mythix 2.4.2 → 2.4.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mythix",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.5",
|
|
4
4
|
"description": "Mythix is a NodeJS web-app framework",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"express": "^4.17.3",
|
|
31
31
|
"express-busboy": "github:th317erd/express-busboy#0754a570d7979097b31e48655b80d3fcd628d4e4",
|
|
32
32
|
"form-data": "^4.0.0",
|
|
33
|
-
"mythix-orm": "^1.4.
|
|
33
|
+
"mythix-orm": "^1.4.7",
|
|
34
34
|
"nife": "^1.11.3",
|
|
35
35
|
"prompts": "^2.4.2"
|
|
36
36
|
}
|
|
@@ -183,13 +183,13 @@ class ControllerBase {
|
|
|
183
183
|
this.responseStatusCode = parseInt(code, 10);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
async handleIncomingRequest(request, response,
|
|
187
|
-
this.route = route;
|
|
186
|
+
async handleIncomingRequest(request, response, args) {
|
|
187
|
+
this.route = args.route;
|
|
188
188
|
|
|
189
|
-
if (typeof this[controllerMethod] !== 'function')
|
|
190
|
-
this.throwInternalServerError(`Specified route handler named "${this.constructor.name}::${controllerMethod}" not found.`);
|
|
189
|
+
if (typeof this[args.controllerMethod] !== 'function')
|
|
190
|
+
this.throwInternalServerError(`Specified route handler named "${this.constructor.name}::${args.controllerMethod}" not found.`);
|
|
191
191
|
|
|
192
|
-
return await this[controllerMethod].call(this, {
|
|
192
|
+
return await this[args.controllerMethod].call(this, { body: request.body, request, response, ...args }, this.getModels());
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
async handleOutgoingResponse(_controllerResult, request, response /*, { route, controller, controllerMethod, controllerInstance, startTime, params } */) {
|
|
@@ -239,15 +239,22 @@ class HTTPServer {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
createRequestLogger(application, request) {
|
|
242
|
-
|
|
242
|
+
let requestID = (Date.now() + Math.random()).toFixed(REQUEST_ID_POSTFIX_LENGTH);
|
|
243
|
+
|
|
244
|
+
if (request.mythixLogger) {
|
|
245
|
+
if (!request.mythixRequestID)
|
|
246
|
+
request.mythixRequestID = requestID;
|
|
247
|
+
|
|
243
248
|
return request.mythixLogger;
|
|
249
|
+
}
|
|
244
250
|
|
|
245
251
|
let logger = application.getLogger();
|
|
246
252
|
let loggerMethod = ('' + request.method).toUpperCase();
|
|
247
253
|
let loggerURL = ('' + request.path);
|
|
248
|
-
let requestID = (Date.now() + Math.random()).toFixed(REQUEST_ID_POSTFIX_LENGTH);
|
|
249
254
|
let ipAddress = Nife.get(request, 'client.remoteAddress', '<unknown IP address>');
|
|
250
255
|
|
|
256
|
+
request.mythixRequestID = requestID;
|
|
257
|
+
|
|
251
258
|
return logger.clone({ formatter: (output) => `{${ipAddress}} - [#${requestID} ${loggerMethod} ${loggerURL}]: ${output}`});
|
|
252
259
|
}
|
|
253
260
|
|