* feat: RECORDING_TRANSCRIPTION_READY webhook * refactor: split into diff files and restructuring * feat: finish batch processor finished * chore: types * fix: type error * chore: change name of triggger * test: add unit test * fix: type * fix: type err * chore: test * feat: add booking reference repository and other imp * chore: log * fix: import * chore: type error * fix: update test * fix: test * fix: test * fix: add timeout * chore: move beforeEach * Mock missing env variables to test. These vars are not set in CI --------- Co-authored-by: Hariom <hariombalhara@gmail.com>
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import { z } from "zod";
|
|
|
|
const commonSchema = z
|
|
.object({
|
|
version: z.string(),
|
|
type: z.string(),
|
|
id: z.string(),
|
|
event_ts: z.number().optional(),
|
|
})
|
|
.passthrough();
|
|
|
|
export const meetingEndedSchema = commonSchema.extend({
|
|
payload: z
|
|
.object({
|
|
meeting_id: z.string(),
|
|
end_ts: z.number().optional(),
|
|
room: z.string(),
|
|
start_ts: z.number().optional(),
|
|
})
|
|
.passthrough(),
|
|
});
|
|
|
|
export const recordingReadySchema = commonSchema.extend({
|
|
payload: z.object({
|
|
recording_id: z.string(),
|
|
end_ts: z.number().optional(),
|
|
room_name: z.string(),
|
|
start_ts: z.number().optional(),
|
|
status: z.string(),
|
|
|
|
max_participants: z.number().optional(),
|
|
duration: z.number().optional(),
|
|
s3_key: z.string().optional(),
|
|
}),
|
|
});
|
|
|
|
export const batchProcessorJobFinishedSchema = commonSchema.extend({
|
|
payload: z
|
|
.object({
|
|
id: z.string(),
|
|
status: z.string(),
|
|
input: z.object({
|
|
sourceType: z.string(),
|
|
recordingId: z.string(),
|
|
}),
|
|
output: z
|
|
.object({
|
|
transcription: z.array(z.object({ format: z.string() }).passthrough()),
|
|
})
|
|
.passthrough(),
|
|
})
|
|
.passthrough(),
|
|
});
|
|
|
|
export type TBatchProcessorJobFinished = z.infer<typeof batchProcessorJobFinishedSchema>;
|
|
|
|
export const downloadLinkSchema = z.object({
|
|
download_link: z.string(),
|
|
});
|
|
|
|
export const testRequestSchema = z.object({
|
|
test: z.enum(["test"]),
|
|
});
|