vest 4.0.0-dev-cc5cf5 → 4.0.0-dev-31f012
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 +52 -44
- package/README.md +7 -1
- package/dist/cjs/classnames.development.js +3 -3
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/promisify.development.js +1 -1
- package/dist/cjs/promisify.production.js +1 -1
- package/dist/cjs/vest.development.js +394 -180
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +3 -3
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/promisify.development.js +1 -1
- package/dist/es/promisify.production.js +1 -1
- package/dist/es/vest.development.js +394 -180
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +3 -3
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/promisify.development.js +1 -1
- package/dist/umd/promisify.production.js +1 -1
- package/dist/umd/vest.development.js +394 -180
- package/dist/umd/vest.production.js +1 -1
- package/package.json +1 -1
- package/testUtils/testObjects.ts +11 -2
- package/types/classnames.d.ts +2 -2
- package/types/vest.d.ts +10 -3
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -107
- package/docs/_assets/favicon.ico +0 -0
- package/docs/_assets/vest-logo.png +0 -0
- package/docs/_sidebar.md +0 -14
- package/docs/cross_field_validations.md +0 -34
- package/docs/enforce.md +0 -11
- package/docs/exclusion.md +0 -129
- package/docs/getting_started.md +0 -72
- package/docs/group.md +0 -142
- package/docs/index.html +0 -41
- package/docs/migration.md +0 -202
- package/docs/n4s/rules.md +0 -1282
- package/docs/node.md +0 -36
- package/docs/optional.md +0 -103
- package/docs/result.md +0 -249
- package/docs/state.md +0 -102
- package/docs/test.md +0 -172
- package/docs/utilities.md +0 -109
- package/docs/warn.md +0 -82
package/CHANGELOG.md
CHANGED
|
@@ -4,67 +4,75 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## 4.0.0 - 2021-10-
|
|
7
|
+
## 4.0.0 - 2021-10-31
|
|
8
8
|
### Changed or removed
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- 6224c32 breaking(vest, enforce): prepare next major (ealush)
|
|
9
|
+
- f5ba507 major(context): used named export in context (ealush)
|
|
10
|
+
- eaed68f breaking(vest, enforce): prepare next major (ealush)
|
|
12
11
|
|
|
13
12
|
### Added
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
13
|
+
- e0f0f91 feat(vest): support custom optional logic (ealush)
|
|
14
|
+
- d4fecee feat(vest): Add a parser export (ealush)
|
|
15
|
+
- e72498d feat(vest): isValid with field name (ealush)
|
|
16
|
+
- f60d952 feat(vest): handle execution order state refill with memoized tests (ealush)
|
|
17
|
+
- a2b60c4 feat(vest): Make the state rely on execution order. Make skipWhen set skipped context. (undefined)
|
|
18
|
+
- ae5eb02 added(n4s): partial rule modifier (undefined)
|
|
19
|
+
- 990c68f feat(n4s): context propagation within enforce (undefined)
|
|
21
20
|
|
|
22
21
|
### Fixed and improved
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
22
|
+
- 31f0123 patch(vest): move creation functions to event bus (ealush)
|
|
23
|
+
- d23641c patch: Some cleanups (ealush)
|
|
24
|
+
- 7acb76f fix(vest): prevent pending tests from being marked as skipped (ealush)
|
|
25
|
+
- 8851ff5 patch(vest): Add isolate module for containing re-orders (ealush)
|
|
26
|
+
- 0593c0f patch(vest): refresh tests after cancel (ealush)
|
|
27
|
+
- e915b53 patch: add cursor util (ealush)
|
|
28
|
+
- f54ae8b patch(vest): move cursor into context (ealush)
|
|
29
|
+
- fc7627e patch(vest): automatically purge not-found test results (ealush)
|
|
30
|
+
- d68d990 vx: correctly pass cli options to build script (ealush)
|
|
31
|
+
- 7c47b9a patch(vest): Throw error when tests are called in the wrong order (ealush)
|
|
32
|
+
- 01be84e vx: add types to exports (ealush)
|
|
33
|
+
- 7201170 organize vest state hooks (ealush)
|
|
34
|
+
- e39bfd8 patch(vest): infer omitted optional fields (ealush)
|
|
35
|
+
- 93014e3 vx: add dev bundle to exports (ealush)
|
|
36
|
+
- 91df42e fix(vest): prevent changing test status once it was finalized (ealush)
|
|
37
|
+
- 797df3e patch(vest): add cache invalidation for canceled tests (ealush)
|
|
38
|
+
- 14ba6d9 types(vest): add safeguard around shouldUseErrorAsMessage (ealush)
|
|
39
|
+
- 477ca00 patch(vest): some cleanups (ealush)
|
|
40
|
+
- 58d5ed3 patch(vest): remove duplicate code handling perv test registration (ealush)
|
|
41
|
+
- 6a98443 vx: use context directly from published package (ealush)
|
|
42
|
+
- a79e479 patch: run done callbacks via event (ealush)
|
|
43
|
+
- 01d32b7 patch(vest): removed state subscription (ealush)
|
|
36
44
|
- package.json
|
|
37
45
|
- packages/anyone/package.json
|
|
38
46
|
- packages/anyone/package.json
|
|
39
47
|
- packages/vast/types/vast.d.ts
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
48
|
+
- b10b98b patch(vest): remove pending and lagging state (ealush)
|
|
49
|
+
- dfd2cc3 patch(vest): convert boolean flags to a single status key (ealush)
|
|
50
|
+
- 1c9da6c patch: simplify fieldname comparison (ealush)
|
|
51
|
+
- 43c75a4 patch(vest): add useAllIncomplete hook (ealush)
|
|
52
|
+
- 2dfdc97 patch(vest): invalid accounts for warning tests as well (ealush)
|
|
53
|
+
- 4033cca patch(vest): isValid counts all required tests per field (ealush)
|
|
54
|
+
- 02b28a6 chore: cleanups (ealush)
|
|
47
55
|
- .eslintrc.js
|
|
48
|
-
-
|
|
56
|
+
- afa16e9 add(n4s): enforce.condition (ealush)
|
|
49
57
|
- package.json
|
|
50
58
|
- packages/anyone/package.json
|
|
51
|
-
-
|
|
52
|
-
-
|
|
59
|
+
- d452e26 chore: cleanup residue (undefined)
|
|
60
|
+
- 5982183 chore: remove duplicate types (undefined)
|
|
53
61
|
- packages/anyone/package.json
|
|
54
|
-
-
|
|
55
|
-
-
|
|
62
|
+
- 52ac8e0 patch: add nodejs exports (undefined)
|
|
63
|
+
- f9c4b3e patch: remove unused exports (undefined)
|
|
56
64
|
- packages/anyone/package.json
|
|
57
|
-
-
|
|
65
|
+
- db0253b chore: reduce complexity, remove all lint errors (undefined)
|
|
58
66
|
- packages/anyone/.npmignore
|
|
59
67
|
- .github/PULL_REQUEST_TEMPLATE.md
|
|
60
|
-
-
|
|
61
|
-
-
|
|
68
|
+
- be9c776 chore: cleanup unused code (ealush)
|
|
69
|
+
- c5eb2de lint: handling lint of all packages (ealush)
|
|
62
70
|
- .gitignore
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
71
|
+
- d388fdc patch(n4s): add ruleReturn default values (ealush)
|
|
72
|
+
- be91b7e fix(n4s): make enforce compound runners fall back to correct response (ealush)
|
|
73
|
+
- 7e8f25c fix(n4s): make enforce chaining work (ealush)
|
|
74
|
+
- e60ce3b chore: some lint fixes (ealush)
|
|
75
|
+
- fc8e2d8 add cli options support (ealush)
|
|
68
76
|
|
|
69
77
|
## 3.2.7 - 2021-07-17
|
|
70
78
|
|
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Vest tries to remediate this by separating validation logic from feature logic s
|
|
|
62
62
|
## Example code ([Run in sandbox](https://codesandbox.io/s/vest-react-tutorial-finished-ztt8t?file=/src/validate.js))
|
|
63
63
|
|
|
64
64
|
```js
|
|
65
|
-
import { create, only, test, enforce, warn } from 'vest';
|
|
65
|
+
import { create, only, test, enforce, warn, skipWhen } from 'vest';
|
|
66
66
|
|
|
67
67
|
export default create((data = {}, currentField) => {
|
|
68
68
|
only(currentField);
|
|
@@ -88,6 +88,12 @@ export default create((data = {}, currentField) => {
|
|
|
88
88
|
enforce(data.password).matches(/[0-9]/);
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
skipWhen(!data.password, () => {
|
|
92
|
+
test('confirm_password', 'Passwords do not match', () => {
|
|
93
|
+
enforce(data.confirm_password).equals(data.password);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
91
97
|
test('email', 'Email Address is not valid', () => {
|
|
92
98
|
enforce(data.email).isEmail();
|
|
93
99
|
});
|
|
@@ -56,10 +56,10 @@ function parse(res) {
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates a function that returns class names that match the validation result
|
|
58
58
|
*/
|
|
59
|
-
function
|
|
59
|
+
function classnames(res, classes) {
|
|
60
60
|
if (classes === void 0) { classes = {}; }
|
|
61
61
|
if (!res || !isFunction(res.hasErrors)) {
|
|
62
|
-
throwError("
|
|
62
|
+
throwError("classnames: Expected first argument to be Vest's result object.");
|
|
63
63
|
}
|
|
64
64
|
var selectors = parse(res);
|
|
65
65
|
return function (key) {
|
|
@@ -74,4 +74,4 @@ function classNames(res, classes) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
module.exports =
|
|
77
|
+
module.exports = classnames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t){return"function"==typeof t}function r(r,n){var e;return null!==(e=function(r){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t(r)?r.apply(void 0,n):r}(r))&&void 0!==e?e:n}function n(t){var r=Number(t);return!(isNaN(parseFloat(String(t)))||isNaN(Number(t))||!isFinite(r))}function e(t,r){return n(t)&&n(r)&&Number(t)>Number(r)}function u(t,r){return Object.prototype.hasOwnProperty.call(t,r)}module.exports=function(n,o){void 0===o&&(o={}),n&&t(n.hasErrors)||function(t,n){throw Error(r(n,t))}("
|
|
1
|
+
"use strict";function t(t){return"function"==typeof t}function r(r,n){var e;return null!==(e=function(r){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t(r)?r.apply(void 0,n):r}(r))&&void 0!==e?e:n}function n(t){var r=Number(t);return!(isNaN(parseFloat(String(t)))||isNaN(Number(t))||!isFinite(r))}function e(t,r){return n(t)&&n(r)&&Number(t)>Number(r)}function u(t,r){return Object.prototype.hasOwnProperty.call(t,r)}module.exports=function(n,o){void 0===o&&(o={}),n&&t(n.hasErrors)||function(t,n){throw Error(r(n,t))}("classnames: Expected first argument to be Vest's result object.");var s=function(t){var r={},n={invalid:t.hasErrors,tested:function(o){return o?u(r,o)?r[o]:(r[o]=u(t.tests,o)&&e(t.tests[o].testCount,0),n.tested(o)):e(t.testCount,0)},untested:function(r){return 0===t.testCount||!n.tested(r)},valid:t.isValid,warning:t.hasWarnings};return n}(n);return function(r){var n,e=[];for(n in o){var u=n;t(s[u])&&s[u](r)&&e.push(o[u])}return e.join(" ")}};
|
|
@@ -18,7 +18,7 @@ var promisify = function (validatorFn) {
|
|
|
18
18
|
args[_i] = arguments[_i];
|
|
19
19
|
}
|
|
20
20
|
if (!isFunction(validatorFn)) {
|
|
21
|
-
throwError('
|
|
21
|
+
throwError('promisify: Expected validatorFn to be a function.');
|
|
22
22
|
}
|
|
23
23
|
return new Promise(function (resolve) { return validatorFn.apply(void 0, args).done(resolve); });
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function n(n){return"function"==typeof n}function r(r,t){var o;return null!==(o=function(r){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return n(r)?r.apply(void 0,t):r}(r))&&void 0!==o?o:t}function t(n,t){throw Error(r(t,n))}module.exports=function(r){return function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return n(r)||t("
|
|
1
|
+
"use strict";function n(n){return"function"==typeof n}function r(r,t){var o;return null!==(o=function(r){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return n(r)?r.apply(void 0,t):r}(r))&&void 0!==o?o:t}function t(n,t){throw Error(r(t,n))}module.exports=function(r){return function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return n(r)||t("promisify: Expected validatorFn to be a function."),new Promise((function(n){return r.apply(void 0,o).done(n)}))}};
|