@adaptivestone/framework 4.9.0 → 4.9.2

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/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
+ ### 4.9.2
2
+
3
+ [UPDATE] deps update
4
+
5
+ ### 4.9.1
6
+
7
+ [UPDATE] all responces from framework now happens in JSON. Previouls sometime aswers was in plan text
8
+
1
9
  ### 4.9.0
2
10
 
3
- [BREAKING] We are separated testsing to setyp and global setup. Global setup now care of mongo to make sure that only on mongodb memoery server is spinned up. If you are using vitest please add "globalSetup: @adaptivestone/framework/tests/gloablSetupVitest" to your vitest config
11
+ [BREAKING] We are separated testsing to setyp and global setup. Global setup now care of mongo to make sure that only on mongodb memoery server is spinned up. If you are using vitest please add "globalSetup: node_modules/@adaptivestone/framework/tests/globalSetupVitest" to your vitest config
4
12
 
5
13
  ### 4.8.3
6
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptivestone/framework",
3
- "version": "4.9.0",
3
+ "version": "4.9.2",
4
4
  "description": "Adaptive stone node js framework",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -59,7 +59,7 @@
59
59
  "eslint-plugin-vitest": "^0.3.1",
60
60
  "husky": "^8.0.0",
61
61
  "lint-staged": "^14.0.0",
62
- "mongodb-memory-server": "^8.0.2",
62
+ "mongodb-memory-server": "^9.0.0",
63
63
  "nodemon": "^3.0.1",
64
64
  "prettier": "^3.0.0",
65
65
  "vitest": "^0.34.3"
@@ -46,7 +46,7 @@ class HttpServer extends Base {
46
46
  // eslint-disable-next-line no-console
47
47
  console.error(err.stack);
48
48
  // TODO
49
- res.status(500).send('Something broke!');
49
+ res.status(500).json({ message: 'Something broke!' });
50
50
  });
51
51
 
52
52
  this.httpServer = http.Server(this.express);
@@ -105,9 +105,9 @@ class RateLimiter extends AbstractMiddleware {
105
105
  async middleware(req, res, next) {
106
106
  if (!this.limiter) {
107
107
  this.logger.info(
108
- `RateLimmiter not inited correclty! Please check init logs `,
108
+ `RateLimiter not inited correclty! Please check init logs `,
109
109
  );
110
- return res.status(500).send('');
110
+ return res.status(500).json({ message: 'RateLimiter error' });
111
111
  }
112
112
 
113
113
  const { namespace } = this.app.getConfig('redis');
@@ -122,7 +122,7 @@ class RateLimiter extends AbstractMiddleware {
122
122
  if (consumeResult) {
123
123
  return next();
124
124
  }
125
- return res.status(429).send('Too Many Requests');
125
+ return res.status(429).json({ message: 'Too Many Requests' });
126
126
  }
127
127
  }
128
128
 
@@ -106,7 +106,7 @@ describe('rate limiter methods', () => {
106
106
  status = statusCode;
107
107
  return this;
108
108
  },
109
- send() {
109
+ json() {
110
110
  isSend = true;
111
111
  },
112
112
  },
@@ -137,7 +137,7 @@ describe('rate limiter methods', () => {
137
137
  status = statusCode;
138
138
  return this;
139
139
  },
140
- send() {
140
+ json() {
141
141
  isSend = true;
142
142
  },
143
143
  },
@@ -9,7 +9,7 @@ class RoleMiddleware extends AbstractMiddleware {
9
9
  const { user } = req.appInfo;
10
10
 
11
11
  if (!user) {
12
- return res.status(401).send();
12
+ return res.status(401).json({ message: 'User should be provided' });
13
13
  }
14
14
 
15
15
  let hasRole = false;
@@ -48,7 +48,7 @@ describe('role middleware methods', () => {
48
48
  status = statusCode;
49
49
  return this;
50
50
  },
51
- send() {
51
+ json() {
52
52
  isSend = true;
53
53
  },
54
54
  },