Signature
export function allSettled<const B extends BehaviorRecord>( behaviors: B, options?: { concurrency?: number },): Behavior<RecordInput<B>, SettledRecord<B>, never, RecordContext<B>>;Imports
import { allSettled } from "@/lib/flow/all-settled";import { allSettled } from "@/lib/flow";Type Parameters
BBehavior record type.
Parameters
optionsOptional concurrency limit.
Returns
A behavior producing a keyed record of child results.
Behavior<RecordInput<B>, SettledRecord<B>, never, RecordContext<B>>Details
Unlike `all`, domain failures from one child do not cancel siblings. Parent cancellation still
aborts active children and returns a cancellation runtime error for the whole operation.
Examples
const loadEverything = allSettled({ profile: loadProfile, recommendations: loadRecommendations,});Related Symbols
Runs keyed behaviors in parallel and fails fast on the first child failure.
Executable Flow workflow unit.
Object map of named behaviors for `all`, `allSettled`, and `race`.
Converts a structural result-like value into a branded Flow result.
Intersects the custom context types of every behavior in a record.
Intersects the input types of every behavior in a record.
Maps each behavior key to the full result returned by that child.
Source
export function allSettled<const B extends BehaviorRecord>( behaviors: B, options?: { concurrency?: number },): Behavior<RecordInput<B>, SettledRecord<B>, never, RecordContext<B>> { return async (input, context) => { if (context.signal.aborted) { return resultFromSignal(context.signal); }
return runSettled(behaviors, input, context, options?.concurrency); };}