koatty_validation 1.3.4 → 1.4.0
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/.rollup.config.js +62 -62
- package/.vscode/launch.json +81 -0
- package/CHANGELOG.md +83 -73
- package/LICENSE +29 -29
- package/README.md +363 -116
- package/coverage.lcov +1607 -0
- package/dist/LICENSE +29 -29
- package/dist/README.md +363 -116
- package/dist/index.d.ts +421 -219
- package/dist/index.js +785 -651
- package/dist/index.mjs +767 -649
- package/dist/package.json +91 -91
- package/examples/README.md +90 -0
- package/examples/basic-usage.ts +239 -0
- package/examples/custom-decorators-example.ts +230 -0
- package/examples/usage-example.ts +284 -0
- package/package.json +91 -91
package/.rollup.config.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Usage:
|
|
4
|
-
* @Author: richen
|
|
5
|
-
* @Date: 2021-12-17 10:20:44
|
|
6
|
-
* @LastEditTime: 2021-12-18 11:58:46
|
|
7
|
-
*/
|
|
8
|
-
import json from "@rollup/plugin-json";
|
|
9
|
-
import typescript from 'rollup-plugin-typescript2';
|
|
10
|
-
// import babel from '@rollup/plugin-babel';
|
|
11
|
-
|
|
12
|
-
export default [
|
|
13
|
-
{
|
|
14
|
-
input: './src/index.ts',
|
|
15
|
-
output: [{
|
|
16
|
-
format: 'cjs',
|
|
17
|
-
file: './dist/index.js',
|
|
18
|
-
banner: require('./scripts/copyright')
|
|
19
|
-
}],
|
|
20
|
-
plugins: [
|
|
21
|
-
// babel({
|
|
22
|
-
// babelHelpers: "runtime",
|
|
23
|
-
// configFile: './babel.config.js',
|
|
24
|
-
// exclude: 'node_modules/**',
|
|
25
|
-
// }),
|
|
26
|
-
json(),
|
|
27
|
-
typescript({
|
|
28
|
-
tsconfigOverride: {
|
|
29
|
-
compilerOptions: {
|
|
30
|
-
declaration: false,
|
|
31
|
-
declarationMap: false,
|
|
32
|
-
module: "ESNext"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
input: './src/index.ts',
|
|
40
|
-
output: [{
|
|
41
|
-
format: 'es',
|
|
42
|
-
file: './dist/index.mjs',
|
|
43
|
-
banner: require('./scripts/copyright')
|
|
44
|
-
}],
|
|
45
|
-
plugins: [
|
|
46
|
-
// babel({
|
|
47
|
-
// babelHelpers: "runtime",
|
|
48
|
-
// configFile: './babel.config.js',
|
|
49
|
-
// exclude: 'node_modules/**',
|
|
50
|
-
// }),
|
|
51
|
-
json(),
|
|
52
|
-
typescript({
|
|
53
|
-
tsconfigOverride: {
|
|
54
|
-
compilerOptions: {
|
|
55
|
-
declaration: false,
|
|
56
|
-
declarationMap: false,
|
|
57
|
-
module: "ESNext"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* @Description:
|
|
3
|
+
* @Usage:
|
|
4
|
+
* @Author: richen
|
|
5
|
+
* @Date: 2021-12-17 10:20:44
|
|
6
|
+
* @LastEditTime: 2021-12-18 11:58:46
|
|
7
|
+
*/
|
|
8
|
+
import json from "@rollup/plugin-json";
|
|
9
|
+
import typescript from 'rollup-plugin-typescript2';
|
|
10
|
+
// import babel from '@rollup/plugin-babel';
|
|
11
|
+
|
|
12
|
+
export default [
|
|
13
|
+
{
|
|
14
|
+
input: './src/index.ts',
|
|
15
|
+
output: [{
|
|
16
|
+
format: 'cjs',
|
|
17
|
+
file: './dist/index.js',
|
|
18
|
+
banner: require('./scripts/copyright')
|
|
19
|
+
}],
|
|
20
|
+
plugins: [
|
|
21
|
+
// babel({
|
|
22
|
+
// babelHelpers: "runtime",
|
|
23
|
+
// configFile: './babel.config.js',
|
|
24
|
+
// exclude: 'node_modules/**',
|
|
25
|
+
// }),
|
|
26
|
+
json(),
|
|
27
|
+
typescript({
|
|
28
|
+
tsconfigOverride: {
|
|
29
|
+
compilerOptions: {
|
|
30
|
+
declaration: false,
|
|
31
|
+
declarationMap: false,
|
|
32
|
+
module: "ESNext"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
input: './src/index.ts',
|
|
40
|
+
output: [{
|
|
41
|
+
format: 'es',
|
|
42
|
+
file: './dist/index.mjs',
|
|
43
|
+
banner: require('./scripts/copyright')
|
|
44
|
+
}],
|
|
45
|
+
plugins: [
|
|
46
|
+
// babel({
|
|
47
|
+
// babelHelpers: "runtime",
|
|
48
|
+
// configFile: './babel.config.js',
|
|
49
|
+
// exclude: 'node_modules/**',
|
|
50
|
+
// }),
|
|
51
|
+
json(),
|
|
52
|
+
typescript({
|
|
53
|
+
tsconfigOverride: {
|
|
54
|
+
compilerOptions: {
|
|
55
|
+
declaration: false,
|
|
56
|
+
declarationMap: false,
|
|
57
|
+
module: "ESNext"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
63
|
]
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"configurations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Launch Koatty Project",
|
|
5
|
+
"type": "node",
|
|
6
|
+
"request": "launch",
|
|
7
|
+
"args": [
|
|
8
|
+
"${workspaceRoot}/src/App.ts"
|
|
9
|
+
],
|
|
10
|
+
"runtimeArgs": [
|
|
11
|
+
"--nolazy",
|
|
12
|
+
"-r",
|
|
13
|
+
"ts-node/register"
|
|
14
|
+
],
|
|
15
|
+
"envFile": "/Users/richen/Workspace/.env",
|
|
16
|
+
"sourceMaps": true,
|
|
17
|
+
"cwd": "${workspaceRoot}",
|
|
18
|
+
"protocol": "inspector",
|
|
19
|
+
"internalConsoleOptions": "neverOpen"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "Launch GoPackage",
|
|
23
|
+
"type": "go",
|
|
24
|
+
"request": "launch",
|
|
25
|
+
"mode": "auto",
|
|
26
|
+
"program": "${workspaceFolder}/main.go",
|
|
27
|
+
"envFile": "/Users/richen/Workspace/.env",
|
|
28
|
+
"args": []
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "Launch Java Project",
|
|
32
|
+
"type": "java",
|
|
33
|
+
"request": "launch",
|
|
34
|
+
"mainClass": "",
|
|
35
|
+
"envFile": "/Users/richen/Workspace/.env"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "Launch Node.js Project",
|
|
39
|
+
"type": "node",
|
|
40
|
+
"request": "launch",
|
|
41
|
+
"mode": "auto",
|
|
42
|
+
"program": "${workspaceFolder}/app.js",
|
|
43
|
+
"envFile": "/Users/richen/Workspace/.env",
|
|
44
|
+
"args": []
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "Launch Typescript Project",
|
|
48
|
+
"type": "node",
|
|
49
|
+
"request": "launch",
|
|
50
|
+
"args": [
|
|
51
|
+
"${workspaceRoot}/src/index.ts"
|
|
52
|
+
],
|
|
53
|
+
"runtimeArgs": [
|
|
54
|
+
"--nolazy",
|
|
55
|
+
"-r",
|
|
56
|
+
"ts-node/register"
|
|
57
|
+
],
|
|
58
|
+
"envFile": "/Users/richen/Workspace/.env",
|
|
59
|
+
"sourceMaps": true,
|
|
60
|
+
"cwd": "${workspaceRoot}",
|
|
61
|
+
"protocol": "inspector",
|
|
62
|
+
"internalConsoleOptions": "neverOpen"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "node",
|
|
66
|
+
"name": "vscode-jest-tests",
|
|
67
|
+
"request": "launch",
|
|
68
|
+
"console": "integratedTerminal",
|
|
69
|
+
"internalConsoleOptions": "neverOpen",
|
|
70
|
+
"disableOptimisticBPs": true,
|
|
71
|
+
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
|
72
|
+
"cwd": "${workspaceFolder}",
|
|
73
|
+
"args": [
|
|
74
|
+
"--config",
|
|
75
|
+
"jest.config.js",
|
|
76
|
+
"--runInBand",
|
|
77
|
+
"--watchAll=false"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,76 +2,86 @@
|
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
###
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
###
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
5
|
+
## [1.4.0](https://github.com/koatty/koatty_validation/compare/v1.3.2...v1.4.0) (2025-06-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add validation examples and decorator factory ([d448709](https://github.com/koatty/koatty_validation/commit/d44870987a808cd43c5a7ed5fabd5ca43162d0b6))
|
|
11
|
+
|
|
12
|
+
### [1.3.2](https://github.com/koatty/koatty_validation/compare/v1.3.1...v1.3.2) (2024-01-14)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* deps ([6da3e43](https://github.com/koatty/koatty_validation/commit/6da3e437c946c9de2fc45f5319768fef0c4609b0))
|
|
18
|
+
|
|
19
|
+
### [1.3.1](https://github.com/koatty/koatty_validation/compare/v1.3.0...v1.3.1) (2024-01-07)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* comment ([d898cf6](https://github.com/koatty/koatty_validation/commit/d898cf68bc8693f78155b7208b419dc4b11dffb4))
|
|
25
|
+
* dto赋值类型 ([5a1d68d](https://github.com/koatty/koatty_validation/commit/5a1d68dea0b67e988427c54abae9bfe76a6eaf48))
|
|
26
|
+
|
|
27
|
+
## [1.3.0](https://github.com/koatty/koatty_validation/compare/v1.2.10...v1.3.0) (2024-01-03)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* 增加@CheckFunc ([d5bdc2d](https://github.com/koatty/koatty_validation/commit/d5bdc2d51cdbf6d558e376bfda51e126158d4e75))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* export ValidFuncs ([7d42023](https://github.com/koatty/koatty_validation/commit/7d42023138e9577c9646423c4c38faffba46fb10))
|
|
38
|
+
|
|
39
|
+
### [1.2.10](https://github.com/koatty/koatty_validation/compare/v1.2.9...v1.2.10) (2023-12-16)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* assign dto property ([2357642](https://github.com/koatty/koatty_validation/commit/2357642f6ac1479c839454d40ec4bd89f3fbd7b2))
|
|
45
|
+
|
|
46
|
+
### [1.2.9](https://github.com/koatty/koatty_validation/compare/v1.2.8...v1.2.9) (2023-09-01)
|
|
47
|
+
|
|
48
|
+
### [1.2.8](https://github.com/koatty/koatty_validation/compare/v1.2.7...v1.2.8) (2023-02-17)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* convert type ([924449d](https://github.com/koatty/koatty_validation/commit/924449d9f5fd7b14cbe3c1532f96416e69cc4eed))
|
|
54
|
+
|
|
55
|
+
### [1.2.7](https://github.com/koatty/koatty_validation/compare/v1.2.6...v1.2.7) (2023-02-17)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Bug Fixes
|
|
59
|
+
|
|
60
|
+
* add script ([ca82c14](https://github.com/koatty/koatty_validation/commit/ca82c14b0a2226024fb2c4476ba7353be7a2f65a))
|
|
61
|
+
* plainToClass convert type ([06ed46e](https://github.com/koatty/koatty_validation/commit/06ed46e21ce191dc1c9f5c18ee7d029e9b6d4abf))
|
|
62
|
+
|
|
63
|
+
### [1.2.6](https://github.com/koatty/koatty_validation/compare/v1.2.5...v1.2.6) (2023-01-09)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* err msg ([18632d4](https://github.com/koatty/koatty_validation/commit/18632d4c9b05b1d117be7f8170da0ce014018ab8))
|
|
69
|
+
|
|
70
|
+
### [1.2.5](https://github.com/koatty/koatty_validation/compare/v1.2.4...v1.2.5) (2022-08-19)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Bug Fixes
|
|
74
|
+
|
|
75
|
+
* merge ([52c65f4](https://github.com/koatty/koatty_validation/commit/52c65f41c46a02a3fc5735e6e22ee6a3ed5337f8))
|
|
76
|
+
|
|
77
|
+
### [1.2.4](https://github.com/koatty/koatty_validation/compare/v1.2.3...v1.2.4) (2022-05-27)
|
|
78
|
+
|
|
79
|
+
### [1.2.3](https://github.com/koatty/koatty_validation/compare/v1.2.2...v1.2.3) (2022-03-09)
|
|
80
|
+
|
|
81
|
+
### [1.2.2](https://github.com/koatty/koatty_validation/compare/v1.2.0...v1.2.2) (2022-02-25)
|
|
82
|
+
|
|
83
|
+
## [1.2.0](https://github.com/koatty/koatty_validation/compare/v1.1.0...v1.2.0) (2022-02-25)
|
|
84
|
+
|
|
85
|
+
## [1.1.0](https://github.com/koatty/koatty_validation/compare/v1.0.12...v1.1.0) (2022-02-16)
|
|
86
|
+
|
|
87
|
+
## [2.0.0](https://github.com/koatty/koatty_validation/compare/v1.0.12...v2.0.0) (2022-02-16)
|
package/LICENSE
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020, Koatty
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020, Koatty
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|