pg-promise 11.4.0 → 11.4.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.
Files changed (43) hide show
  1. package/README.md +42 -42
  2. package/lib/assert.js +1 -1
  3. package/lib/connect.js +17 -17
  4. package/lib/database-pool.js +5 -5
  5. package/lib/database.js +37 -37
  6. package/lib/errors/index.js +4 -4
  7. package/lib/errors/parameterized-query-error.js +12 -12
  8. package/lib/errors/prepared-statement-error.js +13 -13
  9. package/lib/errors/query-file-error.js +10 -10
  10. package/lib/errors/query-result-error.js +13 -13
  11. package/lib/events.js +17 -17
  12. package/lib/formatting.js +69 -69
  13. package/lib/helpers/column-set.js +29 -29
  14. package/lib/helpers/column.js +39 -39
  15. package/lib/helpers/index.js +4 -4
  16. package/lib/helpers/methods/concat.js +9 -9
  17. package/lib/helpers/methods/index.js +5 -5
  18. package/lib/helpers/methods/insert.js +15 -15
  19. package/lib/helpers/methods/sets.js +5 -5
  20. package/lib/helpers/methods/update.js +22 -22
  21. package/lib/helpers/methods/values.js +10 -10
  22. package/lib/helpers/table-name.js +7 -7
  23. package/lib/index.js +3 -3
  24. package/lib/inner-state.js +3 -3
  25. package/lib/main.js +32 -32
  26. package/lib/patterns.js +1 -1
  27. package/lib/promise-adapter.js +12 -12
  28. package/lib/promise-parser.js +7 -7
  29. package/lib/query-file.js +21 -21
  30. package/lib/query.js +19 -19
  31. package/lib/stream.js +11 -11
  32. package/lib/task.js +25 -25
  33. package/lib/text.js +17 -17
  34. package/lib/tx-mode.js +14 -14
  35. package/lib/types/index.js +3 -3
  36. package/lib/types/parameterized-query.js +16 -16
  37. package/lib/types/prepared-statement.js +18 -18
  38. package/lib/types/server-formatting.js +3 -3
  39. package/lib/utils/color.js +1 -1
  40. package/lib/utils/index.js +20 -20
  41. package/lib/utils/public.js +26 -26
  42. package/package.json +5 -5
  43. package/typescript/pg-subset.d.ts +1 -1
package/lib/text.js CHANGED
@@ -9,32 +9,32 @@
9
9
 
10
10
  /* All error messages used in the module */
11
11
 
12
- const streamVersion = require(`../package.json`)
13
- .devDependencies[`pg-query-stream`];
12
+ const streamVersion = require('../package.json')
13
+ .devDependencies['pg-query-stream'];
14
14
 
15
15
  module.exports = {
16
- nativeError: `Failed to initialize Native Bindings.`,
16
+ nativeError: 'Failed to initialize Native Bindings.',
17
17
 
18
18
  /* Database errors */
19
- queryDisconnected: `Cannot execute a query on a disconnected client.`,
20
- invalidQuery: `Invalid query format.`,
21
- invalidFunction: `Invalid function name.`,
22
- invalidProc: `Invalid procedure name.`,
23
- invalidMask: `Invalid Query Result Mask specified.`,
24
- looseQuery: `Querying against a released or lost connection.`,
19
+ queryDisconnected: 'Cannot execute a query on a disconnected client.',
20
+ invalidQuery: 'Invalid query format.',
21
+ invalidFunction: 'Invalid function name.',
22
+ invalidProc: 'Invalid procedure name.',
23
+ invalidMask: 'Invalid Query Result Mask specified.',
24
+ looseQuery: 'Querying against a released or lost connection.',
25
25
 
26
26
  /* result errors */
27
- notEmpty: `No return data was expected.`,
28
- noData: `No data returned from the query.`,
29
- multiple: `Multiple rows were not expected.`,
27
+ notEmpty: 'No return data was expected.',
28
+ noData: 'No data returned from the query.',
29
+ multiple: 'Multiple rows were not expected.',
30
30
 
31
31
  /* streaming support */
32
- nativeStreaming: `Streaming doesn't work with Native Bindings.`,
32
+ nativeStreaming: 'Streaming doesn\'t work with Native Bindings.',
33
33
  invalidStream: `Invalid or missing stream object: pg-query-stream >= v${streamVersion} was expected`,
34
- invalidStreamState: `Invalid stream state.`,
35
- invalidStreamCB: `Invalid or missing stream initialization callback.`,
34
+ invalidStreamState: 'Invalid stream state.',
35
+ invalidStreamCB: 'Invalid or missing stream initialization callback.',
36
36
 
37
37
  /* connection errors */
38
- poolDestroyed: `Connection pool of the database object has been destroyed.`,
39
- clientEnd: `Abnormal client.end() call, due to invalid code or failed server connection.`
38
+ poolDestroyed: 'Connection pool of the database object has been destroyed.',
39
+ clientEnd: 'Abnormal client.end() call, due to invalid code or failed server connection.'
40
40
  };
