applay-utils 1.8.14 → 1.8.16

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.
File without changes
package/.build/config CHANGED
File without changes
File without changes
File without changes
package/index.js CHANGED
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applay-utils",
3
- "version": "1.8.14",
3
+ "version": "1.8.16",
4
4
  "description": "Utilitary tools for Applay applications",
5
5
  "scripts": {
6
6
  "build": "npm version patch",
package/utils/crypto.js CHANGED
File without changes
package/utils/jwt.js CHANGED
File without changes
package/utils/logger.js CHANGED
@@ -17,20 +17,20 @@ var logger = (prefix, filelog, nivel) => {
17
17
  } else {
18
18
  return pinoCaller.info(msg)
19
19
  }
20
- },
21
- unhandledRejection: (reason, p) => {
22
- var errolist = reason.stack.toString().split('\n');
23
- // console.log(errolist);
24
- var position = errolist[1].replace(')', '').split(':').slice(1);
25
- var msg = `${errolist[0]}`;
26
- if (errolist[0].includes('evalmachine.<anonymous>')) {
27
- position = [errolist[0].split(':')[1], 1];
28
- msg = errolist[4] + '\n\n' + errolist[1] + '\n' + errolist[2]
29
- }
30
- var pinoCallerError = require('../libs-custom/pino-caller')(modLogger, { relativeTo: 'any', stackAdjustment: nivel || 1, prefix, position })
31
- process.removeListener('unhandledRejection', consoleFunc.unhandledRejection);
32
- return pinoCallerError.error(msg)
33
- }
20
+ }//,
21
+ // unhandledRejection: (reason, p) => {
22
+ // var errolist = reason.stack.toString().split('\n');
23
+ // // console.log(errolist);
24
+ // var position = errolist[1].replace(')', '').split(':').slice(1);
25
+ // var msg = `${errolist[0]}`;
26
+ // if (errolist[0].includes('evalmachine.<anonymous>')) {
27
+ // position = [errolist[0].split(':')[1], 1];
28
+ // msg = errolist[4] + '\n\n' + errolist[1] + '\n' + errolist[2]
29
+ // }
30
+ // var pinoCallerError = require('../libs-custom/pino-caller')(modLogger, { relativeTo: 'any', stackAdjustment: nivel || 1, prefix, position })
31
+ // process.removeListener('unhandledRejection', consoleFunc.unhandledRejection);
32
+ // return pinoCallerError.error(msg)
33
+ // }
34
34
  }
35
35
  return consoleFunc;
36
36
  };
package/utils/mdb.js CHANGED
@@ -8,20 +8,37 @@ var MDB = {
8
8
  }
9
9
 
10
10
  var connect = (alias, url, callback) => {
11
- // console.log('Conectando..', alias, ' - url:', url);
12
- if (MDB.status[alias]) { return callback(MDB.clients[alias]); }
13
- MongoBase.MongoClient.connect(url, { useUnifiedTopology: true }, (err, client) => {
11
+ if (MDB.status[url]) { return callback(MDB.clients[url]); }
12
+ console.log('===============>>>>>>> NOVO POOL DE CONEXÃO MDB ',url,alias)
13
+ let uriparams = `?appName=${url}&minPoolSize=2&maxPoolSize=10&maxIdleTimeMS=30000&serverSelectionTimeoutMS=5000`;
14
+ MongoBase.MongoClient.connect(url+uriparams, { useUnifiedTopology: true }, (err, client) => {
14
15
  if (err) { return console.log('ERRO MDB -- TRACKING -- ', err); }
15
- MDB.status[alias] = true;
16
- MDB.clients[alias] = client;
17
- process.on('SIGTERM', internalStop(alias, true, 'SIGTERM'));
18
- process.on('SIGINT', internalStop(alias, true, 'SIGINT'));
19
- process.on('uncaughtException', internalStop(alias, true, 'uncaughtException'));
16
+ MDB.status[url] = true;
17
+ MDB.clients[url] = client;
18
+ process.on('SIGTERM', internalStop(url, true, 'SIGTERM'));
19
+ process.on('SIGINT', internalStop(url, true, 'SIGINT'));
20
+ process.on('uncaughtException', internalStop(url, true, 'uncaughtException'));
20
21
  // console.log('Conectado com ', alias);
21
22
  callback(client)
22
23
  });
23
24
  }
24
25
 
26
+ // var connect = (alias, url, callback) => {
27
+ // if (MDB.status[alias]) { return callback(MDB.clients[alias]); }
28
+ // console.log('================================================>>>>>>> NOVO POOL DE CONEXÃO MDB ',alias, Object.keys(MDB.status).length)
29
+ // let uriparams = `?appName=${alias}&minPoolSize=10&maxPoolSize=100&maxIdleTimeMS=30000&serverSelectionTimeoutMS=5000`;
30
+ // MongoBase.MongoClient.connect(url+uriparams, { useUnifiedTopology: true }, (err, client) => {
31
+ // if (err) { return console.log('ERRO MDB -- TRACKING -- ', err); }
32
+ // MDB.status[alias] = true;
33
+ // MDB.clients[alias] = client;
34
+ // process.on('SIGTERM', internalStop(alias, true, 'SIGTERM'));
35
+ // process.on('SIGINT', internalStop(alias, true, 'SIGINT'));
36
+ // process.on('uncaughtException', internalStop(alias, true, 'uncaughtException'));
37
+ // // console.log('Conectado com ', alias);
38
+ // callback(client)
39
+ // });
40
+ // }
41
+
25
42
  var connectAsync = (alias, url) => new Promise(resolve => connect(alias, url, (client) => resolve(client)));
26
43
 
27
44
  var internalStop = (alias, finish) => {
@@ -197,7 +214,7 @@ function build(data, model, user) {
197
214
  // var objId = data[x1]._reg && data[x1]._reg.objId ? data[x1]._reg.objId : '';
198
215
  var objId = data[x1]._id ? data[x1]._id + '' : (data[x1]._reg && data[x1]._reg.objId ? data[x1]._reg.objId : '');
199
216
  data[x1]._reg = {
200
- regId: time.getTime() + user._id + '',
217
+ regId: user.regId|| time.getTime() + user._id + '',
201
218
  collection: model,
202
219
  objId: objId,
203
220
  reg: 'reg' + model.slice(0, 1).toUpperCase() + model.slice(1)
package/utils/querys.js CHANGED
@@ -16,7 +16,7 @@ var registerLogs = (db,collection,result,callback)=>{
16
16
  (size/1000/1000).toFixed(2)+'mb',
17
17
  size
18
18
  ]
19
- fs.appendFileSync("/home/arch/logs/mdb-size.csv",`\n${line.join(';')}` );
19
+ fs.appendFileSync(`/home/${process.env.USER}/logs/mdb-size.csv`,`\n${line.join(';')}` );
20
20
  }
21
21
 
22
22
  var querys = {
package/utils/sftp.js CHANGED
File without changes
package/utils/tools.js CHANGED
File without changes