pg/000755 001751 000166 0000000000 14744520166013170 5ustar00runner000000 000000 1474452016614744520166pg/LICENSE000644 001751 000166 0000002165 14744520166014201 0ustar00runner000000 000000 1474452016614744520166 MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE pg/README.md000644 001751 000166 0000001227 14744520166014451 0ustar00runner000000 000000 1474452016614744520166# Installation > `npm install --save @types/pg` # Summary This package contains type definitions for pg (https://github.com/brianc/node-postgres). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pg. ### Additional Details * Last updated: Thu, 23 Jan 2025 20:03:02 GMT * Dependencies: [@types/node](https://npmjs.com/package/@types/node), [pg-protocol](https://npmjs.com/package/pg-protocol), [pg-types](https://npmjs.com/package/pg-types) # Credits These definitions were written by [Phips Peter](https://github.com/pspeter3), and [Ravi van Rooijen](https://github.com/HoldYourWaffle). pg/index.d.ts000644 001751 000166 0000023543 14744520166015100 0ustar00runner000000 000000 1474452016614744520166/// import events = require("events"); import stream = require("stream"); import pgTypes = require("pg-types"); import { NoticeMessage } from "pg-protocol/dist/messages"; import { ConnectionOptions } from "tls"; export type QueryConfigValues = T extends Array ? T : never; export interface ClientConfig { user?: string | undefined; database?: string | undefined; password?: string | (() => string | Promise) | undefined; port?: number | undefined; host?: string | undefined; connectionString?: string | undefined; keepAlive?: boolean | undefined; stream?: () => stream.Duplex | stream.Duplex | undefined; statement_timeout?: false | number | undefined; ssl?: boolean | ConnectionOptions | undefined; query_timeout?: number | undefined; lock_timeout?: number | undefined; keepAliveInitialDelayMillis?: number | undefined; idle_in_transaction_session_timeout?: number | undefined; application_name?: string | undefined; connectionTimeoutMillis?: number | undefined; types?: CustomTypesConfig | undefined; options?: string | undefined; } export type ConnectionConfig = ClientConfig; export interface Defaults extends ClientConfig { poolSize?: number | undefined; poolIdleTimeout?: number | undefined; reapIntervalMillis?: number | undefined; binary?: boolean | undefined; parseInt8?: boolean | undefined; parseInputDatesAsUTC?: boolean | undefined; } export interface PoolConfig extends ClientConfig { // properties from module 'node-pool' max?: number | undefined; min?: number | undefined; idleTimeoutMillis?: number | undefined | null; log?: ((...messages: any[]) => void) | undefined; Promise?: PromiseConstructorLike | undefined; allowExitOnIdle?: boolean | undefined; maxUses?: number | undefined; maxLifetimeSeconds?: number | undefined; Client?: (new() => ClientBase) | undefined; } export interface QueryConfig { name?: string | undefined; text: string; values?: QueryConfigValues; types?: CustomTypesConfig | undefined; } export interface CustomTypesConfig { getTypeParser: typeof pgTypes.getTypeParser; } export interface Submittable { submit: (connection: Connection) => void; } export interface QueryArrayConfig extends QueryConfig { rowMode: "array"; } export interface FieldDef { name: string; tableID: number; columnID: number; dataTypeID: number; dataTypeSize: number; dataTypeModifier: number; format: string; } export interface QueryResultBase { command: string; rowCount: number | null; oid: number; fields: FieldDef[]; } export interface QueryResultRow { [column: string]: any; } export interface QueryResult extends QueryResultBase { rows: R[]; } export interface QueryArrayResult extends QueryResultBase { rows: R[]; } export interface Notification { processId: number; channel: string; payload?: string | undefined; } export interface ResultBuilder extends QueryResult { addRow(row: R): void; } export interface QueryParse { name: string; text: string; types: string[]; } type ValueMapper = (param: any, index: number) => any; export interface BindConfig { portal?: string | undefined; statement?: string | undefined; binary?: string | undefined; values?: Array | undefined; valueMapper?: ValueMapper | undefined; } export interface ExecuteConfig { portal?: string | undefined; rows?: string | undefined; } export interface MessageConfig { type: string; name?: string | undefined; } export function escapeIdentifier(str: string): string; export function escapeLiteral(str: string): string; export class Connection extends events.EventEmitter { readonly stream: stream.Duplex; constructor(config?: ConnectionConfig); bind(config: BindConfig | null, more: boolean): void; execute(config: ExecuteConfig | null, more: boolean): void; parse(query: QueryParse, more: boolean): void; query(text: string): void; describe(msg: MessageConfig, more: boolean): void; close(msg: MessageConfig, more: boolean): void; flush(): void; sync(): void; end(): void; } export interface PoolOptions extends PoolConfig { max: number; maxUses: number; allowExitOnIdle: boolean; maxLifetimeSeconds: number; idleTimeoutMillis: number | null; } /** * {@link https://node-postgres.com/apis/pool} */ export class Pool extends events.EventEmitter { /** * Every field of the config object is entirely optional. * The config passed to the pool is also passed to every client * instance within the pool when the pool creates that client. */ constructor(config?: PoolConfig); readonly totalCount: number; readonly idleCount: number; readonly waitingCount: number; readonly expiredCount: number; readonly ending: boolean; readonly ended: boolean; options: PoolOptions; connect(): Promise; connect( callback: (err: Error | undefined, client: PoolClient | undefined, done: (release?: any) => void) => void, ): void; end(): Promise; end(callback: () => void): void; query(queryStream: T): T; // tslint:disable:no-unnecessary-generics query( queryConfig: QueryArrayConfig, values?: QueryConfigValues, ): Promise>; query( queryConfig: QueryConfig, ): Promise>; query( queryTextOrConfig: string | QueryConfig, values?: QueryConfigValues, ): Promise>; query( queryConfig: QueryArrayConfig, callback: (err: Error, result: QueryArrayResult) => void, ): void; query( queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void, ): void; query( queryText: string, values: QueryConfigValues, callback: (err: Error, result: QueryResult) => void, ): void; // tslint:enable:no-unnecessary-generics on(event: "release" | "error", listener: (err: Error, client: PoolClient) => void): this; on(event: "connect" | "acquire" | "remove", listener: (client: PoolClient) => void): this; } export class ClientBase extends events.EventEmitter { constructor(config?: string | ClientConfig); connect(): Promise; connect(callback: (err: Error) => void): void; query(queryStream: T): T; // tslint:disable:no-unnecessary-generics query( queryConfig: QueryArrayConfig, values?: QueryConfigValues, ): Promise>; query( queryConfig: QueryConfig, ): Promise>; query( queryTextOrConfig: string | QueryConfig, values?: QueryConfigValues, ): Promise>; query( queryConfig: QueryArrayConfig, callback: (err: Error, result: QueryArrayResult) => void, ): void; query( queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void, ): void; query( queryText: string, values: QueryConfigValues, callback: (err: Error, result: QueryResult) => void, ): void; // tslint:enable:no-unnecessary-generics copyFrom(queryText: string): stream.Writable; copyTo(queryText: string): stream.Readable; pauseDrain(): void; resumeDrain(): void; escapeIdentifier: typeof escapeIdentifier; escapeLiteral: typeof escapeLiteral; setTypeParser: typeof pgTypes.setTypeParser; getTypeParser: typeof pgTypes.getTypeParser; on(event: "drain", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: "notice", listener: (notice: NoticeMessage) => void): this; on(event: "notification", listener: (message: Notification) => void): this; // tslint:disable-next-line unified-signatures on(event: "end", listener: () => void): this; } export class Client extends ClientBase { user?: string | undefined; database?: string | undefined; port: number; host: string; password?: string | undefined; ssl: boolean; constructor(config?: string | ClientConfig); end(): Promise; end(callback: (err: Error) => void): void; } export interface PoolClient extends ClientBase { release(err?: Error | boolean): void; } export class Query extends events.EventEmitter implements Submittable { constructor(queryTextOrConfig?: string | QueryConfig, values?: QueryConfigValues); submit: (connection: Connection) => void; on(event: "row", listener: (row: R, result?: ResultBuilder) => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: "end", listener: (result: ResultBuilder) => void): this; } export class Events extends events.EventEmitter { on(event: "error", listener: (err: Error, client: Client) => void): this; } export const types: typeof pgTypes; export const defaults: Defaults & ClientConfig; import * as Pg from "."; export const native: typeof Pg | null; export { DatabaseError } from "pg-protocol"; pg/lib/000755 001751 000166 0000000000 14744520166013736 5ustar00runner000000 000000 1474452016614744520166pg/package.json000644 001751 000166 0000002031 14744520166015452 0ustar00runner000000 000000 1474452016614744520166{ "name": "@types/pg", "version": "8.11.11", "description": "TypeScript definitions for pg", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pg", "license": "MIT", "contributors": [ { "name": "Phips Peter", "githubUsername": "pspeter3", "url": "https://github.com/pspeter3" }, { "name": "Ravi van Rooijen", "githubUsername": "HoldYourWaffle", "url": "https://github.com/HoldYourWaffle" } ], "main": "", "types": "index.d.ts", "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", "directory": "types/pg" }, "scripts": {}, "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^4.0.1" }, "peerDependencies": {}, "typesPublisherContentHash": "5d09c31829f9e4fda446be2545d1f00cd7d549d5d3a8eaf15fa999d181174a71", "typeScriptVersion": "5.0" }pg/lib/connection-parameters.d.ts000644 001751 000166 0000003302 14744520166021026 0ustar00runner000000 000000 1474452016614744520166import { ConnectionOptions } from "tls"; import { ConnectionConfig } from ".."; interface ConnectionParametersConfig extends Pick< ConnectionConfig, | "user" | "database" | "password" | "port" | "host" | "options" | "ssl" | "application_name" | "statement_timeout" | "idle_in_transaction_session_timeout" | "query_timeout" > { binary?: unknown; client_encoding?: unknown; replication?: unknown; isDomainSocket?: unknown; fallback_application_name?: unknown; lock_timeout?: unknown; connect_timeout?: unknown; keepalives?: unknown; keepalives_idle?: unknown; } export = ConnectionParameters; declare class ConnectionParameters implements ConnectionParametersConfig { user?: string | undefined; database?: string | undefined; password?: string | (() => string | Promise) | undefined; port?: number | undefined; host?: string | undefined; statement_timeout?: false | number | undefined; ssl?: boolean | ConnectionOptions | undefined; query_timeout?: number | undefined; idle_in_transaction_session_timeout?: number | undefined; application_name?: string | undefined; options?: string | undefined; binary?: unknown; client_encoding?: unknown; replication?: unknown; isDomainSocket?: unknown; fallback_application_name?: unknown; lock_timeout?: unknown; connect_timeout?: unknown; keepalives?: unknown; keepalives_idle?: unknown; constructor(config?: string | ConnectionParametersConfig); getLibpqConnectionString(cb: (err: Error | null, params: string | null) => TResult): TResult; } pg/lib/type-overrides.d.ts000644 001751 000166 0000003552 14744520166017516 0ustar00runner000000 000000 1474452016614744520166import { CustomTypesConfig } from ".."; declare enum builtins { BOOL = 16, BYTEA = 17, CHAR = 18, INT8 = 20, INT2 = 21, INT4 = 23, REGPROC = 24, TEXT = 25, OID = 26, TID = 27, XID = 28, CID = 29, JSON = 114, XML = 142, PG_NODE_TREE = 194, SMGR = 210, PATH = 602, POLYGON = 604, CIDR = 650, FLOAT4 = 700, FLOAT8 = 701, ABSTIME = 702, RELTIME = 703, TINTERVAL = 704, CIRCLE = 718, MACADDR8 = 774, MONEY = 790, MACADDR = 829, INET = 869, ACLITEM = 1033, BPCHAR = 1042, VARCHAR = 1043, DATE = 1082, TIME = 1083, TIMESTAMP = 1114, TIMESTAMPTZ = 1184, INTERVAL = 1186, TIMETZ = 1266, BIT = 1560, VARBIT = 1562, NUMERIC = 1700, REFCURSOR = 1790, REGPROCEDURE = 2202, REGOPER = 2203, REGOPERATOR = 2204, REGCLASS = 2205, REGTYPE = 2206, UUID = 2950, TXID_SNAPSHOT = 2970, PG_LSN = 3220, PG_NDISTINCT = 3361, PG_DEPENDENCIES = 3402, TSVECTOR = 3614, TSQUERY = 3615, GTSVECTOR = 3642, REGCONFIG = 3734, REGDICTIONARY = 3769, JSONB = 3802, REGNAMESPACE = 4089, REGROLE = 4096, } type TypeId = builtins; type TypeParser = (value: I) => T; export = TypeOverrides; declare class TypeOverrides implements CustomTypesConfig { constructor(types?: CustomTypesConfig); setTypeParser(oid: number | TypeId, parseFn: TypeParser): void; setTypeParser(oid: number | TypeId, format: "text", parseFn: TypeParser): void; setTypeParser(oid: number | TypeId, format: "binary", parseFn: TypeParser): void; getTypeParser(oid: number | TypeId, format?: "text"): TypeParser; getTypeParser(oid: number | TypeId, format: "binary"): TypeParser; }