camstreamerlib 4.0.27 → 4.0.28-f67e7db

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.
@@ -9,6 +9,7 @@ const CamSwitcherAPI_1 = require("./types/CamSwitcherAPI");
9
9
  const common_1 = require("./types/common");
10
10
  const VapixAPI_1 = require("./VapixAPI");
11
11
  const BasicAPI_1 = require("./internal/BasicAPI");
12
+ const helpers_1 = require("./helpers");
12
13
  const BASE_PATH = '/local/camswitcher/api';
13
14
  class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
14
15
  CustomFormData;
@@ -273,20 +274,7 @@ class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
273
274
  if (data[paramName] === undefined) {
274
275
  throw new errors_1.ParameterNotFoundError(paramName);
275
276
  }
276
- if (data[paramName] === '') {
277
- return {};
278
- }
279
- try {
280
- return JSON.parse(data[paramName] + '');
281
- }
282
- catch {
283
- try {
284
- return JSON.parse(decodeURIComponent((data[paramName] + '').replaceAll('\\', '')));
285
- }
286
- catch (e) {
287
- throw new errors_1.JsonParseError(paramName, data[paramName]);
288
- }
289
- }
277
+ return (0, helpers_1.jsonParseCameraParam)(data[paramName] + '', paramName);
290
278
  }
291
279
  async getUploadedFileList(clipName, storage, options) {
292
280
  const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
@@ -0,0 +1 @@
1
+ export declare const jsonParseCameraParam: (param: string, paramName: string) => any;
package/cjs/helpers.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonParseCameraParam = void 0;
4
+ const errors_1 = require("./errors/errors");
5
+ const jsonParseCameraParam = (param, paramName) => {
6
+ if (param === '') {
7
+ return {};
8
+ }
9
+ try {
10
+ return JSON.parse(param);
11
+ }
12
+ catch {
13
+ try {
14
+ return JSON.parse(decodeURIComponent(param.replaceAll('\\', '')));
15
+ }
16
+ catch (e) {
17
+ throw new errors_1.JsonParseError(paramName, param);
18
+ }
19
+ }
20
+ };
21
+ exports.jsonParseCameraParam = jsonParseCameraParam;
package/cjs/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export { CamScripterAPI } from './CamScripterAPI';
26
26
  export * from './types/CamScripterAPI';
27
27
  export { VapixAPI } from './VapixAPI';
28
28
  export * from './types/VapixAPI';
29
+ export * from './helpers';
package/cjs/index.js CHANGED
@@ -53,3 +53,4 @@ __exportStar(require("./types/CamScripterAPI"), exports);
53
53
  var VapixAPI_1 = require("./VapixAPI");
54
54
  Object.defineProperty(exports, "VapixAPI", { enumerable: true, get: function () { return VapixAPI_1.VapixAPI; } });
55
55
  __exportStar(require("./types/VapixAPI"), exports);
56
+ __exportStar(require("./helpers"), exports);
@@ -77,7 +77,7 @@ const parseVideoOptionsToVapixParams = (firmWareVersion, video) => {
77
77
  const nbrOfChannels = video.nbrOfChannels ? (video.audio === 1 ? `&nbrOfChannels=${video.nbrOfChannels}` : '') : '';
78
78
  const audioParams = `audio=${video.audio}${nbrOfChannels}`;
79
79
  const videoCodecParams = video.videoCodec === 'h264'
80
- ? `videocodec=${video.videoCodec}&h264Profile=${video.h264Profile}`
80
+ ? `videocodec=${video.videoCodec}&h264profile=${video.h264Profile}`
81
81
  : `videocodec=${video.videoCodec}`;
82
82
  const videoParams = `camera=${video.camera}&resolution=${video.resolution}&fps=${video.fps}&compression=${video.compression}&videokeyframeinterval=${video.govLength}&${videoCodecParams}${overlaysParams}`;
83
83
  return [videoParams, bitrateParams, audioParams].join('&');
@@ -92,7 +92,7 @@ const parseVapixParamsToVideoOptions = (internalVapixParams) => {
92
92
  });
93
93
  let h264Profile = undefined;
94
94
  if (params['videocodec'] === 'h264') {
95
- h264Profile = (params['h264Profile'] ?? 'high');
95
+ h264Profile = (params['h264profile'] ?? params['h264Profile'] ?? 'high');
96
96
  }
97
97
  let nbrOfChannels = undefined;
98
98
  if (params['audio'] === '1') {
@@ -126,6 +126,7 @@ export declare enum EUserActions {
126
126
  SET_PRIORITY_LIST = "setPriorityList.cgi",
127
127
  SET_BLACK_LIST = "setBlackList.cgi",
128
128
  SET_WHITE_LIST = "setWhiteList.cgi",
129
+ SET_FRIENDLY_LIST = "setFriendlyList.cgi",
129
130
  GO_TO_COORDINATES = "goToCoordinates.cgi",
130
131
  SET_TRACKING_MODE = "setTrackingMode.cgi",
131
132
  SET_ZONES = "setZones.cgi",
@@ -721,6 +722,82 @@ declare const eventsDataSchema: z.ZodUnion<readonly [z.ZodObject<{
721
722
  idValue: string;
722
723
  }[] | undefined;
723
724
  };
725
+ }>, z.ZodObject<{
726
+ type: z.ZodLiteral<"USER_ACTION">;
727
+ cgi: z.ZodLiteral<EUserActions.SET_FRIENDLY_LIST>;
728
+ ip: z.ZodString;
729
+ params: z.ZodObject<{
730
+ userId: z.ZodString;
731
+ userName: z.ZodString;
732
+ userPriority: z.ZodString;
733
+ }, "strip", z.ZodTypeAny, {
734
+ userId: string;
735
+ userName: string;
736
+ userPriority: string;
737
+ }, {
738
+ userId: string;
739
+ userName: string;
740
+ userPriority: string;
741
+ }>;
742
+ postJsonBody: z.ZodObject<{
743
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
744
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
745
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
746
+ idValue: z.ZodString;
747
+ }, "strip", z.ZodTypeAny, {
748
+ domain: "adsb" | "remoteId";
749
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
750
+ idValue: string;
751
+ }, {
752
+ domain: "adsb" | "remoteId";
753
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
754
+ idValue: string;
755
+ }>, "many">>;
756
+ }, "strip", z.ZodTypeAny, {
757
+ list: {
758
+ domain: "adsb" | "remoteId";
759
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
760
+ idValue: string;
761
+ }[];
762
+ }, {
763
+ list?: {
764
+ domain: "adsb" | "remoteId";
765
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
766
+ idValue: string;
767
+ }[] | undefined;
768
+ }>;
769
+ }, "strip", z.ZodTypeAny, {
770
+ params: {
771
+ userId: string;
772
+ userName: string;
773
+ userPriority: string;
774
+ };
775
+ type: "USER_ACTION";
776
+ ip: string;
777
+ cgi: EUserActions.SET_FRIENDLY_LIST;
778
+ postJsonBody: {
779
+ list: {
780
+ domain: "adsb" | "remoteId";
781
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
782
+ idValue: string;
783
+ }[];
784
+ };
785
+ }, {
786
+ params: {
787
+ userId: string;
788
+ userName: string;
789
+ userPriority: string;
790
+ };
791
+ type: "USER_ACTION";
792
+ ip: string;
793
+ cgi: EUserActions.SET_FRIENDLY_LIST;
794
+ postJsonBody: {
795
+ list?: {
796
+ domain: "adsb" | "remoteId";
797
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
798
+ idValue: string;
799
+ }[] | undefined;
800
+ };
724
801
  }>, z.ZodObject<{
725
802
  type: z.ZodLiteral<"USER_ACTION">;
726
803
  cgi: z.ZodLiteral<EUserActions.GO_TO_COORDINATES>;
@@ -1794,6 +1871,82 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
1794
1871
  idValue: string;
1795
1872
  }[] | undefined;
1796
1873
  };
