@inf-monkeys-tech/monkeys 1.1.31 → 1.1.32

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.
@@ -5648,6 +5648,10 @@ var schemasCannotOverlap = (left, right) => {
5648
5648
  const a = left;
5649
5649
  const b = right;
5650
5650
  if (a.$ref || b.$ref) return false;
5651
+ for (const key of ["anyOf", "oneOf"]) {
5652
+ if (Array.isArray(a[key]) && a[key].every((branch) => schemasCannotOverlap(branch, b))) return true;
5653
+ if (Array.isArray(b[key]) && b[key].every((branch) => schemasCannotOverlap(a, branch))) return true;
5654
+ }
5651
5655
  const values = (schema) => Object.prototype.hasOwnProperty.call(schema, "const") ? [schema.const] : Array.isArray(schema.enum) ? schema.enum : void 0;
5652
5656
  const av = values(a), bv = values(b);
5653
5657
  if (av && bv && av.every((value) => !bv.some((other) => canonicalContentHash(value) === canonicalContentHash(other)))) return true;
@@ -5729,6 +5733,16 @@ var acceptsPreviousSchema = (previous, next) => {
5729
5733
  const withoutAnnotations = (schema) => Object.fromEntries(Object.entries(schema).filter(([key]) => !["title", "description", "examples", "$comment"].includes(key)));
5730
5734
  const before = withoutAnnotations(previous);
5731
5735
  const after = withoutAnnotations(next);
5736
+ const union = (schema) => {
5737
+ const key = Array.isArray(schema.oneOf) && !schema.anyOf ? "oneOf" : Array.isArray(schema.anyOf) && !schema.oneOf ? "anyOf" : void 0;
5738
+ if (!key) return void 0;
5739
+ const { [key]: alternatives, ...siblings } = schema;
5740
+ return { key, alternatives, siblings };
5741
+ };
5742
+ const oldUnion = union(before), newUnion = union(after);
5743
+ if (oldUnion && newUnion && canonicalContentHash(oldUnion.siblings) === canonicalContentHash(newUnion.siblings)) {
5744
+ return oldUnion.alternatives.every((branch) => newUnion.alternatives.some((candidate, index) => acceptsPreviousSchema(branch, candidate) && (newUnion.key !== "oneOf" || newUnion.alternatives.every((other, otherIndex) => index === otherIndex || schemasCannotOverlap(branch, other)))));
5745
+ }
5732
5746
  const branches = (schema) => Object.keys(schema).length === 1 ? Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : void 0 : void 0;
5733
5747
  const oldBranches = branches(before);
5734
5748
  if (oldBranches) return oldBranches.every((branch) => acceptsPreviousSchema(branch, next));
@@ -7235,4 +7249,4 @@ export {
7235
7249
  PageCompositionSchema,
7236
7250
  compilePageComposition
7237
7251
  };
7238
- //# sourceMappingURL=chunk-N3RVZAFT.mjs.map
7252
+ //# sourceMappingURL=chunk-OL3X34S6.mjs.map