import type { AbstractConnection, ConnectionOptions } from '@sequelize-orm/core'; import { AbstractConnectionManager } from '@sequelize-orm/core'; import type { ClientConfig } from 'pg'; import * as Pg from 'pg'; import type { TypeId, TypeParser } from 'pg-types'; import type { PostgresDialect } from './dialect.js'; type TypeFormat = 'text' | 'binary'; export type PgModule = typeof Pg; export interface PostgresConnection extends AbstractConnection, Pg.Client { _invalid?: boolean; standard_conforming_strings?: boolean; _ending?: boolean; } export interface PostgresConnectionOptions extends Omit { /** * !! DO NOT SET THIS TO TRUE !! * (unless you know what you're doing) * see [http://www.postgresql.org/message-id/flat/bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com#bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com] */ binary?: boolean; /** * see [http://www.postgresql.org/docs/9.3/static/runtime-config-logging.html#GUC-APPLICATION-NAME] * choose the SSL mode with the PGSSLMODE environment variable * object format: [https://github.com/brianc/node-postgres/blob/ee19e74ffa6309c9c5e8e01746261a8f651661f8/lib/connection.js#L79] * see also [http://www.postgresql.org/docs/9.3/static/libpq-ssl.html] * In addition to the values accepted by the corresponding server, * you can use "auto" to determine the right encoding from the * current locale in the client (LC_CTYPE environment variable on Unix systems) */ client_encoding?: string; /** * This should help with backends incorrectly considering idle clients to be dead and prematurely disconnecting them. * this feature has been added in pg module v6.0.0, check pg/CHANGELOG.md * Times out queries after a set time in milliseconds in the database end. Added in pg v7.3 * Times out queries after a set time in milliseconds in client end, query would be still running in database end. * Number of milliseconds to wait for connection, default is no timeout. * Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds. Added in pg v7.17.0 only supported in postgres >= 10 * Maximum wait time for lock requests in milliseconds. Added in pg v8.8.0. */ lock_timeout?: number; } export declare class PostgresConnectionManager extends AbstractConnectionManager { #private; constructor(dialect: PostgresDialect); connect(config: ConnectionOptions): Promise; disconnect(connection: PostgresConnection): Promise; validate(connection: PostgresConnection): boolean; getTypeParser(oid: TypeId, format?: TypeFormat): TypeParser; /** * Refreshes the local registry of Custom Types (e.g. enum) OIDs */ refreshDynamicOids(): Promise; } export {};