@ikonintegration/ikapi 3.0.3 → 3.0.6
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/package.json
CHANGED
package/src/Database/DDB/IKDB.js
CHANGED
|
@@ -21,12 +21,14 @@ export default class IKDB_DDB extends IKDB {
|
|
|
21
21
|
// if (config && this.tableName) { localConsole.debug(`Using table: ${this.tableName} on region: ${this.region}`); }
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async _getConnection() {
|
|
25
|
-
if ((!DDB_CONN && !DDB_CONN_HASH) || DDB_CONN_HASH != sha1(this.region)) DDB_CONN = await this._newConnection(this.config);
|
|
26
|
-
return DDB_CONN;
|
|
27
|
-
}
|
|
28
24
|
async connect() {
|
|
29
25
|
const localConsole = (this.transaction ? this.transaction.logger : console);
|
|
26
|
+
//Reusability logic
|
|
27
|
+
if (!((!DDB_CONN && !DDB_CONN_HASH) || DDB_CONN_HASH != sha1(this.region))) {
|
|
28
|
+
localConsole.debug("Reusing database connection");
|
|
29
|
+
this.connection = DDB_CONN;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
30
32
|
//setup db
|
|
31
33
|
if (Utils.isOffline()) {
|
|
32
34
|
localConsole.debug("Starting offline database connection");
|
package/src/Logger/IKLogger.js
CHANGED
|
@@ -15,14 +15,14 @@ export default class IKLogger {
|
|
|
15
15
|
constructor(_config, _LOG_LEVEL, transactionID) {
|
|
16
16
|
abind(this);
|
|
17
17
|
//
|
|
18
|
-
if (!_LOG_LEVEL) _LOG_LEVEL = LOG_LEVELS.DEBUG;
|
|
18
|
+
if (!_LOG_LEVEL && !(_config || {}).level) _LOG_LEVEL = LOG_LEVELS.DEBUG;
|
|
19
19
|
else {
|
|
20
|
-
_LOG_LEVEL = LOG_STRINGS.indexOf(_LOG_LEVEL);
|
|
20
|
+
_LOG_LEVEL = LOG_STRINGS.indexOf((_config || {}).level || _LOG_LEVEL);
|
|
21
21
|
if (_LOG_LEVEL == -1) _LOG_LEVEL = LOG_LEVELS.DEBUG;
|
|
22
22
|
}
|
|
23
23
|
//
|
|
24
24
|
this.origin = PURE_CONSOLE;
|
|
25
|
-
this._LOG_LEVEL =
|
|
25
|
+
this._LOG_LEVEL = _LOG_LEVEL;
|
|
26
26
|
this._config = _config || {};
|
|
27
27
|
this._transactionID = transactionID;
|
|
28
28
|
this._filterBlacklist = this._config.sensitiveFilteringKeywords || blacklist;
|
|
@@ -80,7 +80,7 @@ export default class IKLogger {
|
|
|
80
80
|
if (Utils.isOffline()) {
|
|
81
81
|
return ` [${this._timestamp()} - ${LOG_STRINGS[level]}] [${caller}] ${msg.join(" ")}`;
|
|
82
82
|
} else if (Utils.isIKAPIGateway() && this._transactionID) {
|
|
83
|
-
return (isRaw ? '' : ` ${this._transactionID}`) + ` [${LOG_STRINGS[level]}] [${caller}] ${msg.join(" ")}`;
|
|
83
|
+
return (isRaw ? '' : ` ${this._transactionID}`) + ` [${LOG_STRINGS[level]}] [${caller}] ${this._supressSensitiveInfo(msg.join(" "))}`;
|
|
84
84
|
} else {
|
|
85
85
|
return ` [${LOG_STRINGS[level]}] [${caller}] ${msg.join(" ")}`;
|
|
86
86
|
}
|
|
@@ -108,7 +108,7 @@ export default class IKLogger {
|
|
|
108
108
|
_pushLog(level, fMsg) {
|
|
109
109
|
// push into logs stack
|
|
110
110
|
// this._logs.push(fMsg);
|
|
111
|
-
DEFAULT_LOG_FUNCTION.apply(PURE_CONSOLE, [
|
|
111
|
+
DEFAULT_LOG_FUNCTION.apply(PURE_CONSOLE, [fMsg]);
|
|
112
112
|
}
|
|
113
113
|
/* Sensitive information handling */
|
|
114
114
|
_supressSensitiveInfo(value) {
|