@pxp-nd/core 1.2.72 → 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 -305
- 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
package/dist/ScriptManager.js
CHANGED
|
@@ -1,130 +1,130 @@
|
|
|
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
|
-
* Run scripts for all modules
|
|
31
|
-
*
|
|
32
|
-
* @summary Manage modules scripts
|
|
33
|
-
* @author Jaime Rivera
|
|
34
|
-
*
|
|
35
|
-
* Created at : 2020-06-15 16:31:21
|
|
36
|
-
* Last modified : 2020-10-23 19:32:15
|
|
37
|
-
*/
|
|
38
|
-
const fs_1 = __importDefault(require("fs"));
|
|
39
|
-
const path_1 = __importDefault(require("path"));
|
|
40
|
-
const util_1 = __importDefault(require("util"));
|
|
41
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
-
const figlet = __importStar(require("figlet"));
|
|
43
|
-
require("reflect-metadata");
|
|
44
|
-
const typeorm_1 = require("typeorm");
|
|
45
|
-
const ScriptVersion_1 = __importDefault(require("./entities/ScriptVersion"));
|
|
46
|
-
async function loadCustomStripts() {
|
|
47
|
-
const dir = path_1.default.join(process.cwd(), 'dist', 'config.js');
|
|
48
|
-
const customScripts = await Promise.resolve().then(() => __importStar(require(dir)));
|
|
49
|
-
return customScripts.default.scripts || [];
|
|
50
|
-
}
|
|
51
|
-
let scriptArray = [];
|
|
52
|
-
// let scriptArray: ScriptInterface[] = [...pxpScripts];
|
|
53
|
-
console.log(chalk_1.default.red(figlet.textSync('script-loader', { horizontalLayout: 'default' })));
|
|
54
|
-
console.log(chalk_1.default.red('=================================================================='));
|
|
55
|
-
console.log();
|
|
56
|
-
const compare = (a, b) => {
|
|
57
|
-
let comparison = 0;
|
|
58
|
-
const aSortCode = a.scriptCode.substring(8);
|
|
59
|
-
const bSortCode = b.scriptCode.substring(8);
|
|
60
|
-
if (aSortCode > bSortCode) {
|
|
61
|
-
comparison = 1;
|
|
62
|
-
}
|
|
63
|
-
else if (aSortCode < bSortCode) {
|
|
64
|
-
comparison = -1;
|
|
65
|
-
}
|
|
66
|
-
return comparison;
|
|
67
|
-
};
|
|
68
|
-
const executeScripts = async () => {
|
|
69
|
-
const connection = typeorm_1.getConnection();
|
|
70
|
-
while (scriptArray.length > 0) {
|
|
71
|
-
const scriptObject = scriptArray.shift();
|
|
72
|
-
if (scriptObject) {
|
|
73
|
-
const foundSV = await ScriptVersion_1.default.findOne({ scriptCode: scriptObject.scriptCode });
|
|
74
|
-
if (!foundSV) {
|
|
75
|
-
let queryRunner = connection.createQueryRunner();
|
|
76
|
-
try {
|
|
77
|
-
await queryRunner.connect();
|
|
78
|
-
await queryRunner.startTransaction();
|
|
79
|
-
const manager = queryRunner.manager;
|
|
80
|
-
await scriptObject.scriptFunction(manager);
|
|
81
|
-
const scriptVersion = new ScriptVersion_1.default();
|
|
82
|
-
scriptVersion.scriptCode = scriptObject.scriptCode;
|
|
83
|
-
await manager.save(scriptVersion);
|
|
84
|
-
await queryRunner.commitTransaction();
|
|
85
|
-
console.log(chalk_1.default.green('Loaded: ' + scriptObject.scriptCode));
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
await queryRunner.rollbackTransaction();
|
|
89
|
-
console.log(chalk_1.default.red('Error: ' + scriptObject.scriptCode, err));
|
|
90
|
-
}
|
|
91
|
-
finally {
|
|
92
|
-
await queryRunner.release();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
console.log('Already exists: ' + scriptObject.scriptCode);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
(async () => {
|
|
102
|
-
try {
|
|
103
|
-
await typeorm_1.createConnections();
|
|
104
|
-
const readdir = util_1.default.promisify(fs_1.default.readdir);
|
|
105
|
-
const modulesPath = `${process.cwd()}/dist/modules`;
|
|
106
|
-
let modules = [];
|
|
107
|
-
try {
|
|
108
|
-
const customScripts = await loadCustomStripts();
|
|
109
|
-
scriptArray = [...scriptArray, ...customScripts];
|
|
110
|
-
modules = await readdir(modulesPath);
|
|
111
|
-
for (const module of modules) {
|
|
112
|
-
const url = modulesPath + '/' + module + '/database/script.js';
|
|
113
|
-
if (fs_1.default.existsSync(url)) {
|
|
114
|
-
const scriptAux = await Promise.resolve().then(() => __importStar(require(url)));
|
|
115
|
-
scriptArray = scriptArray.concat(scriptAux.default);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
scriptArray.sort(compare);
|
|
119
|
-
await executeScripts();
|
|
120
|
-
console.log(chalk_1.default.blue(figlet.textSync('thank you', { font: 'Mini', horizontalLayout: 'default' })));
|
|
121
|
-
process.exit();
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
console.log('Error running script manager', err);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch (e) {
|
|
128
|
-
// Deal with the fact the chain failed
|
|
129
|
-
}
|
|
130
|
-
})();
|
|
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
|
+
* Run scripts for all modules
|
|
31
|
+
*
|
|
32
|
+
* @summary Manage modules scripts
|
|
33
|
+
* @author Jaime Rivera
|
|
34
|
+
*
|
|
35
|
+
* Created at : 2020-06-15 16:31:21
|
|
36
|
+
* Last modified : 2020-10-23 19:32:15
|
|
37
|
+
*/
|
|
38
|
+
const fs_1 = __importDefault(require("fs"));
|
|
39
|
+
const path_1 = __importDefault(require("path"));
|
|
40
|
+
const util_1 = __importDefault(require("util"));
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const figlet = __importStar(require("figlet"));
|
|
43
|
+
require("reflect-metadata");
|
|
44
|
+
const typeorm_1 = require("typeorm");
|
|
45
|
+
const ScriptVersion_1 = __importDefault(require("./entities/ScriptVersion"));
|
|
46
|
+
async function loadCustomStripts() {
|
|
47
|
+
const dir = path_1.default.join(process.cwd(), 'dist', 'config.js');
|
|
48
|
+
const customScripts = await Promise.resolve().then(() => __importStar(require(dir)));
|
|
49
|
+
return customScripts.default.scripts || [];
|
|
50
|
+
}
|
|
51
|
+
let scriptArray = [];
|
|
52
|
+
// let scriptArray: ScriptInterface[] = [...pxpScripts];
|
|
53
|
+
console.log(chalk_1.default.red(figlet.textSync('script-loader', { horizontalLayout: 'default' })));
|
|
54
|
+
console.log(chalk_1.default.red('=================================================================='));
|
|
55
|
+
console.log();
|
|
56
|
+
const compare = (a, b) => {
|
|
57
|
+
let comparison = 0;
|
|
58
|
+
const aSortCode = a.scriptCode.substring(8);
|
|
59
|
+
const bSortCode = b.scriptCode.substring(8);
|
|
60
|
+
if (aSortCode > bSortCode) {
|
|
61
|
+
comparison = 1;
|
|
62
|
+
}
|
|
63
|
+
else if (aSortCode < bSortCode) {
|
|
64
|
+
comparison = -1;
|
|
65
|
+
}
|
|
66
|
+
return comparison;
|
|
67
|
+
};
|
|
68
|
+
const executeScripts = async () => {
|
|
69
|
+
const connection = typeorm_1.getConnection();
|
|
70
|
+
while (scriptArray.length > 0) {
|
|
71
|
+
const scriptObject = scriptArray.shift();
|
|
72
|
+
if (scriptObject) {
|
|
73
|
+
const foundSV = await ScriptVersion_1.default.findOne({ scriptCode: scriptObject.scriptCode });
|
|
74
|
+
if (!foundSV) {
|
|
75
|
+
let queryRunner = connection.createQueryRunner();
|
|
76
|
+
try {
|
|
77
|
+
await queryRunner.connect();
|
|
78
|
+
await queryRunner.startTransaction();
|
|
79
|
+
const manager = queryRunner.manager;
|
|
80
|
+
await scriptObject.scriptFunction(manager);
|
|
81
|
+
const scriptVersion = new ScriptVersion_1.default();
|
|
82
|
+
scriptVersion.scriptCode = scriptObject.scriptCode;
|
|
83
|
+
await manager.save(scriptVersion);
|
|
84
|
+
await queryRunner.commitTransaction();
|
|
85
|
+
console.log(chalk_1.default.green('Loaded: ' + scriptObject.scriptCode));
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
await queryRunner.rollbackTransaction();
|
|
89
|
+
console.log(chalk_1.default.red('Error: ' + scriptObject.scriptCode, err));
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
await queryRunner.release();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
console.log('Already exists: ' + scriptObject.scriptCode);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
(async () => {
|
|
102
|
+
try {
|
|
103
|
+
await typeorm_1.createConnections();
|
|
104
|
+
const readdir = util_1.default.promisify(fs_1.default.readdir);
|
|
105
|
+
const modulesPath = `${process.cwd()}/dist/modules`;
|
|
106
|
+
let modules = [];
|
|
107
|
+
try {
|
|
108
|
+
const customScripts = await loadCustomStripts();
|
|
109
|
+
scriptArray = [...scriptArray, ...customScripts];
|
|
110
|
+
modules = await readdir(modulesPath);
|
|
111
|
+
for (const module of modules) {
|
|
112
|
+
const url = modulesPath + '/' + module + '/database/script.js';
|
|
113
|
+
if (fs_1.default.existsSync(url)) {
|
|
114
|
+
const scriptAux = await Promise.resolve().then(() => __importStar(require(url)));
|
|
115
|
+
scriptArray = scriptArray.concat(scriptAux.default);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
scriptArray.sort(compare);
|
|
119
|
+
await executeScripts();
|
|
120
|
+
console.log(chalk_1.default.blue(figlet.textSync('thank you', { font: 'Mini', horizontalLayout: 'default' })));
|
|
121
|
+
process.exit();
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
console.log('Error running script manager', err);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
// Deal with the fact the chain failed
|
|
129
|
+
}
|
|
130
|
+
})();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kplian Ltda 2020
|
|
3
|
-
*
|
|
4
|
-
* MIT
|
|
5
|
-
*
|
|
6
|
-
* This files contains data to be added to database for pxp module
|
|
7
|
-
*
|
|
8
|
-
* @summary DML should be added here
|
|
9
|
-
* @author Jaime Rivera
|
|
10
|
-
*
|
|
11
|
-
* Created at : 2020-10-15 16:31:21
|
|
12
|
-
* Last modified : 2020-10-23 19:58:43
|
|
13
|
-
*/
|
|
14
|
-
import { ScriptInterface } from '../lib/pxp/utils/Security';
|
|
15
|
-
declare const scriptsArray: ScriptInterface[];
|
|
16
|
-
export default scriptsArray;
|
|
1
|
+
/**
|
|
2
|
+
* Kplian Ltda 2020
|
|
3
|
+
*
|
|
4
|
+
* MIT
|
|
5
|
+
*
|
|
6
|
+
* This files contains data to be added to database for pxp module
|
|
7
|
+
*
|
|
8
|
+
* @summary DML should be added here
|
|
9
|
+
* @author Jaime Rivera
|
|
10
|
+
*
|
|
11
|
+
* Created at : 2020-10-15 16:31:21
|
|
12
|
+
* Last modified : 2020-10-23 19:58:43
|
|
13
|
+
*/
|
|
14
|
+
import { ScriptInterface } from '../lib/pxp/utils/Security';
|
|
15
|
+
declare const scriptsArray: ScriptInterface[];
|
|
16
|
+
export default scriptsArray;
|
package/dist/database/script.js
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Kplian Ltda 2020
|
|
4
|
-
*
|
|
5
|
-
* MIT
|
|
6
|
-
*
|
|
7
|
-
* This files contains data to be added to database for pxp module
|
|
8
|
-
*
|
|
9
|
-
* @summary DML should be added here
|
|
10
|
-
* @author Jaime Rivera
|
|
11
|
-
*
|
|
12
|
-
* Created at : 2020-10-15 16:31:21
|
|
13
|
-
* Last modified : 2020-10-23 19:58:43
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
// import { ScriptInterface } from '@pxp-nd/core';
|
|
17
|
-
// import {Person , User , Role, Subsystem , Ui} from '@pxp-nd/entities';
|
|
18
|
-
const Person = class {
|
|
19
|
-
}, User = class {
|
|
20
|
-
}, Role = class {
|
|
21
|
-
}, Subsystem = class {
|
|
22
|
-
}, Ui = class {
|
|
23
|
-
static findOne(filter) { }
|
|
24
|
-
};
|
|
25
|
-
const scriptsArray = [];
|
|
26
|
-
/***************************
|
|
27
|
-
* ADD YOUR SCRIPTS HERE
|
|
28
|
-
***************************/
|
|
29
|
-
scriptsArray.push({
|
|
30
|
-
scriptCode: 'JRR-PXP-20200601-001',
|
|
31
|
-
scriptFunction: async (em) => {
|
|
32
|
-
const person = new Person();
|
|
33
|
-
person.name = 'admin';
|
|
34
|
-
person.lastName = 'admin';
|
|
35
|
-
person.createdBy = 'admin';
|
|
36
|
-
await em.save(person);
|
|
37
|
-
const subsystem = new Subsystem();
|
|
38
|
-
subsystem.name = 'PXP';
|
|
39
|
-
subsystem.code = 'PXP';
|
|
40
|
-
subsystem.folderName = 'pxp';
|
|
41
|
-
subsystem.prefix = 'PXP';
|
|
42
|
-
subsystem.createdBy = 'admin';
|
|
43
|
-
await em.save(subsystem);
|
|
44
|
-
const role = new Role();
|
|
45
|
-
role.role = 'admin';
|
|
46
|
-
role.description = 'Pxp Administrator (equals to root)';
|
|
47
|
-
role.createdBy = 'admin';
|
|
48
|
-
role.subsystem = subsystem;
|
|
49
|
-
await em.save(role);
|
|
50
|
-
const user = new User();
|
|
51
|
-
user.person = person;
|
|
52
|
-
user.username = 'admin';
|
|
53
|
-
user.hash = '201a971991b7e67d0706a829ba5fc77cf4633a57f21b27bb3fd61e3126e3ccf711282eb04f3973a68d4e1444f032e6279b4ddf09fd6bbf51ada163f2bc7f74ce';
|
|
54
|
-
user.salt = 'bb7094089cd4f2e9528e8d0f1b00d219c3b3a82e8a39402faee476263bf0848c';
|
|
55
|
-
user.createdBy = 'admin';
|
|
56
|
-
user.roles = [role];
|
|
57
|
-
await em.save(user);
|
|
58
|
-
const ui = new Ui();
|
|
59
|
-
ui.code = 'PXP';
|
|
60
|
-
ui.name = 'Pxp (root ui)';
|
|
61
|
-
ui.description = 'This should not show in menu all subsystems depend on this';
|
|
62
|
-
ui.subsystem = subsystem;
|
|
63
|
-
ui.createdBy = 'admin';
|
|
64
|
-
await em.save(ui);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
// ROOT MENU FOR EXAMPLES
|
|
68
|
-
scriptsArray.push({
|
|
69
|
-
scriptCode: 'JRR-PXP-20210407-001',
|
|
70
|
-
scriptFunction: async (em) => {
|
|
71
|
-
const subsystem = new Subsystem();
|
|
72
|
-
subsystem.name = 'EXAMPLE';
|
|
73
|
-
subsystem.code = 'EXA ';
|
|
74
|
-
subsystem.folderName = 'exa';
|
|
75
|
-
subsystem.prefix = 'EXA';
|
|
76
|
-
subsystem.createdBy = 'admin';
|
|
77
|
-
await em.save(subsystem);
|
|
78
|
-
const rootUi = await Ui.findOne({ code: "PXP" });
|
|
79
|
-
const uiParent = new Ui();
|
|
80
|
-
uiParent.code = 'EXA';
|
|
81
|
-
uiParent.name = 'EXAMPLES';
|
|
82
|
-
uiParent.description = 'ROOT MENU FOR EXAMPLES';
|
|
83
|
-
uiParent.subsystem = subsystem;
|
|
84
|
-
uiParent.parent = rootUi; // as Ui;
|
|
85
|
-
uiParent.createdBy = 'admin';
|
|
86
|
-
await em.save(uiParent);
|
|
87
|
-
const ui1 = new Ui();
|
|
88
|
-
ui1.code = 'EXA_FormExample';
|
|
89
|
-
ui1.name = ' FORM EXAMPLES';
|
|
90
|
-
ui1.description = 'ROOT MENU FOR EXAMPLES';
|
|
91
|
-
ui1.subsystem = subsystem;
|
|
92
|
-
ui1.createdBy = 'admin';
|
|
93
|
-
ui1.parent = uiParent;
|
|
94
|
-
ui1.route = "EXA_FormExample";
|
|
95
|
-
await em.save(ui1);
|
|
96
|
-
const ui2 = new Ui();
|
|
97
|
-
ui2.code = 'EXA_PickerExample';
|
|
98
|
-
ui2.name = 'PICKER EXAMPLES';
|
|
99
|
-
ui2.description = 'ROOT MENU FOR EXAMPLES';
|
|
100
|
-
ui2.subsystem = subsystem;
|
|
101
|
-
ui2.createdBy = 'admin';
|
|
102
|
-
ui2.parent = uiParent;
|
|
103
|
-
ui2.route = "EXA_PickerExample";
|
|
104
|
-
await em.save(ui2);
|
|
105
|
-
const ui3 = new Ui();
|
|
106
|
-
ui3.code = 'EXA_TextFieldExample';
|
|
107
|
-
ui3.name = 'TEXT FIELd EXAMPLE';
|
|
108
|
-
ui3.description = 'ROOT MENU FOR EXAMPLES';
|
|
109
|
-
ui3.subsystem = subsystem;
|
|
110
|
-
ui3.createdBy = 'admin';
|
|
111
|
-
ui3.parent = uiParent;
|
|
112
|
-
ui3.route = "EXA_TextFieldExample";
|
|
113
|
-
await em.save(ui3);
|
|
114
|
-
const ui4 = new Ui();
|
|
115
|
-
ui4.code = 'EXA_AutocompleteExample';
|
|
116
|
-
ui4.name = 'AUTO COMPLETE EXAMPLE';
|
|
117
|
-
ui4.description = 'ROOT MENU FOR EXAMPLES';
|
|
118
|
-
ui4.subsystem = subsystem;
|
|
119
|
-
ui4.createdBy = 'admin';
|
|
120
|
-
ui4.parent = uiParent;
|
|
121
|
-
ui4.route = "EXA_AutocompleteExample";
|
|
122
|
-
await em.save(ui4);
|
|
123
|
-
const ui5 = new Ui();
|
|
124
|
-
ui5.code = 'EXA__MapExample';
|
|
125
|
-
ui5.name = 'MAP EXAMPLE';
|
|
126
|
-
ui5.description = 'ROOT MENU FOR EXAMPLES';
|
|
127
|
-
ui5.subsystem = subsystem;
|
|
128
|
-
ui5.createdBy = 'admin';
|
|
129
|
-
ui5.parent = uiParent;
|
|
130
|
-
ui5.route = "EXA__MapExample";
|
|
131
|
-
await em.save(ui5);
|
|
132
|
-
const ui6 = new Ui();
|
|
133
|
-
ui6.code = 'EXALIST__options';
|
|
134
|
-
ui6.name = 'LIST EXAMPLE OPTIONS';
|
|
135
|
-
ui6.description = 'ROOT MENU FOR EXAMPLES';
|
|
136
|
-
ui6.subsystem = subsystem;
|
|
137
|
-
ui6.createdBy = 'admin';
|
|
138
|
-
ui6.parent = uiParent;
|
|
139
|
-
ui6.route = "EXALIST__options";
|
|
140
|
-
await em.save(ui6);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
exports.default = scriptsArray;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Kplian Ltda 2020
|
|
4
|
+
*
|
|
5
|
+
* MIT
|
|
6
|
+
*
|
|
7
|
+
* This files contains data to be added to database for pxp module
|
|
8
|
+
*
|
|
9
|
+
* @summary DML should be added here
|
|
10
|
+
* @author Jaime Rivera
|
|
11
|
+
*
|
|
12
|
+
* Created at : 2020-10-15 16:31:21
|
|
13
|
+
* Last modified : 2020-10-23 19:58:43
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
// import { ScriptInterface } from '@pxp-nd/core';
|
|
17
|
+
// import {Person , User , Role, Subsystem , Ui} from '@pxp-nd/entities';
|
|
18
|
+
const Person = class {
|
|
19
|
+
}, User = class {
|
|
20
|
+
}, Role = class {
|
|
21
|
+
}, Subsystem = class {
|
|
22
|
+
}, Ui = class {
|
|
23
|
+
static findOne(filter) { }
|
|
24
|
+
};
|
|
25
|
+
const scriptsArray = [];
|
|
26
|
+
/***************************
|
|
27
|
+
* ADD YOUR SCRIPTS HERE
|
|
28
|
+
***************************/
|
|
29
|
+
scriptsArray.push({
|
|
30
|
+
scriptCode: 'JRR-PXP-20200601-001',
|
|
31
|
+
scriptFunction: async (em) => {
|
|
32
|
+
const person = new Person();
|
|
33
|
+
person.name = 'admin';
|
|
34
|
+
person.lastName = 'admin';
|
|
35
|
+
person.createdBy = 'admin';
|
|
36
|
+
await em.save(person);
|
|
37
|
+
const subsystem = new Subsystem();
|
|
38
|
+
subsystem.name = 'PXP';
|
|
39
|
+
subsystem.code = 'PXP';
|
|
40
|
+
subsystem.folderName = 'pxp';
|
|
41
|
+
subsystem.prefix = 'PXP';
|
|
42
|
+
subsystem.createdBy = 'admin';
|
|
43
|
+
await em.save(subsystem);
|
|
44
|
+
const role = new Role();
|
|
45
|
+
role.role = 'admin';
|
|
46
|
+
role.description = 'Pxp Administrator (equals to root)';
|
|
47
|
+
role.createdBy = 'admin';
|
|
48
|
+
role.subsystem = subsystem;
|
|
49
|
+
await em.save(role);
|
|
50
|
+
const user = new User();
|
|
51
|
+
user.person = person;
|
|
52
|
+
user.username = 'admin';
|
|
53
|
+
user.hash = '201a971991b7e67d0706a829ba5fc77cf4633a57f21b27bb3fd61e3126e3ccf711282eb04f3973a68d4e1444f032e6279b4ddf09fd6bbf51ada163f2bc7f74ce';
|
|
54
|
+
user.salt = 'bb7094089cd4f2e9528e8d0f1b00d219c3b3a82e8a39402faee476263bf0848c';
|
|
55
|
+
user.createdBy = 'admin';
|
|
56
|
+
user.roles = [role];
|
|
57
|
+
await em.save(user);
|
|
58
|
+
const ui = new Ui();
|
|
59
|
+
ui.code = 'PXP';
|
|
60
|
+
ui.name = 'Pxp (root ui)';
|
|
61
|
+
ui.description = 'This should not show in menu all subsystems depend on this';
|
|
62
|
+
ui.subsystem = subsystem;
|
|
63
|
+
ui.createdBy = 'admin';
|
|
64
|
+
await em.save(ui);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
// ROOT MENU FOR EXAMPLES
|
|
68
|
+
scriptsArray.push({
|
|
69
|
+
scriptCode: 'JRR-PXP-20210407-001',
|
|
70
|
+
scriptFunction: async (em) => {
|
|
71
|
+
const subsystem = new Subsystem();
|
|
72
|
+
subsystem.name = 'EXAMPLE';
|
|
73
|
+
subsystem.code = 'EXA ';
|
|
74
|
+
subsystem.folderName = 'exa';
|
|
75
|
+
subsystem.prefix = 'EXA';
|
|
76
|
+
subsystem.createdBy = 'admin';
|
|
77
|
+
await em.save(subsystem);
|
|
78
|
+
const rootUi = await Ui.findOne({ code: "PXP" });
|
|
79
|
+
const uiParent = new Ui();
|
|
80
|
+
uiParent.code = 'EXA';
|
|
81
|
+
uiParent.name = 'EXAMPLES';
|
|
82
|
+
uiParent.description = 'ROOT MENU FOR EXAMPLES';
|
|
83
|
+
uiParent.subsystem = subsystem;
|
|
84
|
+
uiParent.parent = rootUi; // as Ui;
|
|
85
|
+
uiParent.createdBy = 'admin';
|
|
86
|
+
await em.save(uiParent);
|
|
87
|
+
const ui1 = new Ui();
|
|
88
|
+
ui1.code = 'EXA_FormExample';
|
|
89
|
+
ui1.name = ' FORM EXAMPLES';
|
|
90
|
+
ui1.description = 'ROOT MENU FOR EXAMPLES';
|
|
91
|
+
ui1.subsystem = subsystem;
|
|
92
|
+
ui1.createdBy = 'admin';
|
|
93
|
+
ui1.parent = uiParent;
|
|
94
|
+
ui1.route = "EXA_FormExample";
|
|
95
|
+
await em.save(ui1);
|
|
96
|
+
const ui2 = new Ui();
|
|
97
|
+
ui2.code = 'EXA_PickerExample';
|
|
98
|
+
ui2.name = 'PICKER EXAMPLES';
|
|
99
|
+
ui2.description = 'ROOT MENU FOR EXAMPLES';
|
|
100
|
+
ui2.subsystem = subsystem;
|
|
101
|
+
ui2.createdBy = 'admin';
|
|
102
|
+
ui2.parent = uiParent;
|
|
103
|
+
ui2.route = "EXA_PickerExample";
|
|
104
|
+
await em.save(ui2);
|
|
105
|
+
const ui3 = new Ui();
|
|
106
|
+
ui3.code = 'EXA_TextFieldExample';
|
|
107
|
+
ui3.name = 'TEXT FIELd EXAMPLE';
|
|
108
|
+
ui3.description = 'ROOT MENU FOR EXAMPLES';
|
|
109
|
+
ui3.subsystem = subsystem;
|
|
110
|
+
ui3.createdBy = 'admin';
|
|
111
|
+
ui3.parent = uiParent;
|
|
112
|
+
ui3.route = "EXA_TextFieldExample";
|
|
113
|
+
await em.save(ui3);
|
|
114
|
+
const ui4 = new Ui();
|
|
115
|
+
ui4.code = 'EXA_AutocompleteExample';
|
|
116
|
+
ui4.name = 'AUTO COMPLETE EXAMPLE';
|
|
117
|
+
ui4.description = 'ROOT MENU FOR EXAMPLES';
|
|
118
|
+
ui4.subsystem = subsystem;
|
|
119
|
+
ui4.createdBy = 'admin';
|
|
120
|
+
ui4.parent = uiParent;
|
|
121
|
+
ui4.route = "EXA_AutocompleteExample";
|
|
122
|
+
await em.save(ui4);
|
|
123
|
+
const ui5 = new Ui();
|
|
124
|
+
ui5.code = 'EXA__MapExample';
|
|
125
|
+
ui5.name = 'MAP EXAMPLE';
|
|
126
|
+
ui5.description = 'ROOT MENU FOR EXAMPLES';
|
|
127
|
+
ui5.subsystem = subsystem;
|
|
128
|
+
ui5.createdBy = 'admin';
|
|
129
|
+
ui5.parent = uiParent;
|
|
130
|
+
ui5.route = "EXA__MapExample";
|
|
131
|
+
await em.save(ui5);
|
|
132
|
+
const ui6 = new Ui();
|
|
133
|
+
ui6.code = 'EXALIST__options';
|
|
134
|
+
ui6.name = 'LIST EXAMPLE OPTIONS';
|
|
135
|
+
ui6.description = 'ROOT MENU FOR EXAMPLES';
|
|
136
|
+
ui6.subsystem = subsystem;
|
|
137
|
+
ui6.createdBy = 'admin';
|
|
138
|
+
ui6.parent = uiParent;
|
|
139
|
+
ui6.route = "EXALIST__options";
|
|
140
|
+
await em.save(ui6);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
exports.default = scriptsArray;
|
package/dist/db.datasource.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const createConnections: (connections: any[] | object) => any;
|
|
2
|
-
export { createConnections };
|
|
1
|
+
declare const createConnections: (connections: any[] | object) => any;
|
|
2
|
+
export { createConnections };
|