import { AggregateRootId, AggregateRootVersion, CommittedAggregateEvents, EventSourceId, EventType, IEventTypes } from '@dolittle/sdk.events'; import { AppliedEvent } from './AppliedEvent'; /** * Represents the aggregate root. */ export declare class AggregateRoot { readonly eventSourceId: EventSourceId; private _aggregateRootId?; private _aggregateRootType; private _appliedEvents; private _version; private _eventTypes; /** * Initialises a new instance of the {@link AggregateRoot} class. * @param {EventSourceId} eventSourceId - The event source id of the aggregate root. */ constructor(eventSourceId: EventSourceId); /** * Gets aggregate root id. */ get aggregateRootId(): AggregateRootId; /** * Sets the aggregate root id - internal use. */ set aggregateRootId(value: AggregateRootId); /** * Sets the event types - internal use. */ set eventTypes(value: IEventTypes); /** * Gets the version of the aggregate root. */ get version(): AggregateRootVersion; /** * Gets all applied events. */ get appliedEvents(): AppliedEvent[]; /** * Apply an event to the aggregate root that will be committed to the event store. * @param {any} event - Event type apply. * @param {EventType} [eventType] - Optional type of event to apply. */ apply(event: any, eventType?: EventType): void; /** * Apply a public event to the aggregate root that will be committed to the event store. * @param {any} event - Event type apply. * @param {EventType} [eventType] - Optional type of event to apply. */ applyPublic(event: any, eventType?: EventType): void; /** * Re-applies the committed aggregate events to rehydrate the state of the aggregate root by calling on()-methods and incrementing the in-memory version. * @param {CommittedAggregateEvents} committedEvents - The events to re-apply. */ reApply(committedEvents: CommittedAggregateEvents): void; /** * Move to next version. */ nextVersion(): void; private applyImplementation; private invokeOnMethod; private throwIfEventContentIsNullOrUndefined; private getOnMethodFor; private throwIfAggregateRootVersionIsOutOfOrder; private throwIfEventWasAppliedByOtherAggreateRoot; private throwIfEventWasAppliedToOtherEventSource; } //# sourceMappingURL=AggregateRoot.d.ts.map