postgrejs 2.20.0 → 2.21.1
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 +37 -0
- package/README.md +8 -8
- package/cjs/connection/connection.js +9 -4
- package/cjs/protocol/pg-socket.js +25 -9
- package/esm/connection/connection.js +9 -4
- package/esm/protocol/pg-socket.js +21 -5
- package/package.json +1 -1
- package/types/connection/bind-param.d.ts +1 -1
- package/types/connection/connection.d.ts +9 -9
- package/types/connection/cursor.d.ts +5 -5
- package/types/connection/pool.d.ts +8 -8
- package/types/connection/portal.d.ts +3 -3
- package/types/connection/prepared-statement.d.ts +5 -5
- package/types/data-types/bool-type.d.ts +1 -1
- package/types/interfaces/command-result.d.ts +1 -1
- package/types/interfaces/data-type.d.ts +1 -2
- package/types/protocol/frontend.d.ts +4 -4
- package/types/protocol/pg-socket.d.ts +2 -2
- package/types/protocol/protocol.d.ts +1 -1
- package/types/util/config-from-env.d.ts +1 -1
- package/types/util/convert-row-to-object.d.ts +1 -1
- package/types/util/decode-binaryarray.d.ts +1 -1
- package/types/util/encode-binaryarray.d.ts +1 -2
- package/types/util/get-parsers.d.ts +3 -3
- package/types/util/parse-row.d.ts +2 -2
- package/types/util/stringify-arrayliteral.d.ts +2 -2
- package/types/util/stringify-for-sql.d.ts +2 -2
- package/types/util/wrap-row-description.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
# v2.21.1
|
|
2
|
+
[2024-09-20]
|
|
3
|
+
|
|
4
|
+
### Fixes
|
|
5
|
+
|
|
6
|
+
* fix: Fixed error messages not showing issue ([`b1ac9be`](https://github.com/panates/postgrejs/commit/b1ac9be100941cf4a400ec0203934f23fd8189ba))
|
|
7
|
+
* fix: unix socket connection issue ([`1653631`](https://github.com/panates/postgrejs/commit/1653631567361b244b21acb7fcd6c863c7fd747a))
|
|
8
|
+
|
|
9
|
+
### Changes
|
|
10
|
+
|
|
11
|
+
* chore: Move CI from circleci to GitHub Actions ([`e5e6d4d`](https://github.com/panates/postgrejs/commit/e5e6d4daaab6a25fee2d9ebf5ecd8eb0c88b279f))
|
|
12
|
+
* chore: updated dependencies ([`0166983`](https://github.com/panates/postgrejs/commit/0166983503a6349adca87ca486b01e3215e185f9))
|
|
13
|
+
* chore: updated ci urls ([`f8ccd6f`](https://github.com/panates/postgrejs/commit/f8ccd6fabce1ded8b787974d2b9d0362e058eadd))
|
|
14
|
+
* chore: Move CI from circleci to GitHub Actions #13 ([`31e94bb`](https://github.com/panates/postgrejs/commit/31e94bb6e75bf645774ae06da3a0e1f4e73f0ea4))
|
|
15
|
+
* chore: Added coveralls support ([`9deda5f`](https://github.com/panates/postgrejs/commit/9deda5fe53f9b8d7a7b07ce17942b23d862395ea))
|
|
16
|
+
* chore: Move CI from circleci to GitHub Actions #8 ([`d5e2af2`](https://github.com/panates/postgrejs/commit/d5e2af29acc116fe2ad9cb91cda7fac3b11662bc))
|
|
17
|
+
* chore: Move CI from circleci to GitHub Actions #12 ([`2088d6a`](https://github.com/panates/postgrejs/commit/2088d6a8ff268af072d6d511979c8d4812972520))
|
|
18
|
+
* chore: Move CI from circleci to GitHub Actions #7 ([`8bacf98`](https://github.com/panates/postgrejs/commit/8bacf988825ef623a1c61a2471b83a685f66e924))
|
|
19
|
+
* chore: Move CI from circleci to GitHub Actions #9 ([`b7211e9`](https://github.com/panates/postgrejs/commit/b7211e9e3a62d1eb3af0b87c0fb536f03a32979d))
|
|
20
|
+
* chore: Move CI from circleci to GitHub Actions #6 ([`af38576`](https://github.com/panates/postgrejs/commit/af385760348e5f1fe60313115ff170c848ddc4ce))
|
|
21
|
+
* chore: Move CI from circleci to GitHub Actions #4 ([`6c260f5`](https://github.com/panates/postgrejs/commit/6c260f5d40893433684743ab55f707d0a63c0b76))
|
|
22
|
+
* chore: Move CI from circleci to GitHub Actions #5 ([`dbe687e`](https://github.com/panates/postgrejs/commit/dbe687e7f8719eb3d25ef24f9b4dc790917e8c2d))
|
|
23
|
+
* chore: Added node 16, 20, pg 16 ([`7458917`](https://github.com/panates/postgrejs/commit/74589172982861911968f93e6d5418f12dc17c63))
|
|
24
|
+
* chore: Move CI from circleci to GitHub Actions #10 ([`8144035`](https://github.com/panates/postgrejs/commit/814403556531dc79ac5d1fb46e7620123b4f2766))
|
|
25
|
+
* chore: Move CI from circleci to GitHub Actions #11 ([`a758c38`](https://github.com/panates/postgrejs/commit/a758c3806eb0cb80ac4d1ffac0cdde47b54d9c8a))
|
|
26
|
+
* chore: Move CI from circleci to GitHub Actions ([`485c398`](https://github.com/panates/postgrejs/commit/485c398fee7e45d4ab623157e1d601003b44b3f1))
|
|
27
|
+
* chore: Move CI from circleci to GitHub Actions #3 ([`187f12f`](https://github.com/panates/postgrejs/commit/187f12f2fe3364aa758147dbebad062f60bfc690))
|
|
28
|
+
|
|
29
|
+
# v2.21.0
|
|
30
|
+
[2024-09-14]
|
|
31
|
+
|
|
32
|
+
### Changes
|
|
33
|
+
|
|
34
|
+
* Abort pending operations when the socket closes ([`705063a`](https://github.com/panates/postgrejs/commit/705063a4a15267b1ce634a32f2b997c55b6aff45))
|
|
35
|
+
* chore: fixed lint issues ([`f13dab2`](https://github.com/panates/postgrejs/commit/f13dab2858dac384de4c8b3c21f650995f66ff5e))
|
|
36
|
+
* 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))
|
|
37
|
+
|
|
1
38
|
# v2.20.0
|
|
2
39
|
[2024-09-14]
|
|
3
40
|
|
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
[![NPM Version][npm-image]][npm-url]
|
|
9
9
|
[![NPM Downloads][downloads-image]][downloads-url]
|
|
10
|
-
[![
|
|
10
|
+
[![CI Tests][ci-test-image]][ci-test-url]
|
|
11
11
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
PostgreJS is
|
|
14
|
+
PostgreJS is an enterprise-level PostgreSQL client for Node.js.
|
|
15
15
|
It is designed to provide a robust and efficient interface to PostgreSQL databases,
|
|
16
16
|
ensuring high performance and reliability for enterprise applications.
|
|
17
17
|
Written entirely in TypeScript, it leverages modern JavaScript features to deliver a seamless development experience.
|
|
@@ -63,7 +63,7 @@ Please read :small_orange_diamond: [DOCUMENTATION](https://postgrejs.panates.com
|
|
|
63
63
|
### Establish a single connection, execute a simple query
|
|
64
64
|
|
|
65
65
|
```ts
|
|
66
|
-
import {Connection} from 'postgrejs';
|
|
66
|
+
import { Connection } from 'postgrejs';
|
|
67
67
|
// Create connection
|
|
68
68
|
const connection = new Connection('postgres://localhost');
|
|
69
69
|
// Connect to database server
|
|
@@ -82,7 +82,7 @@ await connection.close();
|
|
|
82
82
|
|
|
83
83
|
### Establish a pooled connection, create a cursor
|
|
84
84
|
```ts
|
|
85
|
-
import {Pool} from 'postgrejs';
|
|
85
|
+
import { Pool } from 'postgrejs';
|
|
86
86
|
|
|
87
87
|
// Create connection pool
|
|
88
88
|
const db = new Pool({
|
|
@@ -114,7 +114,7 @@ await db.close();
|
|
|
114
114
|
|
|
115
115
|
### Using prepared statements
|
|
116
116
|
```ts
|
|
117
|
-
import {DataTypeOIDs} from 'postgrejs';
|
|
117
|
+
import { DataTypeOIDs } from 'postgrejs';
|
|
118
118
|
|
|
119
119
|
// .....
|
|
120
120
|
const statement = await connection.prepare(
|
|
@@ -196,12 +196,12 @@ When you open an issue please provide version of NodeJS and PostgreSQL server.
|
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
## License
|
|
199
|
-
|
|
199
|
+
PostgreJS is available under [MIT](LICENSE) license.
|
|
200
200
|
|
|
201
201
|
[npm-image]: https://img.shields.io/npm/v/postgrejs
|
|
202
202
|
[npm-url]: https://npmjs.org/package/postgrejs
|
|
203
|
-
[
|
|
204
|
-
[
|
|
203
|
+
[ci-test-image]: https://github.com/panates/postgrejs/actions/workflows/test.yml/badge.svg
|
|
204
|
+
[ci-test-url]: https://github.com/panates/postgrejs/actions/workflows/test.yml
|
|
205
205
|
[coveralls-image]: https://img.shields.io/coveralls/panates/postgrejs/master.svg
|
|
206
206
|
[coveralls-url]: https://coveralls.io/r/panates/postgrejs
|
|
207
207
|
[downloads-image]: https://img.shields.io/npm/dm/postgrejs.svg
|
|
@@ -269,10 +269,15 @@ class Connection extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
269
269
|
const stack = new Error().stack;
|
|
270
270
|
return promise.catch(e => {
|
|
271
271
|
if (e instanceof Error && stack) {
|
|
272
|
-
e.stack
|
|
273
|
-
.
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
if (e.stack && stack) {
|
|
273
|
+
e.stack =
|
|
274
|
+
e.stack.substring(0, e.stack.indexOf('\n')) +
|
|
275
|
+
'\n' +
|
|
276
|
+
stack
|
|
277
|
+
.split('\n')
|
|
278
|
+
.filter((x, i) => i && !x.includes('._captureErrorStack'))
|
|
279
|
+
.join('\n');
|
|
280
|
+
}
|
|
276
281
|
}
|
|
277
282
|
throw e;
|
|
278
283
|
});
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PgSocket = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
|
6
|
+
const node_net_1 = tslib_1.__importDefault(require("node:net"));
|
|
7
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
8
|
+
const node_tls_1 = tslib_1.__importDefault(require("node:tls"));
|
|
7
9
|
const putil_promisify_1 = tslib_1.__importDefault(require("putil-promisify"));
|
|
8
|
-
const tls_1 = tslib_1.__importDefault(require("tls"));
|
|
9
10
|
const constants_js_1 = require("../constants.js");
|
|
10
11
|
const safe_event_emitter_js_1 = require("../safe-event-emitter.js");
|
|
11
12
|
const backend_js_1 = require("./backend.js");
|
|
@@ -44,7 +45,7 @@ class PgSocket extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
44
45
|
return;
|
|
45
46
|
this._state = constants_js_1.ConnectionState.CONNECTING;
|
|
46
47
|
const options = this.options;
|
|
47
|
-
const socket = (this._socket = new
|
|
48
|
+
const socket = (this._socket = new node_net_1.default.Socket());
|
|
48
49
|
const errorHandler = (err) => {
|
|
49
50
|
this._state = constants_js_1.ConnectionState.CLOSED;
|
|
50
51
|
this._removeListeners();
|
|
@@ -62,9 +63,9 @@ class PgSocket extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
62
63
|
this._removeListeners();
|
|
63
64
|
if (x.toString() === 'S') {
|
|
64
65
|
const tslOptions = { ...options.ssl, socket };
|
|
65
|
-
if (options.host &&
|
|
66
|
+
if (options.host && node_net_1.default.isIP(options.host) === 0)
|
|
66
67
|
tslOptions.servername = options.host;
|
|
67
|
-
const tlsSocket = (this._socket =
|
|
68
|
+
const tlsSocket = (this._socket = node_tls_1.default.connect(tslOptions));
|
|
68
69
|
tlsSocket.once('error', errorHandler);
|
|
69
70
|
tlsSocket.once('secureConnect', () => {
|
|
70
71
|
this._removeListeners();
|
|
@@ -88,8 +89,10 @@ class PgSocket extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
88
89
|
socket.once('error', errorHandler);
|
|
89
90
|
socket.once('connect', connectHandler);
|
|
90
91
|
this.emit('connecting');
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
const port = options.port || DEFAULT_PORT_NUMBER;
|
|
93
|
+
if (options.host && options.host.startsWith('/')) {
|
|
94
|
+
socket.connect(node_path_1.default.join(options.host, '/.s.PGSQL.' + port));
|
|
95
|
+
}
|
|
93
96
|
else
|
|
94
97
|
socket.connect(options.port || DEFAULT_PORT_NUMBER, options.host || 'localhost');
|
|
95
98
|
}
|
|
@@ -154,8 +157,14 @@ class PgSocket extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
154
157
|
this._send(this._frontend.getSyncMessage());
|
|
155
158
|
}
|
|
156
159
|
capture(callback) {
|
|
160
|
+
if (this._state === constants_js_1.ConnectionState.CLOSING || this._state === constants_js_1.ConnectionState.CLOSED) {
|
|
161
|
+
return Promise.reject(new Error('Connection closed'));
|
|
162
|
+
}
|
|
163
|
+
if (this._state !== constants_js_1.ConnectionState.READY)
|
|
164
|
+
return Promise.reject(new Error('Connection is not ready'));
|
|
157
165
|
return new Promise((resolve, reject) => {
|
|
158
166
|
const done = (err, result) => {
|
|
167
|
+
this.removeListener('close', closeHandler);
|
|
159
168
|
this.removeListener('error', errorHandler);
|
|
160
169
|
this.removeListener('message', msgHandler);
|
|
161
170
|
if (err)
|
|
@@ -164,14 +173,21 @@ class PgSocket extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
164
173
|
resolve(result);
|
|
165
174
|
};
|
|
166
175
|
const errorHandler = (err) => {
|
|
176
|
+
this.removeListener('close', closeHandler);
|
|
167
177
|
this.removeListener('message', msgHandler);
|
|
168
178
|
reject(err);
|
|
169
179
|
};
|
|
180
|
+
const closeHandler = () => {
|
|
181
|
+
this.removeListener('error', errorHandler);
|
|
182
|
+
this.removeListener('message', msgHandler);
|
|
183
|
+
reject(new Error('Connection closed'));
|
|
184
|
+
};
|
|
170
185
|
const msgHandler = (code, msg) => {
|
|
171
186
|
const x = callback(code, msg, done);
|
|
172
187
|
if (putil_promisify_1.default.isPromise(x))
|
|
173
188
|
x.catch(err => done(err));
|
|
174
189
|
};
|
|
190
|
+
this.once('close', closeHandler);
|
|
175
191
|
this.once('error', errorHandler);
|
|
176
192
|
this.on('message', msgHandler);
|
|
177
193
|
});
|
|
@@ -280,7 +296,7 @@ class PgSocket extends safe_event_emitter_js_1.SafeEventEmitter {
|
|
|
280
296
|
break;
|
|
281
297
|
case protocol_js_1.Protocol.AuthenticationMessageKind.MD5Password:
|
|
282
298
|
this._resolvePassword(password => {
|
|
283
|
-
const md5 = (x) =>
|
|
299
|
+
const md5 = (x) => node_crypto_1.default.createHash('md5').update(x, 'utf8').digest('hex');
|
|
284
300
|
const l = md5(password + this.options.user);
|
|
285
301
|
const r = md5(Buffer.concat([Buffer.from(l), msg.salt]));
|
|
286
302
|
const pass = 'md5' + r;
|
|
@@ -266,10 +266,15 @@ export class Connection extends SafeEventEmitter {
|
|
|
266
266
|
const stack = new Error().stack;
|
|
267
267
|
return promise.catch(e => {
|
|
268
268
|
if (e instanceof Error && stack) {
|
|
269
|
-
e.stack
|
|
270
|
-
.
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
if (e.stack && stack) {
|
|
270
|
+
e.stack =
|
|
271
|
+
e.stack.substring(0, e.stack.indexOf('\n')) +
|
|
272
|
+
'\n' +
|
|
273
|
+
stack
|
|
274
|
+
.split('\n')
|
|
275
|
+
.filter((x, i) => i && !x.includes('._captureErrorStack'))
|
|
276
|
+
.join('\n');
|
|
277
|
+
}
|
|
273
278
|
}
|
|
274
279
|
throw e;
|
|
275
280
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import crypto from 'crypto';
|
|
2
|
-
import net from 'net';
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import net from 'node:net';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import tls from 'node:tls';
|
|
3
5
|
import promisify from 'putil-promisify';
|
|
4
|
-
import tls from 'tls';
|
|
5
6
|
import { ConnectionState } from '../constants.js';
|
|
6
7
|
import { SafeEventEmitter } from '../safe-event-emitter.js';
|
|
7
8
|
import { Backend } from './backend.js';
|
|
@@ -84,8 +85,10 @@ export class PgSocket extends SafeEventEmitter {
|
|
|
84
85
|
socket.once('error', errorHandler);
|
|
85
86
|
socket.once('connect', connectHandler);
|
|
86
87
|
this.emit('connecting');
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
const port = options.port || DEFAULT_PORT_NUMBER;
|
|
89
|
+
if (options.host && options.host.startsWith('/')) {
|
|
90
|
+
socket.connect(path.join(options.host, '/.s.PGSQL.' + port));
|
|
91
|
+
}
|
|
89
92
|
else
|
|
90
93
|
socket.connect(options.port || DEFAULT_PORT_NUMBER, options.host || 'localhost');
|
|
91
94
|
}
|
|
@@ -150,8 +153,14 @@ export class PgSocket extends SafeEventEmitter {
|
|
|
150
153
|
this._send(this._frontend.getSyncMessage());
|
|
151
154
|
}
|
|
152
155
|
capture(callback) {
|
|
156
|
+
if (this._state === ConnectionState.CLOSING || this._state === ConnectionState.CLOSED) {
|
|
157
|
+
return Promise.reject(new Error('Connection closed'));
|
|
158
|
+
}
|
|
159
|
+
if (this._state !== ConnectionState.READY)
|
|
160
|
+
return Promise.reject(new Error('Connection is not ready'));
|
|
153
161
|
return new Promise((resolve, reject) => {
|
|
154
162
|
const done = (err, result) => {
|
|
163
|
+
this.removeListener('close', closeHandler);
|
|
155
164
|
this.removeListener('error', errorHandler);
|
|
156
165
|
this.removeListener('message', msgHandler);
|
|
157
166
|
if (err)
|
|
@@ -160,14 +169,21 @@ export class PgSocket extends SafeEventEmitter {
|
|
|
160
169
|
resolve(result);
|
|
161
170
|
};
|
|
162
171
|
const errorHandler = (err) => {
|
|
172
|
+
this.removeListener('close', closeHandler);
|
|
163
173
|
this.removeListener('message', msgHandler);
|
|
164
174
|
reject(err);
|
|
165
175
|
};
|
|
176
|
+
const closeHandler = () => {
|
|
177
|
+
this.removeListener('error', errorHandler);
|
|
178
|
+
this.removeListener('message', msgHandler);
|
|
179
|
+
reject(new Error('Connection closed'));
|
|
180
|
+
};
|
|
166
181
|
const msgHandler = (code, msg) => {
|
|
167
182
|
const x = callback(code, msg, done);
|
|
168
183
|
if (promisify.isPromise(x))
|
|
169
184
|
x.catch(err => done(err));
|
|
170
185
|
};
|
|
186
|
+
this.once('close', closeHandler);
|
|
171
187
|
this.once('error', errorHandler);
|
|
172
188
|
this.on('message', msgHandler);
|
|
173
189
|
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ConnectionState } from '../constants.js';
|
|
2
|
-
import { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
3
|
-
import { QueryOptions } from '../interfaces/query-options.js';
|
|
4
|
-
import { QueryResult } from '../interfaces/query-result.js';
|
|
5
|
-
import { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
|
|
6
|
-
import { ScriptResult } from '../interfaces/script-result.js';
|
|
7
|
-
import { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
|
|
8
|
-
import { DatabaseError } from '../protocol/database-error.js';
|
|
9
|
-
import { Protocol } from '../protocol/protocol.js';
|
|
2
|
+
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
3
|
+
import type { QueryOptions } from '../interfaces/query-options.js';
|
|
4
|
+
import type { QueryResult } from '../interfaces/query-result.js';
|
|
5
|
+
import type { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
|
|
6
|
+
import type { ScriptResult } from '../interfaces/script-result.js';
|
|
7
|
+
import type { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
|
|
8
|
+
import type { DatabaseError } from '../protocol/database-error.js';
|
|
9
|
+
import type { Protocol } from '../protocol/protocol.js';
|
|
10
10
|
import { SafeEventEmitter } from '../safe-event-emitter.js';
|
|
11
|
-
import { Maybe } from '../types.js';
|
|
11
|
+
import type { Maybe } from '../types.js';
|
|
12
12
|
import { IntlConnection } from './intl-connection.js';
|
|
13
13
|
import type { Pool } from './pool.js';
|
|
14
14
|
import { PreparedStatement } from './prepared-statement.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FieldInfo } from '../interfaces/field-info.js';
|
|
2
|
-
import { QueryOptions } from '../interfaces/query-options.js';
|
|
1
|
+
import type { FieldInfo } from '../interfaces/field-info.js';
|
|
2
|
+
import type { QueryOptions } from '../interfaces/query-options.js';
|
|
3
3
|
import { SafeEventEmitter } from '../safe-event-emitter.js';
|
|
4
|
-
import { AnyParseFunction, Maybe, Row } from '../types.js';
|
|
5
|
-
import { Portal } from './portal.js';
|
|
6
|
-
import { PreparedStatement } from './prepared-statement.js';
|
|
4
|
+
import type { AnyParseFunction, Maybe, Row } from '../types.js';
|
|
5
|
+
import type { Portal } from './portal.js';
|
|
6
|
+
import type { PreparedStatement } from './prepared-statement.js';
|
|
7
7
|
export declare class Cursor extends SafeEventEmitter implements AsyncDisposable {
|
|
8
8
|
private readonly _statement;
|
|
9
9
|
private readonly _portal;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Pool as LightningPool } from 'lightning-pool';
|
|
2
|
-
import { PoolConfiguration } from '../interfaces/database-connection-params.js';
|
|
3
|
-
import { QueryOptions } from '../interfaces/query-options.js';
|
|
4
|
-
import { QueryResult } from '../interfaces/query-result.js';
|
|
5
|
-
import { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
|
|
6
|
-
import { ScriptResult } from '../interfaces/script-result.js';
|
|
7
|
-
import { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
|
|
2
|
+
import type { PoolConfiguration } from '../interfaces/database-connection-params.js';
|
|
3
|
+
import type { QueryOptions } from '../interfaces/query-options.js';
|
|
4
|
+
import type { QueryResult } from '../interfaces/query-result.js';
|
|
5
|
+
import type { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
|
|
6
|
+
import type { ScriptResult } from '../interfaces/script-result.js';
|
|
7
|
+
import type { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
|
|
8
8
|
import { SafeEventEmitter } from '../safe-event-emitter.js';
|
|
9
|
-
import { Connection, NotificationCallback } from './connection.js';
|
|
9
|
+
import { Connection, type NotificationCallback } from './connection.js';
|
|
10
10
|
import { IntlConnection } from './intl-connection.js';
|
|
11
|
-
import { PreparedStatement } from './prepared-statement.js';
|
|
11
|
+
import type { PreparedStatement } from './prepared-statement.js';
|
|
12
12
|
export declare class Pool extends SafeEventEmitter {
|
|
13
13
|
protected readonly _pool: LightningPool<IntlConnection>;
|
|
14
14
|
protected readonly _notificationListeners: SafeEventEmitter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QueryOptions } from '../interfaces/query-options.js';
|
|
1
|
+
import type { QueryOptions } from '../interfaces/query-options.js';
|
|
2
2
|
import { Protocol } from '../protocol/protocol.js';
|
|
3
|
-
import { Maybe } from '../types.js';
|
|
4
|
-
import { Connection } from './connection.js';
|
|
3
|
+
import type { Maybe } from '../types.js';
|
|
4
|
+
import type { Connection } from './connection.js';
|
|
5
5
|
import type { PreparedStatement } from './prepared-statement.js';
|
|
6
6
|
export interface PortalExecuteResult {
|
|
7
7
|
code: Protocol.BackendMessageCode;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { QueryOptions } from '../interfaces/query-options.js';
|
|
2
|
-
import { QueryResult } from '../interfaces/query-result.js';
|
|
3
|
-
import { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
|
|
1
|
+
import type { QueryOptions } from '../interfaces/query-options.js';
|
|
2
|
+
import type { QueryResult } from '../interfaces/query-result.js';
|
|
3
|
+
import type { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
|
|
4
4
|
import { SafeEventEmitter } from '../safe-event-emitter.js';
|
|
5
|
-
import { Maybe, OID } from '../types.js';
|
|
6
|
-
import { Connection } from './connection.js';
|
|
5
|
+
import type { Maybe, OID } from '../types.js';
|
|
6
|
+
import type { Connection } from './connection.js';
|
|
7
7
|
export declare class PreparedStatement extends SafeEventEmitter implements AsyncDisposable {
|
|
8
8
|
private readonly _connection;
|
|
9
9
|
private readonly _sql;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DecodeBinaryFunction, EncodeAsNullFunction, EncodeBinaryFunction, EncodeTextFunction, OID, ParseTextFunction } from '../types.js';
|
|
2
|
-
import { EncodeCalculateDimFunction } from '../types.js';
|
|
1
|
+
import type { DecodeBinaryFunction, EncodeAsNullFunction, EncodeBinaryFunction, EncodeCalculateDimFunction, EncodeTextFunction, OID, ParseTextFunction } from '../types.js';
|
|
3
2
|
export interface DataType {
|
|
4
3
|
oid: OID;
|
|
5
4
|
name: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataTypeMap } from '../data-type-map.js';
|
|
2
|
-
import { QueryOptions } from '../interfaces/query-options.js';
|
|
3
|
-
import { Maybe, OID } from '../types.js';
|
|
4
|
-
import { SASL } from './sasl.js';
|
|
5
|
-
import { SmartBufferConfig } from './smart-buffer.js';
|
|
2
|
+
import type { QueryOptions } from '../interfaces/query-options.js';
|
|
3
|
+
import type { Maybe, OID } from '../types.js';
|
|
4
|
+
import type { SASL } from './sasl.js';
|
|
5
|
+
import { type SmartBufferConfig } from './smart-buffer.js';
|
|
6
6
|
export interface FrontendOptions {
|
|
7
7
|
buffer?: SmartBufferConfig;
|
|
8
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConnectionState } from '../constants.js';
|
|
2
|
-
import { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
2
|
+
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
3
3
|
import { SafeEventEmitter } from '../safe-event-emitter.js';
|
|
4
|
-
import { Callback, Maybe } from '../types.js';
|
|
4
|
+
import type { Callback, Maybe } from '../types.js';
|
|
5
5
|
import { Frontend } from './frontend.js';
|
|
6
6
|
import { Protocol } from './protocol.js';
|
|
7
7
|
export type CaptureCallback = (code: Protocol.BackendMessageCode, msg: any, done: (err: Maybe<Error>, result?: any) => void) => void | Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
1
|
+
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
2
2
|
export declare function configFromEnv(): ConnectionConfiguration;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FieldInfo } from '../interfaces/field-info.js';
|
|
1
|
+
import type { FieldInfo } from '../interfaces/field-info.js';
|
|
2
2
|
export declare function convertRowToObject(fields: FieldInfo[], row: any[]): any;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
1
|
+
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
2
|
import type { DecodeBinaryFunction, Nullable } from '../types.js';
|
|
3
3
|
export declare function decodeBinaryArray<T = any>(buf: Buffer, decoder: DecodeBinaryFunction, options?: DataMappingOptions): Nullable<T[]>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
2
|
import type { SmartBuffer } from '../protocol/smart-buffer.js';
|
|
3
|
-
import type { EncodeBinaryFunction, OID } from '../types.js';
|
|
4
|
-
import { EncodeCalculateDimFunction } from '../types.js';
|
|
3
|
+
import type { EncodeBinaryFunction, EncodeCalculateDimFunction, OID } from '../types.js';
|
|
5
4
|
export declare function encodeBinaryArray(io: SmartBuffer, value: any[], itemOid: OID, options: DataMappingOptions, encode: EncodeBinaryFunction, encodeCalculateDimFn?: EncodeCalculateDimFunction): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypeMap } from '../data-type-map.js';
|
|
2
|
-
import { Protocol } from '../protocol/protocol.js';
|
|
3
|
-
import { AnyParseFunction } from '../types.js';
|
|
1
|
+
import type { DataTypeMap } from '../data-type-map.js';
|
|
2
|
+
import type { Protocol } from '../protocol/protocol.js';
|
|
3
|
+
import type { AnyParseFunction } from '../types.js';
|
|
4
4
|
export declare function getParsers(typeMap: DataTypeMap, fields: Protocol.RowDescription[]): AnyParseFunction[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
|
-
import { AnyParseFunction } from '../types.js';
|
|
1
|
+
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
|
+
import type { AnyParseFunction } from '../types.js';
|
|
3
3
|
export declare function parseRow(parsers: AnyParseFunction[], row: any[], options: DataMappingOptions): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
|
-
import { EncodeTextFunction } from '../types.js';
|
|
1
|
+
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
|
+
import type { EncodeTextFunction } from '../types.js';
|
|
3
3
|
export declare function stringifyArrayLiteral(value: any[], options?: DataMappingOptions, encode?: EncodeTextFunction): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
|
-
import { EncodeTextFunction } from '../types.js';
|
|
1
|
+
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
|
+
import type { EncodeTextFunction } from '../types.js';
|
|
3
3
|
export declare function stringifyArrayForSQL(v: any[], options?: DataMappingOptions, encode?: EncodeTextFunction): string;
|
|
4
4
|
export declare function stringifyValueForSQL(v: any, options?: DataMappingOptions, encode?: EncodeTextFunction): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataFormat } from '../constants.js';
|
|
2
|
-
import { DataTypeMap } from '../data-type-map.js';
|
|
3
|
-
import { FieldInfo } from '../interfaces/field-info.js';
|
|
4
|
-
import { Protocol } from '../protocol/protocol.js';
|
|
2
|
+
import type { DataTypeMap } from '../data-type-map.js';
|
|
3
|
+
import type { FieldInfo } from '../interfaces/field-info.js';
|
|
4
|
+
import type { Protocol } from '../protocol/protocol.js';
|
|
5
5
|
export declare function wrapRowDescription(typeMap: DataTypeMap, fields: Protocol.RowDescription[], columnFormat: DataFormat | DataFormat[]): FieldInfo[];
|