pg/LICENSE000777 177776 177776 0000002165 14211314300010625 0ustar00000000 000000 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.md000777 177776 177776 0000001313 14211314300011071 0ustar00000000 000000 # 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: Mon, 07 Mar 2022 05:31:43 GMT * Dependencies: [@types/pg-types](https://npmjs.com/package/@types/pg-types), [@types/pg-protocol](https://npmjs.com/package/@types/pg-protocol), [@types/node](https://npmjs.com/package/@types/node) * Global values: none # Credits These definitions were written by [Phips Peter](https://github.com/pspeter3), and [Ravi van Rooijen](https://github.com/HoldYourWaffle). pg/index.d.ts000777 177776 177776 0000022460 14211314300011521 0ustar00000000 000000 // Type definitions for pg 8.6 // Project: https://github.com/brianc/node-postgres // Definitions by: Phips Peter , Ravi van Rooijen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// 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 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 | undefined; statement_timeout?: false | number | undefined; parseInputDatesAsUTC?: boolean | undefined; ssl?: boolean | ConnectionOptions | undefined; query_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; } export interface PoolConfig extends ClientConfig { // properties from module 'node-pool' max?: number | undefined; min?: number | undefined; idleTimeoutMillis?: number | undefined; log?: ((...messages: any[]) => void) | undefined; Promise?: PromiseConstructorLike | undefined; allowExitOnIdle?: boolean | undefined; maxUses?: number | undefined; } export interface QueryConfig { name?: string | undefined; text: string; values?: I | undefined; 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; 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[]; } export interface BindConfig { portal?: string | undefined; statement?: string | undefined; binary?: string | undefined; values?: Array | undefined; } export interface ExecuteConfig { portal?: string | undefined; rows?: string | undefined; } export interface MessageConfig { type: string; name?: string | undefined; } 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; } /** * {@link https://node-postgres.com/api/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; connect(): Promise; connect(callback: (err: Error, client: PoolClient, 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?: I, ): Promise>; query( queryConfig: QueryConfig, ): Promise>; query( queryTextOrConfig: string | QueryConfig, values?: I, ): 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: I, callback: (err: Error, result: QueryResult) => void, ): void; // tslint:enable:no-unnecessary-generics on(event: '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?: I, ): Promise>; query( queryConfig: QueryConfig, ): Promise>; query( queryTextOrConfig: string | QueryConfig, values?: I, ): 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: any[], 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(str: string): string; escapeLiteral(str: string): string; 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?: I); 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/000777 177776 177776 0000000000 14211314300010357 5ustar00000000 000000 pg/lib/type-overrides.d.ts000777 177776 177776 0000000731 14211314300014136 0ustar00000000 000000 import { CustomTypesConfig } from '..'; type TypeParser = (oid: TOid) => TReturn; type TypeFormat = 'text' | 'binary'; export = TypeOverrides; declare class TypeOverrides implements CustomTypesConfig { constructor(types?: CustomTypesConfig); setTypeParser(oid: number, format: TypeFormat, fn: TypeParser): void; setTypeParser(oid: number, fn: TypeParser): void; getTypeParser(oid: number, format?: TypeFormat): TypeParser; } pg/package.json000777 177776 177776 0000001773 14211314300012112 0ustar00000000 000000 { "name": "@types/pg", "version": "8.6.5", "description": "TypeScript definitions for pg", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pg", "license": "MIT", "contributors": [ { "name": "Phips Peter", "url": "https://github.com/pspeter3", "githubUsername": "pspeter3" }, { "name": "Ravi van Rooijen", "url": "https://github.com/HoldYourWaffle", "githubUsername": "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": "^2.2.0" }, "typesPublisherContentHash": "256800974165ebea3f1c90c99c599220b880adf52ea6380821de95a5f08dd021", "typeScriptVersion": "3.9" }