camstreamerlib 4.0.3 → 4.0.4

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.
@@ -1,4 +1,4 @@
1
- import { IClient, TParameters, TResponse } from './internal/types';
1
+ import { IClient, TResponse } from './internal/types';
2
2
  import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TTypePriorityList, TWhiteList, TZones } from './types/PlaneTrackerAPI';
3
3
  import { THttpRequestOptions } from './types/common';
4
4
  import { BasicAPI } from './internal/BasicAPI';
@@ -106,17 +106,6 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
106
106
  protocol: "https" | "http" | "https_insecure";
107
107
  sourceKey: string;
108
108
  };
109
- genetec: {
110
- ip: string;
111
- enabled: boolean;
112
- port: number;
113
- cameraList: string[];
114
- pass: string;
115
- appId: string;
116
- user: string;
117
- protocol: "https" | "http" | "https_insecure";
118
- baseUri: string;
119
- };
120
109
  camstreamerIntegration: {
121
110
  adPlacementEnabled: boolean;
122
111
  adMinIntervalSec: number;
@@ -232,10 +221,4 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
232
221
  setZones(zones: TZones, options?: THttpRequestOptions): Promise<void>;
233
222
  goToCoordinates(lat: number, lon: number, alt?: number, options?: THttpRequestOptions): Promise<void>;
234
223
  downloadReport(options?: THttpRequestOptions): Promise<string>;
235
- checkGenetecConnection(params: TParameters, options?: THttpRequestOptions): Promise<boolean>;
236
- getGenetecCameraList(params: TParameters, options?: THttpRequestOptions): Promise<{
237
- value: string;
238
- label: string;
239
- index: number;
240
- }[]>;
241
224
  }
@@ -4,7 +4,6 @@ exports.PlaneTrackerAPI = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const PlaneTrackerAPI_1 = require("./types/PlaneTrackerAPI");
6
6
  const errors_1 = require("./errors/errors");
7
- const GenetecAgent_1 = require("./types/GenetecAgent");
8
7
  const BasicAPI_1 = require("./internal/BasicAPI");
9
8
  const BASE_PATH = '/local/planetracker';
10
9
  class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
@@ -187,13 +186,5 @@ class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
187
186
  downloadReport(options) {
188
187
  return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
189
188
  }
190
- async checkGenetecConnection(params, options) {
191
- const res = await this._postUrlEncoded(`${BASE_PATH}/package/checkGenetecConnection.cgi`, params, options);
192
- return res.status === 200;
193
- }
194
- async getGenetecCameraList(params, options) {
195
- const res = await this._postUrlEncoded(`${BASE_PATH}/package/getGenetecCameraList.cgi`, params, options);
196
- return GenetecAgent_1.cameraListSchema.parse(await res.json());
197
- }
198
189
  }
199
190
  exports.PlaneTrackerAPI = PlaneTrackerAPI;
@@ -14,8 +14,9 @@ const toSnakeCaseDeep = (o) => {
14
14
  };
15
15
  exports.toSnakeCaseDeep = toSnakeCaseDeep;
