Skip to content

Commit aee3e84

Browse files
authored
feat: Sync with Seam API via b812df0e943c8f2fff98f038c8b5db987fbbd604 (#2763)
1 parent 9b0bb8f commit aee3e84

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './managed-access-code.js'
2+
export * from './pending-mutations.js'
23
export * from './unmanaged-access-code.js'
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import { z } from 'zod'
2+
3+
const common_pending_mutation = z.object({
4+
created_at: z
5+
.string()
6+
.datetime()
7+
.describe('Date and time at which the mutation was created.'),
8+
message: z.string().describe('Detailed description of the mutation.'),
9+
})
10+
11+
const creating = common_pending_mutation
12+
.extend({
13+
mutation_code: z
14+
.literal('creating')
15+
.describe(
16+
'Mutation code to indicate that Seam is in the process of setting an access code on the device.',
17+
),
18+
})
19+
.describe('Seam is in the process of setting an access code on the device.')
20+
21+
const deleting = common_pending_mutation
22+
.extend({
23+
mutation_code: z
24+
.literal('deleting')
25+
.describe(
26+
'Mutation code to indicate that Seam is in the process of removing an access code from the device.',
27+
),
28+
})
29+
.describe(
30+
'Seam is in the process of removing an access code from the device.',
31+
)
32+
33+
const updating_code = common_pending_mutation
34+
.extend({
35+
mutation_code: z
36+
.literal('updating_code')
37+
.describe(
38+
'Mutation code to indicate that Seam is in the process of pushing an updated PIN code to the device.',
39+
),
40+
from: z
41+
.object({
42+
code: z.string().nullable().describe('Previous PIN code.'),
43+
})
44+
.describe('Previous code configuration.'),
45+
to: z
46+
.object({
47+
code: z.string().nullable().describe('New PIN code.'),
48+
})
49+
.describe('New code configuration.'),
50+
})
51+
.describe(
52+
'Seam is in the process of pushing an updated PIN code to the device.',
53+
)
54+
55+
const updating_name = common_pending_mutation
56+
.extend({
57+
mutation_code: z
58+
.literal('updating_name')
59+
.describe(
60+
'Mutation code to indicate that Seam is in the process of pushing an updated access code name to the device.',
61+
),
62+
from: z
63+
.object({
64+
name: z.string().nullable().describe('Previous access code name.'),
65+
})
66+
.describe('Previous name configuration.'),
67+
to: z
68+
.object({
69+
name: z.string().nullable().describe('New access code name.'),
70+
})
71+
.describe('New name configuration.'),
72+
})
73+
.describe(
74+
'Seam is in the process of pushing an updated access code name to the device.',
75+
)
76+
77+
const updating_time_frame = common_pending_mutation
78+
.extend({
79+
mutation_code: z
80+
.literal('updating_time_frame')
81+
.describe(
82+
'Mutation code to indicate that Seam is in the process of pushing updated access code time frame to the device.',
83+
),
84+
from: z
85+
.object({
86+
starts_at: z
87+
.string()
88+
.datetime()
89+
.nullable()
90+
.describe('Previous start time for the access code.'),
91+
ends_at: z
92+
.string()
93+
.datetime()
94+
.nullable()
95+
.describe('Previous end time for the access code.'),
96+
})
97+
.describe('Previous time frame configuration.'),
98+
to: z
99+
.object({
100+
starts_at: z
101+
.string()
102+
.datetime()
103+
.nullable()
104+
.describe('New start time for the access code.'),
105+
ends_at: z
106+
.string()
107+
.datetime()
108+
.nullable()
109+
.describe('New end time for the access code.'),
110+
})
111+
.describe('New time frame configuration.'),
112+
})
113+
.describe(
114+
'Seam is in the process of pushing an updated time frame to the device.',
115+
)
116+
117+
export const access_code_pending_mutations = z.discriminatedUnion(
118+
'mutation_code',
119+
[creating, deleting, updating_code, updating_name, updating_time_frame],
120+
)
121+
122+
export type AccessCodePendingMutation = z.infer<
123+
typeof access_code_pending_mutations
124+
>
125+
126+
const _access_code_pending_mutations_map = z.object({
127+
creating: creating.optional().nullable(),
128+
deleting: deleting.optional().nullable(),
129+
updating_code: updating_code.optional().nullable(),
130+
updating_name: updating_name.optional().nullable(),
131+
updating_time_frame: updating_time_frame.optional().nullable(),
132+
})
133+
134+
export type AccessCodePendingMutationsMap = z.infer<
135+
typeof _access_code_pending_mutations_map
136+
>

0 commit comments

Comments
 (0)