@seamapi/types 1.879.0 → 1.880.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.879.0",
3
+ "version": "1.880.0",
4
4
  "description": "TypeScript types for the Seam API.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod'
2
2
 
3
3
  import { activate_climate_preset_action_attempt } from './activate-climate-preset.js'
4
+ import { assign_credential_action_attempt } from './assign-credential.js'
4
5
  import { configure_auto_lock_action_attempt } from './configure-auto-lock.js'
5
6
  import { deprecated_action_attempts } from './deprecated.js'
6
7
  import { encode_credential_action_attempt } from './encode-credential.js'
@@ -21,6 +22,7 @@ export const action_attempt = z.union([
21
22
  ...scan_credential_action_attempt.options,
22
23
  ...encode_credential_action_attempt.options,
23
24
  ...scan_to_assign_credential_action_attempt.options,
25
+ ...assign_credential_action_attempt.options,
24
26
  ...reset_sandbox_workspace_action_attempt.options,
25
27
  ...set_fan_mode_action_attempt.options,
26
28
  ...set_hvac_mode_action_attempt.options,
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod'
2
+
3
+ import { access_method } from '../access-grants/access-method.js'
4
+ import {
5
+ common_action_attempt_errors,
6
+ common_failed_action_attempt,
7
+ common_pending_action_attempt,
8
+ common_succeeded_action_attempt,
9
+ } from './common.js'
10
+
11
+ const action_type = z
12
+ .literal('ASSIGN_CREDENTIAL')
13
+ .describe(
14
+ 'Action attempt to track the status of assigning an existing credential to an access method.',
15
+ )
16
+
17
+ const credential_not_found_error = z
18
+ .object({
19
+ type: z
20
+ .literal('credential_not_found')
21
+ .describe(
22
+ 'Error type to indicate that no matching credential was found.',
23
+ ),
24
+ message: z
25
+ .string()
26
+ .describe(
27
+ 'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
28
+ ),
29
+ })
30
+ .describe('Error to indicate that no matching credential was found.')
31
+
32
+ const error = z.union([
33
+ ...common_action_attempt_errors,
34
+ credential_not_found_error,
35
+ ])
36
+
37
+ const result = access_method.describe(
38
+ 'Result of an assignment attempt. If the attempt was successful, includes the updated access method with the assigned credential.',
39
+ )
40
+
41
+ export const assign_credential_action_attempt = z.discriminatedUnion('status', [
42
+ common_pending_action_attempt
43
+ .extend({
44
+ action_type,
45
+ })
46
+ .describe('Assigning a credential to an access method is pending.'),
47
+ common_succeeded_action_attempt
48
+ .extend({
49
+ action_type,
50
+ result,
51
+ })
52
+ .describe('Assigning a credential to an access method succeeded.'),
53
+ common_failed_action_attempt
54
+ .extend({ action_type, error })
55
+ .describe('Assigning a credential to an access method failed.'),
56
+ ])
57
+
58
+ export type AssignCredentialActionAttempt = z.infer<
59
+ typeof assign_credential_action_attempt
60
+ >