A step completed from outside: send(token) starts work elsewhere and
returns; the workflow waits until a process holding the token calls
engine.complete(token, value) or engine.fail(token, error). send
is retried under the retry policy, each attempt with a new token.
Asks another workflow to cancel, once this point is durable.
Starts a child workflow and waits for its result.
Registers a step that undoes what the workflow did so far: if the
workflow fails or is cancelled, every registered compensation runs as a
step named name, newest first, then the failure is thrown. Register it
after the step it undoes succeeded:
const hold = await ctx.step("reserve", () => inventory.reserve(sku));
ctx.compensate("release", () => inventory.release(hold));
Ends this run and starts a new run of the same ID with input, in one record. Never resolves.
Marks a patch whose old branch was removed.
Progress of the running step. Coalesced; never waits for the disk.
Journal operations this run made so far (deterministic).
A key stable across retries and recovery for the step whose function is running (distinct for each run of a workflow ID, including a reset one). Pass it to services that accept idempotency keys.
The current time in Unix ms, recorded.
Key key of object type type, called from this workflow or handler:
each call is a journal operation, sent through the durable outbox and
run exactly once; call resolves with the handler's recorded result.
True for new runs, and for running ones the first time they get here after the deploy.
The latest progress the running step reported, also from before a crash.
A random number in [0, 1), recorded.
Records search attributes (null removes a key). They are never encrypted.
Sends a signal to another workflow once this run is durable through here.
signal under the name every SDK uses.
Sleeps durably; the run is parked out of memory while it waits.
Sleeps durably until at; the run is parked out of memory while it waits.
Starts a child workflow without waiting for it. By default it is
terminated when this workflow closes; parentClose: "abandon" lets it
outlive it.
Runs fn as a durable step. fn runs only once everything this run
recorded before is durable (at once with readOnly); its result is
recorded and returned without waiting for the disk. On replay the
recorded result is returned and fn does not run.
Opens the run's stream name for appending (readers follow it with
run.stream(name)). In workflow code it opens a stream of the run: its
appends are recorded once (a replay appends nothing), and close() or
the run's end completes it; steps may append to it too. Inside a step's
function it opens a stream of the step, which the step's result
completes; an attempt that runs again finds what earlier attempts
recorded in recorded() and continues after it.
A random UUID, recorded.
Waits for the next signal name. Resolves undefined on timeout.
The workflow context.