/** * DB adapter for MCP. * - `connectPglite()` returns a PGlite-backed client. * - `connectPostgres()` returns a `pg.Pool`-backed client. * - `createMcpDbClient()` selects adapter based on `persistenceDriver` config. * * Schema is the caller's responsibility — these factories do NOT bootstrap any * tables. Apply drizzle-kit migrations (`pnpm --filter @revealui/db db:migrate` * or the PGlite equivalent) before issuing queries. */ import type { McpDocumentOperationsInsert, McpDocumentOperationsRow } from '@revealui/contracts'; export interface QueryResult> { rows: T[]; affectedRows?: number; } export type McpDbClient = { query: >(sql: string, params?: unknown[]) => Promise>; close: () => Promise; }; /** * Re-export the Drizzle-generated types for MCP's document-operations log so * consumers of `@revealui/mcp` don't have to also import `@revealui/contracts` * just to type a `mcp_document_operations` row. These types ARE the source of * truth — they are generated from the Drizzle schema at * `packages/db/src/schema/mcp-document-operations.ts` and will track any * future column changes automatically. */ export type { McpDocumentOperationsInsert, McpDocumentOperationsRow }; /** * Connect to PGlite (embedded PostgreSQL) for local development/testing. * Uses dynamic import to avoid bundling @electric-sql/pglite when not needed. * * @param options - Optional connection options * @param options.dataDir - Override the default data directory. Use ':memory:' for in-memory. */ export declare function connectPglite(options?: { dataDir?: string; }): Promise; /** * Connect to PostgreSQL for production use. * Supports Neon, Supabase, and generic PostgreSQL with SSL. */ export declare function connectPostgres(): Promise; /** * Factory function that creates an MCP database client based on configuration. * Reads `persistenceDriver` from getMcpConfig() to determine which adapter to use. */ export declare function createMcpDbClient(): Promise; declare const _default: { connectPglite: typeof connectPglite; connectPostgres: typeof connectPostgres; createMcpDbClient: typeof createMcpDbClient; }; export default _default; //# sourceMappingURL=db.d.ts.map