@pxp-nd/core 1.2.2 → 1.2.5

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 (67) hide show
  1. package/README.md +1 -1
  2. package/dist/PxpApp.d.ts +54 -54
  3. package/dist/PxpApp.js +283 -283
  4. package/dist/ScriptManager.d.ts +1 -1
  5. package/dist/ScriptManager.js +130 -130
  6. package/dist/database/script.d.ts +16 -16
  7. package/dist/database/script.js +143 -143
  8. package/dist/db.datasource.d.ts +2 -2
  9. package/dist/db.datasource.js +86 -86
  10. package/dist/entities/Log.d.ts +32 -32
  11. package/dist/entities/Log.js +95 -95
  12. package/dist/entities/ScriptVersion.d.ts +19 -19
  13. package/dist/entities/ScriptVersion.js +43 -43
  14. package/dist/index.d.ts +11 -11
  15. package/dist/index.js +28 -28
  16. package/dist/interfaces.d.ts +49 -44
  17. package/dist/interfaces.js +3 -3
  18. package/dist/lib/pxp/Controller.d.ts +51 -51
  19. package/dist/lib/pxp/Controller.js +377 -371
  20. package/dist/lib/pxp/ControllerInterface.d.ts +18 -18
  21. package/dist/lib/pxp/ControllerInterface.js +2 -2
  22. package/dist/lib/pxp/Decorators.d.ts +23 -19
  23. package/dist/lib/pxp/Decorators.js +123 -125
  24. package/dist/lib/pxp/ListParamInterface.d.ts +23 -23
  25. package/dist/lib/pxp/ListParamInterface.js +2 -2
  26. package/dist/lib/pxp/PxpError.d.ts +24 -24
  27. package/dist/lib/pxp/PxpError.js +57 -57
  28. package/dist/lib/pxp/RouteDefinition.d.ts +26 -26
  29. package/dist/lib/pxp/RouteDefinition.js +26 -26
  30. package/dist/lib/pxp/index.d.ts +20 -20
  31. package/dist/lib/pxp/index.js +33 -33
  32. package/dist/lib/pxp/loadControllers.d.ts +4 -4
  33. package/dist/lib/pxp/loadControllers.js +89 -89
  34. package/dist/lib/pxp/middlewares/ParseParams.d.ts +4 -4
  35. package/dist/lib/pxp/middlewares/ParseParams.js +71 -71
  36. package/dist/lib/pxp/middlewares/isReportMiddleware.d.ts +2 -2
  37. package/dist/lib/pxp/middlewares/isReportMiddleware.js +13 -13
  38. package/dist/lib/pxp/utils/Security.d.ts +23 -23
  39. package/dist/lib/pxp/utils/Security.js +77 -77
  40. package/dist/lib/pxp/utils/crypto.d.ts +3 -3
  41. package/dist/lib/pxp/utils/crypto.js +15 -15
  42. package/dist/lib/reports/fonts/Roboto-Regular-normal.d.ts +2 -2
  43. package/dist/lib/reports/fonts/Roboto-Regular-normal.js +4 -4
  44. package/dist/lib/reports/generated.d.ts +4 -4
  45. package/dist/lib/reports/generated.js +200 -200
  46. package/dist/lib/reports/helper.d.ts +8 -8
  47. package/dist/lib/reports/helper.js +49 -49
  48. package/dist/lib/reports/pdf.d.ts +3 -3
  49. package/dist/lib/reports/pdf.js +119 -119
  50. package/dist/lib/reports/report-routes.d.ts +3 -3
  51. package/dist/lib/reports/report-routes.js +24 -24
  52. package/dist/lib/reports/xlsx.d.ts +1 -1
  53. package/dist/lib/reports/xlsx.js +65 -65
  54. package/dist/sockets/basic-sockets.d.ts +5 -5
  55. package/dist/sockets/basic-sockets.js +38 -38
  56. package/dist/sockets/entities/UserIo.d.ts +6 -6
  57. package/dist/sockets/entities/UserIo.js +30 -30
  58. package/dist/sockets/entities/index.d.ts +5 -5
  59. package/dist/sockets/entities/index.js +9 -9
  60. package/dist/sockets/index.d.ts +2 -2
  61. package/dist/sockets/index.js +19 -19
  62. package/dist/sockets/pxp-io-server.d.ts +6 -6
  63. package/dist/sockets/pxp-io-server.js +50 -50
  64. package/dist/swaggerOptions.d.ts +16 -16
  65. package/dist/swaggerOptions.js +20 -20
  66. package/package.json +65 -64
  67. package/yalc.lock +9 -9
