interaqt 0.6.1 → 0.6.2
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/agent/agentspace/knowledge/generator/api-reference.md +14 -9
- package/agent/agentspace/knowledge/generator/test-implementation.md +18 -6
- package/agent/agentspace/knowledge/usage/05-interactions.md +5 -5
- package/agent/agentspace/knowledge/usage/13-testing.md +5 -5
- package/agent/agentspace/knowledge/usage/14-api-reference.md +16 -8
- package/agent/agentspace/prompt/requirement_analysis_refactor.md +34 -0
- package/dist/index.js +219 -239
- package/dist/index.js.map +1 -1
- package/dist/runtime/Controller.d.ts +3 -4
- package/dist/runtime/Controller.d.ts.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -35,13 +35,13 @@ function ar(...u) {
|
|
|
35
35
|
}
|
|
36
36
|
function or() {
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const Ft = /* @__PURE__ */ new Map();
|
|
39
39
|
function xe(u, t) {
|
|
40
|
-
t && t.isKlass && t.displayName &&
|
|
40
|
+
t && t.isKlass && t.displayName && Ft.set(u, t);
|
|
41
41
|
}
|
|
42
42
|
function nr() {
|
|
43
43
|
const u = [];
|
|
44
|
-
return Array.from(
|
|
44
|
+
return Array.from(Ft.entries()).forEach(([, t]) => {
|
|
45
45
|
t.instances && Array.isArray(t.instances) && t.stringify && u.push(...t.instances.map((e) => t.stringify(e)));
|
|
46
46
|
}), `[${u.join(",")}]`;
|
|
47
47
|
}
|
|
@@ -52,7 +52,7 @@ function cr(u) {
|
|
|
52
52
|
function Ie(u) {
|
|
53
53
|
const t = /* @__PURE__ */ new Map();
|
|
54
54
|
return u.forEach(({ type: e, options: i = {}, uuid: r, public: s }) => {
|
|
55
|
-
const a =
|
|
55
|
+
const a = Ft.get(e);
|
|
56
56
|
if (!a) {
|
|
57
57
|
console.warn(`Class ${e} not found in KlassByName`);
|
|
58
58
|
return;
|
|
@@ -192,9 +192,9 @@ class C {
|
|
|
192
192
|
return this.create(e.public, e.options);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
var
|
|
195
|
+
var Vt = /* @__PURE__ */ ((u) => (u.String = "string", u.Number = "number", u.Boolean = "boolean", u.Timestamp = "timestamp", u))(Vt || {});
|
|
196
196
|
const $e = /^[a-zA-Z0-9_]+$/;
|
|
197
|
-
class
|
|
197
|
+
class Qt {
|
|
198
198
|
constructor(t, e) {
|
|
199
199
|
this._type = "Dictionary", this._options = e, this.uuid = k(e), this.name = t.name, this.type = t.type, this.collection = t.collection ?? !1, this.args = t.args, this.defaultValue = t.defaultValue, this.computation = t.computation;
|
|
200
200
|
}
|
|
@@ -222,7 +222,7 @@ class Lt {
|
|
|
222
222
|
type: "string",
|
|
223
223
|
required: !0,
|
|
224
224
|
collection: !1,
|
|
225
|
-
options: Array.from(Object.values(
|
|
225
|
+
options: Array.from(Object.values(Vt))
|
|
226
226
|
},
|
|
227
227
|
collection: {
|
|
228
228
|
type: "boolean",
|
|
@@ -248,7 +248,7 @@ class Lt {
|
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
static create(t, e) {
|
|
251
|
-
const i = new
|
|
251
|
+
const i = new Qt(t, e);
|
|
252
252
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
253
253
|
throw new Error(`duplicate uuid in options ${i.uuid}, Dictionary`);
|
|
254
254
|
return this.instances.push(i), i;
|
|
@@ -314,7 +314,7 @@ class v {
|
|
|
314
314
|
type: {
|
|
315
315
|
type: "string",
|
|
316
316
|
required: !0,
|
|
317
|
-
options: () => Object.values(
|
|
317
|
+
options: () => Object.values(Vt)
|
|
318
318
|
},
|
|
319
319
|
collection: {
|
|
320
320
|
type: "boolean",
|
|
@@ -553,7 +553,7 @@ class P {
|
|
|
553
553
|
return this.create(e.public, e.options);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
class
|
|
556
|
+
class Lt {
|
|
557
557
|
constructor(t, e) {
|
|
558
558
|
this._type = "Interaction", this._options = e, this.uuid = k(e), this.name = t.name, this.conditions = t.conditions, this.userAttributives = t.userAttributives, this.userRef = t.userRef, this.action = t.action, this.payload = t.payload, this.sideEffects = t.sideEffects || [], this.data = t.data, this.query = t.query;
|
|
559
559
|
}
|
|
@@ -614,7 +614,7 @@ class qt {
|
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
616
|
static create(t, e) {
|
|
617
|
-
const i = new
|
|
617
|
+
const i = new Lt(t, e);
|
|
618
618
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
619
619
|
throw new Error(`duplicate uuid in options ${i.uuid}, Interaction`);
|
|
620
620
|
return this.instances.push(i), i;
|
|
@@ -651,7 +651,7 @@ class qt {
|
|
|
651
651
|
return this.create(e.public, e.options);
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
class
|
|
654
|
+
class qt {
|
|
655
655
|
constructor(t, e) {
|
|
656
656
|
this._type = "Activity", this._options = e, this.uuid = k(e), this.name = t.name, this.interactions = t.interactions || [], this.gateways = t.gateways || [], this.transfers = t.transfers || [], this.groups = t.groups || [], this.events = t.events || [];
|
|
657
657
|
}
|
|
@@ -699,7 +699,7 @@ class Bt {
|
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
701
|
static create(t, e) {
|
|
702
|
-
const i = new
|
|
702
|
+
const i = new qt(t, e);
|
|
703
703
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
704
704
|
throw new Error(`duplicate uuid in options ${i.uuid}, Activity`);
|
|
705
705
|
return this.instances.push(i), i;
|
|
@@ -1206,7 +1206,7 @@ function pr(u, t = [], e = Fe) {
|
|
|
1206
1206
|
yt(r.body[0].expression, i, e)
|
|
1207
1207
|
);
|
|
1208
1208
|
}
|
|
1209
|
-
class
|
|
1209
|
+
class U {
|
|
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 K {
|
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
1240
|
static create(t, e) {
|
|
1241
|
-
const i = new
|
|
1241
|
+
const i = new U(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;
|
|
@@ -1274,7 +1274,7 @@ class K {
|
|
|
1274
1274
|
return i.content && typeof i.content == "string" && i.content.startsWith("func::") && (i.content = new Function("return " + i.content.substring(6))()), this.create(i, e.options);
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
class
|
|
1277
|
+
class vt {
|
|
1278
1278
|
constructor(t, e) {
|
|
1279
1279
|
this._type = "Attributives", this._options = e, this.uuid = k(e), this.content = t.content;
|
|
1280
1280
|
}
|
|
@@ -1297,7 +1297,7 @@ class kt {
|
|
|
1297
1297
|
};
|
|
1298
1298
|
}
|
|
1299
1299
|
static create(t, e) {
|
|
1300
|
-
const i = new
|
|
1300
|
+
const i = new vt(t, e);
|
|
1301
1301
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1302
1302
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributives`);
|
|
1303
1303
|
return this.instances.push(i), i;
|
|
@@ -1328,7 +1328,7 @@ class kt {
|
|
|
1328
1328
|
return this.create(e.public, e.options);
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function Mt(u) {
|
|
1332
1332
|
if (!u) return;
|
|
1333
1333
|
if (u.raw.type === "atom")
|
|
1334
1334
|
return rt.create({
|
|
@@ -1339,13 +1339,13 @@ function Pt(u) {
|
|
|
1339
1339
|
return st.create({
|
|
1340
1340
|
type: "expression",
|
|
1341
1341
|
operator: t.operator,
|
|
1342
|
-
left:
|
|
1343
|
-
right:
|
|
1342
|
+
left: Mt(u.left),
|
|
1343
|
+
right: Mt(u.right)
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
1346
|
function fr(u) {
|
|
1347
|
-
return
|
|
1348
|
-
content:
|
|
1347
|
+
return vt.create({
|
|
1348
|
+
content: Mt(u)
|
|
1349
1349
|
});
|
|
1350
1350
|
}
|
|
1351
1351
|
class _t {
|
|
@@ -1408,7 +1408,7 @@ class _t {
|
|
|
1408
1408
|
return i.content && typeof i.content == "string" && i.content.startsWith("func::") && (i.content = new Function("return " + i.content.substring(6))()), this.create(i, e.options);
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
class
|
|
1411
|
+
class Bt {
|
|
1412
1412
|
constructor(t, e) {
|
|
1413
1413
|
this._type = "DataAttributive", this._options = e, this.uuid = k(e), this.content = t.content, this.name = t.name;
|
|
1414
1414
|
}
|
|
@@ -1434,7 +1434,7 @@ class Wt {
|
|
|
1434
1434
|
};
|
|
1435
1435
|
}
|
|
1436
1436
|
static create(t, e) {
|
|
1437
|
-
const i = new
|
|
1437
|
+
const i = new Bt(t, e);
|
|
1438
1438
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1439
1439
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributive`);
|
|
1440
1440
|
return this.instances.push(i), i;
|
|
@@ -1585,7 +1585,7 @@ class ye {
|
|
|
1585
1585
|
return this.create(e.public, e.options);
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
|
-
class
|
|
1588
|
+
class kt {
|
|
1589
1589
|
constructor(t, e) {
|
|
1590
1590
|
this._type = "Action", this._options = e, this.uuid = k(e), this.name = t.name;
|
|
1591
1591
|
}
|
|
@@ -1607,7 +1607,7 @@ class Tt {
|
|
|
1607
1607
|
};
|
|
1608
1608
|
}
|
|
1609
1609
|
static create(t, e) {
|
|
1610
|
-
const i = new
|
|
1610
|
+
const i = new kt(t, e);
|
|
1611
1611
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1612
1612
|
throw new Error(`duplicate uuid in options ${i.uuid}, Action`);
|
|
1613
1613
|
return this.instances.push(i), i;
|
|
@@ -1639,7 +1639,7 @@ class Tt {
|
|
|
1639
1639
|
return this.create(e.public, e.options);
|
|
1640
1640
|
}
|
|
1641
1641
|
}
|
|
1642
|
-
const Ve =
|
|
1642
|
+
const Ve = kt.create({ name: "get" });
|
|
1643
1643
|
class et {
|
|
1644
1644
|
constructor(t, e) {
|
|
1645
1645
|
this._type = "Gateway", this._options = e, this.uuid = k(e), this.name = t.name;
|
|
@@ -1694,7 +1694,7 @@ class et {
|
|
|
1694
1694
|
return this.create(e.public, e.options);
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
|
-
class
|
|
1697
|
+
class Wt {
|
|
1698
1698
|
constructor(t, e) {
|
|
1699
1699
|
this._type = "Event", this._options = e, this.uuid = k(e), this.name = t.name;
|
|
1700
1700
|
}
|
|
@@ -1716,7 +1716,7 @@ class Jt {
|
|
|
1716
1716
|
};
|
|
1717
1717
|
}
|
|
1718
1718
|
static create(t, e) {
|
|
1719
|
-
const i = new
|
|
1719
|
+
const i = new Wt(t, e);
|
|
1720
1720
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1721
1721
|
throw new Error(`duplicate uuid in options ${i.uuid}, Event`);
|
|
1722
1722
|
return this.instances.push(i), i;
|
|
@@ -1748,7 +1748,7 @@ class Jt {
|
|
|
1748
1748
|
return this.create(e.public, e.options);
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
|
-
class
|
|
1751
|
+
class K {
|
|
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 G {
|
|
|
1776
1776
|
};
|
|
1777
1777
|
}
|
|
1778
1778
|
static create(t, e) {
|
|
1779
|
-
const i = new
|
|
1779
|
+
const i = new K(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;
|
|
@@ -1811,7 +1811,7 @@ class G {
|
|
|
1811
1811
|
return this.create(e.public, e.options);
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
|
-
class
|
|
1814
|
+
class Jt {
|
|
1815
1815
|
constructor(t, e) {
|
|
1816
1816
|
this._type = "StateTransfer", this._options = e, this.uuid = k(e), this.trigger = t.trigger, this.current = t.current, this.next = t.next, this.computeTarget = t.computeTarget;
|
|
1817
1817
|
}
|
|
@@ -1849,7 +1849,7 @@ class Ht {
|
|
|
1849
1849
|
};
|
|
1850
1850
|
}
|
|
1851
1851
|
static create(t, e) {
|
|
1852
|
-
const i = new
|
|
1852
|
+
const i = new Jt(t, e);
|
|
1853
1853
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1854
1854
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateTransfer`);
|
|
1855
1855
|
return this.instances.push(i), i;
|
|
@@ -2442,7 +2442,7 @@ class dt {
|
|
|
2442
2442
|
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);
|
|
2443
2443
|
}
|
|
2444
2444
|
}
|
|
2445
|
-
class
|
|
2445
|
+
class Tt {
|
|
2446
2446
|
constructor(t, e) {
|
|
2447
2447
|
this._type = "Transform", this._options = e, this.uuid = k(e), this.record = t.record, this.eventDeps = t.eventDeps, this.attributeQuery = t.attributeQuery, this.callback = t.callback;
|
|
2448
2448
|
}
|
|
@@ -2475,7 +2475,7 @@ class At {
|
|
|
2475
2475
|
};
|
|
2476
2476
|
}
|
|
2477
2477
|
static create(t, e) {
|
|
2478
|
-
const i = new
|
|
2478
|
+
const i = new Tt(t, e);
|
|
2479
2479
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2480
2480
|
throw new Error(`duplicate uuid in options ${i.uuid}, Transform`);
|
|
2481
2481
|
return this.instances.push(i), i;
|
|
@@ -2585,7 +2585,7 @@ class ht {
|
|
|
2585
2585
|
return typeof i.callback == "string" && i.callback.startsWith("func::") && (i.callback = new Function("return " + i.callback.substring(6))()), typeof i.nextRecomputeTime == "string" && i.nextRecomputeTime.startsWith("func::") && (i.nextRecomputeTime = new Function("return " + i.nextRecomputeTime.substring(6))()), this.create(i, e.options);
|
|
2586
2586
|
}
|
|
2587
2587
|
}
|
|
2588
|
-
class
|
|
2588
|
+
class Ht {
|
|
2589
2589
|
constructor(t, e) {
|
|
2590
2590
|
this._type = "PayloadItem", this._options = e, this.uuid = k(e), this.name = t.name, this.base = t.base, this.type = t.type, this.isRef = t.isRef ?? !1, this.required = t.required ?? !1, this.isCollection = t.isCollection ?? !1, this.itemRef = t.itemRef;
|
|
2591
2591
|
}
|
|
@@ -2636,7 +2636,7 @@ class jt {
|
|
|
2636
2636
|
};
|
|
2637
2637
|
}
|
|
2638
2638
|
static create(t, e) {
|
|
2639
|
-
const i = new
|
|
2639
|
+
const i = new Ht(t, e);
|
|
2640
2640
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2641
2641
|
throw new Error(`duplicate uuid in options ${i.uuid}, PayloadItem`);
|
|
2642
2642
|
return this.instances.push(i), i;
|
|
@@ -2675,7 +2675,7 @@ class jt {
|
|
|
2675
2675
|
return this.create(e.public, e.options);
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
2678
|
-
class
|
|
2678
|
+
class jt {
|
|
2679
2679
|
constructor(t, e) {
|
|
2680
2680
|
this._type = "Payload", this._options = e, this.uuid = k(e), this.items = t.items || [];
|
|
2681
2681
|
}
|
|
@@ -2699,7 +2699,7 @@ class Ut {
|
|
|
2699
2699
|
};
|
|
2700
2700
|
}
|
|
2701
2701
|
static create(t, e) {
|
|
2702
|
-
const i = new
|
|
2702
|
+
const i = new jt(t, e);
|
|
2703
2703
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2704
2704
|
throw new Error(`duplicate uuid in options ${i.uuid}, Payload`);
|
|
2705
2705
|
return this.instances.push(i), i;
|
|
@@ -2731,7 +2731,7 @@ class Ut {
|
|
|
2731
2731
|
return this.create(e.public, e.options);
|
|
2732
2732
|
}
|
|
2733
2733
|
}
|
|
2734
|
-
class
|
|
2734
|
+
class Ut {
|
|
2735
2735
|
constructor(t, e) {
|
|
2736
2736
|
this._type = "SideEffect", this._options = e, this.uuid = k(e), this.name = t.name, this.handle = t.handle;
|
|
2737
2737
|
}
|
|
@@ -2759,7 +2759,7 @@ class Kt {
|
|
|
2759
2759
|
};
|
|
2760
2760
|
}
|
|
2761
2761
|
static create(t, e) {
|
|
2762
|
-
const i = new
|
|
2762
|
+
const i = new Ut(t, e);
|
|
2763
2763
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2764
2764
|
throw new Error(`duplicate uuid in options ${i.uuid}, SideEffect`);
|
|
2765
2765
|
return this.instances.push(i), i;
|
|
@@ -2793,7 +2793,7 @@ class Kt {
|
|
|
2793
2793
|
return i.handle && typeof i.handle == "string" && i.handle.startsWith("func::") && (i.handle = new Function("return " + i.handle.substring(6))()), this.create(i, e.options);
|
|
2794
2794
|
}
|
|
2795
2795
|
}
|
|
2796
|
-
function
|
|
2796
|
+
function Pt(u) {
|
|
2797
2797
|
if (!u) return;
|
|
2798
2798
|
if (u.raw.type === "atom")
|
|
2799
2799
|
return rt.create({
|
|
@@ -2804,13 +2804,13 @@ function $t(u) {
|
|
|
2804
2804
|
return st.create({
|
|
2805
2805
|
type: "expression",
|
|
2806
2806
|
operator: t.operator,
|
|
2807
|
-
left:
|
|
2808
|
-
right:
|
|
2807
|
+
left: Pt(u.left),
|
|
2808
|
+
right: Pt(u.right)
|
|
2809
2809
|
});
|
|
2810
2810
|
}
|
|
2811
|
-
class
|
|
2811
|
+
class At {
|
|
2812
2812
|
constructor(t, e) {
|
|
2813
|
-
this._type = "Conditions", this._options = e, this.uuid = k(e), t.content && t.content instanceof R ? this.content =
|
|
2813
|
+
this._type = "Conditions", this._options = e, this.uuid = k(e), t.content && t.content instanceof R ? this.content = Pt(t.content) : this.content = t.content;
|
|
2814
2814
|
}
|
|
2815
2815
|
static {
|
|
2816
2816
|
this.isKlass = !0;
|
|
@@ -2831,7 +2831,7 @@ class St {
|
|
|
2831
2831
|
};
|
|
2832
2832
|
}
|
|
2833
2833
|
static create(t, e) {
|
|
2834
|
-
const i = new
|
|
2834
|
+
const i = new At(t, e);
|
|
2835
2835
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2836
2836
|
throw new Error(`duplicate uuid in options ${i.uuid}, Conditions`);
|
|
2837
2837
|
return this.instances.push(i), i;
|
|
@@ -2862,7 +2862,7 @@ class St {
|
|
|
2862
2862
|
return this.create(e.public, e.options);
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
|
-
class
|
|
2865
|
+
class Kt {
|
|
2866
2866
|
constructor(t, e) {
|
|
2867
2867
|
this._type = "DataAttributives", this._options = e, this.uuid = k(e), this.content = t.content;
|
|
2868
2868
|
}
|
|
@@ -2885,7 +2885,7 @@ class Gt {
|
|
|
2885
2885
|
};
|
|
2886
2886
|
}
|
|
2887
2887
|
static create(t, e) {
|
|
2888
|
-
const i = new
|
|
2888
|
+
const i = new Kt(t, e);
|
|
2889
2889
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2890
2890
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributives`);
|
|
2891
2891
|
return this.instances.push(i), i;
|
|
@@ -2920,16 +2920,16 @@ const Qe = [
|
|
|
2920
2920
|
C,
|
|
2921
2921
|
P,
|
|
2922
2922
|
v,
|
|
2923
|
+
Lt,
|
|
2923
2924
|
qt,
|
|
2924
|
-
|
|
2925
|
-
K,
|
|
2925
|
+
U,
|
|
2926
2926
|
_t,
|
|
2927
|
-
|
|
2928
|
-
|
|
2927
|
+
Bt,
|
|
2928
|
+
kt,
|
|
2929
2929
|
et,
|
|
2930
|
+
Wt,
|
|
2931
|
+
K,
|
|
2930
2932
|
Jt,
|
|
2931
|
-
G,
|
|
2932
|
-
Ht,
|
|
2933
2933
|
at,
|
|
2934
2934
|
ot,
|
|
2935
2935
|
nt,
|
|
@@ -2937,21 +2937,21 @@ const Qe = [
|
|
|
2937
2937
|
lt,
|
|
2938
2938
|
ut,
|
|
2939
2939
|
dt,
|
|
2940
|
-
|
|
2940
|
+
Tt,
|
|
2941
2941
|
ht,
|
|
2942
|
+
Ht,
|
|
2942
2943
|
jt,
|
|
2943
2944
|
Ut,
|
|
2944
|
-
|
|
2945
|
-
Lt,
|
|
2945
|
+
Qt,
|
|
2946
2946
|
rt,
|
|
2947
2947
|
st,
|
|
2948
|
-
|
|
2949
|
-
|
|
2948
|
+
At,
|
|
2949
|
+
Kt
|
|
2950
2950
|
];
|
|
2951
2951
|
Qe.forEach((u) => {
|
|
2952
2952
|
u && u.displayName && xe(u.displayName, u);
|
|
2953
2953
|
});
|
|
2954
|
-
class
|
|
2954
|
+
class Gt {
|
|
2955
2955
|
constructor(t, e) {
|
|
2956
2956
|
this._type = "Custom", this._options = e, this.uuid = k(e), this.name = t.name, this.dataDeps = t.dataDeps, this.compute = t.compute, this.incrementalCompute = t.incrementalCompute, this.incrementalPatchCompute = t.incrementalPatchCompute, this.createState = t.createState, this.getDefaultValue = t.getDefaultValue, this.asyncReturn = t.asyncReturn, this.useLastValue = t.useLastValue;
|
|
2957
2957
|
}
|
|
@@ -3014,7 +3014,7 @@ class Xt {
|
|
|
3014
3014
|
};
|
|
3015
3015
|
}
|
|
3016
3016
|
static create(t, e) {
|
|
3017
|
-
const i = new
|
|
3017
|
+
const i = new Gt(t, e);
|
|
3018
3018
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
3019
3019
|
throw new Error(`duplicate uuid in options ${i.uuid}, Custom`);
|
|
3020
3020
|
return this.instances.push(i), i;
|
|
@@ -3270,7 +3270,7 @@ class ge {
|
|
|
3270
3270
|
}
|
|
3271
3271
|
}
|
|
3272
3272
|
function mr({ name: u, isRef: t = !1 }, e) {
|
|
3273
|
-
return
|
|
3273
|
+
return U.create({
|
|
3274
3274
|
name: u,
|
|
3275
3275
|
content: u ? new Function("user", `return user.roles.includes('${u}')`) : function() {
|
|
3276
3276
|
return !0;
|
|
@@ -3282,7 +3282,7 @@ function g(u, t) {
|
|
|
3282
3282
|
if (!u)
|
|
3283
3283
|
throw new Error(t);
|
|
3284
3284
|
}
|
|
3285
|
-
function
|
|
3285
|
+
function Et(u, t, e) {
|
|
3286
3286
|
const i = [...t];
|
|
3287
3287
|
let r = u, s;
|
|
3288
3288
|
const a = i.pop();
|
|
@@ -3290,7 +3290,7 @@ function Ct(u, t, e) {
|
|
|
3290
3290
|
r[s] || (r[s] = {}), r = r[s];
|
|
3291
3291
|
return r[a] = e, !0;
|
|
3292
3292
|
}
|
|
3293
|
-
class
|
|
3293
|
+
class B {
|
|
3294
3294
|
constructor(t, e, i, r) {
|
|
3295
3295
|
this.parentEntityName = t, this.attributeName = e, this.map = i, this.symmetricDirection = r, this.data = this.map.getAttributeData(t, e), g(!!this.data, `${t} has no attribute: ${e}`);
|
|
3296
3296
|
}
|
|
@@ -3417,7 +3417,7 @@ class _ {
|
|
|
3417
3417
|
return g(this.isLinkFiltered(), "only filtered relation can get match expression"), this.data.matchExpression;
|
|
3418
3418
|
}
|
|
3419
3419
|
getBaseAttributeInfo() {
|
|
3420
|
-
return g(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new
|
|
3420
|
+
return g(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new B(this.parentEntityName, this.data.baseRelationAttributeName, this.map, this.symmetricDirection);
|
|
3421
3421
|
}
|
|
3422
3422
|
}
|
|
3423
3423
|
class m {
|
|
@@ -3915,7 +3915,7 @@ class x {
|
|
|
3915
3915
|
return this.parentLinkRecordQuery ? new x(this.recordName, this.map, this.data, this.parentRecord, this.attributeName, !0) : this;
|
|
3916
3916
|
}
|
|
3917
3917
|
}
|
|
3918
|
-
function
|
|
3918
|
+
function _e(u) {
|
|
3919
3919
|
const t = [];
|
|
3920
3920
|
return u.forEach((e) => t.push(...Array.isArray(e) ? e : [e])), t;
|
|
3921
3921
|
}
|
|
@@ -3925,7 +3925,7 @@ class Q {
|
|
|
3925
3925
|
const s = this.map.getRecordInfo(e);
|
|
3926
3926
|
this.recordName = s.isFilteredEntity || s.isFilteredRelation ? s.resolvedBaseRecordName : e;
|
|
3927
3927
|
const [a, o, n] = this.map.groupAttributes(this.recordName, i ? Object.keys(i) : []);
|
|
3928
|
-
this.relatedEntitiesData =
|
|
3928
|
+
this.relatedEntitiesData = _e(o.map(
|
|
3929
3929
|
(l) => Array.isArray(i[l.attributeName]) ? i[l.attributeName].map((d) => new Q(this.map, l.recordName, d, l)) : new Q(this.map, l.recordName, i[l.attributeName], l)
|
|
3930
3930
|
)), this.valueAttributes = a, this.entityIdAttributes = n;
|
|
3931
3931
|
const c = this.map.getRecordInfo(this.recordName);
|
|
@@ -4002,7 +4002,7 @@ class Q {
|
|
|
4002
4002
|
}), i;
|
|
4003
4003
|
}
|
|
4004
4004
|
}
|
|
4005
|
-
class
|
|
4005
|
+
class Be {
|
|
4006
4006
|
constructor(t, e) {
|
|
4007
4007
|
this.map = t, this.queryAgent = e, this.dependencies = /* @__PURE__ */ new Map();
|
|
4008
4008
|
}
|
|
@@ -4275,7 +4275,7 @@ class Je {
|
|
|
4275
4275
|
}
|
|
4276
4276
|
class He {
|
|
4277
4277
|
constructor(t, e) {
|
|
4278
|
-
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new
|
|
4278
|
+
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new Be(t, this), this.initializeFilteredEntityDependencies();
|
|
4279
4279
|
}
|
|
4280
4280
|
/**
|
|
4281
4281
|
* 初始化所有 filtered entity 的依赖关系
|
|
@@ -4327,7 +4327,7 @@ ${b}
|
|
|
4327
4327
|
const s = {};
|
|
4328
4328
|
return Object.entries(r).forEach(([a, o]) => {
|
|
4329
4329
|
const n = i.getPath(a).slice(1, 1 / 0);
|
|
4330
|
-
n.length === 1 && e.includes(n[0]) && typeof o == "string" && (o = JSON.parse(o)), o !== null &&
|
|
4330
|
+
n.length === 1 && e.includes(n[0]) && typeof o == "string" && (o = JSON.parse(o)), o !== null && Et(s, n, o);
|
|
4331
4331
|
}), s;
|
|
4332
4332
|
});
|
|
4333
4333
|
}
|
|
@@ -4374,7 +4374,7 @@ ${b}
|
|
|
4374
4374
|
value: ["=", b]
|
|
4375
4375
|
})
|
|
4376
4376
|
}), O = t.label ? c.concat(N) : c;
|
|
4377
|
-
|
|
4377
|
+
Et(
|
|
4378
4378
|
N,
|
|
4379
4379
|
[l.alias || l.attributeName, f, h.attributeName],
|
|
4380
4380
|
await this.findRecords(
|
|
@@ -4462,7 +4462,7 @@ ${b}
|
|
|
4462
4462
|
for (let b of N.attributeQuery.xToManyRecords)
|
|
4463
4463
|
for (let A of p) {
|
|
4464
4464
|
const O = A[f].id, te = d.label ? y.concat(A) : y;
|
|
4465
|
-
|
|
4465
|
+
Et(
|
|
4466
4466
|
A,
|
|
4467
4467
|
[f, b.attributeName],
|
|
4468
4468
|
await this.findXToManyRelatedRecords(
|
|
@@ -5222,19 +5222,19 @@ class it {
|
|
|
5222
5222
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
5223
5223
|
const e = this.data.attributes[t];
|
|
5224
5224
|
return e.isRecord && e.field;
|
|
5225
|
-
}).map((t) => new
|
|
5225
|
+
}).map((t) => new B(this.name, t, this.map));
|
|
5226
5226
|
}
|
|
5227
5227
|
get strictRecordAttributes() {
|
|
5228
5228
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
5229
5229
|
const e = this.data.attributes[t];
|
|
5230
5230
|
return e.isRecord && !e.field && !e.isFilteredRelation;
|
|
5231
|
-
}).map((t) => new
|
|
5231
|
+
}).map((t) => new B(this.name, t, this.map));
|
|
5232
5232
|
}
|
|
5233
5233
|
get differentTableRecordAttributes() {
|
|
5234
5234
|
return this.strictRecordAttributes.filter((t) => !(t.isMergedWithParent() || t.isLinkMergedWithParent()));
|
|
5235
5235
|
}
|
|
5236
5236
|
get reliance() {
|
|
5237
|
-
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new
|
|
5237
|
+
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new B(this.name, t, this.map));
|
|
5238
5238
|
}
|
|
5239
5239
|
get notRelianceCombined() {
|
|
5240
5240
|
return this.combinedRecords.filter((t) => !t.isReliance);
|
|
@@ -5246,10 +5246,10 @@ class it {
|
|
|
5246
5246
|
return this.reliance.filter((t) => t.table === this.table);
|
|
5247
5247
|
}
|
|
5248
5248
|
get valueAttributes() {
|
|
5249
|
-
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new
|
|
5249
|
+
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new B(this.name, t, this.map));
|
|
5250
5250
|
}
|
|
5251
5251
|
getAttributeInfo(t) {
|
|
5252
|
-
return new
|
|
5252
|
+
return new B(this.name, t, this.map);
|
|
5253
5253
|
}
|
|
5254
5254
|
get baseRecordName() {
|
|
5255
5255
|
return this.data.baseRecordName;
|
|
@@ -5426,7 +5426,7 @@ class Ue {
|
|
|
5426
5426
|
}
|
|
5427
5427
|
}
|
|
5428
5428
|
if (!(!s || !a))
|
|
5429
|
-
return new
|
|
5429
|
+
return new B(s, a, this, c);
|
|
5430
5430
|
}
|
|
5431
5431
|
getTableAndAliasStack(t) {
|
|
5432
5432
|
const [e, ...i] = t;
|
|
@@ -5628,7 +5628,7 @@ function ie(u, t, e, i) {
|
|
|
5628
5628
|
);
|
|
5629
5629
|
}
|
|
5630
5630
|
function ze(u, t, e, i) {
|
|
5631
|
-
const r = e === "entity", a = `__${
|
|
5631
|
+
const r = e === "entity", a = `__${G(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,
|
|
@@ -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 =
|
|
5657
|
+
const o = G(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
5661
|
const e = /* @__PURE__ */ new Map(), i = ft(u);
|
|
5662
5662
|
if (i && i.length > 0)
|
|
5663
5663
|
for (const r of i) {
|
|
5664
|
-
const s =
|
|
5664
|
+
const s = G(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);
|
|
@@ -5678,7 +5678,7 @@ function ti(u, t, e) {
|
|
|
5678
5678
|
type: "json",
|
|
5679
5679
|
defaultValue: (r, s) => {
|
|
5680
5680
|
const a = ft(t), n = (i.get(s) || []).filter(
|
|
5681
|
-
(c) => a.some((l) =>
|
|
5681
|
+
(c) => a.some((l) => G(l) === c)
|
|
5682
5682
|
);
|
|
5683
5683
|
return n.length > 0 ? n : [s];
|
|
5684
5684
|
}
|
|
@@ -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 =
|
|
5776
|
+
const d = G(l);
|
|
5777
5777
|
return {
|
|
5778
5778
|
key: t,
|
|
5779
5779
|
value: ["contains", d]
|
|
@@ -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 =
|
|
5801
|
+
const i = u, r = t, s = G(i);
|
|
5802
5802
|
return i.baseRelation ? [i, si(i)] : [P.create({
|
|
5803
5803
|
name: s,
|
|
5804
5804
|
baseRelation: r,
|
|
@@ -5826,7 +5826,7 @@ function ai(u) {
|
|
|
5826
5826
|
function ft(u) {
|
|
5827
5827
|
return pt(u) ? u.inputEntities || [] : u.inputRelations || [];
|
|
5828
5828
|
}
|
|
5829
|
-
function
|
|
5829
|
+
function G(u) {
|
|
5830
5830
|
return pt(u), u.name;
|
|
5831
5831
|
}
|
|
5832
5832
|
class oi {
|
|
@@ -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
|
|
6226
|
-
name:
|
|
6225
|
+
const z = "_System_", q = "_Dictionary_", re = "id", se = "_rowId", ni = C.create({
|
|
6226
|
+
name: z,
|
|
6227
6227
|
properties: [
|
|
6228
6228
|
v.create({
|
|
6229
6229
|
name: "concept",
|
|
@@ -6255,7 +6255,7 @@ const Y = "_System_", q = "_Dictionary_", re = "id", se = "_rowId", ni = C.creat
|
|
|
6255
6255
|
collection: !1
|
|
6256
6256
|
})
|
|
6257
6257
|
]
|
|
6258
|
-
}), yr = 0,
|
|
6258
|
+
}), yr = 0, Ct = 1, gr = 2;
|
|
6259
6259
|
class li {
|
|
6260
6260
|
constructor(t, e) {
|
|
6261
6261
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
@@ -6270,18 +6270,18 @@ class li {
|
|
|
6270
6270
|
if (this.scheduler.isDataBasedComputation(i)) {
|
|
6271
6271
|
if (Object.entries(i.dataDeps).forEach(([r, s]) => {
|
|
6272
6272
|
const a = this.convertDataDepToERMutationEventsSourceMap(r, s, i);
|
|
6273
|
-
e[s.phase ||
|
|
6273
|
+
e[s.phase || Ct].push(...a);
|
|
6274
6274
|
}), i.dataContext.type === "property" && Object.values(i.dataDeps).some((r) => r.type === "global")) {
|
|
6275
6275
|
const r = {
|
|
6276
6276
|
type: "records",
|
|
6277
6277
|
source: i.dataContext.host
|
|
6278
6278
|
};
|
|
6279
|
-
e[
|
|
6279
|
+
e[Ct].push(...this.convertDataDepToERMutationEventsSourceMap("_self", r, i, "create"));
|
|
6280
6280
|
}
|
|
6281
6281
|
} else {
|
|
6282
6282
|
const { eventDeps: r } = i;
|
|
6283
6283
|
for (const s of Object.values(r))
|
|
6284
|
-
e[s.phase ||
|
|
6284
|
+
e[s.phase || Ct].push({
|
|
6285
6285
|
type: s.type,
|
|
6286
6286
|
recordName: s.recordName,
|
|
6287
6287
|
record: s.record,
|
|
@@ -6527,7 +6527,7 @@ class E {
|
|
|
6527
6527
|
return t[this.key];
|
|
6528
6528
|
}
|
|
6529
6529
|
}
|
|
6530
|
-
class
|
|
6530
|
+
class _ {
|
|
6531
6531
|
constructor(t) {
|
|
6532
6532
|
this.defaultValue = t;
|
|
6533
6533
|
}
|
|
@@ -6538,14 +6538,14 @@ class B {
|
|
|
6538
6538
|
return await this.controller.system.storage.dict.get(this.key);
|
|
6539
6539
|
}
|
|
6540
6540
|
}
|
|
6541
|
-
function
|
|
6541
|
+
function $t(u, t) {
|
|
6542
6542
|
if (t == null || u === t) return !0;
|
|
6543
6543
|
if (typeof t != "object" || t === null)
|
|
6544
6544
|
return u === t;
|
|
6545
6545
|
if (typeof u != "object" || u === null)
|
|
6546
6546
|
return !1;
|
|
6547
6547
|
for (const e in t)
|
|
6548
|
-
if (!(e in u) ||
|
|
6548
|
+
if (!(e in u) || !$t(u[e], t[e]))
|
|
6549
6549
|
return !1;
|
|
6550
6550
|
return !0;
|
|
6551
6551
|
}
|
|
@@ -6562,13 +6562,13 @@ class ve {
|
|
|
6562
6562
|
const i = this.map[t];
|
|
6563
6563
|
if (i) {
|
|
6564
6564
|
for (const r of i)
|
|
6565
|
-
if (
|
|
6565
|
+
if ($t(e, r.trigger))
|
|
6566
6566
|
return r.next;
|
|
6567
6567
|
}
|
|
6568
6568
|
return null;
|
|
6569
6569
|
}
|
|
6570
6570
|
findTransfers(t) {
|
|
6571
|
-
return this.data.transfers.filter((e) =>
|
|
6571
|
+
return this.data.transfers.filter((e) => $t(t, e.trigger));
|
|
6572
6572
|
}
|
|
6573
6573
|
}
|
|
6574
6574
|
function T(u, t) {
|
|
@@ -6617,7 +6617,7 @@ class hi {
|
|
|
6617
6617
|
}
|
|
6618
6618
|
createState() {
|
|
6619
6619
|
return {
|
|
6620
|
-
currentState: new
|
|
6620
|
+
currentState: new _(this.defaultState.name)
|
|
6621
6621
|
};
|
|
6622
6622
|
}
|
|
6623
6623
|
// 这里的 defaultValue 不能是 async 的模式。因为是直接创建时填入的。
|
|
@@ -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 =
|
|
6680
|
+
const Nr = K.create({
|
|
6681
6681
|
name: "nonExistent",
|
|
6682
6682
|
computeValue: () => null
|
|
6683
|
-
}), vr =
|
|
6683
|
+
}), vr = K.create({
|
|
6684
6684
|
name: "nonDeleted",
|
|
6685
6685
|
computeValue: () => !1
|
|
6686
|
-
}), kr =
|
|
6686
|
+
}), kr = K.create({
|
|
6687
6687
|
name: "deleted",
|
|
6688
6688
|
computeValue: () => !0
|
|
6689
6689
|
}), fi = [hi, pi];
|
|
@@ -6836,8 +6836,8 @@ class bi {
|
|
|
6836
6836
|
}
|
|
6837
6837
|
createState() {
|
|
6838
6838
|
return {
|
|
6839
|
-
matchCount: new
|
|
6840
|
-
totalCount: new
|
|
6839
|
+
matchCount: new _(0),
|
|
6840
|
+
totalCount: new _(0),
|
|
6841
6841
|
isItemMatch: new E(!1, this.args.record.name)
|
|
6842
6842
|
};
|
|
6843
6843
|
}
|
|
@@ -6964,7 +6964,7 @@ class Ni {
|
|
|
6964
6964
|
}
|
|
6965
6965
|
createState() {
|
|
6966
6966
|
return {
|
|
6967
|
-
matchCount: new
|
|
6967
|
+
matchCount: new _(0),
|
|
6968
6968
|
isItemMatch: new E(!1, this.args.record.name)
|
|
6969
6969
|
};
|
|
6970
6970
|
}
|
|
@@ -7094,7 +7094,7 @@ class Ti {
|
|
|
7094
7094
|
}
|
|
7095
7095
|
createState() {
|
|
7096
7096
|
return {
|
|
7097
|
-
count: new
|
|
7097
|
+
count: new _(0),
|
|
7098
7098
|
isItemMatch: new E(!1, this.record.name)
|
|
7099
7099
|
};
|
|
7100
7100
|
}
|
|
@@ -7220,7 +7220,7 @@ class Ei {
|
|
|
7220
7220
|
});
|
|
7221
7221
|
}
|
|
7222
7222
|
static {
|
|
7223
|
-
this.computationType =
|
|
7223
|
+
this.computationType = Tt;
|
|
7224
7224
|
}
|
|
7225
7225
|
static {
|
|
7226
7226
|
this.contextType = ["entity", "relation"];
|
|
@@ -7421,7 +7421,7 @@ class M {
|
|
|
7421
7421
|
return new Nt(this, "<", t);
|
|
7422
7422
|
}
|
|
7423
7423
|
eq(t) {
|
|
7424
|
-
return new
|
|
7424
|
+
return new Xt(this, t);
|
|
7425
7425
|
}
|
|
7426
7426
|
getVariables() {
|
|
7427
7427
|
const t = /* @__PURE__ */ new Set();
|
|
@@ -7553,7 +7553,7 @@ class Nt {
|
|
|
7553
7553
|
}
|
|
7554
7554
|
}
|
|
7555
7555
|
}
|
|
7556
|
-
class
|
|
7556
|
+
class Xt {
|
|
7557
7557
|
constructor(t, e) {
|
|
7558
7558
|
this.left = t, this.right = e;
|
|
7559
7559
|
}
|
|
@@ -7600,8 +7600,8 @@ class xi {
|
|
|
7600
7600
|
}
|
|
7601
7601
|
createState() {
|
|
7602
7602
|
return {
|
|
7603
|
-
lastRecomputeTime: new
|
|
7604
|
-
nextRecomputeTime: new
|
|
7603
|
+
lastRecomputeTime: new _(null),
|
|
7604
|
+
nextRecomputeTime: new _(null)
|
|
7605
7605
|
};
|
|
7606
7606
|
}
|
|
7607
7607
|
getDefaultValue() {
|
|
@@ -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
|
|
7616
|
+
else if (e instanceof Nt || e instanceof Xt)
|
|
7617
7617
|
r = e.evaluate({ now: i }), s = e.solve();
|
|
7618
7618
|
else
|
|
7619
7619
|
throw new Error("Invalid result type");
|
|
@@ -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
|
|
7654
|
+
else if (i instanceof Nt || i instanceof Xt)
|
|
7655
7655
|
s = i.evaluate({ now: r }), a = i.solve();
|
|
7656
7656
|
else
|
|
7657
7657
|
throw new Error("Invalid result type");
|
|
@@ -7834,8 +7834,8 @@ class Oi {
|
|
|
7834
7834
|
}
|
|
7835
7835
|
createState() {
|
|
7836
7836
|
return {
|
|
7837
|
-
sum: new
|
|
7838
|
-
count: new
|
|
7837
|
+
sum: new _(0),
|
|
7838
|
+
count: new _(0),
|
|
7839
7839
|
itemValue: new E(0, this.record.name)
|
|
7840
7840
|
};
|
|
7841
7841
|
}
|
|
@@ -7968,7 +7968,7 @@ class Fi {
|
|
|
7968
7968
|
}
|
|
7969
7969
|
}
|
|
7970
7970
|
const Vi = [Oi, Fi];
|
|
7971
|
-
class
|
|
7971
|
+
class St {
|
|
7972
7972
|
constructor(t, e, i) {
|
|
7973
7973
|
this.controller = t, this.args = e, this.dataContext = i, this.state = {}, this.dataDeps = {}, this.useLastValue = e.useLastValue !== void 0 ? e.useLastValue : !0, e.dataDeps && (this.dataDeps = e.dataDeps), e.compute && (this.computeCallback = e.compute, this.compute = async (...r) => {
|
|
7974
7974
|
if (this.computeCallback) {
|
|
@@ -8012,7 +8012,7 @@ class Et {
|
|
|
8012
8012
|
}));
|
|
8013
8013
|
}
|
|
8014
8014
|
static {
|
|
8015
|
-
this.computationType =
|
|
8015
|
+
this.computationType = Gt;
|
|
8016
8016
|
}
|
|
8017
8017
|
createState() {
|
|
8018
8018
|
if (this.createStateCallback) {
|
|
@@ -8039,22 +8039,22 @@ class Et {
|
|
|
8039
8039
|
return S.skip();
|
|
8040
8040
|
}
|
|
8041
8041
|
}
|
|
8042
|
-
class Qi extends
|
|
8042
|
+
class Qi extends St {
|
|
8043
8043
|
static {
|
|
8044
8044
|
this.contextType = "global";
|
|
8045
8045
|
}
|
|
8046
8046
|
}
|
|
8047
|
-
class Li extends
|
|
8047
|
+
class Li extends St {
|
|
8048
8048
|
static {
|
|
8049
8049
|
this.contextType = "entity";
|
|
8050
8050
|
}
|
|
8051
8051
|
}
|
|
8052
|
-
class qi extends
|
|
8052
|
+
class qi extends St {
|
|
8053
8053
|
static {
|
|
8054
8054
|
this.contextType = "relation";
|
|
8055
8055
|
}
|
|
8056
8056
|
}
|
|
8057
|
-
class
|
|
8057
|
+
class _i extends St {
|
|
8058
8058
|
static {
|
|
8059
8059
|
this.contextType = "property";
|
|
8060
8060
|
}
|
|
@@ -8069,11 +8069,11 @@ If you want to use aggregated data from all records in the entity/relation, you
|
|
|
8069
8069
|
super(t, e, i);
|
|
8070
8070
|
}
|
|
8071
8071
|
}
|
|
8072
|
-
const
|
|
8072
|
+
const Bi = [
|
|
8073
8073
|
Qi,
|
|
8074
8074
|
Li,
|
|
8075
8075
|
qi,
|
|
8076
|
-
|
|
8076
|
+
_i
|
|
8077
8077
|
];
|
|
8078
8078
|
class J extends Error {
|
|
8079
8079
|
constructor(t, e = {}) {
|
|
@@ -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 || {}),
|
|
8196
|
-
class
|
|
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 {
|
|
8197
8197
|
constructor(t, e = {}) {
|
|
8198
8198
|
super(t, {
|
|
8199
8199
|
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
8200
8200
|
context: {
|
|
8201
|
-
category:
|
|
8201
|
+
category: X.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:
|
|
8217
|
+
category: X.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:
|
|
8233
|
+
category: X.COMPUTATION,
|
|
8234
8234
|
handleName: e.handleName,
|
|
8235
8235
|
computationName: e.computationName,
|
|
8236
8236
|
dataContext: e.dataContext,
|
|
@@ -8271,12 +8271,12 @@ class W extends F {
|
|
|
8271
8271
|
}), this.depName = e.depName, this.depType = e.depType, this.missingData = e.missingData, this.invalidData = e.invalidData;
|
|
8272
8272
|
}
|
|
8273
8273
|
}
|
|
8274
|
-
class
|
|
8274
|
+
class xt extends J {
|
|
8275
8275
|
constructor(t, e = {}) {
|
|
8276
8276
|
super(t, {
|
|
8277
8277
|
errorType: e.context?.errorType || "SchedulerError",
|
|
8278
8278
|
context: {
|
|
8279
|
-
category:
|
|
8279
|
+
category: X.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:
|
|
8293
|
+
category: X.PERMISSION,
|
|
8294
8294
|
checkType: e.checkType,
|
|
8295
8295
|
fieldName: e.fieldName,
|
|
8296
8296
|
payload: e.payload,
|
|
@@ -8358,7 +8358,7 @@ class D extends J {
|
|
|
8358
8358
|
});
|
|
8359
8359
|
}
|
|
8360
8360
|
}
|
|
8361
|
-
const
|
|
8361
|
+
const It = "_ASYNC_TASK_";
|
|
8362
8362
|
class Wi {
|
|
8363
8363
|
constructor(t, e, i, r, s) {
|
|
8364
8364
|
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new li(this.controller, this), this.buildComputationHandleMap(s);
|
|
@@ -8552,7 +8552,7 @@ class Wi {
|
|
|
8552
8552
|
const e = t;
|
|
8553
8553
|
if (e.state)
|
|
8554
8554
|
for (const i of Object.values(e.state))
|
|
8555
|
-
i instanceof
|
|
8555
|
+
i instanceof _ && (i.controller = this.controller, await this.controller.system.storage.dict.set(i.key, i.defaultValue ?? null));
|
|
8556
8556
|
}
|
|
8557
8557
|
}
|
|
8558
8558
|
addMutationComputationListeners() {
|
|
@@ -8675,7 +8675,7 @@ class Wi {
|
|
|
8675
8675
|
}
|
|
8676
8676
|
}
|
|
8677
8677
|
} catch (i) {
|
|
8678
|
-
throw i instanceof F ? i : new
|
|
8678
|
+
throw i instanceof F ? i : new xt("Unexpected error in dirty records computation", {
|
|
8679
8679
|
schedulingPhase: "dirty-records-processing",
|
|
8680
8680
|
failedComputations: [t.computation.args.constructor.displayName],
|
|
8681
8681
|
causedBy: i instanceof Error ? i : new Error(String(i))
|
|
@@ -8685,8 +8685,8 @@ class Wi {
|
|
|
8685
8685
|
getAsyncTaskRecordKey(t) {
|
|
8686
8686
|
if (t.dataContext.type === "property") {
|
|
8687
8687
|
const e = t.dataContext;
|
|
8688
|
-
return `${
|
|
8689
|
-
} else return t.dataContext.type === "global" ? `${
|
|
8688
|
+
return `${It}_${e.host.name}_${e.id.name}`;
|
|
8689
|
+
} else return t.dataContext.type === "global" ? `${It}_${t.dataContext.id.name}` : `${It}_${t.dataContext.type}_${t.dataContext.id?.name}`;
|
|
8690
8690
|
}
|
|
8691
8691
|
async createAsyncTask(t, e, i, r) {
|
|
8692
8692
|
if (t.dataContext.type === "property")
|
|
@@ -8903,7 +8903,7 @@ class Wi {
|
|
|
8903
8903
|
try {
|
|
8904
8904
|
this.addMutationPropertyComputationDefaultValueListeners(), this.addMutationComputationListeners(), t && (await this.setupGlobalBoundStateDefaultValues(), await this.setupGlobalComputationDefaultValue(), await this.setupDictDefaultValue());
|
|
8905
8905
|
} catch (e) {
|
|
8906
|
-
throw e instanceof
|
|
8906
|
+
throw e instanceof xt ? e : new xt("Unexpected error during scheduler setup", {
|
|
8907
8907
|
schedulingPhase: "top-level-setup",
|
|
8908
8908
|
causedBy: e instanceof Error ? e : new Error(String(e))
|
|
8909
8909
|
});
|
|
@@ -8938,7 +8938,7 @@ class ke {
|
|
|
8938
8938
|
async checkUser(t, e, i) {
|
|
8939
8939
|
let r;
|
|
8940
8940
|
if (!this.interaction.userAttributives) return !0;
|
|
8941
|
-
const s =
|
|
8941
|
+
const s = vt.is(this.interaction.userAttributives) ? R.fromValue(
|
|
8942
8942
|
this.interaction.userAttributives.content
|
|
8943
8943
|
) : R.atom(
|
|
8944
8944
|
this.interaction.userAttributives
|
|
@@ -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 (
|
|
8972
|
+
if (U.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);
|
|
@@ -9026,7 +9026,7 @@ class ke {
|
|
|
9026
9026
|
}
|
|
9027
9027
|
async checkCondition(t) {
|
|
9028
9028
|
if (this.interaction.conditions) {
|
|
9029
|
-
const e =
|
|
9029
|
+
const e = At.is(this.interaction.conditions) ? new R(this.interaction.conditions.content) : R.atom(this.interaction.conditions), i = async (s) => {
|
|
9030
9030
|
if (!s) return !0;
|
|
9031
9031
|
if (s.content) {
|
|
9032
9032
|
const a = s.content;
|
|
@@ -9103,7 +9103,7 @@ class ke {
|
|
|
9103
9103
|
return s;
|
|
9104
9104
|
}
|
|
9105
9105
|
}
|
|
9106
|
-
class
|
|
9106
|
+
class H {
|
|
9107
9107
|
constructor(t, e) {
|
|
9108
9108
|
this.graph = t, this.parent = e;
|
|
9109
9109
|
}
|
|
@@ -9113,7 +9113,7 @@ class j {
|
|
|
9113
9113
|
};
|
|
9114
9114
|
}
|
|
9115
9115
|
static create(t, e, i) {
|
|
9116
|
-
const r = new
|
|
9116
|
+
const r = new H(e, i);
|
|
9117
9117
|
return t.current && (r.current = $.create(t.current, e, r)), r;
|
|
9118
9118
|
}
|
|
9119
9119
|
isInteractionAvailable(t) {
|
|
@@ -9147,13 +9147,13 @@ 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) =>
|
|
9150
|
+
return tt.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
9154
|
if (tt.is(r.content)) {
|
|
9155
9155
|
const a = $.GroupStateNodeType.get(r.content.type), o = new a(r, e, i);
|
|
9156
|
-
return o.isGroup = !0, o.children = t?.children?.map((n) =>
|
|
9156
|
+
return o.isGroup = !0, o.children = t?.children?.map((n) => H.create(n, e, o)), o;
|
|
9157
9157
|
} else
|
|
9158
9158
|
return new $(r, e, i);
|
|
9159
9159
|
}
|
|
@@ -9175,10 +9175,10 @@ class $ {
|
|
|
9175
9175
|
}
|
|
9176
9176
|
class ne {
|
|
9177
9177
|
constructor(t, e) {
|
|
9178
|
-
this.graph = e, this.root =
|
|
9178
|
+
this.graph = e, this.root = H.create(t, this.graph);
|
|
9179
9179
|
}
|
|
9180
9180
|
static createInitialState(t) {
|
|
9181
|
-
return
|
|
9181
|
+
return H.createInitialState(t);
|
|
9182
9182
|
}
|
|
9183
9183
|
isInteractionAvailable(t) {
|
|
9184
9184
|
return this.root.isInteractionAvailable(t);
|
|
@@ -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 (
|
|
9320
|
+
if (U.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,8 +9352,8 @@ class Ui extends $ {
|
|
|
9352
9352
|
// 可以根据 group 上的具体配置逻辑,来动态决定。
|
|
9353
9353
|
}
|
|
9354
9354
|
$.GroupStateNodeType.set("program", Ui);
|
|
9355
|
-
const ce = new ue(),
|
|
9356
|
-
name:
|
|
9355
|
+
const ce = new ue(), Dt = "_Interaction_", gt = "_Activity_", Te = C.create({
|
|
9356
|
+
name: Dt,
|
|
9357
9357
|
properties: [
|
|
9358
9358
|
v.create({
|
|
9359
9359
|
name: "interactionId",
|
|
@@ -9428,7 +9428,7 @@ class Gi {
|
|
|
9428
9428
|
try {
|
|
9429
9429
|
const s = this.interactionCallsByName.get(t);
|
|
9430
9430
|
if (!s)
|
|
9431
|
-
throw new
|
|
9431
|
+
throw new Y(`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
|
|
9443
|
+
error: new Y("Interaction execution failed", {
|
|
9444
9444
|
interactionName: t,
|
|
9445
9445
|
userId: e.user?.id,
|
|
9446
9446
|
payload: e.payload,
|
|
@@ -9457,7 +9457,7 @@ class Gi {
|
|
|
9457
9457
|
}
|
|
9458
9458
|
return o;
|
|
9459
9459
|
} catch (s) {
|
|
9460
|
-
throw new
|
|
9460
|
+
throw new Y("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
|
|
9485
|
+
const l = new Y(`Cannot find interaction ${e} in activity ${t}`, {
|
|
9486
9486
|
interactionName: e,
|
|
9487
9487
|
userId: r.user?.id,
|
|
9488
9488
|
payload: r.payload,
|
|
@@ -9513,7 +9513,7 @@ class Gi {
|
|
|
9513
9513
|
t.sideEffects || (t.sideEffects = {});
|
|
9514
9514
|
for (let a of s)
|
|
9515
9515
|
try {
|
|
9516
|
-
if (a instanceof
|
|
9516
|
+
if (a instanceof j)
|
|
9517
9517
|
t.sideEffects[a.name] = {
|
|
9518
9518
|
result: await a.content(r)
|
|
9519
9519
|
};
|
|
@@ -9525,7 +9525,7 @@ class Gi {
|
|
|
9525
9525
|
}
|
|
9526
9526
|
} catch (o) {
|
|
9527
9527
|
let n = "unknown";
|
|
9528
|
-
a instanceof
|
|
9528
|
+
a instanceof j ? n = a.name : n = a.name || "unknown", e.error({ label: "recordMutationSideEffect", message: n }), t.sideEffects[n] = {
|
|
9529
9529
|
error: o
|
|
9530
9530
|
};
|
|
9531
9531
|
}
|
|
@@ -9553,10 +9553,10 @@ class Gi {
|
|
|
9553
9553
|
}));
|
|
9554
9554
|
}
|
|
9555
9555
|
async saveEvent(t) {
|
|
9556
|
-
return this.controller.system.storage.create(
|
|
9556
|
+
return this.controller.system.storage.create(Dt, t);
|
|
9557
9557
|
}
|
|
9558
9558
|
async getEvent(t) {
|
|
9559
|
-
return (await this.controller.system.storage.find(
|
|
9559
|
+
return (await this.controller.system.storage.find(Dt, t, void 0, ["*"])).map((e) => ({
|
|
9560
9560
|
...e
|
|
9561
9561
|
}));
|
|
9562
9562
|
}
|
|
@@ -9573,27 +9573,27 @@ class Gi {
|
|
|
9573
9573
|
return this.interactionCallsByName.get(t);
|
|
9574
9574
|
}
|
|
9575
9575
|
}
|
|
9576
|
-
const
|
|
9576
|
+
const zt = new ue();
|
|
9577
9577
|
function Xi() {
|
|
9578
|
-
return
|
|
9578
|
+
return zt.getStore()?.effects;
|
|
9579
9579
|
}
|
|
9580
9580
|
function le(u) {
|
|
9581
|
-
const t =
|
|
9581
|
+
const t = zt.getStore();
|
|
9582
9582
|
t?.effects && t.effects.push(...u);
|
|
9583
9583
|
}
|
|
9584
9584
|
const Tr = "User";
|
|
9585
|
-
class
|
|
9585
|
+
class j {
|
|
9586
9586
|
constructor(t) {
|
|
9587
9587
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
9588
9588
|
}
|
|
9589
9589
|
static create(t) {
|
|
9590
|
-
return new
|
|
9590
|
+
return new j(t);
|
|
9591
9591
|
}
|
|
9592
9592
|
}
|
|
9593
|
-
const
|
|
9593
|
+
const Ot = "_isDeleted_", Ar = {
|
|
9594
9594
|
create() {
|
|
9595
9595
|
return v.create({
|
|
9596
|
-
name:
|
|
9596
|
+
name: Ot,
|
|
9597
9597
|
type: "boolean"
|
|
9598
9598
|
});
|
|
9599
9599
|
}
|
|
@@ -9614,10 +9614,10 @@ class Sr {
|
|
|
9614
9614
|
recordMutationSideEffects: n = [],
|
|
9615
9615
|
computations: c = [],
|
|
9616
9616
|
ignorePermission: l = !1,
|
|
9617
|
-
|
|
9617
|
+
forceThrowInteractionError: d = !1
|
|
9618
9618
|
// 会 catch 住 error,并在 result 中返回。
|
|
9619
9619
|
} = t;
|
|
9620
|
-
this.system = e, this.ignorePermission = l, this.
|
|
9620
|
+
this.system = e, this.ignorePermission = l, this.forceThrowInteractionError = d, this.entities = [...i], this.relations = [...r], this.activities = [...s], this.interactions = [...a], this.dict = [...o], this.recordMutationSideEffects = [...n], this.activityManager = new Gi(this, s, a);
|
|
9621
9621
|
const h = [
|
|
9622
9622
|
...Si,
|
|
9623
9623
|
...Ci,
|
|
@@ -9628,7 +9628,7 @@ class Sr {
|
|
|
9628
9628
|
...Vi,
|
|
9629
9629
|
...Mi,
|
|
9630
9630
|
...fi,
|
|
9631
|
-
...
|
|
9631
|
+
...Bi,
|
|
9632
9632
|
...c
|
|
9633
9633
|
];
|
|
9634
9634
|
this.scheduler = new Wi(this, this.entities, this.relations, this.dict, h), n.forEach((p) => {
|
|
@@ -9670,7 +9670,7 @@ class Sr {
|
|
|
9670
9670
|
await this.system.storage.create(r.id.name, a);
|
|
9671
9671
|
} else {
|
|
9672
9672
|
const r = t;
|
|
9673
|
-
r.id.name ===
|
|
9673
|
+
r.id.name === Ot && e ? await this.system.storage.delete(r.host.name, R.atom({ key: "id", value: ["=", i.id] })) : await this.system.storage.update(r.host.name, R.atom({ key: "id", value: ["=", i.id] }), { [r.id.name]: e });
|
|
9674
9674
|
}
|
|
9675
9675
|
}
|
|
9676
9676
|
}
|
|
@@ -9693,49 +9693,29 @@ class Sr {
|
|
|
9693
9693
|
}
|
|
9694
9694
|
} else {
|
|
9695
9695
|
const a = t;
|
|
9696
|
-
a.id.name ===
|
|
9696
|
+
a.id.name === Ot && s.data ? (T(s.type !== "delete", "Hard deletion property cannot be deleted"), await this.system.storage.delete(a.host.name, R.atom({ key: "id", value: ["=", i.id] }))) : s.type === "insert" ? await this.system.storage.update(a.host.name, R.atom({ key: "id", value: ["=", i.id] }), { [a.id.name]: s.data }) : s.type === "update" ? await this.system.storage.update(a.host.name, R.atom({ key: "id", value: ["=", i.id] }), { [a.id.name]: s.data }) : s.type === "delete" && await this.system.storage.update(a.host.name, R.atom({ key: "id", value: ["=", i.id] }), { [a.id.name]: null });
|
|
9697
9697
|
}
|
|
9698
9698
|
}
|
|
9699
9699
|
}
|
|
9700
|
-
async callInteraction(t, e) {
|
|
9700
|
+
async callInteraction(t, e, i, r) {
|
|
9701
9701
|
try {
|
|
9702
|
-
const
|
|
9703
|
-
if (
|
|
9704
|
-
throw r.error;
|
|
9705
|
-
return r;
|
|
9706
|
-
} catch (i) {
|
|
9707
|
-
throw new H("Failed to call interaction", {
|
|
9708
|
-
interactionName: t,
|
|
9709
|
-
userId: e.user?.id,
|
|
9710
|
-
payload: e.payload,
|
|
9711
|
-
executionPhase: "callInteraction",
|
|
9712
|
-
causedBy: i instanceof Error ? i : new Error(String(i))
|
|
9713
|
-
});
|
|
9714
|
-
}
|
|
9715
|
-
}
|
|
9716
|
-
async callActivityInteraction(t, e, i, r) {
|
|
9717
|
-
try {
|
|
9718
|
-
const s = { effects: [] }, a = await vt.run(s, async () => await this.activityManager.callActivityInteraction(t, e, i, r));
|
|
9719
|
-
if (a.effects && s.effects.length > 0) {
|
|
9720
|
-
const o = s.effects.filter(
|
|
9721
|
-
(n) => !a.effects.some(
|
|
9722
|
-
(c) => c.type === n.type && c.recordName === n.recordName && c.record?.id === n.record?.id
|
|
9723
|
-
)
|
|
9724
|
-
);
|
|
9725
|
-
a.effects.push(...o);
|
|
9726
|
-
}
|
|
9727
|
-
if (a.error && this.forceThtrowInteractionError)
|
|
9702
|
+
const s = { effects: [] }, a = await zt.run(s, async () => i ? await this.activityManager.callActivityInteraction(i, t, r, e) : await this.activityManager.callInteraction(t, e));
|
|
9703
|
+
if (a.effects = s.effects, a.error && this.forceThrowInteractionError)
|
|
9728
9704
|
throw a.error;
|
|
9729
|
-
return a;
|
|
9705
|
+
return await this.runRecordChangeSideEffects(a, this.system.logger), a;
|
|
9730
9706
|
} catch (s) {
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9707
|
+
const a = !!i;
|
|
9708
|
+
throw new Y(
|
|
9709
|
+
a ? "Failed to call activity interaction" : "Failed to call interaction",
|
|
9710
|
+
{
|
|
9711
|
+
interactionName: t,
|
|
9712
|
+
userId: e.user?.id,
|
|
9713
|
+
payload: e.payload,
|
|
9714
|
+
executionPhase: a ? "callActivityInteraction" : "callInteraction",
|
|
9715
|
+
...a ? { context: { activityName: i, activityId: r } } : {},
|
|
9716
|
+
causedBy: s instanceof Error ? s : new Error(String(s))
|
|
9717
|
+
}
|
|
9718
|
+
);
|
|
9739
9719
|
}
|
|
9740
9720
|
}
|
|
9741
9721
|
async runRecordChangeSideEffects(t, e) {
|
|
@@ -9745,7 +9725,7 @@ class Sr {
|
|
|
9745
9725
|
if (s)
|
|
9746
9726
|
for (let a of s)
|
|
9747
9727
|
try {
|
|
9748
|
-
if (a instanceof
|
|
9728
|
+
if (a instanceof j)
|
|
9749
9729
|
t.sideEffects[a.name] = {
|
|
9750
9730
|
result: await a.content(r)
|
|
9751
9731
|
};
|
|
@@ -9757,7 +9737,7 @@ class Sr {
|
|
|
9757
9737
|
}
|
|
9758
9738
|
} catch (o) {
|
|
9759
9739
|
let n = "unknown";
|
|
9760
|
-
a instanceof
|
|
9740
|
+
a instanceof j ? n = a.name : n = a.name || "unknown", e.error({ label: "recordMutationSideEffect", message: n }), t.sideEffects[n] = {
|
|
9761
9741
|
error: o
|
|
9762
9742
|
};
|
|
9763
9743
|
}
|
|
@@ -9798,12 +9778,12 @@ class Zi {
|
|
|
9798
9778
|
}
|
|
9799
9779
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
9800
9780
|
async get(t, e, i) {
|
|
9801
|
-
const r = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(
|
|
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;
|
|
9802
9782
|
return s === void 0 ? i : Yi(s);
|
|
9803
9783
|
}
|
|
9804
9784
|
async set(t, e, i, r) {
|
|
9805
9785
|
const s = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
9806
|
-
return await this.queryHandle.findOne(
|
|
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);
|
|
9807
9787
|
}
|
|
9808
9788
|
async setup(t, e, i = !1) {
|
|
9809
9789
|
await this.db.open(i);
|
|
@@ -9948,9 +9928,9 @@ class Cr {
|
|
|
9948
9928
|
export {
|
|
9949
9929
|
gt as ACTIVITY_RECORD,
|
|
9950
9930
|
qe as ALL_ATTR_SYMBOL,
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9931
|
+
It as ASYNC_TASK_RECORD,
|
|
9932
|
+
kt as Action,
|
|
9933
|
+
qt as Activity,
|
|
9954
9934
|
Z as ActivityCall,
|
|
9955
9935
|
tt as ActivityGroup,
|
|
9956
9936
|
Ki as ActivityInteractionRelation,
|
|
@@ -9958,10 +9938,10 @@ export {
|
|
|
9958
9938
|
Ae as ActivityStateEntity,
|
|
9959
9939
|
dt as Any,
|
|
9960
9940
|
ki as AnyHandles,
|
|
9961
|
-
|
|
9941
|
+
B as AttributeInfo,
|
|
9962
9942
|
x as AttributeQuery,
|
|
9963
|
-
|
|
9964
|
-
|
|
9943
|
+
U as Attributive,
|
|
9944
|
+
vt as Attributives,
|
|
9965
9945
|
lt as Average,
|
|
9966
9946
|
Vi as AverageHandles,
|
|
9967
9947
|
ur as BaseKlass,
|
|
@@ -9978,27 +9958,27 @@ export {
|
|
|
9978
9958
|
oe as ComputationStateError,
|
|
9979
9959
|
_t as Condition,
|
|
9980
9960
|
D as ConditionError,
|
|
9981
|
-
|
|
9961
|
+
At as Conditions,
|
|
9982
9962
|
Sr as Controller,
|
|
9983
9963
|
nt as Count,
|
|
9984
9964
|
Si as CountHandles,
|
|
9985
|
-
|
|
9986
|
-
|
|
9965
|
+
Gt as Custom,
|
|
9966
|
+
Bi as CustomHandles,
|
|
9987
9967
|
Yt as DBConsoleLogger,
|
|
9988
9968
|
tr as DBLogLevel,
|
|
9989
9969
|
oi as DBSetup,
|
|
9990
9970
|
kr as DELETED_STATE,
|
|
9991
9971
|
q as DICTIONARY_RECORD,
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9972
|
+
Bt as DataAttributive,
|
|
9973
|
+
Kt as DataAttributives,
|
|
9974
|
+
Qt as Dictionary,
|
|
9995
9975
|
ci as DictionaryEntity,
|
|
9996
9976
|
C as Entity,
|
|
9997
9977
|
Li as EntityCustomHandle,
|
|
9998
9978
|
je as EntityQueryHandle,
|
|
9999
9979
|
Ue as EntityToTableMap,
|
|
10000
|
-
|
|
10001
|
-
|
|
9980
|
+
Xt as Equation,
|
|
9981
|
+
Wt as Event,
|
|
10002
9982
|
ut as Every,
|
|
10003
9983
|
wi as EveryHandles,
|
|
10004
9984
|
M as Expression,
|
|
@@ -10006,7 +9986,7 @@ export {
|
|
|
10006
9986
|
Ve as GetAction,
|
|
10007
9987
|
Ni as GlobalAnyHandle,
|
|
10008
9988
|
Oi as GlobalAverageHandle,
|
|
10009
|
-
|
|
9989
|
+
_ as GlobalBoundState,
|
|
10010
9990
|
Ti as GlobalCountHandle,
|
|
10011
9991
|
Qi as GlobalCustomHandle,
|
|
10012
9992
|
bi as GlobalEveryHandle,
|
|
@@ -10014,15 +9994,15 @@ export {
|
|
|
10014
9994
|
hi as GlobalStateMachineHandle,
|
|
10015
9995
|
Pi as GlobalSumHandle,
|
|
10016
9996
|
mi as GlobalWeightedSummationHandle,
|
|
10017
|
-
|
|
9997
|
+
Ot as HARD_DELETION_PROPERTY_NAME,
|
|
10018
9998
|
Ar as HardDeletionProperty,
|
|
10019
9999
|
re as ID_ATTR,
|
|
10020
|
-
|
|
10000
|
+
Dt as INTERACTION_RECORD,
|
|
10021
10001
|
Nt as Inequality,
|
|
10022
|
-
|
|
10002
|
+
Lt as Interaction,
|
|
10023
10003
|
ke as InteractionCall,
|
|
10024
10004
|
Te as InteractionEventEntity,
|
|
10025
|
-
|
|
10005
|
+
Ft as KlassByName,
|
|
10026
10006
|
f as LINK_SYMBOL,
|
|
10027
10007
|
Rt as LinkInfo,
|
|
10028
10008
|
m as MatchExp,
|
|
@@ -10033,19 +10013,19 @@ export {
|
|
|
10033
10013
|
Q as NewRecordData,
|
|
10034
10014
|
gr as PHASE_AFTER_ALL,
|
|
10035
10015
|
yr as PHASE_BEFORE_ALL,
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10016
|
+
Ct as PHASE_NORMAL,
|
|
10017
|
+
jt as Payload,
|
|
10018
|
+
Ht as PayloadItem,
|
|
10039
10019
|
v as Property,
|
|
10040
10020
|
vi as PropertyAnyHandle,
|
|
10041
10021
|
Fi as PropertyAverageHandle,
|
|
10042
10022
|
Ai as PropertyCountHandle,
|
|
10043
|
-
|
|
10023
|
+
_i as PropertyCustomHandle,
|
|
10044
10024
|
Ri as PropertyEveryHandle,
|
|
10045
10025
|
Ii as PropertyRealTimeComputation,
|
|
10046
10026
|
pi as PropertyStateMachineHandle,
|
|
10047
10027
|
$i as PropertySumHandle,
|
|
10048
|
-
|
|
10028
|
+
Vt as PropertyTypes,
|
|
10049
10029
|
yi as PropertyWeightedSummationHandle,
|
|
10050
10030
|
ye as Query,
|
|
10051
10031
|
me as QueryItem,
|
|
@@ -10055,7 +10035,7 @@ export {
|
|
|
10055
10035
|
Mi as RealTimeHandles,
|
|
10056
10036
|
E as RecordBoundState,
|
|
10057
10037
|
it as RecordInfo,
|
|
10058
|
-
|
|
10038
|
+
j as RecordMutationSideEffect,
|
|
10059
10039
|
I as RecordQuery,
|
|
10060
10040
|
He as RecordQueryAgent,
|
|
10061
10041
|
L as RecordQueryTree,
|
|
@@ -10064,27 +10044,27 @@ export {
|
|
|
10064
10044
|
ge as RefContainer,
|
|
10065
10045
|
P as Relation,
|
|
10066
10046
|
qi as RelationCustomHandle,
|
|
10067
|
-
|
|
10047
|
+
z as SYSTEM_RECORD,
|
|
10068
10048
|
Wi as Scheduler,
|
|
10069
|
-
|
|
10049
|
+
Ut as SideEffect,
|
|
10070
10050
|
at as StateMachine,
|
|
10071
10051
|
fi as StateMachineHandles,
|
|
10072
|
-
|
|
10073
|
-
|
|
10052
|
+
K as StateNode,
|
|
10053
|
+
Jt as StateTransfer,
|
|
10074
10054
|
ct as Summation,
|
|
10075
10055
|
Di as SummationHandles,
|
|
10076
10056
|
Zt as SystemConsoleLogger,
|
|
10077
10057
|
ni as SystemEntity,
|
|
10078
10058
|
er as SystemLogLevel,
|
|
10079
10059
|
pe as Transfer,
|
|
10080
|
-
|
|
10060
|
+
Tt as Transform,
|
|
10081
10061
|
Ci as TransformHandles,
|
|
10082
10062
|
Tr as USER_ENTITY,
|
|
10083
10063
|
ot as WeightedSummation,
|
|
10084
10064
|
gi as WeightedSummationHandles,
|
|
10085
10065
|
le as addToCurrentEffects,
|
|
10086
10066
|
T as assert,
|
|
10087
|
-
|
|
10067
|
+
zt as asyncEffectsContext,
|
|
10088
10068
|
ce as asyncInteractionContext,
|
|
10089
10069
|
fr as boolExpToAttributives,
|
|
10090
10070
|
ar as clearAllInstances,
|