demeine
Version:
DDDD - Distributed Domain Driven Design
23 lines (22 loc) • 1.56 kB
TypeScript
import Promise from 'bluebird';
import { Aggregate } from '../aggregate';
import { Event } from '../aggregate/Aggregate.interfaces';
import { AggregateFactory } from '../aggregate/DefaultFactory';
import { Partition, Stream } from './Partition.interfaces';
import { Callback, ConcurrencyStrategy, RepositoryOptions } from './Repository.interfaces';
export declare class Repository<T extends Aggregate = Aggregate, Payload extends object = object> {
_partition: Partition<T, Payload>;
_factory: AggregateFactory<T>;
_aggregateType: string;
_resetSnapshotOnFail: boolean;
_concurrencyStrategy?: ConcurrencyStrategy<Payload>;
constructor(partition: Partition<T, Payload>, aggregateType: string, factory?: AggregateFactory<T>, concurrencyStrategy?: ConcurrencyStrategy<Payload>, options?: RepositoryOptions);
findById(id: string, callback?: Callback<T>): Promise<T>;
findBySnapshot(id: string, isRetry: boolean, callback?: Callback<T>): Promise<T>;
findByQueryStreamWithSnapshot(id: string, isRetry: boolean, callback?: Callback<T>): Promise<T>;
findEventsById(id: string, callback: Callback<Array<Event<Payload>>>): Promise<Array<Event<Payload>>>;
checkConcurrencyStrategy(aggregate: T, stream: Stream<Payload>, uncommittedEvents: Array<Event<Payload>>): Promise<boolean>;
_getDeleteEvent(events: Array<Event<Payload>>): Event<Payload> | null;
_delete(aggregate: T, deleteEvent: Event<Payload>): Promise<T>;
save(aggregate: T, commitId?: string, callback?: Callback<T>): Promise<T>;
}