koatty_validation 1.2.2 → 1.2.3

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.2.3](https://github.com/koatty/koatty_validation/compare/v1.2.2...v1.2.3) (2022-03-09)
6
+
5
7
  ### [1.2.2](https://github.com/koatty/koatty_validation/compare/v1.2.0...v1.2.2) (2022-02-25)
6
8
 
7
9
  ## [1.2.0](https://github.com/koatty/koatty_validation/compare/v1.1.0...v1.2.0) (2022-02-25)
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2022-02-25 10:59:08
3
+ * @Date: 2022-03-09 18:25:00
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2022-02-25 10:58:54
3
+ * @Date: 2022-03-09 18:24:48
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -314,7 +314,7 @@ function plateNumber(value) {
314
314
  * @Usage:
315
315
  * @Author: richen
316
316
  * @Date: 2021-11-25 10:47:04
317
- * @LastEditTime: 2022-02-25 10:33:20
317
+ * @LastEditTime: 2022-03-09 18:23:18
318
318
  */
319
319
  // constant
320
320
  const PARAM_TYPE_KEY = 'PARAM_TYPE_KEY';
@@ -629,7 +629,7 @@ Object.keys(ValidFuncs).forEach((key) => {
629
629
  if (helper__namespace.isString(options)) {
630
630
  options = { message: options, value: null };
631
631
  }
632
- if (!ValidFuncs[key](value, options)) {
632
+ if (!ValidFuncs[key](value, options.value)) {
633
633
  throw new Error(options.message || `ValidatorError: invalid arguments.`);
634
634
  }
635
635
  };
@@ -640,7 +640,7 @@ Object.keys(ValidFuncs).forEach((key) => {
640
640
  * @Usage:
641
641
  * @Author: richen
642
642
  * @Date: 2021-11-25 10:46:57
643
- * @LastEditTime: 2022-02-24 15:33:34
643
+ * @LastEditTime: 2022-03-02 11:23:27
644
644
  */
645
645
  /**
646
646
  * Validation parameter's type and values.
@@ -660,9 +660,10 @@ function Valid(rule, options) {
660
660
  rules = rule;
661
661
  }
662
662
  return (target, propertyKey, descriptor) => {
663
+ var _a;
663
664
  // 获取成员参数类型
664
665
  const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyKey);
665
- const type = (paramTypes[descriptor] && paramTypes[descriptor].name) ? paramTypes[descriptor].name : "object";
666
+ const type = ((_a = paramTypes[descriptor]) === null || _a === void 0 ? void 0 : _a.name) ? paramTypes[descriptor].name : 'object';
666
667
  if (helper__namespace.isString(options)) {
667
668
  options = { message: options, value: null };
668
669
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2022-02-25 10:58:54
3
+ * @Date: 2022-03-09 18:24:48
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -290,7 +290,7 @@ function plateNumber(value) {
290
290
  * @Usage:
291
291
  * @Author: richen
292
292
  * @Date: 2021-11-25 10:47:04
293
- * @LastEditTime: 2022-02-25 10:33:20
293
+ * @LastEditTime: 2022-03-09 18:23:18
294
294
  */
295
295
  // constant
296
296
  const PARAM_TYPE_KEY = 'PARAM_TYPE_KEY';
@@ -605,7 +605,7 @@ Object.keys(ValidFuncs).forEach((key) => {
605
605
  if (helper.isString(options)) {
606
606
  options = { message: options, value: null };
607
607
  }
608
- if (!ValidFuncs[key](value, options)) {
608
+ if (!ValidFuncs[key](value, options.value)) {
609
609
  throw new Error(options.message || `ValidatorError: invalid arguments.`);
610
610
  }
611
611
  };
@@ -616,7 +616,7 @@ Object.keys(ValidFuncs).forEach((key) => {
616
616
  * @Usage:
617
617
  * @Author: richen
618
618
  * @Date: 2021-11-25 10:46:57
619
- * @LastEditTime: 2022-02-24 15:33:34
619
+ * @LastEditTime: 2022-03-02 11:23:27
620
620
  */
621
621
  /**
622
622
  * Validation parameter's type and values.
@@ -636,9 +636,10 @@ function Valid(rule, options) {
636
636
  rules = rule;
637
637
  }
638
638
  return (target, propertyKey, descriptor) => {
639
+ var _a;
639
640
  // 获取成员参数类型
640
641
  const paramTypes = Reflect.getMetadata("design:paramtypes", target, propertyKey);
641
- const type = (paramTypes[descriptor] && paramTypes[descriptor].name) ? paramTypes[descriptor].name : "object";
642
+ const type = ((_a = paramTypes[descriptor]) === null || _a === void 0 ? void 0 : _a.name) ? paramTypes[descriptor].name : 'object';
642
643
  if (helper.isString(options)) {
643
644
  options = { message: options, value: null };
644
645
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty_validation",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Validation Util for Koatty and ThinkORM.",
5
5
  "scripts": {
6
6
  "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
@@ -1 +1 @@
1
- window.jest_html_reporters_callback__({"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":1,"numPassedTests":2,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":1,"numTotalTests":2,"startTime":1645757930020,"success":false,"testResults":[{"leaks":false,"numFailingTests":0,"numPassingTests":2,"numPendingTests":0,"numTodoTests":0,"perfStats":{"end":1645757932136,"runtime":2047,"slow":false,"start":1645757930089},"skipped":false,"testFilePath":"/Users/richen/Workspace/nodejs/koatty_validation/test/.test.ts","testResults":[{"ancestorTitles":["koatty_validation"],"duration":47,"failureDetails":[],"failureMessages":[],"fullName":"koatty_validation FunctionValidator","invocations":1,"location":null,"numPassingAsserts":0,"status":"passed","title":"FunctionValidator"},{"ancestorTitles":["koatty_validation"],"duration":5,"failureDetails":[],"failureMessages":[],"fullName":"koatty_validation ClassValidator","invocations":1,"location":null,"numPassingAsserts":0,"status":"passed","title":"ClassValidator"}],"failureMessage":null}],"wasInterrupted":false,"config":{"bail":0,"changedFilesWithAncestor":false,"collectCoverage":true,"collectCoverageFrom":[],"coverageDirectory":"coverage","coverageProvider":"babel","coverageReporters":["html","lcov","json","text","clover","text-summary"],"detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"expand":false,"findRelatedTests":false,"forceExit":false,"json":false,"lastCommit":false,"listTests":false,"logHeapUsage":false,"maxConcurrency":5,"maxWorkers":7,"noStackTrace":false,"nonFlagArgs":[],"notify":false,"notifyMode":"failure-change","onlyChanged":false,"onlyFailures":false,"passWithNoTests":true,"projects":[],"reporters":[["default",{}],["/Users/richen/Workspace/nodejs/koatty_validation/node_modules/jest-html-reporters/index.js",{}]],"rootDir":"/Users/richen/Workspace/nodejs/koatty_validation","runTestsByPath":false,"skipFilter":false,"testFailureExitCode":1,"testPathPattern":"","testSequencer":"/Users/richen/Workspace/nodejs/koatty_validation/node_modules/@jest/test-sequencer/build/index.js","updateSnapshot":"new","useStderr":false,"verbose":true,"watch":false,"watchAll":false,"watchman":true},"endTime":1645757932333,"_reporterOptions":{"publicPath":"/Users/richen/Workspace/nodejs/koatty_validation","filename":"jest_html_reporters.html","expand":false,"pageTitle":"","hideIcon":false,"testCommand":"npx jest","openReport":false,"failureMessageOnly":false,"enableMergeData":false,"dataMergeLevel":1},"attachInfos":{}})
1
+ window.jest_html_reporters_callback__({"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":1,"numPassedTests":2,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":1,"numTotalTests":2,"startTime":1646821485222,"success":false,"testResults":[{"leaks":false,"numFailingTests":0,"numPassingTests":2,"numPendingTests":0,"numTodoTests":0,"perfStats":{"end":1646821486984,"runtime":1684,"slow":false,"start":1646821485300},"skipped":false,"testFilePath":"/Users/richen/Workspace/nodejs/koatty_validation/test/.test.ts","testResults":[{"ancestorTitles":["koatty_validation"],"duration":20,"failureDetails":[],"failureMessages":[],"fullName":"koatty_validation FunctionValidator","invocations":1,"location":null,"numPassingAsserts":0,"status":"passed","title":"FunctionValidator"},{"ancestorTitles":["koatty_validation"],"duration":2,"failureDetails":[],"failureMessages":[],"fullName":"koatty_validation ClassValidator","invocations":1,"location":null,"numPassingAsserts":0,"status":"passed","title":"ClassValidator"}],"failureMessage":null}],"wasInterrupted":false,"config":{"bail":0,"changedFilesWithAncestor":false,"collectCoverage":true,"collectCoverageFrom":[],"coverageDirectory":"coverage","coverageProvider":"babel","coverageReporters":["html","lcov","json","text","clover","text-summary"],"detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"expand":false,"findRelatedTests":false,"forceExit":false,"json":false,"lastCommit":false,"listTests":false,"logHeapUsage":false,"maxConcurrency":5,"maxWorkers":7,"noStackTrace":false,"nonFlagArgs":[],"notify":false,"notifyMode":"failure-change","onlyChanged":false,"onlyFailures":false,"passWithNoTests":true,"projects":[],"reporters":[["default",{}],["/Users/richen/Workspace/nodejs/koatty_validation/node_modules/jest-html-reporters/index.js",{}]],"rootDir":"/Users/richen/Workspace/nodejs/koatty_validation","runTestsByPath":false,"skipFilter":false,"testFailureExitCode":1,"testPathPattern":"","testSequencer":"/Users/richen/Workspace/nodejs/koatty_validation/node_modules/@jest/test-sequencer/build/index.js","updateSnapshot":"new","useStderr":false,"verbose":true,"watch":false,"watchAll":false,"watchman":true},"endTime":1646821487107,"_reporterOptions":{"publicPath":"/Users/richen/Workspace/nodejs/koatty_validation","filename":"jest_html_reporters.html","expand":false,"pageTitle":"","hideIcon":false,"testCommand":"npx jest","openReport":false,"failureMessageOnly":false,"enableMergeData":false,"dataMergeLevel":1},"attachInfos":{}})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty_validation",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Validation Util for Koatty and ThinkORM.",
5
5
  "scripts": {
6
6
  "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",