Skip to content

Commit e497771

Browse files
authored
feat: Add salto_ks warnings (#1567)
1 parent bc05563 commit e497771

File tree

3 files changed

+181
-177
lines changed

3 files changed

+181
-177
lines changed

src/lib/seam/connect/models/devices/device.ts

+25-21
Original file line numberDiff line numberDiff line change
@@ -200,29 +200,31 @@ const many_active_backup_codes = common_device_warning
200200
})
201201
.describe('Too many backup codes.')
202202

203-
const salto_unknown_device_type = common_device_warning
203+
const salto_ks_office_mode = common_device_warning
204204
.extend({
205205
warning_code: z
206-
.literal('salto_unknown_device_type')
206+
.literal('salto_ks_office_mode')
207207
.describe(warning_code_description),
208208
})
209-
.describe('A Salto Lock displaying an unknown device type.')
209+
.describe('Lock is in Office Mode. Access Codes will not unlock doors.')
210210

211-
const salto_office_mode = common_device_warning
211+
const salto_ks_privacy_mode = common_device_warning
212212
.extend({
213213
warning_code: z
214-
.literal('salto_office_mode')
214+
.literal('salto_ks_privacy_mode')
215215
.describe(warning_code_description),
216216
})
217-
.describe('Lock is in Office Mode. Access Codes will not unlock doors.')
217+
.describe('Lock is in Privacy Mode. Access Codes will not unlock doors.')
218218

219-
const salto_privacy_mode = common_device_warning
219+
const salto_ks_subscription_limit_almost_reached = common_device_warning
220220
.extend({
221221
warning_code: z
222-
.literal('salto_privacy_mode')
222+
.literal('salto_ks_subscription_limit_almost_reached')
223223
.describe(warning_code_description),
224224
})
225-
.describe('Lock is in Privacy Mode. Access Codes will not unlock doors.')
225+
.describe(
226+
'Indicates that the Salto KS site has exceeded 80% of the maximum number of allowed users. Please increase your subscription limit, or delete some users from your site to rectify this.',
227+
)
226228

