camstreamerlib
Version:
Helper library for CamStreamer ACAP applications.
73 lines (72 loc) • 3.21 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fieldSchema = exports.customGraphicsSchema = exports.mappingZoneSchema = exports.mappingZonesCountdownSettingsSchema = void 0;
const zod_1 = require("zod");
const serviceCommonTypes_1 = require("./serviceCommonTypes");
const mappingZonesCommonSchema = zod_1.z.object({
name: zod_1.z.string(),
pos_x: zod_1.z.number(),
pos_y: zod_1.z.number(),
text: zod_1.z
.array(zod_1.z.object({
source: zod_1.z.string(),
active: zod_1.z.boolean(),
}))
.optional(),
wrapText: zod_1.z.boolean(),
textLines: zod_1.z.number().positive(),
textWidth: zod_1.z.number().nonnegative(),
textAlign: zod_1.z.union([zod_1.z.literal('A_LEFT'), zod_1.z.literal('A_CENTER'), zod_1.z.literal('A_RIGHT')]),
textVerticalAlign: zod_1.z.union([zod_1.z.literal('VA_TOP'), zod_1.z.literal('VA_CENTER'), zod_1.z.literal('VA_BOTTOM')]),
textColor: zod_1.z.string(),
font: serviceCommonTypes_1.fontSchema,
fontSize: zod_1.z.number().nonnegative(),
switchingTime: zod_1.z.number().nonnegative(),
});
exports.mappingZonesCountdownSettingsSchema = zod_1.z.object({
startDate: zod_1.z.number().nonnegative(),
targetDate: zod_1.z.number().nonnegative(),
countdown: zod_1.z.boolean(),
countup: zod_1.z.boolean(),
displayDay: zod_1.z.boolean(),
displayHour: zod_1.z.boolean(),
displayMinute: zod_1.z.boolean(),
displaySeconds: zod_1.z.boolean(),
idleText: zod_1.z.string(),
hideZeros: zod_1.z.boolean(),
delimiter: zod_1.z.union([zod_1.z.literal('colon'), zod_1.z.literal('letters')]),
suffixSeconds: zod_1.z.string(),
suffixMinute: zod_1.z.string(),
suffixHour: zod_1.z.string(),
suffixDay: zod_1.z.string(),
loop: zod_1.z.boolean(),
loopPeriod: zod_1.z.number().nonnegative(),
waitingPeriod: zod_1.z.number().nonnegative(),
});
const mappingZonePlainSchema = mappingZonesCommonSchema.extend({
type: zod_1.z.literal('plain'),
});
const mappingZoneCountdownSchema = mappingZonesCommonSchema.extend({
type: zod_1.z.literal('countdown'),
settings: exports.mappingZonesCountdownSettingsSchema,
});
exports.mappingZoneSchema = zod_1.z.discriminatedUnion('type', [mappingZonePlainSchema, mappingZoneCountdownSchema]);
exports.customGraphicsSchema = serviceCommonTypes_1.serviceCommonSchema.extend({
name: zod_1.z.literal(serviceCommonTypes_1.serviceNames.customGraphics),
pos_x: zod_1.z.number(),
pos_y: zod_1.z.number(),
coordSystem: serviceCommonTypes_1.coordinateSystemSchema,
clockFormat: zod_1.z.union([zod_1.z.literal('12h'), zod_1.z.literal('24h')]),
background: zod_1.z.enum(['custom', 'image']),
image: zod_1.z.string(),
customAreaColor: zod_1.z.string(),
customAreaWidth: zod_1.z.number().nonnegative(),
customAreaHeight: zod_1.z.number().nonnegative(),
customAreaCorners: zod_1.z.union([zod_1.z.literal('sharp'), zod_1.z.literal('rounded')]),
mappingZones: zod_1.z.array(exports.mappingZoneSchema),
});
exports.fieldSchema = zod_1.z.object({
field_name: zod_1.z.string(),
text: zod_1.z.string(),
color: zod_1.z.string().optional(),
});