/** @public */ export declare abstract class Data { [key: string]: any; static assign(vo: Data, values: ValuesObject): Data; set(key: string, value: any): void; fromObject(object: ValuesObject): void; toObject(exclude?: string[]): Record; abstract uniqKey(): string; } /** @public */ export declare abstract class Entity { abstract _getRepo(storage: Storage_2): Repo>; abstract _getVO(): T; protected _data: T; private __id; get data(): T; get _id(): string; set _id(value: string); constructor(data?: T); getUniqKey(): any; isPersisted(): boolean; toString(): any; } /** @public */ export declare type EntityConstructor = new (data?: T) => Entity; /** @public */ export declare class EntityManager { private readonly _storage; private _saveMap; private _removeMap; constructor(storage: Storage_2); persist(entity: Entity): this; persistMany(entities: Entity[]): this; remove(entity: Entity): this; forget(): this; flush(): Promise; refresh(entity: Entity): Promise>; } /** @public */ export declare class ErrEntityHasNoUniqKeyValue extends Error { } /** @public */ export declare class ErrEntityNotFound extends Error { } /** @public */ export declare class ErrFoundNotUniqEntity extends Error { } /** @public */ export declare class ErrNoSession extends ErrStorage { } /** @public */ export declare class ErrStorage extends Error { } /** @public */ export declare abstract class Repo> { protected _storage: Storage_2; protected _entity: T; protected _limit: number; protected _offset: number; /** * Возвращает объект соотв. сущности, например new App() */ abstract Entity(): T; /** * Возвращает название коллекции/таблицы/... хранящей записи соотв. сущностей */ abstract Name(): string; _transformer: (object: any) => any; constructor(storage: Storage_2); resetTransformer(): void; get storage(): Storage_2; save(entity: T): Promise; findById(id: string): Promise; /** * * @protected */ _findByParams(parameters: Record, limit?: number, order?: Record): Promise; findMany(parameters: Record, order?: Record): Promise; shift(limit?: number, offset?: number): this; count(query?: Record): Promise; remove(entity: T, silent?: boolean): Promise; } /** @public */ declare abstract class Storage_2 { protected _dsn: string; constructor(dsn: string); abstract find(name: string, query: Record): Promise; abstract save(name: string, uniqKey: string, data: Record): Promise; abstract createSession(): StorageSession; abstract count(name: string, query?: Record): Promise; abstract remove(collectionName: string, uniqKeyName: string, uniqKey: string): Promise; } export { Storage_2 as Storage } /** @public */ export declare interface StorageCursor { limit(number_: number): StorageCursor; sort(parameters: Record): StorageCursor; skip(offset: number): StorageCursor; toArray(): Promise; } /** @public */ export declare abstract class StorageSession { abstract start(options?: Record): Promise; abstract commit(fn: () => any, options?: Record): Promise; } /** @public */ export declare type ValuesObject = Record; export { }