@pi-r/postgres 0.6.6 → 0.6.8
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 +10 -7
- package/package.json +5 -5
package/client/index.js
CHANGED
|
@@ -46,6 +46,7 @@ function removePoolProperties(credential) {
|
|
|
46
46
|
return credential;
|
|
47
47
|
}
|
|
48
48
|
function fromConnectionString(credential, uri) {
|
|
49
|
+
var _a;
|
|
49
50
|
const { user, password, host, port, database, application_name, ssl } = connectionString.parse(uri);
|
|
50
51
|
if (!credential.user) {
|
|
51
52
|
credential.user = user;
|
|
@@ -58,7 +59,7 @@ function fromConnectionString(credential, uri) {
|
|
|
58
59
|
credential.database || (credential.database = database);
|
|
59
60
|
credential.application_name || (credential.application_name = application_name);
|
|
60
61
|
if (ssl) {
|
|
61
|
-
credential.ssl
|
|
62
|
+
(_a = credential.ssl) !== null && _a !== void 0 ? _a : (credential.ssl = (0, types_1.isPlainObject)(ssl) ? ssl : true);
|
|
62
63
|
}
|
|
63
64
|
return credential;
|
|
64
65
|
}
|
|
@@ -84,6 +85,7 @@ function setAuthentication(credential) {
|
|
|
84
85
|
}
|
|
85
86
|
exports.setAuthentication = setAuthentication;
|
|
86
87
|
function setCredential(item) {
|
|
88
|
+
var _a, _b, _c, _d, _e;
|
|
87
89
|
let credential = this.getCredential(item);
|
|
88
90
|
if (credential) {
|
|
89
91
|
setAuthentication.call(this, credential);
|
|
@@ -115,7 +117,7 @@ function setCredential(item) {
|
|
|
115
117
|
}
|
|
116
118
|
let username, password, pool;
|
|
117
119
|
if ((0, types_1.isString)(usePool)) {
|
|
118
|
-
if (username = credential.user || credential.connectionString && (0, util_1.parseConnectionString)(credential.connectionString)
|
|
120
|
+
if (username = credential.user || credential.connectionString && ((_a = (0, util_1.parseConnectionString)(credential.connectionString)) === null || _a === void 0 ? void 0 : _a.username)) {
|
|
119
121
|
[password, pool] = DbPool.validateKey(POOL_STATE, username, usePool);
|
|
120
122
|
if (pool) {
|
|
121
123
|
pool.add(item, password);
|
|
@@ -131,16 +133,16 @@ function setCredential(item) {
|
|
|
131
133
|
if (config) {
|
|
132
134
|
const { min, max, idle, timeout } = config;
|
|
133
135
|
if (min >= 0) {
|
|
134
|
-
credential.min
|
|
136
|
+
(_b = credential.min) !== null && _b !== void 0 ? _b : (credential.min = min);
|
|
135
137
|
}
|
|
136
138
|
if (max > 0) {
|
|
137
|
-
credential.max
|
|
139
|
+
(_c = credential.max) !== null && _c !== void 0 ? _c : (credential.max = max);
|
|
138
140
|
}
|
|
139
141
|
if (idle > 0) {
|
|
140
|
-
credential.idleTimeoutMillis
|
|
142
|
+
(_d = credential.idleTimeoutMillis) !== null && _d !== void 0 ? _d : (credential.idleTimeoutMillis = idle);
|
|
141
143
|
}
|
|
142
144
|
if (timeout > 0) {
|
|
143
|
-
credential.connectionTimeoutMillis
|
|
145
|
+
(_e = credential.connectionTimeoutMillis) !== null && _e !== void 0 ? _e : (credential.connectionTimeoutMillis = timeout);
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
const poolKey = getPoolKey(credential);
|
|
@@ -156,6 +158,7 @@ async function executeQuery(item, options) {
|
|
|
156
158
|
}
|
|
157
159
|
exports.executeQuery = executeQuery;
|
|
158
160
|
async function executeBatchQuery(batch, options = '', outResult) {
|
|
161
|
+
var _a;
|
|
159
162
|
const length = batch.length;
|
|
160
163
|
if (length === 0) {
|
|
161
164
|
return [];
|
|
@@ -237,7 +240,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
237
240
|
item.transactionState &= ~64;
|
|
238
241
|
return client;
|
|
239
242
|
};
|
|
240
|
-
if (this.host
|
|
243
|
+
if ((_a = this.host) === null || _a === void 0 ? void 0 : _a.username) {
|
|
241
244
|
this.applyCommand(...batch);
|
|
242
245
|
}
|
|
243
246
|
for (let i = 0; i < length; ++i) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/postgres",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "PostgreSQL client driver for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"types": "client/index.d.ts",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@e-mc/db": "^0.8.
|
|
25
|
-
"@e-mc/types": "^0.8.
|
|
26
|
-
"pg": "^8.
|
|
24
|
+
"@e-mc/db": "^0.8.14",
|
|
25
|
+
"@e-mc/types": "^0.8.14",
|
|
26
|
+
"pg": "^8.12.0",
|
|
27
27
|
"pg-connection-string": "^2.6.4",
|
|
28
|
-
"pg-query-stream": "^4.
|
|
28
|
+
"pg-query-stream": "^4.6.0"
|
|
29
29
|
}
|
|
30
30
|
}
|