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
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ptzCompassSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.ptzCompassSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.ptzCompass),
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.ptzCompassSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.ptzCompass),
8
8
  pos_x: zod_1.z.number(),
9
9
  pos_y: zod_1.z.number(),
10
- coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
10
+ coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
11
11
  scale: zod_1.z.number().nonnegative(),
12
12
  type: zod_1.z.union([zod_1.z.literal('compass'), zod_1.z.literal('map'), zod_1.z.literal('image')]),
13
13
  image: zod_1.z.union([zod_1.z.string().url(), zod_1.z.literal('')]),
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ptzSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.ptzSchema = widgetCommonTypes_1.widgetCommonSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.ptz),
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.ptzSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.ptz),
8
8
  ptz_positions: zod_1.z.record(zod_1.z.string(), zod_1.z.object({
9
- overlayList: zod_1.z.array(widgetCommonTypes_1.overlaySchema.omit({ active: true, fps: true })),
9
+ overlayList: zod_1.z.array(serviceCommonTypes_1.overlaySchema.omit({ active: true, fps: true })),
10
10
  loop: zod_1.z.boolean(),
11
11
  })),
12
12
  });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scoreOverviewSchema = exports.baseballScoreBoardAutomaticSchema = exports.baseballScoreBoardSchema = exports.scoreBoardSchema = exports.sportFontSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
6
  exports.sportFontSchema = zod_1.z.union([zod_1.z.literal('classic'), zod_1.z.intersection(zod_1.z.string(), zod_1.z.object({}))]);
