/** * In-memory stand-in for `@evershop/postgres-query-builder` and * `lib/postgres/connection.js`, for service tests that must not touch a * database (the repo's mocks-first posture). It understands the subset the * address services use: select().from().where().and().load()/execute(), * insert().given().execute() (returns the row plus `insertId`), * update().given().where().execute(), del(), and the transaction helpers. * Every write is recorded so a test can assert exactly what reached `given()`. */ type Row = Record; type Cond = [column: string, op: string, value: unknown]; export interface FakeDb { tables: Record; inserts: Array<{ table: string; data: Row; }>; updates: Array<{ table: string; data: Row; where: Cond[]; }>; deletes: Array<{ table: string; where: Cond[]; }>; tx: { started: number; committed: number; rolledBack: number; }; } export declare function createFakeDb(seed?: Record): FakeDb; export declare function createFakeQueryBuilder(db: FakeDb): { select: () => Record; insert: (table: string) => { given(d: Row): any; execute(): Promise<{ insertId: number; }>; }; update: (table: string) => { given(d: Row): any; where(c: string, op: string, v: unknown): any; and(c: string, op: string, v: unknown): any; execute(): Promise; }; del: (table: string) => { where(c: string, op: string, v: unknown): any; and(c: string, op: string, v: unknown): any; execute(): Promise; }; execute(): Promise; startTransaction(): Promise; commit(): Promise; rollback(): Promise; getConnection(): Promise<{ INTRANSACTION: boolean; release(): void; }>; pool: { query: () => Promise<{ rows: never[]; }>; }; connection: { INTRANSACTION: boolean; release(): void; }; }; export {};