pg-promise 10.5.0-beta.0 → 10.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/connect.js +0 -12
- package/lib/utils/index.js +1 -8
- package/package.json +7 -7
- package/typescript/pg-subset.d.ts +8 -4
package/README.md
CHANGED
|
@@ -974,7 +974,7 @@ db.txIf({cnd}, t => {
|
|
|
974
974
|
This library manages all database connections via the [connection pool], which internally caches them.
|
|
975
975
|
|
|
976
976
|
Connections in the cache expire due to inactivity after [idleTimeoutMillis] number of milliseconds, which you
|
|
977
|
-
can set when creating the [Database] object.
|
|
977
|
+
can set only when creating the [Database] object.
|
|
978
978
|
|
|
979
979
|
While there is a single open connection in the pool, the process cannot terminate by itself, only via `process.exit()`.
|
|
980
980
|
If you want the process to finish by itself, without waiting for all connections in the pool to expire, you need
|
package/lib/connect.js
CHANGED
|
@@ -45,7 +45,6 @@ function poolConnect(ctx, db, config) {
|
|
|
45
45
|
enumerable: false,
|
|
46
46
|
writable: true
|
|
47
47
|
});
|
|
48
|
-
hidePassword(client); // See: https://github.com/brianc/node-postgres/issues/1568
|
|
49
48
|
setSchema(client, ctx);
|
|
50
49
|
}
|
|
51
50
|
setCtx(client, ctx);
|
|
@@ -78,7 +77,6 @@ function directConnect(ctx, config) {
|
|
|
78
77
|
});
|
|
79
78
|
reject(err);
|
|
80
79
|
} else {
|
|
81
|
-
hidePassword(client); // See: https://github.com/brianc/node-postgres/issues/1568
|
|
82
80
|
setSchema(client, ctx);
|
|
83
81
|
setCtx(client, ctx);
|
|
84
82
|
const end = lockClientEnd(client);
|
|
@@ -142,16 +140,6 @@ function setCtx(client, ctx) {
|
|
|
142
140
|
});
|
|
143
141
|
}
|
|
144
142
|
|
|
145
|
-
// See: https://github.com/brianc/node-postgres/issues/1568
|
|
146
|
-
function hidePassword(client) {
|
|
147
|
-
hideProperty(client, `password`);
|
|
148
|
-
hideProperty(client.connectionParameters, `password`);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function hideProperty(obj, prop) {
|
|
152
|
-
Object.defineProperty(obj, prop, {value: obj[prop], enumerable: false});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
143
|
function setSchema(client, ctx) {
|
|
156
144
|
let s = ctx.options.schema;
|
|
157
145
|
if (!s) {
|
package/lib/utils/index.js
CHANGED
|
@@ -80,6 +80,7 @@ function addReadProp(obj, name, value, hidden) {
|
|
|
80
80
|
// Converts a connection string or object into its safe copy:
|
|
81
81
|
// if password is present, it is masked with symbol '#'.
|
|
82
82
|
function getSafeConnection(cn) {
|
|
83
|
+
const maskPassword = cs => cs.replace(/:(?![/])([^@]+)/, (_, m) => `:` + new Array(m.length + 1).join(`#`));
|
|
83
84
|
if (typeof cn === `object`) {
|
|
84
85
|
const copy = Object.assign({}, cn);
|
|
85
86
|
if (typeof copy.password === `string`) {
|
|
@@ -93,14 +94,6 @@ function getSafeConnection(cn) {
|
|
|
93
94
|
return maskPassword(cn);
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
///////////////////////////////////////////////////////////
|
|
97
|
-
// Replaces password letters with # in a connection string.
|
|
98
|
-
function maskPassword(connectionString) {
|
|
99
|
-
return connectionString.replace(/:(?![/])([^@]+)/, (_, m) => {
|
|
100
|
-
return `:` + new Array(m.length + 1).join(`#`);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
97
|
///////////////////////////////////////////
|
|
105
98
|
// Returns a space gap for console output;
|
|
106
99
|
function messageGap(level) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-promise",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.2",
|
|
4
4
|
"description": "PostgreSQL interface for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "typescript/pg-promise.d.ts",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"assert-options": "0.6.1",
|
|
44
|
-
"pg": "8.0.
|
|
44
|
+
"pg": "8.0.3",
|
|
45
45
|
"pg-minify": "1.5.2",
|
|
46
46
|
"spex": "3.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "13.
|
|
49
|
+
"@types/node": "13.13.2",
|
|
50
50
|
"JSONStream": "1.3.5",
|
|
51
51
|
"bluebird": "3.7.2",
|
|
52
|
-
"coveralls": "3.0.
|
|
52
|
+
"coveralls": "3.0.13",
|
|
53
53
|
"eslint": "6.8.0",
|
|
54
|
-
"tslint": "6.1.
|
|
54
|
+
"tslint": "6.1.1",
|
|
55
55
|
"istanbul": "0.4.5",
|
|
56
56
|
"jasmine-node": "3.0.0",
|
|
57
|
-
"jsdoc": "3.6.
|
|
58
|
-
"pg-query-stream": "3.0.
|
|
57
|
+
"jsdoc": "3.6.4",
|
|
58
|
+
"pg-query-stream": "3.0.7",
|
|
59
59
|
"typescript": "3.8.3"
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// Calling it 'pg-subset' to avoid a conflict in case the application also
|
|
14
14
|
// includes the official 'pg' typings.
|
|
15
15
|
//
|
|
16
|
-
// Supported version of pg:
|
|
16
|
+
// Supported version of pg: 8.0.0 and later.
|
|
17
17
|
//
|
|
18
18
|
// pg: https://github.com/brianc/node-postgres
|
|
19
19
|
//////////////////////////////////////////////////////////////////////////////
|
|
@@ -212,9 +212,13 @@ declare namespace pg {
|
|
|
212
212
|
// 0 will disable connection pooling
|
|
213
213
|
max: number
|
|
214
214
|
|
|
215
|
-
// max milliseconds a client can go unused before it is removed
|
|
216
|
-
//
|
|
217
|
-
|
|
215
|
+
// max milliseconds a client can go unused before it is removed from the pool and destroyed;
|
|
216
|
+
//
|
|
217
|
+
// Made unavailable in v10.5.0, due to the following:
|
|
218
|
+
// - https://github.com/brianc/node-postgres/issues/2139
|
|
219
|
+
// - https://github.com/vitaly-t/pg-promise/issues/703
|
|
220
|
+
//
|
|
221
|
+
// idleTimeoutMillis: number
|
|
218
222
|
|
|
219
223
|
client_encoding: string
|
|
220
224
|
|