53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { z } from "zod";
|
|
import { subtitleSchema } from "./contract";
|
|
export const audioJobInputSchema = z
|
|
.object({
|
|
operation: z.enum(["transcribe", "separate"]),
|
|
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
bytes: z
|
|
.number()
|
|
.int()
|
|
.positive()
|
|
.max(70 * 1024 * 1024),
|
|
})
|
|
.strict();
|
|
export type AudioJobInput = z.infer<typeof audioJobInputSchema>;
|
|
export const audioJobStatusSchema = z.object({
|
|
id: z.string().regex(/^[a-f0-9]{64}$/),
|
|
status: z.enum([
|
|
"awaiting-input",
|
|
"queued",
|
|
"running",
|
|
"succeeded",
|
|
"failed",
|
|
]),
|
|
stage: z.string().max(300),
|
|
error: z.string().max(500).optional(),
|
|
result: z
|
|
.object({
|
|
subtitles: z.array(subtitleSchema).max(500).optional(),
|
|
durationSeconds: z.number().positive().max(180.1),
|
|
stems: z
|
|
.object({
|
|
vocals: z.object({
|
|
bytes: z
|
|
.number()
|
|
.int()
|
|
.positive()
|
|
.max(70 * 1024 * 1024),
|
|
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
}),
|
|
background: z.object({
|
|
bytes: z
|
|
.number()
|
|
.int()
|
|
.positive()
|
|
.max(70 * 1024 * 1024),
|
|
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
}),
|
|
})
|
|
.optional(),
|
|
})
|
|
.optional(),
|
|
});
|