import type { DomainEvent } from "./domain-event"; import { AbstractEntity, type Entity, type TEntity } from "./entity"; export interface AggregateRoot extends Entity { readonly domainEvents: DomainEvent[]; clearDomainEvents(): void; } /** * A cluster of associated objects which act as a single unit for the purpose of data changes. * Each `Aggregate` has a single root and then a boundary which defines what the `Aggregate` is repsonsible for. * * ## Rules * - The `Aggregate Root` is a single, specific `Entity`; * - The `Aggregate Root` is the only object that outside objects are allow to reference; * - Objects within the `Aggregate` can hold "_identity_", which only needs to be distinguishable within the `Aggregate`; * - Objects within the `Aggregate` can hold reference to external Objects; * - The `Aggregate Root` is responsible for enforcing consistency rules within the boundary; * - External objects can not hold reference to objects within the Aggregate boundary; they can only access them transiently via the Aggregate Root * - Delete operations should remove _everything_ within the `Aggregate` boundary; */ export declare abstract class AbstractAggregateRoot extends AbstractEntity implements AggregateRoot { private _domainEvents; protected addDomainEvent(event: DomainEvent): void; clearDomainEvents(): void; get domainEvents(): DomainEvent[]; } //# sourceMappingURL=aggregate-root.d.ts.map