@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,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Kplian Ltda 2020
|
|
4
|
-
*
|
|
5
|
-
* MIT
|
|
6
|
-
*
|
|
7
|
-
* Route definition interface
|
|
8
|
-
*
|
|
9
|
-
* @summary Route definition interface
|
|
10
|
-
* @author Jaime Rivera
|
|
11
|
-
*
|
|
12
|
-
* Created at : 2020-06-13 18:09:48
|
|
13
|
-
* Last modified : 2020-09-17 18:13:52
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.Method = void 0;
|
|
17
|
-
var Method;
|
|
18
|
-
(function (Method) {
|
|
19
|
-
Method["get"] = "get";
|
|
20
|
-
Method["post"] = "post";
|
|
21
|
-
Method["delete"] = "delete";
|
|
22
|
-
Method["options"] = "options";
|
|
23
|
-
Method["put"] = "put";
|
|
24
|
-
Method["patch"] = "patch";
|
|
25
|
-
})(Method = exports.Method || (exports.Method = {}));
|
|
26
|
-
;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Kplian Ltda 2020
|
|
4
|
+
*
|
|
5
|
+
* MIT
|
|
6
|
+
*
|
|
7
|
+
* Route definition interface
|
|
8
|
+
*
|
|
9
|
+
* @summary Route definition interface
|
|
10
|
+
* @author Jaime Rivera
|
|
11
|
+
*
|
|
12
|
+
* Created at : 2020-06-13 18:09:48
|
|
13
|
+
* Last modified : 2020-09-17 18:13:52
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Method = void 0;
|
|
17
|
+
var Method;
|
|
18
|
+
(function (Method) {
|
|
19
|
+
Method["get"] = "get";
|
|
20
|
+
Method["post"] = "post";
|
|
21
|
+
Method["delete"] = "delete";
|
|
22
|
+
Method["options"] = "options";
|
|
23
|
+
Method["put"] = "put";
|
|
24
|
+
Method["patch"] = "patch";
|
|
25
|
+
})(Method = exports.Method || (exports.Method = {}));
|
|
26
|
+
;
|
package/dist/lib/pxp/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kplian Ltda 2020
|
|
3
|
-
*
|
|
4
|
-
* MIT
|
|
5
|
-
*
|
|
6
|
-
* Index organization file.
|
|
7
|
-
*
|
|
8
|
-
* @summary Index organization file.
|
|
9
|
-
* @author Jaime Rivera
|
|
10
|
-
*
|
|
11
|
-
* Created at : 2020-06-13 18:09:48
|
|
12
|
-
* Last modified : 2020-09-17 19:15:51
|
|
13
|
-
*/
|
|
14
|
-
export { Controller } from './Controller';
|
|
15
|
-
export type { ControllerInterface } from './ControllerInterface';
|
|
16
|
-
export * from './Decorators';
|
|
17
|
-
export type { ListParam } from './ListParamInterface';
|
|
18
|
-
export * from './PxpError';
|
|
19
|
-
export * from './RouteDefinition';
|
|
20
|
-
export * from './utils/Security';
|
|
1
|
+
/**
|
|
2
|
+
* Kplian Ltda 2020
|
|
3
|
+
*
|
|
4
|
+
* MIT
|
|
5
|
+
*
|
|
6
|
+
* Index organization file.
|
|
7
|
+
*
|
|
8
|
+
* @summary Index organization file.
|
|
9
|
+
* @author Jaime Rivera
|
|
10
|
+
*
|
|
11
|
+
* Created at : 2020-06-13 18:09:48
|
|
12
|
+
* Last modified : 2020-09-17 19:15:51
|
|
13
|
+
*/
|
|
14
|
+
export { Controller } from './Controller';
|
|
15
|
+
export type { ControllerInterface } from './ControllerInterface';
|
|
16
|
+
export * from './Decorators';
|
|
17
|
+
export type { ListParam } from './ListParamInterface';
|
|
18
|
+
export * from './PxpError';
|
|
19
|
+
export * from './RouteDefinition';
|
|
20
|
+
export * from './utils/Security';
|
package/dist/lib/pxp/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.Controller = void 0;
|
|
14
|
-
/**
|
|
15
|
-
* Kplian Ltda 2020
|
|
16
|
-
*
|
|
17
|
-
* MIT
|
|
18
|
-
*
|
|
19
|
-
* Index organization file.
|
|
20
|
-
*
|
|
21
|
-
* @summary Index organization file.
|
|
22
|
-
* @author Jaime Rivera
|
|
23
|
-
*
|
|
24
|
-
* Created at : 2020-06-13 18:09:48
|
|
25
|
-
* Last modified : 2020-09-17 19:15:51
|
|
26
|
-
*/
|
|
27
|
-
// export { PxpEntity } from './PxpEntity';
|
|
28
|
-
var Controller_1 = require("./Controller");
|
|
29
|
-
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return Controller_1.Controller; } });
|
|
30
|
-
__exportStar(require("./Decorators"), exports);
|
|
31
|
-
__exportStar(require("./PxpError"), exports);
|
|
32
|
-
__exportStar(require("./RouteDefinition"), exports);
|
|
33
|
-
__exportStar(require("./utils/Security"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Controller = void 0;
|
|
14
|
+
/**
|
|
15
|
+
* Kplian Ltda 2020
|
|
16
|
+
*
|
|
17
|
+
* MIT
|
|
18
|
+
*
|
|
19
|
+
* Index organization file.
|
|
20
|
+
*
|
|
21
|
+
* @summary Index organization file.
|
|
22
|
+
* @author Jaime Rivera
|
|
23
|
+
*
|
|
24
|
+
* Created at : 2020-06-13 18:09:48
|
|
25
|
+
* Last modified : 2020-09-17 19:15:51
|
|
26
|
+
*/
|
|
27
|
+
// export { PxpEntity } from './PxpEntity';
|
|
28
|
+
var Controller_1 = require("./Controller");
|
|
29
|
+
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return Controller_1.Controller; } });
|
|
30
|
+
__exportStar(require("./Decorators"), exports);
|
|
31
|
+
__exportStar(require("./PxpError"), exports);
|
|
32
|
+
__exportStar(require("./RouteDefinition"), exports);
|
|
33
|
+
__exportStar(require("./utils/Security"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ControllerInterface as Controller } from './index';
|
|
2
|
-
import { IConfigPxpApp } from '../../interfaces';
|
|
3
|
-
declare const _default: (config: IConfigPxpApp, io: any) => Promise<Controller[]>;
|
|
4
|
-
export default _default;
|
|
1
|
+
import { ControllerInterface as Controller } from './index';
|
|
2
|
+
import { IConfigPxpApp } from '../../interfaces';
|
|
3
|
+
declare const _default: (config: IConfigPxpApp, io: any) => Promise<Controller[]>;
|
|
4
|
+
export default _default;
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
/**
|
|
26
|
-
* Kplian Ltda 2020
|
|
27
|
-
*
|
|
28
|
-
* MIT
|
|
29
|
-
*
|
|
30
|
-
* Automatically load all controllers
|
|
31
|
-
*
|
|
32
|
-
* @summary Automatically load all controllers
|
|
33
|
-
* @author Jaime Rivera
|
|
34
|
-
*
|
|
35
|
-
* Created at : 2020-06-13 18:09:48
|
|
36
|
-
* Last modified : 2020-10-04 19:04:18
|
|
37
|
-
*/
|
|
38
|
-
const fs_1 = __importDefault(require("fs"));
|
|
39
|
-
const util_1 = __importDefault(require("util"));
|
|
40
|
-
const path_1 = __importDefault(require("path"));
|
|
41
|
-
// import * as controllers from '../../controllers';
|
|
42
|
-
const readdir = util_1.default.promisify(fs_1.default.readdir);
|
|
43
|
-
const loadPxpControllers = (config, io) => {
|
|
44
|
-
const controllers = [];
|
|
45
|
-
if (config.modules) {
|
|
46
|
-
const modules = Object.keys(config.modules);
|
|
47
|
-
modules.forEach((name) => {
|
|
48
|
-
const module = config.modules[name];
|
|
49
|
-
const modControllers = module.controllers ? module.controllers : [];
|
|
50
|
-
modControllers.forEach((ctrl) => controllers.push(new ctrl(name, null, config, io)));
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
// const pxpControllers: any = controllers;
|
|
54
|
-
return controllers;
|
|
55
|
-
// return Object.keys(controllers).map((key: any) => new controllers[key]('pxp', config));
|
|
56
|
-
};
|
|
57
|
-
exports.default = async (config, io) => {
|
|
58
|
-
// const modulesPath = `${__dirname}/../../modules`;
|
|
59
|
-
const modulesPath = path_1.default.join(process.cwd(), `/dist/modules`);
|
|
60
|
-
let modules = [];
|
|
61
|
-
const controllers = loadPxpControllers(config, io);
|
|
62
|
-
let controllerFiles = [];
|
|
63
|
-
let auxFiles = [];
|
|
64
|
-
try {
|
|
65
|
-
modules = await readdir(modulesPath);
|
|
66
|
-
for (const module of modules) {
|
|
67
|
-
const files = await readdir(modulesPath + '/' + module + '/controllers');
|
|
68
|
-
// this adds javascript files not ts
|
|
69
|
-
auxFiles = files.reduce((result, j) => {
|
|
70
|
-
if (!j.includes('.map') && j.includes('.js')) {
|
|
71
|
-
result.push({
|
|
72
|
-
url: modulesPath + '/' + module + '/controllers/' + j,
|
|
73
|
-
module
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}, []);
|
|
78
|
-
controllerFiles = [...controllerFiles, ...auxFiles];
|
|
79
|
-
}
|
|
80
|
-
for (const controllerFile of controllerFiles) {
|
|
81
|
-
const ControllerClass = await Promise.resolve().then(() => __importStar(require(controllerFile.url)));
|
|
82
|
-
controllers.push(new ControllerClass.default(controllerFile.module, null, config, io));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
console.log(err);
|
|
87
|
-
}
|
|
88
|
-
return controllers;
|
|
89
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
/**
|
|
26
|
+
* Kplian Ltda 2020
|
|
27
|
+
*
|
|
28
|
+
* MIT
|
|
29
|
+
*
|
|
30
|
+
* Automatically load all controllers
|
|
31
|
+
*
|
|
32
|
+
* @summary Automatically load all controllers
|
|
33
|
+
* @author Jaime Rivera
|
|
34
|
+
*
|
|
35
|
+
* Created at : 2020-06-13 18:09:48
|
|
36
|
+
* Last modified : 2020-10-04 19:04:18
|
|
37
|
+
*/
|
|
38
|
+
const fs_1 = __importDefault(require("fs"));
|
|
39
|
+
const util_1 = __importDefault(require("util"));
|
|
40
|
+
const path_1 = __importDefault(require("path"));
|
|
41
|
+
// import * as controllers from '../../controllers';
|
|
42
|
+
const readdir = util_1.default.promisify(fs_1.default.readdir);
|
|
43
|
+
const loadPxpControllers = (config, io) => {
|
|
44
|
+
const controllers = [];
|
|
45
|
+
if (config.modules) {
|
|
46
|
+
const modules = Object.keys(config.modules);
|
|
47
|
+
modules.forEach((name) => {
|
|
48
|
+
const module = config.modules[name];
|
|
49
|
+
const modControllers = module.controllers ? module.controllers : [];
|
|
50
|
+
modControllers.forEach((ctrl) => controllers.push(new ctrl(name, null, config, io)));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// const pxpControllers: any = controllers;
|
|
54
|
+
return controllers;
|
|
55
|
+
// return Object.keys(controllers).map((key: any) => new controllers[key]('pxp', config));
|
|
56
|
+
};
|
|
57
|
+
exports.default = async (config, io) => {
|
|
58
|
+
// const modulesPath = `${__dirname}/../../modules`;
|
|
59
|
+
const modulesPath = path_1.default.join(process.cwd(), `/dist/modules`);
|
|
60
|
+
let modules = [];
|
|
61
|
+
const controllers = loadPxpControllers(config, io);
|
|
62
|
+
let controllerFiles = [];
|
|
63
|
+
let auxFiles = [];
|
|
64
|
+
try {
|
|
65
|
+
modules = await readdir(modulesPath);
|
|
66
|
+
for (const module of modules) {
|
|
67
|
+
const files = await readdir(modulesPath + '/' + module + '/controllers');
|
|
68
|
+
// this adds javascript files not ts
|
|
69
|
+
auxFiles = files.reduce((result, j) => {
|
|
70
|
+
if (!j.includes('.map') && j.includes('.js')) {
|
|
71
|
+
result.push({
|
|
72
|
+
url: modulesPath + '/' + module + '/controllers/' + j,
|
|
73
|
+
module
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}, []);
|
|
78
|
+
controllerFiles = [...controllerFiles, ...auxFiles];
|
|
79
|
+
}
|
|
80
|
+
for (const controllerFile of controllerFiles) {
|
|
81
|
+
const ControllerClass = await Promise.resolve().then(() => __importStar(require(controllerFile.url)));
|
|
82
|
+
controllers.push(new ControllerClass.default(controllerFile.module, null, config, io));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
console.log(err);
|
|
87
|
+
}
|
|
88
|
+
return controllers;
|
|
89
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NextFunction, Response } from 'express';
|
|
2
|
-
import { ListParam } from '../ListParamInterface';
|
|
3
|
-
export declare const getListParams: (params: Record<string, any>) => ListParam;
|
|
4
|
-
export declare const parseParams: (req: any, res: Response, next: NextFunction) => void;
|
|
1
|
+
import { NextFunction, Response } from 'express';
|
|
2
|
+
import { ListParam } from '../ListParamInterface';
|
|
3
|
+
export declare const getListParams: (params: Record<string, any>) => ListParam;
|
|
4
|
+
export declare const parseParams: (req: any, res: Response, next: NextFunction) => void;
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseParams = exports.getListParams = void 0;
|
|
4
|
-
const typeorm_1 = require("typeorm");
|
|
5
|
-
const getListParams = (params) => {
|
|
6
|
-
const newParams = {};
|
|
7
|
-
Object.keys(params).map((key) => {
|
|
8
|
-
if (key === 'start') {
|
|
9
|
-
newParams.skip = JSON.parse(params[key]);
|
|
10
|
-
// delete params[key];
|
|
11
|
-
}
|
|
12
|
-
else if (key === 'limit') {
|
|
13
|
-
newParams.take = JSON.parse(params[key]);
|
|
14
|
-
// delete params[key];
|
|
15
|
-
}
|
|
16
|
-
else if (key === 'sort') {
|
|
17
|
-
newParams.order = {
|
|
18
|
-
[String(params.sort).replace(/\"/g, '')]: String(params.dir).replace(/\"/g, '').toUpperCase() || 'ASC'
|
|
19
|
-
};
|
|
20
|
-
// delete params[key];
|
|
21
|
-
// delete params['dir'];
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
newParams[key] = params[key];
|
|
25
|
-
// params[key] = JSON.parse(params[key])
|
|
26
|
-
}
|
|
27
|
-
;
|
|
28
|
-
});
|
|
29
|
-
const res = Object.assign({}, newParams);
|
|
30
|
-
if (params.genericFilterFields) {
|
|
31
|
-
res.where = [];
|
|
32
|
-
const genericFilterFields = params.genericFilterFields;
|
|
33
|
-
const filterFieldsArray = genericFilterFields.split('#');
|
|
34
|
-
filterFieldsArray.forEach((field) => {
|
|
35
|
-
// res.where = {
|
|
36
|
-
// ...res.where,
|
|
37
|
-
// [field]:
|
|
38
|
-
// Like('%' + (params.genericFilterValue as string) + '%')
|
|
39
|
-
// }
|
|
40
|
-
if (res.where) {
|
|
41
|
-
res.where.push({
|
|
42
|
-
[field]: typeorm_1.ILike('%' + String(params.genericFilterValue) + '%')
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
res.filterValue = res['genericFilterValue'];
|
|
47
|
-
// delete res['genericFilterFields'];
|
|
48
|
-
delete res['genericFilterValue'];
|
|
49
|
-
}
|
|
50
|
-
return res;
|
|
51
|
-
};
|
|
52
|
-
exports.getListParams = getListParams;
|
|
53
|
-
const parseParams = (req, res, next) => {
|
|
54
|
-
// default values
|
|
55
|
-
let defaultValues = {};
|
|
56
|
-
// if(req.method !== 'GET') {
|
|
57
|
-
// defaultValues = {
|
|
58
|
-
// isActive: true,
|
|
59
|
-
// createdBy: req.user.username || ' ',
|
|
60
|
-
// };
|
|
61
|
-
// }
|
|
62
|
-
// default values
|
|
63
|
-
// const defaultValues = {
|
|
64
|
-
// // isActive: true,
|
|
65
|
-
// // createdBy: req.user.username || ' ',
|
|
66
|
-
// };
|
|
67
|
-
req.pxpParams = Object.assign(Object.assign(Object.assign(Object.assign({}, exports.getListParams(req.query)), req.body), req.params), defaultValues);
|
|
68
|
-
req.paramasMerge = Object.assign(Object.assign(Object.assign({}, req.query), req.body), req.params);
|
|
69
|
-
next();
|
|
70
|
-
};
|
|
71
|
-
exports.parseParams = parseParams;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseParams = exports.getListParams = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const getListParams = (params) => {
|
|
6
|
+
const newParams = {};
|
|
7
|
+
Object.keys(params).map((key) => {
|
|
8
|
+
if (key === 'start') {
|
|
9
|
+
newParams.skip = JSON.parse(params[key]);
|
|
10
|
+
// delete params[key];
|
|
11
|
+
}
|
|
12
|
+
else if (key === 'limit') {
|
|
13
|
+
newParams.take = JSON.parse(params[key]);
|
|
14
|
+
// delete params[key];
|
|
15
|
+
}
|
|
16
|
+
else if (key === 'sort') {
|
|
17
|
+
newParams.order = {
|
|
18
|
+
[String(params.sort).replace(/\"/g, '')]: String(params.dir).replace(/\"/g, '').toUpperCase() || 'ASC'
|
|
19
|
+
};
|
|
20
|
+
// delete params[key];
|
|
21
|
+
// delete params['dir'];
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
newParams[key] = params[key];
|
|
25
|
+
// params[key] = JSON.parse(params[key])
|
|
26
|
+
}
|
|
27
|
+
;
|
|
28
|
+
});
|
|
29
|
+
const res = Object.assign({}, newParams);
|
|
30
|
+
if (params.genericFilterFields) {
|
|
31
|
+
res.where = [];
|
|
32
|
+
const genericFilterFields = params.genericFilterFields;
|
|
33
|
+
const filterFieldsArray = genericFilterFields.split('#');
|
|
34
|
+
filterFieldsArray.forEach((field) => {
|
|
35
|
+
// res.where = {
|
|
36
|
+
// ...res.where,
|
|
37
|
+
// [field]:
|
|
38
|
+
// Like('%' + (params.genericFilterValue as string) + '%')
|
|
39
|
+
// }
|
|
40
|
+
if (res.where) {
|
|
41
|
+
res.where.push({
|
|
42
|
+
[field]: typeorm_1.ILike('%' + String(params.genericFilterValue) + '%')
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
res.filterValue = res['genericFilterValue'];
|
|
47
|
+
// delete res['genericFilterFields'];
|
|
48
|
+
delete res['genericFilterValue'];
|
|
49
|
+
}
|
|
50
|
+
return res;
|
|
51
|
+
};
|
|
52
|
+
exports.getListParams = getListParams;
|
|
53
|
+
const parseParams = (req, res, next) => {
|
|
54
|
+
// default values
|
|
55
|
+
let defaultValues = {};
|
|
56
|
+
// if(req.method !== 'GET') {
|
|
57
|
+
// defaultValues = {
|
|
58
|
+
// isActive: true,
|
|
59
|
+
// createdBy: req.user.username || ' ',
|
|
60
|
+
// };
|
|
61
|
+
// }
|
|
62
|
+
// default values
|
|
63
|
+
// const defaultValues = {
|
|
64
|
+
// // isActive: true,
|
|
65
|
+
// // createdBy: req.user.username || ' ',
|
|
66
|
+
// };
|
|
67
|
+
req.pxpParams = Object.assign(Object.assign(Object.assign(Object.assign({}, exports.getListParams(req.query)), req.body), req.params), defaultValues);
|
|
68
|
+
req.paramasMerge = Object.assign(Object.assign(Object.assign({}, req.query), req.body), req.params);
|
|
69
|
+
next();
|
|
70
|
+
};
|
|
71
|
+
exports.parseParams = parseParams;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NextFunction, Response } from 'express';
|
|
2
|
-
export declare const isReportMiddleware: (req: any, res: Response, next: NextFunction) => void;
|
|
1
|
+
import { NextFunction, Response } from 'express';
|
|
2
|
+
export declare const isReportMiddleware: (req: any, res: Response, next: NextFunction) => void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isReportMiddleware = void 0;
|
|
4
|
-
const isReportMiddleware = (req, res, next) => {
|
|
5
|
-
if (req.query.report) {
|
|
6
|
-
delete req.query.start; //TODO 20211011: change for spread operator instead of delete
|
|
7
|
-
delete req.query.limit;
|
|
8
|
-
req.report = JSON.parse(req.query.report);
|
|
9
|
-
delete req.query.report;
|
|
10
|
-
}
|
|
11
|
-
next();
|
|
12
|
-
};
|
|
13
|
-
exports.isReportMiddleware = isReportMiddleware;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isReportMiddleware = void 0;
|
|
4
|
+
const isReportMiddleware = (req, res, next) => {
|
|
5
|
+
if (req.query.report) {
|
|
6
|
+
delete req.query.start; //TODO 20211011: change for spread operator instead of delete
|
|
7
|
+
delete req.query.limit;
|
|
8
|
+
req.report = JSON.parse(req.query.report);
|
|
9
|
+
delete req.query.report;
|
|
10
|
+
}
|
|
11
|
+
next();
|
|
12
|
+
};
|
|
13
|
+
exports.isReportMiddleware = isReportMiddleware;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kplian Ltda 2020
|
|
3
|
-
*
|
|
4
|
-
* MIT
|
|
5
|
-
*
|
|
6
|
-
* Common security functions
|
|
7
|
-
*
|
|
8
|
-
* @summary Common security functions.
|
|
9
|
-
* @author Mercedes Zambrana
|
|
10
|
-
*
|
|
11
|
-
* Created at : 2020-06-13 18:09:48
|
|
12
|
-
* Last modified : 2020-10-20 17:46:24
|
|
13
|
-
*/
|
|
14
|
-
import 'reflect-metadata';
|
|
15
|
-
import { EntityManager } from 'typeorm';
|
|
16
|
-
interface ScriptInterface {
|
|
17
|
-
scriptCode: string;
|
|
18
|
-
scriptFunction: (manager: EntityManager) => void;
|
|
19
|
-
}
|
|
20
|
-
declare const userHasPermission: (Role: any) => (userId: number, transaction: string) => Promise<boolean>;
|
|
21
|
-
declare const insertLog: (username: string, macaddres: string, ip: string, logType: string, desc: string, proc: string, trans: string, query: string, req: Record<string, unknown>, resp: string, err: string, timeEx: number, logConfig: Record<string, unknown>) => Promise<number>;
|
|
22
|
-
export { userHasPermission, insertLog };
|
|
23
|
-
export type { ScriptInterface };
|
|
1
|
+
/**
|
|
2
|
+
* Kplian Ltda 2020
|
|
3
|
+
*
|
|
4
|
+
* MIT
|
|
5
|
+
*
|
|
6
|
+
* Common security functions
|
|
7
|
+
*
|
|
8
|
+
* @summary Common security functions.
|
|
9
|
+
* @author Mercedes Zambrana
|
|
10
|
+
*
|
|
11
|
+
* Created at : 2020-06-13 18:09:48
|
|
12
|
+
* Last modified : 2020-10-20 17:46:24
|
|
13
|
+
*/
|
|
14
|
+
import 'reflect-metadata';
|
|
15
|
+
import { EntityManager } from 'typeorm';
|
|
16
|
+
interface ScriptInterface {
|
|
17
|
+
scriptCode: string;
|
|
18
|
+
scriptFunction: (manager: EntityManager) => void;
|
|
19
|
+
}
|
|
20
|
+
declare const userHasPermission: (Role: any) => (userId: number, transaction: string) => Promise<boolean>;
|
|
21
|
+
declare const insertLog: (username: string, macaddres: string, ip: string, logType: string, desc: string, proc: string, trans: string, query: string, req: Record<string, unknown>, resp: string, err: string, timeEx: number, logConfig: Record<string, unknown>) => Promise<number>;
|
|
22
|
+
export { userHasPermission, insertLog };
|
|
23
|
+
export type { ScriptInterface };
|