@seamapi/types 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/seam/connect/route-types.d.ts +877 -12
- package/lib/seam/connect/unstable/model-types.d.ts +1 -1
- package/lib/seam/connect/unstable/models/capability-properties/access-code.d.ts +70 -0
- package/lib/seam/connect/unstable/models/capability-properties/access-code.js +28 -0
- package/lib/seam/connect/unstable/models/capability-properties/access-code.js.map +1 -0
- package/lib/seam/connect/unstable/models/capability-properties/index.d.ts +286 -0
- package/lib/seam/connect/unstable/models/capability-properties/index.js +10 -0
- package/lib/seam/connect/unstable/models/capability-properties/index.js.map +1 -0
- package/lib/seam/connect/unstable/models/capability-properties/lock.d.ts +24 -0
- package/lib/seam/connect/unstable/models/capability-properties/lock.js +11 -0
- package/lib/seam/connect/unstable/models/capability-properties/lock.js.map +1 -0
- package/lib/seam/connect/unstable/models/capability-properties/thermostat.d.ts +302 -0
- package/lib/seam/connect/unstable/models/capability-properties/thermostat.js +46 -0
- package/lib/seam/connect/unstable/models/capability-properties/thermostat.js.map +1 -0
- package/lib/seam/connect/unstable/models/device-metadata.d.ts +722 -0
- package/lib/seam/connect/unstable/models/device-metadata.js +143 -0
- package/lib/seam/connect/unstable/models/device-metadata.js.map +1 -0
- package/lib/seam/connect/unstable/models/index.d.ts +1 -0
- package/lib/seam/connect/unstable/models/index.js +1 -0
- package/lib/seam/connect/unstable/models/index.js.map +1 -1
- package/lib/seam/connect/unstable/models/managed-device.d.ts +1549 -7
- package/lib/seam/connect/unstable/models/managed-device.js +31 -9
- package/lib/seam/connect/unstable/models/managed-device.js.map +1 -1
- package/lib/seam/connect/unstable/schemas.d.ts +1 -1
- package/lib/seam/connect/unstable/schemas.js +1 -1
- package/lib/seam/connect/unstable/schemas.js.map +1 -1
- package/package.json +4 -1
- package/src/lib/seam/connect/route-types.ts +1201 -12
- package/src/lib/seam/connect/unstable/model-types.ts +4 -0
- package/src/lib/seam/connect/unstable/models/capability-properties/access-code.ts +33 -0
- package/src/lib/seam/connect/unstable/models/capability-properties/index.ts +26 -0
- package/src/lib/seam/connect/unstable/models/capability-properties/lock.ts +11 -0
- package/src/lib/seam/connect/unstable/models/capability-properties/thermostat.ts +53 -0
- package/src/lib/seam/connect/unstable/models/device-metadata.ts +162 -0
- package/src/lib/seam/connect/unstable/models/index.ts +1 -0
- package/src/lib/seam/connect/unstable/models/managed-device.ts +44 -9
- package/src/lib/seam/connect/unstable/schemas.ts +5 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
const simple_access_code_constraint = z.object({
|
|
4
|
+
constraint_type: z.enum([
|
|
5
|
+
'no_zeros', // Nuki
|
|
6
|
+
'cannot_start_with_12', // Nuki
|
|
7
|
+
'no_triple_consecutive_ints', // Brivo
|
|
8
|
+
'cannot_specify_pin_code', // Lockly
|
|
9
|
+
'pin_code_matches_existing_set', // Salto
|
|
10
|
+
'start_date_in_future', // Kwikset
|
|
11
|
+
]),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const complex_access_code_constraint = z.object({
|
|
15
|
+
constraint_type: z.enum(['name_length']), // Nuki, Kwikset
|
|
16
|
+
min_length: z.number().optional(),
|
|
17
|
+
max_length: z.number().optional(),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const access_code_constraint = z.union([
|
|
21
|
+
simple_access_code_constraint,
|
|
22
|
+
complex_access_code_constraint,
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
export type AccessCodeConstraint = z.infer<typeof access_code_constraint>
|
|
26
|
+
|
|
27
|
+
export const access_code_capability_properties = z.object({
|
|
28
|
+
code_constraints: z.array(access_code_constraint).optional(),
|
|
29
|
+
supported_code_lengths: z.array(z.number()).optional(),
|
|
30
|
+
max_active_codes_supported: z.number().optional(),
|
|
31
|
+
supports_backup_access_code_pool: z.boolean().optional(),
|
|
32
|
+
has_native_entry_events: z.boolean().optional(),
|
|
33
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { access_code_capability_properties } from './access-code.js'
|
|
2
|
+
import { lock_capability_properties } from './lock.js'
|
|
3
|
+
import {
|
|
4
|
+
climate_setting,
|
|
5
|
+
climate_setting_schedule,
|
|
6
|
+
hvac_mode_setting,
|
|
7
|
+
thermostat_capability_properties,
|
|
8
|
+
} from './thermostat.js'
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
access_code_capability_properties,
|
|
12
|
+
climate_setting,
|
|
13
|
+
climate_setting_schedule,
|
|
14
|
+
hvac_mode_setting,
|
|
15
|
+
lock_capability_properties,
|
|
16
|
+
thermostat_capability_properties,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// todo: discriminate based on capability and remove intersection type
|
|
20
|
+
export const capability_properties = access_code_capability_properties
|
|
21
|
+
.partial()
|
|
22
|
+
.merge(lock_capability_properties.partial())
|
|
23
|
+
.merge(thermostat_capability_properties.partial())
|
|
24
|
+
|
|
25
|
+
export type { AccessCodeConstraint } from './access-code.js'
|
|
26
|
+
export type { ClimateSetting } from './thermostat.js'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const climate_setting = z.object({
|
|
4
|
+
automatic_heating_enabled: z.boolean(),
|
|
5
|
+
automatic_cooling_enabled: z.boolean(),
|
|
6
|
+
hvac_mode_setting: z.enum(['off', 'heat', 'cool', 'heatcool']),
|
|
7
|
+
cooling_set_point_celsius: z.number().optional(),
|
|
8
|
+
heating_set_point_celsius: z.number().optional(),
|
|
9
|
+
cooling_set_point_fahrenheit: z.number().optional(),
|
|
10
|
+
heating_set_point_fahrenheit: z.number().optional(),
|
|
11
|
+
manual_override_allowed: z.boolean(),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export type ClimateSetting = z.infer<typeof climate_setting>
|
|
15
|
+
|
|
16
|
+
export const climate_setting_schedule = z
|
|
17
|
+
.object({
|
|
18
|
+
climate_setting_schedule_id: z.string().uuid(),
|
|
19
|
+
schedule_type: z.literal('time_bound'),
|
|
20
|
+
device_id: z.string(),
|
|
21
|
+
name: z.string().optional(),
|
|
22
|
+
schedule_starts_at: z.string(),
|
|
23
|
+
schedule_ends_at: z.string(),
|
|
24
|
+
created_at: z.string().datetime(),
|
|
25
|
+
})
|
|
26
|
+
.merge(climate_setting.partial())
|
|
27
|
+
|
|
28
|
+
export const hvac_mode_setting = z.enum(['off', 'heat', 'cool', 'heatcool'])
|
|
29
|
+
|
|
30
|
+
export const thermostat_capability_properties = z.object({
|
|
31
|
+
temperature_fahrenheit: z.number(),
|
|
32
|
+
temperature_celsius: z.number(),
|
|
33
|
+
relative_humidity: z.number().min(0).max(1),
|
|
34
|
+
can_enable_automatic_heating: z.boolean(),
|
|
35
|
+
can_enable_automatic_cooling: z.boolean(),
|
|
36
|
+
available_hvac_mode_settings: z.array(hvac_mode_setting),
|
|
37
|
+
is_heating: z.boolean(),
|
|
38
|
+
is_cooling: z.boolean(),
|
|
39
|
+
is_fan_running: z.boolean(),
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* this is true if the current thermostat settings differ that what is on seam, and `current_climate_setting.manual_override_allowed: true`
|
|
43
|
+
*/
|
|
44
|
+
is_temporary_manual_override_active: z.boolean(),
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* can be derived from `default_climate_setting`, or `active_climate_setting_schedule` if one is active
|
|
48
|
+
*/
|
|
49
|
+
current_climate_setting: climate_setting,
|
|
50
|
+
default_climate_setting: climate_setting.optional(),
|
|
51
|
+
is_climate_setting_schedule_active: z.boolean(),
|
|
52
|
+
active_climate_setting_schedule: climate_setting_schedule.optional(),
|
|
53
|
+
})
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const device_metadata = z
|
|
4
|
+
.object({
|
|
5
|
+
august_metadata: z.object({
|
|
6
|
+
lock_id: z.string(),
|
|
7
|
+
lock_name: z.string(),
|
|
8
|
+
house_name: z.string(),
|
|
9
|
+
has_keypad: z.boolean(),
|
|
10
|
+
keypad_battery_level: z.string().optional(),
|
|
11
|
+
model: z.string().optional(),
|
|
12
|
+
house_id: z.string().optional(),
|
|
13
|
+
}),
|
|
14
|
+
|
|
15
|
+
schlage_metadata: z.object({
|
|
16
|
+
device_id: z.string(),
|
|
17
|
+
device_name: z.string(),
|
|
18
|
+
access_code_length: z.number(),
|
|
19
|
+
model: z.string().optional(),
|
|
20
|
+
}),
|
|
21
|
+
|
|
22
|
+
smartthings_metadata: z.object({
|
|
23
|
+
device_id: z.string(),
|
|
24
|
+
device_name: z.string(),
|
|
25
|
+
model: z.string().optional(),
|
|
26
|
+
location_id: z.string().optional(),
|
|
27
|
+
}),
|
|
28
|
+
|
|
29
|
+
lockly_metadata: z.object({
|
|
30
|
+
device_id: z.string(),
|
|
31
|
+
device_name: z.string(),
|
|
32
|
+
model: z.string().optional(),
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
nuki_metadata: z.object({
|
|
36
|
+
device_id: z.string(),
|
|
37
|
+
device_name: z.string(),
|
|
38
|
+
keypad_battery_critical: z.boolean().optional(),
|
|
39
|
+
}),
|
|
40
|
+
|
|
41
|
+
kwikset_metadata: z.object({
|
|
42
|
+
device_id: z.string(),
|
|
43
|
+
device_name: z.string(),
|
|
44
|
+
model_number: z.string(),
|
|
45
|
+
}),
|
|
46
|
+
|
|
47
|
+
salto_metadata: z.object({
|
|
48
|
+
lock_id: z.string(),
|
|
49
|
+
customer_reference: z.string(),
|
|
50
|
+
lock_type: z.string(),
|
|
51
|
+
battery_level: z.string(),
|
|
52
|
+
locked_state: z.string(),
|
|
53
|
+
model: z.string().optional(),
|
|
54
|
+
}),
|
|
55
|
+
|
|
56
|
+
genie_metadata: z.object({
|
|
57
|
+
device_name: z.string(),
|
|
58
|
+
door_name: z.string(),
|
|
59
|
+
}),
|
|
60
|
+
|
|
61
|
+
brivo_metadata: z.object({
|
|
62
|
+
device_name: z.string(),
|
|
63
|
+
}),
|
|
64
|
+
|
|
65
|
+
igloo_metadata: z.object({
|
|
66
|
+
device_id: z.string(),
|
|
67
|
+
bridge_id: z.string(),
|
|
68
|
+
model: z.string().optional(),
|
|
69
|
+
}),
|
|
70
|
+
|
|
71
|
+
noiseaware_metadata: z.object({
|
|
72
|
+
device_model: z.enum(['indoor', 'outdoor']),
|
|
73
|
+
noise_level_nrs: z.number(),
|
|
74
|
+
noise_level_decibel: z.number(),
|
|
75
|
+
device_name: z.string(),
|
|
76
|
+
device_id: z.string(),
|
|
77
|
+
}),
|
|
78
|
+
|
|
79
|
+
minut_metadata: z.object({
|
|
80
|
+
device_id: z.string(),
|
|
81
|
+
device_name: z.string(),
|
|
82
|
+
latest_sensor_values: z.object({
|
|
83
|
+
temperature: z.object({
|
|
84
|
+
time: z.string(),
|
|
85
|
+
value: z.number(),
|
|
86
|
+
}),
|
|
87
|
+
sound: z.object({
|
|
88
|
+
time: z.string(),
|
|
89
|
+
value: z.number(),
|
|
90
|
+
}),
|
|
91
|
+
humidity: z.object({
|
|
92
|
+
time: z.string(),
|
|
93
|
+
value: z.number(),
|
|
94
|
+
}),
|
|
95
|
+
pressure: z.object({
|
|
96
|
+
time: z.string(),
|
|
97
|
+
value: z.number(),
|
|
98
|
+
}),
|
|
99
|
+
accelerometer_z: z.object({
|
|
100
|
+
time: z.string(),
|
|
101
|
+
value: z.number(),
|
|
102
|
+
}),
|
|
103
|
+
}),
|
|
104
|
+
}),
|
|
105
|
+
|
|
106
|
+
two_n_metadata: z.object({
|
|
107
|
+
device_id: z.number(),
|
|
108
|
+
device_name: z.string(),
|
|
109
|
+
}),
|
|
110
|
+
|
|
111
|
+
controlbyweb_metadata: z.object({
|
|
112
|
+
device_id: z.string(),
|
|
113
|
+
device_name: z.string(),
|
|
114
|
+
relay_name: z.string().nullable(),
|
|
115
|
+
}),
|
|
116
|
+
|
|
117
|
+
ttlock_metadata: z.object({
|
|
118
|
+
lock_id: z.number(),
|
|
119
|
+
lock_alias: z.string(),
|
|
120
|
+
}),
|
|
121
|
+
|
|
122
|
+
seam_bridge_metadata: z.object({
|
|
123
|
+
unlock_method: z.enum(['bridge', 'doorking']).optional(),
|
|
124
|
+
device_num: z.number(),
|
|
125
|
+
name: z.string(),
|
|
126
|
+
}),
|
|
127
|
+
|
|
128
|
+
igloohome_metadata: z.object({
|
|
129
|
+
device_id: z.string(),
|
|
130
|
+
bridge_id: z.string(),
|
|
131
|
+
device_name: z.string(),
|
|
132
|
+
bridge_name: z.string(),
|
|
133
|
+
}),
|
|
134
|
+
|
|
135
|
+
nest_metadata: z.object({
|
|
136
|
+
nest_device_id: z.string(),
|
|
137
|
+
device_name: z.string(), // set by Google
|
|
138
|
+
custom_name: z.string(), // set by device owner
|
|
139
|
+
}),
|
|
140
|
+
|
|
141
|
+
ecobee_metadata: z.object({
|
|
142
|
+
ecobee_device_id: z.string(),
|
|
143
|
+
device_name: z.string(),
|
|
144
|
+
min_heating_set_point_fahrenheit: z.number().optional(),
|
|
145
|
+
max_heating_set_point_fahrenheit: z.number().optional(),
|
|
146
|
+
min_cooling_set_point_fahrenheit: z.number().optional(),
|
|
147
|
+
max_cooling_set_point_fahrenheit: z.number().optional(),
|
|
148
|
+
min_heating_set_point_celsius: z.number().optional(),
|
|
149
|
+
max_heating_set_point_celsius: z.number().optional(),
|
|
150
|
+
min_cooling_set_point_celsius: z.number().optional(),
|
|
151
|
+
max_cooling_set_point_celsius: z.number().optional(),
|
|
152
|
+
min_delta_heat_cool_set_points_fahrenheit: z.number().optional(),
|
|
153
|
+
min_delta_heat_cool_set_points_celsius: z.number().optional(),
|
|
154
|
+
}),
|
|
155
|
+
|
|
156
|
+
hubitat_metadata: z.object({
|
|
157
|
+
device_id: z.string(),
|
|
158
|
+
device_name: z.string(),
|
|
159
|
+
device_label: z.string(),
|
|
160
|
+
}),
|
|
161
|
+
})
|
|
162
|
+
.partial()
|
|
@@ -1,23 +1,50 @@
|
|
|
1
|
+
import type { SetRequired, Simplify } from 'type-fest'
|
|
1
2
|
import { z } from 'zod'
|
|
2
3
|
|
|
3
4
|
import { capabilities } from './capabilities-supported.js'
|
|
5
|
+
import { capability_properties } from './capability-properties/index.js'
|
|
6
|
+
import { device_metadata } from './device-metadata.js'
|
|
4
7
|
import { any_device_type } from './device-type.js'
|
|
5
8
|
|
|
9
|
+
export const battery_status = z.enum(['critical', 'low', 'good', 'full'])
|
|
10
|
+
|
|
11
|
+
export type BatteryStatus = z.infer<typeof battery_status>
|
|
12
|
+
|
|
13
|
+
export const common_device_properties = z.object({
|
|
14
|
+
online: z.boolean(),
|
|
15
|
+
name: z.string(),
|
|
16
|
+
model: z.object({
|
|
17
|
+
display_name: z.string(),
|
|
18
|
+
}),
|
|
19
|
+
has_direct_power: z.boolean().optional(),
|
|
20
|
+
battery_level: z.number().min(0).max(1).optional(),
|
|
21
|
+
battery: z
|
|
22
|
+
.object({
|
|
23
|
+
level: z.number().min(0).max(1),
|
|
24
|
+
status: battery_status,
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
// todo: use enum
|
|
28
|
+
manufacturer: z.string().optional(),
|
|
29
|
+
image_url: z.string().url().optional(),
|
|
30
|
+
image_alt_text: z.string().optional(),
|
|
31
|
+
serial_number: z.string().optional(),
|
|
32
|
+
})
|
|
33
|
+
|
|
6
34
|
export const managed_device = z.object({
|
|
7
35
|
device_id: z.string().uuid(),
|
|
8
36
|
device_type: any_device_type,
|
|
9
37
|
capabilities_supported: z.array(capabilities),
|
|
10
|
-
properties:
|
|
38
|
+
properties: common_device_properties
|
|
39
|
+
.and(device_metadata)
|
|
40
|
+
.and(capability_properties),
|
|
41
|
+
location: z
|
|
42
|
+
// todo: optional instead of nullable
|
|
11
43
|
.object({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
model: z.object({
|
|
15
|
-
display_name: z.string(),
|
|
16
|
-
}),
|
|
44
|
+
location_name: z.string().optional(),
|
|
45
|
+
timezone: z.string().optional(),
|
|
17
46
|
})
|
|
18
|
-
.
|
|
19
|
-
// todo: better type
|
|
20
|
-
location: z.any(),
|
|
47
|
+
.nullable(),
|
|
21
48
|
connected_account_id: z.string().uuid(),
|
|
22
49
|
workspace_id: z.string().uuid(),
|
|
23
50
|
errors: z.array(
|
|
@@ -37,3 +64,11 @@ export const managed_device = z.object({
|
|
|
37
64
|
})
|
|
38
65
|
|
|
39
66
|
export type ManagedDevice = z.infer<typeof managed_device>
|
|
67
|
+
|
|
68
|
+
export type ManagedDeviceWithBackendMetadata<
|
|
69
|
+
MetadataKey extends keyof z.infer<typeof device_metadata>,
|
|
70
|
+
> = Simplify<
|
|
71
|
+
ManagedDevice & {
|
|
72
|
+
properties: SetRequired<ManagedDevice['properties'], MetadataKey>
|
|
73
|
+
}
|
|
74
|
+
>
|