@sanity/validation 2.22.4-reference-updates.58 → 2.22.6-field-groups.141
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/dist/dts/Rule.d.ts.map +1 -1
- package/dist/dts/util/convertToValidationMarker.d.ts +1 -1
- package/dist/dts/util/convertToValidationMarker.d.ts.map +1 -1
- package/lib/Rule.js +7 -0
- package/lib/validators/objectValidator.js +1 -1
- package/package.json +5 -5
- package/src/Rule.ts +8 -1
- package/src/util/convertToValidationMarker.ts +1 -1
- package/src/validators/objectValidator.ts +1 -1
package/dist/dts/Rule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rule.d.ts","sourceRoot":"","sources":["../../src/Rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAUV,MAAM,eAAe,CAAA;AA0DtB,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"Rule.d.ts","sourceRoot":"","sources":["../../src/Rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAUV,MAAM,eAAe,CAAA;AA0DtB,QAAA,MAAM,IAAI,EAAE,SAkWX,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValidationMarker, ValidationError, ValidationContext } from '@sanity/types';
|
|
2
2
|
declare type ValidationErrorLike = Pick<ValidationError, 'message'> & Partial<ValidationError>;
|
|
3
3
|
export declare function isNonNullable<T>(t: T): t is NonNullable<T>;
|
|
4
|
-
export default function convertToValidationMarker(validatorResult: true | true[] | string | string[] | ValidationError | ValidationError[] | ValidationErrorLike | ValidationErrorLike[], level: 'error' | 'warning' | undefined, context: ValidationContext): ValidationMarker[];
|
|
4
|
+
export default function convertToValidationMarker(validatorResult: true | true[] | string | string[] | ValidationError | ValidationError[] | ValidationErrorLike | ValidationErrorLike[], level: 'error' | 'warning' | 'info' | undefined, context: ValidationContext): ValidationMarker[];
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=convertToValidationMarker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertToValidationMarker.d.ts","sourceRoot":"","sources":["../../../src/util/convertToValidationMarker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAIlF,aAAK,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAEtF,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAE1D;AAED,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,eAAe,EACX,IAAI,GACJ,IAAI,EAAE,GACN,MAAM,GACN,MAAM,EAAE,GACR,eAAe,GACf,eAAe,EAAE,GACjB,mBAAmB,GACnB,mBAAmB,EAAE,EACzB,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"convertToValidationMarker.d.ts","sourceRoot":"","sources":["../../../src/util/convertToValidationMarker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAIlF,aAAK,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAEtF,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAE1D;AAED,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,eAAe,EACX,IAAI,GACJ,IAAI,EAAE,GACN,MAAM,GACN,MAAM,EAAE,GACR,eAAe,GACf,eAAe,EAAE,GACjB,mBAAmB,GACnB,mBAAmB,EAAE,EACzB,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,EAC/C,OAAO,EAAE,iBAAiB,GACzB,gBAAgB,EAAE,CA2DpB"}
|
package/lib/Rule.js
CHANGED
|
@@ -120,6 +120,13 @@ var Rule = (_temp = _class = class Rule {
|
|
|
120
120
|
return rule;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
info(message) {
|
|
124
|
+
var rule = this.clone();
|
|
125
|
+
rule._level = 'info';
|
|
126
|
+
rule._message = message || undefined;
|
|
127
|
+
return rule;
|
|
128
|
+
}
|
|
129
|
+
|
|
123
130
|
reset() {
|
|
124
131
|
this._type = this._type || undefined;
|
|
125
132
|
this._rules = (this._rules || []).filter(rule => rule.flag === 'type');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/validation",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.6-field-groups.141+b498d782c",
|
|
4
4
|
"description": "Validation and warning infrastructure for Sanity projects",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./dist/dts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"directory": "packages/@sanity/validation"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@sanity/client": "2.22.
|
|
36
|
-
"@sanity/schema": "2.22.
|
|
35
|
+
"@sanity/client": "2.22.6-field-groups.141+b498d782c",
|
|
36
|
+
"@sanity/schema": "2.22.6-field-groups.141+b498d782c"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@sanity/client": "^2.0.0"
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@sanity/types": "2.22.
|
|
47
|
+
"@sanity/types": "2.22.6-field-groups.141+b498d782c",
|
|
48
48
|
"date-fns": "^2.16.1",
|
|
49
49
|
"lodash": "^4.17.15"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "b498d782c2296fc8169cfba7a125b104624024c4"
|
|
52
52
|
}
|
package/src/Rule.ts
CHANGED
|
@@ -83,7 +83,7 @@ const Rule: RuleClass = class Rule implements IRule {
|
|
|
83
83
|
})
|
|
84
84
|
|
|
85
85
|
_type: RuleTypeConstraint | undefined = undefined
|
|
86
|
-
_level: 'error' | 'warning' | undefined = undefined
|
|
86
|
+
_level: 'error' | 'warning' | 'info' | undefined = undefined
|
|
87
87
|
_required: 'required' | 'optional' | undefined = undefined
|
|
88
88
|
_typeDef: SchemaType | undefined = undefined
|
|
89
89
|
_message: string | undefined = undefined
|
|
@@ -118,6 +118,13 @@ const Rule: RuleClass = class Rule implements IRule {
|
|
|
118
118
|
return rule
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
info(message?: string): Rule {
|
|
122
|
+
const rule = this.clone()
|
|
123
|
+
rule._level = 'info'
|
|
124
|
+
rule._message = message || undefined
|
|
125
|
+
return rule
|
|
126
|
+
}
|
|
127
|
+
|
|
121
128
|
reset(): this {
|
|
122
129
|
this._type = this._type || undefined
|
|
123
130
|
this._rules = (this._rules || []).filter((rule) => rule.flag === 'type')
|
|
@@ -18,7 +18,7 @@ export default function convertToValidationMarker(
|
|
|
18
18
|
| ValidationError[]
|
|
19
19
|
| ValidationErrorLike
|
|
20
20
|
| ValidationErrorLike[],
|
|
21
|
-
level: 'error' | 'warning' | undefined,
|
|
21
|
+
level: 'error' | 'warning' | 'info' | undefined,
|
|
22
22
|
context: ValidationContext
|
|
23
23
|
): ValidationMarker[] {
|
|
24
24
|
if (validatorResult === true) return []
|