@seamapi/types 1.18.4 → 1.18.5

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.
Files changed (34) hide show
  1. package/dist/devicedb.cjs +67 -4
  2. package/dist/devicedb.cjs.map +1 -1
  3. package/dist/devicedb.d.cts +646 -74
  4. package/lib/seam/devicedb/index.d.ts +2 -2
  5. package/lib/seam/devicedb/index.js +1 -1
  6. package/lib/seam/devicedb/index.js.map +1 -1
  7. package/lib/seam/devicedb/public-models/device-model-v0.d.ts +30 -0
  8. package/lib/seam/devicedb/public-models/device-model-v0.js +12 -0
  9. package/lib/seam/devicedb/public-models/device-model-v0.js.map +1 -0
  10. package/lib/seam/devicedb/public-models/device-model-v1.d.ts +680 -0
  11. package/lib/seam/devicedb/public-models/device-model-v1.js +80 -0
  12. package/lib/seam/devicedb/public-models/device-model-v1.js.map +1 -0
  13. package/lib/seam/devicedb/public-models/image-reference.d.ts +15 -0
  14. package/lib/seam/devicedb/public-models/image-reference.js +7 -0
  15. package/lib/seam/devicedb/public-models/image-reference.js.map +1 -0
  16. package/lib/seam/devicedb/public-models/index.d.ts +4 -0
  17. package/lib/seam/devicedb/public-models/index.js +5 -0
  18. package/lib/seam/devicedb/public-models/index.js.map +1 -0
  19. package/lib/seam/devicedb/public-models/manufacturer.d.ts +44 -0
  20. package/lib/seam/devicedb/public-models/manufacturer.js +11 -0
  21. package/lib/seam/devicedb/public-models/manufacturer.js.map +1 -0
  22. package/lib/seam/devicedb/route-types.d.ts +74 -4
  23. package/package.json +1 -1
  24. package/src/lib/seam/devicedb/index.ts +2 -2
  25. package/src/lib/seam/devicedb/public-models/device-model-v0.ts +14 -0
  26. package/src/lib/seam/devicedb/public-models/device-model-v1.ts +95 -0
  27. package/src/lib/seam/devicedb/public-models/image-reference.ts +9 -0
  28. package/src/lib/seam/devicedb/public-models/index.ts +4 -0
  29. package/src/lib/seam/devicedb/public-models/manufacturer.ts +14 -0
  30. package/src/lib/seam/devicedb/route-types.ts +147 -41
  31. package/lib/seam/devicedb/public-models.d.ts +0 -273
  32. package/lib/seam/devicedb/public-models.js +0 -45
  33. package/lib/seam/devicedb/public-models.js.map +0 -1
  34. package/src/lib/seam/devicedb/public-models.ts +0 -56
