mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-29 02:24:02 +02:00
scheduled works
This commit is contained in:
parent
66dc065996
commit
9587368acf
6 changed files with 237 additions and 47 deletions
|
|
@ -1,10 +1,30 @@
|
|||
import z from 'zod';
|
||||
|
||||
export const TrackScheduleSchema = z.discriminatedUnion('type', [
|
||||
z.object({
|
||||
type: z.literal('cron'),
|
||||
expression: z.string(),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal('window'),
|
||||
cron: z.string(),
|
||||
startTime: z.string(),
|
||||
endTime: z.string(),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal('once'),
|
||||
runAt: z.string(),
|
||||
}),
|
||||
]);
|
||||
|
||||
export type TrackSchedule = z.infer<typeof TrackScheduleSchema>;
|
||||
|
||||
export const TrackBlockSchema = z.object({
|
||||
trackId: z.string(),
|
||||
instruction: z.string(),
|
||||
matchCriteria: z.string().optional(),
|
||||
active: z.boolean().default(true),
|
||||
schedule: TrackScheduleSchema.optional(),
|
||||
lastRunAt: z.string().optional(),
|
||||
lastRunId: z.string().optional(),
|
||||
lastRunSummary: z.string().optional(),
|
||||
|
|
@ -31,5 +51,4 @@ export const TrackRunCompleteEvent = z.object({
|
|||
export const TrackEvent = z.union([TrackRunStartEvent, TrackRunCompleteEvent]);
|
||||
|
||||
export type TrackBlock = z.infer<typeof TrackBlockSchema>;
|
||||
export type TrackResult = z.infer<typeof TrackResultSchema>;
|
||||
export type TrackEventType = z.infer<typeof TrackEvent>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue