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