Skip to content

@oona/vlo / index / waitFor

Function: waitFor() ​

waitFor<T>(definition, options?): SeqStep

Defined in: sdk/ts/sdk/src/core/helpers/sequence.ts:194

A sequence phase that parks the run until definition is delivered.

The payload is stored in signals[definition.name]. With timeoutMs the wait races the kernel's paired deadline timer (the loser is cancelled): onTimeout: "fail" (default) fails the run, "continue" stores null and advances. context is emitted on the human channel when the wait opens. A signal or deadline arriving for a phase already left behind is ignored.

Type Parameters ​

T ​

T

Parameters ​

definition ​

SignalDef<T>

options? ​

WaitForOptions = {}

Returns ​

SeqStep

Example ​

ts
import { defineWorkflow, sequence, signalOf, step, waitFor } from "@oona/vlo";
import { approve, finish, plan } from "./activities.ts";

export default defineWorkflow("example", sequence([
  step(plan),
  waitFor(approve, { timeoutMs: 86_400_000, onTimeout: "fail", context: { what: "plan" } }),
  step(finish, (state) => ({ uppers: [], approvedBy: signalOf(state, approve).by })),
]));