Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/seam/connect/internal/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export {
customer_data,
customer_portal,
customer_portal_theme,
datetime,
device_capability_flags,
device_metadata,
device_provider,
Expand Down
24 changes: 8 additions & 16 deletions src/lib/seam/connect/models/access-codes/managed-access-code.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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.'),
})
Expand Down Expand Up @@ -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.'),
})
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
34 changes: 12 additions & 22 deletions src/lib/seam/connect/models/access-codes/pending-mutations.ts
Original file line number Diff line number Diff line change
@@ -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.'),
})

Expand All @@ -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.",
Expand Down Expand Up @@ -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.'),
})
Expand Down
33 changes: 14 additions & 19 deletions src/lib/seam/connect/models/access-grants/access-grant.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
56 changes: 19 additions & 37 deletions src/lib/seam/connect/models/access-grants/access-method.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -83,10 +84,9 @@ const _access_method_warning_map = z.object({
export type AccessMethodWarningMap = z.infer<typeof _access_method_warning_map>

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(
Expand Down Expand Up @@ -120,10 +120,9 @@ export type AccessMethodErrorMap = z.infer<typeof _access_method_error_map>

// 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.'),
})

Expand Down Expand Up @@ -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.'),
})
Expand Down Expand Up @@ -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
Expand Down
31 changes: 9 additions & 22 deletions src/lib/seam/connect/models/access-grants/pending-mutations.ts
Original file line number Diff line number Diff line change
@@ -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.'),
})

Expand Down Expand Up @@ -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.'),
})
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand Down
Loading
Loading