interaqt 0.7.4 → 0.8.1
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/.claude/agents/bug-fix-handler.md +242 -0
- package/agent/.claude/agents/code-generation-handler.md +235 -86
- package/agent/.claude/agents/computation-generation-handler.md +236 -47
- package/agent/.claude/agents/error-check-handler.md +1251 -0
- package/agent/.claude/agents/frontend-generation-handler.md +397 -0
- package/agent/.claude/agents/implement-design-handler.md +76 -15
- package/agent/.claude/agents/implement-integration-handler.md +1689 -0
- package/agent/.claude/agents/permission-generation-handler.md +22 -11
- package/agent/.claude/agents/requirements-analysis-handler.md +812 -82
- package/agent/.claude/settings.local.json +36 -1
- package/agent/CLAUDE.md +53 -13
- package/agent/agentspace/knowledge/generator/computation-analysis.md +105 -21
- package/agent/agentspace/knowledge/generator/data-analysis.md +211 -17
- package/agent/agentspace/prompt/integration_sub_agent_refactor.md +19 -0
- package/dist/index.js +345 -399
- package/dist/index.js.map +1 -1
- package/dist/shared/Data.d.ts +30 -57
- package/dist/shared/Data.d.ts.map +1 -1
- package/dist/shared/Interaction.d.ts +6 -6
- package/dist/shared/Interaction.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parse as
|
|
1
|
+
import { parse as Se } from "acorn";
|
|
2
2
|
import { AsyncLocalStorage as le } from "async_hooks";
|
|
3
3
|
function ue(u) {
|
|
4
4
|
return u !== null && typeof u == "object";
|
|
@@ -8,7 +8,7 @@ function de(u) {
|
|
|
8
8
|
const t = Object.getPrototypeOf(u);
|
|
9
9
|
return t === null ? !0 : t === Object.prototype || t === null;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Ee(u, t) {
|
|
12
12
|
const e = {};
|
|
13
13
|
for (const i of u)
|
|
14
14
|
i && i[t] !== void 0 && (e[String(i[t])] = i);
|
|
@@ -29,27 +29,27 @@ function mt(u, t) {
|
|
|
29
29
|
const e = u;
|
|
30
30
|
return t && e._type && e.constructor?.clone ? e.constructor.clone(u, t) : u;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function ar(...u) {
|
|
33
33
|
for (const t of u)
|
|
34
34
|
t.instances.length = 0;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function or() {
|
|
37
37
|
}
|
|
38
38
|
const Dt = /* @__PURE__ */ new Map();
|
|
39
|
-
function
|
|
39
|
+
function Ie(u, t) {
|
|
40
40
|
t && t.isKlass && t.displayName && Dt.set(u, t);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function nr() {
|
|
43
43
|
const u = [];
|
|
44
44
|
return Array.from(Dt.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
|
}
|
|
48
|
-
function
|
|
48
|
+
function cr(u) {
|
|
49
49
|
const t = JSON.parse(u);
|
|
50
|
-
return
|
|
50
|
+
return Ce(t);
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function Ce(u) {
|
|
53
53
|
const t = /* @__PURE__ */ new Map();
|
|
54
54
|
return u.forEach(({ type: e, options: i = {}, uuid: r, public: s }) => {
|
|
55
55
|
const a = Dt.get(e);
|
|
@@ -61,10 +61,10 @@ function xe(u) {
|
|
|
61
61
|
t.set(r, o);
|
|
62
62
|
}), t;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function lr(u) {
|
|
65
65
|
return console.warn("createClass is deprecated in refactored code"), null;
|
|
66
66
|
}
|
|
67
|
-
class
|
|
67
|
+
class ur {
|
|
68
68
|
static {
|
|
69
69
|
this.isKlass = !0;
|
|
70
70
|
}
|
|
@@ -86,11 +86,11 @@ class dr {
|
|
|
86
86
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
let
|
|
89
|
+
let xe = 0;
|
|
90
90
|
function k(u) {
|
|
91
|
-
return u?.uuid || `id_${++
|
|
91
|
+
return u?.uuid || `id_${++xe}`;
|
|
92
92
|
}
|
|
93
|
-
const
|
|
93
|
+
const Me = /^[a-zA-Z0-9_]+$/;
|
|
94
94
|
class I {
|
|
95
95
|
// for Merged Entity
|
|
96
96
|
constructor(t, e) {
|
|
@@ -111,7 +111,7 @@ class I {
|
|
|
111
111
|
type: "string",
|
|
112
112
|
required: !0,
|
|
113
113
|
constraints: {
|
|
114
|
-
nameFormat: ({ name: t }) =>
|
|
114
|
+
nameFormat: ({ name: t }) => Me.test(t)
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
properties: {
|
|
@@ -193,7 +193,7 @@ class I {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
var Vt = /* @__PURE__ */ ((u) => (u.String = "string", u.Number = "number", u.Boolean = "boolean", u.Timestamp = "timestamp", u))(Vt || {});
|
|
196
|
-
const
|
|
196
|
+
const Pe = /^[a-zA-Z0-9_]+$/;
|
|
197
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;
|
|
@@ -214,7 +214,7 @@ class Qt {
|
|
|
214
214
|
required: !0,
|
|
215
215
|
collection: !1,
|
|
216
216
|
constraints: {
|
|
217
|
-
format: ({ name: t }) =>
|
|
217
|
+
format: ({ name: t }) => Pe.test(t),
|
|
218
218
|
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
219
219
|
}
|
|
220
220
|
},
|
|
@@ -287,7 +287,7 @@ class Qt {
|
|
|
287
287
|
return this.create(e.public, e.options);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const $e = /^[a-zA-Z0-9_]+$/;
|
|
291
291
|
class v {
|
|
292
292
|
constructor(t, e) {
|
|
293
293
|
this._type = "Property", this._options = e, this.uuid = k(e), this.name = t.name, this.type = t.type, this.collection = t.collection, this.defaultValue = t.defaultValue, this.computed = t.computed, this.computation = t.computation;
|
|
@@ -307,7 +307,7 @@ class v {
|
|
|
307
307
|
type: "string",
|
|
308
308
|
required: !0,
|
|
309
309
|
constraints: {
|
|
310
|
-
format: ({ name: t }) =>
|
|
310
|
+
format: ({ name: t }) => $e.test(t),
|
|
311
311
|
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
312
312
|
}
|
|
313
313
|
},
|
|
@@ -555,7 +555,7 @@ class P {
|
|
|
555
555
|
}
|
|
556
556
|
class Lt {
|
|
557
557
|
constructor(t, e) {
|
|
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.
|
|
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.dataPolicy = t.dataPolicy;
|
|
559
559
|
}
|
|
560
560
|
static {
|
|
561
561
|
this.isKlass = !0;
|
|
@@ -606,8 +606,8 @@ class Lt {
|
|
|
606
606
|
required: !1,
|
|
607
607
|
collection: !1
|
|
608
608
|
},
|
|
609
|
-
|
|
610
|
-
type: "
|
|
609
|
+
dataPolicy: {
|
|
610
|
+
type: "DataPolicy",
|
|
611
611
|
required: !1,
|
|
612
612
|
collection: !1
|
|
613
613
|
}
|
|
@@ -624,7 +624,7 @@ class Lt {
|
|
|
624
624
|
name: t.name,
|
|
625
625
|
action: t.action
|
|
626
626
|
};
|
|
627
|
-
t.conditions !== void 0 && (e.conditions = t.conditions), t.userAttributives !== void 0 && (e.userAttributives = t.userAttributives), t.userRef !== void 0 && (e.userRef = t.userRef), t.payload !== void 0 && (e.payload = t.payload), t.sideEffects && t.sideEffects.length > 0 && (e.sideEffects = t.sideEffects), t.data !== void 0 && (e.data = t.data), t.
|
|
627
|
+
t.conditions !== void 0 && (e.conditions = t.conditions), t.userAttributives !== void 0 && (e.userAttributives = t.userAttributives), t.userRef !== void 0 && (e.userRef = t.userRef), t.payload !== void 0 && (e.payload = t.payload), t.sideEffects && t.sideEffects.length > 0 && (e.sideEffects = t.sideEffects), t.data !== void 0 && (e.data = t.data), t.dataPolicy !== void 0 && (e.dataPolicy = t.dataPolicy);
|
|
628
628
|
const i = {
|
|
629
629
|
type: "Interaction",
|
|
630
630
|
options: t._options,
|
|
@@ -638,7 +638,7 @@ class Lt {
|
|
|
638
638
|
name: t.name,
|
|
639
639
|
action: t.action
|
|
640
640
|
};
|
|
641
|
-
return t.conditions !== void 0 && (i.conditions = t.conditions), t.userAttributives !== void 0 && (i.userAttributives = t.userAttributives), t.userRef !== void 0 && (i.userRef = t.userRef), t.payload !== void 0 && (i.payload = t.payload), t.sideEffects && t.sideEffects.length > 0 && (i.sideEffects = t.sideEffects), t.data !== void 0 && (i.data = t.data), t.
|
|
641
|
+
return t.conditions !== void 0 && (i.conditions = t.conditions), t.userAttributives !== void 0 && (i.userAttributives = t.userAttributives), t.userRef !== void 0 && (i.userRef = t.userRef), t.payload !== void 0 && (i.payload = t.payload), t.sideEffects && t.sideEffects.length > 0 && (i.sideEffects = t.sideEffects), t.data !== void 0 && (i.data = t.data), t.dataPolicy !== void 0 && (i.dataPolicy = t.dataPolicy), this.create(i);
|
|
642
642
|
}
|
|
643
643
|
static is(t) {
|
|
644
644
|
return t !== null && typeof t == "object" && "_type" in t && t._type === "Interaction";
|
|
@@ -874,11 +874,11 @@ function pe(u, t, e) {
|
|
|
874
874
|
i.activities?.forEach((r) => pe(r, t, i));
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function dr(u) {
|
|
878
878
|
const t = [];
|
|
879
879
|
return pe(u, (e) => t.push(e)), t;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function hr(u) {
|
|
882
882
|
return null;
|
|
883
883
|
}
|
|
884
884
|
class it {
|
|
@@ -1176,7 +1176,7 @@ const Fe = {
|
|
|
1176
1176
|
"||": "or",
|
|
1177
1177
|
"!": "not"
|
|
1178
1178
|
};
|
|
1179
|
-
function
|
|
1179
|
+
function Oe(u) {
|
|
1180
1180
|
return { key: u };
|
|
1181
1181
|
}
|
|
1182
1182
|
function yt(u, t, e) {
|
|
@@ -1200,8 +1200,8 @@ function yt(u, t, e) {
|
|
|
1200
1200
|
};
|
|
1201
1201
|
throw new Error("unknown ast node type");
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1204
|
-
const i =
|
|
1203
|
+
function pr(u, t = [], e = Oe) {
|
|
1204
|
+
const i = Ee(t, "name"), r = Se(u, { ecmaVersion: 2020 });
|
|
1205
1205
|
return new R(
|
|
1206
1206
|
yt(r.body[0].expression, i, e)
|
|
1207
1207
|
);
|
|
@@ -1343,7 +1343,7 @@ function Mt(u) {
|
|
|
1343
1343
|
right: Mt(u.right)
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
|
-
function
|
|
1346
|
+
function fr(u) {
|
|
1347
1347
|
return vt.create({
|
|
1348
1348
|
content: Mt(u)
|
|
1349
1349
|
});
|
|
@@ -1470,27 +1470,32 @@ class _t {
|
|
|
1470
1470
|
}
|
|
1471
1471
|
class fe {
|
|
1472
1472
|
constructor(t, e) {
|
|
1473
|
-
this._type = "
|
|
1473
|
+
this._type = "DataPolicy", this._options = e, this.uuid = k(e), this.match = t.match, this.modifier = t.modifier, this.attributeQuery = t.attributeQuery;
|
|
1474
1474
|
}
|
|
1475
1475
|
static {
|
|
1476
1476
|
this.isKlass = !0;
|
|
1477
1477
|
}
|
|
1478
1478
|
static {
|
|
1479
|
-
this.displayName = "
|
|
1479
|
+
this.displayName = "DataPolicy";
|
|
1480
1480
|
}
|
|
1481
1481
|
static {
|
|
1482
1482
|
this.instances = [];
|
|
1483
1483
|
}
|
|
1484
1484
|
static {
|
|
1485
1485
|
this.public = {
|
|
1486
|
-
|
|
1487
|
-
type: "
|
|
1488
|
-
required: !
|
|
1486
|
+
match: {
|
|
1487
|
+
type: "any",
|
|
1488
|
+
required: !1,
|
|
1489
1489
|
collection: !1
|
|
1490
1490
|
},
|
|
1491
|
-
|
|
1492
|
-
type: "
|
|
1493
|
-
required: !
|
|
1491
|
+
modifier: {
|
|
1492
|
+
type: "any",
|
|
1493
|
+
required: !1,
|
|
1494
|
+
collection: !1
|
|
1495
|
+
},
|
|
1496
|
+
attributeQuery: {
|
|
1497
|
+
type: "any",
|
|
1498
|
+
required: !1,
|
|
1494
1499
|
collection: !1
|
|
1495
1500
|
}
|
|
1496
1501
|
};
|
|
@@ -1498,84 +1503,26 @@ class fe {
|
|
|
1498
1503
|
static create(t, e) {
|
|
1499
1504
|
const i = new fe(t, e);
|
|
1500
1505
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1501
|
-
throw new Error(`duplicate uuid in options ${i.uuid},
|
|
1502
|
-
return this.instances.push(i), i;
|
|
1503
|
-
}
|
|
1504
|
-
static stringify(t) {
|
|
1505
|
-
const e = {
|
|
1506
|
-
type: "QueryItem",
|
|
1507
|
-
options: t._options,
|
|
1508
|
-
uuid: t.uuid,
|
|
1509
|
-
public: {
|
|
1510
|
-
name: t.name,
|
|
1511
|
-
value: t.value
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
return JSON.stringify(e);
|
|
1515
|
-
}
|
|
1516
|
-
static clone(t, e) {
|
|
1517
|
-
return this.create({
|
|
1518
|
-
name: t.name,
|
|
1519
|
-
value: t.value
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
static is(t) {
|
|
1523
|
-
return t !== null && typeof t == "object" && "_type" in t && t._type === "QueryItem";
|
|
1524
|
-
}
|
|
1525
|
-
static check(t) {
|
|
1526
|
-
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
1527
|
-
}
|
|
1528
|
-
static parse(t) {
|
|
1529
|
-
const e = JSON.parse(t);
|
|
1530
|
-
return this.create(e.public, e.options);
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
class me {
|
|
1534
|
-
constructor(t, e) {
|
|
1535
|
-
this._type = "Query", this._options = e, this.uuid = k(e), this.items = t.items;
|
|
1536
|
-
}
|
|
1537
|
-
static {
|
|
1538
|
-
this.isKlass = !0;
|
|
1539
|
-
}
|
|
1540
|
-
static {
|
|
1541
|
-
this.displayName = "Query";
|
|
1542
|
-
}
|
|
1543
|
-
static {
|
|
1544
|
-
this.instances = [];
|
|
1545
|
-
}
|
|
1546
|
-
static {
|
|
1547
|
-
this.public = {
|
|
1548
|
-
items: {
|
|
1549
|
-
type: "QueryItem",
|
|
1550
|
-
required: !0,
|
|
1551
|
-
collection: !0
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
static create(t, e) {
|
|
1556
|
-
const i = new me(t, e);
|
|
1557
|
-
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1558
|
-
throw new Error(`duplicate uuid in options ${i.uuid}, Query`);
|
|
1506
|
+
throw new Error(`duplicate uuid in options ${i.uuid}, DataPolicy`);
|
|
1559
1507
|
return this.instances.push(i), i;
|
|
1560
1508
|
}
|
|
1561
1509
|
static stringify(t) {
|
|
1562
|
-
const e = {
|
|
1563
|
-
|
|
1510
|
+
const e = {};
|
|
1511
|
+
t.match !== void 0 && (e.match = t.match), t.modifier !== void 0 && (e.modifier = t.modifier), t.attributeQuery !== void 0 && (e.attributeQuery = t.attributeQuery);
|
|
1512
|
+
const i = {
|
|
1513
|
+
type: "DataPolicy",
|
|
1564
1514
|
options: t._options,
|
|
1565
1515
|
uuid: t.uuid,
|
|
1566
|
-
public:
|
|
1567
|
-
items: t.items
|
|
1568
|
-
}
|
|
1516
|
+
public: e
|
|
1569
1517
|
};
|
|
1570
|
-
return JSON.stringify(
|
|
1518
|
+
return JSON.stringify(i);
|
|
1571
1519
|
}
|
|
1572
1520
|
static clone(t, e) {
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
});
|
|
1521
|
+
const i = {};
|
|
1522
|
+
return t.match !== void 0 && (i.match = t.match), t.modifier !== void 0 && (i.modifier = t.modifier), t.attributeQuery !== void 0 && (i.attributeQuery = t.attributeQuery), this.create(i);
|
|
1576
1523
|
}
|
|
1577
1524
|
static is(t) {
|
|
1578
|
-
return t !== null && typeof t == "object" && "_type" in t && t._type === "
|
|
1525
|
+
return t !== null && typeof t == "object" && "_type" in t && t._type === "DataPolicy";
|
|
1579
1526
|
}
|
|
1580
1527
|
static check(t) {
|
|
1581
1528
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
@@ -1639,7 +1586,7 @@ class kt {
|
|
|
1639
1586
|
return this.create(e.public, e.options);
|
|
1640
1587
|
}
|
|
1641
1588
|
}
|
|
1642
|
-
const
|
|
1589
|
+
const De = kt.create({ name: "get" });
|
|
1643
1590
|
class tt {
|
|
1644
1591
|
constructor(t, e) {
|
|
1645
1592
|
this._type = "Gateway", this._options = e, this.uuid = k(e), this.name = t.name;
|
|
@@ -2916,7 +2863,7 @@ class Kt {
|
|
|
2916
2863
|
return this.create(e.public, e.options);
|
|
2917
2864
|
}
|
|
2918
2865
|
}
|
|
2919
|
-
const
|
|
2866
|
+
const Ve = [
|
|
2920
2867
|
I,
|
|
2921
2868
|
P,
|
|
2922
2869
|
v,
|
|
@@ -2948,8 +2895,8 @@ const Qe = [
|
|
|
2948
2895
|
At,
|
|
2949
2896
|
Kt
|
|
2950
2897
|
];
|
|
2951
|
-
|
|
2952
|
-
u && u.displayName &&
|
|
2898
|
+
Ve.forEach((u) => {
|
|
2899
|
+
u && u.displayName && Ie(u.displayName, u);
|
|
2953
2900
|
});
|
|
2954
2901
|
class Gt {
|
|
2955
2902
|
constructor(t, e) {
|
|
@@ -3058,7 +3005,7 @@ class Gt {
|
|
|
3058
3005
|
}), this.create(i, e.options);
|
|
3059
3006
|
}
|
|
3060
3007
|
}
|
|
3061
|
-
class
|
|
3008
|
+
class me {
|
|
3062
3009
|
constructor(t = [], e = []) {
|
|
3063
3010
|
this.clonedEntities = /* @__PURE__ */ new Map(), this.clonedRelations = /* @__PURE__ */ new Map(), this.reverseEntityMap = /* @__PURE__ */ new Map(), this.reverseRelationMap = /* @__PURE__ */ new Map(), this.originalEntities = [...t], this.originalRelations = [...e], (t.length > 0 || e.length > 0) && this.initializeClones();
|
|
3064
3011
|
}
|
|
@@ -3269,7 +3216,7 @@ class ye {
|
|
|
3269
3216
|
return null;
|
|
3270
3217
|
}
|
|
3271
3218
|
}
|
|
3272
|
-
function
|
|
3219
|
+
function mr({ name: u, isRef: t = !1 }, e) {
|
|
3273
3220
|
return U.create({
|
|
3274
3221
|
name: u,
|
|
3275
3222
|
content: u ? new Function("user", `return user.roles.includes('${u}')`) : function() {
|
|
@@ -3642,7 +3589,7 @@ class m {
|
|
|
3642
3589
|
);
|
|
3643
3590
|
}
|
|
3644
3591
|
}
|
|
3645
|
-
class
|
|
3592
|
+
class Qe {
|
|
3646
3593
|
constructor(t, e, i, r) {
|
|
3647
3594
|
this.recordName = t, this.map = e, this.data = i, this.fromRelation = r;
|
|
3648
3595
|
}
|
|
@@ -3678,7 +3625,7 @@ class x {
|
|
|
3678
3625
|
e,
|
|
3679
3626
|
N,
|
|
3680
3627
|
new C(h, e, i.attributeQuery || [], s, a),
|
|
3681
|
-
new
|
|
3628
|
+
new Qe(h, e, i.modifier),
|
|
3682
3629
|
r,
|
|
3683
3630
|
s,
|
|
3684
3631
|
a,
|
|
@@ -3772,7 +3719,7 @@ class L {
|
|
|
3772
3719
|
}), this.parentLinkQueryTree && (t[f] = this.parentLinkQueryTree.getData()), t;
|
|
3773
3720
|
}
|
|
3774
3721
|
}
|
|
3775
|
-
const f = "&",
|
|
3722
|
+
const f = "&", Le = "*";
|
|
3776
3723
|
class C {
|
|
3777
3724
|
constructor(t, e, i = [], r, s, a) {
|
|
3778
3725
|
this.recordName = t, this.map = e, this.data = i, this.parentRecord = r, this.attributeName = s, this.shouldQueryParentLinkData = a, this.relatedRecords = [], this.xToManyRecords = [], this.xToOneRecords = [], this.valueAttributes = [], this.id = Math.random();
|
|
@@ -3785,7 +3732,7 @@ class C {
|
|
|
3785
3732
|
this.parentLinkRecordQuery = x.create(y.linkName, this.map, d, void 0);
|
|
3786
3733
|
return;
|
|
3787
3734
|
}
|
|
3788
|
-
if (l ===
|
|
3735
|
+
if (l === Le) {
|
|
3789
3736
|
o = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((y) => y.attributeName));
|
|
3790
3737
|
return;
|
|
3791
3738
|
}
|
|
@@ -3794,10 +3741,10 @@ class C {
|
|
|
3794
3741
|
let y = l, N = d;
|
|
3795
3742
|
if (p.isLinkFiltered()) {
|
|
3796
3743
|
y = p.getBaseAttributeInfo().attributeName;
|
|
3797
|
-
const A = d.matchExpression, D = p.getLinkInfo().getBaseLinkInfo(), te = new m(D.name, this.map, p.getMatchExpression()).rebase(p.isRecordSource() ? "target" : "source"),
|
|
3744
|
+
const A = d.matchExpression, D = p.getLinkInfo().getBaseLinkInfo(), te = new m(D.name, this.map, p.getMatchExpression()).rebase(p.isRecordSource() ? "target" : "source"), Ae = A ? te.and(A.data) : te;
|
|
3798
3745
|
N = {
|
|
3799
3746
|
...d,
|
|
3800
|
-
matchExpression:
|
|
3747
|
+
matchExpression: Ae.data
|
|
3801
3748
|
};
|
|
3802
3749
|
}
|
|
3803
3750
|
const b = x.create(p.recordName, this.map, N, void 0, this.recordName, y, h, !1, l);
|
|
@@ -3915,7 +3862,7 @@ class C {
|
|
|
3915
3862
|
return this.parentLinkRecordQuery ? new C(this.recordName, this.map, this.data, this.parentRecord, this.attributeName, !0) : this;
|
|
3916
3863
|
}
|
|
3917
3864
|
}
|
|
3918
|
-
function
|
|
3865
|
+
function qe(u) {
|
|
3919
3866
|
const t = [];
|
|
3920
3867
|
return u.forEach((e) => t.push(...Array.isArray(e) ? e : [e])), t;
|
|
3921
3868
|
}
|
|
@@ -3925,7 +3872,7 @@ class Q {
|
|
|
3925
3872
|
const s = this.map.getRecordInfo(e);
|
|
3926
3873
|
this.recordName = s.isFilteredEntity || s.isFilteredRelation ? s.resolvedBaseRecordName : e;
|
|
3927
3874
|
const [a, o, n] = this.map.groupAttributes(this.recordName, i ? Object.keys(i) : []);
|
|
3928
|
-
this.relatedEntitiesData =
|
|
3875
|
+
this.relatedEntitiesData = qe(o.map(
|
|
3929
3876
|
(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
3877
|
)), this.valueAttributes = a, this.entityIdAttributes = n;
|
|
3931
3878
|
const c = this.map.getRecordInfo(this.recordName);
|
|
@@ -4002,7 +3949,7 @@ class Q {
|
|
|
4002
3949
|
}), i;
|
|
4003
3950
|
}
|
|
4004
3951
|
}
|
|
4005
|
-
class
|
|
3952
|
+
class Be {
|
|
4006
3953
|
constructor(t, e) {
|
|
4007
3954
|
this.map = t, this.queryAgent = e, this.dependencies = /* @__PURE__ */ new Map();
|
|
4008
3955
|
}
|
|
@@ -4228,7 +4175,7 @@ class _e {
|
|
|
4228
4175
|
}
|
|
4229
4176
|
}
|
|
4230
4177
|
}
|
|
4231
|
-
class
|
|
4178
|
+
class _e {
|
|
4232
4179
|
constructor() {
|
|
4233
4180
|
this.aliasToPath = /* @__PURE__ */ new Map(), this.pathStrToAlias = /* @__PURE__ */ new Map(), this.aliasPlaceholder = 0;
|
|
4234
4181
|
}
|
|
@@ -4242,7 +4189,7 @@ class We {
|
|
|
4242
4189
|
return this.aliasToPath.get(t);
|
|
4243
4190
|
}
|
|
4244
4191
|
}
|
|
4245
|
-
const
|
|
4192
|
+
const ye = ":root";
|
|
4246
4193
|
class bt {
|
|
4247
4194
|
constructor(t, e, i = []) {
|
|
4248
4195
|
this.label = t, this.parent = e, this.stack = i;
|
|
@@ -4257,9 +4204,9 @@ class bt {
|
|
|
4257
4204
|
return new bt(t, this);
|
|
4258
4205
|
}
|
|
4259
4206
|
}
|
|
4260
|
-
class
|
|
4207
|
+
class We {
|
|
4261
4208
|
constructor(t) {
|
|
4262
|
-
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(
|
|
4209
|
+
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(ye, t), this.recursiveSaveLabelledRecordQuery(t);
|
|
4263
4210
|
}
|
|
4264
4211
|
recursiveSaveLabelledRecordQuery(t) {
|
|
4265
4212
|
t.attributeQuery?.relatedRecords.forEach((e) => {
|
|
@@ -4273,9 +4220,9 @@ class Je {
|
|
|
4273
4220
|
return this.recordQueryByName.get(t);
|
|
4274
4221
|
}
|
|
4275
4222
|
}
|
|
4276
|
-
class
|
|
4223
|
+
class Je {
|
|
4277
4224
|
constructor(t, e) {
|
|
4278
|
-
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new
|
|
4225
|
+
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new Be(t, this), this.initializeFilteredEntityDependencies();
|
|
4279
4226
|
}
|
|
4280
4227
|
/**
|
|
4281
4228
|
* 初始化所有 filtered entity 的依赖关系
|
|
@@ -4334,8 +4281,8 @@ ${b}
|
|
|
4334
4281
|
// 查 entity 和 查 relation 都是一样的。具体在 entityQuery 里面区别。
|
|
4335
4282
|
// TODO 为了性能,也可以把信息丢到客户端,然客户端去结构化???
|
|
4336
4283
|
// CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
4337
|
-
async findRecords(t, e = "", i, r = new bt(
|
|
4338
|
-
if (i || (i = new
|
|
4284
|
+
async findRecords(t, e = "", i, r = new bt(ye)) {
|
|
4285
|
+
if (i || (i = new We(t)), t.goto) {
|
|
4339
4286
|
if (t.exit && await t.exit(r))
|
|
4340
4287
|
return [];
|
|
4341
4288
|
const d = i.get(t.goto);
|
|
@@ -4546,7 +4493,7 @@ ${b}
|
|
|
4546
4493
|
return t ? `${t}___` : "";
|
|
4547
4494
|
}
|
|
4548
4495
|
buildSelectClause(t, e = "") {
|
|
4549
|
-
const i = new
|
|
4496
|
+
const i = new _e();
|
|
4550
4497
|
return t.length ? [t.map(({ tableAliasAndField: s, attribute: a, nameContext: o }) => {
|
|
4551
4498
|
const n = [
|
|
4552
4499
|
`${this.withPrefix(e)}${o[0]}`,
|
|
@@ -5118,9 +5065,9 @@ WHERE "${s.idField}" = ${l()}
|
|
|
5118
5065
|
return p ? [N, ...p] : void 0;
|
|
5119
5066
|
}
|
|
5120
5067
|
}
|
|
5121
|
-
class
|
|
5068
|
+
class He {
|
|
5122
5069
|
constructor(t, e) {
|
|
5123
|
-
this.map = t, this.database = e, this.agent = new
|
|
5070
|
+
this.map = t, this.database = e, this.agent = new Je(t, e);
|
|
5124
5071
|
}
|
|
5125
5072
|
async findOne(t, e, i = {}, r) {
|
|
5126
5073
|
const s = {
|
|
@@ -5380,7 +5327,7 @@ class Rt {
|
|
|
5380
5327
|
return g(this.isFilteredRelation(), "only filtered relation can get resolved record name"), this.data.resolvedBaseRecordName;
|
|
5381
5328
|
}
|
|
5382
5329
|
}
|
|
5383
|
-
class
|
|
5330
|
+
class je {
|
|
5384
5331
|
constructor(t) {
|
|
5385
5332
|
this.data = t;
|
|
5386
5333
|
}
|
|
@@ -5576,7 +5523,7 @@ class Ue {
|
|
|
5576
5523
|
return r.join(".");
|
|
5577
5524
|
}
|
|
5578
5525
|
}
|
|
5579
|
-
function
|
|
5526
|
+
function Ue(u) {
|
|
5580
5527
|
const t = /* @__PURE__ */ new Map();
|
|
5581
5528
|
for (const e of u)
|
|
5582
5529
|
if (e.inputEntities)
|
|
@@ -5587,7 +5534,7 @@ function Ke(u) {
|
|
|
5587
5534
|
}
|
|
5588
5535
|
return t;
|
|
5589
5536
|
}
|
|
5590
|
-
function
|
|
5537
|
+
function Ke(u) {
|
|
5591
5538
|
const t = /* @__PURE__ */ new Map();
|
|
5592
5539
|
for (const e of u) {
|
|
5593
5540
|
const i = e.name || `${e.source.name}_${e.sourceProperty}_${e.targetProperty}_${e.target.name}`;
|
|
@@ -5601,8 +5548,8 @@ function Ge(u) {
|
|
|
5601
5548
|
}
|
|
5602
5549
|
return t;
|
|
5603
5550
|
}
|
|
5604
|
-
function
|
|
5605
|
-
const e = new
|
|
5551
|
+
function Ge(u, t) {
|
|
5552
|
+
const e = new me(u, t), i = Ue(u), r = Ke(t);
|
|
5606
5553
|
return ee(
|
|
5607
5554
|
u,
|
|
5608
5555
|
e,
|
|
@@ -5622,15 +5569,15 @@ function ee(u, t, e, i) {
|
|
|
5622
5569
|
});
|
|
5623
5570
|
if (r.length !== 0)
|
|
5624
5571
|
for (const s of r)
|
|
5625
|
-
|
|
5572
|
+
Xe(
|
|
5626
5573
|
s,
|
|
5627
5574
|
t,
|
|
5628
5575
|
i,
|
|
5629
5576
|
e
|
|
5630
5577
|
);
|
|
5631
5578
|
}
|
|
5632
|
-
function
|
|
5633
|
-
const r = e === "entity", a = `__${G(u)}_input_${e}`, o = r ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] =
|
|
5579
|
+
function Xe(u, t, e, i) {
|
|
5580
|
+
const r = e === "entity", a = `__${G(u)}_input_${e}`, o = r ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] = ei(
|
|
5634
5581
|
o,
|
|
5635
5582
|
a,
|
|
5636
5583
|
i,
|
|
@@ -5640,7 +5587,7 @@ function ze(u, t, e, i) {
|
|
|
5640
5587
|
const l = pt(u);
|
|
5641
5588
|
if (l)
|
|
5642
5589
|
for (const d of l)
|
|
5643
|
-
|
|
5590
|
+
ze(
|
|
5644
5591
|
d,
|
|
5645
5592
|
c,
|
|
5646
5593
|
a,
|
|
@@ -5648,8 +5595,8 @@ function ze(u, t, e, i) {
|
|
|
5648
5595
|
r
|
|
5649
5596
|
);
|
|
5650
5597
|
}
|
|
5651
|
-
function
|
|
5652
|
-
const [s, a] =
|
|
5598
|
+
function ze(u, t, e, i, r) {
|
|
5599
|
+
const [s, a] = ii(
|
|
5653
5600
|
u,
|
|
5654
5601
|
t,
|
|
5655
5602
|
e
|
|
@@ -5659,7 +5606,7 @@ function Ye(u, t, e, i, r) {
|
|
|
5659
5606
|
const o = G(a), n = r ? i.getEntityByName(o) : i.getRelationByName(o);
|
|
5660
5607
|
n && i.replace(s, n);
|
|
5661
5608
|
}
|
|
5662
|
-
function
|
|
5609
|
+
function Ye(u, t) {
|
|
5663
5610
|
const e = /* @__PURE__ */ new Map(), i = pt(u);
|
|
5664
5611
|
if (i && i.length > 0)
|
|
5665
5612
|
for (const r of i) {
|
|
@@ -5673,8 +5620,8 @@ function Ze(u, t) {
|
|
|
5673
5620
|
}
|
|
5674
5621
|
return e;
|
|
5675
5622
|
}
|
|
5676
|
-
function
|
|
5677
|
-
const i =
|
|
5623
|
+
function Ze(u, t, e) {
|
|
5624
|
+
const i = Ye(t, e);
|
|
5678
5625
|
return v.create({
|
|
5679
5626
|
name: u,
|
|
5680
5627
|
type: "json",
|
|
@@ -5686,14 +5633,14 @@ function ti(u, t, e) {
|
|
|
5686
5633
|
}
|
|
5687
5634
|
});
|
|
5688
5635
|
}
|
|
5689
|
-
function
|
|
5636
|
+
function ti(u, t, e) {
|
|
5690
5637
|
const i = pt(u), r = [], s = /* @__PURE__ */ new Map(), a = {};
|
|
5691
5638
|
for (const o of i) {
|
|
5692
5639
|
let n = o;
|
|
5693
5640
|
if (ht(n))
|
|
5694
5641
|
for (; n.baseEntity && n.properties.length === 0; )
|
|
5695
5642
|
n = n.baseEntity;
|
|
5696
|
-
else if (
|
|
5643
|
+
else if (si(n))
|
|
5697
5644
|
for (; n.baseRelation && n.properties.length === 0; )
|
|
5698
5645
|
n = n.baseRelation;
|
|
5699
5646
|
const c = Object.fromEntries(n.properties.map((h) => [h.name, h]));
|
|
@@ -5723,13 +5670,13 @@ function ei(u, t, e) {
|
|
|
5723
5670
|
}
|
|
5724
5671
|
return r;
|
|
5725
5672
|
}
|
|
5726
|
-
function
|
|
5727
|
-
const r =
|
|
5673
|
+
function ei(u, t, e, i) {
|
|
5674
|
+
const r = Ze(
|
|
5728
5675
|
t,
|
|
5729
5676
|
u,
|
|
5730
5677
|
e
|
|
5731
5678
|
), s = [
|
|
5732
|
-
...
|
|
5679
|
+
...ti(
|
|
5733
5680
|
u,
|
|
5734
5681
|
e,
|
|
5735
5682
|
i
|
|
@@ -5787,7 +5734,7 @@ function ii(u, t, e, i) {
|
|
|
5787
5734
|
return [o, n || o];
|
|
5788
5735
|
}
|
|
5789
5736
|
}
|
|
5790
|
-
function
|
|
5737
|
+
function ii(u, t, e) {
|
|
5791
5738
|
if (ht(u)) {
|
|
5792
5739
|
const i = u, r = t;
|
|
5793
5740
|
let s = i;
|
|
@@ -5801,7 +5748,7 @@ function ri(u, t, e) {
|
|
|
5801
5748
|
}), [a, s];
|
|
5802
5749
|
} else {
|
|
5803
5750
|
const i = u, r = t, s = G(i);
|
|
5804
|
-
return i.baseRelation ? [i,
|
|
5751
|
+
return i.baseRelation ? [i, ri(i)] : [P.create({
|
|
5805
5752
|
name: s,
|
|
5806
5753
|
baseRelation: r,
|
|
5807
5754
|
sourceProperty: i.sourceProperty,
|
|
@@ -5813,7 +5760,7 @@ function ri(u, t, e) {
|
|
|
5813
5760
|
}), i];
|
|
5814
5761
|
}
|
|
5815
5762
|
}
|
|
5816
|
-
function
|
|
5763
|
+
function ri(u) {
|
|
5817
5764
|
let t = u;
|
|
5818
5765
|
for (; t.baseRelation; )
|
|
5819
5766
|
t = t.baseRelation;
|
|
@@ -5822,7 +5769,7 @@ function si(u) {
|
|
|
5822
5769
|
function ht(u) {
|
|
5823
5770
|
return "inputEntities" in u || !("sourceProperty" in u);
|
|
5824
5771
|
}
|
|
5825
|
-
function
|
|
5772
|
+
function si(u) {
|
|
5826
5773
|
return "sourceProperty" in u;
|
|
5827
5774
|
}
|
|
5828
5775
|
function pt(u) {
|
|
@@ -5831,7 +5778,7 @@ function pt(u) {
|
|
|
5831
5778
|
function G(u) {
|
|
5832
5779
|
return ht(u), u.name;
|
|
5833
5780
|
}
|
|
5834
|
-
class
|
|
5781
|
+
class ai {
|
|
5835
5782
|
constructor(t, e, i, r = []) {
|
|
5836
5783
|
this.entities = t, this.relations = e, this.database = i, this.mergeLinks = r, this.fieldNameMap = /* @__PURE__ */ new Map(), this.usedFieldNames = /* @__PURE__ */ new Set(), this.fieldCounter = 1, this.recordToTableMap = /* @__PURE__ */ new Map(), this.tableToRecordsMap = /* @__PURE__ */ new Map(), this.mergeLog = [], this.tables = {}, this.map = { links: {}, records: {} }, this.buildMap(), this.buildTables();
|
|
5837
5784
|
}
|
|
@@ -6110,7 +6057,7 @@ class oi {
|
|
|
6110
6057
|
* 统一处理 merged entities 和 merged relations
|
|
6111
6058
|
*/
|
|
6112
6059
|
processMergedItems() {
|
|
6113
|
-
const t =
|
|
6060
|
+
const t = Ge(
|
|
6114
6061
|
this.entities,
|
|
6115
6062
|
this.relations
|
|
6116
6063
|
);
|
|
@@ -6224,7 +6171,7 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
6224
6171
|
return this.fieldCounter++, this.fieldNameMap.set(t, r), this.usedFieldNames.add(r), r;
|
|
6225
6172
|
}
|
|
6226
6173
|
}
|
|
6227
|
-
const X = "_System_", q = "_Dictionary_", ie = "id", re = "_rowId",
|
|
6174
|
+
const X = "_System_", q = "_Dictionary_", ie = "id", re = "_rowId", oi = I.create({
|
|
6228
6175
|
name: X,
|
|
6229
6176
|
properties: [
|
|
6230
6177
|
v.create({
|
|
@@ -6243,7 +6190,7 @@ const X = "_System_", q = "_Dictionary_", ie = "id", re = "_rowId", ni = I.creat
|
|
|
6243
6190
|
collection: !1
|
|
6244
6191
|
})
|
|
6245
6192
|
]
|
|
6246
|
-
}),
|
|
6193
|
+
}), ni = I.create({
|
|
6247
6194
|
name: q,
|
|
6248
6195
|
properties: [
|
|
6249
6196
|
v.create({
|
|
@@ -6257,8 +6204,8 @@ const X = "_System_", q = "_Dictionary_", ie = "id", re = "_rowId", ni = I.creat
|
|
|
6257
6204
|
collection: !1
|
|
6258
6205
|
})
|
|
6259
6206
|
]
|
|
6260
|
-
}),
|
|
6261
|
-
class
|
|
6207
|
+
}), yr = 0, It = 1, gr = 2;
|
|
6208
|
+
class ci {
|
|
6262
6209
|
constructor(t, e) {
|
|
6263
6210
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
6264
6211
|
}
|
|
@@ -6488,28 +6435,28 @@ class S {
|
|
|
6488
6435
|
this.skip = () => new wt();
|
|
6489
6436
|
}
|
|
6490
6437
|
static {
|
|
6491
|
-
this.resolved = (t, e) => new
|
|
6438
|
+
this.resolved = (t, e) => new Re(t, e);
|
|
6492
6439
|
}
|
|
6493
6440
|
static {
|
|
6494
|
-
this.async = (t) => new
|
|
6441
|
+
this.async = (t) => new be(t);
|
|
6495
6442
|
}
|
|
6496
6443
|
static {
|
|
6497
|
-
this.fullRecompute = (t) => new
|
|
6444
|
+
this.fullRecompute = (t) => new ge(t);
|
|
6498
6445
|
}
|
|
6499
6446
|
}
|
|
6500
6447
|
class wt extends S {
|
|
6501
6448
|
}
|
|
6502
|
-
class
|
|
6449
|
+
class ge extends S {
|
|
6503
6450
|
constructor(t) {
|
|
6504
6451
|
super(), this.reason = t;
|
|
6505
6452
|
}
|
|
6506
6453
|
}
|
|
6507
|
-
class
|
|
6454
|
+
class be extends S {
|
|
6508
6455
|
constructor(t) {
|
|
6509
6456
|
super(), this.args = t;
|
|
6510
6457
|
}
|
|
6511
6458
|
}
|
|
6512
|
-
class
|
|
6459
|
+
class Re extends S {
|
|
6513
6460
|
constructor(t, e) {
|
|
6514
6461
|
super(), this.result = t, this.args = e;
|
|
6515
6462
|
}
|
|
@@ -6551,7 +6498,7 @@ function $t(u, t) {
|
|
|
6551
6498
|
return !1;
|
|
6552
6499
|
return !0;
|
|
6553
6500
|
}
|
|
6554
|
-
class
|
|
6501
|
+
class we {
|
|
6555
6502
|
constructor(t) {
|
|
6556
6503
|
this.data = t, this.map = {};
|
|
6557
6504
|
for (const e of t.transfers)
|
|
@@ -6577,32 +6524,32 @@ function T(u, t) {
|
|
|
6577
6524
|
if (!u)
|
|
6578
6525
|
throw new Error(t);
|
|
6579
6526
|
}
|
|
6580
|
-
function
|
|
6527
|
+
function br(u, t) {
|
|
6581
6528
|
return new Map(Array.from(u.entries()).map(([e, i]) => [e, t(e, i)]));
|
|
6582
6529
|
}
|
|
6583
|
-
function
|
|
6530
|
+
function Rr(u, t) {
|
|
6584
6531
|
return Object.fromEntries(Object.entries(u).map(([e, i]) => [e, t(e, i)]));
|
|
6585
6532
|
}
|
|
6586
|
-
async function
|
|
6533
|
+
async function wr(u, t) {
|
|
6587
6534
|
for (let e of u)
|
|
6588
6535
|
if (!await t(e)) return !1;
|
|
6589
6536
|
return !0;
|
|
6590
6537
|
}
|
|
6591
|
-
async function
|
|
6538
|
+
async function li(u, t) {
|
|
6592
6539
|
for (let e of u)
|
|
6593
6540
|
if (await t(e)) return !0;
|
|
6594
6541
|
return !1;
|
|
6595
6542
|
}
|
|
6596
|
-
async function
|
|
6543
|
+
async function ui(u, t) {
|
|
6597
6544
|
for (let e of u) {
|
|
6598
6545
|
const i = await t(e);
|
|
6599
6546
|
if (i !== !0) return i;
|
|
6600
6547
|
}
|
|
6601
6548
|
return !0;
|
|
6602
6549
|
}
|
|
6603
|
-
class
|
|
6550
|
+
class di {
|
|
6604
6551
|
constructor(t, e, i) {
|
|
6605
|
-
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6552
|
+
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new we(this.args), this.initialState = this.args.initialState;
|
|
6606
6553
|
for (const r of this.args.transfers) {
|
|
6607
6554
|
const s = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6608
6555
|
this.eventDeps[s] = {
|
|
@@ -6630,9 +6577,9 @@ class hi {
|
|
|
6630
6577
|
return s ? (await this.state.currentState.set(s.name), s.computeValue ? await s.computeValue.call(this.controller, t, e) : s.name) : S.skip();
|
|
6631
6578
|
}
|
|
6632
6579
|
}
|
|
6633
|
-
class
|
|
6580
|
+
class hi {
|
|
6634
6581
|
constructor(t, e, i) {
|
|
6635
|
-
this.controller = t, this.args = e, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6582
|
+
this.controller = t, this.args = e, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new we(this.args), this.initialState = this.args.initialState, this.dataContext = i;
|
|
6636
6583
|
for (const r of this.args.transfers) {
|
|
6637
6584
|
const s = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6638
6585
|
this.eventDeps[s] = {
|
|
@@ -6677,17 +6624,17 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6677
6624
|
};
|
|
6678
6625
|
}
|
|
6679
6626
|
}
|
|
6680
|
-
const
|
|
6627
|
+
const Nr = K.create({
|
|
6681
6628
|
name: "nonExistent",
|
|
6682
6629
|
computeValue: () => null
|
|
6683
|
-
}),
|
|
6630
|
+
}), vr = K.create({
|
|
6684
6631
|
name: "nonDeleted",
|
|
6685
6632
|
computeValue: () => !1
|
|
6686
|
-
}),
|
|
6633
|
+
}), kr = K.create({
|
|
6687
6634
|
name: "deleted",
|
|
6688
6635
|
computeValue: () => !0
|
|
6689
|
-
}),
|
|
6690
|
-
class
|
|
6636
|
+
}), pi = [di, hi];
|
|
6637
|
+
class fi {
|
|
6691
6638
|
constructor(t, e, i) {
|
|
6692
6639
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.matchRecordToWeight = this.args.callback.bind(this.controller), this.record = this.args.record, this.dataDeps = {
|
|
6693
6640
|
main: {
|
|
@@ -6740,7 +6687,7 @@ class mi {
|
|
|
6740
6687
|
return i;
|
|
6741
6688
|
}
|
|
6742
6689
|
}
|
|
6743
|
-
class
|
|
6690
|
+
class mi {
|
|
6744
6691
|
constructor(t, e, i) {
|
|
6745
6692
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.matchRecordToWeight = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((a) => a.source === i.host && a.sourceProperty === this.args.property || a.target === i.host && a.targetProperty === this.args.property), T(this.relation, "weighted summation computation must specify property"), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === i.host.name, T(this.isSource ? this.relation.source === i.host : this.relation.target === i.host, "weighted summation computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
6746
6693
|
const r = this.args.attributeQuery || [];
|
|
@@ -6816,8 +6763,8 @@ class yi {
|
|
|
6816
6763
|
return s;
|
|
6817
6764
|
}
|
|
6818
6765
|
}
|
|
6819
|
-
const
|
|
6820
|
-
class
|
|
6766
|
+
const yi = [fi, mi];
|
|
6767
|
+
class gi {
|
|
6821
6768
|
constructor(t, e, i) {
|
|
6822
6769
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6823
6770
|
main: {
|
|
@@ -6870,7 +6817,7 @@ class bi {
|
|
|
6870
6817
|
return a === s;
|
|
6871
6818
|
}
|
|
6872
6819
|
}
|
|
6873
|
-
class
|
|
6820
|
+
class bi {
|
|
6874
6821
|
constructor(t, e, i) {
|
|
6875
6822
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((a) => a.source === i.host && a.sourceProperty === this.args.property || a.target === i.host && a.targetProperty === this.args.property), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === i.host.name, T(this.isSource ? this.relation.source === i.host : this.relation.target === i.host, "every computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
6876
6823
|
const r = this.args.attributeQuery || [];
|
|
@@ -6944,8 +6891,8 @@ class Ri {
|
|
|
6944
6891
|
return a === o;
|
|
6945
6892
|
}
|
|
6946
6893
|
}
|
|
6947
|
-
const
|
|
6948
|
-
class
|
|
6894
|
+
const Ri = [gi, bi];
|
|
6895
|
+
class wi {
|
|
6949
6896
|
constructor(t, e, i) {
|
|
6950
6897
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6951
6898
|
main: {
|
|
@@ -6998,7 +6945,7 @@ class Ni {
|
|
|
6998
6945
|
return s > 0;
|
|
6999
6946
|
}
|
|
7000
6947
|
}
|
|
7001
|
-
class
|
|
6948
|
+
class Ni {
|
|
7002
6949
|
constructor(t, e, i) {
|
|
7003
6950
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((n) => n.source === i.host && n.sourceProperty === this.args.property || n.target === i.host && n.targetProperty === this.args.property), T(this.relation, `cannot find relation for property ${this.args.property} in "Any" computation`), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === i.host.name, T(this.isSource ? this.relation.source === i.host : this.relation.target === i.host, "any computation relation direction error");
|
|
7004
6951
|
let r = this.relation.baseRelation || this.relation;
|
|
@@ -7074,8 +7021,8 @@ class vi {
|
|
|
7074
7021
|
return s > 0;
|
|
7075
7022
|
}
|
|
7076
7023
|
}
|
|
7077
|
-
const
|
|
7078
|
-
class
|
|
7024
|
+
const vi = [wi, Ni];
|
|
7025
|
+
class ki {
|
|
7079
7026
|
constructor(t, e, i) {
|
|
7080
7027
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.record = this.args.record, this.callback = this.args.callback?.bind(this) || (() => !0), this.dataDeps = {
|
|
7081
7028
|
main: {
|
|
@@ -7125,7 +7072,7 @@ class Ti {
|
|
|
7125
7072
|
return s = Math.max(0, s), await this.state.count.set(s), s;
|
|
7126
7073
|
}
|
|
7127
7074
|
}
|
|
7128
|
-
class
|
|
7075
|
+
class Ti {
|
|
7129
7076
|
constructor(t, e, i) {
|
|
7130
7077
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback?.bind(this.controller), this.args.property ? this.relation = this.controller.relations.find((a) => a.source === i.host && a.sourceProperty === this.args.property || a.target === i.host && a.targetProperty === this.args.property) : this.relation = this.args.record, this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === i.host.name, T(this.isSource ? this.relation.source === i.host : this.relation.target === i.host, "count computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7131
7078
|
const r = this.args.attributeQuery || [];
|
|
@@ -7207,8 +7154,8 @@ class Ai {
|
|
|
7207
7154
|
return a;
|
|
7208
7155
|
}
|
|
7209
7156
|
}
|
|
7210
|
-
const
|
|
7211
|
-
class
|
|
7157
|
+
const Ai = [ki, Ti];
|
|
7158
|
+
class Si {
|
|
7212
7159
|
constructor(t, e, i) {
|
|
7213
7160
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, T(!(this.args.record && this.args.eventDeps), "Transform must have either record or eventDep"), T(!(this.args.dataDeps && this.args.eventDeps), "Transform must have either dataDeps or eventDeps"), this.transformCallback = this.args.callback.bind(this.controller), this.args.eventDeps ? this.eventDeps = this.args.eventDeps : (T(this.args.dataDeps?._source === void 0, "dataDep name `_source` is reserved for Transform"), this.dataDeps = {
|
|
7214
7161
|
...this.args.dataDeps || {},
|
|
@@ -7316,7 +7263,7 @@ class Ei {
|
|
|
7316
7263
|
return r;
|
|
7317
7264
|
}
|
|
7318
7265
|
}
|
|
7319
|
-
const
|
|
7266
|
+
const Ei = [Si];
|
|
7320
7267
|
class M {
|
|
7321
7268
|
constructor(t) {
|
|
7322
7269
|
this.node = t;
|
|
@@ -7588,7 +7535,7 @@ class Xt {
|
|
|
7588
7535
|
}
|
|
7589
7536
|
}
|
|
7590
7537
|
}
|
|
7591
|
-
class
|
|
7538
|
+
class Ii {
|
|
7592
7539
|
constructor(t, e, i) {
|
|
7593
7540
|
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
7541
|
}
|
|
@@ -7620,7 +7567,7 @@ class Ci {
|
|
|
7620
7567
|
return await this.state.lastRecomputeTime.set(i), await this.state.nextRecomputeTime.set(s), r;
|
|
7621
7568
|
}
|
|
7622
7569
|
}
|
|
7623
|
-
class
|
|
7570
|
+
class Ci {
|
|
7624
7571
|
constructor(t, e, i) {
|
|
7625
7572
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = {
|
|
7626
7573
|
_current: {
|
|
@@ -7658,8 +7605,8 @@ class xi {
|
|
|
7658
7605
|
return await this.state.lastRecomputeTime.set(e, r), await this.state.nextRecomputeTime.set(e, a), s;
|
|
7659
7606
|
}
|
|
7660
7607
|
}
|
|
7661
|
-
const
|
|
7662
|
-
class
|
|
7608
|
+
const xi = [Ii, Ci];
|
|
7609
|
+
class Mi {
|
|
7663
7610
|
constructor(t, e, i) {
|
|
7664
7611
|
if (this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
|
|
7665
7612
|
throw new Error("Sum computation requires attributeQuery with at least one field");
|
|
@@ -7720,7 +7667,7 @@ class Pi {
|
|
|
7720
7667
|
return s;
|
|
7721
7668
|
}
|
|
7722
7669
|
}
|
|
7723
|
-
class
|
|
7670
|
+
class Pi {
|
|
7724
7671
|
constructor(t, e, i) {
|
|
7725
7672
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.relation = this.controller.relations.find((o) => o.source === i.host && o.sourceProperty === this.args.property || o.target === i.host && o.targetProperty === this.args.property), T(this.relation, "summation computation must specify either property or record"), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === i.host.name, T(this.isSource ? this.relation.source === i.host : this.relation.target === i.host, "summation computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7726
7673
|
const r = this.args.attributeQuery || [];
|
|
@@ -7809,7 +7756,7 @@ class $i {
|
|
|
7809
7756
|
return a;
|
|
7810
7757
|
}
|
|
7811
7758
|
}
|
|
7812
|
-
const
|
|
7759
|
+
const $i = [Mi, Pi];
|
|
7813
7760
|
class Fi {
|
|
7814
7761
|
constructor(t, e, i) {
|
|
7815
7762
|
if (this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
|
|
@@ -7883,7 +7830,7 @@ class Fi {
|
|
|
7883
7830
|
return await this.state.sum.set(a), await this.state.count.set(s), s > 0 ? a / s : 0;
|
|
7884
7831
|
}
|
|
7885
7832
|
}
|
|
7886
|
-
class
|
|
7833
|
+
class Oi {
|
|
7887
7834
|
constructor(t, e, i) {
|
|
7888
7835
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.relation = this.controller.relations.find((o) => o.source === i.host && o.sourceProperty === this.args.property || o.target === i.host && o.targetProperty === this.args.property), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === i.host.name, T(this.isSource ? this.relation.source === i.host : this.relation.target === i.host, "average computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7889
7836
|
const r = this.args.attributeQuery || [];
|
|
@@ -7967,7 +7914,7 @@ class Di {
|
|
|
7967
7914
|
return await this.state.count.set(e.record, a), a > 0 ? o / a : 0;
|
|
7968
7915
|
}
|
|
7969
7916
|
}
|
|
7970
|
-
const
|
|
7917
|
+
const Di = [Fi, Oi];
|
|
7971
7918
|
class St {
|
|
7972
7919
|
constructor(t, e, i) {
|
|
7973
7920
|
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) => {
|
|
@@ -8039,22 +7986,22 @@ class St {
|
|
|
8039
7986
|
return S.skip();
|
|
8040
7987
|
}
|
|
8041
7988
|
}
|
|
8042
|
-
class
|
|
7989
|
+
class Vi extends St {
|
|
8043
7990
|
static {
|
|
8044
7991
|
this.contextType = "global";
|
|
8045
7992
|
}
|
|
8046
7993
|
}
|
|
8047
|
-
class
|
|
7994
|
+
class Qi extends St {
|
|
8048
7995
|
static {
|
|
8049
7996
|
this.contextType = "entity";
|
|
8050
7997
|
}
|
|
8051
7998
|
}
|
|
8052
|
-
class
|
|
7999
|
+
class Li extends St {
|
|
8053
8000
|
static {
|
|
8054
8001
|
this.contextType = "relation";
|
|
8055
8002
|
}
|
|
8056
8003
|
}
|
|
8057
|
-
class
|
|
8004
|
+
class qi extends St {
|
|
8058
8005
|
static {
|
|
8059
8006
|
this.contextType = "property";
|
|
8060
8007
|
}
|
|
@@ -8069,11 +8016,11 @@ If you want to use aggregated data from all records in the entity/relation, you
|
|
|
8069
8016
|
super(t, e, i);
|
|
8070
8017
|
}
|
|
8071
8018
|
}
|
|
8072
|
-
const
|
|
8019
|
+
const Bi = [
|
|
8020
|
+
Vi,
|
|
8073
8021
|
Qi,
|
|
8074
8022
|
Li,
|
|
8075
|
-
qi
|
|
8076
|
-
Bi
|
|
8023
|
+
qi
|
|
8077
8024
|
];
|
|
8078
8025
|
class W extends Error {
|
|
8079
8026
|
constructor(t, e = {}) {
|
|
@@ -8192,7 +8139,7 @@ Stack trace:`, r.stack.split(`
|
|
|
8192
8139
|
return null;
|
|
8193
8140
|
}
|
|
8194
8141
|
}
|
|
8195
|
-
var
|
|
8142
|
+
var O = /* @__PURE__ */ ((u) => (u.LOW = "low", u.MEDIUM = "medium", u.HIGH = "high", u.CRITICAL = "critical", u))(O || {}), H = /* @__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))(H || {});
|
|
8196
8143
|
class z extends W {
|
|
8197
8144
|
constructor(t, e = {}) {
|
|
8198
8145
|
super(t, {
|
|
@@ -8206,7 +8153,7 @@ class z extends W {
|
|
|
8206
8153
|
...e.context
|
|
8207
8154
|
},
|
|
8208
8155
|
causedBy: e.causedBy
|
|
8209
|
-
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity ||
|
|
8156
|
+
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || O.HIGH;
|
|
8210
8157
|
}
|
|
8211
8158
|
}
|
|
8212
8159
|
class se extends W {
|
|
@@ -8222,7 +8169,7 @@ class se extends W {
|
|
|
8222
8169
|
...e.context
|
|
8223
8170
|
},
|
|
8224
8171
|
causedBy: e.causedBy
|
|
8225
|
-
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity ||
|
|
8172
|
+
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || O.MEDIUM;
|
|
8226
8173
|
}
|
|
8227
8174
|
}
|
|
8228
8175
|
class V extends W {
|
|
@@ -8238,14 +8185,14 @@ class V extends W {
|
|
|
8238
8185
|
...e.context
|
|
8239
8186
|
},
|
|
8240
8187
|
causedBy: e.causedBy
|
|
8241
|
-
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity ||
|
|
8188
|
+
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity || O.MEDIUM;
|
|
8242
8189
|
}
|
|
8243
8190
|
}
|
|
8244
8191
|
class ae extends V {
|
|
8245
8192
|
constructor(t, e = {}) {
|
|
8246
8193
|
super(t, {
|
|
8247
8194
|
...e,
|
|
8248
|
-
severity:
|
|
8195
|
+
severity: O.HIGH,
|
|
8249
8196
|
context: {
|
|
8250
8197
|
errorType: "ComputationStateError",
|
|
8251
8198
|
stateKey: e.stateKey,
|
|
@@ -8260,7 +8207,7 @@ class J extends V {
|
|
|
8260
8207
|
constructor(t, e = {}) {
|
|
8261
8208
|
super(t, {
|
|
8262
8209
|
...e,
|
|
8263
|
-
severity:
|
|
8210
|
+
severity: O.MEDIUM,
|
|
8264
8211
|
context: {
|
|
8265
8212
|
errorType: "ComputationDataDepError",
|
|
8266
8213
|
depName: e.depName,
|
|
@@ -8282,10 +8229,10 @@ class Ct extends W {
|
|
|
8282
8229
|
...e.context
|
|
8283
8230
|
},
|
|
8284
8231
|
causedBy: e.causedBy
|
|
8285
|
-
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity =
|
|
8232
|
+
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity = O.HIGH;
|
|
8286
8233
|
}
|
|
8287
8234
|
}
|
|
8288
|
-
class
|
|
8235
|
+
class _i extends W {
|
|
8289
8236
|
constructor(t, e) {
|
|
8290
8237
|
super(t, {
|
|
8291
8238
|
errorType: "SideEffectError",
|
|
@@ -8298,10 +8245,10 @@ class Wi extends W {
|
|
|
8298
8245
|
...e.context
|
|
8299
8246
|
},
|
|
8300
8247
|
causedBy: e.causedBy
|
|
8301
|
-
}), this.sideEffectName = e.sideEffectName, this.recordName = e.recordName, this.mutationType = e.mutationType, this.severity =
|
|
8248
|
+
}), this.sideEffectName = e.sideEffectName, this.recordName = e.recordName, this.mutationType = e.mutationType, this.severity = O.MEDIUM;
|
|
8302
8249
|
}
|
|
8303
8250
|
}
|
|
8304
|
-
class
|
|
8251
|
+
class F extends W {
|
|
8305
8252
|
constructor(t, e) {
|
|
8306
8253
|
super(t, {
|
|
8307
8254
|
errorType: e.context?.errorType || "ConditionError",
|
|
@@ -8314,16 +8261,16 @@ class O extends W {
|
|
|
8314
8261
|
...e.context
|
|
8315
8262
|
},
|
|
8316
8263
|
causedBy: e.causedBy
|
|
8317
|
-
}), this.checkType = e.checkType, this.fieldName = e.fieldName, this.payload = e.payload, this.evaluationError = e.evaluationError, this.error = e.evaluationError, this.type = e.type || t, this.severity = e.severity ||
|
|
8264
|
+
}), this.checkType = e.checkType, this.fieldName = e.fieldName, this.payload = e.payload, this.evaluationError = e.evaluationError, this.error = e.evaluationError, this.type = e.type || t, this.severity = e.severity || O.HIGH;
|
|
8318
8265
|
}
|
|
8319
8266
|
/**
|
|
8320
8267
|
* Helper factory methods for common condition error scenarios
|
|
8321
8268
|
*/
|
|
8322
8269
|
static userCheckFailed(t, e) {
|
|
8323
|
-
return new
|
|
8270
|
+
return new F("User check failed", {
|
|
8324
8271
|
checkType: "user",
|
|
8325
8272
|
evaluationError: t,
|
|
8326
|
-
severity:
|
|
8273
|
+
severity: O.HIGH,
|
|
8327
8274
|
context: e,
|
|
8328
8275
|
type: "check user failed"
|
|
8329
8276
|
// For backward compatibility
|
|
@@ -8331,21 +8278,21 @@ class O extends W {
|
|
|
8331
8278
|
}
|
|
8332
8279
|
static payloadValidationFailed(t, e, i, r) {
|
|
8333
8280
|
const s = `${t} ${e}`;
|
|
8334
|
-
return new
|
|
8281
|
+
return new F(`Payload validation failed for field '${t}': ${e}`, {
|
|
8335
8282
|
checkType: "payload",
|
|
8336
8283
|
fieldName: t,
|
|
8337
8284
|
payload: i,
|
|
8338
8285
|
evaluationError: r,
|
|
8339
|
-
severity:
|
|
8286
|
+
severity: O.MEDIUM,
|
|
8340
8287
|
type: s
|
|
8341
8288
|
// For backward compatibility
|
|
8342
8289
|
});
|
|
8343
8290
|
}
|
|
8344
8291
|
static conditionCheckFailed(t, e) {
|
|
8345
|
-
return new
|
|
8292
|
+
return new F(`Condition check failed: ${t.data.name}`, {
|
|
8346
8293
|
checkType: "condition",
|
|
8347
8294
|
evaluationError: t,
|
|
8348
|
-
severity:
|
|
8295
|
+
severity: O.HIGH,
|
|
8349
8296
|
context: e,
|
|
8350
8297
|
type: "condition check failed"
|
|
8351
8298
|
// For backward compatibility
|
|
@@ -8353,31 +8300,31 @@ class O extends W {
|
|
|
8353
8300
|
}
|
|
8354
8301
|
static attributiveCheckFailed(t, e, i, r) {
|
|
8355
8302
|
const s = `${t} ${e}`;
|
|
8356
|
-
return new
|
|
8303
|
+
return new F(`Attributive check failed for field '${t}': ${e}`, {
|
|
8357
8304
|
checkType: "attributive",
|
|
8358
8305
|
fieldName: t,
|
|
8359
8306
|
payload: i,
|
|
8360
8307
|
evaluationError: r,
|
|
8361
|
-
severity:
|
|
8308
|
+
severity: O.MEDIUM,
|
|
8362
8309
|
type: s
|
|
8363
8310
|
// For backward compatibility
|
|
8364
8311
|
});
|
|
8365
8312
|
}
|
|
8366
8313
|
static conceptCheckFailed(t, e) {
|
|
8367
|
-
return new
|
|
8314
|
+
return new F(`Concept check failed for field '${t}'`, {
|
|
8368
8315
|
checkType: "concept",
|
|
8369
8316
|
fieldName: t,
|
|
8370
8317
|
evaluationError: e,
|
|
8371
|
-
severity:
|
|
8318
|
+
severity: O.MEDIUM,
|
|
8372
8319
|
type: `${t} check concept failed`
|
|
8373
8320
|
// For backward compatibility
|
|
8374
8321
|
});
|
|
8375
8322
|
}
|
|
8376
8323
|
}
|
|
8377
8324
|
const xt = "_ASYNC_TASK_";
|
|
8378
|
-
class
|
|
8325
|
+
class Wi {
|
|
8379
8326
|
constructor(t, e, i, r, s) {
|
|
8380
|
-
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new
|
|
8327
|
+
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new ci(this.controller, this), this.buildComputationHandleMap(s);
|
|
8381
8328
|
const a = [];
|
|
8382
8329
|
r.forEach((o) => {
|
|
8383
8330
|
o.computation && a.push({ dataContext: { type: "global", id: o }, args: o.computation });
|
|
@@ -8800,7 +8747,7 @@ class Ji {
|
|
|
8800
8747
|
dataContext: t.dataContext,
|
|
8801
8748
|
computationPhase: "type-validation"
|
|
8802
8749
|
});
|
|
8803
|
-
if (s instanceof
|
|
8750
|
+
if (s instanceof ge) {
|
|
8804
8751
|
const o = t;
|
|
8805
8752
|
if (!o.compute)
|
|
8806
8753
|
throw new V("compute must be defined for computation when incrementalCompute returns ComputationResultFullRecompute", {
|
|
@@ -8823,7 +8770,7 @@ class Ji {
|
|
|
8823
8770
|
}
|
|
8824
8771
|
if (s instanceof wt)
|
|
8825
8772
|
return;
|
|
8826
|
-
if (s instanceof
|
|
8773
|
+
if (s instanceof be)
|
|
8827
8774
|
try {
|
|
8828
8775
|
return await this.createAsyncTask(t, s.args, i);
|
|
8829
8776
|
} catch (o) {
|
|
@@ -8836,7 +8783,7 @@ class Ji {
|
|
|
8836
8783
|
});
|
|
8837
8784
|
}
|
|
8838
8785
|
try {
|
|
8839
|
-
const o = s instanceof
|
|
8786
|
+
const o = s instanceof Re ? await t.asyncReturn(s.result, s.args) : s;
|
|
8840
8787
|
t.incrementalPatchCompute ? await this.controller.applyResultPatch(t.dataContext, o, i) : await this.controller.applyResult(t.dataContext, o, i);
|
|
8841
8788
|
} catch (o) {
|
|
8842
8789
|
throw new V("Failed to apply computation result", {
|
|
@@ -8926,7 +8873,7 @@ class Ji {
|
|
|
8926
8873
|
}
|
|
8927
8874
|
}
|
|
8928
8875
|
}
|
|
8929
|
-
class
|
|
8876
|
+
class Ne {
|
|
8930
8877
|
constructor(t, e, i) {
|
|
8931
8878
|
this.interaction = t, this.controller = e, this.activitySeqCall = i, this.system = e.system;
|
|
8932
8879
|
}
|
|
@@ -8960,7 +8907,7 @@ class ve {
|
|
|
8960
8907
|
this.interaction.userAttributives
|
|
8961
8908
|
), a = (o) => o.isRef ? i(o, t.user, e) : this.checkAttributive(o, t, t.user);
|
|
8962
8909
|
if (r = await this.checkAttributives(s, a, []), r === !0) return r;
|
|
8963
|
-
throw
|
|
8910
|
+
throw F.userCheckFailed(r);
|
|
8964
8911
|
}
|
|
8965
8912
|
// 用来check attributive 形容的后面的 target 到底是不是那个概念的实例。
|
|
8966
8913
|
async checkConcept(t, e, i, r = []) {
|
|
@@ -8980,7 +8927,7 @@ class ve {
|
|
|
8980
8927
|
}
|
|
8981
8928
|
if (this.isConceptAlias(e)) {
|
|
8982
8929
|
const s = [];
|
|
8983
|
-
return await
|
|
8930
|
+
return await li(e.for, async (o) => {
|
|
8984
8931
|
const n = await this.isConcept(t, o);
|
|
8985
8932
|
return n === !0 ? !0 : (s.push(n), !1);
|
|
8986
8933
|
}) ? !0 : { name: e.name, type: "conceptAlias", stack: r, error: s };
|
|
@@ -9008,25 +8955,25 @@ class ve {
|
|
|
9008
8955
|
throw new Error(`${s} in payload is not defined in interaction ${this.interaction.name}`);
|
|
9009
8956
|
for (let s of i) {
|
|
9010
8957
|
if (s.required && !(s.name in e))
|
|
9011
|
-
throw
|
|
8958
|
+
throw F.payloadValidationFailed(s.name, "missing", e);
|
|
9012
8959
|
const a = e[s.name];
|
|
9013
8960
|
if (a === void 0) return;
|
|
9014
8961
|
if (s.isCollection && !Array.isArray(a))
|
|
9015
|
-
throw
|
|
8962
|
+
throw F.payloadValidationFailed(s.name, "data is not array", a);
|
|
9016
8963
|
if (s.isCollection) {
|
|
9017
8964
|
if (s.isRef && !a.every((o) => !!o.id))
|
|
9018
|
-
throw
|
|
8965
|
+
throw F.payloadValidationFailed(s.name, "data not every is ref", a);
|
|
9019
8966
|
} else if (s.isRef && !a.id)
|
|
9020
|
-
throw
|
|
8967
|
+
throw F.payloadValidationFailed(s.name, "data is not a ref", a);
|
|
9021
8968
|
if (s.base)
|
|
9022
8969
|
if (s.isCollection) {
|
|
9023
|
-
const o = await
|
|
8970
|
+
const o = await ui(a, (n) => this.checkConcept(n, s.base));
|
|
9024
8971
|
if (o !== !0)
|
|
9025
|
-
throw
|
|
8972
|
+
throw F.conceptCheckFailed(s.name, o);
|
|
9026
8973
|
} else {
|
|
9027
8974
|
const o = await this.checkConcept(a, s.base);
|
|
9028
8975
|
if (o !== !0)
|
|
9029
|
-
throw
|
|
8976
|
+
throw F.conceptCheckFailed(s.name, o);
|
|
9030
8977
|
}
|
|
9031
8978
|
if (s.isRef) {
|
|
9032
8979
|
const o = s.isCollection ? m.atom({
|
|
@@ -9058,7 +9005,7 @@ class ve {
|
|
|
9058
9005
|
return !0;
|
|
9059
9006
|
}, r = await e.evaluateAsync(i);
|
|
9060
9007
|
if (r !== !0)
|
|
9061
|
-
throw
|
|
9008
|
+
throw F.conditionCheckFailed(r);
|
|
9062
9009
|
}
|
|
9063
9010
|
}
|
|
9064
9011
|
// CAUTION sideEffect 是并行的。如果要串行,用户应该自己写在一个里面
|
|
@@ -9076,7 +9023,7 @@ class ve {
|
|
|
9076
9023
|
T(!i.sideEffects[o], `sideEffect ${o} already exists`), i.sideEffects[o] = { result: n, error: c };
|
|
9077
9024
|
}
|
|
9078
9025
|
isGetInteraction() {
|
|
9079
|
-
return this.interaction.action ===
|
|
9026
|
+
return this.interaction.action === De;
|
|
9080
9027
|
}
|
|
9081
9028
|
async saveEvent(t) {
|
|
9082
9029
|
return await this.controller.activityManager.saveEvent(t);
|
|
@@ -9084,10 +9031,10 @@ class ve {
|
|
|
9084
9031
|
async retrieveData(t) {
|
|
9085
9032
|
let e;
|
|
9086
9033
|
if (I.is(this.interaction.data) || P.is(this.interaction.data)) {
|
|
9087
|
-
const i = this.interaction.data.name, r =
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
e = await this.system.storage.find(i,
|
|
9034
|
+
const i = this.interaction.data.name, r = this.interaction.dataPolicy?.match, s = this.interaction.dataPolicy?.modifier;
|
|
9035
|
+
this.interaction.dataPolicy?.attributeQuery;
|
|
9036
|
+
const a = { ...t.query?.modifier || {}, ...s || {} }, o = t.query?.attributeQuery || [], n = typeof r == "function" ? await r.call(this.controller, t) : r, c = n instanceof R ? n : n ? R.atom(n) : void 0, l = R.and(c, t.query?.match);
|
|
9037
|
+
e = await this.system.storage.find(i, l, a, o);
|
|
9091
9038
|
} else
|
|
9092
9039
|
T(!1, `unknown data type ${this.interaction.data}`);
|
|
9093
9040
|
return e;
|
|
@@ -9224,7 +9171,7 @@ class Y {
|
|
|
9224
9171
|
for (let o of t.interactions) {
|
|
9225
9172
|
const n = { content: o, next: null, uuid: o.uuid, parentGroup: e, parentSeq: r };
|
|
9226
9173
|
this.uuidToNode.set(o.uuid, n), this.rawToNode.set(o, n);
|
|
9227
|
-
const c = new
|
|
9174
|
+
const c = new Ne(o, this.controller, this);
|
|
9228
9175
|
this.uuidToInteractionCall.set(o.uuid, c), o.name && this.interactionCallByName.set(o.name, c);
|
|
9229
9176
|
}
|
|
9230
9177
|
for (let o of t.gateways) {
|
|
@@ -9340,7 +9287,7 @@ class Y {
|
|
|
9340
9287
|
}), await this.setActivity(t, { refs: r });
|
|
9341
9288
|
}
|
|
9342
9289
|
}
|
|
9343
|
-
class
|
|
9290
|
+
class Ji extends $ {
|
|
9344
9291
|
onChange(t, e) {
|
|
9345
9292
|
if (this.graph.isStartNode(t)) {
|
|
9346
9293
|
if (e)
|
|
@@ -9351,25 +9298,25 @@ class Hi extends $ {
|
|
|
9351
9298
|
}
|
|
9352
9299
|
}
|
|
9353
9300
|
}
|
|
9354
|
-
$.GroupStateNodeType.set("any",
|
|
9355
|
-
class
|
|
9301
|
+
$.GroupStateNodeType.set("any", Ji);
|
|
9302
|
+
class Hi extends $ {
|
|
9356
9303
|
onChange(t, e) {
|
|
9357
9304
|
this.isGroupCompleted() && this.complete();
|
|
9358
9305
|
}
|
|
9359
9306
|
}
|
|
9360
|
-
$.GroupStateNodeType.set("every",
|
|
9361
|
-
class
|
|
9307
|
+
$.GroupStateNodeType.set("every", Hi);
|
|
9308
|
+
class ji extends $ {
|
|
9362
9309
|
onChange(t, e) {
|
|
9363
9310
|
this.graph.isEndNode(t) && this.complete();
|
|
9364
9311
|
}
|
|
9365
9312
|
}
|
|
9366
|
-
$.GroupStateNodeType.set("race",
|
|
9367
|
-
class
|
|
9313
|
+
$.GroupStateNodeType.set("race", ji);
|
|
9314
|
+
class Ui extends $ {
|
|
9368
9315
|
// 可以根据 group 上的具体配置逻辑,来动态决定。
|
|
9369
9316
|
}
|
|
9370
|
-
$.GroupStateNodeType.set("program",
|
|
9371
|
-
const ne = new le(),
|
|
9372
|
-
name:
|
|
9317
|
+
$.GroupStateNodeType.set("program", Ui);
|
|
9318
|
+
const ne = new le(), Ft = "_Interaction_", gt = "_Activity_", ve = I.create({
|
|
9319
|
+
name: Ft,
|
|
9373
9320
|
properties: [
|
|
9374
9321
|
v.create({
|
|
9375
9322
|
name: "interactionId",
|
|
@@ -9397,7 +9344,7 @@ const ne = new le(), Ot = "_Interaction_", gt = "_Activity_", ke = I.create({
|
|
|
9397
9344
|
collection: !1
|
|
9398
9345
|
})
|
|
9399
9346
|
]
|
|
9400
|
-
}),
|
|
9347
|
+
}), ke = I.create({
|
|
9401
9348
|
name: gt,
|
|
9402
9349
|
properties: [
|
|
9403
9350
|
v.create({
|
|
@@ -9421,21 +9368,21 @@ const ne = new le(), Ot = "_Interaction_", gt = "_Activity_", ke = I.create({
|
|
|
9421
9368
|
collection: !1
|
|
9422
9369
|
})
|
|
9423
9370
|
]
|
|
9424
|
-
}),
|
|
9371
|
+
}), Ki = P.create({
|
|
9425
9372
|
name: "activityInteraction",
|
|
9426
|
-
source:
|
|
9373
|
+
source: ke,
|
|
9427
9374
|
sourceProperty: "interaction",
|
|
9428
|
-
target:
|
|
9375
|
+
target: ve,
|
|
9429
9376
|
targetProperty: "activity",
|
|
9430
9377
|
type: "1:n"
|
|
9431
9378
|
});
|
|
9432
|
-
class
|
|
9379
|
+
class Gi {
|
|
9433
9380
|
constructor(t, e, i) {
|
|
9434
|
-
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(
|
|
9381
|
+
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(ke, ve), this.controller.relations.push(Ki), e.forEach((r) => {
|
|
9435
9382
|
const s = new Y(r, t);
|
|
9436
9383
|
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));
|
|
9437
9384
|
}), i.forEach((r) => {
|
|
9438
|
-
const s = new
|
|
9385
|
+
const s = new Ne(r, t);
|
|
9439
9386
|
this.interactionCalls.set(r.uuid, s), r.name && (T(!this.interactionCallsByName.has(r.name), `interaction name ${r.name} is duplicated`), this.interactionCallsByName.set(r.name, s));
|
|
9440
9387
|
});
|
|
9441
9388
|
}
|
|
@@ -9542,10 +9489,10 @@ class Xi {
|
|
|
9542
9489
|
}));
|
|
9543
9490
|
}
|
|
9544
9491
|
async saveEvent(t) {
|
|
9545
|
-
return this.controller.system.storage.create(
|
|
9492
|
+
return this.controller.system.storage.create(Ft, t);
|
|
9546
9493
|
}
|
|
9547
9494
|
async getEvent(t) {
|
|
9548
|
-
return (await this.controller.system.storage.find(
|
|
9495
|
+
return (await this.controller.system.storage.find(Ft, t, void 0, ["*"])).map((e) => ({
|
|
9549
9496
|
...e
|
|
9550
9497
|
}));
|
|
9551
9498
|
}
|
|
@@ -9563,31 +9510,31 @@ class Xi {
|
|
|
9563
9510
|
}
|
|
9564
9511
|
}
|
|
9565
9512
|
const zt = new le();
|
|
9566
|
-
function
|
|
9513
|
+
function Xi() {
|
|
9567
9514
|
return zt.getStore()?.effects;
|
|
9568
9515
|
}
|
|
9569
9516
|
function ce(u) {
|
|
9570
9517
|
const t = zt.getStore();
|
|
9571
9518
|
t?.effects && t.effects.push(...u);
|
|
9572
9519
|
}
|
|
9573
|
-
const
|
|
9574
|
-
class
|
|
9520
|
+
const Tr = "User";
|
|
9521
|
+
class Te {
|
|
9575
9522
|
constructor(t) {
|
|
9576
9523
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
9577
9524
|
}
|
|
9578
9525
|
static create(t) {
|
|
9579
|
-
return new
|
|
9526
|
+
return new Te(t);
|
|
9580
9527
|
}
|
|
9581
9528
|
}
|
|
9582
|
-
const
|
|
9529
|
+
const Ot = "_isDeleted_", Ar = {
|
|
9583
9530
|
create() {
|
|
9584
9531
|
return v.create({
|
|
9585
|
-
name:
|
|
9532
|
+
name: Ot,
|
|
9586
9533
|
type: "boolean"
|
|
9587
9534
|
});
|
|
9588
9535
|
}
|
|
9589
9536
|
};
|
|
9590
|
-
class
|
|
9537
|
+
class Sr {
|
|
9591
9538
|
constructor(t) {
|
|
9592
9539
|
this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
|
|
9593
9540
|
BoolExp: R,
|
|
@@ -9606,21 +9553,21 @@ class Er {
|
|
|
9606
9553
|
forceThrowInteractionError: d = !1
|
|
9607
9554
|
// 会 catch 住 error,并在 result 中返回。
|
|
9608
9555
|
} = t;
|
|
9609
|
-
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
|
|
9556
|
+
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);
|
|
9610
9557
|
const h = [
|
|
9611
|
-
...
|
|
9612
|
-
...
|
|
9613
|
-
...
|
|
9614
|
-
...
|
|
9615
|
-
...
|
|
9616
|
-
|
|
9617
|
-
...
|
|
9618
|
-
...
|
|
9619
|
-
...
|
|
9620
|
-
...
|
|
9558
|
+
...Ai,
|
|
9559
|
+
...Ei,
|
|
9560
|
+
...vi,
|
|
9561
|
+
...Ri,
|
|
9562
|
+
...yi,
|
|
9563
|
+
...$i,
|
|
9564
|
+
...Di,
|
|
9565
|
+
...xi,
|
|
9566
|
+
...pi,
|
|
9567
|
+
...Bi,
|
|
9621
9568
|
...c
|
|
9622
9569
|
];
|
|
9623
|
-
this.scheduler = new
|
|
9570
|
+
this.scheduler = new Wi(this, this.entities, this.relations, this.dict, h), n.forEach((p) => {
|
|
9624
9571
|
let y = this.recordNameToSideEffects.get(p.record.name);
|
|
9625
9572
|
y || this.recordNameToSideEffects.set(p.record.name, y = /* @__PURE__ */ new Set()), y.add(p);
|
|
9626
9573
|
});
|
|
@@ -9659,7 +9606,7 @@ class Er {
|
|
|
9659
9606
|
await this.system.storage.create(r.id.name, a);
|
|
9660
9607
|
} else {
|
|
9661
9608
|
const r = t;
|
|
9662
|
-
r.id.name ===
|
|
9609
|
+
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 });
|
|
9663
9610
|
}
|
|
9664
9611
|
}
|
|
9665
9612
|
}
|
|
@@ -9682,7 +9629,7 @@ class Er {
|
|
|
9682
9629
|
}
|
|
9683
9630
|
} else {
|
|
9684
9631
|
const a = t;
|
|
9685
|
-
a.id.name ===
|
|
9632
|
+
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 });
|
|
9686
9633
|
}
|
|
9687
9634
|
}
|
|
9688
9635
|
}
|
|
@@ -9718,7 +9665,7 @@ class Er {
|
|
|
9718
9665
|
result: await a.content.call(this, r)
|
|
9719
9666
|
};
|
|
9720
9667
|
} catch (o) {
|
|
9721
|
-
const n = new
|
|
9668
|
+
const n = new _i(
|
|
9722
9669
|
`Side effect '${a.name}' failed for ${r.type} on ${r.recordName}`,
|
|
9723
9670
|
{
|
|
9724
9671
|
sideEffectName: a.name,
|
|
@@ -9744,13 +9691,13 @@ class Er {
|
|
|
9744
9691
|
this.callbacks.has(t) || this.callbacks.set(t, /* @__PURE__ */ new Set()), this.callbacks.get(t).add(e);
|
|
9745
9692
|
}
|
|
9746
9693
|
}
|
|
9747
|
-
function
|
|
9694
|
+
function zi(u) {
|
|
9748
9695
|
return encodeURI(JSON.stringify(u));
|
|
9749
9696
|
}
|
|
9750
|
-
function
|
|
9697
|
+
function Yi(u) {
|
|
9751
9698
|
return u === void 0 ? void 0 : JSON.parse(decodeURI(u));
|
|
9752
9699
|
}
|
|
9753
|
-
class
|
|
9700
|
+
class Zi {
|
|
9754
9701
|
constructor(t) {
|
|
9755
9702
|
this.db = t, this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
|
|
9756
9703
|
get: async (e) => {
|
|
@@ -9775,20 +9722,20 @@ class tr {
|
|
|
9775
9722
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
9776
9723
|
async get(t, e, i) {
|
|
9777
9724
|
const r = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(X, r, void 0, ["value"]))?.value;
|
|
9778
|
-
return s === void 0 ? i :
|
|
9725
|
+
return s === void 0 ? i : Yi(s);
|
|
9779
9726
|
}
|
|
9780
9727
|
async set(t, e, i, r) {
|
|
9781
9728
|
const s = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
9782
|
-
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:
|
|
9729
|
+
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);
|
|
9783
9730
|
}
|
|
9784
9731
|
async setup(t, e, i = !1) {
|
|
9785
9732
|
await this.db.open(i);
|
|
9786
|
-
const r = new
|
|
9733
|
+
const r = new ai(
|
|
9787
9734
|
t,
|
|
9788
9735
|
e,
|
|
9789
9736
|
this.db
|
|
9790
9737
|
);
|
|
9791
|
-
i && await r.createTables(), this.queryHandle = new
|
|
9738
|
+
i && await r.createTables(), this.queryHandle = new He(new je(r.map), this.db), this.map = r.map;
|
|
9792
9739
|
}
|
|
9793
9740
|
findOne(...t) {
|
|
9794
9741
|
return this.queryHandle.findOne(...t);
|
|
@@ -9808,7 +9755,7 @@ class tr {
|
|
|
9808
9755
|
async callWithEvents(t, e, i = []) {
|
|
9809
9756
|
const r = [], s = await t(...e, r), a = await this.dispatch(r);
|
|
9810
9757
|
i.push(...r, ...a);
|
|
9811
|
-
const o =
|
|
9758
|
+
const o = Xi();
|
|
9812
9759
|
return o && r.length > 0 && ce(r), o && a.length > 0 && ce(a), s;
|
|
9813
9760
|
}
|
|
9814
9761
|
findRelationByName(...t) {
|
|
@@ -9847,7 +9794,7 @@ class tr {
|
|
|
9847
9794
|
return this.db.close();
|
|
9848
9795
|
}
|
|
9849
9796
|
}
|
|
9850
|
-
var
|
|
9797
|
+
var tr = /* @__PURE__ */ ((u) => (u[u.ERROR = 0] = "ERROR", u[u.INFO = 1] = "INFO", u))(tr || {});
|
|
9851
9798
|
class Yt {
|
|
9852
9799
|
constructor(t = 0) {
|
|
9853
9800
|
this.level = t;
|
|
@@ -9862,7 +9809,7 @@ class Yt {
|
|
|
9862
9809
|
return new Yt(this.level);
|
|
9863
9810
|
}
|
|
9864
9811
|
}
|
|
9865
|
-
var
|
|
9812
|
+
var er = /* @__PURE__ */ ((u) => (u[u.MUTE = -1] = "MUTE", u[u.ERROR = 0] = "ERROR", u[u.INFO = 1] = "INFO", u[u.DEBUG = 2] = "DEBUG", u))(er || {});
|
|
9866
9813
|
class Zt {
|
|
9867
9814
|
constructor(t = 0) {
|
|
9868
9815
|
this.level = t;
|
|
@@ -9880,13 +9827,13 @@ class Zt {
|
|
|
9880
9827
|
return new Zt(this.level);
|
|
9881
9828
|
}
|
|
9882
9829
|
}
|
|
9883
|
-
const
|
|
9884
|
-
class
|
|
9885
|
-
constructor(t, e =
|
|
9886
|
-
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new
|
|
9830
|
+
const Er = new Yt(), ir = new Zt();
|
|
9831
|
+
class Ir {
|
|
9832
|
+
constructor(t, e = ir) {
|
|
9833
|
+
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new Zi(t);
|
|
9887
9834
|
}
|
|
9888
9835
|
setup(t, e, i, r = !1) {
|
|
9889
|
-
const s = new
|
|
9836
|
+
const s = new me(t, e), { entities: a, relations: o } = s.getAll();
|
|
9890
9837
|
return i.forEach(({ dataContext: n, state: c }) => {
|
|
9891
9838
|
Object.entries(c).forEach(([l, d]) => {
|
|
9892
9839
|
if (d instanceof E) {
|
|
@@ -9912,7 +9859,7 @@ class Cr {
|
|
|
9912
9859
|
}
|
|
9913
9860
|
});
|
|
9914
9861
|
}), this.storage.setup(
|
|
9915
|
-
[...a,
|
|
9862
|
+
[...a, ni, oi],
|
|
9916
9863
|
o,
|
|
9917
9864
|
r
|
|
9918
9865
|
);
|
|
@@ -9923,171 +9870,170 @@ class Cr {
|
|
|
9923
9870
|
}
|
|
9924
9871
|
export {
|
|
9925
9872
|
gt as ACTIVITY_RECORD,
|
|
9926
|
-
|
|
9873
|
+
Le as ALL_ATTR_SYMBOL,
|
|
9927
9874
|
xt as ASYNC_TASK_RECORD,
|
|
9928
9875
|
kt as Action,
|
|
9929
9876
|
qt as Activity,
|
|
9930
9877
|
Y as ActivityCall,
|
|
9931
9878
|
Z as ActivityGroup,
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9879
|
+
Ki as ActivityInteractionRelation,
|
|
9880
|
+
Gi as ActivityManager,
|
|
9881
|
+
ke as ActivityStateEntity,
|
|
9935
9882
|
ut as Any,
|
|
9936
|
-
|
|
9883
|
+
vi as AnyHandles,
|
|
9937
9884
|
_ as AttributeInfo,
|
|
9938
9885
|
C as AttributeQuery,
|
|
9939
9886
|
U as Attributive,
|
|
9940
9887
|
vt as Attributives,
|
|
9941
9888
|
ct as Average,
|
|
9942
|
-
|
|
9943
|
-
|
|
9889
|
+
Di as AverageHandles,
|
|
9890
|
+
ur as BaseKlass,
|
|
9944
9891
|
it as BoolAtomData,
|
|
9945
9892
|
R as BoolExp,
|
|
9946
9893
|
rt as BoolExpressionData,
|
|
9947
9894
|
J as ComputationDataDepError,
|
|
9948
9895
|
V as ComputationError,
|
|
9949
9896
|
S as ComputationResult,
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9897
|
+
be as ComputationResultAsync,
|
|
9898
|
+
ge as ComputationResultFullRecompute,
|
|
9899
|
+
Re as ComputationResultResolved,
|
|
9953
9900
|
wt as ComputationResultSkip,
|
|
9954
9901
|
ae as ComputationStateError,
|
|
9955
9902
|
Bt as Condition,
|
|
9956
|
-
|
|
9903
|
+
F as ConditionError,
|
|
9957
9904
|
At as Conditions,
|
|
9958
|
-
|
|
9905
|
+
Sr as Controller,
|
|
9959
9906
|
ot as Count,
|
|
9960
|
-
|
|
9907
|
+
Ai as CountHandles,
|
|
9961
9908
|
Gt as Custom,
|
|
9962
|
-
|
|
9909
|
+
Bi as CustomHandles,
|
|
9963
9910
|
Yt as DBConsoleLogger,
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9911
|
+
tr as DBLogLevel,
|
|
9912
|
+
ai as DBSetup,
|
|
9913
|
+
kr as DELETED_STATE,
|
|
9967
9914
|
q as DICTIONARY_RECORD,
|
|
9968
9915
|
_t as DataAttributive,
|
|
9969
9916
|
Kt as DataAttributives,
|
|
9917
|
+
fe as DataPolicy,
|
|
9970
9918
|
Qt as Dictionary,
|
|
9971
|
-
|
|
9919
|
+
ni as DictionaryEntity,
|
|
9972
9920
|
I as Entity,
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9921
|
+
Qi as EntityCustomHandle,
|
|
9922
|
+
He as EntityQueryHandle,
|
|
9923
|
+
je as EntityToTableMap,
|
|
9976
9924
|
Xt as Equation,
|
|
9977
9925
|
Wt as Event,
|
|
9978
9926
|
lt as Every,
|
|
9979
|
-
|
|
9927
|
+
Ri as EveryHandles,
|
|
9980
9928
|
M as Expression,
|
|
9981
9929
|
tt as Gateway,
|
|
9982
|
-
|
|
9983
|
-
|
|
9930
|
+
De as GetAction,
|
|
9931
|
+
wi as GlobalAnyHandle,
|
|
9984
9932
|
Fi as GlobalAverageHandle,
|
|
9985
9933
|
B as GlobalBoundState,
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9934
|
+
ki as GlobalCountHandle,
|
|
9935
|
+
Vi as GlobalCustomHandle,
|
|
9936
|
+
gi as GlobalEveryHandle,
|
|
9937
|
+
Ii as GlobalRealTimeComputation,
|
|
9938
|
+
di as GlobalStateMachineHandle,
|
|
9939
|
+
Mi as GlobalSumHandle,
|
|
9940
|
+
fi as GlobalWeightedSummationHandle,
|
|
9941
|
+
Ot as HARD_DELETION_PROPERTY_NAME,
|
|
9942
|
+
Ar as HardDeletionProperty,
|
|
9995
9943
|
ie as ID_ATTR,
|
|
9996
|
-
|
|
9944
|
+
Ft as INTERACTION_RECORD,
|
|
9997
9945
|
Nt as Inequality,
|
|
9998
9946
|
Lt as Interaction,
|
|
9999
|
-
|
|
10000
|
-
|
|
9947
|
+
Ne as InteractionCall,
|
|
9948
|
+
ve as InteractionEventEntity,
|
|
10001
9949
|
Dt as KlassByName,
|
|
10002
9950
|
f as LINK_SYMBOL,
|
|
10003
9951
|
Rt as LinkInfo,
|
|
10004
9952
|
m as MatchExp,
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
9953
|
+
Qe as Modifier,
|
|
9954
|
+
Ir as MonoSystem,
|
|
9955
|
+
vr as NON_DELETED_STATE,
|
|
9956
|
+
Nr as NON_EXIST_STATE,
|
|
10009
9957
|
Q as NewRecordData,
|
|
10010
|
-
|
|
10011
|
-
|
|
9958
|
+
gr as PHASE_AFTER_ALL,
|
|
9959
|
+
yr as PHASE_BEFORE_ALL,
|
|
10012
9960
|
It as PHASE_NORMAL,
|
|
10013
9961
|
jt as Payload,
|
|
10014
9962
|
Ht as PayloadItem,
|
|
10015
9963
|
v as Property,
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
9964
|
+
Ni as PropertyAnyHandle,
|
|
9965
|
+
Oi as PropertyAverageHandle,
|
|
9966
|
+
Ti as PropertyCountHandle,
|
|
9967
|
+
qi as PropertyCustomHandle,
|
|
9968
|
+
bi as PropertyEveryHandle,
|
|
9969
|
+
Ci as PropertyRealTimeComputation,
|
|
9970
|
+
hi as PropertyStateMachineHandle,
|
|
9971
|
+
Pi as PropertySumHandle,
|
|
10024
9972
|
Vt as PropertyTypes,
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
fe as QueryItem,
|
|
10028
|
-
ge as ROOT_LABEL,
|
|
9973
|
+
mi as PropertyWeightedSummationHandle,
|
|
9974
|
+
ye as ROOT_LABEL,
|
|
10029
9975
|
re as ROW_ID_ATTR,
|
|
10030
9976
|
dt as RealTime,
|
|
10031
|
-
|
|
9977
|
+
xi as RealTimeHandles,
|
|
10032
9978
|
E as RecordBoundState,
|
|
10033
9979
|
et as RecordInfo,
|
|
10034
|
-
|
|
9980
|
+
Te as RecordMutationSideEffect,
|
|
10035
9981
|
x as RecordQuery,
|
|
10036
|
-
|
|
9982
|
+
Je as RecordQueryAgent,
|
|
10037
9983
|
L as RecordQueryTree,
|
|
10038
|
-
|
|
9984
|
+
Si as RecordsTransformHandle,
|
|
10039
9985
|
bt as RecursiveContext,
|
|
10040
|
-
|
|
9986
|
+
me as RefContainer,
|
|
10041
9987
|
P as Relation,
|
|
10042
|
-
|
|
9988
|
+
Li as RelationCustomHandle,
|
|
10043
9989
|
X as SYSTEM_RECORD,
|
|
10044
|
-
|
|
9990
|
+
Wi as Scheduler,
|
|
10045
9991
|
Ut as SideEffect,
|
|
10046
9992
|
st as StateMachine,
|
|
10047
|
-
|
|
9993
|
+
pi as StateMachineHandles,
|
|
10048
9994
|
K as StateNode,
|
|
10049
9995
|
Jt as StateTransfer,
|
|
10050
9996
|
nt as Summation,
|
|
10051
|
-
|
|
9997
|
+
$i as SummationHandles,
|
|
10052
9998
|
Zt as SystemConsoleLogger,
|
|
10053
|
-
|
|
10054
|
-
|
|
9999
|
+
oi as SystemEntity,
|
|
10000
|
+
er as SystemLogLevel,
|
|
10055
10001
|
he as Transfer,
|
|
10056
10002
|
Tt as Transform,
|
|
10057
|
-
|
|
10058
|
-
|
|
10003
|
+
Ei as TransformHandles,
|
|
10004
|
+
Tr as USER_ENTITY,
|
|
10059
10005
|
at as WeightedSummation,
|
|
10060
|
-
|
|
10006
|
+
yi as WeightedSummationHandles,
|
|
10061
10007
|
ce as addToCurrentEffects,
|
|
10062
10008
|
T as assert,
|
|
10063
10009
|
zt as asyncEffectsContext,
|
|
10064
10010
|
ne as asyncInteractionContext,
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10011
|
+
fr as boolExpToAttributives,
|
|
10012
|
+
ar as clearAllInstances,
|
|
10013
|
+
lr as createClass,
|
|
10014
|
+
Ce as createInstances,
|
|
10015
|
+
cr as createInstancesFromString,
|
|
10016
|
+
mr as createUserRoleAttributive,
|
|
10017
|
+
Er as dbConsoleLogger,
|
|
10072
10018
|
mt as deepClone,
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10019
|
+
wr as everyAsync,
|
|
10020
|
+
ui as everyWithErrorAsync,
|
|
10021
|
+
br as filterMap,
|
|
10022
|
+
hr as findRootActivity,
|
|
10077
10023
|
pe as forEachInteraction,
|
|
10078
10024
|
k as generateUUID,
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10025
|
+
Xi as getCurrentEffects,
|
|
10026
|
+
dr as getInteractions,
|
|
10027
|
+
Ee as indexBy,
|
|
10082
10028
|
ue as isObject,
|
|
10083
10029
|
de as isPlainObject,
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10030
|
+
Rr as mapObject,
|
|
10031
|
+
pr as parse,
|
|
10032
|
+
Ie as registerKlass,
|
|
10033
|
+
or as removeAllInstance,
|
|
10034
|
+
li as someAsync,
|
|
10035
|
+
nr as stringifyAllInstances,
|
|
10090
10036
|
w as stringifyAttribute,
|
|
10091
|
-
|
|
10037
|
+
ir as systemConsoleLogger
|
|
10092
10038
|
};
|
|
10093
10039
|
//# sourceMappingURL=index.js.map
|