camstreamerlib 4.0.0-beta.30 → 4.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/CamOverlayAPI.d.ts +3 -2
- package/cjs/CamOverlayAPI.js +8 -8
- package/cjs/CamScripterAPI.d.ts +3 -2
- package/cjs/CamScripterAPI.js +5 -5
- package/cjs/CamStreamerAPI.d.ts +3 -2
- package/cjs/CamStreamerAPI.js +4 -4
- package/cjs/CamSwitcherAPI.d.ts +3 -2
- package/cjs/CamSwitcherAPI.js +7 -7
- package/cjs/PlaneTrackerAPI.d.ts +3 -2
- package/cjs/PlaneTrackerAPI.js +15 -15
- package/cjs/VapixAPI.d.ts +3 -2
- package/cjs/VapixAPI.js +13 -13
- package/cjs/events/AxisCameraStationEvents.d.ts +4 -2
- package/cjs/events/AxisCameraStationEvents.js +4 -4
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +0 -2
- package/cjs/types/CamSwitcherAPI.d.ts +0 -2
- package/cjs/types/VapixAPI.d.ts +0 -2
- package/esm/CamOverlayAPI.d.ts +3 -2
- package/esm/CamOverlayAPI.js +8 -8
- package/esm/CamScripterAPI.d.ts +3 -2
- package/esm/CamScripterAPI.js +5 -5
- package/esm/CamStreamerAPI.d.ts +3 -2
- package/esm/CamStreamerAPI.js +4 -4
- package/esm/CamSwitcherAPI.d.ts +3 -2
- package/esm/CamSwitcherAPI.js +7 -7
- package/esm/PlaneTrackerAPI.d.ts +3 -2
- package/esm/PlaneTrackerAPI.js +15 -15
- package/esm/VapixAPI.d.ts +3 -2
- package/esm/VapixAPI.js +13 -13
- package/esm/events/AxisCameraStationEvents.d.ts +4 -2
- package/esm/events/AxisCameraStationEvents.js +4 -4
- package/esm/types/CamOverlayAPI/CamOverlayAPI.d.ts +0 -2
- package/esm/types/CamSwitcherAPI.d.ts +0 -2
- package/esm/types/VapixAPI.d.ts +0 -2
- package/package.json +1 -1
- package/cjs/node/WsEventClient.d.ts +0 -13
- package/cjs/node/WsEventClient.js +0 -22
- package/esm/node/WsEventClient.d.ts +0 -13
- package/esm/node/WsEventClient.js +0 -18
package/esm/CamOverlayAPI.js
CHANGED
|
@@ -24,6 +24,9 @@ export class CamOverlayAPI {
|
|
|
24
24
|
static getBasePath = () => BASE_PATH;
|
|
25
25
|
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
26
26
|
static getFilePreviewPath = (path) => `${BASE_PATH}/image.cgi?path=${encodeURIComponent(path)}`;
|
|
27
|
+
getClient(proxyParams) {
|
|
28
|
+
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
29
|
+
}
|
|
27
30
|
async checkCameraTime(options) {
|
|
28
31
|
const response = await this._get({ path: `${BASE_PATH}/camera_time.cgi` }, options);
|
|
29
32
|
return z.boolean().parse(response.state);
|
|
@@ -89,7 +92,7 @@ export class CamOverlayAPI {
|
|
|
89
92
|
await this._post({ path: `${BASE_PATH}/enabled.cgi?id_${serviceId}=${enabled ? 1 : 0}`, data: '' }, options);
|
|
90
93
|
}
|
|
91
94
|
async isEnabled(serviceId, options) {
|
|
92
|
-
const agent = this.
|
|
95
|
+
const agent = this.getClient(options?.proxyParams);
|
|
93
96
|
const res = await agent.get({ path: `${BASE_PATH}/services.cgi?action=get`, timeout: options?.timeout });
|
|
94
97
|
if (res.ok) {
|
|
95
98
|
const data = JSON.parse(await res.text());
|
|
@@ -186,7 +189,7 @@ export class CamOverlayAPI {
|
|
|
186
189
|
if (contentType !== undefined && data) {
|
|
187
190
|
headers = { 'Content-Type': contentType };
|
|
188
191
|
}
|
|
189
|
-
const agent = this.
|
|
192
|
+
const agent = this.getClient(options?.proxyParams);
|
|
190
193
|
const res = await agent.post({
|
|
191
194
|
path,
|
|
192
195
|
data: data ?? '',
|
|
@@ -203,7 +206,7 @@ export class CamOverlayAPI {
|
|
|
203
206
|
}
|
|
204
207
|
}
|
|
205
208
|
async _get(params, options) {
|
|
206
|
-
const agent = this.
|
|
209
|
+
const agent = this.getClient(options?.proxyParams);
|
|
207
210
|
const res = await agent.get({ ...params, timeout: options?.timeout });
|
|
208
211
|
if (res.ok) {
|
|
209
212
|
return (await res.json());
|
|
@@ -213,7 +216,7 @@ export class CamOverlayAPI {
|
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
218
|
async _post(params, options) {
|
|
216
|
-
const agent = this.
|
|
219
|
+
const agent = this.getClient(options?.proxyParams);
|
|
217
220
|
const res = await agent.post({ ...params, timeout: options?.timeout });
|
|
218
221
|
if (res.ok) {
|
|
219
222
|
return (await res.json());
|
|
@@ -223,7 +226,7 @@ export class CamOverlayAPI {
|
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
async _getBlob(params, options) {
|
|
226
|
-
const agent = this.
|
|
229
|
+
const agent = this.getClient(options?.proxyParams);
|
|
227
230
|
const res = await agent.get({ ...params, timeout: options?.timeout });
|
|
228
231
|
if (res.ok) {
|
|
229
232
|
return await this.parseBlobResponse(res);
|
|
@@ -249,7 +252,4 @@ export class CamOverlayAPI {
|
|
|
249
252
|
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
250
253
|
return this._post({ path, data, parameters, headers: { ...baseHeaders, ...headers } }, options);
|
|
251
254
|
}
|
|
252
|
-
getAgent(proxyParams) {
|
|
253
|
-
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
254
|
-
}
|
|
255
255
|
}
|
package/esm/CamScripterAPI.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { ProxyClient } from './internal/ProxyClient';
|
|
1
2
|
import { IClient, TResponse } from './internal/types';
|
|
2
3
|
import { TNodeState, TPackageInfoList, TStorage, TStorageType } from './types/CamScripterAPI';
|
|
3
|
-
import { THttpRequestOptions, TNetworkCamera } from './types/common';
|
|
4
|
+
import { THttpRequestOptions, TNetworkCamera, TProxyParams } from './types/common';
|
|
4
5
|
export declare class CamScripterAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
5
6
|
client: Client;
|
|
6
7
|
constructor(client: Client);
|
|
7
8
|
static getProxyUrlPath: () => string;
|
|
9
|
+
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
8
10
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
9
11
|
getNetworkCameraList(options?: THttpRequestOptions): Promise<TNetworkCamera[]>;
|
|
10
12
|
getStorageInfo(options?: THttpRequestOptions): Promise<TStorage>;
|
|
@@ -32,5 +34,4 @@ export declare class CamScripterAPI<Client extends IClient<TResponse> = IClient<
|
|
|
32
34
|
}>;
|
|
33
35
|
private get;
|
|
34
36
|
private post;
|
|
35
|
-
private getAgent;
|
|
36
37
|
}
|
package/esm/CamScripterAPI.js
CHANGED
|
@@ -9,6 +9,9 @@ export class CamScripterAPI {
|
|
|
9
9
|
this.client = client;
|
|
10
10
|
}
|
|
11
11
|
static getProxyUrlPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
12
|
+
getClient(proxyParams) {
|
|
13
|
+
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
14
|
+
}
|
|
12
15
|
async checkCameraTime(options) {
|
|
13
16
|
const data = await this.get(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
14
17
|
return cameraTimeResponseSchema.parse(data).state;
|
|
@@ -50,7 +53,7 @@ export class CamScripterAPI {
|
|
|
50
53
|
return camscripterApiResponseSchema.parse(data);
|
|
51
54
|
}
|
|
52
55
|
async get(path, parameters, options) {
|
|
53
|
-
const agent = this.
|
|
56
|
+
const agent = this.getClient(options?.proxyParams);
|
|
54
57
|
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
55
58
|
if (res.ok) {
|
|
56
59
|
return await res.json();
|
|
@@ -60,7 +63,7 @@ export class CamScripterAPI {
|
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
async post(path, data, parameters, options) {
|
|
63
|
-
const agent = this.
|
|
66
|
+
const agent = this.getClient(options?.proxyParams);
|
|
64
67
|
const res = await agent.post({ path, data, parameters, timeout: options?.timeout });
|
|
65
68
|
if (res.ok) {
|
|
66
69
|
return await res.json();
|
|
@@ -69,7 +72,4 @@ export class CamScripterAPI {
|
|
|
69
72
|
throw new Error(await responseStringify(res));
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
|
-
getAgent(proxyParams) {
|
|
73
|
-
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
74
|
-
}
|
|
75
75
|
}
|
package/esm/CamStreamerAPI.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { ProxyClient } from './internal/ProxyClient';
|
|
1
2
|
import { IClient, TResponse } from './internal/types';
|
|
2
3
|
import { TStreamAttributes, TStreamList } from './types/CamStreamerAPI';
|
|
3
|
-
import { THttpRequestOptions } from './types/common';
|
|
4
|
+
import { THttpRequestOptions, TProxyParams } from './types/common';
|
|
4
5
|
export declare class CamStreamerAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
5
6
|
client: Client;
|
|
6
7
|
constructor(client: Client);
|
|
8
|
+
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
7
9
|
getStreamList(options?: THttpRequestOptions): Promise<TStreamList>;
|
|
8
10
|
getStream(streamId: string, options?: THttpRequestOptions): Promise<TStreamAttributes>;
|
|
9
11
|
getStreamParameter(streamId: string, paramName: string, options?: THttpRequestOptions): Promise<string>;
|
|
@@ -14,5 +16,4 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse> = IClient<
|
|
|
14
16
|
wsAuthorization(options?: THttpRequestOptions): Promise<string>;
|
|
15
17
|
getUtcTime(options?: THttpRequestOptions): Promise<number>;
|
|
16
18
|
private get;
|
|
17
|
-
private getAgent;
|
|
18
19
|
}
|
package/esm/CamStreamerAPI.js
CHANGED
|
@@ -7,6 +7,9 @@ export class CamStreamerAPI {
|
|
|
7
7
|
constructor(client) {
|
|
8
8
|
this.client = client;
|
|
9
9
|
}
|
|
10
|
+
getClient(proxyParams) {
|
|
11
|
+
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
12
|
+
}
|
|
10
13
|
async getStreamList(options) {
|
|
11
14
|
const streamListRes = await this.get(`${BASE_PATH}/stream/list.cgi`, undefined, options);
|
|
12
15
|
return streamListSchema.parse(streamListRes.data);
|
|
@@ -46,7 +49,7 @@ export class CamStreamerAPI {
|
|
|
46
49
|
return await this.get(`${BASE_PATH}/get_utc_time.cgi`, undefined, options);
|
|
47
50
|
}
|
|
48
51
|
async get(path, parameters, options) {
|
|
49
|
-
const agent = this.
|
|
52
|
+
const agent = this.getClient(options?.proxyParams);
|
|
50
53
|
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
51
54
|
if (res.ok) {
|
|
52
55
|
return await res.json();
|
|
@@ -55,7 +58,4 @@ export class CamStreamerAPI {
|
|
|
55
58
|
throw new Error(await responseStringify(res));
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
getAgent(proxyParams) {
|
|
59
|
-
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
60
|
-
}
|
|
61
61
|
}
|
package/esm/CamSwitcherAPI.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IClient, TResponse } from './internal/types';
|
|
2
2
|
import { TAudioPushInfo, TOutputInfo, TStorageInfo, TStreamSaveList, TClipList, TStreamSaveLoadList, TClipSaveLoadList, TPlaylistSaveLoadList, TTrackerSaveList, TrackerSaveLoadList, TClipSaveList, TPlaylistSaveList, TCameraOptions, TGlobalAudioSettings, TSecondaryAudioSettings } from './types/CamSwitcherAPI';
|
|
3
|
-
import { TAudioChannel, THttpRequestOptions, TNetworkCamera, TStorageType } from './types/common';
|
|
3
|
+
import { TAudioChannel, THttpRequestOptions, TNetworkCamera, TProxyParams, TStorageType } from './types/common';
|
|
4
|
+
import { ProxyClient } from './internal/ProxyClient';
|
|
4
5
|
export declare class CamSwitcherAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
5
6
|
client: Client;
|
|
6
7
|
private CustomFormData;
|
|
@@ -12,6 +13,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse> = IClient<
|
|
|
12
13
|
static getProxyUrlPath: () => string;
|
|
13
14
|
static getWsEventsUrlPath: () => string;
|
|
14
15
|
static getClipPreviewUrlPath: (id: string, storage: TStorageType) => string;
|
|
16
|
+
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
15
17
|
generateSilence(sampleRate: number, channels: TAudioChannel, options?: THttpRequestOptions): Promise<void>;
|
|
16
18
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
17
19
|
getNetworkCameraList(options?: THttpRequestOptions): Promise<TNetworkCamera[]>;
|
|
@@ -49,5 +51,4 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse> = IClient<
|
|
|
49
51
|
private set;
|
|
50
52
|
private setParamFromCameraJSON;
|
|
51
53
|
private getParamFromCameraAndJSONParse;
|
|
52
|
-
private getAgent;
|
|
53
54
|
}
|
package/esm/CamSwitcherAPI.js
CHANGED
|
@@ -20,8 +20,11 @@ export class CamSwitcherAPI {
|
|
|
20
20
|
static getProxyUrlPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
21
21
|
static getWsEventsUrlPath = () => `/local/camswitcher/events`;
|
|
22
22
|
static getClipPreviewUrlPath = (id, storage) => `${BASE_PATH}/clip_preview.cgi?clip_name=${id}&storage=${storage}`;
|
|
23
|
+
getClient(proxyParams) {
|
|
24
|
+
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
25
|
+
}
|
|
23
26
|
async generateSilence(sampleRate, channels, options) {
|
|
24
|
-
const agent = this.
|
|
27
|
+
const agent = this.getClient(options?.proxyParams);
|
|
25
28
|
await agent.get({
|
|
26
29
|
path: `${BASE_PATH}/generate_silence.cgi`,
|
|
27
30
|
parameters: {
|
|
@@ -111,7 +114,7 @@ export class CamSwitcherAPI {
|
|
|
111
114
|
formData.append('clip_name', id);
|
|
112
115
|
formData.append('clip_type', clipType);
|
|
113
116
|
formData.append('file', file, fileName);
|
|
114
|
-
const agent = this.
|
|
117
|
+
const agent = this.getClient(options?.proxyParams);
|
|
115
118
|
const res = await agent.post({ path, data: formData, timeout: options?.timeout });
|
|
116
119
|
const output = (await res.json());
|
|
117
120
|
if (output.status !== 200) {
|
|
@@ -244,7 +247,7 @@ export class CamSwitcherAPI {
|
|
|
244
247
|
return res[paramName] ?? '';
|
|
245
248
|
}
|
|
246
249
|
async get(path, parameters, options) {
|
|
247
|
-
const agent = this.
|
|
250
|
+
const agent = this.getClient(options?.proxyParams);
|
|
248
251
|
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
249
252
|
if (res.ok) {
|
|
250
253
|
const d = (await res.json());
|
|
@@ -255,7 +258,7 @@ export class CamSwitcherAPI {
|
|
|
255
258
|
}
|
|
256
259
|
}
|
|
257
260
|
async set(path, data, parameters, options) {
|
|
258
|
-
const agent = this.
|
|
261
|
+
const agent = this.getClient(options?.proxyParams);
|
|
259
262
|
const res = await agent.post({ path, data: JSON.stringify(data), parameters, timeout: options?.timeout });
|
|
260
263
|
if (res.ok) {
|
|
261
264
|
const parsed = await res.json();
|
|
@@ -287,9 +290,6 @@ export class CamSwitcherAPI {
|
|
|
287
290
|
}
|
|
288
291
|
throw new Error("Error: no parametr '" + paramName + "' was found");
|
|
289
292
|
}
|
|
290
|
-
getAgent(proxyParams) {
|
|
291
|
-
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
292
|
-
}
|
|
293
293
|
}
|
|
294
294
|
const CSW_PARAM_NAMES = {
|
|
295
295
|
SETTINGS: 'Camswitcher.Settings',
|
package/esm/PlaneTrackerAPI.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { IClient, TBlobResponse, TParameters, TResponse } from './internal/types';
|
|
2
2
|
import { ICAO, TApiUser, TExportDataType, TImportDataType } from './types/PlaneTrackerAPI';
|
|
3
|
-
import { THttpRequestOptions } from './types/common';
|
|
3
|
+
import { THttpRequestOptions, TProxyParams } from './types/common';
|
|
4
|
+
import { ProxyClient } from './internal/ProxyClient';
|
|
4
5
|
export declare class PlaneTrackerAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
5
6
|
private client;
|
|
6
7
|
private apiUser;
|
|
7
8
|
constructor(client: Client, apiUser: TApiUser);
|
|
8
9
|
static getProxyUrlPath: () => string;
|
|
10
|
+
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
9
11
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
10
12
|
resetPtzCalibration: (options?: THttpRequestOptions) => Promise<TResponse>;
|
|
11
13
|
resetFocusCalibration: (options?: THttpRequestOptions) => Promise<TResponse>;
|
|
@@ -38,5 +40,4 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse> = IClient
|
|
|
38
40
|
private parseBlobResponse;
|
|
39
41
|
private _postJsonEncoded;
|
|
40
42
|
private _postUrlEncoded;
|
|
41
|
-
private getAgent;
|
|
42
43
|
}
|
package/esm/PlaneTrackerAPI.js
CHANGED
|
@@ -11,12 +11,15 @@ export class PlaneTrackerAPI {
|
|
|
11
11
|
this.apiUser = apiUser;
|
|
12
12
|
}
|
|
13
13
|
static getProxyUrlPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
14
|
+
getClient(proxyParams) {
|
|
15
|
+
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
16
|
+
}
|
|
14
17
|
async checkCameraTime(options) {
|
|
15
18
|
const response = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
16
19
|
return z.boolean().parse(response.state);
|
|
17
20
|
}
|
|
18
21
|
resetPtzCalibration = async (options) => {
|
|
19
|
-
const agent = this.
|
|
22
|
+
const agent = this.getClient(options?.proxyParams);
|
|
20
23
|
return await agent.get({
|
|
21
24
|
path: `${BASE_PATH}/package/resetPtzCalibration.cgi`,
|
|
22
25
|
parameters: this.apiUser,
|
|
@@ -24,7 +27,7 @@ export class PlaneTrackerAPI {
|
|
|
24
27
|
});
|
|
25
28
|
};
|
|
26
29
|
resetFocusCalibration = async (options) => {
|
|
27
|
-
const agent = this.
|
|
30
|
+
const agent = this.getClient(options?.proxyParams);
|
|
28
31
|
return await agent.get({
|
|
29
32
|
path: `${BASE_PATH}/package/resetFocusCalibration.cgi`,
|
|
30
33
|
parameters: this.apiUser,
|
|
@@ -32,11 +35,11 @@ export class PlaneTrackerAPI {
|
|
|
32
35
|
});
|
|
33
36
|
};
|
|
34
37
|
serverRunCheck = async (options) => {
|
|
35
|
-
const agent = this.
|
|
38
|
+
const agent = this.getClient(options?.proxyParams);
|
|
36
39
|
return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
|
|
37
40
|
};
|
|
38
41
|
getLiveViewAlias = async (rtspUrl, options) => {
|
|
39
|
-
const agent = this.
|
|
42
|
+
const agent = this.getClient(options?.proxyParams);
|
|
40
43
|
return await agent.get({
|
|
41
44
|
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
42
45
|
parameters: { rtsp_url: rtspUrl },
|
|
@@ -58,7 +61,7 @@ export class PlaneTrackerAPI {
|
|
|
58
61
|
return await this._getBlob(`${BASE_PATH}/package_data.cgi`, { action: 'EXPORT', dataType }, options);
|
|
59
62
|
};
|
|
60
63
|
importAppSettings = async (dataType, formData, options) => {
|
|
61
|
-
const agent = this.
|
|
64
|
+
const agent = this.getClient(options?.proxyParams);
|
|
62
65
|
return await agent.post({
|
|
63
66
|
path: `${BASE_PATH}/package_data.cgi`,
|
|
64
67
|
data: formData,
|
|
@@ -76,7 +79,7 @@ export class PlaneTrackerAPI {
|
|
|
76
79
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, modeJsonString, this.apiUser, options);
|
|
77
80
|
};
|
|
78
81
|
startTrackingPlane = async (icao, options) => {
|
|
79
|
-
const agent = this.
|
|
82
|
+
const agent = this.getClient(options?.proxyParams);
|
|
80
83
|
return await agent.get({
|
|
81
84
|
path: `${BASE_PATH}/package/trackIcao.cgi`,
|
|
82
85
|
parameters: { icao, ...this.apiUser },
|
|
@@ -84,7 +87,7 @@ export class PlaneTrackerAPI {
|
|
|
84
87
|
});
|
|
85
88
|
};
|
|
86
89
|
stopTrackingPlane = async (options) => {
|
|
87
|
-
const agent = this.
|
|
90
|
+
const agent = this.getClient(options?.proxyParams);
|
|
88
91
|
return await agent.get({
|
|
89
92
|
path: `${BASE_PATH}/package/resetIcao.cgi`,
|
|
90
93
|
parameters: this.apiUser,
|
|
@@ -119,7 +122,7 @@ export class PlaneTrackerAPI {
|
|
|
119
122
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setZones.cgi`, zonesJsonString, this.apiUser, options);
|
|
120
123
|
};
|
|
121
124
|
goToCoordinates = async (lat, lon, alt, options) => {
|
|
122
|
-
const agent = this.
|
|
125
|
+
const agent = this.getClient(options?.proxyParams);
|
|
123
126
|
return await agent.get({
|
|
124
127
|
path: `${BASE_PATH}/package/goToCoordinates.cgi`,
|
|
125
128
|
parameters: { lat, lon, alt, ...this.apiUser },
|
|
@@ -134,7 +137,7 @@ export class PlaneTrackerAPI {
|
|
|
134
137
|
return await res.json();
|
|
135
138
|
};
|
|
136
139
|
async _getJson(path, parameters, options) {
|
|
137
|
-
const agent = this.
|
|
140
|
+
const agent = this.getClient(options?.proxyParams);
|
|
138
141
|
const res = await agent.get({
|
|
139
142
|
path,
|
|
140
143
|
parameters,
|
|
@@ -148,7 +151,7 @@ export class PlaneTrackerAPI {
|
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
async _getBlob(path, parameters, options) {
|
|
151
|
-
const agent = this.
|
|
154
|
+
const agent = this.getClient(options?.proxyParams);
|
|
152
155
|
const res = await agent.get({
|
|
153
156
|
path,
|
|
154
157
|
parameters,
|
|
@@ -170,7 +173,7 @@ export class PlaneTrackerAPI {
|
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
async _postJsonEncoded(path, data, parameters, options) {
|
|
173
|
-
const agent = this.
|
|
176
|
+
const agent = this.getClient(options?.proxyParams);
|
|
174
177
|
const res = await agent.post({
|
|
175
178
|
path,
|
|
176
179
|
data,
|
|
@@ -187,7 +190,7 @@ export class PlaneTrackerAPI {
|
|
|
187
190
|
}
|
|
188
191
|
async _postUrlEncoded(path, params, options) {
|
|
189
192
|
const data = paramToUrl(params);
|
|
190
|
-
const agent = this.
|
|
193
|
+
const agent = this.getClient(options?.proxyParams);
|
|
191
194
|
const res = await agent.post({
|
|
192
195
|
path,
|
|
193
196
|
data,
|
|
@@ -201,7 +204,4 @@ export class PlaneTrackerAPI {
|
|
|
201
204
|
throw new Error(await responseStringify(res));
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
|
-
getAgent(proxyParams) {
|
|
205
|
-
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
206
|
-
}
|
|
207
207
|
}
|
package/esm/VapixAPI.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
2
|
import { TAudioSampleRates, TSDCardInfo, TPtzOverview, TCameraPTZItem, TCameraPTZItemData, TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
|
|
3
|
-
import {
|
|
3
|
+
import { ProxyClient } from './internal/ProxyClient';
|
|
4
|
+
import { TCameraImageConfig, THttpRequestOptions, TProxyParams } from './types/common';
|
|
4
5
|
export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
|
|
5
6
|
private client;
|
|
6
7
|
constructor(client: Client);
|
|
8
|
+
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
7
9
|
postUrlEncoded(path: string, parameters?: TParameters, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
|
|
8
10
|
postJson(path: string, jsonData: Record<string, any>, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
|
|
9
11
|
getCameraImage(parameters: TCameraImageConfig, options?: THttpRequestOptions): Promise<TResponse>;
|
|
@@ -75,5 +77,4 @@ export declare class VapixAPI<Client extends IClient<TResponse> = IClient<TRespo
|
|
|
75
77
|
private static parseParameters;
|
|
76
78
|
private static parseCameraPtzResponse;
|
|
77
79
|
private static parsePtz;
|
|
78
|
-
private getAgent;
|
|
79
80
|
}
|
package/esm/VapixAPI.js
CHANGED
|
@@ -10,10 +10,13 @@ export class VapixAPI {
|
|
|
10
10
|
constructor(client) {
|
|
11
11
|
this.client = client;
|
|
12
12
|
}
|
|
13
|
+
getClient(proxyParams) {
|
|
14
|
+
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
15
|
+
}
|
|
13
16
|
async postUrlEncoded(path, parameters, headers, options) {
|
|
14
17
|
const data = paramToUrl(parameters);
|
|
15
18
|
const head = { ...headers, 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
16
|
-
const agent = this.
|
|
19
|
+
const agent = this.getClient(options?.proxyParams);
|
|
17
20
|
const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
|
|
18
21
|
if (!res.ok) {
|
|
19
22
|
throw new Error(await responseStringify(res));
|
|
@@ -23,7 +26,7 @@ export class VapixAPI {
|
|
|
23
26
|
async postJson(path, jsonData, headers, options) {
|
|
24
27
|
const data = JSON.stringify(jsonData);
|
|
25
28
|
const head = { ...headers, 'Content-Type': 'application/json' };
|
|
26
|
-
const agent = this.
|
|
29
|
+
const agent = this.getClient(options?.proxyParams);
|
|
27
30
|
const res = await agent.post({ path, data, headers: head, timeout: options?.timeout });
|
|
28
31
|
if (!res.ok) {
|
|
29
32
|
throw new Error(await responseStringify(res));
|
|
@@ -31,7 +34,7 @@ export class VapixAPI {
|
|
|
31
34
|
return res;
|
|
32
35
|
}
|
|
33
36
|
async getCameraImage(parameters, options) {
|
|
34
|
-
const agent = this.
|
|
37
|
+
const agent = this.getClient(options?.proxyParams);
|
|
35
38
|
return await agent.get({ path: '/axis-cgi/jpg/image.cgi', parameters, timeout: options?.timeout });
|
|
36
39
|
}
|
|
37
40
|
async getEventDeclarations(options) {
|
|
@@ -41,7 +44,7 @@ export class VapixAPI {
|
|
|
41
44
|
'<GetEventInstances xmlns="http://www.axis.com/vapix/ws/event1"/>' +
|
|
42
45
|
'</s:Body>' +
|
|
43
46
|
'</s:Envelope>';
|
|
44
|
-
const agent = this.
|
|
47
|
+
const agent = this.getClient(options?.proxyParams);
|
|
45
48
|
const res = await agent.post({
|
|
46
49
|
path: '/vapix/services',
|
|
47
50
|
data,
|
|
@@ -177,7 +180,7 @@ export class VapixAPI {
|
|
|
177
180
|
}
|
|
178
181
|
async getTimezone(options) {
|
|
179
182
|
try {
|
|
180
|
-
const agent = this.
|
|
183
|
+
const agent = this.getClient(options?.proxyParams);
|
|
181
184
|
const resV2 = await agent.get({ path: '/config/rest/time/v2/timeZone', timeout: options?.timeout });
|
|
182
185
|
if (!resV2.ok) {
|
|
183
186
|
throw new Error(await responseStringify(resV2));
|
|
@@ -386,7 +389,7 @@ export class VapixAPI {
|
|
|
386
389
|
}, undefined, options);
|
|
387
390
|
}
|
|
388
391
|
async getApplicationList(options) {
|
|
389
|
-
const agent = this.
|
|
392
|
+
const agent = this.getClient(options?.proxyParams);
|
|
390
393
|
const res = await agent.get({ path: '/axis-cgi/applications/list.cgi', timeout: options?.timeout });
|
|
391
394
|
const xml = await res.text();
|
|
392
395
|
const parser = new XMLParser({
|
|
@@ -407,7 +410,7 @@ export class VapixAPI {
|
|
|
407
410
|
});
|
|
408
411
|
}
|
|
409
412
|
async startApplication(applicationID, options) {
|
|
410
|
-
const agent = this.
|
|
413
|
+
const agent = this.getClient(options?.proxyParams);
|
|
411
414
|
const res = await agent.get({
|
|
412
415
|
path: '/axis-cgi/applications/control.cgi',
|
|
413
416
|
parameters: {
|
|
@@ -422,7 +425,7 @@ export class VapixAPI {
|
|
|
422
425
|
}
|
|
423
426
|
}
|
|
424
427
|
async restartApplication(applicationID, options) {
|
|
425
|
-
const agent = this.
|
|
428
|
+
const agent = this.getClient(options?.proxyParams);
|
|
426
429
|
const res = await agent.get({
|
|
427
430
|
path: '/axis-cgi/applications/control.cgi',
|
|
428
431
|
parameters: {
|
|
@@ -437,7 +440,7 @@ export class VapixAPI {
|
|
|
437
440
|
}
|
|
438
441
|
}
|
|
439
442
|
async stopApplication(applicationID, options) {
|
|
440
|
-
const agent = this.
|
|
443
|
+
const agent = this.getClient(options?.proxyParams);
|
|
441
444
|
const res = await agent.get({
|
|
442
445
|
path: '/axis-cgi/applications/control.cgi',
|
|
443
446
|
parameters: {
|
|
@@ -454,7 +457,7 @@ export class VapixAPI {
|
|
|
454
457
|
async installApplication(data, fileName, options) {
|
|
455
458
|
const formData = new FormData();
|
|
456
459
|
formData.append('packfil', data, fileName);
|
|
457
|
-
const agent = this.
|
|
460
|
+
const agent = this.getClient(options?.proxyParams);
|
|
458
461
|
const res = await agent.post({
|
|
459
462
|
path: '/axis-cgi/applications/upload.cgi',
|
|
460
463
|
data: formData,
|
|
@@ -537,7 +540,4 @@ export class VapixAPI {
|
|
|
537
540
|
});
|
|
538
541
|
return res;
|
|
539
542
|
};
|
|
540
|
-
getAgent(proxyParams) {
|
|
541
|
-
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
542
|
-
}
|
|
543
543
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { HttpOptions } from '../internal/types';
|
|
2
|
-
import { THttpRequestOptions } from '../types/common';
|
|
2
|
+
import { THttpRequestOptions, TProxyParams } from '../types/common';
|
|
3
|
+
import { ProxyClient } from '../internal/ProxyClient';
|
|
4
|
+
import { DefaultClient } from '../node';
|
|
3
5
|
export declare class AxisCameraStationEvents {
|
|
4
6
|
private sourceKey;
|
|
5
7
|
private client;
|
|
6
8
|
constructor(clientOptions: HttpOptions, sourceKey: string);
|
|
9
|
+
getClient(proxyParams?: TProxyParams): DefaultClient | ProxyClient<DefaultClient>;
|
|
7
10
|
sendEvent(data: Record<string, string>, eventType: string, options?: THttpRequestOptions): Promise<void>;
|
|
8
11
|
private getDate;
|
|
9
|
-
private getAgent;
|
|
10
12
|
}
|
|
@@ -8,6 +8,9 @@ export class AxisCameraStationEvents {
|
|
|
8
8
|
this.sourceKey = sourceKey;
|
|
9
9
|
this.client = new DefaultClient(clientOptions);
|
|
10
10
|
}
|
|
11
|
+
getClient(proxyParams) {
|
|
12
|
+
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
13
|
+
}
|
|
11
14
|
async sendEvent(data, eventType, options) {
|
|
12
15
|
const dateString = this.getDate();
|
|
13
16
|
const event = {
|
|
@@ -19,7 +22,7 @@ export class AxisCameraStationEvents {
|
|
|
19
22
|
},
|
|
20
23
|
};
|
|
21
24
|
const eventData = JSON.stringify(event);
|
|
22
|
-
const agent = this.
|
|
25
|
+
const agent = this.getClient(options?.proxyParams);
|
|
23
26
|
const res = await agent.post({
|
|
24
27
|
path: '/Acs/Api/ExternalDataFacade/AddExternalData',
|
|
25
28
|
data: eventData,
|
|
@@ -43,7 +46,4 @@ export class AxisCameraStationEvents {
|
|
|
43
46
|
const seconds = pad(date.getUTCSeconds(), 2);
|
|
44
47
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
45
48
|
}
|
|
46
|
-
getAgent(proxyParams) {
|
|
47
|
-
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
48
|
-
}
|
|
49
49
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { HttpOptions } from '../internal/types';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import { TH264Profile, TAudioChannelCount, TKeyboardShortcut } from './common';
|
|
4
|
-
export type CamSwitcherAPIOptions = HttpOptions;
|
|
5
3
|
declare const channelTypeSchema: z.ZodUnion<[z.ZodLiteral<"audio">, z.ZodLiteral<"video">, z.ZodLiteral<"av">]>;
|
|
6
4
|
export type TChannelType = z.infer<typeof channelTypeSchema>;
|
|
7
5
|
declare const playlistPlayTypeSchema: z.ZodUnion<[z.ZodLiteral<"PLAY_ALL">, z.ZodLiteral<"PLAY_ALL_LOOP">, z.ZodLiteral<"PLAY_ALL_SHUFFLED">, z.ZodLiteral<"PLAY_ALL_LOOP_SHUFFLED">, z.ZodLiteral<"PLAY_ONE_RANDOM">]>;
|
package/esm/types/VapixAPI.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IWebsocket } from '../internal/types';
|
|
2
|
-
import { WsClientOptions } from './WsClient';
|
|
3
|
-
type TEvent = {
|
|
4
|
-
data: string;
|
|
5
|
-
};
|
|
6
|
-
export declare class WsEventClient implements IWebsocket<TEvent> {
|
|
7
|
-
private wsClient;
|
|
8
|
-
constructor(options: WsClientOptions);
|
|
9
|
-
send: (data: string) => void;
|
|
10
|
-
destroy: () => void;
|
|
11
|
-
onmessage: ((event: TEvent) => void) | null;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WsEventClient = void 0;
|
|
4
|
-
const WsClient_1 = require("./WsClient");
|
|
5
|
-
class WsEventClient {
|
|
6
|
-
wsClient;
|
|
7
|
-
constructor(options) {
|
|
8
|
-
this.wsClient = new WsClient_1.WsClient(options);
|
|
9
|
-
this.wsClient.on('message', (data) => {
|
|
10
|
-
this.onmessage?.({ data: data.toString() });
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
send = (data) => {
|
|
14
|
-
this.wsClient.send(data);
|
|
15
|
-
};
|
|
16
|
-
destroy = () => {
|
|
17
|
-
this.wsClient.close();
|
|
18
|
-
this.onmessage = null;
|
|
19
|
-
};
|
|
20
|
-
onmessage = null;
|
|
21
|
-
}
|
|
22
|
-
exports.WsEventClient = WsEventClient;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IWebsocket } from '../internal/types';
|
|
2
|
-
import { WsClientOptions } from './WsClient';
|
|
3
|
-
type TEvent = {
|
|
4
|
-
data: string;
|
|
5
|
-
};
|
|
6
|
-
export declare class WsEventClient implements IWebsocket<TEvent> {
|
|
7
|
-
private wsClient;
|
|
8
|
-
constructor(options: WsClientOptions);
|
|
9
|
-
send: (data: string) => void;
|
|
10
|
-
destroy: () => void;
|
|
11
|
-
onmessage: ((event: TEvent) => void) | null;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { WsClient } from './WsClient';
|
|
2
|
-
export class WsEventClient {
|
|
3
|
-
wsClient;
|
|
4
|
-
constructor(options) {
|
|
5
|
-
this.wsClient = new WsClient(options);
|
|
6
|
-
this.wsClient.on('message', (data) => {
|
|
7
|
-
this.onmessage?.({ data: data.toString() });
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
send = (data) => {
|
|
11
|
-
this.wsClient.send(data);
|
|
12
|
-
};
|
|
13
|
-
destroy = () => {
|
|
14
|
-
this.wsClient.close();
|
|
15
|
-
this.onmessage = null;
|
|
16
|
-
};
|
|
17
|
-
onmessage = null;
|
|
18
|
-
}
|