Function: fanOut()
fanOut<
I,O>(target,select,options):SeqStep
Defined in: sdk/ts/sdk/src/core/helpers/sequence.ts:113
A sequence phase that runs target once per item select returns, at most concurrency at a time, with step ids ${target.name}#${index}.
select must be pure and read only state written by earlier phases: it is re-evaluated on every event of the phase and the run fails if it returns a different count. Outputs are stored in results[target.name] in item order; an empty selection stores [] and moves on. A task that does not succeed fails the run, unless onFailure: "continue" stores null for that item.
Throws a TypeError synchronously unless concurrency is an integer ≥ 1.
Type Parameters
I
I
O
O
Parameters
target
Activity<I, O>
select
(state) => I[]
options
Returns
Example
ts
import { defineWorkflow, fanOut, resultOf, sequence, step } from "@oona/vlo";
import { plan, work } from "./activities.ts";
export default defineWorkflow("example", sequence([
step(plan),
fanOut(work, (state) => resultOf(state, plan).items.map((item) => ({ item })), { concurrency: 2 }),
]));