Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ export const access_method = z.object({
issued_at: z
.string()
.datetime()
.nullable()
.optional()
.describe('Date and time at which the access method was issued.'),
instant_key_url: z
.string()
.optional()
.describe('URL of instant key for mobile key access methods.'),
}).describe(`
---
undocumented: Unreleased.
Expand Down
5 changes: 5 additions & 0 deletions src/lib/seam/connect/models/acs/acs-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const acs_system_capability_flags = z.object({
.describe(
'Indicates whether the [access control system](https://docs.seam.co/latest/capability-guides/access-systems) supports [adding users to access groups](https://docs.seam.co/latest/capability-guides/access-systems/assigning-users-to-access-groups#add-an-acs-user-to-an-access-group). See also [Access Group-based Access Control Systems](https://docs.seam.co/latest/capability-guides/access-systems/understanding-access-control-system-differences#access-group-based-access-control-systems).',
),
can_create_user: z.boolean().optional(),
can_delete_user: z.boolean().optional(),
can_update_user_information: z.boolean().optional(),
can_update_user_supension_state: z.boolean().optional(),
can_update_user_group_membership: z.boolean().optional(),
})

export const acs_location = z.object({
Expand Down
28 changes: 6 additions & 22 deletions src/lib/seam/connect/models/acs/acs-users/acs-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,6 @@ const common_acs_user = z
.describe(
'Phone number of the user identity associated with the [ACS user](https://docs.seam.co/latest/capability-guides/access-systems/user-management) in E.164 format (for example, `+15555550100`).',
),
latest_desired_state_synced_with_provider_at: z
.string()
.datetime()
.nullable()
.optional().describe(`
---
undocumented: Only used internally.
---
`),
is_latest_desired_state_synced_with_provider: z
.boolean()
.nullable()
.optional().describe(`
---
undocumented: Only used internally.
---
`),
warnings: z
.array(acs_users_warnings)
.describe(
Expand All @@ -326,11 +309,12 @@ const common_acs_user = z
.describe(
'Errors associated with the [ACS user](https://docs.seam.co/latest/capability-guides/access-systems/user-management).',
),
pending_mutations: z.array(acs_user_pending_mutations).optional().describe(`
---
undocumented: Experimental.
---
`),
pending_mutations: z
.array(acs_user_pending_mutations)
.optional()
.describe(
'Pending mutations associated with the [ACS user](https://docs.seam.co/latest/capability-guides/access-systems/user-management). Seam is in the process of pushing these mutations to the integrated access system.',
),
})
.merge(user_fields)

Expand Down
89 changes: 62 additions & 27 deletions src/lib/seam/connect/models/acs/acs-users/pending-mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@ import { z } from 'zod'
import { phone_number } from '../../phone-number.js'

const common_pending_mutation = z.object({
created_at: z.string().datetime(),
message: z.string(),
created_at: z
.string()
.datetime()
.describe('Date and time at which the mutation was created.'),
message: z.string().describe('Detailed description of the mutation.'),
})

const creating = common_pending_mutation.extend({
mutation_code: z.literal('creating'),
})
const creating = common_pending_mutation
.extend({
mutation_code: z.literal('creating'),
})
.describe(
'Seam is in the process of pushing a user creation to the integrated access system.',
)

const deleting = common_pending_mutation.extend({
mutation_code: z.literal('deleting'),
})
const deleting = common_pending_mutation
.extend({
mutation_code: z.literal('deleting'),
})
.describe(
'Seam is in the process of pushing a user deletion to the integrated access system.',
)

const acs_user_info = z.object({
email_address: z.string().email().nullable(),
Expand All @@ -33,27 +44,51 @@ const access_schedule = z.object({
ends_at: z.string().datetime().nullable(),
})

const updating_access_schedule_mutation = common_pending_mutation.extend({
mutation_code: z.literal('updating_access_schedule'),
from: access_schedule,
to: access_schedule,
})
const updating_access_schedule_mutation = common_pending_mutation
.extend({
mutation_code: z.literal('updating_access_schedule'),
from: access_schedule,
to: access_schedule,
})
.describe(
'Seam is in the process of pushing an access schedule update to the integrated access system.',
)

const updating_suspension_state_mutation = common_pending_mutation.extend({
mutation_code: z.literal('updating_suspension_state'),
from: z.object({ is_suspended: z.boolean() }),
to: z.object({ is_suspended: z.boolean() }),
})
const updating_suspension_state_mutation = common_pending_mutation
.extend({
mutation_code: z.literal('updating_suspension_state'),
from: z.object({ is_suspended: z.boolean() }),
to: z.object({ is_suspended: z.boolean() }),
})
.describe(
'Seam is in the process of pushing a suspension state update to the integrated access system.',
)

const updating_group_membership_mutation = common_pending_mutation.extend({
mutation_code: z.literal('updating_group_membership'),
from: z.object({
acs_access_group_id: z.string().uuid().nullable(),
}),
to: z.object({
acs_access_group_id: z.string().uuid().nullable(),
}),
})
const updating_group_membership_mutation = common_pending_mutation
.extend({
mutation_code: z.literal('updating_group_membership'),
from: z
.object({
acs_access_group_id: z
.string()
.uuid()
.nullable()
.describe('Old access group ID.'),
})
.describe('Old access group membership.'),
to: z
.object({
acs_access_group_id: z
.string()
.uuid()
.nullable()
.describe('New access group ID.'),
})
.describe('New access group membership.'),
})
.describe(
'Seam is in the process of pushing an access group membership update to the integrated access system.',
)

export const acs_user_pending_mutations = z.discriminatedUnion(
'mutation_code',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
climate_setting,
fan_mode_setting,
hvac_mode_setting,
thermostat_daily_program,
thermostat_schedule,
thermostat_weekly_program,
} from '../../thermostats/index.js'

export const thermostat_capability_properties = z
Expand Down Expand Up @@ -41,6 +43,13 @@ export const thermostat_capability_properties = z
available_climate_presets: z.array(climate_preset),
fallback_climate_preset_key: z.string().min(1).nullable().default(null),
active_thermostat_schedule: thermostat_schedule.nullable().default(null),
thermostat_daily_programs: z
.array(thermostat_daily_program)
.nullable()
.default(null),
thermostat_weekly_program: thermostat_weekly_program
.nullable()
.default(null),
min_cooling_set_point_celsius: z.number(),
min_cooling_set_point_fahrenheit: z.number(),
max_cooling_set_point_celsius: z.number(),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/seam/connect/models/devices/device-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const PROVIDER_CATEGORY_MAP = {
'tedee',
],

thermostats: ['ecobee', 'nest'],
thermostats: ['ecobee', 'nest', 'sensi', 'honeywell_resideo'],
noise_sensors: ['minut', 'noiseaware'],
access_control_systems: [
'pti',
Expand Down
14 changes: 14 additions & 0 deletions src/lib/seam/connect/models/devices/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,16 @@ const device_has_flaky_connection = common_device_warning
})
.describe('Device has flaky connection.')

const lockly_timezone_not_configured = common_device_warning
.extend({
warning_code: z
.literal('lockly_timezone_not_configured')
.describe(warning_code_description),
})
.describe(
'We detected that this device does not have a timezone configured. Time bound codes may not work as expected.',
)

export const unknown_issue_with_phone = common_device_warning
.extend({
warning_code: z
Expand Down Expand Up @@ -333,6 +343,7 @@ const device_warning = z.discriminatedUnion('warning_code', [
salto_ks_privacy_mode,
salto_ks_subscription_limit_almost_reached,
unknown_issue_with_phone,
lockly_timezone_not_configured,
])

export type DeviceWarning = z.infer<typeof device_warning>
Expand Down Expand Up @@ -376,6 +387,9 @@ export const device_warning_map = z.object({
salto_ks_subscription_limit_almost_reached:
salto_ks_subscription_limit_almost_reached.optional().nullable(),
unknown_issue_with_phone: unknown_issue_with_phone.optional().nullable(),
lockly_timezone_not_configured: lockly_timezone_not_configured
.optional()
.nullable(),
})

export type DeviceWarningMap = z.infer<typeof device_warning_map>
Expand Down
13 changes: 6 additions & 7 deletions src/lib/seam/connect/models/events/access-grants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const access_grant_created_event = access_grant_event.extend({
event_type: z.literal('access_grant.created'),
}).describe(`
---
route_path: /access_grants
route_path: /unstable_access_grants
---
An access grant was created.
`)
Expand All @@ -21,7 +21,7 @@ export const access_grant_deleted_event = access_grant_event.extend({
event_type: z.literal('access_grant.deleted'),
}).describe(`
---
route_path: /access_grants
route_path: /unstable_access_grants
---
An access grant was deleted.
`)
Expand All @@ -35,7 +35,7 @@ export const access_grant_access_granted_to_all_doors_event =
event_type: z.literal('access_grant.access_granted_to_all_doors'),
}).describe(`
---
route_path: /access_grants
route_path: /unstable_access_grants
---
All access requested for an access grant was successfully granted.
`)
Expand All @@ -57,7 +57,7 @@ export const access_grant_access_granted_to_door_event =
acs_entrance_id,
}).describe(`
---
route_path: /access_grants
route_path: /unstable_access_grants
---
Access requested as part of an access grant to a particular door was successfully granted.
`)
Expand All @@ -73,7 +73,7 @@ export const access_grant_access_to_door_lost_event = access_grant_event.extend(
},
).describe(`
---
route_path: /access_grants
route_path: /unstable_access_grants
---
Access to a particular door that was requested as part of an access grant was lost.
`)
Expand All @@ -82,11 +82,10 @@ export type AccessGrantAccessToDoorLostEvent = z.infer<
typeof access_grant_access_to_door_lost_event
>

export const access_code_events = [
export const access_grant_events = [
access_grant_created_event,
access_grant_deleted_event,
access_grant_access_granted_to_all_doors_event,
access_grant_access_granted_to_door_event,
access_grant_access_to_door_lost_event,
access_grant_deleted_event,
] as const
8 changes: 4 additions & 4 deletions src/lib/seam/connect/models/events/access-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const access_method_issued_event = access_method_event.extend({
event_type: z.literal('access_method.issued'),
}).describe(`
---
route_path: /access_methods
route_path: /unstable_access_methods
---
An access method was issued.
`)
Expand All @@ -22,7 +22,7 @@ export const access_method_card_encoding_required_event =
event_type: z.literal('access_method.card_encoding_required'),
}).describe(`
---
route_path: /access_methods
route_path: /unstable_access_methods
---
An access method representing a physical card requires encoding.
`)
Expand All @@ -35,7 +35,7 @@ export const access_method_revoked_event = access_method_event.extend({
event_type: z.literal('access_method.revoked'),
}).describe(`
---
route_path: /access_methods
route_path: /unstable_access_methods
---
An access method was revoked.
`)
Expand All @@ -44,7 +44,7 @@ export type AccessMethodRevokedEvent = z.infer<
typeof access_method_revoked_event
>

export const access_code_events = [
export const access_method_events = [
access_method_issued_event,
access_method_revoked_event,
access_method_card_encoding_required_event,
Expand Down
4 changes: 4 additions & 0 deletions src/lib/seam/connect/models/events/seam-event.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { z } from 'zod'

import { access_code_events } from './access-codes.js'
import { access_grant_events } from './access-grants.js'
import { access_method_events } from './access-methods.js'
import { acs_events } from './acs/index.js'
import { action_attempt_events } from './action-attempts.js'
import { client_session_events } from './client-sessions.js'
Expand All @@ -12,6 +14,8 @@ import { phone_events } from './phones.js'

export const seam_event = z.discriminatedUnion('event_type', [
...access_code_events,
...access_grant_events,
...access_method_events,
...acs_events,
...client_session_events,
...connected_account_events,
Expand Down
5 changes: 5 additions & 0 deletions src/lib/seam/connect/models/thermostats/climate-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export const climate_preset = z.object({
.describe(
'Indicates whether the [climate preset](https://docs.seam.co/latest/capability-guides/thermostats/creating-and-managing-climate-presets) key can be deleted.',
),
can_program: z
.boolean()
.describe(
'Indicates whether the [climate preset](https://docs.seam.co/latest/capability-guides/thermostats/creating-and-managing-climate-presets) key can be programmed in a thermostat daily program.',
),
name: z
.string()
.nullable()
Expand Down
1 change: 1 addition & 0 deletions src/lib/seam/connect/models/thermostats/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './climate-preset.js'
export * from './modes.js'
export * from './thermostat-program.js'
export * from './thermostat-schedule.js'
Loading