interaqt 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/core/EventSource.d.ts +3 -3
- package/dist/core/EventSource.d.ts.map +1 -1
- package/dist/drivers/Mysql.d.ts +2 -1
- package/dist/drivers/Mysql.d.ts.map +1 -1
- package/dist/drivers/PGLite.d.ts +2 -1
- package/dist/drivers/PGLite.d.ts.map +1 -1
- package/dist/drivers/PostgreSQL.d.ts +2 -1
- package/dist/drivers/PostgreSQL.d.ts.map +1 -1
- package/dist/drivers/SQLite.d.ts +2 -1
- package/dist/drivers/SQLite.d.ts.map +1 -1
- package/dist/index.js +781 -676
- package/dist/index.js.map +1 -1
- package/dist/runtime/Controller.d.ts +8 -0
- package/dist/runtime/Controller.d.ts.map +1 -1
- package/dist/runtime/MonoSystem.d.ts.map +1 -1
- package/dist/runtime/System.d.ts +3 -1
- package/dist/runtime/System.d.ts.map +1 -1
- package/dist/runtime/transaction.d.ts +34 -0
- package/dist/runtime/transaction.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { AsyncLocalStorage as
|
|
2
|
-
import { AsyncLocalStorage as
|
|
3
|
-
function
|
|
1
|
+
import { AsyncLocalStorage as Ie } from "node:async_hooks";
|
|
2
|
+
import { AsyncLocalStorage as $e } from "async_hooks";
|
|
3
|
+
function Ce(l) {
|
|
4
4
|
return l !== null && typeof l == "object";
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
if (!
|
|
6
|
+
function xe(l) {
|
|
7
|
+
if (!Ce(l)) return !1;
|
|
8
8
|
const t = Object.getPrototypeOf(l);
|
|
9
9
|
return t === null ? !0 : t === Object.prototype || t === null;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function zi(l, t) {
|
|
12
12
|
const e = {};
|
|
13
13
|
for (const r of l)
|
|
14
14
|
r && r[t] !== void 0 && (e[String(r[t])] = r);
|
|
15
15
|
return e;
|
|
16
16
|
}
|
|
17
17
|
function T(l) {
|
|
18
|
-
return typeof l == "function" ? `func::${l.toString()}` : Array.isArray(l) ? l :
|
|
18
|
+
return typeof l == "function" ? `func::${l.toString()}` : Array.isArray(l) ? l : Ce(l) && !xe(l) ? `uuid::${l.uuid}` : l;
|
|
19
19
|
}
|
|
20
20
|
function Et(l, t) {
|
|
21
21
|
if (l == null || typeof l != "object") return l;
|
|
22
22
|
if (Array.isArray(l)) return l.map((r) => Et(r, t));
|
|
23
|
-
if (
|
|
23
|
+
if (xe(l))
|
|
24
24
|
return Object.fromEntries(Object.entries(l).map(([r, i]) => [r, Et(i, t)]));
|
|
25
25
|
if (l instanceof Set)
|
|
26
26
|
return new Set(Array.from(l.values()).map((r) => Et(r, t)));
|
|
@@ -29,28 +29,28 @@ function Et(l, t) {
|
|
|
29
29
|
const e = l;
|
|
30
30
|
return t && e._type && e.constructor?.clone ? e.constructor.clone(l, t) : l;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Xi(...l) {
|
|
33
33
|
for (const t of l)
|
|
34
34
|
t.instances.length = 0;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
38
|
-
t && t.isKlass && t.displayName &&
|
|
36
|
+
const Yt = /* @__PURE__ */ new Map();
|
|
37
|
+
function Pe(l, t) {
|
|
38
|
+
t && t.isKlass && t.displayName && Yt.set(l, t);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Yi() {
|
|
41
41
|
const l = [];
|
|
42
|
-
return Array.from(
|
|
42
|
+
return Array.from(Yt.entries()).forEach(([, t]) => {
|
|
43
43
|
t.instances && Array.isArray(t.instances) && t.stringify && l.push(...t.instances.map((e) => t.stringify(e)));
|
|
44
44
|
}), `[${l.join(",")}]`;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Zi(l) {
|
|
47
47
|
const t = JSON.parse(l);
|
|
48
|
-
return
|
|
48
|
+
return Ye(t);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Ye(l) {
|
|
51
51
|
const t = /* @__PURE__ */ new Map();
|
|
52
52
|
return l.forEach(({ type: e, options: r = {}, uuid: i, public: s }) => {
|
|
53
|
-
const a =
|
|
53
|
+
const a = Yt.get(e);
|
|
54
54
|
if (!a) {
|
|
55
55
|
console.warn(`Class ${e} not found in KlassByName`);
|
|
56
56
|
return;
|
|
@@ -59,11 +59,11 @@ function Ke(l) {
|
|
|
59
59
|
t.set(i, n);
|
|
60
60
|
}), t;
|
|
61
61
|
}
|
|
62
|
-
let
|
|
62
|
+
let Ze = 0;
|
|
63
63
|
function E(l) {
|
|
64
|
-
return l?.uuid || `id_${++
|
|
64
|
+
return l?.uuid || `id_${++Ze}`;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const tr = /^[a-zA-Z0-9_]+$/;
|
|
67
67
|
class $ {
|
|
68
68
|
constructor(t, e) {
|
|
69
69
|
this._type = "Entity", this._options = e, this.uuid = E(e), this.name = t.name, this.properties = t.properties || [], this.computation = t.computation, this.baseEntity = t.baseEntity, this.matchExpression = t.matchExpression, this.inputEntities = t.inputEntities, this.commonProperties = t.commonProperties, this.constraints = t.constraints;
|
|
@@ -83,7 +83,7 @@ class $ {
|
|
|
83
83
|
type: "string",
|
|
84
84
|
required: !0,
|
|
85
85
|
constraints: {
|
|
86
|
-
nameFormat: ({ name: t }) =>
|
|
86
|
+
nameFormat: ({ name: t }) => tr.test(t)
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
properties: {
|
|
@@ -183,9 +183,9 @@ class $ {
|
|
|
183
183
|
return this.create(e.public, e.options);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
var
|
|
187
|
-
const
|
|
188
|
-
class
|
|
186
|
+
var Zt = /* @__PURE__ */ ((l) => (l.String = "string", l.Number = "number", l.Boolean = "boolean", l.Timestamp = "timestamp", l))(Zt || {});
|
|
187
|
+
const er = /^[a-zA-Z0-9_]+$/;
|
|
188
|
+
class te {
|
|
189
189
|
constructor(t, e) {
|
|
190
190
|
this._type = "Dictionary", this._options = e, this.uuid = E(e), this.name = t.name, this.type = t.type, this.collection = t.collection ?? !1, this.args = t.args, this.defaultValue = t.defaultValue, this.computation = t.computation;
|
|
191
191
|
}
|
|
@@ -205,14 +205,14 @@ class Xt {
|
|
|
205
205
|
required: !0,
|
|
206
206
|
collection: !1,
|
|
207
207
|
constraints: {
|
|
208
|
-
format: ({ name: t }) =>
|
|
208
|
+
format: ({ name: t }) => er.test(t)
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
211
|
type: {
|
|
212
212
|
type: "string",
|
|
213
213
|
required: !0,
|
|
214
214
|
collection: !1,
|
|
215
|
-
options: Array.from(Object.values(
|
|
215
|
+
options: Array.from(Object.values(Zt))
|
|
216
216
|
},
|
|
217
217
|
collection: {
|
|
218
218
|
type: "boolean",
|
|
@@ -238,7 +238,7 @@ class Xt {
|
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
static create(t, e) {
|
|
241
|
-
const r = new
|
|
241
|
+
const r = new te(t, e);
|
|
242
242
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
243
243
|
throw new Error(`duplicate uuid in options ${r.uuid}, Dictionary`);
|
|
244
244
|
return this.instances.push(r), r;
|
|
@@ -277,7 +277,7 @@ class Xt {
|
|
|
277
277
|
return this.create(e.public, e.options);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
const
|
|
280
|
+
const rr = /^[a-zA-Z0-9_]+$/;
|
|
281
281
|
class N {
|
|
282
282
|
constructor(t, e) {
|
|
283
283
|
this._type = "Property", this._options = e, this.uuid = E(e), this.name = t.name, this.type = t.type, this.collection = t.collection, this.defaultValue = t.defaultValue, this.computed = t.computed, this.computation = t.computation;
|
|
@@ -297,13 +297,13 @@ class N {
|
|
|
297
297
|
type: "string",
|
|
298
298
|
required: !0,
|
|
299
299
|
constraints: {
|
|
300
|
-
format: ({ name: t }) =>
|
|
300
|
+
format: ({ name: t }) => rr.test(t)
|
|
301
301
|
}
|
|
302
302
|
},
|
|
303
303
|
type: {
|
|
304
304
|
type: "string",
|
|
305
305
|
required: !0,
|
|
306
|
-
options: () => Object.values(
|
|
306
|
+
options: () => Object.values(Zt)
|
|
307
307
|
},
|
|
308
308
|
collection: {
|
|
309
309
|
type: "boolean",
|
|
@@ -549,8 +549,8 @@ class x {
|
|
|
549
549
|
return this.create(e.public, e.options);
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
const
|
|
553
|
-
class
|
|
552
|
+
const ir = /^[a-zA-Z0-9_]+$/;
|
|
553
|
+
class ee {
|
|
554
554
|
constructor(t, e) {
|
|
555
555
|
this._type = "UniqueConstraint", this._options = e, this.uuid = E(e), this.name = t.name, this.properties = t.properties, this.where = t.where, this.violationCode = t.violationCode;
|
|
556
556
|
}
|
|
@@ -569,7 +569,7 @@ class Yt {
|
|
|
569
569
|
type: "string",
|
|
570
570
|
required: !0,
|
|
571
571
|
constraints: {
|
|
572
|
-
nameFormat: ({ name: t }) =>
|
|
572
|
+
nameFormat: ({ name: t }) => ir.test(t)
|
|
573
573
|
}
|
|
574
574
|
},
|
|
575
575
|
properties: {
|
|
@@ -594,7 +594,7 @@ class Yt {
|
|
|
594
594
|
};
|
|
595
595
|
}
|
|
596
596
|
static create(t, e) {
|
|
597
|
-
const r = new
|
|
597
|
+
const r = new ee(t, e);
|
|
598
598
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
599
599
|
throw new Error(`duplicate uuid in options ${r.uuid}, UniqueConstraint`);
|
|
600
600
|
return this.instances.push(r), r;
|
|
@@ -695,7 +695,7 @@ class tt {
|
|
|
695
695
|
return this.create(e.public, e.options);
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
class
|
|
698
|
+
class re {
|
|
699
699
|
constructor(t, e) {
|
|
700
700
|
this._type = "StateTransfer", this._options = e, this.uuid = E(e), this.trigger = t.trigger, this.current = t.current, this.next = t.next, this.computeTarget = t.computeTarget;
|
|
701
701
|
}
|
|
@@ -733,7 +733,7 @@ class Zt {
|
|
|
733
733
|
};
|
|
734
734
|
}
|
|
735
735
|
static create(t, e) {
|
|
736
|
-
const r = new
|
|
736
|
+
const r = new re(t, e);
|
|
737
737
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
738
738
|
throw new Error(`duplicate uuid in options ${r.uuid}, StateTransfer`);
|
|
739
739
|
return this.instances.push(r), r;
|
|
@@ -1326,7 +1326,7 @@ class gt {
|
|
|
1326
1326
|
return typeof i.callback == "string" && i.callback.startsWith("func::") && (r.callback = new Function("return " + i.callback.substring(6))()), this.create(r, e.options);
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
class
|
|
1329
|
+
class Mt {
|
|
1330
1330
|
constructor(t, e) {
|
|
1331
1331
|
this._type = "Transform", this._options = e, this.uuid = E(e), this.record = t.record, this.eventDeps = t.eventDeps, this.attributeQuery = t.attributeQuery, this.callback = t.callback;
|
|
1332
1332
|
}
|
|
@@ -1359,7 +1359,7 @@ class xt {
|
|
|
1359
1359
|
};
|
|
1360
1360
|
}
|
|
1361
1361
|
static create(t, e) {
|
|
1362
|
-
const r = new
|
|
1362
|
+
const r = new Mt(t, e);
|
|
1363
1363
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
1364
1364
|
throw new Error(`duplicate uuid in options ${r.uuid}, Transform`);
|
|
1365
1365
|
return this.instances.push(r), r;
|
|
@@ -1469,7 +1469,7 @@ class bt {
|
|
|
1469
1469
|
return typeof r.callback == "string" && r.callback.startsWith("func::") && (r.callback = new Function("return " + r.callback.substring(6))()), typeof r.nextRecomputeTime == "string" && r.nextRecomputeTime.startsWith("func::") && (r.nextRecomputeTime = new Function("return " + r.nextRecomputeTime.substring(6))()), this.create(r, e.options);
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
class
|
|
1472
|
+
class ie {
|
|
1473
1473
|
constructor(t, e) {
|
|
1474
1474
|
this._type = "SideEffect", this._options = e, this.uuid = E(e), this.name = t.name, this.handle = t.handle;
|
|
1475
1475
|
}
|
|
@@ -1497,7 +1497,7 @@ class te {
|
|
|
1497
1497
|
};
|
|
1498
1498
|
}
|
|
1499
1499
|
static create(t, e) {
|
|
1500
|
-
const r = new
|
|
1500
|
+
const r = new ie(t, e);
|
|
1501
1501
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
1502
1502
|
throw new Error(`duplicate uuid in options ${r.uuid}, SideEffect`);
|
|
1503
1503
|
return this.instances.push(r), r;
|
|
@@ -1814,13 +1814,13 @@ class w {
|
|
|
1814
1814
|
throw new Error(`invalid bool expression type: ${JSON.stringify(this.raw)}`);
|
|
1815
1815
|
}
|
|
1816
1816
|
}
|
|
1817
|
-
const
|
|
1817
|
+
const sr = [
|
|
1818
1818
|
$,
|
|
1819
1819
|
x,
|
|
1820
1820
|
N,
|
|
1821
|
-
|
|
1821
|
+
ee,
|
|
1822
1822
|
tt,
|
|
1823
|
-
|
|
1823
|
+
re,
|
|
1824
1824
|
dt,
|
|
1825
1825
|
ht,
|
|
1826
1826
|
pt,
|
|
@@ -1828,17 +1828,17 @@ const er = [
|
|
|
1828
1828
|
mt,
|
|
1829
1829
|
yt,
|
|
1830
1830
|
gt,
|
|
1831
|
-
|
|
1831
|
+
Mt,
|
|
1832
1832
|
bt,
|
|
1833
|
+
ie,
|
|
1833
1834
|
te,
|
|
1834
|
-
Xt,
|
|
1835
1835
|
Rt,
|
|
1836
1836
|
wt
|
|
1837
1837
|
];
|
|
1838
|
-
|
|
1839
|
-
l && l.displayName &&
|
|
1838
|
+
sr.forEach((l) => {
|
|
1839
|
+
l && l.displayName && Pe(l.displayName, l);
|
|
1840
1840
|
});
|
|
1841
|
-
class
|
|
1841
|
+
class Me {
|
|
1842
1842
|
constructor(t = [], e = []) {
|
|
1843
1843
|
this.clonedEntities = /* @__PURE__ */ new Map(), this.clonedRelations = /* @__PURE__ */ new Map(), this.reverseEntityMap = /* @__PURE__ */ new Map(), this.reverseRelationMap = /* @__PURE__ */ new Map(), this.originalEntities = [...t], this.originalRelations = [...e], (t.length > 0 || e.length > 0) && this.initializeClones();
|
|
1844
1844
|
}
|
|
@@ -2049,7 +2049,7 @@ class $e {
|
|
|
2049
2049
|
return null;
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
|
-
class
|
|
2052
|
+
class se {
|
|
2053
2053
|
constructor(t, e) {
|
|
2054
2054
|
if (this._type = "Custom", this._options = e, this.uuid = E(e), this.name = t.name, this.dataDeps = t.dataDeps, this.compute = t.compute, this.incrementalCompute = t.incrementalCompute, this.incrementalPatchCompute = t.incrementalPatchCompute, this.createState = t.createState, this.getInitialValue = t.getInitialValue, this.asyncReturn = t.asyncReturn, this.useLastValue = t.useLastValue, t.concurrency !== void 0 && t.concurrency !== "serializable" && t.concurrency !== "atomic-safe")
|
|
2055
2055
|
throw new Error(`Invalid Custom concurrency '${t.concurrency}'. Expected 'serializable' or 'atomic-safe'.`);
|
|
@@ -2119,7 +2119,7 @@ class ee {
|
|
|
2119
2119
|
};
|
|
2120
2120
|
}
|
|
2121
2121
|
static create(t, e) {
|
|
2122
|
-
const r = new
|
|
2122
|
+
const r = new se(t, e);
|
|
2123
2123
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
2124
2124
|
throw new Error(`duplicate uuid in options ${r.uuid}, Custom`);
|
|
2125
2125
|
return this.instances.push(r), r;
|
|
@@ -2164,7 +2164,7 @@ class ee {
|
|
|
2164
2164
|
}), this.create(r, e.options);
|
|
2165
2165
|
}
|
|
2166
2166
|
}
|
|
2167
|
-
class
|
|
2167
|
+
class Oe {
|
|
2168
2168
|
constructor(t, e) {
|
|
2169
2169
|
this._type = "EventSource", this._options = e, this.uuid = E(e), this.name = t.name, this.entity = t.entity, this.guard = t.guard, this.mapEventData = t.mapEventData, this.resolve = t.resolve, this.afterDispatch = t.afterDispatch, this.postCommit = t.postCommit;
|
|
2170
2170
|
}
|
|
@@ -2178,7 +2178,7 @@ class Ce {
|
|
|
2178
2178
|
this.instances = [];
|
|
2179
2179
|
}
|
|
2180
2180
|
static create(t, e) {
|
|
2181
|
-
const r = new
|
|
2181
|
+
const r = new Oe(t, e);
|
|
2182
2182
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
2183
2183
|
throw new Error(`duplicate uuid in options ${r.uuid}, EventSource`);
|
|
2184
2184
|
return this.instances.push(r), r;
|
|
@@ -2221,7 +2221,7 @@ function R(l, t) {
|
|
|
2221
2221
|
if (!l)
|
|
2222
2222
|
throw new Error(t);
|
|
2223
2223
|
}
|
|
2224
|
-
function
|
|
2224
|
+
function qt(l, t, e) {
|
|
2225
2225
|
const r = [...t];
|
|
2226
2226
|
let i = l, s;
|
|
2227
2227
|
const a = r.pop();
|
|
@@ -2229,7 +2229,7 @@ function Vt(l, t, e) {
|
|
|
2229
2229
|
i[s] || (i[s] = {}), i = i[s];
|
|
2230
2230
|
return i[a] = e, !0;
|
|
2231
2231
|
}
|
|
2232
|
-
class
|
|
2232
|
+
class K {
|
|
2233
2233
|
constructor(t, e, r, i) {
|
|
2234
2234
|
this.parentEntityName = t, this.attributeName = e, this.map = r, this.symmetricDirection = i, this.data = this.map.getAttributeData(t, e), R(!!this.data, `${t} has no attribute: ${e}`);
|
|
2235
2235
|
}
|
|
@@ -2356,14 +2356,14 @@ class G {
|
|
|
2356
2356
|
return R(this.isLinkFiltered(), "only filtered relation can get match expression"), this.data.matchExpression;
|
|
2357
2357
|
}
|
|
2358
2358
|
getBaseAttributeInfo() {
|
|
2359
|
-
return R(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new
|
|
2359
|
+
return R(this.isLinkFiltered(), "only filtered relation can get base attribute info"), new K(this.parentEntityName, this.data.baseRelationAttributeName, this.map, this.symmetricDirection);
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
2362
|
class y {
|
|
2363
2363
|
constructor(t, e, r, i, s) {
|
|
2364
2364
|
this.map = e, this.contextRootEntity = i, this.fromRelation = s, R(!r || r instanceof w, `match data is not a BoolExpression instance, you passed: ${this.data}`);
|
|
2365
2365
|
const a = this.map.getRecordInfo(t);
|
|
2366
|
-
this.entityName = a.resolvedBaseRecordName, this.xToOneQueryTree = new
|
|
2366
|
+
this.entityName = a.resolvedBaseRecordName, this.xToOneQueryTree = new Q(this.entityName, this.map);
|
|
2367
2367
|
let n = r;
|
|
2368
2368
|
a.resolvedMatchExpression && (n = r ? a.resolvedMatchExpression.and(r) : a.resolvedMatchExpression), n && (this.data = this.convertFilteredRelation(n), this.buildQueryTree(this.data, this.xToOneQueryTree));
|
|
2369
2369
|
}
|
|
@@ -2584,7 +2584,7 @@ class y {
|
|
|
2584
2584
|
);
|
|
2585
2585
|
}
|
|
2586
2586
|
}
|
|
2587
|
-
class
|
|
2587
|
+
class ar {
|
|
2588
2588
|
constructor(t, e, r, i) {
|
|
2589
2589
|
this.recordName = t, this.map = e, this.data = r, this.fromRelation = i;
|
|
2590
2590
|
}
|
|
@@ -2606,7 +2606,7 @@ class rr {
|
|
|
2606
2606
|
* 用于确保 ORDER BY 中引用的关联字段会触发相应的 JOIN
|
|
2607
2607
|
*/
|
|
2608
2608
|
get xToOneQueryTree() {
|
|
2609
|
-
const t = new
|
|
2609
|
+
const t = new Q(this.recordName, this.map);
|
|
2610
2610
|
return Object.keys(this.data?.orderBy || {}).forEach((e) => {
|
|
2611
2611
|
const r = e.split(".");
|
|
2612
2612
|
if (r.length === 1) {
|
|
@@ -2632,7 +2632,7 @@ class P {
|
|
|
2632
2632
|
e,
|
|
2633
2633
|
f,
|
|
2634
2634
|
new C(d, e, r.attributeQuery || [], s, a),
|
|
2635
|
-
new
|
|
2635
|
+
new ar(d, e, r.modifier),
|
|
2636
2636
|
i,
|
|
2637
2637
|
s,
|
|
2638
2638
|
a,
|
|
@@ -2671,7 +2671,7 @@ class P {
|
|
|
2671
2671
|
);
|
|
2672
2672
|
}
|
|
2673
2673
|
}
|
|
2674
|
-
class
|
|
2674
|
+
class Q {
|
|
2675
2675
|
// 父节点和自己这个几点 link 上的 query
|
|
2676
2676
|
constructor(t, e, r, i, s, a, n) {
|
|
2677
2677
|
this.recordName = t, this.map = e, this.parentRecord = r, this.attributeName = i, this.data = s, this.parent = a, this.parentLinkQueryTree = n, this.fields = [], R(!!t, "recordName cannot be empty"), this.fields = s?.fields || [], this.records = s?.records || {}, r && (this.info = this.map.getInfo(this.parentRecord, this.attributeName));
|
|
@@ -2681,26 +2681,26 @@ class q {
|
|
|
2681
2681
|
if (t.length === 1)
|
|
2682
2682
|
this.fields.push(e);
|
|
2683
2683
|
else if (e === m)
|
|
2684
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2684
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new Q(this.info.linkName, this.map)), this.parentLinkQueryTree.addField(r);
|
|
2685
2685
|
else {
|
|
2686
2686
|
const i = this.map.getInfo(this.recordName, e);
|
|
2687
|
-
this.records[e] || (this.records[e] = new
|
|
2687
|
+
this.records[e] || (this.records[e] = new Q(i.recordName, this.map, this.recordName, e, void 0, this)), this.records[e].addField(r);
|
|
2688
2688
|
}
|
|
2689
2689
|
}
|
|
2690
2690
|
addRecord(t, e) {
|
|
2691
2691
|
const [r, ...i] = t;
|
|
2692
2692
|
if (t.length === 1)
|
|
2693
2693
|
if (r === m)
|
|
2694
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2694
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new Q(this.info.linkName, this.map)), e && (this.parentLinkQueryTree = this.parentLinkQueryTree.merge(e));
|
|
2695
2695
|
else {
|
|
2696
|
-
const s = this.map.getInfo(this.recordName, r), a = e || new
|
|
2696
|
+
const s = this.map.getInfo(this.recordName, r), a = e || new Q(s.recordName, this.map, this.recordName, r, void 0, this);
|
|
2697
2697
|
this.records[r] = this.records[r] ? this.records[r].merge(a) : a;
|
|
2698
2698
|
}
|
|
2699
2699
|
else if (r === m)
|
|
2700
|
-
this.parentLinkQueryTree || (this.parentLinkQueryTree = new
|
|
2700
|
+
this.parentLinkQueryTree || (this.parentLinkQueryTree = new Q(this.info.linkName, this.map)), this.parentLinkQueryTree.addRecord(i, e);
|
|
2701
2701
|
else {
|
|
2702
2702
|
const s = this.map.getInfo(this.recordName, r);
|
|
2703
|
-
this.records[r] = new
|
|
2703
|
+
this.records[r] = new Q(s.recordName, this.map, this.recordName, r, void 0, this), this.records[r].addRecord(i, e);
|
|
2704
2704
|
}
|
|
2705
2705
|
}
|
|
2706
2706
|
forEachRecords(t) {
|
|
@@ -2715,7 +2715,7 @@ class q {
|
|
|
2715
2715
|
this.records[a] && t.records[a] ? i[a] = this.records[a].merge(t.records[a]) : this.records[a] ? i[a] = this.records[a] : i[a] = t.records[a];
|
|
2716
2716
|
});
|
|
2717
2717
|
let s;
|
|
2718
|
-
return this.parentLinkQueryTree && t.parentLinkQueryTree ? s = this.parentLinkQueryTree.merge(t.parentLinkQueryTree) : s = this.parentLinkQueryTree || t.parentLinkQueryTree, new
|
|
2718
|
+
return this.parentLinkQueryTree && t.parentLinkQueryTree ? s = this.parentLinkQueryTree.merge(t.parentLinkQueryTree) : s = this.parentLinkQueryTree || t.parentLinkQueryTree, new Q(this.recordName, this.map, this.parentRecord, this.attributeName, { fields: e, records: i }, this.parent, s);
|
|
2719
2719
|
}
|
|
2720
2720
|
getData() {
|
|
2721
2721
|
const t = {
|
|
@@ -2726,7 +2726,7 @@ class q {
|
|
|
2726
2726
|
}), this.parentLinkQueryTree && (t[m] = this.parentLinkQueryTree.getData()), t;
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
2729
|
-
const m = "&",
|
|
2729
|
+
const m = "&", nr = "*";
|
|
2730
2730
|
class C {
|
|
2731
2731
|
constructor(t, e, r = [], i, s, a) {
|
|
2732
2732
|
this.recordName = t, this.map = e, this.data = r, this.parentRecord = i, this.attributeName = s, this.shouldQueryParentLinkData = a, this.relatedRecords = [], this.xToManyRecords = [], this.xToOneRecords = [], this.valueAttributes = [], this.id = Math.random();
|
|
@@ -2739,7 +2739,7 @@ class C {
|
|
|
2739
2739
|
this.parentLinkRecordQuery = P.create(f.linkName, this.map, d, void 0);
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
2742
|
-
if (u ===
|
|
2742
|
+
if (u === nr) {
|
|
2743
2743
|
n = new Set(this.map.getRecordInfo(this.recordName).valueAttributes.map((f) => f.attributeName));
|
|
2744
2744
|
return;
|
|
2745
2745
|
}
|
|
@@ -2848,7 +2848,7 @@ class C {
|
|
|
2848
2848
|
return this.buildXToOneQueryTree();
|
|
2849
2849
|
}
|
|
2850
2850
|
buildXToOneQueryTree() {
|
|
2851
|
-
const t = new
|
|
2851
|
+
const t = new Q(this.recordName, this.map, this.parentRecord, this.attributeName);
|
|
2852
2852
|
if (this.data.forEach((e) => {
|
|
2853
2853
|
Array.isArray(e) || t.addField([e]);
|
|
2854
2854
|
}), this.xToOneRecords.forEach((e) => {
|
|
@@ -2860,7 +2860,7 @@ class C {
|
|
|
2860
2860
|
return t;
|
|
2861
2861
|
}
|
|
2862
2862
|
buildFullQueryTree() {
|
|
2863
|
-
const t = new
|
|
2863
|
+
const t = new Q(this.recordName, this.map, this.parentRecord, this.attributeName);
|
|
2864
2864
|
return this.relatedRecords.forEach((e) => {
|
|
2865
2865
|
t.addRecord([e.attributeName], e.attributeQuery.fullQueryTree);
|
|
2866
2866
|
}), t;
|
|
@@ -2869,18 +2869,18 @@ class C {
|
|
|
2869
2869
|
return this.parentLinkRecordQuery ? new C(this.recordName, this.map, this.data, this.parentRecord, this.attributeName, !0) : this;
|
|
2870
2870
|
}
|
|
2871
2871
|
}
|
|
2872
|
-
function
|
|
2872
|
+
function or(l) {
|
|
2873
2873
|
const t = [];
|
|
2874
2874
|
return l.forEach((e) => t.push(...Array.isArray(e) ? e : [e])), t;
|
|
2875
2875
|
}
|
|
2876
|
-
class
|
|
2876
|
+
class q {
|
|
2877
2877
|
constructor(t, e, r, i) {
|
|
2878
2878
|
this.map = t, this.originalRecordName = e, this.rawData = r, this.info = i, this.mergedLinkTargetNewRecords = [], this.mergedLinkTargetRecordIdRefs = [], this.mergedLinkTargetNullRecords = [], this.combinedNewRecords = [], this.combinedRecordIdRefs = [], this.combinedNullRecords = [], this.differentTableMergedLinkNewRecords = [], this.differentTableMergedLinkRecordIdRefs = [], this.differentTableMergedLinkNullRecords = [], this.isolatedNewRecords = [], this.isolatedRecordIdRefs = [], this.isolatedNullRecords = [], this.entityIdAttributes = [], this.relatedEntitiesData = [], this.valueAttributes = [], this.sameRowEntityIdRefs = [], this.defaultValues = {};
|
|
2879
2879
|
const s = this.map.getRecordInfo(e);
|
|
2880
2880
|
this.recordName = s.resolvedBaseRecordName;
|
|
2881
2881
|
const [a, n, o] = this.map.groupAttributes(this.recordName, r ? Object.keys(r) : []);
|
|
2882
|
-
this.relatedEntitiesData =
|
|
2883
|
-
(u) => Array.isArray(r[u.attributeName]) ? r[u.attributeName].map((d) => new
|
|
2882
|
+
this.relatedEntitiesData = or(n.map(
|
|
2883
|
+
(u) => Array.isArray(r[u.attributeName]) ? r[u.attributeName].map((d) => new q(this.map, u.recordName, d, u)) : new q(this.map, u.recordName, r[u.attributeName], u)
|
|
2884
2884
|
)), this.valueAttributes = a, this.entityIdAttributes = o;
|
|
2885
2885
|
const c = this.map.getRecordInfo(this.recordName);
|
|
2886
2886
|
this.defaultValues = c.valueAttributes.reduce((u, d) => {
|
|
@@ -2888,10 +2888,10 @@ class L {
|
|
|
2888
2888
|
return !this.rawData?.hasOwnProperty(d.attributeName) && h.defaultValue && typeof h.defaultValue == "function" && (u[d.attributeName] = h.defaultValue(r, this.originalRecordName)), u;
|
|
2889
2889
|
}, {}), this.relatedEntitiesData.forEach((u) => {
|
|
2890
2890
|
u.info.isMergedWithParent() ? u.isNull() ? this.combinedNullRecords.push(u) : u.isRef() ? this.combinedRecordIdRefs.push(u) : this.combinedNewRecords.push(u) : u.info.isLinkMergedWithParent() ? u.isNull() ? this.mergedLinkTargetNullRecords.push(u) : u.isRef() ? this.mergedLinkTargetRecordIdRefs.push(u) : this.mergedLinkTargetNewRecords.push(u) : u.info.isLinkMergedWithAttribute() ? u.isNull() ? this.differentTableMergedLinkNullRecords.push(u) : u.isRef() ? this.differentTableMergedLinkRecordIdRefs.push(u) : this.differentTableMergedLinkNewRecords.push(u) : u.isNull() ? this.isolatedNullRecords.push(u) : u.isRef() ? this.isolatedRecordIdRefs.push(u) : this.isolatedNewRecords.push(u);
|
|
2891
|
-
}), this.rawData?.[m] && (this.linkRecordData = new
|
|
2891
|
+
}), this.rawData?.[m] && (this.linkRecordData = new q(this.map, i?.linkName, this.rawData[m]));
|
|
2892
2892
|
}
|
|
2893
2893
|
merge(t) {
|
|
2894
|
-
const e = new
|
|
2894
|
+
const e = new q(this.map, this.originalRecordName, { ...this.rawData, ...t }, this.info);
|
|
2895
2895
|
return this.recordName !== this.originalRecordName && (e.recordName = this.recordName), e;
|
|
2896
2896
|
}
|
|
2897
2897
|
getRef() {
|
|
@@ -2956,7 +2956,7 @@ class L {
|
|
|
2956
2956
|
}), r;
|
|
2957
2957
|
}
|
|
2958
2958
|
}
|
|
2959
|
-
class
|
|
2959
|
+
class cr {
|
|
2960
2960
|
constructor(t, e, r, i, s, a) {
|
|
2961
2961
|
this.map = t, this.database = e, this.queryExecutor = r, this.helper = a, this.sqlBuilder = s, this.filteredEntityManager = i;
|
|
2962
2962
|
}
|
|
@@ -3079,7 +3079,7 @@ class ar {
|
|
|
3079
3079
|
}), o = {
|
|
3080
3080
|
[a.attributeName]: r,
|
|
3081
3081
|
[m]: s.getData()[m]
|
|
3082
|
-
}, [c] = await this.helper.updateRecord(a.parentEntityName, n, new
|
|
3082
|
+
}, [c] = await this.helper.updateRecord(a.parentEntityName, n, new q(this.map, a.parentEntityName, o), e);
|
|
3083
3083
|
s.info.isXToMany ? (i[s.info.attributeName] || (i[s.info.attributeName] = []), i[s.info.attributeName].push({
|
|
3084
3084
|
...c,
|
|
3085
3085
|
[m]: c[a.attributeName][m]
|
|
@@ -3094,7 +3094,7 @@ class ar {
|
|
|
3094
3094
|
source: s.info.isRecordSource() ? r : a,
|
|
3095
3095
|
target: s.info.isRecordSource() ? a : r
|
|
3096
3096
|
});
|
|
3097
|
-
const o = new
|
|
3097
|
+
const o = new q(this.map, s.info.linkName, n), c = await this.createRecord(o, `create isolated related link record ${t.recordName}.${s.info?.attributeName}`, e);
|
|
3098
3098
|
s.info.isXToMany ? (i[s.info.attributeName] || (i[s.info.attributeName] = []), i[s.info.attributeName].push({
|
|
3099
3099
|
...a,
|
|
3100
3100
|
[m]: c
|
|
@@ -3117,7 +3117,7 @@ class ar {
|
|
|
3117
3117
|
source: a.info.isRecordSource() ? r : a.getRef(),
|
|
3118
3118
|
target: a.info.isRecordSource() ? a.getRef() : r
|
|
3119
3119
|
});
|
|
3120
|
-
const o = new
|
|
3120
|
+
const o = new q(this.map, a.info.linkName, n), c = await this.createRecord(o, `create isolated related link record of old related ${t.recordName}.${a.info?.attributeName}`, e);
|
|
3121
3121
|
a.info.isXToMany ? (i[a.info.attributeName] || (i[a.info.attributeName] = []), i[a.info.attributeName][s] = {
|
|
3122
3122
|
...a.getData(),
|
|
3123
3123
|
[m]: c
|
|
@@ -3157,7 +3157,7 @@ class ar {
|
|
|
3157
3157
|
});
|
|
3158
3158
|
await this.helper.unlink(t, h, !1, "unlink combined record for add new link", a);
|
|
3159
3159
|
}
|
|
3160
|
-
const c = new
|
|
3160
|
+
const c = new q(this.map, o.name, {
|
|
3161
3161
|
source: { id: e },
|
|
3162
3162
|
target: { id: r },
|
|
3163
3163
|
...i
|
|
@@ -3169,7 +3169,7 @@ class ar {
|
|
|
3169
3169
|
* 这是一个辅助方法,实际的删除逻辑在 RecordQueryAgent 中
|
|
3170
3170
|
*/
|
|
3171
3171
|
}
|
|
3172
|
-
class
|
|
3172
|
+
class lr {
|
|
3173
3173
|
constructor(t, e) {
|
|
3174
3174
|
this.map = t, this.queryAgent = e, this.dependencies = /* @__PURE__ */ new Map();
|
|
3175
3175
|
}
|
|
@@ -3395,7 +3395,7 @@ class nr {
|
|
|
3395
3395
|
}
|
|
3396
3396
|
}
|
|
3397
3397
|
}
|
|
3398
|
-
class
|
|
3398
|
+
class ur {
|
|
3399
3399
|
constructor() {
|
|
3400
3400
|
this.aliasToPath = /* @__PURE__ */ new Map(), this.pathStrToAlias = /* @__PURE__ */ new Map(), this.aliasPlaceholder = 0;
|
|
3401
3401
|
}
|
|
@@ -3418,7 +3418,7 @@ class or {
|
|
|
3418
3418
|
return this.aliasToPath.get(t);
|
|
3419
3419
|
}
|
|
3420
3420
|
}
|
|
3421
|
-
class
|
|
3421
|
+
class dr {
|
|
3422
3422
|
constructor(t, e) {
|
|
3423
3423
|
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (r) => "?");
|
|
3424
3424
|
}
|
|
@@ -3460,7 +3460,7 @@ ${v}
|
|
|
3460
3460
|
* 构建 SELECT 子句
|
|
3461
3461
|
*/
|
|
3462
3462
|
buildSelectClause(t, e = "") {
|
|
3463
|
-
const r = new
|
|
3463
|
+
const r = new ur();
|
|
3464
3464
|
return t.length ? [t.map(({ tableAliasAndField: s, attribute: a, nameContext: n }) => {
|
|
3465
3465
|
const o = [
|
|
3466
3466
|
`${this.withPrefix(e)}${n[0]}`,
|
|
@@ -3700,7 +3700,7 @@ WHERE ${s}
|
|
|
3700
3700
|
return e?.toLowerCase() === "json" ? JSON.stringify(t) : t;
|
|
3701
3701
|
}
|
|
3702
3702
|
}
|
|
3703
|
-
const
|
|
3703
|
+
const $t = ":root";
|
|
3704
3704
|
class Y {
|
|
3705
3705
|
constructor(t, e, r = []) {
|
|
3706
3706
|
this.label = t, this.parent = e, this.stack = r;
|
|
@@ -3718,9 +3718,9 @@ class Y {
|
|
|
3718
3718
|
return new Y(t, this);
|
|
3719
3719
|
}
|
|
3720
3720
|
}
|
|
3721
|
-
class
|
|
3721
|
+
class hr {
|
|
3722
3722
|
constructor(t) {
|
|
3723
|
-
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set(
|
|
3723
|
+
this.recordQuery = t, this.recordQueryByName = /* @__PURE__ */ new Map(), this.set($t, t), this.recursiveSaveLabelledRecordQuery(t);
|
|
3724
3724
|
}
|
|
3725
3725
|
recursiveSaveLabelledRecordQuery(t) {
|
|
3726
3726
|
t.attributeQuery?.relatedRecords.forEach((e) => {
|
|
@@ -3734,7 +3734,7 @@ class lr {
|
|
|
3734
3734
|
return this.recordQueryByName.get(t);
|
|
3735
3735
|
}
|
|
3736
3736
|
}
|
|
3737
|
-
class
|
|
3737
|
+
class pr {
|
|
3738
3738
|
constructor(t, e, r) {
|
|
3739
3739
|
this.map = t, this.database = e, this.sqlBuilder = r;
|
|
3740
3740
|
}
|
|
@@ -3750,7 +3750,7 @@ class ur {
|
|
|
3750
3750
|
const s = {};
|
|
3751
3751
|
return Object.entries(i).forEach(([a, n]) => {
|
|
3752
3752
|
const o = r.getPath(a).slice(1, 1 / 0);
|
|
3753
|
-
o.length === 1 && e.includes(o[0]) && typeof n == "string" && (n = JSON.parse(n)), n !== null &&
|
|
3753
|
+
o.length === 1 && e.includes(o[0]) && typeof n == "string" && (n = JSON.parse(n)), n !== null && qt(s, o, n);
|
|
3754
3754
|
}), s;
|
|
3755
3755
|
});
|
|
3756
3756
|
}
|
|
@@ -3758,8 +3758,8 @@ class ur {
|
|
|
3758
3758
|
* 查找记录(主查询方法)
|
|
3759
3759
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
3760
3760
|
*/
|
|
3761
|
-
async findRecords(t, e = "", r, i = new Y(
|
|
3762
|
-
if (r || (r = new
|
|
3761
|
+
async findRecords(t, e = "", r, i = new Y($t), s = !1) {
|
|
3762
|
+
if (r || (r = new hr(t)), t.goto) {
|
|
3763
3763
|
if (t.exit && await t.exit(i))
|
|
3764
3764
|
return [];
|
|
3765
3765
|
const p = r.get(t.goto);
|
|
@@ -3787,8 +3787,8 @@ FOR UPDATE` : a,
|
|
|
3787
3787
|
value: ["=", g.id]
|
|
3788
3788
|
}), I = p.derive({
|
|
3789
3789
|
matchExpression: v
|
|
3790
|
-
}),
|
|
3791
|
-
g[p.alias || p.attributeName] = await this.findRecords(I, e, r,
|
|
3790
|
+
}), V = t.label ? h.concat(g) : h;
|
|
3791
|
+
g[p.alias || p.attributeName] = await this.findRecords(I, e, r, V);
|
|
3792
3792
|
}
|
|
3793
3793
|
}
|
|
3794
3794
|
for (let p of t.attributeQuery.xToOneRecords) {
|
|
@@ -3797,13 +3797,13 @@ FOR UPDATE` : a,
|
|
|
3797
3797
|
for (let b of f.attributeQuery.xToManyRecords) {
|
|
3798
3798
|
const v = this.map.getInfo(b.parentRecord, b.attributeName).getReverseInfo()?.attributeName;
|
|
3799
3799
|
for (let I of d) {
|
|
3800
|
-
const
|
|
3800
|
+
const V = I[p.attributeName][m].id, _ = b.derive({
|
|
3801
3801
|
matchExpression: b.matchExpression.and({
|
|
3802
3802
|
key: `${v}.id`,
|
|
3803
|
-
value: ["=",
|
|
3803
|
+
value: ["=", V]
|
|
3804
3804
|
})
|
|
3805
3805
|
}), J = t.label ? h.concat(I) : h;
|
|
3806
|
-
|
|
3806
|
+
qt(
|
|
3807
3807
|
I,
|
|
3808
3808
|
[p.alias || p.attributeName, m, b.attributeName],
|
|
3809
3809
|
await this.findRecords(
|
|
@@ -3898,8 +3898,8 @@ FOR UPDATE` : a,
|
|
|
3898
3898
|
if (b)
|
|
3899
3899
|
for (let g of b.attributeQuery.xToManyRecords)
|
|
3900
3900
|
for (let v of p) {
|
|
3901
|
-
const I = v[m].id,
|
|
3902
|
-
|
|
3901
|
+
const I = v[m].id, V = d.label ? f.concat(v) : f;
|
|
3902
|
+
qt(
|
|
3903
3903
|
v,
|
|
3904
3904
|
[m, g.attributeName],
|
|
3905
3905
|
await this.findXToManyRelatedRecords(
|
|
@@ -3908,7 +3908,7 @@ FOR UPDATE` : a,
|
|
|
3908
3908
|
I,
|
|
3909
3909
|
g,
|
|
3910
3910
|
s,
|
|
3911
|
-
|
|
3911
|
+
V
|
|
3912
3912
|
)
|
|
3913
3913
|
);
|
|
3914
3914
|
}
|
|
@@ -3942,7 +3942,7 @@ FOR UPDATE` : a,
|
|
|
3942
3942
|
return p ? [b, ...p] : void 0;
|
|
3943
3943
|
}
|
|
3944
3944
|
}
|
|
3945
|
-
class
|
|
3945
|
+
class fr {
|
|
3946
3946
|
constructor(t, e, r, i, s, a) {
|
|
3947
3947
|
this.map = t, this.database = e, this.queryExecutor = r, this.helper = a, this.sqlBuilder = s, this.filteredEntityManager = i;
|
|
3948
3948
|
}
|
|
@@ -4114,7 +4114,7 @@ class dr {
|
|
|
4114
4114
|
return R(!a.isTargetReliance, `cannot unlink reliance data, you can only delete record, ${t}`), a.isCombined() ? this.helper.relocateCombinedRecordDataForLink(t, e, r, s) : this.deleteRecord(t, e, s);
|
|
4115
4115
|
}
|
|
4116
4116
|
}
|
|
4117
|
-
class
|
|
4117
|
+
class mr {
|
|
4118
4118
|
constructor(t, e, r, i, s) {
|
|
4119
4119
|
this.map = t, this.database = e, this.helper = s, this.sqlBuilder = i, this.filteredEntityManager = r;
|
|
4120
4120
|
}
|
|
@@ -4218,9 +4218,9 @@ class hr {
|
|
|
4218
4218
|
return await this.database.update(i, s, a.idField, `update record ${t} by id`), e;
|
|
4219
4219
|
}
|
|
4220
4220
|
}
|
|
4221
|
-
class
|
|
4221
|
+
class yr {
|
|
4222
4222
|
constructor(t, e) {
|
|
4223
|
-
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (r) => "?"), this.filteredEntityManager = new
|
|
4223
|
+
this.map = t, this.database = e, this.getPlaceholder = e.getPlaceholder || (() => (r) => "?"), this.filteredEntityManager = new lr(t, this), this.sqlBuilder = new dr(t, e), this.queryExecutor = new pr(t, e, this.sqlBuilder), this.creationExecutor = new cr(t, e, this.queryExecutor, this.filteredEntityManager, this.sqlBuilder, this), this.deletionExecutor = new fr(t, e, this.queryExecutor, this.filteredEntityManager, this.sqlBuilder, this), this.updateExecutor = new mr(t, e, this.filteredEntityManager, this.sqlBuilder, this), this.initializeFilteredEntityDependencies();
|
|
4224
4224
|
}
|
|
4225
4225
|
/**
|
|
4226
4226
|
* 初始化所有 filtered entity 的依赖关系
|
|
@@ -4240,11 +4240,11 @@ class pr {
|
|
|
4240
4240
|
* 查找记录(主查询方法)- 委托给 QueryExecutor
|
|
4241
4241
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
4242
4242
|
*/
|
|
4243
|
-
async findRecords(t, e = "", r, i = new Y(
|
|
4243
|
+
async findRecords(t, e = "", r, i = new Y($t)) {
|
|
4244
4244
|
return this.queryExecutor.findRecords(t, e, r, i);
|
|
4245
4245
|
}
|
|
4246
4246
|
async lockRecords(t, e = "") {
|
|
4247
|
-
return this.queryExecutor.findRecords(t, e, void 0, new Y(
|
|
4247
|
+
return this.queryExecutor.findRecords(t, e, void 0, new Y($t), !0);
|
|
4248
4248
|
}
|
|
4249
4249
|
// 委托给 CreationExecutor
|
|
4250
4250
|
async createRecordDependency(t, e) {
|
|
@@ -4347,7 +4347,7 @@ class pr {
|
|
|
4347
4347
|
}), `finding combined records for relocate ${t}.${a}`, void 0), o = this.map.getLinkInfoByName(t)[r ? "sourceRecordInfo" : "targetRecordInfo"];
|
|
4348
4348
|
await this.deleteRecordSameRowData(o.name, n.map((c) => c[a]));
|
|
4349
4349
|
for (let c of n) {
|
|
4350
|
-
const u = new
|
|
4350
|
+
const u = new q(this.map, o.name, c[a]);
|
|
4351
4351
|
await this.creationExecutor.insertSameRowData(u, void 0), i?.push({
|
|
4352
4352
|
type: "delete",
|
|
4353
4353
|
recordName: t,
|
|
@@ -4391,9 +4391,9 @@ class pr {
|
|
|
4391
4391
|
return this.queryExecutor.findPath(t, e, r, i, s);
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
4394
|
-
class
|
|
4394
|
+
class gr {
|
|
4395
4395
|
constructor(t, e) {
|
|
4396
|
-
this.map = t, this.database = e, this.agent = new
|
|
4396
|
+
this.map = t, this.database = e, this.agent = new yr(t, e);
|
|
4397
4397
|
}
|
|
4398
4398
|
async findOne(t, e, r = {}, i) {
|
|
4399
4399
|
const s = {
|
|
@@ -4428,12 +4428,12 @@ class fr {
|
|
|
4428
4428
|
return this.agent.lockRecords(i, `locking ${t} from handle`);
|
|
4429
4429
|
}
|
|
4430
4430
|
async create(t, e, r) {
|
|
4431
|
-
const i = new
|
|
4431
|
+
const i = new q(this.map, t, e);
|
|
4432
4432
|
return this.agent.createRecord(i, `create record ${t} from handle`, r);
|
|
4433
4433
|
}
|
|
4434
4434
|
// CAUTION 不能递归更新 relate entity 的 value,如果传入了 related entity 的值,说明是建立新的联系。
|
|
4435
4435
|
async update(t, e, r, i) {
|
|
4436
|
-
const s = new
|
|
4436
|
+
const s = new q(this.map, t, r);
|
|
4437
4437
|
return this.agent.updateRecord(t, e, s, i);
|
|
4438
4438
|
}
|
|
4439
4439
|
async delete(t, e, r) {
|
|
@@ -4446,7 +4446,7 @@ class fr {
|
|
|
4446
4446
|
return this.agent.addLinkFromRecord(t, e, r, i, s, a);
|
|
4447
4447
|
}
|
|
4448
4448
|
async updateRelationByName(t, e, r, i) {
|
|
4449
|
-
return R(!r.source && !r.target, "Relation can only update attributes. Use addRelation/removeRelation to update source/target."), this.agent.updateRecord(t, e, new
|
|
4449
|
+
return R(!r.source && !r.target, "Relation can only update attributes. Use addRelation/removeRelation to update source/target."), this.agent.updateRecord(t, e, new q(this.map, t, r), i);
|
|
4450
4450
|
}
|
|
4451
4451
|
async removeRelationByName(t, e, r) {
|
|
4452
4452
|
return this.agent.unlink(t, e, !1, `remove relation ${t}`, r);
|
|
@@ -4509,19 +4509,19 @@ class ot {
|
|
|
4509
4509
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
4510
4510
|
const e = this.data.attributes[t];
|
|
4511
4511
|
return e.isRecord && e.field;
|
|
4512
|
-
}).map((t) => new
|
|
4512
|
+
}).map((t) => new K(this.name, t, this.map));
|
|
4513
4513
|
}
|
|
4514
4514
|
get strictRecordAttributes() {
|
|
4515
4515
|
return Object.keys(this.data.attributes).filter((t) => {
|
|
4516
4516
|
const e = this.data.attributes[t];
|
|
4517
4517
|
return e.isRecord && !e.field && !e.isFilteredRelation;
|
|
4518
|
-
}).map((t) => new
|
|
4518
|
+
}).map((t) => new K(this.name, t, this.map));
|
|
4519
4519
|
}
|
|
4520
4520
|
get differentTableRecordAttributes() {
|
|
4521
4521
|
return this.strictRecordAttributes.filter((t) => !(t.isMergedWithParent() || t.isLinkMergedWithParent()));
|
|
4522
4522
|
}
|
|
4523
4523
|
get reliance() {
|
|
4524
|
-
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new
|
|
4524
|
+
return Object.keys(this.data.attributes).filter((t) => this.data.attributes[t].isReliance).map((t) => new K(this.name, t, this.map));
|
|
4525
4525
|
}
|
|
4526
4526
|
get notRelianceCombined() {
|
|
4527
4527
|
return this.combinedRecords.filter((t) => !t.isReliance);
|
|
@@ -4533,10 +4533,10 @@ class ot {
|
|
|
4533
4533
|
return this.reliance.filter((t) => t.table === this.table);
|
|
4534
4534
|
}
|
|
4535
4535
|
get valueAttributes() {
|
|
4536
|
-
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new
|
|
4536
|
+
return Object.entries(this.data.attributes).filter(([, t]) => !t.isRecord).map(([t]) => new K(this.name, t, this.map));
|
|
4537
4537
|
}
|
|
4538
4538
|
getAttributeInfo(t) {
|
|
4539
|
-
return new
|
|
4539
|
+
return new K(this.name, t, this.map);
|
|
4540
4540
|
}
|
|
4541
4541
|
get baseRecordName() {
|
|
4542
4542
|
return this.data.baseRecordName;
|
|
@@ -4563,7 +4563,7 @@ class ot {
|
|
|
4563
4563
|
return this.data?.resolvedMatchExpression;
|
|
4564
4564
|
}
|
|
4565
4565
|
}
|
|
4566
|
-
class
|
|
4566
|
+
class Ct {
|
|
4567
4567
|
constructor(t, e, r, i = !0) {
|
|
4568
4568
|
this.name = t, this.data = e, this.map = r, this.isFromSource = i;
|
|
4569
4569
|
}
|
|
@@ -4651,7 +4651,7 @@ class It {
|
|
|
4651
4651
|
getBaseLinkInfo() {
|
|
4652
4652
|
R(this.isFilteredRelation(), "only filtered relation can get base link info");
|
|
4653
4653
|
const t = this.data.baseLinkName;
|
|
4654
|
-
return new
|
|
4654
|
+
return new Ct(t, this.map.data.links[t], this.map);
|
|
4655
4655
|
}
|
|
4656
4656
|
getMatchExpression() {
|
|
4657
4657
|
if (this.isFilteredRelation())
|
|
@@ -4665,7 +4665,7 @@ class It {
|
|
|
4665
4665
|
return R(this.isFilteredRelation(), "only filtered relation can get resolved record name"), this.data.resolvedBaseRecordName;
|
|
4666
4666
|
}
|
|
4667
4667
|
}
|
|
4668
|
-
class
|
|
4668
|
+
class Ht {
|
|
4669
4669
|
constructor(t, e) {
|
|
4670
4670
|
this.data = t, this.aliasManager = e;
|
|
4671
4671
|
}
|
|
@@ -4690,10 +4690,10 @@ class Wt {
|
|
|
4690
4690
|
}
|
|
4691
4691
|
getLinkInfo(t, e) {
|
|
4692
4692
|
const r = this.getAttributeAndSymmetricDirection(e)[0], { linkName: i, isSource: s } = this.data.records[t].attributes[r];
|
|
4693
|
-
return R(!!i, `cannot find relation ${t} ${r}`), new
|
|
4693
|
+
return R(!!i, `cannot find relation ${t} ${r}`), new Ct(i, this.data.links[i], this, !!s);
|
|
4694
4694
|
}
|
|
4695
4695
|
getLinkInfoByName(t) {
|
|
4696
|
-
return R(!!this.data.links[t], `cannot find link ${t}`), new
|
|
4696
|
+
return R(!!this.data.links[t], `cannot find link ${t}`), new Ct(t, this.data.links[t], this);
|
|
4697
4697
|
}
|
|
4698
4698
|
getInfoByPath(t) {
|
|
4699
4699
|
const [e, ...r] = t;
|
|
@@ -4706,7 +4706,7 @@ class Wt {
|
|
|
4706
4706
|
c = h, d === m ? (R(!!s && !!a, `reading link in wrong path ${u.join(".")}`), s = this.data.records[s].attributes[a].linkName, a = void 0, i = n.linkName, n = void 0) : (n = this.data.records[i].attributes[d], R(!!n, `attribute ${d} not found in ${i}. namePath: ${t.join(".")}`), s = i, i = n.isRecord ? n.recordName : "", a = d);
|
|
4707
4707
|
}
|
|
4708
4708
|
if (!(!s || !a))
|
|
4709
|
-
return new
|
|
4709
|
+
return new K(s, a, this, c);
|
|
4710
4710
|
}
|
|
4711
4711
|
getTableAndAliasStack(t) {
|
|
4712
4712
|
const [e, ...r] = t;
|
|
@@ -4735,15 +4735,15 @@ class Wt {
|
|
|
4735
4735
|
u = this.getInfoByPath(b);
|
|
4736
4736
|
const g = i.attributes[p];
|
|
4737
4737
|
R(u.isRecord, `${r.slice(0, h + 1).join(".")} is not a entity attribute`);
|
|
4738
|
-
const v = this.data.records[g.recordName], I = `${a}_${p}${f ? `_${f.toUpperCase()}` : ""}`,
|
|
4738
|
+
const v = this.data.records[g.recordName], I = `${a}_${p}${f ? `_${f.toUpperCase()}` : ""}`, V = this.aliasManager?.getTableAlias(I) || I;
|
|
4739
4739
|
if (u.isMergedWithParent() || u.isLinkMergedWithParent())
|
|
4740
4740
|
o = a;
|
|
4741
4741
|
else if (u.isLinkIsolated()) {
|
|
4742
4742
|
const _ = `REL_${I}`;
|
|
4743
4743
|
o = this.aliasManager?.getTableAlias(_) || _;
|
|
4744
4744
|
} else
|
|
4745
|
-
o =
|
|
4746
|
-
u.isMergedWithParent() || (a =
|
|
4745
|
+
o = V;
|
|
4746
|
+
u.isMergedWithParent() || (a = V), s = u.table, i = v, n = u.getLinkInfo()?.table, c = !1;
|
|
4747
4747
|
}
|
|
4748
4748
|
d.push({
|
|
4749
4749
|
table: s,
|
|
@@ -4861,7 +4861,7 @@ class Wt {
|
|
|
4861
4861
|
return i.join(".");
|
|
4862
4862
|
}
|
|
4863
4863
|
}
|
|
4864
|
-
function
|
|
4864
|
+
function br(l) {
|
|
4865
4865
|
const t = /* @__PURE__ */ new Map();
|
|
4866
4866
|
for (const e of l)
|
|
4867
4867
|
if (e.inputEntities)
|
|
@@ -4872,7 +4872,7 @@ function mr(l) {
|
|
|
4872
4872
|
}
|
|
4873
4873
|
return t;
|
|
4874
4874
|
}
|
|
4875
|
-
function
|
|
4875
|
+
function Rr(l) {
|
|
4876
4876
|
const t = /* @__PURE__ */ new Map();
|
|
4877
4877
|
for (const e of l) {
|
|
4878
4878
|
const r = e.name || `${e.source.name}_${e.sourceProperty}_${e.targetProperty}_${e.target.name}`;
|
|
@@ -4886,32 +4886,32 @@ function yr(l) {
|
|
|
4886
4886
|
}
|
|
4887
4887
|
return t;
|
|
4888
4888
|
}
|
|
4889
|
-
function
|
|
4890
|
-
const e = new
|
|
4891
|
-
return
|
|
4889
|
+
function wr(l, t) {
|
|
4890
|
+
const e = new Me(l, t), r = br(l), i = Rr(t);
|
|
4891
|
+
return Re(
|
|
4892
4892
|
l,
|
|
4893
4893
|
e,
|
|
4894
4894
|
r,
|
|
4895
4895
|
"entity"
|
|
4896
|
-
),
|
|
4896
|
+
), Re(
|
|
4897
4897
|
t,
|
|
4898
4898
|
e,
|
|
4899
4899
|
i,
|
|
4900
4900
|
"relation"
|
|
4901
4901
|
), e.getAll();
|
|
4902
4902
|
}
|
|
4903
|
-
function
|
|
4903
|
+
function Re(l, t, e, r) {
|
|
4904
4904
|
const i = l.filter((s) => vt(s) !== void 0);
|
|
4905
4905
|
for (const s of i)
|
|
4906
|
-
|
|
4906
|
+
Nr(
|
|
4907
4907
|
s,
|
|
4908
4908
|
t,
|
|
4909
4909
|
r,
|
|
4910
4910
|
e
|
|
4911
4911
|
);
|
|
4912
4912
|
}
|
|
4913
|
-
function
|
|
4914
|
-
const i = e === "entity", a = `__${et(l)}_input_${e}`, n = i ? t.getEntityByName(l.name) : t.getRelationByName(l.name), [o, c] =
|
|
4913
|
+
function Nr(l, t, e, r) {
|
|
4914
|
+
const i = e === "entity", a = `__${et(l)}_input_${e}`, n = i ? t.getEntityByName(l.name) : t.getRelationByName(l.name), [o, c] = Sr(
|
|
4915
4915
|
n,
|
|
4916
4916
|
a,
|
|
4917
4917
|
r,
|
|
@@ -4926,7 +4926,7 @@ function br(l, t, e, r) {
|
|
|
4926
4926
|
}
|
|
4927
4927
|
if (u)
|
|
4928
4928
|
for (const d of u)
|
|
4929
|
-
|
|
4929
|
+
vr(
|
|
4930
4930
|
d,
|
|
4931
4931
|
c,
|
|
4932
4932
|
a,
|
|
@@ -4934,8 +4934,8 @@ function br(l, t, e, r) {
|
|
|
4934
4934
|
i
|
|
4935
4935
|
);
|
|
4936
4936
|
}
|
|
4937
|
-
function
|
|
4938
|
-
const [s, a] =
|
|
4937
|
+
function vr(l, t, e, r, i) {
|
|
4938
|
+
const [s, a] = kr(
|
|
4939
4939
|
l,
|
|
4940
4940
|
t,
|
|
4941
4941
|
e
|
|
@@ -4945,7 +4945,7 @@ function Rr(l, t, e, r, i) {
|
|
|
4945
4945
|
const n = et(a), o = i ? r.getEntityByName(n) : r.getRelationByName(n);
|
|
4946
4946
|
o && r.replace(s, o);
|
|
4947
4947
|
}
|
|
4948
|
-
function
|
|
4948
|
+
function Tr(l, t) {
|
|
4949
4949
|
const e = /* @__PURE__ */ new Map(), r = vt(l);
|
|
4950
4950
|
if (r && r.length > 0)
|
|
4951
4951
|
for (const i of r) {
|
|
@@ -4959,8 +4959,8 @@ function wr(l, t) {
|
|
|
4959
4959
|
}
|
|
4960
4960
|
return e;
|
|
4961
4961
|
}
|
|
4962
|
-
function
|
|
4963
|
-
const r =
|
|
4962
|
+
function Er(l, t, e) {
|
|
4963
|
+
const r = Tr(t, e);
|
|
4964
4964
|
return N.create({
|
|
4965
4965
|
name: l,
|
|
4966
4966
|
type: "json",
|
|
@@ -4972,14 +4972,14 @@ function Nr(l, t, e) {
|
|
|
4972
4972
|
}
|
|
4973
4973
|
});
|
|
4974
4974
|
}
|
|
4975
|
-
function
|
|
4975
|
+
function Ar(l, t, e) {
|
|
4976
4976
|
const r = vt(l) || [], i = [], s = /* @__PURE__ */ new Map(), a = Object.fromEntries(l.commonProperties?.map((n) => [n.name, n]) || []);
|
|
4977
4977
|
for (const n of r) {
|
|
4978
4978
|
let o = n;
|
|
4979
4979
|
if (Nt(o))
|
|
4980
4980
|
for (; o.baseEntity && o.properties.length === 0; )
|
|
4981
4981
|
o = o.baseEntity;
|
|
4982
|
-
else if (
|
|
4982
|
+
else if ($r(o))
|
|
4983
4983
|
for (; o.baseRelation && o.properties.length === 0; )
|
|
4984
4984
|
o = o.baseRelation;
|
|
4985
4985
|
const c = Object.fromEntries(o.properties.map((h) => [h.name, h]));
|
|
@@ -5009,13 +5009,13 @@ function vr(l, t, e) {
|
|
|
5009
5009
|
}
|
|
5010
5010
|
return i;
|
|
5011
5011
|
}
|
|
5012
|
-
function
|
|
5013
|
-
const i =
|
|
5012
|
+
function Sr(l, t, e, r) {
|
|
5013
|
+
const i = Er(
|
|
5014
5014
|
t,
|
|
5015
5015
|
l,
|
|
5016
5016
|
e
|
|
5017
5017
|
), s = [
|
|
5018
|
-
...
|
|
5018
|
+
...Ar(
|
|
5019
5019
|
l,
|
|
5020
5020
|
e,
|
|
5021
5021
|
r
|
|
@@ -5073,7 +5073,7 @@ function Tr(l, t, e, r) {
|
|
|
5073
5073
|
return [n, o || n];
|
|
5074
5074
|
}
|
|
5075
5075
|
}
|
|
5076
|
-
function
|
|
5076
|
+
function kr(l, t, e) {
|
|
5077
5077
|
if (Nt(l)) {
|
|
5078
5078
|
const r = l, i = t;
|
|
5079
5079
|
let s = r;
|
|
@@ -5087,7 +5087,7 @@ function Er(l, t, e) {
|
|
|
5087
5087
|
}), [a, s];
|
|
5088
5088
|
} else {
|
|
5089
5089
|
const r = l, i = t, s = et(r);
|
|
5090
|
-
return r.baseRelation ? [r,
|
|
5090
|
+
return r.baseRelation ? [r, Ir(r)] : [x.create({
|
|
5091
5091
|
name: s,
|
|
5092
5092
|
baseRelation: i,
|
|
5093
5093
|
sourceProperty: r.sourceProperty,
|
|
@@ -5099,7 +5099,7 @@ function Er(l, t, e) {
|
|
|
5099
5099
|
}), r];
|
|
5100
5100
|
}
|
|
5101
5101
|
}
|
|
5102
|
-
function
|
|
5102
|
+
function Ir(l) {
|
|
5103
5103
|
let t = l;
|
|
5104
5104
|
for (; t.baseRelation; )
|
|
5105
5105
|
t = t.baseRelation;
|
|
@@ -5108,7 +5108,7 @@ function Ar(l) {
|
|
|
5108
5108
|
function Nt(l) {
|
|
5109
5109
|
return "inputEntities" in l || !("sourceProperty" in l);
|
|
5110
5110
|
}
|
|
5111
|
-
function
|
|
5111
|
+
function $r(l) {
|
|
5112
5112
|
return "sourceProperty" in l;
|
|
5113
5113
|
}
|
|
5114
5114
|
function vt(l) {
|
|
@@ -5117,7 +5117,7 @@ function vt(l) {
|
|
|
5117
5117
|
function et(l) {
|
|
5118
5118
|
return Nt(l), l.name;
|
|
5119
5119
|
}
|
|
5120
|
-
class
|
|
5120
|
+
class Cr {
|
|
5121
5121
|
constructor() {
|
|
5122
5122
|
this.tableAliasCounter = 1, this.fieldAliasCounter = 1, this.tablePathToAlias = /* @__PURE__ */ new Map(), this.tableAliasToPath = /* @__PURE__ */ new Map(), this.fieldPathToAlias = /* @__PURE__ */ new Map(), this.fieldAliasToPath = /* @__PURE__ */ new Map(), this.MAX_IDENTIFIER_LENGTH = 63;
|
|
5123
5123
|
}
|
|
@@ -5203,17 +5203,17 @@ class kr {
|
|
|
5203
5203
|
this.tableAliasCounter = 1, this.fieldAliasCounter = 1, this.tablePathToAlias.clear(), this.tableAliasToPath.clear(), this.fieldPathToAlias.clear(), this.fieldAliasToPath.clear();
|
|
5204
5204
|
}
|
|
5205
5205
|
}
|
|
5206
|
-
const
|
|
5206
|
+
const we = {
|
|
5207
5207
|
name: "postgres",
|
|
5208
5208
|
maxIdentifierLength: 63,
|
|
5209
5209
|
supportsCreateIndexIfNotExists: !0,
|
|
5210
|
-
encodeLiteral:
|
|
5210
|
+
encodeLiteral: Fe,
|
|
5211
5211
|
constraints: {
|
|
5212
5212
|
unique: !0,
|
|
5213
5213
|
filteredUnique: !0
|
|
5214
5214
|
}
|
|
5215
5215
|
};
|
|
5216
|
-
function
|
|
5216
|
+
function Fe(l) {
|
|
5217
5217
|
if (l === null) return "NULL";
|
|
5218
5218
|
if (typeof l == "number") {
|
|
5219
5219
|
if (!Number.isFinite(l)) throw new Error(`Invalid numeric constraint literal: ${l}`);
|
|
@@ -5221,27 +5221,27 @@ function xe(l) {
|
|
|
5221
5221
|
}
|
|
5222
5222
|
return typeof l == "boolean" ? l ? "TRUE" : "FALSE" : `'${l.replace(/'/g, "''")}'`;
|
|
5223
5223
|
}
|
|
5224
|
-
function
|
|
5225
|
-
return typeof l == "boolean" ? l ? "1" : "0" :
|
|
5224
|
+
function ts(l) {
|
|
5225
|
+
return typeof l == "boolean" ? l ? "1" : "0" : Fe(l);
|
|
5226
5226
|
}
|
|
5227
5227
|
function ct(l) {
|
|
5228
5228
|
return {
|
|
5229
|
-
...
|
|
5229
|
+
...we,
|
|
5230
5230
|
...l?.schemaDialect,
|
|
5231
5231
|
constraints: {
|
|
5232
|
-
...
|
|
5232
|
+
...we.constraints,
|
|
5233
5233
|
...l?.schemaDialect?.constraints
|
|
5234
5234
|
}
|
|
5235
5235
|
};
|
|
5236
5236
|
}
|
|
5237
|
-
function
|
|
5237
|
+
function kt(l, t) {
|
|
5238
5238
|
return t.name === "mysql" ? `\`${l.replace(/`/g, "``")}\`` : `"${l.replace(/"/g, '""')}"`;
|
|
5239
5239
|
}
|
|
5240
5240
|
function At(l, t) {
|
|
5241
5241
|
return t.encodeLiteral(l);
|
|
5242
5242
|
}
|
|
5243
|
-
function
|
|
5244
|
-
const r =
|
|
5243
|
+
function xr(l, t, e) {
|
|
5244
|
+
const r = kt(l, e);
|
|
5245
5245
|
switch (t.op) {
|
|
5246
5246
|
case "isNull":
|
|
5247
5247
|
return `${r} IS NULL`;
|
|
@@ -5261,22 +5261,22 @@ function Ir(l, t, e) {
|
|
|
5261
5261
|
}
|
|
5262
5262
|
}
|
|
5263
5263
|
}
|
|
5264
|
-
function
|
|
5265
|
-
const a = r.supportsCreateIndexIfNotExists ? " IF NOT EXISTS" : "", n = e.map((c) =>
|
|
5264
|
+
function De(l, t, e, r, i, s) {
|
|
5265
|
+
const a = r.supportsCreateIndexIfNotExists ? " IF NOT EXISTS" : "", n = e.map((c) => kt(c, r)).join(", "), o = i ? `
|
|
5266
5266
|
WHERE ${Object.entries(i).map(([c, u]) => {
|
|
5267
5267
|
const d = s?.(c) ?? c;
|
|
5268
|
-
return
|
|
5268
|
+
return xr(d, u, r);
|
|
5269
5269
|
}).join(" AND ")}` : "";
|
|
5270
|
-
return `CREATE UNIQUE INDEX${a} ${
|
|
5270
|
+
return `CREATE UNIQUE INDEX${a} ${kt(l, r)} ON ${kt(t, r)} (${n})${o}`;
|
|
5271
5271
|
}
|
|
5272
|
-
function
|
|
5272
|
+
function Pr(l, t, e) {
|
|
5273
5273
|
if (!t.constraints.unique)
|
|
5274
5274
|
throw new Error(`unique constraints are not supported by ${t.name} schema dialect`);
|
|
5275
5275
|
if (l.where && !t.constraints.filteredUnique)
|
|
5276
5276
|
throw new Error(`filtered unique constraints are not supported by ${t.name} schema dialect`);
|
|
5277
5277
|
return {
|
|
5278
5278
|
item: l,
|
|
5279
|
-
sql:
|
|
5279
|
+
sql: De(
|
|
5280
5280
|
l.physicalName,
|
|
5281
5281
|
l.tableName,
|
|
5282
5282
|
l.fields,
|
|
@@ -5286,9 +5286,9 @@ function $r(l, t, e) {
|
|
|
5286
5286
|
)
|
|
5287
5287
|
};
|
|
5288
5288
|
}
|
|
5289
|
-
class
|
|
5289
|
+
class Mr {
|
|
5290
5290
|
constructor(t, e, r, i = []) {
|
|
5291
|
-
this.entities = t, this.relations = e, this.database = r, this.mergeLinks = i, this.fieldNameMap = /* @__PURE__ */ new Map(), this.usedFieldNames = /* @__PURE__ */ new Set(), this.fieldCounter = 1, this.recordToTableMap = /* @__PURE__ */ new Map(), this.tableToRecordsMap = /* @__PURE__ */ new Map(), this.mergeLog = [], this.tables = {}, this.map = { links: {}, records: {} }, this.aliasManager = new
|
|
5291
|
+
this.entities = t, this.relations = e, this.database = r, this.mergeLinks = i, this.fieldNameMap = /* @__PURE__ */ new Map(), this.usedFieldNames = /* @__PURE__ */ new Set(), this.fieldCounter = 1, this.recordToTableMap = /* @__PURE__ */ new Map(), this.tableToRecordsMap = /* @__PURE__ */ new Map(), this.mergeLog = [], this.tables = {}, this.map = { links: {}, records: {} }, this.aliasManager = new Cr(), this.constraintSchemaItems = [], this.buildMap(), this.buildTables(), this.buildConstraints();
|
|
5292
5292
|
}
|
|
5293
5293
|
createRecordToTable(t, e) {
|
|
5294
5294
|
this.recordToTableMap.set(t, e);
|
|
@@ -5383,8 +5383,8 @@ class Cr {
|
|
|
5383
5383
|
}
|
|
5384
5384
|
];
|
|
5385
5385
|
}));
|
|
5386
|
-
e && R(!r.source && !r.target, "source and target is reserved name for relation attributes"), r[
|
|
5387
|
-
name:
|
|
5386
|
+
e && R(!r.source && !r.target, "source and target is reserved name for relation attributes"), r[Ne] = {
|
|
5387
|
+
name: Ne,
|
|
5388
5388
|
type: "id",
|
|
5389
5389
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5390
5390
|
};
|
|
@@ -5679,7 +5679,7 @@ class Cr {
|
|
|
5679
5679
|
* 统一处理 merged entities 和 merged relations
|
|
5680
5680
|
*/
|
|
5681
5681
|
processMergedItems() {
|
|
5682
|
-
const t =
|
|
5682
|
+
const t = wr(
|
|
5683
5683
|
this.entities,
|
|
5684
5684
|
this.relations
|
|
5685
5685
|
);
|
|
@@ -5757,8 +5757,8 @@ class Cr {
|
|
|
5757
5757
|
buildTables() {
|
|
5758
5758
|
Object.entries(this.map.records).forEach(([t, e]) => {
|
|
5759
5759
|
this.tables[e.table] || (this.tables[e.table] = { columns: {
|
|
5760
|
-
[
|
|
5761
|
-
name:
|
|
5760
|
+
[ve]: {
|
|
5761
|
+
name: ve,
|
|
5762
5762
|
type: "pk",
|
|
5763
5763
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5764
5764
|
}
|
|
@@ -5798,7 +5798,7 @@ ${Object.values(this.tables[t].columns).map((r) => ` "${r.name}" ${r.fieldTyp
|
|
|
5798
5798
|
return r.length + i.length + 1 <= s ? `${r}_${i}` : `${r.slice(0, s - i.length - 1)}_${i}`;
|
|
5799
5799
|
}
|
|
5800
5800
|
resolveConstraintField(t, e) {
|
|
5801
|
-
const r = new
|
|
5801
|
+
const r = new Ht(this.map, this.aliasManager), i = r.getRecordInfo(t), s = this.map.records[t]?.attributes[e];
|
|
5802
5802
|
if (!s)
|
|
5803
5803
|
throw new Error(`constraint property "${e}" not found on "${t}"`);
|
|
5804
5804
|
if (!s.isRecord && s.computed)
|
|
@@ -5878,7 +5878,7 @@ ${Object.values(this.tables[t].columns).map((r) => ` "${r.name}" ${r.fieldTyp
|
|
|
5878
5878
|
}
|
|
5879
5879
|
createConstraintSQL() {
|
|
5880
5880
|
const t = ct(this.database);
|
|
5881
|
-
return this.constraintSchemaItems.map((e) =>
|
|
5881
|
+
return this.constraintSchemaItems.map((e) => Pr(
|
|
5882
5882
|
e,
|
|
5883
5883
|
t,
|
|
5884
5884
|
(r) => e.fields[e.properties.indexOf(r)] || this.resolveConstraintField(e.recordName, r)
|
|
@@ -5931,7 +5931,7 @@ ${Object.values(this.tables[t].columns).map((r) => ` "${r.name}" ${r.fieldTyp
|
|
|
5931
5931
|
});
|
|
5932
5932
|
}
|
|
5933
5933
|
}
|
|
5934
|
-
const st = "_System_", B = "_Dictionary_",
|
|
5934
|
+
const st = "_System_", B = "_Dictionary_", Ne = "id", ve = "_rowId", Or = $.create({
|
|
5935
5935
|
name: st,
|
|
5936
5936
|
properties: [
|
|
5937
5937
|
N.create({
|
|
@@ -5950,7 +5950,7 @@ const st = "_System_", B = "_Dictionary_", be = "id", Re = "_rowId", xr = $.crea
|
|
|
5950
5950
|
collection: !1
|
|
5951
5951
|
})
|
|
5952
5952
|
]
|
|
5953
|
-
}),
|
|
5953
|
+
}), Fr = $.create({
|
|
5954
5954
|
name: B,
|
|
5955
5955
|
properties: [
|
|
5956
5956
|
N.create({
|
|
@@ -5964,8 +5964,8 @@ const st = "_System_", B = "_Dictionary_", be = "id", Re = "_rowId", xr = $.crea
|
|
|
5964
5964
|
collection: !1
|
|
5965
5965
|
})
|
|
5966
5966
|
]
|
|
5967
|
-
}),
|
|
5968
|
-
class
|
|
5967
|
+
}), es = 0, Qt = 1, rs = 2;
|
|
5968
|
+
class Dr {
|
|
5969
5969
|
constructor(t, e) {
|
|
5970
5970
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
5971
5971
|
}
|
|
@@ -5979,18 +5979,18 @@ class Mr {
|
|
|
5979
5979
|
if (this.scheduler.isDataBasedComputation(r)) {
|
|
5980
5980
|
if (Object.entries(r.dataDeps).forEach(([i, s]) => {
|
|
5981
5981
|
const a = this.convertDataDepToERMutationEventsSourceMap(i, s, r);
|
|
5982
|
-
e[s.phase ||
|
|
5982
|
+
e[s.phase || Qt].push(...a);
|
|
5983
5983
|
}), r.dataContext.type === "property" && Object.values(r.dataDeps).some((i) => i.type === "global")) {
|
|
5984
5984
|
const i = {
|
|
5985
5985
|
type: "records",
|
|
5986
5986
|
source: r.dataContext.host
|
|
5987
5987
|
};
|
|
5988
|
-
e[
|
|
5988
|
+
e[Qt].push(...this.convertDataDepToERMutationEventsSourceMap("_self", i, r, "create"));
|
|
5989
5989
|
}
|
|
5990
5990
|
} else {
|
|
5991
5991
|
const { eventDeps: i } = r;
|
|
5992
5992
|
for (const s of Object.values(i))
|
|
5993
|
-
e[s.phase ||
|
|
5993
|
+
e[s.phase || Qt].push({
|
|
5994
5994
|
type: s.type,
|
|
5995
5995
|
recordName: s.recordName,
|
|
5996
5996
|
record: s.record,
|
|
@@ -6196,31 +6196,31 @@ class Mr {
|
|
|
6196
6196
|
}
|
|
6197
6197
|
class k {
|
|
6198
6198
|
static {
|
|
6199
|
-
this.skip = () => new
|
|
6199
|
+
this.skip = () => new xt();
|
|
6200
6200
|
}
|
|
6201
6201
|
static {
|
|
6202
|
-
this.resolved = (t, e) => new
|
|
6202
|
+
this.resolved = (t, e) => new qe(t, e);
|
|
6203
6203
|
}
|
|
6204
6204
|
static {
|
|
6205
|
-
this.async = (t) => new
|
|
6205
|
+
this.async = (t) => new Le(t);
|
|
6206
6206
|
}
|
|
6207
6207
|
static {
|
|
6208
|
-
this.fullRecompute = (t) => new
|
|
6208
|
+
this.fullRecompute = (t) => new Ve(t);
|
|
6209
6209
|
}
|
|
6210
6210
|
}
|
|
6211
|
-
class
|
|
6211
|
+
class xt extends k {
|
|
6212
6212
|
}
|
|
6213
|
-
class
|
|
6213
|
+
class Ve extends k {
|
|
6214
6214
|
constructor(t) {
|
|
6215
6215
|
super(), this.reason = t;
|
|
6216
6216
|
}
|
|
6217
6217
|
}
|
|
6218
|
-
class
|
|
6218
|
+
class Le extends k {
|
|
6219
6219
|
constructor(t) {
|
|
6220
6220
|
super(), this.args = t;
|
|
6221
6221
|
}
|
|
6222
6222
|
}
|
|
6223
|
-
class
|
|
6223
|
+
class qe extends k {
|
|
6224
6224
|
constructor(t, e) {
|
|
6225
6225
|
super(), this.result = t, this.args = e;
|
|
6226
6226
|
}
|
|
@@ -6331,7 +6331,7 @@ class j {
|
|
|
6331
6331
|
return e === "number" || e === "boolean" || e === "string" ? e : "json";
|
|
6332
6332
|
}
|
|
6333
6333
|
}
|
|
6334
|
-
function
|
|
6334
|
+
function Gt(l, t) {
|
|
6335
6335
|
if (t == null || l === t) return !0;
|
|
6336
6336
|
if (typeof t != "object" || t === null)
|
|
6337
6337
|
return l === t;
|
|
@@ -6339,11 +6339,11 @@ function jt(l, t) {
|
|
|
6339
6339
|
return !1;
|
|
6340
6340
|
const e = l, r = t;
|
|
6341
6341
|
for (const i in r)
|
|
6342
|
-
if (!(i in e) || !
|
|
6342
|
+
if (!(i in e) || !Gt(e[i], r[i]))
|
|
6343
6343
|
return !1;
|
|
6344
6344
|
return !0;
|
|
6345
6345
|
}
|
|
6346
|
-
class
|
|
6346
|
+
class Qe {
|
|
6347
6347
|
constructor(t) {
|
|
6348
6348
|
this.data = t, this.map = {};
|
|
6349
6349
|
for (const e of t.transfers)
|
|
@@ -6356,45 +6356,45 @@ class De {
|
|
|
6356
6356
|
const r = this.map[t];
|
|
6357
6357
|
if (r) {
|
|
6358
6358
|
for (const i of r)
|
|
6359
|
-
if (
|
|
6359
|
+
if (Gt(e, i.trigger))
|
|
6360
6360
|
return i.next;
|
|
6361
6361
|
}
|
|
6362
6362
|
return null;
|
|
6363
6363
|
}
|
|
6364
6364
|
findTransfers(t) {
|
|
6365
|
-
return this.data.transfers.filter((e) =>
|
|
6365
|
+
return this.data.transfers.filter((e) => Gt(t, e.trigger));
|
|
6366
6366
|
}
|
|
6367
6367
|
}
|
|
6368
6368
|
function A(l, t) {
|
|
6369
6369
|
if (!l)
|
|
6370
6370
|
throw new Error(t);
|
|
6371
6371
|
}
|
|
6372
|
-
function
|
|
6372
|
+
function is(l, t) {
|
|
6373
6373
|
return new Map(Array.from(l.entries()).map(([e, r]) => [e, t(e, r)]));
|
|
6374
6374
|
}
|
|
6375
|
-
function
|
|
6375
|
+
function ss(l, t) {
|
|
6376
6376
|
return Object.fromEntries(Object.entries(l).map(([e, r]) => [e, t(e, r)]));
|
|
6377
6377
|
}
|
|
6378
|
-
async function
|
|
6378
|
+
async function as(l, t) {
|
|
6379
6379
|
for (let e of l)
|
|
6380
6380
|
if (!await t(e)) return !1;
|
|
6381
6381
|
return !0;
|
|
6382
6382
|
}
|
|
6383
|
-
async function
|
|
6383
|
+
async function ns(l, t) {
|
|
6384
6384
|
for (let e of l)
|
|
6385
6385
|
if (await t(e)) return !0;
|
|
6386
6386
|
return !1;
|
|
6387
6387
|
}
|
|
6388
|
-
async function
|
|
6388
|
+
async function os(l, t) {
|
|
6389
6389
|
for (let e of l) {
|
|
6390
6390
|
const r = await t(e);
|
|
6391
6391
|
if (r !== !0) return r;
|
|
6392
6392
|
}
|
|
6393
6393
|
return !0;
|
|
6394
6394
|
}
|
|
6395
|
-
class
|
|
6395
|
+
class Vr {
|
|
6396
6396
|
constructor(t, e, r) {
|
|
6397
|
-
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6397
|
+
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Qe(this.args), this.initialState = this.args.initialState;
|
|
6398
6398
|
for (const i of this.args.transfers) {
|
|
6399
6399
|
const s = `${i.trigger.recordName}_${i.trigger.type}`;
|
|
6400
6400
|
this.eventDeps[s] = {
|
|
@@ -6425,9 +6425,9 @@ class Or {
|
|
|
6425
6425
|
return s.computeValue ? await s.computeValue.call(this.controller, a, e) : s.name;
|
|
6426
6426
|
}
|
|
6427
6427
|
}
|
|
6428
|
-
class
|
|
6428
|
+
class Lr {
|
|
6429
6429
|
constructor(t, e, r) {
|
|
6430
|
-
this.controller = t, this.args = e, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6430
|
+
this.controller = t, this.args = e, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Qe(this.args), this.initialState = this.args.initialState, this.dataContext = r;
|
|
6431
6431
|
for (const i of this.args.transfers) {
|
|
6432
6432
|
const s = `${i.trigger.recordName}_${i.trigger.type}`;
|
|
6433
6433
|
this.eventDeps[s] = {
|
|
@@ -6477,17 +6477,17 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6477
6477
|
};
|
|
6478
6478
|
}
|
|
6479
6479
|
}
|
|
6480
|
-
const
|
|
6480
|
+
const cs = tt.create({
|
|
6481
6481
|
name: "nonExistent",
|
|
6482
6482
|
computeValue: () => null
|
|
6483
|
-
}),
|
|
6483
|
+
}), ls = tt.create({
|
|
6484
6484
|
name: "nonDeleted",
|
|
6485
6485
|
computeValue: () => !1
|
|
6486
|
-
}),
|
|
6486
|
+
}), us = tt.create({
|
|
6487
6487
|
name: "deleted",
|
|
6488
6488
|
computeValue: () => !0
|
|
6489
|
-
}),
|
|
6490
|
-
class
|
|
6489
|
+
}), qr = [Vr, Lr];
|
|
6490
|
+
class Qr {
|
|
6491
6491
|
constructor(t, e, r) {
|
|
6492
6492
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.matchRecordToWeight = this.args.callback.bind(this.controller), this.record = this.args.record, this.dataDeps = {
|
|
6493
6493
|
main: {
|
|
@@ -6540,7 +6540,7 @@ class Vr {
|
|
|
6540
6540
|
return this.state.total.increment(r);
|
|
6541
6541
|
}
|
|
6542
6542
|
}
|
|
6543
|
-
class
|
|
6543
|
+
class _r {
|
|
6544
6544
|
constructor(t, e, r) {
|
|
6545
6545
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.matchRecordToWeight = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((a) => a.source === r.host && a.sourceProperty === this.args.property || a.target === r.host && a.targetProperty === this.args.property), A(this.relation, "weighted summation computation must specify property"), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, A(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "weighted summation computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
6546
6546
|
const i = this.args.attributeQuery || [];
|
|
@@ -6616,8 +6616,8 @@ class Lr {
|
|
|
6616
6616
|
return this.state.total.increment(e.record, s);
|
|
6617
6617
|
}
|
|
6618
6618
|
}
|
|
6619
|
-
const
|
|
6620
|
-
class
|
|
6619
|
+
const Br = [Qr, _r];
|
|
6620
|
+
class Ur {
|
|
6621
6621
|
constructor(t, e, r) {
|
|
6622
6622
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6623
6623
|
main: {
|
|
@@ -6678,7 +6678,7 @@ class Qr {
|
|
|
6678
6678
|
return c === 0 ? this.defaultValue : o === c;
|
|
6679
6679
|
}
|
|
6680
6680
|
}
|
|
6681
|
-
class
|
|
6681
|
+
class Wr {
|
|
6682
6682
|
constructor(t, e, r) {
|
|
6683
6683
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((a) => a.source === r.host && a.sourceProperty === this.args.property || a.target === r.host && a.targetProperty === this.args.property), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, A(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "every computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
6684
6684
|
const i = this.args.attributeQuery || [];
|
|
@@ -6774,8 +6774,8 @@ class _r {
|
|
|
6774
6774
|
return c === 0 ? !this.args.notEmpty : o === c;
|
|
6775
6775
|
}
|
|
6776
6776
|
}
|
|
6777
|
-
const
|
|
6778
|
-
class
|
|
6777
|
+
const jr = [Ur, Wr];
|
|
6778
|
+
class Hr {
|
|
6779
6779
|
constructor(t, e, r) {
|
|
6780
6780
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.dataDeps = {
|
|
6781
6781
|
main: {
|
|
@@ -6828,7 +6828,7 @@ class Ur {
|
|
|
6828
6828
|
return await this.state.matchCount.increment(s) > 0;
|
|
6829
6829
|
}
|
|
6830
6830
|
}
|
|
6831
|
-
class
|
|
6831
|
+
class Gr {
|
|
6832
6832
|
constructor(t, e, r) {
|
|
6833
6833
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.callback = this.args.callback.bind(this.controller), this.relation = this.controller.relations.find((o) => o.source === r.host && o.sourceProperty === this.args.property || o.target === r.host && o.targetProperty === this.args.property), A(this.relation, `cannot find relation for property ${this.args.property} in "Any" computation`), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, A(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "any computation relation direction error");
|
|
6834
6834
|
let i = this.relation.baseRelation || this.relation;
|
|
@@ -6909,8 +6909,8 @@ class Wr {
|
|
|
6909
6909
|
return await this.state.matchCount.increment(e.record, s) > 0;
|
|
6910
6910
|
}
|
|
6911
6911
|
}
|
|
6912
|
-
const
|
|
6913
|
-
class
|
|
6912
|
+
const Jr = [Hr, Gr];
|
|
6913
|
+
class Kr {
|
|
6914
6914
|
constructor(t, e, r) {
|
|
6915
6915
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.record = this.args.record, this.callback = this.args.callback?.bind(this) || (() => !0), this.dataDeps = {
|
|
6916
6916
|
main: {
|
|
@@ -6962,7 +6962,7 @@ class Hr {
|
|
|
6962
6962
|
return a;
|
|
6963
6963
|
}
|
|
6964
6964
|
}
|
|
6965
|
-
class
|
|
6965
|
+
class zr {
|
|
6966
6966
|
constructor(t, e, r) {
|
|
6967
6967
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.callback = this.args.callback?.bind(this.controller), this.args.property ? this.relation = this.controller.relations.find((a) => a.source === r.host && a.sourceProperty === this.args.property || a.target === r.host && a.targetProperty === this.args.property) : this.relation = this.args.record, this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, A(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "count computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
6968
6968
|
const i = this.args.attributeQuery || [];
|
|
@@ -7053,8 +7053,8 @@ class Jr {
|
|
|
7053
7053
|
return n;
|
|
7054
7054
|
}
|
|
7055
7055
|
}
|
|
7056
|
-
const
|
|
7057
|
-
class
|
|
7056
|
+
const Xr = [Kr, zr];
|
|
7057
|
+
class D extends Error {
|
|
7058
7058
|
constructor(t, e = {}) {
|
|
7059
7059
|
super(`${t}. Caused by: ${e.causedBy?.message}`), this.name = this.constructor.name, this.timestamp = /* @__PURE__ */ new Date(), this.errorId = this.generateErrorId(), this.errorType = e.errorType || this.constructor.name, this.context = e.context || {}, this.causedBy = e.causedBy, this.stackTrace = this.stack, Object.setPrototypeOf(this, new.target.prototype);
|
|
7060
7060
|
}
|
|
@@ -7067,7 +7067,7 @@ class Q extends Error {
|
|
|
7067
7067
|
getErrorChain() {
|
|
7068
7068
|
const t = [this];
|
|
7069
7069
|
let e = this.causedBy;
|
|
7070
|
-
for (; e && (t.push(e), e instanceof
|
|
7070
|
+
for (; e && (t.push(e), e instanceof D); )
|
|
7071
7071
|
e = e.causedBy;
|
|
7072
7072
|
return t;
|
|
7073
7073
|
}
|
|
@@ -7171,51 +7171,92 @@ Stack trace:`, i.stack.split(`
|
|
|
7171
7171
|
return null;
|
|
7172
7172
|
}
|
|
7173
7173
|
}
|
|
7174
|
-
var M = /* @__PURE__ */ ((l) => (l.LOW = "low", l.MEDIUM = "medium", l.HIGH = "high", l.CRITICAL = "critical", l))(M || {}),
|
|
7174
|
+
var M = /* @__PURE__ */ ((l) => (l.LOW = "low", l.MEDIUM = "medium", l.HIGH = "high", l.CRITICAL = "critical", l))(M || {}), G = /* @__PURE__ */ ((l) => (l.VALIDATION = "validation", l.PERMISSION = "permission", l.COMPUTATION = "computation", l.STORAGE = "storage", l.INTERACTION = "interaction", l.ACTIVITY = "activity", l.SYSTEM = "system", l.CONFIGURATION = "configuration", l))(G || {});
|
|
7175
7175
|
class W extends Error {
|
|
7176
7176
|
constructor(t) {
|
|
7177
7177
|
super(`Retry transaction with SERIALIZABLE isolation: ${t}`), this.reason = t, this.name = "RequireSerializableRetry", Object.setPrototypeOf(this, new.target.prototype);
|
|
7178
7178
|
}
|
|
7179
7179
|
}
|
|
7180
|
-
|
|
7180
|
+
class Yr extends D {
|
|
7181
|
+
constructor(t = {}) {
|
|
7182
|
+
super(
|
|
7183
|
+
"Nested dispatch is not supported inside a dispatch transaction. Model the work as one EventSource, or dispatch again after the outer dispatch commits",
|
|
7184
|
+
{
|
|
7185
|
+
errorType: "NestedDispatchError",
|
|
7186
|
+
context: {
|
|
7187
|
+
outerEventSourceName: t.outerEventSourceName,
|
|
7188
|
+
nestedEventSourceName: t.nestedEventSourceName
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
);
|
|
7192
|
+
}
|
|
7193
|
+
}
|
|
7194
|
+
class Jt extends D {
|
|
7195
|
+
constructor(t) {
|
|
7196
|
+
super(
|
|
7197
|
+
`Transaction capability requirement is not satisfied: ${t.reason}`,
|
|
7198
|
+
{
|
|
7199
|
+
errorType: "TransactionCapabilityError",
|
|
7200
|
+
context: {
|
|
7201
|
+
transactionName: t.transactionName,
|
|
7202
|
+
requestedIsolation: t.requestedIsolation,
|
|
7203
|
+
capability: t.capability
|
|
7204
|
+
}
|
|
7205
|
+
}
|
|
7206
|
+
);
|
|
7207
|
+
}
|
|
7208
|
+
}
|
|
7209
|
+
function H(l, t = /* @__PURE__ */ new Set()) {
|
|
7181
7210
|
if (l == null || t.has(l)) return [];
|
|
7182
7211
|
t.add(l);
|
|
7183
7212
|
const e = [l];
|
|
7184
7213
|
if (typeof l != "object") return e;
|
|
7185
7214
|
const r = l;
|
|
7186
|
-
return r.causedBy && e.push(...
|
|
7215
|
+
return r.causedBy && e.push(...H(r.causedBy, t)), r.cause && e.push(...H(r.cause, t)), r.error && e.push(...H(r.error, t)), l instanceof D && l.causedBy && e.push(...H(l.causedBy, t)), e;
|
|
7187
7216
|
}
|
|
7188
|
-
function
|
|
7189
|
-
return
|
|
7217
|
+
function Zr(l) {
|
|
7218
|
+
return H(l).some((t) => t instanceof W);
|
|
7190
7219
|
}
|
|
7191
|
-
function
|
|
7192
|
-
return
|
|
7220
|
+
function ti(l) {
|
|
7221
|
+
return H(l).some((t) => {
|
|
7193
7222
|
if (!t || typeof t != "object") return !1;
|
|
7194
7223
|
const e = t.code;
|
|
7195
7224
|
return e === "40001" || e === "40P01";
|
|
7196
7225
|
});
|
|
7197
7226
|
}
|
|
7198
|
-
|
|
7199
|
-
|
|
7227
|
+
function ei(l, t) {
|
|
7228
|
+
return H(l).find((e) => !e || typeof e != "object" ? !1 : e.code === t);
|
|
7229
|
+
}
|
|
7230
|
+
function ds(l, t) {
|
|
7231
|
+
return ei(l, t) !== void 0;
|
|
7232
|
+
}
|
|
7233
|
+
const Te = [10, 25, 60, 150, 350];
|
|
7234
|
+
function ri(l) {
|
|
7200
7235
|
return new Promise((t) => setTimeout(t, l));
|
|
7201
7236
|
}
|
|
7202
|
-
function
|
|
7237
|
+
function St(l, t, e, r) {
|
|
7203
7238
|
return l && typeof l == "object" && Object.assign(l, {
|
|
7204
7239
|
transactionAttempts: t,
|
|
7205
7240
|
transactionIsolation: e,
|
|
7206
7241
|
transactionName: r
|
|
7207
7242
|
}), l;
|
|
7208
7243
|
}
|
|
7209
|
-
class
|
|
7244
|
+
class It extends Error {
|
|
7210
7245
|
constructor(t, e, r, i) {
|
|
7211
|
-
super(`Transaction retry exhausted for ${t} after ${e} attempts`, { cause: i }), this.name = "TransactionRetryExhaustedError", Object.assign(this, {
|
|
7246
|
+
super(`Transaction retry exhausted for ${t} after ${e} attempts`, { cause: i }), this.name = "TransactionRetryExhaustedError", this.transactionAttempts = e, this.transactionIsolation = r, this.transactionName = t, Object.assign(this, {
|
|
7212
7247
|
transactionAttempts: e,
|
|
7213
7248
|
transactionIsolation: r,
|
|
7214
7249
|
transactionName: t
|
|
7215
7250
|
}), Object.setPrototypeOf(this, new.target.prototype);
|
|
7216
7251
|
}
|
|
7217
7252
|
}
|
|
7218
|
-
|
|
7253
|
+
function hs(l) {
|
|
7254
|
+
return H(l).some((t) => t instanceof It);
|
|
7255
|
+
}
|
|
7256
|
+
function ps(l) {
|
|
7257
|
+
return H(l).some((t) => t instanceof Jt);
|
|
7258
|
+
}
|
|
7259
|
+
async function ae(l, t, e = {}) {
|
|
7219
7260
|
const r = e.maxAttempts ?? 5;
|
|
7220
7261
|
let i = "READ COMMITTED", s = 0, a;
|
|
7221
7262
|
for (; s < r; ) {
|
|
@@ -7223,19 +7264,34 @@ async function re(l, t, e = {}) {
|
|
|
7223
7264
|
try {
|
|
7224
7265
|
return await t(i, s);
|
|
7225
7266
|
} catch (n) {
|
|
7226
|
-
if (a = n,
|
|
7227
|
-
continue;
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7267
|
+
if (a = n, Zr(n)) {
|
|
7268
|
+
if (i = "SERIALIZABLE", s < r) continue;
|
|
7269
|
+
throw new It(
|
|
7270
|
+
l,
|
|
7271
|
+
s,
|
|
7272
|
+
i,
|
|
7273
|
+
St(n, s, i, l)
|
|
7274
|
+
);
|
|
7275
|
+
}
|
|
7276
|
+
if (ti(n)) {
|
|
7277
|
+
if (s < r) {
|
|
7278
|
+
const o = Te[Math.min(s - 1, Te.length - 1)], c = Math.floor(Math.random() * o);
|
|
7279
|
+
await ri(o + c);
|
|
7280
|
+
continue;
|
|
7281
|
+
}
|
|
7282
|
+
throw new It(
|
|
7283
|
+
l,
|
|
7284
|
+
s,
|
|
7285
|
+
i,
|
|
7286
|
+
St(n, s, i, l)
|
|
7287
|
+
);
|
|
7232
7288
|
}
|
|
7233
|
-
throw
|
|
7289
|
+
throw St(n, s, i, l);
|
|
7234
7290
|
}
|
|
7235
7291
|
}
|
|
7236
|
-
throw new
|
|
7292
|
+
throw new It(l, s, i, St(a, s, i, l));
|
|
7237
7293
|
}
|
|
7238
|
-
class
|
|
7294
|
+
class ii {
|
|
7239
7295
|
constructor(t, e, r) {
|
|
7240
7296
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, A(!(this.args.record && this.args.eventDeps), "Transform must have either record or eventDep"), A(!(this.args.dataDeps && this.args.eventDeps), "Transform must have either dataDeps or eventDeps"), this.transformCallback = this.args.callback.bind(this.controller), this.args.eventDeps ? this.eventDeps = this.args.eventDeps : (A(this.args.dataDeps?._source === void 0, "dataDep name `_source` is reserved for Transform"), this.dataDeps = {
|
|
7241
7297
|
...this.args.dataDeps || {},
|
|
@@ -7247,7 +7303,7 @@ class Zr {
|
|
|
7247
7303
|
});
|
|
7248
7304
|
}
|
|
7249
7305
|
static {
|
|
7250
|
-
this.computationType =
|
|
7306
|
+
this.computationType = Mt;
|
|
7251
7307
|
}
|
|
7252
7308
|
static {
|
|
7253
7309
|
this.contextType = ["entity", "relation"];
|
|
@@ -7354,7 +7410,7 @@ class Zr {
|
|
|
7354
7410
|
return i;
|
|
7355
7411
|
}
|
|
7356
7412
|
}
|
|
7357
|
-
const
|
|
7413
|
+
const si = [ii];
|
|
7358
7414
|
class O {
|
|
7359
7415
|
constructor(t) {
|
|
7360
7416
|
this.node = t;
|
|
@@ -7453,13 +7509,13 @@ class O {
|
|
|
7453
7509
|
}
|
|
7454
7510
|
}
|
|
7455
7511
|
gt(t) {
|
|
7456
|
-
return new
|
|
7512
|
+
return new Pt(this, ">", t);
|
|
7457
7513
|
}
|
|
7458
7514
|
lt(t) {
|
|
7459
|
-
return new
|
|
7515
|
+
return new Pt(this, "<", t);
|
|
7460
7516
|
}
|
|
7461
7517
|
eq(t) {
|
|
7462
|
-
return new
|
|
7518
|
+
return new ne(this, t);
|
|
7463
7519
|
}
|
|
7464
7520
|
getVariables() {
|
|
7465
7521
|
const t = /* @__PURE__ */ new Set();
|
|
@@ -7556,7 +7612,7 @@ class O {
|
|
|
7556
7612
|
}
|
|
7557
7613
|
}
|
|
7558
7614
|
}
|
|
7559
|
-
class
|
|
7615
|
+
class Pt {
|
|
7560
7616
|
constructor(t, e, r) {
|
|
7561
7617
|
this.left = t, this.operator = e, this.right = r;
|
|
7562
7618
|
}
|
|
@@ -7591,7 +7647,7 @@ class Ct {
|
|
|
7591
7647
|
}
|
|
7592
7648
|
}
|
|
7593
7649
|
}
|
|
7594
|
-
class
|
|
7650
|
+
class ne {
|
|
7595
7651
|
constructor(t, e) {
|
|
7596
7652
|
this.left = t, this.right = e;
|
|
7597
7653
|
}
|
|
@@ -7626,7 +7682,7 @@ class ie {
|
|
|
7626
7682
|
}
|
|
7627
7683
|
}
|
|
7628
7684
|
}
|
|
7629
|
-
class
|
|
7685
|
+
class ai {
|
|
7630
7686
|
constructor(t, e, r) {
|
|
7631
7687
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = this.args.dataDeps ?? {}, this.callback = (i, s) => this.args.callback.call(this.controller, i, s), this.nextRecomputeTime = this.args.nextRecomputeTime ? (i, s) => this.args.nextRecomputeTime.call(this.controller, i, s) : void 0;
|
|
7632
7688
|
}
|
|
@@ -7651,14 +7707,14 @@ class ei {
|
|
|
7651
7707
|
let i, s;
|
|
7652
7708
|
if (e instanceof O)
|
|
7653
7709
|
i = e.evaluate({ now: r }), s = r + this.nextRecomputeTime(r, t);
|
|
7654
|
-
else if (e instanceof
|
|
7710
|
+
else if (e instanceof Pt || e instanceof ne)
|
|
7655
7711
|
i = e.evaluate({ now: r }), s = e.solve();
|
|
7656
7712
|
else
|
|
7657
7713
|
throw new Error("Invalid result type");
|
|
7658
7714
|
return await this.state.lastRecomputeTime.setInternal(r), await this.state.nextRecomputeTime.setInternal(s), i;
|
|
7659
7715
|
}
|
|
7660
7716
|
}
|
|
7661
|
-
class
|
|
7717
|
+
class ni {
|
|
7662
7718
|
constructor(t, e, r) {
|
|
7663
7719
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {
|
|
7664
7720
|
_current: {
|
|
@@ -7689,15 +7745,15 @@ class ri {
|
|
|
7689
7745
|
let s, a;
|
|
7690
7746
|
if (r instanceof O)
|
|
7691
7747
|
s = r.evaluate({ now: i }), a = i + this.nextRecomputeTime(i, t);
|
|
7692
|
-
else if (r instanceof
|
|
7748
|
+
else if (r instanceof Pt || r instanceof ne)
|
|
7693
7749
|
s = r.evaluate({ now: i }), a = r.solve();
|
|
7694
7750
|
else
|
|
7695
7751
|
throw new Error("Invalid result type");
|
|
7696
7752
|
return await this.state.lastRecomputeTime.setInternal(e, i), await this.state.nextRecomputeTime.setInternal(e, a), s;
|
|
7697
7753
|
}
|
|
7698
7754
|
}
|
|
7699
|
-
const
|
|
7700
|
-
class
|
|
7755
|
+
const oi = [ai, ni];
|
|
7756
|
+
class ci {
|
|
7701
7757
|
constructor(t, e, r) {
|
|
7702
7758
|
if (this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
|
|
7703
7759
|
throw new Error("Sum computation requires attributeQuery with at least one field");
|
|
@@ -7758,7 +7814,7 @@ class si {
|
|
|
7758
7814
|
return this.state.sum.increment(s);
|
|
7759
7815
|
}
|
|
7760
7816
|
}
|
|
7761
|
-
class
|
|
7817
|
+
class li {
|
|
7762
7818
|
constructor(t, e, r) {
|
|
7763
7819
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.relation = this.controller.relations.find((n) => n.source === r.host && n.sourceProperty === this.args.property || n.target === r.host && n.targetProperty === this.args.property), A(this.relation, "summation computation must specify either property or record"), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, A(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "summation computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7764
7820
|
const i = this.args.attributeQuery || [];
|
|
@@ -7847,8 +7903,8 @@ class ai {
|
|
|
7847
7903
|
return this.state.sum.increment(e.record, a);
|
|
7848
7904
|
}
|
|
7849
7905
|
}
|
|
7850
|
-
const
|
|
7851
|
-
class
|
|
7906
|
+
const ui = [ci, li];
|
|
7907
|
+
class di {
|
|
7852
7908
|
constructor(t, e, r) {
|
|
7853
7909
|
if (this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.record = this.args.record, !this.args.attributeQuery || this.args.attributeQuery.length === 0)
|
|
7854
7910
|
throw new Error("Average computation requires attributeQuery with at least one field");
|
|
@@ -7928,7 +7984,7 @@ class oi {
|
|
|
7928
7984
|
return c > 0 ? o / c : 0;
|
|
7929
7985
|
}
|
|
7930
7986
|
}
|
|
7931
|
-
class
|
|
7987
|
+
class hi {
|
|
7932
7988
|
constructor(t, e, r) {
|
|
7933
7989
|
this.controller = t, this.args = e, this.dataContext = r, this.useLastValue = !1, this.dataDeps = {}, this.relation = this.controller.relations.find((n) => n.source === r.host && n.sourceProperty === this.args.property || n.target === r.host && n.targetProperty === this.args.property), this.isSource = this.args.direction ? this.args.direction === "source" : this.relation.source.name === r.host.name, A(this.isSource ? this.relation.source === r.host : this.relation.target === r.host, "average computation relation direction error"), this.relationAttr = this.isSource ? this.relation.sourceProperty : this.relation.targetProperty, this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name, this.property = this.args.property || this.relationAttr, this.reverseProperty = this.isSource ? this.relation.targetProperty : this.relation.sourceProperty;
|
|
7934
7990
|
const i = this.args.attributeQuery || [];
|
|
@@ -8013,8 +8069,8 @@ class ci {
|
|
|
8013
8069
|
return c > 0 ? o / c : 0;
|
|
8014
8070
|
}
|
|
8015
8071
|
}
|
|
8016
|
-
const
|
|
8017
|
-
class
|
|
8072
|
+
const pi = [di, hi];
|
|
8073
|
+
class Ot {
|
|
8018
8074
|
constructor(t, e, r) {
|
|
8019
8075
|
this.controller = t, this.args = e, this.dataContext = r, this.state = {}, this.dataDeps = {}, this.useLastValue = e.useLastValue !== void 0 ? e.useLastValue : !0, e.dataDeps && (this.dataDeps = e.dataDeps), e.compute && (this.computeCallback = e.compute, this.compute = async (...i) => {
|
|
8020
8076
|
if (this.computeCallback) {
|
|
@@ -8058,7 +8114,7 @@ class Pt {
|
|
|
8058
8114
|
}));
|
|
8059
8115
|
}
|
|
8060
8116
|
static {
|
|
8061
|
-
this.computationType =
|
|
8117
|
+
this.computationType = se;
|
|
8062
8118
|
}
|
|
8063
8119
|
createState() {
|
|
8064
8120
|
if (this.createStateCallback) {
|
|
@@ -8086,22 +8142,22 @@ class Pt {
|
|
|
8086
8142
|
return k.skip();
|
|
8087
8143
|
}
|
|
8088
8144
|
}
|
|
8089
|
-
class
|
|
8145
|
+
class fi extends Ot {
|
|
8090
8146
|
static {
|
|
8091
8147
|
this.contextType = "global";
|
|
8092
8148
|
}
|
|
8093
8149
|
}
|
|
8094
|
-
class
|
|
8150
|
+
class mi extends Ot {
|
|
8095
8151
|
static {
|
|
8096
8152
|
this.contextType = "entity";
|
|
8097
8153
|
}
|
|
8098
8154
|
}
|
|
8099
|
-
class
|
|
8155
|
+
class yi extends Ot {
|
|
8100
8156
|
static {
|
|
8101
8157
|
this.contextType = "relation";
|
|
8102
8158
|
}
|
|
8103
8159
|
}
|
|
8104
|
-
class
|
|
8160
|
+
class gi extends Ot {
|
|
8105
8161
|
static {
|
|
8106
8162
|
this.contextType = "property";
|
|
8107
8163
|
}
|
|
@@ -8116,18 +8172,18 @@ If you want to use aggregated data from all records in the entity/relation, you
|
|
|
8116
8172
|
super(t, e, r);
|
|
8117
8173
|
}
|
|
8118
8174
|
}
|
|
8119
|
-
const
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8175
|
+
const bi = [
|
|
8176
|
+
fi,
|
|
8177
|
+
mi,
|
|
8178
|
+
yi,
|
|
8179
|
+
gi
|
|
8124
8180
|
];
|
|
8125
|
-
class
|
|
8181
|
+
class L extends D {
|
|
8126
8182
|
constructor(t, e = {}) {
|
|
8127
8183
|
super(t, {
|
|
8128
8184
|
errorType: e.context?.errorType || "ComputationError",
|
|
8129
8185
|
context: {
|
|
8130
|
-
category:
|
|
8186
|
+
category: G.COMPUTATION,
|
|
8131
8187
|
handleName: e.handleName,
|
|
8132
8188
|
computationName: e.computationName,
|
|
8133
8189
|
dataContext: e.dataContext,
|
|
@@ -8138,7 +8194,7 @@ class V extends Q {
|
|
|
8138
8194
|
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity || M.MEDIUM;
|
|
8139
8195
|
}
|
|
8140
8196
|
}
|
|
8141
|
-
class
|
|
8197
|
+
class Ee extends L {
|
|
8142
8198
|
constructor(t, e = {}) {
|
|
8143
8199
|
super(t, {
|
|
8144
8200
|
...e,
|
|
@@ -8153,7 +8209,7 @@ class ve extends V {
|
|
|
8153
8209
|
}), this.stateKey = e.stateKey, this.stateValue = e.stateValue, this.expectedStateType = e.expectedStateType, this.actualStateType = e.actualStateType;
|
|
8154
8210
|
}
|
|
8155
8211
|
}
|
|
8156
|
-
class
|
|
8212
|
+
class z extends L {
|
|
8157
8213
|
constructor(t, e = {}) {
|
|
8158
8214
|
super(t, {
|
|
8159
8215
|
...e,
|
|
@@ -8168,7 +8224,7 @@ class K extends V {
|
|
|
8168
8224
|
}), this.depName = e.depName, this.depType = e.depType, this.missingData = e.missingData, this.invalidData = e.invalidData;
|
|
8169
8225
|
}
|
|
8170
8226
|
}
|
|
8171
|
-
class
|
|
8227
|
+
class _e extends D {
|
|
8172
8228
|
constructor(t, e) {
|
|
8173
8229
|
super(t, {
|
|
8174
8230
|
errorType: "ConstraintViolationError",
|
|
@@ -8182,13 +8238,13 @@ class Ve extends Q {
|
|
|
8182
8238
|
driver: e.driver,
|
|
8183
8239
|
rawCode: e.rawCode,
|
|
8184
8240
|
severity: M.MEDIUM,
|
|
8185
|
-
category:
|
|
8241
|
+
category: G.STORAGE
|
|
8186
8242
|
},
|
|
8187
8243
|
causedBy: e.causedBy
|
|
8188
8244
|
}), this.constraintName = e.constraintName, this.recordName = e.recordName, this.properties = e.properties;
|
|
8189
8245
|
}
|
|
8190
8246
|
}
|
|
8191
|
-
class
|
|
8247
|
+
class _t extends D {
|
|
8192
8248
|
constructor(t, e = {}) {
|
|
8193
8249
|
super(t, {
|
|
8194
8250
|
errorType: "ConstraintSetupError",
|
|
@@ -8203,27 +8259,27 @@ class qt extends Q {
|
|
|
8203
8259
|
driver: e.driver,
|
|
8204
8260
|
rawCode: e.rawCode,
|
|
8205
8261
|
severity: M.HIGH,
|
|
8206
|
-
category:
|
|
8262
|
+
category: G.STORAGE
|
|
8207
8263
|
},
|
|
8208
8264
|
causedBy: e.causedBy
|
|
8209
8265
|
}), this.constraintName = e.constraintName, this.recordName = e.recordName, this.properties = e.properties;
|
|
8210
8266
|
}
|
|
8211
8267
|
}
|
|
8212
|
-
function
|
|
8268
|
+
function Ri(l) {
|
|
8213
8269
|
let t = l;
|
|
8214
8270
|
const e = /* @__PURE__ */ new Set();
|
|
8215
8271
|
for (; t && !e.has(t); ) {
|
|
8216
|
-
if (e.add(t), t instanceof
|
|
8217
|
-
t instanceof Error ? t = (t instanceof
|
|
8272
|
+
if (e.add(t), t instanceof _e) return t;
|
|
8273
|
+
t instanceof Error ? t = (t instanceof D ? t.causedBy : void 0) || t.cause : t = void 0;
|
|
8218
8274
|
}
|
|
8219
8275
|
}
|
|
8220
|
-
function
|
|
8276
|
+
function wi(l, t) {
|
|
8221
8277
|
for (const e of t) {
|
|
8222
8278
|
const r = l[e];
|
|
8223
8279
|
if (typeof r == "string" && r.length > 0) return r;
|
|
8224
8280
|
}
|
|
8225
8281
|
}
|
|
8226
|
-
function
|
|
8282
|
+
function Ni(l) {
|
|
8227
8283
|
const t = "UNIQUE constraint failed: ", e = l.indexOf(t);
|
|
8228
8284
|
if (e < 0) return;
|
|
8229
8285
|
const r = l.slice(e + t.length).split(",").map((s) => s.trim());
|
|
@@ -8232,8 +8288,8 @@ function gi(l) {
|
|
|
8232
8288
|
fields: r.map((s) => s.split(".").at(-1).replace(/^"|"$/g, ""))
|
|
8233
8289
|
};
|
|
8234
8290
|
}
|
|
8235
|
-
function
|
|
8236
|
-
const e = l && typeof l == "object" ? l : {}, r = l instanceof Error ? l.message : String(l), i = e.code ?? e.errno, s =
|
|
8291
|
+
function Bt(l, t) {
|
|
8292
|
+
const e = l && typeof l == "object" ? l : {}, r = l instanceof Error ? l.message : String(l), i = e.code ?? e.errno, s = wi(e, ["constraint", "constraintName", "index", "sqlMessage"]), a = Ni(r), n = i === "23505" || i === "SQLITE_CONSTRAINT_UNIQUE" || i === "SQLITE_CONSTRAINT" || i === 1062 || r.includes("UNIQUE constraint failed") || r.includes("duplicate key value violates unique constraint") || r.includes("Duplicate entry");
|
|
8237
8293
|
return {
|
|
8238
8294
|
driver: t?.constructor?.name,
|
|
8239
8295
|
message: r,
|
|
@@ -8245,12 +8301,12 @@ function Qt(l, t) {
|
|
|
8245
8301
|
raw: l
|
|
8246
8302
|
};
|
|
8247
8303
|
}
|
|
8248
|
-
class
|
|
8304
|
+
class Ut extends D {
|
|
8249
8305
|
constructor(t, e = {}) {
|
|
8250
8306
|
super(t, {
|
|
8251
8307
|
errorType: e.context?.errorType || "SchedulerError",
|
|
8252
8308
|
context: {
|
|
8253
|
-
category:
|
|
8309
|
+
category: G.SYSTEM,
|
|
8254
8310
|
schedulingPhase: e.schedulingPhase,
|
|
8255
8311
|
failedComputations: e.failedComputations,
|
|
8256
8312
|
...e.context
|
|
@@ -8259,12 +8315,12 @@ class _t extends Q {
|
|
|
8259
8315
|
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity = M.HIGH;
|
|
8260
8316
|
}
|
|
8261
8317
|
}
|
|
8262
|
-
class
|
|
8318
|
+
class Ae extends D {
|
|
8263
8319
|
constructor(t, e) {
|
|
8264
8320
|
super(t, {
|
|
8265
8321
|
errorType: "SideEffectError",
|
|
8266
8322
|
context: {
|
|
8267
|
-
category:
|
|
8323
|
+
category: G.SYSTEM,
|
|
8268
8324
|
sideEffectName: e.sideEffectName,
|
|
8269
8325
|
recordName: e.recordName,
|
|
8270
8326
|
mutationType: e.mutationType,
|
|
@@ -8275,12 +8331,12 @@ class Te extends Q {
|
|
|
8275
8331
|
}), this.sideEffectName = e.sideEffectName, this.recordName = e.recordName, this.mutationType = e.mutationType, this.severity = M.MEDIUM;
|
|
8276
8332
|
}
|
|
8277
8333
|
}
|
|
8278
|
-
class
|
|
8334
|
+
class X extends D {
|
|
8279
8335
|
constructor(t, e) {
|
|
8280
8336
|
super(t, {
|
|
8281
8337
|
errorType: e.context?.errorType || "ConditionError",
|
|
8282
8338
|
context: {
|
|
8283
|
-
category:
|
|
8339
|
+
category: G.PERMISSION,
|
|
8284
8340
|
checkType: e.checkType,
|
|
8285
8341
|
fieldName: e.fieldName,
|
|
8286
8342
|
payload: e.payload,
|
|
@@ -8294,7 +8350,7 @@ class z extends Q {
|
|
|
8294
8350
|
* Helper factory methods for common condition error scenarios
|
|
8295
8351
|
*/
|
|
8296
8352
|
static userCheckFailed(t, e) {
|
|
8297
|
-
return new
|
|
8353
|
+
return new X("User check failed", {
|
|
8298
8354
|
checkType: "user",
|
|
8299
8355
|
evaluationError: t,
|
|
8300
8356
|
severity: M.HIGH,
|
|
@@ -8305,7 +8361,7 @@ class z extends Q {
|
|
|
8305
8361
|
}
|
|
8306
8362
|
static payloadValidationFailed(t, e, r, i) {
|
|
8307
8363
|
const s = `${t} ${e}`;
|
|
8308
|
-
return new
|
|
8364
|
+
return new X(`Payload validation failed for field '${t}': ${e}`, {
|
|
8309
8365
|
checkType: "payload",
|
|
8310
8366
|
fieldName: t,
|
|
8311
8367
|
payload: r,
|
|
@@ -8316,7 +8372,7 @@ class z extends Q {
|
|
|
8316
8372
|
});
|
|
8317
8373
|
}
|
|
8318
8374
|
static conditionCheckFailed(t, e) {
|
|
8319
|
-
return new
|
|
8375
|
+
return new X(`Condition check failed: ${t.data.name}`, {
|
|
8320
8376
|
checkType: "condition",
|
|
8321
8377
|
evaluationError: t,
|
|
8322
8378
|
severity: M.HIGH,
|
|
@@ -8327,7 +8383,7 @@ class z extends Q {
|
|
|
8327
8383
|
}
|
|
8328
8384
|
static attributiveCheckFailed(t, e, r, i) {
|
|
8329
8385
|
const s = `${t} ${e}`;
|
|
8330
|
-
return new
|
|
8386
|
+
return new X(`Attributive check failed for field '${t}': ${e}`, {
|
|
8331
8387
|
checkType: "attributive",
|
|
8332
8388
|
fieldName: t,
|
|
8333
8389
|
payload: r,
|
|
@@ -8338,7 +8394,7 @@ class z extends Q {
|
|
|
8338
8394
|
});
|
|
8339
8395
|
}
|
|
8340
8396
|
static conceptCheckFailed(t, e) {
|
|
8341
|
-
return new
|
|
8397
|
+
return new X(`Concept check failed for field '${t}'`, {
|
|
8342
8398
|
checkType: "concept",
|
|
8343
8399
|
fieldName: t,
|
|
8344
8400
|
evaluationError: e,
|
|
@@ -8348,10 +8404,10 @@ class z extends Q {
|
|
|
8348
8404
|
});
|
|
8349
8405
|
}
|
|
8350
8406
|
}
|
|
8351
|
-
const
|
|
8352
|
-
class
|
|
8407
|
+
const Wt = "_ASYNC_TASK_";
|
|
8408
|
+
class vi {
|
|
8353
8409
|
constructor(t, e, r, i, s) {
|
|
8354
|
-
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new
|
|
8410
|
+
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new Dr(this.controller, this), this.buildComputationHandleMap(s);
|
|
8355
8411
|
const a = [];
|
|
8356
8412
|
i.forEach((n) => {
|
|
8357
8413
|
n.computation && a.push({ dataContext: { type: "global", id: n }, args: n.computation });
|
|
@@ -8659,7 +8715,7 @@ class bi {
|
|
|
8659
8715
|
try {
|
|
8660
8716
|
this.isDataBasedComputation(t.computation) ? r = await this.computeDataBasedDirtyRecordsAndEvents(t, e) : r = await this.computeEventBasedDirtyRecordsAndEvents(t, e);
|
|
8661
8717
|
} catch (i) {
|
|
8662
|
-
throw new
|
|
8718
|
+
throw new L("Failed to compute dirty records and events", {
|
|
8663
8719
|
handleName: t.computation.constructor.name,
|
|
8664
8720
|
computationName: t.computation.args.constructor.displayName,
|
|
8665
8721
|
dataContext: t.computation.dataContext,
|
|
@@ -8671,7 +8727,7 @@ class bi {
|
|
|
8671
8727
|
try {
|
|
8672
8728
|
await this.runComputation(t.computation, s, i);
|
|
8673
8729
|
} catch (a) {
|
|
8674
|
-
throw new
|
|
8730
|
+
throw new L("Failed to run computation for dirty record", {
|
|
8675
8731
|
handleName: t.computation.constructor.name,
|
|
8676
8732
|
computationName: t.computation.args.constructor.displayName,
|
|
8677
8733
|
dataContext: t.computation.dataContext,
|
|
@@ -8682,7 +8738,7 @@ class bi {
|
|
|
8682
8738
|
}
|
|
8683
8739
|
}
|
|
8684
8740
|
} catch (r) {
|
|
8685
|
-
throw r instanceof
|
|
8741
|
+
throw r instanceof L ? r : new Ut("Unexpected error in dirty records computation", {
|
|
8686
8742
|
schedulingPhase: "dirty-records-processing",
|
|
8687
8743
|
failedComputations: [t.computation.args.constructor.displayName],
|
|
8688
8744
|
causedBy: r instanceof Error ? r : new Error(String(r))
|
|
@@ -8692,8 +8748,8 @@ class bi {
|
|
|
8692
8748
|
getAsyncTaskRecordKey(t) {
|
|
8693
8749
|
if (t.dataContext.type === "property") {
|
|
8694
8750
|
const e = t.dataContext;
|
|
8695
|
-
return `${
|
|
8696
|
-
} else return t.dataContext.type === "global" ? `${
|
|
8751
|
+
return `${Wt}_${e.host.name}_${e.id.name}`;
|
|
8752
|
+
} else return t.dataContext.type === "global" ? `${Wt}_${t.dataContext.id.name}` : `${Wt}_${t.dataContext.type}_${t.dataContext.id?.name}`;
|
|
8697
8753
|
}
|
|
8698
8754
|
getComputationName(t) {
|
|
8699
8755
|
return t.args.name || t.args.constructor.displayName;
|
|
@@ -8751,7 +8807,7 @@ class bi {
|
|
|
8751
8807
|
throw new Error(`Async computation for ${t.dataContext.type} is not implemented yet`);
|
|
8752
8808
|
}
|
|
8753
8809
|
async handleAsyncReturn(t, e) {
|
|
8754
|
-
return
|
|
8810
|
+
return ae(`asyncReturn:${this.getAsyncTaskRecordKey(t)}`, async (r) => this.controller.system.storage.runInTransaction({ name: `asyncReturn:${this.getAsyncTaskRecordKey(t)}`, isolation: r }, async () => {
|
|
8755
8811
|
const i = this.getAsyncTaskRecordKey(t), s = t.dataContext.type === "property" ? ["*", ["record", { attributeQuery: ["id"] }]] : ["*"], n = (await this.controller.system.storage.atomic.lockRows(
|
|
8756
8812
|
i,
|
|
8757
8813
|
y.atom({ key: "id", value: ["=", e.id] }),
|
|
@@ -8796,7 +8852,7 @@ class bi {
|
|
|
8796
8852
|
try {
|
|
8797
8853
|
n = t.dataDeps ? await this.resolveDataDeps(t, r) : {};
|
|
8798
8854
|
} catch (o) {
|
|
8799
|
-
throw new
|
|
8855
|
+
throw new z("Failed to resolve computation data dependencies", {
|
|
8800
8856
|
handleName: t.constructor.name,
|
|
8801
8857
|
computationName: t.args.constructor.displayName,
|
|
8802
8858
|
dataContext: t.dataContext,
|
|
@@ -8813,7 +8869,7 @@ class bi {
|
|
|
8813
8869
|
try {
|
|
8814
8870
|
o = await this.controller.retrieveLastValue(t.dataContext, r);
|
|
8815
8871
|
} catch (c) {
|
|
8816
|
-
throw new
|
|
8872
|
+
throw new Ee("Failed to retrieve last value for incremental computation", {
|
|
8817
8873
|
handleName: t.constructor.name,
|
|
8818
8874
|
computationName: t.args.constructor.displayName,
|
|
8819
8875
|
dataContext: t.dataContext,
|
|
@@ -8827,7 +8883,7 @@ class bi {
|
|
|
8827
8883
|
try {
|
|
8828
8884
|
o = await this.controller.retrieveLastValue(t.dataContext, r);
|
|
8829
8885
|
} catch (c) {
|
|
8830
|
-
throw new
|
|
8886
|
+
throw new Ee("Failed to retrieve last value for incremental patch computation", {
|
|
8831
8887
|
handleName: t.constructor.name,
|
|
8832
8888
|
computationName: t.args.constructor.displayName,
|
|
8833
8889
|
dataContext: t.dataContext,
|
|
@@ -8836,18 +8892,18 @@ class bi {
|
|
|
8836
8892
|
}
|
|
8837
8893
|
s = await t.incrementalPatchCompute(o, e, r, n);
|
|
8838
8894
|
} else
|
|
8839
|
-
throw new
|
|
8895
|
+
throw new L(`Unknown computation type: ${t.constructor.name}`, {
|
|
8840
8896
|
handleName: t.constructor.name,
|
|
8841
8897
|
computationName: t.args.constructor.displayName,
|
|
8842
8898
|
dataContext: t.dataContext,
|
|
8843
8899
|
computationPhase: "type-validation"
|
|
8844
8900
|
});
|
|
8845
|
-
if (s instanceof
|
|
8901
|
+
if (s instanceof Ve) {
|
|
8846
8902
|
const o = t;
|
|
8847
8903
|
if (this.controller.system.storage.getTransactionIsolation() !== "SERIALIZABLE")
|
|
8848
8904
|
throw new W(`full recompute ${t.args.name || t.args.constructor.displayName}`);
|
|
8849
8905
|
if (!o.compute)
|
|
8850
|
-
throw new
|
|
8906
|
+
throw new L("compute must be defined for computation when incrementalCompute returns ComputationResultFullRecompute", {
|
|
8851
8907
|
handleName: t.constructor.name,
|
|
8852
8908
|
computationName: t.args.constructor.displayName,
|
|
8853
8909
|
dataContext: t.dataContext,
|
|
@@ -8857,7 +8913,7 @@ class bi {
|
|
|
8857
8913
|
}
|
|
8858
8914
|
}
|
|
8859
8915
|
} catch (o) {
|
|
8860
|
-
throw o instanceof
|
|
8916
|
+
throw o instanceof L ? o : new L("Computation execution failed", {
|
|
8861
8917
|
handleName: t.constructor.name,
|
|
8862
8918
|
computationName: t.args.constructor.displayName,
|
|
8863
8919
|
dataContext: t.dataContext,
|
|
@@ -8865,13 +8921,13 @@ class bi {
|
|
|
8865
8921
|
causedBy: o instanceof Error ? o : new Error(String(o))
|
|
8866
8922
|
});
|
|
8867
8923
|
}
|
|
8868
|
-
if (s instanceof
|
|
8924
|
+
if (s instanceof xt)
|
|
8869
8925
|
return;
|
|
8870
|
-
if (s instanceof
|
|
8926
|
+
if (s instanceof Le)
|
|
8871
8927
|
try {
|
|
8872
8928
|
return await this.createAsyncTask(t, s.args, r);
|
|
8873
8929
|
} catch (o) {
|
|
8874
|
-
throw new
|
|
8930
|
+
throw new L("Failed to create async task", {
|
|
8875
8931
|
handleName: t.constructor.name,
|
|
8876
8932
|
computationName: t.args.constructor.displayName,
|
|
8877
8933
|
dataContext: t.dataContext,
|
|
@@ -8880,7 +8936,7 @@ class bi {
|
|
|
8880
8936
|
});
|
|
8881
8937
|
}
|
|
8882
8938
|
try {
|
|
8883
|
-
const o = s instanceof
|
|
8939
|
+
const o = s instanceof qe ? await t.asyncReturn(s.result, s.args) : s;
|
|
8884
8940
|
if (t.incrementalPatchCompute) {
|
|
8885
8941
|
if (this.requiresSerializablePatchApply(t) && this.controller.system.storage.getTransactionIsolation() !== "SERIALIZABLE")
|
|
8886
8942
|
throw new W(`entity/relation patch from custom computation ${this.getComputationName(t)}`);
|
|
@@ -8888,7 +8944,7 @@ class bi {
|
|
|
8888
8944
|
} else
|
|
8889
8945
|
await this.controller.applyResult(t.dataContext, o, r);
|
|
8890
8946
|
} catch (o) {
|
|
8891
|
-
throw new
|
|
8947
|
+
throw new L("Failed to apply computation result", {
|
|
8892
8948
|
handleName: t.constructor.name,
|
|
8893
8949
|
computationName: t.args.constructor.displayName,
|
|
8894
8950
|
dataContext: t.dataContext,
|
|
@@ -8897,7 +8953,7 @@ class bi {
|
|
|
8897
8953
|
});
|
|
8898
8954
|
}
|
|
8899
8955
|
} catch (s) {
|
|
8900
|
-
throw s instanceof
|
|
8956
|
+
throw s instanceof L ? s : new L("Unexpected error during computation execution", {
|
|
8901
8957
|
handleName: t.constructor.name,
|
|
8902
8958
|
computationName: t.args.constructor.displayName,
|
|
8903
8959
|
dataContext: t.dataContext,
|
|
@@ -8915,7 +8971,7 @@ class bi {
|
|
|
8915
8971
|
return await this.controller.system.storage.find(s.source.name, void 0, {}, s.attributeQuery);
|
|
8916
8972
|
if (s.type === "property") {
|
|
8917
8973
|
if (!e?.id)
|
|
8918
|
-
throw new
|
|
8974
|
+
throw new z("Record ID is required for property data dependency", {
|
|
8919
8975
|
depName: i,
|
|
8920
8976
|
depType: s.type,
|
|
8921
8977
|
missingData: !0,
|
|
@@ -8927,7 +8983,7 @@ class bi {
|
|
|
8927
8983
|
} else {
|
|
8928
8984
|
if (s.type === "global")
|
|
8929
8985
|
return await this.controller.system.storage.dict.get(s.source.name);
|
|
8930
|
-
throw new
|
|
8986
|
+
throw new z(`Unknown data dependency type: ${s.type}`, {
|
|
8931
8987
|
depName: i,
|
|
8932
8988
|
depType: s.type,
|
|
8933
8989
|
invalidData: !0,
|
|
@@ -8937,7 +8993,7 @@ class bi {
|
|
|
8937
8993
|
});
|
|
8938
8994
|
}
|
|
8939
8995
|
} catch (a) {
|
|
8940
|
-
throw a instanceof
|
|
8996
|
+
throw a instanceof z ? a : new z(`Failed to resolve data dependency '${i}'`, {
|
|
8941
8997
|
depName: i,
|
|
8942
8998
|
depType: s.type,
|
|
8943
8999
|
handleName: t.constructor.name,
|
|
@@ -8949,7 +9005,7 @@ class bi {
|
|
|
8949
9005
|
}));
|
|
8950
9006
|
return Object.fromEntries(Object.entries(t.dataDeps).map(([i], s) => [i, r[s]]));
|
|
8951
9007
|
} catch (r) {
|
|
8952
|
-
throw r instanceof
|
|
9008
|
+
throw r instanceof z ? r : new z("Failed to resolve computation data dependencies", {
|
|
8953
9009
|
handleName: t.constructor.name,
|
|
8954
9010
|
computationName: t.args.constructor.displayName,
|
|
8955
9011
|
dataContext: t.dataContext,
|
|
@@ -8968,39 +9024,39 @@ class bi {
|
|
|
8968
9024
|
try {
|
|
8969
9025
|
this.addMutationPropertyComputationDefaultValueListeners(), this.addMutationComputationListeners(), t && (await this.setupGlobalBoundStateDefaultValues(), await this.setupGlobalComputationDefaultValue(), await this.setupDictDefaultValue());
|
|
8970
9026
|
} catch (e) {
|
|
8971
|
-
throw e instanceof
|
|
9027
|
+
throw e instanceof Ut ? e : new Ut("Unexpected error during scheduler setup", {
|
|
8972
9028
|
schedulingPhase: "top-level-setup",
|
|
8973
9029
|
causedBy: e instanceof Error ? e : new Error(String(e))
|
|
8974
9030
|
});
|
|
8975
9031
|
}
|
|
8976
9032
|
}
|
|
8977
9033
|
}
|
|
8978
|
-
const
|
|
8979
|
-
function
|
|
8980
|
-
return
|
|
9034
|
+
const oe = new $e();
|
|
9035
|
+
function Ti() {
|
|
9036
|
+
return oe.getStore()?.effects;
|
|
8981
9037
|
}
|
|
8982
|
-
function
|
|
8983
|
-
const t =
|
|
9038
|
+
function Se(l) {
|
|
9039
|
+
const t = oe.getStore();
|
|
8984
9040
|
t?.effects && t.effects.push(...l);
|
|
8985
9041
|
}
|
|
8986
|
-
const
|
|
8987
|
-
class
|
|
9042
|
+
const fs = "User";
|
|
9043
|
+
class Be {
|
|
8988
9044
|
constructor(t) {
|
|
8989
9045
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
8990
9046
|
}
|
|
8991
9047
|
static create(t) {
|
|
8992
|
-
return new
|
|
9048
|
+
return new Be(t);
|
|
8993
9049
|
}
|
|
8994
9050
|
}
|
|
8995
|
-
const
|
|
9051
|
+
const Kt = "_isDeleted_", ke = new Ie(), ms = {
|
|
8996
9052
|
create() {
|
|
8997
9053
|
return N.create({
|
|
8998
|
-
name:
|
|
9054
|
+
name: Kt,
|
|
8999
9055
|
type: "boolean"
|
|
9000
9056
|
});
|
|
9001
9057
|
}
|
|
9002
9058
|
};
|
|
9003
|
-
class
|
|
9059
|
+
class ys {
|
|
9004
9060
|
constructor(t) {
|
|
9005
9061
|
this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
|
|
9006
9062
|
BoolExp: w,
|
|
@@ -9024,19 +9080,19 @@ class ls {
|
|
|
9024
9080
|
for (const p of this.eventSources)
|
|
9025
9081
|
p.entity && p.entity.name && !d.has(p.entity.name) && (this.entities.push(p.entity), d.add(p.entity.name));
|
|
9026
9082
|
const h = [
|
|
9027
|
-
...
|
|
9028
|
-
...
|
|
9083
|
+
...Xr,
|
|
9084
|
+
...si,
|
|
9085
|
+
...Jr,
|
|
9029
9086
|
...jr,
|
|
9030
9087
|
...Br,
|
|
9088
|
+
...ui,
|
|
9089
|
+
...pi,
|
|
9090
|
+
...oi,
|
|
9031
9091
|
...qr,
|
|
9032
|
-
...
|
|
9033
|
-
...li,
|
|
9034
|
-
...ii,
|
|
9035
|
-
...Dr,
|
|
9036
|
-
...fi,
|
|
9092
|
+
...bi,
|
|
9037
9093
|
...o
|
|
9038
9094
|
];
|
|
9039
|
-
this.scheduler = new
|
|
9095
|
+
this.scheduler = new vi(this, this.entities, this.relations, this.dict, h), n.forEach((p) => {
|
|
9040
9096
|
let f = this.recordNameToSideEffects.get(p.record.name);
|
|
9041
9097
|
f || this.recordNameToSideEffects.set(p.record.name, f = /* @__PURE__ */ new Set()), f.add(p);
|
|
9042
9098
|
});
|
|
@@ -9056,7 +9112,7 @@ class ls {
|
|
|
9056
9112
|
}
|
|
9057
9113
|
}
|
|
9058
9114
|
async applyResult(t, e, r) {
|
|
9059
|
-
if (!(e instanceof
|
|
9115
|
+
if (!(e instanceof xt)) {
|
|
9060
9116
|
if (t.type === "global")
|
|
9061
9117
|
return this.system.storage.dict.set(t.id.name, e);
|
|
9062
9118
|
if (t.type === "entity") {
|
|
@@ -9079,12 +9135,12 @@ class ls {
|
|
|
9079
9135
|
await this.system.storage.create(i.id.name, a);
|
|
9080
9136
|
} else {
|
|
9081
9137
|
const i = t;
|
|
9082
|
-
i.id.name ===
|
|
9138
|
+
i.id.name === Kt && e ? await this.system.storage.delete(i.host.name, w.atom({ key: "id", value: ["=", r.id] })) : await this.system.storage.update(i.host.name, w.atom({ key: "id", value: ["=", r.id] }), { [i.id.name]: e });
|
|
9083
9139
|
}
|
|
9084
9140
|
}
|
|
9085
9141
|
}
|
|
9086
9142
|
async applyResultPatch(t, e, r) {
|
|
9087
|
-
if (e instanceof
|
|
9143
|
+
if (e instanceof xt || e === void 0) return;
|
|
9088
9144
|
const i = Array.isArray(e) ? e : [e];
|
|
9089
9145
|
for (const s of i)
|
|
9090
9146
|
if (t.type === "global")
|
|
@@ -9102,7 +9158,7 @@ class ls {
|
|
|
9102
9158
|
}
|
|
9103
9159
|
} else {
|
|
9104
9160
|
const a = t;
|
|
9105
|
-
a.id.name ===
|
|
9161
|
+
a.id.name === Kt && s.data ? (A(s.type !== "delete", "Hard deletion property cannot be deleted"), await this.system.storage.delete(a.host.name, w.atom({ key: "id", value: ["=", r.id] }))) : s.type === "insert" ? await this.system.storage.update(a.host.name, w.atom({ key: "id", value: ["=", r.id] }), { [a.id.name]: s.data }) : s.type === "update" ? await this.system.storage.update(a.host.name, w.atom({ key: "id", value: ["=", r.id] }), { [a.id.name]: s.data }) : s.type === "delete" && await this.system.storage.update(a.host.name, w.atom({ key: "id", value: ["=", r.id] }), { [a.id.name]: null });
|
|
9106
9162
|
}
|
|
9107
9163
|
}
|
|
9108
9164
|
cloneDispatchArgs(t) {
|
|
@@ -9113,36 +9169,50 @@ class ls {
|
|
|
9113
9169
|
/**
|
|
9114
9170
|
* Unified dispatch API for all event source types.
|
|
9115
9171
|
* First parameter is an object reference to the event source, second is the event args.
|
|
9172
|
+
*
|
|
9173
|
+
* A dispatch is the framework's synchronous fact transaction boundary:
|
|
9174
|
+
* guard, mapEventData, event record creation, resolve, synchronous computations,
|
|
9175
|
+
* and afterDispatch all run inside one retryable storage transaction attempt.
|
|
9176
|
+
* If any of those steps fails, the attempt is rolled back and postCommit plus
|
|
9177
|
+
* record mutation side effects are skipped. After a successful commit,
|
|
9178
|
+
* postCommit and record mutation side effects run outside the transaction;
|
|
9179
|
+
* their failures are reported in sideEffects without rolling back committed facts.
|
|
9116
9180
|
*/
|
|
9117
9181
|
async dispatch(t, e) {
|
|
9118
9182
|
A(!!t, "eventSource is required for dispatch");
|
|
9119
|
-
|
|
9183
|
+
const r = ke.getStore();
|
|
9184
|
+
if (r)
|
|
9185
|
+
throw new Yr({
|
|
9186
|
+
outerEventSourceName: r.eventSourceName,
|
|
9187
|
+
nestedEventSourceName: t.name
|
|
9188
|
+
});
|
|
9189
|
+
let i;
|
|
9120
9190
|
try {
|
|
9121
|
-
|
|
9122
|
-
const
|
|
9123
|
-
return
|
|
9124
|
-
!this.ignoreGuard && t.guard && await t.guard.call(this,
|
|
9125
|
-
const
|
|
9126
|
-
await this.system.storage.create(t.entity.name,
|
|
9127
|
-
let o;
|
|
9128
|
-
t.resolve && (o = await t.resolve.call(this, s));
|
|
9191
|
+
i = await ae(t.name || "dispatch", async (s) => {
|
|
9192
|
+
const a = this.cloneDispatchArgs(e), n = { effects: [] };
|
|
9193
|
+
return oe.run(n, async () => this.system.storage.runInTransaction({ name: t.name, isolation: s }, async () => ke.run({ eventSourceName: t.name }, async () => {
|
|
9194
|
+
!this.ignoreGuard && t.guard && await t.guard.call(this, a);
|
|
9195
|
+
const o = t.mapEventData ? await t.mapEventData(a) : {};
|
|
9196
|
+
await this.system.storage.create(t.entity.name, o);
|
|
9129
9197
|
let c;
|
|
9198
|
+
t.resolve && (c = await t.resolve.call(this, a));
|
|
9199
|
+
let u;
|
|
9130
9200
|
if (t.afterDispatch) {
|
|
9131
|
-
const
|
|
9132
|
-
|
|
9201
|
+
const d = await t.afterDispatch.call(this, a, { data: c });
|
|
9202
|
+
d && (u = d);
|
|
9133
9203
|
}
|
|
9134
|
-
return { data:
|
|
9135
|
-
}));
|
|
9204
|
+
return { data: c, effects: n.effects, sideEffects: {}, context: u };
|
|
9205
|
+
})));
|
|
9136
9206
|
});
|
|
9137
|
-
} catch (
|
|
9138
|
-
if (this.forceThrowDispatchError) throw
|
|
9139
|
-
|
|
9140
|
-
error:
|
|
9207
|
+
} catch (s) {
|
|
9208
|
+
if (this.forceThrowDispatchError) throw s;
|
|
9209
|
+
i = {
|
|
9210
|
+
error: s,
|
|
9141
9211
|
effects: [],
|
|
9142
9212
|
sideEffects: {}
|
|
9143
9213
|
};
|
|
9144
9214
|
}
|
|
9145
|
-
return
|
|
9215
|
+
return i.error || (await this.runPostCommitHook(t, e, i, this.system.logger), await this.runRecordChangeSideEffects(i, this.system.logger)), i;
|
|
9146
9216
|
}
|
|
9147
9217
|
async runPostCommitHook(t, e, r, i) {
|
|
9148
9218
|
if (t.postCommit)
|
|
@@ -9156,7 +9226,7 @@ class ls {
|
|
|
9156
9226
|
...s
|
|
9157
9227
|
});
|
|
9158
9228
|
} catch (s) {
|
|
9159
|
-
const a = new
|
|
9229
|
+
const a = new Ae(
|
|
9160
9230
|
`Post-commit hook '${t.name}' failed`,
|
|
9161
9231
|
{
|
|
9162
9232
|
sideEffectName: t.name,
|
|
@@ -9183,7 +9253,7 @@ class ls {
|
|
|
9183
9253
|
result: await a.content.call(this, i)
|
|
9184
9254
|
};
|
|
9185
9255
|
} catch (n) {
|
|
9186
|
-
const o = new
|
|
9256
|
+
const o = new Ae(
|
|
9187
9257
|
`Side effect '${a.name}' failed for ${i.type} on ${i.recordName}`,
|
|
9188
9258
|
{
|
|
9189
9259
|
sideEffectName: a.name,
|
|
@@ -9212,20 +9282,20 @@ class ls {
|
|
|
9212
9282
|
return this.eventSourcesByName.get(t);
|
|
9213
9283
|
}
|
|
9214
9284
|
}
|
|
9215
|
-
function
|
|
9285
|
+
function Ei(l) {
|
|
9216
9286
|
return encodeURI(JSON.stringify(l));
|
|
9217
9287
|
}
|
|
9218
|
-
function
|
|
9288
|
+
function Ai(l) {
|
|
9219
9289
|
return l === void 0 ? void 0 : JSON.parse(decodeURI(l));
|
|
9220
9290
|
}
|
|
9221
|
-
class
|
|
9291
|
+
class Si {
|
|
9222
9292
|
constructor(t) {
|
|
9223
9293
|
this.db = t, this.constraintSchemaItems = [], this.schema = {
|
|
9224
9294
|
dialect: ct(),
|
|
9225
9295
|
records: [],
|
|
9226
9296
|
tables: [],
|
|
9227
9297
|
constraints: []
|
|
9228
|
-
}, this.transactionContext = new
|
|
9298
|
+
}, this.transactionContext = new Ie(), this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
|
|
9229
9299
|
get: async (e) => {
|
|
9230
9300
|
const r = y.atom({ key: "key", value: ["=", e] });
|
|
9231
9301
|
return (await this.queryHandle.findOne(B, r, void 0, ["value"]))?.value?.raw;
|
|
@@ -9245,27 +9315,54 @@ class vi {
|
|
|
9245
9315
|
getTransactionIsolation() {
|
|
9246
9316
|
return this.getActiveTransactionContext()?.isolation;
|
|
9247
9317
|
}
|
|
9318
|
+
getTransactionCapability() {
|
|
9319
|
+
return this.db.transactionCapability ?? {
|
|
9320
|
+
transactions: !0,
|
|
9321
|
+
isolationLevels: ["READ COMMITTED"],
|
|
9322
|
+
transactionBoundConnection: !1,
|
|
9323
|
+
concurrentTransactions: "unsupported",
|
|
9324
|
+
nestedStrategy: "reuse",
|
|
9325
|
+
notes: [
|
|
9326
|
+
"This driver has no explicit transaction capability declaration; MonoStorage will use fallback BEGIN/COMMIT semantics only."
|
|
9327
|
+
]
|
|
9328
|
+
};
|
|
9329
|
+
}
|
|
9248
9330
|
async runInTransaction(t, e) {
|
|
9249
|
-
const r = t.isolation ?? "READ COMMITTED", i = this.
|
|
9250
|
-
if (i)
|
|
9251
|
-
|
|
9331
|
+
const r = t.isolation ?? "READ COMMITTED", i = this.getTransactionCapability();
|
|
9332
|
+
if (!i.transactions)
|
|
9333
|
+
throw new Jt({
|
|
9334
|
+
transactionName: t.name,
|
|
9335
|
+
requestedIsolation: r,
|
|
9336
|
+
capability: i,
|
|
9337
|
+
reason: "driver does not support transactions"
|
|
9338
|
+
});
|
|
9339
|
+
if (!i.isolationLevels.includes(r))
|
|
9340
|
+
throw new Jt({
|
|
9341
|
+
transactionName: t.name,
|
|
9342
|
+
requestedIsolation: r,
|
|
9343
|
+
capability: i,
|
|
9344
|
+
reason: `driver does not support ${r} isolation`
|
|
9345
|
+
});
|
|
9346
|
+
const s = this.getActiveTransactionContext();
|
|
9347
|
+
if (s) {
|
|
9348
|
+
if (s.isolation !== "SERIALIZABLE" && r === "SERIALIZABLE")
|
|
9252
9349
|
throw new W(`${t.name || "nested transaction"} requires SERIALIZABLE isolation`);
|
|
9253
|
-
|
|
9350
|
+
s.depth++;
|
|
9254
9351
|
try {
|
|
9255
9352
|
return await e();
|
|
9256
9353
|
} finally {
|
|
9257
|
-
|
|
9354
|
+
s.depth--;
|
|
9258
9355
|
}
|
|
9259
9356
|
}
|
|
9260
|
-
const
|
|
9357
|
+
const a = { depth: 1, isolation: r }, n = async () => this.transactionContext.run(a, e);
|
|
9261
9358
|
if (this.db.runInTransaction)
|
|
9262
|
-
return this.db.runInTransaction({ name: t.name, isolation: r },
|
|
9359
|
+
return this.db.runInTransaction({ name: t.name, isolation: r }, n);
|
|
9263
9360
|
await this.db.scheme("BEGIN", t.name);
|
|
9264
9361
|
try {
|
|
9265
|
-
const
|
|
9266
|
-
return await this.db.scheme("COMMIT", t.name),
|
|
9267
|
-
} catch (
|
|
9268
|
-
throw await this.db.scheme("ROLLBACK", t.name),
|
|
9362
|
+
const o = await n();
|
|
9363
|
+
return await this.db.scheme("COMMIT", t.name), o;
|
|
9364
|
+
} catch (o) {
|
|
9365
|
+
throw await this.db.scheme("ROLLBACK", t.name), o;
|
|
9269
9366
|
}
|
|
9270
9367
|
}
|
|
9271
9368
|
isInTransaction() {
|
|
@@ -9276,7 +9373,7 @@ class vi {
|
|
|
9276
9373
|
throw new Error(`${t} requires an active transaction`);
|
|
9277
9374
|
}
|
|
9278
9375
|
async withAtomicTransaction(t, e) {
|
|
9279
|
-
return this.isInTransaction() ? e() :
|
|
9376
|
+
return this.isInTransaction() ? e() : ae(t, (r) => this.runInTransaction({ name: t, isolation: r }, e));
|
|
9280
9377
|
}
|
|
9281
9378
|
async setDictionaryValue(t, e, r) {
|
|
9282
9379
|
const i = y.atom({ key: "key", value: ["=", t] }), s = await this.queryHandle.findOne(B, i, void 0, ["value"]);
|
|
@@ -9291,23 +9388,23 @@ class vi {
|
|
|
9291
9388
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
9292
9389
|
async get(t, e, r) {
|
|
9293
9390
|
const i = y.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), s = (await this.queryHandle.findOne(st, i, void 0, ["value"]))?.value;
|
|
9294
|
-
return s === void 0 ? r :
|
|
9391
|
+
return s === void 0 ? r : Ai(s);
|
|
9295
9392
|
}
|
|
9296
9393
|
async set(t, e, r, i) {
|
|
9297
9394
|
const s = y.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
9298
|
-
return await this.queryHandle.findOne(st, s, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [st, s, { concept: t, key: e.toString(), value:
|
|
9395
|
+
return await this.queryHandle.findOne(st, s, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [st, s, { concept: t, key: e.toString(), value: Ei(r) }], i) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [st, { concept: t, key: e.toString(), value: encodeURI(JSON.stringify(r)) }], i);
|
|
9299
9396
|
}
|
|
9300
9397
|
async setup(t, e, r = !1) {
|
|
9301
9398
|
await this.db.open(r), r && this.db.setupInternalComputationState && await this.db.setupInternalComputationState();
|
|
9302
9399
|
let i;
|
|
9303
9400
|
try {
|
|
9304
|
-
i = new
|
|
9401
|
+
i = new Mr(
|
|
9305
9402
|
t,
|
|
9306
9403
|
e,
|
|
9307
9404
|
this.db
|
|
9308
9405
|
);
|
|
9309
9406
|
} catch (s) {
|
|
9310
|
-
throw new
|
|
9407
|
+
throw new _t(
|
|
9311
9408
|
s instanceof Error ? s.message : String(s),
|
|
9312
9409
|
{
|
|
9313
9410
|
driver: this.db.constructor?.name,
|
|
@@ -9316,7 +9413,7 @@ class vi {
|
|
|
9316
9413
|
);
|
|
9317
9414
|
}
|
|
9318
9415
|
if (r && await i.createTables(), await this.createConstraints(i), this.db.setupRecordSequences) {
|
|
9319
|
-
const s = new
|
|
9416
|
+
const s = new Ht(i.map, i.aliasManager);
|
|
9320
9417
|
await this.db.setupRecordSequences(Object.keys(i.map.records).map((a) => {
|
|
9321
9418
|
const n = s.getRecordInfo(a), o = n.idField;
|
|
9322
9419
|
if (!o)
|
|
@@ -9328,7 +9425,7 @@ class vi {
|
|
|
9328
9425
|
};
|
|
9329
9426
|
}));
|
|
9330
9427
|
}
|
|
9331
|
-
this.queryHandle = new
|
|
9428
|
+
this.queryHandle = new gr(new Ht(i.map, i.aliasManager), this.db), this.map = i.map, this.constraintSchemaItems = i.constraintSchemaItems, this.schema = this.createSchemaMetadata(i);
|
|
9332
9429
|
}
|
|
9333
9430
|
createSchemaMetadata(t) {
|
|
9334
9431
|
return {
|
|
@@ -9352,7 +9449,7 @@ class vi {
|
|
|
9352
9449
|
try {
|
|
9353
9450
|
e = t.createConstraintSQL();
|
|
9354
9451
|
} catch (r) {
|
|
9355
|
-
throw new
|
|
9452
|
+
throw new _t(
|
|
9356
9453
|
r instanceof Error ? r.message : String(r),
|
|
9357
9454
|
{
|
|
9358
9455
|
driver: this.db.constructor?.name,
|
|
@@ -9365,7 +9462,7 @@ class vi {
|
|
|
9365
9462
|
try {
|
|
9366
9463
|
await this.db.scheme(r.sql, `setup constraint ${i.constraintName}`);
|
|
9367
9464
|
} catch (s) {
|
|
9368
|
-
throw new
|
|
9465
|
+
throw new _t(
|
|
9369
9466
|
`Failed to setup constraint "${i.constraintName}" on "${i.recordName}"`,
|
|
9370
9467
|
{
|
|
9371
9468
|
constraintName: i.constraintName,
|
|
@@ -9374,7 +9471,7 @@ class vi {
|
|
|
9374
9471
|
tableName: i.tableName,
|
|
9375
9472
|
properties: i.properties,
|
|
9376
9473
|
driver: this.db.constructor?.name,
|
|
9377
|
-
rawCode:
|
|
9474
|
+
rawCode: Bt(s, this.db).rawCode,
|
|
9378
9475
|
causedBy: s instanceof Error ? s : void 0
|
|
9379
9476
|
}
|
|
9380
9477
|
);
|
|
@@ -9472,18 +9569,18 @@ RETURNING "numberValue" AS value`,
|
|
|
9472
9569
|
async () => {
|
|
9473
9570
|
const i = this.getPlaceholder();
|
|
9474
9571
|
if (this.isRecordTarget(e)) {
|
|
9475
|
-
const { tableName: g, idField: v, fieldName: I } = this.resolveRecordTarget(e),
|
|
9476
|
-
`SELECT "${I}" AS value FROM "${g}" WHERE "${v}" = ${
|
|
9572
|
+
const { tableName: g, idField: v, fieldName: I } = this.resolveRecordTarget(e), V = i(), _ = await this.db.query(
|
|
9573
|
+
`SELECT "${I}" AS value FROM "${g}" WHERE "${v}" = ${V}${this.supportsForUpdate() ? " FOR UPDATE" : ""}`,
|
|
9477
9574
|
[e.id],
|
|
9478
9575
|
`atomic replace lock ${e.recordName}.${e.field}`
|
|
9479
9576
|
);
|
|
9480
9577
|
if (!_.length) throw new Error(`Atomic replace target not found: ${e.recordName}.${String(e.id)}.${e.field}`);
|
|
9481
|
-
const J = this.getPlaceholder(),
|
|
9482
|
-
`UPDATE "${g}" SET "${I}" = ${
|
|
9578
|
+
const J = this.getPlaceholder(), Vt = J(), it = J(), Lt = await this.db.query(
|
|
9579
|
+
`UPDATE "${g}" SET "${I}" = ${Vt} WHERE "${v}" = ${it} RETURNING "${I}" AS value`,
|
|
9483
9580
|
[r, e.id],
|
|
9484
9581
|
`atomic replace ${e.recordName}.${e.field}`
|
|
9485
9582
|
);
|
|
9486
|
-
return { oldValue: _[0].value ?? null, newValue:
|
|
9583
|
+
return { oldValue: _[0].value ?? null, newValue: Lt[0]?.value ?? r };
|
|
9487
9584
|
}
|
|
9488
9585
|
const s = this.resolveGlobalColumn(e, r), a = this.normalizeGlobalValue(r, s);
|
|
9489
9586
|
await this.ensureGlobalStateRow(e, s);
|
|
@@ -9502,9 +9599,9 @@ RETURNING "numberValue" AS value`,
|
|
|
9502
9599
|
compareAndSet: async (e, r, i, s) => {
|
|
9503
9600
|
const a = this.getPlaceholder(), n = s?.defaultValue;
|
|
9504
9601
|
if (this.isRecordTarget(e)) {
|
|
9505
|
-
const { tableName: J, idField:
|
|
9602
|
+
const { tableName: J, idField: Vt, fieldName: it } = this.resolveRecordTarget(e), Lt = a(), Ke = a(), ze = a(), Xe = a();
|
|
9506
9603
|
return (await this.db.query(
|
|
9507
|
-
`UPDATE "${J}" SET "${it}" = ${
|
|
9604
|
+
`UPDATE "${J}" SET "${it}" = ${Lt} WHERE "${Vt}" = ${Ke} AND COALESCE("${it}", ${ze}) = ${Xe} RETURNING "${it}" AS value`,
|
|
9508
9605
|
[i, e.id, n, r],
|
|
9509
9606
|
`atomic compareAndSet ${e.recordName}.${e.field}`
|
|
9510
9607
|
)).length > 0;
|
|
@@ -9516,9 +9613,9 @@ RETURNING "numberValue" AS value`,
|
|
|
9516
9613
|
`atomic compareAndSet ${e.key}`
|
|
9517
9614
|
)).length) return !0;
|
|
9518
9615
|
if (d !== u) return !1;
|
|
9519
|
-
const v = this.getPlaceholder(), I = v(),
|
|
9616
|
+
const v = this.getPlaceholder(), I = v(), V = v();
|
|
9520
9617
|
return (await this.db.query(
|
|
9521
|
-
`INSERT INTO "_ComputationState_" ("key", "${o}") VALUES (${I}, ${
|
|
9618
|
+
`INSERT INTO "_ComputationState_" ("key", "${o}") VALUES (${I}, ${V}) ON CONFLICT ("key") DO NOTHING RETURNING "${o}" AS value`,
|
|
9522
9619
|
[e.key, c],
|
|
9523
9620
|
`atomic compareAndSet insert ${e.key}`
|
|
9524
9621
|
)).length > 0;
|
|
@@ -9593,7 +9690,7 @@ RETURNING "numberValue" AS value`,
|
|
|
9593
9690
|
return this.callWithEvents(this.queryHandle.delete.bind(this.queryHandle), [t, e], r);
|
|
9594
9691
|
}
|
|
9595
9692
|
findConstraintForError(t) {
|
|
9596
|
-
const e =
|
|
9693
|
+
const e = Bt(t, this.db);
|
|
9597
9694
|
if (e.constraintName) {
|
|
9598
9695
|
const i = this.constraintSchemaItems.find((s) => s.physicalName === e.constraintName || s.constraintName === e.constraintName);
|
|
9599
9696
|
if (i) return i;
|
|
@@ -9605,12 +9702,12 @@ RETURNING "numberValue" AS value`,
|
|
|
9605
9702
|
});
|
|
9606
9703
|
}
|
|
9607
9704
|
mapConstraintError(t) {
|
|
9608
|
-
const e =
|
|
9705
|
+
const e = Ri(t);
|
|
9609
9706
|
if (e) return e;
|
|
9610
|
-
const r =
|
|
9707
|
+
const r = Bt(t, this.db);
|
|
9611
9708
|
if (!r.isUniqueViolation) return t;
|
|
9612
9709
|
const i = this.findConstraintForError(t);
|
|
9613
|
-
return new
|
|
9710
|
+
return new _e(
|
|
9614
9711
|
i ? `Unique constraint "${i.constraintName}" was violated` : "Unique constraint was violated",
|
|
9615
9712
|
{
|
|
9616
9713
|
kind: "unique",
|
|
@@ -9630,8 +9727,8 @@ RETURNING "numberValue" AS value`,
|
|
|
9630
9727
|
try {
|
|
9631
9728
|
const i = [], s = await t(...e, i), a = await this.dispatch(i);
|
|
9632
9729
|
r.push(...i, ...a);
|
|
9633
|
-
const n =
|
|
9634
|
-
return n && i.length > 0 &&
|
|
9730
|
+
const n = Ti();
|
|
9731
|
+
return n && i.length > 0 && Se(i), n && a.length > 0 && Se(a), s;
|
|
9635
9732
|
} catch (i) {
|
|
9636
9733
|
throw this.mapConstraintError(i);
|
|
9637
9734
|
}
|
|
@@ -9672,8 +9769,8 @@ RETURNING "numberValue" AS value`,
|
|
|
9672
9769
|
return this.db.close();
|
|
9673
9770
|
}
|
|
9674
9771
|
}
|
|
9675
|
-
var
|
|
9676
|
-
class
|
|
9772
|
+
var ki = /* @__PURE__ */ ((l) => (l[l.ERROR = 0] = "ERROR", l[l.INFO = 1] = "INFO", l))(ki || {});
|
|
9773
|
+
class ce {
|
|
9677
9774
|
constructor(t = 0) {
|
|
9678
9775
|
this.level = t;
|
|
9679
9776
|
}
|
|
@@ -9684,11 +9781,11 @@ class ae {
|
|
|
9684
9781
|
this.level >= 0 && console.error({ type: t, name: e, sql: r, params: i, error: s });
|
|
9685
9782
|
}
|
|
9686
9783
|
child() {
|
|
9687
|
-
return new
|
|
9784
|
+
return new ce(this.level);
|
|
9688
9785
|
}
|
|
9689
9786
|
}
|
|
9690
|
-
var
|
|
9691
|
-
class
|
|
9787
|
+
var Ii = /* @__PURE__ */ ((l) => (l[l.MUTE = -1] = "MUTE", l[l.ERROR = 0] = "ERROR", l[l.INFO = 1] = "INFO", l[l.DEBUG = 2] = "DEBUG", l))(Ii || {});
|
|
9788
|
+
class le {
|
|
9692
9789
|
constructor(t = 0) {
|
|
9693
9790
|
this.level = t;
|
|
9694
9791
|
}
|
|
@@ -9702,16 +9799,16 @@ class ne {
|
|
|
9702
9799
|
this.level >= 2 && console.debug(`[DEBUG] ${t}: ${e}`, r);
|
|
9703
9800
|
}
|
|
9704
9801
|
child(t) {
|
|
9705
|
-
return new
|
|
9802
|
+
return new le(this.level);
|
|
9706
9803
|
}
|
|
9707
9804
|
}
|
|
9708
|
-
const
|
|
9709
|
-
class
|
|
9710
|
-
constructor(t, e =
|
|
9711
|
-
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new
|
|
9805
|
+
const gs = new ce(), $i = new le();
|
|
9806
|
+
class bs {
|
|
9807
|
+
constructor(t, e = $i) {
|
|
9808
|
+
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new Si(t);
|
|
9712
9809
|
}
|
|
9713
9810
|
async setup(t, e, r, i = !1) {
|
|
9714
|
-
const s = new
|
|
9811
|
+
const s = new Me(t, e), { entities: a, relations: n } = s.getAll();
|
|
9715
9812
|
r.forEach(({ dataContext: o, state: c }) => {
|
|
9716
9813
|
Object.entries(c).forEach(([u, d]) => {
|
|
9717
9814
|
if (d instanceof S) {
|
|
@@ -9737,7 +9834,7 @@ class ds {
|
|
|
9737
9834
|
}
|
|
9738
9835
|
});
|
|
9739
9836
|
}), await this.storage.setup(
|
|
9740
|
-
[...a,
|
|
9837
|
+
[...a, Fr, Or],
|
|
9741
9838
|
n,
|
|
9742
9839
|
i
|
|
9743
9840
|
), await this.setupTransformUniqueIndexes(r);
|
|
@@ -9755,7 +9852,7 @@ class ds {
|
|
|
9755
9852
|
continue;
|
|
9756
9853
|
const a = e.id.name, n = this.storage, o = n.queryHandle.map, c = o.getRecordInfo(a), [, u] = o.getTableAliasAndFieldName([a], i.key, !0), [, d] = o.getTableAliasAndFieldName([a], s.key, !0), h = `idx_transform_${this.hashIdentifier(`${c.table}_${u}_${d}`)}`, p = ct(n.db);
|
|
9757
9854
|
await n.db.scheme(
|
|
9758
|
-
|
|
9855
|
+
De(h, c.table, [u, d], p),
|
|
9759
9856
|
`setup transform unique index ${a}`
|
|
9760
9857
|
);
|
|
9761
9858
|
}
|
|
@@ -9764,8 +9861,8 @@ class ds {
|
|
|
9764
9861
|
await this.storage.destroy();
|
|
9765
9862
|
}
|
|
9766
9863
|
}
|
|
9767
|
-
const
|
|
9768
|
-
class
|
|
9864
|
+
const Rs = new $e();
|
|
9865
|
+
class Ft {
|
|
9769
9866
|
constructor(t, e) {
|
|
9770
9867
|
this._type = "Action", this._options = e, this.uuid = E(e), this.name = t.name;
|
|
9771
9868
|
}
|
|
@@ -9787,7 +9884,7 @@ class Mt {
|
|
|
9787
9884
|
};
|
|
9788
9885
|
}
|
|
9789
9886
|
static create(t, e) {
|
|
9790
|
-
const r = new
|
|
9887
|
+
const r = new Ft(t, e);
|
|
9791
9888
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
9792
9889
|
throw new Error(`duplicate uuid in options ${r.uuid}, Action`);
|
|
9793
9890
|
return this.instances.push(r), r;
|
|
@@ -9819,8 +9916,8 @@ class Mt {
|
|
|
9819
9916
|
return this.create(e.public, e.options);
|
|
9820
9917
|
}
|
|
9821
9918
|
}
|
|
9822
|
-
const
|
|
9823
|
-
function
|
|
9919
|
+
const Ci = Ft.create({ name: "get" });
|
|
9920
|
+
function zt(l) {
|
|
9824
9921
|
if (!l) return;
|
|
9825
9922
|
if (l.raw.type === "atom")
|
|
9826
9923
|
return Rt.create({
|
|
@@ -9831,13 +9928,13 @@ function Jt(l) {
|
|
|
9831
9928
|
return wt.create({
|
|
9832
9929
|
type: "expression",
|
|
9833
9930
|
operator: t.operator,
|
|
9834
|
-
left:
|
|
9835
|
-
right:
|
|
9931
|
+
left: zt(l.left),
|
|
9932
|
+
right: zt(l.right)
|
|
9836
9933
|
});
|
|
9837
9934
|
}
|
|
9838
|
-
class
|
|
9935
|
+
class Dt {
|
|
9839
9936
|
constructor(t, e) {
|
|
9840
|
-
this._type = "Conditions", this._options = e, this.uuid = E(e), t.content && t.content instanceof w ? this.content =
|
|
9937
|
+
this._type = "Conditions", this._options = e, this.uuid = E(e), t.content && t.content instanceof w ? this.content = zt(t.content) : this.content = t.content;
|
|
9841
9938
|
}
|
|
9842
9939
|
static {
|
|
9843
9940
|
this.isKlass = !0;
|
|
@@ -9858,7 +9955,7 @@ class Ot {
|
|
|
9858
9955
|
};
|
|
9859
9956
|
}
|
|
9860
9957
|
static create(t, e) {
|
|
9861
|
-
const r = new
|
|
9958
|
+
const r = new Dt(t, e);
|
|
9862
9959
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
9863
9960
|
throw new Error(`duplicate uuid in options ${r.uuid}, Conditions`);
|
|
9864
9961
|
return this.instances.push(r), r;
|
|
@@ -10011,7 +10108,7 @@ class Tt {
|
|
|
10011
10108
|
return this.create(e.public, e.options);
|
|
10012
10109
|
}
|
|
10013
10110
|
}
|
|
10014
|
-
function
|
|
10111
|
+
function Xt(l) {
|
|
10015
10112
|
if (!l) return;
|
|
10016
10113
|
if (l.raw.type === "atom")
|
|
10017
10114
|
return Rt.create({
|
|
@@ -10022,17 +10119,17 @@ function Gt(l) {
|
|
|
10022
10119
|
return wt.create({
|
|
10023
10120
|
type: "expression",
|
|
10024
10121
|
operator: t.operator,
|
|
10025
|
-
left:
|
|
10026
|
-
right:
|
|
10122
|
+
left: Xt(l.left),
|
|
10123
|
+
right: Xt(l.right)
|
|
10027
10124
|
});
|
|
10028
10125
|
}
|
|
10029
|
-
function
|
|
10126
|
+
function ws(l) {
|
|
10030
10127
|
return Tt.create({
|
|
10031
|
-
content:
|
|
10128
|
+
content: Xt(l)
|
|
10032
10129
|
});
|
|
10033
10130
|
}
|
|
10034
|
-
const
|
|
10035
|
-
name:
|
|
10131
|
+
const xi = "_Interaction_", ue = $.create({
|
|
10132
|
+
name: xi,
|
|
10036
10133
|
properties: [
|
|
10037
10134
|
N.create({ name: "interactionId", type: "string", collection: !1 }),
|
|
10038
10135
|
N.create({ name: "interactionName", type: "string", collection: !1 }),
|
|
@@ -10042,7 +10139,7 @@ const ki = "_Interaction_", oe = $.create({
|
|
|
10042
10139
|
N.create({ name: "context", type: "object", collection: !1 })
|
|
10043
10140
|
]
|
|
10044
10141
|
});
|
|
10045
|
-
class
|
|
10142
|
+
class de {
|
|
10046
10143
|
constructor(t, e) {
|
|
10047
10144
|
this._type = "Interaction", this._options = e, this.uuid = E(e), this.name = t.name, this.conditions = t.conditions, this.userAttributives = t.userAttributives, this.userRef = t.userRef, this.action = t.action, this.payload = t.payload, this.data = t.data, this.dataPolicy = t.dataPolicy;
|
|
10048
10145
|
}
|
|
@@ -10098,10 +10195,10 @@ class ce {
|
|
|
10098
10195
|
};
|
|
10099
10196
|
}
|
|
10100
10197
|
static create(t, e) {
|
|
10101
|
-
const r = new
|
|
10198
|
+
const r = new de(t, e);
|
|
10102
10199
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10103
10200
|
throw new Error(`duplicate uuid in options ${r.uuid}, Interaction`);
|
|
10104
|
-
return r.entity =
|
|
10201
|
+
return r.entity = ue, r.guard = Pi(r), r.mapEventData = Mi(r), t.action === Ci && (r.resolve = Oi(r)), this.instances.push(r), r;
|
|
10105
10202
|
}
|
|
10106
10203
|
static stringify(t) {
|
|
10107
10204
|
const e = {
|
|
@@ -10140,12 +10237,12 @@ class U extends Error {
|
|
|
10140
10237
|
super(t), this.name = "InteractionGuardError", this.type = e.type, this.checkType = e.checkType, this.error = e.error;
|
|
10141
10238
|
}
|
|
10142
10239
|
}
|
|
10143
|
-
function
|
|
10240
|
+
function Pi(l) {
|
|
10144
10241
|
return async function(t) {
|
|
10145
|
-
await
|
|
10242
|
+
await Ue(this, l, t), await Di(this, l, t), await We(this, l, t);
|
|
10146
10243
|
};
|
|
10147
10244
|
}
|
|
10148
|
-
function
|
|
10245
|
+
function Mi(l) {
|
|
10149
10246
|
return (t) => ({
|
|
10150
10247
|
interactionName: l.name,
|
|
10151
10248
|
interactionId: l.uuid,
|
|
@@ -10155,14 +10252,14 @@ function $i(l) {
|
|
|
10155
10252
|
context: t.context || {}
|
|
10156
10253
|
});
|
|
10157
10254
|
}
|
|
10158
|
-
function
|
|
10255
|
+
function Oi(l) {
|
|
10159
10256
|
return async function(t) {
|
|
10160
|
-
return
|
|
10257
|
+
return Vi(this, l, t);
|
|
10161
10258
|
};
|
|
10162
10259
|
}
|
|
10163
|
-
async function
|
|
10260
|
+
async function Ue(l, t, e) {
|
|
10164
10261
|
if (!t.conditions) return;
|
|
10165
|
-
const r =
|
|
10262
|
+
const r = Dt.is(t.conditions) ? new w(t.conditions.content) : w.atom(t.conditions), i = async (a) => {
|
|
10166
10263
|
if (!a) return !0;
|
|
10167
10264
|
if (a.content) {
|
|
10168
10265
|
let n;
|
|
@@ -10183,7 +10280,7 @@ async function qe(l, t, e) {
|
|
|
10183
10280
|
error: s
|
|
10184
10281
|
});
|
|
10185
10282
|
}
|
|
10186
|
-
async function
|
|
10283
|
+
async function Fi(l, t, e, r) {
|
|
10187
10284
|
if (t.content) {
|
|
10188
10285
|
let i;
|
|
10189
10286
|
try {
|
|
@@ -10195,9 +10292,9 @@ async function xi(l, t, e, r) {
|
|
|
10195
10292
|
}
|
|
10196
10293
|
return !0;
|
|
10197
10294
|
}
|
|
10198
|
-
async function
|
|
10295
|
+
async function Di(l, t, e) {
|
|
10199
10296
|
if (!t.userAttributives) return;
|
|
10200
|
-
const r = Tt.is(t.userAttributives) ? w.fromValue(t.userAttributives.content) : w.atom(t.userAttributives), i = (a) =>
|
|
10297
|
+
const r = Tt.is(t.userAttributives) ? w.fromValue(t.userAttributives.content) : w.atom(t.userAttributives), i = (a) => Fi(l, a, e, e.user), s = await r.evaluateAsync(i);
|
|
10201
10298
|
if (s !== !0)
|
|
10202
10299
|
throw new U("User check failed", {
|
|
10203
10300
|
type: "check user failed",
|
|
@@ -10205,7 +10302,7 @@ async function Pi(l, t, e) {
|
|
|
10205
10302
|
error: s
|
|
10206
10303
|
});
|
|
10207
10304
|
}
|
|
10208
|
-
async function
|
|
10305
|
+
async function We(l, t, e) {
|
|
10209
10306
|
const r = e.payload || {}, i = t.payload?.items || [], s = Object.keys(r);
|
|
10210
10307
|
for (const a of s)
|
|
10211
10308
|
if (!i.some((n) => n.name === a))
|
|
@@ -10269,13 +10366,13 @@ async function at(l, t) {
|
|
|
10269
10366
|
}
|
|
10270
10367
|
return rt.is(t) ? !0 : $.is(t) ? l && typeof l == "object" ? !0 : { name: t.name || "", type: "conceptCheck", error: "invalid entity data" } : !0;
|
|
10271
10368
|
}
|
|
10272
|
-
async function
|
|
10369
|
+
async function Vi(l, t, e) {
|
|
10273
10370
|
if ($.is(t.data) || x.is(t.data)) {
|
|
10274
10371
|
const r = t.data.name, i = t.dataPolicy?.match, s = t.dataPolicy?.modifier, a = { ...e.query?.modifier || {}, ...s || {} }, n = e.query?.attributeQuery || [], o = typeof i == "function" ? await i.call(l, e) : i, c = w.and(o, e.query?.match);
|
|
10275
10372
|
return l.system.storage.find(r, c, a, n);
|
|
10276
10373
|
}
|
|
10277
10374
|
}
|
|
10278
|
-
class
|
|
10375
|
+
class he {
|
|
10279
10376
|
constructor(t, e) {
|
|
10280
10377
|
this._type = "Activity", this._options = e, this.uuid = E(e), this.name = t.name, this.interactions = t.interactions || [], this.gateways = t.gateways || [], this.transfers = t.transfers || [], this.groups = t.groups || [], this.events = t.events || [];
|
|
10281
10378
|
}
|
|
@@ -10323,7 +10420,7 @@ class le {
|
|
|
10323
10420
|
};
|
|
10324
10421
|
}
|
|
10325
10422
|
static create(t, e) {
|
|
10326
|
-
const r = new
|
|
10423
|
+
const r = new he(t, e);
|
|
10327
10424
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10328
10425
|
throw new Error(`duplicate uuid in options ${r.uuid}, Activity`);
|
|
10329
10426
|
return this.instances.push(r), r;
|
|
@@ -10424,7 +10521,7 @@ class lt {
|
|
|
10424
10521
|
return this.create(e.public, e.options);
|
|
10425
10522
|
}
|
|
10426
10523
|
}
|
|
10427
|
-
class
|
|
10524
|
+
class je {
|
|
10428
10525
|
constructor(t, e) {
|
|
10429
10526
|
this._type = "Transfer", this._options = e, this.uuid = E(e), this.name = t.name, this.source = t.source, this.target = t.target;
|
|
10430
10527
|
}
|
|
@@ -10457,7 +10554,7 @@ class _e {
|
|
|
10457
10554
|
};
|
|
10458
10555
|
}
|
|
10459
10556
|
static create(t, e) {
|
|
10460
|
-
const r = new
|
|
10557
|
+
const r = new je(t, e);
|
|
10461
10558
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10462
10559
|
throw new Error(`duplicate uuid in options ${r.uuid}, Transfer`);
|
|
10463
10560
|
return this.instances.push(r), r;
|
|
@@ -10493,19 +10590,19 @@ class _e {
|
|
|
10493
10590
|
return this.create(e.public, e.options);
|
|
10494
10591
|
}
|
|
10495
10592
|
}
|
|
10496
|
-
function
|
|
10593
|
+
function He(l, t, e) {
|
|
10497
10594
|
l.interactions.forEach((r) => t(r, e)), l.groups.forEach((r) => {
|
|
10498
|
-
r.activities?.forEach((i) =>
|
|
10595
|
+
r.activities?.forEach((i) => He(i, t, r));
|
|
10499
10596
|
});
|
|
10500
10597
|
}
|
|
10501
|
-
function
|
|
10598
|
+
function Ns(l) {
|
|
10502
10599
|
const t = [];
|
|
10503
|
-
return
|
|
10600
|
+
return He(l, (e) => t.push(e)), t;
|
|
10504
10601
|
}
|
|
10505
|
-
function
|
|
10602
|
+
function vs(l) {
|
|
10506
10603
|
return null;
|
|
10507
10604
|
}
|
|
10508
|
-
class
|
|
10605
|
+
class pe {
|
|
10509
10606
|
constructor(t, e) {
|
|
10510
10607
|
this._type = "Condition", this._options = e, this.uuid = E(e), this.content = t.content, this.name = t.name;
|
|
10511
10608
|
}
|
|
@@ -10531,7 +10628,7 @@ class ue {
|
|
|
10531
10628
|
};
|
|
10532
10629
|
}
|
|
10533
10630
|
static create(t, e) {
|
|
10534
|
-
const r = new
|
|
10631
|
+
const r = new pe(t, e);
|
|
10535
10632
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10536
10633
|
throw new Error(`duplicate uuid in options ${r.uuid}, Condition`);
|
|
10537
10634
|
return this.instances.push(r), r;
|
|
@@ -10565,7 +10662,7 @@ class ue {
|
|
|
10565
10662
|
return typeof i.content == "string" && i.content.startsWith("func::") && (r.content = new Function("return " + i.content.substring(6))()), this.create(r, e.options);
|
|
10566
10663
|
}
|
|
10567
10664
|
}
|
|
10568
|
-
class
|
|
10665
|
+
class fe {
|
|
10569
10666
|
constructor(t, e) {
|
|
10570
10667
|
this._type = "DataAttributive", this._options = e, this.uuid = E(e), this.content = t.content, this.name = t.name;
|
|
10571
10668
|
}
|
|
@@ -10591,7 +10688,7 @@ class de {
|
|
|
10591
10688
|
};
|
|
10592
10689
|
}
|
|
10593
10690
|
static create(t, e) {
|
|
10594
|
-
const r = new
|
|
10691
|
+
const r = new fe(t, e);
|
|
10595
10692
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10596
10693
|
throw new Error(`duplicate uuid in options ${r.uuid}, DataAttributive`);
|
|
10597
10694
|
return this.instances.push(r), r;
|
|
@@ -10625,7 +10722,7 @@ class de {
|
|
|
10625
10722
|
return typeof i.content == "string" && i.content.startsWith("func::") && (r.content = new Function("return " + i.content.substring(6))()), this.create(r, e.options);
|
|
10626
10723
|
}
|
|
10627
10724
|
}
|
|
10628
|
-
class
|
|
10725
|
+
class Ge {
|
|
10629
10726
|
constructor(t, e) {
|
|
10630
10727
|
this._type = "DataPolicy", this._options = e, this.uuid = E(e), this.match = t.match, this.modifier = t.modifier, this.attributeQuery = t.attributeQuery;
|
|
10631
10728
|
}
|
|
@@ -10658,7 +10755,7 @@ class Ue {
|
|
|
10658
10755
|
};
|
|
10659
10756
|
}
|
|
10660
10757
|
static create(t, e) {
|
|
10661
|
-
const r = new
|
|
10758
|
+
const r = new Ge(t, e);
|
|
10662
10759
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10663
10760
|
throw new Error(`duplicate uuid in options ${r.uuid}, DataPolicy`);
|
|
10664
10761
|
return this.instances.push(r), r;
|
|
@@ -10743,7 +10840,7 @@ class ut {
|
|
|
10743
10840
|
return this.create(e.public, e.options);
|
|
10744
10841
|
}
|
|
10745
10842
|
}
|
|
10746
|
-
class
|
|
10843
|
+
class me {
|
|
10747
10844
|
constructor(t, e) {
|
|
10748
10845
|
this._type = "Event", this._options = e, this.uuid = E(e), this.name = t.name;
|
|
10749
10846
|
}
|
|
@@ -10765,7 +10862,7 @@ class he {
|
|
|
10765
10862
|
};
|
|
10766
10863
|
}
|
|
10767
10864
|
static create(t, e) {
|
|
10768
|
-
const r = new
|
|
10865
|
+
const r = new me(t, e);
|
|
10769
10866
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10770
10867
|
throw new Error(`duplicate uuid in options ${r.uuid}, Event`);
|
|
10771
10868
|
return this.instances.push(r), r;
|
|
@@ -10797,7 +10894,7 @@ class he {
|
|
|
10797
10894
|
return this.create(e.public, e.options);
|
|
10798
10895
|
}
|
|
10799
10896
|
}
|
|
10800
|
-
class
|
|
10897
|
+
class ye {
|
|
10801
10898
|
constructor(t, e) {
|
|
10802
10899
|
this._type = "PayloadItem", this._options = e, this.uuid = E(e), this.name = t.name, this.base = t.base, this.type = t.type, this.isRef = t.isRef ?? !1, this.required = t.required ?? !1, this.isCollection = t.isCollection ?? !1, this.itemRef = t.itemRef;
|
|
10803
10900
|
}
|
|
@@ -10848,7 +10945,7 @@ class pe {
|
|
|
10848
10945
|
};
|
|
10849
10946
|
}
|
|
10850
10947
|
static create(t, e) {
|
|
10851
|
-
const r = new
|
|
10948
|
+
const r = new ye(t, e);
|
|
10852
10949
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10853
10950
|
throw new Error(`duplicate uuid in options ${r.uuid}, PayloadItem`);
|
|
10854
10951
|
return this.instances.push(r), r;
|
|
@@ -10887,7 +10984,7 @@ class pe {
|
|
|
10887
10984
|
return this.create(e.public, e.options);
|
|
10888
10985
|
}
|
|
10889
10986
|
}
|
|
10890
|
-
class
|
|
10987
|
+
class ge {
|
|
10891
10988
|
constructor(t, e) {
|
|
10892
10989
|
this._type = "Payload", this._options = e, this.uuid = E(e), this.items = t.items || [];
|
|
10893
10990
|
}
|
|
@@ -10911,7 +11008,7 @@ class fe {
|
|
|
10911
11008
|
};
|
|
10912
11009
|
}
|
|
10913
11010
|
static create(t, e) {
|
|
10914
|
-
const r = new
|
|
11011
|
+
const r = new ge(t, e);
|
|
10915
11012
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10916
11013
|
throw new Error(`duplicate uuid in options ${r.uuid}, Payload`);
|
|
10917
11014
|
return this.instances.push(r), r;
|
|
@@ -10943,7 +11040,7 @@ class fe {
|
|
|
10943
11040
|
return this.create(e.public, e.options);
|
|
10944
11041
|
}
|
|
10945
11042
|
}
|
|
10946
|
-
class
|
|
11043
|
+
class be {
|
|
10947
11044
|
constructor(t, e) {
|
|
10948
11045
|
this._type = "DataAttributives", this._options = e, this.uuid = E(e), this.content = t.content;
|
|
10949
11046
|
}
|
|
@@ -10966,7 +11063,7 @@ class me {
|
|
|
10966
11063
|
};
|
|
10967
11064
|
}
|
|
10968
11065
|
static create(t, e) {
|
|
10969
|
-
const r = new
|
|
11066
|
+
const r = new be(t, e);
|
|
10970
11067
|
if (this.instances.find((s) => s.uuid === r.uuid))
|
|
10971
11068
|
throw new Error(`duplicate uuid in options ${r.uuid}, DataAttributives`);
|
|
10972
11069
|
return this.instances.push(r), r;
|
|
@@ -10997,24 +11094,24 @@ class me {
|
|
|
10997
11094
|
return this.create(e.public, e.options);
|
|
10998
11095
|
}
|
|
10999
11096
|
}
|
|
11000
|
-
const
|
|
11001
|
-
ce,
|
|
11002
|
-
le,
|
|
11003
|
-
rt,
|
|
11004
|
-
ue,
|
|
11097
|
+
const Li = [
|
|
11005
11098
|
de,
|
|
11006
|
-
Mt,
|
|
11007
|
-
ut,
|
|
11008
11099
|
he,
|
|
11100
|
+
rt,
|
|
11009
11101
|
pe,
|
|
11010
11102
|
fe,
|
|
11011
|
-
|
|
11012
|
-
|
|
11103
|
+
Ft,
|
|
11104
|
+
ut,
|
|
11105
|
+
me,
|
|
11106
|
+
ye,
|
|
11107
|
+
ge,
|
|
11108
|
+
Dt,
|
|
11109
|
+
be
|
|
11013
11110
|
];
|
|
11014
|
-
|
|
11015
|
-
l && l.displayName &&
|
|
11111
|
+
Li.forEach((l) => {
|
|
11112
|
+
l && l.displayName && Pe(l.displayName, l);
|
|
11016
11113
|
});
|
|
11017
|
-
function
|
|
11114
|
+
function Ts({ name: l, isRef: t = !1 }, e) {
|
|
11018
11115
|
return rt.create({
|
|
11019
11116
|
name: l,
|
|
11020
11117
|
content: l ? new Function("user", `return user.roles.includes('${l}')`) : function() {
|
|
@@ -11091,7 +11188,7 @@ class F {
|
|
|
11091
11188
|
this.parent.transferToNext(this.node.uuid);
|
|
11092
11189
|
}
|
|
11093
11190
|
}
|
|
11094
|
-
class
|
|
11191
|
+
class jt {
|
|
11095
11192
|
constructor(t, e) {
|
|
11096
11193
|
this.graph = e, this.root = Z.create(t, this.graph);
|
|
11097
11194
|
}
|
|
@@ -11147,7 +11244,7 @@ class nt {
|
|
|
11147
11244
|
this.ACTIVITY_RECORD = "_Activity_";
|
|
11148
11245
|
}
|
|
11149
11246
|
async create(t) {
|
|
11150
|
-
const e =
|
|
11247
|
+
const e = jt.createInitialState(this.graph.head);
|
|
11151
11248
|
return {
|
|
11152
11249
|
activityId: (await t.system.storage.create(nt.ACTIVITY_RECORD, {
|
|
11153
11250
|
name: this.activity.name,
|
|
@@ -11193,16 +11290,16 @@ class nt {
|
|
|
11193
11290
|
return lt.is(this.graph.head.content) ? !!this.graph.head.childSeqs?.some((r) => this.isActivityHead(t, r.head)) : t === this.graph.head.content;
|
|
11194
11291
|
}
|
|
11195
11292
|
async checkActivityState(t, e, r) {
|
|
11196
|
-
if (!new
|
|
11293
|
+
if (!new jt(await this.getState(t, e), this).isInteractionAvailable(r))
|
|
11197
11294
|
throw new Error(`interaction ${r} not available`);
|
|
11198
11295
|
}
|
|
11199
11296
|
async fullGuardWithUserRef(t, e, r) {
|
|
11200
|
-
if (!t.ignoreGuard && e.conditions && await
|
|
11297
|
+
if (!t.ignoreGuard && e.conditions && await Ue(t, e, r), e.userAttributives) {
|
|
11201
11298
|
const i = Tt.is(e.userAttributives) ? w.fromValue(
|
|
11202
11299
|
e.userAttributives.content
|
|
11203
11300
|
) : w.atom(
|
|
11204
11301
|
e.userAttributives
|
|
11205
|
-
), s = (n) => n.isRef ? this.checkUserRef(t, n, r.user, r.activityId) :
|
|
11302
|
+
), s = (n) => n.isRef ? this.checkUserRef(t, n, r.user, r.activityId) : qi(t, n, r, r.user), a = await i.evaluateAsync(s);
|
|
11206
11303
|
if (a !== !0)
|
|
11207
11304
|
throw new U("User check failed", {
|
|
11208
11305
|
type: "check user failed",
|
|
@@ -11210,10 +11307,10 @@ class nt {
|
|
|
11210
11307
|
error: a
|
|
11211
11308
|
});
|
|
11212
11309
|
}
|
|
11213
|
-
e.payload && await
|
|
11310
|
+
e.payload && await We(t, e, r);
|
|
11214
11311
|
}
|
|
11215
11312
|
async completeInteractionState(t, e, r) {
|
|
11216
|
-
const i = new
|
|
11313
|
+
const i = new jt(await this.getState(t, e), this), s = i.completeInteraction(r);
|
|
11217
11314
|
A(s, "change activity state failed");
|
|
11218
11315
|
const a = i.toJSON();
|
|
11219
11316
|
await this.setActivity(t, e, { state: a });
|
|
@@ -11228,7 +11325,7 @@ class nt {
|
|
|
11228
11325
|
}), await this.setActivity(t, e, { refs: s });
|
|
11229
11326
|
}
|
|
11230
11327
|
}
|
|
11231
|
-
async function
|
|
11328
|
+
async function qi(l, t, e, r) {
|
|
11232
11329
|
if (t.content) {
|
|
11233
11330
|
let i;
|
|
11234
11331
|
try {
|
|
@@ -11240,7 +11337,7 @@ async function Fi(l, t, e, r) {
|
|
|
11240
11337
|
}
|
|
11241
11338
|
return !0;
|
|
11242
11339
|
}
|
|
11243
|
-
class
|
|
11340
|
+
class Qi extends F {
|
|
11244
11341
|
onChange(t, e) {
|
|
11245
11342
|
if (this.graph.isStartNode(t)) {
|
|
11246
11343
|
if (e)
|
|
@@ -11251,24 +11348,24 @@ class Di extends F {
|
|
|
11251
11348
|
}
|
|
11252
11349
|
}
|
|
11253
11350
|
}
|
|
11254
|
-
F.GroupStateNodeType.set("any",
|
|
11255
|
-
class
|
|
11351
|
+
F.GroupStateNodeType.set("any", Qi);
|
|
11352
|
+
class _i extends F {
|
|
11256
11353
|
onChange(t, e) {
|
|
11257
11354
|
this.isGroupCompleted() && this.complete();
|
|
11258
11355
|
}
|
|
11259
11356
|
}
|
|
11260
|
-
F.GroupStateNodeType.set("every",
|
|
11261
|
-
class
|
|
11357
|
+
F.GroupStateNodeType.set("every", _i);
|
|
11358
|
+
class Bi extends F {
|
|
11262
11359
|
onChange(t, e) {
|
|
11263
11360
|
this.graph.isEndNode(t) && this.complete();
|
|
11264
11361
|
}
|
|
11265
11362
|
}
|
|
11266
|
-
F.GroupStateNodeType.set("race",
|
|
11267
|
-
class
|
|
11363
|
+
F.GroupStateNodeType.set("race", Bi);
|
|
11364
|
+
class Ui extends F {
|
|
11268
11365
|
}
|
|
11269
|
-
F.GroupStateNodeType.set("program",
|
|
11270
|
-
const
|
|
11271
|
-
name:
|
|
11366
|
+
F.GroupStateNodeType.set("program", Ui);
|
|
11367
|
+
const Wi = "_Activity_", Je = $.create({
|
|
11368
|
+
name: Wi,
|
|
11272
11369
|
properties: [
|
|
11273
11370
|
N.create({
|
|
11274
11371
|
name: "name",
|
|
@@ -11291,17 +11388,17 @@ const Qi = "_Activity_", We = $.create({
|
|
|
11291
11388
|
collection: !1
|
|
11292
11389
|
})
|
|
11293
11390
|
]
|
|
11294
|
-
}),
|
|
11391
|
+
}), ji = x.create({
|
|
11295
11392
|
name: "activityInteraction",
|
|
11296
|
-
source:
|
|
11393
|
+
source: Je,
|
|
11297
11394
|
sourceProperty: "interaction",
|
|
11298
|
-
target:
|
|
11395
|
+
target: ue,
|
|
11299
11396
|
targetProperty: "activity",
|
|
11300
11397
|
type: "1:n"
|
|
11301
11398
|
});
|
|
11302
|
-
class
|
|
11399
|
+
class Es {
|
|
11303
11400
|
constructor(t) {
|
|
11304
|
-
this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(
|
|
11401
|
+
this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(Je, ue), this.requiredRelations.push(ji)), t.forEach((e) => {
|
|
11305
11402
|
const r = new nt(e);
|
|
11306
11403
|
this.activityCalls.set(e.uuid, r), e.name && (A(!this.activityCallsByName.has(e.name), `activity name ${e.name} is duplicated`), this.activityCallsByName.set(e.name, r));
|
|
11307
11404
|
});
|
|
@@ -11330,8 +11427,8 @@ class gs {
|
|
|
11330
11427
|
throw new Error("activityId must be provided for non-head interaction of an activity");
|
|
11331
11428
|
await r.checkActivityState(this, o.activityId, e.uuid), await r.fullGuardWithUserRef(this, e, o);
|
|
11332
11429
|
}
|
|
11333
|
-
}, a = (o) => {
|
|
11334
|
-
const c = e.mapEventData ? e.mapEventData(o) : {};
|
|
11430
|
+
}, a = async (o) => {
|
|
11431
|
+
const c = e.mapEventData ? await e.mapEventData(o) : {};
|
|
11335
11432
|
return o.activityId && (c.activity = { id: o.activityId }), c;
|
|
11336
11433
|
}, n = async function(o, c) {
|
|
11337
11434
|
const u = o.activityId;
|
|
@@ -11377,12 +11474,12 @@ class gs {
|
|
|
11377
11474
|
return this.activityCallsByName.get(t);
|
|
11378
11475
|
}
|
|
11379
11476
|
}
|
|
11380
|
-
class
|
|
11477
|
+
class As extends D {
|
|
11381
11478
|
constructor(t, e = {}) {
|
|
11382
11479
|
super(t, {
|
|
11383
11480
|
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
11384
11481
|
context: {
|
|
11385
|
-
category:
|
|
11482
|
+
category: G.INTERACTION,
|
|
11386
11483
|
interactionName: e.interactionName,
|
|
11387
11484
|
userId: e.userId,
|
|
11388
11485
|
payload: e.payload,
|
|
@@ -11393,12 +11490,12 @@ class bs extends Q {
|
|
|
11393
11490
|
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || M.HIGH;
|
|
11394
11491
|
}
|
|
11395
11492
|
}
|
|
11396
|
-
class
|
|
11493
|
+
class Hi extends D {
|
|
11397
11494
|
constructor(t, e = {}) {
|
|
11398
11495
|
super(t, {
|
|
11399
11496
|
errorType: e.context?.errorType || "ActivityError",
|
|
11400
11497
|
context: {
|
|
11401
|
-
category:
|
|
11498
|
+
category: G.ACTIVITY,
|
|
11402
11499
|
activityName: e.activityName,
|
|
11403
11500
|
activityId: e.activityId,
|
|
11404
11501
|
activityInstanceId: e.activityInstanceId,
|
|
@@ -11409,7 +11506,7 @@ class Bi extends Q {
|
|
|
11409
11506
|
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || M.MEDIUM;
|
|
11410
11507
|
}
|
|
11411
11508
|
}
|
|
11412
|
-
class
|
|
11509
|
+
class Ss extends Hi {
|
|
11413
11510
|
constructor(t, e = {}) {
|
|
11414
11511
|
super(t, {
|
|
11415
11512
|
...e,
|
|
@@ -11424,199 +11521,207 @@ class Rs extends Bi {
|
|
|
11424
11521
|
}
|
|
11425
11522
|
}
|
|
11426
11523
|
export {
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11524
|
+
Wi as ACTIVITY_RECORD,
|
|
11525
|
+
nr as ALL_ATTR_SYMBOL,
|
|
11526
|
+
Wt as ASYNC_TASK_RECORD,
|
|
11527
|
+
Ft as Action,
|
|
11528
|
+
he as Activity,
|
|
11432
11529
|
nt as ActivityCall,
|
|
11433
|
-
|
|
11530
|
+
Hi as ActivityError,
|
|
11434
11531
|
lt as ActivityGroup,
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11532
|
+
ji as ActivityInteractionRelation,
|
|
11533
|
+
Es as ActivityManager,
|
|
11534
|
+
Je as ActivityStateEntity,
|
|
11535
|
+
Ss as ActivityStateError,
|
|
11536
|
+
Cr as AliasManager,
|
|
11440
11537
|
gt as Any,
|
|
11441
|
-
|
|
11442
|
-
|
|
11538
|
+
Jr as AnyHandles,
|
|
11539
|
+
K as AttributeInfo,
|
|
11443
11540
|
C as AttributeQuery,
|
|
11444
11541
|
rt as Attributive,
|
|
11445
11542
|
Tt as Attributives,
|
|
11446
11543
|
mt as Average,
|
|
11447
|
-
|
|
11544
|
+
pi as AverageHandles,
|
|
11448
11545
|
Rt as BoolAtomData,
|
|
11449
11546
|
w as BoolExp,
|
|
11450
11547
|
wt as BoolExpressionData,
|
|
11451
|
-
|
|
11452
|
-
|
|
11548
|
+
z as ComputationDataDepError,
|
|
11549
|
+
L as ComputationError,
|
|
11453
11550
|
k as ComputationResult,
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11551
|
+
Le as ComputationResultAsync,
|
|
11552
|
+
Ve as ComputationResultFullRecompute,
|
|
11553
|
+
qe as ComputationResultResolved,
|
|
11554
|
+
xt as ComputationResultSkip,
|
|
11555
|
+
Ee as ComputationStateError,
|
|
11556
|
+
pe as Condition,
|
|
11557
|
+
X as ConditionError,
|
|
11558
|
+
Dt as Conditions,
|
|
11559
|
+
_t as ConstraintSetupError,
|
|
11560
|
+
_e as ConstraintViolationError,
|
|
11561
|
+
ys as Controller,
|
|
11465
11562
|
pt as Count,
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11563
|
+
Xr as CountHandles,
|
|
11564
|
+
cr as CreationExecutor,
|
|
11565
|
+
se as Custom,
|
|
11566
|
+
bi as CustomHandles,
|
|
11567
|
+
ce as DBConsoleLogger,
|
|
11568
|
+
ki as DBLogLevel,
|
|
11569
|
+
Mr as DBSetup,
|
|
11570
|
+
we as DEFAULT_SCHEMA_DIALECT,
|
|
11571
|
+
us as DELETED_STATE,
|
|
11475
11572
|
B as DICTIONARY_RECORD,
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11573
|
+
fe as DataAttributive,
|
|
11574
|
+
be as DataAttributives,
|
|
11575
|
+
Ge as DataPolicy,
|
|
11576
|
+
te as Dictionary,
|
|
11577
|
+
Fr as DictionaryEntity,
|
|
11481
11578
|
$ as Entity,
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11579
|
+
mi as EntityCustomHandle,
|
|
11580
|
+
gr as EntityQueryHandle,
|
|
11581
|
+
Ht as EntityToTableMap,
|
|
11582
|
+
ne as Equation,
|
|
11583
|
+
G as ErrorCategory,
|
|
11487
11584
|
M as ErrorSeverity,
|
|
11488
|
-
|
|
11489
|
-
|
|
11585
|
+
me as Event,
|
|
11586
|
+
Oe as EventSource,
|
|
11490
11587
|
yt as Every,
|
|
11491
|
-
|
|
11588
|
+
jr as EveryHandles,
|
|
11492
11589
|
O as Expression,
|
|
11493
|
-
|
|
11590
|
+
D as FrameworkError,
|
|
11494
11591
|
ut as Gateway,
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11592
|
+
Ci as GetAction,
|
|
11593
|
+
Hr as GlobalAnyHandle,
|
|
11594
|
+
di as GlobalAverageHandle,
|
|
11498
11595
|
j as GlobalBoundState,
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11596
|
+
Kr as GlobalCountHandle,
|
|
11597
|
+
fi as GlobalCustomHandle,
|
|
11598
|
+
Ur as GlobalEveryHandle,
|
|
11599
|
+
ai as GlobalRealTimeComputation,
|
|
11600
|
+
Vr as GlobalStateMachineHandle,
|
|
11601
|
+
ci as GlobalSumHandle,
|
|
11602
|
+
Qr as GlobalWeightedSummationHandle,
|
|
11603
|
+
Kt as HARD_DELETION_PROPERTY_NAME,
|
|
11604
|
+
ms as HardDeletionProperty,
|
|
11605
|
+
Ne as ID_ATTR,
|
|
11606
|
+
xi as INTERACTION_RECORD,
|
|
11607
|
+
Pt as Inequality,
|
|
11608
|
+
de as Interaction,
|
|
11609
|
+
ue as InteractionEventEntity,
|
|
11610
|
+
As as InteractionExecutionError,
|
|
11514
11611
|
U as InteractionGuardError,
|
|
11515
|
-
|
|
11612
|
+
Yt as KlassByName,
|
|
11516
11613
|
m as LINK_SYMBOL,
|
|
11517
|
-
|
|
11614
|
+
Ct as LinkInfo,
|
|
11518
11615
|
y as MatchExp,
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11616
|
+
ar as Modifier,
|
|
11617
|
+
bs as MonoSystem,
|
|
11618
|
+
ls as NON_DELETED_STATE,
|
|
11619
|
+
cs as NON_EXIST_STATE,
|
|
11620
|
+
Yr as NestedDispatchError,
|
|
11621
|
+
q as NewRecordData,
|
|
11622
|
+
rs as PHASE_AFTER_ALL,
|
|
11623
|
+
es as PHASE_BEFORE_ALL,
|
|
11624
|
+
Qt as PHASE_NORMAL,
|
|
11625
|
+
ge as Payload,
|
|
11626
|
+
ye as PayloadItem,
|
|
11529
11627
|
N as Property,
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11628
|
+
Gr as PropertyAnyHandle,
|
|
11629
|
+
hi as PropertyAverageHandle,
|
|
11630
|
+
zr as PropertyCountHandle,
|
|
11631
|
+
gi as PropertyCustomHandle,
|
|
11632
|
+
Wr as PropertyEveryHandle,
|
|
11633
|
+
ni as PropertyRealTimeComputation,
|
|
11634
|
+
Lr as PropertyStateMachineHandle,
|
|
11635
|
+
li as PropertySumHandle,
|
|
11636
|
+
Zt as PropertyTypes,
|
|
11637
|
+
_r as PropertyWeightedSummationHandle,
|
|
11638
|
+
pr as QueryExecutor,
|
|
11639
|
+
$t as ROOT_LABEL,
|
|
11640
|
+
ve as ROW_ID_ATTR,
|
|
11543
11641
|
bt as RealTime,
|
|
11544
|
-
|
|
11642
|
+
oi as RealTimeHandles,
|
|
11545
11643
|
S as RecordBoundState,
|
|
11546
11644
|
ot as RecordInfo,
|
|
11547
|
-
|
|
11645
|
+
Be as RecordMutationSideEffect,
|
|
11548
11646
|
P as RecordQuery,
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11647
|
+
yr as RecordQueryAgent,
|
|
11648
|
+
hr as RecordQueryRef,
|
|
11649
|
+
Q as RecordQueryTree,
|
|
11650
|
+
ii as RecordsTransformHandle,
|
|
11553
11651
|
Y as RecursiveContext,
|
|
11554
|
-
|
|
11652
|
+
Me as RefContainer,
|
|
11555
11653
|
x as Relation,
|
|
11556
|
-
|
|
11654
|
+
yi as RelationCustomHandle,
|
|
11557
11655
|
W as RequireSerializableRetry,
|
|
11558
|
-
|
|
11656
|
+
dr as SQLBuilder,
|
|
11559
11657
|
st as SYSTEM_RECORD,
|
|
11560
|
-
|
|
11561
|
-
|
|
11658
|
+
vi as Scheduler,
|
|
11659
|
+
ie as SideEffect,
|
|
11562
11660
|
dt as StateMachine,
|
|
11563
|
-
|
|
11661
|
+
qr as StateMachineHandles,
|
|
11564
11662
|
tt as StateNode,
|
|
11565
|
-
|
|
11663
|
+
re as StateTransfer,
|
|
11566
11664
|
ft as Summation,
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11665
|
+
ui as SummationHandles,
|
|
11666
|
+
le as SystemConsoleLogger,
|
|
11667
|
+
Or as SystemEntity,
|
|
11668
|
+
Ii as SystemLogLevel,
|
|
11669
|
+
Jt as TransactionCapabilityError,
|
|
11670
|
+
It as TransactionRetryExhaustedError,
|
|
11671
|
+
je as Transfer,
|
|
11672
|
+
Mt as Transform,
|
|
11673
|
+
si as TransformHandles,
|
|
11674
|
+
fs as USER_ENTITY,
|
|
11675
|
+
ee as UniqueConstraint,
|
|
11576
11676
|
ht as WeightedSummation,
|
|
11577
|
-
|
|
11578
|
-
|
|
11677
|
+
Br as WeightedSummationHandles,
|
|
11678
|
+
Se as addToCurrentEffects,
|
|
11579
11679
|
A as assert,
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11680
|
+
oe as asyncEffectsContext,
|
|
11681
|
+
Rs as asyncInteractionContext,
|
|
11682
|
+
ws as boolExpToAttributives,
|
|
11683
|
+
Ue as checkCondition,
|
|
11684
|
+
We as checkPayload,
|
|
11685
|
+
Xi as clearAllInstances,
|
|
11686
|
+
H as collectErrorChain,
|
|
11687
|
+
Ye as createInstances,
|
|
11688
|
+
Zi as createInstancesFromString,
|
|
11689
|
+
Pr as createUniqueConstraintStatement,
|
|
11690
|
+
De as createUniqueIndexSQL,
|
|
11691
|
+
Ts as createUserRoleAttributive,
|
|
11692
|
+
gs as dbConsoleLogger,
|
|
11592
11693
|
Et as deepClone,
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11694
|
+
Fe as defaultEncodeLiteral,
|
|
11695
|
+
as as everyAsync,
|
|
11696
|
+
os as everyWithErrorAsync,
|
|
11697
|
+
is as filterMap,
|
|
11698
|
+
Ri as findConstraintViolationError,
|
|
11699
|
+
ei as findErrorByCode,
|
|
11700
|
+
vs as findRootActivity,
|
|
11701
|
+
He as forEachInteraction,
|
|
11600
11702
|
E as generateUUID,
|
|
11601
|
-
|
|
11602
|
-
|
|
11703
|
+
Ti as getCurrentEffects,
|
|
11704
|
+
Ns as getInteractions,
|
|
11603
11705
|
ct as getSchemaDialect,
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11706
|
+
ds as hasErrorCode,
|
|
11707
|
+
zi as indexBy,
|
|
11708
|
+
Ce as isObject,
|
|
11709
|
+
xe as isPlainObject,
|
|
11710
|
+
Zr as isRequireSerializableRetry,
|
|
11711
|
+
ti as isRetryableTransactionError,
|
|
11712
|
+
ps as isTransactionCapabilityError,
|
|
11713
|
+
hs as isTransactionRetryExhaustedError,
|
|
11714
|
+
ss as mapObject,
|
|
11715
|
+
Bt as normalizeDatabaseError,
|
|
11716
|
+
xr as predicateSQLForOperator,
|
|
11717
|
+
kt as quoteIdentifier,
|
|
11613
11718
|
At as quoteLiteral,
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11719
|
+
Pe as registerKlass,
|
|
11720
|
+
ae as runWithTransactionRetry,
|
|
11721
|
+
ns as someAsync,
|
|
11722
|
+
ts as sqliteEncodeLiteral,
|
|
11723
|
+
Yi as stringifyAllInstances,
|
|
11619
11724
|
T as stringifyAttribute,
|
|
11620
|
-
|
|
11725
|
+
$i as systemConsoleLogger
|
|
11621
11726
|
};
|
|
11622
11727
|
//# sourceMappingURL=index.js.map
|