/* auto-generated by NAPI-RS */ /* eslint-disable */ export declare class DocStorage { constructor(path: string) /** Initialize the database and run migrations. */ connect(): Promise close(): Promise get isClosed(): Promise /** * Flush the WAL file to the database file. * See https://www.sqlite.org/pragma.html#pragma_wal_checkpoint:~:text=PRAGMA%20schema.wal_checkpoint%3B */ checkpoint(): Promise validate(): Promise setSpaceId(spaceId: string): Promise pushUpdate(docId: string, update: Uint8Array): Promise getDocSnapshot(docId: string): Promise setDocSnapshot(snapshot: DocRecord): Promise getDocUpdates(docId: string): Promise> markUpdatesMerged(docId: string, updates: Array): Promise deleteDoc(docId: string): Promise getDocClocks(after?: Date | undefined | null): Promise> getDocClock(docId: string): Promise getBlob(key: string): Promise setBlob(blob: SetBlob): Promise deleteBlob(key: string, permanently: boolean): Promise releaseBlobs(): Promise listBlobs(): Promise> getPeerRemoteClocks(peer: string): Promise> getPeerRemoteClock(peer: string, docId: string): Promise setPeerRemoteClock(peer: string, docId: string, clock: Date): Promise getPeerPulledRemoteClocks(peer: string): Promise> getPeerPulledRemoteClock(peer: string, docId: string): Promise setPeerPulledRemoteClock(peer: string, docId: string, clock: Date): Promise getPeerPushedClocks(peer: string): Promise> getPeerPushedClock(peer: string, docId: string): Promise setPeerPushedClock(peer: string, docId: string, clock: Date): Promise clearClocks(): Promise } export declare class SqliteConnection { constructor(path: string) connect(): Promise addBlob(key: string, blob: Uint8Array): Promise getBlob(key: string): Promise deleteBlob(key: string): Promise getBlobKeys(): Promise> getUpdates(docId?: string | undefined | null): Promise> deleteUpdates(docId?: string | undefined | null): Promise getUpdatesCount(docId?: string | undefined | null): Promise getAllUpdates(): Promise> insertUpdates(updates: Array): Promise replaceUpdates(docId: string | undefined | null, updates: Array): Promise getServerClock(key: string): Promise setServerClock(key: string, data: Uint8Array): Promise getServerClockKeys(): Promise> clearServerClock(): Promise delServerClock(key: string): Promise getSyncMetadata(key: string): Promise setSyncMetadata(key: string, data: Uint8Array): Promise getSyncMetadataKeys(): Promise> clearSyncMetadata(): Promise delSyncMetadata(key: string): Promise initVersion(): Promise setVersion(version: number): Promise getMaxVersion(): Promise close(): Promise get isClose(): boolean static validate(path: string): Promise migrateAddDocId(): Promise /** * Flush the WAL file to the database file. * See https://www.sqlite.org/pragma.html#pragma_wal_checkpoint:~:text=PRAGMA%20schema.wal_checkpoint%3B */ checkpoint(): Promise } export interface Blob { key: string data: Uint8Array mime: string size: number createdAt: Date } export interface BlobRow { key: string data: Buffer timestamp: Date } export interface DocClock { docId: string timestamp: Date } export interface DocRecord { docId: string data: Uint8Array timestamp: Date } export interface DocUpdate { docId: string createdAt: Date data: Uint8Array } export interface InsertRow { docId?: string data: Uint8Array } export interface ListedBlob { key: string size: number mime: string createdAt: Date } export declare function mintChallengeResponse(resource: string, bits?: number | undefined | null): Promise export interface SetBlob { key: string data: Uint8Array mime: string } export interface UpdateRow { id: number timestamp: Date data: Buffer docId?: string } export declare enum ValidationResult { MissingTables = 0, MissingDocIdColumn = 1, MissingVersionColumn = 2, GeneralError = 3, Valid = 4 } export declare function verifyChallengeResponse(response: string, bits: number, resource: string): Promise