7
7
  exports.scoreBoardSchema = zod_1.z.object({
8
8
  id: zod_1.z.number().nonnegative(),
@@ -10,10 +10,10 @@ exports.scoreBoardSchema = zod_1.z.object({
10
10
  schedule: zod_1.z.string().optional(),
11
11
  cameraList: zod_1.z.array(zod_1.z.number()),
12
12
  zIndex: zod_1.z.number().nonnegative(),
13
- name: zod_1.z.literal('scoreBoard'),
13
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.scoreBoard),
14
14
  pos_x: zod_1.z.number(),
15
15
  pos_y: zod_1.z.number(),
16
- coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
16
+ coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
17
17
  width: zod_1.z.number(),
18
18
  height: zod_1.z.number(),
19
19
  scale: zod_1.z.number(),
@@ -41,10 +41,10 @@ exports.baseballScoreBoardSchema = zod_1.z.object({
41
41
  schedule: zod_1.z.string().optional(),
42
42
  cameraList: zod_1.z.array(zod_1.z.number()),
43
43
  zIndex: zod_1.z.number().nonnegative(),
44
- name: zod_1.z.literal('baseballScoreBoard'),
44
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.baseballScoreBoard),
45
45
  pos_x: zod_1.z.number(),
46
46
  pos_y: zod_1.z.number(),
47
- coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
47
+ coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
48
48
  width: zod_1.z.number(),
49
49
  height: zod_1.z.number(),
50
50
  scale: zod_1.z.number(),
@@ -78,7 +78,7 @@ exports.baseballScoreBoardAutomaticSchema = zod_1.z.object({
78
78
  schedule: zod_1.z.string().optional(),
79
79
  cameraList: zod_1.z.array(zod_1.z.number()),
80
80
  zIndex: zod_1.z.number().nonnegative(),
81
- name: zod_1.z.literal('myBallBaseballWidgets'),
81
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.myBallBaseballWidgets),
82
82
  width: zod_1.z.number(),
83
83
  height: zod_1.z.number(),
84
84
  scale: zod_1.z.number(),
@@ -103,10 +103,10 @@ exports.scoreOverviewSchema = zod_1.z.object({
103
103
  enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
104
104
  cameraList: zod_1.z.array(zod_1.z.number()),
105
105
  zIndex: zod_1.z.number().nonnegative(),
106
- name: zod_1.z.literal('scoreOverview'),
106
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.scoreOverview),
107
107
  pos_x: zod_1.z.number(),
108
108
  pos_y: zod_1.z.number(),
109
- coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
109
+ coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
110
110
  width: zod_1.z.number(),
111
111
  height: zod_1.z.number(),
112
112
  scale: zod_1.z.number(),
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.screenSharingSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.screenSharingSchema = widgetCommonTypes_1.sharingSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.screenSharing),
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.screenSharingSchema = serviceCommonTypes_1.sharingSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.screenSharing),
8
8
  });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.overlaySchema = exports.sharingSchema = exports.widgetCommonSchema = exports.weatherUnitSchema = exports.fontSchema = exports.languageSchema = exports.coordinateSystemSchema = exports.allowedWidgetNames = void 0;
3
+ exports.overlaySchema = exports.sharingSchema = exports.serviceCommonSchema = exports.weatherUnitSchema = exports.fontSchema = exports.languageSchema = exports.coordinateSystemSchema = exports.serviceNames = void 0;
4
4
  const zod_1 = require("zod");
5
- exports.allowedWidgetNames = {
5
+ exports.serviceNames = {
6
6
  accuweather: 'accuweather',
7
7
  infoticker: 'infoticker',
8
8
  customGraphics: 'customGraphics',
@@ -12,6 +12,10 @@ exports.allowedWidgetNames = {
12
12
  pip: 'pip',
13
13
  screenSharing: 'screenSharing',
14
14
  web_camera: 'web_camera',
15
+ scoreBoard: 'scoreBoard',
16
+ baseballScoreBoard: 'baseballScoreBoard',
17
+ myBallBaseballWidgets: 'myBallBaseballWidgets',
18
+ scoreOverview: 'scoreOverview',
15
19
  };
16
20
  exports.coordinateSystemSchema = zod_1.z.union([
17
21
  zod_1.z.literal('top_left'),
@@ -47,7 +51,7 @@ exports.fontSchema = zod_1.z.union([
47
51
  }),
48
52
  ]);
49
53
  exports.weatherUnitSchema = zod_1.z.union([zod_1.z.literal('Metric'), zod_1.z.literal('Imperial')]);
50
- exports.widgetCommonSchema = zod_1.z.object({
54
+ exports.serviceCommonSchema = zod_1.z.object({
51
55
  id: zod_1.z.number().nonnegative(),
52
56
  enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
53
57
  automationType: zod_1.z.union([
@@ -67,7 +71,7 @@ exports.widgetCommonSchema = zod_1.z.object({
67
71
  width: zod_1.z.number().nonnegative(),
68
72
  height: zod_1.z.number().nonnegative(),
69
73
  });
70
- exports.sharingSchema = exports.widgetCommonSchema.extend({
74
+ exports.sharingSchema = exports.serviceCommonSchema.extend({
71
75
  pos_x: zod_1.z.number().nonnegative(),
72
76
  pos_y: zod_1.z.number().nonnegative(),
73
77
  coordSystem: exports.coordinateSystemSchema,
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webCameraSharingSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
- exports.webCameraSharingSchema = widgetCommonTypes_1.sharingSchema.extend({
7
- name: zod_1.z.literal(widgetCommonTypes_1.allowedWidgetNames.web_camera),
5
+ const serviceCommonTypes_1 = require("./serviceCommonTypes");
6
+ exports.webCameraSharingSchema = serviceCommonTypes_1.sharingSchema.extend({
7
+ name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.web_camera),
8
8
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WsClient = void 0;
4
- const REFRESH_TIMEOUT = 5_000;
4
+ const REFRESH_TIMEOUT = 5000;
5
5
  class WsClient {
6
6
  getUrl;
7
7
  getAuthToken;
@@ -3,7 +3,7 @@ import { ParsingBlobError, ServiceNotFoundError } from './errors/errors';
3
3
  import { networkCameraListSchema } from './types/common';
4
4
  import { z } from 'zod';
5
5
  import { ProxyClient } from './internal/ProxyClient';
6
- import { fileListSchema, ImageType, storageDataListSchema, widgetsSchema, WSResponseSchema, } from './types/CamOverlayAPI';
6
+ import { fileListSchema, ImageType, storageDataListSchema, serviceListSchema, servicesSchema, WSResponseSchema, } from './types/CamOverlayAPI';
7
7
  const BASE_PATH = '/local/camoverlay/api';
8
8
  export class CamOverlayAPI {
9
9
  client;
@@ -96,7 +96,7 @@ export class CamOverlayAPI {
96
96
  throw new Error(await responseStringify(res));
97
97
  }
98
98
  }
99
- async getSingleWidget(serviceId, options) {
99
+ async getSingleService(serviceId, options) {
100
100
  const data = await this._get({
101
101
  path: `${BASE_PATH}/services.cgi`,
102
102
  parameters: {
@@ -104,34 +104,34 @@ export class CamOverlayAPI {
104
104
  service_id: serviceId.toString(),
105
105
  },
106
106
  }, options);
107
- return widgetsSchema.parse(data);
107
+ return servicesSchema.parse(data);
108
108
  }
109
- async getWidgets(options) {
110
- const widgetList = await this._get({
109
+ async getServices(options) {
110
+ const serviceList = await this._get({
111
111
  path: `${BASE_PATH}/services.cgi`,
112
112
  parameters: {
113
113
  action: 'get',
114
114
  },
115
115
  }, options);
116
- const widgets = widgetList.services;
117
- widgets.forEach((widget) => {
118
- const parsedWidget = widgetsSchema.safeParse(widget);
119
- if (!parsedWidget.success) {
120
- console.warn(`[SERVICE SCHEMA MISMATCH]: Service ${widget.name} (${widget.id}) does not match the current schema, or is a hidden service.`);
116
+ const services = serviceListSchema.parse(serviceList).services;
117
+ services.forEach((service) => {
118
+ const parsedService = servicesSchema.safeParse(service);
119
+ if (!parsedService.success) {
120
+ console.warn(`[SERVICE SCHEMA MISMATCH]: Service ${service.name} (${service.id}) does not match the current schema, or is a hidden service.`);
121
121
  }
122
122
  });
123
- return widgets;
123
+ return services;
124
124
  }
125
- async updateSingleWidget(widget, options) {
125
+ async updateSingleService(service, options) {
126
126
  const path = `${BASE_PATH}/services.cgi`;
127
- await this._postJsonEncoded(path, JSON.stringify(widget), {
127
+ await this._postJsonEncoded(path, JSON.stringify(service), {
128
128
  action: 'set',
129
- service_id: widget.id.toString(),
129
+ service_id: service.id.toString(),
130
130
  }, undefined, options);
131
131
  }
132
- async updateWidgets(widgets, options) {
132
+ async updateServices(services, options) {
133
133
  const path = `${BASE_PATH}/services.cgi`;
134
- await this._postJsonEncoded(path, JSON.stringify({ services: widgets }), {
134
+ await this._postJsonEncoded(path, JSON.stringify({ services: services }), {
135
135
  action: 'set',
136
136
  }, undefined, options);
137
137
  }
@@ -1,4 +1,4 @@
1
- import * as EventEmitter from 'events';
1
+ import EventEmitter from 'events';
2
2
  import { WsClient } from './node/WsClient';
3
3
  export class CamOverlayDrawingAPI extends EventEmitter {
4
4
  tls;
@@ -18,8 +18,9 @@ export class ResourceManager {
18
18
  if (this.images[moniker] !== undefined) {
19
19
  return this.images[moniker];
20
20
  }
21
- if (this.imgFileNames[moniker] !== undefined) {
22
- const imgData = await fs.readFile(this.imgFileNames[moniker]);
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
- if (this.fontFileNames[moniker] !== undefined) {
33
- const fontData = await fs.readFile(this.fontFileNames[moniker]);
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
  }
@@ -1,4 +1,4 @@
1
- import * as EventEmitter from 'events';
1
+ import EventEmitter from 'events';
2
2
  import { WsClient } from './node/WsClient';
3
3
  export class CamScripterAPICameraEventsGenerator extends EventEmitter {
4
4
  tls;
@@ -1,6 +1,6 @@
1
- import * as AdmZip from 'adm-zip';
2
- import * as Path from 'path';
3
- import * as fs from 'fs';
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
- if (data[camera] !== undefined) {
346
- res[camera - 1] = data[camera]?.map(({ data: itemData, ...d }) => d);
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;
@@ -1,4 +1,4 @@
1
- import * as crypto from 'crypto';
1
+ import crypto from 'crypto';
2
2
  export class Digest {
3
3
  nonceCount = 1;
4
4
  getAuthHeader(user, pass, method, uri, wwwAuthenticateHeader) {
@@ -1,8 +1,8 @@
1
- import * as http from 'http';
2
- import * as url from 'url';
3
- import * as fs from 'fs';
4
- import * as path from 'path';
5
- import * as EventEmitter from 'events';
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;
@@ -1,5 +1,5 @@
1
- import * as EventEmitter from 'events';
2
- import * as WebSocket from 'ws';
1
+ import EventEmitter from 'events';
2
+ import WebSocket from 'ws';
3
3
  import { Digest } from './Digest';
4
4
  export class WsClient extends EventEmitter {
5
5
  user;
@@ -13,7 +13,7 @@ export const WSResponseSchema = z.object({
13
13
  status: z.number(),
14
14
  message: z.string(),
15
15
  });
16
- export const widgetsSchema = z.discriminatedUnion('name', [
16
+ export const servicesSchema = z.discriminatedUnion('name', [
17
17
  infoTickerSchema,
18
18
  accuweatherSchema,
19
19
  ptzCompassSchema,
@@ -28,22 +28,22 @@ export const widgetsSchema = z.discriminatedUnion('name', [
28
28
  baseballScoreBoardAutomaticSchema,
29
29
  scoreOverviewSchema,
30
30
  ]);
31
- export const widgetListSchema = z.object({
32
- services: z.array(widgetsSchema),
31
+ export const serviceListSchema = z.object({
32
+ services: z.array(servicesSchema),
33
33
  });
34
- export const isAccuweather = (widget) => widget.name === 'accuweather';
35
- export const isCustomGraphics = (widget) => widget.name === 'customGraphics';
36
- export const isImages = (widget) => widget.name === 'images';
37
- export const isInfoticker = (widget) => widget.name === 'infoticker';
38
- export const isPip = (widget) => widget.name === 'pip';
39
- export const isPtzCompass = (widget) => widget.name === 'ptzCompass';
40
- export const isPtz = (widget) => widget.name === 'ptz';
41
- export const isScreenSharing = (widget) => widget.name === 'screenSharing';
42
- export const isWebCameraSharing = (widget) => widget.name === 'web_camera';
43
- export const isScoreBoard = (widget) => widget.name === 'scoreBoard';
44
- export const isBaseballScoreBoard = (widget) => widget.name === 'baseballScoreBoard';
45
- export const isBaseballScoreBoardAutomatic = (widget) => widget.name === 'myBallBaseballWidgets';
46
- export const isScoreOverview = (widget) => widget.name === 'scoreOverview';
34
+ export const isAccuweather = (service) => service.name === 'accuweather';
35
+ export const isCustomGraphics = (service) => service.name === 'customGraphics';
36
+ export const isImages = (service) => service.name === 'images';
37
+ export const isInfoticker = (service) => service.name === 'infoticker';
38
+ export const isPip = (service) => service.name === 'pip';
39
+ export const isPtzCompass = (service) => service.name === 'ptzCompass';
40
+ export const isPtz = (service) => service.name === 'ptz';
41
+ export const isScreenSharing = (service) => service.name === 'screenSharing';
42
+ export const isWebCameraSharing = (service) => service.name === 'web_camera';
43
+ export const isScoreBoard = (service) => service.name === 'scoreBoard';
44
+ export const isBaseballScoreBoard = (service) => service.name === 'baseballScoreBoard';
45
+ export const isBaseballScoreBoardAutomatic = (service) => service.name === 'myBallBaseballWidgets';
46
+ export const isScoreOverview = (service) => service.name === 'scoreOverview';
47
47
  export var ImageType;
48
48
  (function (ImageType) {
49
49
  ImageType[ImageType["PNG"] = 0] = "PNG";
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, coordinateSystemSchema, fontSchema, languageSchema, weatherUnitSchema, widgetCommonSchema, } from './widgetCommonTypes';
3
- export const accuweatherSchema = widgetCommonSchema.extend({
4
- name: z.literal(allowedWidgetNames.accuweather),
2
+ import { serviceNames, coordinateSystemSchema, fontSchema, languageSchema, weatherUnitSchema, serviceCommonSchema, } from './serviceCommonTypes';
3
+ export const accuweatherSchema = serviceCommonSchema.extend({
4
+ name: z.literal(serviceNames.accuweather),
5
5
  location: z.string(),
6
6
  locationName: z.string(),
7
7
  title: z.string(),
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, coordinateSystemSchema, fontSchema, widgetCommonSchema } from './widgetCommonTypes';
2
+ import { serviceNames, coordinateSystemSchema, fontSchema, serviceCommonSchema } from './serviceCommonTypes';
3
3
  const mappingZonesCommonSchema = z.object({
4
4
  name: z.string(),
5
5
  pos_x: z.number(),
@@ -48,8 +48,8 @@ const mappingZoneCountdownSchema = mappingZonesCommonSchema.extend({
48
48
  settings: mappingZonesCountdownSettingsSchema,
49
49
  });
50
50
  export const mappingZoneSchema = z.discriminatedUnion('type', [mappingZonePlainSchema, mappingZoneCountdownSchema]);
51
- export const customGraphicsSchema = widgetCommonSchema.extend({
52
- name: z.literal(allowedWidgetNames.customGraphics),
51
+ export const customGraphicsSchema = serviceCommonSchema.extend({
52
+ name: z.literal(serviceNames.customGraphics),
53
53
  pos_x: z.number(),
54
54
  pos_y: z.number(),
55
55
  coordSystem: coordinateSystemSchema,
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, overlaySchema, widgetCommonSchema } from './widgetCommonTypes';
3
- export const imagesSchema = widgetCommonSchema.extend({
4
- name: z.literal(allowedWidgetNames.images),
2
+ import { serviceNames, overlaySchema, serviceCommonSchema } from './serviceCommonTypes';
3
+ export const imagesSchema = serviceCommonSchema.extend({
4
+ name: z.literal(serviceNames.images),
5
5
  overlayList: z.array(overlaySchema),
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export * from './CamOverlayAPI';
2
- export * from './widgetCommonTypes';
2
+ export * from './serviceCommonTypes';
3
3
  export * from './accuweatherSchema';
4
4
  export * from './customGraphicsSchema';
5
5
  export * from './imagesSchema';
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, fontSchema, languageSchema, weatherUnitSchema, widgetCommonSchema, } from './widgetCommonTypes';
3
- export const infoTickerSchema = widgetCommonSchema.extend({
4
- name: z.literal(allowedWidgetNames.infoticker),
2
+ import { serviceNames, fontSchema, languageSchema, weatherUnitSchema, serviceCommonSchema } from './serviceCommonTypes';
3
+ export const infoTickerSchema = serviceCommonSchema.extend({
4
+ name: z.literal(serviceNames.infoticker),
5
5
  showClock: z.union([z.literal(0), z.literal(1)]),
6
6
  clockType: z.union([z.literal('12h'), z.literal('24h')]),
7
7
  textColor: z.string(),
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, coordinateSystemSchema, widgetCommonSchema } from './widgetCommonTypes';
3
- export const pipSchema = widgetCommonSchema.extend({
4
- name: z.literal(allowedWidgetNames.pip),
2
+ import { serviceNames, coordinateSystemSchema, serviceCommonSchema } from './serviceCommonTypes';
3
+ export const pipSchema = serviceCommonSchema.extend({
4
+ name: z.literal(serviceNames.pip),
5
5
  coordSystem: coordinateSystemSchema,
6
6
  pos_x: z.number(),
7
7
  pos_y: z.number(),
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, coordinateSystemSchema, widgetCommonSchema } from './widgetCommonTypes';
3
- export const ptzCompassSchema = widgetCommonSchema.extend({
4
- name: z.literal(allowedWidgetNames.ptzCompass),
2
+ import { serviceNames, coordinateSystemSchema, serviceCommonSchema } from './serviceCommonTypes';
3
+ export const ptzCompassSchema = serviceCommonSchema.extend({
4
+ name: z.literal(serviceNames.ptzCompass),
5
5
  pos_x: z.number(),
6
6
  pos_y: z.number(),
7
7
  coordSystem: coordinateSystemSchema,
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, overlaySchema, widgetCommonSchema } from './widgetCommonTypes';
3
- export const ptzSchema = widgetCommonSchema.extend({
4
- name: z.literal(allowedWidgetNames.ptz),
2
+ import { serviceNames, overlaySchema, serviceCommonSchema } from './serviceCommonTypes';
3
+ export const ptzSchema = serviceCommonSchema.extend({
4
+ name: z.literal(serviceNames.ptz),
5
5
  ptz_positions: z.record(z.string(), z.object({
6
6
  overlayList: z.array(overlaySchema.omit({ active: true, fps: true })),
7
7
  loop: z.boolean(),
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { coordinateSystemSchema } from './widgetCommonTypes';
2
+ import { coordinateSystemSchema, serviceNames } from './serviceCommonTypes';
3
3
  export const sportFontSchema = z.union([z.literal('classic'), z.intersection(z.string(), z.object({}))]);
4
4
  export const scoreBoardSchema = z.object({
5
5
  id: z.number().nonnegative(),
@@ -7,7 +7,7 @@ export const scoreBoardSchema = z.object({
7
7
  schedule: z.string().optional(),
8
8
  cameraList: z.array(z.number()),
9
9
  zIndex: z.number().nonnegative(),
10
- name: z.literal('scoreBoard'),
10
+ name: z.literal(serviceNames.scoreBoard),
11
11
  pos_x: z.number(),
12
12
  pos_y: z.number(),
13
13
  coordSystem: coordinateSystemSchema,
@@ -38,7 +38,7 @@ export const baseballScoreBoardSchema = z.object({
38
38
  schedule: z.string().optional(),
39
39
  cameraList: z.array(z.number()),
40
40
  zIndex: z.number().nonnegative(),
41
- name: z.literal('baseballScoreBoard'),
41
+ name: z.literal(serviceNames.baseballScoreBoard),
42
42
  pos_x: z.number(),
43
43
  pos_y: z.number(),
44
44
  coordSystem: coordinateSystemSchema,
@@ -75,7 +75,7 @@ export const baseballScoreBoardAutomaticSchema = z.object({
75
75
  schedule: z.string().optional(),
76
76
  cameraList: z.array(z.number()),
77
77
  zIndex: z.number().nonnegative(),
78
- name: z.literal('myBallBaseballWidgets'),
78
+ name: z.literal(serviceNames.myBallBaseballWidgets),
79
79
  width: z.number(),
80
80
  height: z.number(),
81
81
  scale: z.number(),
@@ -100,7 +100,7 @@ export const scoreOverviewSchema = z.object({
100
100
  enabled: z.union([z.literal(0), z.literal(1)]),
101
101
  cameraList: z.array(z.number()),
102
102
  zIndex: z.number().nonnegative(),
103
- name: z.literal('scoreOverview'),
103
+ name: z.literal(serviceNames.scoreOverview),
104
104
  pos_x: z.number(),
105
105
  pos_y: z.number(),
106
106
  coordSystem: coordinateSystemSchema,
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, sharingSchema } from './widgetCommonTypes';
2
+ import { serviceNames, sharingSchema } from './serviceCommonTypes';
3
3
  export const screenSharingSchema = sharingSchema.extend({
4
- name: z.literal(allowedWidgetNames.screenSharing),
4
+ name: z.literal(serviceNames.screenSharing),
5
5
  });
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export const allowedWidgetNames = {
2
+ export const serviceNames = {
3
3
  accuweather: 'accuweather',
4
4
  infoticker: 'infoticker',
5
5
  customGraphics: 'customGraphics',
@@ -9,6 +9,10 @@ export const allowedWidgetNames = {
9
9
  pip: 'pip',
10
10
  screenSharing: 'screenSharing',
11
11
  web_camera: 'web_camera',
12
+ scoreBoard: 'scoreBoard',
13
+ baseballScoreBoard: 'baseballScoreBoard',
14
+ myBallBaseballWidgets: 'myBallBaseballWidgets',
15
+ scoreOverview: 'scoreOverview',
12
16
  };
13
17
  export const coordinateSystemSchema = z.union([
14
18
  z.literal('top_left'),
@@ -44,7 +48,7 @@ export const fontSchema = z.union([
44
48
  }),
45
49
  ]);
46
50
  export const weatherUnitSchema = z.union([z.literal('Metric'), z.literal('Imperial')]);
47
- export const widgetCommonSchema = z.object({
51
+ export const serviceCommonSchema = z.object({
48
52
  id: z.number().nonnegative(),
49
53
  enabled: z.union([z.literal(0), z.literal(1)]),
50
54
  automationType: z.union([
@@ -64,7 +68,7 @@ export const widgetCommonSchema = z.object({
64
68
  width: z.number().nonnegative(),
65
69
  height: z.number().nonnegative(),
66
70
  });
67
- export const sharingSchema = widgetCommonSchema.extend({
71
+ export const sharingSchema = serviceCommonSchema.extend({
68
72
  pos_x: z.number().nonnegative(),
69
73
  pos_y: z.number().nonnegative(),
70
74
  coordSystem: coordinateSystemSchema,
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { allowedWidgetNames, sharingSchema } from './widgetCommonTypes';
2
+ import { serviceNames, sharingSchema } from './serviceCommonTypes';
3
3
  export const webCameraSharingSchema = sharingSchema.extend({
4
- name: z.literal(allowedWidgetNames.web_camera),
4
+ name: z.literal(serviceNames.web_camera),
5
5
  });
@@ -1,4 +1,4 @@
1
- const REFRESH_TIMEOUT = 5_000;
1
+ const REFRESH_TIMEOUT = 5000;
2
2
  export class WsClient {
3
3
  getUrl;
4
4
  getAuthToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.35",
3
+ "version": "4.0.0-beta.37",
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",