mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
29 lines
829 B
TypeScript
29 lines
829 B
TypeScript
import { z } from 'zod';
|
|
|
|
const runStatusSchema = z.enum(['running', 'succeeded', 'failed']);
|
|
|
|
const createRunSchema = z.object({
|
|
loadId: z.string(),
|
|
config: z.any().optional(),
|
|
data: z.any().optional(),
|
|
});
|
|
|
|
const updateRunSchema = z.object({
|
|
status: runStatusSchema,
|
|
error: z.string().optional(),
|
|
});
|
|
|
|
const findRunsSchema = z.object({
|
|
loadId: z.string().optional(),
|
|
offset: z.number().optional(),
|
|
limit: z.number().optional(),
|
|
});
|
|
|
|
type RunStatus = z.infer<typeof runStatusSchema>;
|
|
type CreateRunOptions = z.infer<typeof createRunSchema>;
|
|
type UpdateRunOptions = z.infer<typeof updateRunSchema>;
|
|
type FindRunsOptions = z.infer<typeof findRunsSchema>;
|
|
|
|
export type { RunStatus, CreateRunOptions, UpdateRunOptions, FindRunsOptions };
|
|
export { runStatusSchema, createRunSchema, updateRunSchema, findRunsSchema };
|