camstreamerlib
Version:
Helper library for CamStreamer ACAP applications.
71 lines (70 loc) • 2.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cswEventsSchema = void 0;
const zod_1 = require("zod");
const cswEventsDataSchema = zod_1.z.discriminatedUnion('type', [
zod_1.z.object({ type: zod_1.z.literal('authorization'), state: zod_1.z.string() }),
zod_1.z.object({
type: zod_1.z.literal('PlaylistSwitch'),
playlist_name: zod_1.z.string(),
}),
zod_1.z.object({
type: zod_1.z.literal('StreamAvailable'),
stream_name: zod_1.z.string(),
state: zod_1.z.boolean(),
}),
zod_1.z.object({
type: zod_1.z.literal('StreamSwitchAudio'),
stream_name: zod_1.z.string().optional(),
clip_name: zod_1.z.string().optional(),
master_audio: zod_1.z.boolean(),
}),
zod_1.z.object({
type: zod_1.z.literal('StreamSwitchVideoError'),
playlist_name: zod_1.z.string(),
playlist_active_stream: zod_1.z.number(),
stream_name: zod_1.z.string().optional(),
clip_name: zod_1.z.string().optional(),
info: zod_1.z.string(),
}),
zod_1.z.object({
type: zod_1.z.literal('StreamSwitchAudioError'),
stream_name: zod_1.z.string().optional(),
clip_name: zod_1.z.string().optional(),
master_audio: zod_1.z.boolean(),
}),
zod_1.z.object({
type: zod_1.z.literal('StreamSwitchVideo'),
playlist_active_stream: zod_1.z.number(),
stream_name: zod_1.z.string().optional(),
playlist_name: zod_1.z.string().optional(),
clip_name: zod_1.z.string().optional(),
}),
zod_1.z.object({
type: zod_1.z.literal('PlaylistQueueChange'),
queue: zod_1.z.array(zod_1.z.string()),
}),
zod_1.z.object({
type: zod_1.z.literal('ClipUpload'),
clip_name: zod_1.z.string().optional(),
}),
zod_1.z.object({
type: zod_1.z.literal('SwitcherStop'),
default_playlist_id: zod_1.z.string().optional(),
}),
zod_1.z.object({
type: zod_1.z.literal('SwitcherStart'),
default_playlist_id: zod_1.z.string().optional(),
}),
zod_1.z.object({
type: zod_1.z.literal('MediaServerStarted'),
}),
zod_1.z.object({
type: zod_1.z.literal('ClipRemove'),
clip_name: zod_1.z.string(),
}),
]);
exports.cswEventsSchema = zod_1.z.discriminatedUnion('type', [
zod_1.z.object({ type: zod_1.z.literal('init'), data: cswEventsDataSchema }),
...cswEventsDataSchema.options,
]);