import { CellCache, PostCache, CommentCache, VoteCache, UserIdentityCache, ModerateMessage } from '../types/waku'; import { User } from '../types/identity'; import { DelegationInfo } from '../delegation/types'; import { Bookmark, BookmarkCache } from '../types/forum'; export interface LocalDatabaseCache { cells: CellCache; posts: PostCache; comments: CommentCache; votes: VoteCache; moderations: { [targetId: string]: ModerateMessage; }; userIdentities: UserIdentityCache; bookmarks: BookmarkCache; } /** * Minimal in-memory LocalDatabase * Mirrors CacheService message handling to enable incremental migration. */ export declare class LocalDatabase { private processedMessageIds; private validator; private db; private _isSyncing; private _lastSync; private pendingIds; private pendingListeners; readonly cache: LocalDatabaseCache; constructor(); /** * Open IndexedDB and hydrate in-memory cache. */ open(): Promise; /** * Apply a message into the LocalDatabase. * Returns true if the message was newly processed and stored. */ applyMessage(message: unknown): Promise; /** * Temporary alias to ease migration from CacheService.updateCache */ updateCache(message: unknown): Promise; clear(): void; private storeMessage; /** * Hydrate cache from IndexedDB on warm start */ private hydrateFromIndexedDB; private hydratePendingFromMeta; private getAllFromStore; private put; getSyncState(): { lastSync: number | null; isSyncing: boolean; }; setSyncing(isSyncing: boolean): void; updateLastSync(timestamp: number): void; markPending(id: string): void; clearPending(id: string): void; isPending(id: string): boolean; onPendingChange(listener: () => void): () => void; /** * Store user authentication data */ storeUser(user: User): Promise; /** * Load user authentication data */ loadUser(): Promise; /** * Clear user authentication data */ clearUser(): Promise; /** * Store delegation information */ storeDelegation(delegation: DelegationInfo): Promise; /** * Load delegation information */ loadDelegation(): Promise; /** * Clear delegation information */ clearDelegation(): Promise; /** * Store UI state value */ storeUIState(key: string, value: unknown): Promise; /** * Load UI state value */ loadUIState(key: string): Promise; /** * Clear UI state value */ clearUIState(key: string): Promise; /** * Add a bookmark */ addBookmark(bookmark: Bookmark): Promise; /** * Remove a bookmark */ removeBookmark(bookmarkId: string): Promise; /** * Get all bookmarks for a user */ getUserBookmarks(userId: string): Promise; /** * Get bookmarks by type for a user */ getUserBookmarksByType(userId: string, type: 'post' | 'comment'): Promise; /** * Check if an item is bookmarked by a user */ isBookmarked(userId: string, type: 'post' | 'comment', targetId: string): boolean; /** * Get bookmark by ID */ getBookmark(bookmarkId: string): Bookmark | undefined; /** * Get all bookmarks from cache */ getAllBookmarks(): Bookmark[]; } export declare const localDatabase: LocalDatabase; //# sourceMappingURL=LocalDatabase.d.ts.map