interaqt 1.5.0 → 1.5.3

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/dist/index.js CHANGED
@@ -18,15 +18,15 @@ function ls(c, t) {
18
18
  function k(c) {
19
19
  return typeof c == "function" ? `func::${c.toString()}` : Array.isArray(c) ? c : Ni(c) && !vi(c) ? `uuid::${c.uuid}` : c;
20
20
  }
21
- function Qt(c, t) {
21
+ function Bt(c, t) {
22
22
  if (c == null || typeof c != "object") return c;
23
- if (Array.isArray(c)) return c.map((i) => Qt(i, t));
23
+ if (Array.isArray(c)) return c.map((i) => Bt(i, t));
24
24
  if (vi(c))
25
- return Object.fromEntries(Object.entries(c).map(([i, r]) => [i, Qt(r, t)]));
25
+ return Object.fromEntries(Object.entries(c).map(([i, r]) => [i, Bt(r, t)]));
26
26
  if (c instanceof Set)
27
- return new Set(Array.from(c.values()).map((i) => Qt(i, t)));
27
+ return new Set(Array.from(c.values()).map((i) => Bt(i, t)));
28
28
  if (c instanceof Map)
29
- return new Map(Array.from(c.entries()).map(([i, r]) => [i, Qt(r, t)]));
29
+ return new Map(Array.from(c.entries()).map(([i, r]) => [i, Bt(r, t)]));
30
30
  const e = c;
31
31
  return t && e._type && e.constructor?.clone ? e.constructor.clone(c, t) : c;
32
32
  }
@@ -60,11 +60,11 @@ function Gi(c) {
60
60
  t.set(r, n);
61
61
  }), t;
62
62
  }
63
- let Ji = 0;
63
+ let Ki = 0;
64
64
  function A(c) {
65
- return c?.uuid || `id_${++Ji}`;
65
+ return c?.uuid || `id_${++Ki}`;
66
66
  }
