@sanity/schema 6.23.0-next.26 → 6.23.0-next.38

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as resolveSearchConfig, d as OWN_PROPS_NAME, f as Rule, l as resolveSearchConfigForBaseFieldPaths, n as Schema$1, s as DEFAULT_MAX_FIELD_DEPTH, u as ALL_FIELDS_GROUP_NAME } from "./Schema-C69uh07G.js";
1
+ import { c as resolveSearchConfig, d as OWN_PROPS_NAME, f as Rule, l as resolveSearchConfigForBaseFieldPaths, n as Schema$1, s as DEFAULT_MAX_FIELD_DEPTH, u as ALL_FIELDS_GROUP_NAME } from "./Schema-A0BdoNMg.js";
2
2
  import { SetBuilder, processSetSynchronization } from "@sanity/descriptors";
3
3
  import { isSpanSchemaType } from "@sanity/types";
4
4
  import { dequal } from "dequal/lite";
@@ -402,7 +402,7 @@ function maybeValidations(obj) {
402
402
  let validation = maybeValidation(rule);
403
403
  if (validation === void 0) continue;
404
404
  let rulesToAdd = impliedRules.filter((ir) => !validation.rules.some((r) => r.type === ir.type));
405
- rulesToAdd.length > 0 && validation.rules.unshift(...rulesToAdd), !validations.some((v) => dequal(v, validation)) && validations.push(validation);
405
+ rulesToAdd.length > 0 && validation.rules.unshift(...rulesToAdd), validations.some((v) => dequal(v, validation)) || validations.push(validation);
406
406
  }
407
407
  return validations.length > 0 ? validations : void 0;
408
408
  }
@@ -1488,13 +1488,14 @@ function getDupes(array, selector = (v) => v) {
1488
1488
  const NOOP_VISITOR = (typeDef) => typeDef, TYPE_TYPE = {
1489
1489
  name: "type",
1490
1490
  type: null
1491
- }, FUTURE_RESERVED = [
1492
- "any",
1493
- "time",
1494
- "date"
1495
- ];
1491
+ }, FUTURE_RESERVED = ["any", "time"];
1496
1492
  function traverseSchema(types = [], coreTypes = [], visitor = NOOP_VISITOR, parentTypes = []) {
1497
- let coreTypesRegistry = Object.create(null), registry = Object.create(null), parentTypesRegistry = Object.create(null), coreTypeNames = coreTypes.map((typeDef) => typeDef.name), parentTypeNames = parentTypes.map((typeDef) => typeDef.name), reservedTypeNames = FUTURE_RESERVED.concat(coreTypeNames, parentTypeNames), typeNames = types.map((typeDef) => typeDef && typeDef.name).filter(Boolean);
1493
+ let coreTypesRegistry = Object.create(null), registry = Object.create(null), parentTypesRegistry = Object.create(null), coreTypeNames = coreTypes.map((typeDef) => typeDef.name), parentTypeNames = parentTypes.map((typeDef) => typeDef.name), reservedTypeNames = /* @__PURE__ */ new Set([
1494
+ "type",
1495
+ ...FUTURE_RESERVED,
1496
+ ...coreTypeNames,
1497
+ ...parentTypeNames
1498
+ ]), typeNames = types.map((typeDef) => typeDef && typeDef.name).filter(Boolean);
1498
1499
  coreTypes.forEach((coreType) => {
1499
1500
  coreTypesRegistry[coreType.name] = coreType;
1500
1501
  }), parentTypes.forEach((type) => {
@@ -1513,7 +1514,7 @@ function traverseSchema(types = [], coreTypes = [], visitor = NOOP_VISITOR, pare
1513
1514
  return typeNames.concat(parentTypeNames, coreTypeNames);
1514
1515
  }
1515
1516
  function isReserved(typeName) {
1516
- return typeName === "type" || reservedTypeNames.includes(typeName);
1517
+ return reservedTypeNames.has(typeName);
1517
1518
  }
1518
1519
  let visitType = (isRoot) => (typeDef, index) => visitor(typeDef, {
1519
1520
  visit: visitType(!1),