footprintjs - v11.2.0
    Preparing search index...

    Interface ParallelForEachConfig<TItem, TScope>

    Runtime fan-out config — one branch per item, branch COUNT decided at runtime from the payload. Design: docs/design/execution-control.md (D2).

    Each branch runs as a generated SUBFLOW (isolated runtime, own commit log, addressable at <stageId>~<index> in every trace query), which is what makes branches unable to corrupt each other's in-flight state.

    interface ParallelForEachConfig<TItem = any, TScope = any> {
        branch: (item: TItem, index: number) => BranchChart;
        failFast?: boolean;
        into: string;
        items: (scope: TScope) => readonly TItem[];
        maxBranches: number;
    }

    Type Parameters

    • TItem = any
    • TScope = any
    Index
    branch: (item: TItem, index: number) => BranchChart

    Builds the chart for ONE item. Called once per executed branch, with the item and its index — close over them, or read the item / index values seeded into the branch's own scope.

    failFast?: boolean

    Fan-out error policy — the SAME policy the existing parallel fan-out uses. true = Promise.all (the first failing branch rejects the stage); omitted/false = best-effort Promise.allSettled (every branch runs; a failed branch's slot in the results array is undefined).

    into: string

    State key the ordered results array is written to on the parent scope. REQUIRED — a key derived from the stage id could silently overwrite state the chart already owns.

    items: (scope: TScope) => readonly TItem[]

    Picks the items to fan out over, from the live scope. Reads here are tracked like any other stage read, so the fan-out's own inputs show up in the trace and in a backward slice.

    maxBranches: number

    Hard ceiling on branches per execution. REQUIRED: an unbounded fan-out driven by model output is a resource attack, so there is no default to forget. Extra items do not run — the truncation is recorded, never silent.