import type { Flow } from './types.js'; import type { DB } from '../../data/db/index.js'; import type { TenantConfig } from '../../auth/tenant/types.js'; /** * Runs `run` inside a database transaction (or one independent transaction per * database, when several are involved), with the request/job context's locals * propagated via `SET LOCAL` so Postgres-side RLS policies and `current_setting` * lookups see the active tenant. * * The transactions are bound to a child context so `pipe()` and DI resolution * pick them up; `run` is invoked inside that child context. This is the single * shared path for both the HTTP surface and `jobs.execute` — keep it that way * so the two entry points cannot drift in their isolation behaviour. * * With a `signal`, aborting cancels each transaction's in-flight query on the * server (`pg_cancel_backend`), so the query fails, the transaction rolls back * and the connection returns to the pool instead of being held to completion. */ export declare function executeInTransaction(ctx: Flow, databases: readonly string[], tenant: TenantConfig | null, timeoutMs: number, run: () => Promise, signal?: AbortSignal): Promise; /** * Propagates context locals onto a transaction via `SET LOCAL`: the request id, * the tenant id (`pipework.tenant_id`, read by generated RLS policies), and any * custom tenant session variables. */ export declare function propagateLocals(tx: DB, ctx: Flow, tenant: TenantConfig | null): Promise; //# sourceMappingURL=run-in-transaction.d.ts.map