camstreamerlib 4.0.32 → 4.0.33-13547c1

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.
Files changed (35) hide show
  1. package/README.md +9 -0
  2. package/cjs/PlaneTrackerAPI.d.ts +25 -7
  3. package/cjs/PlaneTrackerAPI.js +2 -1
  4. package/cjs/browser.index.d.ts +2 -0
  5. package/cjs/browser.index.js +18 -0
  6. package/cjs/types/PlaneTrackerAPI.d.ts +125 -21
  7. package/cjs/types/PlaneTrackerAPI.js +28 -6
  8. package/cjs/types/PlaneTrackerAPI.test.d.ts +1 -0
  9. package/cjs/types/PlaneTrackerAPI.test.js +49 -0
  10. package/cjs/types/ws/PlaneTrackerEvents.d.ts +47 -0
  11. package/cjs/types/ws/PlaneTrackerEvents.js +15 -1
  12. package/cjs/ws/PlaneTrackerEvents.d.ts +1 -1
  13. package/cjs/ws/PlaneTrackerEvents.js +2 -2
  14. package/cjs/ws/PlaneTrackerEvents.test.d.ts +1 -0
  15. package/cjs/ws/PlaneTrackerEvents.test.js +27 -0
  16. package/esm/PlaneTrackerAPI.js +2 -1
  17. package/esm/browser.index.js +2 -0
  18. package/esm/types/PlaneTrackerAPI.js +28 -6
  19. package/esm/types/PlaneTrackerAPI.test.js +47 -0
  20. package/esm/types/ws/PlaneTrackerEvents.js +14 -0
  21. package/esm/ws/PlaneTrackerEvents.js +3 -3
  22. package/esm/ws/PlaneTrackerEvents.test.js +25 -0
  23. package/examples/README.md +43 -0
  24. package/examples/camstreamerlib.js +13201 -0
  25. package/examples/camswitcher-events.html +137 -0
  26. package/examples/planetracker-events.html +186 -0
  27. package/examples/utils/example.css +102 -0
  28. package/package.json +107 -103
  29. package/types/PlaneTrackerAPI.d.ts +25 -7
  30. package/types/browser.index.d.ts +2 -0
  31. package/types/types/PlaneTrackerAPI.d.ts +125 -21
  32. package/types/types/PlaneTrackerAPI.test.d.ts +1 -0
  33. package/types/types/ws/PlaneTrackerEvents.d.ts +47 -0
  34. package/types/ws/PlaneTrackerEvents.d.ts +1 -1
  35. package/types/ws/PlaneTrackerEvents.test.d.ts +1 -0
package/README.md CHANGED
@@ -39,6 +39,15 @@ npm install camstreamerlib
39
39
 
40
40
  </br>
41
41
 
