@pi-r/mysql 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.
Files changed (2) hide show
  1. package/client/index.js +8 -7
  2. package/package.json +4 -4
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 = exports.setAuthentication = void 0;
4
3
  const main = require("mysql2");
5
4
  const mysql = require("mysql2/promise");
@@ -79,6 +78,7 @@ function setAuthentication(credential) {
79
78
  }
80
79
  exports.setAuthentication = setAuthentication;
81
80
  function setCredential(item) {
81
+ var _a, _b, _c, _d, _e;
82
82
  let credential = this.getCredential(item);
83
83
  if (credential) {
84
84
  setAuthentication.call(this, credential);
@@ -105,7 +105,7 @@ function setCredential(item) {
105
105
  }
106
106
  let username, password, pool;
107
107
  if ((0, types_1.isString)(usePool)) {
108
- if (username = credential.user || credential.uri && (0, util_1.parseConnectionString)(credential.uri)?.username) {
108
+ if (username = credential.user || credential.uri && ((_a = (0, util_1.parseConnectionString)(credential.uri)) === null || _a === void 0 ? void 0 : _a.username)) {
109
109
  [password, pool] = DbPool.validateKey(POOL_STATE, username, usePool);
110
110
  if (pool) {
111
111
  pool.add(item, password);
@@ -121,16 +121,16 @@ function setCredential(item) {
121
121
  if (config) {
122
122
  const { max, idle, queue_max, timeout } = config;
123
123
  if (max > 0) {
124
- credential.connectionLimit ?? (credential.connectionLimit = max);
124
+ (_b = credential.connectionLimit) !== null && _b !== void 0 ? _b : (credential.connectionLimit = max);
125
125
  }
126
126
  if (idle >= 0) {
127
- credential.idleTimeout ?? (credential.idleTimeout = idle);
127
+ (_c = credential.idleTimeout) !== null && _c !== void 0 ? _c : (credential.idleTimeout = idle);
128
128
  }
129
129
  if (queue_max >= 0) {
130
- credential.queueLimit ?? (credential.queueLimit = queue_max);
130
+ (_d = credential.queueLimit) !== null && _d !== void 0 ? _d : (credential.queueLimit = queue_max);
131
131
  }
132
132
  if (timeout > 0) {
133
- credential.connectTimeout ?? (credential.connectTimeout = timeout);
133
+ (_e = credential.connectTimeout) !== null && _e !== void 0 ? _e : (credential.connectTimeout = timeout);
134
134
  }
135
135
  }
136
136
  const poolKey = getPoolKey(credential);
@@ -146,6 +146,7 @@ async function executeQuery(item, options) {
146
146
  }
147
147
  exports.executeQuery = executeQuery;
148
148
  async function executeBatchQuery(batch, options = '', outResult) {
149
+ var _a;
149
150
  const length = batch.length;
150
151
  if (length === 0) {
151
152
  return [];
@@ -228,7 +229,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
228
229
  item.transactionState &= ~64;
229
230
  return client;
230
231
  };
231
- if (this.host?.username) {
232
+ if ((_a = this.host) === null || _a === void 0 ? void 0 : _a.username) {
232
233
  this.applyCommand(...batch);
233
234
  }
234
235
  for (let i = 0, mysql2Client, mysql2Credential; i < length; ++i) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/mysql",
3
- "version": "0.6.5",
3
+ "version": "0.6.7",
4
4
  "description": "MySQL 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.6",
25
- "@e-mc/types": "^0.8.6",
26
- "mysql2": "^3.9.2"
24
+ "@e-mc/db": "^0.8.8",
25
+ "@e-mc/types": "^0.8.8",
26
+ "mysql2": "^3.9.3"
27
27
  }
28
28
  }