@sanity/schema 6.9.2-next.3 → 6.9.2-next.34
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/lib/Schema-BckCkziq.js.map +1 -1
- package/lib/_internal.d.ts +6 -6
- package/lib/_internal.js +3 -8
- package/lib/_internal.js.map +1 -1
- package/package.json +6 -6
package/lib/_internal.d.ts
CHANGED
|
@@ -391,8 +391,8 @@ declare const builtinTypes: ({
|
|
|
391
391
|
name: string;
|
|
392
392
|
type: string;
|
|
393
393
|
title: string;
|
|
394
|
-
readOnly?: undefined;
|
|
395
394
|
fieldset?: undefined;
|
|
395
|
+
readOnly?: undefined;
|
|
396
396
|
validation?: undefined;
|
|
397
397
|
hidden?: undefined;
|
|
398
398
|
} | {
|
|
@@ -470,8 +470,8 @@ declare const builtinTypes: ({
|
|
|
470
470
|
name: string;
|
|
471
471
|
type: string;
|
|
472
472
|
title: string;
|
|
473
|
-
readOnly?: undefined;
|
|
474
473
|
fieldset?: undefined;
|
|
474
|
+
readOnly?: undefined;
|
|
475
475
|
validation?: undefined;
|
|
476
476
|
hidden?: undefined;
|
|
477
477
|
} | {
|
|
@@ -547,17 +547,17 @@ declare const builtinTypes: ({
|
|
|
547
547
|
};
|
|
548
548
|
}[];
|
|
549
549
|
fields: ({
|
|
550
|
-
title?: undefined;
|
|
551
|
-
readOnly?: undefined;
|
|
552
|
-
fieldset?: undefined;
|
|
553
550
|
name: string;
|
|
554
551
|
type: string;
|
|
555
|
-
|
|
552
|
+
fieldset?: undefined;
|
|
553
|
+
title?: undefined;
|
|
556
554
|
readOnly?: undefined;
|
|
555
|
+
} | {
|
|
557
556
|
name: string;
|
|
558
557
|
title: string;
|
|
559
558
|
type: string;
|
|
560
559
|
fieldset: string;
|
|
560
|
+
readOnly?: undefined;
|
|
561
561
|
} | {
|
|
562
562
|
fieldset?: undefined;
|
|
563
563
|
name: string;
|
package/lib/_internal.js
CHANGED
|
@@ -389,10 +389,7 @@ function maybeValidations(obj) {
|
|
|
389
389
|
case "reference":
|
|
390
390
|
impliedRules.push({ type: "reference" });
|
|
391
391
|
break;
|
|
392
|
-
case "email":
|
|
393
|
-
impliedRules.push({ type: "email" });
|
|
394
|
-
break;
|
|
395
|
-
default:
|
|
392
|
+
case "email": impliedRules.push({ type: "email" });
|
|
396
393
|
}
|
|
397
394
|
if (!("validation" in obj) || !obj.validation) return impliedRules.length > 0 ? [{
|
|
398
395
|
level: "error",
|
|
@@ -1833,8 +1830,8 @@ function validateTypeName(typeName, visitorContext) {
|
|
|
1833
1830
|
if (!typeName) return [error("Type is missing a type.", HELP_IDS.TYPE_MISSING_TYPE)];
|
|
1834
1831
|
if (typeof typeName != "string") return [error("Type has an invalid \"type\"-property - should be a string.", HELP_IDS.TYPE_MISSING_TYPE)];
|
|
1835
1832
|
if (!possibleTypeNames.includes(typeName)) {
|
|
1836
|
-
let suggestions = possibleTypeNames.map((possibleTypeName) => [leven(typeName, possibleTypeName), possibleTypeName]).filter(([distance]) => distance < 3).map(([_, name]) => name);
|
|
1837
|
-
return [error(`Unknown type: ${typeName}.${
|
|
1833
|
+
let suggestions = possibleTypeNames.map((possibleTypeName) => [leven(typeName, possibleTypeName), possibleTypeName]).filter(([distance]) => distance < 3).map(([_, name]) => name), suggestion = suggestions.length > 0 ? ` Did you mean ${humanizeList(suggestions.map(quote), { conjunction: "or" })}?` : "";
|
|
1834
|
+
return [error(`Unknown type: ${typeName}.${suggestion}`)];
|
|
1838
1835
|
}
|
|
1839
1836
|
return [];
|
|
1840
1837
|
}
|
|
@@ -2211,8 +2208,6 @@ function applyRuleSpec(rule, ruleSpec) {
|
|
|
2211
2208
|
case "media":
|
|
2212
2209
|
if (constraint === void 0) return rule.media(() => !0);
|
|
2213
2210
|
if (typeof constraint == "function") return rule.media(constraint);
|
|
2214
|
-
break;
|
|
2215
|
-
default: break;
|
|
2216
2211
|
}
|
|
2217
2212
|
return rule;
|
|
2218
2213
|
}
|