pg 7.16.1 → 7.18.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/LICENSE +1 -1
- package/README.md +1 -1
- package/lib/client.js +3 -0
- package/lib/compat/check-constructor.js +0 -0
- package/lib/compat/warn-deprecation.js +2 -2
- package/lib/connection-fast.js +5 -0
- package/lib/connection-parameters.js +1 -0
- package/lib/connection.js +14 -4
- package/lib/defaults.js +4 -0
- package/lib/index.js +0 -0
- package/lib/native/client.js +4 -1
- package/lib/native/index.js +0 -0
- package/lib/native/query.js +0 -0
- package/lib/query.js +0 -0
- package/lib/result.js +1 -1
- package/lib/sasl.js +0 -0
- package/lib/type-overrides.js +0 -0
- package/lib/utils.js +0 -0
- package/package.json +4 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ The causes and solutions to common errors can be found among the [Frequently Ask
|
|
|
69
69
|
|
|
70
70
|
## License
|
|
71
71
|
|
|
72
|
-
Copyright (c) 2010-
|
|
72
|
+
Copyright (c) 2010-2020 Brian Carlson (brian.m.carlson@gmail.com)
|
|
73
73
|
|
|
74
74
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
75
75
|
of this software and associated documentation files (the "Software"), to deal
|
package/lib/client.js
CHANGED
|
@@ -371,6 +371,9 @@ Client.prototype.getStartupConf = function () {
|
|
|
371
371
|
if (params.statement_timeout) {
|
|
372
372
|
data.statement_timeout = String(parseInt(params.statement_timeout, 10))
|
|
373
373
|
}
|
|
374
|
+
if (params.idle_in_transaction_session_timeout) {
|
|
375
|
+
data.idle_in_transaction_session_timeout = String(parseInt(params.idle_in_transaction_session_timeout, 10))
|
|
376
|
+
}
|
|
374
377
|
|
|
375
378
|
return data
|
|
376
379
|
}
|
|
File without changes
|
|
@@ -5,7 +5,7 @@ const util = require('util')
|
|
|
5
5
|
const dummyFunctions = new Map()
|
|
6
6
|
|
|
7
7
|
// Node 4 doesn’t support process.emitWarning(message, 'DeprecationWarning', code).
|
|
8
|
-
const
|
|
8
|
+
const warnDeprecation = (message, code) => {
|
|
9
9
|
let dummy = dummyFunctions.get(code)
|
|
10
10
|
|
|
11
11
|
if (dummy === undefined) {
|
|
@@ -16,4 +16,4 @@ const emitDeprecationWarning = (message, code) => {
|
|
|
16
16
|
dummy()
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
module.exports =
|
|
19
|
+
module.exports = warnDeprecation
|
package/lib/connection-fast.js
CHANGED
|
@@ -15,6 +15,8 @@ var Writer = require('buffer-writer')
|
|
|
15
15
|
// eslint-disable-next-line
|
|
16
16
|
var PacketStream = require('pg-packet-stream')
|
|
17
17
|
|
|
18
|
+
var warnDeprecation = require('./compat/warn-deprecation')
|
|
19
|
+
|
|
18
20
|
var TEXT_MODE = 0
|
|
19
21
|
|
|
20
22
|
// TODO(bmc) support binary mode here
|
|
@@ -105,6 +107,9 @@ Connection.prototype.connect = function (port, host) {
|
|
|
105
107
|
secureOptions: self.ssl.secureOptions,
|
|
106
108
|
NPNProtocols: self.ssl.NPNProtocols
|
|
107
109
|
}
|
|
110
|
+
if (typeof self.ssl.rejectUnauthorized !== 'boolean') {
|
|
111
|
+
warnDeprecation('Implicit disabling of certificate verification is deprecated and will be removed in pg 8. Specify `rejectUnauthorized: true` to require a valid CA or `rejectUnauthorized: false` to explicitly opt out of MITM protection.', 'PG-SSL-VERIFY')
|
|
112
|
+
}
|
|
108
113
|
if (net.isIP(host) === 0) {
|
|
109
114
|
options.servername = host
|
|
110
115
|
}
|
|
@@ -65,6 +65,7 @@ var ConnectionParameters = function (config) {
|
|
|
65
65
|
this.application_name = val('application_name', config, 'PGAPPNAME')
|
|
66
66
|
this.fallback_application_name = val('fallback_application_name', config, false)
|
|
67
67
|
this.statement_timeout = val('statement_timeout', config, false)
|
|
68
|
+
this.idle_in_transaction_session_timeout = val('idle_in_transaction_session_timeout', config, false)
|
|
68
69
|
this.query_timeout = val('query_timeout', config, false)
|
|
69
70
|
|
|
70
71
|
if (config.connectionTimeoutMillis === undefined) {
|
package/lib/connection.js
CHANGED
|
@@ -14,6 +14,8 @@ var util = require('util')
|
|
|
14
14
|
var Writer = require('buffer-writer')
|
|
15
15
|
var Reader = require('packet-reader')
|
|
16
16
|
|
|
17
|
+
var warnDeprecation = require('./compat/warn-deprecation')
|
|
18
|
+
|
|
17
19
|
var TEXT_MODE = 0
|
|
18
20
|
var BINARY_MODE = 1
|
|
19
21
|
var Connection = function (config) {
|
|
@@ -83,11 +85,13 @@ Connection.prototype.connect = function (port, host) {
|
|
|
83
85
|
this.stream.once('data', function (buffer) {
|
|
84
86
|
var responseCode = buffer.toString('utf8')
|
|
85
87
|
switch (responseCode) {
|
|
86
|
-
case 'N': // Server does not support SSL connections
|
|
87
|
-
return self.emit('error', new Error('The server does not support SSL connections'))
|
|
88
88
|
case 'S': // Server supports SSL connections, continue with a secure connection
|
|
89
89
|
break
|
|
90
|
+
case 'N': // Server does not support SSL connections
|
|
91
|
+
self.stream.end()
|
|
92
|
+
return self.emit('error', new Error('The server does not support SSL connections'))
|
|
90
93
|
default: // Any other response byte, including 'E' (ErrorResponse) indicating a server error
|
|
94
|
+
self.stream.end()
|
|
91
95
|
return self.emit('error', new Error('There was an error establishing an SSL connection'))
|
|
92
96
|
}
|
|
93
97
|
var tls = require('tls')
|
|
@@ -103,13 +107,15 @@ Connection.prototype.connect = function (port, host) {
|
|
|
103
107
|
secureOptions: self.ssl.secureOptions,
|
|
104
108
|
NPNProtocols: self.ssl.NPNProtocols
|
|
105
109
|
}
|
|
110
|
+
if (typeof self.ssl.rejectUnauthorized !== 'boolean') {
|
|
111
|
+
warnDeprecation('Implicit disabling of certificate verification is deprecated and will be removed in pg 8. Specify `rejectUnauthorized: true` to require a valid CA or `rejectUnauthorized: false` to explicitly opt out of MITM protection.', 'PG-SSL-VERIFY')
|
|
112
|
+
}
|
|
106
113
|
if (net.isIP(host) === 0) {
|
|
107
114
|
options.servername = host
|
|
108
115
|
}
|
|
109
116
|
self.stream = tls.connect(options)
|
|
110
|
-
self.attachListeners(self.stream)
|
|
111
117
|
self.stream.on('error', reportStreamError)
|
|
112
|
-
|
|
118
|
+
self.attachListeners(self.stream)
|
|
113
119
|
self.emit('sslconnect')
|
|
114
120
|
})
|
|
115
121
|
}
|
|
@@ -340,6 +346,10 @@ Connection.prototype.end = function () {
|
|
|
340
346
|
// 0x58 = 'X'
|
|
341
347
|
this.writer.add(emptyBuffer)
|
|
342
348
|
this._ending = true
|
|
349
|
+
if (!this.stream.writable) {
|
|
350
|
+
this.stream.end()
|
|
351
|
+
return
|
|
352
|
+
}
|
|
343
353
|
return this.stream.write(END_BUFFER, () => {
|
|
344
354
|
this.stream.end()
|
|
345
355
|
})
|
package/lib/defaults.js
CHANGED
|
@@ -59,6 +59,10 @@ module.exports = {
|
|
|
59
59
|
// false=unlimited
|
|
60
60
|
statement_timeout: false,
|
|
61
61
|
|
|
62
|
+
// Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds
|
|
63
|
+
// false=unlimited
|
|
64
|
+
idle_in_transaction_session_timeout: false,
|
|
65
|
+
|
|
62
66
|
// max milliseconds to wait for query to complete (client side)
|
|
63
67
|
query_timeout: false,
|
|
64
68
|
|
package/lib/index.js
CHANGED
|
File without changes
|
package/lib/native/client.js
CHANGED
|
@@ -89,7 +89,10 @@ Client.prototype._connect = function (cb) {
|
|
|
89
89
|
this.connectionParameters.getLibpqConnectionString(function (err, conString) {
|
|
90
90
|
if (err) return cb(err)
|
|
91
91
|
self.native.connect(conString, function (err) {
|
|
92
|
-
if (err)
|
|
92
|
+
if (err) {
|
|
93
|
+
self.native.end()
|
|
94
|
+
return cb(err)
|
|
95
|
+
}
|
|
93
96
|
|
|
94
97
|
// set internal states to connected
|
|
95
98
|
self._connected = true
|
package/lib/native/index.js
CHANGED
|
File without changes
|
package/lib/native/query.js
CHANGED
|
File without changes
|
package/lib/query.js
CHANGED
|
File without changes
|
package/lib/result.js
CHANGED
package/lib/sasl.js
CHANGED
|
File without changes
|
package/lib/type-overrides.js
CHANGED
|
File without changes
|
package/lib/utils.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.18.1",
|
|
4
4
|
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"postgresql",
|
|
12
12
|
"rdbms"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "
|
|
14
|
+
"homepage": "https://github.com/brianc/node-postgres",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git://github.com/brianc/node-postgres.git"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"packet-reader": "1.0.0",
|
|
24
24
|
"pg-connection-string": "0.1.3",
|
|
25
25
|
"pg-packet-stream": "^1.1.0",
|
|
26
|
-
"pg-pool": "^2.0.
|
|
26
|
+
"pg-pool": "^2.0.10",
|
|
27
27
|
"pg-types": "^2.1.0",
|
|
28
28
|
"pgpass": "1.x",
|
|
29
29
|
"semver": "4.3.2"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">= 4.5.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "b3f0728a1102772a5c6320c78c2533354d78a39b"
|
|
57
57
|
}
|