@midwayjs/validate 4.0.0-beta.7 → 4.0.0-beta.9

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.
@@ -17,6 +17,8 @@ const i18n = require("@midwayjs/i18n");
17
17
  const pipe_1 = require("./pipe");
18
18
  const constants_1 = require("./constants");
19
19
  let ValidateConfiguration = class ValidateConfiguration {
20
+ decoratorService;
21
+ validateService;
20
22
  async init() {
21
23
  this.decoratorService.registerParameterHandler(constants_1.VALID_KEY, ({ parameterIndex, originParamType, originArgs, metadata }) => {
22
24
  if (!metadata.schema) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RuleType = exports.Rule = void 0;
3
+ exports.RuleType = void 0;
4
+ exports.Rule = Rule;
4
5
  const Joi = require("joi");
5
6
  exports.RuleType = Joi;
6
7
  const core_1 = require("@midwayjs/core");
@@ -12,5 +13,4 @@ function Rule(rule) {
12
13
  }
13
14
  };
14
15
  }
15
- exports.Rule = Rule;
16
16
  //# sourceMappingURL=rule.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Valid = void 0;
3
+ exports.Valid = Valid;
4
4
  const core_1 = require("@midwayjs/core");
5
5
  const constants_1 = require("../constants");
6
6
  const pipe_1 = require("../pipe");
@@ -18,5 +18,4 @@ function Valid(schemaOrPipes, pipes) {
18
18
  pipes: [pipe_1.DecoratorValidPipe, ...pipes],
19
19
  });
20
20
  }
21
- exports.Valid = Valid;
22
21
  //# sourceMappingURL=valid.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Validate = void 0;
3
+ exports.Validate = Validate;
4
4
  const core_1 = require("@midwayjs/core");
5
5
  const constants_1 = require("../constants");
6
6
  function Validate(options = {}) {
@@ -8,5 +8,4 @@ function Validate(options = {}) {
8
8
  core_1.MetadataManager.defineMetadata(constants_1.VALIDATE_KEY, options, target, methodName);
9
9
  };
10
10
  }
11
- exports.Validate = Validate;
12
11
  //# sourceMappingURL=validate.js.map
package/dist/dtoHelper.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OmitDto = exports.PickDto = void 0;
3
+ exports.PickDto = PickDto;
4
+ exports.OmitDto = OmitDto;
4
5
  const core_1 = require("@midwayjs/core");
5
6
  const constants_1 = require("./constants");
6
7
  function PickDto(dto, keys) {
@@ -13,7 +14,6 @@ function PickDto(dto, keys) {
13
14
  });
14
15
  return pickedDto;
15
16
  }
16
- exports.PickDto = PickDto;
17
17
  function OmitDto(dto, keys) {
18
18
  const pickedDto = function () { };
19
19
  pickedDto.prototype = dto.prototype;
@@ -24,5 +24,4 @@ function OmitDto(dto, keys) {
24
24
  });
25
25
  return pickedDto;
26
26
  }
27
- exports.OmitDto = OmitDto;
28
27
  //# sourceMappingURL=dtoHelper.js.map
package/dist/pipe.js CHANGED
@@ -16,6 +16,7 @@ const i18n = require("@midwayjs/i18n");
16
16
  const constants_1 = require("./constants");
17
17
  const Joi = require("joi");
18
18
  class AbstractValidationPipe {
19
+ validateService;
19
20
  validateWithSchema(value, options, schema) {
20
21
  const validateOptions = this.parseValidationOptions(options);
21
22
  const result = this.validateService.validateWithSchema(schema, value, validateOptions);
@@ -26,7 +27,10 @@ class AbstractValidationPipe {
26
27
  }
27
28
  validate(value, options) {
28
29
  const validateOptions = this.parseValidationOptions(options);
29
- if (options.metaType.isBaseType) {
30
+ if (options.metaType.isBaseType ||
31
+ !options.metaType.originDesign ||
32
+ options.metadata?.type === 'files_stream' ||
33
+ options.metadata?.type === 'file_stream') {
30
34
  return value;
31
35
  }
32
36
  const result = this.validateService.validate(options.metaType.originDesign, value, validateOptions);
@@ -103,6 +107,7 @@ exports.ParseFloatPipe = ParseFloatPipe = __decorate([
103
107
  (0, core_1.Pipe)()
104
108
  ], ParseFloatPipe);
105
109
  class DefaultValuePipe {
110
+ defaultValue;
106
111
  constructor(defaultValue) {
107
112
  this.defaultValue = defaultValue;
108
113
  }
package/dist/service.js CHANGED
@@ -9,7 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getSchema = exports.ValidateService = void 0;
12
+ exports.ValidateService = void 0;
13
+ exports.getSchema = getSchema;
13
14
  const core_1 = require("@midwayjs/core");
14
15
  const DefaultConfig = require("./config/config.default");
15
16
  const constants_1 = require("./constants");
@@ -17,9 +18,10 @@ const Joi = require("joi");
17
18
  const i18n_1 = require("@midwayjs/i18n");
18
19
  const error_1 = require("./error");
19
20
  let ValidateService = class ValidateService {
20
- constructor() {
21
- this.messages = {};
22
- }
21
+ validateConfig;
22
+ i18nConfig;
23
+ i18nService;
24
+ messages = {};
23
25
  async init() {
24
26
  const locales = Object.keys(DefaultConfig.i18n.localeTable);
25
27
  locales.forEach(locale => {
@@ -82,5 +84,4 @@ function getSchema(ClzType) {
82
84
  return Joi.object(rules);
83
85
  }
84
86
  }
85
- exports.getSchema = getSchema;
86
87
  //# sourceMappingURL=service.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/validate",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.9",
4
4
  "description": "Midway Component for validation (using @midwayjs/validation first)",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -23,14 +23,14 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@midwayjs/i18n": "^4.0.0-beta.7",
26
+ "@midwayjs/i18n": "^4.0.0-beta.9",
27
27
  "joi": "17.13.3"
28
28
  },
29
29
  "devDependencies": {
30
- "@midwayjs/core": "^4.0.0-beta.7",
31
- "@midwayjs/express": "^4.0.0-beta.7",
32
- "@midwayjs/koa": "^4.0.0-beta.7",
33
- "@midwayjs/mock": "^4.0.0-beta.7"
30
+ "@midwayjs/core": "^4.0.0-beta.9",
31
+ "@midwayjs/express": "^4.0.0-beta.9",
32
+ "@midwayjs/koa": "^4.0.0-beta.9",
33
+ "@midwayjs/mock": "^4.0.0-beta.9"
34
34
  },
35
- "gitHead": "6a221788112b4d998b3958e0a275579f42816c59"
35
+ "gitHead": "771e83974ef9f3d78c296e4ee0c8c68db44f6b31"
36
36
  }