package/lib/tx-mode.js CHANGED
@@ -7,9 +7,9 @@
7
7
  * Removal or modification of this copyright notice is prohibited.
8
8
  */
9
9
 
10
- const {InnerState} = require(`./inner-state`);
11
- const {addInspection} = require(`./utils`);
12
- const {assert} = require(`./assert`);
10
+ const {InnerState} = require('./inner-state');
11
+ const {addInspection} = require('./utils');
12
+ const {assert} = require('./assert');
13
13
 
14
14
  /**
15
15
  * @enum {number}
@@ -103,42 +103,42 @@ const isolationLevel = {
103
103
  class TransactionMode extends InnerState {
104
104
 
105
105
  constructor(options) {
106
- options = assert(options, [`tiLevel`, `deferrable`, `readOnly`]);
106
+ options = assert(options, ['tiLevel', 'deferrable', 'readOnly']);
107
107
  const {readOnly, deferrable} = options;
108
108
  let {tiLevel} = options;
109
- let level, accessMode, deferrableMode, begin = `begin`;
109
+ let level, accessMode, deferrableMode, begin = 'begin';
110
110
  tiLevel = (tiLevel > 0) ? parseInt(tiLevel) : 0;
111
111
 
112
112
  if (tiLevel > 0 && tiLevel < 4) {
113
- const values = [`serializable`, `repeatable read`, `read committed`];
114
- level = `isolation level ` + values[tiLevel - 1];
113
+ const values = ['serializable', 'repeatable read', 'read committed'];
114
+ level = 'isolation level ' + values[tiLevel - 1];
115
115
  }
116
116
  if (readOnly) {
117
- accessMode = `read only`;
117
+ accessMode = 'read only';
118
118
  } else {
119
119
  if (readOnly !== undefined) {
120
- accessMode = `read write`;
120
+ accessMode = 'read write';
121
121
  }
122
122
  }
123
123
  // From the official documentation: http://www.postgresql.org/docs/9.5/static/sql-set-transaction.html
124
124
  // The DEFERRABLE transaction property has no effect unless the transaction is also SERIALIZABLE and READ ONLY
125
125
  if (tiLevel === isolationLevel.serializable && readOnly) {
126
126
  if (deferrable) {
127
- deferrableMode = `deferrable`;
127
+ deferrableMode = 'deferrable';
128
128
  } else {
129
129
  if (deferrable !== undefined) {
130
- deferrableMode = `not deferrable`;
130
+ deferrableMode = 'not deferrable';
131
131
  }
132
132
  }
133
133
  }
134
134
  if (level) {
135
- begin += ` ` + level;
135
+ begin += ' ' + level;
136
136
  }
137
137
  if (accessMode) {
138
- begin += ` ` + accessMode;
138
+ begin += ' ' + accessMode;
139
139
  }
140
140
  if (deferrableMode) {
141
- begin += ` ` + deferrableMode;
141
+ begin += ' ' + deferrableMode;
142
142
  }
143
143
 
144
144
  super({begin, capBegin: begin.toUpperCase()});
@@ -7,9 +7,9 @@
7
7
  * Removal or modification of this copyright notice is prohibited.
8
8
  */