@@ -0,0 +1,80 @@
1
+ import { z } from 'zod';
2
+ import { image_reference } from './image-reference.js';
3
+ import { manufacturer } from './manufacturer.js';
4
+ const smartlock = z.object({
5
+ main_category: z.literal('smartlock'),
6
+ physical_properties: z.object({
7
+ lock_type: z.enum([
8
+ 'deadbolt',
9
+ 'lever',
10
+ 'mortise',
11
+ 'lockbox',
12
+ 'cylinder',
13
+ 'padlock',
14
+ 'locker',
15
+ ]),
16
+ has_physical_key: z.boolean(),
17
+ has_camera: z.boolean(),
18
+ }),
19
+ software_features: z.object({
20
+ can_remotely_unlock: z.boolean(),
21
+ can_program_access_codes: z.boolean(),
22
+ can_program_access_schedules: z.boolean(),
23
+ can_program_access_codes_offline: z.boolean(),
24
+ }),
25
+ });
26
+ const sensor = z.object({
27
+ main_category: z.literal('sensor'),
28
+ physical_properties: z.object({
29
+ has_noise_sensor: z.boolean(),
30
+ has_humidity_sensor: z.boolean(),
31
+ has_temperature_sensor: z.boolean(),
32
+ has_occupancy_detection: z.boolean(),
33
+ }),
34
+ });
35
+ const thermostat = z.object({
36
+ main_category: z.literal('thermostat'),
37
+ physical_properties: z.object({
38
+ available_modes: z.enum(['heat', 'cool', 'fan', 'eco']).array(),
39
+ is_heat_pump_compatible: z.boolean(),
40
+ has_occupancy_detection: z.boolean(),
41
+ supports_demand_response: z.boolean(),
42
+ has_humidity_sensor: z.boolean(),
43
+ has_temperature_sensor: z.boolean(),
44
+ supports_emergency_heating_mode: z.boolean(),
45
+ }),
46
+ software_features: z.object({
47
+ can_program_climate_schedules: z.boolean(),
48
+ }),
49
+ });
50
+ export const device_model_category_specific_properties = z.discriminatedUnion('main_category', [smartlock, sensor, thermostat]);
51
+ export const base_device_model_v1 = z.object({
52
+ device_model_id: z.string().uuid(),
53
+ manufacturer,
54
+ is_device_supported: z.boolean(),
55
+ display_name: z.string(),
56
+ description: z.string(),
57
+ product_url: z.string(),
58
+ main_connection_type: z.enum(['wifi', 'zwave', 'zigbee', 'unknown']),
59
+ aesthetic_variants: z
60
+ .object({
61
+ slug: z.string(),
62
+ display_name: z.string(),
63
+ primary_color_hex: z.string().optional(),
64
+ manufacturer_sku: z.string(),
65
+ front_image: image_reference.optional(),
66
+ back_image: image_reference.optional(),
67
+ })
68
+ .array(),
69
+ power_sources: z
70
+ .enum([
71
+ 'battery',
72
+ 'hardwired',
73
+ 'mechanical_harvesting',
74
+ 'wireless',
75
+ 'ethernet',
76
+ ])
77
+ .array(),
78
+ });
79
+ export const device_model_v1 = base_device_model_v1.and(device_model_category_specific_properties);
80
+ //# sourceMappingURL=device-model-v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-model-v1.js","sourceRoot":"","sources":["../../../../src/lib/seam/devicedb/public-models/device-model-v1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IACrC,mBAAmB,EAAE,CAAC,CAAC,MAAM,CAAC;QAC5B,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC;YAChB,UAAU;YACV,OAAO;YACP,SAAS;YACT,SAAS;YACT,UAAU;YACV,SAAS;YACT,QAAQ;SACT,CAAC;QACF,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;QAC7B,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;KACxB,CAAC;IACF,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC;QAC1B,mBAAmB,EAAE,CAAC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strip", z.ZodTypeAny, {
7
+ height: number;
8
+ width: number;
9
+ url: string;
10
+ }, {
11
+ height: number;
12
+ width: number;
13
+ url: string;
14
+ }>;
15
+ export type ImageReference = z.infer<typeof image_reference>;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export const image_reference = z.object({
3
+ url: z.string().url(),
4
+ width: z.number(),
5
+ height: z.number(),
6
+ });
7
+ //# sourceMappingURL=image-reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-reference.js","sourceRoot":"","sources":["../../../../src/lib/seam/devicedb/public-models/image-reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './device-model-v0.js';
2
+ export * from './device-model-v1.js';
3
+ export * from './image-reference.js';
4
+ export * from './manufacturer.js';
@@ -0,0 +1,5 @@
1
+ export * from './device-model-v0.js';
2
+ export * from './device-model-v1.js';
3
+ export * from './image-reference.js';
4
+ export * from './manufacturer.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/seam/devicedb/public-models/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod';
2
+ export declare const manufacturer: z.ZodObject<{
3
+ manufacturer_id: z.ZodString;
4
+ display_name: z.ZodString;
5
+ logo: z.ZodOptional<z.ZodObject<{
6
+ url: z.ZodString;
7
+ width: z.ZodNumber;
8
+ height: z.ZodNumber;
9
+ }, "strip", z.ZodTypeAny, {
10
+ height: number;
11
+ width: number;
12
+ url: string;
13
+ }, {
14
+ height: number;
15
+ width: number;
16
+ url: string;
17
+ }>>;
18
+ integration: z.ZodEnum<["stable", "beta", "planned", "unsupported"]>;
19
+ is_connect_webview_supported: z.ZodBoolean;
20
+ requires_seam_support_to_add_account: z.ZodBoolean;
21
+ }, "strip", z.ZodTypeAny, {
22
+ display_name: string;
23
+ manufacturer_id: string;
24
+ integration: "beta" | "stable" | "unsupported" | "planned";
25
+ is_connect_webview_supported: boolean;
26
+ requires_seam_support_to_add_account: boolean;
27
+ logo?: {
28
+ height: number;
29
+ width: number;
30
+ url: string;
31
+ } | undefined;
32
+ }, {
33
+ display_name: string;
34
+ manufacturer_id: string;
35
+ integration: "beta" | "stable" | "unsupported" | "planned";
36
+ is_connect_webview_supported: boolean;
37
+ requires_seam_support_to_add_account: boolean;
38
+ logo?: {
39
+ height: number;
40
+ width: number;
41
+ url: string;
42
+ } | undefined;
43
+ }>;
44
+ export type Manufacturer = z.infer<typeof manufacturer>;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { image_reference } from './image-reference.js';
3
+ export const manufacturer = z.object({
4
+ manufacturer_id: z.string().uuid(),
5
+ display_name: z.string(),
6
+ logo: image_reference.optional(),
7
+ integration: z.enum(['stable', 'beta', 'planned', 'unsupported']),
8
+ is_connect_webview_supported: z.boolean(),
9
+ requires_seam_support_to_add_account: z.boolean(),
10
+ });
11
+ //# sourceMappingURL=manufacturer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manufacturer.js","sourceRoot":"","sources":["../../../../src/lib/seam/devicedb/public-models/manufacturer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,IAAI,EAAE,eAAe,CAAC,QAAQ,EAAE;IAChC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IACjE,4BAA4B,EAAE,CAAC,CAAC,OAAO,EAAE;IACzC,oCAAoC,EAAE,CAAC,CAAC,OAAO,EAAE;CAClD,CAAC,CAAA"}
@@ -28,7 +28,6 @@ export interface Routes {
28
28
  description: string;
29
29
  product_url: string;
30
30
  main_connection_type: 'wifi' | 'zwave' | 'zigbee' | 'unknown';
31
- main_category: 'smartlock' | 'thermostat' | 'noise_sensor';
32
31
  aesthetic_variants: Array<{
33
32
  slug: string;
34
33
  display_name: string;
@@ -45,7 +44,43 @@ export interface Routes {
45
44
  height: number;
46
45
  } | undefined;
47
46
  }>;
48
- };
47
+ power_sources: Array<'battery' | 'hardwired' | 'mechanical_harvesting' | 'wireless' | 'ethernet'>;
48
+ } & ({
49
+ main_category: 'smartlock';
50
+ physical_properties: {
51
+ lock_type: 'deadbolt' | 'lever' | 'mortise' | 'lockbox' | 'cylinder' | 'padlock' | 'locker';
52
+ has_physical_key: boolean;
53
+ has_camera: boolean;
54
+ };
55
+ software_features: {
56
+ can_remotely_unlock: boolean;
57
+ can_program_access_codes: boolean;
58
+ can_program_access_schedules: boolean;
59
+ can_program_access_codes_offline: boolean;
60
+ };
61
+ } | {
62
+ main_category: 'sensor';
63
+ physical_properties: {
64
+ has_noise_sensor: boolean;
65
+ has_humidity_sensor: boolean;
66
+ has_temperature_sensor: boolean;
67
+ has_occupancy_detection: boolean;
68
+ };
69
+ } | {
70
+ main_category: 'thermostat';
71
+ physical_properties: {
72
+ available_modes: Array<'heat' | 'cool' | 'fan' | 'eco'>;
73
+ is_heat_pump_compatible: boolean;
74
+ has_occupancy_detection: boolean;
75
+ supports_demand_response: boolean;
76
+ has_humidity_sensor: boolean;
77
+ has_temperature_sensor: boolean;
78
+ supports_emergency_heating_mode: boolean;
79
+ };
80
+ software_features: {
81
+ can_program_climate_schedules: boolean;
82
+ };
83
+ });
49
84
  };
