interaqt 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +328 -0
- 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 +17 -10
- 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 +3 -3
- package/dist/builtins/interaction/errors/ActivityErrors.d.ts.map +1 -1
- package/dist/builtins/interaction/errors/InteractionErrors.d.ts +2 -2
- 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/BoolExp.d.ts +2 -1
- package/dist/core/BoolExp.d.ts.map +1 -1
- package/dist/core/Computation.d.ts +3 -8
- package/dist/core/Computation.d.ts.map +1 -1
- package/dist/core/Custom.d.ts +2 -2
- package/dist/core/Custom.d.ts.map +1 -1
- package/dist/core/EventSource.d.ts +18 -16
- package/dist/core/EventSource.d.ts.map +1 -1
- package/dist/core/Property.d.ts +0 -3
- package/dist/core/Property.d.ts.map +1 -1
- package/dist/core/RealDictionary.d.ts +0 -3
- package/dist/core/RealDictionary.d.ts.map +1 -1
- package/dist/core/Relation.d.ts.map +1 -1
- package/dist/core/StateNode.d.ts +3 -3
- package/dist/core/StateNode.d.ts.map +1 -1
- package/dist/core/StateTransfer.d.ts +2 -6
- package/dist/core/StateTransfer.d.ts.map +1 -1
- package/dist/core/Transform.d.ts +2 -2
- package/dist/core/Transform.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/interfaces.d.ts +0 -9
- package/dist/core/interfaces.d.ts.map +1 -1
- package/dist/core/types.d.ts +0 -29
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/utils.d.ts +22 -6
- package/dist/core/utils.d.ts.map +1 -1
- package/dist/drivers/Mysql.d.ts +5 -5
- package/dist/drivers/Mysql.d.ts.map +1 -1
- package/dist/drivers/PGLite.d.ts +5 -5
- package/dist/drivers/PGLite.d.ts.map +1 -1
- package/dist/drivers/PostgreSQL.d.ts +5 -5
- package/dist/drivers/PostgreSQL.d.ts.map +1 -1
- package/dist/drivers/SQLite.d.ts +5 -5
- package/dist/drivers/SQLite.d.ts.map +1 -1
- package/dist/index.js +937 -1192
- package/dist/index.js.map +1 -1
- package/dist/runtime/Controller.d.ts +14 -14
- package/dist/runtime/Controller.d.ts.map +1 -1
- package/dist/runtime/MonoSystem.d.ts +4 -4
- package/dist/runtime/MonoSystem.d.ts.map +1 -1
- package/dist/runtime/Scheduler.d.ts +3 -3
- package/dist/runtime/Scheduler.d.ts.map +1 -1
- package/dist/runtime/System.d.ts +50 -51
- package/dist/runtime/System.d.ts.map +1 -1
- package/dist/runtime/computations/Any.d.ts +4 -4
- package/dist/runtime/computations/Any.d.ts.map +1 -1
- package/dist/runtime/computations/Average.d.ts +2 -2
- package/dist/runtime/computations/Average.d.ts.map +1 -1
- package/dist/runtime/computations/Computation.d.ts +41 -47
- package/dist/runtime/computations/Computation.d.ts.map +1 -1
- package/dist/runtime/computations/Count.d.ts +4 -4
- package/dist/runtime/computations/Count.d.ts.map +1 -1
- package/dist/runtime/computations/Every.d.ts +4 -4
- package/dist/runtime/computations/Every.d.ts.map +1 -1
- package/dist/runtime/computations/RealTime.d.ts +9 -17
- package/dist/runtime/computations/RealTime.d.ts.map +1 -1
- package/dist/runtime/computations/StateMachine.d.ts +2 -2
- package/dist/runtime/computations/Summation.d.ts +2 -2
- package/dist/runtime/computations/Summation.d.ts.map +1 -1
- package/dist/runtime/computations/TransitionFinder.d.ts +9 -4
- package/dist/runtime/computations/TransitionFinder.d.ts.map +1 -1
- package/dist/runtime/computations/WeightedSummation.d.ts +2 -2
- package/dist/runtime/computations/WeightedSummation.d.ts.map +1 -1
- package/dist/runtime/errors/ComputationErrors.d.ts +3 -3
- package/dist/runtime/errors/ComputationErrors.d.ts.map +1 -1
- package/dist/runtime/errors/ConditionErrors.d.ts +6 -6
- package/dist/runtime/errors/ConditionErrors.d.ts.map +1 -1
- package/dist/runtime/errors/FrameworkError.d.ts +4 -4
- package/dist/runtime/errors/FrameworkError.d.ts.map +1 -1
- package/dist/runtime/errors/SideEffectError.d.ts +1 -1
- package/dist/runtime/errors/SideEffectError.d.ts.map +1 -1
- package/dist/runtime/errors/SystemErrors.d.ts +1 -1
- package/dist/runtime/errors/SystemErrors.d.ts.map +1 -1
- package/dist/runtime/errors/index.d.ts +5 -5
- package/dist/runtime/errors/index.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/types/computation.d.ts +11 -0
- package/dist/runtime/types/computation.d.ts.map +1 -0
- package/dist/runtime/util.d.ts +6 -6
- package/dist/runtime/util.d.ts.map +1 -1
- package/dist/storage/erstorage/MatchExp.d.ts +4 -4
- package/dist/storage/erstorage/MatchExp.d.ts.map +1 -1
- package/dist/storage/erstorage/QueryExecutor.d.ts +1 -1
- package/dist/storage/erstorage/QueryExecutor.d.ts.map +1 -1
- package/dist/storage/erstorage/RecordQuery.d.ts +5 -5
- package/dist/storage/erstorage/RecordQuery.d.ts.map +1 -1
- package/dist/storage/erstorage/SQLBuilder.d.ts +11 -11
- package/dist/storage/erstorage/SQLBuilder.d.ts.map +1 -1
- package/dist/storage/erstorage/Setup.d.ts +1 -1
- package/dist/storage/erstorage/util/RecursiveContext.d.ts +4 -10
- package/dist/storage/erstorage/util/RecursiveContext.d.ts.map +1 -1
- package/dist/storage/erstorage/util.d.ts +3 -3
- package/dist/storage/erstorage/util.d.ts.map +1 -1
- package/dist/storage/utils.d.ts +2 -2
- package/dist/storage/utils.d.ts.map +1 -1
- package/package.json +4 -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,55 @@
|
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function fe(u, t) {
|
|
39
|
-
t && t.isKlass && t.displayName && Qt.set(u, t);
|
|
35
|
+
const Ft = /* @__PURE__ */ new Map();
|
|
36
|
+
function ue(u, t) {
|
|
37
|
+
t && t.isKlass && t.displayName && Ft.set(u, t);
|
|
40
38
|
}
|
|
41
|
-
function
|
|
39
|
+
function fr() {
|
|
42
40
|
const u = [];
|
|
43
|
-
return Array.from(
|
|
41
|
+
return Array.from(Ft.entries()).forEach(([, t]) => {
|
|
44
42
|
t.instances && Array.isArray(t.instances) && t.stringify && u.push(...t.instances.map((e) => t.stringify(e)));
|
|
45
43
|
}), `[${u.join(",")}]`;
|
|
46
44
|
}
|
|
47
|
-
function
|
|
45
|
+
function mr(u) {
|
|
48
46
|
const t = JSON.parse(u);
|
|
49
|
-
return
|
|
47
|
+
return ke(t);
|
|
50
48
|
}
|
|
51
|
-
function
|
|
49
|
+
function ke(u) {
|
|
52
50
|
const t = /* @__PURE__ */ new Map();
|
|
53
51
|
return u.forEach(({ type: e, options: i = {}, uuid: r, public: s }) => {
|
|
54
|
-
const a =
|
|
52
|
+
const a = Ft.get(e);
|
|
55
53
|
if (!a) {
|
|
56
54
|
console.warn(`Class ${e} not found in KlassByName`);
|
|
57
55
|
return;
|
|
@@ -60,36 +58,11 @@ function Ce(u) {
|
|
|
60
58
|
t.set(r, o);
|
|
61
59
|
}), t;
|
|
62
60
|
}
|
|
63
|
-
|
|
64
|
-
return console.warn("createClass is deprecated in refactored code"), null;
|
|
65
|
-
}
|
|
66
|
-
class Nr {
|
|
67
|
-
static {
|
|
68
|
-
this.isKlass = !0;
|
|
69
|
-
}
|
|
70
|
-
static {
|
|
71
|
-
this.instances = [];
|
|
72
|
-
}
|
|
73
|
-
// 通用的 create 方法实现
|
|
74
|
-
static createBase(t, e) {
|
|
75
|
-
if (e.find((r) => r.uuid === t.uuid))
|
|
76
|
-
throw new Error(`duplicate uuid in options ${t.uuid}, ${t._type}`);
|
|
77
|
-
return e.push(t), t;
|
|
78
|
-
}
|
|
79
|
-
// 通用的 is 方法实现
|
|
80
|
-
static isBase(t, e) {
|
|
81
|
-
return t !== null && typeof t == "object" && "_type" in t && t._type === e;
|
|
82
|
-
}
|
|
83
|
-
// 通用的 check 方法实现
|
|
84
|
-
static checkBase(t) {
|
|
85
|
-
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
let xe = 0;
|
|
61
|
+
let Se = 0;
|
|
89
62
|
function T(u) {
|
|
90
|
-
return u?.uuid || `id_${++
|
|
63
|
+
return u?.uuid || `id_${++Se}`;
|
|
91
64
|
}
|
|
92
|
-
const
|
|
65
|
+
const Ee = /^[a-zA-Z0-9_]+$/;
|
|
93
66
|
class I {
|
|
94
67
|
// for Merged Entity
|
|
95
68
|
constructor(t, e) {
|
|
@@ -110,7 +83,7 @@ class I {
|
|
|
110
83
|
type: "string",
|
|
111
84
|
required: !0,
|
|
112
85
|
constraints: {
|
|
113
|
-
nameFormat: ({ name: t }) =>
|
|
86
|
+
nameFormat: ({ name: t }) => Ee.test(t)
|
|
114
87
|
}
|
|
115
88
|
},
|
|
116
89
|
properties: {
|
|
@@ -201,9 +174,9 @@ class I {
|
|
|
201
174
|
return this.create(e.public, e.options);
|
|
202
175
|
}
|
|
203
176
|
}
|
|
204
|
-
var
|
|
205
|
-
const
|
|
206
|
-
class
|
|
177
|
+
var Vt = /* @__PURE__ */ ((u) => (u.String = "string", u.Number = "number", u.Boolean = "boolean", u.Timestamp = "timestamp", u))(Vt || {});
|
|
178
|
+
const Ie = /^[a-zA-Z0-9_]+$/;
|
|
179
|
+
class Qt {
|
|
207
180
|
constructor(t, e) {
|
|
208
181
|
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
182
|
}
|
|
@@ -223,15 +196,14 @@ class qt {
|
|
|
223
196
|
required: !0,
|
|
224
197
|
collection: !1,
|
|
225
198
|
constraints: {
|
|
226
|
-
format: ({ name: t }) =>
|
|
227
|
-
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
199
|
+
format: ({ name: t }) => Ie.test(t)
|
|
228
200
|
}
|
|
229
201
|
},
|
|
230
202
|
type: {
|
|
231
203
|
type: "string",
|
|
232
204
|
required: !0,
|
|
233
205
|
collection: !1,
|
|
234
|
-
options: Array.from(Object.values(
|
|
206
|
+
options: Array.from(Object.values(Vt))
|
|
235
207
|
},
|
|
236
208
|
collection: {
|
|
237
209
|
type: "boolean",
|
|
@@ -257,7 +229,7 @@ class qt {
|
|
|
257
229
|
};
|
|
258
230
|
}
|
|
259
231
|
static create(t, e) {
|
|
260
|
-
const i = new
|
|
232
|
+
const i = new Qt(t, e);
|
|
261
233
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
262
234
|
throw new Error(`duplicate uuid in options ${i.uuid}, Dictionary`);
|
|
263
235
|
return this.instances.push(i), i;
|
|
@@ -296,7 +268,7 @@ class qt {
|
|
|
296
268
|
return this.create(e.public, e.options);
|
|
297
269
|
}
|
|
298
270
|
}
|
|
299
|
-
const
|
|
271
|
+
const xe = /^[a-zA-Z0-9_]+$/;
|
|
300
272
|
class N {
|
|
301
273
|
constructor(t, e) {
|
|
302
274
|
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 +288,13 @@ class N {
|
|
|
316
288
|
type: "string",
|
|
317
289
|
required: !0,
|
|
318
290
|
constraints: {
|
|
319
|
-
format: ({ name: t }) =>
|
|
320
|
-
length: ({ name: t }) => t.length > 1 && t.length < 5
|
|
291
|
+
format: ({ name: t }) => xe.test(t)
|
|
321
292
|
}
|
|
322
293
|
},
|
|
323
294
|
type: {
|
|
324
295
|
type: "string",
|
|
325
296
|
required: !0,
|
|
326
|
-
options: () => Object.values(
|
|
297
|
+
options: () => Object.values(Vt)
|
|
327
298
|
},
|
|
328
299
|
collection: {
|
|
329
300
|
type: "boolean",
|
|
@@ -379,11 +350,11 @@ class N {
|
|
|
379
350
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
380
351
|
}
|
|
381
352
|
static parse(t) {
|
|
382
|
-
const e = JSON.parse(t), i = e.public;
|
|
383
|
-
return
|
|
353
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
354
|
+
return typeof r.defaultValue == "string" && r.defaultValue.startsWith("func::") && (i.defaultValue = new Function("return " + r.defaultValue.substring(6))()), typeof r.computed == "string" && r.computed.startsWith("func::") && (i.computed = new Function("return " + r.computed.substring(6))()), this.create(i, e.options);
|
|
384
355
|
}
|
|
385
356
|
}
|
|
386
|
-
class
|
|
357
|
+
class M {
|
|
387
358
|
constructor(t, e) {
|
|
388
359
|
if (this._type = "Relation", this._options = e, this.uuid = T(e), t.inputRelations) {
|
|
389
360
|
if (!t.inputRelations || t.inputRelations.length === 0)
|
|
@@ -415,7 +386,7 @@ class x {
|
|
|
415
386
|
// for Merged Relation
|
|
416
387
|
// Getter for name that returns computed name if _name is undefined
|
|
417
388
|
get name() {
|
|
418
|
-
return this._name !== void 0 ? this._name :
|
|
389
|
+
return this._name !== void 0 ? this._name : M.public.name.computed ? M.public.name.computed(this) : void 0;
|
|
419
390
|
}
|
|
420
391
|
// Setter for name
|
|
421
392
|
set name(t) {
|
|
@@ -515,7 +486,7 @@ class x {
|
|
|
515
486
|
};
|
|
516
487
|
}
|
|
517
488
|
static create(t, e) {
|
|
518
|
-
const i = new
|
|
489
|
+
const i = new M(t, e);
|
|
519
490
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
520
491
|
throw new Error(`duplicate uuid in options ${i.uuid}, Relation`);
|
|
521
492
|
return this.instances.push(i), i;
|
|
@@ -529,7 +500,7 @@ class x {
|
|
|
529
500
|
properties: t.properties
|
|
530
501
|
};
|
|
531
502
|
t.inputRelations || (e.source = t.source, e.target = t.target);
|
|
532
|
-
const i = t
|
|
503
|
+
const i = (t instanceof M, t.name);
|
|
533
504
|
i !== void 0 && (e.name = i), t.computation !== void 0 && (e.computation = t.computation), t.baseRelation !== void 0 && (e.baseRelation = t.baseRelation), t.matchExpression !== void 0 && (e.matchExpression = t.matchExpression), t.inputRelations !== void 0 && (e.inputRelations = t.inputRelations);
|
|
534
505
|
const r = {
|
|
535
506
|
type: "Relation",
|
|
@@ -548,8 +519,8 @@ class x {
|
|
|
548
519
|
properties: t.properties?.map((s) => N.clone(s, e))
|
|
549
520
|
};
|
|
550
521
|
t.inputRelations || (i.source = t.source, i.target = t.target);
|
|
551
|
-
const r = t
|
|
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
|
|
522
|
+
const r = (t instanceof M, t.name);
|
|
523
|
+
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 M(i, t._options);
|
|
553
524
|
}
|
|
554
525
|
static is(t) {
|
|
555
526
|
return t !== null && typeof t == "object" && "_type" in t && t._type === "Relation";
|
|
@@ -562,7 +533,7 @@ class x {
|
|
|
562
533
|
return this.create(e.public, e.options);
|
|
563
534
|
}
|
|
564
535
|
}
|
|
565
|
-
class
|
|
536
|
+
class K {
|
|
566
537
|
constructor(t, e) {
|
|
567
538
|
this._type = "StateNode", this._options = e, this.uuid = T(e), this.name = t.name, this.computeValue = t.computeValue;
|
|
568
539
|
}
|
|
@@ -590,7 +561,7 @@ class z {
|
|
|
590
561
|
};
|
|
591
562
|
}
|
|
592
563
|
static create(t, e) {
|
|
593
|
-
const i = new
|
|
564
|
+
const i = new K(t, e);
|
|
594
565
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
595
566
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateNode`);
|
|
596
567
|
return this.instances.push(i), i;
|
|
@@ -625,7 +596,7 @@ class z {
|
|
|
625
596
|
return this.create(e.public, e.options);
|
|
626
597
|
}
|
|
627
598
|
}
|
|
628
|
-
class
|
|
599
|
+
class Lt {
|
|
629
600
|
constructor(t, e) {
|
|
630
601
|
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
602
|
}
|
|
@@ -663,7 +634,7 @@ class Bt {
|
|
|
663
634
|
};
|
|
664
635
|
}
|
|
665
636
|
static create(t, e) {
|
|
666
|
-
const i = new
|
|
637
|
+
const i = new Lt(t, e);
|
|
667
638
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
668
639
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateTransfer`);
|
|
669
640
|
return this.instances.push(i), i;
|
|
@@ -857,8 +828,8 @@ class nt {
|
|
|
857
828
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
858
829
|
}
|
|
859
830
|
static parse(t) {
|
|
860
|
-
const e = JSON.parse(t), i = e.public;
|
|
861
|
-
return
|
|
831
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
832
|
+
return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
|
|
862
833
|
}
|
|
863
834
|
}
|
|
864
835
|
class ct {
|
|
@@ -926,7 +897,7 @@ class ct {
|
|
|
926
897
|
}
|
|
927
898
|
static clone(t, e) {
|
|
928
899
|
let i = t.record;
|
|
929
|
-
return e && (I.is(t.record) ? i = I.clone(t.record, e) :
|
|
900
|
+
return e && (I.is(t.record) ? i = I.clone(t.record, e) : M.is(t.record) && (i = M.clone(t.record, e))), this.create({
|
|
930
901
|
record: i,
|
|
931
902
|
direction: t.direction,
|
|
932
903
|
callback: t.callback,
|
|
@@ -941,8 +912,8 @@ class ct {
|
|
|
941
912
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
942
913
|
}
|
|
943
914
|
static parse(t) {
|
|
944
|
-
const e = JSON.parse(t), i = e.public;
|
|
945
|
-
return
|
|
915
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
916
|
+
return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
|
|
946
917
|
}
|
|
947
918
|
}
|
|
948
919
|
class lt {
|
|
@@ -1162,8 +1133,8 @@ class dt {
|
|
|
1162
1133
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
1163
1134
|
}
|
|
1164
1135
|
static parse(t) {
|
|
1165
|
-
const e = JSON.parse(t), i = e.public;
|
|
1166
|
-
return
|
|
1136
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
1137
|
+
return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
|
|
1167
1138
|
}
|
|
1168
1139
|
}
|
|
1169
1140
|
class ht {
|
|
@@ -1252,11 +1223,11 @@ class ht {
|
|
|
1252
1223
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
1253
1224
|
}
|
|
1254
1225
|
static parse(t) {
|
|
1255
|
-
const e = JSON.parse(t), i = e.public;
|
|
1256
|
-
return
|
|
1226
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
1227
|
+
return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
|
|
1257
1228
|
}
|
|
1258
1229
|
}
|
|
1259
|
-
class
|
|
1230
|
+
class Tt {
|
|
1260
1231
|
constructor(t, e) {
|
|
1261
1232
|
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
1233
|
}
|
|
@@ -1289,7 +1260,7 @@ class At {
|
|
|
1289
1260
|
};
|
|
1290
1261
|
}
|
|
1291
1262
|
static create(t, e) {
|
|
1292
|
-
const i = new
|
|
1263
|
+
const i = new Tt(t, e);
|
|
1293
1264
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1294
1265
|
throw new Error(`duplicate uuid in options ${i.uuid}, Transform`);
|
|
1295
1266
|
return this.instances.push(i), i;
|
|
@@ -1389,7 +1360,7 @@ class pt {
|
|
|
1389
1360
|
return t.attributeQuery !== void 0 && (i.attributeQuery = t.attributeQuery), t.dataDeps !== void 0 && (i.dataDeps = t.dataDeps), t.nextRecomputeTime !== void 0 && (i.nextRecomputeTime = t.nextRecomputeTime), this.create(i);
|
|
1390
1361
|
}
|
|
1391
1362
|
static is(t) {
|
|
1392
|
-
return t !== null && typeof t == "object" && "_type" in t && t._type === "
|
|
1363
|
+
return t !== null && typeof t == "object" && "_type" in t && t._type === "RealTimeValue";
|
|
1393
1364
|
}
|
|
1394
1365
|
static check(t) {
|
|
1395
1366
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
@@ -1399,7 +1370,7 @@ class pt {
|
|
|
1399
1370
|
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
1371
|
}
|
|
1401
1372
|
}
|
|
1402
|
-
class
|
|
1373
|
+
class qt {
|
|
1403
1374
|
constructor(t, e) {
|
|
1404
1375
|
this._type = "SideEffect", this._options = e, this.uuid = T(e), this.name = t.name, this.handle = t.handle;
|
|
1405
1376
|
}
|
|
@@ -1427,7 +1398,7 @@ class _t {
|
|
|
1427
1398
|
};
|
|
1428
1399
|
}
|
|
1429
1400
|
static create(t, e) {
|
|
1430
|
-
const i = new
|
|
1401
|
+
const i = new qt(t, e);
|
|
1431
1402
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
1432
1403
|
throw new Error(`duplicate uuid in options ${i.uuid}, SideEffect`);
|
|
1433
1404
|
return this.instances.push(i), i;
|
|
@@ -1457,8 +1428,8 @@ class _t {
|
|
|
1457
1428
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
1458
1429
|
}
|
|
1459
1430
|
static parse(t) {
|
|
1460
|
-
const e = JSON.parse(t), i = e.public;
|
|
1461
|
-
return
|
|
1431
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
1432
|
+
return typeof r.handle == "string" && r.handle.startsWith("func::") && (i.handle = new Function("return " + r.handle.substring(6))()), this.create(i, e.options);
|
|
1462
1433
|
}
|
|
1463
1434
|
}
|
|
1464
1435
|
class ft {
|
|
@@ -1640,8 +1611,11 @@ class R {
|
|
|
1640
1611
|
isExpression() {
|
|
1641
1612
|
return this.raw.type === "expression";
|
|
1642
1613
|
}
|
|
1614
|
+
static isExpressionData(t) {
|
|
1615
|
+
return t !== null && typeof t == "object" && "type" in t && (t.type === "atom" || t.type === "expression");
|
|
1616
|
+
}
|
|
1643
1617
|
static standardizeData(t) {
|
|
1644
|
-
return t instanceof R ? t.raw :
|
|
1618
|
+
return t instanceof R ? t.raw : R.isExpressionData(t) ? t : { type: "atom", data: t };
|
|
1645
1619
|
}
|
|
1646
1620
|
and(t) {
|
|
1647
1621
|
return new R({
|
|
@@ -1741,12 +1715,12 @@ class R {
|
|
|
1741
1715
|
throw new Error(`invalid bool expression type: ${JSON.stringify(this.raw)}`);
|
|
1742
1716
|
}
|
|
1743
1717
|
}
|
|
1744
|
-
const
|
|
1718
|
+
const Me = [
|
|
1745
1719
|
I,
|
|
1746
|
-
|
|
1720
|
+
M,
|
|
1747
1721
|
N,
|
|
1748
|
-
|
|
1749
|
-
|
|
1722
|
+
K,
|
|
1723
|
+
Lt,
|
|
1750
1724
|
ot,
|
|
1751
1725
|
nt,
|
|
1752
1726
|
ct,
|
|
@@ -1754,17 +1728,17 @@ const Oe = [
|
|
|
1754
1728
|
ut,
|
|
1755
1729
|
dt,
|
|
1756
1730
|
ht,
|
|
1757
|
-
|
|
1731
|
+
Tt,
|
|
1758
1732
|
pt,
|
|
1759
|
-
_t,
|
|
1760
1733
|
qt,
|
|
1734
|
+
Qt,
|
|
1761
1735
|
ft,
|
|
1762
1736
|
mt
|
|
1763
1737
|
];
|
|
1764
|
-
|
|
1765
|
-
u && u.displayName &&
|
|
1738
|
+
Me.forEach((u) => {
|
|
1739
|
+
u && u.displayName && ue(u.displayName, u);
|
|
1766
1740
|
});
|
|
1767
|
-
class
|
|
1741
|
+
class de {
|
|
1768
1742
|
constructor(t = [], e = []) {
|
|
1769
1743
|
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
1744
|
}
|
|
@@ -1777,7 +1751,7 @@ class me {
|
|
|
1777
1751
|
this.clonedEntities.set(t, e), this.reverseEntityMap.set(e, t);
|
|
1778
1752
|
}
|
|
1779
1753
|
for (const t of this.originalRelations) {
|
|
1780
|
-
const e =
|
|
1754
|
+
const e = M.clone(t, !1);
|
|
1781
1755
|
this.clonedRelations.set(t, e), this.reverseRelationMap.set(e, t);
|
|
1782
1756
|
}
|
|
1783
1757
|
this.updateAllReferences();
|
|
@@ -1801,7 +1775,7 @@ class me {
|
|
|
1801
1775
|
if (i === t || i.uuid === t.uuid)
|
|
1802
1776
|
throw new Error(`Relation already exists in container: ${t.name}`);
|
|
1803
1777
|
this.originalRelations.push(t);
|
|
1804
|
-
const e =
|
|
1778
|
+
const e = M.clone(t, !1);
|
|
1805
1779
|
return this.clonedRelations.set(t, e), this.reverseRelationMap.set(e, t), this.updateReferencesInObject(e), e;
|
|
1806
1780
|
}
|
|
1807
1781
|
/**
|
|
@@ -1975,7 +1949,7 @@ class me {
|
|
|
1975
1949
|
return null;
|
|
1976
1950
|
}
|
|
1977
1951
|
}
|
|
1978
|
-
class
|
|
1952
|
+
class Bt {
|
|
1979
1953
|
constructor(t, e) {
|
|
1980
1954
|
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
1955
|
}
|
|
@@ -2038,7 +2012,7 @@ class Wt {
|
|
|
2038
2012
|
};
|
|
2039
2013
|
}
|
|
2040
2014
|
static create(t, e) {
|
|
2041
|
-
const i = new
|
|
2015
|
+
const i = new Bt(t, e);
|
|
2042
2016
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2043
2017
|
throw new Error(`duplicate uuid in options ${i.uuid}, Custom`);
|
|
2044
2018
|
return this.instances.push(i), i;
|
|
@@ -2082,7 +2056,7 @@ class Wt {
|
|
|
2082
2056
|
}), this.create(i, e.options);
|
|
2083
2057
|
}
|
|
2084
2058
|
}
|
|
2085
|
-
class
|
|
2059
|
+
class he {
|
|
2086
2060
|
constructor(t, e) {
|
|
2087
2061
|
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
2062
|
}
|
|
@@ -2096,7 +2070,7 @@ class ye {
|
|
|
2096
2070
|
this.instances = [];
|
|
2097
2071
|
}
|
|
2098
2072
|
static create(t, e) {
|
|
2099
|
-
const i = new
|
|
2073
|
+
const i = new he(t, e);
|
|
2100
2074
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
2101
2075
|
throw new Error(`duplicate uuid in options ${i.uuid}, EventSource`);
|
|
2102
2076
|
return this.instances.push(i), i;
|
|
@@ -2138,7 +2112,7 @@ function b(u, t) {
|
|
|
2138
2112
|
if (!u)
|
|
2139
2113
|
throw new Error(t);
|
|
2140
2114
|
}
|
|
2141
|
-
function
|
|
2115
|
+
function Et(u, t, e) {
|
|
2142
2116
|
const i = [...t];
|
|
2143
2117
|
let r = u, s;
|
|
2144
2118
|
const a = i.pop();
|
|
@@ -2146,7 +2120,7 @@ function Ct(u, t, e) {
|
|
|
2146
2120
|
r[s] || (r[s] = {}), r = r[s];
|
|
2147
2121
|
return r[a] = e, !0;
|
|
2148
2122
|
}
|
|
2149
|
-
class
|
|
2123
|
+
class _ {
|
|
2150
2124
|
constructor(t, e, i, r) {
|
|
2151
2125
|
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
2126
|
}
|
|
@@ -2273,14 +2247,14 @@ class J {
|
|
|
2273
2247
|
return b(this.isLinkFiltered(), "only filtered relation can get match expression"), this.data.matchExpression;
|
|
2274
2248
|
}
|
|
2275
2249
|
getBaseAttributeInfo() {
|
|
2276
|
-
return b(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new
|
|
2250
|
+
return b(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new _(this.parentEntityName, this.data.baseRelationAttributeName, this.map, this.symmetricDirection);
|
|
2277
2251
|
}
|
|
2278
2252
|
}
|
|
2279
2253
|
class m {
|
|
2280
2254
|
constructor(t, e, i, r, s) {
|
|
2281
2255
|
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
2256
|
const a = this.map.getRecordInfo(t);
|
|
2283
|
-
this.entityName = a.resolvedBaseRecordName, this.xToOneQueryTree = new
|
|
2257
|
+
this.entityName = a.resolvedBaseRecordName, this.xToOneQueryTree = new Q(this.entityName, this.map);
|
|
2284
2258
|
let o = i;
|
|
2285
2259
|
a.resolvedMatchExpression && (o = i ? a.resolvedMatchExpression.and(i) : a.resolvedMatchExpression), o && (this.data = this.convertFilteredRelation(o), this.buildQueryTree(this.data, this.xToOneQueryTree));
|
|
2286
2260
|
}
|
|
@@ -2328,8 +2302,8 @@ class m {
|
|
|
2328
2302
|
const n = [...a.resolvedPath, o], c = this.map.getInfoByPath(n), l = a.resolvedPath.concat(c?.isLinkFiltered() ? c.getBaseAttributeInfo().attributeName : o);
|
|
2329
2303
|
let d = a.matchExpression;
|
|
2330
2304
|
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(
|
|
2305
|
+
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("."));
|
|
2306
|
+
d = d ? d.and(A) : A;
|
|
2333
2307
|
}
|
|
2334
2308
|
return {
|
|
2335
2309
|
path: [...a.path, o],
|
|
@@ -2501,7 +2475,7 @@ class m {
|
|
|
2501
2475
|
);
|
|
2502
2476
|
}
|
|
2503
2477
|
}
|
|
2504
|
-
class
|
|
2478
|
+
class Pe {
|
|
2505
2479
|
constructor(t, e, i, r) {
|
|
2506
2480
|
this.recordName = t, this.map = e, this.data = i, this.fromRelation = r;
|
|
2507
2481
|
}
|
|
@@ -2523,7 +2497,7 @@ class De {
|
|
|
2523
2497
|
* 用于确保 ORDER BY 中引用的关联字段会触发相应的 JOIN
|
|
2524
2498
|
*/
|
|
2525
2499
|
get xToOneQueryTree() {
|
|
2526
|
-
const t = new
|
|
2500
|
+
const t = new Q(this.recordName, this.map);
|
|
2527
2501
|
return Object.keys(this.data?.orderBy || {}).forEach((e) => {
|
|
2528
2502
|
const i = e.split(".");
|
|
2529
2503
|
if (i.length === 1) {
|
|
@@ -2534,7 +2508,7 @@ class De {
|
|
|
2534
2508
|
}), t;
|
|
2535
2509
|
}
|
|
2536
2510
|
}
|
|
2537
|
-
class
|
|
2511
|
+
class P {
|
|
2538
2512
|
constructor(t, e, i, r, s, a, o, n, c, l = !1, d, h, p, y) {
|
|
2539
2513
|
this.recordName = t, this.map = e, this.matchExpression = i, this.attributeQuery = r, this.modifier = s, this.contextRootEntity = a, this.parentRecord = o, this.attributeName = n, this.onlyRelationData = c, this.allowNull = l, this.label = d, this.goto = h, this.exit = p, this.alias = y;
|
|
2540
2514
|
}
|
|
@@ -2544,12 +2518,12 @@ class M {
|
|
|
2544
2518
|
key: "id",
|
|
2545
2519
|
value: ["not", null]
|
|
2546
2520
|
}), y = p;
|
|
2547
|
-
return l.resolvedMatchExpression && (y = p.and(new m(d, e, l.resolvedMatchExpression))), new
|
|
2521
|
+
return l.resolvedMatchExpression && (y = p.and(new m(d, e, l.resolvedMatchExpression))), new P(
|
|
2548
2522
|
d,
|
|
2549
2523
|
e,
|
|
2550
2524
|
y,
|
|
2551
|
-
new
|
|
2552
|
-
new
|
|
2525
|
+
new x(d, e, i.attributeQuery || [], s, a),
|
|
2526
|
+
new Pe(d, e, i.modifier),
|
|
2553
2527
|
r,
|
|
2554
2528
|
s,
|
|
2555
2529
|
a,
|
|
@@ -2571,7 +2545,7 @@ class M {
|
|
|
2571
2545
|
// CAUTION 特别注意这里的参数,不能让用取用原本的 matchExpression, attributeQuery, modifier 里面的 data 传进来。
|
|
2572
2546
|
// 因为 data 不能代表一切配置,例如 attributeQuery 里面 还有个 shouldQueryParentLinkData 就是保存在 this 上的。
|
|
2573
2547
|
derive({ matchExpression: t, attributeQuery: e, modifier: i }) {
|
|
2574
|
-
return new
|
|
2548
|
+
return new P(
|
|
2575
2549
|
this.recordName,
|
|
2576
2550
|
this.map,
|
|
2577
2551
|
t || this.matchExpression,
|
|
@@ -2588,7 +2562,7 @@ class M {
|
|
|
2588
2562
|
);
|
|
2589
2563
|
}
|
|
2590
2564
|
}
|
|
2591
|
-
class
|
|
2565
|
+
class Q {
|
|
2592
2566
|
// 父节点和自己这个几点 link 上的 query
|
|
2593
2567
|
constructor(t, e, i, r, s, a, o) {
|
|
2594
2568
|
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 +2572,26 @@ class L {
|
|
|
2598
2572
|
if (t.length === 1)
|
|
2599
2573
|
this.fields.push(e);
|
|
2600
2574
|
else if (e === f)
|
|
2601
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2575
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new Q(this.info.linkName, this.map)), this.parentLinkQueryTree.addField(i);
|
|
2602
2576
|
else {
|
|
2603
2577
|
const r = this.map.getInfo(this.recordName, e);
|
|
2604
|
-
this.records[e] || (this.records[e] = new
|
|
2578
|
+
this.records[e] || (this.records[e] = new Q(r.recordName, this.map, this.recordName, e, void 0, this)), this.records[e].addField(i);
|
|
2605
2579
|
}
|
|
2606
2580
|
}
|
|
2607
2581
|
addRecord(t, e) {
|
|
2608
2582
|
const [i, ...r] = t;
|
|
2609
2583
|
if (t.length === 1)
|
|
2610
2584
|
if (i === f)
|
|
2611
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2585
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new Q(this.info.linkName, this.map)), e && (this.parentLinkQueryTree = this.parentLinkQueryTree.merge(e));
|
|
2612
2586
|
else {
|
|
2613
|
-
const s = this.map.getInfo(this.recordName, i), a = e || new
|
|
2587
|
+
const s = this.map.getInfo(this.recordName, i), a = e || new Q(s.recordName, this.map, this.recordName, i, void 0, this);
|
|
2614
2588
|
this.records[i] = this.records[i] ? this.records[i].merge(a) : a;
|
|
2615
2589
|
}
|
|
2616
2590
|
else if (i === f)
|
|
2617
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2591
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new Q(this.info.linkName, this.map)), this.parentLinkQueryTree.addRecord(r, e);
|
|
2618
2592
|
else {
|
|
2619
2593
|
const s = this.map.getInfo(this.recordName, i);
|
|
2620
|
-
this.records[i] = new
|
|
2594
|
+
this.records[i] = new Q(s.recordName, this.map, this.recordName, i, void 0, this), this.records[i].addRecord(r, e);
|
|
2621
2595
|
}
|
|
2622
2596
|
}
|
|
2623
2597
|
forEachRecords(t) {
|
|
@@ -2632,7 +2606,7 @@ class L {
|
|
|
2632
2606
|
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
2607
|
});
|
|
2634
2608
|
let s;
|
|
2635
|
-
return this.parentLinkQueryTree && t.parentLinkQueryTree ? s = this.parentLinkQueryTree.merge(t.parentLinkQueryTree) : s = this.parentLinkQueryTree || t.parentLinkQueryTree, new
|
|
2609
|
+
return this.parentLinkQueryTree && t.parentLinkQueryTree ? s = this.parentLinkQueryTree.merge(t.parentLinkQueryTree) : s = this.parentLinkQueryTree || t.parentLinkQueryTree, new Q(this.recordName, this.map, this.parentRecord, this.attributeName, { fields: e, records: r }, this.parent, s);
|
|
2636
2610
|
}
|
|
2637
2611
|
getData() {
|
|
2638
2612
|
const t = {
|
|
@@ -2643,8 +2617,8 @@ class L {
|
|
|
2643
2617
|
}), this.parentLinkQueryTree && (t[f] = this.parentLinkQueryTree.getData()), t;
|
|
2644
2618
|
}
|
|
2645
2619
|
}
|
|
2646
|
-
const f = "&",
|
|
2647
|
-
class
|
|
2620
|
+
const f = "&", Ce = "*";
|
|
2621
|
+
class x {
|
|
2648
2622
|
constructor(t, e, i = [], r, s, a) {
|
|
2649
2623
|
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
2624
|
let o = /* @__PURE__ */ new Set();
|
|
@@ -2653,10 +2627,10 @@ class C {
|
|
|
2653
2627
|
if (l === f) {
|
|
2654
2628
|
b(!!(this.parentRecord && this.attributeName), `parent record and attribute name cannot be empty when query link data, you passed ${this.parentRecord} ${this.attributeName}`);
|
|
2655
2629
|
const y = this.map.getInfo(this.parentRecord, this.attributeName);
|
|
2656
|
-
this.parentLinkRecordQuery =
|
|
2630
|
+
this.parentLinkRecordQuery = P.create(y.linkName, this.map, d, void 0);
|
|
2657
2631
|
return;
|
|
2658
2632
|
}
|
|
2659
|
-
if (l ===
|
|
2633
|
+
if (l === Ce) {
|
|
2660
2634
|
o = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((y) => y.attributeName));
|
|
2661
2635
|
return;
|
|
2662
2636
|
}
|
|
@@ -2665,13 +2639,13 @@ class C {
|
|
|
2665
2639
|
let y = l, v = d;
|
|
2666
2640
|
if (p.isLinkFiltered()) {
|
|
2667
2641
|
y = p.getBaseAttributeInfo().attributeName;
|
|
2668
|
-
const
|
|
2642
|
+
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
2643
|
v = {
|
|
2670
2644
|
...d,
|
|
2671
|
-
matchExpression:
|
|
2645
|
+
matchExpression: Ae.data
|
|
2672
2646
|
};
|
|
2673
2647
|
}
|
|
2674
|
-
const g =
|
|
2648
|
+
const g = P.create(p.recordName, this.map, v, void 0, this.recordName, y, h, !1, l);
|
|
2675
2649
|
this.relatedRecords.push(g), p.isXToMany ? this.xToManyRecords.push(g) : p.isXToOne && this.xToOneRecords.push(g);
|
|
2676
2650
|
} else
|
|
2677
2651
|
o.add(l);
|
|
@@ -2680,7 +2654,7 @@ class C {
|
|
|
2680
2654
|
static mergeAttributeQueryData(t, e) {
|
|
2681
2655
|
const i = [...t, ...e], r = new Set(i.filter((o) => typeof o == "string")), a = i.filter((o) => typeof o != "string").reduce((o, n) => {
|
|
2682
2656
|
const [c, l] = n;
|
|
2683
|
-
return o[c] ? o[c] = { attributeQuery:
|
|
2657
|
+
return o[c] ? o[c] = { attributeQuery: x.mergeAttributeQueryData(o[c].attributeQuery, l.attributeQuery) } : o[c] = l, o;
|
|
2684
2658
|
}, {});
|
|
2685
2659
|
return [
|
|
2686
2660
|
...r,
|
|
@@ -2691,32 +2665,32 @@ class C {
|
|
|
2691
2665
|
const o = e.getRecordInfo(t), n = e.getRecordInfo(o.resolvedBaseRecordName);
|
|
2692
2666
|
let c = n.valueAttributes.map((l) => l.attributeName);
|
|
2693
2667
|
return i && n.sameTableReliance.forEach((l) => {
|
|
2694
|
-
const d =
|
|
2668
|
+
const d = x.getAttributeQueryDataForRecord(l.recordName, e, !0, r), h = [
|
|
2695
2669
|
l.attributeName,
|
|
2696
2670
|
{
|
|
2697
2671
|
attributeQuery: [...d]
|
|
2698
2672
|
}
|
|
2699
2673
|
];
|
|
2700
2674
|
if (!n.isRelation) {
|
|
2701
|
-
const p =
|
|
2675
|
+
const p = x.getAttributeQueryDataForRecord(l.linkName, e, !0, r);
|
|
2702
2676
|
h[1].attributeQuery.push([f, { attributeQuery: p }]);
|
|
2703
2677
|
}
|
|
2704
|
-
c =
|
|
2678
|
+
c = x.mergeAttributeQueryData(c, [h]);
|
|
2705
2679
|
}), a && n.notRelianceCombined.forEach((l) => {
|
|
2706
|
-
const d =
|
|
2680
|
+
const d = x.getAttributeQueryDataForRecord(l.recordName, e, !0, r), h = [
|
|
2707
2681
|
l.attributeName,
|
|
2708
2682
|
{
|
|
2709
2683
|
attributeQuery: [...d]
|
|
2710
2684
|
}
|
|
2711
2685
|
];
|
|
2712
2686
|
if (!n.isRelation) {
|
|
2713
|
-
const p =
|
|
2687
|
+
const p = x.getAttributeQueryDataForRecord(l.linkName, e, !0, r);
|
|
2714
2688
|
h[1].attributeQuery.push([f, { attributeQuery: p }]);
|
|
2715
2689
|
}
|
|
2716
|
-
c =
|
|
2690
|
+
c = x.mergeAttributeQueryData(c, [h]);
|
|
2717
2691
|
}), r && n.mergedRecordAttributes.forEach((l) => {
|
|
2718
|
-
const d =
|
|
2719
|
-
c =
|
|
2692
|
+
const d = x.getAttributeQueryDataForRecord(l.linkName, e, i, !0);
|
|
2693
|
+
c = x.mergeAttributeQueryData(c, [
|
|
2720
2694
|
[
|
|
2721
2695
|
l.attributeName,
|
|
2722
2696
|
{
|
|
@@ -2725,7 +2699,7 @@ class C {
|
|
|
2725
2699
|
]
|
|
2726
2700
|
]);
|
|
2727
2701
|
}), s && n.managedRecordAttributes.forEach((l) => {
|
|
2728
|
-
c =
|
|
2702
|
+
c = x.mergeAttributeQueryData(c, [
|
|
2729
2703
|
[
|
|
2730
2704
|
l.attributeName,
|
|
2731
2705
|
{
|
|
@@ -2765,7 +2739,7 @@ class C {
|
|
|
2765
2739
|
return this.buildXToOneQueryTree();
|
|
2766
2740
|
}
|
|
2767
2741
|
buildXToOneQueryTree() {
|
|
2768
|
-
const t = new
|
|
2742
|
+
const t = new Q(this.recordName, this.map, this.parentRecord, this.attributeName);
|
|
2769
2743
|
if (this.data.forEach((e) => {
|
|
2770
2744
|
Array.isArray(e) || t.addField([e]);
|
|
2771
2745
|
}), this.xToOneRecords.forEach((e) => {
|
|
@@ -2777,27 +2751,27 @@ class C {
|
|
|
2777
2751
|
return t;
|
|
2778
2752
|
}
|
|
2779
2753
|
buildFullQueryTree() {
|
|
2780
|
-
const t = new
|
|
2754
|
+
const t = new Q(this.recordName, this.map, this.parentRecord, this.attributeName);
|
|
2781
2755
|
return this.relatedRecords.forEach((e) => {
|
|
2782
2756
|
t.addRecord([e.attributeName], e.attributeQuery.fullQueryTree);
|
|
2783
2757
|
}), t;
|
|
2784
2758
|
}
|
|
2785
2759
|
withParentLinkData() {
|
|
2786
|
-
return this.parentLinkRecordQuery ? new
|
|
2760
|
+
return this.parentLinkRecordQuery ? new x(this.recordName, this.map, this.data, this.parentRecord, this.attributeName, !0) : this;
|
|
2787
2761
|
}
|
|
2788
2762
|
}
|
|
2789
|
-
function
|
|
2763
|
+
function $e(u) {
|
|
2790
2764
|
const t = [];
|
|
2791
2765
|
return u.forEach((e) => t.push(...Array.isArray(e) ? e : [e])), t;
|
|
2792
2766
|
}
|
|
2793
|
-
class
|
|
2767
|
+
class V {
|
|
2794
2768
|
constructor(t, e, i, r) {
|
|
2795
2769
|
this.map = t, this.originalRecordName = e, this.rawData = i, this.info = r, this.mergedLinkTargetNewRecords = [], this.mergedLinkTargetRecordIdRefs = [], this.mergedLinkTargetNullRecords = [], this.combinedNewRecords = [], this.combinedRecordIdRefs = [], this.combinedNullRecords = [], this.differentTableMergedLinkNewRecords = [], this.differentTableMergedLinkRecordIdRefs = [], this.differentTableMergedLinkNullRecords = [], this.isolatedNewRecords = [], this.isolatedRecordIdRefs = [], this.isolatedNullRecords = [], this.entityIdAttributes = [], this.relatedEntitiesData = [], this.valueAttributes = [], this.sameRowEntityIdRefs = [], this.defaultValues = {};
|
|
2796
2770
|
const s = this.map.getRecordInfo(e);
|
|
2797
2771
|
this.recordName = s.resolvedBaseRecordName;
|
|
2798
2772
|
const [a, o, n] = this.map.groupAttributes(this.recordName, i ? Object.keys(i) : []);
|
|
2799
|
-
this.relatedEntitiesData =
|
|
2800
|
-
(l) => Array.isArray(i[l.attributeName]) ? i[l.attributeName].map((d) => new
|
|
2773
|
+
this.relatedEntitiesData = $e(o.map(
|
|
2774
|
+
(l) => Array.isArray(i[l.attributeName]) ? i[l.attributeName].map((d) => new V(this.map, l.recordName, d, l)) : new V(this.map, l.recordName, i[l.attributeName], l)
|
|
2801
2775
|
)), this.valueAttributes = a, this.entityIdAttributes = n;
|
|
2802
2776
|
const c = this.map.getRecordInfo(this.recordName);
|
|
2803
2777
|
this.defaultValues = c.valueAttributes.reduce((l, d) => {
|
|
@@ -2805,10 +2779,10 @@ class Q {
|
|
|
2805
2779
|
return !this.rawData?.hasOwnProperty(d.attributeName) && h.defaultValue && typeof h.defaultValue == "function" && (l[d.attributeName] = h.defaultValue(i, this.originalRecordName)), l;
|
|
2806
2780
|
}, {}), this.relatedEntitiesData.forEach((l) => {
|
|
2807
2781
|
l.info.isMergedWithParent() ? l.isNull() ? this.combinedNullRecords.push(l) : l.isRef() ? this.combinedRecordIdRefs.push(l) : this.combinedNewRecords.push(l) : l.info.isLinkMergedWithParent() ? l.isNull() ? this.mergedLinkTargetNullRecords.push(l) : l.isRef() ? this.mergedLinkTargetRecordIdRefs.push(l) : this.mergedLinkTargetNewRecords.push(l) : l.info.isLinkMergedWithAttribute() ? l.isNull() ? this.differentTableMergedLinkNullRecords.push(l) : l.isRef() ? this.differentTableMergedLinkRecordIdRefs.push(l) : this.differentTableMergedLinkNewRecords.push(l) : l.isNull() ? this.isolatedNullRecords.push(l) : l.isRef() ? this.isolatedRecordIdRefs.push(l) : this.isolatedNewRecords.push(l);
|
|
2808
|
-
}), this.rawData?.[f] && (this.linkRecordData = new
|
|
2782
|
+
}), this.rawData?.[f] && (this.linkRecordData = new V(this.map, r?.linkName, this.rawData[f]));
|
|
2809
2783
|
}
|
|
2810
2784
|
merge(t) {
|
|
2811
|
-
const e = new
|
|
2785
|
+
const e = new V(this.map, this.originalRecordName, { ...this.rawData, ...t }, this.info);
|
|
2812
2786
|
return this.recordName !== this.originalRecordName && (e.recordName = this.recordName), e;
|
|
2813
2787
|
}
|
|
2814
2788
|
getRef() {
|
|
@@ -2873,7 +2847,7 @@ class Q {
|
|
|
2873
2847
|
}), i;
|
|
2874
2848
|
}
|
|
2875
2849
|
}
|
|
2876
|
-
class
|
|
2850
|
+
class Oe {
|
|
2877
2851
|
constructor(t, e, i, r, s, a) {
|
|
2878
2852
|
this.map = t, this.database = e, this.queryExecutor = i, this.helper = a, this.sqlBuilder = s, this.filteredEntityManager = r;
|
|
2879
2853
|
}
|
|
@@ -2996,7 +2970,7 @@ class Qe {
|
|
|
2996
2970
|
}), n = {
|
|
2997
2971
|
[a.attributeName]: i,
|
|
2998
2972
|
[f]: s.getData()[f]
|
|
2999
|
-
}, [c] = await this.helper.updateRecord(a.parentEntityName, o, new
|
|
2973
|
+
}, [c] = await this.helper.updateRecord(a.parentEntityName, o, new V(this.map, a.parentEntityName, n), e);
|
|
3000
2974
|
s.info.isXToMany ? (r[s.info.attributeName] || (r[s.info.attributeName] = []), r[s.info.attributeName].push({
|
|
3001
2975
|
...c,
|
|
3002
2976
|
[f]: c[a.attributeName][f]
|
|
@@ -3011,7 +2985,7 @@ class Qe {
|
|
|
3011
2985
|
source: s.info.isRecordSource() ? i : a,
|
|
3012
2986
|
target: s.info.isRecordSource() ? a : i
|
|
3013
2987
|
});
|
|
3014
|
-
const n = new
|
|
2988
|
+
const n = new V(this.map, s.info.linkName, o), c = await this.createRecord(n, `create isolated related link record ${t.recordName}.${s.info?.attributeName}`, e);
|
|
3015
2989
|
s.info.isXToMany ? (r[s.info.attributeName] || (r[s.info.attributeName] = []), r[s.info.attributeName].push({
|
|
3016
2990
|
...a,
|
|
3017
2991
|
[f]: c
|
|
@@ -3034,7 +3008,7 @@ class Qe {
|
|
|
3034
3008
|
source: a.info.isRecordSource() ? i : a.getRef(),
|
|
3035
3009
|
target: a.info.isRecordSource() ? a.getRef() : i
|
|
3036
3010
|
});
|
|
3037
|
-
const n = new
|
|
3011
|
+
const n = new V(this.map, a.info.linkName, o), c = await this.createRecord(n, `create isolated related link record of old related ${t.recordName}.${a.info?.attributeName}`, e);
|
|
3038
3012
|
a.info.isXToMany ? (r[a.info.attributeName] || (r[a.info.attributeName] = []), r[a.info.attributeName][s] = {
|
|
3039
3013
|
...a.getData(),
|
|
3040
3014
|
[f]: c
|
|
@@ -3056,7 +3030,7 @@ class Qe {
|
|
|
3056
3030
|
* 添加链接
|
|
3057
3031
|
*/
|
|
3058
3032
|
async addLink(t, e, i, r = {}, s = !1, a) {
|
|
3059
|
-
const o = (await this.queryExecutor.findRecords(
|
|
3033
|
+
const o = (await this.queryExecutor.findRecords(P.create(t, this.map, {
|
|
3060
3034
|
matchExpression: m.atom({ key: "source.id", value: ["=", e] }).and({
|
|
3061
3035
|
key: "target.id",
|
|
3062
3036
|
value: ["=", i]
|
|
@@ -3074,7 +3048,7 @@ class Qe {
|
|
|
3074
3048
|
});
|
|
3075
3049
|
await this.helper.unlink(t, h, !1, "unlink combined record for add new link", a);
|
|
3076
3050
|
}
|
|
3077
|
-
const c = new
|
|
3051
|
+
const c = new V(this.map, n.name, {
|
|
3078
3052
|
source: { id: e },
|
|
3079
3053
|
target: { id: i },
|
|
3080
3054
|
...r
|
|
@@ -3086,7 +3060,7 @@ class Qe {
|
|
|
3086
3060
|
* 这是一个辅助方法,实际的删除逻辑在 RecordQueryAgent 中
|
|
3087
3061
|
*/
|
|
3088
3062
|
}
|
|
3089
|
-
class
|
|
3063
|
+
class De {
|
|
3090
3064
|
constructor(t, e) {
|
|
3091
3065
|
this.map = t, this.queryAgent = e, this.dependencies = /* @__PURE__ */ new Map();
|
|
3092
3066
|
}
|
|
@@ -3168,7 +3142,7 @@ class Le {
|
|
|
3168
3142
|
const o = s.path.concat("id").join("."), n = m.atom({
|
|
3169
3143
|
key: o,
|
|
3170
3144
|
value: ["=", i]
|
|
3171
|
-
}), c =
|
|
3145
|
+
}), c = P.create(t.baseEntityName, this.map, {
|
|
3172
3146
|
matchExpression: n,
|
|
3173
3147
|
attributeQuery: ["id"]
|
|
3174
3148
|
});
|
|
@@ -3180,7 +3154,7 @@ class Le {
|
|
|
3180
3154
|
async checkRecordMatchesFilter(t, e, i) {
|
|
3181
3155
|
if (!this.queryAgent)
|
|
3182
3156
|
throw new Error("QueryAgent not set in FilteredEntityManager");
|
|
3183
|
-
const r =
|
|
3157
|
+
const r = P.create(e, this.map, {
|
|
3184
3158
|
matchExpression: i.and({
|
|
3185
3159
|
key: "id",
|
|
3186
3160
|
value: ["=", t]
|
|
@@ -3275,7 +3249,7 @@ class Le {
|
|
|
3275
3249
|
*/
|
|
3276
3250
|
async updateSingleFilteredEntityFlag(t, e, i) {
|
|
3277
3251
|
const r = this.map.getRecordInfo(t.baseEntityName), s = await this.queryAgent.findRecords(
|
|
3278
|
-
|
|
3252
|
+
P.create(t.baseEntityName, this.map, {
|
|
3279
3253
|
matchExpression: m.atom({ key: "id", value: ["=", e] }),
|
|
3280
3254
|
attributeQuery: r.isRelation ? ["*", ["target", { attributeQuery: ["*"] }], ["source", { attributeQuery: ["*"] }]] : ["*"]
|
|
3281
3255
|
}),
|
|
@@ -3312,7 +3286,7 @@ class Le {
|
|
|
3312
3286
|
}
|
|
3313
3287
|
}
|
|
3314
3288
|
}
|
|
3315
|
-
class
|
|
3289
|
+
class Fe {
|
|
3316
3290
|
constructor() {
|
|
3317
3291
|
this.aliasToPath = /* @__PURE__ */ new Map(), this.pathStrToAlias = /* @__PURE__ */ new Map(), this.aliasPlaceholder = 0;
|
|
3318
3292
|
}
|
|
@@ -3335,7 +3309,7 @@ class qe {
|
|
|
3335
3309
|
return this.aliasToPath.get(t);
|
|
3336
3310
|
}
|
|
3337
3311
|
}
|
|
3338
|
-
class
|
|
3312
|
+
class Ve {
|
|
3339
3313
|
constructor(t, e) {
|
|
3340
3314
|
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?");
|
|
3341
3315
|
}
|
|
@@ -3356,7 +3330,7 @@ class Be {
|
|
|
3356
3330
|
), [p, y] = this.buildSelectClause(
|
|
3357
3331
|
t.attributeQuery.getValueAndXToOneRecordFields(),
|
|
3358
3332
|
e
|
|
3359
|
-
), v = this.buildFromClause(t.recordName, e), g = this.buildJoinClause(n, e),
|
|
3333
|
+
), v = this.buildFromClause(t.recordName, e), g = this.buildJoinClause(n, e), A = this.buildModifierClause(t.modifier, e, y);
|
|
3360
3334
|
return [
|
|
3361
3335
|
`
|
|
3362
3336
|
SELECT
|
|
@@ -3367,7 +3341,7 @@ ${g}
|
|
|
3367
3341
|
WHERE
|
|
3368
3342
|
${d}
|
|
3369
3343
|
|
|
3370
|
-
${
|
|
3344
|
+
${A}
|
|
3371
3345
|
`,
|
|
3372
3346
|
h,
|
|
3373
3347
|
y
|
|
@@ -3377,7 +3351,7 @@ ${k}
|
|
|
3377
3351
|
* 构建 SELECT 子句
|
|
3378
3352
|
*/
|
|
3379
3353
|
buildSelectClause(t, e = "") {
|
|
3380
|
-
const i = new
|
|
3354
|
+
const i = new Fe();
|
|
3381
3355
|
return t.length ? [t.map(({ tableAliasAndField: s, attribute: a, nameContext: o }) => {
|
|
3382
3356
|
const n = [
|
|
3383
3357
|
`${this.withPrefix(e)}${o[0]}`,
|
|
@@ -3484,29 +3458,29 @@ ${k}
|
|
|
3484
3458
|
joinTarget: [d, h]
|
|
3485
3459
|
});
|
|
3486
3460
|
} else {
|
|
3487
|
-
const g = c.getLinkInfo(),
|
|
3461
|
+
const g = c.getLinkInfo(), A = c.isLinkManyToManySymmetric() ? c.symmetricDirection === "source" : g.isRelationSource(c.parentEntityName, c.attributeName);
|
|
3488
3462
|
r.push({
|
|
3489
3463
|
for: l,
|
|
3490
3464
|
joinSource: a,
|
|
3491
|
-
joinIdField: [s,
|
|
3465
|
+
joinIdField: [s, A ? g.record.attributes.source.field : g.record.attributes.target.field],
|
|
3492
3466
|
joinTarget: [p, y]
|
|
3493
3467
|
}), o.onlyIdField() || r.push({
|
|
3494
3468
|
for: l,
|
|
3495
3469
|
joinSource: [p, y],
|
|
3496
|
-
joinIdField: [
|
|
3470
|
+
joinIdField: [A ? g.record.attributes.target.field : g.record.attributes.source.field, v],
|
|
3497
3471
|
joinTarget: [d, h]
|
|
3498
3472
|
});
|
|
3499
3473
|
}
|
|
3500
3474
|
if (r.push(...this.getJoinTables(o, l, [v, d, h])), o.parentLinkQueryTree && !o.parentLinkQueryTree.onlyIdField()) {
|
|
3501
|
-
const g = l.concat(f), [,
|
|
3502
|
-
|
|
3475
|
+
const g = l.concat(f), [, A] = this.map.getTableAliasAndFieldName(g, "id", !0), D = [
|
|
3476
|
+
A,
|
|
3503
3477
|
// link 的 idField
|
|
3504
3478
|
p,
|
|
3505
3479
|
// link 的 tableName
|
|
3506
3480
|
y
|
|
3507
3481
|
// link 的 tableAlias
|
|
3508
3482
|
];
|
|
3509
|
-
r.push(...this.getJoinTables(o.parentLinkQueryTree, g,
|
|
3483
|
+
r.push(...this.getJoinTables(o.parentLinkQueryTree, g, D));
|
|
3510
3484
|
}
|
|
3511
3485
|
}), r;
|
|
3512
3486
|
}
|
|
@@ -3520,7 +3494,7 @@ ${k}
|
|
|
3520
3494
|
if (!s.data.isFunctionMatch) return { ...s.data };
|
|
3521
3495
|
if (s.data.value[0].toLowerCase() !== "exist")
|
|
3522
3496
|
throw new Error(`we only support Exist function match on entity for now. yours: ${s.data.key} ${s.data.value[0]} ${s.data.value[1]}`);
|
|
3523
|
-
const o = this.map.getInfoByPath(s.data.namePath), { alias: n } = this.map.getTableAndAliasStack(s.data.namePath).at(-1), c = this.map.getReverseAttribute(o.parentEntityName, o.attributeName), l = s.data.namePath.slice(1, -1), d =
|
|
3497
|
+
const o = this.map.getInfoByPath(s.data.namePath), { alias: n } = this.map.getTableAndAliasStack(s.data.namePath).at(-1), c = this.map.getReverseAttribute(o.parentEntityName, o.attributeName), l = s.data.namePath.slice(1, -1), d = P.create(
|
|
3524
3498
|
o.recordName,
|
|
3525
3499
|
this.map,
|
|
3526
3500
|
{
|
|
@@ -3617,20 +3591,14 @@ WHERE ${s}
|
|
|
3617
3591
|
return e?.toLowerCase() === "json" ? JSON.stringify(t) : t;
|
|
3618
3592
|
}
|
|
3619
3593
|
}
|
|
3620
|
-
const
|
|
3594
|
+
const _t = ":root";
|
|
3621
3595
|
class it {
|
|
3622
3596
|
constructor(t, e, i = []) {
|
|
3623
3597
|
this.label = t, this.parent = e, this.stack = i;
|
|
3624
3598
|
}
|
|
3625
|
-
/**
|
|
3626
|
-
* 添加一个值到栈中,返回新的上下文
|
|
3627
|
-
*/
|
|
3628
3599
|
concat(t) {
|
|
3629
3600
|
return new it(this.label, this.parent, [...this.stack, t]);
|
|
3630
3601
|
}
|
|
3631
|
-
/**
|
|
3632
|
-
* 获取栈数据
|
|
3633
|
-
*/
|
|
3634
3602
|
getStack(t) {
|
|
3635
3603
|
return [...this.stack];
|
|
3636
3604
|
}
|
|
@@ -3641,9 +3609,9 @@ class it {
|
|
|
3641
3609
|
return new it(t, this);
|
|
3642
3610
|
}
|
|
3643
3611
|
}
|
|
3644
|
-
class
|
|
3612
|
+
class Qe {
|
|
3645
3613
|
constructor(t) {
|
|
3646
|
-
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(
|
|
3614
|
+
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(_t, t), this.recursiveSaveLabelledRecordQuery(t);
|
|
3647
3615
|
}
|
|
3648
3616
|
recursiveSaveLabelledRecordQuery(t) {
|
|
3649
3617
|
t.attributeQuery?.relatedRecords.forEach((e) => {
|
|
@@ -3657,7 +3625,7 @@ class _e {
|
|
|
3657
3625
|
return this.recordQueryByName.get(t);
|
|
3658
3626
|
}
|
|
3659
3627
|
}
|
|
3660
|
-
class
|
|
3628
|
+
class Le {
|
|
3661
3629
|
constructor(t, e, i) {
|
|
3662
3630
|
this.map = t, this.database = e, this.sqlBuilder = i;
|
|
3663
3631
|
}
|
|
@@ -3673,7 +3641,7 @@ class We {
|
|
|
3673
3641
|
const s = {};
|
|
3674
3642
|
return Object.entries(r).forEach(([a, o]) => {
|
|
3675
3643
|
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 &&
|
|
3644
|
+
n.length === 1 && e.includes(n[0]) && typeof o == "string" && (o = JSON.parse(o)), o !== null && Et(s, n, o);
|
|
3677
3645
|
}), s;
|
|
3678
3646
|
});
|
|
3679
3647
|
}
|
|
@@ -3681,8 +3649,8 @@ class We {
|
|
|
3681
3649
|
* 查找记录(主查询方法)
|
|
3682
3650
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
3683
3651
|
*/
|
|
3684
|
-
async findRecords(t, e = "", i, r = new it(
|
|
3685
|
-
if (i || (i = new
|
|
3652
|
+
async findRecords(t, e = "", i, r = new it(_t)) {
|
|
3653
|
+
if (i || (i = new Qe(t)), t.goto) {
|
|
3686
3654
|
if (t.exit && await t.exit(r))
|
|
3687
3655
|
return [];
|
|
3688
3656
|
const d = i.get(t.goto);
|
|
@@ -3705,8 +3673,8 @@ class We {
|
|
|
3705
3673
|
value: ["=", y.id]
|
|
3706
3674
|
}), g = d.derive({
|
|
3707
3675
|
matchExpression: v
|
|
3708
|
-
}),
|
|
3709
|
-
y[d.alias || d.attributeName] = await this.findRecords(g, e, i,
|
|
3676
|
+
}), A = t.label ? l.concat(y) : l;
|
|
3677
|
+
y[d.alias || d.attributeName] = await this.findRecords(g, e, i, A);
|
|
3710
3678
|
}
|
|
3711
3679
|
}
|
|
3712
3680
|
for (let d of t.attributeQuery.xToOneRecords) {
|
|
@@ -3715,20 +3683,20 @@ class We {
|
|
|
3715
3683
|
for (let p of h.attributeQuery.xToManyRecords) {
|
|
3716
3684
|
const v = this.map.getInfo(p.parentRecord, p.attributeName).getReverseInfo()?.attributeName;
|
|
3717
3685
|
for (let g of c) {
|
|
3718
|
-
const
|
|
3686
|
+
const A = g[d.attributeName][f].id, D = p.derive({
|
|
3719
3687
|
matchExpression: p.matchExpression.and({
|
|
3720
3688
|
key: `${v}.id`,
|
|
3721
|
-
value: ["=",
|
|
3689
|
+
value: ["=", A]
|
|
3722
3690
|
})
|
|
3723
|
-
}),
|
|
3724
|
-
|
|
3691
|
+
}), J = t.label ? l.concat(g) : l;
|
|
3692
|
+
Et(
|
|
3725
3693
|
g,
|
|
3726
3694
|
[d.alias || d.attributeName, f, p.attributeName],
|
|
3727
3695
|
await this.findRecords(
|
|
3728
|
-
|
|
3696
|
+
D,
|
|
3729
3697
|
`finding relation data: ${t.recordName}.${d.attributeName}.&.${p.attributeName}`,
|
|
3730
3698
|
i,
|
|
3731
|
-
|
|
3699
|
+
J
|
|
3732
3700
|
)
|
|
3733
3701
|
);
|
|
3734
3702
|
}
|
|
@@ -3804,29 +3772,29 @@ class We {
|
|
|
3804
3772
|
matchExpression: c,
|
|
3805
3773
|
attributeQuery: l
|
|
3806
3774
|
}), 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() ? (
|
|
3775
|
+
let A;
|
|
3776
|
+
return o.isLinkManyToManySymmetric() ? (A = {
|
|
3809
3777
|
...g,
|
|
3810
3778
|
[f]: g[`${n}:source`]?.[f]?.id ? g[`${n}:source`]?.[f] : g[`${n}:target`]?.[f]
|
|
3811
|
-
}, delete
|
|
3779
|
+
}, delete A[`${n}:source`], delete A[`${n}:target`]) : (A = {
|
|
3812
3780
|
...g,
|
|
3813
3781
|
[f]: g[n][f]
|
|
3814
|
-
}, delete
|
|
3782
|
+
}, delete A[n]), A;
|
|
3815
3783
|
}) : h, y = d.label && d.label !== a.label ? a.spawn(d.label) : a, v = r.attributeQuery.parentLinkRecordQuery;
|
|
3816
3784
|
if (v)
|
|
3817
3785
|
for (let g of v.attributeQuery.xToManyRecords)
|
|
3818
|
-
for (let
|
|
3819
|
-
const
|
|
3820
|
-
|
|
3821
|
-
|
|
3786
|
+
for (let A of p) {
|
|
3787
|
+
const D = A[f].id, J = d.label ? y.concat(A) : y;
|
|
3788
|
+
Et(
|
|
3789
|
+
A,
|
|
3822
3790
|
[f, g.attributeName],
|
|
3823
3791
|
await this.findXToManyRelatedRecords(
|
|
3824
3792
|
g.parentRecord,
|
|
3825
3793
|
g.attributeName,
|
|
3826
|
-
|
|
3794
|
+
D,
|
|
3827
3795
|
g,
|
|
3828
3796
|
s,
|
|
3829
|
-
|
|
3797
|
+
J
|
|
3830
3798
|
)
|
|
3831
3799
|
);
|
|
3832
3800
|
}
|
|
@@ -3839,7 +3807,7 @@ class We {
|
|
|
3839
3807
|
const a = e.split("."), o = a.at(-1), n = a.slice(0, -1), c = m.atom({
|
|
3840
3808
|
key: "id",
|
|
3841
3809
|
value: ["=", i]
|
|
3842
|
-
}), l =
|
|
3810
|
+
}), l = x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !1, !0), d = e;
|
|
3843
3811
|
let h = l;
|
|
3844
3812
|
for (let g of n)
|
|
3845
3813
|
h.push([g, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
|
|
@@ -3853,14 +3821,14 @@ class We {
|
|
|
3853
3821
|
return p = [...g.stack], !0;
|
|
3854
3822
|
};
|
|
3855
3823
|
h.push([o, { goto: d, exit: y }]);
|
|
3856
|
-
const v = (await this.findRecords(
|
|
3824
|
+
const v = (await this.findRecords(P.create(t, this.map, {
|
|
3857
3825
|
matchExpression: c,
|
|
3858
3826
|
attributeQuery: l
|
|
3859
3827
|
}), `find records for path ${t}.${e}`))[0];
|
|
3860
3828
|
return p ? [v, ...p] : void 0;
|
|
3861
3829
|
}
|
|
3862
3830
|
}
|
|
3863
|
-
class
|
|
3831
|
+
class qe {
|
|
3864
3832
|
constructor(t, e, i, r, s, a) {
|
|
3865
3833
|
this.map = t, this.database = e, this.queryExecutor = i, this.helper = a, this.sqlBuilder = s, this.filteredEntityManager = r;
|
|
3866
3834
|
}
|
|
@@ -3868,9 +3836,9 @@ class Je {
|
|
|
3868
3836
|
* 删除记录(主入口)
|
|
3869
3837
|
*/
|
|
3870
3838
|
async deleteRecord(t, e, i, r = !1) {
|
|
3871
|
-
const s =
|
|
3839
|
+
const s = P.create(t, this.map, {
|
|
3872
3840
|
matchExpression: e,
|
|
3873
|
-
attributeQuery:
|
|
3841
|
+
attributeQuery: x.getAttributeQueryDataForRecord(
|
|
3874
3842
|
t,
|
|
3875
3843
|
this.map,
|
|
3876
3844
|
!0,
|
|
@@ -3898,7 +3866,7 @@ class Je {
|
|
|
3898
3866
|
const s = this.map.getRecordInfo(t);
|
|
3899
3867
|
for (let a of e) {
|
|
3900
3868
|
if (!r) {
|
|
3901
|
-
const o =
|
|
3869
|
+
const o = P.create(
|
|
3902
3870
|
t,
|
|
3903
3871
|
this.map,
|
|
3904
3872
|
{
|
|
@@ -3906,7 +3874,7 @@ class Je {
|
|
|
3906
3874
|
key: "id",
|
|
3907
3875
|
value: ["=", a.id]
|
|
3908
3876
|
}),
|
|
3909
|
-
attributeQuery:
|
|
3877
|
+
attributeQuery: x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !0, !0),
|
|
3910
3878
|
modifier: { limit: 1 }
|
|
3911
3879
|
}
|
|
3912
3880
|
), n = await this.helper.findRecords(o, `find record with same row data for delete ${t}`);
|
|
@@ -4032,7 +4000,7 @@ class Je {
|
|
|
4032
4000
|
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
4001
|
}
|
|
4034
4002
|
}
|
|
4035
|
-
class
|
|
4003
|
+
class Be {
|
|
4036
4004
|
constructor(t, e, i, r, s) {
|
|
4037
4005
|
this.map = t, this.database = e, this.helper = s, this.sqlBuilder = r, this.filteredEntityManager = i;
|
|
4038
4006
|
}
|
|
@@ -4040,9 +4008,9 @@ class He {
|
|
|
4040
4008
|
* 更新记录(主入口)
|
|
4041
4009
|
*/
|
|
4042
4010
|
async updateRecord(t, e, i, r) {
|
|
4043
|
-
const s =
|
|
4011
|
+
const s = P.create(t, this.map, {
|
|
4044
4012
|
matchExpression: e,
|
|
4045
|
-
attributeQuery:
|
|
4013
|
+
attributeQuery: x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !0, !0)
|
|
4046
4014
|
}), a = await this.helper.findRecords(s, `find record for updating ${t}`), o = [];
|
|
4047
4015
|
for (let n of a) {
|
|
4048
4016
|
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 +4104,9 @@ class He {
|
|
|
4136
4104
|
return await this.database.update(r, s, a.idField, `update record ${t} by id`), e;
|
|
4137
4105
|
}
|
|
4138
4106
|
}
|
|
4139
|
-
class
|
|
4107
|
+
class _e {
|
|
4140
4108
|
constructor(t, e) {
|
|
4141
|
-
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new
|
|
4109
|
+
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (i) => "?"), this.filteredEntityManager = new De(t, this), this.sqlBuilder = new Ve(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
4110
|
}
|
|
4143
4111
|
/**
|
|
4144
4112
|
* 初始化所有 filtered entity 的依赖关系
|
|
@@ -4158,7 +4126,7 @@ class je {
|
|
|
4158
4126
|
* 查找记录(主查询方法)- 委托给 QueryExecutor
|
|
4159
4127
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
4160
4128
|
*/
|
|
4161
|
-
async findRecords(t, e = "", i, r = new it(
|
|
4129
|
+
async findRecords(t, e = "", i, r = new it(_t)) {
|
|
4162
4130
|
return this.queryExecutor.findRecords(t, e, i, r);
|
|
4163
4131
|
}
|
|
4164
4132
|
// 委托给 CreationExecutor
|
|
@@ -4222,7 +4190,7 @@ class je {
|
|
|
4222
4190
|
async flashOutCombinedRecordsAndMergedLinks(t, e, i = "") {
|
|
4223
4191
|
const r = {};
|
|
4224
4192
|
let s;
|
|
4225
|
-
const a =
|
|
4193
|
+
const a = x.getAttributeQueryDataForRecord(t.recordName, this.map, !0, !0, !1, !0);
|
|
4226
4194
|
for (let c of t.combinedRecordIdRefs) {
|
|
4227
4195
|
const l = {
|
|
4228
4196
|
key: `${c.info.attributeName}.id`,
|
|
@@ -4230,7 +4198,7 @@ class je {
|
|
|
4230
4198
|
};
|
|
4231
4199
|
s ? s = s.or(l) : s = m.atom(l);
|
|
4232
4200
|
}
|
|
4233
|
-
const o =
|
|
4201
|
+
const o = P.create(t.recordName, this.map, {
|
|
4234
4202
|
matchExpression: s,
|
|
4235
4203
|
attributeQuery: a
|
|
4236
4204
|
}, void 0, void 0, void 0, !1, !0), n = await this.queryExecutor.findRecords(o, i, void 0);
|
|
@@ -4256,13 +4224,13 @@ class je {
|
|
|
4256
4224
|
* 用于 unlink 场景中处理合并记录的数据迁移
|
|
4257
4225
|
*/
|
|
4258
4226
|
async relocateCombinedRecordDataForLink(t, e, i = !1, r) {
|
|
4259
|
-
const s =
|
|
4227
|
+
const s = x.getAttributeQueryDataForRecord(t, this.map, !0, !0, !0, !0), a = i ? "source" : "target", o = await this.queryExecutor.findRecords(P.create(t, this.map, {
|
|
4260
4228
|
matchExpression: e,
|
|
4261
4229
|
attributeQuery: s
|
|
4262
4230
|
}), `finding combined records for relocate ${t}.${a}`, void 0), n = this.map.getLinkInfoByName(t)[i ? "sourceRecordInfo" : "targetRecordInfo"];
|
|
4263
4231
|
await this.deleteRecordSameRowData(n.name, o.map((c) => c[a]));
|
|
4264
4232
|
for (let c of o) {
|
|
4265
|
-
const l = new
|
|
4233
|
+
const l = new V(this.map, n.name, c[a]);
|
|
4266
4234
|
await this.creationExecutor.insertSameRowData(l, void 0), r?.push({
|
|
4267
4235
|
type: "delete",
|
|
4268
4236
|
recordName: t,
|
|
@@ -4306,9 +4274,9 @@ class je {
|
|
|
4306
4274
|
return this.queryExecutor.findPath(t, e, i, r, s);
|
|
4307
4275
|
}
|
|
4308
4276
|
}
|
|
4309
|
-
class
|
|
4277
|
+
class We {
|
|
4310
4278
|
constructor(t, e) {
|
|
4311
|
-
this.map = t, this.database = e, this.agent = new
|
|
4279
|
+
this.map = t, this.database = e, this.agent = new _e(t, e);
|
|
4312
4280
|
}
|
|
4313
4281
|
async findOne(t, e, i = {}, r) {
|
|
4314
4282
|
const s = {
|
|
@@ -4319,7 +4287,7 @@ class Ue {
|
|
|
4319
4287
|
}
|
|
4320
4288
|
async find(t, e, i, r = []) {
|
|
4321
4289
|
b(this.map.getRecord(t), `cannot find entity ${t}`);
|
|
4322
|
-
const s =
|
|
4290
|
+
const s = P.create(
|
|
4323
4291
|
t,
|
|
4324
4292
|
this.map,
|
|
4325
4293
|
{
|
|
@@ -4331,12 +4299,12 @@ class Ue {
|
|
|
4331
4299
|
return this.agent.findRecords(s, `finding ${t} from handle`);
|
|
4332
4300
|
}
|
|
4333
4301
|
async create(t, e, i) {
|
|
4334
|
-
const r = new
|
|
4302
|
+
const r = new V(this.map, t, e);
|
|
4335
4303
|
return this.agent.createRecord(r, `create record ${t} from handle`, i);
|
|
4336
4304
|
}
|
|
4337
4305
|
// CAUTION 不能递归更新 relate entity 的 value,如果传入了 related entity 的值,说明是建立新的联系。
|
|
4338
4306
|
async update(t, e, i, r) {
|
|
4339
|
-
const s = new
|
|
4307
|
+
const s = new V(this.map, t, i);
|
|
4340
4308
|
return this.agent.updateRecord(t, e, s, r);
|
|
4341
4309
|
}
|
|
4342
4310
|
async delete(t, e, i) {
|
|
@@ -4349,7 +4317,7 @@ class Ue {
|
|
|
4349
4317
|
return this.agent.addLinkFromRecord(t, e, i, r, s, a);
|
|
4350
4318
|
}
|
|
4351
4319
|
async updateRelationByName(t, e, i, r) {
|
|
4352
|
-
return b(!i.source && !i.target, "Relation can only update attributes. Use addRelation/removeRelation to update source/target."), this.agent.updateRecord(t, e, new
|
|
4320
|
+
return b(!i.source && !i.target, "Relation can only update attributes. Use addRelation/removeRelation to update source/target."), this.agent.updateRecord(t, e, new V(this.map, t, i), r);
|
|
4353
4321
|
}
|
|
4354
4322
|
async removeRelationByName(t, e, i) {
|
|
4355
4323
|
return this.agent.unlink(t, e, !1, `remove relation ${t}`, i);
|
|
@@ -4412,19 +4380,19 @@ class rt {
|
|
|
4412
4380
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
4413
4381
|
const e = this.data.attributes[t];
|
|
4414
4382
|
return e.isRecord && e.field;
|
|
4415
|
-
}).map((t) => new
|
|
4383
|
+
}).map((t) => new _(this.name, t, this.map));
|
|
4416
4384
|
}
|
|
4417
4385
|
get strictRecordAttributes() {
|
|
4418
4386
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
4419
4387
|
const e = this.data.attributes[t];
|
|
4420
4388
|
return e.isRecord && !e.field && !e.isFilteredRelation;
|
|
4421
|
-
}).map((t) => new
|
|
4389
|
+
}).map((t) => new _(this.name, t, this.map));
|
|
4422
4390
|
}
|
|
4423
4391
|
get differentTableRecordAttributes() {
|
|
4424
4392
|
return this.strictRecordAttributes.filter((t) => !(t.isMergedWithParent() || t.isLinkMergedWithParent()));
|
|
4425
4393
|
}
|
|
4426
4394
|
get reliance() {
|
|
4427
|
-
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new
|
|
4395
|
+
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new _(this.name, t, this.map));
|
|
4428
4396
|
}
|
|
4429
4397
|
get notRelianceCombined() {
|
|
4430
4398
|
return this.combinedRecords.filter((t) => !t.isReliance);
|
|
@@ -4436,10 +4404,10 @@ class rt {
|
|
|
4436
4404
|
return this.reliance.filter((t) => t.table === this.table);
|
|
4437
4405
|
}
|
|
4438
4406
|
get valueAttributes() {
|
|
4439
|
-
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new
|
|
4407
|
+
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new _(this.name, t, this.map));
|
|
4440
4408
|
}
|
|
4441
4409
|
getAttributeInfo(t) {
|
|
4442
|
-
return new
|
|
4410
|
+
return new _(this.name, t, this.map);
|
|
4443
4411
|
}
|
|
4444
4412
|
get baseRecordName() {
|
|
4445
4413
|
return this.data.baseRecordName;
|
|
@@ -4466,7 +4434,7 @@ class rt {
|
|
|
4466
4434
|
return this.data?.resolvedMatchExpression;
|
|
4467
4435
|
}
|
|
4468
4436
|
}
|
|
4469
|
-
class
|
|
4437
|
+
class wt {
|
|
4470
4438
|
constructor(t, e, i, r = !0) {
|
|
4471
4439
|
this.name = t, this.data = e, this.map = i, this.isFromSource = r;
|
|
4472
4440
|
}
|
|
@@ -4554,7 +4522,7 @@ class vt {
|
|
|
4554
4522
|
getBaseLinkInfo() {
|
|
4555
4523
|
b(this.isFilteredRelation(), "only filtered relation can get base link info");
|
|
4556
4524
|
const t = this.data.baseLinkName;
|
|
4557
|
-
return new
|
|
4525
|
+
return new wt(t, this.map.data.links[t], this.map);
|
|
4558
4526
|
}
|
|
4559
4527
|
getMatchExpression() {
|
|
4560
4528
|
if (this.isFilteredRelation())
|
|
@@ -4568,7 +4536,7 @@ class vt {
|
|
|
4568
4536
|
return b(this.isFilteredRelation(), "only filtered relation can get resolved record name"), this.data.resolvedBaseRecordName;
|
|
4569
4537
|
}
|
|
4570
4538
|
}
|
|
4571
|
-
class
|
|
4539
|
+
class Je {
|
|
4572
4540
|
constructor(t, e) {
|
|
4573
4541
|
this.data = t, this.aliasManager = e;
|
|
4574
4542
|
}
|
|
@@ -4593,10 +4561,10 @@ class Ge {
|
|
|
4593
4561
|
}
|
|
4594
4562
|
getLinkInfo(t, e) {
|
|
4595
4563
|
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
|
|
4564
|
+
return b(!!r, `cannot find relation ${t} ${i}`), new wt(r, this.data.links[r], this, !!s);
|
|
4597
4565
|
}
|
|
4598
4566
|
getLinkInfoByName(t) {
|
|
4599
|
-
return b(!!this.data.links[t], `cannot find link ${t}`), new
|
|
4567
|
+
return b(!!this.data.links[t], `cannot find link ${t}`), new wt(t, this.data.links[t], this);
|
|
4600
4568
|
}
|
|
4601
4569
|
getInfoByPath(t) {
|
|
4602
4570
|
const [e, ...i] = t;
|
|
@@ -4609,7 +4577,7 @@ class Ge {
|
|
|
4609
4577
|
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
4578
|
}
|
|
4611
4579
|
if (!(!s || !a))
|
|
4612
|
-
return new
|
|
4580
|
+
return new _(s, a, this, c);
|
|
4613
4581
|
}
|
|
4614
4582
|
getTableAndAliasStack(t) {
|
|
4615
4583
|
const [e, ...i] = t;
|
|
@@ -4632,21 +4600,21 @@ class Ge {
|
|
|
4632
4600
|
for (let h = 0; h < i.length; h++) {
|
|
4633
4601
|
const [p, y] = this.getAttributeAndSymmetricDirection(i[h]), v = [e, ...i.slice(0, h + 1)];
|
|
4634
4602
|
if (p === f) {
|
|
4635
|
-
const { linkTable: g, linkAlias:
|
|
4636
|
-
b(!c, `last attribute in path is a link, cannot read link of a link ${
|
|
4603
|
+
const { linkTable: g, linkAlias: A, path: D } = d.pop();
|
|
4604
|
+
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
4605
|
} else {
|
|
4638
4606
|
l = this.getInfoByPath(v);
|
|
4639
4607
|
const g = r.attributes[p];
|
|
4640
4608
|
b(l.isRecord, `${i.slice(0, h + 1).join(".")} is not a entity attribute`);
|
|
4641
|
-
const
|
|
4609
|
+
const A = this.data.records[g.recordName], D = `${a}_${p}${y ? `_${y.toUpperCase()}` : ""}`, J = this.aliasManager?.getTableAlias(D) || D;
|
|
4642
4610
|
if (l.isMergedWithParent() || l.isLinkMergedWithParent())
|
|
4643
4611
|
n = a;
|
|
4644
4612
|
else if (l.isLinkIsolated()) {
|
|
4645
|
-
const
|
|
4646
|
-
n = this.aliasManager?.getTableAlias(
|
|
4613
|
+
const Y = `REL_${D}`;
|
|
4614
|
+
n = this.aliasManager?.getTableAlias(Y) || Y;
|
|
4647
4615
|
} else
|
|
4648
|
-
n =
|
|
4649
|
-
l.isMergedWithParent() || (a =
|
|
4616
|
+
n = J;
|
|
4617
|
+
l.isMergedWithParent() || (a = J), s = l.table, r = A, o = l.getLinkInfo()?.table, c = !1;
|
|
4650
4618
|
}
|
|
4651
4619
|
d.push({
|
|
4652
4620
|
table: s,
|
|
@@ -4764,7 +4732,7 @@ class Ge {
|
|
|
4764
4732
|
return r.join(".");
|
|
4765
4733
|
}
|
|
4766
4734
|
}
|
|
4767
|
-
function
|
|
4735
|
+
function He(u) {
|
|
4768
4736
|
const t = /* @__PURE__ */ new Map();
|
|
4769
4737
|
for (const e of u)
|
|
4770
4738
|
if (e.inputEntities)
|
|
@@ -4775,7 +4743,7 @@ function Ke(u) {
|
|
|
4775
4743
|
}
|
|
4776
4744
|
return t;
|
|
4777
4745
|
}
|
|
4778
|
-
function
|
|
4746
|
+
function je(u) {
|
|
4779
4747
|
const t = /* @__PURE__ */ new Map();
|
|
4780
4748
|
for (const e of u) {
|
|
4781
4749
|
const i = e.name || `${e.source.name}_${e.sourceProperty}_${e.targetProperty}_${e.target.name}`;
|
|
@@ -4789,32 +4757,32 @@ function Xe(u) {
|
|
|
4789
4757
|
}
|
|
4790
4758
|
return t;
|
|
4791
4759
|
}
|
|
4792
|
-
function
|
|
4793
|
-
const e = new
|
|
4794
|
-
return
|
|
4760
|
+
function Ue(u, t) {
|
|
4761
|
+
const e = new de(u, t), i = He(u), r = je(t);
|
|
4762
|
+
return ie(
|
|
4795
4763
|
u,
|
|
4796
4764
|
e,
|
|
4797
4765
|
i,
|
|
4798
4766
|
"entity"
|
|
4799
|
-
),
|
|
4767
|
+
), ie(
|
|
4800
4768
|
t,
|
|
4801
4769
|
e,
|
|
4802
4770
|
r,
|
|
4803
4771
|
"relation"
|
|
4804
4772
|
), e.getAll();
|
|
4805
4773
|
}
|
|
4806
|
-
function
|
|
4774
|
+
function ie(u, t, e, i) {
|
|
4807
4775
|
const r = u.filter((s) => gt(s) !== void 0);
|
|
4808
4776
|
for (const s of r)
|
|
4809
|
-
|
|
4777
|
+
Ge(
|
|
4810
4778
|
s,
|
|
4811
4779
|
t,
|
|
4812
4780
|
i,
|
|
4813
4781
|
e
|
|
4814
4782
|
);
|
|
4815
4783
|
}
|
|
4816
|
-
function
|
|
4817
|
-
const r = e === "entity", a = `__${
|
|
4784
|
+
function Ge(u, t, e, i) {
|
|
4785
|
+
const r = e === "entity", a = `__${X(u)}_input_${e}`, o = r ? t.getEntityByName(u.name) : t.getRelationByName(u.name), [n, c] = Ze(
|
|
4818
4786
|
o,
|
|
4819
4787
|
a,
|
|
4820
4788
|
i,
|
|
@@ -4829,7 +4797,7 @@ function Ye(u, t, e, i) {
|
|
|
4829
4797
|
}
|
|
4830
4798
|
if (l)
|
|
4831
4799
|
for (const d of l)
|
|
4832
|
-
|
|
4800
|
+
Ke(
|
|
4833
4801
|
d,
|
|
4834
4802
|
c,
|
|
4835
4803
|
a,
|
|
@@ -4837,22 +4805,22 @@ function Ye(u, t, e, i) {
|
|
|
4837
4805
|
r
|
|
4838
4806
|
);
|
|
4839
4807
|
}
|
|
4840
|
-
function
|
|
4841
|
-
const [s, a] =
|
|
4808
|
+
function Ke(u, t, e, i, r) {
|
|
4809
|
+
const [s, a] = ti(
|
|
4842
4810
|
u,
|
|
4843
4811
|
t,
|
|
4844
4812
|
e
|
|
4845
4813
|
);
|
|
4846
4814
|
if (!r && s === u)
|
|
4847
4815
|
return;
|
|
4848
|
-
const o =
|
|
4816
|
+
const o = X(a), n = r ? i.getEntityByName(o) : i.getRelationByName(o);
|
|
4849
4817
|
n && i.replace(s, n);
|
|
4850
4818
|
}
|
|
4851
|
-
function
|
|
4819
|
+
function Xe(u, t) {
|
|
4852
4820
|
const e = /* @__PURE__ */ new Map(), i = gt(u);
|
|
4853
4821
|
if (i && i.length > 0)
|
|
4854
4822
|
for (const r of i) {
|
|
4855
|
-
const s =
|
|
4823
|
+
const s = X(r), a = [...t.get(s) || []], o = e.get(s) || [];
|
|
4856
4824
|
for (o.push(s), e.set(s, o); a.length; ) {
|
|
4857
4825
|
const n = a.shift(), c = e.get(n) || [];
|
|
4858
4826
|
c.push(...o), e.set(n, c);
|
|
@@ -4862,27 +4830,27 @@ function ti(u, t) {
|
|
|
4862
4830
|
}
|
|
4863
4831
|
return e;
|
|
4864
4832
|
}
|
|
4865
|
-
function
|
|
4866
|
-
const i =
|
|
4833
|
+
function ze(u, t, e) {
|
|
4834
|
+
const i = Xe(t, e);
|
|
4867
4835
|
return N.create({
|
|
4868
4836
|
name: u,
|
|
4869
4837
|
type: "json",
|
|
4870
4838
|
defaultValue: (r, s) => {
|
|
4871
4839
|
const a = gt(t) || [], n = (i.get(s) || []).filter(
|
|
4872
|
-
(c) => a.some((l) =>
|
|
4840
|
+
(c) => a.some((l) => X(l) === c)
|
|
4873
4841
|
);
|
|
4874
4842
|
return n.length > 0 ? n : [s];
|
|
4875
4843
|
}
|
|
4876
4844
|
});
|
|
4877
4845
|
}
|
|
4878
|
-
function
|
|
4846
|
+
function Ye(u, t, e) {
|
|
4879
4847
|
const i = gt(u) || [], r = [], s = /* @__PURE__ */ new Map(), a = Object.fromEntries(u.commonProperties?.map((o) => [o.name, o]) || []);
|
|
4880
4848
|
for (const o of i) {
|
|
4881
4849
|
let n = o;
|
|
4882
4850
|
if (yt(n))
|
|
4883
4851
|
for (; n.baseEntity && n.properties.length === 0; )
|
|
4884
4852
|
n = n.baseEntity;
|
|
4885
|
-
else if (
|
|
4853
|
+
else if (ii(n))
|
|
4886
4854
|
for (; n.baseRelation && n.properties.length === 0; )
|
|
4887
4855
|
n = n.baseRelation;
|
|
4888
4856
|
const c = Object.fromEntries(n.properties.map((h) => [h.name, h]));
|
|
@@ -4912,13 +4880,13 @@ function ii(u, t, e) {
|
|
|
4912
4880
|
}
|
|
4913
4881
|
return r;
|
|
4914
4882
|
}
|
|
4915
|
-
function
|
|
4916
|
-
const r =
|
|
4883
|
+
function Ze(u, t, e, i) {
|
|
4884
|
+
const r = ze(
|
|
4917
4885
|
t,
|
|
4918
4886
|
u,
|
|
4919
4887
|
e
|
|
4920
4888
|
), s = [
|
|
4921
|
-
...
|
|
4889
|
+
...Ye(
|
|
4922
4890
|
u,
|
|
4923
4891
|
e,
|
|
4924
4892
|
i
|
|
@@ -4941,7 +4909,7 @@ function ri(u, t, e, i) {
|
|
|
4941
4909
|
}))
|
|
4942
4910
|
)) : o.properties = s, [o, n || o];
|
|
4943
4911
|
} else {
|
|
4944
|
-
const a = i.getRelationByName(u.name), o =
|
|
4912
|
+
const a = i.getRelationByName(u.name), o = M.create({
|
|
4945
4913
|
name: a.name,
|
|
4946
4914
|
source: a.source,
|
|
4947
4915
|
sourceProperty: a.sourceProperty,
|
|
@@ -4953,7 +4921,7 @@ function ri(u, t, e, i) {
|
|
|
4953
4921
|
let n;
|
|
4954
4922
|
if (a.inputRelations?.some((c) => c.baseRelation)) {
|
|
4955
4923
|
const c = a.name || `${a.source.name}_${a.sourceProperty}_${a.targetProperty}_${a.target.name}`;
|
|
4956
|
-
n =
|
|
4924
|
+
n = M.create({
|
|
4957
4925
|
name: `__${c}_base`,
|
|
4958
4926
|
source: a.source,
|
|
4959
4927
|
sourceProperty: `__${a.sourceProperty}_base`,
|
|
@@ -4964,7 +4932,7 @@ function ri(u, t, e, i) {
|
|
|
4964
4932
|
properties: s
|
|
4965
4933
|
}), o.baseRelation = n, o.sourceProperty = a.sourceProperty, o.targetProperty = a.targetProperty, o.matchExpression = m.fromArray(
|
|
4966
4934
|
a.inputRelations.map((l) => {
|
|
4967
|
-
const d =
|
|
4935
|
+
const d = X(l);
|
|
4968
4936
|
return {
|
|
4969
4937
|
key: t,
|
|
4970
4938
|
value: ["contains", d]
|
|
@@ -4976,7 +4944,7 @@ function ri(u, t, e, i) {
|
|
|
4976
4944
|
return [o, n || o];
|
|
4977
4945
|
}
|
|
4978
4946
|
}
|
|
4979
|
-
function
|
|
4947
|
+
function ti(u, t, e) {
|
|
4980
4948
|
if (yt(u)) {
|
|
4981
4949
|
const i = u, r = t;
|
|
4982
4950
|
let s = i;
|
|
@@ -4989,8 +4957,8 @@ function si(u, t, e) {
|
|
|
4989
4957
|
value: ["contains", i.name]
|
|
4990
4958
|
}), [a, s];
|
|
4991
4959
|
} else {
|
|
4992
|
-
const i = u, r = t, s =
|
|
4993
|
-
return i.baseRelation ? [i,
|
|
4960
|
+
const i = u, r = t, s = X(i);
|
|
4961
|
+
return i.baseRelation ? [i, ei(i)] : [M.create({
|
|
4994
4962
|
name: s,
|
|
4995
4963
|
baseRelation: r,
|
|
4996
4964
|
sourceProperty: i.sourceProperty,
|
|
@@ -5002,7 +4970,7 @@ function si(u, t, e) {
|
|
|
5002
4970
|
}), i];
|
|
5003
4971
|
}
|
|
5004
4972
|
}
|
|
5005
|
-
function
|
|
4973
|
+
function ei(u) {
|
|
5006
4974
|
let t = u;
|
|
5007
4975
|
for (; t.baseRelation; )
|
|
5008
4976
|
t = t.baseRelation;
|
|
@@ -5011,16 +4979,16 @@ function ai(u) {
|
|
|
5011
4979
|
function yt(u) {
|
|
5012
4980
|
return "inputEntities" in u || !("sourceProperty" in u);
|
|
5013
4981
|
}
|
|
5014
|
-
function
|
|
4982
|
+
function ii(u) {
|
|
5015
4983
|
return "sourceProperty" in u;
|
|
5016
4984
|
}
|
|
5017
4985
|
function gt(u) {
|
|
5018
4986
|
return yt(u) ? u.inputEntities : u.inputRelations;
|
|
5019
4987
|
}
|
|
5020
|
-
function
|
|
4988
|
+
function X(u) {
|
|
5021
4989
|
return yt(u), u.name;
|
|
5022
4990
|
}
|
|
5023
|
-
class
|
|
4991
|
+
class ri {
|
|
5024
4992
|
constructor() {
|
|
5025
4993
|
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
4994
|
}
|
|
@@ -5106,9 +5074,9 @@ class ni {
|
|
|
5106
5074
|
this.tableAliasCounter = 1, this.fieldAliasCounter = 1, this.tablePathToAlias.clear(), this.tableAliasToPath.clear(), this.fieldPathToAlias.clear(), this.fieldAliasToPath.clear();
|
|
5107
5075
|
}
|
|
5108
5076
|
}
|
|
5109
|
-
class
|
|
5077
|
+
class si {
|
|
5110
5078
|
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
|
|
5079
|
+
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
5080
|
}
|
|
5113
5081
|
createRecordToTable(t, e) {
|
|
5114
5082
|
this.recordToTableMap.set(t, e);
|
|
@@ -5203,8 +5171,8 @@ class ci {
|
|
|
5203
5171
|
}
|
|
5204
5172
|
];
|
|
5205
5173
|
}));
|
|
5206
|
-
e && b(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[
|
|
5207
|
-
name:
|
|
5174
|
+
e && b(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[re] = {
|
|
5175
|
+
name: re,
|
|
5208
5176
|
type: "id",
|
|
5209
5177
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5210
5178
|
};
|
|
@@ -5499,7 +5467,7 @@ class ci {
|
|
|
5499
5467
|
* 统一处理 merged entities 和 merged relations
|
|
5500
5468
|
*/
|
|
5501
5469
|
processMergedItems() {
|
|
5502
|
-
const t =
|
|
5470
|
+
const t = Ue(
|
|
5503
5471
|
this.entities,
|
|
5504
5472
|
this.relations
|
|
5505
5473
|
);
|
|
@@ -5516,9 +5484,9 @@ class ci {
|
|
|
5516
5484
|
p[0] === "1" && p[1] === "1" && y !== v,
|
|
5517
5485
|
`only 1:1 can merge: ${s}.${a.slice(0, n + 1).join(".")}`
|
|
5518
5486
|
);
|
|
5519
|
-
const g = y === o ? v : y,
|
|
5520
|
-
if (
|
|
5521
|
-
throw new Error(`conflict found when join ${d}, ${
|
|
5487
|
+
const g = y === o ? v : y, A = this.combineRecordTable(o, g, d);
|
|
5488
|
+
if (A)
|
|
5489
|
+
throw new Error(`conflict found when join ${d}, ${A.join(",")} already merged with ${o}`);
|
|
5522
5490
|
h.mergedTo = "combined", i.push(h), o = l.recordName, delete t[d], delete e[d];
|
|
5523
5491
|
}
|
|
5524
5492
|
}), Object.values(t).forEach((r) => {
|
|
@@ -5577,8 +5545,8 @@ class ci {
|
|
|
5577
5545
|
buildTables() {
|
|
5578
5546
|
Object.entries(this.map.records).forEach(([t, e]) => {
|
|
5579
5547
|
this.tables[e.table] || (this.tables[e.table] = { columns: {
|
|
5580
|
-
[
|
|
5581
|
-
name:
|
|
5548
|
+
[se]: {
|
|
5549
|
+
name: se,
|
|
5582
5550
|
type: "pk",
|
|
5583
5551
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5584
5552
|
}
|
|
@@ -5651,8 +5619,8 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
5651
5619
|
});
|
|
5652
5620
|
}
|
|
5653
5621
|
}
|
|
5654
|
-
const
|
|
5655
|
-
name:
|
|
5622
|
+
const Z = "_System_", L = "_Dictionary_", re = "id", se = "_rowId", ai = I.create({
|
|
5623
|
+
name: Z,
|
|
5656
5624
|
properties: [
|
|
5657
5625
|
N.create({
|
|
5658
5626
|
name: "concept",
|
|
@@ -5670,8 +5638,8 @@ const tt = "_System_", q = "_Dictionary_", ae = "id", oe = "_rowId", li = I.crea
|
|
|
5670
5638
|
collection: !1
|
|
5671
5639
|
})
|
|
5672
5640
|
]
|
|
5673
|
-
}),
|
|
5674
|
-
name:
|
|
5641
|
+
}), oi = I.create({
|
|
5642
|
+
name: L,
|
|
5675
5643
|
properties: [
|
|
5676
5644
|
N.create({
|
|
5677
5645
|
name: "key",
|
|
@@ -5684,8 +5652,8 @@ const tt = "_System_", q = "_Dictionary_", ae = "id", oe = "_rowId", li = I.crea
|
|
|
5684
5652
|
collection: !1
|
|
5685
5653
|
})
|
|
5686
5654
|
]
|
|
5687
|
-
}),
|
|
5688
|
-
class
|
|
5655
|
+
}), yr = 0, It = 1, gr = 2;
|
|
5656
|
+
class ni {
|
|
5689
5657
|
constructor(t, e) {
|
|
5690
5658
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
5691
5659
|
}
|
|
@@ -5699,18 +5667,18 @@ class di {
|
|
|
5699
5667
|
if (this.scheduler.isDataBasedComputation(i)) {
|
|
5700
5668
|
if (Object.entries(i.dataDeps).forEach(([r, s]) => {
|
|
5701
5669
|
const a = this.convertDataDepToERMutationEventsSourceMap(r, s, i);
|
|
5702
|
-
e[s.phase ||
|
|
5670
|
+
e[s.phase || It].push(...a);
|
|
5703
5671
|
}), i.dataContext.type === "property" && Object.values(i.dataDeps).some((r) => r.type === "global")) {
|
|
5704
5672
|
const r = {
|
|
5705
5673
|
type: "records",
|
|
5706
5674
|
source: i.dataContext.host
|
|
5707
5675
|
};
|
|
5708
|
-
e[
|
|
5676
|
+
e[It].push(...this.convertDataDepToERMutationEventsSourceMap("_self", r, i, "create"));
|
|
5709
5677
|
}
|
|
5710
5678
|
} else {
|
|
5711
5679
|
const { eventDeps: r } = i;
|
|
5712
5680
|
for (const s of Object.values(r))
|
|
5713
|
-
e[s.phase ||
|
|
5681
|
+
e[s.phase || It].push({
|
|
5714
5682
|
type: s.type,
|
|
5715
5683
|
recordName: s.recordName,
|
|
5716
5684
|
record: s.record,
|
|
@@ -5749,7 +5717,7 @@ class di {
|
|
|
5749
5717
|
* @returns 是否需要触发计算
|
|
5750
5718
|
*/
|
|
5751
5719
|
shouldTriggerUpdateComputation(t, e) {
|
|
5752
|
-
return t.type !== "update" || !("dataDep" in t) ? !0 : t.dataDep.type === "global" && e.recordName ===
|
|
5720
|
+
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
5721
|
(r) => !e.record.hasOwnProperty(r) || e.record[r] === e.oldRecord[r]
|
|
5754
5722
|
);
|
|
5755
5723
|
}
|
|
@@ -5807,15 +5775,15 @@ class di {
|
|
|
5807
5775
|
} else e.type === "global" && ((!r || r === "update") && a.push({
|
|
5808
5776
|
dataDep: e,
|
|
5809
5777
|
type: "update",
|
|
5810
|
-
recordName:
|
|
5811
|
-
sourceRecordName:
|
|
5778
|
+
recordName: L,
|
|
5779
|
+
sourceRecordName: L,
|
|
5812
5780
|
attributes: ["value"],
|
|
5813
5781
|
computation: i
|
|
5814
5782
|
}), (!r || r === "create") && a.push({
|
|
5815
5783
|
dataDep: e,
|
|
5816
5784
|
type: "create",
|
|
5817
|
-
recordName:
|
|
5818
|
-
sourceRecordName:
|
|
5785
|
+
recordName: L,
|
|
5786
|
+
sourceRecordName: L,
|
|
5819
5787
|
computation: i
|
|
5820
5788
|
}));
|
|
5821
5789
|
return a;
|
|
@@ -5912,31 +5880,31 @@ class di {
|
|
|
5912
5880
|
}
|
|
5913
5881
|
class S {
|
|
5914
5882
|
static {
|
|
5915
|
-
this.skip = () => new
|
|
5883
|
+
this.skip = () => new Nt();
|
|
5916
5884
|
}
|
|
5917
5885
|
static {
|
|
5918
|
-
this.resolved = (t, e) => new
|
|
5886
|
+
this.resolved = (t, e) => new me(t, e);
|
|
5919
5887
|
}
|
|
5920
5888
|
static {
|
|
5921
|
-
this.async = (t) => new
|
|
5889
|
+
this.async = (t) => new fe(t);
|
|
5922
5890
|
}
|
|
5923
5891
|
static {
|
|
5924
|
-
this.fullRecompute = (t) => new
|
|
5892
|
+
this.fullRecompute = (t) => new pe(t);
|
|
5925
5893
|
}
|
|
5926
5894
|
}
|
|
5927
|
-
class
|
|
5895
|
+
class Nt extends S {
|
|
5928
5896
|
}
|
|
5929
|
-
class
|
|
5897
|
+
class pe extends S {
|
|
5930
5898
|
constructor(t) {
|
|
5931
5899
|
super(), this.reason = t;
|
|
5932
5900
|
}
|
|
5933
5901
|
}
|
|
5934
|
-
class
|
|
5902
|
+
class fe extends S {
|
|
5935
5903
|
constructor(t) {
|
|
5936
5904
|
super(), this.args = t;
|
|
5937
5905
|
}
|
|
5938
5906
|
}
|
|
5939
|
-
class
|
|
5907
|
+
class me extends S {
|
|
5940
5908
|
constructor(t, e) {
|
|
5941
5909
|
super(), this.result = t, this.args = e;
|
|
5942
5910
|
}
|
|
@@ -5949,8 +5917,8 @@ class E {
|
|
|
5949
5917
|
return await this.controller.system.storage.update(this.record, m.atom({ key: "id", value: ["=", t.id] }), { [this.key]: e }), e;
|
|
5950
5918
|
}
|
|
5951
5919
|
async get(t) {
|
|
5952
|
-
if (t[this.key] === void 0) {
|
|
5953
|
-
const i = (await this.controller.system.storage.findOne(this.record, m.atom({ key: "id", value: ["=", t.id] }), void 0, [this.key]))?.[this.key];
|
|
5920
|
+
if (!t || t[this.key] === void 0) {
|
|
5921
|
+
const i = (t ? await this.controller.system.storage.findOne(this.record, m.atom({ key: "id", value: ["=", t.id] }), void 0, [this.key]) : void 0)?.[this.key];
|
|
5954
5922
|
return i !== void 0 ? i : this.defaultValue;
|
|
5955
5923
|
}
|
|
5956
5924
|
return t[this.key];
|
|
@@ -5967,18 +5935,19 @@ class B {
|
|
|
5967
5935
|
return await this.controller.system.storage.dict.get(this.key);
|
|
5968
5936
|
}
|
|
5969
5937
|
}
|
|
5970
|
-
function
|
|
5938
|
+
function Ct(u, t) {
|
|
5971
5939
|
if (t == null || u === t) return !0;
|
|
5972
5940
|
if (typeof t != "object" || t === null)
|
|
5973
5941
|
return u === t;
|
|
5974
5942
|
if (typeof u != "object" || u === null)
|
|
5975
5943
|
return !1;
|
|
5976
|
-
|
|
5977
|
-
|
|
5944
|
+
const e = u, i = t;
|
|
5945
|
+
for (const r in i)
|
|
5946
|
+
if (!(r in e) || !Ct(e[r], i[r]))
|
|
5978
5947
|
return !1;
|
|
5979
5948
|
return !0;
|
|
5980
5949
|
}
|
|
5981
|
-
class
|
|
5950
|
+
class ye {
|
|
5982
5951
|
constructor(t) {
|
|
5983
5952
|
this.data = t, this.map = {};
|
|
5984
5953
|
for (const e of t.transfers)
|
|
@@ -5991,45 +5960,45 @@ class we {
|
|
|
5991
5960
|
const i = this.map[t];
|
|
5992
5961
|
if (i) {
|
|
5993
5962
|
for (const r of i)
|
|
5994
|
-
if (
|
|
5963
|
+
if (Ct(e, r.trigger))
|
|
5995
5964
|
return r.next;
|
|
5996
5965
|
}
|
|
5997
5966
|
return null;
|
|
5998
5967
|
}
|
|
5999
5968
|
findTransfers(t) {
|
|
6000
|
-
return this.data.transfers.filter((e) =>
|
|
5969
|
+
return this.data.transfers.filter((e) => Ct(t, e.trigger));
|
|
6001
5970
|
}
|
|
6002
5971
|
}
|
|
6003
|
-
function
|
|
5972
|
+
function k(u, t) {
|
|
6004
5973
|
if (!u)
|
|
6005
5974
|
throw new Error(t);
|
|
6006
5975
|
}
|
|
6007
|
-
function
|
|
5976
|
+
function br(u, t) {
|
|
6008
5977
|
return new Map(Array.from(u.entries()).map(([e, i]) => [e, t(e, i)]));
|
|
6009
5978
|
}
|
|
6010
|
-
function
|
|
5979
|
+
function Rr(u, t) {
|
|
6011
5980
|
return Object.fromEntries(Object.entries(u).map(([e, i]) => [e, t(e, i)]));
|
|
6012
5981
|
}
|
|
6013
|
-
async function
|
|
5982
|
+
async function wr(u, t) {
|
|
6014
5983
|
for (let e of u)
|
|
6015
5984
|
if (!await t(e)) return !1;
|
|
6016
5985
|
return !0;
|
|
6017
5986
|
}
|
|
6018
|
-
async function
|
|
5987
|
+
async function Nr(u, t) {
|
|
6019
5988
|
for (let e of u)
|
|
6020
5989
|
if (await t(e)) return !0;
|
|
6021
5990
|
return !1;
|
|
6022
5991
|
}
|
|
6023
|
-
async function
|
|
5992
|
+
async function vr(u, t) {
|
|
6024
5993
|
for (let e of u) {
|
|
6025
5994
|
const i = await t(e);
|
|
6026
5995
|
if (i !== !0) return i;
|
|
6027
5996
|
}
|
|
6028
5997
|
return !0;
|
|
6029
5998
|
}
|
|
6030
|
-
class
|
|
5999
|
+
class ci {
|
|
6031
6000
|
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
|
|
6001
|
+
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
6002
|
for (const r of this.args.transfers) {
|
|
6034
6003
|
const s = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6035
6004
|
this.eventDeps[s] = {
|
|
@@ -6057,9 +6026,9 @@ class fi {
|
|
|
6057
6026
|
return s ? (await this.state.currentState.set(s.name), s.computeValue ? await s.computeValue.call(this.controller, t, e) : s.name) : S.skip();
|
|
6058
6027
|
}
|
|
6059
6028
|
}
|
|
6060
|
-
class
|
|
6029
|
+
class li {
|
|
6061
6030
|
constructor(t, e, i) {
|
|
6062
|
-
this.controller = t, this.args = e, this.useLastValue = !0, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6031
|
+
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
6032
|
for (const r of this.args.transfers) {
|
|
6064
6033
|
const s = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6065
6034
|
this.eventDeps[s] = {
|
|
@@ -6081,7 +6050,7 @@ class mi {
|
|
|
6081
6050
|
}
|
|
6082
6051
|
async getInitialValue(t) {
|
|
6083
6052
|
const e = t[this.dataContext.id.name];
|
|
6084
|
-
return
|
|
6053
|
+
return k(
|
|
6085
6054
|
!(e !== void 0 && !this.initialState.computeValue),
|
|
6086
6055
|
`${this.dataContext.host.name}.${this.dataContext.id.name} have been set when ${this.dataContext.host.name} created,
|
|
6087
6056
|
if you want to save the use the initial value, you need to define computeValue in initialState to save it.
|
|
@@ -6104,17 +6073,17 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6104
6073
|
};
|
|
6105
6074
|
}
|
|
6106
6075
|
}
|
|
6107
|
-
const
|
|
6076
|
+
const Tr = K.create({
|
|
6108
6077
|
name: "nonExistent",
|
|
6109
6078
|
computeValue: () => null
|
|
6110
|
-
}),
|
|
6079
|
+
}), Ar = K.create({
|
|
6111
6080
|
name: "nonDeleted",
|
|
6112
6081
|
computeValue: () => !1
|
|
6113
|
-
}),
|
|
6082
|
+
}), kr = K.create({
|
|
6114
6083
|
name: "deleted",
|
|
6115
6084
|
computeValue: () => !0
|
|
6116
|
-
}),
|
|
6117
|
-
class
|
|
6085
|
+
}), ui = [ci, li];
|
|
6086
|
+
class di {
|
|
6118
6087
|
constructor(t, e, i) {
|
|
6119
6088
|
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
6089
|
main: {
|
|
@@ -6167,9 +6136,9 @@ class gi {
|
|
|
6167
6136
|
return i;
|
|
6168
6137
|
}
|
|
6169
6138
|
}
|
|
6170
|
-
class
|
|
6139
|
+
class hi {
|
|
6171
6140
|
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),
|
|
6141
|
+
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
6142
|
const r = this.args.attributeQuery || [];
|
|
6174
6143
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((a) => a[0] !== f) || [];
|
|
6175
6144
|
const s = (r.find((a) => a[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6243,8 +6212,8 @@ class bi {
|
|
|
6243
6212
|
return s;
|
|
6244
6213
|
}
|
|
6245
6214
|
}
|
|
6246
|
-
const
|
|
6247
|
-
class
|
|
6215
|
+
const pi = [di, hi];
|
|
6216
|
+
class fi {
|
|
6248
6217
|
constructor(t, e, i) {
|
|
6249
6218
|
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
6219
|
main: {
|
|
@@ -6297,9 +6266,9 @@ class wi {
|
|
|
6297
6266
|
return a === s;
|
|
6298
6267
|
}
|
|
6299
6268
|
}
|
|
6300
|
-
class
|
|
6269
|
+
class mi {
|
|
6301
6270
|
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,
|
|
6271
|
+
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
6272
|
const r = this.args.attributeQuery || [];
|
|
6304
6273
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((a) => a[0] !== f) || [];
|
|
6305
6274
|
const s = (r.find((a) => a[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6371,8 +6340,8 @@ class Ni {
|
|
|
6371
6340
|
return a === o;
|
|
6372
6341
|
}
|
|
6373
6342
|
}
|
|
6374
|
-
const
|
|
6375
|
-
class
|
|
6343
|
+
const yi = [fi, mi];
|
|
6344
|
+
class gi {
|
|
6376
6345
|
constructor(t, e, i) {
|
|
6377
6346
|
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
6347
|
main: {
|
|
@@ -6425,14 +6394,14 @@ class Ti {
|
|
|
6425
6394
|
return s > 0;
|
|
6426
6395
|
}
|
|
6427
6396
|
}
|
|
6428
|
-
class
|
|
6397
|
+
class bi {
|
|
6429
6398
|
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),
|
|
6399
|
+
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
6400
|
let r = this.relation.baseRelation || this.relation;
|
|
6432
6401
|
for (; r.baseRelation; )
|
|
6433
6402
|
r = r.baseRelation;
|
|
6434
6403
|
const s = r.type.split(":");
|
|
6435
|
-
|
|
6404
|
+
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
6405
|
const a = this.args.attributeQuery || [];
|
|
6437
6406
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((n) => n[0] !== f) || [];
|
|
6438
6407
|
const o = (a.find((n) => n[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6501,8 +6470,8 @@ class ki {
|
|
|
6501
6470
|
return s > 0;
|
|
6502
6471
|
}
|
|
6503
6472
|
}
|
|
6504
|
-
const
|
|
6505
|
-
class
|
|
6473
|
+
const Ri = [gi, bi];
|
|
6474
|
+
class wi {
|
|
6506
6475
|
constructor(t, e, i) {
|
|
6507
6476
|
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
6477
|
main: {
|
|
@@ -6552,9 +6521,9 @@ class Si {
|
|
|
6552
6521
|
return s = Math.max(0, s), await this.state.count.set(s), s;
|
|
6553
6522
|
}
|
|
6554
6523
|
}
|
|
6555
|
-
class
|
|
6524
|
+
class Ni {
|
|
6556
6525
|
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,
|
|
6526
|
+
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
6527
|
const r = this.args.attributeQuery || [];
|
|
6559
6528
|
this.relatedAttributeQuery = r.filter((a) => a && a[0] !== f) || [];
|
|
6560
6529
|
const s = (r.find((a) => a && a[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -6636,10 +6605,10 @@ class Ei {
|
|
|
6636
6605
|
return a;
|
|
6637
6606
|
}
|
|
6638
6607
|
}
|
|
6639
|
-
const
|
|
6640
|
-
class
|
|
6608
|
+
const vi = [wi, Ni];
|
|
6609
|
+
class Ti {
|
|
6641
6610
|
constructor(t, e, i) {
|
|
6642
|
-
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !0, this.dataDeps = {},
|
|
6611
|
+
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
6612
|
...this.args.dataDeps || {},
|
|
6644
6613
|
_source: {
|
|
6645
6614
|
type: "records",
|
|
@@ -6649,7 +6618,7 @@ class Ci {
|
|
|
6649
6618
|
});
|
|
6650
6619
|
}
|
|
6651
6620
|
static {
|
|
6652
|
-
this.computationType =
|
|
6621
|
+
this.computationType = Tt;
|
|
6653
6622
|
}
|
|
6654
6623
|
static {
|
|
6655
6624
|
this.contextType = ["entity", "relation"];
|
|
@@ -6664,7 +6633,7 @@ class Ci {
|
|
|
6664
6633
|
return [];
|
|
6665
6634
|
}
|
|
6666
6635
|
async compute({ _source: t }) {
|
|
6667
|
-
|
|
6636
|
+
k(!this.eventDeps, "Transform compute should not be called with eventDeps");
|
|
6668
6637
|
const e = [];
|
|
6669
6638
|
for (const i of t) {
|
|
6670
6639
|
const r = await this.transformCallback.call(this.controller, i);
|
|
@@ -6679,7 +6648,7 @@ class Ci {
|
|
|
6679
6648
|
return e;
|
|
6680
6649
|
}
|
|
6681
6650
|
async computeDirtyRecords(t) {
|
|
6682
|
-
return
|
|
6651
|
+
return k(this.eventDeps, "computeDirtyRecords should be called with eventDeps"), [{}];
|
|
6683
6652
|
}
|
|
6684
6653
|
async incrementalPatchCompute(t, e) {
|
|
6685
6654
|
return this.eventDeps ? this.eventBasedIncrementalPatchCompute(t, e) : this.dataBasedIncrementalPatchCompute(t, e);
|
|
@@ -6745,20 +6714,20 @@ class Ci {
|
|
|
6745
6714
|
return r;
|
|
6746
6715
|
}
|
|
6747
6716
|
}
|
|
6748
|
-
const
|
|
6749
|
-
class
|
|
6717
|
+
const Ai = [Ti];
|
|
6718
|
+
class C {
|
|
6750
6719
|
constructor(t) {
|
|
6751
6720
|
this.node = t;
|
|
6752
6721
|
}
|
|
6753
6722
|
static number(t) {
|
|
6754
|
-
return new
|
|
6723
|
+
return new C({ type: "number", value: t });
|
|
6755
6724
|
}
|
|
6756
6725
|
static variable(t) {
|
|
6757
|
-
return new
|
|
6726
|
+
return new C({ type: "variable", variable: { id: t } });
|
|
6758
6727
|
}
|
|
6759
6728
|
add(t) {
|
|
6760
6729
|
const e = typeof t == "number" ? { type: "number", value: t } : t.node;
|
|
6761
|
-
return new
|
|
6730
|
+
return new C({
|
|
6762
6731
|
type: "operation",
|
|
6763
6732
|
operation: "+",
|
|
6764
6733
|
left: this.node,
|
|
@@ -6767,7 +6736,7 @@ class P {
|
|
|
6767
6736
|
}
|
|
6768
6737
|
subtract(t) {
|
|
6769
6738
|
const e = typeof t == "number" ? { type: "number", value: t } : t.node;
|
|
6770
|
-
return new
|
|
6739
|
+
return new C({
|
|
6771
6740
|
type: "operation",
|
|
6772
6741
|
operation: "-",
|
|
6773
6742
|
left: this.node,
|
|
@@ -6776,7 +6745,7 @@ class P {
|
|
|
6776
6745
|
}
|
|
6777
6746
|
multiply(t) {
|
|
6778
6747
|
const e = typeof t == "number" ? { type: "number", value: t } : t.node;
|
|
6779
|
-
return new
|
|
6748
|
+
return new C({
|
|
6780
6749
|
type: "operation",
|
|
6781
6750
|
operation: "*",
|
|
6782
6751
|
left: this.node,
|
|
@@ -6785,7 +6754,7 @@ class P {
|
|
|
6785
6754
|
}
|
|
6786
6755
|
divide(t) {
|
|
6787
6756
|
const e = typeof t == "number" ? { type: "number", value: t } : t.node;
|
|
6788
|
-
return new
|
|
6757
|
+
return new C({
|
|
6789
6758
|
type: "operation",
|
|
6790
6759
|
operation: "/",
|
|
6791
6760
|
left: this.node,
|
|
@@ -6794,7 +6763,7 @@ class P {
|
|
|
6794
6763
|
}
|
|
6795
6764
|
power(t) {
|
|
6796
6765
|
const e = typeof t == "number" ? { type: "number", value: t } : t.node;
|
|
6797
|
-
return new
|
|
6766
|
+
return new C({
|
|
6798
6767
|
type: "operation",
|
|
6799
6768
|
operation: "^",
|
|
6800
6769
|
left: this.node,
|
|
@@ -6802,7 +6771,7 @@ class P {
|
|
|
6802
6771
|
});
|
|
6803
6772
|
}
|
|
6804
6773
|
sqrt() {
|
|
6805
|
-
return new
|
|
6774
|
+
return new C({
|
|
6806
6775
|
type: "operation",
|
|
6807
6776
|
operation: "sqrt",
|
|
6808
6777
|
left: this.node
|
|
@@ -6844,13 +6813,13 @@ class P {
|
|
|
6844
6813
|
}
|
|
6845
6814
|
}
|
|
6846
6815
|
gt(t) {
|
|
6847
|
-
return new
|
|
6816
|
+
return new vt(this, ">", t);
|
|
6848
6817
|
}
|
|
6849
6818
|
lt(t) {
|
|
6850
|
-
return new
|
|
6819
|
+
return new vt(this, "<", t);
|
|
6851
6820
|
}
|
|
6852
6821
|
eq(t) {
|
|
6853
|
-
return new
|
|
6822
|
+
return new Wt(this, t);
|
|
6854
6823
|
}
|
|
6855
6824
|
getVariables() {
|
|
6856
6825
|
const t = /* @__PURE__ */ new Set();
|
|
@@ -6860,7 +6829,7 @@ class P {
|
|
|
6860
6829
|
t.type === "variable" ? e.add(t.variable.id) : t.type === "operation" && (t.left && this.collectVariables(t.left, e), t.right && this.collectVariables(t.right, e));
|
|
6861
6830
|
}
|
|
6862
6831
|
clone() {
|
|
6863
|
-
return new
|
|
6832
|
+
return new C(this.cloneNode(this.node));
|
|
6864
6833
|
}
|
|
6865
6834
|
cloneNode(t) {
|
|
6866
6835
|
const e = { type: t.type };
|
|
@@ -6947,7 +6916,7 @@ class P {
|
|
|
6947
6916
|
}
|
|
6948
6917
|
}
|
|
6949
6918
|
}
|
|
6950
|
-
class
|
|
6919
|
+
class vt {
|
|
6951
6920
|
constructor(t, e, i) {
|
|
6952
6921
|
this.left = t, this.operator = e, this.right = i;
|
|
6953
6922
|
}
|
|
@@ -6956,7 +6925,7 @@ class kt {
|
|
|
6956
6925
|
return this.operator === ">" ? e > i : e < i;
|
|
6957
6926
|
}
|
|
6958
6927
|
solve() {
|
|
6959
|
-
const t = typeof this.right == "number" ?
|
|
6928
|
+
const t = typeof this.right == "number" ? C.number(this.right) : this.right, e = this.left.getVariables(), i = t.getVariables(), r = [.../* @__PURE__ */ new Set([...e, ...i])];
|
|
6960
6929
|
if (r.length !== 1)
|
|
6961
6930
|
throw new Error("Can only solve inequalities with exactly one variable");
|
|
6962
6931
|
const s = r[0];
|
|
@@ -6982,7 +6951,7 @@ class kt {
|
|
|
6982
6951
|
}
|
|
6983
6952
|
}
|
|
6984
6953
|
}
|
|
6985
|
-
class
|
|
6954
|
+
class Wt {
|
|
6986
6955
|
constructor(t, e) {
|
|
6987
6956
|
this.left = t, this.right = e;
|
|
6988
6957
|
}
|
|
@@ -6991,7 +6960,7 @@ class Ht {
|
|
|
6991
6960
|
return Math.abs(e - i) < 1e-10;
|
|
6992
6961
|
}
|
|
6993
6962
|
solve() {
|
|
6994
|
-
const t = typeof this.right == "number" ?
|
|
6963
|
+
const t = typeof this.right == "number" ? C.number(this.right) : this.right, e = this.left.getVariables(), i = t.getVariables(), r = [.../* @__PURE__ */ new Set([...e, ...i])];
|
|
6995
6964
|
if (r.length !== 1)
|
|
6996
6965
|
throw new Error("Can only solve equations with exactly one variable");
|
|
6997
6966
|
const s = r[0];
|
|
@@ -7017,7 +6986,7 @@ class Ht {
|
|
|
7017
6986
|
}
|
|
7018
6987
|
}
|
|
7019
6988
|
}
|
|
7020
|
-
class
|
|
6989
|
+
class ki {
|
|
7021
6990
|
constructor(t, e, i) {
|
|
7022
6991
|
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
6992
|
}
|
|
@@ -7038,18 +7007,18 @@ class Mi {
|
|
|
7038
7007
|
}
|
|
7039
7008
|
// TODO now 是不是应该用 dataDeps 动态注入???这样能手动测试。改成在哪里配置?
|
|
7040
7009
|
async compute(t) {
|
|
7041
|
-
const e = await this.args.callback(
|
|
7010
|
+
const e = await this.args.callback(C.variable("now"), t), i = Date.now();
|
|
7042
7011
|
let r, s;
|
|
7043
|
-
if (e instanceof
|
|
7012
|
+
if (e instanceof C)
|
|
7044
7013
|
r = e.evaluate({ now: i }), s = i + this.nextRecomputeTime(i, t);
|
|
7045
|
-
else if (e instanceof
|
|
7014
|
+
else if (e instanceof vt || e instanceof Wt)
|
|
7046
7015
|
r = e.evaluate({ now: i }), s = e.solve();
|
|
7047
7016
|
else
|
|
7048
7017
|
throw new Error("Invalid result type");
|
|
7049
7018
|
return await this.state.lastRecomputeTime.set(i), await this.state.nextRecomputeTime.set(s), r;
|
|
7050
7019
|
}
|
|
7051
7020
|
}
|
|
7052
|
-
class
|
|
7021
|
+
class Si {
|
|
7053
7022
|
constructor(t, e, i) {
|
|
7054
7023
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = {
|
|
7055
7024
|
_current: {
|
|
@@ -7076,19 +7045,19 @@ class Pi {
|
|
|
7076
7045
|
}
|
|
7077
7046
|
// TODO now 是不是应该用 dataDeps 动态注入???这样能手动测试。改成在哪里配置?
|
|
7078
7047
|
async compute(t, e) {
|
|
7079
|
-
const i = await this.args.callback(
|
|
7048
|
+
const i = await this.args.callback(C.variable("now"), t), r = Date.now();
|
|
7080
7049
|
let s, a;
|
|
7081
|
-
if (i instanceof
|
|
7050
|
+
if (i instanceof C)
|
|
7082
7051
|
s = i.evaluate({ now: r }), a = r + this.nextRecomputeTime(r, t);
|
|
7083
|
-
else if (i instanceof
|
|
7052
|
+
else if (i instanceof vt || i instanceof Wt)
|
|
7084
7053
|
s = i.evaluate({ now: r }), a = i.solve();
|
|
7085
7054
|
else
|
|
7086
7055
|
throw new Error("Invalid result type");
|
|
7087
7056
|
return await this.state.lastRecomputeTime.set(e, r), await this.state.nextRecomputeTime.set(e, a), s;
|
|
7088
7057
|
}
|
|
7089
7058
|
}
|
|
7090
|
-
const
|
|
7091
|
-
class
|
|
7059
|
+
const Ei = [ki, Si];
|
|
7060
|
+
class Ii {
|
|
7092
7061
|
constructor(t, e, i) {
|
|
7093
7062
|
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
7063
|
throw new Error("Sum computation requires attributeQuery with at least one field");
|
|
@@ -7149,9 +7118,9 @@ class Oi {
|
|
|
7149
7118
|
return s;
|
|
7150
7119
|
}
|
|
7151
7120
|
}
|
|
7152
|
-
class
|
|
7121
|
+
class xi {
|
|
7153
7122
|
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),
|
|
7123
|
+
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
7124
|
const r = this.args.attributeQuery || [];
|
|
7156
7125
|
this.relatedAttributeQuery = this.args.attributeQuery?.filter((o) => o[0] !== f) || [];
|
|
7157
7126
|
const s = (r.find((o) => o[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -7238,8 +7207,8 @@ class Di {
|
|
|
7238
7207
|
return a;
|
|
7239
7208
|
}
|
|
7240
7209
|
}
|
|
7241
|
-
const
|
|
7242
|
-
class
|
|
7210
|
+
const Mi = [Ii, xi];
|
|
7211
|
+
class Pi {
|
|
7243
7212
|
constructor(t, e, i) {
|
|
7244
7213
|
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
7214
|
throw new Error("Average computation requires attributeQuery with at least one field");
|
|
@@ -7312,9 +7281,9 @@ class Vi {
|
|
|
7312
7281
|
return await this.state.sum.set(a), await this.state.count.set(s), s > 0 ? a / s : 0;
|
|
7313
7282
|
}
|
|
7314
7283
|
}
|
|
7315
|
-
class
|
|
7284
|
+
class Ci {
|
|
7316
7285
|
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,
|
|
7286
|
+
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
7287
|
const r = this.args.attributeQuery || [];
|
|
7319
7288
|
this.relatedAttributeQuery = r.filter((o) => o && o[0] !== f) || [];
|
|
7320
7289
|
const s = (r.find((o) => o && o[0] === f) || [])[1]?.attributeQuery;
|
|
@@ -7396,8 +7365,8 @@ class Qi {
|
|
|
7396
7365
|
return await this.state.count.set(e.record, a), a > 0 ? o / a : 0;
|
|
7397
7366
|
}
|
|
7398
7367
|
}
|
|
7399
|
-
const
|
|
7400
|
-
class
|
|
7368
|
+
const $i = [Pi, Ci];
|
|
7369
|
+
class At {
|
|
7401
7370
|
constructor(t, e, i) {
|
|
7402
7371
|
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
7372
|
if (this.computeCallback) {
|
|
@@ -7441,7 +7410,7 @@ class St {
|
|
|
7441
7410
|
}));
|
|
7442
7411
|
}
|
|
7443
7412
|
static {
|
|
7444
|
-
this.computationType =
|
|
7413
|
+
this.computationType = Bt;
|
|
7445
7414
|
}
|
|
7446
7415
|
createState() {
|
|
7447
7416
|
if (this.createStateCallback) {
|
|
@@ -7469,29 +7438,29 @@ class St {
|
|
|
7469
7438
|
return S.skip();
|
|
7470
7439
|
}
|
|
7471
7440
|
}
|
|
7472
|
-
class
|
|
7441
|
+
class Oi extends At {
|
|
7473
7442
|
static {
|
|
7474
7443
|
this.contextType = "global";
|
|
7475
7444
|
}
|
|
7476
7445
|
}
|
|
7477
|
-
class
|
|
7446
|
+
class Di extends At {
|
|
7478
7447
|
static {
|
|
7479
7448
|
this.contextType = "entity";
|
|
7480
7449
|
}
|
|
7481
7450
|
}
|
|
7482
|
-
class
|
|
7451
|
+
class Fi extends At {
|
|
7483
7452
|
static {
|
|
7484
7453
|
this.contextType = "relation";
|
|
7485
7454
|
}
|
|
7486
7455
|
}
|
|
7487
|
-
class
|
|
7456
|
+
class Vi extends At {
|
|
7488
7457
|
static {
|
|
7489
7458
|
this.contextType = "property";
|
|
7490
7459
|
}
|
|
7491
7460
|
constructor(t, e, i) {
|
|
7492
7461
|
if (e.dataDeps) {
|
|
7493
7462
|
const r = Object.keys(e.dataDeps).filter((s) => e.dataDeps[s].type === "records");
|
|
7494
|
-
|
|
7463
|
+
k(r.length === 0, `property-level custom computation dataDeps should not contain "records” type dataDeps, but got ${r.join(", ")}
|
|
7495
7464
|
If you want to use related entity/relation as dataDeps, please use "property" type dataDeps with args: { type: "property", attributeQuery: [attributeQuery] }
|
|
7496
7465
|
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
7466
|
`);
|
|
@@ -7499,13 +7468,13 @@ If you want to use aggregated data from all records in the entity/relation, you
|
|
|
7499
7468
|
super(t, e, i);
|
|
7500
7469
|
}
|
|
7501
7470
|
}
|
|
7502
|
-
const
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7471
|
+
const Qi = [
|
|
7472
|
+
Oi,
|
|
7473
|
+
Di,
|
|
7474
|
+
Fi,
|
|
7475
|
+
Vi
|
|
7507
7476
|
];
|
|
7508
|
-
class
|
|
7477
|
+
class W extends Error {
|
|
7509
7478
|
constructor(t, e = {}) {
|
|
7510
7479
|
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
7480
|
}
|
|
@@ -7518,7 +7487,7 @@ class H extends Error {
|
|
|
7518
7487
|
getErrorChain() {
|
|
7519
7488
|
const t = [this];
|
|
7520
7489
|
let e = this.causedBy;
|
|
7521
|
-
for (; e && (t.push(e), e instanceof
|
|
7490
|
+
for (; e && (t.push(e), e instanceof W); )
|
|
7522
7491
|
e = e.causedBy;
|
|
7523
7492
|
return t;
|
|
7524
7493
|
}
|
|
@@ -7622,13 +7591,13 @@ Stack trace:`, r.stack.split(`
|
|
|
7622
7591
|
return null;
|
|
7623
7592
|
}
|
|
7624
7593
|
}
|
|
7625
|
-
var $ = /* @__PURE__ */ ((u) => (u.LOW = "low", u.MEDIUM = "medium", u.HIGH = "high", u.CRITICAL = "critical", u))($ || {}),
|
|
7626
|
-
class
|
|
7594
|
+
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 || {});
|
|
7595
|
+
class F extends W {
|
|
7627
7596
|
constructor(t, e = {}) {
|
|
7628
7597
|
super(t, {
|
|
7629
7598
|
errorType: e.context?.errorType || "ComputationError",
|
|
7630
7599
|
context: {
|
|
7631
|
-
category:
|
|
7600
|
+
category: j.COMPUTATION,
|
|
7632
7601
|
handleName: e.handleName,
|
|
7633
7602
|
computationName: e.computationName,
|
|
7634
7603
|
dataContext: e.dataContext,
|
|
@@ -7639,7 +7608,7 @@ class V extends H {
|
|
|
7639
7608
|
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity || $.MEDIUM;
|
|
7640
7609
|
}
|
|
7641
7610
|
}
|
|
7642
|
-
class
|
|
7611
|
+
class ae extends F {
|
|
7643
7612
|
constructor(t, e = {}) {
|
|
7644
7613
|
super(t, {
|
|
7645
7614
|
...e,
|
|
@@ -7654,7 +7623,7 @@ class ne extends V {
|
|
|
7654
7623
|
}), this.stateKey = e.stateKey, this.stateValue = e.stateValue, this.expectedStateType = e.expectedStateType, this.actualStateType = e.actualStateType;
|
|
7655
7624
|
}
|
|
7656
7625
|
}
|
|
7657
|
-
class
|
|
7626
|
+
class H extends F {
|
|
7658
7627
|
constructor(t, e = {}) {
|
|
7659
7628
|
super(t, {
|
|
7660
7629
|
...e,
|
|
@@ -7669,12 +7638,12 @@ class U extends V {
|
|
|
7669
7638
|
}), this.depName = e.depName, this.depType = e.depType, this.missingData = e.missingData, this.invalidData = e.invalidData;
|
|
7670
7639
|
}
|
|
7671
7640
|
}
|
|
7672
|
-
class
|
|
7641
|
+
class xt extends W {
|
|
7673
7642
|
constructor(t, e = {}) {
|
|
7674
7643
|
super(t, {
|
|
7675
7644
|
errorType: e.context?.errorType || "SchedulerError",
|
|
7676
7645
|
context: {
|
|
7677
|
-
category:
|
|
7646
|
+
category: j.SYSTEM,
|
|
7678
7647
|
schedulingPhase: e.schedulingPhase,
|
|
7679
7648
|
failedComputations: e.failedComputations,
|
|
7680
7649
|
...e.context
|
|
@@ -7683,12 +7652,12 @@ class Mt extends H {
|
|
|
7683
7652
|
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity = $.HIGH;
|
|
7684
7653
|
}
|
|
7685
7654
|
}
|
|
7686
|
-
class
|
|
7655
|
+
class Li extends W {
|
|
7687
7656
|
constructor(t, e) {
|
|
7688
7657
|
super(t, {
|
|
7689
7658
|
errorType: "SideEffectError",
|
|
7690
7659
|
context: {
|
|
7691
|
-
category:
|
|
7660
|
+
category: j.SYSTEM,
|
|
7692
7661
|
sideEffectName: e.sideEffectName,
|
|
7693
7662
|
recordName: e.recordName,
|
|
7694
7663
|
mutationType: e.mutationType,
|
|
@@ -7699,12 +7668,12 @@ class Hi extends H {
|
|
|
7699
7668
|
}), this.sideEffectName = e.sideEffectName, this.recordName = e.recordName, this.mutationType = e.mutationType, this.severity = $.MEDIUM;
|
|
7700
7669
|
}
|
|
7701
7670
|
}
|
|
7702
|
-
class
|
|
7671
|
+
class U extends W {
|
|
7703
7672
|
constructor(t, e) {
|
|
7704
7673
|
super(t, {
|
|
7705
7674
|
errorType: e.context?.errorType || "ConditionError",
|
|
7706
7675
|
context: {
|
|
7707
|
-
category:
|
|
7676
|
+
category: j.PERMISSION,
|
|
7708
7677
|
checkType: e.checkType,
|
|
7709
7678
|
fieldName: e.fieldName,
|
|
7710
7679
|
payload: e.payload,
|
|
@@ -7718,7 +7687,7 @@ class D extends H {
|
|
|
7718
7687
|
* Helper factory methods for common condition error scenarios
|
|
7719
7688
|
*/
|
|
7720
7689
|
static userCheckFailed(t, e) {
|
|
7721
|
-
return new
|
|
7690
|
+
return new U("User check failed", {
|
|
7722
7691
|
checkType: "user",
|
|
7723
7692
|
evaluationError: t,
|
|
7724
7693
|
severity: $.HIGH,
|
|
@@ -7729,7 +7698,7 @@ class D extends H {
|
|
|
7729
7698
|
}
|
|
7730
7699
|
static payloadValidationFailed(t, e, i, r) {
|
|
7731
7700
|
const s = `${t} ${e}`;
|
|
7732
|
-
return new
|
|
7701
|
+
return new U(`Payload validation failed for field '${t}': ${e}`, {
|
|
7733
7702
|
checkType: "payload",
|
|
7734
7703
|
fieldName: t,
|
|
7735
7704
|
payload: i,
|
|
@@ -7740,7 +7709,7 @@ class D extends H {
|
|
|
7740
7709
|
});
|
|
7741
7710
|
}
|
|
7742
7711
|
static conditionCheckFailed(t, e) {
|
|
7743
|
-
return new
|
|
7712
|
+
return new U(`Condition check failed: ${t.data.name}`, {
|
|
7744
7713
|
checkType: "condition",
|
|
7745
7714
|
evaluationError: t,
|
|
7746
7715
|
severity: $.HIGH,
|
|
@@ -7751,7 +7720,7 @@ class D extends H {
|
|
|
7751
7720
|
}
|
|
7752
7721
|
static attributiveCheckFailed(t, e, i, r) {
|
|
7753
7722
|
const s = `${t} ${e}`;
|
|
7754
|
-
return new
|
|
7723
|
+
return new U(`Attributive check failed for field '${t}': ${e}`, {
|
|
7755
7724
|
checkType: "attributive",
|
|
7756
7725
|
fieldName: t,
|
|
7757
7726
|
payload: i,
|
|
@@ -7762,7 +7731,7 @@ class D extends H {
|
|
|
7762
7731
|
});
|
|
7763
7732
|
}
|
|
7764
7733
|
static conceptCheckFailed(t, e) {
|
|
7765
|
-
return new
|
|
7734
|
+
return new U(`Concept check failed for field '${t}'`, {
|
|
7766
7735
|
checkType: "concept",
|
|
7767
7736
|
fieldName: t,
|
|
7768
7737
|
evaluationError: e,
|
|
@@ -7772,10 +7741,10 @@ class D extends H {
|
|
|
7772
7741
|
});
|
|
7773
7742
|
}
|
|
7774
7743
|
}
|
|
7775
|
-
const
|
|
7776
|
-
class
|
|
7744
|
+
const Mt = "_ASYNC_TASK_";
|
|
7745
|
+
class qi {
|
|
7777
7746
|
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
|
|
7747
|
+
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
7748
|
const a = [];
|
|
7780
7749
|
r.forEach((o) => {
|
|
7781
7750
|
o.computation && a.push({ dataContext: { type: "global", id: o }, args: o.computation });
|
|
@@ -7795,9 +7764,9 @@ class ji {
|
|
|
7795
7764
|
});
|
|
7796
7765
|
for (const o of a) {
|
|
7797
7766
|
const n = o.dataContext, c = o.args, l = this.computationHandleMap.get(c.constructor);
|
|
7798
|
-
|
|
7767
|
+
k(!!l, `cannot find Computation handle map for ${c.constructor.displayName || c.constructor.name}`);
|
|
7799
7768
|
const d = l[n.type];
|
|
7800
|
-
|
|
7769
|
+
k(!!d, `cannot find Computation handle for ${c.constructor.displayName || c.constructor.name} with context type ${n.type}`);
|
|
7801
7770
|
const h = new d(this.controller, c, n);
|
|
7802
7771
|
if (this.computationsHandles.set(n.id, h), this.isAsyncComputation(h)) {
|
|
7803
7772
|
if (h.dataContext.type === "property") {
|
|
@@ -7817,7 +7786,7 @@ class ji {
|
|
|
7817
7786
|
type: "json"
|
|
7818
7787
|
})
|
|
7819
7788
|
]
|
|
7820
|
-
}), y =
|
|
7789
|
+
}), y = M.create({
|
|
7821
7790
|
name: `${p.name}_${h.dataContext.host.name}_${h.dataContext.id.name}`,
|
|
7822
7791
|
source: p,
|
|
7823
7792
|
target: h.dataContext.host,
|
|
@@ -7909,7 +7878,7 @@ class ji {
|
|
|
7909
7878
|
const r = this.computationHandleMap.get(i.computationType);
|
|
7910
7879
|
if (Array.isArray(i.contextType))
|
|
7911
7880
|
for (const s of i.contextType)
|
|
7912
|
-
|
|
7881
|
+
k(!r[s], `${s} for ${i.computationType.name} is already registered.`), r[s] = e;
|
|
7913
7882
|
else
|
|
7914
7883
|
r[i.contextType] = e;
|
|
7915
7884
|
}
|
|
@@ -7939,13 +7908,13 @@ class ji {
|
|
|
7939
7908
|
}
|
|
7940
7909
|
async createStateData(t, ...e) {
|
|
7941
7910
|
const i = this.computationsHandles.get(t);
|
|
7942
|
-
return
|
|
7911
|
+
return k(!!i, "cannot find computation handle"), i.createStateData?.(...e) ?? {};
|
|
7943
7912
|
}
|
|
7944
7913
|
addMutationPropertyComputationDefaultValueListeners() {
|
|
7945
7914
|
for (const t of this.computationsHandles.values())
|
|
7946
7915
|
if (t.getInitialValue && t.dataContext.type === "property") {
|
|
7947
7916
|
const e = t.dataContext;
|
|
7948
|
-
|
|
7917
|
+
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
7918
|
for (let r of i)
|
|
7950
7919
|
if (r.type === "create" && r.recordName === e.host.name) {
|
|
7951
7920
|
const s = await t.getInitialValue?.(r.record);
|
|
@@ -7984,11 +7953,11 @@ class ji {
|
|
|
7984
7953
|
return [e.oldRecord ?? e.record];
|
|
7985
7954
|
let i = [];
|
|
7986
7955
|
if (!t.isRelation)
|
|
7987
|
-
|
|
7956
|
+
k(t.type === "update", "only support update event for entity"), i = await this.controller.system.storage.find(t.sourceRecordName, m.atom({
|
|
7988
7957
|
key: t.targetPath.concat("id").join("."),
|
|
7989
7958
|
value: ["=", e.oldRecord.id]
|
|
7990
7959
|
}), void 0);
|
|
7991
|
-
else if (
|
|
7960
|
+
else if (k(t.type === "create" || t.type === "delete", "only support create/delete event for relation"), t.dataDep, t.type === "create")
|
|
7992
7961
|
i = await this.controller.system.storage.find(t.sourceRecordName, m.atom({
|
|
7993
7962
|
key: t.targetPath.concat(["&", "id"]).join("."),
|
|
7994
7963
|
value: ["=", e.record.id]
|
|
@@ -8017,7 +7986,7 @@ class ji {
|
|
|
8017
7986
|
}
|
|
8018
7987
|
async computeDataBasedDirtyRecordsAndEvents(t, e) {
|
|
8019
7988
|
let i = [];
|
|
8020
|
-
if (t.dataDep.type === "global" && e.recordName ===
|
|
7989
|
+
if (t.dataDep.type === "global" && e.recordName === L)
|
|
8021
7990
|
if (t.computation.dataContext.type === "property") {
|
|
8022
7991
|
const r = t.computation.dataContext;
|
|
8023
7992
|
i = (await this.controller.system.storage.find(r.host.name, m.atom({ key: "id", value: ["not", null] }), {}, ["*"])).map((a) => [a, {
|
|
@@ -8066,7 +8035,7 @@ class ji {
|
|
|
8066
8035
|
try {
|
|
8067
8036
|
this.isDataBasedComputation(t.computation) ? i = await this.computeDataBasedDirtyRecordsAndEvents(t, e) : i = await this.computeEventBasedDirtyRecordsAndEvents(t, e);
|
|
8068
8037
|
} catch (r) {
|
|
8069
|
-
throw new
|
|
8038
|
+
throw new F("Failed to compute dirty records and events", {
|
|
8070
8039
|
handleName: t.computation.constructor.name,
|
|
8071
8040
|
computationName: t.computation.args.constructor.displayName,
|
|
8072
8041
|
dataContext: t.computation.dataContext,
|
|
@@ -8078,7 +8047,7 @@ class ji {
|
|
|
8078
8047
|
try {
|
|
8079
8048
|
await this.runComputation(t.computation, s, r);
|
|
8080
8049
|
} catch (a) {
|
|
8081
|
-
throw new
|
|
8050
|
+
throw new F("Failed to run computation for dirty record", {
|
|
8082
8051
|
handleName: t.computation.constructor.name,
|
|
8083
8052
|
computationName: t.computation.args.constructor.displayName,
|
|
8084
8053
|
dataContext: t.computation.dataContext,
|
|
@@ -8089,7 +8058,7 @@ class ji {
|
|
|
8089
8058
|
}
|
|
8090
8059
|
}
|
|
8091
8060
|
} catch (i) {
|
|
8092
|
-
throw i instanceof
|
|
8061
|
+
throw i instanceof F ? i : new xt("Unexpected error in dirty records computation", {
|
|
8093
8062
|
schedulingPhase: "dirty-records-processing",
|
|
8094
8063
|
failedComputations: [t.computation.args.constructor.displayName],
|
|
8095
8064
|
causedBy: i instanceof Error ? i : new Error(String(i))
|
|
@@ -8099,8 +8068,8 @@ class ji {
|
|
|
8099
8068
|
getAsyncTaskRecordKey(t) {
|
|
8100
8069
|
if (t.dataContext.type === "property") {
|
|
8101
8070
|
const e = t.dataContext;
|
|
8102
|
-
return `${
|
|
8103
|
-
} else return t.dataContext.type === "global" ? `${
|
|
8071
|
+
return `${Mt}_${e.host.name}_${e.id.name}`;
|
|
8072
|
+
} else return t.dataContext.type === "global" ? `${Mt}_${t.dataContext.id.name}` : `${Mt}_${t.dataContext.type}_${t.dataContext.id?.name}`;
|
|
8104
8073
|
}
|
|
8105
8074
|
async createAsyncTask(t, e, i, r) {
|
|
8106
8075
|
if (t.dataContext.type === "property")
|
|
@@ -8152,7 +8121,7 @@ class ji {
|
|
|
8152
8121
|
try {
|
|
8153
8122
|
a = t.dataDeps ? await this.resolveDataDeps(t, i) : {};
|
|
8154
8123
|
} catch (o) {
|
|
8155
|
-
throw new
|
|
8124
|
+
throw new H("Failed to resolve computation data dependencies", {
|
|
8156
8125
|
handleName: t.constructor.name,
|
|
8157
8126
|
computationName: t.args.constructor.displayName,
|
|
8158
8127
|
dataContext: t.dataContext,
|
|
@@ -8169,7 +8138,7 @@ class ji {
|
|
|
8169
8138
|
try {
|
|
8170
8139
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8171
8140
|
} catch (n) {
|
|
8172
|
-
throw new
|
|
8141
|
+
throw new ae("Failed to retrieve last value for incremental computation", {
|
|
8173
8142
|
handleName: t.constructor.name,
|
|
8174
8143
|
computationName: t.args.constructor.displayName,
|
|
8175
8144
|
dataContext: t.dataContext,
|
|
@@ -8183,7 +8152,7 @@ class ji {
|
|
|
8183
8152
|
try {
|
|
8184
8153
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8185
8154
|
} catch (n) {
|
|
8186
|
-
throw new
|
|
8155
|
+
throw new ae("Failed to retrieve last value for incremental patch computation", {
|
|
8187
8156
|
handleName: t.constructor.name,
|
|
8188
8157
|
computationName: t.args.constructor.displayName,
|
|
8189
8158
|
dataContext: t.dataContext,
|
|
@@ -8192,16 +8161,16 @@ class ji {
|
|
|
8192
8161
|
}
|
|
8193
8162
|
s = await t.incrementalPatchCompute(o, e, i, a);
|
|
8194
8163
|
} else
|
|
8195
|
-
throw new
|
|
8164
|
+
throw new F(`Unknown computation type: ${t.constructor.name}`, {
|
|
8196
8165
|
handleName: t.constructor.name,
|
|
8197
8166
|
computationName: t.args.constructor.displayName,
|
|
8198
8167
|
dataContext: t.dataContext,
|
|
8199
8168
|
computationPhase: "type-validation"
|
|
8200
8169
|
});
|
|
8201
|
-
if (s instanceof
|
|
8170
|
+
if (s instanceof pe) {
|
|
8202
8171
|
const o = t;
|
|
8203
8172
|
if (!o.compute)
|
|
8204
|
-
throw new
|
|
8173
|
+
throw new F("compute must be defined for computation when incrementalCompute returns ComputationResultFullRecompute", {
|
|
8205
8174
|
handleName: t.constructor.name,
|
|
8206
8175
|
computationName: t.args.constructor.displayName,
|
|
8207
8176
|
dataContext: t.dataContext,
|
|
@@ -8211,7 +8180,7 @@ class ji {
|
|
|
8211
8180
|
}
|
|
8212
8181
|
}
|
|
8213
8182
|
} catch (o) {
|
|
8214
|
-
throw o instanceof
|
|
8183
|
+
throw o instanceof F ? o : new F("Computation execution failed", {
|
|
8215
8184
|
handleName: t.constructor.name,
|
|
8216
8185
|
computationName: t.args.constructor.displayName,
|
|
8217
8186
|
dataContext: t.dataContext,
|
|
@@ -8219,13 +8188,13 @@ class ji {
|
|
|
8219
8188
|
causedBy: o instanceof Error ? o : new Error(String(o))
|
|
8220
8189
|
});
|
|
8221
8190
|
}
|
|
8222
|
-
if (s instanceof
|
|
8191
|
+
if (s instanceof Nt)
|
|
8223
8192
|
return;
|
|
8224
|
-
if (s instanceof
|
|
8193
|
+
if (s instanceof fe)
|
|
8225
8194
|
try {
|
|
8226
8195
|
return await this.createAsyncTask(t, s.args, i);
|
|
8227
8196
|
} catch (o) {
|
|
8228
|
-
throw new
|
|
8197
|
+
throw new F("Failed to create async task", {
|
|
8229
8198
|
handleName: t.constructor.name,
|
|
8230
8199
|
computationName: t.args.constructor.displayName,
|
|
8231
8200
|
dataContext: t.dataContext,
|
|
@@ -8234,10 +8203,10 @@ class ji {
|
|
|
8234
8203
|
});
|
|
8235
8204
|
}
|
|
8236
8205
|
try {
|
|
8237
|
-
const o = s instanceof
|
|
8206
|
+
const o = s instanceof me ? await t.asyncReturn(s.result, s.args) : s;
|
|
8238
8207
|
t.incrementalPatchCompute ? await this.controller.applyResultPatch(t.dataContext, o, i) : await this.controller.applyResult(t.dataContext, o, i);
|
|
8239
8208
|
} catch (o) {
|
|
8240
|
-
throw new
|
|
8209
|
+
throw new F("Failed to apply computation result", {
|
|
8241
8210
|
handleName: t.constructor.name,
|
|
8242
8211
|
computationName: t.args.constructor.displayName,
|
|
8243
8212
|
dataContext: t.dataContext,
|
|
@@ -8246,7 +8215,7 @@ class ji {
|
|
|
8246
8215
|
});
|
|
8247
8216
|
}
|
|
8248
8217
|
} catch (s) {
|
|
8249
|
-
throw s instanceof
|
|
8218
|
+
throw s instanceof F ? s : new F("Unexpected error during computation execution", {
|
|
8250
8219
|
handleName: t.constructor.name,
|
|
8251
8220
|
computationName: t.args.constructor.displayName,
|
|
8252
8221
|
dataContext: t.dataContext,
|
|
@@ -8264,7 +8233,7 @@ class ji {
|
|
|
8264
8233
|
return await this.controller.system.storage.find(s.source.name, void 0, {}, s.attributeQuery);
|
|
8265
8234
|
if (s.type === "property") {
|
|
8266
8235
|
if (!e?.id)
|
|
8267
|
-
throw new
|
|
8236
|
+
throw new H("Record ID is required for property data dependency", {
|
|
8268
8237
|
depName: r,
|
|
8269
8238
|
depType: s.type,
|
|
8270
8239
|
missingData: !0,
|
|
@@ -8276,7 +8245,7 @@ class ji {
|
|
|
8276
8245
|
} else {
|
|
8277
8246
|
if (s.type === "global")
|
|
8278
8247
|
return await this.controller.system.storage.dict.get(s.source.name);
|
|
8279
|
-
throw new
|
|
8248
|
+
throw new H(`Unknown data dependency type: ${s.type}`, {
|
|
8280
8249
|
depName: r,
|
|
8281
8250
|
depType: s.type,
|
|
8282
8251
|
invalidData: !0,
|
|
@@ -8286,7 +8255,7 @@ class ji {
|
|
|
8286
8255
|
});
|
|
8287
8256
|
}
|
|
8288
8257
|
} catch (a) {
|
|
8289
|
-
throw a instanceof
|
|
8258
|
+
throw a instanceof H ? a : new H(`Failed to resolve data dependency '${r}'`, {
|
|
8290
8259
|
depName: r,
|
|
8291
8260
|
depType: s.type,
|
|
8292
8261
|
handleName: t.constructor.name,
|
|
@@ -8298,7 +8267,7 @@ class ji {
|
|
|
8298
8267
|
}));
|
|
8299
8268
|
return Object.fromEntries(Object.entries(t.dataDeps).map(([r], s) => [r, i[s]]));
|
|
8300
8269
|
} catch (i) {
|
|
8301
|
-
throw i instanceof
|
|
8270
|
+
throw i instanceof H ? i : new H("Failed to resolve computation data dependencies", {
|
|
8302
8271
|
handleName: t.constructor.name,
|
|
8303
8272
|
computationName: t.args.constructor.displayName,
|
|
8304
8273
|
dataContext: t.dataContext,
|
|
@@ -8317,39 +8286,39 @@ class ji {
|
|
|
8317
8286
|
try {
|
|
8318
8287
|
this.addMutationPropertyComputationDefaultValueListeners(), this.addMutationComputationListeners(), t && (await this.setupGlobalBoundStateDefaultValues(), await this.setupGlobalComputationDefaultValue(), await this.setupDictDefaultValue());
|
|
8319
8288
|
} catch (e) {
|
|
8320
|
-
throw e instanceof
|
|
8289
|
+
throw e instanceof xt ? e : new xt("Unexpected error during scheduler setup", {
|
|
8321
8290
|
schedulingPhase: "top-level-setup",
|
|
8322
8291
|
causedBy: e instanceof Error ? e : new Error(String(e))
|
|
8323
8292
|
});
|
|
8324
8293
|
}
|
|
8325
8294
|
}
|
|
8326
8295
|
}
|
|
8327
|
-
const
|
|
8328
|
-
function
|
|
8329
|
-
return
|
|
8296
|
+
const Jt = new ne();
|
|
8297
|
+
function Bi() {
|
|
8298
|
+
return Jt.getStore()?.effects;
|
|
8330
8299
|
}
|
|
8331
|
-
function
|
|
8332
|
-
const t =
|
|
8300
|
+
function oe(u) {
|
|
8301
|
+
const t = Jt.getStore();
|
|
8333
8302
|
t?.effects && t.effects.push(...u);
|
|
8334
8303
|
}
|
|
8335
|
-
const
|
|
8336
|
-
class
|
|
8304
|
+
const Sr = "User";
|
|
8305
|
+
class ge {
|
|
8337
8306
|
constructor(t) {
|
|
8338
8307
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
8339
8308
|
}
|
|
8340
8309
|
static create(t) {
|
|
8341
|
-
return new
|
|
8310
|
+
return new ge(t);
|
|
8342
8311
|
}
|
|
8343
8312
|
}
|
|
8344
|
-
const
|
|
8313
|
+
const $t = "_isDeleted_", Er = {
|
|
8345
8314
|
create() {
|
|
8346
8315
|
return N.create({
|
|
8347
|
-
name:
|
|
8316
|
+
name: $t,
|
|
8348
8317
|
type: "boolean"
|
|
8349
8318
|
});
|
|
8350
8319
|
}
|
|
8351
8320
|
};
|
|
8352
|
-
class
|
|
8321
|
+
class Ir {
|
|
8353
8322
|
constructor(t) {
|
|
8354
8323
|
this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
|
|
8355
8324
|
BoolExp: R,
|
|
@@ -8373,19 +8342,19 @@ class Pr {
|
|
|
8373
8342
|
for (const p of this.eventSources)
|
|
8374
8343
|
p.entity && p.entity.name && !d.has(p.entity.name) && (this.entities.push(p.entity), d.add(p.entity.name));
|
|
8375
8344
|
const h = [
|
|
8376
|
-
...Ii,
|
|
8377
|
-
...xi,
|
|
8378
|
-
...Ai,
|
|
8379
8345
|
...vi,
|
|
8346
|
+
...Ai,
|
|
8380
8347
|
...Ri,
|
|
8381
|
-
...Fi,
|
|
8382
|
-
...Li,
|
|
8383
|
-
...$i,
|
|
8384
8348
|
...yi,
|
|
8385
|
-
...
|
|
8349
|
+
...pi,
|
|
8350
|
+
...Mi,
|
|
8351
|
+
...$i,
|
|
8352
|
+
...Ei,
|
|
8353
|
+
...ui,
|
|
8354
|
+
...Qi,
|
|
8386
8355
|
...n
|
|
8387
8356
|
];
|
|
8388
|
-
this.scheduler = new
|
|
8357
|
+
this.scheduler = new qi(this, this.entities, this.relations, this.dict, h), o.forEach((p) => {
|
|
8389
8358
|
let y = this.recordNameToSideEffects.get(p.record.name);
|
|
8390
8359
|
y || this.recordNameToSideEffects.set(p.record.name, y = /* @__PURE__ */ new Set()), y.add(p);
|
|
8391
8360
|
});
|
|
@@ -8405,7 +8374,7 @@ class Pr {
|
|
|
8405
8374
|
}
|
|
8406
8375
|
}
|
|
8407
8376
|
async applyResult(t, e, i) {
|
|
8408
|
-
if (!(e instanceof
|
|
8377
|
+
if (!(e instanceof Nt)) {
|
|
8409
8378
|
if (t.type === "global")
|
|
8410
8379
|
return this.system.storage.dict.set(t.id.name, e);
|
|
8411
8380
|
if (t.type === "entity") {
|
|
@@ -8424,17 +8393,17 @@ class Pr {
|
|
|
8424
8393
|
await this.system.storage.create(r.id.name, a);
|
|
8425
8394
|
} else {
|
|
8426
8395
|
const r = t;
|
|
8427
|
-
r.id.name ===
|
|
8396
|
+
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
8397
|
}
|
|
8429
8398
|
}
|
|
8430
8399
|
}
|
|
8431
8400
|
async applyResultPatch(t, e, i) {
|
|
8432
|
-
if (e instanceof
|
|
8401
|
+
if (e instanceof Nt || e === void 0) return;
|
|
8433
8402
|
const r = Array.isArray(e) ? e : [e];
|
|
8434
|
-
for (const s of r)
|
|
8403
|
+
for (const s of r)
|
|
8435
8404
|
if (t.type === "global")
|
|
8436
|
-
|
|
8437
|
-
if (t.type === "entity" || t.type === "relation") {
|
|
8405
|
+
await this.system.storage.dict.set(t.id.name, s);
|
|
8406
|
+
else if (t.type === "entity" || t.type === "relation") {
|
|
8438
8407
|
const a = t;
|
|
8439
8408
|
if (s.type === "insert")
|
|
8440
8409
|
await this.system.storage.create(a.id.name, s.data);
|
|
@@ -8447,9 +8416,8 @@ class Pr {
|
|
|
8447
8416
|
}
|
|
8448
8417
|
} else {
|
|
8449
8418
|
const a = t;
|
|
8450
|
-
a.id.name ===
|
|
8419
|
+
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
8420
|
}
|
|
8452
|
-
}
|
|
8453
8421
|
}
|
|
8454
8422
|
/**
|
|
8455
8423
|
* Unified dispatch API for all event source types.
|
|
@@ -8457,7 +8425,7 @@ class Pr {
|
|
|
8457
8425
|
*/
|
|
8458
8426
|
async dispatch(t, e) {
|
|
8459
8427
|
const i = { effects: [] };
|
|
8460
|
-
return
|
|
8428
|
+
return Jt.run(i, async () => {
|
|
8461
8429
|
await this.system.storage.beginTransaction(t.name);
|
|
8462
8430
|
let r;
|
|
8463
8431
|
try {
|
|
@@ -8494,7 +8462,7 @@ class Pr {
|
|
|
8494
8462
|
result: await a.content.call(this, r)
|
|
8495
8463
|
};
|
|
8496
8464
|
} catch (o) {
|
|
8497
|
-
const n = new
|
|
8465
|
+
const n = new Li(
|
|
8498
8466
|
`Side effect '${a.name}' failed for ${r.type} on ${r.recordName}`,
|
|
8499
8467
|
{
|
|
8500
8468
|
sideEffectName: a.name,
|
|
@@ -8518,55 +8486,56 @@ class Pr {
|
|
|
8518
8486
|
addEventListener(t, e) {
|
|
8519
8487
|
this.callbacks.has(t) || this.callbacks.set(t, /* @__PURE__ */ new Set()), this.callbacks.get(t).add(e);
|
|
8520
8488
|
}
|
|
8489
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8521
8490
|
findEventSourceByName(t) {
|
|
8522
8491
|
return this.eventSourcesByName.get(t);
|
|
8523
8492
|
}
|
|
8524
8493
|
}
|
|
8525
|
-
function
|
|
8494
|
+
function _i(u) {
|
|
8526
8495
|
return encodeURI(JSON.stringify(u));
|
|
8527
8496
|
}
|
|
8528
|
-
function
|
|
8497
|
+
function Wi(u) {
|
|
8529
8498
|
return u === void 0 ? void 0 : JSON.parse(decodeURI(u));
|
|
8530
8499
|
}
|
|
8531
|
-
class
|
|
8500
|
+
class Ji {
|
|
8532
8501
|
constructor(t) {
|
|
8533
8502
|
this.db = t, this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
|
|
8534
8503
|
get: async (e) => {
|
|
8535
8504
|
const i = m.atom({ key: "key", value: ["=", e] });
|
|
8536
|
-
return (await this.queryHandle.findOne(
|
|
8505
|
+
return (await this.queryHandle.findOne(L, i, void 0, ["value"]))?.value?.raw;
|
|
8537
8506
|
},
|
|
8538
8507
|
set: async (e, i) => {
|
|
8539
|
-
const r = m.atom({ key: "key", value: ["=", e] }), s = await this.queryHandle.findOne(
|
|
8540
|
-
|
|
8508
|
+
const r = m.atom({ key: "key", value: ["=", e] }), s = await this.queryHandle.findOne(L, r, void 0, ["value"]);
|
|
8509
|
+
s ? await this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [L, m.atom({ key: "id", value: ["=", s.id] }), { key: e, value: { raw: i } }], []) : await this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [L, { key: e, value: { raw: i } }], []);
|
|
8541
8510
|
}
|
|
8542
8511
|
};
|
|
8543
8512
|
}
|
|
8544
|
-
beginTransaction(t = "") {
|
|
8545
|
-
|
|
8513
|
+
async beginTransaction(t = "") {
|
|
8514
|
+
await (this.db.beginTransaction ? this.db.beginTransaction(t) : this.db.scheme("BEGIN", t));
|
|
8546
8515
|
}
|
|
8547
|
-
commitTransaction(t = "") {
|
|
8548
|
-
|
|
8516
|
+
async commitTransaction(t = "") {
|
|
8517
|
+
await (this.db.commitTransaction ? this.db.commitTransaction(t) : this.db.scheme("COMMIT", t));
|
|
8549
8518
|
}
|
|
8550
|
-
rollbackTransaction(t = "") {
|
|
8551
|
-
|
|
8519
|
+
async rollbackTransaction(t = "") {
|
|
8520
|
+
await (this.db.rollbackTransaction ? this.db.rollbackTransaction(t) : this.db.scheme("ROLLBACK", t));
|
|
8552
8521
|
}
|
|
8553
8522
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
8554
8523
|
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 :
|
|
8524
|
+
const r = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(Z, r, void 0, ["value"]))?.value;
|
|
8525
|
+
return s === void 0 ? i : Wi(s);
|
|
8557
8526
|
}
|
|
8558
8527
|
async set(t, e, i, r) {
|
|
8559
8528
|
const s = m.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
8560
|
-
return await this.queryHandle.findOne(
|
|
8529
|
+
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
8530
|
}
|
|
8562
8531
|
async setup(t, e, i = !1) {
|
|
8563
8532
|
await this.db.open(i);
|
|
8564
|
-
const r = new
|
|
8533
|
+
const r = new si(
|
|
8565
8534
|
t,
|
|
8566
8535
|
e,
|
|
8567
8536
|
this.db
|
|
8568
8537
|
);
|
|
8569
|
-
i && await r.createTables(), this.queryHandle = new
|
|
8538
|
+
i && await r.createTables(), this.queryHandle = new We(new Je(r.map, r.aliasManager), this.db), this.map = r.map;
|
|
8570
8539
|
}
|
|
8571
8540
|
findOne(...t) {
|
|
8572
8541
|
return this.queryHandle.findOne(...t);
|
|
@@ -8586,8 +8555,8 @@ class Xi {
|
|
|
8586
8555
|
async callWithEvents(t, e, i = []) {
|
|
8587
8556
|
const r = [], s = await t(...e, r), a = await this.dispatch(r);
|
|
8588
8557
|
i.push(...r, ...a);
|
|
8589
|
-
const o =
|
|
8590
|
-
return o && r.length > 0 &&
|
|
8558
|
+
const o = Bi();
|
|
8559
|
+
return o && r.length > 0 && oe(r), o && a.length > 0 && oe(a), s;
|
|
8591
8560
|
}
|
|
8592
8561
|
findRelationByName(...t) {
|
|
8593
8562
|
return this.queryHandle.findRelationByName(...t);
|
|
@@ -8625,8 +8594,8 @@ class Xi {
|
|
|
8625
8594
|
return this.db.close();
|
|
8626
8595
|
}
|
|
8627
8596
|
}
|
|
8628
|
-
var
|
|
8629
|
-
class
|
|
8597
|
+
var Hi = /* @__PURE__ */ ((u) => (u[u.ERROR = 0] = "ERROR", u[u.INFO = 1] = "INFO", u))(Hi || {});
|
|
8598
|
+
class Ht {
|
|
8630
8599
|
constructor(t = 0) {
|
|
8631
8600
|
this.level = t;
|
|
8632
8601
|
}
|
|
@@ -8637,11 +8606,11 @@ class Ut {
|
|
|
8637
8606
|
this.level >= 0 && console.error({ type: t, name: e, sql: i, params: r, error: s });
|
|
8638
8607
|
}
|
|
8639
8608
|
child() {
|
|
8640
|
-
return new
|
|
8609
|
+
return new Ht(this.level);
|
|
8641
8610
|
}
|
|
8642
8611
|
}
|
|
8643
|
-
var
|
|
8644
|
-
class
|
|
8612
|
+
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 || {});
|
|
8613
|
+
class jt {
|
|
8645
8614
|
constructor(t = 0) {
|
|
8646
8615
|
this.level = t;
|
|
8647
8616
|
}
|
|
@@ -8655,17 +8624,17 @@ class Gt {
|
|
|
8655
8624
|
this.level >= 2 && console.debug(`[DEBUG] ${t}: ${e}`, i);
|
|
8656
8625
|
}
|
|
8657
8626
|
child(t) {
|
|
8658
|
-
return new
|
|
8627
|
+
return new jt(this.level);
|
|
8659
8628
|
}
|
|
8660
8629
|
}
|
|
8661
|
-
const
|
|
8662
|
-
class
|
|
8663
|
-
constructor(t, e =
|
|
8664
|
-
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new
|
|
8630
|
+
const xr = new Ht(), Ui = new jt();
|
|
8631
|
+
class Mr {
|
|
8632
|
+
constructor(t, e = Ui) {
|
|
8633
|
+
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new Ji(t);
|
|
8665
8634
|
}
|
|
8666
|
-
setup(t, e, i, r = !1) {
|
|
8667
|
-
const s = new
|
|
8668
|
-
|
|
8635
|
+
async setup(t, e, i, r = !1) {
|
|
8636
|
+
const s = new de(t, e), { entities: a, relations: o } = s.getAll();
|
|
8637
|
+
i.forEach(({ dataContext: n, state: c }) => {
|
|
8669
8638
|
Object.entries(c).forEach(([l, d]) => {
|
|
8670
8639
|
if (d instanceof E) {
|
|
8671
8640
|
if (!d.record)
|
|
@@ -8689,18 +8658,18 @@ class Or {
|
|
|
8689
8658
|
}
|
|
8690
8659
|
}
|
|
8691
8660
|
});
|
|
8692
|
-
}), this.storage.setup(
|
|
8693
|
-
[...a,
|
|
8661
|
+
}), await this.storage.setup(
|
|
8662
|
+
[...a, oi, ai],
|
|
8694
8663
|
o,
|
|
8695
8664
|
r
|
|
8696
8665
|
);
|
|
8697
8666
|
}
|
|
8698
|
-
destroy() {
|
|
8699
|
-
this.storage.destroy();
|
|
8667
|
+
async destroy() {
|
|
8668
|
+
await this.storage.destroy();
|
|
8700
8669
|
}
|
|
8701
8670
|
}
|
|
8702
|
-
const
|
|
8703
|
-
class
|
|
8671
|
+
const Pr = new ne();
|
|
8672
|
+
class kt {
|
|
8704
8673
|
constructor(t, e) {
|
|
8705
8674
|
this._type = "Action", this._options = e, this.uuid = T(e), this.name = t.name;
|
|
8706
8675
|
}
|
|
@@ -8722,7 +8691,7 @@ class Et {
|
|
|
8722
8691
|
};
|
|
8723
8692
|
}
|
|
8724
8693
|
static create(t, e) {
|
|
8725
|
-
const i = new
|
|
8694
|
+
const i = new kt(t, e);
|
|
8726
8695
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8727
8696
|
throw new Error(`duplicate uuid in options ${i.uuid}, Action`);
|
|
8728
8697
|
return this.instances.push(i), i;
|
|
@@ -8754,8 +8723,8 @@ class Et {
|
|
|
8754
8723
|
return this.create(e.public, e.options);
|
|
8755
8724
|
}
|
|
8756
8725
|
}
|
|
8757
|
-
const
|
|
8758
|
-
function
|
|
8726
|
+
const Gi = kt.create({ name: "get" });
|
|
8727
|
+
function Ot(u) {
|
|
8759
8728
|
if (!u) return;
|
|
8760
8729
|
if (u.raw.type === "atom")
|
|
8761
8730
|
return ft.create({
|
|
@@ -8766,13 +8735,13 @@ function Dt(u) {
|
|
|
8766
8735
|
return mt.create({
|
|
8767
8736
|
type: "expression",
|
|
8768
8737
|
operator: t.operator,
|
|
8769
|
-
left:
|
|
8770
|
-
right:
|
|
8738
|
+
left: Ot(u.left),
|
|
8739
|
+
right: Ot(u.right)
|
|
8771
8740
|
});
|
|
8772
8741
|
}
|
|
8773
|
-
class
|
|
8742
|
+
class St {
|
|
8774
8743
|
constructor(t, e) {
|
|
8775
|
-
this._type = "Conditions", this._options = e, this.uuid = T(e), t.content && t.content instanceof R ? this.content =
|
|
8744
|
+
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
8745
|
}
|
|
8777
8746
|
static {
|
|
8778
8747
|
this.isKlass = !0;
|
|
@@ -8793,7 +8762,7 @@ class bt {
|
|
|
8793
8762
|
};
|
|
8794
8763
|
}
|
|
8795
8764
|
static create(t, e) {
|
|
8796
|
-
const i = new
|
|
8765
|
+
const i = new St(t, e);
|
|
8797
8766
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8798
8767
|
throw new Error(`duplicate uuid in options ${i.uuid}, Conditions`);
|
|
8799
8768
|
return this.instances.push(i), i;
|
|
@@ -8824,7 +8793,7 @@ class bt {
|
|
|
8824
8793
|
return this.create(e.public, e.options);
|
|
8825
8794
|
}
|
|
8826
8795
|
}
|
|
8827
|
-
class
|
|
8796
|
+
class z {
|
|
8828
8797
|
constructor(t, e) {
|
|
8829
8798
|
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
8799
|
}
|
|
@@ -8856,7 +8825,7 @@ class K {
|
|
|
8856
8825
|
};
|
|
8857
8826
|
}
|
|
8858
8827
|
static create(t, e) {
|
|
8859
|
-
const i = new
|
|
8828
|
+
const i = new z(t, e);
|
|
8860
8829
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8861
8830
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributive`);
|
|
8862
8831
|
return this.instances.push(i), i;
|
|
@@ -8888,11 +8857,11 @@ class K {
|
|
|
8888
8857
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
8889
8858
|
}
|
|
8890
8859
|
static parse(t) {
|
|
8891
|
-
const e = JSON.parse(t), i = e.public;
|
|
8892
|
-
return
|
|
8860
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
8861
|
+
return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
|
|
8893
8862
|
}
|
|
8894
8863
|
}
|
|
8895
|
-
class
|
|
8864
|
+
class bt {
|
|
8896
8865
|
constructor(t, e) {
|
|
8897
8866
|
this._type = "Attributives", this._options = e, this.uuid = T(e), this.content = t.content;
|
|
8898
8867
|
}
|
|
@@ -8915,7 +8884,7 @@ class Rt {
|
|
|
8915
8884
|
};
|
|
8916
8885
|
}
|
|
8917
8886
|
static create(t, e) {
|
|
8918
|
-
const i = new
|
|
8887
|
+
const i = new bt(t, e);
|
|
8919
8888
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
8920
8889
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributives`);
|
|
8921
8890
|
return this.instances.push(i), i;
|
|
@@ -8946,7 +8915,7 @@ class Rt {
|
|
|
8946
8915
|
return this.create(e.public, e.options);
|
|
8947
8916
|
}
|
|
8948
8917
|
}
|
|
8949
|
-
function
|
|
8918
|
+
function Dt(u) {
|
|
8950
8919
|
if (!u) return;
|
|
8951
8920
|
if (u.raw.type === "atom")
|
|
8952
8921
|
return ft.create({
|
|
@@ -8957,26 +8926,27 @@ function Ft(u) {
|
|
|
8957
8926
|
return mt.create({
|
|
8958
8927
|
type: "expression",
|
|
8959
8928
|
operator: t.operator,
|
|
8960
|
-
left:
|
|
8961
|
-
right:
|
|
8929
|
+
left: Dt(u.left),
|
|
8930
|
+
right: Dt(u.right)
|
|
8962
8931
|
});
|
|
8963
8932
|
}
|
|
8964
|
-
function
|
|
8965
|
-
return
|
|
8966
|
-
content:
|
|
8933
|
+
function Cr(u) {
|
|
8934
|
+
return bt.create({
|
|
8935
|
+
content: Dt(u)
|
|
8967
8936
|
});
|
|
8968
8937
|
}
|
|
8969
|
-
const
|
|
8970
|
-
name:
|
|
8938
|
+
const Ki = "_Interaction_", Ut = I.create({
|
|
8939
|
+
name: Ki,
|
|
8971
8940
|
properties: [
|
|
8972
8941
|
N.create({ name: "interactionId", type: "string", collection: !1 }),
|
|
8973
8942
|
N.create({ name: "interactionName", type: "string", collection: !1 }),
|
|
8974
8943
|
N.create({ name: "payload", type: "object", collection: !1 }),
|
|
8975
8944
|
N.create({ name: "user", type: "object", collection: !1 }),
|
|
8976
|
-
N.create({ name: "query", type: "object", collection: !1 })
|
|
8945
|
+
N.create({ name: "query", type: "object", collection: !1 }),
|
|
8946
|
+
N.create({ name: "context", type: "object", collection: !1 })
|
|
8977
8947
|
]
|
|
8978
8948
|
});
|
|
8979
|
-
class
|
|
8949
|
+
class Gt {
|
|
8980
8950
|
constructor(t, e) {
|
|
8981
8951
|
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
8952
|
}
|
|
@@ -9032,10 +9002,10 @@ class Xt {
|
|
|
9032
9002
|
};
|
|
9033
9003
|
}
|
|
9034
9004
|
static create(t, e) {
|
|
9035
|
-
const i = new
|
|
9005
|
+
const i = new Gt(t, e);
|
|
9036
9006
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9037
9007
|
throw new Error(`duplicate uuid in options ${i.uuid}, Interaction`);
|
|
9038
|
-
return i.entity =
|
|
9008
|
+
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
9009
|
}
|
|
9040
9010
|
static stringify(t) {
|
|
9041
9011
|
const e = {
|
|
@@ -9069,33 +9039,34 @@ class Xt {
|
|
|
9069
9039
|
return this.create(e.public, e.options);
|
|
9070
9040
|
}
|
|
9071
9041
|
}
|
|
9072
|
-
class
|
|
9042
|
+
class q extends Error {
|
|
9073
9043
|
constructor(t, e) {
|
|
9074
9044
|
super(t), this.name = "InteractionGuardError", this.type = e.type, this.checkType = e.checkType, this.error = e.error;
|
|
9075
9045
|
}
|
|
9076
9046
|
}
|
|
9077
|
-
function
|
|
9047
|
+
function Xi(u) {
|
|
9078
9048
|
return async function(t) {
|
|
9079
|
-
await
|
|
9049
|
+
await be(this, u, t), await tr(this, u, t), await Re(this, u, t);
|
|
9080
9050
|
};
|
|
9081
9051
|
}
|
|
9082
|
-
function
|
|
9052
|
+
function zi(u) {
|
|
9083
9053
|
return (t) => ({
|
|
9084
9054
|
interactionName: u.name,
|
|
9085
9055
|
interactionId: u.uuid,
|
|
9086
9056
|
user: t.user,
|
|
9087
9057
|
query: t.query || {},
|
|
9088
|
-
payload: t.payload || {}
|
|
9058
|
+
payload: t.payload || {},
|
|
9059
|
+
context: t.context || {}
|
|
9089
9060
|
});
|
|
9090
9061
|
}
|
|
9091
|
-
function
|
|
9062
|
+
function Yi(u) {
|
|
9092
9063
|
return async function(t) {
|
|
9093
|
-
return
|
|
9064
|
+
return er(this, u, t);
|
|
9094
9065
|
};
|
|
9095
9066
|
}
|
|
9096
|
-
async function
|
|
9067
|
+
async function be(u, t, e) {
|
|
9097
9068
|
if (!t.conditions) return;
|
|
9098
|
-
const i =
|
|
9069
|
+
const i = St.is(t.conditions) ? new R(t.conditions.content) : R.atom(t.conditions), r = async (a) => {
|
|
9099
9070
|
if (!a) return !0;
|
|
9100
9071
|
if (a.content) {
|
|
9101
9072
|
let o;
|
|
@@ -9110,13 +9081,13 @@ async function rr(u, t, e) {
|
|
|
9110
9081
|
return !0;
|
|
9111
9082
|
}, s = await i.evaluateAsync(r);
|
|
9112
9083
|
if (s !== !0)
|
|
9113
|
-
throw new
|
|
9084
|
+
throw new q(`Condition check failed: ${s?.data?.name}`, {
|
|
9114
9085
|
type: "condition check failed",
|
|
9115
9086
|
checkType: "condition",
|
|
9116
9087
|
error: s
|
|
9117
9088
|
});
|
|
9118
9089
|
}
|
|
9119
|
-
async function
|
|
9090
|
+
async function Zi(u, t, e, i) {
|
|
9120
9091
|
if (t.content) {
|
|
9121
9092
|
let r;
|
|
9122
9093
|
try {
|
|
@@ -9128,87 +9099,87 @@ async function sr(u, t, e, i) {
|
|
|
9128
9099
|
}
|
|
9129
9100
|
return !0;
|
|
9130
9101
|
}
|
|
9131
|
-
async function
|
|
9102
|
+
async function tr(u, t, e) {
|
|
9132
9103
|
if (!t.userAttributives) return;
|
|
9133
|
-
const i =
|
|
9104
|
+
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
9105
|
if (s !== !0)
|
|
9135
|
-
throw new
|
|
9106
|
+
throw new q("User check failed", {
|
|
9136
9107
|
type: "check user failed",
|
|
9137
9108
|
checkType: "user",
|
|
9138
9109
|
error: s
|
|
9139
9110
|
});
|
|
9140
9111
|
}
|
|
9141
|
-
async function
|
|
9112
|
+
async function Re(u, t, e) {
|
|
9142
9113
|
const i = e.payload || {}, r = t.payload?.items || [], s = Object.keys(i);
|
|
9143
9114
|
for (const a of s)
|
|
9144
9115
|
if (!r.some((o) => o.name === a))
|
|
9145
|
-
throw new
|
|
9116
|
+
throw new q(
|
|
9146
9117
|
`${a} in payload is not defined in interaction ${t.name}`,
|
|
9147
9118
|
{ type: `${a} not defined`, checkType: "payload" }
|
|
9148
9119
|
);
|
|
9149
9120
|
for (const a of r) {
|
|
9150
9121
|
if (a.required && !(a.name in i))
|
|
9151
|
-
throw new
|
|
9122
|
+
throw new q(
|
|
9152
9123
|
`Payload validation failed for field '${a.name}': missing`,
|
|
9153
9124
|
{ type: `${a.name} missing`, checkType: "payload" }
|
|
9154
9125
|
);
|
|
9155
9126
|
const o = i[a.name];
|
|
9156
9127
|
if (o === void 0) return;
|
|
9157
9128
|
if (a.isCollection && !Array.isArray(o))
|
|
9158
|
-
throw new
|
|
9129
|
+
throw new q(
|
|
9159
9130
|
`Payload validation failed for field '${a.name}': data is not array`,
|
|
9160
9131
|
{ type: `${a.name} data is not array`, checkType: "payload" }
|
|
9161
9132
|
);
|
|
9162
9133
|
if (a.isCollection) {
|
|
9163
9134
|
if (a.isRef && !o.every((n) => !!n.id))
|
|
9164
|
-
throw new
|
|
9135
|
+
throw new q(
|
|
9165
9136
|
`Payload validation failed for field '${a.name}': data not every is ref`,
|
|
9166
9137
|
{ type: `${a.name} data not every is ref`, checkType: "payload" }
|
|
9167
9138
|
);
|
|
9168
9139
|
} else if (a.isRef && !o.id)
|
|
9169
|
-
throw new
|
|
9140
|
+
throw new q(
|
|
9170
9141
|
`Payload validation failed for field '${a.name}': data is not a ref`,
|
|
9171
9142
|
{ type: `${a.name} data is not a ref`, checkType: "payload" }
|
|
9172
9143
|
);
|
|
9173
9144
|
if (a.base)
|
|
9174
9145
|
if (a.isCollection)
|
|
9175
9146
|
for (const n of o) {
|
|
9176
|
-
const c = await
|
|
9147
|
+
const c = await tt(n, a.base);
|
|
9177
9148
|
if (c !== !0)
|
|
9178
|
-
throw new
|
|
9149
|
+
throw new q(
|
|
9179
9150
|
`Concept check failed for field '${a.name}'`,
|
|
9180
9151
|
{ type: `${a.name} check concept failed`, checkType: "concept", error: c }
|
|
9181
9152
|
);
|
|
9182
9153
|
}
|
|
9183
9154
|
else {
|
|
9184
|
-
const n = await
|
|
9155
|
+
const n = await tt(o, a.base);
|
|
9185
9156
|
if (n !== !0)
|
|
9186
|
-
throw new
|
|
9157
|
+
throw new q(
|
|
9187
9158
|
`Concept check failed for field '${a.name}'`,
|
|
9188
9159
|
{ type: `${a.name} check concept failed`, checkType: "concept", error: n }
|
|
9189
9160
|
);
|
|
9190
9161
|
}
|
|
9191
9162
|
}
|
|
9192
9163
|
}
|
|
9193
|
-
async function
|
|
9164
|
+
async function tt(u, t) {
|
|
9194
9165
|
if (t.base) {
|
|
9195
9166
|
const e = t;
|
|
9196
|
-
return e.attributive,
|
|
9167
|
+
return e.attributive, tt(u, e.base);
|
|
9197
9168
|
}
|
|
9198
9169
|
if (t.for) {
|
|
9199
9170
|
for (const e of t.for)
|
|
9200
|
-
if (await
|
|
9201
|
-
return { name: t.name, type: "conceptAlias", error: "no match" };
|
|
9171
|
+
if (await tt(u, e) === !0) return !0;
|
|
9172
|
+
return { name: t.name || "", type: "conceptAlias", error: "no match" };
|
|
9202
9173
|
}
|
|
9203
|
-
return
|
|
9174
|
+
return z.is(t) ? !0 : I.is(t) ? u && typeof u == "object" ? !0 : { name: t.name || "", type: "conceptCheck", error: "invalid entity data" } : !0;
|
|
9204
9175
|
}
|
|
9205
|
-
async function
|
|
9206
|
-
if (I.is(t.data) ||
|
|
9176
|
+
async function er(u, t, e) {
|
|
9177
|
+
if (I.is(t.data) || M.is(t.data)) {
|
|
9207
9178
|
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
9179
|
return u.system.storage.find(i, c, a, o);
|
|
9209
9180
|
}
|
|
9210
9181
|
}
|
|
9211
|
-
class
|
|
9182
|
+
class Kt {
|
|
9212
9183
|
constructor(t, e) {
|
|
9213
9184
|
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
9185
|
}
|
|
@@ -9256,7 +9227,7 @@ class zt {
|
|
|
9256
9227
|
};
|
|
9257
9228
|
}
|
|
9258
9229
|
static create(t, e) {
|
|
9259
|
-
const i = new
|
|
9230
|
+
const i = new Kt(t, e);
|
|
9260
9231
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9261
9232
|
throw new Error(`duplicate uuid in options ${i.uuid}, Activity`);
|
|
9262
9233
|
return this.instances.push(i), i;
|
|
@@ -9357,7 +9328,7 @@ class st {
|
|
|
9357
9328
|
return this.create(e.public, e.options);
|
|
9358
9329
|
}
|
|
9359
9330
|
}
|
|
9360
|
-
class
|
|
9331
|
+
class we {
|
|
9361
9332
|
constructor(t, e) {
|
|
9362
9333
|
this._type = "Transfer", this._options = e, this.uuid = T(e), this.name = t.name, this.source = t.source, this.target = t.target;
|
|
9363
9334
|
}
|
|
@@ -9390,7 +9361,7 @@ class Te {
|
|
|
9390
9361
|
};
|
|
9391
9362
|
}
|
|
9392
9363
|
static create(t, e) {
|
|
9393
|
-
const i = new
|
|
9364
|
+
const i = new we(t, e);
|
|
9394
9365
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9395
9366
|
throw new Error(`duplicate uuid in options ${i.uuid}, Transfer`);
|
|
9396
9367
|
return this.instances.push(i), i;
|
|
@@ -9426,19 +9397,19 @@ class Te {
|
|
|
9426
9397
|
return this.create(e.public, e.options);
|
|
9427
9398
|
}
|
|
9428
9399
|
}
|
|
9429
|
-
function
|
|
9400
|
+
function Ne(u, t, e) {
|
|
9430
9401
|
u.interactions.forEach((i) => t(i, e)), u.groups.forEach((i) => {
|
|
9431
|
-
i.activities?.forEach((r) =>
|
|
9402
|
+
i.activities?.forEach((r) => Ne(r, t, i));
|
|
9432
9403
|
});
|
|
9433
9404
|
}
|
|
9434
|
-
function
|
|
9405
|
+
function $r(u) {
|
|
9435
9406
|
const t = [];
|
|
9436
|
-
return
|
|
9407
|
+
return Ne(u, (e) => t.push(e)), t;
|
|
9437
9408
|
}
|
|
9438
|
-
function
|
|
9409
|
+
function Or(u) {
|
|
9439
9410
|
return null;
|
|
9440
9411
|
}
|
|
9441
|
-
class
|
|
9412
|
+
class Xt {
|
|
9442
9413
|
constructor(t, e) {
|
|
9443
9414
|
this._type = "Condition", this._options = e, this.uuid = T(e), this.content = t.content, this.name = t.name;
|
|
9444
9415
|
}
|
|
@@ -9464,7 +9435,7 @@ class Yt {
|
|
|
9464
9435
|
};
|
|
9465
9436
|
}
|
|
9466
9437
|
static create(t, e) {
|
|
9467
|
-
const i = new
|
|
9438
|
+
const i = new Xt(t, e);
|
|
9468
9439
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9469
9440
|
throw new Error(`duplicate uuid in options ${i.uuid}, Condition`);
|
|
9470
9441
|
return this.instances.push(i), i;
|
|
@@ -9494,11 +9465,11 @@ class Yt {
|
|
|
9494
9465
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
9495
9466
|
}
|
|
9496
9467
|
static parse(t) {
|
|
9497
|
-
const e = JSON.parse(t), i = e.public;
|
|
9498
|
-
return
|
|
9468
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
9469
|
+
return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
|
|
9499
9470
|
}
|
|
9500
9471
|
}
|
|
9501
|
-
class
|
|
9472
|
+
class zt {
|
|
9502
9473
|
constructor(t, e) {
|
|
9503
9474
|
this._type = "DataAttributive", this._options = e, this.uuid = T(e), this.content = t.content, this.name = t.name;
|
|
9504
9475
|
}
|
|
@@ -9524,7 +9495,7 @@ class Zt {
|
|
|
9524
9495
|
};
|
|
9525
9496
|
}
|
|
9526
9497
|
static create(t, e) {
|
|
9527
|
-
const i = new
|
|
9498
|
+
const i = new zt(t, e);
|
|
9528
9499
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9529
9500
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributive`);
|
|
9530
9501
|
return this.instances.push(i), i;
|
|
@@ -9554,11 +9525,11 @@ class Zt {
|
|
|
9554
9525
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
9555
9526
|
}
|
|
9556
9527
|
static parse(t) {
|
|
9557
|
-
const e = JSON.parse(t), i = e.public;
|
|
9558
|
-
return
|
|
9528
|
+
const e = JSON.parse(t), i = e.public, r = i;
|
|
9529
|
+
return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
|
|
9559
9530
|
}
|
|
9560
9531
|
}
|
|
9561
|
-
class
|
|
9532
|
+
class ve {
|
|
9562
9533
|
constructor(t, e) {
|
|
9563
9534
|
this._type = "DataPolicy", this._options = e, this.uuid = T(e), this.match = t.match, this.modifier = t.modifier, this.attributeQuery = t.attributeQuery;
|
|
9564
9535
|
}
|
|
@@ -9591,7 +9562,7 @@ class Ae {
|
|
|
9591
9562
|
};
|
|
9592
9563
|
}
|
|
9593
9564
|
static create(t, e) {
|
|
9594
|
-
const i = new
|
|
9565
|
+
const i = new ve(t, e);
|
|
9595
9566
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9596
9567
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataPolicy`);
|
|
9597
9568
|
return this.instances.push(i), i;
|
|
@@ -9676,7 +9647,7 @@ class at {
|
|
|
9676
9647
|
return this.create(e.public, e.options);
|
|
9677
9648
|
}
|
|
9678
9649
|
}
|
|
9679
|
-
class
|
|
9650
|
+
class Yt {
|
|
9680
9651
|
constructor(t, e) {
|
|
9681
9652
|
this._type = "Event", this._options = e, this.uuid = T(e), this.name = t.name;
|
|
9682
9653
|
}
|
|
@@ -9698,7 +9669,7 @@ class te {
|
|
|
9698
9669
|
};
|
|
9699
9670
|
}
|
|
9700
9671
|
static create(t, e) {
|
|
9701
|
-
const i = new
|
|
9672
|
+
const i = new Yt(t, e);
|
|
9702
9673
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9703
9674
|
throw new Error(`duplicate uuid in options ${i.uuid}, Event`);
|
|
9704
9675
|
return this.instances.push(i), i;
|
|
@@ -9730,7 +9701,7 @@ class te {
|
|
|
9730
9701
|
return this.create(e.public, e.options);
|
|
9731
9702
|
}
|
|
9732
9703
|
}
|
|
9733
|
-
class
|
|
9704
|
+
class Zt {
|
|
9734
9705
|
constructor(t, e) {
|
|
9735
9706
|
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
9707
|
}
|
|
@@ -9781,7 +9752,7 @@ class ee {
|
|
|
9781
9752
|
};
|
|
9782
9753
|
}
|
|
9783
9754
|
static create(t, e) {
|
|
9784
|
-
const i = new
|
|
9755
|
+
const i = new Zt(t, e);
|
|
9785
9756
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9786
9757
|
throw new Error(`duplicate uuid in options ${i.uuid}, PayloadItem`);
|
|
9787
9758
|
return this.instances.push(i), i;
|
|
@@ -9820,7 +9791,7 @@ class ee {
|
|
|
9820
9791
|
return this.create(e.public, e.options);
|
|
9821
9792
|
}
|
|
9822
9793
|
}
|
|
9823
|
-
class
|
|
9794
|
+
class te {
|
|
9824
9795
|
constructor(t, e) {
|
|
9825
9796
|
this._type = "Payload", this._options = e, this.uuid = T(e), this.items = t.items || [];
|
|
9826
9797
|
}
|
|
@@ -9844,7 +9815,7 @@ class ie {
|
|
|
9844
9815
|
};
|
|
9845
9816
|
}
|
|
9846
9817
|
static create(t, e) {
|
|
9847
|
-
const i = new
|
|
9818
|
+
const i = new te(t, e);
|
|
9848
9819
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9849
9820
|
throw new Error(`duplicate uuid in options ${i.uuid}, Payload`);
|
|
9850
9821
|
return this.instances.push(i), i;
|
|
@@ -9876,7 +9847,7 @@ class ie {
|
|
|
9876
9847
|
return this.create(e.public, e.options);
|
|
9877
9848
|
}
|
|
9878
9849
|
}
|
|
9879
|
-
class
|
|
9850
|
+
class ee {
|
|
9880
9851
|
constructor(t, e) {
|
|
9881
9852
|
this._type = "DataAttributives", this._options = e, this.uuid = T(e), this.content = t.content;
|
|
9882
9853
|
}
|
|
@@ -9899,7 +9870,7 @@ class re {
|
|
|
9899
9870
|
};
|
|
9900
9871
|
}
|
|
9901
9872
|
static create(t, e) {
|
|
9902
|
-
const i = new
|
|
9873
|
+
const i = new ee(t, e);
|
|
9903
9874
|
if (this.instances.find((s) => s.uuid === i.uuid))
|
|
9904
9875
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributives`);
|
|
9905
9876
|
return this.instances.push(i), i;
|
|
@@ -9930,25 +9901,25 @@ class re {
|
|
|
9930
9901
|
return this.create(e.public, e.options);
|
|
9931
9902
|
}
|
|
9932
9903
|
}
|
|
9933
|
-
const
|
|
9904
|
+
const ir = [
|
|
9905
|
+
Gt,
|
|
9906
|
+
Kt,
|
|
9907
|
+
z,
|
|
9934
9908
|
Xt,
|
|
9935
9909
|
zt,
|
|
9936
|
-
|
|
9910
|
+
kt,
|
|
9911
|
+
at,
|
|
9937
9912
|
Yt,
|
|
9938
9913
|
Zt,
|
|
9939
|
-
Et,
|
|
9940
|
-
at,
|
|
9941
9914
|
te,
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
bt,
|
|
9945
|
-
re
|
|
9915
|
+
St,
|
|
9916
|
+
ee
|
|
9946
9917
|
];
|
|
9947
|
-
|
|
9948
|
-
u && u.displayName &&
|
|
9918
|
+
ir.forEach((u) => {
|
|
9919
|
+
u && u.displayName && ue(u.displayName, u);
|
|
9949
9920
|
});
|
|
9950
|
-
function
|
|
9951
|
-
return
|
|
9921
|
+
function Dr({ name: u, isRef: t = !1 }, e) {
|
|
9922
|
+
return z.create({
|
|
9952
9923
|
name: u,
|
|
9953
9924
|
content: u ? new Function("user", `return user.roles.includes('${u}')`) : function() {
|
|
9954
9925
|
return !0;
|
|
@@ -9956,190 +9927,7 @@ function Lr({ name: u, isRef: t = !1 }, e) {
|
|
|
9956
9927
|
isRef: t
|
|
9957
9928
|
}, e);
|
|
9958
9929
|
}
|
|
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 {
|
|
9930
|
+
class G {
|
|
10143
9931
|
constructor(t, e) {
|
|
10144
9932
|
this.graph = t, this.parent = e;
|
|
10145
9933
|
}
|
|
@@ -10149,7 +9937,7 @@ class X {
|
|
|
10149
9937
|
};
|
|
10150
9938
|
}
|
|
10151
9939
|
static create(t, e, i) {
|
|
10152
|
-
const r = new
|
|
9940
|
+
const r = new G(e, i);
|
|
10153
9941
|
return t.current && (r.current = O.create(t.current, e, r)), r;
|
|
10154
9942
|
}
|
|
10155
9943
|
isInteractionAvailable(t) {
|
|
@@ -10182,13 +9970,13 @@ class O {
|
|
|
10182
9970
|
}
|
|
10183
9971
|
static createInitialState(t) {
|
|
10184
9972
|
const e = { uuid: t.uuid };
|
|
10185
|
-
return st.is(t.content) && (e.children = t.childSeqs.map((i) =>
|
|
9973
|
+
return st.is(t.content) && (e.children = t.childSeqs.map((i) => G.createInitialState(i.head))), e;
|
|
10186
9974
|
}
|
|
10187
9975
|
static create(t, e, i) {
|
|
10188
9976
|
const r = e.getNodeByUUID(t.uuid);
|
|
10189
9977
|
if (st.is(r.content)) {
|
|
10190
9978
|
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) =>
|
|
9979
|
+
return o.isGroup = !0, o.children = t?.children?.map((n) => G.create(n, e, o)), o;
|
|
10192
9980
|
} else
|
|
10193
9981
|
return new O(r, e, i);
|
|
10194
9982
|
}
|
|
@@ -10207,12 +9995,12 @@ class O {
|
|
|
10207
9995
|
this.parent.transferToNext(this.node.uuid);
|
|
10208
9996
|
}
|
|
10209
9997
|
}
|
|
10210
|
-
class
|
|
9998
|
+
class Pt {
|
|
10211
9999
|
constructor(t, e) {
|
|
10212
|
-
this.graph = e, this.root =
|
|
10000
|
+
this.graph = e, this.root = G.create(t, this.graph);
|
|
10213
10001
|
}
|
|
10214
10002
|
static createInitialState(t) {
|
|
10215
|
-
return
|
|
10003
|
+
return G.createInitialState(t);
|
|
10216
10004
|
}
|
|
10217
10005
|
isInteractionAvailable(t) {
|
|
10218
10006
|
return this.root.isInteractionAvailable(t);
|
|
@@ -10224,26 +10012,15 @@ class le {
|
|
|
10224
10012
|
return this.root.toJSON();
|
|
10225
10013
|
}
|
|
10226
10014
|
}
|
|
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
|
-
};
|
|
10015
|
+
class et {
|
|
10016
|
+
constructor(t) {
|
|
10017
|
+
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
10018
|
}
|
|
10240
10019
|
buildGraph(t, e) {
|
|
10241
10020
|
const i = /* @__PURE__ */ new Map(), r = {};
|
|
10242
10021
|
for (let o of t.interactions) {
|
|
10243
10022
|
const n = { content: o, next: null, uuid: o.uuid, parentGroup: e, parentSeq: r };
|
|
10244
10023
|
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
10024
|
}
|
|
10248
10025
|
for (let o of t.gateways) {
|
|
10249
10026
|
const n = { content: o, next: [], prev: [], uuid: o.uuid };
|
|
@@ -10262,7 +10039,7 @@ class W {
|
|
|
10262
10039
|
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
10040
|
if (t.transfers?.forEach((o) => {
|
|
10264
10041
|
const n = this.rawToNode.get(o.source) || i.get(o.source), c = this.rawToNode.get(o.target) || i.get(o.target);
|
|
10265
|
-
|
|
10042
|
+
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
10043
|
}), s.size !== 1) throw new Error(`start node must one, current: ${s.size}`);
|
|
10267
10044
|
if (a.size !== 1) throw new Error(`end node must be one, current: ${a.size}`);
|
|
10268
10045
|
return Object.assign(r, {
|
|
@@ -10273,40 +10050,40 @@ class W {
|
|
|
10273
10050
|
static {
|
|
10274
10051
|
this.ACTIVITY_RECORD = "_Activity_";
|
|
10275
10052
|
}
|
|
10276
|
-
async create() {
|
|
10277
|
-
const
|
|
10053
|
+
async create(t) {
|
|
10054
|
+
const e = Pt.createInitialState(this.graph.head);
|
|
10278
10055
|
return {
|
|
10279
|
-
activityId: (await
|
|
10056
|
+
activityId: (await t.system.storage.create(et.ACTIVITY_RECORD, {
|
|
10280
10057
|
name: this.activity.name,
|
|
10281
10058
|
uuid: this.activity.uuid,
|
|
10282
|
-
state:
|
|
10059
|
+
state: e,
|
|
10283
10060
|
refs: {}
|
|
10284
10061
|
})).id,
|
|
10285
|
-
state:
|
|
10062
|
+
state: e
|
|
10286
10063
|
};
|
|
10287
10064
|
}
|
|
10288
10065
|
getNodeByUUID(t) {
|
|
10289
10066
|
return this.uuidToNode.get(t);
|
|
10290
10067
|
}
|
|
10291
|
-
async getState(t) {
|
|
10292
|
-
return (await this.getActivity(t))?.state;
|
|
10068
|
+
async getState(t, e) {
|
|
10069
|
+
return (await this.getActivity(t, e))?.state;
|
|
10293
10070
|
}
|
|
10294
|
-
async getActivity(t) {
|
|
10295
|
-
const
|
|
10071
|
+
async getActivity(t, e) {
|
|
10072
|
+
const i = m.atom({
|
|
10296
10073
|
key: "id",
|
|
10297
|
-
value: ["=",
|
|
10074
|
+
value: ["=", e]
|
|
10298
10075
|
});
|
|
10299
|
-
return (await
|
|
10076
|
+
return (await t.system.storage.find(et.ACTIVITY_RECORD, i, void 0, ["*"])).map((s) => ({ ...s, state: s.state, refs: s.refs }))[0];
|
|
10300
10077
|
}
|
|
10301
|
-
async setActivity(t, e) {
|
|
10302
|
-
const
|
|
10078
|
+
async setActivity(t, e, i) {
|
|
10079
|
+
const r = m.atom({
|
|
10303
10080
|
key: "id",
|
|
10304
|
-
value: ["=",
|
|
10305
|
-
}),
|
|
10306
|
-
return delete
|
|
10081
|
+
value: ["=", e]
|
|
10082
|
+
}), s = { ...i };
|
|
10083
|
+
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
10084
|
}
|
|
10308
|
-
async setState(t, e) {
|
|
10309
|
-
return this.setActivity(t, { state:
|
|
10085
|
+
async setState(t, e, i) {
|
|
10086
|
+
return this.setActivity(t, e, { state: i });
|
|
10310
10087
|
}
|
|
10311
10088
|
isStartNode(t) {
|
|
10312
10089
|
const e = this.uuidToNode.get(t);
|
|
@@ -10319,44 +10096,55 @@ class W {
|
|
|
10319
10096
|
isActivityHead(t, e = this.graph.head) {
|
|
10320
10097
|
return st.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((i) => this.isActivityHead(t, i.head)) : t === this.graph.head.content;
|
|
10321
10098
|
}
|
|
10322
|
-
async
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
return await this.setActivity(s, { state: c }), {
|
|
10342
|
-
...o,
|
|
10343
|
-
context: {
|
|
10344
|
-
activityId: s,
|
|
10345
|
-
nextState: c
|
|
10346
|
-
}
|
|
10347
|
-
};
|
|
10099
|
+
async checkActivityState(t, e, i) {
|
|
10100
|
+
if (!new Pt(await this.getState(t, e), this).isInteractionAvailable(i))
|
|
10101
|
+
throw new Error(`interaction ${i} not available`);
|
|
10102
|
+
}
|
|
10103
|
+
async fullGuardWithUserRef(t, e, i) {
|
|
10104
|
+
if (!t.ignoreGuard && e.conditions && await be(t, e, i), e.userAttributives) {
|
|
10105
|
+
const r = bt.is(e.userAttributives) ? R.fromValue(
|
|
10106
|
+
e.userAttributives.content
|
|
10107
|
+
) : R.atom(
|
|
10108
|
+
e.userAttributives
|
|
10109
|
+
), s = (o) => o.isRef ? this.checkUserRef(t, o, i.user, i.activityId) : rr(t, o, i, i.user), a = await r.evaluateAsync(s);
|
|
10110
|
+
if (a !== !0)
|
|
10111
|
+
throw new q("User check failed", {
|
|
10112
|
+
type: "check user failed",
|
|
10113
|
+
checkType: "user",
|
|
10114
|
+
error: a
|
|
10115
|
+
});
|
|
10116
|
+
}
|
|
10117
|
+
e.payload && await Re(t, e, i);
|
|
10348
10118
|
}
|
|
10349
|
-
async
|
|
10350
|
-
const r = (await this.
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10119
|
+
async completeInteractionState(t, e, i) {
|
|
10120
|
+
const r = new Pt(await this.getState(t, e), this), s = r.completeInteraction(i);
|
|
10121
|
+
k(s, "change activity state failed");
|
|
10122
|
+
const a = r.toJSON();
|
|
10123
|
+
await this.setActivity(t, e, { state: a });
|
|
10124
|
+
}
|
|
10125
|
+
async saveUserRefs(t, e, i, r) {
|
|
10126
|
+
const s = (await this.getActivity(t, e))?.refs || {};
|
|
10127
|
+
i.userRef?.name && (s[i.userRef?.name] = r.user.id), i.payload?.items.forEach((a) => {
|
|
10128
|
+
if (z.is(a.itemRef) && a.itemRef?.name && r.payload[a.name]) {
|
|
10129
|
+
const o = r.payload[a.name];
|
|
10130
|
+
a.isCollection ? (s[a.itemRef.name] || (s[a.itemRef.name] = []), s[a.itemRef.name].push(o.id)) : s[a.itemRef.name] = o.id;
|
|
10355
10131
|
}
|
|
10356
|
-
}), await this.setActivity(t, { refs:
|
|
10132
|
+
}), await this.setActivity(t, e, { refs: s });
|
|
10133
|
+
}
|
|
10134
|
+
}
|
|
10135
|
+
async function rr(u, t, e, i) {
|
|
10136
|
+
if (t.content) {
|
|
10137
|
+
let r;
|
|
10138
|
+
try {
|
|
10139
|
+
r = await t.content.call(u, i, e);
|
|
10140
|
+
} catch {
|
|
10141
|
+
r = !1;
|
|
10142
|
+
}
|
|
10143
|
+
return r === void 0 ? !0 : r;
|
|
10357
10144
|
}
|
|
10145
|
+
return !0;
|
|
10358
10146
|
}
|
|
10359
|
-
class
|
|
10147
|
+
class sr extends O {
|
|
10360
10148
|
onChange(t, e) {
|
|
10361
10149
|
if (this.graph.isStartNode(t)) {
|
|
10362
10150
|
if (e)
|
|
@@ -10367,70 +10155,24 @@ class lr extends O {
|
|
|
10367
10155
|
}
|
|
10368
10156
|
}
|
|
10369
10157
|
}
|
|
10370
|
-
O.GroupStateNodeType.set("any",
|
|
10371
|
-
class
|
|
10158
|
+
O.GroupStateNodeType.set("any", sr);
|
|
10159
|
+
class ar extends O {
|
|
10372
10160
|
onChange(t, e) {
|
|
10373
10161
|
this.isGroupCompleted() && this.complete();
|
|
10374
10162
|
}
|
|
10375
10163
|
}
|
|
10376
|
-
O.GroupStateNodeType.set("every",
|
|
10377
|
-
class
|
|
10164
|
+
O.GroupStateNodeType.set("every", ar);
|
|
10165
|
+
class or extends O {
|
|
10378
10166
|
onChange(t, e) {
|
|
10379
10167
|
this.graph.isEndNode(t) && this.complete();
|
|
10380
10168
|
}
|
|
10381
10169
|
}
|
|
10382
|
-
O.GroupStateNodeType.set("race",
|
|
10383
|
-
class
|
|
10384
|
-
}
|
|
10385
|
-
O.GroupStateNodeType.set("program", hr);
|
|
10386
|
-
class Se extends H {
|
|
10387
|
-
constructor(t, e = {}) {
|
|
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
|
-
}
|
|
10170
|
+
O.GroupStateNodeType.set("race", or);
|
|
10171
|
+
class nr extends O {
|
|
10415
10172
|
}
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
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,
|
|
10173
|
+
O.GroupStateNodeType.set("program", nr);
|
|
10174
|
+
const cr = "_Activity_", Te = I.create({
|
|
10175
|
+
name: cr,
|
|
10434
10176
|
properties: [
|
|
10435
10177
|
N.create({
|
|
10436
10178
|
name: "name",
|
|
@@ -10453,121 +10195,83 @@ const Nt = "_Activity_", Ee = I.create({
|
|
|
10453
10195
|
collection: !1
|
|
10454
10196
|
})
|
|
10455
10197
|
]
|
|
10456
|
-
}),
|
|
10198
|
+
}), lr = M.create({
|
|
10457
10199
|
name: "activityInteraction",
|
|
10458
|
-
source:
|
|
10200
|
+
source: Te,
|
|
10459
10201
|
sourceProperty: "interaction",
|
|
10460
|
-
target:
|
|
10202
|
+
target: Ut,
|
|
10461
10203
|
targetProperty: "activity",
|
|
10462
10204
|
type: "1:n"
|
|
10463
10205
|
});
|
|
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));
|
|
10206
|
+
class Fr {
|
|
10207
|
+
constructor(t) {
|
|
10208
|
+
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) => {
|
|
10209
|
+
const i = new et(e);
|
|
10210
|
+
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
10211
|
});
|
|
10473
|
-
for (const
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
mapEventData: s.mapEventData,
|
|
10482
|
-
resolve: s.resolve,
|
|
10483
|
-
afterDispatch: s.afterDispatch
|
|
10484
|
-
};
|
|
10212
|
+
for (const e of t) {
|
|
10213
|
+
const i = this.activityCallsByName.get(e.name), r = this.collectAllInteractions(e);
|
|
10214
|
+
for (const s of r) {
|
|
10215
|
+
const a = this.getActivityInteractionEventSourceName(e.name, s.name), o = this.buildActivityInteractionEventSource(
|
|
10216
|
+
a,
|
|
10217
|
+
s,
|
|
10218
|
+
i
|
|
10219
|
+
);
|
|
10485
10220
|
this.activityEventSources.push(o);
|
|
10486
10221
|
}
|
|
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
10222
|
}
|
|
10518
|
-
return s;
|
|
10519
|
-
}
|
|
10520
|
-
async callActivityInteraction(t, e, i, r) {
|
|
10521
|
-
const s = this.activityCallsByName.get(t);
|
|
10522
|
-
if (!s)
|
|
10523
|
-
throw new Se(`Cannot find activity for ${t}`, {
|
|
10524
|
-
activityName: t,
|
|
10525
|
-
context: {
|
|
10526
|
-
interactionName: e,
|
|
10527
|
-
activityId: i,
|
|
10528
|
-
userId: r.user?.id
|
|
10529
|
-
}
|
|
10530
|
-
});
|
|
10531
|
-
await this.controller.system.storage.beginTransaction(s.activity.name);
|
|
10532
|
-
const a = s.interactionCallByName.get(e);
|
|
10533
|
-
if (!a)
|
|
10534
|
-
throw await this.controller.system.storage.rollbackTransaction(s.activity.name), new ue(`Cannot find interaction ${e} in activity ${t}`, {
|
|
10535
|
-
interactionName: e,
|
|
10536
|
-
userId: r.user?.id,
|
|
10537
|
-
payload: r.payload,
|
|
10538
|
-
executionPhase: "activity-interaction-lookup",
|
|
10539
|
-
context: { activityName: t, activityId: i }
|
|
10540
|
-
});
|
|
10541
|
-
const o = await s.callInteraction(i, a.interaction.uuid, r);
|
|
10542
|
-
return o.error ? await this.controller.system.storage.rollbackTransaction(s.activity.name) : await this.controller.system.storage.commitTransaction(s.activity.name), o;
|
|
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
10223
|
}
|
|
10551
|
-
|
|
10552
|
-
const i = {
|
|
10553
|
-
|
|
10224
|
+
buildActivityInteractionEventSource(t, e, i) {
|
|
10225
|
+
const r = i.isActivityHead(e), s = async function(n) {
|
|
10226
|
+
if (r && !n.activityId) {
|
|
10227
|
+
e.guard && await e.guard.call(this, n);
|
|
10228
|
+
const c = await i.create(this);
|
|
10229
|
+
n.activityId = c.activityId;
|
|
10230
|
+
} else if (r && n.activityId)
|
|
10231
|
+
await i.checkActivityState(this, n.activityId, e.uuid), e.guard && await e.guard.call(this, n);
|
|
10232
|
+
else {
|
|
10233
|
+
if (!n.activityId)
|
|
10234
|
+
throw new Error("activityId must be provided for non-head interaction of an activity");
|
|
10235
|
+
await i.checkActivityState(this, n.activityId, e.uuid), await i.fullGuardWithUserRef(this, e, n);
|
|
10236
|
+
}
|
|
10237
|
+
}, a = (n) => {
|
|
10238
|
+
const c = e.mapEventData ? e.mapEventData(n) : {};
|
|
10239
|
+
return n.activityId && (c.activity = { id: n.activityId }), c;
|
|
10240
|
+
}, o = async function(n, c) {
|
|
10241
|
+
const l = n.activityId;
|
|
10242
|
+
return await i.saveUserRefs(this, l, e, n), await i.completeInteractionState(this, l, e.uuid), {
|
|
10243
|
+
...(e.afterDispatch ? await e.afterDispatch.call(this, n, c) : void 0) || {},
|
|
10244
|
+
activityId: l,
|
|
10245
|
+
nextState: await i.getState(this, l)
|
|
10246
|
+
};
|
|
10554
10247
|
};
|
|
10555
|
-
return
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10248
|
+
return {
|
|
10249
|
+
uuid: `${i.activity.uuid}_${e.uuid}`,
|
|
10250
|
+
_type: "EventSource",
|
|
10251
|
+
name: t,
|
|
10252
|
+
entity: e.entity,
|
|
10253
|
+
guard: s,
|
|
10254
|
+
mapEventData: a,
|
|
10255
|
+
resolve: e.resolve,
|
|
10256
|
+
afterDispatch: o
|
|
10257
|
+
};
|
|
10258
|
+
}
|
|
10259
|
+
collectAllInteractions(t) {
|
|
10260
|
+
const e = [...t.interactions];
|
|
10261
|
+
for (const i of t.groups || [])
|
|
10262
|
+
for (const r of i.activities || [])
|
|
10263
|
+
e.push(...this.collectAllInteractions(r));
|
|
10264
|
+
return e;
|
|
10563
10265
|
}
|
|
10564
|
-
|
|
10565
|
-
return
|
|
10266
|
+
getOutput() {
|
|
10267
|
+
return {
|
|
10268
|
+
eventSources: this.activityEventSources,
|
|
10269
|
+
entities: this.requiredEntities,
|
|
10270
|
+
relations: this.requiredRelations
|
|
10271
|
+
};
|
|
10566
10272
|
}
|
|
10567
|
-
|
|
10568
|
-
return
|
|
10569
|
-
...e
|
|
10570
|
-
}));
|
|
10273
|
+
getActivityInteractionEventSourceName(t, e) {
|
|
10274
|
+
return `${t}:${e}`;
|
|
10571
10275
|
}
|
|
10572
10276
|
getActivityCall(t) {
|
|
10573
10277
|
return this.activityCalls.get(t);
|
|
@@ -10575,188 +10279,229 @@ class Br {
|
|
|
10575
10279
|
getActivityCallByName(t) {
|
|
10576
10280
|
return this.activityCallsByName.get(t);
|
|
10577
10281
|
}
|
|
10578
|
-
|
|
10579
|
-
|
|
10282
|
+
}
|
|
10283
|
+
class Vr extends W {
|
|
10284
|
+
constructor(t, e = {}) {
|
|
10285
|
+
super(t, {
|
|
10286
|
+
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
10287
|
+
context: {
|
|
10288
|
+
category: j.INTERACTION,
|
|
10289
|
+
interactionName: e.interactionName,
|
|
10290
|
+
userId: e.userId,
|
|
10291
|
+
payload: e.payload,
|
|
10292
|
+
executionPhase: e.executionPhase,
|
|
10293
|
+
...e.context
|
|
10294
|
+
},
|
|
10295
|
+
causedBy: e.causedBy
|
|
10296
|
+
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || $.HIGH;
|
|
10580
10297
|
}
|
|
10581
|
-
|
|
10582
|
-
|
|
10298
|
+
}
|
|
10299
|
+
class ur extends W {
|
|
10300
|
+
constructor(t, e = {}) {
|
|
10301
|
+
super(t, {
|
|
10302
|
+
errorType: e.context?.errorType || "ActivityError",
|
|
10303
|
+
context: {
|
|
10304
|
+
category: j.ACTIVITY,
|
|
10305
|
+
activityName: e.activityName,
|
|
10306
|
+
activityId: e.activityId,
|
|
10307
|
+
activityInstanceId: e.activityInstanceId,
|
|
10308
|
+
currentState: e.currentState,
|
|
10309
|
+
...e.context
|
|
10310
|
+
},
|
|
10311
|
+
causedBy: e.causedBy
|
|
10312
|
+
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || $.MEDIUM;
|
|
10313
|
+
}
|
|
10314
|
+
}
|
|
10315
|
+
class Qr extends ur {
|
|
10316
|
+
constructor(t, e = {}) {
|
|
10317
|
+
super(t, {
|
|
10318
|
+
...e,
|
|
10319
|
+
severity: $.HIGH,
|
|
10320
|
+
context: {
|
|
10321
|
+
errorType: "ActivityStateError",
|
|
10322
|
+
expectedState: e.expectedState,
|
|
10323
|
+
actualState: e.actualState,
|
|
10324
|
+
stateTransition: e.stateTransition
|
|
10325
|
+
}
|
|
10326
|
+
}), this.expectedState = e.expectedState, this.actualState = e.actualState, this.stateTransition = e.stateTransition;
|
|
10583
10327
|
}
|
|
10584
10328
|
}
|
|
10585
10329
|
export {
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10330
|
+
cr as ACTIVITY_RECORD,
|
|
10331
|
+
Ce as ALL_ATTR_SYMBOL,
|
|
10332
|
+
Mt as ASYNC_TASK_RECORD,
|
|
10333
|
+
kt as Action,
|
|
10334
|
+
Kt as Activity,
|
|
10335
|
+
et as ActivityCall,
|
|
10336
|
+
ur as ActivityError,
|
|
10593
10337
|
st as ActivityGroup,
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10338
|
+
lr as ActivityInteractionRelation,
|
|
10339
|
+
Fr as ActivityManager,
|
|
10340
|
+
Te as ActivityStateEntity,
|
|
10341
|
+
Qr as ActivityStateError,
|
|
10342
|
+
ri as AliasManager,
|
|
10599
10343
|
ht as Any,
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10344
|
+
Ri as AnyHandles,
|
|
10345
|
+
_ as AttributeInfo,
|
|
10346
|
+
x as AttributeQuery,
|
|
10347
|
+
z as Attributive,
|
|
10348
|
+
bt as Attributives,
|
|
10605
10349
|
ut as Average,
|
|
10606
|
-
|
|
10607
|
-
Nr as BaseKlass,
|
|
10350
|
+
$i as AverageHandles,
|
|
10608
10351
|
ft as BoolAtomData,
|
|
10609
10352
|
R as BoolExp,
|
|
10610
10353
|
mt as BoolExpressionData,
|
|
10611
|
-
|
|
10612
|
-
|
|
10354
|
+
H as ComputationDataDepError,
|
|
10355
|
+
F as ComputationError,
|
|
10613
10356
|
S as ComputationResult,
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10357
|
+
fe as ComputationResultAsync,
|
|
10358
|
+
pe as ComputationResultFullRecompute,
|
|
10359
|
+
me as ComputationResultResolved,
|
|
10360
|
+
Nt as ComputationResultSkip,
|
|
10361
|
+
ae as ComputationStateError,
|
|
10362
|
+
Xt as Condition,
|
|
10363
|
+
U as ConditionError,
|
|
10364
|
+
St as Conditions,
|
|
10365
|
+
Ir as Controller,
|
|
10623
10366
|
ct as Count,
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10367
|
+
vi as CountHandles,
|
|
10368
|
+
Oe as CreationExecutor,
|
|
10369
|
+
Bt as Custom,
|
|
10370
|
+
Qi as CustomHandles,
|
|
10371
|
+
Ht as DBConsoleLogger,
|
|
10372
|
+
Hi as DBLogLevel,
|
|
10373
|
+
si as DBSetup,
|
|
10374
|
+
kr as DELETED_STATE,
|
|
10375
|
+
L as DICTIONARY_RECORD,
|
|
10376
|
+
zt as DataAttributive,
|
|
10377
|
+
ee as DataAttributives,
|
|
10378
|
+
ve as DataPolicy,
|
|
10379
|
+
Qt as Dictionary,
|
|
10380
|
+
oi as DictionaryEntity,
|
|
10638
10381
|
I as Entity,
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10382
|
+
Di as EntityCustomHandle,
|
|
10383
|
+
We as EntityQueryHandle,
|
|
10384
|
+
Je as EntityToTableMap,
|
|
10385
|
+
Wt as Equation,
|
|
10386
|
+
j as ErrorCategory,
|
|
10387
|
+
$ as ErrorSeverity,
|
|
10388
|
+
Yt as Event,
|
|
10389
|
+
he as EventSource,
|
|
10645
10390
|
dt as Every,
|
|
10646
|
-
|
|
10647
|
-
|
|
10391
|
+
yi as EveryHandles,
|
|
10392
|
+
C as Expression,
|
|
10393
|
+
W as FrameworkError,
|
|
10648
10394
|
at as Gateway,
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10395
|
+
Gi as GetAction,
|
|
10396
|
+
gi as GlobalAnyHandle,
|
|
10397
|
+
Pi as GlobalAverageHandle,
|
|
10652
10398
|
B as GlobalBoundState,
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
Qt as KlassByName,
|
|
10399
|
+
wi as GlobalCountHandle,
|
|
10400
|
+
Oi as GlobalCustomHandle,
|
|
10401
|
+
fi as GlobalEveryHandle,
|
|
10402
|
+
ki as GlobalRealTimeComputation,
|
|
10403
|
+
ci as GlobalStateMachineHandle,
|
|
10404
|
+
Ii as GlobalSumHandle,
|
|
10405
|
+
di as GlobalWeightedSummationHandle,
|
|
10406
|
+
$t as HARD_DELETION_PROPERTY_NAME,
|
|
10407
|
+
Er as HardDeletionProperty,
|
|
10408
|
+
re as ID_ATTR,
|
|
10409
|
+
Ki as INTERACTION_RECORD,
|
|
10410
|
+
vt as Inequality,
|
|
10411
|
+
Gt as Interaction,
|
|
10412
|
+
Ut as InteractionEventEntity,
|
|
10413
|
+
Vr as InteractionExecutionError,
|
|
10414
|
+
q as InteractionGuardError,
|
|
10415
|
+
Ft as KlassByName,
|
|
10671
10416
|
f as LINK_SYMBOL,
|
|
10672
|
-
|
|
10417
|
+
wt as LinkInfo,
|
|
10673
10418
|
m as MatchExp,
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10419
|
+
Pe as Modifier,
|
|
10420
|
+
Mr as MonoSystem,
|
|
10421
|
+
Ar as NON_DELETED_STATE,
|
|
10422
|
+
Tr as NON_EXIST_STATE,
|
|
10423
|
+
V as NewRecordData,
|
|
10424
|
+
gr as PHASE_AFTER_ALL,
|
|
10425
|
+
yr as PHASE_BEFORE_ALL,
|
|
10426
|
+
It as PHASE_NORMAL,
|
|
10427
|
+
te as Payload,
|
|
10428
|
+
Zt as PayloadItem,
|
|
10684
10429
|
N as Property,
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10430
|
+
bi as PropertyAnyHandle,
|
|
10431
|
+
Ci as PropertyAverageHandle,
|
|
10432
|
+
Ni as PropertyCountHandle,
|
|
10433
|
+
Vi as PropertyCustomHandle,
|
|
10434
|
+
mi as PropertyEveryHandle,
|
|
10435
|
+
Si as PropertyRealTimeComputation,
|
|
10436
|
+
li as PropertyStateMachineHandle,
|
|
10437
|
+
xi as PropertySumHandle,
|
|
10438
|
+
Vt as PropertyTypes,
|
|
10439
|
+
hi as PropertyWeightedSummationHandle,
|
|
10440
|
+
Le as QueryExecutor,
|
|
10441
|
+
_t as ROOT_LABEL,
|
|
10442
|
+
se as ROW_ID_ATTR,
|
|
10698
10443
|
pt as RealTime,
|
|
10699
|
-
|
|
10444
|
+
Ei as RealTimeHandles,
|
|
10700
10445
|
E as RecordBoundState,
|
|
10701
10446
|
rt as RecordInfo,
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10447
|
+
ge as RecordMutationSideEffect,
|
|
10448
|
+
P as RecordQuery,
|
|
10449
|
+
_e as RecordQueryAgent,
|
|
10450
|
+
Qe as RecordQueryRef,
|
|
10451
|
+
Q as RecordQueryTree,
|
|
10452
|
+
Ti as RecordsTransformHandle,
|
|
10708
10453
|
it as RecursiveContext,
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10454
|
+
de as RefContainer,
|
|
10455
|
+
M as Relation,
|
|
10456
|
+
Fi as RelationCustomHandle,
|
|
10457
|
+
Ve as SQLBuilder,
|
|
10458
|
+
Z as SYSTEM_RECORD,
|
|
10459
|
+
qi as Scheduler,
|
|
10460
|
+
qt as SideEffect,
|
|
10716
10461
|
ot as StateMachine,
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10462
|
+
ui as StateMachineHandles,
|
|
10463
|
+
K as StateNode,
|
|
10464
|
+
Lt as StateTransfer,
|
|
10720
10465
|
lt as Summation,
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10466
|
+
Mi as SummationHandles,
|
|
10467
|
+
jt as SystemConsoleLogger,
|
|
10468
|
+
ai as SystemEntity,
|
|
10469
|
+
ji as SystemLogLevel,
|
|
10470
|
+
we as Transfer,
|
|
10471
|
+
Tt as Transform,
|
|
10472
|
+
Ai as TransformHandles,
|
|
10473
|
+
Sr as USER_ENTITY,
|
|
10729
10474
|
nt as WeightedSummation,
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10475
|
+
pi as WeightedSummationHandles,
|
|
10476
|
+
oe as addToCurrentEffects,
|
|
10477
|
+
k as assert,
|
|
10478
|
+
Jt as asyncEffectsContext,
|
|
10479
|
+
Pr as asyncInteractionContext,
|
|
10480
|
+
Cr as boolExpToAttributives,
|
|
10481
|
+
be as checkCondition,
|
|
10482
|
+
Re as checkPayload,
|
|
10483
|
+
pr as clearAllInstances,
|
|
10484
|
+
ke as createInstances,
|
|
10485
|
+
mr as createInstancesFromString,
|
|
10486
|
+
Dr as createUserRoleAttributive,
|
|
10487
|
+
xr as dbConsoleLogger,
|
|
10488
|
+
Rt as deepClone,
|
|
10489
|
+
wr as everyAsync,
|
|
10490
|
+
vr as everyWithErrorAsync,
|
|
10491
|
+
br as filterMap,
|
|
10492
|
+
Or as findRootActivity,
|
|
10493
|
+
Ne as forEachInteraction,
|
|
10748
10494
|
T as generateUUID,
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
br as stringifyAllInstances,
|
|
10495
|
+
Bi as getCurrentEffects,
|
|
10496
|
+
$r as getInteractions,
|
|
10497
|
+
hr as indexBy,
|
|
10498
|
+
ce as isObject,
|
|
10499
|
+
le as isPlainObject,
|
|
10500
|
+
Rr as mapObject,
|
|
10501
|
+
ue as registerKlass,
|
|
10502
|
+
Nr as someAsync,
|
|
10503
|
+
fr as stringifyAllInstances,
|
|
10759
10504
|
w as stringifyAttribute,
|
|
10760
|
-
|
|
10505
|
+
Ui as systemConsoleLogger
|
|
10761
10506
|
};
|
|
10762
10507
|
//# sourceMappingURL=index.js.map
|