@pxp-nd/core 1.2.4 → 1.2.7
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/dist/PxpApp.js +26 -4
- package/dist/interfaces.d.ts +5 -0
- package/dist/lib/pxp/Controller.js +2 -6
- package/package.json +1 -1
package/dist/PxpApp.js
CHANGED
|
@@ -12,6 +12,25 @@
|
|
|
12
12
|
* Created at : 2020-06-13 18:09:48
|
|
13
13
|
* Last modified : 2020-09-20 18:24:45
|
|
14
14
|
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
15
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
36
|
};
|
|
@@ -19,6 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
38
|
exports.PxpApp = void 0;
|
|
20
39
|
require("reflect-metadata");
|
|
21
40
|
const typeorm_1 = require("typeorm");
|
|
41
|
+
const bodyParser = __importStar(require("body-parser"));
|
|
22
42
|
const express_fileupload_1 = __importDefault(require("express-fileupload"));
|
|
23
43
|
const express_1 = __importDefault(require("express"));
|
|
24
44
|
const passport_1 = __importDefault(require("passport"));
|
|
@@ -45,7 +65,7 @@ const modulesPxp = {
|
|
|
45
65
|
common: '@pxp-nd/common',
|
|
46
66
|
reports: '@pxp-nd/reports',
|
|
47
67
|
};
|
|
48
|
-
//auth configure
|
|
68
|
+
//auth configure
|
|
49
69
|
/**
|
|
50
70
|
*
|
|
51
71
|
* */
|
|
@@ -125,8 +145,10 @@ class PxpApp {
|
|
|
125
145
|
}
|
|
126
146
|
next();
|
|
127
147
|
});
|
|
128
|
-
this.app.use(express_1.default.json());
|
|
129
|
-
this.app.use(express_1.default.urlencoded({
|
|
148
|
+
this.app.use(express_1.default.json({ limit: '50mb' }));
|
|
149
|
+
this.app.use(express_1.default.urlencoded({ limit: '50mb' }));
|
|
150
|
+
this.app.use(bodyParser.json({ limit: '50mb' }));
|
|
151
|
+
this.app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
130
152
|
this.app.use(express_fileupload_1.default({
|
|
131
153
|
limits: { fileSize: 5 * 1024 * 1024 },
|
|
132
154
|
}));
|
|
@@ -264,7 +286,7 @@ class PxpApp {
|
|
|
264
286
|
if (this.config.auth) {
|
|
265
287
|
await this.initializeAuthentication(this.configAuth);
|
|
266
288
|
}
|
|
267
|
-
// load ioServer
|
|
289
|
+
// load ioServer
|
|
268
290
|
this.loadIOserver();
|
|
269
291
|
// load controllers and routes
|
|
270
292
|
await this.loadControllers();
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ declare interface IModule {
|
|
|
26
26
|
declare interface IModules {
|
|
27
27
|
[name: string]: IModule;
|
|
28
28
|
}
|
|
29
|
+
declare interface IConfigExpress {
|
|
30
|
+
[name: string]: any;
|
|
31
|
+
}
|
|
29
32
|
export interface IConfigPxpApp {
|
|
30
33
|
defaultDbSettings?: string;
|
|
31
34
|
apiPrefix?: string;
|
|
@@ -40,5 +43,7 @@ export interface IConfigPxpApp {
|
|
|
40
43
|
scripts?: any[];
|
|
41
44
|
modules?: IModules;
|
|
42
45
|
enableSocket?: boolean;
|
|
46
|
+
expressJsonConfig?: IConfigExpress;
|
|
47
|
+
expressUrlEncodedConfig?: IConfigExpress;
|
|
43
48
|
}
|
|
44
49
|
export {};
|
|
@@ -171,7 +171,7 @@ class Controller {
|
|
|
171
171
|
const iniAt = req.start;
|
|
172
172
|
const endsAt = now.valueOf() - iniAt.valueOf();
|
|
173
173
|
res.logId = await index_1.__(index_1.insertLog('nouser', 'mac', req.ip, 'error', ex.tecMessage, this.module, this.transactionCode, '', // query
|
|
174
|
-
params, ex.stack, ex.statusCode, endsAt,
|
|
174
|
+
params, ex.stack, ex.statusCode, endsAt, logValue));
|
|
175
175
|
index_1.errorMiddleware(ex, req, res);
|
|
176
176
|
}
|
|
177
177
|
});
|
|
@@ -205,7 +205,7 @@ class Controller {
|
|
|
205
205
|
const iniAt = req.start;
|
|
206
206
|
const endsAt = now.valueOf() - iniAt.valueOf();
|
|
207
207
|
res.logId = (await index_1.__(index_1.insertLog(this.user && this.user.username ? this.user.username : 'nouser', 'mac', req.ip, 'error', ex.tecMessage, this.module, this.transactionCode, '', // query
|
|
208
|
-
params, ex.stack, ex.statusCode, endsAt,
|
|
208
|
+
params, ex.stack, ex.statusCode, endsAt, logValue)));
|
|
209
209
|
index_1.errorMiddleware(ex, req, res);
|
|
210
210
|
}
|
|
211
211
|
});
|
|
@@ -274,7 +274,6 @@ class Controller {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
async list(params) {
|
|
277
|
-
console.log('lllleggaa en list');
|
|
278
277
|
const connection = typeorm_1.getConnection(process.env.DB_WRITE_CONNECTION_NAME);
|
|
279
278
|
const queryRunner = connection.getMetadata(this.model).ownColumns.find(column => column.isPrimary === true);
|
|
280
279
|
// ffp search if in the params has been sent the primary key
|
|
@@ -286,16 +285,13 @@ class Controller {
|
|
|
286
285
|
// filter by some column that exist in the entity
|
|
287
286
|
// ffp if some column is into of params for added in the condition
|
|
288
287
|
let ownColumnsForSchema = {};
|
|
289
|
-
console.log('connection.getMetadata(this.model).ownColumns', connection.getMetadata(this.model).ownColumns);
|
|
290
288
|
const whereOwnColumns = connection.getMetadata(this.model).ownColumns.reduce((t, column) => {
|
|
291
|
-
console.log('column.propertyName', column.propertyName);
|
|
292
289
|
if (`_${column.propertyName}` in params) {
|
|
293
290
|
ownColumnsForSchema = Object.assign(Object.assign({}, ownColumnsForSchema), { [`_${column.propertyName}`]: joi_1.default.string() });
|
|
294
291
|
t = Object.assign(Object.assign({}, t), { [column.propertyName]: params[`_${column.propertyName}`] });
|
|
295
292
|
}
|
|
296
293
|
return t;
|
|
297
294
|
}, {});
|
|
298
|
-
console.log('whereOwnColumns', whereOwnColumns);
|
|
299
295
|
const schema = this.getListSchema(ownColumnsForSchema);
|
|
300
296
|
const resParams = await index_1.__(this.schemaValidate(schema, params));
|
|
301
297
|
const listParam = this.getListParams(resParams, whereOwnColumns);
|