/** * Composed sequences: a body that builds one value out of several. * * A `` whose children are not all named ``s composes. Every * unnamed `` and every `` literal is concatenated, in declaration * order, into the sequence's own value; a named `` is a field beside it, * reached as `${{Name.Field}}` and contributing nothing to the concatenation. * * Both engines walk the body in ONE pass, because the order the gens draw in is * part of the cross-language contract: taking the named ones first and the * unnamed ones after would shift every column that follows. */ import type { Sequence, SequenceItem } from './types.js'; /** A body item that draws: a named field or an unnamed part. */ type DrawingItem = Extract; /** What the in-memory engine needs from its caller to draw one gen's column. */ export type DrawColumn = (item: DrawingItem, n: number) => string[]; /** The composed value and the named fields, both over the applicable rows. */ export interface ComposedColumns { readonly composed: string[]; readonly fields: Map; } /** * Draw a composed body over `applicableCount` rows. * * The caller supplies the draw so this module stays out of the generator * machinery — it owns the ORDER, which is the part that matters, and nothing * else. */ export declare function drawComposed(items: readonly SequenceItem[], applicableCount: number, draw: DrawColumn): ComposedColumns; /** What the streaming engine needs: a per-row resolver for one gen. */ export type BuildPart = (streamId: string, item: SequenceItem & { kind: 'field' | 'gen'; }) => Sequence; export interface ComposedStream { readonly sequence: Sequence; readonly fields: Map; } /** * The streaming counterpart: every part keeps a stream of its own, so a row is * a function of its index exactly as any other. * * Parts are numbered among the UNNAMED ones (`#p0`, `#p1`, …), so adding a * literal between two gens moves nothing. */ export declare function buildComposedStream(name: string, items: readonly SequenceItem[], build: BuildPart): ComposedStream; /** * Whether the body composes a value of its own. * * A body of nothing but named items — fields and constants — has none, and * `${{Name}}` stays the literal marker that says you meant `${{Name.Field}}`. */ export declare function composesOwnValue(items: readonly SequenceItem[]): boolean; /** * The one part of a composed body that a `uniq="true"` draw applies to. * * A composed value is a concatenation, so it is unique exactly when the join is * injective — true when ONE part is drawn and the rest are constants, because * appending a constant cannot make two different draws collide. Two drawn parts * is the variable-width trap (`9` + `15` and `91` + `5` join alike) and the * validator refuses it (TDC220), so this returns nothing rather than guessing. */ export declare function uniqDrawPart(items: readonly SequenceItem[], uniq: boolean): SequenceItem | undefined; export {}; //# sourceMappingURL=composed.d.ts.map