/** * Keeps a statement observer from widening what a query error serializes. * * postgres.js defines `stack`/`query`/`parameters`/`args`/`types` on every * query error it raises, and makes them ENUMERABLE exactly when its `debug` * option is truthy (`connection.js`, `queryError`). Pipework sets `debug` to * install a per-statement observer — so, absent this boundary, merely observing * statements would start leaking bind parameters into every log drain that * serializes errors. Observation must not change what an error exposes. * * Why this is a closed set rather than a best-effort sweep: enumerability only * changes where `debug` is truthy, and only three sites in pipework construct a * connection carrying the observer — `createManagedConnection`, * `createIsolatedConnection`, and `createSetupConnection`. Every other * `postgres()` in the codebase (migrations, CLI, startup validation, reaper, * `tap()`) leaves `debug` unset, so its errors keep these fields * non-enumerable already and need no treatment. * * The one gap, deliberate and announced: `ManagedConnection.client` is the * sanctioned raw-driver door, and errors from queries issued through it do not * pass this boundary. Reading `.client` on an observed connection logs a * one-time warning saying so. Wrapping the `Sql` to close that gap was * considered and REJECTED: it means proxying a callable tagged-template whose * `begin`/`savepoint` hand out fresh client instances needing recursive * re-wrapping, on the hottest path in the system — more risk than the narrow, * documented gap it would close. Do not "clean this up" by adding one. */ /** Records that this client's `debug` hook came from a statement observer alone. */ export declare function markObservedConnection(client: unknown): void; /** True when this client's `debug` hook came from a statement observer alone. */ export declare function isObservedConnection(client: unknown): boolean; /** Carries observed-ness onto a transaction- or savepoint-scoped client. */ export declare function propagateObserved(from: unknown, to: unknown): void; /** * Returns the error to propagate with the driver-added fields hidden from * serialization, following `cause` because the driver error usually arrives * wrapped by drizzle. Returns the original untouched when there is nothing to * hide. */ export declare function withoutDriverAddedFields(err: unknown): unknown; /** * Runs driver work, hiding the fields postgres.js only exposed because a * statement observer is attached. Pure pass-through when the connection is not * observed, and never alters the error itself — only what it serializes. */ export declare function throughErrorBoundary(client: unknown, run: () => Promise): Promise; //# sourceMappingURL=driver-error-boundary.d.ts.map