mythix 2.0.2 → 2.1.1

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.0.2",
3
+ "version": "2.1.1",
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": "^8.0.2",
32
32
  "form-data": "^4.0.0",
33
- "mythix-orm": "^1.0.4",
33
+ "mythix-orm": "^1.1.0",
34
34
  "nife": "^1.11.3",
35
35
  "prompts": "^2.4.2"
36
36
  }
@@ -143,6 +143,22 @@ class ControllerBase {
143
143
  this.response.cookie(name, ('' + value), options || {});
144
144
  }
145
145
 
146
+ getHeader(name) {
147
+ return this.request.headers[name];
148
+ }
149
+
150
+ getHeaders(_names) {
151
+ let names = Nife.toArray(_names).filter(Boolean);
152
+ let headers = {};
153
+
154
+ for (let i = 0, il = names.length; i < il; i++) {
155
+ let name = names[i];
156
+ headers[name] = this.getHeader(name);
157
+ }
158
+
159
+ return headers;
160
+ }
161
+
146
162
  setHeader(name, value) {
147
163
  this.response.header(name, value);
148
164
  }
@@ -175,7 +175,7 @@ class HTTPServer {
175
175
  () => rootNext(),
176
176
  (error) => {
177
177
  if (!(error instanceof HTTPBaseError))
178
- this.getApplication().error('Error in middleware: ', error);
178
+ this.getApplication().getLogger().error('Error in middleware: ', error);
179
179
  },
180
180
  );
181
181
  }
@@ -12,6 +12,11 @@ class Model extends _Model {
12
12
  return this;
13
13
  }
14
14
 
15
+ static getModels() {
16
+ let connection = this.getConnection();
17
+ return connection.getModels();
18
+ }
19
+
15
20
  getModel(modelName) {
16
21
  return this.constructor.getModel(modelName);
17
22
  }