camstreamerlib 4.0.30 → 4.0.31-2493e55
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 +1 -1
- package/cjs/CamSwitcherAPI.d.ts +18 -1
- package/cjs/CamSwitcherAPI.js +30 -26
- package/cjs/PlaneTrackerAPI.d.ts +1 -0
- package/cjs/errors/errors.d.ts +3 -0
- package/cjs/errors/errors.js +8 -1
- package/cjs/internal/types.d.ts +2 -0
- package/cjs/node/CamOverlayDrawingAPI.d.ts +2 -1
- package/cjs/node/CamOverlayDrawingAPI.js +6 -3
- package/cjs/node/CamScripterAPICameraEventsGenerator.d.ts +2 -1
- package/cjs/node/CamScripterAPICameraEventsGenerator.js +6 -3
- package/cjs/node/DefaultClient.d.ts +4 -3
- package/cjs/node/DefaultClient.js +8 -6
- package/cjs/node/DeviceConnectClient.d.ts +9 -0
- package/cjs/node/DeviceConnectClient.js +15 -0
- package/cjs/node/DeviceConnectWsClient.d.ts +12 -0
- package/cjs/node/DeviceConnectWsClient.js +21 -0
- package/cjs/node/VapixEvents.d.ts +2 -1
- package/cjs/node/VapixEvents.js +6 -3
- package/cjs/node/WsClient.d.ts +7 -2
- package/cjs/node/WsClient.js +3 -3
- package/cjs/node/index.d.ts +2 -0
- package/cjs/node/index.js +4 -1
- package/cjs/types/PlaneTrackerAPI.d.ts +5 -0
- package/cjs/types/PlaneTrackerAPI.js +1 -0
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +23 -0
- package/cjs/web/DefaultClient.d.ts +2 -1
- package/cjs/web/DefaultClient.js +5 -3
- package/cjs/web/DeviceConnectClient.d.ts +4 -0
- package/cjs/web/DeviceConnectClient.js +10 -0
- package/cjs/web/DeviceConnectWsClient.d.ts +4 -0
- package/cjs/web/DeviceConnectWsClient.js +14 -0
- package/cjs/web/index.d.ts +2 -0
- package/cjs/web/index.js +5 -1
- package/esm/CamSwitcherAPI.js +32 -28
- package/esm/errors/errors.js +6 -0
- package/esm/node/CamOverlayDrawingAPI.js +6 -3
- package/esm/node/CamScripterAPICameraEventsGenerator.js +6 -3
- package/esm/node/DefaultClient.js +8 -6
- package/esm/node/DeviceConnectClient.js +11 -0
- package/esm/node/DeviceConnectWsClient.js +17 -0
- package/esm/node/VapixEvents.js +6 -3
- package/esm/node/WsClient.js +3 -3
- package/esm/node/index.js +2 -0
- package/esm/types/PlaneTrackerAPI.js +1 -0
- package/esm/web/DefaultClient.js +5 -3
- package/esm/web/DeviceConnectClient.js +6 -0
- package/esm/web/DeviceConnectWsClient.js +10 -0
- package/esm/web/index.js +2 -0
- package/package.json +103 -103
- package/types/CamSwitcherAPI.d.ts +18 -1
- package/types/PlaneTrackerAPI.d.ts +1 -0
- package/types/errors/errors.d.ts +3 -0
- package/types/internal/types.d.ts +2 -0
- package/types/node/CamOverlayDrawingAPI.d.ts +2 -1
- package/types/node/CamScripterAPICameraEventsGenerator.d.ts +2 -1
- package/types/node/DefaultClient.d.ts +4 -3
- package/types/node/DeviceConnectClient.d.ts +9 -0
- package/types/node/DeviceConnectWsClient.d.ts +12 -0
- package/types/node/VapixEvents.d.ts +2 -1
- package/types/node/WsClient.d.ts +7 -2
- package/types/node/index.d.ts +2 -0
- package/types/types/PlaneTrackerAPI.d.ts +5 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +23 -0
- package/types/web/DefaultClient.d.ts +2 -1
- package/types/web/DeviceConnectClient.d.ts +4 -0
- package/types/web/DeviceConnectWsClient.d.ts +4 -0
- package/types/web/index.d.ts +2 -0
package/README.md
CHANGED
package/cjs/CamSwitcherAPI.d.ts
CHANGED
|
@@ -144,7 +144,24 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
|
|
|
144
144
|
setSecondaryAudioSettings(settings: TSecondaryAudioSettings, options?: THttpRequestOptions): Promise<void>;
|
|
145
145
|
setDefaultPlaylist(playlistId: string, options?: THttpRequestOptions): Promise<void>;
|
|
146
146
|
setPermanentRtspUrlToken(token: string, options?: THttpRequestOptions): Promise<void>;
|
|
147
|
-
getCamSwitchOptions(options?: THttpRequestOptions): Promise<
|
|
147
|
+
getCamSwitchOptions(options?: THttpRequestOptions): Promise<{
|
|
148
|
+
resolution?: string | undefined;
|
|
149
|
+
compression?: number | undefined;
|
|
150
|
+
bitrateMode?: "VBR" | "MBR" | "ABR" | undefined;
|
|
151
|
+
maximumBitRate?: number | undefined;
|
|
152
|
+
retentionTime?: number | undefined;
|
|
153
|
+
bitRateLimit?: number | undefined;
|
|
154
|
+
fps?: number | undefined;
|
|
155
|
+
govLength?: number | undefined;
|
|
156
|
+
h264Profile?: "high" | "main" | "baseline" | undefined;
|
|
157
|
+
keyboard?: {
|
|
158
|
+
none: string | null;
|
|
159
|
+
fromSource: string | null;
|
|
160
|
+
} | undefined;
|
|
161
|
+
bitrateVapixParams?: string | null | undefined;
|
|
162
|
+
audioSampleRate?: number | undefined;
|
|
163
|
+
audioChannelCount?: 1 | 2 | undefined;
|
|
164
|
+
} | undefined>;
|
|
148
165
|
getGlobalAudioSettings(options?: THttpRequestOptions): Promise<{
|
|
149
166
|
type: "source" | "fromSource";
|
|
150
167
|
source: string;
|
package/cjs/CamSwitcherAPI.js
CHANGED
|
@@ -34,15 +34,13 @@ class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
|
|
|
34
34
|
return common_1.networkCameraListSchema.parse(res.data);
|
|
35
35
|
}
|
|
36
36
|
async generateSilence(sampleRate, channels, options) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
timeout: options?.timeout,
|
|
45
|
-
});
|
|
37
|
+
const res = await this._getJson(`${BASE_PATH}/generate_silence.cgi`, {
|
|
38
|
+
sample_rate: sampleRate.toString(),
|
|
39
|
+
channels,
|
|
40
|
+
}, options);
|
|
41
|
+
if (res.status !== 200) {
|
|
42
|
+
throw new errors_1.GenerateSilenceError(res.message);
|
|
43
|
+
}
|
|
46
44
|
}
|
|
47
45
|
async getMaxFps(source, options) {
|
|
48
46
|
const res = await this._getJson(`${BASE_PATH}/get_max_framerate.cgi`, {
|
|
@@ -204,28 +202,34 @@ class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
|
|
|
204
202
|
async getCamSwitchOptions(options) {
|
|
205
203
|
const saveData = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.SETTINGS, options);
|
|
206
204
|
if ((0, utils_1.isNullish)(saveData.video)) {
|
|
207
|
-
return
|
|
205
|
+
return;
|
|
208
206
|
}
|
|
209
|
-
|
|
207
|
+
const settings = {
|
|
208
|
+
audioSampleRate: saveData.audio?.sampleRate,
|
|
209
|
+
audioChannelCount: saveData.audio?.channelCount,
|
|
210
|
+
keyboard: saveData.keyboard,
|
|
211
|
+
fps: saveData.video.fps,
|
|
212
|
+
resolution: saveData.video.resolution,
|
|
213
|
+
h264Profile: saveData.video.h264Profile,
|
|
214
|
+
compression: saveData.video.compression,
|
|
215
|
+
govLength: saveData.video.govLength,
|
|
216
|
+
bitrateVapixParams: saveData.video.bitrateVapixParams,
|
|
217
|
+
};
|
|
218
|
+
if (!(0, utils_1.isNullish)(saveData.video.bitrateVapixParams)) {
|
|
210
219
|
const bitrateOptions = (0, convertors_1.parseVapixParamsToBitrateOptions)(saveData.video.bitrateVapixParams);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
220
|
+
settings.bitrateMode = bitrateOptions.bitrateMode;
|
|
221
|
+
settings.maximumBitRate = bitrateOptions.maximumBitRate;
|
|
222
|
+
settings.retentionTime = bitrateOptions.retentionTime;
|
|
223
|
+
settings.bitRateLimit = bitrateOptions.bitRateLimit;
|
|
215
224
|
}
|
|
216
|
-
if (!(0, utils_1.isNullish)(saveData.video
|
|
217
|
-
|
|
218
|
-
|
|
225
|
+
if (!(0, utils_1.isNullish)(saveData.video.bitrateLimit)) {
|
|
226
|
+
settings.maximumBitRate = saveData.video.bitrateLimit;
|
|
227
|
+
settings.bitrateMode = 'MBR';
|
|
219
228
|
}
|
|
220
|
-
if (!(0, utils_1.isNullish)(saveData.video
|
|
221
|
-
|
|
229
|
+
if (!(0, utils_1.isNullish)(saveData.video.videoClipQuality)) {
|
|
230
|
+
settings.maximumBitRate = saveData.video.videoClipQuality;
|
|
222
231
|
}
|
|
223
|
-
return
|
|
224
|
-
...saveData.video,
|
|
225
|
-
audioSampleRate: saveData.audio.sampleRate,
|
|
226
|
-
audioChannelCount: saveData.audio.channelCount,
|
|
227
|
-
keyboard: saveData.keyboard,
|
|
228
|
-
};
|
|
232
|
+
return CamSwitcherAPI_1.cameraOptionsSchema.parse(settings);
|
|
229
233
|
}
|
|
230
234
|
async getGlobalAudioSettings(options) {
|
|
231
235
|
const settings = {
|
package/cjs/PlaneTrackerAPI.d.ts
CHANGED
|
@@ -268,6 +268,7 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
|
|
|
268
268
|
maxAltitudeAmsl?: number | undefined;
|
|
269
269
|
minSpeedKmph?: number | undefined;
|
|
270
270
|
maxSpeedKmph?: number | undefined;
|
|
271
|
+
runwayDirectionDeg?: number | undefined;
|
|
271
272
|
}[];
|
|
272
273
|
}>;
|
|
273
274
|
setZones(zones: TZones, options?: THttpRequestOptions): Promise<void>;
|
package/cjs/errors/errors.d.ts
CHANGED
|
@@ -49,6 +49,9 @@ export declare class FetchDeviceInfoError extends Error {
|
|
|
49
49
|
export declare class AddNewClipError extends Error {
|
|
50
50
|
constructor(message: string);
|
|
51
51
|
}
|
|
52
|
+
export declare class GenerateSilenceError extends Error {
|
|
53
|
+
constructor(message: string);
|
|
54
|
+
}
|
|
52
55
|
export declare class PtzNotSupportedError extends Error {
|
|
53
56
|
constructor();
|
|
54
57
|
}
|
package/cjs/errors/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MigrationError = exports.BadRequestError = exports.ServerError = exports.InvalidAltitudeError = exports.InvalidLatLngError = exports.CannotSetCoordsInAutoModeError = exports.ImportSettingsError = exports.ResetCalibrationError = exports.TimezoneFetchError = exports.TimezoneNotSetupError = exports.UtcTimeFetchError = exports.WsAuthorizationError = exports.StorageDataFetchError = exports.PtzNotSupportedError = exports.AddNewClipError = exports.FetchDeviceInfoError = exports.NoDeviceInfoError = exports.MaxFPSError = exports.SDCardJobError = exports.SDCardActionError = exports.ApplicationAPIError = exports.SettingParameterError = exports.ParameterNotFoundError = exports.JsonParseError = exports.ParsingBlobError = exports.ServiceNotFoundError = exports.ServiceUnavailableError = exports.ErrorWithResponse = void 0;
|
|
3
|
+
exports.MigrationError = exports.BadRequestError = exports.ServerError = exports.InvalidAltitudeError = exports.InvalidLatLngError = exports.CannotSetCoordsInAutoModeError = exports.ImportSettingsError = exports.ResetCalibrationError = exports.TimezoneFetchError = exports.TimezoneNotSetupError = exports.UtcTimeFetchError = exports.WsAuthorizationError = exports.StorageDataFetchError = exports.PtzNotSupportedError = exports.GenerateSilenceError = exports.AddNewClipError = exports.FetchDeviceInfoError = exports.NoDeviceInfoError = exports.MaxFPSError = exports.SDCardJobError = exports.SDCardActionError = exports.ApplicationAPIError = exports.SettingParameterError = exports.ParameterNotFoundError = exports.JsonParseError = exports.ParsingBlobError = exports.ServiceNotFoundError = exports.ServiceUnavailableError = exports.ErrorWithResponse = void 0;
|
|
4
4
|
class ErrorWithResponse extends Error {
|
|
5
5
|
res;
|
|
6
6
|
constructor(res) {
|
|
@@ -111,6 +111,13 @@ class AddNewClipError extends Error {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
exports.AddNewClipError = AddNewClipError;
|
|
114
|
+
class GenerateSilenceError extends Error {
|
|
115
|
+
constructor(message) {
|
|
116
|
+
super('Error generating silence clip: ' + message);
|
|
117
|
+
this.name = 'GenerateSilenceError';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.GenerateSilenceError = GenerateSilenceError;
|
|
114
121
|
class PtzNotSupportedError extends Error {
|
|
115
122
|
constructor() {
|
|
116
123
|
super('Ptz not supported.');
|
package/cjs/internal/types.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export type Options = {
|
|
2
2
|
ip?: string;
|
|
3
|
+
host?: string;
|
|
3
4
|
port?: number;
|
|
4
5
|
user?: string;
|
|
5
6
|
pass?: string;
|
|
6
7
|
tls?: boolean;
|
|
7
8
|
tlsInsecure?: boolean;
|
|
9
|
+
headers?: Record<string, string>;
|
|
8
10
|
};
|
|
9
11
|
export type HttpOptions = Options & {
|
|
10
12
|
keepAlive?: boolean;
|
|
@@ -6,10 +6,11 @@ import { CamOverlayDrawingOptions, TCairoCreateResponse, TCairoResponse, TUpload
|
|
|
6
6
|
export declare class CamOverlayDrawingAPI extends EventEmitter {
|
|
7
7
|
private tls;
|
|
8
8
|
private tlsInsecure;
|
|
9
|
-
private
|
|
9
|
+
private host;
|
|
10
10
|
private port;
|
|
11
11
|
private user;
|
|
12
12
|
private pass;
|
|
13
|
+
private headers?;
|
|
13
14
|
private cameraList;
|
|
14
15
|
private zIndex;
|
|
15
16
|
private callId;
|
|
@@ -6,10 +6,11 @@ const WsClient_1 = require("./WsClient");
|
|
|
6
6
|
class CamOverlayDrawingAPI extends events_1.EventEmitter {
|
|
7
7
|
tls;
|
|
8
8
|
tlsInsecure;
|
|
9
|
-
|
|
9
|
+
host;
|
|
10
10
|
port;
|
|
11
11
|
user;
|
|
12
12
|
pass;
|
|
13
|
+
headers;
|
|
13
14
|
cameraList;
|
|
14
15
|
zIndex;
|
|
15
16
|
callId;
|
|
@@ -21,10 +22,11 @@ class CamOverlayDrawingAPI extends events_1.EventEmitter {
|
|
|
21
22
|
super();
|
|
22
23
|
this.tls = options?.tls ?? false;
|
|
23
24
|
this.tlsInsecure = options?.tlsInsecure ?? false;
|
|
24
|
-
this.
|
|
25
|
+
this.host = options?.host ?? options?.ip ?? '127.0.0.1';
|
|
25
26
|
this.port = options?.port ?? (this.tls ? 443 : 80);
|
|
26
27
|
this.user = options?.user ?? '';
|
|
27
28
|
this.pass = options?.pass ?? '';
|
|
29
|
+
this.headers = options?.headers;
|
|
28
30
|
this.zIndex = options?.zIndex ?? 0;
|
|
29
31
|
this.cameraList = [0];
|
|
30
32
|
if (options && Array.isArray(options.camera)) {
|
|
@@ -91,7 +93,7 @@ class CamOverlayDrawingAPI extends events_1.EventEmitter {
|
|
|
91
93
|
}
|
|
92
94
|
createWsClient() {
|
|
93
95
|
const options = {
|
|
94
|
-
|
|
96
|
+
host: this.host,
|
|
95
97
|
port: this.port,
|
|
96
98
|
address: '/local/camoverlay/ws',
|
|
97
99
|
protocol: 'cairo-api',
|
|
@@ -99,6 +101,7 @@ class CamOverlayDrawingAPI extends events_1.EventEmitter {
|
|
|
99
101
|
pass: this.pass,
|
|
100
102
|
tls: this.tls,
|
|
101
103
|
tlsInsecure: this.tlsInsecure,
|
|
104
|
+
headers: this.headers,
|
|
102
105
|
};
|
|
103
106
|
this.ws = new WsClient_1.WsClient(options);
|
|
104
107
|
this.ws.onOpen = () => {
|
|
@@ -5,10 +5,11 @@ import { TCamScripterEvent, TEventDeclaration, TEventUndeclaration, TCamScripter
|
|
|
5
5
|
export declare class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
6
6
|
private tls;
|
|
7
7
|
private tlsInsecure;
|
|
8
|
-
private
|
|
8
|
+
private host;
|
|
9
9
|
private port;
|
|
10
10
|
private user;
|
|
11
11
|
private pass;
|
|
12
|
+
private headers?;
|
|
12
13
|
private callId;
|
|
13
14
|
private sendMessages;
|
|
14
15
|
private timeoutCheckTimer;
|
|
@@ -6,10 +6,11 @@ const WsClient_1 = require("./WsClient");
|
|
|
6
6
|
class CamScripterAPICameraEventsGenerator extends events_1.EventEmitter {
|
|
7
7
|
tls;
|
|
8
8
|
tlsInsecure;
|
|
9
|
-
|
|
9
|
+
host;
|
|
10
10
|
port;
|
|
11
11
|
user;
|
|
12
12
|
pass;
|
|
13
|
+
headers;
|
|
13
14
|
callId;
|
|
14
15
|
sendMessages;
|
|
15
16
|
timeoutCheckTimer;
|
|
@@ -19,10 +20,11 @@ class CamScripterAPICameraEventsGenerator extends events_1.EventEmitter {
|
|
|
19
20
|
super();
|
|
20
21
|
this.tls = options?.tls ?? false;
|
|
21
22
|
this.tlsInsecure = options?.tlsInsecure ?? false;
|
|
22
|
-
this.
|
|
23
|
+
this.host = options?.host ?? options?.ip ?? '127.0.0.1';
|
|
23
24
|
this.port = options?.port ?? (this.tls ? 443 : 80);
|
|
24
25
|
this.user = options?.user ?? '';
|
|
25
26
|
this.pass = options?.pass ?? '';
|
|
27
|
+
this.headers = options?.headers;
|
|
26
28
|
this.callId = 0;
|
|
27
29
|
this.sendMessages = {};
|
|
28
30
|
this.wsConnected = false;
|
|
@@ -64,10 +66,11 @@ class CamScripterAPICameraEventsGenerator extends events_1.EventEmitter {
|
|
|
64
66
|
pass: this.pass,
|
|
65
67
|
tlsInsecure: this.tlsInsecure,
|
|
66
68
|
tls: this.tls,
|
|
67
|
-
|
|
69
|
+
host: this.host,
|
|
68
70
|
port: this.port,
|
|
69
71
|
address: `/local/camscripter/ws`,
|
|
70
72
|
protocol: 'camera-events',
|
|
73
|
+
headers: this.headers,
|
|
71
74
|
};
|
|
72
75
|
this.ws = new WsClient_1.WsClient(options);
|
|
73
76
|
this.ws.onOpen = () => {
|
|
@@ -4,10 +4,11 @@ import { IClient, HttpOptions, TGetParams, TPostParams } from '../internal/types
|
|
|
4
4
|
import { FormData as UndiciFormData, Response as UndiciResponse } from 'undici';
|
|
5
5
|
export declare class DefaultClient implements IClient<UndiciResponse, UndiciFormData | Buffer> {
|
|
6
6
|
private tls;
|
|
7
|
-
private
|
|
7
|
+
private host;
|
|
8
8
|
private port;
|
|
9
|
-
private user
|
|
10
|
-
private pass
|
|
9
|
+
private user?;
|
|
10
|
+
private pass?;
|
|
11
|
+
private headers;
|
|
11
12
|
private httpRequestSender;
|
|
12
13
|
constructor(opt?: HttpOptions);
|
|
13
14
|
get(params: TGetParams): Promise<UndiciResponse>;
|
|
@@ -5,17 +5,19 @@ const utils_1 = require("../internal/utils");
|
|
|
5
5
|
const HttpRequestSender_1 = require("./HttpRequestSender");
|
|
6
6
|
class DefaultClient {
|
|
7
7
|
tls;
|
|
8
|
-
|
|
8
|
+
host;
|
|
9
9
|
port;
|
|
10
10
|
user;
|
|
11
11
|
pass;
|
|
12
|
+
headers;
|
|
12
13
|
httpRequestSender;
|
|
13
14
|
constructor(opt = {}) {
|
|
14
15
|
this.tls = opt.tls ?? false;
|
|
15
|
-
this.
|
|
16
|
+
this.host = opt.host ?? opt.ip ?? '127.0.0.1';
|
|
16
17
|
this.port = opt.port ?? (this.tls ? 443 : 80);
|
|
17
|
-
this.user = opt.user
|
|
18
|
-
this.pass = opt.pass
|
|
18
|
+
this.user = opt.user;
|
|
19
|
+
this.pass = opt.pass;
|
|
20
|
+
this.headers = opt.headers ?? {};
|
|
19
21
|
let agentOptions;
|
|
20
22
|
if (opt.tlsInsecure !== undefined || opt.keepAlive !== undefined) {
|
|
21
23
|
agentOptions = {
|
|
@@ -39,12 +41,12 @@ class DefaultClient {
|
|
|
39
41
|
return {
|
|
40
42
|
method: method,
|
|
41
43
|
protocol: this.tls ? 'https:' : 'http:',
|
|
42
|
-
host: this.
|
|
44
|
+
host: this.host,
|
|
43
45
|
port: this.port,
|
|
44
46
|
path: (0, utils_1.addParametersToPath)(path, params),
|
|
45
47
|
user: this.user,
|
|
46
48
|
pass: this.pass,
|
|
47
|
-
headers,
|
|
49
|
+
headers: { ...this.headers, ...headers },
|
|
48
50
|
timeout,
|
|
49
51
|
};
|
|
50
52
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DefaultClient } from './DefaultClient';
|
|
2
|
+
type THttpOptions = {
|
|
3
|
+
tlsInsecure?: boolean;
|
|
4
|
+
keepAlive?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare class DeviceConnectClient extends DefaultClient {
|
|
7
|
+
constructor(deviceAccessToken: string, host: string, opt?: THttpOptions);
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceConnectClient = void 0;
|
|
4
|
+
const DefaultClient_1 = require("./DefaultClient");
|
|
5
|
+
class DeviceConnectClient extends DefaultClient_1.DefaultClient {
|
|
6
|
+
constructor(deviceAccessToken, host, opt = {}) {
|
|
7
|
+
super({
|
|
8
|
+
...opt,
|
|
9
|
+
tls: true,
|
|
10
|
+
host: host,
|
|
11
|
+
headers: { authorization: `Bearer ${deviceAccessToken}` },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.DeviceConnectClient = DeviceConnectClient;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WsClient } from './WsClient';
|
|
2
|
+
type TWsClientOptions = {
|
|
3
|
+
path: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
tlsInsecure?: boolean;
|
|
6
|
+
pingInterval?: number;
|
|
7
|
+
protocol?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class DeviceConnectWsClient extends WsClient {
|
|
10
|
+
constructor(deviceAccessToken: string, host: string, opt: TWsClientOptions);
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceConnectWsClient = void 0;
|
|
4
|
+
const WsClient_1 = require("./WsClient");
|
|
5
|
+
class DeviceConnectWsClient extends WsClient_1.WsClient {
|
|
6
|
+
constructor(deviceAccessToken, host, opt) {
|
|
7
|
+
const andChar = opt.path.includes('?') ? '&' : '?';
|
|
8
|
+
super({
|
|
9
|
+
...opt,
|
|
10
|
+
tls: true,
|
|
11
|
+
host: host,
|
|
12
|
+
address: `${opt.path}${andChar}DEVICE_ACCESS_TOKEN=${deviceAccessToken}`,
|
|
13
|
+
});
|
|
14
|
+
this.wsOptions = {
|
|
15
|
+
auth: undefined,
|
|
16
|
+
rejectUnauthorized: !opt.tlsInsecure,
|
|
17
|
+
headers: { ...opt.headers },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.DeviceConnectWsClient = DeviceConnectWsClient;
|
|
@@ -3,10 +3,11 @@ import { Options } from '../internal/types';
|
|
|
3
3
|
export declare class VapixEvents extends EventEmitter {
|
|
4
4
|
private tls;
|
|
5
5
|
private tlsInsecure;
|
|
6
|
-
private
|
|
6
|
+
private host;
|
|
7
7
|
private port;
|
|
8
8
|
private user;
|
|
9
9
|
private pass;
|
|
10
|
+
private headers?;
|
|
10
11
|
private ws;
|
|
11
12
|
constructor(options?: Options);
|
|
12
13
|
connect(): void;
|
package/cjs/node/VapixEvents.js
CHANGED
|
@@ -6,19 +6,21 @@ const WsClient_1 = require("./WsClient");
|
|
|
6
6
|
class VapixEvents extends eventemitter2_1.EventEmitter2 {
|
|
7
7
|
tls;
|
|
8
8
|
tlsInsecure;
|
|
9
|
-
|
|
9
|
+
host;
|
|
10
10
|
port;
|
|
11
11
|
user;
|
|
12
12
|
pass;
|
|
13
|
+
headers;
|
|
13
14
|
ws;
|
|
14
15
|
constructor(options = {}) {
|
|
15
16
|
super();
|
|
16
17
|
this.tls = options.tls ?? false;
|
|
17
18
|
this.tlsInsecure = options.tlsInsecure ?? false;
|
|
18
|
-
this.
|
|
19
|
+
this.host = options.host ?? options.ip ?? '127.0.0.1';
|
|
19
20
|
this.port = options.port ?? (this.tls ? 443 : 80);
|
|
20
21
|
this.user = options.user ?? 'root';
|
|
21
22
|
this.pass = options.pass ?? '';
|
|
23
|
+
this.headers = options.headers;
|
|
22
24
|
this.createWsClient();
|
|
23
25
|
eventemitter2_1.EventEmitter2.call(this);
|
|
24
26
|
}
|
|
@@ -34,9 +36,10 @@ class VapixEvents extends eventemitter2_1.EventEmitter2 {
|
|
|
34
36
|
tlsInsecure: this.tlsInsecure,
|
|
35
37
|
user: this.user,
|
|
36
38
|
pass: this.pass,
|
|
37
|
-
|
|
39
|
+
host: this.host,
|
|
38
40
|
port: this.port,
|
|
39
41
|
address: '/vapix/ws-data-stream?sources=events',
|
|
42
|
+
headers: this.headers,
|
|
40
43
|
};
|
|
41
44
|
this.ws = new WsClient_1.WsClient(options);
|
|
42
45
|
this.ws.onOpen = () => {
|
package/cjs/node/WsClient.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { IWsClient, Options } from '../internal/types';
|
|
2
2
|
export type WsClientOptions = Options & {
|
|
3
3
|
address: string;
|
|
4
|
-
headers?: Record<string, string>;
|
|
5
4
|
pingInterval?: number;
|
|
6
5
|
protocol?: string;
|
|
7
6
|
};
|
|
7
|
+
type TWsoptions = {
|
|
8
|
+
auth?: string;
|
|
9
|
+
rejectUnauthorized: boolean;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
};
|
|
8
12
|
export declare class WsClient implements IWsClient {
|
|
9
13
|
private user;
|
|
10
14
|
private pass;
|
|
11
15
|
private address;
|
|
12
16
|
private protocol?;
|
|
13
17
|
private pingInterval;
|
|
14
|
-
|
|
18
|
+
protected wsOptions: TWsoptions;
|
|
15
19
|
private digestAddress;
|
|
16
20
|
private isAlive;
|
|
17
21
|
private pingTimer?;
|
|
@@ -28,3 +32,4 @@ export declare class WsClient implements IWsClient {
|
|
|
28
32
|
reconnect(): void;
|
|
29
33
|
private closeWsConnection;
|
|
30
34
|
}
|
|
35
|
+
export {};
|
package/cjs/node/WsClient.js
CHANGED
|
@@ -18,12 +18,12 @@ class WsClient {
|
|
|
18
18
|
constructor(options) {
|
|
19
19
|
const tls = options.tls ?? false;
|
|
20
20
|
const tlsInsecure = options.tlsInsecure ?? false;
|
|
21
|
-
const
|
|
21
|
+
const host = options.host ?? options.ip ?? '127.0.0.1';
|
|
22
22
|
const port = options.port ?? (tls ? 443 : 80);
|
|
23
23
|
this.user = options.user ?? '';
|
|
24
24
|
this.pass = options.pass ?? '';
|
|
25
25
|
const protocol = tls ? 'wss' : 'ws';
|
|
26
|
-
this.address = `${protocol}://${
|
|
26
|
+
this.address = `${protocol}://${host}:${port}${options.address}`;
|
|
27
27
|
this.digestAddress = options.address;
|
|
28
28
|
this.pingInterval = options.pingInterval ?? 30000;
|
|
29
29
|
this.protocol = options.protocol;
|
|
@@ -61,7 +61,7 @@ class WsClient {
|
|
|
61
61
|
this.isAlive = true;
|
|
62
62
|
});
|
|
63
63
|
if (wwwAuthenticateHeader !== undefined) {
|
|
64
|
-
this.wsOptions.headers['
|
|
64
|
+
this.wsOptions.headers['authorization'] = new Digest_1.Digest().getAuthHeader(this.user, this.pass, 'GET', this.digestAddress, wwwAuthenticateHeader);
|
|
65
65
|
}
|
|
66
66
|
this.ws.on('unexpected-response', (req, res) => {
|
|
67
67
|
if (res.statusCode === 401 && res.headers['www-authenticate'] !== undefined) {
|
package/cjs/node/index.d.ts
CHANGED
package/cjs/node/index.js
CHANGED
|
@@ -14,8 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.VapixEvents = exports.CamScripterAPICameraEventsGenerator = exports.CamOverlayDrawingAPI = exports.Frame = exports.Painter = exports.ResourceManager = void 0;
|
|
17
|
+
exports.VapixEvents = exports.CamScripterAPICameraEventsGenerator = exports.CamOverlayDrawingAPI = exports.Frame = exports.Painter = exports.ResourceManager = exports.DeviceConnectWsClient = void 0;
|
|
18
18
|
__exportStar(require("./DefaultClient"), exports);
|
|
19
|
+
__exportStar(require("./DeviceConnectClient"), exports);
|
|
20
|
+
var DeviceConnectWsClient_1 = require("./DeviceConnectWsClient");
|
|
21
|
+
Object.defineProperty(exports, "DeviceConnectWsClient", { enumerable: true, get: function () { return DeviceConnectWsClient_1.DeviceConnectWsClient; } });
|
|
19
22
|
__exportStar(require("./WsClient"), exports);
|
|
20
23
|
__exportStar(require("./HttpServer"), exports);
|
|
21
24
|
__exportStar(require("./HttpRequestSender"), exports);
|
|
@@ -1113,6 +1113,7 @@ export declare const zonesSchema: z.ZodObject<{
|
|
|
1113
1113
|
minSpeedKmph: z.ZodOptional<z.ZodNumber>;
|
|
1114
1114
|
maxSpeedKmph: z.ZodOptional<z.ZodNumber>;
|
|
1115
1115
|
flightDirection: z.ZodDefault<z.ZodEnum<["all", "arrival", "departure"]>>;
|
|
1116
|
+
runwayDirectionDeg: z.ZodOptional<z.ZodNumber>;
|
|
1116
1117
|
weight: z.ZodNumber;
|
|
1117
1118
|
perimeter: z.ZodDefault<z.ZodEnum<["none", "outer", "inner"]>>;
|
|
1118
1119
|
trackingDomains: z.ZodDefault<z.ZodArray<z.ZodEnum<["adsb", "remoteId"]>, "many">>;
|
|
@@ -1134,6 +1135,7 @@ export declare const zonesSchema: z.ZodObject<{
|
|
|
1134
1135
|
maxAltitudeAmsl?: number | undefined;
|
|
1135
1136
|
minSpeedKmph?: number | undefined;
|
|
1136
1137
|
maxSpeedKmph?: number | undefined;
|
|
1138
|
+
runwayDirectionDeg?: number | undefined;
|
|
1137
1139
|
}, {
|
|
1138
1140
|
area: [{
|
|
1139
1141
|
lat: number;
|
|
@@ -1150,6 +1152,7 @@ export declare const zonesSchema: z.ZodObject<{
|
|
|
1150
1152
|
minSpeedKmph?: number | undefined;
|
|
1151
1153
|
maxSpeedKmph?: number | undefined;
|
|
1152
1154
|
flightDirection?: "all" | "arrival" | "departure" | undefined;
|
|
1155
|
+
runwayDirectionDeg?: number | undefined;
|
|
1153
1156
|
perimeter?: "none" | "outer" | "inner" | undefined;
|
|
1154
1157
|
trackingDomains?: ("adsb" | "remoteId")[] | undefined;
|
|
1155
1158
|
}>, "many">>;
|
|
@@ -1172,6 +1175,7 @@ export declare const zonesSchema: z.ZodObject<{
|
|
|
1172
1175
|
maxAltitudeAmsl?: number | undefined;
|
|
1173
1176
|
minSpeedKmph?: number | undefined;
|
|
1174
1177
|
maxSpeedKmph?: number | undefined;
|
|
1178
|
+
runwayDirectionDeg?: number | undefined;
|
|
1175
1179
|
}[];
|
|
1176
1180
|
}, {
|
|
1177
1181
|
zones?: {
|
|
@@ -1190,6 +1194,7 @@ export declare const zonesSchema: z.ZodObject<{
|
|
|
1190
1194
|
minSpeedKmph?: number | undefined;
|
|
1191
1195
|
maxSpeedKmph?: number | undefined;
|
|
1192
1196
|
flightDirection?: "all" | "arrival" | "departure" | undefined;
|
|
1197
|
+
runwayDirectionDeg?: number | undefined;
|
|
1193
1198
|
perimeter?: "none" | "outer" | "inner" | undefined;
|
|
1194
1199
|
trackingDomains?: ("adsb" | "remoteId")[] | undefined;
|
|
1195
1200
|
}[] | undefined;
|
|
@@ -372,6 +372,7 @@ exports.zonesSchema = zod_1.z.object({
|
|
|
372
372
|
minSpeedKmph: zod_1.z.number().optional(),
|
|
373
373
|
maxSpeedKmph: zod_1.z.number().optional(),
|
|
374
374
|
flightDirection: zod_1.z.enum(['all', 'arrival', 'departure']).default('all'),
|
|
375
|
+
runwayDirectionDeg: zod_1.z.number().min(0).max(360).optional(),
|
|
375
376
|
weight: zod_1.z.number(),
|
|
376
377
|
perimeter: exports.zonePerimeterSchema.default('none'),
|
|
377
378
|
trackingDomains: zod_1.z.array(exports.domainIdSchema).default(['adsb', 'remoteId']),
|