camstreamerlib 4.0.5 → 4.0.7

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,10 +1,11 @@
1
1
  import { IClient, TResponse } from './internal/types';
2
- import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TTypePriorityList, TWhiteList, TZones } from './types/PlaneTrackerAPI';
2
+ import { ICAO, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TWhiteList, TZones } from './types/PlaneTrackerAPI';
3
3
  import { THttpRequestOptions } from './types/common';
4
4
  import { BasicAPI } from './internal/BasicAPI';
5
+ import { TApiUser } from './types/ws/PlaneTrackerEvents';
5
6
  export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> extends BasicAPI<Client> {
6
7
  private apiUser;
7
- constructor(client: Client, apiUser: TApiUser);
8
+ constructor(client: Client, apiUser: Omit<TApiUser, 'ip'>);
8
9
  static getProxyPath: () => string;
9
10
  static getWsEventsPath: () => string;
10
11
  checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
@@ -185,14 +186,31 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
185
186
  startTrackingPlane(icao: ICAO, options?: THttpRequestOptions): Promise<void>;
186
187
  stopTrackingPlane(options?: THttpRequestOptions): Promise<void>;
187
188
  getIcao(by: TGetIcaoByOption, value: string, options?: THttpRequestOptions): Promise<string>;
188
- getPriorityList(options?: THttpRequestOptions): Promise<string[]>;
189
- setPriorityList(priorityList: TPriorityList['priorityList'], options?: THttpRequestOptions): Promise<void>;
190
- getTypePriorityList(options?: THttpRequestOptions): Promise<string[]>;
191
- setTypePriorityList(typePriorityList: TTypePriorityList['typePriorityList'], options?: THttpRequestOptions): Promise<void>;
192
- getWhiteList(options?: THttpRequestOptions): Promise<string[]>;
193
- setWhiteList(whiteList: TWhiteList['whiteList'], options?: THttpRequestOptions): Promise<void>;
194
- getBlackList(options?: THttpRequestOptions): Promise<string[]>;
195
- setBlackList(blackList: TBlackList['blackList'], options?: THttpRequestOptions): Promise<void>;
189
+ getPriorityList(options?: THttpRequestOptions): Promise<{
190
+ list: {
191
+ priority: number;
192
+ domain: "adsb" | "remoteId";
193
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
194
+ idValue: string;
195
+ }[];
196
+ }>;
197
+ setPriorityList(priorityList: TPriorityList, options?: THttpRequestOptions): Promise<void>;
198
+ getWhiteList(options?: THttpRequestOptions): Promise<{
199
+ list: {
200
+ domain: "adsb" | "remoteId";
201
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
202
+ idValue: string;
203
+ }[];
204
+ }>;
205
+ setWhiteList(whiteList: TWhiteList, options?: THttpRequestOptions): Promise<void>;
206
+ getBlackList(options?: THttpRequestOptions): Promise<{
207
+ list: {
208
+ domain: "adsb" | "remoteId";
209
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
210
+ idValue: string;
211
+ }[];
212
+ }>;
213
+ setBlackList(blackList: TBlackList, options?: THttpRequestOptions): Promise<void>;
196
214
  fetchMapInfo(options?: THttpRequestOptions): Promise<{
197
215
  minZoom: number;
198
216
  maxZoom: number;
@@ -121,31 +121,24 @@ class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
121
121
  }
122
122
  async getPriorityList(options) {
123
123
  const res = await this._getJson(`${BASE_PATH}/package/getPriorityList.cgi`, undefined, options);
124
- return PlaneTrackerAPI_1.priorityListSchema.parse(res).priorityList;
124
+ return PlaneTrackerAPI_1.priorityListSchema.parse(res);
125
125
  }
126
126
  async setPriorityList(priorityList, options) {
127
- await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, { priorityList }, this.apiUser, options);
128
- }
129
- async getTypePriorityList(options) {
130
- const res = await this._getJson(`${BASE_PATH}/package/getTypePriorityList.cgi`, undefined, options);
131
- return PlaneTrackerAPI_1.typePriorityListSchema.parse(res).typePriorityList;
132
- }
133
- async setTypePriorityList(typePriorityList, options) {
134
- await this._postJsonEncoded(`${BASE_PATH}/package/setTypePriorityList.cgi`, { typePriorityList }, this.apiUser, options);
127
+ await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, priorityList, this.apiUser, options);
135
128
  }