1874
+ }>, z.ZodObject<{
1875
+ type: z.ZodLiteral<"USER_ACTION">;
1876
+ cgi: z.ZodLiteral<EUserActions.SET_FRIENDLY_LIST>;
1877
+ ip: z.ZodString;
1878
+ params: z.ZodObject<{
1879
+ userId: z.ZodString;
1880
+ userName: z.ZodString;
1881
+ userPriority: z.ZodString;
1882
+ }, "strip", z.ZodTypeAny, {
1883
+ userId: string;
1884
+ userName: string;
1885
+ userPriority: string;
1886
+ }, {
1887
+ userId: string;
1888
+ userName: string;
1889
+ userPriority: string;
1890
+ }>;
1891
+ postJsonBody: z.ZodObject<{
1892
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
1893
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
1894
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
1895
+ idValue: z.ZodString;
1896
+ }, "strip", z.ZodTypeAny, {
1897
+ domain: "adsb" | "remoteId";
1898
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1899
+ idValue: string;
1900
+ }, {
1901
+ domain: "adsb" | "remoteId";
1902
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1903
+ idValue: string;
1904
+ }>, "many">>;
1905
+ }, "strip", z.ZodTypeAny, {
1906
+ list: {
1907
+ domain: "adsb" | "remoteId";
1908
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1909
+ idValue: string;
1910
+ }[];
1911
+ }, {
1912
+ list?: {
1913
+ domain: "adsb" | "remoteId";
1914
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1915
+ idValue: string;
1916
+ }[] | undefined;
1917
+ }>;
1918
+ }, "strip", z.ZodTypeAny, {
1919
+ params: {
1920
+ userId: string;
1921
+ userName: string;
1922
+ userPriority: string;
1923
+ };
1924
+ type: "USER_ACTION";
1925
+ ip: string;
1926
+ cgi: EUserActions.SET_FRIENDLY_LIST;
1927
+ postJsonBody: {
1928
+ list: {
1929
+ domain: "adsb" | "remoteId";
1930
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1931
+ idValue: string;
1932
+ }[];
1933
+ };
1934
+ }, {
1935
+ params: {
1936
+ userId: string;
1937
+ userName: string;
1938
+ userPriority: string;
1939
+ };
1940
+ type: "USER_ACTION";
1941
+ ip: string;
1942
+ cgi: EUserActions.SET_FRIENDLY_LIST;
1943
+ postJsonBody: {
1944
+ list?: {
1945
+ domain: "adsb" | "remoteId";
1946
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1947
+ idValue: string;
1948
+ }[] | undefined;
1949
+ };
1797
1950
  }>, z.ZodObject<{
1798
1951
  type: z.ZodLiteral<"USER_ACTION">;
1799
1952
  cgi: z.ZodLiteral<EUserActions.GO_TO_COORDINATES>;
@@ -2415,6 +2568,22 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
2415
2568
  idValue: string;
2416
2569
  }[];
