interaqt 1.5.2 → 1.5.4
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 +919 -897
- package/dist/index.js.map +1 -1
- package/dist/runtime/Controller.d.ts.map +1 -1
- package/dist/runtime/migration.d.ts +1 -0
- package/dist/runtime/migration.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { AsyncLocalStorage as
|
|
2
|
-
import { AsyncLocalStorage as
|
|
1
|
+
import { AsyncLocalStorage as Ri } from "node:async_hooks";
|
|
2
|
+
import { AsyncLocalStorage as Ni } from "async_hooks";
|
|
3
3
|
import { createHash as Wi } from "node:crypto";
|
|
4
|
-
function
|
|
4
|
+
function vi(c) {
|
|
5
5
|
return c !== null && typeof c == "object";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
if (!
|
|
7
|
+
function Ei(c) {
|
|
8
|
+
if (!vi(c)) return !1;
|
|
9
9
|
const t = Object.getPrototypeOf(c);
|
|
10
10
|
return t === null ? !0 : t === Object.prototype || t === null;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function us(c, t) {
|
|
13
13
|
const e = {};
|
|
14
14
|
for (const i of c)
|
|
15
15
|
i && i[t] !== void 0 && (e[String(i[t])] = i);
|
|
16
16
|
return e;
|
|
17
17
|
}
|
|
18
18
|
function k(c) {
|
|
19
|
-
return typeof c == "function" ? `func::${c.toString()}` : Array.isArray(c) ? c :
|
|
19
|
+
return typeof c == "function" ? `func::${c.toString()}` : Array.isArray(c) ? c : vi(c) && !Ei(c) ? `uuid::${c.uuid}` : c;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Bt(c, t) {
|
|
22
22
|
if (c == null || typeof c != "object") return c;
|
|
23
|
-
if (Array.isArray(c)) return c.map((i) =>
|
|
24
|
-
if (
|
|
25
|
-
return Object.fromEntries(Object.entries(c).map(([i, r]) => [i,
|
|
23
|
+
if (Array.isArray(c)) return c.map((i) => Bt(i, t));
|
|
24
|
+
if (Ei(c))
|
|
25
|
+
return Object.fromEntries(Object.entries(c).map(([i, r]) => [i, Bt(r, t)]));
|
|
26
26
|
if (c instanceof Set)
|
|
27
|
-
return new Set(Array.from(c.values()).map((i) =>
|
|
27
|
+
return new Set(Array.from(c.values()).map((i) => Bt(i, t)));
|
|
28
28
|
if (c instanceof Map)
|
|
29
|
-
return new Map(Array.from(c.entries()).map(([i, r]) => [i,
|
|
29
|
+
return new Map(Array.from(c.entries()).map(([i, r]) => [i, Bt(r, t)]));
|
|
30
30
|
const e = c;
|
|
31
31
|
return t && e._type && e.constructor?.clone ? e.constructor.clone(c, t) : c;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ds(...c) {
|
|
34
34
|
for (const t of c)
|
|
35
35
|
t.instances.length = 0;
|
|
36
36
|
}
|
|
37
37
|
const Ce = /* @__PURE__ */ new Map();
|
|
38
|
-
function
|
|
38
|
+
function Ti(c, t) {
|
|
39
39
|
t && t.isKlass && t.displayName && Ce.set(c, t);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function hs() {
|
|
42
42
|
const c = [];
|
|
43
43
|
return Array.from(Ce.entries()).forEach(([, t]) => {
|
|
44
44
|
t.instances && Array.isArray(t.instances) && t.stringify && c.push(...t.instances.map((e) => t.stringify(e)));
|
|
45
45
|
}), `[${c.join(",")}]`;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ps(c) {
|
|
48
48
|
const t = JSON.parse(c);
|
|
49
49
|
return Gi(t);
|
|
50
50
|
}
|
|
@@ -60,11 +60,11 @@ function Gi(c) {
|
|
|
60
60
|
t.set(r, n);
|
|
61
61
|
}), t;
|
|
62
62
|
}
|
|
63
|
-
let
|
|
63
|
+
let Ki = 0;
|
|
64
64
|
function A(c) {
|
|
65
|
-
return c?.uuid || `id_${++
|
|
65
|
+
return c?.uuid || `id_${++Ki}`;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const Ji = /^[a-zA-Z0-9_]+$/;
|
|
68
68
|
class D {
|
|
69
69
|
constructor(t, e) {
|
|
70
70
|
this._type = "Entity", this._options = e, this.uuid = A(e), this.name = t.name, this.properties = t.properties || [], this.computation = t.computation, this.baseEntity = t.baseEntity, this.matchExpression = t.matchExpression, this.inputEntities = t.inputEntities, this.commonProperties = t.commonProperties, this.constraints = t.constraints;
|
|
@@ -84,7 +84,7 @@ class D {
|
|
|
84
84
|
type: "string",
|
|
85
85
|
required: !0,
|
|
86
86
|
constraints: {
|
|
87
|
-
nameFormat: ({ name: t }) =>
|
|
87
|
+
nameFormat: ({ name: t }) => Ji.test(t)
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
properties: {
|
|
@@ -550,7 +550,7 @@ class F {
|
|
|
550
550
|
return this.create(e.public, e.options);
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
const
|
|
553
|
+
const Si = /^[a-zA-Z0-9_]+$/;
|
|
554
554
|
class Zt {
|
|
555
555
|
constructor(t, e) {
|
|
556
556
|
this._type = "UniqueConstraint", this._options = e, this.uuid = A(e), this.name = t.name, this.properties = t.properties, this.where = t.where, this.violationCode = t.violationCode;
|
|
@@ -570,7 +570,7 @@ class Zt {
|
|
|
570
570
|
type: "string",
|
|
571
571
|
required: !0,
|
|
572
572
|
constraints: {
|
|
573
|
-
nameFormat: ({ name: t }) =>
|
|
573
|
+
nameFormat: ({ name: t }) => Si.test(t)
|
|
574
574
|
}
|
|
575
575
|
},
|
|
576
576
|
properties: {
|
|
@@ -633,7 +633,7 @@ class Zt {
|
|
|
633
633
|
return this.create(e.public, e.options);
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
class
|
|
636
|
+
class ki {
|
|
637
637
|
constructor(t, e) {
|
|
638
638
|
this._type = "NonNullConstraint", this._options = e, this.uuid = A(e), this.name = t.name, this.property = t.property, this.violationCode = t.violationCode;
|
|
639
639
|
}
|
|
@@ -652,7 +652,7 @@ class Si {
|
|
|
652
652
|
type: "string",
|
|
653
653
|
required: !0,
|
|
654
654
|
constraints: {
|
|
655
|
-
nameFormat: ({ name: t }) =>
|
|
655
|
+
nameFormat: ({ name: t }) => Si.test(t)
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
658
|
property: {
|
|
@@ -666,7 +666,7 @@ class Si {
|
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
668
|
static create(t, e) {
|
|
669
|
-
const i = new
|
|
669
|
+
const i = new ki(t, e);
|
|
670
670
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
671
671
|
throw new Error(`duplicate uuid in options ${i.uuid}, NonNullConstraint`);
|
|
672
672
|
return this.instances.push(i), i;
|
|
@@ -702,7 +702,7 @@ class Si {
|
|
|
702
702
|
return this.create(e.public, e.options);
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
class
|
|
705
|
+
class yt {
|
|
706
706
|
constructor(t, e) {
|
|
707
707
|
this._type = "StateNode", this._options = e, this.uuid = A(e), this.name = t.name, this.computeValue = t.computeValue;
|
|
708
708
|
}
|
|
@@ -730,7 +730,7 @@ class mt {
|
|
|
730
730
|
};
|
|
731
731
|
}
|
|
732
732
|
static create(t, e) {
|
|
733
|
-
const i = new
|
|
733
|
+
const i = new yt(t, e);
|
|
734
734
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
735
735
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateNode`);
|
|
736
736
|
return this.instances.push(i), i;
|
|
@@ -842,7 +842,7 @@ class xe {
|
|
|
842
842
|
return this.create(e.public, e.options);
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
-
class
|
|
845
|
+
class Ct {
|
|
846
846
|
constructor(t, e) {
|
|
847
847
|
this._type = "StateMachine", this._options = e, this.uuid = A(e), this.states = t.states, this.transfers = t.transfers, this.initialState = t.initialState;
|
|
848
848
|
}
|
|
@@ -875,7 +875,7 @@ class At {
|
|
|
875
875
|
};
|
|
876
876
|
}
|
|
877
877
|
static create(t, e) {
|
|
878
|
-
const i = new
|
|
878
|
+
const i = new Ct(t, e);
|
|
879
879
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
880
880
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateMachine`);
|
|
881
881
|
return this.instances.push(i), i;
|
|
@@ -911,7 +911,7 @@ class At {
|
|
|
911
911
|
return this.create(e.public, e.options);
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
class
|
|
914
|
+
class $t {
|
|
915
915
|
constructor(t, e) {
|
|
916
916
|
this._type = "WeightedSummation", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps;
|
|
917
917
|
}
|
|
@@ -959,7 +959,7 @@ class Ct {
|
|
|
959
959
|
};
|
|
960
960
|
}
|
|
961
961
|
static create(t, e) {
|
|
962
|
-
const i = new
|
|
962
|
+
const i = new $t(t, e);
|
|
963
963
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
964
964
|
throw new Error(`duplicate uuid in options ${i.uuid}, WeightedSummation`);
|
|
965
965
|
return this.instances.push(i), i;
|
|
@@ -1001,7 +1001,7 @@ class Ct {
|
|
|
1001
1001
|
return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
|
-
class
|
|
1004
|
+
class It {
|
|
1005
1005
|
constructor(t, e) {
|
|
1006
1006
|
this._type = "Count", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps;
|
|
1007
1007
|
}
|
|
@@ -1044,7 +1044,7 @@ class $t {
|
|
|
1044
1044
|
};
|
|
1045
1045
|
}
|
|
1046
1046
|
static create(t, e) {
|
|
1047
|
-
const i = new
|
|
1047
|
+
const i = new It(t, e);
|
|
1048
1048
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1049
1049
|
throw new Error(`duplicate uuid in options ${i.uuid}, Count`);
|
|
1050
1050
|
return this.instances.push(i), i;
|
|
@@ -1085,7 +1085,7 @@ class $t {
|
|
|
1085
1085
|
return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
-
class
|
|
1088
|
+
class xt {
|
|
1089
1089
|
constructor(t, e) {
|
|
1090
1090
|
this._type = "Summation", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.attributeQuery = t.attributeQuery;
|
|
1091
1091
|
}
|
|
@@ -1118,7 +1118,7 @@ class It {
|
|
|
1118
1118
|
};
|
|
1119
1119
|
}
|
|
1120
1120
|
static create(t, e) {
|
|
1121
|
-
const i = new
|
|
1121
|
+
const i = new xt(t, e);
|
|
1122
1122
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1123
1123
|
throw new Error(`duplicate uuid in options ${i.uuid}, Summation`);
|
|
1124
1124
|
return this.instances.push(i), i;
|
|
@@ -1153,7 +1153,7 @@ class It {
|
|
|
1153
1153
|
return this.create(e.public, e.options);
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
|
-
class
|
|
1156
|
+
class Mt {
|
|
1157
1157
|
constructor(t, e) {
|
|
1158
1158
|
this._type = "Average", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.attributeQuery = t.attributeQuery;
|
|
1159
1159
|
}
|
|
@@ -1186,7 +1186,7 @@ class xt {
|
|
|
1186
1186
|
};
|
|
1187
1187
|
}
|
|
1188
1188
|
static create(t, e) {
|
|
1189
|
-
const i = new
|
|
1189
|
+
const i = new Mt(t, e);
|
|
1190
1190
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1191
1191
|
throw new Error(`duplicate uuid in options ${i.uuid}, Average`);
|
|
1192
1192
|
return this.instances.push(i), i;
|
|
@@ -1221,7 +1221,7 @@ class xt {
|
|
|
1221
1221
|
return this.create(e.public, e.options);
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
|
-
class
|
|
1224
|
+
class Pt {
|
|
1225
1225
|
constructor(t, e) {
|
|
1226
1226
|
this._type = "Every", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps, this.notEmpty = t.notEmpty;
|
|
1227
1227
|
}
|
|
@@ -1269,7 +1269,7 @@ class Mt {
|
|
|
1269
1269
|
};
|
|
1270
1270
|
}
|
|
1271
1271
|
static create(t, e) {
|
|
1272
|
-
const i = new
|
|
1272
|
+
const i = new Pt(t, e);
|
|
1273
1273
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1274
1274
|
throw new Error(`duplicate uuid in options ${i.uuid}, Every`);
|
|
1275
1275
|
return this.instances.push(i), i;
|
|
@@ -1306,7 +1306,7 @@ class Mt {
|
|
|
1306
1306
|
return typeof r.callback == "string" && r.callback.startsWith("func::") && (i.callback = new Function("return " + r.callback.substring(6))()), this.create(i, e.options);
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
|
-
class
|
|
1309
|
+
class Dt {
|
|
1310
1310
|
constructor(t, e) {
|
|
1311
1311
|
this._type = "Any", this._options = e, this.uuid = A(e), this.record = t.record, this.property = t.property, this.direction = t.direction, this.callback = t.callback, this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps;
|
|
1312
1312
|
}
|
|
@@ -1354,7 +1354,7 @@ class Pt {
|
|
|
1354
1354
|
};
|
|
1355
1355
|
}
|
|
1356
1356
|
static create(t, e) {
|
|
1357
|
-
const i = new
|
|
1357
|
+
const i = new Dt(t, e);
|
|
1358
1358
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1359
1359
|
throw new Error(`duplicate uuid in options ${i.uuid}, Any`);
|
|
1360
1360
|
return this.instances.push(i), i;
|
|
@@ -1466,7 +1466,7 @@ class te {
|
|
|
1466
1466
|
return typeof i.callback == "string" && i.callback.startsWith("func::") && (i.callback = new Function("return " + i.callback.substring(6))()), this.create(i, e.options);
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
|
-
class
|
|
1469
|
+
class Ot {
|
|
1470
1470
|
constructor(t, e) {
|
|
1471
1471
|
this._type = "RealTimeValue", this._options = e, this.uuid = A(e), this.attributeQuery = t.attributeQuery, this.dataDeps = t.dataDeps, this.nextRecomputeTime = t.nextRecomputeTime, this.callback = t.callback;
|
|
1472
1472
|
}
|
|
@@ -1504,7 +1504,7 @@ class Dt {
|
|
|
1504
1504
|
};
|
|
1505
1505
|
}
|
|
1506
1506
|
static create(t, e) {
|
|
1507
|
-
const i = new
|
|
1507
|
+
const i = new Ot(t, e);
|
|
1508
1508
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1509
1509
|
throw new Error(`duplicate uuid in options ${i.uuid}, RealTimeValue`);
|
|
1510
1510
|
return this.instances.push(i), i;
|
|
@@ -1601,7 +1601,7 @@ class Me {
|
|
|
1601
1601
|
return typeof r.handle == "string" && r.handle.startsWith("func::") && (i.handle = new Function("return " + r.handle.substring(6))()), this.create(i, e.options);
|
|
1602
1602
|
}
|
|
1603
1603
|
}
|
|
1604
|
-
class
|
|
1604
|
+
class Ft {
|
|
1605
1605
|
constructor(t, e) {
|
|
1606
1606
|
this._type = "BoolAtomData", this._options = e, this.uuid = A(e), this.type = t.type || "atom", this.data = t.data;
|
|
1607
1607
|
}
|
|
@@ -1630,7 +1630,7 @@ class Ot {
|
|
|
1630
1630
|
};
|
|
1631
1631
|
}
|
|
1632
1632
|
static create(t, e) {
|
|
1633
|
-
const i = new
|
|
1633
|
+
const i = new Ft(t, e);
|
|
1634
1634
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1635
1635
|
throw new Error(`duplicate uuid in options ${i.uuid}, BoolAtomData`);
|
|
1636
1636
|
return this.instances.push(i), i;
|
|
@@ -1648,7 +1648,7 @@ class Ot {
|
|
|
1648
1648
|
return t !== null && typeof t == "object" && typeof t.uuid == "string";
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
class
|
|
1651
|
+
class Lt {
|
|
1652
1652
|
constructor(t, e) {
|
|
1653
1653
|
this._type = "BoolExpressionData", this._options = e, this.uuid = A(e), this.type = t.type || "expression", this.operator = t.operator || "and", this.left = t.left, this.right = t.right;
|
|
1654
1654
|
}
|
|
@@ -1689,7 +1689,7 @@ class Ft {
|
|
|
1689
1689
|
};
|
|
1690
1690
|
}
|
|
1691
1691
|
static create(t, e) {
|
|
1692
|
-
const i = new
|
|
1692
|
+
const i = new Lt(t, e);
|
|
1693
1693
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
1694
1694
|
throw new Error(`duplicate uuid in options ${i.uuid}, BoolExpressionData`);
|
|
1695
1695
|
return this.instances.push(i), i;
|
|
@@ -1889,24 +1889,24 @@ const Yi = [
|
|
|
1889
1889
|
F,
|
|
1890
1890
|
T,
|
|
1891
1891
|
Zt,
|
|
1892
|
-
|
|
1892
|
+
yt,
|
|
1893
1893
|
xe,
|
|
1894
|
-
At,
|
|
1895
1894
|
Ct,
|
|
1896
1895
|
$t,
|
|
1897
1896
|
It,
|
|
1898
1897
|
xt,
|
|
1899
1898
|
Mt,
|
|
1900
1899
|
Pt,
|
|
1901
|
-
te,
|
|
1902
1900
|
Dt,
|
|
1901
|
+
te,
|
|
1902
|
+
Ot,
|
|
1903
1903
|
Me,
|
|
1904
1904
|
Ie,
|
|
1905
|
-
|
|
1906
|
-
|
|
1905
|
+
Ft,
|
|
1906
|
+
Lt
|
|
1907
1907
|
];
|
|
1908
1908
|
Yi.forEach((c) => {
|
|
1909
|
-
c && c.displayName &&
|
|
1909
|
+
c && c.displayName && Ti(c.displayName, c);
|
|
1910
1910
|
});
|
|
1911
1911
|
class ge {
|
|
1912
1912
|
constructor(t = [], e = []) {
|
|
@@ -2234,7 +2234,7 @@ class Pe {
|
|
|
2234
2234
|
}), this.create(i, e.options);
|
|
2235
2235
|
}
|
|
2236
2236
|
}
|
|
2237
|
-
class
|
|
2237
|
+
class Ai {
|
|
2238
2238
|
constructor(t, e) {
|
|
2239
2239
|
this._type = "EventSource", this._options = e, this.uuid = A(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, this.postCommit = t.postCommit;
|
|
2240
2240
|
}
|
|
@@ -2248,7 +2248,7 @@ class ki {
|
|
|
2248
2248
|
this.instances = [];
|
|
2249
2249
|
}
|
|
2250
2250
|
static create(t, e) {
|
|
2251
|
-
const i = new
|
|
2251
|
+
const i = new Ai(t, e);
|
|
2252
2252
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
2253
2253
|
throw new Error(`duplicate uuid in options ${i.uuid}, EventSource`);
|
|
2254
2254
|
return this.instances.push(i), i;
|
|
@@ -2481,7 +2481,7 @@ class w {
|
|
|
2481
2481
|
const o = [...s.resolvedPath, n], l = this.map.getInfoByPath(o), u = s.resolvedPath.concat(l?.isLinkFiltered() ? l.getBaseAttributeInfo().attributeName : n);
|
|
2482
2482
|
let d = s.matchExpression;
|
|
2483
2483
|
if (l?.isLinkFiltered()) {
|
|
2484
|
-
const
|
|
2484
|
+
const h = l.getLinkInfo(), f = new w(h.getResolvedBaseRecordName(), this.map, h.getResolvedMatchExpression()), m = this.map.getReversePath(u), y = [l.isRecordSource() ? "source" : "target", ...m.slice(2)], b = f.rebase(y.join("."));
|
|
2485
2485
|
d = d ? d.and(b) : b;
|
|
2486
2486
|
}
|
|
2487
2487
|
return {
|
|
@@ -2529,8 +2529,8 @@ class w {
|
|
|
2529
2529
|
R(!t, "reference value cannot use IN to match"), o = `IN (${i[1].map((d) => s()).join(",")})`, l = i[1];
|
|
2530
2530
|
else if (i[0].toLowerCase() === "between")
|
|
2531
2531
|
if (t) {
|
|
2532
|
-
const d = this.getReferenceFieldValue(i[1][0]),
|
|
2533
|
-
o = `BETWEEN "${d.split(".")[0]}"."${d.split(".")[1]}" AND "${
|
|
2532
|
+
const d = this.getReferenceFieldValue(i[1][0]), h = this.getReferenceFieldValue(i[1][1]);
|
|
2533
|
+
o = `BETWEEN "${d.split(".")[0]}"."${d.split(".")[1]}" AND "${h.split(".")[0]}"."${h.split(".")[1]}"`, l = [];
|
|
2534
2534
|
} else
|
|
2535
2535
|
o = `BETWEEN ${s()} AND ${s()}`, l = [i[1][0], i[1][1]];
|
|
2536
2536
|
else {
|
|
@@ -2544,20 +2544,20 @@ class w {
|
|
|
2544
2544
|
const r = i.data.key.split("."), a = this.map.getInfoByPath([this.entityName].concat(r)), s = [this.entityName].concat(r), n = this.map.spawnManyToManySymmetricPath(s);
|
|
2545
2545
|
let o, l;
|
|
2546
2546
|
if (n && (o = n[0].slice(1, 1 / 0), l = n[1].slice(1, 1 / 0)), a.isValue) {
|
|
2547
|
-
const u = this.getFinalFieldName(r), [d,
|
|
2547
|
+
const u = this.getFinalFieldName(r), [d, h] = this.getFinalFieldValue(i.data.isReferenceValue, i.data.key, i.data.value, u.join("."), a.fieldType, t, e);
|
|
2548
2548
|
if (!n)
|
|
2549
2549
|
return {
|
|
2550
2550
|
...i.data,
|
|
2551
2551
|
fieldName: u,
|
|
2552
2552
|
fieldValue: d,
|
|
2553
|
-
fieldParams:
|
|
2553
|
+
fieldParams: h
|
|
2554
2554
|
};
|
|
2555
2555
|
const [f, m] = this.getFinalFieldValue(i.data.isReferenceValue, i.data.key, i.data.value, u.join("."), a.fieldType, t, e);
|
|
2556
2556
|
return E.atom({
|
|
2557
2557
|
...i.data,
|
|
2558
2558
|
fieldName: this.getFinalFieldName(o),
|
|
2559
2559
|
fieldValue: d,
|
|
2560
|
-
fieldParams:
|
|
2560
|
+
fieldParams: h
|
|
2561
2561
|
}).or({
|
|
2562
2562
|
...i.data,
|
|
2563
2563
|
fieldName: this.getFinalFieldName(l),
|
|
@@ -2688,12 +2688,12 @@ class Zi {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
}
|
|
2690
2690
|
class L {
|
|
2691
|
-
constructor(t, e, i, r, a, s, n, o, l, u = !1, d,
|
|
2692
|
-
this.recordName = t, this.map = e, this.matchExpression = i, this.attributeQuery = r, this.modifier = a, this.contextRootEntity = s, this.parentRecord = n, this.attributeName = o, this.onlyRelationData = l, this.allowNull = u, this.label = d, this.goto =
|
|
2691
|
+
constructor(t, e, i, r, a, s, n, o, l, u = !1, d, h, f, m) {
|
|
2692
|
+
this.recordName = t, this.map = e, this.matchExpression = i, this.attributeQuery = r, this.modifier = a, this.contextRootEntity = s, this.parentRecord = n, this.attributeName = o, this.onlyRelationData = l, this.allowNull = u, this.label = d, this.goto = h, this.exit = f, this.alias = m;
|
|
2693
2693
|
}
|
|
2694
2694
|
static create(t, e, i, r, a, s, n, o = !1, l) {
|
|
2695
|
-
const u = e.getRecordInfo(t), d = u.resolvedBaseRecordName,
|
|
2696
|
-
let f = o ?
|
|
2695
|
+
const u = e.getRecordInfo(t), d = u.resolvedBaseRecordName, h = new w(d, e, i.matchExpression, r);
|
|
2696
|
+
let f = o ? h : h.and({
|
|
2697
2697
|
key: "id",
|
|
2698
2698
|
value: ["not", null]
|
|
2699
2699
|
}), m = f;
|
|
@@ -2802,7 +2802,7 @@ class O {
|
|
|
2802
2802
|
this.recordName = t, this.map = e, this.data = i, this.parentRecord = r, this.attributeName = a, this.shouldQueryParentLinkData = s, this.relatedRecords = [], this.xToManyRecords = [], this.xToOneRecords = [], this.valueAttributes = [], this.id = Math.random();
|
|
2803
2803
|
let n = /* @__PURE__ */ new Set();
|
|
2804
2804
|
i.forEach((o) => {
|
|
2805
|
-
const l = typeof o == "string" ? [o, {}, !1] : o, [u, d,
|
|
2805
|
+
const l = typeof o == "string" ? [o, {}, !1] : o, [u, d, h] = l;
|
|
2806
2806
|
if (u === g) {
|
|
2807
2807
|
R(!!(this.parentRecord && this.attributeName), `parent record and attribute name cannot be empty when query link data, you passed ${this.parentRecord} ${this.attributeName}`);
|
|
2808
2808
|
const m = this.map.getInfo(this.parentRecord, this.attributeName);
|
|
@@ -2815,16 +2815,16 @@ class O {
|
|
|
2815
2815
|
}
|
|
2816
2816
|
const f = this.map.getInfo(this.recordName, u);
|
|
2817
2817
|
if (f.isRecord) {
|
|
2818
|
-
let m = u,
|
|
2818
|
+
let m = u, p = d;
|
|
2819
2819
|
if (f.isLinkFiltered()) {
|
|
2820
2820
|
m = f.getBaseAttributeInfo().attributeName;
|
|
2821
2821
|
const b = d.matchExpression, v = f.getLinkInfo().getBaseLinkInfo(), I = new w(v.name, this.map, f.getMatchExpression()).rebase(f.isRecordSource() ? "target" : "source"), S = b ? I.and(b.data) : I;
|
|
2822
|
-
|
|
2822
|
+
p = {
|
|
2823
2823
|
...d,
|
|
2824
2824
|
matchExpression: S.data
|
|
2825
2825
|
};
|
|
2826
2826
|
}
|
|
2827
|
-
const y = L.create(f.recordName, this.map,
|
|
2827
|
+
const y = L.create(f.recordName, this.map, p, void 0, this.recordName, m, h, !1, u);
|
|
2828
2828
|
this.relatedRecords.push(y), f.isXToMany ? this.xToManyRecords.push(y) : f.isXToOne && this.xToOneRecords.push(y);
|
|
2829
2829
|
} else
|
|
2830
2830
|
n.add(u);
|
|
@@ -2844,7 +2844,7 @@ class O {
|
|
|
2844
2844
|
const n = e.getRecordInfo(t), o = e.getRecordInfo(n.resolvedBaseRecordName);
|
|
2845
2845
|
let l = o.valueAttributes.map((u) => u.attributeName);
|
|
2846
2846
|
return i && o.sameTableReliance.forEach((u) => {
|
|
2847
|
-
const d = O.getAttributeQueryDataForRecord(u.recordName, e, !0, r),
|
|
2847
|
+
const d = O.getAttributeQueryDataForRecord(u.recordName, e, !0, r), h = [
|
|
2848
2848
|
u.attributeName,
|
|
2849
2849
|
{
|
|
2850
2850
|
attributeQuery: [...d]
|
|
@@ -2852,11 +2852,11 @@ class O {
|
|
|
2852
2852
|
];
|
|
2853
2853
|
if (!o.isRelation) {
|
|
2854
2854
|
const f = O.getAttributeQueryDataForRecord(u.linkName, e, !0, r);
|
|
2855
|
-
|
|
2855
|
+
h[1].attributeQuery.push([g, { attributeQuery: f }]);
|
|
2856
2856
|
}
|
|
2857
|
-
l = O.mergeAttributeQueryData(l, [
|
|
2857
|
+
l = O.mergeAttributeQueryData(l, [h]);
|
|
2858
2858
|
}), s && o.notRelianceCombined.forEach((u) => {
|
|
2859
|
-
const d = O.getAttributeQueryDataForRecord(u.recordName, e, !0, r),
|
|
2859
|
+
const d = O.getAttributeQueryDataForRecord(u.recordName, e, !0, r), h = [
|
|
2860
2860
|
u.attributeName,
|
|
2861
2861
|
{
|
|
2862
2862
|
attributeQuery: [...d]
|
|
@@ -2864,9 +2864,9 @@ class O {
|
|
|
2864
2864
|
];
|
|
2865
2865
|
if (!o.isRelation) {
|
|
2866
2866
|
const f = O.getAttributeQueryDataForRecord(u.linkName, e, !0, r);
|
|
2867
|
-
|
|
2867
|
+
h[1].attributeQuery.push([g, { attributeQuery: f }]);
|
|
2868
2868
|
}
|
|
2869
|
-
l = O.mergeAttributeQueryData(l, [
|
|
2869
|
+
l = O.mergeAttributeQueryData(l, [h]);
|
|
2870
2870
|
}), r && o.mergedRecordAttributes.forEach((u) => {
|
|
2871
2871
|
const d = O.getAttributeQueryDataForRecord(u.linkName, e, i, !0);
|
|
2872
2872
|
l = O.mergeAttributeQueryData(l, [
|
|
@@ -2954,8 +2954,8 @@ class j {
|
|
|
2954
2954
|
)), this.valueAttributes = s, this.entityIdAttributes = o;
|
|
2955
2955
|
const l = this.map.getRecordInfo(this.recordName);
|
|
2956
2956
|
this.defaultValues = l.valueAttributes.reduce((u, d) => {
|
|
2957
|
-
const
|
|
2958
|
-
return !this.rawData?.hasOwnProperty(d.attributeName) &&
|
|
2957
|
+
const h = d.data;
|
|
2958
|
+
return !this.rawData?.hasOwnProperty(d.attributeName) && h.defaultValue && typeof h.defaultValue == "function" && (u[d.attributeName] = h.defaultValue(i, this.originalRecordName)), u;
|
|
2959
2959
|
}, {}), this.relatedEntitiesData.forEach((u) => {
|
|
2960
2960
|
u.info.isMergedWithParent() ? u.isNull() ? this.combinedNullRecords.push(u) : u.isRef() ? this.combinedRecordIdRefs.push(u) : this.combinedNewRecords.push(u) : u.info.isLinkMergedWithParent() ? u.isNull() ? this.mergedLinkTargetNullRecords.push(u) : u.isRef() ? this.mergedLinkTargetRecordIdRefs.push(u) : this.mergedLinkTargetNewRecords.push(u) : u.info.isLinkMergedWithAttribute() ? u.isNull() ? this.differentTableMergedLinkNullRecords.push(u) : u.isRef() ? this.differentTableMergedLinkRecordIdRefs.push(u) : this.differentTableMergedLinkNewRecords.push(u) : u.isNull() ? this.isolatedNullRecords.push(u) : u.isRef() ? this.isolatedRecordIdRefs.push(u) : this.isolatedNewRecords.push(u);
|
|
2961
2961
|
}), this.rawData?.[g] && (this.linkRecordData = new j(this.map, r?.linkName, this.rawData[g]));
|
|
@@ -3079,9 +3079,9 @@ class ir {
|
|
|
3079
3079
|
}
|
|
3080
3080
|
});
|
|
3081
3081
|
else if (t.valueAttributes.length) {
|
|
3082
|
-
const o = t.getSameRowFieldAndValue(r), l = this.map.getRecordInfo(t.recordName), u = new Set(l.valueAttributes.map((
|
|
3083
|
-
o.forEach((
|
|
3084
|
-
u.has(
|
|
3082
|
+
const o = t.getSameRowFieldAndValue(r), l = this.map.getRecordInfo(t.recordName), u = new Set(l.valueAttributes.map((h) => h.attributeName)), d = { ...t.getData() };
|
|
3083
|
+
o.forEach((h) => {
|
|
3084
|
+
u.has(h.name) && (d[h.name] = h.value);
|
|
3085
3085
|
}), i?.push({
|
|
3086
3086
|
type: "update",
|
|
3087
3087
|
recordName: t.recordName,
|
|
@@ -3221,11 +3221,11 @@ class ir {
|
|
|
3221
3221
|
R(!n, `cannot create ${t} for ${e} ${i}, link already exist`);
|
|
3222
3222
|
const o = this.map.getLinkInfoByName(t);
|
|
3223
3223
|
if (!o.isCombined() && !o.isMerged() && (o.isManyToOne || o.isOneToMany)) {
|
|
3224
|
-
const u = o.isManyToOne ? "source.id" : "target.id", d = o.isManyToOne ? e : i,
|
|
3224
|
+
const u = o.isManyToOne ? "source.id" : "target.id", d = o.isManyToOne ? e : i, h = w.atom({
|
|
3225
3225
|
key: u,
|
|
3226
3226
|
value: ["=", d]
|
|
3227
3227
|
});
|
|
3228
|
-
await this.helper.unlink(t,
|
|
3228
|
+
await this.helper.unlink(t, h, !1, "unlink combined record for add new link", s);
|
|
3229
3229
|
}
|
|
3230
3230
|
const l = new j(this.map, o.name, {
|
|
3231
3231
|
source: { id: e },
|
|
@@ -3281,11 +3281,11 @@ class rr {
|
|
|
3281
3281
|
for (let l = 1; l < o.length - 1; l++) {
|
|
3282
3282
|
const u = o.slice(0, l + 1), d = this.map.getInfoByPath(u);
|
|
3283
3283
|
if (d && d.isRecord) {
|
|
3284
|
-
const
|
|
3285
|
-
(y) => y.entityName ===
|
|
3284
|
+
const h = d.recordName, f = n.slice(0, l), m = n[n.length - 1], p = i.find(
|
|
3285
|
+
(y) => y.entityName === h && JSON.stringify(y.path) === JSON.stringify(f)
|
|
3286
3286
|
);
|
|
3287
|
-
|
|
3288
|
-
entityName:
|
|
3287
|
+
p ? p.attributes.includes(m) || p.attributes.push(m) : i.push({
|
|
3288
|
+
entityName: h,
|
|
3289
3289
|
path: f,
|
|
3290
3290
|
attributes: [m]
|
|
3291
3291
|
});
|
|
@@ -3385,9 +3385,9 @@ class rr {
|
|
|
3385
3385
|
record: { ...r, id: e }
|
|
3386
3386
|
}));
|
|
3387
3387
|
if (Object.keys(u).length > 0) {
|
|
3388
|
-
const
|
|
3389
|
-
if (
|
|
3390
|
-
const f =
|
|
3388
|
+
const h = this.map.getRecordInfo(t).data.attributes.__filtered_entities;
|
|
3389
|
+
if (h && h.field) {
|
|
3390
|
+
const f = h.field;
|
|
3391
3391
|
await this.queryAgent.updateRecordDataById(
|
|
3392
3392
|
t,
|
|
3393
3393
|
{ id: e },
|
|
@@ -3452,12 +3452,12 @@ class rr {
|
|
|
3452
3452
|
}), n[t.filteredEntityName] = !1), l !== o) {
|
|
3453
3453
|
const d = this.map.getRecordInfo(t.baseEntityName).data.attributes.__filtered_entities;
|
|
3454
3454
|
if (d && d.field) {
|
|
3455
|
-
const
|
|
3455
|
+
const h = d.field;
|
|
3456
3456
|
await this.queryAgent.updateRecordDataById(
|
|
3457
3457
|
t.baseEntityName,
|
|
3458
3458
|
{ id: e },
|
|
3459
3459
|
[{
|
|
3460
|
-
field:
|
|
3460
|
+
field: h,
|
|
3461
3461
|
value: JSON.stringify(n)
|
|
3462
3462
|
}]
|
|
3463
3463
|
);
|
|
@@ -3502,27 +3502,27 @@ class sr {
|
|
|
3502
3502
|
* @returns [SQL字符串, 参数数组, 字段别名映射]
|
|
3503
3503
|
*/
|
|
3504
3504
|
buildXToOneFindQuery(t, e = "", i) {
|
|
3505
|
-
const r = t.attributeQuery.xToOneQueryTree, a = t.matchExpression.xToOneQueryTree, s = t.modifier.xToOneQueryTree, n = r.merge(a).merge(s), o = this.getJoinTables(n, [t.recordName]), l = i || this.getPlaceholder(), u = t.matchExpression.buildFieldMatchExpression(l, this.database), [d,
|
|
3505
|
+
const r = t.attributeQuery.xToOneQueryTree, a = t.matchExpression.xToOneQueryTree, s = t.modifier.xToOneQueryTree, n = r.merge(a).merge(s), o = this.getJoinTables(n, [t.recordName]), l = i || this.getPlaceholder(), u = t.matchExpression.buildFieldMatchExpression(l, this.database), [d, h] = this.buildWhereClause(
|
|
3506
3506
|
this.parseMatchExpressionValue(t.recordName, u, t.contextRootEntity, l),
|
|
3507
3507
|
e,
|
|
3508
3508
|
l
|
|
3509
3509
|
), [f, m] = this.buildSelectClause(
|
|
3510
3510
|
t.attributeQuery.getValueAndXToOneRecordFields(),
|
|
3511
3511
|
e
|
|
3512
|
-
),
|
|
3512
|
+
), p = this.buildFromClause(t.recordName, e), y = this.buildJoinClause(o, e), b = this.buildModifierClause(t.modifier, e, m);
|
|
3513
3513
|
return [
|
|
3514
3514
|
`
|
|
3515
3515
|
SELECT
|
|
3516
3516
|
${f}
|
|
3517
3517
|
FROM
|
|
3518
|
-
${
|
|
3518
|
+
${p}
|
|
3519
3519
|
${y}
|
|
3520
3520
|
WHERE
|
|
3521
3521
|
${d}
|
|
3522
3522
|
|
|
3523
3523
|
${b}
|
|
3524
3524
|
`,
|
|
3525
|
-
|
|
3525
|
+
h,
|
|
3526
3526
|
m
|
|
3527
3527
|
];
|
|
3528
3528
|
}
|
|
@@ -3585,13 +3585,13 @@ ${b}
|
|
|
3585
3585
|
const { limit: r, offset: a, orderBy: s } = t, n = [];
|
|
3586
3586
|
return s.length && n.push(`ORDER BY ${s.map(({ attribute: o, recordName: l, order: u }) => {
|
|
3587
3587
|
const d = o.split(".");
|
|
3588
|
-
let
|
|
3589
|
-
d.length === 1 ? (
|
|
3590
|
-
const [m,
|
|
3591
|
-
|
|
3588
|
+
let h, f;
|
|
3589
|
+
d.length === 1 ? (h = [l], f = o) : (h = [l, ...d.slice(0, -1)], f = d[d.length - 1]);
|
|
3590
|
+
const [m, p] = this.map.getTableAliasAndFieldName(
|
|
3591
|
+
h,
|
|
3592
3592
|
f
|
|
3593
3593
|
);
|
|
3594
|
-
return `"${`${this.withPrefix(e)}${m}`}"."${
|
|
3594
|
+
return `"${`${this.withPrefix(e)}${m}`}"."${p}" ${u}`;
|
|
3595
3595
|
}).join(",")}`), r && n.push(`LIMIT ${r}`), a && n.push(`OFFSET ${a}`), n.join(`
|
|
3596
3596
|
`);
|
|
3597
3597
|
}
|
|
@@ -3613,18 +3613,18 @@ ${b}
|
|
|
3613
3613
|
throw new Error(`${e.concat(o).join(".")} is not a record`);
|
|
3614
3614
|
const u = e.concat(o), {
|
|
3615
3615
|
table: d,
|
|
3616
|
-
alias:
|
|
3616
|
+
alias: h,
|
|
3617
3617
|
linkTable: f,
|
|
3618
3618
|
linkAlias: m
|
|
3619
|
-
} = this.map.getTableAndAliasStack(u).at(-1), [,
|
|
3619
|
+
} = this.map.getTableAndAliasStack(u).at(-1), [, p] = this.map.getTableAliasAndFieldName(u, "id", !0);
|
|
3620
3620
|
if (!l.isMergedWithParent())
|
|
3621
3621
|
if (l.isLinkMergedWithParent()) {
|
|
3622
3622
|
if (n.onlyIdField()) return;
|
|
3623
3623
|
r.push({
|
|
3624
3624
|
for: u,
|
|
3625
3625
|
joinSource: s,
|
|
3626
|
-
joinIdField: [l.linkField,
|
|
3627
|
-
joinTarget: [d,
|
|
3626
|
+
joinIdField: [l.linkField, p],
|
|
3627
|
+
joinTarget: [d, h]
|
|
3628
3628
|
});
|
|
3629
3629
|
} else if (l.isLinkMergedWithAttribute()) {
|
|
3630
3630
|
const y = l.getReverseInfo();
|
|
@@ -3634,7 +3634,7 @@ ${b}
|
|
|
3634
3634
|
for: u,
|
|
3635
3635
|
joinSource: s,
|
|
3636
3636
|
joinIdField: [a, y.linkField],
|
|
3637
|
-
joinTarget: [d,
|
|
3637
|
+
joinTarget: [d, h]
|
|
3638
3638
|
});
|
|
3639
3639
|
} else {
|
|
3640
3640
|
const y = l.getLinkInfo(), b = l.isLinkManyToManySymmetric() ? l.symmetricDirection === "source" : y.isRelationSource(l.parentEntityName, l.attributeName);
|
|
@@ -3646,11 +3646,11 @@ ${b}
|
|
|
3646
3646
|
}), n.onlyIdField() || r.push({
|
|
3647
3647
|
for: u,
|
|
3648
3648
|
joinSource: [f, m],
|
|
3649
|
-
joinIdField: [b ? y.record.attributes.target.field : y.record.attributes.source.field,
|
|
3650
|
-
joinTarget: [d,
|
|
3649
|
+
joinIdField: [b ? y.record.attributes.target.field : y.record.attributes.source.field, p],
|
|
3650
|
+
joinTarget: [d, h]
|
|
3651
3651
|
});
|
|
3652
3652
|
}
|
|
3653
|
-
if (r.push(...this.getJoinTables(n, u, [
|
|
3653
|
+
if (r.push(...this.getJoinTables(n, u, [p, d, h])), n.parentLinkQueryTree && !n.parentLinkQueryTree.onlyIdField()) {
|
|
3654
3654
|
const y = u.concat(g), [, b] = this.map.getTableAliasAndFieldName(y, "id", !0), v = [
|
|
3655
3655
|
b,
|
|
3656
3656
|
// link 的 idField
|
|
@@ -3685,13 +3685,13 @@ ${b}
|
|
|
3685
3685
|
},
|
|
3686
3686
|
// 如果上层还有,就继承上层的,如果没有, context 就只这一层
|
|
3687
3687
|
i || t
|
|
3688
|
-
), [
|
|
3688
|
+
), [h, f] = this.buildXToOneFindQuery(d, o, r);
|
|
3689
3689
|
return {
|
|
3690
3690
|
...a.data,
|
|
3691
3691
|
isInnerQuery: !0,
|
|
3692
3692
|
fieldValue: `
|
|
3693
3693
|
EXISTS (
|
|
3694
|
-
${
|
|
3694
|
+
${h}
|
|
3695
3695
|
)
|
|
3696
3696
|
`,
|
|
3697
3697
|
fieldParams: f
|
|
@@ -3770,13 +3770,13 @@ WHERE ${a}
|
|
|
3770
3770
|
return e?.toLowerCase() === "json" ? JSON.stringify(t) : t;
|
|
3771
3771
|
}
|
|
3772
3772
|
}
|
|
3773
|
-
const
|
|
3774
|
-
class
|
|
3773
|
+
const Kt = ":root";
|
|
3774
|
+
class ht {
|
|
3775
3775
|
constructor(t, e, i = []) {
|
|
3776
3776
|
this.label = t, this.parent = e, this.stack = i;
|
|
3777
3777
|
}
|
|
3778
3778
|
concat(t) {
|
|
3779
|
-
return new
|
|
3779
|
+
return new ht(this.label, this.parent, [...this.stack, t]);
|
|
3780
3780
|
}
|
|
3781
3781
|
getStack(t) {
|
|
3782
3782
|
return [...this.stack];
|
|
@@ -3785,12 +3785,12 @@ class dt {
|
|
|
3785
3785
|
* 创建一个新的子上下文
|
|
3786
3786
|
*/
|
|
3787
3787
|
spawn(t) {
|
|
3788
|
-
return new
|
|
3788
|
+
return new ht(t, this);
|
|
3789
3789
|
}
|
|
3790
3790
|
}
|
|
3791
3791
|
class nr {
|
|
3792
3792
|
constructor(t) {
|
|
3793
|
-
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(
|
|
3793
|
+
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(Kt, t), this.recursiveSaveLabelledRecordQuery(t);
|
|
3794
3794
|
}
|
|
3795
3795
|
recursiveSaveLabelledRecordQuery(t) {
|
|
3796
3796
|
t.attributeQuery?.relatedRecords.forEach((e) => {
|
|
@@ -3828,16 +3828,16 @@ class or {
|
|
|
3828
3828
|
* 查找记录(主查询方法)
|
|
3829
3829
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
3830
3830
|
*/
|
|
3831
|
-
async findRecords(t, e = "", i, r = new
|
|
3831
|
+
async findRecords(t, e = "", i, r = new ht(Kt), a = !1) {
|
|
3832
3832
|
if (i || (i = new nr(t)), t.goto) {
|
|
3833
3833
|
if (t.exit && await t.exit(r))
|
|
3834
3834
|
return [];
|
|
3835
3835
|
const f = i.get(t.goto);
|
|
3836
3836
|
R(f, `goto ${t.goto} not found`);
|
|
3837
|
-
const m = t.matchExpression.and(f.matchExpression),
|
|
3837
|
+
const m = t.matchExpression.and(f.matchExpression), p = f.derive({
|
|
3838
3838
|
matchExpression: m
|
|
3839
3839
|
});
|
|
3840
|
-
return this.findRecords(
|
|
3840
|
+
return this.findRecords(p, e, i, r);
|
|
3841
3841
|
}
|
|
3842
3842
|
if (t.label && r.label === t.label && r.stack.length > 1 && r.stack[0].id === r.stack.at(-1).id)
|
|
3843
3843
|
return [];
|
|
@@ -3846,39 +3846,39 @@ class or {
|
|
|
3846
3846
|
FOR UPDATE` : s,
|
|
3847
3847
|
n,
|
|
3848
3848
|
e
|
|
3849
|
-
), d = this.structureRawReturns(u, this.map.getRecordInfo(t.recordName).JSONFields, o),
|
|
3850
|
-
await this.completeXToOneLeftoverRecords(t, d, i,
|
|
3849
|
+
), d = this.structureRawReturns(u, this.map.getRecordInfo(t.recordName).JSONFields, o), h = t.label && t.label !== r.label ? r.spawn(t.label) : r;
|
|
3850
|
+
await this.completeXToOneLeftoverRecords(t, d, i, h);
|
|
3851
3851
|
for (let f of t.attributeQuery.xToOneRecords)
|
|
3852
3852
|
if (f.goto) {
|
|
3853
|
-
const
|
|
3853
|
+
const p = this.map.getInfo(f.parentRecord, f.attributeName).getReverseInfo()?.attributeName;
|
|
3854
3854
|
for (let y of d) {
|
|
3855
3855
|
const b = f.matchExpression.and({
|
|
3856
|
-
key: `${
|
|
3856
|
+
key: `${p}.id`,
|
|
3857
3857
|
value: ["=", y.id]
|
|
3858
3858
|
}), v = f.derive({
|
|
3859
3859
|
matchExpression: b
|
|
3860
|
-
}), N = t.label ?
|
|
3860
|
+
}), N = t.label ? h.concat(y) : h;
|
|
3861
3861
|
y[f.alias || f.attributeName] = await this.findRecords(v, e, i, N);
|
|
3862
3862
|
}
|
|
3863
3863
|
}
|
|
3864
3864
|
for (let f of t.attributeQuery.xToOneRecords) {
|
|
3865
3865
|
const m = f.attributeQuery.parentLinkRecordQuery;
|
|
3866
3866
|
if (m)
|
|
3867
|
-
for (let
|
|
3868
|
-
const b = this.map.getInfo(
|
|
3867
|
+
for (let p of m.attributeQuery.xToManyRecords) {
|
|
3868
|
+
const b = this.map.getInfo(p.parentRecord, p.attributeName).getReverseInfo()?.attributeName;
|
|
3869
3869
|
for (let v of d) {
|
|
3870
|
-
const N = v[f.attributeName][g].id, I =
|
|
3871
|
-
matchExpression:
|
|
3870
|
+
const N = v[f.attributeName][g].id, I = p.derive({
|
|
3871
|
+
matchExpression: p.matchExpression.and({
|
|
3872
3872
|
key: `${b}.id`,
|
|
3873
3873
|
value: ["=", N]
|
|
3874
3874
|
})
|
|
3875
|
-
}), S = t.label ?
|
|
3875
|
+
}), S = t.label ? h.concat(v) : h;
|
|
3876
3876
|
oe(
|
|
3877
3877
|
v,
|
|
3878
|
-
[f.alias || f.attributeName, g,
|
|
3878
|
+
[f.alias || f.attributeName, g, p.attributeName],
|
|
3879
3879
|
await this.findRecords(
|
|
3880
3880
|
I,
|
|
3881
|
-
`finding relation data: ${t.recordName}.${f.attributeName}.&.${
|
|
3881
|
+
`finding relation data: ${t.recordName}.${f.attributeName}.&.${p.attributeName}`,
|
|
3882
3882
|
i,
|
|
3883
3883
|
S
|
|
3884
3884
|
)
|
|
@@ -3889,14 +3889,14 @@ FOR UPDATE` : s,
|
|
|
3889
3889
|
for (let f of t.attributeQuery.xToManyRecords)
|
|
3890
3890
|
if (!f.onlyRelationData)
|
|
3891
3891
|
for (let m of d) {
|
|
3892
|
-
const
|
|
3892
|
+
const p = t.label ? h.concat(m) : h;
|
|
3893
3893
|
m[f.alias || f.attributeName] = await this.findXToManyRelatedRecords(
|
|
3894
3894
|
t.recordName,
|
|
3895
3895
|
f.attributeName,
|
|
3896
3896
|
m.id,
|
|
3897
3897
|
f,
|
|
3898
3898
|
i,
|
|
3899
|
-
|
|
3899
|
+
p
|
|
3900
3900
|
);
|
|
3901
3901
|
}
|
|
3902
3902
|
return d;
|
|
@@ -3955,7 +3955,7 @@ FOR UPDATE` : s,
|
|
|
3955
3955
|
}), u = r.attributeQuery.parentLinkRecordQuery ? r.attributeQuery.withParentLinkData() : r.attributeQuery, d = r.derive({
|
|
3956
3956
|
matchExpression: l,
|
|
3957
3957
|
attributeQuery: u
|
|
3958
|
-
}),
|
|
3958
|
+
}), h = await this.findRecords(d, `finding related record: ${r.parentRecord}.${r.attributeName}`, a, s), f = r.attributeQuery.parentLinkRecordQuery ? h.map((y) => {
|
|
3959
3959
|
let b;
|
|
3960
3960
|
return n.isLinkManyToManySymmetric() ? (b = {
|
|
3961
3961
|
...y,
|
|
@@ -3964,9 +3964,9 @@ FOR UPDATE` : s,
|
|
|
3964
3964
|
...y,
|
|
3965
3965
|
[g]: y[o][g]
|
|
3966
3966
|
}, delete b[o]), b;
|
|
3967
|
-
}) :
|
|
3968
|
-
if (
|
|
3969
|
-
for (let y of
|
|
3967
|
+
}) : h, m = d.label && d.label !== s.label ? s.spawn(d.label) : s, p = r.attributeQuery.parentLinkRecordQuery;
|
|
3968
|
+
if (p)
|
|
3969
|
+
for (let y of p.attributeQuery.xToManyRecords)
|
|
3970
3970
|
for (let b of f) {
|
|
3971
3971
|
const v = b[g].id, N = d.label ? m.concat(b) : m;
|
|
3972
3972
|
oe(
|
|
@@ -3992,24 +3992,24 @@ FOR UPDATE` : s,
|
|
|
3992
3992
|
key: "id",
|
|
3993
3993
|
value: ["=", i]
|
|
3994
3994
|
}), u = O.getAttributeQueryDataForRecord(t, this.map, !0, !0, !1, !0), d = e;
|
|
3995
|
-
let
|
|
3995
|
+
let h = u;
|
|
3996
3996
|
for (let y of o)
|
|
3997
|
-
|
|
3998
|
-
|
|
3997
|
+
h.push([y, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
|
|
3998
|
+
h.push([n, { label: d, attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
|
|
3999
3999
|
for (let y of o)
|
|
4000
|
-
|
|
4000
|
+
h.push([y, { attributeQuery: ["*"] }]), h = h.at(-1)[1].attributeQuery;
|
|
4001
4001
|
let f;
|
|
4002
4002
|
const m = async (y) => {
|
|
4003
4003
|
if (f) return !0;
|
|
4004
4004
|
if (y.stack.at(-1)?.id === r)
|
|
4005
4005
|
return f = [...y.stack], !0;
|
|
4006
4006
|
};
|
|
4007
|
-
|
|
4008
|
-
const
|
|
4007
|
+
h.push([n, { goto: d, exit: m }]);
|
|
4008
|
+
const p = (await this.findRecords(L.create(t, this.map, {
|
|
4009
4009
|
matchExpression: l,
|
|
4010
4010
|
attributeQuery: u
|
|
4011
4011
|
}), `find records for path ${t}.${e}`))[0];
|
|
4012
|
-
return f ? [
|
|
4012
|
+
return f ? [p, ...f] : void 0;
|
|
4013
4013
|
}
|
|
4014
4014
|
}
|
|
4015
4015
|
class cr {
|
|
@@ -4197,8 +4197,8 @@ class lr {
|
|
|
4197
4197
|
attributeQuery: O.getAttributeQueryDataForRecord(t, this.map, !0, !0, !0, !0)
|
|
4198
4198
|
}), s = await this.helper.findRecords(a, `find record for updating ${t}`), n = [];
|
|
4199
4199
|
for (let o of s) {
|
|
4200
|
-
const l = await this.helper.createRecordDependency(i, r), u = await this.updateSameRowData(a.recordName, o, l, r), d = await this.handleUpdateReliance(a.recordName, o, i, r),
|
|
4201
|
-
await this.filteredEntityManager.updateFilteredEntityFlags(a.recordName, o.id, r, o, !1,
|
|
4200
|
+
const l = await this.helper.createRecordDependency(i, r), u = await this.updateSameRowData(a.recordName, o, l, r), d = await this.handleUpdateReliance(a.recordName, o, i, r), h = Object.keys(i.getData());
|
|
4201
|
+
await this.filteredEntityManager.updateFilteredEntityFlags(a.recordName, o.id, r, o, !1, h), n.push({ ...i.getData(), ...u.getData(), ...d });
|
|
4202
4202
|
}
|
|
4203
4203
|
return n;
|
|
4204
4204
|
}
|
|
@@ -4310,11 +4310,11 @@ class ur {
|
|
|
4310
4310
|
* 查找记录(主查询方法)- 委托给 QueryExecutor
|
|
4311
4311
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
4312
4312
|
*/
|
|
4313
|
-
async findRecords(t, e = "", i, r = new
|
|
4313
|
+
async findRecords(t, e = "", i, r = new ht(Kt)) {
|
|
4314
4314
|
return this.queryExecutor.findRecords(t, e, i, r);
|
|
4315
4315
|
}
|
|
4316
4316
|
async lockRecords(t, e = "") {
|
|
4317
|
-
return this.queryExecutor.findRecords(t, e, void 0, new
|
|
4317
|
+
return this.queryExecutor.findRecords(t, e, void 0, new ht(Kt), !0);
|
|
4318
4318
|
}
|
|
4319
4319
|
// 委托给 CreationExecutor
|
|
4320
4320
|
async createRecordDependency(t, e) {
|
|
@@ -4331,9 +4331,9 @@ class ur {
|
|
|
4331
4331
|
return this.creationExecutor.preprocessSameRowData(t, e, i, r);
|
|
4332
4332
|
const a = t.getData();
|
|
4333
4333
|
if (e && !a.id && (a.id = r.id), t.valueAttributes.length) {
|
|
4334
|
-
const o = t.getSameRowFieldAndValue(r), l = this.map.getRecordInfo(t.recordName), u = new Set(l.valueAttributes.map((
|
|
4335
|
-
o.forEach((
|
|
4336
|
-
u.has(
|
|
4334
|
+
const o = t.getSameRowFieldAndValue(r), l = this.map.getRecordInfo(t.recordName), u = new Set(l.valueAttributes.map((h) => h.attributeName)), d = { ...t.getData() };
|
|
4335
|
+
o.forEach((h) => {
|
|
4336
|
+
u.has(h.name) && (d[h.name] = h.value);
|
|
4337
4337
|
}), i?.push({
|
|
4338
4338
|
type: "update",
|
|
4339
4339
|
recordName: t.recordName,
|
|
@@ -4461,7 +4461,7 @@ class ur {
|
|
|
4461
4461
|
return this.queryExecutor.findPath(t, e, i, r, a);
|
|
4462
4462
|
}
|
|
4463
4463
|
}
|
|
4464
|
-
class
|
|
4464
|
+
class ei {
|
|
4465
4465
|
constructor(t, e) {
|
|
4466
4466
|
this.map = t, this.database = e, this.agent = new ur(t, e);
|
|
4467
4467
|
}
|
|
@@ -4544,7 +4544,7 @@ class ti {
|
|
|
4544
4544
|
return this.map.getInfo(t, e).recordName;
|
|
4545
4545
|
}
|
|
4546
4546
|
}
|
|
4547
|
-
class
|
|
4547
|
+
class Et {
|
|
4548
4548
|
constructor(t, e) {
|
|
4549
4549
|
this.name = t, this.map = e, this.data = this.map.data.records[t];
|
|
4550
4550
|
}
|
|
@@ -4615,7 +4615,7 @@ class vt {
|
|
|
4615
4615
|
return this.data.matchExpression;
|
|
4616
4616
|
}
|
|
4617
4617
|
get filteredBy() {
|
|
4618
|
-
return this.data.filteredBy?.map((t) => new
|
|
4618
|
+
return this.data.filteredBy?.map((t) => new Et(t, this.map));
|
|
4619
4619
|
}
|
|
4620
4620
|
get isFilteredEntity() {
|
|
4621
4621
|
return this.data?.isFilteredEntity;
|
|
@@ -4633,7 +4633,7 @@ class vt {
|
|
|
4633
4633
|
return this.data?.resolvedMatchExpression;
|
|
4634
4634
|
}
|
|
4635
4635
|
}
|
|
4636
|
-
class
|
|
4636
|
+
class Jt {
|
|
4637
4637
|
constructor(t, e, i, r = !0) {
|
|
4638
4638
|
this.name = t, this.data = e, this.map = i, this.isFromSource = r;
|
|
4639
4639
|
}
|
|
@@ -4662,10 +4662,10 @@ class Kt {
|
|
|
4662
4662
|
return this.data.sourceRecord;
|
|
4663
4663
|
}
|
|
4664
4664
|
get sourceRecordInfo() {
|
|
4665
|
-
return new
|
|
4665
|
+
return new Et(this.data.sourceRecord, this.map);
|
|
4666
4666
|
}
|
|
4667
4667
|
get targetRecordInfo() {
|
|
4668
|
-
return new
|
|
4668
|
+
return new Et(this.data.targetRecord, this.map);
|
|
4669
4669
|
}
|
|
4670
4670
|
get targetRecord() {
|
|
4671
4671
|
return this.data.targetRecord;
|
|
@@ -4721,7 +4721,7 @@ class Kt {
|
|
|
4721
4721
|
getBaseLinkInfo() {
|
|
4722
4722
|
R(this.isFilteredRelation(), "only filtered relation can get base link info");
|
|
4723
4723
|
const t = this.data.baseLinkName;
|
|
4724
|
-
return new
|
|
4724
|
+
return new Jt(t, this.map.data.links[t], this.map);
|
|
4725
4725
|
}
|
|
4726
4726
|
getMatchExpression() {
|
|
4727
4727
|
if (this.isFilteredRelation())
|
|
@@ -4735,7 +4735,7 @@ class Kt {
|
|
|
4735
4735
|
return R(this.isFilteredRelation(), "only filtered relation can get resolved record name"), this.data.resolvedBaseRecordName;
|
|
4736
4736
|
}
|
|
4737
4737
|
}
|
|
4738
|
-
class
|
|
4738
|
+
class dt {
|
|
4739
4739
|
constructor(t, e) {
|
|
4740
4740
|
this.data = t, this.aliasManager = e;
|
|
4741
4741
|
}
|
|
@@ -4749,7 +4749,7 @@ class ut {
|
|
|
4749
4749
|
return this.data.records[t].attributes[this.getAttributeAndSymmetricDirection(e)[0]];
|
|
4750
4750
|
}
|
|
4751
4751
|
getRecordInfo(t) {
|
|
4752
|
-
return new
|
|
4752
|
+
return new Et(t, this);
|
|
4753
4753
|
}
|
|
4754
4754
|
getInfo(t, e) {
|
|
4755
4755
|
const i = this.getInfoByPath([t, ...e.split(".")]);
|
|
@@ -4760,10 +4760,10 @@ class ut {
|
|
|
4760
4760
|
}
|
|
4761
4761
|
getLinkInfo(t, e) {
|
|
4762
4762
|
const i = this.getAttributeAndSymmetricDirection(e)[0], { linkName: r, isSource: a } = this.data.records[t].attributes[i];
|
|
4763
|
-
return R(!!r, `cannot find relation ${t} ${i}`), new
|
|
4763
|
+
return R(!!r, `cannot find relation ${t} ${i}`), new Jt(r, this.data.links[r], this, !!a);
|
|
4764
4764
|
}
|
|
4765
4765
|
getLinkInfoByName(t) {
|
|
4766
|
-
return R(!!this.data.links[t], `cannot find link ${t}`), new
|
|
4766
|
+
return R(!!this.data.links[t], `cannot find link ${t}`), new Jt(t, this.data.links[t], this);
|
|
4767
4767
|
}
|
|
4768
4768
|
getInfoByPath(t) {
|
|
4769
4769
|
const [e, ...i] = t;
|
|
@@ -4772,8 +4772,8 @@ class ut {
|
|
|
4772
4772
|
const u = [];
|
|
4773
4773
|
for (; o = i.shift(); ) {
|
|
4774
4774
|
u.push(o);
|
|
4775
|
-
const [d,
|
|
4776
|
-
l =
|
|
4775
|
+
const [d, h] = this.getAttributeAndSymmetricDirection(o);
|
|
4776
|
+
l = h, d === g ? (R(!!a && !!s, `reading link in wrong path ${u.join(".")}`), a = this.data.records[a].attributes[s].linkName, s = void 0, r = n.linkName, n = void 0) : (n = this.data.records[r].attributes[d], R(!!n, `attribute ${d} not found in ${r}. namePath: ${t.join(".")}`), a = r, r = n.isRecord ? n.recordName : "", s = d);
|
|
4777
4777
|
}
|
|
4778
4778
|
if (!(!a || !s))
|
|
4779
4779
|
return new it(a, s, this, l);
|
|
@@ -4796,15 +4796,15 @@ class ut {
|
|
|
4796
4796
|
// link: currentLink,
|
|
4797
4797
|
path: [e]
|
|
4798
4798
|
}];
|
|
4799
|
-
for (let
|
|
4800
|
-
const [f, m] = this.getAttributeAndSymmetricDirection(i[
|
|
4799
|
+
for (let h = 0; h < i.length; h++) {
|
|
4800
|
+
const [f, m] = this.getAttributeAndSymmetricDirection(i[h]), p = [e, ...i.slice(0, h + 1)];
|
|
4801
4801
|
if (f === g) {
|
|
4802
4802
|
const { linkTable: y, linkAlias: b, path: v } = d.pop();
|
|
4803
4803
|
R(!l, `last attribute in path is a link, cannot read link of a link ${v.join(".")}`), a = y, s = b, r = this.data.records[u.linkName], l = !0, n = "", o = "", u = void 0;
|
|
4804
4804
|
} else {
|
|
4805
|
-
u = this.getInfoByPath(
|
|
4805
|
+
u = this.getInfoByPath(p);
|
|
4806
4806
|
const y = r.attributes[f];
|
|
4807
|
-
R(u.isRecord, `${i.slice(0,
|
|
4807
|
+
R(u.isRecord, `${i.slice(0, h + 1).join(".")} is not a entity attribute`);
|
|
4808
4808
|
const b = this.data.records[y.recordName], v = `${s}_${f}${m ? `_${m.toUpperCase()}` : ""}`, N = this.aliasManager?.getTableAlias(v) || v;
|
|
4809
4809
|
if (u.isMergedWithParent() || u.isLinkMergedWithParent())
|
|
4810
4810
|
o = s;
|
|
@@ -4822,20 +4822,20 @@ class ut {
|
|
|
4822
4822
|
isLinkRecord: l,
|
|
4823
4823
|
linkTable: n,
|
|
4824
4824
|
linkAlias: o,
|
|
4825
|
-
path:
|
|
4825
|
+
path: p
|
|
4826
4826
|
});
|
|
4827
4827
|
}
|
|
4828
4828
|
return d;
|
|
4829
4829
|
}
|
|
4830
4830
|
getTableAliasAndFieldName(t, e, i = !1) {
|
|
4831
|
-
const r = this.getTableAndAliasStack(t), { table: a, alias: s, record: n, path: o, linkAlias: l, linkTable: u, isLinkRecord: d } = r.at(-1),
|
|
4832
|
-
if (!i && e === "id" && !d && t.length > 1 && (
|
|
4833
|
-
if (
|
|
4834
|
-
const { alias: m, table:
|
|
4835
|
-
return [m,
|
|
4831
|
+
const r = this.getTableAndAliasStack(t), { table: a, alias: s, record: n, path: o, linkAlias: l, linkTable: u, isLinkRecord: d } = r.at(-1), h = !d && r.length > 1 ? this.getInfoByPath(o) : null;
|
|
4832
|
+
if (!i && e === "id" && !d && t.length > 1 && (h?.isLinkMergedWithParent() || h?.isLinkIsolated()))
|
|
4833
|
+
if (h?.isLinkMergedWithParent()) {
|
|
4834
|
+
const { alias: m, table: p } = r.at(-2);
|
|
4835
|
+
return [m, h.linkField, p];
|
|
4836
4836
|
} else {
|
|
4837
|
-
const m =
|
|
4838
|
-
return [l,
|
|
4837
|
+
const m = h.getLinkInfo().record, p = h?.isLinkManyToManySymmetric() ? h?.symmetricDirection === "source" ? m?.attributes.target.field : m?.attributes.source.field : h.isRecordSource() ? m?.attributes.target.field : m?.attributes.source.field;
|
|
4838
|
+
return [l, p, u];
|
|
4839
4839
|
}
|
|
4840
4840
|
else {
|
|
4841
4841
|
const m = n.attributes[this.getAttributeAndSymmetricDirection(e)[0]].field;
|
|
@@ -4904,11 +4904,11 @@ class ut {
|
|
|
4904
4904
|
if (u === "source" || u === "target") {
|
|
4905
4905
|
const d = this.getInfo(s, l);
|
|
4906
4906
|
if (d.isRecord) {
|
|
4907
|
-
const
|
|
4907
|
+
const h = d.getLinkInfo().data;
|
|
4908
4908
|
let f;
|
|
4909
|
-
d.isRecordSource() ? f =
|
|
4909
|
+
d.isRecordSource() ? f = h.targetRecord : f = h.sourceRecord;
|
|
4910
4910
|
let m;
|
|
4911
|
-
if (u === "source" ? m =
|
|
4911
|
+
if (u === "source" ? m = h.sourceRecord : m = h.targetRecord, f === m) {
|
|
4912
4912
|
n += 2;
|
|
4913
4913
|
continue;
|
|
4914
4914
|
} else {
|
|
@@ -4958,20 +4958,20 @@ function hr(c) {
|
|
|
4958
4958
|
}
|
|
4959
4959
|
function pr(c, t) {
|
|
4960
4960
|
const e = new ge(c, t), i = dr(c), r = hr(t);
|
|
4961
|
-
return
|
|
4961
|
+
return ii(
|
|
4962
4962
|
c,
|
|
4963
4963
|
e,
|
|
4964
4964
|
i,
|
|
4965
4965
|
"entity"
|
|
4966
|
-
),
|
|
4966
|
+
), ii(
|
|
4967
4967
|
t,
|
|
4968
4968
|
e,
|
|
4969
4969
|
r,
|
|
4970
4970
|
"relation"
|
|
4971
4971
|
), e.getAll();
|
|
4972
4972
|
}
|
|
4973
|
-
function
|
|
4974
|
-
const r = c.filter((a) =>
|
|
4973
|
+
function ii(c, t, e, i) {
|
|
4974
|
+
const r = c.filter((a) => _t(a) !== void 0);
|
|
4975
4975
|
for (const a of r)
|
|
4976
4976
|
fr(
|
|
4977
4977
|
a,
|
|
@@ -4981,18 +4981,18 @@ function ei(c, t, e, i) {
|
|
|
4981
4981
|
);
|
|
4982
4982
|
}
|
|
4983
4983
|
function fr(c, t, e, i) {
|
|
4984
|
-
const r = e === "entity", s = `__${
|
|
4984
|
+
const r = e === "entity", s = `__${gt(c)}_input_${e}`, n = r ? t.getEntityByName(c.name) : t.getRelationByName(c.name), [o, l] = wr(
|
|
4985
4985
|
n,
|
|
4986
4986
|
s,
|
|
4987
4987
|
i,
|
|
4988
4988
|
t
|
|
4989
4989
|
);
|
|
4990
4990
|
t.replace(o, c), l !== o && t.add(l);
|
|
4991
|
-
const u =
|
|
4991
|
+
const u = _t(c) || [];
|
|
4992
4992
|
if (c.commonProperties) {
|
|
4993
|
-
const d = u.filter((
|
|
4993
|
+
const d = u.filter((h) => c.commonProperties.some((f) => !h.properties.some((m) => m.name === f.name && m.type === f.type)));
|
|
4994
4994
|
if (d.length > 0)
|
|
4995
|
-
throw new Error(`Merged ${e} ${c.name} defined commonProperties, but these ${e}s do not have commonProperties: ${d.map((
|
|
4995
|
+
throw new Error(`Merged ${e} ${c.name} defined commonProperties, but these ${e}s do not have commonProperties: ${d.map((h) => h.name).join(", ")}`);
|
|
4996
4996
|
}
|
|
4997
4997
|
if (u)
|
|
4998
4998
|
for (const d of u)
|
|
@@ -5012,14 +5012,14 @@ function mr(c, t, e, i, r) {
|
|
|
5012
5012
|
);
|
|
5013
5013
|
if (!r && a === c)
|
|
5014
5014
|
return;
|
|
5015
|
-
const n =
|
|
5015
|
+
const n = gt(s), o = r ? i.getEntityByName(n) : i.getRelationByName(n);
|
|
5016
5016
|
o && i.replace(a, o);
|
|
5017
5017
|
}
|
|
5018
5018
|
function yr(c, t) {
|
|
5019
|
-
const e = /* @__PURE__ */ new Map(), i =
|
|
5019
|
+
const e = /* @__PURE__ */ new Map(), i = _t(c);
|
|
5020
5020
|
if (i && i.length > 0)
|
|
5021
5021
|
for (const r of i) {
|
|
5022
|
-
const a =
|
|
5022
|
+
const a = gt(r), s = [...t.get(a) || []], n = e.get(a) || [];
|
|
5023
5023
|
for (n.push(a), e.set(a, n); s.length; ) {
|
|
5024
5024
|
const o = s.shift(), l = e.get(o) || [];
|
|
5025
5025
|
l.push(...n), e.set(o, l);
|
|
@@ -5035,38 +5035,38 @@ function gr(c, t, e) {
|
|
|
5035
5035
|
name: c,
|
|
5036
5036
|
type: "json",
|
|
5037
5037
|
defaultValue: (r, a) => {
|
|
5038
|
-
const s =
|
|
5039
|
-
(l) => s.some((u) =>
|
|
5038
|
+
const s = _t(t) || [], o = (i.get(a) || []).filter(
|
|
5039
|
+
(l) => s.some((u) => gt(u) === l)
|
|
5040
5040
|
);
|
|
5041
5041
|
return o.length > 0 ? o : [a];
|
|
5042
5042
|
}
|
|
5043
5043
|
});
|
|
5044
5044
|
}
|
|
5045
5045
|
function br(c, t, e) {
|
|
5046
|
-
const i =
|
|
5046
|
+
const i = _t(c) || [], r = [], a = /* @__PURE__ */ new Map(), s = Object.fromEntries(c.commonProperties?.map((n) => [n.name, n]) || []);
|
|
5047
5047
|
for (const n of i) {
|
|
5048
5048
|
let o = n;
|
|
5049
|
-
if (
|
|
5049
|
+
if (qt(o))
|
|
5050
5050
|
for (; o.baseEntity && o.properties.length === 0; )
|
|
5051
5051
|
o = o.baseEntity;
|
|
5052
5052
|
else if (vr(o))
|
|
5053
5053
|
for (; o.baseRelation && o.properties.length === 0; )
|
|
5054
5054
|
o = o.baseRelation;
|
|
5055
|
-
const l = Object.fromEntries(o.properties.map((
|
|
5055
|
+
const l = Object.fromEntries(o.properties.map((h) => [h.name, h]));
|
|
5056
5056
|
a.set(n.name, l), Object.assign(s, l);
|
|
5057
5057
|
const u = n.inputEntities || n.inputRelations, d = [...t.get(n.name) || []];
|
|
5058
5058
|
for (; d.length; ) {
|
|
5059
|
-
const
|
|
5059
|
+
const h = d.shift();
|
|
5060
5060
|
if (!u)
|
|
5061
|
-
a.set(
|
|
5061
|
+
a.set(h, l);
|
|
5062
5062
|
else {
|
|
5063
|
-
const f = e.getEntityByName(
|
|
5063
|
+
const f = e.getEntityByName(h) || e.getRelationByName(h);
|
|
5064
5064
|
if (!(f.inputEntities || f.inputRelations)) {
|
|
5065
|
-
const
|
|
5066
|
-
a.set(
|
|
5065
|
+
const p = Object.fromEntries(f.properties.map((y) => [y.name, y]));
|
|
5066
|
+
a.set(h, p), Object.assign(s, p);
|
|
5067
5067
|
}
|
|
5068
5068
|
}
|
|
5069
|
-
d.push(...t.get(
|
|
5069
|
+
d.push(...t.get(h) || []);
|
|
5070
5070
|
}
|
|
5071
5071
|
}
|
|
5072
5072
|
for (const n of Object.keys(s)) {
|
|
@@ -5093,7 +5093,7 @@ function wr(c, t, e, i) {
|
|
|
5093
5093
|
r,
|
|
5094
5094
|
...c.properties
|
|
5095
5095
|
];
|
|
5096
|
-
if (
|
|
5096
|
+
if (qt(c)) {
|
|
5097
5097
|
const s = i.getEntityByName(c.name), n = D.create({
|
|
5098
5098
|
name: s.name
|
|
5099
5099
|
});
|
|
@@ -5131,7 +5131,7 @@ function wr(c, t, e, i) {
|
|
|
5131
5131
|
properties: a
|
|
5132
5132
|
}), n.baseRelation = o, n.sourceProperty = s.sourceProperty, n.targetProperty = s.targetProperty, n.matchExpression = w.fromArray(
|
|
5133
5133
|
s.inputRelations.map((u) => {
|
|
5134
|
-
const d =
|
|
5134
|
+
const d = gt(u);
|
|
5135
5135
|
return {
|
|
5136
5136
|
key: t,
|
|
5137
5137
|
value: ["contains", d]
|
|
@@ -5144,7 +5144,7 @@ function wr(c, t, e, i) {
|
|
|
5144
5144
|
}
|
|
5145
5145
|
}
|
|
5146
5146
|
function Rr(c, t, e) {
|
|
5147
|
-
if (
|
|
5147
|
+
if (qt(c)) {
|
|
5148
5148
|
const i = c, r = t;
|
|
5149
5149
|
let a = i;
|
|
5150
5150
|
if (i.baseEntity)
|
|
@@ -5156,7 +5156,7 @@ function Rr(c, t, e) {
|
|
|
5156
5156
|
value: ["contains", i.name]
|
|
5157
5157
|
}), [s, a];
|
|
5158
5158
|
} else {
|
|
5159
|
-
const i = c, r = t, a =
|
|
5159
|
+
const i = c, r = t, a = gt(i);
|
|
5160
5160
|
return i.baseRelation ? [i, Nr(i)] : [F.create({
|
|
5161
5161
|
name: a,
|
|
5162
5162
|
baseRelation: r,
|
|
@@ -5175,17 +5175,17 @@ function Nr(c) {
|
|
|
5175
5175
|
t = t.baseRelation;
|
|
5176
5176
|
return t;
|
|
5177
5177
|
}
|
|
5178
|
-
function
|
|
5178
|
+
function qt(c) {
|
|
5179
5179
|
return "inputEntities" in c || !("sourceProperty" in c);
|
|
5180
5180
|
}
|
|
5181
5181
|
function vr(c) {
|
|
5182
5182
|
return "sourceProperty" in c;
|
|
5183
5183
|
}
|
|
5184
|
-
function
|
|
5185
|
-
return
|
|
5184
|
+
function _t(c) {
|
|
5185
|
+
return qt(c) ? c.inputEntities : c.inputRelations;
|
|
5186
5186
|
}
|
|
5187
|
-
function
|
|
5188
|
-
return
|
|
5187
|
+
function gt(c) {
|
|
5188
|
+
return qt(c), c.name;
|
|
5189
5189
|
}
|
|
5190
5190
|
class Er {
|
|
5191
5191
|
constructor() {
|
|
@@ -5273,18 +5273,18 @@ class Er {
|
|
|
5273
5273
|
this.tableAliasCounter = 1, this.fieldAliasCounter = 1, this.tablePathToAlias.clear(), this.tableAliasToPath.clear(), this.fieldPathToAlias.clear(), this.fieldAliasToPath.clear();
|
|
5274
5274
|
}
|
|
5275
5275
|
}
|
|
5276
|
-
const
|
|
5276
|
+
const ri = {
|
|
5277
5277
|
name: "postgres",
|
|
5278
5278
|
maxIdentifierLength: 63,
|
|
5279
5279
|
supportsCreateIndexIfNotExists: !0,
|
|
5280
|
-
encodeLiteral:
|
|
5280
|
+
encodeLiteral: Ci,
|
|
5281
5281
|
constraints: {
|
|
5282
5282
|
unique: !0,
|
|
5283
5283
|
filteredUnique: !0,
|
|
5284
5284
|
nonNull: !0
|
|
5285
5285
|
}
|
|
5286
5286
|
};
|
|
5287
|
-
function
|
|
5287
|
+
function Ci(c) {
|
|
5288
5288
|
if (c === null) return "NULL";
|
|
5289
5289
|
if (typeof c == "number") {
|
|
5290
5290
|
if (!Number.isFinite(c)) throw new Error(`Invalid numeric constraint literal: ${c}`);
|
|
@@ -5292,53 +5292,53 @@ function Ai(c) {
|
|
|
5292
5292
|
}
|
|
5293
5293
|
return typeof c == "boolean" ? c ? "TRUE" : "FALSE" : `'${c.replace(/'/g, "''")}'`;
|
|
5294
5294
|
}
|
|
5295
|
-
function
|
|
5296
|
-
return typeof c == "boolean" ? c ? "1" : "0" :
|
|
5295
|
+
function fs(c) {
|
|
5296
|
+
return typeof c == "boolean" ? c ? "1" : "0" : Ci(c);
|
|
5297
5297
|
}
|
|
5298
5298
|
function Q(c) {
|
|
5299
5299
|
return {
|
|
5300
|
-
...
|
|
5300
|
+
...ri,
|
|
5301
5301
|
...c?.schemaDialect,
|
|
5302
5302
|
constraints: {
|
|
5303
|
-
...
|
|
5303
|
+
...ri.constraints,
|
|
5304
5304
|
...c?.schemaDialect?.constraints
|
|
5305
5305
|
}
|
|
5306
5306
|
};
|
|
5307
5307
|
}
|
|
5308
|
-
function
|
|
5308
|
+
function ct(c, t) {
|
|
5309
5309
|
return t.name === "mysql" ? `\`${c.replace(/`/g, "``")}\`` : `"${c.replace(/"/g, '""')}"`;
|
|
5310
5310
|
}
|
|
5311
|
-
function
|
|
5311
|
+
function Ut(c, t) {
|
|
5312
5312
|
return t.encodeLiteral(c);
|
|
5313
5313
|
}
|
|
5314
5314
|
function Tr(c, t, e) {
|
|
5315
|
-
const i =
|
|
5315
|
+
const i = ct(c, e);
|
|
5316
5316
|
switch (t.op) {
|
|
5317
5317
|
case "isNull":
|
|
5318
5318
|
return `${i} IS NULL`;
|
|
5319
5319
|
case "isNotNull":
|
|
5320
5320
|
return `${i} IS NOT NULL`;
|
|
5321
5321
|
case "equals":
|
|
5322
|
-
return t.value === null ? `${i} IS NULL` : `${i} = ${
|
|
5322
|
+
return t.value === null ? `${i} IS NULL` : `${i} = ${Ut(t.value, e)}`;
|
|
5323
5323
|
case "notEquals":
|
|
5324
|
-
return t.value === null ? `${i} IS NOT NULL` : `${i} != ${
|
|
5324
|
+
return t.value === null ? `${i} IS NOT NULL` : `${i} != ${Ut(t.value, e)}`;
|
|
5325
5325
|
case "in": {
|
|
5326
5326
|
const r = t.value.filter((s) => s !== null), a = [];
|
|
5327
|
-
return t.value.some((s) => s === null) && a.push(`${i} IS NULL`), r.length && a.push(`${i} IN (${r.map((s) =>
|
|
5327
|
+
return t.value.some((s) => s === null) && a.push(`${i} IS NULL`), r.length && a.push(`${i} IN (${r.map((s) => Ut(s, e)).join(", ")})`), `(${a.join(" OR ")})`;
|
|
5328
5328
|
}
|
|
5329
5329
|
case "notIn": {
|
|
5330
5330
|
const r = t.value.filter((s) => s !== null), a = [];
|
|
5331
|
-
return t.value.some((s) => s === null) && a.push(`${i} IS NOT NULL`), r.length && a.push(`${i} NOT IN (${r.map((s) =>
|
|
5331
|
+
return t.value.some((s) => s === null) && a.push(`${i} IS NOT NULL`), r.length && a.push(`${i} NOT IN (${r.map((s) => Ut(s, e)).join(", ")})`), `(${a.join(" AND ")})`;
|
|
5332
5332
|
}
|
|
5333
5333
|
}
|
|
5334
5334
|
}
|
|
5335
5335
|
function be(c, t, e, i, r, a) {
|
|
5336
|
-
const s = i.supportsCreateIndexIfNotExists ? " IF NOT EXISTS" : "", n = e.map((l) =>
|
|
5336
|
+
const s = i.supportsCreateIndexIfNotExists ? " IF NOT EXISTS" : "", n = e.map((l) => ct(l, i)).join(", "), o = r ? `
|
|
5337
5337
|
WHERE ${Object.entries(r).map(([l, u]) => {
|
|
5338
5338
|
const d = a?.(l) ?? l;
|
|
5339
5339
|
return Tr(d, u, i);
|
|
5340
5340
|
}).join(" AND ")}` : "";
|
|
5341
|
-
return `CREATE UNIQUE INDEX${s} ${
|
|
5341
|
+
return `CREATE UNIQUE INDEX${s} ${ct(c, i)} ON ${ct(t, i)} (${n})${o}`;
|
|
5342
5342
|
}
|
|
5343
5343
|
function Sr(c, t, e) {
|
|
5344
5344
|
if (!t.constraints.unique)
|
|
@@ -5362,7 +5362,7 @@ function kr(c, t) {
|
|
|
5362
5362
|
throw new Error("expected non-null constraint item");
|
|
5363
5363
|
if (!t.constraints.nonNull)
|
|
5364
5364
|
throw new Error(`non-null constraints are not supported by ${t.name} schema dialect`);
|
|
5365
|
-
const e =
|
|
5365
|
+
const e = ct(c.tableName, t), i = ct(c.physicalName, t), r = ct(c.field, t);
|
|
5366
5366
|
if (t.name === "sqlite")
|
|
5367
5367
|
throw new Error("post-recompute non-null constraints are not supported by sqlite schema dialect");
|
|
5368
5368
|
return {
|
|
@@ -5370,7 +5370,7 @@ function kr(c, t) {
|
|
|
5370
5370
|
sql: `ALTER TABLE ${e} ADD CONSTRAINT ${i} CHECK (${r} IS NOT NULL)`
|
|
5371
5371
|
};
|
|
5372
5372
|
}
|
|
5373
|
-
class
|
|
5373
|
+
class ai {
|
|
5374
5374
|
constructor(t, e, i, r = []) {
|
|
5375
5375
|
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 Er(), this.constraintSchemaItems = [], this.buildMap(), this.buildTables(), this.buildConstraints();
|
|
5376
5376
|
}
|
|
@@ -5470,8 +5470,8 @@ class ri {
|
|
|
5470
5470
|
}
|
|
5471
5471
|
];
|
|
5472
5472
|
}));
|
|
5473
|
-
e && R(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[
|
|
5474
|
-
name:
|
|
5473
|
+
e && R(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[si] = {
|
|
5474
|
+
name: si,
|
|
5475
5475
|
type: "id",
|
|
5476
5476
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5477
5477
|
};
|
|
@@ -5778,15 +5778,15 @@ class ri {
|
|
|
5778
5778
|
const [a, ...s] = r.split(".");
|
|
5779
5779
|
let n = a;
|
|
5780
5780
|
for (let o = 0; o < s.length; o++) {
|
|
5781
|
-
const l = s[o], u = this.map.records[n].attributes[l], d = u.linkName,
|
|
5781
|
+
const l = s[o], u = this.map.records[n].attributes[l], d = u.linkName, h = this.map.links[d], { relType: f, sourceRecord: m, targetRecord: p } = h;
|
|
5782
5782
|
R(
|
|
5783
|
-
f[0] === "1" && f[1] === "1" && m !==
|
|
5783
|
+
f[0] === "1" && f[1] === "1" && m !== p,
|
|
5784
5784
|
`only 1:1 can merge: ${a}.${s.slice(0, o + 1).join(".")}`
|
|
5785
5785
|
);
|
|
5786
|
-
const y = m === n ?
|
|
5786
|
+
const y = m === n ? p : m, b = this.combineRecordTable(n, y, d);
|
|
5787
5787
|
if (b)
|
|
5788
5788
|
throw new Error(`conflict found when join ${d}, ${b.join(",")} already merged with ${n}`);
|
|
5789
|
-
|
|
5789
|
+
h.mergedTo = "combined", i.push(h), n = u.recordName, delete t[d], delete e[d];
|
|
5790
5790
|
}
|
|
5791
5791
|
}), Object.values(t).forEach((r) => {
|
|
5792
5792
|
if (r.isFilteredRelation) return;
|
|
@@ -5844,8 +5844,8 @@ class ri {
|
|
|
5844
5844
|
buildTables() {
|
|
5845
5845
|
Object.entries(this.map.records).forEach(([t, e]) => {
|
|
5846
5846
|
this.tables[e.table] || (this.tables[e.table] = { columns: {
|
|
5847
|
-
[
|
|
5848
|
-
name:
|
|
5847
|
+
[ni]: {
|
|
5848
|
+
name: ni,
|
|
5849
5849
|
type: "pk",
|
|
5850
5850
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5851
5851
|
}
|
|
@@ -5885,7 +5885,7 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
5885
5885
|
return i.length + r.length + 1 <= a ? `${i}_${r}` : `${i.slice(0, a - r.length - 1)}_${r}`;
|
|
5886
5886
|
}
|
|
5887
5887
|
resolveConstraintField(t, e) {
|
|
5888
|
-
const i = new
|
|
5888
|
+
const i = new dt(this.map, this.aliasManager), r = i.getRecordInfo(t), a = this.map.records[t]?.attributes[e];
|
|
5889
5889
|
if (!a)
|
|
5890
5890
|
throw new Error(`constraint property "${e}" not found on "${t}"`);
|
|
5891
5891
|
if (!a.isRecord && a.computed)
|
|
@@ -6036,13 +6036,13 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
6036
6036
|
if (!l.isRecord) return;
|
|
6037
6037
|
const u = l.recordName, d = `${e}_${n}`;
|
|
6038
6038
|
if (this.aliasManager.registerTablePath(d), this.aliasManager.registerTablePath(`${d}_SOURCE`), this.aliasManager.registerTablePath(`${d}_TARGET`), this.aliasManager.registerTablePath(`REL_${d}`), this.aliasManager.registerTablePath(`REL_${d}_SOURCE`), this.aliasManager.registerTablePath(`REL_${d}_TARGET`), i.has(u)) return;
|
|
6039
|
-
const
|
|
6040
|
-
|
|
6039
|
+
const h = new Set(i);
|
|
6040
|
+
h.add(u), this.generateAliasesForRecord(u, d, h, r + 1, a);
|
|
6041
6041
|
});
|
|
6042
6042
|
}
|
|
6043
6043
|
}
|
|
6044
|
-
const
|
|
6045
|
-
name:
|
|
6044
|
+
const Rt = "_System_", K = "_Dictionary_", si = "id", ni = "_rowId", oi = D.create({
|
|
6045
|
+
name: Rt,
|
|
6046
6046
|
properties: [
|
|
6047
6047
|
T.create({
|
|
6048
6048
|
name: "concept",
|
|
@@ -6060,8 +6060,8 @@ const wt = "_System_", J = "_Dictionary_", ai = "id", si = "_rowId", ni = D.crea
|
|
|
6060
6060
|
collection: !1
|
|
6061
6061
|
})
|
|
6062
6062
|
]
|
|
6063
|
-
}),
|
|
6064
|
-
name:
|
|
6063
|
+
}), ci = D.create({
|
|
6064
|
+
name: K,
|
|
6065
6065
|
properties: [
|
|
6066
6066
|
T.create({
|
|
6067
6067
|
name: "key",
|
|
@@ -6074,8 +6074,8 @@ const wt = "_System_", J = "_Dictionary_", ai = "id", si = "_rowId", ni = D.crea
|
|
|
6074
6074
|
collection: !1
|
|
6075
6075
|
})
|
|
6076
6076
|
]
|
|
6077
|
-
}),
|
|
6078
|
-
class
|
|
6077
|
+
}), ms = 0, ce = 1, ys = 2;
|
|
6078
|
+
class $i {
|
|
6079
6079
|
constructor(t, e) {
|
|
6080
6080
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
6081
6081
|
}
|
|
@@ -6139,7 +6139,7 @@ class Ci {
|
|
|
6139
6139
|
* @returns 是否需要触发计算
|
|
6140
6140
|
*/
|
|
6141
6141
|
shouldTriggerUpdateComputation(t, e) {
|
|
6142
|
-
return t.type !== "update" || !("dataDep" in t) ? !0 : t.dataDep.type === "global" && e.recordName ===
|
|
6142
|
+
return t.type !== "update" || !("dataDep" in t) ? !0 : t.dataDep.type === "global" && e.recordName === K ? e.record?.key === t.dataDep.source.name : t.attributes.includes("*") ? Object.keys(e.record || {}).some(
|
|
6143
6143
|
(r) => r !== "id" && e.record[r] !== e.oldRecord?.[r]
|
|
6144
6144
|
) : !t.attributes.filter((r) => r !== "id").every(
|
|
6145
6145
|
(r) => !e.record.hasOwnProperty(r) || e.record[r] === e.oldRecord[r]
|
|
@@ -6199,15 +6199,15 @@ class Ci {
|
|
|
6199
6199
|
} else e.type === "global" && ((!r || r === "update") && s.push({
|
|
6200
6200
|
dataDep: e,
|
|
6201
6201
|
type: "update",
|
|
6202
|
-
recordName:
|
|
6203
|
-
sourceRecordName:
|
|
6202
|
+
recordName: K,
|
|
6203
|
+
sourceRecordName: K,
|
|
6204
6204
|
attributes: ["value"],
|
|
6205
6205
|
computation: i
|
|
6206
6206
|
}), (!r || r === "create") && s.push({
|
|
6207
6207
|
dataDep: e,
|
|
6208
6208
|
type: "create",
|
|
6209
|
-
recordName:
|
|
6210
|
-
sourceRecordName:
|
|
6209
|
+
recordName: K,
|
|
6210
|
+
sourceRecordName: K,
|
|
6211
6211
|
computation: i
|
|
6212
6212
|
}));
|
|
6213
6213
|
return s;
|
|
@@ -6306,26 +6306,26 @@ class Ci {
|
|
|
6306
6306
|
}
|
|
6307
6307
|
class x {
|
|
6308
6308
|
static {
|
|
6309
|
-
this.skip = () => new
|
|
6309
|
+
this.skip = () => new pt();
|
|
6310
6310
|
}
|
|
6311
6311
|
static {
|
|
6312
6312
|
this.resolved = (t, e) => new ee(t, e);
|
|
6313
6313
|
}
|
|
6314
6314
|
static {
|
|
6315
|
-
this.async = (t) => new
|
|
6315
|
+
this.async = (t) => new Vt(t);
|
|
6316
6316
|
}
|
|
6317
6317
|
static {
|
|
6318
6318
|
this.fullRecompute = (t) => new Xt(t);
|
|
6319
6319
|
}
|
|
6320
6320
|
}
|
|
6321
|
-
class
|
|
6321
|
+
class pt extends x {
|
|
6322
6322
|
}
|
|
6323
6323
|
class Xt extends x {
|
|
6324
6324
|
constructor(t) {
|
|
6325
6325
|
super(), this.reason = t;
|
|
6326
6326
|
}
|
|
6327
6327
|
}
|
|
6328
|
-
class
|
|
6328
|
+
class Vt extends x {
|
|
6329
6329
|
constructor(t) {
|
|
6330
6330
|
super(), this.args = t;
|
|
6331
6331
|
}
|
|
@@ -6453,7 +6453,7 @@ function we(c, t) {
|
|
|
6453
6453
|
return !1;
|
|
6454
6454
|
return !0;
|
|
6455
6455
|
}
|
|
6456
|
-
class
|
|
6456
|
+
class Ii {
|
|
6457
6457
|
constructor(t) {
|
|
6458
6458
|
this.data = t, this.map = {};
|
|
6459
6459
|
for (const e of t.transfers)
|
|
@@ -6479,23 +6479,23 @@ function C(c, t) {
|
|
|
6479
6479
|
if (!c)
|
|
6480
6480
|
throw new Error(t);
|
|
6481
6481
|
}
|
|
6482
|
-
function
|
|
6482
|
+
function gs(c, t) {
|
|
6483
6483
|
return new Map(Array.from(c.entries()).map(([e, i]) => [e, t(e, i)]));
|
|
6484
6484
|
}
|
|
6485
|
-
function
|
|
6485
|
+
function bs(c, t) {
|
|
6486
6486
|
return Object.fromEntries(Object.entries(c).map(([e, i]) => [e, t(e, i)]));
|
|
6487
6487
|
}
|
|
6488
|
-
async function
|
|
6488
|
+
async function ws(c, t) {
|
|
6489
6489
|
for (let e of c)
|
|
6490
6490
|
if (!await t(e)) return !1;
|
|
6491
6491
|
return !0;
|
|
6492
6492
|
}
|
|
6493
|
-
async function
|
|
6493
|
+
async function Rs(c, t) {
|
|
6494
6494
|
for (let e of c)
|
|
6495
6495
|
if (await t(e)) return !0;
|
|
6496
6496
|
return !1;
|
|
6497
6497
|
}
|
|
6498
|
-
async function
|
|
6498
|
+
async function Ns(c, t) {
|
|
6499
6499
|
for (let e of c) {
|
|
6500
6500
|
const i = await t(e);
|
|
6501
6501
|
if (i !== !0) return i;
|
|
@@ -6504,7 +6504,7 @@ async function Rs(c, t) {
|
|
|
6504
6504
|
}
|
|
6505
6505
|
class Ar {
|
|
6506
6506
|
constructor(t, e, i) {
|
|
6507
|
-
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6507
|
+
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Ii(this.args), this.initialState = this.args.initialState;
|
|
6508
6508
|
for (const r of this.args.transfers) {
|
|
6509
6509
|
const a = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6510
6510
|
this.eventDeps[a] = {
|
|
@@ -6514,7 +6514,7 @@ class Ar {
|
|
|
6514
6514
|
}
|
|
6515
6515
|
}
|
|
6516
6516
|
static {
|
|
6517
|
-
this.computationType =
|
|
6517
|
+
this.computationType = Ct;
|
|
6518
6518
|
}
|
|
6519
6519
|
static {
|
|
6520
6520
|
this.contextType = "global";
|
|
@@ -6537,7 +6537,7 @@ class Ar {
|
|
|
6537
6537
|
}
|
|
6538
6538
|
class Cr {
|
|
6539
6539
|
constructor(t, e, i) {
|
|
6540
|
-
this.controller = t, this.args = e, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6540
|
+
this.controller = t, this.args = e, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Ii(this.args), this.initialState = this.args.initialState, this.dataContext = i;
|
|
6541
6541
|
for (const r of this.args.transfers) {
|
|
6542
6542
|
const a = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6543
6543
|
this.eventDeps[a] = {
|
|
@@ -6547,7 +6547,7 @@ class Cr {
|
|
|
6547
6547
|
}
|
|
6548
6548
|
}
|
|
6549
6549
|
static {
|
|
6550
|
-
this.computationType =
|
|
6550
|
+
this.computationType = Ct;
|
|
6551
6551
|
}
|
|
6552
6552
|
static {
|
|
6553
6553
|
this.contextType = "property";
|
|
@@ -6587,13 +6587,13 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6587
6587
|
};
|
|
6588
6588
|
}
|
|
6589
6589
|
}
|
|
6590
|
-
const
|
|
6590
|
+
const vs = yt.create({
|
|
6591
6591
|
name: "nonExistent",
|
|
6592
6592
|
computeValue: () => null
|
|
6593
|
-
}),
|
|
6593
|
+
}), Es = yt.create({
|
|
6594
6594
|
name: "nonDeleted",
|
|
6595
6595
|
computeValue: () => !1
|
|
6596
|
-
}),
|
|
6596
|
+
}), Ts = yt.create({
|
|
6597
6597
|
name: "deleted",
|
|
6598
6598
|
computeValue: () => !0
|
|
6599
6599
|
}), $r = [Ar, Cr];
|
|
@@ -6609,7 +6609,7 @@ class Ir {
|
|
|
6609
6609
|
};
|
|
6610
6610
|
}
|
|
6611
6611
|
static {
|
|
6612
|
-
this.computationType =
|
|
6612
|
+
this.computationType = $t;
|
|
6613
6613
|
}
|
|
6614
6614
|
static {
|
|
6615
6615
|
this.contextType = "global";
|
|
@@ -6668,7 +6668,7 @@ class xr {
|
|
|
6668
6668
|
};
|
|
6669
6669
|
}
|
|
6670
6670
|
static {
|
|
6671
|
-
this.computationType =
|
|
6671
|
+
this.computationType = $t;
|
|
6672
6672
|
}
|
|
6673
6673
|
static {
|
|
6674
6674
|
this.contextType = "property";
|
|
@@ -6720,8 +6720,8 @@ class xr {
|
|
|
6720
6720
|
this.relationAttributeQuery
|
|
6721
6721
|
), l = o[this.isSource ? "target" : "source"];
|
|
6722
6722
|
l["&"] = o;
|
|
6723
|
-
const u = this.matchRecordToWeight.call(this.controller, l, r), d = u.weight * u.value, { oldValue:
|
|
6724
|
-
a = d - (
|
|
6723
|
+
const u = this.matchRecordToWeight.call(this.controller, l, r), d = u.weight * u.value, { oldValue: h } = await this.state.itemResult.replace(o, d);
|
|
6724
|
+
a = d - (h ?? 0);
|
|
6725
6725
|
}
|
|
6726
6726
|
return this.state.total.increment(e.record, a);
|
|
6727
6727
|
}
|
|
@@ -6739,7 +6739,7 @@ class Pr {
|
|
|
6739
6739
|
}, this.defaultValue = !this.args.notEmpty;
|
|
6740
6740
|
}
|
|
6741
6741
|
static {
|
|
6742
|
-
this.computationType =
|
|
6742
|
+
this.computationType = Pt;
|
|
6743
6743
|
}
|
|
6744
6744
|
static {
|
|
6745
6745
|
this.contextType = "global";
|
|
@@ -6807,7 +6807,7 @@ class Dr {
|
|
|
6807
6807
|
};
|
|
6808
6808
|
}
|
|
6809
6809
|
static {
|
|
6810
|
-
this.computationType =
|
|
6810
|
+
this.computationType = Pt;
|
|
6811
6811
|
}
|
|
6812
6812
|
static {
|
|
6813
6813
|
this.contextType = "property";
|
|
@@ -6837,19 +6837,19 @@ class Dr {
|
|
|
6837
6837
|
const a = e.relatedMutationEvent;
|
|
6838
6838
|
let s = 0, n = 0;
|
|
6839
6839
|
if (a.type === "create" && a.recordName === this.relation.name) {
|
|
6840
|
-
const u = a.record,
|
|
6840
|
+
const u = a.record, h = (await this.controller.system.storage.findOne(this.relation.name, w.atom({
|
|
6841
6841
|
key: "id",
|
|
6842
6842
|
value: ["=", u.id]
|
|
6843
6843
|
}), void 0, this.relationAttributeQuery))[this.isSource ? "target" : "source"];
|
|
6844
|
-
|
|
6845
|
-
const f = !!this.callback.call(this.controller,
|
|
6844
|
+
h["&"] = u;
|
|
6845
|
+
const f = !!this.callback.call(this.controller, h, r);
|
|
6846
6846
|
let m;
|
|
6847
6847
|
try {
|
|
6848
6848
|
({ oldValue: m } = await this.state.isItemMatch.replace(u, f));
|
|
6849
|
-
} catch (
|
|
6850
|
-
if (
|
|
6849
|
+
} catch (p) {
|
|
6850
|
+
if (p instanceof Error && p.message.includes("Atomic replace target not found"))
|
|
6851
6851
|
return x.fullRecompute("relation contribution state target not found");
|
|
6852
|
-
throw
|
|
6852
|
+
throw p;
|
|
6853
6853
|
}
|
|
6854
6854
|
s = Number(f) - +!!m, n = 1;
|
|
6855
6855
|
} else if (a.type === "delete" && a.recordName === this.relation.name) {
|
|
@@ -6866,18 +6866,18 @@ class Dr {
|
|
|
6866
6866
|
), d = w.atom({
|
|
6867
6867
|
key: u,
|
|
6868
6868
|
value: ["=", a.oldRecord.id]
|
|
6869
|
-
}),
|
|
6870
|
-
f["&"] =
|
|
6869
|
+
}), h = await this.controller.system.storage.findOne(this.relation.name, d, void 0, this.relationAttributeQuery), f = h[this.isSource ? "target" : "source"];
|
|
6870
|
+
f["&"] = h;
|
|
6871
6871
|
const m = !!this.callback.call(this.controller, f, r);
|
|
6872
|
-
let
|
|
6872
|
+
let p;
|
|
6873
6873
|
try {
|
|
6874
|
-
({ oldValue:
|
|
6874
|
+
({ oldValue: p } = await this.state.isItemMatch.replace(h, m));
|
|
6875
6875
|
} catch (y) {
|
|
6876
6876
|
if (y instanceof Error && y.message.includes("Atomic replace target not found"))
|
|
6877
6877
|
return x.fullRecompute("relation contribution state target not found");
|
|
6878
6878
|
throw y;
|
|
6879
6879
|
}
|
|
6880
|
-
s = Number(m) - +!!
|
|
6880
|
+
s = Number(m) - +!!p;
|
|
6881
6881
|
} else
|
|
6882
6882
|
return x.fullRecompute("mutation is not caused by relation.");
|
|
6883
6883
|
const o = await this.state.matchCount.increment(e.record, s), l = await this.state.totalCount.increment(e.record, n);
|
|
@@ -6897,7 +6897,7 @@ class Fr {
|
|
|
6897
6897
|
};
|
|
6898
6898
|
}
|
|
6899
6899
|
static {
|
|
6900
|
-
this.computationType =
|
|
6900
|
+
this.computationType = Dt;
|
|
6901
6901
|
}
|
|
6902
6902
|
static {
|
|
6903
6903
|
this.contextType = "global";
|
|
@@ -6961,7 +6961,7 @@ class Lr {
|
|
|
6961
6961
|
};
|
|
6962
6962
|
}
|
|
6963
6963
|
static {
|
|
6964
|
-
this.computationType =
|
|
6964
|
+
this.computationType = Dt;
|
|
6965
6965
|
}
|
|
6966
6966
|
static {
|
|
6967
6967
|
this.contextType = "property";
|
|
@@ -6994,8 +6994,8 @@ class Lr {
|
|
|
6994
6994
|
value: ["=", o.id]
|
|
6995
6995
|
}), void 0, this.relationAttributeQuery))[this.isSource ? "target" : "source"];
|
|
6996
6996
|
u["&"] = o;
|
|
6997
|
-
const d = !!this.callback.call(this.controller, u, r), { oldValue:
|
|
6998
|
-
a = Number(d) - +!!
|
|
6997
|
+
const d = !!this.callback.call(this.controller, u, r), { oldValue: h } = await this.state.isItemMatch.replace(o, d);
|
|
6998
|
+
a = Number(d) - +!!h;
|
|
6999
6999
|
} else if (s.type === "delete" && s.recordName === this.relation.name) {
|
|
7000
7000
|
const o = s.record;
|
|
7001
7001
|
a = !!await this.state.isItemMatch.get(o) ? -1 : 0;
|
|
@@ -7012,8 +7012,8 @@ class Lr {
|
|
|
7012
7012
|
value: ["=", s.oldRecord.id]
|
|
7013
7013
|
}), u = await this.controller.system.storage.findOne(this.relation.name, l, void 0, this.relationAttributeQuery), d = u[this.isSource ? "target" : "source"];
|
|
7014
7014
|
d["&"] = u;
|
|
7015
|
-
const
|
|
7016
|
-
a = Number(
|
|
7015
|
+
const h = !!this.callback.call(this.controller, d, r), { oldValue: f } = await this.state.isItemMatch.replace(u, h);
|
|
7016
|
+
a = Number(h) - +!!f;
|
|
7017
7017
|
} else
|
|
7018
7018
|
return x.fullRecompute("mutation is not caused by relation.");
|
|
7019
7019
|
return await this.state.matchCount.increment(e.record, a) > 0;
|
|
@@ -7032,7 +7032,7 @@ class _r {
|
|
|
7032
7032
|
};
|
|
7033
7033
|
}
|
|
7034
7034
|
static {
|
|
7035
|
-
this.computationType =
|
|
7035
|
+
this.computationType = It;
|
|
7036
7036
|
}
|
|
7037
7037
|
static {
|
|
7038
7038
|
this.contextType = "global";
|
|
@@ -7090,7 +7090,7 @@ class Vr {
|
|
|
7090
7090
|
};
|
|
7091
7091
|
}
|
|
7092
7092
|
static {
|
|
7093
|
-
this.computationType =
|
|
7093
|
+
this.computationType = It;
|
|
7094
7094
|
}
|
|
7095
7095
|
static {
|
|
7096
7096
|
this.contextType = "property";
|
|
@@ -7132,8 +7132,8 @@ class Vr {
|
|
|
7132
7132
|
this.relationAttributeQuery
|
|
7133
7133
|
))[this.isSource ? "target" : "source"];
|
|
7134
7134
|
u["&"] = o;
|
|
7135
|
-
const d = !!this.callback.call(this.controller, u, r), { oldValue:
|
|
7136
|
-
s = Number(d) - +!!
|
|
7135
|
+
const d = !!this.callback.call(this.controller, u, r), { oldValue: h } = await this.state.isItemMatchCount.replace(o, d);
|
|
7136
|
+
s = Number(d) - +!!h;
|
|
7137
7137
|
} else
|
|
7138
7138
|
s = 1;
|
|
7139
7139
|
else if (a.type === "delete" && a.recordName === this.relation.name)
|
|
@@ -7153,8 +7153,8 @@ class Vr {
|
|
|
7153
7153
|
this.relationAttributeQuery
|
|
7154
7154
|
), u = l[this.isSource ? "target" : "source"];
|
|
7155
7155
|
u["&"] = l;
|
|
7156
|
-
const d = !!this.callback.call(this.controller, u, r), { oldValue:
|
|
7157
|
-
s = Number(d) - +!!
|
|
7156
|
+
const d = !!this.callback.call(this.controller, u, r), { oldValue: h } = await this.state.isItemMatchCount.replace(l, d);
|
|
7157
|
+
s = Number(d) - +!!h;
|
|
7158
7158
|
}
|
|
7159
7159
|
} else
|
|
7160
7160
|
return x.fullRecompute(`unknown related mutation event for ${this.dataContext.host.name}.${this.dataContext.id.name}`);
|
|
@@ -7337,21 +7337,21 @@ function Hr(c) {
|
|
|
7337
7337
|
function jr(c, t) {
|
|
7338
7338
|
return Y(c).find((e) => !e || typeof e != "object" ? !1 : e.code === t);
|
|
7339
7339
|
}
|
|
7340
|
-
function
|
|
7340
|
+
function Ss(c, t) {
|
|
7341
7341
|
return jr(c, t) !== void 0;
|
|
7342
7342
|
}
|
|
7343
|
-
const
|
|
7343
|
+
const li = [10, 25, 60, 150, 350];
|
|
7344
7344
|
function Wr(c) {
|
|
7345
7345
|
return new Promise((t) => setTimeout(t, c));
|
|
7346
7346
|
}
|
|
7347
|
-
function
|
|
7347
|
+
function Ht(c, t, e, i) {
|
|
7348
7348
|
return c && typeof c == "object" && Object.assign(c, {
|
|
7349
7349
|
transactionAttempts: t,
|
|
7350
7350
|
transactionIsolation: e,
|
|
7351
7351
|
transactionName: i
|
|
7352
7352
|
}), c;
|
|
7353
7353
|
}
|
|
7354
|
-
class
|
|
7354
|
+
class Wt extends Error {
|
|
7355
7355
|
constructor(t, e, i, r) {
|
|
7356
7356
|
super(`Transaction retry exhausted for ${t} after ${e} attempts`, { cause: r }), this.name = "TransactionRetryExhaustedError", this.transactionAttempts = e, this.transactionIsolation = i, this.transactionName = t, Object.assign(this, {
|
|
7357
7357
|
transactionAttempts: e,
|
|
@@ -7360,10 +7360,10 @@ class jt extends Error {
|
|
|
7360
7360
|
}), Object.setPrototypeOf(this, new.target.prototype);
|
|
7361
7361
|
}
|
|
7362
7362
|
}
|
|
7363
|
-
function Ss(c) {
|
|
7364
|
-
return Y(c).some((t) => t instanceof jt);
|
|
7365
|
-
}
|
|
7366
7363
|
function ks(c) {
|
|
7364
|
+
return Y(c).some((t) => t instanceof Wt);
|
|
7365
|
+
}
|
|
7366
|
+
function As(c) {
|
|
7367
7367
|
return Y(c).some((t) => t instanceof Re);
|
|
7368
7368
|
}
|
|
7369
7369
|
async function De(c, t, e = {}) {
|
|
@@ -7376,30 +7376,30 @@ async function De(c, t, e = {}) {
|
|
|
7376
7376
|
} catch (n) {
|
|
7377
7377
|
if (s = n, Ur(n)) {
|
|
7378
7378
|
if (r = "SERIALIZABLE", a < i) continue;
|
|
7379
|
-
throw new
|
|
7379
|
+
throw new Wt(
|
|
7380
7380
|
c,
|
|
7381
7381
|
a,
|
|
7382
7382
|
r,
|
|
7383
|
-
|
|
7383
|
+
Ht(n, a, r, c)
|
|
7384
7384
|
);
|
|
7385
7385
|
}
|
|
7386
7386
|
if (Hr(n)) {
|
|
7387
7387
|
if (a < i) {
|
|
7388
|
-
const o =
|
|
7388
|
+
const o = li[Math.min(a - 1, li.length - 1)], l = Math.floor(Math.random() * o);
|
|
7389
7389
|
await Wr(o + l);
|
|
7390
7390
|
continue;
|
|
7391
7391
|
}
|
|
7392
|
-
throw new
|
|
7392
|
+
throw new Wt(
|
|
7393
7393
|
c,
|
|
7394
7394
|
a,
|
|
7395
7395
|
r,
|
|
7396
|
-
|
|
7396
|
+
Ht(n, a, r, c)
|
|
7397
7397
|
);
|
|
7398
7398
|
}
|
|
7399
|
-
throw
|
|
7399
|
+
throw Ht(n, a, r, c);
|
|
7400
7400
|
}
|
|
7401
7401
|
}
|
|
7402
|
-
throw new
|
|
7402
|
+
throw new Wt(c, a, r, Ht(s, a, r, c));
|
|
7403
7403
|
}
|
|
7404
7404
|
class Gr {
|
|
7405
7405
|
constructor(t, e, i) {
|
|
@@ -7489,8 +7489,8 @@ class Gr {
|
|
|
7489
7489
|
);
|
|
7490
7490
|
if (!d)
|
|
7491
7491
|
return [];
|
|
7492
|
-
const
|
|
7493
|
-
s = Array.isArray(
|
|
7492
|
+
const h = await this.transformCallback.call(this.controller, d);
|
|
7493
|
+
s = Array.isArray(h) ? h : [h];
|
|
7494
7494
|
}
|
|
7495
7495
|
const n = w.atom({ key: this.state.sourceRecordId.key, value: ["=", a] }), l = (await this.controller.system.storage.atomic.lockRows(i.id.name, n, ["*"])).reduce((u, d) => (u[Number(d[this.state.transformIndex.key])] = d, u), {});
|
|
7496
7496
|
s.forEach((u, d) => {
|
|
@@ -7520,7 +7520,7 @@ class Gr {
|
|
|
7520
7520
|
return r;
|
|
7521
7521
|
}
|
|
7522
7522
|
}
|
|
7523
|
-
const
|
|
7523
|
+
const Kr = [Gr];
|
|
7524
7524
|
class _ {
|
|
7525
7525
|
constructor(t) {
|
|
7526
7526
|
this.node = t;
|
|
@@ -7792,12 +7792,12 @@ class Oe {
|
|
|
7792
7792
|
}
|
|
7793
7793
|
}
|
|
7794
7794
|
}
|
|
7795
|
-
class
|
|
7795
|
+
class Jr {
|
|
7796
7796
|
constructor(t, e, i) {
|
|
7797
7797
|
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = this.args.dataDeps ?? {}, this.callback = (r, a) => this.args.callback.call(this.controller, r, a), this.nextRecomputeTime = this.args.nextRecomputeTime ? (r, a) => this.args.nextRecomputeTime.call(this.controller, r, a) : void 0;
|
|
7798
7798
|
}
|
|
7799
7799
|
static {
|
|
7800
|
-
this.computationType =
|
|
7800
|
+
this.computationType = Ot;
|
|
7801
7801
|
}
|
|
7802
7802
|
static {
|
|
7803
7803
|
this.contextType = "global";
|
|
@@ -7835,7 +7835,7 @@ class Xr {
|
|
|
7835
7835
|
}, this.isResultNumber = this.dataContext.id.type === "number", this.callback = (r, a) => this.args.callback.call(this.controller, r, a), this.nextRecomputeTime = this.args.nextRecomputeTime ? (r, a) => this.args.nextRecomputeTime.call(this.controller, r, a) : void 0;
|
|
7836
7836
|
}
|
|
7837
7837
|
static {
|
|
7838
|
-
this.computationType =
|
|
7838
|
+
this.computationType = Ot;
|
|
7839
7839
|
}
|
|
7840
7840
|
static {
|
|
7841
7841
|
this.contextType = "property";
|
|
@@ -7862,7 +7862,7 @@ class Xr {
|
|
|
7862
7862
|
return await this.state.lastRecomputeTime.setInternal(e, r), await this.state.nextRecomputeTime.setInternal(e, s), a;
|
|
7863
7863
|
}
|
|
7864
7864
|
}
|
|
7865
|
-
const zr = [
|
|
7865
|
+
const zr = [Jr, Xr];
|
|
7866
7866
|
class Yr {
|
|
7867
7867
|
constructor(t, e, i) {
|
|
7868
7868
|
if (this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
|
|
@@ -7880,7 +7880,7 @@ class Yr {
|
|
|
7880
7880
|
};
|
|
7881
7881
|
}
|
|
7882
7882
|
static {
|
|
7883
|
-
this.computationType =
|
|
7883
|
+
this.computationType = xt;
|
|
7884
7884
|
}
|
|
7885
7885
|
static {
|
|
7886
7886
|
this.contextType = "global";
|
|
@@ -7945,7 +7945,7 @@ class Zr {
|
|
|
7945
7945
|
};
|
|
7946
7946
|
}
|
|
7947
7947
|
static {
|
|
7948
|
-
this.computationType =
|
|
7948
|
+
this.computationType = xt;
|
|
7949
7949
|
}
|
|
7950
7950
|
static {
|
|
7951
7951
|
this.contextType = "property";
|
|
@@ -8031,7 +8031,7 @@ class ea {
|
|
|
8031
8031
|
};
|
|
8032
8032
|
}
|
|
8033
8033
|
static {
|
|
8034
|
-
this.computationType =
|
|
8034
|
+
this.computationType = Mt;
|
|
8035
8035
|
}
|
|
8036
8036
|
static {
|
|
8037
8037
|
this.contextType = "global";
|
|
@@ -8069,8 +8069,8 @@ class ea {
|
|
|
8069
8069
|
w.atom({ key: "id", value: ["=", e.record.id] }),
|
|
8070
8070
|
void 0,
|
|
8071
8071
|
this.args.attributeQuery
|
|
8072
|
-
), d = this.resolveAvgField(u) || 0, { oldValue:
|
|
8073
|
-
a = d - (
|
|
8072
|
+
), d = this.resolveAvgField(u) || 0, { oldValue: h } = await this.state.itemValue.replace(u, d);
|
|
8073
|
+
a = d - (h ?? 0), s = 1;
|
|
8074
8074
|
} else if (e.type === "delete")
|
|
8075
8075
|
a = -(await this.state.itemValue.get(e.record) || 0), s = -1;
|
|
8076
8076
|
else if (e.type === "update") {
|
|
@@ -8079,8 +8079,8 @@ class ea {
|
|
|
8079
8079
|
w.atom({ key: "id", value: ["=", e.record.id] }),
|
|
8080
8080
|
void 0,
|
|
8081
8081
|
this.args.attributeQuery
|
|
8082
|
-
), d = this.resolveAvgField(u) || 0, { oldValue:
|
|
8083
|
-
a = d - (
|
|
8082
|
+
), d = this.resolveAvgField(u) || 0, { oldValue: h } = await this.state.itemValue.replace(u, d);
|
|
8083
|
+
a = d - (h ?? 0);
|
|
8084
8084
|
}
|
|
8085
8085
|
const n = await this.controller.system.storage.atomic.updateGlobalFields(
|
|
8086
8086
|
{
|
|
@@ -8115,7 +8115,7 @@ class ia {
|
|
|
8115
8115
|
};
|
|
8116
8116
|
}
|
|
8117
8117
|
static {
|
|
8118
|
-
this.computationType =
|
|
8118
|
+
this.computationType = Mt;
|
|
8119
8119
|
}
|
|
8120
8120
|
static {
|
|
8121
8121
|
this.contextType = "property";
|
|
@@ -8158,9 +8158,9 @@ class ia {
|
|
|
8158
8158
|
w.atom({ key: "id", value: ["=", u.id] }),
|
|
8159
8159
|
void 0,
|
|
8160
8160
|
this.relationAttributeQuery
|
|
8161
|
-
),
|
|
8162
|
-
|
|
8163
|
-
const f = this.resolveAvgField(
|
|
8161
|
+
), h = d[this.isSource ? "target" : "source"];
|
|
8162
|
+
h["&"] = d;
|
|
8163
|
+
const f = this.resolveAvgField(h) || 0, { oldValue: m } = await this.state.itemResult.replace(d, f);
|
|
8164
8164
|
s = f - (m ?? 0), n = 1;
|
|
8165
8165
|
} else if (a.type === "delete" && a.recordName === this.relation.name)
|
|
8166
8166
|
s = -(await this.state.itemResult.get(a.record) ?? 0), n = -1;
|
|
@@ -8172,8 +8172,8 @@ class ia {
|
|
|
8172
8172
|
this.relationAttributeQuery
|
|
8173
8173
|
), d = u[this.isSource ? "target" : "source"];
|
|
8174
8174
|
d["&"] = u;
|
|
8175
|
-
const
|
|
8176
|
-
s =
|
|
8175
|
+
const h = this.resolveAvgField(d) || 0, { oldValue: f } = await this.state.itemResult.replace(u, h);
|
|
8176
|
+
s = h - (f ?? 0);
|
|
8177
8177
|
}
|
|
8178
8178
|
const o = await this.state.sum.increment(e.record, s), l = await this.state.count.increment(e.record, n);
|
|
8179
8179
|
return l > 0 ? o / l : 0;
|
|
@@ -8304,7 +8304,7 @@ class H extends U {
|
|
|
8304
8304
|
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity || q.MEDIUM;
|
|
8305
8305
|
}
|
|
8306
8306
|
}
|
|
8307
|
-
class
|
|
8307
|
+
class ui extends H {
|
|
8308
8308
|
constructor(t, e = {}) {
|
|
8309
8309
|
super(t, {
|
|
8310
8310
|
...e,
|
|
@@ -8334,7 +8334,7 @@ class rt extends H {
|
|
|
8334
8334
|
}), this.depName = e.depName, this.depType = e.depType, this.missingData = e.missingData, this.invalidData = e.invalidData;
|
|
8335
8335
|
}
|
|
8336
8336
|
}
|
|
8337
|
-
class
|
|
8337
|
+
class xi extends U {
|
|
8338
8338
|
constructor(t, e) {
|
|
8339
8339
|
super(t, {
|
|
8340
8340
|
errorType: "ConstraintViolationError",
|
|
@@ -8379,7 +8379,7 @@ function la(c) {
|
|
|
8379
8379
|
let t = c;
|
|
8380
8380
|
const e = /* @__PURE__ */ new Set();
|
|
8381
8381
|
for (; t && !e.has(t); ) {
|
|
8382
|
-
if (e.add(t), t instanceof
|
|
8382
|
+
if (e.add(t), t instanceof xi) return t;
|
|
8383
8383
|
t instanceof Error ? t = (t instanceof U ? t.causedBy : void 0) || t.cause : t = void 0;
|
|
8384
8384
|
}
|
|
8385
8385
|
}
|
|
@@ -8425,7 +8425,7 @@ class ue extends U {
|
|
|
8425
8425
|
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity = q.HIGH;
|
|
8426
8426
|
}
|
|
8427
8427
|
}
|
|
8428
|
-
class
|
|
8428
|
+
class di extends U {
|
|
8429
8429
|
constructor(t, e) {
|
|
8430
8430
|
super(t, {
|
|
8431
8431
|
errorType: "SideEffectError",
|
|
@@ -8441,7 +8441,7 @@ class ui extends U {
|
|
|
8441
8441
|
}), this.sideEffectName = e.sideEffectName, this.recordName = e.recordName, this.mutationType = e.mutationType, this.severity = q.MEDIUM;
|
|
8442
8442
|
}
|
|
8443
8443
|
}
|
|
8444
|
-
class
|
|
8444
|
+
class ut extends U {
|
|
8445
8445
|
constructor(t, e) {
|
|
8446
8446
|
super(t, {
|
|
8447
8447
|
errorType: e.context?.errorType || "ConditionError",
|
|
@@ -8460,7 +8460,7 @@ class lt extends U {
|
|
|
8460
8460
|
* Helper factory methods for common condition error scenarios
|
|
8461
8461
|
*/
|
|
8462
8462
|
static userCheckFailed(t, e) {
|
|
8463
|
-
return new
|
|
8463
|
+
return new ut("User check failed", {
|
|
8464
8464
|
checkType: "user",
|
|
8465
8465
|
evaluationError: t,
|
|
8466
8466
|
severity: q.HIGH,
|
|
@@ -8471,7 +8471,7 @@ class lt extends U {
|
|
|
8471
8471
|
}
|
|
8472
8472
|
static payloadValidationFailed(t, e, i, r) {
|
|
8473
8473
|
const a = `${t} ${e}`;
|
|
8474
|
-
return new
|
|
8474
|
+
return new ut(`Payload validation failed for field '${t}': ${e}`, {
|
|
8475
8475
|
checkType: "payload",
|
|
8476
8476
|
fieldName: t,
|
|
8477
8477
|
payload: i,
|
|
@@ -8482,7 +8482,7 @@ class lt extends U {
|
|
|
8482
8482
|
});
|
|
8483
8483
|
}
|
|
8484
8484
|
static conditionCheckFailed(t, e) {
|
|
8485
|
-
return new
|
|
8485
|
+
return new ut(`Condition check failed: ${t.data.name}`, {
|
|
8486
8486
|
checkType: "condition",
|
|
8487
8487
|
evaluationError: t,
|
|
8488
8488
|
severity: q.HIGH,
|
|
@@ -8493,7 +8493,7 @@ class lt extends U {
|
|
|
8493
8493
|
}
|
|
8494
8494
|
static attributiveCheckFailed(t, e, i, r) {
|
|
8495
8495
|
const a = `${t} ${e}`;
|
|
8496
|
-
return new
|
|
8496
|
+
return new ut(`Attributive check failed for field '${t}': ${e}`, {
|
|
8497
8497
|
checkType: "attributive",
|
|
8498
8498
|
fieldName: t,
|
|
8499
8499
|
payload: i,
|
|
@@ -8504,7 +8504,7 @@ class lt extends U {
|
|
|
8504
8504
|
});
|
|
8505
8505
|
}
|
|
8506
8506
|
static conceptCheckFailed(t, e) {
|
|
8507
|
-
return new
|
|
8507
|
+
return new ut(`Concept check failed for field '${t}'`, {
|
|
8508
8508
|
checkType: "concept",
|
|
8509
8509
|
fieldName: t,
|
|
8510
8510
|
evaluationError: e,
|
|
@@ -8517,7 +8517,7 @@ class lt extends U {
|
|
|
8517
8517
|
const de = "_ASYNC_TASK_";
|
|
8518
8518
|
class ha {
|
|
8519
8519
|
constructor(t, e, i, r, a) {
|
|
8520
|
-
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new
|
|
8520
|
+
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new $i(this.controller, this), this.buildComputationHandleMap(a);
|
|
8521
8521
|
const s = [];
|
|
8522
8522
|
r.forEach((n) => {
|
|
8523
8523
|
n.computation && s.push({ dataContext: { type: "global", id: n }, args: n.computation });
|
|
@@ -8540,10 +8540,10 @@ class ha {
|
|
|
8540
8540
|
C(!!u, `cannot find Computation handle map for ${l.constructor.displayName || l.constructor.name}`);
|
|
8541
8541
|
const d = u[o.type];
|
|
8542
8542
|
C(!!d, `cannot find Computation handle for ${l.constructor.displayName || l.constructor.name} with context type ${o.type}`);
|
|
8543
|
-
const
|
|
8544
|
-
if (this.computationsHandles.set(o.id,
|
|
8545
|
-
const f = this.getAsyncTaskRecordKey(
|
|
8546
|
-
if (
|
|
8543
|
+
const h = new d(this.controller, l, o);
|
|
8544
|
+
if (this.computationsHandles.set(o.id, h), this.isAsyncComputation(h)) {
|
|
8545
|
+
const f = this.getAsyncTaskRecordKey(h);
|
|
8546
|
+
if (h.dataContext.type === "property") {
|
|
8547
8547
|
const m = new D({
|
|
8548
8548
|
name: f,
|
|
8549
8549
|
properties: [
|
|
@@ -8564,16 +8564,16 @@ class ha {
|
|
|
8564
8564
|
type: "string"
|
|
8565
8565
|
}, { uuid: `${f}_freshnessKey` })
|
|
8566
8566
|
]
|
|
8567
|
-
}, { uuid: f }),
|
|
8568
|
-
name: `${m.name}_${
|
|
8567
|
+
}, { uuid: f }), p = new F({
|
|
8568
|
+
name: `${m.name}_${h.dataContext.host.name}_${h.dataContext.id.name}`,
|
|
8569
8569
|
source: m,
|
|
8570
|
-
target:
|
|
8570
|
+
target: h.dataContext.host,
|
|
8571
8571
|
sourceProperty: "record",
|
|
8572
|
-
targetProperty: `_${
|
|
8572
|
+
targetProperty: `_${h.dataContext.id.name}_task`,
|
|
8573
8573
|
type: "1:1"
|
|
8574
8574
|
}, { uuid: `${f}_record_relation` });
|
|
8575
|
-
e.push(m), i.push(
|
|
8576
|
-
} else if (
|
|
8575
|
+
e.push(m), i.push(p);
|
|
8576
|
+
} else if (h.dataContext.type === "global") {
|
|
8577
8577
|
const m = new D({
|
|
8578
8578
|
name: f,
|
|
8579
8579
|
properties: [
|
|
@@ -8600,8 +8600,8 @@ class ha {
|
|
|
8600
8600
|
]
|
|
8601
8601
|
}, { uuid: f });
|
|
8602
8602
|
e.push(m);
|
|
8603
|
-
} else if (
|
|
8604
|
-
|
|
8603
|
+
} else if (h.dataContext.type === "entity") {
|
|
8604
|
+
h.dataContext;
|
|
8605
8605
|
const m = new D({
|
|
8606
8606
|
name: f,
|
|
8607
8607
|
properties: [
|
|
@@ -8628,8 +8628,8 @@ class ha {
|
|
|
8628
8628
|
]
|
|
8629
8629
|
}, { uuid: f });
|
|
8630
8630
|
e.push(m);
|
|
8631
|
-
} else if (
|
|
8632
|
-
|
|
8631
|
+
} else if (h.dataContext.type === "relation") {
|
|
8632
|
+
h.dataContext;
|
|
8633
8633
|
const m = new D({
|
|
8634
8634
|
name: f,
|
|
8635
8635
|
properties: [
|
|
@@ -8776,7 +8776,7 @@ class ha {
|
|
|
8776
8776
|
}
|
|
8777
8777
|
async computeDataBasedDirtyRecordsAndEvents(t, e) {
|
|
8778
8778
|
let i = [];
|
|
8779
|
-
if (t.dataDep.type === "global" && e.recordName ===
|
|
8779
|
+
if (t.dataDep.type === "global" && e.recordName === K)
|
|
8780
8780
|
if (t.computation.dataContext.type === "property") {
|
|
8781
8781
|
const r = t.computation.dataContext;
|
|
8782
8782
|
i = (await this.controller.system.storage.find(r.host.name, w.atom({ key: "id", value: ["not", null] }), {}, ["*"])).map((s) => [s, {
|
|
@@ -8979,7 +8979,7 @@ class ha {
|
|
|
8979
8979
|
try {
|
|
8980
8980
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8981
8981
|
} catch (l) {
|
|
8982
|
-
throw new
|
|
8982
|
+
throw new ui("Failed to retrieve last value for incremental computation", {
|
|
8983
8983
|
handleName: t.constructor.name,
|
|
8984
8984
|
computationName: t.args.constructor.displayName,
|
|
8985
8985
|
dataContext: t.dataContext,
|
|
@@ -8993,7 +8993,7 @@ class ha {
|
|
|
8993
8993
|
try {
|
|
8994
8994
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8995
8995
|
} catch (l) {
|
|
8996
|
-
throw new
|
|
8996
|
+
throw new ui("Failed to retrieve last value for incremental patch computation", {
|
|
8997
8997
|
handleName: t.constructor.name,
|
|
8998
8998
|
computationName: t.args.constructor.displayName,
|
|
8999
8999
|
dataContext: t.dataContext,
|
|
@@ -9031,9 +9031,9 @@ class ha {
|
|
|
9031
9031
|
causedBy: o instanceof Error ? o : new Error(String(o))
|
|
9032
9032
|
});
|
|
9033
9033
|
}
|
|
9034
|
-
if (a instanceof
|
|
9034
|
+
if (a instanceof pt)
|
|
9035
9035
|
return;
|
|
9036
|
-
if (a instanceof
|
|
9036
|
+
if (a instanceof Vt)
|
|
9037
9037
|
try {
|
|
9038
9038
|
return await this.createAsyncTask(t, a.args, i);
|
|
9039
9039
|
} catch (o) {
|
|
@@ -9141,11 +9141,11 @@ class ha {
|
|
|
9141
9141
|
}
|
|
9142
9142
|
}
|
|
9143
9143
|
}
|
|
9144
|
-
const Fe = new
|
|
9144
|
+
const Fe = new Ni();
|
|
9145
9145
|
function pa() {
|
|
9146
9146
|
return Fe.getStore()?.effects;
|
|
9147
9147
|
}
|
|
9148
|
-
function
|
|
9148
|
+
function hi(c) {
|
|
9149
9149
|
const t = Fe.getStore();
|
|
9150
9150
|
t?.effects && t.effects.push(...c);
|
|
9151
9151
|
}
|
|
@@ -9157,31 +9157,31 @@ class M extends Error {
|
|
|
9157
9157
|
}
|
|
9158
9158
|
class he extends M {
|
|
9159
9159
|
}
|
|
9160
|
-
class
|
|
9160
|
+
class Cs extends M {
|
|
9161
9161
|
}
|
|
9162
|
-
class
|
|
9162
|
+
class Tt extends M {
|
|
9163
9163
|
}
|
|
9164
9164
|
class Ve extends M {
|
|
9165
9165
|
}
|
|
9166
|
-
class
|
|
9166
|
+
class St extends M {
|
|
9167
9167
|
}
|
|
9168
9168
|
class fa extends M {
|
|
9169
9169
|
}
|
|
9170
9170
|
function nt(c) {
|
|
9171
|
-
return Wi("sha256").update(
|
|
9171
|
+
return Wi("sha256").update(ft(c)).digest("hex");
|
|
9172
9172
|
}
|
|
9173
9173
|
function ma(c) {
|
|
9174
9174
|
return nt(c);
|
|
9175
9175
|
}
|
|
9176
|
-
function
|
|
9176
|
+
function ft(c) {
|
|
9177
9177
|
if (c === null || typeof c != "object")
|
|
9178
9178
|
return typeof c == "function" ? "[Function]" : JSON.stringify(c);
|
|
9179
9179
|
if (Array.isArray(c))
|
|
9180
|
-
return `[${c.map(
|
|
9180
|
+
return `[${c.map(ft).join(",")}]`;
|
|
9181
9181
|
const t = c;
|
|
9182
|
-
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${
|
|
9182
|
+
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${ft(t[e])}`).join(",")}}`;
|
|
9183
9183
|
}
|
|
9184
|
-
function
|
|
9184
|
+
function lt(c) {
|
|
9185
9185
|
return c.namePath;
|
|
9186
9186
|
}
|
|
9187
9187
|
function st(c, t, e) {
|
|
@@ -9245,7 +9245,7 @@ function wa(c) {
|
|
|
9245
9245
|
key: t.key,
|
|
9246
9246
|
scope: e ? "record" : "global",
|
|
9247
9247
|
hostRecord: e ? t.record : void 0,
|
|
9248
|
-
defaultSignature:
|
|
9248
|
+
defaultSignature: ft(t.defaultValue),
|
|
9249
9249
|
valueType: typeof t.defaultValue
|
|
9250
9250
|
};
|
|
9251
9251
|
});
|
|
@@ -9280,7 +9280,7 @@ ${i.text}`).join(`
|
|
|
9280
9280
|
};
|
|
9281
9281
|
}
|
|
9282
9282
|
function Na(c, t = !1) {
|
|
9283
|
-
const e = c.args, i = ga(c), r = ba(c), a = wa(c), s = a.map((b) => b.key), n = re(c), o = P(c.dataContext), l = c.dataContext.type === "entity" || c.dataContext.type === "relation" ? c.dataContext.id.name : void 0, u = c.constructor?.name || String(e._type || e.constructor?.name || "UnknownComputation"), d = st("computation", n, c.args.uuid),
|
|
9283
|
+
const e = c.args, i = ga(c), r = ba(c), a = wa(c), s = a.map((b) => b.key), n = re(c), o = P(c.dataContext), l = c.dataContext.type === "entity" || c.dataContext.type === "relation" ? c.dataContext.id.name : void 0, u = c.constructor?.name || String(e._type || e.constructor?.name || "UnknownComputation"), d = st("computation", n, c.args.uuid), h = Ra(e, t), f = nt({
|
|
9284
9284
|
type: u,
|
|
9285
9285
|
dataContext: o,
|
|
9286
9286
|
dataDeps: i,
|
|
@@ -9288,19 +9288,19 @@ function Na(c, t = !1) {
|
|
|
9288
9288
|
hasCompute: typeof c.compute == "function",
|
|
9289
9289
|
hasIncrementalCompute: typeof c.incrementalCompute == "function",
|
|
9290
9290
|
hasIncrementalPatchCompute: typeof c.incrementalPatchCompute == "function"
|
|
9291
|
-
}), m = nt({ stateKeys: s, boundStates: a }),
|
|
9291
|
+
}), m = nt({ stateKeys: s, boundStates: a }), p = nt({
|
|
9292
9292
|
type: u,
|
|
9293
9293
|
dataContext: o,
|
|
9294
9294
|
outputRecord: l,
|
|
9295
9295
|
outputProperty: c.dataContext.type === "property" ? c.dataContext.id.name : void 0,
|
|
9296
9296
|
deps: i,
|
|
9297
9297
|
eventDeps: r,
|
|
9298
|
-
callbackPaths:
|
|
9299
|
-
hasFunction:
|
|
9298
|
+
callbackPaths: h?.callbackPaths || [],
|
|
9299
|
+
hasFunction: h?.hasFunction === !0,
|
|
9300
9300
|
hasCompute: typeof c.compute == "function",
|
|
9301
9301
|
hasIncrementalCompute: typeof c.incrementalCompute == "function",
|
|
9302
9302
|
hasIncrementalPatchCompute: typeof c.incrementalPatchCompute == "function"
|
|
9303
|
-
}), y = nt({ structuralSignature:
|
|
9303
|
+
}), y = nt({ structuralSignature: p, stateSignature: m, functionHash: h?.hash });
|
|
9304
9304
|
return {
|
|
9305
9305
|
id: n,
|
|
9306
9306
|
identity: d,
|
|
@@ -9323,25 +9323,25 @@ function Na(c, t = !1) {
|
|
|
9323
9323
|
} : void 0,
|
|
9324
9324
|
outputSignature: f,
|
|
9325
9325
|
stateSignature: m,
|
|
9326
|
-
structuralSignature:
|
|
9327
|
-
functionSignature:
|
|
9326
|
+
structuralSignature: p,
|
|
9327
|
+
functionSignature: h,
|
|
9328
9328
|
signature: y
|
|
9329
9329
|
};
|
|
9330
9330
|
}
|
|
9331
|
-
function
|
|
9331
|
+
function jt(c, t = c.system.storage.schema, e = {}) {
|
|
9332
9332
|
const i = [
|
|
9333
9333
|
...c.entities.map((l) => {
|
|
9334
9334
|
const u = st("entity", `entity:${l.name}`, l.uuid);
|
|
9335
9335
|
return {
|
|
9336
|
-
id:
|
|
9336
|
+
id: lt(u),
|
|
9337
9337
|
identity: u,
|
|
9338
9338
|
name: l.name,
|
|
9339
9339
|
kind: "entity",
|
|
9340
9340
|
properties: (l.properties || []).map((d) => {
|
|
9341
|
-
const
|
|
9341
|
+
const h = st("property", `property:${l.name}.${d.name}`, d.uuid);
|
|
9342
9342
|
return {
|
|
9343
|
-
id:
|
|
9344
|
-
identity:
|
|
9343
|
+
id: lt(h),
|
|
9344
|
+
identity: h,
|
|
9345
9345
|
name: d.name,
|
|
9346
9346
|
type: d.type,
|
|
9347
9347
|
collection: d.collection === !0,
|
|
@@ -9353,15 +9353,15 @@ function Ht(c, t = c.system.storage.schema, e = {}) {
|
|
|
9353
9353
|
...c.relations.map((l) => {
|
|
9354
9354
|
const u = st("relation", `relation:${l.name}`, l.uuid);
|
|
9355
9355
|
return {
|
|
9356
|
-
id:
|
|
9356
|
+
id: lt(u),
|
|
9357
9357
|
identity: u,
|
|
9358
9358
|
name: l.name,
|
|
9359
9359
|
kind: "relation",
|
|
9360
9360
|
properties: (l.properties || []).map((d) => {
|
|
9361
|
-
const
|
|
9361
|
+
const h = st("property", `property:${l.name}.${d.name}`, d.uuid);
|
|
9362
9362
|
return {
|
|
9363
|
-
id:
|
|
9364
|
-
identity:
|
|
9363
|
+
id: lt(h),
|
|
9364
|
+
identity: h,
|
|
9365
9365
|
name: d.name,
|
|
9366
9366
|
type: d.type,
|
|
9367
9367
|
collection: d.collection === !0,
|
|
@@ -9373,7 +9373,7 @@ function Ht(c, t = c.system.storage.schema, e = {}) {
|
|
|
9373
9373
|
], r = c.relations.map((l) => {
|
|
9374
9374
|
const u = st("relation", `relation:${l.name}`, l.uuid);
|
|
9375
9375
|
return {
|
|
9376
|
-
id:
|
|
9376
|
+
id: lt(u),
|
|
9377
9377
|
identity: u,
|
|
9378
9378
|
name: l.name,
|
|
9379
9379
|
source: l.source.name,
|
|
@@ -9385,7 +9385,7 @@ function Ht(c, t = c.system.storage.schema, e = {}) {
|
|
|
9385
9385
|
}), a = c.dict.map((l) => {
|
|
9386
9386
|
const u = st("dictionary", `dictionary:${l.name}`, l.uuid);
|
|
9387
9387
|
return {
|
|
9388
|
-
id:
|
|
9388
|
+
id: lt(u),
|
|
9389
9389
|
identity: u,
|
|
9390
9390
|
name: l.name,
|
|
9391
9391
|
type: l.type,
|
|
@@ -9416,14 +9416,14 @@ function Ht(c, t = c.system.storage.schema, e = {}) {
|
|
|
9416
9416
|
storage: t
|
|
9417
9417
|
};
|
|
9418
9418
|
}
|
|
9419
|
-
function
|
|
9419
|
+
function $s(c, t) {
|
|
9420
9420
|
const e = new Map(c.computations.map((i) => [i.id, i]));
|
|
9421
9421
|
return t.computations.filter((i) => {
|
|
9422
9422
|
const r = e.get(i.id);
|
|
9423
9423
|
return !r || r.signature !== i.signature;
|
|
9424
9424
|
});
|
|
9425
9425
|
}
|
|
9426
|
-
function
|
|
9426
|
+
function ot(c) {
|
|
9427
9427
|
if (c.kind === "computation") return `${c.kind}:${c.id}`;
|
|
9428
9428
|
const t = c.kind === "destructive-scope" && c.recordName || "";
|
|
9429
9429
|
return `${c.kind}:${c.dataContext}:${t}`;
|
|
@@ -9437,49 +9437,49 @@ function va(c) {
|
|
|
9437
9437
|
function Ea(c) {
|
|
9438
9438
|
return c.kind === "computation" ? `computation:${c.id}` : c.kind === "dictionary" ? `dictionary:${c.id}` : c.kind === "record" ? `record:${c.id}` : c.kind === "property" ? `property:${c.id}` : c.kind === "relation" ? `relation:${c.id}` : `storage:${c.dataContext}`;
|
|
9439
9439
|
}
|
|
9440
|
-
function
|
|
9440
|
+
function Mi(c, t) {
|
|
9441
9441
|
return (c?.decisions || []).some(t);
|
|
9442
9442
|
}
|
|
9443
9443
|
function Qe(c, t) {
|
|
9444
9444
|
return (c?.decisions || []).find(t);
|
|
9445
9445
|
}
|
|
9446
|
-
function
|
|
9446
|
+
function Pi(c, t) {
|
|
9447
9447
|
return t ? c?.[t] : void 0;
|
|
9448
9448
|
}
|
|
9449
9449
|
function Gt(c, t) {
|
|
9450
9450
|
const e = Qe(c?.approvedDiff, (i) => i.kind === "event-rebuild-handler" && i.dataContext === t);
|
|
9451
|
-
return
|
|
9451
|
+
return Pi(c?.handlers?.eventRebuild, e?.handlerRef);
|
|
9452
9452
|
}
|
|
9453
|
-
function
|
|
9453
|
+
function Di(c, t) {
|
|
9454
9454
|
const e = Qe(c?.approvedDiff, (i) => i.kind === "async-completion-handler" && i.dataContext === t);
|
|
9455
|
-
return
|
|
9455
|
+
return Pi(c?.handlers?.asyncCompletion, e?.handlerRef);
|
|
9456
9456
|
}
|
|
9457
9457
|
function Ta(c, t, e, i) {
|
|
9458
|
-
const r = [], a = [], s = new Map(c.computations.map((
|
|
9459
|
-
for (const
|
|
9460
|
-
l.has(
|
|
9458
|
+
const r = [], a = [], s = new Map(c.computations.map((p) => [p.id, p])), n = new Map(t.computations.map((p) => [p.id, p])), o = new Map(c.records.map((p) => [p.id, p])), l = new Map(t.records.map((p) => [p.id, p])), u = new Map(c.relations.map((p) => [p.id, p])), d = new Map(t.relations.map((p) => [p.id, p])), h = new Map((c.dictionaries || []).map((p) => [p.id, p])), f = new Map((t.dictionaries || []).map((p) => [p.id, p]));
|
|
9459
|
+
for (const p of c.records)
|
|
9460
|
+
l.has(p.id) || r.push({
|
|
9461
9461
|
kind: "record",
|
|
9462
|
-
id:
|
|
9462
|
+
id: p.id,
|
|
9463
9463
|
changeType: "removed",
|
|
9464
|
-
dataContext: `${
|
|
9465
|
-
reason: `${
|
|
9464
|
+
dataContext: `${p.kind}:${p.name}`,
|
|
9465
|
+
reason: `${p.kind} no longer exists in the new model`
|
|
9466
9466
|
});
|
|
9467
|
-
for (const
|
|
9468
|
-
const y = o.get(
|
|
9469
|
-
y ? (y.kind !==
|
|
9467
|
+
for (const p of t.records) {
|
|
9468
|
+
const y = o.get(p.id);
|
|
9469
|
+
y ? (y.kind !== p.kind || y.name !== p.name) && r.push({
|
|
9470
9470
|
kind: "record",
|
|
9471
|
-
id:
|
|
9471
|
+
id: p.id,
|
|
9472
9472
|
changeType: "changed",
|
|
9473
|
-
dataContext: `${
|
|
9473
|
+
dataContext: `${p.kind}:${p.name}`,
|
|
9474
9474
|
reason: "record kind or name changed"
|
|
9475
9475
|
}) : r.push({
|
|
9476
9476
|
kind: "record",
|
|
9477
|
-
id:
|
|
9477
|
+
id: p.id,
|
|
9478
9478
|
changeType: "added",
|
|
9479
|
-
dataContext: `${
|
|
9480
|
-
reason: `${
|
|
9479
|
+
dataContext: `${p.kind}:${p.name}`,
|
|
9480
|
+
reason: `${p.kind} was added`
|
|
9481
9481
|
});
|
|
9482
|
-
const b = new Map((y?.properties || []).map((N) => [N.id, N])), v = new Map(
|
|
9482
|
+
const b = new Map((y?.properties || []).map((N) => [N.id, N])), v = new Map(p.properties.map((N) => [N.id, N]));
|
|
9483
9483
|
for (const N of y?.properties || [])
|
|
9484
9484
|
v.has(N.id) || r.push({
|
|
9485
9485
|
kind: "property",
|
|
@@ -9488,142 +9488,142 @@ function Ta(c, t, e, i) {
|
|
|
9488
9488
|
dataContext: `property:${y?.name}.${N.name}`,
|
|
9489
9489
|
reason: "property no longer exists in the new model"
|
|
9490
9490
|
});
|
|
9491
|
-
for (const N of
|
|
9491
|
+
for (const N of p.properties) {
|
|
9492
9492
|
const I = b.get(N.id);
|
|
9493
9493
|
I ? (I.name !== N.name || I.type !== N.type || I.collection !== N.collection || I.computed !== N.computed) && r.push({
|
|
9494
9494
|
kind: "property",
|
|
9495
9495
|
id: N.id,
|
|
9496
9496
|
changeType: "changed",
|
|
9497
|
-
dataContext: `property:${
|
|
9497
|
+
dataContext: `property:${p.name}.${N.name}`,
|
|
9498
9498
|
reason: "property name, type, collection, or computed flag changed"
|
|
9499
9499
|
}) : r.push({
|
|
9500
9500
|
kind: "property",
|
|
9501
9501
|
id: N.id,
|
|
9502
9502
|
changeType: "added",
|
|
9503
|
-
dataContext: `property:${
|
|
9503
|
+
dataContext: `property:${p.name}.${N.name}`,
|
|
9504
9504
|
reason: "property was added"
|
|
9505
9505
|
});
|
|
9506
9506
|
}
|
|
9507
9507
|
}
|
|
9508
|
-
for (const
|
|
9509
|
-
d.has(
|
|
9508
|
+
for (const p of c.relations)
|
|
9509
|
+
d.has(p.id) || r.push({
|
|
9510
9510
|
kind: "relation",
|
|
9511
|
-
id:
|
|
9511
|
+
id: p.id,
|
|
9512
9512
|
changeType: "removed",
|
|
9513
|
-
dataContext: `relation:${
|
|
9513
|
+
dataContext: `relation:${p.name}`,
|
|
9514
9514
|
reason: "relation no longer exists in the new model"
|
|
9515
9515
|
});
|
|
9516
|
-
for (const
|
|
9517
|
-
const y = u.get(
|
|
9518
|
-
y ? (y.name !==
|
|
9516
|
+
for (const p of t.relations) {
|
|
9517
|
+
const y = u.get(p.id);
|
|
9518
|
+
y ? (y.name !== p.name || y.source !== p.source || y.target !== p.target || y.sourceProperty !== p.sourceProperty || y.targetProperty !== p.targetProperty || y.type !== p.type) && r.push({
|
|
9519
9519
|
kind: "relation",
|
|
9520
|
-
id:
|
|
9520
|
+
id: p.id,
|
|
9521
9521
|
changeType: "changed",
|
|
9522
|
-
dataContext: `relation:${
|
|
9522
|
+
dataContext: `relation:${p.name}`,
|
|
9523
9523
|
reason: "relation endpoints, properties, or type changed"
|
|
9524
9524
|
}) : r.push({
|
|
9525
9525
|
kind: "relation",
|
|
9526
|
-
id:
|
|
9526
|
+
id: p.id,
|
|
9527
9527
|
changeType: "added",
|
|
9528
|
-
dataContext: `relation:${
|
|
9528
|
+
dataContext: `relation:${p.name}`,
|
|
9529
9529
|
reason: "relation was added"
|
|
9530
9530
|
});
|
|
9531
9531
|
}
|
|
9532
|
-
for (const
|
|
9533
|
-
f.has(
|
|
9532
|
+
for (const p of c.dictionaries || [])
|
|
9533
|
+
f.has(p.id) || r.push({
|
|
9534
9534
|
kind: "dictionary",
|
|
9535
|
-
id:
|
|
9535
|
+
id: p.id,
|
|
9536
9536
|
changeType: "removed",
|
|
9537
|
-
dataContext: `global:${
|
|
9537
|
+
dataContext: `global:${p.name}`,
|
|
9538
9538
|
reason: "dictionary no longer exists in the new model"
|
|
9539
9539
|
});
|
|
9540
|
-
for (const
|
|
9541
|
-
const y =
|
|
9540
|
+
for (const p of t.dictionaries || []) {
|
|
9541
|
+
const y = h.get(p.id);
|
|
9542
9542
|
let b = "unchanged", v = "dictionary is unchanged";
|
|
9543
|
-
y ? (y.type !==
|
|
9543
|
+
y ? (y.type !== p.type || y.collection !== p.collection || y.computed !== p.computed) && (b = "changed", v = "dictionary type, collection, or computed flag changed") : (b = "added", v = "dictionary was added"), b !== "unchanged" && r.push({
|
|
9544
9544
|
kind: "dictionary",
|
|
9545
|
-
id:
|
|
9545
|
+
id: p.id,
|
|
9546
9546
|
changeType: b,
|
|
9547
|
-
dataContext: `global:${
|
|
9547
|
+
dataContext: `global:${p.name}`,
|
|
9548
9548
|
reason: v
|
|
9549
9549
|
});
|
|
9550
9550
|
}
|
|
9551
|
-
for (const
|
|
9552
|
-
n.has(
|
|
9551
|
+
for (const p of c.computations)
|
|
9552
|
+
n.has(p.id) || r.push({
|
|
9553
9553
|
kind: "computation",
|
|
9554
|
-
id:
|
|
9555
|
-
dataContext:
|
|
9556
|
-
computationType:
|
|
9554
|
+
id: p.id,
|
|
9555
|
+
dataContext: p.dataContext,
|
|
9556
|
+
computationType: p.type,
|
|
9557
9557
|
changeType: "removed",
|
|
9558
9558
|
detected: {},
|
|
9559
9559
|
recommendation: "ignore",
|
|
9560
9560
|
reason: "computation no longer exists in the new model"
|
|
9561
9561
|
});
|
|
9562
|
-
for (const
|
|
9563
|
-
const y = s.get(
|
|
9564
|
-
dataDepsChanged: y ? !Yt(y.deps,
|
|
9565
|
-
eventDepsChanged: y ? !Yt(y.eventDeps,
|
|
9566
|
-
outputSignatureChanged: y ? y.outputSignature !==
|
|
9567
|
-
stateSignatureChanged: y ? y.stateSignature !==
|
|
9568
|
-
functionTextChanged: y ? y.functionSignature?.hash !==
|
|
9569
|
-
functionHash:
|
|
9562
|
+
for (const p of t.computations) {
|
|
9563
|
+
const y = s.get(p.id), b = {
|
|
9564
|
+
dataDepsChanged: y ? !Yt(y.deps, p.deps) : !0,
|
|
9565
|
+
eventDepsChanged: y ? !Yt(y.eventDeps, p.eventDeps) : !0,
|
|
9566
|
+
outputSignatureChanged: y ? y.outputSignature !== p.outputSignature : !0,
|
|
9567
|
+
stateSignatureChanged: y ? y.stateSignature !== p.stateSignature : !0,
|
|
9568
|
+
functionTextChanged: y ? y.functionSignature?.hash !== p.functionSignature?.hash : p.functionSignature?.hasFunction === !0,
|
|
9569
|
+
functionHash: p.functionSignature?.hash,
|
|
9570
9570
|
previousFunctionHash: y?.functionSignature?.hash,
|
|
9571
|
-
hasFunction:
|
|
9572
|
-
hasClosureRisk:
|
|
9573
|
-
needsEventRebuildHandler:
|
|
9574
|
-
needsAsyncCompletionHandler:
|
|
9571
|
+
hasFunction: p.functionSignature?.hasFunction === !0,
|
|
9572
|
+
hasClosureRisk: p.functionSignature?.hasFunction === !0,
|
|
9573
|
+
needsEventRebuildHandler: p.eventDeps.length > 0,
|
|
9574
|
+
needsAsyncCompletionHandler: p.asyncReturn
|
|
9575
9575
|
};
|
|
9576
9576
|
let v = "unchanged", N = "ignore", I = "unchanged", S = "computation is structurally unchanged";
|
|
9577
|
-
y ? y.structuralSignature !==
|
|
9577
|
+
y ? y.structuralSignature !== p.structuralSignature ? (v = "changed", N = "needs-review", I = "changed", S = "computation structure changed") : y.stateSignature !== p.stateSignature && y.outputSignature === p.outputSignature ? (v = "state-only", N = "needs-review", I = "state-only", S = "computation state changed without output structure changes") : y.functionSignature?.hash !== p.functionSignature?.hash ? (v = "possibly-changed", N = "needs-review", I = "changed", S = "function text changed and requires human semantic review") : p.functionSignature?.hasFunction && (N = "needs-review", S = "function callback has closure risk and requires human review") : (v = "added", N = "rebuild", I = "changed", S = "new computation requires approved rebuild"), r.push({
|
|
9578
9578
|
kind: "computation",
|
|
9579
|
-
id:
|
|
9580
|
-
dataContext:
|
|
9581
|
-
computationType:
|
|
9579
|
+
id: p.id,
|
|
9580
|
+
dataContext: p.dataContext,
|
|
9581
|
+
computationType: p.type,
|
|
9582
9582
|
changeType: v,
|
|
9583
9583
|
detected: b,
|
|
9584
9584
|
recommendation: N,
|
|
9585
9585
|
reason: S
|
|
9586
9586
|
}), N !== "ignore" && a.push({
|
|
9587
9587
|
kind: "computation",
|
|
9588
|
-
id:
|
|
9589
|
-
dataContext:
|
|
9588
|
+
id: p.id,
|
|
9589
|
+
dataContext: p.dataContext,
|
|
9590
9590
|
recommendedDecision: I,
|
|
9591
9591
|
reason: S
|
|
9592
9592
|
}), b.needsEventRebuildHandler && a.push({
|
|
9593
9593
|
kind: "event-rebuild-handler",
|
|
9594
|
-
dataContext:
|
|
9594
|
+
dataContext: p.dataContext,
|
|
9595
9595
|
reason: "event-based computation needs an external migration rebuild handler"
|
|
9596
9596
|
}), b.needsAsyncCompletionHandler && a.push({
|
|
9597
9597
|
kind: "async-completion-handler",
|
|
9598
|
-
dataContext:
|
|
9598
|
+
dataContext: p.dataContext,
|
|
9599
9599
|
reason: "async computation needs an external migration completion handler"
|
|
9600
9600
|
});
|
|
9601
9601
|
}
|
|
9602
|
-
for (const
|
|
9602
|
+
for (const p of e.preRecomputeDDL)
|
|
9603
9603
|
r.push({
|
|
9604
9604
|
kind: "storage",
|
|
9605
|
-
id:
|
|
9605
|
+
id: p.logicalPath || p.description,
|
|
9606
9606
|
changeType: "added",
|
|
9607
|
-
dataContext:
|
|
9608
|
-
reason:
|
|
9607
|
+
dataContext: p.logicalPath || p.tableName || p.description,
|
|
9608
|
+
reason: p.description
|
|
9609
9609
|
});
|
|
9610
|
-
for (const
|
|
9610
|
+
for (const p of i.blockingChanges)
|
|
9611
9611
|
r.push({
|
|
9612
9612
|
kind: "storage",
|
|
9613
|
-
id:
|
|
9613
|
+
id: p.logicalPath,
|
|
9614
9614
|
changeType: "blocked",
|
|
9615
|
-
dataContext:
|
|
9616
|
-
reason:
|
|
9615
|
+
dataContext: p.logicalPath,
|
|
9616
|
+
reason: p.reason
|
|
9617
9617
|
});
|
|
9618
|
-
for (const
|
|
9618
|
+
for (const p of i.destructiveScopes)
|
|
9619
9619
|
a.push({
|
|
9620
9620
|
kind: "destructive-scope",
|
|
9621
|
-
dataContext:
|
|
9622
|
-
recordName:
|
|
9623
|
-
ids:
|
|
9624
|
-
reason:
|
|
9621
|
+
dataContext: p.dataContext,
|
|
9622
|
+
recordName: p.recordName,
|
|
9623
|
+
ids: p.ids || [],
|
|
9624
|
+
reason: p.reason
|
|
9625
9625
|
});
|
|
9626
|
-
const m = Array.from(new Map(a.map((
|
|
9626
|
+
const m = Array.from(new Map(a.map((p) => [ot(p), p])).values());
|
|
9627
9627
|
return {
|
|
9628
9628
|
kind: "interaqt-migration-diff",
|
|
9629
9629
|
version: 2,
|
|
@@ -9643,7 +9643,25 @@ function Ta(c, t, e, i) {
|
|
|
9643
9643
|
safety: i
|
|
9644
9644
|
};
|
|
9645
9645
|
}
|
|
9646
|
-
function Sa(c, t, e
|
|
9646
|
+
function Sa(c, t, e) {
|
|
9647
|
+
const i = Be(t), r = new Map(c.requiredDecisions.map((a) => [ot(a), a]));
|
|
9648
|
+
for (const a of e) {
|
|
9649
|
+
if (!a.rebuildOutput) continue;
|
|
9650
|
+
const s = i.get(a.computationId);
|
|
9651
|
+
if (!s || typeof s.compute == "function") continue;
|
|
9652
|
+
const n = {
|
|
9653
|
+
kind: "event-rebuild-handler",
|
|
9654
|
+
dataContext: a.dataContext,
|
|
9655
|
+
reason: "computation without full compute support needs an external migration rebuild handler"
|
|
9656
|
+
};
|
|
9657
|
+
r.set(ot(n), n);
|
|
9658
|
+
}
|
|
9659
|
+
return c.requiredDecisions = Array.from(r.values()), c.summary = {
|
|
9660
|
+
...c.summary,
|
|
9661
|
+
requiredDecisionCount: c.requiredDecisions.length
|
|
9662
|
+
}, c;
|
|
9663
|
+
}
|
|
9664
|
+
function ka(c, t, e, i, r) {
|
|
9647
9665
|
if (!c)
|
|
9648
9666
|
throw new M("Migration requires an approved diff. Call controller.generateMigrationDiff(), review it, set status to 'approved', then pass it as migrate({ approvedDiff }).");
|
|
9649
9667
|
if (c.kind !== "interaqt-migration-diff" || c.version !== 2)
|
|
@@ -9652,37 +9670,40 @@ function Sa(c, t, e, i, r) {
|
|
|
9652
9670
|
throw new M("Migration approvedDiff must have status 'approved'");
|
|
9653
9671
|
if (c.fromModelHash !== t.modelHash || c.toModelHash !== e.modelHash)
|
|
9654
9672
|
throw new M("Migration approvedDiff is stale: model hash does not match current database and code");
|
|
9655
|
-
const a = r || c, s = new Set(
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
const
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9673
|
+
const a = r || c, s = new Set(c.requiredDecisions.map(ot)), n = /* @__PURE__ */ new Set([
|
|
9674
|
+
...a.requiredDecisions.map(ot),
|
|
9675
|
+
...s
|
|
9676
|
+
]), o = new Set(a.changes.map(Ea)), l = /* @__PURE__ */ new Set();
|
|
9677
|
+
for (const d of c.decisions) {
|
|
9678
|
+
const h = va(d);
|
|
9679
|
+
if (l.has(h))
|
|
9680
|
+
throw new M(`Duplicate migration decision: ${h}`);
|
|
9681
|
+
if (l.add(h), d.kind === "computation" && !o.has(`computation:${d.id}`))
|
|
9682
|
+
throw new M(`Migration decision references a computation that is not present in the approved diff: ${d.id}`);
|
|
9683
|
+
if (d.kind === "event-rebuild-handler") {
|
|
9684
|
+
if (!n.has(h))
|
|
9685
|
+
throw new M(`Migration event rebuild decision does not match a required review item: ${d.dataContext}`);
|
|
9686
|
+
if (!i?.eventRebuild?.[d.handlerRef])
|
|
9687
|
+
throw new M(`Missing migration event rebuild handler '${d.handlerRef}' for ${d.dataContext}`);
|
|
9688
|
+
}
|
|
9689
|
+
if (d.kind === "async-completion-handler") {
|
|
9690
|
+
if (!n.has(h))
|
|
9691
|
+
throw new M(`Migration async completion decision does not match a required review item: ${d.dataContext}`);
|
|
9692
|
+
if (!i?.asyncCompletion?.[d.handlerRef])
|
|
9693
|
+
throw new M(`Missing migration async completion handler '${d.handlerRef}' for ${d.dataContext}`);
|
|
9694
|
+
}
|
|
9695
|
+
if (d.kind === "rename-candidate-reviewed")
|
|
9696
|
+
throw new M(`Migration rename candidate decision does not match any Phase 1.5 executable review item: ${d.from} -> ${d.to}`);
|
|
9697
|
+
}
|
|
9698
|
+
for (const d of a.requiredDecisions)
|
|
9699
|
+
if (!l.has(ot(d)))
|
|
9700
|
+
throw new M(`Missing migration decision for required review item: ${ot(d)}`);
|
|
9701
|
+
const u = new Set(e.computations.map((d) => d.id));
|
|
9702
|
+
for (const d of c.decisions)
|
|
9703
|
+
if (d.kind === "computation" && !u.has(d.id))
|
|
9704
|
+
throw new M(`Migration decision references unknown computation: ${d.id}`);
|
|
9705
|
+
}
|
|
9706
|
+
function Aa(c, t, e) {
|
|
9686
9707
|
const i = [], r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = new Map(t.computations.map((o) => [o.id, o]));
|
|
9687
9708
|
for (const o of e.decisions) {
|
|
9688
9709
|
if (o.kind !== "computation") continue;
|
|
@@ -9695,13 +9716,13 @@ function ka(c, t, e) {
|
|
|
9695
9716
|
const n = e.decisions.filter((o) => o.kind === "computation" && o.decision === "unrebuildable").map((o) => ({ kind: "unrebuildable-computation", logicalPath: o.dataContext, reason: o.reason }));
|
|
9696
9717
|
return { changedComputations: i, outputChangedIds: r, stateOnlyIds: a, blocking: n };
|
|
9697
9718
|
}
|
|
9698
|
-
function
|
|
9719
|
+
function Be(c) {
|
|
9699
9720
|
return new Map(Array.from(c.scheduler.computationsHandles.values()).map((t) => [re(t), t]));
|
|
9700
9721
|
}
|
|
9701
9722
|
function pe(c) {
|
|
9702
9723
|
return c.dataContext;
|
|
9703
9724
|
}
|
|
9704
|
-
function
|
|
9725
|
+
function Ca(c, t, e) {
|
|
9705
9726
|
return c.relations.find(
|
|
9706
9727
|
(i) => i.source === t && i.sourceProperty === e || i.target === t && i.targetProperty === e
|
|
9707
9728
|
);
|
|
@@ -9709,13 +9730,13 @@ function Aa(c, t, e) {
|
|
|
9709
9730
|
function Oi(c, t, e) {
|
|
9710
9731
|
return e.flatMap((i) => {
|
|
9711
9732
|
if (!Array.isArray(i) || typeof i[0] != "string") return [];
|
|
9712
|
-
const r =
|
|
9733
|
+
const r = Ca(c, t, i[0]);
|
|
9713
9734
|
if (!r) return [];
|
|
9714
9735
|
const a = r.source === t ? r.target : r.source, s = i[1], o = (Array.isArray(s?.attributeQuery) ? s.attributeQuery : []).flatMap((l) => typeof l == "string" && l !== "*" && l !== g ? [`property:${a}.${l}`] : Array.isArray(l) && l[0] === g ? [`relation:${r.name}`] : Array.isArray(l) ? Oi(c, a, [l]) : []);
|
|
9715
9736
|
return [`relation:${r.name}`, ...o];
|
|
9716
9737
|
});
|
|
9717
9738
|
}
|
|
9718
|
-
function
|
|
9739
|
+
function pi(c, t, e) {
|
|
9719
9740
|
if (c.type === "global" && c.source) return [`global:${c.source}`];
|
|
9720
9741
|
if (c.type === "records" && c.source) return [`entity:${c.source}`];
|
|
9721
9742
|
if (c.type === "property") {
|
|
@@ -9726,7 +9747,7 @@ function hi(c, t, e) {
|
|
|
9726
9747
|
}
|
|
9727
9748
|
return [];
|
|
9728
9749
|
}
|
|
9729
|
-
function
|
|
9750
|
+
function fi(c, t) {
|
|
9730
9751
|
const e = [`entity:${c.recordName}`];
|
|
9731
9752
|
if (c.type === "update") {
|
|
9732
9753
|
const i = t.records.find((r) => r.name === c.recordName);
|
|
@@ -9734,54 +9755,54 @@ function pi(c, t) {
|
|
|
9734
9755
|
}
|
|
9735
9756
|
return e;
|
|
9736
9757
|
}
|
|
9737
|
-
function
|
|
9738
|
-
const a = new Map(t.computations.map((
|
|
9739
|
-
for (const
|
|
9740
|
-
for (const y of
|
|
9741
|
-
for (const b of
|
|
9742
|
-
n.has(b) || n.set(b, /* @__PURE__ */ new Set()), n.get(b).add(
|
|
9743
|
-
for (const y of
|
|
9744
|
-
for (const b of
|
|
9745
|
-
b !==
|
|
9746
|
-
}
|
|
9747
|
-
const o = new Set(e.map((
|
|
9748
|
-
const y = s.get(
|
|
9749
|
-
return r.outputChangedIds?.has(
|
|
9750
|
-
}).map((
|
|
9758
|
+
function mi(c, t, e, i = [], r = {}) {
|
|
9759
|
+
const a = new Map(t.computations.map((p) => [pe(p), p])), s = new Map(c.computations.map((p) => [p.id, p])), n = /* @__PURE__ */ new Map();
|
|
9760
|
+
for (const p of t.computations) {
|
|
9761
|
+
for (const y of p.deps)
|
|
9762
|
+
for (const b of pi(y, p, t))
|
|
9763
|
+
n.has(b) || n.set(b, /* @__PURE__ */ new Set()), n.get(b).add(p.id);
|
|
9764
|
+
for (const y of p.eventDeps)
|
|
9765
|
+
for (const b of fi(y, t))
|
|
9766
|
+
b !== p.dataContext && (n.has(b) || n.set(b, /* @__PURE__ */ new Set()), n.get(b).add(p.id));
|
|
9767
|
+
}
|
|
9768
|
+
const o = new Set(e.map((p) => p.id)), u = [...e.filter((p) => {
|
|
9769
|
+
const y = s.get(p.id);
|
|
9770
|
+
return r.outputChangedIds?.has(p.id) || !y || y.outputSignature !== p.outputSignature;
|
|
9771
|
+
}).map((p) => pe(p)), ...i];
|
|
9751
9772
|
for (; u.length; ) {
|
|
9752
|
-
const
|
|
9753
|
-
for (const y of n.get(
|
|
9773
|
+
const p = u.shift();
|
|
9774
|
+
for (const y of n.get(p) || []) {
|
|
9754
9775
|
if (o.has(y)) continue;
|
|
9755
9776
|
o.add(y);
|
|
9756
9777
|
const b = t.computations.find((v) => v.id === y);
|
|
9757
9778
|
b && u.push(pe(b));
|
|
9758
9779
|
}
|
|
9759
9780
|
}
|
|
9760
|
-
const d = /* @__PURE__ */ new Set(),
|
|
9761
|
-
if (
|
|
9762
|
-
if (d.has(
|
|
9763
|
-
throw new
|
|
9764
|
-
d.add(
|
|
9765
|
-
const y = t.computations.find((b) => b.id ===
|
|
9781
|
+
const d = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), f = [], m = (p) => {
|
|
9782
|
+
if (h.has(p)) return;
|
|
9783
|
+
if (d.has(p))
|
|
9784
|
+
throw new Tt(`Migration detected a derived computation cycle at ${p}`);
|
|
9785
|
+
d.add(p);
|
|
9786
|
+
const y = t.computations.find((b) => b.id === p);
|
|
9766
9787
|
if (y) {
|
|
9767
9788
|
for (const b of y.deps)
|
|
9768
|
-
for (const v of
|
|
9789
|
+
for (const v of pi(b, y, t)) {
|
|
9769
9790
|
const N = a.get(v);
|
|
9770
9791
|
N && o.has(N.id) && m(N.id);
|
|
9771
9792
|
}
|
|
9772
9793
|
for (const b of y.eventDeps)
|
|
9773
|
-
for (const v of
|
|
9794
|
+
for (const v of fi(b, t)) {
|
|
9774
9795
|
if (v === y.dataContext) continue;
|
|
9775
9796
|
const N = a.get(v);
|
|
9776
9797
|
N && o.has(N.id) && m(N.id);
|
|
9777
9798
|
}
|
|
9778
9799
|
}
|
|
9779
|
-
d.delete(
|
|
9800
|
+
d.delete(p), h.add(p), f.push(p);
|
|
9780
9801
|
};
|
|
9781
|
-
return o.forEach(m), f.map((
|
|
9782
|
-
const y = t.computations.find((W) => W.id ===
|
|
9802
|
+
return o.forEach(m), f.map((p) => {
|
|
9803
|
+
const y = t.computations.find((W) => W.id === p), b = s.get(p), v = r.stateOnlyIds?.has(p) === !0, N = r.outputChangedIds?.has(p) || !b || b.outputSignature !== y.outputSignature, I = !b || b.stateSignature !== y.stateSignature, S = e.some((W) => W.id === p);
|
|
9783
9804
|
return {
|
|
9784
|
-
computationId:
|
|
9805
|
+
computationId: p,
|
|
9785
9806
|
dataContext: y.dataContext,
|
|
9786
9807
|
rebuildState: (v || I) && y.boundStates.length > 0,
|
|
9787
9808
|
rebuildOutput: v ? !1 : N || !S,
|
|
@@ -9793,7 +9814,7 @@ function fi(c, t, e, i = [], r = {}) {
|
|
|
9793
9814
|
function fe(c, t) {
|
|
9794
9815
|
return `${c || "?"}.${t || "?"}`;
|
|
9795
9816
|
}
|
|
9796
|
-
function
|
|
9817
|
+
function yi(c, t) {
|
|
9797
9818
|
const e = [], i = new Map(c.storage.records.map((l) => [l.recordName, l])), r = new Map(t.storage.records.map((l) => [l.recordName, l])), a = new Map(c.records.map((l) => [l.name, l])), s = new Map(t.records.map((l) => [l.name, l])), n = (l) => l.startsWith("_ASYNC_TASK__"), o = (l) => c.computations.some((u) => u.outputRecord === l);
|
|
9798
9819
|
for (const l of c.storage.records)
|
|
9799
9820
|
if (!r.has(l.recordName) && !l.isFiltered) {
|
|
@@ -9815,11 +9836,11 @@ function mi(c, t) {
|
|
|
9815
9836
|
newPhysicalPath: l.tableName,
|
|
9816
9837
|
reason: "fact record table changed"
|
|
9817
9838
|
});
|
|
9818
|
-
const d = new Map((u.attributeDetails || []).map((m) => [m.name, m])),
|
|
9839
|
+
const d = new Map((u.attributeDetails || []).map((m) => [m.name, m])), h = new Map((l.attributeDetails || []).map((m) => [m.name, m]));
|
|
9819
9840
|
a.get(u.recordName), s.get(l.recordName);
|
|
9820
|
-
const f = (m,
|
|
9841
|
+
const f = (m, p, y) => y.records.find((v) => v.name === m)?.properties.find((v) => v.name === p)?.computed === !0;
|
|
9821
9842
|
for (const m of u.attributeDetails || [])
|
|
9822
|
-
if (!
|
|
9843
|
+
if (!h.get(m.name) && !m.name.startsWith("_")) {
|
|
9823
9844
|
const y = f(u.recordName, m.name, c);
|
|
9824
9845
|
e.push({
|
|
9825
9846
|
kind: "unsupported-destructive-schema-change",
|
|
@@ -9829,17 +9850,17 @@ function mi(c, t) {
|
|
|
9829
9850
|
});
|
|
9830
9851
|
}
|
|
9831
9852
|
for (const m of l.attributeDetails || []) {
|
|
9832
|
-
const
|
|
9833
|
-
!
|
|
9853
|
+
const p = d.get(m.name);
|
|
9854
|
+
!p || f(u.recordName, m.name, c) || f(l.recordName, m.name, t) || ((p.kind !== m.kind || p.tableName !== m.tableName || p.fieldName !== m.fieldName || p.sourceField !== m.sourceField || p.targetField !== m.targetField) && e.push({
|
|
9834
9855
|
kind: "physical-path-move",
|
|
9835
9856
|
logicalPath: `${l.recordName}.${m.name}`,
|
|
9836
|
-
oldPhysicalPath: fe(
|
|
9857
|
+
oldPhysicalPath: fe(p.tableName, p.fieldName || p.sourceField || p.targetField),
|
|
9837
9858
|
newPhysicalPath: fe(m.tableName, m.fieldName || m.sourceField || m.targetField),
|
|
9838
9859
|
reason: "fact attribute physical path changed"
|
|
9839
|
-
}), (
|
|
9860
|
+
}), (p.type !== m.type || p.fieldType !== m.fieldType || p.collection !== m.collection) && e.push({
|
|
9840
9861
|
kind: "unsupported-destructive-schema-change",
|
|
9841
9862
|
logicalPath: `${l.recordName}.${m.name}`,
|
|
9842
|
-
oldPhysicalPath: `${
|
|
9863
|
+
oldPhysicalPath: `${p.type || "?"}/${p.fieldType || "?"}/${p.collection === !0}`,
|
|
9843
9864
|
newPhysicalPath: `${m.type || "?"}/${m.fieldType || "?"}/${m.collection === !0}`,
|
|
9844
9865
|
reason: "fact attribute type, field type, or collection flag changed"
|
|
9845
9866
|
}));
|
|
@@ -9847,17 +9868,17 @@ function mi(c, t) {
|
|
|
9847
9868
|
}
|
|
9848
9869
|
return e;
|
|
9849
9870
|
}
|
|
9850
|
-
function
|
|
9871
|
+
function $a(c, t, e, i) {
|
|
9851
9872
|
const r = c.computations.find((a) => a.id === t && a.dataContext === e);
|
|
9852
9873
|
return r ? r.owner === "exclusive" && r.ownershipProof?.kind === "computed-output" && r.ownershipProof.owner === "exclusive" && r.ownershipProof.ownerComputationId === t && r.ownershipProof.dataContext === e && r.ownershipProof.outputRecord === r.outputRecord : !(i !== void 0 && (c.records.some((s) => s.name === i) || c.storage.records.some((s) => s.recordName === i)));
|
|
9853
9874
|
}
|
|
9854
|
-
function
|
|
9875
|
+
function Ia(c, t, e = {}, i) {
|
|
9855
9876
|
const r = [], a = new Set(t.map((s) => s.computationId));
|
|
9856
9877
|
for (const s of c.scheduler.computationsHandles.values()) {
|
|
9857
9878
|
const n = re(s);
|
|
9858
9879
|
if (!a.has(n)) continue;
|
|
9859
9880
|
const o = P(s.dataContext);
|
|
9860
|
-
if (s.dataContext.type === "property" && s.dataContext.id.name === _e && !
|
|
9881
|
+
if (s.dataContext.type === "property" && s.dataContext.id.name === _e && !Mi(e.approvedDiff, (l) => l.kind === "destructive-scope" && l.dataContext === o) && r.push({ kind: "destructive-computed-output", logicalPath: o, reason: "destructive computed output requires an approved destructive-scope decision" }), s.asyncReturn && !Di(e, o) && r.push({ kind: "async-computation", logicalPath: o, reason: "async computation requires an approved async-completion-handler decision and runtime handler" }), (s.dataContext.type === "entity" || s.dataContext.type === "relation") && !s.compute && r.push({ kind: "unrebuildable-computation", logicalPath: o, reason: "entity/relation output lacks a full compute contract" }), s.dataContext.type === "entity" || s.dataContext.type === "relation") {
|
|
9861
9882
|
const l = s.state?.sourceRecordId?.key, u = s.state?.transformIndex?.key;
|
|
9862
9883
|
(!l || !u || typeof s.eventDeps == "object") && r.push({
|
|
9863
9884
|
kind: "unrebuildable-computation",
|
|
@@ -9865,7 +9886,7 @@ function $a(c, t, e = {}, i) {
|
|
|
9865
9886
|
reason: "entity/relation output migration requires a data-based Transform with sourceRecordId and transformIndex state"
|
|
9866
9887
|
});
|
|
9867
9888
|
}
|
|
9868
|
-
(s.dataContext.type === "entity" || s.dataContext.type === "relation") && i &&
|
|
9889
|
+
(s.dataContext.type === "entity" || s.dataContext.type === "relation") && i && !$a(i, n, o, s.dataContext.id.name) && r.push({
|
|
9869
9890
|
kind: "destructive-computed-output",
|
|
9870
9891
|
logicalPath: o,
|
|
9871
9892
|
reason: "entity/relation output replacement requires exclusive output ownership proof in the previous manifest"
|
|
@@ -9874,7 +9895,7 @@ function $a(c, t, e = {}, i) {
|
|
|
9874
9895
|
return r;
|
|
9875
9896
|
}
|
|
9876
9897
|
async function Te(c, t, e) {
|
|
9877
|
-
const i =
|
|
9898
|
+
const i = Be(c), r = [], a = async (s) => {
|
|
9878
9899
|
if (c.system.storage.queryHandle)
|
|
9879
9900
|
return c.system.storage.find(s, void 0, void 0, ["*"]);
|
|
9880
9901
|
if (!e) return;
|
|
@@ -9882,8 +9903,8 @@ async function Te(c, t, e) {
|
|
|
9882
9903
|
if (!o || !l || u.length === 0) return;
|
|
9883
9904
|
const d = c.system.storage.db || c.system.db;
|
|
9884
9905
|
if (typeof d?.query != "function") return;
|
|
9885
|
-
const
|
|
9886
|
-
return d.query(`SELECT ${f} FROM ${
|
|
9906
|
+
const h = (m) => `"${m.replace(/"/g, '""')}"`, f = u.map((m) => `${h(m.fieldName)} AS ${h(m.name)}`).join(", ");
|
|
9907
|
+
return d.query(`SELECT ${f} FROM ${h(l)}`, []);
|
|
9887
9908
|
};
|
|
9888
9909
|
for (const s of t) {
|
|
9889
9910
|
const n = i.get(s.computationId);
|
|
@@ -9909,7 +9930,7 @@ async function Te(c, t, e) {
|
|
|
9909
9930
|
if (!l || !u) continue;
|
|
9910
9931
|
const d = await n.compute(await c.scheduler.resolveDataDeps(n));
|
|
9911
9932
|
if (!Array.isArray(d)) continue;
|
|
9912
|
-
const
|
|
9933
|
+
const h = new Set(d.map((p) => `${p[l]}:${p[u]}`)), m = (await a(o) || []).filter((p) => !h.has(`${p[l]}:${p[u]}`)).map((p) => String(p.id));
|
|
9913
9934
|
m.length && r.push({
|
|
9914
9935
|
dataContext: P(n.dataContext),
|
|
9915
9936
|
recordName: o,
|
|
@@ -9925,24 +9946,24 @@ function Fi(c, t) {
|
|
|
9925
9946
|
const e = (c.approvedDiff?.decisions || []).filter((s) => s.kind === "destructive-scope"), i = (s) => `${s.dataContext}:${s.recordName || ""}`, r = new Map(e.map((s) => [i(s), [...s.ids || []].sort().join(",")])), a = new Set(t.map(i));
|
|
9926
9947
|
for (const s of e)
|
|
9927
9948
|
if (!a.has(i(s)))
|
|
9928
|
-
throw new
|
|
9949
|
+
throw new St(`Destructive migration scope mismatch for ${s.dataContext}`);
|
|
9929
9950
|
for (const s of t) {
|
|
9930
9951
|
const n = [...s.ids || []].sort().join(",");
|
|
9931
9952
|
if (r.get(i(s)) !== n)
|
|
9932
|
-
throw new
|
|
9953
|
+
throw new St(`Destructive migration scope mismatch for ${s.dataContext}`);
|
|
9933
9954
|
}
|
|
9934
9955
|
}
|
|
9935
|
-
function
|
|
9956
|
+
function gi(c, t) {
|
|
9936
9957
|
const e = new Set(c.storage.records.filter((i) => i.isFiltered).map((i) => i.recordName));
|
|
9937
9958
|
return t.storage.records.filter((i) => i.isFiltered && !e.has(i.recordName)).map((i) => `entity:${i.recordName}`);
|
|
9938
9959
|
}
|
|
9939
|
-
function
|
|
9960
|
+
function xa(c) {
|
|
9940
9961
|
return c.map((t) => {
|
|
9941
9962
|
const e = t.oldPhysicalPath || t.newPhysicalPath ? ` (${t.oldPhysicalPath || "?"} -> ${t.newPhysicalPath || "?"})` : "";
|
|
9942
9963
|
return `${t.kind}: ${t.logicalPath}${e}: ${t.reason}`;
|
|
9943
9964
|
});
|
|
9944
9965
|
}
|
|
9945
|
-
async function
|
|
9966
|
+
async function bi(c) {
|
|
9946
9967
|
const t = c.system;
|
|
9947
9968
|
return t.readMigrationManifest ? t.readMigrationManifest() : c.system.storage.get(Le, qe);
|
|
9948
9969
|
}
|
|
@@ -9955,10 +9976,10 @@ async function me(c, t) {
|
|
|
9955
9976
|
await c.system.storage.set(Le, qe, t);
|
|
9956
9977
|
}
|
|
9957
9978
|
function Yt(c, t) {
|
|
9958
|
-
return
|
|
9979
|
+
return ft(c) === ft(t);
|
|
9959
9980
|
}
|
|
9960
|
-
async function
|
|
9961
|
-
const a =
|
|
9981
|
+
async function Ue(c, t, e, i, r = {}) {
|
|
9982
|
+
const a = Di(r, P(t.dataContext));
|
|
9962
9983
|
if (!a)
|
|
9963
9984
|
throw new Ve(`Migration cannot treat async task creation as completion for ${P(t.dataContext)}`);
|
|
9964
9985
|
return a({
|
|
@@ -9970,16 +9991,16 @@ async function Be(c, t, e, i, r = {}) {
|
|
|
9970
9991
|
});
|
|
9971
9992
|
}
|
|
9972
9993
|
async function et(c, t, e, i, r = {}) {
|
|
9973
|
-
if (e instanceof
|
|
9974
|
-
if (e instanceof
|
|
9994
|
+
if (e instanceof pt) return;
|
|
9995
|
+
if (e instanceof Vt && (e = await Ue(c, t, e, i, r)), e instanceof ee)
|
|
9975
9996
|
throw new Ve(`Migration requires direct final output, not asyncReturn resolution, for ${P(t.dataContext)}`);
|
|
9976
9997
|
const a = await c.retrieveLastValue(t.dataContext, i);
|
|
9977
9998
|
if (!Yt(a, e))
|
|
9978
9999
|
return await c.applyResult(t.dataContext, e, i), Li(t.dataContext, e, a, i);
|
|
9979
10000
|
}
|
|
9980
|
-
async function
|
|
9981
|
-
if (e instanceof
|
|
9982
|
-
if (e instanceof
|
|
10001
|
+
async function Ma(c, t, e, i, r = {}) {
|
|
10002
|
+
if (e instanceof pt || e === void 0) return [];
|
|
10003
|
+
if (e instanceof Vt && (e = await Ue(c, t, e, i, r)), e instanceof ee)
|
|
9983
10004
|
throw new Ve(`Migration requires direct final output for ${P(t.dataContext)}`);
|
|
9984
10005
|
const a = Array.isArray(e) ? e : [e], s = [];
|
|
9985
10006
|
for (const n of a) {
|
|
@@ -9990,7 +10011,7 @@ async function xa(c, t, e, i, r = {}) {
|
|
|
9990
10011
|
}
|
|
9991
10012
|
const o = n;
|
|
9992
10013
|
if (o.type === "delete" && (t.dataContext.type === "entity" || t.dataContext.type === "relation"))
|
|
9993
|
-
throw new
|
|
10014
|
+
throw new St(`Migration refuses delete patch for ${P(t.dataContext)} without explicit audited scope`);
|
|
9994
10015
|
if (await c.applyResultPatch(t.dataContext, o, i), t.dataContext.type === "entity" || t.dataContext.type === "relation")
|
|
9995
10016
|
s.push({
|
|
9996
10017
|
recordName: t.dataContext.id.name,
|
|
@@ -10009,7 +10030,7 @@ async function xa(c, t, e, i, r = {}) {
|
|
|
10009
10030
|
function Li(c, t, e, i) {
|
|
10010
10031
|
if (c.type === "global")
|
|
10011
10032
|
return {
|
|
10012
|
-
recordName:
|
|
10033
|
+
recordName: K,
|
|
10013
10034
|
type: e === void 0 ? "create" : "update",
|
|
10014
10035
|
record: { key: c.id.name, value: t, id: c.id.name },
|
|
10015
10036
|
oldRecord: e === void 0 ? void 0 : { key: c.id.name, value: e, id: c.id.name },
|
|
@@ -10024,19 +10045,19 @@ function Li(c, t, e, i) {
|
|
|
10024
10045
|
keys: [c.id.name]
|
|
10025
10046
|
};
|
|
10026
10047
|
}
|
|
10027
|
-
async function
|
|
10048
|
+
async function Pa(c, t, e = {}) {
|
|
10028
10049
|
if (t.dataContext.type !== "entity" && t.dataContext.type !== "relation") return [];
|
|
10029
10050
|
let i = await t.compute(await c.scheduler.resolveDataDeps(t));
|
|
10030
|
-
if (i instanceof
|
|
10031
|
-
throw new
|
|
10051
|
+
if (i instanceof Vt && (i = await Ue(c, t, i, void 0, e)), !Array.isArray(i))
|
|
10052
|
+
throw new Tt(`Entity/relation migration compute must return an array for ${P(t.dataContext)}`);
|
|
10032
10053
|
const r = t.dataContext.id.name, a = t.state?.sourceRecordId?.key, s = t.state?.transformIndex?.key;
|
|
10033
10054
|
if (!a || !s)
|
|
10034
|
-
throw new
|
|
10055
|
+
throw new Tt(`Transform migration requires sourceRecordId and transformIndex state for ${P(t.dataContext)}`);
|
|
10035
10056
|
const n = await c.system.storage.find(r, void 0, void 0, ["*"]), o = new Map(n.map((u) => [`${u[a]}:${u[s]}`, u])), l = [];
|
|
10036
10057
|
for (const u of i) {
|
|
10037
|
-
const d = `${u[a]}:${u[s]}`,
|
|
10038
|
-
if (o.delete(d),
|
|
10039
|
-
Yt({ ...
|
|
10058
|
+
const d = `${u[a]}:${u[s]}`, h = o.get(d);
|
|
10059
|
+
if (o.delete(d), h)
|
|
10060
|
+
Yt({ ...h, id: void 0 }, { ...u, id: void 0 }) || (await c.system.storage.update(r, w.atom({ key: "id", value: ["=", h.id] }), u), l.push({ recordName: r, type: "update", record: { ...h, ...u }, oldRecord: h, keys: Object.keys(u) }));
|
|
10040
10061
|
else {
|
|
10041
10062
|
const f = await c.system.storage.create(r, u);
|
|
10042
10063
|
l.push({ recordName: r, type: "create", record: f });
|
|
@@ -10045,19 +10066,19 @@ async function Ma(c, t, e = {}) {
|
|
|
10045
10066
|
for (const u of o.values()) {
|
|
10046
10067
|
if (!Qe(
|
|
10047
10068
|
e.approvedDiff,
|
|
10048
|
-
(
|
|
10069
|
+
(h) => h.kind === "destructive-scope" && h.dataContext === P(t.dataContext) && h.recordName === r
|
|
10049
10070
|
)?.ids.map(String).includes(String(u.id)))
|
|
10050
|
-
throw new
|
|
10071
|
+
throw new St(`Migration would delete stale derived ${r} record ${u.id}; approve destructive scope before executing`);
|
|
10051
10072
|
await c.system.storage.delete(r, w.atom({ key: "id", value: ["=", u.id] })), l.push({ recordName: r, type: "delete", record: u });
|
|
10052
10073
|
}
|
|
10053
10074
|
return l;
|
|
10054
10075
|
}
|
|
10055
|
-
async function
|
|
10056
|
-
return Fi(e, await Te(c, t, r)), new
|
|
10076
|
+
async function Da(c, t, e = {}, i = [], r) {
|
|
10077
|
+
return Fi(e, await Te(c, t, r)), new Oa(c, t, e, i).run();
|
|
10057
10078
|
}
|
|
10058
|
-
class
|
|
10079
|
+
class Oa {
|
|
10059
10080
|
constructor(t, e, i = {}, r = []) {
|
|
10060
|
-
this.controller = t, this.rebuildPlan = e, this.options = i, this.initialEvents = r, this.handles =
|
|
10081
|
+
this.controller = t, this.rebuildPlan = e, this.options = i, this.initialEvents = r, this.handles = Be(this.controller), this.sourceMapManager = new $i(this.controller, this.controller.scheduler), this.affectedIds = new Set(this.rebuildPlan.map((a) => a.computationId)), this.pendingEventsByComputation = /* @__PURE__ */ new Map(), this.sourceMapManager.initialize(new Set(
|
|
10061
10082
|
Array.from(this.handles.entries()).filter(([a]) => this.affectedIds.has(a)).map(([, a]) => a)
|
|
10062
10083
|
));
|
|
10063
10084
|
}
|
|
@@ -10067,10 +10088,10 @@ class Da {
|
|
|
10067
10088
|
for (const e of this.rebuildPlan) {
|
|
10068
10089
|
const i = this.handles.get(e.computationId);
|
|
10069
10090
|
if (!i) continue;
|
|
10070
|
-
if (i.dataContext.type === "property" && i.dataContext.id.name === _e && !
|
|
10071
|
-
throw new
|
|
10091
|
+
if (i.dataContext.type === "property" && i.dataContext.id.name === _e && !Mi(this.options.approvedDiff, (s) => s.kind === "destructive-scope" && s.dataContext === P(i.dataContext)))
|
|
10092
|
+
throw new St(`Migration refuses to recompute destructive property ${P(i.dataContext)} without approved destructive scope`);
|
|
10072
10093
|
if (typeof i.compute != "function" && !Gt(this.options, P(i.dataContext)))
|
|
10073
|
-
throw new
|
|
10094
|
+
throw new Tt(`Migration requires full compute support for ${P(i.dataContext)}`);
|
|
10074
10095
|
if (e.rebuildState && !e.rebuildOutput) {
|
|
10075
10096
|
await this.rebuildStateDefaults(i);
|
|
10076
10097
|
continue;
|
|
@@ -10095,7 +10116,7 @@ class Da {
|
|
|
10095
10116
|
if (t.dataContext.type === "property") {
|
|
10096
10117
|
const o = t.dataContext.host.name, l = await this.controller.system.storage.find(o, void 0, void 0, ["*"]), u = [];
|
|
10097
10118
|
for (const d of l) {
|
|
10098
|
-
const
|
|
10119
|
+
const h = await e({ controller: this.controller, dataContext: t.dataContext, record: d }), f = await et(this.controller, t, h, d, this.options);
|
|
10099
10120
|
f && u.push(f);
|
|
10100
10121
|
}
|
|
10101
10122
|
return u;
|
|
@@ -10108,7 +10129,7 @@ class Da {
|
|
|
10108
10129
|
return n ? [n] : [];
|
|
10109
10130
|
}
|
|
10110
10131
|
if (t.dataContext.type === "entity" || t.dataContext.type === "relation")
|
|
10111
|
-
return
|
|
10132
|
+
return Pa(this.controller, t, this.options);
|
|
10112
10133
|
const i = t.dataContext.host.name, r = await this.controller.system.storage.find(i, void 0, void 0, ["*"]), a = [];
|
|
10113
10134
|
for (const s of r) {
|
|
10114
10135
|
const n = await t.compute(
|
|
@@ -10140,7 +10161,7 @@ class Da {
|
|
|
10140
10161
|
if (!("dataDep" in s)) {
|
|
10141
10162
|
const o = Gt(this.options, P(t.dataContext));
|
|
10142
10163
|
if (!o)
|
|
10143
|
-
throw new
|
|
10164
|
+
throw new Tt(`Event-based migration requires an approved event rebuild handler for ${P(t.dataContext)}`);
|
|
10144
10165
|
const l = await o({ controller: this.controller, dataContext: t.dataContext, mutationEvent: r }), u = await et(this.controller, t, l, void 0, this.options);
|
|
10145
10166
|
u && i.push(u);
|
|
10146
10167
|
continue;
|
|
@@ -10161,7 +10182,7 @@ class Da {
|
|
|
10161
10182
|
const n = await et(this.controller, t, a, i, this.options);
|
|
10162
10183
|
return n ? [n] : [];
|
|
10163
10184
|
}
|
|
10164
|
-
return
|
|
10185
|
+
return Ma(this.controller, t, a, i, this.options);
|
|
10165
10186
|
}
|
|
10166
10187
|
if (t.incrementalCompute) {
|
|
10167
10188
|
const n = t.useLastValue ? await this.controller.retrieveLastValue(t.dataContext, i) : void 0;
|
|
@@ -10172,25 +10193,25 @@ class Da {
|
|
|
10172
10193
|
return s ? [s] : [];
|
|
10173
10194
|
}
|
|
10174
10195
|
}
|
|
10175
|
-
async function
|
|
10196
|
+
async function Fa(c, t, e) {
|
|
10176
10197
|
const i = new Set(t.storage.records.filter((s) => s.isFiltered).map((s) => s.recordName)), r = e.storage.records.filter((s) => s.isFiltered && !i.has(s.recordName)), a = [];
|
|
10177
10198
|
for (const s of r) {
|
|
10178
10199
|
const n = s.resolvedBaseRecordName;
|
|
10179
10200
|
if (!n || !s.resolvedMatchExpression) continue;
|
|
10180
10201
|
const o = await c.system.storage.find(n, void 0, void 0, ["id", "__filtered_entities"]), l = await c.system.storage.find(n, s.resolvedMatchExpression, void 0, ["id"]), u = new Set(l.map((d) => String(d.id)));
|
|
10181
10202
|
for (const d of o) {
|
|
10182
|
-
const
|
|
10203
|
+
const h = {
|
|
10183
10204
|
...d.__filtered_entities && typeof d.__filtered_entities == "object" ? d.__filtered_entities : {},
|
|
10184
10205
|
[s.recordName]: u.has(String(d.id))
|
|
10185
10206
|
};
|
|
10186
10207
|
await c.system.storage.update(
|
|
10187
10208
|
n,
|
|
10188
10209
|
w.atom({ key: "id", value: ["=", d.id] }),
|
|
10189
|
-
{ __filtered_entities:
|
|
10210
|
+
{ __filtered_entities: h }
|
|
10190
10211
|
), a.push({
|
|
10191
10212
|
recordName: s.recordName,
|
|
10192
10213
|
type: u.has(String(d.id)) ? "create" : "delete",
|
|
10193
|
-
record: { ...d, __filtered_entities:
|
|
10214
|
+
record: { ...d, __filtered_entities: h },
|
|
10194
10215
|
oldRecord: d,
|
|
10195
10216
|
keys: ["__filtered_entities"]
|
|
10196
10217
|
});
|
|
@@ -10198,7 +10219,7 @@ async function Oa(c, t, e) {
|
|
|
10198
10219
|
}
|
|
10199
10220
|
return a;
|
|
10200
10221
|
}
|
|
10201
|
-
const
|
|
10222
|
+
const Is = "User";
|
|
10202
10223
|
class qi {
|
|
10203
10224
|
constructor(t) {
|
|
10204
10225
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
@@ -10207,7 +10228,7 @@ class qi {
|
|
|
10207
10228
|
return new qi(t);
|
|
10208
10229
|
}
|
|
10209
10230
|
}
|
|
10210
|
-
const Se = "_isDeleted_",
|
|
10231
|
+
const Se = "_isDeleted_", wi = new Ri(), xs = {
|
|
10211
10232
|
create() {
|
|
10212
10233
|
return T.create({
|
|
10213
10234
|
name: Se,
|
|
@@ -10215,7 +10236,7 @@ const Se = "_isDeleted_", bi = new wi(), Is = {
|
|
|
10215
10236
|
});
|
|
10216
10237
|
}
|
|
10217
10238
|
};
|
|
10218
|
-
class
|
|
10239
|
+
class Ms {
|
|
10219
10240
|
constructor(t) {
|
|
10220
10241
|
this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
|
|
10221
10242
|
BoolExp: E,
|
|
@@ -10238,9 +10259,9 @@ class xs {
|
|
|
10238
10259
|
const d = new Set(this.entities.map((f) => f.name));
|
|
10239
10260
|
for (const f of this.eventSources)
|
|
10240
10261
|
f.entity && f.entity.name && !d.has(f.entity.name) && (this.entities.push(f.entity), d.add(f.entity.name));
|
|
10241
|
-
const
|
|
10262
|
+
const h = [
|
|
10242
10263
|
...Qr,
|
|
10243
|
-
...
|
|
10264
|
+
...Kr,
|
|
10244
10265
|
...qr,
|
|
10245
10266
|
...Or,
|
|
10246
10267
|
...Mr,
|
|
@@ -10251,7 +10272,7 @@ class xs {
|
|
|
10251
10272
|
...ca,
|
|
10252
10273
|
...o
|
|
10253
10274
|
];
|
|
10254
|
-
this.scheduler = new ha(this, this.entities, this.relations, this.dict,
|
|
10275
|
+
this.scheduler = new ha(this, this.entities, this.relations, this.dict, h), n.forEach((f) => {
|
|
10255
10276
|
let m = this.recordNameToSideEffects.get(f.record.name);
|
|
10256
10277
|
m || this.recordNameToSideEffects.set(f.record.name, m = /* @__PURE__ */ new Set()), m.add(f);
|
|
10257
10278
|
});
|
|
@@ -10269,7 +10290,7 @@ class xs {
|
|
|
10269
10290
|
const s = this.system, n = s.prepareMigrationSchema;
|
|
10270
10291
|
if (typeof n != "function")
|
|
10271
10292
|
throw new Error("Current system does not support migration manifest validation");
|
|
10272
|
-
const o = await n.call(s, this.entities, this.relations, r), l =
|
|
10293
|
+
const o = await n.call(s, this.entities, this.relations, r), l = jt(this, o.schema), u = await bi(this);
|
|
10273
10294
|
if (u && u.modelHash !== l.modelHash)
|
|
10274
10295
|
throw new Error(`Model manifest mismatch. Call controller.generateMigrationDiff(), review it, then call controller.migrate({ approvedDiff }). Manifest key: ${Le}/${qe}`);
|
|
10275
10296
|
if (!u && await this.system.hasExistingData?.())
|
|
@@ -10278,7 +10299,7 @@ class xs {
|
|
|
10278
10299
|
return;
|
|
10279
10300
|
}
|
|
10280
10301
|
await this.system.setup(this.entities, this.relations, r, e);
|
|
10281
|
-
const a =
|
|
10302
|
+
const a = jt(this);
|
|
10282
10303
|
await this.scheduler.setup(e), e && await me(this, a);
|
|
10283
10304
|
}
|
|
10284
10305
|
async createMigrationBaseline() {
|
|
@@ -10290,35 +10311,35 @@ class xs {
|
|
|
10290
10311
|
missingDDL: i.preRecomputeDDL,
|
|
10291
10312
|
blockingChanges: i.blockingChanges
|
|
10292
10313
|
});
|
|
10293
|
-
const r =
|
|
10314
|
+
const r = jt(this, i.schema);
|
|
10294
10315
|
return await me(this, r), r;
|
|
10295
10316
|
}
|
|
10296
10317
|
async prepareMigrationContext(t = {}) {
|
|
10297
10318
|
const e = this.scheduler.createStates(), i = this.system;
|
|
10298
10319
|
C(typeof i.prepareMigrationSchema == "function", "Current system does not support schema migration planning");
|
|
10299
|
-
const r = await i.prepareMigrationSchema(this.entities, this.relations, e), a = await
|
|
10320
|
+
const r = await i.prepareMigrationSchema(this.entities, this.relations, e), a = await bi(this);
|
|
10300
10321
|
if (!a)
|
|
10301
10322
|
throw new he("Migration baseline manifest not found. Run setup(true) with the current framework first or createMigrationBaseline().");
|
|
10302
|
-
const s =
|
|
10323
|
+
const s = jt(this, r.schema, { includeFunctionText: t.includeFunctionText === !0 });
|
|
10303
10324
|
return { states: e, migrationSystem: i, schemaPlan: r, previousManifest: a, nextManifest: s };
|
|
10304
10325
|
}
|
|
10305
10326
|
async buildCurrentMigrationDiff(t, e, i, r = {}) {
|
|
10306
10327
|
const a = i.computations.filter(
|
|
10307
|
-
(
|
|
10308
|
-
), s =
|
|
10328
|
+
(h) => !e.computations.some((f) => f.id === h.id && f.signature === h.signature)
|
|
10329
|
+
), s = gi(e, i), n = mi(
|
|
10309
10330
|
e,
|
|
10310
10331
|
i,
|
|
10311
10332
|
a,
|
|
10312
10333
|
s,
|
|
10313
|
-
{ outputChangedIds: new Set(a.map((
|
|
10314
|
-
), o =
|
|
10334
|
+
{ outputChangedIds: new Set(a.map((h) => h.id)) }
|
|
10335
|
+
), o = yi(e, i), l = r.includeDestructiveScope === !0 ? await Te(this, n, e) : [], u = {
|
|
10315
10336
|
blockingChanges: [
|
|
10316
10337
|
...t.blockingChanges,
|
|
10317
10338
|
...o
|
|
10318
10339
|
],
|
|
10319
10340
|
destructiveScopes: l
|
|
10320
|
-
};
|
|
10321
|
-
return
|
|
10341
|
+
}, d = Ta(e, i, t, u);
|
|
10342
|
+
return Sa(d, this, n);
|
|
10322
10343
|
}
|
|
10323
10344
|
async generateMigrationDiff(t = {}) {
|
|
10324
10345
|
const { schemaPlan: e, previousManifest: i, nextManifest: r } = await this.prepareMigrationContext({
|
|
@@ -10330,26 +10351,26 @@ class xs {
|
|
|
10330
10351
|
const e = { ...t }, i = await this.prepareMigrationContext(), r = i.migrationSystem;
|
|
10331
10352
|
C(typeof r.applyMigrationSchema == "function", "Current system does not support schema migration application");
|
|
10332
10353
|
const { schemaPlan: a, previousManifest: s, nextManifest: n } = i, o = await this.buildCurrentMigrationDiff(a, s, n, { includeDestructiveScope: !1 });
|
|
10333
|
-
|
|
10334
|
-
const l = e.approvedDiff, u = ma(l), d =
|
|
10354
|
+
ka(e.approvedDiff, s, n, e.handlers, o);
|
|
10355
|
+
const l = e.approvedDiff, u = ma(l), d = Aa(s, n, l), h = d.changedComputations, f = gi(s, n), m = mi(s, n, h, f, {
|
|
10335
10356
|
outputChangedIds: d.outputChangedIds,
|
|
10336
10357
|
stateOnlyIds: d.stateOnlyIds
|
|
10337
|
-
}),
|
|
10358
|
+
}), p = yi(s, n), y = Ia(
|
|
10338
10359
|
this,
|
|
10339
10360
|
m,
|
|
10340
10361
|
e,
|
|
10341
10362
|
s
|
|
10342
10363
|
), b = [
|
|
10343
10364
|
...a.blockingChanges,
|
|
10344
|
-
...
|
|
10365
|
+
...p,
|
|
10345
10366
|
...d.blocking,
|
|
10346
10367
|
...y
|
|
10347
|
-
], v =
|
|
10368
|
+
], v = xa(b), N = await Te(this, m, s);
|
|
10348
10369
|
Fi(e, N);
|
|
10349
10370
|
const I = {
|
|
10350
10371
|
mode: "compute",
|
|
10351
10372
|
dryRun: e.dryRun === !0,
|
|
10352
|
-
changedComputations:
|
|
10373
|
+
changedComputations: h,
|
|
10353
10374
|
rebuildPlan: m,
|
|
10354
10375
|
schemaPlan: {
|
|
10355
10376
|
schema: a.schema,
|
|
@@ -10369,8 +10390,8 @@ ${v.join(`
|
|
|
10369
10390
|
`)}`);
|
|
10370
10391
|
let S;
|
|
10371
10392
|
const W = (V, tt) => {
|
|
10372
|
-
const
|
|
10373
|
-
return
|
|
10393
|
+
const wt = ["pending", "schema-applied", "computation-applied", "constraints-applied", "manifest-written", "succeeded"];
|
|
10394
|
+
return wt.indexOf(V) >= wt.indexOf(tt);
|
|
10374
10395
|
};
|
|
10375
10396
|
try {
|
|
10376
10397
|
S = await r.beginMigration?.(
|
|
@@ -10382,8 +10403,8 @@ ${v.join(`
|
|
|
10382
10403
|
const V = S?.phase || "pending";
|
|
10383
10404
|
W(V, "schema-applied") || (await r.applyMigrationSchema(a, S?.id), S && await r.updateMigrationPhase?.(S.id, "schema-applied")), W(V, "manifest-written") || await this.system.storage.runInTransaction({ name: "migration recompute", isolation: "SERIALIZABLE" }, async () => {
|
|
10384
10405
|
if (!W(V, "computation-applied")) {
|
|
10385
|
-
const ne = await
|
|
10386
|
-
await
|
|
10406
|
+
const ne = await Fa(this, s, n);
|
|
10407
|
+
await Da(this, m, e, ne, s), S && await r.updateMigrationPhase?.(S.id, "computation-applied");
|
|
10387
10408
|
}
|
|
10388
10409
|
W(V, "constraints-applied") || (await r.verifyMigrationSchema?.(a, S?.id), await r.applyMigrationPostSchema?.(a, S?.id), S && await r.updateMigrationPhase?.(S.id, "constraints-applied"));
|
|
10389
10410
|
const tt = `manifest:current:${n.modelHash}:${u}`;
|
|
@@ -10405,7 +10426,7 @@ ${v.join(`
|
|
|
10405
10426
|
}
|
|
10406
10427
|
}
|
|
10407
10428
|
async applyResult(t, e, i) {
|
|
10408
|
-
if (!(e instanceof
|
|
10429
|
+
if (!(e instanceof pt)) {
|
|
10409
10430
|
if (t.type === "global")
|
|
10410
10431
|
return this.system.storage.dict.set(t.id.name, e);
|
|
10411
10432
|
if (t.type === "entity") {
|
|
@@ -10433,7 +10454,7 @@ ${v.join(`
|
|
|
10433
10454
|
}
|
|
10434
10455
|
}
|
|
10435
10456
|
async applyResultPatch(t, e, i) {
|
|
10436
|
-
if (e instanceof
|
|
10457
|
+
if (e instanceof pt || e === void 0) return;
|
|
10437
10458
|
const r = Array.isArray(e) ? e : [e];
|
|
10438
10459
|
for (const a of r)
|
|
10439
10460
|
if (t.type === "global")
|
|
@@ -10473,7 +10494,7 @@ ${v.join(`
|
|
|
10473
10494
|
*/
|
|
10474
10495
|
async dispatch(t, e) {
|
|
10475
10496
|
C(!!t, "eventSource is required for dispatch");
|
|
10476
|
-
const i =
|
|
10497
|
+
const i = wi.getStore();
|
|
10477
10498
|
if (i)
|
|
10478
10499
|
throw new Br({
|
|
10479
10500
|
outerEventSourceName: i.eventSourceName,
|
|
@@ -10483,7 +10504,7 @@ ${v.join(`
|
|
|
10483
10504
|
try {
|
|
10484
10505
|
r = await De(t.name || "dispatch", async (a) => {
|
|
10485
10506
|
const s = this.cloneDispatchArgs(e), n = { effects: [] };
|
|
10486
|
-
return Fe.run(n, async () => this.system.storage.runInTransaction({ name: t.name, isolation: a }, async () =>
|
|
10507
|
+
return Fe.run(n, async () => this.system.storage.runInTransaction({ name: t.name, isolation: a }, async () => wi.run({ eventSourceName: t.name }, async () => {
|
|
10487
10508
|
!this.ignoreGuard && t.guard && await t.guard.call(this, s);
|
|
10488
10509
|
const o = t.mapEventData ? await t.mapEventData(s) : {};
|
|
10489
10510
|
await this.system.storage.create(t.entity.name, o);
|
|
@@ -10519,7 +10540,7 @@ ${v.join(`
|
|
|
10519
10540
|
...a
|
|
10520
10541
|
});
|
|
10521
10542
|
} catch (a) {
|
|
10522
|
-
const s = new
|
|
10543
|
+
const s = new di(
|
|
10523
10544
|
`Post-commit hook '${t.name}' failed`,
|
|
10524
10545
|
{
|
|
10525
10546
|
sideEffectName: t.name,
|
|
@@ -10546,7 +10567,7 @@ ${v.join(`
|
|
|
10546
10567
|
result: await s.content.call(this, r)
|
|
10547
10568
|
};
|
|
10548
10569
|
} catch (n) {
|
|
10549
|
-
const o = new
|
|
10570
|
+
const o = new di(
|
|
10550
10571
|
`Side effect '${s.name}' failed for ${r.type} on ${r.recordName}`,
|
|
10551
10572
|
{
|
|
10552
10573
|
sideEffectName: s.name,
|
|
@@ -10575,23 +10596,23 @@ ${v.join(`
|
|
|
10575
10596
|
return this.eventSourcesByName.get(t);
|
|
10576
10597
|
}
|
|
10577
10598
|
}
|
|
10578
|
-
function
|
|
10599
|
+
function La(c) {
|
|
10579
10600
|
return encodeURI(JSON.stringify(c));
|
|
10580
10601
|
}
|
|
10581
|
-
function
|
|
10602
|
+
function qa(c) {
|
|
10582
10603
|
return c === void 0 ? void 0 : JSON.parse(decodeURI(c));
|
|
10583
10604
|
}
|
|
10584
|
-
class
|
|
10605
|
+
class _a {
|
|
10585
10606
|
constructor(t) {
|
|
10586
10607
|
this.db = t, this.constraintSchemaItems = [], this.schema = {
|
|
10587
10608
|
dialect: Q(),
|
|
10588
10609
|
records: [],
|
|
10589
10610
|
tables: [],
|
|
10590
10611
|
constraints: []
|
|
10591
|
-
}, this.transactionContext = new
|
|
10612
|
+
}, this.transactionContext = new Ri(), this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
|
|
10592
10613
|
get: async (e) => {
|
|
10593
10614
|
const i = w.atom({ key: "key", value: ["=", e] });
|
|
10594
|
-
return (await this.queryHandle.findOne(
|
|
10615
|
+
return (await this.queryHandle.findOne(K, i, void 0, ["value"]))?.value?.raw;
|
|
10595
10616
|
},
|
|
10596
10617
|
set: async (e, i) => {
|
|
10597
10618
|
await this.setDictionaryValue(e, i, !0);
|
|
@@ -10677,29 +10698,29 @@ class qa {
|
|
|
10677
10698
|
return this.isInTransaction() ? e() : De(t, (i) => this.runInTransaction({ name: t, isolation: i }, e));
|
|
10678
10699
|
}
|
|
10679
10700
|
async setDictionaryValue(t, e, i) {
|
|
10680
|
-
const r = w.atom({ key: "key", value: ["=", t] }), a = await this.queryHandle.findOne(
|
|
10701
|
+
const r = w.atom({ key: "key", value: ["=", t] }), a = await this.queryHandle.findOne(K, r, void 0, ["value"]);
|
|
10681
10702
|
if (a) {
|
|
10682
|
-
const s = [
|
|
10703
|
+
const s = [K, w.atom({ key: "id", value: ["=", a.id] }), { key: t, value: { raw: e } }];
|
|
10683
10704
|
i ? await this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), s, []) : await this.queryHandle.update(...s, []);
|
|
10684
10705
|
} else {
|
|
10685
|
-
const s = [
|
|
10706
|
+
const s = [K, { key: t, value: { raw: e } }];
|
|
10686
10707
|
i ? await this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), s, []) : await this.queryHandle.create(...s, []);
|
|
10687
10708
|
}
|
|
10688
10709
|
}
|
|
10689
10710
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
10690
10711
|
async get(t, e, i) {
|
|
10691
|
-
const r = w.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), a = (await this.queryHandle.findOne(
|
|
10692
|
-
return a === void 0 ? i :
|
|
10712
|
+
const r = w.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), a = (await this.queryHandle.findOne(Rt, r, void 0, ["value"]))?.value;
|
|
10713
|
+
return a === void 0 ? i : qa(a);
|
|
10693
10714
|
}
|
|
10694
10715
|
async set(t, e, i, r) {
|
|
10695
10716
|
const a = w.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
10696
|
-
return await this.queryHandle.findOne(
|
|
10717
|
+
return await this.queryHandle.findOne(Rt, a, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [Rt, a, { concept: t, key: e.toString(), value: La(i) }], r) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [Rt, { concept: t, key: e.toString(), value: encodeURI(JSON.stringify(i)) }], r);
|
|
10697
10718
|
}
|
|
10698
10719
|
async setup(t, e, i = !1) {
|
|
10699
10720
|
await this.db.open(i), i && this.db.setupInternalComputationState && await this.db.setupInternalComputationState();
|
|
10700
10721
|
let r;
|
|
10701
10722
|
try {
|
|
10702
|
-
r = new
|
|
10723
|
+
r = new ai(
|
|
10703
10724
|
t,
|
|
10704
10725
|
e,
|
|
10705
10726
|
this.db
|
|
@@ -10714,7 +10735,7 @@ class qa {
|
|
|
10714
10735
|
);
|
|
10715
10736
|
}
|
|
10716
10737
|
if (i && await r.createTables(), await this.createConstraints(r), this.db.setupRecordSequences) {
|
|
10717
|
-
const a = new
|
|
10738
|
+
const a = new dt(r.map, r.aliasManager);
|
|
10718
10739
|
await this.db.setupRecordSequences(Object.keys(r.map.records).map((s) => {
|
|
10719
10740
|
const n = a.getRecordInfo(s), o = n.idField;
|
|
10720
10741
|
if (!o)
|
|
@@ -10726,13 +10747,13 @@ class qa {
|
|
|
10726
10747
|
};
|
|
10727
10748
|
}));
|
|
10728
10749
|
}
|
|
10729
|
-
this.queryHandle = new
|
|
10750
|
+
this.queryHandle = new ei(new dt(r.map, r.aliasManager), this.db), this.map = r.map, this.constraintSchemaItems = r.constraintSchemaItems, this.schema = this.createSchemaMetadata(r);
|
|
10730
10751
|
}
|
|
10731
10752
|
async prepareMigrationAdditive(t, e) {
|
|
10732
10753
|
await this.ensureDbOpenForSchemaRead(), this.db.setupInternalComputationState;
|
|
10733
10754
|
let i;
|
|
10734
10755
|
try {
|
|
10735
|
-
i = new
|
|
10756
|
+
i = new ai(
|
|
10736
10757
|
t,
|
|
10737
10758
|
e,
|
|
10738
10759
|
this.db
|
|
@@ -10793,7 +10814,7 @@ class qa {
|
|
|
10793
10814
|
async applyMigrationAdditivePlan(t, e) {
|
|
10794
10815
|
const i = t.internal.dbSetup;
|
|
10795
10816
|
if (await this.db.open(!1), this.db.setupInternalComputationState && await this.db.setupInternalComputationState(), await this.applyMigrationOperations("schema", t.preRecomputeDDL, e), this.db.setupRecordSequences) {
|
|
10796
|
-
const r = new
|
|
10817
|
+
const r = new dt(i.map, i.aliasManager);
|
|
10797
10818
|
await this.db.setupRecordSequences(Object.keys(i.map.records).map((a) => {
|
|
10798
10819
|
const s = r.getRecordInfo(a), n = s.idField;
|
|
10799
10820
|
if (!n)
|
|
@@ -10805,7 +10826,7 @@ class qa {
|
|
|
10805
10826
|
};
|
|
10806
10827
|
}));
|
|
10807
10828
|
}
|
|
10808
|
-
this.queryHandle = new
|
|
10829
|
+
this.queryHandle = new ei(new dt(i.map, i.aliasManager), this.db), this.map = i.map, this.constraintSchemaItems = i.constraintSchemaItems, this.schema = this.createSchemaMetadata(i);
|
|
10809
10830
|
}
|
|
10810
10831
|
async applyPostRecomputeSchemaPlan(t, e) {
|
|
10811
10832
|
await this.applyMigrationOperations("constraints", t.postRecomputeDDL, e);
|
|
@@ -11104,8 +11125,8 @@ class qa {
|
|
|
11104
11125
|
increment: async (e, i) => {
|
|
11105
11126
|
const r = this.getPlaceholder();
|
|
11106
11127
|
if (this.isRecordTarget(e)) {
|
|
11107
|
-
const { tableName: l, idField: u, fieldName: d } = this.resolveRecordTarget(e),
|
|
11108
|
-
`UPDATE "${l}" SET "${d}" = COALESCE("${d}", 0) + ${
|
|
11128
|
+
const { tableName: l, idField: u, fieldName: d } = this.resolveRecordTarget(e), h = r(), f = r(), m = await this.db.query(
|
|
11129
|
+
`UPDATE "${l}" SET "${d}" = COALESCE("${d}", 0) + ${h} WHERE "${u}" = ${f} RETURNING "${d}" AS value`,
|
|
11109
11130
|
[i, e.id],
|
|
11110
11131
|
`atomic increment ${e.recordName}.${e.field}`
|
|
11111
11132
|
);
|
|
@@ -11145,27 +11166,27 @@ RETURNING "numberValue" AS value`,
|
|
|
11145
11166
|
`SELECT "${a}" AS value FROM "_ComputationState_" WHERE "key" = ${n}${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
|
|
11146
11167
|
[e.key],
|
|
11147
11168
|
`atomic replace lock ${e.key}`
|
|
11148
|
-
), l = t.filter((y) => y !== a).map((y) => `"${y}" = NULL`).join(", "), u = this.parseGlobalValue(o[0]?.value, a) ?? e.defaultValue ?? null, d = this.getPlaceholder(),
|
|
11169
|
+
), l = t.filter((y) => y !== a).map((y) => `"${y}" = NULL`).join(", "), u = this.parseGlobalValue(o[0]?.value, a) ?? e.defaultValue ?? null, d = this.getPlaceholder(), h = d(), f = d(), m = [`"${a}" = ${h}`, l].filter(Boolean).join(", "), p = await this.db.query(
|
|
11149
11170
|
`UPDATE "_ComputationState_" SET ${m} WHERE "key" = ${f} RETURNING "${a}" AS value`,
|
|
11150
11171
|
[s, e.key],
|
|
11151
11172
|
`atomic replace ${e.key}`
|
|
11152
11173
|
);
|
|
11153
|
-
return { oldValue: u, newValue: this.parseGlobalValue(
|
|
11174
|
+
return { oldValue: u, newValue: this.parseGlobalValue(p[0]?.value, a) ?? i };
|
|
11154
11175
|
}
|
|
11155
11176
|
),
|
|
11156
11177
|
compareAndSet: async (e, i, r, a) => {
|
|
11157
11178
|
const s = this.getPlaceholder(), n = a?.defaultValue;
|
|
11158
11179
|
if (this.isRecordTarget(e)) {
|
|
11159
|
-
const { tableName: S, idField: W, fieldName: V } = this.resolveRecordTarget(e), tt = s(),
|
|
11180
|
+
const { tableName: S, idField: W, fieldName: V } = this.resolveRecordTarget(e), tt = s(), wt = s(), ne = s(), ji = s();
|
|
11160
11181
|
return (await this.db.query(
|
|
11161
|
-
`UPDATE "${S}" SET "${V}" = ${tt} WHERE "${W}" = ${
|
|
11182
|
+
`UPDATE "${S}" SET "${V}" = ${tt} WHERE "${W}" = ${wt} AND COALESCE("${V}", ${ne}) = ${ji} RETURNING "${V}" AS value`,
|
|
11162
11183
|
[r, e.id, n, i],
|
|
11163
11184
|
`atomic compareAndSet ${e.recordName}.${e.field}`
|
|
11164
11185
|
)).length > 0;
|
|
11165
11186
|
}
|
|
11166
|
-
const o = this.resolveGlobalColumn(e, r), l = this.normalizeGlobalValue(r, o), u = this.normalizeGlobalValue(n, o), d = this.normalizeGlobalValue(i, o),
|
|
11187
|
+
const o = this.resolveGlobalColumn(e, r), l = this.normalizeGlobalValue(r, o), u = this.normalizeGlobalValue(n, o), d = this.normalizeGlobalValue(i, o), h = s(), f = s(), m = s(), p = s();
|
|
11167
11188
|
if ((await this.db.query(
|
|
11168
|
-
`UPDATE "_ComputationState_" SET "${o}" = ${
|
|
11189
|
+
`UPDATE "_ComputationState_" SET "${o}" = ${h} WHERE "key" = ${f} AND COALESCE("${o}", ${m}) = ${p} RETURNING "${o}" AS value`,
|
|
11169
11190
|
[l, e.key, u, d],
|
|
11170
11191
|
`atomic compareAndSet ${e.key}`
|
|
11171
11192
|
)).length) return !0;
|
|
@@ -11200,9 +11221,9 @@ RETURNING "numberValue" AS value`,
|
|
|
11200
11221
|
Object.entries(i).forEach(([f, m]) => {
|
|
11201
11222
|
l[f] = Number(l[f] ?? r[f] ?? 0) + m;
|
|
11202
11223
|
});
|
|
11203
|
-
const u = this.getPlaceholder(), d = u(),
|
|
11224
|
+
const u = this.getPlaceholder(), d = u(), h = u();
|
|
11204
11225
|
return await this.db.update(
|
|
11205
|
-
`UPDATE "_ComputationState_" SET "jsonValue" = ${d} WHERE "key" = ${
|
|
11226
|
+
`UPDATE "_ComputationState_" SET "jsonValue" = ${d} WHERE "key" = ${h}`,
|
|
11206
11227
|
[JSON.stringify(l), e.key],
|
|
11207
11228
|
void 0,
|
|
11208
11229
|
`atomic updateGlobalFields ${e.key}`
|
|
@@ -11264,7 +11285,7 @@ RETURNING "numberValue" AS value`,
|
|
|
11264
11285
|
const i = le(t, this.db);
|
|
11265
11286
|
if (!i.isUniqueViolation) return t;
|
|
11266
11287
|
const r = this.findConstraintForError(t);
|
|
11267
|
-
return new
|
|
11288
|
+
return new xi(
|
|
11268
11289
|
r ? `Unique constraint "${r.constraintName}" was violated` : "Unique constraint was violated",
|
|
11269
11290
|
{
|
|
11270
11291
|
kind: "unique",
|
|
@@ -11285,7 +11306,7 @@ RETURNING "numberValue" AS value`,
|
|
|
11285
11306
|
const r = [], a = await t(...e, r), s = await this.dispatch(r);
|
|
11286
11307
|
i.push(...r, ...s);
|
|
11287
11308
|
const n = pa();
|
|
11288
|
-
return n && r.length > 0 &&
|
|
11309
|
+
return n && r.length > 0 && hi(r), n && s.length > 0 && hi(s), a;
|
|
11289
11310
|
} catch (r) {
|
|
11290
11311
|
throw this.mapConstraintError(r);
|
|
11291
11312
|
}
|
|
@@ -11326,8 +11347,8 @@ RETURNING "numberValue" AS value`,
|
|
|
11326
11347
|
return this.db.close();
|
|
11327
11348
|
}
|
|
11328
11349
|
}
|
|
11329
|
-
var
|
|
11330
|
-
class
|
|
11350
|
+
var Va = /* @__PURE__ */ ((c) => (c[c.ERROR = 0] = "ERROR", c[c.INFO = 1] = "INFO", c))(Va || {});
|
|
11351
|
+
class He {
|
|
11331
11352
|
constructor(t = 0) {
|
|
11332
11353
|
this.level = t;
|
|
11333
11354
|
}
|
|
@@ -11338,11 +11359,11 @@ class Ue {
|
|
|
11338
11359
|
this.level >= 0 && console.error({ type: t, name: e, sql: i, params: r, error: a });
|
|
11339
11360
|
}
|
|
11340
11361
|
child() {
|
|
11341
|
-
return new
|
|
11362
|
+
return new He(this.level);
|
|
11342
11363
|
}
|
|
11343
11364
|
}
|
|
11344
|
-
var
|
|
11345
|
-
class
|
|
11365
|
+
var Qa = /* @__PURE__ */ ((c) => (c[c.MUTE = -1] = "MUTE", c[c.ERROR = 0] = "ERROR", c[c.INFO = 1] = "INFO", c[c.DEBUG = 2] = "DEBUG", c))(Qa || {});
|
|
11366
|
+
class je {
|
|
11346
11367
|
constructor(t = 0) {
|
|
11347
11368
|
this.level = t;
|
|
11348
11369
|
}
|
|
@@ -11356,13 +11377,13 @@ class He {
|
|
|
11356
11377
|
this.level >= 2 && console.debug(`[DEBUG] ${t}: ${e}`, i);
|
|
11357
11378
|
}
|
|
11358
11379
|
child(t) {
|
|
11359
|
-
return new
|
|
11380
|
+
return new je(this.level);
|
|
11360
11381
|
}
|
|
11361
11382
|
}
|
|
11362
|
-
const
|
|
11363
|
-
class
|
|
11364
|
-
constructor(t, e =
|
|
11365
|
-
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new
|
|
11383
|
+
const Ps = new He(), Ba = new je();
|
|
11384
|
+
class Ds {
|
|
11385
|
+
constructor(t, e = Ba) {
|
|
11386
|
+
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new _a(t);
|
|
11366
11387
|
}
|
|
11367
11388
|
get db() {
|
|
11368
11389
|
return this.storage.db;
|
|
@@ -11509,16 +11530,16 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11509
11530
|
if (d instanceof $) {
|
|
11510
11531
|
if (!d.record)
|
|
11511
11532
|
return;
|
|
11512
|
-
let
|
|
11513
|
-
if (
|
|
11533
|
+
let h = a.getEntityByName(d.record);
|
|
11534
|
+
if (h || (h = a.getRelationByName(d.record)), !h)
|
|
11514
11535
|
throw new Error(`Entity or Relation not found: ${d.record}`);
|
|
11515
|
-
for (;
|
|
11516
|
-
|
|
11536
|
+
for (; h.baseEntity || h.baseRelation; )
|
|
11537
|
+
h = h.baseEntity || h.baseRelation;
|
|
11517
11538
|
if (d.defaultValue instanceof T)
|
|
11518
|
-
d.defaultValue.name = d.key,
|
|
11539
|
+
d.defaultValue.name = d.key, h.properties.push(d.defaultValue);
|
|
11519
11540
|
else {
|
|
11520
11541
|
const f = typeof d.defaultValue;
|
|
11521
|
-
|
|
11542
|
+
h.properties.push(T.create({
|
|
11522
11543
|
name: d.key,
|
|
11523
11544
|
type: f,
|
|
11524
11545
|
// 应该系统定义
|
|
@@ -11529,7 +11550,7 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11529
11550
|
}
|
|
11530
11551
|
});
|
|
11531
11552
|
}), await this.storage.setup(
|
|
11532
|
-
[...s,
|
|
11553
|
+
[...s, ci, oi],
|
|
11533
11554
|
n,
|
|
11534
11555
|
r
|
|
11535
11556
|
), await this.setupTransformUniqueIndexes(i);
|
|
@@ -11561,7 +11582,7 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11561
11582
|
}
|
|
11562
11583
|
});
|
|
11563
11584
|
}), {
|
|
11564
|
-
entities: [...a,
|
|
11585
|
+
entities: [...a, ci, oi],
|
|
11565
11586
|
relations: s
|
|
11566
11587
|
};
|
|
11567
11588
|
}
|
|
@@ -11599,9 +11620,9 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11599
11620
|
const r = i.sourceRecordId, a = i.transformIndex;
|
|
11600
11621
|
if (!(r instanceof $) || !(a instanceof $) || r.unique === !1 || e.type !== "entity" && e.type !== "relation")
|
|
11601
11622
|
continue;
|
|
11602
|
-
const s = e.id.name, n = this.storage, o = n.queryHandle.map, l = o.getRecordInfo(s), [, u] = o.getTableAliasAndFieldName([s], r.key, !0), [, d] = o.getTableAliasAndFieldName([s], a.key, !0),
|
|
11623
|
+
const s = e.id.name, n = this.storage, o = n.queryHandle.map, l = o.getRecordInfo(s), [, u] = o.getTableAliasAndFieldName([s], r.key, !0), [, d] = o.getTableAliasAndFieldName([s], a.key, !0), h = `idx_transform_${this.hashIdentifier(`${l.table}_${u}_${d}`)}`, f = Q(n.db);
|
|
11603
11624
|
await n.db.scheme(
|
|
11604
|
-
be(
|
|
11625
|
+
be(h, l.table, [u, d], f),
|
|
11605
11626
|
`setup transform unique index ${s}`
|
|
11606
11627
|
);
|
|
11607
11628
|
}
|
|
@@ -11609,15 +11630,15 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11609
11630
|
createTransformUniqueIndexOperations(t, e) {
|
|
11610
11631
|
const i = t.internal.dbSetup;
|
|
11611
11632
|
if (!i) return [];
|
|
11612
|
-
const r = new
|
|
11633
|
+
const r = new dt(i.map, i.aliasManager), a = Q(this.storage.db);
|
|
11613
11634
|
return e.flatMap(({ dataContext: s, state: n }) => {
|
|
11614
11635
|
const o = n.sourceRecordId, l = n.transformIndex;
|
|
11615
11636
|
if (!(o instanceof $) || !(l instanceof $) || o.unique === !1 || s.type !== "entity" && s.type !== "relation")
|
|
11616
11637
|
return [];
|
|
11617
|
-
const u = s.id.name, d = r.getRecordInfo(u), [,
|
|
11638
|
+
const u = s.id.name, d = r.getRecordInfo(u), [, h] = r.getTableAliasAndFieldName([u], o.key, !0), [, f] = r.getTableAliasAndFieldName([u], l.key, !0), m = `idx_transform_${this.hashIdentifier(`${d.table}_${h}_${f}`)}`;
|
|
11618
11639
|
return [{
|
|
11619
11640
|
kind: "create-constraint",
|
|
11620
|
-
sql: be(m, d.table, [
|
|
11641
|
+
sql: be(m, d.table, [h, f], a),
|
|
11621
11642
|
tableName: d.table,
|
|
11622
11643
|
logicalPath: `${u}.${o.key}.${l.key}`,
|
|
11623
11644
|
description: `migration setup transform unique index ${u}`
|
|
@@ -11628,7 +11649,7 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11628
11649
|
await this.storage.destroy();
|
|
11629
11650
|
}
|
|
11630
11651
|
}
|
|
11631
|
-
const
|
|
11652
|
+
const Os = new Ni();
|
|
11632
11653
|
class ae {
|
|
11633
11654
|
constructor(t, e) {
|
|
11634
11655
|
this._type = "Action", this._options = e, this.uuid = A(e), this.name = t.name;
|
|
@@ -11683,16 +11704,16 @@ class ae {
|
|
|
11683
11704
|
return this.create(e.public, e.options);
|
|
11684
11705
|
}
|
|
11685
11706
|
}
|
|
11686
|
-
const
|
|
11707
|
+
const Ua = ae.create({ name: "get" });
|
|
11687
11708
|
function ke(c) {
|
|
11688
11709
|
if (!c) return;
|
|
11689
11710
|
if (c.raw.type === "atom")
|
|
11690
|
-
return
|
|
11711
|
+
return Ft.create({
|
|
11691
11712
|
type: "atom",
|
|
11692
11713
|
data: c.raw.data
|
|
11693
11714
|
});
|
|
11694
11715
|
const t = c.raw;
|
|
11695
|
-
return
|
|
11716
|
+
return Lt.create({
|
|
11696
11717
|
type: "expression",
|
|
11697
11718
|
operator: t.operator,
|
|
11698
11719
|
left: ke(c.left),
|
|
@@ -11753,7 +11774,7 @@ class se {
|
|
|
11753
11774
|
return this.create(e.public, e.options);
|
|
11754
11775
|
}
|
|
11755
11776
|
}
|
|
11756
|
-
class
|
|
11777
|
+
class bt {
|
|
11757
11778
|
constructor(t, e) {
|
|
11758
11779
|
this._type = "Attributive", this._options = e, this.uuid = A(e), this.stringContent = t.stringContent, this.content = t.content, this.name = t.name, this.isRef = t.isRef;
|
|
11759
11780
|
}
|
|
@@ -11785,7 +11806,7 @@ class gt {
|
|
|
11785
11806
|
};
|
|
11786
11807
|
}
|
|
11787
11808
|
static create(t, e) {
|
|
11788
|
-
const i = new
|
|
11809
|
+
const i = new bt(t, e);
|
|
11789
11810
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
11790
11811
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributive`);
|
|
11791
11812
|
return this.instances.push(i), i;
|
|
@@ -11821,7 +11842,7 @@ class gt {
|
|
|
11821
11842
|
return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
|
|
11822
11843
|
}
|
|
11823
11844
|
}
|
|
11824
|
-
class
|
|
11845
|
+
class Qt {
|
|
11825
11846
|
constructor(t, e) {
|
|
11826
11847
|
this._type = "Attributives", this._options = e, this.uuid = A(e), this.content = t.content;
|
|
11827
11848
|
}
|
|
@@ -11844,7 +11865,7 @@ class Vt {
|
|
|
11844
11865
|
};
|
|
11845
11866
|
}
|
|
11846
11867
|
static create(t, e) {
|
|
11847
|
-
const i = new
|
|
11868
|
+
const i = new Qt(t, e);
|
|
11848
11869
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
11849
11870
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributives`);
|
|
11850
11871
|
return this.instances.push(i), i;
|
|
@@ -11878,25 +11899,25 @@ class Vt {
|
|
|
11878
11899
|
function Ae(c) {
|
|
11879
11900
|
if (!c) return;
|
|
11880
11901
|
if (c.raw.type === "atom")
|
|
11881
|
-
return
|
|
11902
|
+
return Ft.create({
|
|
11882
11903
|
type: "atom",
|
|
11883
11904
|
data: c.raw.data
|
|
11884
11905
|
});
|
|
11885
11906
|
const t = c.raw;
|
|
11886
|
-
return
|
|
11907
|
+
return Lt.create({
|
|
11887
11908
|
type: "expression",
|
|
11888
11909
|
operator: t.operator,
|
|
11889
11910
|
left: Ae(c.left),
|
|
11890
11911
|
right: Ae(c.right)
|
|
11891
11912
|
});
|
|
11892
11913
|
}
|
|
11893
|
-
function
|
|
11894
|
-
return
|
|
11914
|
+
function Fs(c) {
|
|
11915
|
+
return Qt.create({
|
|
11895
11916
|
content: Ae(c)
|
|
11896
11917
|
});
|
|
11897
11918
|
}
|
|
11898
|
-
const
|
|
11899
|
-
name:
|
|
11919
|
+
const Ha = "_Interaction_", We = D.create({
|
|
11920
|
+
name: Ha,
|
|
11900
11921
|
properties: [
|
|
11901
11922
|
T.create({ name: "interactionId", type: "string", collection: !1 }),
|
|
11902
11923
|
T.create({ name: "interactionName", type: "string", collection: !1 }),
|
|
@@ -11906,7 +11927,7 @@ const Ua = "_Interaction_", je = D.create({
|
|
|
11906
11927
|
T.create({ name: "context", type: "object", collection: !1 })
|
|
11907
11928
|
]
|
|
11908
11929
|
});
|
|
11909
|
-
class
|
|
11930
|
+
class Ge {
|
|
11910
11931
|
constructor(t, e) {
|
|
11911
11932
|
this._type = "Interaction", this._options = e, this.uuid = A(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;
|
|
11912
11933
|
}
|
|
@@ -11962,10 +11983,10 @@ class We {
|
|
|
11962
11983
|
};
|
|
11963
11984
|
}
|
|
11964
11985
|
static create(t, e) {
|
|
11965
|
-
const i = new
|
|
11986
|
+
const i = new Ge(t, e);
|
|
11966
11987
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
11967
11988
|
throw new Error(`duplicate uuid in options ${i.uuid}, Interaction`);
|
|
11968
|
-
return i.entity =
|
|
11989
|
+
return i.entity = We, i.guard = ja(i), i.mapEventData = Wa(i), t.action === Ua && (i.resolve = Ga(i)), this.instances.push(i), i;
|
|
11969
11990
|
}
|
|
11970
11991
|
static stringify(t) {
|
|
11971
11992
|
const e = {
|
|
@@ -11999,17 +12020,17 @@ class We {
|
|
|
11999
12020
|
return this.create(e.public, e.options);
|
|
12000
12021
|
}
|
|
12001
12022
|
}
|
|
12002
|
-
class
|
|
12023
|
+
class J extends Error {
|
|
12003
12024
|
constructor(t, e) {
|
|
12004
12025
|
super(t), this.name = "InteractionGuardError", this.type = e.type, this.checkType = e.checkType, this.error = e.error;
|
|
12005
12026
|
}
|
|
12006
12027
|
}
|
|
12007
|
-
function
|
|
12028
|
+
function ja(c) {
|
|
12008
12029
|
return async function(t) {
|
|
12009
12030
|
await _i(this, c, t), await Ja(this, c, t), await Vi(this, c, t);
|
|
12010
12031
|
};
|
|
12011
12032
|
}
|
|
12012
|
-
function
|
|
12033
|
+
function Wa(c) {
|
|
12013
12034
|
return (t) => ({
|
|
12014
12035
|
interactionName: c.name,
|
|
12015
12036
|
interactionId: c.uuid,
|
|
@@ -12019,9 +12040,9 @@ function ja(c) {
|
|
|
12019
12040
|
context: t.context || {}
|
|
12020
12041
|
});
|
|
12021
12042
|
}
|
|
12022
|
-
function
|
|
12043
|
+
function Ga(c) {
|
|
12023
12044
|
return async function(t) {
|
|
12024
|
-
return
|
|
12045
|
+
return Xa(this, c, t);
|
|
12025
12046
|
};
|
|
12026
12047
|
}
|
|
12027
12048
|
async function _i(c, t, e) {
|
|
@@ -12041,13 +12062,13 @@ async function _i(c, t, e) {
|
|
|
12041
12062
|
return !0;
|
|
12042
12063
|
}, a = await i.evaluateAsync(r);
|
|
12043
12064
|
if (a !== !0)
|
|
12044
|
-
throw new
|
|
12065
|
+
throw new J(`Condition check failed: ${a?.data?.name}`, {
|
|
12045
12066
|
type: "condition check failed",
|
|
12046
12067
|
checkType: "condition",
|
|
12047
12068
|
error: a
|
|
12048
12069
|
});
|
|
12049
12070
|
}
|
|
12050
|
-
async function
|
|
12071
|
+
async function Ka(c, t, e, i) {
|
|
12051
12072
|
if (t.content) {
|
|
12052
12073
|
let r;
|
|
12053
12074
|
try {
|
|
@@ -12061,9 +12082,9 @@ async function Ga(c, t, e, i) {
|
|
|
12061
12082
|
}
|
|
12062
12083
|
async function Ja(c, t, e) {
|
|
12063
12084
|
if (!t.userAttributives) return;
|
|
12064
|
-
const i =
|
|
12085
|
+
const i = Qt.is(t.userAttributives) ? E.fromValue(t.userAttributives.content) : E.atom(t.userAttributives), r = (s) => Ka(c, s, e, e.user), a = await i.evaluateAsync(r);
|
|
12065
12086
|
if (a !== !0)
|
|
12066
|
-
throw new
|
|
12087
|
+
throw new J("User check failed", {
|
|
12067
12088
|
type: "check user failed",
|
|
12068
12089
|
checkType: "user",
|
|
12069
12090
|
error: a
|
|
@@ -12073,73 +12094,73 @@ async function Vi(c, t, e) {
|
|
|
12073
12094
|
const i = e.payload || {}, r = t.payload?.items || [], a = Object.keys(i);
|
|
12074
12095
|
for (const s of a)
|
|
12075
12096
|
if (!r.some((n) => n.name === s))
|
|
12076
|
-
throw new
|
|
12097
|
+
throw new J(
|
|
12077
12098
|
`${s} in payload is not defined in interaction ${t.name}`,
|
|
12078
12099
|
{ type: `${s} not defined`, checkType: "payload" }
|
|
12079
12100
|
);
|
|
12080
12101
|
for (const s of r) {
|
|
12081
12102
|
if (s.required && !(s.name in i))
|
|
12082
|
-
throw new
|
|
12103
|
+
throw new J(
|
|
12083
12104
|
`Payload validation failed for field '${s.name}': missing`,
|
|
12084
12105
|
{ type: `${s.name} missing`, checkType: "payload" }
|
|
12085
12106
|
);
|
|
12086
12107
|
const n = i[s.name];
|
|
12087
12108
|
if (n === void 0) return;
|
|
12088
12109
|
if (s.isCollection && !Array.isArray(n))
|
|
12089
|
-
throw new
|
|
12110
|
+
throw new J(
|
|
12090
12111
|
`Payload validation failed for field '${s.name}': data is not array`,
|
|
12091
12112
|
{ type: `${s.name} data is not array`, checkType: "payload" }
|
|
12092
12113
|
);
|
|
12093
12114
|
if (s.isCollection) {
|
|
12094
12115
|
if (s.isRef && !n.every((o) => !!o.id))
|
|
12095
|
-
throw new
|
|
12116
|
+
throw new J(
|
|
12096
12117
|
`Payload validation failed for field '${s.name}': data not every is ref`,
|
|
12097
12118
|
{ type: `${s.name} data not every is ref`, checkType: "payload" }
|
|
12098
12119
|
);
|
|
12099
12120
|
} else if (s.isRef && !n.id)
|
|
12100
|
-
throw new
|
|
12121
|
+
throw new J(
|
|
12101
12122
|
`Payload validation failed for field '${s.name}': data is not a ref`,
|
|
12102
12123
|
{ type: `${s.name} data is not a ref`, checkType: "payload" }
|
|
12103
12124
|
);
|
|
12104
12125
|
if (s.base)
|
|
12105
12126
|
if (s.isCollection)
|
|
12106
12127
|
for (const o of n) {
|
|
12107
|
-
const l = await
|
|
12128
|
+
const l = await Nt(o, s.base);
|
|
12108
12129
|
if (l !== !0)
|
|
12109
|
-
throw new
|
|
12130
|
+
throw new J(
|
|
12110
12131
|
`Concept check failed for field '${s.name}'`,
|
|
12111
12132
|
{ type: `${s.name} check concept failed`, checkType: "concept", error: l }
|
|
12112
12133
|
);
|
|
12113
12134
|
}
|
|
12114
12135
|
else {
|
|
12115
|
-
const o = await
|
|
12136
|
+
const o = await Nt(n, s.base);
|
|
12116
12137
|
if (o !== !0)
|
|
12117
|
-
throw new
|
|
12138
|
+
throw new J(
|
|
12118
12139
|
`Concept check failed for field '${s.name}'`,
|
|
12119
12140
|
{ type: `${s.name} check concept failed`, checkType: "concept", error: o }
|
|
12120
12141
|
);
|
|
12121
12142
|
}
|
|
12122
12143
|
}
|
|
12123
12144
|
}
|
|
12124
|
-
async function
|
|
12145
|
+
async function Nt(c, t) {
|
|
12125
12146
|
if (t.base) {
|
|
12126
12147
|
const e = t;
|
|
12127
|
-
return e.attributive,
|
|
12148
|
+
return e.attributive, Nt(c, e.base);
|
|
12128
12149
|
}
|
|
12129
12150
|
if (t.for) {
|
|
12130
12151
|
for (const e of t.for)
|
|
12131
|
-
if (await
|
|
12152
|
+
if (await Nt(c, e) === !0) return !0;
|
|
12132
12153
|
return { name: t.name || "", type: "conceptAlias", error: "no match" };
|
|
12133
12154
|
}
|
|
12134
|
-
return
|
|
12155
|
+
return bt.is(t) ? !0 : D.is(t) ? c && typeof c == "object" ? !0 : { name: t.name || "", type: "conceptCheck", error: "invalid entity data" } : !0;
|
|
12135
12156
|
}
|
|
12136
|
-
async function
|
|
12157
|
+
async function Xa(c, t, e) {
|
|
12137
12158
|
if (D.is(t.data) || F.is(t.data)) {
|
|
12138
12159
|
const i = t.data.name, r = t.dataPolicy?.match, a = t.dataPolicy?.modifier, s = { ...e.query?.modifier || {}, ...a || {} }, n = e.query?.attributeQuery || [], o = typeof r == "function" ? await r.call(c, e) : r, l = E.and(o, e.query?.match);
|
|
12139
12160
|
return c.system.storage.find(i, l, s, n);
|
|
12140
12161
|
}
|
|
12141
12162
|
}
|
|
12142
|
-
class
|
|
12163
|
+
class Ke {
|
|
12143
12164
|
constructor(t, e) {
|
|
12144
12165
|
this._type = "Activity", this._options = e, this.uuid = A(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 || [];
|
|
12145
12166
|
}
|
|
@@ -12187,7 +12208,7 @@ class Ge {
|
|
|
12187
12208
|
};
|
|
12188
12209
|
}
|
|
12189
12210
|
static create(t, e) {
|
|
12190
|
-
const i = new
|
|
12211
|
+
const i = new Ke(t, e);
|
|
12191
12212
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12192
12213
|
throw new Error(`duplicate uuid in options ${i.uuid}, Activity`);
|
|
12193
12214
|
return this.instances.push(i), i;
|
|
@@ -12225,7 +12246,7 @@ class Ge {
|
|
|
12225
12246
|
return this.create(e.public, e.options);
|
|
12226
12247
|
}
|
|
12227
12248
|
}
|
|
12228
|
-
class
|
|
12249
|
+
class kt {
|
|
12229
12250
|
constructor(t, e) {
|
|
12230
12251
|
this._type = "ActivityGroup", this._options = e, this.uuid = A(e), this.type = t.type, this.activities = t.activities || [];
|
|
12231
12252
|
}
|
|
@@ -12254,7 +12275,7 @@ class St {
|
|
|
12254
12275
|
};
|
|
12255
12276
|
}
|
|
12256
12277
|
static create(t, e) {
|
|
12257
|
-
const i = new
|
|
12278
|
+
const i = new kt(t, e);
|
|
12258
12279
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12259
12280
|
throw new Error(`duplicate uuid in options ${i.uuid}, ActivityGroup`);
|
|
12260
12281
|
return this.instances.push(i), i;
|
|
@@ -12362,11 +12383,11 @@ function Bi(c, t, e) {
|
|
|
12362
12383
|
i.activities?.forEach((r) => Bi(r, t, i));
|
|
12363
12384
|
});
|
|
12364
12385
|
}
|
|
12365
|
-
function
|
|
12386
|
+
function Ls(c) {
|
|
12366
12387
|
const t = [];
|
|
12367
12388
|
return Bi(c, (e) => t.push(e)), t;
|
|
12368
12389
|
}
|
|
12369
|
-
function
|
|
12390
|
+
function qs(c) {
|
|
12370
12391
|
return null;
|
|
12371
12392
|
}
|
|
12372
12393
|
class Je {
|
|
@@ -12429,7 +12450,7 @@ class Je {
|
|
|
12429
12450
|
return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
|
|
12430
12451
|
}
|
|
12431
12452
|
}
|
|
12432
|
-
class
|
|
12453
|
+
class Xe {
|
|
12433
12454
|
constructor(t, e) {
|
|
12434
12455
|
this._type = "DataAttributive", this._options = e, this.uuid = A(e), this.content = t.content, this.name = t.name;
|
|
12435
12456
|
}
|
|
@@ -12455,7 +12476,7 @@ class Ke {
|
|
|
12455
12476
|
};
|
|
12456
12477
|
}
|
|
12457
12478
|
static create(t, e) {
|
|
12458
|
-
const i = new
|
|
12479
|
+
const i = new Xe(t, e);
|
|
12459
12480
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12460
12481
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributive`);
|
|
12461
12482
|
return this.instances.push(i), i;
|
|
@@ -12553,7 +12574,7 @@ class Ui {
|
|
|
12553
12574
|
return this.create(e.public, e.options);
|
|
12554
12575
|
}
|
|
12555
12576
|
}
|
|
12556
|
-
class
|
|
12577
|
+
class At {
|
|
12557
12578
|
constructor(t, e) {
|
|
12558
12579
|
this._type = "Gateway", this._options = e, this.uuid = A(e), this.name = t.name;
|
|
12559
12580
|
}
|
|
@@ -12575,7 +12596,7 @@ class kt {
|
|
|
12575
12596
|
};
|
|
12576
12597
|
}
|
|
12577
12598
|
static create(t, e) {
|
|
12578
|
-
const i = new
|
|
12599
|
+
const i = new At(t, e);
|
|
12579
12600
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12580
12601
|
throw new Error(`duplicate uuid in options ${i.uuid}, Gateway`);
|
|
12581
12602
|
return this.instances.push(i), i;
|
|
@@ -12607,7 +12628,7 @@ class kt {
|
|
|
12607
12628
|
return this.create(e.public, e.options);
|
|
12608
12629
|
}
|
|
12609
12630
|
}
|
|
12610
|
-
class
|
|
12631
|
+
class ze {
|
|
12611
12632
|
constructor(t, e) {
|
|
12612
12633
|
this._type = "Event", this._options = e, this.uuid = A(e), this.name = t.name;
|
|
12613
12634
|
}
|
|
@@ -12629,7 +12650,7 @@ class Xe {
|
|
|
12629
12650
|
};
|
|
12630
12651
|
}
|
|
12631
12652
|
static create(t, e) {
|
|
12632
|
-
const i = new
|
|
12653
|
+
const i = new ze(t, e);
|
|
12633
12654
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12634
12655
|
throw new Error(`duplicate uuid in options ${i.uuid}, Event`);
|
|
12635
12656
|
return this.instances.push(i), i;
|
|
@@ -12661,7 +12682,7 @@ class Xe {
|
|
|
12661
12682
|
return this.create(e.public, e.options);
|
|
12662
12683
|
}
|
|
12663
12684
|
}
|
|
12664
|
-
class
|
|
12685
|
+
class Ye {
|
|
12665
12686
|
constructor(t, e) {
|
|
12666
12687
|
this._type = "PayloadItem", this._options = e, this.uuid = A(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;
|
|
12667
12688
|
}
|
|
@@ -12712,7 +12733,7 @@ class ze {
|
|
|
12712
12733
|
};
|
|
12713
12734
|
}
|
|
12714
12735
|
static create(t, e) {
|
|
12715
|
-
const i = new
|
|
12736
|
+
const i = new Ye(t, e);
|
|
12716
12737
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12717
12738
|
throw new Error(`duplicate uuid in options ${i.uuid}, PayloadItem`);
|
|
12718
12739
|
return this.instances.push(i), i;
|
|
@@ -12751,7 +12772,7 @@ class ze {
|
|
|
12751
12772
|
return this.create(e.public, e.options);
|
|
12752
12773
|
}
|
|
12753
12774
|
}
|
|
12754
|
-
class
|
|
12775
|
+
class Ze {
|
|
12755
12776
|
constructor(t, e) {
|
|
12756
12777
|
this._type = "Payload", this._options = e, this.uuid = A(e), this.items = t.items || [];
|
|
12757
12778
|
}
|
|
@@ -12775,7 +12796,7 @@ class Ye {
|
|
|
12775
12796
|
};
|
|
12776
12797
|
}
|
|
12777
12798
|
static create(t, e) {
|
|
12778
|
-
const i = new
|
|
12799
|
+
const i = new Ze(t, e);
|
|
12779
12800
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12780
12801
|
throw new Error(`duplicate uuid in options ${i.uuid}, Payload`);
|
|
12781
12802
|
return this.instances.push(i), i;
|
|
@@ -12807,7 +12828,7 @@ class Ye {
|
|
|
12807
12828
|
return this.create(e.public, e.options);
|
|
12808
12829
|
}
|
|
12809
12830
|
}
|
|
12810
|
-
class
|
|
12831
|
+
class ti {
|
|
12811
12832
|
constructor(t, e) {
|
|
12812
12833
|
this._type = "DataAttributives", this._options = e, this.uuid = A(e), this.content = t.content;
|
|
12813
12834
|
}
|
|
@@ -12830,7 +12851,7 @@ class Ze {
|
|
|
12830
12851
|
};
|
|
12831
12852
|
}
|
|
12832
12853
|
static create(t, e) {
|
|
12833
|
-
const i = new
|
|
12854
|
+
const i = new ti(t, e);
|
|
12834
12855
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12835
12856
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributives`);
|
|
12836
12857
|
return this.instances.push(i), i;
|
|
@@ -12861,25 +12882,25 @@ class Ze {
|
|
|
12861
12882
|
return this.create(e.public, e.options);
|
|
12862
12883
|
}
|
|
12863
12884
|
}
|
|
12864
|
-
const
|
|
12865
|
-
We,
|
|
12885
|
+
const za = [
|
|
12866
12886
|
Ge,
|
|
12867
|
-
gt,
|
|
12868
|
-
Je,
|
|
12869
12887
|
Ke,
|
|
12870
|
-
|
|
12871
|
-
|
|
12888
|
+
bt,
|
|
12889
|
+
Je,
|
|
12872
12890
|
Xe,
|
|
12891
|
+
ae,
|
|
12892
|
+
At,
|
|
12873
12893
|
ze,
|
|
12874
12894
|
Ye,
|
|
12895
|
+
Ze,
|
|
12875
12896
|
se,
|
|
12876
|
-
|
|
12897
|
+
ti
|
|
12877
12898
|
];
|
|
12878
|
-
|
|
12879
|
-
c && c.displayName &&
|
|
12899
|
+
za.forEach((c) => {
|
|
12900
|
+
c && c.displayName && Ti(c.displayName, c);
|
|
12880
12901
|
});
|
|
12881
|
-
function
|
|
12882
|
-
return
|
|
12902
|
+
function _s({ name: c, isRef: t = !1 }, e) {
|
|
12903
|
+
return bt.create({
|
|
12883
12904
|
name: c,
|
|
12884
12905
|
content: c ? new Function("user", `return user.roles.includes('${c}')`) : function() {
|
|
12885
12906
|
return !0;
|
|
@@ -12887,7 +12908,7 @@ function qs({ name: c, isRef: t = !1 }, e) {
|
|
|
12887
12908
|
isRef: t
|
|
12888
12909
|
}, e);
|
|
12889
12910
|
}
|
|
12890
|
-
class
|
|
12911
|
+
class mt {
|
|
12891
12912
|
constructor(t, e) {
|
|
12892
12913
|
this.graph = t, this.parent = e;
|
|
12893
12914
|
}
|
|
@@ -12897,7 +12918,7 @@ class ft {
|
|
|
12897
12918
|
};
|
|
12898
12919
|
}
|
|
12899
12920
|
static create(t, e, i) {
|
|
12900
|
-
const r = new
|
|
12921
|
+
const r = new mt(e, i);
|
|
12901
12922
|
return t.current && (r.current = B.create(t.current, e, r)), r;
|
|
12902
12923
|
}
|
|
12903
12924
|
isInteractionAvailable(t) {
|
|
@@ -12930,13 +12951,13 @@ class B {
|
|
|
12930
12951
|
}
|
|
12931
12952
|
static createInitialState(t) {
|
|
12932
12953
|
const e = { uuid: t.uuid };
|
|
12933
|
-
return
|
|
12954
|
+
return kt.is(t.content) && (e.children = t.childSeqs.map((i) => mt.createInitialState(i.head))), e;
|
|
12934
12955
|
}
|
|
12935
12956
|
static create(t, e, i) {
|
|
12936
12957
|
const r = e.getNodeByUUID(t.uuid);
|
|
12937
|
-
if (
|
|
12958
|
+
if (kt.is(r.content)) {
|
|
12938
12959
|
const s = B.GroupStateNodeType.get(r.content.type), n = new s(r, e, i);
|
|
12939
|
-
return n.isGroup = !0, n.children = t?.children?.map((o) =>
|
|
12960
|
+
return n.isGroup = !0, n.children = t?.children?.map((o) => mt.create(o, e, n)), n;
|
|
12940
12961
|
} else
|
|
12941
12962
|
return new B(r, e, i);
|
|
12942
12963
|
}
|
|
@@ -12957,10 +12978,10 @@ class B {
|
|
|
12957
12978
|
}
|
|
12958
12979
|
class ye {
|
|
12959
12980
|
constructor(t, e) {
|
|
12960
|
-
this.graph = e, this.root =
|
|
12981
|
+
this.graph = e, this.root = mt.create(t, this.graph);
|
|
12961
12982
|
}
|
|
12962
12983
|
static createInitialState(t) {
|
|
12963
|
-
return
|
|
12984
|
+
return mt.createInitialState(t);
|
|
12964
12985
|
}
|
|
12965
12986
|
isInteractionAvailable(t) {
|
|
12966
12987
|
return this.root.isInteractionAvailable(t);
|
|
@@ -12972,7 +12993,7 @@ class ye {
|
|
|
12972
12993
|
return this.root.toJSON();
|
|
12973
12994
|
}
|
|
12974
12995
|
}
|
|
12975
|
-
class
|
|
12996
|
+
class vt {
|
|
12976
12997
|
constructor(t) {
|
|
12977
12998
|
this.activity = t, this.uuidToNode = /* @__PURE__ */ new Map(), this.rawToNode = /* @__PURE__ */ new Map(), this.checkUserRef = async (e, i, r, a) => (C(i.isRef, "attributive must be ref"), ((await this.getActivity(e, a))?.refs)[i.name] === r.id), this.graph = this.buildGraph(t);
|
|
12978
12999
|
}
|
|
@@ -12999,7 +13020,7 @@ class Nt {
|
|
|
12999
13020
|
const a = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]), s = /* @__PURE__ */ new Set([...Object.values(t.interactions), ...Object.values(t.groups)]);
|
|
13000
13021
|
if (t.transfers?.forEach((n) => {
|
|
13001
13022
|
const o = this.rawToNode.get(n.source) || i.get(n.source), l = this.rawToNode.get(n.target) || i.get(n.target);
|
|
13002
|
-
C(!!o, `cannot find source ${n.source.name}`), C(!!l, `cannot find target ${n.source.name}`),
|
|
13023
|
+
C(!!o, `cannot find source ${n.source.name}`), C(!!l, `cannot find target ${n.source.name}`), At.is(o) ? o.next.push(l) : o.next = l, At.is(l) ? l.prev.push(o) : l.prev = o, s.delete(n.source), a.delete(n.target);
|
|
13003
13024
|
}), a.size !== 1) throw new Error(`start node must one, current: ${a.size}`);
|
|
13004
13025
|
if (s.size !== 1) throw new Error(`end node must be one, current: ${s.size}`);
|
|
13005
13026
|
return Object.assign(r, {
|
|
@@ -13013,7 +13034,7 @@ class Nt {
|
|
|
13013
13034
|
async create(t) {
|
|
13014
13035
|
const e = ye.createInitialState(this.graph.head);
|
|
13015
13036
|
return {
|
|
13016
|
-
activityId: (await t.system.storage.create(
|
|
13037
|
+
activityId: (await t.system.storage.create(vt.ACTIVITY_RECORD, {
|
|
13017
13038
|
name: this.activity.name,
|
|
13018
13039
|
uuid: this.activity.uuid,
|
|
13019
13040
|
state: e,
|
|
@@ -13033,14 +13054,14 @@ class Nt {
|
|
|
13033
13054
|
key: "id",
|
|
13034
13055
|
value: ["=", e]
|
|
13035
13056
|
});
|
|
13036
|
-
return (await t.system.storage.find(
|
|
13057
|
+
return (await t.system.storage.find(vt.ACTIVITY_RECORD, i, void 0, ["*"])).map((a) => ({ ...a, state: a.state, refs: a.refs }))[0];
|
|
13037
13058
|
}
|
|
13038
13059
|
async setActivity(t, e, i) {
|
|
13039
13060
|
const r = w.atom({
|
|
13040
13061
|
key: "id",
|
|
13041
13062
|
value: ["=", e]
|
|
13042
13063
|
}), a = { ...i };
|
|
13043
|
-
return delete a.state, delete a.refs, i.state && (a.state = i.state), i.refs && (a.refs = i.refs), await t.system.storage.update(
|
|
13064
|
+
return delete a.state, delete a.refs, i.state && (a.state = i.state), i.refs && (a.refs = i.refs), await t.system.storage.update(vt.ACTIVITY_RECORD, r, a);
|
|
13044
13065
|
}
|
|
13045
13066
|
async setState(t, e, i) {
|
|
13046
13067
|
return this.setActivity(t, e, { state: i });
|
|
@@ -13054,7 +13075,7 @@ class Nt {
|
|
|
13054
13075
|
return e.parentSeq.tail === e;
|
|
13055
13076
|
}
|
|
13056
13077
|
isActivityHead(t, e = this.graph.head) {
|
|
13057
|
-
return
|
|
13078
|
+
return kt.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((i) => this.isActivityHead(t, i.head)) : t === this.graph.head.content;
|
|
13058
13079
|
}
|
|
13059
13080
|
async checkActivityState(t, e, i) {
|
|
13060
13081
|
if (!new ye(await this.getState(t, e), this).isInteractionAvailable(i))
|
|
@@ -13062,13 +13083,13 @@ class Nt {
|
|
|
13062
13083
|
}
|
|
13063
13084
|
async fullGuardWithUserRef(t, e, i) {
|
|
13064
13085
|
if (!t.ignoreGuard && e.conditions && await _i(t, e, i), e.userAttributives) {
|
|
13065
|
-
const r =
|
|
13086
|
+
const r = Qt.is(e.userAttributives) ? E.fromValue(
|
|
13066
13087
|
e.userAttributives.content
|
|
13067
13088
|
) : E.atom(
|
|
13068
13089
|
e.userAttributives
|
|
13069
|
-
), a = (n) => n.isRef ? this.checkUserRef(t, n, i.user, i.activityId) :
|
|
13090
|
+
), a = (n) => n.isRef ? this.checkUserRef(t, n, i.user, i.activityId) : Ya(t, n, i, i.user), s = await r.evaluateAsync(a);
|
|
13070
13091
|
if (s !== !0)
|
|
13071
|
-
throw new
|
|
13092
|
+
throw new J("User check failed", {
|
|
13072
13093
|
type: "check user failed",
|
|
13073
13094
|
checkType: "user",
|
|
13074
13095
|
error: s
|
|
@@ -13085,14 +13106,14 @@ class Nt {
|
|
|
13085
13106
|
async saveUserRefs(t, e, i, r) {
|
|
13086
13107
|
const a = (await this.getActivity(t, e))?.refs || {};
|
|
13087
13108
|
i.userRef?.name && (a[i.userRef?.name] = r.user.id), i.payload?.items.forEach((s) => {
|
|
13088
|
-
if (
|
|
13109
|
+
if (bt.is(s.itemRef) && s.itemRef?.name && r.payload[s.name]) {
|
|
13089
13110
|
const n = r.payload[s.name];
|
|
13090
13111
|
s.isCollection ? (a[s.itemRef.name] || (a[s.itemRef.name] = []), a[s.itemRef.name].push(n.id)) : a[s.itemRef.name] = n.id;
|
|
13091
13112
|
}
|
|
13092
13113
|
}), await this.setActivity(t, e, { refs: a });
|
|
13093
13114
|
}
|
|
13094
13115
|
}
|
|
13095
|
-
async function
|
|
13116
|
+
async function Ya(c, t, e, i) {
|
|
13096
13117
|
if (t.content) {
|
|
13097
13118
|
let r;
|
|
13098
13119
|
try {
|
|
@@ -13104,7 +13125,7 @@ async function za(c, t, e, i) {
|
|
|
13104
13125
|
}
|
|
13105
13126
|
return !0;
|
|
13106
13127
|
}
|
|
13107
|
-
class
|
|
13128
|
+
class Za extends B {
|
|
13108
13129
|
onChange(t, e) {
|
|
13109
13130
|
if (this.graph.isStartNode(t)) {
|
|
13110
13131
|
if (e)
|
|
@@ -13115,24 +13136,24 @@ class Ya extends B {
|
|
|
13115
13136
|
}
|
|
13116
13137
|
}
|
|
13117
13138
|
}
|
|
13118
|
-
B.GroupStateNodeType.set("any",
|
|
13119
|
-
class
|
|
13139
|
+
B.GroupStateNodeType.set("any", Za);
|
|
13140
|
+
class ts extends B {
|
|
13120
13141
|
onChange(t, e) {
|
|
13121
13142
|
this.isGroupCompleted() && this.complete();
|
|
13122
13143
|
}
|
|
13123
13144
|
}
|
|
13124
|
-
B.GroupStateNodeType.set("every",
|
|
13125
|
-
class
|
|
13145
|
+
B.GroupStateNodeType.set("every", ts);
|
|
13146
|
+
class es extends B {
|
|
13126
13147
|
onChange(t, e) {
|
|
13127
13148
|
this.graph.isEndNode(t) && this.complete();
|
|
13128
13149
|
}
|
|
13129
13150
|
}
|
|
13130
|
-
B.GroupStateNodeType.set("race",
|
|
13131
|
-
class
|
|
13151
|
+
B.GroupStateNodeType.set("race", es);
|
|
13152
|
+
class is extends B {
|
|
13132
13153
|
}
|
|
13133
|
-
B.GroupStateNodeType.set("program",
|
|
13134
|
-
const
|
|
13135
|
-
name:
|
|
13154
|
+
B.GroupStateNodeType.set("program", is);
|
|
13155
|
+
const rs = "_Activity_", Hi = D.create({
|
|
13156
|
+
name: rs,
|
|
13136
13157
|
properties: [
|
|
13137
13158
|
T.create({
|
|
13138
13159
|
name: "name",
|
|
@@ -13155,18 +13176,18 @@ const is = "_Activity_", Hi = D.create({
|
|
|
13155
13176
|
collection: !1
|
|
13156
13177
|
})
|
|
13157
13178
|
]
|
|
13158
|
-
}),
|
|
13179
|
+
}), as = F.create({
|
|
13159
13180
|
name: "activityInteraction",
|
|
13160
13181
|
source: Hi,
|
|
13161
13182
|
sourceProperty: "interaction",
|
|
13162
|
-
target:
|
|
13183
|
+
target: We,
|
|
13163
13184
|
targetProperty: "activity",
|
|
13164
13185
|
type: "1:n"
|
|
13165
13186
|
});
|
|
13166
|
-
class
|
|
13187
|
+
class Vs {
|
|
13167
13188
|
constructor(t) {
|
|
13168
|
-
this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(Hi,
|
|
13169
|
-
const i = new
|
|
13189
|
+
this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(Hi, We), this.requiredRelations.push(as)), t.forEach((e) => {
|
|
13190
|
+
const i = new vt(e);
|
|
13170
13191
|
this.activityCalls.set(e.uuid, i), e.name && (C(!this.activityCallsByName.has(e.name), `activity name ${e.name} is duplicated`), this.activityCallsByName.set(e.name, i));
|
|
13171
13192
|
});
|
|
13172
13193
|
for (const e of t) {
|
|
@@ -13241,7 +13262,7 @@ class _s {
|
|
|
13241
13262
|
return this.activityCallsByName.get(t);
|
|
13242
13263
|
}
|
|
13243
13264
|
}
|
|
13244
|
-
class
|
|
13265
|
+
class Qs extends U {
|
|
13245
13266
|
constructor(t, e = {}) {
|
|
13246
13267
|
super(t, {
|
|
13247
13268
|
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
@@ -13257,7 +13278,7 @@ class Vs extends U {
|
|
|
13257
13278
|
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || q.HIGH;
|
|
13258
13279
|
}
|
|
13259
13280
|
}
|
|
13260
|
-
class
|
|
13281
|
+
class ss extends U {
|
|
13261
13282
|
constructor(t, e = {}) {
|
|
13262
13283
|
super(t, {
|
|
13263
13284
|
errorType: e.context?.errorType || "ActivityError",
|
|
@@ -13273,7 +13294,7 @@ class as extends U {
|
|
|
13273
13294
|
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || q.MEDIUM;
|
|
13274
13295
|
}
|
|
13275
13296
|
}
|
|
13276
|
-
class
|
|
13297
|
+
class Bs extends ss {
|
|
13277
13298
|
constructor(t, e = {}) {
|
|
13278
13299
|
super(t, {
|
|
13279
13300
|
...e,
|
|
@@ -13288,118 +13309,118 @@ class Qs extends as {
|
|
|
13288
13309
|
}
|
|
13289
13310
|
}
|
|
13290
13311
|
export {
|
|
13291
|
-
|
|
13312
|
+
rs as ACTIVITY_RECORD,
|
|
13292
13313
|
tr as ALL_ATTR_SYMBOL,
|
|
13293
13314
|
de as ASYNC_TASK_RECORD,
|
|
13294
13315
|
ae as Action,
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13316
|
+
Ke as Activity,
|
|
13317
|
+
vt as ActivityCall,
|
|
13318
|
+
ss as ActivityError,
|
|
13319
|
+
kt as ActivityGroup,
|
|
13320
|
+
as as ActivityInteractionRelation,
|
|
13321
|
+
Vs as ActivityManager,
|
|
13301
13322
|
Hi as ActivityStateEntity,
|
|
13302
|
-
|
|
13323
|
+
Bs as ActivityStateError,
|
|
13303
13324
|
Er as AliasManager,
|
|
13304
13325
|
fa as AmbiguousComputationSignatureError,
|
|
13305
|
-
|
|
13326
|
+
Dt as Any,
|
|
13306
13327
|
qr as AnyHandles,
|
|
13307
13328
|
Ve as AsyncMigrationComputationError,
|
|
13308
13329
|
it as AttributeInfo,
|
|
13309
13330
|
O as AttributeQuery,
|
|
13310
|
-
|
|
13311
|
-
|
|
13312
|
-
|
|
13331
|
+
bt as Attributive,
|
|
13332
|
+
Qt as Attributives,
|
|
13333
|
+
Mt as Average,
|
|
13313
13334
|
ra as AverageHandles,
|
|
13314
|
-
|
|
13335
|
+
Ft as BoolAtomData,
|
|
13315
13336
|
E as BoolExp,
|
|
13316
|
-
|
|
13337
|
+
Lt as BoolExpressionData,
|
|
13317
13338
|
rt as ComputationDataDepError,
|
|
13318
13339
|
H as ComputationError,
|
|
13319
13340
|
x as ComputationResult,
|
|
13320
|
-
|
|
13341
|
+
Vt as ComputationResultAsync,
|
|
13321
13342
|
Xt as ComputationResultFullRecompute,
|
|
13322
13343
|
ee as ComputationResultResolved,
|
|
13323
|
-
|
|
13324
|
-
|
|
13344
|
+
pt as ComputationResultSkip,
|
|
13345
|
+
ui as ComputationStateError,
|
|
13325
13346
|
Je as Condition,
|
|
13326
|
-
|
|
13347
|
+
ut as ConditionError,
|
|
13327
13348
|
se as Conditions,
|
|
13328
13349
|
at as ConstraintSetupError,
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13350
|
+
xi as ConstraintViolationError,
|
|
13351
|
+
Ms as Controller,
|
|
13352
|
+
It as Count,
|
|
13332
13353
|
Qr as CountHandles,
|
|
13333
13354
|
ir as CreationExecutor,
|
|
13334
13355
|
Pe as Custom,
|
|
13335
13356
|
ca as CustomHandles,
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13357
|
+
He as DBConsoleLogger,
|
|
13358
|
+
Va as DBLogLevel,
|
|
13359
|
+
ai as DBSetup,
|
|
13360
|
+
ri as DEFAULT_SCHEMA_DIALECT,
|
|
13361
|
+
Ts as DELETED_STATE,
|
|
13362
|
+
K as DICTIONARY_RECORD,
|
|
13363
|
+
Xe as DataAttributive,
|
|
13364
|
+
ti as DataAttributives,
|
|
13344
13365
|
Ui as DataPolicy,
|
|
13345
|
-
|
|
13366
|
+
St as DestructiveComputedOutputError,
|
|
13346
13367
|
Ie as Dictionary,
|
|
13347
|
-
|
|
13368
|
+
ci as DictionaryEntity,
|
|
13348
13369
|
D as Entity,
|
|
13349
13370
|
sa as EntityCustomHandle,
|
|
13350
|
-
|
|
13351
|
-
|
|
13371
|
+
ei as EntityQueryHandle,
|
|
13372
|
+
dt as EntityToTableMap,
|
|
13352
13373
|
Oe as Equation,
|
|
13353
13374
|
Z as ErrorCategory,
|
|
13354
13375
|
q as ErrorSeverity,
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13376
|
+
ze as Event,
|
|
13377
|
+
Ai as EventSource,
|
|
13378
|
+
Pt as Every,
|
|
13358
13379
|
Or as EveryHandles,
|
|
13359
13380
|
_ as Expression,
|
|
13360
13381
|
U as FrameworkError,
|
|
13361
|
-
|
|
13362
|
-
|
|
13382
|
+
At as Gateway,
|
|
13383
|
+
Ua as GetAction,
|
|
13363
13384
|
Fr as GlobalAnyHandle,
|
|
13364
13385
|
ea as GlobalAverageHandle,
|
|
13365
13386
|
z as GlobalBoundState,
|
|
13366
13387
|
_r as GlobalCountHandle,
|
|
13367
13388
|
aa as GlobalCustomHandle,
|
|
13368
13389
|
Pr as GlobalEveryHandle,
|
|
13369
|
-
|
|
13390
|
+
Jr as GlobalRealTimeComputation,
|
|
13370
13391
|
Ar as GlobalStateMachineHandle,
|
|
13371
13392
|
Yr as GlobalSumHandle,
|
|
13372
13393
|
Ir as GlobalWeightedSummationHandle,
|
|
13373
13394
|
Se as HARD_DELETION_PROPERTY_NAME,
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13395
|
+
xs as HardDeletionProperty,
|
|
13396
|
+
si as ID_ATTR,
|
|
13397
|
+
Ha as INTERACTION_RECORD,
|
|
13377
13398
|
zt as Inequality,
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13399
|
+
Ge as Interaction,
|
|
13400
|
+
We as InteractionEventEntity,
|
|
13401
|
+
Qs as InteractionExecutionError,
|
|
13402
|
+
J as InteractionGuardError,
|
|
13382
13403
|
Ce as KlassByName,
|
|
13383
13404
|
g as LINK_SYMBOL,
|
|
13384
|
-
|
|
13405
|
+
Jt as LinkInfo,
|
|
13385
13406
|
Le as MIGRATION_MANIFEST_CONCEPT,
|
|
13386
13407
|
qe as MIGRATION_MANIFEST_CURRENT_KEY,
|
|
13387
13408
|
w as MatchExp,
|
|
13388
13409
|
he as MigrationBaselineError,
|
|
13389
13410
|
M as MigrationError,
|
|
13390
13411
|
Zi as Modifier,
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13412
|
+
Ds as MonoSystem,
|
|
13413
|
+
Es as NON_DELETED_STATE,
|
|
13414
|
+
vs as NON_EXIST_STATE,
|
|
13394
13415
|
Br as NestedDispatchError,
|
|
13395
13416
|
j as NewRecordData,
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13417
|
+
ki as NonNullConstraint,
|
|
13418
|
+
ys as PHASE_AFTER_ALL,
|
|
13419
|
+
ms as PHASE_BEFORE_ALL,
|
|
13399
13420
|
ce as PHASE_NORMAL,
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13421
|
+
Ze as Payload,
|
|
13422
|
+
Ye as PayloadItem,
|
|
13423
|
+
Cs as PhysicalLayoutChangeError,
|
|
13403
13424
|
T as Property,
|
|
13404
13425
|
Lr as PropertyAnyHandle,
|
|
13405
13426
|
ia as PropertyAverageHandle,
|
|
@@ -13412,113 +13433,114 @@ export {
|
|
|
13412
13433
|
$e as PropertyTypes,
|
|
13413
13434
|
xr as PropertyWeightedSummationHandle,
|
|
13414
13435
|
or as QueryExecutor,
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13436
|
+
Kt as ROOT_LABEL,
|
|
13437
|
+
ni as ROW_ID_ATTR,
|
|
13438
|
+
Ot as RealTime,
|
|
13418
13439
|
zr as RealTimeHandles,
|
|
13419
13440
|
$ as RecordBoundState,
|
|
13420
|
-
|
|
13441
|
+
Et as RecordInfo,
|
|
13421
13442
|
qi as RecordMutationSideEffect,
|
|
13422
13443
|
L as RecordQuery,
|
|
13423
13444
|
ur as RecordQueryAgent,
|
|
13424
13445
|
nr as RecordQueryRef,
|
|
13425
13446
|
G as RecordQueryTree,
|
|
13426
13447
|
Gr as RecordsTransformHandle,
|
|
13427
|
-
|
|
13448
|
+
ht as RecursiveContext,
|
|
13428
13449
|
ge as RefContainer,
|
|
13429
13450
|
F as Relation,
|
|
13430
13451
|
na as RelationCustomHandle,
|
|
13431
13452
|
X as RequireSerializableRetry,
|
|
13432
13453
|
sr as SQLBuilder,
|
|
13433
|
-
|
|
13454
|
+
Rt as SYSTEM_RECORD,
|
|
13434
13455
|
ha as Scheduler,
|
|
13435
13456
|
Me as SideEffect,
|
|
13436
|
-
|
|
13457
|
+
Ct as StateMachine,
|
|
13437
13458
|
$r as StateMachineHandles,
|
|
13438
|
-
|
|
13459
|
+
yt as StateNode,
|
|
13439
13460
|
xe as StateTransfer,
|
|
13440
|
-
|
|
13461
|
+
xt as Summation,
|
|
13441
13462
|
ta as SummationHandles,
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13463
|
+
je as SystemConsoleLogger,
|
|
13464
|
+
oi as SystemEntity,
|
|
13465
|
+
Qa as SystemLogLevel,
|
|
13445
13466
|
Re as TransactionCapabilityError,
|
|
13446
|
-
|
|
13467
|
+
Wt as TransactionRetryExhaustedError,
|
|
13447
13468
|
Qi as Transfer,
|
|
13448
13469
|
te as Transform,
|
|
13449
|
-
|
|
13450
|
-
|
|
13470
|
+
Kr as TransformHandles,
|
|
13471
|
+
Is as USER_ENTITY,
|
|
13451
13472
|
Zt as UniqueConstraint,
|
|
13452
|
-
|
|
13453
|
-
|
|
13473
|
+
Tt as UnrebuildableComputationError,
|
|
13474
|
+
$t as WeightedSummation,
|
|
13454
13475
|
Mr as WeightedSummationHandles,
|
|
13455
|
-
|
|
13476
|
+
Sa as addMissingRebuildHandlerRequirements,
|
|
13477
|
+
hi as addToCurrentEffects,
|
|
13456
13478
|
C as assert,
|
|
13457
13479
|
Fi as assertDestructiveScopeAllowed,
|
|
13458
13480
|
Fe as asyncEffectsContext,
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13481
|
+
Os as asyncInteractionContext,
|
|
13482
|
+
Fs as boolExpToAttributives,
|
|
13483
|
+
mi as buildAffectedRebuildPlan,
|
|
13462
13484
|
Ta as buildMigrationDiff,
|
|
13463
13485
|
_i as checkCondition,
|
|
13464
13486
|
Vi as checkPayload,
|
|
13465
|
-
|
|
13487
|
+
ds as clearAllInstances,
|
|
13466
13488
|
Y as collectErrorChain,
|
|
13467
13489
|
re as computationManifestId,
|
|
13468
13490
|
Gi as createInstances,
|
|
13469
|
-
|
|
13470
|
-
|
|
13491
|
+
ps as createInstancesFromString,
|
|
13492
|
+
jt as createMigrationManifest,
|
|
13471
13493
|
kr as createNonNullConstraintStatement,
|
|
13472
|
-
|
|
13494
|
+
xa as createPlanBlockingMessages,
|
|
13473
13495
|
Sr as createUniqueConstraintStatement,
|
|
13474
13496
|
be as createUniqueIndexSQL,
|
|
13475
|
-
|
|
13497
|
+
_s as createUserRoleAttributive,
|
|
13476
13498
|
P as dataContextPath,
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13499
|
+
Ps as dbConsoleLogger,
|
|
13500
|
+
Bt as deepClone,
|
|
13501
|
+
Ci as defaultEncodeLiteral,
|
|
13502
|
+
ws as everyAsync,
|
|
13503
|
+
Ns as everyWithErrorAsync,
|
|
13504
|
+
gs as filterMap,
|
|
13483
13505
|
la as findConstraintViolationError,
|
|
13484
13506
|
jr as findErrorByCode,
|
|
13485
|
-
|
|
13507
|
+
qs as findRootActivity,
|
|
13486
13508
|
Bi as forEachInteraction,
|
|
13487
13509
|
A as generateUUID,
|
|
13488
|
-
|
|
13489
|
-
|
|
13510
|
+
$s as getChangedComputations,
|
|
13511
|
+
Aa as getChangedComputationsFromApprovedDiff,
|
|
13490
13512
|
pa as getCurrentEffects,
|
|
13491
13513
|
Te as getDestructiveDeletionScope,
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13514
|
+
Ls as getInteractions,
|
|
13515
|
+
gi as getNewFilteredDataContexts,
|
|
13516
|
+
Ia as getRecomputeBlockingChanges,
|
|
13495
13517
|
Q as getSchemaDialect,
|
|
13496
|
-
|
|
13497
|
-
|
|
13518
|
+
yi as getStorageBlockingChanges,
|
|
13519
|
+
Ss as hasErrorCode,
|
|
13498
13520
|
ma as hashMigrationDiff,
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13521
|
+
us as indexBy,
|
|
13522
|
+
vi as isObject,
|
|
13523
|
+
Ei as isPlainObject,
|
|
13502
13524
|
Ur as isRequireSerializableRetry,
|
|
13503
13525
|
Hr as isRetryableTransactionError,
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13526
|
+
As as isTransactionCapabilityError,
|
|
13527
|
+
ks as isTransactionRetryExhaustedError,
|
|
13528
|
+
bs as mapObject,
|
|
13507
13529
|
le as normalizeDatabaseError,
|
|
13508
13530
|
Tr as predicateSQLForOperator,
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13531
|
+
ct as quoteIdentifier,
|
|
13532
|
+
Ut as quoteLiteral,
|
|
13533
|
+
bi as readMigrationManifest,
|
|
13534
|
+
Da as recomputeChangedComputations,
|
|
13535
|
+
Fa as recomputeFilteredMemberships,
|
|
13536
|
+
Ti as registerKlass,
|
|
13515
13537
|
De as runWithTransactionRetry,
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13538
|
+
Rs as someAsync,
|
|
13539
|
+
fs as sqliteEncodeLiteral,
|
|
13540
|
+
hs as stringifyAllInstances,
|
|
13519
13541
|
k as stringifyAttribute,
|
|
13520
|
-
|
|
13521
|
-
|
|
13542
|
+
Ba as systemConsoleLogger,
|
|
13543
|
+
ka as validateApprovedDiff,
|
|
13522
13544
|
me as writeMigrationManifest
|
|
13523
13545
|
};
|
|
13524
13546
|
//# sourceMappingURL=index.js.map
|