camstreamerlib 4.0.0-beta.36 → 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.
- package/cjs/CamOverlayAPI.js +15 -15
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +17 -17
- package/cjs/types/CamOverlayAPI/accuweatherSchema.js +7 -7
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.js +5 -5
- package/cjs/types/CamOverlayAPI/imagesSchema.js +4 -4
- package/cjs/types/CamOverlayAPI/index.js +1 -1
- package/cjs/types/CamOverlayAPI/infotickerSchema.js +6 -6
- package/cjs/types/CamOverlayAPI/pipSchema.js +4 -4
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.js +4 -4
- package/cjs/types/CamOverlayAPI/ptzSchema.js +4 -4
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +8 -8
- package/cjs/types/CamOverlayAPI/screenSharingSchema.js +3 -3
- package/cjs/types/CamOverlayAPI/{widgetCommonTypes.js → serviceCommonTypes.js} +8 -4
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +3 -3
- package/esm/CamOverlayAPI.js +16 -16
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +16 -16
- package/esm/types/CamOverlayAPI/accuweatherSchema.js +3 -3
- package/esm/types/CamOverlayAPI/customGraphicsSchema.js +3 -3
- package/esm/types/CamOverlayAPI/imagesSchema.js +3 -3
- package/esm/types/CamOverlayAPI/index.js +1 -1
- package/esm/types/CamOverlayAPI/infotickerSchema.js +3 -3
- package/esm/types/CamOverlayAPI/pipSchema.js +3 -3
- package/esm/types/CamOverlayAPI/ptzCompassSchema.js +3 -3
- package/esm/types/CamOverlayAPI/ptzSchema.js +3 -3
- package/esm/types/CamOverlayAPI/scoreBoardSchema.js +5 -5
- package/esm/types/CamOverlayAPI/screenSharingSchema.js +2 -2
- package/esm/types/CamOverlayAPI/{widgetCommonTypes.js → serviceCommonTypes.js} +7 -3
- package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +2 -2
- package/package.json +1 -1
- package/types/CamOverlayAPI.d.ts +821 -5
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +18 -18
- package/types/types/CamOverlayAPI/index.d.ts +1 -1
- package/types/types/CamOverlayAPI/{widgetCommonTypes.d.ts → serviceCommonTypes.d.ts} +6 -2
package/cjs/CamOverlayAPI.js
CHANGED
|
@@ -99,7 +99,7 @@ class CamOverlayAPI {
|
|
|
99
99
|
throw new Error(await (0, utils_1.responseStringify)(res));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
async
|
|
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.
|
|
110
|
+
return CamOverlayAPI_1.servicesSchema.parse(data);
|
|
111
111
|
}
|
|
112
|
-
async
|
|
113
|
-
const
|
|
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
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
if (!
|
|
123
|
-
console.warn(`[SERVICE SCHEMA MISMATCH]: 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
|
|
126
|
+
return services;
|
|
127
127
|
}
|
|
128
|
-
async
|
|
128
|
+
async updateSingleService(service, options) {
|
|
129
129
|
const path = `${BASE_PATH}/services.cgi`;
|
|
130
|
-
await this._postJsonEncoded(path, JSON.stringify(
|
|
130
|
+
await this._postJsonEncoded(path, JSON.stringify(service), {
|
|
131
131
|
action: 'set',
|
|
132
|
-
service_id:
|
|
132
|
+
service_id: service.id.toString(),
|
|
133
133
|
}, undefined, options);
|
|
134
134
|
}
|
|
135
|
-
async
|
|
135
|
+
async updateServices(services, options) {
|
|
136
136
|
const path = `${BASE_PATH}/services.cgi`;
|
|
137
|
-
await this._postJsonEncoded(path, JSON.stringify({ services:
|
|
137
|
+
await this._postJsonEncoded(path, JSON.stringify({ services: services }), {
|
|
138
138
|
action: 'set',
|
|
139
139
|
}, undefined, options);
|
|
140
140
|
}
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
35
|
-
services: zod_1.z.array(exports.
|
|
34
|
+
exports.serviceListSchema = zod_1.z.object({
|
|
35
|
+
services: zod_1.z.array(exports.servicesSchema),
|
|
36
36
|
});
|
|
37
|
-
const isAccuweather = (
|
|
37
|
+
const isAccuweather = (service) => service.name === 'accuweather';
|
|
38
38
|
exports.isAccuweather = isAccuweather;
|
|
39
|
-
const isCustomGraphics = (
|
|
39
|
+
const isCustomGraphics = (service) => service.name === 'customGraphics';
|
|
40
40
|
exports.isCustomGraphics = isCustomGraphics;
|
|
41
|
-
const isImages = (
|
|
41
|
+
const isImages = (service) => service.name === 'images';
|
|
42
42
|
exports.isImages = isImages;
|
|
43
|
-
const isInfoticker = (
|
|
43
|
+
const isInfoticker = (service) => service.name === 'infoticker';
|
|
44
44
|
exports.isInfoticker = isInfoticker;
|
|
45
|
-
const isPip = (
|
|
45
|
+
const isPip = (service) => service.name === 'pip';
|
|
46
46
|
exports.isPip = isPip;
|
|
47
|
-
const isPtzCompass = (
|
|
47
|
+
const isPtzCompass = (service) => service.name === 'ptzCompass';
|
|
48
48
|
exports.isPtzCompass = isPtzCompass;
|
|
49
|
-
const isPtz = (
|
|
49
|
+
const isPtz = (service) => service.name === 'ptz';
|
|
50
50
|
exports.isPtz = isPtz;
|
|
51
|
-
const isScreenSharing = (
|
|
51
|
+
const isScreenSharing = (service) => service.name === 'screenSharing';
|
|
52
52
|
exports.isScreenSharing = isScreenSharing;
|
|
53
|
-
const isWebCameraSharing = (
|
|
53
|
+
const isWebCameraSharing = (service) => service.name === 'web_camera';
|
|
54
54
|
exports.isWebCameraSharing = isWebCameraSharing;
|
|
55
|
-
const isScoreBoard = (
|
|
55
|
+
const isScoreBoard = (service) => service.name === 'scoreBoard';
|
|
56
56
|
exports.isScoreBoard = isScoreBoard;
|
|
57
|
-
const isBaseballScoreBoard = (
|
|
57
|
+
const isBaseballScoreBoard = (service) => service.name === 'baseballScoreBoard';
|
|
58
58
|
exports.isBaseballScoreBoard = isBaseballScoreBoard;
|
|
59
|
-
const isBaseballScoreBoardAutomatic = (
|
|
59
|
+
const isBaseballScoreBoardAutomatic = (service) => service.name === 'myBallBaseballWidgets';
|
|
60
60
|
exports.isBaseballScoreBoardAutomatic = isBaseballScoreBoardAutomatic;
|
|
61
|
-
const isScoreOverview = (
|
|
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
|
|
6
|
-
exports.accuweatherSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
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:
|
|
25
|
-
font:
|
|
26
|
-
units:
|
|
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:
|
|
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
|
|
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:
|
|
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 =
|
|
55
|
-
name: zod_1.z.literal(
|
|
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:
|
|
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
|
|
6
|
-
exports.imagesSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
8
|
-
overlayList: zod_1.z.array(
|
|
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("./
|
|
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
|
|
6
|
-
exports.infoTickerSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
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:
|
|
15
|
-
weatherUnits:
|
|
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:
|
|
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
|
|
6
|
-
exports.pipSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
8
|
-
coordSystem:
|
|
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(),
|
|
@@ -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
|
|
6
|
-
exports.ptzCompassSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
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:
|
|
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
|
|
6
|
-
exports.ptzSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
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(
|
|
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
|
|
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(
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
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(
|
|
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:
|
|
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
|
|
6
|
-
exports.screenSharingSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
6
|
-
exports.webCameraSharingSchema =
|
|
7
|
-
name: zod_1.z.literal(
|
|
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
|
});
|
package/esm/CamOverlayAPI.js
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
|
107
|
+
return servicesSchema.parse(data);
|
|
108
108
|
}
|
|
109
|
-
async
|
|
110
|
-
const
|
|
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
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
120
|
-
console.warn(`[SERVICE SCHEMA MISMATCH]: 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
|
|
123
|
+
return services;
|
|
124
124
|
}
|
|
125
|
-
async
|
|
125
|
+
async updateSingleService(service, options) {
|
|
126
126
|
const path = `${BASE_PATH}/services.cgi`;
|
|
127
|
-
await this._postJsonEncoded(path, JSON.stringify(
|
|
127
|
+
await this._postJsonEncoded(path, JSON.stringify(service), {
|
|
128
128
|
action: 'set',
|
|
129
|
-
service_id:
|
|
129
|
+
service_id: service.id.toString(),
|
|
130
130
|
}, undefined, options);
|
|
131
131
|
}
|
|
132
|
-
async
|
|
132
|
+
async updateServices(services, options) {
|
|
133
133
|
const path = `${BASE_PATH}/services.cgi`;
|
|
134
|
-
await this._postJsonEncoded(path, JSON.stringify({ services:
|
|
134
|
+
await this._postJsonEncoded(path, JSON.stringify({ services: services }), {
|
|
135
135
|
action: 'set',
|
|
136
136
|
}, undefined, options);
|
|
137
137
|
}
|
|
@@ -13,7 +13,7 @@ export const WSResponseSchema = z.object({
|
|
|
13
13
|
status: z.number(),
|
|
14
14
|
message: z.string(),
|
|
15
15
|
});
|
|
16
|
-
export const
|
|
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
|
|
32
|
-
services: z.array(
|
|
31
|
+
export const serviceListSchema = z.object({
|
|
32
|
+
services: z.array(servicesSchema),
|
|
33
33
|
});
|
|
34
|
-
export const isAccuweather = (
|
|
35
|
-
export const isCustomGraphics = (
|
|
36
|
-
export const isImages = (
|
|
37
|
-
export const isInfoticker = (
|
|
38
|
-
export const isPip = (
|
|
39
|
-
export const isPtzCompass = (
|
|
40
|
-
export const isPtz = (
|
|
41
|
-
export const isScreenSharing = (
|
|
42
|
-
export const isWebCameraSharing = (
|
|
43
|
-
export const isScoreBoard = (
|
|
44
|
-
export const isBaseballScoreBoard = (
|
|
45
|
-
export const isBaseballScoreBoardAutomatic = (
|
|
46
|
-
export const isScoreOverview = (
|
|
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 {
|
|
3
|
-
export const accuweatherSchema =
|
|
4
|
-
name: z.literal(
|
|
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 {
|
|
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 =
|
|
52
|
-
name: z.literal(
|
|
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 {
|
|
3
|
-
export const imagesSchema =
|
|
4
|
-
name: z.literal(
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export const infoTickerSchema =
|
|
4
|
-
name: z.literal(
|
|
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 {
|
|
3
|
-
export const pipSchema =
|
|
4
|
-
name: z.literal(
|
|
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 {
|
|
3
|
-
export const ptzCompassSchema =
|
|
4
|
-
name: z.literal(
|
|
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,
|