import { AuthorizationKey, DocumentBaseline, ObjectIdentifier, Operation } from '@verdant-web/common'; import { WeakEvent } from 'weak-event'; import { Context } from '../context/context.js'; import { FileManager } from '../files/FileManager.js'; import { Disposable } from '../utils/Disposable.js'; import { Entity } from './Entity.js'; export type EntityStoreEventData = { oid: ObjectIdentifier; operations?: Record; baselines?: DocumentBaseline[]; isLocal: boolean; }; export type EntityStoreEvents = { add: WeakEvent; replace: WeakEvent; resetAll: WeakEvent; }; export interface IncomingData { operations?: Operation[]; baselines?: DocumentBaseline[]; reset?: boolean; isLocal?: boolean; } export interface EntityCreateOptions { undoable?: boolean; access?: AuthorizationKey; } export declare class EntityStore extends Disposable { private ctx; private files; private batcher; private events; private cache; private pendingEntityPromises; private abortDataQueueController; private ongoingResetPromise; private entityFinalizationRegistry; constructor({ ctx, files }: { ctx: Context; files: FileManager; }); get batch(): ({ undoable, batchName, max, timeout, }?: { undoable?: boolean; batchName?: string; max?: number | null; timeout?: number | null; }) => import("./OperationBatcher.js").OperationBatch; get flushAllBatches(): () => Promise; addData: (data: IncomingData) => Promise; empty: () => Promise; private resetData; private processData; hydrate: (oid: string, opts?: { abort: AbortSignal; }) => Promise; destroy: () => Promise; /** * Creates a new Entity with the given initial data. */ create: (initial: any, oid: ObjectIdentifier, { undoable, access }?: EntityCreateOptions) => Promise>; deleteAll: (oids: ObjectIdentifier[], options?: { undoable?: boolean; }) => Promise; delete: (oid: ObjectIdentifier, options?: { undoable?: boolean; }) => Promise; private getCollectionSchema; /** * Constructs an entity from an OID, but does not load it or add it to the cache. */ private constructEntity; private onPendingOperations; discardPendingOperation: (operation: Operation) => void; /** * Loads initial Entity data from storage */ private loadEntity; private loadEntityData; /** * Drops all entities from the cache. Any entities * referenced will go 'dead'... */ clearCache: () => void; }