pg-promise 11.5.4 → 11.6.0

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 CHANGED
@@ -2,8 +2,8 @@ pg-promise
2
2
  ==========
3
3
 
4
4
  [![Build Status](https://github.com/vitaly-t/pg-promise/workflows/ci/badge.svg?branch=master)](https://github.com/vitaly-t/pg-promise/actions?query=workflow%3Aci+branch%3Amaster)
5
- [![Node Version](https://img.shields.io/badge/nodejs-14%20--%2018-green.svg?logo=node.js&style=flat)](https://nodejs.org)
6
- [![Postgres Version](https://img.shields.io/badge/postgresql-10%20--%2015-green.svg?logo=postgresql&style=flat)](https://www.postgresql.org)
5
+ [![Node Version](https://img.shields.io/badge/nodejs-14%20--%2020-green.svg?logo=node.js&style=flat)](https://nodejs.org)
6
+ [![Postgres Version](https://img.shields.io/badge/postgresql-10%20--%2016-green.svg?logo=postgresql&style=flat)](https://www.postgresql.org)
7
7
 
8
8
  ---
9
9
 
package/lib/database.js CHANGED
@@ -1679,5 +1679,5 @@ module.exports = config => {
1679
1679
 
1680
1680
  /**
1681
1681
  * @external Result
1682
- * @see https://node-postgres.com/api/result
1682
+ * @see https://node-postgres.com/apis/result
1683
1683
  */
package/lib/formatting.js CHANGED
@@ -170,7 +170,7 @@ const formatAs = {
170
170
  array({query, array, raw, options}) {
171
171
  options = options && typeof options === 'object' ? options : {};
172
172
  return query.replace(npm.patterns.multipleValues, name => {
173
- const v = formatAs.stripName(name.substr(1), raw);
173
+ const v = formatAs.stripName(name.substring(1), raw);
174
174
  const idx = v.name - 1;
175
175
  if (idx >= maxVariable) {
176
176
  throw new RangeError(`Variable $${v.name} exceeds supported maximum of $${maxVariable}`);
@@ -200,7 +200,7 @@ const formatAs = {
200
200
  const mod = name.match(npm.patterns.hasValidModifier);
201
201
  if (mod) {
202
202
  return {
203
- name: name.substr(0, mod.index),
203
+ name: name.substring(0, mod.index),
204
204
  fm: fmMap[mod[0]] | (raw ? fmFlags.raw : 0)
205
205
  };
206
206
  }
@@ -839,7 +839,7 @@ const $as = {
839
839
  * - `obj` - the formatting object, and is the same as `this` context
840
840
  *
841
841
  * - For $[Index Variables] formatting:
842
- * - `index` - element's index (starts with 1) that's outside of the input array
842
+ * - `index` - element's index (starts with 1) that's outside the input array
843
843
  * - `arr` - the formatting/input array, and is the same as `this` context
844
844
  *
845
845
  * You can tell which type of call it is by checking the type of the first parameter.
@@ -884,7 +884,8 @@ const $to = {
884
884
  },
885
885
  number(num) {
886
886
  if (typeof num === 'bigint' || Number.isFinite(num)) {
887
- return num.toString();
887
+ const s = num.toString();
888
+ return num < 0 ? `(${s})` : s;
888
889
  }
889
890
  // Converting NaN/+Infinity/-Infinity according to Postgres documentation:
890
891
  // http://www.postgresql.org/docs/9.6/static/datatype-numeric.html#DATATYPE-FLOAT
@@ -266,11 +266,11 @@ function parseColumn(name) {
266
266
  const res = {};
267
267
  if (name[0] === '?') {
268
268
  res.cnd = true;
269
- name = name.substr(1);
269
+ name = name.substring(1);
270
270
  }
271
271
  const mod = name.match(npm.patterns.hasValidModifier);
272
272
  if (mod) {
273
- res.name = name.substr(0, mod.index);
273
+ res.name = name.substring(0, mod.index);
274
274
  res.mod = mod[0];
275
275
  } else {
276
276
  res.name = name;
package/lib/main.js CHANGED
@@ -415,7 +415,7 @@ module.exports = $main;
415
415
 
416
416
  /**
417
417
  * @external Client
418
- * @see https://node-postgres.com/api/client
418
+ * @see https://node-postgres.com/apis/client
419
419
  */
420
420
 
421
421
  /**
package/lib/query.js CHANGED
@@ -263,9 +263,7 @@ function $query(ctx, query, values, qrm, config) {
263
263
  }
264
264
 
265
265
  // Extends Result to provide iterable for the rows;
266
- //
267
- // To be removed once the following PR is merged amd released:
268
- // https://github.com/brianc/node-postgres/pull/2861
266
+ // See: https://github.com/brianc/node-postgres/pull/2861
269
267
  function makeIterable(r) {
270
268
  r[Symbol.iterator] = function () {
271
269
  return this.rows.values();
@@ -162,7 +162,7 @@ function addInspection(type, cb) {
162
162
  // This is for detecting when to skip executing ROLLBACK for a failed transaction.
163
163
  function isConnectivityError(err) {
164
164
  const code = err && typeof err.code === 'string' && err.code;
165
- const cls = code && code.substr(0, 2); // Error Class
165
+ const cls = code && code.substring(0, 2); // Error Class
166
166
  // istanbul ignore next (we cannot test-cover all error cases):
167
167
  return code === 'ECONNRESET' || (cls === '08' && code !== '08P01') || (cls === '57' && code !== '57014');
168
168
  // Code 'ECONNRESET' - Connectivity issue handled by the driver.
@@ -39,7 +39,7 @@ const npm = {
39
39
  */
40
40
  function camelize(text) {
41
41
  text = text.replace(/[-_\s.]+(.)?/g, (_, c) => c ? c.toUpperCase() : '');
42
- return text.substr(0, 1).toLowerCase() + text.substr(1);
42
+ return text.substring(0, 1).toLowerCase() + text.substring(1);
43
43
  }
44
44
 
45
45
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-promise",
3
- "version": "11.5.4",
3
+ "version": "11.6.0",
4
4
  "description": "PostgreSQL interface for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "typings": "typescript/pg-promise.d.ts",
@@ -42,22 +42,22 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "assert-options": "0.8.1",
45
- "pg": "8.11.3",
45
+ "pg": "8.11.5",
46
46
  "pg-minify": "1.6.3",
47
47
  "spex": "3.3.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/node": "20.5.2",
50
+ "@types/node": "20.12.5",
51
51
  "bluebird": "3.7.2",
52
52
  "coveralls": "3.1.1",
53
- "cspell": "7.0.1",
54
- "eslint": "8.47.0",
53
+ "cspell": "8.6.1",
54
+ "eslint": "8.57.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
- "pg-query-stream": "4.5.3",
59
+ "pg-query-stream": "4.5.5",
60
60
  "tslint": "6.1.3",
61
- "typescript": "5.1.6"
61
+ "typescript": "5.4.4"
62
62
  }
63
63
  }