@sanity/schema 6.9.2-next.4 → 6.9.2-next.41
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 +14 -14
- 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;
|
|
387
388
|
validation?: undefined;
|
|
388
389
|
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;
|
|
394
396
|
validation?: undefined;
|
|
395
397
|
hidden?: undefined;
|
|
396
|
-
fieldset?: undefined;
|
|
397
|
-
readOnly?: 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
|
-
validation?: undefined;
|
|
413
412
|
title?: undefined;
|
|
413
|
+
validation?: 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;
|
|
466
467
|
validation?: undefined;
|
|
467
468
|
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;
|
|
473
475
|
validation?: undefined;
|
|
474
476
|
hidden?: undefined;
|
|
475
|
-
fieldset?: undefined;
|
|
476
|
-
readOnly?: 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;
|
|
487
486
|
name: string;
|
|
488
487
|
type: string;
|
|
489
488
|
readOnly: boolean;
|
|
490
489
|
hidden: boolean;
|
|
491
490
|
fieldset: string;
|
|
492
491
|
title?: undefined;
|
|
493
|
-
} | {
|
|
494
492
|
validation?: undefined;
|
|
495
|
-
|
|
493
|
+
} | {
|
|
496
494
|
name: string;
|
|
497
495
|
type: string;
|
|
498
496
|
title: string;
|
|
499
497
|
readOnly: boolean;
|
|
500
498
|
fieldset: string;
|
|
499
|
+
validation?: undefined;
|
|
500
|
+
hidden?: undefined;
|
|
501
501
|
})[];
|
|
502
502
|
preview: {
|
|
503
503
|
select: {
|
|
@@ -547,17 +547,17 @@ declare const builtinTypes: ({
|
|
|
547
547
|
};
|
|
548
548
|
}[];
|
|
549
549
|
fields: ({
|
|
550
|
-
name: string;
|
|
551
|
-
type: string;
|
|
552
|
-
fieldset?: undefined;
|
|
553
550
|
title?: undefined;
|
|
554
551
|
readOnly?: undefined;
|
|
552
|
+
fieldset?: undefined;
|
|
553
|
+
name: string;
|
|
554
|
+
type: string;
|
|
555
555
|
} | {
|
|
556
|
+
readOnly?: undefined;
|
|
556
557
|
name: string;
|
|
557
558
|
title: string;
|
|
558
559
|
type: string;
|
|
559
560
|
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
|
}
|