/** * Detect whether an error (or AggregateError wrapping multiple attempts) * represents an ECONNREFUSED — i.e. the database is simply not running. * * Handles: * - Direct `{ code: "ECONNREFUSED" }` errors from Node `net` * - `AggregateError` from dual-stack IPv4+IPv6 connection attempts * - Drizzle's `cause`-wrapped pg errors */ export declare function isEconnrefused(err: unknown): boolean; /** * Detect PostgreSQL authentication failures. * PG error codes: 28P01 (invalid_password), 28000 (invalid_authorization_specification) */ export declare function isAuthFailure(err: unknown): boolean; /** * Detect the "SSL is not enabled on the server" failure — the client attempted * an SSL handshake against a Postgres server that doesn't support it (common * with a plain local dev database). The fix is `?sslmode=disable` on the URL. */ export declare function isSslNotEnabled(err: unknown): boolean; /** * Detect PostgreSQL "cannot drop ... because other objects depend on it" * (error code 2BP01, dependent_objects_still_exist). This is the failure that * strands a declarative `db push` half-applied when a collection is removed but * an enum type it defined is still referenced by another object. */ export declare function isDependencyDropError(err: unknown): boolean; /** * Pre-flight check: verify that the database is reachable before running * a heavy subprocess (Atlas, migrations, etc.). * * Exits with code 1 and a friendly banner on known failure modes. * On unknown errors, logs a warning and allows the caller to proceed. */ export declare function checkDatabaseConnectivity(databaseUrl: string): Promise; /** * Post-hoc error diagnosis for direct database operations (e.g. applyPolicies). * Returns a formatted diagnostic string if the error matches a known pattern, * or null if unrecognized. */ export declare function diagnoseDbError(err: unknown, databaseUrl?: string): string | null;