136
129
  async getWhiteList(options) {
137
130
  const res = await this._getJson(`${BASE_PATH}/package/getWhiteList.cgi`, undefined, options);
138
- return PlaneTrackerAPI_1.whiteListSchema.parse(res).whiteList;
131
+ return PlaneTrackerAPI_1.whiteListSchema.parse(res);
139
132
  }
140
133
  async setWhiteList(whiteList, options) {
141
- await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, { whiteList }, this.apiUser, options);
134
+ await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, whiteList, this.apiUser, options);
142
135
  }
143
136
  async getBlackList(options) {
144
137
  const res = await this._getJson(`${BASE_PATH}/package/getBlackList.cgi`, undefined, options);
145
- return PlaneTrackerAPI_1.blackListSchema.parse(res).blackList;
138
+ return PlaneTrackerAPI_1.blackListSchema.parse(res);
146
139
  }
147
140
  async setBlackList(blackList, options) {
148
- await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, { blackList }, this.apiUser, options);
141
+ await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, blackList, this.apiUser, options);
149
142
  }
150
143
  async fetchMapInfo(options) {
151
144
  const res = await this._getJson(`${BASE_PATH}/package/getMapInfo.cgi`, undefined, options);
@@ -1,11 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export type TImportDataType = 'MAP_DATA' | 'SERVER_DATA' | 'ALL';
3
3
  export type TExportDataType = 'NIGHT_SKY_CALIBRATION_DATA' | 'ALL';
4
- export type TApiUser = {
5
- userId: string;
6
- userName: string;
7
- userPriority: number;
8
- };
9
4
  export declare const wsAliasResponseSchema: z.ZodObject<{
10
5
  alias: z.ZodString;
11
6
  ws: z.ZodString;
@@ -804,38 +799,132 @@ export declare const flightInfoSchema: z.ZodObject<{
804
799
  }[] | undefined;
805
800
  }>;
806
801
  export type TFlightInfo = z.infer<typeof flightInfoSchema>;
807
- export declare const typePriorityListSchema: z.ZodObject<{
808
- typePriorityList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
802
+ export declare const listEntryDomainSchema: z.ZodEnum<["adsb", "remoteId"]>;
803
+ export declare const listEntryIdTypeSchema: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
804
+ export type TListEntryDomain = z.infer<typeof listEntryDomainSchema>;
805
+ export type TListEntryIdType = z.infer<typeof listEntryIdTypeSchema>;
806
+ export declare const listEntrySchema: z.ZodObject<{
807
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
808
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
809
+ idValue: z.ZodString;
809
810
  }, "strip", z.ZodTypeAny, {
810
- typePriorityList: string[];
811
+ domain: "adsb" | "remoteId";
812
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
813
+ idValue: string;
811
814
  }, {
812
- typePriorityList?: string[] | undefined;
815
+ domain: "adsb" | "remoteId";
816
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
817
+ idValue: string;
813
818
  }>;
814
- export type TTypePriorityList = z.infer<typeof typePriorityListSchema>;
815
- export declare const priorityListSchema: z.ZodObject<{
816
- priorityList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
819
+ export declare const priorityListEntrySchema: z.ZodObject<{
820
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
821
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
822
+ idValue: z.ZodString;
823
+ } & {
824
+ priority: z.ZodNumber;
817
825
  }, "strip", z.ZodTypeAny, {
818
- priorityList: string[];
826
+ priority: number;
827
+ domain: "adsb" | "remoteId";
828
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
829
+ idValue: string;
819
830
  }, {
820
- priorityList?: string[] | undefined;
831
+ priority: number;
832
+ domain: "adsb" | "remoteId";
833
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
834
+ idValue: string;
821
835
  }>;
822
- export type TPriorityList = z.infer<typeof priorityListSchema>;
836
+ export type TListEntry = z.infer<typeof listEntrySchema>;
837
+ export type TPriorityListEntry = z.infer<typeof priorityListEntrySchema>;
823
838
  export declare const whiteListSchema: z.ZodObject<{
824
- whiteList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
839
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
840
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
841
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
842
+ idValue: z.ZodString;
843
+ }, "strip", z.ZodTypeAny, {
844
+ domain: "adsb" | "remoteId";
845
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
846
+ idValue: string;
847
+ }, {
848
+ domain: "adsb" | "remoteId";
849
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
850
+ idValue: string;
851
+ }>, "many">>;
825
852
  }, "strip", z.ZodTypeAny, {
826
- whiteList: string[];
853
+ list: {
854
+ domain: "adsb" | "remoteId";
855
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
856
+ idValue: string;
857
+ }[];
827
858
  }, {
828
- whiteList?: string[] | undefined;
859
+ list?: {
860
+ domain: "adsb" | "remoteId";
861
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
862
+ idValue: string;
863
+ }[] | undefined;
829
864
  }>;
830
- export type TWhiteList = z.infer<typeof whiteListSchema>;
831
865
  export declare const blackListSchema: z.ZodObject<{
832
- blackList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
866
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
867
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
868
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
869
+ idValue: z.ZodString;
870
+ }, "strip", z.ZodTypeAny, {
871
+ domain: "adsb" | "remoteId";
872
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
873
+ idValue: string;
874
+ }, {
875
+ domain: "adsb" | "remoteId";
876
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
877
+ idValue: string;
878
+ }>, "many">>;
879
+ }, "strip", z.ZodTypeAny, {
880
+ list: {
881
+ domain: "adsb" | "remoteId";
882
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
883
+ idValue: string;
884
+ }[];
885
+ }, {
886
+ list?: {
887
+ domain: "adsb" | "remoteId";
888
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
889
+ idValue: string;
890
+ }[] | undefined;
891
+ }>;
892
+ export declare const priorityListSchema: z.ZodObject<{
893
+ list: z.ZodDefault<z.ZodArray<z.ZodObject<{
894
+ domain: z.ZodEnum<["adsb", "remoteId"]>;
895
+ idType: z.ZodEnum<["icao", "type_icao", "drone_mac", "operator_mac", "category"]>;
896
+ idValue: z.ZodString;
897
+ } & {
898
+ priority: z.ZodNumber;
899
+ }, "strip", z.ZodTypeAny, {
900
+ priority: number;
901
+ domain: "adsb" | "remoteId";
902
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
903
+ idValue: string;
904
+ }, {
905
+ priority: number;
906
+ domain: "adsb" | "remoteId";
907
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
908
+ idValue: string;
909
+ }>, "many">>;
833
910
  }, "strip", z.ZodTypeAny, {
834
- blackList: string[];
911
+ list: {
912
+ priority: number;
913
+ domain: "adsb" | "remoteId";
914
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
915
+ idValue: string;
916
+ }[];
835
917
  }, {
836
- blackList?: string[] | undefined;
918
+ list?: {
919
+ priority: number;
920
+ domain: "adsb" | "remoteId";
921
+ idType: "icao" | "type_icao" | "drone_mac" | "operator_mac" | "category";
922
+ idValue: string;
923
+ }[] | undefined;
837
924
  }>;
925
+ export type TWhiteList = z.infer<typeof whiteListSchema>;
838
926
  export type TBlackList = z.infer<typeof blackListSchema>;
927
+ export type TPriorityList = z.infer<typeof priorityListSchema>;
839
928
  export declare const mapTypeSchema: z.ZodEnum<["roadmap", "satellite"]>;
840
929
  export type TMapType = z.infer<typeof mapTypeSchema>;
841
930
  export declare const mapInfoSchema: z.ZodObject<{
@@ -946,4 +1035,43 @@ export declare const zonesSchema: z.ZodObject<{
946
1035
  }[] | undefined;
947
1036
  }>;
948
1037
  export type TZones = z.infer<typeof zonesSchema>;
1038
+ export declare const domainIdSchema: z.ZodEnum<["adsb", "remoteId"]>;
1039
+ export type TDomainId = z.infer<typeof domainIdSchema>;
1040
+ export type TCategoryIcon = 'small' | 'large' | 'heavy' | 'helicopter' | 'drone' | 'operator' | 'unknown';
1041
+ export type TCategoryDescriptor = {
1042
+ categoryId: string;
1043
+ uiName: string;
1044
+ icon: TCategoryIcon;
1045
+ };
1046
+ export type TDomainDescriptor = {
1047
+ uiName: string;
1048
+ icon: TCategoryIcon;
1049
+ categoryList: TCategoryDescriptor[];
1050
+ };
1051
+ export type TDomainList = Record<TDomainId, TDomainDescriptor>;
1052
+ export declare const ADSB_CATEGORY_IDS: {
1053
+ readonly A_LIGHT: "A_LIGHT";
1054
+ readonly A_SMALL: "A_SMALL";
1055
+ readonly A_LARGE: "A_LARGE";
1056
+ readonly A_HIGH_VORTEX: "A_HIGH_VORTEX";
1057
+ readonly A_HEAVY: "A_HEAVY";
1058
+ readonly A_HIGH_PERF: "A_HIGH_PERF";
1059
+ readonly A_ROTORCRAFT: "A_ROTORCRAFT";
1060
+ readonly B_GLIDER: "B_GLIDER";
1061
+ readonly B_LIGHTER_THAN_AIR: "B_LIGHTER_THAN_AIR";
1062
+ readonly B_PARACHUTIST: "B_PARACHUTIST";
1063
+ readonly B_ULTRALIGHT: "B_ULTRALIGHT";
1064
+ readonly B_UAV: "B_UAV";
1065
+ readonly B_SPACE: "B_SPACE";
1066
+ readonly C_SURFACE_EMERGENCY: "C_SURFACE_EMERGENCY";
1067
+ readonly C_SERVICE_VEHICLE: "C_SERVICE_VEHICLE";
1068
+ readonly C_POINT_OBSTACLE: "C_POINT_OBSTACLE";
1069
+ readonly C_CLUSTER_OBSTACLE: "C_CLUSTER_OBSTACLE";
1070
+ readonly C_LINE_OBSTACLE: "C_LINE_OBSTACLE";
1071
+ readonly UNKNOWN: "UNKNOWN";
1072
+ };
1073
+ export declare const REMOTE_ID_CATEGORY_IDS: {
1074
+ readonly DRONE: "DRONE";
1075
+ readonly OPERATOR: "OPERATOR";
1076
+ };
949
1077
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zonesSchema = exports.mapInfoSchema = exports.mapTypeSchema = exports.blackListSchema = exports.whiteListSchema = exports.priorityListSchema = exports.typePriorityListSchema = exports.flightInfoSchema = exports.trackingModeSchema = exports.getIcaoSchema = exports.serverSettingsSchema = exports.cameraSettingsSchema = exports.widgetSchema = exports.connectionSchema = exports.wsAliasResponseSchema = void 0;
3
+ exports.REMOTE_ID_CATEGORY_IDS = exports.ADSB_CATEGORY_IDS = exports.domainIdSchema = exports.zonesSchema = exports.mapInfoSchema = exports.mapTypeSchema = exports.priorityListSchema = exports.blackListSchema = exports.whiteListSchema = exports.priorityListEntrySchema = exports.listEntrySchema = exports.listEntryIdTypeSchema = exports.listEntryDomainSchema = exports.flightInfoSchema = exports.trackingModeSchema = exports.getIcaoSchema = exports.serverSettingsSchema = exports.cameraSettingsSchema = exports.widgetSchema = exports.connectionSchema = exports.wsAliasResponseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.wsAliasResponseSchema = zod_1.z.object({
6
6
  alias: zod_1.z.string(),
@@ -280,17 +280,24 @@ exports.flightInfoSchema = zod_1.z.object({
280
280
  }))
281
281
  .optional(),
282
282
  });
