@pi-r/mssql 0.3.2 → 0.3.4
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/client/index.js +7 -5
- package/package.json +3 -3
- package/types/index.d.ts +2 -0
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
package/client/index.js
CHANGED
|
@@ -111,7 +111,8 @@ function convertType(sql, type, value, options) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
function getPoolKey(credential) {
|
|
114
|
-
|
|
114
|
+
var _a;
|
|
115
|
+
const tls = (_a = credential.options) === null || _a === void 0 ? void 0 : _a.cryptoCredentialsDetails;
|
|
115
116
|
if (tls) {
|
|
116
117
|
if (!(0, types_1.isObject)(tls)) {
|
|
117
118
|
delete credential.options.cryptoCredentialsDetails;
|
|
@@ -129,6 +130,7 @@ function isOutputParameters(params) {
|
|
|
129
130
|
return (0, types_1.isPlainObject)(params) && Object.keys(params).length === 2 && 'input' in params && 'output' in params;
|
|
130
131
|
}
|
|
131
132
|
function setCredential(item) {
|
|
133
|
+
var _a, _b, _c, _d;
|
|
132
134
|
let credential = this.getCredential(item), hostname, username, password, port, database;
|
|
133
135
|
if (credential) {
|
|
134
136
|
({ username, password, hostname, port, database } = (0, util_1.parseServerAuth)(credential, true));
|
|
@@ -207,16 +209,16 @@ function setCredential(item) {
|
|
|
207
209
|
if (config) {
|
|
208
210
|
const { min, max, idle, queue_idle } = config;
|
|
209
211
|
if (min >= 0) {
|
|
210
|
-
poolConfig.min
|
|
212
|
+
(_a = poolConfig.min) !== null && _a !== void 0 ? _a : (poolConfig.min = min);
|
|
211
213
|
}
|
|
212
214
|
if (max > 0) {
|
|
213
|
-
poolConfig.max
|
|
215
|
+
(_b = poolConfig.max) !== null && _b !== void 0 ? _b : (poolConfig.max = max);
|
|
214
216
|
}
|
|
215
217
|
if (idle >= 0) {
|
|
216
|
-
poolConfig.idleTimeout
|
|
218
|
+
(_c = poolConfig.idleTimeout) !== null && _c !== void 0 ? _c : (poolConfig.idleTimeout = idle);
|
|
217
219
|
}
|
|
218
220
|
if (queue_idle >= 0) {
|
|
219
|
-
poolConfig.acquireTimeout
|
|
221
|
+
(_d = poolConfig.acquireTimeout) !== null && _d !== void 0 ? _d : (poolConfig.acquireTimeout = queue_idle);
|
|
220
222
|
}
|
|
221
223
|
}
|
|
222
224
|
new MSSQLPool(new TediousPool(poolConfig, credential), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/mssql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
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.6.
|
|
25
|
-
"@e-mc/types": "^0.6.
|
|
24
|
+
"@e-mc/db": "^0.6.3",
|
|
25
|
+
"@e-mc/types": "^0.6.3",
|
|
26
26
|
"tedious": "^16.7.1",
|
|
27
27
|
"tedious-connection-pool2": "^2.1.0"
|
|
28
28
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { DbDataSource } from '@e-mc/types/lib/squared';
|
|
|
2
2
|
|
|
3
3
|
import type { ExecuteAction, ServerAuth } from '@e-mc/types/lib/db';
|
|
4
4
|
|
|
5
|
+
// @ts-ignore
|
|
5
6
|
import type { ConnectionConfig, ParameterOptions, TediousType, TediousTypes } from 'tedious';
|
|
7
|
+
// @ts-ignore
|
|
6
8
|
import type { PoolConfig } from 'tedious-connection-pool';
|
|
7
9
|
|
|
8
10
|
export interface MSSQLDataSource extends DbDataSource<string, unknown, unknown, string | MSSQLCredential, string | PoolConfig>, ExecuteAction<MSSQLRequestParameters | MSSQLRequestWithOutputParameters> {
|