Interface: FlowBranchBuilder<TFlowIn, TBranchOut, THandle, TBranchId, TReceipt, TCustomMetrics, TStepOutputs>
Defined in: builders/flow-branch-builder.ts:20
Fluent builder for a conditional multi-way branch inside a FlowNode (.branch(id, $b => ...)).
Configures the unified branch output schema, ordered when(predicate, ...) cases, and the required otherwise(...) fallback case.
Extends
AstBuilder<FlowBranchNode<TFlowIn,TBranchOut,THandle,TBranchId>>
Type Parameters
Methods
otherwise()
otherwise<TNextOutputs>(configure): FlowBranchBuilder<TFlowIn, TBranchOut, THandle, TBranchId, TReceipt, TCustomMetrics, TStepOutputs>;Defined in: builders/flow-branch-builder.ts:97
Configures the fallback otherwise($sub => ...) branch executed when no when predicate matches.
Throws at builder call time if the fallback sub-branch returned by configure contains zero steps.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TNextOutputs extends Record<string, unknown> | TStepOutputs | Accumulated step outputs map inside the fallback sub-branch. |
Parameters
| Parameter | Type | Description |
|---|---|---|
configure | ($sub) => FlowSubBranchBuilder<TFlowIn, TBranchOut, THandle, TReceipt, TCustomMetrics, TNextOutputs> | Fallback sub-branch configurator callback. |
Returns
FlowBranchBuilder<TFlowIn, TBranchOut, THandle, TBranchId, TReceipt, TCustomMetrics, TStepOutputs>
New immutable branch builder.
output()
output<TNewBranchOut>(schema): FlowBranchBuilder<TFlowIn, TNewBranchOut, THandle, TBranchId, TReceipt, TCustomMetrics, TStepOutputs>;Defined in: builders/flow-branch-builder.ts:40
Binds the unified Zod output validation schema for all cases of this branch.
Every branch case (when and otherwise) must produce an output conforming to schema.
Type Parameters
| Type Parameter | Description |
|---|---|
TNewBranchOut | Unified branch output payload type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | ZodType<TNewBranchOut> | Zod schema validating the branch output. |
Returns
FlowBranchBuilder<TFlowIn, TNewBranchOut, THandle, TBranchId, TReceipt, TCustomMetrics, TStepOutputs>
New immutable branch builder.
toAST()
toAST(): FlowBranchNode;Defined in: ast/ast-builder.ts:20
Compiles the current builder configuration into a deeply frozen passive AST node.
Validates required builder invariants at compilation time and returns an immutable plain-object AST representation containing zero execution methods.
Returns
Deeply frozen passive AST node.
Inherited from
when()
when<TNextOutputs>(predicate, configure): FlowBranchBuilder<TFlowIn, TBranchOut, THandle, TBranchId, TReceipt, TCustomMetrics, TStepOutputs>;Defined in: builders/flow-branch-builder.ts:64
Appends a conditional when(predicate, $sub => ...) branch case evaluated in declaration order.
Throws at builder call time if the sub-branch returned by configure contains zero steps.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TNextOutputs extends Record<string, unknown> | TStepOutputs | Accumulated step outputs map inside the sub-branch. |
Parameters
| Parameter | Type | Description |
|---|---|---|
predicate | (input) => boolean | Synchronous predicate over flowInput. |
configure | ($sub) => FlowSubBranchBuilder<TFlowIn, TBranchOut, THandle, TReceipt, TCustomMetrics, TNextOutputs> | Sub-branch configurator callback. |
Returns
FlowBranchBuilder<TFlowIn, TBranchOut, THandle, TBranchId, TReceipt, TCustomMetrics, TStepOutputs>
New immutable branch builder.