@adaptivestone/framework 5.0.0-alpha.15 → 5.0.0-alpha.17

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,3 +1,13 @@
1
+ ### 5.0.0-alpha.17
2
+
3
+ [NEW] generateRandomBytes command
4
+ [UPDATE] update deps
5
+
6
+ ### 5.0.0-alpha.16
7
+
8
+ [UPDATE] no warning of direct usage body and query
9
+ [UPDATE] update deps
10
+
1
11
  ### 5.0.0-alpha.15
2
12
 
3
13
  [BUG] fix bug with pagination
@@ -0,0 +1,15 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import AbstractCommand from '../modules/AbstractCommand.js';
3
+
4
+ class GenerateRandomBytes extends AbstractCommand {
5
+ async run() {
6
+ const sizes = [16, 32, 64, 128, 256];
7
+ for (const size of sizes) {
8
+ const bytes = randomBytes(size).toString('hex');
9
+ this.logger.info(`${size} bytes: ${bytes}`);
10
+ }
11
+ return true;
12
+ }
13
+ }
14
+
15
+ export default GenerateRandomBytes;
package/config/auth.js CHANGED
@@ -1,6 +1,9 @@
1
1
  export default {
2
2
  hashRounds: 64,
3
3
  saltSecret:
4
- process.env.AUTH_SALT || console.error('AUTH_SALT is not defined'),
4
+ process.env.AUTH_SALT ||
5
+ console.error(
6
+ 'AUTH_SALT is not defined. You can "npm run cli generateRandomBytes" and use it',
7
+ ),
5
8
  isAuthWithVefificationFlow: true,
6
9
  };
@@ -196,22 +196,22 @@ class AbstractController extends Base {
196
196
  errors: err.message,
197
197
  });
198
198
  }
199
- req.body = new Proxy(req.body, {
200
- get: (target, prop) => {
201
- this.logger.warn(
202
- 'Please not use "req.body" directly. Implement "request" and use "req.appInfo.request" ',
203
- );
204
- return target[prop];
205
- },
206
- });
207
- req.query = new Proxy(req.query, {
208
- get: (target, prop) => {
209
- this.logger.warn(
210
- 'Please not use "req.query" directly. Implement "query" and use "req.appInfo.query" ',
211
- );
212
- return target[prop];
213
- },
214
- });
199
+ // req.body = new Proxy(req.body, {
200
+ // get: (target, prop) => {
201
+ // this.logger.warn(
202
+ // 'Please not use "req.body" directly. Implement "request" and use "req.appInfo.request" ',
203
+ // );
204
+ // return target[prop];
205
+ // },
206
+ // });
207
+ // req.query = new Proxy(req.query, {
208
+ // get: (target, prop) => {
209
+ // this.logger.warn(
210
+ // 'Please not use "req.query" directly. Implement "query" and use "req.appInfo.query" ',
211
+ // );
212
+ // return target[prop];
213
+ // },
214
+ // });
215
215
 
216
216
  if (!routeObject.handler) {
217
217
  this.logger.error(`Route object have no handler defined`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptivestone/framework",
3
- "version": "5.0.0-alpha.15",
3
+ "version": "5.0.0-alpha.17",
4
4
  "description": "Adaptive stone node js framework",
5
5
  "main": "index.js",
6
6
  "type": "module",