Skip to content

Commit

Permalink
implementing #643
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Aug 15, 2019
1 parent 3243141 commit bc92038
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions test/typescript/connection.ts
Expand Up @@ -30,6 +30,8 @@ r.ssl = {
ca: ''
};

r.password = () => 'pass123';

r.keepAlive = true;

const db2 = pgp({
Expand Down
8 changes: 5 additions & 3 deletions typescript/pg-subset.d.ts
Expand Up @@ -69,6 +69,8 @@ declare namespace pg {
NPNProtocols?: string[] | Buffer | Buffer[] | Uint8Array | Uint8Array[]
}

type DynamicPassword = string | (() => string) | (() => Promise<string>);

// See:
// 1) https://github.com/brianc/node-postgres/blob/master/lib/defaults.js
// 2) https://github.com/brianc/node-pg-pool
Expand All @@ -77,7 +79,7 @@ declare namespace pg {
host?: string
database?: string
user?: string
password?: string
password?: DynamicPassword
port?: number
ssl?: boolean | ISSLConfig
binary?: boolean
Expand Down Expand Up @@ -190,7 +192,7 @@ declare namespace pg {
database: string

// database user's password
password: string
password: DynamicPassword

// database port
port: number
Expand Down Expand Up @@ -255,7 +257,7 @@ declare namespace pg {
connectionParameters: IConnectionParameters;
database: string;
user: string;
password: string;
password: DynamicPassword;
port: number;
host: string;

Expand Down

0 comments on commit bc92038

Please sign in to comment.