Signature
tsSignature
export function runChild<I, O, E, C extends object>( behavior: Behavior<I, O, E, C>, input: I, context: RuntimeContext<C>, childControllers: AbortController[],): Promise<Result<O, E | RuntimeError>>;Imports
tsImport
import { runChild } from "@/lib/flow/core/record";import { runChild } from "@/lib/flow";Type Parameters
IInput type.
OOutput type.
EExpected domain error type.
CCustom context type.
Parameters
behaviorBehavior<I, O, E, C>
Child behavior to execute.
inputI
Input passed to the child.
contextParent runtime context.
childControllersAbortController[]
Mutable collection of child controllers owned by the parent helper.
Returns
Child result including runtime errors.
Return type
Promise<Result<O, E | RuntimeError>>Details
This advanced runtime helper lets parent helpers cancel child work independently while still
respecting parent cancellation.
Related Symbols
Behavior
Executable Flow workflow unit.
type
input
Creates an identity behavior for starting typed pipelines.
function
Result
Explicit success-or-failure outcome used throughout Flow.
type
RuntimeContext
Execution context passed to every behavior.
type
RuntimeError
Runtime-level failure union added around every behavior's domain error type.
type
Source
tsflow/core/record.ts:152-164
export function runChild<I, O, E, C extends object>( behavior: Behavior<I, O, E, C>, input: I, context: RuntimeContext<C>, childControllers: AbortController[],): Promise<Result<O, E | RuntimeError>> { const { controller, unlink } = createLinkedController(context.signal); childControllers.push(controller);
return runBehavior(behavior, input, contextWithSignal(context, controller.signal)).finally( unlink, );}