interaqt 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +84 -67
- package/dist/index.js.map +1 -1
- package/dist/runtime/Scheduler.d.ts +5 -4
- package/dist/runtime/Scheduler.d.ts.map +1 -1
- package/dist/runtime/activity/InteractionCall.d.ts.map +1 -1
- package/dist/runtime/computations/Computation.d.ts +7 -1
- package/dist/runtime/computations/Computation.d.ts.map +1 -1
- package/dist/runtime/computations/StateMachine.d.ts +3 -0
- package/dist/runtime/computations/StateMachine.d.ts.map +1 -1
- package/dist/shared/BoolExp.d.ts +3 -3
- package/dist/shared/BoolExp.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1029,17 +1029,25 @@ class R {
|
|
|
1029
1029
|
constructor(t) {
|
|
1030
1030
|
if (this.raw = t, !t)
|
|
1031
1031
|
throw new Error("BoolExp raw data cannot be undefined");
|
|
1032
|
+
if (t.type !== "atom" && t.type !== "expression")
|
|
1033
|
+
throw new Error(`invalid bool expression type: ${JSON.stringify(t)}`);
|
|
1032
1034
|
}
|
|
1033
1035
|
static atom(t) {
|
|
1034
1036
|
return new R({ type: "atom", data: t });
|
|
1035
1037
|
}
|
|
1036
1038
|
static and(...t) {
|
|
1037
|
-
const e = t.filter((s) => !!s)
|
|
1038
|
-
|
|
1039
|
+
const e = t.filter((s) => !!s);
|
|
1040
|
+
if (e.length === 0)
|
|
1041
|
+
return;
|
|
1042
|
+
const [r, ...i] = e;
|
|
1043
|
+
return i.reduce((s, a) => s.and(a), r instanceof R ? r : R.atom(r));
|
|
1039
1044
|
}
|
|
1040
1045
|
static or(...t) {
|
|
1041
|
-
const e = t.filter((s) => !!s)
|
|
1042
|
-
|
|
1046
|
+
const e = t.filter((s) => !!s);
|
|
1047
|
+
if (e.length === 0)
|
|
1048
|
+
return;
|
|
1049
|
+
const [r, ...i] = e;
|
|
1050
|
+
return i.reduce((s, a) => s.or(a), r instanceof R ? r : R.atom(r));
|
|
1043
1051
|
}
|
|
1044
1052
|
isAtom() {
|
|
1045
1053
|
return this.raw.type === "atom";
|
|
@@ -1061,7 +1069,7 @@ class R {
|
|
|
1061
1069
|
return this.raw;
|
|
1062
1070
|
}
|
|
1063
1071
|
static fromValue(t) {
|
|
1064
|
-
return new R(t);
|
|
1072
|
+
return t instanceof R ? t : new R(t);
|
|
1065
1073
|
}
|
|
1066
1074
|
toJSON() {
|
|
1067
1075
|
return this.raw;
|
|
@@ -1344,7 +1352,7 @@ function Ci(u) {
|
|
|
1344
1352
|
content: Ot(u)
|
|
1345
1353
|
});
|
|
1346
1354
|
}
|
|
1347
|
-
class
|
|
1355
|
+
class Ht {
|
|
1348
1356
|
constructor(t, e) {
|
|
1349
1357
|
this._type = "Condition", this._options = e, this.uuid = S(e), this.content = t.content, this.name = t.name;
|
|
1350
1358
|
}
|
|
@@ -1370,7 +1378,7 @@ class jt {
|
|
|
1370
1378
|
};
|
|
1371
1379
|
}
|
|
1372
1380
|
static create(t, e) {
|
|
1373
|
-
const r = new
|
|
1381
|
+
const r = new Ht(t, e);
|
|
1374
1382
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
1375
1383
|
throw new Error(`duplicate uuid in options ${r.uuid}, Condition`);
|
|
1376
1384
|
return this.instances.push(r), r;
|
|
@@ -1404,7 +1412,7 @@ class jt {
|
|
|
1404
1412
|
return r.content && typeof r.content == "string" && r.content.startsWith("func::") && (r.content = new Function("return " + r.content.substring(6))()), this.create(r, e.options);
|
|
1405
1413
|
}
|
|
1406
1414
|
}
|
|
1407
|
-
class
|
|
1415
|
+
class jt {
|
|
1408
1416
|
constructor(t, e) {
|
|
1409
1417
|
this._type = "DataAttributive", this._options = e, this.uuid = S(e), this.content = t.content, this.name = t.name;
|
|
1410
1418
|
}
|
|
@@ -1430,7 +1438,7 @@ class Ht {
|
|
|
1430
1438
|
};
|
|
1431
1439
|
}
|
|
1432
1440
|
static create(t, e) {
|
|
1433
|
-
const r = new
|
|
1441
|
+
const r = new jt(t, e);
|
|
1434
1442
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
1435
1443
|
throw new Error(`duplicate uuid in options ${r.uuid}, DataAttributive`);
|
|
1436
1444
|
return this.instances.push(r), r;
|
|
@@ -2919,8 +2927,8 @@ const We = [
|
|
|
2919
2927
|
Wt,
|
|
2920
2928
|
Jt,
|
|
2921
2929
|
X,
|
|
2922
|
-
jt,
|
|
2923
2930
|
Ht,
|
|
2931
|
+
jt,
|
|
2924
2932
|
Ct,
|
|
2925
2933
|
st,
|
|
2926
2934
|
Ut,
|
|
@@ -3768,7 +3776,7 @@ class q {
|
|
|
3768
3776
|
}), this.parentLinkQueryTree && (t[f] = this.parentLinkQueryTree.getData()), t;
|
|
3769
3777
|
}
|
|
3770
3778
|
}
|
|
3771
|
-
const f = "&",
|
|
3779
|
+
const f = "&", He = "*";
|
|
3772
3780
|
class x {
|
|
3773
3781
|
constructor(t, e, r = [], i, s, a) {
|
|
3774
3782
|
this.recordName = t, this.map = e, this.data = r, this.parentRecord = i, this.attributeName = s, this.shouldQueryParentLinkData = a, this.relatedRecords = [], this.xToManyRecords = [], this.xToOneRecords = [], this.valueAttributes = [], this.id = Math.random();
|
|
@@ -3781,7 +3789,7 @@ class x {
|
|
|
3781
3789
|
this.parentLinkRecordQuery = M.create(y.linkName, this.map, d, void 0);
|
|
3782
3790
|
return;
|
|
3783
3791
|
}
|
|
3784
|
-
if (l ===
|
|
3792
|
+
if (l === He) {
|
|
3785
3793
|
o = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((y) => y.attributeName));
|
|
3786
3794
|
return;
|
|
3787
3795
|
}
|
|
@@ -3911,7 +3919,7 @@ class x {
|
|
|
3911
3919
|
return this.parentLinkRecordQuery ? new x(this.recordName, this.map, this.data, this.parentRecord, this.attributeName, !0) : this;
|
|
3912
3920
|
}
|
|
3913
3921
|
}
|
|
3914
|
-
function
|
|
3922
|
+
function je(u) {
|
|
3915
3923
|
const t = [];
|
|
3916
3924
|
return u.forEach((e) => t.push(...Array.isArray(e) ? e : [e])), t;
|
|
3917
3925
|
}
|
|
@@ -3921,7 +3929,7 @@ class L {
|
|
|
3921
3929
|
const s = this.map.getRecordInfo(e);
|
|
3922
3930
|
this.recordName = s.isFilteredEntity || s.isFilteredRelation ? s.resolvedBaseRecordName : e;
|
|
3923
3931
|
const [a, o, n] = this.map.groupAttributes(this.recordName, r ? Object.keys(r) : []);
|
|
3924
|
-
this.relatedEntitiesData =
|
|
3932
|
+
this.relatedEntitiesData = je(o.map(
|
|
3925
3933
|
(l) => Array.isArray(r[l.attributeName]) ? r[l.attributeName].map((d) => new L(this.map, l.recordName, d, l)) : new L(this.map, l.recordName, r[l.attributeName], l)
|
|
3926
3934
|
)), this.valueAttributes = a, this.entityIdAttributes = n;
|
|
3927
3935
|
const c = this.map.getRecordInfo(this.recordName);
|
|
@@ -6408,6 +6416,12 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6408
6416
|
const i = await this.state.currentState.get(r), s = this.transitionFinder?.findNextState(i, e);
|
|
6409
6417
|
return s ? (await this.state.currentState.set(r, s.name), s.computeValue ? await s.computeValue.call(this.controller, t, e) : s.name) : A.skip();
|
|
6410
6418
|
}
|
|
6419
|
+
// 给外部用的,因为可能在 Transform 里面设置初始值。
|
|
6420
|
+
async createStateData(t) {
|
|
6421
|
+
return {
|
|
6422
|
+
[this.state.currentState.key]: t.name
|
|
6423
|
+
};
|
|
6424
|
+
}
|
|
6411
6425
|
}
|
|
6412
6426
|
const Di = Y.create({
|
|
6413
6427
|
name: "nonExistent",
|
|
@@ -7807,7 +7821,7 @@ const Jr = [
|
|
|
7807
7821
|
Br,
|
|
7808
7822
|
Wr
|
|
7809
7823
|
];
|
|
7810
|
-
class
|
|
7824
|
+
class j extends Error {
|
|
7811
7825
|
constructor(t, e = {}) {
|
|
7812
7826
|
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);
|
|
7813
7827
|
}
|
|
@@ -7820,7 +7834,7 @@ class H extends Error {
|
|
|
7820
7834
|
getErrorChain() {
|
|
7821
7835
|
const t = [this];
|
|
7822
7836
|
let e = this.causedBy;
|
|
7823
|
-
for (; e && (t.push(e), e instanceof
|
|
7837
|
+
for (; e && (t.push(e), e instanceof j); )
|
|
7824
7838
|
e = e.causedBy;
|
|
7825
7839
|
return t;
|
|
7826
7840
|
}
|
|
@@ -7925,7 +7939,7 @@ Stack trace:`, i.stack.split(`
|
|
|
7925
7939
|
}
|
|
7926
7940
|
}
|
|
7927
7941
|
var V = /* @__PURE__ */ ((u) => (u.LOW = "low", u.MEDIUM = "medium", u.HIGH = "high", u.CRITICAL = "critical", u))(V || {}), Z = /* @__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))(Z || {});
|
|
7928
|
-
class U extends
|
|
7942
|
+
class U extends j {
|
|
7929
7943
|
constructor(t, e = {}) {
|
|
7930
7944
|
super(t, {
|
|
7931
7945
|
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
@@ -7941,7 +7955,7 @@ class U extends H {
|
|
|
7941
7955
|
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || V.HIGH;
|
|
7942
7956
|
}
|
|
7943
7957
|
}
|
|
7944
|
-
class ne extends
|
|
7958
|
+
class ne extends j {
|
|
7945
7959
|
constructor(t, e = {}) {
|
|
7946
7960
|
super(t, {
|
|
7947
7961
|
errorType: e.context?.errorType || "ActivityError",
|
|
@@ -7957,7 +7971,7 @@ class ne extends H {
|
|
|
7957
7971
|
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || V.MEDIUM;
|
|
7958
7972
|
}
|
|
7959
7973
|
}
|
|
7960
|
-
class Q extends
|
|
7974
|
+
class Q extends j {
|
|
7961
7975
|
constructor(t, e = {}) {
|
|
7962
7976
|
super(t, {
|
|
7963
7977
|
errorType: e.context?.errorType || "ComputationError",
|
|
@@ -8003,7 +8017,7 @@ class J extends Q {
|
|
|
8003
8017
|
}), this.depName = e.depName, this.depType = e.depType, this.missingData = e.missingData, this.invalidData = e.invalidData;
|
|
8004
8018
|
}
|
|
8005
8019
|
}
|
|
8006
|
-
class
|
|
8020
|
+
class H extends j {
|
|
8007
8021
|
constructor(t, e = {}) {
|
|
8008
8022
|
super(t, {
|
|
8009
8023
|
errorType: e.context?.errorType || "SchedulerError",
|
|
@@ -8017,7 +8031,7 @@ class j extends H {
|
|
|
8017
8031
|
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity = V.HIGH;
|
|
8018
8032
|
}
|
|
8019
8033
|
}
|
|
8020
|
-
class O extends
|
|
8034
|
+
class O extends j {
|
|
8021
8035
|
constructor(t, e) {
|
|
8022
8036
|
super(t, {
|
|
8023
8037
|
errorType: e.context?.errorType || "ConditionError",
|
|
@@ -8090,7 +8104,7 @@ class O extends H {
|
|
|
8090
8104
|
});
|
|
8091
8105
|
}
|
|
8092
8106
|
}
|
|
8093
|
-
const tt = "_System_", _ = "_Dictionary_", et = "id", ot = "_rowId",
|
|
8107
|
+
const tt = "_System_", _ = "_Dictionary_", et = "id", ot = "_rowId", Hr = C.create({
|
|
8094
8108
|
name: tt,
|
|
8095
8109
|
properties: [
|
|
8096
8110
|
T.create({
|
|
@@ -8109,7 +8123,7 @@ const tt = "_System_", _ = "_Dictionary_", et = "id", ot = "_rowId", jr = C.crea
|
|
|
8109
8123
|
collection: !1
|
|
8110
8124
|
})
|
|
8111
8125
|
]
|
|
8112
|
-
}),
|
|
8126
|
+
}), jr = C.create({
|
|
8113
8127
|
name: _,
|
|
8114
8128
|
properties: [
|
|
8115
8129
|
T.create({
|
|
@@ -8318,19 +8332,23 @@ class Ur {
|
|
|
8318
8332
|
const Dt = "_ASYNC_TASK_";
|
|
8319
8333
|
class Gr {
|
|
8320
8334
|
constructor(t, e, r, i, s) {
|
|
8321
|
-
this.controller = t, this.
|
|
8335
|
+
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new Ur(this.controller, this), this.buildComputationHandleMap(s);
|
|
8322
8336
|
const a = [];
|
|
8323
|
-
|
|
8324
|
-
o.computation && a.push({ dataContext: { type: "
|
|
8337
|
+
i.forEach((o) => {
|
|
8338
|
+
o.computation && a.push({ dataContext: { type: "global", id: o }, args: o.computation });
|
|
8339
|
+
}), e.forEach((o) => {
|
|
8340
|
+
o.computation && a.push({ dataContext: { type: "entity", id: o }, args: o.computation });
|
|
8341
|
+
}), r.forEach((o) => {
|
|
8342
|
+
const n = o;
|
|
8343
|
+
n.computation && a.push({ dataContext: { type: "relation", id: o }, args: n.computation });
|
|
8344
|
+
}), e.forEach((o) => {
|
|
8345
|
+
o.properties?.forEach((n) => {
|
|
8325
8346
|
n.computation && a.push({ dataContext: { type: "property", host: o, id: n }, args: n.computation });
|
|
8326
8347
|
});
|
|
8327
8348
|
}), r.forEach((o) => {
|
|
8328
|
-
|
|
8329
|
-
n.computation && a.push({ dataContext: { type: "relation", id: o }, args: n.computation }), n.properties && n.properties.forEach((c) => {
|
|
8349
|
+
o.properties?.forEach((c) => {
|
|
8330
8350
|
c.computation && a.push({ dataContext: { type: "property", host: o, id: c }, args: c.computation });
|
|
8331
8351
|
});
|
|
8332
|
-
}), i.forEach((o) => {
|
|
8333
|
-
o.computation && a.push({ dataContext: { type: "global", id: o.name }, args: o.computation });
|
|
8334
8352
|
});
|
|
8335
8353
|
for (const o of a) {
|
|
8336
8354
|
const n = o.dataContext, c = o.args, l = this.computationHandleMap.get(c.constructor);
|
|
@@ -8338,7 +8356,7 @@ class Gr {
|
|
|
8338
8356
|
const d = l[n.type];
|
|
8339
8357
|
v(!!d, `cannot find Computation handle for ${c.constructor.displayName || c.constructor.name} with context type ${n.type}`);
|
|
8340
8358
|
const h = new d(this.controller, c, n);
|
|
8341
|
-
if (this.
|
|
8359
|
+
if (this.computationsHandles.set(n.id, h), this.isAsyncComputation(h)) {
|
|
8342
8360
|
if (h.dataContext.type === "property") {
|
|
8343
8361
|
const p = C.create({
|
|
8344
8362
|
name: this.getAsyncTaskRecordKey(h),
|
|
@@ -8455,11 +8473,11 @@ class Gr {
|
|
|
8455
8473
|
}
|
|
8456
8474
|
}
|
|
8457
8475
|
getBoundStateName(t, e, r) {
|
|
8458
|
-
return `_${t.type === "property" ? `${t.host.name}_${t.id.name}` : t.
|
|
8476
|
+
return `_${t.type === "property" ? `${t.host.name}_${t.id.name}` : t.id.name}_bound_${e}`;
|
|
8459
8477
|
}
|
|
8460
8478
|
createStates() {
|
|
8461
8479
|
const t = [];
|
|
8462
|
-
for (const e of this.
|
|
8480
|
+
for (const e of this.computationsHandles.values())
|
|
8463
8481
|
if (e.createState) {
|
|
8464
8482
|
const r = e.createState();
|
|
8465
8483
|
t.push({ dataContext: e.dataContext, state: r }), e.state = r;
|
|
@@ -8472,12 +8490,16 @@ class Gr {
|
|
|
8472
8490
|
else if (e.dataContext.type === "relation")
|
|
8473
8491
|
s.record = e.dataContext.id.name;
|
|
8474
8492
|
else
|
|
8475
|
-
throw new Error(`global data context ${e.dataContext.id} must specify record name for RecordBoundState`);
|
|
8493
|
+
throw new Error(`global data context ${e.dataContext.id.name} must specify record name for RecordBoundState`);
|
|
8476
8494
|
}
|
|
8477
8495
|
return t;
|
|
8478
8496
|
}
|
|
8497
|
+
async createStateData(t, ...e) {
|
|
8498
|
+
const r = this.computationsHandles.get(t);
|
|
8499
|
+
return v(!!r, "cannot find computation handle"), r.createStateData?.(...e) ?? {};
|
|
8500
|
+
}
|
|
8479
8501
|
async setupDefaultValues() {
|
|
8480
|
-
for (const t of this.
|
|
8502
|
+
for (const t of this.computationsHandles.values())
|
|
8481
8503
|
if (t.getDefaultValue)
|
|
8482
8504
|
if (t.dataContext.type === "global" || t.dataContext.type === "entity" || t.dataContext.type === "relation") {
|
|
8483
8505
|
const e = await t.getDefaultValue();
|
|
@@ -8493,8 +8515,8 @@ class Gr {
|
|
|
8493
8515
|
});
|
|
8494
8516
|
}
|
|
8495
8517
|
}
|
|
8496
|
-
async
|
|
8497
|
-
for (const t of this.
|
|
8518
|
+
async setupGlobalBoundStateDefaultValues() {
|
|
8519
|
+
for (const t of this.computationsHandles.values()) {
|
|
8498
8520
|
const e = t;
|
|
8499
8521
|
if (e.state)
|
|
8500
8522
|
for (const r of Object.values(e.state))
|
|
@@ -8502,7 +8524,7 @@ class Gr {
|
|
|
8502
8524
|
}
|
|
8503
8525
|
}
|
|
8504
8526
|
async setupMutationListeners() {
|
|
8505
|
-
this.sourceMapManager.initialize(this.
|
|
8527
|
+
this.sourceMapManager.initialize(new Set(this.computationsHandles.values())), this.dataSourceMapTree = this.sourceMapManager.getSourceMapTree(), this.controller.system.storage.listen(async (t) => {
|
|
8506
8528
|
for (let e of t) {
|
|
8507
8529
|
const r = this.sourceMapManager.findSourceMapsForMutation(e);
|
|
8508
8530
|
if (r.length > 0)
|
|
@@ -8621,7 +8643,7 @@ class Gr {
|
|
|
8621
8643
|
}
|
|
8622
8644
|
}
|
|
8623
8645
|
} catch (r) {
|
|
8624
|
-
throw r instanceof Q ? r : new
|
|
8646
|
+
throw r instanceof Q ? r : new H("Unexpected error in dirty records computation", {
|
|
8625
8647
|
schedulingPhase: "dirty-records-processing",
|
|
8626
8648
|
failedComputations: [t.computation.args.constructor.displayName],
|
|
8627
8649
|
causedBy: r instanceof Error ? r : new Error(String(r))
|
|
@@ -8632,7 +8654,7 @@ class Gr {
|
|
|
8632
8654
|
if (t.dataContext.type === "property") {
|
|
8633
8655
|
const e = t.dataContext;
|
|
8634
8656
|
return `${Dt}_${e.host.name}_${e.id.name}`;
|
|
8635
|
-
} else return t.dataContext.type === "global" ? `${Dt}_${t.dataContext.id}` : `${Dt}_${t.dataContext.type}_${t.dataContext.id?.name
|
|
8657
|
+
} else return t.dataContext.type === "global" ? `${Dt}_${t.dataContext.id.name}` : `${Dt}_${t.dataContext.type}_${t.dataContext.id?.name}`;
|
|
8636
8658
|
}
|
|
8637
8659
|
async createAsyncTask(t, e, r, i) {
|
|
8638
8660
|
if (t.dataContext.type === "property")
|
|
@@ -8850,15 +8872,15 @@ class Gr {
|
|
|
8850
8872
|
try {
|
|
8851
8873
|
await this.setupDefaultValues();
|
|
8852
8874
|
} catch (t) {
|
|
8853
|
-
throw new
|
|
8875
|
+
throw new H("Failed to setup computation default values", {
|
|
8854
8876
|
schedulingPhase: "default-values-setup",
|
|
8855
8877
|
causedBy: t instanceof Error ? t : new Error(String(t))
|
|
8856
8878
|
});
|
|
8857
8879
|
}
|
|
8858
8880
|
try {
|
|
8859
|
-
await this.
|
|
8881
|
+
await this.setupGlobalBoundStateDefaultValues();
|
|
8860
8882
|
} catch (t) {
|
|
8861
|
-
throw new
|
|
8883
|
+
throw new H("Failed to setup computation state default values", {
|
|
8862
8884
|
schedulingPhase: "state-default-values-setup",
|
|
8863
8885
|
causedBy: t instanceof Error ? t : new Error(String(t))
|
|
8864
8886
|
});
|
|
@@ -8866,7 +8888,7 @@ class Gr {
|
|
|
8866
8888
|
try {
|
|
8867
8889
|
await this.setupMutationListeners();
|
|
8868
8890
|
} catch (t) {
|
|
8869
|
-
throw new
|
|
8891
|
+
throw new H("Failed to setup mutation listeners for computations", {
|
|
8870
8892
|
schedulingPhase: "mutation-listeners-setup",
|
|
8871
8893
|
causedBy: t instanceof Error ? t : new Error(String(t))
|
|
8872
8894
|
});
|
|
@@ -8874,13 +8896,13 @@ class Gr {
|
|
|
8874
8896
|
try {
|
|
8875
8897
|
await this.setupGlobalDict();
|
|
8876
8898
|
} catch (t) {
|
|
8877
|
-
throw new
|
|
8899
|
+
throw new H("Failed to setup global dictionary", {
|
|
8878
8900
|
schedulingPhase: "global-dict-setup",
|
|
8879
8901
|
causedBy: t instanceof Error ? t : new Error(String(t))
|
|
8880
8902
|
});
|
|
8881
8903
|
}
|
|
8882
8904
|
} catch (t) {
|
|
8883
|
-
throw t instanceof
|
|
8905
|
+
throw t instanceof H ? t : new H("Unexpected error during scheduler setup", {
|
|
8884
8906
|
schedulingPhase: "top-level-setup",
|
|
8885
8907
|
causedBy: t instanceof Error ? t : new Error(String(t))
|
|
8886
8908
|
});
|
|
@@ -9046,14 +9068,9 @@ class Ae {
|
|
|
9046
9068
|
let e;
|
|
9047
9069
|
if (C.is(this.interaction.data) || P.is(this.interaction.data)) {
|
|
9048
9070
|
const r = this.interaction.data.name, i = Object.fromEntries(
|
|
9049
|
-
this.interaction.query?.items?.map((
|
|
9050
|
-
), s = i.modifier;
|
|
9051
|
-
|
|
9052
|
-
let a = i.match, o;
|
|
9053
|
-
a && typeof a == "object" && "raw" in a ? o = a : a && (o = R.fromValue(a));
|
|
9054
|
-
const n = { ...t.query?.modifier || {}, ...s || {} }, c = t.query?.attributeQuery || [];
|
|
9055
|
-
let l = t.query?.match;
|
|
9056
|
-
o && l ? l = o.and(l) : o && (l = o), e = await this.system.storage.find(r, l, n, c);
|
|
9071
|
+
this.interaction.query?.items?.map((p) => [p.name, p.value]) || []
|
|
9072
|
+
), { match: s, modifier: a, attributeQuery: o } = i, n = { ...t.query?.modifier || {}, ...a || {} }, c = t.query?.attributeQuery || [], l = typeof s == "function" ? await s.call(this.controller, t) : s, d = l instanceof R ? l : l ? R.atom(l) : void 0, h = R.and(d, t.query?.match);
|
|
9073
|
+
e = await this.system.storage.find(r, h, n, c);
|
|
9057
9074
|
} else
|
|
9058
9075
|
v(!1, `unknown data type ${this.interaction.data}`);
|
|
9059
9076
|
return e;
|
|
@@ -9627,7 +9644,7 @@ class Li {
|
|
|
9627
9644
|
}
|
|
9628
9645
|
async retrieveLastValue(t, e) {
|
|
9629
9646
|
if (t.type === "global")
|
|
9630
|
-
return this.system.storage.dict.get(t.id);
|
|
9647
|
+
return this.system.storage.dict.get(t.id.name);
|
|
9631
9648
|
if (t.type === "entity" || t.type === "relation")
|
|
9632
9649
|
return this.system.storage.find(t.id.name, void 0, void 0, ["*"]);
|
|
9633
9650
|
{
|
|
@@ -9638,7 +9655,7 @@ class Li {
|
|
|
9638
9655
|
async applyResult(t, e, r) {
|
|
9639
9656
|
if (!(e instanceof kt)) {
|
|
9640
9657
|
if (t.type === "global")
|
|
9641
|
-
return this.system.storage.dict.set(t.id, e);
|
|
9658
|
+
return this.system.storage.dict.set(t.id.name, e);
|
|
9642
9659
|
if (t.type === "entity") {
|
|
9643
9660
|
if (e == null) return;
|
|
9644
9661
|
const i = t;
|
|
@@ -9664,7 +9681,7 @@ class Li {
|
|
|
9664
9681
|
const i = Array.isArray(e) ? e : [e];
|
|
9665
9682
|
for (const s of i) {
|
|
9666
9683
|
if (t.type === "global")
|
|
9667
|
-
return this.system.storage.dict.set(t.id, s);
|
|
9684
|
+
return this.system.storage.dict.set(t.id.name, s);
|
|
9668
9685
|
if (t.type === "entity" || t.type === "relation") {
|
|
9669
9686
|
const a = t;
|
|
9670
9687
|
if (s.type === "insert")
|
|
@@ -10005,7 +10022,7 @@ class _i {
|
|
|
10005
10022
|
}
|
|
10006
10023
|
});
|
|
10007
10024
|
}), this.storage.setup(
|
|
10008
|
-
[...a,
|
|
10025
|
+
[...a, jr, Hr],
|
|
10009
10026
|
o,
|
|
10010
10027
|
i
|
|
10011
10028
|
);
|
|
@@ -10119,7 +10136,7 @@ let di = class {
|
|
|
10119
10136
|
return he();
|
|
10120
10137
|
}
|
|
10121
10138
|
};
|
|
10122
|
-
class
|
|
10139
|
+
class Hi {
|
|
10123
10140
|
constructor(t, e = {}) {
|
|
10124
10141
|
this.database = t, this.options = e, this.idSystem = new di(this), this.logger = this.options?.logger || Rt, this.db = new Pe(this.database);
|
|
10125
10142
|
}
|
|
@@ -10248,7 +10265,7 @@ class hi {
|
|
|
10248
10265
|
return e === void 0 ? await this.db.scheme(`INSERT INTO "_IDS_" (name, last) VALUES ('${t}', ${r})`, i) : await this.db.update('UPDATE "_IDS_" SET last = ? WHERE name = ?', [r, t], void 0, i), r;
|
|
10249
10266
|
}
|
|
10250
10267
|
}
|
|
10251
|
-
class
|
|
10268
|
+
class ji {
|
|
10252
10269
|
constructor(t, e = {}) {
|
|
10253
10270
|
this.database = t, this.options = e, this.idSystem = new hi(this), this.logger = this.options?.logger || Rt;
|
|
10254
10271
|
}
|
|
@@ -10330,7 +10347,7 @@ class Hi {
|
|
|
10330
10347
|
}
|
|
10331
10348
|
export {
|
|
10332
10349
|
Tt as ACTIVITY_RECORD,
|
|
10333
|
-
|
|
10350
|
+
He as ALL_ATTR_SYMBOL,
|
|
10334
10351
|
Dt as ASYNC_TASK_RECORD,
|
|
10335
10352
|
Ct as Action,
|
|
10336
10353
|
Jt as Activity,
|
|
@@ -10359,7 +10376,7 @@ export {
|
|
|
10359
10376
|
ve as ComputationResultResolved,
|
|
10360
10377
|
kt as ComputationResultSkip,
|
|
10361
10378
|
ce as ComputationStateError,
|
|
10362
|
-
|
|
10379
|
+
Ht as Condition,
|
|
10363
10380
|
O as ConditionError,
|
|
10364
10381
|
Mt as Conditions,
|
|
10365
10382
|
Li as Controller,
|
|
@@ -10372,10 +10389,10 @@ export {
|
|
|
10372
10389
|
dr as DBSetup,
|
|
10373
10390
|
Fi as DELETED_STATE,
|
|
10374
10391
|
_ as DICTIONARY_RECORD,
|
|
10375
|
-
|
|
10392
|
+
jt as DataAttributive,
|
|
10376
10393
|
zt as DataAttributives,
|
|
10377
10394
|
Bt as Dictionary,
|
|
10378
|
-
|
|
10395
|
+
jr as DictionaryEntity,
|
|
10379
10396
|
C as Entity,
|
|
10380
10397
|
_r as EntityCustomHandle,
|
|
10381
10398
|
Ye as EntityQueryHandle,
|
|
@@ -10411,11 +10428,11 @@ export {
|
|
|
10411
10428
|
m as MatchExp,
|
|
10412
10429
|
Je as Modifier,
|
|
10413
10430
|
_i as MonoSystem,
|
|
10414
|
-
|
|
10431
|
+
ji as MysqlDB,
|
|
10415
10432
|
Oi as NON_DELETED_STATE,
|
|
10416
10433
|
Di as NON_EXIST_STATE,
|
|
10417
10434
|
L as NewRecordData,
|
|
10418
|
-
|
|
10435
|
+
Hi as PGLiteDB,
|
|
10419
10436
|
Xt as Payload,
|
|
10420
10437
|
Kt as PayloadItem,
|
|
10421
10438
|
Wi as PostgreSQLDB,
|
|
@@ -10458,7 +10475,7 @@ export {
|
|
|
10458
10475
|
ht as Summation,
|
|
10459
10476
|
Fr as SummationHandles,
|
|
10460
10477
|
re as SystemConsoleLogger,
|
|
10461
|
-
|
|
10478
|
+
Hr as SystemEntity,
|
|
10462
10479
|
ci as SystemLogLevel,
|
|
10463
10480
|
ye as Transfer,
|
|
10464
10481
|
xt as Transform,
|