9
9
 
10
- const {ServerFormatting} = require(`./server-formatting`);
11
- const {PreparedStatement} = require(`./prepared-statement`);
12
- const {ParameterizedQuery} = require(`./parameterized-query`);
10
+ const {ServerFormatting} = require('./server-formatting');
11
+ const {PreparedStatement} = require('./prepared-statement');
12
+ const {ParameterizedQuery} = require('./parameterized-query');
13
13
 
14
14
  module.exports = {
15
15
  ServerFormatting,
@@ -7,14 +7,14 @@
7
7
  * Removal or modification of this copyright notice is prohibited.
8
8
  */
9
9
 
10
- const {ServerFormatting} = require(`./server-formatting`);
11
- const {ParameterizedQueryError} = require(`../errors`);
12
- const {QueryFile} = require(`../query-file`);
13
- const {assert} = require(`../assert`);
10
+ const {ServerFormatting} = require('./server-formatting');
11
+ const {ParameterizedQueryError} = require('../errors');
12
+ const {QueryFile} = require('../query-file');
13
+ const {assert} = require('../assert');
14
14
 
15
15
  const npm = {
16
- EOL: require(`os`).EOL,
17
- utils: require(`../utils`)
16
+ EOL: require('os').EOL,
17
+ utils: require('../utils')
18
18
  };
19
19
 
20
20
  /**
@@ -86,12 +86,12 @@ const npm = {
86
86
  */
87
87
  class ParameterizedQuery extends ServerFormatting {
88
88
  constructor(options) {
89
- if (typeof options === `string` || options instanceof QueryFile) {
89
+ if (typeof options === 'string' || options instanceof QueryFile) {
90
90
  options = {
91
91
  text: options
92
92
  };
93
93
  } else {
94
- options = assert(options, [`text`, `values`, `binary`, `rowMode`]);
94
+ options = assert(options, ['text', 'values', 'binary', 'rowMode']);
95
95
  }
96
96
  super(options);
97
97
  }
@@ -133,7 +133,7 @@ ParameterizedQuery.prototype.parse = function () {
133
133
  }
134
134
 
135
135
  if (!npm.utils.isText(_i.target.text)) {
136
- errors.push(`Property 'text' must be a non-empty text string.`);
136
+ errors.push('Property \'text\' must be a non-empty text string.');
137
137
  }
138
138
 
139
139
  if (!npm.utils.isNull(values)) {
@@ -174,24 +174,24 @@ ParameterizedQuery.prototype.toString = function (level) {
174
174
  const gap = npm.utils.messageGap(level + 1);
175
175
  const pq = this.parse();
176
176
  const lines = [
177
- `ParameterizedQuery {`
177
+ 'ParameterizedQuery {'
178
178
  ];
179
179
  if (npm.utils.isText(pq.text)) {
180
- lines.push(gap + `text: "` + pq.text + `"`);
180
+ lines.push(gap + 'text: "' + pq.text + '"');
181
181
  }
182
182
  if (this.values !== undefined) {
183
- lines.push(gap + `values: ` + npm.utils.toJson(this.values));
183
+ lines.push(gap + 'values: ' + npm.utils.toJson(this.values));
184
184
  }
185
185
  if (this.binary !== undefined) {
186
- lines.push(gap + `binary: ` + npm.utils.toJson(this.binary));
186
+ lines.push(gap + 'binary: ' + npm.utils.toJson(this.binary));
187
187
  }
188
188
  if (this.rowMode !== undefined) {
189
- lines.push(gap + `rowMode: ` + npm.utils.toJson(this.rowMode));
189
+ lines.push(gap + 'rowMode: ' + npm.utils.toJson(this.rowMode));
190
190
  }
191
191
  if (this.error !== undefined) {
192
- lines.push(gap + `error: ` + this.error.toString(level + 1));
192
+ lines.push(gap + 'error: ' + this.error.toString(level + 1));
193
193
  }
194
- lines.push(npm.utils.messageGap(level) + `}`);
194
+ lines.push(npm.utils.messageGap(level) + '}');
195
195
  return lines.join(npm.EOL);
196
196
  };
197
197
 
@@ -7,14 +7,14 @@
7
7
  * Removal or modification of this copyright notice is prohibited.
8
8
  */
9
9
 
10
- const {ServerFormatting} = require(`./server-formatting`);
11
- const {PreparedStatementError} = require(`../errors`);
12
- const {QueryFile} = require(`../query-file`);
13
- const {assert} = require(`../assert`);
10
+ const {ServerFormatting} = require('./server-formatting');
11
+ const {PreparedStatementError} = require('../errors');
12
+ const {QueryFile} = require('../query-file');
13
+ const {assert} = require('../assert');
14
14
 
15
15
  const npm = {
16
- EOL: require(`os`).EOL,
17
- utils: require(`../utils`)
16
+ EOL: require('os').EOL,
17
+ utils: require('../utils')
18
18
  };
19
19
 
20
20
  /**
@@ -89,7 +89,7 @@ const npm = {
89
89
  */
90
90
  class PreparedStatement extends ServerFormatting {
91
91
  constructor(options) {
92
- options = assert(options, [`name`, `text`, `values`, `binary`, `rowMode`, `rows`]);
92
+ options = assert(options, ['name', 'text', 'values', 'binary', 'rowMode', 'rows']);
93
93
  super(options);
94
94
  }
95
95
 
@@ -161,7 +161,7 @@ PreparedStatement.prototype.parse = function () {
161
161
  _i.currentError = undefined;
162
162
 
163
163
  if (!npm.utils.isText(_i.target.name)) {
164
- errors.push(`Property 'name' must be a non-empty text string.`);
164
+ errors.push('Property \'name\' must be a non-empty text string.');
165
165
  }
166
166
 
167
167
  if (qf) {
@@ -173,7 +173,7 @@ PreparedStatement.prototype.parse = function () {
173
173
  }
174
174
  }
175
175
  if (!npm.utils.isText(_i.target.text)) {
176
- errors.push(`Property 'text' must be a non-empty text string.`);
176
+ errors.push('Property \'text\' must be a non-empty text string.');
177
177
  }
178
178
 
179
179
  if (!npm.utils.isNull(values)) {
@@ -218,28 +218,28 @@ PreparedStatement.prototype.toString = function (level) {
218
218
  const gap = npm.utils.messageGap(level + 1);
219
219
  const ps = this.parse();
220
220
  const lines = [
221
- `PreparedStatement {`,
222
- gap + `name: ` + npm.utils.toJson(this.name)
221
+ 'PreparedStatement {',
222
+ gap + 'name: ' + npm.utils.toJson(this.name)
223
223
  ];
224
224
  if (npm.utils.isText(ps.text)) {
225
- lines.push(gap + `text: "` + ps.text + `"`);
225
+ lines.push(gap + 'text: "' + ps.text + '"');
226
226
  }
227
227
  if (this.values !== undefined) {
228
- lines.push(gap + `values: ` + npm.utils.toJson(this.values));
228
+ lines.push(gap + 'values: ' + npm.utils.toJson(this.values));
229
229
  }
230
230
  if (this.binary !== undefined) {
231
- lines.push(gap + `binary: ` + npm.utils.toJson(this.binary));
231
+ lines.push(gap + 'binary: ' + npm.utils.toJson(this.binary));
232
232
  }
233
233
  if (this.rowMode !== undefined) {
234
- lines.push(gap + `rowMode: ` + npm.utils.toJson(this.rowMode));
234
+ lines.push(gap + 'rowMode: ' + npm.utils.toJson(this.rowMode));
235
235
  }
236
236
  if (this.rows !== undefined) {
237
- lines.push(gap + `rows: ` + npm.utils.toJson(this.rows));
237
+ lines.push(gap + 'rows: ' + npm.utils.toJson(this.rows));
238
238
  }
239
239
  if (this.error) {
240
- lines.push(gap + `error: ` + this.error.toString(level + 1));
240
+ lines.push(gap + 'error: ' + this.error.toString(level + 1));
241
241
  }
242
- lines.push(npm.utils.messageGap(level) + `}`);
242
+ lines.push(npm.utils.messageGap(level) + '}');
243
243
  return lines.join(npm.EOL);
244
244
  };
245
245
 
@@ -1,6 +1,6 @@
1
- const {InnerState} = require(`../inner-state`);
2
- const {addInspection} = require(`../utils`);
3
- const utils = require(`../utils`);
1
+ const {InnerState} = require('../inner-state');
2
+ const {addInspection} = require('../utils');
3
+ const utils = require('../utils');
4
4
 
5
5
  /**
6
6
  * @private
@@ -1,4 +1,4 @@
1
- const util = require(`util`);
1
+ const util = require('util');
2
2
 
3
3
  class ColorConsole {
4
4
 
@@ -8,9 +8,9 @@
8
8
  */
9
9
 
10
10
  const npm = {
11
- path: require(`path`),
12
- util: require(`util`),
13
- patterns: require(`../patterns`)
11
+ path: require('path'),
12
+ util: require('util'),
13
+ patterns: require('../patterns')
14
14
  };
15
15
 
16
16
  ////////////////////////////////////////////
@@ -22,7 +22,7 @@ function isNull(value) {
22
22
  ////////////////////////////////////////////////////////
23
23
  // Verifies parameter for being a non-empty text string;
24
24
  function isText(txt) {
25
- return txt && typeof txt === `string` && /\S/.test(txt);
25
+ return txt && typeof txt === 'string' && /\S/.test(txt);
26
26
  }
27
27
 
28
28
  ///////////////////////////////////////////////////////////
@@ -31,8 +31,8 @@ function isText(txt) {
31
31
  // Proper configuration is having NODE_ENV = 'development', but this
32
32
  // method only checks for 'dev' being present, and regardless of the case.
33
33
  function isDev() {
34
- const env = global.process.env.NODE_ENV || ``;
35
- return env.toLowerCase().indexOf(`dev`) !== -1;
34
+ const env = global.process.env.NODE_ENV || '';
35
+ return env.toLowerCase().indexOf('dev') !== -1;
36
36
  }
37
37
 
38
38
  /////////////////////////////////////////////
@@ -59,13 +59,13 @@ function addReadProp(obj, name, value, hidden) {
59
59
  // Converts a connection string or object into its safe copy:
60
60
  // if password is present, it is masked with symbol '#'.
61
61
  function getSafeConnection(cn) {
62
- const maskPassword = cs => cs.replace(/:(?![/])([^@]+)/, (_, m) => `:` + new Array(m.length + 1).join(`#`));
63
- if (typeof cn === `object`) {
62
+ const maskPassword = cs => cs.replace(/:(?![/])([^@]+)/, (_, m) => ':' + new Array(m.length + 1).join('#'));
63
+ if (typeof cn === 'object') {
64
64
  const copy = Object.assign({}, cn);
65
- if (typeof copy.password === `string`) {
66
- copy.password = copy.password.replace(/./g, `#`);
65
+ if (typeof copy.password === 'string') {
66
+ copy.password = copy.password.replace(/./g, '#');
67
67
  }
68
- if (typeof copy.connectionString === `string`) {
68
+ if (typeof copy.connectionString === 'string') {
69
69
  copy.connectionString = maskPassword(copy.connectionString);
70
70
  }
71
71
  return copy;
@@ -76,7 +76,7 @@ function getSafeConnection(cn) {
76
76
  ///////////////////////////////////////////
77
77
  // Returns a space gap for console output;
78
78
  function messageGap(level) {
79
- return ` `.repeat(level * 4);
79
+ return ' '.repeat(level * 4);
80
80
  }
81
81
 
82
82
  /////////////////////////////////////////
@@ -92,10 +92,10 @@ function getLocalStack(startIdx, maxLines) {
92
92
  startIdx = startIdx || 0;
93
93
  const endIdx = maxLines > 0 ? startIdx + maxLines : undefined;
94
94
  return new Error().stack
95
- .split(`\n`)
95
+ .split('\n')
96
96
  .filter(line => line.match(/\(.+\)/))
97
97
  .slice(startIdx, endIdx)
98
- .join(`\n`);
98
+ .join('\n');
99
99
  }
100
100
 
101
101
  //////////////////////////////
@@ -113,14 +113,14 @@ function InternalError(error) {
113
113
  // - value - the value; set when 'has' = true
114
114
  function getIfHas(obj, prop) {
115
115
  const result = {valid: true};
116
- if (prop.indexOf(`.`) === -1) {
116
+ if (prop.indexOf('.') === -1) {
117
117
  result.has = prop in obj;
118
118
  result.target = obj;
119
119
  if (result.has) {
120
120
  result.value = obj[prop];
121
121
  }
122
122
  } else {
123
- const names = prop.split(`.`);
123
+ const names = prop.split('.');
124
124
  let missing, target;
125
125
  for (let i = 0; i < names.length; i++) {
126
126
  const n = names[i];
@@ -147,7 +147,7 @@ function getIfHas(obj, prop) {
147
147
  /////////////////////////////////////////////////////////////////////////
148
148
  // Checks if the property exists in the object or value or its prototype;
149
149
  function hasProperty(value, prop) {
150
- return (value && typeof value === `object` && prop in value) ||
150
+ return (value && typeof value === 'object' && prop in value) ||
151
151
  value !== null && value !== undefined && value[prop] !== undefined;
152
152
  }
153
153
 
@@ -161,10 +161,10 @@ function addInspection(type, cb) {
161
161
  // Identifies a general connectivity error, after which no more queries can be executed.
162
162
  // This is for detecting when to skip executing ROLLBACK for a failed transaction.
163
163
  function isConnectivityError(err) {
164
- const code = err && typeof err.code === `string` && err.code;
164
+ const code = err && typeof err.code === 'string' && err.code;
165
165
  const cls = code && code.substr(0, 2); // Error Class
166
166
  // istanbul ignore next (we cannot test-cover all error cases):
167
- return code === `ECONNRESET` || (cls === `08` && code !== `08P01`) || (cls === `57` && code !== `57014`);
167
+ return code === 'ECONNRESET' || (cls === '08' && code !== '08P01') || (cls === '57' && code !== '57014');
168
168
  // Code 'ECONNRESET' - Connectivity issue handled by the driver.
169
169
  // Class 08 - Connection Exception (except for 08P01, for protocol violation).
170
170
  // Class 57 - Operator Intervention (except for 57014, for cancelled queries).
@@ -176,7 +176,7 @@ function isConnectivityError(err) {
176
176
  // Does JSON.stringify, with support for BigInt (irreversible)
177
177
  function toJson(data) {
178
178
  if (data !== undefined) {
179
- return JSON.stringify(data, (_, v) => typeof v === `bigint` ? `${v}#bigint` : v)
179
+ return JSON.stringify(data, (_, v) => typeof v === 'bigint' ? `${v}#bigint` : v)
180
180
  .replace(/"(-?\d+)#bigint"/g, (_, a) => a);
181
181
  }
182
182
  }
@@ -7,13 +7,13 @@
7
7
  * Removal or modification of this copyright notice is prohibited.
8
8
  */
9
9
 
10
- const {assert} = require(`../assert`);
10
+ const {assert} = require('../assert');
11
11
 
12
12
  const npm = {
13
- fs: require(`fs`),
14
- path: require(`path`),
15
- utils: require(`./`),
16
- package: require(`../../package.json`)
13
+ fs: require('fs'),
14
+ path: require('path'),
15
+ utils: require('./'),
16
+ package: require('../../package.json')
17
17
  };
18
18
 
19
19
  /**
@@ -38,7 +38,7 @@ const npm = {
38
38
  *
39
39
  */
40
40
  function camelize(text) {
41
- text = text.replace(/[-_\s.]+(.)?/g, (_, c) => c ? c.toUpperCase() : ``);
41
+ text = text.replace(/[-_\s.]+(.)?/g, (_, c) => c ? c.toUpperCase() : '');
42
42
  return text.substr(0, 1).toLowerCase() + text.substr(1);
43
43
  }
44
44
 
@@ -65,7 +65,7 @@ function camelize(text) {
65
65
  *
66
66
  */
67
67
  function camelizeVar(text) {
68
- text = text.replace(/[^a-zA-Z0-9$_\-\s.]/g, ``).replace(/^[0-9_\-\s.]+/, ``);
68
+ text = text.replace(/[^a-zA-Z0-9$_\-\s.]/g, '').replace(/^[0-9_\-\s.]+/, '');
69
69
  return camelize(text);
70
70
  }
71
71
 
@@ -89,28 +89,28 @@ function _enumSql(dir, options, cb, namePath) {
89
89
  if (stat.isDirectory()) {
90
90
  if (options.recursive) {
91
91
  const dirName = camelizeVar(file);
92
- const np = namePath ? (namePath + `.` + dirName) : dirName;
92
+ const np = namePath ? (namePath + '.' + dirName) : dirName;
93
93
  const t = _enumSql(fullPath, options, cb, np);
94
94
  if (Object.keys(t).length) {
95
95
  if (!dirName.length || dirName in tree) {
96
96
  if (!options.ignoreErrors) {
97
- throw new Error(`Empty or duplicate camelized folder name: ` + fullPath);
97
+ throw new Error('Empty or duplicate camelized folder name: ' + fullPath);
98
98
  }
99
99
  }
100
100
  tree[dirName] = t;
101
101
  }
102
102
  }
103
103
  } else {
104
- if (npm.path.extname(file).toLowerCase() === `.sql`) {
105
- const name = camelizeVar(file.replace(/\.[^/.]+$/, ``));
104
+ if (npm.path.extname(file).toLowerCase() === '.sql') {
105
+ const name = camelizeVar(file.replace(/\.[^/.]+$/, ''));
106
106
  if (!name.length || name in tree) {
107
107
  if (!options.ignoreErrors) {
108
- throw new Error(`Empty or duplicate camelized file name: ` + fullPath);
108
+ throw new Error('Empty or duplicate camelized file name: ' + fullPath);
109
109
  }
110
110
  }
111
111
  tree[name] = fullPath;
112
112
  if (cb) {
113
- const result = cb(fullPath, name, namePath ? (namePath + `.` + name) : name);
113
+ const result = cb(fullPath, name, namePath ? (namePath + '.' + name) : name);
114
114
  if (result !== undefined) {
115
115
  tree[name] = result;
116
116
  }
@@ -185,11 +185,11 @@ function _enumSql(dir, options, cb, namePath) {
185
185
  */
186
186
  function enumSql(dir, options, cb) {
187
187
  if (!npm.utils.isText(dir)) {
188
- throw new TypeError(`Parameter 'dir' must be a non-empty text string.`);
188
+ throw new TypeError('Parameter \'dir\' must be a non-empty text string.');
189
189
  }
190
- options = assert(options, [`recursive`, `ignoreErrors`]);
191
- cb = (typeof cb === `function`) ? cb : null;
192
- return _enumSql(dir, options, cb, ``);
190
+ options = assert(options, ['recursive', 'ignoreErrors']);
191
+ cb = (typeof cb === 'function') ? cb : null;
192
+ return _enumSql(dir, options, cb, '');
193
193
  }
194
194
 
195
195
  /**
@@ -236,26 +236,26 @@ function enumSql(dir, options, cb) {
236
236
  */
237
237
  function taskArgs(args) {
238
238
 
239
- if (!args || typeof args.length !== `number`) {
240
- throw new TypeError(`Parameter 'args' must be an array-like object of arguments.`);
239
+ if (!args || typeof args.length !== 'number') {
240
+ throw new TypeError('Parameter \'args\' must be an array-like object of arguments.');
241
241
  }
242
242
 
243
243
  let options = args[0], cb;
244
- if (typeof options === `function`) {
244
+ if (typeof options === 'function') {
245
245
  cb = options;
246
246
  options = {};
247
247
  if (cb.name) {
248
248
  options.tag = cb.name;
249
249
  }
250
250
  } else {
251
- if (typeof args[1] === `function`) {
251
+ if (typeof args[1] === 'function') {
252
252
  cb = args[1];
253
253
  }
254
- if (typeof options === `string` || typeof options === `number`) {
254
+ if (typeof options === 'string' || typeof options === 'number') {
255
255
  options = {tag: options};
256
256
  } else {
257
- options = (typeof options === `object` && options) || {};
258
- if (!(`tag` in options) && cb && cb.name) {
257
+ options = (typeof options === 'object' && options) || {};
258
+ if (!('tag' in options) && cb && cb.name) {
259
259
  options.tag = cb.name;
260
260
  }
261
261
  }
@@ -263,7 +263,7 @@ function taskArgs(args) {
263
263
 
264
264
  const res = [options, cb];
265
265
 
266
- Object.defineProperty(res, `options`, {
266
+ Object.defineProperty(res, 'options', {
267
267
  get: function () {
268
268
  return this[0];
269
269
  },
@@ -273,7 +273,7 @@ function taskArgs(args) {
273
273
  enumerable: true
274
274
  });
275
275
 
276
- Object.defineProperty(res, `cb`, {
276
+ Object.defineProperty(res, 'cb', {
277
277
  get: function () {
278
278
  return this[1];
279
279
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-promise",
3
- "version": "11.4.0",
3
+ "version": "11.4.2",
4
4
  "description": "PostgreSQL interface for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "typings": "typescript/pg-promise.d.ts",
@@ -47,17 +47,17 @@
47
47
  "spex": "3.2.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/node": "18.15.0",
50
+ "@types/node": "18.15.3",
51
51
  "bluebird": "3.7.2",
52
52
  "coveralls": "3.1.1",
53
- "cspell": "6.28.0",
54
- "eslint": "8.35.0",
53
+ "cspell": "6.30.0",
54
+ "eslint": "8.36.0",
55
55
  "istanbul": "0.4.5",
56
56
  "jasmine-node": "3.0.0",
57
57
  "jsdoc": "4.0.2",
58
58
  "JSONStream": "1.3.5",
59
59
  "pg-query-stream": "4.4.0",
60
60
  "tslint": "6.1.3",
61
- "typescript": "4.9.5"
61
+ "typescript": "5.0.2"
62
62
  }
63
63
  }
@@ -289,7 +289,7 @@ declare namespace pg {
289
289
 
290
290
  end(cb: (err: Error) => any): any;
291
291
 
292
- log: () => void;
292
+ log: (msg: string, err?: any) => void;
293
293
 
294
294
  readonly options: { [name: string]: any }; // connection options
295
295