camstreamerlib 4.0.0-beta.97 → 4.0.1
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 +44 -15
- package/cjs/CamOverlayAPI.d.ts +147 -109
- package/cjs/CamOverlayAPI.js +14 -63
- package/cjs/CamScripterAPI.d.ts +5 -8
- package/cjs/CamScripterAPI.js +11 -29
- package/cjs/CamStreamerAPI.d.ts +2745 -589
- package/cjs/CamStreamerAPI.js +68 -76
- package/cjs/CamSwitcherAPI.d.ts +23 -22
- package/cjs/CamSwitcherAPI.js +30 -88
- package/cjs/PlaneTrackerAPI.d.ts +28 -30
- package/cjs/PlaneTrackerAPI.js +20 -75
- package/cjs/VapixAPI.d.ts +36 -23
- package/cjs/VapixAPI.js +227 -106
- package/cjs/errors/errors.d.ts +11 -5
- package/cjs/errors/errors.js +5 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -0
- package/cjs/internal/BasicAPI.d.ts +15 -0
- package/cjs/internal/BasicAPI.js +93 -0
- package/cjs/internal/WsEvents.d.ts +1 -0
- package/cjs/internal/WsEvents.js +5 -0
- package/cjs/internal/constants.d.ts +1 -0
- package/cjs/internal/constants.js +2 -1
- package/cjs/internal/convertors.d.ts +6 -0
- package/cjs/internal/convertors.js +115 -0
- package/cjs/internal/transformers.js +8 -8
- package/cjs/internal/types.d.ts +3 -0
- package/cjs/internal/versionCompare.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +894 -374
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +54 -11
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +40 -40
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.js +21 -0
- package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/index.d.ts +1 -0
- package/cjs/types/CamOverlayAPI/index.js +1 -0
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/cjs/types/CamScripterAPI.d.ts +0 -11
- package/cjs/types/CamScripterAPI.js +1 -5
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +19642 -3073
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +126 -57
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +434 -52
- package/cjs/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/cjs/types/CamStreamerAPI/index.d.ts +1 -3
- package/cjs/types/CamStreamerAPI/index.js +1 -3
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/cjs/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +430 -219
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +116 -58
- package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +394 -52
- package/cjs/types/CamStreamerAPI/windySchema.js +9 -1
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +402 -52
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +12 -1
- package/cjs/types/CamSwitcherAPI.d.ts +96 -91
- package/cjs/types/CamSwitcherAPI.js +9 -9
- package/cjs/types/GenetecAgent.d.ts +2 -2
- package/cjs/types/PlaneTrackerAPI.d.ts +60 -47
- package/cjs/types/PlaneTrackerAPI.js +5 -2
- package/cjs/types/VapixAPI.d.ts +51 -32
- package/cjs/types/VapixAPI.js +10 -3
- package/cjs/types/common.d.ts +27 -0
- package/cjs/types/common.js +13 -1
- package/cjs/types/ws/CamStreamerEvents.d.ts +110 -77
- package/cjs/types/ws/CamStreamerEvents.js +11 -7
- package/cjs/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/esm/CamOverlayAPI.js +16 -65
- package/esm/CamScripterAPI.js +9 -30
- package/esm/CamStreamerAPI.js +70 -78
- package/esm/CamSwitcherAPI.js +31 -89
- package/esm/PlaneTrackerAPI.js +21 -76
- package/esm/VapixAPI.js +228 -107
- package/esm/errors/errors.js +5 -1
- package/esm/index.js +1 -0
- package/esm/internal/BasicAPI.js +89 -0
- package/esm/internal/WsEvents.js +5 -0
- package/esm/internal/constants.js +1 -0
- package/esm/internal/convertors.js +108 -0
- package/esm/internal/transformers.js +1 -1
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +47 -10
- package/esm/types/CamOverlayAPI/htmlOverlaySchema.js +18 -0
- package/esm/types/CamOverlayAPI/index.js +1 -0
- package/esm/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/esm/types/CamScripterAPI.js +0 -4
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +109 -41
- package/esm/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/esm/types/CamStreamerAPI/index.js +1 -3
- package/esm/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +116 -58
- package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
- package/esm/types/CamStreamerAPI/windySchema.js +9 -1
- package/esm/types/CamStreamerAPI/youtubeSchema.js +12 -1
- package/esm/types/CamSwitcherAPI.js +8 -8
- package/esm/types/PlaneTrackerAPI.js +5 -2
- package/esm/types/VapixAPI.js +9 -2
- package/esm/types/common.js +12 -0
- package/esm/types/ws/CamStreamerEvents.js +11 -7
- package/package.json +4 -4
- package/types/CamOverlayAPI.d.ts +147 -109
- package/types/CamScripterAPI.d.ts +5 -8
- package/types/CamStreamerAPI.d.ts +2745 -589
- package/types/CamSwitcherAPI.d.ts +23 -22
- package/types/PlaneTrackerAPI.d.ts +28 -30
- package/types/VapixAPI.d.ts +36 -23
- package/types/errors/errors.d.ts +11 -5
- package/types/index.d.ts +1 -0
- package/types/internal/BasicAPI.d.ts +15 -0
- package/types/internal/WsEvents.d.ts +1 -0
- package/types/internal/constants.d.ts +1 -0
- package/types/internal/convertors.d.ts +6 -0
- package/types/internal/types.d.ts +3 -0
- package/types/internal/versionCompare.d.ts +2 -2
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +894 -374
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +40 -40
- package/types/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/index.d.ts +1 -0
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/types/types/CamScripterAPI.d.ts +0 -11
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +19642 -3073
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +434 -52
- package/types/types/CamStreamerAPI/index.d.ts +1 -3
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +430 -219
- package/types/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +394 -52
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +402 -52
- package/types/types/CamSwitcherAPI.d.ts +96 -91
- package/types/types/GenetecAgent.d.ts +2 -2
- package/types/types/PlaneTrackerAPI.d.ts +60 -47
- package/types/types/VapixAPI.d.ts +51 -32
- package/types/types/common.d.ts +27 -0
- package/types/types/ws/CamStreamerEvents.d.ts +110 -77
- package/types/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/types/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/cjs/types/CamStreamerAPI/churchSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/churchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/daCastSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/dailymotionSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/gameChangerSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/hlsPullSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/hlsPushSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/ibmSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -250
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +0 -27
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +0 -211
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +0 -14
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/sdCardSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/srtSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/srtSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/twitchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/vimeoSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/wowzaSchema.js +0 -11
- package/esm/types/CamStreamerAPI/churchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/daCastSchema.js +0 -5
- package/esm/types/CamStreamerAPI/dailymotionSchema.js +0 -5
- package/esm/types/CamStreamerAPI/gameChangerSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPullSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPushSchema.js +0 -5
- package/esm/types/CamStreamerAPI/ibmSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftAzureSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftStreamSchema.js +0 -5
- package/esm/types/CamStreamerAPI/mpegDvbSchema.js +0 -21
- package/esm/types/CamStreamerAPI/rtmpSchema.js +0 -8
- package/esm/types/CamStreamerAPI/sdCardSchema.js +0 -5
- package/esm/types/CamStreamerAPI/srtSchema.js +0 -5
- package/esm/types/CamStreamerAPI/twitchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/vimeoSchema.js +0 -5
- package/esm/types/CamStreamerAPI/wowzaSchema.js +0 -5
- package/types/types/CamStreamerAPI/churchSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/daCastSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/ibmSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -250
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +0 -211
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/srtSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/twitchSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/vimeoSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/wowzaSchema.d.ts +0 -202
package/cjs/CamOverlayAPI.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CamOverlayAPI = void 0;
|
|
4
|
-
const utils_1 = require("./internal/utils");
|
|
5
4
|
const errors_1 = require("./errors/errors");
|
|
6
5
|
const common_1 = require("./types/common");
|
|
7
6
|
const zod_1 = require("zod");
|
|
8
|
-
const ProxyClient_1 = require("./internal/ProxyClient");
|
|
9
7
|
const CamOverlayAPI_1 = require("./types/CamOverlayAPI");
|
|
8
|
+
const BasicAPI_1 = require("./internal/BasicAPI");
|
|
10
9
|
const BASE_PATH = '/local/camoverlay/api';
|
|
11
|
-
class CamOverlayAPI {
|
|
12
|
-
client;
|
|
13
|
-
constructor(client) {
|
|
14
|
-
this.client = client;
|
|
15
|
-
}
|
|
10
|
+
class CamOverlayAPI extends BasicAPI_1.BasicAPI {
|
|
16
11
|
static getBasePath = () => BASE_PATH;
|
|
17
12
|
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
18
13
|
static getFilePreviewPath = (path) => `${BASE_PATH}/image.cgi?path=${encodeURIComponent(path)}`;
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
async checkAPIAvailable(options) {
|
|
15
|
+
await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
|
|
21
16
|
}
|
|
22
17
|
async checkCameraTime(options) {
|
|
23
18
|
const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
@@ -36,7 +31,7 @@ class CamOverlayAPI {
|
|
|
36
31
|
}
|
|
37
32
|
async listFiles(fileType, options) {
|
|
38
33
|
const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'list' }, options);
|
|
39
|
-
return CamOverlayAPI_1.
|
|
34
|
+
return (0, CamOverlayAPI_1.getFileListSchema)(fileType).parse(res.list);
|
|
40
35
|
}
|
|
41
36
|
async uploadFile(fileType, formData, storage, options) {
|
|
42
37
|
await this._post(`${BASE_PATH}/upload_${fileType}.cgi`, formData, {
|
|
@@ -48,14 +43,14 @@ class CamOverlayAPI {
|
|
|
48
43
|
await this._postUrlEncoded(`${BASE_PATH}/upload_${fileType}.cgi`, {
|
|
49
44
|
action: 'remove',
|
|
50
45
|
...fileParams,
|
|
51
|
-
}, options
|
|
46
|
+
}, options);
|
|
52
47
|
}
|
|
53
48
|
async getFileStorage(fileType, options) {
|
|
54
49
|
const res = await this._getJson(`${BASE_PATH}/upload_${fileType}.cgi`, { action: 'get_storage' }, options);
|
|
55
50
|
if (res.code !== 200) {
|
|
56
51
|
throw new errors_1.StorageDataFetchError(res);
|
|
57
52
|
}
|
|
58
|
-
return CamOverlayAPI_1.
|
|
53
|
+
return (0, CamOverlayAPI_1.getStorageDataListSchema)(fileType).parse(res.list);
|
|
59
54
|
}
|
|
60
55
|
async getFilePreviewFromCamera(path, options) {
|
|
61
56
|
return await this._getBlob(CamOverlayAPI.getFilePreviewPath(path), undefined, options);
|
|
@@ -99,15 +94,15 @@ class CamOverlayAPI {
|
|
|
99
94
|
return services;
|
|
100
95
|
}
|
|
101
96
|
async updateSingleService(service, options) {
|
|
102
|
-
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`,
|
|
97
|
+
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`, service, {
|
|
103
98
|
action: 'set',
|
|
104
99
|
service_id: service.id,
|
|
105
|
-
}, options
|
|
100
|
+
}, options);
|
|
106
101
|
}
|
|
107
102
|
async updateServices(services, options) {
|
|
108
|
-
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`,
|
|
103
|
+
await this._postJsonEncoded(`${BASE_PATH}/services.cgi`, { services: services }, {
|
|
109
104
|
action: 'set',
|
|
110
|
-
}, options
|
|
105
|
+
}, options);
|
|
111
106
|
}
|
|
112
107
|
updateCGText(serviceId, fields, options) {
|
|
113
108
|
const params = {};
|
|
@@ -146,6 +141,9 @@ class CamOverlayAPI {
|
|
|
146
141
|
};
|
|
147
142
|
return this.promiseCGUpdate(serviceId, 'update_image', params, contentType, imageData, options);
|
|
148
143
|
}
|
|
144
|
+
downloadReport(options) {
|
|
145
|
+
return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
|
|
146
|
+
}
|
|
149
147
|
async promiseCGUpdate(serviceId, action, params = {}, contentType, data, options) {
|
|
150
148
|
const path = `${BASE_PATH}/customGraphics.cgi`;
|
|
151
149
|
let headers = {};
|
|
@@ -168,52 +166,5 @@ class CamOverlayAPI {
|
|
|
168
166
|
throw new errors_1.ErrorWithResponse(res);
|
|
169
167
|
}
|
|
170
168
|
}
|
|
171
|
-
async _getJson(path, parameters, options) {
|
|
172
|
-
const agent = this.getClient(options?.proxyParams);
|
|
173
|
-
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
174
|
-
if (res.ok) {
|
|
175
|
-
return await res.json();
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
async _post(path, data, parameters, options, headers) {
|
|
182
|
-
const agent = this.getClient(options?.proxyParams);
|
|
183
|
-
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
184
|
-
if (res.ok) {
|
|
185
|
-
return await res.json();
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
async _getBlob(path, parameters, options) {
|
|
192
|
-
const agent = this.getClient(options?.proxyParams);
|
|
193
|
-
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
194
|
-
if (res.ok) {
|
|
195
|
-
return await this.parseBlobResponse(res);
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
async parseBlobResponse(response) {
|
|
202
|
-
try {
|
|
203
|
-
return (await response.blob());
|
|
204
|
-
}
|
|
205
|
-
catch (err) {
|
|
206
|
-
throw new errors_1.ParsingBlobError(err);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
async _postUrlEncoded(path, parameters, options, headers) {
|
|
210
|
-
const data = (0, utils_1.paramToUrl)(parameters);
|
|
211
|
-
const baseHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
212
|
-
return this._post(path, data, undefined, options, { ...baseHeaders, ...headers });
|
|
213
|
-
}
|
|
214
|
-
async _postJsonEncoded(path, data, parameters, options, headers) {
|
|
215
|
-
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
216
|
-
return this._post(path, data, parameters, options, { ...baseHeaders, ...headers });
|
|
217
|
-
}
|
|
218
169
|
}
|
|
219
170
|
exports.CamOverlayAPI = CamOverlayAPI;
|
package/cjs/CamScripterAPI.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BasicAPI } from './internal/BasicAPI';
|
|
2
2
|
import { IClient, TResponse } from './internal/types';
|
|
3
|
-
import { THttpRequestOptions,
|
|
4
|
-
export declare class CamScripterAPI<Client extends IClient<TResponse, any>> {
|
|
5
|
-
private client;
|
|
6
|
-
constructor(client: Client);
|
|
3
|
+
import { THttpRequestOptions, TStorageType } from './types/common';
|
|
4
|
+
export declare class CamScripterAPI<Client extends IClient<TResponse, any>> extends BasicAPI<Client> {
|
|
7
5
|
static getProxyPath: () => string;
|
|
8
|
-
|
|
6
|
+
checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
|
|
9
7
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
10
8
|
getNetworkCameraList(options?: THttpRequestOptions): Promise<{
|
|
11
9
|
name: string;
|
|
@@ -41,6 +39,5 @@ export declare class CamScripterAPI<Client extends IClient<TResponse, any>> {
|
|
|
41
39
|
node_state: "OK" | "NOT_INSTALLED" | "NOT_FOUND";
|
|
42
40
|
}>;
|
|
43
41
|
installNodejs(storage: TStorageType, options?: THttpRequestOptions): Promise<void>;
|
|
44
|
-
|
|
45
|
-
private _post;
|
|
42
|
+
downloadReport(options?: THttpRequestOptions): Promise<string>;
|
|
46
43
|
}
|
package/cjs/CamScripterAPI.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.CamScripterAPI = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const BasicAPI_1 = require("./internal/BasicAPI");
|
|
6
9
|
const CamScripterAPI_1 = require("./types/CamScripterAPI");
|
|
7
10
|
const common_1 = require("./types/common");
|
|
8
11
|
const BASE_PATH = '/local/camscripter';
|
|
9
|
-
class CamScripterAPI {
|
|
10
|
-
client;
|
|
11
|
-
constructor(client) {
|
|
12
|
-
this.client = client;
|
|
13
|
-
}
|
|
12
|
+
class CamScripterAPI extends BasicAPI_1.BasicAPI {
|
|
14
13
|
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
async checkAPIAvailable(options) {
|
|
15
|
+
await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
|
|
17
16
|
}
|
|
18
17
|
async checkCameraTime(options) {
|
|
19
18
|
const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
20
|
-
return
|
|
19
|
+
return zod_1.default.boolean().parse(res.state);
|
|
21
20
|
}
|
|
22
21
|
async getNetworkCameraList(options) {
|
|
23
22
|
const res = await this._getJson(`${BASE_PATH}/network_camera_list.cgi`, undefined, options);
|
|
@@ -56,25 +55,8 @@ class CamScripterAPI {
|
|
|
56
55
|
async installNodejs(storage, options) {
|
|
57
56
|
await this._getJson(`${BASE_PATH}/node_update.cgi`, { storage: storage }, options);
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
62
|
-
if (res.ok) {
|
|
63
|
-
return await res.json();
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async _post(path, data, parameters, options, headers) {
|
|
70
|
-
const agent = this.getClient(options?.proxyParams);
|
|
71
|
-
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
72
|
-
if (res.ok) {
|
|
73
|
-
return await res.json();
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
77
|
-
}
|
|
58
|
+
downloadReport(options) {
|
|
59
|
+
return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
|
|
78
60
|
}
|
|
79
61
|
}
|
|
80
62
|
exports.CamScripterAPI = CamScripterAPI;
|