interaqt 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtins/interaction/Interaction.d.ts.map +1 -1
- package/dist/core/BoolExp.d.ts.map +1 -1
- package/dist/index.js +686 -662
- package/dist/index.js.map +1 -1
- package/dist/storage/erstorage/MatchExp.d.ts +1 -0
- package/dist/storage/erstorage/MatchExp.d.ts.map +1 -1
- package/dist/storage/erstorage/RecordQueryAgent.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,8 +35,8 @@ function B(s, e) {
|
|
|
35
35
|
};
|
|
36
36
|
return JSON.stringify(i);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return typeof s == "string" && s.startsWith("func::") ? new Function("return " + s.substring(6))() : Array.isArray(s) ? s.map((e) =>
|
|
38
|
+
function I(s) {
|
|
39
|
+
return typeof s == "string" && s.startsWith("func::") ? new Function("return " + s.substring(6))() : Array.isArray(s) ? s.map((e) => I(e)) : rt(s) ? Object.fromEntries(Object.entries(s).map(([e, t]) => [e, I(t)])) : s;
|
|
40
40
|
}
|
|
41
41
|
function yt(s, e) {
|
|
42
42
|
if (s == null || typeof s != "object") return s;
|
|
@@ -66,9 +66,9 @@ function $o() {
|
|
|
66
66
|
}
|
|
67
67
|
function To(s) {
|
|
68
68
|
const e = JSON.parse(s);
|
|
69
|
-
return
|
|
69
|
+
return Aa(e);
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Aa(s) {
|
|
72
72
|
const e = /* @__PURE__ */ new Map();
|
|
73
73
|
for (const u of s) {
|
|
74
74
|
if (!qt.get(u.type))
|
|
@@ -86,8 +86,8 @@ function Ia(s) {
|
|
|
86
86
|
const d = u.substring(6), p = t.get(d);
|
|
87
87
|
if (p) return l(p);
|
|
88
88
|
if (i.has(d)) {
|
|
89
|
-
const
|
|
90
|
-
return
|
|
89
|
+
const m = r.get(d) || [];
|
|
90
|
+
return m.push(l), r.set(d, m), l(void 0);
|
|
91
91
|
}
|
|
92
92
|
const h = e.get(d);
|
|
93
93
|
if (!h)
|
|
@@ -98,40 +98,40 @@ function Ia(s) {
|
|
|
98
98
|
}
|
|
99
99
|
if (Array.isArray(u)) {
|
|
100
100
|
const d = new Array(u.length);
|
|
101
|
-
return u.forEach((p, h) => a(p, (
|
|
102
|
-
d[h] =
|
|
101
|
+
return u.forEach((p, h) => a(p, (m) => {
|
|
102
|
+
d[h] = m;
|
|
103
103
|
})), l(d);
|
|
104
104
|
}
|
|
105
105
|
if (rt(u)) {
|
|
106
106
|
const d = {};
|
|
107
|
-
return Object.entries(u).forEach(([p, h]) => a(h, (
|
|
108
|
-
d[p] =
|
|
107
|
+
return Object.entries(u).forEach(([p, h]) => a(h, (m) => {
|
|
108
|
+
d[p] = m;
|
|
109
109
|
})), l(d);
|
|
110
110
|
}
|
|
111
111
|
return l(u);
|
|
112
112
|
}
|
|
113
113
|
const n = /* @__PURE__ */ new Set(["computation"]), o = [];
|
|
114
114
|
function c(u) {
|
|
115
|
-
const { type: l, options: d = {}, uuid: p, public: h } = u,
|
|
116
|
-
if (
|
|
115
|
+
const { type: l, options: d = {}, uuid: p, public: h } = u, m = t.get(p);
|
|
116
|
+
if (m) return m;
|
|
117
117
|
i.add(p);
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
Object.entries(h || {}).forEach(([
|
|
121
|
-
if (n.has(
|
|
118
|
+
const f = qt.get(l), y = {};
|
|
119
|
+
let w;
|
|
120
|
+
Object.entries(h || {}).forEach(([b, N]) => {
|
|
121
|
+
if (n.has(b)) {
|
|
122
122
|
o.push(() => {
|
|
123
123
|
a(N, (E) => {
|
|
124
|
-
b
|
|
124
|
+
w[b] = E;
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
a(N, (E) => {
|
|
130
|
-
|
|
130
|
+
w ? w[b] = E : y[b] = E;
|
|
131
131
|
});
|
|
132
|
-
}),
|
|
132
|
+
}), w = f.create(y, { ...d, uuid: p }), i.delete(p), t.set(p, w);
|
|
133
133
|
const g = r.get(p);
|
|
134
|
-
return g && (r.delete(p), g.forEach((
|
|
134
|
+
return g && (r.delete(p), g.forEach((b) => b(w))), w;
|
|
135
135
|
}
|
|
136
136
|
for (const u of s)
|
|
137
137
|
c(u);
|
|
@@ -139,9 +139,9 @@ function Ia(s) {
|
|
|
139
139
|
throw new Error(`Unresolved instance references after deserialization: ${Array.from(r.keys()).join(", ")}`);
|
|
140
140
|
return t;
|
|
141
141
|
}
|
|
142
|
-
let
|
|
142
|
+
let Ia = 0;
|
|
143
143
|
function P(s) {
|
|
144
|
-
return s?.uuid || `id_${++
|
|
144
|
+
return s?.uuid || `id_${++Ia}`;
|
|
145
145
|
}
|
|
146
146
|
function Vr(s, e, t) {
|
|
147
147
|
const i = t === "Relation" ? ["id", "_rowId", "source", "target"] : ["id", "_rowId"], r = /* @__PURE__ */ new Set();
|
|
@@ -271,12 +271,12 @@ class j {
|
|
|
271
271
|
}
|
|
272
272
|
static parse(e) {
|
|
273
273
|
const t = JSON.parse(e);
|
|
274
|
-
return this.create(
|
|
274
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
var xi = /* @__PURE__ */ ((s) => (s.String = "string", s.Number = "number", s.Boolean = "boolean", s.Timestamp = "timestamp", s))(xi || {});
|
|
278
278
|
const ii = /^[a-zA-Z0-9_]+$/;
|
|
279
|
-
class
|
|
279
|
+
class Ai {
|
|
280
280
|
constructor(e, t) {
|
|
281
281
|
this._type = "Dictionary", this._options = t, this.uuid = P(t), this.name = e.name, this.type = e.type, this.collection = e.collection ?? !1, this.args = e.args, this.defaultValue = e.defaultValue, this.computation = e.computation;
|
|
282
282
|
}
|
|
@@ -331,7 +331,7 @@ class Ii {
|
|
|
331
331
|
static create(e, t) {
|
|
332
332
|
if (typeof e.name != "string" || !ii.test(e.name))
|
|
333
333
|
throw new Error(`Dictionary name "${e.name}" is invalid. Dictionary names must match ${ii} (letters, numbers and underscore only).`);
|
|
334
|
-
const i = new
|
|
334
|
+
const i = new Ai(e, t);
|
|
335
335
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
336
336
|
throw new Error(`duplicate uuid in options ${i.uuid}, Dictionary`);
|
|
337
337
|
return this.instances.push(i), i;
|
|
@@ -355,7 +355,7 @@ class Ii {
|
|
|
355
355
|
}
|
|
356
356
|
static parse(e) {
|
|
357
357
|
const t = JSON.parse(e);
|
|
358
|
-
return this.create(
|
|
358
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
const ri = /^[a-zA-Z0-9_]+$/;
|
|
@@ -434,7 +434,7 @@ class x {
|
|
|
434
434
|
}
|
|
435
435
|
static parse(e) {
|
|
436
436
|
const t = JSON.parse(e);
|
|
437
|
-
return this.create(
|
|
437
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
const Fe = /^[a-zA-Z0-9_]+$/, nr = ["1:1", "1:n", "n:1", "n:n"];
|
|
@@ -641,7 +641,7 @@ class X {
|
|
|
641
641
|
}
|
|
642
642
|
static parse(e) {
|
|
643
643
|
const t = JSON.parse(e);
|
|
644
|
-
return this.create(
|
|
644
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
const Qe = /^[a-zA-Z0-9_]+$/;
|
|
@@ -715,10 +715,10 @@ class jt {
|
|
|
715
715
|
}
|
|
716
716
|
static parse(e) {
|
|
717
717
|
const t = JSON.parse(e);
|
|
718
|
-
return this.create(
|
|
718
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
class
|
|
721
|
+
class Ii {
|
|
722
722
|
constructor(e, t) {
|
|
723
723
|
this._type = "NonNullConstraint", this._options = t, this.uuid = P(t), this.name = e.name, this.property = e.property, this.violationCode = e.violationCode;
|
|
724
724
|
}
|
|
@@ -753,7 +753,7 @@ class Ai {
|
|
|
753
753
|
static create(e, t) {
|
|
754
754
|
if (typeof e.name != "string" || !Qe.test(e.name))
|
|
755
755
|
throw new Error(`NonNullConstraint name "${e.name}" is invalid. Constraint names must match ${Qe} (letters, numbers and underscore only).`);
|
|
756
|
-
const i = new
|
|
756
|
+
const i = new Ii(e, t);
|
|
757
757
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
758
758
|
throw new Error(`duplicate uuid in options ${i.uuid}, NonNullConstraint`);
|
|
759
759
|
return this.instances.push(i), i;
|
|
@@ -776,7 +776,7 @@ class Ai {
|
|
|
776
776
|
}
|
|
777
777
|
static parse(e) {
|
|
778
778
|
const t = JSON.parse(e);
|
|
779
|
-
return this.create(
|
|
779
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
782
|
class Ht {
|
|
@@ -891,7 +891,7 @@ class Ht {
|
|
|
891
891
|
}
|
|
892
892
|
static parse(e) {
|
|
893
893
|
const t = JSON.parse(e);
|
|
894
|
-
return this.create(
|
|
894
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
895
895
|
}
|
|
896
896
|
}
|
|
897
897
|
class Ke {
|
|
@@ -944,7 +944,7 @@ class Ke {
|
|
|
944
944
|
}
|
|
945
945
|
static parse(e) {
|
|
946
946
|
const t = JSON.parse(e);
|
|
947
|
-
return this.create(
|
|
947
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
950
|
class Pi {
|
|
@@ -1009,7 +1009,7 @@ class Pi {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
static parse(e) {
|
|
1011
1011
|
const t = JSON.parse(e);
|
|
1012
|
-
return this.create(
|
|
1012
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
1015
|
class at {
|
|
@@ -1068,7 +1068,7 @@ class at {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
static parse(e) {
|
|
1070
1070
|
const t = JSON.parse(e);
|
|
1071
|
-
return this.create(
|
|
1071
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
1074
|
class nt {
|
|
@@ -1145,7 +1145,7 @@ class nt {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
static parse(e) {
|
|
1147
1147
|
const t = JSON.parse(e);
|
|
1148
|
-
return this.create(
|
|
1148
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
1151
|
class st {
|
|
@@ -1223,7 +1223,7 @@ class st {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
static parse(e) {
|
|
1225
1225
|
const t = JSON.parse(e);
|
|
1226
|
-
return this.create(
|
|
1226
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
class ot {
|
|
@@ -1288,7 +1288,7 @@ class ot {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
static parse(e) {
|
|
1290
1290
|
const t = JSON.parse(e);
|
|
1291
|
-
return this.create(
|
|
1291
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
class ct {
|
|
@@ -1353,7 +1353,7 @@ class ct {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
static parse(e) {
|
|
1355
1355
|
const t = JSON.parse(e);
|
|
1356
|
-
return this.create(
|
|
1356
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
1359
|
class ut {
|
|
@@ -1432,7 +1432,7 @@ class ut {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
static parse(e) {
|
|
1434
1434
|
const t = JSON.parse(e);
|
|
1435
|
-
return this.create(
|
|
1435
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
1438
|
class lt {
|
|
@@ -1509,7 +1509,7 @@ class lt {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
static parse(e) {
|
|
1511
1511
|
const t = JSON.parse(e);
|
|
1512
|
-
return this.create(
|
|
1512
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
class Kt {
|
|
@@ -1574,7 +1574,7 @@ class Kt {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
static parse(e) {
|
|
1576
1576
|
const t = JSON.parse(e);
|
|
1577
|
-
return this.create(
|
|
1577
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
1580
|
class dt {
|
|
@@ -1637,7 +1637,7 @@ class dt {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
static parse(e) {
|
|
1639
1639
|
const t = JSON.parse(e);
|
|
1640
|
-
return this.create(
|
|
1640
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
1643
|
class Mi {
|
|
@@ -1690,7 +1690,7 @@ class Mi {
|
|
|
1690
1690
|
}
|
|
1691
1691
|
static parse(e) {
|
|
1692
1692
|
const t = JSON.parse(e);
|
|
1693
|
-
return this.create(
|
|
1693
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1694
1694
|
}
|
|
1695
1695
|
}
|
|
1696
1696
|
class zt {
|
|
@@ -1744,7 +1744,7 @@ class zt {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
static parse(e) {
|
|
1746
1746
|
const t = JSON.parse(e);
|
|
1747
|
-
return this.create(
|
|
1747
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
1750
1750
|
class Gt {
|
|
@@ -1810,7 +1810,7 @@ class Gt {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
static parse(e) {
|
|
1812
1812
|
const t = JSON.parse(e);
|
|
1813
|
-
return this.create(
|
|
1813
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
1816
|
class $ {
|
|
@@ -1946,11 +1946,9 @@ class $ {
|
|
|
1946
1946
|
const o = n;
|
|
1947
1947
|
return o && !i || !o && i ? !0 : { data: a, inverse: i, stack: t, error: "atom evaluate error" };
|
|
1948
1948
|
}
|
|
1949
|
-
if (this.isOr())
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
const a = this.left.evaluate(e, r);
|
|
1953
|
-
return a !== !0 ? a : this.requireRight("and").evaluate(e, r);
|
|
1949
|
+
if (this.isOr() || this.isAnd()) {
|
|
1950
|
+
const a = i ? this.isOr() : this.isAnd(), n = this.requireRight(this.isAnd() ? "and" : "or"), o = this.left.evaluate(e, r, i);
|
|
1951
|
+
return a ? o !== !0 ? o : n.evaluate(e, r, i) : o === !0 ? !0 : n.evaluate(e, r, i);
|
|
1954
1952
|
}
|
|
1955
1953
|
if (this.isNot())
|
|
1956
1954
|
return this.left.evaluate(e, r, !i);
|
|
@@ -1972,11 +1970,9 @@ class $ {
|
|
|
1972
1970
|
const o = n;
|
|
1973
1971
|
return o && !i || !o && i ? !0 : { data: a, inverse: i, stack: t, error: "atom evaluate error" };
|
|
1974
1972
|
}
|
|
1975
|
-
if (this.isOr())
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
const a = await this.left.evaluateAsync(e, r);
|
|
1979
|
-
return a !== !0 ? a : this.requireRight("and").evaluateAsync(e, r);
|
|
1973
|
+
if (this.isOr() || this.isAnd()) {
|
|
1974
|
+
const a = i ? this.isOr() : this.isAnd(), n = this.requireRight(this.isAnd() ? "and" : "or"), o = await this.left.evaluateAsync(e, r, i);
|
|
1975
|
+
return a ? o !== !0 ? o : n.evaluateAsync(e, r, i) : o === !0 ? !0 : n.evaluateAsync(e, r, i);
|
|
1980
1976
|
}
|
|
1981
1977
|
if (this.isNot())
|
|
1982
1978
|
return this.left.evaluateAsync(e, r, !i);
|
|
@@ -2291,7 +2287,7 @@ class qi {
|
|
|
2291
2287
|
// uuid:: 引用(entity)需要 graph 管线(createInstances)才能解析。
|
|
2292
2288
|
static parse(e) {
|
|
2293
2289
|
const t = JSON.parse(e);
|
|
2294
|
-
return this.create(
|
|
2290
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
2295
2291
|
}
|
|
2296
2292
|
}
|
|
2297
2293
|
const La = [
|
|
@@ -2299,7 +2295,7 @@ const La = [
|
|
|
2299
2295
|
X,
|
|
2300
2296
|
x,
|
|
2301
2297
|
jt,
|
|
2302
|
-
|
|
2298
|
+
Ii,
|
|
2303
2299
|
Ht,
|
|
2304
2300
|
Ke,
|
|
2305
2301
|
Pi,
|
|
@@ -2313,7 +2309,7 @@ const La = [
|
|
|
2313
2309
|
Kt,
|
|
2314
2310
|
dt,
|
|
2315
2311
|
Mi,
|
|
2316
|
-
|
|
2312
|
+
Ai,
|
|
2317
2313
|
Ye,
|
|
2318
2314
|
zt,
|
|
2319
2315
|
Gt,
|
|
@@ -2741,8 +2737,8 @@ class S {
|
|
|
2741
2737
|
const c = [...n.resolvedPath, o], u = this.map.getInfoByPath(c), l = n.resolvedPath.concat(u?.isLinkFiltered() ? u.getBaseAttributeInfo().attributeName : o);
|
|
2742
2738
|
let d = n.matchExpression;
|
|
2743
2739
|
if (u?.isLinkFiltered()) {
|
|
2744
|
-
const p = u.getLinkInfo(), h = new S(p.getResolvedBaseRecordName(), this.map, p.getResolvedMatchExpression()),
|
|
2745
|
-
d = d ? d.and(
|
|
2740
|
+
const p = u.getLinkInfo(), h = new S(p.getResolvedBaseRecordName(), this.map, p.getResolvedMatchExpression()), m = this.map.getReversePath(l), y = [u.isRecordSource() ? "source" : "target", ...m.slice(2)], w = h.rebase(y.join("."));
|
|
2741
|
+
d = d ? d.and(w) : w;
|
|
2746
2742
|
}
|
|
2747
2743
|
return {
|
|
2748
2744
|
path: [...n.path, o],
|
|
@@ -2762,12 +2758,35 @@ class S {
|
|
|
2762
2758
|
const o = e.data.value[1].split(".");
|
|
2763
2759
|
o.length > 1 && t.addField(o);
|
|
2764
2760
|
}
|
|
2765
|
-
if (i.length === 1 && a.isValue)
|
|
2761
|
+
if (!this.contextRootEntity && Array.isArray(e.data.value) && typeof e.data.value[0] == "string" && e.data.value[0].toLowerCase() === "exist" && e.data.value[1] && this.collectExistReferencePaths(e.data.value[1]).forEach((o) => t.addField(o)), i.length === 1 && a.isValue)
|
|
2766
2762
|
return;
|
|
2767
2763
|
const n = this.map.spawnManyToManySymmetricPath(r);
|
|
2768
2764
|
a.isRecord ? n ? n.forEach((o) => t.addRecord(o.slice(1, 1 / 0))) : t.addRecord(i) : n ? n.forEach((o) => t.addField(o.slice(1, 1 / 0))) : t.addField(i);
|
|
2769
2765
|
}
|
|
2770
2766
|
}
|
|
2767
|
+
// CAUTION 收集 exist 子查询(含嵌套 exist)里所有 isReferenceValue 的引用路径。这些引用都
|
|
2768
|
+
// 解析自最外层根实体(contextRootEntity 逐层继承),因此必须由根查询统一并入 JOIN 树。
|
|
2769
|
+
// 仅返回跨关联的多段路径(length>1);单段的是根实体自己的列,无需额外 JOIN。
|
|
2770
|
+
// 节点可能是 BoolExp、ExpressionData 或裸 MatchAtom(exist 的 value[1] 允许这几种形态),统一归一化。
|
|
2771
|
+
collectExistReferencePaths(e) {
|
|
2772
|
+
const t = (a) => a instanceof $ ? a : $.isExpressionData(a) ? $.fromValue(a) : a && typeof a == "object" && "key" in a && "value" in a ? $.atom(a) : null, i = [], r = (a) => {
|
|
2773
|
+
const n = t(a);
|
|
2774
|
+
if (!n) return;
|
|
2775
|
+
if (n.isExpression()) {
|
|
2776
|
+
n.left && r(n.left), n.right && r(n.right);
|
|
2777
|
+
return;
|
|
2778
|
+
}
|
|
2779
|
+
const o = n.data;
|
|
2780
|
+
if (Array.isArray(o.value)) {
|
|
2781
|
+
if (o.isReferenceValue && typeof o.value[1] == "string") {
|
|
2782
|
+
const c = o.value[1].split(".");
|
|
2783
|
+
c.length > 1 && i.push(c);
|
|
2784
|
+
}
|
|
2785
|
+
typeof o.value[0] == "string" && o.value[0].toLowerCase() === "exist" && o.value[1] && r(o.value[1]);
|
|
2786
|
+
}
|
|
2787
|
+
};
|
|
2788
|
+
return r(e), i;
|
|
2789
|
+
}
|
|
2771
2790
|
getFinalFieldName(e) {
|
|
2772
2791
|
const t = [this.entityName].concat(e.slice(0, -1));
|
|
2773
2792
|
return this.map.getTableAliasAndFieldName(t, e.at(-1)).slice(0, 2);
|
|
@@ -2876,13 +2895,13 @@ class S {
|
|
|
2876
2895
|
}
|
|
2877
2896
|
let l;
|
|
2878
2897
|
for (const d of u) {
|
|
2879
|
-
const p = this.getFinalFieldName(d), [h,
|
|
2898
|
+
const p = this.getFinalFieldName(d), [h, m] = this.getFinalFieldValue(r.data.isReferenceValue, r.data.key, r.data.value, p.join("."), n.fieldType, e, t), f = {
|
|
2880
2899
|
...r.data,
|
|
2881
2900
|
fieldName: p,
|
|
2882
2901
|
fieldValue: h,
|
|
2883
|
-
fieldParams:
|
|
2902
|
+
fieldParams: m
|
|
2884
2903
|
};
|
|
2885
|
-
l = l ? l.or(
|
|
2904
|
+
l = l ? l.or(f) : $.atom(f);
|
|
2886
2905
|
}
|
|
2887
2906
|
return l;
|
|
2888
2907
|
} else {
|
|
@@ -2897,12 +2916,12 @@ class S {
|
|
|
2897
2916
|
for (const p of u) {
|
|
2898
2917
|
const h = [this.entityName].concat(p);
|
|
2899
2918
|
T(h.length === o.length, `symmetric path variant must preserve length, ${h} ${o}`);
|
|
2900
|
-
const
|
|
2919
|
+
const m = l({
|
|
2901
2920
|
...r.data,
|
|
2902
2921
|
namePath: h,
|
|
2903
2922
|
isFunctionMatch: !0
|
|
2904
2923
|
});
|
|
2905
|
-
d = d ? d.or(
|
|
2924
|
+
d = d ? d.or(m) : $.atom(m);
|
|
2906
2925
|
}
|
|
2907
2926
|
return d;
|
|
2908
2927
|
}
|
|
@@ -3019,8 +3038,8 @@ class Br {
|
|
|
3019
3038
|
}
|
|
3020
3039
|
}
|
|
3021
3040
|
class G {
|
|
3022
|
-
constructor(e, t, i, r, a, n, o, c, u, l = !1, d, p, h,
|
|
3023
|
-
this.recordName = e, this.map = t, this.matchExpression = i, this.attributeQuery = r, this.modifier = a, this.contextRootEntity = n, this.parentRecord = o, this.attributeName = c, this.onlyRelationData = u, this.allowNull = l, this.label = d, this.goto = p, this.exit = h, this.alias =
|
|
3041
|
+
constructor(e, t, i, r, a, n, o, c, u, l = !1, d, p, h, m) {
|
|
3042
|
+
this.recordName = e, this.map = t, this.matchExpression = i, this.attributeQuery = r, this.modifier = a, this.contextRootEntity = n, this.parentRecord = o, this.attributeName = c, this.onlyRelationData = u, this.allowNull = l, this.label = d, this.goto = p, this.exit = h, this.alias = m;
|
|
3024
3043
|
}
|
|
3025
3044
|
static create(e, t, i, r, a, n, o, c = !1, u) {
|
|
3026
3045
|
const d = t.getRecordInfo(e).resolvedBaseRecordName, p = new S(e, t, i.matchExpression, r), h = c ? p : p.and({
|
|
@@ -3138,33 +3157,33 @@ class K {
|
|
|
3138
3157
|
const u = typeof c == "string" ? [c, {}, !1] : c, [l, d, p] = u;
|
|
3139
3158
|
if (l === R) {
|
|
3140
3159
|
T(!!(this.parentRecord && this.attributeName), `parent record and attribute name cannot be empty when query link data, you passed ${this.parentRecord} ${this.attributeName}`);
|
|
3141
|
-
const
|
|
3142
|
-
let
|
|
3143
|
-
|
|
3144
|
-
...
|
|
3160
|
+
const m = this.map.getInfo(this.parentRecord, this.attributeName);
|
|
3161
|
+
let f = d;
|
|
3162
|
+
m.isLinkManyToManySymmetric() && (f = {
|
|
3163
|
+
...f,
|
|
3145
3164
|
attributeQuery: K.mergeAttributeQueryData(
|
|
3146
|
-
|
|
3165
|
+
f.attributeQuery || [],
|
|
3147
3166
|
[["source", { attributeQuery: ["id"] }], ["target", { attributeQuery: ["id"] }]]
|
|
3148
3167
|
)
|
|
3149
|
-
}), this.parentLinkRecordQuery = G.create(
|
|
3168
|
+
}), this.parentLinkRecordQuery = G.create(m.linkName, this.map, f, void 0);
|
|
3150
3169
|
return;
|
|
3151
3170
|
}
|
|
3152
3171
|
if (l === Va) {
|
|
3153
|
-
o = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((
|
|
3172
|
+
o = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((m) => m.attributeName));
|
|
3154
3173
|
return;
|
|
3155
3174
|
}
|
|
3156
3175
|
const h = this.map.getInfo(this.recordName, l);
|
|
3157
3176
|
if (h.isRecord) {
|
|
3158
|
-
let
|
|
3177
|
+
let m = l, f = d;
|
|
3159
3178
|
if (h.isLinkFiltered()) {
|
|
3160
|
-
|
|
3161
|
-
const
|
|
3162
|
-
|
|
3179
|
+
m = h.getBaseAttributeInfo().attributeName;
|
|
3180
|
+
const w = d.matchExpression, g = h.getLinkInfo().getBaseLinkInfo(), N = new S(g.name, this.map, h.getMatchExpression()).rebase(h.isRecordSource() ? "target" : "source"), E = w ? N.and(w) : N;
|
|
3181
|
+
f = {
|
|
3163
3182
|
...d,
|
|
3164
3183
|
matchExpression: E.data
|
|
3165
3184
|
};
|
|
3166
3185
|
}
|
|
3167
|
-
const y = G.create(h.recordName, this.map,
|
|
3186
|
+
const y = G.create(h.recordName, this.map, f, void 0, this.recordName, m, p, !1, l);
|
|
3168
3187
|
this.relatedRecords.push(y), h.isXToMany ? this.xToManyRecords.push(y) : h.isXToOne && this.xToOneRecords.push(y);
|
|
3169
3188
|
} else
|
|
3170
3189
|
o.add(l);
|
|
@@ -3174,13 +3193,13 @@ class K {
|
|
|
3174
3193
|
const i = [...e, ...t], r = new Set(i.filter((c) => typeof c == "string")), a = i.filter((c) => typeof c != "string"), n = (c, u, l) => {
|
|
3175
3194
|
const d = {}, p = ["matchExpression", "modifier", "label", "goto", "exit"];
|
|
3176
3195
|
for (const h of p) {
|
|
3177
|
-
const
|
|
3178
|
-
if (!(
|
|
3179
|
-
if (
|
|
3196
|
+
const m = u[h], f = l[h];
|
|
3197
|
+
if (!(m === void 0 && f === void 0)) {
|
|
3198
|
+
if (m !== void 0 && f !== void 0 && JSON.stringify(m) !== JSON.stringify(f))
|
|
3180
3199
|
throw new Error(
|
|
3181
3200
|
`cannot merge duplicate attributeQuery entries for "${c}": both declare a different "${h}". Merging would have to silently pick one (dropping the other's ${h}), which returns wrong data with no warning. Combine them into a single entry explicitly.`
|
|
3182
3201
|
);
|
|
3183
|
-
d[h] =
|
|
3202
|
+
d[h] = m !== void 0 ? m : f;
|
|
3184
3203
|
}
|
|
3185
3204
|
}
|
|
3186
3205
|
return d;
|
|
@@ -3805,8 +3824,8 @@ class Ua {
|
|
|
3805
3824
|
const u = [e].concat(o);
|
|
3806
3825
|
let l = e;
|
|
3807
3826
|
for (let h = 0; h < o.length - 1; h++) {
|
|
3808
|
-
const
|
|
3809
|
-
c(l,
|
|
3827
|
+
const m = o[h], f = o.slice(0, h), y = this.map.getInfoByPath(u.slice(0, h + 2));
|
|
3828
|
+
c(l, f, m), y && y.isRecord && (l = y.recordName);
|
|
3810
3829
|
}
|
|
3811
3830
|
const d = o[o.length - 1], p = o.slice(0, o.length - 1);
|
|
3812
3831
|
c(l, p, d);
|
|
@@ -3905,9 +3924,9 @@ class Ua {
|
|
|
3905
3924
|
for (const o of a) {
|
|
3906
3925
|
const c = o.dependencies.filter((p) => p.entityName === e), u = /* @__PURE__ */ new Set();
|
|
3907
3926
|
for (const p of c) {
|
|
3908
|
-
if (i && !i.filter((
|
|
3927
|
+
if (i && !i.filter((f) => p.attributes.includes(f)).length)
|
|
3909
3928
|
continue;
|
|
3910
|
-
(await this.findAffectedSourceRecordIds(o, p.path, t)).forEach((
|
|
3929
|
+
(await this.findAffectedSourceRecordIds(o, p.path, t)).forEach((m) => u.add(m));
|
|
3911
3930
|
}
|
|
3912
3931
|
if (!u.size) continue;
|
|
3913
3932
|
const l = Array.from(u), d = await this.checkRecordsMatchFilter(l, o.baseEntityName, o.matchExpression);
|
|
@@ -3950,8 +3969,8 @@ class Ua {
|
|
|
3950
3969
|
a.matchExpression
|
|
3951
3970
|
);
|
|
3952
3971
|
for (const d of u) {
|
|
3953
|
-
const p = ni(a.filteredEntityName, d.id), h = l.has(d.id),
|
|
3954
|
-
h !==
|
|
3972
|
+
const p = ni(a.filteredEntityName, d.id), h = l.has(d.id), m = i.has(p) ? i.get(p) : o.has(d.id);
|
|
3973
|
+
h !== m && t.push({
|
|
3955
3974
|
type: h ? "create" : "delete",
|
|
3956
3975
|
recordName: a.filteredEntityName,
|
|
3957
3976
|
record: { ...d }
|
|
@@ -4075,24 +4094,24 @@ class Ha {
|
|
|
4075
4094
|
l,
|
|
4076
4095
|
t,
|
|
4077
4096
|
u
|
|
4078
|
-
), [h,
|
|
4097
|
+
), [h, m] = this.buildSelectClause(
|
|
4079
4098
|
e.attributeQuery.getValueAndXToOneRecordFields(),
|
|
4080
4099
|
t
|
|
4081
|
-
),
|
|
4100
|
+
), f = this.buildFromClause(e.recordName, t), y = this.buildJoinClause(c, t), w = this.buildModifierClause(e.modifier, t, m);
|
|
4082
4101
|
return [
|
|
4083
4102
|
`
|
|
4084
4103
|
SELECT
|
|
4085
4104
|
${h}
|
|
4086
4105
|
FROM
|
|
4087
|
-
${
|
|
4106
|
+
${f}
|
|
4088
4107
|
${y}
|
|
4089
4108
|
WHERE
|
|
4090
4109
|
${d}
|
|
4091
4110
|
|
|
4092
|
-
${
|
|
4111
|
+
${w}
|
|
4093
4112
|
`,
|
|
4094
4113
|
p,
|
|
4095
|
-
|
|
4114
|
+
m
|
|
4096
4115
|
];
|
|
4097
4116
|
}
|
|
4098
4117
|
/**
|
|
@@ -4161,13 +4180,13 @@ ${b}
|
|
|
4161
4180
|
if (d !== "ASC" && d !== "DESC")
|
|
4162
4181
|
throw new Error(`orderBy value must be 'ASC' or 'DESC', got: ${JSON.stringify(l)} for attribute ${c}`);
|
|
4163
4182
|
const p = c.split(".");
|
|
4164
|
-
let h,
|
|
4165
|
-
p.length === 1 ? (h = [u],
|
|
4166
|
-
const [
|
|
4183
|
+
let h, m;
|
|
4184
|
+
p.length === 1 ? (h = [u], m = c) : (h = [u, ...p.slice(0, -1)], m = p[p.length - 1]);
|
|
4185
|
+
const [f, y] = this.map.getTableAliasAndFieldName(
|
|
4167
4186
|
h,
|
|
4168
|
-
|
|
4187
|
+
m
|
|
4169
4188
|
);
|
|
4170
|
-
return `"${`${this.withPrefix(t)}${
|
|
4189
|
+
return `"${`${this.withPrefix(t)}${f}`}"."${y}" ${d}`;
|
|
4171
4190
|
}).join(",")}`), r != null && o.push(`LIMIT ${r}`), a != null && a !== 0 && o.push(`OFFSET ${a}`), o.join(`
|
|
4172
4191
|
`);
|
|
4173
4192
|
}
|
|
@@ -4191,15 +4210,15 @@ ${b}
|
|
|
4191
4210
|
table: d,
|
|
4192
4211
|
alias: p,
|
|
4193
4212
|
linkTable: h,
|
|
4194
|
-
linkAlias:
|
|
4195
|
-
} = this.map.getTableAndAliasStack(l).at(-1), [,
|
|
4213
|
+
linkAlias: m
|
|
4214
|
+
} = this.map.getTableAndAliasStack(l).at(-1), [, f] = this.map.getTableAliasAndFieldName(l, "id", !0);
|
|
4196
4215
|
if (!u.isMergedWithParent())
|
|
4197
4216
|
if (u.isLinkMergedWithParent()) {
|
|
4198
4217
|
if (o.onlyIdField()) return;
|
|
4199
4218
|
r.push({
|
|
4200
4219
|
for: l,
|
|
4201
4220
|
joinSource: n,
|
|
4202
|
-
joinIdField: [u.linkField,
|
|
4221
|
+
joinIdField: [u.linkField, f],
|
|
4203
4222
|
joinTarget: [d, p]
|
|
4204
4223
|
});
|
|
4205
4224
|
} else if (u.isLinkMergedWithAttribute()) {
|
|
@@ -4213,26 +4232,26 @@ ${b}
|
|
|
4213
4232
|
joinTarget: [d, p]
|
|
4214
4233
|
});
|
|
4215
4234
|
} else {
|
|
4216
|
-
const y = u.getLinkInfo(),
|
|
4235
|
+
const y = u.getLinkInfo(), w = u.isLinkManyToManySymmetric() ? u.symmetricDirection === "source" : y.isRelationSource(u.parentEntityName, u.attributeName);
|
|
4217
4236
|
r.push({
|
|
4218
4237
|
for: l,
|
|
4219
4238
|
joinSource: n,
|
|
4220
|
-
joinIdField: [a,
|
|
4221
|
-
joinTarget: [h,
|
|
4239
|
+
joinIdField: [a, w ? y.record.attributes.source.field : y.record.attributes.target.field],
|
|
4240
|
+
joinTarget: [h, m]
|
|
4222
4241
|
}), o.onlyIdField() || r.push({
|
|
4223
4242
|
for: l,
|
|
4224
|
-
joinSource: [h,
|
|
4225
|
-
joinIdField: [
|
|
4243
|
+
joinSource: [h, m],
|
|
4244
|
+
joinIdField: [w ? y.record.attributes.target.field : y.record.attributes.source.field, f],
|
|
4226
4245
|
joinTarget: [d, p]
|
|
4227
4246
|
});
|
|
4228
4247
|
}
|
|
4229
|
-
if (r.push(...this.getJoinTables(o, l, [
|
|
4230
|
-
const y = l.concat(R), [,
|
|
4231
|
-
|
|
4248
|
+
if (r.push(...this.getJoinTables(o, l, [f, d, p])), o.parentLinkQueryTree && !o.parentLinkQueryTree.onlyIdField()) {
|
|
4249
|
+
const y = l.concat(R), [, w] = this.map.getTableAliasAndFieldName(y, "id", !0), g = [
|
|
4250
|
+
w,
|
|
4232
4251
|
// link 的 idField
|
|
4233
4252
|
h,
|
|
4234
4253
|
// link 的 tableName
|
|
4235
|
-
|
|
4254
|
+
m
|
|
4236
4255
|
// link 的 tableAlias
|
|
4237
4256
|
];
|
|
4238
4257
|
r.push(...this.getJoinTables(o.parentLinkQueryTree, y, g));
|
|
@@ -4451,16 +4470,16 @@ class za {
|
|
|
4451
4470
|
if (i || (i = new Ka(e)), e.goto) {
|
|
4452
4471
|
if (e.exit && await e.exit(r))
|
|
4453
4472
|
return [];
|
|
4454
|
-
const
|
|
4455
|
-
T(
|
|
4456
|
-
const g = e.matchExpression.and(
|
|
4473
|
+
const w = i.get(e.goto);
|
|
4474
|
+
T(w, `goto ${e.goto} not found`);
|
|
4475
|
+
const g = e.matchExpression.and(w.matchExpression), b = w.derive({
|
|
4457
4476
|
matchExpression: g
|
|
4458
4477
|
});
|
|
4459
|
-
return this.findRecords(
|
|
4478
|
+
return this.findRecords(b, t, i, r);
|
|
4460
4479
|
}
|
|
4461
4480
|
if (e.label && r.label === e.label && r.stack.length > 1) {
|
|
4462
|
-
const
|
|
4463
|
-
if (r.stack.slice(0, -1).some((g) => g.id ===
|
|
4481
|
+
const w = r.stack.at(-1);
|
|
4482
|
+
if (r.stack.slice(0, -1).some((g) => g.id === w.id))
|
|
4464
4483
|
return [];
|
|
4465
4484
|
}
|
|
4466
4485
|
const n = e.modifier, o = (n.limit !== void 0 || n.offset !== void 0) && !(n.limit === 1 && !n.offset) && (this.queryTreeHasXToManyPath(e.matchExpression.xToOneQueryTree) || this.queryTreeHasXToManyPath(e.modifier.xToOneQueryTree)), c = o ? e.derive({
|
|
@@ -4475,48 +4494,48 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4475
4494
|
l,
|
|
4476
4495
|
t
|
|
4477
4496
|
);
|
|
4478
|
-
let
|
|
4497
|
+
let m = this.dedupeIdenticalRows(h);
|
|
4479
4498
|
if (o) {
|
|
4480
|
-
const
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
n.limit !== void 0 ?
|
|
4499
|
+
const w = n.offset || 0;
|
|
4500
|
+
m = m.slice(
|
|
4501
|
+
w,
|
|
4502
|
+
n.limit !== void 0 ? w + n.limit : void 0
|
|
4484
4503
|
);
|
|
4485
4504
|
}
|
|
4486
|
-
const
|
|
4487
|
-
await this.completeXToOneLeftoverRecords(e,
|
|
4488
|
-
for (let
|
|
4489
|
-
if (
|
|
4490
|
-
const
|
|
4491
|
-
for (let N of
|
|
4492
|
-
const E =
|
|
4493
|
-
key: `${
|
|
4505
|
+
const f = this.structureRawReturns(m, e.recordName, d), y = e.label && e.label !== r.label ? r.spawn(e.label) : r;
|
|
4506
|
+
await this.completeXToOneLeftoverRecords(e, f, i, y);
|
|
4507
|
+
for (let w of e.attributeQuery.xToOneRecords)
|
|
4508
|
+
if (w.goto) {
|
|
4509
|
+
const b = this.map.getInfo(w.parentRecord, w.attributeName).getReverseInfo()?.attributeName;
|
|
4510
|
+
for (let N of f) {
|
|
4511
|
+
const E = w.matchExpression.and({
|
|
4512
|
+
key: `${b}.id`,
|
|
4494
4513
|
value: ["=", N.id]
|
|
4495
|
-
}), v =
|
|
4514
|
+
}), v = w.derive({
|
|
4496
4515
|
matchExpression: E
|
|
4497
4516
|
}), k = e.label ? y.concat(N) : y;
|
|
4498
|
-
N[
|
|
4517
|
+
N[w.alias || w.attributeName] = await this.findRecords(v, t, i, k);
|
|
4499
4518
|
}
|
|
4500
4519
|
}
|
|
4501
|
-
for (let
|
|
4502
|
-
const g =
|
|
4520
|
+
for (let w of e.attributeQuery.xToOneRecords) {
|
|
4521
|
+
const g = w.attributeQuery.parentLinkRecordQuery;
|
|
4503
4522
|
if (g)
|
|
4504
|
-
for (let
|
|
4505
|
-
const E = this.map.getInfo(
|
|
4506
|
-
for (let v of
|
|
4507
|
-
if (!v[
|
|
4508
|
-
const k = v[
|
|
4509
|
-
matchExpression:
|
|
4523
|
+
for (let b of g.attributeQuery.xToManyRecords) {
|
|
4524
|
+
const E = this.map.getInfo(b.parentRecord, b.attributeName).getReverseInfo()?.attributeName;
|
|
4525
|
+
for (let v of f) {
|
|
4526
|
+
if (!v[w.attributeName]?.[R]) continue;
|
|
4527
|
+
const k = v[w.attributeName][R].id, q = b.derive({
|
|
4528
|
+
matchExpression: b.matchExpression.and({
|
|
4510
4529
|
key: `${E}.id`,
|
|
4511
4530
|
value: ["=", k]
|
|
4512
4531
|
})
|
|
4513
4532
|
}), F = e.label ? y.concat(v) : y;
|
|
4514
4533
|
gt(
|
|
4515
4534
|
v,
|
|
4516
|
-
[
|
|
4535
|
+
[w.alias || w.attributeName, R, b.attributeName],
|
|
4517
4536
|
await this.findRecords(
|
|
4518
4537
|
q,
|
|
4519
|
-
`finding relation data: ${e.recordName}.${
|
|
4538
|
+
`finding relation data: ${e.recordName}.${w.attributeName}.&.${b.attributeName}`,
|
|
4520
4539
|
i,
|
|
4521
4540
|
F
|
|
4522
4541
|
)
|
|
@@ -4524,30 +4543,30 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4524
4543
|
}
|
|
4525
4544
|
}
|
|
4526
4545
|
}
|
|
4527
|
-
for (let
|
|
4528
|
-
if (!
|
|
4529
|
-
if (this.canBatchXToManyQuery(e,
|
|
4546
|
+
for (let w of e.attributeQuery.xToManyRecords)
|
|
4547
|
+
if (!w.onlyRelationData)
|
|
4548
|
+
if (this.canBatchXToManyQuery(e, w, f))
|
|
4530
4549
|
await this.findXToManyRelatedRecordsBatched(
|
|
4531
4550
|
e.recordName,
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4551
|
+
w.attributeName,
|
|
4552
|
+
f,
|
|
4553
|
+
w,
|
|
4535
4554
|
i,
|
|
4536
4555
|
y
|
|
4537
4556
|
);
|
|
4538
4557
|
else
|
|
4539
|
-
for (let g of
|
|
4540
|
-
const
|
|
4541
|
-
g[
|
|
4558
|
+
for (let g of f) {
|
|
4559
|
+
const b = e.label ? y.concat(g) : y;
|
|
4560
|
+
g[w.alias || w.attributeName] = await this.findXToManyRelatedRecords(
|
|
4542
4561
|
e.recordName,
|
|
4543
|
-
|
|
4562
|
+
w.attributeName,
|
|
4544
4563
|
g.id,
|
|
4545
|
-
|
|
4564
|
+
w,
|
|
4546
4565
|
i,
|
|
4547
|
-
|
|
4566
|
+
b
|
|
4548
4567
|
);
|
|
4549
4568
|
}
|
|
4550
|
-
return
|
|
4569
|
+
return f;
|
|
4551
4570
|
}
|
|
4552
4571
|
/**
|
|
4553
4572
|
* 判断查询树中是否存在 x:n 路径(会导致 LEFT JOIN fan-out)。
|
|
@@ -4587,21 +4606,21 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4587
4606
|
y[l] = [], d.set(String(y.id), y);
|
|
4588
4607
|
const p = r.attributeQuery.data.some(
|
|
4589
4608
|
(y) => (typeof y == "string" ? y : y[0]) === u
|
|
4590
|
-
), h = p ? r.attributeQuery.data : [...r.attributeQuery.data, [u, { attributeQuery: ["id"] }]],
|
|
4609
|
+
), h = p ? r.attributeQuery.data : [...r.attributeQuery.data, [u, { attributeQuery: ["id"] }]], m = r.attributeQuery.parentLinkRecordQuery, f = !!m;
|
|
4591
4610
|
for (let y = 0; y < i.length; y += 500) {
|
|
4592
|
-
const
|
|
4611
|
+
const w = i.slice(y, y + 500), g = r.matchExpression.and({
|
|
4593
4612
|
key: `${u}.id`,
|
|
4594
|
-
value: ["in",
|
|
4595
|
-
}),
|
|
4613
|
+
value: ["in", w.map((v) => v.id)]
|
|
4614
|
+
}), b = new K(
|
|
4596
4615
|
r.recordName,
|
|
4597
4616
|
this.map,
|
|
4598
4617
|
h,
|
|
4599
4618
|
r.parentRecord,
|
|
4600
4619
|
r.attributeName,
|
|
4601
|
-
|
|
4620
|
+
f
|
|
4602
4621
|
), N = r.derive({
|
|
4603
4622
|
matchExpression: g,
|
|
4604
|
-
attributeQuery:
|
|
4623
|
+
attributeQuery: b
|
|
4605
4624
|
}), E = await this.findRecords(
|
|
4606
4625
|
N,
|
|
4607
4626
|
`finding related records in batch: ${r.parentRecord}.${r.attributeName}`,
|
|
@@ -4610,8 +4629,8 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4610
4629
|
);
|
|
4611
4630
|
for (const v of E) {
|
|
4612
4631
|
const k = v[u]?.id, q = k !== void 0 ? d.get(String(k)) : void 0;
|
|
4613
|
-
if (
|
|
4614
|
-
for (let F of
|
|
4632
|
+
if (f ? (v[R] = v[u]?.[R], delete v[u]) : p || delete v[u], m)
|
|
4633
|
+
for (let F of m.attributeQuery.xToManyRecords) {
|
|
4615
4634
|
const Y = v[R].id;
|
|
4616
4635
|
gt(
|
|
4617
4636
|
v,
|
|
@@ -4692,29 +4711,29 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4692
4711
|
h = p;
|
|
4693
4712
|
else if (!o.isLinkManyToManySymmetric())
|
|
4694
4713
|
h = p.map((y) => {
|
|
4695
|
-
const
|
|
4714
|
+
const w = {
|
|
4696
4715
|
...y,
|
|
4697
4716
|
[R]: y[c][R]
|
|
4698
4717
|
};
|
|
4699
|
-
return delete
|
|
4718
|
+
return delete w[c], w;
|
|
4700
4719
|
});
|
|
4701
4720
|
else {
|
|
4702
|
-
const
|
|
4721
|
+
const w = r.attributeQuery.data.find(
|
|
4703
4722
|
(v) => Array.isArray(v) && v[0] === R
|
|
4704
|
-
)?.[1]?.attributeQuery || [], g = (v) =>
|
|
4723
|
+
)?.[1]?.attributeQuery || [], g = (v) => w.some((k) => k === v || Array.isArray(k) && k[0] === v), b = g("source"), N = g("target"), E = /* @__PURE__ */ new Set();
|
|
4705
4724
|
h = [];
|
|
4706
4725
|
for (const v of p) {
|
|
4707
|
-
const k = (
|
|
4708
|
-
if (!
|
|
4709
|
-
const L = ne ?
|
|
4710
|
-
return String(ye) === String(i) && String(L) === String(v.id) ?
|
|
4726
|
+
const k = (A, ne) => {
|
|
4727
|
+
if (!A?.id) return;
|
|
4728
|
+
const L = ne ? A.source?.id : A.target?.id, ye = ne ? A.target?.id : A.source?.id;
|
|
4729
|
+
return String(ye) === String(i) && String(L) === String(v.id) ? A : void 0;
|
|
4711
4730
|
}, q = k(v[`${c}:source`]?.[R], !0) ?? k(v[`${c}:target`]?.[R], !1);
|
|
4712
4731
|
if (!q) continue;
|
|
4713
4732
|
const F = `${v.id}::${q.id}`;
|
|
4714
4733
|
if (E.has(F)) continue;
|
|
4715
4734
|
E.add(F);
|
|
4716
4735
|
const Y = { ...q };
|
|
4717
|
-
|
|
4736
|
+
b || delete Y.source, N || delete Y.target;
|
|
4718
4737
|
const M = {
|
|
4719
4738
|
...v,
|
|
4720
4739
|
[R]: Y
|
|
@@ -4722,13 +4741,13 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4722
4741
|
delete M[`${c}:source`], delete M[`${c}:target`], h.push(M);
|
|
4723
4742
|
}
|
|
4724
4743
|
}
|
|
4725
|
-
const
|
|
4726
|
-
if (
|
|
4727
|
-
for (let y of
|
|
4728
|
-
for (let
|
|
4729
|
-
const g =
|
|
4744
|
+
const m = d.label && d.label !== n.label ? n.spawn(d.label) : n, f = r.attributeQuery.parentLinkRecordQuery;
|
|
4745
|
+
if (f)
|
|
4746
|
+
for (let y of f.attributeQuery.xToManyRecords)
|
|
4747
|
+
for (let w of h) {
|
|
4748
|
+
const g = w[R].id, b = d.label ? m.concat(w) : m;
|
|
4730
4749
|
gt(
|
|
4731
|
-
|
|
4750
|
+
w,
|
|
4732
4751
|
[R, y.attributeName],
|
|
4733
4752
|
await this.findXToManyRelatedRecords(
|
|
4734
4753
|
y.parentRecord,
|
|
@@ -4736,7 +4755,7 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4736
4755
|
g,
|
|
4737
4756
|
y,
|
|
4738
4757
|
a,
|
|
4739
|
-
|
|
4758
|
+
b
|
|
4740
4759
|
)
|
|
4741
4760
|
);
|
|
4742
4761
|
}
|
|
@@ -4751,23 +4770,23 @@ FOR UPDATE OF "${e.recordName}"` : u,
|
|
|
4751
4770
|
value: ["=", i]
|
|
4752
4771
|
}), u = K.getAttributeQueryDataForRecord(e, this.map, !0, !0, !1, !0), l = t;
|
|
4753
4772
|
let d = u;
|
|
4754
|
-
for (let
|
|
4755
|
-
d.push([
|
|
4773
|
+
for (let f of o)
|
|
4774
|
+
d.push([f, { attributeQuery: ["*"] }]), d = d.at(-1)[1].attributeQuery;
|
|
4756
4775
|
d.push([n, { label: l, attributeQuery: ["*"] }]), d = d.at(-1)[1].attributeQuery;
|
|
4757
|
-
for (let
|
|
4758
|
-
d.push([
|
|
4776
|
+
for (let f of o)
|
|
4777
|
+
d.push([f, { attributeQuery: ["*"] }]), d = d.at(-1)[1].attributeQuery;
|
|
4759
4778
|
let p;
|
|
4760
|
-
const h = async (
|
|
4779
|
+
const h = async (f) => {
|
|
4761
4780
|
if (p) return !0;
|
|
4762
|
-
if (
|
|
4763
|
-
return p = [...
|
|
4781
|
+
if (f.stack.at(-1)?.id === r)
|
|
4782
|
+
return p = [...f.stack], !0;
|
|
4764
4783
|
};
|
|
4765
4784
|
d.push([n, { goto: l, exit: h }]);
|
|
4766
|
-
const
|
|
4785
|
+
const m = (await this.findRecords(G.create(e, this.map, {
|
|
4767
4786
|
matchExpression: c,
|
|
4768
4787
|
attributeQuery: u
|
|
4769
4788
|
}), `find records for path ${e}.${t}`))[0];
|
|
4770
|
-
return p ? [
|
|
4789
|
+
return p ? [m, ...p] : void 0;
|
|
4771
4790
|
}
|
|
4772
4791
|
}
|
|
4773
4792
|
class Ga {
|
|
@@ -4837,15 +4856,15 @@ class Ga {
|
|
|
4837
4856
|
}
|
|
4838
4857
|
), d = await this.agent.findRecords(l, `find record with same row data for delete ${e}`);
|
|
4839
4858
|
if (o.notRelianceCombined.some((h) => !!d[0]?.[h.attributeName]?.id)) {
|
|
4840
|
-
const h = o.combinedRecords.filter((y) => !(o.isRelation && (y.attributeName === "source" || y.attributeName === "target"))).flatMap((y) => y.getLinkInfo().recordInfo.sameRowFields), [
|
|
4859
|
+
const h = o.combinedRecords.filter((y) => !(o.isRelation && (y.attributeName === "source" || y.attributeName === "target"))).flatMap((y) => y.getLinkInfo().recordInfo.sameRowFields), [m, f] = this.sqlBuilder.buildUpdateFieldsToNullSQL(
|
|
4841
4860
|
o.name,
|
|
4842
4861
|
[.../* @__PURE__ */ new Set([...o.sameRowFields, ...h])],
|
|
4843
4862
|
u
|
|
4844
4863
|
);
|
|
4845
|
-
await this.database.update(
|
|
4864
|
+
await this.database.update(m, f, o.idField, `use update to delete ${e} because of sameRowData`);
|
|
4846
4865
|
} else {
|
|
4847
|
-
const [h,
|
|
4848
|
-
await this.database.delete(h,
|
|
4866
|
+
const [h, m] = this.sqlBuilder.buildDeleteSQL(o.name, o.idField, u.id);
|
|
4867
|
+
await this.database.delete(h, m, `delete record ${o.name} as row`);
|
|
4849
4868
|
}
|
|
4850
4869
|
}
|
|
4851
4870
|
for (let l of o.sameTableReliance)
|
|
@@ -4971,11 +4990,11 @@ class Wa {
|
|
|
4971
4990
|
attributeQuery: c
|
|
4972
4991
|
}), l = await this.agent.findRecords(u, `find record for updating ${e}`), d = Object.keys(i.getData()), p = [];
|
|
4973
4992
|
for (let h of l) {
|
|
4974
|
-
const
|
|
4993
|
+
const m = Array.from(/* @__PURE__ */ new Set([
|
|
4975
4994
|
...d,
|
|
4976
4995
|
...i.getSameRowFieldAndValue(h).map((N) => N.name)
|
|
4977
|
-
])),
|
|
4978
|
-
await this.filteredEntityManager.settleMembershipChecks(
|
|
4996
|
+
])), f = await this.filteredEntityManager.collectMembershipChecks(u.recordName, [h.id], m, r), y = r ? await this.collectUpdateLinkChecks(i, r) : [], w = await this.agent.createRecordDependency(i, r), g = await this.updateSameRowData(u.recordName, h, w, r), b = await this.handleUpdateReliance(u.recordName, h, i, r);
|
|
4997
|
+
await this.filteredEntityManager.settleMembershipChecks(f.concat(y), r), p.push({ ...i.getData(), ...g.getData(), ...b });
|
|
4979
4998
|
}
|
|
4980
4999
|
return p;
|
|
4981
5000
|
}
|
|
@@ -5127,69 +5146,74 @@ class Ja {
|
|
|
5127
5146
|
* 事件流只反映关系层面的事实:旧 link delete + 新 link create(见下方 events?.push)。
|
|
5128
5147
|
*/
|
|
5129
5148
|
async flashOutCombinedRecordsAndMergedLinks(e, t, i = "", r) {
|
|
5130
|
-
const a = {}, n = r?.size ? e.combinedRecordIdRefs.filter((
|
|
5149
|
+
const a = {}, n = r?.size ? e.combinedRecordIdRefs.filter((h) => !r.has(h.info.attributeName)) : e.combinedRecordIdRefs;
|
|
5131
5150
|
if (!n.length) return a;
|
|
5132
5151
|
let o;
|
|
5133
5152
|
const c = K.getAttributeQueryDataForRecord(e.recordName, this.map, !0, !0, !1, !0);
|
|
5134
|
-
for (let
|
|
5135
|
-
const
|
|
5136
|
-
key: `${
|
|
5137
|
-
value: ["=",
|
|
5153
|
+
for (let h of n) {
|
|
5154
|
+
const m = {
|
|
5155
|
+
key: `${h.info.attributeName}.id`,
|
|
5156
|
+
value: ["=", h.getRef().id]
|
|
5138
5157
|
};
|
|
5139
|
-
o ? o = o.or(
|
|
5158
|
+
o ? o = o.or(m) : o = S.atom(m);
|
|
5140
5159
|
}
|
|
5141
5160
|
const u = G.create(e.recordName, this.map, {
|
|
5142
5161
|
matchExpression: o,
|
|
5143
5162
|
attributeQuery: c
|
|
5144
|
-
}, void 0, void 0, void 0, !1, !0), l = await this.queryExecutor.findRecords(u, i, void 0), d = this.map.getRecordInfo(e.recordName).isRelation && !!this.map.data.links[e.recordName];
|
|
5145
|
-
for (let
|
|
5146
|
-
d &&
|
|
5163
|
+
}, void 0, void 0, void 0, !1, !0), l = await this.queryExecutor.findRecords(u, i, void 0), d = this.map.getRecordInfo(e.recordName).isRelation && !!this.map.data.links[e.recordName], p = [];
|
|
5164
|
+
for (let h of l) {
|
|
5165
|
+
d && h.id && t?.push({
|
|
5147
5166
|
type: "delete",
|
|
5148
5167
|
recordName: e.recordName,
|
|
5149
5168
|
record: {
|
|
5150
|
-
...Object.fromEntries(Object.entries(
|
|
5151
|
-
id:
|
|
5152
|
-
source: { id:
|
|
5153
|
-
target: { id:
|
|
5169
|
+
...Object.fromEntries(Object.entries(h).filter(([, m]) => m === null || typeof m != "object")),
|
|
5170
|
+
id: h.id,
|
|
5171
|
+
source: { id: h.source?.id },
|
|
5172
|
+
target: { id: h.target?.id }
|
|
5154
5173
|
}
|
|
5155
5174
|
});
|
|
5156
|
-
for (let
|
|
5157
|
-
if (
|
|
5158
|
-
if (
|
|
5175
|
+
for (let m of n)
|
|
5176
|
+
if (h[m.info?.attributeName]?.id === m.getRef().id) {
|
|
5177
|
+
if (h.id && !m.info.isLinkSourceRelation() && p.push(...await this.filteredEntityManager.collectMembershipChecks(
|
|
5178
|
+
e.recordName,
|
|
5179
|
+
[h.id],
|
|
5180
|
+
[m.info.attributeName],
|
|
5181
|
+
t
|
|
5182
|
+
)), await this.deleteRecordSameRowData(m.recordName, [{ id: h[m.info?.attributeName].id }]), h.id && t?.push({
|
|
5159
5183
|
type: "delete",
|
|
5160
|
-
recordName:
|
|
5161
|
-
record:
|
|
5162
|
-
}), T(!a[
|
|
5163
|
-
...
|
|
5184
|
+
recordName: m.info.linkName,
|
|
5185
|
+
record: h[m.info?.attributeName][R]
|
|
5186
|
+
}), T(!a[m.info?.attributeName], `should not have same combined record, conflict attribute: ${m.info?.attributeName}`), a[m.info?.attributeName] = {
|
|
5187
|
+
...h[m.info?.attributeName]
|
|
5164
5188
|
}, this.map.getRecordInfo(e.recordName).isRelation && this.map.data.links[e.recordName]) {
|
|
5165
|
-
const
|
|
5166
|
-
for (const
|
|
5167
|
-
if (
|
|
5168
|
-
const
|
|
5169
|
-
if (
|
|
5170
|
-
const
|
|
5189
|
+
const y = a[m.info?.attributeName], w = this.map.getRecordInfo(m.recordName);
|
|
5190
|
+
for (const g of w.mergedRecordAttributes) {
|
|
5191
|
+
if (g.linkName !== e.recordName) continue;
|
|
5192
|
+
const b = y[g.attributeName];
|
|
5193
|
+
if (b?.id === void 0) continue;
|
|
5194
|
+
const N = b[R], E = !this.map.getLinkInfoByName(e.recordName).isRelationSource(m.recordName, g.attributeName);
|
|
5171
5195
|
t?.push({
|
|
5172
5196
|
type: "delete",
|
|
5173
5197
|
recordName: e.recordName,
|
|
5174
5198
|
record: {
|
|
5175
|
-
...
|
|
5176
|
-
source:
|
|
5177
|
-
target:
|
|
5199
|
+
...N || {},
|
|
5200
|
+
source: E ? { id: y.id } : { id: b.id },
|
|
5201
|
+
target: E ? { id: b.id } : { id: y.id }
|
|
5178
5202
|
}
|
|
5179
|
-
}), delete
|
|
5203
|
+
}), delete y[g.attributeName];
|
|
5180
5204
|
}
|
|
5181
5205
|
}
|
|
5182
|
-
|
|
5183
|
-
...
|
|
5184
|
-
id: await this.database.getAutoId(
|
|
5206
|
+
m.info.isLinkSourceRelation() || (a[m.info?.attributeName][R] = {
|
|
5207
|
+
...m.linkRecordData?.getData() || {},
|
|
5208
|
+
id: await this.database.getAutoId(m.info.linkName)
|
|
5185
5209
|
}, t?.push({
|
|
5186
5210
|
type: "create",
|
|
5187
|
-
recordName:
|
|
5188
|
-
record: a[
|
|
5211
|
+
recordName: m.info.linkName,
|
|
5212
|
+
record: a[m.info?.attributeName][R]
|
|
5189
5213
|
}));
|
|
5190
5214
|
}
|
|
5191
5215
|
}
|
|
5192
|
-
return a;
|
|
5216
|
+
return await this.filteredEntityManager.settleMembershipChecks(p, t), a;
|
|
5193
5217
|
}
|
|
5194
5218
|
/**
|
|
5195
5219
|
* 重定位合并记录数据用于链接
|
|
@@ -5299,15 +5323,15 @@ function ur(s) {
|
|
|
5299
5323
|
}
|
|
5300
5324
|
function Xa(s, e) {
|
|
5301
5325
|
const t = new pi(s, e), i = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), n = [...s, ...e], o = /* @__PURE__ */ new Map();
|
|
5302
|
-
for (const
|
|
5303
|
-
const
|
|
5304
|
-
De(y) ? i.add(
|
|
5305
|
-
}
|
|
5306
|
-
const c = /* @__PURE__ */ new Map(), u = ur(s.filter((
|
|
5307
|
-
for (const
|
|
5308
|
-
dr(
|
|
5309
|
-
for (const
|
|
5310
|
-
dr(
|
|
5326
|
+
for (const m of n) {
|
|
5327
|
+
const f = H(m), { root: y } = Qr(m);
|
|
5328
|
+
De(y) ? i.add(f) : o.set(f, H(y));
|
|
5329
|
+
}
|
|
5330
|
+
const c = /* @__PURE__ */ new Map(), u = ur(s.filter((m) => m.inputEntities)), l = ur(e.filter((m) => m.inputRelations)), d = lr(s), p = lr(e);
|
|
5331
|
+
for (const m of u)
|
|
5332
|
+
dr(m, t, "entity", d, o, c, i, r, a);
|
|
5333
|
+
for (const m of l)
|
|
5334
|
+
dr(m, t, "relation", p, o, c, i, r, a);
|
|
5311
5335
|
return { ...t.getAll(), abstractNames: i, discriminatorHostNames: r, inputWritablePropertyNames: a };
|
|
5312
5336
|
}
|
|
5313
5337
|
function lr(s) {
|
|
@@ -5368,22 +5392,22 @@ function dr(s, e, t, i, r, a, n, o, c) {
|
|
|
5368
5392
|
...Ya(v, r, a)
|
|
5369
5393
|
})), h = /* @__PURE__ */ new Set();
|
|
5370
5394
|
p.forEach((v) => v.hostedTypes.forEach((k) => h.add(k)));
|
|
5371
|
-
let
|
|
5395
|
+
let m = p[0]?.memberCondition;
|
|
5372
5396
|
for (let v = 1; v < p.length; v++)
|
|
5373
|
-
|
|
5374
|
-
const
|
|
5375
|
-
...en(
|
|
5397
|
+
m = m.or(p[v].memberCondition);
|
|
5398
|
+
const f = u ? e.getEntityByName(l) : e.getRelationByName(l), y = [
|
|
5399
|
+
...en(f, i, e),
|
|
5376
5400
|
Za(r),
|
|
5377
5401
|
...s.properties
|
|
5378
|
-
],
|
|
5379
|
-
|
|
5402
|
+
], w = d.some((v) => ke(v)), [g, b] = tn(
|
|
5403
|
+
f,
|
|
5380
5404
|
y,
|
|
5381
|
-
|
|
5405
|
+
w ? m : void 0
|
|
5382
5406
|
);
|
|
5383
|
-
e.replace(g,
|
|
5384
|
-
let N =
|
|
5385
|
-
|
|
5386
|
-
memberCondition:
|
|
5407
|
+
e.replace(g, f);
|
|
5408
|
+
let N = b;
|
|
5409
|
+
b !== g && (N = e.add(b), ht(g) ? g.baseEntity = N : g.baseRelation = N, n.add(H(N))), a.set(l, {
|
|
5410
|
+
memberCondition: m,
|
|
5387
5411
|
hostedTypes: h,
|
|
5388
5412
|
physicalBaseName: H(N)
|
|
5389
5413
|
}), o.add(H(N));
|
|
@@ -5452,12 +5476,12 @@ function en(s, e, t) {
|
|
|
5452
5476
|
if (!l)
|
|
5453
5477
|
a.set(p, u);
|
|
5454
5478
|
else {
|
|
5455
|
-
const h = t.getEntityByName(p) || t.getRelationByName(p),
|
|
5456
|
-
if (h && !
|
|
5457
|
-
const
|
|
5479
|
+
const h = t.getEntityByName(p) || t.getRelationByName(p), m = h && !!De(h);
|
|
5480
|
+
if (h && !m) {
|
|
5481
|
+
const f = Object.fromEntries(
|
|
5458
5482
|
h.properties.filter((y) => y.name !== pe).map((y) => [y.name, y])
|
|
5459
5483
|
);
|
|
5460
|
-
a.set(p,
|
|
5484
|
+
a.set(p, f), Object.assign(n, f);
|
|
5461
5485
|
}
|
|
5462
5486
|
}
|
|
5463
5487
|
d.push(...e.get(p) || []);
|
|
@@ -5573,9 +5597,9 @@ class yi {
|
|
|
5573
5597
|
`'${pe}' is the discriminator column of merged record '${n}' and is managed by the framework — it is written once at creation based on the name the record is created as, and cannot be set or changed through create/update. To move a record between input views, change the data its membership conditions depend on instead.`
|
|
5574
5598
|
);
|
|
5575
5599
|
}
|
|
5576
|
-
const a = i && t[
|
|
5600
|
+
const a = i && t[Ie] !== void 0;
|
|
5577
5601
|
for (const [n, o] of Object.entries(t)) {
|
|
5578
|
-
if (n ===
|
|
5602
|
+
if (n === Ie || n === Pe || n === R) continue;
|
|
5579
5603
|
const [c] = this.map.getAttributeAndSymmetricDirection(n), u = r.attributes[c];
|
|
5580
5604
|
if (!u) {
|
|
5581
5605
|
if (a) continue;
|
|
@@ -5924,23 +5948,23 @@ class qe {
|
|
|
5924
5948
|
path: [t]
|
|
5925
5949
|
}];
|
|
5926
5950
|
for (let p = 0; p < i.length; p++) {
|
|
5927
|
-
const [h,
|
|
5951
|
+
const [h, m] = this.getAttributeAndSymmetricDirection(i[p]), f = [t, ...i.slice(0, p + 1)];
|
|
5928
5952
|
if (h === R) {
|
|
5929
|
-
const { linkTable: y, linkAlias:
|
|
5930
|
-
T(!u, `last attribute in path is a link, cannot read link of a link ${g.join(".")}`), a = y, n =
|
|
5953
|
+
const { linkTable: y, linkAlias: w, path: g } = d.pop();
|
|
5954
|
+
T(!u, `last attribute in path is a link, cannot read link of a link ${g.join(".")}`), a = y, n = w, r = this.data.records[l.linkName], u = !0, o = "", c = "", l = void 0;
|
|
5931
5955
|
} else {
|
|
5932
|
-
l = this.getInfoByPath(
|
|
5956
|
+
l = this.getInfoByPath(f);
|
|
5933
5957
|
const y = r.attributes[h];
|
|
5934
5958
|
T(l.isRecord, `${i.slice(0, p + 1).join(".")} is not a entity attribute`);
|
|
5935
|
-
const
|
|
5959
|
+
const w = this.data.records[y.recordName], g = `${n}_${h}${m ? `_${m.toUpperCase()}` : ""}`, b = this.aliasManager?.registerTablePath(g) || g;
|
|
5936
5960
|
if (l.isMergedWithParent() || l.isLinkMergedWithParent())
|
|
5937
5961
|
c = n;
|
|
5938
5962
|
else if (l.isLinkIsolated()) {
|
|
5939
5963
|
const N = `REL_${g}`;
|
|
5940
5964
|
c = this.aliasManager?.registerTablePath(N) || N;
|
|
5941
5965
|
} else
|
|
5942
|
-
c =
|
|
5943
|
-
l.isMergedWithParent() || (n =
|
|
5966
|
+
c = b;
|
|
5967
|
+
l.isMergedWithParent() || (n = b), a = l.table, r = w, o = l.getLinkInfo()?.table, u = !1;
|
|
5944
5968
|
}
|
|
5945
5969
|
d.push({
|
|
5946
5970
|
table: a,
|
|
@@ -5949,7 +5973,7 @@ class qe {
|
|
|
5949
5973
|
isLinkRecord: u,
|
|
5950
5974
|
linkTable: o,
|
|
5951
5975
|
linkAlias: c,
|
|
5952
|
-
path:
|
|
5976
|
+
path: f
|
|
5953
5977
|
});
|
|
5954
5978
|
}
|
|
5955
5979
|
return d;
|
|
@@ -5958,19 +5982,19 @@ class qe {
|
|
|
5958
5982
|
const r = this.getTableAndAliasStack(e), { table: a, alias: n, record: o, path: c, linkAlias: u, linkTable: l, isLinkRecord: d } = r.at(-1), p = !d && r.length > 1 ? this.getInfoByPath(c) : null;
|
|
5959
5983
|
if (!i && t === "id" && !d && e.length > 1 && (p?.isLinkMergedWithParent() || p?.isLinkIsolated()))
|
|
5960
5984
|
if (p?.isLinkMergedWithParent()) {
|
|
5961
|
-
const { alias:
|
|
5962
|
-
return [
|
|
5985
|
+
const { alias: m, table: f } = r.at(-2);
|
|
5986
|
+
return [m, p.linkField, f];
|
|
5963
5987
|
} else {
|
|
5964
|
-
const
|
|
5965
|
-
return [u,
|
|
5988
|
+
const m = p.getLinkInfo().record, f = p?.isLinkManyToManySymmetric() ? p?.symmetricDirection === "source" ? m?.attributes.target.field : m?.attributes.source.field : p.isRecordSource() ? m?.attributes.target.field : m?.attributes.source.field;
|
|
5989
|
+
return [u, f, l];
|
|
5966
5990
|
}
|
|
5967
5991
|
else {
|
|
5968
|
-
const [
|
|
5969
|
-
if (!
|
|
5992
|
+
const [m] = this.getAttributeAndSymmetricDirection(t), f = o.attributes[m];
|
|
5993
|
+
if (!f)
|
|
5970
5994
|
throw new Error(`attribute "${t}" not found on "${e.join(".")}"`);
|
|
5971
|
-
const y =
|
|
5995
|
+
const y = f.field;
|
|
5972
5996
|
if (!y)
|
|
5973
|
-
throw
|
|
5997
|
+
throw f.isRecord ? new Error(
|
|
5974
5998
|
`attribute "${t}" on "${e.join(".")}" is a relation, not a value field. Use a value path through the relation instead (e.g. "${t}.someField").`
|
|
5975
5999
|
) : new Error(`attribute "${t}" on "${e.join(".")}" has no physical field`);
|
|
5976
6000
|
return [n, y, a];
|
|
@@ -6062,8 +6086,8 @@ class qe {
|
|
|
6062
6086
|
if (d === "source" || d === "target") {
|
|
6063
6087
|
const p = this.getInfo(n, l);
|
|
6064
6088
|
if (p.isRecord) {
|
|
6065
|
-
const h = p.getLinkInfo().data,
|
|
6066
|
-
if (
|
|
6089
|
+
const h = p.getLinkInfo().data, m = p.isRecordSource() ? h.targetRecord : h.sourceRecord, f = d === "source" ? h.sourceRecord : h.targetRecord;
|
|
6090
|
+
if (m === f) {
|
|
6067
6091
|
o += 2;
|
|
6068
6092
|
continue;
|
|
6069
6093
|
}
|
|
@@ -6373,8 +6397,8 @@ class le {
|
|
|
6373
6397
|
}
|
|
6374
6398
|
];
|
|
6375
6399
|
}));
|
|
6376
|
-
t && T(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[
|
|
6377
|
-
name:
|
|
6400
|
+
t && T(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[Ie] = {
|
|
6401
|
+
name: Ie,
|
|
6378
6402
|
type: "id",
|
|
6379
6403
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
6380
6404
|
};
|
|
@@ -6646,11 +6670,11 @@ class le {
|
|
|
6646
6670
|
*/
|
|
6647
6671
|
validatePropertyNames() {
|
|
6648
6672
|
const e = (t, i) => {
|
|
6649
|
-
const r = new Set(i ? [
|
|
6673
|
+
const r = new Set(i ? [Ie, Pe, "source", "target"] : [Ie, Pe]), a = /* @__PURE__ */ new Set();
|
|
6650
6674
|
for (const n of t.properties || []) {
|
|
6651
6675
|
if (r.has(n.name))
|
|
6652
6676
|
throw new Error(
|
|
6653
|
-
`Property name '${n.name}' on ${i ? "relation" : "entity"} '${t.name}' is reserved: ` + (n.name ===
|
|
6677
|
+
`Property name '${n.name}' on ${i ? "relation" : "entity"} '${t.name}' is reserved: ` + (n.name === Ie || n.name === Pe ? `the framework manages the '${n.name}' column and would silently overwrite your declaration (including any defaultValue/computation on it). Use a different name, e.g. 'externalId'.` : "'source'/'target' are the relation's endpoint attributes. Use a different name for the relation property.")
|
|
6654
6678
|
);
|
|
6655
6679
|
if (a.has(n.name))
|
|
6656
6680
|
throw new Error(
|
|
@@ -6822,14 +6846,14 @@ class le {
|
|
|
6822
6846
|
const [a, ...n] = r.split(".");
|
|
6823
6847
|
let o = a;
|
|
6824
6848
|
for (let c = 0; c < n.length; c++) {
|
|
6825
|
-
const u = n[c], l = this.map.records[o].attributes[u], d = l.linkName, p = this.map.links[d], { relType: h, sourceRecord:
|
|
6849
|
+
const u = n[c], l = this.map.records[o].attributes[u], d = l.linkName, p = this.map.links[d], { relType: h, sourceRecord: m, targetRecord: f } = p;
|
|
6826
6850
|
T(
|
|
6827
|
-
h[0] === "1" && h[1] === "1" &&
|
|
6851
|
+
h[0] === "1" && h[1] === "1" && m !== f,
|
|
6828
6852
|
`only 1:1 can merge: ${a}.${n.slice(0, c + 1).join(".")}`
|
|
6829
6853
|
);
|
|
6830
|
-
const y =
|
|
6831
|
-
if (
|
|
6832
|
-
throw new Error(`conflict found when join ${d}, ${
|
|
6854
|
+
const y = m === o ? f : m, w = this.combineRecordTable(o, y, d);
|
|
6855
|
+
if (w)
|
|
6856
|
+
throw new Error(`conflict found when join ${d}, ${w.join(",")} already merged with ${o}`);
|
|
6833
6857
|
p.mergedTo = "combined", i.push(p), o = l.recordName, delete e[d], delete t[d];
|
|
6834
6858
|
}
|
|
6835
6859
|
}), Object.values(e).forEach((r) => {
|
|
@@ -7099,7 +7123,7 @@ ${Object.values(this.tables[e].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
7099
7123
|
});
|
|
7100
7124
|
}
|
|
7101
7125
|
}
|
|
7102
|
-
const We = "_System_", Z = "_Dictionary_",
|
|
7126
|
+
const We = "_System_", Z = "_Dictionary_", Ie = "id", Pe = "_rowId", fr = j.create({
|
|
7103
7127
|
name: We,
|
|
7104
7128
|
properties: [
|
|
7105
7129
|
x.create({
|
|
@@ -8072,10 +8096,10 @@ function _(s, e) {
|
|
|
8072
8096
|
if (!s)
|
|
8073
8097
|
throw new Error(e);
|
|
8074
8098
|
}
|
|
8075
|
-
function
|
|
8099
|
+
function Ao(s, e) {
|
|
8076
8100
|
return new Map(Array.from(s.entries()).map(([t, i]) => [t, e(t, i)]));
|
|
8077
8101
|
}
|
|
8078
|
-
function
|
|
8102
|
+
function Io(s, e) {
|
|
8079
8103
|
return Object.fromEntries(Object.entries(s).map(([t, i]) => [t, e(t, i)]));
|
|
8080
8104
|
}
|
|
8081
8105
|
async function Po(s, e) {
|
|
@@ -8113,15 +8137,15 @@ function Wr(s, e, t) {
|
|
|
8113
8137
|
const h = l.pop();
|
|
8114
8138
|
if (!(!h || d.has(h))) {
|
|
8115
8139
|
d.add(h), h.name && o.add(h.name);
|
|
8116
|
-
for (const
|
|
8140
|
+
for (const m of h.properties ?? []) c.add(m.name);
|
|
8117
8141
|
h.baseEntity && l.push(h.baseEntity), h.baseRelation && l.push(h.baseRelation);
|
|
8118
|
-
for (const
|
|
8142
|
+
for (const m of h.inputEntities ?? []) l.push(m);
|
|
8119
8143
|
}
|
|
8120
8144
|
}
|
|
8121
8145
|
const p = /* @__PURE__ */ new Set();
|
|
8122
8146
|
for (const h of s.relations) {
|
|
8123
|
-
const
|
|
8124
|
-
|
|
8147
|
+
const m = h.source?.name, f = h.target?.name;
|
|
8148
|
+
m && o.has(m) && h.sourceProperty && p.add(h.sourceProperty), f && o.has(f) && h.targetProperty && p.add(h.targetProperty);
|
|
8125
8149
|
}
|
|
8126
8150
|
for (const h of n)
|
|
8127
8151
|
c.has(h) || (p.has(h) && a(`trigger.keys ["${h}"] refers to a relation attribute. Relation replacement does not emit a host update event carrying this key, so the transfer would never fire. Declare the trigger on the relation record's create/delete events instead (e.g. { recordName: '<relationName>', type: 'create' }).`), a(`trigger.keys ["${h}"] does not match any declared property of "${r.recordName}", so the transfer would never fire. Declare the property or fix the key name.`));
|
|
@@ -8774,7 +8798,7 @@ class de extends Error {
|
|
|
8774
8798
|
super(`Retry transaction with SERIALIZABLE isolation: ${e}`), this.reason = e, this.name = "RequireSerializableRetry", Object.setPrototypeOf(this, new.target.prototype);
|
|
8775
8799
|
}
|
|
8776
8800
|
}
|
|
8777
|
-
class
|
|
8801
|
+
class An extends ae {
|
|
8778
8802
|
constructor(e = {}) {
|
|
8779
8803
|
super(
|
|
8780
8804
|
"Nested dispatch is not supported inside a dispatch transaction. Model the work as one EventSource, or dispatch again after the outer dispatch commits",
|
|
@@ -8811,7 +8835,7 @@ function we(s, e = /* @__PURE__ */ new Set()) {
|
|
|
8811
8835
|
const i = s;
|
|
8812
8836
|
return i.causedBy && t.push(...we(i.causedBy, e)), i.cause && t.push(...we(i.cause, e)), i.error && t.push(...we(i.error, e)), s instanceof ae && s.causedBy && t.push(...we(s.causedBy, e)), t;
|
|
8813
8837
|
}
|
|
8814
|
-
function
|
|
8838
|
+
function In(s) {
|
|
8815
8839
|
return we(s).some((e) => e instanceof de);
|
|
8816
8840
|
}
|
|
8817
8841
|
const Pn = /* @__PURE__ */ new Set(["40001", "40P01", "57P01", "ECONNRESET", "EPIPE", "SQLITE_BUSY"]);
|
|
@@ -8862,7 +8886,7 @@ async function Di(s, e, t = {}) {
|
|
|
8862
8886
|
try {
|
|
8863
8887
|
return await e(r, a);
|
|
8864
8888
|
} catch (o) {
|
|
8865
|
-
if (n = o,
|
|
8889
|
+
if (n = o, In(o)) {
|
|
8866
8890
|
if (r = "SERIALIZABLE", a < i) continue;
|
|
8867
8891
|
throw new xt(
|
|
8868
8892
|
s,
|
|
@@ -9939,7 +9963,7 @@ class Vt {
|
|
|
9939
9963
|
if (this.computationsHandles.set(c.id, p), this.isAsyncComputation(p)) {
|
|
9940
9964
|
const h = this.getAsyncTaskRecordKey(p);
|
|
9941
9965
|
if (p.dataContext.type === "property") {
|
|
9942
|
-
const
|
|
9966
|
+
const m = new j({
|
|
9943
9967
|
name: h,
|
|
9944
9968
|
properties: [
|
|
9945
9969
|
new x({
|
|
@@ -9959,17 +9983,17 @@ class Vt {
|
|
|
9959
9983
|
type: "string"
|
|
9960
9984
|
}, { uuid: `${h}_freshnessKey` })
|
|
9961
9985
|
]
|
|
9962
|
-
}, { uuid: h }),
|
|
9963
|
-
name: `${
|
|
9964
|
-
source:
|
|
9986
|
+
}, { uuid: h }), f = new X({
|
|
9987
|
+
name: `${m.name}_${p.dataContext.host.name}_${p.dataContext.id.name}`,
|
|
9988
|
+
source: m,
|
|
9965
9989
|
target: p.dataContext.host,
|
|
9966
9990
|
sourceProperty: "record",
|
|
9967
9991
|
targetProperty: `_${p.dataContext.id.name}_task`,
|
|
9968
9992
|
type: "1:1"
|
|
9969
9993
|
}, { uuid: `${h}_record_relation` });
|
|
9970
|
-
t.push(
|
|
9994
|
+
t.push(m), i.push(f);
|
|
9971
9995
|
} else if (p.dataContext.type === "global") {
|
|
9972
|
-
const
|
|
9996
|
+
const m = new j({
|
|
9973
9997
|
name: h,
|
|
9974
9998
|
properties: [
|
|
9975
9999
|
new x({
|
|
@@ -9994,10 +10018,10 @@ class Vt {
|
|
|
9994
10018
|
}, { uuid: `${h}_globalKey` })
|
|
9995
10019
|
]
|
|
9996
10020
|
}, { uuid: h });
|
|
9997
|
-
t.push(
|
|
10021
|
+
t.push(m);
|
|
9998
10022
|
} else if (p.dataContext.type === "entity") {
|
|
9999
10023
|
p.dataContext;
|
|
10000
|
-
const
|
|
10024
|
+
const m = new j({
|
|
10001
10025
|
name: h,
|
|
10002
10026
|
properties: [
|
|
10003
10027
|
new x({
|
|
@@ -10022,10 +10046,10 @@ class Vt {
|
|
|
10022
10046
|
}, { uuid: `${h}_entityName` })
|
|
10023
10047
|
]
|
|
10024
10048
|
}, { uuid: h });
|
|
10025
|
-
t.push(
|
|
10049
|
+
t.push(m);
|
|
10026
10050
|
} else if (p.dataContext.type === "relation") {
|
|
10027
10051
|
p.dataContext;
|
|
10028
|
-
const
|
|
10052
|
+
const m = new j({
|
|
10029
10053
|
name: h,
|
|
10030
10054
|
properties: [
|
|
10031
10055
|
new x({
|
|
@@ -10050,7 +10074,7 @@ class Vt {
|
|
|
10050
10074
|
}, { uuid: `${h}_relationName` })
|
|
10051
10075
|
]
|
|
10052
10076
|
}, { uuid: h });
|
|
10053
|
-
t.push(
|
|
10077
|
+
t.push(m);
|
|
10054
10078
|
}
|
|
10055
10079
|
}
|
|
10056
10080
|
}
|
|
@@ -10935,13 +10959,13 @@ function Sr(s) {
|
|
|
10935
10959
|
const e = Fi.getStore();
|
|
10936
10960
|
e?.effects && e.effects.push(...s);
|
|
10937
10961
|
}
|
|
10938
|
-
const cs = new Dr(), Li = "_MigrationManifest_", Vi = "current",
|
|
10962
|
+
const cs = new Dr(), Li = "_MigrationManifest_", Vi = "current", At = "3", Yt = "_isDeleted_";
|
|
10939
10963
|
class C extends Error {
|
|
10940
10964
|
constructor(e, t) {
|
|
10941
10965
|
super(e), this.details = t, this.name = new.target.name;
|
|
10942
10966
|
}
|
|
10943
10967
|
}
|
|
10944
|
-
class
|
|
10968
|
+
class It extends C {
|
|
10945
10969
|
}
|
|
10946
10970
|
class Bo extends C {
|
|
10947
10971
|
}
|
|
@@ -11161,7 +11185,7 @@ function ws(s) {
|
|
|
11161
11185
|
return Ne($i(s));
|
|
11162
11186
|
}
|
|
11163
11187
|
function Ns(s, e = !1) {
|
|
11164
|
-
const t = s.args, i = ms(s), r = fs(s), a = ys(s), n = a.map((E) => E.key), o = mt(s), c = O(s.dataContext), u = s.dataContext.type === "entity" || s.dataContext.type === "relation" ? s.dataContext.id.name : void 0, l = ca(s), d = xe("computation", o, s.args.uuid), p = gs(t, e), h = ws(t), { allocation:
|
|
11188
|
+
const t = s.args, i = ms(s), r = fs(s), a = ys(s), n = a.map((E) => E.key), o = mt(s), c = O(s.dataContext), u = s.dataContext.type === "entity" || s.dataContext.type === "relation" ? s.dataContext.id.name : void 0, l = ca(s), d = xe("computation", o, s.args.uuid), p = gs(t, e), h = ws(t), { allocation: m, scopeSignature: f, allocationSignature: y } = sa(t), w = Ne({
|
|
11165
11189
|
type: l,
|
|
11166
11190
|
dataContext: c,
|
|
11167
11191
|
dataDeps: i,
|
|
@@ -11170,7 +11194,7 @@ function Ns(s, e = !1) {
|
|
|
11170
11194
|
hasCompute: typeof s.compute == "function",
|
|
11171
11195
|
hasIncrementalCompute: typeof s.incrementalCompute == "function",
|
|
11172
11196
|
hasIncrementalPatchCompute: typeof s.incrementalPatchCompute == "function"
|
|
11173
|
-
}), g = Ne({ stateKeys: n, boundStates: a }),
|
|
11197
|
+
}), g = Ne({ stateKeys: n, boundStates: a }), b = Ne({
|
|
11174
11198
|
type: l,
|
|
11175
11199
|
dataContext: c,
|
|
11176
11200
|
outputRecord: u,
|
|
@@ -11186,7 +11210,7 @@ function Ns(s, e = !1) {
|
|
|
11186
11210
|
hasCompute: typeof s.compute == "function",
|
|
11187
11211
|
hasIncrementalCompute: typeof s.incrementalCompute == "function",
|
|
11188
11212
|
hasIncrementalPatchCompute: typeof s.incrementalPatchCompute == "function"
|
|
11189
|
-
}), N = Ne({ structuralSignature:
|
|
11213
|
+
}), N = Ne({ structuralSignature: b, stateSignature: g, functionHash: p?.hash, allocationSignature: y });
|
|
11190
11214
|
return {
|
|
11191
11215
|
id: o,
|
|
11192
11216
|
identity: d,
|
|
@@ -11207,14 +11231,14 @@ function Ns(s, e = !1) {
|
|
|
11207
11231
|
dataContext: c,
|
|
11208
11232
|
outputRecord: u
|
|
11209
11233
|
} : void 0,
|
|
11210
|
-
outputSignature:
|
|
11234
|
+
outputSignature: w,
|
|
11211
11235
|
stateSignature: g,
|
|
11212
|
-
structuralSignature:
|
|
11236
|
+
structuralSignature: b,
|
|
11213
11237
|
argsSignature: h,
|
|
11214
11238
|
functionSignature: p,
|
|
11215
|
-
allocation:
|
|
11239
|
+
allocation: m,
|
|
11216
11240
|
allocationSignature: y,
|
|
11217
|
-
scopeSignature:
|
|
11241
|
+
scopeSignature: f,
|
|
11218
11242
|
signature: N
|
|
11219
11243
|
};
|
|
11220
11244
|
}
|
|
@@ -11297,7 +11321,7 @@ function vt(s, e = s.system.storage.schema, t = {}) {
|
|
|
11297
11321
|
})), u = vi({ records: i, relations: r, dictionaries: a, computations: c, sequences: o, storage: e });
|
|
11298
11322
|
return {
|
|
11299
11323
|
version: 2,
|
|
11300
|
-
frameworkVersion:
|
|
11324
|
+
frameworkVersion: At,
|
|
11301
11325
|
modelHash: Ne(u),
|
|
11302
11326
|
records: i,
|
|
11303
11327
|
relations: r,
|
|
@@ -11315,10 +11339,10 @@ function Qo(s, e) {
|
|
|
11315
11339
|
});
|
|
11316
11340
|
}
|
|
11317
11341
|
function Er(s) {
|
|
11318
|
-
if (s.frameworkVersion !==
|
|
11319
|
-
throw new
|
|
11320
|
-
`Migration manifest was written by an incompatible interaqt manifest generator (found '${s.frameworkVersion}', expected '${
|
|
11321
|
-
{ foundGeneratorVersion: s.frameworkVersion, expectedGeneratorVersion:
|
|
11342
|
+
if (s.frameworkVersion !== At)
|
|
11343
|
+
throw new It(
|
|
11344
|
+
`Migration manifest was written by an incompatible interaqt manifest generator (found '${s.frameworkVersion}', expected '${At}'). Verify that the current definitions match the existing schema, then re-baseline with controller.createMigrationBaseline().`,
|
|
11345
|
+
{ foundGeneratorVersion: s.frameworkVersion, expectedGeneratorVersion: At }
|
|
11322
11346
|
);
|
|
11323
11347
|
}
|
|
11324
11348
|
function re(s) {
|
|
@@ -11558,19 +11582,19 @@ async function xs(s, e, t, i, r) {
|
|
|
11558
11582
|
}), n.set(re(d), d), u !== "property") {
|
|
11559
11583
|
const p = c.outputRecord || c.dataContext.split(":")[1], h = `${c.dataContext}:${p}`;
|
|
11560
11584
|
if (!o.has(h)) {
|
|
11561
|
-
const
|
|
11585
|
+
const m = {
|
|
11562
11586
|
dataContext: c.dataContext,
|
|
11563
11587
|
recordName: p,
|
|
11564
11588
|
ids: l.ids || [],
|
|
11565
11589
|
count: l.expectedExistingCount,
|
|
11566
11590
|
reason: "fact output records will be discarded during computation takeover"
|
|
11567
11591
|
};
|
|
11568
|
-
o.set(h,
|
|
11592
|
+
o.set(h, m), n.set(re({ kind: "destructive-scope", ...m }), {
|
|
11569
11593
|
kind: "destructive-scope",
|
|
11570
|
-
dataContext:
|
|
11571
|
-
recordName:
|
|
11572
|
-
ids:
|
|
11573
|
-
reason:
|
|
11594
|
+
dataContext: m.dataContext,
|
|
11595
|
+
recordName: m.recordName,
|
|
11596
|
+
ids: m.ids,
|
|
11597
|
+
reason: m.reason
|
|
11574
11598
|
});
|
|
11575
11599
|
}
|
|
11576
11600
|
}
|
|
@@ -11591,183 +11615,183 @@ async function xs(s, e, t, i, r) {
|
|
|
11591
11615
|
}))
|
|
11592
11616
|
}, e;
|
|
11593
11617
|
}
|
|
11594
|
-
function
|
|
11595
|
-
const r = [], a = [], n = new Map(s.computations.map((
|
|
11596
|
-
for (const
|
|
11597
|
-
u.has(
|
|
11618
|
+
function As(s, e, t, i) {
|
|
11619
|
+
const r = [], a = [], n = new Map(s.computations.map((f) => [f.id, f])), o = new Map(e.computations.map((f) => [f.id, f])), c = new Map(s.records.map((f) => [f.id, f])), u = new Map(e.records.map((f) => [f.id, f])), l = new Map(s.relations.map((f) => [f.id, f])), d = new Map(e.relations.map((f) => [f.id, f])), p = new Map((s.dictionaries || []).map((f) => [f.id, f])), h = new Map((e.dictionaries || []).map((f) => [f.id, f]));
|
|
11620
|
+
for (const f of s.records)
|
|
11621
|
+
u.has(f.id) || r.push({
|
|
11598
11622
|
kind: "record",
|
|
11599
|
-
id:
|
|
11623
|
+
id: f.id,
|
|
11600
11624
|
changeType: "removed",
|
|
11601
|
-
dataContext: `${
|
|
11602
|
-
reason: `${
|
|
11625
|
+
dataContext: `${f.kind}:${f.name}`,
|
|
11626
|
+
reason: `${f.kind} no longer exists in the new model`
|
|
11603
11627
|
});
|
|
11604
|
-
for (const
|
|
11605
|
-
const y = c.get(
|
|
11606
|
-
y ? (y.kind !==
|
|
11628
|
+
for (const f of e.records) {
|
|
11629
|
+
const y = c.get(f.id);
|
|
11630
|
+
y ? (y.kind !== f.kind || y.name !== f.name) && r.push({
|
|
11607
11631
|
kind: "record",
|
|
11608
|
-
id:
|
|
11632
|
+
id: f.id,
|
|
11609
11633
|
changeType: "changed",
|
|
11610
|
-
dataContext: `${
|
|
11634
|
+
dataContext: `${f.kind}:${f.name}`,
|
|
11611
11635
|
reason: "record kind or name changed"
|
|
11612
11636
|
}) : r.push({
|
|
11613
11637
|
kind: "record",
|
|
11614
|
-
id:
|
|
11638
|
+
id: f.id,
|
|
11615
11639
|
changeType: "added",
|
|
11616
|
-
dataContext: `${
|
|
11617
|
-
reason: `${
|
|
11640
|
+
dataContext: `${f.kind}:${f.name}`,
|
|
11641
|
+
reason: `${f.kind} was added`
|
|
11618
11642
|
});
|
|
11619
|
-
const
|
|
11620
|
-
for (const
|
|
11621
|
-
g.has(
|
|
11643
|
+
const w = new Map((y?.properties || []).map((b) => [b.id, b])), g = new Map(f.properties.map((b) => [b.id, b]));
|
|
11644
|
+
for (const b of y?.properties || [])
|
|
11645
|
+
g.has(b.id) || r.push({
|
|
11622
11646
|
kind: "property",
|
|
11623
|
-
id:
|
|
11647
|
+
id: b.id,
|
|
11624
11648
|
changeType: "removed",
|
|
11625
|
-
dataContext: `property:${y?.name}.${
|
|
11649
|
+
dataContext: `property:${y?.name}.${b.name}`,
|
|
11626
11650
|
reason: "property no longer exists in the new model"
|
|
11627
11651
|
});
|
|
11628
|
-
for (const
|
|
11629
|
-
const N =
|
|
11630
|
-
N ? (N.name !==
|
|
11652
|
+
for (const b of f.properties) {
|
|
11653
|
+
const N = w.get(b.id);
|
|
11654
|
+
N ? (N.name !== b.name || N.type !== b.type || N.collection !== b.collection || N.computed !== b.computed) && r.push({
|
|
11631
11655
|
kind: "property",
|
|
11632
|
-
id:
|
|
11656
|
+
id: b.id,
|
|
11633
11657
|
changeType: "changed",
|
|
11634
|
-
dataContext: `property:${
|
|
11658
|
+
dataContext: `property:${f.name}.${b.name}`,
|
|
11635
11659
|
reason: "property name, type, collection, or computed flag changed"
|
|
11636
11660
|
}) : r.push({
|
|
11637
11661
|
kind: "property",
|
|
11638
|
-
id:
|
|
11662
|
+
id: b.id,
|
|
11639
11663
|
changeType: "added",
|
|
11640
|
-
dataContext: `property:${
|
|
11664
|
+
dataContext: `property:${f.name}.${b.name}`,
|
|
11641
11665
|
reason: "property was added"
|
|
11642
11666
|
});
|
|
11643
11667
|
}
|
|
11644
11668
|
}
|
|
11645
|
-
for (const
|
|
11646
|
-
d.has(
|
|
11669
|
+
for (const f of s.relations)
|
|
11670
|
+
d.has(f.id) || r.push({
|
|
11647
11671
|
kind: "relation",
|
|
11648
|
-
id:
|
|
11672
|
+
id: f.id,
|
|
11649
11673
|
changeType: "removed",
|
|
11650
|
-
dataContext: `relation:${
|
|
11674
|
+
dataContext: `relation:${f.name}`,
|
|
11651
11675
|
reason: "relation no longer exists in the new model"
|
|
11652
11676
|
});
|
|
11653
|
-
for (const
|
|
11654
|
-
const y = l.get(
|
|
11655
|
-
y ? (y.name !==
|
|
11677
|
+
for (const f of e.relations) {
|
|
11678
|
+
const y = l.get(f.id);
|
|
11679
|
+
y ? (y.name !== f.name || y.source !== f.source || y.target !== f.target || y.sourceProperty !== f.sourceProperty || y.targetProperty !== f.targetProperty || y.type !== f.type) && r.push({
|
|
11656
11680
|
kind: "relation",
|
|
11657
|
-
id:
|
|
11681
|
+
id: f.id,
|
|
11658
11682
|
changeType: "changed",
|
|
11659
|
-
dataContext: `relation:${
|
|
11683
|
+
dataContext: `relation:${f.name}`,
|
|
11660
11684
|
reason: "relation endpoints, properties, or type changed"
|
|
11661
11685
|
}) : r.push({
|
|
11662
11686
|
kind: "relation",
|
|
11663
|
-
id:
|
|
11687
|
+
id: f.id,
|
|
11664
11688
|
changeType: "added",
|
|
11665
|
-
dataContext: `relation:${
|
|
11689
|
+
dataContext: `relation:${f.name}`,
|
|
11666
11690
|
reason: "relation was added"
|
|
11667
11691
|
});
|
|
11668
11692
|
}
|
|
11669
|
-
for (const
|
|
11670
|
-
h.has(
|
|
11693
|
+
for (const f of s.dictionaries || [])
|
|
11694
|
+
h.has(f.id) || r.push({
|
|
11671
11695
|
kind: "dictionary",
|
|
11672
|
-
id:
|
|
11696
|
+
id: f.id,
|
|
11673
11697
|
changeType: "removed",
|
|
11674
|
-
dataContext: `global:${
|
|
11698
|
+
dataContext: `global:${f.name}`,
|
|
11675
11699
|
reason: "dictionary no longer exists in the new model"
|
|
11676
11700
|
});
|
|
11677
|
-
for (const
|
|
11678
|
-
const y = p.get(
|
|
11679
|
-
let
|
|
11680
|
-
y ? (y.type !==
|
|
11701
|
+
for (const f of e.dictionaries || []) {
|
|
11702
|
+
const y = p.get(f.id);
|
|
11703
|
+
let w = "unchanged", g = "dictionary is unchanged";
|
|
11704
|
+
y ? (y.type !== f.type || y.collection !== f.collection || y.computed !== f.computed) && (w = "changed", g = "dictionary type, collection, or computed flag changed") : (w = "added", g = "dictionary was added"), w !== "unchanged" && r.push({
|
|
11681
11705
|
kind: "dictionary",
|
|
11682
|
-
id:
|
|
11683
|
-
changeType:
|
|
11684
|
-
dataContext: `global:${
|
|
11706
|
+
id: f.id,
|
|
11707
|
+
changeType: w,
|
|
11708
|
+
dataContext: `global:${f.name}`,
|
|
11685
11709
|
reason: g
|
|
11686
11710
|
});
|
|
11687
11711
|
}
|
|
11688
|
-
for (const
|
|
11689
|
-
o.has(
|
|
11712
|
+
for (const f of s.computations)
|
|
11713
|
+
o.has(f.id) || r.push({
|
|
11690
11714
|
kind: "computation",
|
|
11691
|
-
id:
|
|
11692
|
-
dataContext:
|
|
11693
|
-
computationType:
|
|
11715
|
+
id: f.id,
|
|
11716
|
+
dataContext: f.dataContext,
|
|
11717
|
+
computationType: f.type,
|
|
11694
11718
|
changeType: "removed",
|
|
11695
11719
|
detected: {},
|
|
11696
11720
|
recommendation: "ignore",
|
|
11697
11721
|
reason: "computation no longer exists in the new model"
|
|
11698
11722
|
});
|
|
11699
|
-
for (const
|
|
11700
|
-
const y = n.get(
|
|
11701
|
-
dataDepsChanged: y ? !tt(y.deps,
|
|
11702
|
-
eventDepsChanged: y ? !tt(y.eventDeps,
|
|
11703
|
-
outputSignatureChanged: y ? y.outputSignature !==
|
|
11704
|
-
stateSignatureChanged: y ? y.stateSignature !==
|
|
11705
|
-
allocationSignatureChanged: y ? y.allocationSignature !==
|
|
11706
|
-
allocationSignature:
|
|
11723
|
+
for (const f of e.computations) {
|
|
11724
|
+
const y = n.get(f.id), w = {
|
|
11725
|
+
dataDepsChanged: y ? !tt(y.deps, f.deps) : !0,
|
|
11726
|
+
eventDepsChanged: y ? !tt(y.eventDeps, f.eventDeps) : !0,
|
|
11727
|
+
outputSignatureChanged: y ? y.outputSignature !== f.outputSignature : !0,
|
|
11728
|
+
stateSignatureChanged: y ? y.stateSignature !== f.stateSignature : !0,
|
|
11729
|
+
allocationSignatureChanged: y ? y.allocationSignature !== f.allocationSignature : f.allocationSignature !== void 0,
|
|
11730
|
+
allocationSignature: f.allocationSignature,
|
|
11707
11731
|
previousAllocationSignature: y?.allocationSignature,
|
|
11708
|
-
functionTextChanged: y ? y.functionSignature?.hash !==
|
|
11709
|
-
functionHash:
|
|
11732
|
+
functionTextChanged: y ? y.functionSignature?.hash !== f.functionSignature?.hash : f.functionSignature?.hasFunction === !0,
|
|
11733
|
+
functionHash: f.functionSignature?.hash,
|
|
11710
11734
|
previousFunctionHash: y?.functionSignature?.hash,
|
|
11711
|
-
hasFunction:
|
|
11712
|
-
hasClosureRisk:
|
|
11713
|
-
needsEventRebuildHandler:
|
|
11714
|
-
needsAsyncCompletionHandler:
|
|
11735
|
+
hasFunction: f.functionSignature?.hasFunction === !0,
|
|
11736
|
+
hasClosureRisk: f.functionSignature?.hasFunction === !0,
|
|
11737
|
+
needsEventRebuildHandler: f.eventDeps.length > 0,
|
|
11738
|
+
needsAsyncCompletionHandler: f.asyncReturn
|
|
11715
11739
|
};
|
|
11716
|
-
let g = "unchanged",
|
|
11717
|
-
if (y ? y.allocationSignature !==
|
|
11740
|
+
let g = "unchanged", b = "ignore", N = "unchanged", E = "computation is structurally unchanged";
|
|
11741
|
+
if (y ? y.allocationSignature !== f.allocationSignature ? (g = "changed", b = "needs-review", N = "unrebuildable", E = "scoped allocation args changed") : y.structuralSignature !== f.structuralSignature ? (g = "changed", b = "needs-review", N = "changed", E = "computation structure changed") : y.stateSignature !== f.stateSignature && y.outputSignature === f.outputSignature ? (g = "state-only", b = "needs-review", N = "state-only", E = "computation state changed without output structure changes") : y.functionSignature?.hash !== f.functionSignature?.hash ? (g = "possibly-changed", b = "needs-review", N = "changed", E = "function text changed and requires human semantic review") : f.functionSignature?.hasFunction && (b = "needs-review", E = "function callback has closure risk and requires human review") : (g = "added", b = f.allocation?.kind === "scoped-sequence" ? "needs-review" : "rebuild", N = f.allocation?.kind === "scoped-sequence" ? "unrebuildable" : "changed", E = f.allocation?.kind === "scoped-sequence" ? "new scoped allocation computation requires approved sequence initialization" : "new computation requires approved rebuild"), r.push({
|
|
11718
11742
|
kind: "computation",
|
|
11719
|
-
id:
|
|
11720
|
-
dataContext:
|
|
11721
|
-
computationType:
|
|
11743
|
+
id: f.id,
|
|
11744
|
+
dataContext: f.dataContext,
|
|
11745
|
+
computationType: f.type,
|
|
11722
11746
|
changeType: g,
|
|
11723
|
-
detected:
|
|
11724
|
-
recommendation:
|
|
11747
|
+
detected: w,
|
|
11748
|
+
recommendation: b,
|
|
11725
11749
|
reason: E
|
|
11726
|
-
}),
|
|
11750
|
+
}), b !== "ignore") {
|
|
11727
11751
|
a.push({
|
|
11728
11752
|
kind: "computation",
|
|
11729
|
-
id:
|
|
11730
|
-
dataContext:
|
|
11753
|
+
id: f.id,
|
|
11754
|
+
dataContext: f.dataContext,
|
|
11731
11755
|
recommendedDecision: N,
|
|
11732
11756
|
reason: E
|
|
11733
11757
|
});
|
|
11734
|
-
const v = ds(
|
|
11758
|
+
const v = ds(f);
|
|
11735
11759
|
v && a.push(v);
|
|
11736
11760
|
}
|
|
11737
11761
|
}
|
|
11738
|
-
for (const
|
|
11739
|
-
|
|
11762
|
+
for (const f of Ki(s, e))
|
|
11763
|
+
f.changeType === "predicate-changed" && r.push({
|
|
11740
11764
|
kind: "storage",
|
|
11741
|
-
id: `filtered-predicate:${
|
|
11765
|
+
id: `filtered-predicate:${f.recordName}`,
|
|
11742
11766
|
changeType: "changed",
|
|
11743
|
-
dataContext: `${
|
|
11744
|
-
reason: `filtered-predicate-changed: matchExpression of filtered ${
|
|
11767
|
+
dataContext: `${f.isRelation ? "relation" : "entity"}:${f.recordName}`,
|
|
11768
|
+
reason: `filtered-predicate-changed: matchExpression of filtered ${f.isRelation ? "relation" : "entity"} "${f.recordName}" changed from ${fe(f.oldRecord?.resolvedMatchExpression ?? null)} to ${fe(f.newRecord.resolvedMatchExpression ?? null)}; existing memberships will be re-evaluated and downstream computations rebuilt`
|
|
11745
11769
|
});
|
|
11746
|
-
for (const
|
|
11770
|
+
for (const f of t.preRecomputeDDL)
|
|
11747
11771
|
r.push({
|
|
11748
11772
|
kind: "storage",
|
|
11749
|
-
id:
|
|
11773
|
+
id: f.logicalPath || f.description,
|
|
11750
11774
|
changeType: "added",
|
|
11751
|
-
dataContext:
|
|
11752
|
-
reason:
|
|
11775
|
+
dataContext: f.logicalPath || f.tableName || f.description,
|
|
11776
|
+
reason: f.description
|
|
11753
11777
|
});
|
|
11754
|
-
for (const
|
|
11778
|
+
for (const f of i.blockingChanges)
|
|
11755
11779
|
r.push({
|
|
11756
11780
|
kind: "storage",
|
|
11757
|
-
id:
|
|
11781
|
+
id: f.logicalPath,
|
|
11758
11782
|
changeType: "blocked",
|
|
11759
|
-
dataContext:
|
|
11760
|
-
reason:
|
|
11783
|
+
dataContext: f.logicalPath,
|
|
11784
|
+
reason: f.reason
|
|
11761
11785
|
});
|
|
11762
|
-
for (const
|
|
11786
|
+
for (const f of i.destructiveScopes)
|
|
11763
11787
|
a.push({
|
|
11764
11788
|
kind: "destructive-scope",
|
|
11765
|
-
dataContext:
|
|
11766
|
-
recordName:
|
|
11767
|
-
ids:
|
|
11768
|
-
reason:
|
|
11789
|
+
dataContext: f.dataContext,
|
|
11790
|
+
recordName: f.recordName,
|
|
11791
|
+
ids: f.ids || [],
|
|
11792
|
+
reason: f.reason
|
|
11769
11793
|
});
|
|
11770
|
-
const
|
|
11794
|
+
const m = Array.from(new Map(a.map((f) => [re(f), f])).values());
|
|
11771
11795
|
return {
|
|
11772
11796
|
kind: "interaqt-migration-diff",
|
|
11773
11797
|
version: 2,
|
|
@@ -11778,16 +11802,16 @@ function Is(s, e, t, i) {
|
|
|
11778
11802
|
generatorVersion: "phase-1.5",
|
|
11779
11803
|
summary: {
|
|
11780
11804
|
changeCount: r.length,
|
|
11781
|
-
requiredDecisionCount:
|
|
11805
|
+
requiredDecisionCount: m.length,
|
|
11782
11806
|
blockingChangeCount: i.blockingChanges.length
|
|
11783
11807
|
},
|
|
11784
11808
|
changes: r,
|
|
11785
|
-
requiredDecisions:
|
|
11809
|
+
requiredDecisions: m,
|
|
11786
11810
|
decisions: [],
|
|
11787
11811
|
safety: i
|
|
11788
11812
|
};
|
|
11789
11813
|
}
|
|
11790
|
-
function
|
|
11814
|
+
function Is(s, e, t) {
|
|
11791
11815
|
const i = ji(e), r = new Map(s.requiredDecisions.map((a) => [re(a), a]));
|
|
11792
11816
|
for (const a of t) {
|
|
11793
11817
|
if (!a.rebuildOutput) continue;
|
|
@@ -11851,11 +11875,11 @@ function Ps(s, e, t, i, r) {
|
|
|
11851
11875
|
throw new C(`Migration computation takeover target type does not match data context: ${d.dataContext}`);
|
|
11852
11876
|
if (!pa(e, t, h))
|
|
11853
11877
|
throw new C(`Migration computation takeover can only discard previous fact output: ${d.dataContext}`);
|
|
11854
|
-
const
|
|
11878
|
+
const m = h.allocation?.kind === "scoped-sequence" && s.decisions.find(
|
|
11855
11879
|
(y) => (y.kind === "scoped-sequence-seed" || y.kind === "scoped-sequence-no-seed") && y.id === d.computationId && y.dataContext === d.dataContext
|
|
11856
11880
|
);
|
|
11857
11881
|
if (!s.decisions.find(
|
|
11858
|
-
(y) => y.kind === "computation" && y.id === d.computationId && (y.decision === "changed" ||
|
|
11882
|
+
(y) => y.kind === "computation" && y.id === d.computationId && (y.decision === "changed" || m && y.decision === "unrebuildable")
|
|
11859
11883
|
))
|
|
11860
11884
|
throw new C(`Migration computation takeover requires an approved changed computation decision: ${d.computationId}`);
|
|
11861
11885
|
if (d.targetType !== "property") {
|
|
@@ -11871,25 +11895,25 @@ function Ps(s, e, t, i, r) {
|
|
|
11871
11895
|
if (d.kind === "scoped-sequence-seed") {
|
|
11872
11896
|
if (!o.has(p))
|
|
11873
11897
|
throw new C(`Migration scoped sequence seed decision does not match a required review item: ${d.dataContext}`);
|
|
11874
|
-
const h = t.computations.find((
|
|
11898
|
+
const h = t.computations.find((f) => f.id === d.id);
|
|
11875
11899
|
if (!h || h.dataContext !== d.dataContext || h.allocation?.kind !== "scoped-sequence")
|
|
11876
11900
|
throw new C(`Migration scoped sequence seed references unknown scoped sequence computation: ${d.id}`);
|
|
11877
|
-
const
|
|
11878
|
-
(
|
|
11901
|
+
const m = a.requiredDecisions.find(
|
|
11902
|
+
(f) => f.kind === "scoped-sequence-seed" && f.id === d.id
|
|
11879
11903
|
);
|
|
11880
|
-
if (!
|
|
11904
|
+
if (!m || d.sequenceName !== m.sequenceName || d.hostRecord !== m.hostRecord || d.targetProperty !== m.targetProperty || d.scopeSignature !== m.scopeSignature || d.valuePath !== m.valuePath || d.aggregate !== m.aggregate || d.mode !== m.mode)
|
|
11881
11905
|
throw new C(`Migration scoped sequence seed decision does not match the generated seed operation: ${d.dataContext}`);
|
|
11882
11906
|
}
|
|
11883
11907
|
if (d.kind === "scoped-sequence-no-seed") {
|
|
11884
11908
|
if (!o.has(p))
|
|
11885
11909
|
throw new C(`Migration scoped sequence no-seed decision does not match a required review item: ${d.dataContext}`);
|
|
11886
|
-
const h = t.computations.find((
|
|
11910
|
+
const h = t.computations.find((f) => f.id === d.id);
|
|
11887
11911
|
if (!h || h.dataContext !== d.dataContext || h.allocation?.kind !== "scoped-sequence" || h.allocation.initializeFrom)
|
|
11888
11912
|
throw new C(`Migration scoped sequence no-seed references unknown scoped sequence computation: ${d.id}`);
|
|
11889
|
-
const
|
|
11890
|
-
(
|
|
11913
|
+
const m = a.requiredDecisions.find(
|
|
11914
|
+
(f) => f.kind === "scoped-sequence-no-seed" && f.id === d.id
|
|
11891
11915
|
);
|
|
11892
|
-
if (!
|
|
11916
|
+
if (!m || d.sequenceName !== m.sequenceName || d.hostRecord !== m.hostRecord || d.targetProperty !== m.targetProperty || d.scopeSignature !== m.scopeSignature || d.expectedHostCount !== m.expectedHostCount)
|
|
11893
11917
|
throw new C(`Migration scoped sequence no-seed decision does not match the generated no-seed operation: ${d.dataContext}`);
|
|
11894
11918
|
}
|
|
11895
11919
|
if (d.kind === "event-rebuild-handler") {
|
|
@@ -11907,8 +11931,8 @@ function Ps(s, e, t, i, r) {
|
|
|
11907
11931
|
if (d.kind === "empty-fact-record-removal") {
|
|
11908
11932
|
if (!o.has(p))
|
|
11909
11933
|
throw new C(`Migration empty fact record removal decision does not match a required review item: ${d.recordName}`);
|
|
11910
|
-
const h = e.storage.records.find((
|
|
11911
|
-
if (!h ||
|
|
11934
|
+
const h = e.storage.records.find((f) => f.recordName === d.recordName), m = t.storage.records.find((f) => f.recordName === d.recordName);
|
|
11935
|
+
if (!h || m || h.tableName !== d.tableName || d.expectedCount !== 0 || !ga(e, t, d.recordName))
|
|
11912
11936
|
throw new C(`Invalid empty fact record removal decision for ${d.recordName}`);
|
|
11913
11937
|
}
|
|
11914
11938
|
if (d.kind === "rename-candidate-reviewed")
|
|
@@ -12043,63 +12067,63 @@ function kr(s, e) {
|
|
|
12043
12067
|
function Cr(s, e, t, i = [], r = {}) {
|
|
12044
12068
|
const a = new Map(e.computations.map((g) => [St(g), g])), n = new Map(s.computations.map((g) => [g.id, g])), o = /* @__PURE__ */ new Map();
|
|
12045
12069
|
for (const g of e.computations) {
|
|
12046
|
-
for (const
|
|
12047
|
-
for (const N of Tr(
|
|
12070
|
+
for (const b of g.deps)
|
|
12071
|
+
for (const N of Tr(b, g, e))
|
|
12048
12072
|
o.has(N) || o.set(N, /* @__PURE__ */ new Set()), o.get(N).add(g.id);
|
|
12049
|
-
for (const
|
|
12050
|
-
for (const N of kr(
|
|
12073
|
+
for (const b of g.eventDeps)
|
|
12074
|
+
for (const N of kr(b, e))
|
|
12051
12075
|
N !== g.dataContext && (o.has(N) || o.set(N, /* @__PURE__ */ new Set()), o.get(N).add(g.id));
|
|
12052
12076
|
}
|
|
12053
12077
|
const c = (g) => {
|
|
12054
|
-
const
|
|
12055
|
-
return
|
|
12078
|
+
const b = g.match(/^property:([^.]*)\._isDeleted_$/);
|
|
12079
|
+
return b ? Qt(e, b[1]) : [];
|
|
12056
12080
|
}, u = /* @__PURE__ */ new Map();
|
|
12057
12081
|
for (const g of e.computations)
|
|
12058
|
-
for (const
|
|
12059
|
-
u.set(
|
|
12082
|
+
for (const b of c(g.dataContext))
|
|
12083
|
+
u.set(b, g);
|
|
12060
12084
|
const l = (g) => {
|
|
12061
|
-
const
|
|
12062
|
-
N &&
|
|
12085
|
+
const b = [], N = a.get(g);
|
|
12086
|
+
N && b.push(N);
|
|
12063
12087
|
const E = u.get(g);
|
|
12064
|
-
return E && E !== N &&
|
|
12088
|
+
return E && E !== N && b.push(E), b;
|
|
12065
12089
|
}, d = new Set(t.map((g) => g.id)), h = [...t.filter((g) => {
|
|
12066
|
-
const
|
|
12067
|
-
return r.outputChangedIds?.has(g.id) || !
|
|
12090
|
+
const b = n.get(g.id);
|
|
12091
|
+
return r.outputChangedIds?.has(g.id) || !b || b.outputSignature !== g.outputSignature;
|
|
12068
12092
|
}).flatMap((g) => [St(g), ...c(St(g))]), ...i];
|
|
12069
12093
|
for (; h.length; ) {
|
|
12070
12094
|
const g = h.shift();
|
|
12071
|
-
for (const
|
|
12072
|
-
if (d.has(
|
|
12073
|
-
d.add(
|
|
12074
|
-
const N = e.computations.find((E) => E.id ===
|
|
12095
|
+
for (const b of o.get(g) || []) {
|
|
12096
|
+
if (d.has(b)) continue;
|
|
12097
|
+
d.add(b);
|
|
12098
|
+
const N = e.computations.find((E) => E.id === b);
|
|
12075
12099
|
N && h.push(St(N));
|
|
12076
12100
|
}
|
|
12077
12101
|
}
|
|
12078
|
-
const
|
|
12079
|
-
if (
|
|
12080
|
-
if (
|
|
12102
|
+
const m = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), y = [], w = (g) => {
|
|
12103
|
+
if (f.has(g)) return;
|
|
12104
|
+
if (m.has(g))
|
|
12081
12105
|
throw new et(`Migration detected a derived computation cycle at ${g}`);
|
|
12082
|
-
|
|
12083
|
-
const
|
|
12084
|
-
if (
|
|
12085
|
-
for (const N of
|
|
12086
|
-
for (const E of Tr(N,
|
|
12106
|
+
m.add(g);
|
|
12107
|
+
const b = e.computations.find((N) => N.id === g);
|
|
12108
|
+
if (b) {
|
|
12109
|
+
for (const N of b.deps)
|
|
12110
|
+
for (const E of Tr(N, b, e))
|
|
12087
12111
|
for (const v of l(E))
|
|
12088
|
-
v.id !== g && d.has(v.id) &&
|
|
12089
|
-
for (const N of
|
|
12112
|
+
v.id !== g && d.has(v.id) && w(v.id);
|
|
12113
|
+
for (const N of b.eventDeps)
|
|
12090
12114
|
for (const E of kr(N, e))
|
|
12091
|
-
if (E !==
|
|
12115
|
+
if (E !== b.dataContext)
|
|
12092
12116
|
for (const v of l(E))
|
|
12093
|
-
v.id !== g && d.has(v.id) &&
|
|
12117
|
+
v.id !== g && d.has(v.id) && w(v.id);
|
|
12094
12118
|
}
|
|
12095
|
-
|
|
12119
|
+
m.delete(g), f.add(g), y.push(g);
|
|
12096
12120
|
};
|
|
12097
|
-
return d.forEach(
|
|
12098
|
-
const
|
|
12121
|
+
return d.forEach(w), y.map((g) => {
|
|
12122
|
+
const b = e.computations.find((F) => F.id === g), N = n.get(g), E = r.stateOnlyIds?.has(g) === !0, v = r.outputChangedIds?.has(g) || !N || N.outputSignature !== b.outputSignature, k = !N || N.stateSignature !== b.stateSignature, q = t.some((F) => F.id === g);
|
|
12099
12123
|
return {
|
|
12100
12124
|
computationId: g,
|
|
12101
|
-
dataContext:
|
|
12102
|
-
rebuildState: (E || k) &&
|
|
12125
|
+
dataContext: b.dataContext,
|
|
12126
|
+
rebuildState: (E || k) && b.boundStates.length > 0,
|
|
12103
12127
|
rebuildOutput: E ? !1 : v || !q,
|
|
12104
12128
|
propagateOutputEvents: E ? !1 : v || !q,
|
|
12105
12129
|
isSeed: q
|
|
@@ -12131,32 +12155,32 @@ function xr(s, e) {
|
|
|
12131
12155
|
newPhysicalPath: u.tableName,
|
|
12132
12156
|
reason: "fact record table changed"
|
|
12133
12157
|
});
|
|
12134
|
-
const d = new Map((l.attributeDetails || []).map((
|
|
12158
|
+
const d = new Map((l.attributeDetails || []).map((m) => [m.name, m])), p = new Map((u.attributeDetails || []).map((m) => [m.name, m]));
|
|
12135
12159
|
a.get(l.recordName), n.get(u.recordName);
|
|
12136
|
-
const h = (
|
|
12137
|
-
for (const
|
|
12138
|
-
if (!p.get(
|
|
12139
|
-
const y = h(l.recordName,
|
|
12160
|
+
const h = (m, f, y) => y.records.find((g) => g.name === m)?.properties.find((g) => g.name === f)?.computed === !0;
|
|
12161
|
+
for (const m of l.attributeDetails || [])
|
|
12162
|
+
if (!p.get(m.name) && !m.name.startsWith("_")) {
|
|
12163
|
+
const y = h(l.recordName, m.name, s);
|
|
12140
12164
|
t.push({
|
|
12141
12165
|
kind: "unsupported-destructive-schema-change",
|
|
12142
|
-
logicalPath: `${l.recordName}.${
|
|
12143
|
-
oldPhysicalPath: ui(
|
|
12166
|
+
logicalPath: `${l.recordName}.${m.name}`,
|
|
12167
|
+
oldPhysicalPath: ui(m.tableName, m.fieldName || m.sourceField || m.targetField),
|
|
12144
12168
|
reason: y ? "computed attribute physical cleanup is not supported by compute-route schema migration" : "fact attribute was removed from the new schema"
|
|
12145
12169
|
});
|
|
12146
12170
|
}
|
|
12147
|
-
for (const
|
|
12148
|
-
const
|
|
12149
|
-
!
|
|
12171
|
+
for (const m of u.attributeDetails || []) {
|
|
12172
|
+
const f = d.get(m.name);
|
|
12173
|
+
!f || h(l.recordName, m.name, s) || h(u.recordName, m.name, e) || ((f.kind !== m.kind || f.tableName !== m.tableName || f.fieldName !== m.fieldName || f.sourceField !== m.sourceField || f.targetField !== m.targetField) && t.push({
|
|
12150
12174
|
kind: "physical-path-move",
|
|
12151
|
-
logicalPath: `${u.recordName}.${
|
|
12152
|
-
oldPhysicalPath: ui(
|
|
12153
|
-
newPhysicalPath: ui(
|
|
12175
|
+
logicalPath: `${u.recordName}.${m.name}`,
|
|
12176
|
+
oldPhysicalPath: ui(f.tableName, f.fieldName || f.sourceField || f.targetField),
|
|
12177
|
+
newPhysicalPath: ui(m.tableName, m.fieldName || m.sourceField || m.targetField),
|
|
12154
12178
|
reason: "fact attribute physical path changed"
|
|
12155
|
-
}), (
|
|
12179
|
+
}), (f.type !== m.type || f.fieldType !== m.fieldType || f.collection !== m.collection) && t.push({
|
|
12156
12180
|
kind: "unsupported-destructive-schema-change",
|
|
12157
|
-
logicalPath: `${u.recordName}.${
|
|
12158
|
-
oldPhysicalPath: `${
|
|
12159
|
-
newPhysicalPath: `${
|
|
12181
|
+
logicalPath: `${u.recordName}.${m.name}`,
|
|
12182
|
+
oldPhysicalPath: `${f.type || "?"}/${f.fieldType || "?"}/${f.collection === !0}`,
|
|
12183
|
+
newPhysicalPath: `${m.type || "?"}/${m.fieldType || "?"}/${m.collection === !0}`,
|
|
12160
12184
|
reason: "fact attribute type, field type, or collection flag changed"
|
|
12161
12185
|
}));
|
|
12162
12186
|
}
|
|
@@ -12218,34 +12242,34 @@ async function Qs(s, e, t, i, r, a, n, o) {
|
|
|
12218
12242
|
const l = new Map((u.attributeDetails || []).map((M) => [M.name, M])), d = l.get(i);
|
|
12219
12243
|
if (!d?.fieldName || d.kind !== "value") return;
|
|
12220
12244
|
const p = r.map((M) => {
|
|
12221
|
-
const
|
|
12222
|
-
return
|
|
12245
|
+
const A = l.get(M.path);
|
|
12246
|
+
return A?.fieldName && A.kind === "value" ? { ...M, fieldName: A.fieldName } : void 0;
|
|
12223
12247
|
});
|
|
12224
12248
|
if (p.some((M) => !M)) return;
|
|
12225
|
-
const h = U(c),
|
|
12226
|
-
if (!
|
|
12227
|
-
const y =
|
|
12228
|
-
`SELECT COUNT(*) AS ${
|
|
12229
|
-
|
|
12249
|
+
const h = U(c), m = (M) => ce(M, h), f = Us(o, l, h);
|
|
12250
|
+
if (!f) return;
|
|
12251
|
+
const y = m(u.tableName), w = m(d.fieldName), g = f.sql ? ` WHERE ${f.sql}` : "", N = (await c.query(
|
|
12252
|
+
`SELECT COUNT(*) AS ${m("__rowCount")}, COUNT(${w}) AS ${m("__validValueCount")} FROM ${y}${g}`,
|
|
12253
|
+
f.params
|
|
12230
12254
|
))[0], E = Number(N?.__rowCount ?? 0), v = Number(N?.__validValueCount ?? 0);
|
|
12231
12255
|
if (E !== v)
|
|
12232
12256
|
throw new C(`ScopedSequence ${n} initializeFrom valuePath must be present for every matched host row`);
|
|
12233
12257
|
if (E === 0) return [];
|
|
12234
|
-
const k = p.map((M,
|
|
12235
|
-
`SELECT ${[...k, `MAX(${
|
|
12236
|
-
|
|
12258
|
+
const k = p.map((M, A) => `${m(M.fieldName)} AS ${m(`__scope_${A}`)}`), q = p.map((M) => m(M.fieldName)), F = await c.query(
|
|
12259
|
+
`SELECT ${[...k, `MAX(${w}) AS ${m("__maxValue")}`].join(", ")} FROM ${y}${g} GROUP BY ${q.join(", ")}`,
|
|
12260
|
+
f.params
|
|
12237
12261
|
), Y = new Map(a.map((M) => [String(M.name), M]));
|
|
12238
12262
|
return F.map((M) => {
|
|
12239
|
-
const
|
|
12263
|
+
const A = /* @__PURE__ */ new Map();
|
|
12240
12264
|
r.forEach((L, ye) => {
|
|
12241
12265
|
if (!Y.has(L.name)) throw new Error(`ScopedSequence ${n} initializeFrom scope "${L.name}" is not declared`);
|
|
12242
|
-
|
|
12266
|
+
A.set(L.name, M[`__scope_${ye}`]);
|
|
12243
12267
|
});
|
|
12244
12268
|
const ne = Number(M.__maxValue);
|
|
12245
12269
|
if (!Number.isFinite(ne))
|
|
12246
12270
|
throw new Error(`ScopedSequence ${n} initializeFrom valuePath must resolve to numbers`);
|
|
12247
12271
|
return {
|
|
12248
|
-
scope: ra(a,
|
|
12272
|
+
scope: ra(a, A),
|
|
12249
12273
|
max: ne
|
|
12250
12274
|
};
|
|
12251
12275
|
});
|
|
@@ -12260,29 +12284,29 @@ function Us(s, e, t) {
|
|
|
12260
12284
|
if (typeof p?.key != "string" || p.key.includes(".")) return;
|
|
12261
12285
|
const h = e.get(p.key);
|
|
12262
12286
|
if (!h?.fieldName || h.kind !== "value" || !Array.isArray(p.value) || p.value.length !== 2 || typeof p.value[0] != "string") return;
|
|
12263
|
-
const
|
|
12264
|
-
if (
|
|
12265
|
-
if (
|
|
12266
|
-
if ((
|
|
12267
|
-
return
|
|
12268
|
-
if ((
|
|
12269
|
-
const
|
|
12270
|
-
return i.push(o(
|
|
12287
|
+
const m = p.value[0].toLowerCase(), f = p.value[1], y = r(h.fieldName);
|
|
12288
|
+
if (m === "is null") return `${y} IS NULL`;
|
|
12289
|
+
if (m === "is not null") return `${y} IS NOT NULL`;
|
|
12290
|
+
if ((m === "=" || m === "!=") && f === null)
|
|
12291
|
+
return m === "=" ? `${y} IS NULL` : `${y} IS NOT NULL`;
|
|
12292
|
+
if ((m === "=" || m === "!=") && f !== null) {
|
|
12293
|
+
const w = a();
|
|
12294
|
+
return i.push(o(f)), m === "=" ? `(${y} IS NOT NULL AND ${y} = ${w})` : `(${y} IS NOT NULL AND ${y} != ${w})`;
|
|
12271
12295
|
}
|
|
12272
|
-
if (
|
|
12273
|
-
if (!Array.isArray(
|
|
12274
|
-
const
|
|
12275
|
-
if (
|
|
12276
|
-
if (
|
|
12277
|
-
const
|
|
12296
|
+
if (m === "in" || m === "not in") {
|
|
12297
|
+
if (!Array.isArray(f) || f.some((N) => N === void 0)) return;
|
|
12298
|
+
const w = f.filter((N) => N !== null).map(o), g = f.length !== w.length;
|
|
12299
|
+
if (m === "in" && f.length === 0) return "1 = 0";
|
|
12300
|
+
if (m === "not in" && f.length === 0) return `${y} IS NOT NULL`;
|
|
12301
|
+
const b = w.map((N) => {
|
|
12278
12302
|
const E = a();
|
|
12279
12303
|
return i.push(N), E;
|
|
12280
12304
|
});
|
|
12281
|
-
if (
|
|
12282
|
-
const N =
|
|
12305
|
+
if (m === "in") {
|
|
12306
|
+
const N = b.length ? `${y} IN (${b.join(", ")})` : "1 = 0";
|
|
12283
12307
|
return g ? `(${y} IS NULL OR ${N})` : `(${y} IS NOT NULL AND ${N})`;
|
|
12284
12308
|
}
|
|
12285
|
-
return g &&
|
|
12309
|
+
return g && b.length === 0 ? `${y} IS NOT NULL` : g ? `(${y} IS NOT NULL AND ${y} NOT IN (${b.join(", ")}))` : `(${y} IS NOT NULL AND ${y} NOT IN (${b.join(", ")}))`;
|
|
12286
12310
|
}
|
|
12287
12311
|
return;
|
|
12288
12312
|
}
|
|
@@ -12290,10 +12314,10 @@ function Us(s, e, t) {
|
|
|
12290
12314
|
const p = d.operator, h = c(d.left);
|
|
12291
12315
|
if (!h) return;
|
|
12292
12316
|
if (p === "not") return `(NOT ${h})`;
|
|
12293
|
-
const
|
|
12294
|
-
if (!
|
|
12295
|
-
if (p === "and") return `(${h} AND ${
|
|
12296
|
-
if (p === "or") return `(${h} OR ${
|
|
12317
|
+
const m = c(d.right);
|
|
12318
|
+
if (!m) return;
|
|
12319
|
+
if (p === "and") return `(${h} AND ${m})`;
|
|
12320
|
+
if (p === "or") return `(${h} OR ${m})`;
|
|
12297
12321
|
}
|
|
12298
12322
|
}
|
|
12299
12323
|
}, u = c(s);
|
|
@@ -12316,15 +12340,15 @@ async function js(s, e, t) {
|
|
|
12316
12340
|
throw new C(`ScopedSequence ${String(r.name)} initializeFrom.record must match host record ${d}`);
|
|
12317
12341
|
if (String(o.valuePath) !== p)
|
|
12318
12342
|
throw new C(`ScopedSequence ${String(r.name)} initializeFrom.valuePath must match target property ${d}.${p}`);
|
|
12319
|
-
const h = o.scope || [],
|
|
12343
|
+
const h = o.scope || [], m = r.scope || [], f = is(o.match ?? r.match), y = await Qs(
|
|
12320
12344
|
s,
|
|
12321
12345
|
t,
|
|
12322
12346
|
c,
|
|
12323
12347
|
String(o.valuePath),
|
|
12324
12348
|
h,
|
|
12325
|
-
|
|
12349
|
+
m,
|
|
12326
12350
|
String(r.name),
|
|
12327
|
-
|
|
12351
|
+
f
|
|
12328
12352
|
);
|
|
12329
12353
|
if (y) {
|
|
12330
12354
|
for (const k of y)
|
|
@@ -12338,13 +12362,13 @@ async function js(s, e, t) {
|
|
|
12338
12362
|
});
|
|
12339
12363
|
continue;
|
|
12340
12364
|
}
|
|
12341
|
-
const
|
|
12365
|
+
const w = Array.from(/* @__PURE__ */ new Set([
|
|
12342
12366
|
String(o.valuePath),
|
|
12343
12367
|
...h.map((k) => k.path),
|
|
12344
|
-
...ts(
|
|
12345
|
-
])), g =
|
|
12368
|
+
...ts(f)
|
|
12369
|
+
])), g = w.includes("*") ? ["*"] : w, b = (await s.system.storage.find(c, void 0, void 0, g)).filter((k) => aa(f, k)), N = new Map(m.map((k) => [String(k.name), k])), E = /* @__PURE__ */ new Map();
|
|
12346
12370
|
let v = 0;
|
|
12347
|
-
for (const k of
|
|
12371
|
+
for (const k of b) {
|
|
12348
12372
|
const q = Ni(k, String(o.valuePath));
|
|
12349
12373
|
if (q == null)
|
|
12350
12374
|
throw new C(`ScopedSequence ${String(r.name)} initializeFrom valuePath must be present for every matched host row`);
|
|
@@ -12357,10 +12381,10 @@ async function js(s, e, t) {
|
|
|
12357
12381
|
if (!N.get(L.name)) throw new Error(`ScopedSequence ${String(r.name)} initializeFrom scope "${L.name}" is not declared`);
|
|
12358
12382
|
Y.set(L.name, Ni(k, L.path));
|
|
12359
12383
|
}
|
|
12360
|
-
const M = ra(
|
|
12361
|
-
(!ne || F > ne.max) && E.set(
|
|
12384
|
+
const M = ra(m, Y), A = JSON.stringify(M), ne = E.get(A);
|
|
12385
|
+
(!ne || F > ne.max) && E.set(A, { scope: M, max: F });
|
|
12362
12386
|
}
|
|
12363
|
-
if (v !==
|
|
12387
|
+
if (v !== b.length)
|
|
12364
12388
|
throw new C(`ScopedSequence ${String(r.name)} initializeFrom did not validate every matched host row`);
|
|
12365
12389
|
for (const k of E.values())
|
|
12366
12390
|
await s.system.storage.atomic.seedSequenceValue({
|
|
@@ -12430,12 +12454,12 @@ async function Ti(s, e, t, i) {
|
|
|
12430
12454
|
if (s.system.storage.queryHandle)
|
|
12431
12455
|
return s.system.storage.find(o, void 0, void 0, ["*"]);
|
|
12432
12456
|
if (!t) return;
|
|
12433
|
-
const u = t.storage.records.find((
|
|
12457
|
+
const u = t.storage.records.find((f) => f.recordName === o), l = u?.tableName, d = (u?.attributeDetails || []).filter((f) => f.kind === "value" && f.fieldName);
|
|
12434
12458
|
if (!u || !l || d.length === 0) return;
|
|
12435
12459
|
const p = s.system.storage.db || s.system.db;
|
|
12436
12460
|
if (typeof p?.query != "function") return;
|
|
12437
|
-
const h = (
|
|
12438
|
-
return p.query(`SELECT ${
|
|
12461
|
+
const h = (f) => `"${f.replace(/"/g, '""')}"`, m = d.map((f) => `${h(f.fieldName)} AS ${h(f.name)}`).join(", ");
|
|
12462
|
+
return p.query(`SELECT ${m} FROM ${h(l)}`, []);
|
|
12439
12463
|
};
|
|
12440
12464
|
for (const o of e) {
|
|
12441
12465
|
const c = r.get(o.computationId);
|
|
@@ -12461,12 +12485,12 @@ async function Ti(s, e, t, i) {
|
|
|
12461
12485
|
if (!l || !d) continue;
|
|
12462
12486
|
const p = await c.compute(await s.scheduler.resolveDataDeps(c));
|
|
12463
12487
|
if (!Array.isArray(p)) continue;
|
|
12464
|
-
const h = new Set(p.map((y) => `${y[l]}:${y[d]}`)),
|
|
12465
|
-
|
|
12488
|
+
const h = new Set(p.map((y) => `${y[l]}:${y[d]}`)), f = (await n(u) || []).filter((y) => !h.has(`${y[l]}:${y[d]}`)).map((y) => String(y.id));
|
|
12489
|
+
f.length && a.push({
|
|
12466
12490
|
dataContext: O(c.dataContext),
|
|
12467
12491
|
recordName: u,
|
|
12468
|
-
ids:
|
|
12469
|
-
count:
|
|
12492
|
+
ids: f,
|
|
12493
|
+
count: f.length,
|
|
12470
12494
|
reason: "transform recompute would delete stale derived output records"
|
|
12471
12495
|
});
|
|
12472
12496
|
}
|
|
@@ -12484,7 +12508,7 @@ function va(s, e) {
|
|
|
12484
12508
|
throw new he(`Destructive migration scope mismatch for ${o.dataContext}`);
|
|
12485
12509
|
}
|
|
12486
12510
|
}
|
|
12487
|
-
async function
|
|
12511
|
+
async function Ar(s, e, t, i) {
|
|
12488
12512
|
const r = (e.approvedDiff?.decisions || []).filter((a) => a.kind === "computation-takeover");
|
|
12489
12513
|
for (const a of r) {
|
|
12490
12514
|
const n = await wa(s, a.dataContext, t, i);
|
|
@@ -12510,7 +12534,7 @@ function Ki(s, e) {
|
|
|
12510
12534
|
}
|
|
12511
12535
|
return i;
|
|
12512
12536
|
}
|
|
12513
|
-
function
|
|
12537
|
+
function Ir(s, e) {
|
|
12514
12538
|
return Ki(s, e).map((t) => `${t.isRelation ? "relation" : "entity"}:${t.recordName}`);
|
|
12515
12539
|
}
|
|
12516
12540
|
function Gs(s) {
|
|
@@ -12546,7 +12570,7 @@ async function zi(s, e, t, i, r = {}) {
|
|
|
12546
12570
|
result: t
|
|
12547
12571
|
});
|
|
12548
12572
|
}
|
|
12549
|
-
async function
|
|
12573
|
+
async function Ae(s, e, t, i, r = {}, a = {}) {
|
|
12550
12574
|
if (t instanceof Oe) {
|
|
12551
12575
|
if (!a.skipAsNull || e.dataContext.type !== "property") return;
|
|
12552
12576
|
const o = e.dataContext;
|
|
@@ -12569,7 +12593,7 @@ async function Ws(s, e, t, i, r = {}) {
|
|
|
12569
12593
|
const a = Array.isArray(t) ? t : [t], n = [];
|
|
12570
12594
|
for (const o of a) {
|
|
12571
12595
|
if (!o || typeof o != "object" || !("type" in o)) {
|
|
12572
|
-
const u = await
|
|
12596
|
+
const u = await Ae(s, e, o, i, r);
|
|
12573
12597
|
u && n.push(u);
|
|
12574
12598
|
continue;
|
|
12575
12599
|
}
|
|
@@ -12637,17 +12661,17 @@ async function Js(s, e, t = {}) {
|
|
|
12637
12661
|
);
|
|
12638
12662
|
if (!d)
|
|
12639
12663
|
throw new he(`Migration takeover requires approved destructive scope before clearing ${r}`);
|
|
12640
|
-
const p = await s.system.storage.find(r, void 0, void 0, ["*"]), h = new Set(d.ids.map(String)),
|
|
12641
|
-
if (h.size !==
|
|
12664
|
+
const p = await s.system.storage.find(r, void 0, void 0, ["*"]), h = new Set(d.ids.map(String)), m = new Set(p.map((y) => String(y.id)));
|
|
12665
|
+
if (h.size !== m.size || [...m].some((y) => !h.has(y)))
|
|
12642
12666
|
throw new he(`Migration takeover destructive scope mismatch for ${O(e.dataContext)}`);
|
|
12643
|
-
const
|
|
12667
|
+
const f = [];
|
|
12644
12668
|
for (const y of p)
|
|
12645
|
-
await s.system.storage.delete(r, S.atom({ key: "id", value: ["=", y.id] })),
|
|
12669
|
+
await s.system.storage.delete(r, S.atom({ key: "id", value: ["=", y.id] })), f.push({ recordName: r, type: "delete", record: y });
|
|
12646
12670
|
for (const y of i) {
|
|
12647
|
-
const
|
|
12648
|
-
|
|
12671
|
+
const w = await s.system.storage.create(r, y);
|
|
12672
|
+
f.push({ recordName: r, type: "create", record: w });
|
|
12649
12673
|
}
|
|
12650
|
-
return
|
|
12674
|
+
return f;
|
|
12651
12675
|
}
|
|
12652
12676
|
const c = await s.system.storage.find(r, void 0, void 0, ["*"]), u = new Map(c.map((d) => [`${d[a]}:${d[n]}`, d])), l = [];
|
|
12653
12677
|
for (const d of i) {
|
|
@@ -12655,8 +12679,8 @@ async function Js(s, e, t = {}) {
|
|
|
12655
12679
|
if (u.delete(p), h)
|
|
12656
12680
|
tt({ ...h, id: void 0 }, { ...d, id: void 0 }) || (await s.system.storage.update(r, S.atom({ key: "id", value: ["=", h.id] }), d), l.push({ recordName: r, type: "update", record: { ...h, ...d }, oldRecord: h, keys: Object.keys(d) }));
|
|
12657
12681
|
else {
|
|
12658
|
-
const
|
|
12659
|
-
l.push({ recordName: r, type: "create", record:
|
|
12682
|
+
const m = await s.system.storage.create(r, d);
|
|
12683
|
+
l.push({ recordName: r, type: "create", record: m });
|
|
12660
12684
|
}
|
|
12661
12685
|
}
|
|
12662
12686
|
for (const d of u.values()) {
|
|
@@ -12712,16 +12736,16 @@ class Ys {
|
|
|
12712
12736
|
if (e.dataContext.type === "property") {
|
|
12713
12737
|
const l = e.dataContext.host.name, d = await this.controller.system.storage.find(l, void 0, void 0, ["*"]), p = [];
|
|
12714
12738
|
for (const h of d) {
|
|
12715
|
-
const
|
|
12739
|
+
const m = t?.targetType === "property" ? Xe(h, e.dataContext.id.name) : h, f = await r({ controller: this.controller, dataContext: e.dataContext, record: m }), y = await Ae(this.controller, e, f, h, this.options, i);
|
|
12716
12740
|
y && p.push(y);
|
|
12717
12741
|
}
|
|
12718
12742
|
return p;
|
|
12719
12743
|
}
|
|
12720
|
-
const c = await r({ controller: this.controller, dataContext: e.dataContext }), u = await
|
|
12744
|
+
const c = await r({ controller: this.controller, dataContext: e.dataContext }), u = await Ae(this.controller, e, c, void 0, this.options);
|
|
12721
12745
|
return u ? [u] : [];
|
|
12722
12746
|
}
|
|
12723
12747
|
if (e.dataContext.type === "global") {
|
|
12724
|
-
const c = await this.controller.scheduler.resolveDataDeps(e), u = await
|
|
12748
|
+
const c = await this.controller.scheduler.resolveDataDeps(e), u = await Ae(this.controller, e, await e.compute(c), void 0, this.options);
|
|
12725
12749
|
return u ? [u] : [];
|
|
12726
12750
|
}
|
|
12727
12751
|
if (e.dataContext.type === "entity" || e.dataContext.type === "relation")
|
|
@@ -12731,7 +12755,7 @@ class Ys {
|
|
|
12731
12755
|
const u = await this.controller.scheduler.resolveDataDeps(e, c), l = t?.targetType === "property" ? Xe(c, e.dataContext.id.name) : c, d = t?.targetType === "property" ? Xe(u, e.dataContext.id.name) : u, p = await e.compute(
|
|
12732
12756
|
d,
|
|
12733
12757
|
l
|
|
12734
|
-
), h = await
|
|
12758
|
+
), h = await Ae(this.controller, e, p, c, this.options, i);
|
|
12735
12759
|
h && o.push(h);
|
|
12736
12760
|
}
|
|
12737
12761
|
return o;
|
|
@@ -12763,7 +12787,7 @@ class Ys {
|
|
|
12763
12787
|
r || (r = !0, i.push(...await this.runFullRecompute(e)));
|
|
12764
12788
|
continue;
|
|
12765
12789
|
}
|
|
12766
|
-
const d = await l({ controller: this.controller, dataContext: e.dataContext, mutationEvent: a }), p = await
|
|
12790
|
+
const d = await l({ controller: this.controller, dataContext: e.dataContext, mutationEvent: a }), p = await Ae(this.controller, e, d, void 0, this.options);
|
|
12767
12791
|
p && i.push(p);
|
|
12768
12792
|
continue;
|
|
12769
12793
|
}
|
|
@@ -12781,7 +12805,7 @@ class Ys {
|
|
|
12781
12805
|
if (r.mode === "skip") return [];
|
|
12782
12806
|
if (r.mode === "patch")
|
|
12783
12807
|
return Ws(this.controller, e, r.result, i, this.options);
|
|
12784
|
-
const a = await
|
|
12808
|
+
const a = await Ae(this.controller, e, r.result, i, this.options);
|
|
12785
12809
|
return a ? [a] : [];
|
|
12786
12810
|
}
|
|
12787
12811
|
}
|
|
@@ -12792,27 +12816,27 @@ async function Zs(s, e, t) {
|
|
|
12792
12816
|
if (!o || !n.resolvedMatchExpression) continue;
|
|
12793
12817
|
const c = await s.system.storage.find(o, r(n.resolvedMatchExpression), void 0, ["*"]);
|
|
12794
12818
|
if (a.changeType === "added") {
|
|
12795
|
-
for (const
|
|
12819
|
+
for (const m of c)
|
|
12796
12820
|
i.push({
|
|
12797
12821
|
recordName: n.recordName,
|
|
12798
12822
|
type: "create",
|
|
12799
|
-
record:
|
|
12823
|
+
record: m
|
|
12800
12824
|
});
|
|
12801
12825
|
continue;
|
|
12802
12826
|
}
|
|
12803
|
-
const u = a.oldRecord?.resolvedBaseRecordName ?? o, l = r(a.oldRecord?.resolvedMatchExpression), d = l ? await s.system.storage.find(u, l, void 0, ["*"]) : [], p = new Set(d.map((
|
|
12804
|
-
for (const
|
|
12805
|
-
p.has(String(
|
|
12827
|
+
const u = a.oldRecord?.resolvedBaseRecordName ?? o, l = r(a.oldRecord?.resolvedMatchExpression), d = l ? await s.system.storage.find(u, l, void 0, ["*"]) : [], p = new Set(d.map((m) => String(m.id))), h = new Set(c.map((m) => String(m.id)));
|
|
12828
|
+
for (const m of c)
|
|
12829
|
+
p.has(String(m.id)) || i.push({
|
|
12806
12830
|
recordName: n.recordName,
|
|
12807
12831
|
type: "create",
|
|
12808
|
-
record:
|
|
12832
|
+
record: m
|
|
12809
12833
|
});
|
|
12810
|
-
for (const
|
|
12811
|
-
h.has(String(
|
|
12834
|
+
for (const m of d)
|
|
12835
|
+
h.has(String(m.id)) || i.push({
|
|
12812
12836
|
recordName: n.recordName,
|
|
12813
12837
|
type: "delete",
|
|
12814
|
-
record:
|
|
12815
|
-
oldRecord:
|
|
12838
|
+
record: m,
|
|
12839
|
+
oldRecord: m
|
|
12816
12840
|
});
|
|
12817
12841
|
}
|
|
12818
12842
|
return i;
|
|
@@ -12854,8 +12878,8 @@ class Ho {
|
|
|
12854
12878
|
this.system = t, this.ignoreGuard = u, this.forceThrowDispatchError = l, this.entities = [...i], this.relations = [...r], this.dict = [...n], this.recordMutationSideEffects = [...o], this.eventSources = [...a];
|
|
12855
12879
|
for (const h of this.eventSources) {
|
|
12856
12880
|
if (h.name) {
|
|
12857
|
-
const
|
|
12858
|
-
if (
|
|
12881
|
+
const m = this.eventSourcesByName.get(h.name);
|
|
12882
|
+
if (m && m !== h)
|
|
12859
12883
|
throw new Error(`Duplicate eventSource name "${h.name}". Event source names must be unique within a Controller; findEventSourceByName would silently resolve to only one of them.`);
|
|
12860
12884
|
this.eventSourcesByName.set(h.name, h);
|
|
12861
12885
|
}
|
|
@@ -12879,8 +12903,8 @@ class Ho {
|
|
|
12879
12903
|
...c
|
|
12880
12904
|
];
|
|
12881
12905
|
this.scheduler = new Vt(this, this.entities, this.relations, this.dict, p), o.forEach((h) => {
|
|
12882
|
-
let
|
|
12883
|
-
|
|
12906
|
+
let m = this.recordNameToSideEffects.get(h.record.name);
|
|
12907
|
+
m || this.recordNameToSideEffects.set(h.record.name, m = /* @__PURE__ */ new Set()), m.add(h);
|
|
12884
12908
|
});
|
|
12885
12909
|
}
|
|
12886
12910
|
async setup(e) {
|
|
@@ -12900,7 +12924,7 @@ class Ho {
|
|
|
12900
12924
|
if (d && Er(d), d && d.modelHash !== l.modelHash)
|
|
12901
12925
|
throw new Error(`Model manifest mismatch. Call controller.generateMigrationDiff(), review it, then call controller.migrate({ approvedDiff }). Manifest key: ${Li}/${Vi}`);
|
|
12902
12926
|
if (!d && await this.system.hasExistingData?.())
|
|
12903
|
-
throw new
|
|
12927
|
+
throw new It("Existing database has no migration manifest. Call controller.createMigrationBaseline() before normal setup or migration.");
|
|
12904
12928
|
await this.system.setup(this.entities, this.relations, r, { install: t, internalRequirements: a }), await this.scheduler.setup(t);
|
|
12905
12929
|
return;
|
|
12906
12930
|
}
|
|
@@ -12943,7 +12967,7 @@ class Ho {
|
|
|
12943
12967
|
_(typeof i.prepareMigrationSchema == "function", "Current system does not support migration baseline");
|
|
12944
12968
|
const r = await i.prepareMigrationSchema(this.entities, this.relations, e, { internalRequirements: t });
|
|
12945
12969
|
if (r.preRecomputeDDL.length > 0 || r.blockingChanges.length > 0)
|
|
12946
|
-
throw new
|
|
12970
|
+
throw new It("Cannot create migration baseline because current definitions do not match the existing schema", {
|
|
12947
12971
|
missingDDL: r.preRecomputeDDL,
|
|
12948
12972
|
blockingChanges: r.blockingChanges
|
|
12949
12973
|
});
|
|
@@ -12955,28 +12979,28 @@ class Ho {
|
|
|
12955
12979
|
_(typeof r.prepareMigrationSchema == "function", "Current system does not support schema migration planning");
|
|
12956
12980
|
const a = await r.prepareMigrationSchema(this.entities, this.relations, t, { internalRequirements: i }), n = await Pr(this);
|
|
12957
12981
|
if (!n)
|
|
12958
|
-
throw new
|
|
12982
|
+
throw new It("Migration baseline manifest not found. Run setup(true) with the current framework first or createMigrationBaseline().");
|
|
12959
12983
|
Er(n);
|
|
12960
12984
|
const o = vt(this, a.schema, { includeFunctionText: e.includeFunctionText === !0 });
|
|
12961
12985
|
return { states: t, migrationSystem: r, schemaPlan: a, previousManifest: n, nextManifest: o };
|
|
12962
12986
|
}
|
|
12963
12987
|
async buildCurrentMigrationDiff(e, t, i, r = {}) {
|
|
12964
12988
|
const a = i.computations.filter(
|
|
12965
|
-
(
|
|
12966
|
-
), n =
|
|
12989
|
+
(f) => !t.computations.some((y) => y.id === f.id && y.signature === f.signature)
|
|
12990
|
+
), n = Ir(t, i), o = Cr(
|
|
12967
12991
|
t,
|
|
12968
12992
|
i,
|
|
12969
12993
|
a,
|
|
12970
12994
|
n,
|
|
12971
|
-
{ outputChangedIds: new Set(a.map((
|
|
12995
|
+
{ outputChangedIds: new Set(a.map((f) => f.id)) }
|
|
12972
12996
|
), c = xr(t, i), u = $r(this, e), l = r.includeDestructiveScope === !0 ? await Ti(this, o, t, u) : [], d = {
|
|
12973
12997
|
blockingChanges: [
|
|
12974
12998
|
...e.blockingChanges,
|
|
12975
12999
|
...c
|
|
12976
13000
|
],
|
|
12977
13001
|
destructiveScopes: l
|
|
12978
|
-
}, p = await xs(this,
|
|
12979
|
-
return
|
|
13002
|
+
}, p = await xs(this, As(t, i, e, d), t, i, u), h = await Es(this, p, t, i), m = await $s(this, h, t, i, u);
|
|
13003
|
+
return Is(m, this, o);
|
|
12980
13004
|
}
|
|
12981
13005
|
async generateMigrationDiff(e = {}) {
|
|
12982
13006
|
const { schemaPlan: t, previousManifest: i, nextManifest: r } = await this.prepareMigrationContext({
|
|
@@ -12989,16 +13013,16 @@ class Ho {
|
|
|
12989
13013
|
_(typeof r.applyMigrationSchema == "function", "Current system does not support schema migration application");
|
|
12990
13014
|
const { schemaPlan: a, previousManifest: n, nextManifest: o } = i, c = await this.buildCurrentMigrationDiff(a, n, o, { includeDestructiveScope: !1 });
|
|
12991
13015
|
Ps(t.approvedDiff, n, o, t.handlers, c);
|
|
12992
|
-
const u = t.approvedDiff, l = us(u), d = qs(u), p = Ds(u), h = Ms(n, o, u),
|
|
13016
|
+
const u = t.approvedDiff, l = us(u), d = qs(u), p = Ds(u), h = Ms(n, o, u), m = h.changedComputations, f = Ir(n, o), y = Cr(n, o, m, f, {
|
|
12993
13017
|
outputChangedIds: h.outputChangedIds,
|
|
12994
13018
|
stateOnlyIds: h.stateOnlyIds
|
|
12995
|
-
}),
|
|
13019
|
+
}), w = await ba(this, t.approvedDiff, n), g = Cs(n, w), b = {
|
|
12996
13020
|
...a,
|
|
12997
13021
|
postRecomputeDDL: [
|
|
12998
13022
|
...a.postRecomputeDDL,
|
|
12999
13023
|
...g
|
|
13000
13024
|
]
|
|
13001
|
-
}, N = xr(n, o).filter((L) => !(L.kind === "unsupported-destructive-schema-change" &&
|
|
13025
|
+
}, N = xr(n, o).filter((L) => !(L.kind === "unsupported-destructive-schema-change" && w.has(L.logicalPath))), E = Bs(
|
|
13002
13026
|
this,
|
|
13003
13027
|
y,
|
|
13004
13028
|
t,
|
|
@@ -13009,20 +13033,20 @@ class Ho {
|
|
|
13009
13033
|
...h.blocking,
|
|
13010
13034
|
...E
|
|
13011
13035
|
], k = Gs(v), q = $r(this, a), F = await Ti(this, y, n, q);
|
|
13012
|
-
va(t, F), await
|
|
13036
|
+
va(t, F), await Ar(this, t, n, q), await Ts(this, t.approvedDiff, n, q);
|
|
13013
13037
|
const Y = Hs(this, n, o), M = {
|
|
13014
13038
|
mode: "compute",
|
|
13015
13039
|
dryRun: t.dryRun === !0,
|
|
13016
|
-
changedComputations:
|
|
13040
|
+
changedComputations: m,
|
|
13017
13041
|
rebuildPlan: y,
|
|
13018
13042
|
scopedSequenceSeedOperations: d,
|
|
13019
13043
|
scopedSequenceNoSeedOperations: p,
|
|
13020
13044
|
factPropertyBackfills: Y,
|
|
13021
13045
|
schemaPlan: {
|
|
13022
|
-
schema:
|
|
13023
|
-
preRecomputeDDL:
|
|
13024
|
-
postRecomputeDDL:
|
|
13025
|
-
verificationDDL:
|
|
13046
|
+
schema: b.schema,
|
|
13047
|
+
preRecomputeDDL: b.preRecomputeDDL,
|
|
13048
|
+
postRecomputeDDL: b.postRecomputeDDL,
|
|
13049
|
+
verificationDDL: b.verificationDDL,
|
|
13026
13050
|
blockingChanges: v
|
|
13027
13051
|
},
|
|
13028
13052
|
blockingChanges: k,
|
|
@@ -13034,32 +13058,32 @@ class Ho {
|
|
|
13034
13058
|
throw new Error(`Migration plan has blocking changes:
|
|
13035
13059
|
${k.join(`
|
|
13036
13060
|
`)}`);
|
|
13037
|
-
let
|
|
13061
|
+
let A;
|
|
13038
13062
|
const ne = (L, ye) => {
|
|
13039
13063
|
const ei = ["pending", "schema-applied", "computation-applied", "constraints-applied", "manifest-written", "succeeded"];
|
|
13040
13064
|
return ei.indexOf(L) >= ei.indexOf(ye);
|
|
13041
13065
|
};
|
|
13042
13066
|
this.scheduler.teardown(), this.scheduler.registerDictDefaults();
|
|
13043
13067
|
try {
|
|
13044
|
-
|
|
13068
|
+
A = await r.beginMigration?.(
|
|
13045
13069
|
o.modelHash,
|
|
13046
13070
|
l,
|
|
13047
13071
|
u.summary,
|
|
13048
13072
|
u.decisions.length
|
|
13049
13073
|
);
|
|
13050
|
-
const L =
|
|
13051
|
-
await r.applyMigrationSchema(
|
|
13074
|
+
const L = A?.phase || "pending";
|
|
13075
|
+
await r.applyMigrationSchema(b, A?.id), ne(L, "schema-applied") || A && await r.updateMigrationPhase?.(A.id, "schema-applied"), ne(L, "manifest-written") || await this.system.storage.runInTransaction({ name: "migration recompute", isolation: "SERIALIZABLE" }, async () => {
|
|
13052
13076
|
if (!ne(L, "computation-applied")) {
|
|
13053
13077
|
await Ks(this, Y);
|
|
13054
13078
|
const Ca = await Zs(this, n, o);
|
|
13055
|
-
await
|
|
13079
|
+
await Ar(this, t, n), await Xs(this, y, t, Ca, n), await js(this, u, n), A && await r.updateMigrationPhase?.(A.id, "computation-applied");
|
|
13056
13080
|
}
|
|
13057
|
-
ne(L, "constraints-applied") || (await ks(this, t.approvedDiff, n), await r.verifyMigrationSchema?.(
|
|
13081
|
+
ne(L, "constraints-applied") || (await ks(this, t.approvedDiff, n), await r.verifyMigrationSchema?.(b, A?.id), await r.applyMigrationPostSchema?.(b, A?.id), A && await r.updateMigrationPhase?.(A.id, "constraints-applied"));
|
|
13058
13082
|
const ye = `manifest:current:${o.modelHash}:${l}`;
|
|
13059
|
-
await r.isMigrationOperationComplete?.(
|
|
13060
|
-
}),
|
|
13083
|
+
await r.isMigrationOperationComplete?.(A?.id, ye) || (await li(this, o), await r.markMigrationOperationComplete?.(A?.id, ye)), A && await r.updateMigrationPhase?.(A.id, "manifest-written");
|
|
13084
|
+
}), A && await r.finishMigration?.(A.id, "succeeded");
|
|
13061
13085
|
} catch (L) {
|
|
13062
|
-
throw
|
|
13086
|
+
throw A && await r.finishMigration?.(A.id, "failed", L), L;
|
|
13063
13087
|
}
|
|
13064
13088
|
try {
|
|
13065
13089
|
await this.scheduler.setup(!1);
|
|
@@ -13201,7 +13225,7 @@ ${k.join(`
|
|
|
13201
13225
|
_(!!e, "eventSource is required for dispatch");
|
|
13202
13226
|
const i = Mr.getStore();
|
|
13203
13227
|
if (i)
|
|
13204
|
-
throw new
|
|
13228
|
+
throw new An({
|
|
13205
13229
|
outerEventSourceName: i.eventSourceName,
|
|
13206
13230
|
nestedEventSourceName: e.name
|
|
13207
13231
|
});
|
|
@@ -13902,13 +13926,13 @@ class to {
|
|
|
13902
13926
|
increment: async (t, i) => {
|
|
13903
13927
|
const r = this.getPlaceholder();
|
|
13904
13928
|
if (this.isRecordTarget(t)) {
|
|
13905
|
-
const { tableName: u, idField: l, fieldName: d } = this.resolveRecordTarget(t), p = r(), h = r(),
|
|
13929
|
+
const { tableName: u, idField: l, fieldName: d } = this.resolveRecordTarget(t), p = r(), h = r(), m = await this.db.query(
|
|
13906
13930
|
`UPDATE "${u}" SET "${d}" = COALESCE("${d}", 0) + ${p} WHERE "${l}" = ${h} RETURNING "${d}" AS value`,
|
|
13907
13931
|
[i, t.id],
|
|
13908
13932
|
`atomic increment ${t.recordName}.${t.field}`
|
|
13909
13933
|
);
|
|
13910
|
-
if (!
|
|
13911
|
-
return Number(
|
|
13934
|
+
if (!m.length) throw new Error(`Atomic increment target not found: ${t.recordName}.${String(t.id)}.${t.field}`);
|
|
13935
|
+
return Number(m[0]?.value ?? await this.atomic.get(t) ?? 0);
|
|
13912
13936
|
}
|
|
13913
13937
|
const a = r(), n = r(), o = r(), c = await this.db.query(
|
|
13914
13938
|
`INSERT INTO "_ComputationState_" ("key", "numberValue") VALUES (${a}, ${n})
|
|
@@ -13924,14 +13948,14 @@ RETURNING "numberValue" AS value`,
|
|
|
13924
13948
|
async () => {
|
|
13925
13949
|
const r = this.getPlaceholder();
|
|
13926
13950
|
if (this.isRecordTarget(t)) {
|
|
13927
|
-
const { tableName: y, idField:
|
|
13928
|
-
`SELECT "${g}" AS value FROM "${y}" WHERE "${
|
|
13951
|
+
const { tableName: y, idField: w, fieldName: g } = this.resolveRecordTarget(t), b = r(), N = await this.db.query(
|
|
13952
|
+
`SELECT "${g}" AS value FROM "${y}" WHERE "${w}" = ${b}${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
|
|
13929
13953
|
[t.id],
|
|
13930
13954
|
`atomic replace lock ${t.recordName}.${t.field}`
|
|
13931
13955
|
);
|
|
13932
13956
|
if (!N.length) throw new Error(`Atomic replace target not found: ${t.recordName}.${String(t.id)}.${t.field}`);
|
|
13933
13957
|
const E = this.getPlaceholder(), v = E(), k = E(), q = await this.db.query(
|
|
13934
|
-
`UPDATE "${y}" SET "${g}" = ${v} WHERE "${
|
|
13958
|
+
`UPDATE "${y}" SET "${g}" = ${v} WHERE "${w}" = ${k} RETURNING "${g}" AS value`,
|
|
13935
13959
|
[i, t.id],
|
|
13936
13960
|
`atomic replace ${t.recordName}.${t.field}`
|
|
13937
13961
|
);
|
|
@@ -13943,12 +13967,12 @@ RETURNING "numberValue" AS value`,
|
|
|
13943
13967
|
`SELECT "${a}" AS value FROM "_ComputationState_" WHERE "key" = ${o}${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
|
|
13944
13968
|
[t.key],
|
|
13945
13969
|
`atomic replace lock ${t.key}`
|
|
13946
|
-
), u = e.filter((y) => y !== a).map((y) => `"${y}" = NULL`).join(", "), l = this.parseGlobalValue(c[0]?.value, a) ?? t.defaultValue ?? null, d = this.getPlaceholder(), p = d(), h = d(),
|
|
13947
|
-
`UPDATE "_ComputationState_" SET ${
|
|
13970
|
+
), u = e.filter((y) => y !== a).map((y) => `"${y}" = NULL`).join(", "), l = this.parseGlobalValue(c[0]?.value, a) ?? t.defaultValue ?? null, d = this.getPlaceholder(), p = d(), h = d(), m = [`"${a}" = ${p}`, u].filter(Boolean).join(", "), f = await this.db.query(
|
|
13971
|
+
`UPDATE "_ComputationState_" SET ${m} WHERE "key" = ${h} RETURNING "${a}" AS value`,
|
|
13948
13972
|
[n, t.key],
|
|
13949
13973
|
`atomic replace ${t.key}`
|
|
13950
13974
|
);
|
|
13951
|
-
return { oldValue: l, newValue: this.parseGlobalValue(
|
|
13975
|
+
return { oldValue: l, newValue: this.parseGlobalValue(f[0]?.value, a) ?? i };
|
|
13952
13976
|
}
|
|
13953
13977
|
),
|
|
13954
13978
|
compareAndSet: async (t, i, r, a) => {
|
|
@@ -13961,16 +13985,16 @@ RETURNING "numberValue" AS value`,
|
|
|
13961
13985
|
`atomic compareAndSet ${t.recordName}.${t.field}`
|
|
13962
13986
|
)).length > 0;
|
|
13963
13987
|
}
|
|
13964
|
-
const c = this.resolveGlobalColumn(t, r), u = this.normalizeGlobalValue(r, c), l = this.normalizeGlobalValue(o, c), d = this.normalizeGlobalValue(i, c), p = n(), h = n(),
|
|
13988
|
+
const c = this.resolveGlobalColumn(t, r), u = this.normalizeGlobalValue(r, c), l = this.normalizeGlobalValue(o, c), d = this.normalizeGlobalValue(i, c), p = n(), h = n(), m = n(), f = n();
|
|
13965
13989
|
if ((await this.db.query(
|
|
13966
|
-
`UPDATE "_ComputationState_" SET "${c}" = ${p} WHERE "key" = ${h} AND COALESCE("${c}", ${
|
|
13990
|
+
`UPDATE "_ComputationState_" SET "${c}" = ${p} WHERE "key" = ${h} AND COALESCE("${c}", ${m}) = ${f} RETURNING "${c}" AS value`,
|
|
13967
13991
|
[u, t.key, l, d],
|
|
13968
13992
|
`atomic compareAndSet ${t.key}`
|
|
13969
13993
|
)).length) return !0;
|
|
13970
13994
|
if (d !== l) return !1;
|
|
13971
|
-
const
|
|
13995
|
+
const w = this.getPlaceholder(), g = w(), b = w();
|
|
13972
13996
|
return (await this.db.query(
|
|
13973
|
-
`INSERT INTO "_ComputationState_" ("key", "${c}") VALUES (${g}, ${
|
|
13997
|
+
`INSERT INTO "_ComputationState_" ("key", "${c}") VALUES (${g}, ${b}) ON CONFLICT ("key") DO NOTHING RETURNING "${c}" AS value`,
|
|
13974
13998
|
[t.key, u],
|
|
13975
13999
|
`atomic compareAndSet insert ${t.key}`
|
|
13976
14000
|
)).length > 0;
|
|
@@ -14002,10 +14026,10 @@ RETURNING "lastValue" AS value`,
|
|
|
14002
14026
|
if (this.validateAtomicSequenceTarget(t), t.mode !== void 0 && t.mode !== "max" && t.mode !== "replace")
|
|
14003
14027
|
throw new Error('Atomic sequence seed mode must be "max" or "replace"');
|
|
14004
14028
|
this.requireTransaction(`atomic scoped sequence seed ${t.sequenceName}`);
|
|
14005
|
-
const i = this.sequenceScopeKey(t.scope), r = JSON.stringify(this.normalizeSequenceScope(t.scope)), a = t.mode ?? "max", n = this.getPlaceholder(), o = n(), c = n(), u = n(), l = n(), d = n(), h = U(this.db).name === "sqlite" ? `MAX("_ScopedSequence_"."lastValue", ${d})` : `GREATEST("_ScopedSequence_"."lastValue", ${d})`,
|
|
14029
|
+
const i = this.sequenceScopeKey(t.scope), r = JSON.stringify(this.normalizeSequenceScope(t.scope)), a = t.mode ?? "max", n = this.getPlaceholder(), o = n(), c = n(), u = n(), l = n(), d = n(), h = U(this.db).name === "sqlite" ? `MAX("_ScopedSequence_"."lastValue", ${d})` : `GREATEST("_ScopedSequence_"."lastValue", ${d})`, m = a === "replace" ? `${d}` : h;
|
|
14006
14030
|
await this.db.query(
|
|
14007
14031
|
`INSERT INTO "_ScopedSequence_" ("sequenceName", "scopeKey", "scope", "lastValue") VALUES (${o}, ${c}, ${u}, ${l})
|
|
14008
|
-
ON CONFLICT ("sequenceName", "scopeKey") DO UPDATE SET "lastValue" = ${
|
|
14032
|
+
ON CONFLICT ("sequenceName", "scopeKey") DO UPDATE SET "lastValue" = ${m}
|
|
14009
14033
|
RETURNING "lastValue" AS value`,
|
|
14010
14034
|
[t.sequenceName, i, r, t.value, t.value],
|
|
14011
14035
|
`atomic scoped sequence seed ${t.sequenceName}`
|
|
@@ -14029,8 +14053,8 @@ RETURNING "lastValue" AS value`,
|
|
|
14029
14053
|
[t.key],
|
|
14030
14054
|
`atomic updateGlobalFields lock ${t.key}`
|
|
14031
14055
|
), c = this.parseGlobalValue(o[0]?.value, "jsonValue") ?? {}, u = { ...r, ...c };
|
|
14032
|
-
Object.entries(i).forEach(([h,
|
|
14033
|
-
u[h] = Number(u[h] ?? r[h] ?? 0) +
|
|
14056
|
+
Object.entries(i).forEach(([h, m]) => {
|
|
14057
|
+
u[h] = Number(u[h] ?? r[h] ?? 0) + m;
|
|
14034
14058
|
});
|
|
14035
14059
|
const l = this.getPlaceholder(), d = l(), p = l();
|
|
14036
14060
|
return await this.db.update(
|
|
@@ -14065,9 +14089,9 @@ RETURNING "lastValue" AS value`,
|
|
|
14065
14089
|
r
|
|
14066
14090
|
);
|
|
14067
14091
|
}
|
|
14068
|
-
const h = p.sort((y,
|
|
14092
|
+
const h = p.sort((y, w) => String(y) < String(w) ? -1 : String(y) > String(w) ? 1 : 0), m = this.getPlaceholder(), f = h.map(() => m()).join(",");
|
|
14069
14093
|
if (await this.db.query(
|
|
14070
|
-
`SELECT "${n}" AS id FROM "${a}" WHERE "${n}" IN (${
|
|
14094
|
+
`SELECT "${n}" AS id FROM "${a}" WHERE "${n}" IN (${f})${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
|
|
14071
14095
|
h,
|
|
14072
14096
|
`atomic lockRows ${t} (round ${l + 1})`
|
|
14073
14097
|
), h.forEach((y) => c.set(String(y), y)), !this.supportsForUpdate()) break;
|
|
@@ -14342,9 +14366,9 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
14342
14366
|
return await this.acquireMigrationLock(l[0].id), { id: l[0].id, phase: l[0].phase };
|
|
14343
14367
|
const d = `${Date.now()}-${Math.random().toString(36).slice(2)}`, p = (/* @__PURE__ */ new Date()).toISOString(), h = i === void 0 ? null : JSON.stringify(i);
|
|
14344
14368
|
await this.acquireMigrationLock(d);
|
|
14345
|
-
const
|
|
14369
|
+
const m = ue(a, 8);
|
|
14346
14370
|
return await this.db.update(
|
|
14347
|
-
`INSERT INTO "__interaqt_migration_log" ("id", "modelHash", "approvedDiffHash", "approvedDiffSummary", "decisionCount", "reviewedAt", "phase", "status", "createdAt", "updatedAt") VALUES (${
|
|
14371
|
+
`INSERT INTO "__interaqt_migration_log" ("id", "modelHash", "approvedDiffHash", "approvedDiffSummary", "decisionCount", "reviewedAt", "phase", "status", "createdAt", "updatedAt") VALUES (${m[0]}, ${m[1]}, ${m[2]}, ${m[3]}, ${m[4]}, ${m[5]}, 'pending', 'pending', ${m[6]}, ${m[7]})`,
|
|
14348
14372
|
[d, e, t || "", h, r, p, p, p],
|
|
14349
14373
|
void 0,
|
|
14350
14374
|
"write migration log pending"
|
|
@@ -14398,18 +14422,18 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
14398
14422
|
if (h instanceof D) {
|
|
14399
14423
|
if (!h.record)
|
|
14400
14424
|
return;
|
|
14401
|
-
let
|
|
14402
|
-
if (
|
|
14425
|
+
let m = o.getEntityByName(h.record);
|
|
14426
|
+
if (m || (m = o.getRelationByName(h.record)), !m)
|
|
14403
14427
|
throw new Error(`Entity or Relation not found: ${h.record}`);
|
|
14404
|
-
for (;
|
|
14405
|
-
|
|
14428
|
+
for (; m.baseEntity || m.baseRelation; )
|
|
14429
|
+
m = m.baseEntity || m.baseRelation;
|
|
14406
14430
|
if (h.defaultValue instanceof x)
|
|
14407
|
-
h.defaultValue.name = h.key,
|
|
14431
|
+
h.defaultValue.name = h.key, m.properties.push(h.defaultValue);
|
|
14408
14432
|
else {
|
|
14409
|
-
const
|
|
14410
|
-
|
|
14433
|
+
const f = typeof h.defaultValue;
|
|
14434
|
+
m.properties.push(x.create({
|
|
14411
14435
|
name: h.key,
|
|
14412
|
-
type:
|
|
14436
|
+
type: f,
|
|
14413
14437
|
// 应该系统定义
|
|
14414
14438
|
collection: Array.isArray(h.defaultValue),
|
|
14415
14439
|
defaultValue: () => h.defaultValue
|
|
@@ -14506,10 +14530,10 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
14506
14530
|
const c = o.sourceRecordId, u = o.transformIndex;
|
|
14507
14531
|
if (!(c instanceof D) || !(u instanceof D) || c.unique === !1 || n.type !== "entity" && n.type !== "relation")
|
|
14508
14532
|
return [];
|
|
14509
|
-
const l = n.id.name, d = r.getRecordInfo(l), [, p] = r.getTableAliasAndFieldName([l], c.key, !0), [, h] = r.getTableAliasAndFieldName([l], u.key, !0),
|
|
14533
|
+
const l = n.id.name, d = r.getRecordInfo(l), [, p] = r.getTableAliasAndFieldName([l], c.key, !0), [, h] = r.getTableAliasAndFieldName([l], u.key, !0), m = `idx_transform_${this.hashIdentifier(`${d.table}_${p}_${h}`)}`;
|
|
14510
14534
|
return [{
|
|
14511
14535
|
kind: "create-constraint",
|
|
14512
|
-
sql: gi(
|
|
14536
|
+
sql: gi(m, d.table, [p, h], a),
|
|
14513
14537
|
tableName: d.table,
|
|
14514
14538
|
logicalPath: `${l}.${c.key}.${u.key}`,
|
|
14515
14539
|
description: `migration setup transform unique index ${l}`
|
|
@@ -14577,7 +14601,7 @@ class Zt {
|
|
|
14577
14601
|
}
|
|
14578
14602
|
static parse(e) {
|
|
14579
14603
|
const t = JSON.parse(e);
|
|
14580
|
-
return this.create(
|
|
14604
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
14581
14605
|
}
|
|
14582
14606
|
}
|
|
14583
14607
|
const Ut = "interaqt:builtin:action:get", Go = Zt.create({ name: "get" }, { uuid: Ut });
|
|
@@ -14647,7 +14671,7 @@ class ft {
|
|
|
14647
14671
|
}
|
|
14648
14672
|
static parse(e) {
|
|
14649
14673
|
const t = JSON.parse(e);
|
|
14650
|
-
return this.create(
|
|
14674
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
14651
14675
|
}
|
|
14652
14676
|
}
|
|
14653
14677
|
const no = "_Interaction_", Ji = j.create({
|
|
@@ -14750,7 +14774,7 @@ class Xi {
|
|
|
14750
14774
|
// `uuid::` 引用需要完整实例集合才能解析——graph 级反序列化请使用 createInstancesFromString。
|
|
14751
14775
|
static parse(e) {
|
|
14752
14776
|
const t = JSON.parse(e);
|
|
14753
|
-
return this.create(
|
|
14777
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
14754
14778
|
}
|
|
14755
14779
|
}
|
|
14756
14780
|
class ge extends Error {
|
|
@@ -14853,9 +14877,9 @@ async function ho(s, e, t) {
|
|
|
14853
14877
|
if (n.base) {
|
|
14854
14878
|
const u = n.base.name, l = n.isCollection ? o : [o];
|
|
14855
14879
|
for (const d of l) {
|
|
14856
|
-
if (!d || typeof d != "object")
|
|
14880
|
+
if (!d || typeof d != "object" || Array.isArray(d))
|
|
14857
14881
|
throw new ge(
|
|
14858
|
-
`Payload validation failed for field '${n.name}': expected ${u} data (object), got ${d === null ? "null" : typeof d}`,
|
|
14882
|
+
`Payload validation failed for field '${n.name}': expected ${u} data (object), got ${d === null ? "null" : Array.isArray(d) ? "array" : typeof d}`,
|
|
14859
14883
|
{ type: `${n.name} check concept failed`, checkType: "payload" }
|
|
14860
14884
|
);
|
|
14861
14885
|
if (n.isRef && !await s.system.storage.findOne(
|
|
@@ -14971,7 +14995,7 @@ class Yi {
|
|
|
14971
14995
|
// graph 级反序列化请使用 createInstancesFromString(Transfer/ActivityGroup 已注册 Klass)。
|
|
14972
14996
|
static parse(e) {
|
|
14973
14997
|
const t = JSON.parse(e);
|
|
14974
|
-
return this.create(
|
|
14998
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
14975
14999
|
}
|
|
14976
15000
|
}
|
|
14977
15001
|
class je {
|
|
@@ -15034,7 +15058,7 @@ class je {
|
|
|
15034
15058
|
}
|
|
15035
15059
|
static parse(e) {
|
|
15036
15060
|
const t = JSON.parse(e);
|
|
15037
|
-
return this.create(
|
|
15061
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15038
15062
|
}
|
|
15039
15063
|
}
|
|
15040
15064
|
class Zi {
|
|
@@ -15103,7 +15127,7 @@ class Zi {
|
|
|
15103
15127
|
}
|
|
15104
15128
|
static parse(e) {
|
|
15105
15129
|
const t = JSON.parse(e);
|
|
15106
|
-
return this.create(
|
|
15130
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15107
15131
|
}
|
|
15108
15132
|
}
|
|
15109
15133
|
function Ta(s, e, t) {
|
|
@@ -15179,7 +15203,7 @@ class er {
|
|
|
15179
15203
|
}
|
|
15180
15204
|
static parse(e) {
|
|
15181
15205
|
const t = JSON.parse(e);
|
|
15182
|
-
return this.create(
|
|
15206
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15183
15207
|
}
|
|
15184
15208
|
}
|
|
15185
15209
|
class tr {
|
|
@@ -15237,7 +15261,7 @@ class tr {
|
|
|
15237
15261
|
}
|
|
15238
15262
|
static parse(e) {
|
|
15239
15263
|
const t = JSON.parse(e);
|
|
15240
|
-
return this.create(
|
|
15264
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15241
15265
|
}
|
|
15242
15266
|
}
|
|
15243
15267
|
class it {
|
|
@@ -15291,7 +15315,7 @@ class it {
|
|
|
15291
15315
|
}
|
|
15292
15316
|
static parse(e) {
|
|
15293
15317
|
const t = JSON.parse(e);
|
|
15294
|
-
return this.create(
|
|
15318
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15295
15319
|
}
|
|
15296
15320
|
}
|
|
15297
15321
|
class ir {
|
|
@@ -15345,7 +15369,7 @@ class ir {
|
|
|
15345
15369
|
}
|
|
15346
15370
|
static parse(e) {
|
|
15347
15371
|
const t = JSON.parse(e);
|
|
15348
|
-
return this.create(
|
|
15372
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15349
15373
|
}
|
|
15350
15374
|
}
|
|
15351
15375
|
class rr {
|
|
@@ -15431,7 +15455,7 @@ class rr {
|
|
|
15431
15455
|
}
|
|
15432
15456
|
static parse(e) {
|
|
15433
15457
|
const t = JSON.parse(e);
|
|
15434
|
-
return this.create(
|
|
15458
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15435
15459
|
}
|
|
15436
15460
|
}
|
|
15437
15461
|
class ar {
|
|
@@ -15481,7 +15505,7 @@ class ar {
|
|
|
15481
15505
|
}
|
|
15482
15506
|
static parse(e) {
|
|
15483
15507
|
const t = JSON.parse(e);
|
|
15484
|
-
return this.create(
|
|
15508
|
+
return this.create(I(t.public), { ...t.options, uuid: t.uuid });
|
|
15485
15509
|
}
|
|
15486
15510
|
}
|
|
15487
15511
|
const mo = [
|
|
@@ -15965,7 +15989,7 @@ export {
|
|
|
15965
15989
|
Z as DICTIONARY_RECORD,
|
|
15966
15990
|
tr as DataPolicy,
|
|
15967
15991
|
he as DestructiveComputedOutputError,
|
|
15968
|
-
|
|
15992
|
+
Ai as Dictionary,
|
|
15969
15993
|
yr as DictionaryEntity,
|
|
15970
15994
|
j as Entity,
|
|
15971
15995
|
Gn as EntityCustomHandle,
|
|
@@ -15995,7 +16019,7 @@ export {
|
|
|
15995
16019
|
bn as GlobalWeightedSummationHandle,
|
|
15996
16020
|
Mt as HARD_DELETION_PROPERTY_NAME,
|
|
15997
16021
|
jo as HardDeletionProperty,
|
|
15998
|
-
|
|
16022
|
+
Ie as ID_ATTR,
|
|
15999
16023
|
no as INTERACTION_RECORD,
|
|
16000
16024
|
Lt as Inequality,
|
|
16001
16025
|
Xi as Interaction,
|
|
@@ -16008,15 +16032,15 @@ export {
|
|
|
16008
16032
|
Li as MIGRATION_MANIFEST_CONCEPT,
|
|
16009
16033
|
Vi as MIGRATION_MANIFEST_CURRENT_KEY,
|
|
16010
16034
|
S as MatchExp,
|
|
16011
|
-
|
|
16035
|
+
It as MigrationBaselineError,
|
|
16012
16036
|
C as MigrationError,
|
|
16013
16037
|
Br as Modifier,
|
|
16014
16038
|
zo as MonoSystem,
|
|
16015
16039
|
Oo as NON_DELETED_STATE,
|
|
16016
16040
|
Do as NON_EXIST_STATE,
|
|
16017
|
-
|
|
16041
|
+
An as NestedDispatchError,
|
|
16018
16042
|
ie as NewRecordData,
|
|
16019
|
-
|
|
16043
|
+
Ii as NonNullConstraint,
|
|
16020
16044
|
xo as PHASE_AFTER_ALL,
|
|
16021
16045
|
Co as PHASE_BEFORE_ALL,
|
|
16022
16046
|
oi as PHASE_NORMAL,
|
|
@@ -16080,13 +16104,13 @@ export {
|
|
|
16080
16104
|
Nn as WeightedSummationHandles,
|
|
16081
16105
|
xs as addComputationTakeoverReview,
|
|
16082
16106
|
Es as addEmptyFactRecordRemovalReview,
|
|
16083
|
-
|
|
16107
|
+
Is as addMissingRebuildHandlerRequirements,
|
|
16084
16108
|
$s as addScopedSequenceNoSeedReview,
|
|
16085
16109
|
Sr as addToCurrentEffects,
|
|
16086
16110
|
_ as assert,
|
|
16087
16111
|
ks as assertApprovedEmptyFactRecordRemovalsStillEmpty,
|
|
16088
16112
|
dn as assertCallbackAttributeQueryDeclared,
|
|
16089
|
-
|
|
16113
|
+
Ar as assertComputationTakeoverAllowed,
|
|
16090
16114
|
va as assertDestructiveScopeAllowed,
|
|
16091
16115
|
Er as assertManifestGeneratorCurrent,
|
|
16092
16116
|
Ts as assertScopedSequenceNoSeedDecisions,
|
|
@@ -16094,7 +16118,7 @@ export {
|
|
|
16094
16118
|
cs as asyncInteractionContext,
|
|
16095
16119
|
Ks as backfillNewFactPropertyDefaults,
|
|
16096
16120
|
Cr as buildAffectedRebuildPlan,
|
|
16097
|
-
|
|
16121
|
+
As as buildMigrationDiff,
|
|
16098
16122
|
hn as buildRelationSideMatchKey,
|
|
16099
16123
|
uo as checkCondition,
|
|
16100
16124
|
ho as checkPayload,
|
|
@@ -16102,7 +16126,7 @@ export {
|
|
|
16102
16126
|
we as collectErrorChain,
|
|
16103
16127
|
mt as computationManifestId,
|
|
16104
16128
|
Cs as createEmptyFactRecordRemovalOperations,
|
|
16105
|
-
|
|
16129
|
+
Aa as createInstances,
|
|
16106
16130
|
To as createInstancesFromString,
|
|
16107
16131
|
vt as createMigrationManifest,
|
|
16108
16132
|
$r as createMigrationReadHandle,
|
|
@@ -16112,7 +16136,7 @@ export {
|
|
|
16112
16136
|
gi as createUniqueIndexSQL,
|
|
16113
16137
|
O as dataContextPath,
|
|
16114
16138
|
Ko as dbConsoleLogger,
|
|
16115
|
-
|
|
16139
|
+
I as decodeFunctionValues,
|
|
16116
16140
|
yt as deepClone,
|
|
16117
16141
|
zr as defaultDataBasedIncrementalPlan,
|
|
16118
16142
|
Ur as defaultEncodeLiteral,
|
|
@@ -16120,7 +16144,7 @@ export {
|
|
|
16120
16144
|
Po as everyAsync,
|
|
16121
16145
|
qo as everyWithErrorAsync,
|
|
16122
16146
|
ln as externalDataDepKeys,
|
|
16123
|
-
|
|
16147
|
+
Ao as filterMap,
|
|
16124
16148
|
on as findConstraintViolationError,
|
|
16125
16149
|
qn as findErrorByCode,
|
|
16126
16150
|
Jo as findRootActivity,
|
|
@@ -16135,7 +16159,7 @@ export {
|
|
|
16135
16159
|
Ki as getFilteredRecordChanges,
|
|
16136
16160
|
Wo as getInteractions,
|
|
16137
16161
|
Hs as getNewFactPropertyBackfills,
|
|
16138
|
-
|
|
16162
|
+
Ir as getNewFilteredDataContexts,
|
|
16139
16163
|
Bs as getRecomputeBlockingChanges,
|
|
16140
16164
|
U as getSchemaDialect,
|
|
16141
16165
|
Ds as getScopedSequenceNoSeedOperations,
|
|
@@ -16146,11 +16170,11 @@ export {
|
|
|
16146
16170
|
So as indexBy,
|
|
16147
16171
|
Fr as isObject,
|
|
16148
16172
|
rt as isPlainObject,
|
|
16149
|
-
|
|
16173
|
+
In as isRequireSerializableRetry,
|
|
16150
16174
|
Mn as isRetryableTransactionError,
|
|
16151
16175
|
_o as isTransactionCapabilityError,
|
|
16152
16176
|
Vo as isTransactionRetryExhaustedError,
|
|
16153
|
-
|
|
16177
|
+
Io as mapObject,
|
|
16154
16178
|
kt as normalizeDatabaseError,
|
|
16155
16179
|
Re as normalizeScopedSequenceMatchExpression,
|
|
16156
16180
|
an as predicateSQLForOperator,
|