cabloy 5.1.183 → 5.1.184

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/.cabloy-version CHANGED
@@ -1 +1 @@
1
- 5.1.183
1
+ 5.1.184
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.184
4
+
5
+ ### Improvements
6
+
7
+ - Update guard demonstration examples.
8
+
3
9
  ## 5.1.183
4
10
 
5
11
  ### Improvements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cabloy",
3
- "version": "5.1.183",
3
+ "version": "5.1.184",
4
4
  "gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
5
5
  "description": "A Node.js fullstack framework",
6
6
  "keywords": [
@@ -1,7 +1,7 @@
1
1
  import type { Next } from 'vona';
2
2
  import type { IDecoratorGuardOptionsGlobal, IGuardExecute } from 'vona-module-a-aspect';
3
3
 
4
- import { BeanBase, Global, useApp } from 'vona';
4
+ import { $protocolKey, BeanBase, Global, useApp } from 'vona';
5
5
  import { Guard } from 'vona-module-a-aspect';
6
6
 
7
7
  const app = useApp();
@@ -40,12 +40,19 @@ export interface IGuardOptionsDemonstration extends IDecoratorGuardOptionsGlobal
40
40
  '/home/user/passport/createPassportJwtFromOauthCode',
41
41
  '/home/user/passport/createTempAuthToken',
42
42
  '/auth/passport/callback',
43
+ '/auth/mock/authorize',
44
+ '/captcha/create',
45
+ '/image/upload-policy',
46
+ '/file/upload-policy',
43
47
  ],
44
48
  dependencies: 'a-user:passport',
45
49
  })
46
50
  @Global()
47
51
  export class GuardDemonstration extends BeanBase implements IGuardExecute {
48
52
  async execute(options: IGuardOptionsDemonstration, next: Next): Promise<boolean> {
53
+ const headerOpenapiSchema = this.ctx.headers[$protocolKey('x-vona-openapi-schema')];
54
+ if (headerOpenapiSchema?.toString() === 'true') return next();
55
+
49
56
  const method = this.ctx.method.toUpperCase();
50
57
  if (!options.methodsForWrite.some(item => item.toUpperCase() === method)) {
51
58
  return next();