@seamapi/types 1.367.2 → 1.369.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.367.2",
3
+ "version": "1.369.0",
4
4
  "description": "TypeScript types for the Seam API.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -89,7 +89,7 @@
89
89
  "npm": ">= 9.0.0"
90
90
  },
91
91
  "peerDependencies": {
92
- "zod": "^3.21.4"
92
+ "zod": "^3.24.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@seamapi/blueprint": "^0.37.1",
@@ -111,6 +111,6 @@
111
111
  "tsx": "^4.6.2",
112
112
  "typedoc": "^0.25.2",
113
113
  "typescript": "~5.3.3",
114
- "zod": "^3.21.4"
114
+ "zod": "^3.24.0"
115
115
  }
116
116
  }
@@ -1,38 +1,61 @@
1
1
  import { z } from 'zod'
2
2
 
3
3
  export const common_action_attempt = z.object({
4
- action_attempt_id: z.string().uuid().describe(`
5
- ---
6
- title: Action Attempt ID
7
- ---
8
- The ID of the action attempt.
9
- `),
10
- status: z.enum(['pending', 'success', 'error']),
4
+ action_attempt_id: z.string().uuid().describe('ID of the action attempt.'),
5
+ status: z
6
+ .enum(['pending', 'success', 'error'])
7
+ .describe('Status of the action attempt.'),
11
8
  })
12
9
 
13
10
  export const common_pending_action_attempt = common_action_attempt.extend({
14
11
  status: z.literal('pending'),
15
- result: z.null(),
16
- error: z.null(),
12
+ result: z
13
+ .null()
14
+ .describe(
15
+ 'Result of the action attempt. Null for pending action attempts.',
16
+ ),
17
+ error: z
18
+ .null()
19
+ .describe(
20
+ 'Errors associated with the action attempt. Null for pending action attempts.',
21
+ ),
17
22
  })
18
23
 
19
24
  export const common_succeeded_action_attempt = common_action_attempt.extend({
20
25
  status: z.literal('success'),
21
- error: z.null(),
26
+ error: z
27
+ .null()
28
+ .describe(
29
+ 'Errors associated with the action attempt. Null for successful action attempts.',
30
+ ),
22
31
  })
23
32
 
24
33
  export const common_failed_action_attempt = common_action_attempt.extend({
25
34
  status: z.literal('error'),
26
- result: z.null(),
35
+ result: z
36
+ .null()
37
+ .describe('Result of the action attempt. Null for failed action attempts.'),
27
38
  })
28
39
 
29
40
  export const common_action_attempt_errors = [
30
- z.object({
31
- type: z.literal('uncategorized_error'),
32
- message: z.string(),
33
- }),
34
- z.object({
35
- type: z.literal('action_attempt_expired'),
36
- message: z.string(),
37
- }),
41
+ z
42
+ .object({
43
+ type: z
44
+ .literal('uncategorized_error')
45
+ .describe('Type of the error associated with the action attempt.'),
46
+ message: z
47
+ .string()
48
+ .describe('Message for the error associated with the action attempt.'),
49
+ })
50
+ .describe("Error that doesn't fit into other specific error categories."),
51
+ z
52
+ .object({
53
+ type: z
54
+ .literal('action_attempt_expired')
55
+ .describe('Type of the error associated with the action attempt.'),
56
+ message: z
57
+ .string()
58
+ .describe('Message for the error associated with the action attempt.'),
59
+ })
60
+ .describe('Error to indicate an expired action attempt.'),
38
61
  ] as const
@@ -11,7 +11,9 @@ import {
11
11
  common_succeeded_action_attempt,
12
12
  } from './common.js'
13
13
 
14
- const action_type = z.literal('ENCODE_CREDENTIAL')
14
+ const action_type = z
15
+ .literal('ENCODE_CREDENTIAL')
16
+ .describe('Type of action that the action attempt tracks.')
15
17
 
16
18
  const no_credential_on_encoder_error = z.object({
17
19
  type: z.literal('no_credential_on_encoder'),
@@ -35,23 +37,33 @@ const error = z.union([
35
37
  credential_cannot_be_reissued,
36
38
  ])
37
39
 
38
- const result = acs_credential.or(unmanaged_acs_credential)
40
+ const result = acs_credential
41
+ .or(unmanaged_acs_credential)
42
+ .describe(
43
+ 'If an encoding attempt was successful, includes the `acs_credential` data that was encoded onto the card.',
44
+ )
39
45
 
40
46
  export const encode_credential_action_attempt = z.discriminatedUnion('status', [
41
47
  common_pending_action_attempt
42
48
  .extend({
43
49
  action_type,
44
50
  })
45
- .describe('Encoding credential data from physical encoder.'),
51
+ .describe(
52
+ 'Action attempt to track encoding credential data from the physical encoder onto a card.',
53
+ ),
46
54
  common_succeeded_action_attempt
47
55
  .extend({
48
56
  action_type,
49
57
  result,
50
58
  })
51
- .describe('Encoding credential data from physical encoder succeeded.'),
59
+ .describe(
60
+ 'Action attempt to indicate that encoding credential data from the physical encoder onto a card succeeded.',
61
+ ),
52
62
  common_failed_action_attempt
53
63
  .extend({ action_type, error })
54
- .describe('Encoding credential data from physical encoder failed.'),
64
+ .describe(
65
+ 'Action attempt to indicate that encoding credential data from the physical encoder onto a card failed.',
66
+ ),
55
67
  ])
56
68
 
57
69
  export type EncodeCredentialActionAttempt = z.infer<