import type { Common } from '../internal/common.js'; import type { Logger } from '../internal/logger.js'; import type { Schema } from '../internal/types.js'; import type { Drizzle } from '../types/db.js'; import { PGlite } from "@electric-sql/pglite"; import type { PgTransactionConfig } from "drizzle-orm/pg-core"; import type pg from "pg"; type InnerQB = Omit, "transaction"> & TransactionQB; type TransactionQB = { /** * Transaction with retries, logging, metrics, and error parsing. */ transaction(transaction: (tx: QB) => Promise, config?: PgTransactionConfig, context?: { logger?: Logger; }): Promise; transaction({ label }: { label: string; }, transaction: (tx: QB) => Promise, config?: PgTransactionConfig, context?: { logger?: Logger; }): Promise; }; /** * Query builder with built-in retry logic, logging, and metrics. */ export type QB = TransactionQB & { raw: Drizzle; /** * Query with retries, logging, metrics, and error parsing. */ wrap(query: (db: InnerQB) => T, context?: { logger?: Logger; }): T; wrap({ label }: { label: string; }, query: (db: InnerQB) => T, context?: { logger?: Logger; }): T; } & ({ $dialect: "pglite"; $client: PGlite; } | { $dialect: "postgres"; $client: pg.Pool | pg.PoolClient; }); export declare const parseDbError: (error: any) => Error; /** * Create a query builder. * * @example * ```ts * const qb = createQB(drizzle(pool), { casing: "snake_case", common }); * const result1 = await qb.wrap((db) => db.select().from(accounts)); * const result2 = await qb.wrap({ label: "label" }, (db) => db.select().from(accounts)); * ``` */ export declare const createQB: (db: Drizzle & { $client: TClient; }, { common, isAdmin }: { common: Common; isAdmin?: boolean | undefined; }) => QB; export {}; //# sourceMappingURL=queryBuilder.d.ts.map