interaqt 0.6.3 → 0.6.4

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
@@ -17,15 +17,15 @@ function Ce(u, t) {
17
17
  function w(u) {
18
18
  return typeof u == "function" ? `func::${u.toString()}` : Array.isArray(u) ? u : de(u) && !he(u) ? `uuid::${u.uuid}` : u;
19
19
  }
20
- function mt(u, t) {
20
+ function ft(u, t) {
21
21
  if (u == null || typeof u != "object") return u;
22
- if (Array.isArray(u)) return u.map((i) => mt(i, t));
22
+ if (Array.isArray(u)) return u.map((i) => ft(i, t));
23
23
  if (he(u))
24
- return Object.fromEntries(Object.entries(u).map(([i, r]) => [i, mt(r, t)]));
24
+ return Object.fromEntries(Object.entries(u).map(([i, r]) => [i, ft(r, t)]));
25
25
  if (u instanceof Set)
26
- return new Set(Array.from(u.values()).map((i) => mt(i, t)));
26
+ return new Set(Array.from(u.values()).map((i) => ft(i, t)));
27
27
  if (u instanceof Map)
28
- return new Map(Array.from(u.entries()).map(([i, r]) => [i, mt(r, t)]));
28
+ return new Map(Array.from(u.entries()).map(([i, r]) => [i, ft(r, t)]));
29
29
  const e = u;
30
30
  return t && e._type && e.constructor?.clone ? e.constructor.clone(u, t) : u;
31
31
  }
@@ -737,7 +737,7 @@ class qt {
737
737
  return this.create(e.public, e.options);
738
738
  }
739
739
  }
740
- class tt {
740
+ class Z {
741
741
  constructor(t, e) {
742
742
  this._type = "ActivityGroup", this._options = e, this.uuid = k(e), this.type = t.type, this.activities = t.activities || [];
743
743
  }
@@ -766,7 +766,7 @@ class tt {
766
766
  };
767
767
  }
768
768
  static create(t, e) {
769
- const i = new tt(t, e);
769
+ const i = new Z(t, e);
770
770
  if (this.instances.find((s) => s.uuid === i.uuid))
771
771
  throw new Error(`duplicate uuid in options ${i.uuid}, ActivityGroup`);
772
772
  return this.instances.push(i), i;
@@ -881,7 +881,7 @@ function dr(u) {
881
881
  function hr(u) {
882
882
  return null;
883
883
  }
884
- class rt {
884
+ class it {
885
885
  constructor(t, e) {
886
886
  this._type = "BoolAtomData", this._options = e, this.uuid = k(e), this.type = t.type || "atom", this.data = t.data;
887
887
  }
@@ -910,7 +910,7 @@ class rt {
910
910
  };
911
911
  }
912
912
  static create(t, e) {
913
- const i = new rt(t, e);
913
+ const i = new it(t, e);
914
914
  if (this.instances.find((s) => s.uuid === i.uuid))
915
915
  throw new Error(`duplicate uuid in options ${i.uuid}, BoolAtomData`);
916
916
  return this.instances.push(i), i;
@@ -944,7 +944,7 @@ class rt {
944
944
  return this.create(e.public, e.options);
945
945
  }
946
946
  }
947
- class st {
947
+ class rt {
948
948
  constructor(t, e) {
949
949
  this._type = "BoolExpressionData", this._options = e, this.uuid = k(e), this.type = t.type || "expression", this.operator = t.operator || "and", this.left = t.left, this.right = t.right;
950
950
  }
@@ -985,7 +985,7 @@ class st {
985
985
  };
986
986
  }
987
987
  static create(t, e) {
988
- const i = new st(t, e);
988
+ const i = new rt(t, e);
989
989
  if (this.instances.find((s) => s.uuid === i.uuid))
990
990
  throw new Error(`duplicate uuid in options ${i.uuid}, BoolExpressionData`);
991
991
  return this.instances.push(i), i;
@@ -1179,13 +1179,13 @@ const Oe = {
1179
1179
  function Fe(u) {
1180
1180
  return { key: u };
1181
1181
  }
1182
- function yt(u, t, e) {
1182
+ function mt(u, t, e) {
1183
1183
  if (u.type === "LogicalExpression")
1184
1184
  return {
1185
1185
  type: "expression",
1186
1186
  operator: Oe[u.operator],
1187
- left: yt(u.left, t, e),
1188
- right: yt(u.right, t, e)
1187
+ left: mt(u.left, t, e),
1188
+ right: mt(u.right, t, e)
1189
1189
  };
1190
1190
  if (u.type === "Identifier")
1191
1191
  return {
@@ -1196,17 +1196,17 @@ function yt(u, t, e) {
1196
1196
  return {
1197
1197
  type: "expression",
1198
1198
  operator: "not",
1199
- left: yt(u.argument, t, e)
1199
+ left: mt(u.argument, t, e)
1200
1200
  };
1201
1201
  throw new Error("unknown ast node type");
1202
1202
  }
1203
1203
  function pr(u, t = [], e = Fe) {
1204
1204
  const i = Ce(t, "name"), r = Ee(u, { ecmaVersion: 2020 });
1205
1205
  return new R(
1206
- yt(r.body[0].expression, i, e)
1206
+ mt(r.body[0].expression, i, e)
1207
1207
  );
1208
1208
  }
1209
- class U {
1209
+ class j {
1210
1210
  constructor(t, e) {
1211
1211
  this._type = "Attributive", this._options = e, this.uuid = k(e), this.stringContent = t.stringContent, this.content = t.content, this.name = t.name, this.isRef = t.isRef;
1212
1212
  }
@@ -1238,7 +1238,7 @@ class U {
1238
1238
  };
1239
1239
  }
1240
1240
  static create(t, e) {
1241
- const i = new U(t, e);
1241
+ const i = new j(t, e);
1242
1242
  if (this.instances.find((s) => s.uuid === i.uuid))
1243
1243
  throw new Error(`duplicate uuid in options ${i.uuid}, Attributive`);
1244
1244
  return this.instances.push(i), i;
@@ -1331,12 +1331,12 @@ class vt {
1331
1331
  function Mt(u) {
1332
1332
  if (!u) return;
1333
1333
  if (u.raw.type === "atom")
1334
- return rt.create({
1334
+ return it.create({
1335
1335
  type: "atom",
1336
1336
  data: u.raw.data
1337
1337
  });
1338
1338
  const t = u.raw;
1339
- return st.create({
1339
+ return rt.create({
1340
1340
  type: "expression",
1341
1341
  operator: t.operator,
1342
1342
  left: Mt(u.left),
@@ -1640,7 +1640,7 @@ class kt {
1640
1640
  }
1641
1641
  }
1642
1642
  const Ve = kt.create({ name: "get" });
1643
- class et {
1643
+ class tt {
1644
1644
  constructor(t, e) {
1645
1645
  this._type = "Gateway", this._options = e, this.uuid = k(e), this.name = t.name;
1646
1646
  }
@@ -1662,7 +1662,7 @@ class et {
1662
1662
  };
1663
1663
  }
1664
1664
  static create(t, e) {
1665
- const i = new et(t, e);
1665
+ const i = new tt(t, e);
1666
1666
  if (this.instances.find((s) => s.uuid === i.uuid))
1667
1667
  throw new Error(`duplicate uuid in options ${i.uuid}, Gateway`);
1668
1668
  return this.instances.push(i), i;
@@ -1748,7 +1748,7 @@ class Wt {
1748
1748
  return this.create(e.public, e.options);
1749
1749
  }
1750
1750
  }
1751
- class K {
1751
+ class U {
1752
1752
  constructor(t, e) {
1753
1753
  this._type = "StateNode", this._options = e, this.uuid = k(e), this.name = t.name, this.computeValue = t.computeValue;
1754
1754
  }
@@ -1776,7 +1776,7 @@ class K {
1776
1776
  };
1777
1777
  }
1778
1778
  static create(t, e) {
1779
- const i = new K(t, e);
1779
+ const i = new U(t, e);
1780
1780
  if (this.instances.find((s) => s.uuid === i.uuid))
1781
1781
  throw new Error(`duplicate uuid in options ${i.uuid}, StateNode`);
1782
1782
  return this.instances.push(i), i;
@@ -1888,7 +1888,7 @@ class Jt {
1888
1888
  return this.create(e.public, e.options);
1889
1889
  }
1890
1890
  }
1891
- class at {
1891
+ class st {
1892
1892
  constructor(t, e) {
1893
1893
  this._type = "StateMachine", this._options = e, this.uuid = k(e), this.states = t.states, this.transfers = t.transfers, this.defaultState = t.defaultState;
1894
1894
  }
@@ -1921,7 +1921,7 @@ class at {
1921
1921
  };
1922
1922
  }
1923
1923
  static create(t, e) {
1924
- const i = new at(t, e);
1924
+ const i = new st(t, e);
1925
1925
  if (this.instances.find((s) => s.uuid === i.uuid))
1926
1926
  throw new Error(`duplicate uuid in options ${i.uuid}, StateMachine`);
1927
1927
  return this.instances.push(i), i;
@@ -1957,7 +1957,7 @@ class at {
1957
1957
  return this.create(e.public, e.options);
1958
1958
  }
1959
1959
  }
1960
- class ot {
1960
+ class at {
1961
1961
  constructor(t, e) {
1962
1962
  this._type = "WeightedSummation", this._options = e, this.uuid = k(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;
1963
1963
  }
@@ -2005,7 +2005,7 @@ class ot {
2005
2005
  };
2006
2006
  }
2007
2007
  static create(t, e) {
2008
- const i = new ot(t, e);
2008
+ const i = new at(t, e);
2009
2009
  if (this.instances.find((s) => s.uuid === i.uuid))
2010
2010
  throw new Error(`duplicate uuid in options ${i.uuid}, WeightedSummation`);
2011
2011
  return this.instances.push(i), i;
@@ -2047,7 +2047,7 @@ class ot {
2047
2047
  return i.callback && typeof i.callback == "string" && i.callback.startsWith("func::") && (i.callback = new Function("return " + i.callback.substring(6))()), this.create(i, e.options);
2048
2048
  }
2049
2049
  }
2050
- class nt {
2050
+ class ot {
2051
2051
  constructor(t, e) {
2052
2052
  this._type = "Count", this._options = e, this.uuid = k(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;
2053
2053
  }
@@ -2090,7 +2090,7 @@ class nt {
2090
2090
  };
2091
2091
  }
2092
2092
  static create(t, e) {
2093
- const i = new nt(t, e);
2093
+ const i = new ot(t, e);
2094
2094
  if (this.instances.find((s) => s.uuid === i.uuid))
2095
2095
  throw new Error(`duplicate uuid in options ${i.uuid}, Count`);
2096
2096
  return this.instances.push(i), i;
@@ -2131,7 +2131,7 @@ class nt {
2131
2131
  return i.callback && typeof i.callback == "string" && i.callback.startsWith("func::") && (i.callback = new Function("return " + i.callback.substring(6))()), this.create(i, e.options);
2132
2132
  }
2133
2133
  }
2134
- class ct {
2134
+ class nt {
2135
2135
  constructor(t, e) {
2136
2136
  this._type = "Summation", this._options = e, this.uuid = k(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.attributeQuery = t.attributeQuery;
2137
2137
  }
@@ -2164,7 +2164,7 @@ class ct {
2164
2164
  };
2165
2165
  }
2166
2166
  static create(t, e) {
2167
- const i = new ct(t, e);
2167
+ const i = new nt(t, e);
2168
2168
  if (this.instances.find((s) => s.uuid === i.uuid))
2169
2169
  throw new Error(`duplicate uuid in options ${i.uuid}, Summation`);
2170
2170
  return this.instances.push(i), i;
@@ -2199,7 +2199,7 @@ class ct {
2199
2199
  return this.create(e.public, e.options);
2200
2200
  }
2201
2201
  }
2202
- class lt {
2202
+ class ct {
2203
2203
  constructor(t, e) {
2204
2204
  this._type = "Average", this._options = e, this.uuid = k(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.attributeQuery = t.attributeQuery;
2205
2205
  }
@@ -2232,7 +2232,7 @@ class lt {
2232
2232
  };
2233
2233
  }
2234
2234
  static create(t, e) {
2235
- const i = new lt(t, e);
2235
+ const i = new ct(t, e);
2236
2236
  if (this.instances.find((s) => s.uuid === i.uuid))
2237
2237
  throw new Error(`duplicate uuid in options ${i.uuid}, Average`);
2238
2238
  return this.instances.push(i), i;
@@ -2267,7 +2267,7 @@ class lt {
2267
2267
  return this.create(e.public, e.options);
2268
2268
  }
2269
2269
  }
2270
- class ut {
2270
+ class lt {
2271
2271
  constructor(t, e) {
2272
2272
  this._type = "Every", this._options = e, this.uuid = k(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;
2273
2273
  }
@@ -2315,7 +2315,7 @@ class ut {
2315
2315
  };
2316
2316
  }
2317
2317
  static create(t, e) {
2318
- const i = new ut(t, e);
2318
+ const i = new lt(t, e);
2319
2319
  if (this.instances.find((s) => s.uuid === i.uuid))
2320
2320
  throw new Error(`duplicate uuid in options ${i.uuid}, Every`);
2321
2321
  return this.instances.push(i), i;
@@ -2352,7 +2352,7 @@ class ut {
2352
2352
  return i.callback && typeof i.callback == "string" && i.callback.startsWith("func::") && (i.callback = new Function("return " + i.callback.substring(6))()), this.create(i, e.options);
2353
2353
  }
2354
2354
  }
2355
- class dt {
2355
+ class ut {
2356
2356
  constructor(t, e) {
2357
2357
  this._type = "Any", this._options = e, this.uuid = k(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;
2358
2358
  }
@@ -2400,7 +2400,7 @@ class dt {
2400
2400
  };
2401
2401
  }
2402
2402
  static create(t, e) {
2403
- const i = new dt(t, e);
2403
+ const i = new ut(t, e);
2404
2404
  if (this.instances.find((s) => s.uuid === i.uuid))
2405
2405
  throw new Error(`duplicate uuid in options ${i.uuid}, Any`);
2406
2406
  return this.instances.push(i), i;
@@ -2512,7 +2512,7 @@ class Tt {
2512
2512
  return typeof i.callback == "string" && i.callback.startsWith("func::") && (i.callback = new Function("return " + i.callback.substring(6))()), this.create(i, e.options);
2513
2513
  }
2514
2514
  }
2515
- class ht {
2515
+ class dt {
2516
2516
  constructor(t, e) {
2517
2517
  this._type = "RealTimeValue", this._options = e, this.uuid = k(e), this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps, this.nextRecomputeTime = t.nextRecomputeTime, this.callback = t.callback;
2518
2518
  }
@@ -2550,7 +2550,7 @@ class ht {
2550
2550
  };
2551
2551
  }
2552
2552
  static create(t, e) {
2553
- const i = new ht(t, e);
2553
+ const i = new dt(t, e);
2554
2554
  if (this.instances.find((s) => s.uuid === i.uuid))
2555
2555
  throw new Error(`duplicate uuid in options ${i.uuid}, RealTimeValue`);
2556
2556
  return this.instances.push(i), i;
@@ -2796,12 +2796,12 @@ class Ut {
2796
2796
  function Pt(u) {
2797
2797
  if (!u) return;
2798
2798
  if (u.raw.type === "atom")
2799
- return rt.create({
2799
+ return it.create({
2800
2800
  type: "atom",
2801
2801
  data: u.raw.data
2802
2802
  });
2803
2803
  const t = u.raw;
2804
- return st.create({
2804
+ return rt.create({
2805
2805
  type: "expression",
2806
2806
  operator: t.operator,
2807
2807
  left: Pt(u.left),
@@ -2922,29 +2922,29 @@ const Qe = [
2922
2922
  v,
2923
2923
  Lt,
2924
2924
  qt,
2925
- U,
2925
+ j,
2926
2926
  _t,
2927
2927
  Bt,
2928
2928
  kt,
2929
- et,
2929
+ tt,
2930
2930
  Wt,
2931
- K,
2931
+ U,
2932
2932
  Jt,
2933
+ st,
2933
2934
  at,
2934
2935
  ot,
2935
2936
  nt,
2936
2937
  ct,
2937
2938
  lt,
2938
2939
  ut,
2939
- dt,
2940
2940
  Tt,
2941
- ht,
2941
+ dt,
2942
2942
  Ht,
2943
2943
  jt,
2944
2944
  Ut,
2945
2945
  Qt,
2946
+ it,
2946
2947
  rt,
2947
- st,
2948
2948
  At,
2949
2949
  Kt
2950
2950
  ];
@@ -3270,7 +3270,7 @@ class ge {
3270
3270
  }
3271
3271
  }
3272
3272
  function mr({ name: u, isRef: t = !1 }, e) {
3273
- return U.create({
3273
+ return j.create({
3274
3274
  name: u,
3275
3275
  content: u ? new Function("user", `return user.roles.includes('${u}')`) : function() {
3276
3276
  return !0;
@@ -4243,18 +4243,18 @@ class We {
4243
4243
  }
4244
4244
  }
4245
4245
  const be = ":root";
4246
- class bt {
4246
+ class gt {
4247
4247
  constructor(t, e, i = []) {
4248
4248
  this.label = t, this.parent = e, this.stack = i;
4249
4249
  }
4250
4250
  concat(t) {
4251
- return new bt(this.label, this.parent, [...this.stack, t]);
4251
+ return new gt(this.label, this.parent, [...this.stack, t]);
4252
4252
  }
4253
4253
  getStack(t) {
4254
4254
  return [...this.stack];
4255
4255
  }
4256
4256
  spawn(t) {
4257
- return new bt(t, this);
4257
+ return new gt(t, this);
4258
4258
  }
4259
4259
  }
4260
4260
  class Je {
@@ -4334,7 +4334,7 @@ ${b}
4334
4334
  // 查 entity 和 查 relation 都是一样的。具体在 entityQuery 里面区别。
4335
4335
  // TODO 为了性能,也可以把信息丢到客户端,然客户端去结构化???
4336
4336
  // CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
4337
- async findRecords(t, e = "", i, r = new bt(be)) {
4337
+ async findRecords(t, e = "", i, r = new gt(be)) {
4338
4338
  if (i || (i = new Je(t)), t.goto) {
4339
4339
  if (t.exit && await t.exit(r))
4340
4340
  return [];
@@ -5187,7 +5187,7 @@ class je {
5187
5187
  return this.map.getInfo(t, e).recordName;
5188
5188
  }
5189
5189
  }
5190
- class it {
5190
+ class et {
5191
5191
  constructor(t, e) {
5192
5192
  this.name = t, this.map = e, this.data = this.map.data.records[t];
5193
5193
  }
@@ -5258,7 +5258,7 @@ class it {
5258
5258
  return this.data.matchExpression;
5259
5259
  }
5260
5260
  get filteredBy() {
5261
- return this.data.filteredBy?.map((t) => new it(t, this.map));
5261
+ return this.data.filteredBy?.map((t) => new et(t, this.map));
5262
5262
  }
5263
5263
  get isFilteredEntity() {
5264
5264
  return this.data?.isFilteredEntity;
@@ -5276,7 +5276,7 @@ class it {
5276
5276
  return this.data?.resolvedMatchExpression;
5277
5277
  }
5278
5278
  }
5279
- class Rt {
5279
+ class bt {
5280
5280
  constructor(t, e, i, r = !0) {
5281
5281
  this.name = t, this.data = e, this.map = i, this.isFromSource = r;
5282
5282
  }
@@ -5305,10 +5305,10 @@ class Rt {
5305
5305
  return this.data.sourceRecord;
5306
5306
  }
5307
5307
  get sourceRecordInfo() {
5308
- return new it(this.data.sourceRecord, this.map);
5308
+ return new et(this.data.sourceRecord, this.map);
5309
5309
  }
5310
5310
  get targetRecordInfo() {
5311
- return new it(this.data.targetRecord, this.map);
5311
+ return new et(this.data.targetRecord, this.map);
5312
5312
  }
5313
5313
  get targetRecord() {
5314
5314
  return this.data.targetRecord;
@@ -5364,7 +5364,7 @@ class Rt {
5364
5364
  getBaseLinkInfo() {
5365
5365
  g(this.isFilteredRelation(), "only filtered relation can get base link info");
5366
5366
  const t = this.data.baseLinkName;
5367
- return new Rt(t, this.map.data.links[t], this.map);
5367
+ return new bt(t, this.map.data.links[t], this.map);
5368
5368
  }
5369
5369
  getMatchExpression() {
5370
5370
  if (this.isFilteredRelation())
@@ -5392,7 +5392,7 @@ class Ue {
5392
5392
  return this.data.records[t].attributes[this.getAttributeAndSymmetricDirection(e)[0]];
5393
5393
  }
5394
5394
  getRecordInfo(t) {
5395
- return new it(t, this);
5395
+ return new et(t, this);
5396
5396
  }
5397
5397
  getInfo(t, e) {
5398
5398
  const i = this.getInfoByPath([t, ...e.split(".")]);
@@ -5403,10 +5403,10 @@ class Ue {
5403
5403
  }
5404
5404
  getLinkInfo(t, e) {
5405
5405
  const i = this.getAttributeAndSymmetricDirection(e)[0], { linkName: r, isSource: s } = this.data.records[t].attributes[i];
5406
- return g(!!r, `cannot find relation ${t} ${i}`), new Rt(r, this.data.links[r], this, !!s);
5406
+ return g(!!r, `cannot find relation ${t} ${i}`), new bt(r, this.data.links[r], this, !!s);
5407
5407
  }
5408
5408
  getLinkInfoByName(t) {
5409
- return g(!!this.data.links[t], `cannot find link ${t}`), new Rt(t, this.data.links[t], this);
5409
+ return g(!!this.data.links[t], `cannot find link ${t}`), new bt(t, this.data.links[t], this);
5410
5410
  }
5411
5411
  getInfoByPath(t) {
5412
5412
  const [e, ...i] = t;
@@ -5615,7 +5615,7 @@ function Xe(u, t) {
5615
5615
  }
5616
5616
  function ie(u, t, e, i) {
5617
5617
  const r = u.filter((s) => {
5618
- const a = ft(s);
5618
+ const a = pt(s);
5619
5619
  return a && a.length > 0;
5620
5620
  });
5621
5621
  if (r.length !== 0)
@@ -5628,14 +5628,14 @@ function ie(u, t, e, i) {
5628
5628
  );
5629
5629
  }
5630
5630
  function ze(u, t, e, i) {
5631
- const r = e === "entity", a = `__${G(u)}_input_${e}`, o = r ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] = ii(
5631
+ const r = e === "entity", a = `__${K(u)}_input_${e}`, o = r ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] = ii(
5632
5632
  o,
5633
5633
  a,
5634
5634
  i,
5635
5635
  t
5636
5636
  );
5637
5637
  t.replace(n, u), c !== n && t.add(c);
5638
- const l = ft(u);
5638
+ const l = pt(u);
5639
5639
  if (l)
5640
5640
  for (const d of l)
5641
5641
  Ye(
@@ -5654,14 +5654,14 @@ function Ye(u, t, e, i, r) {
5654
5654
  );
5655
5655
  if (!r && s === u)
5656
5656
  return;
5657
- const o = G(a), n = r ? i.getEntityByName(o) : i.getRelationByName(o);
5657
+ const o = K(a), n = r ? i.getEntityByName(o) : i.getRelationByName(o);
5658
5658
  n && i.replace(s, n);
5659
5659
  }
5660
5660
  function Ze(u, t) {
5661
- const e = /* @__PURE__ */ new Map(), i = ft(u);
5661
+ const e = /* @__PURE__ */ new Map(), i = pt(u);
5662
5662
  if (i && i.length > 0)
5663
5663
  for (const r of i) {
5664
- const s = G(r), a = [...t.get(s) || []], o = e.get(s) || [];
5664
+ const s = K(r), a = [...t.get(s) || []], o = e.get(s) || [];
5665
5665
  for (o.push(s), e.set(s, o); a.length; ) {
5666
5666
  const n = a.shift(), c = e.get(n) || [];
5667
5667
  c.push(...o), e.set(n, c);
@@ -5677,18 +5677,18 @@ function ti(u, t, e) {
5677
5677
  name: u,
5678
5678
  type: "json",
5679
5679
  defaultValue: (r, s) => {
5680
- const a = ft(t), n = (i.get(s) || []).filter(
5681
- (c) => a.some((l) => G(l) === c)
5680
+ const a = pt(t), n = (i.get(s) || []).filter(
5681
+ (c) => a.some((l) => K(l) === c)
5682
5682
  );
5683
5683
  return n.length > 0 ? n : [s];
5684
5684
  }
5685
5685
  });
5686
5686
  }
5687
5687
  function ei(u, t, e) {
5688
- const i = ft(u), r = [], s = /* @__PURE__ */ new Map(), a = {};
5688
+ const i = pt(u), r = [], s = /* @__PURE__ */ new Map(), a = {};
5689
5689
  for (const o of i) {
5690
5690
  let n = o;
5691
- if (pt(n))
5691
+ if (ht(n))
5692
5692
  for (; n.baseEntity && n.properties.length === 0; )
5693
5693
  n = n.baseEntity;
5694
5694
  else if (ai(n))
@@ -5735,7 +5735,7 @@ function ii(u, t, e, i) {
5735
5735
  r,
5736
5736
  ...u.properties
5737
5737
  ];
5738
- if (pt(u)) {
5738
+ if (ht(u)) {
5739
5739
  const a = i.getEntityByName(u.name), o = C.create({
5740
5740
  name: a.name
5741
5741
  });
@@ -5773,7 +5773,7 @@ function ii(u, t, e, i) {
5773
5773
  properties: s
5774
5774
  }), o.baseRelation = n, o.sourceProperty = a.sourceProperty, o.targetProperty = a.targetProperty, o.matchExpression = m.fromArray(
5775
5775
  a.inputRelations.map((l) => {
5776
- const d = G(l);
5776
+ const d = K(l);
5777
5777
  return {
5778
5778
  key: t,
5779
5779
  value: ["contains", d]
@@ -5786,7 +5786,7 @@ function ii(u, t, e, i) {
5786
5786
  }
5787
5787
  }
5788
5788
  function ri(u, t, e) {
5789
- if (pt(u)) {
5789
+ if (ht(u)) {
5790
5790
  const i = u, r = t;
5791
5791
  let s = i;
5792
5792
  if (i.baseEntity)
@@ -5798,7 +5798,7 @@ function ri(u, t, e) {
5798
5798
  value: ["contains", i.name]
5799
5799
  }), [a, s];
5800
5800
  } else {
5801
- const i = u, r = t, s = G(i);
5801
+ const i = u, r = t, s = K(i);
5802
5802
  return i.baseRelation ? [i, si(i)] : [P.create({
5803
5803
  name: s,
5804
5804
  baseRelation: r,
@@ -5817,17 +5817,17 @@ function si(u) {
5817
5817
  t = t.baseRelation;
5818
5818
  return t;
5819
5819
  }
5820
- function pt(u) {
5820
+ function ht(u) {
5821
5821
  return "inputEntities" in u || !("sourceProperty" in u);
5822
5822
  }
5823
5823
  function ai(u) {
5824
5824
  return "sourceProperty" in u;
5825
5825
  }
5826
- function ft(u) {
5827
- return pt(u) ? u.inputEntities || [] : u.inputRelations || [];
5826
+ function pt(u) {
5827
+ return ht(u) ? u.inputEntities || [] : u.inputRelations || [];
5828
5828
  }
5829
- function G(u) {
5830
- return pt(u), u.name;
5829
+ function K(u) {
5830
+ return ht(u), u.name;
5831
5831
  }
5832
5832
  class oi {
5833
5833
  constructor(t, e, i, r = []) {
@@ -6222,8 +6222,8 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
6222
6222
  return this.fieldCounter++, this.fieldNameMap.set(t, r), this.usedFieldNames.add(r), r;
6223
6223
  }
6224
6224
  }
6225
- const z = "_System_", q = "_Dictionary_", re = "id", se = "_rowId", ni = C.create({
6226
- name: z,
6225
+ const X = "_System_", q = "_Dictionary_", re = "id", se = "_rowId", ni = C.create({
6226
+ name: X,
6227
6227
  properties: [
6228
6228
  v.create({
6229
6229
  name: "concept",
@@ -6483,7 +6483,7 @@ class li {
6483
6483
  }
6484
6484
  class S {
6485
6485
  static {
6486
- this.skip = () => new wt();
6486
+ this.skip = () => new Rt();
6487
6487
  }
6488
6488
  static {
6489
6489
  this.resolved = (t, e) => new Ne(t, e);
@@ -6495,7 +6495,7 @@ class S {
6495
6495
  this.fullRecompute = (t) => new Re(t);
6496
6496
  }
6497
6497
  }
6498
- class wt extends S {
6498
+ class Rt extends S {
6499
6499
  }
6500
6500
  class Re extends S {
6501
6501
  constructor(t) {
@@ -6610,7 +6610,7 @@ class hi {
6610
6610
  }
6611
6611
  }
6612
6612
  static {
6613
- this.computationType = at;
6613
+ this.computationType = st;
6614
6614
  }
6615
6615
  static {
6616
6616
  this.contextType = "global";
@@ -6641,7 +6641,7 @@ class pi {
6641
6641
  }
6642
6642
  }
6643
6643
  static {
6644
- this.computationType = at;
6644
+ this.computationType = st;
6645
6645
  }
6646
6646
  static {
6647
6647
  this.contextType = "property";
@@ -6677,13 +6677,13 @@ Or if you want to use state name as value, you should not set ${this.dataContext
6677
6677
  };
6678
6678
  }
6679
6679
  }
6680
- const Nr = K.create({
6680
+ const Nr = U.create({
6681
6681
  name: "nonExistent",
6682
6682
  computeValue: () => null
6683
- }), vr = K.create({
6683
+ }), vr = U.create({
6684
6684
  name: "nonDeleted",
6685
6685
  computeValue: () => !1
6686
- }), kr = K.create({
6686
+ }), kr = U.create({
6687
6687
  name: "deleted",
6688
6688
  computeValue: () => !0
6689
6689
  }), fi = [hi, pi];
@@ -6699,7 +6699,7 @@ class mi {
6699
6699
  };
6700
6700
  }
6701
6701
  static {
6702
- this.computationType = ot;
6702
+ this.computationType = at;
6703
6703
  }
6704
6704
  static {
6705
6705
  this.contextType = "global";
@@ -6758,7 +6758,7 @@ class yi {
6758
6758
  };
6759
6759
  }
6760
6760
  static {
6761
- this.computationType = ot;
6761
+ this.computationType = at;
6762
6762
  }
6763
6763
  static {
6764
6764
  this.contextType = "property";
@@ -6829,7 +6829,7 @@ class bi {
6829
6829
  }, this.defaultValue = !this.args.notEmpty;
6830
6830
  }
6831
6831
  static {
6832
- this.computationType = ut;
6832
+ this.computationType = lt;
6833
6833
  }
6834
6834
  static {
6835
6835
  this.contextType = "global";
@@ -6889,7 +6889,7 @@ class Ri {
6889
6889
  };
6890
6890
  }
6891
6891
  static {
6892
- this.computationType = ut;
6892
+ this.computationType = lt;
6893
6893
  }
6894
6894
  static {
6895
6895
  this.contextType = "property";
@@ -6957,7 +6957,7 @@ class Ni {
6957
6957
  };
6958
6958
  }
6959
6959
  static {
6960
- this.computationType = dt;
6960
+ this.computationType = ut;
6961
6961
  }
6962
6962
  static {
6963
6963
  this.contextType = "global";
@@ -7021,7 +7021,7 @@ class vi {
7021
7021
  };
7022
7022
  }
7023
7023
  static {
7024
- this.computationType = dt;
7024
+ this.computationType = ut;
7025
7025
  }
7026
7026
  static {
7027
7027
  this.contextType = "property";
@@ -7087,7 +7087,7 @@ class Ti {
7087
7087
  };
7088
7088
  }
7089
7089
  static {
7090
- this.computationType = nt;
7090
+ this.computationType = ot;
7091
7091
  }
7092
7092
  static {
7093
7093
  this.contextType = "global";
@@ -7143,7 +7143,7 @@ class Ai {
7143
7143
  };
7144
7144
  }
7145
7145
  static {
7146
- this.computationType = nt;
7146
+ this.computationType = ot;
7147
7147
  }
7148
7148
  static {
7149
7149
  this.contextType = "property";
@@ -7415,10 +7415,10 @@ class M {
7415
7415
  }
7416
7416
  }
7417
7417
  gt(t) {
7418
- return new Nt(this, ">", t);
7418
+ return new wt(this, ">", t);
7419
7419
  }
7420
7420
  lt(t) {
7421
- return new Nt(this, "<", t);
7421
+ return new wt(this, "<", t);
7422
7422
  }
7423
7423
  eq(t) {
7424
7424
  return new Xt(this, t);
@@ -7518,7 +7518,7 @@ class M {
7518
7518
  }
7519
7519
  }
7520
7520
  }
7521
- class Nt {
7521
+ class wt {
7522
7522
  constructor(t, e, i) {
7523
7523
  this.left = t, this.operator = e, this.right = i;
7524
7524
  }
@@ -7593,7 +7593,7 @@ class xi {
7593
7593
  this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = this.args.dataDeps ?? {}, this.callback = (r, s) => this.args.callback.call(this.controller, r, s), this.nextRecomputeTime = this.args.nextRecomputeTime ? (r, s) => this.args.nextRecomputeTime.call(this.controller, r, s) : void 0;
7594
7594
  }
7595
7595
  static {
7596
- this.computationType = ht;
7596
+ this.computationType = dt;
7597
7597
  }
7598
7598
  static {
7599
7599
  this.contextType = "global";
@@ -7613,7 +7613,7 @@ class xi {
7613
7613
  let r, s;
7614
7614
  if (e instanceof M)
7615
7615
  r = e.evaluate({ now: i }), s = i + this.nextRecomputeTime(i, t);
7616
- else if (e instanceof Nt || e instanceof Xt)
7616
+ else if (e instanceof wt || e instanceof Xt)
7617
7617
  r = e.evaluate({ now: i }), s = e.solve();
7618
7618
  else
7619
7619
  throw new Error("Invalid result type");
@@ -7631,7 +7631,7 @@ class Ii {
7631
7631
  }, this.isResultNumber = this.dataContext.id.type === "number", this.callback = (r, s) => this.args.callback.call(this.controller, r, s), this.nextRecomputeTime = this.args.nextRecomputeTime ? (r, s) => this.args.nextRecomputeTime.call(this.controller, r, s) : void 0;
7632
7632
  }
7633
7633
  static {
7634
- this.computationType = ht;
7634
+ this.computationType = dt;
7635
7635
  }
7636
7636
  static {
7637
7637
  this.contextType = "property";
@@ -7651,7 +7651,7 @@ class Ii {
7651
7651
  let s, a;
7652
7652
  if (i instanceof M)
7653
7653
  s = i.evaluate({ now: r }), a = r + this.nextRecomputeTime(r, t);
7654
- else if (i instanceof Nt || i instanceof Xt)
7654
+ else if (i instanceof wt || i instanceof Xt)
7655
7655
  s = i.evaluate({ now: r }), a = i.solve();
7656
7656
  else
7657
7657
  throw new Error("Invalid result type");
@@ -7676,7 +7676,7 @@ class Pi {
7676
7676
  };
7677
7677
  }
7678
7678
  static {
7679
- this.computationType = ct;
7679
+ this.computationType = nt;
7680
7680
  }
7681
7681
  static {
7682
7682
  this.contextType = "global";
@@ -7741,7 +7741,7 @@ class $i {
7741
7741
  };
7742
7742
  }
7743
7743
  static {
7744
- this.computationType = ct;
7744
+ this.computationType = nt;
7745
7745
  }
7746
7746
  static {
7747
7747
  this.contextType = "property";
@@ -7827,7 +7827,7 @@ class Oi {
7827
7827
  };
7828
7828
  }
7829
7829
  static {
7830
- this.computationType = lt;
7830
+ this.computationType = ct;
7831
7831
  }
7832
7832
  static {
7833
7833
  this.contextType = "global";
@@ -7904,7 +7904,7 @@ class Fi {
7904
7904
  };
7905
7905
  }
7906
7906
  static {
7907
- this.computationType = lt;
7907
+ this.computationType = ct;
7908
7908
  }
7909
7909
  static {
7910
7910
  this.contextType = "property";
@@ -8192,13 +8192,13 @@ Stack trace:`, r.stack.split(`
8192
8192
  return null;
8193
8193
  }
8194
8194
  }
8195
- var V = /* @__PURE__ */ ((u) => (u.LOW = "low", u.MEDIUM = "medium", u.HIGH = "high", u.CRITICAL = "critical", u))(V || {}), X = /* @__PURE__ */ ((u) => (u.VALIDATION = "validation", u.PERMISSION = "permission", u.COMPUTATION = "computation", u.STORAGE = "storage", u.INTERACTION = "interaction", u.ACTIVITY = "activity", u.SYSTEM = "system", u.CONFIGURATION = "configuration", u))(X || {});
8196
- class Y extends J {
8195
+ var V = /* @__PURE__ */ ((u) => (u.LOW = "low", u.MEDIUM = "medium", u.HIGH = "high", u.CRITICAL = "critical", u))(V || {}), G = /* @__PURE__ */ ((u) => (u.VALIDATION = "validation", u.PERMISSION = "permission", u.COMPUTATION = "computation", u.STORAGE = "storage", u.INTERACTION = "interaction", u.ACTIVITY = "activity", u.SYSTEM = "system", u.CONFIGURATION = "configuration", u))(G || {});
8196
+ class z extends J {
8197
8197
  constructor(t, e = {}) {
8198
8198
  super(t, {
8199
8199
  errorType: e.context?.errorType || "InteractionExecutionError",
8200
8200
  context: {
8201
- category: X.INTERACTION,
8201
+ category: G.INTERACTION,
8202
8202
  interactionName: e.interactionName,
8203
8203
  userId: e.userId,
8204
8204
  payload: e.payload,
@@ -8214,7 +8214,7 @@ class ae extends J {
8214
8214
  super(t, {
8215
8215
  errorType: e.context?.errorType || "ActivityError",
8216
8216
  context: {
8217
- category: X.ACTIVITY,
8217
+ category: G.ACTIVITY,
8218
8218
  activityName: e.activityName,
8219
8219
  activityId: e.activityId,
8220
8220
  activityInstanceId: e.activityInstanceId,
@@ -8230,7 +8230,7 @@ class F extends J {
8230
8230
  super(t, {
8231
8231
  errorType: e.context?.errorType || "ComputationError",
8232
8232
  context: {
8233
- category: X.COMPUTATION,
8233
+ category: G.COMPUTATION,
8234
8234
  handleName: e.handleName,
8235
8235
  computationName: e.computationName,
8236
8236
  dataContext: e.dataContext,
@@ -8276,7 +8276,7 @@ class xt extends J {
8276
8276
  super(t, {
8277
8277
  errorType: e.context?.errorType || "SchedulerError",
8278
8278
  context: {
8279
- category: X.SYSTEM,
8279
+ category: G.SYSTEM,
8280
8280
  schedulingPhase: e.schedulingPhase,
8281
8281
  failedComputations: e.failedComputations,
8282
8282
  ...e.context
@@ -8290,7 +8290,7 @@ class D extends J {
8290
8290
  super(t, {
8291
8291
  errorType: e.context?.errorType || "ConditionError",
8292
8292
  context: {
8293
- category: X.PERMISSION,
8293
+ category: G.PERMISSION,
8294
8294
  checkType: e.checkType,
8295
8295
  fieldName: e.fieldName,
8296
8296
  payload: e.payload,
@@ -8805,7 +8805,7 @@ class Wi {
8805
8805
  causedBy: o instanceof Error ? o : new Error(String(o))
8806
8806
  });
8807
8807
  }
8808
- if (s instanceof wt)
8808
+ if (s instanceof Rt)
8809
8809
  return;
8810
8810
  if (s instanceof we)
8811
8811
  try {
@@ -8969,7 +8969,7 @@ class ke {
8969
8969
  return n === !0 ? !0 : (s.push(n), !1);
8970
8970
  }) ? !0 : { name: e.name, type: "conceptAlias", stack: r, error: s };
8971
8971
  } else {
8972
- if (U.is(e))
8972
+ if (j.is(e))
8973
8973
  return await this.checkAttributive(e, void 0, t) ? !0 : { name: e.name, type: "conceptCheck", stack: r, error: "role check error" };
8974
8974
  const s = e.constructor?.check;
8975
8975
  return s ? s(t) ? !0 : { name: e.name, type: "conceptCheck", stack: r, error: "constructor check error" } : e.constructor && typeof e.constructor.check == "function" ? e.constructor.check(t) ? !0 : { name: e.name || "", type: "conceptCheck", stack: r, error: "constructor check error" } : C.is(e) ? t && typeof t == "object" && "id" in t || t && typeof t == "object" ? !0 : { name: e.name || "", type: "conceptCheck", stack: r, error: "invalid entity data" } : t && typeof t == "object" ? !0 : typeof e == "function" ? t instanceof e ? !0 : { name: e.name, type: "conceptCheck", stack: r, error: "instanceof check error" } : (console.warn(`unknown concept ${e}, cannot check ${t}. pass.`), !0);
@@ -9147,11 +9147,11 @@ class $ {
9147
9147
  }
9148
9148
  static createInitialState(t) {
9149
9149
  const e = { uuid: t.uuid };
9150
- return tt.is(t.content) && (e.children = t.childSeqs.map((i) => H.createInitialState(i.head))), e;
9150
+ return Z.is(t.content) && (e.children = t.childSeqs.map((i) => H.createInitialState(i.head))), e;
9151
9151
  }
9152
9152
  static create(t, e, i) {
9153
9153
  const r = e.getNodeByUUID(t.uuid);
9154
- if (tt.is(r.content)) {
9154
+ if (Z.is(r.content)) {
9155
9155
  const a = $.GroupStateNodeType.get(r.content.type), o = new a(r, e, i);
9156
9156
  return o.isGroup = !0, o.children = t?.children?.map((n) => H.create(n, e, o)), o;
9157
9157
  } else
@@ -9190,7 +9190,7 @@ class ne {
9190
9190
  return this.root.toJSON();
9191
9191
  }
9192
9192
  }
9193
- class Z {
9193
+ class Y {
9194
9194
  constructor(t, e) {
9195
9195
  this.activity = t, this.controller = e, this.uuidToNode = /* @__PURE__ */ new Map(), this.uuidToInteractionCall = /* @__PURE__ */ new Map(), this.interactionCallByName = /* @__PURE__ */ new Map(), this.rawToNode = /* @__PURE__ */ new Map(), this.checkUserRef = async (i, r, s) => (T(i.isRef, "attributive must be ref"), ((await this.getActivity(s))?.refs)[i.name] === r.id), this.system = e.system, this.graph = this.buildGraph(t);
9196
9196
  }
@@ -9199,8 +9199,8 @@ class Z {
9199
9199
  }
9200
9200
  static {
9201
9201
  this.from = (t, e) => {
9202
- let i = Z.cache.get(t);
9203
- return i || (i = new Z(t, e), Z.cache.set(t, i)), i;
9202
+ let i = Y.cache.get(t);
9203
+ return i || (i = new Y(t, e), Y.cache.set(t, i)), i;
9204
9204
  };
9205
9205
  }
9206
9206
  buildGraph(t, e) {
@@ -9228,7 +9228,7 @@ class Z {
9228
9228
  const s = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]), a = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]);
9229
9229
  if (t.transfers?.forEach((o) => {
9230
9230
  const n = this.rawToNode.get(o.source) || i.get(o.source), c = this.rawToNode.get(o.target) || i.get(o.target);
9231
- T(!!n, `cannot find source ${o.source.name}`), T(!!c, `cannot find target ${o.source.name}`), et.is(n) ? n.next.push(c) : n.next = c, et.is(c) ? c.prev.push(n) : c.prev = n, a.delete(o.source), s.delete(o.target);
9231
+ T(!!n, `cannot find source ${o.source.name}`), T(!!c, `cannot find target ${o.source.name}`), tt.is(n) ? n.next.push(c) : n.next = c, tt.is(c) ? c.prev.push(n) : c.prev = n, a.delete(o.source), s.delete(o.target);
9232
9232
  }), s.size !== 1) throw new Error(`start node must one, current: ${s.size}`);
9233
9233
  if (a.size !== 1) throw new Error(`end node must be one, current: ${a.size}`);
9234
9234
  return Object.assign(r, {
@@ -9284,7 +9284,7 @@ class Z {
9284
9284
  return e.parentSeq.tail === e;
9285
9285
  }
9286
9286
  isActivityHead(t, e = this.graph.head) {
9287
- return tt.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((i) => this.isActivityHead(t, i.head)) : t === this.graph.head.content;
9287
+ return Z.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((i) => this.isActivityHead(t, i.head)) : t === this.graph.head.content;
9288
9288
  }
9289
9289
  async callInteraction(t, e, i) {
9290
9290
  const r = this.uuidToInteractionCall.get(e);
@@ -9317,7 +9317,7 @@ class Z {
9317
9317
  async saveUserRefs(t, e, i) {
9318
9318
  const r = (await this.getActivity(t))?.refs || {};
9319
9319
  e.interaction.userRef?.name && (r[e.interaction.userRef?.name] = i.user.id), e.interaction.payload?.items.forEach((s) => {
9320
- if (U.is(s.itemRef) && s.itemRef?.name && i.payload[s.name]) {
9320
+ if (j.is(s.itemRef) && s.itemRef?.name && i.payload[s.name]) {
9321
9321
  const a = i.payload[s.name];
9322
9322
  s.isCollection ? (r[s.itemRef.name] || (r[s.itemRef.name] = []), r[s.itemRef.name].push(a.id)) : r[s.itemRef.name] = a.id;
9323
9323
  }
@@ -9352,7 +9352,7 @@ class Ui extends $ {
9352
9352
  // 可以根据 group 上的具体配置逻辑,来动态决定。
9353
9353
  }
9354
9354
  $.GroupStateNodeType.set("program", Ui);
9355
- const ce = new ue(), Dt = "_Interaction_", gt = "_Activity_", Te = C.create({
9355
+ const ce = new ue(), Dt = "_Interaction_", yt = "_Activity_", Te = C.create({
9356
9356
  name: Dt,
9357
9357
  properties: [
9358
9358
  v.create({
@@ -9382,7 +9382,7 @@ const ce = new ue(), Dt = "_Interaction_", gt = "_Activity_", Te = C.create({
9382
9382
  })
9383
9383
  ]
9384
9384
  }), Ae = C.create({
9385
- name: gt,
9385
+ name: yt,
9386
9386
  properties: [
9387
9387
  v.create({
9388
9388
  name: "name",
@@ -9416,7 +9416,7 @@ const ce = new ue(), Dt = "_Interaction_", gt = "_Activity_", Te = C.create({
9416
9416
  class Gi {
9417
9417
  constructor(t, e, i) {
9418
9418
  this.controller = t, this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.interactionCallsByName = /* @__PURE__ */ new Map(), this.interactionCalls = /* @__PURE__ */ new Map(), this.controller.entities.push(Ae, Te), this.controller.relations.push(Ki), e.forEach((r) => {
9419
- const s = new Z(r, t);
9419
+ const s = new Y(r, t);
9420
9420
  this.activityCalls.set(r.uuid, s), r.name && (T(!this.activityCallsByName.has(r.name), `activity name ${r.name} is duplicated`), this.activityCallsByName.set(r.name, s));
9421
9421
  }), i.forEach((r) => {
9422
9422
  const s = new ke(r, t);
@@ -9428,7 +9428,7 @@ class Gi {
9428
9428
  try {
9429
9429
  const s = this.interactionCallsByName.get(t);
9430
9430
  if (!s)
9431
- throw new Y(`Cannot find interaction for ${t}`, {
9431
+ throw new z(`Cannot find interaction for ${t}`, {
9432
9432
  interactionName: t,
9433
9433
  userId: e.user?.id,
9434
9434
  payload: e.payload,
@@ -9440,7 +9440,7 @@ class Gi {
9440
9440
  o = await s.call(e);
9441
9441
  } catch (n) {
9442
9442
  a = n, o = {
9443
- error: new Y("Interaction execution failed", {
9443
+ error: new z("Interaction execution failed", {
9444
9444
  interactionName: t,
9445
9445
  userId: e.user?.id,
9446
9446
  payload: e.payload,
@@ -9453,11 +9453,11 @@ class Gi {
9453
9453
  event: void 0
9454
9454
  };
9455
9455
  } finally {
9456
- a || o.error ? (a && (console.error(a), r.error({ label: "systemError", message: "unknownError", error: a })), r.error({ label: "interaction", message: s.interaction.name, error: o.error }), await this.controller.system.storage.rollbackTransaction(s.interaction.name)) : (await this.controller.system.storage.commitTransaction(s.interaction.name), await this.runRecordChangeSideEffects(o, r));
9456
+ a || o.error ? (a && (console.error(a), r.error({ label: "systemError", message: "unknownError", error: a })), r.error({ label: "interaction", message: s.interaction.name, error: o.error }), await this.controller.system.storage.rollbackTransaction(s.interaction.name)) : await this.controller.system.storage.commitTransaction(s.interaction.name);
9457
9457
  }
9458
9458
  return o;
9459
9459
  } catch (s) {
9460
- throw new Y("Unexpected error during interaction call", {
9460
+ throw new z("Unexpected error during interaction call", {
9461
9461
  interactionName: t,
9462
9462
  userId: e.user?.id,
9463
9463
  payload: e.payload,
@@ -9482,7 +9482,7 @@ class Gi {
9482
9482
  a.info({ label: "activity", message: o.activity.name }), await this.controller.system.storage.beginTransaction(o.activity.name);
9483
9483
  const n = o.interactionCallByName.get(e);
9484
9484
  if (!n) {
9485
- const l = new Y(`Cannot find interaction ${e} in activity ${t}`, {
9485
+ const l = new z(`Cannot find interaction ${e} in activity ${t}`, {
9486
9486
  interactionName: e,
9487
9487
  userId: r.user?.id,
9488
9488
  payload: r.payload,
@@ -9492,7 +9492,7 @@ class Gi {
9492
9492
  throw await this.controller.system.storage.rollbackTransaction(o.activity.name), l;
9493
9493
  }
9494
9494
  const c = await o.callInteraction(i, n.interaction.uuid, r);
9495
- return c.error ? (a.error({ label: "activity", message: o.activity.name }), await this.controller.system.storage.rollbackTransaction(o.activity.name)) : (await this.controller.system.storage.commitTransaction(o.activity.name), await this.runRecordChangeSideEffects(c, a)), c;
9495
+ return c.error ? (a.error({ label: "activity", message: o.activity.name }), await this.controller.system.storage.rollbackTransaction(o.activity.name)) : await this.controller.system.storage.commitTransaction(o.activity.name), c;
9496
9496
  } catch (o) {
9497
9497
  throw new ae("Unexpected error during activity interaction call", {
9498
9498
  activityName: t,
@@ -9505,35 +9505,8 @@ class Gi {
9505
9505
  });
9506
9506
  }
9507
9507
  }
9508
- async runRecordChangeSideEffects(t, e) {
9509
- const i = t.effects;
9510
- for (let r of i || []) {
9511
- const s = this.controller.recordNameToSideEffects.get(r.recordName);
9512
- if (s) {
9513
- t.sideEffects || (t.sideEffects = {});
9514
- for (let a of s)
9515
- try {
9516
- if (a instanceof j)
9517
- t.sideEffects[a.name] = {
9518
- result: await a.content(r)
9519
- };
9520
- else {
9521
- const o = a;
9522
- o.name && typeof o.content == "function" && (t.sideEffects[o.name] = {
9523
- result: await o.content(r)
9524
- });
9525
- }
9526
- } catch (o) {
9527
- let n = "unknown";
9528
- a instanceof j ? n = a.name : n = a.name || "unknown", e.error({ label: "recordMutationSideEffect", message: n }), t.sideEffects[n] = {
9529
- error: o
9530
- };
9531
- }
9532
- }
9533
- }
9534
- }
9535
9508
  async createActivity(t) {
9536
- return this.controller.system.storage.create(gt, {
9509
+ return this.controller.system.storage.create(yt, {
9537
9510
  ...t,
9538
9511
  state: t.state,
9539
9512
  refs: t.refs
@@ -9543,10 +9516,10 @@ class Gi {
9543
9516
  const i = {
9544
9517
  ...e
9545
9518
  };
9546
- return delete i.state, delete i.refs, e.state && (i.state = e.state), e.refs && (i.refs = e.refs), this.controller.system.storage.update(gt, t, i);
9519
+ return delete i.state, delete i.refs, e.state && (i.state = e.state), e.refs && (i.refs = e.refs), this.controller.system.storage.update(yt, t, i);
9547
9520
  }
9548
9521
  async getActivity(t) {
9549
- return (await this.controller.system.storage.find(gt, t, void 0, ["*"])).map((e) => ({
9522
+ return (await this.controller.system.storage.find(yt, t, void 0, ["*"])).map((e) => ({
9550
9523
  ...e,
9551
9524
  state: e.state,
9552
9525
  refs: e.refs
@@ -9582,12 +9555,12 @@ function le(u) {
9582
9555
  t?.effects && t.effects.push(...u);
9583
9556
  }
9584
9557
  const Tr = "User";
9585
- class j {
9558
+ class Nt {
9586
9559
  constructor(t) {
9587
9560
  this.name = t.name, this.record = t.record, this.content = t.content;
9588
9561
  }
9589
9562
  static create(t) {
9590
- return new j(t);
9563
+ return new Nt(t);
9591
9564
  }
9592
9565
  }
9593
9566
  const Ot = "_isDeleted_", Ar = {
@@ -9651,7 +9624,7 @@ class Sr {
9651
9624
  }
9652
9625
  }
9653
9626
  async applyResult(t, e, i) {
9654
- if (!(e instanceof wt)) {
9627
+ if (!(e instanceof Rt)) {
9655
9628
  if (t.type === "global")
9656
9629
  return this.system.storage.dict.set(t.id.name, e);
9657
9630
  if (t.type === "entity") {
@@ -9675,7 +9648,7 @@ class Sr {
9675
9648
  }
9676
9649
  }
9677
9650
  async applyResultPatch(t, e, i) {
9678
- if (e instanceof wt || e === void 0) return;
9651
+ if (e instanceof Rt || e === void 0) return;
9679
9652
  const r = Array.isArray(e) ? e : [e];
9680
9653
  for (const s of r) {
9681
9654
  if (t.type === "global")
@@ -9705,7 +9678,7 @@ class Sr {
9705
9678
  return await this.runRecordChangeSideEffects(a, this.system.logger), a;
9706
9679
  } catch (s) {
9707
9680
  const a = !!i;
9708
- throw new Y(
9681
+ throw new z(
9709
9682
  a ? "Failed to call activity interaction" : "Failed to call interaction",
9710
9683
  {
9711
9684
  interactionName: t,
@@ -9725,9 +9698,9 @@ class Sr {
9725
9698
  if (s)
9726
9699
  for (let a of s)
9727
9700
  try {
9728
- if (a instanceof j)
9701
+ if (a instanceof Nt)
9729
9702
  t.sideEffects[a.name] = {
9730
- result: await a.content(r)
9703
+ result: await a.content.call(this, r)
9731
9704
  };
9732
9705
  else {
9733
9706
  const o = a;
@@ -9737,7 +9710,7 @@ class Sr {
9737
9710
  }
9738
9711
  } catch (o) {
9739
9712
  let n = "unknown";
9740
- a instanceof j ? n = a.name : n = a.name || "unknown", e.error({ label: "recordMutationSideEffect", message: n }), t.sideEffects[n] = {
9713
+ a instanceof Nt ? n = a.name : n = a.name || "unknown", e.error({ label: "recordMutationSideEffect", message: n }), t.sideEffects[n] = {
9741
9714
  error: o
9742
9715
  };
9743
9716
  }
@@ -9778,12 +9751,12 @@ class Zi {
9778
9751
  }
9779
9752
  // CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
9780
9753
  async get(t, e, i) {
9781
- const r = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(z, r, void 0, ["value"]))?.value;
9754
+ const r = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(X, r, void 0, ["value"]))?.value;
9782
9755
  return s === void 0 ? i : Yi(s);
9783
9756
  }
9784
9757
  async set(t, e, i, r) {
9785
9758
  const s = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
9786
- return await this.queryHandle.findOne(z, s, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [z, s, { concept: t, key: e.toString(), value: zi(i) }], r) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [z, { concept: t, key: e.toString(), value: encodeURI(JSON.stringify(i)) }], r);
9759
+ return await this.queryHandle.findOne(X, s, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [X, s, { concept: t, key: e.toString(), value: zi(i) }], r) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [X, { concept: t, key: e.toString(), value: encodeURI(JSON.stringify(i)) }], r);
9787
9760
  }
9788
9761
  async setup(t, e, i = !1) {
9789
9762
  await this.db.open(i);
@@ -9926,41 +9899,41 @@ class Cr {
9926
9899
  }
9927
9900
  }
9928
9901
  export {
9929
- gt as ACTIVITY_RECORD,
9902
+ yt as ACTIVITY_RECORD,
9930
9903
  qe as ALL_ATTR_SYMBOL,
9931
9904
  It as ASYNC_TASK_RECORD,
9932
9905
  kt as Action,
9933
9906
  qt as Activity,
9934
- Z as ActivityCall,
9935
- tt as ActivityGroup,
9907
+ Y as ActivityCall,
9908
+ Z as ActivityGroup,
9936
9909
  Ki as ActivityInteractionRelation,
9937
9910
  Gi as ActivityManager,
9938
9911
  Ae as ActivityStateEntity,
9939
- dt as Any,
9912
+ ut as Any,
9940
9913
  ki as AnyHandles,
9941
9914
  B as AttributeInfo,
9942
9915
  x as AttributeQuery,
9943
- U as Attributive,
9916
+ j as Attributive,
9944
9917
  vt as Attributives,
9945
- lt as Average,
9918
+ ct as Average,
9946
9919
  Vi as AverageHandles,
9947
9920
  ur as BaseKlass,
9948
- rt as BoolAtomData,
9921
+ it as BoolAtomData,
9949
9922
  R as BoolExp,
9950
- st as BoolExpressionData,
9923
+ rt as BoolExpressionData,
9951
9924
  W as ComputationDataDepError,
9952
9925
  F as ComputationError,
9953
9926
  S as ComputationResult,
9954
9927
  we as ComputationResultAsync,
9955
9928
  Re as ComputationResultFullRecompute,
9956
9929
  Ne as ComputationResultResolved,
9957
- wt as ComputationResultSkip,
9930
+ Rt as ComputationResultSkip,
9958
9931
  oe as ComputationStateError,
9959
9932
  _t as Condition,
9960
9933
  D as ConditionError,
9961
9934
  At as Conditions,
9962
9935
  Sr as Controller,
9963
- nt as Count,
9936
+ ot as Count,
9964
9937
  Si as CountHandles,
9965
9938
  Gt as Custom,
9966
9939
  Bi as CustomHandles,
@@ -9979,10 +9952,10 @@ export {
9979
9952
  Ue as EntityToTableMap,
9980
9953
  Xt as Equation,
9981
9954
  Wt as Event,
9982
- ut as Every,
9955
+ lt as Every,
9983
9956
  wi as EveryHandles,
9984
9957
  M as Expression,
9985
- et as Gateway,
9958
+ tt as Gateway,
9986
9959
  Ve as GetAction,
9987
9960
  Ni as GlobalAnyHandle,
9988
9961
  Oi as GlobalAverageHandle,
@@ -9998,13 +9971,13 @@ export {
9998
9971
  Ar as HardDeletionProperty,
9999
9972
  re as ID_ATTR,
10000
9973
  Dt as INTERACTION_RECORD,
10001
- Nt as Inequality,
9974
+ wt as Inequality,
10002
9975
  Lt as Interaction,
10003
9976
  ke as InteractionCall,
10004
9977
  Te as InteractionEventEntity,
10005
9978
  Ft as KlassByName,
10006
9979
  f as LINK_SYMBOL,
10007
- Rt as LinkInfo,
9980
+ bt as LinkInfo,
10008
9981
  m as MatchExp,
10009
9982
  Le as Modifier,
10010
9983
  Cr as MonoSystem,
@@ -10031,27 +10004,27 @@ export {
10031
10004
  me as QueryItem,
10032
10005
  be as ROOT_LABEL,
10033
10006
  se as ROW_ID_ATTR,
10034
- ht as RealTime,
10007
+ dt as RealTime,
10035
10008
  Mi as RealTimeHandles,
10036
10009
  E as RecordBoundState,
10037
- it as RecordInfo,
10038
- j as RecordMutationSideEffect,
10010
+ et as RecordInfo,
10011
+ Nt as RecordMutationSideEffect,
10039
10012
  I as RecordQuery,
10040
10013
  He as RecordQueryAgent,
10041
10014
  L as RecordQueryTree,
10042
10015
  Ei as RecordsTransformHandle,
10043
- bt as RecursiveContext,
10016
+ gt as RecursiveContext,
10044
10017
  ge as RefContainer,
10045
10018
  P as Relation,
10046
10019
  qi as RelationCustomHandle,
10047
- z as SYSTEM_RECORD,
10020
+ X as SYSTEM_RECORD,
10048
10021
  Wi as Scheduler,
10049
10022
  Ut as SideEffect,
10050
- at as StateMachine,
10023
+ st as StateMachine,
10051
10024
  fi as StateMachineHandles,
10052
- K as StateNode,
10025
+ U as StateNode,
10053
10026
  Jt as StateTransfer,
10054
- ct as Summation,
10027
+ nt as Summation,
10055
10028
  Di as SummationHandles,
10056
10029
  Zt as SystemConsoleLogger,
10057
10030
  ni as SystemEntity,
@@ -10060,7 +10033,7 @@ export {
10060
10033
  Tt as Transform,
10061
10034
  Ci as TransformHandles,
10062
10035
  Tr as USER_ENTITY,
10063
- ot as WeightedSummation,
10036
+ at as WeightedSummation,
10064
10037
  gi as WeightedSummationHandles,
10065
10038
  le as addToCurrentEffects,
10066
10039
  T as assert,
@@ -10073,7 +10046,7 @@ export {
10073
10046
  cr as createInstancesFromString,
10074
10047
  mr as createUserRoleAttributive,
10075
10048
  Er as dbConsoleLogger,
10076
- mt as deepClone,
10049
+ ft as deepClone,
10077
10050
  wr as everyAsync,
10078
10051
  di as everyWithErrorAsync,
10079
10052
  br as filterMap,