67
- const Ki = /^[a-zA-Z0-9_]+$/;
67
+ const Ji = /^[a-zA-Z0-9_]+$/;
68
68
  class D {
69
69
  constructor(t, e) {
70
70
  this._type = "Entity", this._options = e, this.uuid = A(e), this.name = t.name, this.properties = t.properties || [], this.computation = t.computation, this.baseEntity = t.baseEntity, this.matchExpression = t.matchExpression, this.inputEntities = t.inputEntities, this.commonProperties = t.commonProperties, this.constraints = t.constraints;
@@ -84,7 +84,7 @@ class D {
84
84
  type: "string",
85
85
  required: !0,
86
86
  constraints: {
87
- nameFormat: ({ name: t }) => Ki.test(t)
87
+ nameFormat: ({ name: t }) => Ji.test(t)
88
88
  }
89
89
  },
90
90
  properties: {
@@ -842,7 +842,7 @@ class xe {
842
842
  return this.create(e.public, e.options);
843
843
  }
844
844
  }
845
- class At {
845
+ class Ct {
846
846
  constructor(t, e) {
847
847
  this._type = "StateMachine", this._options = e, this.uuid = A(e), this.states = t.states, this.transfers = t.transfers, this.initialState = t.initialState;
848
848
  }
@@ -875,7 +875,7 @@ class At {
875
875
  };
876
876
  }
877
877
  static create(t, e) {
878
- const i = new At(t, e);
878
+ const i = new Ct(t, e);
879
879
  if (this.instances.find((a) => a.uuid === i.uuid))
880
880
  throw new Error(`duplicate uuid in options ${i.uuid}, StateMachine`);
881
881
  return this.instances.push(i), i;
@@ -911,7 +911,7 @@ class At {
911
911
  return this.create(e.public, e.options);
912
912
  }
913
913
  }
914
- class Ct {
914
+ class $t {
915
915
  constructor(t, e) {
916
916
  this._type = "WeightedSummation", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps;
917
917
  }
@@ -959,7 +959,7 @@ class Ct {
959
959
  };
960
960
  }
961
961
  static create(t, e) {
962
- const i = new Ct(t, e);
962
+ const i = new $t(t, e);
963
963
  if (this.instances.find((a) => a.uuid === i.uuid))
964
964
  throw new Error(`duplicate uuid in options ${i.uuid}, WeightedSummation`);
965
965
  return this.instances.push(i), i;
@@ -1001,7 +1001,7 @@ class Ct {
1001
1001
  return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
1002
1002
  }
1003
1003
  }
1004
- class $t {
1004
+ class It {
1005
1005
  constructor(t, e) {
1006
1006
  this._type = "Count", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps;
1007
1007
  }
@@ -1044,7 +1044,7 @@ class $t {
1044
1044
  };
1045
1045
  }
1046
1046
  static create(t, e) {
1047
- const i = new $t(t, e);
1047
+ const i = new It(t, e);
1048
1048
  if (this.instances.find((a) => a.uuid === i.uuid))
1049
1049
  throw new Error(`duplicate uuid in options ${i.uuid}, Count`);
1050
1050
  return this.instances.push(i), i;
@@ -1085,7 +1085,7 @@ class $t {
1085
1085
  return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
1086
1086
  }
1087
1087
  }
1088
- class It {
1088
+ class xt {
1089
1089
  constructor(t, e) {
1090
1090
  this._type = "Summation", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.attributeQuery = t.attributeQuery;
1091
1091
  }
@@ -1118,7 +1118,7 @@ class It {
1118
1118
  };
1119
1119
  }
1120
1120
  static create(t, e) {
1121
- const i = new It(t, e);
1121
+ const i = new xt(t, e);
1122
1122
  if (this.instances.find((a) => a.uuid === i.uuid))
1123
1123
  throw new Error(`duplicate uuid in options ${i.uuid}, Summation`);
1124
1124
  return this.instances.push(i), i;
@@ -1153,7 +1153,7 @@ class It {
1153
1153
  return this.create(e.public, e.options);
1154
1154
  }
1155
1155
  }
1156
- class xt {
1156
+ class Mt {
1157
1157
  constructor(t, e) {
1158
1158
  this._type = "Average", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.attributeQuery = t.attributeQuery;
1159
1159
  }
@@ -1186,7 +1186,7 @@ class xt {
1186
1186
  };
1187
1187
  }
1188
1188
  static create(t, e) {
1189
- const i = new xt(t, e);
1189
+ const i = new Mt(t, e);
1190
1190
  if (this.instances.find((a) => a.uuid === i.uuid))
1191
1191
  throw new Error(`duplicate uuid in options ${i.uuid}, Average`);
1192
1192
  return this.instances.push(i), i;
@@ -1221,7 +1221,7 @@ class xt {
1221
1221
  return this.create(e.public, e.options);
1222
1222
  }
1223
1223
  }
1224
- class Mt {
1224
+ class Pt {
1225
1225
  constructor(t, e) {
1226
1226
  this._type = "Every", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps, this.notEmpty = t.notEmpty;
1227
1227
  }
@@ -1269,7 +1269,7 @@ class Mt {
1269
1269
  };
1270
1270
  }
1271
1271
  static create(t, e) {
1272
- const i = new Mt(t, e);
1272
+ const i = new Pt(t, e);
1273
1273
  if (this.instances.find((a) => a.uuid === i.uuid))
1274
1274
  throw new Error(`duplicate uuid in options ${i.uuid}, Every`);
1275
1275
  return this.instances.push(i), i;
@@ -1306,7 +1306,7 @@ class Mt {
1306
1306
  return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
1307
1307
  }
1308
1308
  }
1309
- class Pt {
1309
+ class Dt {
1310
1310
  constructor(t, e) {
1311
1311
  this._type = "Any", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps;
1312
1312
  }
@@ -1354,7 +1354,7 @@ class Pt {
1354
1354
  };
1355
1355
  }
1356
1356
  static create(t, e) {
1357
- const i = new Pt(t, e);
1357
+ const i = new Dt(t, e);
1358
1358
  if (this.instances.find((a) => a.uuid === i.uuid))
1359
1359
  throw new Error(`duplicate uuid in options ${i.uuid}, Any`);
1360
1360
  return this.instances.push(i), i;
@@ -1466,7 +1466,7 @@ class te {
1466
1466
  return typeof i.callback == "string" && i.callback.startsWith("func::") && (i.callback = new Function("return " + i.callback.substring(6))()), this.create(i, e.options);
1467
1467
  }
1468
1468
  }
1469
- class Dt {
1469
+ class Ot {
1470
1470
  constructor(t, e) {
1471
1471
  this._type = "RealTimeValue", this._options = e, this.uuid = A(e), this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps, this.nextRecomputeTime = t.nextRecomputeTime, this.callback = t.callback;
1472
1472
  }
@@ -1504,7 +1504,7 @@ class Dt {
1504
1504
  };
1505
1505
  }
1506
1506
  static create(t, e) {
1507
- const i = new Dt(t, e);
1507
+ const i = new Ot(t, e);
1508
1508
  if (this.instances.find((a) => a.uuid === i.uuid))
1509
1509
  throw new Error(`duplicate uuid in options ${i.uuid}, RealTimeValue`);
1510
1510
  return this.instances.push(i), i;
@@ -1601,7 +1601,7 @@ class Me {
1601
1601
  return typeof r.handle == "string" && r.handle.startsWith("func::") && (i.handle = new Function("return " + r.handle.substring(6))()), this.create(i, e.options);
1602
1602
  }
1603
1603
  }
1604
- class Ot {
1604
+ class Ft {
1605
1605
  constructor(t, e) {
1606
1606
  this._type = "BoolAtomData", this._options = e, this.uuid = A(e), this.type = t.type || "atom", this.data = t.data;
1607
1607
  }
@@ -1630,7 +1630,7 @@ class Ot {
1630
1630
  };
1631
1631
  }
1632
1632
  static create(t, e) {
1633
- const i = new Ot(t, e);
1633
+ const i = new Ft(t, e);
1634
1634
  if (this.instances.find((a) => a.uuid === i.uuid))
1635
1635
  throw new Error(`duplicate uuid in options ${i.uuid}, BoolAtomData`);
1636
1636
  return this.instances.push(i), i;
@@ -1648,7 +1648,7 @@ class Ot {
1648
1648
  return t !== null && typeof t == "object" && typeof t.uuid == "string";
1649
1649
  }
1650
1650
  }
1651
- class Ft {
1651
+ class Lt {
1652
1652
  constructor(t, e) {
1653
1653
  this._type = "BoolExpressionData", this._options = e, this.uuid = A(e), this.type = t.type || "expression", this.operator = t.operator || "and", this.left = t.left, this.right = t.right;
1654
1654
  }
@@ -1689,7 +1689,7 @@ class Ft {
1689
1689
  };
1690
1690
  }
1691
1691
  static create(t, e) {
1692
- const i = new Ft(t, e);
1692
+ const i = new Lt(t, e);
1693
1693
  if (this.instances.find((a) => a.uuid === i.uuid))
1694
1694
  throw new Error(`duplicate uuid in options ${i.uuid}, BoolExpressionData`);
1695
1695
  return this.instances.push(i), i;
@@ -1725,7 +1725,7 @@ class Ft {
1725
1725
  return this.create(e.public, e.options);
1726
1726
  }
1727
1727
  }
1728
- class v {
1728
+ class E {
1729
1729
  constructor(t) {
1730
1730
  if (this.raw = t, !t)
1731
1731
  throw new Error("BoolExp raw data cannot be undefined");
@@ -1733,21 +1733,21 @@ class v {
1733
1733
  throw new Error(`invalid bool expression type: ${JSON.stringify(t)}`);
1734
1734
  }
1735
1735
  static atom(t) {
1736
- return new v({ type: "atom", data: t });
1736
+ return new E({ type: "atom", data: t });
1737
1737
  }
1738
1738
  static and(...t) {
1739
1739
  const e = t.filter((a) => !!a);
1740
1740
  if (e.length === 0)
1741
1741
  return;
1742
1742
  const [i, ...r] = e;
1743
- return r.reduce((a, s) => a.and(s), i instanceof v ? i : new v(v.standardizeData(i)));
1743
+ return r.reduce((a, s) => a.and(s), i instanceof E ? i : new E(E.standardizeData(i)));
1744
1744
  }
1745
1745
  static or(...t) {
1746
1746
  const e = t.filter((a) => !!a);
1747
1747
  if (e.length === 0)
1748
1748
  return;
1749
1749
  const [i, ...r] = e;
1750
- return r.reduce((a, s) => a.or(s), i instanceof v ? i : v.atom(i));
1750
+ return r.reduce((a, s) => a.or(s), i instanceof E ? i : E.atom(i));
1751
1751
  }
1752
1752
  isAtom() {
1753
1753
  return this.raw.type === "atom";
@@ -1756,10 +1756,10 @@ class v {
1756
1756
  return this.raw.type;
1757
1757
  }
1758
1758
  get left() {
1759
- return new v(this.raw.left);
1759
+ return new E(this.raw.left);
1760
1760
  }
1761
1761
  get right() {
1762
- return this.raw.right ? new v(this.raw.right) : void 0;
1762
+ return this.raw.right ? new E(this.raw.right) : void 0;
1763
1763
  }
1764
1764
  get data() {
1765
1765
  return this.raw.data;
@@ -1769,13 +1769,13 @@ class v {
1769
1769
  return this.raw;
1770
1770
  }
1771
1771
  static fromValue(t) {
1772
- return t instanceof v ? t : new v(t);
1772
+ return t instanceof E ? t : new E(t);
1773
1773
  }
1774
1774
  toJSON() {
1775
1775
  return this.raw;
1776
1776
  }
1777
1777
  static fromJSON(t) {
1778
- return new v(t);
1778
+ return new E(t);
1779
1779
  }
1780
1780
  isExpression() {
1781
1781
  return this.raw.type === "expression";
@@ -1784,14 +1784,14 @@ class v {
1784
1784
  return t !== null && typeof t == "object" && "type" in t && (t.type === "atom" || t.type === "expression");
1785
1785
  }
1786
1786
  static standardizeData(t) {
1787
- return t instanceof v ? t.raw : v.isExpressionData(t) ? t : { type: "atom", data: t };
1787
+ return t instanceof E ? t.raw : E.isExpressionData(t) ? t : { type: "atom", data: t };
1788
1788
  }
1789
1789
  and(t) {
1790
- return new v({
1790
+ return new E({
1791
1791
  type: "expression",
1792
1792
  operator: "and",
1793
1793
  left: this.raw,
1794
- right: v.standardizeData(t)
1794
+ right: E.standardizeData(t)
1795
1795
  });
1796
1796
  }
1797
1797
  isAnd() {
@@ -1804,16 +1804,16 @@ class v {
1804
1804
  return this.raw.operator === "not";
1805
1805
  }
1806
1806
  or(t) {
1807
- return new v({
1807
+ return new E({
1808
1808
  type: "expression",
1809
1809
  operator: "or",
1810
1810
  left: this.raw,
1811
- right: t instanceof v ? t.raw : { type: "atom", data: t }
1811
+ right: t instanceof E ? t.raw : { type: "atom", data: t }
1812
1812
  });
1813
1813
  }
1814
1814
  // 取反
1815
1815
  not() {
1816
- return new v({
1816
+ return new E({
1817
1817
  type: "expression",
1818
1818
  operator: "not",
1819
1819
  left: this.raw
@@ -1830,7 +1830,7 @@ class v {
1830
1830
  }
1831
1831
  } else {
1832
1832
  const i = t(this, e);
1833
- return i instanceof v ? i : v.atom(i);
1833
+ return i instanceof E ? i : E.atom(i);
1834
1834
  }
1835
1835
  }
1836
1836
  find(t, e) {
@@ -1891,19 +1891,19 @@ const Yi = [
1891
1891
  Zt,
1892
1892
  mt,
1893
1893
  xe,
1894
- At,
1895
1894
  Ct,
1896
1895
  $t,
1897
1896
  It,
1898
1897
  xt,
1899
1898
  Mt,
1900
1899
  Pt,
1901
- te,
1902
1900
  Dt,
1901
+ te,
1902
+ Ot,
1903
1903
  Me,
1904
1904
  Ie,
1905
- Ot,
1906
- Ft
1905
+ Ft,
1906
+ Lt
1907
1907
  ];
1908
1908
  Yi.forEach((c) => {
1909
1909
  c && c.displayName && Ei(c.displayName, c);
@@ -2431,14 +2431,14 @@ class it {
2431
2431
  }
2432
2432
  class w {
2433
2433
  constructor(t, e, i, r, a) {
2434
- this.map = e, this.contextRootEntity = r, this.fromRelation = a, R(!i || i instanceof v, `match data is not a BoolExpression instance, you passed: ${this.data}`);
2434
+ this.map = e, this.contextRootEntity = r, this.fromRelation = a, R(!i || i instanceof E, `match data is not a BoolExpression instance, you passed: ${this.data}`);
2435
2435
  const s = this.map.getRecordInfo(t);
2436
2436
  this.entityName = s.resolvedBaseRecordName, this.xToOneQueryTree = new G(this.entityName, this.map);
2437
2437
  let n = i;
2438
2438
  s.resolvedMatchExpression && (n = i ? s.resolvedMatchExpression.and(i) : s.resolvedMatchExpression), n && (this.data = this.convertFilteredRelation(n), this.buildQueryTree(this.data, this.xToOneQueryTree));
2439
2439
  }
2440
2440
  static atom(t) {
2441
- return R(t.key !== void 0, "key cannot be undefined"), R(Array.isArray(t.value) && t.value.length === 2, "value must be array"), R(t.value[1] !== void 0, `${t.key} value cannot be undefined`), v.atom(t);
2441
+ return R(t.key !== void 0, "key cannot be undefined"), R(Array.isArray(t.value) && t.value.length === 2, "value must be array"), R(t.value[1] !== void 0, `${t.key} value cannot be undefined`), E.atom(t);
2442
2442
  }
2443
2443
  // TODO 支持更复杂的格式
2444
2444
  // object 表达批量的 and
@@ -2458,7 +2458,7 @@ class w {
2458
2458
  * @returns 路径数组,每个路径是一个字符串数组
2459
2459
  */
2460
2460
  static extractPaths(t) {
2461
- const e = [], i = t instanceof v ? t : v.fromValue(t);
2461
+ const e = [], i = t instanceof E ? t : E.fromValue(t);
2462
2462
  if (i.isExpression())
2463
2463
  i.left && e.push(...w.extractPaths(i.left.raw)), i.right && e.push(...w.extractPaths(i.right.raw));
2464
2464
  else if (i.isAtom()) {
@@ -2470,7 +2470,7 @@ class w {
2470
2470
  convertFilteredRelation(t) {
2471
2471
  if (t.isExpression()) {
2472
2472
  const e = this.convertFilteredRelation(t.left), i = t.right ? this.convertFilteredRelation(t.right) : void 0, r = t.raw;
2473
- return new v({
2473
+ return new E({
2474
2474
  type: "expression",
2475
2475
  operator: r.operator,
2476
2476
  left: e.raw,
@@ -2481,7 +2481,7 @@ class w {
2481
2481
  const o = [...s.resolvedPath, n], l = this.map.getInfoByPath(o), u = s.resolvedPath.concat(l?.isLinkFiltered() ? l.getBaseAttributeInfo().attributeName : n);
2482
2482
  let d = s.matchExpression;
2483
2483
  if (l?.isLinkFiltered()) {
2484
- const h = l.getLinkInfo(), f = new w(h.getResolvedBaseRecordName(), this.map, h.getResolvedMatchExpression()), y = this.map.getReversePath(u), m = [l.isRecordSource() ? "source" : "target", ...y.slice(2)], b = f.rebase(m.join("."));
2484
+ const h = l.getLinkInfo(), f = new w(h.getResolvedBaseRecordName(), this.map, h.getResolvedMatchExpression()), m = this.map.getReversePath(u), y = [l.isRecordSource() ? "source" : "target", ...m.slice(2)], b = f.rebase(y.join("."));
2485
2485
  d = d ? d.and(b) : b;
2486
2486
  }
2487
2487
  return {
@@ -2552,8 +2552,8 @@ class w {
2552
2552
  fieldValue: d,
2553
2553
  fieldParams: h
2554
2554
  };
2555
- const [f, y] = this.getFinalFieldValue(i.data.isReferenceValue, i.data.key, i.data.value, u.join("."), a.fieldType, t, e);
2556
- return v.atom({
2555
+ const [f, m] = this.getFinalFieldValue(i.data.isReferenceValue, i.data.key, i.data.value, u.join("."), a.fieldType, t, e);
2556
+ return E.atom({
2557
2557
  ...i.data,
2558
2558
  fieldName: this.getFinalFieldName(o),
2559
2559
  fieldValue: d,
@@ -2562,7 +2562,7 @@ class w {
2562
2562
  ...i.data,
2563
2563
  fieldName: this.getFinalFieldName(l),
2564
2564
  fieldValue: f,
2565
- fieldParams: y
2565
+ fieldParams: m
2566
2566
  });
2567
2567
  } else {
2568
2568
  if (!n)
@@ -2572,7 +2572,7 @@ class w {
2572
2572
  isFunctionMatch: !0
2573
2573
  };
2574
2574
  const u = [this.entityName].concat(o), d = [this.entityName].concat(l);
2575
- return R(u.length === s.length, `symmetric entity match can only be last, ${u} ${s}`), v.atom({
2575
+ return R(u.length === s.length, `symmetric entity match can only be last, ${u} ${s}`), E.atom({
2576
2576
  ...i.data,
2577
2577
  namePath: u,
2578
2578
  isFunctionMatch: !0
@@ -2585,7 +2585,7 @@ class w {
2585
2585
  }) : null;
2586
2586
  }
2587
2587
  and(t) {
2588
- return t instanceof w ? (R(this.entityName === t.entityName, `cannot and match exp of different entity: ${this.entityName} and ${t.entityName}`), new w(this.entityName, this.map, this.data ? this.data.and(t.data) : t.data, this.contextRootEntity)) : (R(t.key !== void 0, "key cannot be undefined"), R(Array.isArray(t.value) && t.value.length === 2, "value must be array"), R(t.value[1] !== void 0, `${t.key} value cannot be undefined`), new w(this.entityName, this.map, this.data ? this.data.and(t) : v.atom(t), this.contextRootEntity));
2588
+ return t instanceof w ? (R(this.entityName === t.entityName, `cannot and match exp of different entity: ${this.entityName} and ${t.entityName}`), new w(this.entityName, this.map, this.data ? this.data.and(t.data) : t.data, this.contextRootEntity)) : (R(t.key !== void 0, "key cannot be undefined"), R(Array.isArray(t.value) && t.value.length === 2, "value must be array"), R(t.value[1] !== void 0, `${t.key} value cannot be undefined`), new w(this.entityName, this.map, this.data ? this.data.and(t) : E.atom(t), this.contextRootEntity));
2589
2589
  }
2590
2590
  rebase(t) {
2591
2591
  const e = this.map.getInfo(this.entityName, t);
@@ -2608,14 +2608,14 @@ class w {
2608
2608
  const o = n.data, l = o.key.split(".");
2609
2609
  if (l[0] === t) {
2610
2610
  const d = l.slice(1).join(".");
2611
- return v.atom({
2611
+ return E.atom({
2612
2612
  key: d,
2613
2613
  value: o.value,
2614
2614
  isReferenceValue: o.isReferenceValue
2615
2615
  });
2616
2616
  }
2617
2617
  const u = this.map.getShrinkedAttribute(i, `${r}.${o.key}`);
2618
- return v.atom({
2618
+ return E.atom({
2619
2619
  key: u,
2620
2620
  value: o.value,
2621
2621
  isReferenceValue: o.isReferenceValue
@@ -2644,7 +2644,7 @@ class w {
2644
2644
  * @returns MatchExp 实例
2645
2645
  */
2646
2646
  static fromJSON(t, e) {
2647
- const i = t.data ? v.fromValue(t.data) : void 0;
2647
+ const i = t.data ? E.fromValue(t.data) : void 0;
2648
2648
  return new w(
2649
2649
  t.entityName,
2650
2650
  e,
@@ -2688,19 +2688,19 @@ class Zi {
2688
2688
  }
2689
2689
  }
2690
2690
  class L {
2691
- constructor(t, e, i, r, a, s, n, o, l, u = !1, d, h, f, y) {
2692
- this.recordName = t, this.map = e, this.matchExpression = i, this.attributeQuery = r, this.modifier = a, this.contextRootEntity = s, this.parentRecord = n, this.attributeName = o, this.onlyRelationData = l, this.allowNull = u, this.label = d, this.goto = h, this.exit = f, this.alias = y;
2691
+ constructor(t, e, i, r, a, s, n, o, l, u = !1, d, h, f, m) {
2692
+ this.recordName = t, this.map = e, this.matchExpression = i, this.attributeQuery = r, this.modifier = a, this.contextRootEntity = s, this.parentRecord = n, this.attributeName = o, this.onlyRelationData = l, this.allowNull = u, this.label = d, this.goto = h, this.exit = f, this.alias = m;
2693
2693
  }
2694
2694
  static create(t, e, i, r, a, s, n, o = !1, l) {
2695
2695
  const u = e.getRecordInfo(t), d = u.resolvedBaseRecordName, h = new w(d, e, i.matchExpression, r);
2696
2696
  let f = o ? h : h.and({
2697
2697
  key: "id",
2698
2698
  value: ["not", null]
2699
- }), y = f;
2700
- return u.resolvedMatchExpression && (y = f.and(new w(d, e, u.resolvedMatchExpression))), new L(
2699
+ }), m = f;
2700
+ return u.resolvedMatchExpression && (m = f.and(new w(d, e, u.resolvedMatchExpression))), new L(
2701
2701
  d,
2702
2702
  e,
2703
- y,
2703
+ m,
2704
2704
  new O(d, e, i.attributeQuery || [], a, s),
2705
2705
  new Zi(d, e, i.modifier),
2706
2706
  r,
@@ -2805,27 +2805,27 @@ class O {
2805
2805
  const l = typeof o == "string" ? [o, {}, !1] : o, [u, d, h] = l;
2806
2806
  if (u === g) {
2807
2807
  R(!!(this.parentRecord && this.attributeName), `parent record and attribute name cannot be empty when query link data, you passed ${this.parentRecord} ${this.attributeName}`);
2808
- const y = this.map.getInfo(this.parentRecord, this.attributeName);
2809
- this.parentLinkRecordQuery = L.create(y.linkName, this.map, d, void 0);
2808
+ const m = this.map.getInfo(this.parentRecord, this.attributeName);
2809
+ this.parentLinkRecordQuery = L.create(m.linkName, this.map, d, void 0);
2810
2810
  return;
2811
2811
  }
2812
2812
  if (u === tr) {
2813
- n = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((y) => y.attributeName));
2813
+ n = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((m) => m.attributeName));
2814
2814
  return;
2815
2815
  }
2816
2816
  const f = this.map.getInfo(this.recordName, u);
2817
2817
  if (f.isRecord) {
2818
- let y = u, p = d;
2818
+ let m = u, p = d;
2819
2819
  if (f.isLinkFiltered()) {
2820
- y = f.getBaseAttributeInfo().attributeName;
2821
- const b = d.matchExpression, E = f.getLinkInfo().getBaseLinkInfo(), I = new w(E.name, this.map, f.getMatchExpression()).rebase(f.isRecordSource() ? "target" : "source"), S = b ? I.and(b.data) : I;
2820
+ m = f.getBaseAttributeInfo().attributeName;
2821
+ const b = d.matchExpression, v = f.getLinkInfo().getBaseLinkInfo(), I = new w(v.name, this.map, f.getMatchExpression()).rebase(f.isRecordSource() ? "target" : "source"), S = b ? I.and(b.data) : I;
2822
2822
  p = {
2823
2823
  ...d,
2824
2824
  matchExpression: S.data
2825
2825
  };
2826
2826
  }
2827
- const m = L.create(f.recordName, this.map, p, void 0, this.recordName, y, h, !1, u);
2828
- this.relatedRecords.push(m), f.isXToMany ? this.xToManyRecords.push(m) : f.isXToOne && this.xToOneRecords.push(m);
2827
+ const y = L.create(f.recordName, this.map, p, void 0, this.recordName, m, h, !1, u);
2828
+ this.relatedRecords.push(y), f.isXToMany ? this.xToManyRecords.push(y) : f.isXToOne && this.xToOneRecords.push(y);
2829
2829
  } else
2830
2830
  n.add(u);
2831
2831
  }), this.valueAttributes = Array.from(n), this.fullQueryTree = this.buildFullQueryTree();
@@ -3264,7 +3264,7 @@ class rr {
3264
3264
  * 从匹配表达式中提取依赖关系
3265
3265
  */
3266
3266
  extractDependenciesFromExpression(t, e, i) {
3267
- const r = v.fromValue(e);
3267
+ const r = E.fromValue(e);
3268
3268
  if (r.isExpression())
3269
3269
  r.left && this.extractDependenciesFromExpression(t, r.left.raw, i), r.right && this.extractDependenciesFromExpression(t, r.right.raw, i);
3270
3270
  else if (r.isAtom()) {
@@ -3281,13 +3281,13 @@ class rr {
3281
3281
  for (let l = 1; l < o.length - 1; l++) {
3282
3282
  const u = o.slice(0, l + 1), d = this.map.getInfoByPath(u);
3283
3283
  if (d && d.isRecord) {
3284
- const h = d.recordName, f = n.slice(0, l), y = n[n.length - 1], p = i.find(
3285
- (m) => m.entityName === h && JSON.stringify(m.path) === JSON.stringify(f)
3284
+ const h = d.recordName, f = n.slice(0, l), m = n[n.length - 1], p = i.find(
3285
+ (y) => y.entityName === h && JSON.stringify(y.path) === JSON.stringify(f)
3286
3286
  );
3287
- p ? p.attributes.includes(y) || p.attributes.push(y) : i.push({
3287
+ p ? p.attributes.includes(m) || p.attributes.push(m) : i.push({
3288
3288
  entityName: h,
3289
3289
  path: f,
3290
- attributes: [y]
3290
+ attributes: [m]
3291
3291
  });
3292
3292
  }
3293
3293
  }
@@ -3506,24 +3506,24 @@ class sr {
3506
3506
  this.parseMatchExpressionValue(t.recordName, u, t.contextRootEntity, l),
3507
3507
  e,
3508
3508
  l
3509
- ), [f, y] = this.buildSelectClause(
3509
+ ), [f, m] = this.buildSelectClause(
3510
3510
  t.attributeQuery.getValueAndXToOneRecordFields(),
3511
3511
  e
3512
- ), p = this.buildFromClause(t.recordName, e), m = this.buildJoinClause(o, e), b = this.buildModifierClause(t.modifier, e, y);
3512
+ ), p = this.buildFromClause(t.recordName, e), y = this.buildJoinClause(o, e), b = this.buildModifierClause(t.modifier, e, m);
3513
3513
  return [
3514
3514
  `
3515
3515
  SELECT
3516
3516
  ${f}
3517
3517
  FROM
3518
3518
  ${p}
3519
- ${m}
3519
+ ${y}
3520
3520
  WHERE
3521
3521
  ${d}
3522
3522
 
3523
3523
  ${b}
3524
3524
  `,
3525
3525
  h,
3526
- y
3526
+ m
3527
3527
  ];
3528
3528
  }
3529
3529
  /**
@@ -3587,11 +3587,11 @@ ${b}
3587
3587
  const d = o.split(".");
3588
3588
  let h, f;
3589
3589
  d.length === 1 ? (h = [l], f = o) : (h = [l, ...d.slice(0, -1)], f = d[d.length - 1]);
3590
- const [y, p] = this.map.getTableAliasAndFieldName(
3590
+ const [m, p] = this.map.getTableAliasAndFieldName(
3591
3591
  h,
3592
3592
  f
3593
3593
  );
3594
- return `"${`${this.withPrefix(e)}${y}`}"."${p}" ${u}`;
3594
+ return `"${`${this.withPrefix(e)}${m}`}"."${p}" ${u}`;
3595
3595
  }).join(",")}`), r && n.push(`LIMIT ${r}`), a && n.push(`OFFSET ${a}`), n.join(`
3596
3596
  `);
3597
3597
  }
@@ -3615,7 +3615,7 @@ ${b}
3615
3615
  table: d,
3616
3616
  alias: h,
3617
3617
  linkTable: f,
3618
- linkAlias: y
3618
+ linkAlias: m
3619
3619
  } = this.map.getTableAndAliasStack(u).at(-1), [, p] = this.map.getTableAliasAndFieldName(u, "id", !0);
3620
3620
  if (!l.isMergedWithParent())
3621
3621
  if (l.isLinkMergedWithParent()) {
@@ -3627,39 +3627,39 @@ ${b}
3627
3627
  joinTarget: [d, h]
3628
3628
  });
3629
3629
  } else if (l.isLinkMergedWithAttribute()) {
3630
- const m = l.getReverseInfo();
3631
- if (!m.linkField)
3632
- throw new Error(`${m.parentEntityName}.${m.attributeName} has no field`);
3630
+ const y = l.getReverseInfo();
3631
+ if (!y.linkField)
3632
+ throw new Error(`${y.parentEntityName}.${y.attributeName} has no field`);
3633
3633
  r.push({
3634
3634
  for: u,
3635
3635
  joinSource: s,
3636
- joinIdField: [a, m.linkField],
3636
+ joinIdField: [a, y.linkField],
3637
3637
  joinTarget: [d, h]
3638
3638
  });
3639
3639
  } else {
3640
- const m = l.getLinkInfo(), b = l.isLinkManyToManySymmetric() ? l.symmetricDirection === "source" : m.isRelationSource(l.parentEntityName, l.attributeName);
3640
+ const y = l.getLinkInfo(), b = l.isLinkManyToManySymmetric() ? l.symmetricDirection === "source" : y.isRelationSource(l.parentEntityName, l.attributeName);
3641
3641
  r.push({
3642
3642
  for: u,
3643
3643
  joinSource: s,
3644
- joinIdField: [a, b ? m.record.attributes.source.field : m.record.attributes.target.field],
3645
- joinTarget: [f, y]
3644
+ joinIdField: [a, b ? y.record.attributes.source.field : y.record.attributes.target.field],
3645
+ joinTarget: [f, m]
3646
3646
  }), n.onlyIdField() || r.push({
3647
3647
  for: u,
3648
- joinSource: [f, y],
3649
- joinIdField: [b ? m.record.attributes.target.field : m.record.attributes.source.field, p],
3648
+ joinSource: [f, m],
3649
+ joinIdField: [b ? y.record.attributes.target.field : y.record.attributes.source.field, p],
3650
3650
  joinTarget: [d, h]
3651
3651
  });
3652
3652
  }
3653
3653
  if (r.push(...this.getJoinTables(n, u, [p, d, h])), n.parentLinkQueryTree && !n.parentLinkQueryTree.onlyIdField()) {
3654
- const m = u.concat(g), [, b] = this.map.getTableAliasAndFieldName(m, "id", !0), E = [
3654
+ const y = u.concat(g), [, b] = this.map.getTableAliasAndFieldName(y, "id", !0), v = [
3655
3655
  b,
3656
3656
  // link 的 idField
3657
3657
  f,
3658
3658
  // link 的 tableName
3659
- y
3659
+ m
3660
3660
  // link 的 tableAlias
3661
3661
  ];
3662
- r.push(...this.getJoinTables(n.parentLinkQueryTree, m, E));
3662
+ r.push(...this.getJoinTables(n.parentLinkQueryTree, y, v));
3663
3663
  }
3664
3664
  }), r;
3665
3665
  }
@@ -3770,7 +3770,7 @@ WHERE ${a}
3770
3770
  return e?.toLowerCase() === "json" ? JSON.stringify(t) : t;
3771
3771
  }
3772
3772
  }
3773
- const Jt = ":root";
3773
+ const Kt = ":root";
3774
3774
  class dt {
3775
3775
  constructor(t, e, i = []) {
3776
3776
  this.label = t, this.parent = e, this.stack = i;
@@ -3790,7 +3790,7 @@ class dt {
3790
3790
  }
3791
3791
  class nr {
3792
3792
  constructor(t) {
3793
- this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(Jt, t), this.recursiveSaveLabelledRecordQuery(t);
3793
+ this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(Kt, t), this.recursiveSaveLabelledRecordQuery(t);
3794
3794
  }
3795
3795
  recursiveSaveLabelledRecordQuery(t) {
3796
3796
  t.attributeQuery?.relatedRecords.forEach((e) => {
@@ -3828,14 +3828,14 @@ class or {
3828
3828
  * 查找记录(主查询方法)
3829
3829
  * CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
3830
3830
  */
3831
- async findRecords(t, e = "", i, r = new dt(Jt), a = !1) {
3831
+ async findRecords(t, e = "", i, r = new dt(Kt), a = !1) {
3832
3832
  if (i || (i = new nr(t)), t.goto) {
3833
3833
  if (t.exit && await t.exit(r))
3834
3834
  return [];
3835
3835
  const f = i.get(t.goto);
3836
3836
  R(f, `goto ${t.goto} not found`);
3837
- const y = t.matchExpression.and(f.matchExpression), p = f.derive({
3838
- matchExpression: y
3837
+ const m = t.matchExpression.and(f.matchExpression), p = f.derive({
3838
+ matchExpression: m
3839
3839
  });
3840
3840
  return this.findRecords(p, e, i, r);
3841
3841
  }
@@ -3851,30 +3851,30 @@ FOR UPDATE` : s,
3851
3851
  for (let f of t.attributeQuery.xToOneRecords)
3852
3852
  if (f.goto) {
3853
3853
  const p = this.map.getInfo(f.parentRecord, f.attributeName).getReverseInfo()?.attributeName;
3854
- for (let m of d) {
3854
+ for (let y of d) {
3855
3855
  const b = f.matchExpression.and({
3856
3856
  key: `${p}.id`,
3857
- value: ["=", m.id]
3858
- }), E = f.derive({
3857
+ value: ["=", y.id]
3858
+ }), v = f.derive({
3859
3859
  matchExpression: b
3860
- }), N = t.label ? h.concat(m) : h;
3861
- m[f.alias || f.attributeName] = await this.findRecords(E, e, i, N);
3860
+ }), N = t.label ? h.concat(y) : h;
3861
+ y[f.alias || f.attributeName] = await this.findRecords(v, e, i, N);
3862
3862
  }
3863
3863
  }
3864
3864
  for (let f of t.attributeQuery.xToOneRecords) {
3865
- const y = f.attributeQuery.parentLinkRecordQuery;
3866
- if (y)
3867
- for (let p of y.attributeQuery.xToManyRecords) {
3865
+ const m = f.attributeQuery.parentLinkRecordQuery;
3866
+ if (m)
3867
+ for (let p of m.attributeQuery.xToManyRecords) {
3868
3868
  const b = this.map.getInfo(p.parentRecord, p.attributeName).getReverseInfo()?.attributeName;
3869
- for (let E of d) {
3870
- const N = E[f.attributeName][g].id, I = p.derive({
3869
+ for (let v of d) {
3870
+ const N = v[f.attributeName][g].id, I = p.derive({
3871
3871
  matchExpression: p.matchExpression.and({
3872
3872
  key: `${b}.id`,
3873
3873
  value: ["=", N]
3874
3874
  })
3875
- }), S = t.label ? h.concat(E) : h;
3875
+ }), S = t.label ? h.concat(v) : h;
3876
3876
  oe(
3877
- E,
3877
+ v,
3878
3878
  [f.alias || f.attributeName, g, p.attributeName],
3879
3879
  await this.findRecords(
3880
3880
  I,
@@ -3888,12 +3888,12 @@ FOR UPDATE` : s,
3888
3888
  }
3889
3889
  for (let f of t.attributeQuery.xToManyRecords)
3890
3890
  if (!f.onlyRelationData)
3891
- for (let y of d) {
3892
- const p = t.label ? h.concat(y) : h;
3893
- y[f.alias || f.attributeName] = await this.findXToManyRelatedRecords(
3891
+ for (let m of d) {
3892
+ const p = t.label ? h.concat(m) : h;
3893
+ m[f.alias || f.attributeName] = await this.findXToManyRelatedRecords(
3894
3894
  t.recordName,
3895
3895
  f.attributeName,
3896
- y.id,
3896
+ m.id,
3897
3897
  f,
3898
3898
  i,
3899
3899
  p
@@ -3955,28 +3955,28 @@ FOR UPDATE` : s,
3955
3955
  }), u = r.attributeQuery.parentLinkRecordQuery ? r.attributeQuery.withParentLinkData() : r.attributeQuery, d = r.derive({
3956
3956
  matchExpression: l,
3957
3957
  attributeQuery: u
3958
- }), h = await this.findRecords(d, `finding related record: ${r.parentRecord}.${r.attributeName}`, a, s), f = r.attributeQuery.parentLinkRecordQuery ? h.map((m) => {
3958
+ }), h = await this.findRecords(d, `finding related record: ${r.parentRecord}.${r.attributeName}`, a, s), f = r.attributeQuery.parentLinkRecordQuery ? h.map((y) => {
3959
3959
  let b;
3960
3960
  return n.isLinkManyToManySymmetric() ? (b = {
3961
- ...m,
3962
- [g]: m[`${o}:source`]?.[g]?.id ? m[`${o}:source`]?.[g] : m[`${o}:target`]?.[g]
3961
+ ...y,
3962
+ [g]: y[`${o}:source`]?.[g]?.id ? y[`${o}:source`]?.[g] : y[`${o}:target`]?.[g]
3963
3963
  }, delete b[`${o}:source`], delete b[`${o}:target`]) : (b = {
3964
- ...m,
3965
- [g]: m[o][g]
3964
+ ...y,
3965
+ [g]: y[o][g]
3966
3966
  }, delete b[o]), b;
3967
- }) : h, y = d.label && d.label !== s.label ? s.spawn(d.label) : s, p = r.attributeQuery.parentLinkRecordQuery;
3967
+ }) : h, m = d.label && d.label !== s.label ? s.spawn(d.label) : s, p = r.attributeQuery.parentLinkRecordQuery;
3968
3968
  if (p)
3969
- for (let m of p.attributeQuery.xToManyRecords)
3969
+ for (let y of p.attributeQuery.xToManyRecords)
3970
3970
  for (let b of f) {
3971
- const E = b[g].id, N = d.label ? y.concat(b) : y;
3971
+ const v = b[g].id, N = d.label ? m.concat(b) : m;
3972
3972
  oe(
3973
3973
  b,
3974
- [g, m.attributeName],
3974
+ [g, y.attributeName],
3975
3975
  await this.findXToManyRelatedRecords(
3976
- m.parentRecord,
3977
- m.attributeName,
3978
- E,
3979
- m,
3976
+ y.parentRecord,
3977
+ y.attributeName,
3978
+ v,
3979
+ y,
3980
3980
  a,
3981
3981
  N
3982
3982
  )
@@ -3993,18 +3993,18 @@ FOR UPDATE` : s,
3993
3993
  value: ["=", i]
3994
3994
  }), u = O.getAttributeQueryDataForRecord(t, this.map, !0, !0, !1, !0), d = e;
3995
3995
  let h = u;
3996
- for (let m of o)
3997
- h.push([m, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
3996
+ for (let y of o)
3997
+ h.push([y, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
3998
3998
  h.push([n, { label: d, attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
3999
- for (let m of o)
4000
- h.push([m, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
3999
+ for (let y of o)
4000
+ h.push([y, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
4001
4001
  let f;
4002
- const y = async (m) => {
4002
+ const m = async (y) => {
4003
4003
  if (f) return !0;
4004
- if (m.stack.at(-1)?.id === r)
4005
- return f = [...m.stack], !0;
4004
+ if (y.stack.at(-1)?.id === r)
4005
+ return f = [...y.stack], !0;
4006
4006
  };
4007
- h.push([n, { goto: d, exit: y }]);
4007
+ h.push([n, { goto: d, exit: m }]);
4008
4008
  const p = (await this.findRecords(L.create(t, this.map, {
4009
4009
  matchExpression: l,
4010
4010
  attributeQuery: u
@@ -4310,11 +4310,11 @@ class ur {
4310
4310
  * 查找记录(主查询方法)- 委托给 QueryExecutor
4311
4311
  * CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
4312
4312
  */
4313
- async findRecords(t, e = "", i, r = new dt(Jt)) {
4313
+ async findRecords(t, e = "", i, r = new dt(Kt)) {
4314
4314
  return this.queryExecutor.findRecords(t, e, i, r);
4315
4315
  }
4316
4316
  async lockRecords(t, e = "") {
4317
- return this.queryExecutor.findRecords(t, e, void 0, new dt(Jt), !0);
4317
+ return this.queryExecutor.findRecords(t, e, void 0, new dt(Kt), !0);
4318
4318
  }
4319
4319
  // 委托给 CreationExecutor
4320
4320
  async createRecordDependency(t, e) {
@@ -4544,7 +4544,7 @@ class ti {
4544
4544
  return this.map.getInfo(t, e).recordName;
4545
4545
  }
4546
4546
  }
4547
- class vt {
4547
+ class Et {
4548
4548
  constructor(t, e) {
4549
4549
  this.name = t, this.map = e, this.data = this.map.data.records[t];
4550
4550
  }
@@ -4615,7 +4615,7 @@ class vt {
4615
4615
  return this.data.matchExpression;
4616
4616
  }
4617
4617
  get filteredBy() {
4618
- return this.data.filteredBy?.map((t) => new vt(t, this.map));
4618
+ return this.data.filteredBy?.map((t) => new Et(t, this.map));
4619
4619
  }
4620
4620
  get isFilteredEntity() {
4621
4621
  return this.data?.isFilteredEntity;
@@ -4633,7 +4633,7 @@ class vt {
4633
4633
  return this.data?.resolvedMatchExpression;
4634
4634
  }
4635
4635
  }
4636
- class Kt {
4636
+ class Jt {
4637
4637
  constructor(t, e, i, r = !0) {
4638
4638
  this.name = t, this.data = e, this.map = i, this.isFromSource = r;
4639
4639
  }
@@ -4662,10 +4662,10 @@ class Kt {
4662
4662
  return this.data.sourceRecord;
4663
4663
  }
4664
4664
  get sourceRecordInfo() {
4665
- return new vt(this.data.sourceRecord, this.map);
4665
+ return new Et(this.data.sourceRecord, this.map);
4666
4666
  }
4667
4667
  get targetRecordInfo() {
4668
- return new vt(this.data.targetRecord, this.map);
4668
+ return new Et(this.data.targetRecord, this.map);
4669
4669
  }
4670
4670
  get targetRecord() {
4671
4671
  return this.data.targetRecord;
@@ -4721,7 +4721,7 @@ class Kt {
4721
4721
  getBaseLinkInfo() {
4722
4722
  R(this.isFilteredRelation(), "only filtered relation can get base link info");
4723
4723
  const t = this.data.baseLinkName;
4724
- return new Kt(t, this.map.data.links[t], this.map);
4724
+ return new Jt(t, this.map.data.links[t], this.map);
4725
4725
  }
4726
4726
  getMatchExpression() {
4727
4727
  if (this.isFilteredRelation())
@@ -4749,7 +4749,7 @@ class ut {
4749
4749
  return this.data.records[t].attributes[this.getAttributeAndSymmetricDirection(e)[0]];
4750
4750
  }
4751
4751
  getRecordInfo(t) {
4752
- return new vt(t, this);
4752
+ return new Et(t, this);
4753
4753
  }
4754
4754
  getInfo(t, e) {
4755
4755
  const i = this.getInfoByPath([t, ...e.split(".")]);
@@ -4760,10 +4760,10 @@ class ut {
4760
4760
  }
4761
4761
  getLinkInfo(t, e) {
4762
4762
  const i = this.getAttributeAndSymmetricDirection(e)[0], { linkName: r, isSource: a } = this.data.records[t].attributes[i];
4763
- return R(!!r, `cannot find relation ${t} ${i}`), new Kt(r, this.data.links[r], this, !!a);
4763
+ return R(!!r, `cannot find relation ${t} ${i}`), new Jt(r, this.data.links[r], this, !!a);
4764
4764
  }
4765
4765
  getLinkInfoByName(t) {
4766
- return R(!!this.data.links[t], `cannot find link ${t}`), new Kt(t, this.data.links[t], this);
4766
+ return R(!!this.data.links[t], `cannot find link ${t}`), new Jt(t, this.data.links[t], this);
4767
4767
  }
4768
4768
  getInfoByPath(t) {
4769
4769
  const [e, ...i] = t;
@@ -4797,19 +4797,19 @@ class ut {
4797
4797
  path: [e]
4798
4798
  }];
4799
4799
  for (let h = 0; h < i.length; h++) {
4800
- const [f, y] = this.getAttributeAndSymmetricDirection(i[h]), p = [e, ...i.slice(0, h + 1)];
4800
+ const [f, m] = this.getAttributeAndSymmetricDirection(i[h]), p = [e, ...i.slice(0, h + 1)];
4801
4801
  if (f === g) {
4802
- const { linkTable: m, linkAlias: b, path: E } = d.pop();
4803
- R(!l, `last attribute in path is a link, cannot read link of a link ${E.join(".")}`), a = m, s = b, r = this.data.records[u.linkName], l = !0, n = "", o = "", u = void 0;
4802
+ const { linkTable: y, linkAlias: b, path: v } = d.pop();
4803
+ R(!l, `last attribute in path is a link, cannot read link of a link ${v.join(".")}`), a = y, s = b, r = this.data.records[u.linkName], l = !0, n = "", o = "", u = void 0;
4804
4804
  } else {
4805
4805
  u = this.getInfoByPath(p);
4806
- const m = r.attributes[f];
4806
+ const y = r.attributes[f];
4807
4807
  R(u.isRecord, `${i.slice(0, h + 1).join(".")} is not a entity attribute`);
4808
- const b = this.data.records[m.recordName], E = `${s}_${f}${y ? `_${y.toUpperCase()}` : ""}`, N = this.aliasManager?.getTableAlias(E) || E;
4808
+ const b = this.data.records[y.recordName], v = `${s}_${f}${m ? `_${m.toUpperCase()}` : ""}`, N = this.aliasManager?.getTableAlias(v) || v;
4809
4809
  if (u.isMergedWithParent() || u.isLinkMergedWithParent())
4810
4810
  o = s;
4811
4811
  else if (u.isLinkIsolated()) {
4812
- const I = `REL_${E}`;
4812
+ const I = `REL_${v}`;
4813
4813
  o = this.aliasManager?.getTableAlias(I) || I;
4814
4814
  } else
4815
4815
  o = N;
@@ -4831,15 +4831,15 @@ class ut {
4831
4831
  const r = this.getTableAndAliasStack(t), { table: a, alias: s, record: n, path: o, linkAlias: l, linkTable: u, isLinkRecord: d } = r.at(-1), h = !d && r.length > 1 ? this.getInfoByPath(o) : null;
4832
4832
  if (!i && e === "id" && !d && t.length > 1 && (h?.isLinkMergedWithParent() || h?.isLinkIsolated()))
4833
4833
  if (h?.isLinkMergedWithParent()) {
4834
- const { alias: y, table: p } = r.at(-2);
4835
- return [y, h.linkField, p];
4834
+ const { alias: m, table: p } = r.at(-2);
4835
+ return [m, h.linkField, p];
4836
4836
  } else {
4837
- const y = h.getLinkInfo().record, p = h?.isLinkManyToManySymmetric() ? h?.symmetricDirection === "source" ? y?.attributes.target.field : y?.attributes.source.field : h.isRecordSource() ? y?.attributes.target.field : y?.attributes.source.field;
4837
+ const m = h.getLinkInfo().record, p = h?.isLinkManyToManySymmetric() ? h?.symmetricDirection === "source" ? m?.attributes.target.field : m?.attributes.source.field : h.isRecordSource() ? m?.attributes.target.field : m?.attributes.source.field;
4838
4838
  return [l, p, u];
4839
4839
  }
4840
4840
  else {
4841
- const y = n.attributes[this.getAttributeAndSymmetricDirection(e)[0]].field;
4842
- return [s, y, a];
4841
+ const m = n.attributes[this.getAttributeAndSymmetricDirection(e)[0]].field;
4842
+ return [s, m, a];
4843
4843
  }
4844
4844
  }
4845
4845
  findManyToManySymmetricPath(t) {
@@ -4907,12 +4907,12 @@ class ut {
4907
4907
  const h = d.getLinkInfo().data;
4908
4908
  let f;
4909
4909
  d.isRecordSource() ? f = h.targetRecord : f = h.sourceRecord;
4910
- let y;
4911
- if (u === "source" ? y = h.sourceRecord : y = h.targetRecord, f === y) {
4910
+ let m;
4911
+ if (u === "source" ? m = h.sourceRecord : m = h.targetRecord, f === m) {
4912
4912
  n += 2;
4913
4913
  continue;
4914
4914
  } else {
4915
- a = y, s = a, a = "", s = "", r.push(o), r.push(u), n += 2;
4915
+ a = m, s = a, a = "", s = "", r.push(o), r.push(u), n += 2;
4916
4916
  continue;
4917
4917
  }
4918
4918
  }
@@ -4971,7 +4971,7 @@ function pr(c, t) {
4971
4971
  ), e.getAll();
4972
4972
  }
4973
4973
  function ei(c, t, e, i) {
4974
- const r = c.filter((a) => qt(a) !== void 0);
4974
+ const r = c.filter((a) => _t(a) !== void 0);
4975
4975
  for (const a of r)
4976
4976
  fr(
4977
4977
  a,
@@ -4988,9 +4988,9 @@ function fr(c, t, e, i) {
4988
4988
  t
4989
4989
  );
4990
4990
  t.replace(o, c), l !== o && t.add(l);
4991
- const u = qt(c) || [];
4991
+ const u = _t(c) || [];
4992
4992
  if (c.commonProperties) {
4993
- const d = u.filter((h) => c.commonProperties.some((f) => !h.properties.some((y) => y.name === f.name && y.type === f.type)));
4993
+ const d = u.filter((h) => c.commonProperties.some((f) => !h.properties.some((m) => m.name === f.name && m.type === f.type)));
4994
4994
  if (d.length > 0)
4995
4995
  throw new Error(`Merged ${e} ${c.name} defined commonProperties, but these ${e}s do not have commonProperties: ${d.map((h) => h.name).join(", ")}`);
4996
4996
  }
@@ -5016,7 +5016,7 @@ function mr(c, t, e, i, r) {
5016
5016
  o && i.replace(a, o);
5017
5017
  }
5018
5018
  function yr(c, t) {
5019
- const e = /* @__PURE__ */ new Map(), i = qt(c);
5019
+ const e = /* @__PURE__ */ new Map(), i = _t(c);
5020
5020
  if (i && i.length > 0)
5021
5021
  for (const r of i) {
5022
5022
  const a = yt(r), s = [...t.get(a) || []], n = e.get(a) || [];
@@ -5035,7 +5035,7 @@ function gr(c, t, e) {
5035
5035
  name: c,
5036
5036
  type: "json",
5037
5037
  defaultValue: (r, a) => {
5038
- const s = qt(t) || [], o = (i.get(a) || []).filter(
5038
+ const s = _t(t) || [], o = (i.get(a) || []).filter(
5039
5039
  (l) => s.some((u) => yt(u) === l)
5040
5040
  );
5041
5041
  return o.length > 0 ? o : [a];
@@ -5043,10 +5043,10 @@ function gr(c, t, e) {
5043
5043
  });
5044
5044
  }
5045
5045
  function br(c, t, e) {
5046
- const i = qt(c) || [], r = [], a = /* @__PURE__ */ new Map(), s = Object.fromEntries(c.commonProperties?.map((n) => [n.name, n]) || []);
5046
+ const i = _t(c) || [], r = [], a = /* @__PURE__ */ new Map(), s = Object.fromEntries(c.commonProperties?.map((n) => [n.name, n]) || []);
5047
5047
  for (const n of i) {
5048
5048
  let o = n;
5049
- if (Lt(o))
5049
+ if (qt(o))
5050
5050
  for (; o.baseEntity && o.properties.length === 0; )
5051
5051
  o = o.baseEntity;
5052
5052
  else if (vr(o))
@@ -5062,7 +5062,7 @@ function br(c, t, e) {
5062
5062
  else {
5063
5063
  const f = e.getEntityByName(h) || e.getRelationByName(h);
5064
5064
  if (!(f.inputEntities || f.inputRelations)) {
5065
- const p = Object.fromEntries(f.properties.map((m) => [m.name, m]));
5065
+ const p = Object.fromEntries(f.properties.map((y) => [y.name, y]));
5066
5066
  a.set(h, p), Object.assign(s, p);
5067
5067
  }
5068
5068
  }
@@ -5093,7 +5093,7 @@ function wr(c, t, e, i) {
5093
5093
  r,
5094
5094
  ...c.properties
5095
5095
  ];
5096
- if (Lt(c)) {
5096
+ if (qt(c)) {
5097
5097
  const s = i.getEntityByName(c.name), n = D.create({
5098
5098
  name: s.name
5099
5099
  });
@@ -5144,7 +5144,7 @@ function wr(c, t, e, i) {
5144
5144
  }
5145
5145
  }
5146
5146
  function Rr(c, t, e) {
5147
- if (Lt(c)) {
5147
+ if (qt(c)) {
5148
5148
  const i = c, r = t;
5149
5149
  let a = i;
5150
5150
  if (i.baseEntity)
@@ -5175,17 +5175,17 @@ function Nr(c) {
5175
5175
  t = t.baseRelation;
5176
5176
  return t;
5177
5177
  }
5178
- function Lt(c) {
5178
+ function qt(c) {
5179
5179
  return "inputEntities" in c || !("sourceProperty" in c);
5180
5180
  }
5181
5181
  function vr(c) {
5182
5182
  return "sourceProperty" in c;
5183
5183
  }
5184
- function qt(c) {
5185
- return Lt(c) ? c.inputEntities : c.inputRelations;
5184
+ function _t(c) {
5185
+ return qt(c) ? c.inputEntities : c.inputRelations;
5186
5186
  }
5187
5187
  function yt(c) {
5188
- return Lt(c), c.name;
5188
+ return qt(c), c.name;
5189
5189
  }
5190
5190
  class Er {
5191
5191
  constructor() {
@@ -5308,7 +5308,7 @@ function Q(c) {
5308
5308
  function ot(c, t) {
5309
5309
  return t.name === "mysql" ? `\`${c.replace(/`/g, "``")}\`` : `"${c.replace(/"/g, '""')}"`;
5310
5310
  }
5311
- function Bt(c, t) {
5311
+ function Ut(c, t) {
5312
5312
  return t.encodeLiteral(c);
5313
5313
  }
5314
5314
  function Tr(c, t, e) {
@@ -5319,16 +5319,16 @@ function Tr(c, t, e) {
5319
5319
  case "isNotNull":
5320
5320
  return `${i} IS NOT NULL`;
5321
5321
  case "equals":
5322
- return t.value === null ? `${i} IS NULL` : `${i} = ${Bt(t.value, e)}`;
5322
+ return t.value === null ? `${i} IS NULL` : `${i} = ${Ut(t.value, e)}`;
5323
5323
  case "notEquals":
5324
- return t.value === null ? `${i} IS NOT NULL` : `${i} != ${Bt(t.value, e)}`;
5324
+ return t.value === null ? `${i} IS NOT NULL` : `${i} != ${Ut(t.value, e)}`;
5325
5325
  case "in": {
5326
5326
  const r = t.value.filter((s) => s !== null), a = [];
5327
- return t.value.some((s) => s === null) && a.push(`${i} IS NULL`), r.length && a.push(`${i} IN (${r.map((s) => Bt(s, e)).join(", ")})`), `(${a.join(" OR ")})`;
5327
+ return t.value.some((s) => s === null) && a.push(`${i} IS NULL`), r.length && a.push(`${i} IN (${r.map((s) => Ut(s, e)).join(", ")})`), `(${a.join(" OR ")})`;
5328
5328
  }
5329
5329
  case "notIn": {
5330
5330
  const r = t.value.filter((s) => s !== null), a = [];
5331
- return t.value.some((s) => s === null) && a.push(`${i} IS NOT NULL`), r.length && a.push(`${i} NOT IN (${r.map((s) => Bt(s, e)).join(", ")})`), `(${a.join(" AND ")})`;
5331
+ return t.value.some((s) => s === null) && a.push(`${i} IS NOT NULL`), r.length && a.push(`${i} NOT IN (${r.map((s) => Ut(s, e)).join(", ")})`), `(${a.join(" AND ")})`;
5332
5332
  }
5333
5333
  }
5334
5334
  }
@@ -5778,12 +5778,12 @@ class ri {
5778
5778
  const [a, ...s] = r.split(".");
5779
5779
  let n = a;
5780
5780
  for (let o = 0; o < s.length; o++) {
5781
- const l = s[o], u = this.map.records[n].attributes[l], d = u.linkName, h = this.map.links[d], { relType: f, sourceRecord: y, targetRecord: p } = h;
5781
+ const l = s[o], u = this.map.records[n].attributes[l], d = u.linkName, h = this.map.links[d], { relType: f, sourceRecord: m, targetRecord: p } = h;
5782
5782
  R(
5783
- f[0] === "1" && f[1] === "1" && y !== p,
5783
+ f[0] === "1" && f[1] === "1" && m !== p,
5784
5784
  `only 1:1 can merge: ${a}.${s.slice(0, o + 1).join(".")}`
5785
5785
  );
5786
- const m = y === n ? p : y, b = this.combineRecordTable(n, m, d);
5786
+ const y = m === n ? p : m, b = this.combineRecordTable(n, y, d);
5787
5787
  if (b)
5788
5788
  throw new Error(`conflict found when join ${d}, ${b.join(",")} already merged with ${n}`);
5789
5789
  h.mergedTo = "combined", i.push(h), n = u.recordName, delete t[d], delete e[d];
@@ -6041,7 +6041,7 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
6041
6041
  });
6042
6042
  }
6043
6043
  }
6044
- const wt = "_System_", J = "_Dictionary_", ai = "id", si = "_rowId", ni = D.create({
6044
+ const wt = "_System_", K = "_Dictionary_", ai = "id", si = "_rowId", ni = D.create({
6045
6045
  name: wt,
6046
6046
  properties: [
6047
6047
  T.create({
@@ -6061,7 +6061,7 @@ const wt = "_System_", J = "_Dictionary_", ai = "id", si = "_rowId", ni = D.crea
6061
6061
  })
6062
6062
  ]
6063
6063
  }), oi = D.create({
6064
- name: J,
6064
+ name: K,
6065
6065
  properties: [
6066
6066
  T.create({
6067
6067
  name: "key",
@@ -6139,7 +6139,7 @@ class Ci {
6139
6139
  * @returns 是否需要触发计算
6140
6140
  */
6141
6141
  shouldTriggerUpdateComputation(t, e) {
6142
- return t.type !== "update" || !("dataDep" in t) ? !0 : t.dataDep.type === "global" && e.recordName === J ? e.record?.key === t.dataDep.source.name : t.attributes.includes("*") ? Object.keys(e.record || {}).some(
6142
+ return t.type !== "update" || !("dataDep" in t) ? !0 : t.dataDep.type === "global" && e.recordName === K ? e.record?.key === t.dataDep.source.name : t.attributes.includes("*") ? Object.keys(e.record || {}).some(
6143
6143
  (r) => r !== "id" && e.record[r] !== e.oldRecord?.[r]
6144
6144
  ) : !t.attributes.filter((r) => r !== "id").every(
6145
6145
  (r) => !e.record.hasOwnProperty(r) || e.record[r] === e.oldRecord[r]
@@ -6199,15 +6199,15 @@ class Ci {
6199
6199
  } else e.type === "global" && ((!r || r === "update") && s.push({
6200
6200
  dataDep: e,
6201
6201
  type: "update",
6202
- recordName: J,
6203
- sourceRecordName: J,
6202
+ recordName: K,
6203
+ sourceRecordName: K,
6204
6204
  attributes: ["value"],
6205
6205
  computation: i
6206
6206
  }), (!r || r === "create") && s.push({
6207
6207
  dataDep: e,
6208
6208
  type: "create",
6209
- recordName: J,
6210
- sourceRecordName: J,
6209
+ recordName: K,
6210
+ sourceRecordName: K,
6211
6211
  computation: i
6212
6212
  }));
6213
6213
  return s;
@@ -6312,7 +6312,7 @@ class x {
6312
6312
  this.resolved = (t, e) => new ee(t, e);
6313
6313
  }
6314
6314
  static {
6315
- this.async = (t) => new _t(t);
6315
+ this.async = (t) => new Vt(t);
6316
6316
  }
6317
6317
  static {
6318
6318
  this.fullRecompute = (t) => new Xt(t);
@@ -6325,7 +6325,7 @@ class Xt extends x {
6325
6325
  super(), this.reason = t;
6326
6326
  }
6327
6327
  }
6328
- class _t extends x {
6328
+ class Vt extends x {
6329
6329
  constructor(t) {
6330
6330
  super(), this.args = t;
6331
6331
  }
@@ -6514,7 +6514,7 @@ class Ar {
6514
6514
  }
6515
6515
  }
6516
6516
  static {
6517
- this.computationType = At;
6517
+ this.computationType = Ct;
6518
6518
  }
6519
6519
  static {
6520
6520
  this.contextType = "global";
@@ -6547,7 +6547,7 @@ class Cr {
6547
6547
  }
6548
6548
  }
6549
6549
  static {
6550
- this.computationType = At;
6550
+ this.computationType = Ct;
6551
6551
  }
6552
6552
  static {
6553
6553
  this.contextType = "property";
@@ -6609,7 +6609,7 @@ class Ir {
6609
6609
  };
6610
6610
  }
6611
6611
  static {
6612
- this.computationType = Ct;
6612
+ this.computationType = $t;
6613
6613
  }
6614
6614
  static {
6615
6615
  this.contextType = "global";
@@ -6668,7 +6668,7 @@ class xr {
6668
6668
  };
6669
6669
  }
6670
6670
  static {
6671
- this.computationType = Ct;
6671
+ this.computationType = $t;
6672
6672
  }
6673
6673
  static {
6674
6674
  this.contextType = "property";
@@ -6739,7 +6739,7 @@ class Pr {
6739
6739
  }, this.defaultValue = !this.args.notEmpty;
6740
6740
  }
6741
6741
  static {
6742
- this.computationType = Mt;
6742
+ this.computationType = Pt;
6743
6743
  }
6744
6744
  static {
6745
6745
  this.contextType = "global";
@@ -6807,7 +6807,7 @@ class Dr {
6807
6807
  };
6808
6808
  }
6809
6809
  static {
6810
- this.computationType = Mt;
6810
+ this.computationType = Pt;
6811
6811
  }
6812
6812
  static {
6813
6813
  this.contextType = "property";
@@ -6843,15 +6843,15 @@ class Dr {
6843
6843
  }), void 0, this.relationAttributeQuery))[this.isSource ? "target" : "source"];
6844
6844
  h["&"] = u;
6845
6845
  const f = !!this.callback.call(this.controller, h, r);
6846
- let y;
6846
+ let m;
6847
6847
  try {
6848
- ({ oldValue: y } = await this.state.isItemMatch.replace(u, f));
6848
+ ({ oldValue: m } = await this.state.isItemMatch.replace(u, f));
6849
6849
  } catch (p) {
6850
6850
  if (p instanceof Error && p.message.includes("Atomic replace target not found"))
6851
6851
  return x.fullRecompute("relation contribution state target not found");
6852
6852
  throw p;
6853
6853
  }
6854
- s = Number(f) - +!!y, n = 1;
6854
+ s = Number(f) - +!!m, n = 1;
6855
6855
  } else if (a.type === "delete" && a.recordName === this.relation.name) {
6856
6856
  const u = a.record;
6857
6857
  s = !!await this.state.isItemMatch.get(u) ? -1 : 0, n = -1;
@@ -6868,16 +6868,16 @@ class Dr {
6868
6868
  value: ["=", a.oldRecord.id]
6869
6869
  }), h = await this.controller.system.storage.findOne(this.relation.name, d, void 0, this.relationAttributeQuery), f = h[this.isSource ? "target" : "source"];
6870
6870
  f["&"] = h;
6871
- const y = !!this.callback.call(this.controller, f, r);
6871
+ const m = !!this.callback.call(this.controller, f, r);
6872
6872
  let p;
6873
6873
  try {
6874
- ({ oldValue: p } = await this.state.isItemMatch.replace(h, y));
6875
- } catch (m) {
6876
- if (m instanceof Error && m.message.includes("Atomic replace target not found"))
6874
+ ({ oldValue: p } = await this.state.isItemMatch.replace(h, m));
6875
+ } catch (y) {
6876
+ if (y instanceof Error && y.message.includes("Atomic replace target not found"))
6877
6877
  return x.fullRecompute("relation contribution state target not found");
6878
- throw m;
6878
+ throw y;
6879
6879
  }
6880
- s = Number(y) - +!!p;
6880
+ s = Number(m) - +!!p;
6881
6881
  } else
6882
6882
  return x.fullRecompute("mutation is not caused by relation.");
6883
6883
  const o = await this.state.matchCount.increment(e.record, s), l = await this.state.totalCount.increment(e.record, n);
@@ -6897,7 +6897,7 @@ class Fr {
6897
6897
  };
6898
6898
  }
6899
6899
  static {
6900
- this.computationType = Pt;
6900
+ this.computationType = Dt;
6901
6901
  }
6902
6902
  static {
6903
6903
  this.contextType = "global";
@@ -6961,7 +6961,7 @@ class Lr {
6961
6961
  };
6962
6962
  }
6963
6963
  static {
6964
- this.computationType = Pt;
6964
+ this.computationType = Dt;
6965
6965
  }
6966
6966
  static {
6967
6967
  this.contextType = "property";
@@ -7032,7 +7032,7 @@ class _r {
7032
7032
  };
7033
7033
  }
7034
7034
  static {
7035
- this.computationType = $t;
7035
+ this.computationType = It;
7036
7036
  }
7037
7037
  static {
7038
7038
  this.contextType = "global";
@@ -7090,7 +7090,7 @@ class Vr {
7090
7090
  };
7091
7091
  }
7092
7092
  static {
7093
- this.computationType = $t;
7093
+ this.computationType = It;
7094
7094
  }
7095
7095
  static {
7096
7096
  this.contextType = "property";
@@ -7344,14 +7344,14 @@ const ci = [10, 25, 60, 150, 350];
7344
7344
  function Wr(c) {
7345
7345
  return new Promise((t) => setTimeout(t, c));
7346
7346
  }
7347
- function Ut(c, t, e, i) {
7347
+ function Ht(c, t, e, i) {
7348
7348
  return c && typeof c == "object" && Object.assign(c, {
7349
7349
  transactionAttempts: t,
7350
7350
  transactionIsolation: e,
7351
7351
  transactionName: i
7352
7352
  }), c;
7353
7353
  }
7354
- class jt extends Error {
7354
+ class Wt extends Error {
7355
7355
  constructor(t, e, i, r) {
7356
7356
  super(`Transaction retry exhausted for ${t} after ${e} attempts`, { cause: r }), this.name = "TransactionRetryExhaustedError", this.transactionAttempts = e, this.transactionIsolation = i, this.transactionName = t, Object.assign(this, {
7357
7357
  transactionAttempts: e,
@@ -7361,7 +7361,7 @@ class jt extends Error {
7361
7361
  }
7362
7362
  }
7363
7363
  function Ss(c) {
7364
- return Y(c).some((t) => t instanceof jt);
7364
+ return Y(c).some((t) => t instanceof Wt);
7365
7365
  }
7366
7366
  function ks(c) {
7367
7367
  return Y(c).some((t) => t instanceof Re);
@@ -7376,11 +7376,11 @@ async function De(c, t, e = {}) {
7376
7376
  } catch (n) {
7377
7377
  if (s = n, Ur(n)) {
7378
7378
  if (r = "SERIALIZABLE", a < i) continue;
7379
- throw new jt(
7379
+ throw new Wt(
7380
7380
  c,
7381
7381
  a,
7382
7382
  r,
7383
- Ut(n, a, r, c)
7383
+ Ht(n, a, r, c)
7384
7384
  );
7385
7385
  }
7386
7386
  if (Hr(n)) {
@@ -7389,17 +7389,17 @@ async function De(c, t, e = {}) {
7389
7389
  await Wr(o + l);
7390
7390
  continue;
7391
7391
  }
7392
- throw new jt(
7392
+ throw new Wt(
7393
7393
  c,
7394
7394
  a,
7395
7395
  r,
7396
- Ut(n, a, r, c)
7396
+ Ht(n, a, r, c)
7397
7397
  );
7398
7398
  }
7399
- throw Ut(n, a, r, c);
7399
+ throw Ht(n, a, r, c);
7400
7400
  }
7401
7401
  }
7402
- throw new jt(c, a, r, Ut(s, a, r, c));
7402
+ throw new Wt(c, a, r, Ht(s, a, r, c));
7403
7403
  }
7404
7404
  class Gr {
7405
7405
  constructor(t, e, i) {
@@ -7434,7 +7434,7 @@ class Gr {
7434
7434
  for (const i of t) {
7435
7435
  const r = await this.transformCallback.call(this.controller, i);
7436
7436
  (Array.isArray(r) ? r : [r]).forEach((s, n) => {
7437
- e.push({
7437
+ s && e.push({
7438
7438
  ...s,
7439
7439
  [this.state.sourceRecordId.key]: i.id,
7440
7440
  [this.state.transformIndex.key]: n
@@ -7520,7 +7520,7 @@ class Gr {
7520
7520
  return r;
7521
7521
  }
7522
7522
  }
7523
- const Jr = [Gr];
7523
+ const Kr = [Gr];
7524
7524
  class _ {
7525
7525
  constructor(t) {
7526
7526
  this.node = t;
@@ -7792,12 +7792,12 @@ class Oe {
7792
7792
  }
7793
7793
  }
7794
7794
  }
7795
- class Kr {
7795
+ class Jr {
7796
7796
  constructor(t, e, i) {
7797
7797
  this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = this.args.dataDeps ?? {}, this.callback = (r, a) => this.args.callback.call(this.controller, r, a), this.nextRecomputeTime = this.args.nextRecomputeTime ? (r, a) => this.args.nextRecomputeTime.call(this.controller, r, a) : void 0;
7798
7798
  }
7799
7799
  static {
7800
- this.computationType = Dt;
7800
+ this.computationType = Ot;
7801
7801
  }
7802
7802
  static {
7803
7803
  this.contextType = "global";
@@ -7835,7 +7835,7 @@ class Xr {
7835
7835
  }, this.isResultNumber = this.dataContext.id.type === "number", this.callback = (r, a) => this.args.callback.call(this.controller, r, a), this.nextRecomputeTime = this.args.nextRecomputeTime ? (r, a) => this.args.nextRecomputeTime.call(this.controller, r, a) : void 0;
7836
7836
  }
7837
7837
  static {
7838
- this.computationType = Dt;
7838
+ this.computationType = Ot;
7839
7839
  }
7840
7840
  static {
7841
7841
  this.contextType = "property";
@@ -7862,7 +7862,7 @@ class Xr {
7862
7862
  return await this.state.lastRecomputeTime.setInternal(e, r), await this.state.nextRecomputeTime.setInternal(e, s), a;
7863
7863
  }
7864
7864
  }
7865
- const zr = [Kr, Xr];
7865
+ const zr = [Jr, Xr];
7866
7866
  class Yr {
7867
7867
  constructor(t, e, i) {
7868
7868
  if (this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
@@ -7880,7 +7880,7 @@ class Yr {
7880
7880
  };
7881
7881
  }
7882
7882
  static {
7883
- this.computationType = It;
7883
+ this.computationType = xt;
7884
7884
  }
7885
7885
  static {
7886
7886
  this.contextType = "global";
@@ -7945,7 +7945,7 @@ class Zr {
7945
7945
  };
7946
7946
  }
7947
7947
  static {
7948
- this.computationType = It;
7948
+ this.computationType = xt;
7949
7949
  }
7950
7950
  static {
7951
7951
  this.contextType = "property";
@@ -8031,7 +8031,7 @@ class ea {
8031
8031
  };
8032
8032
  }
8033
8033
  static {
8034
- this.computationType = xt;
8034
+ this.computationType = Mt;
8035
8035
  }
8036
8036
  static {
8037
8037
  this.contextType = "global";
@@ -8115,7 +8115,7 @@ class ia {
8115
8115
  };
8116
8116
  }
8117
8117
  static {
8118
- this.computationType = xt;
8118
+ this.computationType = Mt;
8119
8119
  }
8120
8120
  static {
8121
8121
  this.contextType = "property";
@@ -8160,8 +8160,8 @@ class ia {
8160
8160
  this.relationAttributeQuery
8161
8161
  ), h = d[this.isSource ? "target" : "source"];
8162
8162
  h["&"] = d;
8163
- const f = this.resolveAvgField(h) || 0, { oldValue: y } = await this.state.itemResult.replace(d, f);
8164
- s = f - (y ?? 0), n = 1;
8163
+ const f = this.resolveAvgField(h) || 0, { oldValue: m } = await this.state.itemResult.replace(d, f);
8164
+ s = f - (m ?? 0), n = 1;
8165
8165
  } else if (a.type === "delete" && a.recordName === this.relation.name)
8166
8166
  s = -(await this.state.itemResult.get(a.record) ?? 0), n = -1;
8167
8167
  else if (a.type === "update") {
@@ -8544,7 +8544,7 @@ class ha {
8544
8544
  if (this.computationsHandles.set(o.id, h), this.isAsyncComputation(h)) {
8545
8545
  const f = this.getAsyncTaskRecordKey(h);
8546
8546
  if (h.dataContext.type === "property") {
8547
- const y = new D({
8547
+ const m = new D({
8548
8548
  name: f,
8549
8549
  properties: [
8550
8550
  new T({
@@ -8565,16 +8565,16 @@ class ha {
8565
8565
  }, { uuid: `${f}_freshnessKey` })
8566
8566
  ]
8567
8567
  }, { uuid: f }), p = new F({
8568
- name: `${y.name}_${h.dataContext.host.name}_${h.dataContext.id.name}`,
8569
- source: y,
8568
+ name: `${m.name}_${h.dataContext.host.name}_${h.dataContext.id.name}`,
8569
+ source: m,
8570
8570
  target: h.dataContext.host,
8571
8571
  sourceProperty: "record",
8572
8572
  targetProperty: `_${h.dataContext.id.name}_task`,
8573
8573
  type: "1:1"
8574
8574
  }, { uuid: `${f}_record_relation` });
8575
- e.push(y), i.push(p);
8575
+ e.push(m), i.push(p);
8576
8576
  } else if (h.dataContext.type === "global") {
8577
- const y = new D({
8577
+ const m = new D({
8578
8578
  name: f,
8579
8579
  properties: [
8580
8580
  new T({
@@ -8599,10 +8599,10 @@ class ha {
8599
8599
  }, { uuid: `${f}_globalKey` })
8600
8600
  ]
8601
8601
  }, { uuid: f });
8602
- e.push(y);
8602
+ e.push(m);
8603
8603
  } else if (h.dataContext.type === "entity") {
8604
8604
  h.dataContext;
8605
- const y = new D({
8605
+ const m = new D({
8606
8606
  name: f,
8607
8607
  properties: [
8608
8608
  new T({
@@ -8627,10 +8627,10 @@ class ha {
8627
8627
  }, { uuid: `${f}_entityName` })
8628
8628
  ]
8629
8629
  }, { uuid: f });
8630
- e.push(y);
8630
+ e.push(m);
8631
8631
  } else if (h.dataContext.type === "relation") {
8632
8632
  h.dataContext;
8633
- const y = new D({
8633
+ const m = new D({
8634
8634
  name: f,
8635
8635
  properties: [
8636
8636
  new T({
@@ -8655,7 +8655,7 @@ class ha {
8655
8655
  }, { uuid: `${f}_relationName` })
8656
8656
  ]
8657
8657
  }, { uuid: f });
8658
- e.push(y);
8658
+ e.push(m);
8659
8659
  }
8660
8660
  }
8661
8661
  }
@@ -8776,7 +8776,7 @@ class ha {
8776
8776
  }
8777
8777
  async computeDataBasedDirtyRecordsAndEvents(t, e) {
8778
8778
  let i = [];
8779
- if (t.dataDep.type === "global" && e.recordName === J)
8779
+ if (t.dataDep.type === "global" && e.recordName === K)
8780
8780
  if (t.computation.dataContext.type === "property") {
8781
8781
  const r = t.computation.dataContext;
8782
8782
  i = (await this.controller.system.storage.find(r.host.name, w.atom({ key: "id", value: ["not", null] }), {}, ["*"])).map((s) => [s, {
@@ -9033,7 +9033,7 @@ class ha {
9033
9033
  }
9034
9034
  if (a instanceof ht)
9035
9035
  return;
9036
- if (a instanceof _t)
9036
+ if (a instanceof Vt)
9037
9037
  try {
9038
9038
  return await this.createAsyncTask(t, a.args, i);
9039
9039
  } catch (o) {
@@ -9159,11 +9159,11 @@ class he extends M {
9159
9159
  }
9160
9160
  class As extends M {
9161
9161
  }
9162
- class Et extends M {
9162
+ class Tt extends M {
9163
9163
  }
9164
9164
  class Ve extends M {
9165
9165
  }
9166
- class Tt extends M {
9166
+ class St extends M {
9167
9167
  }
9168
9168
  class fa extends M {
9169
9169
  }
@@ -9288,7 +9288,7 @@ function Na(c, t = !1) {
9288
9288
  hasCompute: typeof c.compute == "function",
9289
9289
  hasIncrementalCompute: typeof c.incrementalCompute == "function",
9290
9290
  hasIncrementalPatchCompute: typeof c.incrementalPatchCompute == "function"
9291
- }), y = nt({ stateKeys: s, boundStates: a }), p = nt({
9291
+ }), m = nt({ stateKeys: s, boundStates: a }), p = nt({
9292
9292
  type: u,
9293
9293
  dataContext: o,
9294
9294
  outputRecord: l,
@@ -9300,7 +9300,7 @@ function Na(c, t = !1) {
9300
9300
  hasCompute: typeof c.compute == "function",
9301
9301
  hasIncrementalCompute: typeof c.incrementalCompute == "function",
9302
9302
  hasIncrementalPatchCompute: typeof c.incrementalPatchCompute == "function"
9303
- }), m = nt({ structuralSignature: p, stateSignature: y, functionHash: h?.hash });
9303
+ }), y = nt({ structuralSignature: p, stateSignature: m, functionHash: h?.hash });
9304
9304
  return {
9305
9305
  id: n,
9306
9306
  identity: d,
@@ -9322,13 +9322,13 @@ function Na(c, t = !1) {
9322
9322
  outputRecord: l
9323
9323
  } : void 0,
9324
9324
  outputSignature: f,
9325
- stateSignature: y,
9325
+ stateSignature: m,
9326
9326
  structuralSignature: p,
9327
9327
  functionSignature: h,
9328
- signature: m
9328
+ signature: y
9329
9329
  };
9330
9330
  }
9331
- function Ht(c, t = c.system.storage.schema, e = {}) {
9331
+ function jt(c, t = c.system.storage.schema, e = {}) {
9332
9332
  const i = [
9333
9333
  ...c.entities.map((l) => {
9334
9334
  const u = st("entity", `entity:${l.name}`, l.uuid);
@@ -9423,7 +9423,7 @@ function Cs(c, t) {
9423
9423
  return !r || r.signature !== i.signature;
9424
9424
  });
9425
9425
  }
9426
- function Wt(c) {
9426
+ function Rt(c) {
9427
9427
  if (c.kind === "computation") return `${c.kind}:${c.id}`;
9428
9428
  const t = c.kind === "destructive-scope" && c.recordName || "";
9429
9429
  return `${c.kind}:${c.dataContext}:${t}`;
@@ -9465,8 +9465,8 @@ function Ta(c, t, e, i) {
9465
9465
  reason: `${p.kind} no longer exists in the new model`
9466
9466
  });
9467
9467
  for (const p of t.records) {
9468
- const m = o.get(p.id);
9469
- m ? (m.kind !== p.kind || m.name !== p.name) && r.push({
9468
+ const y = o.get(p.id);
9469
+ y ? (y.kind !== p.kind || y.name !== p.name) && r.push({
9470
9470
  kind: "record",
9471
9471
  id: p.id,
9472
9472
  changeType: "changed",
@@ -9479,13 +9479,13 @@ function Ta(c, t, e, i) {
9479
9479
  dataContext: `${p.kind}:${p.name}`,
9480
9480
  reason: `${p.kind} was added`
9481
9481
  });
9482
- const b = new Map((m?.properties || []).map((N) => [N.id, N])), E = new Map(p.properties.map((N) => [N.id, N]));
9483
- for (const N of m?.properties || [])
9484
- E.has(N.id) || r.push({
9482
+ const b = new Map((y?.properties || []).map((N) => [N.id, N])), v = new Map(p.properties.map((N) => [N.id, N]));
9483
+ for (const N of y?.properties || [])
9484
+ v.has(N.id) || r.push({
9485
9485
  kind: "property",
9486
9486
  id: N.id,
9487
9487
  changeType: "removed",
9488
- dataContext: `property:${m?.name}.${N.name}`,
9488
+ dataContext: `property:${y?.name}.${N.name}`,
9489
9489
  reason: "property no longer exists in the new model"
9490
9490
  });
9491
9491
  for (const N of p.properties) {
@@ -9514,8 +9514,8 @@ function Ta(c, t, e, i) {
9514
9514
  reason: "relation no longer exists in the new model"
9515
9515
  });
9516
9516
  for (const p of t.relations) {
9517
- const m = u.get(p.id);
9518
- m ? (m.name !== p.name || m.source !== p.source || m.target !== p.target || m.sourceProperty !== p.sourceProperty || m.targetProperty !== p.targetProperty || m.type !== p.type) && r.push({
9517
+ const y = u.get(p.id);
9518
+ y ? (y.name !== p.name || y.source !== p.source || y.target !== p.target || y.sourceProperty !== p.sourceProperty || y.targetProperty !== p.targetProperty || y.type !== p.type) && r.push({
9519
9519
  kind: "relation",
9520
9520
  id: p.id,
9521
9521
  changeType: "changed",
@@ -9538,14 +9538,14 @@ function Ta(c, t, e, i) {
9538
9538
  reason: "dictionary no longer exists in the new model"
9539
9539
  });
9540
9540
  for (const p of t.dictionaries || []) {
9541
- const m = h.get(p.id);
9542
- let b = "unchanged", E = "dictionary is unchanged";
9543
- m ? (m.type !== p.type || m.collection !== p.collection || m.computed !== p.computed) && (b = "changed", E = "dictionary type, collection, or computed flag changed") : (b = "added", E = "dictionary was added"), b !== "unchanged" && r.push({
9541
+ const y = h.get(p.id);
9542
+ let b = "unchanged", v = "dictionary is unchanged";
9543
+ y ? (y.type !== p.type || y.collection !== p.collection || y.computed !== p.computed) && (b = "changed", v = "dictionary type, collection, or computed flag changed") : (b = "added", v = "dictionary was added"), b !== "unchanged" && r.push({
9544
9544
  kind: "dictionary",
9545
9545
  id: p.id,
9546
9546
  changeType: b,
9547
9547
  dataContext: `global:${p.name}`,
9548
- reason: E
9548
+ reason: v
9549
9549
  });
9550
9550
  }
9551
9551
  for (const p of c.computations)
@@ -9560,26 +9560,26 @@ function Ta(c, t, e, i) {
9560
9560
  reason: "computation no longer exists in the new model"
9561
9561
  });
9562
9562
  for (const p of t.computations) {
9563
- const m = s.get(p.id), b = {
9564
- dataDepsChanged: m ? !Yt(m.deps, p.deps) : !0,
9565
- eventDepsChanged: m ? !Yt(m.eventDeps, p.eventDeps) : !0,
9566
- outputSignatureChanged: m ? m.outputSignature !== p.outputSignature : !0,
9567
- stateSignatureChanged: m ? m.stateSignature !== p.stateSignature : !0,
9568
- functionTextChanged: m ? m.functionSignature?.hash !== p.functionSignature?.hash : p.functionSignature?.hasFunction === !0,
9563
+ const y = s.get(p.id), b = {
9564
+ dataDepsChanged: y ? !Yt(y.deps, p.deps) : !0,
9565
+ eventDepsChanged: y ? !Yt(y.eventDeps, p.eventDeps) : !0,
9566
+ outputSignatureChanged: y ? y.outputSignature !== p.outputSignature : !0,
9567
+ stateSignatureChanged: y ? y.stateSignature !== p.stateSignature : !0,
9568
+ functionTextChanged: y ? y.functionSignature?.hash !== p.functionSignature?.hash : p.functionSignature?.hasFunction === !0,
9569
9569
  functionHash: p.functionSignature?.hash,
9570
- previousFunctionHash: m?.functionSignature?.hash,
9570
+ previousFunctionHash: y?.functionSignature?.hash,
9571
9571
  hasFunction: p.functionSignature?.hasFunction === !0,
9572
9572
  hasClosureRisk: p.functionSignature?.hasFunction === !0,
9573
9573
  needsEventRebuildHandler: p.eventDeps.length > 0,
9574
9574
  needsAsyncCompletionHandler: p.asyncReturn
9575
9575
  };
9576
- let E = "unchanged", N = "ignore", I = "unchanged", S = "computation is structurally unchanged";
9577
- m ? m.structuralSignature !== p.structuralSignature ? (E = "changed", N = "needs-review", I = "changed", S = "computation structure changed") : m.stateSignature !== p.stateSignature && m.outputSignature === p.outputSignature ? (E = "state-only", N = "needs-review", I = "state-only", S = "computation state changed without output structure changes") : m.functionSignature?.hash !== p.functionSignature?.hash ? (E = "possibly-changed", N = "needs-review", I = "changed", S = "function text changed and requires human semantic review") : p.functionSignature?.hasFunction && (N = "needs-review", S = "function callback has closure risk and requires human review") : (E = "added", N = "rebuild", I = "changed", S = "new computation requires approved rebuild"), r.push({
9576
+ let v = "unchanged", N = "ignore", I = "unchanged", S = "computation is structurally unchanged";
9577
+ y ? y.structuralSignature !== p.structuralSignature ? (v = "changed", N = "needs-review", I = "changed", S = "computation structure changed") : y.stateSignature !== p.stateSignature && y.outputSignature === p.outputSignature ? (v = "state-only", N = "needs-review", I = "state-only", S = "computation state changed without output structure changes") : y.functionSignature?.hash !== p.functionSignature?.hash ? (v = "possibly-changed", N = "needs-review", I = "changed", S = "function text changed and requires human semantic review") : p.functionSignature?.hasFunction && (N = "needs-review", S = "function callback has closure risk and requires human review") : (v = "added", N = "rebuild", I = "changed", S = "new computation requires approved rebuild"), r.push({
9578
9578
  kind: "computation",
9579
9579
  id: p.id,
9580
9580
  dataContext: p.dataContext,
9581
9581
  computationType: p.type,
9582
- changeType: E,
9582
+ changeType: v,
9583
9583
  detected: b,
9584
9584
  recommendation: N,
9585
9585
  reason: S
@@ -9623,7 +9623,7 @@ function Ta(c, t, e, i) {
9623
9623
  ids: p.ids || [],
9624
9624
  reason: p.reason
9625
9625
  });
9626
- const y = Array.from(new Map(a.map((p) => [Wt(p), p])).values());
9626
+ const m = Array.from(new Map(a.map((p) => [Rt(p), p])).values());
9627
9627
  return {
9628
9628
  kind: "interaqt-migration-diff",
9629
9629
  version: 2,
@@ -9634,11 +9634,11 @@ function Ta(c, t, e, i) {
9634
9634
  generatorVersion: "phase-1.5",
9635
9635
  summary: {
9636
9636
  changeCount: r.length,
9637
- requiredDecisionCount: y.length,
9637
+ requiredDecisionCount: m.length,
9638
9638
  blockingChangeCount: i.blockingChanges.length
9639
9639
  },
9640
9640
  changes: r,
9641
- requiredDecisions: y,
9641
+ requiredDecisions: m,
9642
9642
  decisions: [],
9643
9643
  safety: i
9644
9644
  };
@@ -9652,35 +9652,38 @@ function Sa(c, t, e, i, r) {
9652
9652
  throw new M("Migration approvedDiff must have status 'approved'");
9653
9653
  if (c.fromModelHash !== t.modelHash || c.toModelHash !== e.modelHash)
9654
9654
  throw new M("Migration approvedDiff is stale: model hash does not match current database and code");
9655
- const a = r || c, s = new Set(a.requiredDecisions.map(Wt)), n = new Set(a.changes.map(Ea)), o = /* @__PURE__ */ new Set();
9656
- for (const u of c.decisions) {
9657
- const d = va(u);
9658
- if (o.has(d))
9659
- throw new M(`Duplicate migration decision: ${d}`);
9660
- if (o.add(d), u.kind === "computation" && !n.has(`computation:${u.id}`))
9661
- throw new M(`Migration decision references a computation that is not present in the approved diff: ${u.id}`);
9662
- if (u.kind === "event-rebuild-handler") {
9663
- if (!s.has(d))
9664
- throw new M(`Migration event rebuild decision does not match a required review item: ${u.dataContext}`);
9665
- if (!i?.eventRebuild?.[u.handlerRef])
9666
- throw new M(`Missing migration event rebuild handler '${u.handlerRef}' for ${u.dataContext}`);
9667
- }
9668
- if (u.kind === "async-completion-handler") {
9669
- if (!s.has(d))
9670
- throw new M(`Migration async completion decision does not match a required review item: ${u.dataContext}`);
9671
- if (!i?.asyncCompletion?.[u.handlerRef])
9672
- throw new M(`Missing migration async completion handler '${u.handlerRef}' for ${u.dataContext}`);
9673
- }
9674
- if (u.kind === "rename-candidate-reviewed")
9675
- throw new M(`Migration rename candidate decision does not match any Phase 1.5 executable review item: ${u.from} -> ${u.to}`);
9676
- }
9677
- for (const u of a.requiredDecisions)
9678
- if (!o.has(Wt(u)))
9679
- throw new M(`Missing migration decision for required review item: ${Wt(u)}`);
9680
- const l = new Set(e.computations.map((u) => u.id));
9681
- for (const u of c.decisions)
9682
- if (u.kind === "computation" && !l.has(u.id))
9683
- throw new M(`Migration decision references unknown computation: ${u.id}`);
9655
+ const a = r || c, s = new Set(c.requiredDecisions.map(Rt)), n = /* @__PURE__ */ new Set([
9656
+ ...a.requiredDecisions.map(Rt),
9657
+ ...s
9658
+ ]), o = new Set(a.changes.map(Ea)), l = /* @__PURE__ */ new Set();
9659
+ for (const d of c.decisions) {
9660
+ const h = va(d);
9661
+ if (l.has(h))
9662
+ throw new M(`Duplicate migration decision: ${h}`);
9663
+ if (l.add(h), d.kind === "computation" && !o.has(`computation:${d.id}`))
9664
+ throw new M(`Migration decision references a computation that is not present in the approved diff: ${d.id}`);
9665
+ if (d.kind === "event-rebuild-handler") {
9666
+ if (!n.has(h))
9667
+ throw new M(`Migration event rebuild decision does not match a required review item: ${d.dataContext}`);
9668
+ if (!i?.eventRebuild?.[d.handlerRef])
9669
+ throw new M(`Missing migration event rebuild handler '${d.handlerRef}' for ${d.dataContext}`);
9670
+ }
9671
+ if (d.kind === "async-completion-handler") {
9672
+ if (!n.has(h))
9673
+ throw new M(`Migration async completion decision does not match a required review item: ${d.dataContext}`);
9674
+ if (!i?.asyncCompletion?.[d.handlerRef])
9675
+ throw new M(`Missing migration async completion handler '${d.handlerRef}' for ${d.dataContext}`);
9676
+ }
9677
+ if (d.kind === "rename-candidate-reviewed")
9678
+ throw new M(`Migration rename candidate decision does not match any Phase 1.5 executable review item: ${d.from} -> ${d.to}`);
9679
+ }
9680
+ for (const d of a.requiredDecisions)
9681
+ if (!l.has(Rt(d)))
9682
+ throw new M(`Missing migration decision for required review item: ${Rt(d)}`);
9683
+ const u = new Set(e.computations.map((d) => d.id));
9684
+ for (const d of c.decisions)
9685
+ if (d.kind === "computation" && !u.has(d.id))
9686
+ throw new M(`Migration decision references unknown computation: ${d.id}`);
9684
9687
  }
9685
9688
  function ka(c, t, e) {
9686
9689
  const i = [], r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = new Map(t.computations.map((o) => [o.id, o]));
@@ -9737,55 +9740,55 @@ function pi(c, t) {
9737
9740
  function fi(c, t, e, i = [], r = {}) {
9738
9741
  const a = new Map(t.computations.map((p) => [pe(p), p])), s = new Map(c.computations.map((p) => [p.id, p])), n = /* @__PURE__ */ new Map();
9739
9742
  for (const p of t.computations) {
9740
- for (const m of p.deps)
9741
- for (const b of hi(m, p, t))
9743
+ for (const y of p.deps)
9744
+ for (const b of hi(y, p, t))
9742
9745
  n.has(b) || n.set(b, /* @__PURE__ */ new Set()), n.get(b).add(p.id);
9743
- for (const m of p.eventDeps)
9744
- for (const b of pi(m, t))
9746
+ for (const y of p.eventDeps)
9747
+ for (const b of pi(y, t))
9745
9748
  b !== p.dataContext && (n.has(b) || n.set(b, /* @__PURE__ */ new Set()), n.get(b).add(p.id));
9746
9749
  }
9747
9750
  const o = new Set(e.map((p) => p.id)), u = [...e.filter((p) => {
9748
- const m = s.get(p.id);
9749
- return r.outputChangedIds?.has(p.id) || !m || m.outputSignature !== p.outputSignature;
9751
+ const y = s.get(p.id);
9752
+ return r.outputChangedIds?.has(p.id) || !y || y.outputSignature !== p.outputSignature;
9750
9753
  }).map((p) => pe(p)), ...i];
9751
9754
  for (; u.length; ) {
9752
9755
  const p = u.shift();
9753
- for (const m of n.get(p) || []) {
9754
- if (o.has(m)) continue;
9755
- o.add(m);
9756
- const b = t.computations.find((E) => E.id === m);
9756
+ for (const y of n.get(p) || []) {
9757
+ if (o.has(y)) continue;
9758
+ o.add(y);
9759
+ const b = t.computations.find((v) => v.id === y);
9757
9760
  b && u.push(pe(b));
9758
9761
  }
9759
9762
  }
9760
- const d = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), f = [], y = (p) => {
9763
+ const d = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), f = [], m = (p) => {
9761
9764
  if (h.has(p)) return;
9762
9765
  if (d.has(p))
9763
- throw new Et(`Migration detected a derived computation cycle at ${p}`);
9766
+ throw new Tt(`Migration detected a derived computation cycle at ${p}`);
9764
9767
  d.add(p);
9765
- const m = t.computations.find((b) => b.id === p);
9766
- if (m) {
9767
- for (const b of m.deps)
9768
- for (const E of hi(b, m, t)) {
9769
- const N = a.get(E);
9770
- N && o.has(N.id) && y(N.id);
9768
+ const y = t.computations.find((b) => b.id === p);
9769
+ if (y) {
9770
+ for (const b of y.deps)
9771
+ for (const v of hi(b, y, t)) {
9772
+ const N = a.get(v);
9773
+ N && o.has(N.id) && m(N.id);
9771
9774
  }
9772
- for (const b of m.eventDeps)
9773
- for (const E of pi(b, t)) {
9774
- if (E === m.dataContext) continue;
9775
- const N = a.get(E);
9776
- N && o.has(N.id) && y(N.id);
9775
+ for (const b of y.eventDeps)
9776
+ for (const v of pi(b, t)) {
9777
+ if (v === y.dataContext) continue;
9778
+ const N = a.get(v);
9779
+ N && o.has(N.id) && m(N.id);
9777
9780
  }
9778
9781
  }
9779
9782
  d.delete(p), h.add(p), f.push(p);
9780
9783
  };
9781
- return o.forEach(y), f.map((p) => {
9782
- const m = t.computations.find((W) => W.id === p), b = s.get(p), E = r.stateOnlyIds?.has(p) === !0, N = r.outputChangedIds?.has(p) || !b || b.outputSignature !== m.outputSignature, I = !b || b.stateSignature !== m.stateSignature, S = e.some((W) => W.id === p);
9784
+ return o.forEach(m), f.map((p) => {
9785
+ const y = t.computations.find((W) => W.id === p), b = s.get(p), v = r.stateOnlyIds?.has(p) === !0, N = r.outputChangedIds?.has(p) || !b || b.outputSignature !== y.outputSignature, I = !b || b.stateSignature !== y.stateSignature, S = e.some((W) => W.id === p);
9783
9786
  return {
9784
9787
  computationId: p,
9785
- dataContext: m.dataContext,
9786
- rebuildState: (E || I) && m.boundStates.length > 0,
9787
- rebuildOutput: E ? !1 : N || !S,
9788
- propagateOutputEvents: E ? !1 : N || !S,
9788
+ dataContext: y.dataContext,
9789
+ rebuildState: (v || I) && y.boundStates.length > 0,
9790
+ rebuildOutput: v ? !1 : N || !S,
9791
+ propagateOutputEvents: v ? !1 : N || !S,
9789
9792
  isSeed: S
9790
9793
  };
9791
9794
  });
@@ -9794,47 +9797,53 @@ function fe(c, t) {
9794
9797
  return `${c || "?"}.${t || "?"}`;
9795
9798
  }
9796
9799
  function mi(c, t) {
9797
- const e = [], i = new Map(c.storage.records.map((n) => [n.recordName, n])), r = new Map(t.storage.records.map((n) => [n.recordName, n])), a = new Map(c.records.map((n) => [n.name, n])), s = new Map(t.records.map((n) => [n.name, n]));
9798
- for (const n of c.storage.records)
9799
- !r.has(n.recordName) && !n.isFiltered && e.push({
9800
- kind: "unsupported-destructive-schema-change",
9801
- logicalPath: n.recordName,
9802
- oldPhysicalPath: n.tableName,
9803
- reason: "fact record was removed from the new schema"
9804
- });
9805
- for (const n of t.storage.records) {
9806
- const o = i.get(n.recordName);
9807
- if (!o) continue;
9808
- o.tableName !== n.tableName && !n.attributes.some((h) => h.startsWith("_")) && e.push({
9800
+ const e = [], i = new Map(c.storage.records.map((l) => [l.recordName, l])), r = new Map(t.storage.records.map((l) => [l.recordName, l])), a = new Map(c.records.map((l) => [l.name, l])), s = new Map(t.records.map((l) => [l.name, l])), n = (l) => l.startsWith("_ASYNC_TASK__"), o = (l) => c.computations.some((u) => u.outputRecord === l);
9801
+ for (const l of c.storage.records)
9802
+ if (!r.has(l.recordName) && !l.isFiltered) {
9803
+ const u = n(l.recordName) ? "framework-generated async task record cleanup is not supported by compute-route schema migration" : o(l.recordName) ? "computed output record physical cleanup is not supported by compute-route schema migration" : "fact record was removed from the new schema";
9804
+ e.push({
9805
+ kind: "unsupported-destructive-schema-change",
9806
+ logicalPath: l.recordName,
9807
+ oldPhysicalPath: l.tableName,
9808
+ reason: u
9809
+ });
9810
+ }
9811
+ for (const l of t.storage.records) {
9812
+ const u = i.get(l.recordName);
9813
+ if (!u) continue;
9814
+ u.tableName !== l.tableName && !l.attributes.some((m) => m.startsWith("_")) && e.push({
9809
9815
  kind: "physical-path-move",
9810
- logicalPath: n.recordName,
9811
- oldPhysicalPath: o.tableName,
9812
- newPhysicalPath: n.tableName,
9816
+ logicalPath: l.recordName,
9817
+ oldPhysicalPath: u.tableName,
9818
+ newPhysicalPath: l.tableName,
9813
9819
  reason: "fact record table changed"
9814
9820
  });
9815
- const l = new Map((o.attributeDetails || []).map((h) => [h.name, h])), u = new Map((n.attributeDetails || []).map((h) => [h.name, h]));
9816
- a.get(o.recordName), s.get(n.recordName);
9817
- const d = (h, f, y) => y.records.find((m) => m.name === h)?.properties.find((m) => m.name === f)?.computed === !0;
9818
- for (const h of o.attributeDetails || [])
9819
- !u.get(h.name) && !h.name.startsWith("_") && !d(o.recordName, h.name, c) && e.push({
9820
- kind: "unsupported-destructive-schema-change",
9821
- logicalPath: `${o.recordName}.${h.name}`,
9822
- oldPhysicalPath: fe(h.tableName, h.fieldName || h.sourceField || h.targetField),
9823
- reason: "fact attribute was removed from the new schema"
9824
- });
9825
- for (const h of n.attributeDetails || []) {
9826
- const f = l.get(h.name);
9827
- !f || d(o.recordName, h.name, c) || d(n.recordName, h.name, t) || ((f.kind !== h.kind || f.tableName !== h.tableName || f.fieldName !== h.fieldName || f.sourceField !== h.sourceField || f.targetField !== h.targetField) && e.push({
9821
+ const d = new Map((u.attributeDetails || []).map((m) => [m.name, m])), h = new Map((l.attributeDetails || []).map((m) => [m.name, m]));
9822
+ a.get(u.recordName), s.get(l.recordName);
9823
+ const f = (m, p, y) => y.records.find((v) => v.name === m)?.properties.find((v) => v.name === p)?.computed === !0;
9824
+ for (const m of u.attributeDetails || [])
9825
+ if (!h.get(m.name) && !m.name.startsWith("_")) {
9826
+ const y = f(u.recordName, m.name, c);
9827
+ e.push({
9828
+ kind: "unsupported-destructive-schema-change",
9829
+ logicalPath: `${u.recordName}.${m.name}`,
9830
+ oldPhysicalPath: fe(m.tableName, m.fieldName || m.sourceField || m.targetField),
9831
+ reason: y ? "computed attribute physical cleanup is not supported by compute-route schema migration" : "fact attribute was removed from the new schema"
9832
+ });
9833
+ }
9834
+ for (const m of l.attributeDetails || []) {
9835
+ const p = d.get(m.name);
9836
+ !p || f(u.recordName, m.name, c) || f(l.recordName, m.name, t) || ((p.kind !== m.kind || p.tableName !== m.tableName || p.fieldName !== m.fieldName || p.sourceField !== m.sourceField || p.targetField !== m.targetField) && e.push({
9828
9837
  kind: "physical-path-move",
9829
- logicalPath: `${n.recordName}.${h.name}`,
9830
- oldPhysicalPath: fe(f.tableName, f.fieldName || f.sourceField || f.targetField),
9831
- newPhysicalPath: fe(h.tableName, h.fieldName || h.sourceField || h.targetField),
9838
+ logicalPath: `${l.recordName}.${m.name}`,
9839
+ oldPhysicalPath: fe(p.tableName, p.fieldName || p.sourceField || p.targetField),
9840
+ newPhysicalPath: fe(m.tableName, m.fieldName || m.sourceField || m.targetField),
9832
9841
  reason: "fact attribute physical path changed"
9833
- }), (f.type !== h.type || f.fieldType !== h.fieldType || f.collection !== h.collection) && e.push({
9842
+ }), (p.type !== m.type || p.fieldType !== m.fieldType || p.collection !== m.collection) && e.push({
9834
9843
  kind: "unsupported-destructive-schema-change",
9835
- logicalPath: `${n.recordName}.${h.name}`,
9836
- oldPhysicalPath: `${f.type || "?"}/${f.fieldType || "?"}/${f.collection === !0}`,
9837
- newPhysicalPath: `${h.type || "?"}/${h.fieldType || "?"}/${h.collection === !0}`,
9844
+ logicalPath: `${l.recordName}.${m.name}`,
9845
+ oldPhysicalPath: `${p.type || "?"}/${p.fieldType || "?"}/${p.collection === !0}`,
9846
+ newPhysicalPath: `${m.type || "?"}/${m.fieldType || "?"}/${m.collection === !0}`,
9838
9847
  reason: "fact attribute type, field type, or collection flag changed"
9839
9848
  }));
9840
9849
  }
@@ -9851,11 +9860,19 @@ function $a(c, t, e = {}, i) {
9851
9860
  const n = re(s);
9852
9861
  if (!a.has(n)) continue;
9853
9862
  const o = P(s.dataContext);
9854
- s.dataContext.type === "property" && s.dataContext.id.name === _e && !xi(e.approvedDiff, (l) => l.kind === "destructive-scope" && l.dataContext === o) && r.push({ kind: "destructive-computed-output", logicalPath: o, reason: "destructive computed output requires an approved destructive-scope decision" }), s.asyncReturn && !Pi(e, o) && r.push({ kind: "async-computation", logicalPath: o, reason: "async computation requires an approved async-completion-handler decision and runtime handler" }), (s.dataContext.type === "entity" || s.dataContext.type === "relation") && !s.compute && r.push({ kind: "unrebuildable-computation", logicalPath: o, reason: "entity/relation output lacks a full compute contract" }), (s.dataContext.type === "entity" || s.dataContext.type === "relation") && i && !Ca(i, n, o, s.dataContext.id.name) && r.push({
9863
+ if (s.dataContext.type === "property" && s.dataContext.id.name === _e && !xi(e.approvedDiff, (l) => l.kind === "destructive-scope" && l.dataContext === o) && r.push({ kind: "destructive-computed-output", logicalPath: o, reason: "destructive computed output requires an approved destructive-scope decision" }), s.asyncReturn && !Pi(e, o) && r.push({ kind: "async-computation", logicalPath: o, reason: "async computation requires an approved async-completion-handler decision and runtime handler" }), (s.dataContext.type === "entity" || s.dataContext.type === "relation") && !s.compute && r.push({ kind: "unrebuildable-computation", logicalPath: o, reason: "entity/relation output lacks a full compute contract" }), s.dataContext.type === "entity" || s.dataContext.type === "relation") {
9864
+ const l = s.state?.sourceRecordId?.key, u = s.state?.transformIndex?.key;
9865
+ (!l || !u || typeof s.eventDeps == "object") && r.push({
9866
+ kind: "unrebuildable-computation",
9867
+ logicalPath: o,
9868
+ reason: "entity/relation output migration requires a data-based Transform with sourceRecordId and transformIndex state"
9869
+ });
9870
+ }
9871
+ (s.dataContext.type === "entity" || s.dataContext.type === "relation") && i && !Ca(i, n, o, s.dataContext.id.name) && r.push({
9855
9872
  kind: "destructive-computed-output",
9856
9873
  logicalPath: o,
9857
9874
  reason: "entity/relation output replacement requires exclusive output ownership proof in the previous manifest"
9858
- }), typeof s.eventDeps == "object" && !s.compute && !Gt(e, o) && r.push({ kind: "unrebuildable-computation", logicalPath: o, reason: "event-based computation requires an approved event-rebuild-handler decision and runtime handler" });
9875
+ }), typeof s.eventDeps == "object" && !Gt(e, o) && r.push({ kind: "unrebuildable-computation", logicalPath: o, reason: "event-based computation requires an approved event-rebuild-handler decision and runtime handler" });
9859
9876
  }
9860
9877
  return r;
9861
9878
  }
@@ -9864,11 +9881,11 @@ async function Te(c, t, e) {
9864
9881
  if (c.system.storage.queryHandle)
9865
9882
  return c.system.storage.find(s, void 0, void 0, ["*"]);
9866
9883
  if (!e) return;
9867
- const o = e.storage.records.find((y) => y.recordName === s), l = o?.tableName, u = (o?.attributeDetails || []).filter((y) => y.kind === "value" && y.fieldName);
9884
+ const o = e.storage.records.find((m) => m.recordName === s), l = o?.tableName, u = (o?.attributeDetails || []).filter((m) => m.kind === "value" && m.fieldName);
9868
9885
  if (!o || !l || u.length === 0) return;
9869
9886
  const d = c.system.storage.db || c.system.db;
9870
9887
  if (typeof d?.query != "function") return;
9871
- const h = (y) => `"${y.replace(/"/g, '""')}"`, f = u.map((y) => `${h(y.fieldName)} AS ${h(y.name)}`).join(", ");
9888
+ const h = (m) => `"${m.replace(/"/g, '""')}"`, f = u.map((m) => `${h(m.fieldName)} AS ${h(m.name)}`).join(", ");
9872
9889
  return d.query(`SELECT ${f} FROM ${h(l)}`, []);
9873
9890
  };
9874
9891
  for (const s of t) {
@@ -9895,12 +9912,12 @@ async function Te(c, t, e) {
9895
9912
  if (!l || !u) continue;
9896
9913
  const d = await n.compute(await c.scheduler.resolveDataDeps(n));
9897
9914
  if (!Array.isArray(d)) continue;
9898
- const h = new Set(d.map((p) => `${p[l]}:${p[u]}`)), y = (await a(o) || []).filter((p) => !h.has(`${p[l]}:${p[u]}`)).map((p) => String(p.id));
9899
- y.length && r.push({
9915
+ const h = new Set(d.map((p) => `${p[l]}:${p[u]}`)), m = (await a(o) || []).filter((p) => !h.has(`${p[l]}:${p[u]}`)).map((p) => String(p.id));
9916
+ m.length && r.push({
9900
9917
  dataContext: P(n.dataContext),
9901
9918
  recordName: o,
9902
- ids: y,
9903
- count: y.length,
9919
+ ids: m,
9920
+ count: m.length,
9904
9921
  reason: "transform recompute would delete stale derived output records"
9905
9922
  });
9906
9923
  }
@@ -9911,11 +9928,11 @@ function Fi(c, t) {
9911
9928
  const e = (c.approvedDiff?.decisions || []).filter((s) => s.kind === "destructive-scope"), i = (s) => `${s.dataContext}:${s.recordName || ""}`, r = new Map(e.map((s) => [i(s), [...s.ids || []].sort().join(",")])), a = new Set(t.map(i));
9912
9929
  for (const s of e)
9913
9930
  if (!a.has(i(s)))
9914
- throw new Tt(`Destructive migration scope mismatch for ${s.dataContext}`);
9931
+ throw new St(`Destructive migration scope mismatch for ${s.dataContext}`);
9915
9932
  for (const s of t) {
9916
9933
  const n = [...s.ids || []].sort().join(",");
9917
9934
  if (r.get(i(s)) !== n)
9918
- throw new Tt(`Destructive migration scope mismatch for ${s.dataContext}`);
9935
+ throw new St(`Destructive migration scope mismatch for ${s.dataContext}`);
9919
9936
  }
9920
9937
  }
9921
9938
  function yi(c, t) {
@@ -9957,7 +9974,7 @@ async function Be(c, t, e, i, r = {}) {
9957
9974
  }
9958
9975
  async function et(c, t, e, i, r = {}) {
9959
9976
  if (e instanceof ht) return;
9960
- if (e instanceof _t && (e = await Be(c, t, e, i, r)), e instanceof ee)
9977
+ if (e instanceof Vt && (e = await Be(c, t, e, i, r)), e instanceof ee)
9961
9978
  throw new Ve(`Migration requires direct final output, not asyncReturn resolution, for ${P(t.dataContext)}`);
9962
9979
  const a = await c.retrieveLastValue(t.dataContext, i);
9963
9980
  if (!Yt(a, e))
@@ -9965,7 +9982,7 @@ async function et(c, t, e, i, r = {}) {
9965
9982
  }
9966
9983
  async function xa(c, t, e, i, r = {}) {
9967
9984
  if (e instanceof ht || e === void 0) return [];
9968
- if (e instanceof _t && (e = await Be(c, t, e, i, r)), e instanceof ee)
9985
+ if (e instanceof Vt && (e = await Be(c, t, e, i, r)), e instanceof ee)
9969
9986
  throw new Ve(`Migration requires direct final output for ${P(t.dataContext)}`);
9970
9987
  const a = Array.isArray(e) ? e : [e], s = [];
9971
9988
  for (const n of a) {
@@ -9976,7 +9993,7 @@ async function xa(c, t, e, i, r = {}) {
9976
9993
  }
9977
9994
  const o = n;
9978
9995
  if (o.type === "delete" && (t.dataContext.type === "entity" || t.dataContext.type === "relation"))
9979
- throw new Tt(`Migration refuses delete patch for ${P(t.dataContext)} without explicit audited scope`);
9996
+ throw new St(`Migration refuses delete patch for ${P(t.dataContext)} without explicit audited scope`);
9980
9997
  if (await c.applyResultPatch(t.dataContext, o, i), t.dataContext.type === "entity" || t.dataContext.type === "relation")
9981
9998
  s.push({
9982
9999
  recordName: t.dataContext.id.name,
@@ -9995,7 +10012,7 @@ async function xa(c, t, e, i, r = {}) {
9995
10012
  function Li(c, t, e, i) {
9996
10013
  if (c.type === "global")
9997
10014
  return {
9998
- recordName: J,
10015
+ recordName: K,
9999
10016
  type: e === void 0 ? "create" : "update",
10000
10017
  record: { key: c.id.name, value: t, id: c.id.name },
10001
10018
  oldRecord: e === void 0 ? void 0 : { key: c.id.name, value: e, id: c.id.name },
@@ -10013,11 +10030,11 @@ function Li(c, t, e, i) {
10013
10030
  async function Ma(c, t, e = {}) {
10014
10031
  if (t.dataContext.type !== "entity" && t.dataContext.type !== "relation") return [];
10015
10032
  let i = await t.compute(await c.scheduler.resolveDataDeps(t));
10016
- if (i instanceof _t && (i = await Be(c, t, i, void 0, e)), !Array.isArray(i))
10017
- throw new Et(`Entity/relation migration compute must return an array for ${P(t.dataContext)}`);
10033
+ if (i instanceof Vt && (i = await Be(c, t, i, void 0, e)), !Array.isArray(i))
10034
+ throw new Tt(`Entity/relation migration compute must return an array for ${P(t.dataContext)}`);
10018
10035
  const r = t.dataContext.id.name, a = t.state?.sourceRecordId?.key, s = t.state?.transformIndex?.key;
10019
10036
  if (!a || !s)
10020
- throw new Et(`Transform migration requires sourceRecordId and transformIndex state for ${P(t.dataContext)}`);
10037
+ throw new Tt(`Transform migration requires sourceRecordId and transformIndex state for ${P(t.dataContext)}`);
10021
10038
  const n = await c.system.storage.find(r, void 0, void 0, ["*"]), o = new Map(n.map((u) => [`${u[a]}:${u[s]}`, u])), l = [];
10022
10039
  for (const u of i) {
10023
10040
  const d = `${u[a]}:${u[s]}`, h = o.get(d);
@@ -10033,7 +10050,7 @@ async function Ma(c, t, e = {}) {
10033
10050
  e.approvedDiff,
10034
10051
  (h) => h.kind === "destructive-scope" && h.dataContext === P(t.dataContext) && h.recordName === r
10035
10052
  )?.ids.map(String).includes(String(u.id)))
10036
- throw new Tt(`Migration would delete stale derived ${r} record ${u.id}; approve destructive scope before executing`);
10053
+ throw new St(`Migration would delete stale derived ${r} record ${u.id}; approve destructive scope before executing`);
10037
10054
  await c.system.storage.delete(r, w.atom({ key: "id", value: ["=", u.id] })), l.push({ recordName: r, type: "delete", record: u });
10038
10055
  }
10039
10056
  return l;
@@ -10054,9 +10071,9 @@ class Da {
10054
10071
  const i = this.handles.get(e.computationId);
10055
10072
  if (!i) continue;
10056
10073
  if (i.dataContext.type === "property" && i.dataContext.id.name === _e && !xi(this.options.approvedDiff, (s) => s.kind === "destructive-scope" && s.dataContext === P(i.dataContext)))
10057
- throw new Tt(`Migration refuses to recompute destructive property ${P(i.dataContext)} without approved destructive scope`);
10074
+ throw new St(`Migration refuses to recompute destructive property ${P(i.dataContext)} without approved destructive scope`);
10058
10075
  if (typeof i.compute != "function" && !Gt(this.options, P(i.dataContext)))
10059
- throw new Et(`Migration requires full compute support for ${P(i.dataContext)}`);
10076
+ throw new Tt(`Migration requires full compute support for ${P(i.dataContext)}`);
10060
10077
  if (e.rebuildState && !e.rebuildOutput) {
10061
10078
  await this.rebuildStateDefaults(i);
10062
10079
  continue;
@@ -10126,7 +10143,7 @@ class Da {
10126
10143
  if (!("dataDep" in s)) {
10127
10144
  const o = Gt(this.options, P(t.dataContext));
10128
10145
  if (!o)
10129
- throw new Et(`Event-based migration requires an approved event rebuild handler for ${P(t.dataContext)}`);
10146
+ throw new Tt(`Event-based migration requires an approved event rebuild handler for ${P(t.dataContext)}`);
10130
10147
  const l = await o({ controller: this.controller, dataContext: t.dataContext, mutationEvent: r }), u = await et(this.controller, t, l, void 0, this.options);
10131
10148
  u && i.push(u);
10132
10149
  continue;
@@ -10204,7 +10221,7 @@ const Se = "_isDeleted_", bi = new wi(), Is = {
10204
10221
  class xs {
10205
10222
  constructor(t) {
10206
10223
  this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
10207
- BoolExp: v,
10224
+ BoolExp: E,
10208
10225
  MatchExp: w
10209
10226
  }, this.dict = [], this.recordMutationSideEffects = [], this.eventSourcesByName = /* @__PURE__ */ new Map(), this.eventSourcesByUUID = /* @__PURE__ */ new Map(), this.callbacks = /* @__PURE__ */ new Map();
10210
10227
  const {
@@ -10226,7 +10243,7 @@ class xs {
10226
10243
  f.entity && f.entity.name && !d.has(f.entity.name) && (this.entities.push(f.entity), d.add(f.entity.name));
10227
10244
  const h = [
10228
10245
  ...Qr,
10229
- ...Jr,
10246
+ ...Kr,
10230
10247
  ...qr,
10231
10248
  ...Or,
10232
10249
  ...Mr,
@@ -10238,8 +10255,8 @@ class xs {
10238
10255
  ...o
10239
10256
  ];
10240
10257
  this.scheduler = new ha(this, this.entities, this.relations, this.dict, h), n.forEach((f) => {
10241
- let y = this.recordNameToSideEffects.get(f.record.name);
10242
- y || this.recordNameToSideEffects.set(f.record.name, y = /* @__PURE__ */ new Set()), y.add(f);
10258
+ let m = this.recordNameToSideEffects.get(f.record.name);
10259
+ m || this.recordNameToSideEffects.set(f.record.name, m = /* @__PURE__ */ new Set()), m.add(f);
10243
10260
  });
10244
10261
  }
10245
10262
  async setup(t) {
@@ -10255,7 +10272,7 @@ class xs {
10255
10272
  const s = this.system, n = s.prepareMigrationSchema;
10256
10273
  if (typeof n != "function")
10257
10274
  throw new Error("Current system does not support migration manifest validation");
10258
- const o = await n.call(s, this.entities, this.relations, r), l = Ht(this, o.schema), u = await gi(this);
10275
+ const o = await n.call(s, this.entities, this.relations, r), l = jt(this, o.schema), u = await gi(this);
10259
10276
  if (u && u.modelHash !== l.modelHash)
10260
10277
  throw new Error(`Model manifest mismatch. Call controller.generateMigrationDiff(), review it, then call controller.migrate({ approvedDiff }). Manifest key: ${Le}/${qe}`);
10261
10278
  if (!u && await this.system.hasExistingData?.())
@@ -10264,7 +10281,7 @@ class xs {
10264
10281
  return;
10265
10282
  }
10266
10283
  await this.system.setup(this.entities, this.relations, r, e);
10267
- const a = Ht(this);
10284
+ const a = jt(this);
10268
10285
  await this.scheduler.setup(e), e && await me(this, a);
10269
10286
  }
10270
10287
  async createMigrationBaseline() {
@@ -10276,7 +10293,7 @@ class xs {
10276
10293
  missingDDL: i.preRecomputeDDL,
10277
10294
  blockingChanges: i.blockingChanges
10278
10295
  });
10279
- const r = Ht(this, i.schema);
10296
+ const r = jt(this, i.schema);
10280
10297
  return await me(this, r), r;
10281
10298
  }
10282
10299
  async prepareMigrationContext(t = {}) {
@@ -10285,7 +10302,7 @@ class xs {
10285
10302
  const r = await i.prepareMigrationSchema(this.entities, this.relations, e), a = await gi(this);
10286
10303
  if (!a)
10287
10304
  throw new he("Migration baseline manifest not found. Run setup(true) with the current framework first or createMigrationBaseline().");
10288
- const s = Ht(this, r.schema, { includeFunctionText: t.includeFunctionText === !0 });
10305
+ const s = jt(this, r.schema, { includeFunctionText: t.includeFunctionText === !0 });
10289
10306
  return { states: e, migrationSystem: i, schemaPlan: r, previousManifest: a, nextManifest: s };
10290
10307
  }
10291
10308
  async buildCurrentMigrationDiff(t, e, i, r = {}) {
@@ -10317,26 +10334,26 @@ class xs {
10317
10334
  C(typeof r.applyMigrationSchema == "function", "Current system does not support schema migration application");
10318
10335
  const { schemaPlan: a, previousManifest: s, nextManifest: n } = i, o = await this.buildCurrentMigrationDiff(a, s, n, { includeDestructiveScope: !1 });
10319
10336
  Sa(e.approvedDiff, s, n, e.handlers, o);
10320
- const l = e.approvedDiff, u = ma(l), d = ka(s, n, l), h = d.changedComputations, f = yi(s, n), y = fi(s, n, h, f, {
10337
+ const l = e.approvedDiff, u = ma(l), d = ka(s, n, l), h = d.changedComputations, f = yi(s, n), m = fi(s, n, h, f, {
10321
10338
  outputChangedIds: d.outputChangedIds,
10322
10339
  stateOnlyIds: d.stateOnlyIds
10323
- }), p = mi(s, n), m = $a(
10340
+ }), p = mi(s, n), y = $a(
10324
10341
  this,
10325
- y,
10342
+ m,
10326
10343
  e,
10327
10344
  s
10328
10345
  ), b = [
10329
10346
  ...a.blockingChanges,
10330
10347
  ...p,
10331
10348
  ...d.blocking,
10332
- ...m
10333
- ], E = Ia(b), N = await Te(this, y, s);
10349
+ ...y
10350
+ ], v = Ia(b), N = await Te(this, m, s);
10334
10351
  Fi(e, N);
10335
10352
  const I = {
10336
10353
  mode: "compute",
10337
10354
  dryRun: e.dryRun === !0,
10338
10355
  changedComputations: h,
10339
- rebuildPlan: y,
10356
+ rebuildPlan: m,
10340
10357
  schemaPlan: {
10341
10358
  schema: a.schema,
10342
10359
  preRecomputeDDL: a.preRecomputeDDL,
@@ -10344,14 +10361,14 @@ class xs {
10344
10361
  verificationDDL: a.verificationDDL,
10345
10362
  blockingChanges: b
10346
10363
  },
10347
- blockingChanges: E,
10364
+ blockingChanges: v,
10348
10365
  deletionScope: N,
10349
10366
  approvedDiffHash: u
10350
10367
  };
10351
10368
  if (I.dryRun) return I;
10352
- if (E.length)
10369
+ if (v.length)
10353
10370
  throw new Error(`Migration plan has blocking changes:
10354
- ${E.join(`
10371
+ ${v.join(`
10355
10372
  `)}`);
10356
10373
  let S;
10357
10374
  const W = (V, tt) => {
@@ -10369,7 +10386,7 @@ ${E.join(`
10369
10386
  W(V, "schema-applied") || (await r.applyMigrationSchema(a, S?.id), S && await r.updateMigrationPhase?.(S.id, "schema-applied")), W(V, "manifest-written") || await this.system.storage.runInTransaction({ name: "migration recompute", isolation: "SERIALIZABLE" }, async () => {
10370
10387
  if (!W(V, "computation-applied")) {
10371
10388
  const ne = await Oa(this, s, n);
10372
- await Pa(this, y, e, ne, s), S && await r.updateMigrationPhase?.(S.id, "computation-applied");
10389
+ await Pa(this, m, e, ne, s), S && await r.updateMigrationPhase?.(S.id, "computation-applied");
10373
10390
  }
10374
10391
  W(V, "constraints-applied") || (await r.verifyMigrationSchema?.(a, S?.id), await r.applyMigrationPostSchema?.(a, S?.id), S && await r.updateMigrationPhase?.(S.id, "constraints-applied"));
10375
10392
  const tt = `manifest:current:${n.modelHash}:${u}`;
@@ -10387,7 +10404,7 @@ ${E.join(`
10387
10404
  return this.system.storage.find(t.id.name, void 0, void 0, ["*"]);
10388
10405
  {
10389
10406
  const i = t;
10390
- return e[i.id.name] ? e[i.id.name] : (await this.system.storage.findOne(i.host.name, v.atom({ key: "id", value: ["=", e.id] }), void 0, ["*"]))[i.id.name];
10407
+ return e[i.id.name] ? e[i.id.name] : (await this.system.storage.findOne(i.host.name, E.atom({ key: "id", value: ["=", e.id] }), void 0, ["*"]))[i.id.name];
10391
10408
  }
10392
10409
  }
10393
10410
  async applyResult(t, e, i) {
@@ -10399,7 +10416,7 @@ ${E.join(`
10399
10416
  if (this.system.storage.getTransactionIsolation() !== "SERIALIZABLE")
10400
10417
  throw new X("entity replace result");
10401
10418
  const r = t;
10402
- await this.system.storage.delete(r.id.name, v.atom({ key: "id", value: ["not", null] }));
10419
+ await this.system.storage.delete(r.id.name, E.atom({ key: "id", value: ["not", null] }));
10403
10420
  const a = Array.isArray(e) ? e : [e];
10404
10421
  for (const s of a)
10405
10422
  await this.system.storage.create(r.id.name, s);
@@ -10408,13 +10425,13 @@ ${E.join(`
10408
10425
  if (this.system.storage.getTransactionIsolation() !== "SERIALIZABLE")
10409
10426
  throw new X("relation replace result");
10410
10427
  const r = t;
10411
- await this.system.storage.delete(r.id.name, v.atom({ key: "id", value: ["not", null] }));
10428
+ await this.system.storage.delete(r.id.name, E.atom({ key: "id", value: ["not", null] }));
10412
10429
  const a = Array.isArray(e) ? e : [e];
10413
10430
  for (const s of a)
10414
10431
  await this.system.storage.create(r.id.name, s);
10415
10432
  } else {
10416
10433
  const r = t;
10417
- r.id.name === Se && e ? await this.system.storage.delete(r.host.name, v.atom({ key: "id", value: ["=", i.id] })) : await this.system.storage.update(r.host.name, v.atom({ key: "id", value: ["=", i.id] }), { [r.id.name]: e });
10434
+ r.id.name === Se && e ? await this.system.storage.delete(r.host.name, E.atom({ key: "id", value: ["=", i.id] })) : await this.system.storage.update(r.host.name, E.atom({ key: "id", value: ["=", i.id] }), { [r.id.name]: e });
10418
10435
  }
10419
10436
  }
10420
10437
  }
@@ -10437,7 +10454,7 @@ ${E.join(`
10437
10454
  }
10438
10455
  } else {
10439
10456
  const s = t;
10440
- s.id.name === Se && a.data ? (C(a.type !== "delete", "Hard deletion property cannot be deleted"), await this.system.storage.delete(s.host.name, v.atom({ key: "id", value: ["=", i.id] }))) : a.type === "insert" ? await this.system.storage.update(s.host.name, v.atom({ key: "id", value: ["=", i.id] }), { [s.id.name]: a.data }) : a.type === "update" ? await this.system.storage.update(s.host.name, v.atom({ key: "id", value: ["=", i.id] }), { [s.id.name]: a.data }) : a.type === "delete" && await this.system.storage.update(s.host.name, v.atom({ key: "id", value: ["=", i.id] }), { [s.id.name]: null });
10457
+ s.id.name === Se && a.data ? (C(a.type !== "delete", "Hard deletion property cannot be deleted"), await this.system.storage.delete(s.host.name, E.atom({ key: "id", value: ["=", i.id] }))) : a.type === "insert" ? await this.system.storage.update(s.host.name, E.atom({ key: "id", value: ["=", i.id] }), { [s.id.name]: a.data }) : a.type === "update" ? await this.system.storage.update(s.host.name, E.atom({ key: "id", value: ["=", i.id] }), { [s.id.name]: a.data }) : a.type === "delete" && await this.system.storage.update(s.host.name, E.atom({ key: "id", value: ["=", i.id] }), { [s.id.name]: null });
10441
10458
  }
10442
10459
  }
10443
10460
  cloneDispatchArgs(t) {
@@ -10577,7 +10594,7 @@ class qa {
10577
10594
  }, this.transactionContext = new wi(), this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
10578
10595
  get: async (e) => {
10579
10596
  const i = w.atom({ key: "key", value: ["=", e] });
10580
- return (await this.queryHandle.findOne(J, i, void 0, ["value"]))?.value?.raw;
10597
+ return (await this.queryHandle.findOne(K, i, void 0, ["value"]))?.value?.raw;
10581
10598
  },
10582
10599
  set: async (e, i) => {
10583
10600
  await this.setDictionaryValue(e, i, !0);
@@ -10663,12 +10680,12 @@ class qa {
10663
10680
  return this.isInTransaction() ? e() : De(t, (i) => this.runInTransaction({ name: t, isolation: i }, e));
10664
10681
  }
10665
10682
  async setDictionaryValue(t, e, i) {
10666
- const r = w.atom({ key: "key", value: ["=", t] }), a = await this.queryHandle.findOne(J, r, void 0, ["value"]);
10683
+ const r = w.atom({ key: "key", value: ["=", t] }), a = await this.queryHandle.findOne(K, r, void 0, ["value"]);
10667
10684
  if (a) {
10668
- const s = [J, w.atom({ key: "id", value: ["=", a.id] }), { key: t, value: { raw: e } }];
10685
+ const s = [K, w.atom({ key: "id", value: ["=", a.id] }), { key: t, value: { raw: e } }];
10669
10686
  i ? await this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), s, []) : await this.queryHandle.update(...s, []);
10670
10687
  } else {
10671
- const s = [J, { key: t, value: { raw: e } }];
10688
+ const s = [K, { key: t, value: { raw: e } }];
10672
10689
  i ? await this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), s, []) : await this.queryHandle.create(...s, []);
10673
10690
  }
10674
10691
  }
@@ -11090,13 +11107,13 @@ class qa {
11090
11107
  increment: async (e, i) => {
11091
11108
  const r = this.getPlaceholder();
11092
11109
  if (this.isRecordTarget(e)) {
11093
- const { tableName: l, idField: u, fieldName: d } = this.resolveRecordTarget(e), h = r(), f = r(), y = await this.db.query(
11110
+ const { tableName: l, idField: u, fieldName: d } = this.resolveRecordTarget(e), h = r(), f = r(), m = await this.db.query(
11094
11111
  `UPDATE "${l}" SET "${d}" = COALESCE("${d}", 0) + ${h} WHERE "${u}" = ${f} RETURNING "${d}" AS value`,
11095
11112
  [i, e.id],
11096
11113
  `atomic increment ${e.recordName}.${e.field}`
11097
11114
  );
11098
- if (!y.length) throw new Error(`Atomic increment target not found: ${e.recordName}.${String(e.id)}.${e.field}`);
11099
- return Number(y[0]?.value ?? await this.atomic.get(e) ?? 0);
11115
+ if (!m.length) throw new Error(`Atomic increment target not found: ${e.recordName}.${String(e.id)}.${e.field}`);
11116
+ return Number(m[0]?.value ?? await this.atomic.get(e) ?? 0);
11100
11117
  }
11101
11118
  const a = r(), s = r(), n = r(), o = await this.db.query(
11102
11119
  `INSERT INTO "_ComputationState_" ("key", "numberValue") VALUES (${a}, ${s})
@@ -11112,14 +11129,14 @@ RETURNING "numberValue" AS value`,
11112
11129
  async () => {
11113
11130
  const r = this.getPlaceholder();
11114
11131
  if (this.isRecordTarget(e)) {
11115
- const { tableName: m, idField: b, fieldName: E } = this.resolveRecordTarget(e), N = r(), I = await this.db.query(
11116
- `SELECT "${E}" AS value FROM "${m}" WHERE "${b}" = ${N}${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
11132
+ const { tableName: y, idField: b, fieldName: v } = this.resolveRecordTarget(e), N = r(), I = await this.db.query(
11133
+ `SELECT "${v}" AS value FROM "${y}" WHERE "${b}" = ${N}${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
11117
11134
  [e.id],
11118
11135
  `atomic replace lock ${e.recordName}.${e.field}`
11119
11136
  );
11120
11137
  if (!I.length) throw new Error(`Atomic replace target not found: ${e.recordName}.${String(e.id)}.${e.field}`);
11121
11138
  const S = this.getPlaceholder(), W = S(), V = S(), tt = await this.db.query(
11122
- `UPDATE "${m}" SET "${E}" = ${W} WHERE "${b}" = ${V} RETURNING "${E}" AS value`,
11139
+ `UPDATE "${y}" SET "${v}" = ${W} WHERE "${b}" = ${V} RETURNING "${v}" AS value`,
11123
11140
  [i, e.id],
11124
11141
  `atomic replace ${e.recordName}.${e.field}`
11125
11142
  );
@@ -11131,8 +11148,8 @@ RETURNING "numberValue" AS value`,
11131
11148
  `SELECT "${a}" AS value FROM "_ComputationState_" WHERE "key" = ${n}${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
11132
11149
  [e.key],
11133
11150
  `atomic replace lock ${e.key}`
11134
- ), l = t.filter((m) => m !== a).map((m) => `"${m}" = NULL`).join(", "), u = this.parseGlobalValue(o[0]?.value, a) ?? e.defaultValue ?? null, d = this.getPlaceholder(), h = d(), f = d(), y = [`"${a}" = ${h}`, l].filter(Boolean).join(", "), p = await this.db.query(
11135
- `UPDATE "_ComputationState_" SET ${y} WHERE "key" = ${f} RETURNING "${a}" AS value`,
11151
+ ), l = t.filter((y) => y !== a).map((y) => `"${y}" = NULL`).join(", "), u = this.parseGlobalValue(o[0]?.value, a) ?? e.defaultValue ?? null, d = this.getPlaceholder(), h = d(), f = d(), m = [`"${a}" = ${h}`, l].filter(Boolean).join(", "), p = await this.db.query(
11152
+ `UPDATE "_ComputationState_" SET ${m} WHERE "key" = ${f} RETURNING "${a}" AS value`,
11136
11153
  [s, e.key],
11137
11154
  `atomic replace ${e.key}`
11138
11155
  );
@@ -11149,16 +11166,16 @@ RETURNING "numberValue" AS value`,
11149
11166
  `atomic compareAndSet ${e.recordName}.${e.field}`
11150
11167
  )).length > 0;
11151
11168
  }
11152
- const o = this.resolveGlobalColumn(e, r), l = this.normalizeGlobalValue(r, o), u = this.normalizeGlobalValue(n, o), d = this.normalizeGlobalValue(i, o), h = s(), f = s(), y = s(), p = s();
11169
+ const o = this.resolveGlobalColumn(e, r), l = this.normalizeGlobalValue(r, o), u = this.normalizeGlobalValue(n, o), d = this.normalizeGlobalValue(i, o), h = s(), f = s(), m = s(), p = s();
11153
11170
  if ((await this.db.query(
11154
- `UPDATE "_ComputationState_" SET "${o}" = ${h} WHERE "key" = ${f} AND COALESCE("${o}", ${y}) = ${p} RETURNING "${o}" AS value`,
11171
+ `UPDATE "_ComputationState_" SET "${o}" = ${h} WHERE "key" = ${f} AND COALESCE("${o}", ${m}) = ${p} RETURNING "${o}" AS value`,
11155
11172
  [l, e.key, u, d],
11156
11173
  `atomic compareAndSet ${e.key}`
11157
11174
  )).length) return !0;
11158
11175
  if (d !== u) return !1;
11159
- const b = this.getPlaceholder(), E = b(), N = b();
11176
+ const b = this.getPlaceholder(), v = b(), N = b();
11160
11177
  return (await this.db.query(
11161
- `INSERT INTO "_ComputationState_" ("key", "${o}") VALUES (${E}, ${N}) ON CONFLICT ("key") DO NOTHING RETURNING "${o}" AS value`,
11178
+ `INSERT INTO "_ComputationState_" ("key", "${o}") VALUES (${v}, ${N}) ON CONFLICT ("key") DO NOTHING RETURNING "${o}" AS value`,
11162
11179
  [e.key, l],
11163
11180
  `atomic compareAndSet insert ${e.key}`
11164
11181
  )).length > 0;
@@ -11183,8 +11200,8 @@ RETURNING "numberValue" AS value`,
11183
11200
  [e.key],
11184
11201
  `atomic updateGlobalFields lock ${e.key}`
11185
11202
  ), o = this.parseGlobalValue(n[0]?.value, "jsonValue") ?? {}, l = { ...r, ...o };
11186
- Object.entries(i).forEach(([f, y]) => {
11187
- l[f] = Number(l[f] ?? r[f] ?? 0) + y;
11203
+ Object.entries(i).forEach(([f, m]) => {
11204
+ l[f] = Number(l[f] ?? r[f] ?? 0) + m;
11188
11205
  });
11189
11206
  const u = this.getPlaceholder(), d = u(), h = u();
11190
11207
  return await this.db.update(
@@ -11600,10 +11617,10 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
11600
11617
  const o = n.sourceRecordId, l = n.transformIndex;
11601
11618
  if (!(o instanceof $) || !(l instanceof $) || o.unique === !1 || s.type !== "entity" && s.type !== "relation")
11602
11619
  return [];
11603
- const u = s.id.name, d = r.getRecordInfo(u), [, h] = r.getTableAliasAndFieldName([u], o.key, !0), [, f] = r.getTableAliasAndFieldName([u], l.key, !0), y = `idx_transform_${this.hashIdentifier(`${d.table}_${h}_${f}`)}`;
11620
+ const u = s.id.name, d = r.getRecordInfo(u), [, h] = r.getTableAliasAndFieldName([u], o.key, !0), [, f] = r.getTableAliasAndFieldName([u], l.key, !0), m = `idx_transform_${this.hashIdentifier(`${d.table}_${h}_${f}`)}`;
11604
11621
  return [{
11605
11622
  kind: "create-constraint",
11606
- sql: be(y, d.table, [h, f], a),
11623
+ sql: be(m, d.table, [h, f], a),
11607
11624
  tableName: d.table,
11608
11625
  logicalPath: `${u}.${o.key}.${l.key}`,
11609
11626
  description: `migration setup transform unique index ${u}`
@@ -11673,12 +11690,12 @@ const Ba = ae.create({ name: "get" });
11673
11690
  function ke(c) {
11674
11691
  if (!c) return;
11675
11692
  if (c.raw.type === "atom")
11676
- return Ot.create({
11693
+ return Ft.create({
11677
11694
  type: "atom",
11678
11695
  data: c.raw.data
11679
11696
  });
11680
11697
  const t = c.raw;
11681
- return Ft.create({
11698
+ return Lt.create({
11682
11699
  type: "expression",
11683
11700
  operator: t.operator,
11684
11701
  left: ke(c.left),
@@ -11687,7 +11704,7 @@ function ke(c) {
11687
11704
  }
11688
11705
  class se {
11689
11706
  constructor(t, e) {
11690
- this._type = "Conditions", this._options = e, this.uuid = A(e), t.content && t.content instanceof v ? this.content = ke(t.content) : this.content = t.content;
11707
+ this._type = "Conditions", this._options = e, this.uuid = A(e), t.content && t.content instanceof E ? this.content = ke(t.content) : this.content = t.content;
11691
11708
  }
11692
11709
  static {
11693
11710
  this.isKlass = !0;
@@ -11807,7 +11824,7 @@ class gt {
11807
11824
  return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
11808
11825
  }
11809
11826
  }
11810
- class Vt {
11827
+ class Qt {
11811
11828
  constructor(t, e) {
11812
11829
  this._type = "Attributives", this._options = e, this.uuid = A(e), this.content = t.content;
11813
11830
  }
@@ -11830,7 +11847,7 @@ class Vt {
11830
11847
  };
11831
11848
  }
11832
11849
  static create(t, e) {
11833
- const i = new Vt(t, e);
11850
+ const i = new Qt(t, e);
11834
11851
  if (this.instances.find((a) => a.uuid === i.uuid))
11835
11852
  throw new Error(`duplicate uuid in options ${i.uuid}, Attributives`);
11836
11853
  return this.instances.push(i), i;
@@ -11864,12 +11881,12 @@ class Vt {
11864
11881
  function Ae(c) {
11865
11882
  if (!c) return;
11866
11883
  if (c.raw.type === "atom")
11867
- return Ot.create({
11884
+ return Ft.create({
11868
11885
  type: "atom",
11869
11886
  data: c.raw.data
11870
11887
  });
11871
11888
  const t = c.raw;
11872
- return Ft.create({
11889
+ return Lt.create({
11873
11890
  type: "expression",
11874
11891
  operator: t.operator,
11875
11892
  left: Ae(c.left),
@@ -11877,7 +11894,7 @@ function Ae(c) {
11877
11894
  });
11878
11895
  }
11879
11896
  function Os(c) {
11880
- return Vt.create({
11897
+ return Qt.create({
11881
11898
  content: Ae(c)
11882
11899
  });
11883
11900
  }
@@ -11985,14 +12002,14 @@ class We {
11985
12002
  return this.create(e.public, e.options);
11986
12003
  }
11987
12004
  }
11988
- class K extends Error {
12005
+ class J extends Error {
11989
12006
  constructor(t, e) {
11990
12007
  super(t), this.name = "InteractionGuardError", this.type = e.type, this.checkType = e.checkType, this.error = e.error;
11991
12008
  }
11992
12009
  }
11993
12010
  function Ha(c) {
11994
12011
  return async function(t) {
11995
- await _i(this, c, t), await Ja(this, c, t), await Vi(this, c, t);
12012
+ await _i(this, c, t), await Ka(this, c, t), await Vi(this, c, t);
11996
12013
  };
11997
12014
  }
11998
12015
  function ja(c) {
@@ -12007,12 +12024,12 @@ function ja(c) {
12007
12024
  }
12008
12025
  function Wa(c) {
12009
12026
  return async function(t) {
12010
- return Ka(this, c, t);
12027
+ return Ja(this, c, t);
12011
12028
  };
12012
12029
  }
12013
12030
  async function _i(c, t, e) {
12014
12031
  if (!t.conditions) return;
12015
- const i = se.is(t.conditions) ? new v(t.conditions.content) : v.atom(t.conditions), r = async (s) => {
12032
+ const i = se.is(t.conditions) ? new E(t.conditions.content) : E.atom(t.conditions), r = async (s) => {
12016
12033
  if (!s) return !0;
12017
12034
  if (s.content) {
12018
12035
  let n;
@@ -12027,7 +12044,7 @@ async function _i(c, t, e) {
12027
12044
  return !0;
12028
12045
  }, a = await i.evaluateAsync(r);
12029
12046
  if (a !== !0)
12030
- throw new K(`Condition check failed: ${a?.data?.name}`, {
12047
+ throw new J(`Condition check failed: ${a?.data?.name}`, {
12031
12048
  type: "condition check failed",
12032
12049
  checkType: "condition",
12033
12050
  error: a
@@ -12045,11 +12062,11 @@ async function Ga(c, t, e, i) {
12045
12062
  }
12046
12063
  return !0;
12047
12064
  }
12048
- async function Ja(c, t, e) {
12065
+ async function Ka(c, t, e) {
12049
12066
  if (!t.userAttributives) return;
12050
- const i = Vt.is(t.userAttributives) ? v.fromValue(t.userAttributives.content) : v.atom(t.userAttributives), r = (s) => Ga(c, s, e, e.user), a = await i.evaluateAsync(r);
12067
+ const i = Qt.is(t.userAttributives) ? E.fromValue(t.userAttributives.content) : E.atom(t.userAttributives), r = (s) => Ga(c, s, e, e.user), a = await i.evaluateAsync(r);
12051
12068
  if (a !== !0)
12052
- throw new K("User check failed", {
12069
+ throw new J("User check failed", {
12053
12070
  type: "check user failed",
12054
12071
  checkType: "user",
12055
12072
  error: a
@@ -12059,69 +12076,69 @@ async function Vi(c, t, e) {
12059
12076
  const i = e.payload || {}, r = t.payload?.items || [], a = Object.keys(i);
12060
12077
  for (const s of a)
12061
12078
  if (!r.some((n) => n.name === s))
12062
- throw new K(
12079
+ throw new J(
12063
12080
  `${s} in payload is not defined in interaction ${t.name}`,
12064
12081
  { type: `${s} not defined`, checkType: "payload" }
12065
12082
  );
12066
12083
  for (const s of r) {
12067
12084
  if (s.required && !(s.name in i))
12068
- throw new K(
12085
+ throw new J(
12069
12086
  `Payload validation failed for field '${s.name}': missing`,
12070
12087
  { type: `${s.name} missing`, checkType: "payload" }
12071
12088
  );
12072
12089
  const n = i[s.name];
12073
12090
  if (n === void 0) return;
12074
12091
  if (s.isCollection && !Array.isArray(n))
12075
- throw new K(
12092
+ throw new J(
12076
12093
  `Payload validation failed for field '${s.name}': data is not array`,
12077
12094
  { type: `${s.name} data is not array`, checkType: "payload" }
12078
12095
  );
12079
12096
  if (s.isCollection) {
12080
12097
  if (s.isRef && !n.every((o) => !!o.id))
12081
- throw new K(
12098
+ throw new J(
12082
12099
  `Payload validation failed for field '${s.name}': data not every is ref`,
12083
12100
  { type: `${s.name} data not every is ref`, checkType: "payload" }
12084
12101
  );
12085
12102
  } else if (s.isRef && !n.id)
12086
- throw new K(
12103
+ throw new J(
12087
12104
  `Payload validation failed for field '${s.name}': data is not a ref`,
12088
12105
  { type: `${s.name} data is not a ref`, checkType: "payload" }
12089
12106
  );
12090
12107
  if (s.base)
12091
12108
  if (s.isCollection)
12092
12109
  for (const o of n) {
12093
- const l = await Rt(o, s.base);
12110
+ const l = await Nt(o, s.base);
12094
12111
  if (l !== !0)
12095
- throw new K(
12112
+ throw new J(
12096
12113
  `Concept check failed for field '${s.name}'`,
12097
12114
  { type: `${s.name} check concept failed`, checkType: "concept", error: l }
12098
12115
  );
12099
12116
  }
12100
12117
  else {
12101
- const o = await Rt(n, s.base);
12118
+ const o = await Nt(n, s.base);
12102
12119
  if (o !== !0)
12103
- throw new K(
12120
+ throw new J(
12104
12121
  `Concept check failed for field '${s.name}'`,
12105
12122
  { type: `${s.name} check concept failed`, checkType: "concept", error: o }
12106
12123
  );
12107
12124
  }
12108
12125
  }
12109
12126
  }
12110
- async function Rt(c, t) {
12127
+ async function Nt(c, t) {
12111
12128
  if (t.base) {
12112
12129
  const e = t;
12113
- return e.attributive, Rt(c, e.base);
12130
+ return e.attributive, Nt(c, e.base);
12114
12131
  }
12115
12132
  if (t.for) {
12116
12133
  for (const e of t.for)
12117
- if (await Rt(c, e) === !0) return !0;
12134
+ if (await Nt(c, e) === !0) return !0;
12118
12135
  return { name: t.name || "", type: "conceptAlias", error: "no match" };
12119
12136
  }
12120
12137
  return gt.is(t) ? !0 : D.is(t) ? c && typeof c == "object" ? !0 : { name: t.name || "", type: "conceptCheck", error: "invalid entity data" } : !0;
12121
12138
  }
12122
- async function Ka(c, t, e) {
12139
+ async function Ja(c, t, e) {
12123
12140
  if (D.is(t.data) || F.is(t.data)) {
12124
- const i = t.data.name, r = t.dataPolicy?.match, a = t.dataPolicy?.modifier, s = { ...e.query?.modifier || {}, ...a || {} }, n = e.query?.attributeQuery || [], o = typeof r == "function" ? await r.call(c, e) : r, l = v.and(o, e.query?.match);
12141
+ const i = t.data.name, r = t.dataPolicy?.match, a = t.dataPolicy?.modifier, s = { ...e.query?.modifier || {}, ...a || {} }, n = e.query?.attributeQuery || [], o = typeof r == "function" ? await r.call(c, e) : r, l = E.and(o, e.query?.match);
12125
12142
  return c.system.storage.find(i, l, s, n);
12126
12143
  }
12127
12144
  }
@@ -12211,7 +12228,7 @@ class Ge {
12211
12228
  return this.create(e.public, e.options);
12212
12229
  }
12213
12230
  }
12214
- class St {
12231
+ class kt {
12215
12232
  constructor(t, e) {
12216
12233
  this._type = "ActivityGroup", this._options = e, this.uuid = A(e), this.type = t.type, this.activities = t.activities || [];
12217
12234
  }
@@ -12240,7 +12257,7 @@ class St {
12240
12257
  };
12241
12258
  }
12242
12259
  static create(t, e) {
12243
- const i = new St(t, e);
12260
+ const i = new kt(t, e);
12244
12261
  if (this.instances.find((a) => a.uuid === i.uuid))
12245
12262
  throw new Error(`duplicate uuid in options ${i.uuid}, ActivityGroup`);
12246
12263
  return this.instances.push(i), i;
@@ -12355,7 +12372,7 @@ function Fs(c) {
12355
12372
  function Ls(c) {
12356
12373
  return null;
12357
12374
  }
12358
- class Je {
12375
+ class Ke {
12359
12376
  constructor(t, e) {
12360
12377
  this._type = "Condition", this._options = e, this.uuid = A(e), this.content = t.content, this.name = t.name;
12361
12378
  }
@@ -12381,7 +12398,7 @@ class Je {
12381
12398
  };
12382
12399
  }
12383
12400
  static create(t, e) {
12384
- const i = new Je(t, e);
12401
+ const i = new Ke(t, e);
12385
12402
  if (this.instances.find((a) => a.uuid === i.uuid))
12386
12403
  throw new Error(`duplicate uuid in options ${i.uuid}, Condition`);
12387
12404
  return this.instances.push(i), i;
@@ -12415,7 +12432,7 @@ class Je {
12415
12432
  return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
12416
12433
  }
12417
12434
  }
12418
- class Ke {
12435
+ class Je {
12419
12436
  constructor(t, e) {
12420
12437
  this._type = "DataAttributive", this._options = e, this.uuid = A(e), this.content = t.content, this.name = t.name;
12421
12438
  }
@@ -12441,7 +12458,7 @@ class Ke {
12441
12458
  };
12442
12459
  }
12443
12460
  static create(t, e) {
12444
- const i = new Ke(t, e);
12461
+ const i = new Je(t, e);
12445
12462
  if (this.instances.find((a) => a.uuid === i.uuid))
12446
12463
  throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributive`);
12447
12464
  return this.instances.push(i), i;
@@ -12539,7 +12556,7 @@ class Ui {
12539
12556
  return this.create(e.public, e.options);
12540
12557
  }
12541
12558
  }
12542
- class kt {
12559
+ class At {
12543
12560
  constructor(t, e) {
12544
12561
  this._type = "Gateway", this._options = e, this.uuid = A(e), this.name = t.name;
12545
12562
  }
@@ -12561,7 +12578,7 @@ class kt {
12561
12578
  };
12562
12579
  }
12563
12580
  static create(t, e) {
12564
- const i = new kt(t, e);
12581
+ const i = new At(t, e);
12565
12582
  if (this.instances.find((a) => a.uuid === i.uuid))
12566
12583
  throw new Error(`duplicate uuid in options ${i.uuid}, Gateway`);
12567
12584
  return this.instances.push(i), i;
@@ -12851,10 +12868,10 @@ const Xa = [
12851
12868
  We,
12852
12869
  Ge,
12853
12870
  gt,
12854
- Je,
12855
12871
  Ke,
12872
+ Je,
12856
12873
  ae,
12857
- kt,
12874
+ At,
12858
12875
  Xe,
12859
12876
  ze,
12860
12877
  Ye,
@@ -12916,11 +12933,11 @@ class B {
12916
12933
  }
12917
12934
  static createInitialState(t) {
12918
12935
  const e = { uuid: t.uuid };
12919
- return St.is(t.content) && (e.children = t.childSeqs.map((i) => ft.createInitialState(i.head))), e;
12936
+ return kt.is(t.content) && (e.children = t.childSeqs.map((i) => ft.createInitialState(i.head))), e;
12920
12937
  }
12921
12938
  static create(t, e, i) {
12922
12939
  const r = e.getNodeByUUID(t.uuid);
12923
- if (St.is(r.content)) {
12940
+ if (kt.is(r.content)) {
12924
12941
  const s = B.GroupStateNodeType.get(r.content.type), n = new s(r, e, i);
12925
12942
  return n.isGroup = !0, n.children = t?.children?.map((o) => ft.create(o, e, n)), n;
12926
12943
  } else
@@ -12958,7 +12975,7 @@ class ye {
12958
12975
  return this.root.toJSON();
12959
12976
  }
12960
12977
  }
12961
- class Nt {
12978
+ class vt {
12962
12979
  constructor(t) {
12963
12980
  this.activity = t, this.uuidToNode = /* @__PURE__ */ new Map(), this.rawToNode = /* @__PURE__ */ new Map(), this.checkUserRef = async (e, i, r, a) => (C(i.isRef, "attributive must be ref"), ((await this.getActivity(e, a))?.refs)[i.name] === r.id), this.graph = this.buildGraph(t);
12964
12981
  }
@@ -12985,7 +13002,7 @@ class Nt {
12985
13002
  const a = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]), s = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]);
12986
13003
  if (t.transfers?.forEach((n) => {
12987
13004
  const o = this.rawToNode.get(n.source) || i.get(n.source), l = this.rawToNode.get(n.target) || i.get(n.target);
12988
- C(!!o, `cannot find source ${n.source.name}`), C(!!l, `cannot find target ${n.source.name}`), kt.is(o) ? o.next.push(l) : o.next = l, kt.is(l) ? l.prev.push(o) : l.prev = o, s.delete(n.source), a.delete(n.target);
13005
+ C(!!o, `cannot find source ${n.source.name}`), C(!!l, `cannot find target ${n.source.name}`), At.is(o) ? o.next.push(l) : o.next = l, At.is(l) ? l.prev.push(o) : l.prev = o, s.delete(n.source), a.delete(n.target);
12989
13006
  }), a.size !== 1) throw new Error(`start node must one, current: ${a.size}`);
12990
13007
  if (s.size !== 1) throw new Error(`end node must be one, current: ${s.size}`);
12991
13008
  return Object.assign(r, {
@@ -12999,7 +13016,7 @@ class Nt {
12999
13016
  async create(t) {
13000
13017
  const e = ye.createInitialState(this.graph.head);
13001
13018
  return {
13002
- activityId: (await t.system.storage.create(Nt.ACTIVITY_RECORD, {
13019
+ activityId: (await t.system.storage.create(vt.ACTIVITY_RECORD, {
13003
13020
  name: this.activity.name,
13004
13021
  uuid: this.activity.uuid,
13005
13022
  state: e,
@@ -13019,14 +13036,14 @@ class Nt {
13019
13036
  key: "id",
13020
13037
  value: ["=", e]
13021
13038
  });
13022
- return (await t.system.storage.find(Nt.ACTIVITY_RECORD, i, void 0, ["*"])).map((a) => ({ ...a, state: a.state, refs: a.refs }))[0];
13039
+ return (await t.system.storage.find(vt.ACTIVITY_RECORD, i, void 0, ["*"])).map((a) => ({ ...a, state: a.state, refs: a.refs }))[0];
13023
13040
  }
13024
13041
  async setActivity(t, e, i) {
13025
13042
  const r = w.atom({
13026
13043
  key: "id",
13027
13044
  value: ["=", e]
13028
13045
  }), a = { ...i };
13029
- return delete a.state, delete a.refs, i.state && (a.state = i.state), i.refs && (a.refs = i.refs), await t.system.storage.update(Nt.ACTIVITY_RECORD, r, a);
13046
+ return delete a.state, delete a.refs, i.state && (a.state = i.state), i.refs && (a.refs = i.refs), await t.system.storage.update(vt.ACTIVITY_RECORD, r, a);
13030
13047
  }
13031
13048
  async setState(t, e, i) {
13032
13049
  return this.setActivity(t, e, { state: i });
@@ -13040,7 +13057,7 @@ class Nt {
13040
13057
  return e.parentSeq.tail === e;
13041
13058
  }
13042
13059
  isActivityHead(t, e = this.graph.head) {
13043
- return St.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((i) => this.isActivityHead(t, i.head)) : t === this.graph.head.content;
13060
+ return kt.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((i) => this.isActivityHead(t, i.head)) : t === this.graph.head.content;
13044
13061
  }
13045
13062
  async checkActivityState(t, e, i) {
13046
13063
  if (!new ye(await this.getState(t, e), this).isInteractionAvailable(i))
@@ -13048,13 +13065,13 @@ class Nt {
13048
13065
  }
13049
13066
  async fullGuardWithUserRef(t, e, i) {
13050
13067
  if (!t.ignoreGuard && e.conditions && await _i(t, e, i), e.userAttributives) {
13051
- const r = Vt.is(e.userAttributives) ? v.fromValue(
13068
+ const r = Qt.is(e.userAttributives) ? E.fromValue(
13052
13069
  e.userAttributives.content
13053
- ) : v.atom(
13070
+ ) : E.atom(
13054
13071
  e.userAttributives
13055
13072
  ), a = (n) => n.isRef ? this.checkUserRef(t, n, i.user, i.activityId) : za(t, n, i, i.user), s = await r.evaluateAsync(a);
13056
13073
  if (s !== !0)
13057
- throw new K("User check failed", {
13074
+ throw new J("User check failed", {
13058
13075
  type: "check user failed",
13059
13076
  checkType: "user",
13060
13077
  error: s
@@ -13152,7 +13169,7 @@ const is = "_Activity_", Hi = D.create({
13152
13169
  class _s {
13153
13170
  constructor(t) {
13154
13171
  this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(Hi, je), this.requiredRelations.push(rs)), t.forEach((e) => {
13155
- const i = new Nt(e);
13172
+ const i = new vt(e);
13156
13173
  this.activityCalls.set(e.uuid, i), e.name && (C(!this.activityCallsByName.has(e.name), `activity name ${e.name} is duplicated`), this.activityCallsByName.set(e.name, i));
13157
13174
  });
13158
13175
  for (const e of t) {
@@ -13279,42 +13296,42 @@ export {
13279
13296
  de as ASYNC_TASK_RECORD,
13280
13297
  ae as Action,
13281
13298
  Ge as Activity,
13282
- Nt as ActivityCall,
13299
+ vt as ActivityCall,
13283
13300
  as as ActivityError,
13284
- St as ActivityGroup,
13301
+ kt as ActivityGroup,
13285
13302
  rs as ActivityInteractionRelation,
13286
13303
  _s as ActivityManager,
13287
13304
  Hi as ActivityStateEntity,
13288
13305
  Qs as ActivityStateError,
13289
13306
  Er as AliasManager,
13290
13307
  fa as AmbiguousComputationSignatureError,
13291
- Pt as Any,
13308
+ Dt as Any,
13292
13309
  qr as AnyHandles,
13293
13310
  Ve as AsyncMigrationComputationError,
13294
13311
  it as AttributeInfo,
13295
13312
  O as AttributeQuery,
13296
13313
  gt as Attributive,
13297
- Vt as Attributives,
13298
- xt as Average,
13314
+ Qt as Attributives,
13315
+ Mt as Average,
13299
13316
  ra as AverageHandles,
13300
- Ot as BoolAtomData,
13301
- v as BoolExp,
13302
- Ft as BoolExpressionData,
13317
+ Ft as BoolAtomData,
13318
+ E as BoolExp,
13319
+ Lt as BoolExpressionData,
13303
13320
  rt as ComputationDataDepError,
13304
13321
  H as ComputationError,
13305
13322
  x as ComputationResult,
13306
- _t as ComputationResultAsync,
13323
+ Vt as ComputationResultAsync,
13307
13324
  Xt as ComputationResultFullRecompute,
13308
13325
  ee as ComputationResultResolved,
13309
13326
  ht as ComputationResultSkip,
13310
13327
  li as ComputationStateError,
13311
- Je as Condition,
13328
+ Ke as Condition,
13312
13329
  lt as ConditionError,
13313
13330
  se as Conditions,
13314
13331
  at as ConstraintSetupError,
13315
13332
  Ii as ConstraintViolationError,
13316
13333
  xs as Controller,
13317
- $t as Count,
13334
+ It as Count,
13318
13335
  Qr as CountHandles,
13319
13336
  ir as CreationExecutor,
13320
13337
  Pe as Custom,
@@ -13324,11 +13341,11 @@ export {
13324
13341
  ri as DBSetup,
13325
13342
  ii as DEFAULT_SCHEMA_DIALECT,
13326
13343
  Es as DELETED_STATE,
13327
- J as DICTIONARY_RECORD,
13328
- Ke as DataAttributive,
13344
+ K as DICTIONARY_RECORD,
13345
+ Je as DataAttributive,
13329
13346
  Ze as DataAttributives,
13330
13347
  Ui as DataPolicy,
13331
- Tt as DestructiveComputedOutputError,
13348
+ St as DestructiveComputedOutputError,
13332
13349
  Ie as Dictionary,
13333
13350
  oi as DictionaryEntity,
13334
13351
  D as Entity,
@@ -13340,11 +13357,11 @@ export {
13340
13357
  q as ErrorSeverity,
13341
13358
  Xe as Event,
13342
13359
  ki as EventSource,
13343
- Mt as Every,
13360
+ Pt as Every,
13344
13361
  Or as EveryHandles,
13345
13362
  _ as Expression,
13346
13363
  U as FrameworkError,
13347
- kt as Gateway,
13364
+ At as Gateway,
13348
13365
  Ba as GetAction,
13349
13366
  Fr as GlobalAnyHandle,
13350
13367
  ea as GlobalAverageHandle,
@@ -13352,7 +13369,7 @@ export {
13352
13369
  _r as GlobalCountHandle,
13353
13370
  aa as GlobalCustomHandle,
13354
13371
  Pr as GlobalEveryHandle,
13355
- Kr as GlobalRealTimeComputation,
13372
+ Jr as GlobalRealTimeComputation,
13356
13373
  Ar as GlobalStateMachineHandle,
13357
13374
  Yr as GlobalSumHandle,
13358
13375
  Ir as GlobalWeightedSummationHandle,
@@ -13364,10 +13381,10 @@ export {
13364
13381
  We as Interaction,
13365
13382
  je as InteractionEventEntity,
13366
13383
  Vs as InteractionExecutionError,
13367
- K as InteractionGuardError,
13384
+ J as InteractionGuardError,
13368
13385
  Ce as KlassByName,
13369
13386
  g as LINK_SYMBOL,
13370
- Kt as LinkInfo,
13387
+ Jt as LinkInfo,
13371
13388
  Le as MIGRATION_MANIFEST_CONCEPT,
13372
13389
  qe as MIGRATION_MANIFEST_CURRENT_KEY,
13373
13390
  w as MatchExp,
@@ -13398,12 +13415,12 @@ export {
13398
13415
  $e as PropertyTypes,
13399
13416
  xr as PropertyWeightedSummationHandle,
13400
13417
  or as QueryExecutor,
13401
- Jt as ROOT_LABEL,
13418
+ Kt as ROOT_LABEL,
13402
13419
  si as ROW_ID_ATTR,
13403
- Dt as RealTime,
13420
+ Ot as RealTime,
13404
13421
  zr as RealTimeHandles,
13405
13422
  $ as RecordBoundState,
13406
- vt as RecordInfo,
13423
+ Et as RecordInfo,
13407
13424
  qi as RecordMutationSideEffect,
13408
13425
  L as RecordQuery,
13409
13426
  ur as RecordQueryAgent,
@@ -13419,24 +13436,24 @@ export {
13419
13436
  wt as SYSTEM_RECORD,
13420
13437
  ha as Scheduler,
13421
13438
  Me as SideEffect,
13422
- At as StateMachine,
13439
+ Ct as StateMachine,
13423
13440
  $r as StateMachineHandles,
13424
13441
  mt as StateNode,
13425
13442
  xe as StateTransfer,
13426
- It as Summation,
13443
+ xt as Summation,
13427
13444
  ta as SummationHandles,
13428
13445
  He as SystemConsoleLogger,
13429
13446
  ni as SystemEntity,
13430
13447
  Va as SystemLogLevel,
13431
13448
  Re as TransactionCapabilityError,
13432
- jt as TransactionRetryExhaustedError,
13449
+ Wt as TransactionRetryExhaustedError,
13433
13450
  Qi as Transfer,
13434
13451
  te as Transform,
13435
- Jr as TransformHandles,
13452
+ Kr as TransformHandles,
13436
13453
  $s as USER_ENTITY,
13437
13454
  Zt as UniqueConstraint,
13438
- Et as UnrebuildableComputationError,
13439
- Ct as WeightedSummation,
13455
+ Tt as UnrebuildableComputationError,
13456
+ $t as WeightedSummation,
13440
13457
  Mr as WeightedSummationHandles,
13441
13458
  di as addToCurrentEffects,
13442
13459
  C as assert,
@@ -13453,7 +13470,7 @@ export {
13453
13470
  re as computationManifestId,
13454
13471
  Gi as createInstances,
13455
13472
  hs as createInstancesFromString,
13456
- Ht as createMigrationManifest,
13473
+ jt as createMigrationManifest,
13457
13474
  kr as createNonNullConstraintStatement,
13458
13475
  Ia as createPlanBlockingMessages,
13459
13476
  Sr as createUniqueConstraintStatement,
@@ -13461,7 +13478,7 @@ export {
13461
13478
  qs as createUserRoleAttributive,
13462
13479
  P as dataContextPath,
13463
13480
  Ms as dbConsoleLogger,
13464
- Qt as deepClone,
13481
+ Bt as deepClone,
13465
13482
  Ai as defaultEncodeLiteral,
13466
13483
  bs as everyAsync,
13467
13484
  Rs as everyWithErrorAsync,
@@ -13493,7 +13510,7 @@ export {
13493
13510
  le as normalizeDatabaseError,
13494
13511
  Tr as predicateSQLForOperator,
13495
13512
  ot as quoteIdentifier,
13496
- Bt as quoteLiteral,
13513
+ Ut as quoteLiteral,
13497
13514
  gi as readMigrationManifest,
13498
13515
  Pa as recomputeChangedComputations,
13499
13516
  Oa as recomputeFilteredMemberships,