camstreamerlib
Version:
Helper library for CamStreamer ACAP applications.
77 lines (76 loc) • 2.76 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.sharingSchema = exports.overlaySchema = exports.weatherUnitSchema = exports.fontSchema = exports.widgetCommonSchema = exports.languageSchema = exports.coordinateSystemSchema = void 0;
const zod_1 = require("zod");
exports.coordinateSystemSchema = zod_1.z.union([
zod_1.z.literal('top_left'),
zod_1.z.literal('top'),
zod_1.z.literal('top_right'),
zod_1.z.literal('left'),
zod_1.z.literal('center'),
zod_1.z.literal('right'),
zod_1.z.literal('bottom_left'),
zod_1.z.literal('bottom'),
zod_1.z.literal('bottom_right'),
]);
exports.languageSchema = zod_1.z.union([
zod_1.z.literal('en-us'),
zod_1.z.literal('fr-fr'),
zod_1.z.literal('ja-jp'),
zod_1.z.literal('pt-pt'),
zod_1.z.literal('es-es'),
zod_1.z.literal('de-de'),
zod_1.z.literal('ko-kr'),
zod_1.z.literal('zh-hk'),
zod_1.z.literal('zh-cn'),
zod_1.z.literal('nl-nl'),
zod_1.z.literal('cs-cz'),
zod_1.z.literal('ru-ru'),
zod_1.z.literal('sv-se'),
]);
exports.widgetCommonSchema = zod_1.z.object({
id: zod_1.z.number().nonnegative(),
enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
automationType: zod_1.z.union([
zod_1.z.literal('time'),
zod_1.z.literal('manual'),
zod_1.z.literal('schedule'),
zod_1.z.custom((val) => {
return typeof val === 'string' ? /^input\d+$/.test(val) : false;
}),
]),
invertInput: zod_1.z.boolean().optional(),
cameraList: zod_1.z.array(zod_1.z.number()),
camera: zod_1.z.number().nonnegative().optional(),
schedule: zod_1.z.string().optional(),
customName: zod_1.z.string(),
zIndex: zod_1.z.number().optional(),
width: zod_1.z.number().nonnegative(),
height: zod_1.z.number().nonnegative(),
});
exports.fontSchema = zod_1.z.union([
zod_1.z.literal('classic'),
zod_1.z.literal('digital'),
zod_1.z.custom((val) => {
return typeof val === 'string';
}),
]);
exports.weatherUnitSchema = zod_1.z.union([zod_1.z.literal('Metric'), zod_1.z.literal('Imperial')]);
exports.overlaySchema = zod_1.z.object({
active: zod_1.z.boolean(),
coordSystem: exports.coordinateSystemSchema,
pos_x: zod_1.z.number(),
pos_y: zod_1.z.number(),
imgPath: zod_1.z.string(),
imgName: zod_1.z.string(),
duration: zod_1.z.number(),
scale: zod_1.z.number(),
fps: zod_1.z.number().optional(),
});
exports.sharingSchema = exports.widgetCommonSchema.extend({
pos_x: zod_1.z.number().nonnegative(),
pos_y: zod_1.z.number().nonnegative(),
coordSystem: exports.coordinateSystemSchema,
screenSize: zod_1.z.number().positive(),
fps: zod_1.z.number(),
});