227229
const wyze_device_missing_gateway = common_device_warning
228230
.extend({
@@ -318,7 +320,6 @@ export const unknown_issue_with_phone = common_device_warning
318320
const device_warning = z.discriminatedUnion('warning_code', [
319321
partial_backup_access_code_pool,
320322
many_active_backup_codes,
321-
salto_unknown_device_type,
322323
wyze_device_missing_gateway,
323324
functional_offline_device,
324325
third_party_integration_detected,
@@ -329,8 +330,9 @@ const device_warning = z.discriminatedUnion('warning_code', [
329330
device_communication_degraded,
330331
scheduled_maintenance_window,
331332
device_has_flaky_connection,
332-
salto_office_mode,
333-
salto_privacy_mode,
333+
salto_ks_office_mode,
334+
salto_ks_privacy_mode,
335+
salto_ks_subscription_limit_almost_reached,
334336
unknown_issue_with_phone,
335337
])
336338

@@ -341,7 +343,13 @@ export const device_warning_map = z.object({
341343
.optional()
342344
.nullable(),
343345
many_active_backup_codes: many_active_backup_codes.optional().nullable(),
344-
salto_unknown_device_type: salto_unknown_device_type.optional().nullable(),
346+
device_has_flaky_connection: device_has_flaky_connection
347+
.extend({
348+
_event_id: z.string().uuid().optional(),
349+
_reason: z.string().optional(),
350+
})
351+
.optional()
352+
.nullable(),
345353
wyze_device_missing_gateway: wyze_device_missing_gateway
346354
.optional()
347355
.nullable(),
@@ -364,14 +372,10 @@ export const device_warning_map = z.object({
364372
scheduled_maintenance_window: scheduled_maintenance_window
365373
.optional()
366374
.nullable(),
367-
device_has_flaky_connection: device_has_flaky_connection
368-
.extend({
369-
_event_id: z.string().uuid().optional(),
370-
})
371-
.optional()
372-
.nullable(),
373-
salto_office_mode: salto_office_mode.optional().nullable(),
374-
salto_privacy_mode: salto_privacy_mode.optional().nullable(),
375+
salto_ks_office_mode: salto_ks_office_mode.optional().nullable(),
376+
salto_ks_privacy_mode: salto_ks_privacy_mode.optional().nullable(),
377+
salto_ks_subscription_limit_almost_reached:
378+
salto_ks_subscription_limit_almost_reached.optional().nullable(),
375379
unknown_issue_with_phone: unknown_issue_with_phone.optional().nullable(),
376380
})
377381

src/lib/seam/connect/openapi.ts

+36-36
Original file line numberDiff line numberDiff line change
@@ -7598,22 +7598,6 @@ export default {
75987598
required: ['message', 'created_at', 'warning_code'],
75997599
type: 'object',
76007600
},
7601-
{
7602-
description:
7603-
'A Salto Lock displaying an unknown device type.',
7604-
properties: {
7605-
created_at: { format: 'date-time', type: 'string' },
7606-
message: { type: 'string' },
7607-
warning_code: {
7608-
description:
7609-
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
7610-
enum: ['salto_unknown_device_type'],
7611-
type: 'string',
7612-
},
7613-
},
7614-
required: ['message', 'created_at', 'warning_code'],
7615-
type: 'object',
7616-
},
76177601
{
76187602
description: 'Wyze Lock is not connected to a gateway.',
76197603
properties: {
@@ -7774,7 +7758,7 @@ export default {
77747758
warning_code: {
77757759
description:
77767760
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
7777-
enum: ['salto_office_mode'],
7761+
enum: ['salto_ks_office_mode'],
77787762
type: 'string',
77797763
},
77807764
},
@@ -7790,7 +7774,23 @@ export default {
77907774
warning_code: {
77917775
description:
77927776
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
7793-
enum: ['salto_privacy_mode'],
7777+
enum: ['salto_ks_privacy_mode'],
7778+
type: 'string',
7779+
},
7780+
},
7781+
required: ['message', 'created_at', 'warning_code'],
7782+
type: 'object',
7783+
},
7784+
{
7785+
description:
7786+
'Indicates that the Salto KS site has exceeded 80% of the maximum number of allowed users. Please increase your subscription limit, or delete some users from your site to rectify this.',
7787+
properties: {
7788+
created_at: { format: 'date-time', type: 'string' },
7789+
message: { type: 'string' },
7790+
warning_code: {
7791+
description:
7792+
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
7793+
enum: ['salto_ks_subscription_limit_almost_reached'],
77947794
type: 'string',
77957795
},
77967796
},
@@ -14967,22 +14967,6 @@ export default {
1496714967
required: ['message', 'created_at', 'warning_code'],
1496814968
type: 'object',
1496914969
},
14970-
{
14971-
description:
14972-
'A Salto Lock displaying an unknown device type.',
14973-
properties: {
14974-
created_at: { format: 'date-time', type: 'string' },
14975-
message: { type: 'string' },
14976-
warning_code: {
14977-
description:
14978-
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
14979-
enum: ['salto_unknown_device_type'],
14980-
type: 'string',
14981-
},
14982-
},
14983-
required: ['message', 'created_at', 'warning_code'],
14984-
type: 'object',
14985-
},
1498614970
{
1498714971
description: 'Wyze Lock is not connected to a gateway.',
1498814972
properties: {
@@ -15143,7 +15127,7 @@ export default {
1514315127
warning_code: {
1514415128
description:
1514515129
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
15146-
enum: ['salto_office_mode'],
15130+
enum: ['salto_ks_office_mode'],
1514715131
type: 'string',
1514815132
},
1514915133
},
@@ -15159,7 +15143,23 @@ export default {
1515915143
warning_code: {
1516015144
description:
1516115145
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
15162-
enum: ['salto_privacy_mode'],
15146+
enum: ['salto_ks_privacy_mode'],
15147+
type: 'string',
15148+
},
15149+
},
15150+
required: ['message', 'created_at', 'warning_code'],
15151+
type: 'object',
15152+
},
15153+
{
15154+
description:
15155+
'Indicates that the Salto KS site has exceeded 80% of the maximum number of allowed users. Please increase your subscription limit, or delete some users from your site to rectify this.',
15156+
properties: {
15157+
created_at: { format: 'date-time', type: 'string' },
15158+
message: { type: 'string' },
15159+
warning_code: {
15160+
description:
15161+
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
15162+
enum: ['salto_ks_subscription_limit_almost_reached'],
1516315163
type: 'string',
1516415164
},
1516515165
},

0 commit comments

Comments
 (0)