Каркас monorepo: scheduler, data_collector, khbuild_assistant_prep, khb_common; миграции; CI/CD
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
25
packages/scheduler/src/settings.ts
Normal file
25
packages/scheduler/src/settings.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const daysSchema = z.union([z.literal("daily"), z.literal("workdays"), z.array(z.enum(["mon", "tue", "wed", "thu", "fri", "sat", "sun"]))]);
|
||||
|
||||
export const jobSchema = z.object({
|
||||
name: z.string(),
|
||||
call: z.object({
|
||||
service: z.string(),
|
||||
method: z.enum(["GET", "POST"]).default("POST"),
|
||||
path: z.string(),
|
||||
body: z.unknown().optional(),
|
||||
}),
|
||||
at: z.string().regex(/^\d{2}:\d{2}$/),
|
||||
days: daysSchema,
|
||||
});
|
||||
|
||||
export const schedulerSchema = z.object({
|
||||
tickSeconds: z.number().default(10),
|
||||
missedGraceSeconds: z.number().default(60),
|
||||
http: z.object({ host: z.string().default("127.0.0.1"), port: z.number(), token: z.string().min(1) }),
|
||||
jobs: z.array(jobSchema),
|
||||
services: z.record(z.object({ baseUrl: z.string(), token: z.string() })),
|
||||
});
|
||||
export type SchedulerSettings = z.infer<typeof schedulerSchema>;
|
||||
export type JobSettings = z.infer<typeof jobSchema>;
|
||||
Reference in New Issue
Block a user