UNPKG

event-local

Version:

Event client

35 lines (34 loc) 1.44 kB
import { Command } from "./Command"; import { ReflectionMutableCommandProccessingAggregate } from "./ReflectionMutableCommandProccessingAggregate"; import { DomenEvent } from "./DomenEvent"; /** * Мы будем создавать агрегат репозитория с шаблонным кодом, передавая в нём название * сущности, за хранение которой он ответственнен. * пример кода * * new TemoeratureRepository() { * constructor() { * super(Temperature) * } * } * * const temoeratureRepository = new TemoeratureRepository(); * temoeratureRepository.find(12) * */ export declare class AggregateRepository<T> { protected entity_type: string; protected entity: Function; private rand; constructor(entity: T & ReflectionMutableCommandProccessingAggregate); /** * Вставляет события в таблицу events, и создаёт сущность entities. */ save(agregatCommand: Command): Promise<T>; protected saveEvent(event: DomenEvent): Promise<void>; find(id: string): Promise<T & ReflectionMutableCommandProccessingAggregate>; /** * Вставляет события в таблицу events, Обновляет версию до актуальной. */ update(agregatCommand: Command): Promise<T & ReflectionMutableCommandProccessingAggregate>; }