import { PropertyAccessor } from '@cratis/fundamentals'; import { IProjectionBuilder } from './IProjectionBuilder.js'; import type { IFromAllBuilder } from './IFromAllBuilder.js'; /** * Defines the top-level projection builder for a specific read model type. * Extends the core builder with projection-wide configuration options. * @template TReadModel - The read model type this projection produces. */ export interface IProjectionBuilderFor extends IProjectionBuilder> { /** * Subscribes to every event type, including types not explicitly declared. * Mappings share the All block with fromEvery. Unlike fromEvery, this expands the subscription. * @param builderCallback - Callback for configuring all-event assignments and counters. * @returns This builder for fluent chaining. */ fromAll(builderCallback: (builder: IFromAllBuilder) => void): IProjectionBuilderFor; /** * Specifies the event sequence this projection should read from. * @param eventSequenceId - The identifier of the event sequence. * @returns This builder for fluent chaining. */ fromEventSequence(eventSequenceId: string): IProjectionBuilderFor; /** * Sets the container name used to store read model instances (e.g., collection or table name). * @param name - The container name. * @returns This builder for fluent chaining. */ containerName(name: string): IProjectionBuilderFor; /** * Marks this projection as not rewindable, preventing historical event replay. * @returns This builder for fluent chaining. */ notRewindable(): IProjectionBuilderFor; /** * Marks this projection as passive, meaning it will not actively observe events. * @returns This builder for fluent chaining. */ passive(): IProjectionBuilderFor; /** * Declares this projection to be one of several mutually exclusive representations of the * same logical entity. Entering one variant removes the entity from every sibling variant * of the same identity. * @param identity - The type anchoring the logical identity shared by every variant. Does not need to be a read model itself. * @param keyAccessor - Accessor for the property on this variant used as its own key. * @returns This builder for fluent chaining. */ variantOf(identity: Function, keyAccessor: PropertyAccessor): IProjectionBuilderFor; /** * Names an event that may create or resurrect this variant. Repeatable - a variant may enter * on more than one event. Every other event this projection is built from is automatically * reclassified into an update-only join: it can bring an already-active instance up to date, * but it can never create or resurrect one. * @param eventType - The event constructor. * @param key - Optional event property name used as the key. Defaults to the event source identifier. * @returns This builder for fluent chaining. */ entersOn(eventType: Function, key?: string): IProjectionBuilderFor; } //# sourceMappingURL=IProjectionBuilderFor.d.ts.map