{"_id":"@bims-ad/tdm-client","_rev":"2-389ec949eb5923566b0227fb6f89d0de","name":"@bims-ad/tdm-client","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@bims-ad/tdm-client","version":"0.1.0","keywords":["broadcom","tdm","test-data-manager","openapi","api-client","typescript","esm"],"license":"MIT","_id":"@bims-ad/tdm-client@0.1.0","maintainers":[{"name":"ki.alam","email":"ki.alam@broadcom.com"}],"homepage":"https://github.com/zoobroker/broadcom-tdm-client/tree/main/libs/client#readme","bugs":{"url":"https://github.com/zoobroker/broadcom-tdm-client/issues"},"dist":{"shasum":"f8aac9ff8de5581750cad61124349b4713ac92e5","tarball":"https://registry.npmjs.org/@bims-ad/tdm-client/-/tdm-client-0.1.0.tgz","fileCount":654,"integrity":"sha512-bW1Ta0E3DqaUccvF+hYfRHz3yI95mbaFhViRJG9B2iZruffw4xcM8X0lAZwWyw7JETPUJ5orBH7u1gT/0LwHPg==","signatures":[{"sig":"MEUCIDRnj3CyjOJzGnwqyDsQ6FvYXcSELXiZ5Km6FjTa47QVAiEAxw2vhGSdkte1/G3HfV0u/CKa035pp0JcvgIuTieGGNM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3110171},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"5e63110e2abee92176527f149325f003e0f48b11","_npmUser":{"name":"ki.alam","email":"ki.alam@broadcom.com"},"repository":{"url":"git+https://github.com/zoobroker/broadcom-tdm-client.git","type":"git","directory":"libs/client"},"_npmVersion":"11.16.0","description":"TypeScript client for the Broadcom Test Data Manager (TDM) REST API — typed clients for all 13 servlet services, plus an auth-refreshing session, correct pagination, and job-domain helpers.","directories":{},"_nodeVersion":"24.18.0","dependencies":{"axios":"^1.18.1","tslib":"^2.8.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tdm-client_0.1.0_1784421107594_0.14919433090613032","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@bims-ad/tdm-client","version":"0.1.2","description":"TypeScript client for the Broadcom Test Data Manager (TDM) REST API — typed clients for all 13 servlet services, plus an auth-refreshing session, correct pagination, and job-domain helpers.","license":"MIT","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{"./package.json":"./package.json",".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"keywords":["broadcom","tdm","test-data-manager","openapi","api-client","typescript","esm"],"repository":{"type":"git","url":"git+https://github.com/zoobroker/broadcom-tdm-client.git","directory":"libs/client"},"homepage":"https://github.com/zoobroker/broadcom-tdm-client/tree/main/libs/client#readme","bugs":{"url":"https://github.com/zoobroker/broadcom-tdm-client/issues"},"engines":{"node":">=24"},"publishConfig":{"access":"public"},"dependencies":{"axios":"^1.18.1","tslib":"^2.8.1"},"gitHead":"d44b9bb8cda7d8fc4de93a9796b5bcd186c8b4c1","_id":"@bims-ad/tdm-client@0.1.2","_nodeVersion":"24.18.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-DOLiRQeb5IGuCBoi+bjBzXLnOOoRQ2NxNLiZWd1JMZf2WNQYk+jucO3S5Et2Cx5hAjsdRubknlFtfD5/NnLSDw==","shasum":"90cedacbaae5706644488848bad9ac3169dbbd03","tarball":"https://registry.npmjs.org/@bims-ad/tdm-client/-/tdm-client-0.1.2.tgz","fileCount":654,"unpackedSize":3110171,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD6BvSPO6mHdIs8DdU574Mkajve4vFyWJwX98HrkOIBlAIgWXTNpyLzq72ED7G+jwjIErHClA+KXzSUhnLLXj3gIfs="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e16dcb54-daa4-4852-a0f0-d5dd653ce0b8"}},"directories":{},"maintainers":[{"name":"ki.alam","email":"ki.alam@broadcom.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tdm-client_0.1.2_1784429240702_0.8648078941932558"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-19T00:31:47.273Z","modified":"2026-07-19T02:47:20.991Z","0.1.0":"2026-07-19T00:31:47.792Z","0.1.2":"2026-07-19T02:47:20.855Z"},"bugs":{"url":"https://github.com/zoobroker/broadcom-tdm-client/issues"},"license":"MIT","homepage":"https://github.com/zoobroker/broadcom-tdm-client/tree/main/libs/client#readme","keywords":["broadcom","tdm","test-data-manager","openapi","api-client","typescript","esm"],"repository":{"type":"git","url":"git+https://github.com/zoobroker/broadcom-tdm-client.git","directory":"libs/client"},"description":"TypeScript client for the Broadcom Test Data Manager (TDM) REST API — typed clients for all 13 servlet services, plus an auth-refreshing session, correct pagination, and job-domain helpers.","maintainers":[{"name":"ki.alam","email":"ki.alam@broadcom.com"}],"readme":"# @bims-ad/tdm-client\n\nTypeScript clients for the Broadcom Test Data Manager REST API, generated from\nthe OpenAPI 3.1 specs in `swagger/`.\n\n## Shape\n\nThe thirteen TDM specs are thirteen servlet context roots on **one host**\n(`job-engine` → `/TDMJobService`, `publish` → `/TDMPublisherService`, …). They\nshare an origin and a JWT but each needs its own base URL. Two specs declaring\n`POST /api/ca/v1/jobs` are therefore different URLs, not a conflict.\n\n`createTdmClients()` takes the origin and returns one configured client per\nservice. Pass it into any generated operation:\n\n```ts\nimport { createTdmClients, jobEngine } from '@bims-ad/tdm-client';\n\nconst tdm = createTdmClients({\n  origin: 'https://tdm.example.com:8443',\n  token,\n  insecureTls: true, // lab hosts ship self-signed / expired certs\n});\n\nconst jobs = await jobEngine.getAllJobs({ client: tdm.jobEngine, query: { size: 50 } });\n```\n\nAuth: `core` owns `/user/login` and issues the JWT the other twelve consume.\nUse `setTdmToken(tdm, token)` to swap it on already-built clients.\n\n## Domain layer\n\nAbove the raw generated clients sits a thin hand-written domain layer that encodes\nthe operational knowledge the generated types can't (auth lifecycle, the endpoint\ngotchas). Prefer it over wiring auth yourself.\n\n### `createTdmSession` — auth that stays fresh\n\nFor anything long-running (a monitor, a poller), use a **session** instead of a\none-shot login. It takes credentials, logs in, and keeps the JWT current —\n**proactively** before the ~24h expiry and **reactively** on a 401 — so your\ncalls never fail on a stale token. The clients it exposes always carry a valid\ntoken; you never rebuild them.\n\n```ts\nimport { createTdmSession, jobEngine } from '@bims-ad/tdm-client';\n\nconst session = await createTdmSession({\n  origin: 'https://tdm.example.com:8443',\n  username, password,\n  insecureTls: true,\n});\n\nwhile (running) {\n  await session.ensureFresh(); // no-op until the token nears expiry, then re-logs-in\n  const { data } = await jobEngine.getAllJobs({ client: session.clients.jobEngine });\n  // ...\n}\n```\n\n`loginToTdm()` (returning a `TdmLoginResult`) remains available for the one-shot\ncase, but `createTdmSession` is the right default for a live integration. See the\nJSDoc on `TdmSession` for the full contract.\n\n### `paginate()` — correct list paging\n\nTDM list endpoints are 1-indexed (`page=0` aliases page 1) and can repeat a record\nacross pages. `paginate()` encodes that once: give it a `fetchPage(page, size)`\nadapter and a `keyOf`, and it handles 1-indexing, dedup, and the stop conditions\nfor any list endpoint. See its JSDoc for the shape.\n\n### `createJobsApi()` + job helpers\n\nJob-domain operations and field semantics, so you don't re-derive the model's\ntraps. `createJobsApi(session.clients)` gives `recent()`, `get()` (the singular\n`/job/{id}`), and `children()` (the plural `/jobs/{id}`). Pure helpers encode what\nthe generated types can't:\n\n```ts\nimport { createJobsApi, isTerminal, statusOf, jobFilter } from '@bims-ad/tdm-client';\n\nconst jobs = createJobsApi(session.clients);\nconst recent = await jobs.recent({ total: 500, q: jobFilter({ origin: 'flow_origin' }) });\nconst done = recent.filter(isTerminal);           // terminal = status, NOT endTimeL\n```\n\nKey rule baked in: **terminality is decided by `status`, never by `endTimeL`** — a\njob cancelled before it started has no `endTimeL`; one cancelled mid-run has one.\nSee `jobs.ts` JSDoc for `isTerminal`, `durationMs`, `queueLatencyMs`,\n`wasCancelledBeforeStart`, and the singular/plural endpoint distinction.\n\n## Generated code\n\n`src/generated/` is **gitignored**. It is produced by `tools/generate-clients.mjs`\nvia the `generate-clients` Nx target, which `build`, `typecheck`, `test`, and\n`lint` all `dependsOn` — so a fresh clone materializes it on the first command.\nNever edit it; the next run overwrites it.\n\nRegenerate explicitly:\n\n```sh\nbun run generate:clients\n```\n\n## Why axios, not fetch\n\n`@hey-api/client-axios`, not `client-fetch`, because TDM hosts commonly present\nself-signed or expired certificates and may sit behind a proxy. There is no\nsingle fetch code path that handles that on both Node and Bun:\n\n| Approach | Node 24 | Bun 1.3 |\n|---|---|---|\n| `fetch` + `tls: {}` | not an API | works |\n| `fetch` + undici `Agent` | `UND_ERR_INVALID_ARG` | ignored |\n| `undici.fetch` + `Agent` | works | fails |\n| **`axios` + `httpsAgent`** | **works** | **works** |\n\n`axios` gives per-instance TLS and proxy control on both runtimes. The\nalternative — `NODE_TLS_REJECT_UNAUTHORIZED=0` — disables verification\nprocess-wide, which is the wrong scope for one bad certificate.\n\n## Known deviation\n\n`exactOptionalPropertyTypes` is `false` in `tsconfig.lib.json`, against the\nworkspace default. hey-api's output cannot satisfy it and the files are\nmachine-written. Scoped to this project; everything else inherits `true`.\n","readmeFilename":"README.md"}