camstreamerlib 4.0.6 → 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.
- package/cjs/PlaneTrackerAPI.d.ts +3 -2
- package/cjs/types/PlaneTrackerAPI.d.ts +39 -5
- package/cjs/types/PlaneTrackerAPI.js +27 -1
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +158 -100
- package/cjs/types/ws/PlaneTrackerEvents.js +59 -62
- package/cjs/ws/PlaneTrackerEvents.d.ts +3 -4
- package/cjs/ws/PlaneTrackerEvents.js +2 -2
- package/esm/types/PlaneTrackerAPI.js +26 -0
- package/esm/types/ws/PlaneTrackerEvents.js +59 -62
- package/esm/ws/PlaneTrackerEvents.js +3 -3
- package/package.json +1 -1
- package/types/PlaneTrackerAPI.d.ts +3 -2
- package/types/types/PlaneTrackerAPI.d.ts +39 -5
- package/types/types/ws/PlaneTrackerEvents.d.ts +158 -100
- package/types/ws/PlaneTrackerEvents.d.ts +3 -4
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ptrEventsSchema = exports.
|
|
3
|
+
exports.ptrEventsSchema = exports.wsUserActionData = exports.EUserActions = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const PlaneTrackerAPI_1 = require("../PlaneTrackerAPI");
|
|
6
|
-
const
|
|
6
|
+
const wsApiFlightDataSchema = zod_1.z.object({
|
|
7
|
+
targetId: zod_1.z.string(),
|
|
7
8
|
icao: zod_1.z.string(),
|
|
9
|
+
domain: PlaneTrackerAPI_1.domainIdSchema,
|
|
10
|
+
categoryId: zod_1.z.string(),
|
|
11
|
+
groupId: zod_1.z.string().optional(),
|
|
8
12
|
lat: zod_1.z.number(),
|
|
9
13
|
lon: zod_1.z.number(),
|
|
10
14
|
heading: zod_1.z.number(),
|
|
@@ -15,7 +19,6 @@ const apiFlightDataSchema = zod_1.z.object({
|
|
|
15
19
|
whiteListed: zod_1.z.boolean(),
|
|
16
20
|
blackListed: zod_1.z.boolean(),
|
|
17
21
|
priorityListed: zod_1.z.boolean(),
|
|
18
|
-
typePriorityListed: zod_1.z.boolean().default(false),
|
|
19
22
|
autoSelectionIgnored: zod_1.z.boolean(),
|
|
20
23
|
signalQuality: zod_1.z.number(),
|
|
21
24
|
emitterCategorySet: zod_1.z.number().default(4),
|
|
@@ -23,6 +26,13 @@ const apiFlightDataSchema = zod_1.z.object({
|
|
|
23
26
|
emergencyState: zod_1.z.boolean(),
|
|
24
27
|
emergencyStatusMessage: zod_1.z.string(),
|
|
25
28
|
});
|
|
29
|
+
const wsCameraPositionDataSchema = zod_1.z.object({
|
|
30
|
+
lat: zod_1.z.number(),
|
|
31
|
+
lon: zod_1.z.number(),
|
|
32
|
+
azimuth: zod_1.z.number().min(0).max(360),
|
|
33
|
+
elevation: zod_1.z.number().min(-90).max(90),
|
|
34
|
+
fov: zod_1.z.number(),
|
|
35
|
+
});
|
|
26
36
|
const apiUserSchema = zod_1.z.object({
|
|
27
37
|
userId: zod_1.z.string(),
|
|
28
38
|
userName: zod_1.z.string(),
|
|
@@ -34,63 +44,53 @@ const apiStringUserSchema = zod_1.z.object({
|
|
|
34
44
|
userName: zod_1.z.string(),
|
|
35
45
|
userPriority: zod_1.z.string(),
|
|
36
46
|
});
|
|
37
|
-
var
|
|
38
|
-
(function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
PlaneTrackerUserActions["GO_TO_COORDINATES"] = "goToCoordinates.cgi";
|
|
55
|
-
PlaneTrackerUserActions["SET_TRACKING_MODE"] = "setTrackingMode.cgi";
|
|
56
|
-
PlaneTrackerUserActions["SET_ZONES"] = "setZones.cgi";
|
|
57
|
-
PlaneTrackerUserActions["RESET_PTZ_CALIBRATION"] = "resetPtzCalibration.cgi";
|
|
58
|
-
PlaneTrackerUserActions["LOCK_API"] = "lockApi.cgi";
|
|
59
|
-
PlaneTrackerUserActions["UNLOCK_API"] = "unlockApi.cgi";
|
|
60
|
-
})(PlaneTrackerUserActions || (exports.PlaneTrackerUserActions = PlaneTrackerUserActions = {}));
|
|
61
|
-
exports.planeTrackerUserActionData = zod_1.z.discriminatedUnion('cgi', [
|
|
62
|
-
zod_1.z.object({
|
|
63
|
-
cgi: zod_1.z.literal(PlaneTrackerUserActions.TRACK_ICAO),
|
|
47
|
+
var EUserActions;
|
|
48
|
+
(function (EUserActions) {
|
|
49
|
+
EUserActions["TRACK_ICAO"] = "trackIcao.cgi";
|
|
50
|
+
EUserActions["RESET_ICAO"] = "resetIcao.cgi";
|
|
51
|
+
EUserActions["SET_PRIORITY_LIST"] = "setPriorityList.cgi";
|
|
52
|
+
EUserActions["SET_BLACK_LIST"] = "setBlackList.cgi";
|
|
53
|
+
EUserActions["SET_WHITE_LIST"] = "setWhiteList.cgi";
|
|
54
|
+
EUserActions["GO_TO_COORDINATES"] = "goToCoordinates.cgi";
|
|
55
|
+
EUserActions["SET_TRACKING_MODE"] = "setTrackingMode.cgi";
|
|
56
|
+
EUserActions["SET_ZONES"] = "setZones.cgi";
|
|
57
|
+
EUserActions["RESET_PTZ_CALIBRATION"] = "resetPtzCalibration.cgi";
|
|
58
|
+
EUserActions["LOCK_API"] = "lockApi.cgi";
|
|
59
|
+
EUserActions["UNLOCK_API"] = "unlockApi.cgi";
|
|
60
|
+
})(EUserActions || (exports.EUserActions = EUserActions = {}));
|
|
61
|
+
exports.wsUserActionData = zod_1.z.discriminatedUnion('cgi', [
|
|
62
|
+
zod_1.z.object({
|
|
63
|
+
cgi: zod_1.z.literal(EUserActions.TRACK_ICAO),
|
|
64
64
|
ip: zod_1.z.string(),
|
|
65
65
|
params: apiStringUserSchema.extend({
|
|
66
66
|
icao: zod_1.z.string(),
|
|
67
67
|
}),
|
|
68
68
|
}),
|
|
69
69
|
zod_1.z.object({
|
|
70
|
-
cgi: zod_1.z.literal(
|
|
70
|
+
cgi: zod_1.z.literal(EUserActions.RESET_ICAO),
|
|
71
71
|
ip: zod_1.z.string(),
|
|
72
72
|
params: apiStringUserSchema,
|
|
73
73
|
}),
|
|
74
74
|
zod_1.z.object({
|
|
75
|
-
cgi: zod_1.z.literal(
|
|
75
|
+
cgi: zod_1.z.literal(EUserActions.SET_PRIORITY_LIST),
|
|
76
76
|
ip: zod_1.z.string(),
|
|
77
77
|
params: apiStringUserSchema,
|
|
78
78
|
postJsonBody: PlaneTrackerAPI_1.priorityListSchema,
|
|
79
79
|
}),
|
|
80
80
|
zod_1.z.object({
|
|
81
|
-
cgi: zod_1.z.literal(
|
|
81
|
+
cgi: zod_1.z.literal(EUserActions.SET_BLACK_LIST),
|
|
82
82
|
ip: zod_1.z.string(),
|
|
83
83
|
params: apiStringUserSchema,
|
|
84
84
|
postJsonBody: PlaneTrackerAPI_1.blackListSchema,
|
|
85
85
|
}),
|
|
86
86
|
zod_1.z.object({
|
|
87
|
-
cgi: zod_1.z.literal(
|
|
87
|
+
cgi: zod_1.z.literal(EUserActions.SET_WHITE_LIST),
|
|
88
88
|
ip: zod_1.z.string(),
|
|
89
89
|
params: apiStringUserSchema,
|
|
90
90
|
postJsonBody: PlaneTrackerAPI_1.whiteListSchema,
|
|
91
91
|
}),
|
|
92
92
|
zod_1.z.object({
|
|
93
|
-
cgi: zod_1.z.literal(
|
|
93
|
+
cgi: zod_1.z.literal(EUserActions.GO_TO_COORDINATES),
|
|
94
94
|
ip: zod_1.z.string(),
|
|
95
95
|
params: apiStringUserSchema.extend({
|
|
96
96
|
lat: zod_1.z.string(),
|
|
@@ -98,44 +98,41 @@ exports.planeTrackerUserActionData = zod_1.z.discriminatedUnion('cgi', [
|
|
|
98
98
|
}),
|
|
99
99
|
}),
|
|
100
100
|
zod_1.z.object({
|
|
101
|
-
cgi: zod_1.z.literal(
|
|
101
|
+
cgi: zod_1.z.literal(EUserActions.SET_TRACKING_MODE),
|
|
102
102
|
ip: zod_1.z.string(),
|
|
103
103
|
params: apiStringUserSchema,
|
|
104
104
|
postJsonBody: PlaneTrackerAPI_1.trackingModeSchema,
|
|
105
105
|
}),
|
|
106
106
|
zod_1.z.object({
|
|
107
|
-
cgi: zod_1.z.literal(
|
|
107
|
+
cgi: zod_1.z.literal(EUserActions.SET_ZONES),
|
|
108
108
|
ip: zod_1.z.string(),
|
|
109
109
|
params: apiStringUserSchema,
|
|
110
110
|
postJsonBody: PlaneTrackerAPI_1.zonesSchema,
|
|
111
111
|
}),
|
|
112
112
|
zod_1.z.object({
|
|
113
|
-
cgi: zod_1.z.literal(
|
|
113
|
+
cgi: zod_1.z.literal(EUserActions.RESET_PTZ_CALIBRATION),
|
|
114
114
|
ip: zod_1.z.string(),
|
|
115
115
|
params: apiStringUserSchema,
|
|
116
116
|
}),
|
|
117
117
|
zod_1.z.object({
|
|
118
|
-
cgi: zod_1.z.literal(
|
|
118
|
+
cgi: zod_1.z.literal(EUserActions.LOCK_API),
|
|
119
119
|
ip: zod_1.z.string(),
|
|
120
120
|
params: apiStringUserSchema.extend({
|
|
121
121
|
timeout: zod_1.z.string(),
|
|
122
122
|
}),
|
|
123
123
|
}),
|
|
124
124
|
zod_1.z.object({
|
|
125
|
-
cgi: zod_1.z.literal(
|
|
125
|
+
cgi: zod_1.z.literal(EUserActions.UNLOCK_API),
|
|
126
126
|
ip: zod_1.z.string(),
|
|
127
127
|
params: apiStringUserSchema,
|
|
128
128
|
}),
|
|
129
129
|
]);
|
|
130
|
-
const
|
|
131
|
-
zod_1.z
|
|
130
|
+
const eventsDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
131
|
+
zod_1.z
|
|
132
|
+
.object({
|
|
132
133
|
type: zod_1.z.literal('CAMERA_POSITION'),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
azimuth: zod_1.z.number().min(0).max(360),
|
|
136
|
-
elevation: zod_1.z.number().min(-90).max(90),
|
|
137
|
-
fov: zod_1.z.number(),
|
|
138
|
-
}),
|
|
134
|
+
})
|
|
135
|
+
.merge(wsCameraPositionDataSchema),
|
|
139
136
|
zod_1.z.object({
|
|
140
137
|
type: zod_1.z.literal('TRACKING_START'),
|
|
141
138
|
icao: zod_1.z.string(),
|
|
@@ -145,7 +142,7 @@ const ptrEventsDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
145
142
|
}),
|
|
146
143
|
zod_1.z.object({
|
|
147
144
|
type: zod_1.z.literal('FLIGHT_LIST'),
|
|
148
|
-
list: zod_1.z.array(
|
|
145
|
+
list: zod_1.z.array(wsApiFlightDataSchema),
|
|
149
146
|
}),
|
|
150
147
|
zod_1.z.object({
|
|
151
148
|
type: zod_1.z.literal('USER_ACTION'),
|
|
@@ -156,17 +153,17 @@ const ptrEventsDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
156
153
|
timeout: zod_1.z.string().optional(),
|
|
157
154
|
}),
|
|
158
155
|
cgi: zod_1.z.enum([
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
156
|
+
EUserActions.TRACK_ICAO,
|
|
157
|
+
EUserActions.RESET_ICAO,
|
|
158
|
+
EUserActions.SET_PRIORITY_LIST,
|
|
159
|
+
EUserActions.SET_BLACK_LIST,
|
|
160
|
+
EUserActions.SET_WHITE_LIST,
|
|
161
|
+
EUserActions.GO_TO_COORDINATES,
|
|
162
|
+
EUserActions.SET_TRACKING_MODE,
|
|
163
|
+
EUserActions.SET_ZONES,
|
|
164
|
+
EUserActions.RESET_PTZ_CALIBRATION,
|
|
165
|
+
EUserActions.LOCK_API,
|
|
166
|
+
EUserActions.UNLOCK_API,
|
|
170
167
|
]),
|
|
171
168
|
postJsonBody: zod_1.z.any(),
|
|
172
169
|
}),
|
|
@@ -186,6 +183,6 @@ const ptrEventsDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
186
183
|
}),
|
|
187
184
|
]);
|
|
188
185
|
exports.ptrEventsSchema = zod_1.z.discriminatedUnion('type', [
|
|
189
|
-
zod_1.z.object({ type: zod_1.z.literal('init'), data:
|
|
190
|
-
...
|
|
186
|
+
zod_1.z.object({ type: zod_1.z.literal('init'), data: eventsDataSchema }),
|
|
187
|
+
...eventsDataSchema.options,
|
|
191
188
|
]);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IWsClient } from '../internal/types';
|
|
2
2
|
import { WsEvents } from '../internal/WsEvents';
|
|
3
|
-
import { TApiUser } from '../types/
|
|
4
|
-
|
|
5
|
-
export declare class PlaneTrackerEvents extends WsEvents<TPlaneTrackerEvent> {
|
|
3
|
+
import { TEventData, TApiUser } from '../types/ws/PlaneTrackerEvents';
|
|
4
|
+
export declare class PlaneTrackerEvents extends WsEvents<TEventData> {
|
|
6
5
|
private _apiUser;
|
|
7
|
-
constructor(ws: IWsClient, _apiUser: TApiUser);
|
|
6
|
+
constructor(ws: IWsClient, _apiUser: Omit<TApiUser, 'ip'>);
|
|
8
7
|
private sendInitMsg;
|
|
9
8
|
}
|
|
@@ -8,9 +8,9 @@ class PlaneTrackerEvents extends WsEvents_1.WsEvents {
|
|
|
8
8
|
constructor(ws, _apiUser) {
|
|
9
9
|
super((data) => {
|
|
10
10
|
const parsedData = PlaneTrackerEvents_1.ptrEventsSchema.parse(data);
|
|
11
|
-
if (parsedData.type ===
|
|
11
|
+
if (parsedData.type === 'USER_ACTION') {
|
|
12
12
|
const { type, ...actionData } = parsedData;
|
|
13
|
-
const userAction = PlaneTrackerEvents_1.
|
|
13
|
+
const userAction = PlaneTrackerEvents_1.wsUserActionData.parse(actionData);
|
|
14
14
|
return { ...userAction, type };
|
|
15
15
|
}
|
|
16
16
|
return parsedData;
|
|
@@ -323,3 +323,29 @@ export const zonesSchema = z.object({
|
|
|
323
323
|
}))
|
|
324
324
|
.default([]),
|
|
325
325
|
});
|
|
326
|
+
export const domainIdSchema = z.enum(['adsb', 'remoteId']);
|
|
327
|
+
export const ADSB_CATEGORY_IDS = {
|
|
328
|
+
A_LIGHT: 'A_LIGHT',
|
|
329
|
+
A_SMALL: 'A_SMALL',
|
|
330
|
+
A_LARGE: 'A_LARGE',
|
|
331
|
+
A_HIGH_VORTEX: 'A_HIGH_VORTEX',
|
|
332
|
+
A_HEAVY: 'A_HEAVY',
|
|
333
|
+
A_HIGH_PERF: 'A_HIGH_PERF',
|
|
334
|
+
A_ROTORCRAFT: 'A_ROTORCRAFT',
|
|
335
|
+
B_GLIDER: 'B_GLIDER',
|
|
336
|
+
B_LIGHTER_THAN_AIR: 'B_LIGHTER_THAN_AIR',
|
|
337
|
+
B_PARACHUTIST: 'B_PARACHUTIST',
|
|
338
|
+
B_ULTRALIGHT: 'B_ULTRALIGHT',
|
|
339
|
+
B_UAV: 'B_UAV',
|
|
340
|
+
B_SPACE: 'B_SPACE',
|
|
341
|
+
C_SURFACE_EMERGENCY: 'C_SURFACE_EMERGENCY',
|
|
342
|
+
C_SERVICE_VEHICLE: 'C_SERVICE_VEHICLE',
|
|
343
|
+
C_POINT_OBSTACLE: 'C_POINT_OBSTACLE',
|
|
344
|
+
C_CLUSTER_OBSTACLE: 'C_CLUSTER_OBSTACLE',
|
|
345
|
+
C_LINE_OBSTACLE: 'C_LINE_OBSTACLE',
|
|
346
|
+
UNKNOWN: 'UNKNOWN',
|
|
347
|
+
};
|
|
348
|
+
export const REMOTE_ID_CATEGORY_IDS = {
|
|
349
|
+
DRONE: 'DRONE',
|
|
350
|
+
OPERATOR: 'OPERATOR',
|
|
351
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { blackListSchema, priorityListSchema, trackingModeSchema, whiteListSchema, zonesSchema, } from '../PlaneTrackerAPI';
|
|
3
|
-
const
|
|
2
|
+
import { blackListSchema, priorityListSchema, trackingModeSchema, whiteListSchema, zonesSchema, domainIdSchema, } from '../PlaneTrackerAPI';
|
|
3
|
+
const wsApiFlightDataSchema = z.object({
|
|
4
|
+
targetId: z.string(),
|
|
4
5
|
icao: z.string(),
|
|
6
|
+
domain: domainIdSchema,
|
|
7
|
+
categoryId: z.string(),
|
|
8
|
+
groupId: z.string().optional(),
|
|
5
9
|
lat: z.number(),
|
|
6
10
|
lon: z.number(),
|
|
7
11
|
heading: z.number(),
|
|
@@ -12,7 +16,6 @@ const apiFlightDataSchema = z.object({
|
|
|
12
16
|
whiteListed: z.boolean(),
|
|
13
17
|
blackListed: z.boolean(),
|
|
14
18
|
priorityListed: z.boolean(),
|
|
15
|
-
typePriorityListed: z.boolean().default(false),
|
|
16
19
|
autoSelectionIgnored: z.boolean(),
|
|
17
20
|
signalQuality: z.number(),
|
|
18
21
|
emitterCategorySet: z.number().default(4),
|
|
@@ -20,6 +23,13 @@ const apiFlightDataSchema = z.object({
|
|
|
20
23
|
emergencyState: z.boolean(),
|
|
21
24
|
emergencyStatusMessage: z.string(),
|
|
22
25
|
});
|
|
26
|
+
const wsCameraPositionDataSchema = z.object({
|
|
27
|
+
lat: z.number(),
|
|
28
|
+
lon: z.number(),
|
|
29
|
+
azimuth: z.number().min(0).max(360),
|
|
30
|
+
elevation: z.number().min(-90).max(90),
|
|
31
|
+
fov: z.number(),
|
|
32
|
+
});
|
|
23
33
|
const apiUserSchema = z.object({
|
|
24
34
|
userId: z.string(),
|
|
25
35
|
userName: z.string(),
|
|
@@ -31,63 +41,53 @@ const apiStringUserSchema = z.object({
|
|
|
31
41
|
userName: z.string(),
|
|
32
42
|
userPriority: z.string(),
|
|
33
43
|
});
|
|
34
|
-
export var
|
|
35
|
-
(function (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
PlaneTrackerUserActions["GO_TO_COORDINATES"] = "goToCoordinates.cgi";
|
|
52
|
-
PlaneTrackerUserActions["SET_TRACKING_MODE"] = "setTrackingMode.cgi";
|
|
53
|
-
PlaneTrackerUserActions["SET_ZONES"] = "setZones.cgi";
|
|
54
|
-
PlaneTrackerUserActions["RESET_PTZ_CALIBRATION"] = "resetPtzCalibration.cgi";
|
|
55
|
-
PlaneTrackerUserActions["LOCK_API"] = "lockApi.cgi";
|
|
56
|
-
PlaneTrackerUserActions["UNLOCK_API"] = "unlockApi.cgi";
|
|
57
|
-
})(PlaneTrackerUserActions || (PlaneTrackerUserActions = {}));
|
|
58
|
-
export const planeTrackerUserActionData = z.discriminatedUnion('cgi', [
|
|
59
|
-
z.object({
|
|
60
|
-
cgi: z.literal(PlaneTrackerUserActions.TRACK_ICAO),
|
|
44
|
+
export var EUserActions;
|
|
45
|
+
(function (EUserActions) {
|
|
46
|
+
EUserActions["TRACK_ICAO"] = "trackIcao.cgi";
|
|
47
|
+
EUserActions["RESET_ICAO"] = "resetIcao.cgi";
|
|
48
|
+
EUserActions["SET_PRIORITY_LIST"] = "setPriorityList.cgi";
|
|
49
|
+
EUserActions["SET_BLACK_LIST"] = "setBlackList.cgi";
|
|
50
|
+
EUserActions["SET_WHITE_LIST"] = "setWhiteList.cgi";
|
|
51
|
+
EUserActions["GO_TO_COORDINATES"] = "goToCoordinates.cgi";
|
|
52
|
+
EUserActions["SET_TRACKING_MODE"] = "setTrackingMode.cgi";
|
|
53
|
+
EUserActions["SET_ZONES"] = "setZones.cgi";
|
|
54
|
+
EUserActions["RESET_PTZ_CALIBRATION"] = "resetPtzCalibration.cgi";
|
|
55
|
+
EUserActions["LOCK_API"] = "lockApi.cgi";
|
|
56
|
+
EUserActions["UNLOCK_API"] = "unlockApi.cgi";
|
|
57
|
+
})(EUserActions || (EUserActions = {}));
|
|
58
|
+
export const wsUserActionData = z.discriminatedUnion('cgi', [
|
|
59
|
+
z.object({
|
|
60
|
+
cgi: z.literal(EUserActions.TRACK_ICAO),
|
|
61
61
|
ip: z.string(),
|
|
62
62
|
params: apiStringUserSchema.extend({
|
|
63
63
|
icao: z.string(),
|
|
64
64
|
}),
|
|
65
65
|
}),
|
|
66
66
|
z.object({
|
|
67
|
-
cgi: z.literal(
|
|
67
|
+
cgi: z.literal(EUserActions.RESET_ICAO),
|
|
68
68
|
ip: z.string(),
|
|
69
69
|
params: apiStringUserSchema,
|
|
70
70
|
}),
|
|
71
71
|
z.object({
|
|
72
|
-
cgi: z.literal(
|
|
72
|
+
cgi: z.literal(EUserActions.SET_PRIORITY_LIST),
|
|
73
73
|
ip: z.string(),
|
|
74
74
|
params: apiStringUserSchema,
|
|
75
75
|
postJsonBody: priorityListSchema,
|
|
76
76
|
}),
|
|
77
77
|
z.object({
|
|
78
|
-
cgi: z.literal(
|
|
78
|
+
cgi: z.literal(EUserActions.SET_BLACK_LIST),
|
|
79
79
|
ip: z.string(),
|
|
80
80
|
params: apiStringUserSchema,
|
|
81
81
|
postJsonBody: blackListSchema,
|
|
82
82
|
}),
|
|
83
83
|
z.object({
|
|
84
|
-
cgi: z.literal(
|
|
84
|
+
cgi: z.literal(EUserActions.SET_WHITE_LIST),
|
|
85
85
|
ip: z.string(),
|
|
86
86
|
params: apiStringUserSchema,
|
|
87
87
|
postJsonBody: whiteListSchema,
|
|
88
88
|
}),
|
|
89
89
|
z.object({
|
|
90
|
-
cgi: z.literal(
|
|
90
|
+
cgi: z.literal(EUserActions.GO_TO_COORDINATES),
|
|
91
91
|
ip: z.string(),
|
|
92
92
|
params: apiStringUserSchema.extend({
|
|
93
93
|
lat: z.string(),
|
|
@@ -95,44 +95,41 @@ export const planeTrackerUserActionData = z.discriminatedUnion('cgi', [
|
|
|
95
95
|
}),
|
|
96
96
|
}),
|
|
97
97
|
z.object({
|
|
98
|
-
cgi: z.literal(
|
|
98
|
+
cgi: z.literal(EUserActions.SET_TRACKING_MODE),
|
|
99
99
|
ip: z.string(),
|
|
100
100
|
params: apiStringUserSchema,
|
|
101
101
|
postJsonBody: trackingModeSchema,
|
|
102
102
|
}),
|
|
103
103
|
z.object({
|
|
104
|
-
cgi: z.literal(
|
|
104
|
+
cgi: z.literal(EUserActions.SET_ZONES),
|
|
105
105
|
ip: z.string(),
|
|
106
106
|
params: apiStringUserSchema,
|
|
107
107
|
postJsonBody: zonesSchema,
|
|
108
108
|
}),
|
|
109
109
|
z.object({
|
|
110
|
-
cgi: z.literal(
|
|
110
|
+
cgi: z.literal(EUserActions.RESET_PTZ_CALIBRATION),
|
|
111
111
|
ip: z.string(),
|
|
112
112
|
params: apiStringUserSchema,
|
|
113
113
|
}),
|
|
114
114
|
z.object({
|
|
115
|
-
cgi: z.literal(
|
|
115
|
+
cgi: z.literal(EUserActions.LOCK_API),
|
|
116
116
|
ip: z.string(),
|
|
117
117
|
params: apiStringUserSchema.extend({
|
|
118
118
|
timeout: z.string(),
|
|
119
119
|
}),
|
|
120
120
|
}),
|
|
121
121
|
z.object({
|
|
122
|
-
cgi: z.literal(
|
|
122
|
+
cgi: z.literal(EUserActions.UNLOCK_API),
|
|
123
123
|
ip: z.string(),
|
|
124
124
|
params: apiStringUserSchema,
|
|
125
125
|
}),
|
|
126
126
|
]);
|
|
127
|
-
const
|
|
128
|
-
z
|
|
127
|
+
const eventsDataSchema = z.discriminatedUnion('type', [
|
|
128
|
+
z
|
|
129
|
+
.object({
|
|
129
130
|
type: z.literal('CAMERA_POSITION'),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
azimuth: z.number().min(0).max(360),
|
|
133
|
-
elevation: z.number().min(-90).max(90),
|
|
134
|
-
fov: z.number(),
|
|
135
|
-
}),
|
|
131
|
+
})
|
|
132
|
+
.merge(wsCameraPositionDataSchema),
|
|
136
133
|
z.object({
|
|
137
134
|
type: z.literal('TRACKING_START'),
|
|
138
135
|
icao: z.string(),
|
|
@@ -142,7 +139,7 @@ const ptrEventsDataSchema = z.discriminatedUnion('type', [
|
|
|
142
139
|
}),
|
|
143
140
|
z.object({
|
|
144
141
|
type: z.literal('FLIGHT_LIST'),
|
|
145
|
-
list: z.array(
|
|
142
|
+
list: z.array(wsApiFlightDataSchema),
|
|
146
143
|
}),
|
|
147
144
|
z.object({
|
|
148
145
|
type: z.literal('USER_ACTION'),
|
|
@@ -153,17 +150,17 @@ const ptrEventsDataSchema = z.discriminatedUnion('type', [
|
|
|
153
150
|
timeout: z.string().optional(),
|
|
154
151
|
}),
|
|
155
152
|
cgi: z.enum([
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
153
|
+
EUserActions.TRACK_ICAO,
|
|
154
|
+
EUserActions.RESET_ICAO,
|
|
155
|
+
EUserActions.SET_PRIORITY_LIST,
|
|
156
|
+
EUserActions.SET_BLACK_LIST,
|
|
157
|
+
EUserActions.SET_WHITE_LIST,
|
|
158
|
+
EUserActions.GO_TO_COORDINATES,
|
|
159
|
+
EUserActions.SET_TRACKING_MODE,
|
|
160
|
+
EUserActions.SET_ZONES,
|
|
161
|
+
EUserActions.RESET_PTZ_CALIBRATION,
|
|
162
|
+
EUserActions.LOCK_API,
|
|
163
|
+
EUserActions.UNLOCK_API,
|
|
167
164
|
]),
|
|
168
165
|
postJsonBody: z.any(),
|
|
169
166
|
}),
|
|
@@ -183,6 +180,6 @@ const ptrEventsDataSchema = z.discriminatedUnion('type', [
|
|
|
183
180
|
}),
|
|
184
181
|
]);
|
|
185
182
|
export const ptrEventsSchema = z.discriminatedUnion('type', [
|
|
186
|
-
z.object({ type: z.literal('init'), data:
|
|
187
|
-
...
|
|
183
|
+
z.object({ type: z.literal('init'), data: eventsDataSchema }),
|
|
184
|
+
...eventsDataSchema.options,
|
|
188
185
|
]);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { WsEvents } from '../internal/WsEvents';
|
|
2
|
-
import {
|
|
2
|
+
import { wsUserActionData, ptrEventsSchema } from '../types/ws/PlaneTrackerEvents';
|
|
3
3
|
export class PlaneTrackerEvents extends WsEvents {
|
|
4
4
|
_apiUser;
|
|
5
5
|
constructor(ws, _apiUser) {
|
|
6
6
|
super((data) => {
|
|
7
7
|
const parsedData = ptrEventsSchema.parse(data);
|
|
8
|
-
if (parsedData.type ===
|
|
8
|
+
if (parsedData.type === 'USER_ACTION') {
|
|
9
9
|
const { type, ...actionData } = parsedData;
|
|
10
|
-
const userAction =
|
|
10
|
+
const userAction = wsUserActionData.parse(actionData);
|
|
11
11
|
return { ...userAction, type };
|
|
12
12
|
}
|
|
13
13
|
return parsedData;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IClient, TResponse } from './internal/types';
|
|
2
|
-
import { ICAO,
|
|
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>;
|
|
@@ -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;
|
|
@@ -1040,4 +1035,43 @@ export declare const zonesSchema: z.ZodObject<{
|
|
|
1040
1035
|
}[] | undefined;
|
|
1041
1036
|
}>;
|
|
1042
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
|
+
};
|
|
1043
1077
|
export {};
|