Skip to content

Interface: CommandBuilder<TIn, TOut, THandle> ​

Defined in: builders/command-builder.ts:16

Fluent builder for a deterministic TypeScript step command (P.command(id)).

Configures input and output Zod validation schemas, optional active partition extraction, and the passive asynchronous step callback.

Extends ​

Type Parameters ​

Type ParameterDefault typeDescription
TInunknownValidated command input payload type.
TOutunknownValidated command output payload type.
THandleunknownRuntime handle type of the active isolation scope.

Methods ​

input() ​

ts
input<TNewIn>(schema): CommandBuilder<TNewIn, TOut, THandle>;

Defined in: builders/command-builder.ts:32

Binds the Zod input validation schema for the command step.

Resets any previously bound extractPartitions or run callbacks when the input type changes.

Type Parameters ​

Type ParameterDescription
TNewInValidated command input payload type.

Parameters ​

ParameterTypeDescription
schemaZodType<TNewIn>Zod schema validating step input.

Returns ​

CommandBuilder<TNewIn, TOut, THandle>

New immutable command builder.


output() ​

ts
output<TNewOut>(schema): CommandBuilder<TIn, TNewOut, THandle>;

Defined in: builders/command-builder.ts:47

Binds the Zod output validation schema for the command step.

Resets any previously bound run callback when the output type changes.

Type Parameters ​

Type ParameterDescription
TNewOutValidated command output payload type.

Parameters ​

ParameterTypeDescription
schemaZodType<TNewOut>Zod schema validating step output.

Returns ​

CommandBuilder<TIn, TNewOut, THandle>

New immutable command builder.


partitions() ​

ts
partitions(extractor): CommandBuilder<TIn, TOut, THandle>;

Defined in: builders/command-builder.ts:60

Binds an optional synchronous partition extractor mapping validated TIn to active partition IDs.

Populates ResolutionContext.activePartitions when the command step executes.

Parameters ​

ParameterTypeDescription
extractor(input) => readonly string[]Partition ID extractor callback.

Returns ​

CommandBuilder<TIn, TOut, THandle>

New immutable command builder.


run() ​

ts
run<TNewHandle>(fn): CommandBuilder<TIn, TOut, TNewHandle>;

Defined in: builders/command-builder.ts:73

Binds the passive asynchronous step callback executed by the runtime's executeCommand executor.

Narrows the builder's scope handle type parameter to TNewHandle.

Type Parameters ​

Type ParameterDefault typeDescription
TNewHandleTHandleRuntime handle type of the active isolation scope.

Parameters ​

ParameterTypeDescription
fn(input, ctx) => Promise<TOut>Passive step callback.

Returns ​

CommandBuilder<TIn, TOut, TNewHandle>

New immutable command builder.


toAST() ​

ts
toAST(): CommandNode;

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 ​

CommandNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST

Properties ​

PropertyModifierTypeDescriptionDefined in
idreadonlystringUnique identifier of the command step.builders/command-builder.ts:19

Released under the MIT License.