diff --git a/src/lib/seam/connect/internal/schemas.ts b/src/lib/seam/connect/internal/schemas.ts index 4cd60eaf..43d2ad73 100644 --- a/src/lib/seam/connect/internal/schemas.ts +++ b/src/lib/seam/connect/internal/schemas.ts @@ -20,8 +20,10 @@ export { climate_setting, climate_setting_schedule, common_device_properties, + connect_webview_device_selection_mode, custom_metadata_input, device_capability_flags, + device_metadata, dormakaba_oracode_time_slot, enrollment_automation, fan_mode_setting, diff --git a/src/lib/seam/connect/models/acs/entrance.ts b/src/lib/seam/connect/models/acs/entrance.ts index 9f130c7e..38648e9c 100644 --- a/src/lib/seam/connect/models/acs/entrance.ts +++ b/src/lib/seam/connect/models/acs/entrance.ts @@ -38,6 +38,7 @@ export const acs_entrance = z.object({ }) .nullable(), }) + export type AcsEntranceLatchMetadata = z.infer< typeof acs_entrance_latch_metadata > diff --git a/src/lib/seam/connect/models/connect-webview.ts b/src/lib/seam/connect/models/connect-webviews/connect-webview.ts similarity index 71% rename from src/lib/seam/connect/models/connect-webview.ts rename to src/lib/seam/connect/models/connect-webviews/connect-webview.ts index 3cb64218..c78ed92b 100644 --- a/src/lib/seam/connect/models/connect-webview.ts +++ b/src/lib/seam/connect/models/connect-webviews/connect-webview.ts @@ -1,18 +1,29 @@ import { z } from 'zod' -import { custom_metadata } from './custom-metadata.js' +import { custom_metadata } from '../custom-metadata.js' + +export const connect_webview_device_selection_mode = z.enum([ + 'none', + 'single', + 'multiple', +]) export const connect_webview = z.object({ connect_webview_id: z.string().uuid(), - connected_account_id: z.string().uuid().optional(), - url: z.string().url(), workspace_id: z.string().uuid(), - device_selection_mode: z.enum(['none', 'single', 'multiple']), + created_at: z.string().datetime(), + connected_account_id: z.string().uuid().nullable(), + url: z.string().url(), + device_selection_mode: connect_webview_device_selection_mode, + + // TODO: Use enum value. accepted_providers: z.array(z.string()), + + // TODO: Use enum value. accepted_devices: z.array(z.string()), + any_provider_allowed: z.boolean(), any_device_allowed: z.boolean(), - created_at: z.string().datetime(), login_successful: z.boolean(), status: z.enum(['pending', 'failed', 'authorized']), custom_redirect_url: z.string().url().nullable(), diff --git a/src/lib/seam/connect/models/connect-webviews/index.ts b/src/lib/seam/connect/models/connect-webviews/index.ts new file mode 100644 index 00000000..506beb29 --- /dev/null +++ b/src/lib/seam/connect/models/connect-webviews/index.ts @@ -0,0 +1 @@ +export * from './connect-webview.js' diff --git a/src/lib/seam/connect/models/devices/managed-device.ts b/src/lib/seam/connect/models/devices/managed-device.ts index a80fcf3f..83a1d3aa 100644 --- a/src/lib/seam/connect/models/devices/managed-device.ts +++ b/src/lib/seam/connect/models/devices/managed-device.ts @@ -1,4 +1,3 @@ -import type { SetRequired, Simplify } from 'type-fest' import { z } from 'zod' import { schemas as devicedb_schemas } from '@seamapi/types/devicedb' @@ -229,11 +228,3 @@ export const managed_device = z .merge(device_capability_flags) export type ManagedDevice = z.infer - -export type ManagedDeviceWithBackendMetadata< - MetadataKey extends keyof z.infer, -> = Simplify< - ManagedDevice & { - properties: SetRequired - } -> diff --git a/src/lib/seam/connect/models/index.ts b/src/lib/seam/connect/models/index.ts index 8e894ba3..81875cc3 100644 --- a/src/lib/seam/connect/models/index.ts +++ b/src/lib/seam/connect/models/index.ts @@ -1,7 +1,7 @@ export * from './access-codes/index.js' export * from './acs/index.js' export * from './capability-properties/index.js' -export * from './connect-webview.js' +export * from './connect-webviews/index.js' export * from './custom-metadata.js' export * from './devices/index.js' export * from './network.js' diff --git a/src/lib/seam/connect/openapi.ts b/src/lib/seam/connect/openapi.ts index 9bfb2875..a479b78d 100644 --- a/src/lib/seam/connect/openapi.ts +++ b/src/lib/seam/connect/openapi.ts @@ -434,7 +434,11 @@ export default { }, automatically_manage_new_devices: { type: 'boolean' }, connect_webview_id: { format: 'uuid', type: 'string' }, - connected_account_id: { format: 'uuid', type: 'string' }, + connected_account_id: { + format: 'uuid', + nullable: true, + type: 'string', + }, created_at: { format: 'date-time', type: 'string' }, custom_metadata: { additionalProperties: { @@ -465,14 +469,15 @@ export default { }, required: [ 'connect_webview_id', - 'url', 'workspace_id', + 'created_at', + 'connected_account_id', + 'url', 'device_selection_mode', 'accepted_providers', 'accepted_devices', 'any_provider_allowed', 'any_device_allowed', - 'created_at', 'login_successful', 'status', 'custom_redirect_url', @@ -7234,7 +7239,10 @@ export default { }, type: 'array', }, - automatically_manage_new_devices: { type: 'boolean' }, + automatically_manage_new_devices: { + default: true, + type: 'boolean', + }, custom_metadata: { additionalProperties: { nullable: true, @@ -7263,7 +7271,7 @@ export default { ], type: 'string', }, - wait_for_device_creation: { type: 'boolean' }, + wait_for_device_creation: { default: false, type: 'boolean' }, }, type: 'object', }, diff --git a/src/lib/seam/connect/route-types.ts b/src/lib/seam/connect/route-types.ts index 88b1b97b..83831488 100644 --- a/src/lib/seam/connect/route-types.ts +++ b/src/lib/seam/connect/route-types.ts @@ -2025,23 +2025,23 @@ export interface Routes { ) | undefined custom_metadata?: Record | undefined - automatically_manage_new_devices?: boolean | undefined - wait_for_device_creation?: boolean | undefined + automatically_manage_new_devices?: boolean + wait_for_device_creation?: boolean } commonParams: {} formData: {} jsonResponse: { connect_webview: { connect_webview_id: string - connected_account_id?: string | undefined - url: string workspace_id: string + created_at: string + connected_account_id: string | null + url: string device_selection_mode: 'none' | 'single' | 'multiple' accepted_providers: string[] accepted_devices: string[] any_provider_allowed: boolean any_device_allowed: boolean - created_at: string login_successful: boolean status: 'pending' | 'failed' | 'authorized' custom_redirect_url: string | null @@ -2077,15 +2077,15 @@ export interface Routes { jsonResponse: { connect_webview: { connect_webview_id: string - connected_account_id?: string | undefined - url: string workspace_id: string + created_at: string + connected_account_id: string | null + url: string device_selection_mode: 'none' | 'single' | 'multiple' accepted_providers: string[] accepted_devices: string[] any_provider_allowed: boolean any_device_allowed: boolean - created_at: string login_successful: boolean status: 'pending' | 'failed' | 'authorized' custom_redirect_url: string | null @@ -2112,15 +2112,15 @@ export interface Routes { jsonResponse: { connect_webviews: Array<{ connect_webview_id: string - connected_account_id?: string | undefined - url: string workspace_id: string + created_at: string + connected_account_id: string | null + url: string device_selection_mode: 'none' | 'single' | 'multiple' accepted_providers: string[] accepted_devices: string[] any_provider_allowed: boolean any_device_allowed: boolean - created_at: string login_successful: boolean status: 'pending' | 'failed' | 'authorized' custom_redirect_url: string | null