Skip to content

Commit 7253418

Browse files
authored
feat: Sync with Seam API via 5c6d380a14eeff44962b4580fc73de6dc4064dbc (#2629)
1 parent 94c7804 commit 7253418

5 files changed

Lines changed: 3003 additions & 250 deletions

File tree

src/lib/seam/connect/models/access-grants/access-grant.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,25 @@ const overprovisioned_access = common_access_grant_warning
8181
'Indicates that the access grant has access to locations it should not have. Access methods are being removed from the extra locations.',
8282
)
8383

84+
const updating_access_times = common_access_grant_warning
85+
.extend({
86+
warning_code: z
87+
.literal('updating_access_times')
88+
.describe(warning_code_description),
89+
access_method_ids: z
90+
.array(z.string().uuid())
91+
.describe('IDs of the access methods being updated.'),
92+
})
93+
.describe(
94+
'Indicates that the access times for this [access grant](https://docs.seam.co/latest/capability-guides/access-grants) are being updated.',
95+
)
96+
8497
const access_grant_warning = z
8598
.discriminatedUnion('warning_code', [
8699
being_deleted,
87100
underprovisioned_access,
88101
overprovisioned_access,
102+
updating_access_times,
89103
])
90104
.describe(
91105
'Warning associated with the [access grant](https://docs.seam.co/latest/capability-guides/access-grants).',
@@ -95,6 +109,7 @@ const _access_grant_warning_map = z.object({
95109
being_deleted: being_deleted.optional().nullable(),
96110
underprovisioned_access: underprovisioned_access.optional().nullable(),
97111
overprovisioned_access: overprovisioned_access.optional().nullable(),
112+
updating_access_times: updating_access_times.optional().nullable(),
98113
})
99114

100115
export type AccessGrantWarningMap = z.infer<typeof _access_grant_warning_map>

src/lib/seam/connect/models/access-grants/access-method.ts

Lines changed: 144 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,156 @@ const being_deleted = common_access_method_warning
2323
'Indicates that the [access method](https://docs.seam.co/latest/capability-guides/access-grants/delivering-access-methods) is being deleted.',
2424
)
2525

26+
const updating_access_times_warning = common_access_method_warning
27+
.extend({
28+
warning_code: z
29+
.literal('updating_access_times')
30+
.describe(warning_code_description),
31+
})
32+
.describe(
33+
'Indicates that the access times for this [access method](https://docs.seam.co/latest/capability-guides/access-grants/delivering-access-methods) are being updated.',
34+
)
35+
2636
const access_method_warning = z
27-
.discriminatedUnion('warning_code', [being_deleted])
37+
.discriminatedUnion('warning_code', [
38+
being_deleted,
39+
updating_access_times_warning,
40+
])
2841
.describe(
2942
'Warning associated with the [access method](https://docs.seam.co/latest/capability-guides/access-grants/delivering-access-methods).',
3043
)
3144

3245
const _access_method_warning_map = z.object({
3346
being_deleted: being_deleted.optional().nullable(),
47+
updating_access_times: updating_access_times_warning.optional().nullable(),
3448
})
3549

3650
export type AccessMethodWarningMap = z.infer<typeof _access_method_warning_map>
3751

