All files / src/services/elevenLabsInternalAPI/textToDialogue request.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57      1x                                                                 1x   1x                                    
import { ProxyURLSchema } from "@/brands/proxyURL";
import z from "zod";
 
const OutputFormats = [
    "ALAW_8000",
    "MP3_22050_32",
    "MP3_24000_48",
    "MP3_44100_128",
    "MP3_44100_192",
    "MP3_44100_32",
    "MP3_44100_64",
    "MP3_44100_96",
    "OPUS_48000_128",
    "OPUS_48000_192",
    "OPUS_48000_32",
    "OPUS_48000_64",
    "OPUS_48000_96",
    "PCM_16000",
    "PCM_22050",
    "PCM_24000",
    "PCM_32000",
    "PCM_44100",
    "PCM_48000",
    "PCM_8000",
    "ULAW_8000",
    "WAV_16000",
    "WAV_22050",
    "WAV_24000",
    "WAV_32000",
    "WAV_44100",
    "WAV_48000",
    "WAV_8000",
] as const;
 
type OutputFormat = Lowercase<(typeof OutputFormats)[number]>;
 
const OutputFormatSchema = z.enum(OutputFormats).transform((val): OutputFormat => val.toLowerCase() as OutputFormat);
 
export const RequestSchema = z.object({
    proxyURL: ProxyURLSchema,
    bearerToken: z.string(),
    inputs: z.array(
        z.object({
            text: z.string(),
            voiceID: z.string(),
        }),
    ),
    languageCode: z.string().optional(),
    modelID: z.string().optional(),
    outputFormat: OutputFormatSchema,
    settings: z.object({
        stability: z.number(),
    }),
});
 
export type RequestType = z.input<typeof RequestSchema>;