@awarevue/api-types 1.0.68 → 1.0.70
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/dist/access-control/access-rule.d.ts +4 -4
- package/dist/access-control/person-presence.d.ts +4 -4
- package/dist/access-control/person.d.ts +4 -4
- package/dist/agent-communication/protocol.d.ts +14 -14
- package/dist/agent-communication/queries.d.ts +6 -6
- package/dist/alarm-automation.d.ts +67 -0
- package/dist/alarm-automation.js +123 -0
- package/dist/api/media.d.ts +6 -6
- package/dist/automation.d.ts +16 -4
- package/dist/automation.js +1 -0
- package/dist/device/any-device.d.ts +148 -148
- package/dist/device/presence-tracker.d.ts +12 -12
- package/dist/device-event.d.ts +8 -8
- package/dist/device-import.d.ts +12 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/layout.d.ts +2 -2
- package/dist/macros.d.ts +14 -14
- package/dist/messages/device-communication.d.ts +10 -10
- package/dist/package.json +1 -1
- package/dist/view.d.ts +2 -2
- package/package.json +1 -1
|
@@ -85,8 +85,6 @@ export declare const sAccessRuleDto: z.ZodObject<{
|
|
|
85
85
|
id: string;
|
|
86
86
|
version: number;
|
|
87
87
|
displayName: string;
|
|
88
|
-
createdOn: string;
|
|
89
|
-
lastModifiedOn: string;
|
|
90
88
|
appliedTo: {
|
|
91
89
|
id: string;
|
|
92
90
|
firstName: string;
|
|
@@ -101,13 +99,13 @@ export declare const sAccessRuleDto: z.ZodObject<{
|
|
|
101
99
|
scheduleId: string;
|
|
102
100
|
groupId: string;
|
|
103
101
|
}[];
|
|
102
|
+
createdOn: string;
|
|
103
|
+
lastModifiedOn: string;
|
|
104
104
|
refs: Record<string, string | string[]>;
|
|
105
105
|
}, {
|
|
106
106
|
id: string;
|
|
107
107
|
version: number;
|
|
108
108
|
displayName: string;
|
|
109
|
-
createdOn: string;
|
|
110
|
-
lastModifiedOn: string;
|
|
111
109
|
appliedTo: {
|
|
112
110
|
id: string;
|
|
113
111
|
firstName: string;
|
|
@@ -122,6 +120,8 @@ export declare const sAccessRuleDto: z.ZodObject<{
|
|
|
122
120
|
scheduleId: string;
|
|
123
121
|
groupId: string;
|
|
124
122
|
}[];
|
|
123
|
+
createdOn: string;
|
|
124
|
+
lastModifiedOn: string;
|
|
125
125
|
refs: Record<string, string | string[]>;
|
|
126
126
|
}>;
|
|
127
127
|
export type AccessRuleDto = z.infer<typeof sAccessRuleDto>;
|
|
@@ -149,6 +149,7 @@ export declare const sPersonPresenceActionDto: z.ZodObject<{
|
|
|
149
149
|
checkCompleted: z.ZodBoolean;
|
|
150
150
|
}, "strip", z.ZodTypeAny, {
|
|
151
151
|
id: string;
|
|
152
|
+
timestamp: number;
|
|
152
153
|
person: string | {
|
|
153
154
|
id: string;
|
|
154
155
|
firstName: string;
|
|
@@ -161,12 +162,12 @@ export declare const sPersonPresenceActionDto: z.ZodObject<{
|
|
|
161
162
|
displayName: string;
|
|
162
163
|
isGlobal: boolean;
|
|
163
164
|
};
|
|
164
|
-
timestamp: number;
|
|
165
|
-
checkInOrOut: boolean;
|
|
166
165
|
isLeave: boolean;
|
|
166
|
+
checkInOrOut: boolean;
|
|
167
167
|
checkCompleted: boolean;
|
|
168
168
|
}, {
|
|
169
169
|
id: string;
|
|
170
|
+
timestamp: number;
|
|
170
171
|
person: string | {
|
|
171
172
|
id: string;
|
|
172
173
|
firstName: string;
|
|
@@ -179,9 +180,8 @@ export declare const sPersonPresenceActionDto: z.ZodObject<{
|
|
|
179
180
|
displayName: string;
|
|
180
181
|
isGlobal: boolean;
|
|
181
182
|
};
|
|
182
|
-
timestamp: number;
|
|
183
|
-
checkInOrOut: boolean;
|
|
184
183
|
isLeave: boolean;
|
|
184
|
+
checkInOrOut: boolean;
|
|
185
185
|
checkCompleted: boolean;
|
|
186
186
|
}>;
|
|
187
187
|
export type PersonPresenceActionDto = z.infer<typeof sPersonPresenceActionDto>;
|
|
@@ -52,11 +52,11 @@ export declare const sPersonDto: z.ZodObject<{
|
|
|
52
52
|
id: string;
|
|
53
53
|
position: string | null;
|
|
54
54
|
version: number;
|
|
55
|
-
createdOn: string;
|
|
56
|
-
lastModifiedOn: string;
|
|
57
55
|
firstName: string;
|
|
58
56
|
lastName: string;
|
|
59
57
|
avatarId: string | null;
|
|
58
|
+
createdOn: string;
|
|
59
|
+
lastModifiedOn: string;
|
|
60
60
|
refs: Record<string, string | string[]>;
|
|
61
61
|
validFrom: string | null;
|
|
62
62
|
validTo: string | null;
|
|
@@ -77,11 +77,11 @@ export declare const sPersonDto: z.ZodObject<{
|
|
|
77
77
|
id: string;
|
|
78
78
|
position: string | null;
|
|
79
79
|
version: number;
|
|
80
|
-
createdOn: string;
|
|
81
|
-
lastModifiedOn: string;
|
|
82
80
|
firstName: string;
|
|
83
81
|
lastName: string;
|
|
84
82
|
avatarId: string | null;
|
|
83
|
+
createdOn: string;
|
|
84
|
+
lastModifiedOn: string;
|
|
85
85
|
refs: Record<string, string | string[]>;
|
|
86
86
|
validFrom: string | null;
|
|
87
87
|
validTo: string | null;
|
|
@@ -235,7 +235,7 @@ export declare const sAccessControlCapabilityReport: z.ZodObject<{
|
|
|
235
235
|
formatDescription?: string | undefined;
|
|
236
236
|
maxPerPerson?: number | undefined;
|
|
237
237
|
}[];
|
|
238
|
-
accessObjects: ("
|
|
238
|
+
accessObjects: ("accessRule" | "schedule" | "person" | "device" | "zone")[];
|
|
239
239
|
oneSchedulePerDoor: boolean;
|
|
240
240
|
}, {
|
|
241
241
|
tokens: {
|
|
@@ -244,7 +244,7 @@ export declare const sAccessControlCapabilityReport: z.ZodObject<{
|
|
|
244
244
|
formatDescription?: string | undefined;
|
|
245
245
|
maxPerPerson?: number | undefined;
|
|
246
246
|
}[];
|
|
247
|
-
accessObjects: ("
|
|
247
|
+
accessObjects: ("accessRule" | "schedule" | "person" | "device" | "zone")[];
|
|
248
248
|
oneSchedulePerDoor: boolean;
|
|
249
249
|
}>;
|
|
250
250
|
export declare const sRegisterRq: z.ZodObject<{
|
|
@@ -341,7 +341,7 @@ export declare const sRegisterRq: z.ZodObject<{
|
|
|
341
341
|
formatDescription?: string | undefined;
|
|
342
342
|
maxPerPerson?: number | undefined;
|
|
343
343
|
}[];
|
|
344
|
-
accessObjects: ("
|
|
344
|
+
accessObjects: ("accessRule" | "schedule" | "person" | "device" | "zone")[];
|
|
345
345
|
oneSchedulePerDoor: boolean;
|
|
346
346
|
}, {
|
|
347
347
|
tokens: {
|
|
@@ -350,7 +350,7 @@ export declare const sRegisterRq: z.ZodObject<{
|
|
|
350
350
|
formatDescription?: string | undefined;
|
|
351
351
|
maxPerPerson?: number | undefined;
|
|
352
352
|
}[];
|
|
353
|
-
accessObjects: ("
|
|
353
|
+
accessObjects: ("accessRule" | "schedule" | "person" | "device" | "zone")[];
|
|
354
354
|
oneSchedulePerDoor: boolean;
|
|
355
355
|
}>>>;
|
|
356
356
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -378,7 +378,7 @@ export declare const sRegisterRq: z.ZodObject<{
|
|
|
378
378
|
formatDescription?: string | undefined;
|
|
379
379
|
maxPerPerson?: number | undefined;
|
|
380
380
|
}[];
|
|
381
|
-
accessObjects: ("
|
|
381
|
+
accessObjects: ("accessRule" | "schedule" | "person" | "device" | "zone")[];
|
|
382
382
|
oneSchedulePerDoor: boolean;
|
|
383
383
|
}> | undefined;
|
|
384
384
|
}, {
|
|
@@ -406,7 +406,7 @@ export declare const sRegisterRq: z.ZodObject<{
|
|
|
406
406
|
formatDescription?: string | undefined;
|
|
407
407
|
maxPerPerson?: number | undefined;
|
|
408
408
|
}[];
|
|
409
|
-
accessObjects: ("
|
|
409
|
+
accessObjects: ("accessRule" | "schedule" | "person" | "device" | "zone")[];
|
|
410
410
|
oneSchedulePerDoor: boolean;
|
|
411
411
|
}> | undefined;
|
|
412
412
|
}>;
|
|
@@ -559,7 +559,6 @@ export declare const sRunCommandRq: z.ZodObject<{
|
|
|
559
559
|
batchId: z.ZodOptional<z.ZodString>;
|
|
560
560
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
561
561
|
}, "strip", z.ZodTypeAny, {
|
|
562
|
-
command: string;
|
|
563
562
|
kind: "command";
|
|
564
563
|
device: {
|
|
565
564
|
name: string;
|
|
@@ -569,10 +568,10 @@ export declare const sRunCommandRq: z.ZodObject<{
|
|
|
569
568
|
[k: string]: unknown;
|
|
570
569
|
};
|
|
571
570
|
};
|
|
571
|
+
command: string;
|
|
572
572
|
params?: Record<string, unknown> | undefined;
|
|
573
573
|
batchId?: string | undefined;
|
|
574
574
|
}, {
|
|
575
|
-
command: string;
|
|
576
575
|
kind: "command";
|
|
577
576
|
device: {
|
|
578
577
|
name: string;
|
|
@@ -582,6 +581,7 @@ export declare const sRunCommandRq: z.ZodObject<{
|
|
|
582
581
|
[k: string]: unknown;
|
|
583
582
|
};
|
|
584
583
|
};
|
|
584
|
+
command: string;
|
|
585
585
|
params?: Record<string, unknown> | undefined;
|
|
586
586
|
batchId?: string | undefined;
|
|
587
587
|
}>;
|
|
@@ -6301,14 +6301,14 @@ export declare const sChangeIssue: z.ZodObject<{
|
|
|
6301
6301
|
code?: "BAD_REFERENCE" | "NOT_FOUND" | "NOT_UNIQUE" | "INVALID" | "NOT_SUPPORTED" | undefined;
|
|
6302
6302
|
message?: string | undefined;
|
|
6303
6303
|
path?: string | undefined;
|
|
6304
|
-
objectKind?: "
|
|
6304
|
+
objectKind?: "accessRule" | "schedule" | "person" | "device" | "zone" | undefined;
|
|
6305
6305
|
objectId?: string | undefined;
|
|
6306
6306
|
}, {
|
|
6307
6307
|
index?: number | undefined;
|
|
6308
6308
|
code?: "BAD_REFERENCE" | "NOT_FOUND" | "NOT_UNIQUE" | "INVALID" | "NOT_SUPPORTED" | undefined;
|
|
6309
6309
|
message?: string | undefined;
|
|
6310
6310
|
path?: string | undefined;
|
|
6311
|
-
objectKind?: "
|
|
6311
|
+
objectKind?: "accessRule" | "schedule" | "person" | "device" | "zone" | undefined;
|
|
6312
6312
|
objectId?: string | undefined;
|
|
6313
6313
|
}>;
|
|
6314
6314
|
export declare const sValidateChangeRs: z.ZodIntersection<z.ZodObject<{
|
|
@@ -6333,14 +6333,14 @@ export declare const sValidateChangeRs: z.ZodIntersection<z.ZodObject<{
|
|
|
6333
6333
|
code?: "BAD_REFERENCE" | "NOT_FOUND" | "NOT_UNIQUE" | "INVALID" | "NOT_SUPPORTED" | undefined;
|
|
6334
6334
|
message?: string | undefined;
|
|
6335
6335
|
path?: string | undefined;
|
|
6336
|
-
objectKind?: "
|
|
6336
|
+
objectKind?: "accessRule" | "schedule" | "person" | "device" | "zone" | undefined;
|
|
6337
6337
|
objectId?: string | undefined;
|
|
6338
6338
|
}, {
|
|
6339
6339
|
index?: number | undefined;
|
|
6340
6340
|
code?: "BAD_REFERENCE" | "NOT_FOUND" | "NOT_UNIQUE" | "INVALID" | "NOT_SUPPORTED" | undefined;
|
|
6341
6341
|
message?: string | undefined;
|
|
6342
6342
|
path?: string | undefined;
|
|
6343
|
-
objectKind?: "
|
|
6343
|
+
objectKind?: "accessRule" | "schedule" | "person" | "device" | "zone" | undefined;
|
|
6344
6344
|
objectId?: string | undefined;
|
|
6345
6345
|
}>, "many">;
|
|
6346
6346
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
@@ -6349,7 +6349,7 @@ export declare const sValidateChangeRs: z.ZodIntersection<z.ZodObject<{
|
|
|
6349
6349
|
code?: "BAD_REFERENCE" | "NOT_FOUND" | "NOT_UNIQUE" | "INVALID" | "NOT_SUPPORTED" | undefined;
|
|
6350
6350
|
message?: string | undefined;
|
|
6351
6351
|
path?: string | undefined;
|
|
6352
|
-
objectKind?: "
|
|
6352
|
+
objectKind?: "accessRule" | "schedule" | "person" | "device" | "zone" | undefined;
|
|
6353
6353
|
objectId?: string | undefined;
|
|
6354
6354
|
}[];
|
|
6355
6355
|
}, {
|
|
@@ -6358,7 +6358,7 @@ export declare const sValidateChangeRs: z.ZodIntersection<z.ZodObject<{
|
|
|
6358
6358
|
code?: "BAD_REFERENCE" | "NOT_FOUND" | "NOT_UNIQUE" | "INVALID" | "NOT_SUPPORTED" | undefined;
|
|
6359
6359
|
message?: string | undefined;
|
|
6360
6360
|
path?: string | undefined;
|
|
6361
|
-
objectKind?: "
|
|
6361
|
+
objectKind?: "accessRule" | "schedule" | "person" | "device" | "zone" | undefined;
|
|
6362
6362
|
objectId?: string | undefined;
|
|
6363
6363
|
}[];
|
|
6364
6364
|
}>>;
|
|
@@ -112,18 +112,18 @@ export declare const sMediaSearchMatch: z.ZodObject<{
|
|
|
112
112
|
}, "strip", z.ZodTypeAny, {
|
|
113
113
|
endTime: number | null;
|
|
114
114
|
startTime: number;
|
|
115
|
+
providerAssignedRef: string;
|
|
115
116
|
objectKind: string;
|
|
116
117
|
probability: number;
|
|
117
|
-
providerAssignedRef: string;
|
|
118
118
|
foreignRef: string;
|
|
119
119
|
provider: string;
|
|
120
120
|
relevance: number;
|
|
121
121
|
}, {
|
|
122
122
|
endTime: number | null;
|
|
123
123
|
startTime: number;
|
|
124
|
+
providerAssignedRef: string;
|
|
124
125
|
objectKind: string;
|
|
125
126
|
probability: number;
|
|
126
|
-
providerAssignedRef: string;
|
|
127
127
|
foreignRef: string;
|
|
128
128
|
provider: string;
|
|
129
129
|
relevance: number;
|
|
@@ -140,18 +140,18 @@ export declare const sMediaSearchResponse: z.ZodArray<z.ZodObject<{
|
|
|
140
140
|
}, "strip", z.ZodTypeAny, {
|
|
141
141
|
endTime: number | null;
|
|
142
142
|
startTime: number;
|
|
143
|
+
providerAssignedRef: string;
|
|
143
144
|
objectKind: string;
|
|
144
145
|
probability: number;
|
|
145
|
-
providerAssignedRef: string;
|
|
146
146
|
foreignRef: string;
|
|
147
147
|
provider: string;
|
|
148
148
|
relevance: number;
|
|
149
149
|
}, {
|
|
150
150
|
endTime: number | null;
|
|
151
151
|
startTime: number;
|
|
152
|
+
providerAssignedRef: string;
|
|
152
153
|
objectKind: string;
|
|
153
154
|
probability: number;
|
|
154
|
-
providerAssignedRef: string;
|
|
155
155
|
foreignRef: string;
|
|
156
156
|
provider: string;
|
|
157
157
|
relevance: number;
|
|
@@ -317,18 +317,18 @@ export declare const responseSchemasByType: {
|
|
|
317
317
|
}, "strip", z.ZodTypeAny, {
|
|
318
318
|
endTime: number | null;
|
|
319
319
|
startTime: number;
|
|
320
|
+
providerAssignedRef: string;
|
|
320
321
|
objectKind: string;
|
|
321
322
|
probability: number;
|
|
322
|
-
providerAssignedRef: string;
|
|
323
323
|
foreignRef: string;
|
|
324
324
|
provider: string;
|
|
325
325
|
relevance: number;
|
|
326
326
|
}, {
|
|
327
327
|
endTime: number | null;
|
|
328
328
|
startTime: number;
|
|
329
|
+
providerAssignedRef: string;
|
|
329
330
|
objectKind: string;
|
|
330
331
|
probability: number;
|
|
331
|
-
providerAssignedRef: string;
|
|
332
332
|
foreignRef: string;
|
|
333
333
|
provider: string;
|
|
334
334
|
relevance: number;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DeviceEvent } from './device-event';
|
|
3
|
+
import { DeviceType } from './device';
|
|
4
|
+
import { AutomationRuleBody } from './automation';
|
|
5
|
+
export declare const sAlarmBehavior: z.ZodEnum<["ignore", "trigger-always", "trigger-when-armed"]>;
|
|
6
|
+
export declare const sAlarmAutomationLevel: z.ZodEnum<["by-device", "by-type"]>;
|
|
7
|
+
export declare const sAlarmAutomationCriteria: z.ZodObject<{
|
|
8
|
+
field: z.ZodString;
|
|
9
|
+
value: z.ZodUnknown;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
field: string;
|
|
12
|
+
value?: unknown;
|
|
13
|
+
}, {
|
|
14
|
+
field: string;
|
|
15
|
+
value?: unknown;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const sAlarmAutomationMetadata: z.ZodObject<{
|
|
18
|
+
behavior: z.ZodEnum<["ignore", "trigger-always", "trigger-when-armed"]>;
|
|
19
|
+
level: z.ZodEnum<["by-device", "by-type"]>;
|
|
20
|
+
eventKind: z.ZodOptional<z.ZodString>;
|
|
21
|
+
eventCriteria: z.ZodArray<z.ZodObject<{
|
|
22
|
+
field: z.ZodString;
|
|
23
|
+
value: z.ZodUnknown;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
field: string;
|
|
26
|
+
value?: unknown;
|
|
27
|
+
}, {
|
|
28
|
+
field: string;
|
|
29
|
+
value?: unknown;
|
|
30
|
+
}>, "many">;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
behavior: "ignore" | "trigger-always" | "trigger-when-armed";
|
|
33
|
+
level: "by-device" | "by-type";
|
|
34
|
+
eventCriteria: {
|
|
35
|
+
field: string;
|
|
36
|
+
value?: unknown;
|
|
37
|
+
}[];
|
|
38
|
+
eventKind?: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
behavior: "ignore" | "trigger-always" | "trigger-when-armed";
|
|
41
|
+
level: "by-device" | "by-type";
|
|
42
|
+
eventCriteria: {
|
|
43
|
+
field: string;
|
|
44
|
+
value?: unknown;
|
|
45
|
+
}[];
|
|
46
|
+
eventKind?: string | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
export type AlarmBehavior = z.infer<typeof sAlarmBehavior>;
|
|
49
|
+
export type AlarmAutomationLevel = z.infer<typeof sAlarmAutomationLevel>;
|
|
50
|
+
export type AlarmAutomationMetadata = z.infer<typeof sAlarmAutomationMetadata>;
|
|
51
|
+
export declare const isAlarmAutomationMetadata: (metadata: unknown) => metadata is AlarmAutomationMetadata;
|
|
52
|
+
export declare const formatByDeviceAutomationCode: (deviceId: string) => string;
|
|
53
|
+
export declare const formatByTypeAutomationCode: (eventKind: DeviceEvent["kind"]) => string;
|
|
54
|
+
export declare const isByDeviceAutomationCode: (code: string) => boolean;
|
|
55
|
+
export declare const isByTypeAutomationCode: (code: string) => boolean;
|
|
56
|
+
export type ParsedByDeviceAutomationCode = {
|
|
57
|
+
type: 'by-device';
|
|
58
|
+
value: string;
|
|
59
|
+
};
|
|
60
|
+
export type ParsedByTypeAutomationCode = {
|
|
61
|
+
type: 'by-type';
|
|
62
|
+
value: DeviceEvent['kind'];
|
|
63
|
+
};
|
|
64
|
+
export type ParsedAlarmAutomationCode = ParsedByDeviceAutomationCode | ParsedByTypeAutomationCode;
|
|
65
|
+
export declare const parseAlarmAutomationCode: (code: string) => ParsedAlarmAutomationCode | null;
|
|
66
|
+
export declare const createAlarmRuleBody: (eventKind: DeviceEvent["kind"], behavior: AlarmBehavior, deviceType: DeviceType, eventCriteria: AlarmAutomationMetadata["eventCriteria"], deviceId?: string) => AutomationRuleBody;
|
|
67
|
+
export declare const resolveAlarmExclusivityGroup: (deviceType: DeviceType) => string;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveAlarmExclusivityGroup = exports.createAlarmRuleBody = exports.parseAlarmAutomationCode = exports.isByTypeAutomationCode = exports.isByDeviceAutomationCode = exports.formatByTypeAutomationCode = exports.formatByDeviceAutomationCode = exports.isAlarmAutomationMetadata = exports.sAlarmAutomationMetadata = exports.sAlarmAutomationCriteria = exports.sAlarmAutomationLevel = exports.sAlarmBehavior = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.sAlarmBehavior = zod_1.z.enum([
|
|
6
|
+
'ignore',
|
|
7
|
+
'trigger-always',
|
|
8
|
+
'trigger-when-armed',
|
|
9
|
+
]);
|
|
10
|
+
exports.sAlarmAutomationLevel = zod_1.z.enum(['by-device', 'by-type']);
|
|
11
|
+
exports.sAlarmAutomationCriteria = zod_1.z.object({
|
|
12
|
+
field: zod_1.z.string().describe('The field to match'),
|
|
13
|
+
value: zod_1.z.unknown().describe('The value to match'),
|
|
14
|
+
});
|
|
15
|
+
exports.sAlarmAutomationMetadata = zod_1.z.object({
|
|
16
|
+
behavior: exports.sAlarmBehavior,
|
|
17
|
+
level: exports.sAlarmAutomationLevel,
|
|
18
|
+
eventKind: zod_1.z.string().optional().describe('The kind of event to match'),
|
|
19
|
+
eventCriteria: zod_1.z.array(exports.sAlarmAutomationCriteria),
|
|
20
|
+
});
|
|
21
|
+
const isAlarmAutomationMetadata = (metadata) => {
|
|
22
|
+
if (typeof metadata !== 'object' || metadata === null) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const parsed = exports.sAlarmAutomationMetadata.safeParse(metadata);
|
|
26
|
+
return parsed.success;
|
|
27
|
+
};
|
|
28
|
+
exports.isAlarmAutomationMetadata = isAlarmAutomationMetadata;
|
|
29
|
+
// Alarm assigns automation rules with code that is either:
|
|
30
|
+
// [by-event]:[event-kind]
|
|
31
|
+
// [by-device]:[device-id]
|
|
32
|
+
const formatByDeviceAutomationCode = (deviceId) => {
|
|
33
|
+
return `by-device:${deviceId}`;
|
|
34
|
+
};
|
|
35
|
+
exports.formatByDeviceAutomationCode = formatByDeviceAutomationCode;
|
|
36
|
+
const formatByTypeAutomationCode = (eventKind) => {
|
|
37
|
+
return `by-Type:${eventKind}`;
|
|
38
|
+
};
|
|
39
|
+
exports.formatByTypeAutomationCode = formatByTypeAutomationCode;
|
|
40
|
+
const isByDeviceAutomationCode = (code) => {
|
|
41
|
+
return code.startsWith('by-device:');
|
|
42
|
+
};
|
|
43
|
+
exports.isByDeviceAutomationCode = isByDeviceAutomationCode;
|
|
44
|
+
const isByTypeAutomationCode = (code) => {
|
|
45
|
+
return code.startsWith('by-type:');
|
|
46
|
+
};
|
|
47
|
+
exports.isByTypeAutomationCode = isByTypeAutomationCode;
|
|
48
|
+
const parseAlarmAutomationCode = (code) => {
|
|
49
|
+
if ((0, exports.isByDeviceAutomationCode)(code)) {
|
|
50
|
+
return {
|
|
51
|
+
type: 'by-device',
|
|
52
|
+
value: code.replace('by-device:', ''),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if ((0, exports.isByTypeAutomationCode)(code)) {
|
|
56
|
+
return {
|
|
57
|
+
type: 'by-type',
|
|
58
|
+
value: code.replace('by-type:', ''),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
exports.parseAlarmAutomationCode = parseAlarmAutomationCode;
|
|
64
|
+
// {
|
|
65
|
+
// "displayName": "Trigger alarm on force-open door events",
|
|
66
|
+
// "enabled": true,
|
|
67
|
+
// "body": {
|
|
68
|
+
// "onEvent": "door-force",
|
|
69
|
+
// "commands": [
|
|
70
|
+
// {
|
|
71
|
+
// "command": "alarm.set-trigger",
|
|
72
|
+
// "target": "target.type ==\"alarm\"",
|
|
73
|
+
// "params": {
|
|
74
|
+
// "event": "{{event}}",
|
|
75
|
+
// "onlyIfArmed": "{{device.provider ==\"paxton\"}}"
|
|
76
|
+
// }
|
|
77
|
+
// }
|
|
78
|
+
// ]
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
const encodeComparison = (value) => {
|
|
82
|
+
if (typeof value === 'string') {
|
|
83
|
+
return `== ${JSON.stringify(value)}`;
|
|
84
|
+
}
|
|
85
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
86
|
+
return `== ${String(value)}`;
|
|
87
|
+
}
|
|
88
|
+
if (Array.isArray(value)) {
|
|
89
|
+
return `in (${value.map(encodeComparison).join(', ')})`;
|
|
90
|
+
}
|
|
91
|
+
if (value === null) {
|
|
92
|
+
return '== null';
|
|
93
|
+
}
|
|
94
|
+
throw new Error(`Unsupported value type for comparison: ${typeof value}`);
|
|
95
|
+
};
|
|
96
|
+
const createAlarmRuleBody = (eventKind, behavior, deviceType, eventCriteria, deviceId) => {
|
|
97
|
+
let runIf = 'device.type == "' + deviceType + '"';
|
|
98
|
+
if (deviceId) {
|
|
99
|
+
runIf += ` && device.id == "${deviceId}"`;
|
|
100
|
+
}
|
|
101
|
+
for (const criterion of eventCriteria) {
|
|
102
|
+
runIf += ` && event.${criterion.field} ${encodeComparison(criterion.value)}`;
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
onEvent: eventKind,
|
|
106
|
+
runIf,
|
|
107
|
+
commands: behavior === 'ignore'
|
|
108
|
+
? []
|
|
109
|
+
: [
|
|
110
|
+
{
|
|
111
|
+
command: 'alarm.set-trigger',
|
|
112
|
+
target: 'target.type =="alarm"',
|
|
113
|
+
params: {
|
|
114
|
+
event: '{{event}}',
|
|
115
|
+
onlyIfArmed: behavior === 'trigger-when-armed',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
exports.createAlarmRuleBody = createAlarmRuleBody;
|
|
122
|
+
const resolveAlarmExclusivityGroup = (deviceType) => `alarm-${deviceType}`;
|
|
123
|
+
exports.resolveAlarmExclusivityGroup = resolveAlarmExclusivityGroup;
|
package/dist/api/media.d.ts
CHANGED
|
@@ -80,11 +80,11 @@ export declare const sGetScenePreviewClipRequest: z.ZodObject<{
|
|
|
80
80
|
deviceId: z.ZodString;
|
|
81
81
|
providerAssignedRef: z.ZodString;
|
|
82
82
|
}, "strip", z.ZodTypeAny, {
|
|
83
|
-
providerAssignedRef: string;
|
|
84
83
|
deviceId: string;
|
|
85
|
-
}, {
|
|
86
84
|
providerAssignedRef: string;
|
|
85
|
+
}, {
|
|
87
86
|
deviceId: string;
|
|
87
|
+
providerAssignedRef: string;
|
|
88
88
|
}>;
|
|
89
89
|
export declare const sGetObjectSnapshotRequest: z.ZodObject<{
|
|
90
90
|
deviceId: z.ZodString;
|
|
@@ -94,15 +94,15 @@ export declare const sGetObjectSnapshotRequest: z.ZodObject<{
|
|
|
94
94
|
height: z.ZodOptional<z.ZodNumber>;
|
|
95
95
|
quality: z.ZodOptional<z.ZodNumber>;
|
|
96
96
|
}, "strip", z.ZodTypeAny, {
|
|
97
|
-
providerAssignedRef: string;
|
|
98
97
|
deviceId: string;
|
|
98
|
+
providerAssignedRef: string;
|
|
99
99
|
crop: boolean;
|
|
100
100
|
boxes: boolean;
|
|
101
101
|
height?: number | undefined;
|
|
102
102
|
quality?: number | undefined;
|
|
103
103
|
}, {
|
|
104
|
-
providerAssignedRef: string;
|
|
105
104
|
deviceId: string;
|
|
105
|
+
providerAssignedRef: string;
|
|
106
106
|
crop: boolean;
|
|
107
107
|
boxes: boolean;
|
|
108
108
|
height?: number | undefined;
|
|
@@ -112,11 +112,11 @@ export declare const sGetObjectThumbnailRequest: z.ZodObject<{
|
|
|
112
112
|
deviceId: z.ZodString;
|
|
113
113
|
providerAssignedRef: z.ZodString;
|
|
114
114
|
}, "strip", z.ZodTypeAny, {
|
|
115
|
-
providerAssignedRef: string;
|
|
116
115
|
deviceId: string;
|
|
117
|
-
}, {
|
|
118
116
|
providerAssignedRef: string;
|
|
117
|
+
}, {
|
|
119
118
|
deviceId: string;
|
|
119
|
+
providerAssignedRef: string;
|
|
120
120
|
}>;
|
|
121
121
|
export declare const sGetExportLinkResponse: z.ZodObject<{
|
|
122
122
|
relativeUrl: z.ZodString;
|
package/dist/automation.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export declare const sAutomationRuleProps: z.ZodObject<{
|
|
|
86
86
|
exclusivityGroup: z.ZodNullable<z.ZodString>;
|
|
87
87
|
score: z.ZodNullable<z.ZodNumber>;
|
|
88
88
|
module: z.ZodNullable<z.ZodString>;
|
|
89
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
89
90
|
}, "strip", z.ZodTypeAny, {
|
|
90
91
|
code: string | null;
|
|
91
92
|
module: string | null;
|
|
@@ -98,6 +99,7 @@ export declare const sAutomationRuleProps: z.ZodObject<{
|
|
|
98
99
|
}[];
|
|
99
100
|
runIf?: string | undefined;
|
|
100
101
|
};
|
|
102
|
+
metadata: Record<string, unknown>;
|
|
101
103
|
displayName: string;
|
|
102
104
|
enabled: boolean;
|
|
103
105
|
exclusivityGroup: string | null;
|
|
@@ -115,6 +117,7 @@ export declare const sAutomationRuleProps: z.ZodObject<{
|
|
|
115
117
|
}[];
|
|
116
118
|
runIf?: string | undefined;
|
|
117
119
|
};
|
|
120
|
+
metadata: Record<string, unknown>;
|
|
118
121
|
displayName: string;
|
|
119
122
|
enabled: boolean;
|
|
120
123
|
exclusivityGroup: string | null;
|
|
@@ -162,6 +165,7 @@ export declare const sAddAutomationRuleRequest: z.ZodObject<{
|
|
|
162
165
|
exclusivityGroup: z.ZodNullable<z.ZodString>;
|
|
163
166
|
score: z.ZodNullable<z.ZodNumber>;
|
|
164
167
|
module: z.ZodNullable<z.ZodString>;
|
|
168
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
165
169
|
}, "strip", z.ZodTypeAny, {
|
|
166
170
|
code: string | null;
|
|
167
171
|
module: string | null;
|
|
@@ -174,6 +178,7 @@ export declare const sAddAutomationRuleRequest: z.ZodObject<{
|
|
|
174
178
|
}[];
|
|
175
179
|
runIf?: string | undefined;
|
|
176
180
|
};
|
|
181
|
+
metadata: Record<string, unknown>;
|
|
177
182
|
displayName: string;
|
|
178
183
|
enabled: boolean;
|
|
179
184
|
exclusivityGroup: string | null;
|
|
@@ -191,6 +196,7 @@ export declare const sAddAutomationRuleRequest: z.ZodObject<{
|
|
|
191
196
|
}[];
|
|
192
197
|
runIf?: string | undefined;
|
|
193
198
|
};
|
|
199
|
+
metadata: Record<string, unknown>;
|
|
194
200
|
displayName: string;
|
|
195
201
|
enabled: boolean;
|
|
196
202
|
exclusivityGroup: string | null;
|
|
@@ -238,6 +244,7 @@ export declare const sUpdateAutomationRule: z.ZodObject<{
|
|
|
238
244
|
exclusivityGroup: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
245
|
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
240
246
|
module: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
247
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
241
248
|
} & {
|
|
242
249
|
id: z.ZodString;
|
|
243
250
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -253,6 +260,7 @@ export declare const sUpdateAutomationRule: z.ZodObject<{
|
|
|
253
260
|
}[];
|
|
254
261
|
runIf?: string | undefined;
|
|
255
262
|
} | undefined;
|
|
263
|
+
metadata?: Record<string, unknown> | undefined;
|
|
256
264
|
description?: string | undefined;
|
|
257
265
|
displayName?: string | undefined;
|
|
258
266
|
enabled?: boolean | undefined;
|
|
@@ -271,6 +279,7 @@ export declare const sUpdateAutomationRule: z.ZodObject<{
|
|
|
271
279
|
}[];
|
|
272
280
|
runIf?: string | undefined;
|
|
273
281
|
} | undefined;
|
|
282
|
+
metadata?: Record<string, unknown> | undefined;
|
|
274
283
|
description?: string | undefined;
|
|
275
284
|
displayName?: string | undefined;
|
|
276
285
|
enabled?: boolean | undefined;
|
|
@@ -318,6 +327,7 @@ export declare const sAutomationRuleDto: z.ZodObject<{
|
|
|
318
327
|
exclusivityGroup: z.ZodNullable<z.ZodString>;
|
|
319
328
|
score: z.ZodNullable<z.ZodNumber>;
|
|
320
329
|
module: z.ZodNullable<z.ZodString>;
|
|
330
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
321
331
|
} & {
|
|
322
332
|
id: z.ZodString;
|
|
323
333
|
createdOn: z.ZodString;
|
|
@@ -335,12 +345,13 @@ export declare const sAutomationRuleDto: z.ZodObject<{
|
|
|
335
345
|
}[];
|
|
336
346
|
runIf?: string | undefined;
|
|
337
347
|
};
|
|
348
|
+
metadata: Record<string, unknown>;
|
|
338
349
|
displayName: string;
|
|
350
|
+
createdOn: string;
|
|
351
|
+
lastModifiedOn: string;
|
|
339
352
|
enabled: boolean;
|
|
340
353
|
exclusivityGroup: string | null;
|
|
341
354
|
score: number | null;
|
|
342
|
-
createdOn: string;
|
|
343
|
-
lastModifiedOn: string;
|
|
344
355
|
description?: string | undefined;
|
|
345
356
|
}, {
|
|
346
357
|
code: string | null;
|
|
@@ -355,12 +366,13 @@ export declare const sAutomationRuleDto: z.ZodObject<{
|
|
|
355
366
|
}[];
|
|
356
367
|
runIf?: string | undefined;
|
|
357
368
|
};
|
|
369
|
+
metadata: Record<string, unknown>;
|
|
358
370
|
displayName: string;
|
|
371
|
+
createdOn: string;
|
|
372
|
+
lastModifiedOn: string;
|
|
359
373
|
enabled: boolean;
|
|
360
374
|
exclusivityGroup: string | null;
|
|
361
375
|
score: number | null;
|
|
362
|
-
createdOn: string;
|
|
363
|
-
lastModifiedOn: string;
|
|
364
376
|
description?: string | undefined;
|
|
365
377
|
}>;
|
|
366
378
|
export type AutomationRuleBody = z.infer<typeof sAutomationRuleBody>;
|
package/dist/automation.js
CHANGED
|
@@ -43,6 +43,7 @@ exports.sAutomationRuleProps = zod_1.z.object({
|
|
|
43
43
|
.string()
|
|
44
44
|
.nullable()
|
|
45
45
|
.describe('The module the automation rule belongs to'),
|
|
46
|
+
metadata: zod_1.z.record(zod_1.z.unknown()),
|
|
46
47
|
});
|
|
47
48
|
exports.sAddAutomationRuleRequest = exports.sAutomationRuleProps;
|
|
48
49
|
exports.sUpdateAutomationRule = exports.sAutomationRuleProps.partial().merge(zod_1.z.object({
|