import { Cancellation } from '@dolittle/sdk.resilience'; import { AggregateRootId } from '../AggregateRootId'; import { AggregateRootVersion } from '../AggregateRootVersion'; import { EventSourceId, EventSourceIdLike } from '../EventSourceId'; import { EventType } from '../EventType'; import { EventTypeIdLike } from '../EventTypeId'; import { CommitForAggregateBuilder } from './Builders/CommitForAggregateBuilder'; import { CommitAggregateEventsResult } from './CommitAggregateEventsResult'; import { CommitEventsResult } from './CommitEventsResult'; import { CommittedAggregateEvents } from './CommittedAggregateEvents'; import { UncommittedAggregateEvents } from './UncommittedAggregateEvents'; import { UncommittedEvent } from './UncommittedEvent'; /** * Defines the API surface for the event store. */ export declare abstract class IEventStore { /** * Commit a single event. * @param {*} event - The content of the event. * @param {EventSourceIdLike} eventSourceId - The source of the event - a unique identifier that is associated with the event. * @param {EventType | EventTypeIdLike} eventType - An event type or an identifier representing the event type. * @param {Cancellation} cancellation - The cancellation signal. * @returns {Promise} * @summary If no event type identifier or event type is supplied, it will look for associated event types based * on the actual type of the event. */ abstract commit(event: any, eventSourceId: EventSourceIdLike, eventType?: EventType | EventTypeIdLike, cancellation?: Cancellation): Promise; /** * Commit a collection of events. * @param {UncommittedEvent|UncommittedEvent[]} eventOrEvents - The event or events. * @param {Cancellation} cancellation - The cancellation signal. * @returns {Promise} * @summary If no event type identifier or event type is supplied, it will look for associated event types based. * @summary On the actual type of the event. */ abstract commit(eventOrEvents: UncommittedEvent | UncommittedEvent[], cancellation?: Cancellation): Promise; /** * Commit a single public event. * @param {*} event - The content of the event. * @param {EventSourceIdLike} eventSourceId - The source of the event - a unique identifier that is associated with the event. * @param {EventType | EventTypeIdLike} eventType - An event type or an identifier representing the event type. * @param {Cancellation} cancellation - The cancellation signal. * @returns {Promise} * @summary If no event type identifier or event type is supplied, it will look for associated event types based * on the actual type of the event. */ abstract commitPublic(event: any, eventSourceId: EventSourceIdLike, eventType?: EventType | EventTypeIdLike, cancellation?: Cancellation): Promise; /** * Commit a single event for an aggregate. * @param {*} event - The content of the event. * @param {EventSourceIdLike} eventSourceId - The source of the event - a unique identifier that is associated with the event. * @param {AggregateRootId} aggregateRootId - The type of the aggregate root that applied the event to the Event Source. * @param {AggregateRootVersion} expectedAggregateRootVersion - The {AggregateRootVersion} of the Aggregate Root that was used to apply the rules that resulted in the Events. * The events can only be committed to the Event Store if the version of Aggregate Root has not changed. * @param {EventType | EventTypeIdLike} [eventType] - An artifact or an identifier representing the artifact. * @param {Cancellation} cancellation - The cancellation signal. * @returns {Promise} * @summary If no event type identifier or event type is supplied, it will look for associated artifacts based * on the actual type of the event. */ abstract commitForAggregate(event: any, eventSourceId: EventSourceIdLike, aggregateRootId: AggregateRootId, expectedAggregateRootVersion: AggregateRootVersion, eventType?: EventType | EventTypeIdLike, cancellation?: Cancellation): Promise; /** * Commit a collection of events. * @param {UncommittedEvent} events - Collection of aggregate events. * @param {Cancellation} cancellation - The cancellation signal. * @returns Promise. * @summary If no artifact identifier or artifact is supplied, it will look for associated artifacts based. * @summary On the actual type of the event. */ abstract commitForAggregate(events: UncommittedAggregateEvents, cancellation?: Cancellation): Promise; /** * Commit for aggregate root. * @param {AggregateRootId} aggregateRootId - Aggregate root to commit for. * @param {Cancellation} cancellation - The cancellation signal. * @returns {CommitForAggregateBuilder} */ abstract forAggregate(aggregateRootId: AggregateRootId): CommitForAggregateBuilder; /** * Fetches the {@link CommittedAggregateEvents} for an aggregate root. * @param {AggregateRootId} aggregateRootId - The aggregate root to fetch for. * @param {EventSourceId} eventSourceId - The event source id to fetch for. * @param {Cancellation} cancellation - The cancellation signal. * @returns {Promise} */ abstract fetchForAggregate(aggregateRootId: AggregateRootId, eventSourceId: EventSourceId, cancellation?: Cancellation): Promise; } //# sourceMappingURL=IEventStore.d.ts.map