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
66 changes: 66 additions & 0 deletions src/lib/seam/connect/models/access-codes/managed-access-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,38 @@ const no_space_for_access_code_on_device = common_access_code_error.extend({
No space for access code on device.
`)

const failed_to_issue = common_access_code_error.extend({
error_code: z.literal('failed_to_issue').describe(error_code_description),
}).describe(`
---
resource_type: access_code
undocumented: Unreleased.
---
Seam was unable to issue this access code before its start time, so the recipient may be unable to unlock the device. This usually points to a problem that needs attention, such as an offline or disconnected device. Seam keeps retrying, and this error clears automatically if the access code is eventually issued.
`)

const failed_to_apply_mutations = common_access_code_error.extend({
error_code: z
.literal('failed_to_apply_mutations')
.describe(error_code_description),
}).describe(`
---
resource_type: access_code
undocumented: Unreleased.
---
Seam was unable to apply this access code's pending mutations to the device, so the code on the device does not match its requested state. Seam keeps retrying, and this error clears automatically once the mutations are applied.
`)

const failed_to_expire = common_access_code_error.extend({
error_code: z.literal('failed_to_expire').describe(error_code_description),
}).describe(`
---
resource_type: access_code
undocumented: Unreleased.
---
This access code is still active on the device even though its \`ends_at\` has passed, so the recipient may still be able to unlock the device after their access window ended. Seam is attempting to remove it, and this error clears automatically once the access code is no longer active.
`)

const access_code_inactive_error = common_access_code_error.extend({
error_code: z
.literal('access_code_inactive')
Expand Down Expand Up @@ -156,6 +188,9 @@ const access_code_error = z
conflicting_external_modification_error,
access_code_inactive_error,
code_constraints_violated,
failed_to_issue,
failed_to_apply_mutations,
failed_to_expire,
])
.describe(
'Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).',
Expand All @@ -178,6 +213,9 @@ const _access_code_error_map = z.object({
.nullable(),
access_code_inactive: access_code_inactive_error.optional().nullable(),
code_constraints_violated: code_constraints_violated.optional().nullable(),
failed_to_issue: failed_to_issue.optional().nullable(),
failed_to_apply_mutations: failed_to_apply_mutations.optional().nullable(),
failed_to_expire: failed_to_expire.optional().nullable(),
})

export type AccessCodeErrorMap = z.infer<typeof _access_code_error_map>
Expand Down Expand Up @@ -260,6 +298,28 @@ const delay_in_removing_from_device = common_access_code_warning.extend({
Delay in removing code from device.
`)

const delay_in_issuing = common_access_code_warning.extend({
warning_code: z
.literal('delay_in_issuing')
.describe(warning_code_description),
}).describe(`
---
undocumented: Unreleased.
---
Seam has not yet issued this access code, even though its start time is approaching, so access may not be ready when the recipient arrives. Seam is still attempting to issue it, and this warning clears automatically once issuance succeeds.
`)

const delay_in_applying_mutations = common_access_code_warning.extend({
warning_code: z
.literal('delay_in_applying_mutations')
.describe(warning_code_description),
}).describe(`
---
undocumented: Unreleased.
---
Seam has not yet applied this access code's pending mutations to the device, so the code on the device does not yet match its requested state. Seam is still attempting to apply them, and this warning clears automatically once the mutations are applied.
`)

const third_party_integration_detected = common_access_code_warning
.extend({
warning_code: z
Expand Down Expand Up @@ -317,6 +377,8 @@ const access_code_warning = z
external_modification_in_effect_warning,
delay_in_setting_on_device,
delay_in_removing_from_device,
delay_in_issuing,
delay_in_applying_mutations,
third_party_integration_detected,
igloo_algopin_must_be_used_within_24_hours,
management_transferred,
Expand All @@ -341,6 +403,10 @@ const _access_code_warning_map = z.object({
delay_in_removing_from_device: delay_in_removing_from_device
.optional()
.nullable(),
delay_in_issuing: delay_in_issuing.optional().nullable(),
delay_in_applying_mutations: delay_in_applying_mutations
.optional()
.nullable(),
third_party_integration_detected: third_party_integration_detected
.optional()
.nullable(),
Expand Down
99 changes: 99 additions & 0 deletions src/lib/seam/connect/models/events/access-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,99 @@ export type AccessCodeFailedToSetOnDeviceEvent = z.infer<
typeof access_code_failed_to_set_on_device_event
>

export const access_code_issued_event = access_code_event.extend({
event_type: z.literal('access_code.issued'),
code,
}).describe(`
---
route_path: /access_codes
undocumented: Unreleased.
---
An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) was issued.
`)

export type AccessCodeIssuedEvent = z.infer<typeof access_code_issued_event>

export const access_code_delay_in_issuing_event = access_code_event
.extend({
event_type: z.literal('access_code.delay_in_issuing'),
})
.extend(access_code_event_issue_properties).describe(`
---
route_path: /access_codes
undocumented: Unreleased.
---
Seam has not yet issued this [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes), even though its start time is approaching, so access may not be ready when the recipient arrives. Seam is still attempting to issue it, and the accompanying \`delay_in_issuing\` warning clears automatically once issuance succeeds.
`)

export type AccessCodeDelayInIssuingEvent = z.infer<
typeof access_code_delay_in_issuing_event
>

export const access_code_failed_to_issue_event = access_code_event
.extend({
event_type: z.literal('access_code.failed_to_issue'),
})
.extend(access_code_event_issue_properties).describe(`
---
route_path: /access_codes
undocumented: Unreleased.
---
Seam was unable to issue this [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) before its start time, so the recipient may be unable to unlock the device. This usually points to a problem that needs attention, such as an offline or disconnected device. Seam keeps retrying, and the accompanying \`failed_to_issue\` error clears automatically if the access code is eventually issued.
`)

export type AccessCodeFailedToIssueEvent = z.infer<
typeof access_code_failed_to_issue_event
>

export const access_code_delay_in_applying_mutations_event = access_code_event
.extend({
event_type: z.literal('access_code.delay_in_applying_mutations'),
})
.extend(access_code_event_issue_properties).describe(`
---
route_path: /access_codes
undocumented: Unreleased.
---
Seam has not yet applied this [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes)'s pending mutations to the device, so the code on the device does not yet match its requested state. Seam is still attempting to apply them, and the accompanying \`delay_in_applying_mutations\` warning clears automatically once the mutations are applied.
`)

export type AccessCodeDelayInApplyingMutationsEvent = z.infer<
typeof access_code_delay_in_applying_mutations_event
>

export const access_code_failed_to_apply_mutations_event = access_code_event
.extend({
event_type: z.literal('access_code.failed_to_apply_mutations'),
})
.extend(access_code_event_issue_properties).describe(`
---
route_path: /access_codes
undocumented: Unreleased.
---
Seam was unable to apply this [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes)'s pending mutations to the device, so the code on the device does not match its requested state. Seam keeps retrying, and the accompanying \`failed_to_apply_mutations\` error clears automatically once the mutations are applied.
`)

export type AccessCodeFailedToApplyMutationsEvent = z.infer<
typeof access_code_failed_to_apply_mutations_event
>

export const access_code_failed_to_expire_event = access_code_event
.extend({
event_type: z.literal('access_code.failed_to_expire'),
})
.extend(access_code_event_issue_properties).describe(`
---
route_path: /access_codes
undocumented: Unreleased.
---
An [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes) is still active on the device even though its \`ends_at\` has passed, so the recipient may still be able to unlock the device after their access window ended. Seam is attempting to remove it, and the accompanying \`failed_to_expire\` error clears automatically once the access code is no longer active.
`)

export type AccessCodeFailedToExpireEvent = z.infer<
typeof access_code_failed_to_expire_event
>

export const access_code_deleted_event = access_code_event.extend({
event_type: z.literal('access_code.deleted'),
code: code.nullable(),
Expand Down Expand Up @@ -460,6 +553,12 @@ export const access_code_events = [
access_code_removed_from_device_event,
access_code_delay_in_setting_on_device_event,
access_code_failed_to_set_on_device_event,
access_code_issued_event,
access_code_delay_in_issuing_event,
access_code_failed_to_issue_event,
access_code_delay_in_applying_mutations_event,
access_code_failed_to_apply_mutations_event,
access_code_failed_to_expire_event,
access_code_deleted_event,
access_code_delay_in_removing_from_device_event,
access_code_failed_to_remove_from_device_event,
Expand Down
Loading
Loading