@pxp-nd/core 1.2.74 → 1.2.75
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/README.md +1 -1
- package/dist/PxpApp.d.ts +54 -54
- package/dist/PxpApp.js +283 -284
- package/dist/ScriptManager.d.ts +1 -1
- package/dist/ScriptManager.js +130 -130
- package/dist/database/script.d.ts +16 -16
- package/dist/database/script.js +143 -143
- package/dist/db.datasource.d.ts +2 -2
- package/dist/db.datasource.js +86 -86
- package/dist/entities/Log.d.ts +32 -32
- package/dist/entities/Log.js +95 -95
- package/dist/entities/ScriptVersion.d.ts +19 -19
- package/dist/entities/ScriptVersion.js +43 -43
- package/dist/index.d.ts +11 -11
- package/dist/index.js +28 -28
- package/dist/interfaces.d.ts +49 -49
- package/dist/interfaces.js +3 -3
- package/dist/lib/pxp/Controller.d.ts +51 -51
- package/dist/lib/pxp/Controller.js +377 -377
- package/dist/lib/pxp/ControllerInterface.d.ts +18 -18
- package/dist/lib/pxp/ControllerInterface.js +2 -2
- package/dist/lib/pxp/Decorators.d.ts +23 -23
- package/dist/lib/pxp/Decorators.js +123 -123
- package/dist/lib/pxp/ListParamInterface.d.ts +23 -23
- package/dist/lib/pxp/ListParamInterface.js +2 -2
- package/dist/lib/pxp/PxpError.d.ts +24 -24
- package/dist/lib/pxp/PxpError.js +57 -57
- package/dist/lib/pxp/RouteDefinition.d.ts +26 -26
- package/dist/lib/pxp/RouteDefinition.js +26 -26
- package/dist/lib/pxp/index.d.ts +20 -20
- package/dist/lib/pxp/index.js +33 -33
- package/dist/lib/pxp/loadControllers.d.ts +4 -4
- package/dist/lib/pxp/loadControllers.js +89 -89
- package/dist/lib/pxp/middlewares/ParseParams.d.ts +4 -4
- package/dist/lib/pxp/middlewares/ParseParams.js +71 -71
- package/dist/lib/pxp/middlewares/isReportMiddleware.d.ts +2 -2
- package/dist/lib/pxp/middlewares/isReportMiddleware.js +13 -13
- package/dist/lib/pxp/utils/Security.d.ts +23 -23
- package/dist/lib/pxp/utils/Security.js +79 -77
- package/dist/lib/pxp/utils/crypto.d.ts +3 -3
- package/dist/lib/pxp/utils/crypto.js +15 -15
- package/dist/lib/reports/fonts/Roboto-Regular-normal.d.ts +2 -2
- package/dist/lib/reports/fonts/Roboto-Regular-normal.js +4 -4
- package/dist/lib/reports/generated.d.ts +4 -4
- package/dist/lib/reports/generated.js +200 -200
- package/dist/lib/reports/helper.d.ts +8 -8
- package/dist/lib/reports/helper.js +49 -49
- package/dist/lib/reports/pdf.d.ts +3 -3
- package/dist/lib/reports/pdf.js +119 -119
- package/dist/lib/reports/report-routes.d.ts +3 -3
- package/dist/lib/reports/report-routes.js +24 -24
- package/dist/lib/reports/xlsx.d.ts +1 -1
- package/dist/lib/reports/xlsx.js +65 -65
- package/dist/sockets/basic-sockets.d.ts +5 -5
- package/dist/sockets/basic-sockets.js +38 -38
- package/dist/sockets/entities/UserIo.d.ts +6 -6
- package/dist/sockets/entities/UserIo.js +30 -30
- package/dist/sockets/entities/index.d.ts +5 -5
- package/dist/sockets/entities/index.js +9 -9
- package/dist/sockets/index.d.ts +2 -2
- package/dist/sockets/index.js +19 -19
- package/dist/sockets/pxp-io-server.d.ts +6 -6
- package/dist/sockets/pxp-io-server.js +50 -50
- package/dist/swaggerOptions.d.ts +16 -16
- package/dist/swaggerOptions.js +20 -20
- package/package.json +65 -65
- package/yalc.lock +9 -9
|
@@ -1,77 +1,79 @@
|
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
log
|
|
57
|
-
log.
|
|
58
|
-
log.
|
|
59
|
-
log.
|
|
60
|
-
log.
|
|
61
|
-
log.
|
|
62
|
-
log.
|
|
63
|
-
log.
|
|
64
|
-
log.
|
|
65
|
-
log.
|
|
66
|
-
log.
|
|
67
|
-
log.
|
|
68
|
-
log.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.
|
|
73
|
-
.
|
|
74
|
-
.
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
if (logConfig) {
|
|
40
|
+
for (const [key, value] of Object.entries(logConfig)) {
|
|
41
|
+
if (key in req) {
|
|
42
|
+
if (!value) {
|
|
43
|
+
delete req[key];
|
|
44
|
+
}
|
|
45
|
+
else if (value === 'cc_mask') {
|
|
46
|
+
const aux = req[key];
|
|
47
|
+
req[key] = '************' + aux.substr(-4);
|
|
48
|
+
}
|
|
49
|
+
else if (value === 'complete_mask') {
|
|
50
|
+
const aux = req[key];
|
|
51
|
+
req[key] = aux.replace(/./g, '*');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const log = new Log_1.default();
|
|
57
|
+
log.username = username;
|
|
58
|
+
log.macaddres = macaddres;
|
|
59
|
+
log.ip = ip;
|
|
60
|
+
log.logType = logType;
|
|
61
|
+
log.description = desc;
|
|
62
|
+
log.procedure = proc;
|
|
63
|
+
log.transaction = trans;
|
|
64
|
+
log.query = query;
|
|
65
|
+
log.request = JSON.stringify(req);
|
|
66
|
+
log.response = resp;
|
|
67
|
+
log.execTime = timeEx;
|
|
68
|
+
log.errorCode = err;
|
|
69
|
+
log.shortRequest = JSON.stringify(req).substring(0, 150);
|
|
70
|
+
log.shortResponse = resp.substring(0, 150);
|
|
71
|
+
const logIds = await typeorm_1.getManager(process.env.DB_LOG_CONNECTION_NAME)
|
|
72
|
+
.createQueryBuilder()
|
|
73
|
+
.insert()
|
|
74
|
+
.into(Log_1.default)
|
|
75
|
+
.values([log])
|
|
76
|
+
.execute();
|
|
77
|
+
return logIds.identifiers[0].logId;
|
|
78
|
+
};
|
|
79
|
+
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;
|