camstreamerlib 4.0.0-beta.35 → 4.0.0-beta.37

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.
Files changed (57) hide show
  1. package/cjs/CamOverlayAPI.js +15 -15
  2. package/cjs/CamOverlayDrawingAPI.js +6 -3
  3. package/cjs/CamOverlayPainter/ResourceManager.js +30 -5
  4. package/cjs/CamScripterAPICameraEventsGenerator.js +6 -3
  5. package/cjs/CamStreamerAPI.js +4 -1
  6. package/cjs/CreatePackage.js +22 -19
  7. package/cjs/VapixAPI.js +3 -2
  8. package/cjs/node/Digest.js +8 -5
  9. package/cjs/node/HttpServer.js +15 -12
  10. package/cjs/node/WsClient.js +11 -8
  11. package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +17 -17
  12. package/cjs/types/CamOverlayAPI/accuweatherSchema.js +7 -7
  13. package/cjs/types/CamOverlayAPI/customGraphicsSchema.js +5 -5
  14. package/cjs/types/CamOverlayAPI/imagesSchema.js +4 -4
  15. package/cjs/types/CamOverlayAPI/index.js +1 -1
  16. package/cjs/types/CamOverlayAPI/infotickerSchema.js +6 -6
  17. package/cjs/types/CamOverlayAPI/pipSchema.js +4 -4
  18. package/cjs/types/CamOverlayAPI/ptzCompassSchema.js +4 -4
  19. package/cjs/types/CamOverlayAPI/ptzSchema.js +4 -4
  20. package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +8 -8
  21. package/cjs/types/CamOverlayAPI/screenSharingSchema.js +3 -3
  22. package/cjs/types/CamOverlayAPI/{widgetCommonTypes.js → serviceCommonTypes.js} +8 -4
  23. package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +3 -3
  24. package/cjs/web/WsClient.js +1 -1
  25. package/esm/CamOverlayAPI.js +16 -16
  26. package/esm/CamOverlayDrawingAPI.js +1 -1
  27. package/esm/CamOverlayPainter/ResourceManager.js +6 -4
  28. package/esm/CamScripterAPICameraEventsGenerator.js +1 -1
  29. package/esm/CreatePackage.js +3 -3
  30. package/esm/VapixAPI.js +3 -2
  31. package/esm/node/Digest.js +1 -1
  32. package/esm/node/HttpServer.js +5 -5
  33. package/esm/node/WsClient.js +2 -2
  34. package/esm/types/CamOverlayAPI/CamOverlayAPI.js +16 -16
  35. package/esm/types/CamOverlayAPI/accuweatherSchema.js +3 -3
  36. package/esm/types/CamOverlayAPI/customGraphicsSchema.js +3 -3
  37. package/esm/types/CamOverlayAPI/imagesSchema.js +3 -3
  38. package/esm/types/CamOverlayAPI/index.js +1 -1
  39. package/esm/types/CamOverlayAPI/infotickerSchema.js +3 -3
  40. package/esm/types/CamOverlayAPI/pipSchema.js +3 -3
  41. package/esm/types/CamOverlayAPI/ptzCompassSchema.js +3 -3
  42. package/esm/types/CamOverlayAPI/ptzSchema.js +3 -3
  43. package/esm/types/CamOverlayAPI/scoreBoardSchema.js +5 -5
  44. package/esm/types/CamOverlayAPI/screenSharingSchema.js +2 -2
  45. package/esm/types/CamOverlayAPI/{widgetCommonTypes.js → serviceCommonTypes.js} +7 -3
  46. package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +2 -2
  47. package/esm/web/WsClient.js +1 -1
  48. package/package.json +1 -3
  49. package/types/CamOverlayAPI.d.ts +821 -5
  50. package/types/CamOverlayDrawingAPI.d.ts +1 -1
  51. package/types/CamOverlayPainter/ResourceManager.d.ts +2 -2
  52. package/types/CamScripterAPICameraEventsGenerator.d.ts +1 -1
  53. package/types/node/HttpServer.d.ts +2 -2
  54. package/types/node/WsClient.d.ts +1 -1
  55. package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +18 -18
  56. package/types/types/CamOverlayAPI/index.d.ts +1 -1
  57. package/types/types/CamOverlayAPI/{widgetCommonTypes.d.ts → serviceCommonTypes.d.ts} +6 -2
@@ -99,7 +99,7 @@ class CamOverlayAPI {
99
99
  throw new Error(await (0, utils_1.responseStringify)(res));
100
100
  }
101
101
  }
