A WorkflowStep defined by passing its handler functions directly,
instead of subclassing WorkflowStep. Reach for this for simple steps —
a few lines calling an API or writing a field onto the context — where a
whole new class would be needless boilerplate. Fully interoperable with
every decorator/composite in this package, since it implements the exact
same WorkflowStep interface a subclass would.
A key-value store shared across every step of a workflow, enforcing
"scoped immutability": once a key has been written by a step, only that
same step may write it again (e.g. from its own rollback) — every
other step gets read-only access to it.
Runs subSteps concurrently as a single WorkflowStep — the concurrent
counterpart to WorkflowStepGroup's sequential composition. Succeeds
only if every sub-step succeeds or is skipped; fails with the first
failure encountered (the others are still awaited to completion, per
Future.wait's default behavior, before this step resolves).
The "parallel" concurrency strategy: every call to run spins up a
fully independent WorkflowRunner (via createRunner) with its own
isolated FlowContext, running concurrently with any other in-flight
calls rather than cancelling or queuing them. See ManagedWorkflowRunner
for the "one current run" strategies (ignore/cancelExisting/enqueue)
and SharedWorkflowRunner for joinOrCreate.
Implements the joinOrCreate concurrency strategy: if no session is
active, join starts a new one via createRunner; if one is already in
flight, join merges into it instead of starting a second physical run
— avoiding duplicate work and UI flicker for shared resources like a
global loading indicator.
A WorkflowStep for work with no natural completion of its own — a live
stream subscription, an open connection, a polling loop, anything that's
simply "started" and then just keeps running. Unlike an ordinary step,
execute() deliberately never resolves on its own once start returns —
it stays pending until this step is cancelled or deactivated (e.g. by a
superseding ManagedWorkflowRunner.cancelExisting run), at which point
stop tears the work down.
A live, queryable snapshot of a WorkflowRunner's progress: which step is
currently executing (forward or rollback), and the last known StepStatus
of every step reached so far.
Lets a whole sub-pipeline of steps be embedded as a single WorkflowStep
inside a parent WorkflowRunner, so large flows can be composed out of named,
independently testable sub-flows instead of one flat list of steps.
Builds a fresh WorkflowRunner (with fresh step instances) for one
logical run. Concurrency-control wrappers (ManagedWorkflowRunner,
ParallelWorkflowRunner, SharedWorkflowRunner) call this once per
logical run rather than reusing a single instance, because both
WorkflowRunner and stateful steps (e.g. InteractiveStep) hold
per-instance mutable state that two overlapping runs can never safely
share.
The WorkflowFailure.error a call resolves with when
ConcurrencyStrategy.enqueue's maxQueueLength is already full — the
call is rejected, not queued, but (like every other outcome in this
package) reported by resolving normally rather than throwing to the
caller.