editia-core
Version:
Core services and utilities for Editia applications - Authentication, Monetization, Video Generation Types, and Database Management
435 lines • 16.3 kB
TypeScript
/**
* Shared Zod validation schemas for video generation
* Replaces duplicated validation logic across mobile and server-primary
*/
import { z } from 'zod';
import { VideoRequestStatus } from './constants';
export declare const VideoIdSchema: z.ZodBranded<z.ZodString, "VideoId">;
export declare const ScriptIdSchema: z.ZodBranded<z.ZodString, "ScriptId">;
export declare const UserIdSchema: z.ZodBranded<z.ZodString, "UserId">;
export declare const GenerationJobIdSchema: z.ZodBranded<z.ZodString, "GenerationJobId">;
export declare const HexColorSchema: z.ZodBranded<z.ZodString, "HexColor">;
export declare const CaptionConfigurationSchema: z.ZodObject<{
enabled: z.ZodBoolean;
presetId: z.ZodOptional<z.ZodString>;
placement: z.ZodEnum<["top", "center", "bottom"]>;
transcriptColor: z.ZodOptional<z.ZodBranded<z.ZodString, "HexColor">>;
transcriptEffect: z.ZodOptional<z.ZodEnum<["karaoke", "highlight", "fade", "bounce", "slide", "enlarge"]>>;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: (string & z.BRAND<"HexColor">) | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
}, {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: string | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
}>;
export declare const VideoEditorialProfileSchema: z.ZodObject<{
persona_description: z.ZodString;
tone_of_voice: z.ZodString;
audience: z.ZodString;
style_notes: z.ZodString;
examples: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
}, {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
}>;
export declare const VideoTypeSchema: z.ZodObject<{
id: z.ZodBranded<z.ZodString, "VideoId">;
title: z.ZodString;
description: z.ZodString;
upload_url: z.ZodString;
tags: z.ZodArray<z.ZodString, "many">;
user_id: z.ZodBranded<z.ZodString, "UserId">;
created_at: z.ZodOptional<z.ZodString>;
duration_seconds: z.ZodNullable<z.ZodNumber>;
analysis_status: z.ZodOptional<z.ZodString>;
analysis_data: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string & z.BRAND<"VideoId">;
user_id: string & z.BRAND<"UserId">;
title: string;
description: string;
upload_url: string;
tags: string[];
duration_seconds: number | null;
created_at?: string | undefined;
analysis_status?: string | undefined;
analysis_data?: unknown;
}, {
id: string;
user_id: string;
title: string;
description: string;
upload_url: string;
tags: string[];
duration_seconds: number | null;
created_at?: string | undefined;
analysis_status?: string | undefined;
analysis_data?: unknown;
}>;
export declare const VideoGenerationRequestSchema: z.ZodObject<{
scriptId: z.ZodOptional<z.ZodBranded<z.ZodString, "ScriptId">>;
prompt: z.ZodString;
selectedVideoIds: z.ZodArray<z.ZodBranded<z.ZodString, "VideoId">, "many">;
captionConfig: z.ZodObject<{
enabled: z.ZodBoolean;
presetId: z.ZodOptional<z.ZodString>;
placement: z.ZodEnum<["top", "center", "bottom"]>;
transcriptColor: z.ZodOptional<z.ZodBranded<z.ZodString, "HexColor">>;
transcriptEffect: z.ZodOptional<z.ZodEnum<["karaoke", "highlight", "fade", "bounce", "slide", "enlarge"]>>;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: (string & z.BRAND<"HexColor">) | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
}, {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: string | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
}>;
editorialProfile: z.ZodObject<{
persona_description: z.ZodString;
tone_of_voice: z.ZodString;
audience: z.ZodString;
style_notes: z.ZodString;
examples: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
}, {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
}>;
outputLanguage: z.ZodEnum<[import("./constants").Language, ...import("./constants").Language[]]>;
userId: z.ZodBranded<z.ZodString, "UserId">;
}, "strip", z.ZodTypeAny, {
prompt: string;
selectedVideoIds: (string & z.BRAND<"VideoId">)[];
captionConfig: {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: (string & z.BRAND<"HexColor">) | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
};
editorialProfile: {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
};
outputLanguage: import("./constants").Language;
userId: string & z.BRAND<"UserId">;
scriptId?: (string & z.BRAND<"ScriptId">) | undefined;
}, {
prompt: string;
selectedVideoIds: string[];
captionConfig: {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: string | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
};
editorialProfile: {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
};
outputLanguage: import("./constants").Language;
userId: string;
scriptId?: string | undefined;
}>;
export declare const VideoGenerationResultSchema: z.ZodObject<{
jobId: z.ZodBranded<z.ZodString, "GenerationJobId">;
status: z.ZodNativeEnum<typeof VideoRequestStatus>;
message: z.ZodString;
estimatedDuration: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
status: VideoRequestStatus;
message: string;
jobId: string & z.BRAND<"GenerationJobId">;
estimatedDuration?: number | undefined;
}, {
status: VideoRequestStatus;
message: string;
jobId: string;
estimatedDuration?: number | undefined;
}>;
export declare const VideoRequestSchema: z.ZodObject<{
id: z.ZodBranded<z.ZodString, "GenerationJobId">;
user_id: z.ZodBranded<z.ZodString, "UserId">;
script_id: z.ZodOptional<z.ZodBranded<z.ZodString, "ScriptId">>;
prompt: z.ZodString;
selected_videos: z.ZodArray<z.ZodBranded<z.ZodString, "VideoId">, "many">;
caption_config: z.ZodObject<{
enabled: z.ZodBoolean;
presetId: z.ZodOptional<z.ZodString>;
placement: z.ZodEnum<["top", "center", "bottom"]>;
transcriptColor: z.ZodOptional<z.ZodBranded<z.ZodString, "HexColor">>;
transcriptEffect: z.ZodOptional<z.ZodEnum<["karaoke", "highlight", "fade", "bounce", "slide", "enlarge"]>>;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: (string & z.BRAND<"HexColor">) | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
}, {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: string | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
}>;
editorial_profile: z.ZodObject<{
persona_description: z.ZodString;
tone_of_voice: z.ZodString;
audience: z.ZodString;
style_notes: z.ZodString;
examples: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
}, {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
}>;
output_language: z.ZodEnum<[import("./constants").Language, ...import("./constants").Language[]]>;
status: z.ZodNativeEnum<typeof VideoRequestStatus>;
created_at: z.ZodString;
updated_at: z.ZodString;
error_message: z.ZodOptional<z.ZodString>;
video_url: z.ZodOptional<z.ZodString>;
thumbnail_url: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id: string & z.BRAND<"GenerationJobId">;
user_id: string & z.BRAND<"UserId">;
status: VideoRequestStatus;
created_at: string;
prompt: string;
selected_videos: (string & z.BRAND<"VideoId">)[];
caption_config: {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: (string & z.BRAND<"HexColor">) | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
};
editorial_profile: {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
};
output_language: import("./constants").Language;
updated_at: string;
script_id?: (string & z.BRAND<"ScriptId">) | undefined;
error_message?: string | undefined;
video_url?: string | undefined;
thumbnail_url?: string | undefined;
}, {
id: string;
user_id: string;
status: VideoRequestStatus;
created_at: string;
prompt: string;
selected_videos: string[];
caption_config: {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: string | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
};
editorial_profile: {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
};
output_language: import("./constants").Language;
updated_at: string;
script_id?: string | undefined;
error_message?: string | undefined;
video_url?: string | undefined;
thumbnail_url?: string | undefined;
}>;
export declare const ApiResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
success: z.ZodBoolean;
data: z.ZodOptional<T>;
error: z.ZodOptional<z.ZodString>;
status: z.ZodNumber;
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
success: z.ZodBoolean;
data: z.ZodOptional<T>;
error: z.ZodOptional<z.ZodString>;
status: z.ZodNumber;
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
success: z.ZodBoolean;
data: z.ZodOptional<T>;
error: z.ZodOptional<z.ZodString>;
status: z.ZodNumber;
}>, any>[k]; } : never, z.baseObjectInputType<{
success: z.ZodBoolean;
data: z.ZodOptional<T>;
error: z.ZodOptional<z.ZodString>;
status: z.ZodNumber;
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
success: z.ZodBoolean;
data: z.ZodOptional<T>;
error: z.ZodOptional<z.ZodString>;
status: z.ZodNumber;
}>[k_1]; } : never>;
export declare const VideoStatusResponseSchema: z.ZodObject<{
id: z.ZodBranded<z.ZodString, "GenerationJobId">;
status: z.ZodNativeEnum<typeof VideoRequestStatus>;
progress: z.ZodOptional<z.ZodNumber>;
error_message: z.ZodOptional<z.ZodString>;
video_url: z.ZodOptional<z.ZodString>;
thumbnail_url: z.ZodOptional<z.ZodString>;
updated_at: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string & z.BRAND<"GenerationJobId">;
status: VideoRequestStatus;
updated_at: string;
error_message?: string | undefined;
video_url?: string | undefined;
thumbnail_url?: string | undefined;
progress?: number | undefined;
}, {
id: string;
status: VideoRequestStatus;
updated_at: string;
error_message?: string | undefined;
video_url?: string | undefined;
thumbnail_url?: string | undefined;
progress?: number | undefined;
}>;
export declare const ScenePlanSchema: z.ZodObject<{
id: z.ZodString;
startTime: z.ZodNumber;
endTime: z.ZodNumber;
duration: z.ZodNumber;
text: z.ZodString;
videoId: z.ZodBranded<z.ZodString, "VideoId">;
}, "strip", z.ZodTypeAny, {
id: string;
startTime: number;
endTime: number;
duration: number;
text: string;
videoId: string & z.BRAND<"VideoId">;
}, {
id: string;
startTime: number;
endTime: number;
duration: number;
text: string;
videoId: string;
}>;
export declare const validateVideoDuration: (scriptLength: number, videoDuration: number) => boolean;
export declare const validateCaptionConfig: (config: unknown) => config is {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: (string & z.BRAND<"HexColor">) | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
};
export declare const validateVideoEditorialProfile: (profile: unknown) => profile is {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
};
export declare const validateVideoGenerationRequest: (request: unknown) => request is {
prompt: string;
selectedVideoIds: (string & z.BRAND<"VideoId">)[];
captionConfig: {
enabled: boolean;
placement: "top" | "center" | "bottom";
presetId?: string | undefined;
transcriptColor?: (string & z.BRAND<"HexColor">) | undefined;
transcriptEffect?: "karaoke" | "highlight" | "fade" | "bounce" | "slide" | "enlarge" | undefined;
};
editorialProfile: {
persona_description: string;
tone_of_voice: string;
audience: string;
style_notes: string;
examples?: string | undefined;
};
outputLanguage: import("./constants").Language;
userId: string & z.BRAND<"UserId">;
scriptId?: (string & z.BRAND<"ScriptId">) | undefined;
};
export declare const isValidHexColor: (color: unknown) => color is string;
export declare const isValidVideo: (video: unknown) => video is {
id: string & z.BRAND<"VideoId">;
user_id: string & z.BRAND<"UserId">;
title: string;
description: string;
upload_url: string;
tags: string[];
duration_seconds: number | null;
created_at?: string | undefined;
analysis_status?: string | undefined;
analysis_data?: unknown;
};
export declare const TemplateValidationResultSchema: z.ZodObject<{
isValid: z.ZodBoolean;
warnings: z.ZodArray<z.ZodString, "many">;
errors: z.ZodArray<z.ZodString, "many">;
captionsEnabled: z.ZodBoolean;
totalDuration: z.ZodNumber;
requiredDuration: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
isValid: boolean;
warnings: string[];
errors: string[];
captionsEnabled: boolean;
totalDuration: number;
requiredDuration: number;
}, {
isValid: boolean;
warnings: string[];
errors: string[];
captionsEnabled: boolean;
totalDuration: number;
requiredDuration: number;
}>;
//# sourceMappingURL=validation.d.ts.map