@awarevue/api-types 1.0.1
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 +243 -0
- package/dist/access-control/access-rule.js +49 -0
- package/dist/access-control/credential.d.ts +14 -0
- package/dist/access-control/credential.js +12 -0
- package/dist/access-control/index.d.ts +7 -0
- package/dist/access-control/index.js +23 -0
- package/dist/access-control/person-presence.d.ts +249 -0
- package/dist/access-control/person-presence.js +61 -0
- package/dist/access-control/person.d.ts +209 -0
- package/dist/access-control/person.js +49 -0
- package/dist/access-control/schedule.d.ts +500 -0
- package/dist/access-control/schedule.js +65 -0
- package/dist/access-control/sync.d.ts +3 -0
- package/dist/access-control/sync.js +2 -0
- package/dist/access-control/zone.d.ts +65 -0
- package/dist/access-control/zone.js +28 -0
- package/dist/agent-communication/index.d.ts +1 -0
- package/dist/agent-communication/index.js +17 -0
- package/dist/agent-communication/protocol.d.ts +1692 -0
- package/dist/agent-communication/protocol.js +341 -0
- package/dist/api/alarm.d.ts +23 -0
- package/dist/api/alarm.js +2 -0
- package/dist/api/auth.d.ts +31 -0
- package/dist/api/auth.js +19 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +20 -0
- package/dist/api/media.d.ts +187 -0
- package/dist/api/media.js +59 -0
- package/dist/api/query.d.ts +33 -0
- package/dist/api/query.js +41 -0
- package/dist/app.d.ts +12 -0
- package/dist/app.js +8 -0
- package/dist/automation.d.ts +334 -0
- package/dist/automation.js +49 -0
- package/dist/aware-config.d.ts +3 -0
- package/dist/aware-config.js +2 -0
- package/dist/custom-field.d.ts +52 -0
- package/dist/custom-field.js +19 -0
- package/dist/device/alarm.d.ts +265 -0
- package/dist/device/alarm.js +66 -0
- package/dist/device/any-device.d.ts +2376 -0
- package/dist/device/any-device.js +185 -0
- package/dist/device/camera-lift.d.ts +17 -0
- package/dist/device/camera-lift.js +7 -0
- package/dist/device/camera.d.ts +829 -0
- package/dist/device/camera.js +120 -0
- package/dist/device/device-gateway.d.ts +3 -0
- package/dist/device/device-gateway.js +4 -0
- package/dist/device/door.d.ts +217 -0
- package/dist/device/door.js +57 -0
- package/dist/device/index.d.ts +15 -0
- package/dist/device/index.js +31 -0
- package/dist/device/intercom-operator.d.ts +13 -0
- package/dist/device/intercom-operator.js +5 -0
- package/dist/device/intercom-terminal.d.ts +244 -0
- package/dist/device/intercom-terminal.js +48 -0
- package/dist/device/io-board.d.ts +55 -0
- package/dist/device/io-board.js +19 -0
- package/dist/device/motion-sensor.d.ts +8 -0
- package/dist/device/motion-sensor.js +8 -0
- package/dist/device/panic-button.d.ts +26 -0
- package/dist/device/panic-button.js +14 -0
- package/dist/device/pbx.d.ts +20 -0
- package/dist/device/pbx.js +11 -0
- package/dist/device/presence-tracker.d.ts +127 -0
- package/dist/device/presence-tracker.js +27 -0
- package/dist/device/reader/commands.d.ts +1 -0
- package/dist/device/reader/commands.js +2 -0
- package/dist/device/reader/events.d.ts +37 -0
- package/dist/device/reader/events.js +13 -0
- package/dist/device/reader/index.d.ts +3 -0
- package/dist/device/reader/index.js +19 -0
- package/dist/device/reader/specs.d.ts +2 -0
- package/dist/device/reader/specs.js +4 -0
- package/dist/device/server.d.ts +73 -0
- package/dist/device/server.js +33 -0
- package/dist/device-command.d.ts +23 -0
- package/dist/device-command.js +110 -0
- package/dist/device-event.d.ts +682 -0
- package/dist/device-event.js +87 -0
- package/dist/device-factory.d.ts +112 -0
- package/dist/device-factory.js +25 -0
- package/dist/device-group.d.ts +74 -0
- package/dist/device-group.js +31 -0
- package/dist/device-import.d.ts +1412 -0
- package/dist/device-import.js +33 -0
- package/dist/device-relation.d.ts +30 -0
- package/dist/device-relation.js +68 -0
- package/dist/device-state.d.ts +10 -0
- package/dist/device-state.js +2 -0
- package/dist/error.d.ts +13 -0
- package/dist/error.js +10 -0
- package/dist/file.d.ts +3 -0
- package/dist/file.js +2 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +44 -0
- package/dist/layout.d.ts +188 -0
- package/dist/layout.js +40 -0
- package/dist/macros.d.ts +160 -0
- package/dist/macros.js +26 -0
- package/dist/messages/device-communication.d.ts +121 -0
- package/dist/messages/device-communication.js +63 -0
- package/dist/messages/index.d.ts +5 -0
- package/dist/messages/index.js +21 -0
- package/dist/messages/progress.d.ts +118 -0
- package/dist/messages/progress.js +51 -0
- package/dist/messages/provider-api/index.d.ts +1 -0
- package/dist/messages/provider-api/index.js +17 -0
- package/dist/messages/provider-api/sync-protocol.d.ts +83 -0
- package/dist/messages/provider-api/sync-protocol.js +2 -0
- package/dist/messages/web-rtc-signaling.d.ts +265 -0
- package/dist/messages/web-rtc-signaling.js +82 -0
- package/dist/messages/web-socket.d.ts +7 -0
- package/dist/messages/web-socket.js +5 -0
- package/dist/milestone.d.ts +5 -0
- package/dist/milestone.js +2 -0
- package/dist/module-config.d.ts +27 -0
- package/dist/module-config.js +2 -0
- package/dist/orchid.d.ts +19 -0
- package/dist/orchid.js +2 -0
- package/dist/package.json +40 -0
- package/dist/permissions.d.ts +6 -0
- package/dist/permissions.js +168 -0
- package/dist/template.d.ts +50 -0
- package/dist/template.js +21 -0
- package/dist/user.d.ts +184 -0
- package/dist/user.js +56 -0
- package/dist/view.d.ts +775 -0
- package/dist/view.js +74 -0
- package/dist/webrtc-playback.d.ts +20 -0
- package/dist/webrtc-playback.js +14 -0
- package/package.json +40 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { WebSocketMessage } from './web-socket';
|
|
3
|
+
export declare const sSessionDescription: z.ZodObject<{
|
|
4
|
+
type: z.ZodString;
|
|
5
|
+
sdp: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: string;
|
|
8
|
+
sdp: string;
|
|
9
|
+
}, {
|
|
10
|
+
type: string;
|
|
11
|
+
sdp: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type SessionDescription = z.infer<typeof sSessionDescription>;
|
|
14
|
+
export declare const sIceCandidate: z.ZodString;
|
|
15
|
+
export type IceCandidate = z.infer<typeof sIceCandidate>;
|
|
16
|
+
export declare const sWebRtcServiceDescription: z.ZodUnion<[z.ZodObject<{
|
|
17
|
+
service: z.ZodLiteral<"live">;
|
|
18
|
+
serviceParams: z.ZodObject<{
|
|
19
|
+
deviceId: z.ZodString;
|
|
20
|
+
streamId: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
deviceId: string;
|
|
23
|
+
streamId: string;
|
|
24
|
+
}, {
|
|
25
|
+
deviceId: string;
|
|
26
|
+
streamId: string;
|
|
27
|
+
}>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
service: "live";
|
|
30
|
+
serviceParams: {
|
|
31
|
+
deviceId: string;
|
|
32
|
+
streamId: string;
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
service: "live";
|
|
36
|
+
serviceParams: {
|
|
37
|
+
deviceId: string;
|
|
38
|
+
streamId: string;
|
|
39
|
+
};
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
service: z.ZodLiteral<"playback">;
|
|
42
|
+
serviceParams: z.ZodObject<{
|
|
43
|
+
controllerId: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
controllerId: string;
|
|
46
|
+
}, {
|
|
47
|
+
controllerId: string;
|
|
48
|
+
}>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
service: "playback";
|
|
51
|
+
serviceParams: {
|
|
52
|
+
controllerId: string;
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
service: "playback";
|
|
56
|
+
serviceParams: {
|
|
57
|
+
controllerId: string;
|
|
58
|
+
};
|
|
59
|
+
}>]>;
|
|
60
|
+
export type WebRtcServiceDescription = z.infer<typeof sWebRtcServiceDescription>;
|
|
61
|
+
export declare const sWebRtcNewSessionPayload: z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
62
|
+
service: z.ZodLiteral<"live">;
|
|
63
|
+
serviceParams: z.ZodObject<{
|
|
64
|
+
deviceId: z.ZodString;
|
|
65
|
+
streamId: z.ZodString;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
deviceId: string;
|
|
68
|
+
streamId: string;
|
|
69
|
+
}, {
|
|
70
|
+
deviceId: string;
|
|
71
|
+
streamId: string;
|
|
72
|
+
}>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
service: "live";
|
|
75
|
+
serviceParams: {
|
|
76
|
+
deviceId: string;
|
|
77
|
+
streamId: string;
|
|
78
|
+
};
|
|
79
|
+
}, {
|
|
80
|
+
service: "live";
|
|
81
|
+
serviceParams: {
|
|
82
|
+
deviceId: string;
|
|
83
|
+
streamId: string;
|
|
84
|
+
};
|
|
85
|
+
}>, z.ZodObject<{
|
|
86
|
+
service: z.ZodLiteral<"playback">;
|
|
87
|
+
serviceParams: z.ZodObject<{
|
|
88
|
+
controllerId: z.ZodString;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
controllerId: string;
|
|
91
|
+
}, {
|
|
92
|
+
controllerId: string;
|
|
93
|
+
}>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
service: "playback";
|
|
96
|
+
serviceParams: {
|
|
97
|
+
controllerId: string;
|
|
98
|
+
};
|
|
99
|
+
}, {
|
|
100
|
+
service: "playback";
|
|
101
|
+
serviceParams: {
|
|
102
|
+
controllerId: string;
|
|
103
|
+
};
|
|
104
|
+
}>]>, z.ZodObject<{
|
|
105
|
+
from: z.ZodOptional<z.ZodString>;
|
|
106
|
+
requestId: z.ZodString;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
requestId: string;
|
|
109
|
+
from?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
requestId: string;
|
|
112
|
+
from?: string | undefined;
|
|
113
|
+
}>>;
|
|
114
|
+
export type WebRtcNewSessionPayload = z.infer<typeof sWebRtcNewSessionPayload>;
|
|
115
|
+
export declare const sWebRtcSessionCreatedPayload: z.ZodObject<{
|
|
116
|
+
requestId: z.ZodString;
|
|
117
|
+
sessionId: z.ZodString;
|
|
118
|
+
stunServer: z.ZodNullable<z.ZodString>;
|
|
119
|
+
frozenStreamTimeout: z.ZodNullable<z.ZodNumber>;
|
|
120
|
+
trickleIce: z.ZodBoolean;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
requestId: string;
|
|
123
|
+
sessionId: string;
|
|
124
|
+
stunServer: string | null;
|
|
125
|
+
frozenStreamTimeout: number | null;
|
|
126
|
+
trickleIce: boolean;
|
|
127
|
+
}, {
|
|
128
|
+
requestId: string;
|
|
129
|
+
sessionId: string;
|
|
130
|
+
stunServer: string | null;
|
|
131
|
+
frozenStreamTimeout: number | null;
|
|
132
|
+
trickleIce: boolean;
|
|
133
|
+
}>;
|
|
134
|
+
export type WebRtcSessionCreatedPayload = z.infer<typeof sWebRtcSessionCreatedPayload>;
|
|
135
|
+
export declare const sWebRtcOfferPayload: z.ZodObject<{
|
|
136
|
+
sessionId: z.ZodString;
|
|
137
|
+
description: z.ZodObject<{
|
|
138
|
+
type: z.ZodString;
|
|
139
|
+
sdp: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
type: string;
|
|
142
|
+
sdp: string;
|
|
143
|
+
}, {
|
|
144
|
+
type: string;
|
|
145
|
+
sdp: string;
|
|
146
|
+
}>;
|
|
147
|
+
from: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
description: {
|
|
150
|
+
type: string;
|
|
151
|
+
sdp: string;
|
|
152
|
+
};
|
|
153
|
+
sessionId: string;
|
|
154
|
+
from?: string | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
description: {
|
|
157
|
+
type: string;
|
|
158
|
+
sdp: string;
|
|
159
|
+
};
|
|
160
|
+
sessionId: string;
|
|
161
|
+
from?: string | undefined;
|
|
162
|
+
}>;
|
|
163
|
+
export type WebRtcOfferPayload = z.infer<typeof sWebRtcOfferPayload>;
|
|
164
|
+
export declare const sWebRtcAnswerPayload: z.ZodObject<{
|
|
165
|
+
sessionId: z.ZodString;
|
|
166
|
+
description: z.ZodObject<{
|
|
167
|
+
type: z.ZodString;
|
|
168
|
+
sdp: z.ZodString;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
type: string;
|
|
171
|
+
sdp: string;
|
|
172
|
+
}, {
|
|
173
|
+
type: string;
|
|
174
|
+
sdp: string;
|
|
175
|
+
}>;
|
|
176
|
+
from: z.ZodOptional<z.ZodString>;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
description: {
|
|
179
|
+
type: string;
|
|
180
|
+
sdp: string;
|
|
181
|
+
};
|
|
182
|
+
sessionId: string;
|
|
183
|
+
from?: string | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
description: {
|
|
186
|
+
type: string;
|
|
187
|
+
sdp: string;
|
|
188
|
+
};
|
|
189
|
+
sessionId: string;
|
|
190
|
+
from?: string | undefined;
|
|
191
|
+
}>;
|
|
192
|
+
export type WebRtcAnswerPayload = z.infer<typeof sWebRtcAnswerPayload>;
|
|
193
|
+
export declare const sWebRtcIceCandidatePayload: z.ZodObject<{
|
|
194
|
+
sessionId: z.ZodString;
|
|
195
|
+
candidate: z.ZodString;
|
|
196
|
+
from: z.ZodOptional<z.ZodString>;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
candidate: string;
|
|
199
|
+
sessionId: string;
|
|
200
|
+
from?: string | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
candidate: string;
|
|
203
|
+
sessionId: string;
|
|
204
|
+
from?: string | undefined;
|
|
205
|
+
}>;
|
|
206
|
+
export type WebRtcIceCandidatePayload = z.infer<typeof sWebRtcIceCandidatePayload>;
|
|
207
|
+
export declare const sWebRtcReleaseSessionPayload: z.ZodObject<{
|
|
208
|
+
sessionId: z.ZodString;
|
|
209
|
+
from: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
|
211
|
+
sessionId: string;
|
|
212
|
+
from?: string | undefined;
|
|
213
|
+
}, {
|
|
214
|
+
sessionId: string;
|
|
215
|
+
from?: string | undefined;
|
|
216
|
+
}>;
|
|
217
|
+
export type WebRtcReleaseSessionPayload = z.infer<typeof sWebRtcReleaseSessionPayload>;
|
|
218
|
+
export declare const sWebRtcErrorPayload: z.ZodObject<{
|
|
219
|
+
sessionId: z.ZodString;
|
|
220
|
+
error: z.ZodObject<{
|
|
221
|
+
code: z.ZodString;
|
|
222
|
+
message: z.ZodString;
|
|
223
|
+
}, "strip", z.ZodTypeAny, {
|
|
224
|
+
code: string;
|
|
225
|
+
message: string;
|
|
226
|
+
}, {
|
|
227
|
+
code: string;
|
|
228
|
+
message: string;
|
|
229
|
+
}>;
|
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
error: {
|
|
232
|
+
code: string;
|
|
233
|
+
message: string;
|
|
234
|
+
};
|
|
235
|
+
sessionId: string;
|
|
236
|
+
}, {
|
|
237
|
+
error: {
|
|
238
|
+
code: string;
|
|
239
|
+
message: string;
|
|
240
|
+
};
|
|
241
|
+
sessionId: string;
|
|
242
|
+
}>;
|
|
243
|
+
export type WebRtcErrorPayload = z.infer<typeof sWebRtcErrorPayload>;
|
|
244
|
+
interface WebRtcEventMap {
|
|
245
|
+
'new-session': WebRtcNewSessionPayload;
|
|
246
|
+
'session-created': WebRtcSessionCreatedPayload;
|
|
247
|
+
offer: WebRtcOfferPayload;
|
|
248
|
+
answer: WebRtcAnswerPayload;
|
|
249
|
+
'ice-candidate': WebRtcIceCandidatePayload;
|
|
250
|
+
'release-session': WebRtcReleaseSessionPayload;
|
|
251
|
+
error: WebRtcErrorPayload;
|
|
252
|
+
}
|
|
253
|
+
export type WebRtcWsMessage = {
|
|
254
|
+
[K in keyof WebRtcEventMap]: {
|
|
255
|
+
event: K;
|
|
256
|
+
data: WebRtcEventMap[K];
|
|
257
|
+
};
|
|
258
|
+
}[keyof WebRtcEventMap];
|
|
259
|
+
export declare const isWebRtcWebSocketMessage: (message: WebSocketMessage) => message is WebRtcWsMessage;
|
|
260
|
+
export type WebRtcMessage = {
|
|
261
|
+
[K in keyof WebRtcEventMap]: {
|
|
262
|
+
type: K;
|
|
263
|
+
} & WebRtcEventMap[K];
|
|
264
|
+
}[keyof WebRtcEventMap];
|
|
265
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isWebRtcWebSocketMessage = exports.sWebRtcErrorPayload = exports.sWebRtcReleaseSessionPayload = exports.sWebRtcIceCandidatePayload = exports.sWebRtcAnswerPayload = exports.sWebRtcOfferPayload = exports.sWebRtcSessionCreatedPayload = exports.sWebRtcNewSessionPayload = exports.sWebRtcServiceDescription = exports.sIceCandidate = exports.sSessionDescription = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.sSessionDescription = zod_1.default.object({
|
|
9
|
+
type: zod_1.default.string().nonempty(),
|
|
10
|
+
sdp: zod_1.default.string().nonempty(),
|
|
11
|
+
});
|
|
12
|
+
exports.sIceCandidate = zod_1.default.string().nonempty();
|
|
13
|
+
exports.sWebRtcServiceDescription = zod_1.default.union([
|
|
14
|
+
zod_1.default.object({
|
|
15
|
+
service: zod_1.default.literal('live'),
|
|
16
|
+
serviceParams: zod_1.default.object({
|
|
17
|
+
deviceId: zod_1.default.string().nonempty(),
|
|
18
|
+
streamId: zod_1.default.string().nonempty(),
|
|
19
|
+
}),
|
|
20
|
+
}),
|
|
21
|
+
zod_1.default.object({
|
|
22
|
+
service: zod_1.default.literal('playback'),
|
|
23
|
+
serviceParams: zod_1.default.object({
|
|
24
|
+
controllerId: zod_1.default.string().nonempty(),
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
exports.sWebRtcNewSessionPayload = exports.sWebRtcServiceDescription.and(zod_1.default.object({
|
|
29
|
+
from: zod_1.default.string().optional(),
|
|
30
|
+
requestId: zod_1.default.string().nonempty(),
|
|
31
|
+
}));
|
|
32
|
+
exports.sWebRtcSessionCreatedPayload = zod_1.default.object({
|
|
33
|
+
requestId: zod_1.default.string().nonempty(),
|
|
34
|
+
sessionId: zod_1.default.string().nonempty(),
|
|
35
|
+
stunServer: zod_1.default.string().nullable(),
|
|
36
|
+
frozenStreamTimeout: zod_1.default.number().nullable(),
|
|
37
|
+
trickleIce: zod_1.default.boolean(),
|
|
38
|
+
});
|
|
39
|
+
exports.sWebRtcOfferPayload = zod_1.default.object({
|
|
40
|
+
sessionId: zod_1.default.string().nonempty(),
|
|
41
|
+
description: exports.sSessionDescription,
|
|
42
|
+
from: zod_1.default.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
exports.sWebRtcAnswerPayload = zod_1.default.object({
|
|
45
|
+
sessionId: zod_1.default.string().nonempty(),
|
|
46
|
+
description: exports.sSessionDescription,
|
|
47
|
+
from: zod_1.default.string().optional(),
|
|
48
|
+
});
|
|
49
|
+
exports.sWebRtcIceCandidatePayload = zod_1.default.object({
|
|
50
|
+
sessionId: zod_1.default.string().nonempty(),
|
|
51
|
+
candidate: exports.sIceCandidate,
|
|
52
|
+
from: zod_1.default.string().optional(),
|
|
53
|
+
});
|
|
54
|
+
exports.sWebRtcReleaseSessionPayload = zod_1.default.object({
|
|
55
|
+
sessionId: zod_1.default.string().nonempty(),
|
|
56
|
+
from: zod_1.default.string().optional(),
|
|
57
|
+
});
|
|
58
|
+
exports.sWebRtcErrorPayload = zod_1.default.object({
|
|
59
|
+
sessionId: zod_1.default.string().nonempty(),
|
|
60
|
+
error: zod_1.default.object({
|
|
61
|
+
code: zod_1.default.string().nonempty(),
|
|
62
|
+
message: zod_1.default.string().nonempty(),
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
const validators = {
|
|
66
|
+
'new-session': exports.sWebRtcNewSessionPayload,
|
|
67
|
+
'session-created': exports.sWebRtcSessionCreatedPayload,
|
|
68
|
+
offer: exports.sWebRtcOfferPayload,
|
|
69
|
+
answer: exports.sWebRtcAnswerPayload,
|
|
70
|
+
'ice-candidate': exports.sWebRtcIceCandidatePayload,
|
|
71
|
+
'release-session': exports.sWebRtcReleaseSessionPayload,
|
|
72
|
+
error: exports.sWebRtcErrorPayload,
|
|
73
|
+
};
|
|
74
|
+
// validate a web socket message as a WebRTC signaling message (use validators according to event)
|
|
75
|
+
const isWebRtcWebSocketMessage = (message) => {
|
|
76
|
+
const validator = validators[message.event];
|
|
77
|
+
if (!validator) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return validator.safeParse(message.data).success;
|
|
81
|
+
};
|
|
82
|
+
exports.isWebRtcWebSocketMessage = isWebRtcWebSocketMessage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { JSONSchema4 } from 'json-schema';
|
|
2
|
+
import { UiHint } from './agent-communication';
|
|
3
|
+
export interface ModuleConfig {
|
|
4
|
+
app: {
|
|
5
|
+
modules: string[];
|
|
6
|
+
};
|
|
7
|
+
[moduleName: string]: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface ModuleConfigMetadata {
|
|
10
|
+
allModules: string[];
|
|
11
|
+
moduleTitles: Record<string, string>;
|
|
12
|
+
moduleDefaults: Record<string, Record<string, unknown>>;
|
|
13
|
+
moduleSchemas: Record<string, JSONSchema4>;
|
|
14
|
+
moduleUiHints: Record<string, UiHint[]>;
|
|
15
|
+
}
|
|
16
|
+
export interface ConfigIssue {
|
|
17
|
+
paths: string[];
|
|
18
|
+
message: string;
|
|
19
|
+
provider: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ModuleConfigSpecs {
|
|
22
|
+
provider: string;
|
|
23
|
+
title: string;
|
|
24
|
+
schema: JSONSchema4;
|
|
25
|
+
default: Record<string, unknown>;
|
|
26
|
+
uiHints?: UiHint[];
|
|
27
|
+
}
|
package/dist/orchid.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type OrchidLoginResponse = {
|
|
2
|
+
token: string;
|
|
3
|
+
sessionId: string;
|
|
4
|
+
id: string;
|
|
5
|
+
username: string;
|
|
6
|
+
emailAddress: string | null;
|
|
7
|
+
admin: boolean;
|
|
8
|
+
libraryAccess: boolean;
|
|
9
|
+
groups: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}[];
|
|
14
|
+
identity: {
|
|
15
|
+
authProvider: string;
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
package/dist/orchid.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@awarevue/api-types",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Common types between backend, agent(s) and frontend(s)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"zod": "^3.24.2"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/json-schema": "^7.0.15",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^8.31.1",
|
|
21
|
+
"@typescript-eslint/parser": "^8.31.1",
|
|
22
|
+
"eslint": "^9.26.0",
|
|
23
|
+
"eslint-config-prettier": "^10.1.2",
|
|
24
|
+
"eslint-plugin-import": "^2.31.0",
|
|
25
|
+
"typescript": "~5.8.3",
|
|
26
|
+
"zod": "^3.24.2"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc && cp package.json dist/",
|
|
30
|
+
"prepare": "yarn run build",
|
|
31
|
+
"lint": "eslint packages --ext .ts,.tsx"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"registry": "https://registry.npmjs.org/"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const sPermissionId: z.ZodUnion<[z.ZodLiteral<"layout:read">, z.ZodLiteral<"layout:update">, z.ZodLiteral<"layout:delete">, z.ZodLiteral<"layout:create">, z.ZodLiteral<"camera:live">, z.ZodLiteral<"camera:playback">, z.ZodLiteral<"camera:playback-export">, z.ZodLiteral<"camera:ptz">, z.ZodLiteral<"camera:privacy-mode">, z.ZodLiteral<"camera:assign">, z.ZodLiteral<"preset:read">, z.ZodLiteral<"preset:update">, z.ZodLiteral<"preset:delete">, z.ZodLiteral<"preset:create">, z.ZodLiteral<"door:release">, z.ZodLiteral<"door:lock">, z.ZodLiteral<"camera-lift:activate">, z.ZodLiteral<"io-board:activate">, z.ZodLiteral<"public-view:read">, z.ZodLiteral<"public-view:update">, z.ZodLiteral<"public-view:delete">, z.ZodLiteral<"public-view:create">, z.ZodLiteral<"private-view:read">, z.ZodLiteral<"private-view:update">, z.ZodLiteral<"private-view:delete">, z.ZodLiteral<"private-view:create">, z.ZodLiteral<"person:read">, z.ZodLiteral<"person:update">, z.ZodLiteral<"person:delete">, z.ZodLiteral<"person:create">, z.ZodLiteral<"person:assign">, z.ZodLiteral<"person:print">, z.ZodLiteral<"door-group:read">, z.ZodLiteral<"door-group:update">, z.ZodLiteral<"door-group:delete">, z.ZodLiteral<"door-group:create">, z.ZodLiteral<"access-rule:read">, z.ZodLiteral<"access-rule:update">, z.ZodLiteral<"access-rule:delete">, z.ZodLiteral<"access-rule:create">, z.ZodLiteral<"schedule:read">, z.ZodLiteral<"schedule:update">, z.ZodLiteral<"schedule:delete">, z.ZodLiteral<"schedule:create">, z.ZodLiteral<"presence:read">, z.ZodLiteral<"presence:update">, z.ZodLiteral<"presence:update-reader">, z.ZodLiteral<"factory:read">, z.ZodLiteral<"factory:update">, z.ZodLiteral<"factory:delete">, z.ZodLiteral<"factory:create">, z.ZodLiteral<"event:read">, z.ZodLiteral<"event:purge">, z.ZodLiteral<"alarm:read">, z.ZodLiteral<"alarm:acknowlede">, z.ZodLiteral<"alarm:arm">, z.ZodLiteral<"alarm:trigger">, z.ZodLiteral<"user:read">, z.ZodLiteral<"user:change-password">, z.ZodLiteral<"user:change-username">, z.ZodLiteral<"user:change-name">, z.ZodLiteral<"user:change-email">, z.ZodLiteral<"user:activate">, z.ZodLiteral<"user:delete">, z.ZodLiteral<"user:change-roles">, z.ZodLiteral<"user:create">, z.ZodLiteral<"role:read">, z.ZodLiteral<"role:create">, z.ZodLiteral<"role:delete">, z.ZodLiteral<"role:update">, z.ZodLiteral<"module:read">, z.ZodLiteral<"module:update">, z.ZodLiteral<"module:enable">, z.ZodLiteral<"device:discover">, z.ZodLiteral<"device:import">, z.ZodLiteral<"device:override-specs">, z.ZodLiteral<"automation:read">, z.ZodLiteral<"automation:update">, z.ZodLiteral<"automation:delete">, z.ZodLiteral<"automation:create">, z.ZodLiteral<"device-group:read">, z.ZodLiteral<"device-group:update">, z.ZodLiteral<"device-group:delete">, z.ZodLiteral<"device-group:create">, z.ZodLiteral<"macro:read">, z.ZodLiteral<"macro:update">, z.ZodLiteral<"macro:delete">, z.ZodLiteral<"macro:create">, z.ZodLiteral<"macro:run">, z.ZodLiteral<"template:read">, z.ZodLiteral<"template:update">, z.ZodLiteral<"template:delete">, z.ZodLiteral<"template:create">, z.ZodLiteral<"custom-field:read">, z.ZodLiteral<"custom-field:update">, z.ZodLiteral<"custom-field:delete">, z.ZodLiteral<"custom-field:create">, z.ZodLiteral<"media:read">, z.ZodLiteral<"about:read">, z.ZodLiteral<"intercom:read">, ...(z.ZodLiteral<"device:camera"> | z.ZodLiteral<"device:door"> | z.ZodLiteral<"device:motion-sensor"> | z.ZodLiteral<"device:panic-button"> | z.ZodLiteral<"device:intercom-terminal">)[]]>;
|
|
3
|
+
export type PermissionArea = 'layout' | 'camera' | 'preset' | 'door' | 'public-view' | 'private-view' | 'person' | 'door-group' | 'access-rule' | 'schedule' | 'presence' | 'factory' | 'event' | 'alarm' | 'user' | 'role' | 'device' | 'module' | 'automation' | 'device-group' | 'macro' | 'template' | 'custom-field' | 'media' | 'about' | 'intercom' | 'device';
|
|
4
|
+
export declare const permissions: Record<"device:camera" | "device:door" | "device:motion-sensor" | "device:panic-button" | "device:intercom-terminal" | "layout:read" | "layout:update" | "layout:delete" | "layout:create" | "camera:live" | "camera:playback" | "camera:playback-export" | "camera:ptz" | "camera:privacy-mode" | "camera:assign" | "preset:read" | "preset:update" | "preset:delete" | "preset:create" | "door:release" | "door:lock" | "camera-lift:activate" | "io-board:activate" | "public-view:read" | "public-view:update" | "public-view:delete" | "public-view:create" | "private-view:read" | "private-view:update" | "private-view:delete" | "private-view:create" | "person:read" | "person:update" | "person:delete" | "person:create" | "person:assign" | "person:print" | "door-group:read" | "door-group:update" | "door-group:delete" | "door-group:create" | "access-rule:read" | "access-rule:update" | "access-rule:delete" | "access-rule:create" | "schedule:read" | "schedule:update" | "schedule:delete" | "schedule:create" | "presence:read" | "presence:update" | "presence:update-reader" | "factory:read" | "factory:update" | "factory:delete" | "factory:create" | "event:read" | "event:purge" | "alarm:read" | "alarm:acknowlede" | "alarm:arm" | "alarm:trigger" | "user:read" | "user:change-password" | "user:change-username" | "user:change-name" | "user:change-email" | "user:activate" | "user:delete" | "user:change-roles" | "user:create" | "role:read" | "role:create" | "role:delete" | "role:update" | "module:read" | "module:update" | "module:enable" | "device:discover" | "device:import" | "device:override-specs" | "automation:read" | "automation:update" | "automation:delete" | "automation:create" | "device-group:read" | "device-group:update" | "device-group:delete" | "device-group:create" | "macro:read" | "macro:update" | "macro:delete" | "macro:create" | "macro:run" | "template:read" | "template:update" | "template:delete" | "template:create" | "custom-field:read" | "custom-field:update" | "custom-field:delete" | "custom-field:create" | "media:read" | "about:read" | "intercom:read", string>;
|
|
5
|
+
export declare const permissionsArray: ("device:camera" | "device:door" | "device:motion-sensor" | "device:panic-button" | "device:intercom-terminal" | "layout:read" | "layout:update" | "layout:delete" | "layout:create" | "camera:live" | "camera:playback" | "camera:playback-export" | "camera:ptz" | "camera:privacy-mode" | "camera:assign" | "preset:read" | "preset:update" | "preset:delete" | "preset:create" | "door:release" | "door:lock" | "camera-lift:activate" | "io-board:activate" | "public-view:read" | "public-view:update" | "public-view:delete" | "public-view:create" | "private-view:read" | "private-view:update" | "private-view:delete" | "private-view:create" | "person:read" | "person:update" | "person:delete" | "person:create" | "person:assign" | "person:print" | "door-group:read" | "door-group:update" | "door-group:delete" | "door-group:create" | "access-rule:read" | "access-rule:update" | "access-rule:delete" | "access-rule:create" | "schedule:read" | "schedule:update" | "schedule:delete" | "schedule:create" | "presence:read" | "presence:update" | "presence:update-reader" | "factory:read" | "factory:update" | "factory:delete" | "factory:create" | "event:read" | "event:purge" | "alarm:read" | "alarm:acknowlede" | "alarm:arm" | "alarm:trigger" | "user:read" | "user:change-password" | "user:change-username" | "user:change-name" | "user:change-email" | "user:activate" | "user:delete" | "user:change-roles" | "user:create" | "role:read" | "role:create" | "role:delete" | "role:update" | "module:read" | "module:update" | "module:enable" | "device:discover" | "device:import" | "device:override-specs" | "automation:read" | "automation:update" | "automation:delete" | "automation:create" | "device-group:read" | "device-group:update" | "device-group:delete" | "device-group:create" | "macro:read" | "macro:update" | "macro:delete" | "macro:create" | "macro:run" | "template:read" | "template:update" | "template:delete" | "template:create" | "custom-field:read" | "custom-field:update" | "custom-field:delete" | "custom-field:create" | "media:read" | "about:read" | "intercom:read")[];
|
|
6
|
+
export type PermissionId = z.infer<typeof sPermissionId>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.permissionsArray = exports.permissions = exports.sPermissionId = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Some Device Types omitted for now until we work out if they are needed
|
|
6
|
+
const deviceTypePermissions = {
|
|
7
|
+
camera: zod_1.z.literal('device:camera').describe('View cameras'),
|
|
8
|
+
door: zod_1.z.literal('device:door').describe('View doors'),
|
|
9
|
+
'motion-sensor': zod_1.z
|
|
10
|
+
.literal('device:motion-sensor')
|
|
11
|
+
.describe('View motion sensors'),
|
|
12
|
+
'panic-button': zod_1.z
|
|
13
|
+
.literal('device:panic-button')
|
|
14
|
+
.describe('View panic buttons'),
|
|
15
|
+
'intercom-terminal': zod_1.z
|
|
16
|
+
.literal('device:intercom-terminal')
|
|
17
|
+
.describe('View intercom terminals'),
|
|
18
|
+
};
|
|
19
|
+
const sDeviceTypePermissions = Object.values(deviceTypePermissions);
|
|
20
|
+
exports.sPermissionId = zod_1.z.union([
|
|
21
|
+
//Layout
|
|
22
|
+
zod_1.z.literal('layout:read').describe('Read layout data'),
|
|
23
|
+
zod_1.z.literal('layout:update').describe('Update layouts'),
|
|
24
|
+
zod_1.z.literal('layout:delete').describe('Delete layout'),
|
|
25
|
+
zod_1.z.literal('layout:create').describe('Create layout'),
|
|
26
|
+
//Camera
|
|
27
|
+
zod_1.z.literal('camera:live').describe('View live camera feed'),
|
|
28
|
+
zod_1.z.literal('camera:playback').describe('View camera playback'),
|
|
29
|
+
zod_1.z.literal('camera:playback-export').describe('Export camera playback'),
|
|
30
|
+
zod_1.z.literal('camera:ptz').describe('Control camera PTZ'),
|
|
31
|
+
zod_1.z.literal('camera:privacy-mode').describe('Control camera privacy mode'),
|
|
32
|
+
zod_1.z.literal('camera:assign').describe('Assign adjacent cameras to devices'),
|
|
33
|
+
//Preset
|
|
34
|
+
zod_1.z.literal('preset:read').describe('Use camera presets'),
|
|
35
|
+
zod_1.z.literal('preset:update').describe('Update presets'),
|
|
36
|
+
zod_1.z.literal('preset:delete').describe('Delete preset'),
|
|
37
|
+
zod_1.z.literal('preset:create').describe('Create preset'),
|
|
38
|
+
//Door
|
|
39
|
+
zod_1.z.literal('door:release').describe('Release door'),
|
|
40
|
+
zod_1.z.literal('door:lock').describe('Lock or unlock door'),
|
|
41
|
+
//Camera Lift
|
|
42
|
+
zod_1.z.literal('camera-lift:activate').describe('Activate camera lifts'),
|
|
43
|
+
//IO Board
|
|
44
|
+
zod_1.z.literal('io-board:activate').describe('Activate IO board outputs'),
|
|
45
|
+
//Public View
|
|
46
|
+
zod_1.z.literal('public-view:read').describe('Read public view data'),
|
|
47
|
+
zod_1.z.literal('public-view:update').describe('Update public views'),
|
|
48
|
+
zod_1.z.literal('public-view:delete').describe('Delete public view'),
|
|
49
|
+
zod_1.z.literal('public-view:create').describe('Create public view'),
|
|
50
|
+
//Private View
|
|
51
|
+
zod_1.z.literal('private-view:read').describe('Read private view data'),
|
|
52
|
+
zod_1.z.literal('private-view:update').describe('Update private views'),
|
|
53
|
+
zod_1.z.literal('private-view:delete').describe('Delete private view'),
|
|
54
|
+
zod_1.z.literal('private-view:create').describe('Create private view'),
|
|
55
|
+
//Person
|
|
56
|
+
zod_1.z.literal('person:read').describe('Read person data'),
|
|
57
|
+
zod_1.z.literal('person:update').describe('Update person data'),
|
|
58
|
+
zod_1.z.literal('person:delete').describe('Delete person'),
|
|
59
|
+
zod_1.z.literal('person:create').describe('Create person'),
|
|
60
|
+
zod_1.z.literal('person:assign').describe('Assign credentials and access rules'),
|
|
61
|
+
zod_1.z.literal('person:print').describe('Print person details'),
|
|
62
|
+
//Doors and Groups (needs access to doors to be useful)
|
|
63
|
+
zod_1.z.literal('door-group:read').describe('Read door group data'),
|
|
64
|
+
zod_1.z.literal('door-group:update').describe('Update door group'),
|
|
65
|
+
zod_1.z.literal('door-group:delete').describe('Delete door group'),
|
|
66
|
+
zod_1.z.literal('door-group:create').describe('Create door group'),
|
|
67
|
+
//Access Rule
|
|
68
|
+
zod_1.z.literal('access-rule:read').describe('Read access rule data'),
|
|
69
|
+
zod_1.z.literal('access-rule:update').describe('Update access rules'),
|
|
70
|
+
zod_1.z.literal('access-rule:delete').describe('Delete access rule'),
|
|
71
|
+
zod_1.z.literal('access-rule:create').describe('Create access rule'),
|
|
72
|
+
//Schedule
|
|
73
|
+
zod_1.z.literal('schedule:read').describe('Read schedule data'),
|
|
74
|
+
zod_1.z.literal('schedule:update').describe('Update schedule data'),
|
|
75
|
+
zod_1.z.literal('schedule:delete').describe('Delete schedule'),
|
|
76
|
+
zod_1.z.literal('schedule:create').describe('Create schedule'),
|
|
77
|
+
//Presence
|
|
78
|
+
zod_1.z.literal('presence:read').describe('Read presence data'),
|
|
79
|
+
zod_1.z.literal('presence:update').describe('Update presence data'),
|
|
80
|
+
zod_1.z
|
|
81
|
+
.literal('presence:update-reader')
|
|
82
|
+
.describe('Update presence via USB reader'),
|
|
83
|
+
//Factory
|
|
84
|
+
zod_1.z.literal('factory:read').describe('Read custom devices'),
|
|
85
|
+
zod_1.z.literal('factory:update').describe('Update custom devices'),
|
|
86
|
+
zod_1.z.literal('factory:delete').describe('Delete custom device'),
|
|
87
|
+
zod_1.z.literal('factory:create').describe('Create custom device'),
|
|
88
|
+
//Event
|
|
89
|
+
zod_1.z.literal('event:read').describe('View events'),
|
|
90
|
+
zod_1.z.literal('event:purge').describe('Clear events'), //No UI effect yet
|
|
91
|
+
//Alarm
|
|
92
|
+
zod_1.z.literal('alarm:read').describe('View alarms'),
|
|
93
|
+
zod_1.z.literal('alarm:acknowlede').describe('Acknowledge alarms'),
|
|
94
|
+
zod_1.z.literal('alarm:arm').describe('Can arm or disarm'),
|
|
95
|
+
zod_1.z.literal('alarm:trigger').describe('Can trigger alarms'),
|
|
96
|
+
//User
|
|
97
|
+
zod_1.z.literal('user:read').describe('View user data'),
|
|
98
|
+
zod_1.z.literal('user:change-password').describe('Change user password'),
|
|
99
|
+
zod_1.z.literal('user:change-username').describe('Change user login id'),
|
|
100
|
+
zod_1.z.literal('user:change-name').describe('Change user name'),
|
|
101
|
+
zod_1.z.literal('user:change-email').describe('Change user email'),
|
|
102
|
+
zod_1.z.literal('user:activate').describe('Activate or Deactivate user'),
|
|
103
|
+
zod_1.z.literal('user:delete').describe('Delete user'),
|
|
104
|
+
zod_1.z.literal('user:change-roles').describe('Change user roles'),
|
|
105
|
+
zod_1.z.literal('user:create').describe('Create user'),
|
|
106
|
+
//Role
|
|
107
|
+
zod_1.z.literal('role:read').describe('View role data'),
|
|
108
|
+
zod_1.z.literal('role:create').describe('Create role'),
|
|
109
|
+
zod_1.z.literal('role:delete').describe('Delete role'),
|
|
110
|
+
zod_1.z.literal('role:update').describe('Update role data'),
|
|
111
|
+
//Module
|
|
112
|
+
zod_1.z.literal('module:read').describe('View module settings'),
|
|
113
|
+
zod_1.z.literal('module:update').describe('Update module settings'),
|
|
114
|
+
zod_1.z.literal('module:enable').describe('Enable and disable modules'),
|
|
115
|
+
//Device
|
|
116
|
+
zod_1.z.literal('device:discover').describe('Discover devices'), //No UI effect yet
|
|
117
|
+
zod_1.z.literal('device:import').describe('Import discovered devices'), //No UI effect yet
|
|
118
|
+
zod_1.z.literal('device:override-specs').describe('Override device specs'),
|
|
119
|
+
//Automation
|
|
120
|
+
zod_1.z.literal('automation:read').describe('View automation data'),
|
|
121
|
+
zod_1.z.literal('automation:update').describe('Update automation data'), //No UI effect yet
|
|
122
|
+
zod_1.z.literal('automation:delete').describe('Delete automation'), //No UI effect yet
|
|
123
|
+
zod_1.z.literal('automation:create').describe('Create automation'), //No UI effect yet
|
|
124
|
+
//Device Groups
|
|
125
|
+
zod_1.z.literal('device-group:read').describe('View device groups'),
|
|
126
|
+
zod_1.z.literal('device-group:update').describe('Update device groups'),
|
|
127
|
+
zod_1.z.literal('device-group:delete').describe('Delete device group'),
|
|
128
|
+
zod_1.z.literal('device-group:create').describe('Create device group'),
|
|
129
|
+
//Macros
|
|
130
|
+
zod_1.z.literal('macro:read').describe('View macros'),
|
|
131
|
+
zod_1.z.literal('macro:update').describe('Update macros'),
|
|
132
|
+
zod_1.z.literal('macro:delete').describe('Delete macro'),
|
|
133
|
+
zod_1.z.literal('macro:create').describe('Create macro'),
|
|
134
|
+
zod_1.z.literal('macro:run').describe('Run macro'),
|
|
135
|
+
//Templates
|
|
136
|
+
zod_1.z.literal('template:read').describe('View templates'),
|
|
137
|
+
zod_1.z.literal('template:update').describe('Update templates'),
|
|
138
|
+
zod_1.z.literal('template:delete').describe('Delete template'),
|
|
139
|
+
zod_1.z.literal('template:create').describe('Create template'),
|
|
140
|
+
//Custom Fields
|
|
141
|
+
zod_1.z.literal('custom-field:read').describe('View custom fields'),
|
|
142
|
+
zod_1.z.literal('custom-field:update').describe('Update custom fields'),
|
|
143
|
+
zod_1.z.literal('custom-field:delete').describe('Delete custom field'),
|
|
144
|
+
zod_1.z.literal('custom-field:create').describe('Create custom field'),
|
|
145
|
+
//Media
|
|
146
|
+
zod_1.z.literal('media:read').describe('View media page'),
|
|
147
|
+
//About
|
|
148
|
+
zod_1.z.literal('about:read').describe('View about data'),
|
|
149
|
+
//Intercom
|
|
150
|
+
zod_1.z.literal('intercom:read').describe('View intercom data'), //No UI effect yet
|
|
151
|
+
//Devices
|
|
152
|
+
...sDeviceTypePermissions, //No UI effects yet
|
|
153
|
+
]);
|
|
154
|
+
const permissionsToRecord = (permissions) => {
|
|
155
|
+
const options = permissions.options;
|
|
156
|
+
return options.reduce((acc, option) => {
|
|
157
|
+
const key = option.value;
|
|
158
|
+
const description = option.description;
|
|
159
|
+
acc[key] = description || '';
|
|
160
|
+
return acc;
|
|
161
|
+
}, {});
|
|
162
|
+
};
|
|
163
|
+
const permissionsToArray = (permissions) => {
|
|
164
|
+
const options = permissions.options;
|
|
165
|
+
return options.map((option) => option.value);
|
|
166
|
+
};
|
|
167
|
+
exports.permissions = permissionsToRecord(exports.sPermissionId);
|
|
168
|
+
exports.permissionsArray = permissionsToArray(exports.sPermissionId);
|