52+
// Pending mutations for access methods
53+
const common_pending_mutation = z.object({
54+
created_at: z
55+
.string()
56+
.datetime()
57+
.describe('Date and time at which the mutation was created.'),
58+
message: z.string().describe('Detailed description of the mutation.'),
59+
})
60+
61+
const provisioning_access_mutation = common_pending_mutation
62+
.extend({
63+
mutation_code: z
64+
.literal('provisioning_access')
65+
.describe(
66+
'Mutation code to indicate that Seam is in the process of provisioning access for this access method on new devices.',
67+
),
68+
from: z
69+
.object({
70+
device_ids: z
71+
.array(z.string().uuid())
72+
.describe('Previous device IDs where access was provisioned.'),
73+
})
74+
.describe('Previous device configuration.'),
75+
to: z
76+
.object({
77+
device_ids: z
78+
.array(z.string().uuid())
79+
.describe('New device IDs where access is being provisioned.'),
80+
})
81+
.describe('New device configuration.'),
82+
})
83+
.describe(
84+
'Seam is in the process of provisioning access for this access method on new devices.',
85+
)
86+
87+
const revoking_access_mutation = common_pending_mutation
88+
.extend({
89+
mutation_code: z
90+
.literal('revoking_access')
91+
.describe(
92+
'Mutation code to indicate that Seam is in the process of revoking access for this access method from devices.',
93+
),
94+
from: z
95+
.object({
96+
device_ids: z
97+
.array(z.string().uuid())
98+
.describe('Previous device IDs where access existed.'),
99+
})
100+
.describe('Previous device configuration.'),
101+
to: z
102+
.object({
103+
device_ids: z
104+
.array(z.string().uuid())
105+
.describe('New device IDs where access should remain.'),
106+
})
107+
.describe('New device configuration.'),
108+
})
109+
.describe(
110+
'Seam is in the process of revoking access for this access method from devices.',
111+
)
112+
113+
const updating_access_times_mutation = common_pending_mutation
114+
.extend({
115+
mutation_code: z
116+
.literal('updating_access_times')
117+
.describe(
118+
'Mutation code to indicate that Seam is in the process of updating the access times for this access method.',
119+
),
120+
from: z
121+
.object({
122+
starts_at: z
123+
.string()
124+
.datetime()
125+
.nullable()
126+
.describe('Previous start time for access.'),
127+
ends_at: z
128+
.string()
129+
.datetime()
130+
.nullable()
131+
.describe('Previous end time for access.'),
132+
})
133+
.describe('Previous access time configuration.'),
134+
to: z
135+
.object({
136+
starts_at: z
137+
.string()
138+
.datetime()
139+
.nullable()
140+
.describe('New start time for access.'),
141+
ends_at: z
142+
.string()
143+
.datetime()
144+
.nullable()
145+
.describe('New end time for access.'),
146+
})
147+
.describe('New access time configuration.'),
148+
})
149+
.describe(
150+
'Seam is in the process of updating the access times for this access method.',
151+
)
152+
153+
export const access_method_pending_mutations = z.discriminatedUnion(
154+
'mutation_code',
155+
[
156+
provisioning_access_mutation,
157+
revoking_access_mutation,
158+
updating_access_times_mutation,
159+
],
160+
)
161+
162+
export type AccessMethodPendingMutation = z.infer<
163+
typeof access_method_pending_mutations
164+
>
165+
166+
const _access_method_pending_mutations_map = z.object({
167+
provisioning_access: provisioning_access_mutation.optional().nullable(),
168+
revoking_access: revoking_access_mutation.optional().nullable(),
169+
updating_access_times: updating_access_times_mutation.optional().nullable(),
170+
})
171+
172+
export type AccessMethodPendingMutationsMap = z.infer<
173+
typeof _access_method_pending_mutations_map
174+
>
175+
38176
export const access_method = z.object({
39177
workspace_id: z
40178
.string()
@@ -84,6 +222,11 @@ export const access_method = z.object({
84222
.describe(
85223
'Warnings associated with the [access method](https://docs.seam.co/latest/capability-guides/access-grants/delivering-access-methods).',
86224
),
225+
pending_mutations: z
226+
.array(access_method_pending_mutations)
227+
.describe(
228+
'Pending mutations for the [access method](https://docs.seam.co/latest/capability-guides/access-grants/delivering-access-methods). Indicates operations that are in progress.',
229+
),
87230
customization_profile_id: z
88231
.string()
89232
.uuid()

src/lib/seam/connect/models/access-grants/pending-mutations.ts

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,52 @@ const updating_spaces_mutation = common_pending_mutation
3939
'Seam is in the process of updating the devices/spaces associated with this access grant.',
4040
)
4141

42+
const updating_access_times_mutation = common_pending_mutation
43+
.extend({
44+
mutation_code: z
45+
.literal('updating_access_times')
46+
.describe(
47+
'Mutation code to indicate that Seam is in the process of updating the access times for this access grant.',
48+
),
49+
access_method_ids: z
50+
.array(z.string().uuid())
51+
.describe('IDs of the access methods being updated.'),
52+
from: z
53+
.object({
54+
starts_at: z
55+
.string()
56+
.datetime()
57+
.nullable()
58+
.describe('Previous start time for access.'),
59+
ends_at: z
60+
.string()
61+
.datetime()
62+
.nullable()
63+
.describe('Previous end time for access.'),
64+
})
65+
.describe('Previous access time configuration.'),
66+
to: z
67+
.object({
68+
starts_at: z
69+
.string()
70+
.datetime()
71+
.nullable()
72+
.describe('New start time for access.'),
73+
ends_at: z
74+
.string()
75+
.datetime()
76+
.nullable()
77+
.describe('New end time for access.'),
78+
})
79+
.describe('New access time configuration.'),
80+
})
81+
.describe(
82+
'Seam is in the process of updating the access times for this access grant.',
83+
)
84+
4285
export const access_grant_pending_mutations = z.discriminatedUnion(
4386
'mutation_code',
44-
[updating_spaces_mutation],
87+
[updating_spaces_mutation, updating_access_times_mutation],
4588
)
4689

4790
export type AccessGrantPendingMutation = z.infer<
@@ -50,6 +93,7 @@ export type AccessGrantPendingMutation = z.infer<
5093

5194
const _access_grant_pending_mutations_map = z.object({
5295
updating_spaces: updating_spaces_mutation.optional().nullable(),
96+
updating_access_times: updating_access_times_mutation.optional().nullable(),
5397
})
5498

5599
export type AccessGrantPendingMutationsMap = z.infer<

0 commit comments

Comments
 (0)