/** * PGLite Collection Integration * * Provides TanStack-style collections backed by PGLite local database. */ import type { BaseRecord, PGLiteCollectionOptions, Collection, SyncState, PGLiteInterface } from '../types'; /** * PGLiteCollection - A collection backed by PGLite local database */ export declare class PGLiteCollection implements Collection { readonly id: string; readonly table: string; private items; private subscribers; private options; private syncState; private pgliteInstance?; constructor(options: PGLiteCollectionOptions); /** * Initialize the collection - create table if needed and load data */ initialize(): Promise; /** * Refresh data from PGLite */ refresh(): Promise; /** * Get all items in the collection */ getAll(): T[]; /** * Get item by ID */ get(id: string | number): T | undefined; /** * Insert a new item */ insert(data: Omit & { id?: T['id']; }): Promise; /** * Update an existing item */ update(id: string | number, data: Partial): Promise; /** * Delete an item */ delete(id: string | number): Promise; /** * Subscribe to changes */ subscribe(callback: (items: T[]) => void): () => void; /** * Get current sync state */ getSyncState(): SyncState; /** * Execute a raw SQL query */ rawQuery(sql: string, params?: unknown[]): Promise<{ rows: R[]; }>; private getPGLite; private notifySubscribers; } /** * Factory function to create a PGLiteCollection */ export declare function createPGLiteCollection(options: PGLiteCollectionOptions): PGLiteCollection; /** * Options for PGLiteStore */ export interface PGLiteStoreOptions { pglite: PGLiteInterface | (() => Promise); } /** * PGLiteStore - Manages multiple PGLite-backed collections */ export declare class PGLiteStore { private pglite; private collections; private pgliteInstance?; isDisposed: boolean; constructor(options: PGLiteStoreOptions); /** * Register a new collection */ registerCollection(options: Omit, 'pglite'>): PGLiteCollection; /** * Get a registered collection */ getCollection(id: string): PGLiteCollection | undefined; /** * Get all collection IDs */ getCollectionIds(): string[]; /** * Initialize all collections */ initializeAll(): Promise; /** * Dispose of all resources */ dispose(): Promise; } //# sourceMappingURL=pglite-collection.d.ts.map