import { AutoMap } from '@cratis/chronicle.contracts'; import { IFromBuilder } from './IFromBuilder.js'; import { IFromEveryBuilder } from './IFromEveryBuilder.js'; import { IJoinBuilder } from './IJoinBuilder.js'; import { IRemovedWithBuilder } from './IRemovedWithBuilder.js'; import { IRemovedWithJoinBuilder } from './IRemovedWithJoinBuilder.js'; /** The contract-level event type identifier shape used across projection definitions. */ export type ContractEventType = { Id: string; Generation: number; Tombstone: boolean; }; /** Accumulated property mapping for a from clause. */ export interface FromRecord { Key: ContractEventType; Value: { Properties: Record; Key: string; ParentKey: string; }; } /** Accumulated property mapping for a join clause. */ export interface JoinRecord { Key: ContractEventType; Value: { On: string; Properties: Record; Key: string; }; } /** Accumulated removal mapping for a removedWith clause. */ export interface RemovedWithRecord { Key: ContractEventType; Value: { Key: string; ParentKey: string; }; } /** Accumulated removal mapping for a removedWithJoin clause. */ export interface RemovedWithJoinRecord { Key: ContractEventType; Value: { Key: string; }; } /** * Plain object shape matching the wire-level `ChildrenDefinition` used for both children * collections and nested single-object projections. */ export interface ChildrenDefinitionLike { IdentifiedBy: string; From: FromRecord[]; Join: JoinRecord[]; Children: Record; All: { Properties: Record; IncludeChildren: boolean; AutoMap: AutoMap; }; FromEventProperty?: { Event: ContractEventType | undefined; PropertyExpression: string; }; RemovedWith: RemovedWithRecord[]; RemovedWithJoin: RemovedWithJoinRecord[]; AutoMap: AutoMap; Nested: Record; } /** * Base accumulator shared by every projection-shaped builder (the top-level * {@link ProjectionBuilderFor}, and the child/nested builders reached through * `.children()`/`.nested()`). Holds the from/join/fromEvery/removedWith/removedWithJoin/ * children/nested state and the mapping operations common to all of them, mirroring the * shared `ProjectionBuilder` base class on the C# client. * @template TReadModel - The read model type this builder produces. * @template TBuilder - The concrete builder type returned for fluent chaining. */ export declare abstract class ProjectionBuilderCore { protected _autoMap: AutoMap; protected _initialState: string; protected readonly _from: FromRecord[]; protected readonly _join: JoinRecord[]; private readonly _joinEventNames; protected readonly _removedWith: RemovedWithRecord[]; protected readonly _removedWithJoin: RemovedWithJoinRecord[]; protected readonly _children: Record; protected readonly _nested: Record; protected _all: { Properties: Record; IncludeChildren: boolean; AutoMap: AutoMap; }; /** @inheritdoc */ autoMap(): TBuilder; /** @inheritdoc */ noAutoMap(): TBuilder; /** @inheritdoc */ withInitialValues(initialValueProvider: () => TReadModel): TBuilder; /** @inheritdoc */ from(eventType: new (...args: any[]) => TEvent, builderCallback?: (builder: IFromBuilder) => void): TBuilder; /** @inheritdoc */ join(eventType: new (...args: any[]) => TEvent, builderCallback?: (builder: IJoinBuilder) => void): TBuilder; /** @inheritdoc */ fromEvery(builderCallback: (builder: IFromEveryBuilder) => void): TBuilder; /** @inheritdoc */ removedWith(eventType: new (...args: any[]) => TEvent, builderCallback?: (builder: IRemovedWithBuilder) => void): TBuilder; /** @inheritdoc */ removedWithJoin(eventType: new (...args: any[]) => TEvent, builderCallback?: (builder: IRemovedWithJoinBuilder) => void): TBuilder; /** Resolves join defaults once the entire projection (including identifiedBy) is configured. */ protected resolveJoins(): void; /** Returns a default join-on path for children, if one is available. */ protected defaultJoinOn(): string | undefined; /** * Creates an empty {@link ChildrenDefinitionLike} accumulator for a children/nested entry. * @returns A fresh, empty children definition. */ protected createEmptyChildrenDefinition(): ChildrenDefinitionLike; /** * Merges `.addChild()` accumulations captured on a from/join builder into this builder's * children definitions, creating the target child entry on first use. * @param eventType - The contract event type the child additions were captured for. * @param children - The accumulated child additions. */ private mergeChildAdditions; /** * Resolves the contract event type for a decorated event constructor. * @param eventTypeConstructor - The event class constructor. * @returns The contract-level event type identifier. */ protected toContractEventType(eventTypeConstructor: Function): ContractEventType; } //# sourceMappingURL=ProjectionBuilderCore.d.ts.map