@seamapi/types 1.26.0 → 1.26.2

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.
@@ -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.optional(),
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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ACnC,CAAC;QACF,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC;YACrB,YAAY,EAAE,OAAO,CAAC,YAAY;SACnC,CAAC;KACH;IACD,4BAA4B,EAAE;QAC5B,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,CAAC,KAAK,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') | undefined;
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.26.0",
3
+ "version": "1.26.2",
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
  }
@@ -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.optional(),
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,16 @@ 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
+ | (
137
+ | 'smartlock'
138
+ | 'sensor'
139
+ | 'thermostat'
140
+ | 'relay'
141
+ | 'intercom'
142
+ | 'accessory'
143
+ )
144
+ | undefined
136
145
  manufacturer_id?: string | undefined
137
146
  manufacturer_ids?: string[] | undefined
138
147
  integration_status?: