Skip to main content

Interface: StepApi

Defined in: packages/workflow-engine/src/core/steps.ts:228

Durable operations available to a stage.

Never catch errors thrown by ctx.step.* without rethrowing; use isStepControlFlowError when a catch boundary must distinguish suspension.

Properties​

[STEP_API_PENDING_CONTROL_FLOW]?​

readonly optional [STEP_API_PENDING_CONTROL_FLOW]?: () => StepControlFlowError | undefined

Defined in: packages/workflow-engine/src/core/steps.ts:249

Returns​

StepControlFlowError | undefined


[STEP_API_SETTLE_IN_FLIGHT]?​

readonly optional [STEP_API_SETTLE_IN_FLIGHT]?: () => Promise<void>

Defined in: packages/workflow-engine/src/core/steps.ts:259

Wait for every run step still executing in this invocation to settle, bounded by the longest remaining lease. Steps may run concurrently under Promise.all; when one of them suspends, the siblings are given the chance to finish and record before the stage suspends, so the replay finds completed rows instead of live leases (StepInFlight).

Returns​

Promise<void>


ai​

readonly ai: StepAiApi

Defined in: packages/workflow-engine/src/core/steps.ts:248

Durable AI calls and the realtime/batch map primitive.

Methods​

run()​

run<T>(id, fn, options?): Promise<T>

Defined in: packages/workflow-engine/src/core/steps.ts:235

Memoize one side effect by id.

Results round-trip through JSON: Dates become strings, undefined object fields disappear, and Maps/Sets lose their runtime types.

Type Parameters​

T​

T

Parameters​

id​

string

fn​

(step) => Promise<T>

options?​

StepRunOptions

Returns​

Promise<T>


sleep()​

sleep(id, duration): Promise<void>

Defined in: packages/workflow-engine/src/core/steps.ts:246

Parameters​

id​

string

duration​

string | number

Returns​

Promise<void>


waitFor()​

Call Signature​

waitFor<T, U>(id, opts): Promise<U>

Defined in: packages/workflow-engine/src/core/steps.ts:240

Type Parameters​
T​

T

U​

U

Parameters​
id​

string

opts​

StepWaitOptionsNarrowing<T, U>

Returns​

Promise<U>

Call Signature​

waitFor<T>(id, opts): Promise<T>

Defined in: packages/workflow-engine/src/core/steps.ts:244

Type Parameters​
T​

T

Parameters​
id​

string

opts​

StepWaitOptions<T>

Returns​

Promise<T>


waitForSignal()​

waitForSignal<T>(id, opts): Promise<T>

Defined in: packages/workflow-engine/src/core/steps.ts:245

Type Parameters​

T​

T = unknown

Parameters​

id​

string

opts​

StepSignalOptions

Returns​

Promise<T>