283
- exports.typePriorityListSchema = zod_1.z.object({
284
- typePriorityList: zod_1.z.array(zod_1.z.string()).default([]),
283
+ exports.listEntryDomainSchema = zod_1.z.enum(['adsb', 'remoteId']);
284
+ exports.listEntryIdTypeSchema = zod_1.z.enum(['icao', 'type_icao', 'drone_mac', 'operator_mac', 'category']);
285
+ exports.listEntrySchema = zod_1.z.object({
286
+ domain: exports.listEntryDomainSchema,
287
+ idType: exports.listEntryIdTypeSchema,
288
+ idValue: zod_1.z.string().min(1),
285
289
  });
286
- exports.priorityListSchema = zod_1.z.object({
287
- priorityList: zod_1.z.array(zod_1.z.string()).default([]),
290
+ exports.priorityListEntrySchema = exports.listEntrySchema.extend({
291
+ priority: zod_1.z.number().int().min(1),
288
292
  });
289
293
  exports.whiteListSchema = zod_1.z.object({
290
- whiteList: zod_1.z.array(zod_1.z.string()).default([]),
294
+ list: zod_1.z.array(exports.listEntrySchema).default([]),
291
295
  });
292
296
  exports.blackListSchema = zod_1.z.object({
293
- blackList: zod_1.z.array(zod_1.z.string()).default([]),
297
+ list: zod_1.z.array(exports.listEntrySchema).default([]),
298
+ });
299
+ exports.priorityListSchema = zod_1.z.object({
300
+ list: zod_1.z.array(exports.priorityListEntrySchema).default([]),
294
301
  });
295
302
  exports.mapTypeSchema = zod_1.z.enum(['roadmap', 'satellite']);
296
303
  exports.mapInfoSchema = zod_1.z.object({
@@ -319,3 +326,29 @@ exports.zonesSchema = zod_1.z.object({
319
326
  }))
320
327
  .default([]),
321
328
  });
329
+ exports.domainIdSchema = zod_1.z.enum(['adsb', 'remoteId']);
330
+ exports.ADSB_CATEGORY_IDS = {
331
+ A_LIGHT: 'A_LIGHT',
332
+ A_SMALL: 'A_SMALL',
333
+ A_LARGE: 'A_LARGE',
334
+ A_HIGH_VORTEX: 'A_HIGH_VORTEX',
335
+ A_HEAVY: 'A_HEAVY',
336
+ A_HIGH_PERF: 'A_HIGH_PERF',
337
+ A_ROTORCRAFT: 'A_ROTORCRAFT',
338
+ B_GLIDER: 'B_GLIDER',
339
+ B_LIGHTER_THAN_AIR: 'B_LIGHTER_THAN_AIR',
340
+ B_PARACHUTIST: 'B_PARACHUTIST',
341
+ B_ULTRALIGHT: 'B_ULTRALIGHT',
342
+ B_UAV: 'B_UAV',
343
+ B_SPACE: 'B_SPACE',
344
+ C_SURFACE_EMERGENCY: 'C_SURFACE_EMERGENCY',
345
+ C_SERVICE_VEHICLE: 'C_SERVICE_VEHICLE',
346
+ C_POINT_OBSTACLE: 'C_POINT_OBSTACLE',
347
+ C_CLUSTER_OBSTACLE: 'C_CLUSTER_OBSTACLE',
348
+ C_LINE_OBSTACLE: 'C_LINE_OBSTACLE',
349
+ UNKNOWN: 'UNKNOWN',
350
+ };
351
+ exports.REMOTE_ID_CATEGORY_IDS = {
352
+ DRONE: 'DRONE',
353
+ OPERATOR: 'OPERATOR',
354
+ };