@sanity/schema 6.13.0-next.79 → 6.13.0-next.85
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/_internal.d.ts +10 -10
- package/lib/_internal.js +4 -4
- package/lib/_internal.js.map +1 -1
- package/package.json +2 -2
package/lib/_internal.d.ts
CHANGED
|
@@ -387,17 +387,17 @@ declare const builtinTypes: ({
|
|
|
387
387
|
type: string;
|
|
388
388
|
title: string;
|
|
389
389
|
readOnly: boolean;
|
|
390
|
-
fieldset?: undefined;
|
|
391
390
|
validation?: undefined;
|
|
392
391
|
hidden?: undefined;
|
|
392
|
+
fieldset?: undefined;
|
|
393
393
|
} | {
|
|
394
394
|
name: string;
|
|
395
395
|
type: string;
|
|
396
396
|
title: string;
|
|
397
|
-
readOnly?: undefined;
|
|
398
|
-
fieldset?: undefined;
|
|
399
397
|
validation?: undefined;
|
|
400
398
|
hidden?: undefined;
|
|
399
|
+
readOnly?: undefined;
|
|
400
|
+
fieldset?: undefined;
|
|
401
401
|
} | {
|
|
402
402
|
name: string;
|
|
403
403
|
type: string;
|
|
@@ -412,8 +412,8 @@ declare const builtinTypes: ({
|
|
|
412
412
|
readOnly: boolean;
|
|
413
413
|
hidden: boolean;
|
|
414
414
|
fieldset: string;
|
|
415
|
-
title?: undefined;
|
|
416
415
|
validation?: undefined;
|
|
416
|
+
title?: undefined;
|
|
417
417
|
} | {
|
|
418
418
|
name: string;
|
|
419
419
|
type: string;
|
|
@@ -466,17 +466,17 @@ declare const builtinTypes: ({
|
|
|
466
466
|
type: string;
|
|
467
467
|
title: string;
|
|
468
468
|
readOnly: boolean;
|
|
469
|
-
fieldset?: undefined;
|
|
470
469
|
validation?: undefined;
|
|
471
470
|
hidden?: undefined;
|
|
471
|
+
fieldset?: undefined;
|
|
472
472
|
} | {
|
|
473
473
|
name: string;
|
|
474
474
|
type: string;
|
|
475
475
|
title: string;
|
|
476
|
-
readOnly?: undefined;
|
|
477
|
-
fieldset?: undefined;
|
|
478
476
|
validation?: undefined;
|
|
479
477
|
hidden?: undefined;
|
|
478
|
+
readOnly?: undefined;
|
|
479
|
+
fieldset?: undefined;
|
|
480
480
|
} | {
|
|
481
481
|
name: string;
|
|
482
482
|
type: string;
|
|
@@ -486,21 +486,21 @@ declare const builtinTypes: ({
|
|
|
486
486
|
validation: (Rule: import("@sanity/types").Rule) => import("@sanity/types").Rule;
|
|
487
487
|
hidden?: undefined;
|
|
488
488
|
} | {
|
|
489
|
+
validation?: undefined;
|
|
489
490
|
name: string;
|
|
490
491
|
type: string;
|
|
491
492
|
readOnly: boolean;
|
|
492
493
|
hidden: boolean;
|
|
493
494
|
fieldset: string;
|
|
494
495
|
title?: undefined;
|
|
495
|
-
validation?: undefined;
|
|
496
496
|
} | {
|
|
497
|
+
validation?: undefined;
|
|
498
|
+
hidden?: undefined;
|
|
497
499
|
name: string;
|
|
498
500
|
type: string;
|
|
499
501
|
title: string;
|
|
500
502
|
readOnly: boolean;
|
|
501
503
|
fieldset: string;
|
|
502
|
-
validation?: undefined;
|
|
503
|
-
hidden?: undefined;
|
|
504
504
|
})[];
|
|
505
505
|
preview: {
|
|
506
506
|
select: {
|
package/lib/_internal.js
CHANGED
|
@@ -609,7 +609,7 @@ function maybeOrdering(val) {
|
|
|
609
609
|
function maybeOrderingBy(val) {
|
|
610
610
|
if (!isObject(val) || Array.isArray(val)) return;
|
|
611
611
|
let field = "field" in val && typeof val.field == "string" ? val.field : void 0, direction = "direction" in val && (val.direction === "asc" || val.direction === "desc") ? val.direction : void 0, nulls = "nulls" in val && (val.nulls === "first" || val.nulls === "last") ? val.nulls : void 0;
|
|
612
|
-
if (
|
|
612
|
+
if (field && direction) return {
|
|
613
613
|
field,
|
|
614
614
|
direction,
|
|
615
615
|
...nulls && { nulls }
|
|
@@ -2136,10 +2136,10 @@ function traverse(obj) {
|
|
|
2136
2136
|
}
|
|
2137
2137
|
}
|
|
2138
2138
|
function coerceValidation(val) {
|
|
2139
|
-
|
|
2139
|
+
isObject(val) && "validation" in val && (val.validation = (Array.isArray(val.validation) ? val.validation : [val.validation]).map((group) => {
|
|
2140
2140
|
if (isObject(group)) return (baseRule) => {
|
|
2141
2141
|
let rule = baseRule, level = "level" in group ? group.level : void 0, rules = "rules" in group ? group.rules : void 0, message = "message" in group ? group.message : void 0;
|
|
2142
|
-
if (
|
|
2142
|
+
if (rules && Array.isArray(rules)) {
|
|
2143
2143
|
isValidLevel(level) && (message === void 0 || typeof message == "string") && (rule = rule[level](message));
|
|
2144
2144
|
for (let ruleSpec of rules) rule = applyRuleSpec(rule, ruleSpec);
|
|
2145
2145
|
return rule;
|
|
@@ -2150,7 +2150,7 @@ function coerceValidation(val) {
|
|
|
2150
2150
|
function coerceConstraintRule(val) {
|
|
2151
2151
|
if (isObject(val)) return Array.isArray(val) ? val.map(coerceConstraintRule).filter(Boolean) : (baseRule) => {
|
|
2152
2152
|
let rule = baseRule, rules = "_rules" in val ? val._rules : void 0, level = "_level" in val ? val._level : void 0, message = "_message" in val ? val._message : void 0;
|
|
2153
|
-
if (
|
|
2153
|
+
if (rules && Array.isArray(rules)) {
|
|
2154
2154
|
typeof level == "string" && (rule = rule[level](message));
|
|
2155
2155
|
for (let ruleSpec of rules) rule = applyRuleSpec(rule, ruleSpec);
|
|
2156
2156
|
return rule;
|