pg-promise 12.1.3 → 12.3.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 +1 -1
- package/lib/database.js +4 -24
- package/lib/formatting.js +2 -2
- package/lib/tx-mode.js +5 -5
- package/lib/types/prepared-statement.js +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ pg-promise
|
|
|
3
3
|
|
|
4
4
|
[](https://github.com/vitaly-t/pg-promise/actions/workflows/ci.yml)
|
|
5
5
|
[](https://nodejs.org)
|
|
6
|
-
[](https://www.postgresql.org)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
package/lib/database.js
CHANGED
|
@@ -1233,30 +1233,11 @@ function Database(cn, dc, config) {
|
|
|
1233
1233
|
*
|
|
1234
1234
|
* @example
|
|
1235
1235
|
*
|
|
1236
|
-
* db.task('my-task', t => {
|
|
1236
|
+
* db.task('my-task', async t => {
|
|
1237
1237
|
* // t.ctx = task context object
|
|
1238
1238
|
*
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1241
|
-
* return t.any('SELECT * FROM Events WHERE userId = $1', user.id);
|
|
1242
|
-
* });
|
|
1243
|
-
* })
|
|
1244
|
-
* .then(data => {
|
|
1245
|
-
* // success
|
|
1246
|
-
* // data = as returned from the task's callback
|
|
1247
|
-
* })
|
|
1248
|
-
* .catch(error => {
|
|
1249
|
-
* // error
|
|
1250
|
-
* });
|
|
1251
|
-
*
|
|
1252
|
-
* @example
|
|
1253
|
-
*
|
|
1254
|
-
* // using an ES7 syntax for the callback:
|
|
1255
|
-
* db.task('my-task', async t {
|
|
1256
|
-
* // t.ctx = task context object
|
|
1257
|
-
*
|
|
1258
|
-
* const user = await t.one('SELECT id FROM Users WHERE name = $1', 'John');
|
|
1259
|
-
* return t.any('SELECT * FROM Events WHERE userId = $1', user.id);
|
|
1239
|
+
* const user = await t.one('SELECT id FROM Users WHERE name = $1', ['John']);
|
|
1240
|
+
* return t.any('SELECT * FROM Events WHERE userId = $1', [user.id]);
|
|
1260
1241
|
* })
|
|
1261
1242
|
* .then(data => {
|
|
1262
1243
|
* // success
|
|
@@ -1419,7 +1400,7 @@ function Database(cn, dc, config) {
|
|
|
1419
1400
|
* @example
|
|
1420
1401
|
*
|
|
1421
1402
|
* // using an ES7 syntax for the callback:
|
|
1422
|
-
* db.tx('my-transaction', async t {
|
|
1403
|
+
* db.tx('my-transaction', async t => {
|
|
1423
1404
|
* // t.ctx = transaction context object
|
|
1424
1405
|
*
|
|
1425
1406
|
* const user = await t.one('INSERT INTO Users(name, age) VALUES($1, $2) RETURNING id', ['Mike', 25]);
|
|
@@ -1432,7 +1413,6 @@ function Database(cn, dc, config) {
|
|
|
1432
1413
|
* .catch(error => {
|
|
1433
1414
|
* // error
|
|
1434
1415
|
* });
|
|
1435
|
-
*
|
|
1436
1416
|
*/
|
|
1437
1417
|
obj.tx = function () {
|
|
1438
1418
|
const args = npm.pubUtils.taskArgs(arguments);
|
package/lib/formatting.js
CHANGED
|
@@ -110,7 +110,7 @@ function formatValue({value, fm, cc, options}) {
|
|
|
110
110
|
|
|
111
111
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
112
112
|
// Converts array of values into PostgreSQL Array Constructor: array[...], as per PostgreSQL documentation:
|
|
113
|
-
//
|
|
113
|
+
// https://www.postgresql.org/docs/17/arrays.html
|
|
114
114
|
//
|
|
115
115
|
// Arrays of any depth/dimension are supported.
|
|
116
116
|
//
|
|
@@ -888,7 +888,7 @@ const $to = {
|
|
|
888
888
|
return num < 0 ? `(${s})` : s;
|
|
889
889
|
}
|
|
890
890
|
// Converting NaN/+Infinity/-Infinity according to Postgres documentation:
|
|
891
|
-
//
|
|
891
|
+
// https://www.postgresql.org/docs/17/datatype-numeric.html#DATATYPE-FLOAT
|
|
892
892
|
//
|
|
893
893
|
// NOTE: strings for 'NaN'/'+Infinity'/'-Infinity' are not case-sensitive.
|
|
894
894
|
if (num === Number.POSITIVE_INFINITY) {
|
package/lib/tx-mode.js
CHANGED
|
@@ -25,16 +25,16 @@ const isolationLevel = {
|
|
|
25
25
|
/** Isolation level not specified. */
|
|
26
26
|
none: 0,
|
|
27
27
|
|
|
28
|
-
/** ISOLATION LEVEL SERIALIZABLE */
|
|
28
|
+
/** `ISOLATION LEVEL SERIALIZABLE` */
|
|
29
29
|
serializable: 1,
|
|
30
30
|
|
|
31
|
-
/** ISOLATION LEVEL REPEATABLE READ */
|
|
31
|
+
/** `ISOLATION LEVEL REPEATABLE READ` */
|
|
32
32
|
repeatableRead: 2,
|
|
33
33
|
|
|
34
|
-
/** ISOLATION LEVEL READ COMMITTED */
|
|
34
|
+
/** `ISOLATION LEVEL READ COMMITTED` */
|
|
35
35
|
readCommitted: 3
|
|
36
36
|
|
|
37
|
-
// From the official documentation:
|
|
37
|
+
// From the official documentation: https://www.postgresql.org/docs/17/sql-set-transaction.html
|
|
38
38
|
// The SQL standard defines one additional level, READ UNCOMMITTED. In PostgreSQL READ UNCOMMITTED is treated as READ COMMITTED.
|
|
39
39
|
// => skipping `READ UNCOMMITTED`.
|
|
40
40
|
};
|
|
@@ -120,7 +120,7 @@ class TransactionMode extends InnerState {
|
|
|
120
120
|
accessMode = 'read write';
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
// From the official documentation:
|
|
123
|
+
// From the official documentation: https://www.postgresql.org/docs/17/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) {
|
|
@@ -44,7 +44,7 @@ const npm = {
|
|
|
44
44
|
*
|
|
45
45
|
* @see
|
|
46
46
|
* {@link errors.PreparedStatementError PreparedStatementError},
|
|
47
|
-
* {@link
|
|
47
|
+
* {@link https://www.postgresql.org/docs/17/sql-prepare.html PostgreSQL Prepared Statements}
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
*
|
package/lib/utils/index.js
CHANGED
|
@@ -169,7 +169,7 @@ function isConnectivityError(err) {
|
|
|
169
169
|
// Class 08 - Connection Exception (except for 08P01, for protocol violation).
|
|
170
170
|
// Class 57 - Operator Intervention (except for 57014, for cancelled queries).
|
|
171
171
|
//
|
|
172
|
-
// ERROR CODES: https://www.postgresql.org/docs/
|
|
172
|
+
// ERROR CODES: https://www.postgresql.org/docs/17/errcodes-appendix.html
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
///////////////////////////////////////////////////////////////
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-promise",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.0",
|
|
4
4
|
"description": "PostgreSQL interface for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "typescript/pg-promise.d.ts",
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
"assert-options": "0.8.3",
|
|
45
45
|
"pg": "8.16.3",
|
|
46
46
|
"pg-minify": "1.8.0",
|
|
47
|
-
"spex": "4.0
|
|
47
|
+
"spex": "4.1.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"pg-query-stream": "4.10.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@eslint/js": "9.
|
|
54
|
-
"@types/node": "24.
|
|
53
|
+
"@eslint/js": "9.39.1",
|
|
54
|
+
"@types/node": "24.10.0",
|
|
55
55
|
"coveralls": "3.1.1",
|
|
56
|
-
"cspell": "9.
|
|
57
|
-
"eslint": "9.
|
|
58
|
-
"globals": "16.
|
|
56
|
+
"cspell": "9.3.0",
|
|
57
|
+
"eslint": "9.39.1",
|
|
58
|
+
"globals": "16.5.0",
|
|
59
59
|
"istanbul": "0.4.5",
|
|
60
60
|
"jasmine-node": "3.0.0",
|
|
61
|
-
"jsdoc": "4.0.
|
|
61
|
+
"jsdoc": "4.0.5",
|
|
62
62
|
"JSONStream": "1.3.5",
|
|
63
|
-
"typescript": "5.9.
|
|
63
|
+
"typescript": "5.9.3"
|
|
64
64
|
}
|
|
65
65
|
}
|