@ikonintegration/ikapi 3.0.17 → 3.0.20

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/ikapi",
3
- "version": "3.0.17",
3
+ "version": "3.0.20",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -37,8 +37,9 @@ export default class IKDB_DDB extends IKDB {
37
37
  // localConsole.debug("Starting remote database connection");
38
38
  //initialize connection
39
39
  this.connection = new DynamoDB({
40
- region: this.region,
40
+ region: this.region, maxAttempts: IKGlobals.DDBMaxAttempts,
41
41
  requestHandler: new NodeHttpHandler({
42
+ connectionTimeout: IKGlobals.DDBHttpTimeout, socketTimeout: IKGlobals.DDBHttpTimeout,
42
43
  httpsAgent: new Agent({ keepAlive: false, maxSockets: 50, rejectUnauthorized: true }),
43
44
  })
44
45
  });
@@ -34,7 +34,7 @@ export default class IKDBQueryGet extends IKDBBaseQuery {
34
34
  ...(this.limit > 0 ? { Limit: this.limit - (appendingItems ? appendingItems.length : 0) } : {}),
35
35
  ...(!this.scanIndexForward ? { ScanIndexForward: false } : {}),
36
36
  };
37
- localConsole.log('Querying: ', query, appendingItems.length);
37
+ localConsole.log('Querying: ', query, appendingItems ? appendingItems.length : null);
38
38
  const resp = await dbManager.connection.query(query);
39
39
  // localConsole.debug('Raw result: ', resp);
40
40
  return resp;
package/src/IKGlobals.js CHANGED
@@ -6,6 +6,9 @@ IKGlobals.DBDrivers = {
6
6
  IKGlobals.CacheDrivers = {
7
7
  REDIS: 'REDIS'
8
8
  };
9
+ //DDB Client
10
+ IKGlobals.DDBHttpTimeout = 15000;
11
+ IKGlobals.DDBMaxAttempts = 3;
9
12
  //Error messages
10
13
  IKGlobals.ErrorResponseValidationFail = 'Input validation failed: '; //400
11
14
  IKGlobals.ErrorResponseInvalidServerResponse = 'No valid response, this is a system error.'; //400
@@ -9,7 +9,7 @@ const LOG_STRINGS = ['DEBUG', 'INFO', 'WARN', 'ERROR'];
9
9
  const PURE_CONSOLE = (console.flushLogs ? console.origin : console);
10
10
  const DEFAULT_LOG_FUNCTION = PURE_CONSOLE.log.bind(PURE_CONSOLE);
11
11
  //
12
- const blacklist = ['password','phonenumber','code','resetCode','recaptchaToken','token','mfa','REFRESH_TOKEN','SECRET_HASH','SecretHash','AccessToken','UserCode','paymentMethodNonce'];
12
+ const blacklist = ['password','phonenumber'/*,'code'*/,'resetCode','recaptchaToken','token','mfa','REFRESH_TOKEN','SECRET_HASH','SecretHash','AccessToken','UserCode','paymentMethodNonce'];
13
13
  //
14
14
  export default class IKLogger {
15
15
  constructor(_config, _LOG_LEVEL, transactionID) {
@@ -81,7 +81,7 @@ export default class IKLogger {
81
81
  if (Utils.isOffline()) {
82
82
  return ` [${this._timestamp()} - ${LOG_STRINGS[level]}] [${caller}] ${msg.join(" ")}`;
83
83
  } else if (Utils.isHybridlessContainer() && this._transactionID) {
84
- return (isRaw ? '' : ` ${this._transactionID}`) + ` [${LOG_STRINGS[level]}] [${caller}] ${this._supressSensitiveInfo(msg.join(" "))}`;
84
+ return (isRaw ? '' : ` ${this._transactionID}`) + ` [${LOG_STRINGS[level]}] [${caller}] ${(msg.map(this._supressSensitiveInfo).join(" "))}`;
85
85
  } else {
86
86
  return ` [${LOG_STRINGS[level]}] [${caller}] ${msg.join(" ")}`;
87
87
  }
@@ -127,10 +127,10 @@ export default class IKLogger {
127
127
  Object.keys(value).forEach(function (elt, i, array) {
128
128
  const match = blacklist.find((f) => elt.toLowerCase().includes(f.toLowerCase()));
129
129
  if (match) value[elt] = '**SUPRESSED_SENSITIVE_DATA**';
130
- else value[elt] = supress(value[elt]);
130
+ else value[elt] = value[elt];
131
131
  });
132
132
  return value;
133
- } else if (Array.isArray(value)) return value.map(v=>supress(v));
133
+ } else if (Array.isArray(value)) return value.map(v=>this._supressSensitiveInfo(v));
134
134
  return value;
135
135
  }
136
136
  }