import { StoredValue, ObjectType, BaseNode } from '../../../schema/dist/index.js'; import { Logger } from '@llamaindex/env'; import { BaseKVStore } from '../../kv-store/dist/index.js'; declare const TYPE_KEY = "__type__"; declare const DATA_KEY = "__data__"; interface Serializer { toPersistence(data: Record): T; fromPersistence(data: T): Record; } declare const jsonSerializer: Serializer; declare const noneSerializer: Serializer>; type DocJson = { [TYPE_KEY]: ObjectType; [DATA_KEY]: Data; }; declare function isValidDocJson(docJson: StoredValue | null | undefined): docJson is DocJson; declare function docToJson(doc: BaseNode, serializer: Serializer): DocJson; declare function jsonToDoc(docDict: DocJson, serializer: Serializer): BaseNode; interface RefDocInfo { nodeIds: string[]; extraInfo: Record; } declare abstract class BaseDocumentStore { serializer: Serializer; persist(persistPath?: string): void; abstract docs(): Promise>; abstract addDocuments(docs: BaseNode[], allowUpdate: boolean): Promise; abstract getDocument(docId: string, raiseError: boolean): Promise; abstract deleteDocument(docId: string, raiseError: boolean): Promise; abstract documentExists(docId: string): Promise; abstract setDocumentHash(docId: string, docHash: string): Promise; abstract getDocumentHash(docId: string): Promise; abstract getAllDocumentHashes(): Promise>; abstract getAllRefDocInfo(): Promise | undefined>; abstract getRefDocInfo(refDocId: string): Promise; abstract deleteRefDoc(refDocId: string, raiseError: boolean): Promise; getNodes(nodeIds: string[], raiseError?: boolean): Promise; getNode(nodeId: string, raiseError?: boolean): Promise; getNodeDict(nodeIdDict: { [index: number]: string; }): Promise>; } declare class KVDocumentStore extends BaseDocumentStore { private kvstore; private nodeCollection; private refDocCollection; private metadataCollection; private logger; constructor(kvstore: BaseKVStore, namespace?: string, options?: { logger?: Logger; }); docs(): Promise>; addDocuments(docs: BaseNode[], allowUpdate?: boolean): Promise; getDocument(docId: string, raiseError?: boolean): Promise; getRefDocInfo(refDocId: string): Promise; getAllRefDocInfo(): Promise | undefined>; refDocExists(refDocId: string): Promise; documentExists(docId: string): Promise; private removeRefDocNode; deleteDocument(docId: string, raiseError?: boolean, removeRefDocNode?: boolean): Promise; deleteRefDoc(refDocId: string, raiseError?: boolean): Promise; setDocumentHash(docId: string, docHash: string): Promise; getDocumentHash(docId: string): Promise; getAllDocumentHashes(): Promise>; private isNil; } export { BaseDocumentStore, KVDocumentStore, docToJson, isValidDocJson, jsonSerializer, jsonToDoc, noneSerializer }; export type { RefDocInfo, Serializer };