UNPKG

@clipwhisperer/common

Version:

ClipWhisperer Common - Shared library providing core utilities, database schemas, authentication, bucket management, and common functionality across all ClipWhisperer microservices

808 lines (807 loc) 25.4 kB
import { z } from "zod"; /** * Speech Mark Schema - represents precise word timing from AWS Polly */ export declare const speechMarkSchema: z.ZodObject<{ time: z.ZodNumber; type: z.ZodEnum<["word", "sentence", "ssml"]>; start: z.ZodNumber; end: z.ZodNumber; value: z.ZodString; }, "strip", z.ZodTypeAny, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }>; export type SpeechMark = z.infer<typeof speechMarkSchema>; /** * Narrator Service Response Schema */ export declare const narratorResponseSchema: z.ZodObject<{ audioId: z.ZodString; audioUrl: z.ZodString; speechMarks: z.ZodArray<z.ZodObject<{ time: z.ZodNumber; type: z.ZodEnum<["word", "sentence", "ssml"]>; start: z.ZodNumber; end: z.ZodNumber; value: z.ZodString; }, "strip", z.ZodTypeAny, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }>, "many">; duration: z.ZodNumber; wordCount: z.ZodNumber; metadata: z.ZodObject<{ voiceId: z.ZodString; engine: z.ZodString; outputFormat: z.ZodString; fileSize: z.ZodNumber; }, "strip", z.ZodTypeAny, { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }, { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }>; }, "strip", z.ZodTypeAny, { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }, { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }>; export type NarratorResponse = z.infer<typeof narratorResponseSchema>; /** * Hub to Narrator Request Schema */ export declare const hubToNarratorRequestSchema: z.ZodObject<{ text: z.ZodString; voiceId: z.ZodDefault<z.ZodOptional<z.ZodString>>; engine: z.ZodDefault<z.ZodOptional<z.ZodString>>; outputFormat: z.ZodDefault<z.ZodOptional<z.ZodString>>; metadata: z.ZodObject<{ videoId: z.ZodString; requestId: z.ZodString; }, "strip", z.ZodTypeAny, { videoId?: string; requestId?: string; }, { videoId?: string; requestId?: string; }>; }, "strip", z.ZodTypeAny, { metadata?: { videoId?: string; requestId?: string; }; voiceId?: string; engine?: string; outputFormat?: string; text?: string; }, { metadata?: { videoId?: string; requestId?: string; }; voiceId?: string; engine?: string; outputFormat?: string; text?: string; }>; export type HubToNarratorRequest = z.infer<typeof hubToNarratorRequestSchema>; /** * Hub to Renderer Request Schema */ export declare const hubToRendererRequestSchema: z.ZodObject<{ videoId: z.ZodString; audioUrl: z.ZodString; speechMarks: z.ZodArray<z.ZodObject<{ time: z.ZodNumber; type: z.ZodEnum<["word", "sentence", "ssml"]>; start: z.ZodNumber; end: z.ZodNumber; value: z.ZodString; }, "strip", z.ZodTypeAny, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }>, "many">; backgroundVideoPath: z.ZodOptional<z.ZodString>; config: z.ZodOptional<z.ZodObject<{ fontSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; fontColor: z.ZodDefault<z.ZodOptional<z.ZodString>>; fontFamily: z.ZodDefault<z.ZodOptional<z.ZodString>>; backgroundColor: z.ZodDefault<z.ZodOptional<z.ZodString>>; wordsPerGroup: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; minimumDisplayTime: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; }, "strip", z.ZodTypeAny, { fontSize?: number; fontColor?: string; fontFamily?: string; backgroundColor?: string; wordsPerGroup?: number; minimumDisplayTime?: number; }, { fontSize?: number; fontColor?: string; fontFamily?: string; backgroundColor?: string; wordsPerGroup?: number; minimumDisplayTime?: number; }>>; metadata: z.ZodObject<{ requestId: z.ZodString; narratorAudioId: z.ZodString; }, "strip", z.ZodTypeAny, { requestId?: string; narratorAudioId?: string; }, { requestId?: string; narratorAudioId?: string; }>; }, "strip", z.ZodTypeAny, { metadata?: { requestId?: string; narratorAudioId?: string; }; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; videoId?: string; backgroundVideoPath?: string; config?: { fontSize?: number; fontColor?: string; fontFamily?: string; backgroundColor?: string; wordsPerGroup?: number; minimumDisplayTime?: number; }; }, { metadata?: { requestId?: string; narratorAudioId?: string; }; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; videoId?: string; backgroundVideoPath?: string; config?: { fontSize?: number; fontColor?: string; fontFamily?: string; backgroundColor?: string; wordsPerGroup?: number; minimumDisplayTime?: number; }; }>; export type HubToRendererRequest = z.infer<typeof hubToRendererRequestSchema>; /** * Renderer Response Schema */ export declare const rendererResponseSchema: z.ZodObject<{ videoId: z.ZodString; outputPath: z.ZodString; duration: z.ZodNumber; fileSize: z.ZodNumber; wordTimings: z.ZodArray<z.ZodObject<{ word: z.ZodString; startTime: z.ZodNumber; endTime: z.ZodNumber; }, "strip", z.ZodTypeAny, { word?: string; startTime?: number; endTime?: number; }, { word?: string; startTime?: number; endTime?: number; }>, "many">; metadata: z.ZodObject<{ renderTime: z.ZodNumber; audioSource: z.ZodString; speechMarksCount: z.ZodNumber; }, "strip", z.ZodTypeAny, { renderTime?: number; audioSource?: string; speechMarksCount?: number; }, { renderTime?: number; audioSource?: string; speechMarksCount?: number; }>; }, "strip", z.ZodTypeAny, { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }, { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }>; export type RendererResponse = z.infer<typeof rendererResponseSchema>; /** * Complete Workflow Status Schema */ export declare const workflowStatusSchema: z.ZodObject<{ videoId: z.ZodString; status: z.ZodEnum<["pending", "scraping", "scrape_complete", "narrating", "narration_complete", "rendering", "render_complete", "completed", "failed"]>; progress: z.ZodNumber; currentStep: z.ZodString; steps: z.ZodObject<{ scraping: z.ZodObject<{ status: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>; startTime: z.ZodOptional<z.ZodDate>; endTime: z.ZodOptional<z.ZodDate>; data: z.ZodOptional<z.ZodAny>; }, "strip", z.ZodTypeAny, { status?: "pending" | "completed" | "failed" | "in_progress"; data?: any; startTime?: Date; endTime?: Date; }, { status?: "pending" | "completed" | "failed" | "in_progress"; data?: any; startTime?: Date; endTime?: Date; }>; narration: z.ZodObject<{ status: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>; startTime: z.ZodOptional<z.ZodDate>; endTime: z.ZodOptional<z.ZodDate>; data: z.ZodOptional<z.ZodObject<{ audioId: z.ZodString; audioUrl: z.ZodString; speechMarks: z.ZodArray<z.ZodObject<{ time: z.ZodNumber; type: z.ZodEnum<["word", "sentence", "ssml"]>; start: z.ZodNumber; end: z.ZodNumber; value: z.ZodString; }, "strip", z.ZodTypeAny, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }, { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }>, "many">; duration: z.ZodNumber; wordCount: z.ZodNumber; metadata: z.ZodObject<{ voiceId: z.ZodString; engine: z.ZodString; outputFormat: z.ZodString; fileSize: z.ZodNumber; }, "strip", z.ZodTypeAny, { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }, { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }>; }, "strip", z.ZodTypeAny, { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }, { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }>>; }, "strip", z.ZodTypeAny, { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }; startTime?: Date; endTime?: Date; }, { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }; startTime?: Date; endTime?: Date; }>; rendering: z.ZodObject<{ status: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>; startTime: z.ZodOptional<z.ZodDate>; endTime: z.ZodOptional<z.ZodDate>; data: z.ZodOptional<z.ZodObject<{ videoId: z.ZodString; outputPath: z.ZodString; duration: z.ZodNumber; fileSize: z.ZodNumber; wordTimings: z.ZodArray<z.ZodObject<{ word: z.ZodString; startTime: z.ZodNumber; endTime: z.ZodNumber; }, "strip", z.ZodTypeAny, { word?: string; startTime?: number; endTime?: number; }, { word?: string; startTime?: number; endTime?: number; }>, "many">; metadata: z.ZodObject<{ renderTime: z.ZodNumber; audioSource: z.ZodString; speechMarksCount: z.ZodNumber; }, "strip", z.ZodTypeAny, { renderTime?: number; audioSource?: string; speechMarksCount?: number; }, { renderTime?: number; audioSource?: string; speechMarksCount?: number; }>; }, "strip", z.ZodTypeAny, { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }, { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }>>; }, "strip", z.ZodTypeAny, { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }; startTime?: Date; endTime?: Date; }, { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }; startTime?: Date; endTime?: Date; }>; }, "strip", z.ZodTypeAny, { scraping?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: any; startTime?: Date; endTime?: Date; }; rendering?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }; startTime?: Date; endTime?: Date; }; narration?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }; startTime?: Date; endTime?: Date; }; }, { scraping?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: any; startTime?: Date; endTime?: Date; }; rendering?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }; startTime?: Date; endTime?: Date; }; narration?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }; startTime?: Date; endTime?: Date; }; }>; error: z.ZodOptional<z.ZodString>; createdAt: z.ZodDate; updatedAt: z.ZodDate; }, "strip", z.ZodTypeAny, { status?: "pending" | "scraping" | "scrape_complete" | "narrating" | "narration_complete" | "rendering" | "render_complete" | "completed" | "failed"; error?: string; videoId?: string; progress?: number; currentStep?: string; steps?: { scraping?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: any; startTime?: Date; endTime?: Date; }; rendering?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }; startTime?: Date; endTime?: Date; }; narration?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }; startTime?: Date; endTime?: Date; }; }; createdAt?: Date; updatedAt?: Date; }, { status?: "pending" | "scraping" | "scrape_complete" | "narrating" | "narration_complete" | "rendering" | "render_complete" | "completed" | "failed"; error?: string; videoId?: string; progress?: number; currentStep?: string; steps?: { scraping?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: any; startTime?: Date; endTime?: Date; }; rendering?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { renderTime?: number; audioSource?: string; speechMarksCount?: number; }; fileSize?: number; videoId?: string; outputPath?: string; wordTimings?: { word?: string; startTime?: number; endTime?: number; }[]; }; startTime?: Date; endTime?: Date; }; narration?: { status?: "pending" | "completed" | "failed" | "in_progress"; data?: { duration?: number; metadata?: { voiceId?: string; engine?: string; outputFormat?: string; fileSize?: number; }; audioId?: string; audioUrl?: string; speechMarks?: { value?: string; type?: "word" | "sentence" | "ssml"; end?: number; time?: number; start?: number; }[]; wordCount?: number; }; startTime?: Date; endTime?: Date; }; }; createdAt?: Date; updatedAt?: Date; }>; export type WorkflowStatus = z.infer<typeof workflowStatusSchema>;