cdk-rds-sql 3.4.1 → 4.0.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/.jsii +53 -18
- package/README.md +29 -2
- package/lib/database.js +1 -1
- package/lib/handler.js +35 -7
- package/lib/provider.d.ts +6 -0
- package/lib/provider.js +9 -2
- package/lib/role.js +1 -1
- package/lib/schema.d.ts +5 -0
- package/lib/schema.js +5 -2
- package/lib/sql.js +1 -1
- package/node_modules/pg/lib/client.js +12 -3
- package/node_modules/pg/lib/connection.js +0 -1
- package/node_modules/pg/lib/native/client.js +1 -1
- package/node_modules/pg/lib/query.js +1 -1
- package/node_modules/pg/lib/result.js +2 -1
- package/node_modules/pg/lib/stream.js +69 -16
- package/node_modules/pg/lib/utils.js +35 -42
- package/node_modules/pg/package.json +6 -6
- package/node_modules/pg-connection-string/README.md +2 -2
- package/node_modules/pg-connection-string/package.json +3 -3
- package/node_modules/pg-pool/README.md +1 -1
- package/node_modules/pg-pool/index.js +1 -1
- package/node_modules/pg-pool/package.json +4 -4
- package/node_modules/pg-pool/test/lifetime-timeout.js +0 -1
- package/node_modules/pg-pool/test/max-uses.js +0 -1
- package/node_modules/pg-pool/test/releasing-clients.js +0 -1
- package/node_modules/pg-protocol/dist/b.js +0 -2
- package/node_modules/pg-protocol/dist/b.js.map +1 -1
- package/node_modules/pg-protocol/dist/buffer-reader.d.ts +1 -0
- package/node_modules/pg-protocol/dist/buffer-reader.js +5 -0
- package/node_modules/pg-protocol/dist/buffer-reader.js.map +1 -1
- package/node_modules/pg-protocol/dist/inbound-parser.test.js +27 -10
- package/node_modules/pg-protocol/dist/inbound-parser.test.js.map +1 -1
- package/node_modules/pg-protocol/dist/index.js.map +1 -1
- package/node_modules/pg-protocol/dist/parser.js +2 -2
- package/node_modules/pg-protocol/dist/parser.js.map +1 -1
- package/node_modules/pg-protocol/package.json +4 -4
- package/node_modules/pg-protocol/src/b.ts +0 -3
- package/node_modules/pg-protocol/src/buffer-reader.ts +6 -0
- package/node_modules/pg-protocol/src/inbound-parser.test.ts +28 -11
- package/node_modules/pg-protocol/src/index.ts +1 -1
- package/node_modules/pg-protocol/src/parser.ts +2 -3
- package/package.json +4 -4
package/lib/schema.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CustomResource } from "aws-cdk-lib";
|
|
|
2
2
|
import { Construct } from "constructs";
|
|
3
3
|
import { IDatabase } from "./database";
|
|
4
4
|
import { Provider } from "./provider";
|
|
5
|
+
import { Role } from "./role";
|
|
5
6
|
export interface SchemaProps {
|
|
6
7
|
/**
|
|
7
8
|
* Provider.
|
|
@@ -17,6 +18,10 @@ export interface SchemaProps {
|
|
|
17
18
|
* Schema name.
|
|
18
19
|
*/
|
|
19
20
|
readonly schemaName: string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional role to be granted for managing tables in schema
|
|
23
|
+
*/
|
|
24
|
+
readonly role?: Role;
|
|
20
25
|
}
|
|
21
26
|
export declare class Schema extends CustomResource {
|
|
22
27
|
readonly schemaName: string;
|
package/lib/schema.js
CHANGED
|
@@ -14,15 +14,18 @@ class Schema extends aws_cdk_lib_1.CustomResource {
|
|
|
14
14
|
ResourceId: props.schemaName,
|
|
15
15
|
SecretArn: props.provider.secret.secretArn,
|
|
16
16
|
DatabaseName: props.database ? props.database.databaseName : undefined,
|
|
17
|
+
RoleName: props.role ? props.role.roleName : undefined,
|
|
17
18
|
},
|
|
18
19
|
});
|
|
19
20
|
this.node.addDependency(props.provider);
|
|
20
21
|
this.schemaName = props.schemaName;
|
|
21
22
|
if (props.database)
|
|
22
23
|
this.node.addDependency(props.database);
|
|
24
|
+
if (props.role)
|
|
25
|
+
this.node.addDependency(props.role);
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
exports.Schema = Schema;
|
|
26
29
|
_a = JSII_RTTI_SYMBOL_1;
|
|
27
|
-
Schema[_a] = { fqn: "cdk-rds-sql.Schema", version: "
|
|
28
|
-
//# sourceMappingURL=data:application/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
CHANGED
|
@@ -24,5 +24,5 @@ class Sql extends aws_cdk_lib_1.CustomResource {
|
|
|
24
24
|
}
|
|
25
25
|
exports.Sql = Sql;
|
|
26
26
|
_a = JSII_RTTI_SYMBOL_1;
|
|
27
|
-
Sql[_a] = { fqn: "cdk-rds-sql.Sql", version: "
|
|
27
|
+
Sql[_a] = { fqn: "cdk-rds-sql.Sql", version: "4.0.0" };
|
|
28
28
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3FsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3NxbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDZDQUE0QztBQUc1QyxpQ0FBdUM7QUEyQnZDLE1BQWEsR0FBSSxTQUFRLDRCQUFjO0lBQ3JDLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBZTtRQUN2RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRTtZQUNmLFlBQVksRUFBRSxLQUFLLENBQUMsUUFBUSxDQUFDLFlBQVk7WUFDekMsVUFBVSxFQUFFO2dCQUNWLFFBQVEsRUFBRSxxQkFBYyxDQUFDLEdBQUc7Z0JBQzVCLFNBQVMsRUFBRSxLQUFLLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxTQUFTO2dCQUMxQyxZQUFZLEVBQUUsS0FBSyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLFFBQVEsQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLFNBQVM7Z0JBQ3RFLFNBQVMsRUFBRSxLQUFLLENBQUMsU0FBUztnQkFDMUIsUUFBUSxFQUFFLEtBQUssQ0FBQyxRQUFRO2FBQ3pCO1NBQ0YsQ0FBQyxDQUFBO1FBQ0YsSUFBSSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLFFBQVE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iBDb25zdHJ1Y3QsIGlkOiBzdHJpbmcsIHByb3BzOiBTcWxQcm9wcykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwge1xuICAgICAgc2VydmljZVRva2VuOiBwcm9wcy5wcm92aWRlci5zZXJ2aWNlVG9rZW4sXG4gICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgIFJlc291cmNlOiBSZHNTcWxSZXNvdXJjZS5TUUwsXG4gICAgICAgIFNlY3JldEFybjogcHJvcHMucHJvdmlkZXIuc2VjcmV0LnNlY3JldEFybixcbiAgICAgICAgRGF0YWJhc2VOYW1lOiBwcm9wcy5kYXRhYmFzZSA/IHByb3BzLmRhdGFiYXNlLmRhdGFiYXNlTmFtZSA6IHVuZGVmaW5lZCxcbiAgICAgICAgU3RhdGVtZW50OiBwcm9wcy5zdGF0ZW1lbnQsXG4gICAgICAgIFJvbGxiYWNrOiBwcm9wcy5yb2xsYmFjayxcbiAgICAgIH0sXG4gICAgfSlcbiAgICB0aGlzLm5vZGUuYWRkRGVwZW5kZW5jeShwcm9wcy5wcm92aWRlcilcbiAgICBpZiAocHJvcHMuZGF0YWJhc2UpIHRoaXMubm9kZS5hZGREZXBlbmRlbmN5KHByb3BzLmRhdGFiYXNlKVxuICB9XG59XG4iXX0=
|
|
@@ -99,7 +99,6 @@ class Client extends EventEmitter {
|
|
|
99
99
|
}
|
|
100
100
|
this._connecting = true
|
|
101
101
|
|
|
102
|
-
this.connectionTimeoutHandle
|
|
103
102
|
if (this._connectionTimeoutMillis > 0) {
|
|
104
103
|
this.connectionTimeoutHandle = setTimeout(() => {
|
|
105
104
|
con._ending = true
|
|
@@ -378,11 +377,21 @@ class Client extends EventEmitter {
|
|
|
378
377
|
}
|
|
379
378
|
|
|
380
379
|
_handleCommandComplete(msg) {
|
|
380
|
+
if (this.activeQuery == null) {
|
|
381
|
+
const error = new Error('Received unexpected commandComplete message from backend.')
|
|
382
|
+
this._handleErrorEvent(error)
|
|
383
|
+
return
|
|
384
|
+
}
|
|
381
385
|
// delegate commandComplete to active query
|
|
382
386
|
this.activeQuery.handleCommandComplete(msg, this.connection)
|
|
383
387
|
}
|
|
384
388
|
|
|
385
|
-
_handleParseComplete(
|
|
389
|
+
_handleParseComplete() {
|
|
390
|
+
if (this.activeQuery == null) {
|
|
391
|
+
const error = new Error('Received unexpected parseComplete message from backend.')
|
|
392
|
+
this._handleErrorEvent(error)
|
|
393
|
+
return
|
|
394
|
+
}
|
|
386
395
|
// if a prepared statement has a name and properly parses
|
|
387
396
|
// we track that its already been executed so we don't parse
|
|
388
397
|
// it again on the same client
|
|
@@ -515,7 +524,7 @@ class Client extends EventEmitter {
|
|
|
515
524
|
query.callback = query.callback || values
|
|
516
525
|
}
|
|
517
526
|
} else {
|
|
518
|
-
readTimeout = this.connectionParameters.query_timeout
|
|
527
|
+
readTimeout = config.query_timeout || this.connectionParameters.query_timeout
|
|
519
528
|
query = new Query(config, values, callback)
|
|
520
529
|
if (!query.callback) {
|
|
521
530
|
result = new this._Promise((resolve, reject) => {
|
|
@@ -167,7 +167,7 @@ Client.prototype.query = function (config, values, callback) {
|
|
|
167
167
|
config.callback = values
|
|
168
168
|
}
|
|
169
169
|
} else {
|
|
170
|
-
readTimeout = this.connectionParameters.query_timeout
|
|
170
|
+
readTimeout = config.query_timeout || this.connectionParameters.query_timeout
|
|
171
171
|
query = new NativeQuery(config, values, callback)
|
|
172
172
|
if (!query.callback) {
|
|
173
173
|
let resolveOut, rejectOut
|
|
@@ -65,7 +65,7 @@ class Query extends EventEmitter {
|
|
|
65
65
|
if (!Array.isArray(this._results)) {
|
|
66
66
|
this._results = [this._result]
|
|
67
67
|
}
|
|
68
|
-
this._result = new Result(this._rowMode, this.
|
|
68
|
+
this._result = new Result(this._rowMode, this._result._types)
|
|
69
69
|
this._results.push(this._result)
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -37,7 +37,7 @@ class Result {
|
|
|
37
37
|
if (match) {
|
|
38
38
|
this.command = match[1]
|
|
39
39
|
if (match[3]) {
|
|
40
|
-
//
|
|
40
|
+
// COMMAND OID ROWS
|
|
41
41
|
this.oid = parseInt(match[2], 10)
|
|
42
42
|
this.rowCount = parseInt(match[3], 10)
|
|
43
43
|
} else if (match[2]) {
|
|
@@ -100,6 +100,7 @@ class Result {
|
|
|
100
100
|
this._parsers[i] = types.getTypeParser(desc.dataTypeID, desc.format || 'text')
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
|
|
103
104
|
this._prebuiltEmptyResultObject = { ...row }
|
|
104
105
|
}
|
|
105
106
|
}
|
|
@@ -1,28 +1,81 @@
|
|
|
1
|
+
const { getStream, getSecureStream } = getStreamFuncs()
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
/**
|
|
5
|
+
* Get a socket stream compatible with the current runtime environment.
|
|
6
|
+
* @returns {Duplex}
|
|
7
|
+
*/
|
|
8
|
+
getStream,
|
|
9
|
+
/**
|
|
10
|
+
* Get a TLS secured socket, compatible with the current environment,
|
|
11
|
+
* using the socket and other settings given in `options`.
|
|
12
|
+
* @returns {Duplex}
|
|
13
|
+
*/
|
|
14
|
+
getSecureStream,
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @returns {Duplex}
|
|
18
|
+
* The stream functions that work in Node.js
|
|
4
19
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
function getNodejsStreamFuncs() {
|
|
21
|
+
function getStream(ssl) {
|
|
22
|
+
const net = require('net')
|
|
8
23
|
return new net.Socket()
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getSecureStream(options) {
|
|
27
|
+
var tls = require('tls')
|
|
28
|
+
return tls.connect(options)
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
getStream,
|
|
32
|
+
getSecureStream,
|
|
12
33
|
}
|
|
13
34
|
}
|
|
14
35
|
|
|
15
36
|
/**
|
|
16
|
-
*
|
|
17
|
-
* using the socket and other settings given in `options`.
|
|
18
|
-
* @returns {Duplex}
|
|
37
|
+
* The stream functions that work in Cloudflare Workers
|
|
19
38
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
}
|
|
39
|
+
function getCloudflareStreamFuncs() {
|
|
40
|
+
function getStream(ssl) {
|
|
41
|
+
const { CloudflareSocket } = require('pg-cloudflare')
|
|
42
|
+
return new CloudflareSocket(ssl)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getSecureStream(options) {
|
|
25
46
|
options.socket.startTls(options)
|
|
26
47
|
return options.socket
|
|
27
48
|
}
|
|
49
|
+
return {
|
|
50
|
+
getStream,
|
|
51
|
+
getSecureStream,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Are we running in a Cloudflare Worker?
|
|
57
|
+
*
|
|
58
|
+
* @returns true if the code is currently running inside a Cloudflare Worker.
|
|
59
|
+
*/
|
|
60
|
+
function isCloudflareRuntime() {
|
|
61
|
+
// Since 2022-03-21 the `global_navigator` compatibility flag is on for Cloudflare Workers
|
|
62
|
+
// which means that `navigator.userAgent` will be defined.
|
|
63
|
+
if (typeof navigator === 'object' && navigator !== null && typeof navigator.userAgent === 'string') {
|
|
64
|
+
return navigator.userAgent === 'Cloudflare-Workers'
|
|
65
|
+
}
|
|
66
|
+
// In case `navigator` or `navigator.userAgent` is not defined then try a more sneaky approach
|
|
67
|
+
if (typeof Response === 'function') {
|
|
68
|
+
const resp = new Response(null, { cf: { thing: true } })
|
|
69
|
+
if (typeof resp.cf === 'object' && resp.cf !== null && resp.cf.thing) {
|
|
70
|
+
return true
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function getStreamFuncs() {
|
|
77
|
+
if (isCloudflareRuntime()) {
|
|
78
|
+
return getCloudflareStreamFuncs()
|
|
79
|
+
}
|
|
80
|
+
return getNodejsStreamFuncs()
|
|
28
81
|
}
|
|
@@ -49,27 +49,28 @@ var prepareValue = function (val, seen) {
|
|
|
49
49
|
if (val == null) {
|
|
50
50
|
return null
|
|
51
51
|
}
|
|
52
|
-
if (val
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (ArrayBuffer.isView(val)) {
|
|
56
|
-
var buf = Buffer.from(val.buffer, val.byteOffset, val.byteLength)
|
|
57
|
-
if (buf.length === val.byteLength) {
|
|
58
|
-
return buf
|
|
52
|
+
if (typeof val === 'object') {
|
|
53
|
+
if (val instanceof Buffer) {
|
|
54
|
+
return val
|
|
59
55
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return dateToString(val)
|
|
56
|
+
if (ArrayBuffer.isView(val)) {
|
|
57
|
+
var buf = Buffer.from(val.buffer, val.byteOffset, val.byteLength)
|
|
58
|
+
if (buf.length === val.byteLength) {
|
|
59
|
+
return buf
|
|
60
|
+
}
|
|
61
|
+
return buf.slice(val.byteOffset, val.byteOffset + val.byteLength) // Node.js v4 does not support those Buffer.from params
|
|
67
62
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
if (val instanceof Date) {
|
|
64
|
+
if (defaults.parseInputDatesAsUTC) {
|
|
65
|
+
return dateToStringUTC(val)
|
|
66
|
+
} else {
|
|
67
|
+
return dateToString(val)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(val)) {
|
|
71
|
+
return arrayString(val)
|
|
72
|
+
}
|
|
73
|
+
|
|
73
74
|
return prepareObject(val, seen)
|
|
74
75
|
}
|
|
75
76
|
return val.toString()
|
|
@@ -88,14 +89,6 @@ function prepareObject(val, seen) {
|
|
|
88
89
|
return JSON.stringify(val)
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
function pad(number, digits) {
|
|
92
|
-
number = '' + number
|
|
93
|
-
while (number.length < digits) {
|
|
94
|
-
number = '0' + number
|
|
95
|
-
}
|
|
96
|
-
return number
|
|
97
|
-
}
|
|
98
|
-
|
|
99
92
|
function dateToString(date) {
|
|
100
93
|
var offset = -date.getTimezoneOffset()
|
|
101
94
|
|
|
@@ -104,19 +97,19 @@ function dateToString(date) {
|
|
|
104
97
|
if (isBCYear) year = Math.abs(year) + 1 // negative years are 1 off their BC representation
|
|
105
98
|
|
|
106
99
|
var ret =
|
|
107
|
-
|
|
100
|
+
String(year).padStart(4, '0') +
|
|
108
101
|
'-' +
|
|
109
|
-
|
|
102
|
+
String(date.getMonth() + 1).padStart(2, '0') +
|
|
110
103
|
'-' +
|
|
111
|
-
|
|
104
|
+
String(date.getDate()).padStart(2, '0') +
|
|
112
105
|
'T' +
|
|
113
|
-
|
|
106
|
+
String(date.getHours()).padStart(2, '0') +
|
|
114
107
|
':' +
|
|
115
|
-
|
|
108
|
+
String(date.getMinutes()).padStart(2, '0') +
|
|
116
109
|
':' +
|
|
117
|
-
|
|
110
|
+
String(date.getSeconds()).padStart(2, '0') +
|
|
118
111
|
'.' +
|
|
119
|
-
|
|
112
|
+
String(date.getMilliseconds()).padStart(3, '0')
|
|
120
113
|
|
|
121
114
|
if (offset < 0) {
|
|
122
115
|
ret += '-'
|
|
@@ -125,7 +118,7 @@ function dateToString(date) {
|
|
|
125
118
|
ret += '+'
|
|
126
119
|
}
|
|
127
120
|
|
|
128
|
-
ret +=
|
|
121
|
+
ret += String(Math.floor(offset / 60)).padStart(2, '0') + ':' + String(offset % 60).padStart(2, '0')
|
|
129
122
|
if (isBCYear) ret += ' BC'
|
|
130
123
|
return ret
|
|
131
124
|
}
|
|
@@ -136,19 +129,19 @@ function dateToStringUTC(date) {
|
|
|
136
129
|
if (isBCYear) year = Math.abs(year) + 1 // negative years are 1 off their BC representation
|
|
137
130
|
|
|
138
131
|
var ret =
|
|
139
|
-
|
|
132
|
+
String(year).padStart(4, '0') +
|
|
140
133
|
'-' +
|
|
141
|
-
|
|
134
|
+
String(date.getUTCMonth() + 1).padStart(2, '0') +
|
|
142
135
|
'-' +
|
|
143
|
-
|
|
136
|
+
String(date.getUTCDate()).padStart(2, '0') +
|
|
144
137
|
'T' +
|
|
145
|
-
|
|
138
|
+
String(date.getUTCHours()).padStart(2, '0') +
|
|
146
139
|
':' +
|
|
147
|
-
|
|
140
|
+
String(date.getUTCMinutes()).padStart(2, '0') +
|
|
148
141
|
':' +
|
|
149
|
-
|
|
142
|
+
String(date.getUTCSeconds()).padStart(2, '0') +
|
|
150
143
|
'.' +
|
|
151
|
-
|
|
144
|
+
String(date.getUTCMilliseconds()).padStart(3, '0')
|
|
152
145
|
|
|
153
146
|
ret += '+00:00'
|
|
154
147
|
if (isBCYear) ret += ' BC'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.13.3",
|
|
4
4
|
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"author": "Brian Carlson <brian.m.carlson@gmail.com>",
|
|
21
21
|
"main": "./lib",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"pg-connection-string": "^2.
|
|
24
|
-
"pg-pool": "^3.
|
|
25
|
-
"pg-protocol": "^1.
|
|
23
|
+
"pg-connection-string": "^2.7.0",
|
|
24
|
+
"pg-pool": "^3.7.1",
|
|
25
|
+
"pg-protocol": "^1.7.1",
|
|
26
26
|
"pg-types": "^2.1.0",
|
|
27
27
|
"pgpass": "1.x"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@cloudflare/workers-types": "^4.20230404.0",
|
|
31
31
|
"async": "2.6.4",
|
|
32
|
-
"bluebird": "3.
|
|
32
|
+
"bluebird": "3.7.2",
|
|
33
33
|
"co": "4.6.0",
|
|
34
34
|
"pg-copy-streams": "0.3.0",
|
|
35
35
|
"typescript": "^4.0.3",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 8.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "5755b783862dd593f8119d5f5711cfbd10b58444"
|
|
62
62
|
}
|
|
@@ -22,10 +22,10 @@ var config = parse('postgres://someuser:somepassword@somehost:381/somedatabase')
|
|
|
22
22
|
|
|
23
23
|
The resulting config contains a subset of the following properties:
|
|
24
24
|
|
|
25
|
-
* `host` - Postgres server hostname or, for UNIX domain sockets, the socket filename
|
|
26
|
-
* `port` - port on which to connect
|
|
27
25
|
* `user` - User with which to authenticate to the server
|
|
28
26
|
* `password` - Corresponding password
|
|
27
|
+
* `host` - Postgres server hostname or, for UNIX domain sockets, the socket filename
|
|
28
|
+
* `port` - port on which to connect
|
|
29
29
|
* `database` - Database name within the server
|
|
30
30
|
* `client_encoding` - string encoding the client will use
|
|
31
31
|
* `ssl`, either a boolean or an object with properties
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-connection-string",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Functions for dealing with a PostgresSQL connection string",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"chai": "^4.1.1",
|
|
31
31
|
"coveralls": "^3.0.4",
|
|
32
32
|
"istanbul": "^0.4.5",
|
|
33
|
-
"mocha": "^
|
|
33
|
+
"mocha": "^10.5.2"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"index.js",
|
|
37
37
|
"index.d.ts"
|
|
38
38
|
],
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "92cb640fd316972e323ced6256b2acd89b1b58e0"
|
|
40
40
|
}
|
|
@@ -244,7 +244,7 @@ class Pool extends EventEmitter {
|
|
|
244
244
|
// remove the dead client from our list of clients
|
|
245
245
|
this._clients = this._clients.filter((c) => c !== client)
|
|
246
246
|
if (timeoutHit) {
|
|
247
|
-
err
|
|
247
|
+
err = new Error('Connection terminated due to connection timeout', { cause: err })
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// this client won’t be released, so move on immediately
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-pool",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "Connection pool for node-postgres",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/brianc/node-pg-pool#readme",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"bluebird": "3.
|
|
30
|
+
"bluebird": "3.7.2",
|
|
31
31
|
"co": "4.6.0",
|
|
32
32
|
"expect.js": "0.3.1",
|
|
33
33
|
"lodash": "^4.17.11",
|
|
34
|
-
"mocha": "^
|
|
34
|
+
"mocha": "^10.5.2",
|
|
35
35
|
"pg-cursor": "^1.3.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"pg": ">=8.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "732580782ffa2f9299f7112ff27cfa4534cd22f3"
|
|
41
41
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// file for microbenchmarking
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const buffer_writer_1 = require("./buffer-writer");
|
|
5
4
|
const buffer_reader_1 = require("./buffer-reader");
|
|
6
5
|
const LOOPS = 1000;
|
|
7
6
|
let count = 0;
|
|
8
7
|
let start = Date.now();
|
|
9
|
-
const writer = new buffer_writer_1.Writer();
|
|
10
8
|
const reader = new buffer_reader_1.BufferReader();
|
|
11
9
|
const buffer = Buffer.from([33, 33, 33, 33, 33, 33, 33, 0]);
|
|
12
10
|
const run = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b.js","sourceRoot":"","sources":["../src/b.ts"],"names":[],"mappings":";AAAA,6BAA6B;;AAE7B,
|
|
1
|
+
{"version":3,"file":"b.js","sourceRoot":"","sources":["../src/b.ts"],"names":[],"mappings":";AAAA,6BAA6B;;AAE7B,mDAA8C;AAE9C,MAAM,KAAK,GAAG,IAAI,CAAA;AAClB,IAAI,KAAK,GAAG,CAAC,CAAA;AACb,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AAEtB,MAAM,MAAM,GAAG,IAAI,4BAAY,EAAE,CAAA;AACjC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;AAE3D,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,IAAI,KAAK,GAAG,KAAK,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAA;QAC/B,OAAM;KACP;IACD,KAAK,EAAE,CAAA;IACP,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC9B,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QAC3B,MAAM,CAAC,OAAO,EAAE,CAAA;KACjB;IACD,YAAY,CAAC,GAAG,CAAC,CAAA;AACnB,CAAC,CAAA;AAED,GAAG,EAAE,CAAA"}
|
|
@@ -28,6 +28,11 @@ class BufferReader {
|
|
|
28
28
|
this.offset += 4;
|
|
29
29
|
return result;
|
|
30
30
|
}
|
|
31
|
+
uint32() {
|
|
32
|
+
const result = this.buffer.readUInt32BE(this.offset);
|
|
33
|
+
this.offset += 4;
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
31
36
|
string(length) {
|
|
32
37
|
const result = this.buffer.toString(this.encoding, this.offset, this.offset + length);
|
|
33
38
|
this.offset += length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-reader.js","sourceRoot":"","sources":["../src/buffer-reader.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAEzC,MAAa,YAAY;IAMvB,YAAoB,SAAiB,CAAC;QAAlB,WAAM,GAAN,MAAM,CAAY;QAL9B,WAAM,GAAW,WAAW,CAAA;QAEpC,wCAAwC;QAChC,aAAQ,GAAW,OAAO,CAAA;IAEO,CAAC;IAEnC,SAAS,CAAC,MAAc,EAAE,MAAc;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,KAAK;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;QAChB,OAAO,MAAM,CAAA;IACf,CAAC;IAEM,IAAI;QACT,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,MAAM,EAAE,CAAA;QACb,OAAO,MAAM,CAAA;IACf,CAAC;IAEM,KAAK;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;QAChB,OAAO,MAAM,CAAA;IACf,CAAC;IAEM,MAAM,CAAC,MAAc;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,M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AK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;IAC5D,CAAC;IAEM,KAAK,CAAC,MAAc;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;QACnE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAA;QACrB,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAxDD,oCAwDC"}
|
|
@@ -25,16 +25,6 @@ var commandCompleteBuffer = test_buffers_1.default.commandComplete('SELECT 3');
|
|
|
25
25
|
var parseCompleteBuffer = test_buffers_1.default.parseComplete();
|
|
26
26
|
var bindCompleteBuffer = test_buffers_1.default.bindComplete();
|
|
27
27
|
var portalSuspendedBuffer = test_buffers_1.default.portalSuspended();
|
|
28
|
-
var addRow = function (bufferList, name, offset) {
|
|
29
|
-
return bufferList
|
|
30
|
-
.addCString(name) // field name
|
|
31
|
-
.addInt32(offset++) // table id
|
|
32
|
-
.addInt16(offset++) // attribute of column number
|
|
33
|
-
.addInt32(offset++) // objectId of field's data type
|
|
34
|
-
.addInt16(offset++) // datatype size
|
|
35
|
-
.addInt32(offset++) // type modifier
|
|
36
|
-
.addInt16(0); // format code, 0 => text
|
|
37
|
-
};
|
|
38
28
|
var row1 = {
|
|
39
29
|
name: 'id',
|
|
40
30
|
tableID: 1,
|
|
@@ -58,6 +48,16 @@ var twoRowBuf = test_buffers_1.default.rowDescription([
|
|
|
58
48
|
formatCode: 0,
|
|
59
49
|
},
|
|
60
50
|
]);
|
|
51
|
+
var rowWithBigOids = {
|
|
52
|
+
name: 'bigoid',
|
|
53
|
+
tableID: 3000000001,
|
|
54
|
+
attributeNumber: 2,
|
|
55
|
+
dataTypeID: 3000000003,
|
|
56
|
+
dataTypeSize: 4,
|
|
57
|
+
typeModifier: 5,
|
|
58
|
+
formatCode: 0,
|
|
59
|
+
};
|
|
60
|
+
var bigOidDescBuff = test_buffers_1.default.rowDescription([rowWithBigOids]);
|
|
61
61
|
var emptyRowFieldBuf = new buffer_list_1.default().addInt16(0).join(true, 'D');
|
|
62
62
|
var emptyRowFieldBuf = test_buffers_1.default.dataRow([]);
|
|
63
63
|
var oneFieldBuf = new buffer_list_1.default()
|
|
@@ -141,6 +141,22 @@ var expectedTwoRowMessage = {
|
|
|
141
141
|
},
|
|
142
142
|
],
|
|
143
143
|
};
|
|
144
|
+
var expectedBigOidMessage = {
|
|
145
|
+
name: 'rowDescription',
|
|
146
|
+
length: 31,
|
|
147
|
+
fieldCount: 1,
|
|
148
|
+
fields: [
|
|
149
|
+
{
|
|
150
|
+
name: 'bigoid',
|
|
151
|
+
tableID: 3000000001,
|
|
152
|
+
columnID: 2,
|
|
153
|
+
dataTypeID: 3000000003,
|
|
154
|
+
dataTypeSize: 4,
|
|
155
|
+
dataTypeModifier: 5,
|
|
156
|
+
format: 'text',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
144
160
|
var emptyParameterDescriptionBuffer = new buffer_list_1.default()
|
|
145
161
|
.addInt16(0) // number of parameters
|
|
146
162
|
.join(true, 't');
|
|
@@ -247,6 +263,7 @@ describe('PgPacketStream', function () {
|
|
|
247
263
|
testForMessage(emptyRowDescriptionBuffer, expectedEmptyRowDescriptionMessage);
|
|
248
264
|
testForMessage(oneRowDescBuff, expectedOneRowMessage);
|
|
249
265
|
testForMessage(twoRowBuf, expectedTwoRowMessage);
|
|
266
|
+
testForMessage(bigOidDescBuff, expectedBigOidMessage);
|
|
250
267
|
});
|
|
251
268
|
describe('parameterDescription messages', function () {
|
|
252
269
|
testForMessage(emptyParameterDescriptionBuffer, expectedEmptyParameterDescriptionMessage);
|