@midwayjs/validate 3.0.0-beta.5 → 3.0.0-beta.6

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
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * class transformer method missing ([#1387](https://github.com/midwayjs/midway/issues/1387)) ([074e839](https://github.com/midwayjs/midway/commit/074e8393598dc95e2742f735df75a2191c5fe25d))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
7
18
 
8
19
  **Note:** Version bump only for package @midwayjs/validate
@@ -1,10 +1,12 @@
1
1
  import { MidwayDecoratorService } from '@midwayjs/core';
2
+ import * as Joi from 'joi';
2
3
  import * as DefaultConfig from './config.default';
3
4
  export declare class ValidateService {
4
5
  validateConfig: typeof DefaultConfig.validate;
5
6
  validate(ClzType: new (...args: any[]) => any, value: any, options?: {
6
7
  errorStatus?: number;
7
- }): void;
8
+ validateOptions?: Joi.ValidationOptions;
9
+ }): Joi.ValidationResult;
8
10
  }
9
11
  export declare class ValidateConfiguration {
10
12
  decoratorService: MidwayDecoratorService;
@@ -27,6 +27,9 @@ let ValidateService = class ValidateService {
27
27
  if (result.error) {
28
28
  throw new core_1.MidwayValidationError(result.error.message, (_a = options === null || options === void 0 ? void 0 : options.errorStatus) !== null && _a !== void 0 ? _a : this.validateConfig.errorStatus, result.error);
29
29
  }
30
+ else {
31
+ return result;
32
+ }
30
33
  }
31
34
  }
32
35
  };
@@ -50,7 +53,10 @@ let ValidateConfiguration = class ValidateConfiguration {
50
53
  before: (joinPoint) => {
51
54
  for (let i = 0; i < paramTypes.length; i++) {
52
55
  const item = paramTypes[i];
53
- this.validateService.validate(item, joinPoint.args[i], options.metadata);
56
+ const result = this.validateService.validate(item, joinPoint.args[i], options.metadata);
57
+ if (result && result.value) {
58
+ joinPoint.args[i] = result.value;
59
+ }
54
60
  }
55
61
  },
56
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/validate",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.6",
4
4
  "description": "Midway Component for mongoose",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -25,9 +25,9 @@
25
25
  "joi": "^17.2.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@midwayjs/core": "^3.0.0-beta.5",
29
- "@midwayjs/decorator": "^3.0.0-beta.5",
30
- "@midwayjs/mock": "^3.0.0-beta.5"
28
+ "@midwayjs/core": "^3.0.0-beta.6",
29
+ "@midwayjs/decorator": "^3.0.0-beta.6",
30
+ "@midwayjs/mock": "^3.0.0-beta.6"
31
31
  },
32
- "gitHead": "ab0bf05ae6d13f6435db2f7223202be61d585a1b"
32
+ "gitHead": "e4595d30b369e36bef21b36f2b3737d8bc2f802d"
33
33
  }