camstreamerlib 4.0.0-beta.4 → 4.0.0-beta.41
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 +112 -0
- package/cjs/CamOverlayAPI.js +135 -92
- package/cjs/CamScripterAPI.js +52 -42
- package/cjs/CamStreamerAPI.js +83 -39
- package/cjs/CamSwitcherAPI.js +141 -123
- package/cjs/CamSwitcherEvents.js +4 -60
- package/cjs/PlaneTrackerAPI.js +210 -0
- package/cjs/VapixAPI.js +323 -233
- package/cjs/{CreatePackage.js → bin/CreatePackage.js} +22 -19
- package/cjs/errors/errors.js +78 -1
- package/cjs/index.js +17 -4
- package/cjs/internal/ProxyClient.js +28 -32
- package/cjs/internal/WsEvents.js +72 -0
- package/cjs/internal/types.js +2 -0
- package/cjs/internal/utils.js +22 -3
- package/cjs/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +7 -4
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +5 -17
- package/cjs/node/CamOverlayPainter/ResourceManager.js +72 -0
- package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +7 -4
- package/cjs/node/DefaultClient.js +10 -12
- package/cjs/{internal → node}/Digest.js +8 -5
- package/cjs/node/HttpRequestSender.js +14 -4
- package/cjs/node/HttpServer.js +15 -12
- package/cjs/{VapixEvents.js → node/VapixEvents.js} +1 -1
- package/cjs/node/WsClient.js +12 -9
- package/cjs/node/events/AxisCameraStationEvents.js +53 -0
- package/cjs/node/events/GenetecAgent.js +123 -0
- package/cjs/node/index.js +38 -5
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +92 -0
- package/cjs/types/CamOverlayAPI/accuweatherSchema.js +47 -0
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.js +72 -0
- package/cjs/types/CamOverlayAPI/imagesSchema.js +9 -0
- package/cjs/types/CamOverlayAPI/index.js +27 -0
- package/cjs/types/CamOverlayAPI/infotickerSchema.js +26 -0
- package/cjs/types/CamOverlayAPI/pipSchema.js +39 -0
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.js +25 -0
- package/cjs/types/CamOverlayAPI/ptzSchema.js +12 -0
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +132 -0
- package/cjs/types/CamOverlayAPI/screenSharingSchema.js +8 -0
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +91 -0
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +8 -0
- package/cjs/types/CamOverlayDrawingAPI.js +2 -0
- package/cjs/types/CamOverlayPainter.js +14 -0
- package/cjs/types/CamScripterAPI.js +22 -7
- package/cjs/types/CamScripterAPICameraEventsGenerator.js +2 -0
- package/cjs/types/CamStreamerAPI.js +34 -3
- package/cjs/types/CamSwitcherAPI.js +38 -1
- package/cjs/types/CamSwitcherEvents.js +8 -0
- package/cjs/types/GenetecAgent.js +31 -0
- package/cjs/types/PlaneTrackerAPI.js +286 -0
- package/cjs/types/VapixAPI.js +71 -13
- package/cjs/types/VapixEvents.js +2 -0
- package/cjs/web/DefaultClient.js +22 -10
- package/cjs/web/WsClient.js +3 -3
- package/esm/CamOverlayAPI.js +131 -88
- package/esm/CamScripterAPI.js +48 -38
- package/esm/CamStreamerAPI.js +81 -38
- package/esm/CamSwitcherAPI.js +137 -119
- package/esm/CamSwitcherEvents.js +5 -61
- package/esm/PlaneTrackerAPI.js +206 -0
- package/esm/VapixAPI.js +315 -225
- package/esm/{CreatePackage.js → bin/CreatePackage.js} +3 -3
- package/esm/errors/errors.js +66 -0
- package/esm/index.js +12 -3
- package/esm/internal/ProxyClient.js +28 -32
- package/esm/internal/WsEvents.js +68 -0
- package/esm/internal/utils.js +17 -1
- package/esm/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +2 -2
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +2 -13
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/ResourceManager.js +7 -5
- package/esm/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +2 -2
- package/esm/node/DefaultClient.js +10 -12
- package/esm/{internal → node}/Digest.js +1 -1
- package/esm/node/HttpRequestSender.js +14 -4
- package/esm/node/HttpServer.js +5 -5
- package/esm/{VapixEvents.js → node/VapixEvents.js} +1 -1
- package/esm/node/WsClient.js +3 -3
- package/esm/{events → node/events}/AxisCameraStationEvents.js +18 -13
- package/esm/node/events/GenetecAgent.js +119 -0
- package/esm/node/index.js +17 -2
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +76 -0
- package/esm/types/CamOverlayAPI/accuweatherSchema.js +44 -0
- package/esm/types/CamOverlayAPI/customGraphicsSchema.js +69 -0
- package/esm/types/CamOverlayAPI/imagesSchema.js +6 -0
- package/esm/types/CamOverlayAPI/index.js +11 -0
- package/esm/types/CamOverlayAPI/infotickerSchema.js +23 -0
- package/esm/types/CamOverlayAPI/pipSchema.js +36 -0
- package/esm/types/CamOverlayAPI/ptzCompassSchema.js +22 -0
- package/esm/types/CamOverlayAPI/ptzSchema.js +9 -0
- package/esm/types/CamOverlayAPI/scoreBoardSchema.js +129 -0
- package/esm/types/CamOverlayAPI/screenSharingSchema.js +5 -0
- package/esm/types/CamOverlayAPI/serviceCommonTypes.js +88 -0
- package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +5 -0
- package/esm/types/CamOverlayPainter.js +11 -0
- package/esm/types/CamScripterAPI.js +21 -6
- package/esm/types/CamScripterAPICameraEventsGenerator.js +1 -0
- package/esm/types/CamStreamerAPI.js +33 -2
- package/esm/types/CamSwitcherAPI.js +38 -1
- package/esm/types/CamSwitcherEvents.js +8 -0
- package/esm/types/GenetecAgent.js +28 -0
- package/esm/types/PlaneTrackerAPI.js +283 -0
- package/esm/types/VapixAPI.js +70 -12
- package/esm/types/VapixEvents.js +1 -0
- package/esm/web/DefaultClient.js +22 -10
- package/esm/web/WsClient.js +3 -3
- package/package.json +30 -12
- package/types/CamOverlayAPI.d.ts +865 -0
- package/types/CamScripterAPI.d.ts +47 -0
- package/types/CamStreamerAPI.d.ts +64 -0
- package/types/CamSwitcherAPI.d.ts +167 -0
- package/types/CamSwitcherEvents.d.ts +8 -0
- package/types/PlaneTrackerAPI.d.ts +230 -0
- package/types/VapixAPI.d.ts +118 -0
- package/types/bin/CreatePackage.d.ts +1 -0
- package/types/errors/errors.d.ts +68 -0
- package/types/index.d.ts +20 -0
- package/types/internal/ProxyClient.d.ts +10 -0
- package/types/internal/WsEvents.d.ts +41 -0
- package/types/internal/types.d.ts +45 -0
- package/{cjs → types}/internal/utils.d.ts +4 -1
- package/{cjs → types}/internal/versionCompare.d.ts +2 -2
- package/types/node/CamOverlayDrawingAPI.d.ts +41 -0
- package/{esm → types/node}/CamOverlayPainter/Frame.d.ts +8 -37
- package/{cjs → types/node}/CamOverlayPainter/Painter.d.ts +5 -21
- package/types/node/CamOverlayPainter/ResourceManager.d.ts +15 -0
- package/types/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
- package/types/node/DefaultClient.d.ts +16 -0
- package/{esm → types}/node/HttpRequestSender.d.ts +1 -0
- package/{cjs → types}/node/HttpServer.d.ts +2 -2
- package/types/node/VapixEvents.d.ts +16 -0
- package/{cjs → types}/node/WsClient.d.ts +3 -2
- package/types/node/events/AxisCameraStationEvents.d.ts +12 -0
- package/types/node/events/GenetecAgent.d.ts +16 -0
- package/types/node/index.d.ts +17 -0
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +4321 -0
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +84 -0
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +700 -0
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +95 -0
- package/types/types/CamOverlayAPI/index.d.ts +11 -0
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +96 -0
- package/types/types/CamOverlayAPI/pipSchema.d.ts +125 -0
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +93 -0
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +118 -0
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +58 -0
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +145 -0
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +58 -0
- package/types/types/CamOverlayDrawingAPI.d.ts +48 -0
- package/types/types/CamOverlayPainter.d.ts +76 -0
- package/types/types/CamScripterAPI.d.ts +130 -0
- package/types/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
- package/types/types/CamStreamerAPI.d.ts +272 -0
- package/{esm → types}/types/CamSwitcherAPI.d.ts +115 -36
- package/{cjs → types}/types/CamSwitcherEvents.d.ts +77 -0
- package/{esm/events → types/types}/GenetecAgent.d.ts +47 -47
- package/types/types/PlaneTrackerAPI.d.ts +890 -0
- package/{cjs → types}/types/VapixAPI.d.ts +647 -465
- package/types/types/VapixEvents.d.ts +15 -0
- package/{esm → types}/types/common.d.ts +15 -5
- package/types/web/DefaultClient.d.ts +6 -0
- package/cjs/CamOverlayAPI.d.ts +0 -31
- package/cjs/CamOverlayDrawingAPI.d.ts +0 -86
- package/cjs/CamOverlayPainter/Frame.d.ts +0 -96
- package/cjs/CamOverlayPainter/ResourceManager.d.ts +0 -14
- package/cjs/CamOverlayPainter/ResourceManager.js +0 -46
- package/cjs/CamScripterAPI.d.ts +0 -19
- package/cjs/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/cjs/CamStreamerAPI.d.ts +0 -16
- package/cjs/CamSwitcherAPI.d.ts +0 -48
- package/cjs/CamSwitcherEvents.d.ts +0 -18
- package/cjs/VapixAPI.d.ts +0 -66
- package/cjs/VapixEvents.d.ts +0 -43
- package/cjs/errors/errors.d.ts +0 -34
- package/cjs/events/AxisCameraStationEvents.d.ts +0 -9
- package/cjs/events/AxisCameraStationEvents.js +0 -48
- package/cjs/events/GenetecAgent.d.ts +0 -174
- package/cjs/events/GenetecAgent.js +0 -123
- package/cjs/index.d.ts +0 -11
- package/cjs/internal/ProxyClient.d.ts +0 -11
- package/cjs/internal/common.d.ts +0 -39
- package/cjs/internal/common.js +0 -27
- package/cjs/node/DefaultClient.d.ts +0 -15
- package/cjs/node/HttpRequestSender.d.ts +0 -28
- package/cjs/node/WsEventClient.d.ts +0 -13
- package/cjs/node/WsEventClient.js +0 -22
- package/cjs/types/CamOverlayAPI.d.ts +0 -188
- package/cjs/types/CamOverlayAPI.js +0 -47
- package/cjs/types/CamScripterAPI.d.ts +0 -67
- package/cjs/types/CamStreamerAPI.d.ts +0 -139
- package/cjs/types/CamSwitcherAPI.d.ts +0 -814
- package/cjs/types/common.d.ts +0 -37
- package/cjs/web/DefaultClient.d.ts +0 -6
- package/cjs/web/index.d.ts +0 -2
- package/esm/CamOverlayAPI.d.ts +0 -31
- package/esm/CamOverlayDrawingAPI.d.ts +0 -86
- package/esm/CamOverlayPainter/Painter.d.ts +0 -48
- package/esm/CamOverlayPainter/ResourceManager.d.ts +0 -14
- package/esm/CamScripterAPI.d.ts +0 -19
- package/esm/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/esm/CamStreamerAPI.d.ts +0 -16
- package/esm/CamSwitcherAPI.d.ts +0 -48
- package/esm/CamSwitcherEvents.d.ts +0 -18
- package/esm/VapixAPI.d.ts +0 -66
- package/esm/VapixEvents.d.ts +0 -43
- package/esm/errors/errors.d.ts +0 -34
- package/esm/events/AxisCameraStationEvents.d.ts +0 -9
- package/esm/events/GenetecAgent.js +0 -119
- package/esm/index.d.ts +0 -11
- package/esm/internal/Digest.d.ts +0 -4
- package/esm/internal/ProxyClient.d.ts +0 -11
- package/esm/internal/common.d.ts +0 -39
- package/esm/internal/common.js +0 -20
- package/esm/internal/constants.d.ts +0 -1
- package/esm/internal/transformers.d.ts +0 -5
- package/esm/internal/utils.d.ts +0 -11
- package/esm/internal/versionCompare.d.ts +0 -6
- package/esm/node/DefaultClient.d.ts +0 -15
- package/esm/node/HttpServer.d.ts +0 -21
- package/esm/node/WsClient.d.ts +0 -39
- package/esm/node/WsEventClient.d.ts +0 -13
- package/esm/node/WsEventClient.js +0 -18
- package/esm/node/index.d.ts +0 -2
- package/esm/types/CamOverlayAPI.d.ts +0 -188
- package/esm/types/CamOverlayAPI.js +0 -44
- package/esm/types/CamScripterAPI.d.ts +0 -67
- package/esm/types/CamStreamerAPI.d.ts +0 -139
- package/esm/types/CamSwitcherEvents.d.ts +0 -491
- package/esm/types/VapixAPI.d.ts +0 -1683
- package/esm/web/DefaultClient.d.ts +0 -6
- package/esm/web/WsClient.d.ts +0 -13
- package/esm/web/index.d.ts +0 -2
- /package/{cjs/CreatePackage.d.ts → esm/internal/types.js} +0 -0
- /package/esm/{CreatePackage.d.ts → types/CamOverlayDrawingAPI.js} +0 -0
- /package/{cjs → types}/internal/constants.d.ts +0 -0
- /package/{cjs → types}/internal/transformers.d.ts +0 -0
- /package/{cjs/internal → types/node}/Digest.d.ts +0 -0
- /package/{cjs → types}/web/WsClient.d.ts +0 -0
- /package/{cjs/node → types/web}/index.d.ts +0 -0
|
@@ -1,17 +1,20 @@
|
|
|
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
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
+
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
6
9
|
const child_process_1 = require("child_process");
|
|
7
10
|
const productionModulesFolder = 'production_modules';
|
|
8
11
|
function isDirectory(path) {
|
|
9
|
-
const stat =
|
|
12
|
+
const stat = fs_1.default.statSync(path);
|
|
10
13
|
return stat.isDirectory();
|
|
11
14
|
}
|
|
12
15
|
function getPackageInfo(folder) {
|
|
13
16
|
try {
|
|
14
|
-
const manifest =
|
|
17
|
+
const manifest = fs_1.default.readFileSync(path_1.default.join(folder, 'manifest.json'));
|
|
15
18
|
const manifestParsed = JSON.parse(manifest.toString());
|
|
16
19
|
return {
|
|
17
20
|
packageName: manifestParsed.package_name,
|
|
@@ -23,10 +26,10 @@ function getPackageInfo(folder) {
|
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
function createZipArchive(zip, folder, options) {
|
|
26
|
-
const zipFileRegex = new RegExp(`${
|
|
27
|
-
const files =
|
|
29
|
+
const zipFileRegex = new RegExp(`${path_1.default.basename(folder)}(_[0-9]){3}\\.zip`);
|
|
30
|
+
const files = fs_1.default.readdirSync(folder);
|
|
28
31
|
for (const file of files) {
|
|
29
|
-
const path =
|
|
32
|
+
const path = path_1.default.join(folder, file);
|
|
30
33
|
const isDir = isDirectory(path);
|
|
31
34
|
if (file[0] === '.' ||
|
|
32
35
|
zipFileRegex.test(file) ||
|
|
@@ -39,7 +42,7 @@ function createZipArchive(zip, folder, options) {
|
|
|
39
42
|
zip.addLocalFolder(path);
|
|
40
43
|
}
|
|
41
44
|
else if (file === productionModulesFolder && options.includeNodeModules) {
|
|
42
|
-
zip.addLocalFolder(
|
|
45
|
+
zip.addLocalFolder(path_1.default.join(productionModulesFolder, 'node_modules'), 'node_modules');
|
|
43
46
|
}
|
|
44
47
|
else if (isDir) {
|
|
45
48
|
zip.addLocalFolder(path, file);
|
|
@@ -50,13 +53,13 @@ function createZipArchive(zip, folder, options) {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
function installDependencies() {
|
|
53
|
-
if (!
|
|
54
|
-
|
|
56
|
+
if (!fs_1.default.existsSync(productionModulesFolder)) {
|
|
57
|
+
fs_1.default.mkdirSync(productionModulesFolder, {});
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
fs_1.default.cpSync('package.json', path_1.default.join(productionModulesFolder, 'package.json'));
|
|
60
|
+
fs_1.default.cpSync('package-lock.json', path_1.default.join(productionModulesFolder, 'package-lock.json'));
|
|
58
61
|
(0, child_process_1.execSync)(`npm ci --omit=dev`, {
|
|
59
|
-
cwd:
|
|
62
|
+
cwd: path_1.default.join(process.cwd(), productionModulesFolder),
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
65
|
function main(args) {
|
|
@@ -80,26 +83,26 @@ function main(args) {
|
|
|
80
83
|
if (options.includeNodeModules) {
|
|
81
84
|
installDependencies();
|
|
82
85
|
}
|
|
83
|
-
if (
|
|
86
|
+
if (fs_1.default.existsSync('dist')) {
|
|
84
87
|
options.typeScriptPackage = true;
|
|
85
88
|
}
|
|
86
|
-
const folder =
|
|
89
|
+
const folder = path_1.default.resolve('.');
|
|
87
90
|
const packageInfo = getPackageInfo(folder);
|
|
88
91
|
if (packageInfo === undefined) {
|
|
89
92
|
console.error('Package info not found');
|
|
90
93
|
process.exit(1);
|
|
91
94
|
}
|
|
92
95
|
const zipFile = `${options.outputFolder}/${packageInfo.packageName}_${packageInfo.packageVersion}.zip`;
|
|
93
|
-
if (
|
|
96
|
+
if (fs_1.default.existsSync(zipFile)) {
|
|
94
97
|
try {
|
|
95
|
-
|
|
98
|
+
fs_1.default.unlinkSync(zipFile);
|
|
96
99
|
}
|
|
97
100
|
catch (error) {
|
|
98
101
|
console.error('An error occured: ', error);
|
|
99
102
|
process.exit(1);
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
|
-
const zip = new
|
|
105
|
+
const zip = new adm_zip_1.default();
|
|
103
106
|
createZipArchive(zip, folder, options);
|
|
104
107
|
zip.writeZip(zipFile);
|
|
105
108
|
}
|
package/cjs/errors/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AddNewClipError = exports.FetchDeviceInfoError = exports.NoDeviceInfoError = exports.MaxFPSError = exports.SDCardJobError = exports.SDCardActionError = exports.ApplicationAPIError = exports.ParsingBlobError = exports.ServiceNotFoundError = exports.ServiceUnavailableError = void 0;
|
|
3
|
+
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 = void 0;
|
|
4
4
|
class ServiceUnavailableError extends Error {
|
|
5
5
|
constructor() {
|
|
6
6
|
super('Service is unavailable.');
|
|
@@ -22,6 +22,27 @@ class ParsingBlobError extends Error {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
exports.ParsingBlobError = ParsingBlobError;
|
|
25
|
+
class JsonParseError extends Error {
|
|
26
|
+
constructor(paramName, data) {
|
|
27
|
+
super(`Error: in JSON parsing of ${paramName}. Cannot parse: ${data}`);
|
|
28
|
+
this.name = 'JsonParseError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.JsonParseError = JsonParseError;
|
|
32
|
+
class ParameterNotFoundError extends Error {
|
|
33
|
+
constructor(paramName) {
|
|
34
|
+
super(`Error: no parameter '${paramName}' was found`);
|
|
35
|
+
this.name = 'ParameterNotFoundError';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ParameterNotFoundError = ParameterNotFoundError;
|
|
39
|
+
class SettingParameterError extends Error {
|
|
40
|
+
constructor(message) {
|
|
41
|
+
super(`Error setting parameter to camera: ${message}`);
|
|
42
|
+
this.name = 'SettingParameterError';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.SettingParameterError = SettingParameterError;
|
|
25
46
|
class ApplicationAPIError extends Error {
|
|
26
47
|
constructor(action, res) {
|
|
27
48
|
super(`[APP ${action}] Error: ` + res);
|
|
@@ -77,3 +98,59 @@ class AddNewClipError extends Error {
|
|
|
77
98
|
}
|
|
78
99
|
}
|
|
79
100
|
exports.AddNewClipError = AddNewClipError;
|
|
101
|
+
class PtzNotSupportedError extends Error {
|
|
102
|
+
constructor() {
|
|
103
|
+
super('Ptz not supported.');
|
|
104
|
+
this.name = 'PtzNotSupportedError';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.PtzNotSupportedError = PtzNotSupportedError;
|
|
108
|
+
class StorageDataFetchError extends Error {
|
|
109
|
+
constructor(err) {
|
|
110
|
+
super('Error fetching storage data: ' + err);
|
|
111
|
+
this.name = 'StorageDataFetchError';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.StorageDataFetchError = StorageDataFetchError;
|
|
115
|
+
class WsAuthorizationError extends Error {
|
|
116
|
+
constructor(message) {
|
|
117
|
+
super('Server error on ws authorization: ' + message);
|
|
118
|
+
this.name = 'WsAuthorizationError';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.WsAuthorizationError = WsAuthorizationError;
|
|
122
|
+
class UtcTimeFetchError extends Error {
|
|
123
|
+
constructor(message) {
|
|
124
|
+
super('Server error on get UTC time: ' + message);
|
|
125
|
+
this.name = 'UtcTimeFetchError';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.UtcTimeFetchError = UtcTimeFetchError;
|
|
129
|
+
class TimezoneNotSetupError extends Error {
|
|
130
|
+
constructor() {
|
|
131
|
+
super('Time zone not setup on the device');
|
|
132
|
+
this.name = 'TimezoneNotSetupError';
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.TimezoneNotSetupError = TimezoneNotSetupError;
|
|
136
|
+
class TimezoneFetchError extends Error {
|
|
137
|
+
constructor(err) {
|
|
138
|
+
super('Error fetching time zone information: ' + err);
|
|
139
|
+
this.name = 'TimezoneFetchError';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.TimezoneFetchError = TimezoneFetchError;
|
|
143
|
+
class ResetCalibrationError extends Error {
|
|
144
|
+
constructor(type, err) {
|
|
145
|
+
super('Error resetting ' + type.toLowerCase() + ' calibration: ' + err);
|
|
146
|
+
this.name = 'ResetCalibrationError';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
exports.ResetCalibrationError = ResetCalibrationError;
|
|
150
|
+
class ImportSettingsError extends Error {
|
|
151
|
+
constructor(err) {
|
|
152
|
+
super('Error importing settings: ' + err);
|
|
153
|
+
this.name = 'ImportSettingsError';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.ImportSettingsError = ImportSettingsError;
|
package/cjs/index.js
CHANGED
|
@@ -14,18 +14,31 @@ 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.VapixAPI = exports.CamSwitcherEvents = exports.CamSwitcherAPI = void 0;
|
|
18
|
-
__exportStar(require("./internal/
|
|
17
|
+
exports.VapixAPI = exports.PlaneTrackerAPI = exports.CamSwitcherEvents = exports.CamSwitcherAPI = exports.CamStreamerAPI = exports.CamScripterAPI = exports.CamOverlayAPI = void 0;
|
|
18
|
+
__exportStar(require("./internal/types"), exports);
|
|
19
19
|
__exportStar(require("./internal/constants"), exports);
|
|
20
20
|
__exportStar(require("./internal/utils"), exports);
|
|
21
21
|
__exportStar(require("./internal/versionCompare"), exports);
|
|
22
|
+
__exportStar(require("./internal/ProxyClient"), exports);
|
|
22
23
|
__exportStar(require("./types/common"), exports);
|
|
24
|
+
var CamOverlayAPI_1 = require("./CamOverlayAPI");
|
|
25
|
+
Object.defineProperty(exports, "CamOverlayAPI", { enumerable: true, get: function () { return CamOverlayAPI_1.CamOverlayAPI; } });
|
|
26
|
+
__exportStar(require("./types/CamOverlayAPI"), exports);
|
|
27
|
+
var CamScripterAPI_1 = require("./CamScripterAPI");
|
|
28
|
+
Object.defineProperty(exports, "CamScripterAPI", { enumerable: true, get: function () { return CamScripterAPI_1.CamScripterAPI; } });
|
|
29
|
+
__exportStar(require("./types/CamScripterAPI"), exports);
|
|
30
|
+
var CamStreamerAPI_1 = require("./CamStreamerAPI");
|
|
31
|
+
Object.defineProperty(exports, "CamStreamerAPI", { enumerable: true, get: function () { return CamStreamerAPI_1.CamStreamerAPI; } });
|
|
32
|
+
__exportStar(require("./types/CamStreamerAPI"), exports);
|
|
23
33
|
var CamSwitcherAPI_1 = require("./CamSwitcherAPI");
|
|
24
34
|
Object.defineProperty(exports, "CamSwitcherAPI", { enumerable: true, get: function () { return CamSwitcherAPI_1.CamSwitcherAPI; } });
|
|
35
|
+
__exportStar(require("./types/CamSwitcherAPI"), exports);
|
|
25
36
|
var CamSwitcherEvents_1 = require("./CamSwitcherEvents");
|
|
26
37
|
Object.defineProperty(exports, "CamSwitcherEvents", { enumerable: true, get: function () { return CamSwitcherEvents_1.CamSwitcherEvents; } });
|
|
38
|
+
__exportStar(require("./types/CamSwitcherEvents"), exports);
|
|
39
|
+
var PlaneTrackerAPI_1 = require("./PlaneTrackerAPI");
|
|
40
|
+
Object.defineProperty(exports, "PlaneTrackerAPI", { enumerable: true, get: function () { return PlaneTrackerAPI_1.PlaneTrackerAPI; } });
|
|
41
|
+
__exportStar(require("./types/PlaneTrackerAPI"), exports);
|
|
27
42
|
var VapixAPI_1 = require("./VapixAPI");
|
|
28
43
|
Object.defineProperty(exports, "VapixAPI", { enumerable: true, get: function () { return VapixAPI_1.VapixAPI; } });
|
|
29
|
-
__exportStar(require("./types/CamSwitcherEvents"), exports);
|
|
30
|
-
__exportStar(require("./types/CamSwitcherAPI"), exports);
|
|
31
44
|
__exportStar(require("./types/VapixAPI"), exports);
|
|
@@ -4,41 +4,37 @@ exports.ProxyClient = void 0;
|
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
class ProxyClient {
|
|
6
6
|
client;
|
|
7
|
-
|
|
8
|
-
constructor(client,
|
|
7
|
+
proxyParams;
|
|
8
|
+
constructor(client, proxyParams) {
|
|
9
9
|
this.client = client;
|
|
10
|
-
this.
|
|
10
|
+
this.proxyParams = proxyParams;
|
|
11
11
|
}
|
|
12
|
-
get
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
realUrl: this.getProxyUrl(),
|
|
26
|
-
realHeaders: {
|
|
27
|
-
...(headers ?? {}),
|
|
28
|
-
'x-target-camera-protocol': proxy.port === 443 ? 'https' : 'http',
|
|
29
|
-
'x-target-camera-path': url,
|
|
30
|
-
'x-target-camera-ip': proxy.ip,
|
|
31
|
-
'x-target-camera-mdns': proxy.mdnsName,
|
|
32
|
-
'x-target-camera-port': String(proxy.port),
|
|
33
|
-
'x-target-camera-pass': encodeURIComponent(proxy.pass),
|
|
34
|
-
'x-target-camera-user': encodeURIComponent(proxy.user),
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
12
|
+
get(params) {
|
|
13
|
+
const { path, parameters, headers, timeout } = params;
|
|
14
|
+
const targetPath = (0, utils_1.addParametersToPath)(path, parameters);
|
|
15
|
+
const { realPath, realHeaders } = this.getReal(targetPath, headers);
|
|
16
|
+
return this.client.get({ path: realPath, headers: realHeaders, timeout });
|
|
17
|
+
}
|
|
18
|
+
post(params) {
|
|
19
|
+
const { path, data, parameters, headers, timeout } = params;
|
|
20
|
+
const targetPath = (0, utils_1.addParametersToPath)(path, parameters);
|
|
21
|
+
const { realPath, realHeaders } = this.getReal(targetPath, headers);
|
|
22
|
+
return this.client.post({ path: realPath, data, headers: realHeaders, timeout });
|
|
23
|
+
}
|
|
24
|
+
getReal(targetPath, headers) {
|
|
38
25
|
return {
|
|
39
|
-
|
|
40
|
-
realHeaders:
|
|
26
|
+
realPath: this.proxyParams.path,
|
|
27
|
+
realHeaders: {
|
|
28
|
+
...(headers ?? {}),
|
|
29
|
+
'x-target-camera-protocol': this.proxyParams.target.port === 443 ? 'https' : 'http',
|
|
30
|
+
'x-target-camera-path': targetPath,
|
|
31
|
+
'x-target-camera-ip': this.proxyParams.target.ip,
|
|
32
|
+
'x-target-camera-mdns': this.proxyParams.target.mdnsName,
|
|
33
|
+
'x-target-camera-port': String(this.proxyParams.target.port),
|
|
34
|
+
'x-target-camera-pass': this.proxyParams.target.pass,
|
|
35
|
+
'x-target-camera-user': this.proxyParams.target.user,
|
|
36
|
+
},
|
|
41
37
|
};
|
|
42
|
-
}
|
|
38
|
+
}
|
|
43
39
|
}
|
|
44
40
|
exports.ProxyClient = ProxyClient;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WsEvents = void 0;
|
|
4
|
+
class WsEvents {
|
|
5
|
+
zodSchema;
|
|
6
|
+
ws;
|
|
7
|
+
_isDestroyed = false;
|
|
8
|
+
listeners = {};
|
|
9
|
+
constructor(zodSchema, ws) {
|
|
10
|
+
this.zodSchema = zodSchema;
|
|
11
|
+
this.ws = ws;
|
|
12
|
+
this.ws.onmessage = (e) => this.onMessage(e);
|
|
13
|
+
}
|
|
14
|
+
get isDestroyed() {
|
|
15
|
+
return this._isDestroyed;
|
|
16
|
+
}
|
|
17
|
+
resendInitData() {
|
|
18
|
+
const request = {
|
|
19
|
+
command: 'sendInitData',
|
|
20
|
+
};
|
|
21
|
+
this.ws.send(JSON.stringify(request));
|
|
22
|
+
}
|
|
23
|
+
addListener(type, listener, id) {
|
|
24
|
+
const typeList = this.listeners[type];
|
|
25
|
+
if (typeList === undefined) {
|
|
26
|
+
this.listeners[type] = { [id]: listener };
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
typeList[id] = listener;
|
|
30
|
+
}
|
|
31
|
+
removeListener(type, id) {
|
|
32
|
+
const typeList = this.listeners[type];
|
|
33
|
+
if (typeList) {
|
|
34
|
+
delete typeList[id];
|
|
35
|
+
if (Object.keys(typeList).length === 0) {
|
|
36
|
+
delete this.listeners[type];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
onMessage(evt) {
|
|
41
|
+
if (this.isDestroyed) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const eventData = JSON.parse(evt.data);
|
|
46
|
+
const data = this.zodSchema.parse(eventData);
|
|
47
|
+
if (isInitEvent(data)) {
|
|
48
|
+
this.processMessage(data.data, true);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.processMessage(data, false);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error('Error parsing event data:', evt.data, error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
processMessage(event, isInit) {
|
|
58
|
+
const listeners = this.listeners[event.type];
|
|
59
|
+
const list = Object.values(listeners ?? {});
|
|
60
|
+
list.forEach((listener) => listener(event, isInit));
|
|
61
|
+
}
|
|
62
|
+
destroy() {
|
|
63
|
+
this._isDestroyed = true;
|
|
64
|
+
this.ws.onmessage = () => { };
|
|
65
|
+
this.ws.destroy();
|
|
66
|
+
this.listeners = {};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.WsEvents = WsEvents;
|
|
70
|
+
const isInitEvent = (event) => {
|
|
71
|
+
return event.type === 'init';
|
|
72
|
+
};
|
package/cjs/internal/utils.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLoopPlayType = exports.isPlaylist = exports.isTracker = exports.isClip = exports.isStream = exports.isCamera = exports.arrayToUrl = exports.paramToUrl = exports.addParametersToPath = void 0;
|
|
4
|
-
const common_1 = require("./common");
|
|
3
|
+
exports.isNullish = exports.pad = exports.responseStringify = exports.isLoopPlayType = exports.isPlaylist = exports.isTracker = exports.isClip = exports.isStream = exports.isCamera = exports.arrayToUrl = exports.paramToUrl = exports.addParametersToPath = void 0;
|
|
5
4
|
const addParametersToPath = (path, params) => {
|
|
6
5
|
if (params === undefined || Object.keys(params).length === 0) {
|
|
7
6
|
return path;
|
|
@@ -17,7 +16,7 @@ const paramToUrl = (params) => {
|
|
|
17
16
|
let output = '';
|
|
18
17
|
for (const key in params) {
|
|
19
18
|
const value = params[key];
|
|
20
|
-
if (
|
|
19
|
+
if (isNullish(value)) {
|
|
21
20
|
continue;
|
|
22
21
|
}
|
|
23
22
|
output += `${encodeURIComponent(key)}=${encodeURIComponent(value)}&`;
|
|
@@ -44,3 +43,23 @@ const isPlaylist = (id) => id?.charAt(0) === 'p';
|
|
|
44
43
|
exports.isPlaylist = isPlaylist;
|
|
45
44
|
const isLoopPlayType = (playType) => playType.includes('LOOP');
|
|
46
45
|
exports.isLoopPlayType = isLoopPlayType;
|
|
46
|
+
async function responseStringify(res) {
|
|
47
|
+
return JSON.stringify({
|
|
48
|
+
status: res.status,
|
|
49
|
+
body: await res.text(),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.responseStringify = responseStringify;
|
|
53
|
+
function pad(num, size) {
|
|
54
|
+
const sign = Math.sign(num) === -1 ? '-' : '';
|
|
55
|
+
return (sign +
|
|
56
|
+
new Array(size)
|
|
57
|
+
.concat([Math.abs(num)])
|
|
58
|
+
.join('0')
|
|
59
|
+
.slice(-size));
|
|
60
|
+
}
|
|
61
|
+
exports.pad = pad;
|
|
62
|
+
function isNullish(value) {
|
|
63
|
+
return value === null || value === undefined;
|
|
64
|
+
}
|
|
65
|
+
exports.isNullish = isNullish;
|
|
@@ -1,9 +1,12 @@
|
|
|
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.CamOverlayDrawingAPI = void 0;
|
|
4
|
-
const
|
|
5
|
-
const WsClient_1 = require("./
|
|
6
|
-
class CamOverlayDrawingAPI extends
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
const WsClient_1 = require("./WsClient");
|
|
9
|
+
class CamOverlayDrawingAPI extends events_1.default {
|
|
7
10
|
tls;
|
|
8
11
|
tlsInsecure;
|
|
9
12
|
ip;
|
|
@@ -37,7 +40,7 @@ class CamOverlayDrawingAPI extends EventEmitter {
|
|
|
37
40
|
this.sendMessages = {};
|
|
38
41
|
this.wsConnected = false;
|
|
39
42
|
this.createWsClient();
|
|
40
|
-
|
|
43
|
+
events_1.default.call(this);
|
|
41
44
|
}
|
|
42
45
|
connect() {
|
|
43
46
|
this.ws.open();
|
|
@@ -57,6 +57,14 @@ class Frame extends events_1.EventEmitter {
|
|
|
57
57
|
this.width = width;
|
|
58
58
|
this.height = height;
|
|
59
59
|
}
|
|
60
|
+
getFrameInfo() {
|
|
61
|
+
return {
|
|
62
|
+
x: this.posX,
|
|
63
|
+
y: this.posY,
|
|
64
|
+
width: this.width,
|
|
65
|
+
height: this.height,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
60
68
|
setText(text, align, textType = 'TFM_OVERFLOW', fontColor) {
|
|
61
69
|
this.text = text;
|
|
62
70
|
this.align = align;
|
|
@@ -76,6 +84,16 @@ class Frame extends events_1.EventEmitter {
|
|
|
76
84
|
this.fontName = undefined;
|
|
77
85
|
this.font = fontData;
|
|
78
86
|
}
|
|
87
|
+
getTextInfo() {
|
|
88
|
+
return {
|
|
89
|
+
text: this.text,
|
|
90
|
+
textAlign: this.align,
|
|
91
|
+
textType: this.textType,
|
|
92
|
+
fontColor: this.fontColor,
|
|
93
|
+
font: this.font,
|
|
94
|
+
fontName: this.fontName,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
79
97
|
setBgColor(color) {
|
|
80
98
|
this.bgColor = color;
|
|
81
99
|
}
|
|
@@ -92,6 +110,14 @@ class Frame extends events_1.EventEmitter {
|
|
|
92
110
|
setBgType(type) {
|
|
93
111
|
this.bgType = type;
|
|
94
112
|
}
|
|
113
|
+
getBgInfo() {
|
|
114
|
+
return {
|
|
115
|
+
bgColor: this.bgColor,
|
|
116
|
+
bgImage: this.bgImage,
|
|
117
|
+
bgImageName: this.bgImageName,
|
|
118
|
+
bgType: this.bgType,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
95
121
|
setBorderRadius(radius) {
|
|
96
122
|
this.borderRadius = radius;
|
|
97
123
|
}
|
|
@@ -101,6 +127,13 @@ class Frame extends events_1.EventEmitter {
|
|
|
101
127
|
setBorderColor(color) {
|
|
102
128
|
this.borderColor = color;
|
|
103
129
|
}
|
|
130
|
+
getBorderInfo() {
|
|
131
|
+
return {
|
|
132
|
+
borderRadius: this.borderRadius,
|
|
133
|
+
borderWidth: this.borderWidth,
|
|
134
|
+
borderColor: this.borderColor,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
104
137
|
setCustomDraw(customDraw) {
|
|
105
138
|
this.customDraw = customDraw;
|
|
106
139
|
}
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Painter = void 0;
|
|
4
4
|
const CamOverlayDrawingAPI_1 = require("../CamOverlayDrawingAPI");
|
|
5
5
|
const ResourceManager_1 = require("./ResourceManager");
|
|
6
|
-
exports.ResourceManager = ResourceManager_1.default;
|
|
7
6
|
const Frame_1 = require("./Frame");
|
|
8
|
-
|
|
9
|
-
exports.COORD = {
|
|
10
|
-
top_left: [-1, -1],
|
|
11
|
-
center_left: [-1, 0],
|
|
12
|
-
bottom_left: [-1, 1],
|
|
13
|
-
top_center: [0, -1],
|
|
14
|
-
center: [0, 0],
|
|
15
|
-
bottom_center: [0, 1],
|
|
16
|
-
top_right: [1, -1],
|
|
17
|
-
center_right: [1, 0],
|
|
18
|
-
bottom_right: [1, 1],
|
|
19
|
-
};
|
|
7
|
+
const CamOverlayPainter_1 = require("../../types/CamOverlayPainter");
|
|
20
8
|
class Painter extends Frame_1.Frame {
|
|
21
9
|
screenWidth;
|
|
22
10
|
screenHeight;
|
|
@@ -27,11 +15,11 @@ class Painter extends Frame_1.Frame {
|
|
|
27
15
|
layers = [];
|
|
28
16
|
constructor(opt, coopt) {
|
|
29
17
|
super(opt);
|
|
30
|
-
this.coAlignment =
|
|
18
|
+
this.coAlignment = CamOverlayPainter_1.COORD[opt.coAlignment];
|
|
31
19
|
this.screenWidth = opt.screenWidth;
|
|
32
20
|
this.screenHeight = opt.screenHeight;
|
|
33
21
|
this.cod = new CamOverlayDrawingAPI_1.CamOverlayDrawingAPI(coopt);
|
|
34
|
-
this.rm = new ResourceManager_1.
|
|
22
|
+
this.rm = new ResourceManager_1.ResourceManager(this.cod);
|
|
35
23
|
}
|
|
36
24
|
get camOverlayDrawingAPI() {
|
|
37
25
|
return this.cod;
|
|
@@ -71,7 +59,7 @@ class Painter extends Frame_1.Frame {
|
|
|
71
59
|
this.screenHeight = sh;
|
|
72
60
|
}
|
|
73
61
|
setCoAlignment(coAlignment) {
|
|
74
|
-
this.coAlignment =
|
|
62
|
+
this.coAlignment = CamOverlayPainter_1.COORD[coAlignment];
|
|
75
63
|
}
|
|
76
64
|
layoutChanged() {
|
|
77
65
|
this.refreshLayers = true;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ResourceManager = void 0;
|
|
27
|
+
const fs = __importStar(require("fs/promises"));
|
|
28
|
+
class ResourceManager {
|
|
29
|
+
co;
|
|
30
|
+
imgFileNames = {};
|
|
31
|
+
fontFileNames = {};
|
|
32
|
+
images = {};
|
|
33
|
+
fonts = {};
|
|
34
|
+
constructor(co) {
|
|
35
|
+
this.co = co;
|
|
36
|
+
}
|
|
37
|
+
registerImage(moniker, fileName) {
|
|
38
|
+
this.imgFileNames[moniker] = process.env.INSTALL_PATH + '/images/' + fileName;
|
|
39
|
+
}
|
|
40
|
+
registerFont(moniker, fileName) {
|
|
41
|
+
this.fontFileNames[moniker] = process.env.INSTALL_PATH + '/fonts/' + fileName;
|
|
42
|
+
}
|
|
43
|
+
async image(moniker) {
|
|
44
|
+
if (this.images[moniker] !== undefined) {
|
|
45
|
+
return this.images[moniker];
|
|
46
|
+
}
|
|
47
|
+
const path = this.imgFileNames[moniker];
|
|
48
|
+
if (path !== undefined) {
|
|
49
|
+
const imgData = await fs.readFile(path);
|
|
50
|
+
this.images[moniker] = await this.co.uploadImageData(imgData);
|
|
51
|
+
return this.images[moniker];
|
|
52
|
+
}
|
|
53
|
+
throw new Error('Error! Unknown image requested!');
|
|
54
|
+
}
|
|
55
|
+
async font(moniker) {
|
|
56
|
+
if (this.fonts[moniker] !== undefined) {
|
|
57
|
+
return this.fonts[moniker];
|
|
58
|
+
}
|
|
59
|
+
const path = this.fontFileNames[moniker];
|
|
60
|
+
if (path !== undefined) {
|
|
61
|
+
const fontData = await fs.readFile(path);
|
|
62
|
+
this.fonts[moniker] = await this.co.uploadFontData(fontData);
|
|
63
|
+
return this.fonts[moniker];
|
|
64
|
+
}
|
|
65
|
+
throw new Error('Error! Unknown font requested!');
|
|
66
|
+
}
|
|
67
|
+
clear() {
|
|
68
|
+
this.images = {};
|
|
69
|
+
this.fonts = {};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ResourceManager = ResourceManager;
|
package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js}
RENAMED
|
@@ -1,9 +1,12 @@
|
|
|
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.CamScripterAPICameraEventsGenerator = void 0;
|
|
4
|
-
const
|
|
5
|
-
const WsClient_1 = require("./
|
|
6
|
-
class CamScripterAPICameraEventsGenerator extends
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
const WsClient_1 = require("./WsClient");
|
|
9
|
+
class CamScripterAPICameraEventsGenerator extends events_1.default {
|
|
7
10
|
tls;
|
|
8
11
|
tlsInsecure;
|
|
9
12
|
ip;
|
|
@@ -27,7 +30,7 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
|
27
30
|
this.sendMessages = {};
|
|
28
31
|
this.wsConnected = false;
|
|
29
32
|
this.createWsClient();
|
|
30
|
-
|
|
33
|
+
events_1.default.call(this);
|
|
31
34
|
}
|
|
32
35
|
connect() {
|
|
33
36
|
this.ws.open();
|