@sanity/validation 2.33.2 → 2.33.3-performance-opts.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateDocument.d.ts","sourceRoot":"","sources":["../../src/validateDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAMjB,MAAM,eAAe,CAAA;AAYtB;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,EAAE,GACvB,UAAU,GAAG,SAAS,CAiBxB;AAED,wBAA8B,gBAAgB,CAC5C,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,GACrD,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA2B7B;AAED;;;;;;GAMG;AACH,aAAK,iBAAiB,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAC5F,CAAA;AAED,aAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,OAAO,CAAA;CACf,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"validateDocument.d.ts","sourceRoot":"","sources":["../../src/validateDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAMjB,MAAM,eAAe,CAAA;AAYtB;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,EAAE,GACvB,UAAU,GAAG,SAAS,CAiBxB;AAED,wBAA8B,gBAAgB,CAC5C,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,GACrD,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA2B7B;AAED;;;;;;GAMG;AACH,aAAK,iBAAiB,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAC5F,CAAA;AAED,aAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,OAAO,CAAA;CACf,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAIxC,wBAAsB,YAAY,CAAC,EACjC,KAAK,EACL,IAAI,EACJ,IAAS,EACT,MAAM,EACN,GAAG,aAAa,EACjB,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA6HnD"}
|
package/lib/validateDocument.js
CHANGED
|
@@ -117,6 +117,8 @@ function _validateDocument() {
|
|
|
117
117
|
return _validateDocument.apply(this, arguments);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
var idle = () => new Promise(resolve => window.requestIdleCallback(resolve));
|
|
121
|
+
|
|
120
122
|
function validateItem(_x4) {
|
|
121
123
|
return _validateItem.apply(this, arguments);
|
|
122
124
|
}
|
|
@@ -130,6 +132,7 @@ function _validateItem() {
|
|
|
130
132
|
parent = _ref.parent,
|
|
131
133
|
restOfContext = _objectWithoutProperties(_ref, _excluded);
|
|
132
134
|
|
|
135
|
+
yield idle();
|
|
133
136
|
var rules = (0, _normalizeValidationRules.default)(type); // run validation for the current value
|
|
134
137
|
|
|
135
138
|
var selfChecks = rules.map(rule => rule.validate(value, _objectSpread(_objectSpread({}, restOfContext), {}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/validation",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.3-performance-opts.4+87ec2ee6e8",
|
|
4
4
|
"description": "Validation and warning infrastructure for Sanity projects",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./dist/dts",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@sanity/client": "^3.3.3",
|
|
36
|
-
"@sanity/schema": "2.33.
|
|
36
|
+
"@sanity/schema": "2.33.3-performance-opts.4+87ec2ee6e8"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@sanity/types": "2.33.
|
|
39
|
+
"@sanity/types": "2.33.3-performance-opts.4+87ec2ee6e8",
|
|
40
40
|
"date-fns": "^2.16.1",
|
|
41
41
|
"lodash": "^4.17.15"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "87ec2ee6e85a8cb44368bde6557516e9ed024af0"
|
|
44
44
|
}
|
package/src/validateDocument.ts
CHANGED
|
@@ -94,6 +94,8 @@ type ValidateItemOptions = {
|
|
|
94
94
|
value: unknown
|
|
95
95
|
} & ExplicitUndefined<ValidationContext>
|
|
96
96
|
|
|
97
|
+
const idle = () => new Promise((resolve) => window.requestIdleCallback(resolve))
|
|
98
|
+
|
|
97
99
|
export async function validateItem({
|
|
98
100
|
value,
|
|
99
101
|
type,
|
|
@@ -101,6 +103,7 @@ export async function validateItem({
|
|
|
101
103
|
parent,
|
|
102
104
|
...restOfContext
|
|
103
105
|
}: ValidateItemOptions): Promise<ValidationMarker[]> {
|
|
106
|
+
await idle()
|
|
104
107
|
const rules = normalizeValidationRules(type)
|
|
105
108
|
|
|
106
109
|
// run validation for the current value
|