16
16
  const splitWords = (input) => {
17
- if (!input)
17
+ if (!input) {
18
18
  return [];
19
+ }
19
20
  return (input
20
21
  .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
21
22
  .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
@@ -27,15 +28,17 @@ const splitWords = (input) => {
27
28
  };
28
29
  const camelCase = (key) => {
29
30
  const words = splitWords(key);
30
- if (words.length === 0)
31
+ if (words.length === 0) {
31
32
  return '';
33
+ }
32
34
  const [first, ...rest] = words;
33
35
  return first + rest.map((w) => w[0].toUpperCase() + w.slice(1)).join('');
34
36
  };
35
37
  const snakeCase = (key) => splitWords(key).join('_');
36
38
  const isPlainObject = (value) => {
37
- if (value === null || typeof value !== 'object')
39
+ if (value === null || typeof value !== 'object') {
38
40
  return false;
41
+ }
39
42
  const proto = Object.getPrototypeOf(value);
40
43
  return proto === null || proto === Object.prototype;
41
44
  };
@@ -360,38 +360,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
360
360
  protocol: "https" | "http" | "https_insecure";
361
361
  sourceKey: string;
362
362
  }>>;
363
- genetec: z.ZodDefault<z.ZodObject<{
364
- protocol: z.ZodUnion<[z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodLiteral<"https_insecure">]>;
365
- ip: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
366
- port: z.ZodNumber;
367
- user: z.ZodString;
368
- pass: z.ZodString;
369
- } & {
370
- enabled: z.ZodBoolean;
371
- baseUri: z.ZodDefault<z.ZodString>;
372
- appId: z.ZodDefault<z.ZodString>;
373
- cameraList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
374
- }, "strip", z.ZodTypeAny, {
375
- ip: string;
376
- enabled: boolean;
377
- port: number;
378
- cameraList: string[];
379
- pass: string;
380
- appId: string;
381
- user: string;
382
- protocol: "https" | "http" | "https_insecure";
383
- baseUri: string;
384
- }, {
385
- ip: string;
386
- enabled: boolean;
387
- port: number;
388
- pass: string;
389
- user: string;
390
- protocol: "https" | "http" | "https_insecure";
391
- cameraList?: string[] | undefined;
392
- appId?: string | undefined;
393
- baseUri?: string | undefined;
394
- }>>;
395
363
  camstreamerIntegration: z.ZodDefault<z.ZodObject<{
396
364
  adPlacementEnabled: z.ZodBoolean;
397
365
  adMinIntervalSec: z.ZodNumber;
@@ -497,17 +465,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
497
465
  protocol: "https" | "http" | "https_insecure";
498
466
  sourceKey: string;
499
467
  };
500
- genetec: {
501
- ip: string;
502
- enabled: boolean;
503
- port: number;
504
- cameraList: string[];
505
- pass: string;
506
- appId: string;
507
- user: string;
508
- protocol: "https" | "http" | "https_insecure";
509
- baseUri: string;
510
- };
511
468
  camstreamerIntegration: {
512
469
  adPlacementEnabled: boolean;
513
470
  adMinIntervalSec: number;
@@ -649,17 +606,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
649
606
  protocol: "https" | "http" | "https_insecure";
650
607
  sourceKey: string;
651
608
  } | undefined;
652
- genetec?: {
653
- ip: string;
654
- enabled: boolean;
655
- port: number;
656
- pass: string;
657
- user: string;
658
- protocol: "https" | "http" | "https_insecure";
659
- cameraList?: string[] | undefined;
660
- appId?: string | undefined;
661
- baseUri?: string | undefined;
662
- } | undefined;
663
609
  camstreamerIntegration?: {
664
610
  adPlacementEnabled: boolean;
665
611
  adMinIntervalSec: number;
@@ -201,24 +201,6 @@ exports.cameraSettingsSchema = zod_1.z.object({
201
201
  pass: '',
202
202
  sourceKey: '',
203
203
  }),
204
- genetec: exports.connectionSchema
205
- .extend({
206
- enabled: zod_1.z.boolean(),
207
- baseUri: zod_1.z.string().default(''),
208
- appId: zod_1.z.string().default(''),
209
- cameraList: zod_1.z.string().array().default([]),
210
- })
211
- .default({
212
- enabled: false,
213
- protocol: 'http',
214
- ip: '',
215
- port: 4590,
216
- user: '',
217
- pass: '',
218
- baseUri: 'WebSdk',
219
- appId: '',
220
- cameraList: [],
221
- }),
222
204
  camstreamerIntegration: zod_1.z
223
205
  .object({
224
206
  adPlacementEnabled: zod_1.z.boolean(),
@@ -1,7 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { blackListSchema, cameraSettingsSchema, flightInfoSchema, getIcaoSchema, mapInfoSchema, priorityListSchema, serverSettingsSchema, trackingModeSchema, typePriorityListSchema, whiteListSchema, wsAliasResponseSchema, zonesSchema, } from './types/PlaneTrackerAPI';
3
3
  import { CannotSetCoordsInAutoModeError, ImportSettingsError, InvalidAltitudeError, InvalidLatLngError, ResetCalibrationError, ServerError, BadRequestError, } from './errors/errors';
4
- import { cameraListSchema } from './types/GenetecAgent';
5
4
  import { BasicAPI } from './internal/BasicAPI';
6
5
  const BASE_PATH = '/local/planetracker';
7
6
  export class PlaneTrackerAPI extends BasicAPI {
@@ -184,12 +183,4 @@ export class PlaneTrackerAPI extends BasicAPI {
184
183
  downloadReport(options) {
185
184
  return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
186
185
  }
187
- async checkGenetecConnection(params, options) {
188
- const res = await this._postUrlEncoded(`${BASE_PATH}/package/checkGenetecConnection.cgi`, params, options);
189
- return res.status === 200;
190
- }
191
- async getGenetecCameraList(params, options) {
192
- const res = await this._postUrlEncoded(`${BASE_PATH}/package/getGenetecCameraList.cgi`, params, options);
193
- return cameraListSchema.parse(await res.json());
194
- }
195
186
  }
@@ -7,8 +7,9 @@ export const toSnakeCaseDeep = (o) => {
7
7
  return mapKeysDeep(o, snakeCase);
8
8
  };
9
9
  const splitWords = (input) => {
10
- if (!input)
10
+ if (!input) {
11
11
  return [];
12
+ }
12
13
  return (input
13
14
  .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
14
15
  .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
@@ -20,15 +21,17 @@ const splitWords = (input) => {
20
21
  };
21
22
  const camelCase = (key) => {
22
23
  const words = splitWords(key);
23
- if (words.length === 0)
24
+ if (words.length === 0) {
24
25
  return '';
26
+ }
25
27
  const [first, ...rest] = words;
26
28
  return first + rest.map((w) => w[0].toUpperCase() + w.slice(1)).join('');
27
29
  };
28
30
  const snakeCase = (key) => splitWords(key).join('_');
29
31
  const isPlainObject = (value) => {
30
- if (value === null || typeof value !== 'object')
32
+ if (value === null || typeof value !== 'object') {
31
33
  return false;
34
+ }
32
35
  const proto = Object.getPrototypeOf(value);
33
36
  return proto === null || proto === Object.prototype;
34
37
  };
@@ -198,24 +198,6 @@ export const cameraSettingsSchema = z.object({
198
198
  pass: '',
199
199
  sourceKey: '',
200
200
  }),
201
- genetec: connectionSchema
202
- .extend({
203
- enabled: z.boolean(),
204
- baseUri: z.string().default(''),
205
- appId: z.string().default(''),
206
- cameraList: z.string().array().default([]),
207
- })
208
- .default({
209
- enabled: false,
210
- protocol: 'http',
211
- ip: '',
212
- port: 4590,
213
- user: '',
214
- pass: '',
215
- baseUri: 'WebSdk',
216
- appId: '',
217
- cameraList: [],
218
- }),
219
201
  camstreamerIntegration: z
220
202
  .object({
221
203
  adPlacementEnabled: z.boolean(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -1,4 +1,4 @@
1
- import { IClient, TParameters, TResponse } from './internal/types';
1
+ import { IClient, TResponse } from './internal/types';
2
2
  import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TTypePriorityList, TWhiteList, TZones } from './types/PlaneTrackerAPI';
3
3
  import { THttpRequestOptions } from './types/common';
4
4
  import { BasicAPI } from './internal/BasicAPI';
@@ -106,17 +106,6 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
106
106
  protocol: "https" | "http" | "https_insecure";
107
107
  sourceKey: string;
108
108
  };
109
- genetec: {
110
- ip: string;
111
- enabled: boolean;
112
- port: number;
113
- cameraList: string[];
114
- pass: string;
115
- appId: string;
116
- user: string;
117
- protocol: "https" | "http" | "https_insecure";
118
- baseUri: string;
119
- };
120
109
  camstreamerIntegration: {
121
110
  adPlacementEnabled: boolean;
122
111
  adMinIntervalSec: number;
@@ -232,10 +221,4 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
232
221
  setZones(zones: TZones, options?: THttpRequestOptions): Promise<void>;
233
222
  goToCoordinates(lat: number, lon: number, alt?: number, options?: THttpRequestOptions): Promise<void>;
234
223
  downloadReport(options?: THttpRequestOptions): Promise<string>;
235
- checkGenetecConnection(params: TParameters, options?: THttpRequestOptions): Promise<boolean>;
236
- getGenetecCameraList(params: TParameters, options?: THttpRequestOptions): Promise<{
237
- value: string;
238
- label: string;
239
- index: number;
240
- }[]>;
241
224
  }
@@ -360,38 +360,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
360
360
  protocol: "https" | "http" | "https_insecure";
361
361
  sourceKey: string;
362
362
  }>>;
363
- genetec: z.ZodDefault<z.ZodObject<{
364
- protocol: z.ZodUnion<[z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodLiteral<"https_insecure">]>;
365
- ip: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
366
- port: z.ZodNumber;
367
- user: z.ZodString;
368
- pass: z.ZodString;
369
- } & {
370
- enabled: z.ZodBoolean;
371
- baseUri: z.ZodDefault<z.ZodString>;
372
- appId: z.ZodDefault<z.ZodString>;
373
- cameraList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
374
- }, "strip", z.ZodTypeAny, {
375
- ip: string;
376
- enabled: boolean;
377
- port: number;
378
- cameraList: string[];
379
- pass: string;
380
- appId: string;
381
- user: string;
382
- protocol: "https" | "http" | "https_insecure";
383
- baseUri: string;
384
- }, {
385
- ip: string;
386
- enabled: boolean;
387
- port: number;
388
- pass: string;
389
- user: string;
390
- protocol: "https" | "http" | "https_insecure";
391
- cameraList?: string[] | undefined;
392
- appId?: string | undefined;
393
- baseUri?: string | undefined;
394
- }>>;
395
363
  camstreamerIntegration: z.ZodDefault<z.ZodObject<{
396
364
  adPlacementEnabled: z.ZodBoolean;
397
365
  adMinIntervalSec: z.ZodNumber;
@@ -497,17 +465,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
497
465
  protocol: "https" | "http" | "https_insecure";
498
466
  sourceKey: string;
499
467
  };
500
- genetec: {
501
- ip: string;
502
- enabled: boolean;
503
- port: number;
504
- cameraList: string[];
505
- pass: string;
506
- appId: string;
507
- user: string;
508
- protocol: "https" | "http" | "https_insecure";
509
- baseUri: string;
510
- };
511
468
  camstreamerIntegration: {
512
469
  adPlacementEnabled: boolean;
513
470
  adMinIntervalSec: number;
@@ -649,17 +606,6 @@ export declare const cameraSettingsSchema: z.ZodObject<{
649
606
  protocol: "https" | "http" | "https_insecure";
650
607
  sourceKey: string;
651
608
  } | undefined;
652
- genetec?: {
653
- ip: string;
654
- enabled: boolean;
655
- port: number;
656
- pass: string;
657
- user: string;
658
- protocol: "https" | "http" | "https_insecure";
659
- cameraList?: string[] | undefined;
660
- appId?: string | undefined;
661
- baseUri?: string | undefined;
662
- } | undefined;
663
609
  camstreamerIntegration?: {
664
610
  adPlacementEnabled: boolean;
665
611
  adMinIntervalSec: number;