pg-promise 12.1.1 → 12.1.3
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/lib/database.js +2 -2
- package/lib/query.js +2 -2
- package/lib/special-query.js +1 -1
- package/lib/stream.js +1 -1
- package/lib/task.js +4 -11
- package/lib/utils/color.js +2 -2
- package/lib/utils/index.js +5 -5
- package/package.json +4 -3
package/lib/database.js
CHANGED
|
@@ -18,7 +18,7 @@ const npm = {
|
|
|
18
18
|
utils: require('./utils'),
|
|
19
19
|
pubUtils: require('./utils/public'),
|
|
20
20
|
connect: require('./connect'),
|
|
21
|
-
query: require('./query'),
|
|
21
|
+
query: require('./query').query,
|
|
22
22
|
task: require('./task'),
|
|
23
23
|
text: require('./text')
|
|
24
24
|
};
|
|
@@ -1612,7 +1612,7 @@ function onError(err) {
|
|
|
1612
1612
|
module.exports = config => {
|
|
1613
1613
|
const npmLocal = config.$npm;
|
|
1614
1614
|
npmLocal.connect = npmLocal.connect || npm.connect(config);
|
|
1615
|
-
npmLocal.query = npmLocal.query || npm.query
|
|
1615
|
+
npmLocal.query = npmLocal.query || npm.query;
|
|
1616
1616
|
npmLocal.task = npmLocal.task || npm.task(config);
|
|
1617
1617
|
return Database;
|
|
1618
1618
|
};
|
package/lib/query.js
CHANGED
|
@@ -18,7 +18,7 @@ const npm = {
|
|
|
18
18
|
utils: require('./utils'),
|
|
19
19
|
formatting: require('./formatting'),
|
|
20
20
|
errors: require('./errors'),
|
|
21
|
-
stream: require('./stream'),
|
|
21
|
+
stream: require('./stream').stream,
|
|
22
22
|
text: require('./text')
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -270,4 +270,4 @@ function makeIterable(r) {
|
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
module.exports =
|
|
273
|
+
module.exports = {query: $query};
|
package/lib/special-query.js
CHANGED
package/lib/stream.js
CHANGED
package/lib/task.js
CHANGED
|
@@ -13,7 +13,7 @@ const npm = {
|
|
|
13
13
|
spex: require('spex'),
|
|
14
14
|
utils: require('./utils'),
|
|
15
15
|
mode: require('./tx-mode'),
|
|
16
|
-
query: require('./query'),
|
|
16
|
+
query: require('./query').query,
|
|
17
17
|
text: require('./text')
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -193,9 +193,7 @@ const callback = (ctx, obj, cb) => {
|
|
|
193
193
|
|
|
194
194
|
try {
|
|
195
195
|
if (cb.constructor.name === 'GeneratorFunction') {
|
|
196
|
-
|
|
197
|
-
// Clients should use the new ES7 async/await syntax.
|
|
198
|
-
throw new TypeError('ES6 generator functions are no longer supported!');
|
|
196
|
+
throw new TypeError('ES6 generator functions are not supported!');
|
|
199
197
|
}
|
|
200
198
|
result = cb.call(obj, obj); // invoking the callback function;
|
|
201
199
|
} catch (err) {
|
|
@@ -206,7 +204,7 @@ const callback = (ctx, obj, cb) => {
|
|
|
206
204
|
});
|
|
207
205
|
return Promise.reject(err); // reject with the error;
|
|
208
206
|
}
|
|
209
|
-
if (result
|
|
207
|
+
if (result instanceof Promise) {
|
|
210
208
|
return result; // result is a valid promise object;
|
|
211
209
|
}
|
|
212
210
|
return Promise.resolve(result);
|
|
@@ -325,13 +323,8 @@ const execute = (ctx, obj, isTX, config) => {
|
|
|
325
323
|
|
|
326
324
|
module.exports = config => {
|
|
327
325
|
const npmLocal = config.$npm;
|
|
328
|
-
|
|
329
|
-
// istanbul ignore next:
|
|
330
|
-
// we keep 'npm.query' initialization here, even though it is always
|
|
331
|
-
// pre-initialized by the 'database' module, for integrity purpose.
|
|
332
|
-
npmLocal.query = npmLocal.query || npm.query();
|
|
326
|
+
npmLocal.query = npmLocal.query || npm.query;
|
|
333
327
|
npmLocal.spex = npmLocal.spex || npm.spex;
|
|
334
|
-
|
|
335
328
|
return {
|
|
336
329
|
Task, execute, callback
|
|
337
330
|
};
|
package/lib/utils/color.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const {format} = require('util');
|
|
2
2
|
|
|
3
3
|
class ColorConsole {
|
|
4
4
|
|
|
@@ -41,7 +41,7 @@ class ColorConsole {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
static formatColor(args, color) {
|
|
44
|
-
return args.map(a => `\x1b[${color}m${
|
|
44
|
+
return args.map(a => `\x1b[${color}m${format(a)}\x1b[0m`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
package/lib/utils/index.js
CHANGED
|
@@ -57,11 +57,11 @@ function addReadProp(obj, name, value, hidden) {
|
|
|
57
57
|
|
|
58
58
|
//////////////////////////////////////////////////////////////
|
|
59
59
|
// Converts a connection string or object into its safe copy:
|
|
60
|
-
// if password is present, it is masked with symbol '#'.
|
|
60
|
+
// if a password is present, it is masked with the symbol '#'.
|
|
61
61
|
function getSafeConnection(cn) {
|
|
62
62
|
const maskPassword = cs => cs.replace(/:(?![/])([^@]+)/, (_, m) => ':' + new Array(m.length + 1).join('#'));
|
|
63
63
|
if (typeof cn === 'object') {
|
|
64
|
-
const copy =
|
|
64
|
+
const copy = {...cn};
|
|
65
65
|
if (typeof copy.password === 'string') {
|
|
66
66
|
copy.password = copy.password.replace(/./g, '#');
|
|
67
67
|
}
|
|
@@ -88,7 +88,7 @@ function inherits(child, parent) {
|
|
|
88
88
|
// istanbul ignore next
|
|
89
89
|
function getLocalStack(startIdx, maxLines) {
|
|
90
90
|
// from the call stack, we take up to maximum lines,
|
|
91
|
-
// starting with specified line index:
|
|
91
|
+
// starting with the specified line index:
|
|
92
92
|
startIdx = startIdx || 0;
|
|
93
93
|
const endIdx = maxLines > 0 ? startIdx + maxLines : undefined;
|
|
94
94
|
return new Error().stack
|
|
@@ -105,8 +105,8 @@ function InternalError(error) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/////////////////////////////////////////////////////////////////
|
|
108
|
-
// Parses a property name
|
|
109
|
-
// if the property exists. Returns object {valid, has, target, value}:
|
|
108
|
+
// Parses a property name and gets its name from the object
|
|
109
|
+
// if the property exists. Returns an object {valid, has, target, value}:
|
|
110
110
|
// - valid - true/false, whether the syntax is valid
|
|
111
111
|
// - has - a flag that property exists; set when 'valid' = true
|
|
112
112
|
// - target - the target object that contains the property; set when 'has' = true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-promise",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.3",
|
|
4
4
|
"description": "PostgreSQL interface for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "typescript/pg-promise.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"coverage": "istanbul cover ./node_modules/jasmine-node/bin/jasmine-node --captureExceptions test",
|
|
10
10
|
"doc": "jsdoc -c ./jsdoc/jsdoc.js ./jsdoc/README.md -t ./jsdoc/templates/custom",
|
|
11
11
|
"lint": "eslint ./lib ./test/*.js ./test/db",
|
|
12
|
+
"lint:fix": "npm run lint -- --fix",
|
|
12
13
|
"test": "jasmine-node --captureExceptions test",
|
|
13
14
|
"test:init": "node test/db/init.js",
|
|
14
15
|
"test:native": "jasmine-node test --config PG_NATIVE true"
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"assert-options": "0.8.3",
|
|
44
45
|
"pg": "8.16.3",
|
|
45
46
|
"pg-minify": "1.8.0",
|
|
46
|
-
"spex": "4.0.
|
|
47
|
+
"spex": "4.0.2"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"pg-query-stream": "4.10.3"
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"@eslint/js": "9.34.0",
|
|
53
54
|
"@types/node": "24.3.0",
|
|
54
55
|
"coveralls": "3.1.1",
|
|
55
|
-
"cspell": "9.2.
|
|
56
|
+
"cspell": "9.2.1",
|
|
56
57
|
"eslint": "9.34.0",
|
|
57
58
|
"globals": "16.3.0",
|
|
58
59
|
"istanbul": "0.4.5",
|