interaqt 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +391 -372
- package/dist/index.js.map +1 -1
- package/dist/runtime/Controller.d.ts.map +1 -1
- package/dist/runtime/migration.d.ts +1 -0
- package/dist/runtime/migration.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { AsyncLocalStorage as
|
|
2
|
-
import { AsyncLocalStorage as
|
|
1
|
+
import { AsyncLocalStorage as Ri } from "node:async_hooks";
|
|
2
|
+
import { AsyncLocalStorage as Ni } from "async_hooks";
|
|
3
3
|
import { createHash as Wi } from "node:crypto";
|
|
4
|
-
function
|
|
4
|
+
function vi(c) {
|
|
5
5
|
return c !== null && typeof c == "object";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
if (!
|
|
7
|
+
function Ei(c) {
|
|
8
|
+
if (!vi(c)) return !1;
|
|
9
9
|
const t = Object.getPrototypeOf(c);
|
|
10
10
|
return t === null ? !0 : t === Object.prototype || t === null;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function us(c, t) {
|
|
13
13
|
const e = {};
|
|
14
14
|
for (const i of c)
|
|
15
15
|
i && i[t] !== void 0 && (e[String(i[t])] = i);
|
|
16
16
|
return e;
|
|
17
17
|
}
|
|
18
18
|
function k(c) {
|
|
19
|
-
return typeof c == "function" ? `func::${c.toString()}` : Array.isArray(c) ? c :
|
|
19
|
+
return typeof c == "function" ? `func::${c.toString()}` : Array.isArray(c) ? c : vi(c) && !Ei(c) ? `uuid::${c.uuid}` : c;
|
|
20
20
|
}
|
|
21
21
|
function Bt(c, t) {
|
|
22
22
|
if (c == null || typeof c != "object") return c;
|
|
23
23
|
if (Array.isArray(c)) return c.map((i) => Bt(i, t));
|
|
24
|
-
if (
|
|
24
|
+
if (Ei(c))
|
|
25
25
|
return Object.fromEntries(Object.entries(c).map(([i, r]) => [i, Bt(r, t)]));
|
|
26
26
|
if (c instanceof Set)
|
|
27
27
|
return new Set(Array.from(c.values()).map((i) => Bt(i, t)));
|
|
@@ -30,21 +30,21 @@ function Bt(c, t) {
|
|
|
30
30
|
const e = c;
|
|
31
31
|
return t && e._type && e.constructor?.clone ? e.constructor.clone(c, t) : c;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ds(...c) {
|
|
34
34
|
for (const t of c)
|
|
35
35
|
t.instances.length = 0;
|
|
36
36
|
}
|
|
37
37
|
const Ce = /* @__PURE__ */ new Map();
|
|
38
|
-
function
|
|
38
|
+
function Ti(c, t) {
|
|
39
39
|
t && t.isKlass && t.displayName && Ce.set(c, t);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function hs() {
|
|
42
42
|
const c = [];
|
|
43
43
|
return Array.from(Ce.entries()).forEach(([, t]) => {
|
|
44
44
|
t.instances && Array.isArray(t.instances) && t.stringify && c.push(...t.instances.map((e) => t.stringify(e)));
|
|
45
45
|
}), `[${c.join(",")}]`;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ps(c) {
|
|
48
48
|
const t = JSON.parse(c);
|
|
49
49
|
return Gi(t);
|
|
50
50
|
}
|
|
@@ -550,7 +550,7 @@ class F {
|
|
|
550
550
|
return this.create(e.public, e.options);
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
const
|
|
553
|
+
const Si = /^[a-zA-Z0-9_]+$/;
|
|
554
554
|
class Zt {
|
|
555
555
|
constructor(t, e) {
|
|
556
556
|
this._type = "UniqueConstraint", this._options = e, this.uuid = A(e), this.name = t.name, this.properties = t.properties, this.where = t.where, this.violationCode = t.violationCode;
|
|
@@ -570,7 +570,7 @@ class Zt {
|
|
|
570
570
|
type: "string",
|
|
571
571
|
required: !0,
|
|
572
572
|
constraints: {
|
|
573
|
-
nameFormat: ({ name: t }) =>
|
|
573
|
+
nameFormat: ({ name: t }) => Si.test(t)
|
|
574
574
|
}
|
|
575
575
|
},
|
|
576
576
|
properties: {
|
|
@@ -633,7 +633,7 @@ class Zt {
|
|
|
633
633
|
return this.create(e.public, e.options);
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
class
|
|
636
|
+
class ki {
|
|
637
637
|
constructor(t, e) {
|
|
638
638
|
this._type = "NonNullConstraint", this._options = e, this.uuid = A(e), this.name = t.name, this.property = t.property, this.violationCode = t.violationCode;
|
|
639
639
|
}
|
|
@@ -652,7 +652,7 @@ class Si {
|
|
|
652
652
|
type: "string",
|
|
653
653
|
required: !0,
|
|
654
654
|
constraints: {
|
|
655
|
-
nameFormat: ({ name: t }) =>
|
|
655
|
+
nameFormat: ({ name: t }) => Si.test(t)
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
658
|
property: {
|
|
@@ -666,7 +666,7 @@ class Si {
|
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
668
|
static create(t, e) {
|
|
669
|
-
const i = new
|
|
669
|
+
const i = new ki(t, e);
|
|
670
670
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
671
671
|
throw new Error(`duplicate uuid in options ${i.uuid}, NonNullConstraint`);
|
|
672
672
|
return this.instances.push(i), i;
|
|
@@ -702,7 +702,7 @@ class Si {
|
|
|
702
702
|
return this.create(e.public, e.options);
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
class
|
|
705
|
+
class yt {
|
|
706
706
|
constructor(t, e) {
|
|
707
707
|
this._type = "StateNode", this._options = e, this.uuid = A(e), this.name = t.name, this.computeValue = t.computeValue;
|
|
708
708
|
}
|
|
@@ -730,7 +730,7 @@ class mt {
|
|
|
730
730
|
};
|
|
731
731
|
}
|
|
732
732
|
static create(t, e) {
|
|
733
|
-
const i = new
|
|
733
|
+
const i = new yt(t, e);
|
|
734
734
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
735
735
|
throw new Error(`duplicate uuid in options ${i.uuid}, StateNode`);
|
|
736
736
|
return this.instances.push(i), i;
|
|
@@ -1889,7 +1889,7 @@ const Yi = [
|
|
|
1889
1889
|
F,
|
|
1890
1890
|
T,
|
|
1891
1891
|
Zt,
|
|
1892
|
-
|
|
1892
|
+
yt,
|
|
1893
1893
|
xe,
|
|
1894
1894
|
Ct,
|
|
1895
1895
|
$t,
|
|
@@ -1906,7 +1906,7 @@ const Yi = [
|
|
|
1906
1906
|
Lt
|
|
1907
1907
|
];
|
|
1908
1908
|
Yi.forEach((c) => {
|
|
1909
|
-
c && c.displayName &&
|
|
1909
|
+
c && c.displayName && Ti(c.displayName, c);
|
|
1910
1910
|
});
|
|
1911
1911
|
class ge {
|
|
1912
1912
|
constructor(t = [], e = []) {
|
|
@@ -2234,7 +2234,7 @@ class Pe {
|
|
|
2234
2234
|
}), this.create(i, e.options);
|
|
2235
2235
|
}
|
|
2236
2236
|
}
|
|
2237
|
-
class
|
|
2237
|
+
class Ai {
|
|
2238
2238
|
constructor(t, e) {
|
|
2239
2239
|
this._type = "EventSource", this._options = e, this.uuid = A(e), this.name = t.name, this.entity = t.entity, this.guard = t.guard, this.mapEventData = t.mapEventData, this.resolve = t.resolve, this.afterDispatch = t.afterDispatch, this.postCommit = t.postCommit;
|
|
2240
2240
|
}
|
|
@@ -2248,7 +2248,7 @@ class ki {
|
|
|
2248
2248
|
this.instances = [];
|
|
2249
2249
|
}
|
|
2250
2250
|
static create(t, e) {
|
|
2251
|
-
const i = new
|
|
2251
|
+
const i = new Ai(t, e);
|
|
2252
2252
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
2253
2253
|
throw new Error(`duplicate uuid in options ${i.uuid}, EventSource`);
|
|
2254
2254
|
return this.instances.push(i), i;
|
|
@@ -3771,12 +3771,12 @@ WHERE ${a}
|
|
|
3771
3771
|
}
|
|
3772
3772
|
}
|
|
3773
3773
|
const Kt = ":root";
|
|
3774
|
-
class
|
|
3774
|
+
class ht {
|
|
3775
3775
|
constructor(t, e, i = []) {
|
|
3776
3776
|
this.label = t, this.parent = e, this.stack = i;
|
|
3777
3777
|
}
|
|
3778
3778
|
concat(t) {
|
|
3779
|
-
return new
|
|
3779
|
+
return new ht(this.label, this.parent, [...this.stack, t]);
|
|
3780
3780
|
}
|
|
3781
3781
|
getStack(t) {
|
|
3782
3782
|
return [...this.stack];
|
|
@@ -3785,7 +3785,7 @@ class dt {
|
|
|
3785
3785
|
* 创建一个新的子上下文
|
|
3786
3786
|
*/
|
|
3787
3787
|
spawn(t) {
|
|
3788
|
-
return new
|
|
3788
|
+
return new ht(t, this);
|
|
3789
3789
|
}
|
|
3790
3790
|
}
|
|
3791
3791
|
class nr {
|
|
@@ -3828,7 +3828,7 @@ class or {
|
|
|
3828
3828
|
* 查找记录(主查询方法)
|
|
3829
3829
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
3830
3830
|
*/
|
|
3831
|
-
async findRecords(t, e = "", i, r = new
|
|
3831
|
+
async findRecords(t, e = "", i, r = new ht(Kt), a = !1) {
|
|
3832
3832
|
if (i || (i = new nr(t)), t.goto) {
|
|
3833
3833
|
if (t.exit && await t.exit(r))
|
|
3834
3834
|
return [];
|
|
@@ -4310,11 +4310,11 @@ class ur {
|
|
|
4310
4310
|
* 查找记录(主查询方法)- 委托给 QueryExecutor
|
|
4311
4311
|
* CAUTION findRelatedRecords 中的递归调用会使得 includeRelationData 变为 true
|
|
4312
4312
|
*/
|
|
4313
|
-
async findRecords(t, e = "", i, r = new
|
|
4313
|
+
async findRecords(t, e = "", i, r = new ht(Kt)) {
|
|
4314
4314
|
return this.queryExecutor.findRecords(t, e, i, r);
|
|
4315
4315
|
}
|
|
4316
4316
|
async lockRecords(t, e = "") {
|
|
4317
|
-
return this.queryExecutor.findRecords(t, e, void 0, new
|
|
4317
|
+
return this.queryExecutor.findRecords(t, e, void 0, new ht(Kt), !0);
|
|
4318
4318
|
}
|
|
4319
4319
|
// 委托给 CreationExecutor
|
|
4320
4320
|
async createRecordDependency(t, e) {
|
|
@@ -4461,7 +4461,7 @@ class ur {
|
|
|
4461
4461
|
return this.queryExecutor.findPath(t, e, i, r, a);
|
|
4462
4462
|
}
|
|
4463
4463
|
}
|
|
4464
|
-
class
|
|
4464
|
+
class ei {
|
|
4465
4465
|
constructor(t, e) {
|
|
4466
4466
|
this.map = t, this.database = e, this.agent = new ur(t, e);
|
|
4467
4467
|
}
|
|
@@ -4735,7 +4735,7 @@ class Jt {
|
|
|
4735
4735
|
return R(this.isFilteredRelation(), "only filtered relation can get resolved record name"), this.data.resolvedBaseRecordName;
|
|
4736
4736
|
}
|
|
4737
4737
|
}
|
|
4738
|
-
class
|
|
4738
|
+
class dt {
|
|
4739
4739
|
constructor(t, e) {
|
|
4740
4740
|
this.data = t, this.aliasManager = e;
|
|
4741
4741
|
}
|
|
@@ -4958,19 +4958,19 @@ function hr(c) {
|
|
|
4958
4958
|
}
|
|
4959
4959
|
function pr(c, t) {
|
|
4960
4960
|
const e = new ge(c, t), i = dr(c), r = hr(t);
|
|
4961
|
-
return
|
|
4961
|
+
return ii(
|
|
4962
4962
|
c,
|
|
4963
4963
|
e,
|
|
4964
4964
|
i,
|
|
4965
4965
|
"entity"
|
|
4966
|
-
),
|
|
4966
|
+
), ii(
|
|
4967
4967
|
t,
|
|
4968
4968
|
e,
|
|
4969
4969
|
r,
|
|
4970
4970
|
"relation"
|
|
4971
4971
|
), e.getAll();
|
|
4972
4972
|
}
|
|
4973
|
-
function
|
|
4973
|
+
function ii(c, t, e, i) {
|
|
4974
4974
|
const r = c.filter((a) => _t(a) !== void 0);
|
|
4975
4975
|
for (const a of r)
|
|
4976
4976
|
fr(
|
|
@@ -4981,7 +4981,7 @@ function ei(c, t, e, i) {
|
|
|
4981
4981
|
);
|
|
4982
4982
|
}
|
|
4983
4983
|
function fr(c, t, e, i) {
|
|
4984
|
-
const r = e === "entity", s = `__${
|
|
4984
|
+
const r = e === "entity", s = `__${gt(c)}_input_${e}`, n = r ? t.getEntityByName(c.name) : t.getRelationByName(c.name), [o, l] = wr(
|
|
4985
4985
|
n,
|
|
4986
4986
|
s,
|
|
4987
4987
|
i,
|
|
@@ -5012,14 +5012,14 @@ function mr(c, t, e, i, r) {
|
|
|
5012
5012
|
);
|
|
5013
5013
|
if (!r && a === c)
|
|
5014
5014
|
return;
|
|
5015
|
-
const n =
|
|
5015
|
+
const n = gt(s), o = r ? i.getEntityByName(n) : i.getRelationByName(n);
|
|
5016
5016
|
o && i.replace(a, o);
|
|
5017
5017
|
}
|
|
5018
5018
|
function yr(c, t) {
|
|
5019
5019
|
const e = /* @__PURE__ */ new Map(), i = _t(c);
|
|
5020
5020
|
if (i && i.length > 0)
|
|
5021
5021
|
for (const r of i) {
|
|
5022
|
-
const a =
|
|
5022
|
+
const a = gt(r), s = [...t.get(a) || []], n = e.get(a) || [];
|
|
5023
5023
|
for (n.push(a), e.set(a, n); s.length; ) {
|
|
5024
5024
|
const o = s.shift(), l = e.get(o) || [];
|
|
5025
5025
|
l.push(...n), e.set(o, l);
|
|
@@ -5036,7 +5036,7 @@ function gr(c, t, e) {
|
|
|
5036
5036
|
type: "json",
|
|
5037
5037
|
defaultValue: (r, a) => {
|
|
5038
5038
|
const s = _t(t) || [], o = (i.get(a) || []).filter(
|
|
5039
|
-
(l) => s.some((u) =>
|
|
5039
|
+
(l) => s.some((u) => gt(u) === l)
|
|
5040
5040
|
);
|
|
5041
5041
|
return o.length > 0 ? o : [a];
|
|
5042
5042
|
}
|
|
@@ -5131,7 +5131,7 @@ function wr(c, t, e, i) {
|
|
|
5131
5131
|
properties: a
|
|
5132
5132
|
}), n.baseRelation = o, n.sourceProperty = s.sourceProperty, n.targetProperty = s.targetProperty, n.matchExpression = w.fromArray(
|
|
5133
5133
|
s.inputRelations.map((u) => {
|
|
5134
|
-
const d =
|
|
5134
|
+
const d = gt(u);
|
|
5135
5135
|
return {
|
|
5136
5136
|
key: t,
|
|
5137
5137
|
value: ["contains", d]
|
|
@@ -5156,7 +5156,7 @@ function Rr(c, t, e) {
|
|
|
5156
5156
|
value: ["contains", i.name]
|
|
5157
5157
|
}), [s, a];
|
|
5158
5158
|
} else {
|
|
5159
|
-
const i = c, r = t, a =
|
|
5159
|
+
const i = c, r = t, a = gt(i);
|
|
5160
5160
|
return i.baseRelation ? [i, Nr(i)] : [F.create({
|
|
5161
5161
|
name: a,
|
|
5162
5162
|
baseRelation: r,
|
|
@@ -5184,7 +5184,7 @@ function vr(c) {
|
|
|
5184
5184
|
function _t(c) {
|
|
5185
5185
|
return qt(c) ? c.inputEntities : c.inputRelations;
|
|
5186
5186
|
}
|
|
5187
|
-
function
|
|
5187
|
+
function gt(c) {
|
|
5188
5188
|
return qt(c), c.name;
|
|
5189
5189
|
}
|
|
5190
5190
|
class Er {
|
|
@@ -5273,18 +5273,18 @@ class Er {
|
|
|
5273
5273
|
this.tableAliasCounter = 1, this.fieldAliasCounter = 1, this.tablePathToAlias.clear(), this.tableAliasToPath.clear(), this.fieldPathToAlias.clear(), this.fieldAliasToPath.clear();
|
|
5274
5274
|
}
|
|
5275
5275
|
}
|
|
5276
|
-
const
|
|
5276
|
+
const ri = {
|
|
5277
5277
|
name: "postgres",
|
|
5278
5278
|
maxIdentifierLength: 63,
|
|
5279
5279
|
supportsCreateIndexIfNotExists: !0,
|
|
5280
|
-
encodeLiteral:
|
|
5280
|
+
encodeLiteral: Ci,
|
|
5281
5281
|
constraints: {
|
|
5282
5282
|
unique: !0,
|
|
5283
5283
|
filteredUnique: !0,
|
|
5284
5284
|
nonNull: !0
|
|
5285
5285
|
}
|
|
5286
5286
|
};
|
|
5287
|
-
function
|
|
5287
|
+
function Ci(c) {
|
|
5288
5288
|
if (c === null) return "NULL";
|
|
5289
5289
|
if (typeof c == "number") {
|
|
5290
5290
|
if (!Number.isFinite(c)) throw new Error(`Invalid numeric constraint literal: ${c}`);
|
|
@@ -5292,27 +5292,27 @@ function Ai(c) {
|
|
|
5292
5292
|
}
|
|
5293
5293
|
return typeof c == "boolean" ? c ? "TRUE" : "FALSE" : `'${c.replace(/'/g, "''")}'`;
|
|
5294
5294
|
}
|
|
5295
|
-
function
|
|
5296
|
-
return typeof c == "boolean" ? c ? "1" : "0" :
|
|
5295
|
+
function fs(c) {
|
|
5296
|
+
return typeof c == "boolean" ? c ? "1" : "0" : Ci(c);
|
|
5297
5297
|
}
|
|
5298
5298
|
function Q(c) {
|
|
5299
5299
|
return {
|
|
5300
|
-
...
|
|
5300
|
+
...ri,
|
|
5301
5301
|
...c?.schemaDialect,
|
|
5302
5302
|
constraints: {
|
|
5303
|
-
...
|
|
5303
|
+
...ri.constraints,
|
|
5304
5304
|
...c?.schemaDialect?.constraints
|
|
5305
5305
|
}
|
|
5306
5306
|
};
|
|
5307
5307
|
}
|
|
5308
|
-
function
|
|
5308
|
+
function ct(c, t) {
|
|
5309
5309
|
return t.name === "mysql" ? `\`${c.replace(/`/g, "``")}\`` : `"${c.replace(/"/g, '""')}"`;
|
|
5310
5310
|
}
|
|
5311
5311
|
function Ut(c, t) {
|
|
5312
5312
|
return t.encodeLiteral(c);
|
|
5313
5313
|
}
|
|
5314
5314
|
function Tr(c, t, e) {
|
|
5315
|
-
const i =
|
|
5315
|
+
const i = ct(c, e);
|
|
5316
5316
|
switch (t.op) {
|
|
5317
5317
|
case "isNull":
|
|
5318
5318
|
return `${i} IS NULL`;
|
|
@@ -5333,12 +5333,12 @@ function Tr(c, t, e) {
|
|
|
5333
5333
|
}
|
|
5334
5334
|
}
|
|
5335
5335
|
function be(c, t, e, i, r, a) {
|
|
5336
|
-
const s = i.supportsCreateIndexIfNotExists ? " IF NOT EXISTS" : "", n = e.map((l) =>
|
|
5336
|
+
const s = i.supportsCreateIndexIfNotExists ? " IF NOT EXISTS" : "", n = e.map((l) => ct(l, i)).join(", "), o = r ? `
|
|
5337
5337
|
WHERE ${Object.entries(r).map(([l, u]) => {
|
|
5338
5338
|
const d = a?.(l) ?? l;
|
|
5339
5339
|
return Tr(d, u, i);
|
|
5340
5340
|
}).join(" AND ")}` : "";
|
|
5341
|
-
return `CREATE UNIQUE INDEX${s} ${
|
|
5341
|
+
return `CREATE UNIQUE INDEX${s} ${ct(c, i)} ON ${ct(t, i)} (${n})${o}`;
|
|
5342
5342
|
}
|
|
5343
5343
|
function Sr(c, t, e) {
|
|
5344
5344
|
if (!t.constraints.unique)
|
|
@@ -5362,7 +5362,7 @@ function kr(c, t) {
|
|
|
5362
5362
|
throw new Error("expected non-null constraint item");
|
|
5363
5363
|
if (!t.constraints.nonNull)
|
|
5364
5364
|
throw new Error(`non-null constraints are not supported by ${t.name} schema dialect`);
|
|
5365
|
-
const e =
|
|
5365
|
+
const e = ct(c.tableName, t), i = ct(c.physicalName, t), r = ct(c.field, t);
|
|
5366
5366
|
if (t.name === "sqlite")
|
|
5367
5367
|
throw new Error("post-recompute non-null constraints are not supported by sqlite schema dialect");
|
|
5368
5368
|
return {
|
|
@@ -5370,7 +5370,7 @@ function kr(c, t) {
|
|
|
5370
5370
|
sql: `ALTER TABLE ${e} ADD CONSTRAINT ${i} CHECK (${r} IS NOT NULL)`
|
|
5371
5371
|
};
|
|
5372
5372
|
}
|
|
5373
|
-
class
|
|
5373
|
+
class ai {
|
|
5374
5374
|
constructor(t, e, i, r = []) {
|
|
5375
5375
|
this.entities = t, this.relations = e, this.database = i, this.mergeLinks = r, this.fieldNameMap = /* @__PURE__ */ new Map(), this.usedFieldNames = /* @__PURE__ */ new Set(), this.fieldCounter = 1, this.recordToTableMap = /* @__PURE__ */ new Map(), this.tableToRecordsMap = /* @__PURE__ */ new Map(), this.mergeLog = [], this.tables = {}, this.map = { links: {}, records: {} }, this.aliasManager = new Er(), this.constraintSchemaItems = [], this.buildMap(), this.buildTables(), this.buildConstraints();
|
|
5376
5376
|
}
|
|
@@ -5470,8 +5470,8 @@ class ri {
|
|
|
5470
5470
|
}
|
|
5471
5471
|
];
|
|
5472
5472
|
}));
|
|
5473
|
-
e && R(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[
|
|
5474
|
-
name:
|
|
5473
|
+
e && R(!i.source && !i.target, "source and target is reserved name for relation attributes"), i[si] = {
|
|
5474
|
+
name: si,
|
|
5475
5475
|
type: "id",
|
|
5476
5476
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5477
5477
|
};
|
|
@@ -5844,8 +5844,8 @@ class ri {
|
|
|
5844
5844
|
buildTables() {
|
|
5845
5845
|
Object.entries(this.map.records).forEach(([t, e]) => {
|
|
5846
5846
|
this.tables[e.table] || (this.tables[e.table] = { columns: {
|
|
5847
|
-
[
|
|
5848
|
-
name:
|
|
5847
|
+
[ni]: {
|
|
5848
|
+
name: ni,
|
|
5849
5849
|
type: "pk",
|
|
5850
5850
|
fieldType: this.database.mapToDBFieldType("pk")
|
|
5851
5851
|
}
|
|
@@ -5885,7 +5885,7 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
5885
5885
|
return i.length + r.length + 1 <= a ? `${i}_${r}` : `${i.slice(0, a - r.length - 1)}_${r}`;
|
|
5886
5886
|
}
|
|
5887
5887
|
resolveConstraintField(t, e) {
|
|
5888
|
-
const i = new
|
|
5888
|
+
const i = new dt(this.map, this.aliasManager), r = i.getRecordInfo(t), a = this.map.records[t]?.attributes[e];
|
|
5889
5889
|
if (!a)
|
|
5890
5890
|
throw new Error(`constraint property "${e}" not found on "${t}"`);
|
|
5891
5891
|
if (!a.isRecord && a.computed)
|
|
@@ -6041,8 +6041,8 @@ ${Object.values(this.tables[t].columns).map((i) => ` "${i.name}" ${i.fieldTyp
|
|
|
6041
6041
|
});
|
|
6042
6042
|
}
|
|
6043
6043
|
}
|
|
6044
|
-
const
|
|
6045
|
-
name:
|
|
6044
|
+
const Rt = "_System_", K = "_Dictionary_", si = "id", ni = "_rowId", oi = D.create({
|
|
6045
|
+
name: Rt,
|
|
6046
6046
|
properties: [
|
|
6047
6047
|
T.create({
|
|
6048
6048
|
name: "concept",
|
|
@@ -6060,7 +6060,7 @@ const wt = "_System_", K = "_Dictionary_", ai = "id", si = "_rowId", ni = D.crea
|
|
|
6060
6060
|
collection: !1
|
|
6061
6061
|
})
|
|
6062
6062
|
]
|
|
6063
|
-
}),
|
|
6063
|
+
}), ci = D.create({
|
|
6064
6064
|
name: K,
|
|
6065
6065
|
properties: [
|
|
6066
6066
|
T.create({
|
|
@@ -6074,8 +6074,8 @@ const wt = "_System_", K = "_Dictionary_", ai = "id", si = "_rowId", ni = D.crea
|
|
|
6074
6074
|
collection: !1
|
|
6075
6075
|
})
|
|
6076
6076
|
]
|
|
6077
|
-
}),
|
|
6078
|
-
class
|
|
6077
|
+
}), ms = 0, ce = 1, ys = 2;
|
|
6078
|
+
class $i {
|
|
6079
6079
|
constructor(t, e) {
|
|
6080
6080
|
this.controller = t, this.scheduler = e, this.sourceMaps = [], this.sourceMapTree = {};
|
|
6081
6081
|
}
|
|
@@ -6306,7 +6306,7 @@ class Ci {
|
|
|
6306
6306
|
}
|
|
6307
6307
|
class x {
|
|
6308
6308
|
static {
|
|
6309
|
-
this.skip = () => new
|
|
6309
|
+
this.skip = () => new pt();
|
|
6310
6310
|
}
|
|
6311
6311
|
static {
|
|
6312
6312
|
this.resolved = (t, e) => new ee(t, e);
|
|
@@ -6318,7 +6318,7 @@ class x {
|
|
|
6318
6318
|
this.fullRecompute = (t) => new Xt(t);
|
|
6319
6319
|
}
|
|
6320
6320
|
}
|
|
6321
|
-
class
|
|
6321
|
+
class pt extends x {
|
|
6322
6322
|
}
|
|
6323
6323
|
class Xt extends x {
|
|
6324
6324
|
constructor(t) {
|
|
@@ -6453,7 +6453,7 @@ function we(c, t) {
|
|
|
6453
6453
|
return !1;
|
|
6454
6454
|
return !0;
|
|
6455
6455
|
}
|
|
6456
|
-
class
|
|
6456
|
+
class Ii {
|
|
6457
6457
|
constructor(t) {
|
|
6458
6458
|
this.data = t, this.map = {};
|
|
6459
6459
|
for (const e of t.transfers)
|
|
@@ -6479,23 +6479,23 @@ function C(c, t) {
|
|
|
6479
6479
|
if (!c)
|
|
6480
6480
|
throw new Error(t);
|
|
6481
6481
|
}
|
|
6482
|
-
function
|
|
6482
|
+
function gs(c, t) {
|
|
6483
6483
|
return new Map(Array.from(c.entries()).map(([e, i]) => [e, t(e, i)]));
|
|
6484
6484
|
}
|
|
6485
|
-
function
|
|
6485
|
+
function bs(c, t) {
|
|
6486
6486
|
return Object.fromEntries(Object.entries(c).map(([e, i]) => [e, t(e, i)]));
|
|
6487
6487
|
}
|
|
6488
|
-
async function
|
|
6488
|
+
async function ws(c, t) {
|
|
6489
6489
|
for (let e of c)
|
|
6490
6490
|
if (!await t(e)) return !1;
|
|
6491
6491
|
return !0;
|
|
6492
6492
|
}
|
|
6493
|
-
async function
|
|
6493
|
+
async function Rs(c, t) {
|
|
6494
6494
|
for (let e of c)
|
|
6495
6495
|
if (await t(e)) return !0;
|
|
6496
6496
|
return !1;
|
|
6497
6497
|
}
|
|
6498
|
-
async function
|
|
6498
|
+
async function Ns(c, t) {
|
|
6499
6499
|
for (let e of c) {
|
|
6500
6500
|
const i = await t(e);
|
|
6501
6501
|
if (i !== !0) return i;
|
|
@@ -6504,7 +6504,7 @@ async function Rs(c, t) {
|
|
|
6504
6504
|
}
|
|
6505
6505
|
class Ar {
|
|
6506
6506
|
constructor(t, e, i) {
|
|
6507
|
-
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6507
|
+
this.controller = t, this.args = e, this.dataContext = i, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Ii(this.args), this.initialState = this.args.initialState;
|
|
6508
6508
|
for (const r of this.args.transfers) {
|
|
6509
6509
|
const a = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6510
6510
|
this.eventDeps[a] = {
|
|
@@ -6537,7 +6537,7 @@ class Ar {
|
|
|
6537
6537
|
}
|
|
6538
6538
|
class Cr {
|
|
6539
6539
|
constructor(t, e, i) {
|
|
6540
|
-
this.controller = t, this.args = e, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new
|
|
6540
|
+
this.controller = t, this.args = e, this.useLastValue = !1, this.eventDeps = {}, this.useMutationEvent = !0, this.transitionFinder = new Ii(this.args), this.initialState = this.args.initialState, this.dataContext = i;
|
|
6541
6541
|
for (const r of this.args.transfers) {
|
|
6542
6542
|
const a = `${r.trigger.recordName}_${r.trigger.type}`;
|
|
6543
6543
|
this.eventDeps[a] = {
|
|
@@ -6587,13 +6587,13 @@ Or if you want to use state name as value, you should not set ${this.dataContext
|
|
|
6587
6587
|
};
|
|
6588
6588
|
}
|
|
6589
6589
|
}
|
|
6590
|
-
const
|
|
6590
|
+
const vs = yt.create({
|
|
6591
6591
|
name: "nonExistent",
|
|
6592
6592
|
computeValue: () => null
|
|
6593
|
-
}),
|
|
6593
|
+
}), Es = yt.create({
|
|
6594
6594
|
name: "nonDeleted",
|
|
6595
6595
|
computeValue: () => !1
|
|
6596
|
-
}),
|
|
6596
|
+
}), Ts = yt.create({
|
|
6597
6597
|
name: "deleted",
|
|
6598
6598
|
computeValue: () => !0
|
|
6599
6599
|
}), $r = [Ar, Cr];
|
|
@@ -7337,10 +7337,10 @@ function Hr(c) {
|
|
|
7337
7337
|
function jr(c, t) {
|
|
7338
7338
|
return Y(c).find((e) => !e || typeof e != "object" ? !1 : e.code === t);
|
|
7339
7339
|
}
|
|
7340
|
-
function
|
|
7340
|
+
function Ss(c, t) {
|
|
7341
7341
|
return jr(c, t) !== void 0;
|
|
7342
7342
|
}
|
|
7343
|
-
const
|
|
7343
|
+
const li = [10, 25, 60, 150, 350];
|
|
7344
7344
|
function Wr(c) {
|
|
7345
7345
|
return new Promise((t) => setTimeout(t, c));
|
|
7346
7346
|
}
|
|
@@ -7360,10 +7360,10 @@ class Wt extends Error {
|
|
|
7360
7360
|
}), Object.setPrototypeOf(this, new.target.prototype);
|
|
7361
7361
|
}
|
|
7362
7362
|
}
|
|
7363
|
-
function
|
|
7363
|
+
function ks(c) {
|
|
7364
7364
|
return Y(c).some((t) => t instanceof Wt);
|
|
7365
7365
|
}
|
|
7366
|
-
function
|
|
7366
|
+
function As(c) {
|
|
7367
7367
|
return Y(c).some((t) => t instanceof Re);
|
|
7368
7368
|
}
|
|
7369
7369
|
async function De(c, t, e = {}) {
|
|
@@ -7385,7 +7385,7 @@ async function De(c, t, e = {}) {
|
|
|
7385
7385
|
}
|
|
7386
7386
|
if (Hr(n)) {
|
|
7387
7387
|
if (a < i) {
|
|
7388
|
-
const o =
|
|
7388
|
+
const o = li[Math.min(a - 1, li.length - 1)], l = Math.floor(Math.random() * o);
|
|
7389
7389
|
await Wr(o + l);
|
|
7390
7390
|
continue;
|
|
7391
7391
|
}
|
|
@@ -8304,7 +8304,7 @@ class H extends U {
|
|
|
8304
8304
|
}), this.handleName = e.handleName, this.computationName = e.computationName, this.dataContext = e.dataContext, this.computationPhase = e.computationPhase, this.severity = e.severity || q.MEDIUM;
|
|
8305
8305
|
}
|
|
8306
8306
|
}
|
|
8307
|
-
class
|
|
8307
|
+
class ui extends H {
|
|
8308
8308
|
constructor(t, e = {}) {
|
|
8309
8309
|
super(t, {
|
|
8310
8310
|
...e,
|
|
@@ -8334,7 +8334,7 @@ class rt extends H {
|
|
|
8334
8334
|
}), this.depName = e.depName, this.depType = e.depType, this.missingData = e.missingData, this.invalidData = e.invalidData;
|
|
8335
8335
|
}
|
|
8336
8336
|
}
|
|
8337
|
-
class
|
|
8337
|
+
class xi extends U {
|
|
8338
8338
|
constructor(t, e) {
|
|
8339
8339
|
super(t, {
|
|
8340
8340
|
errorType: "ConstraintViolationError",
|
|
@@ -8379,7 +8379,7 @@ function la(c) {
|
|
|
8379
8379
|
let t = c;
|
|
8380
8380
|
const e = /* @__PURE__ */ new Set();
|
|
8381
8381
|
for (; t && !e.has(t); ) {
|
|
8382
|
-
if (e.add(t), t instanceof
|
|
8382
|
+
if (e.add(t), t instanceof xi) return t;
|
|
8383
8383
|
t instanceof Error ? t = (t instanceof U ? t.causedBy : void 0) || t.cause : t = void 0;
|
|
8384
8384
|
}
|
|
8385
8385
|
}
|
|
@@ -8425,7 +8425,7 @@ class ue extends U {
|
|
|
8425
8425
|
}), this.schedulingPhase = e.schedulingPhase, this.failedComputations = e.failedComputations, this.severity = q.HIGH;
|
|
8426
8426
|
}
|
|
8427
8427
|
}
|
|
8428
|
-
class
|
|
8428
|
+
class di extends U {
|
|
8429
8429
|
constructor(t, e) {
|
|
8430
8430
|
super(t, {
|
|
8431
8431
|
errorType: "SideEffectError",
|
|
@@ -8441,7 +8441,7 @@ class ui extends U {
|
|
|
8441
8441
|
}), this.sideEffectName = e.sideEffectName, this.recordName = e.recordName, this.mutationType = e.mutationType, this.severity = q.MEDIUM;
|
|
8442
8442
|
}
|
|
8443
8443
|
}
|
|
8444
|
-
class
|
|
8444
|
+
class ut extends U {
|
|
8445
8445
|
constructor(t, e) {
|
|
8446
8446
|
super(t, {
|
|
8447
8447
|
errorType: e.context?.errorType || "ConditionError",
|
|
@@ -8460,7 +8460,7 @@ class lt extends U {
|
|
|
8460
8460
|
* Helper factory methods for common condition error scenarios
|
|
8461
8461
|
*/
|
|
8462
8462
|
static userCheckFailed(t, e) {
|
|
8463
|
-
return new
|
|
8463
|
+
return new ut("User check failed", {
|
|
8464
8464
|
checkType: "user",
|
|
8465
8465
|
evaluationError: t,
|
|
8466
8466
|
severity: q.HIGH,
|
|
@@ -8471,7 +8471,7 @@ class lt extends U {
|
|
|
8471
8471
|
}
|
|
8472
8472
|
static payloadValidationFailed(t, e, i, r) {
|
|
8473
8473
|
const a = `${t} ${e}`;
|
|
8474
|
-
return new
|
|
8474
|
+
return new ut(`Payload validation failed for field '${t}': ${e}`, {
|
|
8475
8475
|
checkType: "payload",
|
|
8476
8476
|
fieldName: t,
|
|
8477
8477
|
payload: i,
|
|
@@ -8482,7 +8482,7 @@ class lt extends U {
|
|
|
8482
8482
|
});
|
|
8483
8483
|
}
|
|
8484
8484
|
static conditionCheckFailed(t, e) {
|
|
8485
|
-
return new
|
|
8485
|
+
return new ut(`Condition check failed: ${t.data.name}`, {
|
|
8486
8486
|
checkType: "condition",
|
|
8487
8487
|
evaluationError: t,
|
|
8488
8488
|
severity: q.HIGH,
|
|
@@ -8493,7 +8493,7 @@ class lt extends U {
|
|
|
8493
8493
|
}
|
|
8494
8494
|
static attributiveCheckFailed(t, e, i, r) {
|
|
8495
8495
|
const a = `${t} ${e}`;
|
|
8496
|
-
return new
|
|
8496
|
+
return new ut(`Attributive check failed for field '${t}': ${e}`, {
|
|
8497
8497
|
checkType: "attributive",
|
|
8498
8498
|
fieldName: t,
|
|
8499
8499
|
payload: i,
|
|
@@ -8504,7 +8504,7 @@ class lt extends U {
|
|
|
8504
8504
|
});
|
|
8505
8505
|
}
|
|
8506
8506
|
static conceptCheckFailed(t, e) {
|
|
8507
|
-
return new
|
|
8507
|
+
return new ut(`Concept check failed for field '${t}'`, {
|
|
8508
8508
|
checkType: "concept",
|
|
8509
8509
|
fieldName: t,
|
|
8510
8510
|
evaluationError: e,
|
|
@@ -8517,7 +8517,7 @@ class lt extends U {
|
|
|
8517
8517
|
const de = "_ASYNC_TASK_";
|
|
8518
8518
|
class ha {
|
|
8519
8519
|
constructor(t, e, i, r, a) {
|
|
8520
|
-
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new
|
|
8520
|
+
this.controller = t, this.computationsHandles = /* @__PURE__ */ new Map(), this.computationHandleMap = /* @__PURE__ */ new Map(), this.erMutationEventSources = [], this.dataSourceMapTree = {}, this.sourceMapManager = new $i(this.controller, this), this.buildComputationHandleMap(a);
|
|
8521
8521
|
const s = [];
|
|
8522
8522
|
r.forEach((n) => {
|
|
8523
8523
|
n.computation && s.push({ dataContext: { type: "global", id: n }, args: n.computation });
|
|
@@ -8979,7 +8979,7 @@ class ha {
|
|
|
8979
8979
|
try {
|
|
8980
8980
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8981
8981
|
} catch (l) {
|
|
8982
|
-
throw new
|
|
8982
|
+
throw new ui("Failed to retrieve last value for incremental computation", {
|
|
8983
8983
|
handleName: t.constructor.name,
|
|
8984
8984
|
computationName: t.args.constructor.displayName,
|
|
8985
8985
|
dataContext: t.dataContext,
|
|
@@ -8993,7 +8993,7 @@ class ha {
|
|
|
8993
8993
|
try {
|
|
8994
8994
|
o = await this.controller.retrieveLastValue(t.dataContext, i);
|
|
8995
8995
|
} catch (l) {
|
|
8996
|
-
throw new
|
|
8996
|
+
throw new ui("Failed to retrieve last value for incremental patch computation", {
|
|
8997
8997
|
handleName: t.constructor.name,
|
|
8998
8998
|
computationName: t.args.constructor.displayName,
|
|
8999
8999
|
dataContext: t.dataContext,
|
|
@@ -9031,7 +9031,7 @@ class ha {
|
|
|
9031
9031
|
causedBy: o instanceof Error ? o : new Error(String(o))
|
|
9032
9032
|
});
|
|
9033
9033
|
}
|
|
9034
|
-
if (a instanceof
|
|
9034
|
+
if (a instanceof pt)
|
|
9035
9035
|
return;
|
|
9036
9036
|
if (a instanceof Vt)
|
|
9037
9037
|
try {
|
|
@@ -9141,11 +9141,11 @@ class ha {
|
|
|
9141
9141
|
}
|
|
9142
9142
|
}
|
|
9143
9143
|
}
|
|
9144
|
-
const Fe = new
|
|
9144
|
+
const Fe = new Ni();
|
|
9145
9145
|
function pa() {
|
|
9146
9146
|
return Fe.getStore()?.effects;
|
|
9147
9147
|
}
|
|
9148
|
-
function
|
|
9148
|
+
function hi(c) {
|
|
9149
9149
|
const t = Fe.getStore();
|
|
9150
9150
|
t?.effects && t.effects.push(...c);
|
|
9151
9151
|
}
|
|
@@ -9157,7 +9157,7 @@ class M extends Error {
|
|
|
9157
9157
|
}
|
|
9158
9158
|
class he extends M {
|
|
9159
9159
|
}
|
|
9160
|
-
class
|
|
9160
|
+
class Cs extends M {
|
|
9161
9161
|
}
|
|
9162
9162
|
class Tt extends M {
|
|
9163
9163
|
}
|
|
@@ -9168,20 +9168,20 @@ class St extends M {
|
|
|
9168
9168
|
class fa extends M {
|
|
9169
9169
|
}
|
|
9170
9170
|
function nt(c) {
|
|
9171
|
-
return Wi("sha256").update(
|
|
9171
|
+
return Wi("sha256").update(ft(c)).digest("hex");
|
|
9172
9172
|
}
|
|
9173
9173
|
function ma(c) {
|
|
9174
9174
|
return nt(c);
|
|
9175
9175
|
}
|
|
9176
|
-
function
|
|
9176
|
+
function ft(c) {
|
|
9177
9177
|
if (c === null || typeof c != "object")
|
|
9178
9178
|
return typeof c == "function" ? "[Function]" : JSON.stringify(c);
|
|
9179
9179
|
if (Array.isArray(c))
|
|
9180
|
-
return `[${c.map(
|
|
9180
|
+
return `[${c.map(ft).join(",")}]`;
|
|
9181
9181
|
const t = c;
|
|
9182
|
-
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${
|
|
9182
|
+
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${ft(t[e])}`).join(",")}}`;
|
|
9183
9183
|
}
|
|
9184
|
-
function
|
|
9184
|
+
function lt(c) {
|
|
9185
9185
|
return c.namePath;
|
|
9186
9186
|
}
|
|
9187
9187
|
function st(c, t, e) {
|
|
@@ -9245,7 +9245,7 @@ function wa(c) {
|
|
|
9245
9245
|
key: t.key,
|
|
9246
9246
|
scope: e ? "record" : "global",
|
|
9247
9247
|
hostRecord: e ? t.record : void 0,
|
|
9248
|
-
defaultSignature:
|
|
9248
|
+
defaultSignature: ft(t.defaultValue),
|
|
9249
9249
|
valueType: typeof t.defaultValue
|
|
9250
9250
|
};
|
|
9251
9251
|
});
|
|
@@ -9333,14 +9333,14 @@ function jt(c, t = c.system.storage.schema, e = {}) {
|
|
|
9333
9333
|
...c.entities.map((l) => {
|
|
9334
9334
|
const u = st("entity", `entity:${l.name}`, l.uuid);
|
|
9335
9335
|
return {
|
|
9336
|
-
id:
|
|
9336
|
+
id: lt(u),
|
|
9337
9337
|
identity: u,
|
|
9338
9338
|
name: l.name,
|
|
9339
9339
|
kind: "entity",
|
|
9340
9340
|
properties: (l.properties || []).map((d) => {
|
|
9341
9341
|
const h = st("property", `property:${l.name}.${d.name}`, d.uuid);
|
|
9342
9342
|
return {
|
|
9343
|
-
id:
|
|
9343
|
+
id: lt(h),
|
|
9344
9344
|
identity: h,
|
|
9345
9345
|
name: d.name,
|
|
9346
9346
|
type: d.type,
|
|
@@ -9353,14 +9353,14 @@ function jt(c, t = c.system.storage.schema, e = {}) {
|
|
|
9353
9353
|
...c.relations.map((l) => {
|
|
9354
9354
|
const u = st("relation", `relation:${l.name}`, l.uuid);
|
|
9355
9355
|
return {
|
|
9356
|
-
id:
|
|
9356
|
+
id: lt(u),
|
|
9357
9357
|
identity: u,
|
|
9358
9358
|
name: l.name,
|
|
9359
9359
|
kind: "relation",
|
|
9360
9360
|
properties: (l.properties || []).map((d) => {
|
|
9361
9361
|
const h = st("property", `property:${l.name}.${d.name}`, d.uuid);
|
|
9362
9362
|
return {
|
|
9363
|
-
id:
|
|
9363
|
+
id: lt(h),
|
|
9364
9364
|
identity: h,
|
|
9365
9365
|
name: d.name,
|
|
9366
9366
|
type: d.type,
|
|
@@ -9373,7 +9373,7 @@ function jt(c, t = c.system.storage.schema, e = {}) {
|
|
|
9373
9373
|
], r = c.relations.map((l) => {
|
|
9374
9374
|
const u = st("relation", `relation:${l.name}`, l.uuid);
|
|
9375
9375
|
return {
|
|
9376
|
-
id:
|
|
9376
|
+
id: lt(u),
|
|
9377
9377
|
identity: u,
|
|
9378
9378
|
name: l.name,
|
|
9379
9379
|
source: l.source.name,
|
|
@@ -9385,7 +9385,7 @@ function jt(c, t = c.system.storage.schema, e = {}) {
|
|
|
9385
9385
|
}), a = c.dict.map((l) => {
|
|
9386
9386
|
const u = st("dictionary", `dictionary:${l.name}`, l.uuid);
|
|
9387
9387
|
return {
|
|
9388
|
-
id:
|
|
9388
|
+
id: lt(u),
|
|
9389
9389
|
identity: u,
|
|
9390
9390
|
name: l.name,
|
|
9391
9391
|
type: l.type,
|
|
@@ -9416,14 +9416,14 @@ function jt(c, t = c.system.storage.schema, e = {}) {
|
|
|
9416
9416
|
storage: t
|
|
9417
9417
|
};
|
|
9418
9418
|
}
|
|
9419
|
-
function
|
|
9419
|
+
function $s(c, t) {
|
|
9420
9420
|
const e = new Map(c.computations.map((i) => [i.id, i]));
|
|
9421
9421
|
return t.computations.filter((i) => {
|
|
9422
9422
|
const r = e.get(i.id);
|
|
9423
9423
|
return !r || r.signature !== i.signature;
|
|
9424
9424
|
});
|
|
9425
9425
|
}
|
|
9426
|
-
function
|
|
9426
|
+
function ot(c) {
|
|
9427
9427
|
if (c.kind === "computation") return `${c.kind}:${c.id}`;
|
|
9428
9428
|
const t = c.kind === "destructive-scope" && c.recordName || "";
|
|
9429
9429
|
return `${c.kind}:${c.dataContext}:${t}`;
|
|
@@ -9437,22 +9437,22 @@ function va(c) {
|
|
|
9437
9437
|
function Ea(c) {
|
|
9438
9438
|
return c.kind === "computation" ? `computation:${c.id}` : c.kind === "dictionary" ? `dictionary:${c.id}` : c.kind === "record" ? `record:${c.id}` : c.kind === "property" ? `property:${c.id}` : c.kind === "relation" ? `relation:${c.id}` : `storage:${c.dataContext}`;
|
|
9439
9439
|
}
|
|
9440
|
-
function
|
|
9440
|
+
function Mi(c, t) {
|
|
9441
9441
|
return (c?.decisions || []).some(t);
|
|
9442
9442
|
}
|
|
9443
9443
|
function Qe(c, t) {
|
|
9444
9444
|
return (c?.decisions || []).find(t);
|
|
9445
9445
|
}
|
|
9446
|
-
function
|
|
9446
|
+
function Pi(c, t) {
|
|
9447
9447
|
return t ? c?.[t] : void 0;
|
|
9448
9448
|
}
|
|
9449
9449
|
function Gt(c, t) {
|
|
9450
9450
|
const e = Qe(c?.approvedDiff, (i) => i.kind === "event-rebuild-handler" && i.dataContext === t);
|
|
9451
|
-
return
|
|
9451
|
+
return Pi(c?.handlers?.eventRebuild, e?.handlerRef);
|
|
9452
9452
|
}
|
|
9453
|
-
function
|
|
9453
|
+
function Di(c, t) {
|
|
9454
9454
|
const e = Qe(c?.approvedDiff, (i) => i.kind === "async-completion-handler" && i.dataContext === t);
|
|
9455
|
-
return
|
|
9455
|
+
return Pi(c?.handlers?.asyncCompletion, e?.handlerRef);
|
|
9456
9456
|
}
|
|
9457
9457
|
function Ta(c, t, e, i) {
|
|
9458
9458
|
const r = [], a = [], s = new Map(c.computations.map((p) => [p.id, p])), n = new Map(t.computations.map((p) => [p.id, p])), o = new Map(c.records.map((p) => [p.id, p])), l = new Map(t.records.map((p) => [p.id, p])), u = new Map(c.relations.map((p) => [p.id, p])), d = new Map(t.relations.map((p) => [p.id, p])), h = new Map((c.dictionaries || []).map((p) => [p.id, p])), f = new Map((t.dictionaries || []).map((p) => [p.id, p]));
|
|
@@ -9623,7 +9623,7 @@ function Ta(c, t, e, i) {
|
|
|
9623
9623
|
ids: p.ids || [],
|
|
9624
9624
|
reason: p.reason
|
|
9625
9625
|
});
|
|
9626
|
-
const m = Array.from(new Map(a.map((p) => [
|
|
9626
|
+
const m = Array.from(new Map(a.map((p) => [ot(p), p])).values());
|
|
9627
9627
|
return {
|
|
9628
9628
|
kind: "interaqt-migration-diff",
|
|
9629
9629
|
version: 2,
|
|
@@ -9643,7 +9643,25 @@ function Ta(c, t, e, i) {
|
|
|
9643
9643
|
safety: i
|
|
9644
9644
|
};
|
|
9645
9645
|
}
|
|
9646
|
-
function Sa(c, t, e
|
|
9646
|
+
function Sa(c, t, e) {
|
|
9647
|
+
const i = Be(t), r = new Map(c.requiredDecisions.map((a) => [ot(a), a]));
|
|
9648
|
+
for (const a of e) {
|
|
9649
|
+
if (!a.rebuildOutput) continue;
|
|
9650
|
+
const s = i.get(a.computationId);
|
|
9651
|
+
if (!s || typeof s.compute == "function") continue;
|
|
9652
|
+
const n = {
|
|
9653
|
+
kind: "event-rebuild-handler",
|
|
9654
|
+
dataContext: a.dataContext,
|
|
9655
|
+
reason: "computation without full compute support needs an external migration rebuild handler"
|
|
9656
|
+
};
|
|
9657
|
+
r.set(ot(n), n);
|
|
9658
|
+
}
|
|
9659
|
+
return c.requiredDecisions = Array.from(r.values()), c.summary = {
|
|
9660
|
+
...c.summary,
|
|
9661
|
+
requiredDecisionCount: c.requiredDecisions.length
|
|
9662
|
+
}, c;
|
|
9663
|
+
}
|
|
9664
|
+
function ka(c, t, e, i, r) {
|
|
9647
9665
|
if (!c)
|
|
9648
9666
|
throw new M("Migration requires an approved diff. Call controller.generateMigrationDiff(), review it, set status to 'approved', then pass it as migrate({ approvedDiff }).");
|
|
9649
9667
|
if (c.kind !== "interaqt-migration-diff" || c.version !== 2)
|
|
@@ -9652,8 +9670,8 @@ function Sa(c, t, e, i, r) {
|
|
|
9652
9670
|
throw new M("Migration approvedDiff must have status 'approved'");
|
|
9653
9671
|
if (c.fromModelHash !== t.modelHash || c.toModelHash !== e.modelHash)
|
|
9654
9672
|
throw new M("Migration approvedDiff is stale: model hash does not match current database and code");
|
|
9655
|
-
const a = r || c, s = new Set(c.requiredDecisions.map(
|
|
9656
|
-
...a.requiredDecisions.map(
|
|
9673
|
+
const a = r || c, s = new Set(c.requiredDecisions.map(ot)), n = /* @__PURE__ */ new Set([
|
|
9674
|
+
...a.requiredDecisions.map(ot),
|
|
9657
9675
|
...s
|
|
9658
9676
|
]), o = new Set(a.changes.map(Ea)), l = /* @__PURE__ */ new Set();
|
|
9659
9677
|
for (const d of c.decisions) {
|
|
@@ -9678,14 +9696,14 @@ function Sa(c, t, e, i, r) {
|
|
|
9678
9696
|
throw new M(`Migration rename candidate decision does not match any Phase 1.5 executable review item: ${d.from} -> ${d.to}`);
|
|
9679
9697
|
}
|
|
9680
9698
|
for (const d of a.requiredDecisions)
|
|
9681
|
-
if (!l.has(
|
|
9682
|
-
throw new M(`Missing migration decision for required review item: ${
|
|
9699
|
+
if (!l.has(ot(d)))
|
|
9700
|
+
throw new M(`Missing migration decision for required review item: ${ot(d)}`);
|
|
9683
9701
|
const u = new Set(e.computations.map((d) => d.id));
|
|
9684
9702
|
for (const d of c.decisions)
|
|
9685
9703
|
if (d.kind === "computation" && !u.has(d.id))
|
|
9686
9704
|
throw new M(`Migration decision references unknown computation: ${d.id}`);
|
|
9687
9705
|
}
|
|
9688
|
-
function
|
|
9706
|
+
function Aa(c, t, e) {
|
|
9689
9707
|
const i = [], r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = new Map(t.computations.map((o) => [o.id, o]));
|
|
9690
9708
|
for (const o of e.decisions) {
|
|
9691
9709
|
if (o.kind !== "computation") continue;
|
|
@@ -9698,13 +9716,13 @@ function ka(c, t, e) {
|
|
|
9698
9716
|
const n = e.decisions.filter((o) => o.kind === "computation" && o.decision === "unrebuildable").map((o) => ({ kind: "unrebuildable-computation", logicalPath: o.dataContext, reason: o.reason }));
|
|
9699
9717
|
return { changedComputations: i, outputChangedIds: r, stateOnlyIds: a, blocking: n };
|
|
9700
9718
|
}
|
|
9701
|
-
function
|
|
9719
|
+
function Be(c) {
|
|
9702
9720
|
return new Map(Array.from(c.scheduler.computationsHandles.values()).map((t) => [re(t), t]));
|
|
9703
9721
|
}
|
|
9704
9722
|
function pe(c) {
|
|
9705
9723
|
return c.dataContext;
|
|
9706
9724
|
}
|
|
9707
|
-
function
|
|
9725
|
+
function Ca(c, t, e) {
|
|
9708
9726
|
return c.relations.find(
|
|
9709
9727
|
(i) => i.source === t && i.sourceProperty === e || i.target === t && i.targetProperty === e
|
|
9710
9728
|
);
|
|
@@ -9712,13 +9730,13 @@ function Aa(c, t, e) {
|
|
|
9712
9730
|
function Oi(c, t, e) {
|
|
9713
9731
|
return e.flatMap((i) => {
|
|
9714
9732
|
if (!Array.isArray(i) || typeof i[0] != "string") return [];
|
|
9715
|
-
const r =
|
|
9733
|
+
const r = Ca(c, t, i[0]);
|
|
9716
9734
|
if (!r) return [];
|
|
9717
9735
|
const a = r.source === t ? r.target : r.source, s = i[1], o = (Array.isArray(s?.attributeQuery) ? s.attributeQuery : []).flatMap((l) => typeof l == "string" && l !== "*" && l !== g ? [`property:${a}.${l}`] : Array.isArray(l) && l[0] === g ? [`relation:${r.name}`] : Array.isArray(l) ? Oi(c, a, [l]) : []);
|
|
9718
9736
|
return [`relation:${r.name}`, ...o];
|
|
9719
9737
|
});
|
|
9720
9738
|
}
|
|
9721
|
-
function
|
|
9739
|
+
function pi(c, t, e) {
|
|
9722
9740
|
if (c.type === "global" && c.source) return [`global:${c.source}`];
|
|
9723
9741
|
if (c.type === "records" && c.source) return [`entity:${c.source}`];
|
|
9724
9742
|
if (c.type === "property") {
|
|
@@ -9729,7 +9747,7 @@ function hi(c, t, e) {
|
|
|
9729
9747
|
}
|
|
9730
9748
|
return [];
|
|
9731
9749
|
}
|
|
9732
|
-
function
|
|
9750
|
+
function fi(c, t) {
|
|
9733
9751
|
const e = [`entity:${c.recordName}`];
|
|
9734
9752
|
if (c.type === "update") {
|
|
9735
9753
|
const i = t.records.find((r) => r.name === c.recordName);
|
|
@@ -9737,14 +9755,14 @@ function pi(c, t) {
|
|
|
9737
9755
|
}
|
|
9738
9756
|
return e;
|
|
9739
9757
|
}
|
|
9740
|
-
function
|
|
9758
|
+
function mi(c, t, e, i = [], r = {}) {
|
|
9741
9759
|
const a = new Map(t.computations.map((p) => [pe(p), p])), s = new Map(c.computations.map((p) => [p.id, p])), n = /* @__PURE__ */ new Map();
|
|
9742
9760
|
for (const p of t.computations) {
|
|
9743
9761
|
for (const y of p.deps)
|
|
9744
|
-
for (const b of
|
|
9762
|
+
for (const b of pi(y, p, t))
|
|
9745
9763
|
n.has(b) || n.set(b, /* @__PURE__ */ new Set()), n.get(b).add(p.id);
|
|
9746
9764
|
for (const y of p.eventDeps)
|
|
9747
|
-
for (const b of
|
|
9765
|
+
for (const b of fi(y, t))
|
|
9748
9766
|
b !== p.dataContext && (n.has(b) || n.set(b, /* @__PURE__ */ new Set()), n.get(b).add(p.id));
|
|
9749
9767
|
}
|
|
9750
9768
|
const o = new Set(e.map((p) => p.id)), u = [...e.filter((p) => {
|
|
@@ -9768,12 +9786,12 @@ function fi(c, t, e, i = [], r = {}) {
|
|
|
9768
9786
|
const y = t.computations.find((b) => b.id === p);
|
|
9769
9787
|
if (y) {
|
|
9770
9788
|
for (const b of y.deps)
|
|
9771
|
-
for (const v of
|
|
9789
|
+
for (const v of pi(b, y, t)) {
|
|
9772
9790
|
const N = a.get(v);
|
|
9773
9791
|
N && o.has(N.id) && m(N.id);
|
|
9774
9792
|
}
|
|
9775
9793
|
for (const b of y.eventDeps)
|
|
9776
|
-
for (const v of
|
|
9794
|
+
for (const v of fi(b, t)) {
|
|
9777
9795
|
if (v === y.dataContext) continue;
|
|
9778
9796
|
const N = a.get(v);
|
|
9779
9797
|
N && o.has(N.id) && m(N.id);
|
|
@@ -9796,7 +9814,7 @@ function fi(c, t, e, i = [], r = {}) {
|
|
|
9796
9814
|
function fe(c, t) {
|
|
9797
9815
|
return `${c || "?"}.${t || "?"}`;
|
|
9798
9816
|
}
|
|
9799
|
-
function
|
|
9817
|
+
function yi(c, t) {
|
|
9800
9818
|
const e = [], i = new Map(c.storage.records.map((l) => [l.recordName, l])), r = new Map(t.storage.records.map((l) => [l.recordName, l])), a = new Map(c.records.map((l) => [l.name, l])), s = new Map(t.records.map((l) => [l.name, l])), n = (l) => l.startsWith("_ASYNC_TASK__"), o = (l) => c.computations.some((u) => u.outputRecord === l);
|
|
9801
9819
|
for (const l of c.storage.records)
|
|
9802
9820
|
if (!r.has(l.recordName) && !l.isFiltered) {
|
|
@@ -9850,17 +9868,17 @@ function mi(c, t) {
|
|
|
9850
9868
|
}
|
|
9851
9869
|
return e;
|
|
9852
9870
|
}
|
|
9853
|
-
function
|
|
9871
|
+
function $a(c, t, e, i) {
|
|
9854
9872
|
const r = c.computations.find((a) => a.id === t && a.dataContext === e);
|
|
9855
9873
|
return r ? r.owner === "exclusive" && r.ownershipProof?.kind === "computed-output" && r.ownershipProof.owner === "exclusive" && r.ownershipProof.ownerComputationId === t && r.ownershipProof.dataContext === e && r.ownershipProof.outputRecord === r.outputRecord : !(i !== void 0 && (c.records.some((s) => s.name === i) || c.storage.records.some((s) => s.recordName === i)));
|
|
9856
9874
|
}
|
|
9857
|
-
function
|
|
9875
|
+
function Ia(c, t, e = {}, i) {
|
|
9858
9876
|
const r = [], a = new Set(t.map((s) => s.computationId));
|
|
9859
9877
|
for (const s of c.scheduler.computationsHandles.values()) {
|
|
9860
9878
|
const n = re(s);
|
|
9861
9879
|
if (!a.has(n)) continue;
|
|
9862
9880
|
const o = P(s.dataContext);
|
|
9863
|
-
if (s.dataContext.type === "property" && s.dataContext.id.name === _e && !
|
|
9881
|
+
if (s.dataContext.type === "property" && s.dataContext.id.name === _e && !Mi(e.approvedDiff, (l) => l.kind === "destructive-scope" && l.dataContext === o) && r.push({ kind: "destructive-computed-output", logicalPath: o, reason: "destructive computed output requires an approved destructive-scope decision" }), s.asyncReturn && !Di(e, o) && r.push({ kind: "async-computation", logicalPath: o, reason: "async computation requires an approved async-completion-handler decision and runtime handler" }), (s.dataContext.type === "entity" || s.dataContext.type === "relation") && !s.compute && r.push({ kind: "unrebuildable-computation", logicalPath: o, reason: "entity/relation output lacks a full compute contract" }), s.dataContext.type === "entity" || s.dataContext.type === "relation") {
|
|
9864
9882
|
const l = s.state?.sourceRecordId?.key, u = s.state?.transformIndex?.key;
|
|
9865
9883
|
(!l || !u || typeof s.eventDeps == "object") && r.push({
|
|
9866
9884
|
kind: "unrebuildable-computation",
|
|
@@ -9868,7 +9886,7 @@ function $a(c, t, e = {}, i) {
|
|
|
9868
9886
|
reason: "entity/relation output migration requires a data-based Transform with sourceRecordId and transformIndex state"
|
|
9869
9887
|
});
|
|
9870
9888
|
}
|
|
9871
|
-
(s.dataContext.type === "entity" || s.dataContext.type === "relation") && i &&
|
|
9889
|
+
(s.dataContext.type === "entity" || s.dataContext.type === "relation") && i && !$a(i, n, o, s.dataContext.id.name) && r.push({
|
|
9872
9890
|
kind: "destructive-computed-output",
|
|
9873
9891
|
logicalPath: o,
|
|
9874
9892
|
reason: "entity/relation output replacement requires exclusive output ownership proof in the previous manifest"
|
|
@@ -9877,7 +9895,7 @@ function $a(c, t, e = {}, i) {
|
|
|
9877
9895
|
return r;
|
|
9878
9896
|
}
|
|
9879
9897
|
async function Te(c, t, e) {
|
|
9880
|
-
const i =
|
|
9898
|
+
const i = Be(c), r = [], a = async (s) => {
|
|
9881
9899
|
if (c.system.storage.queryHandle)
|
|
9882
9900
|
return c.system.storage.find(s, void 0, void 0, ["*"]);
|
|
9883
9901
|
if (!e) return;
|
|
@@ -9935,17 +9953,17 @@ function Fi(c, t) {
|
|
|
9935
9953
|
throw new St(`Destructive migration scope mismatch for ${s.dataContext}`);
|
|
9936
9954
|
}
|
|
9937
9955
|
}
|
|
9938
|
-
function
|
|
9956
|
+
function gi(c, t) {
|
|
9939
9957
|
const e = new Set(c.storage.records.filter((i) => i.isFiltered).map((i) => i.recordName));
|
|
9940
9958
|
return t.storage.records.filter((i) => i.isFiltered && !e.has(i.recordName)).map((i) => `entity:${i.recordName}`);
|
|
9941
9959
|
}
|
|
9942
|
-
function
|
|
9960
|
+
function xa(c) {
|
|
9943
9961
|
return c.map((t) => {
|
|
9944
9962
|
const e = t.oldPhysicalPath || t.newPhysicalPath ? ` (${t.oldPhysicalPath || "?"} -> ${t.newPhysicalPath || "?"})` : "";
|
|
9945
9963
|
return `${t.kind}: ${t.logicalPath}${e}: ${t.reason}`;
|
|
9946
9964
|
});
|
|
9947
9965
|
}
|
|
9948
|
-
async function
|
|
9966
|
+
async function bi(c) {
|
|
9949
9967
|
const t = c.system;
|
|
9950
9968
|
return t.readMigrationManifest ? t.readMigrationManifest() : c.system.storage.get(Le, qe);
|
|
9951
9969
|
}
|
|
@@ -9958,10 +9976,10 @@ async function me(c, t) {
|
|
|
9958
9976
|
await c.system.storage.set(Le, qe, t);
|
|
9959
9977
|
}
|
|
9960
9978
|
function Yt(c, t) {
|
|
9961
|
-
return
|
|
9979
|
+
return ft(c) === ft(t);
|
|
9962
9980
|
}
|
|
9963
|
-
async function
|
|
9964
|
-
const a =
|
|
9981
|
+
async function Ue(c, t, e, i, r = {}) {
|
|
9982
|
+
const a = Di(r, P(t.dataContext));
|
|
9965
9983
|
if (!a)
|
|
9966
9984
|
throw new Ve(`Migration cannot treat async task creation as completion for ${P(t.dataContext)}`);
|
|
9967
9985
|
return a({
|
|
@@ -9973,16 +9991,16 @@ async function Be(c, t, e, i, r = {}) {
|
|
|
9973
9991
|
});
|
|
9974
9992
|
}
|
|
9975
9993
|
async function et(c, t, e, i, r = {}) {
|
|
9976
|
-
if (e instanceof
|
|
9977
|
-
if (e instanceof Vt && (e = await
|
|
9994
|
+
if (e instanceof pt) return;
|
|
9995
|
+
if (e instanceof Vt && (e = await Ue(c, t, e, i, r)), e instanceof ee)
|
|
9978
9996
|
throw new Ve(`Migration requires direct final output, not asyncReturn resolution, for ${P(t.dataContext)}`);
|
|
9979
9997
|
const a = await c.retrieveLastValue(t.dataContext, i);
|
|
9980
9998
|
if (!Yt(a, e))
|
|
9981
9999
|
return await c.applyResult(t.dataContext, e, i), Li(t.dataContext, e, a, i);
|
|
9982
10000
|
}
|
|
9983
|
-
async function
|
|
9984
|
-
if (e instanceof
|
|
9985
|
-
if (e instanceof Vt && (e = await
|
|
10001
|
+
async function Ma(c, t, e, i, r = {}) {
|
|
10002
|
+
if (e instanceof pt || e === void 0) return [];
|
|
10003
|
+
if (e instanceof Vt && (e = await Ue(c, t, e, i, r)), e instanceof ee)
|
|
9986
10004
|
throw new Ve(`Migration requires direct final output for ${P(t.dataContext)}`);
|
|
9987
10005
|
const a = Array.isArray(e) ? e : [e], s = [];
|
|
9988
10006
|
for (const n of a) {
|
|
@@ -10027,10 +10045,10 @@ function Li(c, t, e, i) {
|
|
|
10027
10045
|
keys: [c.id.name]
|
|
10028
10046
|
};
|
|
10029
10047
|
}
|
|
10030
|
-
async function
|
|
10048
|
+
async function Pa(c, t, e = {}) {
|
|
10031
10049
|
if (t.dataContext.type !== "entity" && t.dataContext.type !== "relation") return [];
|
|
10032
10050
|
let i = await t.compute(await c.scheduler.resolveDataDeps(t));
|
|
10033
|
-
if (i instanceof Vt && (i = await
|
|
10051
|
+
if (i instanceof Vt && (i = await Ue(c, t, i, void 0, e)), !Array.isArray(i))
|
|
10034
10052
|
throw new Tt(`Entity/relation migration compute must return an array for ${P(t.dataContext)}`);
|
|
10035
10053
|
const r = t.dataContext.id.name, a = t.state?.sourceRecordId?.key, s = t.state?.transformIndex?.key;
|
|
10036
10054
|
if (!a || !s)
|
|
@@ -10055,12 +10073,12 @@ async function Ma(c, t, e = {}) {
|
|
|
10055
10073
|
}
|
|
10056
10074
|
return l;
|
|
10057
10075
|
}
|
|
10058
|
-
async function
|
|
10059
|
-
return Fi(e, await Te(c, t, r)), new
|
|
10076
|
+
async function Da(c, t, e = {}, i = [], r) {
|
|
10077
|
+
return Fi(e, await Te(c, t, r)), new Oa(c, t, e, i).run();
|
|
10060
10078
|
}
|
|
10061
|
-
class
|
|
10079
|
+
class Oa {
|
|
10062
10080
|
constructor(t, e, i = {}, r = []) {
|
|
10063
|
-
this.controller = t, this.rebuildPlan = e, this.options = i, this.initialEvents = r, this.handles =
|
|
10081
|
+
this.controller = t, this.rebuildPlan = e, this.options = i, this.initialEvents = r, this.handles = Be(this.controller), this.sourceMapManager = new $i(this.controller, this.controller.scheduler), this.affectedIds = new Set(this.rebuildPlan.map((a) => a.computationId)), this.pendingEventsByComputation = /* @__PURE__ */ new Map(), this.sourceMapManager.initialize(new Set(
|
|
10064
10082
|
Array.from(this.handles.entries()).filter(([a]) => this.affectedIds.has(a)).map(([, a]) => a)
|
|
10065
10083
|
));
|
|
10066
10084
|
}
|
|
@@ -10070,7 +10088,7 @@ class Da {
|
|
|
10070
10088
|
for (const e of this.rebuildPlan) {
|
|
10071
10089
|
const i = this.handles.get(e.computationId);
|
|
10072
10090
|
if (!i) continue;
|
|
10073
|
-
if (i.dataContext.type === "property" && i.dataContext.id.name === _e && !
|
|
10091
|
+
if (i.dataContext.type === "property" && i.dataContext.id.name === _e && !Mi(this.options.approvedDiff, (s) => s.kind === "destructive-scope" && s.dataContext === P(i.dataContext)))
|
|
10074
10092
|
throw new St(`Migration refuses to recompute destructive property ${P(i.dataContext)} without approved destructive scope`);
|
|
10075
10093
|
if (typeof i.compute != "function" && !Gt(this.options, P(i.dataContext)))
|
|
10076
10094
|
throw new Tt(`Migration requires full compute support for ${P(i.dataContext)}`);
|
|
@@ -10111,7 +10129,7 @@ class Da {
|
|
|
10111
10129
|
return n ? [n] : [];
|
|
10112
10130
|
}
|
|
10113
10131
|
if (t.dataContext.type === "entity" || t.dataContext.type === "relation")
|
|
10114
|
-
return
|
|
10132
|
+
return Pa(this.controller, t, this.options);
|
|
10115
10133
|
const i = t.dataContext.host.name, r = await this.controller.system.storage.find(i, void 0, void 0, ["*"]), a = [];
|
|
10116
10134
|
for (const s of r) {
|
|
10117
10135
|
const n = await t.compute(
|
|
@@ -10164,7 +10182,7 @@ class Da {
|
|
|
10164
10182
|
const n = await et(this.controller, t, a, i, this.options);
|
|
10165
10183
|
return n ? [n] : [];
|
|
10166
10184
|
}
|
|
10167
|
-
return
|
|
10185
|
+
return Ma(this.controller, t, a, i, this.options);
|
|
10168
10186
|
}
|
|
10169
10187
|
if (t.incrementalCompute) {
|
|
10170
10188
|
const n = t.useLastValue ? await this.controller.retrieveLastValue(t.dataContext, i) : void 0;
|
|
@@ -10175,7 +10193,7 @@ class Da {
|
|
|
10175
10193
|
return s ? [s] : [];
|
|
10176
10194
|
}
|
|
10177
10195
|
}
|
|
10178
|
-
async function
|
|
10196
|
+
async function Fa(c, t, e) {
|
|
10179
10197
|
const i = new Set(t.storage.records.filter((s) => s.isFiltered).map((s) => s.recordName)), r = e.storage.records.filter((s) => s.isFiltered && !i.has(s.recordName)), a = [];
|
|
10180
10198
|
for (const s of r) {
|
|
10181
10199
|
const n = s.resolvedBaseRecordName;
|
|
@@ -10201,7 +10219,7 @@ async function Oa(c, t, e) {
|
|
|
10201
10219
|
}
|
|
10202
10220
|
return a;
|
|
10203
10221
|
}
|
|
10204
|
-
const
|
|
10222
|
+
const Is = "User";
|
|
10205
10223
|
class qi {
|
|
10206
10224
|
constructor(t) {
|
|
10207
10225
|
this.name = t.name, this.record = t.record, this.content = t.content;
|
|
@@ -10210,7 +10228,7 @@ class qi {
|
|
|
10210
10228
|
return new qi(t);
|
|
10211
10229
|
}
|
|
10212
10230
|
}
|
|
10213
|
-
const Se = "_isDeleted_",
|
|
10231
|
+
const Se = "_isDeleted_", wi = new Ri(), xs = {
|
|
10214
10232
|
create() {
|
|
10215
10233
|
return T.create({
|
|
10216
10234
|
name: Se,
|
|
@@ -10218,7 +10236,7 @@ const Se = "_isDeleted_", bi = new wi(), Is = {
|
|
|
10218
10236
|
});
|
|
10219
10237
|
}
|
|
10220
10238
|
};
|
|
10221
|
-
class
|
|
10239
|
+
class Ms {
|
|
10222
10240
|
constructor(t) {
|
|
10223
10241
|
this.recordNameToSideEffects = /* @__PURE__ */ new Map(), this.globals = {
|
|
10224
10242
|
BoolExp: E,
|
|
@@ -10272,7 +10290,7 @@ class xs {
|
|
|
10272
10290
|
const s = this.system, n = s.prepareMigrationSchema;
|
|
10273
10291
|
if (typeof n != "function")
|
|
10274
10292
|
throw new Error("Current system does not support migration manifest validation");
|
|
10275
|
-
const o = await n.call(s, this.entities, this.relations, r), l = jt(this, o.schema), u = await
|
|
10293
|
+
const o = await n.call(s, this.entities, this.relations, r), l = jt(this, o.schema), u = await bi(this);
|
|
10276
10294
|
if (u && u.modelHash !== l.modelHash)
|
|
10277
10295
|
throw new Error(`Model manifest mismatch. Call controller.generateMigrationDiff(), review it, then call controller.migrate({ approvedDiff }). Manifest key: ${Le}/${qe}`);
|
|
10278
10296
|
if (!u && await this.system.hasExistingData?.())
|
|
@@ -10299,7 +10317,7 @@ class xs {
|
|
|
10299
10317
|
async prepareMigrationContext(t = {}) {
|
|
10300
10318
|
const e = this.scheduler.createStates(), i = this.system;
|
|
10301
10319
|
C(typeof i.prepareMigrationSchema == "function", "Current system does not support schema migration planning");
|
|
10302
|
-
const r = await i.prepareMigrationSchema(this.entities, this.relations, e), a = await
|
|
10320
|
+
const r = await i.prepareMigrationSchema(this.entities, this.relations, e), a = await bi(this);
|
|
10303
10321
|
if (!a)
|
|
10304
10322
|
throw new he("Migration baseline manifest not found. Run setup(true) with the current framework first or createMigrationBaseline().");
|
|
10305
10323
|
const s = jt(this, r.schema, { includeFunctionText: t.includeFunctionText === !0 });
|
|
@@ -10308,20 +10326,20 @@ class xs {
|
|
|
10308
10326
|
async buildCurrentMigrationDiff(t, e, i, r = {}) {
|
|
10309
10327
|
const a = i.computations.filter(
|
|
10310
10328
|
(h) => !e.computations.some((f) => f.id === h.id && f.signature === h.signature)
|
|
10311
|
-
), s =
|
|
10329
|
+
), s = gi(e, i), n = mi(
|
|
10312
10330
|
e,
|
|
10313
10331
|
i,
|
|
10314
10332
|
a,
|
|
10315
10333
|
s,
|
|
10316
10334
|
{ outputChangedIds: new Set(a.map((h) => h.id)) }
|
|
10317
|
-
), o =
|
|
10335
|
+
), o = yi(e, i), l = r.includeDestructiveScope === !0 ? await Te(this, n, e) : [], u = {
|
|
10318
10336
|
blockingChanges: [
|
|
10319
10337
|
...t.blockingChanges,
|
|
10320
10338
|
...o
|
|
10321
10339
|
],
|
|
10322
10340
|
destructiveScopes: l
|
|
10323
|
-
};
|
|
10324
|
-
return
|
|
10341
|
+
}, d = Ta(e, i, t, u);
|
|
10342
|
+
return Sa(d, this, n);
|
|
10325
10343
|
}
|
|
10326
10344
|
async generateMigrationDiff(t = {}) {
|
|
10327
10345
|
const { schemaPlan: e, previousManifest: i, nextManifest: r } = await this.prepareMigrationContext({
|
|
@@ -10333,11 +10351,11 @@ class xs {
|
|
|
10333
10351
|
const e = { ...t }, i = await this.prepareMigrationContext(), r = i.migrationSystem;
|
|
10334
10352
|
C(typeof r.applyMigrationSchema == "function", "Current system does not support schema migration application");
|
|
10335
10353
|
const { schemaPlan: a, previousManifest: s, nextManifest: n } = i, o = await this.buildCurrentMigrationDiff(a, s, n, { includeDestructiveScope: !1 });
|
|
10336
|
-
|
|
10337
|
-
const l = e.approvedDiff, u = ma(l), d =
|
|
10354
|
+
ka(e.approvedDiff, s, n, e.handlers, o);
|
|
10355
|
+
const l = e.approvedDiff, u = ma(l), d = Aa(s, n, l), h = d.changedComputations, f = gi(s, n), m = mi(s, n, h, f, {
|
|
10338
10356
|
outputChangedIds: d.outputChangedIds,
|
|
10339
10357
|
stateOnlyIds: d.stateOnlyIds
|
|
10340
|
-
}), p =
|
|
10358
|
+
}), p = yi(s, n), y = Ia(
|
|
10341
10359
|
this,
|
|
10342
10360
|
m,
|
|
10343
10361
|
e,
|
|
@@ -10347,7 +10365,7 @@ class xs {
|
|
|
10347
10365
|
...p,
|
|
10348
10366
|
...d.blocking,
|
|
10349
10367
|
...y
|
|
10350
|
-
], v =
|
|
10368
|
+
], v = xa(b), N = await Te(this, m, s);
|
|
10351
10369
|
Fi(e, N);
|
|
10352
10370
|
const I = {
|
|
10353
10371
|
mode: "compute",
|
|
@@ -10372,8 +10390,8 @@ ${v.join(`
|
|
|
10372
10390
|
`)}`);
|
|
10373
10391
|
let S;
|
|
10374
10392
|
const W = (V, tt) => {
|
|
10375
|
-
const
|
|
10376
|
-
return
|
|
10393
|
+
const wt = ["pending", "schema-applied", "computation-applied", "constraints-applied", "manifest-written", "succeeded"];
|
|
10394
|
+
return wt.indexOf(V) >= wt.indexOf(tt);
|
|
10377
10395
|
};
|
|
10378
10396
|
try {
|
|
10379
10397
|
S = await r.beginMigration?.(
|
|
@@ -10385,8 +10403,8 @@ ${v.join(`
|
|
|
10385
10403
|
const V = S?.phase || "pending";
|
|
10386
10404
|
W(V, "schema-applied") || (await r.applyMigrationSchema(a, S?.id), S && await r.updateMigrationPhase?.(S.id, "schema-applied")), W(V, "manifest-written") || await this.system.storage.runInTransaction({ name: "migration recompute", isolation: "SERIALIZABLE" }, async () => {
|
|
10387
10405
|
if (!W(V, "computation-applied")) {
|
|
10388
|
-
const ne = await
|
|
10389
|
-
await
|
|
10406
|
+
const ne = await Fa(this, s, n);
|
|
10407
|
+
await Da(this, m, e, ne, s), S && await r.updateMigrationPhase?.(S.id, "computation-applied");
|
|
10390
10408
|
}
|
|
10391
10409
|
W(V, "constraints-applied") || (await r.verifyMigrationSchema?.(a, S?.id), await r.applyMigrationPostSchema?.(a, S?.id), S && await r.updateMigrationPhase?.(S.id, "constraints-applied"));
|
|
10392
10410
|
const tt = `manifest:current:${n.modelHash}:${u}`;
|
|
@@ -10408,7 +10426,7 @@ ${v.join(`
|
|
|
10408
10426
|
}
|
|
10409
10427
|
}
|
|
10410
10428
|
async applyResult(t, e, i) {
|
|
10411
|
-
if (!(e instanceof
|
|
10429
|
+
if (!(e instanceof pt)) {
|
|
10412
10430
|
if (t.type === "global")
|
|
10413
10431
|
return this.system.storage.dict.set(t.id.name, e);
|
|
10414
10432
|
if (t.type === "entity") {
|
|
@@ -10436,7 +10454,7 @@ ${v.join(`
|
|
|
10436
10454
|
}
|
|
10437
10455
|
}
|
|
10438
10456
|
async applyResultPatch(t, e, i) {
|
|
10439
|
-
if (e instanceof
|
|
10457
|
+
if (e instanceof pt || e === void 0) return;
|
|
10440
10458
|
const r = Array.isArray(e) ? e : [e];
|
|
10441
10459
|
for (const a of r)
|
|
10442
10460
|
if (t.type === "global")
|
|
@@ -10476,7 +10494,7 @@ ${v.join(`
|
|
|
10476
10494
|
*/
|
|
10477
10495
|
async dispatch(t, e) {
|
|
10478
10496
|
C(!!t, "eventSource is required for dispatch");
|
|
10479
|
-
const i =
|
|
10497
|
+
const i = wi.getStore();
|
|
10480
10498
|
if (i)
|
|
10481
10499
|
throw new Br({
|
|
10482
10500
|
outerEventSourceName: i.eventSourceName,
|
|
@@ -10486,7 +10504,7 @@ ${v.join(`
|
|
|
10486
10504
|
try {
|
|
10487
10505
|
r = await De(t.name || "dispatch", async (a) => {
|
|
10488
10506
|
const s = this.cloneDispatchArgs(e), n = { effects: [] };
|
|
10489
|
-
return Fe.run(n, async () => this.system.storage.runInTransaction({ name: t.name, isolation: a }, async () =>
|
|
10507
|
+
return Fe.run(n, async () => this.system.storage.runInTransaction({ name: t.name, isolation: a }, async () => wi.run({ eventSourceName: t.name }, async () => {
|
|
10490
10508
|
!this.ignoreGuard && t.guard && await t.guard.call(this, s);
|
|
10491
10509
|
const o = t.mapEventData ? await t.mapEventData(s) : {};
|
|
10492
10510
|
await this.system.storage.create(t.entity.name, o);
|
|
@@ -10522,7 +10540,7 @@ ${v.join(`
|
|
|
10522
10540
|
...a
|
|
10523
10541
|
});
|
|
10524
10542
|
} catch (a) {
|
|
10525
|
-
const s = new
|
|
10543
|
+
const s = new di(
|
|
10526
10544
|
`Post-commit hook '${t.name}' failed`,
|
|
10527
10545
|
{
|
|
10528
10546
|
sideEffectName: t.name,
|
|
@@ -10549,7 +10567,7 @@ ${v.join(`
|
|
|
10549
10567
|
result: await s.content.call(this, r)
|
|
10550
10568
|
};
|
|
10551
10569
|
} catch (n) {
|
|
10552
|
-
const o = new
|
|
10570
|
+
const o = new di(
|
|
10553
10571
|
`Side effect '${s.name}' failed for ${r.type} on ${r.recordName}`,
|
|
10554
10572
|
{
|
|
10555
10573
|
sideEffectName: s.name,
|
|
@@ -10578,20 +10596,20 @@ ${v.join(`
|
|
|
10578
10596
|
return this.eventSourcesByName.get(t);
|
|
10579
10597
|
}
|
|
10580
10598
|
}
|
|
10581
|
-
function
|
|
10599
|
+
function La(c) {
|
|
10582
10600
|
return encodeURI(JSON.stringify(c));
|
|
10583
10601
|
}
|
|
10584
|
-
function
|
|
10602
|
+
function qa(c) {
|
|
10585
10603
|
return c === void 0 ? void 0 : JSON.parse(decodeURI(c));
|
|
10586
10604
|
}
|
|
10587
|
-
class
|
|
10605
|
+
class _a {
|
|
10588
10606
|
constructor(t) {
|
|
10589
10607
|
this.db = t, this.constraintSchemaItems = [], this.schema = {
|
|
10590
10608
|
dialect: Q(),
|
|
10591
10609
|
records: [],
|
|
10592
10610
|
tables: [],
|
|
10593
10611
|
constraints: []
|
|
10594
|
-
}, this.transactionContext = new
|
|
10612
|
+
}, this.transactionContext = new Ri(), this.callbacks = /* @__PURE__ */ new Set(), this.dict = {
|
|
10595
10613
|
get: async (e) => {
|
|
10596
10614
|
const i = w.atom({ key: "key", value: ["=", e] });
|
|
10597
10615
|
return (await this.queryHandle.findOne(K, i, void 0, ["value"]))?.value?.raw;
|
|
@@ -10691,18 +10709,18 @@ class qa {
|
|
|
10691
10709
|
}
|
|
10692
10710
|
// CAUTION kv 结构数据的实现也用 er。这是系统约定,因为也需要 Record 事件!
|
|
10693
10711
|
async get(t, e, i) {
|
|
10694
|
-
const r = w.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), a = (await this.queryHandle.findOne(
|
|
10695
|
-
return a === void 0 ? i :
|
|
10712
|
+
const r = w.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] }), a = (await this.queryHandle.findOne(Rt, r, void 0, ["value"]))?.value;
|
|
10713
|
+
return a === void 0 ? i : qa(a);
|
|
10696
10714
|
}
|
|
10697
10715
|
async set(t, e, i, r) {
|
|
10698
10716
|
const a = w.atom({ key: "key", value: ["=", e] }).and({ key: "concept", value: ["=", t] });
|
|
10699
|
-
return await this.queryHandle.findOne(
|
|
10717
|
+
return await this.queryHandle.findOne(Rt, a, void 0, ["value"]) ? this.callWithEvents(this.queryHandle.update.bind(this.queryHandle), [Rt, a, { concept: t, key: e.toString(), value: La(i) }], r) : this.callWithEvents(this.queryHandle.create.bind(this.queryHandle), [Rt, { concept: t, key: e.toString(), value: encodeURI(JSON.stringify(i)) }], r);
|
|
10700
10718
|
}
|
|
10701
10719
|
async setup(t, e, i = !1) {
|
|
10702
10720
|
await this.db.open(i), i && this.db.setupInternalComputationState && await this.db.setupInternalComputationState();
|
|
10703
10721
|
let r;
|
|
10704
10722
|
try {
|
|
10705
|
-
r = new
|
|
10723
|
+
r = new ai(
|
|
10706
10724
|
t,
|
|
10707
10725
|
e,
|
|
10708
10726
|
this.db
|
|
@@ -10717,7 +10735,7 @@ class qa {
|
|
|
10717
10735
|
);
|
|
10718
10736
|
}
|
|
10719
10737
|
if (i && await r.createTables(), await this.createConstraints(r), this.db.setupRecordSequences) {
|
|
10720
|
-
const a = new
|
|
10738
|
+
const a = new dt(r.map, r.aliasManager);
|
|
10721
10739
|
await this.db.setupRecordSequences(Object.keys(r.map.records).map((s) => {
|
|
10722
10740
|
const n = a.getRecordInfo(s), o = n.idField;
|
|
10723
10741
|
if (!o)
|
|
@@ -10729,13 +10747,13 @@ class qa {
|
|
|
10729
10747
|
};
|
|
10730
10748
|
}));
|
|
10731
10749
|
}
|
|
10732
|
-
this.queryHandle = new
|
|
10750
|
+
this.queryHandle = new ei(new dt(r.map, r.aliasManager), this.db), this.map = r.map, this.constraintSchemaItems = r.constraintSchemaItems, this.schema = this.createSchemaMetadata(r);
|
|
10733
10751
|
}
|
|
10734
10752
|
async prepareMigrationAdditive(t, e) {
|
|
10735
10753
|
await this.ensureDbOpenForSchemaRead(), this.db.setupInternalComputationState;
|
|
10736
10754
|
let i;
|
|
10737
10755
|
try {
|
|
10738
|
-
i = new
|
|
10756
|
+
i = new ai(
|
|
10739
10757
|
t,
|
|
10740
10758
|
e,
|
|
10741
10759
|
this.db
|
|
@@ -10796,7 +10814,7 @@ class qa {
|
|
|
10796
10814
|
async applyMigrationAdditivePlan(t, e) {
|
|
10797
10815
|
const i = t.internal.dbSetup;
|
|
10798
10816
|
if (await this.db.open(!1), this.db.setupInternalComputationState && await this.db.setupInternalComputationState(), await this.applyMigrationOperations("schema", t.preRecomputeDDL, e), this.db.setupRecordSequences) {
|
|
10799
|
-
const r = new
|
|
10817
|
+
const r = new dt(i.map, i.aliasManager);
|
|
10800
10818
|
await this.db.setupRecordSequences(Object.keys(i.map.records).map((a) => {
|
|
10801
10819
|
const s = r.getRecordInfo(a), n = s.idField;
|
|
10802
10820
|
if (!n)
|
|
@@ -10808,7 +10826,7 @@ class qa {
|
|
|
10808
10826
|
};
|
|
10809
10827
|
}));
|
|
10810
10828
|
}
|
|
10811
|
-
this.queryHandle = new
|
|
10829
|
+
this.queryHandle = new ei(new dt(i.map, i.aliasManager), this.db), this.map = i.map, this.constraintSchemaItems = i.constraintSchemaItems, this.schema = this.createSchemaMetadata(i);
|
|
10812
10830
|
}
|
|
10813
10831
|
async applyPostRecomputeSchemaPlan(t, e) {
|
|
10814
10832
|
await this.applyMigrationOperations("constraints", t.postRecomputeDDL, e);
|
|
@@ -11159,9 +11177,9 @@ RETURNING "numberValue" AS value`,
|
|
|
11159
11177
|
compareAndSet: async (e, i, r, a) => {
|
|
11160
11178
|
const s = this.getPlaceholder(), n = a?.defaultValue;
|
|
11161
11179
|
if (this.isRecordTarget(e)) {
|
|
11162
|
-
const { tableName: S, idField: W, fieldName: V } = this.resolveRecordTarget(e), tt = s(),
|
|
11180
|
+
const { tableName: S, idField: W, fieldName: V } = this.resolveRecordTarget(e), tt = s(), wt = s(), ne = s(), ji = s();
|
|
11163
11181
|
return (await this.db.query(
|
|
11164
|
-
`UPDATE "${S}" SET "${V}" = ${tt} WHERE "${W}" = ${
|
|
11182
|
+
`UPDATE "${S}" SET "${V}" = ${tt} WHERE "${W}" = ${wt} AND COALESCE("${V}", ${ne}) = ${ji} RETURNING "${V}" AS value`,
|
|
11165
11183
|
[r, e.id, n, i],
|
|
11166
11184
|
`atomic compareAndSet ${e.recordName}.${e.field}`
|
|
11167
11185
|
)).length > 0;
|
|
@@ -11267,7 +11285,7 @@ RETURNING "numberValue" AS value`,
|
|
|
11267
11285
|
const i = le(t, this.db);
|
|
11268
11286
|
if (!i.isUniqueViolation) return t;
|
|
11269
11287
|
const r = this.findConstraintForError(t);
|
|
11270
|
-
return new
|
|
11288
|
+
return new xi(
|
|
11271
11289
|
r ? `Unique constraint "${r.constraintName}" was violated` : "Unique constraint was violated",
|
|
11272
11290
|
{
|
|
11273
11291
|
kind: "unique",
|
|
@@ -11288,7 +11306,7 @@ RETURNING "numberValue" AS value`,
|
|
|
11288
11306
|
const r = [], a = await t(...e, r), s = await this.dispatch(r);
|
|
11289
11307
|
i.push(...r, ...s);
|
|
11290
11308
|
const n = pa();
|
|
11291
|
-
return n && r.length > 0 &&
|
|
11309
|
+
return n && r.length > 0 && hi(r), n && s.length > 0 && hi(s), a;
|
|
11292
11310
|
} catch (r) {
|
|
11293
11311
|
throw this.mapConstraintError(r);
|
|
11294
11312
|
}
|
|
@@ -11329,8 +11347,8 @@ RETURNING "numberValue" AS value`,
|
|
|
11329
11347
|
return this.db.close();
|
|
11330
11348
|
}
|
|
11331
11349
|
}
|
|
11332
|
-
var
|
|
11333
|
-
class
|
|
11350
|
+
var Va = /* @__PURE__ */ ((c) => (c[c.ERROR = 0] = "ERROR", c[c.INFO = 1] = "INFO", c))(Va || {});
|
|
11351
|
+
class He {
|
|
11334
11352
|
constructor(t = 0) {
|
|
11335
11353
|
this.level = t;
|
|
11336
11354
|
}
|
|
@@ -11341,11 +11359,11 @@ class Ue {
|
|
|
11341
11359
|
this.level >= 0 && console.error({ type: t, name: e, sql: i, params: r, error: a });
|
|
11342
11360
|
}
|
|
11343
11361
|
child() {
|
|
11344
|
-
return new
|
|
11362
|
+
return new He(this.level);
|
|
11345
11363
|
}
|
|
11346
11364
|
}
|
|
11347
|
-
var
|
|
11348
|
-
class
|
|
11365
|
+
var Qa = /* @__PURE__ */ ((c) => (c[c.MUTE = -1] = "MUTE", c[c.ERROR = 0] = "ERROR", c[c.INFO = 1] = "INFO", c[c.DEBUG = 2] = "DEBUG", c))(Qa || {});
|
|
11366
|
+
class je {
|
|
11349
11367
|
constructor(t = 0) {
|
|
11350
11368
|
this.level = t;
|
|
11351
11369
|
}
|
|
@@ -11359,13 +11377,13 @@ class He {
|
|
|
11359
11377
|
this.level >= 2 && console.debug(`[DEBUG] ${t}: ${e}`, i);
|
|
11360
11378
|
}
|
|
11361
11379
|
child(t) {
|
|
11362
|
-
return new
|
|
11380
|
+
return new je(this.level);
|
|
11363
11381
|
}
|
|
11364
11382
|
}
|
|
11365
|
-
const
|
|
11366
|
-
class
|
|
11367
|
-
constructor(t, e =
|
|
11368
|
-
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new
|
|
11383
|
+
const Ps = new He(), Ba = new je();
|
|
11384
|
+
class Ds {
|
|
11385
|
+
constructor(t, e = Ba) {
|
|
11386
|
+
this.logger = e, this.conceptClass = /* @__PURE__ */ new Map(), this.storage = new _a(t);
|
|
11369
11387
|
}
|
|
11370
11388
|
get db() {
|
|
11371
11389
|
return this.storage.db;
|
|
@@ -11532,7 +11550,7 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11532
11550
|
}
|
|
11533
11551
|
});
|
|
11534
11552
|
}), await this.storage.setup(
|
|
11535
|
-
[...s,
|
|
11553
|
+
[...s, ci, oi],
|
|
11536
11554
|
n,
|
|
11537
11555
|
r
|
|
11538
11556
|
), await this.setupTransformUniqueIndexes(i);
|
|
@@ -11564,7 +11582,7 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11564
11582
|
}
|
|
11565
11583
|
});
|
|
11566
11584
|
}), {
|
|
11567
|
-
entities: [...a,
|
|
11585
|
+
entities: [...a, ci, oi],
|
|
11568
11586
|
relations: s
|
|
11569
11587
|
};
|
|
11570
11588
|
}
|
|
@@ -11612,7 +11630,7 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11612
11630
|
createTransformUniqueIndexOperations(t, e) {
|
|
11613
11631
|
const i = t.internal.dbSetup;
|
|
11614
11632
|
if (!i) return [];
|
|
11615
|
-
const r = new
|
|
11633
|
+
const r = new dt(i.map, i.aliasManager), a = Q(this.storage.db);
|
|
11616
11634
|
return e.flatMap(({ dataContext: s, state: n }) => {
|
|
11617
11635
|
const o = n.sourceRecordId, l = n.transformIndex;
|
|
11618
11636
|
if (!(o instanceof $) || !(l instanceof $) || o.unique === !1 || s.type !== "entity" && s.type !== "relation")
|
|
@@ -11631,7 +11649,7 @@ CREATE TABLE IF NOT EXISTS "__interaqt_migration_operation_log" (
|
|
|
11631
11649
|
await this.storage.destroy();
|
|
11632
11650
|
}
|
|
11633
11651
|
}
|
|
11634
|
-
const
|
|
11652
|
+
const Os = new Ni();
|
|
11635
11653
|
class ae {
|
|
11636
11654
|
constructor(t, e) {
|
|
11637
11655
|
this._type = "Action", this._options = e, this.uuid = A(e), this.name = t.name;
|
|
@@ -11686,7 +11704,7 @@ class ae {
|
|
|
11686
11704
|
return this.create(e.public, e.options);
|
|
11687
11705
|
}
|
|
11688
11706
|
}
|
|
11689
|
-
const
|
|
11707
|
+
const Ua = ae.create({ name: "get" });
|
|
11690
11708
|
function ke(c) {
|
|
11691
11709
|
if (!c) return;
|
|
11692
11710
|
if (c.raw.type === "atom")
|
|
@@ -11756,7 +11774,7 @@ class se {
|
|
|
11756
11774
|
return this.create(e.public, e.options);
|
|
11757
11775
|
}
|
|
11758
11776
|
}
|
|
11759
|
-
class
|
|
11777
|
+
class bt {
|
|
11760
11778
|
constructor(t, e) {
|
|
11761
11779
|
this._type = "Attributive", this._options = e, this.uuid = A(e), this.stringContent = t.stringContent, this.content = t.content, this.name = t.name, this.isRef = t.isRef;
|
|
11762
11780
|
}
|
|
@@ -11788,7 +11806,7 @@ class gt {
|
|
|
11788
11806
|
};
|
|
11789
11807
|
}
|
|
11790
11808
|
static create(t, e) {
|
|
11791
|
-
const i = new
|
|
11809
|
+
const i = new bt(t, e);
|
|
11792
11810
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
11793
11811
|
throw new Error(`duplicate uuid in options ${i.uuid}, Attributive`);
|
|
11794
11812
|
return this.instances.push(i), i;
|
|
@@ -11893,13 +11911,13 @@ function Ae(c) {
|
|
|
11893
11911
|
right: Ae(c.right)
|
|
11894
11912
|
});
|
|
11895
11913
|
}
|
|
11896
|
-
function
|
|
11914
|
+
function Fs(c) {
|
|
11897
11915
|
return Qt.create({
|
|
11898
11916
|
content: Ae(c)
|
|
11899
11917
|
});
|
|
11900
11918
|
}
|
|
11901
|
-
const
|
|
11902
|
-
name:
|
|
11919
|
+
const Ha = "_Interaction_", We = D.create({
|
|
11920
|
+
name: Ha,
|
|
11903
11921
|
properties: [
|
|
11904
11922
|
T.create({ name: "interactionId", type: "string", collection: !1 }),
|
|
11905
11923
|
T.create({ name: "interactionName", type: "string", collection: !1 }),
|
|
@@ -11909,7 +11927,7 @@ const Ua = "_Interaction_", je = D.create({
|
|
|
11909
11927
|
T.create({ name: "context", type: "object", collection: !1 })
|
|
11910
11928
|
]
|
|
11911
11929
|
});
|
|
11912
|
-
class
|
|
11930
|
+
class Ge {
|
|
11913
11931
|
constructor(t, e) {
|
|
11914
11932
|
this._type = "Interaction", this._options = e, this.uuid = A(e), this.name = t.name, this.conditions = t.conditions, this.userAttributives = t.userAttributives, this.userRef = t.userRef, this.action = t.action, this.payload = t.payload, this.data = t.data, this.dataPolicy = t.dataPolicy;
|
|
11915
11933
|
}
|
|
@@ -11965,10 +11983,10 @@ class We {
|
|
|
11965
11983
|
};
|
|
11966
11984
|
}
|
|
11967
11985
|
static create(t, e) {
|
|
11968
|
-
const i = new
|
|
11986
|
+
const i = new Ge(t, e);
|
|
11969
11987
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
11970
11988
|
throw new Error(`duplicate uuid in options ${i.uuid}, Interaction`);
|
|
11971
|
-
return i.entity =
|
|
11989
|
+
return i.entity = We, i.guard = ja(i), i.mapEventData = Wa(i), t.action === Ua && (i.resolve = Ga(i)), this.instances.push(i), i;
|
|
11972
11990
|
}
|
|
11973
11991
|
static stringify(t) {
|
|
11974
11992
|
const e = {
|
|
@@ -12007,12 +12025,12 @@ class J extends Error {
|
|
|
12007
12025
|
super(t), this.name = "InteractionGuardError", this.type = e.type, this.checkType = e.checkType, this.error = e.error;
|
|
12008
12026
|
}
|
|
12009
12027
|
}
|
|
12010
|
-
function
|
|
12028
|
+
function ja(c) {
|
|
12011
12029
|
return async function(t) {
|
|
12012
|
-
await _i(this, c, t), await
|
|
12030
|
+
await _i(this, c, t), await Ja(this, c, t), await Vi(this, c, t);
|
|
12013
12031
|
};
|
|
12014
12032
|
}
|
|
12015
|
-
function
|
|
12033
|
+
function Wa(c) {
|
|
12016
12034
|
return (t) => ({
|
|
12017
12035
|
interactionName: c.name,
|
|
12018
12036
|
interactionId: c.uuid,
|
|
@@ -12022,9 +12040,9 @@ function ja(c) {
|
|
|
12022
12040
|
context: t.context || {}
|
|
12023
12041
|
});
|
|
12024
12042
|
}
|
|
12025
|
-
function
|
|
12043
|
+
function Ga(c) {
|
|
12026
12044
|
return async function(t) {
|
|
12027
|
-
return
|
|
12045
|
+
return Xa(this, c, t);
|
|
12028
12046
|
};
|
|
12029
12047
|
}
|
|
12030
12048
|
async function _i(c, t, e) {
|
|
@@ -12050,7 +12068,7 @@ async function _i(c, t, e) {
|
|
|
12050
12068
|
error: a
|
|
12051
12069
|
});
|
|
12052
12070
|
}
|
|
12053
|
-
async function
|
|
12071
|
+
async function Ka(c, t, e, i) {
|
|
12054
12072
|
if (t.content) {
|
|
12055
12073
|
let r;
|
|
12056
12074
|
try {
|
|
@@ -12062,9 +12080,9 @@ async function Ga(c, t, e, i) {
|
|
|
12062
12080
|
}
|
|
12063
12081
|
return !0;
|
|
12064
12082
|
}
|
|
12065
|
-
async function
|
|
12083
|
+
async function Ja(c, t, e) {
|
|
12066
12084
|
if (!t.userAttributives) return;
|
|
12067
|
-
const i = Qt.is(t.userAttributives) ? E.fromValue(t.userAttributives.content) : E.atom(t.userAttributives), r = (s) =>
|
|
12085
|
+
const i = Qt.is(t.userAttributives) ? E.fromValue(t.userAttributives.content) : E.atom(t.userAttributives), r = (s) => Ka(c, s, e, e.user), a = await i.evaluateAsync(r);
|
|
12068
12086
|
if (a !== !0)
|
|
12069
12087
|
throw new J("User check failed", {
|
|
12070
12088
|
type: "check user failed",
|
|
@@ -12134,15 +12152,15 @@ async function Nt(c, t) {
|
|
|
12134
12152
|
if (await Nt(c, e) === !0) return !0;
|
|
12135
12153
|
return { name: t.name || "", type: "conceptAlias", error: "no match" };
|
|
12136
12154
|
}
|
|
12137
|
-
return
|
|
12155
|
+
return bt.is(t) ? !0 : D.is(t) ? c && typeof c == "object" ? !0 : { name: t.name || "", type: "conceptCheck", error: "invalid entity data" } : !0;
|
|
12138
12156
|
}
|
|
12139
|
-
async function
|
|
12157
|
+
async function Xa(c, t, e) {
|
|
12140
12158
|
if (D.is(t.data) || F.is(t.data)) {
|
|
12141
12159
|
const i = t.data.name, r = t.dataPolicy?.match, a = t.dataPolicy?.modifier, s = { ...e.query?.modifier || {}, ...a || {} }, n = e.query?.attributeQuery || [], o = typeof r == "function" ? await r.call(c, e) : r, l = E.and(o, e.query?.match);
|
|
12142
12160
|
return c.system.storage.find(i, l, s, n);
|
|
12143
12161
|
}
|
|
12144
12162
|
}
|
|
12145
|
-
class
|
|
12163
|
+
class Ke {
|
|
12146
12164
|
constructor(t, e) {
|
|
12147
12165
|
this._type = "Activity", this._options = e, this.uuid = A(e), this.name = t.name, this.interactions = t.interactions || [], this.gateways = t.gateways || [], this.transfers = t.transfers || [], this.groups = t.groups || [], this.events = t.events || [];
|
|
12148
12166
|
}
|
|
@@ -12190,7 +12208,7 @@ class Ge {
|
|
|
12190
12208
|
};
|
|
12191
12209
|
}
|
|
12192
12210
|
static create(t, e) {
|
|
12193
|
-
const i = new
|
|
12211
|
+
const i = new Ke(t, e);
|
|
12194
12212
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12195
12213
|
throw new Error(`duplicate uuid in options ${i.uuid}, Activity`);
|
|
12196
12214
|
return this.instances.push(i), i;
|
|
@@ -12365,14 +12383,14 @@ function Bi(c, t, e) {
|
|
|
12365
12383
|
i.activities?.forEach((r) => Bi(r, t, i));
|
|
12366
12384
|
});
|
|
12367
12385
|
}
|
|
12368
|
-
function
|
|
12386
|
+
function Ls(c) {
|
|
12369
12387
|
const t = [];
|
|
12370
12388
|
return Bi(c, (e) => t.push(e)), t;
|
|
12371
12389
|
}
|
|
12372
|
-
function
|
|
12390
|
+
function qs(c) {
|
|
12373
12391
|
return null;
|
|
12374
12392
|
}
|
|
12375
|
-
class
|
|
12393
|
+
class Je {
|
|
12376
12394
|
constructor(t, e) {
|
|
12377
12395
|
this._type = "Condition", this._options = e, this.uuid = A(e), this.content = t.content, this.name = t.name;
|
|
12378
12396
|
}
|
|
@@ -12398,7 +12416,7 @@ class Ke {
|
|
|
12398
12416
|
};
|
|
12399
12417
|
}
|
|
12400
12418
|
static create(t, e) {
|
|
12401
|
-
const i = new
|
|
12419
|
+
const i = new Je(t, e);
|
|
12402
12420
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12403
12421
|
throw new Error(`duplicate uuid in options ${i.uuid}, Condition`);
|
|
12404
12422
|
return this.instances.push(i), i;
|
|
@@ -12432,7 +12450,7 @@ class Ke {
|
|
|
12432
12450
|
return typeof r.content == "string" && r.content.startsWith("func::") && (i.content = new Function("return " + r.content.substring(6))()), this.create(i, e.options);
|
|
12433
12451
|
}
|
|
12434
12452
|
}
|
|
12435
|
-
class
|
|
12453
|
+
class Xe {
|
|
12436
12454
|
constructor(t, e) {
|
|
12437
12455
|
this._type = "DataAttributive", this._options = e, this.uuid = A(e), this.content = t.content, this.name = t.name;
|
|
12438
12456
|
}
|
|
@@ -12458,7 +12476,7 @@ class Je {
|
|
|
12458
12476
|
};
|
|
12459
12477
|
}
|
|
12460
12478
|
static create(t, e) {
|
|
12461
|
-
const i = new
|
|
12479
|
+
const i = new Xe(t, e);
|
|
12462
12480
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12463
12481
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributive`);
|
|
12464
12482
|
return this.instances.push(i), i;
|
|
@@ -12610,7 +12628,7 @@ class At {
|
|
|
12610
12628
|
return this.create(e.public, e.options);
|
|
12611
12629
|
}
|
|
12612
12630
|
}
|
|
12613
|
-
class
|
|
12631
|
+
class ze {
|
|
12614
12632
|
constructor(t, e) {
|
|
12615
12633
|
this._type = "Event", this._options = e, this.uuid = A(e), this.name = t.name;
|
|
12616
12634
|
}
|
|
@@ -12632,7 +12650,7 @@ class Xe {
|
|
|
12632
12650
|
};
|
|
12633
12651
|
}
|
|
12634
12652
|
static create(t, e) {
|
|
12635
|
-
const i = new
|
|
12653
|
+
const i = new ze(t, e);
|
|
12636
12654
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12637
12655
|
throw new Error(`duplicate uuid in options ${i.uuid}, Event`);
|
|
12638
12656
|
return this.instances.push(i), i;
|
|
@@ -12664,7 +12682,7 @@ class Xe {
|
|
|
12664
12682
|
return this.create(e.public, e.options);
|
|
12665
12683
|
}
|
|
12666
12684
|
}
|
|
12667
|
-
class
|
|
12685
|
+
class Ye {
|
|
12668
12686
|
constructor(t, e) {
|
|
12669
12687
|
this._type = "PayloadItem", this._options = e, this.uuid = A(e), this.name = t.name, this.base = t.base, this.type = t.type, this.isRef = t.isRef ?? !1, this.required = t.required ?? !1, this.isCollection = t.isCollection ?? !1, this.itemRef = t.itemRef;
|
|
12670
12688
|
}
|
|
@@ -12715,7 +12733,7 @@ class ze {
|
|
|
12715
12733
|
};
|
|
12716
12734
|
}
|
|
12717
12735
|
static create(t, e) {
|
|
12718
|
-
const i = new
|
|
12736
|
+
const i = new Ye(t, e);
|
|
12719
12737
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12720
12738
|
throw new Error(`duplicate uuid in options ${i.uuid}, PayloadItem`);
|
|
12721
12739
|
return this.instances.push(i), i;
|
|
@@ -12754,7 +12772,7 @@ class ze {
|
|
|
12754
12772
|
return this.create(e.public, e.options);
|
|
12755
12773
|
}
|
|
12756
12774
|
}
|
|
12757
|
-
class
|
|
12775
|
+
class Ze {
|
|
12758
12776
|
constructor(t, e) {
|
|
12759
12777
|
this._type = "Payload", this._options = e, this.uuid = A(e), this.items = t.items || [];
|
|
12760
12778
|
}
|
|
@@ -12778,7 +12796,7 @@ class Ye {
|
|
|
12778
12796
|
};
|
|
12779
12797
|
}
|
|
12780
12798
|
static create(t, e) {
|
|
12781
|
-
const i = new
|
|
12799
|
+
const i = new Ze(t, e);
|
|
12782
12800
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12783
12801
|
throw new Error(`duplicate uuid in options ${i.uuid}, Payload`);
|
|
12784
12802
|
return this.instances.push(i), i;
|
|
@@ -12810,7 +12828,7 @@ class Ye {
|
|
|
12810
12828
|
return this.create(e.public, e.options);
|
|
12811
12829
|
}
|
|
12812
12830
|
}
|
|
12813
|
-
class
|
|
12831
|
+
class ti {
|
|
12814
12832
|
constructor(t, e) {
|
|
12815
12833
|
this._type = "DataAttributives", this._options = e, this.uuid = A(e), this.content = t.content;
|
|
12816
12834
|
}
|
|
@@ -12833,7 +12851,7 @@ class Ze {
|
|
|
12833
12851
|
};
|
|
12834
12852
|
}
|
|
12835
12853
|
static create(t, e) {
|
|
12836
|
-
const i = new
|
|
12854
|
+
const i = new ti(t, e);
|
|
12837
12855
|
if (this.instances.find((a) => a.uuid === i.uuid))
|
|
12838
12856
|
throw new Error(`duplicate uuid in options ${i.uuid}, DataAttributives`);
|
|
12839
12857
|
return this.instances.push(i), i;
|
|
@@ -12864,25 +12882,25 @@ class Ze {
|
|
|
12864
12882
|
return this.create(e.public, e.options);
|
|
12865
12883
|
}
|
|
12866
12884
|
}
|
|
12867
|
-
const
|
|
12868
|
-
We,
|
|
12885
|
+
const za = [
|
|
12869
12886
|
Ge,
|
|
12870
|
-
gt,
|
|
12871
12887
|
Ke,
|
|
12888
|
+
bt,
|
|
12872
12889
|
Je,
|
|
12890
|
+
Xe,
|
|
12873
12891
|
ae,
|
|
12874
12892
|
At,
|
|
12875
|
-
Xe,
|
|
12876
12893
|
ze,
|
|
12877
12894
|
Ye,
|
|
12895
|
+
Ze,
|
|
12878
12896
|
se,
|
|
12879
|
-
|
|
12897
|
+
ti
|
|
12880
12898
|
];
|
|
12881
|
-
|
|
12882
|
-
c && c.displayName &&
|
|
12899
|
+
za.forEach((c) => {
|
|
12900
|
+
c && c.displayName && Ti(c.displayName, c);
|
|
12883
12901
|
});
|
|
12884
|
-
function
|
|
12885
|
-
return
|
|
12902
|
+
function _s({ name: c, isRef: t = !1 }, e) {
|
|
12903
|
+
return bt.create({
|
|
12886
12904
|
name: c,
|
|
12887
12905
|
content: c ? new Function("user", `return user.roles.includes('${c}')`) : function() {
|
|
12888
12906
|
return !0;
|
|
@@ -12890,7 +12908,7 @@ function qs({ name: c, isRef: t = !1 }, e) {
|
|
|
12890
12908
|
isRef: t
|
|
12891
12909
|
}, e);
|
|
12892
12910
|
}
|
|
12893
|
-
class
|
|
12911
|
+
class mt {
|
|
12894
12912
|
constructor(t, e) {
|
|
12895
12913
|
this.graph = t, this.parent = e;
|
|
12896
12914
|
}
|
|
@@ -12900,7 +12918,7 @@ class ft {
|
|
|
12900
12918
|
};
|
|
12901
12919
|
}
|
|
12902
12920
|
static create(t, e, i) {
|
|
12903
|
-
const r = new
|
|
12921
|
+
const r = new mt(e, i);
|
|
12904
12922
|
return t.current && (r.current = B.create(t.current, e, r)), r;
|
|
12905
12923
|
}
|
|
12906
12924
|
isInteractionAvailable(t) {
|
|
@@ -12933,13 +12951,13 @@ class B {
|
|
|
12933
12951
|
}
|
|
12934
12952
|
static createInitialState(t) {
|
|
12935
12953
|
const e = { uuid: t.uuid };
|
|
12936
|
-
return kt.is(t.content) && (e.children = t.childSeqs.map((i) =>
|
|
12954
|
+
return kt.is(t.content) && (e.children = t.childSeqs.map((i) => mt.createInitialState(i.head))), e;
|
|
12937
12955
|
}
|
|
12938
12956
|
static create(t, e, i) {
|
|
12939
12957
|
const r = e.getNodeByUUID(t.uuid);
|
|
12940
12958
|
if (kt.is(r.content)) {
|
|
12941
12959
|
const s = B.GroupStateNodeType.get(r.content.type), n = new s(r, e, i);
|
|
12942
|
-
return n.isGroup = !0, n.children = t?.children?.map((o) =>
|
|
12960
|
+
return n.isGroup = !0, n.children = t?.children?.map((o) => mt.create(o, e, n)), n;
|
|
12943
12961
|
} else
|
|
12944
12962
|
return new B(r, e, i);
|
|
12945
12963
|
}
|
|
@@ -12960,10 +12978,10 @@ class B {
|
|
|
12960
12978
|
}
|
|
12961
12979
|
class ye {
|
|
12962
12980
|
constructor(t, e) {
|
|
12963
|
-
this.graph = e, this.root =
|
|
12981
|
+
this.graph = e, this.root = mt.create(t, this.graph);
|
|
12964
12982
|
}
|
|
12965
12983
|
static createInitialState(t) {
|
|
12966
|
-
return
|
|
12984
|
+
return mt.createInitialState(t);
|
|
12967
12985
|
}
|
|
12968
12986
|
isInteractionAvailable(t) {
|
|
12969
12987
|
return this.root.isInteractionAvailable(t);
|
|
@@ -13069,7 +13087,7 @@ class vt {
|
|
|
13069
13087
|
e.userAttributives.content
|
|
13070
13088
|
) : E.atom(
|
|
13071
13089
|
e.userAttributives
|
|
13072
|
-
), a = (n) => n.isRef ? this.checkUserRef(t, n, i.user, i.activityId) :
|
|
13090
|
+
), a = (n) => n.isRef ? this.checkUserRef(t, n, i.user, i.activityId) : Ya(t, n, i, i.user), s = await r.evaluateAsync(a);
|
|
13073
13091
|
if (s !== !0)
|
|
13074
13092
|
throw new J("User check failed", {
|
|
13075
13093
|
type: "check user failed",
|
|
@@ -13088,14 +13106,14 @@ class vt {
|
|
|
13088
13106
|
async saveUserRefs(t, e, i, r) {
|
|
13089
13107
|
const a = (await this.getActivity(t, e))?.refs || {};
|
|
13090
13108
|
i.userRef?.name && (a[i.userRef?.name] = r.user.id), i.payload?.items.forEach((s) => {
|
|
13091
|
-
if (
|
|
13109
|
+
if (bt.is(s.itemRef) && s.itemRef?.name && r.payload[s.name]) {
|
|
13092
13110
|
const n = r.payload[s.name];
|
|
13093
13111
|
s.isCollection ? (a[s.itemRef.name] || (a[s.itemRef.name] = []), a[s.itemRef.name].push(n.id)) : a[s.itemRef.name] = n.id;
|
|
13094
13112
|
}
|
|
13095
13113
|
}), await this.setActivity(t, e, { refs: a });
|
|
13096
13114
|
}
|
|
13097
13115
|
}
|
|
13098
|
-
async function
|
|
13116
|
+
async function Ya(c, t, e, i) {
|
|
13099
13117
|
if (t.content) {
|
|
13100
13118
|
let r;
|
|
13101
13119
|
try {
|
|
@@ -13107,7 +13125,7 @@ async function za(c, t, e, i) {
|
|
|
13107
13125
|
}
|
|
13108
13126
|
return !0;
|
|
13109
13127
|
}
|
|
13110
|
-
class
|
|
13128
|
+
class Za extends B {
|
|
13111
13129
|
onChange(t, e) {
|
|
13112
13130
|
if (this.graph.isStartNode(t)) {
|
|
13113
13131
|
if (e)
|
|
@@ -13118,24 +13136,24 @@ class Ya extends B {
|
|
|
13118
13136
|
}
|
|
13119
13137
|
}
|
|
13120
13138
|
}
|
|
13121
|
-
B.GroupStateNodeType.set("any",
|
|
13122
|
-
class
|
|
13139
|
+
B.GroupStateNodeType.set("any", Za);
|
|
13140
|
+
class ts extends B {
|
|
13123
13141
|
onChange(t, e) {
|
|
13124
13142
|
this.isGroupCompleted() && this.complete();
|
|
13125
13143
|
}
|
|
13126
13144
|
}
|
|
13127
|
-
B.GroupStateNodeType.set("every",
|
|
13128
|
-
class
|
|
13145
|
+
B.GroupStateNodeType.set("every", ts);
|
|
13146
|
+
class es extends B {
|
|
13129
13147
|
onChange(t, e) {
|
|
13130
13148
|
this.graph.isEndNode(t) && this.complete();
|
|
13131
13149
|
}
|
|
13132
13150
|
}
|
|
13133
|
-
B.GroupStateNodeType.set("race",
|
|
13134
|
-
class
|
|
13151
|
+
B.GroupStateNodeType.set("race", es);
|
|
13152
|
+
class is extends B {
|
|
13135
13153
|
}
|
|
13136
|
-
B.GroupStateNodeType.set("program",
|
|
13137
|
-
const
|
|
13138
|
-
name:
|
|
13154
|
+
B.GroupStateNodeType.set("program", is);
|
|
13155
|
+
const rs = "_Activity_", Hi = D.create({
|
|
13156
|
+
name: rs,
|
|
13139
13157
|
properties: [
|
|
13140
13158
|
T.create({
|
|
13141
13159
|
name: "name",
|
|
@@ -13158,17 +13176,17 @@ const is = "_Activity_", Hi = D.create({
|
|
|
13158
13176
|
collection: !1
|
|
13159
13177
|
})
|
|
13160
13178
|
]
|
|
13161
|
-
}),
|
|
13179
|
+
}), as = F.create({
|
|
13162
13180
|
name: "activityInteraction",
|
|
13163
13181
|
source: Hi,
|
|
13164
13182
|
sourceProperty: "interaction",
|
|
13165
|
-
target:
|
|
13183
|
+
target: We,
|
|
13166
13184
|
targetProperty: "activity",
|
|
13167
13185
|
type: "1:n"
|
|
13168
13186
|
});
|
|
13169
|
-
class
|
|
13187
|
+
class Vs {
|
|
13170
13188
|
constructor(t) {
|
|
13171
|
-
this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(Hi,
|
|
13189
|
+
this.activityCalls = /* @__PURE__ */ new Map(), this.activityCallsByName = /* @__PURE__ */ new Map(), this.activityEventSources = [], this.requiredEntities = [], this.requiredRelations = [], t.length > 0 && (this.requiredEntities.push(Hi, We), this.requiredRelations.push(as)), t.forEach((e) => {
|
|
13172
13190
|
const i = new vt(e);
|
|
13173
13191
|
this.activityCalls.set(e.uuid, i), e.name && (C(!this.activityCallsByName.has(e.name), `activity name ${e.name} is duplicated`), this.activityCallsByName.set(e.name, i));
|
|
13174
13192
|
});
|
|
@@ -13244,7 +13262,7 @@ class _s {
|
|
|
13244
13262
|
return this.activityCallsByName.get(t);
|
|
13245
13263
|
}
|
|
13246
13264
|
}
|
|
13247
|
-
class
|
|
13265
|
+
class Qs extends U {
|
|
13248
13266
|
constructor(t, e = {}) {
|
|
13249
13267
|
super(t, {
|
|
13250
13268
|
errorType: e.context?.errorType || "InteractionExecutionError",
|
|
@@ -13260,7 +13278,7 @@ class Vs extends U {
|
|
|
13260
13278
|
}), this.interactionName = e.interactionName, this.userId = e.userId, this.payload = e.payload, this.executionPhase = e.executionPhase, this.severity = e.severity || q.HIGH;
|
|
13261
13279
|
}
|
|
13262
13280
|
}
|
|
13263
|
-
class
|
|
13281
|
+
class ss extends U {
|
|
13264
13282
|
constructor(t, e = {}) {
|
|
13265
13283
|
super(t, {
|
|
13266
13284
|
errorType: e.context?.errorType || "ActivityError",
|
|
@@ -13276,7 +13294,7 @@ class as extends U {
|
|
|
13276
13294
|
}), this.activityName = e.activityName, this.activityId = e.activityId, this.activityInstanceId = e.activityInstanceId, this.currentState = e.currentState, this.severity = e.severity || q.MEDIUM;
|
|
13277
13295
|
}
|
|
13278
13296
|
}
|
|
13279
|
-
class
|
|
13297
|
+
class Bs extends ss {
|
|
13280
13298
|
constructor(t, e = {}) {
|
|
13281
13299
|
super(t, {
|
|
13282
13300
|
...e,
|
|
@@ -13291,18 +13309,18 @@ class Qs extends as {
|
|
|
13291
13309
|
}
|
|
13292
13310
|
}
|
|
13293
13311
|
export {
|
|
13294
|
-
|
|
13312
|
+
rs as ACTIVITY_RECORD,
|
|
13295
13313
|
tr as ALL_ATTR_SYMBOL,
|
|
13296
13314
|
de as ASYNC_TASK_RECORD,
|
|
13297
13315
|
ae as Action,
|
|
13298
|
-
|
|
13316
|
+
Ke as Activity,
|
|
13299
13317
|
vt as ActivityCall,
|
|
13300
|
-
|
|
13318
|
+
ss as ActivityError,
|
|
13301
13319
|
kt as ActivityGroup,
|
|
13302
|
-
|
|
13303
|
-
|
|
13320
|
+
as as ActivityInteractionRelation,
|
|
13321
|
+
Vs as ActivityManager,
|
|
13304
13322
|
Hi as ActivityStateEntity,
|
|
13305
|
-
|
|
13323
|
+
Bs as ActivityStateError,
|
|
13306
13324
|
Er as AliasManager,
|
|
13307
13325
|
fa as AmbiguousComputationSignatureError,
|
|
13308
13326
|
Dt as Any,
|
|
@@ -13310,7 +13328,7 @@ export {
|
|
|
13310
13328
|
Ve as AsyncMigrationComputationError,
|
|
13311
13329
|
it as AttributeInfo,
|
|
13312
13330
|
O as AttributeQuery,
|
|
13313
|
-
|
|
13331
|
+
bt as Attributive,
|
|
13314
13332
|
Qt as Attributives,
|
|
13315
13333
|
Mt as Average,
|
|
13316
13334
|
ra as AverageHandles,
|
|
@@ -13323,46 +13341,46 @@ export {
|
|
|
13323
13341
|
Vt as ComputationResultAsync,
|
|
13324
13342
|
Xt as ComputationResultFullRecompute,
|
|
13325
13343
|
ee as ComputationResultResolved,
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13344
|
+
pt as ComputationResultSkip,
|
|
13345
|
+
ui as ComputationStateError,
|
|
13346
|
+
Je as Condition,
|
|
13347
|
+
ut as ConditionError,
|
|
13330
13348
|
se as Conditions,
|
|
13331
13349
|
at as ConstraintSetupError,
|
|
13332
|
-
|
|
13333
|
-
|
|
13350
|
+
xi as ConstraintViolationError,
|
|
13351
|
+
Ms as Controller,
|
|
13334
13352
|
It as Count,
|
|
13335
13353
|
Qr as CountHandles,
|
|
13336
13354
|
ir as CreationExecutor,
|
|
13337
13355
|
Pe as Custom,
|
|
13338
13356
|
ca as CustomHandles,
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13357
|
+
He as DBConsoleLogger,
|
|
13358
|
+
Va as DBLogLevel,
|
|
13359
|
+
ai as DBSetup,
|
|
13360
|
+
ri as DEFAULT_SCHEMA_DIALECT,
|
|
13361
|
+
Ts as DELETED_STATE,
|
|
13344
13362
|
K as DICTIONARY_RECORD,
|
|
13345
|
-
|
|
13346
|
-
|
|
13363
|
+
Xe as DataAttributive,
|
|
13364
|
+
ti as DataAttributives,
|
|
13347
13365
|
Ui as DataPolicy,
|
|
13348
13366
|
St as DestructiveComputedOutputError,
|
|
13349
13367
|
Ie as Dictionary,
|
|
13350
|
-
|
|
13368
|
+
ci as DictionaryEntity,
|
|
13351
13369
|
D as Entity,
|
|
13352
13370
|
sa as EntityCustomHandle,
|
|
13353
|
-
|
|
13354
|
-
|
|
13371
|
+
ei as EntityQueryHandle,
|
|
13372
|
+
dt as EntityToTableMap,
|
|
13355
13373
|
Oe as Equation,
|
|
13356
13374
|
Z as ErrorCategory,
|
|
13357
13375
|
q as ErrorSeverity,
|
|
13358
|
-
|
|
13359
|
-
|
|
13376
|
+
ze as Event,
|
|
13377
|
+
Ai as EventSource,
|
|
13360
13378
|
Pt as Every,
|
|
13361
13379
|
Or as EveryHandles,
|
|
13362
13380
|
_ as Expression,
|
|
13363
13381
|
U as FrameworkError,
|
|
13364
13382
|
At as Gateway,
|
|
13365
|
-
|
|
13383
|
+
Ua as GetAction,
|
|
13366
13384
|
Fr as GlobalAnyHandle,
|
|
13367
13385
|
ea as GlobalAverageHandle,
|
|
13368
13386
|
z as GlobalBoundState,
|
|
@@ -13374,13 +13392,13 @@ export {
|
|
|
13374
13392
|
Yr as GlobalSumHandle,
|
|
13375
13393
|
Ir as GlobalWeightedSummationHandle,
|
|
13376
13394
|
Se as HARD_DELETION_PROPERTY_NAME,
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13395
|
+
xs as HardDeletionProperty,
|
|
13396
|
+
si as ID_ATTR,
|
|
13397
|
+
Ha as INTERACTION_RECORD,
|
|
13380
13398
|
zt as Inequality,
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13399
|
+
Ge as Interaction,
|
|
13400
|
+
We as InteractionEventEntity,
|
|
13401
|
+
Qs as InteractionExecutionError,
|
|
13384
13402
|
J as InteractionGuardError,
|
|
13385
13403
|
Ce as KlassByName,
|
|
13386
13404
|
g as LINK_SYMBOL,
|
|
@@ -13391,18 +13409,18 @@ export {
|
|
|
13391
13409
|
he as MigrationBaselineError,
|
|
13392
13410
|
M as MigrationError,
|
|
13393
13411
|
Zi as Modifier,
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13412
|
+
Ds as MonoSystem,
|
|
13413
|
+
Es as NON_DELETED_STATE,
|
|
13414
|
+
vs as NON_EXIST_STATE,
|
|
13397
13415
|
Br as NestedDispatchError,
|
|
13398
13416
|
j as NewRecordData,
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13417
|
+
ki as NonNullConstraint,
|
|
13418
|
+
ys as PHASE_AFTER_ALL,
|
|
13419
|
+
ms as PHASE_BEFORE_ALL,
|
|
13402
13420
|
ce as PHASE_NORMAL,
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13421
|
+
Ze as Payload,
|
|
13422
|
+
Ye as PayloadItem,
|
|
13423
|
+
Cs as PhysicalLayoutChangeError,
|
|
13406
13424
|
T as Property,
|
|
13407
13425
|
Lr as PropertyAnyHandle,
|
|
13408
13426
|
ia as PropertyAverageHandle,
|
|
@@ -13416,7 +13434,7 @@ export {
|
|
|
13416
13434
|
xr as PropertyWeightedSummationHandle,
|
|
13417
13435
|
or as QueryExecutor,
|
|
13418
13436
|
Kt as ROOT_LABEL,
|
|
13419
|
-
|
|
13437
|
+
ni as ROW_ID_ATTR,
|
|
13420
13438
|
Ot as RealTime,
|
|
13421
13439
|
zr as RealTimeHandles,
|
|
13422
13440
|
$ as RecordBoundState,
|
|
@@ -13427,101 +13445,102 @@ export {
|
|
|
13427
13445
|
nr as RecordQueryRef,
|
|
13428
13446
|
G as RecordQueryTree,
|
|
13429
13447
|
Gr as RecordsTransformHandle,
|
|
13430
|
-
|
|
13448
|
+
ht as RecursiveContext,
|
|
13431
13449
|
ge as RefContainer,
|
|
13432
13450
|
F as Relation,
|
|
13433
13451
|
na as RelationCustomHandle,
|
|
13434
13452
|
X as RequireSerializableRetry,
|
|
13435
13453
|
sr as SQLBuilder,
|
|
13436
|
-
|
|
13454
|
+
Rt as SYSTEM_RECORD,
|
|
13437
13455
|
ha as Scheduler,
|
|
13438
13456
|
Me as SideEffect,
|
|
13439
13457
|
Ct as StateMachine,
|
|
13440
13458
|
$r as StateMachineHandles,
|
|
13441
|
-
|
|
13459
|
+
yt as StateNode,
|
|
13442
13460
|
xe as StateTransfer,
|
|
13443
13461
|
xt as Summation,
|
|
13444
13462
|
ta as SummationHandles,
|
|
13445
|
-
|
|
13446
|
-
|
|
13447
|
-
|
|
13463
|
+
je as SystemConsoleLogger,
|
|
13464
|
+
oi as SystemEntity,
|
|
13465
|
+
Qa as SystemLogLevel,
|
|
13448
13466
|
Re as TransactionCapabilityError,
|
|
13449
13467
|
Wt as TransactionRetryExhaustedError,
|
|
13450
13468
|
Qi as Transfer,
|
|
13451
13469
|
te as Transform,
|
|
13452
13470
|
Kr as TransformHandles,
|
|
13453
|
-
|
|
13471
|
+
Is as USER_ENTITY,
|
|
13454
13472
|
Zt as UniqueConstraint,
|
|
13455
13473
|
Tt as UnrebuildableComputationError,
|
|
13456
13474
|
$t as WeightedSummation,
|
|
13457
13475
|
Mr as WeightedSummationHandles,
|
|
13458
|
-
|
|
13476
|
+
Sa as addMissingRebuildHandlerRequirements,
|
|
13477
|
+
hi as addToCurrentEffects,
|
|
13459
13478
|
C as assert,
|
|
13460
13479
|
Fi as assertDestructiveScopeAllowed,
|
|
13461
13480
|
Fe as asyncEffectsContext,
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13481
|
+
Os as asyncInteractionContext,
|
|
13482
|
+
Fs as boolExpToAttributives,
|
|
13483
|
+
mi as buildAffectedRebuildPlan,
|
|
13465
13484
|
Ta as buildMigrationDiff,
|
|
13466
13485
|
_i as checkCondition,
|
|
13467
13486
|
Vi as checkPayload,
|
|
13468
|
-
|
|
13487
|
+
ds as clearAllInstances,
|
|
13469
13488
|
Y as collectErrorChain,
|
|
13470
13489
|
re as computationManifestId,
|
|
13471
13490
|
Gi as createInstances,
|
|
13472
|
-
|
|
13491
|
+
ps as createInstancesFromString,
|
|
13473
13492
|
jt as createMigrationManifest,
|
|
13474
13493
|
kr as createNonNullConstraintStatement,
|
|
13475
|
-
|
|
13494
|
+
xa as createPlanBlockingMessages,
|
|
13476
13495
|
Sr as createUniqueConstraintStatement,
|
|
13477
13496
|
be as createUniqueIndexSQL,
|
|
13478
|
-
|
|
13497
|
+
_s as createUserRoleAttributive,
|
|
13479
13498
|
P as dataContextPath,
|
|
13480
|
-
|
|
13499
|
+
Ps as dbConsoleLogger,
|
|
13481
13500
|
Bt as deepClone,
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13501
|
+
Ci as defaultEncodeLiteral,
|
|
13502
|
+
ws as everyAsync,
|
|
13503
|
+
Ns as everyWithErrorAsync,
|
|
13504
|
+
gs as filterMap,
|
|
13486
13505
|
la as findConstraintViolationError,
|
|
13487
13506
|
jr as findErrorByCode,
|
|
13488
|
-
|
|
13507
|
+
qs as findRootActivity,
|
|
13489
13508
|
Bi as forEachInteraction,
|
|
13490
13509
|
A as generateUUID,
|
|
13491
|
-
|
|
13492
|
-
|
|
13510
|
+
$s as getChangedComputations,
|
|
13511
|
+
Aa as getChangedComputationsFromApprovedDiff,
|
|
13493
13512
|
pa as getCurrentEffects,
|
|
13494
13513
|
Te as getDestructiveDeletionScope,
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13514
|
+
Ls as getInteractions,
|
|
13515
|
+
gi as getNewFilteredDataContexts,
|
|
13516
|
+
Ia as getRecomputeBlockingChanges,
|
|
13498
13517
|
Q as getSchemaDialect,
|
|
13499
|
-
|
|
13500
|
-
|
|
13518
|
+
yi as getStorageBlockingChanges,
|
|
13519
|
+
Ss as hasErrorCode,
|
|
13501
13520
|
ma as hashMigrationDiff,
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13521
|
+
us as indexBy,
|
|
13522
|
+
vi as isObject,
|
|
13523
|
+
Ei as isPlainObject,
|
|
13505
13524
|
Ur as isRequireSerializableRetry,
|
|
13506
13525
|
Hr as isRetryableTransactionError,
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13526
|
+
As as isTransactionCapabilityError,
|
|
13527
|
+
ks as isTransactionRetryExhaustedError,
|
|
13528
|
+
bs as mapObject,
|
|
13510
13529
|
le as normalizeDatabaseError,
|
|
13511
13530
|
Tr as predicateSQLForOperator,
|
|
13512
|
-
|
|
13531
|
+
ct as quoteIdentifier,
|
|
13513
13532
|
Ut as quoteLiteral,
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13533
|
+
bi as readMigrationManifest,
|
|
13534
|
+
Da as recomputeChangedComputations,
|
|
13535
|
+
Fa as recomputeFilteredMemberships,
|
|
13536
|
+
Ti as registerKlass,
|
|
13518
13537
|
De as runWithTransactionRetry,
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13538
|
+
Rs as someAsync,
|
|
13539
|
+
fs as sqliteEncodeLiteral,
|
|
13540
|
+
hs as stringifyAllInstances,
|
|
13522
13541
|
k as stringifyAttribute,
|
|
13523
|
-
|
|
13524
|
-
|
|
13542
|
+
Ba as systemConsoleLogger,
|
|
13543
|
+
ka as validateApprovedDiff,
|
|
13525
13544
|
me as writeMigrationManifest
|
|
13526
13545
|
};
|
|
13527
13546
|
//# sourceMappingURL=index.js.map
|