/** * Postgres Embedded Store - PostgreSQL-based Persistence Layer * * Provides reliable persistent storage using PostgreSQL with Prisma: * - ACID transactions for data integrity * - Connection pooling for performance * - Compatible with cloud-hosted Postgres (Supabase, Railway, etc.) * * This replaces the SQLite EmbeddedStore for hosted deployments. */ import { PrismaClient } from '@prisma/client'; /** * Configuration options for PostgresEmbeddedStore */ export interface PostgresEmbeddedStoreConfig { componentName?: string; prisma?: PrismaClient; } /** * Default configuration */ export declare const DEFAULT_POSTGRES_STORE_CONFIG: Required>; /** * Store statistics */ interface StoreStats { reads: number; writes: number; failures: number; lastOperationTime: number | null; totalRecords?: number; } /** * PostgresEmbeddedStore - Prisma-based persistent storage * * Provides namespaced key-value storage with: * - Atomic operations via Postgres transactions * - Connection pooling * - Cloud deployment support */ export declare class PostgresEmbeddedStore { private config; private prisma; private ownsPrisma; private initialized; private stats; constructor(config?: PostgresEmbeddedStoreConfig); /** * Check if Postgres is available (DATABASE_URL is set) */ static isAvailable(): boolean; /** * Initialize the store (must be called before use) */ initialize(): Promise; /** * Get a value from the store */ get(namespace: string, key: string): Promise; /** * Set a value in the store */ set(namespace: string, key: string, value: T): Promise; /** * Delete a value from the store */ delete(namespace: string, key: string): Promise; /** * Get all keys in a namespace */ keys(namespace: string): Promise; /** * Get all entries in a namespace */ getAll(namespace: string): Promise>; /** * Clear all entries in a namespace */ clear(namespace: string): Promise; /** * Check if a key exists */ has(namespace: string, key: string): Promise; /** * Count entries in a namespace */ count(namespace: string): Promise; /** * Run multiple operations in a transaction */ transaction(fn: (tx: PrismaClient) => Promise): Promise; /** * Get store statistics */ getStats(): Promise; /** * Flush any pending writes (no-op for Postgres, writes are immediate) */ flush(): Promise; /** * Close the store */ close(): Promise; /** * Migrate data from SQLite EmbeddedStore to Postgres */ migrateFromSqlite(sqliteData: Map>): Promise<{ migrated: number; skipped: number; }>; /** * Get the Prisma client (for advanced use cases) */ getPrismaClient(): PrismaClient; /** * Ensure the store is initialized */ private ensureInitialized; } /** * Get the global Postgres store instance */ export declare function getPostgresEmbeddedStore(config?: PostgresEmbeddedStoreConfig): PostgresEmbeddedStore; /** * Initialize the global store (call once at startup) */ export declare function initializePostgresEmbeddedStore(config?: PostgresEmbeddedStoreConfig): Promise; /** * Close the global store (call at shutdown) */ export declare function closePostgresEmbeddedStore(): Promise; /** * Create a namespaced store wrapper for a specific component * * This provides a simpler API for components that only use one namespace. */ export declare class NamespacedPostgresStore { private store; private namespace; constructor(store: PostgresEmbeddedStore, namespace: string); get(key: string): Promise; set(key: string, value: T): Promise; delete(key: string): Promise; has(key: string): Promise; keys(): Promise; getAll(): Promise>; clear(): Promise; count(): Promise; } /** * Create a new PostgresEmbeddedStore instance * * Use this factory when you need a separate store instance. * For shared access, use getPostgresEmbeddedStore() instead. */ export declare function createPostgresEmbeddedStore(config?: PostgresEmbeddedStoreConfig): PostgresEmbeddedStore; export {}; //# sourceMappingURL=postgres-embedded-store.d.ts.map