postgrejs 2.22.0 → 2.22.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.
- package/CHANGELOG.md +9 -63
- package/cjs/connection/connection.js +11 -10
- package/cjs/connection/pool.js +4 -0
- package/esm/connection/connection.js +11 -10
- package/esm/connection/pool.js +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
# v2.22.
|
|
2
|
-
[2024-
|
|
1
|
+
# v2.22.2
|
|
2
|
+
[2024-11-04]
|
|
3
3
|
|
|
4
4
|
### Changes
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* chore: Added test-reporter workflow ([`d8e957c`](https://github.com/panates/postgrejs/commit/d8e957c1b5e3b8ce0244142e30527503dc046d52))
|
|
14
|
-
* chore: Added test-reporter workflow ([`d1c6cd3`](https://github.com/panates/postgrejs/commit/d1c6cd3dba5801e23770902a8401a78ab79d04ba))
|
|
15
|
-
* chore: Added test-reporter workflow ([`e9fe487`](https://github.com/panates/postgrejs/commit/e9fe4879ab1ae62597a64353cf77ea202e9b1f26))
|
|
16
|
-
* chore: Added test-reporter workflow ([`a600cf8`](https://github.com/panates/postgrejs/commit/a600cf82fa53426d0fcd4051dac0a71fe0ccc03d))
|
|
17
|
-
* chore: Added test-reporter workflow ([`e4f29b8`](https://github.com/panates/postgrejs/commit/e4f29b8dde342a69099cc23b6212101c5e5ed583))
|
|
18
|
-
* chore: Added test-reporter workflow ([`158bc22`](https://github.com/panates/postgrejs/commit/158bc22583448717a0cb345d6333161c8212bc2a))
|
|
19
|
-
* chore: Added test-reporter workflow ([`b2468f6`](https://github.com/panates/postgrejs/commit/b2468f61bc034f606828665d993a482a74ed0372))
|
|
20
|
-
* chore: Added test-reporter workflow ([`5833ee1`](https://github.com/panates/postgrejs/commit/5833ee1e8d4a437fe19c16899d20e1e609e2d81e))
|
|
21
|
-
* chore: Added test-reporter workflow ([`bf153bd`](https://github.com/panates/postgrejs/commit/bf153bd02dd0ab492f2bf521f1ff2f2dc3b0a4f4))
|
|
22
|
-
* chore: Added test-reporter workflow ([`2a559f2`](https://github.com/panates/postgrejs/commit/2a559f21cc050fdefee63e866d13ab540c76753d))
|
|
23
|
-
* chore: Added test-reporter workflow ([`cb4e6fa`](https://github.com/panates/postgrejs/commit/cb4e6facf5315d044c0088936d1ce71a7544bebe))
|
|
24
|
-
* chore: Updated jest config ([`0f1fe85`](https://github.com/panates/postgrejs/commit/0f1fe85dd0858db5a7aab5812baa9b13688e9e4a))
|
|
25
|
-
* chore: Added test-reporter workflow ([`1562e37`](https://github.com/panates/postgrejs/commit/1562e37c1fb8e935062aa278e261de06dd26880d))
|
|
26
|
-
* chore: Added test-reporter workflow ([`ecb4ff9`](https://github.com/panates/postgrejs/commit/ecb4ff923a46539a8bac3cc2cb125170481bdcd3))
|
|
6
|
+
* refactor: Improved displaying error line ([`3a6bbe9`](https://github.com/panates/postgrejs/commit/3a6bbe929efdb4f46a38c7b9626b4f28739ad341))
|
|
7
|
+
|
|
8
|
+
# v2.22.1
|
|
9
|
+
[2024-10-16]
|
|
10
|
+
|
|
11
|
+
# v2.22.0
|
|
12
|
+
[2024-10-15]
|
|
27
13
|
|
|
28
14
|
# v2.21.1
|
|
29
15
|
[2024-09-20]
|
|
@@ -33,43 +19,17 @@
|
|
|
33
19
|
* fix: Fixed error messages not showing issue ([`b1ac9be`](https://github.com/panates/postgrejs/commit/b1ac9be100941cf4a400ec0203934f23fd8189ba))
|
|
34
20
|
* fix: unix socket connection issue ([`1653631`](https://github.com/panates/postgrejs/commit/1653631567361b244b21acb7fcd6c863c7fd747a))
|
|
35
21
|
|
|
36
|
-
### Changes
|
|
37
|
-
|
|
38
|
-
* chore: Move CI from circleci to GitHub Actions ([`e5e6d4d`](https://github.com/panates/postgrejs/commit/e5e6d4daaab6a25fee2d9ebf5ecd8eb0c88b279f))
|
|
39
|
-
* chore: updated dependencies ([`0166983`](https://github.com/panates/postgrejs/commit/0166983503a6349adca87ca486b01e3215e185f9))
|
|
40
|
-
* chore: updated ci urls ([`f8ccd6f`](https://github.com/panates/postgrejs/commit/f8ccd6fabce1ded8b787974d2b9d0362e058eadd))
|
|
41
|
-
* chore: Move CI from circleci to GitHub Actions #13 ([`31e94bb`](https://github.com/panates/postgrejs/commit/31e94bb6e75bf645774ae06da3a0e1f4e73f0ea4))
|
|
42
|
-
* chore: Added coveralls support ([`9deda5f`](https://github.com/panates/postgrejs/commit/9deda5fe53f9b8d7a7b07ce17942b23d862395ea))
|
|
43
|
-
* chore: Move CI from circleci to GitHub Actions #8 ([`d5e2af2`](https://github.com/panates/postgrejs/commit/d5e2af29acc116fe2ad9cb91cda7fac3b11662bc))
|
|
44
|
-
* chore: Move CI from circleci to GitHub Actions #12 ([`2088d6a`](https://github.com/panates/postgrejs/commit/2088d6a8ff268af072d6d511979c8d4812972520))
|
|
45
|
-
* chore: Move CI from circleci to GitHub Actions #7 ([`8bacf98`](https://github.com/panates/postgrejs/commit/8bacf988825ef623a1c61a2471b83a685f66e924))
|
|
46
|
-
* chore: Move CI from circleci to GitHub Actions #9 ([`b7211e9`](https://github.com/panates/postgrejs/commit/b7211e9e3a62d1eb3af0b87c0fb536f03a32979d))
|
|
47
|
-
* chore: Move CI from circleci to GitHub Actions #6 ([`af38576`](https://github.com/panates/postgrejs/commit/af385760348e5f1fe60313115ff170c848ddc4ce))
|
|
48
|
-
* chore: Move CI from circleci to GitHub Actions #4 ([`6c260f5`](https://github.com/panates/postgrejs/commit/6c260f5d40893433684743ab55f707d0a63c0b76))
|
|
49
|
-
* chore: Move CI from circleci to GitHub Actions #5 ([`dbe687e`](https://github.com/panates/postgrejs/commit/dbe687e7f8719eb3d25ef24f9b4dc790917e8c2d))
|
|
50
|
-
* chore: Added node 16, 20, pg 16 ([`7458917`](https://github.com/panates/postgrejs/commit/74589172982861911968f93e6d5418f12dc17c63))
|
|
51
|
-
* chore: Move CI from circleci to GitHub Actions #10 ([`8144035`](https://github.com/panates/postgrejs/commit/814403556531dc79ac5d1fb46e7620123b4f2766))
|
|
52
|
-
* chore: Move CI from circleci to GitHub Actions #11 ([`a758c38`](https://github.com/panates/postgrejs/commit/a758c3806eb0cb80ac4d1ffac0cdde47b54d9c8a))
|
|
53
|
-
* chore: Move CI from circleci to GitHub Actions ([`485c398`](https://github.com/panates/postgrejs/commit/485c398fee7e45d4ab623157e1d601003b44b3f1))
|
|
54
|
-
* chore: Move CI from circleci to GitHub Actions #3 ([`187f12f`](https://github.com/panates/postgrejs/commit/187f12f2fe3364aa758147dbebad062f60bfc690))
|
|
55
|
-
|
|
56
22
|
# v2.21.0
|
|
57
23
|
[2024-09-14]
|
|
58
24
|
|
|
59
25
|
### Changes
|
|
60
26
|
|
|
61
27
|
* Abort pending operations when the socket closes ([`705063a`](https://github.com/panates/postgrejs/commit/705063a4a15267b1ce634a32f2b997c55b6aff45))
|
|
62
|
-
* chore: fixed lint issues ([`f13dab2`](https://github.com/panates/postgrejs/commit/f13dab2858dac384de4c8b3c21f650995f66ff5e))
|
|
63
28
|
* Throw exception when trying to run query on a connection that is not yeat ready or closing/closed ([`96bd55b`](https://github.com/panates/postgrejs/commit/96bd55bc4e6bb941a2891c79f316653c8c03e1da))
|
|
64
29
|
|
|
65
30
|
# v2.20.0
|
|
66
31
|
[2024-09-14]
|
|
67
32
|
|
|
68
|
-
### Changes
|
|
69
|
-
|
|
70
|
-
* chore: Typing improvements ([`adb46c3`](https://github.com/panates/postgrejs/commit/adb46c3ae486e9182aa9a979bed4848c71e69af4))
|
|
71
|
-
* chore: Typing improvements ([`d414463`](https://github.com/panates/postgrejs/commit/d41446345caa940294996b5662683acca12d9578))
|
|
72
|
-
|
|
73
33
|
# v2.19.0
|
|
74
34
|
[2024-08-20]
|
|
75
35
|
|
|
@@ -92,10 +52,6 @@
|
|
|
92
52
|
|
|
93
53
|
* Fix: Added package.json in esm directory which overwrite "type" property to "module" ([`831bb08`](https://github.com/panates/postgrejs/commit/831bb083230cf3981d69c1334b2e5312de66b520))
|
|
94
54
|
|
|
95
|
-
### Changes
|
|
96
|
-
|
|
97
|
-
* chore: Updated dependencies ([`f3cfc97`](https://github.com/panates/postgrejs/commit/f3cfc97fd440ed5cc454bdf7ac5f254794ea9c57))
|
|
98
|
-
|
|
99
55
|
# v2.17.1
|
|
100
56
|
[2024-08-12]
|
|
101
57
|
|
|
@@ -138,25 +94,15 @@
|
|
|
138
94
|
### Changes
|
|
139
95
|
|
|
140
96
|
* Updated dependencies ([`164644d`](https://github.com/panates/postgrejs/commit/164644d0f872f4835c684d8ad7072af1e6b4767b))
|
|
141
|
-
* chore: Minor change ([`76e0d0f`](https://github.com/panates/postgrejs/commit/76e0d0f5fc95e894b890304a53e00b08ad530415))
|
|
142
|
-
* chore: Updated ([`3721d59`](https://github.com/panates/postgrejs/commit/3721d59afa3f901b0e19bd12faffb5a2268337e2))
|
|
143
|
-
* chore: Updated ([`526e6be`](https://github.com/panates/postgrejs/commit/526e6be83522787f849a5208b6546b662b13a4b3))
|
|
144
|
-
* chore: Updated homepage ([`b4304a7`](https://github.com/panates/postgrejs/commit/b4304a7fd4e41c04f8999b34dd2b85cd9a026209))
|
|
145
97
|
|
|
146
98
|
# v2.15.1
|
|
147
99
|
[2024-07-22]
|
|
148
100
|
|
|
149
101
|
### Changes
|
|
150
102
|
|
|
151
|
-
* chore: Updated readme ([`f2db178`](https://github.com/panates/postgrejs/commit/f2db17882fb33729d2ef2044051c78affb7e6d2b))
|
|
152
103
|
* Changed package name to `postgrejs` ([`5ec4852`](https://github.com/panates/postgrejs/commit/5ec485244c9ac448e82b0649110315fc4d9b789e))
|
|
153
104
|
* Updated readme ([`72f6a1b`](https://github.com/panates/postgrejs/commit/72f6a1bc4bc0af17d9a7c7ce50be8ab5fcbfca2e))
|
|
154
105
|
* Implemented `sqlmode` query parameter for connection string and added `requireSSL` option to connection options. Now the driver tries SSL connection as a first choice. ([`3a27e85`](https://github.com/panates/postgrejs/commit/3a27e85dcbb7bd983dd2f835fa4ac785ad34e266))
|
|
155
|
-
* chore: Updated ([`a90a646`](https://github.com/panates/postgrejs/commit/a90a6461894883f12c396bc0a68518fb75d8bc17))
|
|
156
|
-
* chore: Updated readme ([`c581284`](https://github.com/panates/postgrejs/commit/c581284e2751e93674a26936f31ebbd8b753c2ca))
|
|
157
|
-
* chore: Updated readme ([`1f51284`](https://github.com/panates/postgrejs/commit/1f5128400a6ddff05552ad297cad930fe6244faf))
|
|
158
|
-
* chore: Updated readme ([`d439659`](https://github.com/panates/postgrejs/commit/d43965906101f3494270852b61203d1ce3339437))
|
|
159
|
-
* chore: Updated readme ([`2209d39`](https://github.com/panates/postgrejs/commit/2209d397ebd23d06061bfda10b49df830fb470e9))
|
|
160
106
|
* Updated readme ([`a00f471`](https://github.com/panates/postgrejs/commit/a00f471da79b569d36bbe76ce517a01adba17a24))
|
|
161
107
|
|
|
162
108
|
# v2.12.0
|
|
@@ -133,6 +133,7 @@ class Connection extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
133
133
|
* @param options {ScriptExecuteOptions} - Execute options
|
|
134
134
|
*/
|
|
135
135
|
async execute(sql, options) {
|
|
136
|
+
this.emit('execute', sql, options);
|
|
136
137
|
return this._captureErrorStack(this._intlCon.execute(sql, options)).catch((e) => {
|
|
137
138
|
throw this._handleError(e, sql);
|
|
138
139
|
});
|
|
@@ -148,6 +149,7 @@ class Connection extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
148
149
|
sql,
|
|
149
150
|
});
|
|
150
151
|
}
|
|
152
|
+
this.emit('query', sql, options);
|
|
151
153
|
const typeMap = options?.typeMap || data_type_map_js_1.GlobalTypeMap;
|
|
152
154
|
const paramTypes = options?.params?.map(prm => prm instanceof bind_param_js_1.BindParam ? prm.oid : typeMap.determine(prm));
|
|
153
155
|
const statement = await this.prepare(sql, { paramTypes, typeMap }).catch((e) => {
|
|
@@ -251,17 +253,16 @@ class Connection extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
251
253
|
this._closing = false;
|
|
252
254
|
}
|
|
253
255
|
_handleError(err, script) {
|
|
254
|
-
if (err.position) {
|
|
255
|
-
const i1 = script.lastIndexOf('\n', err.position) + 1;
|
|
256
|
-
|
|
257
|
-
if (i2 < 0)
|
|
258
|
-
i2 = Number.MAX_SAFE_INTEGER;
|
|
259
|
-
err.line = script.substring(i1, i2);
|
|
260
|
-
err.lineNr = [...script.substring(0, i1).matchAll(/\n/g)].length;
|
|
256
|
+
if (err.position != null) {
|
|
257
|
+
const i1 = script.lastIndexOf('\n', err.position - 1) + 1;
|
|
258
|
+
err.lineNr = [...script.substring(0, i1).matchAll(/\n/g)].length + 1;
|
|
261
259
|
err.colNr = err.position - i1;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
260
|
+
const lines = script.split('\n');
|
|
261
|
+
err.line = lines[err.lineNr - 1];
|
|
262
|
+
err.message += `\n at line ${err.lineNr} column ${err.colNr}`;
|
|
263
|
+
if (err.lineNr > 1)
|
|
264
|
+
err.message += `\n${String(err.lineNr - 1).padStart(3)}| ${lines[err.lineNr - 2]}`;
|
|
265
|
+
err.message += `\n${String(err.lineNr).padStart(3)}| ${err.line}\n .${'-'.repeat(Math.max(err.colNr - 1, 0))}^`;
|
|
265
266
|
}
|
|
266
267
|
return err;
|
|
267
268
|
}
|
package/cjs/connection/pool.js
CHANGED
|
@@ -135,6 +135,10 @@ class Pool extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
135
135
|
/* istanbul ignore next */
|
|
136
136
|
if (this.listenerCount('debug'))
|
|
137
137
|
connection.on('debug', (...args) => this.emit('debug', ...args));
|
|
138
|
+
if (this.listenerCount('execute'))
|
|
139
|
+
connection.on('execute', (...args) => this.emit('execute', ...args));
|
|
140
|
+
if (this.listenerCount('query'))
|
|
141
|
+
connection.on('query', (...args) => this.emit('query', ...args));
|
|
138
142
|
return connection;
|
|
139
143
|
}
|
|
140
144
|
/**
|
|
@@ -130,6 +130,7 @@ export class Connection extends SafeEventEmitter {
|
|
|
130
130
|
* @param options {ScriptExecuteOptions} - Execute options
|
|
131
131
|
*/
|
|
132
132
|
async execute(sql, options) {
|
|
133
|
+
this.emit('execute', sql, options);
|
|
133
134
|
return this._captureErrorStack(this._intlCon.execute(sql, options)).catch((e) => {
|
|
134
135
|
throw this._handleError(e, sql);
|
|
135
136
|
});
|
|
@@ -145,6 +146,7 @@ export class Connection extends SafeEventEmitter {
|
|
|
145
146
|
sql,
|
|
146
147
|
});
|
|
147
148
|
}
|
|
149
|
+
this.emit('query', sql, options);
|
|
148
150
|
const typeMap = options?.typeMap || GlobalTypeMap;
|
|
149
151
|
const paramTypes = options?.params?.map(prm => prm instanceof BindParam ? prm.oid : typeMap.determine(prm));
|
|
150
152
|
const statement = await this.prepare(sql, { paramTypes, typeMap }).catch((e) => {
|
|
@@ -248,17 +250,16 @@ export class Connection extends SafeEventEmitter {
|
|
|
248
250
|
this._closing = false;
|
|
249
251
|
}
|
|
250
252
|
_handleError(err, script) {
|
|
251
|
-
if (err.position) {
|
|
252
|
-
const i1 = script.lastIndexOf('\n', err.position) + 1;
|
|
253
|
-
|
|
254
|
-
if (i2 < 0)
|
|
255
|
-
i2 = Number.MAX_SAFE_INTEGER;
|
|
256
|
-
err.line = script.substring(i1, i2);
|
|
257
|
-
err.lineNr = [...script.substring(0, i1).matchAll(/\n/g)].length;
|
|
253
|
+
if (err.position != null) {
|
|
254
|
+
const i1 = script.lastIndexOf('\n', err.position - 1) + 1;
|
|
255
|
+
err.lineNr = [...script.substring(0, i1).matchAll(/\n/g)].length + 1;
|
|
258
256
|
err.colNr = err.position - i1;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
const lines = script.split('\n');
|
|
258
|
+
err.line = lines[err.lineNr - 1];
|
|
259
|
+
err.message += `\n at line ${err.lineNr} column ${err.colNr}`;
|
|
260
|
+
if (err.lineNr > 1)
|
|
261
|
+
err.message += `\n${String(err.lineNr - 1).padStart(3)}| ${lines[err.lineNr - 2]}`;
|
|
262
|
+
err.message += `\n${String(err.lineNr).padStart(3)}| ${err.line}\n .${'-'.repeat(Math.max(err.colNr - 1, 0))}^`;
|
|
262
263
|
}
|
|
263
264
|
return err;
|
|
264
265
|
}
|
package/esm/connection/pool.js
CHANGED
|
@@ -132,6 +132,10 @@ export class Pool extends SafeEventEmitter {
|
|
|
132
132
|
/* istanbul ignore next */
|
|
133
133
|
if (this.listenerCount('debug'))
|
|
134
134
|
connection.on('debug', (...args) => this.emit('debug', ...args));
|
|
135
|
+
if (this.listenerCount('execute'))
|
|
136
|
+
connection.on('execute', (...args) => this.emit('execute', ...args));
|
|
137
|
+
if (this.listenerCount('query'))
|
|
138
|
+
connection.on('query', (...args) => this.emit('query', ...args));
|
|
135
139
|
return connection;
|
|
136
140
|
}
|
|
137
141
|
/**
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postgrejs",
|
|
3
3
|
"description": "Professional PostgreSQL client NodeJS",
|
|
4
|
-
"version": "2.22.
|
|
4
|
+
"version": "2.22.2",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"doublylinked": "^2.5.4",
|
|
9
|
-
"lightning-pool": "^4.
|
|
9
|
+
"lightning-pool": "^4.10.0",
|
|
10
10
|
"postgres-bytea": "^3.0.0",
|
|
11
11
|
"power-tasks": "^1.11.0",
|
|
12
12
|
"putil-merge": "^3.13.0",
|
|
13
13
|
"putil-promisify": "^1.10.1",
|
|
14
14
|
"putil-varhelpers": "^1.6.5",
|
|
15
|
-
"tslib": "^2.
|
|
15
|
+
"tslib": "^2.8.1"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"exports": {
|