@seamapi/types 1.25.0 → 1.26.1

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 (31) hide show
  1. package/dist/connect.cjs +10 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +35 -0
  4. package/dist/devicedb.cjs +81 -9
  5. package/dist/devicedb.cjs.map +1 -1
  6. package/dist/devicedb.d.cts +1842 -2
  7. package/lib/seam/connect/openapi.d.ts +30 -0
  8. package/lib/seam/connect/openapi.js +10 -0
  9. package/lib/seam/connect/openapi.js.map +1 -1
  10. package/lib/seam/connect/route-types.d.ts +5 -0
  11. package/lib/seam/devicedb/index.d.ts +3 -2
  12. package/lib/seam/devicedb/index.js +2 -0
  13. package/lib/seam/devicedb/index.js.map +1 -1
  14. package/lib/seam/devicedb/public-models/device-model-v1.d.ts +5 -2
  15. package/lib/seam/devicedb/public-models/device-model-v1.js +22 -8
  16. package/lib/seam/devicedb/public-models/device-model-v1.js.map +1 -1
  17. package/lib/seam/devicedb/public-models/manufacturer.d.ts +2 -0
  18. package/lib/seam/devicedb/public-models/manufacturer.js +8 -1
  19. package/lib/seam/devicedb/public-models/manufacturer.js.map +1 -1
  20. package/lib/seam/devicedb/route-specs.d.ts +1817 -0
  21. package/lib/seam/devicedb/route-specs.js +49 -0
  22. package/lib/seam/devicedb/route-specs.js.map +1 -0
  23. package/lib/seam/devicedb/route-types.d.ts +1 -1
  24. package/package.json +3 -1
  25. package/src/lib/seam/connect/openapi.ts +10 -0
  26. package/src/lib/seam/connect/route-types.ts +5 -0
  27. package/src/lib/seam/devicedb/index.ts +5 -1
  28. package/src/lib/seam/devicedb/public-models/device-model-v1.ts +28 -8
  29. package/src/lib/seam/devicedb/public-models/manufacturer.ts +13 -1
  30. package/src/lib/seam/devicedb/route-specs.ts +50 -0
  31. package/src/lib/seam/devicedb/route-types.ts +7 -1
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import * as schemas from './public-models/index.js';
3
+ export const routes = {
4
+ '/api/v1/device_models/get': {
5
+ auth: 'publishable_key',
6
+ methods: ['GET', 'OPTIONS'],
7
+ queryParams: z.object({
8
+ device_model_id: z.string().uuid(),
9
+ }),
10
+ jsonResponse: z.object({
11
+ device_model: schemas.device_model_v1,
12
+ }),
13
+ },
14
+ '/api/v1/device_models/list': {
15
+ auth: 'publishable_key',
16
+ methods: ['GET', 'OPTIONS'],
17
+ queryParams: z.object({
18
+ main_category: schemas.device_category,
19
+ manufacturer_id: z.string().uuid().optional(),
20
+ manufacturer_ids: z.string().uuid().array().optional(),
21
+ integration_status: schemas.manufacturer.shape.integration.optional(),
22
+ text_search: z.string().optional(),
23
+ }),
24
+ jsonResponse: z.object({
25
+ device_models: schemas.device_model_v1.array(),
26
+ }),
27
+ },
28
+ '/api/v1/manufacturers/get': {
29
+ auth: 'publishable_key',
30
+ methods: ['GET', 'OPTIONS'],
31
+ queryParams: z.object({
32
+ manufacturer_id: z.string().uuid(),
33
+ }),
34
+ jsonResponse: z.object({
35
+ manufacturer: schemas.manufacturer,
36
+ }),
37
+ },
38
+ '/api/v1/manufacturers/list': {
39
+ auth: 'publishable_key',
40
+ methods: ['GET', 'OPTIONS'],
41
+ queryParams: z.object({
42
+ integration_status: schemas.manufacturer.shape.integration.optional(),
43
+ }),
44
+ jsonResponse: z.object({
45
+ manufacturers: schemas.manufacturer.array(),
46
+ }),
47
+ },
48
+ };
49
+ //# sourceMappingURL=route-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-specs.js","sourceRoot":"","sources":["../../../src/lib/seam/devicedb/route-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AAEnD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,2BAA2B,EAAE;QAC3B,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,CAAC,KAA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K,EAAE,SAAS,CAAC;QAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,kBAAkB,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE;SACtE,CAAC;QACF,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC;YACrB,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE;SAC5C,CAAC;KACH;CACO,CAAA"}
@@ -105,7 +105,7 @@ export interface Routes {
105
105
  route: '/v1/device_models/list';
106
106
  method: 'GET' | 'OPTIONS';
107
107
  queryParams: {
108
- main_category?: string | undefined;
108
+ main_category: 'smartlock' | 'sensor' | 'thermostat' | 'relay' | 'intercom' | 'accessory';
109
109
  manufacturer_id?: string | undefined;
110
110
  manufacturer_ids?: string[] | undefined;
111
111
  integration_status?: ('stable' | 'beta' | 'planned' | 'unsupported' | 'inquire') | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/types",
3
- "version": "1.25.0",
3
+ "version": "1.26.1",
4
4
  "description": "TypeScript types for the Seam API.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -59,6 +59,7 @@
59
59
  "prebuild:ts": "del 'index.*' 'connect.*' 'devicedb.*' 'lib'",
60
60
  "postbuild:ts": "tsc-alias --project tsconfig.build.json",
61
61
  "typecheck": "tsc",
62
+ "docs:build": "typedoc",
62
63
  "lint": "eslint --ignore-path .gitignore .",
63
64
  "prelint": "prettier --check --ignore-path .gitignore .",
64
65
  "postversion": "git push --follow-tags",
@@ -96,6 +97,7 @@
96
97
  "tsup": "^7.1.0",
97
98
  "tsx": "^3.12.1",
98
99
  "type-fest": "^4.3.1",
100
+ "typedoc": "^0.25.2",
99
101
  "typescript": "^5.0.2",
100
102
  "zod": "^3.21.4"
101
103
  }
@@ -1520,6 +1520,7 @@ export default {
1520
1520
  common_code_key: { type: 'string' },
1521
1521
  device_id: { format: 'uuid', type: 'string' },
1522
1522
  ends_at: { type: 'string' },
1523
+ is_external_modification_allowed: { type: 'boolean' },
1523
1524
  name: { type: 'string' },
1524
1525
  prefer_native_scheduling: { type: 'boolean' },
1525
1526
  starts_at: { type: 'string' },
@@ -1595,6 +1596,7 @@ export default {
1595
1596
  type: 'array',
1596
1597
  },
1597
1598
  ends_at: { type: 'string' },
1599
+ is_external_modification_allowed: { type: 'boolean' },
1598
1600
  name: { type: 'string' },
1599
1601
  prefer_native_scheduling: { type: 'boolean' },
1600
1602
  starts_at: { type: 'string' },
@@ -1667,6 +1669,7 @@ export default {
1667
1669
  type: 'array',
1668
1670
  },
1669
1671
  ends_at: { type: 'string' },
1672
+ is_external_modification_allowed: { type: 'boolean' },
1670
1673
  name: { type: 'string' },
1671
1674
  prefer_native_scheduling: { type: 'boolean' },
1672
1675
  starts_at: { type: 'string' },
@@ -2091,6 +2094,7 @@ export default {
2091
2094
  access_code_id: { format: 'uuid', type: 'string' },
2092
2095
  allow_external_modification: { type: 'boolean' },
2093
2096
  force: { type: 'boolean' },
2097
+ is_external_modification_allowed: { type: 'boolean' },
2094
2098
  sync: { default: false, type: 'boolean' },
2095
2099
  },
2096
2100
  required: ['access_code_id'],
@@ -2134,6 +2138,7 @@ export default {
2134
2138
  access_code_id: { format: 'uuid', type: 'string' },
2135
2139
  allow_external_modification: { type: 'boolean' },
2136
2140
  force: { type: 'boolean' },
2141
+ is_external_modification_allowed: { type: 'boolean' },
2137
2142
  sync: { default: false, type: 'boolean' },
2138
2143
  },
2139
2144
  required: ['access_code_id'],
@@ -2407,6 +2412,7 @@ export default {
2407
2412
  access_code_id: { format: 'uuid', type: 'string' },
2408
2413
  allow_external_modification: { type: 'boolean' },
2409
2414
  force: { type: 'boolean' },
2415
+ is_external_modification_allowed: { type: 'boolean' },
2410
2416
  is_managed: { type: 'boolean' },
2411
2417
  },
2412
2418
  required: ['access_code_id', 'is_managed'],
@@ -2450,6 +2456,7 @@ export default {
2450
2456
  access_code_id: { format: 'uuid', type: 'string' },
2451
2457
  allow_external_modification: { type: 'boolean' },
2452
2458
  force: { type: 'boolean' },
2459
+ is_external_modification_allowed: { type: 'boolean' },
2453
2460
  is_managed: { type: 'boolean' },
2454
2461
  },
2455
2462
  required: ['access_code_id', 'is_managed'],
@@ -2507,6 +2514,7 @@ export default {
2507
2514
  },
2508
2515
  device_id: { format: 'uuid', type: 'string' },
2509
2516
  ends_at: { type: 'string' },
2517
+ is_external_modification_allowed: { type: 'boolean' },
2510
2518
  is_managed: { type: 'boolean' },
2511
2519
  name: { type: 'string' },
2512
2520
  prefer_native_scheduling: { type: 'boolean' },
@@ -2572,6 +2580,7 @@ export default {
2572
2580
  },
2573
2581
  device_id: { format: 'uuid', type: 'string' },
2574
2582
  ends_at: { type: 'string' },
2583
+ is_external_modification_allowed: { type: 'boolean' },
2575
2584
  is_managed: { type: 'boolean' },
2576
2585
  name: { type: 'string' },
2577
2586
  prefer_native_scheduling: { type: 'boolean' },
@@ -2639,6 +2648,7 @@ export default {
2639
2648
  },
2640
2649
  device_id: { format: 'uuid', type: 'string' },
2641
2650
  ends_at: { type: 'string' },
2651
+ is_external_modification_allowed: { type: 'boolean' },
2642
2652
  is_managed: { type: 'boolean' },
2643
2653
  name: { type: 'string' },
2644
2654
  prefer_native_scheduling: { type: 'boolean' },
@@ -15,6 +15,7 @@ export interface Routes {
15
15
  prefer_native_scheduling?: boolean | undefined
16
16
  use_backup_access_code_pool?: boolean | undefined
17
17
  allow_external_modification?: boolean | undefined
18
+ is_external_modification_allowed?: boolean | undefined
18
19
  }
19
20
  commonParams: {}
20
21
  formData: {}
@@ -82,6 +83,7 @@ export interface Routes {
82
83
  prefer_native_scheduling?: boolean | undefined
83
84
  use_backup_access_code_pool?: boolean | undefined
84
85
  allow_external_modification?: boolean | undefined
86
+ is_external_modification_allowed?: boolean | undefined
85
87
  }
86
88
  commonParams: {}
87
89
  formData: {}
@@ -309,6 +311,7 @@ export interface Routes {
309
311
  jsonBody: {}
310
312
  commonParams: {
311
313
  access_code_id: string
314
+ is_external_modification_allowed?: boolean | undefined
312
315
  allow_external_modification?: boolean | undefined
313
316
  force?: boolean | undefined
314
317
  sync?: boolean
@@ -418,6 +421,7 @@ export interface Routes {
418
421
  access_code_id: string
419
422
  is_managed: boolean
420
423
  allow_external_modification?: boolean | undefined
424
+ is_external_modification_allowed?: boolean | undefined
421
425
  force?: boolean | undefined
422
426
  }
423
427
  formData: {}
@@ -437,6 +441,7 @@ export interface Routes {
437
441
  prefer_native_scheduling?: boolean | undefined
438
442
  use_backup_access_code_pool?: boolean | undefined
439
443
  allow_external_modification?: boolean | undefined
444
+ is_external_modification_allowed?: boolean | undefined
440
445
  access_code_id: string
441
446
  device_id?: string | undefined
442
447
  type?: ('ongoing' | 'time_bound') | undefined
@@ -1,10 +1,14 @@
1
1
  import * as schemas from './public-models/index.js'
2
2
 
3
- export type { Routes } from './route-types.js'
3
+ export * from './route-specs.js'
4
+ export * from './route-types.js'
4
5
  export { schemas }
5
6
 
6
7
  export type {
8
+ DeviceCategory,
9
+ DeviceConnectionType,
7
10
  DeviceModelV1,
8
11
  ImageReference,
9
12
  Manufacturer,
13
+ ManufacturerIntegrationSupportLevel,
10
14
  } from './public-models/index.js'
@@ -3,8 +3,28 @@ import { z } from 'zod'
3
3
  import { image_reference } from './image-reference.js'
4
4
  import { manufacturer } from './manufacturer.js'
5
5
 
6
+ export const device_category = z.enum([
7
+ 'smartlock',
8
+ 'sensor',
9
+ 'thermostat',
10
+ 'relay',
11
+ 'intercom',
12
+ 'accessory',
13
+ ])
14
+
15
+ export type DeviceCategory = z.infer<typeof device_category>
16
+
17
+ export const device_connection_type = z.enum([
18
+ 'wifi',
19
+ 'zwave',
20
+ 'zigbee',
21
+ 'unknown',
22
+ ])
23
+
24
+ export type DeviceConnectionType = z.infer<typeof device_connection_type>
25
+
6
26
  const smartlock = z.object({
7
- main_category: z.literal('smartlock'),
27
+ main_category: z.literal(device_category.enum.smartlock),
8
28
  physical_properties: z.object({
9
29
  lock_type: z.enum([
10
30
  'deadbolt',
@@ -28,7 +48,7 @@ const smartlock = z.object({
28
48
  })
29
49
 
30
50
  const sensor = z.object({
31
- main_category: z.literal('sensor'),
51
+ main_category: z.literal(device_category.enum.sensor),
32
52
  physical_properties: z.object({
33
53
  has_noise_sensor: z.boolean(),
34
54
  has_humidity_sensor: z.boolean(),
@@ -37,8 +57,8 @@ const sensor = z.object({
37
57
  }),
38
58
  })
39
59
 
40
- const thermostat = z.object({
41
- main_category: z.literal('thermostat'),
60
+ export const thermostat = z.object({
61
+ main_category: z.literal(device_category.enum.thermostat),
42
62
  physical_properties: z.object({
43
63
  available_modes: z.enum(['heat', 'cool', 'fan', 'eco']).array(),
44
64
  is_heat_pump_compatible: z.boolean(),
@@ -56,11 +76,11 @@ const thermostat = z.object({
56
76
  export type ThermostatPropertiesV1 = z.infer<typeof thermostat>
57
77
 
58
78
  const relay = z.object({
59
- main_category: z.literal('relay'),
79
+ main_category: z.literal(device_category.enum.relay),
60
80
  })
61
81
 
62
82
  const intercom = z.object({
63
- main_category: z.literal('intercom'),
83
+ main_category: z.literal(device_category.enum.intercom),
64
84
  physical_properties: z.object({
65
85
  has_camera: z.boolean(),
66
86
  }),
@@ -71,7 +91,7 @@ const intercom = z.object({
71
91
  })
72
92
 
73
93
  const accessory = z.object({
74
- main_category: z.literal('accessory'),
94
+ main_category: z.literal(device_category.enum.accessory),
75
95
  })
76
96
 
77
97
  export const device_model_category_specific_properties = z.discriminatedUnion(
@@ -86,7 +106,7 @@ export const base_device_model_v1 = z.object({
86
106
  display_name: z.string(),
87
107
  description: z.string(),
88
108
  product_url: z.string().optional(),
89
- main_connection_type: z.enum(['wifi', 'zwave', 'zigbee', 'unknown']),
109
+ main_connection_type: device_connection_type,
90
110
  aesthetic_variants: z
91
111
  .object({
92
112
  slug: z.string(),
@@ -2,11 +2,23 @@ import { z } from 'zod'
2
2
 
3
3
  import { image_reference } from './image-reference.js'
4
4
 
5
+ export const manufacturer_integration_support_level = z.enum([
6
+ 'stable',
7
+ 'beta',
8
+ 'planned',
9
+ 'unsupported',
10
+ 'inquire',
11
+ ])
12
+
13
+ export type ManufacturerIntegrationSupportLevel = z.infer<
14
+ typeof manufacturer_integration_support_level
15
+ >
16
+
5
17
  export const manufacturer = z.object({
6
18
  manufacturer_id: z.string().uuid(),
7
19
  display_name: z.string(),
8
20
  logo: image_reference.optional(),
9
- integration: z.enum(['stable', 'beta', 'planned', 'unsupported', 'inquire']),
21
+ integration: manufacturer_integration_support_level,
10
22
  is_connect_webview_supported: z.boolean(),
11
23
  requires_seam_support_to_add_account: z.boolean(),
12
24
  })
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod'
2
+
3
+ import * as schemas from './public-models/index.js'
4
+
5
+ export const routes = {
6
+ '/api/v1/device_models/get': {
7
+ auth: 'publishable_key',
8
+ methods: ['GET', 'OPTIONS'],
9
+ queryParams: z.object({
10
+ device_model_id: z.string().uuid(),
11
+ }),
12
+ jsonResponse: z.object({
13
+ device_model: schemas.device_model_v1,
14
+ }),
15
+ },
16
+ '/api/v1/device_models/list': {
17
+ auth: 'publishable_key',
18
+ methods: ['GET', 'OPTIONS'],
19
+ queryParams: z.object({
20
+ main_category: schemas.device_category,
21
+ manufacturer_id: z.string().uuid().optional(),
22
+ manufacturer_ids: z.string().uuid().array().optional(),
23
+ integration_status: schemas.manufacturer.shape.integration.optional(),
24
+ text_search: z.string().optional(),
25
+ }),
26
+ jsonResponse: z.object({
27
+ device_models: schemas.device_model_v1.array(),
28
+ }),
29
+ },
30
+ '/api/v1/manufacturers/get': {
31
+ auth: 'publishable_key',
32
+ methods: ['GET', 'OPTIONS'],
33
+ queryParams: z.object({
34
+ manufacturer_id: z.string().uuid(),
35
+ }),
36
+ jsonResponse: z.object({
37
+ manufacturer: schemas.manufacturer,
38
+ }),
39
+ },
40
+ '/api/v1/manufacturers/list': {
41
+ auth: 'publishable_key',
42
+ methods: ['GET', 'OPTIONS'],
43
+ queryParams: z.object({
44
+ integration_status: schemas.manufacturer.shape.integration.optional(),
45
+ }),
46
+ jsonResponse: z.object({
47
+ manufacturers: schemas.manufacturer.array(),
48
+ }),
49
+ },
50
+ } as const
@@ -132,7 +132,13 @@ export interface Routes {
132
132
  route: '/v1/device_models/list'
133
133
  method: 'GET' | 'OPTIONS'
134
134
  queryParams: {
135
- main_category?: string | undefined
135
+ main_category:
136
+ | 'smartlock'
137
+ | 'sensor'
138
+ | 'thermostat'
139
+ | 'relay'
140
+ | 'intercom'
141
+ | 'accessory'
136
142
  manufacturer_id?: string | undefined
137
143
  manufacturer_ids?: string[] | undefined
138
144
  integration_status?: