OutputBuilder
Defined in: plan/output-builder.ts:74
Immutable builder for constructing output objects.
Each method returns a new builder instance with updated type information.
Call build() to get the final output value.
Examples
Section titled “Examples”const builder = createOutputBuilder() .add('name', 'Alice') .add('age', 30)
const result = builder.build()// result: { name: string, age: number }// With metadata annotationsconst builder = createOutputBuilder() .add('name', 'Alice') .meta('name', { description: 'User full name', examples: ['Alice', 'Bob'] }) .add('email', 'alice@example.com') .meta('email', { format: 'email' })
const allMeta = builder.getAllMeta()// Map { 'name' => { description: '...', examples: [...] }, 'email' => { format: 'email' } }Type Parameters
Section titled “Type Parameters”T
The current accumulated type
Methods
Section titled “Methods”add<
K,V>(key,value):OutputBuilder<T&{ [P in string]: V }>
Defined in: plan/output-builder.ts:84
Add a key-value pair to the output.
Type Parameters
Section titled “Type Parameters”K extends string
The key type (string literal)
V
The value type
Parameters
Section titled “Parameters”K
Property name to add
V
Value to set
Returns
Section titled “Returns”OutputBuilder<T & { [P in string]: V }>
New builder with the added property
build()
Section titled “build()”build():
T
Defined in: plan/output-builder.ts:125
Get the final accumulated value.
Returns
Section titled “Returns”T
The built output object
getAllMeta()
Section titled “getAllMeta()”getAllMeta():
ReadonlyMap<string,OutputMeta>
Defined in: plan/output-builder.ts:118
Get all metadata as a readonly map.
Returns
Section titled “Returns”ReadonlyMap<string, OutputMeta>
Map of property names to metadata
getMeta()
Section titled “getMeta()”getMeta<
K>(key):OutputMeta|undefined
Defined in: plan/output-builder.ts:111
Get metadata for a specific property.
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”K
Property name
Returns
Section titled “Returns”OutputMeta | undefined
Metadata if set, undefined otherwise
meta()
Section titled “meta()”meta<
K>(key,metadata):OutputBuilder<T>
Defined in: plan/output-builder.ts:103
Add metadata annotations for a property. Used for JSON schema export and other derivations.
Type Parameters
Section titled “Type Parameters”K extends string
Parameters
Section titled “Parameters”K
Property name to annotate
metadata
Section titled “metadata”Metadata annotations
Returns
Section titled “Returns”OutputBuilder<T>
New builder with the added metadata
set<
V>(value):OutputBuilder<V>
Defined in: plan/output-builder.ts:93
Replace the entire accumulated value.
Type Parameters
Section titled “Type Parameters”V
The new value type
Parameters
Section titled “Parameters”V
Value to set
Returns
Section titled “Returns”OutputBuilder<V>
New builder with the new value