Skip to content

Commit

Permalink
fix: Better event type openapi schema (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
seambot authored Jan 10, 2025
1 parent 6299ac4 commit 559ae12
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 175 deletions.
2 changes: 1 addition & 1 deletion src/lib/seam/connect/models/events/acs/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { acs_access_group_events } from './access_groups.js'
import { acs_access_group_events } from './access-groups.js'
import { acs_credential_events } from './credentials.js'
import { acs_encoder_events } from './encoders.js'
import { acs_system_events } from './systems.js'
Expand Down
1 change: 1 addition & 0 deletions src/lib/seam/connect/models/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type * from './access-codes.js'
export type * from './acs/index.js'
export type * from './action-attempts.js'
export type * from './client-sessions.js'
export * from './common.js'
export type * from './connected-accounts.js'
export type * from './devices.js'
export type * from './enrollment-automations.js'
Expand Down
10 changes: 10 additions & 0 deletions src/lib/seam/connect/models/events/seam-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ export const seam_event = z.discriminatedUnion('event_type', [

export type SeamEvent = z.infer<typeof seam_event>

const event_types = seam_event.options.map(
(schema) => schema.shape.event_type.value,
)

type HasAtLeastOneElement<T> = T extends Array<infer E> ? [E, ...E[]] : never

export const seam_event_type = z.enum(
event_types as HasAtLeastOneElement<typeof event_types>,
)

export type SeamEventType = SeamEvent['event_type']
180 changes: 90 additions & 90 deletions src/lib/seam/connect/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21749,160 +21749,160 @@ export default {
},
event_type: {
enum: [
'device.accessory_keypad_connected',
'device.accessory_keypad_disconnected',
'device.added',
'device.connected',
'device.unmanaged.connected',
'device.disconnected',
'device.unmanaged.disconnected',
'device.converted_to_unmanaged',
'device.unmanaged.converted_to_managed',
'device.removed',
'device.deleted',
'device.tampered',
'device.low_battery',
'device.battery_status_changed',
'device.third_party_integration_detected',
'device.third_party_integration_no_longer_detected',
'device.salto.privacy_mode_activated',
'device.salto.privacy_mode_deactivated',
'device.connection_became_flaky',
'device.connection_stabilized',
'device.error.subscription_required',
'device.error.subscription_required.resolved',
'access_code.created',
'access_code.changed',
'access_code.scheduled_on_device',
'access_code.set_on_device',
'access_code.deleted',
'access_code.removed_from_device',
'access_code.failed_to_set_on_device',
'access_code.delay_in_setting_on_device',
'access_code.failed_to_remove_from_device',
'access_code.failed_to_set_on_device',
'access_code.deleted',
'access_code.delay_in_removing_from_device',
'access_code.deleted_external_to_seam',
'access_code.failed_to_remove_from_device',
'access_code.modified_external_to_seam',
'access_code.deleted_external_to_seam',
'access_code.backup_access_code_pulled',
'access_code.unmanaged.converted_to_managed',
'access_code.unmanaged.failed_to_convert_to_managed',
'access_code.unmanaged.created',
'access_code.unmanaged.removed',
'lock.locked',
'lock.unlocked',
'lock.access_denied',
'phone.deactivated',
'connected_account.connected',
'connected_account.successful_login',
'connected_account.created',
'connected_account.deleted',
'connected_account.disconnected',
'connected_account.completed_first_sync',
'connected_account.completed_first_sync_after_reconnection',
'connect_webview.login_succeeded',
'connect_webview.login_failed',
'noise_sensor.noise_threshold_triggered',
'access_code.backup_access_code_pulled',
'acs_system.added',
'acs_system.connected',
'acs_system.added',
'acs_system.disconnected',
'acs_access_group.deleted',
'acs_user.deleted',
'acs_credential.deleted',
'acs_credential.issued',
'acs_credential.reissued',
'acs_user.deleted',
'acs_encoder.added',
'acs_encoder.removed',
'enrollment_automation.deleted',
'acs_access_group.deleted',
'client_session.deleted',
'connected_account.connected',
'connected_account.created',
'connected_account.successful_login',
'connected_account.disconnected',
'connected_account.completed_first_sync',
'connected_account.deleted',
'connected_account.completed_first_sync_after_reconnection',
'action_attempt.lock_door.succeeded',
'action_attempt.lock_door.failed',
'action_attempt.unlock_door.succeeded',
'action_attempt.unlock_door.failed',
'connect_webview.login_succeeded',
'connect_webview.login_failed',
'device.connected',
'device.added',
'device.converted_to_unmanaged',
'device.unmanaged.converted_to_managed',
'device.unmanaged.connected',
'device.disconnected',
'device.unmanaged.disconnected',
'device.tampered',
'device.low_battery',
'device.battery_status_changed',
'device.removed',
'device.deleted',
'device.third_party_integration_detected',
'device.third_party_integration_no_longer_detected',
'device.salto.privacy_mode_activated',
'device.salto.privacy_mode_deactivated',
'device.connection_became_flaky',
'device.connection_stabilized',
'device.error.subscription_required',
'device.error.subscription_required.resolved',
'device.accessory_keypad_connected',
'device.accessory_keypad_disconnected',
'noise_sensor.noise_threshold_triggered',
'lock.locked',
'lock.unlocked',
'lock.access_denied',
'thermostat.climate_preset_activated',
'thermostat.manually_adjusted',
'thermostat.temperature_threshold_exceeded',
'thermostat.temperature_threshold_no_longer_exceeded',
'thermostat.temperature_reached_set_point',
'enrollment_automation.deleted',
'phone.deactivated',
],
type: 'string',
},
event_types: {
items: {
enum: [
'device.accessory_keypad_connected',
'device.accessory_keypad_disconnected',
'device.added',
'device.connected',
'device.unmanaged.connected',
'device.disconnected',
'device.unmanaged.disconnected',
'device.converted_to_unmanaged',
'device.unmanaged.converted_to_managed',
'device.removed',
'device.deleted',
'device.tampered',
'device.low_battery',
'device.battery_status_changed',
'device.third_party_integration_detected',
'device.third_party_integration_no_longer_detected',
'device.salto.privacy_mode_activated',
'device.salto.privacy_mode_deactivated',
'device.connection_became_flaky',
'device.connection_stabilized',
'device.error.subscription_required',
'device.error.subscription_required.resolved',
'access_code.created',
'access_code.changed',
'access_code.scheduled_on_device',
'access_code.set_on_device',
'access_code.deleted',
'access_code.removed_from_device',
'access_code.failed_to_set_on_device',
'access_code.delay_in_setting_on_device',
'access_code.failed_to_remove_from_device',
'access_code.failed_to_set_on_device',
'access_code.deleted',
'access_code.delay_in_removing_from_device',
'access_code.deleted_external_to_seam',
'access_code.failed_to_remove_from_device',
'access_code.modified_external_to_seam',
'access_code.deleted_external_to_seam',
'access_code.backup_access_code_pulled',
'access_code.unmanaged.converted_to_managed',
'access_code.unmanaged.failed_to_convert_to_managed',
'access_code.unmanaged.created',
'access_code.unmanaged.removed',
'lock.locked',
'lock.unlocked',
'lock.access_denied',
'phone.deactivated',
'connected_account.connected',
'connected_account.successful_login',
'connected_account.created',
'connected_account.deleted',
'connected_account.disconnected',
'connected_account.completed_first_sync',
'connected_account.completed_first_sync_after_reconnection',
'connect_webview.login_succeeded',
'connect_webview.login_failed',
'noise_sensor.noise_threshold_triggered',
'access_code.backup_access_code_pulled',
'acs_system.added',
'acs_system.connected',
'acs_system.added',
'acs_system.disconnected',
'acs_access_group.deleted',
'acs_user.deleted',
'acs_credential.deleted',
'acs_credential.issued',
'acs_credential.reissued',
'acs_user.deleted',
'acs_encoder.added',
'acs_encoder.removed',
'enrollment_automation.deleted',
'acs_access_group.deleted',
'client_session.deleted',
'connected_account.connected',
'connected_account.created',
'connected_account.successful_login',
'connected_account.disconnected',
'connected_account.completed_first_sync',
'connected_account.deleted',
'connected_account.completed_first_sync_after_reconnection',
'action_attempt.lock_door.succeeded',
'action_attempt.lock_door.failed',
'action_attempt.unlock_door.succeeded',
'action_attempt.unlock_door.failed',
'connect_webview.login_succeeded',
'connect_webview.login_failed',
'device.connected',
'device.added',
'device.converted_to_unmanaged',
'device.unmanaged.converted_to_managed',
'device.unmanaged.connected',
'device.disconnected',
'device.unmanaged.disconnected',
'device.tampered',
'device.low_battery',
'device.battery_status_changed',
'device.removed',
'device.deleted',
'device.third_party_integration_detected',
'device.third_party_integration_no_longer_detected',
'device.salto.privacy_mode_activated',
'device.salto.privacy_mode_deactivated',
'device.connection_became_flaky',
'device.connection_stabilized',
'device.error.subscription_required',
'device.error.subscription_required.resolved',
'device.accessory_keypad_connected',
'device.accessory_keypad_disconnected',
'noise_sensor.noise_threshold_triggered',
'lock.locked',
'lock.unlocked',
'lock.access_denied',
'thermostat.climate_preset_activated',
'thermostat.manually_adjusted',
'thermostat.temperature_threshold_exceeded',
'thermostat.temperature_threshold_no_longer_exceeded',
'thermostat.temperature_reached_set_point',
'enrollment_automation.deleted',
'phone.deactivated',
],
type: 'string',
},
Expand Down
Loading

0 comments on commit 559ae12

Please sign in to comment.