camstreamerlib 4.0.0-beta.47 → 4.0.0-beta.48
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/README.md +123 -30
- package/cjs/CamSwitcherAPI.js +1 -1
- package/cjs/PlaneTrackerAPI.js +4 -0
- package/cjs/index.js +18 -9
- package/cjs/internal/WsEvents.js +6 -5
- package/cjs/node/CamOverlayDrawingAPI.js +10 -10
- package/cjs/node/CamScripterAPICameraEventsGenerator.js +9 -9
- package/cjs/node/Digest.test.js +13 -0
- package/cjs/node/VapixEvents.js +9 -9
- package/cjs/node/WsClient.js +20 -13
- package/cjs/types/CamOverlayAPI/pipSchema.js +1 -1
- package/cjs/types/PlaneTrackerAPI.js +4 -1
- package/cjs/types/ws/CamOverlayEvents.js +19 -0
- package/cjs/types/ws/CamStreamerEvents.js +32 -0
- package/cjs/types/ws/PlaneTrackerEvents.js +77 -0
- package/cjs/web/DefaultClient.js +6 -2
- package/cjs/web/WsClient.js +13 -15
- package/cjs/ws/CamOverlayEvents.js +24 -0
- package/cjs/ws/CamStreamerEvents.js +24 -0
- package/cjs/ws/CamSwitcherEvents.js +24 -0
- package/cjs/ws/PlaneTrackerEvents.js +22 -0
- package/esm/CamSwitcherAPI.js +1 -1
- package/esm/PlaneTrackerAPI.js +5 -1
- package/esm/index.js +12 -6
- package/esm/internal/WsEvents.js +6 -5
- package/esm/node/CamOverlayDrawingAPI.js +10 -10
- package/esm/node/CamScripterAPICameraEventsGenerator.js +9 -9
- package/esm/node/Digest.test.js +11 -0
- package/esm/node/VapixEvents.js +9 -9
- package/esm/node/WsClient.js +20 -13
- package/esm/types/CamOverlayAPI/pipSchema.js +1 -1
- package/esm/types/PlaneTrackerAPI.js +3 -0
- package/esm/types/ws/CamOverlayEvents.js +16 -0
- package/esm/types/ws/CamStreamerEvents.js +29 -0
- package/esm/types/ws/PlaneTrackerEvents.js +74 -0
- package/esm/web/DefaultClient.js +6 -2
- package/esm/web/WsClient.js +13 -15
- package/esm/ws/CamOverlayEvents.js +20 -0
- package/esm/ws/CamStreamerEvents.js +20 -0
- package/esm/ws/CamSwitcherEvents.js +20 -0
- package/esm/ws/PlaneTrackerEvents.js +18 -0
- package/package.json +1 -1
- package/types/CamSwitcherAPI.d.ts +1 -1
- package/types/PlaneTrackerAPI.d.ts +2 -1
- package/types/index.d.ts +12 -6
- package/types/internal/WsEvents.d.ts +3 -5
- package/types/internal/types.d.ts +7 -6
- package/types/node/CamScripterAPICameraEventsGenerator.d.ts +2 -2
- package/types/node/Digest.test.d.ts +1 -0
- package/types/node/VapixEvents.d.ts +2 -2
- package/types/node/WsClient.d.ts +9 -19
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +5 -5
- package/types/types/CamOverlayAPI/pipSchema.d.ts +2 -2
- package/types/types/CamOverlayDrawingAPI.d.ts +2 -2
- package/types/types/PlaneTrackerAPI.d.ts +8 -0
- package/types/types/ws/CamOverlayEvents.d.ts +88 -0
- package/types/types/ws/CamStreamerEvents.d.ts +249 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +947 -0
- package/types/web/DefaultClient.d.ts +2 -0
- package/types/web/WsClient.d.ts +9 -5
- package/types/ws/CamOverlayEvents.d.ts +8 -0
- package/types/ws/CamStreamerEvents.d.ts +8 -0
- package/types/ws/CamSwitcherEvents.d.ts +8 -0
- package/types/ws/PlaneTrackerEvents.d.ts +9 -0
- package/cjs/CamSwitcherEvents.js +0 -11
- package/esm/CamSwitcherEvents.js +0 -7
- package/types/CamSwitcherEvents.d.ts +0 -8
- /package/cjs/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
- /package/esm/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
- /package/types/types/{CamSwitcherEvents.d.ts → ws/CamSwitcherEvents.d.ts} +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const apiFlightDataSchema = z.object({
|
|
3
|
+
icao: z.string(),
|
|
4
|
+
lat: z.number(),
|
|
5
|
+
lon: z.number(),
|
|
6
|
+
heading: z.number(),
|
|
7
|
+
groundSpeed: z.number(),
|
|
8
|
+
altitudeAMSL: z.number(),
|
|
9
|
+
cameraDistance: z.number(),
|
|
10
|
+
autoTrackingOrder: z.number(),
|
|
11
|
+
whiteListed: z.boolean(),
|
|
12
|
+
blackListed: z.boolean(),
|
|
13
|
+
priorityListed: z.boolean(),
|
|
14
|
+
autoSelectionIgnored: z.boolean(),
|
|
15
|
+
signalQuality: z.number(),
|
|
16
|
+
emergencyState: z.boolean(),
|
|
17
|
+
emergencyStatusMessage: z.string(),
|
|
18
|
+
});
|
|
19
|
+
const apiUserSchema = z.object({
|
|
20
|
+
userId: z.string(),
|
|
21
|
+
userName: z.string(),
|
|
22
|
+
userPriority: z.number(),
|
|
23
|
+
ip: z.string(),
|
|
24
|
+
});
|
|
25
|
+
const ptrEventsDataSchema = z.discriminatedUnion('type', [
|
|
26
|
+
z.object({
|
|
27
|
+
type: z.literal('CAMERA_POSITION'),
|
|
28
|
+
lat: z.number(),
|
|
29
|
+
lon: z.number(),
|
|
30
|
+
azimuth: z.number().min(0).max(360),
|
|
31
|
+
elevation: z.number().min(-90).max(90),
|
|
32
|
+
fov: z.number(),
|
|
33
|
+
}),
|
|
34
|
+
z.object({
|
|
35
|
+
type: z.literal('TRACKING_START'),
|
|
36
|
+
icao: z.string(),
|
|
37
|
+
}),
|
|
38
|
+
z.object({
|
|
39
|
+
type: z.literal('TRACKING_STOP'),
|
|
40
|
+
}),
|
|
41
|
+
z.object({
|
|
42
|
+
type: z.literal('FLIGHT_LIST'),
|
|
43
|
+
list: z.array(apiFlightDataSchema),
|
|
44
|
+
}),
|
|
45
|
+
z.object({
|
|
46
|
+
type: z.literal('USER_ACTION'),
|
|
47
|
+
ip: z.string(),
|
|
48
|
+
params: z.object({
|
|
49
|
+
userId: z.string(),
|
|
50
|
+
userName: z.string(),
|
|
51
|
+
userPriority: z.number(),
|
|
52
|
+
}),
|
|
53
|
+
cgi: z.string(),
|
|
54
|
+
postJsonBody: z.any(),
|
|
55
|
+
}),
|
|
56
|
+
z.object({
|
|
57
|
+
type: z.literal('CONNECTED_USERS'),
|
|
58
|
+
users: z.array(apiUserSchema),
|
|
59
|
+
}),
|
|
60
|
+
z.object({
|
|
61
|
+
type: z.literal('FORCE_TRACKING_STATUS'),
|
|
62
|
+
enabled: z.boolean(),
|
|
63
|
+
icao: z.string().optional(),
|
|
64
|
+
}),
|
|
65
|
+
z.object({
|
|
66
|
+
type: z.literal('API_LOCK_STATUS'),
|
|
67
|
+
isLocked: z.boolean(),
|
|
68
|
+
user: apiUserSchema.optional(),
|
|
69
|
+
}),
|
|
70
|
+
]);
|
|
71
|
+
export const ptrEventsSchema = z.discriminatedUnion('type', [
|
|
72
|
+
z.object({ type: z.literal('init'), data: ptrEventsDataSchema }),
|
|
73
|
+
...ptrEventsDataSchema.options,
|
|
74
|
+
]);
|
package/esm/web/DefaultClient.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { addParametersToPath } from '../internal/utils';
|
|
2
2
|
export class DefaultClient {
|
|
3
|
+
domain;
|
|
4
|
+
constructor(domain = '') {
|
|
5
|
+
this.domain = domain;
|
|
6
|
+
}
|
|
3
7
|
get = (params) => {
|
|
4
8
|
return this.fetchWithTimeout(addParametersToPath(params.path, params.parameters), {
|
|
5
9
|
method: 'GET',
|
|
@@ -13,11 +17,11 @@ export class DefaultClient {
|
|
|
13
17
|
headers: params.headers,
|
|
14
18
|
}, params.timeout);
|
|
15
19
|
};
|
|
16
|
-
async fetchWithTimeout(
|
|
20
|
+
async fetchWithTimeout(path, options, timeout) {
|
|
17
21
|
const controller = new AbortController();
|
|
18
22
|
const timeoutId = timeout !== undefined ? setTimeout(() => controller.abort(), timeout) : null;
|
|
19
23
|
try {
|
|
20
|
-
return await fetch(
|
|
24
|
+
return await fetch(`${this.domain}${path}`, { ...options, signal: controller.signal });
|
|
21
25
|
}
|
|
22
26
|
finally {
|
|
23
27
|
if (timeoutId) {
|
package/esm/web/WsClient.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
const REFRESH_TIMEOUT = 5000;
|
|
2
2
|
export class WsClient {
|
|
3
3
|
getUrl;
|
|
4
|
-
getAuthToken;
|
|
5
4
|
isDestroyed = false;
|
|
6
5
|
ws = null;
|
|
7
6
|
restartTimeout = null;
|
|
8
|
-
constructor(getUrl
|
|
7
|
+
constructor(getUrl) {
|
|
9
8
|
this.getUrl = getUrl;
|
|
10
|
-
this.getAuthToken = getAuthToken;
|
|
11
9
|
}
|
|
12
10
|
init() {
|
|
13
11
|
if (this.isDestroyed) {
|
|
@@ -15,17 +13,9 @@ export class WsClient {
|
|
|
15
13
|
}
|
|
16
14
|
this.destroyWebsocket();
|
|
17
15
|
const ws = new WebSocket(this.getUrl(), 'events');
|
|
18
|
-
ws.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ws.send(JSON.stringify({ authorization: token }));
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error('Error sending auth token:', error);
|
|
25
|
-
ws.close();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
ws.onmessage = (e) => this.onmessage(e);
|
|
16
|
+
ws.binaryType = 'arraybuffer';
|
|
17
|
+
ws.onopen = () => this.onOpen();
|
|
18
|
+
ws.onmessage = (e) => this.onMessage(e.data);
|
|
29
19
|
ws.onclose = () => {
|
|
30
20
|
this.restartTimeout = window.setTimeout(() => this.init(), REFRESH_TIMEOUT);
|
|
31
21
|
};
|
|
@@ -34,7 +24,15 @@ export class WsClient {
|
|
|
34
24
|
send = (msg) => {
|
|
35
25
|
this.ws?.send(msg);
|
|
36
26
|
};
|
|
37
|
-
|
|
27
|
+
onMessage = (_) => { };
|
|
28
|
+
onOpen = () => { };
|
|
29
|
+
onClose = () => { };
|
|
30
|
+
onError = (error) => {
|
|
31
|
+
console.error(error);
|
|
32
|
+
};
|
|
33
|
+
reconnect = () => {
|
|
34
|
+
this.ws?.close();
|
|
35
|
+
};
|
|
38
36
|
destroy = () => {
|
|
39
37
|
this.isDestroyed = true;
|
|
40
38
|
this.destroyWebsocket();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WsEvents } from '../internal/WsEvents';
|
|
2
|
+
import { coEventsSchema } from '../types/ws/CamOverlayEvents';
|
|
3
|
+
export class CamOverlayEvents extends WsEvents {
|
|
4
|
+
getAuthToken;
|
|
5
|
+
constructor(ws, getAuthToken) {
|
|
6
|
+
super(coEventsSchema, ws);
|
|
7
|
+
this.getAuthToken = getAuthToken;
|
|
8
|
+
this.ws.onOpen = this.sendInitMsg;
|
|
9
|
+
}
|
|
10
|
+
sendInitMsg = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const token = await this.getAuthToken();
|
|
13
|
+
this.ws.send(JSON.stringify({ authorization: token }));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error('Error on open:', error);
|
|
17
|
+
this.ws.reconnect();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WsEvents } from '../internal/WsEvents';
|
|
2
|
+
import { csEventsSchema } from '../types/ws/CamStreamerEvents';
|
|
3
|
+
export class CamStreamerEvents extends WsEvents {
|
|
4
|
+
getAuthToken;
|
|
5
|
+
constructor(ws, getAuthToken) {
|
|
6
|
+
super(csEventsSchema, ws);
|
|
7
|
+
this.getAuthToken = getAuthToken;
|
|
8
|
+
this.ws.onOpen = this.sendInitMsg;
|
|
9
|
+
}
|
|
10
|
+
sendInitMsg = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const token = await this.getAuthToken();
|
|
13
|
+
this.ws.send(JSON.stringify({ authorization: token }));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error('Error on open:', error);
|
|
17
|
+
this.ws.reconnect();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WsEvents } from '../internal/WsEvents';
|
|
2
|
+
import { cswEventsSchema } from '../types/ws/CamSwitcherEvents';
|
|
3
|
+
export class CamSwitcherEvents extends WsEvents {
|
|
4
|
+
getAuthToken;
|
|
5
|
+
constructor(ws, getAuthToken) {
|
|
6
|
+
super(cswEventsSchema, ws);
|
|
7
|
+
this.getAuthToken = getAuthToken;
|
|
8
|
+
this.ws.onOpen = this.sendInitMsg;
|
|
9
|
+
}
|
|
10
|
+
sendInitMsg = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const token = await this.getAuthToken();
|
|
13
|
+
this.ws.send(JSON.stringify({ authorization: token }));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error('Error on open:', error);
|
|
17
|
+
this.ws.reconnect();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WsEvents } from '../internal/WsEvents';
|
|
2
|
+
import { ptrEventsSchema } from '../types/ws/PlaneTrackerEvents';
|
|
3
|
+
export class PlaneTrackerEvents extends WsEvents {
|
|
4
|
+
_apiUser;
|
|
5
|
+
constructor(ws, _apiUser) {
|
|
6
|
+
super(ptrEventsSchema, ws);
|
|
7
|
+
this._apiUser = _apiUser;
|
|
8
|
+
this.ws.onOpen = this.sendInitMsg;
|
|
9
|
+
}
|
|
10
|
+
sendInitMsg = () => {
|
|
11
|
+
this.ws.send(JSON.stringify({
|
|
12
|
+
type: 'USER_INFO',
|
|
13
|
+
userId: this._apiUser.userId,
|
|
14
|
+
userName: this._apiUser.userName,
|
|
15
|
+
userPriority: this._apiUser.userPriority,
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
12
12
|
});
|
|
13
13
|
static getProxyPath: () => string;
|
|
14
14
|
static getWsEventsPath: () => string;
|
|
15
|
-
static getClipPreviewPath: (
|
|
15
|
+
static getClipPreviewPath: (clipId: string, storage: TStorageType) => string;
|
|
16
16
|
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
17
17
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
18
18
|
getNetworkCameraList(options?: THttpRequestOptions): Promise<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, TBlobResponse, TParameters, TResponse } from './internal/types';
|
|
2
|
-
import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TImportDataType, TPriorityList, TTrackingMode, TWhiteList, TZones } from './types/PlaneTrackerAPI';
|
|
2
|
+
import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TWhiteList, TZones } from './types/PlaneTrackerAPI';
|
|
3
3
|
import { THttpRequestOptions, TProxyParams } from './types/common';
|
|
4
4
|
import { ProxyClient } from './internal/ProxyClient';
|
|
5
5
|
export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
@@ -177,6 +177,7 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
177
177
|
setTrackingMode(mode: TTrackingMode['mode'], options?: THttpRequestOptions): Promise<void>;
|
|
178
178
|
startTrackingPlane(icao: ICAO, options?: THttpRequestOptions): Promise<void>;
|
|
179
179
|
stopTrackingPlane(options?: THttpRequestOptions): Promise<void>;
|
|
180
|
+
getIcao(by: TGetIcaoByOption, value: string, options?: THttpRequestOptions): Promise<string>;
|
|
180
181
|
getPriorityList(options?: THttpRequestOptions): Promise<{
|
|
181
182
|
priorityList: string[];
|
|
182
183
|
}>;
|
package/types/index.d.ts
CHANGED
|
@@ -4,17 +4,23 @@ export * from './internal/utils';
|
|
|
4
4
|
export * from './internal/versionCompare';
|
|
5
5
|
export * from './internal/ProxyClient';
|
|
6
6
|
export * from './types/common';
|
|
7
|
-
export { CamOverlayAPI } from './CamOverlayAPI';
|
|
8
|
-
export * from './types/CamOverlayAPI';
|
|
9
|
-
export { CamScripterAPI } from './CamScripterAPI';
|
|
10
|
-
export * from './types/CamScripterAPI';
|
|
11
7
|
export { CamStreamerAPI } from './CamStreamerAPI';
|
|
12
8
|
export * from './types/CamStreamerAPI';
|
|
9
|
+
export { CamStreamerEvents } from './ws/CamStreamerEvents';
|
|
10
|
+
export * from './types/ws/CamStreamerEvents';
|
|
11
|
+
export { CamOverlayAPI } from './CamOverlayAPI';
|
|
12
|
+
export * from './types/CamOverlayAPI';
|
|
13
|
+
export { CamOverlayEvents } from './ws/CamOverlayEvents';
|
|
14
|
+
export * from './types/ws/CamOverlayEvents';
|
|
13
15
|
export { CamSwitcherAPI } from './CamSwitcherAPI';
|
|
14
16
|
export * from './types/CamSwitcherAPI';
|
|
15
|
-
export { CamSwitcherEvents } from './CamSwitcherEvents';
|
|
16
|
-
export * from './types/CamSwitcherEvents';
|
|
17
|
+
export { CamSwitcherEvents } from './ws/CamSwitcherEvents';
|
|
18
|
+
export * from './types/ws/CamSwitcherEvents';
|
|
17
19
|
export { PlaneTrackerAPI } from './PlaneTrackerAPI';
|
|
18
20
|
export * from './types/PlaneTrackerAPI';
|
|
21
|
+
export { PlaneTrackerEvents } from './ws/PlaneTrackerEvents';
|
|
22
|
+
export * from './types/ws/PlaneTrackerEvents';
|
|
23
|
+
export { CamScripterAPI } from './CamScripterAPI';
|
|
24
|
+
export * from './types/CamScripterAPI';
|
|
19
25
|
export { VapixAPI } from './VapixAPI';
|
|
20
26
|
export * from './types/VapixAPI';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IWsClient } from './types';
|
|
2
2
|
type TEventType<T extends {
|
|
3
3
|
type: string;
|
|
4
4
|
}> = T extends {
|
|
@@ -22,14 +22,12 @@ type TListenerFunction<T extends {
|
|
|
22
22
|
}, Type extends TEventType<T>> = (data: TEvent<T, Type>, isInit: boolean) => void;
|
|
23
23
|
export declare class WsEvents<T extends {
|
|
24
24
|
type: string;
|
|
25
|
-
}, Event extends {
|
|
26
|
-
data: string;
|
|
27
25
|
}> {
|
|
28
26
|
private zodSchema;
|
|
29
|
-
ws:
|
|
27
|
+
ws: IWsClient;
|
|
30
28
|
private _isDestroyed;
|
|
31
29
|
private listeners;
|
|
32
|
-
constructor(zodSchema: TZodSchema<T>, ws:
|
|
30
|
+
constructor(zodSchema: TZodSchema<T>, ws: IWsClient);
|
|
33
31
|
get isDestroyed(): boolean;
|
|
34
32
|
resendInitData(): void;
|
|
35
33
|
addListener<Type extends TEventType<T>>(type: Type, listener: TListenerFunction<T, Type>, id: string): void;
|
|
@@ -9,7 +9,6 @@ export type Options = {
|
|
|
9
9
|
export type HttpOptions = Options & {
|
|
10
10
|
keepAlive?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export type WsOptions = Options;
|
|
13
12
|
export type TParameters = Record<string, string | number | boolean | null | undefined>;
|
|
14
13
|
export type TResponse = {
|
|
15
14
|
json: () => Promise<any>;
|
|
@@ -36,10 +35,12 @@ export interface IClient<TRes extends TResponse, Data> {
|
|
|
36
35
|
post: (params: TPostParams<Data>) => Promise<TRes>;
|
|
37
36
|
}
|
|
38
37
|
export type TBlobResponse<Client extends IClient<TResponse, any>> = Awaited<ReturnType<Awaited<ReturnType<Client['get']>>['blob']>>;
|
|
39
|
-
export interface
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
export interface IWsClient {
|
|
39
|
+
onMessage: null | ((data: ArrayBuffer | string) => void);
|
|
40
|
+
onOpen: () => void;
|
|
41
|
+
onClose: () => void;
|
|
42
|
+
onError: (error: Error) => void;
|
|
43
|
+
send: (data: ArrayBuffer | string) => void;
|
|
44
|
+
reconnect: () => void;
|
|
42
45
|
destroy: () => void;
|
|
43
|
-
onmessage: null | ((event: Event) => void);
|
|
44
|
-
send: (data: string) => void;
|
|
45
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
-
import {
|
|
3
|
+
import { Options } from '../internal/types';
|
|
4
4
|
import { TCamScripterEvent, TEventDeclaration, TEventUndeclaration, TCamScripterResponse } from '../types/CamScripterAPICameraEventsGenerator';
|
|
5
5
|
export declare class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
6
6
|
private tls;
|
|
@@ -14,7 +14,7 @@ export declare class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
|
14
14
|
private timeoutCheckTimer;
|
|
15
15
|
private wsConnected;
|
|
16
16
|
private ws;
|
|
17
|
-
constructor(options?:
|
|
17
|
+
constructor(options?: Options);
|
|
18
18
|
connect(): void;
|
|
19
19
|
disconnect(): void;
|
|
20
20
|
declareEvent(eventDeclaration: TEventDeclaration): Promise<TCamScripterResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter2 as EventEmitter } from 'eventemitter2';
|
|
2
|
-
import {
|
|
2
|
+
import { Options } from '../internal/types';
|
|
3
3
|
export declare class VapixEvents extends EventEmitter {
|
|
4
4
|
private tls;
|
|
5
5
|
private tlsInsecure;
|
|
@@ -8,7 +8,7 @@ export declare class VapixEvents extends EventEmitter {
|
|
|
8
8
|
private user;
|
|
9
9
|
private pass;
|
|
10
10
|
private ws;
|
|
11
|
-
constructor(options?:
|
|
11
|
+
constructor(options?: Options);
|
|
12
12
|
connect(): void;
|
|
13
13
|
disconnect(): void;
|
|
14
14
|
private createWsClient;
|
package/types/node/WsClient.d.ts
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import EventEmitter from 'events';
|
|
5
|
-
import { WsOptions } from '../internal/types';
|
|
6
|
-
export type WsClientOptions = WsOptions & {
|
|
1
|
+
import { IWsClient, Options } from '../internal/types';
|
|
2
|
+
export type WsClientOptions = Options & {
|
|
7
3
|
address: string;
|
|
8
4
|
headers?: Record<string, string>;
|
|
9
5
|
pingInterval?: number;
|
|
10
6
|
protocol?: string;
|
|
11
7
|
};
|
|
12
|
-
export
|
|
13
|
-
on(event: 'open', listener: () => void): this;
|
|
14
|
-
on(event: 'close', listener: () => void): this;
|
|
15
|
-
on(event: 'message', listener: (data: Buffer) => void): this;
|
|
16
|
-
on(event: 'error', listener: (err: Error) => void): this;
|
|
17
|
-
emit(event: 'open'): boolean;
|
|
18
|
-
emit(event: 'close'): boolean;
|
|
19
|
-
emit(event: 'message', data: Buffer): boolean;
|
|
20
|
-
emit(event: 'error', err: Error): boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare class WsClient extends EventEmitter {
|
|
8
|
+
export declare class WsClient implements IWsClient {
|
|
23
9
|
private user;
|
|
24
10
|
private pass;
|
|
25
11
|
private address;
|
|
@@ -33,8 +19,12 @@ export declare class WsClient extends EventEmitter {
|
|
|
33
19
|
private isClosed;
|
|
34
20
|
constructor(options: WsClientOptions);
|
|
35
21
|
open(wwwAuthenticateHeader?: string): void;
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
onMessage: (_: ArrayBuffer | string) => void;
|
|
23
|
+
onOpen: () => void;
|
|
24
|
+
onClose: () => void;
|
|
25
|
+
onError: (error: Error) => void;
|
|
26
|
+
send(data: ArrayBuffer | string): void;
|
|
27
|
+
destroy(): void;
|
|
38
28
|
reconnect(): void;
|
|
39
29
|
private closeWsConnection;
|
|
40
30
|
}
|
|
@@ -527,7 +527,7 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
|
|
|
527
527
|
camera_height: z.ZodNumber;
|
|
528
528
|
camera_view_area: z.ZodString;
|
|
529
529
|
camera_overlay_params: z.ZodUnion<[z.ZodLiteral<"overlays=off">, z.ZodLiteral<"overlays=all">, z.ZodLiteral<"overlays=text">, z.ZodLiteral<"overlays=image">, z.ZodLiteral<"overlays=application">]>;
|
|
530
|
-
rotate: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]
|
|
530
|
+
rotate: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
|
|
531
531
|
dewarping: z.ZodObject<{
|
|
532
532
|
enabled: z.ZodBoolean;
|
|
533
533
|
rectangle: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
|
|
@@ -608,7 +608,6 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
|
|
|
608
608
|
camera_height: number;
|
|
609
609
|
camera_view_area: string;
|
|
610
610
|
camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
|
|
611
|
-
rotate: 0 | 90 | 180 | 270;
|
|
612
611
|
dewarping: {
|
|
613
612
|
enabled: boolean;
|
|
614
613
|
rectangle: [number, number][];
|
|
@@ -620,6 +619,7 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
|
|
|
620
619
|
schedule?: string | undefined;
|
|
621
620
|
invertInput?: boolean | undefined;
|
|
622
621
|
zIndex?: number | undefined;
|
|
622
|
+
rotate?: 0 | 90 | 180 | 270 | undefined;
|
|
623
623
|
}>, z.ZodObject<{
|
|
624
624
|
id: z.ZodNumber;
|
|
625
625
|
enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
@@ -1997,7 +1997,7 @@ export declare const serviceListSchema: z.ZodObject<{
|
|
|
1997
1997
|
camera_height: z.ZodNumber;
|
|
1998
1998
|
camera_view_area: z.ZodString;
|
|
1999
1999
|
camera_overlay_params: z.ZodUnion<[z.ZodLiteral<"overlays=off">, z.ZodLiteral<"overlays=all">, z.ZodLiteral<"overlays=text">, z.ZodLiteral<"overlays=image">, z.ZodLiteral<"overlays=application">]>;
|
|
2000
|
-
rotate: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]
|
|
2000
|
+
rotate: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
|
|
2001
2001
|
dewarping: z.ZodObject<{
|
|
2002
2002
|
enabled: z.ZodBoolean;
|
|
2003
2003
|
rectangle: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
|
|
@@ -2078,7 +2078,6 @@ export declare const serviceListSchema: z.ZodObject<{
|
|
|
2078
2078
|
camera_height: number;
|
|
2079
2079
|
camera_view_area: string;
|
|
2080
2080
|
camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
|
|
2081
|
-
rotate: 0 | 90 | 180 | 270;
|
|
2082
2081
|
dewarping: {
|
|
2083
2082
|
enabled: boolean;
|
|
2084
2083
|
rectangle: [number, number][];
|
|
@@ -2090,6 +2089,7 @@ export declare const serviceListSchema: z.ZodObject<{
|
|
|
2090
2089
|
schedule?: string | undefined;
|
|
2091
2090
|
invertInput?: boolean | undefined;
|
|
2092
2091
|
zIndex?: number | undefined;
|
|
2092
|
+
rotate?: 0 | 90 | 180 | 270 | undefined;
|
|
2093
2093
|
}>, z.ZodObject<{
|
|
2094
2094
|
id: z.ZodNumber;
|
|
2095
2095
|
enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
@@ -3533,7 +3533,6 @@ export declare const serviceListSchema: z.ZodObject<{
|
|
|
3533
3533
|
camera_height: number;
|
|
3534
3534
|
camera_view_area: string;
|
|
3535
3535
|
camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
|
|
3536
|
-
rotate: 0 | 90 | 180 | 270;
|
|
3537
3536
|
dewarping: {
|
|
3538
3537
|
enabled: boolean;
|
|
3539
3538
|
rectangle: [number, number][];
|
|
@@ -3545,6 +3544,7 @@ export declare const serviceListSchema: z.ZodObject<{
|
|
|
3545
3544
|
schedule?: string | undefined;
|
|
3546
3545
|
invertInput?: boolean | undefined;
|
|
3547
3546
|
zIndex?: number | undefined;
|
|
3547
|
+
rotate?: 0 | 90 | 180 | 270 | undefined;
|
|
3548
3548
|
} | {
|
|
3549
3549
|
name: "customGraphics";
|
|
3550
3550
|
enabled: 0 | 1;
|
|
@@ -29,7 +29,7 @@ export declare const pipSchema: z.ZodObject<{
|
|
|
29
29
|
camera_height: z.ZodNumber;
|
|
30
30
|
camera_view_area: z.ZodString;
|
|
31
31
|
camera_overlay_params: z.ZodUnion<[z.ZodLiteral<"overlays=off">, z.ZodLiteral<"overlays=all">, z.ZodLiteral<"overlays=text">, z.ZodLiteral<"overlays=image">, z.ZodLiteral<"overlays=application">]>;
|
|
32
|
-
rotate: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]
|
|
32
|
+
rotate: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
|
|
33
33
|
dewarping: z.ZodObject<{
|
|
34
34
|
enabled: z.ZodBoolean;
|
|
35
35
|
rectangle: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
|
|
@@ -110,7 +110,6 @@ export declare const pipSchema: z.ZodObject<{
|
|
|
110
110
|
camera_height: number;
|
|
111
111
|
camera_view_area: string;
|
|
112
112
|
camera_overlay_params: "overlays=off" | "overlays=all" | "overlays=text" | "overlays=image" | "overlays=application";
|
|
113
|
-
rotate: 0 | 90 | 180 | 270;
|
|
114
113
|
dewarping: {
|
|
115
114
|
enabled: boolean;
|
|
116
115
|
rectangle: [number, number][];
|
|
@@ -122,4 +121,5 @@ export declare const pipSchema: z.ZodObject<{
|
|
|
122
121
|
schedule?: string | undefined;
|
|
123
122
|
invertInput?: boolean | undefined;
|
|
124
123
|
zIndex?: number | undefined;
|
|
124
|
+
rotate?: 0 | 90 | 180 | 270 | undefined;
|
|
125
125
|
}>;
|
|
@@ -666,6 +666,14 @@ export declare const serverSettingsSchema: z.ZodObject<{
|
|
|
666
666
|
}>;
|
|
667
667
|
export type TServerSettings = z.infer<typeof serverSettingsSchema>;
|
|
668
668
|
export type ICAO = string;
|
|
669
|
+
export declare const getIcaoSchema: z.ZodObject<{
|
|
670
|
+
icao: z.ZodString;
|
|
671
|
+
}, "strip", z.ZodTypeAny, {
|
|
672
|
+
icao: string;
|
|
673
|
+
}, {
|
|
674
|
+
icao: string;
|
|
675
|
+
}>;
|
|
676
|
+
export type TGetIcaoByOption = 'registration' | 'callsign';
|
|
669
677
|
export declare const trackingModeSchema: z.ZodObject<{
|
|
670
678
|
mode: z.ZodUnion<[z.ZodLiteral<"MANUAL">, z.ZodLiteral<"AUTOMATIC">]>;
|
|
671
679
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const coEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"init">;
|
|
4
|
+
data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"authorization">;
|
|
6
|
+
state: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type: "authorization";
|
|
9
|
+
state: string;
|
|
10
|
+
}, {
|
|
11
|
+
type: "authorization";
|
|
12
|
+
state: string;
|
|
13
|
+
}>, z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"ServiceStart">;
|
|
15
|
+
serviceId: z.ZodNumber;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
type: "ServiceStart";
|
|
18
|
+
serviceId: number;
|
|
19
|
+
}, {
|
|
20
|
+
type: "ServiceStart";
|
|
21
|
+
serviceId: number;
|
|
22
|
+
}>, z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"ServiceStop">;
|
|
24
|
+
serviceId: z.ZodNumber;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
type: "ServiceStop";
|
|
27
|
+
serviceId: number;
|
|
28
|
+
}, {
|
|
29
|
+
type: "ServiceStop";
|
|
30
|
+
serviceId: number;
|
|
31
|
+
}>]>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: "init";
|
|
34
|
+
data: {
|
|
35
|
+
type: "authorization";
|
|
36
|
+
state: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: "ServiceStart";
|
|
39
|
+
serviceId: number;
|
|
40
|
+
} | {
|
|
41
|
+
type: "ServiceStop";
|
|
42
|
+
serviceId: number;
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
type: "init";
|
|
46
|
+
data: {
|
|
47
|
+
type: "authorization";
|
|
48
|
+
state: string;
|
|
49
|
+
} | {
|
|
50
|
+
type: "ServiceStart";
|
|
51
|
+
serviceId: number;
|
|
52
|
+
} | {
|
|
53
|
+
type: "ServiceStop";
|
|
54
|
+
serviceId: number;
|
|
55
|
+
};
|
|
56
|
+
}>, z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"authorization">;
|
|
58
|
+
state: z.ZodString;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
type: "authorization";
|
|
61
|
+
state: string;
|
|
62
|
+
}, {
|
|
63
|
+
type: "authorization";
|
|
64
|
+
state: string;
|
|
65
|
+
}>, z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<"ServiceStart">;
|
|
67
|
+
serviceId: z.ZodNumber;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
type: "ServiceStart";
|
|
70
|
+
serviceId: number;
|
|
71
|
+
}, {
|
|
72
|
+
type: "ServiceStart";
|
|
73
|
+
serviceId: number;
|
|
74
|
+
}>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"ServiceStop">;
|
|
76
|
+
serviceId: z.ZodNumber;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
type: "ServiceStop";
|
|
79
|
+
serviceId: number;
|
|
80
|
+
}, {
|
|
81
|
+
type: "ServiceStop";
|
|
82
|
+
serviceId: number;
|
|
83
|
+
}>]>;
|
|
84
|
+
export type TCamOverlayEvent = z.infer<typeof coEventsSchema>;
|
|
85
|
+
export type TCamOverlayEventType = TCamOverlayEvent['type'];
|
|
86
|
+
export type TCamOverlayEventOfType<T extends TCamOverlayEventType> = Extract<TCamOverlayEvent, {
|
|
87
|
+
type: T;
|
|
88
|
+
}>;
|