102
- async getSingleWidget(serviceId, options) {
102
+ async getSingleService(serviceId, options) {
103
103
  const data = await this._get({
104
104
  path: `${BASE_PATH}/services.cgi`,
105
105
  parameters: {
@@ -107,34 +107,34 @@ class CamOverlayAPI {
107
107
  service_id: serviceId.toString(),
108
108
  },
109
109
  }, options);
110
- return CamOverlayAPI_1.widgetsSchema.parse(data);
110
+ return CamOverlayAPI_1.servicesSchema.parse(data);
111
111
  }
112
- async getWidgets(options) {
113
- const widgetList = await this._get({
112
+ async getServices(options) {
113
+ const serviceList = await this._get({
114
114
  path: `${BASE_PATH}/services.cgi`,
115
115
  parameters: {
116
116
  action: 'get',
117
117
  },
118
118
  }, options);
119
- const widgets = widgetList.services;
120
- widgets.forEach((widget) => {
121
- const parsedWidget = CamOverlayAPI_1.widgetsSchema.safeParse(widget);
122
- if (!parsedWidget.success) {
123
- console.warn(`[SERVICE SCHEMA MISMATCH]: Service ${widget.name} (${widget.id}) does not match the current schema, or is a hidden service.`);
119
+ const services = CamOverlayAPI_1.serviceListSchema.parse(serviceList).services;
120
+ services.forEach((service) => {
121
+ const parsedService = CamOverlayAPI_1.servicesSchema.safeParse(service);
122
+ if (!parsedService.success) {
123
+ console.warn(`[SERVICE SCHEMA MISMATCH]: Service ${service.name} (${service.id}) does not match the current schema, or is a hidden service.`);
124
124
  }
125
125
  });
126
- return widgets;
126
+ return services;
127
127
  }
128
- async updateSingleWidget(widget, options) {
128
+ async updateSingleService(service, options) {
129
129
  const path = `${BASE_PATH}/services.cgi`;
130
- await this._postJsonEncoded(path, JSON.stringify(widget), {
130
+ await this._postJsonEncoded(path, JSON.stringify(service), {
131
131
  action: 'set',
132
- service_id: widget.id.toString(),
132
+ service_id: service.id.toString(),
133
133
  }, undefined, options);
134
134
  }
135
- async updateWidgets(widgets, options) {
135
+ async updateServices(services, options) {
136
136
  const path = `${BASE_PATH}/services.cgi`;
137
- await this._postJsonEncoded(path, JSON.stringify({ services: widgets }), {
137
+ await this._postJsonEncoded(path, JSON.stringify({ services: services }), {
138
138
  action: 'set',
139
139
  }, undefined, options);
140
140
  }
@@ -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 EventEmitter = require("events");
7
+ const events_1 = __importDefault(require("events"));
5
8
  const WsClient_1 = require("./node/WsClient");
6
- class CamOverlayDrawingAPI extends EventEmitter {
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
- EventEmitter.call(this);
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
- if (this.imgFileNames[moniker] !== undefined) {
25
- const imgData = await fs.readFile(this.imgFileNames[moniker]);
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
- if (this.fontFileNames[moniker] !== undefined) {
36
- const fontData = await fs.readFile(this.fontFileNames[moniker]);
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 EventEmitter = require("events");
7
+ const events_1 = __importDefault(require("events"));
5
8
  const WsClient_1 = require("./node/WsClient");
6
- class CamScripterAPICameraEventsGenerator extends EventEmitter {
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
- EventEmitter.call(this);
33
+ events_1.default.call(this);
31
34
  }
32
35
  connect() {
33
36
  this.ws.open();
@@ -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");
@@ -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 AdmZip = require("adm-zip");
4
- const Path = require("path");
5
- const fs = require("fs");
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 = fs.statSync(path);
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 = fs.readFileSync(Path.join(folder, 'manifest.json'));
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(`${Path.basename(folder)}(_[0-9]){3}\\.zip`);
27
- const files = fs.readdirSync(folder);
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 = Path.join(folder, file);
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(Path.join(productionModulesFolder, 'node_modules'), 'node_modules');
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 (!fs.existsSync(productionModulesFolder)) {
54
- fs.mkdirSync(productionModulesFolder, {});
56
+ if (!fs_1.default.existsSync(productionModulesFolder)) {
57
+ fs_1.default.mkdirSync(productionModulesFolder, {});
55
58
  }
56
- fs.cpSync('package.json', Path.join(productionModulesFolder, 'package.json'));
57
- fs.cpSync('package-lock.json', Path.join(productionModulesFolder, 'package-lock.json'));
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: Path.join(process.cwd(), productionModulesFolder),
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 (fs.existsSync('dist')) {
86
+ if (fs_1.default.existsSync('dist')) {
84
87
  options.typeScriptPackage = true;
85
88
  }
86
- const folder = Path.resolve('.');
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 (fs.existsSync(zipFile)) {
96
+ if (fs_1.default.existsSync(zipFile)) {
94
97
  try {
95
- fs.unlinkSync(zipFile);
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 AdmZip();
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
- if (data[camera] !== undefined) {
349
- res[camera - 1] = data[camera]?.map(({ data: itemData, ...d }) => d);
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;
@@ -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 crypto = require("crypto");
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 = crypto.createHash('md5').update(`${user}:${digestItems['realm']}:${pass}`).digest('hex');
17
- const HA2 = crypto.createHash('md5').update(`${method}:${uri}`).digest('hex');
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 = crypto
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 = crypto.createHash('md5').update(`${HA1}:${digestItems['nonce']}:${HA2}`).digest('hex');
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}",` +
@@ -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 http = require("http");
5
- const url = require("url");
6
- const fs = require("fs");
7
- const path = require("path");
8
- const EventEmitter = require("events");
9
- class HttpServer extends EventEmitter {
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 = http.createServer((req, res) => {
23
+ this.server = http_1.default.createServer((req, res) => {
21
24
  this.emit('access', req.method + ' ' + req.url);
22
- const parsedUrl = url.parse(req.url ?? '');
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 = path.parse(pathname).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
- fs.access(pathname, fs.constants.R_OK, (err) => {
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 (fs.statSync(pathname).isDirectory()) {
55
+ if (fs_1.default.statSync(pathname).isDirectory()) {
53
56
  pathname += `/index${ext}`;
54
57
  }
55
- fs.readFile(pathname, (error, data) => {
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}`);
@@ -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 EventEmitter = require("events");
5
- const WebSocket = require("ws");
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 EventEmitter {
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 WebSocket(this.address, this.wsOptions);
48
+ this.ws = new ws_1.default(this.address, this.wsOptions);
46
49
  }
47
50
  else {
48
- this.ws = new WebSocket(this.address, this.protocol, this.wsOptions);
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 !== WebSocket.OPEN) || this.isAlive === false) {
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 !== WebSocket.CLOSING && wsCopy.readyState !== WebSocket.CLOSED) {
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 !== WebSocket.CLOSED) {
132
+ if (wsCopy.readyState !== ws_1.default.CLOSED) {
130
133
  wsCopy.terminate();
131
134
  }
132
135
  }, 5000);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fileDataSchema = exports.fileListSchema = exports.fileSchema = exports.storageResponseSchema = exports.storageDataListSchema = exports.storageSchema = exports.ImageType = exports.isScoreOverview = exports.isBaseballScoreBoardAutomatic = exports.isBaseballScoreBoard = exports.isScoreBoard = exports.isWebCameraSharing = exports.isScreenSharing = exports.isPtz = exports.isPtzCompass = exports.isPip = exports.isInfoticker = exports.isImages = exports.isCustomGraphics = exports.isAccuweather = exports.widgetListSchema = exports.widgetsSchema = exports.WSResponseSchema = void 0;
3
+ exports.fileDataSchema = exports.fileListSchema = exports.fileSchema = exports.storageResponseSchema = exports.storageDataListSchema = exports.storageSchema = exports.ImageType = exports.isScoreOverview = exports.isBaseballScoreBoardAutomatic = exports.isBaseballScoreBoard = exports.isScoreBoard = exports.isWebCameraSharing = exports.isScreenSharing = exports.isPtz = exports.isPtzCompass = exports.isPip = exports.isInfoticker = exports.isImages = exports.isCustomGraphics = exports.isAccuweather = exports.serviceListSchema = exports.servicesSchema = exports.WSResponseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const infotickerSchema_1 = require("./infotickerSchema");
6
6
  const accuweatherSchema_1 = require("./accuweatherSchema");
@@ -16,7 +16,7 @@ exports.WSResponseSchema = zod_1.z.object({
16
16
  status: zod_1.z.number(),
17
17
  message: zod_1.z.string(),
18
18
  });
19
- exports.widgetsSchema = zod_1.z.discriminatedUnion('name', [
19
+ exports.servicesSchema = zod_1.z.discriminatedUnion('name', [
20
20
  infotickerSchema_1.infoTickerSchema,
21
21
  accuweatherSchema_1.accuweatherSchema,
22
22
  ptzCompassSchema_1.ptzCompassSchema,
@@ -31,34 +31,34 @@ exports.widgetsSchema = zod_1.z.discriminatedUnion('name', [
31
31
  scoreBoardSchema_1.baseballScoreBoardAutomaticSchema,
32
32
  scoreBoardSchema_1.scoreOverviewSchema,
33
33
  ]);
34
- exports.widgetListSchema = zod_1.z.object({
35
- services: zod_1.z.array(exports.widgetsSchema),
34
+ exports.serviceListSchema = zod_1.z.object({
35
+ services: zod_1.z.array(exports.servicesSchema),
36
36
  });
37
- const isAccuweather = (widget) => widget.name === 'accuweather';
37
+ const isAccuweather = (service) => service.name === 'accuweather';
38
38
  exports.isAccuweather = isAccuweather;
39
- const isCustomGraphics = (widget) => widget.name === 'customGraphics';
39
+ const isCustomGraphics = (service) => service.name === 'customGraphics';
40
40
  exports.isCustomGraphics = isCustomGraphics;
41
- const isImages = (widget) => widget.name === 'images';
41
+ const isImages = (service) => service.name === 'images';
42
42
  exports.isImages = isImages;
43
- const isInfoticker = (widget) => widget.name === 'infoticker';
43
+ const isInfoticker = (service) => service.name === 'infoticker';
44
44
  exports.isInfoticker = isInfoticker;
45
- const isPip = (widget) => widget.name === 'pip';
45
+ const isPip = (service) => service.name === 'pip';
46
46
  exports.isPip = isPip;
47
- const isPtzCompass = (widget) => widget.name === 'ptzCompass';
47
+ const isPtzCompass = (service) => service.name === 'ptzCompass';
48
48
  exports.isPtzCompass = isPtzCompass;
49
- const isPtz = (widget) => widget.name === 'ptz';
49
+ const isPtz = (service) => service.name === 'ptz';
50
50
  exports.isPtz = isPtz;
51
- const isScreenSharing = (widget) => widget.name === 'screenSharing';
51
+ const isScreenSharing = (service) => service.name === 'screenSharing';
52
52
  exports.isScreenSharing = isScreenSharing;
53
- const isWebCameraSharing = (widget) => widget.name === 'web_camera';
53
+ const isWebCameraSharing = (service) => service.name === 'web_camera';
54
54
  exports.isWebCameraSharing = isWebCameraSharing;
55
- const isScoreBoard = (widget) => widget.name === 'scoreBoard';
55
+ const isScoreBoard = (service) => service.name === 'scoreBoard';
56
56
  exports.isScoreBoard = isScoreBoard;
57
- const isBaseballScoreBoard = (widget) => widget.name === 'baseballScoreBoard';
57
+ const isBaseballScoreBoard = (service) => service.name === 'baseballScoreBoard';
58
58
  exports.isBaseballScoreBoard = isBaseballScoreBoard;
59
- const isBaseballScoreBoardAutomatic = (widget) => widget.name === 'myBallBaseballWidgets';
59
+ const isBaseballScoreBoardAutomatic = (service) => service.name === 'myBallBaseballWidgets';
60
60
  exports.isBaseballScoreBoardAutomatic = isBaseballScoreBoardAutomatic;
61
- const isScoreOverview = (widget) => widget.name === 'scoreOverview';
61
+ const isScoreOverview = (service) => service.name === 'scoreOverview';
62
62
  exports.isScoreOverview = isScoreOverview;
63
63
  var ImageType;
64
64
  (function (ImageType) {
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.accuweatherSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.accuweatherSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.accuweather),
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.accuweatherSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.accuweather),
8
8
  location: zod_1.z.string(),
9
9
  locationName: zod_1.z.string(),
10
10
  title: zod_1.z.string(),
@@ -21,12 +21,12 @@ exports.accuweatherSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
21
21
  zod_1.z.literal('140,150,168,0.95'),
22
22
  ]),
23
23
  clockType: zod_1.z.union([zod_1.z.literal('12h'), zod_1.z.literal('24h')]),
24
- lang: widgetCommonTypes_1.languageSchema,
25
- font: widgetCommonTypes_1.fontSchema,
26
- units: widgetCommonTypes_1.weatherUnitSchema,
24
+ lang: serviceCommonTypes_1.languageSchema,
25
+ font: serviceCommonTypes_1.fontSchema,
26
+ units: serviceCommonTypes_1.weatherUnitSchema,
27
27
  pos_x: zod_1.z.number(),
28
28
  pos_y: zod_1.z.number(),
29
- coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
29
+ coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
30
30
  layout: zod_1.z.union([
31
31
  zod_1.z.literal('0'),
32
32
  zod_1.z.literal('1'),
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fieldSchema = exports.customGraphicsSchema = exports.mappingZoneSchema = exports.mappingZonesCountdownSettingsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
6
  const mappingZonesCommonSchema = zod_1.z.object({
7
7
  name: zod_1.z.string(),
8
8
  pos_x: zod_1.z.number(),
@@ -19,7 +19,7 @@ const mappingZonesCommonSchema = zod_1.z.object({
19
19
  textAlign: zod_1.z.union([zod_1.z.literal('A_LEFT'), zod_1.z.literal('A_CENTER'), zod_1.z.literal('A_RIGHT')]),
20
20
  textVerticalAlign: zod_1.z.union([zod_1.z.literal('VA_TOP'), zod_1.z.literal('VA_CENTER'), zod_1.z.literal('VA_BOTTOM')]),
21
21
  textColor: zod_1.z.string(),
22
- font: widgetCommonTypes_1.fontSchema,
22
+ font: serviceCommonTypes_1.fontSchema,
23
23
  fontSize: zod_1.z.number().nonnegative(),
24
24
  switchingTime: zod_1.z.number().nonnegative(),
25
25
  });
@@ -51,11 +51,11 @@ const mappingZoneCountdownSchema = mappingZonesCommonSchema.extend({
51
51
  settings: exports.mappingZonesCountdownSettingsSchema,
52
52
  });
53
53
  exports.mappingZoneSchema = zod_1.z.discriminatedUnion('type', [mappingZonePlainSchema, mappingZoneCountdownSchema]);
54
- exports.customGraphicsSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
55
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.customGraphics),
54
+ exports.customGraphicsSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
55
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.customGraphics),
56
56
  pos_x: zod_1.z.number(),
57
57
  pos_y: zod_1.z.number(),
58
- coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
58
+ coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
59
59
  clockFormat: zod_1.z.union([zod_1.z.literal('12h'), zod_1.z.literal('24h')]),
60
60
  background: zod_1.z.enum(['custom', 'image']),
61
61
  image: zod_1.z.string(),
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.imagesSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.imagesSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.images),
8
- overlayList: zod_1.z.array(widgetCommonTypes_1.overlaySchema),
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.imagesSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.images),
8
+ overlayList: zod_1.z.array(serviceCommonTypes_1.overlaySchema),
9
9
  });
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CamOverlayAPI"), exports);
18
- __exportStar(require("./widgetCommonTypes"), exports);
18
+ __exportStar(require("./serviceCommonTypes"), exports);
19
19
  __exportStar(require("./accuweatherSchema"), exports);
20
20
  __exportStar(require("./customGraphicsSchema"), exports);
21
21
  __exportStar(require("./imagesSchema"), exports);
@@ -2,24 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.infoTickerSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.infoTickerSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.infoticker),
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.infoTickerSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.infoticker),
8
8
  showClock: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
9
9
  clockType: zod_1.z.union([zod_1.z.literal('12h'), zod_1.z.literal('24h')]),
10
10
  textColor: zod_1.z.string(),
11
11
  bgColor: zod_1.z.string(),
12
12
  weatherLocation: zod_1.z.string(),
13
13
  weatherLocationName: zod_1.z.string(),
14
- weatherLang: widgetCommonTypes_1.languageSchema,
15
- weatherUnits: widgetCommonTypes_1.weatherUnitSchema,
14
+ weatherLang: serviceCommonTypes_1.languageSchema,
15
+ weatherUnits: serviceCommonTypes_1.weatherUnitSchema,
16
16
  numberOfLines: zod_1.z.number().positive(),
17
17
  switchingTime: zod_1.z.number().nonnegative(),
18
18
  crawlLeft: zod_1.z.boolean(),
19
19
  crawlSpeed: zod_1.z.number(),
20
20
  coordSystem: zod_1.z.union([zod_1.z.literal('top'), zod_1.z.literal('bottom')]),
21
21
  pos_y: zod_1.z.number(),
22
- font: widgetCommonTypes_1.fontSchema,
22
+ font: serviceCommonTypes_1.fontSchema,
23
23
  fontSize: zod_1.z.number().nonnegative(),
24
24
  sourceType: zod_1.z.union([zod_1.z.literal('text'), zod_1.z.literal('url')]),
25
25
  source: zod_1.z.string(),
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pipSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.pipSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.pip),
8
- coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.pipSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.pip),
8
+ coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
9
9
  pos_x: zod_1.z.number(),
10
10
  pos_y: zod_1.z.number(),
11
11
  fps: zod_1.z.number(),