import { Listener } from '../observer'; import { UUID } from '../uuid'; /** * Namespace for database events. * @public */ export declare namespace DatabaseEvent { interface Update { value: T; } export interface BeforeUpdate extends Update { newValue: T; } export interface AfterUpdate extends Update { } export {}; } /** * Namespace for database access result types. * @public */ export declare namespace DatabaseAccessResult { interface Access { value: T; } export interface Create extends Access { } export interface Read extends Access { } export interface Update extends Access { } export interface Delete { id: string; success: boolean; } export {}; } /** * Represents a database record. * @public */ export interface DatabaseRecord { id: string; } /** * Represents a database with basic CRUD operations. * @public */ export interface Database { isWorking: boolean; create(newValue: Omit): Promise>; read(id: string): Promise>; update(id: string, newValue: Omit, 'id'>): Promise>; delete(id: string): Promise; visit(visitor: (record: T) => void): Promise; onBeforeUpdate(listener: Listener>): () => void; onAfterUpdate(listener: Listener>): () => void; } /** * An in memory database of specific DatabaseRecord types. * @public */ export declare class InMemoryDatabase implements Database { private uuid; isWorking: boolean; private records; private beforeUpdateListeners; private afterUpdateListeners; constructor(uuid: UUID); create(newValue: Omit): Promise>; read(id: string): Promise>; update(id: string, newValue: Omit, 'id'>): Promise>; delete(id: string): Promise; visit(visitor: (record: T) => void): Promise; onBeforeUpdate(listener: Listener>): () => void; onAfterUpdate(listener: Listener>): () => void; } //# sourceMappingURL=inMemoryDatabase.d.ts.map