Skip to content
File

Blob: src/worker/dispatch/workflows/types.ts

typescript33 lines
1import { type UnixTimestampMs as UnixTimestampMsType } from "@/contracts";
2import type { RunExecutionOutcome } from "@/worker/dispatch/shared/run-execution-context";
3 
4export interface ClaimedWorkflowStepResult {
5 kind: "claimed";
6 startedAt: UnixTimestampMsType;
7}
8 
9export interface StaleWorkflowStepResult {
10 kind: "stale";
11 reason: string;
12}
13 
14export interface RecoveredWorkflowStepResult {
15 kind: "recovered";
16}
17 
18export type WorkflowClaimResult = ClaimedWorkflowStepResult | RecoveredWorkflowStepResult | StaleWorkflowStepResult;
19export type WorkflowRunTerminalStatus = Extract<RunExecutionOutcome["kind"], "passed" | "failed" | "canceled">;
20 
21export type WorkflowRunResult =
22 | {
23 kind: "executed";
24 terminalStatus: WorkflowRunTerminalStatus;
25 }
26 | {
27 kind: "recovered";
28 }
29 | {
30 kind: "stale";
31 reason: string;
32 };