@pi-r/mssql 0.6.5 → 0.6.7
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 +11 -9
- package/package.json +3 -3
package/client/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
exports.DB_SOURCE_TYPE = exports.DB_SOURCE_CLIENT = exports.checkTimeout = exports.executeBatchQuery = exports.executeQuery = exports.setCredential = void 0;
|
|
4
3
|
const tedious = require("tedious");
|
|
5
4
|
const types_1 = require("@e-mc/types");
|
|
@@ -111,11 +110,12 @@ function convertType(sql, type, value, options) {
|
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
function getPoolKey(credential) {
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
var _a, _b;
|
|
114
|
+
const auth = (_a = credential.authentication) === null || _a === void 0 ? void 0 : _a.options;
|
|
115
|
+
if (!credential.server || !((auth === null || auth === void 0 ? void 0 : auth.userName) && auth.password)) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
const tls = credential.options
|
|
118
|
+
const tls = (_b = credential.options) === null || _b === void 0 ? void 0 : _b.cryptoCredentialsDetails;
|
|
119
119
|
if (tls) {
|
|
120
120
|
if (!(0, types_1.isObject)(tls)) {
|
|
121
121
|
delete credential.options.cryptoCredentialsDetails;
|
|
@@ -138,6 +138,7 @@ function getPoolKey(credential) {
|
|
|
138
138
|
}
|
|
139
139
|
const isOutputParameters = (params) => (0, types_1.isPlainObject)(params) && Object.keys(params).length === 2 && 'input' in params && 'output' in params;
|
|
140
140
|
function setCredential(item) {
|
|
141
|
+
var _a, _b, _c, _d;
|
|
141
142
|
let credential = this.getCredential(item), hostname, username, password, port, database;
|
|
142
143
|
if (credential) {
|
|
143
144
|
({ username, password, hostname, port, database } = (0, util_1.parseServerAuth)(credential, true));
|
|
@@ -222,16 +223,16 @@ function setCredential(item) {
|
|
|
222
223
|
if (config) {
|
|
223
224
|
const { min, max, idle, queue_idle } = config;
|
|
224
225
|
if (min >= 0) {
|
|
225
|
-
poolConfig.min
|
|
226
|
+
(_a = poolConfig.min) !== null && _a !== void 0 ? _a : (poolConfig.min = min);
|
|
226
227
|
}
|
|
227
228
|
if (max > 0) {
|
|
228
|
-
poolConfig.max
|
|
229
|
+
(_b = poolConfig.max) !== null && _b !== void 0 ? _b : (poolConfig.max = max);
|
|
229
230
|
}
|
|
230
231
|
if (idle >= 0) {
|
|
231
|
-
poolConfig.idleTimeout
|
|
232
|
+
(_c = poolConfig.idleTimeout) !== null && _c !== void 0 ? _c : (poolConfig.idleTimeout = idle);
|
|
232
233
|
}
|
|
233
234
|
if (queue_idle >= 0) {
|
|
234
|
-
poolConfig.acquireTimeout
|
|
235
|
+
(_d = poolConfig.acquireTimeout) !== null && _d !== void 0 ? _d : (poolConfig.acquireTimeout = queue_idle);
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
238
|
const poolKey = getPoolKey(credential);
|
|
@@ -247,6 +248,7 @@ async function executeQuery(item, options) {
|
|
|
247
248
|
}
|
|
248
249
|
exports.executeQuery = executeQuery;
|
|
249
250
|
async function executeBatchQuery(batch, options = '', outResult) {
|
|
251
|
+
var _a;
|
|
250
252
|
const length = batch.length;
|
|
251
253
|
if (length === 0) {
|
|
252
254
|
return [];
|
|
@@ -336,7 +338,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
336
338
|
item.transactionState &= ~64;
|
|
337
339
|
return client;
|
|
338
340
|
};
|
|
339
|
-
if (this.host
|
|
341
|
+
if ((_a = this.host) === null || _a === void 0 ? void 0 : _a.username) {
|
|
340
342
|
this.applyCommand(...batch);
|
|
341
343
|
}
|
|
342
344
|
for (let i = 0; i < length; ++i) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/mssql",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "MSSQL client driver for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"types": "client/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
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.
|
|
24
|
+
"@e-mc/db": "^0.8.8",
|
|
25
|
+
"@e-mc/types": "^0.8.8",
|
|
26
26
|
"tedious": "^16.7.1",
|
|
27
27
|
"tedious-connection-pool2": "^2.1.0"
|
|
28
28
|
}
|