import { PoolClient } from 'pg'; import type { Database } from './types.js'; import type { PostgresDatabaseConfig } from './schemas.js'; import type { Logger } from '@dexto/core'; /** * PostgreSQL database store for production database operations. * Implements the Database interface with connection pooling and JSONB support. * EXPERIMENTAL - NOT FULLY TESTED YET */ export declare class PostgresStore implements Database { private config; private pool; private connected; private logger; constructor(config: PostgresDatabaseConfig, logger: Logger); connect(): Promise; /** * Creates a PostgreSQL schema if it doesn't exist. */ private createSchema; disconnect(): Promise; isConnected(): boolean; getStoreType(): string; get(key: string): Promise; set(key: string, value: T): Promise; setIfAbsent(key: string, value: T): Promise<{ value: T; inserted: boolean; }>; delete(key: string): Promise; list(prefix: string): Promise; append(key: string, item: T): Promise; updateList(key: string, updater: (items: T[]) => { items: T[]; result: R; }): Promise; getRange(key: string, start: number, count: number): Promise; private createTables; private checkConnection; /** * Check if an error is a connection error that should trigger a retry. * Common with serverless databases (Neon) where connections go stale. */ private isConnectionError; /** * Execute a database operation with automatic retry on connection errors. * Handles serverless DB connection issues (Neon cold starts, stale connections). */ private withRetry; /** * Execute a callback within a database transaction. * Note: On connection failure, the entire callback will be retried on a new connection. * Ensure callback operations are idempotent or use this only for read operations. */ transaction(callback: (client: PoolClient) => Promise): Promise; private transactionOnce; getStats(): Promise<{ kvCount: number; listCount: number; totalSize: string; }>; vacuum(): Promise; } //# sourceMappingURL=postgres-store.d.ts.map