@pi-r/oracle 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 +8 -6
- package/package.json +1 -1
package/client/index.js
CHANGED
|
@@ -42,11 +42,13 @@ function removePoolProperties(credential) {
|
|
|
42
42
|
return credential;
|
|
43
43
|
}
|
|
44
44
|
function getPoolKey(credential) {
|
|
45
|
+
var _a;
|
|
45
46
|
if (credential.connectString && (credential.user && credential.password || credential.externalAuth)) {
|
|
46
|
-
return credential.connectString + '_' + (credential.externalAuth ? 'external' : credential.user + '_' + credential.password) + '_' + (credential.edition || '') + '_' + (credential.tag ? credential.tag + '#' + (credential.matchAny ? '1' : '0') : '') + '_' + (credential.privilege
|
|
47
|
+
return credential.connectString + '_' + (credential.externalAuth ? 'external' : credential.user + '_' + credential.password) + '_' + (credential.edition || '') + '_' + (credential.tag ? credential.tag + '#' + (credential.matchAny ? '1' : '0') : '') + '_' + ((_a = credential.privilege) !== null && _a !== void 0 ? _a : '') + '_' + Db.asString(credential.shardingKey) + '_' + Db.asString(credential.superShardingKey);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
async function setCredential(item) {
|
|
51
|
+
var _a, _b, _c, _d, _e;
|
|
50
52
|
let credential = this.getCredential(item), hostname, port, username, database;
|
|
51
53
|
if (credential) {
|
|
52
54
|
({ hostname, port, username } = (0, util_1.parseServerAuth)(credential));
|
|
@@ -130,19 +132,19 @@ async function setCredential(item) {
|
|
|
130
132
|
if (config) {
|
|
131
133
|
const { min, max, idle, queue_max, queue_idle } = config;
|
|
132
134
|
if (min >= 0) {
|
|
133
|
-
credential.poolMin
|
|
135
|
+
(_a = credential.poolMin) !== null && _a !== void 0 ? _a : (credential.poolMin = min);
|
|
134
136
|
}
|
|
135
137
|
if (max > 0) {
|
|
136
|
-
credential.poolMax
|
|
138
|
+
(_b = credential.poolMax) !== null && _b !== void 0 ? _b : (credential.poolMax = max);
|
|
137
139
|
}
|
|
138
140
|
if (idle >= 0) {
|
|
139
|
-
credential.poolTimeout
|
|
141
|
+
(_c = credential.poolTimeout) !== null && _c !== void 0 ? _c : (credential.poolTimeout = idle / 1000);
|
|
140
142
|
}
|
|
141
143
|
if (queue_max >= 0) {
|
|
142
|
-
credential.queueMax
|
|
144
|
+
(_d = credential.queueMax) !== null && _d !== void 0 ? _d : (credential.queueMax = queue_max);
|
|
143
145
|
}
|
|
144
146
|
if (queue_idle >= 0) {
|
|
145
|
-
credential.queueTimeout
|
|
147
|
+
(_e = credential.queueTimeout) !== null && _e !== void 0 ? _e : (credential.queueTimeout = queue_idle);
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
new OraclePool(await createPool(credential), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
|