camstreamerlib 4.0.0-beta.62 → 4.0.0-beta.64
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 -0
- package/cjs/CamOverlayAPI.d.ts +867 -0
- package/cjs/CamOverlayAPI.js +5 -5
- package/cjs/CamScripterAPI.d.ts +46 -0
- package/cjs/CamScripterAPI.js +2 -3
- package/cjs/CamStreamerAPI.d.ts +64 -0
- package/cjs/CamStreamerAPI.js +1 -2
- package/cjs/CamSwitcherAPI.d.ts +167 -0
- package/cjs/CamSwitcherAPI.js +2 -2
- package/cjs/PlaneTrackerAPI.d.ts +229 -0
- package/cjs/PlaneTrackerAPI.js +8 -8
- package/cjs/VapixAPI.d.ts +118 -0
- package/cjs/VapixAPI.js +10 -10
- package/cjs/bin/CreatePackage.d.ts +1 -0
- package/cjs/errors/errors.d.ts +91 -0
- package/cjs/errors/errors.js +32 -26
- package/cjs/index.d.ts +27 -0
- package/cjs/internal/ProxyClient.d.ts +10 -0
- package/cjs/internal/WsEvents.d.ts +37 -0
- package/cjs/internal/constants.d.ts +1 -0
- package/cjs/internal/transformers.d.ts +5 -0
- package/cjs/internal/types.d.ts +47 -0
- package/cjs/internal/utils.d.ts +13 -0
- package/cjs/internal/utils.js +1 -16
- package/cjs/internal/versionCompare.d.ts +6 -0
- package/cjs/node/CamOverlayDrawingAPI.d.ts +41 -0
- package/cjs/node/CamOverlayPainter/Frame.d.ts +67 -0
- package/cjs/node/CamOverlayPainter/Painter.d.ts +32 -0
- package/cjs/node/CamOverlayPainter/ResourceManager.d.ts +15 -0
- package/cjs/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
- package/cjs/node/DefaultClient.d.ts +16 -0
- package/cjs/node/Digest.d.ts +4 -0
- package/cjs/node/Digest.test.d.ts +1 -0
- package/cjs/node/HttpRequestSender.d.ts +29 -0
- package/cjs/node/HttpServer.d.ts +21 -0
- package/cjs/node/TimeZoneDaemon.d.ts +6 -0
- package/cjs/node/TimeZoneDaemon.js +29 -0
- package/cjs/node/VapixEvents.d.ts +16 -0
- package/cjs/node/WsClient.d.ts +30 -0
- package/cjs/node/events/AxisCameraStationEvents.d.ts +12 -0
- package/cjs/node/events/GenetecAgent.d.ts +16 -0
- package/cjs/node/events/GenetecAgent.js +5 -4
- package/cjs/node/index.d.ts +17 -0
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +4330 -0
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +700 -0
- package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +95 -0
- package/cjs/types/CamOverlayAPI/index.d.ts +11 -0
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +96 -0
- package/cjs/types/CamOverlayAPI/pipSchema.d.ts +125 -0
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +96 -0
- package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +118 -0
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +145 -0
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
- package/cjs/types/CamOverlayDrawingAPI.d.ts +48 -0
- package/cjs/types/CamOverlayPainter.d.ts +76 -0
- package/cjs/types/CamScripterAPI.d.ts +130 -0
- package/cjs/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
- package/cjs/types/CamStreamerAPI.d.ts +272 -0
- package/cjs/types/CamSwitcherAPI.d.ts +893 -0
- package/cjs/types/GenetecAgent.d.ts +174 -0
- package/cjs/types/PlaneTrackerAPI.d.ts +926 -0
- package/cjs/types/PlaneTrackerAPI.js +4 -1
- package/cjs/types/VapixAPI.d.ts +1865 -0
- package/cjs/types/VapixEvents.d.ts +15 -0
- package/cjs/types/common.d.ts +49 -0
- package/cjs/types/ws/CamOverlayEvents.d.ts +88 -0
- package/cjs/types/ws/CamStreamerEvents.d.ts +249 -0
- package/cjs/types/ws/CamSwitcherEvents.d.ts +568 -0
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +1637 -0
- package/cjs/types/ws/PlaneTrackerEvents.js +2 -0
- package/cjs/web/DefaultClient.d.ts +8 -0
- package/cjs/web/WsClient.d.ts +17 -0
- package/cjs/web/index.d.ts +2 -0
- package/cjs/ws/CamOverlayEvents.d.ts +8 -0
- package/cjs/ws/CamStreamerEvents.d.ts +8 -0
- package/cjs/ws/CamSwitcherEvents.d.ts +8 -0
- package/cjs/ws/PlaneTrackerEvents.d.ts +9 -0
- package/esm/CamOverlayAPI.js +7 -7
- package/esm/CamScripterAPI.js +3 -4
- package/esm/CamStreamerAPI.js +2 -3
- package/esm/CamSwitcherAPI.js +4 -4
- package/esm/PlaneTrackerAPI.js +10 -10
- package/esm/VapixAPI.js +12 -12
- package/esm/errors/errors.js +30 -24
- package/esm/internal/utils.js +0 -11
- package/esm/node/TimeZoneDaemon.js +25 -0
- package/esm/node/events/GenetecAgent.js +6 -5
- package/esm/types/PlaneTrackerAPI.js +3 -0
- package/esm/types/ws/PlaneTrackerEvents.js +2 -0
- package/package.json +1 -1
- package/types/errors/errors.d.ts +17 -22
- package/types/internal/utils.d.ts +1 -13
- package/types/node/TimeZoneDaemon.d.ts +6 -0
- package/types/types/PlaneTrackerAPI.d.ts +8 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +40 -0
package/cjs/PlaneTrackerAPI.js
CHANGED
|
@@ -45,7 +45,7 @@ class PlaneTrackerAPI {
|
|
|
45
45
|
timeout: options?.timeout,
|
|
46
46
|
});
|
|
47
47
|
if (!res.ok) {
|
|
48
|
-
throw new errors_1.ResetCalibrationError('PTZ',
|
|
48
|
+
throw new errors_1.ResetCalibrationError('PTZ', res);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
async resetFocusCalibration(options) {
|
|
@@ -56,7 +56,7 @@ class PlaneTrackerAPI {
|
|
|
56
56
|
timeout: options?.timeout,
|
|
57
57
|
});
|
|
58
58
|
if (!res.ok) {
|
|
59
|
-
throw new errors_1.ResetCalibrationError('FOCUS',
|
|
59
|
+
throw new errors_1.ResetCalibrationError('FOCUS', res);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
async fetchCameraSettings(options) {
|
|
@@ -84,7 +84,7 @@ class PlaneTrackerAPI {
|
|
|
84
84
|
timeout: options?.timeout,
|
|
85
85
|
});
|
|
86
86
|
if (!res.ok) {
|
|
87
|
-
throw new errors_1.ImportSettingsError(
|
|
87
|
+
throw new errors_1.ImportSettingsError(res);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
async fetchFlightInfo(icao, options) {
|
|
@@ -168,7 +168,7 @@ class PlaneTrackerAPI {
|
|
|
168
168
|
throw new errors_1.InvalidAltitudeError();
|
|
169
169
|
}
|
|
170
170
|
if (res.status === 400) {
|
|
171
|
-
throw new errors_1.BadRequestError(
|
|
171
|
+
throw new errors_1.BadRequestError(res);
|
|
172
172
|
}
|
|
173
173
|
if (res.status === 500) {
|
|
174
174
|
throw new errors_1.ServerError();
|
|
@@ -189,7 +189,7 @@ class PlaneTrackerAPI {
|
|
|
189
189
|
return await res.json();
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
|
-
throw new errors_1.
|
|
192
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
async _getBlob(path, parameters, options) {
|
|
@@ -199,7 +199,7 @@ class PlaneTrackerAPI {
|
|
|
199
199
|
return await this.parseBlobResponse(res);
|
|
200
200
|
}
|
|
201
201
|
else {
|
|
202
|
-
throw new errors_1.
|
|
202
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
async parseBlobResponse(response) {
|
|
@@ -224,7 +224,7 @@ class PlaneTrackerAPI {
|
|
|
224
224
|
return res;
|
|
225
225
|
}
|
|
226
226
|
else {
|
|
227
|
-
throw new errors_1.
|
|
227
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
async _postUrlEncoded(path, params, options) {
|
|
@@ -240,7 +240,7 @@ class PlaneTrackerAPI {
|
|
|
240
240
|
return res;
|
|
241
241
|
}
|
|
242
242
|
else {
|
|
243
|
-
throw new errors_1.
|
|
243
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
|
+
import { TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
|
|
3
|
+
import { ProxyClient } from './internal/ProxyClient';
|
|
4
|
+
import { TCameraImageConfig, THttpRequestOptions, TProxyParams } from './types/common';
|
|
5
|
+
export declare class VapixAPI<Client extends IClient<TResponse, any>> {
|
|
6
|
+
private client;
|
|
7
|
+
private CustomFormData;
|
|
8
|
+
constructor(client: Client, CustomFormData?: {
|
|
9
|
+
new (form?: HTMLFormElement | undefined, submitter?: HTMLElement | null | undefined): FormData;
|
|
10
|
+
prototype: FormData;
|
|
11
|
+
});
|
|
12
|
+
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
13
|
+
postUrlEncoded(path: string, parameters?: TParameters, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
|
|
14
|
+
postJson(path: string, jsonData: Record<string, any>, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
|
|
15
|
+
getCameraImage(parameters: TCameraImageConfig, options?: THttpRequestOptions): Promise<ReturnType<Client["get"]>>;
|
|
16
|
+
getEventDeclarations(options?: THttpRequestOptions): Promise<string>;
|
|
17
|
+
getSupportedAudioSampleRate(options?: THttpRequestOptions): Promise<{
|
|
18
|
+
sampleRate: number;
|
|
19
|
+
bitRates: number[];
|
|
20
|
+
}[]>;
|
|
21
|
+
performAutofocus(options?: THttpRequestOptions): Promise<void>;
|
|
22
|
+
checkSDCard(options?: THttpRequestOptions): Promise<{
|
|
23
|
+
status: "OK" | "connected" | "disconnected";
|
|
24
|
+
totalSize: number;
|
|
25
|
+
freeSize: number;
|
|
26
|
+
}>;
|
|
27
|
+
mountSDCard(options?: THttpRequestOptions): Promise<number>;
|
|
28
|
+
unmountSDCard(options?: THttpRequestOptions): Promise<number>;
|
|
29
|
+
private _doSDCardMountAction;
|
|
30
|
+
fetchSDCardJobProgress(jobId: number, options?: THttpRequestOptions): Promise<number>;
|
|
31
|
+
downloadCameraReport(options?: THttpRequestOptions): Promise<TResponse>;
|
|
32
|
+
getSystemLog(options?: THttpRequestOptions): Promise<TResponse>;
|
|
33
|
+
getMaxFps(channel: number, options?: THttpRequestOptions): Promise<number>;
|
|
34
|
+
getTimezone(options?: THttpRequestOptions): Promise<string>;
|
|
35
|
+
getDateTimeInfo(options?: THttpRequestOptions): Promise<{
|
|
36
|
+
data: {
|
|
37
|
+
dateTime: string;
|
|
38
|
+
dstEnabled: boolean;
|
|
39
|
+
localDateTime: string;
|
|
40
|
+
posixTimeZone: string;
|
|
41
|
+
timeZone?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
getDevicesSettings(options?: THttpRequestOptions): Promise<TAudioDevice[]>;
|
|
45
|
+
fetchRemoteDeviceInfo<T extends Record<string, any>>(payload: T, options?: THttpRequestOptions): Promise<any>;
|
|
46
|
+
getHeaders(options?: THttpRequestOptions): Promise<Record<string, string>>;
|
|
47
|
+
setHeaders(headers: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
|
|
48
|
+
getParameter(paramNames: string | string[], options?: THttpRequestOptions): Promise<Record<string, string>>;
|
|
49
|
+
setParameter(params: Record<string, string | number | boolean>, options?: THttpRequestOptions): Promise<void>;
|
|
50
|
+
getGuardTourList(options?: THttpRequestOptions): Promise<{
|
|
51
|
+
name: string;
|
|
52
|
+
id: string;
|
|
53
|
+
running: string;
|
|
54
|
+
tour: {
|
|
55
|
+
moveSpeed?: unknown;
|
|
56
|
+
position?: unknown;
|
|
57
|
+
presetNbr?: unknown;
|
|
58
|
+
waitTime?: unknown;
|
|
59
|
+
waitTimeViewType?: unknown;
|
|
60
|
+
}[];
|
|
61
|
+
camNbr?: unknown;
|
|
62
|
+
randomEnabled?: unknown;
|
|
63
|
+
timeBetweenSequences?: unknown;
|
|
64
|
+
}>;
|
|
65
|
+
setGuardTourEnabled(guardTourId: string, enable: boolean, options?: THttpRequestOptions): Promise<void>;
|
|
66
|
+
getPTZPresetList(channel: number, options?: THttpRequestOptions): Promise<string[]>;
|
|
67
|
+
listPTZ(camera: number, options?: THttpRequestOptions): Promise<{
|
|
68
|
+
name: string;
|
|
69
|
+
id: number;
|
|
70
|
+
data: {
|
|
71
|
+
pan?: number | undefined;
|
|
72
|
+
tilt?: number | undefined;
|
|
73
|
+
zoom?: number | undefined;
|
|
74
|
+
};
|
|
75
|
+
}[]>;
|
|
76
|
+
listPtzVideoSourceOverview(options?: THttpRequestOptions): Promise<Record<number, {
|
|
77
|
+
name: string;
|
|
78
|
+
id: number;
|
|
79
|
+
}[]>>;
|
|
80
|
+
goToPreset(channel: number, presetName: string, options?: THttpRequestOptions): Promise<TResponse>;
|
|
81
|
+
getPtzPosition(camera: number, options?: THttpRequestOptions): Promise<{
|
|
82
|
+
pan?: number | undefined;
|
|
83
|
+
tilt?: number | undefined;
|
|
84
|
+
zoom?: number | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
getPorts(options?: THttpRequestOptions): Promise<{
|
|
87
|
+
name: string;
|
|
88
|
+
port: string;
|
|
89
|
+
state: "open" | "closed";
|
|
90
|
+
configurable: boolean;
|
|
91
|
+
usage: string;
|
|
92
|
+
direction: "input" | "output";
|
|
93
|
+
normalState: "open" | "closed";
|
|
94
|
+
readonly?: boolean | undefined;
|
|
95
|
+
}[]>;
|
|
96
|
+
setPorts(ports: TPortSetSchema[], options?: THttpRequestOptions): Promise<void>;
|
|
97
|
+
setPortStateSequence(port: number, sequence: TPortSequenceStateSchema[], options?: THttpRequestOptions): Promise<void>;
|
|
98
|
+
getApplicationList(options?: THttpRequestOptions): Promise<{
|
|
99
|
+
Name: string;
|
|
100
|
+
NiceName: string;
|
|
101
|
+
Vendor: string;
|
|
102
|
+
Version: string;
|
|
103
|
+
License: string;
|
|
104
|
+
Status: string;
|
|
105
|
+
appId: "CamStreamer" | "CamSwitcher" | "CamOverlay" | "CamScripter" | "PlaneTracker" | "Ndihxplugin" | "SportTracker" | null;
|
|
106
|
+
ApplicationID?: string | undefined;
|
|
107
|
+
ConfigurationPage?: string | undefined;
|
|
108
|
+
VendorHomePage?: string | undefined;
|
|
109
|
+
LicenseName?: string | undefined;
|
|
110
|
+
}[]>;
|
|
111
|
+
startApplication(applicationId: string, options?: THttpRequestOptions): Promise<void>;
|
|
112
|
+
restartApplication(applicationId: string, options?: THttpRequestOptions): Promise<void>;
|
|
113
|
+
stopApplication(applicationId: string, options?: THttpRequestOptions): Promise<void>;
|
|
114
|
+
installApplication(data: Parameters<typeof FormData.prototype.append>[1], fileName: string, options?: THttpRequestOptions): Promise<void>;
|
|
115
|
+
private static parseParameters;
|
|
116
|
+
private static parseCameraPtzResponse;
|
|
117
|
+
private static parsePtz;
|
|
118
|
+
}
|
package/cjs/VapixAPI.js
CHANGED
|
@@ -23,7 +23,7 @@ class VapixAPI {
|
|
|
23
23
|
const agent = this.getClient(options?.proxyParams);
|
|
24
24
|
const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
|
|
25
25
|
if (!res.ok) {
|
|
26
|
-
throw new errors_1.
|
|
26
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
27
27
|
}
|
|
28
28
|
return res;
|
|
29
29
|
}
|
|
@@ -33,7 +33,7 @@ class VapixAPI {
|
|
|
33
33
|
const agent = this.getClient(options?.proxyParams);
|
|
34
34
|
const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
|
|
35
35
|
if (!res.ok) {
|
|
36
|
-
throw new errors_1.
|
|
36
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
37
37
|
}
|
|
38
38
|
return res;
|
|
39
39
|
}
|
|
@@ -59,7 +59,7 @@ class VapixAPI {
|
|
|
59
59
|
headers: { 'Content-Type': 'application/soap+xml' },
|
|
60
60
|
});
|
|
61
61
|
if (!res.ok) {
|
|
62
|
-
throw new errors_1.
|
|
62
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
63
63
|
}
|
|
64
64
|
return await res.text();
|
|
65
65
|
}
|
|
@@ -136,7 +136,7 @@ class VapixAPI {
|
|
|
136
136
|
const result = parser.parse(textXml);
|
|
137
137
|
const job = result.root.job;
|
|
138
138
|
if (job.result !== 'OK') {
|
|
139
|
-
throw new errors_1.SDCardActionError(action,
|
|
139
|
+
throw new errors_1.SDCardActionError(action, job.description);
|
|
140
140
|
}
|
|
141
141
|
return Number(job.jobid);
|
|
142
142
|
}
|
|
@@ -153,7 +153,7 @@ class VapixAPI {
|
|
|
153
153
|
});
|
|
154
154
|
const job = parser.parse(textXml).root.job;
|
|
155
155
|
if (job.result !== 'OK') {
|
|
156
|
-
throw new errors_1.SDCardJobError();
|
|
156
|
+
throw new errors_1.SDCardJobError(job.description);
|
|
157
157
|
}
|
|
158
158
|
return Number(job.progress);
|
|
159
159
|
}
|
|
@@ -190,7 +190,7 @@ class VapixAPI {
|
|
|
190
190
|
const agent = this.getClient(options?.proxyParams);
|
|
191
191
|
const resV2 = await agent.get({ path: '/config/rest/time/v2/timeZone', timeout: options?.timeout });
|
|
192
192
|
if (!resV2.ok) {
|
|
193
|
-
throw new errors_1.
|
|
193
|
+
throw new errors_1.ErrorWithResponse(resV2);
|
|
194
194
|
}
|
|
195
195
|
const json = await resV2.json();
|
|
196
196
|
const data = VapixAPI_1.timeZoneSchema.parse(json);
|
|
@@ -429,7 +429,7 @@ class VapixAPI {
|
|
|
429
429
|
});
|
|
430
430
|
const text = (await res.text()).trim().toLowerCase();
|
|
431
431
|
if (text !== 'ok' && !(text.startsWith('error:') && text.substring(7) === '6')) {
|
|
432
|
-
throw new errors_1.ApplicationAPIError('START',
|
|
432
|
+
throw new errors_1.ApplicationAPIError('START', text);
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
async restartApplication(applicationId, options) {
|
|
@@ -444,7 +444,7 @@ class VapixAPI {
|
|
|
444
444
|
});
|
|
445
445
|
const text = (await res.text()).trim().toLowerCase();
|
|
446
446
|
if (text !== 'ok') {
|
|
447
|
-
throw new errors_1.ApplicationAPIError('RESTART',
|
|
447
|
+
throw new errors_1.ApplicationAPIError('RESTART', text);
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
async stopApplication(applicationId, options) {
|
|
@@ -459,7 +459,7 @@ class VapixAPI {
|
|
|
459
459
|
});
|
|
460
460
|
const text = (await res.text()).trim().toLowerCase();
|
|
461
461
|
if (text !== 'ok' && !(text.startsWith('error:') && text.substring(7) === '6')) {
|
|
462
|
-
throw new errors_1.ApplicationAPIError('STOP',
|
|
462
|
+
throw new errors_1.ApplicationAPIError('STOP', text);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
async installApplication(data, fileName, options) {
|
|
@@ -475,7 +475,7 @@ class VapixAPI {
|
|
|
475
475
|
timeout: options?.timeout ?? 120000,
|
|
476
476
|
});
|
|
477
477
|
if (!res.ok) {
|
|
478
|
-
throw new errors_1.
|
|
478
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
479
479
|
}
|
|
480
480
|
const text = await res.text();
|
|
481
481
|
if (text.length > 5) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { TResponse } from '../internal/types';
|
|
2
|
+
export declare class ErrorWithResponse<T extends TResponse> extends Error {
|
|
3
|
+
res: T;
|
|
4
|
+
constructor(res: T);
|
|
5
|
+
}
|
|
6
|
+
export declare class ServiceUnavailableError extends Error {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
export declare class ServiceNotFoundError extends Error {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export declare class ParsingBlobError extends Error {
|
|
13
|
+
constructor(err: unknown);
|
|
14
|
+
}
|
|
15
|
+
export declare class JsonParseError extends Error {
|
|
16
|
+
constructor(paramName: string, data: unknown);
|
|
17
|
+
}
|
|
18
|
+
export declare class ParameterNotFoundError extends Error {
|
|
19
|
+
constructor(paramName: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class SettingParameterError extends Error {
|
|
22
|
+
constructor(message: string);
|
|
23
|
+
}
|
|
24
|
+
type TApplicationAPIAction = 'START' | 'RESTART' | 'STOP' | 'INSTALL';
|
|
25
|
+
export declare class ApplicationAPIError extends Error {
|
|
26
|
+
action: TApplicationAPIAction;
|
|
27
|
+
constructor(action: TApplicationAPIAction, reason: string);
|
|
28
|
+
}
|
|
29
|
+
type TSDCardAction = 'MOUNT' | 'UNMOUNT';
|
|
30
|
+
export declare class SDCardActionError extends Error {
|
|
31
|
+
action: TSDCardAction;
|
|
32
|
+
constructor(action: TSDCardAction, reason: string);
|
|
33
|
+
}
|
|
34
|
+
export declare class SDCardJobError extends Error {
|
|
35
|
+
constructor(reason: string);
|
|
36
|
+
}
|
|
37
|
+
type TMaxFPSErrorType = 'MALFORMED_REPLY' | 'CHANNEL_NOT_FOUND' | 'CAPTURE_MODE_NOT_FOUND' | 'FPS_NOT_SPECIFIED';
|
|
38
|
+
export declare class MaxFPSError extends Error {
|
|
39
|
+
constructor(state: TMaxFPSErrorType);
|
|
40
|
+
}
|
|
41
|
+
export declare class NoDeviceInfoError extends Error {
|
|
42
|
+
constructor();
|
|
43
|
+
}
|
|
44
|
+
export declare class FetchDeviceInfoError extends Error {
|
|
45
|
+
constructor(err: unknown);
|
|
46
|
+
}
|
|
47
|
+
export declare class AddNewClipError extends Error {
|
|
48
|
+
constructor(message: string);
|
|
49
|
+
}
|
|
50
|
+
export declare class PtzNotSupportedError extends Error {
|
|
51
|
+
constructor();
|
|
52
|
+
}
|
|
53
|
+
export declare class StorageDataFetchError extends Error {
|
|
54
|
+
constructor(err: unknown);
|
|
55
|
+
}
|
|
56
|
+
export declare class WsAuthorizationError extends Error {
|
|
57
|
+
constructor(message: string);
|
|
58
|
+
}
|
|
59
|
+
export declare class UtcTimeFetchError extends Error {
|
|
60
|
+
constructor(message: string);
|
|
61
|
+
}
|
|
62
|
+
export declare class TimezoneNotSetupError extends Error {
|
|
63
|
+
constructor();
|
|
64
|
+
}
|
|
65
|
+
export declare class TimezoneFetchError extends Error {
|
|
66
|
+
constructor(err: unknown);
|
|
67
|
+
}
|
|
68
|
+
type TCalibrationType = 'PTZ' | 'FOCUS';
|
|
69
|
+
export declare class ResetCalibrationError<T extends TResponse> extends ErrorWithResponse<T> {
|
|
70
|
+
type: TCalibrationType;
|
|
71
|
+
constructor(type: TCalibrationType, res: T);
|
|
72
|
+
}
|
|
73
|
+
export declare class ImportSettingsError<T extends TResponse> extends ErrorWithResponse<T> {
|
|
74
|
+
constructor(res: T);
|
|
75
|
+
}
|
|
76
|
+
export declare class CannotSetCoordsInAutoModeError extends Error {
|
|
77
|
+
constructor();
|
|
78
|
+
}
|
|
79
|
+
export declare class InvalidLatLngError extends Error {
|
|
80
|
+
constructor();
|
|
81
|
+
}
|
|
82
|
+
export declare class InvalidAltitudeError extends Error {
|
|
83
|
+
constructor();
|
|
84
|
+
}
|
|
85
|
+
export declare class ServerError extends Error {
|
|
86
|
+
constructor();
|
|
87
|
+
}
|
|
88
|
+
export declare class BadRequestError<T extends TResponse> extends ErrorWithResponse<T> {
|
|
89
|
+
constructor(res: T);
|
|
90
|
+
}
|
|
91
|
+
export {};
|
package/cjs/errors/errors.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
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;
|
|
4
|
+
class ErrorWithResponse extends Error {
|
|
5
|
+
res;
|
|
6
|
+
constructor(res) {
|
|
7
|
+
super(res.statusText);
|
|
8
|
+
this.res = res;
|
|
9
|
+
this.name = 'ErrorWithResponse';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ErrorWithResponse = ErrorWithResponse;
|
|
5
13
|
class ServiceUnavailableError extends Error {
|
|
6
14
|
constructor() {
|
|
7
15
|
super('Service is unavailable.');
|
|
@@ -45,22 +53,26 @@ class SettingParameterError extends Error {
|
|
|
45
53
|
}
|
|
46
54
|
exports.SettingParameterError = SettingParameterError;
|
|
47
55
|
class ApplicationAPIError extends Error {
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
action;
|
|
57
|
+
constructor(action, reason) {
|
|
58
|
+
super(`Error performing application action '${action}': ${reason}`);
|
|
59
|
+
this.action = action;
|
|
50
60
|
this.name = 'ApplicationAPIError';
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
63
|
exports.ApplicationAPIError = ApplicationAPIError;
|
|
54
64
|
class SDCardActionError extends Error {
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
action;
|
|
66
|
+
constructor(action, reason) {
|
|
67
|
+
super(`Error performing SD card action '${action}': ${reason}`);
|
|
68
|
+
this.action = action;
|
|
57
69
|
this.name = 'SDCardActionError';
|
|
58
70
|
}
|
|
59
71
|
}
|
|
60
72
|
exports.SDCardActionError = SDCardActionError;
|
|
61
73
|
class SDCardJobError extends Error {
|
|
62
|
-
constructor() {
|
|
63
|
-
super(
|
|
74
|
+
constructor(reason) {
|
|
75
|
+
super(`Error while fetching SD card job progress: ${reason}`);
|
|
64
76
|
this.name = 'SDCardJobError';
|
|
65
77
|
}
|
|
66
78
|
}
|
|
@@ -141,16 +153,18 @@ class TimezoneFetchError extends Error {
|
|
|
141
153
|
}
|
|
142
154
|
}
|
|
143
155
|
exports.TimezoneFetchError = TimezoneFetchError;
|
|
144
|
-
class ResetCalibrationError extends
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
class ResetCalibrationError extends ErrorWithResponse {
|
|
157
|
+
type;
|
|
158
|
+
constructor(type, res) {
|
|
159
|
+
super(res);
|
|
160
|
+
this.type = type;
|
|
147
161
|
this.name = 'ResetCalibrationError';
|
|
148
162
|
}
|
|
149
163
|
}
|
|
150
164
|
exports.ResetCalibrationError = ResetCalibrationError;
|
|
151
|
-
class ImportSettingsError extends
|
|
152
|
-
constructor(
|
|
153
|
-
super(
|
|
165
|
+
class ImportSettingsError extends ErrorWithResponse {
|
|
166
|
+
constructor(res) {
|
|
167
|
+
super(res);
|
|
154
168
|
this.name = 'ImportSettingsError';
|
|
155
169
|
}
|
|
156
170
|
}
|
|
@@ -183,18 +197,10 @@ class ServerError extends Error {
|
|
|
183
197
|
}
|
|
184
198
|
}
|
|
185
199
|
exports.ServerError = ServerError;
|
|
186
|
-
class BadRequestError extends
|
|
187
|
-
constructor(
|
|
188
|
-
super(
|
|
189
|
-
this.name = '
|
|
200
|
+
class BadRequestError extends ErrorWithResponse {
|
|
201
|
+
constructor(res) {
|
|
202
|
+
super(res);
|
|
203
|
+
this.name = 'BadRequestError';
|
|
190
204
|
}
|
|
191
205
|
}
|
|
192
206
|
exports.BadRequestError = BadRequestError;
|
|
193
|
-
class GeneralResponseNotOKError extends Error {
|
|
194
|
-
static messageSchema = utils_1.stringifiedResponseSchema;
|
|
195
|
-
constructor(stringifiedRes) {
|
|
196
|
-
super(stringifiedRes);
|
|
197
|
-
this.name = 'GeneralResponseNotOKError';
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
exports.GeneralResponseNotOKError = GeneralResponseNotOKError;
|
package/cjs/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from './errors/errors';
|
|
2
|
+
export * from './internal/types';
|
|
3
|
+
export * from './internal/constants';
|
|
4
|
+
export * from './internal/utils';
|
|
5
|
+
export * from './internal/versionCompare';
|
|
6
|
+
export * from './internal/ProxyClient';
|
|
7
|
+
export * from './types/common';
|
|
8
|
+
export { CamStreamerAPI } from './CamStreamerAPI';
|
|
9
|
+
export * from './types/CamStreamerAPI';
|
|
10
|
+
export { CamStreamerEvents } from './ws/CamStreamerEvents';
|
|
11
|
+
export * from './types/ws/CamStreamerEvents';
|
|
12
|
+
export { CamOverlayAPI } from './CamOverlayAPI';
|
|
13
|
+
export * from './types/CamOverlayAPI';
|
|
14
|
+
export { CamOverlayEvents } from './ws/CamOverlayEvents';
|
|
15
|
+
export * from './types/ws/CamOverlayEvents';
|
|
16
|
+
export { CamSwitcherAPI } from './CamSwitcherAPI';
|
|
17
|
+
export * from './types/CamSwitcherAPI';
|
|
18
|
+
export { CamSwitcherEvents } from './ws/CamSwitcherEvents';
|
|
19
|
+
export * from './types/ws/CamSwitcherEvents';
|
|
20
|
+
export { PlaneTrackerAPI } from './PlaneTrackerAPI';
|
|
21
|
+
export * from './types/PlaneTrackerAPI';
|
|
22
|
+
export { PlaneTrackerEvents } from './ws/PlaneTrackerEvents';
|
|
23
|
+
export * from './types/ws/PlaneTrackerEvents';
|
|
24
|
+
export { CamScripterAPI } from './CamScripterAPI';
|
|
25
|
+
export * from './types/CamScripterAPI';
|
|
26
|
+
export { VapixAPI } from './VapixAPI';
|
|
27
|
+
export * from './types/VapixAPI';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IClient, TGetParams, TResponse } from './types';
|
|
2
|
+
import { TProxyParams } from '../types/common';
|
|
3
|
+
export declare class ProxyClient<Client extends IClient<TResponse, any>> {
|
|
4
|
+
private client;
|
|
5
|
+
private proxyParams;
|
|
6
|
+
constructor(client: Client, proxyParams: TProxyParams);
|
|
7
|
+
get(params: TGetParams): ReturnType<Client["get"]>;
|
|
8
|
+
post(params: Parameters<Client['post']>[0]): ReturnType<Client["post"]>;
|
|
9
|
+
private getReal;
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IWsClient } from './types';
|
|
2
|
+
type TEventType<T extends {
|
|
3
|
+
type: string;
|
|
4
|
+
}> = T extends {
|
|
5
|
+
type: infer Type;
|
|
6
|
+
} ? Type : never;
|
|
7
|
+
type TEvent<T extends {
|
|
8
|
+
type: string;
|
|
9
|
+
}, Type extends TEventType<T>> = T extends {
|
|
10
|
+
type: Type;
|
|
11
|
+
} ? T : never;
|
|
12
|
+
type TValidate<T extends {
|
|
13
|
+
type: string;
|
|
14
|
+
}> = (data: string) => {
|
|
15
|
+
type: 'init';
|
|
16
|
+
data: TEvent<T, TEventType<T>>;
|
|
17
|
+
} | TEvent<T, TEventType<T>>;
|
|
18
|
+
type TListenerFunction<T extends {
|
|
19
|
+
type: string;
|
|
20
|
+
}, Type extends TEventType<T>> = (data: TEvent<T, Type>, isInit: boolean) => void;
|
|
21
|
+
export declare class WsEvents<T extends {
|
|
22
|
+
type: string;
|
|
23
|
+
}> {
|
|
24
|
+
private validate;
|
|
25
|
+
ws: IWsClient;
|
|
26
|
+
private _isDestroyed;
|
|
27
|
+
private listeners;
|
|
28
|
+
constructor(validate: TValidate<T>, ws: IWsClient);
|
|
29
|
+
get isDestroyed(): boolean;
|
|
30
|
+
resendInitData(): void;
|
|
31
|
+
addListener<Type extends TEventType<T>>(type: Type, listener: TListenerFunction<T, Type>, id: string): void;
|
|
32
|
+
removeListener<Type extends TEventType<T>>(type: Type, id: string): void;
|
|
33
|
+
private onMessage;
|
|
34
|
+
private processMessage;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FIRMWARE_WITH_BITRATE_MODES_SUPPORT = "11.11.73";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CamelCasedProperties, CamelCasedPropertiesDeep, SnakeCasedProperties, SnakeCasedPropertiesDeep } from 'type-fest';
|
|
2
|
+
export declare const toCamelCase: <T extends object>(o: T) => CamelCasedProperties<T>;
|
|
3
|
+
export declare const toCamelCaseDeep: <T extends object>(o: T) => CamelCasedPropertiesDeep<T>;
|
|
4
|
+
export declare const toSnakeCase: <T extends object>(o: T) => SnakeCasedProperties<T>;
|
|
5
|
+
export declare const toSnakeCaseDeep: <T extends object>(o: T) => SnakeCasedPropertiesDeep<T>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type Options = {
|
|
2
|
+
ip?: string;
|
|
3
|
+
port?: number;
|
|
4
|
+
user?: string;
|
|
5
|
+
pass?: string;
|
|
6
|
+
tls?: boolean;
|
|
7
|
+
tlsInsecure?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type HttpOptions = Options & {
|
|
10
|
+
keepAlive?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type TParameters = Record<string, string | number | boolean | null | undefined>;
|
|
13
|
+
export type TResponse = {
|
|
14
|
+
json: () => Promise<any>;
|
|
15
|
+
text: () => Promise<string>;
|
|
16
|
+
blob: () => Promise<unknown>;
|
|
17
|
+
status: number;
|
|
18
|
+
ok: boolean;
|
|
19
|
+
statusText: string;
|
|
20
|
+
};
|
|
21
|
+
export type TGetParams = {
|
|
22
|
+
path: string;
|
|
23
|
+
parameters?: TParameters;
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
timeout?: number;
|
|
26
|
+
};
|
|
27
|
+
export type TPostParams<Data> = {
|
|
28
|
+
path: string;
|
|
29
|
+
data: string | Data;
|
|
30
|
+
parameters?: TParameters;
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
timeout?: number;
|
|
33
|
+
};
|
|
34
|
+
export interface IClient<TRes extends TResponse, Data> {
|
|
35
|
+
get: (params: TGetParams) => Promise<TRes>;
|
|
36
|
+
post: (params: TPostParams<Data>) => Promise<TRes>;
|
|
37
|
+
}
|
|
38
|
+
export type TBlobResponse<Client extends IClient<TResponse, any>> = Awaited<ReturnType<Awaited<ReturnType<Client['get']>>['blob']>>;
|
|
39
|
+
export interface IWsClient {
|
|
40
|
+
onMessage: null | ((data: ArrayBuffer | string) => void);
|
|
41
|
+
onOpen: () => void;
|
|
42
|
+
onClose: () => void;
|
|
43
|
+
onError: (error: Error) => void;
|
|
44
|
+
send: (data: ArrayBuffer | string) => void;
|
|
45
|
+
reconnect: () => void;
|
|
46
|
+
destroy: () => void;
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TPlaylistPlayType } from '../types/CamSwitcherAPI';
|
|
2
|
+
import { TParameters } from './types';
|
|
3
|
+
export declare const addParametersToPath: (path: string, params?: TParameters) => string;
|
|
4
|
+
export declare const paramToUrl: (params?: TParameters) => string;
|
|
5
|
+
export declare const arrayToUrl: (arr: string | string[]) => string;
|
|
6
|
+
export declare const isCamera: (id?: string) => boolean;
|
|
7
|
+
export declare const isStream: (id?: string) => boolean;
|
|
8
|
+
export declare const isClip: (id?: string) => boolean;
|
|
9
|
+
export declare const isTracker: (id?: string) => boolean;
|
|
10
|
+
export declare const isPlaylist: (id?: string) => boolean;
|
|
11
|
+
export declare const isLoopPlayType: (playType: TPlaylistPlayType) => boolean;
|
|
12
|
+
export declare function pad(num: number, size: number): string;
|
|
13
|
+
export declare function isNullish<T>(value: T | undefined | null): value is undefined | null;
|
package/cjs/internal/utils.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isNullish = exports.pad = exports.
|
|
7
|
-
const zod_1 = __importDefault(require("zod"));
|
|
3
|
+
exports.isNullish = exports.pad = exports.isLoopPlayType = exports.isPlaylist = exports.isTracker = exports.isClip = exports.isStream = exports.isCamera = exports.arrayToUrl = exports.paramToUrl = exports.addParametersToPath = void 0;
|
|
8
4
|
const addParametersToPath = (path, params) => {
|
|
9
5
|
if (params === undefined || Object.keys(params).length === 0) {
|
|
10
6
|
return path;
|
|
@@ -47,17 +43,6 @@ const isPlaylist = (id) => id?.charAt(0) === 'p';
|
|
|
47
43
|
exports.isPlaylist = isPlaylist;
|
|
48
44
|
const isLoopPlayType = (playType) => playType.includes('LOOP');
|
|
49
45
|
exports.isLoopPlayType = isLoopPlayType;
|
|
50
|
-
async function responseStringify(res) {
|
|
51
|
-
return JSON.stringify({
|
|
52
|
-
status: res.status,
|
|
53
|
-
body: await res.text(),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.responseStringify = responseStringify;
|
|
57
|
-
exports.stringifiedResponseSchema = zod_1.default.object({
|
|
58
|
-
status: zod_1.default.number(),
|
|
59
|
-
body: zod_1.default.string(),
|
|
60
|
-
});
|
|
61
46
|
function pad(num, size) {
|
|
62
47
|
const sign = Math.sign(num) === -1 ? '-' : '';
|
|
63
48
|
return (sign +
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const assertVersionString: (s: string, msg?: string) => void;
|
|
2
|
+
export declare const isFirmwareVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
3
|
+
export declare const isVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
4
|
+
export declare const firmwareVersionCompare: (a: string, b: string) => 0 | 1 | -1;
|
|
5
|
+
export declare const versionCompare: (a: string, b: string) => 0 | 1 | -1;
|
|
6
|
+
export declare const fixVersionToDots: (version: string) => string;
|