@seamapi/types 1.1011.0 → 1.1013.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/types",
3
- "version": "1.1011.0",
3
+ "version": "1.1013.0",
4
4
  "description": "TypeScript types for the Seam API.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -73,6 +73,7 @@ export {
73
73
  provider_capability,
74
74
  reservation_resource,
75
75
  resident_resource,
76
+ resource_key,
76
77
  room_resource,
77
78
  space,
78
79
  space_customer_data,
@@ -1,15 +1,22 @@
1
1
  import { z } from 'zod'
2
2
 
3
+ const custom_metadata_key = z
4
+ .string()
5
+ .max(40)
6
+ .refine((key) => !key.includes('.'), {
7
+ message: 'Custom metadata key names cannot contain a period (.)',
8
+ })
9
+
3
10
  export const custom_metadata_input = z
4
11
  .record(
5
- z.string().max(40),
12
+ custom_metadata_key,
6
13
  z.union([z.string().max(500), z.boolean(), z.null()]),
7
14
  )
8
15
  .refine((val) => Object.keys(val).length <= 50, {
9
16
  message: 'Custom metadata is limited to a maximum of 50 keys',
10
17
  })
11
18
  .describe(
12
- 'Set of up to 50 key:value pairs, with key names up to 40 characters long. Accepts string or Boolean values. Strings are limited to 500 characters. Adding custom metadata to a resource, such as a [Connect Webview](https://docs.seam.co/core-concepts/connect-webviews/attaching-custom-data-to-the-connect-webview), [connected account](https://docs.seam.co/core-concepts/connected-accounts/adding-custom-metadata-to-a-connected-account), or [device](https://docs.seam.co/core-concepts/devices/adding-custom-metadata-to-a-device), enables you to store custom information, like customer details or internal IDs from your application.',
19
+ 'Set of up to 50 key:value pairs, with key names up to 40 characters long that cannot contain a period (.). Accepts string or Boolean values. Strings are limited to 500 characters. Adding custom metadata to a resource, such as a [Connect Webview](https://docs.seam.co/core-concepts/connect-webviews/attaching-custom-data-to-the-connect-webview), [connected account](https://docs.seam.co/core-concepts/connected-accounts/adding-custom-metadata-to-a-connected-account), or [device](https://docs.seam.co/core-concepts/devices/adding-custom-metadata-to-a-device), enables you to store custom information, like customer details or internal IDs from your application.',
13
20
  )
14
21
 
15
22
  export const custom_metadata = z
@@ -24,6 +24,7 @@ export * from './partner/index.js'
24
24
  export * from './phone-number.js'
25
25
  export * from './phones/index.js'
26
26
  export * from './provider-capability.js'
27
+ export * from './resource-key.js'
27
28
  export * from './spaces/index.js'
28
29
  export * from './thermostats/index.js'
29
30
  export * from './user-identities/index.js'
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod'
2
+
3
+ /**
4
+ * Shared schema for every customer-supplied `*_key` identifier
5
+ * (`customer_key`, `access_grant_key`, `space_key`, `user_identity_key`, ...).
6
+ *
7
+ * A whitespace-only key is never a usable identifier: it cannot be looked back
8
+ * up, and once stored it silently shadows the "no key set" case that the
9
+ * underlying columns model as NULL.
10
+ */
11
+ export const resource_key = z
12
+ .string()
13
+ .min(1)
14
+ .refine((value) => value.trim() !== '', {
15
+ message: 'Must not consist only of whitespace',
16
+ })