42
+ # Examples
43
+
44
+ | Example | Description | Open in browser |
45
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
46
+ | [CamSwitcherEvents](examples/camswitcher-events.html) ([source](https://github.com/CamStreamer/CamStreamerLib/blob/master/examples/camswitcher-events.html)) | Logs every CamSwitcher event. `DeviceConnectClient` (HTTP) backs [CamSwitcherAPI](doc/CamSwitcherAPI.md) to obtain the websocket authorization token, `DeviceConnectWsClient` (websocket) backs [CamSwitcherEvents](doc/ws/CamSwitcherEvents.md), which validates and dispatches the events. Connection state is taken from the `authorization` event. | [open](https://camstreamer.github.io/CamStreamerLib/examples/camswitcher-events.html) |
47
+ | [PlaneTrackerEvents](examples/planetracker-events.html) ([source](https://github.com/CamStreamer/CamStreamerLib/blob/master/examples/planetracker-events.html)) | Logs every PlaneTracker event. PlaneTracker needs no authorization token — [PlaneTrackerEvents](doc/ws/PlaneTrackerEvents.md) announces the connecting user (`userId` / `userName` / `userPriority`, editable in the form) as the init message instead, so only the websocket client is needed. The continuous `CAMERA_POSITION` and `FLIGHT_LIST` events only update the summary line unless the checkbox is ticked. | [open](https://camstreamer.github.io/CamStreamerLib/examples/planetracker-events.html) |
48
+
49
+ </br>
50
+
42
51
  # Breaking Changes
43
52
 
44
53
  <details open>
@@ -99,11 +99,29 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
99
99
  priority: number;
100
100
  };
101
101
  identificationLabel: {
102
- firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
103
- secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
104
- thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
105
- fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
106
- opacity: number;
102
+ aircraft: {
103
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
104
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
105
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
106
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
107
+ opacity: number;
108
+ };
109
+ drone: {
110
+ firstRow: "blank" | "remote_id";
111
+ opacity: number;
112
+ };
113
+ } | {
114
+ aircraft: {
115
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
116
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
117
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
118
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
119
+ opacity: number;
120
+ };
121
+ drone: {
122
+ firstRow: "blank" | "remote_id";
123
+ opacity: number;
124
+ };
107
125
  };
108
126
  acs: {
109
127
  ip: string;
@@ -181,11 +199,11 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
181
199
  importAppSettings(dataType: TImportDataType, formData: Parameters<Client['post']>[0]['data'], options?: THttpRequestOptions): Promise<void>;
182
200
  getDomainList(options?: THttpRequestOptions): Promise<Partial<Record<"adsb" | "remoteId", {
183
201
  uiName: string;
184
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
202
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
185
203
  categoryList: {
186
204
  categoryId: string;
187
205
  uiName: string;
188
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
206
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
189
207
  }[];
190
208
  }>>>;
191
209
  fetchFlightInfo(targetId: string, options?: THttpRequestOptions): Promise<{
@@ -5,12 +5,13 @@ const zod_1 = require("zod");
5
5
  const PlaneTrackerAPI_1 = require("./types/PlaneTrackerAPI");
6
6
  const errors_1 = require("./errors/errors");
7
7
  const BasicAPI_1 = require("./internal/BasicAPI");
8
+ const PlaneTrackerEvents_1 = require("./types/ws/PlaneTrackerEvents");
8
9
  const BASE_PATH = '/local/planetracker';
9
10
  class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
10
11
  apiUser;
11
12
  constructor(client, apiUser) {
12
13
  super(client);
13
- this.apiUser = apiUser;
14
+ this.apiUser = PlaneTrackerEvents_1.apiUserInputSchema.parse(apiUser);
14
15
  }
15
16
  static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
16
17
  static getWsEventsPath = () => `${BASE_PATH}/package/ws`;
@@ -0,0 +1,2 @@
1
+ export * from './index';
2
+ export * from './web/index';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./index"), exports);
18
+ __exportStar(require("./web/index"), exports);
@@ -69,6 +69,8 @@ export declare const widgetSchema: z.ZodObject<{
69
69
  }>;
70
70
  declare const labelOptionsSchema: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
71
71
  export type TLabelOption = z.infer<typeof labelOptionsSchema>;
72
+ declare const droneLabelOptionsSchema: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"remote_id">]>;
73
+ export type TDroneLabelOption = z.infer<typeof droneLabelOptionsSchema>;
72
74
  export declare const cameraSettingsSchema: z.ZodObject<{
73
75
  units: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"metric">, z.ZodLiteral<"imperial">]>>;
74
76
  adsbSource: z.ZodDefault<z.ZodObject<{
@@ -347,7 +349,61 @@ export declare const cameraSettingsSchema: z.ZodObject<{
347
349
  port?: number | undefined;
348
350
  priority?: number | undefined;
349
351
  }>>;
350
- identificationLabel: z.ZodDefault<z.ZodObject<{
352
+ identificationLabel: z.ZodDefault<z.ZodUnion<[z.ZodObject<{
353
+ aircraft: z.ZodObject<{
354
+ firstRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
355
+ secondRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
356
+ thirdRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
357
+ fourthRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
358
+ opacity: z.ZodNumber;
359
+ }, "strip", z.ZodTypeAny, {
360
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
361
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
362
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
363
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
364
+ opacity: number;
365
+ }, {
366
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
367
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
368
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
369
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
370
+ opacity: number;
371
+ }>;
372
+ drone: z.ZodDefault<z.ZodObject<{
373
+ firstRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"remote_id">]>;
374
+ opacity: z.ZodNumber;
375
+ }, "strip", z.ZodTypeAny, {
376
+ firstRow: "blank" | "remote_id";
377
+ opacity: number;
378
+ }, {
379
+ firstRow: "blank" | "remote_id";
380
+ opacity: number;
381
+ }>>;
382
+ }, "strip", z.ZodTypeAny, {
383
+ aircraft: {
384
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
385
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
386
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
387
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
388
+ opacity: number;
389
+ };
390
+ drone: {
391
+ firstRow: "blank" | "remote_id";
392
+ opacity: number;
393
+ };
394
+ }, {
395
+ aircraft: {
396
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
397
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
398
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
399
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
400
+ opacity: number;
401
+ };
402
+ drone?: {
403
+ firstRow: "blank" | "remote_id";
404
+ opacity: number;
405
+ } | undefined;
406
+ }>, z.ZodEffects<z.ZodObject<{
351
407
  firstRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
352
408
  secondRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
353
409
  thirdRow: z.ZodUnion<[z.ZodLiteral<"blank">, z.ZodLiteral<"registration">, z.ZodLiteral<"call_sign">, z.ZodLiteral<"flight_number">, z.ZodLiteral<"icao">]>;
@@ -365,7 +421,25 @@ export declare const cameraSettingsSchema: z.ZodObject<{
365
421
  thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
366
422
  fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
367
423
  opacity: number;
368
- }>>;
424
+ }>, {
425
+ aircraft: {
426
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
427
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
428
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
429
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
430
+ opacity: number;
431
+ };
432
+ drone: {
433
+ firstRow: "blank" | "remote_id";
434
+ opacity: number;
435
+ };
436
+ }, {
437
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
438
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
439
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
440
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
441
+ opacity: number;
442
+ }>]>>;
369
443
  acs: z.ZodDefault<z.ZodObject<{
370
444
  protocol: z.ZodUnion<[z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodLiteral<"https_insecure">]>;
371
445
  ip: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
@@ -514,11 +588,29 @@ export declare const cameraSettingsSchema: z.ZodObject<{
514
588
  priority: number;
515
589
  };
516
590
  identificationLabel: {
517
- firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
518
- secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
519
- thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
520
- fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
521
- opacity: number;
591
+ aircraft: {
592
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
593
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
594
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
595
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
596
+ opacity: number;
597
+ };
598
+ drone: {
599
+ firstRow: "blank" | "remote_id";
600
+ opacity: number;
601
+ };
602
+ } | {
603
+ aircraft: {
604
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
605
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
606
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
607
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
608
+ opacity: number;
609
+ };
610
+ drone: {
611
+ firstRow: "blank" | "remote_id";
612
+ opacity: number;
613
+ };
522
614
  };
523
615
  acs: {
524
616
  ip: string;
@@ -677,6 +769,18 @@ export declare const cameraSettingsSchema: z.ZodObject<{
677
769
  thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
678
770
  fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
679
771
  opacity: number;
772
+ } | {
773
+ aircraft: {
774
+ firstRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
775
+ secondRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
776
+ thirdRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
777
+ fourthRow: "blank" | "registration" | "call_sign" | "flight_number" | "icao";
778
+ opacity: number;
779
+ };
780
+ drone?: {
781
+ firstRow: "blank" | "remote_id";
782
+ opacity: number;
783
+ } | undefined;
680
784
  } | undefined;
681
785
  acs?: {
682
786
  ip: string;
@@ -1209,11 +1313,11 @@ declare const categoryDescriptorSchema: z.ZodObject<{
1209
1313
  }, "strip", z.ZodTypeAny, {
1210
1314
  categoryId: string;
1211
1315
  uiName: string;
1212
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1316
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1213
1317
  }, {
1214
1318
  categoryId: string;
1215
1319
  uiName: string;
1216
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1320
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1217
1321
  }>;
1218
1322
  export type TCategoryDescriptor = z.infer<typeof categoryDescriptorSchema>;
1219
1323
  declare const domainDescriptorSchema: z.ZodObject<{
@@ -1226,27 +1330,27 @@ declare const domainDescriptorSchema: z.ZodObject<{
1226
1330
  }, "strip", z.ZodTypeAny, {
1227
1331
  categoryId: string;
1228
1332
  uiName: string;
1229
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1333
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1230
1334
  }, {
1231
1335
  categoryId: string;
1232
1336
  uiName: string;
1233
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1337
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1234
1338
  }>, "many">;
1235
1339
  }, "strip", z.ZodTypeAny, {
1236
1340
  uiName: string;
1237
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1341
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1238
1342
  categoryList: {
1239
1343
  categoryId: string;
1240
1344
  uiName: string;
1241
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1345
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1242
1346
  }[];
1243
1347
  }, {
1244
1348
  uiName: string;
1245
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1349
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1246
1350
  categoryList: {
1247
1351
  categoryId: string;
1248
1352
  uiName: string;
1249
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1353
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1250
1354
  }[];
1251
1355
  }>;
1252
1356
  export type TDomainDescriptor = z.infer<typeof domainDescriptorSchema>;
@@ -1260,27 +1364,27 @@ export declare const domainListSchema: z.ZodRecord<z.ZodEnum<["adsb", "remoteId"
1260
1364
  }, "strip", z.ZodTypeAny, {
1261
1365
  categoryId: string;
1262
1366
  uiName: string;
1263
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1367
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1264
1368
  }, {
1265
1369
  categoryId: string;
1266
1370
  uiName: string;
1267
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1371
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1268
1372
  }>, "many">;
1269
1373
  }, "strip", z.ZodTypeAny, {
1270
1374
  uiName: string;
1271
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1375
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1272
1376
  categoryList: {
1273
1377
  categoryId: string;
1274
1378
  uiName: string;
1275
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1379
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1276
1380
  }[];
1277
1381
  }, {
1278
1382
  uiName: string;
1279
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1383
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1280
1384
  categoryList: {
1281
1385
  categoryId: string;
1282
1386
  uiName: string;
1283
- icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator" | "vehicle";
1387
+ icon: "unknown" | "small" | "drone" | "large" | "heavy" | "helicopter" | "operator" | "vehicle";
1284
1388
  }[];
1285
1389
  }>>;
1286
1390
  export type TDomainList = z.infer<typeof domainListSchema>;
@@ -40,13 +40,32 @@ const labelOptionsSchema = zod_1.z.union([
40
40
  zod_1.z.literal('flight_number'),
41
41
  zod_1.z.literal('icao'),
42
42
  ]);
43
- const identificationLabelSchema = zod_1.z.object({
43
+ const aircraftIdentificationLabelSchema = zod_1.z.object({
44
44
  firstRow: labelOptionsSchema,
45
45
  secondRow: labelOptionsSchema,
46
46
  thirdRow: labelOptionsSchema,
47
47
  fourthRow: labelOptionsSchema,
48
48
  opacity: zod_1.z.number().positive(),
49
49
  });
50
+ const droneLabelOptionsSchema = zod_1.z.union([zod_1.z.literal('blank'), zod_1.z.literal('remote_id')]);
51
+ const droneIdentificationLabelSchema = zod_1.z.object({
52
+ firstRow: droneLabelOptionsSchema,
53
+ opacity: zod_1.z.number().positive(),
54
+ });
55
+ const DEFAULT_DRONE_IDENTIFICATION_LABEL = {
56
+ firstRow: 'remote_id',
57
+ opacity: 30,
58
+ };
59
+ const identificationLabelSchema = zod_1.z.union([
60
+ zod_1.z.object({
61
+ aircraft: aircraftIdentificationLabelSchema,
62
+ drone: droneIdentificationLabelSchema.default(DEFAULT_DRONE_IDENTIFICATION_LABEL),
63
+ }),
64
+ aircraftIdentificationLabelSchema.transform((aircraft) => ({
65
+ aircraft,
66
+ drone: { ...DEFAULT_DRONE_IDENTIFICATION_LABEL },
67
+ })),
68
+ ]);
50
69
  exports.cameraSettingsSchema = zod_1.z.object({
51
70
  units: zod_1.z.union([zod_1.z.literal('metric'), zod_1.z.literal('imperial')]).default('imperial'),
52
71
  adsbSource: zod_1.z
@@ -203,11 +222,14 @@ exports.cameraSettingsSchema = zod_1.z.object({
203
222
  port: 80,
204
223
  }),
205
224
  identificationLabel: identificationLabelSchema.default({
206
- firstRow: 'registration',
207
- secondRow: 'blank',
208
- thirdRow: 'blank',
209
- fourthRow: 'blank',
210
- opacity: 30,
225
+ aircraft: {
226
+ firstRow: 'registration',
227
+ secondRow: 'blank',
228
+ thirdRow: 'blank',
229
+ fourthRow: 'blank',
230
+ opacity: 30,
231
+ },
232
+ drone: DEFAULT_DRONE_IDENTIFICATION_LABEL,
211
233
  }),
212
234
  acs: exports.connectionSchema
213
235
  .extend({
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const PlaneTrackerAPI_1 = require("./PlaneTrackerAPI");
4
+ const globals_1 = require("@jest/globals");
5
+ const AIRCRAFT_LABEL = {
6
+ firstRow: 'icao',
7
+ secondRow: 'call_sign',
8
+ thirdRow: 'blank',
9
+ fourthRow: 'registration',
10
+ opacity: 50,
11
+ };
12
+ const DEFAULT_DRONE_LABEL = { firstRow: 'remote_id', opacity: 30 };
13
+ (0, globals_1.describe)('cameraSettingsSchema identificationLabel', () => {
14
+ (0, globals_1.test)('defaults both aircraft and drone labels', () => {
15
+ (0, globals_1.expect)(PlaneTrackerAPI_1.cameraSettingsSchema.parse({}).identificationLabel).toEqual({
16
+ aircraft: {
17
+ firstRow: 'registration',
18
+ secondRow: 'blank',
19
+ thirdRow: 'blank',
20
+ fourthRow: 'blank',
21
+ opacity: 30,
22
+ },
23
+ drone: DEFAULT_DRONE_LABEL,
24
+ });
25
+ });
26
+ (0, globals_1.test)('parses the aircraft and drone label', () => {
27
+ const identificationLabel = { aircraft: AIRCRAFT_LABEL, drone: { firstRow: 'blank', opacity: 70 } };
28
+ (0, globals_1.expect)(PlaneTrackerAPI_1.cameraSettingsSchema.parse({ identificationLabel }).identificationLabel).toEqual(identificationLabel);
29
+ });
30
+ (0, globals_1.test)('defaults a missing drone label', () => {
31
+ (0, globals_1.expect)(PlaneTrackerAPI_1.cameraSettingsSchema.parse({ identificationLabel: { aircraft: AIRCRAFT_LABEL } }).identificationLabel).toEqual({ aircraft: AIRCRAFT_LABEL, drone: DEFAULT_DRONE_LABEL });
32
+ });
33
+ (0, globals_1.test)('converts the legacy flat label to the aircraft label', () => {
34
+ (0, globals_1.expect)(PlaneTrackerAPI_1.cameraSettingsSchema.parse({ identificationLabel: AIRCRAFT_LABEL }).identificationLabel).toEqual({
35
+ aircraft: AIRCRAFT_LABEL,
36
+ drone: DEFAULT_DRONE_LABEL,
37
+ });
38
+ });
39
+ (0, globals_1.test)('returns an independent drone label for each legacy parse', () => {
40
+ const first = PlaneTrackerAPI_1.cameraSettingsSchema.parse({ identificationLabel: AIRCRAFT_LABEL });
41
+ first.identificationLabel.drone.opacity = 90;
42
+ const second = PlaneTrackerAPI_1.cameraSettingsSchema.parse({ identificationLabel: AIRCRAFT_LABEL });
43
+ (0, globals_1.expect)(second.identificationLabel.drone).toEqual(DEFAULT_DRONE_LABEL);
44
+ });
45
+ (0, globals_1.test)('rejects an unknown drone label row', () => {
46
+ const identificationLabel = { aircraft: AIRCRAFT_LABEL, drone: { firstRow: 'icao', opacity: 30 } };
47
+ (0, globals_1.expect)(PlaneTrackerAPI_1.cameraSettingsSchema.safeParse({ identificationLabel }).success).toBe(false);
48
+ });
49
+ });