50
85
  };
51
86
  '/v1/device_models/list': {
@@ -80,7 +115,6 @@ export interface Routes {
80
115
  description: string;
81
116
  product_url: string;
82
117
  main_connection_type: 'wifi' | 'zwave' | 'zigbee' | 'unknown';
83
- main_category: 'smartlock' | 'thermostat' | 'noise_sensor';
84
118
  aesthetic_variants: Array<{
85
119
  slug: string;
86
120
  display_name: string;
@@ -97,7 +131,43 @@ export interface Routes {
97
131
  height: number;
98
132
  } | undefined;
99
133
  }>;
100
- }>;
134
+ power_sources: Array<'battery' | 'hardwired' | 'mechanical_harvesting' | 'wireless' | 'ethernet'>;
135
+ } & ({
136
+ main_category: 'smartlock';
137
+ physical_properties: {
138
+ lock_type: 'deadbolt' | 'lever' | 'mortise' | 'lockbox' | 'cylinder' | 'padlock' | 'locker';
139
+ has_physical_key: boolean;
140
+ has_camera: boolean;
141
+ };
142
+ software_features: {
143
+ can_remotely_unlock: boolean;
144
+ can_program_access_codes: boolean;
145
+ can_program_access_schedules: boolean;
146
+ can_program_access_codes_offline: boolean;
147
+ };
148
+ } | {
149
+ main_category: 'sensor';
150
+ physical_properties: {
151
+ has_noise_sensor: boolean;
152
+ has_humidity_sensor: boolean;
153
+ has_temperature_sensor: boolean;
154
+ has_occupancy_detection: boolean;
155
+ };
156
+ } | {
157
+ main_category: 'thermostat';
158
+ physical_properties: {
159
+ available_modes: Array<'heat' | 'cool' | 'fan' | 'eco'>;
160
+ is_heat_pump_compatible: boolean;
161
+ has_occupancy_detection: boolean;
162
+ supports_demand_response: boolean;
163
+ has_humidity_sensor: boolean;
164
+ has_temperature_sensor: boolean;
165
+ supports_emergency_heating_mode: boolean;
166
+ };
167
+ software_features: {
168
+ can_program_climate_schedules: boolean;
169
+ };
170
+ })>;
101
171
  };
