import type { IObserver } from './IObserver.ts'; import type { IObservable } from './IObservable.ts'; import type { IEventStorageReader } from './IEventStorageReader.ts'; import type { IEvent } from './IEvent.ts'; export interface IProjection extends IObserver { readonly view: TView; /** Subscribe to new events */ subscribe(eventStore: IObservable): void; /** Restore view state from not-yet-projected events */ restore(eventStore: IEventStorageReader): Promise | void; /** Project new event */ project(event: IEvent, meta?: Record): Promise | void; } export interface IProjectionConstructor { new (c?: any): IProjection; readonly handles?: string[]; }