From bc920384974159c1e25dff441283a3284eae1d45 Mon Sep 17 00:00:00 2001 From: Vitaly Tomilov Date: Thu, 15 Aug 2019 22:06:27 +0100 Subject: [PATCH] implementing #643 --- test/typescript/connection.ts | 2 ++ typescript/pg-subset.d.ts | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/typescript/connection.ts b/test/typescript/connection.ts index 9d87faa1..7be09a2d 100644 --- a/test/typescript/connection.ts +++ b/test/typescript/connection.ts @@ -30,6 +30,8 @@ r.ssl = { ca: '' }; +r.password = () => 'pass123'; + r.keepAlive = true; const db2 = pgp({ diff --git a/typescript/pg-subset.d.ts b/typescript/pg-subset.d.ts index 25f63691..4a3e0759 100644 --- a/typescript/pg-subset.d.ts +++ b/typescript/pg-subset.d.ts @@ -69,6 +69,8 @@ declare namespace pg { NPNProtocols?: string[] | Buffer | Buffer[] | Uint8Array | Uint8Array[] } + type DynamicPassword = string | (() => string) | (() => Promise); + // See: // 1) https://github.com/brianc/node-postgres/blob/master/lib/defaults.js // 2) https://github.com/brianc/node-pg-pool @@ -77,7 +79,7 @@ declare namespace pg { host?: string database?: string user?: string - password?: string + password?: DynamicPassword port?: number ssl?: boolean | ISSLConfig binary?: boolean @@ -190,7 +192,7 @@ declare namespace pg { database: string // database user's password - password: string + password: DynamicPassword // database port port: number @@ -255,7 +257,7 @@ declare namespace pg { connectionParameters: IConnectionParameters; database: string; user: string; - password: string; + password: DynamicPassword; port: number; host: string;