@pi-r/mssql 0.7.5 → 0.7.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/client/pool.js +0 -63
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/mssql",
3
- "version": "0.7.5",
3
+ "version": "0.7.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.9.18",
25
- "@e-mc/types": "^0.9.18",
24
+ "@e-mc/db": "^0.9.28",
25
+ "@e-mc/types": "^0.9.28",
26
26
  "tedious": "^16.7.1",
27
27
  "tedious-connection-pool2": "^2.1.0"
28
28
  }
package/client/pool.js DELETED
@@ -1,63 +0,0 @@
1
- "use strict";
2
- const types_1 = require("@e-mc/types");
3
- const util_1 = require("@e-mc/db/util");
4
- const DbPool = require('@e-mc/db/pool');
5
- class MSSQLPool extends DbPool {
6
- static asString(credential) {
7
- const auth = credential.authentication?.options;
8
- if (!credential.server || !(auth?.userName && auth.password)) {
9
- return super.asString(credential);
10
- }
11
- const options = credential.options;
12
- let tls;
13
- if (options && (tls = options.cryptoCredentialsDetails)) {
14
- if (!(0, types_1.isObject)(tls)) {
15
- delete options.cryptoCredentialsDetails;
16
- }
17
- else if (tls.ca || tls.cert || tls.key) {
18
- credential = { ...credential };
19
- if ('uuidKey' in credential) {
20
- delete credential.uuidKey;
21
- }
22
- credential.options = { ...options };
23
- delete credential.options.cryptoCredentialsDetails;
24
- return JSON.stringify(credential) + '_tls';
25
- }
26
- }
27
- if ('uuidKey' in credential) {
28
- credential = { ...credential };
29
- delete credential.uuidKey;
30
- }
31
- return JSON.stringify(credential);
32
- }
33
- async getConnection() {
34
- return new Promise((resolve, reject) => {
35
- this.client.acquire((err, connection) => {
36
- if (err) {
37
- reject(err);
38
- }
39
- else {
40
- resolve(connection);
41
- }
42
- });
43
- });
44
- }
45
- async close() {
46
- return new Promise((resolve, reject) => {
47
- try {
48
- this.client.drain();
49
- resolve();
50
- }
51
- catch (err) {
52
- reject(err);
53
- }
54
- });
55
- }
56
- isEmpty() {
57
- return this.closed || (0, util_1.checkEmpty)(this.client.connections) && (0, util_1.checkEmpty)(this.client.waiting);
58
- }
59
- get closed() {
60
- return !!this.client.drained;
61
- }
62
- }
63
- module.exports = MSSQLPool;