@awarevue/api-types 2.0.153 → 2.0.154

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.
@@ -20,6 +20,11 @@ export declare const sConflictMeta: z.ZodObject<{
20
20
  blockingId: z.ZodOptional<z.ZodString>;
21
21
  value: z.ZodOptional<z.ZodString>;
22
22
  }, z.core.$strip>;
23
+ /** Someone else changed the resource since the requester read it, so the requester's change was not made. */
24
+ export declare const sChangedMeta: z.ZodObject<{
25
+ subject: z.ZodString;
26
+ id: z.ZodString;
27
+ }, z.core.$strip>;
23
28
  export declare const sVoidMeta: z.ZodObject<{}, z.core.$strict>;
24
29
  export declare const sAccessRuleConflictMeta: z.ZodObject<{
25
30
  deviceSchedules: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
@@ -61,6 +66,7 @@ export type DuplicateMeta = z.infer<typeof sDuplicateMeta>;
61
66
  export type NotFoundMeta = z.infer<typeof sNotFoundMeta>;
62
67
  export type InvalidMeta = z.infer<typeof sInvalidMeta>;
63
68
  export type ConflictMeta = z.infer<typeof sConflictMeta>;
69
+ export type ChangedMeta = z.infer<typeof sChangedMeta>;
64
70
  export type AccessRuleConflictMeta = z.infer<typeof sAccessRuleConflictMeta>;
65
71
  export declare enum AppErrorCode {
66
72
  RESOURCE_ALREADY_EXISTS = "RESOURCE_ALREADY_EXISTS",
@@ -69,6 +75,7 @@ export declare enum AppErrorCode {
69
75
  RESOURCE_INVALID = "RESOURCE_INVALID",
70
76
  RESOURCE_IN_USE = "RESOURCE_IN_USE",
71
77
  RESOURCE_NOT_SUPPORTED = "RESOURCE_NOT_SUPPORTED",
78
+ RESOURCE_CHANGED = "RESOURCE_CHANGED",
72
79
  BAD_REFERENCE = "BAD_REFERENCE",
73
80
  UNKNOWN = "UNKNOWN",
74
81
  SERVER_INTERNAL_ERROR = "SERVER_INTERNAL_ERROR",
@@ -143,6 +150,10 @@ export declare const errorMetadataSchemas: {
143
150
  value: z.ZodOptional<z.ZodString>;
144
151
  }, z.core.$strip>;
145
152
  readonly RESOURCE_NOT_SUPPORTED: z.ZodObject<{}, z.core.$strict>;
153
+ readonly RESOURCE_CHANGED: z.ZodObject<{
154
+ subject: z.ZodString;
155
+ id: z.ZodString;
156
+ }, z.core.$strip>;
146
157
  readonly RESOURCE_FORBIDDEN: z.ZodObject<{}, z.core.$strict>;
147
158
  readonly BAD_REFERENCE: z.ZodObject<{}, z.core.$strict>;
148
159
  readonly ACCESS_RULE_NOT_FOUND: z.ZodObject<{
package/dist/api/error.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.errorMetadataSchemas = exports.AppErrorCode = exports.sPersonTypeSyncPermissionRequiredMeta = exports.sPersonTypeNotAccessControlUserMeta = exports.sTokenLimitExceededMeta = exports.sTokenInvalidFormatMeta = exports.sZoneAccessRuleConflictMeta = exports.sAccessRuleConflictMeta = exports.sVoidMeta = exports.sConflictMeta = exports.sInvalidMeta = exports.sNotFoundMeta = exports.sDuplicateMeta = void 0;
3
+ exports.errorMetadataSchemas = exports.AppErrorCode = exports.sPersonTypeSyncPermissionRequiredMeta = exports.sPersonTypeNotAccessControlUserMeta = exports.sTokenLimitExceededMeta = exports.sTokenInvalidFormatMeta = exports.sZoneAccessRuleConflictMeta = exports.sAccessRuleConflictMeta = exports.sVoidMeta = exports.sChangedMeta = exports.sConflictMeta = exports.sInvalidMeta = exports.sNotFoundMeta = exports.sDuplicateMeta = void 0;
4
4
  exports.isErrorResponse = isErrorResponse;
5
5
  const zod_1 = require("zod");
6
6
  const credential_type_1 = require("../primitives/credential-type");
@@ -26,6 +26,11 @@ exports.sConflictMeta = zod_1.z.object({
26
26
  blockingId: zod_1.z.string().optional(),
27
27
  value: zod_1.z.string().optional(),
28
28
  });
29
+ /** Someone else changed the resource since the requester read it, so the requester's change was not made. */
30
+ exports.sChangedMeta = zod_1.z.object({
31
+ subject: zod_1.z.string(),
32
+ id: zod_1.z.string(),
33
+ });
29
34
  exports.sVoidMeta = zod_1.z.object({}).strict();
30
35
  exports.sAccessRuleConflictMeta = zod_1.z.object({
31
36
  deviceSchedules: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())),
@@ -62,6 +67,7 @@ var AppErrorCode;
62
67
  AppErrorCode["RESOURCE_INVALID"] = "RESOURCE_INVALID";
63
68
  AppErrorCode["RESOURCE_IN_USE"] = "RESOURCE_IN_USE";
64
69
  AppErrorCode["RESOURCE_NOT_SUPPORTED"] = "RESOURCE_NOT_SUPPORTED";
70
+ AppErrorCode["RESOURCE_CHANGED"] = "RESOURCE_CHANGED";
65
71
  AppErrorCode["BAD_REFERENCE"] = "BAD_REFERENCE";
66
72
  AppErrorCode["UNKNOWN"] = "UNKNOWN";
67
73
  AppErrorCode["SERVER_INTERNAL_ERROR"] = "SERVER_INTERNAL_ERROR";
@@ -129,6 +135,7 @@ exports.errorMetadataSchemas = {
129
135
  [AppErrorCode.RESOURCE_INVALID]: exports.sInvalidMeta,
130
136
  [AppErrorCode.RESOURCE_IN_USE]: exports.sConflictMeta,
131
137
  [AppErrorCode.RESOURCE_NOT_SUPPORTED]: exports.sVoidMeta,
138
+ [AppErrorCode.RESOURCE_CHANGED]: exports.sChangedMeta,
132
139
  [AppErrorCode.RESOURCE_FORBIDDEN]: exports.sVoidMeta,
133
140
  [AppErrorCode.BAD_REFERENCE]: exports.sVoidMeta,
134
141
  // access
@@ -231,6 +231,9 @@ export declare const eventSchemaByKind: {
231
231
  objectKind: z.ZodNullable<z.ZodString>;
232
232
  probability: z.ZodNumber;
233
233
  identifiedObjectId: z.ZodNullable<z.ZodString>;
234
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
235
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
236
+ stationary: z.ZodOptional<z.ZodBoolean>;
234
237
  frameTime: z.ZodNumber;
235
238
  startTime: z.ZodNumber;
236
239
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -240,6 +243,8 @@ export declare const eventSchemaByKind: {
240
243
  y1: z.ZodNumber;
241
244
  x2: z.ZodNumber;
242
245
  y2: z.ZodNumber;
246
+ frameWidth: z.ZodOptional<z.ZodNumber>;
247
+ frameHeight: z.ZodOptional<z.ZodNumber>;
243
248
  }, z.core.$strip>>>;
244
249
  'object-detection-updated': z.ZodIntersection<z.ZodObject<{
245
250
  kind: z.ZodLiteral<"object-detection-updated">;
@@ -249,6 +254,9 @@ export declare const eventSchemaByKind: {
249
254
  objectKind: z.ZodNullable<z.ZodString>;
250
255
  probability: z.ZodNumber;
251
256
  identifiedObjectId: z.ZodNullable<z.ZodString>;
257
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
258
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
259
+ stationary: z.ZodOptional<z.ZodBoolean>;
252
260
  frameTime: z.ZodNumber;
253
261
  startTime: z.ZodNumber;
254
262
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -258,6 +266,8 @@ export declare const eventSchemaByKind: {
258
266
  y1: z.ZodNumber;
259
267
  x2: z.ZodNumber;
260
268
  y2: z.ZodNumber;
269
+ frameWidth: z.ZodOptional<z.ZodNumber>;
270
+ frameHeight: z.ZodOptional<z.ZodNumber>;
261
271
  }, z.core.$strip>>>;
262
272
  'object-detection-ended': z.ZodIntersection<z.ZodObject<{
263
273
  kind: z.ZodLiteral<"object-detection-ended">;
@@ -267,6 +277,9 @@ export declare const eventSchemaByKind: {
267
277
  objectKind: z.ZodNullable<z.ZodString>;
268
278
  probability: z.ZodNumber;
269
279
  identifiedObjectId: z.ZodNullable<z.ZodString>;
280
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
281
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
282
+ stationary: z.ZodOptional<z.ZodBoolean>;
270
283
  frameTime: z.ZodNumber;
271
284
  startTime: z.ZodNumber;
272
285
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -276,6 +289,8 @@ export declare const eventSchemaByKind: {
276
289
  y1: z.ZodNumber;
277
290
  x2: z.ZodNumber;
278
291
  y2: z.ZodNumber;
292
+ frameWidth: z.ZodOptional<z.ZodNumber>;
293
+ frameHeight: z.ZodOptional<z.ZodNumber>;
279
294
  }, z.core.$strip>>>;
280
295
  'scene-created': z.ZodIntersection<z.ZodObject<{
281
296
  kind: z.ZodLiteral<"scene-created">;
@@ -9,12 +9,15 @@ export declare const sCameraPtzPresetSaved: z.ZodObject<{
9
9
  }, z.core.$strip>;
10
10
  assignedRef: z.ZodNullable<z.ZodString>;
11
11
  }, z.core.$strip>;
12
+ /** A box in the picture the object was detected in, in pixels of that picture. */
12
13
  export declare const sBoxLocator: z.ZodObject<{
13
14
  locatorKind: z.ZodLiteral<"box">;
14
15
  x1: z.ZodNumber;
15
16
  y1: z.ZodNumber;
16
17
  x2: z.ZodNumber;
17
18
  y2: z.ZodNumber;
19
+ frameWidth: z.ZodOptional<z.ZodNumber>;
20
+ frameHeight: z.ZodOptional<z.ZodNumber>;
18
21
  }, z.core.$strip>;
19
22
  export declare const sObjectLocator: z.ZodObject<{
20
23
  locatorKind: z.ZodLiteral<"box">;
@@ -22,11 +25,16 @@ export declare const sObjectLocator: z.ZodObject<{
22
25
  y1: z.ZodNumber;
23
26
  x2: z.ZodNumber;
24
27
  y2: z.ZodNumber;
28
+ frameWidth: z.ZodOptional<z.ZodNumber>;
29
+ frameHeight: z.ZodOptional<z.ZodNumber>;
25
30
  }, z.core.$strip>;
26
31
  export declare const sObjectDetectionData: z.ZodIntersection<z.ZodObject<{
27
32
  objectKind: z.ZodNullable<z.ZodString>;
28
33
  probability: z.ZodNumber;
29
34
  identifiedObjectId: z.ZodNullable<z.ZodString>;
35
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
36
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ stationary: z.ZodOptional<z.ZodBoolean>;
30
38
  frameTime: z.ZodNumber;
31
39
  startTime: z.ZodNumber;
32
40
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -36,7 +44,12 @@ export declare const sObjectDetectionData: z.ZodIntersection<z.ZodObject<{
36
44
  y1: z.ZodNumber;
37
45
  x2: z.ZodNumber;
38
46
  y2: z.ZodNumber;
47
+ frameWidth: z.ZodOptional<z.ZodNumber>;
48
+ frameHeight: z.ZodOptional<z.ZodNumber>;
39
49
  }, z.core.$strip>>;
50
+ /**
51
+ * A detected object's events: started once, then any number of updated, then ended once.
52
+ */
40
53
  export declare const sObjectDetectionStarted: z.ZodIntersection<z.ZodObject<{
41
54
  kind: z.ZodLiteral<"object-detection-started">;
42
55
  providerAssignedRef: z.ZodString;
@@ -45,6 +58,9 @@ export declare const sObjectDetectionStarted: z.ZodIntersection<z.ZodObject<{
45
58
  objectKind: z.ZodNullable<z.ZodString>;
46
59
  probability: z.ZodNumber;
47
60
  identifiedObjectId: z.ZodNullable<z.ZodString>;
61
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
62
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
63
+ stationary: z.ZodOptional<z.ZodBoolean>;
48
64
  frameTime: z.ZodNumber;
49
65
  startTime: z.ZodNumber;
50
66
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -54,6 +70,8 @@ export declare const sObjectDetectionStarted: z.ZodIntersection<z.ZodObject<{
54
70
  y1: z.ZodNumber;
55
71
  x2: z.ZodNumber;
56
72
  y2: z.ZodNumber;
73
+ frameWidth: z.ZodOptional<z.ZodNumber>;
74
+ frameHeight: z.ZodOptional<z.ZodNumber>;
57
75
  }, z.core.$strip>>>;
58
76
  export declare const sObjectDetectionUpdated: z.ZodIntersection<z.ZodObject<{
59
77
  kind: z.ZodLiteral<"object-detection-updated">;
@@ -63,6 +81,9 @@ export declare const sObjectDetectionUpdated: z.ZodIntersection<z.ZodObject<{
63
81
  objectKind: z.ZodNullable<z.ZodString>;
64
82
  probability: z.ZodNumber;
65
83
  identifiedObjectId: z.ZodNullable<z.ZodString>;
84
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
85
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ stationary: z.ZodOptional<z.ZodBoolean>;
66
87
  frameTime: z.ZodNumber;
67
88
  startTime: z.ZodNumber;
68
89
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -72,6 +93,8 @@ export declare const sObjectDetectionUpdated: z.ZodIntersection<z.ZodObject<{
72
93
  y1: z.ZodNumber;
73
94
  x2: z.ZodNumber;
74
95
  y2: z.ZodNumber;
96
+ frameWidth: z.ZodOptional<z.ZodNumber>;
97
+ frameHeight: z.ZodOptional<z.ZodNumber>;
75
98
  }, z.core.$strip>>>;
76
99
  export declare const sObjectDetectionEnded: z.ZodIntersection<z.ZodObject<{
77
100
  kind: z.ZodLiteral<"object-detection-ended">;
@@ -81,6 +104,9 @@ export declare const sObjectDetectionEnded: z.ZodIntersection<z.ZodObject<{
81
104
  objectKind: z.ZodNullable<z.ZodString>;
82
105
  probability: z.ZodNumber;
83
106
  identifiedObjectId: z.ZodNullable<z.ZodString>;
107
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
108
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ stationary: z.ZodOptional<z.ZodBoolean>;
84
110
  frameTime: z.ZodNumber;
85
111
  startTime: z.ZodNumber;
86
112
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -90,6 +116,8 @@ export declare const sObjectDetectionEnded: z.ZodIntersection<z.ZodObject<{
90
116
  y1: z.ZodNumber;
91
117
  x2: z.ZodNumber;
92
118
  y2: z.ZodNumber;
119
+ frameWidth: z.ZodOptional<z.ZodNumber>;
120
+ frameHeight: z.ZodOptional<z.ZodNumber>;
93
121
  }, z.core.$strip>>>;
94
122
  export declare const sSceneData: z.ZodObject<{
95
123
  detections: z.ZodArray<z.ZodString>;
@@ -146,6 +174,9 @@ export declare const cameraEventSchemasByKind: {
146
174
  objectKind: z.ZodNullable<z.ZodString>;
147
175
  probability: z.ZodNumber;
148
176
  identifiedObjectId: z.ZodNullable<z.ZodString>;
177
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
178
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
179
+ stationary: z.ZodOptional<z.ZodBoolean>;
149
180
  frameTime: z.ZodNumber;
150
181
  startTime: z.ZodNumber;
151
182
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -155,6 +186,8 @@ export declare const cameraEventSchemasByKind: {
155
186
  y1: z.ZodNumber;
156
187
  x2: z.ZodNumber;
157
188
  y2: z.ZodNumber;
189
+ frameWidth: z.ZodOptional<z.ZodNumber>;
190
+ frameHeight: z.ZodOptional<z.ZodNumber>;
158
191
  }, z.core.$strip>>>;
159
192
  readonly 'object-detection-updated': z.ZodIntersection<z.ZodObject<{
160
193
  kind: z.ZodLiteral<"object-detection-updated">;
@@ -164,6 +197,9 @@ export declare const cameraEventSchemasByKind: {
164
197
  objectKind: z.ZodNullable<z.ZodString>;
165
198
  probability: z.ZodNumber;
166
199
  identifiedObjectId: z.ZodNullable<z.ZodString>;
200
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
201
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
202
+ stationary: z.ZodOptional<z.ZodBoolean>;
167
203
  frameTime: z.ZodNumber;
168
204
  startTime: z.ZodNumber;
169
205
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -173,6 +209,8 @@ export declare const cameraEventSchemasByKind: {
173
209
  y1: z.ZodNumber;
174
210
  x2: z.ZodNumber;
175
211
  y2: z.ZodNumber;
212
+ frameWidth: z.ZodOptional<z.ZodNumber>;
213
+ frameHeight: z.ZodOptional<z.ZodNumber>;
176
214
  }, z.core.$strip>>>;
177
215
  readonly 'object-detection-ended': z.ZodIntersection<z.ZodObject<{
178
216
  kind: z.ZodLiteral<"object-detection-ended">;
@@ -182,6 +220,9 @@ export declare const cameraEventSchemasByKind: {
182
220
  objectKind: z.ZodNullable<z.ZodString>;
183
221
  probability: z.ZodNumber;
184
222
  identifiedObjectId: z.ZodNullable<z.ZodString>;
223
+ identificationScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
224
+ providerZones: z.ZodOptional<z.ZodArray<z.ZodString>>;
225
+ stationary: z.ZodOptional<z.ZodBoolean>;
185
226
  frameTime: z.ZodNumber;
186
227
  startTime: z.ZodNumber;
187
228
  endTime: z.ZodNullable<z.ZodNumber>;
@@ -191,6 +232,8 @@ export declare const cameraEventSchemasByKind: {
191
232
  y1: z.ZodNumber;
192
233
  x2: z.ZodNumber;
193
234
  y2: z.ZodNumber;
235
+ frameWidth: z.ZodOptional<z.ZodNumber>;
236
+ frameHeight: z.ZodOptional<z.ZodNumber>;
194
237
  }, z.core.$strip>>>;
195
238
  readonly 'scene-created': z.ZodIntersection<z.ZodObject<{
196
239
  kind: z.ZodLiteral<"scene-created">;
@@ -10,42 +10,76 @@ exports.sCameraPtzPresetSaved = zod_1.z.object({
10
10
  presetInfo: primitives_1.sCameraPresetInfo,
11
11
  assignedRef: zod_1.z.string().nullable(),
12
12
  });
13
+ /** A box in the picture the object was detected in, in pixels of that picture. */
13
14
  exports.sBoxLocator = zod_1.z.object({
14
15
  locatorKind: zod_1.z.literal('box'),
15
16
  x1: zod_1.z.number(),
16
17
  y1: zod_1.z.number(),
17
18
  x2: zod_1.z.number(),
18
19
  y2: zod_1.z.number(),
20
+ frameWidth: zod_1.z
21
+ .number()
22
+ .positive()
23
+ .optional()
24
+ .describe('Width in pixels of the picture the box is measured in, which is not necessarily the stream resolution'),
25
+ frameHeight: zod_1.z
26
+ .number()
27
+ .positive()
28
+ .optional()
29
+ .describe('Height in pixels of the picture the box is measured in'),
19
30
  });
20
31
  exports.sObjectLocator = exports.sBoxLocator;
21
32
  exports.sObjectDetectionData = zod_1.z
22
33
  .object({
23
34
  objectKind: primitives_1.sWorldObjectId.nullable(),
24
35
  probability: zod_1.z.number(),
25
- identifiedObjectId: zod_1.z.string().nullable(),
36
+ identifiedObjectId: zod_1.z
37
+ .string()
38
+ .nullable()
39
+ .describe('Who or what the object was identified as. For faces, the Aware person id.'),
40
+ identificationScore: zod_1.z
41
+ .number()
42
+ .nullable()
43
+ .optional()
44
+ .describe('Confidence of identifiedObjectId, 0 to 1, when known'),
45
+ providerZones: zod_1.z
46
+ .array(zod_1.z.string())
47
+ .optional()
48
+ .describe("Names of the detection provider's zones the object is in now. These are the vendor's zones, not Aware Zones."),
49
+ stationary: zod_1.z
50
+ .boolean()
51
+ .optional()
52
+ .describe('Whether the object has stopped moving'),
26
53
  frameTime: zod_1.z.number(),
27
54
  startTime: zod_1.z.number(),
28
55
  endTime: zod_1.z.number().nullable(),
29
56
  })
30
57
  .and(exports.sObjectLocator);
58
+ const sProviderAssignedRef = zod_1.z
59
+ .string()
60
+ .nonempty()
61
+ .describe('Correlates the events of one detected object, from started to ended; unique only with the provider and camera');
62
+ /**
63
+ * A detected object's events: started once, then any number of updated, then ended once.
64
+ */
31
65
  exports.sObjectDetectionStarted = zod_1.z
32
66
  .object({
33
67
  kind: zod_1.z.literal('object-detection-started'),
34
- providerAssignedRef: zod_1.z.string().nonempty(),
68
+ providerAssignedRef: sProviderAssignedRef,
35
69
  detectionProvider: zod_1.z.string().nonempty(),
36
70
  })
37
71
  .and(exports.sObjectDetectionData);
38
72
  exports.sObjectDetectionUpdated = zod_1.z
39
73
  .object({
40
74
  kind: zod_1.z.literal('object-detection-updated'),
41
- providerAssignedRef: zod_1.z.string().nonempty(),
75
+ providerAssignedRef: sProviderAssignedRef,
42
76
  detectionProvider: zod_1.z.string().nonempty(),
43
77
  })
44
78
  .and(exports.sObjectDetectionData);
45
79
  exports.sObjectDetectionEnded = zod_1.z
46
80
  .object({
47
81
  kind: zod_1.z.literal('object-detection-ended'),
48
- providerAssignedRef: zod_1.z.string().nonempty(),
82
+ providerAssignedRef: sProviderAssignedRef,
49
83
  detectionProvider: zod_1.z.string().nonempty(),
50
84
  })
51
85
  .and(exports.sObjectDetectionData);
@@ -1,8 +1,45 @@
1
1
  import z from 'zod';
2
- export declare const sAddLayoutRequest: z.ZodObject<{
2
+ export declare const sAddImageLayoutRequest: z.ZodObject<{
3
3
  name: z.ZodString;
4
+ order: z.ZodOptional<z.ZodNumber>;
5
+ devices: z.ZodArray<z.ZodObject<{
6
+ deviceId: z.ZodString;
7
+ x: z.ZodNumber;
8
+ y: z.ZodNumber;
9
+ scale: z.ZodNumber;
10
+ rotation: z.ZodNumber;
11
+ fov: z.ZodNumber;
12
+ far: z.ZodNumber;
13
+ displayAs: z.ZodNullable<z.ZodString>;
14
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
16
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
17
+ width: z.ZodOptional<z.ZodNumber>;
18
+ hinge: z.ZodOptional<z.ZodEnum<{
19
+ start: "start";
20
+ end: "end";
21
+ }>>;
22
+ opens: z.ZodOptional<z.ZodEnum<{
23
+ right: "right";
24
+ left: "left";
25
+ }>>;
26
+ size: z.ZodOptional<z.ZodNumber>;
27
+ room: z.ZodOptional<z.ZodString>;
28
+ viewId: z.ZodOptional<z.ZodString>;
29
+ calibration: z.ZodOptional<z.ZodObject<{
30
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
31
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
32
+ }, z.core.$strip>>;
33
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
34
+ }, z.core.$strip>>>;
35
+ }, z.core.$strip>>;
36
+ colorize: z.ZodBoolean;
37
+ kind: z.ZodLiteral<"image">;
4
38
  thumbnailId: z.ZodString;
5
39
  imageId: z.ZodString;
40
+ }, z.core.$strip>;
41
+ export declare const sAddMapLayoutRequest: z.ZodObject<{
42
+ name: z.ZodString;
6
43
  order: z.ZodOptional<z.ZodNumber>;
7
44
  devices: z.ZodArray<z.ZodObject<{
8
45
  deviceId: z.ZodString;
@@ -13,10 +50,188 @@ export declare const sAddLayoutRequest: z.ZodObject<{
13
50
  fov: z.ZodNumber;
14
51
  far: z.ZodNumber;
15
52
  displayAs: z.ZodNullable<z.ZodString>;
53
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
55
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
56
+ width: z.ZodOptional<z.ZodNumber>;
57
+ hinge: z.ZodOptional<z.ZodEnum<{
58
+ start: "start";
59
+ end: "end";
60
+ }>>;
61
+ opens: z.ZodOptional<z.ZodEnum<{
62
+ right: "right";
63
+ left: "left";
64
+ }>>;
65
+ size: z.ZodOptional<z.ZodNumber>;
66
+ room: z.ZodOptional<z.ZodString>;
67
+ viewId: z.ZodOptional<z.ZodString>;
68
+ calibration: z.ZodOptional<z.ZodObject<{
69
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
70
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
71
+ }, z.core.$strip>>;
72
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
73
+ }, z.core.$strip>>>;
16
74
  }, z.core.$strip>>;
17
75
  colorize: z.ZodBoolean;
76
+ kind: z.ZodLiteral<"map">;
77
+ }, z.core.$strip>;
78
+ /** An image layout, or a map layout when `map` is true, chosen by a flag rather than by `kind`. */
79
+ export declare const sAddImageOrMapLayoutRequest: z.ZodObject<{
80
+ name: z.ZodString;
81
+ order: z.ZodOptional<z.ZodNumber>;
82
+ devices: z.ZodArray<z.ZodObject<{
83
+ deviceId: z.ZodString;
84
+ x: z.ZodNumber;
85
+ y: z.ZodNumber;
86
+ scale: z.ZodNumber;
87
+ rotation: z.ZodNumber;
88
+ fov: z.ZodNumber;
89
+ far: z.ZodNumber;
90
+ displayAs: z.ZodNullable<z.ZodString>;
91
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
93
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
94
+ width: z.ZodOptional<z.ZodNumber>;
95
+ hinge: z.ZodOptional<z.ZodEnum<{
96
+ start: "start";
97
+ end: "end";
98
+ }>>;
99
+ opens: z.ZodOptional<z.ZodEnum<{
100
+ right: "right";
101
+ left: "left";
102
+ }>>;
103
+ size: z.ZodOptional<z.ZodNumber>;
104
+ room: z.ZodOptional<z.ZodString>;
105
+ viewId: z.ZodOptional<z.ZodString>;
106
+ calibration: z.ZodOptional<z.ZodObject<{
107
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
108
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
109
+ }, z.core.$strip>>;
110
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
111
+ }, z.core.$strip>>>;
112
+ }, z.core.$strip>>;
113
+ colorize: z.ZodBoolean;
114
+ thumbnailId: z.ZodString;
115
+ imageId: z.ZodString;
18
116
  map: z.ZodBoolean;
19
117
  }, z.core.$strip>;
118
+ /** `3d` layouts are created by importing their model (POST /layouts/models). */
119
+ export declare const sAddLayoutRequest: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ name: z.ZodString;
121
+ order: z.ZodOptional<z.ZodNumber>;
122
+ devices: z.ZodArray<z.ZodObject<{
123
+ deviceId: z.ZodString;
124
+ x: z.ZodNumber;
125
+ y: z.ZodNumber;
126
+ scale: z.ZodNumber;
127
+ rotation: z.ZodNumber;
128
+ fov: z.ZodNumber;
129
+ far: z.ZodNumber;
130
+ displayAs: z.ZodNullable<z.ZodString>;
131
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
133
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
134
+ width: z.ZodOptional<z.ZodNumber>;
135
+ hinge: z.ZodOptional<z.ZodEnum<{
136
+ start: "start";
137
+ end: "end";
138
+ }>>;
139
+ opens: z.ZodOptional<z.ZodEnum<{
140
+ right: "right";
141
+ left: "left";
142
+ }>>;
143
+ size: z.ZodOptional<z.ZodNumber>;
144
+ room: z.ZodOptional<z.ZodString>;
145
+ viewId: z.ZodOptional<z.ZodString>;
146
+ calibration: z.ZodOptional<z.ZodObject<{
147
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
148
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
149
+ }, z.core.$strip>>;
150
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
151
+ }, z.core.$strip>>>;
152
+ }, z.core.$strip>>;
153
+ colorize: z.ZodBoolean;
154
+ kind: z.ZodLiteral<"image">;
155
+ thumbnailId: z.ZodString;
156
+ imageId: z.ZodString;
157
+ }, z.core.$strip>, z.ZodObject<{
158
+ name: z.ZodString;
159
+ order: z.ZodOptional<z.ZodNumber>;
160
+ devices: z.ZodArray<z.ZodObject<{
161
+ deviceId: z.ZodString;
162
+ x: z.ZodNumber;
163
+ y: z.ZodNumber;
164
+ scale: z.ZodNumber;
165
+ rotation: z.ZodNumber;
166
+ fov: z.ZodNumber;
167
+ far: z.ZodNumber;
168
+ displayAs: z.ZodNullable<z.ZodString>;
169
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
170
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
171
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
172
+ width: z.ZodOptional<z.ZodNumber>;
173
+ hinge: z.ZodOptional<z.ZodEnum<{
174
+ start: "start";
175
+ end: "end";
176
+ }>>;
177
+ opens: z.ZodOptional<z.ZodEnum<{
178
+ right: "right";
179
+ left: "left";
180
+ }>>;
181
+ size: z.ZodOptional<z.ZodNumber>;
182
+ room: z.ZodOptional<z.ZodString>;
183
+ viewId: z.ZodOptional<z.ZodString>;
184
+ calibration: z.ZodOptional<z.ZodObject<{
185
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
186
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
187
+ }, z.core.$strip>>;
188
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
189
+ }, z.core.$strip>>>;
190
+ }, z.core.$strip>>;
191
+ colorize: z.ZodBoolean;
192
+ kind: z.ZodLiteral<"map">;
193
+ }, z.core.$strip>], "kind">, z.ZodObject<{
194
+ name: z.ZodString;
195
+ order: z.ZodOptional<z.ZodNumber>;
196
+ devices: z.ZodArray<z.ZodObject<{
197
+ deviceId: z.ZodString;
198
+ x: z.ZodNumber;
199
+ y: z.ZodNumber;
200
+ scale: z.ZodNumber;
201
+ rotation: z.ZodNumber;
202
+ fov: z.ZodNumber;
203
+ far: z.ZodNumber;
204
+ displayAs: z.ZodNullable<z.ZodString>;
205
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
207
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
208
+ width: z.ZodOptional<z.ZodNumber>;
209
+ hinge: z.ZodOptional<z.ZodEnum<{
210
+ start: "start";
211
+ end: "end";
212
+ }>>;
213
+ opens: z.ZodOptional<z.ZodEnum<{
214
+ right: "right";
215
+ left: "left";
216
+ }>>;
217
+ size: z.ZodOptional<z.ZodNumber>;
218
+ room: z.ZodOptional<z.ZodString>;
219
+ viewId: z.ZodOptional<z.ZodString>;
220
+ calibration: z.ZodOptional<z.ZodObject<{
221
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
222
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
223
+ }, z.core.$strip>>;
224
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
225
+ }, z.core.$strip>>>;
226
+ }, z.core.$strip>>;
227
+ colorize: z.ZodBoolean;
228
+ thumbnailId: z.ZodString;
229
+ imageId: z.ZodString;
230
+ map: z.ZodBoolean;
231
+ }, z.core.$strip>]>;
232
+ export type AddImageLayoutRequest = z.infer<typeof sAddImageLayoutRequest>;
233
+ export type AddMapLayoutRequest = z.infer<typeof sAddMapLayoutRequest>;
234
+ export type AddImageOrMapLayoutRequest = z.infer<typeof sAddImageOrMapLayoutRequest>;
20
235
  export type AddLayoutRequest = z.infer<typeof sAddLayoutRequest>;
21
236
  export declare const sUpdateLayoutRequest: z.ZodObject<{
22
237
  name: z.ZodOptional<z.ZodString>;
@@ -33,7 +248,29 @@ export declare const sUpdateLayoutRequest: z.ZodObject<{
33
248
  fov: z.ZodNumber;
34
249
  far: z.ZodNumber;
35
250
  displayAs: z.ZodNullable<z.ZodString>;
251
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
253
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
254
+ width: z.ZodOptional<z.ZodNumber>;
255
+ hinge: z.ZodOptional<z.ZodEnum<{
256
+ start: "start";
257
+ end: "end";
258
+ }>>;
259
+ opens: z.ZodOptional<z.ZodEnum<{
260
+ right: "right";
261
+ left: "left";
262
+ }>>;
263
+ size: z.ZodOptional<z.ZodNumber>;
264
+ room: z.ZodOptional<z.ZodString>;
265
+ viewId: z.ZodOptional<z.ZodString>;
266
+ calibration: z.ZodOptional<z.ZodObject<{
267
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
268
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
269
+ }, z.core.$strip>>;
270
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
271
+ }, z.core.$strip>>>;
36
272
  }, z.core.$strip>>>;
273
+ placementsRev: z.ZodOptional<z.ZodNumber>;
37
274
  colorize: z.ZodOptional<z.ZodBoolean>;
38
275
  map: z.ZodOptional<z.ZodBoolean>;
39
276
  }, z.core.$strip>;
@@ -3,25 +3,55 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.sUpdateLayoutRequest = exports.sAddLayoutRequest = void 0;
6
+ exports.sUpdateLayoutRequest = exports.sAddLayoutRequest = exports.sAddImageOrMapLayoutRequest = exports.sAddMapLayoutRequest = exports.sAddImageLayoutRequest = void 0;
7
7
  const layout_1 = require("../../objects/layout");
8
8
  const zod_1 = __importDefault(require("zod"));
9
- exports.sAddLayoutRequest = zod_1.default.object({
9
+ const sAddLayoutBase = zod_1.default.object({
10
10
  name: zod_1.default.string().nonempty(),
11
- thumbnailId: zod_1.default.string().nonempty(),
12
- imageId: zod_1.default.string().nonempty(),
13
11
  order: zod_1.default.number().optional(),
14
12
  devices: zod_1.default.array(layout_1.sLayoutDeviceDto),
15
13
  colorize: zod_1.default.boolean(),
16
- map: zod_1.default.boolean(),
17
14
  });
15
+ exports.sAddImageLayoutRequest = sAddLayoutBase.extend({
16
+ kind: zod_1.default.literal('image'),
17
+ thumbnailId: zod_1.default.string().nonempty(),
18
+ imageId: zod_1.default.string().nonempty(),
19
+ });
20
+ exports.sAddMapLayoutRequest = sAddLayoutBase.extend({
21
+ kind: zod_1.default.literal('map'),
22
+ });
23
+ /** An image layout, or a map layout when `map` is true, chosen by a flag rather than by `kind`. */
24
+ exports.sAddImageOrMapLayoutRequest = sAddLayoutBase.extend({
25
+ thumbnailId: zod_1.default.string().nonempty(),
26
+ imageId: zod_1.default.string().nonempty(),
27
+ map: zod_1.default.boolean().describe('True for a map layout, false for an image layout'),
28
+ });
29
+ /** `3d` layouts are created by importing their model (POST /layouts/models). */
30
+ exports.sAddLayoutRequest = zod_1.default.union([
31
+ zod_1.default.discriminatedUnion('kind', [exports.sAddImageLayoutRequest, exports.sAddMapLayoutRequest]),
32
+ exports.sAddImageOrMapLayoutRequest,
33
+ ]);
18
34
  exports.sUpdateLayoutRequest = zod_1.default.object({
19
35
  name: zod_1.default.string().optional(),
20
- thumbnailId: zod_1.default.string().optional(),
21
- imageId: zod_1.default.string().optional(),
36
+ thumbnailId: zod_1.default
37
+ .string()
38
+ .optional()
39
+ .describe('Not for 3d layouts, which have no image'),
40
+ imageId: zod_1.default
41
+ .string()
42
+ .optional()
43
+ .describe('Not for 3d layouts, which have no image'),
22
44
  order: zod_1.default.number().optional(),
23
45
  isDefault: zod_1.default.boolean().optional(),
24
46
  devices: zod_1.default.array(layout_1.sLayoutDeviceDto).optional(),
47
+ placementsRev: zod_1.default
48
+ .number()
49
+ .int()
50
+ .optional()
51
+ .describe("The layout's placementsRev the devices were edited from. When sent with devices, the save is refused if someone else saved meanwhile."),
25
52
  colorize: zod_1.default.boolean().optional(),
26
- map: zod_1.default.boolean().optional(),
53
+ map: zod_1.default
54
+ .boolean()
55
+ .optional()
56
+ .describe('Ignored: a layout keeps the kind it was made with'),
27
57
  });
@@ -1,4 +1,51 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * What a layout's document is, fixed when the layout is created:
4
+ * - `image`: a plan image (SVG/PNG); devices are placed on the image.
5
+ * - `map`: the world map; devices are placed on the map.
6
+ * - `3d`: a 3D model (model.json plus plan images); devices are placed on the model's levels, in metres.
7
+ */
8
+ export declare const sLayoutKind: z.ZodEnum<{
9
+ map: "map";
10
+ image: "image";
11
+ "3d": "3d";
12
+ }>;
13
+ export type LayoutKind = z.infer<typeof sLayoutKind>;
14
+ /** Four points in a camera's picture, as fractions of its width and height, and the four level points they show. */
15
+ export declare const sCameraCalibration: z.ZodObject<{
16
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
17
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
18
+ }, z.core.$strip>;
19
+ export type CameraCalibration = z.infer<typeof sCameraCalibration>;
20
+ /** Placement attributes that only some device types use. Absent keys take the device type's defaults. */
21
+ export declare const sLayoutDeviceExtras: z.ZodObject<{
22
+ width: z.ZodOptional<z.ZodNumber>;
23
+ hinge: z.ZodOptional<z.ZodEnum<{
24
+ start: "start";
25
+ end: "end";
26
+ }>>;
27
+ opens: z.ZodOptional<z.ZodEnum<{
28
+ right: "right";
29
+ left: "left";
30
+ }>>;
31
+ size: z.ZodOptional<z.ZodNumber>;
32
+ room: z.ZodOptional<z.ZodString>;
33
+ viewId: z.ZodOptional<z.ZodString>;
34
+ calibration: z.ZodOptional<z.ZodObject<{
35
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
36
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
37
+ }, z.core.$strip>>;
38
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
39
+ }, z.core.$strip>;
40
+ export type LayoutDeviceExtras = z.infer<typeof sLayoutDeviceExtras>;
41
+ /**
42
+ * A device placed on a layout. What x, y and rotation mean depends on the layout's kind:
43
+ * - `image` and `map`: a position on the image or map, as the layout editor stores it.
44
+ * - `3d`: metres on the level, x along the model's x axis (towards the bow) and y along its z axis; rotation is the
45
+ * heading in degrees, 0 towards +x and 90 towards +y; scale is 1.
46
+ *
47
+ * In requests, `level`, `height` and `extras` left out keep their stored values, and null clears them.
48
+ */
2
49
  export declare const sLayoutDeviceDto: z.ZodObject<{
3
50
  deviceId: z.ZodString;
4
51
  x: z.ZodNumber;
@@ -8,13 +55,77 @@ export declare const sLayoutDeviceDto: z.ZodObject<{
8
55
  fov: z.ZodNumber;
9
56
  far: z.ZodNumber;
10
57
  displayAs: z.ZodNullable<z.ZodString>;
58
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
60
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
61
+ width: z.ZodOptional<z.ZodNumber>;
62
+ hinge: z.ZodOptional<z.ZodEnum<{
63
+ start: "start";
64
+ end: "end";
65
+ }>>;
66
+ opens: z.ZodOptional<z.ZodEnum<{
67
+ right: "right";
68
+ left: "left";
69
+ }>>;
70
+ size: z.ZodOptional<z.ZodNumber>;
71
+ room: z.ZodOptional<z.ZodString>;
72
+ viewId: z.ZodOptional<z.ZodString>;
73
+ calibration: z.ZodOptional<z.ZodObject<{
74
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
75
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
76
+ }, z.core.$strip>>;
77
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
78
+ }, z.core.$strip>>>;
11
79
  }, z.core.$strip>;
12
80
  export type LayoutDeviceDto = z.infer<typeof sLayoutDeviceDto>;
13
- export declare const sLayoutDto: z.ZodObject<{
81
+ export declare const sImageLayoutDto: z.ZodObject<{
14
82
  id: z.ZodString;
15
83
  name: z.ZodString;
16
- thumbnailUrl: z.ZodString;
84
+ order: z.ZodNumber;
85
+ isDefault: z.ZodBoolean;
86
+ devices: z.ZodArray<z.ZodObject<{
87
+ deviceId: z.ZodString;
88
+ x: z.ZodNumber;
89
+ y: z.ZodNumber;
90
+ scale: z.ZodNumber;
91
+ rotation: z.ZodNumber;
92
+ fov: z.ZodNumber;
93
+ far: z.ZodNumber;
94
+ displayAs: z.ZodNullable<z.ZodString>;
95
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
96
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
97
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
98
+ width: z.ZodOptional<z.ZodNumber>;
99
+ hinge: z.ZodOptional<z.ZodEnum<{
100
+ start: "start";
101
+ end: "end";
102
+ }>>;
103
+ opens: z.ZodOptional<z.ZodEnum<{
104
+ right: "right";
105
+ left: "left";
106
+ }>>;
107
+ size: z.ZodOptional<z.ZodNumber>;
108
+ room: z.ZodOptional<z.ZodString>;
109
+ viewId: z.ZodOptional<z.ZodString>;
110
+ calibration: z.ZodOptional<z.ZodObject<{
111
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
112
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
113
+ }, z.core.$strip>>;
114
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
115
+ }, z.core.$strip>>>;
116
+ }, z.core.$strip>>;
117
+ colorize: z.ZodBoolean;
118
+ placementsRev: z.ZodNumber;
119
+ map: z.ZodBoolean;
120
+ createdOn: z.ZodString;
121
+ lastModifiedOn: z.ZodString;
122
+ kind: z.ZodLiteral<"image">;
17
123
  imageUrl: z.ZodString;
124
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
125
+ }, z.core.$strip>;
126
+ export declare const sMapLayoutDto: z.ZodObject<{
127
+ id: z.ZodString;
128
+ name: z.ZodString;
18
129
  order: z.ZodNumber;
19
130
  isDefault: z.ZodBoolean;
20
131
  devices: z.ZodArray<z.ZodObject<{
@@ -26,10 +137,221 @@ export declare const sLayoutDto: z.ZodObject<{
26
137
  fov: z.ZodNumber;
27
138
  far: z.ZodNumber;
28
139
  displayAs: z.ZodNullable<z.ZodString>;
140
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
142
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
143
+ width: z.ZodOptional<z.ZodNumber>;
144
+ hinge: z.ZodOptional<z.ZodEnum<{
145
+ start: "start";
146
+ end: "end";
147
+ }>>;
148
+ opens: z.ZodOptional<z.ZodEnum<{
149
+ right: "right";
150
+ left: "left";
151
+ }>>;
152
+ size: z.ZodOptional<z.ZodNumber>;
153
+ room: z.ZodOptional<z.ZodString>;
154
+ viewId: z.ZodOptional<z.ZodString>;
155
+ calibration: z.ZodOptional<z.ZodObject<{
156
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
157
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
158
+ }, z.core.$strip>>;
159
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
160
+ }, z.core.$strip>>>;
29
161
  }, z.core.$strip>>;
30
162
  colorize: z.ZodBoolean;
163
+ placementsRev: z.ZodNumber;
31
164
  map: z.ZodBoolean;
32
165
  createdOn: z.ZodString;
33
166
  lastModifiedOn: z.ZodString;
167
+ kind: z.ZodLiteral<"map">;
168
+ imageUrl: z.ZodOptional<z.ZodString>;
169
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
34
170
  }, z.core.$strip>;
171
+ export declare const sModelLayoutDto: z.ZodObject<{
172
+ id: z.ZodString;
173
+ name: z.ZodString;
174
+ order: z.ZodNumber;
175
+ isDefault: z.ZodBoolean;
176
+ devices: z.ZodArray<z.ZodObject<{
177
+ deviceId: z.ZodString;
178
+ x: z.ZodNumber;
179
+ y: z.ZodNumber;
180
+ scale: z.ZodNumber;
181
+ rotation: z.ZodNumber;
182
+ fov: z.ZodNumber;
183
+ far: z.ZodNumber;
184
+ displayAs: z.ZodNullable<z.ZodString>;
185
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
186
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
187
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
188
+ width: z.ZodOptional<z.ZodNumber>;
189
+ hinge: z.ZodOptional<z.ZodEnum<{
190
+ start: "start";
191
+ end: "end";
192
+ }>>;
193
+ opens: z.ZodOptional<z.ZodEnum<{
194
+ right: "right";
195
+ left: "left";
196
+ }>>;
197
+ size: z.ZodOptional<z.ZodNumber>;
198
+ room: z.ZodOptional<z.ZodString>;
199
+ viewId: z.ZodOptional<z.ZodString>;
200
+ calibration: z.ZodOptional<z.ZodObject<{
201
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
202
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
203
+ }, z.core.$strip>>;
204
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
205
+ }, z.core.$strip>>>;
206
+ }, z.core.$strip>>;
207
+ colorize: z.ZodBoolean;
208
+ placementsRev: z.ZodNumber;
209
+ map: z.ZodBoolean;
210
+ createdOn: z.ZodString;
211
+ lastModifiedOn: z.ZodString;
212
+ kind: z.ZodLiteral<"3d">;
213
+ }, z.core.$strip>;
214
+ export declare const sLayoutDto: z.ZodDiscriminatedUnion<[z.ZodObject<{
215
+ id: z.ZodString;
216
+ name: z.ZodString;
217
+ order: z.ZodNumber;
218
+ isDefault: z.ZodBoolean;
219
+ devices: z.ZodArray<z.ZodObject<{
220
+ deviceId: z.ZodString;
221
+ x: z.ZodNumber;
222
+ y: z.ZodNumber;
223
+ scale: z.ZodNumber;
224
+ rotation: z.ZodNumber;
225
+ fov: z.ZodNumber;
226
+ far: z.ZodNumber;
227
+ displayAs: z.ZodNullable<z.ZodString>;
228
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
229
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
230
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
231
+ width: z.ZodOptional<z.ZodNumber>;
232
+ hinge: z.ZodOptional<z.ZodEnum<{
233
+ start: "start";
234
+ end: "end";
235
+ }>>;
236
+ opens: z.ZodOptional<z.ZodEnum<{
237
+ right: "right";
238
+ left: "left";
239
+ }>>;
240
+ size: z.ZodOptional<z.ZodNumber>;
241
+ room: z.ZodOptional<z.ZodString>;
242
+ viewId: z.ZodOptional<z.ZodString>;
243
+ calibration: z.ZodOptional<z.ZodObject<{
244
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
245
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
246
+ }, z.core.$strip>>;
247
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
248
+ }, z.core.$strip>>>;
249
+ }, z.core.$strip>>;
250
+ colorize: z.ZodBoolean;
251
+ placementsRev: z.ZodNumber;
252
+ map: z.ZodBoolean;
253
+ createdOn: z.ZodString;
254
+ lastModifiedOn: z.ZodString;
255
+ kind: z.ZodLiteral<"image">;
256
+ imageUrl: z.ZodString;
257
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
258
+ }, z.core.$strip>, z.ZodObject<{
259
+ id: z.ZodString;
260
+ name: z.ZodString;
261
+ order: z.ZodNumber;
262
+ isDefault: z.ZodBoolean;
263
+ devices: z.ZodArray<z.ZodObject<{
264
+ deviceId: z.ZodString;
265
+ x: z.ZodNumber;
266
+ y: z.ZodNumber;
267
+ scale: z.ZodNumber;
268
+ rotation: z.ZodNumber;
269
+ fov: z.ZodNumber;
270
+ far: z.ZodNumber;
271
+ displayAs: z.ZodNullable<z.ZodString>;
272
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
273
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
274
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
275
+ width: z.ZodOptional<z.ZodNumber>;
276
+ hinge: z.ZodOptional<z.ZodEnum<{
277
+ start: "start";
278
+ end: "end";
279
+ }>>;
280
+ opens: z.ZodOptional<z.ZodEnum<{
281
+ right: "right";
282
+ left: "left";
283
+ }>>;
284
+ size: z.ZodOptional<z.ZodNumber>;
285
+ room: z.ZodOptional<z.ZodString>;
286
+ viewId: z.ZodOptional<z.ZodString>;
287
+ calibration: z.ZodOptional<z.ZodObject<{
288
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
289
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
290
+ }, z.core.$strip>>;
291
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
292
+ }, z.core.$strip>>>;
293
+ }, z.core.$strip>>;
294
+ colorize: z.ZodBoolean;
295
+ placementsRev: z.ZodNumber;
296
+ map: z.ZodBoolean;
297
+ createdOn: z.ZodString;
298
+ lastModifiedOn: z.ZodString;
299
+ kind: z.ZodLiteral<"map">;
300
+ imageUrl: z.ZodOptional<z.ZodString>;
301
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
302
+ }, z.core.$strip>, z.ZodObject<{
303
+ id: z.ZodString;
304
+ name: z.ZodString;
305
+ order: z.ZodNumber;
306
+ isDefault: z.ZodBoolean;
307
+ devices: z.ZodArray<z.ZodObject<{
308
+ deviceId: z.ZodString;
309
+ x: z.ZodNumber;
310
+ y: z.ZodNumber;
311
+ scale: z.ZodNumber;
312
+ rotation: z.ZodNumber;
313
+ fov: z.ZodNumber;
314
+ far: z.ZodNumber;
315
+ displayAs: z.ZodNullable<z.ZodString>;
316
+ level: z.ZodOptional<z.ZodNullable<z.ZodString>>;
317
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
318
+ extras: z.ZodOptional<z.ZodNullable<z.ZodObject<{
319
+ width: z.ZodOptional<z.ZodNumber>;
320
+ hinge: z.ZodOptional<z.ZodEnum<{
321
+ start: "start";
322
+ end: "end";
323
+ }>>;
324
+ opens: z.ZodOptional<z.ZodEnum<{
325
+ right: "right";
326
+ left: "left";
327
+ }>>;
328
+ size: z.ZodOptional<z.ZodNumber>;
329
+ room: z.ZodOptional<z.ZodString>;
330
+ viewId: z.ZodOptional<z.ZodString>;
331
+ calibration: z.ZodOptional<z.ZodObject<{
332
+ img: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
333
+ level: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
334
+ }, z.core.$strip>>;
335
+ zoneRooms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
336
+ }, z.core.$strip>>>;
337
+ }, z.core.$strip>>;
338
+ colorize: z.ZodBoolean;
339
+ placementsRev: z.ZodNumber;
340
+ map: z.ZodBoolean;
341
+ createdOn: z.ZodString;
342
+ lastModifiedOn: z.ZodString;
343
+ kind: z.ZodLiteral<"3d">;
344
+ }, z.core.$strip>], "kind">;
345
+ export type ImageLayoutDto = z.infer<typeof sImageLayoutDto>;
346
+ export type MapLayoutDto = z.infer<typeof sMapLayoutDto>;
347
+ export type ModelLayoutDto = z.infer<typeof sModelLayoutDto>;
35
348
  export type LayoutDto = z.infer<typeof sLayoutDto>;
349
+ /** The document of a `3d` layout: its model definition and the plan images the definition names. */
350
+ export declare const sLayoutModelDto: z.ZodObject<{
351
+ definition: z.ZodRecord<z.ZodString, z.ZodUnknown>;
352
+ plans: z.ZodArray<z.ZodObject<{
353
+ name: z.ZodString;
354
+ url: z.ZodString;
355
+ }, z.core.$strip>>;
356
+ }, z.core.$strip>;
357
+ export type LayoutModelDto = z.infer<typeof sLayoutModelDto>;
@@ -1,7 +1,69 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sLayoutDto = exports.sLayoutDeviceDto = void 0;
3
+ exports.sLayoutModelDto = exports.sLayoutDto = exports.sModelLayoutDto = exports.sMapLayoutDto = exports.sImageLayoutDto = exports.sLayoutDeviceDto = exports.sLayoutDeviceExtras = exports.sCameraCalibration = exports.sLayoutKind = void 0;
4
4
  const zod_1 = require("zod");
5
+ /**
6
+ * What a layout's document is, fixed when the layout is created:
7
+ * - `image`: a plan image (SVG/PNG); devices are placed on the image.
8
+ * - `map`: the world map; devices are placed on the map.
9
+ * - `3d`: a 3D model (model.json plus plan images); devices are placed on the model's levels, in metres.
10
+ */
11
+ exports.sLayoutKind = zod_1.z.enum(['image', 'map', '3d']);
12
+ const sPoint = zod_1.z.tuple([zod_1.z.number(), zod_1.z.number()]);
13
+ /** Four points in a camera's picture, as fractions of its width and height, and the four level points they show. */
14
+ exports.sCameraCalibration = zod_1.z.object({
15
+ img: zod_1.z.array(sPoint).length(4),
16
+ level: zod_1.z.array(sPoint).length(4),
17
+ });
18
+ /** Placement attributes that only some device types use. Absent keys take the device type's defaults. */
19
+ exports.sLayoutDeviceExtras = zod_1.z.object({
20
+ width: zod_1.z
21
+ .number()
22
+ .min(0.4)
23
+ .max(4)
24
+ .optional()
25
+ .describe('Door: width of the doorway in metres'),
26
+ hinge: zod_1.z
27
+ .enum(['start', 'end'])
28
+ .optional()
29
+ .describe('Door: the end of the doorway, along its rotation, the hinge is at (default start)'),
30
+ opens: zod_1.z
31
+ .enum(['right', 'left'])
32
+ .optional()
33
+ .describe('Door: the side of the doorway, looking along its rotation, the door swings to (default right)'),
34
+ size: zod_1.z
35
+ .number()
36
+ .min(0.3)
37
+ .max(6)
38
+ .optional()
39
+ .describe('Size of the device marker in metres'),
40
+ room: zod_1.z
41
+ .string()
42
+ .min(1)
43
+ .max(64)
44
+ .optional()
45
+ .describe("Room of the layout's document the device belongs to, when not the one it stands in"),
46
+ viewId: zod_1.z
47
+ .string()
48
+ .nonempty()
49
+ .optional()
50
+ .describe('View to open from the device'),
51
+ calibration: exports.sCameraCalibration
52
+ .optional()
53
+ .describe("Camera: maps points in the camera's picture to its level"),
54
+ zoneRooms: zod_1.z
55
+ .record(zod_1.z.string().min(1).max(128), zod_1.z.string().min(1).max(64))
56
+ .optional()
57
+ .describe("Camera: the detection provider's zone names, to rooms of the layout's document"),
58
+ });
59
+ /**
60
+ * A device placed on a layout. What x, y and rotation mean depends on the layout's kind:
61
+ * - `image` and `map`: a position on the image or map, as the layout editor stores it.
62
+ * - `3d`: metres on the level, x along the model's x axis (towards the bow) and y along its z axis; rotation is the
63
+ * heading in degrees, 0 towards +x and 90 towards +y; scale is 1.
64
+ *
65
+ * In requests, `level`, `height` and `extras` left out keep their stored values, and null clears them.
66
+ */
5
67
  exports.sLayoutDeviceDto = zod_1.z.object({
6
68
  deviceId: zod_1.z.string(),
7
69
  x: zod_1.z.number(),
@@ -11,17 +73,66 @@ exports.sLayoutDeviceDto = zod_1.z.object({
11
73
  fov: zod_1.z.number(),
12
74
  far: zod_1.z.number(),
13
75
  displayAs: zod_1.z.string().nullable(),
76
+ level: zod_1.z
77
+ .string()
78
+ .min(1)
79
+ .max(64)
80
+ .nullable()
81
+ .optional()
82
+ .describe("Level of the layout's document the device is on (3d: the model's deck id)"),
83
+ height: zod_1.z
84
+ .number()
85
+ .min(0)
86
+ .max(100)
87
+ .nullable()
88
+ .optional()
89
+ .describe('Metres above the level'),
90
+ extras: exports.sLayoutDeviceExtras.nullable().optional(),
14
91
  });
15
- exports.sLayoutDto = zod_1.z.object({
92
+ const sLayoutBase = zod_1.z.object({
16
93
  id: zod_1.z.string(),
17
94
  name: zod_1.z.string(),
18
- thumbnailUrl: zod_1.z.string(),
19
- imageUrl: zod_1.z.string(),
20
95
  order: zod_1.z.number(),
21
96
  isDefault: zod_1.z.boolean(),
22
97
  devices: zod_1.z.array(exports.sLayoutDeviceDto),
23
98
  colorize: zod_1.z.boolean(),
24
- map: zod_1.z.boolean(),
99
+ placementsRev: zod_1.z
100
+ .number()
101
+ .int()
102
+ .describe('Revision of the placements. Send it back when saving devices, to be refused if someone else saved meanwhile.'),
103
+ map: zod_1.z.boolean().describe('True when kind is map'),
25
104
  createdOn: zod_1.z.string(),
26
105
  lastModifiedOn: zod_1.z.string(),
27
106
  });
107
+ exports.sImageLayoutDto = sLayoutBase.extend({
108
+ kind: zod_1.z.literal('image'),
109
+ imageUrl: zod_1.z.string(),
110
+ thumbnailUrl: zod_1.z.string().optional(),
111
+ });
112
+ exports.sMapLayoutDto = sLayoutBase.extend({
113
+ kind: zod_1.z.literal('map'),
114
+ imageUrl: zod_1.z
115
+ .string()
116
+ .optional()
117
+ .describe('Present when the map layout was created with an image'),
118
+ thumbnailUrl: zod_1.z
119
+ .string()
120
+ .optional()
121
+ .describe('Present when the map layout was created with an image'),
122
+ });
123
+ exports.sModelLayoutDto = sLayoutBase.extend({
124
+ kind: zod_1.z.literal('3d'),
125
+ });
126
+ exports.sLayoutDto = zod_1.z.discriminatedUnion('kind', [
127
+ exports.sImageLayoutDto,
128
+ exports.sMapLayoutDto,
129
+ exports.sModelLayoutDto,
130
+ ]);
131
+ /** The document of a `3d` layout: its model definition and the plan images the definition names. */
132
+ exports.sLayoutModelDto = zod_1.z.object({
133
+ definition: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
134
+ plans: zod_1.z.array(zod_1.z.object({
135
+ name: zod_1.z.string().describe('Name the definition refers to the plan by'),
136
+ url: zod_1.z.string(),
137
+ })),
138
+ });
package/dist/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/Linc-Security-Systems/aware-essentials.git"
6
6
  },
7
- "version": "2.0.153",
7
+ "version": "2.0.154",
8
8
  "description": "Common types between backend, agent(s) and frontend(s)",
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/Linc-Security-Systems/aware-essentials.git"
6
6
  },
7
- "version": "2.0.153",
7
+ "version": "2.0.154",
8
8
  "description": "Common types between backend, agent(s) and frontend(s)",
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",