2417
2570
  };
2571
+ } | {
2572
+ params: {
2573
+ userId: string;
2574
+ userName: string;
2575
+ userPriority: string;
2576
+ };
2577
+ type: "USER_ACTION";
2578
+ ip: string;
2579
+ cgi: EUserActions.SET_FRIENDLY_LIST;
2580
+ postJsonBody: {
2581
+ list: {
2582
+ domain: "adsb" | "remoteId";
2583
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
2584
+ idValue: string;
2585
+ }[];
2586
+ };
2418
2587
  } | {
2419
2588
  params: {
2420
2589
  lat: string;
@@ -2661,6 +2830,22 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
2661
2830
  idValue: string;
2662
2831
  }[] | undefined;
2663
2832
  };
2833
+ } | {
2834
+ params: {
2835
+ userId: string;
2836
+ userName: string;
2837
+ userPriority: string;
2838
+ };
2839
+ type: "USER_ACTION";
2840
+ ip: string;
2841
+ cgi: EUserActions.SET_FRIENDLY_LIST;
2842
+ postJsonBody: {
2843
+ list?: {
2844
+ domain: "adsb" | "remoteId";
2845
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
2846
+ idValue: string;
2847
+ }[] | undefined;
2848
+ };
2664
2849
  } | {
2665
2850
  params: {
2666
2851
  lat: string;
@@ -3357,6 +3542,82 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
3357
3542
  idValue: string;
3358
3543
  }[] | undefined;
3359
3544
  };
