Skip to content

Commit be2878d

Browse files
authored
feat: Sync with Seam API via 7a4bf19d54d17f6b1fe38584ed57d1edd951a49e (#2765)
1 parent 7354b54 commit be2878d

File tree

4 files changed

+802
-3
lines changed

4 files changed

+802
-3
lines changed

src/lib/seam/connect/models/access-codes/managed-access-code.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { z } from 'zod'
22

33
import { device_and_connected_account_error_options } from '../devices/index.js'
4+
import { access_code_pending_mutations } from './pending-mutations.js'
45

56
const common_access_code_error = z.object({
67
message: z
@@ -714,6 +715,11 @@ export const access_code = z.object({
714715
.describe(
715716
'Metadata for a dormakaba Oracode managed access code. Only present for access codes from dormakaba Oracode devices.',
716717
),
718+
pending_mutations: z
719+
.array(access_code_pending_mutations)
720+
.describe(
721+
'Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device.',
722+
),
717723
}).describe(`
718724
---
719725
route_path: /access_codes

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,30 @@ export type AccessCodePendingMutation = z.infer<
123123
typeof access_code_pending_mutations
124124
>
125125

126+
// Internal fields stored in the DB but stripped from public API responses.
127+
// Used to track the delete+recreate flow for providers that don't support
128+
// in-place updates (e.g. Schlage, August).
129+
const internal_recreate_fields = z.object({
130+
must_be_recreated_on_device: z.boolean().optional(),
131+
is_being_removed: z.boolean().optional(),
132+
is_being_created: z.boolean().optional(),
133+
})
134+
126135
const _access_code_pending_mutations_map = z.object({
127136
creating: creating.optional().nullable(),
128137
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(),
138+
updating_code: updating_code
139+
.merge(internal_recreate_fields)
140+
.optional()
141+
.nullable(),
142+
updating_name: updating_name
143+
.merge(internal_recreate_fields)
144+
.optional()
145+
.nullable(),
146+
updating_time_frame: updating_time_frame
147+
.merge(internal_recreate_fields)
148+
.optional()
149+
.nullable(),
132150
})
133151

134152
export type AccessCodePendingMutationsMap = z.infer<

src/lib/seam/connect/openapi.ts

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,241 @@ export default {
13761376
nullable: true,
13771377
type: 'string',
13781378
},
1379+
pending_mutations: {
1380+
description:
1381+
'Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device.',
1382+
items: {
1383+
discriminator: { propertyName: 'mutation_code' },
1384+
oneOf: [
1385+
{
1386+
description:
1387+
'Seam is in the process of setting an access code on the device.',
1388+
properties: {
1389+
created_at: {
1390+
description:
1391+
'Date and time at which the mutation was created.',
1392+
format: 'date-time',
1393+
type: 'string',
1394+
},
1395+
message: {
1396+
description: 'Detailed description of the mutation.',
1397+
type: 'string',
1398+
},
1399+
mutation_code: {
1400+
description:
1401+
'Mutation code to indicate that Seam is in the process of setting an access code on the device.',
1402+
enum: ['creating'],
1403+
type: 'string',
1404+
},
1405+
},
1406+
required: ['created_at', 'message', 'mutation_code'],
1407+
type: 'object',
1408+
},
1409+
{
1410+
description:
1411+
'Seam is in the process of removing an access code from the device.',
1412+
properties: {
1413+
created_at: {
1414+
description:
1415+
'Date and time at which the mutation was created.',
1416+
format: 'date-time',
1417+
type: 'string',
1418+
},
1419+
message: {
1420+
description: 'Detailed description of the mutation.',
1421+
type: 'string',
1422+
},
1423+
mutation_code: {
1424+
description:
1425+
'Mutation code to indicate that Seam is in the process of removing an access code from the device.',
1426+
enum: ['deleting'],
1427+
type: 'string',
1428+
},
1429+
},
1430+
required: ['created_at', 'message', 'mutation_code'],
1431+
type: 'object',
1432+
},
1433+
{
1434+
description:
1435+
'Seam is in the process of pushing an updated PIN code to the device.',
1436+
properties: {
1437+
created_at: {
1438+
description:
1439+
'Date and time at which the mutation was created.',
1440+
format: 'date-time',
1441+
type: 'string',
1442+
},
1443+
from: {
1444+
description: 'Previous code configuration.',
1445+
properties: {
1446+
code: {
1447+
description: 'Previous PIN code.',
1448+
nullable: true,
1449+
type: 'string',
1450+
},
1451+
},
1452+
required: ['code'],
1453+
type: 'object',
1454+
},
1455+
message: {
1456+
description: 'Detailed description of the mutation.',
1457+
type: 'string',
1458+
},
1459+
mutation_code: {
1460+
description:
1461+
'Mutation code to indicate that Seam is in the process of pushing an updated PIN code to the device.',
1462+
enum: ['updating_code'],
1463+
type: 'string',
1464+
},
1465+
to: {
1466+
description: 'New code configuration.',
1467+
properties: {
1468+
code: {
1469+
description: 'New PIN code.',
1470+
nullable: true,
1471+
type: 'string',
1472+
},
1473+
},
1474+
required: ['code'],
1475+
type: 'object',
1476+
},
1477+
},
1478+
required: [
1479+
'created_at',
1480+
'message',
1481+
'mutation_code',
1482+
'from',
1483+
'to',
1484+
],
1485+
type: 'object',
1486+
},
1487+
{
1488+
description:
1489+
'Seam is in the process of pushing an updated access code name to the device.',
1490+
properties: {
1491+
created_at: {
1492+
description:
1493+
'Date and time at which the mutation was created.',
1494+
format: 'date-time',
1495+
type: 'string',
1496+
},
1497+
from: {
1498+
description: 'Previous name configuration.',
1499+
properties: {
1500+
name: {
1501+
description: 'Previous access code name.',
1502+
nullable: true,
1503+
type: 'string',
1504+
},
1505+
},
1506+
required: ['name'],
1507+
type: 'object',
1508+
},
1509+
message: {
1510+
description: 'Detailed description of the mutation.',
1511+
type: 'string',
1512+
},
1513+
mutation_code: {
1514+
description:
1515+
'Mutation code to indicate that Seam is in the process of pushing an updated access code name to the device.',
1516+
enum: ['updating_name'],
1517+
type: 'string',
1518+
},
1519+
to: {
1520+
description: 'New name configuration.',
1521+
properties: {
1522+
name: {
1523+
description: 'New access code name.',
1524+
nullable: true,
1525+
type: 'string',
1526+
},
1527+
},
1528+
required: ['name'],
1529+
type: 'object',
1530+
},
1531+
},
1532+
required: [
1533+
'created_at',
1534+
'message',
1535+
'mutation_code',
1536+
'from',
1537+
'to',
1538+
],
1539+
type: 'object',
1540+
},
1541+
{
1542+
description:
1543+
'Seam is in the process of pushing an updated time frame to the device.',
1544+
properties: {
1545+
created_at: {
1546+
description:
1547+
'Date and time at which the mutation was created.',
1548+
format: 'date-time',
1549+
type: 'string',
1550+
},
1551+
from: {
1552+
description: 'Previous time frame configuration.',
1553+
properties: {
1554+
ends_at: {
1555+
description: 'Previous end time for the access code.',
1556+
format: 'date-time',
1557+
nullable: true,
1558+
type: 'string',
1559+
},
1560+
starts_at: {
1561+
description:
1562+
'Previous start time for the access code.',
1563+
format: 'date-time',
1564+
nullable: true,
1565+
type: 'string',
1566+
},
1567+
},
1568+
required: ['starts_at', 'ends_at'],
1569+
type: 'object',
1570+
},
1571+
message: {
1572+
description: 'Detailed description of the mutation.',
1573+
type: 'string',
1574+
},
1575+
mutation_code: {
1576+
description:
1577+
'Mutation code to indicate that Seam is in the process of pushing updated access code time frame to the device.',
1578+
enum: ['updating_time_frame'],
1579+
type: 'string',
1580+
},
1581+
to: {
1582+
description: 'New time frame configuration.',
1583+
properties: {
1584+
ends_at: {
1585+
description: 'New end time for the access code.',
1586+
format: 'date-time',
1587+
nullable: true,
1588+
type: 'string',
1589+
},
1590+
starts_at: {
1591+
description: 'New start time for the access code.',
1592+
format: 'date-time',
1593+
nullable: true,
1594+
type: 'string',
1595+
},
1596+
},
1597+
required: ['starts_at', 'ends_at'],
1598+
type: 'object',
1599+
},
1600+
},
1601+
required: [
1602+
'created_at',
1603+
'message',
1604+
'mutation_code',
1605+
'from',
1606+
'to',
1607+
],
1608+
type: 'object',
1609+
},
1610+
],
1611+
},
1612+
type: 'array',
1613+
},
13791614
pulled_backup_access_code_id: {
13801615
description:
13811616
'Identifier of the pulled backup access code. Used to associate the pulled backup access code with the original access code.',
@@ -1815,6 +2050,7 @@ export default {
18152050
'is_external_modification_allowed',
18162051
'is_one_time_use',
18172052
'is_offline_access_code',
2053+
'pending_mutations',
18182054
],
18192055
type: 'object',
18202056
'x-route-path': '/access_codes',

0 commit comments

Comments
 (0)