@pi-r/postgres 0.2.10 → 0.2.11
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/client/index.js +5 -4
- package/package.json +1 -1
package/client/index.js
CHANGED
|
@@ -53,6 +53,7 @@ function setAuthentication(credential) {
|
|
|
53
53
|
}
|
|
54
54
|
exports.setAuthentication = setAuthentication;
|
|
55
55
|
function setCredential(item) {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
56
57
|
let credential = this.getCredential(item);
|
|
57
58
|
if (credential) {
|
|
58
59
|
setAuthentication.call(this, credential);
|
|
@@ -76,7 +77,7 @@ function setCredential(item) {
|
|
|
76
77
|
const usePool = item.usePool;
|
|
77
78
|
if (item.usePool && typeof credential.password !== 'function') {
|
|
78
79
|
let username, password, pool;
|
|
79
|
-
if (typeof usePool === 'string' && (username = credential.user || credential.connectionString && (0, util_1.parseConnectionString)(credential.connectionString)
|
|
80
|
+
if (typeof usePool === 'string' && (username = credential.user || credential.connectionString && ((_a = (0, util_1.parseConnectionString)(credential.connectionString)) === null || _a === void 0 ? void 0 : _a.username))) {
|
|
80
81
|
[password, pool] = DbPool.validateKey(POOL_STATE, username, usePool);
|
|
81
82
|
if (pool) {
|
|
82
83
|
pool.add(item, password);
|
|
@@ -90,13 +91,13 @@ function setCredential(item) {
|
|
|
90
91
|
if (config) {
|
|
91
92
|
const { min, max, idle } = config;
|
|
92
93
|
if (min >= 0) {
|
|
93
|
-
credential.min
|
|
94
|
+
(_b = credential.min) !== null && _b !== void 0 ? _b : (credential.min = min);
|
|
94
95
|
}
|
|
95
96
|
if (max > 0) {
|
|
96
|
-
credential.max
|
|
97
|
+
(_c = credential.max) !== null && _c !== void 0 ? _c : (credential.max = max);
|
|
97
98
|
}
|
|
98
99
|
if (idle > 0) {
|
|
99
|
-
credential.idleTimeoutMillis
|
|
100
|
+
(_d = credential.idleTimeoutMillis) !== null && _d !== void 0 ? _d : (credential.idleTimeoutMillis = idle);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
new PostgresPool(new Pool(credential), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
|