camstreamerlib 4.0.6 → 4.0.8

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, 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>;
@@ -157,7 +158,16 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
157
158
  }>;
158
159
  exportAppSettings(dataType: TExportDataType, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
159
160
  importAppSettings(dataType: TImportDataType, formData: Parameters<Client['post']>[0]['data'], options?: THttpRequestOptions): Promise<void>;
160
- fetchFlightInfo(icao: ICAO, options?: THttpRequestOptions): Promise<{
161
+ getDomainList(options?: THttpRequestOptions): Promise<Partial<Record<"adsb" | "remoteId", {
162
+ uiName: string;
163
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
164
+ categoryList: {
165
+ categoryId: string;
166
+ uiName: string;
167
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
168
+ }[];
169
+ }>>>;
170
+ fetchFlightInfo(targetId: string, options?: THttpRequestOptions): Promise<{
161
171
  destinationAirport: {
162
172
  icao?: string | undefined;
163
173
  iata?: string | undefined;
@@ -184,6 +194,8 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
184
194
  setTrackingMode(mode: TTrackingMode['mode'], options?: THttpRequestOptions): Promise<void>;
185
195
  startTrackingPlane(icao: ICAO, options?: THttpRequestOptions): Promise<void>;
186
196
  stopTrackingPlane(options?: THttpRequestOptions): Promise<void>;
197
+ startTrackingTarget(targetId: string, options?: THttpRequestOptions): Promise<void>;
198
+ stopTrackingTarget(options?: THttpRequestOptions): Promise<void>;
187
199
  getIcao(by: TGetIcaoByOption, value: string, options?: THttpRequestOptions): Promise<string>;
188
200
  getPriorityList(options?: THttpRequestOptions): Promise<{
189
201
  list: {
@@ -88,8 +88,12 @@ class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
88
88
  throw new errors_1.ImportSettingsError(res);
89
89
  }
90
90
  }
91
- async fetchFlightInfo(icao, options) {
92
- const res = await this._getJson(`${BASE_PATH}/package/flightInfo.cgi`, { icao }, options);
91
+ async getDomainList(options) {
92
+ const res = await this._getJson(`${BASE_PATH}/getDomainList.cgi`, { action: 'get' }, options);
93
+ return PlaneTrackerAPI_1.domainListSchema.parse(res);
94
+ }
95
+ async fetchFlightInfo(targetId, options) {
96
+ const res = await this._getJson(`${BASE_PATH}/package/flightInfo.cgi`, { targetId }, options);
93
97
  return PlaneTrackerAPI_1.flightInfoSchema.parse(res);
94
98
  }
95
99
  async getTrackingMode(options) {
@@ -115,9 +119,25 @@ class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
115
119
  timeout: options?.timeout,
116
120
  });
117
121
  }
122
+ async startTrackingTarget(targetId, options) {
123
+ const agent = this.getClient(options?.proxyParams);
124
+ await agent.get({
125
+ path: `${BASE_PATH}/package/trackTarget.cgi`,
126
+ parameters: { targetId, ...this.apiUser },
127
+ timeout: options?.timeout,
128
+ });
129
+ }
130
+ async stopTrackingTarget(options) {
131
+ const agent = this.getClient(options?.proxyParams);
132
+ await agent.get({
133
+ path: `${BASE_PATH}/package/resetTarget.cgi`,
134
+ parameters: this.apiUser,
135
+ timeout: options?.timeout,
136
+ });
137
+ }
118
138
  async getIcao(by, value, options) {
119
139
  const res = await this._getJson(`${BASE_PATH}/package/getIcao.cgi`, { [by]: value }, options);
120
- return PlaneTrackerAPI_1.getIcaoSchema.parse(res).icao;
140
+ return PlaneTrackerAPI_1.getIcaoSchema.parse(res).targetId;
121
141
  }
122
142
  async getPriorityList(options) {
123
143
  const res = await this._getJson(`${BASE_PATH}/package/getPriorityList.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;
@@ -706,10 +701,13 @@ export type TServerSettings = z.infer<typeof serverSettingsSchema>;
706
701
  export type ICAO = string;
707
702
  export declare const getIcaoSchema: z.ZodObject<{
708
703
  icao: z.ZodString;
704
+ targetId: z.ZodString;
709
705
  }, "strip", z.ZodTypeAny, {
710
706
  icao: string;
707
+ targetId: string;
711
708
  }, {
712
709
  icao: string;
710
+ targetId: string;
713
711
  }>;
714
712
  export type TGetIcaoByOption = 'registration' | 'callsign';
715
713
  export declare const trackingModeSchema: z.ZodObject<{
@@ -1040,4 +1038,115 @@ export declare const zonesSchema: z.ZodObject<{
1040
1038
  }[] | undefined;
1041
1039
  }>;
1042
1040
  export type TZones = z.infer<typeof zonesSchema>;
1041
+ export declare const domainIdSchema: z.ZodEnum<["adsb", "remoteId"]>;
1042
+ export type TDomainId = z.infer<typeof domainIdSchema>;
1043
+ declare const categoryIconSchema: z.ZodEnum<["small", "large", "heavy", "helicopter", "drone", "operator", "unknown"]>;
1044
+ export type TCategoryIcon = z.infer<typeof categoryIconSchema>;
1045
+ declare const categoryDescriptorSchema: z.ZodObject<{
1046
+ categoryId: z.ZodString;
1047
+ uiName: z.ZodString;
1048
+ icon: z.ZodEnum<["small", "large", "heavy", "helicopter", "drone", "operator", "unknown"]>;
1049
+ }, "strip", z.ZodTypeAny, {
1050
+ categoryId: string;
1051
+ uiName: string;
1052
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1053
+ }, {
1054
+ categoryId: string;
1055
+ uiName: string;
1056
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1057
+ }>;
1058
+ export type TCategoryDescriptor = z.infer<typeof categoryDescriptorSchema>;
1059
+ declare const domainDescriptorSchema: z.ZodObject<{
1060
+ uiName: z.ZodString;
1061
+ icon: z.ZodEnum<["small", "large", "heavy", "helicopter", "drone", "operator", "unknown"]>;
1062
+ categoryList: z.ZodArray<z.ZodObject<{
1063
+ categoryId: z.ZodString;
1064
+ uiName: z.ZodString;
1065
+ icon: z.ZodEnum<["small", "large", "heavy", "helicopter", "drone", "operator", "unknown"]>;
1066
+ }, "strip", z.ZodTypeAny, {
1067
+ categoryId: string;
1068
+ uiName: string;
1069
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1070
+ }, {
1071
+ categoryId: string;
1072
+ uiName: string;
1073
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1074
+ }>, "many">;
1075
+ }, "strip", z.ZodTypeAny, {
1076
+ uiName: string;
1077
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1078
+ categoryList: {
1079
+ categoryId: string;
1080
+ uiName: string;
1081
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1082
+ }[];
1083
+ }, {
1084
+ uiName: string;
1085
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1086
+ categoryList: {
1087
+ categoryId: string;
1088
+ uiName: string;
1089
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1090
+ }[];
1091
+ }>;
1092
+ export type TDomainDescriptor = z.infer<typeof domainDescriptorSchema>;
1093
+ export declare const domainListSchema: z.ZodRecord<z.ZodEnum<["adsb", "remoteId"]>, z.ZodObject<{
1094
+ uiName: z.ZodString;
1095
+ icon: z.ZodEnum<["small", "large", "heavy", "helicopter", "drone", "operator", "unknown"]>;
1096
+ categoryList: z.ZodArray<z.ZodObject<{
1097
+ categoryId: z.ZodString;
1098
+ uiName: z.ZodString;
1099
+ icon: z.ZodEnum<["small", "large", "heavy", "helicopter", "drone", "operator", "unknown"]>;
1100
+ }, "strip", z.ZodTypeAny, {
1101
+ categoryId: string;
1102
+ uiName: string;
1103
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1104
+ }, {
1105
+ categoryId: string;
1106
+ uiName: string;
1107
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1108
+ }>, "many">;
1109
+ }, "strip", z.ZodTypeAny, {
1110
+ uiName: string;
1111
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1112
+ categoryList: {
1113
+ categoryId: string;
1114
+ uiName: string;
1115
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1116
+ }[];
1117
+ }, {
1118
+ uiName: string;
1119
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1120
+ categoryList: {
1121
+ categoryId: string;
1122
+ uiName: string;
1123
+ icon: "unknown" | "small" | "large" | "heavy" | "helicopter" | "drone" | "operator";
1124
+ }[];
1125
+ }>>;
1126
+ export type TDomainList = z.infer<typeof domainListSchema>;
1127
+ export declare const ADSB_CATEGORY_IDS: {
1128
+ readonly A_LIGHT: "A_LIGHT";
1129
+ readonly A_SMALL: "A_SMALL";
1130
+ readonly A_LARGE: "A_LARGE";
1131
+ readonly A_HIGH_VORTEX: "A_HIGH_VORTEX";
1132
+ readonly A_HEAVY: "A_HEAVY";
1133
+ readonly A_HIGH_PERF: "A_HIGH_PERF";
1134
+ readonly A_ROTORCRAFT: "A_ROTORCRAFT";
1135
+ readonly B_GLIDER: "B_GLIDER";
1136
+ readonly B_LIGHTER_THAN_AIR: "B_LIGHTER_THAN_AIR";
1137
+ readonly B_PARACHUTIST: "B_PARACHUTIST";
1138
+ readonly B_ULTRALIGHT: "B_ULTRALIGHT";
1139
+ readonly B_UAV: "B_UAV";
1140
+ readonly B_SPACE: "B_SPACE";
1141
+ readonly C_SURFACE_EMERGENCY: "C_SURFACE_EMERGENCY";
1142
+ readonly C_SERVICE_VEHICLE: "C_SERVICE_VEHICLE";
1143
+ readonly C_POINT_OBSTACLE: "C_POINT_OBSTACLE";
1144
+ readonly C_CLUSTER_OBSTACLE: "C_CLUSTER_OBSTACLE";
1145
+ readonly C_LINE_OBSTACLE: "C_LINE_OBSTACLE";
1146
+ readonly UNKNOWN: "UNKNOWN";
1147
+ };
1148
+ export declare const REMOTE_ID_CATEGORY_IDS: {
1149
+ readonly DRONE: "DRONE";
1150
+ readonly OPERATOR: "OPERATOR";
1151
+ };
1043
1152
  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.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;
3
+ exports.REMOTE_ID_CATEGORY_IDS = exports.ADSB_CATEGORY_IDS = exports.domainListSchema = 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(),
@@ -251,6 +251,7 @@ exports.serverSettingsSchema = zod_1.z.object({
251
251
  });
252
252
  exports.getIcaoSchema = zod_1.z.object({
253
253
  icao: zod_1.z.string(),
254
+ targetId: zod_1.z.string(),
254
255
  });
255
256
  exports.trackingModeSchema = zod_1.z.object({
256
257
  mode: zod_1.z.union([zod_1.z.literal('MANUAL'), zod_1.z.literal('AUTOMATIC')]).default('AUTOMATIC'),
@@ -326,3 +327,41 @@ exports.zonesSchema = zod_1.z.object({
326
327
  }))
327
328
  .default([]),
328
329
  });
330
+ exports.domainIdSchema = zod_1.z.enum(['adsb', 'remoteId']);
331
+ const categoryIconSchema = zod_1.z.enum(['small', 'large', 'heavy', 'helicopter', 'drone', 'operator', 'unknown']);
332
+ const categoryDescriptorSchema = zod_1.z.object({
333
+ categoryId: zod_1.z.string(),
334
+ uiName: zod_1.z.string(),
335
+ icon: categoryIconSchema,
336
+ });
337
+ const domainDescriptorSchema = zod_1.z.object({
338
+ uiName: zod_1.z.string(),
339
+ icon: categoryIconSchema,
340
+ categoryList: zod_1.z.array(categoryDescriptorSchema),
341
+ });
342
+ exports.domainListSchema = zod_1.z.record(exports.domainIdSchema, domainDescriptorSchema);
343
+ exports.ADSB_CATEGORY_IDS = {
344
+ A_LIGHT: 'A_LIGHT',
345
+ A_SMALL: 'A_SMALL',
346
+ A_LARGE: 'A_LARGE',
347
+ A_HIGH_VORTEX: 'A_HIGH_VORTEX',
348
+ A_HEAVY: 'A_HEAVY',
349
+ A_HIGH_PERF: 'A_HIGH_PERF',
350
+ A_ROTORCRAFT: 'A_ROTORCRAFT',
351
+ B_GLIDER: 'B_GLIDER',
352
+ B_LIGHTER_THAN_AIR: 'B_LIGHTER_THAN_AIR',
353
+ B_PARACHUTIST: 'B_PARACHUTIST',
354
+ B_ULTRALIGHT: 'B_ULTRALIGHT',
355
+ B_UAV: 'B_UAV',
356
+ B_SPACE: 'B_SPACE',
357
+ C_SURFACE_EMERGENCY: 'C_SURFACE_EMERGENCY',
358
+ C_SERVICE_VEHICLE: 'C_SERVICE_VEHICLE',
359
+ C_POINT_OBSTACLE: 'C_POINT_OBSTACLE',
360
+ C_CLUSTER_OBSTACLE: 'C_CLUSTER_OBSTACLE',
361
+ C_LINE_OBSTACLE: 'C_LINE_OBSTACLE',
362
+ UNKNOWN: 'UNKNOWN',
363
+ };
364
+ exports.REMOTE_ID_CATEGORY_IDS = {
365
+ DRONE: 'DRONE',
366
+ OPERATOR: 'OPERATOR',
367
+ };