diff --git a/codegen/layouts/partials/request-scalar-type.hbs b/codegen/layouts/partials/request-scalar-type.hbs index 87eec456..9a22396a 100644 --- a/codegen/layouts/partials/request-scalar-type.hbs +++ b/codegen/layouts/partials/request-scalar-type.hbs @@ -1,2 +1,2 @@ -{{#if (eq format "boolean")}}boolean{{else if (eq format "number")}}number{{else if (eq format "record")}}Record{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}} +{{#if (eq format "boolean")}}{{#if values}}{{#each values}}{{#unless @first}} | {{/unless}}{{json this}}{{/each}}{{else}}boolean{{/if}}{{else if (eq format "number")}}number{{else if (eq format "record")}}Record{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}} {{json name}}{{else}}string{{/each}}{{else}}string{{/if}} diff --git a/codegen/layouts/partials/resource-scalar-type.hbs b/codegen/layouts/partials/resource-scalar-type.hbs index 87eec456..9a22396a 100644 --- a/codegen/layouts/partials/resource-scalar-type.hbs +++ b/codegen/layouts/partials/resource-scalar-type.hbs @@ -1,2 +1,2 @@ -{{#if (eq format "boolean")}}boolean{{else if (eq format "number")}}number{{else if (eq format "record")}}Record{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}} +{{#if (eq format "boolean")}}{{#if values}}{{#each values}}{{#unless @first}} | {{/unless}}{{json this}}{{/each}}{{else}}boolean{{/if}}{{else if (eq format "number")}}number{{else if (eq format "record")}}Record{{else if (eq format "enum")}}{{#each values}}{{#unless @first}} | {{/unless}}{{> doc}} {{json name}}{{else}}string{{/each}}{{else}}string{{/if}} diff --git a/codegen/lib/handlebars-helpers.ts b/codegen/lib/handlebars-helpers.ts index 9805b634..48b191ff 100644 --- a/codegen/lib/handlebars-helpers.ts +++ b/codegen/lib/handlebars-helpers.ts @@ -1,6 +1,6 @@ export const identity = (x: unknown): unknown => x -export const json = (value: string): string => JSON.stringify(value) +export const json = (value: unknown): string => JSON.stringify(value) export const replaceExtension = (fileName: string, extension: string): string => fileName.replace(/\.[^.]+$/, extension) diff --git a/package-lock.json b/package-lock.json index 41ad9f0e..295b1a3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "axios-retry": "^4.4.2" }, "devDependencies": { - "@seamapi/blueprint": "^1.5.1", + "@seamapi/blueprint": "^1.6.0", "@seamapi/fake-seam-connect": "^2.0.4", "@seamapi/smith": "^1.1.0", "@seamapi/types": "1.1019.0", @@ -1025,9 +1025,9 @@ "license": "MIT" }, "node_modules/@seamapi/blueprint": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-1.5.1.tgz", - "integrity": "sha512-rXHMNDGmaE7OK+tg3e64DnpMHQypN4BuSS+PkVqGUoYc9f+xBMONqPscsHAGi9iU/iyZOJZKEOKOXvMmWaLoLA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@seamapi/blueprint/-/blueprint-1.6.0.tgz", + "integrity": "sha512-+lIriSgog0E0pUjXz/tdRZiVECiSiBcnZ3uU4JRN45RTLs2BQVbR+Ris6/mXwBV1wkpMetdVD3CP1BB1agf6Lg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index a06c6403..d7000a67 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "axios-retry": "^4.4.2" }, "devDependencies": { - "@seamapi/blueprint": "^1.5.1", + "@seamapi/blueprint": "^1.6.0", "@seamapi/fake-seam-connect": "^2.0.4", "@seamapi/smith": "^1.1.0", "@seamapi/types": "1.1019.0", diff --git a/src/lib/resources/access-code.ts b/src/lib/resources/access-code.ts index d354b143..5b29b54a 100644 --- a/src/lib/resources/access-code.ts +++ b/src/lib/resources/access-code.ts @@ -102,7 +102,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -124,7 +124,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -146,7 +146,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -168,7 +168,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * ID of the managed access code that conflicts with this managed access code, when Seam can identify it. @@ -199,7 +199,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -225,7 +225,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -268,7 +268,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -290,7 +290,7 @@ export type AccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -313,12 +313,12 @@ export type AccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -341,12 +341,12 @@ export type AccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -369,12 +369,12 @@ export type AccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -397,12 +397,12 @@ export type AccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -425,7 +425,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -448,7 +448,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -471,7 +471,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -494,7 +494,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -517,7 +517,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -540,7 +540,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -563,7 +563,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -586,7 +586,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -609,7 +609,7 @@ export type AccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -661,7 +661,7 @@ export type AccessCode = { /** * Indicates whether Seam manages the access code. */ - is_managed: boolean + is_managed: true /** * Indicates whether the access code is intended for use in offline scenarios. If `true`, this code can be created on a device without a network connection. diff --git a/src/lib/resources/acs-access-group.ts b/src/lib/resources/acs-access-group.ts index 5e5726fd..aebe8d70 100644 --- a/src/lib/resources/acs-access-group.ts +++ b/src/lib/resources/acs-access-group.ts @@ -119,7 +119,7 @@ export type AcsAccessGroup = { /** * Indicates whether Seam manages the access group. */ - is_managed: boolean + is_managed: true /** * Name of the access group. diff --git a/src/lib/resources/acs-credential.ts b/src/lib/resources/acs-credential.ts index 4e927e64..8774fcc3 100644 --- a/src/lib/resources/acs-credential.ts +++ b/src/lib/resources/acs-credential.ts @@ -153,7 +153,7 @@ export type AcsCredential = { /** * Indicates whether Seam manages the credential. */ - is_managed: boolean + is_managed: true /** * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is a [multi-phone sync credential](https://docs.seam.co/capability-guides/mobile-access/issuing-mobile-credentials-from-an-access-control-system#what-are-multi-phone-sync-credentials). diff --git a/src/lib/resources/acs-user.ts b/src/lib/resources/acs-user.ts index 9520b50a..5a8320f1 100644 --- a/src/lib/resources/acs-user.ts +++ b/src/lib/resources/acs-user.ts @@ -185,7 +185,7 @@ export type AcsUser = { /** * Indicates whether Seam manages the access system user. */ - is_managed: boolean + is_managed: true /** * Indicates whether the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) is currently [suspended](https://docs.seam.co/low-level-apis/access-systems/user-management/suspending-and-unsuspending-users). diff --git a/src/lib/resources/action-attempt.ts b/src/lib/resources/action-attempt.ts index b90721da..2b6d7cd5 100644 --- a/src/lib/resources/action-attempt.ts +++ b/src/lib/resources/action-attempt.ts @@ -339,7 +339,7 @@ export type ActionAttempt = is_latest_desired_state_synced_with_provider?: boolean | null | undefined - is_managed: boolean + is_managed: true | false /** * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is a [multi-phone sync credential](https://docs.seam.co/capability-guides/mobile-access/issuing-mobile-credentials-from-an-access-control-system#what-are-multi-phone-sync-credentials). @@ -646,7 +646,7 @@ export type ActionAttempt = is_latest_desired_state_synced_with_provider?: boolean | null | undefined - is_managed: boolean + is_managed: true | false /** * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is a [multi-phone sync credential](https://docs.seam.co/capability-guides/mobile-access/issuing-mobile-credentials-from-an-access-control-system#what-are-multi-phone-sync-credentials). @@ -930,7 +930,7 @@ export type ActionAttempt = /** * Indicates whether Seam manages the credential. */ - is_managed: boolean + is_managed: true /** * Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) is a [multi-phone sync credential](https://docs.seam.co/capability-guides/mobile-access/issuing-mobile-credentials-from-an-access-control-system#what-are-multi-phone-sync-credentials). diff --git a/src/lib/resources/device.ts b/src/lib/resources/device.ts index 000e319c..5b63d9ae 100644 --- a/src/lib/resources/device.ts +++ b/src/lib/resources/device.ts @@ -238,12 +238,12 @@ export type Device = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -266,12 +266,12 @@ export type Device = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -294,12 +294,12 @@ export type Device = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -322,12 +322,12 @@ export type Device = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -350,7 +350,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -373,7 +373,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -396,7 +396,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -419,7 +419,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -442,7 +442,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -465,7 +465,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -488,7 +488,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -511,7 +511,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -534,7 +534,7 @@ export type Device = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -572,7 +572,7 @@ export type Device = { /** * Indicates whether Seam manages the device. See also [Managed and Unmanaged Devices](https://docs.seam.co/core-concepts/devices/managed-and-unmanaged-devices). */ - is_managed: boolean + is_managed: true /** * Location information for the device. @@ -2082,7 +2082,7 @@ export type Device = { /** * When `true`, the start and end must fall at the same time of day (the caller picks which). Mutually exclusive with `time_pairs`. */ - matching_start_end_time?: boolean | undefined + matching_start_end_time?: true | undefined /** * Maximum duration this option covers, as an ISO 8601 duration (for example, `PT672H` or `P367D`). Omitted when there is no maximum. */ @@ -2139,7 +2139,7 @@ export type Device = { /** * When `true`, the start and end must fall at the same time of day (the caller picks which). Mutually exclusive with `time_pairs`. */ - matching_start_end_time?: boolean | undefined + matching_start_end_time?: true | undefined /** * Maximum duration this option covers, as an ISO 8601 duration (for example, `PT672H` or `P367D`). Omitted when there is no maximum. */ diff --git a/src/lib/resources/unmanaged-access-code.ts b/src/lib/resources/unmanaged-access-code.ts index e86acdc9..03d07d8c 100644 --- a/src/lib/resources/unmanaged-access-code.ts +++ b/src/lib/resources/unmanaged-access-code.ts @@ -25,11 +25,11 @@ export type UnmanagedAccessCode = { /** * Indicates that Seam cannot convert this unmanaged access code to a managed access code. Some providers do not support management of unmanaged access codes through API integrations. */ - cannot_be_managed?: boolean | undefined + cannot_be_managed?: true | undefined /** * Indicates that Seam cannot delete this unmanaged access code through the provider. If this access code needs to be deleted, it will only be possible from the manufacturer app. */ - cannot_delete_unmanaged_access_code?: boolean | undefined + cannot_delete_unmanaged_access_code?: true | undefined /** * Code used for access. Typically, a numeric or alphanumeric string. */ @@ -108,7 +108,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -130,7 +130,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -152,7 +152,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -174,7 +174,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * ID of the managed access code that conflicts with this managed access code, when Seam can identify it. @@ -205,7 +205,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -231,7 +231,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -274,7 +274,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -296,7 +296,7 @@ export type UnmanagedAccessCode = { /** * Indicates that this is an access code error. */ - is_access_code_error: boolean + is_access_code_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -319,12 +319,12 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -347,12 +347,12 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -375,12 +375,12 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -403,12 +403,12 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -431,7 +431,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -454,7 +454,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -477,7 +477,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -500,7 +500,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -523,7 +523,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -546,7 +546,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -569,7 +569,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -592,7 +592,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -615,7 +615,7 @@ export type UnmanagedAccessCode = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -653,7 +653,7 @@ export type UnmanagedAccessCode = { /** * Indicates that Seam does not manage the access code. */ - is_managed: boolean + is_managed: false /** * Name of the access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes. Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`. To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints. To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components). diff --git a/src/lib/resources/unmanaged-device.ts b/src/lib/resources/unmanaged-device.ts index 0ec130fb..cd87b65c 100644 --- a/src/lib/resources/unmanaged-device.ts +++ b/src/lib/resources/unmanaged-device.ts @@ -188,12 +188,12 @@ export type UnmanagedDevice = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -216,12 +216,12 @@ export type UnmanagedDevice = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -244,12 +244,12 @@ export type UnmanagedDevice = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -272,12 +272,12 @@ export type UnmanagedDevice = { /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ - is_connected_account_error: boolean + is_connected_account_error: true /** * Indicates that the error is not a device error. */ - is_device_error: boolean + is_device_error: false /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -300,7 +300,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -323,7 +323,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -346,7 +346,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -369,7 +369,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -392,7 +392,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -415,7 +415,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -438,7 +438,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -461,7 +461,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -484,7 +484,7 @@ export type UnmanagedDevice = { /** * Indicates that the error is a device error. */ - is_device_error: boolean + is_device_error: true /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. @@ -522,7 +522,7 @@ export type UnmanagedDevice = { /** * Indicates that Seam does not manage the device. */ - is_managed: boolean + is_managed: false /** * Location information for the device. diff --git a/src/lib/routes/access-grants/unmanaged/unmanaged.ts b/src/lib/routes/access-grants/unmanaged/unmanaged.ts index 0ac1c109..1c184b2a 100644 --- a/src/lib/routes/access-grants/unmanaged/unmanaged.ts +++ b/src/lib/routes/access-grants/unmanaged/unmanaged.ts @@ -295,7 +295,7 @@ export type AccessGrantsUnmanagedUpdateParameters = { /** * Must be set to true to convert the unmanaged access grant to managed. */ - is_managed: boolean + is_managed: true } /** diff --git a/src/lib/routes/devices/unmanaged/unmanaged.ts b/src/lib/routes/devices/unmanaged/unmanaged.ts index 8112f34b..d12a69e0 100644 --- a/src/lib/routes/devices/unmanaged/unmanaged.ts +++ b/src/lib/routes/devices/unmanaged/unmanaged.ts @@ -467,7 +467,7 @@ export type DevicesUnmanagedUpdateParameters = { /** * Indicates whether the device is managed. Set this parameter to `true` to convert an unmanaged device to managed. */ - is_managed?: boolean | undefined + is_managed?: true | undefined } /** diff --git a/src/lib/routes/user-identities/unmanaged/unmanaged.ts b/src/lib/routes/user-identities/unmanaged/unmanaged.ts index 98b2336f..e30ac384 100644 --- a/src/lib/routes/user-identities/unmanaged/unmanaged.ts +++ b/src/lib/routes/user-identities/unmanaged/unmanaged.ts @@ -279,7 +279,7 @@ export type UserIdentitiesUnmanagedUpdateParameters = { /** * Must be set to true to convert the unmanaged user identity to managed. */ - is_managed: boolean + is_managed: true /** * ID of the unmanaged user identity that you want to update. diff --git a/test/seam/connect/resource-types.test.ts b/test/seam/connect/resource-types.test.ts new file mode 100644 index 00000000..9cc859f7 --- /dev/null +++ b/test/seam/connect/resource-types.test.ts @@ -0,0 +1,26 @@ +import test from 'ava' + +import type { AccessCode, UnmanagedAccessCode } from '@seamapi/http/connect' + +const expectType = (_value: Expected): void => {} + +const assertAccessCodeNarrowing = ( + code: AccessCode | UnmanagedAccessCode, +): void => { + if (code.is_managed) { + expectType(code) + + // @ts-expect-error A managed access code cannot be the unmanaged variant. + expectType(code) + return + } + + expectType(code) + + // @ts-expect-error An unmanaged access code cannot be the managed variant. + expectType(code) +} + +test('access code resources narrow on is_managed', (t) => { + t.is(typeof assertAccessCodeNarrowing, 'function') +})