102
172
  };
103
173
  '/v1/manufacturers/get': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/types",
3
- "version": "1.18.4",
3
+ "version": "1.18.5",
4
4
  "description": "TypeScript types for the Seam API.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,4 +1,4 @@
1
- import * as schemas from './public-models.js'
1
+ import * as schemas from './public-models/index.js'
2
2
 
3
3
  export type { Routes } from './route-types.js'
4
4
  export { schemas }
@@ -7,4 +7,4 @@ export type {
7
7
  DeviceModelV1,
8
8
  ImageReference,
9
9
  Manufacturer,
10
- } from './public-models.js'
10
+ } from './public-models/index.js'
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod'
2
+
3
+ export const device_model_v0 = z.object({
4
+ main_category: z.string(),
5
+ model_name: z.string(),
6
+ manufacturer_model_id: z.string(),
7
+ connection_type: z.enum(['wifi', 'zwave', 'zigbee', 'unknown']),
8
+ support_level: z.enum(['live', 'beta', 'unsupported']),
9
+ brand: z.string(),
10
+ icon_url: z.string(),
11
+ seam_device_model_page_url: z.string(),
12
+ })
13
+
14
+ export type DeviceModelV0 = z.infer<typeof device_model_v0>
@@ -0,0 +1,95 @@
1
+ import { z } from 'zod'
2
+
3
+ import { image_reference } from './image-reference.js'
4
+ import { manufacturer } from './manufacturer.js'
5
+
6
+ const smartlock = z.object({
7
+ main_category: z.literal('smartlock'),
8
+ physical_properties: z.object({
9
+ lock_type: z.enum([
10
+ 'deadbolt',
11
+ 'lever',
12
+ 'mortise',
13
+ 'lockbox',
14
+ 'cylinder',
15
+ 'padlock',
16
+ 'locker',
17
+ ]),
18
+ has_physical_key: z.boolean(),
19
+ has_camera: z.boolean(),
20
+ }),
21
+ software_features: z.object({
22
+ can_remotely_unlock: z.boolean(),
23
+ can_program_access_codes: z.boolean(),
24
+ can_program_access_schedules: z.boolean(),
25
+ can_program_access_codes_offline: z.boolean(),
26
+ }),
27
+ })
28
+
29
+ const sensor = z.object({
30
+ main_category: z.literal('sensor'),
31
+ physical_properties: z.object({
32
+ has_noise_sensor: z.boolean(),
33
+ has_humidity_sensor: z.boolean(),
34
+ has_temperature_sensor: z.boolean(),
35
+ has_occupancy_detection: z.boolean(),
36
+ }),
37
+ })
38
+
39
+ const thermostat = z.object({
40
+ main_category: z.literal('thermostat'),
41
+ physical_properties: z.object({
42
+ available_modes: z.enum(['heat', 'cool', 'fan', 'eco']).array(),
43
+ is_heat_pump_compatible: z.boolean(),
44
+ has_occupancy_detection: z.boolean(),
45
+ supports_demand_response: z.boolean(),
46
+ has_humidity_sensor: z.boolean(),
47
+ has_temperature_sensor: z.boolean(),
48
+ supports_emergency_heating_mode: z.boolean(),
49
+ }),
50
+ software_features: z.object({
51
+ can_program_climate_schedules: z.boolean(),
52
+ }),
53
+ })
54
+
55
+ export const device_model_category_specific_properties = z.discriminatedUnion(
56
+ 'main_category',
57
+ [smartlock, sensor, thermostat],
58
+ )
59
+
60
+ export const base_device_model_v1 = z.object({
61
+ device_model_id: z.string().uuid(),
62
+ manufacturer,
63
+ is_device_supported: z.boolean(),
64
+ display_name: z.string(),
65
+ description: z.string(),
66
+ product_url: z.string(),
67
+ main_connection_type: z.enum(['wifi', 'zwave', 'zigbee', 'unknown']),
68
+ aesthetic_variants: z
69
+ .object({
70
+ slug: z.string(),
71
+ display_name: z.string(),
72
+ primary_color_hex: z.string().optional(),
73
+ manufacturer_sku: z.string(),
74
+ front_image: image_reference.optional(),
75
+ back_image: image_reference.optional(),
76
+ })
77
+ .array(),
78
+ power_sources: z
79
+ .enum([
80
+ 'battery',
81
+ 'hardwired',
82
+ 'mechanical_harvesting',
83
+ 'wireless',
84
+ 'ethernet',
85
+ ])
86
+ .array(),
87
+ })
88
+
89
+ export type BaseDeviceModelV1 = z.infer<typeof base_device_model_v1>
90
+
91
+ export const device_model_v1 = base_device_model_v1.and(
92
+ device_model_category_specific_properties,
93
+ )
94
+
95
+ export type DeviceModelV1 = z.infer<typeof device_model_v1>
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod'
2
+
3
+ export const image_reference = z.object({
4
+ url: z.string().url(),
5
+ width: z.number(),
6
+ height: z.number(),
7
+ })
8
+
9
+ export type ImageReference = z.infer<typeof image_reference>
@@ -0,0 +1,4 @@
1
+ export * from './device-model-v0.js'
2
+ export * from './device-model-v1.js'
3
+ export * from './image-reference.js'
4
+ export * from './manufacturer.js'
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod'
2
+
3
+ import { image_reference } from './image-reference.js'
4
+
5
+ export const manufacturer = z.object({
6
+ manufacturer_id: z.string().uuid(),
7
+ display_name: z.string(),
8
+ logo: image_reference.optional(),
9
+ integration: z.enum(['stable', 'beta', 'planned', 'unsupported']),
10
+ is_connect_webview_supported: z.boolean(),
11
+ requires_seam_support_to_add_account: z.boolean(),
12
+ })
13
+
14
+ export type Manufacturer = z.infer<typeof manufacturer>