@@ -1,77 +1,77 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.insertLog = exports.userHasPermission = void 0;
7
- /**
8
- * Kplian Ltda 2020
9
- *
10
- * MIT
11
- *
12
- * Common security functions
13
- *
14
- * @summary Common security functions.
15
- * @author Mercedes Zambrana
16
- *
17
- * Created at : 2020-06-13 18:09:48
18
- * Last modified : 2020-10-20 17:46:24
19
- */
20
- require("reflect-metadata");
21
- const typeorm_1 = require("typeorm");
22
- // import { Role } from '@pxp-nd/entities';
23
- const Log_1 = __importDefault(require("../../../entities/Log"));
24
- const userHasPermission = (Role) => async (userId, transaction) => {
25
- const user = await typeorm_1.getManager()
26
- .createQueryBuilder(Role, 'role')
27
- .innerJoinAndSelect('role.uis', 'ui')
28
- .innerJoin('role.users', 'user')
29
- .innerJoin('ui.transactions', 'uiTran')
30
- .innerJoin('uiTran.transaction', 'transac')
31
- .select('COUNT(*) AS count')
32
- .where('"user".user_id = :userId', { userId })
33
- .andWhere('transac.code= :codeTrans', { codeTrans: transaction })
34
- .getRawOne();
35
- return user.count === '0' ? false : true;
36
- };
37
- exports.userHasPermission = userHasPermission;
38
- const insertLog = async (username, macaddres, ip, logType, desc, proc, trans, query, req, resp, err, timeEx, logConfig) => {
39
- for (const [key, value] of Object.entries(logConfig)) {
40
- if (key in req) {
41
- if (!value) {
42
- delete req[key];
43
- }
44
- else if (value === 'cc_mask') {
45
- const aux = req[key];
46
- req[key] = '************' + aux.substr(-4);
47
- }
48
- else if (value === 'complete_mask') {
49
- const aux = req[key];
50
- req[key] = aux.replace(/./g, '*');
51
- }
52
- }
53
- }
54
- const log = new Log_1.default();
55
- log.username = username;
56
- log.macaddres = macaddres;
57
- log.ip = ip;
58
- log.logType = logType;
59
- log.description = desc;
60
- log.procedure = proc;
61
- log.transaction = trans;
62
- log.query = query;
63
- log.request = JSON.stringify(req);
64
- log.response = resp;
65
- log.execTime = timeEx;
66
- log.errorCode = err;
67
- log.shortRequest = JSON.stringify(req).substring(0, 150);
68
- log.shortResponse = resp.substring(0, 150);
69
- const logIds = await typeorm_1.getManager(process.env.DB_LOG_CONNECTION_NAME)
70
- .createQueryBuilder()
71
- .insert()
72
- .into(Log_1.default)
73
- .values([log])
74
- .execute();
75
- return logIds.identifiers[0].logId;
76
- };
77
- exports.insertLog = insertLog;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.insertLog = exports.userHasPermission = void 0;
7
+ /**
8
+ * Kplian Ltda 2020
9
+ *
10
+ * MIT
11
+ *
12
+ * Common security functions
13
+ *
14
+ * @summary Common security functions.
15
+ * @author Mercedes Zambrana
16
+ *
17
+ * Created at : 2020-06-13 18:09:48
18
+ * Last modified : 2020-10-20 17:46:24
19
+ */
20
+ require("reflect-metadata");
21
+ const typeorm_1 = require("typeorm");
22
+ // import { Role } from '@pxp-nd/entities';
23
+ const Log_1 = __importDefault(require("../../../entities/Log"));
24
+ const userHasPermission = (Role) => async (userId, transaction) => {
25
+ const user = await typeorm_1.getManager()
26
+ .createQueryBuilder(Role, 'role')
27
+ .innerJoinAndSelect('role.uis', 'ui')
28
+ .innerJoin('role.users', 'user')
29
+ .innerJoin('ui.transactions', 'uiTran')
30
+ .innerJoin('uiTran.transaction', 'transac')
31
+ .select('COUNT(*) AS count')
32
+ .where('"user".user_id = :userId', { userId })
33
+ .andWhere('transac.code= :codeTrans', { codeTrans: transaction })
34
+ .getRawOne();
35
+ return user.count === '0' ? false : true;
36
+ };
37
+ exports.userHasPermission = userHasPermission;
38
+ const insertLog = async (username, macaddres, ip, logType, desc, proc, trans, query, req, resp, err, timeEx, logConfig) => {
39
+ for (const [key, value] of Object.entries(logConfig)) {
40
+ if (key in req) {
41
+ if (!value) {
42
+ delete req[key];
43
+ }
44
+ else if (value === 'cc_mask') {
45
+ const aux = req[key];
46
+ req[key] = '************' + aux.substr(-4);
47
+ }
48
+ else if (value === 'complete_mask') {
49
+ const aux = req[key];
50
+ req[key] = aux.replace(/./g, '*');
51
+ }
52
+ }
53
+ }
54
+ const log = new Log_1.default();
55
+ log.username = username;
56
+ log.macaddres = macaddres;
57
+ log.ip = ip;
58
+ log.logType = logType;
59
+ log.description = desc;
60
+ log.procedure = proc;
61
+ log.transaction = trans;
62
+ log.query = query;
63
+ log.request = JSON.stringify(req);
64
+ log.response = resp;
65
+ log.execTime = timeEx;
66
+ log.errorCode = err;
67
+ log.shortRequest = JSON.stringify(req).substring(0, 150);
68
+ log.shortResponse = resp.substring(0, 150);
69
+ const logIds = await typeorm_1.getManager(process.env.DB_LOG_CONNECTION_NAME)
70
+ .createQueryBuilder()
71
+ .insert()
72
+ .into(Log_1.default)
73
+ .values([log])
74
+ .execute();
75
+ return logIds.identifiers[0].logId;
76
+ };
77
+ exports.insertLog = insertLog;
@@ -1,3 +1,3 @@
1
- declare const encode: (value: string) => string;
2
- declare const decode: (value: string) => string;
3
- export { encode, decode };
1
+ declare const encode: (value: string) => string;
2
+ declare const decode: (value: string) => string;
3
+ export { encode, decode };
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decode = exports.encode = void 0;
4
- const crypto_js_1 = require("crypto-js");
5
- const encode = (value) => {
6
- const ciphertext = crypto_js_1.AES.encrypt(value, String(process.env.SECRET)).toString();
7
- return ciphertext.replace(/\//g, '-PXP-');
8
- };
9
- exports.encode = encode;
10
- const decode = (value) => {
11
- value = value.replace(/-PXP-/g, '/');
12
- const bytes = crypto_js_1.AES.decrypt(value, String(process.env.SECRET));
13
- return bytes.toString(crypto_js_1.enc.Utf8);
14
- };
15
- exports.decode = decode;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decode = exports.encode = void 0;
4
+ const crypto_js_1 = require("crypto-js");
5
+ const encode = (value) => {
6
+ const ciphertext = crypto_js_1.AES.encrypt(value, String(process.env.SECRET)).toString();
7
+ return ciphertext.replace(/\//g, '-PXP-');
8
+ };
9
+ exports.encode = encode;
10
+ const decode = (value) => {
11
+ value = value.replace(/-PXP-/g, '/');
12
+ const bytes = crypto_js_1.AES.decrypt(value, String(process.env.SECRET));
13
+ return bytes.toString(crypto_js_1.enc.Utf8);
14
+ };
15
+ exports.decode = decode;