import * as Party from 'partykit/server'; import { Doc } from 'yjs'; type StorageKey = DocumentStateVectorKey | DocumentUpdateKey; /** * A key + value pair. */ type Datum = { key: StorageKey; value: Uint8Array; }; /** * This helper method returns `null` if the key is not found. */ declare function levelGet(db: Party.Storage, key: StorageKey): Promise; /** * Set a key + value in storage */ declare function levelPut(db: Party.Storage, key: StorageKey, val: Uint8Array): Promise; /** * A "bulkier" implementation of getting keys and/or values. */ declare function getLevelBulkData(db: Party.Storage, opts: { gte: StorageKey; lt: StorageKey; keys: boolean; values: boolean; reverse?: boolean; limit?: number; }): Promise; /** * Return the actual encoded keys in a range of keys */ declare function getLevelKeyRangeAsEncoded(db: Party.Storage, opts: { gte: StorageKey; lt: StorageKey; reverse?: boolean; limit?: number; }): Promise; declare function clearRange(db: Party.Storage, gte: StorageKey, // Greater than or equal lt: StorageKey): Promise; /** * Create a unique key for a update message. * We encode the result using `keyEncoding` which expects an array. */ type DocumentUpdateKey = ["v1", string, "update", number]; type DocumentStateVectorKey = ["v1_sv", string]; declare class YPartyKitStorage { db: Party.Storage; tr: Promise; _transact(f: (arg0: Party.Storage) => Promise): Promise; constructor(storage: Party.Storage); compactUpdateLog(docName: string, maxUpdates: number, maxBytes: number): Promise; getYDoc(docName: string): Promise; getStateVector(docName: string): Promise; storeUpdate(docName: string, update: Uint8Array): Promise; } export { YPartyKitStorage, clearRange, getLevelBulkData, getLevelKeyRangeAsEncoded, levelGet, levelPut };