pg-promise 12.1.2 → 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 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 = () => $query;
273
+ module.exports = {query: $query};
@@ -27,4 +27,4 @@ const cache = {
27
27
  streamQuery: new SpecialQuery(specialQueryType.stream)
28
28
  };
29
29
 
30
- module.exports = Object.assign({SpecialQuery}, cache);
30
+ module.exports = {SpecialQuery, ...cache};
package/lib/stream.js CHANGED
@@ -122,4 +122,4 @@ function $stream(ctx, qs, initCB) {
122
122
 
123
123
  }
124
124
 
125
- module.exports = $stream;
125
+ module.exports = {stream: $stream};
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
 
@@ -323,13 +323,8 @@ const execute = (ctx, obj, isTX, config) => {
323
323
 
324
324
  module.exports = config => {
325
325
  const npmLocal = config.$npm;
326
-
327
- // istanbul ignore next:
328
- // we keep 'npm.query' initialization here, even though it is always
329
- // pre-initialized by the 'database' module, for integrity purpose.
330
- npmLocal.query = npmLocal.query || npm.query();
326
+ npmLocal.query = npmLocal.query || npm.query;
331
327
  npmLocal.spex = npmLocal.spex || npm.spex;
332
-
333
328
  return {
334
329
  Task, execute, callback
335
330
  };
@@ -1,4 +1,4 @@
1
- const util = require('util');
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${util.format(a)}\x1b[0m`);
44
+ return args.map(a => `\x1b[${color}m${format(a)}\x1b[0m`);
45
45
  }
46
46
  }
47
47
 
@@ -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 = Object.assign({}, cn);
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, and gets its name from the object,
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.2",
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",