diff --git a/.fern/metadata.json b/.fern/metadata.json index 2d6f936..d0bf0ae 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "5.5.1", + "cliVersion": "5.7.7", "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": "013d384eb55b3bae6134a907ce4c7f11837ba7d9", "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..8ae7271 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,14 @@ +## 1.0.0 - 2026-05-04 +### Breaking Changes +* **`MealInDbBaseClientFacingSource`** now includes a required `calendarDate: string` field (YYYY-mm-dd format). Existing code that constructs or destructures this type must be updated to handle the new field. +* **`JunctionEnvironment`** URLs have changed from `tryvital.io` to `junction.com` for all four environments (`Production`, `ProductionEu`, `Sandbox`, `SandboxEu`). If you hard-coded or compared against the old URLs, update accordingly. +### Added +* **`AuthOption`** union type and **`auth`** property on `BaseClientOptions` allow per-client authentication overrides: pass `false` to disable auth, a function returning auth headers, an `AuthProvider` instance, or raw `HeaderAuthProvider.AuthOptions`. +* **`isAuthProvider`** type-guard helper is now exported from the core auth module. +* **`forwardCompatibleEnum_`** schema builder added for forward-compatible enum deserialization. +### Fixed +* **`Micros`**, **`SampleData`**, and **`LabResultsRaw`** serializers now correctly allow `null` values inside record fields, matching the actual API contract. + ## 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/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/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/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/labTests.test.ts b/tests/wire/labTests.test.ts index 7cbce90..3c649ed 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "d4a574a0-6bf2-4c02-a60a-08bfcf66d6d4", + user_id: "cb60d26d-202d-4c27-a593-d1ab1e8a925f", + order_id: "0c86f96d-2df8-4f88-abda-7df05a8c7066", + order_transaction_id: "f004e064-6433-4acb-ab0b-40327efe80aa", 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: "d4a574a0-6bf2-4c02-a60a-08bfcf66d6d4", + userId: "cb60d26d-202d-4c27-a593-d1ab1e8a925f", + orderId: "0c86f96d-2df8-4f88-abda-7df05a8c7066", + orderTransactionId: "f004e064-6433-4acb-ab0b-40327efe80aa", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "235a774c-1f12-446d-b9ba-cd543162ac8a", 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: "235a774c-1f12-446d-b9ba-cd543162ac8a", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "235a774c-1f12-446d-b9ba-cd543162ac8a", 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: "235a774c-1f12-446d-b9ba-cd543162ac8a", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + user_id: "a622c454-92b8-40e3-babf-ba20c144a9df", + order_id: "8822327a-aac0-46f5-8af1-b4d886993e5f", + order_transaction_id: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "f3c3a776-7154-4b4e-96a9-f7890c3ec5bc", + userId: "a622c454-92b8-40e3-babf-ba20c144a9df", + orderId: "8822327a-aac0-46f5-8af1-b4d886993e5f", + orderTransactionId: "69d10d75-e58f-4477-bbb6-3c98e071976f", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -4023,9 +4023,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -4465,9 +4465,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -4956,9 +4956,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -5420,9 +5420,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -5888,9 +5888,9 @@ describe("LabTestsClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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..1deac1a 100644 --- a/tests/wire/sleep.test.ts +++ b/tests/wire/sleep.test.ts @@ -42,67 +42,67 @@ 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-04T11:12:20Z", value: 68 }, + { id: 1, unit: "rmssd", timestamp: "2026-05-04T11:12:50Z", value: 58 }, + { id: 2, unit: "rmssd", timestamp: "2026-05-04T11:13:20Z", value: 97 }, + { id: 3, unit: "rmssd", timestamp: "2026-05-04T11:13:50Z", value: 34 }, + { id: 4, unit: "rmssd", timestamp: "2026-05-04T11:14:20Z", value: 46 }, ], 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-04T11:12:20Z", value: 136 }, + { id: 1, unit: "bpm", timestamp: "2026-05-04T11:12:50Z", value: 19 }, + { id: 2, unit: "bpm", timestamp: "2026-05-04T11:13:20Z", value: 170 }, + { id: 3, unit: "bpm", timestamp: "2026-05-04T11:13:50Z", value: 41 }, + { id: 4, unit: "bpm", timestamp: "2026-05-04T11:14:20Z", value: 122 }, ], hypnogram: [ { id: 0, unit: "stage", - timestamp: "2026-04-30T17:37:44Z", + timestamp: "2026-05-04T11:12:20Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: 1, }, { id: 1, unit: "stage", - timestamp: "2026-04-30T17:38:14Z", + timestamp: "2026-05-04T11:12:50Z", 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-04T11:13:20Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 2, + value: 1, }, { id: 3, unit: "stage", - timestamp: "2026-04-30T17:39:14Z", + timestamp: "2026-05-04T11:13:50Z", 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-04T11:14:20Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: 0, }, ], 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-04T11:12:20Z", value: 16 }, + { id: 1, unit: "bpm", timestamp: "2026-05-04T11:12:50Z", value: 10 }, + { id: 2, unit: "bpm", timestamp: "2026-05-04T11:13:20Z", value: 8 }, + { id: 3, unit: "bpm", timestamp: "2026-05-04T11:13:50Z", value: 19 }, + { id: 4, unit: "bpm", timestamp: "2026-05-04T11:14:20Z", value: 14 }, ], }, created_at: "2023-02-27T20:31:24Z", @@ -165,138 +165,138 @@ describe("SleepClient", () => { { id: 0, unit: "rmssd", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 53, + timestamp: new Date("2026-05-04T11:12:20.000Z"), + value: 68, }, { id: 1, unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 95, + timestamp: new Date("2026-05-04T11:12:50.000Z"), + value: 58, }, { id: 2, unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 59, + timestamp: new Date("2026-05-04T11:13:20.000Z"), + value: 97, }, { id: 3, unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 8, + timestamp: new Date("2026-05-04T11:13:50.000Z"), + value: 34, }, { id: 4, unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 70, + timestamp: new Date("2026-05-04T11:14:20.000Z"), + value: 46, }, ], heartrate: [ { id: 0, unit: "bpm", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 52, + timestamp: new Date("2026-05-04T11:12:20.000Z"), + value: 136, }, { id: 1, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 104, + timestamp: new Date("2026-05-04T11:12:50.000Z"), + value: 19, }, { id: 2, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 20, + timestamp: new Date("2026-05-04T11:13:20.000Z"), + value: 170, }, { id: 3, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 116, + timestamp: new Date("2026-05-04T11:13:50.000Z"), + value: 41, }, { id: 4, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 95, + timestamp: new Date("2026-05-04T11:14:20.000Z"), + value: 122, }, ], hypnogram: [ { id: 0, unit: "stage", - timestamp: new Date("2026-04-30T17:37:44.000Z"), + timestamp: new Date("2026-05-04T11:12:20.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: 1, }, { id: 1, unit: "stage", - timestamp: new Date("2026-04-30T17:38:14.000Z"), + timestamp: new Date("2026-05-04T11:12:50.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-04T11:13:20.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 2, + value: 1, }, { id: 3, unit: "stage", - timestamp: new Date("2026-04-30T17:39:14.000Z"), + timestamp: new Date("2026-05-04T11:13:50.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-04T11:14:20.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: 0, }, ], respiratoryRate: [ { id: 0, unit: "bpm", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 23, + timestamp: new Date("2026-05-04T11:12:20.000Z"), + value: 16, }, { id: 1, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 30, + timestamp: new Date("2026-05-04T11:12:50.000Z"), + value: 10, }, { id: 2, unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 17, + timestamp: new Date("2026-05-04T11:13:20.000Z"), + value: 8, }, { id: 3, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 20, + timestamp: new Date("2026-05-04T11:13:50.000Z"), + value: 19, }, { id: 4, unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 12, + timestamp: new Date("2026-05-04T11:14:20.000Z"), + value: 14, }, ], }, @@ -425,41 +425,48 @@ describe("SleepClient", () => { timezone_offset: 1, type: "type", unit: "rmssd", - timestamp: "2026-04-30T17:37:44Z", - value: 53, + timestamp: "2026-05-04T11:12:20Z", + value: 68, }, { id: 1, timezone_offset: 1, type: "type", unit: "rmssd", - timestamp: "2026-04-30T17:38:14Z", - value: 95, + timestamp: "2026-05-04T11:12:50Z", + value: 58, }, { id: 2, timezone_offset: 1, type: "type", unit: "rmssd", - timestamp: "2026-04-30T17:38:44Z", - value: 59, + timestamp: "2026-05-04T11:13:20Z", + value: 97, + }, + { + id: 3, + timezone_offset: 1, + type: "type", + unit: "rmssd", + timestamp: "2026-05-04T11:13:50Z", + value: 34, }, - { 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-04T11:14:20Z", + value: 46, }, ], 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-04T11:12:20Z", value: 136 }, + { id: 1, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:12:50Z", value: 19 }, + { id: 2, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:13:20Z", value: 170 }, + { id: 3, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:13:50Z", value: 41 }, + { id: 4, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:14:20Z", value: 122 }, ], hypnogram: [ { @@ -467,58 +474,58 @@ describe("SleepClient", () => { timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:37:44Z", + timestamp: "2026-05-04T11:12:20Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: 1, }, { id: 1, timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:38:14Z", + timestamp: "2026-05-04T11:12:50Z", 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-04T11:13:20Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 2, + value: 1, }, { id: 3, timezone_offset: 1, type: "type", unit: "stage", - timestamp: "2026-04-30T17:39:14Z", + timestamp: "2026-05-04T11:13:50Z", 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-04T11:14:20Z", start: "2024-01-15T09:30:00Z", end: "2024-01-15T09:30:00Z", - value: 3, + value: 0, }, ], 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-04T11:12:20Z", value: 16 }, + { id: 1, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:12:50Z", value: 10 }, + { id: 2, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:13:20Z", value: 8 }, + { id: 3, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:13:50Z", value: 19 }, + { id: 4, timezone_offset: 1, type: "type", unit: "bpm", timestamp: "2026-05-04T11:14:20Z", value: 14 }, ], }; @@ -540,40 +547,40 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:37:44.000Z"), - value: 53, + timestamp: new Date("2026-05-04T11:12:20.000Z"), + value: 68, }, { id: 1, timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 95, + timestamp: new Date("2026-05-04T11:12:50.000Z"), + value: 58, }, { id: 2, timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 59, + timestamp: new Date("2026-05-04T11:13:20.000Z"), + value: 97, }, { id: 3, timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 8, + timestamp: new Date("2026-05-04T11:13:50.000Z"), + value: 34, }, { id: 4, timezoneOffset: 1, type: "type", unit: "rmssd", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 70, + timestamp: new Date("2026-05-04T11:14:20.000Z"), + value: 46, }, ], heartrate: [ @@ -582,40 +589,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-04T11:12:20.000Z"), + value: 136, }, { id: 1, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 104, + timestamp: new Date("2026-05-04T11:12:50.000Z"), + value: 19, }, { id: 2, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 20, + timestamp: new Date("2026-05-04T11:13:20.000Z"), + value: 170, }, { id: 3, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:39:14.000Z"), - value: 116, + timestamp: new Date("2026-05-04T11:13:50.000Z"), + value: 41, }, { id: 4, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 95, + timestamp: new Date("2026-05-04T11:14:20.000Z"), + value: 122, }, ], hypnogram: [ @@ -624,50 +631,50 @@ describe("SleepClient", () => { timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:37:44.000Z"), + timestamp: new Date("2026-05-04T11:12:20.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: 1, }, { id: 1, timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:38:14.000Z"), + timestamp: new Date("2026-05-04T11:12:50.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-04T11:13:20.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 2, + value: 1, }, { id: 3, timezoneOffset: 1, type: "type", unit: "stage", - timestamp: new Date("2026-04-30T17:39:14.000Z"), + timestamp: new Date("2026-05-04T11:13:50.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-04T11:14:20.000Z"), start: new Date("2024-01-15T09:30:00.000Z"), end: new Date("2024-01-15T09:30:00.000Z"), - value: 3, + value: 0, }, ], respiratoryRate: [ @@ -676,40 +683,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-04T11:12:20.000Z"), + value: 16, }, { id: 1, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:14.000Z"), - value: 30, + timestamp: new Date("2026-05-04T11:12:50.000Z"), + value: 10, }, { id: 2, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:38:44.000Z"), - value: 17, + timestamp: new Date("2026-05-04T11:13:20.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-04T11:13:50.000Z"), + value: 19, }, { id: 4, timezoneOffset: 1, type: "type", unit: "bpm", - timestamp: new Date("2026-04-30T17:39:44.000Z"), - value: 12, + timestamp: new Date("2026-05-04T11:14:20.000Z"), + value: 14, }, ], }); diff --git a/tests/wire/team.test.ts b/tests/wire/team.test.ts index 3a72bb0..8b3a0cb 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-04T11:12:22Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-04T11:12:22Z", 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-04T11:12:22Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-04T11:12:22Z" }, 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-04T11:12:22.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-04T11:12:22.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-04T11:12:22.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-04T11:12:22.000Z"), }, ingestionStart: "ingestion_start", ingestionEnd: "ingestion_end", diff --git a/tests/wire/testkit.test.ts b/tests/wire/testkit.test.ts index 8930716..34e1cf4 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -332,9 +332,9 @@ describe("TestkitClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + team_id: "c1a760dc-48c6-49a0-a21a-a43238782cf6", 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: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", 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: "ed16182a-f55c-494c-90fc-d005a51a894e", + id: "4725f78e-c2b9-4ff4-bf2c-6bea6aad4b90", + teamId: "c1a760dc-48c6-49a0-a21a-a43238782cf6", patientDetails: { firstName: "first_name", lastName: "last_name", @@ -803,9 +803,9 @@ describe("TestkitClient", () => { details: { type: "testkit", data: { - id: "0efd410c-9980-4e90-be2a-34432bf12dd2", + id: "e781a289-aa6b-41d3-8c55-048a34aa0cbc", shipment: { - id: "e6770ba4-b52b-4089-adbd-84d1f6ca6005", + id: "3885c047-918f-41c5-bd47-bc884e60b52a", outboundTrackingNumber: "", outboundTrackingUrl: "", inboundTrackingNumber: "", diff --git a/tests/wire/user.test.ts b/tests/wire/user.test.ts index 7a45301..35ba2bf 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-04T11:12:22Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-04T11:12:22Z", 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-04T11:12:22Z", }, fallback_birth_date: { value: "1989-09-12", source_slug: "manual", - updated_at: "2026-04-30T17:37:45Z", + updated_at: "2026-05-04T11:12:22Z", }, 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-04T11:12:22.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-04T11:12:22.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-04T11:12:22.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-04T11:12:22.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-04T11:12:22Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-04T11:12:22Z", 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-04T11:12:22Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-04T11:12:22Z" }, 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-04T11:12:22.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-04T11:12:22.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-04T11:12:22.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-04T11:12:22.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-04T11:12:22Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-04T11:12:22Z", 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-04T11:12:22Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-04T11:12:22Z" }, 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-04T11:12:22.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-04T11:12:22.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-04T11:12:22.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-04T11:12:22.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-04T11:12:22Z", connected_sources: [ { provider: { name: "Oura", slug: "oura", logo: "https://logo_url.com" }, - created_on: "2026-04-30T17:37:45Z", + created_on: "2026-05-04T11:12:22Z", 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-04T11:12:22Z" }, + fallback_birth_date: { value: "1989-09-12", source_slug: "manual", updated_at: "2026-05-04T11:12:22Z" }, 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-04T11:12:22.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-04T11:12:22.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-04T11:12:22.000Z"), }, fallbackBirthDate: { value: "1989-09-12", sourceSlug: "manual", - updatedAt: new Date("2026-04-30T17:37:45.000Z"), + updatedAt: new Date("2026-05-04T11:12:22.000Z"), }, ingestionStart: "ingestion_start", ingestionEnd: "ingestion_end", diff --git a/tests/wire/vitals.test.ts b/tests/wire/vitals.test.ts index aacf72d..2143dfc 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-04T11:17:20Z", 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-04T11:17:20.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-04T11:12:20Z", 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-04T11:12:20.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-04T11:17:20Z", 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-04T11:17:20.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-04T11:12:20Z", 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-04T11:12:20.000Z"), systolic: 125, diastolic: 75, },