interaqt 1.0.0 → 1.1.0
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 +5 -2
- package/dist/builtins/interaction/Action.d.ts +1 -1
- package/dist/builtins/interaction/Action.d.ts.map +1 -1
- package/dist/builtins/interaction/Activity.d.ts +1 -1
- package/dist/builtins/interaction/Activity.d.ts.map +1 -1
- package/dist/builtins/interaction/Attributive.d.ts +1 -2
- package/dist/builtins/interaction/Attributive.d.ts.map +1 -1
- package/dist/builtins/interaction/Condition.d.ts +1 -1
- package/dist/builtins/interaction/Condition.d.ts.map +1 -1
- package/dist/builtins/interaction/Conditions.d.ts +1 -2
- package/dist/builtins/interaction/Conditions.d.ts.map +1 -1
- package/dist/builtins/interaction/Data.d.ts +1 -1
- package/dist/builtins/interaction/Data.d.ts.map +1 -1
- package/dist/builtins/interaction/DataAttributives.d.ts +1 -2
- package/dist/builtins/interaction/DataAttributives.d.ts.map +1 -1
- package/dist/builtins/interaction/Event.d.ts +1 -1
- package/dist/builtins/interaction/Event.d.ts.map +1 -1
- package/dist/builtins/interaction/Gateway.d.ts +1 -1
- package/dist/builtins/interaction/Gateway.d.ts.map +1 -1
- package/dist/builtins/interaction/Interaction.d.ts +4 -3
- package/dist/builtins/interaction/Interaction.d.ts.map +1 -1
- package/dist/builtins/interaction/Payload.d.ts +1 -1
- package/dist/builtins/interaction/Payload.d.ts.map +1 -1
- package/dist/builtins/interaction/PayloadItem.d.ts +1 -2
- package/dist/builtins/interaction/PayloadItem.d.ts.map +1 -1
- package/dist/builtins/interaction/activity/ActivityCall.d.ts +23 -19
- package/dist/builtins/interaction/activity/ActivityCall.d.ts.map +1 -1
- package/dist/builtins/interaction/activity/ActivityManager.d.ts +13 -32
- package/dist/builtins/interaction/activity/ActivityManager.d.ts.map +1 -1
- package/dist/builtins/interaction/errors/ActivityErrors.d.ts +1 -1
- package/dist/builtins/interaction/errors/ActivityErrors.d.ts.map +1 -1
- package/dist/builtins/interaction/errors/InteractionErrors.d.ts +1 -1
- package/dist/builtins/interaction/errors/InteractionErrors.d.ts.map +1 -1
- package/dist/builtins/interaction/index.d.ts +0 -1
- package/dist/builtins/interaction/index.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/index.js +844 -1065
- package/dist/index.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/builtins/interaction/activity/InteractionCall.d.ts +0 -75
- package/dist/builtins/interaction/activity/InteractionCall.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { AsyncLocalStorage as
|
|
2
|
-
function
|
|
1
|
+
import { AsyncLocalStorage as ne } from "async_hooks";
|
|
2
|
+
function ce(u) {
|
|
3
3
|
return u !== null && typeof u == "object";
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
if (!
|
|
5
|
+
function le(u) {
|
|
6
|
+
if (!ce(u)) return !1;
|
|
7
7
|
const t = Object.getPrototypeOf(u);
|
|
8
8
|
return t === null ? !0 : t === Object.prototype || t === null;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function hr(u, t) {
|
|
11
11
|
const e = {};
|
|
12
12
|
for (const i of u)
|
|
13
13
|
i && i[t] !== void 0 && (e[String(i[t])] = i);
|
|
14
14
|
return e;
|
|
15
15
|
}
|
|
16
16
|
function w(u) {
|
|
17
|
-
return typeof u == "function" ? `func::${u.toString()}` : Array.isArray(u) ? u :
|
|
17
|
+
return typeof u == "function" ? `func::${u.toString()}` : Array.isArray(u) ? u : ce(u) && !le(u) ? `uuid::${u.uuid}` : u;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Rt(u, t) {
|
|
20
20
|
if (u == null || typeof u != "object") return u;
|
|
21
|
-
if (Array.isArray(u)) return u.map((i) =>
|
|
22
|
-
if (
|
|
23
|
-
return Object.fromEntries(Object.entries(u).map(([i, r]) => [i,
|
|
21
|
+
if (Array.isArray(u)) return u.map((i) => Rt(i, t));
|
|
22
|
+
if (le(u))
|
|
23
|
+
return Object.fromEntries(Object.entries(u).map(([i, r]) => [i, Rt(r, t)]));
|
|
24
24
|
if (u instanceof Set)
|
|
25
|
-
return new Set(Array.from(u.values()).map((i) =>
|
|
25
|
+
return new Set(Array.from(u.values()).map((i) => Rt(i, t)));
|
|
26
26
|
if (u instanceof Map)
|
|
27
|
-
return new Map(Array.from(u.entries()).map(([i, r]) => [i,
|
|
27
|
+
return new Map(Array.from(u.entries()).map(([i, r]) => [i, Rt(r, t)]));
|
|
28
28
|
const e = u;
|
|
29
29
|
return t && e._type && e.constructor?.clone ? e.constructor.clone(u, t) : u;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function pr(...u) {
|
|
32
32
|
for (const t of u)
|
|
33
33
|
t.instances.length = 0;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function fr() {
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
function
|
|
39
|
-
t && t.isKlass && t.displayName &&
|
|
37
|
+
const Ft = /* @__PURE__ */ new Map();
|
|
38
|
+
function ue(u, t) {
|
|
39
|
+
t && t.isKlass && t.displayName && Ft.set(u, t);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function mr() {
|
|
42
42
|
const u = [];
|
|
43
|
-
return Array.from(
|
|
43
|
+
return Array.from(Ft.entries()).forEach(([, t]) => {
|
|
44
44
|
t.instances && Array.isArray(t.instances) && t.stringify && u.push(...t.instances.map((e) => t.stringify(e)));
|
|
45
45
|
}), `[${u.join(",")}]`;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function yr(u) {
|
|
48
48
|
const t = JSON.parse(u);
|
|
49
|
-
return
|
|
49
|
+
return ke(t);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function ke(u) {
|
|
52
52
|
const t = /* @__PURE__ */ new Map();
|
|
53
53
|
return u.forEach(({ type: e, options: i = {}, uuid: r, public: s }) => {
|
|
54
|
-
const a =
|
|
54
|
+
const a = Ft.get(e);
|
|
55
55
|
if (!a) {
|
|
56
56
|
console.warn(`Class ${e} not found in KlassByName`);
|
|
57
57
|
return;
|
|
@@ -60,10 +60,10 @@ function Ce(u) {
|
|
|
60
60
|
t.set(r, o);
|
|
61
61
|
}), t;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function gr(u) {
|
|
64
64
|
return console.warn("createClass is deprecated in refactored code"), null;
|
|
65
65
|
}
|
|
66
|
-
class
|
|
66
|
+
class br {
|
|
67
67
|
static {
|
|
68
68
|
this.isKlass = !0;
|
|
69
69
|
}
|
|
@@ -85,11 +85,11 @@ class Nr {
|
|
|
85
85
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
let
|
|
88
|
+
let Se = 0;
|
|
89
89
|
function T(u) {
|
|
90
|
-
return u?.uuid || `id_${++
|
|
90
|
+
return u?.uuid || `id_${++Se}`;
|
|
91
91
|
}
|
|
92
|
-
const
|
|
92
|
+
const Ee = /^[a-zA-Z0-9_]+$/;
|
|
93
93
|
class I {
|
|
94
94
|
// for Merged Entity
|
|
95
95
|
constructor(t, e) {
|
|
@@ -110,7 +110,7 @@ class I {
|
|
|
110
110
|
type: "string",
|
|
111
111
|
required: !0,
|
|
112
112
|
constraints: {
|
|
113
|
-
nameFormat: ({ name: t }) =>
|
|
113
|
+
nameFormat: ({ name: t }) => Ee.test(t)
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
properties: {
|
|
@@ -201,9 +201,9 @@ class I {
|
|
|
201
201
|
return this.create(e.public, e.options);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
var
|
|
205
|
-
const
|
|
206
|
-
class
|
|
204
|
+
var Qt = /* @__PURE__ */ ((u) => (u.String = "string", u.Number = "number", u.Boolean = "boolean", u.Timestamp = "timestamp", u))(Qt || {});
|
|
205
|
+
const Ie = /^[a-zA-Z0-9_]+$/;
|
|
206
|
+
class Vt {
|
|
207
207
|
constructor(t, e) {
|
|
208
208
|
this._type = "Dictionary", this._options = e, this.uuid = T(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;
|
|
209
209
|
}
|
|
@@ -223,7 +223,7 @@ class qt {
|
|
|
223
223
|
required: !0,
|
|
224
224
|
collection: !1,
|
|
225
225
|
constraints: {
|
|
226
|
-
format: ({ name: t }) =>
|
|
226
|
+
format: ({ name: t }) => Ie.test(t),
|
|
227
227
|
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
228
228
|
}
|
|
229
229
|
},
|
|
@@ -231,7 +231,7 @@ class qt {
|
|
|
231
231
|
type: "string",
|
|
232
232
|
required: !0,
|
|
233
233
|
collection: !1,
|
|
234
|
-
options: Array.from(Object.values(
|
|
234
|
+
options: Array.from(Object.values(Qt))
|
|
235
235
|
},
|
|
236
236
|
collection: {
|
|
237
237
|
type: "boolean",
|
|
@@ -257,7 +257,7 @@ class qt {
|
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
static create(t, e) {
|
|
260
|
-
const i = new
|
|
260
|
+
const i = new Vt(t, e);
|
|
261
261
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
262
262
|
throw new Error(`duplicate uuid in options ${i.uuid}, Dictionary`);
|
|
263
263
|
return this.instances.push(i), i;
|
|
@@ -296,7 +296,7 @@ class qt {
|
|
|
296
296
|
return this.create(e.public, e.options);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
const
|
|
299
|
+
const xe = /^[a-zA-Z0-9_]+$/;
|
|
300
300
|
class N {
|
|
301
301
|
constructor(t, e) {
|
|
302
302
|
this._type = "Property", this._options = e, this.uuid = T(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;
|
|
@@ -316,14 +316,14 @@ class N {
|
|
|
316
316
|
type: "string",
|
|
317
317
|
required: !0,
|
|
318
318
|
constraints: {
|
|
319
|
-
format: ({ name: t }) =>
|
|
319
|
+
format: ({ name: t }) => xe.test(t),
|
|
320
320
|
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
321
321
|
}
|
|
322
322
|
},
|
|
323
323
|
type: {
|
|
324
324
|
type: "string",
|
|
325
325
|
required: !0,
|
|
326
|
-
options: () => Object.values(
|
|
326
|
+
options: () => Object.values(Qt)
|
|
327
327
|
},
|
|
328
328
|
collection: {
|
|
329
329
|
type: "boolean",
|
|
@@ -383,7 +383,7 @@ class N {
|
|
|
383
383
|
return i.defaultValue && typeof i.defaultValue == "string" && i.defaultValue.startsWith("func::") && (i.defaultValue = new Function("return " + i.defaultValue.substring(6))()), i.computed && typeof i.computed == "string" && i.computed.startsWith("func::") && (i.computed = new Function("return " + i.computed.substring(6))()), this.create(i, e.options);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
class
|
|
386
|
+
class C {
|
|
387
387
|
constructor(t, e) {
|
|
388
388
|
if (this._type = "Relation", this._options = e, this.uuid = T(e), t.inputRelations) {
|
|
389
389
|
if (!t.inputRelations || t.inputRelations.length === 0)
|
|
@@ -415,7 +415,7 @@ class x {
|
|
|
415
415
|
// for Merged Relation
|
|
416
416
|
// Getter for name that returns computed name if _name is undefined
|
|
417
417
|
get name() {
|
|
418
|
-
return this._name !== void 0 ? this._name :
|
|
418
|
+
return this._name !== void 0 ? this._name : C.public.name.computed ? C.public.name.computed(this) : void 0;
|
|
419
419
|
}
|
|
420
420
|
// Setter for name
|
|
421
421
|
set name(t) {
|
|
@@ -515,7 +515,7 @@ class x {
|
|
|
515
515
|
};
|
|
516
516
|
}
|
|
517
517
|
static create(t, e) {
|
|
518
|
-
const i = new
|
|
518
|
+
const i = new C(t, e);
|
|
519
519
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
520
520
|
throw new Error(`duplicate uuid in options ${i.uuid}, Relation`);
|
|
521
521
|
return this.instances.push(i), i;
|
|
@@ -549,7 +549,7 @@ class x {
|
|
|
549
549
|
};
|
|
550
550
|
t.inputRelations || (i.source = t.source, i.target = t.target);
|
|
551
551
|
const r = t._name ?? t.name;
|
|
552
|
-
return r !== void 0 && (i.name = r), t.computation !== void 0 && (i.computation = t.computation), t.baseRelation !== void 0 && (i.baseRelation = t.baseRelation), t.matchExpression !== void 0 && (i.matchExpression = t.matchExpression), t.inputRelations !== void 0 && (i.inputRelations = t.inputRelations), new
|
|
552
|
+
return r !== void 0 && (i.name = r), t.computation !== void 0 && (i.computation = t.computation), t.baseRelation !== void 0 && (i.baseRelation = t.baseRelation), t.matchExpression !== void 0 && (i.matchExpression = t.matchExpression), t.inputRelations !== void 0 && (i.inputRelations = t.inputRelations), new C(i, t._options);
|
|
553
553
|
}
|
|
554
554
|
static is(t) {
|
|
555
555
|
return t !== null && typeof t == "object" && "_type" in t && t._type === "Relation";
|
|
@@ -562,7 +562,7 @@ class x {
|
|
|
562
562
|
return this.create(e.public, e.options);
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
class
|
|
565
|
+
class K {
|
|
566
566
|
constructor(t, e) {
|
|
567
567
|
this._type = "StateNode", this._options = e, this.uuid = T(e), this.name = t.name, this.computeValue = t.computeValue;
|
|
568
568
|
}
|
|
@@ -590,7 +590,7 @@ class z {
|
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
592
|
static create(t, e) {
|
|
593
|
-
const i = new
|
|
593
|
+
const i = new K(t, e);
|
|
594
594
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
595
595
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateNode`);
|
|
596
596
|
return this.instances.push(i), i;
|
|
@@ -625,7 +625,7 @@ class z {
|
|
|
625
625
|
return this.create(e.public, e.options);
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
class
|
|
628
|
+
class Lt {
|
|
629
629
|
constructor(t, e) {
|
|
630
630
|
this._type = "StateTransfer", this._options = e, this.uuid = T(e), this.trigger = t.trigger, this.current = t.current, this.next = t.next, this.computeTarget = t.computeTarget;
|
|
631
631
|
}
|
|
@@ -663,7 +663,7 @@ class Bt {
|
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
665
|
static create(t, e) {
|
|
666
|
-
const i = new
|
|
666
|
+
const i = new Lt(t, e);
|
|
667
667
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
668
668
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateTransfer`);
|
|
669
669
|
return this.instances.push(i), i;
|
|
@@ -926,7 +926,7 @@ class ct {
|
|
|
926
926
|
}
|
|
927
927
|
static clone(t, e) {
|
|
928
928
|
let i = t.record;
|
|
929
|
-
return e && (I.is(t.record) ? i = I.clone(t.record, e) :
|
|
929
|
+
return e && (I.is(t.record) ? i = I.clone(t.record, e) : C.is(t.record) && (i = C.clone(t.record, e))), this.create({
|
|
930
930
|
record: i,
|
|
931
931
|
direction: t.direction,
|
|
932
932
|
callback: t.callback,
|
|
@@ -1256,7 +1256,7 @@ class ht {
|
|
|
1256
1256
|
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);
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
|
-
class
|
|
1259
|
+
class Tt {
|
|
1260
1260
|
constructor(t, e) {
|
|
1261
1261
|
this._type = "Transform", this._options = e, this.uuid = T(e), this.record = t.record, this.eventDeps = t.eventDeps, this.attributeQuery = t.attributeQuery, this.callback = t.callback;
|
|
1262
1262
|
}
|
|
@@ -1289,7 +1289,7 @@ class At {
|
|
|
1289
1289
|
};
|
|
1290
1290
|
}
|
|
1291
1291
|
static create(t, e) {
|
|
1292
|
-
const i = new
|
|
1292
|
+
const i = new Tt(t, e);
|
|
1293
1293
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1294
1294
|
throw new Error(`duplicate uuid in options ${i.uuid}, Transform`);
|
|
1295
1295
|
return this.instances.push(i), i;
|
|
@@ -1399,7 +1399,7 @@ class pt {
|
|
|
1399
1399
|
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);
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
|
-
class
|
|
1402
|
+
class qt {
|
|
1403
1403
|
constructor(t, e) {
|
|
1404
1404
|
this._type = "SideEffect", this._options = e, this.uuid = T(e), this.name = t.name, this.handle = t.handle;
|
|
1405
1405
|
}
|
|
@@ -1427,7 +1427,7 @@ class _t {
|
|
|
1427
1427
|
};
|
|
1428
1428
|
}
|
|
1429
1429
|
static create(t, e) {
|
|
1430
|
-
const i = new
|
|
1430
|
+
const i = new qt(t, e);
|
|
1431
1431
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1432
1432
|
throw new Error(`duplicate uuid in options ${i.uuid}, SideEffect`);
|
|
1433
1433
|
return this.instances.push(i), i;
|
|
@@ -1741,12 +1741,12 @@ class R {
|
|
|
1741
1741
|
throw new Error(`invalid bool expression type: ${JSON.stringify(this.raw)}`);
|
|
1742
1742
|
}
|
|
1743
1743
|
}
|
|
1744
|
-
const
|
|
1744
|
+
const Me = [
|
|
1745
1745
|
I,
|
|
1746
|
-
|
|
1746
|
+
C,
|
|
1747
1747
|
N,
|
|
1748
|
-
|
|
1749
|
-
|
|
1748
|
+
K,
|
|
1749
|
+
Lt,
|
|
1750
1750
|
ot,
|
|
1751
1751
|
nt,
|
|
1752
1752
|
ct,
|
|
@@ -1754,17 +1754,17 @@ const Oe = [
|
|
|
1754
1754
|
ut,
|
|
1755
1755
|
dt,
|
|
1756
1756
|
ht,
|
|
1757
|
-
|
|
1757
|
+
Tt,
|
|
1758
1758
|
pt,
|
|
1759
|
-
_t,
|
|
1760
1759
|
qt,
|
|
1760
|
+
Vt,
|
|
1761
1761
|
ft,
|
|
1762
1762
|
mt
|
|
1763
1763
|
];
|
|
1764
|
-
|
|
1765
|
-
u && u.displayName &&
|
|
1764
|
+
Me.forEach((u) => {
|
|
1765
|
+
u && u.displayName && ue(u.displayName, u);
|
|
1766
1766
|
});
|
|
1767
|
-
class
|
|
1767
|
+
class de {
|
|
1768
1768
|
constructor(t = [], e = []) {
|
|
1769
1769
|
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();
|
|
1770
1770
|
}
|
|
@@ -1777,7 +1777,7 @@ class me {
|
|
|
1777
1777
|
this.clonedEntities.set(t, e), this.reverseEntityMap.set(e, t);
|
|
1778
1778
|
}
|
|
1779
1779
|
for (const t of this.originalRelations) {
|
|
1780
|
-
const e =
|
|
1780
|
+
const e = C.clone(t, !1);
|
|
1781
1781
|
this.clonedRelations.set(t, e), this.reverseRelationMap.set(e, t);
|
|
1782
1782
|
}
|
|
1783
1783
|
this.updateAllReferences();
|
|
@@ -1801,7 +1801,7 @@ class me {
|
|
|
1801
1801
|
if (i === t || i.uuid === t.uuid)
|
|
1802
1802
|
throw new Error(`Relation already exists in container: ${t.name}`);
|
|
1803
1803
|
this.originalRelations.push(t);
|
|
1804
|
-
const e =
|
|
1804
|
+
const e = C.clone(t, !1);
|
|
1805
1805
|
return this.clonedRelations.set(t, e), this.reverseRelationMap.set(e, t), this.updateReferencesInObject(e), e;
|
|
1806
1806
|
}
|
|
1807
1807
|
/**
|
|
@@ -1975,7 +1975,7 @@ class me {
|
|
|
1975
1975
|
return null;
|
|
1976
1976
|
}
|
|
1977
1977
|
}
|
|
1978
|
-
class
|
|
1978
|
+
class Bt {
|
|
1979
1979
|
constructor(t, e) {
|
|
1980
1980
|
this._type = "Custom", this._options = e, this.uuid = T(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.getInitialValue = t.getInitialValue, this.asyncReturn = t.asyncReturn, this.useLastValue = t.useLastValue;
|
|
1981
1981
|
}
|
|
@@ -2038,7 +2038,7 @@ class Wt {
|
|
|
2038
2038
|
};
|
|
2039
2039
|
}
|
|
2040
2040
|
static create(t, e) {
|
|
2041
|
-
const i = new
|
|
2041
|
+
const i = new Bt(t, e);
|
|
2042
2042
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2043
2043
|
throw new Error(`duplicate uuid in options ${i.uuid}, Custom`);
|
|
2044
2044
|
return this.instances.push(i), i;
|
|
@@ -2082,7 +2082,7 @@ class Wt {
|
|
|
2082
2082
|
}), this.create(i, e.options);
|
|
2083
2083
|
}
|
|
2084
2084
|
}
|
|
2085
|
-
class
|
|
2085
|
+
class he {
|
|
2086
2086
|
constructor(t, e) {
|
|
2087
2087
|
this._type = "EventSource", this._options = e, this.uuid = T(e), this.name = t.name, this.entity = t.entity, this.guard = t.guard, this.mapEventData = t.mapEventData, this.resolve = t.resolve, this.afterDispatch = t.afterDispatch;
|
|
2088
2088
|
}
|
|
@@ -2096,7 +2096,7 @@ class ye {
|
|
|
2096
2096
|
this.instances = [];
|
|
2097
2097
|
}
|
|
2098
2098
|
static create(t, e) {
|
|
2099
|
-
const i = new
|
|
2099
|
+
const i = new he(t, e);
|
|
2100
2100
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2101
2101
|
throw new Error(`duplicate uuid in options ${i.uuid}, EventSource`);
|
|
2102
2102
|
return this.instances.push(i), i;
|
|
@@ -2138,7 +2138,7 @@ function b(u, t) {
|
|
|
2138
2138
|
if (!u)
|
|
2139
2139
|
throw new Error(t);
|
|
2140
2140
|
}
|
|
2141
|
-
function
|
|
2141
|
+
function Et(u, t, e) {
|
|
2142
2142
|
const i = [...t];
|
|
2143
2143
|
let r = u, s;
|
|
2144
2144
|
const a = i.pop();
|
|
@@ -2146,7 +2146,7 @@ function Ct(u, t, e) {
|
|
|
2146
2146
|
r[s] || (r[s] = {}), r = r[s];
|
|
2147
2147
|
return r[a] = e, !0;
|
|
2148
2148
|
}
|
|
2149
|
-
class
|
|
2149
|
+
class _ {
|
|
2150
2150
|
constructor(t, e, i, r) {
|
|
2151
2151
|
this.parentEntityName = t, this.attributeName = e, this.map = i, this.symmetricDirection = r, this.data = this.map.getAttributeData(t, e), b(!!this.data, `${t} has no attribute: ${e}`);
|
|
2152
2152
|
}
|
|
@@ -2273,14 +2273,14 @@ class J {
|
|
|
2273
2273
|
return b(this.isLinkFiltered(), "only filtered relation can get match expression"), this.data.matchExpression;
|
|
2274
2274
|
}
|
|
2275
2275
|
getBaseAttributeInfo() {
|
|
2276
|
-
return b(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new
|
|
2276
|
+
return b(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new _(this.parentEntityName, this.data.baseRelationAttributeName, this.map, this.symmetricDirection);
|
|
2277
2277
|
}
|
|
2278
2278
|
}
|
|
2279
2279
|
class m {
|
|
2280
2280
|
constructor(t, e, i, r, s) {
|
|
2281
2281
|
this.map = e, this.contextRootEntity = r, this.fromRelation = s, b(!i || i instanceof R, `match data is not a BoolExpression instance, you passed: ${this.data}`);
|
|
2282
2282
|
const a = this.map.getRecordInfo(t);
|
|
2283
|
-
this.entityName = a.resolvedBaseRecordName, this.xToOneQueryTree = new
|
|
2283
|
+
this.entityName = a.resolvedBaseRecordName, this.xToOneQueryTree = new V(this.entityName, this.map);
|
|
2284
2284
|
let o = i;
|
|
2285
2285
|
a.resolvedMatchExpression && (o = i ? a.resolvedMatchExpression.and(i) : a.resolvedMatchExpression), o && (this.data = this.convertFilteredRelation(o), this.buildQueryTree(this.data, this.xToOneQueryTree));
|
|
2286
2286
|
}
|
|
@@ -2328,8 +2328,8 @@ class m {
|
|
|
2328
2328
|
const n = [...a.resolvedPath, o], c = this.map.getInfoByPath(n), l = a.resolvedPath.concat(c?.isLinkFiltered() ? c.getBaseAttributeInfo().attributeName : o);
|
|
2329
2329
|
let d = a.matchExpression;
|
|
2330
2330
|
if (c?.isLinkFiltered()) {
|
|
2331
|
-
const h = c.getLinkInfo(), p = new m(h.getResolvedBaseRecordName(), this.map, h.getResolvedMatchExpression()), y = this.map.getReversePath(l), g = [c.isRecordSource() ? "source" : "target", ...y.slice(2)],
|
|
2332
|
-
d = d ? d.and(
|
|
2331
|
+
const h = c.getLinkInfo(), p = new m(h.getResolvedBaseRecordName(), this.map, h.getResolvedMatchExpression()), y = this.map.getReversePath(l), g = [c.isRecordSource() ? "source" : "target", ...y.slice(2)], A = p.rebase(g.join("."));
|
|
2332
|
+
d = d ? d.and(A) : A;
|
|
2333
2333
|
}
|
|
2334
2334
|
return {
|
|
2335
2335
|
path: [...a.path, o],
|
|
@@ -2501,7 +2501,7 @@ class m {
|
|
|
2501
2501
|
);
|
|
2502
2502
|
}
|
|
2503
2503
|
}
|
|
2504
|
-
class
|
|
2504
|
+
class Pe {
|
|
2505
2505
|
constructor(t, e, i, r) {
|
|
2506
2506
|
this.recordName = t, this.map = e, this.data = i, this.fromRelation = r;
|
|
2507
2507
|
}
|
|
@@ -2523,7 +2523,7 @@ class De {
|
|
|
2523
2523
|
* 用于确保 ORDER BY 中引用的关联字段会触发相应的 JOIN
|
|
2524
2524
|
*/
|
|
2525
2525
|
get xToOneQueryTree() {
|
|
2526
|
-
const t = new
|
|
2526
|
+
const t = new V(this.recordName, this.map);
|
|
2527
2527
|
return Object.keys(this.data?.orderBy || {}).forEach((e) => {
|
|
2528
2528
|
const i = e.split(".");
|
|
2529
2529
|
if (i.length === 1) {
|
|
@@ -2548,8 +2548,8 @@ class M {
|
|
|
2548
2548
|
d,
|
|
2549
2549
|
e,
|
|
2550
2550
|
y,
|
|
2551
|
-
new
|
|
2552
|
-
new
|
|
2551
|
+
new x(d, e, i.attributeQuery || [], s, a),
|
|
2552
|
+
new Pe(d, e, i.modifier),
|
|
2553
2553
|
r,
|
|
2554
2554
|
s,
|
|
2555
2555
|
a,
|
|
@@ -2588,7 +2588,7 @@ class M {
|
|
|
2588
2588
|
);
|
|
2589
2589
|
}
|
|
2590
2590
|
}
|
|
2591
|
-
class
|
|
2591
|
+
class V {
|
|
2592
2592
|
// 父节点和自己这个几点 link 上的 query
|
|
2593
2593
|
constructor(t, e, i, r, s, a, o) {
|
|
2594
2594
|
this.recordName = t, this.map = e, this.parentRecord = i, this.attributeName = r, this.data = s, this.parent = a, this.parentLinkQueryTree = o, this.fields = [], b(!!t, "recordName cannot be empty"), this.fields = s?.fields || [], this.records = s?.records || {}, i && (this.info = this.map.getInfo(this.parentRecord, this.attributeName));
|
|
@@ -2598,26 +2598,26 @@ class L {
|
|
|
2598
2598
|
if (t.length === 1)
|
|
2599
2599
|
this.fields.push(e);
|
|
2600
2600
|
else if (e === f)
|
|
2601
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2601
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new V(this.info.linkName, this.map)), this.parentLinkQueryTree.addField(i);
|
|
2602
2602
|
else {
|
|
2603
2603
|
const r = this.map.getInfo(this.recordName, e);
|
|
2604
|
-
this.records[e] || (this.records[e] = new
|
|
2604
|
+
this.records[e] || (this.records[e] = new V(r.recordName, this.map, this.recordName, e, void 0, this)), this.records[e].addField(i);
|
|
2605
2605
|
}
|
|
2606
2606
|
}
|
|
2607
2607
|
addRecord(t, e) {
|
|
2608
2608
|
const [i, ...r] = t;
|
|
2609
2609
|
if (t.length === 1)
|
|
2610
2610
|
if (i === f)
|
|
2611
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2611
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new V(this.info.linkName, this.map)), e && (this.parentLinkQueryTree = this.parentLinkQueryTree.merge(e));
|
|
2612
2612
|
else {
|
|
2613
|
-
const s = this.map.getInfo(this.recordName, i), a = e || new
|
|
2613
|
+
const s = this.map.getInfo(this.recordName, i), a = e || new V(s.recordName, this.map, this.recordName, i, void 0, this);
|
|
2614
2614
|
this.records[i] = this.records[i] ? this.records[i].merge(a) : a;
|
|
2615
2615
|
}
|
|
2616
2616
|
else if (i === f)
|
|
2617
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2617
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new V(this.info.linkName, this.map)), this.parentLinkQueryTree.addRecord(r, e);
|
|
2618
2618
|
else {
|
|
2619
2619
|
const s = this.map.getInfo(this.recordName, i);
|
|
2620
|
-
this.records[i] = new
|
|
2620
|
+
this.records[i] = new V(s.recordName, this.map, this.recordName, i, void 0, this), this.records[i].addRecord(r, e);
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
2623
|
forEachRecords(t) {
|
|
@@ -2632,7 +2632,7 @@ class L {
|
|
|
2632
2632
|
this.records[a] && t.records[a] ? r[a] = this.records[a].merge(t.records[a]) : this.records[a] ? r[a] = this.records[a] : r[a] = t.records[a];
|
|
2633
2633
|
});
|
|
2634
2634
|
let s;
|
|
2635
|
-
return this.parentLinkQueryTree && t.parentLinkQueryTree ? s = this.parentLinkQueryTree.merge(t.parentLinkQueryTree) : s = this.parentLinkQueryTree || t.parentLinkQueryTree, new
|
|
2635
|
+
return this.parentLinkQueryTree && t.parentLinkQueryTree ? s = this.parentLinkQueryTree.merge(t.parentLinkQueryTree) : s = this.parentLinkQueryTree || t.parentLinkQueryTree, new V(this.recordName, this.map, this.parentRecord, this.attributeName, { fields: e, records: r }, this.parent, s);
|
|
2636
2636
|
}
|
|
2637
2637
|
getData() {
|
|
2638
2638
|
const t = {
|
|
@@ -2643,8 +2643,8 @@ class L {
|
|
|
2643
2643
|
}), this.parentLinkQueryTree && (t[f] = this.parentLinkQueryTree.getData()), t;
|
|
2644
2644
|
}
|
|
2645
2645
|
}
|
|
2646
|
-
const f = "&",
|
|
2647
|
-
class
|
|
2646
|
+
const f = "&", Ce = "*";
|
|
2647
|
+
class x {
|
|
2648
2648
|
constructor(t, e, i = [], r, s, a) {
|
|
2649
2649
|
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();
|
|
2650
2650
|
let o = /* @__PURE__ */ new Set();
|
|
@@ -2656,7 +2656,7 @@ class C {
|
|
|
2656
2656
|
this.parentLinkRecordQuery = M.create(y.linkName, this.map, d, void 0);
|
|
2657
2657
|
return;
|
|
2658
2658
|
}
|
|
2659
|
-
if (l ===
|
|
2659
|
+
if (l === Ce) {
|
|
2660
2660
|
o = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((y) => y.attributeName));
|
|
2661
2661
|
return;
|
|
2662
2662
|
}
|
|
@@ -2665,10 +2665,10 @@ class C {
|
|
|
2665
2665
|
let y = l, v = d;
|
|
2666
2666
|
if (p.isLinkFiltered()) {
|
|
2667
2667
|
y = p.getBaseAttributeInfo().attributeName;
|
|
2668
|
-
const
|
|
2668
|
+
const A = d.matchExpression, D = p.getLinkInfo().getBaseLinkInfo(), Y = new m(D.name, this.map, p.getMatchExpression()).rebase(p.isRecordSource() ? "target" : "source"), Ae = A ? Y.and(A.data) : Y;
|
|
2669
2669
|
v = {
|
|
2670
2670
|
...d,
|
|
2671
|
-
matchExpression:
|
|
2671
|
+
matchExpression: Ae.data
|
|
2672
2672
|
};
|
|
2673
2673
|
}
|
|
2674
2674
|
const g = M.create(p.recordName, this.map, v, void 0, this.recordName, y, h, !1, l);
|
|
@@ -2680,7 +2680,7 @@ class C {
|
|
|
2680
2680
|
static mergeAttributeQueryData(t, e) {
|
|
2681
2681
|
const i = [...t, ...e], r = new Set(i.filter((o) => typeof o == "string")), a = i.filter((o) => typeof o != "string").reduce((o, n) => {
|
|
2682
2682
|
const [c, l] = n;
|
|
2683
|
-
return o[c] ? o[c] = { attributeQuery:
|
|
2683
|
+
return o[c] ? o[c] = { attributeQuery: x.mergeAttributeQueryData(o[c].attributeQuery, l.attributeQuery) } : o[c] = l, o;
|
|
2684
2684
|
}, {});
|
|
2685
2685
|
return [
|
|
2686
2686
|
...r,
|
|
@@ -2691,32 +2691,32 @@ class C {
|
|
|
2691
2691
|
const o = e.getRecordInfo(t), n = e.getRecordInfo(o.resolvedBaseRecordName);
|
|
2692
2692
|
let c = n.valueAttributes.map((l) => l.attributeName);
|
|
2693
2693
|
return i && n.sameTableReliance.forEach((l) => {
|
|
2694
|
-
const d =
|
|
2694
|
+
const d = x.getAttributeQueryDataForRecord(l.recordName, e, !0, r), h = [
|
|
2695
2695
|
l.attributeName,
|
|
2696
2696
|
{
|
|
2697
2697
|
attributeQuery: [...d]
|
|
2698
2698
|
}
|
|
2699
2699
|
];
|
|
2700
2700
|
if (!n.isRelation) {
|
|
2701
|
-
const p =
|
|
2701
|
+
const p = x.getAttributeQueryDataForRecord(l.linkName, e, !0, r);
|
|
2702
2702
|
h[1].attributeQuery.push([f, { attributeQuery: p }]);
|
|
2703
2703
|
}
|
|
2704
|
-
c =
|
|
2704
|
+
c = x.mergeAttributeQueryData(c, [h]);
|
|
2705
2705
|
}), a && n.notRelianceCombined.forEach((l) => {
|
|
2706
|
-
const d =
|
|
2706
|
+
const d = x.getAttributeQueryDataForRecord(l.recordName, e, !0, r), h = [
|
|
2707
2707
|
l.attributeName,
|
|
2708
2708
|
{
|
|
2709
2709
|
attributeQuery: [...d]
|
|
2710
2710
|
}
|
|
2711
2711
|
];
|
|
2712
2712
|
if (!n.isRelation) {
|
|
2713
|
-
const p =
|
|
2713
|
+
const p = x.getAttributeQueryDataForRecord(l.linkName, e, !0, r);
|
|
2714
2714
|
h[1].attributeQuery.push([f, { attributeQuery: p }]);
|
|
2715
2715
|
}
|
|
2716
|
-
c =
|
|
2716
|
+
c = x.mergeAttributeQueryData(c, [h]);
|
|
2717
2717
|
}), r && n.mergedRecordAttributes.forEach((l) => {
|
|
2718
|
-
const d =
|
|
2719
|
-
c =
|
|
2718
|
+
const d = x.getAttributeQueryDataForRecord(l.linkName, e, i, !0);
|
|
2719
|
+
c = x.mergeAttributeQueryData(c, [
|
|
2720
2720
|
[
|
|
2721
2721
|
l.attributeName,
|
|
2722
2722
|
{
|
|
@@ -2725,7 +2725,7 @@ class C {
|
|
|
2725
2725
|
]
|
|
2726
2726
|
]);
|
|
2727
2727
|
}), s && n.managedRecordAttributes.forEach((l) => {
|
|
2728
|
-
c =
|
|
2728
|
+
c = x.mergeAttributeQueryData(c, [
|
|
2729
2729
|
[
|
|
2730
2730
|
l.attributeName,
|
|
2731
2731
|
{
|
|
@@ -2765,7 +2765,7 @@ class C {
|
|
|
2765
2765
|
return this.buildXToOneQueryTree();
|
|
2766
2766
|
}
|
|
2767
2767
|
buildXToOneQueryTree() {
|
|
2768
|
-
const t = new
|
|
2768
|
+
const t = new V(this.recordName, this.map, this.parentRecord, this.attributeName);
|
|
2769
2769
|
if (this.data.forEach((e) => {
|
|
2770
2770
|
Array.isArray(e) || t.addField([e]);
|
|
2771
2771
|
}), this.xToOneRecords.forEach((e) => {
|
|
@@ -2777,16 +2777,16 @@ class C {
|
|
|
2777
2777
|
return t;
|
|
2778
2778
|
}
|
|
2779
2779
|
buildFullQueryTree() {
|
|
2780
|
-
const t = new
|
|
2780
|
+
const t = new V(this.recordName, this.map, this.parentRecord, this.attributeName);
|
|
2781
2781
|
return this.relatedRecords.forEach((e) => {
|
|
2782
2782
|
t.addRecord([e.attributeName], e.attributeQuery.fullQueryTree);
|
|
2783
2783
|
}), t;
|
|
2784
2784
|
}
|
|
2785
2785
|
withParentLinkData() {
|
|
2786
|
-
return this.parentLinkRecordQuery ? new
|
|
2786
|
+
return this.parentLinkRecordQuery ? new x(this.recordName, this.map, this.data, this.parentRecord, this.attributeName, !0) : this;
|
|
2787
2787
|
}
|
|
2788
2788
|
}
|
|
2789
|
-
function
|
|
2789
|
+
function $e(u) {
|
|
2790
2790
|
const t = [];
|
|
2791
2791
|
return u.forEach((e) => t.push(...Array.isArray(e) ? e : [e])), t;
|
|
2792
2792
|
}
|
|
@@ -2796,7 +2796,7 @@ class Q {
|
|
|
2796
2796
|
const s = this.map.getRecordInfo(e);
|
|
2797
2797
|
this.recordName = s.resolvedBaseRecordName;
|
|
2798
2798
|
const [a, o, n] = this.map.groupAttributes(this.recordName, i ? Object.keys(i) : []);
|
|
2799
|
-
this.relatedEntitiesData =
|
|
2799
|
+
this.relatedEntitiesData = $e(o.map(
|
|
2800
2800
|
(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)
|
|
2801
2801
|
)), this.valueAttributes = a, this.entityIdAttributes = n;
|
|
2802
2802
|
const c = this.map.getRecordInfo(this.recordName);
|
|
@@ -2873,7 +2873,7 @@ class Q {
|
|
|
2873
2873
|
}), i;
|
|
2874
2874
|
}
|
|
2875
2875
|
}
|
|
2876
|
-
class
|
|
2876
|
+
class Oe {
|
|
2877
2877
|
constructor(t, e, i, r, s, a) {
|
|
2878
2878
|
this.map = t, this.database = e, this.queryExecutor = i, this.helper = a, this.sqlBuilder = s, this.filteredEntityManager = r;
|
|
2879
2879
|
}
|
|
@@ -3086,7 +3086,7 @@ class Qe {
|
|
|
3086
3086
|
* 这是一个辅助方法,实际的删除逻辑在 RecordQueryAgent 中
|
|
3087
3087
|
*/
|
|
3088
3088
|
}
|
|
3089
|
-
class
|
|
3089
|
+
class De {
|
|
3090
3090
|
constructor(t, e) {
|
|
3091
3091
|
this.map = t, this.queryAgent = e, this.dependencies = /* @__PURE__ */ new Map();
|
|
3092
3092
|
}
|
|
@@ -3312,7 +3312,7 @@ class Le {
|
|
|
3312
3312
|
}
|
|
3313
3313
|
}
|
|
3314
3314
|
}
|
|
3315
|
-
class
|
|
3315
|
+
class Fe {
|
|
3316
3316
|
constructor() {
|
|
3317
3317
|
this.aliasToPath = /* @__PURE__ */ new Map(), this.pathStrToAlias = /* @__PURE__ */ new Map(), this.aliasPlaceholder = 0;
|
|
3318
3318
|
}
|
|
@@ -3335,7 +3335,7 @@ class qe {
|
|
|
3335
3335
|
return this.aliasToPath.get(t);
|
|
3336
3336
|
}
|
|
3337
3337
|
}
|
|
3338
|
-
class
|
|
3338
|
+
class Qe {
|
|
3339
3339
|
constructor(t, e) {
|
|
3340
3340
|
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?");
|
|
3341
3341
|
}
|
|
@@ -3356,7 +3356,7 @@ class Be {
|
|
|
3356
3356
|
), [p, y] = this.buildSelectClause(
|
|
3357
3357
|
t.attributeQuery.getValueAndXToOneRecordFields(),
|
|
3358
3358
|
e
|
|
3359
|
-
), v = this.buildFromClause(t.recordName, e), g = this.buildJoinClause(n, e),
|
|
3359
|
+
), v = this.buildFromClause(t.recordName, e), g = this.buildJoinClause(n, e), A = this.buildModifierClause(t.modifier, e, y);
|
|
3360
3360
|
return [
|
|
3361
3361
|
`
|
|
3362
3362
|
SELECT
|
|
@@ -3367,7 +3367,7 @@ ${g}
|
|
|
3367
3367
|
WHERE
|
|
3368
3368
|
${d}
|
|
3369
3369
|
|
|
3370
|
-
${
|
|
3370
|
+
${A}
|
|
3371
3371
|
`,
|
|
3372
3372
|
h,
|
|
3373
3373
|
y
|
|
@@ -3377,7 +3377,7 @@ ${k}
|
|
|
3377
3377
|
* 构建 SELECT 子句
|
|
3378
3378
|
*/
|
|
3379
3379
|
buildSelectClause(t, e = "") {
|
|
3380
|
-
const i = new
|
|
3380
|
+
const i = new Fe();
|
|
3381
3381
|
return t.length ? [t.map(({ tableAliasAndField: s, attribute: a, nameContext: o }) => {
|
|
3382
3382
|
const n = [
|
|
3383
3383
|
`${this.withPrefix(e)}${o[0]}`,
|
|
@@ -3484,29 +3484,29 @@ ${k}
|
|
|
3484
3484
|
joinTarget: [d, h]
|
|
3485
3485
|
});
|
|
3486
3486
|
} else {
|
|
3487
|
-
const g = c.getLinkInfo(),
|
|
3487
|
+
const g = c.getLinkInfo(), A = c.isLinkManyToManySymmetric() ? c.symmetricDirection === "source" : g.isRelationSource(c.parentEntityName, c.attributeName);
|
|
3488
3488
|
r.push({
|
|
3489
3489
|
for: l,
|
|
3490
3490
|
joinSource: a,
|
|
3491
|
-
joinIdField: [s,
|
|
3491
|
+
joinIdField: [s, A ? g.record.attributes.source.field : g.record.attributes.target.field],
|
|
3492
3492
|
joinTarget: [p, y]
|
|
3493
3493
|
}), o.onlyIdField() || r.push({
|
|
3494
3494
|
for: l,
|
|
3495
3495
|
joinSource: [p, y],
|
|
3496
|
-
joinIdField: [
|
|
3496
|
+
joinIdField: [A ? g.record.attributes.target.field : g.record.attributes.source.field, v],
|
|
3497
3497
|
joinTarget: [d, h]
|
|
3498
3498
|
});
|
|
3499
3499
|
}
|
|
3500
3500
|
if (r.push(...this.getJoinTables(o, l, [v, d, h])), o.parentLinkQueryTree && !o.parentLinkQueryTree.onlyIdField()) {
|
|
3501
|
-
const g = l.concat(f), [,
|
|
3502
|
-
|
|
3501
|
+
const g = l.concat(f), [, A] = this.map.getTableAliasAndFieldName(g, "id", !0), D = [
|
|
3502
|
+
A,
|
|
3503
3503
|
// link 的 idField
|
|
3504
3504
|
p,
|
|
3505
3505
|
// link 的 tableName
|
|
3506
3506
|
y
|
|
3507
3507
|
// link 的 tableAlias
|
|
3508
3508
|
];
|
|
3509
|
-
r.push(...this.getJoinTables(o.parentLinkQueryTree, g,
|
|
3509
|
+
r.push(...this.getJoinTables(o.parentLinkQueryTree, g, D));
|
|
3510
3510
|
}
|
|
3511
3511
|
}), r;
|
|
3512
3512
|
}
|
|
@@ -3617,7 +3617,7 @@ WHERE ${s}
|
|
|
3617
3617
|
return e?.toLowerCase() === "json" ? JSON.stringify(t) : t;
|
|
3618
3618
|
}
|
|
3619
3619
|
}
|
|
3620
|
-
const
|
|
3620
|
+
const _t = ":root";
|
|
3621
3621
|
class it {
|
|
3622
3622
|
constructor(t, e, i = []) {
|
|
3623
3623
|
this.label = t, this.parent = e, this.stack = i;
|
|
@@ -3641,9 +3641,9 @@ class it {
|
|
|
3641
3641
|
return new it(t, this);
|
|
3642
3642
|
}
|
|
3643
3643
|
}
|
|
3644
|
-
class
|
|
3644
|
+
class Ve {
|
|
3645
3645
|
constructor(t) {
|
|
3646
|
-
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(
|
|
3646
|
+
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(_t, t), this.recursiveSaveLabelledRecordQuery(t);
|
|
3647
3647
|
}
|
|
3648
3648
|
recursiveSaveLabelledRecordQuery(t) {
|
|
3649
3649
|
t.attributeQuery?.relatedRecords.forEach((e) => {
|
|
@@ -3657,7 +3657,7 @@ class _e {
|
|
|
3657
3657
|
return this.recordQueryByName.get(t);
|
|
3658
3658
|
}
|
|
3659
3659
|
}
|
|
3660
|
-
class
|
|
3660
|
+
class Le {
|
|
3661
3661
|
constructor(t, e, i) {
|
|
3662
3662
|
this.map = t, this.database = e, this.sqlBuilder = i;
|
|
3663
3663
|
}
|
|
@@ -3673,7 +3673,7 @@ class We {
|
|
|
3673
3673
|
const s = {};
|
|
3674
3674
|
return Object.entries(r).forEach(([a, o]) => {
|
|
3675
3675
|
const n = i.getPath(a).slice(1, 1 / 0);
|
|
3676
|
-
n.length === 1 && e.includes(n[0]) && typeof o == "string" && (o = JSON.parse(o)), o !== null &&
|
|
3676
|
+
n.length === 1 && e.includes(n[0]) && typeof o == "string" && (o = JSON.parse(o)), o !== null && Et(s, n, o);
|
|
3677
3677
|
}), s;
|
|
3678
3678
|
});
|
|
3679
3679
|
}
|
|
@@ -3681,8 +3681,8 @@ class We {
|
|
|
3681
3681
|
* 查找记录(主查询方法)
|
|
3682
3682
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
3683
3683
|
*/
|
|
3684
|
-
async findRecords(t, e = "", i, r = new it(
|
|
3685
|
-
if (i || (i = new
|
|
3684
|
+
async findRecords(t, e = "", i, r = new it(_t)) {
|
|
3685
|
+
if (i || (i = new Ve(t)), t.goto) {
|
|
3686
3686
|
if (t.exit && await t.exit(r))
|
|
3687
3687
|
return [];
|
|
3688
3688
|
const d = i.get(t.goto);
|
|
@@ -3705,8 +3705,8 @@ class We {
|
|
|
3705
3705
|
value: ["=", y.id]
|
|
3706
3706
|
}), g = d.derive({
|
|
3707
3707
|
matchExpression: v
|
|
3708
|
-
}),
|
|
3709
|
-
y[d.alias || d.attributeName] = await this.findRecords(g, e, i,
|
|
3708
|
+
}), A = t.label ? l.concat(y) : l;
|
|
3709
|
+
y[d.alias || d.attributeName] = await this.findRecords(g, e, i, A);
|
|
3710
3710
|
}
|
|
3711
3711
|
}
|
|
3712
3712
|
for (let d of t.attributeQuery.xToOneRecords) {
|
|
@@ -3715,20 +3715,20 @@ class We {
|
|
|
3715
3715
|
for (let p of h.attributeQuery.xToManyRecords) {
|
|
3716
3716
|
const v = this.map.getInfo(p.parentRecord, p.attributeName).getReverseInfo()?.attributeName;
|
|
3717
3717
|
for (let g of c) {
|
|
3718
|
-
const
|
|
3718
|
+
const A = g[d.attributeName][f].id, D = p.derive({
|
|
3719
3719
|
matchExpression: p.matchExpression.and({
|
|
3720
3720
|
key: `${v}.id`,
|
|
3721
|
-
value: ["=",
|
|
3721
|
+
value: ["=", A]
|
|
3722
3722
|
})
|
|
3723
|
-
}),
|
|
3724
|
-
|
|
3723
|
+
}), J = t.label ? l.concat(g) : l;
|
|
3724
|
+
Et(
|
|
3725
3725
|
g,
|
|
3726
3726
|
[d.alias || d.attributeName, f, p.attributeName],
|
|
3727
3727
|
await this.findRecords(
|
|
3728
|
-
|
|
3728
|
+
D,
|
|
3729
3729
|
`finding relation data: ${t.recordName}.${d.attributeName}.&.${p.attributeName}`,
|
|
3730
3730
|
i,
|
|
3731
|
-
|
|
3731
|
+
J
|
|
3732
3732
|
)
|
|
3733
3733
|
);
|
|
3734
3734
|
}
|
|
@@ -3804,29 +3804,29 @@ class We {
|
|
|
3804
3804
|
matchExpression: c,
|
|
3805
3805
|
attributeQuery: l
|
|
3806
3806
|
}), h = await this.findRecords(d, `finding related record: ${r.parentRecord}.${r.attributeName}`, s, a), p = r.attributeQuery.parentLinkRecordQuery ? h.map((g) => {
|
|
3807
|
-
let
|
|
3808
|
-
return o.isLinkManyToManySymmetric() ? (
|
|
3807
|
+
let A;
|
|
3808
|
+
return o.isLinkManyToManySymmetric() ? (A = {
|
|
3809
3809
|
...g,
|
|
3810
3810
|
[f]: g[`${n}:source`]?.[f]?.id ? g[`${n}:source`]?.[f] : g[`${n}:target`]?.[f]
|
|
3811
|
-
}, delete
|
|
3811
|
+
}, delete A[`${n}:source`], delete A[`${n}:target`]) : (A = {
|
|
3812
3812
|
...g,
|
|
3813
3813
|
[f]: g[n][f]
|
|
3814
|
-
}, delete
|
|
3814
|
+
}, delete A[n]), A;
|
|
3815
3815
|
}) : h, y = d.label && d.label !== a.label ? a.spawn(d.label) : a, v = r.attributeQuery.parentLinkRecordQuery;
|
|
3816
3816
|
if (v)
|
|
3817
3817
|
for (let g of v.attributeQuery.xToManyRecords)
|
|
3818
|
-
for (let
|
|
3819
|
-
const
|
|
3820
|
-
|
|
3821
|
-
|
|
3818
|
+
for (let A of p) {
|
|
3819
|
+
const D = A[f].id, J = d.label ? y.concat(A) : y;
|
|
3820
|
+
Et(
|
|
3821
|
+
A,
|
|
3822
3822
|
[f, g.attributeName],
|
|
3823
3823
|
await this.findXToManyRelatedRecords(
|
|
3824
3824
|
g.parentRecord,
|
|
3825
3825
|
g.attributeName,
|
|
3826
|
-
|
|
3826
|
+
D,
|
|
3827
3827
|
g,
|
|
3828
3828
|
s,
|
|
3829
|
-
|
|
3829
|
+
J
|
|
3830
3830
|
)
|
|
3831
3831
|
);
|
|
3832
3832
|
}
|
|
@@ -3839,7 +3839,7 @@ class We {
|
|
|
3839
3839
|
const a = e.split("."), o = a.at(-1), n = a.slice(0, -1), c = m.atom({
|
|
3840
3840
|
key: "id",
|
|
3841
3841
|
value: ["=", i]
|
|
3842
|
-
}), l =
|
|
3842
|
+
}), l = x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !1, !0), d = e;
|
|
3843
3843
|
let h = l;
|
|
3844
3844
|
for (let g of n)
|
|
3845
3845
|
h.push([g, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
|
|
@@ -3860,7 +3860,7 @@ class We {
|
|
|
3860
3860
|
return p ? [v, ...p] : void 0;
|
|
3861
3861
|
}
|
|
3862
3862
|
}
|
|
3863
|
-
class
|
|
3863
|
+
class qe {
|
|
3864
3864
|
constructor(t, e, i, r, s, a) {
|
|
3865
3865
|
this.map = t, this.database = e, this.queryExecutor = i, this.helper = a, this.sqlBuilder = s, this.filteredEntityManager = r;
|
|
3866
3866
|
}
|
|
@@ -3870,7 +3870,7 @@ class Je {
|
|
|
3870
3870
|
async deleteRecord(t, e, i, r = !1) {
|
|
3871
3871
|
const s = M.create(t, this.map, {
|
|
3872
3872
|
matchExpression: e,
|
|
3873
|
-
attributeQuery:
|
|
3873
|
+
attributeQuery: x.getAttributeQueryDataForRecord(
|
|
3874
3874
|
t,
|
|
3875
3875
|
this.map,
|
|
3876
3876
|
!0,
|
|
@@ -3906,7 +3906,7 @@ class Je {
|
|
|
3906
3906
|
key: "id",
|
|
3907
3907
|
value: ["=", a.id]
|
|
3908
3908
|
}),
|
|
3909
|
-
attributeQuery:
|
|
3909
|
+
attributeQuery: x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !0, !0),
|
|
3910
3910
|
modifier: { limit: 1 }
|
|
3911
3911
|
}
|
|
3912
3912
|
), n = await this.helper.findRecords(o, `find record with same row data for delete ${t}`);
|
|
@@ -4032,7 +4032,7 @@ class Je {
|
|
|
4032
4032
|
return b(!a.isTargetReliance, `cannot unlink reliance data, you can only delete record, ${t}`), a.isCombined() ? this.helper.relocateCombinedRecordDataForLink(t, e, i, s) : this.deleteRecord(t, e, s);
|
|
4033
4033
|
}
|
|
4034
4034
|
}
|
|
4035
|
-
class
|
|
4035
|
+
class Be {
|
|
4036
4036
|
constructor(t, e, i, r, s) {
|
|
4037
4037
|
this.map = t, this.database = e, this.helper = s, this.sqlBuilder = r, this.filteredEntityManager = i;
|
|
4038
4038
|
}
|
|
@@ -4042,7 +4042,7 @@ class He {
|
|
|
4042
4042
|
async updateRecord(t, e, i, r) {
|
|
4043
4043
|
const s = M.create(t, this.map, {
|
|
4044
4044
|
matchExpression: e,
|
|
4045
|
-
attributeQuery:
|
|
4045
|
+
attributeQuery: x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !0, !0)
|
|
4046
4046
|
}), a = await this.helper.findRecords(s, `find record for updating ${t}`), o = [];
|
|
4047
4047
|
for (let n of a) {
|
|
4048
4048
|
const c = await this.helper.createRecordDependency(i, r), l = await this.updateSameRowData(s.recordName, n, c, r), d = await this.handleUpdateReliance(s.recordName, n, i, r), h = Object.keys(i.getData());
|
|
@@ -4136,9 +4136,9 @@ class He {
|
|
|
4136
4136
|
return await this.database.update(r, s, a.idField, `update record ${t} by id`), e;
|
|
4137
4137
|
}
|
|
4138
4138
|
}
|
|
4139
|
-
class
|
|
4139
|
+
class _e {
|
|
4140
4140
|
constructor(t, e) {
|
|
4141
|
-
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new
|
|
4141
|
+
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new De(t, this), this.sqlBuilder = new Qe(t, e), this.queryExecutor = new Le(t, e, this.sqlBuilder), this.creationExecutor = new Oe(t, e, this.queryExecutor, this.filteredEntityManager, this.sqlBuilder, this), this.deletionExecutor = new qe(t, e, this.queryExecutor, this.filteredEntityManager, this.sqlBuilder, this), this.updateExecutor = new Be(t, e, this.filteredEntityManager, this.sqlBuilder, this), this.initializeFilteredEntityDependencies();
|
|
4142
4142
|
}
|
|
4143
4143
|
/**
|
|
4144
4144
|
* 初始化所有 filtered entity 的依赖关系
|
|
@@ -4158,7 +4158,7 @@ class je {
|
|
|
4158
4158
|
* 查找记录(主查询方法)- 委托给 QueryExecutor
|
|
4159
4159
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
4160
4160
|
*/
|
|
4161
|
-
async findRecords(t, e = "", i, r = new it(
|
|
4161
|
+
async findRecords(t, e = "", i, r = new it(_t)) {
|
|
4162
4162
|
return this.queryExecutor.findRecords(t, e, i, r);
|
|
4163
4163
|
}
|
|
4164
4164
|
// 委托给 CreationExecutor
|
|
@@ -4222,7 +4222,7 @@ class je {
|
|
|
4222
4222
|
async flashOutCombinedRecordsAndMergedLinks(t, e, i = "") {
|
|
4223
4223
|
const r = {};
|
|
4224
4224
|
let s;
|
|
4225
|
-
const a =
|
|
4225
|
+
const a = x.getAttributeQueryDataForRecord(t.recordName, this.map, !0, !0, !1, !0);
|
|
4226
4226
|
for (let c of t.combinedRecordIdRefs) {
|
|
4227
4227
|
const l = {
|
|
4228
4228
|
key: `${c.info.attributeName}.id`,
|
|
@@ -4256,7 +4256,7 @@ class je {
|
|
|
4256
4256
|
* 用于 unlink 场景中处理合并记录的数据迁移
|
|
4257
4257
|
*/
|
|
4258
4258
|
async relocateCombinedRecordDataForLink(t, e, i = !1, r) {
|
|
4259
|
-
const s =
|
|
4259
|
+
const s = x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !0, !0), a = i ? "source" : "target", o = await this.queryExecutor.findRecords(M.create(t, this.map, {
|
|
4260
4260
|
matchExpression: e,
|
|
4261
4261
|
attributeQuery: s
|
|
4262
4262
|
}), `finding combined records for relocate ${t}.${a}`, void 0), n = this.map.getLinkInfoByName(t)[i ? "sourceRecordInfo" : "targetRecordInfo"];
|
|
@@ -4306,9 +4306,9 @@ class je {
|
|
|
4306
4306
|
return this.queryExecutor.findPath(t, e, i, r, s);
|
|
4307
4307
|
}
|
|
4308
4308
|
}
|
|
4309
|
-
class
|
|
4309
|
+
class We {
|
|
4310
4310
|
constructor(t, e) {
|
|
4311
|
-
this.map = t, this.database = e, this.agent = new
|
|
4311
|
+
this.map = t, this.database = e, this.agent = new _e(t, e);
|
|
4312
4312
|
}
|
|
4313
4313
|
async findOne(t, e, i = {}, r) {
|
|
4314
4314
|
const s = {
|
|
@@ -4412,19 +4412,19 @@ class rt {
|
|
|
4412
4412
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
4413
4413
|
const e = this.data.attributes[t];
|
|
4414
4414
|
return e.isRecord && e.field;
|
|
4415
|
-
}).map((t) => new
|
|
4415
|
+
}).map((t) => new _(this.name, t, this.map));
|
|
4416
4416
|
}
|
|
4417
4417
|
get strictRecordAttributes() {
|
|
4418
4418
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
4419
4419
|
const e = this.data.attributes[t];
|
|
4420
4420
|
return e.isRecord && !e.field && !e.isFilteredRelation;
|
|
4421
|
-
}).map((t) => new
|
|
4421
|
+
}).map((t) => new _(this.name, t, this.map));
|
|
4422
4422
|
}
|
|
4423
4423
|
get differentTableRecordAttributes() {
|
|
4424
4424
|
return this.strictRecordAttributes.filter((t) => !(t.isMergedWithParent() || t.isLinkMergedWithParent()));
|
|
4425
4425
|
}
|
|
4426
4426
|
get reliance() {
|
|
4427
|
-
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new
|
|
4427
|
+
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new _(this.name, t, this.map));
|
|
4428
4428
|
}
|
|
4429
4429
|
get notRelianceCombined() {
|
|
4430
4430
|
return this.combinedRecords.filter((t) => !t.isReliance);
|
|
@@ -4436,10 +4436,10 @@ class rt {
|
|
|
4436
4436
|
return this.reliance.filter((t) => t.table === this.table);
|
|
4437
4437
|
}
|
|
4438
4438
|
get valueAttributes() {
|
|
4439
|
-
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new
|
|
4439
|
+
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new _(this.name, t, this.map));
|
|
4440
4440
|
}
|
|
4441
4441
|
getAttributeInfo(t) {
|
|
4442
|
-
return new
|
|
4442
|
+
return new _(this.name, t, this.map);
|
|
4443
4443
|
}
|
|
4444
4444
|
get baseRecordName() {
|
|
4445
4445
|
return this.data.baseRecordName;
|
|
@@ -4466,7 +4466,7 @@ class rt {
|
|
|
4466
4466
|
return this.data?.resolvedMatchExpression;
|
|
4467
4467
|
}
|
|
4468
4468
|
}
|
|
4469
|
-
class
|
|
4469
|
+
class wt {
|
|
4470
4470
|
constructor(t, e, i, r = !0) {
|
|
4471
4471
|
this.name = t, this.data = e, this.map = i, this.isFromSource = r;
|
|
4472
4472
|
}
|
|
@@ -4554,7 +4554,7 @@ class vt {
|
|
|
4554
4554
|
getBaseLinkInfo() {
|
|
4555
4555
|
b(this.isFilteredRelation(), "only filtered relation can get base link info");
|
|
4556
4556
|
const t = this.data.baseLinkName;
|
|
4557
|
-
return new
|
|
4557
|
+
return new wt(t, this.map.data.links[t], this.map);
|
|
4558
4558
|
}
|
|
4559
4559
|
getMatchExpression() {
|
|
4560
4560
|
if (this.isFilteredRelation())
|
|
@@ -4568,7 +4568,7 @@ class vt {
|
|
|
4568
4568
|
return b(this.isFilteredRelation(), "only filtered relation can get resolved record name"), this.data.resolvedBaseRecordName;
|
|
4569
4569
|
}
|
|
4570
4570
|
}
|
|
4571
|
-
class
|
|
4571
|
+
class Je {
|
|
4572
4572
|
constructor(t, e) {
|
|
4573
4573
|
this.data = t, this.aliasManager = e;
|
|
4574
4574
|
}
|
|
@@ -4593,10 +4593,10 @@ class Ge {
|
|
|
4593
4593
|
}
|
|
4594
4594
|
getLinkInfo(t, e) {
|
|
4595
4595
|
const i = this.getAttributeAndSymmetricDirection(e)[0], { linkName: r, isSource: s } = this.data.records[t].attributes[i];
|
|
4596
|
-
return b(!!r, `cannot find relation ${t} ${i}`), new
|
|
4596
|
+
return b(!!r, `cannot find relation ${t} ${i}`), new wt(r, this.data.links[r], this, !!s);
|
|
4597
4597
|
}
|
|
4598
4598
|
getLinkInfoByName(t) {
|
|
4599
|
-
return b(!!this.data.links[t], `cannot find link ${t}`), new
|
|
4599
|
+
return b(!!this.data.links[t], `cannot find link ${t}`), new wt(t, this.data.links[t], this);
|
|
4600
4600
|
}
|
|
4601
4601
|
getInfoByPath(t) {
|
|
4602
4602
|
const [e, ...i] = t;
|
|
@@ -4609,7 +4609,7 @@ class Ge {
|
|
|
4609
4609
|
c = h, d === f ? (b(!!s && !!a, `reading link in wrong path ${l.join(".")}`), s = this.data.records[s].attributes[a].linkName, a = void 0, r = o.linkName, o = void 0) : (o = this.data.records[r].attributes[d], b(!!o, `attribute ${d} not found in ${r}. namePath: ${t.join(".")}`), s = r, r = o.isRecord ? o.recordName : "", a = d);
|
|
4610
4610
|
}
|
|
4611
4611
|
if (!(!s || !a))
|
|
4612
|
-
return new
|
|
4612
|
+
return new _(s, a, this, c);
|
|
4613
4613
|
}
|
|
4614
4614
|
getTableAndAliasStack(t) {
|
|
4615
4615
|
const [e, ...i] = t;
|
|
@@ -4632,21 +4632,21 @@ class Ge {
|
|
|
4632
4632
|
for (let h = 0; h < i.length; h++) {
|
|
4633
4633
|
const [p, y] = this.getAttributeAndSymmetricDirection(i[h]), v = [e, ...i.slice(0, h + 1)];
|
|
4634
4634
|
if (p === f) {
|
|
4635
|
-
const { linkTable: g, linkAlias:
|
|
4636
|
-
b(!c, `last attribute in path is a link, cannot read link of a link ${
|
|
4635
|
+
const { linkTable: g, linkAlias: A, path: D } = d.pop();
|
|
4636
|
+
b(!c, `last attribute in path is a link, cannot read link of a link ${D.join(".")}`), s = g, a = A, r = this.data.records[l.linkName], c = !0, o = "", n = "", l = void 0;
|
|
4637
4637
|
} else {
|
|
4638
4638
|
l = this.getInfoByPath(v);
|
|
4639
4639
|
const g = r.attributes[p];
|
|
4640
4640
|
b(l.isRecord, `${i.slice(0, h + 1).join(".")} is not a entity attribute`);
|
|
4641
|
-
const
|
|
4641
|
+
const A = this.data.records[g.recordName], D = `${a}_${p}${y ? `_${y.toUpperCase()}` : ""}`, J = this.aliasManager?.getTableAlias(D) || D;
|
|
4642
4642
|
if (l.isMergedWithParent() || l.isLinkMergedWithParent())
|
|
4643
4643
|
n = a;
|
|
4644
4644
|
else if (l.isLinkIsolated()) {
|
|
4645
|
-
const
|
|
4646
|
-
n = this.aliasManager?.getTableAlias(
|
|
4645
|
+
const Y = `REL_${D}`;
|
|
4646
|
+
n = this.aliasManager?.getTableAlias(Y) || Y;
|
|
4647
4647
|
} else
|
|
4648
|
-
n =
|
|
4649
|
-
l.isMergedWithParent() || (a =
|
|
4648
|
+
n = J;
|
|
4649
|
+
l.isMergedWithParent() || (a = J), s = l.table, r = A, o = l.getLinkInfo()?.table, c = !1;
|
|
4650
4650
|
}
|
|
4651
4651
|
d.push({
|
|
4652
4652
|
table: s,
|
|
@@ -4764,7 +4764,7 @@ class Ge {
|
|
|
4764
4764
|
return r.join(".");
|
|
4765
4765
|
}
|
|
4766
4766
|
}
|
|
4767
|
-
function
|
|
4767
|
+
function He(u) {
|
|
4768
4768
|
const t = /* @__PURE__ */ new Map();
|
|
4769
4769
|
for (const e of u)
|
|
4770
4770
|
if (e.inputEntities)
|
|
@@ -4775,7 +4775,7 @@ function Ke(u) {
|
|
|
4775
4775
|
}
|
|
4776
4776
|
return t;
|
|
4777
4777
|
}
|
|
4778
|
-
function
|
|
4778
|
+
function je(u) {
|
|
4779
4779
|
const t = /* @__PURE__ */ new Map();
|
|
4780
4780
|
for (const e of u) {
|
|
4781
4781
|
const i = e.name || `${e.source.name}_${e.sourceProperty}_${e.targetProperty}_${e.target.name}`;
|
|
@@ -4789,32 +4789,32 @@ function Xe(u) {
|
|
|
4789
4789
|
}
|
|
4790
4790
|
return t;
|
|
4791
4791
|
}
|
|
4792
|
-
function
|
|
4793
|
-
const e = new
|
|
4794
|
-
return
|
|
4792
|
+
function Ue(u, t) {
|
|
4793
|
+
const e = new de(u, t), i = He(u), r = je(t);
|
|
4794
|
+
return ie(
|
|
4795
4795
|
u,
|
|
4796
4796
|
e,
|
|
4797
4797
|
i,
|
|
4798
4798
|
"entity"
|
|
4799
|
-
),
|
|
4799
|
+
), ie(
|
|
4800
4800
|
t,
|
|
4801
4801
|
e,
|
|
4802
4802
|
r,
|
|
4803
4803
|
"relation"
|
|
4804
4804
|
), e.getAll();
|
|
4805
4805
|
}
|
|
4806
|
-
function
|
|
4806
|
+
function ie(u, t, e, i) {
|
|
4807
4807
|
const r = u.filter((s) => gt(s) !== void 0);
|
|
4808
4808
|
for (const s of r)
|
|
4809
|
-
|
|
4809
|
+
Ge(
|
|
4810
4810
|
s,
|
|
4811
4811
|
t,
|
|
4812
4812
|
i,
|
|
4813
4813
|
e
|
|
4814
4814
|
);
|
|
4815
4815
|
}
|
|
4816
|
-
function
|
|
4817
|
-
const r = e === "entity", a = `__${
|
|
4816
|
+
function Ge(u, t, e, i) {
|
|
4817
|
+
const r = e === "entity", a = `__${X(u)}_input_${e}`, o = r ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] = Ze(
|
|
4818
4818
|
o,
|
|
4819
4819
|
a,
|
|
4820
4820
|
i,
|
|
@@ -4829,7 +4829,7 @@ function Ye(u, t, e, i) {
|
|
|
4829
4829
|
}
|
|
4830
4830
|
if (l)
|
|
4831
4831
|
for (const d of l)
|
|
4832
|
-
|
|
4832
|
+
Ke(
|
|
4833
4833
|
d,
|
|
4834
4834
|
c,
|
|
4835
4835
|
a,
|
|
@@ -4837,22 +4837,22 @@ function Ye(u, t, e, i) {
|
|
|
4837
4837
|
r
|
|
4838
4838
|
);
|
|
4839
4839
|
}
|
|
4840
|
-
function
|
|
4841
|
-
const [s, a] =
|
|
4840
|
+
function Ke(u, t, e, i, r) {
|
|
4841
|
+
const [s, a] = ti(
|
|
4842
4842
|
u,
|
|
4843
4843
|
t,
|
|
4844
4844
|
e
|
|
4845
4845
|
);
|
|
4846
4846
|
if (!r && s === u)
|
|
4847
4847
|
return;
|
|
4848
|
-
const o =
|
|
4848
|
+
const o = X(a), n = r ? i.getEntityByName(o) : i.getRelationByName(o);
|
|
4849
4849
|
n && i.replace(s, n);
|
|
4850
4850
|
}
|
|
4851
|
-
function
|
|
4851
|
+
function Xe(u, t) {
|
|
4852
4852
|
const e = /* @__PURE__ */ new Map(), i = gt(u);
|
|
4853
4853
|
if (i && i.length > 0)
|
|
4854
4854
|
for (const r of i) {
|
|
4855
|
-
const s =
|
|
4855
|
+
const s = X(r), a = [...t.get(s) || []], o = e.get(s) || [];
|
|
4856
4856
|
for (o.push(s), e.set(s, o); a.length; ) {
|
|
4857
4857
|
const n = a.shift(), c = e.get(n) || [];
|
|
4858
4858
|
c.push(...o), e.set(n, c);
|
|
@@ -4862,27 +4862,27 @@ function ti(u, t) {
|
|
|
4862
4862
|
}
|
|
4863
4863
|
return e;
|
|
4864
4864
|
}
|
|
4865
|
-
function
|
|
4866
|
-
const i =
|
|
4865
|
+
function ze(u, t, e) {
|
|
4866
|
+
const i = Xe(t, e);
|
|
4867
4867
|
return N.create({
|
|
4868
4868
|
name: u,
|
|
4869
4869
|
type: "json",
|
|
4870
4870
|
defaultValue: (r, s) => {
|
|
4871
4871
|
const a = gt(t) || [], n = (i.get(s) || []).filter(
|
|
4872
|
-
(c) => a.some((l) =>
|
|
4872
|
+
(c) => a.some((l) => X(l) === c)
|
|
4873
4873
|
);
|
|
4874
4874
|
return n.length > 0 ? n : [s];
|
|
4875
4875
|
}
|
|
4876
4876
|
});
|
|
4877
4877
|
}
|
|
4878
|
-
function
|
|
4878
|
+
function Ye(u, t, e) {
|
|
4879
4879
|
const i = gt(u) || [], r = [], s = /* @__PURE__ */ new Map(), a = Object.fromEntries(u.commonProperties?.map((o) => [o.name, o]) || []);
|
|
4880
4880
|
for (const o of i) {
|
|
4881
4881
|
let n = o;
|
|
4882
4882
|
if (yt(n))
|
|
4883
4883
|
for (; n.baseEntity && n.properties.length === 0; )
|
|
4884
4884
|
n = n.baseEntity;
|
|
4885
|
-
else if (
|
|
4885
|
+
else if (ii(n))
|
|
4886
4886
|
for (; n.baseRelation && n.properties.length === 0; )
|
|
4887
4887
|
n = n.baseRelation;
|
|
4888
4888
|
const c = Object.fromEntries(n.properties.map((h) => [h.name, h]));
|
|
@@ -4912,13 +4912,13 @@ function ii(u, t, e) {
|
|
|
4912
4912
|
}
|
|
4913
4913
|
return r;
|
|
4914
4914
|
}
|
|
4915
|
-
function
|
|
4916
|
-
const r =
|
|
4915
|
+
function Ze(u, t, e, i) {
|
|
4916
|
+
const r = ze(
|
|
4917
4917
|
t,
|
|
4918
4918
|
u,
|
|
4919
4919
|
e
|
|
4920
4920
|
), s = [
|
|
4921
|
-
...
|
|
4921
|
+
...Ye(
|
|
4922
4922
|
u,
|
|
4923
4923
|
e,
|
|
4924
4924
|
i
|
|
@@ -4941,7 +4941,7 @@ function ri(u, t, e, i) {
|
|
|
4941
4941
|
}))
|
|
4942
4942
|
)) : o.properties = s, [o, n || o];
|
|
4943
4943
|
} else {
|
|
4944
|
-
const a = i.getRelationByName(u.name), o =
|
|
4944
|
+
const a = i.getRelationByName(u.name), o = C.create({
|
|
4945
4945
|
name: a.name,
|
|
4946
4946
|
source: a.source,
|
|
4947
4947
|
sourceProperty: a.sourceProperty,
|
|
@@ -4953,7 +4953,7 @@ function ri(u, t, e, i) {
|
|
|
4953
4953
|
let n;
|
|
4954
4954
|
if (a.inputRelations?.some((c) => c.baseRelation)) {
|
|
4955
4955
|
const c = a.name || `${a.source.name}_${a.sourceProperty}_${a.targetProperty}_${a.target.name}`;
|
|
4956
|
-
n =
|
|
4956
|
+
n = C.create({
|
|
4957
4957
|
name: `__${c}_base`,
|
|
4958
4958
|
source: a.source,
|
|
4959
4959
|
sourceProperty: `__${a.sourceProperty}_base`,
|
|
@@ -4964,7 +4964,7 @@ function ri(u, t, e, i) {
|
|
|
4964
4964
|
properties: s
|
|
4965
4965
|
}), o.baseRelation = n, o.sourceProperty = a.sourceProperty, o.targetProperty = a.targetProperty, o.matchExpression = m.fromArray(
|
|
4966
4966
|
a.inputRelations.map((l) => {
|
|
4967
|
-
const d =
|
|
4967
|
+
const d = X(l);
|
|
4968
4968
|
return {
|
|
4969
4969
|
key: t,
|
|
4970
4970
|
value: ["contains", d]
|
|
@@ -4976,7 +4976,7 @@ function ri(u, t, e, i) {
|
|
|
4976
4976
|
return [o, n || o];
|
|
4977
4977
|
}
|
|
4978
4978
|
}
|
|
4979
|
-
function
|
|
4979
|
+
function ti(u, t, e) {
|
|
4980
4980
|
if (yt(u)) {
|
|
4981
4981
|
const i = u, r = t;
|
|
4982
4982
|
let s = i;
|
|
@@ -4989,8 +4989,8 @@ function si(u, t, e) {
|
|
|
4989
4989
|
value: ["contains", i.name]
|
|
4990
4990
|
}), [a, s];
|
|
4991
4991
|
} else {
|
|
4992
|
-
const i = u, r = t, s =
|
|
4993
|
-
return i.baseRelation ? [i,
|
|
4992
|
+
const i = u, r = t, s = X(i);
|
|
4993
|
+
return i.baseRelation ? [i, ei(i)] : [C.create({
|
|
4994
4994
|
name: s,
|
|
4995
4995
|
baseRelation: r,
|
|
4996
4996
|
sourceProperty: i.sourceProperty,
|
|
@@ -5002,7 +5002,7 @@ function si(u, t, e) {
|
|
|
5002
5002
|
}), i];
|
|
5003
5003
|
}
|
|
5004
5004
|
}
|
|
5005
|
-
function
|
|
5005
|
+
function ei(u) {
|
|
5006
5006
|
let t = u;
|
|
5007
5007
|
for (; t.baseRelation; )
|
|
5008
5008
|
t = t.baseRelation;
|
|
@@ -5011,16 +5011,16 @@ function ai(u) {
|
|
|
5011
5011
|
function yt(u) {
|
|
5012
5012
|
return "inputEntities" in u || !("sourceProperty" in u);
|
|
5013
5013
|
}
|
|
5014
|
-
function
|
|
5014
|
+
function ii(u) {
|
|
5015
5015
|
return "sourceProperty" in u;
|
|
5016
5016
|
}
|
|
5017
5017
|
function gt(u) {
|
|
5018
5018
|
return yt(u) ? u.inputEntities : u.inputRelations;
|
|
5019
5019
|
}
|
|
5020
|
-
function
|
|
5020
|
+
function X(u) {
|
|
5021
5021
|
return yt(u), u.name;
|
|
5022
5022
|
}
|
|
5023
|
-
class
|
|
5023
|
+
class ri {
|
|
5024
5024
|
constructor() {
|
|
5025
5025
|
this.tableAliasCounter = 1, this.fieldAliasCounter = 1, this.tablePathToAlias = /* @__PURE__ */ new Map(), this.tableAliasToPath = /* @__PURE__ */ new Map(), this.fieldPathToAlias = /* @__PURE__ */ new Map(), this.fieldAliasToPath = /* @__PURE__ */ new Map(), this.MAX_IDENTIFIER_LENGTH = 63;
|
|
5026
5026
|
}
|
|
@@ -5106,9 +5106,9 @@ class ni {
|
|
|
5106
5106
|
this.tableAliasCounter = 1, this.fieldAliasCounter = 1, this.tablePathToAlias.clear(), this.tableAliasToPath.clear(), this.fieldPathToAlias.clear(), this.fieldAliasToPath.clear();
|
|
5107
5107
|
}
|
|
5108
5108
|
}
|
|
5109
|
-
class
|
|
5109
|
+
class si {
|
|
5110
5110
|
constructor(t, e, i, r = []) {
|
|
5111
|
-
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.aliasManager = new
|
|
5111
|
+
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.aliasManager = new ri(), this.buildMap(), this.buildTables();
|
|
5112
5112
|
}
|
|
5113
5113
|
createRecordToTable(t, e) {
|
|
5114
5114
|
this.recordToTableMap.set(t, e);
|
|
@@ -5203,8 +5203,8 @@ class ci {
|
|
|
5203
5203
|
}
|
|
5204
5204
|
];
|
|
5205
5205
|
}));
|
|
5206
|
-
e && b(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[
|
|
5207
|
-
name:
|
|
5206
|
+
e && b(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[re] = {
|
|
5207
|
+
name: re,
|
|
5208
5208
|
type: "id",
|
|
5209
5209
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5210
5210
|
};
|
|
@@ -5499,7 +5499,7 @@ class ci {
|
|
|
5499
5499
|
* 统一处理 merged entities 和 merged relations
|
|
5500
5500
|
*/
|
|
5501
5501
|
processMergedItems() {
|
|
5502
|
-
const t =
|
|
5502
|
+
const t = Ue(
|
|
5503
5503
|
this.entities,
|
|
5504
5504
|
this.relations
|
|
5505
5505
|
);
|
|
@@ -5516,9 +5516,9 @@ class ci {
|
|
|
5516
5516
|
p[0] === "1" && p[1] === "1" && y !== v,
|
|
5517
5517
|
`only 1:1 can merge: ${s}.${a.slice(0, n + 1).join(".")}`
|
|
5518
5518
|
);
|
|
5519
|
-
const g = y === o ? v : y,
|
|
5520
|
-
if (
|
|
5521
|
-
throw new Error(`conflict found when join ${d}, ${
|
|
5519
|
+
const g = y === o ? v : y, A = this.combineRecordTable(o, g, d);
|
|
5520
|
+
if (A)
|
|
5521
|
+
throw new Error(`conflict found when join ${d}, ${A.join(",")} already merged with ${o}`);
|
|
5522
5522
|
h.mergedTo = "combined", i.push(h), o = l.recordName, delete t[d], delete e[d];
|
|
5523
5523
|
}
|
|
5524
5524
|
}), Object.values(t).forEach((r) => {
|
|
@@ -5577,8 +5577,8 @@ class ci {
|
|
|
5577
5577
|
buildTables() {
|
|
5578
5578
|
Object.entries(this.map.records).forEach(([t, e]) => {
|
|
5579
5579
|
this.tables[e.table] || (this.tables[e.table] = { columns: {
|
|
5580
|
-
[
|
|
5581
|
-
name:
|
|
5580
|
+
[se]: {
|
|
5581
|
+
name: se,
|
|
5582
5582
|
type: "pk",
|
|
5583
5583
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5584
5584
|
}
|
|
@@ -5651,8 +5651,8 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
5651
5651
|
});
|
|
5652
5652
|
}
|
|
5653
5653
|
}
|
|
5654
|
-
const
|
|
5655
|
-
name:
|
|
5654
|
+
const Z = "_System_", L = "_Dictionary_", re = "id", se = "_rowId", ai = I.create({
|
|
5655
|
+
name: Z,
|
|
5656
5656
|
properties: [
|
|
5657
5657
|
N.create({
|
|
5658
5658
|
name: "concept",
|
|
@@ -5670,8 +5670,8 @@ const tt = "_System_", q = "_Dictionary_", ae = "id", oe = "_rowId", li = I.crea
|
|
|
5670
5670
|
collection: !1
|
|
5671
5671
|
})
|
|
5672
5672
|
]
|
|
5673
|
-
}),
|
|
5674
|
-
name:
|
|
5673
|
+
}), oi = I.create({
|
|
5674
|
+
name: L,
|
|
5675
5675
|
properties: [
|
|
5676
5676
|
N.create({
|
|
5677
5677
|
name: "key",
|
|
@@ -5684,8 +5684,8 @@ const tt = "_System_", q = "_Dictionary_", ae = "id", oe = "_rowId", li = I.crea
|
|
|
5684
5684
|
collection: !1
|
|
5685
5685
|
})
|
|
5686
5686
|
]
|
|
5687
|
-
}),
|
|
5688
|
-
class
|
|
5687
|
+
}), Rr = 0, It = 1, wr = 2;
|
|
5688
|
+
class ni {
|
|
5689
5689
|
constructor(t, e) {
|
|
5690
5690
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
5691
5691
|
}
|
|
@@ -5699,18 +5699,18 @@ class di {
|
|
|
5699
5699
|
if (this.scheduler.isDataBasedComputation(i)) {
|
|
5700
5700
|
if (Object.entries(i.dataDeps).forEach(([r, s]) => {
|
|
5701
5701
|
const a = this.convertDataDepToERMutationEventsSourceMap(r, s, i);
|
|
5702
|
-
e[s.phase ||
|
|
5702
|
+
e[s.phase || It].push(...a);
|
|
5703
5703
|
}), i.dataContext.type === "property" && Object.values(i.dataDeps).some((r) => r.type === "global")) {
|
|
5704
5704
|
const r = {
|
|
5705
5705
|
type: "records",
|
|
5706
5706
|
source: i.dataContext.host
|
|
5707
5707
|
};
|
|
5708
|
-
e[
|
|
5708
|
+
e[It].push(...this.convertDataDepToERMutationEventsSourceMap("_self", r, i, "create"));
|
|
5709
5709
|
}
|
|
5710
5710
|
} else {
|
|
5711
5711
|
const { eventDeps: r } = i;
|
|
5712
5712
|
for (const s of Object.values(r))
|
|
5713
|
-
e[s.phase ||
|
|
5713
|
+
e[s.phase || It].push({
|
|
5714
5714
|
type: s.type,
|
|
5715
5715
|
recordName: s.recordName,
|
|
5716
5716
|
record: s.record,
|
|
@@ -5749,7 +5749,7 @@ class di {
|
|
|
5749
5749
|
* @returns 是否需要触发计算
|
|
5750
5750
|
*/
|
|
5751
5751
|
shouldTriggerUpdateComputation(t, e) {
|
|
5752
|
-
return t.type !== "update" || !("dataDep" in t) ? !0 : t.dataDep.type === "global" && e.recordName ===
|
|
5752
|
+
return t.type !== "update" || !("dataDep" in t) ? !0 : t.dataDep.type === "global" && e.recordName === L ? e.record?.key === t.dataDep.source.name : !t.attributes.filter((r) => r !== "id").every(
|
|
5753
5753
|
(r) => !e.record.hasOwnProperty(r) || e.record[r] === e.oldRecord[r]
|
|
5754
5754
|
);
|
|
5755
5755
|
}
|
|
@@ -5807,15 +5807,15 @@ class di {
|
|
|
5807
5807
|
} else e.type === "global" && ((!r || r === "update") && a.push({
|
|
5808
5808
|
dataDep: e,
|
|
5809
5809
|
type: "update",
|
|
5810
|
-
recordName:
|
|
5811
|
-
sourceRecordName:
|
|
5810
|
+
recordName: L,
|
|
5811
|
+
sourceRecordName: L,
|
|
5812
5812
|
attributes: ["value"],
|
|
5813
5813
|
computation: i
|
|
5814
5814
|
}), (!r || r === "create") && a.push({
|
|
5815
5815
|
dataDep: e,
|
|
5816
5816
|
type: "create",
|
|
5817
|
-
recordName:
|
|
5818
|
-
sourceRecordName:
|
|
5817
|
+
recordName: L,
|
|
5818
|
+
sourceRecordName: L,
|
|
5819
5819
|
computation: i
|
|
5820
5820
|
}));
|
|
5821
5821
|
return a;
|
|
@@ -5912,31 +5912,31 @@ class di {
|
|
|
5912
5912
|
}
|
|
5913
5913
|
class S {
|
|
5914
5914
|
static {
|
|
5915
|
-
this.skip = () => new
|
|
5915
|
+
this.skip = () => new Nt();
|
|
5916
5916
|
}
|
|
5917
5917
|
static {
|
|
5918
|
-
this.resolved = (t, e) => new
|
|
5918
|
+
this.resolved = (t, e) => new me(t, e);
|
|
5919
5919
|
}
|
|
5920
5920
|
static {
|
|
5921
|
-
this.async = (t) => new
|
|
5921
|
+
this.async = (t) => new fe(t);
|
|
5922
5922
|
}
|
|
5923
5923
|
static {
|
|
5924
|
-
this.fullRecompute = (t) => new
|
|
5924
|
+
this.fullRecompute = (t) => new pe(t);
|
|
5925
5925
|
}
|
|
5926
5926
|
}
|
|
5927
|
-
class
|
|
5927
|
+
class Nt extends S {
|
|
5928
5928
|
}
|
|
5929
|
-
class
|
|
5929
|
+
class pe extends S {
|
|
5930
5930
|
constructor(t) {
|
|
5931
5931
|
super(), this.reason = t;
|
|
5932
5932
|
}
|
|
5933
5933
|
}
|
|
5934
|
-
class
|
|
5934
|
+
class fe extends S {
|
|
5935
5935
|
constructor(t) {
|
|
5936
5936
|
super(), this.args = t;
|
|
5937
5937
|
}
|
|
5938
5938
|
}
|
|
5939
|
-
class
|
|
5939
|
+
class me extends S {
|
|
5940
5940
|
constructor(t, e) {
|
|
5941
5941
|
super(), this.result = t, this.args = e;
|
|
5942
5942
|
}
|
|
@@ -5967,18 +5967,18 @@ class B {
|
|
|
5967
5967
|
return await this.controller.system.storage.dict.get(this.key);
|
|
5968
5968
|
}
|
|
5969
5969
|
}
|
|
5970
|
-
function
|
|
5970
|
+
function Ct(u, t) {
|
|
5971
5971
|
if (t == null || u === t) return !0;
|
|
5972
5972
|
if (typeof t != "object" || t === null)
|
|
5973
5973
|
return u === t;
|
|
5974
5974
|
if (typeof u != "object" || u === null)
|
|
5975
5975
|
return !1;
|
|
5976
5976
|
for (const e in t)
|
|
5977
|
-
if (!(e in u) ||
|
|
5977
|
+
if (!(e in u) || !Ct(u[e], t[e]))
|
|
5978
5978
|
return !1;
|
|
5979
5979
|
return !0;
|
|
5980
5980
|
}
|
|
5981
|
-
class
|
|
5981
|
+
class ye {
|
|
5982
5982
|
constructor(t) {
|
|
5983
5983
|
this.data = t, this.map = {};
|
|
5984
5984
|
for (const e of t.transfers)
|
|
@@ -5991,45 +5991,45 @@ class we {
|
|
|
5991
5991
|
const i = this.map[t];
|
|
5992
5992
|
if (i) {
|
|
5993
5993
|
for (const r of i)
|
|
5994
|
-
if (
|
|
5994
|
+
if (Ct(e, r.trigger))
|
|
5995
5995
|
return r.next;
|
|
5996
5996
|
}
|
|
5997
5997
|
return null;
|
|
5998
5998
|
}
|
|
5999
5999
|
findTransfers(t) {
|
|
6000
|
-
return this.data.transfers.filter((e) =>
|
|
6000
|
+
return this.data.transfers.filter((e) => Ct(t, e.trigger));
|
|
6001
6001
|
}
|
|
6002
6002
|
}
|
|
6003
|
-
function
|
|
6003
|
+
function k(u, t) {
|
|
6004
6004
|
if (!u)
|
|
6005
6005
|
throw new Error(t);
|
|
6006
6006
|
}
|
|
6007
|
-
function
|
|
6007
|
+
function Nr(u, t) {
|
|
6008
6008
|
return new Map(Array.from(u.entries()).map(([e, i]) => [e, t(e, i)]));
|
|
6009
6009
|
}
|
|
6010
|
-
function
|
|
6010
|
+
function vr(u, t) {
|
|
6011
6011
|
return Object.fromEntries(Object.entries(u).map(([e, i]) => [e, t(e, i)]));
|
|
6012
6012
|
}
|
|
6013
|
-
async function
|
|
6013
|
+
async function Tr(u, t) {
|
|
6014
6014
|
for (let e of u)
|
|
6015
6015
|
if (!await t(e)) return !1;
|
|
6016
6016
|
return !0;
|
|
6017
6017
|
}
|
|
6018
|
-
async function
|
|
6018
|
+
async function Ar(u, t) {
|
|
6019
6019
|
for (let e of u)
|
|
6020
6020
|
if (await t(e)) return !0;
|
|
6021
6021
|
return !1;
|
|
6022
6022
|
}
|
|
6023
|
-
async function
|
|
6023
|
+
async function kr(u, t) {
|
|
6024
6024
|
for (let e of u) {
|
|
6025
6025
|
const i = await t(e);
|
|
6026
6026
|
if (i !== !0) return i;
|
|
6027
6027
|
}
|
|
6028
6028
|
return !0;
|
|
6029
6029
|
}
|
|
6030
|
-
class
|
|
6030
|
+
class ci {
|
|
6031
6031
|
constructor(t, e, i) {
|
|
6032
|
-
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6032
|
+
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new ye(this.args), this.initialState = this.args.initialState;
|
|
6033
6033
|
for (const r of this.args.transfers) {
|
|
6034
6034
|
const s = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6035
6035
|
this.eventDeps[s] = {
|
|
@@ -6057,9 +6057,9 @@ class fi {
|
|
|
6057
6057
|
return s ? (await this.state.currentState.set(s.name), s.computeValue ? await s.computeValue.call(this.controller, t, e) : s.name) : S.skip();
|
|
6058
6058
|
}
|
|
6059
6059
|
}
|
|
6060
|
-
class
|
|
6060
|
+
class li {
|
|
6061
6061
|
constructor(t, e, i) {
|
|
6062
|
-
this.controller = t, this.args = e, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6062
|
+
this.controller = t, this.args = e, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new ye(this.args), this.initialState = this.args.initialState, this.dataContext = i;
|
|
6063
6063
|
for (const r of this.args.transfers) {
|
|
6064
6064
|
const s = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6065
6065
|
this.eventDeps[s] = {
|
|
@@ -6081,7 +6081,7 @@ class mi {
|
|
|
6081
6081
|
}
|
|
6082
6082
|
async getInitialValue(t) {
|
|
6083
6083
|
const e = t[this.dataContext.id.name];
|
|
6084
|
-
return
|
|
6084
|
+
return k(
|
|
6085
6085
|
!(e !== void 0 && !this.initialState.computeValue),
|
|
6086
6086
|
`${this.dataContext.host.name}.${this.dataContext.id.name} have been set when ${this.dataContext.host.name} created,
|
|
6087
6087
|
if you want to save the use the initial value, you need to define computeValue in initialState to save it.
|
|
@@ -6104,17 +6104,17 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6104
6104
|
};
|
|
6105
6105
|
}
|
|
6106
6106
|
}
|
|
6107
|
-
const
|
|
6107
|
+
const Sr = K.create({
|
|
6108
6108
|
name: "nonExistent",
|
|
6109
6109
|
computeValue: () => null
|
|
6110
|
-
}),
|
|
6110
|
+
}), Er = K.create({
|
|
6111
6111
|
name: "nonDeleted",
|
|
6112
6112
|
computeValue: () => !1
|
|
6113
|
-
}),
|
|
6113
|
+
}), Ir = K.create({
|
|
6114
6114
|
name: "deleted",
|
|
6115
6115
|
computeValue: () => !0
|
|
6116
|
-
}),
|
|
6117
|
-
class
|
|
6116
|
+
}), ui = [ci, li];
|
|
6117
|
+
class di {
|
|
6118
6118
|
constructor(t, e, i) {
|
|
6119
6119
|
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 = {
|
|
6120
6120
|
main: {
|
|
@@ -6167,9 +6167,9 @@ class gi {
|
|
|
6167
6167
|
return i;
|
|
6168
6168
|
}
|
|
6169
6169
|
}
|
|
6170
|
-
class
|
|
6170
|
+
class hi {
|
|
6171
6171
|
constructor(t, e, i) {
|
|
6172
|
-
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),
|
|
6172
|
+
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), k(this.relation, "weighted summation computation must specify property"), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === i.host.name, k(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;
|
|
6173
6173
|
const r = this.args.attributeQuery || [];
|
|
6174
6174
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((a) => a[0] !== f) || [];
|
|
6175
6175
|
const s = (r.find((a) => a[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6243,8 +6243,8 @@ class bi {
|
|
|
6243
6243
|
return s;
|
|
6244
6244
|
}
|
|
6245
6245
|
}
|
|
6246
|
-
const
|
|
6247
|
-
class
|
|
6246
|
+
const pi = [di, hi];
|
|
6247
|
+
class fi {
|
|
6248
6248
|
constructor(t, e, i) {
|
|
6249
6249
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6250
6250
|
main: {
|
|
@@ -6297,9 +6297,9 @@ class wi {
|
|
|
6297
6297
|
return a === s;
|
|
6298
6298
|
}
|
|
6299
6299
|
}
|
|
6300
|
-
class
|
|
6300
|
+
class mi {
|
|
6301
6301
|
constructor(t, e, i) {
|
|
6302
|
-
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,
|
|
6302
|
+
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, k(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;
|
|
6303
6303
|
const r = this.args.attributeQuery || [];
|
|
6304
6304
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((a) => a[0] !== f) || [];
|
|
6305
6305
|
const s = (r.find((a) => a[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6371,8 +6371,8 @@ class Ni {
|
|
|
6371
6371
|
return a === o;
|
|
6372
6372
|
}
|
|
6373
6373
|
}
|
|
6374
|
-
const
|
|
6375
|
-
class
|
|
6374
|
+
const yi = [fi, mi];
|
|
6375
|
+
class gi {
|
|
6376
6376
|
constructor(t, e, i) {
|
|
6377
6377
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6378
6378
|
main: {
|
|
@@ -6425,14 +6425,14 @@ class Ti {
|
|
|
6425
6425
|
return s > 0;
|
|
6426
6426
|
}
|
|
6427
6427
|
}
|
|
6428
|
-
class
|
|
6428
|
+
class bi {
|
|
6429
6429
|
constructor(t, e, i) {
|
|
6430
|
-
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),
|
|
6430
|
+
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), k(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, k(this.isSource ? this.relation.source === i.host : this.relation.target === i.host, "any computation relation direction error");
|
|
6431
6431
|
let r = this.relation.baseRelation || this.relation;
|
|
6432
6432
|
for (; r.baseRelation; )
|
|
6433
6433
|
r = r.baseRelation;
|
|
6434
6434
|
const s = r.type.split(":");
|
|
6435
|
-
|
|
6435
|
+
k(s[this.isSource ? 1 : 0] === "n", `property-level Any computation argument must be an x:n relation. ${this.dataContext.host.name}.${this.args.property}" is a ${this.isSource ? s.join(":") : s.slice().reverse().join(":")} relation`), 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;
|
|
6436
6436
|
const a = this.args.attributeQuery || [];
|
|
6437
6437
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((n) => n[0] !== f) || [];
|
|
6438
6438
|
const o = (a.find((n) => n[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6501,8 +6501,8 @@ class ki {
|
|
|
6501
6501
|
return s > 0;
|
|
6502
6502
|
}
|
|
6503
6503
|
}
|
|
6504
|
-
const
|
|
6505
|
-
class
|
|
6504
|
+
const Ri = [gi, bi];
|
|
6505
|
+
class wi {
|
|
6506
6506
|
constructor(t, e, i) {
|
|
6507
6507
|
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 = {
|
|
6508
6508
|
main: {
|
|
@@ -6552,9 +6552,9 @@ class Si {
|
|
|
6552
6552
|
return s = Math.max(0, s), await this.state.count.set(s), s;
|
|
6553
6553
|
}
|
|
6554
6554
|
}
|
|
6555
|
-
class
|
|
6555
|
+
class Ni {
|
|
6556
6556
|
constructor(t, e, i) {
|
|
6557
|
-
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,
|
|
6557
|
+
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, k(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;
|
|
6558
6558
|
const r = this.args.attributeQuery || [];
|
|
6559
6559
|
this.relatedAttributeQuery = r.filter((a) => a && a[0] !== f) || [];
|
|
6560
6560
|
const s = (r.find((a) => a && a[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6636,10 +6636,10 @@ class Ei {
|
|
|
6636
6636
|
return a;
|
|
6637
6637
|
}
|
|
6638
6638
|
}
|
|
6639
|
-
const
|
|
6640
|
-
class
|
|
6639
|
+
const vi = [wi, Ni];
|
|
6640
|
+
class Ti {
|
|
6641
6641
|
constructor(t, e, i) {
|
|
6642
|
-
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {},
|
|
6642
|
+
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {}, k(!(this.args.record && this.args.eventDeps), "Transform must have either record or eventDep"), k(!(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 : (k(this.args.dataDeps?._source === void 0, "dataDep name `_source` is reserved for Transform"), this.dataDeps = {
|
|
6643
6643
|
...this.args.dataDeps || {},
|
|
6644
6644
|
_source: {
|
|
6645
6645
|
type: "records",
|
|
@@ -6649,7 +6649,7 @@ class Ci {
|
|
|
6649
6649
|
});
|
|
6650
6650
|
}
|
|
6651
6651
|
static {
|
|
6652
|
-
this.computationType =
|
|
6652
|
+
this.computationType = Tt;
|
|
6653
6653
|
}
|
|
6654
6654
|
static {
|
|
6655
6655
|
this.contextType = ["entity", "relation"];
|
|
@@ -6664,7 +6664,7 @@ class Ci {
|
|
|
6664
6664
|
return [];
|
|
6665
6665
|
}
|
|
6666
6666
|
async compute({ _source: t }) {
|
|
6667
|
-
|
|
6667
|
+
k(!this.eventDeps, "Transform compute should not be called with eventDeps");
|
|
6668
6668
|
const e = [];
|
|
6669
6669
|
for (const i of t) {
|
|
6670
6670
|
const r = await this.transformCallback.call(this.controller, i);
|
|
@@ -6679,7 +6679,7 @@ class Ci {
|
|
|
6679
6679
|
return e;
|
|
6680
6680
|
}
|
|
6681
6681
|
async computeDirtyRecords(t) {
|
|
6682
|
-
return
|
|
6682
|
+
return k(this.eventDeps, "computeDirtyRecords should be called with eventDeps"), [{}];
|
|
6683
6683
|
}
|
|
6684
6684
|
async incrementalPatchCompute(t, e) {
|
|
6685
6685
|
return this.eventDeps ? this.eventBasedIncrementalPatchCompute(t, e) : this.dataBasedIncrementalPatchCompute(t, e);
|
|
@@ -6745,7 +6745,7 @@ class Ci {
|
|
|
6745
6745
|
return r;
|
|
6746
6746
|
}
|
|
6747
6747
|
}
|
|
6748
|
-
const
|
|
6748
|
+
const Ai = [Ti];
|
|
6749
6749
|
class P {
|
|
6750
6750
|
constructor(t) {
|
|
6751
6751
|
this.node = t;
|
|
@@ -6844,13 +6844,13 @@ class P {
|
|
|
6844
6844
|
}
|
|
6845
6845
|
}
|
|
6846
6846
|
gt(t) {
|
|
6847
|
-
return new
|
|
6847
|
+
return new vt(this, ">", t);
|
|
6848
6848
|
}
|
|
6849
6849
|
lt(t) {
|
|
6850
|
-
return new
|
|
6850
|
+
return new vt(this, "<", t);
|
|
6851
6851
|
}
|
|
6852
6852
|
eq(t) {
|
|
6853
|
-
return new
|
|
6853
|
+
return new Wt(this, t);
|
|
6854
6854
|
}
|
|
6855
6855
|
getVariables() {
|
|
6856
6856
|
const t = /* @__PURE__ */ new Set();
|
|
@@ -6947,7 +6947,7 @@ class P {
|
|
|
6947
6947
|
}
|
|
6948
6948
|
}
|
|
6949
6949
|
}
|
|
6950
|
-
class
|
|
6950
|
+
class vt {
|
|
6951
6951
|
constructor(t, e, i) {
|
|
6952
6952
|
this.left = t, this.operator = e, this.right = i;
|
|
6953
6953
|
}
|
|
@@ -6982,7 +6982,7 @@ class kt {
|
|
|
6982
6982
|
}
|
|
6983
6983
|
}
|
|
6984
6984
|
}
|
|
6985
|
-
class
|
|
6985
|
+
class Wt {
|
|
6986
6986
|
constructor(t, e) {
|
|
6987
6987
|
this.left = t, this.right = e;
|
|
6988
6988
|
}
|
|
@@ -7017,7 +7017,7 @@ class Ht {
|
|
|
7017
7017
|
}
|
|
7018
7018
|
}
|
|
7019
7019
|
}
|
|
7020
|
-
class
|
|
7020
|
+
class ki {
|
|
7021
7021
|
constructor(t, e, i) {
|
|
7022
7022
|
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;
|
|
7023
7023
|
}
|
|
@@ -7042,14 +7042,14 @@ class Mi {
|
|
|
7042
7042
|
let r, s;
|
|
7043
7043
|
if (e instanceof P)
|
|
7044
7044
|
r = e.evaluate({ now: i }), s = i + this.nextRecomputeTime(i, t);
|
|
7045
|
-
else if (e instanceof
|
|
7045
|
+
else if (e instanceof vt || e instanceof Wt)
|
|
7046
7046
|
r = e.evaluate({ now: i }), s = e.solve();
|
|
7047
7047
|
else
|
|
7048
7048
|
throw new Error("Invalid result type");
|
|
7049
7049
|
return await this.state.lastRecomputeTime.set(i), await this.state.nextRecomputeTime.set(s), r;
|
|
7050
7050
|
}
|
|
7051
7051
|
}
|
|
7052
|
-
class
|
|
7052
|
+
class Si {
|
|
7053
7053
|
constructor(t, e, i) {
|
|
7054
7054
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = {
|
|
7055
7055
|
_current: {
|
|
@@ -7080,15 +7080,15 @@ class Pi {
|
|
|
7080
7080
|
let s, a;
|
|
7081
7081
|
if (i instanceof P)
|
|
7082
7082
|
s = i.evaluate({ now: r }), a = r + this.nextRecomputeTime(r, t);
|
|
7083
|
-
else if (i instanceof
|
|
7083
|
+
else if (i instanceof vt || i instanceof Wt)
|
|
7084
7084
|
s = i.evaluate({ now: r }), a = i.solve();
|
|
7085
7085
|
else
|
|
7086
7086
|
throw new Error("Invalid result type");
|
|
7087
7087
|
return await this.state.lastRecomputeTime.set(e, r), await this.state.nextRecomputeTime.set(e, a), s;
|
|
7088
7088
|
}
|
|
7089
7089
|
}
|
|
7090
|
-
const
|
|
7091
|
-
class
|
|
7090
|
+
const Ei = [ki, Si];
|
|
7091
|
+
class Ii {
|
|
7092
7092
|
constructor(t, e, i) {
|
|
7093
7093
|
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)
|
|
7094
7094
|
throw new Error("Sum computation requires attributeQuery with at least one field");
|
|
@@ -7149,9 +7149,9 @@ class Oi {
|
|
|
7149
7149
|
return s;
|
|
7150
7150
|
}
|
|
7151
7151
|
}
|
|
7152
|
-
class
|
|
7152
|
+
class xi {
|
|
7153
7153
|
constructor(t, e, i) {
|
|
7154
|
-
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),
|
|
7154
|
+
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), k(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, k(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;
|
|
7155
7155
|
const r = this.args.attributeQuery || [];
|
|
7156
7156
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((o) => o[0] !== f) || [];
|
|
7157
7157
|
const s = (r.find((o) => o[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -7238,8 +7238,8 @@ class Di {
|
|
|
7238
7238
|
return a;
|
|
7239
7239
|
}
|
|
7240
7240
|
}
|
|
7241
|
-
const
|
|
7242
|
-
class
|
|
7241
|
+
const Mi = [Ii, xi];
|
|
7242
|
+
class Pi {
|
|
7243
7243
|
constructor(t, e, i) {
|
|
7244
7244
|
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)
|
|
7245
7245
|
throw new Error("Average computation requires attributeQuery with at least one field");
|
|
@@ -7312,9 +7312,9 @@ class Vi {
|
|
|
7312
7312
|
return await this.state.sum.set(a), await this.state.count.set(s), s > 0 ? a / s : 0;
|
|
7313
7313
|
}
|
|
7314
7314
|
}
|
|
7315
|
-
class
|
|
7315
|
+
class Ci {
|
|
7316
7316
|
constructor(t, e, i) {
|
|
7317
|
-
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,
|
|
7317
|
+
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, k(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;
|
|
7318
7318
|
const r = this.args.attributeQuery || [];
|
|
7319
7319
|
this.relatedAttributeQuery = r.filter((o) => o && o[0] !== f) || [];
|
|
7320
7320
|
const s = (r.find((o) => o && o[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -7396,8 +7396,8 @@ class Qi {
|
|
|
7396
7396
|
return await this.state.count.set(e.record, a), a > 0 ? o / a : 0;
|
|
7397
7397
|
}
|
|
7398
7398
|
}
|
|
7399
|
-
const
|
|
7400
|
-
class
|
|
7399
|
+
const $i = [Pi, Ci];
|
|
7400
|
+
class At {
|
|
7401
7401
|
constructor(t, e, i) {
|
|
7402
7402
|
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) => {
|
|
7403
7403
|
if (this.computeCallback) {
|
|
@@ -7441,7 +7441,7 @@ class St {
|
|
|
7441
7441
|
}));
|
|
7442
7442
|
}
|
|
7443
7443
|
static {
|
|
7444
|
-
this.computationType =
|
|
7444
|
+
this.computationType = Bt;
|
|
7445
7445
|
}
|
|
7446
7446
|
createState() {
|
|
7447
7447
|
if (this.createStateCallback) {
|
|
@@ -7469,29 +7469,29 @@ class St {
|
|
|
7469
7469
|
return S.skip();
|
|
7470
7470
|
}
|
|
7471
7471
|
}
|
|
7472
|
-
class
|
|
7472
|
+
class Oi extends At {
|
|
7473
7473
|
static {
|
|
7474
7474
|
this.contextType = "global";
|
|
7475
7475
|
}
|
|
7476
7476
|
}
|
|
7477
|
-
class
|
|
7477
|
+
class Di extends At {
|
|
7478
7478
|
static {
|
|
7479
7479
|
this.contextType = "entity";
|
|
7480
7480
|
}
|
|
7481
7481
|
}
|
|
7482
|
-
class
|
|
7482
|
+
class Fi extends At {
|
|
7483
7483
|
static {
|
|
7484
7484
|
this.contextType = "relation";
|
|
7485
7485
|
}
|
|
7486
7486
|
}
|
|
7487
|
-
class
|
|
7487
|
+
class Qi extends At {
|
|
7488
7488
|
static {
|
|
7489
7489
|
this.contextType = "property";
|
|
7490
7490
|
}
|
|
7491
7491
|
constructor(t, e, i) {
|
|
7492
7492
|
if (e.dataDeps) {
|
|
7493
7493
|
const r = Object.keys(e.dataDeps).filter((s) => e.dataDeps[s].type === "records");
|
|
7494
|
-
|
|
7494
|
+
k(r.length === 0, `property-level custom computation dataDeps should not contain "records” type dataDeps, but got ${r.join(", ")}
|
|
7495
7495
|
If you want to use related entity/relation as dataDeps, please use "property" type dataDeps with args: { type: "property", attributeQuery: [attributeQuery] }
|
|
7496
7496
|
If you want to use aggregated data from all records in the entity/relation, you should define a different dict value to store the aggregated data, and then use the dict value as dataDeps.
|
|
7497
7497
|
`);
|
|
@@ -7499,13 +7499,13 @@ If you want to use aggregated data from all records in the entity/relation, you
|
|
|
7499
7499
|
super(t, e, i);
|
|
7500
7500
|
}
|
|
7501
7501
|
}
|
|
7502
|
-
const
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7502
|
+
const Vi = [
|
|
7503
|
+
Oi,
|
|
7504
|
+
Di,
|
|
7505
|
+
Fi,
|
|
7506
|
+
Qi
|
|
7507
7507
|
];
|
|
7508
|
-
class
|
|
7508
|
+
class W extends Error {
|
|
7509
7509
|
constructor(t, e = {}) {
|
|
7510
7510
|
super(`${t}. Caused by: ${e.causedBy?.message}`), this.name = this.constructor.name, this.timestamp = /* @__PURE__ */ new Date(), this.errorId = this.generateErrorId(), this.errorType = e.errorType || this.constructor.name, this.context = e.context || {}, this.causedBy = e.causedBy, this.stackTrace = this.stack, Object.setPrototypeOf(this, new.target.prototype);
|
|
7511
7511
|
}
|
|
@@ -7518,7 +7518,7 @@ class H extends Error {
|
|
|
7518
7518
|
getErrorChain() {
|
|
7519
7519
|
const t = [this];
|
|
7520
7520
|
let e = this.causedBy;
|
|
7521
|
-
for (; e && (t.push(e), e instanceof
|
|
7521
|
+
for (; e && (t.push(e), e instanceof W); )
|
|
7522
7522
|
e = e.causedBy;
|
|
7523
7523
|
return t;
|
|
7524
7524
|
}
|
|
@@ -7622,13 +7622,13 @@ Stack trace:`, r.stack.split(`
|
|
|
7622
7622
|
return null;
|
|
7623
7623
|
}
|
|
7624
7624
|
}
|
|
7625
|
-
var $ = /* @__PURE__ */ ((u) => (u.LOW = "low", u.MEDIUM = "medium", u.HIGH = "high", u.CRITICAL = "critical", u))($ || {}),
|
|
7626
|
-
class
|
|
7625
|
+
var $ = /* @__PURE__ */ ((u) => (u.LOW = "low", u.MEDIUM = "medium", u.HIGH = "high", u.CRITICAL = "critical", u))($ || {}), j = /* @__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))(j || {});
|
|
7626
|
+
class F extends W {
|
|
7627
7627
|
constructor(t, e = {}) {
|
|
7628
7628
|
super(t, {
|
|
7629
7629
|
errorType: e.context?.errorType || "ComputationError",
|
|
7630
7630
|
context: {
|
|
7631
|
-
category:
|
|
7631
|
+
category: j.COMPUTATION,
|
|
7632
7632
|
handleName: e.handleName,
|
|
7633
7633
|
computationName: e.computationName,
|
|
7634
7634
|
dataContext: e.dataContext,
|
|
@@ -7639,7 +7639,7 @@ class V extends H {
|
|
|
7639
7639
|
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity || $.MEDIUM;
|
|
7640
7640
|
}
|
|
7641
7641
|
}
|
|
7642
|
-
class
|
|
7642
|
+
class ae extends F {
|
|
7643
7643
|
constructor(t, e = {}) {
|
|
7644
7644
|
super(t, {
|
|
7645
7645
|
...e,
|
|
@@ -7654,7 +7654,7 @@ class ne extends V {
|
|
|
7654
7654
|
}), this.stateKey = e.stateKey, this.stateValue = e.stateValue, this.expectedStateType = e.expectedStateType, this.actualStateType = e.actualStateType;
|
|
7655
7655
|
}
|
|
7656
7656
|
}
|
|
7657
|
-
class
|
|
7657
|
+
class H extends F {
|
|
7658
7658
|
constructor(t, e = {}) {
|
|
7659
7659
|
super(t, {
|
|
7660
7660
|
...e,
|
|
@@ -7669,12 +7669,12 @@ class U extends V {
|
|
|
7669
7669
|
}), this.depName = e.depName, this.depType = e.depType, this.missingData = e.missingData, this.invalidData = e.invalidData;
|
|
7670
7670
|
}
|
|
7671
7671
|
}
|
|
7672
|
-
class
|
|
7672
|
+
class xt extends W {
|
|
7673
7673
|
constructor(t, e = {}) {
|
|
7674
7674
|
super(t, {
|
|
7675
7675
|
errorType: e.context?.errorType || "SchedulerError",
|
|
7676
7676
|
context: {
|
|
7677
|
-
category:
|
|
7677
|
+
category: j.SYSTEM,
|
|
7678
7678
|
schedulingPhase: e.schedulingPhase,
|
|
7679
7679
|
failedComputations: e.failedComputations,
|
|
7680
7680
|
...e.context
|
|
@@ -7683,12 +7683,12 @@ class Mt extends H {
|
|
|
7683
7683
|
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity = $.HIGH;
|
|
7684
7684
|
}
|
|
7685
7685
|
}
|
|
7686
|
-
class
|
|
7686
|
+
class Li extends W {
|
|
7687
7687
|
constructor(t, e) {
|
|
7688
7688
|
super(t, {
|
|
7689
7689
|
errorType: "SideEffectError",
|
|
7690
7690
|
context: {
|
|
7691
|
-
category:
|
|
7691
|
+
category: j.SYSTEM,
|
|
7692
7692
|
sideEffectName: e.sideEffectName,
|
|
7693
7693
|
recordName: e.recordName,
|
|
7694
7694
|
mutationType: e.mutationType,
|
|
@@ -7699,12 +7699,12 @@ class Hi extends H {
|
|
|
7699
7699
|
}), this.sideEffectName = e.sideEffectName, this.recordName = e.recordName, this.mutationType = e.mutationType, this.severity = $.MEDIUM;
|
|
7700
7700
|
}
|
|
7701
7701
|
}
|
|
7702
|
-
class
|
|
7702
|
+
class U extends W {
|
|
7703
7703
|
constructor(t, e) {
|
|
7704
7704
|
super(t, {
|
|
7705
7705
|
errorType: e.context?.errorType || "ConditionError",
|
|
7706
7706
|
context: {
|
|
7707
|
-
category:
|
|
7707
|
+
category: j.PERMISSION,
|
|
7708
7708
|
checkType: e.checkType,
|
|
7709
7709
|
fieldName: e.fieldName,
|
|
7710
7710
|
payload: e.payload,
|
|
@@ -7718,7 +7718,7 @@ class D extends H {
|
|
|
7718
7718
|
* Helper factory methods for common condition error scenarios
|
|
7719
7719
|
*/
|
|
7720
7720
|
static userCheckFailed(t, e) {
|
|
7721
|
-
return new
|
|
7721
|
+
return new U("User check failed", {
|
|
7722
7722
|
checkType: "user",
|
|
7723
7723
|
evaluationError: t,
|
|
7724
7724
|
severity: $.HIGH,
|
|
@@ -7729,7 +7729,7 @@ class D extends H {
|
|
|
7729
7729
|
}
|
|
7730
7730
|
static payloadValidationFailed(t, e, i, r) {
|
|
7731
7731
|
const s = `${t} ${e}`;
|
|
7732
|
-
return new
|
|
7732
|
+
return new U(`Payload validation failed for field '${t}': ${e}`, {
|
|
7733
7733
|
checkType: "payload",
|
|
7734
7734
|
fieldName: t,
|
|
7735
7735
|
payload: i,
|
|
@@ -7740,7 +7740,7 @@ class D extends H {
|
|
|
7740
7740
|
});
|
|
7741
7741
|
}
|
|
7742
7742
|
static conditionCheckFailed(t, e) {
|
|
7743
|
-
return new
|
|
7743
|
+
return new U(`Condition check failed: ${t.data.name}`, {
|
|
7744
7744
|
checkType: "condition",
|
|
7745
7745
|
evaluationError: t,
|
|
7746
7746
|
severity: $.HIGH,
|
|
@@ -7751,7 +7751,7 @@ class D extends H {
|
|
|
7751
7751
|
}
|
|
7752
7752
|
static attributiveCheckFailed(t, e, i, r) {
|
|
7753
7753
|
const s = `${t} ${e}`;
|
|
7754
|
-
return new
|
|
7754
|
+
return new U(`Attributive check failed for field '${t}': ${e}`, {
|
|
7755
7755
|
checkType: "attributive",
|
|
7756
7756
|
fieldName: t,
|
|
7757
7757
|
payload: i,
|
|
@@ -7762,7 +7762,7 @@ class D extends H {
|
|
|
7762
7762
|
});
|
|
7763
7763
|
}
|
|
7764
7764
|
static conceptCheckFailed(t, e) {
|
|
7765
|
-
return new
|
|
7765
|
+
return new U(`Concept check failed for field '${t}'`, {
|
|
7766
7766
|
checkType: "concept",
|
|
7767
7767
|
fieldName: t,
|
|
7768
7768
|
evaluationError: e,
|
|
@@ -7772,10 +7772,10 @@ class D extends H {
|
|
|
7772
7772
|
});
|
|
7773
7773
|
}
|
|
7774
7774
|
}
|
|
7775
|
-
const
|
|
7776
|
-
class
|
|
7775
|
+
const Mt = "_ASYNC_TASK_";
|
|
7776
|
+
class qi {
|
|
7777
7777
|
constructor(t, e, i, r, s) {
|
|
7778
|
-
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new
|
|
7778
|
+
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new ni(this.controller, this), this.buildComputationHandleMap(s);
|
|
7779
7779
|
const a = [];
|
|
7780
7780
|
r.forEach((o) => {
|
|
7781
7781
|
o.computation && a.push({ dataContext: { type: "global", id: o }, args: o.computation });
|
|
@@ -7795,9 +7795,9 @@ class ji {
|
|
|
7795
7795
|
});
|
|
7796
7796
|
for (const o of a) {
|
|
7797
7797
|
const n = o.dataContext, c = o.args, l = this.computationHandleMap.get(c.constructor);
|
|
7798
|
-
|
|
7798
|
+
k(!!l, `cannot find Computation handle map for ${c.constructor.displayName || c.constructor.name}`);
|
|
7799
7799
|
const d = l[n.type];
|
|
7800
|
-
|
|
7800
|
+
k(!!d, `cannot find Computation handle for ${c.constructor.displayName || c.constructor.name} with context type ${n.type}`);
|
|
7801
7801
|
const h = new d(this.controller, c, n);
|
|
7802
7802
|
if (this.computationsHandles.set(n.id, h), this.isAsyncComputation(h)) {
|
|
7803
7803
|
if (h.dataContext.type === "property") {
|
|
@@ -7817,7 +7817,7 @@ class ji {
|
|
|
7817
7817
|
type: "json"
|
|
7818
7818
|
})
|
|
7819
7819
|
]
|
|
7820
|
-
}), y =
|
|
7820
|
+
}), y = C.create({
|
|
7821
7821
|
name: `${p.name}_${h.dataContext.host.name}_${h.dataContext.id.name}`,
|
|
7822
7822
|
source: p,
|
|
7823
7823
|
target: h.dataContext.host,
|
|
@@ -7909,7 +7909,7 @@ class ji {
|
|
|
7909
7909
|
const r = this.computationHandleMap.get(i.computationType);
|
|
7910
7910
|
if (Array.isArray(i.contextType))
|
|
7911
7911
|
for (const s of i.contextType)
|
|
7912
|
-
|
|
7912
|
+
k(!r[s], `${s} for ${i.computationType.name} is already registered.`), r[s] = e;
|
|
7913
7913
|
else
|
|
7914
7914
|
r[i.contextType] = e;
|
|
7915
7915
|
}
|
|
@@ -7939,13 +7939,13 @@ class ji {
|
|
|
7939
7939
|
}
|
|
7940
7940
|
async createStateData(t, ...e) {
|
|
7941
7941
|
const i = this.computationsHandles.get(t);
|
|
7942
|
-
return
|
|
7942
|
+
return k(!!i, "cannot find computation handle"), i.createStateData?.(...e) ?? {};
|
|
7943
7943
|
}
|
|
7944
7944
|
addMutationPropertyComputationDefaultValueListeners() {
|
|
7945
7945
|
for (const t of this.computationsHandles.values())
|
|
7946
7946
|
if (t.getInitialValue && t.dataContext.type === "property") {
|
|
7947
7947
|
const e = t.dataContext;
|
|
7948
|
-
|
|
7948
|
+
k(!e.id.defaultValue, `${e.host.name}.${e.id.name} property shuold not has a defaultValue, because it will be overridden by computation`), this.controller.system.storage.listen(async (i) => {
|
|
7949
7949
|
for (let r of i)
|
|
7950
7950
|
if (r.type === "create" && r.recordName === e.host.name) {
|
|
7951
7951
|
const s = await t.getInitialValue?.(r.record);
|
|
@@ -7984,11 +7984,11 @@ class ji {
|
|
|
7984
7984
|
return [e.oldRecord ?? e.record];
|
|
7985
7985
|
let i = [];
|
|
7986
7986
|
if (!t.isRelation)
|
|
7987
|
-
|
|
7987
|
+
k(t.type === "update", "only support update event for entity"), i = await this.controller.system.storage.find(t.sourceRecordName, m.atom({
|
|
7988
7988
|
key: t.targetPath.concat("id").join("."),
|
|
7989
7989
|
value: ["=", e.oldRecord.id]
|
|
7990
7990
|
}), void 0);
|
|
7991
|
-
else if (
|
|
7991
|
+
else if (k(t.type === "create" || t.type === "delete", "only support create/delete event for relation"), t.dataDep, t.type === "create")
|
|
7992
7992
|
i = await this.controller.system.storage.find(t.sourceRecordName, m.atom({
|
|
7993
7993
|
key: t.targetPath.concat(["&", "id"]).join("."),
|
|
7994
7994
|
value: ["=", e.record.id]
|
|
@@ -8017,7 +8017,7 @@ class ji {
|
|
|
8017
8017
|
}
|
|
8018
8018
|
async computeDataBasedDirtyRecordsAndEvents(t, e) {
|
|
8019
8019
|
let i = [];
|
|
8020
|
-
if (t.dataDep.type === "global" && e.recordName ===
|
|
8020
|
+
if (t.dataDep.type === "global" && e.recordName === L)
|
|
8021
8021
|
if (t.computation.dataContext.type === "property") {
|
|
8022
8022
|
const r = t.computation.dataContext;
|
|
8023
8023
|
i = (await this.controller.system.storage.find(r.host.name, m.atom({ key: "id", value: ["not", null] }), {}, ["*"])).map((a) => [a, {
|
|
@@ -8066,7 +8066,7 @@ class ji {
|
|
|
8066
8066
|
try {
|
|
8067
8067
|
this.isDataBasedComputation(t.computation) ? i = await this.computeDataBasedDirtyRecordsAndEvents(t, e) : i = await this.computeEventBasedDirtyRecordsAndEvents(t, e);
|
|
8068
8068
|
} catch (r) {
|
|
8069
|
-
throw new
|
|
8069
|
+
throw new F("Failed to compute dirty records and events", {
|
|
8070
8070
|
handleName: t.computation.constructor.name,
|
|
8071
8071
|
computationName: t.computation.args.constructor.displayName,
|
|
8072
8072
|
dataContext: t.computation.dataContext,
|
|
@@ -8078,7 +8078,7 @@ class ji {
|
|
|
8078
8078
|
try {
|
|
8079
8079
|
await this.runComputation(t.computation, s, r);
|
|
8080
8080
|
} catch (a) {
|
|
8081
|
-
throw new
|
|
8081
|
+
throw new F("Failed to run computation for dirty record", {
|
|
8082
8082
|
handleName: t.computation.constructor.name,
|
|
8083
8083
|
computationName: t.computation.args.constructor.displayName,
|
|
8084
8084
|
dataContext: t.computation.dataContext,
|
|
@@ -8089,7 +8089,7 @@ class ji {
|
|
|
8089
8089
|
}
|
|
8090
8090
|
}
|
|
8091
8091
|
} catch (i) {
|
|
8092
|
-
throw i instanceof
|
|
8092
|
+
throw i instanceof F ? i : new xt("Unexpected error in dirty records computation", {
|
|
8093
8093
|
schedulingPhase: "dirty-records-processing",
|
|
8094
8094
|
failedComputations: [t.computation.args.constructor.displayName],
|
|
8095
8095
|
causedBy: i instanceof Error ? i : new Error(String(i))
|
|
@@ -8099,8 +8099,8 @@ class ji {
|
|
|
8099
8099
|
getAsyncTaskRecordKey(t) {
|
|
8100
8100
|
if (t.dataContext.type === "property") {
|
|
8101
8101
|
const e = t.dataContext;
|
|
8102
|
-
return `${
|
|
8103
|
-
} else return t.dataContext.type === "global" ? `${
|
|
8102
|
+
return `${Mt}_${e.host.name}_${e.id.name}`;
|
|
8103
|
+
} else return t.dataContext.type === "global" ? `${Mt}_${t.dataContext.id.name}` : `${Mt}_${t.dataContext.type}_${t.dataContext.id?.name}`;
|
|
8104
8104
|
}
|
|
8105
8105
|
async createAsyncTask(t, e, i, r) {
|
|
8106
8106
|
if (t.dataContext.type === "property")
|
|
@@ -8152,7 +8152,7 @@ class ji {
|
|
|
8152
8152
|
try {
|
|
8153
8153
|
a = t.dataDeps ? await this.resolveDataDeps(t, i) : {};
|
|
8154
8154
|
} catch (o) {
|
|
8155
|
-
throw new
|
|
8155
|
+
throw new H("Failed to resolve computation data dependencies", {
|
|
8156
8156
|
handleName: t.constructor.name,
|
|
8157
8157
|
computationName: t.args.constructor.displayName,
|
|
8158
8158
|
dataContext: t.dataContext,
|
|
@@ -8169,7 +8169,7 @@ class ji {
|
|
|
8169
8169
|
try {
|
|
8170
8170
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8171
8171
|
} catch (n) {
|
|
8172
|
-
throw new
|
|
8172
|
+
throw new ae("Failed to retrieve last value for incremental computation", {
|
|
8173
8173
|
handleName: t.constructor.name,
|
|
8174
8174
|
computationName: t.args.constructor.displayName,
|
|
8175
8175
|
dataContext: t.dataContext,
|
|
@@ -8183,7 +8183,7 @@ class ji {
|
|
|
8183
8183
|
try {
|
|
8184
8184
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8185
8185
|
} catch (n) {
|
|
8186
|
-
throw new
|
|
8186
|
+
throw new ae("Failed to retrieve last value for incremental patch computation", {
|
|
8187
8187
|
handleName: t.constructor.name,
|
|
8188
8188
|
computationName: t.args.constructor.displayName,
|
|
8189
8189
|
dataContext: t.dataContext,
|
|
@@ -8192,16 +8192,16 @@ class ji {
|
|
|
8192
8192
|
}
|
|
8193
8193
|
s = await t.incrementalPatchCompute(o, e, i, a);
|
|
8194
8194
|
} else
|
|
8195
|
-
throw new
|
|
8195
|
+
throw new F(`Unknown computation type: ${t.constructor.name}`, {
|
|
8196
8196
|
handleName: t.constructor.name,
|
|
8197
8197
|
computationName: t.args.constructor.displayName,
|
|
8198
8198
|
dataContext: t.dataContext,
|
|
8199
8199
|
computationPhase: "type-validation"
|
|
8200
8200
|
});
|
|
8201
|
-
if (s instanceof
|
|
8201
|
+
if (s instanceof pe) {
|
|
8202
8202
|
const o = t;
|
|
8203
8203
|
if (!o.compute)
|
|
8204
|
-
throw new
|
|
8204
|
+
throw new F("compute must be defined for computation when incrementalCompute returns ComputationResultFullRecompute", {
|
|
8205
8205
|
handleName: t.constructor.name,
|
|
8206
8206
|
computationName: t.args.constructor.displayName,
|
|
8207
8207
|
dataContext: t.dataContext,
|
|
@@ -8211,7 +8211,7 @@ class ji {
|
|
|
8211
8211
|
}
|
|
8212
8212
|
}
|
|
8213
8213
|
} catch (o) {
|
|
8214
|
-
throw o instanceof
|
|
8214
|
+
throw o instanceof F ? o : new F("Computation execution failed", {
|
|
8215
8215
|
handleName: t.constructor.name,
|
|
8216
8216
|
computationName: t.args.constructor.displayName,
|
|
8217
8217
|
dataContext: t.dataContext,
|
|
@@ -8219,13 +8219,13 @@ class ji {
|
|
|
8219
8219
|
causedBy: o instanceof Error ? o : new Error(String(o))
|
|
8220
8220
|
});
|
|
8221
8221
|
}
|
|
8222
|
-
if (s instanceof
|
|
8222
|
+
if (s instanceof Nt)
|
|
8223
8223
|
return;
|
|
8224
|
-
if (s instanceof
|
|
8224
|
+
if (s instanceof fe)
|
|
8225
8225
|
try {
|
|
8226
8226
|
return await this.createAsyncTask(t, s.args, i);
|
|
8227
8227
|
} catch (o) {
|
|
8228
|
-
throw new
|
|
8228
|
+
throw new F("Failed to create async task", {
|
|
8229
8229
|
handleName: t.constructor.name,
|
|
8230
8230
|
computationName: t.args.constructor.displayName,
|
|
8231
8231
|
dataContext: t.dataContext,
|
|
@@ -8234,10 +8234,10 @@ class ji {
|
|
|
8234
8234
|
});
|
|
8235
8235
|
}
|
|
8236
8236
|
try {
|
|
8237
|
-
const o = s instanceof
|
|
8237
|
+
const o = s instanceof me ? await t.asyncReturn(s.result, s.args) : s;
|
|
8238
8238
|
t.incrementalPatchCompute ? await this.controller.applyResultPatch(t.dataContext, o, i) : await this.controller.applyResult(t.dataContext, o, i);
|
|
8239
8239
|
} catch (o) {
|
|
8240
|
-
throw new
|
|
8240
|
+
throw new F("Failed to apply computation result", {
|
|
8241
8241
|
handleName: t.constructor.name,
|
|
8242
8242
|
computationName: t.args.constructor.displayName,
|
|
8243
8243
|
dataContext: t.dataContext,
|
|
@@ -8246,7 +8246,7 @@ class ji {
|
|
|
8246
8246
|
});
|
|
8247
8247
|
}
|
|
8248
8248
|
} catch (s) {
|
|
8249
|
-
throw s instanceof
|
|
8249
|
+
throw s instanceof F ? s : new F("Unexpected error during computation execution", {
|
|
8250
8250
|
handleName: t.constructor.name,
|
|
8251
8251
|
computationName: t.args.constructor.displayName,
|
|
8252
8252
|
dataContext: t.dataContext,
|
|
@@ -8264,7 +8264,7 @@ class ji {
|
|
|
8264
8264
|
return await this.controller.system.storage.find(s.source.name, void 0, {}, s.attributeQuery);
|
|
8265
8265
|
if (s.type === "property") {
|
|
8266
8266
|
if (!e?.id)
|
|
8267
|
-
throw new
|
|
8267
|
+
throw new H("Record ID is required for property data dependency", {
|
|
8268
8268
|
depName: r,
|
|
8269
8269
|
depType: s.type,
|
|
8270
8270
|
missingData: !0,
|
|
@@ -8276,7 +8276,7 @@ class ji {
|
|
|
8276
8276
|
} else {
|
|
8277
8277
|
if (s.type === "global")
|
|
8278
8278
|
return await this.controller.system.storage.dict.get(s.source.name);
|
|
8279
|
-
throw new
|
|
8279
|
+
throw new H(`Unknown data dependency type: ${s.type}`, {
|
|
8280
8280
|
depName: r,
|
|
8281
8281
|
depType: s.type,
|
|
8282
8282
|
invalidData: !0,
|
|
@@ -8286,7 +8286,7 @@ class ji {
|
|
|
8286
8286
|
});
|
|
8287
8287
|
}
|
|
8288
8288
|
} catch (a) {
|
|
8289
|
-
throw a instanceof
|
|
8289
|
+
throw a instanceof H ? a : new H(`Failed to resolve data dependency '${r}'`, {
|
|
8290
8290
|
depName: r,
|
|
8291
8291
|
depType: s.type,
|
|
8292
8292
|
handleName: t.constructor.name,
|
|
@@ -8298,7 +8298,7 @@ class ji {
|
|
|
8298
8298
|
}));
|
|
8299
8299
|
return Object.fromEntries(Object.entries(t.dataDeps).map(([r], s) => [r, i[s]]));
|
|
8300
8300
|
} catch (i) {
|
|
8301
|
-
throw i instanceof
|
|
8301
|
+
throw i instanceof H ? i : new H("Failed to resolve computation data dependencies", {
|
|
8302
8302
|
handleName: t.constructor.name,
|
|
8303
8303
|
computationName: t.args.constructor.displayName,
|
|
8304
8304
|
dataContext: t.dataContext,
|
|
@@ -8317,34 +8317,34 @@ class ji {
|
|
|
8317
8317
|
try {
|
|
8318
8318
|
this.addMutationPropertyComputationDefaultValueListeners(), this.addMutationComputationListeners(), t && (await this.setupGlobalBoundStateDefaultValues(), await this.setupGlobalComputationDefaultValue(), await this.setupDictDefaultValue());
|
|
8319
8319
|
} catch (e) {
|
|
8320
|
-
throw e instanceof
|
|
8320
|
+
throw e instanceof xt ? e : new xt("Unexpected error during scheduler setup", {
|
|
8321
8321
|
schedulingPhase: "top-level-setup",
|
|
8322
8322
|
causedBy: e instanceof Error ? e : new Error(String(e))
|
|
8323
8323
|
});
|
|
8324
8324
|
}
|
|
8325
8325
|
}
|
|
8326
8326
|
}
|
|
8327
|
-
const
|
|
8328
|
-
function
|
|
8329
|
-
return
|
|
8327
|
+
const Jt = new ne();
|
|
8328
|
+
function Bi() {
|
|
8329
|
+
return Jt.getStore()?.effects;
|
|
8330
8330
|
}
|
|
8331
|
-
function
|
|
8332
|
-
const t =
|
|
8331
|
+
function oe(u) {
|
|
8332
|
+
const t = Jt.getStore();
|
|
8333
8333
|
t?.effects && t.effects.push(...u);
|
|
8334
8334
|
}
|
|
8335
8335
|
const xr = "User";
|
|
8336
|
-
class
|
|
8336
|
+
class ge {
|
|
8337
8337
|
constructor(t) {
|
|
8338
8338
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
8339
8339
|
}
|
|
8340
8340
|
static create(t) {
|
|
8341
|
-
return new
|
|
8341
|
+
return new ge(t);
|
|
8342
8342
|
}
|
|
8343
8343
|
}
|
|
8344
|
-
const
|
|
8344
|
+
const $t = "_isDeleted_", Mr = {
|
|
8345
8345
|
create() {
|
|
8346
8346
|
return N.create({
|
|
8347
|
-
name:
|
|
8347
|
+
name: $t,
|
|
8348
8348
|
type: "boolean"
|
|
8349
8349
|
});
|
|
8350
8350
|
}
|
|
@@ -8373,19 +8373,19 @@ class Pr {
|
|
|
8373
8373
|
for (const p of this.eventSources)
|
|
8374
8374
|
p.entity && p.entity.name && !d.has(p.entity.name) && (this.entities.push(p.entity), d.add(p.entity.name));
|
|
8375
8375
|
const h = [
|
|
8376
|
-
...Ii,
|
|
8377
|
-
...xi,
|
|
8378
|
-
...Ai,
|
|
8379
8376
|
...vi,
|
|
8377
|
+
...Ai,
|
|
8380
8378
|
...Ri,
|
|
8381
|
-
...Fi,
|
|
8382
|
-
...Li,
|
|
8383
|
-
...$i,
|
|
8384
8379
|
...yi,
|
|
8385
|
-
...
|
|
8380
|
+
...pi,
|
|
8381
|
+
...Mi,
|
|
8382
|
+
...$i,
|
|
8383
|
+
...Ei,
|
|
8384
|
+
...ui,
|
|
8385
|
+
...Vi,
|
|
8386
8386
|
...n
|
|
8387
8387
|
];
|
|
8388
|
-
this.scheduler = new
|
|
8388
|
+
this.scheduler = new qi(this, this.entities, this.relations, this.dict, h), o.forEach((p) => {
|
|
8389
8389
|
let y = this.recordNameToSideEffects.get(p.record.name);
|
|
8390
8390
|
y || this.recordNameToSideEffects.set(p.record.name, y = /* @__PURE__ */ new Set()), y.add(p);
|
|
8391
8391
|
});
|
|
@@ -8405,7 +8405,7 @@ class Pr {
|
|
|
8405
8405
|
}
|
|
8406
8406
|
}
|
|
8407
8407
|
async applyResult(t, e, i) {
|
|
8408
|
-
if (!(e instanceof
|
|
8408
|
+
if (!(e instanceof Nt)) {
|
|
8409
8409
|
if (t.type === "global")
|
|
8410
8410
|
return this.system.storage.dict.set(t.id.name, e);
|
|
8411
8411
|
if (t.type === "entity") {
|
|
@@ -8424,12 +8424,12 @@ class Pr {
|
|
|
8424
8424
|
await this.system.storage.create(r.id.name, a);
|
|
8425
8425
|
} else {
|
|
8426
8426
|
const r = t;
|
|
8427
|
-
r.id.name ===
|
|
8427
|
+
r.id.name === $t && 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 });
|
|
8428
8428
|
}
|
|
8429
8429
|
}
|
|
8430
8430
|
}
|
|
8431
8431
|
async applyResultPatch(t, e, i) {
|
|
8432
|
-
if (e instanceof
|
|
8432
|
+
if (e instanceof Nt || e === void 0) return;
|
|
8433
8433
|
const r = Array.isArray(e) ? e : [e];
|
|
8434
8434
|
for (const s of r) {
|
|
8435
8435
|
if (t.type === "global")
|
|
@@ -8447,7 +8447,7 @@ class Pr {
|
|
|
8447
8447
|
}
|
|
8448
8448
|
} else {
|
|
8449
8449
|
const a = t;
|
|
8450
|
-
a.id.name ===
|
|
8450
|
+
a.id.name === $t && s.data ? (k(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 });
|
|
8451
8451
|
}
|
|
8452
8452
|
}
|
|
8453
8453
|
}
|
|
@@ -8457,7 +8457,7 @@ class Pr {
|
|
|
8457
8457
|
*/
|
|
8458
8458
|
async dispatch(t, e) {
|
|
8459
8459
|
const i = { effects: [] };
|
|
8460
|
-
return
|
|
8460
|
+
return Jt.run(i, async () => {
|
|
8461
8461
|
await this.system.storage.beginTransaction(t.name);
|
|
8462
8462
|
let r;
|
|
8463
8463
|
try {
|
|
@@ -8494,7 +8494,7 @@ class Pr {
|
|
|
8494
8494
|
result: await a.content.call(this, r)
|
|
8495
8495
|
};
|
|
8496
8496
|
} catch (o) {
|
|
8497
|
-
const n = new
|
|
8497
|
+
const n = new Li(
|
|
8498
8498
|
`Side effect '${a.name}' failed for ${r.type} on ${r.recordName}`,
|
|
8499
8499
|
{
|
|
8500
8500
|
sideEffectName: a.name,
|
|
@@ -8522,22 +8522,22 @@ class Pr {
|
|
|
8522
8522
|
return this.eventSourcesByName.get(t);
|
|
8523
8523
|
}
|
|
8524
8524
|
}
|
|
8525
|
-
function
|
|
8525
|
+
function _i(u) {
|
|
8526
8526
|
return encodeURI(JSON.stringify(u));
|
|
8527
8527
|
}
|
|
8528
|
-
function
|
|
8528
|
+
function Wi(u) {
|
|
8529
8529
|
return u === void 0 ? void 0 : JSON.parse(decodeURI(u));
|
|
8530
8530
|
}
|
|
8531
|
-
class
|
|
8531
|
+
class Ji {
|
|
8532
8532
|
constructor(t) {
|
|
8533
8533
|
this.db = t, this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
|
|
8534
8534
|
get: async (e) => {
|
|
8535
8535
|
const i = m.atom({ key: "key", value: ["=", e] });
|
|
8536
|
-
return (await this.queryHandle.findOne(
|
|
8536
|
+
return (await this.queryHandle.findOne(L, i, void 0, ["value"]))?.value?.raw;
|
|
8537
8537
|
},
|
|
8538
8538
|
set: async (e, i) => {
|
|
8539
|
-
const r = m.atom({ key: "key", value: ["=", e] }), s = await this.queryHandle.findOne(
|
|
8540
|
-
return s ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [
|
|
8539
|
+
const r = m.atom({ key: "key", value: ["=", e] }), s = await this.queryHandle.findOne(L, r, void 0, ["value"]);
|
|
8540
|
+
return s ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [L, m.atom({ key: "id", value: ["=", s.id] }), { key: e, value: { raw: i } }], []) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [L, { key: e, value: { raw: i } }], []);
|
|
8541
8541
|
}
|
|
8542
8542
|
};
|
|
8543
8543
|
}
|
|
@@ -8552,21 +8552,21 @@ class Xi {
|
|
|
8552
8552
|
}
|
|
8553
8553
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
8554
8554
|
async get(t, e, i) {
|
|
8555
|
-
const r = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(
|
|
8556
|
-
return s === void 0 ? i :
|
|
8555
|
+
const r = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(Z, r, void 0, ["value"]))?.value;
|
|
8556
|
+
return s === void 0 ? i : Wi(s);
|
|
8557
8557
|
}
|
|
8558
8558
|
async set(t, e, i, r) {
|
|
8559
8559
|
const s = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
8560
|
-
return await this.queryHandle.findOne(
|
|
8560
|
+
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: _i(i) }], r) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [Z, { concept: t, key: e.toString(), value: encodeURI(JSON.stringify(i)) }], r);
|
|
8561
8561
|
}
|
|
8562
8562
|
async setup(t, e, i = !1) {
|
|
8563
8563
|
await this.db.open(i);
|
|
8564
|
-
const r = new
|
|
8564
|
+
const r = new si(
|
|
8565
8565
|
t,
|
|
8566
8566
|
e,
|
|
8567
8567
|
this.db
|
|
8568
8568
|
);
|
|
8569
|
-
i && await r.createTables(), this.queryHandle = new
|
|
8569
|
+
i && await r.createTables(), this.queryHandle = new We(new Je(r.map, r.aliasManager), this.db), this.map = r.map;
|
|
8570
8570
|
}
|
|
8571
8571
|
findOne(...t) {
|
|
8572
8572
|
return this.queryHandle.findOne(...t);
|
|
@@ -8586,8 +8586,8 @@ class Xi {
|
|
|
8586
8586
|
async callWithEvents(t, e, i = []) {
|
|
8587
8587
|
const r = [], s = await t(...e, r), a = await this.dispatch(r);
|
|
8588
8588
|
i.push(...r, ...a);
|
|
8589
|
-
const o =
|
|
8590
|
-
return o && r.length > 0 &&
|
|
8589
|
+
const o = Bi();
|
|
8590
|
+
return o && r.length > 0 && oe(r), o && a.length > 0 && oe(a), s;
|
|
8591
8591
|
}
|
|
8592
8592
|
findRelationByName(...t) {
|
|
8593
8593
|
return this.queryHandle.findRelationByName(...t);
|
|
@@ -8625,8 +8625,8 @@ class Xi {
|
|
|
8625
8625
|
return this.db.close();
|
|
8626
8626
|
}
|
|
8627
8627
|
}
|
|
8628
|
-
var
|
|
8629
|
-
class
|
|
8628
|
+
var Hi = /* @__PURE__ */ ((u) => (u[u.ERROR = 0] = "ERROR", u[u.INFO = 1] = "INFO", u))(Hi || {});
|
|
8629
|
+
class Ht {
|
|
8630
8630
|
constructor(t = 0) {
|
|
8631
8631
|
this.level = t;
|
|
8632
8632
|
}
|
|
@@ -8637,11 +8637,11 @@ class Ut {
|
|
|
8637
8637
|
this.level >= 0 && console.error({ type: t, name: e, sql: i, params: r, error: s });
|
|
8638
8638
|
}
|
|
8639
8639
|
child() {
|
|
8640
|
-
return new
|
|
8640
|
+
return new Ht(this.level);
|
|
8641
8641
|
}
|
|
8642
8642
|
}
|
|
8643
|
-
var
|
|
8644
|
-
class
|
|
8643
|
+
var ji = /* @__PURE__ */ ((u) => (u[u.MUTE = -1] = "MUTE", u[u.ERROR = 0] = "ERROR", u[u.INFO = 1] = "INFO", u[u.DEBUG = 2] = "DEBUG", u))(ji || {});
|
|
8644
|
+
class jt {
|
|
8645
8645
|
constructor(t = 0) {
|
|
8646
8646
|
this.level = t;
|
|
8647
8647
|
}
|
|
@@ -8655,16 +8655,16 @@ class Gt {
|
|
|
8655
8655
|
this.level >= 2 && console.debug(`[DEBUG] ${t}: ${e}`, i);
|
|
8656
8656
|
}
|
|
8657
8657
|
child(t) {
|
|
8658
|
-
return new
|
|
8658
|
+
return new jt(this.level);
|
|
8659
8659
|
}
|
|
8660
8660
|
}
|
|
8661
|
-
const
|
|
8662
|
-
class
|
|
8663
|
-
constructor(t, e =
|
|
8664
|
-
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new
|
|
8661
|
+
const Cr = new Ht(), Ui = new jt();
|
|
8662
|
+
class $r {
|
|
8663
|
+
constructor(t, e = Ui) {
|
|
8664
|
+
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new Ji(t);
|
|
8665
8665
|
}
|
|
8666
8666
|
setup(t, e, i, r = !1) {
|
|
8667
|
-
const s = new
|
|
8667
|
+
const s = new de(t, e), { entities: a, relations: o } = s.getAll();
|
|
8668
8668
|
return i.forEach(({ dataContext: n, state: c }) => {
|
|
8669
8669
|
Object.entries(c).forEach(([l, d]) => {
|
|
8670
8670
|
if (d instanceof E) {
|
|
@@ -8690,7 +8690,7 @@ class Or {
|
|
|
8690
8690
|
}
|
|
8691
8691
|
});
|
|
8692
8692
|
}), this.storage.setup(
|
|
8693
|
-
[...a,
|
|
8693
|
+
[...a, oi, ai],
|
|
8694
8694
|
o,
|
|
8695
8695
|
r
|
|
8696
8696
|
);
|
|
@@ -8699,8 +8699,8 @@ class Or {
|
|
|
8699
8699
|
this.storage.destroy();
|
|
8700
8700
|
}
|
|
8701
8701
|
}
|
|
8702
|
-
const
|
|
8703
|
-
class
|
|
8702
|
+
const Or = new ne();
|
|
8703
|
+
class kt {
|
|
8704
8704
|
constructor(t, e) {
|
|
8705
8705
|
this._type = "Action", this._options = e, this.uuid = T(e), this.name = t.name;
|
|
8706
8706
|
}
|
|
@@ -8722,7 +8722,7 @@ class Et {
|
|
|
8722
8722
|
};
|
|
8723
8723
|
}
|
|
8724
8724
|
static create(t, e) {
|
|
8725
|
-
const i = new
|
|
8725
|
+
const i = new kt(t, e);
|
|
8726
8726
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8727
8727
|
throw new Error(`duplicate uuid in options ${i.uuid}, Action`);
|
|
8728
8728
|
return this.instances.push(i), i;
|
|
@@ -8754,8 +8754,8 @@ class Et {
|
|
|
8754
8754
|
return this.create(e.public, e.options);
|
|
8755
8755
|
}
|
|
8756
8756
|
}
|
|
8757
|
-
const
|
|
8758
|
-
function
|
|
8757
|
+
const Gi = kt.create({ name: "get" });
|
|
8758
|
+
function Ot(u) {
|
|
8759
8759
|
if (!u) return;
|
|
8760
8760
|
if (u.raw.type === "atom")
|
|
8761
8761
|
return ft.create({
|
|
@@ -8766,13 +8766,13 @@ function Dt(u) {
|
|
|
8766
8766
|
return mt.create({
|
|
8767
8767
|
type: "expression",
|
|
8768
8768
|
operator: t.operator,
|
|
8769
|
-
left:
|
|
8770
|
-
right:
|
|
8769
|
+
left: Ot(u.left),
|
|
8770
|
+
right: Ot(u.right)
|
|
8771
8771
|
});
|
|
8772
8772
|
}
|
|
8773
|
-
class
|
|
8773
|
+
class St {
|
|
8774
8774
|
constructor(t, e) {
|
|
8775
|
-
this._type = "Conditions", this._options = e, this.uuid = T(e), t.content && t.content instanceof R ? this.content =
|
|
8775
|
+
this._type = "Conditions", this._options = e, this.uuid = T(e), t.content && t.content instanceof R ? this.content = Ot(t.content) : this.content = t.content;
|
|
8776
8776
|
}
|
|
8777
8777
|
static {
|
|
8778
8778
|
this.isKlass = !0;
|
|
@@ -8793,7 +8793,7 @@ class bt {
|
|
|
8793
8793
|
};
|
|
8794
8794
|
}
|
|
8795
8795
|
static create(t, e) {
|
|
8796
|
-
const i = new
|
|
8796
|
+
const i = new St(t, e);
|
|
8797
8797
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8798
8798
|
throw new Error(`duplicate uuid in options ${i.uuid}, Conditions`);
|
|
8799
8799
|
return this.instances.push(i), i;
|
|
@@ -8824,7 +8824,7 @@ class bt {
|
|
|
8824
8824
|
return this.create(e.public, e.options);
|
|
8825
8825
|
}
|
|
8826
8826
|
}
|
|
8827
|
-
class
|
|
8827
|
+
class z {
|
|
8828
8828
|
constructor(t, e) {
|
|
8829
8829
|
this._type = "Attributive", this._options = e, this.uuid = T(e), this.stringContent = t.stringContent, this.content = t.content, this.name = t.name, this.isRef = t.isRef;
|
|
8830
8830
|
}
|
|
@@ -8856,7 +8856,7 @@ class K {
|
|
|
8856
8856
|
};
|
|
8857
8857
|
}
|
|
8858
8858
|
static create(t, e) {
|
|
8859
|
-
const i = new
|
|
8859
|
+
const i = new z(t, e);
|
|
8860
8860
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8861
8861
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributive`);
|
|
8862
8862
|
return this.instances.push(i), i;
|
|
@@ -8892,7 +8892,7 @@ class K {
|
|
|
8892
8892
|
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);
|
|
8893
8893
|
}
|
|
8894
8894
|
}
|
|
8895
|
-
class
|
|
8895
|
+
class bt {
|
|
8896
8896
|
constructor(t, e) {
|
|
8897
8897
|
this._type = "Attributives", this._options = e, this.uuid = T(e), this.content = t.content;
|
|
8898
8898
|
}
|
|
@@ -8915,7 +8915,7 @@ class Rt {
|
|
|
8915
8915
|
};
|
|
8916
8916
|
}
|
|
8917
8917
|
static create(t, e) {
|
|
8918
|
-
const i = new
|
|
8918
|
+
const i = new bt(t, e);
|
|
8919
8919
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8920
8920
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributives`);
|
|
8921
8921
|
return this.instances.push(i), i;
|
|
@@ -8946,7 +8946,7 @@ class Rt {
|
|
|
8946
8946
|
return this.create(e.public, e.options);
|
|
8947
8947
|
}
|
|
8948
8948
|
}
|
|
8949
|
-
function
|
|
8949
|
+
function Dt(u) {
|
|
8950
8950
|
if (!u) return;
|
|
8951
8951
|
if (u.raw.type === "atom")
|
|
8952
8952
|
return ft.create({
|
|
@@ -8957,26 +8957,27 @@ function Ft(u) {
|
|
|
8957
8957
|
return mt.create({
|
|
8958
8958
|
type: "expression",
|
|
8959
8959
|
operator: t.operator,
|
|
8960
|
-
left:
|
|
8961
|
-
right:
|
|
8960
|
+
left: Dt(u.left),
|
|
8961
|
+
right: Dt(u.right)
|
|
8962
8962
|
});
|
|
8963
8963
|
}
|
|
8964
|
-
function
|
|
8965
|
-
return
|
|
8966
|
-
content:
|
|
8964
|
+
function Dr(u) {
|
|
8965
|
+
return bt.create({
|
|
8966
|
+
content: Dt(u)
|
|
8967
8967
|
});
|
|
8968
8968
|
}
|
|
8969
|
-
const
|
|
8970
|
-
name:
|
|
8969
|
+
const Ki = "_Interaction_", Ut = I.create({
|
|
8970
|
+
name: Ki,
|
|
8971
8971
|
properties: [
|
|
8972
8972
|
N.create({ name: "interactionId", type: "string", collection: !1 }),
|
|
8973
8973
|
N.create({ name: "interactionName", type: "string", collection: !1 }),
|
|
8974
8974
|
N.create({ name: "payload", type: "object", collection: !1 }),
|
|
8975
8975
|
N.create({ name: "user", type: "object", collection: !1 }),
|
|
8976
|
-
N.create({ name: "query", type: "object", collection: !1 })
|
|
8976
|
+
N.create({ name: "query", type: "object", collection: !1 }),
|
|
8977
|
+
N.create({ name: "context", type: "object", collection: !1 })
|
|
8977
8978
|
]
|
|
8978
8979
|
});
|
|
8979
|
-
class
|
|
8980
|
+
class Gt {
|
|
8980
8981
|
constructor(t, e) {
|
|
8981
8982
|
this._type = "Interaction", this._options = e, this.uuid = T(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.data = t.data, this.dataPolicy = t.dataPolicy;
|
|
8982
8983
|
}
|
|
@@ -9032,10 +9033,10 @@ class Xt {
|
|
|
9032
9033
|
};
|
|
9033
9034
|
}
|
|
9034
9035
|
static create(t, e) {
|
|
9035
|
-
const i = new
|
|
9036
|
+
const i = new Gt(t, e);
|
|
9036
9037
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9037
9038
|
throw new Error(`duplicate uuid in options ${i.uuid}, Interaction`);
|
|
9038
|
-
return i.entity =
|
|
9039
|
+
return i.entity = Ut, i.guard = Xi(i), i.mapEventData = zi(i), t.action === Gi && (i.resolve = Yi(i)), this.instances.push(i), i;
|
|
9039
9040
|
}
|
|
9040
9041
|
static stringify(t) {
|
|
9041
9042
|
const e = {
|
|
@@ -9069,33 +9070,34 @@ class Xt {
|
|
|
9069
9070
|
return this.create(e.public, e.options);
|
|
9070
9071
|
}
|
|
9071
9072
|
}
|
|
9072
|
-
class
|
|
9073
|
+
class q extends Error {
|
|
9073
9074
|
constructor(t, e) {
|
|
9074
9075
|
super(t), this.name = "InteractionGuardError", this.type = e.type, this.checkType = e.checkType, this.error = e.error;
|
|
9075
9076
|
}
|
|
9076
9077
|
}
|
|
9077
|
-
function
|
|
9078
|
+
function Xi(u) {
|
|
9078
9079
|
return async function(t) {
|
|
9079
|
-
await
|
|
9080
|
+
await be(this, u, t), await tr(this, u, t), await Re(this, u, t);
|
|
9080
9081
|
};
|
|
9081
9082
|
}
|
|
9082
|
-
function
|
|
9083
|
+
function zi(u) {
|
|
9083
9084
|
return (t) => ({
|
|
9084
9085
|
interactionName: u.name,
|
|
9085
9086
|
interactionId: u.uuid,
|
|
9086
9087
|
user: t.user,
|
|
9087
9088
|
query: t.query || {},
|
|
9088
|
-
payload: t.payload || {}
|
|
9089
|
+
payload: t.payload || {},
|
|
9090
|
+
context: t.context || {}
|
|
9089
9091
|
});
|
|
9090
9092
|
}
|
|
9091
|
-
function
|
|
9093
|
+
function Yi(u) {
|
|
9092
9094
|
return async function(t) {
|
|
9093
|
-
return
|
|
9095
|
+
return er(this, u, t);
|
|
9094
9096
|
};
|
|
9095
9097
|
}
|
|
9096
|
-
async function
|
|
9098
|
+
async function be(u, t, e) {
|
|
9097
9099
|
if (!t.conditions) return;
|
|
9098
|
-
const i =
|
|
9100
|
+
const i = St.is(t.conditions) ? new R(t.conditions.content) : R.atom(t.conditions), r = async (a) => {
|
|
9099
9101
|
if (!a) return !0;
|
|
9100
9102
|
if (a.content) {
|
|
9101
9103
|
let o;
|
|
@@ -9110,13 +9112,13 @@ async function rr(u, t, e) {
|
|
|
9110
9112
|
return !0;
|
|
9111
9113
|
}, s = await i.evaluateAsync(r);
|
|
9112
9114
|
if (s !== !0)
|
|
9113
|
-
throw new
|
|
9115
|
+
throw new q(`Condition check failed: ${s?.data?.name}`, {
|
|
9114
9116
|
type: "condition check failed",
|
|
9115
9117
|
checkType: "condition",
|
|
9116
9118
|
error: s
|
|
9117
9119
|
});
|
|
9118
9120
|
}
|
|
9119
|
-
async function
|
|
9121
|
+
async function Zi(u, t, e, i) {
|
|
9120
9122
|
if (t.content) {
|
|
9121
9123
|
let r;
|
|
9122
9124
|
try {
|
|
@@ -9128,87 +9130,87 @@ async function sr(u, t, e, i) {
|
|
|
9128
9130
|
}
|
|
9129
9131
|
return !0;
|
|
9130
9132
|
}
|
|
9131
|
-
async function
|
|
9133
|
+
async function tr(u, t, e) {
|
|
9132
9134
|
if (!t.userAttributives) return;
|
|
9133
|
-
const i =
|
|
9135
|
+
const i = bt.is(t.userAttributives) ? R.fromValue(t.userAttributives.content) : R.atom(t.userAttributives), r = (a) => Zi(u, a, e, e.user), s = await i.evaluateAsync(r);
|
|
9134
9136
|
if (s !== !0)
|
|
9135
|
-
throw new
|
|
9137
|
+
throw new q("User check failed", {
|
|
9136
9138
|
type: "check user failed",
|
|
9137
9139
|
checkType: "user",
|
|
9138
9140
|
error: s
|
|
9139
9141
|
});
|
|
9140
9142
|
}
|
|
9141
|
-
async function
|
|
9143
|
+
async function Re(u, t, e) {
|
|
9142
9144
|
const i = e.payload || {}, r = t.payload?.items || [], s = Object.keys(i);
|
|
9143
9145
|
for (const a of s)
|
|
9144
9146
|
if (!r.some((o) => o.name === a))
|
|
9145
|
-
throw new
|
|
9147
|
+
throw new q(
|
|
9146
9148
|
`${a} in payload is not defined in interaction ${t.name}`,
|
|
9147
9149
|
{ type: `${a} not defined`, checkType: "payload" }
|
|
9148
9150
|
);
|
|
9149
9151
|
for (const a of r) {
|
|
9150
9152
|
if (a.required && !(a.name in i))
|
|
9151
|
-
throw new
|
|
9153
|
+
throw new q(
|
|
9152
9154
|
`Payload validation failed for field '${a.name}': missing`,
|
|
9153
9155
|
{ type: `${a.name} missing`, checkType: "payload" }
|
|
9154
9156
|
);
|
|
9155
9157
|
const o = i[a.name];
|
|
9156
9158
|
if (o === void 0) return;
|
|
9157
9159
|
if (a.isCollection && !Array.isArray(o))
|
|
9158
|
-
throw new
|
|
9160
|
+
throw new q(
|
|
9159
9161
|
`Payload validation failed for field '${a.name}': data is not array`,
|
|
9160
9162
|
{ type: `${a.name} data is not array`, checkType: "payload" }
|
|
9161
9163
|
);
|
|
9162
9164
|
if (a.isCollection) {
|
|
9163
9165
|
if (a.isRef && !o.every((n) => !!n.id))
|
|
9164
|
-
throw new
|
|
9166
|
+
throw new q(
|
|
9165
9167
|
`Payload validation failed for field '${a.name}': data not every is ref`,
|
|
9166
9168
|
{ type: `${a.name} data not every is ref`, checkType: "payload" }
|
|
9167
9169
|
);
|
|
9168
9170
|
} else if (a.isRef && !o.id)
|
|
9169
|
-
throw new
|
|
9171
|
+
throw new q(
|
|
9170
9172
|
`Payload validation failed for field '${a.name}': data is not a ref`,
|
|
9171
9173
|
{ type: `${a.name} data is not a ref`, checkType: "payload" }
|
|
9172
9174
|
);
|
|
9173
9175
|
if (a.base)
|
|
9174
9176
|
if (a.isCollection)
|
|
9175
9177
|
for (const n of o) {
|
|
9176
|
-
const c = await
|
|
9178
|
+
const c = await tt(n, a.base);
|
|
9177
9179
|
if (c !== !0)
|
|
9178
|
-
throw new
|
|
9180
|
+
throw new q(
|
|
9179
9181
|
`Concept check failed for field '${a.name}'`,
|
|
9180
9182
|
{ type: `${a.name} check concept failed`, checkType: "concept", error: c }
|
|
9181
9183
|
);
|
|
9182
9184
|
}
|
|
9183
9185
|
else {
|
|
9184
|
-
const n = await
|
|
9186
|
+
const n = await tt(o, a.base);
|
|
9185
9187
|
if (n !== !0)
|
|
9186
|
-
throw new
|
|
9188
|
+
throw new q(
|
|
9187
9189
|
`Concept check failed for field '${a.name}'`,
|
|
9188
9190
|
{ type: `${a.name} check concept failed`, checkType: "concept", error: n }
|
|
9189
9191
|
);
|
|
9190
9192
|
}
|
|
9191
9193
|
}
|
|
9192
9194
|
}
|
|
9193
|
-
async function
|
|
9195
|
+
async function tt(u, t) {
|
|
9194
9196
|
if (t.base) {
|
|
9195
9197
|
const e = t;
|
|
9196
|
-
return e.attributive,
|
|
9198
|
+
return e.attributive, tt(u, e.base);
|
|
9197
9199
|
}
|
|
9198
9200
|
if (t.for) {
|
|
9199
9201
|
for (const e of t.for)
|
|
9200
|
-
if (await
|
|
9202
|
+
if (await tt(u, e) === !0) return !0;
|
|
9201
9203
|
return { name: t.name, type: "conceptAlias", error: "no match" };
|
|
9202
9204
|
}
|
|
9203
|
-
return
|
|
9205
|
+
return z.is(t) ? !0 : I.is(t) ? u && typeof u == "object" ? !0 : { name: t.name || "", type: "conceptCheck", error: "invalid entity data" } : !0;
|
|
9204
9206
|
}
|
|
9205
|
-
async function
|
|
9206
|
-
if (I.is(t.data) ||
|
|
9207
|
+
async function er(u, t, e) {
|
|
9208
|
+
if (I.is(t.data) || C.is(t.data)) {
|
|
9207
9209
|
const i = t.data.name, r = t.dataPolicy?.match, s = t.dataPolicy?.modifier, a = { ...e.query?.modifier || {}, ...s || {} }, o = e.query?.attributeQuery || [], n = typeof r == "function" ? await r.call(u, e) : r, c = R.and(n, e.query?.match);
|
|
9208
9210
|
return u.system.storage.find(i, c, a, o);
|
|
9209
9211
|
}
|
|
9210
9212
|
}
|
|
9211
|
-
class
|
|
9213
|
+
class Kt {
|
|
9212
9214
|
constructor(t, e) {
|
|
9213
9215
|
this._type = "Activity", this._options = e, this.uuid = T(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 || [];
|
|
9214
9216
|
}
|
|
@@ -9256,7 +9258,7 @@ class zt {
|
|
|
9256
9258
|
};
|
|
9257
9259
|
}
|
|
9258
9260
|
static create(t, e) {
|
|
9259
|
-
const i = new
|
|
9261
|
+
const i = new Kt(t, e);
|
|
9260
9262
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9261
9263
|
throw new Error(`duplicate uuid in options ${i.uuid}, Activity`);
|
|
9262
9264
|
return this.instances.push(i), i;
|
|
@@ -9357,7 +9359,7 @@ class st {
|
|
|
9357
9359
|
return this.create(e.public, e.options);
|
|
9358
9360
|
}
|
|
9359
9361
|
}
|
|
9360
|
-
class
|
|
9362
|
+
class we {
|
|
9361
9363
|
constructor(t, e) {
|
|
9362
9364
|
this._type = "Transfer", this._options = e, this.uuid = T(e), this.name = t.name, this.source = t.source, this.target = t.target;
|
|
9363
9365
|
}
|
|
@@ -9390,7 +9392,7 @@ class Te {
|
|
|
9390
9392
|
};
|
|
9391
9393
|
}
|
|
9392
9394
|
static create(t, e) {
|
|
9393
|
-
const i = new
|
|
9395
|
+
const i = new we(t, e);
|
|
9394
9396
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9395
9397
|
throw new Error(`duplicate uuid in options ${i.uuid}, Transfer`);
|
|
9396
9398
|
return this.instances.push(i), i;
|
|
@@ -9426,19 +9428,19 @@ class Te {
|
|
|
9426
9428
|
return this.create(e.public, e.options);
|
|
9427
9429
|
}
|
|
9428
9430
|
}
|
|
9429
|
-
function
|
|
9431
|
+
function Ne(u, t, e) {
|
|
9430
9432
|
u.interactions.forEach((i) => t(i, e)), u.groups.forEach((i) => {
|
|
9431
|
-
i.activities?.forEach((r) =>
|
|
9433
|
+
i.activities?.forEach((r) => Ne(r, t, i));
|
|
9432
9434
|
});
|
|
9433
9435
|
}
|
|
9434
|
-
function
|
|
9436
|
+
function Fr(u) {
|
|
9435
9437
|
const t = [];
|
|
9436
|
-
return
|
|
9438
|
+
return Ne(u, (e) => t.push(e)), t;
|
|
9437
9439
|
}
|
|
9438
9440
|
function Qr(u) {
|
|
9439
9441
|
return null;
|
|
9440
9442
|
}
|
|
9441
|
-
class
|
|
9443
|
+
class Xt {
|
|
9442
9444
|
constructor(t, e) {
|
|
9443
9445
|
this._type = "Condition", this._options = e, this.uuid = T(e), this.content = t.content, this.name = t.name;
|
|
9444
9446
|
}
|
|
@@ -9464,7 +9466,7 @@ class Yt {
|
|
|
9464
9466
|
};
|
|
9465
9467
|
}
|
|
9466
9468
|
static create(t, e) {
|
|
9467
|
-
const i = new
|
|
9469
|
+
const i = new Xt(t, e);
|
|
9468
9470
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9469
9471
|
throw new Error(`duplicate uuid in options ${i.uuid}, Condition`);
|
|
9470
9472
|
return this.instances.push(i), i;
|
|
@@ -9498,7 +9500,7 @@ class Yt {
|
|
|
9498
9500
|
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);
|
|
9499
9501
|
}
|
|
9500
9502
|
}
|
|
9501
|
-
class
|
|
9503
|
+
class zt {
|
|
9502
9504
|
constructor(t, e) {
|
|
9503
9505
|
this._type = "DataAttributive", this._options = e, this.uuid = T(e), this.content = t.content, this.name = t.name;
|
|
9504
9506
|
}
|
|
@@ -9524,7 +9526,7 @@ class Zt {
|
|
|
9524
9526
|
};
|
|
9525
9527
|
}
|
|
9526
9528
|
static create(t, e) {
|
|
9527
|
-
const i = new
|
|
9529
|
+
const i = new zt(t, e);
|
|
9528
9530
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9529
9531
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributive`);
|
|
9530
9532
|
return this.instances.push(i), i;
|
|
@@ -9558,7 +9560,7 @@ class Zt {
|
|
|
9558
9560
|
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);
|
|
9559
9561
|
}
|
|
9560
9562
|
}
|
|
9561
|
-
class
|
|
9563
|
+
class ve {
|
|
9562
9564
|
constructor(t, e) {
|
|
9563
9565
|
this._type = "DataPolicy", this._options = e, this.uuid = T(e), this.match = t.match, this.modifier = t.modifier, this.attributeQuery = t.attributeQuery;
|
|
9564
9566
|
}
|
|
@@ -9591,7 +9593,7 @@ class Ae {
|
|
|
9591
9593
|
};
|
|
9592
9594
|
}
|
|
9593
9595
|
static create(t, e) {
|
|
9594
|
-
const i = new
|
|
9596
|
+
const i = new ve(t, e);
|
|
9595
9597
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9596
9598
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataPolicy`);
|
|
9597
9599
|
return this.instances.push(i), i;
|
|
@@ -9676,7 +9678,7 @@ class at {
|
|
|
9676
9678
|
return this.create(e.public, e.options);
|
|
9677
9679
|
}
|
|
9678
9680
|
}
|
|
9679
|
-
class
|
|
9681
|
+
class Yt {
|
|
9680
9682
|
constructor(t, e) {
|
|
9681
9683
|
this._type = "Event", this._options = e, this.uuid = T(e), this.name = t.name;
|
|
9682
9684
|
}
|
|
@@ -9698,7 +9700,7 @@ class te {
|
|
|
9698
9700
|
};
|
|
9699
9701
|
}
|
|
9700
9702
|
static create(t, e) {
|
|
9701
|
-
const i = new
|
|
9703
|
+
const i = new Yt(t, e);
|
|
9702
9704
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9703
9705
|
throw new Error(`duplicate uuid in options ${i.uuid}, Event`);
|
|
9704
9706
|
return this.instances.push(i), i;
|
|
@@ -9730,7 +9732,7 @@ class te {
|
|
|
9730
9732
|
return this.create(e.public, e.options);
|
|
9731
9733
|
}
|
|
9732
9734
|
}
|
|
9733
|
-
class
|
|
9735
|
+
class Zt {
|
|
9734
9736
|
constructor(t, e) {
|
|
9735
9737
|
this._type = "PayloadItem", this._options = e, this.uuid = T(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;
|
|
9736
9738
|
}
|
|
@@ -9781,7 +9783,7 @@ class ee {
|
|
|
9781
9783
|
};
|
|
9782
9784
|
}
|
|
9783
9785
|
static create(t, e) {
|
|
9784
|
-
const i = new
|
|
9786
|
+
const i = new Zt(t, e);
|
|
9785
9787
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9786
9788
|
throw new Error(`duplicate uuid in options ${i.uuid}, PayloadItem`);
|
|
9787
9789
|
return this.instances.push(i), i;
|
|
@@ -9820,7 +9822,7 @@ class ee {
|
|
|
9820
9822
|
return this.create(e.public, e.options);
|
|
9821
9823
|
}
|
|
9822
9824
|
}
|
|
9823
|
-
class
|
|
9825
|
+
class te {
|
|
9824
9826
|
constructor(t, e) {
|
|
9825
9827
|
this._type = "Payload", this._options = e, this.uuid = T(e), this.items = t.items || [];
|
|
9826
9828
|
}
|
|
@@ -9844,7 +9846,7 @@ class ie {
|
|
|
9844
9846
|
};
|
|
9845
9847
|
}
|
|
9846
9848
|
static create(t, e) {
|
|
9847
|
-
const i = new
|
|
9849
|
+
const i = new te(t, e);
|
|
9848
9850
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9849
9851
|
throw new Error(`duplicate uuid in options ${i.uuid}, Payload`);
|
|
9850
9852
|
return this.instances.push(i), i;
|
|
@@ -9876,7 +9878,7 @@ class ie {
|
|
|
9876
9878
|
return this.create(e.public, e.options);
|
|
9877
9879
|
}
|
|
9878
9880
|
}
|
|
9879
|
-
class
|
|
9881
|
+
class ee {
|
|
9880
9882
|
constructor(t, e) {
|
|
9881
9883
|
this._type = "DataAttributives", this._options = e, this.uuid = T(e), this.content = t.content;
|
|
9882
9884
|
}
|
|
@@ -9899,7 +9901,7 @@ class re {
|
|
|
9899
9901
|
};
|
|
9900
9902
|
}
|
|
9901
9903
|
static create(t, e) {
|
|
9902
|
-
const i = new
|
|
9904
|
+
const i = new ee(t, e);
|
|
9903
9905
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9904
9906
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributives`);
|
|
9905
9907
|
return this.instances.push(i), i;
|
|
@@ -9930,25 +9932,25 @@ class re {
|
|
|
9930
9932
|
return this.create(e.public, e.options);
|
|
9931
9933
|
}
|
|
9932
9934
|
}
|
|
9933
|
-
const
|
|
9935
|
+
const ir = [
|
|
9936
|
+
Gt,
|
|
9937
|
+
Kt,
|
|
9938
|
+
z,
|
|
9934
9939
|
Xt,
|
|
9935
9940
|
zt,
|
|
9936
|
-
|
|
9941
|
+
kt,
|
|
9942
|
+
at,
|
|
9937
9943
|
Yt,
|
|
9938
9944
|
Zt,
|
|
9939
|
-
Et,
|
|
9940
|
-
at,
|
|
9941
9945
|
te,
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
bt,
|
|
9945
|
-
re
|
|
9946
|
+
St,
|
|
9947
|
+
ee
|
|
9946
9948
|
];
|
|
9947
|
-
|
|
9948
|
-
u && u.displayName &&
|
|
9949
|
+
ir.forEach((u) => {
|
|
9950
|
+
u && u.displayName && ue(u.displayName, u);
|
|
9949
9951
|
});
|
|
9950
|
-
function
|
|
9951
|
-
return
|
|
9952
|
+
function Vr({ name: u, isRef: t = !1 }, e) {
|
|
9953
|
+
return z.create({
|
|
9952
9954
|
name: u,
|
|
9953
9955
|
content: u ? new Function("user", `return user.roles.includes('${u}')`) : function() {
|
|
9954
9956
|
return !0;
|
|
@@ -9956,190 +9958,7 @@ function Lr({ name: u, isRef: t = !1 }, e) {
|
|
|
9956
9958
|
isRef: t
|
|
9957
9959
|
}, e);
|
|
9958
9960
|
}
|
|
9959
|
-
class
|
|
9960
|
-
constructor(t, e, i) {
|
|
9961
|
-
this.interaction = t, this.controller = e, this.activitySeqCall = i, this.system = e.system;
|
|
9962
|
-
}
|
|
9963
|
-
async checkAttributive(t, e, i) {
|
|
9964
|
-
const r = t;
|
|
9965
|
-
if (r.content) {
|
|
9966
|
-
const s = r.content;
|
|
9967
|
-
let a;
|
|
9968
|
-
try {
|
|
9969
|
-
a = await s.call(this.controller, i, e);
|
|
9970
|
-
} catch {
|
|
9971
|
-
a = !1;
|
|
9972
|
-
}
|
|
9973
|
-
return a === void 0 ? (console.warn(`attributive ${r.name} returned undefined, maybe not implemented, we will return true for now`), !0) : a;
|
|
9974
|
-
} else
|
|
9975
|
-
console.warn(`${r.name} not implemented`);
|
|
9976
|
-
return !0;
|
|
9977
|
-
}
|
|
9978
|
-
async checkMixedAttributive(t, e) {
|
|
9979
|
-
return Promise.resolve(!0);
|
|
9980
|
-
}
|
|
9981
|
-
createHandleAttributive(t, e, i) {
|
|
9982
|
-
return (r) => this.checkAttributive(r, e, i);
|
|
9983
|
-
}
|
|
9984
|
-
async checkUser(t, e, i) {
|
|
9985
|
-
let r;
|
|
9986
|
-
if (!this.interaction.userAttributives) return !0;
|
|
9987
|
-
const s = Rt.is(this.interaction.userAttributives) ? R.fromValue(
|
|
9988
|
-
this.interaction.userAttributives.content
|
|
9989
|
-
) : R.atom(
|
|
9990
|
-
this.interaction.userAttributives
|
|
9991
|
-
), a = (o) => o.isRef ? i(o, t.user, e) : this.checkAttributive(o, t, t.user);
|
|
9992
|
-
if (r = await this.checkAttributives(s, a, []), r === !0) return r;
|
|
9993
|
-
throw D.userCheckFailed(r);
|
|
9994
|
-
}
|
|
9995
|
-
async checkConcept(t, e, i, r = []) {
|
|
9996
|
-
const s = r.concat({ type: "concept", values: { attributives: i, concept: e } }), a = await this.isConcept(t, e, s);
|
|
9997
|
-
if (a !== !0) return a;
|
|
9998
|
-
if (i) {
|
|
9999
|
-
const o = (c) => this.checkMixedAttributive(c, t), n = await this.checkAttributives(R.fromValue(i), o, s);
|
|
10000
|
-
if (n !== !0) return n;
|
|
10001
|
-
}
|
|
10002
|
-
return !0;
|
|
10003
|
-
}
|
|
10004
|
-
async isConcept(t, e, i = []) {
|
|
10005
|
-
const r = i.concat({ type: "isConcept", values: { concept: e } });
|
|
10006
|
-
if (this.isDerivedConcept(e)) {
|
|
10007
|
-
const s = e;
|
|
10008
|
-
return s.attributive ? this.checkConcept(t, s.base, s.attributive, r) : this.isConcept(t, s.base, r);
|
|
10009
|
-
}
|
|
10010
|
-
if (this.isConceptAlias(e)) {
|
|
10011
|
-
const s = [];
|
|
10012
|
-
return await hi(e.for, async (o) => {
|
|
10013
|
-
const n = await this.isConcept(t, o);
|
|
10014
|
-
return n === !0 ? !0 : (s.push(n), !1);
|
|
10015
|
-
}) ? !0 : { name: e.name, type: "conceptAlias", stack: r, error: s };
|
|
10016
|
-
} else {
|
|
10017
|
-
if (K.is(e))
|
|
10018
|
-
return await this.checkAttributive(e, void 0, t) ? !0 : { name: e.name, type: "conceptCheck", stack: r, error: "role check error" };
|
|
10019
|
-
const s = e.constructor?.check;
|
|
10020
|
-
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" } : I.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);
|
|
10021
|
-
}
|
|
10022
|
-
}
|
|
10023
|
-
isDerivedConcept(t) {
|
|
10024
|
-
return !!t.base;
|
|
10025
|
-
}
|
|
10026
|
-
isConceptAlias(t) {
|
|
10027
|
-
return !!t.for;
|
|
10028
|
-
}
|
|
10029
|
-
async checkAttributives(t, e, i = []) {
|
|
10030
|
-
const r = await t.evaluateAsync(e);
|
|
10031
|
-
return r === !0 ? !0 : { name: "", type: "matchAttributives", stack: i, error: r };
|
|
10032
|
-
}
|
|
10033
|
-
async checkPayload(t) {
|
|
10034
|
-
const e = t.payload || {}, i = this.interaction.payload?.items || [], r = Object.keys(e);
|
|
10035
|
-
for (let s of r)
|
|
10036
|
-
if (!i.some((a) => a.name === s))
|
|
10037
|
-
throw new Error(`${s} in payload is not defined in interaction ${this.interaction.name}`);
|
|
10038
|
-
for (let s of i) {
|
|
10039
|
-
if (s.required && !(s.name in e))
|
|
10040
|
-
throw D.payloadValidationFailed(s.name, "missing", e);
|
|
10041
|
-
const a = e[s.name];
|
|
10042
|
-
if (a === void 0) return;
|
|
10043
|
-
if (s.isCollection && !Array.isArray(a))
|
|
10044
|
-
throw D.payloadValidationFailed(s.name, "data is not array", a);
|
|
10045
|
-
if (s.isCollection) {
|
|
10046
|
-
if (s.isRef && !a.every((o) => !!o.id))
|
|
10047
|
-
throw D.payloadValidationFailed(s.name, "data not every is ref", a);
|
|
10048
|
-
} else if (s.isRef && !a.id)
|
|
10049
|
-
throw D.payloadValidationFailed(s.name, "data is not a ref", a);
|
|
10050
|
-
if (s.base)
|
|
10051
|
-
if (s.isCollection) {
|
|
10052
|
-
const o = await pi(a, (n) => this.checkConcept(n, s.base));
|
|
10053
|
-
if (o !== !0)
|
|
10054
|
-
throw D.conceptCheckFailed(s.name, o);
|
|
10055
|
-
} else {
|
|
10056
|
-
const o = await this.checkConcept(a, s.base);
|
|
10057
|
-
if (o !== !0)
|
|
10058
|
-
throw D.conceptCheckFailed(s.name, o);
|
|
10059
|
-
}
|
|
10060
|
-
if (s.isRef) {
|
|
10061
|
-
const o = s.isCollection ? m.atom({
|
|
10062
|
-
key: "id",
|
|
10063
|
-
value: ["in", a.map((n) => n.id)]
|
|
10064
|
-
}) : m.atom({
|
|
10065
|
-
key: "id",
|
|
10066
|
-
value: ["=", a.id]
|
|
10067
|
-
});
|
|
10068
|
-
s.isCollection ? await this.system.storage.find(s.base.name, o, void 0, ["*"]) : await this.system.storage.findOne(s.base.name, o, void 0, ["*"]);
|
|
10069
|
-
}
|
|
10070
|
-
}
|
|
10071
|
-
}
|
|
10072
|
-
async checkCondition(t) {
|
|
10073
|
-
if (this.interaction.conditions) {
|
|
10074
|
-
const e = bt.is(this.interaction.conditions) ? new R(this.interaction.conditions.content) : R.atom(this.interaction.conditions), i = async (s) => {
|
|
10075
|
-
if (!s) return !0;
|
|
10076
|
-
if (s.content) {
|
|
10077
|
-
const a = s.content;
|
|
10078
|
-
let o;
|
|
10079
|
-
try {
|
|
10080
|
-
o = await a.call(this.controller, t);
|
|
10081
|
-
} catch (n) {
|
|
10082
|
-
console.warn("check function throw", n);
|
|
10083
|
-
const c = n instanceof Error ? n.message : String(n);
|
|
10084
|
-
return `Condition '${s.name}' threw exception: ${c}`;
|
|
10085
|
-
}
|
|
10086
|
-
return o === void 0 ? (console.warn(`condition ${s.name} returned undefined, maybe not implemented, we will return true for now`), !0) : o;
|
|
10087
|
-
} else
|
|
10088
|
-
console.warn(`${s.name} not implemented`);
|
|
10089
|
-
return !0;
|
|
10090
|
-
}, r = await e.evaluateAsync(i);
|
|
10091
|
-
if (r !== !0)
|
|
10092
|
-
throw D.conditionCheckFailed(r);
|
|
10093
|
-
}
|
|
10094
|
-
}
|
|
10095
|
-
isGetInteraction() {
|
|
10096
|
-
return this.interaction.action === ve;
|
|
10097
|
-
}
|
|
10098
|
-
static {
|
|
10099
|
-
this.INTERACTION_RECORD = "_Interaction_";
|
|
10100
|
-
}
|
|
10101
|
-
async saveEvent(t) {
|
|
10102
|
-
return await this.system.storage.create(It.INTERACTION_RECORD, t);
|
|
10103
|
-
}
|
|
10104
|
-
async retrieveData(t) {
|
|
10105
|
-
let e;
|
|
10106
|
-
if (I.is(this.interaction.data) || x.is(this.interaction.data)) {
|
|
10107
|
-
const i = this.interaction.data.name, r = this.interaction.dataPolicy?.match, s = this.interaction.dataPolicy?.modifier;
|
|
10108
|
-
this.interaction.dataPolicy?.attributeQuery;
|
|
10109
|
-
const a = { ...t.query?.modifier || {}, ...s || {} }, o = t.query?.attributeQuery || [], n = typeof r == "function" ? await r.call(this.controller, t) : r, c = R.and(n, t.query?.match);
|
|
10110
|
-
e = await this.system.storage.find(i, c, a, o);
|
|
10111
|
-
} else
|
|
10112
|
-
A(!1, `unknown data type ${this.interaction.data}`);
|
|
10113
|
-
return e;
|
|
10114
|
-
}
|
|
10115
|
-
async check(t, e, i, r) {
|
|
10116
|
-
let s;
|
|
10117
|
-
try {
|
|
10118
|
-
this.controller.ignoreGuard || await this.checkCondition(t), await this.checkUser(t, e, i), await this.checkPayload(t);
|
|
10119
|
-
} catch (a) {
|
|
10120
|
-
s = a;
|
|
10121
|
-
}
|
|
10122
|
-
return s;
|
|
10123
|
-
}
|
|
10124
|
-
async call(t, e, i, r) {
|
|
10125
|
-
const s = {
|
|
10126
|
-
sideEffects: {}
|
|
10127
|
-
};
|
|
10128
|
-
if (s.error = await this.check(t, e, i, r), !s.error) {
|
|
10129
|
-
const a = {
|
|
10130
|
-
interactionName: this.interaction.name,
|
|
10131
|
-
interactionId: this.interaction.uuid,
|
|
10132
|
-
user: t.user,
|
|
10133
|
-
query: t.query || {},
|
|
10134
|
-
payload: t.payload || {},
|
|
10135
|
-
args: t
|
|
10136
|
-
};
|
|
10137
|
-
e && e !== void 0 && (a.activity = { id: e }), await this.saveEvent(a), s.event = a, this.isGetInteraction() && (s.data = await this.retrieveData(t));
|
|
10138
|
-
}
|
|
10139
|
-
return s;
|
|
10140
|
-
}
|
|
10141
|
-
}
|
|
10142
|
-
class X {
|
|
9961
|
+
class G {
|
|
10143
9962
|
constructor(t, e) {
|
|
10144
9963
|
this.graph = t, this.parent = e;
|
|
10145
9964
|
}
|
|
@@ -10149,7 +9968,7 @@ class X {
|
|
|
10149
9968
|
};
|
|
10150
9969
|
}
|
|
10151
9970
|
static create(t, e, i) {
|
|
10152
|
-
const r = new
|
|
9971
|
+
const r = new G(e, i);
|
|
10153
9972
|
return t.current && (r.current = O.create(t.current, e, r)), r;
|
|
10154
9973
|
}
|
|
10155
9974
|
isInteractionAvailable(t) {
|
|
@@ -10182,13 +10001,13 @@ class O {
|
|
|
10182
10001
|
}
|
|
10183
10002
|
static createInitialState(t) {
|
|
10184
10003
|
const e = { uuid: t.uuid };
|
|
10185
|
-
return st.is(t.content) && (e.children = t.childSeqs.map((i) =>
|
|
10004
|
+
return st.is(t.content) && (e.children = t.childSeqs.map((i) => G.createInitialState(i.head))), e;
|
|
10186
10005
|
}
|
|
10187
10006
|
static create(t, e, i) {
|
|
10188
10007
|
const r = e.getNodeByUUID(t.uuid);
|
|
10189
10008
|
if (st.is(r.content)) {
|
|
10190
10009
|
const a = O.GroupStateNodeType.get(r.content.type), o = new a(r, e, i);
|
|
10191
|
-
return o.isGroup = !0, o.children = t?.children?.map((n) =>
|
|
10010
|
+
return o.isGroup = !0, o.children = t?.children?.map((n) => G.create(n, e, o)), o;
|
|
10192
10011
|
} else
|
|
10193
10012
|
return new O(r, e, i);
|
|
10194
10013
|
}
|
|
@@ -10207,12 +10026,12 @@ class O {
|
|
|
10207
10026
|
this.parent.transferToNext(this.node.uuid);
|
|
10208
10027
|
}
|
|
10209
10028
|
}
|
|
10210
|
-
class
|
|
10029
|
+
class Pt {
|
|
10211
10030
|
constructor(t, e) {
|
|
10212
|
-
this.graph = e, this.root =
|
|
10031
|
+
this.graph = e, this.root = G.create(t, this.graph);
|
|
10213
10032
|
}
|
|
10214
10033
|
static createInitialState(t) {
|
|
10215
|
-
return
|
|
10034
|
+
return G.createInitialState(t);
|
|
10216
10035
|
}
|
|
10217
10036
|
isInteractionAvailable(t) {
|
|
10218
10037
|
return this.root.isInteractionAvailable(t);
|
|
@@ -10224,26 +10043,15 @@ class le {
|
|
|
10224
10043
|
return this.root.toJSON();
|
|
10225
10044
|
}
|
|
10226
10045
|
}
|
|
10227
|
-
class
|
|
10228
|
-
constructor(t
|
|
10229
|
-
this.activity = t, this.
|
|
10230
|
-
}
|
|
10231
|
-
static {
|
|
10232
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
10233
|
-
}
|
|
10234
|
-
static {
|
|
10235
|
-
this.from = (t, e) => {
|
|
10236
|
-
let i = W.cache.get(t);
|
|
10237
|
-
return i || (i = new W(t, e), W.cache.set(t, i)), i;
|
|
10238
|
-
};
|
|
10046
|
+
class et {
|
|
10047
|
+
constructor(t) {
|
|
10048
|
+
this.activity = t, this.uuidToNode = /* @__PURE__ */ new Map(), this.rawToNode = /* @__PURE__ */ new Map(), this.checkUserRef = async (e, i, r, s) => (k(i.isRef, "attributive must be ref"), ((await this.getActivity(e, s))?.refs)[i.name] === r.id), this.graph = this.buildGraph(t);
|
|
10239
10049
|
}
|
|
10240
10050
|
buildGraph(t, e) {
|
|
10241
10051
|
const i = /* @__PURE__ */ new Map(), r = {};
|
|
10242
10052
|
for (let o of t.interactions) {
|
|
10243
10053
|
const n = { content: o, next: null, uuid: o.uuid, parentGroup: e, parentSeq: r };
|
|
10244
10054
|
this.uuidToNode.set(o.uuid, n), this.rawToNode.set(o, n);
|
|
10245
|
-
const c = new It(o, this.controller, this);
|
|
10246
|
-
this.uuidToInteractionCall.set(o.uuid, c), o.name && this.interactionCallByName.set(o.name, c);
|
|
10247
10055
|
}
|
|
10248
10056
|
for (let o of t.gateways) {
|
|
10249
10057
|
const n = { content: o, next: [], prev: [], uuid: o.uuid };
|
|
@@ -10262,7 +10070,7 @@ class W {
|
|
|
10262
10070
|
const s = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]), a = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]);
|
|
10263
10071
|
if (t.transfers?.forEach((o) => {
|
|
10264
10072
|
const n = this.rawToNode.get(o.source) || i.get(o.source), c = this.rawToNode.get(o.target) || i.get(o.target);
|
|
10265
|
-
|
|
10073
|
+
k(!!n, `cannot find source ${o.source.name}`), k(!!c, `cannot find target ${o.source.name}`), at.is(n) ? n.next.push(c) : n.next = c, at.is(c) ? c.prev.push(n) : c.prev = n, a.delete(o.source), s.delete(o.target);
|
|
10266
10074
|
}), s.size !== 1) throw new Error(`start node must one, current: ${s.size}`);
|
|
10267
10075
|
if (a.size !== 1) throw new Error(`end node must be one, current: ${a.size}`);
|
|
10268
10076
|
return Object.assign(r, {
|
|
@@ -10273,40 +10081,40 @@ class W {
|
|
|
10273
10081
|
static {
|
|
10274
10082
|
this.ACTIVITY_RECORD = "_Activity_";
|
|
10275
10083
|
}
|
|
10276
|
-
async create() {
|
|
10277
|
-
const
|
|
10084
|
+
async create(t) {
|
|
10085
|
+
const e = Pt.createInitialState(this.graph.head);
|
|
10278
10086
|
return {
|
|
10279
|
-
activityId: (await
|
|
10087
|
+
activityId: (await t.system.storage.create(et.ACTIVITY_RECORD, {
|
|
10280
10088
|
name: this.activity.name,
|
|
10281
10089
|
uuid: this.activity.uuid,
|
|
10282
|
-
state:
|
|
10090
|
+
state: e,
|
|
10283
10091
|
refs: {}
|
|
10284
10092
|
})).id,
|
|
10285
|
-
state:
|
|
10093
|
+
state: e
|
|
10286
10094
|
};
|
|
10287
10095
|
}
|
|
10288
10096
|
getNodeByUUID(t) {
|
|
10289
10097
|
return this.uuidToNode.get(t);
|
|
10290
10098
|
}
|
|
10291
|
-
async getState(t) {
|
|
10292
|
-
return (await this.getActivity(t))?.state;
|
|
10099
|
+
async getState(t, e) {
|
|
10100
|
+
return (await this.getActivity(t, e))?.state;
|
|
10293
10101
|
}
|
|
10294
|
-
async getActivity(t) {
|
|
10295
|
-
const
|
|
10102
|
+
async getActivity(t, e) {
|
|
10103
|
+
const i = m.atom({
|
|
10296
10104
|
key: "id",
|
|
10297
|
-
value: ["=",
|
|
10105
|
+
value: ["=", e]
|
|
10298
10106
|
});
|
|
10299
|
-
return (await
|
|
10107
|
+
return (await t.system.storage.find(et.ACTIVITY_RECORD, i, void 0, ["*"])).map((s) => ({ ...s, state: s.state, refs: s.refs }))[0];
|
|
10300
10108
|
}
|
|
10301
|
-
async setActivity(t, e) {
|
|
10302
|
-
const
|
|
10109
|
+
async setActivity(t, e, i) {
|
|
10110
|
+
const r = m.atom({
|
|
10303
10111
|
key: "id",
|
|
10304
|
-
value: ["=",
|
|
10305
|
-
}),
|
|
10306
|
-
return delete
|
|
10112
|
+
value: ["=", e]
|
|
10113
|
+
}), s = { ...i };
|
|
10114
|
+
return delete s.state, delete s.refs, i.state && (s.state = i.state), i.refs && (s.refs = i.refs), await t.system.storage.update(et.ACTIVITY_RECORD, r, s);
|
|
10307
10115
|
}
|
|
10308
|
-
async setState(t, e) {
|
|
10309
|
-
return this.setActivity(t, { state:
|
|
10116
|
+
async setState(t, e, i) {
|
|
10117
|
+
return this.setActivity(t, e, { state: i });
|
|
10310
10118
|
}
|
|
10311
10119
|
isStartNode(t) {
|
|
10312
10120
|
const e = this.uuidToNode.get(t);
|
|
@@ -10319,44 +10127,55 @@ class W {
|
|
|
10319
10127
|
isActivityHead(t, e = this.graph.head) {
|
|
10320
10128
|
return st.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((i) => this.isActivityHead(t, i.head)) : t === this.graph.head.content;
|
|
10321
10129
|
}
|
|
10322
|
-
async
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
};
|
|
10130
|
+
async checkActivityState(t, e, i) {
|
|
10131
|
+
if (!new Pt(await this.getState(t, e), this).isInteractionAvailable(i))
|
|
10132
|
+
throw new Error(`interaction ${i} not available`);
|
|
10133
|
+
}
|
|
10134
|
+
async fullGuardWithUserRef(t, e, i) {
|
|
10135
|
+
if (!t.ignoreGuard && e.conditions && await be(t, e, i), e.userAttributives) {
|
|
10136
|
+
const r = bt.is(e.userAttributives) ? R.fromValue(
|
|
10137
|
+
e.userAttributives.content
|
|
10138
|
+
) : R.atom(
|
|
10139
|
+
e.userAttributives
|
|
10140
|
+
), s = (o) => o.isRef ? this.checkUserRef(t, o, i.user, i.activityId) : rr(t, o, i, i.user), a = await r.evaluateAsync(s);
|
|
10141
|
+
if (a !== !0)
|
|
10142
|
+
throw new q("User check failed", {
|
|
10143
|
+
type: "check user failed",
|
|
10144
|
+
checkType: "user",
|
|
10145
|
+
error: a
|
|
10146
|
+
});
|
|
10147
|
+
}
|
|
10148
|
+
e.payload && await Re(t, e, i);
|
|
10149
|
+
}
|
|
10150
|
+
async completeInteractionState(t, e, i) {
|
|
10151
|
+
const r = new Pt(await this.getState(t, e), this), s = r.completeInteraction(i);
|
|
10152
|
+
k(s, "change activity state failed");
|
|
10153
|
+
const a = r.toJSON();
|
|
10154
|
+
await this.setActivity(t, e, { state: a });
|
|
10348
10155
|
}
|
|
10349
|
-
async saveUserRefs(t, e, i) {
|
|
10350
|
-
const
|
|
10351
|
-
|
|
10352
|
-
if (
|
|
10353
|
-
const
|
|
10354
|
-
|
|
10156
|
+
async saveUserRefs(t, e, i, r) {
|
|
10157
|
+
const s = (await this.getActivity(t, e))?.refs || {};
|
|
10158
|
+
i.userRef?.name && (s[i.userRef?.name] = r.user.id), i.payload?.items.forEach((a) => {
|
|
10159
|
+
if (z.is(a.itemRef) && a.itemRef?.name && r.payload[a.name]) {
|
|
10160
|
+
const o = r.payload[a.name];
|
|
10161
|
+
a.isCollection ? (s[a.itemRef.name] || (s[a.itemRef.name] = []), s[a.itemRef.name].push(o.id)) : s[a.itemRef.name] = o.id;
|
|
10355
10162
|
}
|
|
10356
|
-
}), await this.setActivity(t, { refs:
|
|
10163
|
+
}), await this.setActivity(t, e, { refs: s });
|
|
10164
|
+
}
|
|
10165
|
+
}
|
|
10166
|
+
async function rr(u, t, e, i) {
|
|
10167
|
+
if (t.content) {
|
|
10168
|
+
let r;
|
|
10169
|
+
try {
|
|
10170
|
+
r = await t.content.call(u, i, e);
|
|
10171
|
+
} catch {
|
|
10172
|
+
r = !1;
|
|
10173
|
+
}
|
|
10174
|
+
return r === void 0 ? !0 : r;
|
|
10357
10175
|
}
|
|
10176
|
+
return !0;
|
|
10358
10177
|
}
|
|
10359
|
-
class
|
|
10178
|
+
class sr extends O {
|
|
10360
10179
|
onChange(t, e) {
|
|
10361
10180
|
if (this.graph.isStartNode(t)) {
|
|
10362
10181
|
if (e)
|
|
@@ -10367,70 +10186,24 @@ class lr extends O {
|
|
|
10367
10186
|
}
|
|
10368
10187
|
}
|
|
10369
10188
|
}
|
|
10370
|
-
O.GroupStateNodeType.set("any",
|
|
10371
|
-
class
|
|
10189
|
+
O.GroupStateNodeType.set("any", sr);
|
|
10190
|
+
class ar extends O {
|
|
10372
10191
|
onChange(t, e) {
|
|
10373
10192
|
this.isGroupCompleted() && this.complete();
|
|
10374
10193
|
}
|
|
10375
10194
|
}
|
|
10376
|
-
O.GroupStateNodeType.set("every",
|
|
10377
|
-
class
|
|
10195
|
+
O.GroupStateNodeType.set("every", ar);
|
|
10196
|
+
class or extends O {
|
|
10378
10197
|
onChange(t, e) {
|
|
10379
10198
|
this.graph.isEndNode(t) && this.complete();
|
|
10380
10199
|
}
|
|
10381
10200
|
}
|
|
10382
|
-
O.GroupStateNodeType.set("race",
|
|
10383
|
-
class
|
|
10201
|
+
O.GroupStateNodeType.set("race", or);
|
|
10202
|
+
class nr extends O {
|
|
10384
10203
|
}
|
|
10385
|
-
O.GroupStateNodeType.set("program",
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
super(t, {
|
|
10389
|
-
errorType: e.context?.errorType || "ActivityError",
|
|
10390
|
-
context: {
|
|
10391
|
-
category: G.ACTIVITY,
|
|
10392
|
-
activityName: e.activityName,
|
|
10393
|
-
activityId: e.activityId,
|
|
10394
|
-
activityInstanceId: e.activityInstanceId,
|
|
10395
|
-
currentState: e.currentState,
|
|
10396
|
-
...e.context
|
|
10397
|
-
},
|
|
10398
|
-
causedBy: e.causedBy
|
|
10399
|
-
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || $.MEDIUM;
|
|
10400
|
-
}
|
|
10401
|
-
}
|
|
10402
|
-
class qr extends Se {
|
|
10403
|
-
constructor(t, e = {}) {
|
|
10404
|
-
super(t, {
|
|
10405
|
-
...e,
|
|
10406
|
-
severity: $.HIGH,
|
|
10407
|
-
context: {
|
|
10408
|
-
errorType: "ActivityStateError",
|
|
10409
|
-
expectedState: e.expectedState,
|
|
10410
|
-
actualState: e.actualState,
|
|
10411
|
-
stateTransition: e.stateTransition
|
|
10412
|
-
}
|
|
10413
|
-
}), this.expectedState = e.expectedState, this.actualState = e.actualState, this.stateTransition = e.stateTransition;
|
|
10414
|
-
}
|
|
10415
|
-
}
|
|
10416
|
-
class ue extends H {
|
|
10417
|
-
constructor(t, e = {}) {
|
|
10418
|
-
super(t, {
|
|
10419
|
-
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
10420
|
-
context: {
|
|
10421
|
-
category: G.INTERACTION,
|
|
10422
|
-
interactionName: e.interactionName,
|
|
10423
|
-
userId: e.userId,
|
|
10424
|
-
payload: e.payload,
|
|
10425
|
-
executionPhase: e.executionPhase,
|
|
10426
|
-
...e.context
|
|
10427
|
-
},
|
|
10428
|
-
causedBy: e.causedBy
|
|
10429
|
-
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || $.HIGH;
|
|
10430
|
-
}
|
|
10431
|
-
}
|
|
10432
|
-
const Nt = "_Activity_", Ee = I.create({
|
|
10433
|
-
name: Nt,
|
|
10204
|
+
O.GroupStateNodeType.set("program", nr);
|
|
10205
|
+
const cr = "_Activity_", Te = I.create({
|
|
10206
|
+
name: cr,
|
|
10434
10207
|
properties: [
|
|
10435
10208
|
N.create({
|
|
10436
10209
|
name: "name",
|
|
@@ -10453,121 +10226,83 @@ const Nt = "_Activity_", Ee = I.create({
|
|
|
10453
10226
|
collection: !1
|
|
10454
10227
|
})
|
|
10455
10228
|
]
|
|
10456
|
-
}),
|
|
10229
|
+
}), lr = C.create({
|
|
10457
10230
|
name: "activityInteraction",
|
|
10458
|
-
source:
|
|
10231
|
+
source: Te,
|
|
10459
10232
|
sourceProperty: "interaction",
|
|
10460
|
-
target:
|
|
10233
|
+
target: Ut,
|
|
10461
10234
|
targetProperty: "activity",
|
|
10462
10235
|
type: "1:n"
|
|
10463
10236
|
});
|
|
10464
|
-
class
|
|
10465
|
-
constructor(t
|
|
10466
|
-
this.
|
|
10467
|
-
const
|
|
10468
|
-
this.activityCalls.set(
|
|
10469
|
-
}), i.forEach((r) => {
|
|
10470
|
-
const s = new It(r, t);
|
|
10471
|
-
this.interactionCalls.set(r.uuid, s), r.name && (A(!this.interactionCallsByName.has(r.name), `interaction name ${r.name} is duplicated`), this.interactionCallsByName.set(r.name, s));
|
|
10237
|
+
class Lr {
|
|
10238
|
+
constructor(t) {
|
|
10239
|
+
this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(Te, Ut), this.requiredRelations.push(lr)), t.forEach((e) => {
|
|
10240
|
+
const i = new et(e);
|
|
10241
|
+
this.activityCalls.set(e.uuid, i), e.name && (k(!this.activityCallsByName.has(e.name), `activity name ${e.name} is duplicated`), this.activityCallsByName.set(e.name, i));
|
|
10472
10242
|
});
|
|
10473
|
-
for (const
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
mapEventData: s.mapEventData,
|
|
10482
|
-
resolve: s.resolve,
|
|
10483
|
-
afterDispatch: s.afterDispatch
|
|
10484
|
-
};
|
|
10243
|
+
for (const e of t) {
|
|
10244
|
+
const i = this.activityCallsByName.get(e.name), r = this.collectAllInteractions(e);
|
|
10245
|
+
for (const s of r) {
|
|
10246
|
+
const a = this.getActivityInteractionEventSourceName(e.name, s.name), o = this.buildActivityInteractionEventSource(
|
|
10247
|
+
a,
|
|
10248
|
+
s,
|
|
10249
|
+
i
|
|
10250
|
+
);
|
|
10485
10251
|
this.activityEventSources.push(o);
|
|
10486
10252
|
}
|
|
10487
|
-
}
|
|
10488
|
-
getActivityEventSources() {
|
|
10489
|
-
return this.activityEventSources;
|
|
10490
|
-
}
|
|
10491
|
-
getActivityInteractionEventSourceName(t, e) {
|
|
10492
|
-
return `${t}:${e}`;
|
|
10493
|
-
}
|
|
10494
|
-
async callInteraction(t, e) {
|
|
10495
|
-
const i = this.interactionCallsByName.get(t);
|
|
10496
|
-
if (!i)
|
|
10497
|
-
throw new ue(`Cannot find interaction for ${t}`, {
|
|
10498
|
-
interactionName: t,
|
|
10499
|
-
userId: e.user?.id,
|
|
10500
|
-
payload: e.payload,
|
|
10501
|
-
executionPhase: "interaction-lookup"
|
|
10502
|
-
});
|
|
10503
|
-
await this.controller.system.storage.beginTransaction(i.interaction.name);
|
|
10504
|
-
let r, s;
|
|
10505
|
-
try {
|
|
10506
|
-
s = await i.call(e);
|
|
10507
|
-
} catch (a) {
|
|
10508
|
-
r = a, s = {
|
|
10509
|
-
error: a,
|
|
10510
|
-
effects: [],
|
|
10511
|
-
sideEffects: {},
|
|
10512
|
-
data: void 0,
|
|
10513
|
-
event: void 0
|
|
10514
|
-
};
|
|
10515
|
-
} finally {
|
|
10516
|
-
r || s.error ? await this.controller.system.storage.rollbackTransaction(i.interaction.name) : await this.controller.system.storage.commitTransaction(i.interaction.name);
|
|
10517
10253
|
}
|
|
10518
|
-
return s;
|
|
10519
10254
|
}
|
|
10520
|
-
|
|
10521
|
-
const
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
}
|
|
10544
|
-
async createActivity(t) {
|
|
10545
|
-
return this.controller.system.storage.create(Nt, {
|
|
10546
|
-
...t,
|
|
10547
|
-
state: t.state,
|
|
10548
|
-
refs: t.refs
|
|
10549
|
-
});
|
|
10550
|
-
}
|
|
10551
|
-
async updateActivity(t, e) {
|
|
10552
|
-
const i = {
|
|
10553
|
-
...e
|
|
10255
|
+
buildActivityInteractionEventSource(t, e, i) {
|
|
10256
|
+
const r = i.isActivityHead(e), s = async function(n) {
|
|
10257
|
+
if (r && !n.activityId) {
|
|
10258
|
+
e.guard && await e.guard.call(this, n);
|
|
10259
|
+
const c = await i.create(this);
|
|
10260
|
+
n.activityId = c.activityId;
|
|
10261
|
+
} else if (r && n.activityId)
|
|
10262
|
+
await i.checkActivityState(this, n.activityId, e.uuid), e.guard && await e.guard.call(this, n);
|
|
10263
|
+
else {
|
|
10264
|
+
if (!n.activityId)
|
|
10265
|
+
throw new Error("activityId must be provided for non-head interaction of an activity");
|
|
10266
|
+
await i.checkActivityState(this, n.activityId, e.uuid), await i.fullGuardWithUserRef(this, e, n);
|
|
10267
|
+
}
|
|
10268
|
+
}, a = (n) => {
|
|
10269
|
+
const c = e.mapEventData ? e.mapEventData(n) : {};
|
|
10270
|
+
return n.activityId && (c.activity = { id: n.activityId }), c;
|
|
10271
|
+
}, o = async function(n, c) {
|
|
10272
|
+
const l = n.activityId;
|
|
10273
|
+
return await i.saveUserRefs(this, l, e, n), await i.completeInteractionState(this, l, e.uuid), {
|
|
10274
|
+
...(e.afterDispatch ? await e.afterDispatch.call(this, n, c) : void 0) || {},
|
|
10275
|
+
activityId: l,
|
|
10276
|
+
nextState: await i.getState(this, l)
|
|
10277
|
+
};
|
|
10554
10278
|
};
|
|
10555
|
-
return
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10279
|
+
return {
|
|
10280
|
+
uuid: `${i.activity.uuid}_${e.uuid}`,
|
|
10281
|
+
_type: "EventSource",
|
|
10282
|
+
name: t,
|
|
10283
|
+
entity: e.entity,
|
|
10284
|
+
guard: s,
|
|
10285
|
+
mapEventData: a,
|
|
10286
|
+
resolve: e.resolve,
|
|
10287
|
+
afterDispatch: o
|
|
10288
|
+
};
|
|
10289
|
+
}
|
|
10290
|
+
collectAllInteractions(t) {
|
|
10291
|
+
const e = [...t.interactions];
|
|
10292
|
+
for (const i of t.groups || [])
|
|
10293
|
+
for (const r of i.activities || [])
|
|
10294
|
+
e.push(...this.collectAllInteractions(r));
|
|
10295
|
+
return e;
|
|
10563
10296
|
}
|
|
10564
|
-
|
|
10565
|
-
return
|
|
10297
|
+
getOutput() {
|
|
10298
|
+
return {
|
|
10299
|
+
eventSources: this.activityEventSources,
|
|
10300
|
+
entities: this.requiredEntities,
|
|
10301
|
+
relations: this.requiredRelations
|
|
10302
|
+
};
|
|
10566
10303
|
}
|
|
10567
|
-
|
|
10568
|
-
return
|
|
10569
|
-
...e
|
|
10570
|
-
}));
|
|
10304
|
+
getActivityInteractionEventSourceName(t, e) {
|
|
10305
|
+
return `${t}:${e}`;
|
|
10571
10306
|
}
|
|
10572
10307
|
getActivityCall(t) {
|
|
10573
10308
|
return this.activityCalls.get(t);
|
|
@@ -10575,188 +10310,232 @@ class Br {
|
|
|
10575
10310
|
getActivityCallByName(t) {
|
|
10576
10311
|
return this.activityCallsByName.get(t);
|
|
10577
10312
|
}
|
|
10578
|
-
|
|
10579
|
-
|
|
10313
|
+
}
|
|
10314
|
+
class qr extends W {
|
|
10315
|
+
constructor(t, e = {}) {
|
|
10316
|
+
super(t, {
|
|
10317
|
+
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
10318
|
+
context: {
|
|
10319
|
+
category: j.INTERACTION,
|
|
10320
|
+
interactionName: e.interactionName,
|
|
10321
|
+
userId: e.userId,
|
|
10322
|
+
payload: e.payload,
|
|
10323
|
+
executionPhase: e.executionPhase,
|
|
10324
|
+
...e.context
|
|
10325
|
+
},
|
|
10326
|
+
causedBy: e.causedBy
|
|
10327
|
+
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || $.HIGH;
|
|
10328
|
+
}
|
|
10329
|
+
}
|
|
10330
|
+
class ur extends W {
|
|
10331
|
+
constructor(t, e = {}) {
|
|
10332
|
+
super(t, {
|
|
10333
|
+
errorType: e.context?.errorType || "ActivityError",
|
|
10334
|
+
context: {
|
|
10335
|
+
category: j.ACTIVITY,
|
|
10336
|
+
activityName: e.activityName,
|
|
10337
|
+
activityId: e.activityId,
|
|
10338
|
+
activityInstanceId: e.activityInstanceId,
|
|
10339
|
+
currentState: e.currentState,
|
|
10340
|
+
...e.context
|
|
10341
|
+
},
|
|
10342
|
+
causedBy: e.causedBy
|
|
10343
|
+
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || $.MEDIUM;
|
|
10580
10344
|
}
|
|
10581
|
-
|
|
10582
|
-
|
|
10345
|
+
}
|
|
10346
|
+
class Br extends ur {
|
|
10347
|
+
constructor(t, e = {}) {
|
|
10348
|
+
super(t, {
|
|
10349
|
+
...e,
|
|
10350
|
+
severity: $.HIGH,
|
|
10351
|
+
context: {
|
|
10352
|
+
errorType: "ActivityStateError",
|
|
10353
|
+
expectedState: e.expectedState,
|
|
10354
|
+
actualState: e.actualState,
|
|
10355
|
+
stateTransition: e.stateTransition
|
|
10356
|
+
}
|
|
10357
|
+
}), this.expectedState = e.expectedState, this.actualState = e.actualState, this.stateTransition = e.stateTransition;
|
|
10583
10358
|
}
|
|
10584
10359
|
}
|
|
10585
10360
|
export {
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10361
|
+
cr as ACTIVITY_RECORD,
|
|
10362
|
+
Ce as ALL_ATTR_SYMBOL,
|
|
10363
|
+
Mt as ASYNC_TASK_RECORD,
|
|
10364
|
+
kt as Action,
|
|
10365
|
+
Kt as Activity,
|
|
10366
|
+
et as ActivityCall,
|
|
10367
|
+
ur as ActivityError,
|
|
10593
10368
|
st as ActivityGroup,
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10369
|
+
lr as ActivityInteractionRelation,
|
|
10370
|
+
Lr as ActivityManager,
|
|
10371
|
+
Te as ActivityStateEntity,
|
|
10372
|
+
Br as ActivityStateError,
|
|
10373
|
+
ri as AliasManager,
|
|
10599
10374
|
ht as Any,
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10375
|
+
Ri as AnyHandles,
|
|
10376
|
+
_ as AttributeInfo,
|
|
10377
|
+
x as AttributeQuery,
|
|
10378
|
+
z as Attributive,
|
|
10379
|
+
bt as Attributives,
|
|
10605
10380
|
ut as Average,
|
|
10606
|
-
|
|
10607
|
-
|
|
10381
|
+
$i as AverageHandles,
|
|
10382
|
+
br as BaseKlass,
|
|
10608
10383
|
ft as BoolAtomData,
|
|
10609
10384
|
R as BoolExp,
|
|
10610
10385
|
mt as BoolExpressionData,
|
|
10611
|
-
|
|
10612
|
-
|
|
10386
|
+
H as ComputationDataDepError,
|
|
10387
|
+
F as ComputationError,
|
|
10613
10388
|
S as ComputationResult,
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10389
|
+
fe as ComputationResultAsync,
|
|
10390
|
+
pe as ComputationResultFullRecompute,
|
|
10391
|
+
me as ComputationResultResolved,
|
|
10392
|
+
Nt as ComputationResultSkip,
|
|
10393
|
+
ae as ComputationStateError,
|
|
10394
|
+
Xt as Condition,
|
|
10395
|
+
U as ConditionError,
|
|
10396
|
+
St as Conditions,
|
|
10622
10397
|
Pr as Controller,
|
|
10623
10398
|
ct as Count,
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10399
|
+
vi as CountHandles,
|
|
10400
|
+
Oe as CreationExecutor,
|
|
10401
|
+
Bt as Custom,
|
|
10402
|
+
Vi as CustomHandles,
|
|
10403
|
+
Ht as DBConsoleLogger,
|
|
10404
|
+
Hi as DBLogLevel,
|
|
10405
|
+
si as DBSetup,
|
|
10406
|
+
Ir as DELETED_STATE,
|
|
10407
|
+
L as DICTIONARY_RECORD,
|
|
10408
|
+
zt as DataAttributive,
|
|
10409
|
+
ee as DataAttributives,
|
|
10410
|
+
ve as DataPolicy,
|
|
10411
|
+
Vt as Dictionary,
|
|
10412
|
+
oi as DictionaryEntity,
|
|
10638
10413
|
I as Entity,
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10414
|
+
Di as EntityCustomHandle,
|
|
10415
|
+
We as EntityQueryHandle,
|
|
10416
|
+
Je as EntityToTableMap,
|
|
10417
|
+
Wt as Equation,
|
|
10418
|
+
j as ErrorCategory,
|
|
10419
|
+
$ as ErrorSeverity,
|
|
10420
|
+
Yt as Event,
|
|
10421
|
+
he as EventSource,
|
|
10645
10422
|
dt as Every,
|
|
10646
|
-
|
|
10423
|
+
yi as EveryHandles,
|
|
10647
10424
|
P as Expression,
|
|
10425
|
+
W as FrameworkError,
|
|
10648
10426
|
at as Gateway,
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10427
|
+
Gi as GetAction,
|
|
10428
|
+
gi as GlobalAnyHandle,
|
|
10429
|
+
Pi as GlobalAverageHandle,
|
|
10652
10430
|
B as GlobalBoundState,
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10431
|
+
wi as GlobalCountHandle,
|
|
10432
|
+
Oi as GlobalCustomHandle,
|
|
10433
|
+
fi as GlobalEveryHandle,
|
|
10434
|
+
ki as GlobalRealTimeComputation,
|
|
10435
|
+
ci as GlobalStateMachineHandle,
|
|
10436
|
+
Ii as GlobalSumHandle,
|
|
10437
|
+
di as GlobalWeightedSummationHandle,
|
|
10438
|
+
$t as HARD_DELETION_PROPERTY_NAME,
|
|
10661
10439
|
Mr as HardDeletionProperty,
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
Qt as KlassByName,
|
|
10440
|
+
re as ID_ATTR,
|
|
10441
|
+
Ki as INTERACTION_RECORD,
|
|
10442
|
+
vt as Inequality,
|
|
10443
|
+
Gt as Interaction,
|
|
10444
|
+
Ut as InteractionEventEntity,
|
|
10445
|
+
qr as InteractionExecutionError,
|
|
10446
|
+
q as InteractionGuardError,
|
|
10447
|
+
Ft as KlassByName,
|
|
10671
10448
|
f as LINK_SYMBOL,
|
|
10672
|
-
|
|
10449
|
+
wt as LinkInfo,
|
|
10673
10450
|
m as MatchExp,
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10451
|
+
Pe as Modifier,
|
|
10452
|
+
$r as MonoSystem,
|
|
10453
|
+
Er as NON_DELETED_STATE,
|
|
10454
|
+
Sr as NON_EXIST_STATE,
|
|
10678
10455
|
Q as NewRecordData,
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10456
|
+
wr as PHASE_AFTER_ALL,
|
|
10457
|
+
Rr as PHASE_BEFORE_ALL,
|
|
10458
|
+
It as PHASE_NORMAL,
|
|
10459
|
+
te as Payload,
|
|
10460
|
+
Zt as PayloadItem,
|
|
10684
10461
|
N as Property,
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10462
|
+
bi as PropertyAnyHandle,
|
|
10463
|
+
Ci as PropertyAverageHandle,
|
|
10464
|
+
Ni as PropertyCountHandle,
|
|
10465
|
+
Qi as PropertyCustomHandle,
|
|
10466
|
+
mi as PropertyEveryHandle,
|
|
10467
|
+
Si as PropertyRealTimeComputation,
|
|
10468
|
+
li as PropertyStateMachineHandle,
|
|
10469
|
+
xi as PropertySumHandle,
|
|
10470
|
+
Qt as PropertyTypes,
|
|
10471
|
+
hi as PropertyWeightedSummationHandle,
|
|
10472
|
+
Le as QueryExecutor,
|
|
10473
|
+
_t as ROOT_LABEL,
|
|
10474
|
+
se as ROW_ID_ATTR,
|
|
10698
10475
|
pt as RealTime,
|
|
10699
|
-
|
|
10476
|
+
Ei as RealTimeHandles,
|
|
10700
10477
|
E as RecordBoundState,
|
|
10701
10478
|
rt as RecordInfo,
|
|
10702
|
-
|
|
10479
|
+
ge as RecordMutationSideEffect,
|
|
10703
10480
|
M as RecordQuery,
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10481
|
+
_e as RecordQueryAgent,
|
|
10482
|
+
Ve as RecordQueryRef,
|
|
10483
|
+
V as RecordQueryTree,
|
|
10484
|
+
Ti as RecordsTransformHandle,
|
|
10708
10485
|
it as RecursiveContext,
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10486
|
+
de as RefContainer,
|
|
10487
|
+
C as Relation,
|
|
10488
|
+
Fi as RelationCustomHandle,
|
|
10489
|
+
Qe as SQLBuilder,
|
|
10490
|
+
Z as SYSTEM_RECORD,
|
|
10491
|
+
qi as Scheduler,
|
|
10492
|
+
qt as SideEffect,
|
|
10716
10493
|
ot as StateMachine,
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10494
|
+
ui as StateMachineHandles,
|
|
10495
|
+
K as StateNode,
|
|
10496
|
+
Lt as StateTransfer,
|
|
10720
10497
|
lt as Summation,
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10498
|
+
Mi as SummationHandles,
|
|
10499
|
+
jt as SystemConsoleLogger,
|
|
10500
|
+
ai as SystemEntity,
|
|
10501
|
+
ji as SystemLogLevel,
|
|
10502
|
+
we as Transfer,
|
|
10503
|
+
Tt as Transform,
|
|
10504
|
+
Ai as TransformHandles,
|
|
10728
10505
|
xr as USER_ENTITY,
|
|
10729
10506
|
nt as WeightedSummation,
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10507
|
+
pi as WeightedSummationHandles,
|
|
10508
|
+
oe as addToCurrentEffects,
|
|
10509
|
+
k as assert,
|
|
10510
|
+
Jt as asyncEffectsContext,
|
|
10511
|
+
Or as asyncInteractionContext,
|
|
10512
|
+
Dr as boolExpToAttributives,
|
|
10513
|
+
be as checkCondition,
|
|
10514
|
+
Re as checkPayload,
|
|
10515
|
+
pr as clearAllInstances,
|
|
10516
|
+
gr as createClass,
|
|
10517
|
+
ke as createInstances,
|
|
10518
|
+
yr as createInstancesFromString,
|
|
10519
|
+
Vr as createUserRoleAttributive,
|
|
10520
|
+
Cr as dbConsoleLogger,
|
|
10521
|
+
Rt as deepClone,
|
|
10522
|
+
Tr as everyAsync,
|
|
10523
|
+
kr as everyWithErrorAsync,
|
|
10524
|
+
Nr as filterMap,
|
|
10746
10525
|
Qr as findRootActivity,
|
|
10747
|
-
|
|
10526
|
+
Ne as forEachInteraction,
|
|
10748
10527
|
T as generateUUID,
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10528
|
+
Bi as getCurrentEffects,
|
|
10529
|
+
Fr as getInteractions,
|
|
10530
|
+
hr as indexBy,
|
|
10531
|
+
ce as isObject,
|
|
10532
|
+
le as isPlainObject,
|
|
10533
|
+
vr as mapObject,
|
|
10534
|
+
ue as registerKlass,
|
|
10535
|
+
fr as removeAllInstance,
|
|
10536
|
+
Ar as someAsync,
|
|
10537
|
+
mr as stringifyAllInstances,
|
|
10759
10538
|
w as stringifyAttribute,
|
|
10760
|
-
|
|
10539
|
+
Ui as systemConsoleLogger
|
|
10761
10540
|
};
|
|
10762
10541
|
//# sourceMappingURL=index.js.map
|