@sanity/schema 6.9.2-next.3 → 6.9.2-next.30
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 +10 -10
- package/lib/_internal.js +3 -8
- package/lib/_internal.js.map +1 -1
- package/package.json +6 -6
package/lib/_internal.d.ts
CHANGED
|
@@ -384,17 +384,17 @@ declare const builtinTypes: ({
|
|
|
384
384
|
type: string;
|
|
385
385
|
title: string;
|
|
386
386
|
readOnly: boolean;
|
|
387
|
-
fieldset?: undefined;
|
|
388
387
|
validation?: undefined;
|
|
389
388
|
hidden?: undefined;
|
|
389
|
+
fieldset?: undefined;
|
|
390
390
|
} | {
|
|
391
391
|
name: string;
|
|
392
392
|
type: string;
|
|
393
393
|
title: string;
|
|
394
|
-
readOnly?: undefined;
|
|
395
|
-
fieldset?: undefined;
|
|
396
394
|
validation?: undefined;
|
|
397
395
|
hidden?: undefined;
|
|
396
|
+
readOnly?: undefined;
|
|
397
|
+
fieldset?: undefined;
|
|
398
398
|
} | {
|
|
399
399
|
name: string;
|
|
400
400
|
type: string;
|
|
@@ -409,8 +409,8 @@ declare const builtinTypes: ({
|
|
|
409
409
|
readOnly: boolean;
|
|
410
410
|
hidden: boolean;
|
|
411
411
|
fieldset: string;
|
|
412
|
-
title?: undefined;
|
|
413
412
|
validation?: undefined;
|
|
413
|
+
title?: undefined;
|
|
414
414
|
} | {
|
|
415
415
|
name: string;
|
|
416
416
|
type: string;
|
|
@@ -463,17 +463,17 @@ declare const builtinTypes: ({
|
|
|
463
463
|
type: string;
|
|
464
464
|
title: string;
|
|
465
465
|
readOnly: boolean;
|
|
466
|
-
fieldset?: undefined;
|
|
467
466
|
validation?: undefined;
|
|
468
467
|
hidden?: undefined;
|
|
468
|
+
fieldset?: undefined;
|
|
469
469
|
} | {
|
|
470
470
|
name: string;
|
|
471
471
|
type: string;
|
|
472
472
|
title: string;
|
|
473
|
-
readOnly?: undefined;
|
|
474
|
-
fieldset?: undefined;
|
|
475
473
|
validation?: undefined;
|
|
476
474
|
hidden?: undefined;
|
|
475
|
+
readOnly?: undefined;
|
|
476
|
+
fieldset?: undefined;
|
|
477
477
|
} | {
|
|
478
478
|
name: string;
|
|
479
479
|
type: string;
|
|
@@ -483,21 +483,21 @@ declare const builtinTypes: ({
|
|
|
483
483
|
validation: (Rule: import("@sanity/types").Rule) => import("@sanity/types").Rule;
|
|
484
484
|
hidden?: undefined;
|
|
485
485
|
} | {
|
|
486
|
+
validation?: undefined;
|
|
486
487
|
name: string;
|
|
487
488
|
type: string;
|
|
488
489
|
readOnly: boolean;
|
|
489
490
|
hidden: boolean;
|
|
490
491
|
fieldset: string;
|
|
491
492
|
title?: undefined;
|
|
492
|
-
validation?: undefined;
|
|
493
493
|
} | {
|
|
494
|
+
validation?: undefined;
|
|
495
|
+
hidden?: undefined;
|
|
494
496
|
name: string;
|
|
495
497
|
type: string;
|
|
496
498
|
title: string;
|
|
497
499
|
readOnly: boolean;
|
|
498
500
|
fieldset: string;
|
|
499
|
-
validation?: undefined;
|
|
500
|
-
hidden?: undefined;
|
|
501
501
|
})[];
|
|
502
502
|
preview: {
|
|
503
503
|
select: {
|
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
|
}
|