camstreamerlib 4.0.0-beta.34 → 4.0.0-beta.36
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.js +1 -1
- package/cjs/CamOverlayDrawingAPI.js +6 -3
- package/cjs/CamOverlayPainter/ResourceManager.js +30 -5
- package/cjs/CamScripterAPICameraEventsGenerator.js +6 -3
- package/cjs/CamStreamerAPI.js +4 -1
- package/cjs/CreatePackage.js +22 -19
- package/cjs/VapixAPI.js +3 -2
- package/cjs/node/Digest.js +8 -5
- package/cjs/node/HttpServer.js +15 -12
- package/cjs/node/WsClient.js +11 -8
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +0 -1
- package/cjs/web/WsClient.js +1 -1
- package/esm/CamOverlayAPI.js +1 -1
- package/esm/CamOverlayDrawingAPI.js +1 -1
- package/esm/CamOverlayPainter/ResourceManager.js +6 -4
- package/esm/CamScripterAPICameraEventsGenerator.js +1 -1
- package/esm/CreatePackage.js +3 -3
- package/esm/VapixAPI.js +3 -2
- package/esm/node/Digest.js +1 -1
- package/esm/node/HttpServer.js +5 -5
- package/esm/node/WsClient.js +2 -2
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +0 -1
- package/esm/web/WsClient.js +1 -1
- package/package.json +1 -3
- package/types/CamOverlayDrawingAPI.d.ts +1 -1
- package/types/CamOverlayPainter/ResourceManager.d.ts +2 -2
- package/types/CamScripterAPICameraEventsGenerator.d.ts +1 -1
- package/types/node/HttpServer.d.ts +2 -2
- package/types/node/WsClient.d.ts +1 -1
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +0 -3
package/cjs/CamOverlayAPI.js
CHANGED
|
@@ -29,7 +29,7 @@ class CamOverlayAPI {
|
|
|
29
29
|
}
|
|
30
30
|
async wsAuthorization(options) {
|
|
31
31
|
const response = await this._get({ path: `${BASE_PATH}/ws_authorization.cgi` }, options);
|
|
32
|
-
return CamOverlayAPI_1.WSResponseSchema.parse(response).
|
|
32
|
+
return CamOverlayAPI_1.WSResponseSchema.parse(response).message;
|
|
33
33
|
}
|
|
34
34
|
async getMjpegStreamImage(mjpegUrl, options) {
|
|
35
35
|
return await this._getBlob({
|
|
@@ -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
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
5
8
|
const WsClient_1 = require("./node/WsClient");
|
|
6
|
-
class CamOverlayDrawingAPI extends
|
|
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();
|
|
@@ -1,7 +1,30 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.ResourceManager = void 0;
|
|
4
|
-
const fs = require("fs/promises");
|
|
27
|
+
const fs = __importStar(require("fs/promises"));
|
|
5
28
|
class ResourceManager {
|
|
6
29
|
co;
|
|
7
30
|
imgFileNames = {};
|
|
@@ -21,8 +44,9 @@ class ResourceManager {
|
|
|
21
44
|
if (this.images[moniker] !== undefined) {
|
|
22
45
|
return this.images[moniker];
|
|
23
46
|
}
|
|
24
|
-
|
|
25
|
-
|
|
47
|
+
const path = this.imgFileNames[moniker];
|
|
48
|
+
if (path !== undefined) {
|
|
49
|
+
const imgData = await fs.readFile(path);
|
|
26
50
|
this.images[moniker] = await this.co.uploadImageData(imgData);
|
|
27
51
|
return this.images[moniker];
|
|
28
52
|
}
|
|
@@ -32,8 +56,9 @@ class ResourceManager {
|
|
|
32
56
|
if (this.fonts[moniker] !== undefined) {
|
|
33
57
|
return this.fonts[moniker];
|
|
34
58
|
}
|
|
35
|
-
|
|
36
|
-
|
|
59
|
+
const path = this.fontFileNames[moniker];
|
|
60
|
+
if (path !== undefined) {
|
|
61
|
+
const fontData = await fs.readFile(path);
|
|
37
62
|
this.fonts[moniker] = await this.co.uploadFontData(fontData);
|
|
38
63
|
return this.fonts[moniker];
|
|
39
64
|
}
|
|
@@ -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
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
5
8
|
const WsClient_1 = require("./node/WsClient");
|
|
6
|
-
class CamScripterAPICameraEventsGenerator extends
|
|
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();
|
package/cjs/CamStreamerAPI.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
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.parseCameraStreamResponse = exports.CamStreamerAPI = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
5
8
|
const ProxyClient_1 = require("./internal/ProxyClient");
|
|
6
9
|
const utils_1 = require("./internal/utils");
|
|
7
10
|
const CamStreamerAPI_1 = require("./types/CamStreamerAPI");
|
package/cjs/CreatePackage.js
CHANGED
|
@@ -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/VapixAPI.js
CHANGED
|
@@ -345,8 +345,9 @@ class VapixAPI {
|
|
|
345
345
|
Object.keys(data)
|
|
346
346
|
.map(Number)
|
|
347
347
|
.forEach((camera) => {
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
const item = data[camera];
|
|
349
|
+
if (item !== undefined) {
|
|
350
|
+
res[camera - 1] = item.map(({ data: itemData, ...d }) => d);
|
|
350
351
|
}
|
|
351
352
|
});
|
|
352
353
|
return res;
|
package/cjs/node/Digest.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
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.Digest = void 0;
|
|
4
|
-
const
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
5
8
|
class Digest {
|
|
6
9
|
nonceCount = 1;
|
|
7
10
|
getAuthHeader(user, pass, method, uri, wwwAuthenticateHeader) {
|
|
@@ -13,18 +16,18 @@ class Digest {
|
|
|
13
16
|
const value = arg.substring(pos + 1).trim();
|
|
14
17
|
digestItems[key] = value.replace(/"/g, '');
|
|
15
18
|
}
|
|
16
|
-
const HA1 =
|
|
17
|
-
const HA2 =
|
|
19
|
+
const HA1 = crypto_1.default.createHash('md5').update(`${user}:${digestItems['realm']}:${pass}`).digest('hex');
|
|
20
|
+
const HA2 = crypto_1.default.createHash('md5').update(`${method}:${uri}`).digest('hex');
|
|
18
21
|
const ncValue = ('00000000' + this.nonceCount.toString(16)).slice(-8);
|
|
19
22
|
let response;
|
|
20
23
|
if (digestItems['qop'] !== undefined) {
|
|
21
|
-
response =
|
|
24
|
+
response = crypto_1.default
|
|
22
25
|
.createHash('md5')
|
|
23
26
|
.update(`${HA1}:${digestItems['nonce']}:${ncValue}:162d50aa594e9648:auth:${HA2}`)
|
|
24
27
|
.digest('hex');
|
|
25
28
|
}
|
|
26
29
|
else {
|
|
27
|
-
response =
|
|
30
|
+
response = crypto_1.default.createHash('md5').update(`${HA1}:${digestItems['nonce']}:${HA2}`).digest('hex');
|
|
28
31
|
}
|
|
29
32
|
let header = 'Digest ' +
|
|
30
33
|
`username="${user}",` +
|
package/cjs/node/HttpServer.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
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.HttpServer = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
class HttpServer extends
|
|
7
|
+
const http_1 = __importDefault(require("http"));
|
|
8
|
+
const url_1 = __importDefault(require("url"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const events_1 = __importDefault(require("events"));
|
|
12
|
+
class HttpServer extends events_1.default {
|
|
10
13
|
host;
|
|
11
14
|
port;
|
|
12
15
|
registeredPaths;
|
|
@@ -17,9 +20,9 @@ class HttpServer extends EventEmitter {
|
|
|
17
20
|
this.host = options?.host ?? process.env.HTTP_HOST ?? '0.0.0.0';
|
|
18
21
|
this.port = options?.port ?? parseInt(process.env.HTTP_PORT ?? '80');
|
|
19
22
|
this.registeredPaths = new Map();
|
|
20
|
-
this.server =
|
|
23
|
+
this.server = http_1.default.createServer((req, res) => {
|
|
21
24
|
this.emit('access', req.method + ' ' + req.url);
|
|
22
|
-
const parsedUrl =
|
|
25
|
+
const parsedUrl = url_1.default.parse(req.url ?? '');
|
|
23
26
|
parsedUrl.pathname ??= '';
|
|
24
27
|
const requestCallback = this.registeredPaths.get(parsedUrl.pathname);
|
|
25
28
|
if (requestCallback) {
|
|
@@ -27,7 +30,7 @@ class HttpServer extends EventEmitter {
|
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
29
32
|
let pathname = `./html${parsedUrl.pathname}`;
|
|
30
|
-
const ext =
|
|
33
|
+
const ext = path_1.default.parse(pathname).ext;
|
|
31
34
|
const map = {
|
|
32
35
|
'.ico': 'image/x-icon',
|
|
33
36
|
'.html': 'text/html',
|
|
@@ -42,17 +45,17 @@ class HttpServer extends EventEmitter {
|
|
|
42
45
|
'.pdf': 'application/pdf',
|
|
43
46
|
'.doc': 'application/msword',
|
|
44
47
|
};
|
|
45
|
-
|
|
48
|
+
fs_1.default.access(pathname, fs_1.default.constants.R_OK, (err) => {
|
|
46
49
|
if (err) {
|
|
47
50
|
res.statusCode = 404;
|
|
48
51
|
res.end(`File ${pathname} not found!`);
|
|
49
52
|
this.emit('error', `File ${pathname} not found!`);
|
|
50
53
|
return;
|
|
51
54
|
}
|
|
52
|
-
if (
|
|
55
|
+
if (fs_1.default.statSync(pathname).isDirectory()) {
|
|
53
56
|
pathname += `/index${ext}`;
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
fs_1.default.readFile(pathname, (error, data) => {
|
|
56
59
|
if (error) {
|
|
57
60
|
res.statusCode = 500;
|
|
58
61
|
res.end(`Error getting the file: ${error}`);
|
package/cjs/node/WsClient.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
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.WsClient = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
const ws_1 = __importDefault(require("ws"));
|
|
6
9
|
const Digest_1 = require("./Digest");
|
|
7
|
-
class WsClient extends
|
|
10
|
+
class WsClient extends events_1.default {
|
|
8
11
|
user;
|
|
9
12
|
pass;
|
|
10
13
|
address;
|
|
@@ -42,15 +45,15 @@ class WsClient extends EventEmitter {
|
|
|
42
45
|
}
|
|
43
46
|
this.isClosed = false;
|
|
44
47
|
if (this.protocol === undefined) {
|
|
45
|
-
this.ws = new
|
|
48
|
+
this.ws = new ws_1.default(this.address, this.wsOptions);
|
|
46
49
|
}
|
|
47
50
|
else {
|
|
48
|
-
this.ws = new
|
|
51
|
+
this.ws = new ws_1.default(this.address, this.protocol, this.wsOptions);
|
|
49
52
|
}
|
|
50
53
|
this.ws.binaryType = 'arraybuffer';
|
|
51
54
|
this.isAlive = true;
|
|
52
55
|
this.pingTimer = setInterval(async () => {
|
|
53
|
-
if ((this.ws && this.ws.readyState !==
|
|
56
|
+
if ((this.ws && this.ws.readyState !== ws_1.default.OPEN) || this.isAlive === false) {
|
|
54
57
|
this.emit('error', new Error('Connection timeout'));
|
|
55
58
|
await this.closeWsConnection();
|
|
56
59
|
}
|
|
@@ -122,11 +125,11 @@ class WsClient extends EventEmitter {
|
|
|
122
125
|
}
|
|
123
126
|
wsCopy.removeAllListeners();
|
|
124
127
|
wsCopy.on('error', () => { });
|
|
125
|
-
if (wsCopy.readyState !==
|
|
128
|
+
if (wsCopy.readyState !== ws_1.default.CLOSING && wsCopy.readyState !== ws_1.default.CLOSED) {
|
|
126
129
|
wsCopy.close();
|
|
127
130
|
}
|
|
128
131
|
setTimeout(() => {
|
|
129
|
-
if (wsCopy.readyState !==
|
|
132
|
+
if (wsCopy.readyState !== ws_1.default.CLOSED) {
|
|
130
133
|
wsCopy.terminate();
|
|
131
134
|
}
|
|
132
135
|
}, 5000);
|
|
@@ -15,7 +15,6 @@ const scoreBoardSchema_1 = require("./scoreBoardSchema");
|
|
|
15
15
|
exports.WSResponseSchema = zod_1.z.object({
|
|
16
16
|
status: zod_1.z.number(),
|
|
17
17
|
message: zod_1.z.string(),
|
|
18
|
-
data: zod_1.z.string(),
|
|
19
18
|
});
|
|
20
19
|
exports.widgetsSchema = zod_1.z.discriminatedUnion('name', [
|
|
21
20
|
infotickerSchema_1.infoTickerSchema,
|
package/cjs/web/WsClient.js
CHANGED
package/esm/CamOverlayAPI.js
CHANGED
|
@@ -26,7 +26,7 @@ export class CamOverlayAPI {
|
|
|
26
26
|
}
|
|
27
27
|
async wsAuthorization(options) {
|
|
28
28
|
const response = await this._get({ path: `${BASE_PATH}/ws_authorization.cgi` }, options);
|
|
29
|
-
return WSResponseSchema.parse(response).
|
|
29
|
+
return WSResponseSchema.parse(response).message;
|
|
30
30
|
}
|
|
31
31
|
async getMjpegStreamImage(mjpegUrl, options) {
|
|
32
32
|
return await this._getBlob({
|
|
@@ -18,8 +18,9 @@ export class ResourceManager {
|
|
|
18
18
|
if (this.images[moniker] !== undefined) {
|
|
19
19
|
return this.images[moniker];
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const path = this.imgFileNames[moniker];
|
|
22
|
+
if (path !== undefined) {
|
|
23
|
+
const imgData = await fs.readFile(path);
|
|
23
24
|
this.images[moniker] = await this.co.uploadImageData(imgData);
|
|
24
25
|
return this.images[moniker];
|
|
25
26
|
}
|
|
@@ -29,8 +30,9 @@ export class ResourceManager {
|
|
|
29
30
|
if (this.fonts[moniker] !== undefined) {
|
|
30
31
|
return this.fonts[moniker];
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const path = this.fontFileNames[moniker];
|
|
34
|
+
if (path !== undefined) {
|
|
35
|
+
const fontData = await fs.readFile(path);
|
|
34
36
|
this.fonts[moniker] = await this.co.uploadFontData(fontData);
|
|
35
37
|
return this.fonts[moniker];
|
|
36
38
|
}
|
package/esm/CreatePackage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import AdmZip from 'adm-zip';
|
|
2
|
+
import Path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
5
|
const productionModulesFolder = 'production_modules';
|
|
6
6
|
function isDirectory(path) {
|
package/esm/VapixAPI.js
CHANGED
|
@@ -342,8 +342,9 @@ export class VapixAPI {
|
|
|
342
342
|
Object.keys(data)
|
|
343
343
|
.map(Number)
|
|
344
344
|
.forEach((camera) => {
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
const item = data[camera];
|
|
346
|
+
if (item !== undefined) {
|
|
347
|
+
res[camera - 1] = item.map(({ data: itemData, ...d }) => d);
|
|
347
348
|
}
|
|
348
349
|
});
|
|
349
350
|
return res;
|
package/esm/node/Digest.js
CHANGED
package/esm/node/HttpServer.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import http from 'http';
|
|
2
|
+
import url from 'url';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import EventEmitter from 'events';
|
|
6
6
|
export class HttpServer extends EventEmitter {
|
|
7
7
|
host;
|
|
8
8
|
port;
|
package/esm/node/WsClient.js
CHANGED
|
@@ -12,7 +12,6 @@ import { baseballScoreBoardAutomaticSchema, baseballScoreBoardSchema, scoreBoard
|
|
|
12
12
|
export const WSResponseSchema = z.object({
|
|
13
13
|
status: z.number(),
|
|
14
14
|
message: z.string(),
|
|
15
|
-
data: z.string(),
|
|
16
15
|
});
|
|
17
16
|
export const widgetsSchema = z.discriminatedUnion('name', [
|
|
18
17
|
infoTickerSchema,
|
package/esm/web/WsClient.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camstreamerlib",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.36",
|
|
4
4
|
"description": "Helper library for CamStreamer ACAP applications.",
|
|
5
5
|
"prettier": "@camstreamer/prettier-config",
|
|
6
6
|
"engine": {
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"build:cjs": "tsc --project tsconfig.cjs.json",
|
|
43
43
|
"build:esm": "tsc --project tsconfig.esm.json",
|
|
44
44
|
"copyPackage": "cp -f LICENSE dist/ && cp -f README.md dist/ && cp -f package.json dist/",
|
|
45
|
-
"prepublish": "npm run build",
|
|
46
45
|
"lint": "eslint \"src/**/*.ts\"",
|
|
47
46
|
"lint:fix": "eslint \"src/**/*.ts\" --fix",
|
|
48
47
|
"pretty": "prettier --write \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
|
|
@@ -54,7 +53,6 @@
|
|
|
54
53
|
"/**/*.js",
|
|
55
54
|
"/**/*.ts"
|
|
56
55
|
],
|
|
57
|
-
"type": "module",
|
|
58
56
|
"main": "./cjs/index.js",
|
|
59
57
|
"module": "./esm/index.js",
|
|
60
58
|
"types": "types/index.d.ts",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
-
import
|
|
4
|
+
import EventEmitter from 'events';
|
|
5
5
|
import { CamOverlayDrawingOptions, TCairoCreateResponse, TCairoResponse, TUploadImageResponse, TWriteTextParams } from './types/CamOverlayDrawingAPI';
|
|
6
6
|
export declare class CamOverlayDrawingAPI extends EventEmitter {
|
|
7
7
|
private tls;
|
|
@@ -9,7 +9,7 @@ export declare class ResourceManager {
|
|
|
9
9
|
constructor(co: CamOverlayDrawingAPI);
|
|
10
10
|
registerImage(moniker: string, fileName: string): void;
|
|
11
11
|
registerFont(moniker: string, fileName: string): void;
|
|
12
|
-
image(moniker: string): Promise<TUploadImageResponse>;
|
|
13
|
-
font(moniker: string): Promise<TCairoCreateResponse>;
|
|
12
|
+
image(moniker: string): Promise<TUploadImageResponse | undefined>;
|
|
13
|
+
font(moniker: string): Promise<TCairoCreateResponse | undefined>;
|
|
14
14
|
clear(): void;
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import http from 'http';
|
|
4
|
+
import EventEmitter from 'events';
|
|
5
5
|
export type HttpServerOptions = {
|
|
6
6
|
host?: string;
|
|
7
7
|
port?: number;
|
package/types/node/WsClient.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
-
import
|
|
4
|
+
import EventEmitter from 'events';
|
|
5
5
|
import { WsOptions } from '../internal/types';
|
|
6
6
|
export type WsClientOptions = WsOptions & {
|
|
7
7
|
address: string;
|
|
@@ -13,15 +13,12 @@ import { baseballScoreBoardAutomaticSchema, baseballScoreBoardSchema, scoreBoard
|
|
|
13
13
|
export declare const WSResponseSchema: z.ZodObject<{
|
|
14
14
|
status: z.ZodNumber;
|
|
15
15
|
message: z.ZodString;
|
|
16
|
-
data: z.ZodString;
|
|
17
16
|
}, "strip", z.ZodTypeAny, {
|
|
18
17
|
status: number;
|
|
19
18
|
message: string;
|
|
20
|
-
data: string;
|
|
21
19
|
}, {
|
|
22
20
|
status: number;
|
|
23
21
|
message: string;
|
|
24
|
-
data: string;
|
|
25
22
|
}>;
|
|
26
23
|
export type TWSResponse = z.infer<typeof WSResponseSchema>;
|
|
27
24
|
export declare const widgetsSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObject<{
|