common-rod 1.7.1 → 1.7.3

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/index.js CHANGED
@@ -717,11 +717,17 @@ async function _connectMongodb(appRodSession, mongoConf){
717
717
  strLog = "host=" + hosts;
718
718
  connectionString = `mongodb://${auth}${hosts}/${mongoConf.db}`;
719
719
  }else{
720
- if(!mongoConf.port){
721
- mongoConf.port = "27017";
720
+ if(mongoConf.SRV === true){
721
+ connectionString = `mongodb+srv://${auth}${mongoConf.ip}/${mongoConf.db}`;
722
+ strLog = `SRV ip=${mongoConf.ip} port=${mongoConf.port}`;
723
+ }else{
724
+ if(!mongoConf.port){
725
+ mongoConf.port = "27017";
726
+ }
727
+ connectionString = `mongodb://${auth}${mongoConf.ip}:${mongoConf.port}/${mongoConf.db}`;
728
+ strLog = `ip=${mongoConf.ip} port=${mongoConf.port}`;
722
729
  }
723
- connectionString = `mongodb://${auth}${mongoConf.ip}:${mongoConf.port}/${mongoConf.db}`;
724
- strLog = `ip=${mongoConf.ip} port=${mongoConf.port}`;
730
+
725
731
  }
726
732
 
727
733
  let MongoClient = require('mongodb').MongoClient;
@@ -948,6 +954,7 @@ function handleErrorExpress(appRodSession, q) {
948
954
  //ROUTE AT MATCH ( URL NOT FOUND DEFAULT)
949
955
  app.use((req,res,next)=>{
950
956
  q.dq(req);
957
+ appRodSession.info( `URL NOT FOUND :: method=${req.method} url=${req.url} `);
951
958
  return res.status(403).send("URL NOT FOUND");
952
959
  });
953
960
 
@@ -224,8 +224,8 @@ function printLog(rodSession, ins, optionAttribute, response, autoAddDetail=true
224
224
  }
225
225
 
226
226
  let processLog = maskCredential.incoming_response_detail(optionAttribute._service+'.'+optionAttribute._command, {
227
- Body:data,
228
227
  Header:{...headers},
228
+ Body:data,
229
229
  _RawData: rawData
230
230
  });
231
231
  rawData = processLog._RawData;
@@ -100,7 +100,7 @@
100
100
  }
101
101
  }
102
102
  */
103
- var _ = require('lodash');
103
+ var _ = require('lodash');
104
104
  const utils = require('./utils');
105
105
 
106
106
  function readWithPath(path, obj, cb, currentPath=0){
@@ -189,7 +189,13 @@ let maskCredential = function () {
189
189
  // body = {
190
190
  // ...req.body
191
191
  // }
192
- body = JSON.parse(req.rodRawData);//DEEP COPY
192
+ //DEEP COPY
193
+ let ctype = utils.checkCType(req.get('Content-Type'));
194
+ if(ctype === 'json'){
195
+ body = JSON.parse(req.rodRawData);
196
+ }else{
197
+ body = JSON.parse(JSON.stringify(req.body));
198
+ }
193
199
  } else if (typeof req.body === 'string') {
194
200
  body = req.body;
195
201
  } else {
@@ -290,7 +296,14 @@ let maskCredential = function () {
290
296
  // body = {
291
297
  // ...req.body
292
298
  // }
293
- body = JSON.parse(rawData);//DEEP COPY
299
+ //DEEP COPY
300
+ let ctype = utils.checkCType(req.get('Content-Type'));
301
+ if(ctype === 'json'){
302
+ body = JSON.parse(req.rodRawData);
303
+ }else{
304
+ body = JSON.parse(JSON.stringify(req.body));
305
+ }
306
+
294
307
  } else if (typeof req.body === 'string') {
295
308
  body = req.body;
296
309
  // rawData = req.body;
@@ -278,6 +278,12 @@ function validateConType(conn_type, path, obj, name){
278
278
  "required_attr": false,
279
279
  "required_val": false,
280
280
  "type": "string"
281
+ },{
282
+ "config_path": `${path}.SRV`,
283
+ "array": false,
284
+ "required_attr": false,
285
+ "required_val": false,
286
+ "type": "boolean"
281
287
  }
282
288
  ]
283
289
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "common-rod",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -51,6 +51,7 @@
51
51
  "user":"$user",
52
52
  "pwd":"$pwd"
53
53
  },
54
+ "SRV": false , //optional true/false, default = false
54
55
  "max_retry": 0,
55
56
  "timeout": 4,
56
57
  "retry_condition": "CONNECTION_ERROR",
@@ -329,3 +330,22 @@ foo[0].bar[0]
329
330
  ```
330
331
  Fix bug hideCredenmtial with nested object
331
332
  ```
333
+
334
+ # [1.7.2] - 2022-10-03
335
+ ### Added
336
+ ### Changed
337
+ ### Fixed
338
+ ```
339
+ Fix bug hideCredenmtial with oher ctype
340
+ Fix DetailLog input response attribure Data
341
+ ```
342
+
343
+ # [1.7.3] - 2023-06-15
344
+ ### Added
345
+ ```
346
+ - Support mongo connecion with SRV option
347
+ - Add applog "URL NOT FOUND"
348
+ ```
349
+ ### Changed
350
+ ### Fixed
351
+