diff --git a/src/lib/seam/connect/internal/schemas.ts b/src/lib/seam/connect/internal/schemas.ts index 344280c07..3a5603299 100644 --- a/src/lib/seam/connect/internal/schemas.ts +++ b/src/lib/seam/connect/internal/schemas.ts @@ -43,6 +43,7 @@ export { customer_data, customer_portal, customer_portal_theme, + datetime, device_capability_flags, device_metadata, device_provider, diff --git a/src/lib/seam/connect/models/access-codes/managed-access-code.ts b/src/lib/seam/connect/models/access-codes/managed-access-code.ts index e5540bc7d..da233953d 100644 --- a/src/lib/seam/connect/models/access-codes/managed-access-code.ts +++ b/src/lib/seam/connect/models/access-codes/managed-access-code.ts @@ -1,5 +1,6 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' import { device_and_connected_account_error_options } from '../devices/index.js' import { access_code_pending_mutations } from './pending-mutations.js' @@ -12,9 +13,7 @@ const common_access_code_error = z.object({ is_access_code_error: z .literal(true) .describe('Indicates that this is an access code error.'), - created_at: z - .string() - .datetime() + created_at: datetime .optional() .describe('Date and time at which Seam created the error.'), }) @@ -224,9 +223,7 @@ const common_access_code_warning = z.object({ .describe( 'Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.', ), - created_at: z - .string() - .datetime() + created_at: datetime .optional() .describe('Date and time at which Seam created the warning.'), }) @@ -508,10 +505,9 @@ export const access_code = z.object({ .describe( 'Code used for access. Typically, a numeric or alphanumeric string.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which the access code was created.'), + created_at: datetime.describe( + 'Date and time at which the access code was created.', + ), errors: z.array( z.discriminatedUnion('error_code', [ ...access_code_error.options, @@ -560,17 +556,13 @@ export const access_code = z.object({ is_managed: z .literal(true) .describe('Indicates whether Seam manages the access code.'), - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .optional() .describe( 'Date and time at which the time-bound access code becomes active.', ), - ends_at: z - .string() - .datetime() + ends_at: datetime .nullable() .optional() .describe( diff --git a/src/lib/seam/connect/models/access-codes/pending-mutations.ts b/src/lib/seam/connect/models/access-codes/pending-mutations.ts index 0fb36b5ab..e1b8e43aa 100644 --- a/src/lib/seam/connect/models/access-codes/pending-mutations.ts +++ b/src/lib/seam/connect/models/access-codes/pending-mutations.ts @@ -1,10 +1,11 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + const common_pending_mutation = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which the mutation was created.'), + created_at: datetime.describe( + 'Date and time at which the mutation was created.', + ), message: z.string().describe('Detailed description of the mutation.'), }) @@ -25,12 +26,9 @@ const deferring_creation = common_pending_mutation .describe( "Mutation code to indicate that Seam is waiting until closer to the access code's start time before programming it on the device.", ), - scheduled_at: z - .string() - .datetime() - .describe( - 'Date and time at which Seam will attempt to program this access code on the device.', - ), + scheduled_at: datetime.describe( + 'Date and time at which Seam will attempt to program this access code on the device.', + ), }) .describe( "Seam is waiting until closer to the access code's start time before programming it on the device.", @@ -101,28 +99,20 @@ const updating_time_frame = common_pending_mutation ), from: z .object({ - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .describe('Previous start time for the access code.'), - ends_at: z - .string() - .datetime() + ends_at: datetime .nullable() .describe('Previous end time for the access code.'), }) .describe('Previous time frame configuration.'), to: z .object({ - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .describe('New start time for the access code.'), - ends_at: z - .string() - .datetime() + ends_at: datetime .nullable() .describe('New end time for the access code.'), }) diff --git a/src/lib/seam/connect/models/access-grants/access-grant.ts b/src/lib/seam/connect/models/access-grants/access-grant.ts index 0d1272ac5..63184a602 100644 --- a/src/lib/seam/connect/models/access-grants/access-grant.ts +++ b/src/lib/seam/connect/models/access-grants/access-grant.ts @@ -1,13 +1,13 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' import { access_grant_pending_mutations } from './pending-mutations.js' import { requested_access_method } from './requested-access-method.js' const common_access_grant_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -37,10 +37,9 @@ const cannot_create_requested_access_methods_error = `) const common_access_grant_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -272,17 +271,13 @@ export const access_grant = z.object({ .describe( 'Instant Key URL. Only returned if the Access Grant has a single mobile_key access_method. ', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which the Access Grant was created.'), - starts_at: z - .string() - .datetime() - .describe('Date and time at which the Access Grant starts.'), - ends_at: z - .string() - .datetime() + created_at: datetime.describe( + 'Date and time at which the Access Grant was created.', + ), + starts_at: datetime.describe( + 'Date and time at which the Access Grant starts.', + ), + ends_at: datetime .nullable() .describe('Date and time at which the Access Grant ends.'), display_status: z diff --git a/src/lib/seam/connect/models/access-grants/access-method.ts b/src/lib/seam/connect/models/access-grants/access-method.ts index 52c93e65a..95ca18094 100644 --- a/src/lib/seam/connect/models/access-grants/access-method.ts +++ b/src/lib/seam/connect/models/access-grants/access-method.ts @@ -1,10 +1,11 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + const common_access_method_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -83,10 +84,9 @@ const _access_method_warning_map = z.object({ export type AccessMethodWarningMap = z.infer const common_access_method_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -120,10 +120,9 @@ export type AccessMethodErrorMap = z.infer // Pending mutations for access methods const common_pending_mutation = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which the mutation was created.'), + created_at: datetime.describe( + 'Date and time at which the mutation was created.', + ), message: z.string().describe('Detailed description of the mutation.'), }) @@ -188,30 +187,16 @@ const updating_access_times_mutation = common_pending_mutation ), from: z .object({ - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .describe('Previous start time for access.'), - ends_at: z - .string() - .datetime() - .nullable() - .describe('Previous end time for access.'), + ends_at: datetime.nullable().describe('Previous end time for access.'), }) .describe('Previous access time configuration.'), to: z .object({ - starts_at: z - .string() - .datetime() - .nullable() - .describe('New start time for access.'), - ends_at: z - .string() - .datetime() - .nullable() - .describe('New end time for access.'), + starts_at: datetime.nullable().describe('New start time for access.'), + ends_at: datetime.nullable().describe('New end time for access.'), }) .describe('New access time configuration.'), }) @@ -272,13 +257,10 @@ export const access_method = z.object({ .describe( 'Access method mode. Supported values: `code`, `card`, `mobile_key`, `cloud_key`.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which the access method was created.'), - issued_at: z - .string() - .datetime() + created_at: datetime.describe( + 'Date and time at which the access method was created.', + ), + issued_at: datetime .nullable() .describe('Date and time at which the access method was issued.'), is_issued: z diff --git a/src/lib/seam/connect/models/access-grants/pending-mutations.ts b/src/lib/seam/connect/models/access-grants/pending-mutations.ts index 7163bbe86..b7b927742 100644 --- a/src/lib/seam/connect/models/access-grants/pending-mutations.ts +++ b/src/lib/seam/connect/models/access-grants/pending-mutations.ts @@ -1,10 +1,11 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + const common_pending_mutation = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which the mutation was created.'), + created_at: datetime.describe( + 'Date and time at which the mutation was created.', + ), message: z.string().describe('Detailed description of the mutation.'), }) @@ -51,30 +52,16 @@ const updating_access_times_mutation = common_pending_mutation .describe('IDs of the access methods being updated.'), from: z .object({ - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .describe('Previous start time for access.'), - ends_at: z - .string() - .datetime() - .nullable() - .describe('Previous end time for access.'), + ends_at: datetime.nullable().describe('Previous end time for access.'), }) .describe('Previous access time configuration.'), to: z .object({ - starts_at: z - .string() - .datetime() - .nullable() - .describe('New start time for access.'), - ends_at: z - .string() - .datetime() - .nullable() - .describe('New end time for access.'), + starts_at: datetime.nullable().describe('New start time for access.'), + ends_at: datetime.nullable().describe('New end time for access.'), }) .describe('New access time configuration.'), }) diff --git a/src/lib/seam/connect/models/access-grants/requested-access-method.ts b/src/lib/seam/connect/models/access-grants/requested-access-method.ts index c4c0927e2..fb7561077 100644 --- a/src/lib/seam/connect/models/access-grants/requested-access-method.ts +++ b/src/lib/seam/connect/models/access-grants/requested-access-method.ts @@ -1,5 +1,7 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const requested_access_method = z.object({ display_name: z.string().describe('Display name of the access method.'), mode: z @@ -24,12 +26,9 @@ export const requested_access_method = z.object({ .describe( "Maximum number of times the instant key can be used. Only applicable when mode is 'mobile_key'. Defaults to 1 if not specified.", ), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the requested access method was added to the Access Grant.', - ), + created_at: datetime.describe( + 'Date and time at which the requested access method was added to the Access Grant.', + ), created_access_method_ids: z .array(z.string().uuid()) .describe( diff --git a/src/lib/seam/connect/models/acs/acs-access-group.ts b/src/lib/seam/connect/models/acs/acs-access-group.ts index f38558704..96f4ae891 100644 --- a/src/lib/seam/connect/models/acs/acs-access-group.ts +++ b/src/lib/seam/connect/models/acs/acs-access-group.ts @@ -1,5 +1,6 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' import { schedule } from '../schedule.js' import { acs_access_group_pending_mutations } from './acs-access-groups/pending-mutations.js' @@ -22,10 +23,9 @@ export type AcsAccessGroupExternalType = z.infer< > const common_acs_access_group_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -62,10 +62,9 @@ const _acs_access_group_error_map = z.object({ export type AcsAccessGroupErrorMap = z.infer const common_acs_access_group_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -146,10 +145,9 @@ const common_acs_access_group = z.object({ .describe( 'Display name that corresponds to the brand-specific terminology for the access group type.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which the access group was created.'), + created_at: datetime.describe( + 'Date and time at which the access group was created.', + ), errors: z .array(acs_access_group_errors) .describe('Errors associated with the `acs_access_group`.'), diff --git a/src/lib/seam/connect/models/acs/acs-access-groups/pending-mutations.ts b/src/lib/seam/connect/models/acs/acs-access-groups/pending-mutations.ts index 7a8a619e5..99a1ba471 100644 --- a/src/lib/seam/connect/models/acs/acs-access-groups/pending-mutations.ts +++ b/src/lib/seam/connect/models/acs/acs-access-groups/pending-mutations.ts @@ -1,10 +1,11 @@ import { z } from 'zod' +import { datetime } from '../../datetime.js' + const common_pending_mutation = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which the mutation was created.'), + created_at: datetime.describe( + 'Date and time at which the mutation was created.', + ), message: z.string().describe('Detailed description of the mutation.'), }) @@ -56,14 +57,10 @@ const updating_group_information = common_pending_mutation const access_schedule = z .object({ - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .describe('Starting time for the access schedule.'), - ends_at: z - .string() - .datetime() + ends_at: datetime .nullable() .describe('Ending time for the access schedule.'), }) diff --git a/src/lib/seam/connect/models/acs/acs-credential-pool.ts b/src/lib/seam/connect/models/acs/acs-credential-pool.ts index 071db4867..3b86fc779 100644 --- a/src/lib/seam/connect/models/acs/acs-credential-pool.ts +++ b/src/lib/seam/connect/models/acs/acs-credential-pool.ts @@ -1,5 +1,7 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const acs_credential_pool_external_type = z.enum(['hid_part_number']) export type AcsCredentialPoolExternalType = z.infer< @@ -12,7 +14,7 @@ export const acs_credential_pool = z.object({ display_name: z.string().min(1), external_type: acs_credential_pool_external_type, external_type_display_name: z.string(), - created_at: z.string().datetime(), + created_at: datetime, workspace_id: z.string().uuid(), }).describe(` --- diff --git a/src/lib/seam/connect/models/acs/acs-credential-provisioning-automation.ts b/src/lib/seam/connect/models/acs/acs-credential-provisioning-automation.ts index 4a4d61a63..ac5274a09 100644 --- a/src/lib/seam/connect/models/acs/acs-credential-provisioning-automation.ts +++ b/src/lib/seam/connect/models/acs/acs-credential-provisioning-automation.ts @@ -1,10 +1,12 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const acs_credential_provisioning_automation = z.object({ acs_credential_provisioning_automation_id: z.string().uuid(), credential_manager_acs_system_id: z.string().uuid(), user_identity_id: z.string().uuid(), - created_at: z.string().datetime(), + created_at: datetime, workspace_id: z.string().uuid(), }).describe(` --- @@ -31,10 +33,9 @@ export const enrollment_automation = z.object({ .describe( 'ID of the associated [user identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity).', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which the enrollment automation was created.'), + created_at: datetime.describe( + 'Date and time at which the enrollment automation was created.', + ), workspace_id: z .string() .uuid() diff --git a/src/lib/seam/connect/models/acs/acs-credential.ts b/src/lib/seam/connect/models/acs/acs-credential.ts index 0310ead1f..e83074f82 100644 --- a/src/lib/seam/connect/models/acs/acs-credential.ts +++ b/src/lib/seam/connect/models/acs/acs-credential.ts @@ -1,5 +1,6 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' import { acs_credential_akiles_metadata, acs_credential_visionline_metadata, @@ -36,10 +37,9 @@ export type AcsCredentialExternalType = z.infer< > const common_acs_credential_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -231,9 +231,7 @@ const common_acs_credential = z.object({ .describe( 'Indicates whether the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) has been encoded onto a card.', ), - issued_at: z - .string() - .datetime() + issued_at: datetime .optional() .nullable() .describe( @@ -253,12 +251,9 @@ const common_acs_credential = z.object({ .describe( 'Display name that corresponds to the brand-specific terminology for the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) type.', ), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created.', - ), + created_at: datetime.describe( + 'Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created.', + ), workspace_id: z .string() .uuid() @@ -282,10 +277,9 @@ const common_acs_credential = z.object({ z.object({ error_code: z.string(), message: z.string(), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), }), ) .describe( @@ -309,9 +303,7 @@ const common_acs_credential = z.object({ .describe( 'Indicates whether the latest state of the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) has been synced from Seam to the provider.', ), - latest_desired_state_synced_with_provider_at: z - .string() - .datetime() + latest_desired_state_synced_with_provider_at: datetime .nullable() .optional() .describe( @@ -366,9 +358,7 @@ export const unmanaged_acs_credential = common_acs_credential.merge( `) export const acs_credential_on_encoder = z.object({ - created_at: z - .string() - .datetime() + created_at: datetime .nullable() .describe( 'Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) was created.', @@ -381,16 +371,12 @@ export const acs_credential_on_encoder = z.object({ 'Indicates whether the credential has been issued (encoded onto a card).', ), - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .describe( 'Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) becomes usable.', ), - ends_at: z - .string() - .datetime() + ends_at: datetime .nullable() .describe( 'Date and time at which the [credential](https://docs.seam.co/low-level-apis/access-systems/managing-credentials) will stop being usable.', diff --git a/src/lib/seam/connect/models/acs/acs-credentials/pending-mutations.ts b/src/lib/seam/connect/models/acs/acs-credentials/pending-mutations.ts index dd119aa26..921ca662a 100644 --- a/src/lib/seam/connect/models/acs/acs-credentials/pending-mutations.ts +++ b/src/lib/seam/connect/models/acs/acs-credentials/pending-mutations.ts @@ -1,10 +1,11 @@ import { z } from 'zod' +import { datetime } from '../../datetime.js' + const common_pending_mutation = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which the mutation was created.'), + created_at: datetime.describe( + 'Date and time at which the mutation was created.', + ), message: z.string().describe('Detailed description of the mutation.'), }) diff --git a/src/lib/seam/connect/models/acs/acs-encoder.ts b/src/lib/seam/connect/models/acs/acs-encoder.ts index 69e33c5cf..68c3fbdb3 100644 --- a/src/lib/seam/connect/models/acs/acs-encoder.ts +++ b/src/lib/seam/connect/models/acs/acs-encoder.ts @@ -1,10 +1,11 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + const common_acs_encoder_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -65,12 +66,9 @@ export const acs_encoder = z.object({ .describe( 'Errors associated with the [encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners).', ), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners) was created.', - ), + created_at: datetime.describe( + 'Date and time at which the [encoder](https://docs.seam.co/low-level-apis/access-systems/working-with-card-encoders-and-scanners) was created.', + ), display_name: z .string() .describe( diff --git a/src/lib/seam/connect/models/acs/acs-entrance.ts b/src/lib/seam/connect/models/acs/acs-entrance.ts index b9e1ce724..4fac31b3a 100644 --- a/src/lib/seam/connect/models/acs/acs-entrance.ts +++ b/src/lib/seam/connect/models/acs/acs-entrance.ts @@ -1,5 +1,6 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' import { acs_entrance_akiles_metadata } from './metadata/akiles.js' import { acs_entrance_avigilon_alta_metadata } from './metadata/avigilon-alta.js' import { acs_entrance_dormakaba_ambiance_metadata } from './metadata/dormakaba-ambiance.js' @@ -18,10 +19,9 @@ const warning_code_description = 'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.' const common_acs_entrance_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -152,12 +152,9 @@ export const acs_entrance = z space_ids: z .array(z.string().uuid()) .describe('IDs of the spaces that the entrance is in.'), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) was created.', - ), + created_at: datetime.describe( + 'Date and time at which the [entrance](https://docs.seam.co/low-level-apis/access-systems/retrieving-entrance-details) was created.', + ), display_name: z .string() .describe( @@ -182,10 +179,9 @@ export const acs_entrance = z .describe( 'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), }), ) .describe( diff --git a/src/lib/seam/connect/models/acs/acs-system.ts b/src/lib/seam/connect/models/acs/acs-system.ts index 620183853..7b64e0b59 100644 --- a/src/lib/seam/connect/models/acs/acs-system.ts +++ b/src/lib/seam/connect/models/acs/acs-system.ts @@ -1,5 +1,7 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const acs_system_capability_flags = z.object({ // Access method type capability flags are not publicly exposed for ACS systems // They are only available for ACS entrances @@ -38,10 +40,9 @@ export const acs_system_external_type = z.enum([ export type AcsSystemExternalType = z.infer const common_acs_system_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -200,10 +201,9 @@ const _acs_system_error_map = z.object({ export type AcsSystemErrorMap = z.infer const common_acs_system_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -377,12 +377,9 @@ export const acs_system = z .describe( 'Name of the [access control system](https://docs.seam.co/low-level-apis/access-systems).', ), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [access control system](https://docs.seam.co/low-level-apis/access-systems) was created.', - ), + created_at: datetime.describe( + 'Date and time at which the [access control system](https://docs.seam.co/low-level-apis/access-systems) was created.', + ), workspace_id: z .string() .uuid() diff --git a/src/lib/seam/connect/models/acs/acs-users/acs-user.ts b/src/lib/seam/connect/models/acs/acs-users/acs-user.ts index 5c54bc2f0..839b9735e 100644 --- a/src/lib/seam/connect/models/acs/acs-users/acs-user.ts +++ b/src/lib/seam/connect/models/acs/acs-users/acs-user.ts @@ -1,5 +1,6 @@ import { z } from 'zod' +import { datetime } from '../../datetime.js' import { loose_phone_number } from '../../phone-number.js' import { schedule } from '../../schedule.js' import { acs_user_salto_ks_metadata } from '../metadata/salto.js' @@ -21,10 +22,9 @@ export const acs_user_external_type = z.enum([ export type AcsUserExternalType = z.infer const common_acs_user_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -122,10 +122,9 @@ const _acs_users_error_map = z.object({ export type AcsUsersErrorMap = z.infer const common_acs_user_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -254,12 +253,9 @@ const common_acs_user = z .describe( 'ID of the workspace that contains the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management).', ), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was created.', - ), + created_at: datetime.describe( + 'Date and time at which the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management) was created.', + ), display_name: z .string() .describe( @@ -330,7 +326,7 @@ const common_acs_user = z .describe( 'Pending mutations associated with the [access system user](https://docs.seam.co/low-level-apis/access-systems/user-management). Seam is in the process of pushing these mutations to the integrated access system.', ), - last_successful_sync_at: z.string().datetime().nullable().describe(` + last_successful_sync_at: datetime.nullable().describe(` --- undocumented: Only used internally. --- diff --git a/src/lib/seam/connect/models/acs/acs-users/pending-mutations.ts b/src/lib/seam/connect/models/acs/acs-users/pending-mutations.ts index bdd0c68fd..665bc22a6 100644 --- a/src/lib/seam/connect/models/acs/acs-users/pending-mutations.ts +++ b/src/lib/seam/connect/models/acs/acs-users/pending-mutations.ts @@ -1,12 +1,12 @@ import { z } from 'zod' +import { datetime } from '../../datetime.js' import { loose_phone_number } from '../../phone-number.js' const common_pending_mutation = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which the mutation was created.'), + created_at: datetime.describe( + 'Date and time at which the mutation was created.', + ), message: z.string().describe('Detailed description of the mutation.'), }) @@ -41,9 +41,7 @@ const deferring_creation = common_pending_mutation .describe( 'Mutation code to indicate that Seam is intentionally deferring the creation of the user on the access control system until the appropriate time.', ), - scheduled_at: z - .string() - .datetime() + scheduled_at: datetime .optional() .nullable() .describe('Optional: When the user creation is scheduled to occur.'), @@ -83,14 +81,10 @@ export const updating_user_information_mutation = const access_schedule = z .object({ - starts_at: z - .string() - .datetime() + starts_at: datetime .nullable() .describe('Starting time for the access schedule.'), - ends_at: z - .string() - .datetime() + ends_at: datetime .nullable() .describe('Starting time for the access schedule.'), }) diff --git a/src/lib/seam/connect/models/bridges/bridge-client-session.ts b/src/lib/seam/connect/models/bridges/bridge-client-session.ts index 261728245..68f8c1f34 100644 --- a/src/lib/seam/connect/models/bridges/bridge-client-session.ts +++ b/src/lib/seam/connect/models/bridges/bridge-client-session.ts @@ -1,15 +1,16 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + const common_bridge_client_session_error = z.object({ message: z .string() .describe( 'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), }) const error_code_description = @@ -89,12 +90,9 @@ export type BridgeClientSessionErrorMap = z.infer< > export const bridge_client_session = z.object({ - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the Seam Bridge client session was created.', - ), + created_at: datetime.describe( + 'Date and time at which the Seam Bridge client session was created.', + ), bridge_client_session_id: z .string() .uuid() @@ -110,10 +108,9 @@ export const bridge_client_session = z.object({ .describe( 'Pairing code for Seam Bridge. Use this code to pair Seam Bridge with your workspace.', ), - pairing_code_expires_at: z - .string() - .datetime() - .describe('Date and time at which the pairing code expires.'), + pairing_code_expires_at: datetime.describe( + 'Date and time at which the pairing code expires.', + ), tailscale_hostname: z .string() .describe('Tailscale hostname for Seam Bridge.'), @@ -137,9 +134,7 @@ export const bridge_client_session = z.object({ .string() .nullable() .describe('Telemetry token for the Seam Bridge client session.'), - telemetry_token_expires_at: z - .string() - .datetime() + telemetry_token_expires_at: datetime .nullable() .describe( 'Date and time at which the telemetry token for the Seam Bridge client session expires.', diff --git a/src/lib/seam/connect/models/bridges/bridge-connected-system.ts b/src/lib/seam/connect/models/bridges/bridge-connected-system.ts index 49bfb099e..73b193030 100644 --- a/src/lib/seam/connect/models/bridges/bridge-connected-system.ts +++ b/src/lib/seam/connect/models/bridges/bridge-connected-system.ts @@ -1,24 +1,22 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const bridge_connected_system = z.object({ bridge_id: z .string() .uuid() .describe('ID of Seam Bridge connected to the access system.'), - bridge_created_at: z - .string() - .datetime() - .describe('Date and time at which Seam Bridge was created.'), + bridge_created_at: datetime.describe( + 'Date and time at which Seam Bridge was created.', + ), connected_account_id: z .string() .uuid() .describe('ID of the connected account associated with Seam Bridge.'), - connected_account_created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the connected account associated with Seam Bridge was created.', - ), + connected_account_created_at: datetime.describe( + 'Date and time at which the connected account associated with Seam Bridge was created.', + ), acs_system_id: z .string() .uuid() diff --git a/src/lib/seam/connect/models/bridges/bridge.ts b/src/lib/seam/connect/models/bridges/bridge.ts index c7beb0027..520349dc6 100644 --- a/src/lib/seam/connect/models/bridges/bridge.ts +++ b/src/lib/seam/connect/models/bridges/bridge.ts @@ -1,15 +1,16 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const bridge = z.object({ bridge_id: z.string().uuid().describe('ID of Seam Bridge.'), workspace_id: z .string() .uuid() .describe('ID of the workspace that contains Seam Bridge.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam Bridge was created.'), + created_at: datetime.describe( + 'Date and time at which Seam Bridge was created.', + ), }).describe(` --- undocumented: Unreleased. diff --git a/src/lib/seam/connect/models/client-sessions/client-session.ts b/src/lib/seam/connect/models/client-sessions/client-session.ts index 5b369e8f1..098549820 100644 --- a/src/lib/seam/connect/models/client-sessions/client-session.ts +++ b/src/lib/seam/connect/models/client-sessions/client-session.ts @@ -1,23 +1,19 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const client_session = z.object({ client_session_id: z.string().uuid().describe('ID of the client session.'), workspace_id: z .string() .uuid() .describe('ID of the workspace associated with the client session.'), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens) was created.', - ), - expires_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens) expires.', - ), + created_at: datetime.describe( + 'Date and time at which the [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens) was created.', + ), + expires_at: datetime.describe( + 'Date and time at which the [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens) expires.', + ), token: z .string() .describe( diff --git a/src/lib/seam/connect/models/connect-webviews/connect-webview.ts b/src/lib/seam/connect/models/connect-webviews/connect-webview.ts index 88f708484..dc617ae3d 100644 --- a/src/lib/seam/connect/models/connect-webviews/connect-webview.ts +++ b/src/lib/seam/connect/models/connect-webviews/connect-webview.ts @@ -1,6 +1,7 @@ import { z } from 'zod' import { custom_metadata } from '../custom-metadata.js' +import { datetime } from '../datetime.js' import { provider_capability } from '../provider-capability.js' export const connect_webview_device_selection_mode = z.enum([ @@ -15,10 +16,9 @@ export const connect_webview = z.object({ .string() .uuid() .describe('ID of the workspace that contains the Connect Webview.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which the Connect Webview was created.'), + created_at: datetime.describe( + 'Date and time at which the Connect Webview was created.', + ), connected_account_id: z .string() .uuid() @@ -104,9 +104,7 @@ export const connect_webview = z.object({ .describe( 'Indicates whether Seam should [finish syncing all devices](https://docs.seam.co/core-concepts/connect-webviews/customizing-connect-webviews#wait_for_device_creation) in a newly-connected account before completing the associated Connect Webview.', ), - authorized_at: z - .string() - .datetime() + authorized_at: datetime .nullable() .describe( 'Date and time at which the user authorized (through the Connect Webview) the management of their devices.', diff --git a/src/lib/seam/connect/models/connected-accounts/connected-account.ts b/src/lib/seam/connect/models/connected-accounts/connected-account.ts index 40541bfe4..8bdf27e84 100644 --- a/src/lib/seam/connect/models/connected-accounts/connected-account.ts +++ b/src/lib/seam/connect/models/connected-accounts/connected-account.ts @@ -1,13 +1,13 @@ import { z } from 'zod' import { custom_metadata } from '../custom-metadata.js' +import { datetime } from '../datetime.js' import { provider_capability } from '../provider-capability.js' const common_connected_account_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -34,10 +34,9 @@ const warning_code_description = 'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.' const common_connected_account_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -335,9 +334,7 @@ export const connected_account = z.object({ .string() .uuid() .describe('ID of the connected account.'), - created_at: z - .string() - .datetime() + created_at: datetime .optional() .describe('Date and time at which the connected account was created.'), user_identifier: z diff --git a/src/lib/seam/connect/models/customer/access-grant-resources.ts b/src/lib/seam/connect/models/customer/access-grant-resources.ts index 82ad500cb..f43efe9ac 100644 --- a/src/lib/seam/connect/models/customer/access-grant-resources.ts +++ b/src/lib/seam/connect/models/customer/access-grant-resources.ts @@ -1,6 +1,7 @@ import { z } from 'zod' import { custom_metadata_input } from '../custom-metadata.js' +import { datetime } from '../datetime.js' // Base access grant resource with common fields const base_access_grant_resource = z.object({ @@ -8,14 +9,10 @@ const base_access_grant_resource = z.object({ .string() .optional() .describe('Your name for this access grant resource.'), - starts_at: z - .string() - .datetime() + starts_at: datetime .optional() .describe('Starting date and time for the access grant.'), - ends_at: z - .string() - .datetime() + ends_at: datetime .optional() .describe('Ending date and time for the access grant.'), preferred_code: z diff --git a/src/lib/seam/connect/models/customer/customer.ts b/src/lib/seam/connect/models/customer/customer.ts index 156baeb68..f56d937bb 100644 --- a/src/lib/seam/connect/models/customer/customer.ts +++ b/src/lib/seam/connect/models/customer/customer.ts @@ -1,5 +1,7 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const customer = z.object({ customer_key: z .string() @@ -8,10 +10,9 @@ export const customer = z.object({ .string() .uuid() .describe('ID of the workspace associated with the customer.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which the customer was created.'), + created_at: datetime.describe( + 'Date and time at which the customer was created.', + ), }).describe(` --- route_path: /customers diff --git a/src/lib/seam/connect/models/customization-profiles/customization-profile.ts b/src/lib/seam/connect/models/customization-profiles/customization-profile.ts index e50d3266a..2b13acb18 100644 --- a/src/lib/seam/connect/models/customization-profiles/customization-profile.ts +++ b/src/lib/seam/connect/models/customization-profiles/customization-profile.ts @@ -1,6 +1,7 @@ import { z } from 'zod' import { hex_color_code } from '../colors.js' +import { datetime } from '../datetime.js' export const customer_portal_theme = z.object({ primary_color: hex_color_code.optional(), @@ -23,7 +24,7 @@ export const customization_profile = z.object({ workspace_id: z.string().uuid(), name: z.string().nullable(), customization_profile_id: z.string().uuid(), - created_at: z.string().datetime(), + created_at: datetime, logo_url: z.string().url().optional(), primary_color: z.string().optional(), secondary_color: z.string().optional(), diff --git a/src/lib/seam/connect/models/datetime.ts b/src/lib/seam/connect/models/datetime.ts new file mode 100644 index 000000000..7b2e95a4e --- /dev/null +++ b/src/lib/seam/connect/models/datetime.ts @@ -0,0 +1,3 @@ +import { z } from 'zod' + +export const datetime = z.string().datetime({ offset: true }) diff --git a/src/lib/seam/connect/models/devices/device.ts b/src/lib/seam/connect/models/devices/device.ts index d06c328a3..81f124c79 100644 --- a/src/lib/seam/connect/models/devices/device.ts +++ b/src/lib/seam/connect/models/devices/device.ts @@ -2,6 +2,7 @@ import { z } from 'zod' import { connected_account_error } from '../connected-accounts/index.js' import { custom_metadata } from '../custom-metadata.js' +import { datetime } from '../datetime.js' import { capabilities } from './capabilities-supported.js' import { capability_properties } from './capability-properties/index.js' import { device_metadata } from './device-metadata.js' @@ -118,10 +119,9 @@ const common_device_error = z.object({ is_device_error: z .literal(true) .describe('Indicates that the error is a device error.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), }) const error_code_description = @@ -357,10 +357,9 @@ const common_device_warning = z.object({ .describe( 'Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), }) const partial_backup_access_code_pool = common_device_warning.extend({ @@ -1149,10 +1148,9 @@ export const device = z --- Array of warnings associated with the device. Each warning object within the array contains two fields: \`warning_code\` and \`message\`. \`warning_code\` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. \`message\` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. `), - created_at: z - .string() - .datetime() - .describe('Date and time at which the device object was created.'), + created_at: datetime.describe( + 'Date and time at which the device object was created.', + ), is_managed: z .literal(true) .describe( diff --git a/src/lib/seam/connect/models/devices/phone.ts b/src/lib/seam/connect/models/devices/phone.ts index cc7edc05e..c3ffe46fb 100644 --- a/src/lib/seam/connect/models/devices/phone.ts +++ b/src/lib/seam/connect/models/devices/phone.ts @@ -1,5 +1,6 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' import { device } from './device.js' import { phone_device_type } from './device-type.js' import { phone_specific_properties } from './phone-properties.js' @@ -41,10 +42,9 @@ export const phone = z.object({ .string() .describe('Unique identifier of the type of error.'), message: z.string().describe('Detailed description of the error.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), }), ) .describe('Errors associated with the phone.'), @@ -55,10 +55,9 @@ export const phone = z.object({ .string() .describe('Unique identifier of the type of warning.'), message: z.string().describe('Detailed description of the warning.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), }), ) .describe('Warnings associated with the phone.'), diff --git a/src/lib/seam/connect/models/events/common.ts b/src/lib/seam/connect/models/events/common.ts index de1ea9287..47305a6f2 100644 --- a/src/lib/seam/connect/models/events/common.ts +++ b/src/lib/seam/connect/models/events/common.ts @@ -1,19 +1,17 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const common_event = z.object({ event_id: z.string().uuid().describe('ID of the event.'), workspace_id: z .string() .uuid() .describe('ID of the workspace associated with the event.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which the event was created.'), - occurred_at: z - .string() - .datetime() - .describe('Date and time at which the event occurred.'), + created_at: datetime.describe( + 'Date and time at which the event was created.', + ), + occurred_at: datetime.describe('Date and time at which the event occurred.'), event_description: z .string() .optional() @@ -29,10 +27,9 @@ const warning_code_description = export const common_event_error = z .object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -46,10 +43,9 @@ export const common_event_error = z export const common_event_warning = z .object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( diff --git a/src/lib/seam/connect/models/index.ts b/src/lib/seam/connect/models/index.ts index 1bb4f7f91..34511d465 100644 --- a/src/lib/seam/connect/models/index.ts +++ b/src/lib/seam/connect/models/index.ts @@ -15,6 +15,7 @@ export * from './customer/index.js' export * from './customer/location-resources.js' export * from './customer/user-identity-resources.js' export * from './customization-profiles/index.js' +export * from './datetime.js' export * from './devices/index.js' export * from './events/index.js' export * from './instant-keys/index.js' diff --git a/src/lib/seam/connect/models/instant-keys/instant-key.ts b/src/lib/seam/connect/models/instant-keys/instant-key.ts index e0da2cf72..3f91793ab 100644 --- a/src/lib/seam/connect/models/instant-keys/instant-key.ts +++ b/src/lib/seam/connect/models/instant-keys/instant-key.ts @@ -1,15 +1,16 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const instant_key = z.object({ instant_key_id: z.string().uuid().describe('ID of the Instant Key.'), workspace_id: z .string() .uuid() .describe('ID of the workspace that contains the Instant Key.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which the Instant Key was created.'), + created_at: datetime.describe( + 'Date and time at which the Instant Key was created.', + ), instant_key_url: z .string() .url() @@ -24,10 +25,9 @@ export const instant_key = z.object({ .string() .uuid() .describe('ID of the user identity associated with the Instant Key.'), - expires_at: z - .string() - .datetime() - .describe('Date and time at which the Instant Key expires.'), + expires_at: datetime.describe( + 'Date and time at which the Instant Key expires.', + ), customization_profile_id: z .string() .uuid() diff --git a/src/lib/seam/connect/models/partner/customer-portal.ts b/src/lib/seam/connect/models/partner/customer-portal.ts index 822e5f0ef..b469f22e8 100644 --- a/src/lib/seam/connect/models/partner/customer-portal.ts +++ b/src/lib/seam/connect/models/partner/customer-portal.ts @@ -1,21 +1,21 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const customer_portal = z .object({ url: z.string().url().describe('URL for the customer portal.'), customer_key: z.string().describe('Customer key for the customer portal.'), - expires_at: z - .string() - .datetime() - .describe('Date and time at which the customer portal link expires.'), + expires_at: datetime.describe( + 'Date and time at which the customer portal link expires.', + ), workspace_id: z .string() .uuid() .describe('ID of the workspace associated with the customer portal.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which the customer portal link was created.'), + created_at: datetime.describe( + 'Date and time at which the customer portal link was created.', + ), }) .describe( ` diff --git a/src/lib/seam/connect/models/partner/magic-link.ts b/src/lib/seam/connect/models/partner/magic-link.ts index c95bd41cb..c2a51c45a 100644 --- a/src/lib/seam/connect/models/partner/magic-link.ts +++ b/src/lib/seam/connect/models/partner/magic-link.ts @@ -1,20 +1,20 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const magic_link = z.object({ url: z.string().url().describe('URL for the magic link.'), customer_key: z.string().describe('Customer key for the magic link.'), - expires_at: z - .string() - .datetime() - .describe('Date and time at which the magic link expires.'), + expires_at: datetime.describe( + 'Date and time at which the magic link expires.', + ), workspace_id: z .string() .uuid() .describe('ID of the workspace associated with the magic link.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which the magic link was created.'), + created_at: datetime.describe( + 'Date and time at which the magic link was created.', + ), }).describe(` --- undocumented: Unreleased. diff --git a/src/lib/seam/connect/models/schedule.ts b/src/lib/seam/connect/models/schedule.ts index a83193a13..b5f1b49bd 100644 --- a/src/lib/seam/connect/models/schedule.ts +++ b/src/lib/seam/connect/models/schedule.ts @@ -1,16 +1,13 @@ import { z } from 'zod' +import { datetime } from './datetime.js' + export const start_end_schedule = z .object({ - starts_at: z - .string() - .datetime() - .describe( - "Date and time at which the user's access starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.", - ), - ends_at: z - .string() - .datetime() + starts_at: datetime.describe( + "Date and time at which the user's access starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.", + ), + ends_at: datetime .describe( "Date and time at which the user's access ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.", ) diff --git a/src/lib/seam/connect/models/spaces/space.ts b/src/lib/seam/connect/models/spaces/space.ts index 0c702f8d6..21b25df98 100644 --- a/src/lib/seam/connect/models/spaces/space.ts +++ b/src/lib/seam/connect/models/spaces/space.ts @@ -1,5 +1,7 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + const time_of_day_re = /^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/ export const space_customer_data = z @@ -47,10 +49,9 @@ export const space = z.object({ .describe('Unique key for the space within the workspace.'), name: z.string().describe('Name of the space.'), display_name: z.string().describe('Display name for the space.'), - created_at: z - .string() - .datetime() - .describe('Date and time at which the space was created.'), + created_at: datetime.describe( + 'Date and time at which the space was created.', + ), device_count: z.number().describe('Number of devices in the space.'), acs_entrance_count: z.number().describe('Number of entrances in the space.'), customer_key: z diff --git a/src/lib/seam/connect/models/thermostats/thermostat-program.ts b/src/lib/seam/connect/models/thermostats/thermostat-program.ts index 888f00506..43fa109dc 100644 --- a/src/lib/seam/connect/models/thermostats/thermostat-program.ts +++ b/src/lib/seam/connect/models/thermostats/thermostat-program.ts @@ -1,5 +1,7 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const thermostat_daily_program_period = z .object({ starts_at_time: z @@ -42,12 +44,9 @@ export const thermostat_daily_program = z.object({ .describe( 'ID of the workspace that contains the thermostat daily program.', ), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the thermostat daily program was created.', - ), + created_at: datetime.describe( + 'Date and time at which the thermostat daily program was created.', + ), }).describe(` --- route_path: /thermostats/daily_programs @@ -91,12 +90,9 @@ export const thermostat_weekly_program = z.object({ .uuid() .nullable() .describe('ID of the thermostat daily program to run on Sundays.'), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the thermostat weekly program was created.', - ), + created_at: datetime.describe( + 'Date and time at which the thermostat weekly program was created.', + ), }) export type ThermostatDailyProgram = z.infer diff --git a/src/lib/seam/connect/models/thermostats/thermostat-schedule.ts b/src/lib/seam/connect/models/thermostats/thermostat-schedule.ts index 71588fe46..9e14af6e3 100644 --- a/src/lib/seam/connect/models/thermostats/thermostat-schedule.ts +++ b/src/lib/seam/connect/models/thermostats/thermostat-schedule.ts @@ -1,5 +1,7 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' + export const thermostat_schedule = z.object({ thermostat_schedule_id: z .string() @@ -33,34 +35,25 @@ export const thermostat_schedule = z.object({ .describe( "Number of minutes for which a person at the thermostat can change the thermostat's settings after the activation of the scheduled [climate preset](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-climate-presets). See also [Specifying Manual Override Permissions](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules#specifying-manual-override-permissions).", ), - starts_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.', - ), + starts_at: datetime.describe( + 'Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.', + ), is_override_allowed: z .boolean() .optional() .describe( "Indicates whether a person at the thermostat can change the thermostat's settings after the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts.", ), - ends_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.', - ), + ends_at: datetime.describe( + 'Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.', + ), workspace_id: z .string() .uuid() .describe('ID of the workspace that contains the thermostat schedule.'), - created_at: z - .string() - .datetime() - .describe( - 'Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) was created.', - ), + created_at: datetime.describe( + 'Date and time at which the [thermostat schedule](https://docs.seam.co/capability-guides/thermostats/creating-and-managing-thermostat-schedules) was created.', + ), errors: z .array( z.object({ @@ -74,10 +67,9 @@ export const thermostat_schedule = z.object({ .describe( 'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), }), ) .describe( diff --git a/src/lib/seam/connect/models/user-identities/user-identity.ts b/src/lib/seam/connect/models/user-identities/user-identity.ts index f090dbf2c..19e145e28 100644 --- a/src/lib/seam/connect/models/user-identities/user-identity.ts +++ b/src/lib/seam/connect/models/user-identities/user-identity.ts @@ -1,12 +1,12 @@ import { z } from 'zod' +import { datetime } from '../datetime.js' import { loose_phone_number } from '../phone-number.js' const common_user_identity_error = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the error.'), + created_at: datetime.describe( + 'Date and time at which Seam created the error.', + ), message: z .string() .describe( @@ -15,10 +15,9 @@ const common_user_identity_error = z.object({ }) const common_user_identity_warning = z.object({ - created_at: z - .string() - .datetime() - .describe('Date and time at which Seam created the warning.'), + created_at: datetime.describe( + 'Date and time at which Seam created the warning.', + ), message: z .string() .describe( @@ -139,10 +138,9 @@ export const user_identity = z.object({ .describe( 'Keys that other user identities used to have before they were merged into this user identity. Looking up any of them returns this user identity.', ), - created_at: z - .string() - .datetime() - .describe('Date and time at which the user identity was created.'), + created_at: datetime.describe( + 'Date and time at which the user identity was created.', + ), workspace_id: z .string() .uuid()