3545
+ }>, z.ZodObject<{
3546
+ type: z.ZodLiteral<"USER_ACTION">;
3547
+ cgi: z.ZodLiteral<EUserActions.SET_FRIENDLY_LIST>;
3548
+ ip: z.ZodString;
3549
+ params: z.ZodObject<{
3550
+ userId: z.ZodString;
3551
+ userName: z.ZodString;
3552
+ userPriority: z.ZodString;
3553
+ }, "strip", z.ZodTypeAny, {
3554
+ userId: string;
3555
+ userName: string;
3556
+ userPriority: string;
3557
+ }, {
3558
+ userId: string;
3559
+ userName: string;
3560
+ userPriority: string;
3561
+ }>;
3562
+ postJsonBody: z.ZodObject<{
3563
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
3564
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
3565
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
3566
+ idValue: z.ZodString;
3567
+ }, "strip", z.ZodTypeAny, {
3568
+ domain: "adsb" | "remoteId";
3569
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3570
+ idValue: string;
3571
+ }, {
3572
+ domain: "adsb" | "remoteId";
3573
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3574
+ idValue: string;
3575
+ }>, "many">>;
3576
+ }, "strip", z.ZodTypeAny, {
3577
+ list: {
3578
+ domain: "adsb" | "remoteId";
3579
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3580
+ idValue: string;
3581
+ }[];
3582
+ }, {
3583
+ list?: {
3584
+ domain: "adsb" | "remoteId";
3585
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3586
+ idValue: string;
3587
+ }[] | undefined;
3588
+ }>;
3589
+ }, "strip", z.ZodTypeAny, {
3590
+ params: {
3591
+ userId: string;
3592
+ userName: string;
3593
+ userPriority: string;
3594
+ };
3595
+ type: "USER_ACTION";
3596
+ ip: string;
3597
+ cgi: EUserActions.SET_FRIENDLY_LIST;
3598
+ postJsonBody: {
3599
+ list: {
3600
+ domain: "adsb" | "remoteId";
3601
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3602
+ idValue: string;
3603
+ }[];
3604
+ };
3605
+ }, {
3606
+ params: {
3607
+ userId: string;
3608
+ userName: string;
3609
+ userPriority: string;
3610
+ };
3611
+ type: "USER_ACTION";
3612
+ ip: string;
3613
+ cgi: EUserActions.SET_FRIENDLY_LIST;
3614
+ postJsonBody: {
3615
+ list?: {
3616
+ domain: "adsb" | "remoteId";
3617
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3618
+ idValue: string;
3619
+ }[] | undefined;
3620
+ };
3360
3621
  }>, z.ZodObject<{
3361
3622
  type: z.ZodLiteral<"USER_ACTION">;
3362
3623
  cgi: z.ZodLiteral<EUserActions.GO_TO_COORDINATES>;
@@ -56,6 +56,7 @@ var EUserActions;
56
56
  EUserActions["SET_PRIORITY_LIST"] = "setPriorityList.cgi";
57
57
  EUserActions["SET_BLACK_LIST"] = "setBlackList.cgi";
58
58
  EUserActions["SET_WHITE_LIST"] = "setWhiteList.cgi";
59
+ EUserActions["SET_FRIENDLY_LIST"] = "setFriendlyList.cgi";
59
60
  EUserActions["GO_TO_COORDINATES"] = "goToCoordinates.cgi";
60
61
  EUserActions["SET_TRACKING_MODE"] = "setTrackingMode.cgi";
61
62
  EUserActions["SET_ZONES"] = "setZones.cgi";
@@ -123,6 +124,13 @@ const eventsDataSchema = zod_1.z.union([
123
124
  params: userSchema,
124
125
  postJsonBody: PlaneTrackerAPI_1.whiteListSchema,
125
126
  }),
127
+ zod_1.z.object({
128
+ type: zod_1.z.literal('USER_ACTION'),
129
+ cgi: zod_1.z.literal(EUserActions.SET_FRIENDLY_LIST),
130
+ ip: zod_1.z.string(),
131
+ params: userSchema,
132
+ postJsonBody: PlaneTrackerAPI_1.friendlyListSchema,
133
+ }),
126
134
  zod_1.z.object({
127
135
  type: zod_1.z.literal('USER_ACTION'),
128
136
  cgi: zod_1.z.literal(EUserActions.GO_TO_COORDINATES),
@@ -1,11 +1,12 @@
1
1
  import { z } from 'zod';
2
- import { AddNewClipError, JsonParseError, ParameterNotFoundError } from './errors/errors';
2
+ import { AddNewClipError, ParameterNotFoundError } from './errors/errors';
3
3
  import { parseBitrateOptionsToVapixParams, parseVapixParamsToBitrateOptions } from './internal/convertors';
4
4
  import { isClip, isNullish } from './internal/utils';
5
5
  import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, clipFilesListSchema, } from './types/CamSwitcherAPI';
6
6
  import { networkCameraListSchema, } from './types/common';
7
7
  import { VapixAPI } from './VapixAPI';
8
8
  import { BasicAPI } from './internal/BasicAPI';
9
+ import { jsonParseCameraParam } from './helpers';
9
10
  const BASE_PATH = '/local/camswitcher/api';
10
11
  export class CamSwitcherAPI extends BasicAPI {
11
12
  CustomFormData;
@@ -270,20 +271,7 @@ export class CamSwitcherAPI extends BasicAPI {
270
271
  if (data[paramName] === undefined) {
271
272
  throw new ParameterNotFoundError(paramName);
272
273
  }
273
- if (data[paramName] === '') {
274
- return {};
275
- }
276
- try {
277
- return JSON.parse(data[paramName] + '');
278
- }
279
- catch {
280
- try {
281
- return JSON.parse(decodeURIComponent((data[paramName] + '').replaceAll('\\', '')));
282
- }
283
- catch (e) {
284
- throw new JsonParseError(paramName, data[paramName]);
285
- }
286
- }
274
+ return jsonParseCameraParam(data[paramName] + '', paramName);
287
275
  }
288
276
  async getUploadedFileList(clipName, storage, options) {
289
277
  const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
package/esm/helpers.js ADDED
@@ -0,0 +1,17 @@
1
+ import { JsonParseError } from './errors/errors';
2
+ export const jsonParseCameraParam = (param, paramName) => {
3
+ if (param === '') {
4
+ return {};
5
+ }
6
+ try {
7
+ return JSON.parse(param);
8
+ }
9
+ catch {
10
+ try {
11
+ return JSON.parse(decodeURIComponent(param.replaceAll('\\', '')));
12
+ }
13
+ catch (e) {
14
+ throw new JsonParseError(paramName, param);
15
+ }
16
+ }
17
+ };
package/esm/index.js CHANGED
@@ -26,3 +26,4 @@ export { CamScripterAPI } from './CamScripterAPI';
26
26
  export * from './types/CamScripterAPI';
27
27
  export { VapixAPI } from './VapixAPI';
28
28
  export * from './types/VapixAPI';
29
+ export * from './helpers';
@@ -72,7 +72,7 @@ export const parseVideoOptionsToVapixParams = (firmWareVersion, video) => {
72
72
  const nbrOfChannels = video.nbrOfChannels ? (video.audio === 1 ? `&nbrOfChannels=${video.nbrOfChannels}` : '') : '';
73
73
  const audioParams = `audio=${video.audio}${nbrOfChannels}`;
74
74
  const videoCodecParams = video.videoCodec === 'h264'
75
- ? `videocodec=${video.videoCodec}&h264Profile=${video.h264Profile}`
75
+ ? `videocodec=${video.videoCodec}&h264profile=${video.h264Profile}`
76
76
  : `videocodec=${video.videoCodec}`;
77
77
  const videoParams = `camera=${video.camera}&resolution=${video.resolution}&fps=${video.fps}&compression=${video.compression}&videokeyframeinterval=${video.govLength}&${videoCodecParams}${overlaysParams}`;
78
78
  return [videoParams, bitrateParams, audioParams].join('&');
@@ -86,7 +86,7 @@ export const parseVapixParamsToVideoOptions = (internalVapixParams) => {
86
86
  });
87
87
  let h264Profile = undefined;
88
88
  if (params['videocodec'] === 'h264') {
89
- h264Profile = (params['h264Profile'] ?? 'high');
89
+ h264Profile = (params['h264profile'] ?? params['h264Profile'] ?? 'high');
90
90
  }
91
91
  let nbrOfChannels = undefined;
92
92
  if (params['audio'] === '1') {
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { blackListSchema, priorityListSchema, trackingModeSchema, whiteListSchema, zonesSchema, domainIdSchema, } from '../PlaneTrackerAPI';
2
+ import { blackListSchema, friendlyListSchema, priorityListSchema, trackingModeSchema, whiteListSchema, zonesSchema, domainIdSchema, } from '../PlaneTrackerAPI';
3
3
  const wsApiFlightDataSchema = z.object({
4
4
  targetId: z.string(),
5
5
  icao: z.string(),
@@ -53,6 +53,7 @@ export var EUserActions;
53
53
  EUserActions["SET_PRIORITY_LIST"] = "setPriorityList.cgi";
54
54
  EUserActions["SET_BLACK_LIST"] = "setBlackList.cgi";
55
55
  EUserActions["SET_WHITE_LIST"] = "setWhiteList.cgi";
56
+ EUserActions["SET_FRIENDLY_LIST"] = "setFriendlyList.cgi";
56
57
  EUserActions["GO_TO_COORDINATES"] = "goToCoordinates.cgi";
57
58
  EUserActions["SET_TRACKING_MODE"] = "setTrackingMode.cgi";
58
59
  EUserActions["SET_ZONES"] = "setZones.cgi";
@@ -120,6 +121,13 @@ const eventsDataSchema = z.union([
120
121
  params: userSchema,
121
122
  postJsonBody: whiteListSchema,
122
123
  }),
124
+ z.object({
125
+ type: z.literal('USER_ACTION'),
126
+ cgi: z.literal(EUserActions.SET_FRIENDLY_LIST),
127
+ ip: z.string(),
128
+ params: userSchema,
129
+ postJsonBody: friendlyListSchema,
130
+ }),
123
131
  z.object({
124
132
  type: z.literal('USER_ACTION'),
125
133
  cgi: z.literal(EUserActions.GO_TO_COORDINATES),
package/package.json CHANGED
@@ -1,110 +1,110 @@
1
1
  {
2
- "name": "camstreamerlib",
3
- "version": "4.0.27",
4
- "description": "Helper library for CamStreamer ACAP applications.",
5
- "prettier": "@camstreamer/prettier-config",
6
- "engine": {
7
- "node": ">=18.0.0"
2
+ "name": "camstreamerlib",
3
+ "version": "4.0.28-f67e7db",
4
+ "description": "Helper library for CamStreamer ACAP applications.",
5
+ "prettier": "@camstreamer/prettier-config",
6
+ "engine": {
7
+ "node": ">=18.0.0"
8
+ },
9
+ "dependencies": {
10
+ "adm-zip": "^0.6.0",
11
+ "eventemitter2": "^5.0.1",
12
+ "fast-xml-parser": "^5.3.6",
13
+ "type-fest": "^4.41.0",
14
+ "undici": "^6.27.0",
15
+ "ws": "^8.18.0",
16
+ "zod": "^3.25.76"
17
+ },
18
+ "devDependencies": {
19
+ "@camstreamer/eslint-config": "^1.0.2",
20
+ "@camstreamer/prettier-config": "^2.0.4",
21
+ "@types/adm-zip": "^0.5.5",
22
+ "@types/jest": "^28.0.0",
23
+ "@types/node": "^18.19.127",
24
+ "@types/ws": "^8.5.10",
25
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
26
+ "@typescript-eslint/parser": "^6.8.0",
27
+ "eslint": "^8.51.0",
28
+ "eslint-plugin-deprecation": "^2.0.0",
29
+ "eslint-plugin-unused-imports": "^3.0.0",
30
+ "jest": "^28.1.3",
31
+ "npm-run-all": "^4.1.5",
32
+ "prettier": "^2.7.1",
33
+ "ts-jest": "^28.0.0",
34
+ "ts-node": "^10.7.0",
35
+ "typescript": "5.3.3"
36
+ },
37
+ "overrides": {
38
+ "js-yaml": "^4.2.0"
39
+ },
40
+ "scripts": {
41
+ "clean": "rimraf dist/*",
42
+ "build": "npm-run-all clean build:cjs build:esm copyPackage",
43
+ "build:cjs": "tsc --project tsconfig.cjs.json",
44
+ "build:esm": "tsc --project tsconfig.esm.json",
45
+ "copyPackage": "cp -f LICENSE dist/ && cp -f README.md dist/ && cp -f package.json dist/",
46
+ "publishPackage": "./publish.sh",
47
+ "lint": "eslint \"src/**/*.ts\"",
48
+ "lint:fix": "eslint \"src/**/*.ts\" --fix",
49
+ "pretty": "prettier --write \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
50
+ "pretty:check": "prettier --check \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
51
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
52
+ "audit": "npm audit --audit-level=high"
53
+ },
54
+ "files": [
55
+ "/**/*.js",
56
+ "/**/*.ts"
57
+ ],
58
+ "main": "./cjs/index.js",
59
+ "module": "./esm/index.js",
60
+ "types": "types/index.d.ts",
61
+ "exports": {
62
+ ".": {
63
+ "import": "./esm/index.js",
64
+ "require": "./cjs/index.js",
65
+ "types": "./types/index.d.ts"
8
66
  },
9
- "dependencies": {
10
- "adm-zip": "^0.6.0",
11
- "eventemitter2": "^5.0.1",
12
- "fast-xml-parser": "^5.3.6",
13
- "type-fest": "^4.41.0",
14
- "undici": "^6.27.0",
15
- "ws": "^8.18.0",
16
- "zod": "^3.25.76"
67
+ "./web": {
68
+ "import": "./esm/web/index.js",
69
+ "require": "./cjs/web/index.js",
70
+ "types": "./types/web/index.d.ts"
17
71
  },
18
- "devDependencies": {
19
- "@camstreamer/eslint-config": "^1.0.2",
20
- "@camstreamer/prettier-config": "^2.0.4",
21
- "@types/adm-zip": "^0.5.5",
22
- "@types/jest": "^28.0.0",
23
- "@types/node": "^18.19.127",
24
- "@types/ws": "^8.5.10",
25
- "@typescript-eslint/eslint-plugin": "^6.8.0",
26
- "@typescript-eslint/parser": "^6.8.0",
27
- "eslint": "^8.51.0",
28
- "eslint-plugin-deprecation": "^2.0.0",
29
- "eslint-plugin-unused-imports": "^3.0.0",
30
- "jest": "^28.1.3",
31
- "npm-run-all": "^4.1.5",
32
- "prettier": "^2.7.1",
33
- "ts-jest": "^28.0.0",
34
- "ts-node": "^10.7.0",
35
- "typescript": "5.3.3"
72
+ "./node": {
73
+ "import": "./esm/node/index.js",
74
+ "require": "./cjs/node/index.js",
75
+ "types": "./types/node/index.d.ts"
36
76
  },
37
- "overrides": {
38
- "js-yaml": "^4.2.0"
77
+ "./cjs/index": {
78
+ "import": "./esm/index.js",
79
+ "require": "./cjs/index.js",
80
+ "types": "./types/index.d.ts"
39
81
  },
40
- "scripts": {
41
- "clean": "rimraf dist/*",
42
- "build": "npm-run-all clean build:cjs build:esm copyPackage",
43
- "build:cjs": "tsc --project tsconfig.cjs.json",
44
- "build:esm": "tsc --project tsconfig.esm.json",
45
- "copyPackage": "cp -f LICENSE dist/ && cp -f README.md dist/ && cp -f package.json dist/",
46
- "publishPackage": "./publish.sh",
47
- "lint": "eslint \"src/**/*.ts\"",
48
- "lint:fix": "eslint \"src/**/*.ts\" --fix",
49
- "pretty": "prettier --write \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
50
- "pretty:check": "prettier --check \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
51
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
52
- "audit": "npm audit --audit-level=high"
82
+ "./cjs/node": {
83
+ "import": "./esm/node/index.js",
84
+ "require": "./cjs/node/index.js",
85
+ "types": "./types/node/index.js"
53
86
  },
54
- "files": [
55
- "/**/*.js",
56
- "/**/*.ts"
57
- ],
58
- "main": "./cjs/index.js",
59
- "module": "./esm/index.js",
60
- "types": "types/index.d.ts",
61
- "exports": {
62
- ".": {
63
- "import": "./esm/index.js",
64
- "require": "./cjs/index.js",
65
- "types": "./types/index.d.ts"
66
- },
67
- "./web": {
68
- "import": "./esm/web/index.js",
69
- "require": "./cjs/web/index.js",
70
- "types": "./types/web/index.d.ts"
71
- },
72
- "./node": {
73
- "import": "./esm/node/index.js",
74
- "require": "./cjs/node/index.js",
75
- "types": "./types/node/index.d.ts"
76
- },
77
- "./cjs/index": {
78
- "import": "./esm/index.js",
79
- "require": "./cjs/index.js",
80
- "types": "./types/index.d.ts"
81
- },
82
- "./cjs/node": {
83
- "import": "./esm/node/index.js",
84
- "require": "./cjs/node/index.js",
85
- "types": "./types/node/index.js"
86
- },
87
- "./cjs/node/index": {
88
- "import": "./esm/node/index.js",
89
- "require": "./cjs/node/index.js",
90
- "types": "./types/node/index.js"
91
- }
92
- },
93
- "repository": {
94
- "type": "git",
95
- "url": "git+https://github.com/CamStreamer/CamStreamerLib.git"
96
- },
97
- "keywords": [
98
- "CamStreamer",
99
- "CamOverlay",
100
- "CamScripter",
101
- "Camera",
102
- "Axis"
103
- ],
104
- "author": "CamStreamer s.r.o",
105
- "license": "ISC",
106
- "bugs": {
107
- "url": "https://github.com/CamStreamer/CamStreamerLib/issues"
108
- },
109
- "homepage": "https://github.com/CamStreamer/CamStreamerLib#readme"
87
+ "./cjs/node/index": {
88
+ "import": "./esm/node/index.js",
89
+ "require": "./cjs/node/index.js",
90
+ "types": "./types/node/index.js"
91
+ }
92
+ },
93
+ "repository": {
94
+ "type": "git",
95
+ "url": "git+https://github.com/CamStreamer/CamStreamerLib.git"
96
+ },
97
+ "keywords": [
98
+ "CamStreamer",
99
+ "CamOverlay",
100
+ "CamScripter",
101
+ "Camera",
102
+ "Axis"
103
+ ],
104
+ "author": "CamStreamer s.r.o",
105
+ "license": "ISC",
106
+ "bugs": {
107
+ "url": "https://github.com/CamStreamer/CamStreamerLib/issues"
108
+ },
109
+ "homepage": "https://github.com/CamStreamer/CamStreamerLib#readme"
110
110
  }
@@ -0,0 +1 @@
1
+ export declare const jsonParseCameraParam: (param: string, paramName: string) => any;
package/types/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export { CamScripterAPI } from './CamScripterAPI';
26
26
  export * from './types/CamScripterAPI';
27
27
  export { VapixAPI } from './VapixAPI';
28
28
  export * from './types/VapixAPI';
29
+ export * from './helpers';
@@ -126,6 +126,7 @@ export declare enum EUserActions {
126
126
  SET_PRIORITY_LIST = "setPriorityList.cgi",
127
127
  SET_BLACK_LIST = "setBlackList.cgi",
128
128
  SET_WHITE_LIST = "setWhiteList.cgi",
129
+ SET_FRIENDLY_LIST = "setFriendlyList.cgi",
129
130
  GO_TO_COORDINATES = "goToCoordinates.cgi",
130
131
  SET_TRACKING_MODE = "setTrackingMode.cgi",
131
132
  SET_ZONES = "setZones.cgi",
@@ -721,6 +722,82 @@ declare const eventsDataSchema: z.ZodUnion<readonly [z.ZodObject<{
721
722
  idValue: string;
722
723
  }[] | undefined;
723
724
  };
725
+ }>, z.ZodObject<{
726
+ type: z.ZodLiteral<"USER_ACTION">;
727
+ cgi: z.ZodLiteral<EUserActions.SET_FRIENDLY_LIST>;
728
+ ip: z.ZodString;
729
+ params: z.ZodObject<{
730
+ userId: z.ZodString;
731
+ userName: z.ZodString;
732
+ userPriority: z.ZodString;
733
+ }, "strip", z.ZodTypeAny, {
734
+ userId: string;
735
+ userName: string;
736
+ userPriority: string;
737
+ }, {
738
+ userId: string;
739
+ userName: string;
740
+ userPriority: string;
741
+ }>;
742
+ postJsonBody: z.ZodObject<{
743
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
744
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
745
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
746
+ idValue: z.ZodString;
747
+ }, "strip", z.ZodTypeAny, {
748
+ domain: "adsb" | "remoteId";
749
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
750
+ idValue: string;
751
+ }, {
752
+ domain: "adsb" | "remoteId";
753
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
754
+ idValue: string;
755
+ }>, "many">>;
756
+ }, "strip", z.ZodTypeAny, {
757
+ list: {
758
+ domain: "adsb" | "remoteId";
759
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
760
+ idValue: string;
761
+ }[];
762
+ }, {
763
+ list?: {
764
+ domain: "adsb" | "remoteId";
765
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
766
+ idValue: string;
767
+ }[] | undefined;
768
+ }>;
769
+ }, "strip", z.ZodTypeAny, {
770
+ params: {
771
+ userId: string;
772
+ userName: string;
773
+ userPriority: string;
774
+ };
775
+ type: "USER_ACTION";
776
+ ip: string;
777
+ cgi: EUserActions.SET_FRIENDLY_LIST;
778
+ postJsonBody: {
779
+ list: {
780
+ domain: "adsb" | "remoteId";
781
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
782
+ idValue: string;
783
+ }[];
784
+ };
785
+ }, {
786
+ params: {
787
+ userId: string;
788
+ userName: string;
789
+ userPriority: string;
790
+ };
791
+ type: "USER_ACTION";
792
+ ip: string;
793
+ cgi: EUserActions.SET_FRIENDLY_LIST;
794
+ postJsonBody: {
795
+ list?: {
796
+ domain: "adsb" | "remoteId";
797
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
798
+ idValue: string;
799
+ }[] | undefined;
800
+ };
724
801
  }>, z.ZodObject<{
725
802
  type: z.ZodLiteral<"USER_ACTION">;
726
803
  cgi: z.ZodLiteral<EUserActions.GO_TO_COORDINATES>;
@@ -1794,6 +1871,82 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
1794
1871
  idValue: string;
1795
1872
  }[] | undefined;
1796
1873
  };
1874
+ }>, z.ZodObject<{
1875
+ type: z.ZodLiteral<"USER_ACTION">;
1876
+ cgi: z.ZodLiteral<EUserActions.SET_FRIENDLY_LIST>;
1877
+ ip: z.ZodString;
1878
+ params: z.ZodObject<{
1879
+ userId: z.ZodString;
1880
+ userName: z.ZodString;
1881
+ userPriority: z.ZodString;
1882
+ }, "strip", z.ZodTypeAny, {
1883
+ userId: string;
1884
+ userName: string;
1885
+ userPriority: string;
1886
+ }, {
1887
+ userId: string;
1888
+ userName: string;
1889
+ userPriority: string;
1890
+ }>;
1891
+ postJsonBody: z.ZodObject<{
1892
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
1893
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
1894
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
1895
+ idValue: z.ZodString;
1896
+ }, "strip", z.ZodTypeAny, {
1897
+ domain: "adsb" | "remoteId";
1898
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1899
+ idValue: string;
1900
+ }, {
1901
+ domain: "adsb" | "remoteId";
1902
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1903
+ idValue: string;
1904
+ }>, "many">>;
1905
+ }, "strip", z.ZodTypeAny, {
1906
+ list: {
1907
+ domain: "adsb" | "remoteId";
1908
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1909
+ idValue: string;
1910
+ }[];
1911
+ }, {
1912
+ list?: {
1913
+ domain: "adsb" | "remoteId";
1914
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1915
+ idValue: string;
1916
+ }[] | undefined;
1917
+ }>;
1918
+ }, "strip", z.ZodTypeAny, {
1919
+ params: {
1920
+ userId: string;
1921
+ userName: string;
1922
+ userPriority: string;
1923
+ };
1924
+ type: "USER_ACTION";
1925
+ ip: string;
1926
+ cgi: EUserActions.SET_FRIENDLY_LIST;
1927
+ postJsonBody: {
1928
+ list: {
1929
+ domain: "adsb" | "remoteId";
1930
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1931
+ idValue: string;
1932
+ }[];
1933
+ };
1934
+ }, {
1935
+ params: {
1936
+ userId: string;
1937
+ userName: string;
1938
+ userPriority: string;
1939
+ };
1940
+ type: "USER_ACTION";
1941
+ ip: string;
1942
+ cgi: EUserActions.SET_FRIENDLY_LIST;
1943
+ postJsonBody: {
1944
+ list?: {
1945
+ domain: "adsb" | "remoteId";
1946
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
1947
+ idValue: string;
1948
+ }[] | undefined;
1949
+ };
1797
1950
  }>, z.ZodObject<{
1798
1951
  type: z.ZodLiteral<"USER_ACTION">;
1799
1952
  cgi: z.ZodLiteral<EUserActions.GO_TO_COORDINATES>;
@@ -2415,6 +2568,22 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
2415
2568
  idValue: string;
2416
2569
  }[];
2417
2570
  };
2571
+ } | {
2572
+ params: {
2573
+ userId: string;
2574
+ userName: string;
2575
+ userPriority: string;
2576
+ };
2577
+ type: "USER_ACTION";
2578
+ ip: string;
2579
+ cgi: EUserActions.SET_FRIENDLY_LIST;
2580
+ postJsonBody: {
2581
+ list: {
2582
+ domain: "adsb" | "remoteId";
2583
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
2584
+ idValue: string;
2585
+ }[];
2586
+ };
2418
2587
  } | {
2419
2588
  params: {
2420
2589
  lat: string;
@@ -2661,6 +2830,22 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
2661
2830
  idValue: string;
2662
2831
  }[] | undefined;
2663
2832
  };
2833
+ } | {
2834
+ params: {
2835
+ userId: string;
2836
+ userName: string;
2837
+ userPriority: string;
2838
+ };
2839
+ type: "USER_ACTION";
2840
+ ip: string;
2841
+ cgi: EUserActions.SET_FRIENDLY_LIST;
2842
+ postJsonBody: {
2843
+ list?: {
2844
+ domain: "adsb" | "remoteId";
2845
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
2846
+ idValue: string;
2847
+ }[] | undefined;
2848
+ };
2664
2849
  } | {
2665
2850
  params: {
2666
2851
  lat: string;
@@ -3357,6 +3542,82 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
3357
3542
  idValue: string;
3358
3543
  }[] | undefined;
3359
3544
  };
3545
+ }>, z.ZodObject<{
3546
+ type: z.ZodLiteral<"USER_ACTION">;
3547
+ cgi: z.ZodLiteral<EUserActions.SET_FRIENDLY_LIST>;
3548
+ ip: z.ZodString;
3549
+ params: z.ZodObject<{
3550
+ userId: z.ZodString;
3551
+ userName: z.ZodString;
3552
+ userPriority: z.ZodString;
3553
+ }, "strip", z.ZodTypeAny, {
3554
+ userId: string;
3555
+ userName: string;
3556
+ userPriority: string;
3557
+ }, {
3558
+ userId: string;
3559
+ userName: string;
3560
+ userPriority: string;
3561
+ }>;
3562
+ postJsonBody: z.ZodObject<{
3563
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
3564
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
3565
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
3566
+ idValue: z.ZodString;
3567
+ }, "strip", z.ZodTypeAny, {
3568
+ domain: "adsb" | "remoteId";
3569
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3570
+ idValue: string;
3571
+ }, {
3572
+ domain: "adsb" | "remoteId";
3573
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3574
+ idValue: string;
3575
+ }>, "many">>;
3576
+ }, "strip", z.ZodTypeAny, {
3577
+ list: {
3578
+ domain: "adsb" | "remoteId";
3579
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3580
+ idValue: string;
3581
+ }[];
3582
+ }, {
3583
+ list?: {
3584
+ domain: "adsb" | "remoteId";
3585
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3586
+ idValue: string;
3587
+ }[] | undefined;
3588
+ }>;
3589
+ }, "strip", z.ZodTypeAny, {
3590
+ params: {
3591
+ userId: string;
3592
+ userName: string;
3593
+ userPriority: string;
3594
+ };
3595
+ type: "USER_ACTION";
3596
+ ip: string;
3597
+ cgi: EUserActions.SET_FRIENDLY_LIST;
3598
+ postJsonBody: {
3599
+ list: {
3600
+ domain: "adsb" | "remoteId";
3601
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3602
+ idValue: string;
3603
+ }[];
3604
+ };
3605
+ }, {
3606
+ params: {
3607
+ userId: string;
3608
+ userName: string;
3609
+ userPriority: string;
3610
+ };
3611
+ type: "USER_ACTION";
3612
+ ip: string;
3613
+ cgi: EUserActions.SET_FRIENDLY_LIST;
3614
+ postJsonBody: {
3615
+ list?: {
3616
+ domain: "adsb" | "remoteId";
3617
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
3618
+ idValue: string;
3619
+ }[] | undefined;
3620
+ };
3360
3621
  }>, z.ZodObject<{
3361
3622
  type: z.ZodLiteral<"USER_ACTION">;
3362
3623
  cgi: z.ZodLiteral<EUserActions.GO_TO_COORDINATES>;