UNPKG

@convex-dev/workflow

Version:

Convex component for durably executing workflows.

59 lines 2.17 kB
import type { RetryBehavior, RunResult, WorkpoolOptions } from "@convex-dev/workpool"; import { BaseChannel } from "async-channel"; import { type FunctionReference, type FunctionType, type FunctionVisibility, type GenericDataModel, type GenericMutationCtx } from "convex/server"; import { type JournalEntry } from "../component/schema.js"; import type { TransactionLimits, WorkflowComponent } from "./types.js"; import type { EventId, SchedulerOptions } from "../types.js"; export type WorkerResult = { type: "handlerDone"; runResult: RunResult; } | { type: "executorBlocked"; }; export type StepRequest = { name: string; target: { kind: "function"; functionType: FunctionType; function: FunctionReference<FunctionType, FunctionVisibility>; args: Record<string, unknown>; } | { kind: "event"; args: { eventId?: EventId; }; } | { kind: "workflow"; function: FunctionReference<"mutation", "internal">; args: Record<string, unknown>; } | { kind: "sleep"; args: Record<string, never>; }; retry: RetryBehavior | boolean | undefined; inline: boolean; unstableArgs: boolean; transactionLimits: TransactionLimits | undefined; schedulerOptions: SchedulerOptions; resolve: (result: RunResult) => void; }; export declare class StepExecutor { private workflowId; private generationNumber; private ctx; private component; private journalEntries; private receiver; private now; private workpoolOptions; private journalEntrySize; constructor(workflowId: string, generationNumber: number, ctx: GenericMutationCtx<GenericDataModel>, component: WorkflowComponent, journalEntries: Array<JournalEntry>, receiver: BaseChannel<StepRequest>, now: number, workpoolOptions: WorkpoolOptions | undefined); run(): Promise<WorkerResult>; getGenerationState(): { now: number; latest: boolean; }; completeMessage(message: StepRequest, entry: JournalEntry): void; startSteps(messages: StepRequest[]): Promise<JournalEntry[]>; } //# sourceMappingURL=step.d.ts.map