From c57d7d02ad8873f739289907a863cb1e8dad6288 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 13:52:34 +0000 Subject: [PATCH 1/2] feat!: update environment URLs and add new API fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update base environment URLs from tryvital.io to junction.com domains, add new optional fields to LabReportResult and MealInDbBaseClientFacingSource, introduce new enum types, and add flexible auth override support to BaseClientOptions. Key changes: - Change all JunctionEnvironment URLs from tryvital.io to junction.com (breaking: existing hardcoded URL comparisons will differ) - Add required `calendarDate` field to `MealInDbBaseClientFacingSource` (breaking: existing object literals missing this field won't compile) - Add new `LabReportResultSampleType` and `LabReportResultMeasurementKind` enum types with optional fields on `LabReportResult` - Add `auth` option to `BaseClientOptions` supporting false, function, AuthProvider, or AuthOptions - Fix nullable record value serialization in `Micros`, `SampleData`, and `LabResultsRaw` đŸŒŋ Generated with Fern --- .fern/metadata.json | 8 +- README.md | 12 +- changelog.md | 11 + package.json | 2 +- pnpm-lock.yaml | 72 ++--- src/BaseClient.ts | 29 +- src/api/types/LabReportResult.ts | 4 + .../types/LabReportResultMeasurementKind.ts | 11 + src/api/types/LabReportResultSampleType.ts | 13 + .../types/MealInDbBaseClientFacingSource.ts | 2 + src/api/types/index.ts | 2 + src/core/auth/AuthProvider.ts | 9 + src/core/auth/index.ts | 2 +- src/core/fetcher/requestWithRetries.ts | 6 +- src/core/schemas/builders/enum/enum.ts | 7 + src/core/schemas/builders/enum/index.ts | 2 +- src/environments.ts | 8 +- src/serialization/types/LabReportResult.ts | 6 + .../types/LabReportResultMeasurementKind.ts | 14 + .../types/LabReportResultSampleType.ts | 14 + src/serialization/types/LabResultsRaw.ts | 2 +- .../types/MealInDbBaseClientFacingSource.ts | 2 + src/serialization/types/Micros.ts | 8 +- src/serialization/types/SampleData.ts | 2 +- src/serialization/types/index.ts | 2 + src/version.ts | 2 +- .../fetcher/makePassthroughRequest.test.ts | 2 +- tests/unit/fetcher/requestWithRetries.test.ts | 66 ++++- tests/wire/labReport.test.ts | 4 + tests/wire/labTests.test.ts | 272 +++++++++--------- tests/wire/meal.test.ts | 6 +- tests/wire/sleep.test.ts | 262 ++++++++--------- tests/wire/team.test.ts | 16 +- tests/wire/testkit.test.ts | 40 +-- tests/wire/user.test.ts | 64 ++--- tests/wire/vitals.test.ts | 16 +- 36 files changed, 597 insertions(+), 403 deletions(-) create mode 100644 src/api/types/LabReportResultMeasurementKind.ts create mode 100644 src/api/types/LabReportResultSampleType.ts create mode 100644 src/serialization/types/LabReportResultMeasurementKind.ts create mode 100644 src/serialization/types/LabReportResultSampleType.ts diff --git a/.fern/metadata.json b/.fern/metadata.json index 2d6f936..b42ecf2 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "5.5.1", + "cliVersion": "5.10.2", "generatorName": "fernapi/fern-typescript-sdk", - "generatorVersion": "3.66.1", + "generatorVersion": "3.69.0", "generatorConfig": { "namespaceExport": "Junction", "noSerdeLayer": false, @@ -13,10 +13,10 @@ "packageManager": "pnpm", "testFramework": "vitest" }, - "originGitCommit": "05d79dd6ce370cbd029417f59eb71c056d94aa61", + "originGitCommit": "5f82089cf81f14dcaa4eabeffe1c781fb1679c6e", "originGitCommitIsDirty": true, "invokedBy": "ci", "requestedVersion": "AUTO", "ciProvider": "unknown", - "sdkVersion": "0.0.1" + "sdkVersion": "1.0.0" } diff --git a/README.md b/README.md index dbd1c1e..61e00a5 100644 --- a/README.md +++ b/README.md @@ -588,11 +588,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) Use the `maxRetries` request option to configure this behavior. diff --git a/changelog.md b/changelog.md index 9f803cf..bc4f8dd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,14 @@ +## 1.0.0 - 2026-05-05 +### Breaking Changes +* **`JunctionEnvironment`** URLs have changed from `tryvital.io` to `junction.com` domains — update any hardcoded URL comparisons or overrides to use the new `junction.com` endpoints. +* **`MealInDbBaseClientFacingSource`** now requires a `calendarDate: string` field — add `calendarDate` to any object literals or constructors that build this type. +### Added +* **`LabReportResultSampleType`** and **`LabReportResultMeasurementKind`** — new non-exhaustive enum types exposed as optional fields `sampleType` and `measurementKind` on `LabReportResult`. +* **`AuthOption`** type and `auth` property on `BaseClientOptions` — pass `false` to disable auth, a function, an `AuthProvider`, or auth options to override authentication per-client. +* **`isAuthProvider`** — new exported helper function to type-narrow an unknown value to `AuthProvider`. +### Fixed +* **`Micros`**, **`SampleData`**, and **`LabResultsRaw`** serialization now correctly handles nullable values within record fields. + ## 0.0.1 - 2026-05-01 * Initial SDK generation * đŸŒŋ Generated with Fern diff --git a/package.json b/package.json index adf8dd9..e7148b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@junction-api/sdk", - "version": "0.0.1", + "version": "1.0.0", "private": false, "repository": { "type": "git", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b1468dd..8b598a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -278,8 +278,8 @@ packages: '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} - '@tybys/wasm-util@0.10.1': - resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} + '@tybys/wasm-util@0.10.2': + resolution: {integrity: sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==} '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} @@ -427,8 +427,8 @@ packages: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} - baseline-browser-mapping@2.10.23: - resolution: {integrity: sha512-xwVXGqevyKPsiuQdLj+dZMVjidjJV508TBqexND5HrF89cGdCYCJFB3qhcxRHSeMctdCfbR1jrxBajhDy7o29g==} + baseline-browser-mapping@2.10.25: + resolution: {integrity: sha512-QO/VHsXCQdnzADMfmkeOPvHdIAkoB7i0/rGjINPJEetLx75hNttVWGQ/jycHUDP9zZ9rupbm60WRxcwViB0MiA==} engines: {node: '>=6.0.0'} hasBin: true @@ -488,8 +488,8 @@ packages: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} - electron-to-chromium@1.5.344: - resolution: {integrity: sha512-4MxfbmNDm+KPh066EZy+eUnkcDPcZ35wNmOWzFuh/ijvHsve6kbLTLURy88uCNK5FbpN+yk2nQY6BYh1GEt+wg==} + electron-to-chromium@1.5.348: + resolution: {integrity: sha512-QC2X59nRlycQQMc4ZXjSVBX+tSgJfgRtcrYHbIZLgOV2dCvefoQGegLR7lLXKgpPpSuVmJU19LMzGrSa2C7k3Q==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -701,8 +701,8 @@ packages: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} - nanoid@3.3.11: - resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} + nanoid@3.3.12: + resolution: {integrity: sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true @@ -735,8 +735,8 @@ packages: resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} - postcss@8.5.12: - resolution: {integrity: sha512-W62t/Se6rA0Az3DfCL0AqJwXuKwBeYg6nOaIgzP+xZ7N5BFCI7DYi1qs6ygUYT6rvfi6t9k65UMLJC+PHZpDAA==} + postcss@8.5.13: + resolution: {integrity: sha512-qif0+jGGZoLWdHey3UFHHWP0H7Gbmsk8T5VEqyYFbWqPr1XqvLGBbk/sl8V5exGmcYJklJOhOQq1pV9IcsiFag==} engines: {node: ^10 || ^12 || >=14} require-directory@2.1.1: @@ -843,8 +843,8 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} - tinyexec@1.1.1: - resolution: {integrity: sha512-VKS/ZaQhhkKFMANmAOhhXVoIfBXblQxGX1myCQ2faQrfmobMftXeJPcZGp0gS07ocvGJWDLZGyOZDadDBqYIJg==} + tinyexec@1.1.2: + resolution: {integrity: sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA==} engines: {node: '>=18'} tinyglobby@0.2.16: @@ -855,11 +855,11 @@ packages: resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==} engines: {node: '>=14.0.0'} - tldts-core@7.0.28: - resolution: {integrity: sha512-7W5Efjhsc3chVdFhqtaU0KtK32J37Zcr9RKtID54nG+tIpcY79CQK/veYPODxtD/LJ4Lue66jvrQzIX2Z2/pUQ==} + tldts-core@7.0.29: + resolution: {integrity: sha512-W99NuU7b1DcG3uJ3v9k9VztCH3WialNbBkBft5wCs8V8mexu0XQqaZEYb9l9RNNzK8+3EJ9PKWB0/RUtTQ/o+Q==} - tldts@7.0.28: - resolution: {integrity: sha512-+Zg3vWhRUv8B1maGSTFdev9mjoo8Etn2Ayfs4cnjlD3CsGkxXX4QyW3j2WJ0wdjYcYmy7Lx2RDsZMhgCWafKIw==} + tldts@7.0.29: + resolution: {integrity: sha512-JIXCerhudr/N6OWLwLF1HVsTTUo7ry6qHa5eWZEkiMuxsIiAACL55tGLfqfHfoH7QaMQUW8fngD7u7TxWexYQg==} hasBin: true to-regex-range@5.0.1: @@ -986,8 +986,8 @@ packages: resolution: {integrity: sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==} engines: {node: '>=10.13.0'} - webpack-sources@3.4.0: - resolution: {integrity: sha512-gHwIe1cgBvvfLeu1Yz/dcFpmHfKDVxxyqI+kzqmuxZED81z2ChxpyqPaWcNqigPywhaEke7AjSGga+kxY55gjQ==} + webpack-sources@3.4.1: + resolution: {integrity: sha512-eACpxRN02yaawnt+uUNIF7Qje6A9zArxBbcAJjK1PK3S9Ycg5jIuJ8pW4q8EMnwNZCEGltcjkRx1QzOxOkKD8A==} engines: {node: '>=10.13.0'} webpack@5.106.2: @@ -1150,7 +1150,7 @@ snapshots: dependencies: '@emnapi/core': 1.10.0 '@emnapi/runtime': 1.10.0 - '@tybys/wasm-util': 0.10.1 + '@tybys/wasm-util': 0.10.2 optional: true '@open-draft/deferred-promise@2.2.0': {} @@ -1217,7 +1217,7 @@ snapshots: '@standard-schema/spec@1.1.0': {} - '@tybys/wasm-util@0.10.1': + '@tybys/wasm-util@0.10.2': dependencies: tslib: 2.8.1 optional: true @@ -1403,7 +1403,7 @@ snapshots: assertion-error@2.0.1: {} - baseline-browser-mapping@2.10.23: {} + baseline-browser-mapping@2.10.25: {} braces@3.0.3: dependencies: @@ -1411,9 +1411,9 @@ snapshots: browserslist@4.28.2: dependencies: - baseline-browser-mapping: 2.10.23 + baseline-browser-mapping: 2.10.25 caniuse-lite: 1.0.30001791 - electron-to-chromium: 1.5.344 + electron-to-chromium: 1.5.348 node-releases: 2.0.38 update-browserslist-db: 1.2.3(browserslist@4.28.2) @@ -1452,7 +1452,7 @@ snapshots: detect-libc@2.1.2: {} - electron-to-chromium@1.5.344: {} + electron-to-chromium@1.5.348: {} emoji-regex@8.0.0: {} @@ -1619,7 +1619,7 @@ snapshots: mute-stream@2.0.0: {} - nanoid@3.3.11: {} + nanoid@3.3.12: {} neo-async@2.6.2: {} @@ -1639,9 +1639,9 @@ snapshots: picomatch@4.0.4: {} - postcss@8.5.12: + postcss@8.5.13: dependencies: - nanoid: 3.3.11 + nanoid: 3.3.12 picocolors: 1.1.1 source-map-js: 1.2.1 @@ -1741,7 +1741,7 @@ snapshots: tinybench@2.9.0: {} - tinyexec@1.1.1: {} + tinyexec@1.1.2: {} tinyglobby@0.2.16: dependencies: @@ -1750,11 +1750,11 @@ snapshots: tinyrainbow@3.1.0: {} - tldts-core@7.0.28: {} + tldts-core@7.0.29: {} - tldts@7.0.28: + tldts@7.0.29: dependencies: - tldts-core: 7.0.28 + tldts-core: 7.0.29 to-regex-range@5.0.1: dependencies: @@ -1762,7 +1762,7 @@ snapshots: tough-cookie@6.0.1: dependencies: - tldts: 7.0.28 + tldts: 7.0.29 ts-loader@9.5.7(typescript@5.9.3)(webpack@5.106.2): dependencies: @@ -1793,7 +1793,7 @@ snapshots: dependencies: lightningcss: 1.32.0 picomatch: 4.0.4 - postcss: 8.5.12 + postcss: 8.5.13 rolldown: 1.0.0-rc.17 tinyglobby: 0.2.16 optionalDependencies: @@ -1818,7 +1818,7 @@ snapshots: picomatch: 4.0.4 std-env: 4.1.0 tinybench: 2.9.0 - tinyexec: 1.1.1 + tinyexec: 1.1.2 tinyglobby: 0.2.16 tinyrainbow: 3.1.0 vite: 8.0.10(@types/node@18.19.130)(terser@5.46.2) @@ -1833,7 +1833,7 @@ snapshots: glob-to-regexp: 0.4.1 graceful-fs: 4.2.11 - webpack-sources@3.4.0: {} + webpack-sources@3.4.1: {} webpack@5.106.2: dependencies: @@ -1860,7 +1860,7 @@ snapshots: tapable: 2.3.3 terser-webpack-plugin: 5.5.0(webpack@5.106.2) watchpack: 2.5.1 - webpack-sources: 3.4.0 + webpack-sources: 3.4.1 transitivePeerDependencies: - '@swc/core' - esbuild diff --git a/src/BaseClient.ts b/src/BaseClient.ts index a5fc832..e5961bf 100644 --- a/src/BaseClient.ts +++ b/src/BaseClient.ts @@ -5,6 +5,12 @@ import { mergeHeaders } from "./core/headers.js"; import * as core from "./core/index.js"; import type * as environments from "./environments.js"; +export type AuthOption = + | false + | core.AuthProvider["getAuthRequest"] + | core.AuthProvider + | HeaderAuthProvider.AuthOptions; + export type BaseClientOptions = { environment?: core.Supplier; /** Specify a custom URL to connect the client to. */ @@ -19,6 +25,8 @@ export type BaseClientOptions = { fetch?: typeof fetch; /** Configure logging for the client. */ logging?: core.logging.LogConfig | core.logging.Logger; + /** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */ + auth?: AuthOption; } & HeaderAuthProvider.AuthOptions; export interface BaseRequestOptions { @@ -51,8 +59,8 @@ export function normalizeClientOptions { const normalized = normalizeClientOptions(options) as NormalizedClientOptionsWithAuth; + + if (options.auth === false) { + normalized.authProvider = new core.NoOpAuthProvider(); + return normalized; + } + if (options.auth != null) { + if (typeof options.auth === "function") { + normalized.authProvider = { getAuthRequest: options.auth }; + return normalized; + } + if (core.isAuthProvider(options.auth)) { + normalized.authProvider = options.auth; + return normalized; + } + Object.assign(normalized, options.auth); + } + const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized); normalized.authProvider ??= new HeaderAuthProvider(normalizedWithNoOpAuthProvider); return normalized; diff --git a/src/api/types/LabReportResult.ts b/src/api/types/LabReportResult.ts index 578124f..2ce5519 100644 --- a/src/api/types/LabReportResult.ts +++ b/src/api/types/LabReportResult.ts @@ -6,6 +6,10 @@ export interface LabReportResult { testName: string; value: string; /** â„šī¸ This enum is non-exhaustive. */ + sampleType?: Junction.LabReportResultSampleType; + /** â„šī¸ This enum is non-exhaustive. */ + measurementKind?: Junction.LabReportResultMeasurementKind; + /** â„šī¸ This enum is non-exhaustive. */ type?: Junction.LabReportResultType | null; units?: string | null; maxReferenceRange?: number | null; diff --git a/src/api/types/LabReportResultMeasurementKind.ts b/src/api/types/LabReportResultMeasurementKind.ts new file mode 100644 index 0000000..06f5648 --- /dev/null +++ b/src/api/types/LabReportResultMeasurementKind.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** â„šī¸ This enum is non-exhaustive. */ +export const LabReportResultMeasurementKind = { + Direct: "direct", + Calculated: "calculated", + Ratio: "ratio", + Unknown: "unknown", +} as const; +export type LabReportResultMeasurementKind = + (typeof LabReportResultMeasurementKind)[keyof typeof LabReportResultMeasurementKind]; diff --git a/src/api/types/LabReportResultSampleType.ts b/src/api/types/LabReportResultSampleType.ts new file mode 100644 index 0000000..f55640b --- /dev/null +++ b/src/api/types/LabReportResultSampleType.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +/** â„šī¸ This enum is non-exhaustive. */ +export const LabReportResultSampleType = { + Urine: "urine", + SerumPlasmaBlood: "serum_plasma_blood", + CapillaryBlood: "capillary_blood", + Stool: "stool", + Saliva: "saliva", + Other: "other", + Unknown: "unknown", +} as const; +export type LabReportResultSampleType = (typeof LabReportResultSampleType)[keyof typeof LabReportResultSampleType]; diff --git a/src/api/types/MealInDbBaseClientFacingSource.ts b/src/api/types/MealInDbBaseClientFacingSource.ts index 56ea986..7a5da3b 100644 --- a/src/api/types/MealInDbBaseClientFacingSource.ts +++ b/src/api/types/MealInDbBaseClientFacingSource.ts @@ -12,6 +12,8 @@ export interface MealInDbBaseClientFacingSource { /** This value is identical to `id`. */ providerId: string; timestamp: Date; + /** Date of the meal in the YYYY-mm-dd format. For providers that only expose a date, this is the calendar date as recorded by the user. */ + calendarDate: string; name: string; energy?: Junction.Energy | null; macros?: Junction.Macros | null; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 75d1309..2bfa960 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -575,6 +575,8 @@ export * from "./LabAccountStatus.js"; export * from "./LabLocationCapability.js"; export * from "./LabLocationMetadata.js"; export * from "./LabReportResult.js"; +export * from "./LabReportResultMeasurementKind.js"; +export * from "./LabReportResultSampleType.js"; export * from "./LabReportResultType.js"; export * from "./LabResultsMetadata.js"; export * from "./LabResultsRaw.js"; diff --git a/src/core/auth/AuthProvider.ts b/src/core/auth/AuthProvider.ts index 895a50f..c947866 100644 --- a/src/core/auth/AuthProvider.ts +++ b/src/core/auth/AuthProvider.ts @@ -4,3 +4,12 @@ import type { AuthRequest } from "./AuthRequest.js"; export interface AuthProvider { getAuthRequest(arg?: { endpointMetadata?: EndpointMetadata }): Promise; } + +export function isAuthProvider(value: unknown): value is AuthProvider { + return ( + typeof value === "object" && + value !== null && + "getAuthRequest" in value && + typeof value.getAuthRequest === "function" + ); +} diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts index 2215b22..77effd0 100644 --- a/src/core/auth/index.ts +++ b/src/core/auth/index.ts @@ -1,4 +1,4 @@ -export type { AuthProvider } from "./AuthProvider.js"; +export { type AuthProvider, isAuthProvider } from "./AuthProvider.js"; export type { AuthRequest } from "./AuthRequest.js"; export { BasicAuth } from "./BasicAuth.js"; export { BearerToken } from "./BearerToken.js"; diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts index 1f68968..5e66b93 100644 --- a/src/core/fetcher/requestWithRetries.ts +++ b/src/core/fetcher/requestWithRetries.ts @@ -3,6 +3,10 @@ const MAX_RETRY_DELAY = 60000; // in milliseconds const DEFAULT_MAX_RETRIES = 2; const JITTER_FACTOR = 0.2; // 20% random jitter +function isRetryableStatusCode(statusCode: number): boolean { + return [408, 429].includes(statusCode) || statusCode >= 500; +} + function addPositiveJitter(delay: number): number { const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR; return delay * jitterMultiplier; @@ -51,7 +55,7 @@ export async function requestWithRetries( let response: Response = await requestFn(); for (let i = 0; i < maxRetries; ++i) { - if ([408, 429].includes(response.status) || response.status >= 500) { + if (isRetryableStatusCode(response.status)) { const delay = getRetryDelayFromHeaders(response, i); await new Promise((resolve) => setTimeout(resolve, delay)); diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts index ccae24b..2f2777c 100644 --- a/src/core/schemas/builders/enum/enum.ts +++ b/src/core/schemas/builders/enum/enum.ts @@ -41,3 +41,10 @@ export function enum_(values: E): Schema(values: E): Schema { + return enum_(values).transform({ + transform: (val) => val, + untransform: (val) => val, + }); +} diff --git a/src/core/schemas/builders/enum/index.ts b/src/core/schemas/builders/enum/index.ts index ff3bee3..2ff90af 100644 --- a/src/core/schemas/builders/enum/index.ts +++ b/src/core/schemas/builders/enum/index.ts @@ -1 +1 @@ -export { enum_ } from "./enum.js"; +export { enum_, forwardCompatibleEnum_ } from "./enum.js"; diff --git a/src/environments.ts b/src/environments.ts index 7f9badd..ab6b268 100644 --- a/src/environments.ts +++ b/src/environments.ts @@ -1,10 +1,10 @@ // This file was auto-generated by Fern from our API Definition. export const JunctionEnvironment = { - Production: "https://api.tryvital.io", - ProductionEu: "https://api.eu.tryvital.io", - Sandbox: "https://api.sandbox.tryvital.io", - SandboxEu: "https://api.sandbox.eu.tryvital.io", + Production: "https://api.us.junction.com", + ProductionEu: "https://api.eu.junction.com", + Sandbox: "https://api.sandbox.us.junction.com", + SandboxEu: "https://api.sandbox.eu.junction.com", } as const; export type JunctionEnvironment = diff --git a/src/serialization/types/LabReportResult.ts b/src/serialization/types/LabReportResult.ts index f90670b..cc43947 100644 --- a/src/serialization/types/LabReportResult.ts +++ b/src/serialization/types/LabReportResult.ts @@ -4,6 +4,8 @@ import type * as Junction from "../../api/index.js"; import * as core from "../../core/index.js"; import type * as serializers from "../index.js"; import { Interpretation } from "./Interpretation.js"; +import { LabReportResultMeasurementKind } from "./LabReportResultMeasurementKind.js"; +import { LabReportResultSampleType } from "./LabReportResultSampleType.js"; import { LabReportResultType } from "./LabReportResultType.js"; import { LoincMatch } from "./LoincMatch.js"; @@ -13,6 +15,8 @@ export const LabReportResult: core.serialization.ObjectSchema< > = core.serialization.object({ testName: core.serialization.property("test_name", core.serialization.string()), value: core.serialization.string(), + sampleType: core.serialization.property("sample_type", LabReportResultSampleType.optional()), + measurementKind: core.serialization.property("measurement_kind", LabReportResultMeasurementKind.optional()), type: LabReportResultType.optionalNullable(), units: core.serialization.string().optionalNullable(), maxReferenceRange: core.serialization.property( @@ -34,6 +38,8 @@ export declare namespace LabReportResult { export interface Raw { test_name: string; value: string; + sample_type?: LabReportResultSampleType.Raw | null; + measurement_kind?: LabReportResultMeasurementKind.Raw | null; type?: (LabReportResultType.Raw | null | undefined) | null; units?: (string | null | undefined) | null; max_reference_range?: (number | null | undefined) | null; diff --git a/src/serialization/types/LabReportResultMeasurementKind.ts b/src/serialization/types/LabReportResultMeasurementKind.ts new file mode 100644 index 0000000..b05f978 --- /dev/null +++ b/src/serialization/types/LabReportResultMeasurementKind.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Junction from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const LabReportResultMeasurementKind: core.serialization.Schema< + serializers.LabReportResultMeasurementKind.Raw, + Junction.LabReportResultMeasurementKind +> = core.serialization.enum_(["direct", "calculated", "ratio", "unknown"]); + +export declare namespace LabReportResultMeasurementKind { + export type Raw = "direct" | "calculated" | "ratio" | "unknown"; +} diff --git a/src/serialization/types/LabReportResultSampleType.ts b/src/serialization/types/LabReportResultSampleType.ts new file mode 100644 index 0000000..2b76b96 --- /dev/null +++ b/src/serialization/types/LabReportResultSampleType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Junction from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const LabReportResultSampleType: core.serialization.Schema< + serializers.LabReportResultSampleType.Raw, + Junction.LabReportResultSampleType +> = core.serialization.enum_(["urine", "serum_plasma_blood", "capillary_blood", "stool", "saliva", "other", "unknown"]); + +export declare namespace LabReportResultSampleType { + export type Raw = "urine" | "serum_plasma_blood" | "capillary_blood" | "stool" | "saliva" | "other" | "unknown"; +} diff --git a/src/serialization/types/LabResultsRaw.ts b/src/serialization/types/LabResultsRaw.ts index 5b1a17a..1335a82 100644 --- a/src/serialization/types/LabResultsRaw.ts +++ b/src/serialization/types/LabResultsRaw.ts @@ -19,7 +19,7 @@ export const LabResultsRaw: core.serialization.ObjectSchema = core.serialization.object({ minerals: core.serialization - .record(core.serialization.string(), core.serialization.number()) + .record(core.serialization.string(), core.serialization.number().nullable()) .optionalNullable(), traceElements: core.serialization.property( "trace_elements", - core.serialization.record(core.serialization.string(), core.serialization.number()).optionalNullable(), + core.serialization + .record(core.serialization.string(), core.serialization.number().nullable()) + .optionalNullable(), ), vitamins: core.serialization - .record(core.serialization.string(), core.serialization.number()) + .record(core.serialization.string(), core.serialization.number().nullable()) .optionalNullable(), }); diff --git a/src/serialization/types/SampleData.ts b/src/serialization/types/SampleData.ts index 49e1df5..7d65a47 100644 --- a/src/serialization/types/SampleData.ts +++ b/src/serialization/types/SampleData.ts @@ -18,7 +18,7 @@ export const SampleData: core.serialization.ObjectSchema { }); it("should use requestOptions maxRetries over client maxRetries", async () => { - mockFetch.mockResolvedValue(new Response("", { status: 500 })); + mockFetch.mockResolvedValue(new Response("", { status: 502 })); vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts index d226613..7c98c0a 100644 --- a/tests/unit/fetcher/requestWithRetries.test.ts +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -36,13 +36,13 @@ describe("requestWithRetries", () => { vi.clearAllTimers(); }); - it("should retry on retryable status codes", async () => { + it("should retry on retryable status codes (legacy mode)", async () => { setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); - const retryableStatuses = [408, 429, 500, 502]; + const retryableStatuses = [408, 429, 500, 501, 502, 503, 504, 505]; let callCount = 0; mockFetch.mockImplementation(async () => { @@ -60,6 +60,24 @@ describe("requestWithRetries", () => { expect(response.status).toBe(200); }); + it("should retry on 500 Internal Server Error in legacy mode", async () => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + mockFetch + .mockResolvedValueOnce(new Response("", { status: 500 })) + .mockResolvedValueOnce(new Response("", { status: 200 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + await vi.runAllTimersAsync(); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(2); + expect(response.status).toBe(200); + }); + it("should respect maxRetries limit", async () => { setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); @@ -67,14 +85,48 @@ describe("requestWithRetries", () => { }); const maxRetries = 2; - mockFetch.mockResolvedValue(new Response("", { status: 500 })); + mockFetch.mockResolvedValue(new Response("", { status: 503 })); const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); await vi.runAllTimersAsync(); const response = await responsePromise; expect(mockFetch).toHaveBeenCalledTimes(maxRetries + 1); - expect(response.status).toBe(500); + expect(response.status).toBe(503); + }); + + it("should retry on status 599 (upper boundary of retryable 5xx in legacy mode)", async () => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + mockFetch + .mockResolvedValueOnce(new Response("", { status: 599 })) + .mockResolvedValueOnce(new Response("", { status: 200 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + await vi.runAllTimersAsync(); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(2); + expect(response.status).toBe(200); + }); + + it("should not retry on non-retryable client error (400)", async () => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + mockFetch.mockResolvedValueOnce(new Response("", { status: 400 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + await vi.runAllTimersAsync(); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(1); + expect(response.status).toBe(400); }); it("should not retry on success status codes", async () => { @@ -166,7 +218,7 @@ describe("requestWithRetries", () => { return null as any; }); - mockFetch.mockResolvedValue(new Response("", { status: 500 })); + mockFetch.mockResolvedValue(new Response("", { status: 502 })); const maxRetries = 3; const expectedDelays = [1000, 2000, 4000]; @@ -190,8 +242,8 @@ describe("requestWithRetries", () => { }); mockFetch - .mockResolvedValueOnce(new Response("", { status: 500 })) - .mockResolvedValueOnce(new Response("", { status: 500 })) + .mockResolvedValueOnce(new Response("", { status: 502 })) + .mockResolvedValueOnce(new Response("", { status: 502 })) .mockResolvedValueOnce(new Response("", { status: 200 })) .mockResolvedValueOnce(new Response("", { status: 200 })); diff --git a/tests/wire/labReport.test.ts b/tests/wire/labReport.test.ts index a8b321b..e4afa25 100644 --- a/tests/wire/labReport.test.ts +++ b/tests/wire/labReport.test.ts @@ -28,6 +28,8 @@ describe("LabReportClient", () => { { test_name: "Glucose", value: "90", + sample_type: "serum_plasma_blood", + measurement_kind: "direct", type: "numeric", units: "mg/dL", max_reference_range: 99, @@ -82,6 +84,8 @@ describe("LabReportClient", () => { { testName: "Glucose", value: "90", + sampleType: "serum_plasma_blood", + measurementKind: "direct", type: "numeric", units: "mg/dL", maxReferenceRange: 99, diff --git a/tests/wire/labTests.test.ts b/tests/wire/labTests.test.ts index 7cbce90..8c6e00b 100644 --- a/tests/wire/labTests.test.ts +++ b/tests/wire/labTests.test.ts @@ -1416,9 +1416,9 @@ describe("LabTestsClient", () => { const rawResponseBody = { orders: [ { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { dob: "2020-01-01T00:00:00Z", gender: "male" }, patient_address: { receiver_name: "John Doe", @@ -1483,9 +1483,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -1596,9 +1596,9 @@ describe("LabTestsClient", () => { expect(response).toEqual({ orders: [ { - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { dob: new Date("2020-01-01T00:00:00.000Z"), gender: "male", @@ -1672,9 +1672,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", @@ -1896,10 +1896,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { booking_key: "booking_key" }; const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -1946,10 +1946,10 @@ describe("LabTestsClient", () => { }, }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -2029,10 +2029,10 @@ describe("LabTestsClient", () => { provider: "getlabs", }; const rawResponseBody = { - id: "457f7df9-6038-4acb-8083-a9b6bb9a2ecb", - user_id: "8b347e4a-a0e7-4742-a250-eb5e1179ae28", - order_id: "ed53183d-470c-444d-b836-17abfb08255d", - order_transaction_id: "4eb58e4a-d8a4-40e7-89fe-040484d692c4", + id: "466a125e-887f-478b-beb8-cc8277036362", + user_id: "d1c2ac01-53d0-43f7-b8db-e961a212d6ae", + order_id: "db507174-482d-46d1-8789-720b9b578552", + order_transaction_id: "5421f8f6-1844-4516-8afd-9fd329ce79d4", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -2080,10 +2080,10 @@ describe("LabTestsClient", () => { provider: "getlabs", }); expect(response).toEqual({ - id: "457f7df9-6038-4acb-8083-a9b6bb9a2ecb", - userId: "8b347e4a-a0e7-4742-a250-eb5e1179ae28", - orderId: "ed53183d-470c-444d-b836-17abfb08255d", - orderTransactionId: "4eb58e4a-d8a4-40e7-89fe-040484d692c4", + id: "466a125e-887f-478b-beb8-cc8277036362", + userId: "d1c2ac01-53d0-43f7-b8db-e961a212d6ae", + orderId: "db507174-482d-46d1-8789-720b9b578552", + orderTransactionId: "5421f8f6-1844-4516-8afd-9fd329ce79d4", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -2160,10 +2160,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { booking_key: "booking_key" }; const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -2210,10 +2210,10 @@ describe("LabTestsClient", () => { }, }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -2290,10 +2290,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { cancellation_reason_id: "cancellation_reason_id" }; const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -2338,10 +2338,10 @@ describe("LabTestsClient", () => { cancellationReasonId: "cancellation_reason_id", }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -2416,7 +2416,7 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = [ - { id: "783e52b9-75db-4040-8ae4-d02cac3b3463", name: "I'm feeling sick", is_refundable: true }, + { id: "853c53ee-b2cb-4929-bc1e-98458264f228", name: "I'm feeling sick", is_refundable: true }, ]; server @@ -2430,7 +2430,7 @@ describe("LabTestsClient", () => { const response = await client.labTests.getPhlebotomyAppointmentCancellationReason(); expect(response).toEqual([ { - id: "783e52b9-75db-4040-8ae4-d02cac3b3463", + id: "853c53ee-b2cb-4929-bc1e-98458264f228", name: "I'm feeling sick", isRefundable: true, }, @@ -2442,10 +2442,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -2488,10 +2488,10 @@ describe("LabTestsClient", () => { orderId: "order_id", }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -3190,10 +3190,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { booking_key: "booking_key" }; const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -3240,10 +3240,10 @@ describe("LabTestsClient", () => { }, }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -3320,10 +3320,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { booking_key: "booking_key" }; const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -3370,10 +3370,10 @@ describe("LabTestsClient", () => { }, }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -3450,10 +3450,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { cancellationReasonId: "cancellationReasonId" }; const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -3498,10 +3498,10 @@ describe("LabTestsClient", () => { cancellationReasonId: "cancellationReasonId", }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -3576,7 +3576,7 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = [ - { id: "783e52b9-75db-4040-8ae4-d02cac3b3463", name: "I'm feeling sick", is_refundable: true }, + { id: "853c53ee-b2cb-4929-bc1e-98458264f228", name: "I'm feeling sick", is_refundable: true }, ]; server @@ -3590,7 +3590,7 @@ describe("LabTestsClient", () => { const response = await client.labTests.getPscAppointmentCancellationReason(); expect(response).toEqual([ { - id: "783e52b9-75db-4040-8ae4-d02cac3b3463", + id: "853c53ee-b2cb-4929-bc1e-98458264f228", name: "I'm feeling sick", isRefundable: true, }, @@ -3602,10 +3602,10 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - user_id: "5ae51b66-2f16-4330-8a68-ecffba882c73", - order_id: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - order_transaction_id: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + user_id: "19abc712-bf15-43dd-8a16-179a106e2237", + order_id: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + order_transaction_id: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { first_line: "123 Main St.", second_line: "Apt. 208", @@ -3648,10 +3648,10 @@ describe("LabTestsClient", () => { orderId: "order_id", }); expect(response).toEqual({ - id: "78fbe5d7-6ba2-4611-a4f9-46a1d8a9e5ee", - userId: "5ae51b66-2f16-4330-8a68-ecffba882c73", - orderId: "1b3a0ab3-2aaa-47a6-8e8e-13a37162da86", - orderTransactionId: "48cb3895-80cf-46c6-ab7d-2ebafcc6cf73", + id: "6e06eac5-228b-47cb-9e4b-54301e560dad", + userId: "19abc712-bf15-43dd-8a16-179a106e2237", + orderId: "a64b8c71-bd97-48e0-a6b1-f8415266a491", + orderTransactionId: "eb59b200-a00e-49e5-8d4c-d62b948c7098", address: { firstLine: "123 Main St.", secondLine: "Apt. 208", @@ -3724,9 +3724,9 @@ describe("LabTestsClient", () => { const client = new JunctionClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { first_name: "first_name", last_name: "last_name", @@ -3817,9 +3817,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -3918,9 +3918,9 @@ describe("LabTestsClient", () => { orderId: "order_id", }); expect(response).toEqual({ - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -4023,9 +4023,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", @@ -4155,9 +4155,9 @@ describe("LabTestsClient", () => { }; const rawResponseBody = { order: { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { first_name: "first_name", last_name: "last_name", @@ -4251,9 +4251,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -4363,9 +4363,9 @@ describe("LabTestsClient", () => { }); expect(response).toEqual({ order: { - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -4465,9 +4465,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", @@ -4641,9 +4641,9 @@ describe("LabTestsClient", () => { }; const rawResponseBody = { order: { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { first_name: "first_name", last_name: "last_name", @@ -4737,9 +4737,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -4854,9 +4854,9 @@ describe("LabTestsClient", () => { }); expect(response).toEqual({ order: { - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -4956,9 +4956,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", @@ -5126,9 +5126,9 @@ describe("LabTestsClient", () => { const rawResponseBody = { order: { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { first_name: "first_name", last_name: "last_name", @@ -5222,9 +5222,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -5318,9 +5318,9 @@ describe("LabTestsClient", () => { }); expect(response).toEqual({ order: { - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -5420,9 +5420,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", @@ -5594,9 +5594,9 @@ describe("LabTestsClient", () => { const rawResponseBody = { order: { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { first_name: "first_name", last_name: "last_name", @@ -5690,9 +5690,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -5786,9 +5786,9 @@ describe("LabTestsClient", () => { }); expect(response).toEqual({ order: { - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -5888,9 +5888,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", diff --git a/tests/wire/meal.test.ts b/tests/wire/meal.test.ts index 2d7c070..fa6e0e2 100644 --- a/tests/wire/meal.test.ts +++ b/tests/wire/meal.test.ts @@ -17,7 +17,8 @@ describe("MealClient", () => { priority_id: 42, source_id: 10, provider_id: "123456", - timestamp: "2019-08-24T14:15:22Z", + timestamp: "2019-08-24T00:00:00Z", + calendar_date: "2019-08-24", name: "Dinner", energy: { unit: "kcal", value: 1.1 }, macros: {}, @@ -82,7 +83,8 @@ describe("MealClient", () => { priorityId: 42, sourceId: 10, providerId: "123456", - timestamp: new Date("2019-08-24T14:15:22.000Z"), + timestamp: new Date("2019-08-24T00:00:00.000Z"), + calendarDate: "2019-08-24", name: "Dinner", energy: { unit: "kcal", diff --git a/tests/wire/sleep.test.ts b/tests/wire/sleep.test.ts index bd70a65..146f2bc 100644 --- a/tests/wire/sleep.test.ts +++ b/tests/wire/sleep.test.ts @@ -42,40 +42,40 @@ describe("SleepClient", () => { source: { provider: "oura", type: "unknown", device_id: "550e8400-e29b-41d4-a716-446655440000" }, sleep_stream: { hrv: [ - { id: 0, unit: "rmssd", timestamp: "2026-04-30T17:37:44Z", value: 53 }, - { id: 1, unit: "rmssd", timestamp: "2026-04-30T17:38:14Z", value: 95 }, - { id: 2, unit: "rmssd", timestamp: "2026-04-30T17:38:44Z", value: 59 }, - { id: 3, unit: "rmssd", timestamp: "2026-04-30T17:39:14Z", value: 8 }, - { id: 4, unit: "rmssd", timestamp: "2026-04-30T17:39:44Z", value: 70 }, + { id: 0, unit: "rmssd", timestamp: "2026-05-05T13:33:54Z", value: 4 }, + { id: 1, unit: "rmssd", timestamp: "2026-05-05T13:34:24Z", value: 95 }, + { id: 2, unit: "rmssd", timestamp: "2026-05-05T13:34:54Z", value: 87 }, + { id: 3, unit: "rmssd", timestamp: "2026-05-05T13:35:24Z", value: 52 }, + { id: 4, unit: "rmssd", timestamp: "2026-05-05T13:35:54Z", value: 38 }, ], heartrate: [ - { id: 0, unit: "bpm", timestamp: "2026-04-30T17:37:44Z", value: 52 }, - { id: 1, unit: "bpm", timestamp: "2026-04-30T17:38:14Z", value: 104 }, - { id: 2, unit: "bpm", timestamp: "2026-04-30T17:38:44Z", value: 20 }, - { id: 3, unit: "bpm", timestamp: "2026-04-30T17:39:14Z", value: 116 }, - { id: 4, unit: "bpm", timestamp: "2026-04-30T17:39:44Z", value: 95 }, + { id: 0, unit: "bpm", timestamp: "2026-05-05T13:33:54Z", value: 79 }, + { id: 1, unit: "bpm", timestamp: "2026-05-05T13:34:24Z", value: 156 }, + { id: 2, unit: "bpm", timestamp: "2026-05-05T13:34:54Z", value: 183 }, + { id: 3, unit: "bpm", timestamp: "2026-05-05T13:35:24Z", value: 4 }, + { id: 4, unit: "bpm", timestamp: "2026-05-05T13:35:54Z", value: 176 }, ], hypnogram: [ { id: 0, unit: "stage", - timestamp: "2026-04-30T17:37:44Z", + timestamp: "2026-05-05T13:33:54Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: 0, }, { id: 1, unit: "stage", - timestamp: "2026-04-30T17:38:14Z", + timestamp: "2026-05-05T13:34:24Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 0, + value: 1, }, { id: 2, unit: "stage", - timestamp: "2026-04-30T17:38:44Z", + timestamp: "2026-05-05T13:34:54Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", value: 2, @@ -83,26 +83,26 @@ describe("SleepClient", () => { { id: 3, unit: "stage", - timestamp: "2026-04-30T17:39:14Z", + timestamp: "2026-05-05T13:35:24Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 0, + value: 2, }, { id: 4, unit: "stage", - timestamp: "2026-04-30T17:39:44Z", + timestamp: "2026-05-05T13:35:54Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: -1, }, ], respiratory_rate: [ - { id: 0, unit: "bpm", timestamp: "2026-04-30T17:37:44Z", value: 23 }, - { id: 1, unit: "bpm", timestamp: "2026-04-30T17:38:14Z", value: 30 }, - { id: 2, unit: "bpm", timestamp: "2026-04-30T17:38:44Z", value: 17 }, - { id: 3, unit: "bpm", timestamp: "2026-04-30T17:39:14Z", value: 20 }, - { id: 4, unit: "bpm", timestamp: "2026-04-30T17:39:44Z", value: 12 }, + { id: 0, unit: "bpm", timestamp: "2026-05-05T13:33:54Z", value: 30 }, + { id: 1, unit: "bpm", timestamp: "2026-05-05T13:34:24Z", value: 21 }, + { id: 2, unit: "bpm", timestamp: "2026-05-05T13:34:54Z", value: 8 }, + { id: 3, unit: "bpm", timestamp: "2026-05-05T13:35:24Z", value: 29 }, + { id: 4, unit: "bpm", timestamp: "2026-05-05T13:35:54Z", value: 22 }, ], }, created_at: "2023-02-27T20:31:24Z", @@ -165,87 +165,87 @@ describe("SleepClient", () => { { id: 0, unit: "rmssd", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 53, + timestamp: new Date("2026-05-05T13:33:54.000Z"), + value: 4, }, { id: 1, unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:14.000Z"), + timestamp: new Date("2026-05-05T13:34:24.000Z"), value: 95, }, { id: 2, unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 59, + timestamp: new Date("2026-05-05T13:34:54.000Z"), + value: 87, }, { id: 3, unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 8, + timestamp: new Date("2026-05-05T13:35:24.000Z"), + value: 52, }, { id: 4, unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 70, + timestamp: new Date("2026-05-05T13:35:54.000Z"), + value: 38, }, ], heartrate: [ { id: 0, unit: "bpm", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 52, + timestamp: new Date("2026-05-05T13:33:54.000Z"), + value: 79, }, { id: 1, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 104, + timestamp: new Date("2026-05-05T13:34:24.000Z"), + value: 156, }, { id: 2, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 20, + timestamp: new Date("2026-05-05T13:34:54.000Z"), + value: 183, }, { id: 3, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 116, + timestamp: new Date("2026-05-05T13:35:24.000Z"), + value: 4, }, { id: 4, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 95, + timestamp: new Date("2026-05-05T13:35:54.000Z"), + value: 176, }, ], hypnogram: [ { id: 0, unit: "stage", - timestamp: new Date("2026-04-30T17:37:44.000Z"), + timestamp: new Date("2026-05-05T13:33:54.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: 0, }, { id: 1, unit: "stage", - timestamp: new Date("2026-04-30T17:38:14.000Z"), + timestamp: new Date("2026-05-05T13:34:24.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 0, + value: 1, }, { id: 2, unit: "stage", - timestamp: new Date("2026-04-30T17:38:44.000Z"), + timestamp: new Date("2026-05-05T13:34:54.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), value: 2, @@ -253,50 +253,50 @@ describe("SleepClient", () => { { id: 3, unit: "stage", - timestamp: new Date("2026-04-30T17:39:14.000Z"), + timestamp: new Date("2026-05-05T13:35:24.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 0, + value: 2, }, { id: 4, unit: "stage", - timestamp: new Date("2026-04-30T17:39:44.000Z"), + timestamp: new Date("2026-05-05T13:35:54.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: -1, }, ], respiratoryRate: [ { id: 0, unit: "bpm", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 23, + timestamp: new Date("2026-05-05T13:33:54.000Z"), + value: 30, }, { id: 1, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 30, + timestamp: new Date("2026-05-05T13:34:24.000Z"), + value: 21, }, { id: 2, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 17, + timestamp: new Date("2026-05-05T13:34:54.000Z"), + value: 8, }, { id: 3, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 20, + timestamp: new Date("2026-05-05T13:35:24.000Z"), + value: 29, }, { id: 4, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 12, + timestamp: new Date("2026-05-05T13:35:54.000Z"), + value: 22, }, ], }, @@ -420,46 +420,46 @@ describe("SleepClient", () => { const rawResponseBody = { hrv: [ + { id: 0, timezone_offset: 1, type: "type", unit: "rmssd", timestamp: "2026-05-05T13:33:54Z", value: 4 }, { - id: 0, + id: 1, timezone_offset: 1, type: "type", unit: "rmssd", - timestamp: "2026-04-30T17:37:44Z", - value: 53, + timestamp: "2026-05-05T13:34:24Z", + value: 95, }, { - id: 1, + id: 2, timezone_offset: 1, type: "type", unit: "rmssd", - timestamp: "2026-04-30T17:38:14Z", - value: 95, + timestamp: "2026-05-05T13:34:54Z", + value: 87, }, { - id: 2, + id: 3, timezone_offset: 1, type: "type", unit: "rmssd", - timestamp: "2026-04-30T17:38:44Z", - value: 59, + timestamp: "2026-05-05T13:35:24Z", + value: 52, }, - { id: 3, timezone_offset: 1, type: "type", unit: "rmssd", timestamp: "2026-04-30T17:39:14Z", value: 8 }, { id: 4, timezone_offset: 1, type: "type", unit: "rmssd", - timestamp: "2026-04-30T17:39:44Z", - value: 70, + timestamp: "2026-05-05T13:35:54Z", + value: 38, }, ], heartrate: [ - { id: 0, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:37:44Z", value: 52 }, - { id: 1, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:38:14Z", value: 104 }, - { id: 2, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:38:44Z", value: 20 }, - { id: 3, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:39:14Z", value: 116 }, - { id: 4, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:39:44Z", value: 95 }, + { id: 0, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:33:54Z", value: 79 }, + { id: 1, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:34:24Z", value: 156 }, + { id: 2, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:34:54Z", value: 183 }, + { id: 3, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:35:24Z", value: 4 }, + { id: 4, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:35:54Z", value: 176 }, ], hypnogram: [ { @@ -467,27 +467,27 @@ describe("SleepClient", () => { timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:37:44Z", + timestamp: "2026-05-05T13:33:54Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: 0, }, { id: 1, timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:38:14Z", + timestamp: "2026-05-05T13:34:24Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 0, + value: 1, }, { id: 2, timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:38:44Z", + timestamp: "2026-05-05T13:34:54Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", value: 2, @@ -497,28 +497,28 @@ describe("SleepClient", () => { timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:39:14Z", + timestamp: "2026-05-05T13:35:24Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 0, + value: 2, }, { id: 4, timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:39:44Z", + timestamp: "2026-05-05T13:35:54Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: -1, }, ], respiratory_rate: [ - { id: 0, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:37:44Z", value: 23 }, - { id: 1, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:38:14Z", value: 30 }, - { id: 2, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:38:44Z", value: 17 }, - { id: 3, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:39:14Z", value: 20 }, - { id: 4, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-04-30T17:39:44Z", value: 12 }, + { id: 0, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:33:54Z", value: 30 }, + { id: 1, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:34:24Z", value: 21 }, + { id: 2, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:34:54Z", value: 8 }, + { id: 3, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:35:24Z", value: 29 }, + { id: 4, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-05T13:35:54Z", value: 22 }, ], }; @@ -540,15 +540,15 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 53, + timestamp: new Date("2026-05-05T13:33:54.000Z"), + value: 4, }, { id: 1, timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:14.000Z"), + timestamp: new Date("2026-05-05T13:34:24.000Z"), value: 95, }, { @@ -556,24 +556,24 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 59, + timestamp: new Date("2026-05-05T13:34:54.000Z"), + value: 87, }, { id: 3, timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 8, + timestamp: new Date("2026-05-05T13:35:24.000Z"), + value: 52, }, { id: 4, timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 70, + timestamp: new Date("2026-05-05T13:35:54.000Z"), + value: 38, }, ], heartrate: [ @@ -582,40 +582,40 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 52, + timestamp: new Date("2026-05-05T13:33:54.000Z"), + value: 79, }, { id: 1, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 104, + timestamp: new Date("2026-05-05T13:34:24.000Z"), + value: 156, }, { id: 2, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 20, + timestamp: new Date("2026-05-05T13:34:54.000Z"), + value: 183, }, { id: 3, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 116, + timestamp: new Date("2026-05-05T13:35:24.000Z"), + value: 4, }, { id: 4, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 95, + timestamp: new Date("2026-05-05T13:35:54.000Z"), + value: 176, }, ], hypnogram: [ @@ -624,27 +624,27 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:37:44.000Z"), + timestamp: new Date("2026-05-05T13:33:54.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: 0, }, { id: 1, timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:38:14.000Z"), + timestamp: new Date("2026-05-05T13:34:24.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 0, + value: 1, }, { id: 2, timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:38:44.000Z"), + timestamp: new Date("2026-05-05T13:34:54.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), value: 2, @@ -654,20 +654,20 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:39:14.000Z"), + timestamp: new Date("2026-05-05T13:35:24.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 0, + value: 2, }, { id: 4, timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:39:44.000Z"), + timestamp: new Date("2026-05-05T13:35:54.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: -1, }, ], respiratoryRate: [ @@ -676,40 +676,40 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 23, + timestamp: new Date("2026-05-05T13:33:54.000Z"), + value: 30, }, { id: 1, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 30, + timestamp: new Date("2026-05-05T13:34:24.000Z"), + value: 21, }, { id: 2, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 17, + timestamp: new Date("2026-05-05T13:34:54.000Z"), + value: 8, }, { id: 3, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 20, + timestamp: new Date("2026-05-05T13:35:24.000Z"), + value: 29, }, { id: 4, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 12, + timestamp: new Date("2026-05-05T13:35:54.000Z"), + value: 22, }, ], }); diff --git a/tests/wire/team.test.ts b/tests/wire/team.test.ts index 3a72bb0..9f6b100 100644 --- a/tests/wire/team.test.ts +++ b/tests/wire/team.test.ts @@ -131,16 +131,16 @@ describe("TeamClient", () => { user_id: "56bd81c9-6219-4000-a775-ae85526eba18", team_id: "56bd81c9-6219-4000-a775-ae85526eba18", client_user_id: "ZTEwZjNjMjctOTI2ZS00M2Vm", - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", source: { name: "Oura", slug: "oura", logo: "logo_url" }, }, ], - fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, - fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, + fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, ingestion_start: "ingestion_start", ingestion_end: "ingestion_end", }, @@ -162,7 +162,7 @@ describe("TeamClient", () => { userId: "56bd81c9-6219-4000-a775-ae85526eba18", teamId: "56bd81c9-6219-4000-a775-ae85526eba18", clientUserId: "ZTEwZjNjMjctOTI2ZS00M2Vm", - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), connectedSources: [ { provider: { @@ -170,7 +170,7 @@ describe("TeamClient", () => { slug: "oura", logo: "https://logo_url.com", }, - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), source: { name: "Oura", slug: "oura", @@ -181,12 +181,12 @@ describe("TeamClient", () => { fallbackTimeZone: { id: "Europe/London", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, ingestionStart: "ingestion_start", ingestionEnd: "ingestion_end", diff --git a/tests/wire/testkit.test.ts b/tests/wire/testkit.test.ts index 8930716..a840d57 100644 --- a/tests/wire/testkit.test.ts +++ b/tests/wire/testkit.test.ts @@ -22,9 +22,9 @@ describe("TestkitClient", () => { }; const rawResponseBody = { order: { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { first_name: "first_name", last_name: "last_name", @@ -118,9 +118,9 @@ describe("TestkitClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -230,9 +230,9 @@ describe("TestkitClient", () => { }); expect(response).toEqual({ order: { - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -332,9 +332,9 @@ describe("TestkitClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", @@ -498,9 +498,9 @@ describe("TestkitClient", () => { }; const rawResponseBody = { order: { - user_id: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - team_id: "e3b407cc-8648-48a8-bd51-957735a01cf0", + user_id: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + team_id: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patient_details: { first_name: "first_name", last_name: "last_name", @@ -594,9 +594,9 @@ describe("TestkitClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outbound_tracking_number: "", outbound_tracking_url: "", inbound_tracking_number: "", @@ -701,9 +701,9 @@ describe("TestkitClient", () => { }); expect(response).toEqual({ order: { - userId: "cd6eb651-2f81-4a96-8065-e5deea3f25d8", - id: "31d02d72-8751-4349-ace5-a61c84712706", - teamId: "e3b407cc-8648-48a8-bd51-957735a01cf0", + userId: "4eddb457-d362-4886-b4c7-f625923e6886", + id: "67ad4876-5346-4b51-9ef9-429a5978752e", + teamId: "2c70d2ec-1255-415d-8eb4-d4aeb7d01be9", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -803,9 +803,9 @@ describe("TestkitClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "2fc293b6-8ecb-4fb4-a8fc-b3f552295d61", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "fbbb6ed9-26ff-4caf-bae8-dea572286eed", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", diff --git a/tests/wire/user.test.ts b/tests/wire/user.test.ts index 7a45301..8c5733f 100644 --- a/tests/wire/user.test.ts +++ b/tests/wire/user.test.ts @@ -15,23 +15,23 @@ describe("UserClient", () => { user_id: "56bd81c9-6219-4000-a775-ae85526eba18", team_id: "56bd81c9-6219-4000-a775-ae85526eba18", client_user_id: "ZTEwZjNjMjctOTI2ZS00M2Vm", - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", source: { name: "Oura", slug: "oura", logo: "logo_url" }, }, ], fallback_time_zone: { id: "Europe/London", source_slug: "manual", - updated_at: "2026-04-30T17:37:45Z", + updated_at: "2026-05-05T13:33:56Z", }, fallback_birth_date: { value: "1989-09-12", source_slug: "manual", - updated_at: "2026-04-30T17:37:45Z", + updated_at: "2026-05-05T13:33:56Z", }, ingestion_start: "ingestion_start", ingestion_end: "ingestion_end", @@ -54,7 +54,7 @@ describe("UserClient", () => { userId: "56bd81c9-6219-4000-a775-ae85526eba18", teamId: "56bd81c9-6219-4000-a775-ae85526eba18", clientUserId: "ZTEwZjNjMjctOTI2ZS00M2Vm", - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), connectedSources: [ { provider: { @@ -62,7 +62,7 @@ describe("UserClient", () => { slug: "oura", logo: "https://logo_url.com", }, - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), source: { name: "Oura", slug: "oura", @@ -73,12 +73,12 @@ describe("UserClient", () => { fallbackTimeZone: { id: "Europe/London", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, ingestionStart: "ingestion_start", ingestionEnd: "ingestion_end", @@ -111,16 +111,16 @@ describe("UserClient", () => { user_id: "56bd81c9-6219-4000-a775-ae85526eba18", team_id: "56bd81c9-6219-4000-a775-ae85526eba18", client_user_id: "ZTEwZjNjMjctOTI2ZS00M2Vm", - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", source: { name: "Oura", slug: "oura", logo: "logo_url" }, }, ], - fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, - fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, + fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, ingestion_start: "ingestion_start", ingestion_end: "ingestion_end", }; @@ -141,7 +141,7 @@ describe("UserClient", () => { userId: "56bd81c9-6219-4000-a775-ae85526eba18", teamId: "56bd81c9-6219-4000-a775-ae85526eba18", clientUserId: "ZTEwZjNjMjctOTI2ZS00M2Vm", - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), connectedSources: [ { provider: { @@ -149,7 +149,7 @@ describe("UserClient", () => { slug: "oura", logo: "https://logo_url.com", }, - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), source: { name: "Oura", slug: "oura", @@ -160,12 +160,12 @@ describe("UserClient", () => { fallbackTimeZone: { id: "Europe/London", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, ingestionStart: "ingestion_start", ingestionEnd: "ingestion_end", @@ -982,16 +982,16 @@ describe("UserClient", () => { user_id: "56bd81c9-6219-4000-a775-ae85526eba18", team_id: "56bd81c9-6219-4000-a775-ae85526eba18", client_user_id: "ZTEwZjNjMjctOTI2ZS00M2Vm", - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", source: { name: "Oura", slug: "oura", logo: "logo_url" }, }, ], - fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, - fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, + fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, ingestion_start: "ingestion_start", ingestion_end: "ingestion_end", }; @@ -1011,7 +1011,7 @@ describe("UserClient", () => { userId: "56bd81c9-6219-4000-a775-ae85526eba18", teamId: "56bd81c9-6219-4000-a775-ae85526eba18", clientUserId: "ZTEwZjNjMjctOTI2ZS00M2Vm", - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), connectedSources: [ { provider: { @@ -1019,7 +1019,7 @@ describe("UserClient", () => { slug: "oura", logo: "https://logo_url.com", }, - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), source: { name: "Oura", slug: "oura", @@ -1030,12 +1030,12 @@ describe("UserClient", () => { fallbackTimeZone: { id: "Europe/London", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, ingestionStart: "ingestion_start", ingestionEnd: "ingestion_end", @@ -1116,16 +1116,16 @@ describe("UserClient", () => { user_id: "56bd81c9-6219-4000-a775-ae85526eba18", team_id: "56bd81c9-6219-4000-a775-ae85526eba18", client_user_id: "ZTEwZjNjMjctOTI2ZS00M2Vm", - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-05T13:33:56Z", source: { name: "Oura", slug: "oura", logo: "logo_url" }, }, ], - fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, - fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-04-30T17:37:45Z" }, + fallback_time_zone: { id: "Europe/London", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-05T13:33:56Z" }, ingestion_start: "ingestion_start", ingestion_end: "ingestion_end", }; @@ -1139,7 +1139,7 @@ describe("UserClient", () => { userId: "56bd81c9-6219-4000-a775-ae85526eba18", teamId: "56bd81c9-6219-4000-a775-ae85526eba18", clientUserId: "ZTEwZjNjMjctOTI2ZS00M2Vm", - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), connectedSources: [ { provider: { @@ -1147,7 +1147,7 @@ describe("UserClient", () => { slug: "oura", logo: "https://logo_url.com", }, - createdOn: new Date("2026-04-30T17:37:45.000Z"), + createdOn: new Date("2026-05-05T13:33:56.000Z"), source: { name: "Oura", slug: "oura", @@ -1158,12 +1158,12 @@ describe("UserClient", () => { fallbackTimeZone: { id: "Europe/London", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-05T13:33:56.000Z"), }, ingestionStart: "ingestion_start", ingestionEnd: "ingestion_end", diff --git a/tests/wire/vitals.test.ts b/tests/wire/vitals.test.ts index aacf72d..50dce65 100644 --- a/tests/wire/vitals.test.ts +++ b/tests/wire/vitals.test.ts @@ -2217,7 +2217,7 @@ describe("VitalsClient", () => { unit: "min", timestamp: "2024-01-15T09:30:00Z", start: "2023-02-13T14:57:24Z", - end: "2026-04-30T17:42:44Z", + end: "2026-05-05T13:38:54Z", value: 42, }, ], @@ -2257,7 +2257,7 @@ describe("VitalsClient", () => { unit: "min", timestamp: new Date("2024-01-15T09:30:00.000Z"), start: new Date("2023-02-13T14:57:24.000Z"), - end: new Date("2026-04-30T17:42:44.000Z"), + end: new Date("2026-05-05T13:38:54.000Z"), value: 42, }, ], @@ -4331,7 +4331,7 @@ describe("VitalsClient", () => { oura: [ { source: { provider: "oura", type: "ring" }, - data: [{ unit: "mmHg", timestamp: "2026-04-30T17:37:44Z", systolic: 125, diastolic: 75 }], + data: [{ unit: "mmHg", timestamp: "2026-05-05T13:33:55Z", systolic: 125, diastolic: 75 }], }, ], }, @@ -4366,7 +4366,7 @@ describe("VitalsClient", () => { data: [ { unit: "mmHg", - timestamp: new Date("2026-04-30T17:37:44.000Z"), + timestamp: new Date("2026-05-05T13:33:55.000Z"), systolic: 125, diastolic: 75, }, @@ -4536,7 +4536,7 @@ describe("VitalsClient", () => { unit: "min", timestamp: "2024-01-15T09:30:00Z", start: "2023-02-13T14:57:24Z", - end: "2026-04-30T17:42:44Z", + end: "2026-05-05T13:38:54Z", value: 42, }, ]; @@ -4563,7 +4563,7 @@ describe("VitalsClient", () => { unit: "min", timestamp: new Date("2024-01-15T09:30:00.000Z"), start: new Date("2023-02-13T14:57:24.000Z"), - end: new Date("2026-04-30T17:42:44.000Z"), + end: new Date("2026-05-05T13:38:54.000Z"), value: 42, }, ]); @@ -5994,7 +5994,7 @@ describe("VitalsClient", () => { type: "type", unit: "mmHg", grouping: [{ key: "value" }], - timestamp: "2026-04-30T17:37:44Z", + timestamp: "2026-05-05T13:33:55Z", systolic: 125, diastolic: 75, }, @@ -6025,7 +6025,7 @@ describe("VitalsClient", () => { key: "value", }, ], - timestamp: new Date("2026-04-30T17:37:44.000Z"), + timestamp: new Date("2026-05-05T13:33:55.000Z"), systolic: 125, diastolic: 75, }, From 628d77fd6552d18150a175501c8c7bc74ed4a118 Mon Sep 17 00:00:00 2001 From: Filip Komorowski Date: Wed, 6 May 2026 12:41:28 +0200 Subject: [PATCH 2/2] chore: clean up changelog --- changelog.md | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index bc4f8dd..9d7930a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,15 +1,3 @@ -## 1.0.0 - 2026-05-05 -### Breaking Changes -* **`JunctionEnvironment`** URLs have changed from `tryvital.io` to `junction.com` domains — update any hardcoded URL comparisons or overrides to use the new `junction.com` endpoints. -* **`MealInDbBaseClientFacingSource`** now requires a `calendarDate: string` field — add `calendarDate` to any object literals or constructors that build this type. -### Added -* **`LabReportResultSampleType`** and **`LabReportResultMeasurementKind`** — new non-exhaustive enum types exposed as optional fields `sampleType` and `measurementKind` on `LabReportResult`. -* **`AuthOption`** type and `auth` property on `BaseClientOptions` — pass `false` to disable auth, a function, an `AuthProvider`, or auth options to override authentication per-client. -* **`isAuthProvider`** — new exported helper function to type-narrow an unknown value to `AuthProvider`. -### Fixed -* **`Micros`**, **`SampleData`**, and **`LabResultsRaw`** serialization now correctly handles nullable values within record fields. - -## 0.0.1 - 2026-05-01 +## 1.0.0 - 2026-05-06 * Initial SDK generation * đŸŒŋ Generated with Fern -