@inf-monkeys-tech/monkeys 1.1.28 → 1.1.31

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.
@@ -1441,6 +1441,9 @@ var buildChangeImpactGraph = (previousInput, nextInput, generatedAt = (/* @__PUR
1441
1441
  });
1442
1442
  };
1443
1443
 
1444
+ // src/runtime/declarative-control-compiler.ts
1445
+ import { sha256Hex } from "#canonical-sha256";
1446
+
1444
1447
  // src/runtime/render-tree-compiler.ts
1445
1448
  var compileRenderTree = (input) => {
1446
1449
  const tree = RenderTreeSchema.parse(input);
@@ -1551,136 +1554,6 @@ var stableSerialize = (value) => {
1551
1554
  const record2 = value;
1552
1555
  return `{${Object.keys(record2).filter((key) => record2[key] !== void 0).sort().map((key) => `${JSON.stringify(key)}:${stableSerialize(record2[key])}`).join(",")}}`;
1553
1556
  };
1554
- var SHA256_INITIAL = [
1555
- 1779033703,
1556
- 3144134277,
1557
- 1013904242,
1558
- 2773480762,
1559
- 1359893119,
1560
- 2600822924,
1561
- 528734635,
1562
- 1541459225
1563
- ];
1564
- var SHA256_ROUND = [
1565
- 1116352408,
1566
- 1899447441,
1567
- 3049323471,
1568
- 3921009573,
1569
- 961987163,
1570
- 1508970993,
1571
- 2453635748,
1572
- 2870763221,
1573
- 3624381080,
1574
- 310598401,
1575
- 607225278,
1576
- 1426881987,
1577
- 1925078388,
1578
- 2162078206,
1579
- 2614888103,
1580
- 3248222580,
1581
- 3835390401,
1582
- 4022224774,
1583
- 264347078,
1584
- 604807628,
1585
- 770255983,
1586
- 1249150122,
1587
- 1555081692,
1588
- 1996064986,
1589
- 2554220882,
1590
- 2821834349,
1591
- 2952996808,
1592
- 3210313671,
1593
- 3336571891,
1594
- 3584528711,
1595
- 113926993,
1596
- 338241895,
1597
- 666307205,
1598
- 773529912,
1599
- 1294757372,
1600
- 1396182291,
1601
- 1695183700,
1602
- 1986661051,
1603
- 2177026350,
1604
- 2456956037,
1605
- 2730485921,
1606
- 2820302411,
1607
- 3259730800,
1608
- 3345764771,
1609
- 3516065817,
1610
- 3600352804,
1611
- 4094571909,
1612
- 275423344,
1613
- 430227734,
1614
- 506948616,
1615
- 659060556,
1616
- 883997877,
1617
- 958139571,
1618
- 1322822218,
1619
- 1537002063,
1620
- 1747873779,
1621
- 1955562222,
1622
- 2024104815,
1623
- 2227730452,
1624
- 2361852424,
1625
- 2428436474,
1626
- 2756734187,
1627
- 3204031479,
1628
- 3329325298
1629
- ];
1630
- var rotateRight = (value, amount) => value >>> amount | value << 32 - amount;
1631
- var sha256Hex = (value) => {
1632
- const source = [...new TextEncoder().encode(value)];
1633
- const bitLength = source.length * 8;
1634
- source.push(128);
1635
- while (source.length % 64 !== 56) source.push(0);
1636
- const high = Math.floor(bitLength / 4294967296);
1637
- const low = bitLength >>> 0;
1638
- for (let shift = 24; shift >= 0; shift -= 8)
1639
- source.push(high >>> shift & 255);
1640
- for (let shift = 24; shift >= 0; shift -= 8)
1641
- source.push(low >>> shift & 255);
1642
- const hash = [...SHA256_INITIAL];
1643
- const words = new Array(64).fill(0);
1644
- for (let offset = 0; offset < source.length; offset += 64) {
1645
- for (let index = 0; index < 16; index += 1) {
1646
- const start = offset + index * 4;
1647
- words[index] = (source[start] << 24 | source[start + 1] << 16 | source[start + 2] << 8 | source[start + 3]) >>> 0;
1648
- }
1649
- for (let index = 16; index < 64; index += 1) {
1650
- const previous = words[index - 15];
1651
- const recent = words[index - 2];
1652
- const small0 = rotateRight(previous, 7) ^ rotateRight(previous, 18) ^ previous >>> 3;
1653
- const small1 = rotateRight(recent, 17) ^ rotateRight(recent, 19) ^ recent >>> 10;
1654
- words[index] = words[index - 16] + small0 + words[index - 7] + small1 >>> 0;
1655
- }
1656
- let [a, b, c, d, e, f, g, h] = hash;
1657
- for (let index = 0; index < 64; index += 1) {
1658
- const big1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
1659
- const choice = e & f ^ ~e & g;
1660
- const temp1 = h + big1 + choice + SHA256_ROUND[index] + words[index] >>> 0;
1661
- const big0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
1662
- const majority = a & b ^ a & c ^ b & c;
1663
- const temp2 = big0 + majority >>> 0;
1664
- h = g;
1665
- g = f;
1666
- f = e;
1667
- e = d + temp1 >>> 0;
1668
- d = c;
1669
- c = b;
1670
- b = a;
1671
- a = temp1 + temp2 >>> 0;
1672
- }
1673
- hash[0] = hash[0] + a >>> 0;
1674
- hash[1] = hash[1] + b >>> 0;
1675
- hash[2] = hash[2] + c >>> 0;
1676
- hash[3] = hash[3] + d >>> 0;
1677
- hash[4] = hash[4] + e >>> 0;
1678
- hash[5] = hash[5] + f >>> 0;
1679
- hash[6] = hash[6] + g >>> 0;
1680
- hash[7] = hash[7] + h >>> 0;
1681
- }
1682
- return hash.map((part) => part.toString(16).padStart(8, "0")).join("");
1683
- };
1684
1557
  var canonicalContentHash = (value) => sha256Hex(stableSerialize(value));
1685
1558
  var declarativeRuntimeProjectionId = (resourceKind, releaseSlotId, releaseRevisionRef) => `drb:${canonicalContentHash({ resourceKind, releaseSlotId, releaseRevisionRef })}`;
1686
1559
  var declarativeRouteOwnerIndexProjectionId = (tenantScope, environmentRef, surface) => `dri:${canonicalContentHash({
@@ -4726,7 +4599,7 @@ var deepFreeze2 = (value) => {
4726
4599
  Object.values(value).forEach((child) => deepFreeze2(child));
4727
4600
  return Object.freeze(value);
4728
4601
  };
4729
- var SHA256_INITIAL2 = [
4602
+ var SHA256_INITIAL = [
4730
4603
  1779033703,
4731
4604
  3144134277,
4732
4605
  1013904242,
@@ -4736,7 +4609,7 @@ var SHA256_INITIAL2 = [
4736
4609
  528734635,
4737
4610
  1541459225
4738
4611
  ];
4739
- var SHA256_ROUND2 = [
4612
+ var SHA256_ROUND = [
4740
4613
  1116352408,
4741
4614
  1899447441,
4742
4615
  3049323471,
@@ -4802,7 +4675,7 @@ var SHA256_ROUND2 = [
4802
4675
  3204031479,
4803
4676
  3329325298
4804
4677
  ];
4805
- var rotateRight2 = (value, amount) => value >>> amount | value << 32 - amount;
4678
+ var rotateRight = (value, amount) => value >>> amount | value << 32 - amount;
4806
4679
  var sha256Hex2 = (value) => {
4807
4680
  const source = [...new TextEncoder().encode(value)];
4808
4681
  const bitLength = source.length * 8;
@@ -4812,7 +4685,7 @@ var sha256Hex2 = (value) => {
4812
4685
  const low = bitLength >>> 0;
4813
4686
  for (let shift = 24; shift >= 0; shift -= 8) source.push(high >>> shift & 255);
4814
4687
  for (let shift = 24; shift >= 0; shift -= 8) source.push(low >>> shift & 255);
4815
- const hash = [...SHA256_INITIAL2];
4688
+ const hash = [...SHA256_INITIAL];
4816
4689
  const words = new Array(64).fill(0);
4817
4690
  for (let offset = 0; offset < source.length; offset += 64) {
4818
4691
  for (let index = 0; index < 16; index += 1) {
@@ -4822,16 +4695,16 @@ var sha256Hex2 = (value) => {
4822
4695
  for (let index = 16; index < 64; index += 1) {
4823
4696
  const previous = words[index - 15];
4824
4697
  const recent = words[index - 2];
4825
- const small0 = rotateRight2(previous, 7) ^ rotateRight2(previous, 18) ^ previous >>> 3;
4826
- const small1 = rotateRight2(recent, 17) ^ rotateRight2(recent, 19) ^ recent >>> 10;
4698
+ const small0 = rotateRight(previous, 7) ^ rotateRight(previous, 18) ^ previous >>> 3;
4699
+ const small1 = rotateRight(recent, 17) ^ rotateRight(recent, 19) ^ recent >>> 10;
4827
4700
  words[index] = words[index - 16] + small0 + words[index - 7] + small1 >>> 0;
4828
4701
  }
4829
4702
  let [a, b, c, d, e, f, g, h] = hash;
4830
4703
  for (let index = 0; index < 64; index += 1) {
4831
- const big1 = rotateRight2(e, 6) ^ rotateRight2(e, 11) ^ rotateRight2(e, 25);
4704
+ const big1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
4832
4705
  const choice = e & f ^ ~e & g;
4833
- const temp1 = h + big1 + choice + SHA256_ROUND2[index] + words[index] >>> 0;
4834
- const big0 = rotateRight2(a, 2) ^ rotateRight2(a, 13) ^ rotateRight2(a, 22);
4706
+ const temp1 = h + big1 + choice + SHA256_ROUND[index] + words[index] >>> 0;
4707
+ const big0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
4835
4708
  const majority = a & b ^ a & c ^ b & c;
4836
4709
  const temp2 = big0 + majority >>> 0;
4837
4710
  h = g;
@@ -5778,6 +5651,15 @@ var schemasCannotOverlap = (left, right) => {
5778
5651
  const values = (schema) => Object.prototype.hasOwnProperty.call(schema, "const") ? [schema.const] : Array.isArray(schema.enum) ? schema.enum : void 0;
5779
5652
  const av = values(a), bv = values(b);
5780
5653
  if (av && bv && av.every((value) => !bv.some((other) => canonicalContentHash(value) === canonicalContentHash(other)))) return true;
5654
+ const declaredTypes = (schema) => {
5655
+ const types = typeof schema.type === "string" ? [schema.type] : schema.type;
5656
+ if (!Array.isArray(types) || !types.length || types.some((type) => !["null", "boolean", "object", "array", "number", "integer", "string"].includes(type))) return void 0;
5657
+ return types.map((type) => type === "integer" ? "number" : type);
5658
+ };
5659
+ const valueTypes = (entries) => entries?.map((value) => value === null ? "null" : Array.isArray(value) ? "array" : typeof value);
5660
+ const disjoint = (leftTypes, rightTypes) => !!leftTypes && !!rightTypes && leftTypes.every((type) => !rightTypes.includes(type));
5661
+ const at = declaredTypes(a), bt = declaredTypes(b);
5662
+ if (disjoint(at, bt) || disjoint(valueTypes(av), bt) || disjoint(at, valueTypes(bv))) return true;
5781
5663
  if (a.type !== "object" || b.type !== "object") return false;
5782
5664
  const property = (schema, key) => schema.properties?.[key] ?? (schema.patternProperties ? true : schema.additionalProperties ?? true);
5783
5665
  return [...a.required ?? [], ...b.required ?? []].some((key) => schemasCannotOverlap(property(a, key), property(b, key)));
@@ -5815,6 +5697,31 @@ var boundAcceptsPrevious = (previous, next, direction) => {
5815
5697
  return previous.value !== next.value || !previous.inclusive || next.inclusive;
5816
5698
  };
5817
5699
  var numericRangesAcceptPrevious = (previous, next) => boundAcceptsPrevious(numericBound(previous, "lower"), numericBound(next, "lower"), "lower") && boundAcceptsPrevious(numericBound(previous, "upper"), numericBound(next, "upper"), "upper");
5700
+ var containsSchemaReference = (value) => !!value && typeof value === "object" && Object.entries(value).some(([key, child]) => ["$ref", "$dynamicRef", "$recursiveRef"].includes(key) || containsSchemaReference(child));
5701
+ var hasPositiveLocalReferences = (schema, names, root = true) => {
5702
+ if (typeof schema === "boolean") return true;
5703
+ if (!schema || typeof schema !== "object" || Array.isArray(schema)) return false;
5704
+ return Object.entries(schema).every(([key, value]) => {
5705
+ if (key === "$ref") return typeof value === "string" && [...names].some((name) => value === `#/$defs/${name.replace(/~/g, "~0").replace(/\//g, "~1")}`);
5706
+ if (["$dynamicRef", "$recursiveRef", "$dynamicAnchor", "$recursiveAnchor", "$anchor"].includes(key)) return false;
5707
+ if (key === "$id") return root;
5708
+ if (key === "$defs" || key === "properties") {
5709
+ if (key === "$defs" && !root) return false;
5710
+ return !!value && typeof value === "object" && !Array.isArray(value) && Object.values(value).every((child) => hasPositiveLocalReferences(child, names, false));
5711
+ }
5712
+ if (["items", "additionalProperties"].includes(key)) return hasPositiveLocalReferences(value, names, false);
5713
+ if (["anyOf", "allOf"].includes(key)) return Array.isArray(value) && value.every((child) => hasPositiveLocalReferences(child, names, false));
5714
+ return !containsSchemaReference(value);
5715
+ });
5716
+ };
5717
+ var isUnreachableConditional = (previous, branch) => {
5718
+ if (previous.type !== "object" || !branch || typeof branch !== "object" || Array.isArray(branch)) return false;
5719
+ const rule = branch;
5720
+ if (!rule.if || Object.keys(rule).some((key) => !["if", "then"].includes(key))) return false;
5721
+ const condition = rule.if;
5722
+ if (typeof condition !== "object" || Array.isArray(condition) || Object.keys(condition).some((key) => !["type", "properties", "required"].includes(key)) || condition.type !== void 0 && condition.type !== "object" || !Array.isArray(condition.required)) return false;
5723
+ return condition.required.some((key) => typeof key === "string" && schemasCannotOverlap(previous.properties?.[key] ?? (previous.patternProperties ? true : previous.additionalProperties ?? true), condition.properties?.[key] ?? true));
5724
+ };
5818
5725
  var acceptsPreviousSchema = (previous, next) => {
5819
5726
  if (canonicalContentHash(previous) === canonicalContentHash(next) || next === true) return true;
5820
5727
  if (previous === false) return true;
@@ -5827,6 +5734,21 @@ var acceptsPreviousSchema = (previous, next) => {
5827
5734
  if (oldBranches) return oldBranches.every((branch) => acceptsPreviousSchema(branch, next));
5828
5735
  const newBranches = branches(after);
5829
5736
  if (newBranches) return newBranches.some((branch, index) => acceptsPreviousSchema(previous, branch) && (!after.oneOf || newBranches.every((other, otherIndex) => index === otherIndex || schemasCannotOverlap(previous, other))));
5737
+ if (canonicalContentHash(before.$defs ?? null) !== canonicalContentHash(after.$defs ?? null)) {
5738
+ const oldDefinitions = before.$defs, newDefinitions = after.$defs;
5739
+ if (!oldDefinitions || !newDefinitions || typeof oldDefinitions !== "object" || typeof newDefinitions !== "object" || Array.isArray(oldDefinitions) || Array.isArray(newDefinitions)) return false;
5740
+ const names = new Set(Object.keys(oldDefinitions));
5741
+ if (names.size !== Object.keys(newDefinitions).length || [...names].some((name) => !Object.prototype.hasOwnProperty.call(newDefinitions, name)) || !hasPositiveLocalReferences(before, names) || !hasPositiveLocalReferences(after, names) || [...names].some((name) => !acceptsPreviousSchema(oldDefinitions[name], newDefinitions[name]))) return false;
5742
+ delete before.$defs;
5743
+ delete after.$defs;
5744
+ }
5745
+ if (canonicalContentHash(before.allOf ?? null) !== canonicalContentHash(after.allOf ?? null)) {
5746
+ if (before.allOf !== void 0 && !Array.isArray(before.allOf) || !Array.isArray(after.allOf)) return false;
5747
+ const previousBranches = before.allOf ?? [];
5748
+ if (previousBranches.some((branch) => !after.allOf.some((candidate) => canonicalContentHash(branch) === canonicalContentHash(candidate))) || after.allOf.some((branch) => !previousBranches.some((candidate) => canonicalContentHash(branch) === canonicalContentHash(candidate)) && !isUnreachableConditional(before, branch))) return false;
5749
+ if (before.allOf === void 0) delete after.allOf;
5750
+ else after.allOf = before.allOf;
5751
+ }
5830
5752
  const {
5831
5753
  properties: oldProperties,
5832
5754
  required: oldRequired,
@@ -7313,4 +7235,4 @@ export {
7313
7235
  PageCompositionSchema,
7314
7236
  compilePageComposition
7315
7237
  };
7316
- //# sourceMappingURL=chunk-Z77X7JMT.mjs.map
7238
+ //# sourceMappingURL=chunk-N3RVZAFT.mjs.map