mythix 2.2.2 → 2.4.0
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.
|
|
3
|
+
"version": "2.4.0",
|
|
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.
|
|
33
|
+
"mythix-orm": "^1.4.4",
|
|
34
34
|
"nife": "^1.11.3",
|
|
35
35
|
"prompts": "^2.4.2"
|
|
36
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/* global
|
|
3
|
+
/* global Buffer */
|
|
4
4
|
|
|
5
5
|
const Path = require('path');
|
|
6
6
|
const FileSystem = require('fs');
|
|
@@ -421,6 +421,18 @@ class HTTPServer {
|
|
|
421
421
|
// eslint-disable-next-line new-cap
|
|
422
422
|
let app = Express();
|
|
423
423
|
|
|
424
|
+
app.use(Express.raw({ type: 'application/json' }));
|
|
425
|
+
|
|
426
|
+
// Store _rawBody for request
|
|
427
|
+
app.use((request, response, next) => {
|
|
428
|
+
if ((/application\/json/i).test(request.headers['content-type']) && Buffer.isBuffer(request.body)) {
|
|
429
|
+
let bodyStr = request.body.toString('utf8');
|
|
430
|
+
request._rawBody = request.body = bodyStr;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
next();
|
|
434
|
+
});
|
|
435
|
+
|
|
424
436
|
ExpressBusBoy.extend(app, options.uploads);
|
|
425
437
|
|
|
426
438
|
return app;
|
|
@@ -86,10 +86,10 @@ class DatabaseModule extends BaseModule {
|
|
|
86
86
|
|
|
87
87
|
getTablePrefix() {
|
|
88
88
|
let userSpecifiedPrefix = (this.databaseConfig) ? this.databaseConfig.tablePrefix : undefined;
|
|
89
|
-
if (
|
|
90
|
-
return userSpecifiedPrefix;
|
|
89
|
+
if (userSpecifiedPrefix != null)
|
|
90
|
+
return ('' + userSpecifiedPrefix);
|
|
91
91
|
|
|
92
|
-
return `${this.getApplication().getApplicationName()}_
|
|
92
|
+
return `${this.getApplication().getApplicationName()}_`.replace(/[^A-Za-z0-9_]+/g, '');
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
getConnection() {
|
package/src/utils/test-utils.js
CHANGED
|
@@ -11,6 +11,10 @@ const { HTTPServerModule } = require('../http-server/http-server-module');
|
|
|
11
11
|
|
|
12
12
|
class TestDatabaseModule extends DatabaseModule {
|
|
13
13
|
getTablePrefix() {
|
|
14
|
+
let app = this.getApplication();
|
|
15
|
+
if (typeof app.getTestTablePrefix === 'function')
|
|
16
|
+
return (app.getTestTablePrefix() || '');
|
|
17
|
+
|
|
14
18
|
let prefix = super.getTablePrefix();
|
|
15
19
|
return `${prefix.replace(/_test/g, '')}_test_`.replace(/_+/g, '_').replace(/\W+/g, '_');
|
|
16
20
|
}
|