@loradb/lora-graphql 0.30.0 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyze/indexes.d.ts +2 -0
- package/dist/cli.js +2 -2
- package/dist/compile/read/types.d.ts +6 -1
- package/dist/{diff-DFLndaVb.js → diff-BK3wekMG.js} +2 -2
- package/dist/{diff-DFLndaVb.js.map → diff-BK3wekMG.js.map} +1 -1
- package/dist/driver.d.ts +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{lora-graphql-upoPizGA.js → lora-graphql-BW8S6TRu.js} +482 -436
- package/dist/lora-graphql-BW8S6TRu.js.map +1 -0
- package/dist/lora-graphql.d.ts +13 -0
- package/dist/testing.js +1 -1
- package/package.json +2 -2
- package/dist/lora-graphql-upoPizGA.js.map +0 -1
|
@@ -75,7 +75,7 @@ function kl(e) {
|
|
|
75
75
|
const a = /* @__PURE__ */ new Map(), c = [...s.filters];
|
|
76
76
|
if (!r && !jn.has(s.type)) {
|
|
77
77
|
const d = c.filter((f) => Tl.has(f));
|
|
78
|
-
d.length > 0 ? a.set("RANGE", `${o} is @filterable by ${d.join(", ")}`) : Yr(e, n, s) && a.set("RANGE", `${o} is @sortable`);
|
|
78
|
+
d.length > 0 ? a.set("RANGE", `${o} is @filterable by ${d.join(", ")}`) : s.list && c.includes("INCLUDES") ? a.set("RANGE", `${o} is @filterable by INCLUDES`) : Yr(e, n, s) && a.set("RANGE", `${o} is @sortable`);
|
|
79
79
|
}
|
|
80
80
|
const l = c.filter(
|
|
81
81
|
(d) => d === "WITHIN_BBOX" || d === "DISTANCE"
|
|
@@ -124,7 +124,7 @@ function gn(e, t, n) {
|
|
|
124
124
|
function wo(e) {
|
|
125
125
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").toLowerCase();
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function am(e) {
|
|
128
128
|
switch (e.kind) {
|
|
129
129
|
case "index":
|
|
130
130
|
return `index:${e.index}:${e.label}:${e.property}`;
|
|
@@ -136,7 +136,7 @@ function rm(e) {
|
|
|
136
136
|
return `vector:${e.name}:${e.label}:${e.property}:${e.dimensions}:${e.similarity}`;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function cm(e) {
|
|
140
140
|
switch (e.kind) {
|
|
141
141
|
case "index":
|
|
142
142
|
return `${e.index} index on :${e.label}(${e.property})`;
|
|
@@ -496,7 +496,7 @@ const Ml = Object.freeze([
|
|
|
496
496
|
"PERSISTED_QUERY_ONLY",
|
|
497
497
|
"WRONG_OPERATION_TYPE"
|
|
498
498
|
]), Ul = new Set(Ml);
|
|
499
|
-
function
|
|
499
|
+
function lm(e) {
|
|
500
500
|
if (typeof e != "object" || e === null) return !1;
|
|
501
501
|
const t = e.extensions;
|
|
502
502
|
if (typeof t != "object" || t === null) return !1;
|
|
@@ -973,7 +973,15 @@ function Ls(e, t, n, i = {}) {
|
|
|
973
973
|
function Bi(e) {
|
|
974
974
|
return ne("size", ne("list.unique", e));
|
|
975
975
|
}
|
|
976
|
-
const aa = 2, Hl = 1e3, Vl = 1e4, Gl = /* @__PURE__ */ new Set([
|
|
976
|
+
const aa = 2, Hl = 1e3, Vl = 1e4, Gl = /* @__PURE__ */ new Set([
|
|
977
|
+
"eq",
|
|
978
|
+
"in",
|
|
979
|
+
"startsWith",
|
|
980
|
+
"withinBBox",
|
|
981
|
+
"distance",
|
|
982
|
+
// A list's elements, in the RANGE index inferred for it (G-63).
|
|
983
|
+
"includes"
|
|
984
|
+
]), Ql = /* @__PURE__ */ new Set(["lt", "lte", "gt", "gte"]);
|
|
977
985
|
function ca(e, t, n) {
|
|
978
986
|
return e.statistics?.nodes[t.name] ?? n;
|
|
979
987
|
}
|
|
@@ -3066,7 +3074,7 @@ function Lu(e, t) {
|
|
|
3066
3074
|
}
|
|
3067
3075
|
return e.multipleOf && i.push(Ke(`a multiple of ${e.multipleOf.value}`)), i.length > 0 && n.push(t ? `Each item: ${i.join(" ")}` : i.join(" ")), n.length > 0 ? n.join(" ") : void 0;
|
|
3068
3076
|
}
|
|
3069
|
-
function
|
|
3077
|
+
function um(e, t) {
|
|
3070
3078
|
const n = [], i = [], s = [], o = (c, l, u, d) => {
|
|
3071
3079
|
l !== u && (u === void 0 ? s.push(`${c} was removed (was ${l})`) : l === void 0 ? n.push(`${c} is now ${u}`) : (d === "down" ? u < l : u > l) ? n.push(`${c} went from ${l} to ${u}`) : s.push(`${c} went from ${l} to ${u}`));
|
|
3072
3080
|
};
|
|
@@ -3764,11 +3772,11 @@ function Un(e, t, n, i, s) {
|
|
|
3764
3772
|
let h;
|
|
3765
3773
|
!c && !a && l && u.length === 0 && (h = Xu(e, t, l), h && (r.push(...h.clauses), c = h.expectation));
|
|
3766
3774
|
let m;
|
|
3767
|
-
s && (m = Xi(e, "this", i, s), u.length === 0 && !c && vi(i[0]) && !jn.has(i[0].field.type)
|
|
3775
|
+
s && (m = Xi(e, "this", i, s), u.length === 0 && !c && vi(i[0]) && !jn.has(i[0].field.type) ? c = {
|
|
3768
3776
|
label: o,
|
|
3769
3777
|
access: "range",
|
|
3770
3778
|
reason: `keyset on ${t.name}.${i[0].field.name}`
|
|
3771
|
-
}));
|
|
3779
|
+
} : c?.access === "element" && (c = { ...c, access: "any" }));
|
|
3772
3780
|
let g;
|
|
3773
3781
|
const y = i[0];
|
|
3774
3782
|
return !p && !a && !m && !h && u.length === 0 && y && y.direction === "ASC" && vi(y) && (y.field.type === "String" || y.field.type === "ID") && (g = se(">=", de(M("this"), y.field.property), G("")), c = {
|
|
@@ -3825,7 +3833,7 @@ function Xu(e, t, n) {
|
|
|
3825
3833
|
return l != null ? p = se("=", de(M(d), r.key.property), B(e, l)) : p = se(
|
|
3826
3834
|
"IN",
|
|
3827
3835
|
de(M(d), r.key.property),
|
|
3828
|
-
B(e,
|
|
3836
|
+
B(e, Zu(u))
|
|
3829
3837
|
), f.push({
|
|
3830
3838
|
kind: "match",
|
|
3831
3839
|
pattern: {
|
|
@@ -3858,6 +3866,17 @@ function Xu(e, t, n) {
|
|
|
3858
3866
|
}
|
|
3859
3867
|
}
|
|
3860
3868
|
function Ju(e, t) {
|
|
3869
|
+
const n = e.labels[0], i = Object.entries(t).find(([o, r]) => {
|
|
3870
|
+
const a = e.fields.get(o);
|
|
3871
|
+
return a?.kind === "scalar" && a.list && r != null && r.includes != null;
|
|
3872
|
+
}), s = Yu(e, t);
|
|
3873
|
+
if (i) {
|
|
3874
|
+
const o = `${e.name}.${i[0]} includes`;
|
|
3875
|
+
return s ? { label: n, access: "any", reason: `${s.reason} or ${o}` } : { label: n, access: "element", reason: o };
|
|
3876
|
+
}
|
|
3877
|
+
return s;
|
|
3878
|
+
}
|
|
3879
|
+
function Yu(e, t) {
|
|
3861
3880
|
const n = e.labels[0];
|
|
3862
3881
|
for (const i of ["exact", "range", "text", "point"])
|
|
3863
3882
|
for (const [s, o] of Object.entries(t)) {
|
|
@@ -3879,7 +3898,7 @@ function Ju(e, t) {
|
|
|
3879
3898
|
};
|
|
3880
3899
|
}
|
|
3881
3900
|
}
|
|
3882
|
-
function
|
|
3901
|
+
function Zu(e) {
|
|
3883
3902
|
const t = /* @__PURE__ */ new Set();
|
|
3884
3903
|
return e.filter((n) => {
|
|
3885
3904
|
const i = Y(n);
|
|
@@ -3947,7 +3966,7 @@ function no(e, t, n, i, s) {
|
|
|
3947
3966
|
}
|
|
3948
3967
|
];
|
|
3949
3968
|
}
|
|
3950
|
-
function
|
|
3969
|
+
function ed(e, t, n, i) {
|
|
3951
3970
|
const s = e.schema.getType(
|
|
3952
3971
|
Z.aggregate(t.name)
|
|
3953
3972
|
), o = n.where, r = Un(e, t, o, []);
|
|
@@ -3967,7 +3986,7 @@ function Zu(e, t, n, i) {
|
|
|
3967
3986
|
r.expectation
|
|
3968
3987
|
);
|
|
3969
3988
|
}
|
|
3970
|
-
function
|
|
3989
|
+
function td(e, t, n, i) {
|
|
3971
3990
|
const s = [...new Set(n.by ?? [])];
|
|
3972
3991
|
if (s.length === 0)
|
|
3973
3992
|
throw U("BAD_USER_INPUT", "`by` names at least one field");
|
|
@@ -4041,7 +4060,7 @@ function Xa(e, t) {
|
|
|
4041
4060
|
}
|
|
4042
4061
|
return n;
|
|
4043
4062
|
}
|
|
4044
|
-
function
|
|
4063
|
+
function nd(e, t, n, i, s, o, r) {
|
|
4045
4064
|
const a = e.model.nodes.get(n.target);
|
|
4046
4065
|
me(e, a, "READ");
|
|
4047
4066
|
const c = a.labels[0];
|
|
@@ -4088,7 +4107,7 @@ function td(e, t, n, i, s, o, r) {
|
|
|
4088
4107
|
];
|
|
4089
4108
|
l && v.properties.length > 0 && T.push({
|
|
4090
4109
|
key: "properties",
|
|
4091
|
-
value:
|
|
4110
|
+
value: sd(e, l.name, N, v.properties, I, {
|
|
4092
4111
|
rel: n,
|
|
4093
4112
|
owner: t,
|
|
4094
4113
|
target: $
|
|
@@ -4224,7 +4243,7 @@ function td(e, t, n, i, s, o, r) {
|
|
|
4224
4243
|
expr: { kind: "map", entries: q }
|
|
4225
4244
|
} : (q[0] = { key: "__rows", value: { kind: "list", items: [] } }, { pre: [], expr: { kind: "map", entries: q } });
|
|
4226
4245
|
}
|
|
4227
|
-
function
|
|
4246
|
+
function sd(e, t, n, i, s, o) {
|
|
4228
4247
|
const r = e.model.relationshipProperties.get(t), a = e.schema.getType(t), c = [];
|
|
4229
4248
|
for (const [l, u] of Qe(e, a, i)) {
|
|
4230
4249
|
const d = r.fields.get(u[0].name.value);
|
|
@@ -4330,7 +4349,7 @@ function so(e, t, n, i, s, o) {
|
|
|
4330
4349
|
return { node: r, properties: a, totalCount: c, page: l, aggregate: u };
|
|
4331
4350
|
}
|
|
4332
4351
|
const Wo = /* @__PURE__ */ new Map();
|
|
4333
|
-
function
|
|
4352
|
+
function id(e) {
|
|
4334
4353
|
const t = Wo.get(e);
|
|
4335
4354
|
if (t) return t;
|
|
4336
4355
|
const n = tt(`{ ${e} }`).definitions[0];
|
|
@@ -4341,7 +4360,7 @@ function Ze(e, t, n, i, s) {
|
|
|
4341
4360
|
const o = e.schema.getType(t.name), r = o.getFields(), a = [], c = [], l = Qe(e, o, i), u = [];
|
|
4342
4361
|
for (const [, p] of l) {
|
|
4343
4362
|
const h = t.fields.get(p[0].name.value);
|
|
4344
|
-
h?.kind === "custom" && h.requires && u.push(
|
|
4363
|
+
h?.kind === "custom" && h.requires && u.push(id(h.requires));
|
|
4345
4364
|
}
|
|
4346
4365
|
const d = u.length > 0 ? Qe(e, o, [...i, ...u]) : l;
|
|
4347
4366
|
for (const [p, h] of d) {
|
|
@@ -4386,7 +4405,7 @@ function Ze(e, t, n, i, s) {
|
|
|
4386
4405
|
s
|
|
4387
4406
|
);
|
|
4388
4407
|
else if (y?.kind === "relationship")
|
|
4389
|
-
D =
|
|
4408
|
+
D = od(
|
|
4390
4409
|
e,
|
|
4391
4410
|
n,
|
|
4392
4411
|
y,
|
|
@@ -4400,7 +4419,7 @@ function Ze(e, t, n, i, s) {
|
|
|
4400
4419
|
else {
|
|
4401
4420
|
const I = Ho(t, m);
|
|
4402
4421
|
if (!I) continue;
|
|
4403
|
-
D =
|
|
4422
|
+
D = nd(
|
|
4404
4423
|
e,
|
|
4405
4424
|
n,
|
|
4406
4425
|
I,
|
|
@@ -4442,7 +4461,7 @@ function Ja(e, t, n) {
|
|
|
4442
4461
|
const i = e.degrees.get(`${t.owner}.${t.name}`) ?? t.cardinality;
|
|
4443
4462
|
return i === void 0 ? n : Math.min(n, Math.max(i, 1));
|
|
4444
4463
|
}
|
|
4445
|
-
function
|
|
4464
|
+
function od(e, t, n, i, s, o, r) {
|
|
4446
4465
|
const a = e.model.nodes.get(n.target);
|
|
4447
4466
|
me(e, a, "READ");
|
|
4448
4467
|
const c = a.labels[0];
|
|
@@ -4559,7 +4578,7 @@ const qt = "[A-Za-z_][A-Za-z0-9_]*|`(?:[^`]|``)+`", io = (e) => e.startsWith("`"
|
|
|
4559
4578
|
"REMOVE",
|
|
4560
4579
|
"DELETE",
|
|
4561
4580
|
"DETACH"
|
|
4562
|
-
]),
|
|
4581
|
+
]), rd = /* @__PURE__ */ new Set([
|
|
4563
4582
|
...Za,
|
|
4564
4583
|
"MATCH",
|
|
4565
4584
|
"OPTIONAL",
|
|
@@ -4587,12 +4606,12 @@ function oo(e, t) {
|
|
|
4587
4606
|
for (let c = 0; c < i.length; c++)
|
|
4588
4607
|
s += i[c] === "_" ? t[c] : i[c];
|
|
4589
4608
|
const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
4590
|
-
for (const { keyword: c, text: l } of
|
|
4609
|
+
for (const { keyword: c, text: l } of cd(i, s)) {
|
|
4591
4610
|
for (const d of Go(l)) o.add(d);
|
|
4592
4611
|
for (const d of Qo(l)) r.add(d);
|
|
4593
|
-
const u = c === "SET" ?
|
|
4612
|
+
const u = c === "SET" ? ld(l) : c === "DELETE" ? dd(l) : [];
|
|
4594
4613
|
for (const d of u) {
|
|
4595
|
-
const f =
|
|
4614
|
+
const f = fd(s, d);
|
|
4596
4615
|
if (f.length === 0)
|
|
4597
4616
|
return Vo(n, Go(s), Qo(s));
|
|
4598
4617
|
for (const p of f)
|
|
@@ -4612,14 +4631,14 @@ function oo(e, t) {
|
|
|
4612
4631
|
function Vo(e, t, n) {
|
|
4613
4632
|
return e.filter(
|
|
4614
4633
|
(i) => i.labels.some((s) => t.has(s)) || i.uniqueTogether.some((s) => {
|
|
4615
|
-
const o =
|
|
4634
|
+
const o = ad(i, s.where);
|
|
4616
4635
|
return s.scalars.some((r) => n.has(r.property)) || [...s.singles, ...s.set ? [s.set] : []].some(
|
|
4617
4636
|
(r) => t.has(r.type)
|
|
4618
4637
|
) || o.props.some((r) => n.has(r)) || o.types.some((r) => t.has(r));
|
|
4619
4638
|
})
|
|
4620
4639
|
);
|
|
4621
4640
|
}
|
|
4622
|
-
function
|
|
4641
|
+
function ad(e, t) {
|
|
4623
4642
|
const n = { props: [], types: [] }, i = (s) => {
|
|
4624
4643
|
if (Array.isArray(s)) s.forEach(i);
|
|
4625
4644
|
else if (s && typeof s == "object")
|
|
@@ -4630,7 +4649,7 @@ function rd(e, t) {
|
|
|
4630
4649
|
};
|
|
4631
4650
|
return i(t), n;
|
|
4632
4651
|
}
|
|
4633
|
-
function
|
|
4652
|
+
function cd(e, t) {
|
|
4634
4653
|
const n = [], i = [], s = (c, l) => {
|
|
4635
4654
|
for (; i.length > 0 && i[i.length - 1].depth >= l; ) {
|
|
4636
4655
|
const u = i.pop();
|
|
@@ -4657,7 +4676,7 @@ function ad(e, t) {
|
|
|
4657
4676
|
continue;
|
|
4658
4677
|
}
|
|
4659
4678
|
const d = u[0].toUpperCase(), f = c + u[0].length;
|
|
4660
|
-
|
|
4679
|
+
rd.has(d) && // Not a property, label, parameter or map key.
|
|
4661
4680
|
!".:$".includes(a) && !/^\s*:/.test(e.slice(f, f + 64)) && (s(c, r), Za.has(d) && i.push({ keyword: d, start: c, depth: r })), c = f, a = "a";
|
|
4662
4681
|
}
|
|
4663
4682
|
}
|
|
@@ -4677,14 +4696,14 @@ function Qo(e) {
|
|
|
4677
4696
|
)
|
|
4678
4697
|
);
|
|
4679
4698
|
}
|
|
4680
|
-
function
|
|
4699
|
+
function ld(e) {
|
|
4681
4700
|
return [
|
|
4682
4701
|
...e.matchAll(
|
|
4683
4702
|
new RegExp(`(?<![.\\w\`$])(${qt})\\s*\\+?=(?![=~])`, "g")
|
|
4684
4703
|
)
|
|
4685
4704
|
].map((t) => t[1]);
|
|
4686
4705
|
}
|
|
4687
|
-
const
|
|
4706
|
+
const ud = /* @__PURE__ */ new Set([
|
|
4688
4707
|
"DELETE",
|
|
4689
4708
|
"NULL",
|
|
4690
4709
|
"TRUE",
|
|
@@ -4701,12 +4720,12 @@ const ld = /* @__PURE__ */ new Set([
|
|
|
4701
4720
|
"ELSE",
|
|
4702
4721
|
"END"
|
|
4703
4722
|
]);
|
|
4704
|
-
function
|
|
4723
|
+
function dd(e) {
|
|
4705
4724
|
return [
|
|
4706
4725
|
...e.matchAll(new RegExp(`(?<![.:\\w\`$])(${qt})(?!\\s*[(.])`, "g"))
|
|
4707
|
-
].map((t) => t[1]).filter((t) => !
|
|
4726
|
+
].map((t) => t[1]).filter((t) => !ud.has(t.toUpperCase()));
|
|
4708
4727
|
}
|
|
4709
|
-
function
|
|
4728
|
+
function fd(e, t) {
|
|
4710
4729
|
const n = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), i = new RegExp(
|
|
4711
4730
|
`[(\\[]\\s*${n}\\s*(:\\s*(?:${qt})\\s*(?:[:&|]\\s*:?\\s*(?:${qt})\\s*)*)`,
|
|
4712
4731
|
"g"
|
|
@@ -4729,7 +4748,7 @@ function ec(e, t) {
|
|
|
4729
4748
|
)
|
|
4730
4749
|
].sort();
|
|
4731
4750
|
}
|
|
4732
|
-
function
|
|
4751
|
+
function pd(e, t, n) {
|
|
4733
4752
|
if (t.broad || e.opaque) return !0;
|
|
4734
4753
|
const i = new Set(t.types.flatMap(n));
|
|
4735
4754
|
return e.labels.some((s) => i.has(s)) || e.relationships.some((s) => t.relationshipTypes.includes(s));
|
|
@@ -4834,7 +4853,7 @@ function nc(e, t, n) {
|
|
|
4834
4853
|
const c = a[r];
|
|
4835
4854
|
for (const l of Array.isArray(c) ? c : [c]) {
|
|
4836
4855
|
if (l == null) continue;
|
|
4837
|
-
const u =
|
|
4856
|
+
const u = hd(e, l);
|
|
4838
4857
|
if (!u) {
|
|
4839
4858
|
t.writes && (i.broad = !0);
|
|
4840
4859
|
continue;
|
|
@@ -4861,7 +4880,7 @@ SET n.${R(Te.state)} = "PENDING"`,
|
|
|
4861
4880
|
};
|
|
4862
4881
|
});
|
|
4863
4882
|
}
|
|
4864
|
-
function
|
|
4883
|
+
function hd(e, t) {
|
|
4865
4884
|
const n = t;
|
|
4866
4885
|
if (!(!n || !Array.isArray(n.labels) || !n.properties))
|
|
4867
4886
|
for (const i of e.nodes.values()) {
|
|
@@ -4873,7 +4892,7 @@ function pd(e, t) {
|
|
|
4873
4892
|
function Lt(e, t, n) {
|
|
4874
4893
|
return e.onStatement?.(n), e.observe ? e.observe(n, () => t.execute(n)) : t.execute(n);
|
|
4875
4894
|
}
|
|
4876
|
-
const
|
|
4895
|
+
const md = {
|
|
4877
4896
|
DateTime: "datetime()",
|
|
4878
4897
|
LocalDateTime: "localdatetime()",
|
|
4879
4898
|
Date: "date()"
|
|
@@ -4881,9 +4900,9 @@ const hd = {
|
|
|
4881
4900
|
function en(e, t) {
|
|
4882
4901
|
return [...e.fields.values()].filter(
|
|
4883
4902
|
(n) => n.kind === "scalar" && !!n.timestamp?.has(t)
|
|
4884
|
-
).map((n) => [n.property,
|
|
4903
|
+
).map((n) => [n.property, md[n.type]]);
|
|
4885
4904
|
}
|
|
4886
|
-
function
|
|
4905
|
+
function gd(e, t) {
|
|
4887
4906
|
const n = t.properties ? e.relationshipProperties.get(t.properties) : void 0;
|
|
4888
4907
|
return (n ? en(n, "UPDATE") : []).map(([i, s]) => `, r.${R(i)} = ${s}`).join("");
|
|
4889
4908
|
}
|
|
@@ -4899,7 +4918,7 @@ function Pt(e, t, n, i, s, o, r) {
|
|
|
4899
4918
|
MATCH (${R(e)})${Je(i, s, o, r)}
|
|
4900
4919
|
WHERE ${St(o, r)}`;
|
|
4901
4920
|
}
|
|
4902
|
-
const
|
|
4921
|
+
const yd = (e) => e && se("OR", de(M("row"), "fresh"), e), ke = (e) => e ? ` AND (${P(e)})` : "";
|
|
4903
4922
|
function ro(e, t) {
|
|
4904
4923
|
return [...e.nodes.get(t.target).fields.values()].filter(
|
|
4905
4924
|
(i) => i.kind === "relationship" && i.type === t.type && i.members.includes(t.owner) && i.direction !== t.direction
|
|
@@ -4992,7 +5011,7 @@ function Es(e) {
|
|
|
4992
5011
|
let t = Ko.get(e.model);
|
|
4993
5012
|
return t === void 0 && (t = [...e.model.nodes.values()].some((n) => n.triggers.length > 0), Ko.set(e.model, t)), t;
|
|
4994
5013
|
}
|
|
4995
|
-
function
|
|
5014
|
+
function Ed(e) {
|
|
4996
5015
|
return !e.inTrigger && !!e.triggers && Object.keys(e.triggers).length > 0;
|
|
4997
5016
|
}
|
|
4998
5017
|
function rc(e, t, n) {
|
|
@@ -5029,7 +5048,7 @@ MATCH (this:${R(e.labels[0])}) WHERE this.${R(e.key.property)} = lora_trigger_pa
|
|
|
5029
5048
|
MATCH (target:${R(t.labels[0])}) WHERE target.${R(t.key.property)} = lora_trigger_pair[1]
|
|
5030
5049
|
`;
|
|
5031
5050
|
}
|
|
5032
|
-
function
|
|
5051
|
+
function wd(e, t, n, i) {
|
|
5033
5052
|
const { model: s } = e.env, o = new Set(e.change.deleted.map(Be)), r = /* @__PURE__ */ new Map();
|
|
5034
5053
|
for (const a of i) {
|
|
5035
5054
|
if (a.type !== n.type) continue;
|
|
@@ -5046,7 +5065,7 @@ function Ed(e, t, n, i) {
|
|
|
5046
5065
|
[...r].map(([a, c]) => [a, [...c.values()]])
|
|
5047
5066
|
);
|
|
5048
5067
|
}
|
|
5049
|
-
async function
|
|
5068
|
+
async function vd(e) {
|
|
5050
5069
|
if (!Es(e.env)) return;
|
|
5051
5070
|
const t = (a) => !e.triggered.has(Be(a)), n = Xo(e, e.change.created.filter(t)), i = new Set(e.change.created.map(Be)), s = Xo(
|
|
5052
5071
|
e,
|
|
@@ -5064,7 +5083,7 @@ async function wd(e) {
|
|
|
5064
5083
|
["DISCONNECT", e.disconnected]
|
|
5065
5084
|
])
|
|
5066
5085
|
if (c.operations.has(f))
|
|
5067
|
-
for (const [h, m] of
|
|
5086
|
+
for (const [h, m] of wd(e, a, l, p))
|
|
5068
5087
|
o.push([
|
|
5069
5088
|
c,
|
|
5070
5089
|
(g) => ({
|
|
@@ -5081,7 +5100,7 @@ async function wd(e) {
|
|
|
5081
5100
|
const u = c.operations.has("CREATE") ? n.get(a) ?? [] : [];
|
|
5082
5101
|
u.length > 0 && o.push(r(a, c, "CREATE", u));
|
|
5083
5102
|
const d = c.operations.has("UPDATE") ? (s.get(a) ?? []).filter(
|
|
5084
|
-
(f) =>
|
|
5103
|
+
(f) => kd(e, a, f, c.fields)
|
|
5085
5104
|
) : [];
|
|
5086
5105
|
d.length > 0 && o.push(r(a, c, "UPDATE", d));
|
|
5087
5106
|
}
|
|
@@ -5089,7 +5108,7 @@ async function wd(e) {
|
|
|
5089
5108
|
for (const a of e.env.model.nodes.values())
|
|
5090
5109
|
await $i(e, a, "CREATE", n.get(a) ?? []), await $i(e, a, "UPDATE", s.get(a) ?? []);
|
|
5091
5110
|
}
|
|
5092
|
-
async function
|
|
5111
|
+
async function bd(e, t) {
|
|
5093
5112
|
if (!Es(e.env)) return;
|
|
5094
5113
|
const n = [];
|
|
5095
5114
|
for (const { node: i, keys: s } of t)
|
|
@@ -5123,7 +5142,7 @@ async function $i(e, t, n, i) {
|
|
|
5123
5142
|
operation: n,
|
|
5124
5143
|
type: t.name,
|
|
5125
5144
|
keys: i,
|
|
5126
|
-
change:
|
|
5145
|
+
change: $d(e),
|
|
5127
5146
|
transaction: o,
|
|
5128
5147
|
context: e.env.requestContext
|
|
5129
5148
|
}))();
|
|
@@ -5147,9 +5166,9 @@ async function $i(e, t, n, i) {
|
|
|
5147
5166
|
} finally {
|
|
5148
5167
|
clearTimeout(a);
|
|
5149
5168
|
}
|
|
5150
|
-
for (const c of o.drain())
|
|
5169
|
+
for (const c of o.drain()) Td(e, c);
|
|
5151
5170
|
}
|
|
5152
|
-
function
|
|
5171
|
+
function $d(e) {
|
|
5153
5172
|
const t = {
|
|
5154
5173
|
...e.change,
|
|
5155
5174
|
created: [...e.change.created],
|
|
@@ -5160,7 +5179,7 @@ function bd(e) {
|
|
|
5160
5179
|
};
|
|
5161
5180
|
return ec(t, e), t;
|
|
5162
5181
|
}
|
|
5163
|
-
function
|
|
5182
|
+
function Td(e, t) {
|
|
5164
5183
|
const n = e.change, i = (a, c) => {
|
|
5165
5184
|
const l = a.findIndex((u) => Be(u) === c);
|
|
5166
5185
|
return l >= 0 && a.splice(l, 1), l >= 0;
|
|
@@ -5191,7 +5210,7 @@ async function lc(e, t) {
|
|
|
5191
5210
|
}), r;
|
|
5192
5211
|
}), i = /* @__PURE__ */ new Set(), s = [];
|
|
5193
5212
|
for (const [o, [r]] of t.entries()) {
|
|
5194
|
-
s.push(...
|
|
5213
|
+
s.push(...Ad(e, r, await n[o]));
|
|
5195
5214
|
for (const a of oo(
|
|
5196
5215
|
e.env.model,
|
|
5197
5216
|
r.statement
|
|
@@ -5206,7 +5225,7 @@ async function lc(e, t) {
|
|
|
5206
5225
|
))
|
|
5207
5226
|
await e.send(o);
|
|
5208
5227
|
}
|
|
5209
|
-
function
|
|
5228
|
+
function Ad(e, t, n) {
|
|
5210
5229
|
const i = nc(e.env.model, t, n);
|
|
5211
5230
|
i.broad && (e.change.broad = !0);
|
|
5212
5231
|
const s = [], o = new Set(
|
|
@@ -5229,12 +5248,12 @@ function Xo(e, t) {
|
|
|
5229
5248
|
}
|
|
5230
5249
|
return new Map([...n].map(([i, s]) => [i, [...s.values()]]));
|
|
5231
5250
|
}
|
|
5232
|
-
function
|
|
5251
|
+
function kd(e, t, n, i) {
|
|
5233
5252
|
if (!i) return !0;
|
|
5234
5253
|
const s = e.updatedFields.get(t)?.get(Y(n));
|
|
5235
5254
|
return !!s && i.some((o) => s.has(o));
|
|
5236
5255
|
}
|
|
5237
|
-
async function
|
|
5256
|
+
async function Nd(e, t) {
|
|
5238
5257
|
if (!e.explain) return [];
|
|
5239
5258
|
const n = [], i = [
|
|
5240
5259
|
...t.queries,
|
|
@@ -5291,9 +5310,16 @@ const uc = {
|
|
|
5291
5310
|
exact: ["NodeByPropertyScan"],
|
|
5292
5311
|
range: ["NodeByPropertyRangeScan", "NodeByPropertyScan"],
|
|
5293
5312
|
text: ["NodeByTextScan"],
|
|
5294
|
-
point: ["NodeByPointScan"]
|
|
5313
|
+
point: ["NodeByPointScan"],
|
|
5314
|
+
element: ["NodeByPropertyScan"],
|
|
5315
|
+
any: [
|
|
5316
|
+
"NodeByPropertyScan",
|
|
5317
|
+
"NodeByPropertyRangeScan",
|
|
5318
|
+
"NodeByTextScan",
|
|
5319
|
+
"NodeByPointScan"
|
|
5320
|
+
]
|
|
5295
5321
|
};
|
|
5296
|
-
async function
|
|
5322
|
+
async function Sd(e, t, n = {}) {
|
|
5297
5323
|
if (!e.explain)
|
|
5298
5324
|
throw new Error(
|
|
5299
5325
|
"the driver has no explain(); plan checks need @loradb/lora-node"
|
|
@@ -5309,7 +5335,7 @@ async function Nd(e, t, n = {}) {
|
|
|
5309
5335
|
rule: "mutating-read",
|
|
5310
5336
|
message: "a read statement has a mutating plan",
|
|
5311
5337
|
statement: o.text
|
|
5312
|
-
}), s === 0 && !
|
|
5338
|
+
}), s === 0 && !_d(r.resultColumns, t.columns) && u.push({
|
|
5313
5339
|
rule: "result-columns",
|
|
5314
5340
|
message: `expected columns [${t.columns.join(", ")}], plan returns [${r.resultColumns.join(", ")}]`,
|
|
5315
5341
|
statement: o.text
|
|
@@ -5342,10 +5368,10 @@ async function Nd(e, t, n = {}) {
|
|
|
5342
5368
|
}
|
|
5343
5369
|
return i;
|
|
5344
5370
|
}
|
|
5345
|
-
const
|
|
5346
|
-
function
|
|
5371
|
+
const Rd = new Set(Object.values(uc).flat()), Id = /* @__PURE__ */ new Set(["Argument", "Unwind", "Filter", "Projection"]);
|
|
5372
|
+
function Dd(e, t) {
|
|
5347
5373
|
return Wn(t.tree).filter((n) => n.operator === "Expand").flatMap((n) => {
|
|
5348
|
-
const i =
|
|
5374
|
+
const i = Od(n);
|
|
5349
5375
|
return i ? [
|
|
5350
5376
|
{
|
|
5351
5377
|
rule: "scan-expand",
|
|
@@ -5355,21 +5381,21 @@ function Id(e, t) {
|
|
|
5355
5381
|
] : [];
|
|
5356
5382
|
});
|
|
5357
5383
|
}
|
|
5358
|
-
function
|
|
5384
|
+
function Od(e) {
|
|
5359
5385
|
for (let t = e.children[0]; t; t = t.children[0]) {
|
|
5360
|
-
if (
|
|
5361
|
-
if (t.operator === "NodeByLabelScan" || t.operator === "NodeScan" && Wn(t).slice(1).every((n) =>
|
|
5386
|
+
if (Rd.has(t.operator)) return;
|
|
5387
|
+
if (t.operator === "NodeByLabelScan" || t.operator === "NodeScan" && Wn(t).slice(1).every((n) => Id.has(n.operator)))
|
|
5362
5388
|
return t;
|
|
5363
5389
|
}
|
|
5364
5390
|
}
|
|
5365
|
-
async function
|
|
5391
|
+
async function Cd(e, t, n = {}) {
|
|
5366
5392
|
if (!e.explain)
|
|
5367
5393
|
throw new Error(
|
|
5368
5394
|
"the driver has no explain(); plan checks need @loradb/lora-node"
|
|
5369
5395
|
);
|
|
5370
5396
|
const i = [];
|
|
5371
5397
|
for (const s of t) {
|
|
5372
|
-
const o = await e.explain(s), r = Wn(o.tree), a =
|
|
5398
|
+
const o = await e.explain(s), r = Wn(o.tree), a = Dd(s, o), c = r.filter((u) => u.operator.endsWith("Scan") && u.estimatedRows !== null).map((u) => u.estimatedRows), l = c.length > 0 ? Math.max(...c) : null;
|
|
5373
5399
|
n.rowBudget !== void 0 && l !== null && l > n.rowBudget && a.push({
|
|
5374
5400
|
rule: "row-budget",
|
|
5375
5401
|
message: `the engine estimates ${l} rows scanned; the budget is ${n.rowBudget}`,
|
|
@@ -5392,18 +5418,18 @@ function dc(e) {
|
|
|
5392
5418
|
const t = e.operator === "CallSubquery" ? e.children.slice(0, 1) : e.children;
|
|
5393
5419
|
return [e, ...t.flatMap(dc)];
|
|
5394
5420
|
}
|
|
5395
|
-
function
|
|
5421
|
+
function _d(e, t) {
|
|
5396
5422
|
return e.length === t.length && e.every((n, i) => n === t[i]);
|
|
5397
5423
|
}
|
|
5398
|
-
const
|
|
5424
|
+
const Md = /* @__PURE__ */ new Set([
|
|
5399
5425
|
"EQ",
|
|
5400
5426
|
"IN",
|
|
5401
5427
|
"GT",
|
|
5402
5428
|
"GTE",
|
|
5403
5429
|
"LT",
|
|
5404
5430
|
"LTE"
|
|
5405
|
-
]), Jo = (e, t) => e.settableOn[t],
|
|
5406
|
-
function
|
|
5431
|
+
]), Jo = (e, t) => e.settableOn[t], Ud = (e) => e.constraints !== void 0 && Object.keys(e.constraints).some((t) => t !== "normalize");
|
|
5432
|
+
function jd(e, t = {}) {
|
|
5407
5433
|
const n = [];
|
|
5408
5434
|
for (const i of e.mutations)
|
|
5409
5435
|
i.writes && !i.reports && n.push({
|
|
@@ -5427,11 +5453,11 @@ function Ud(e, t = {}) {
|
|
|
5427
5453
|
type: i.name,
|
|
5428
5454
|
field: s.name,
|
|
5429
5455
|
message: "@unique on text a client supplies, without @normalize: 'Ada@x.com', 'ada@x.com' and 'ada@x.com ' are three values. Add @normalize(trim: true, case: LOWER) if they should be one"
|
|
5430
|
-
}), s.key && s.generate &&
|
|
5456
|
+
}), s.key && s.generate && Ud(s) && n.push({
|
|
5431
5457
|
type: i.name,
|
|
5432
5458
|
field: s.name,
|
|
5433
5459
|
message: "validation rules on a @key(generate: true) apply only to a key the client supplies; a generated UUID is stored as it is"
|
|
5434
|
-
}), (s.type === "Boolean" || s.type === "Enum") && !s.list && !s.unique && !s.key && s.indexes.length === 0 && (Yr(e, i, s) || [...s.filters].some((o) =>
|
|
5460
|
+
}), (s.type === "Boolean" || s.type === "Enum") && !s.list && !s.unique && !s.key && s.indexes.length === 0 && (Yr(e, i, s) || [...s.filters].some((o) => Md.has(o))) && n.push({
|
|
5435
5461
|
type: i.name,
|
|
5436
5462
|
field: s.name,
|
|
5437
5463
|
message: `an index is inferred for this ${s.type === "Boolean" ? "Boolean" : `enum (${s.enumName ?? "Enum"})`}, which has few distinct values: a filter on it alone still reads a large share of the label. It helps next to a selective filter, not instead of one`
|
|
@@ -5447,7 +5473,7 @@ function Ud(e, t = {}) {
|
|
|
5447
5473
|
}
|
|
5448
5474
|
return n;
|
|
5449
5475
|
}
|
|
5450
|
-
function
|
|
5476
|
+
function Ld(e) {
|
|
5451
5477
|
const t = [];
|
|
5452
5478
|
for (const n of e.nodes.values()) {
|
|
5453
5479
|
const i = (o) => [
|
|
@@ -5480,7 +5506,7 @@ function fc(e, t, n = !1) {
|
|
|
5480
5506
|
return i;
|
|
5481
5507
|
}
|
|
5482
5508
|
}
|
|
5483
|
-
function
|
|
5509
|
+
function Pd(e, t) {
|
|
5484
5510
|
const n = Ws(e);
|
|
5485
5511
|
if (n)
|
|
5486
5512
|
return n.filter.length > 0 && t(
|
|
@@ -5515,7 +5541,7 @@ function Ws(e) {
|
|
|
5515
5541
|
} : {}
|
|
5516
5542
|
};
|
|
5517
5543
|
}
|
|
5518
|
-
const
|
|
5544
|
+
const xd = /* @__PURE__ */ new Set([
|
|
5519
5545
|
"READ",
|
|
5520
5546
|
"CREATE",
|
|
5521
5547
|
"UPDATE"
|
|
@@ -5545,7 +5571,7 @@ function Yo(e) {
|
|
|
5545
5571
|
);
|
|
5546
5572
|
}
|
|
5547
5573
|
const tn = (e) => [...e.operations].some((t) => Us.has(t));
|
|
5548
|
-
function
|
|
5574
|
+
function Fd(e, t, n) {
|
|
5549
5575
|
const i = /* @__PURE__ */ new Map(), s = e.authorization;
|
|
5550
5576
|
if (!s) return i;
|
|
5551
5577
|
const o = s.validate.filter(tn), r = s.validate.filter((a) => !tn(a));
|
|
@@ -5557,7 +5583,7 @@ function xd(e, t, n) {
|
|
|
5557
5583
|
}
|
|
5558
5584
|
return i;
|
|
5559
5585
|
}
|
|
5560
|
-
const qe = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ft = (e, t) => e.model?.nodes.get(t.name) ?? t, ts = (e, t, n) => ft(e, t).fields.get(n.name) ?? n,
|
|
5586
|
+
const qe = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ft = (e, t) => e.model?.nodes.get(t.name) ?? t, ts = (e, t, n) => ft(e, t).fields.get(n.name) ?? n, zd = (e, t, n) => e.model?.relationshipProperties.get(t.name)?.fields.get(n.name) ?? n;
|
|
5561
5587
|
function pc(e) {
|
|
5562
5588
|
const t = e.viewer?.claim ?? "sub", n = bs(e, { [t]: "someone" }), i = /* @__PURE__ */ new Map(), s = (c) => {
|
|
5563
5589
|
if (Array.isArray(c)) return c.forEach(s);
|
|
@@ -5592,7 +5618,7 @@ function pc(e) {
|
|
|
5592
5618
|
for (const l of c.fields.values()) s(r(l.authorization));
|
|
5593
5619
|
for (const c of [...e.queries, ...e.mutations])
|
|
5594
5620
|
s(r(c.authorization)), s(o(c.authenticationJwt));
|
|
5595
|
-
const a =
|
|
5621
|
+
const a = Bd(e);
|
|
5596
5622
|
return [
|
|
5597
5623
|
{ name: "anonymous", jwt: void 0 },
|
|
5598
5624
|
{ name: "authenticated", jwt: n },
|
|
@@ -5606,7 +5632,7 @@ function pc(e) {
|
|
|
5606
5632
|
}))
|
|
5607
5633
|
];
|
|
5608
5634
|
}
|
|
5609
|
-
function
|
|
5635
|
+
function Bd(e) {
|
|
5610
5636
|
const t = e.viewer;
|
|
5611
5637
|
if (!t) return;
|
|
5612
5638
|
let n = !1;
|
|
@@ -5704,7 +5730,7 @@ function hc(e, t) {
|
|
|
5704
5730
|
return Hs(s, n);
|
|
5705
5731
|
}
|
|
5706
5732
|
}
|
|
5707
|
-
const
|
|
5733
|
+
const qd = ["READ", "CREATE", "UPDATE"];
|
|
5708
5734
|
function Zo(e, t) {
|
|
5709
5735
|
return (e.authentication?.has(t) ?? !1) || (e.authorization?.validate.some((n) => n.operations.has(t)) ?? !1);
|
|
5710
5736
|
}
|
|
@@ -5716,7 +5742,7 @@ function mc(e, t) {
|
|
|
5716
5742
|
)
|
|
5717
5743
|
];
|
|
5718
5744
|
}
|
|
5719
|
-
function
|
|
5745
|
+
function Wd(e, t, n, i) {
|
|
5720
5746
|
const s = mc(n, i);
|
|
5721
5747
|
try {
|
|
5722
5748
|
return be(e, t.name, n, i), n.authorization?.validate.some((r) => r.operations.has(i)) && Ue(e, t) ? { verdict: "allowed", by: ["bypass"] } : Le(e, t, n, "n", i, "BEFORE") ?? Le(e, t, n, "n", i, "AFTER") ? { verdict: "validated", by: s } : { verdict: "allowed", by: s };
|
|
@@ -5724,7 +5750,7 @@ function qd(e, t, n, i) {
|
|
|
5724
5750
|
return Hs(o, s);
|
|
5725
5751
|
}
|
|
5726
5752
|
}
|
|
5727
|
-
function
|
|
5753
|
+
function Hd(e, t, n) {
|
|
5728
5754
|
const i = mc(t, n);
|
|
5729
5755
|
if (t.authorization?.validate.some((r) => r.operations.has(n)) && Ue(e, void 0) && !t.authentication?.has(n))
|
|
5730
5756
|
return { verdict: "allowed", by: ["bypass"] };
|
|
@@ -5732,14 +5758,14 @@ function Wd(e, t, n) {
|
|
|
5732
5758
|
return { verdict: s === "allowed" ? "allowed" : s === "unauthenticated" ? "unauthenticated" : s === "forbidden" ? "denied" : "validated", by: i };
|
|
5733
5759
|
}
|
|
5734
5760
|
function nn(e, t, n) {
|
|
5735
|
-
const i =
|
|
5761
|
+
const i = Vd(e, t, n);
|
|
5736
5762
|
if (n !== "CREATE" || !t.key.keyScope || !e.model.viewer || i.verdict === "denied" || i.verdict === "unauthenticated" || Ue(e, t))
|
|
5737
5763
|
return i;
|
|
5738
5764
|
const s = [...i.by.filter((o) => o !== "no rule"), "key scope"];
|
|
5739
5765
|
return { verdict: e.jwt ? "validated" : "unauthenticated", by: s };
|
|
5740
5766
|
}
|
|
5741
|
-
function
|
|
5742
|
-
const i =
|
|
5767
|
+
function Vd(e, t, n) {
|
|
5768
|
+
const i = Qd(t, n);
|
|
5743
5769
|
try {
|
|
5744
5770
|
if (me(e, t, n), Ue(e, t)) return { verdict: "allowed", by: ["bypass"] };
|
|
5745
5771
|
const s = n === "CREATE" ? void 0 : ce(e, t, "n", n);
|
|
@@ -5750,7 +5776,7 @@ function Hd(e, t, n) {
|
|
|
5750
5776
|
return Hs(s, i);
|
|
5751
5777
|
}
|
|
5752
5778
|
}
|
|
5753
|
-
function
|
|
5779
|
+
function Gd(e, t, n) {
|
|
5754
5780
|
const i = [
|
|
5755
5781
|
...n.authentication?.has("READ") ? ["@authentication"] : [],
|
|
5756
5782
|
...(n.authorization?.validate ?? []).flatMap(
|
|
@@ -5785,7 +5811,7 @@ function yc(e, t, n, i) {
|
|
|
5785
5811
|
return Hs(a, r);
|
|
5786
5812
|
}
|
|
5787
5813
|
}
|
|
5788
|
-
function
|
|
5814
|
+
function Qd(e, t) {
|
|
5789
5815
|
return [
|
|
5790
5816
|
...e.authentication?.has(t) ? ["@authentication"] : [],
|
|
5791
5817
|
...(e.authorization?.filter ?? []).flatMap(
|
|
@@ -5807,7 +5833,7 @@ function Hs(e, t) {
|
|
|
5807
5833
|
throw e;
|
|
5808
5834
|
}
|
|
5809
5835
|
const wc = (e) => P(e) === "false";
|
|
5810
|
-
function
|
|
5836
|
+
function Kd(e, t) {
|
|
5811
5837
|
const n = [], i = e.viewer?.claim ?? "sub", s = nt(
|
|
5812
5838
|
{ schema: t, fragments: {}, variables: {} },
|
|
5813
5839
|
e,
|
|
@@ -5835,10 +5861,10 @@ function Qd(e, t) {
|
|
|
5835
5861
|
});
|
|
5836
5862
|
}
|
|
5837
5863
|
return n.push(
|
|
5838
|
-
...
|
|
5839
|
-
...Zd(e, s),
|
|
5864
|
+
...Xd(e),
|
|
5840
5865
|
...ef(e, s),
|
|
5841
|
-
...tf(
|
|
5866
|
+
...tf(e, s),
|
|
5867
|
+
...nf(
|
|
5842
5868
|
e,
|
|
5843
5869
|
() => nt({ schema: t, fragments: {}, variables: {} }, e, {
|
|
5844
5870
|
jwt: bs(e, { [i]: "someone" })
|
|
@@ -5846,7 +5872,7 @@ function Qd(e, t) {
|
|
|
5846
5872
|
)
|
|
5847
5873
|
), n;
|
|
5848
5874
|
}
|
|
5849
|
-
function
|
|
5875
|
+
function Xd(e) {
|
|
5850
5876
|
if (!e.bypass) return [];
|
|
5851
5877
|
const t = [];
|
|
5852
5878
|
for (const s of e.nodes.values()) {
|
|
@@ -5901,25 +5927,25 @@ function ki(e, t, n, i) {
|
|
|
5901
5927
|
}
|
|
5902
5928
|
const r = t.fields.has(s) ? s : s.replace(/(Connection|Aggregate|Exists)$/, ""), a = t.fields.get(r);
|
|
5903
5929
|
if (!a || a.kind !== "scalar" && a.kind !== "relationship") continue;
|
|
5904
|
-
const c = a.kind === "relationship" && s === r &&
|
|
5930
|
+
const c = a.kind === "relationship" && s === r && Jd(o, n.nodes.get(a.target));
|
|
5905
5931
|
i.set(r, { pinned: (i.get(r)?.pinned ?? !0) && c });
|
|
5906
5932
|
}
|
|
5907
5933
|
}
|
|
5908
|
-
function
|
|
5934
|
+
function Jd(e, t) {
|
|
5909
5935
|
if (!t || !Fe(e)) return !1;
|
|
5910
5936
|
const n = Object.keys(e);
|
|
5911
5937
|
if (n.length !== 1) return !1;
|
|
5912
5938
|
const i = t.fields.get(n[0]), s = e[n[0]];
|
|
5913
5939
|
return i?.kind === "scalar" && (i.key || i.unique) && !i.list && Fe(s) && Object.keys(s).length === 1 && typeof s.eq == "string" && s.eq.startsWith("$");
|
|
5914
5940
|
}
|
|
5915
|
-
const
|
|
5941
|
+
const Yd = ["CONNECT", "DISCONNECT", "CREATE"];
|
|
5916
5942
|
function vc(e, t) {
|
|
5917
|
-
return t.kind !== "relationship" || t.list || !e.mutations.has("UPDATE") || !t.settableOn.update ? [] :
|
|
5943
|
+
return t.kind !== "relationship" || t.list || !e.mutations.has("UPDATE") || !t.settableOn.update ? [] : Yd.filter((n) => t.nestedOperations.has(n));
|
|
5918
5944
|
}
|
|
5919
|
-
function
|
|
5945
|
+
function Zd(e, t) {
|
|
5920
5946
|
return t.kind === "scalar" ? e.mutations.has("UPDATE") && t.settableOn.update && !t.readonly : vc(e, t).length > 0;
|
|
5921
5947
|
}
|
|
5922
|
-
function
|
|
5948
|
+
function ef(e, t) {
|
|
5923
5949
|
const n = [];
|
|
5924
5950
|
for (const i of e.nodes.values()) {
|
|
5925
5951
|
if (!i.mutations.has("UPDATE")) continue;
|
|
@@ -5965,7 +5991,7 @@ function Zd(e, t) {
|
|
|
5965
5991
|
});
|
|
5966
5992
|
for (const [u, d] of l) {
|
|
5967
5993
|
const f = i.fields.get(u);
|
|
5968
|
-
c.has(u) || !
|
|
5994
|
+
c.has(u) || !Zd(i, f) || f.authorization?.validate.some((p) => p.operations.has("UPDATE")) || f.kind !== "relationship" || f.list || n.push({
|
|
5969
5995
|
type: i.name,
|
|
5970
5996
|
field: u,
|
|
5971
5997
|
message: `${d.join(", ")} ${d.length === 1 ? "tests" : "test"} ${u} on CREATE, but UPDATE can re-point it and no UPDATE rule tests it: a caller can create the ${i.name} as the rule demands, then change ${u}; declare ${u} @settable(onCreate: true, onUpdate: false), or add an UPDATE rule that tests it`
|
|
@@ -5974,7 +6000,7 @@ function Zd(e, t) {
|
|
|
5974
6000
|
}
|
|
5975
6001
|
return n;
|
|
5976
6002
|
}
|
|
5977
|
-
function
|
|
6003
|
+
function tf(e, t) {
|
|
5978
6004
|
const n = [], i = (o, r) => {
|
|
5979
6005
|
const a = o.fields.get(r);
|
|
5980
6006
|
return a?.kind === "scalar" && (a.authorization?.mask?.length ?? 0) > 0 && !zs(t, o, a);
|
|
@@ -6015,7 +6041,7 @@ function ef(e, t) {
|
|
|
6015
6041
|
}
|
|
6016
6042
|
return n;
|
|
6017
6043
|
}
|
|
6018
|
-
function
|
|
6044
|
+
function nf(e, t) {
|
|
6019
6045
|
const n = [], i = e.viewer?.claim ?? "sub", s = (o, r) => {
|
|
6020
6046
|
const { verdict: a } = nn(t(), o, r);
|
|
6021
6047
|
return a === "denied" || a === "unauthenticated";
|
|
@@ -6047,7 +6073,7 @@ function tf(e, t) {
|
|
|
6047
6073
|
}
|
|
6048
6074
|
return n;
|
|
6049
6075
|
}
|
|
6050
|
-
const
|
|
6076
|
+
const sf = ["CREATE", "UPDATE", "DELETE"], of = ["CONNECT", "DISCONNECT", "UPDATE_EDGE"];
|
|
6051
6077
|
function er(e, t, n) {
|
|
6052
6078
|
const i = [], s = t ? { type: e.name, field: t.name } : { type: e.name }, o = [
|
|
6053
6079
|
...(n?.filter ?? []).map((a, c) => ({
|
|
@@ -6061,7 +6087,7 @@ function er(e, t, n) {
|
|
|
6061
6087
|
], r = "set @authorizationDefaults(requireAuthentication: false) if anonymous callers should get such";
|
|
6062
6088
|
for (const { r: a, label: c } of o) {
|
|
6063
6089
|
if (a.requireAuthenticationDefaulted) {
|
|
6064
|
-
const d =
|
|
6090
|
+
const d = cf(a.where);
|
|
6065
6091
|
d !== void 0 ? i.push({
|
|
6066
6092
|
...s,
|
|
6067
6093
|
message: `${c} has a branch that needs no claims (${d}), but requireAuthentication defaults to true, so anonymous callers are refused by the whole rule; ${r} branches, or true to say they should not`
|
|
@@ -6072,11 +6098,11 @@ function er(e, t, n) {
|
|
|
6072
6098
|
continue;
|
|
6073
6099
|
}
|
|
6074
6100
|
if (a.requireAuthentication) continue;
|
|
6075
|
-
const l = (t?.kind === "relationship" ?
|
|
6076
|
-
(d) => a.operations.has(d) && !n?.public?.has(d) && !e.authorization?.public?.has(d) && !
|
|
6101
|
+
const l = (t?.kind === "relationship" ? of : sf).filter(
|
|
6102
|
+
(d) => a.operations.has(d) && !n?.public?.has(d) && !e.authorization?.public?.has(d) && !af(e, t, d)
|
|
6077
6103
|
);
|
|
6078
6104
|
if (l.length === 0) continue;
|
|
6079
|
-
const u = l.map(
|
|
6105
|
+
const u = l.map(rf).join(", ");
|
|
6080
6106
|
i.push({
|
|
6081
6107
|
...s,
|
|
6082
6108
|
message: `${c} lets a signed-out caller ${l.join(", ")}: it needs no claims and requireAuthentication is false for the whole schema; test { jwt: { sub: { exists: true } } } beside it, or add @authentication(operations: [${u}])${t ? "" : ` to ${e.name}`}`
|
|
@@ -6084,14 +6110,14 @@ function er(e, t, n) {
|
|
|
6084
6110
|
}
|
|
6085
6111
|
return i;
|
|
6086
6112
|
}
|
|
6087
|
-
const
|
|
6088
|
-
function
|
|
6113
|
+
const rf = (e) => e === "CONNECT" ? "CREATE_RELATIONSHIP" : e === "DISCONNECT" ? "DELETE_RELATIONSHIP" : e === "UPDATE_EDGE" ? "UPDATE" : e;
|
|
6114
|
+
function af(e, t, n) {
|
|
6089
6115
|
const i = (r) => (e.authentication?.has(r) ?? !1) || t?.kind !== "custom" && (t?.authentication?.has(r) ?? !1);
|
|
6090
6116
|
if (t?.kind !== "relationship") return i(n);
|
|
6091
6117
|
const s = n === "CONNECT" ? "CREATE_RELATIONSHIP" : n === "DISCONNECT" ? "DELETE_RELATIONSHIP" : void 0;
|
|
6092
6118
|
return s && i(s) ? !0 : (n === "CONNECT" ? ["CREATE", "UPDATE"] : ["UPDATE"]).every(i);
|
|
6093
6119
|
}
|
|
6094
|
-
function
|
|
6120
|
+
function cf(e) {
|
|
6095
6121
|
const t = e.OR;
|
|
6096
6122
|
if (!Array.isArray(t)) return;
|
|
6097
6123
|
const n = t.findIndex((i) => !Ni(i));
|
|
@@ -6129,10 +6155,10 @@ const ue = {
|
|
|
6129
6155
|
function $s(e) {
|
|
6130
6156
|
return e.required && !e.defaultValue && !e.timestamp?.has("CREATE") && !e.populatedBy?.operations.has("CREATE") && !(e.key && e.generate);
|
|
6131
6157
|
}
|
|
6132
|
-
function
|
|
6158
|
+
function lf(e) {
|
|
6133
6159
|
return !Se(e, "UPDATE") || e.vector ? !1 : e.list ? e.type !== "Point" && e.type !== "CartesianPoint" : e.type === "Int" || e.type === "Float" || e.type === "BigInt";
|
|
6134
6160
|
}
|
|
6135
|
-
function
|
|
6161
|
+
function uf(e, t) {
|
|
6136
6162
|
const { model: n } = e, i = /* @__PURE__ */ new Map(), s = (b, A, O) => {
|
|
6137
6163
|
let T = i.get(b);
|
|
6138
6164
|
return T || (T = new Ae({ name: b, fields: A, description: O }), i.set(b, T)), T;
|
|
@@ -6372,7 +6398,7 @@ function lf(e, t) {
|
|
|
6372
6398
|
}
|
|
6373
6399
|
return T;
|
|
6374
6400
|
}, k = (b) => {
|
|
6375
|
-
const A = E(b).filter(
|
|
6401
|
+
const A = E(b).filter(lf);
|
|
6376
6402
|
if (A.length !== 0)
|
|
6377
6403
|
return s(
|
|
6378
6404
|
ue.adjustInput(b.name),
|
|
@@ -6470,7 +6496,7 @@ function tr(e) {
|
|
|
6470
6496
|
for (const n of e) t = Math.min(t, ti.indexOf(n));
|
|
6471
6497
|
return ti[t];
|
|
6472
6498
|
}
|
|
6473
|
-
function
|
|
6499
|
+
function df(e) {
|
|
6474
6500
|
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = (r) => ({
|
|
6475
6501
|
kind: "node",
|
|
6476
6502
|
node: r,
|
|
@@ -6555,11 +6581,11 @@ function Si(e, t, n, i, s) {
|
|
|
6555
6581
|
Fe(m) && (Fe(m.edge) && a("UPDATE_EDGE"), Fe(m.node) && (s.push({ kind: "type", node: h, op: "UPDATE" }), Si(e, h, m.node, !0, s)));
|
|
6556
6582
|
}
|
|
6557
6583
|
}
|
|
6558
|
-
function
|
|
6584
|
+
function ff(e, t, n, i, s = {}) {
|
|
6559
6585
|
const o = pc(e), r = (u) => nt({ schema: t, fragments: {}, variables: {} }, u.model ?? e, {
|
|
6560
6586
|
jwt: u.jwt,
|
|
6561
6587
|
unknownContext: !0
|
|
6562
|
-
}), a =
|
|
6588
|
+
}), a = df(e)[n.operation], c = [];
|
|
6563
6589
|
for (const u of Ri(n.selectionSet, i)) {
|
|
6564
6590
|
const d = u.name.value;
|
|
6565
6591
|
if (d === "__typename") continue;
|
|
@@ -6657,7 +6683,7 @@ function Ri(e, t, n = /* @__PURE__ */ new Set()) {
|
|
|
6657
6683
|
}
|
|
6658
6684
|
return i;
|
|
6659
6685
|
}
|
|
6660
|
-
function
|
|
6686
|
+
function pf(e, t) {
|
|
6661
6687
|
const n = pc(e), i = [], s = (o) => nt({ schema: t, fragments: {}, variables: {} }, o.model ?? e, {
|
|
6662
6688
|
jwt: o.jwt,
|
|
6663
6689
|
unknownContext: !0
|
|
@@ -6709,7 +6735,7 @@ function ff(e, t) {
|
|
|
6709
6735
|
field: a.name,
|
|
6710
6736
|
operation: "READ",
|
|
6711
6737
|
principal: l.name,
|
|
6712
|
-
...
|
|
6738
|
+
...Gd(s(l), ft(l, o), ts(l, o, a))
|
|
6713
6739
|
});
|
|
6714
6740
|
if (a.kind === "scalar") {
|
|
6715
6741
|
for (const l of ["CREATE", "UPDATE"])
|
|
@@ -6720,7 +6746,7 @@ function ff(e, t) {
|
|
|
6720
6746
|
field: a.name,
|
|
6721
6747
|
operation: l,
|
|
6722
6748
|
principal: u.name,
|
|
6723
|
-
...
|
|
6749
|
+
...Wd(
|
|
6724
6750
|
s(u),
|
|
6725
6751
|
ft(u, o),
|
|
6726
6752
|
ts(u, o, a),
|
|
@@ -6732,7 +6758,7 @@ function ff(e, t) {
|
|
|
6732
6758
|
}
|
|
6733
6759
|
for (const o of [...e.relationshipProperties.values()].sort(bt))
|
|
6734
6760
|
for (const r of [...o.fields.values()].sort(bt))
|
|
6735
|
-
for (const a of
|
|
6761
|
+
for (const a of qd)
|
|
6736
6762
|
if (Zo(r, a))
|
|
6737
6763
|
for (const c of n)
|
|
6738
6764
|
i.push({
|
|
@@ -6740,7 +6766,7 @@ function ff(e, t) {
|
|
|
6740
6766
|
field: r.name,
|
|
6741
6767
|
operation: a,
|
|
6742
6768
|
principal: c.name,
|
|
6743
|
-
...
|
|
6769
|
+
...Hd(s(c), zd(c, o, r), a)
|
|
6744
6770
|
});
|
|
6745
6771
|
for (const o of [
|
|
6746
6772
|
...[...e.queries].sort(bt),
|
|
@@ -6757,7 +6783,7 @@ function ff(e, t) {
|
|
|
6757
6783
|
return i;
|
|
6758
6784
|
}
|
|
6759
6785
|
const bt = (e, t) => e.name < t.name ? -1 : e.name > t.name ? 1 : 0;
|
|
6760
|
-
async function
|
|
6786
|
+
async function hf(e, t, n = {}) {
|
|
6761
6787
|
const i = n.sample ?? 1e3, s = { nodes: {}, degrees: {} };
|
|
6762
6788
|
for (const o of t.nodes.values()) {
|
|
6763
6789
|
const r = R(o.labels[0]), a = [
|
|
@@ -6787,13 +6813,13 @@ async function pf(e, t, n = {}) {
|
|
|
6787
6813
|
s.nodes[o.name] = Number(l.rows[0]?.c ?? 0), c.forEach((d, f) => {
|
|
6788
6814
|
const p = u[2 * f].rows.map((g) => Number(g.d)).sort(
|
|
6789
6815
|
(g, y) => g - y
|
|
6790
|
-
), h =
|
|
6816
|
+
), h = mf(p), m = Number(u[2 * f + 1].rows[0]?.m ?? 0);
|
|
6791
6817
|
h.max = Math.max(h.max, m), s.degrees[`${o.name}.${d.name}`] = h;
|
|
6792
6818
|
});
|
|
6793
6819
|
}
|
|
6794
6820
|
return s;
|
|
6795
6821
|
}
|
|
6796
|
-
function
|
|
6822
|
+
function mf(e) {
|
|
6797
6823
|
const t = (n) => e.length === 0 ? 0 : e[Math.min(e.length - 1, Math.floor(n * e.length))];
|
|
6798
6824
|
return {
|
|
6799
6825
|
sampled: e.length,
|
|
@@ -6803,8 +6829,8 @@ function hf(e) {
|
|
|
6803
6829
|
max: e.length === 0 ? 0 : e[e.length - 1]
|
|
6804
6830
|
};
|
|
6805
6831
|
}
|
|
6806
|
-
const
|
|
6807
|
-
class
|
|
6832
|
+
const gf = 16, $c = 4096, Tc = 64 * 1024 * 1024, yf = 16 * 1024, Ef = 1024;
|
|
6833
|
+
class wf {
|
|
6808
6834
|
#e = /* @__PURE__ */ new WeakMap();
|
|
6809
6835
|
/**
|
|
6810
6836
|
* Every live entry, oldest first, with its field's entry list, for the
|
|
@@ -6844,9 +6870,9 @@ class Ef {
|
|
|
6844
6870
|
*/
|
|
6845
6871
|
get(t, n) {
|
|
6846
6872
|
const i = t.fieldNodes[0], s = t.rebindable ?? [], o = this.#d(t)?.once, r = o && !this.#o.has(i) && s.every(
|
|
6847
|
-
(E) => o.has(E) &&
|
|
6873
|
+
(E) => o.has(E) && bf(t.variables?.[E])
|
|
6848
6874
|
) ? s : [], a = this.#f(t, r);
|
|
6849
|
-
if (a === void 0 || a.length >
|
|
6875
|
+
if (a === void 0 || a.length > yf)
|
|
6850
6876
|
return n(t.jwt).compiled;
|
|
6851
6877
|
const c = !!t.jwt, l = r.join("\0"), u = this.#e.get(i) ?? [];
|
|
6852
6878
|
for (const E of u)
|
|
@@ -6876,11 +6902,11 @@ class Ef {
|
|
|
6876
6902
|
slotPaths: [...new Set(h.map((E) => E.path))],
|
|
6877
6903
|
contextReads: f.contextReads,
|
|
6878
6904
|
compiled: d.template,
|
|
6879
|
-
bytes:
|
|
6905
|
+
bytes: vf(a, g, p)
|
|
6880
6906
|
};
|
|
6881
6907
|
if (y.bytes > this.#r) return p;
|
|
6882
6908
|
this.#e.has(i) || (this.#e.set(i, u), this.#s?.register(i, u)), u.unshift(y), this.#t.set(y, u), this.#c += y.bytes;
|
|
6883
|
-
for (const E of u.splice(
|
|
6909
|
+
for (const E of u.splice(gf))
|
|
6884
6910
|
this.#l(E);
|
|
6885
6911
|
for (; this.#t.size > this.#a || this.#c > this.#r; ) {
|
|
6886
6912
|
const [E, v] = this.#t.entries().next().value;
|
|
@@ -6935,7 +6961,7 @@ class Ef {
|
|
|
6935
6961
|
const y = r();
|
|
6936
6962
|
return c && this.#n.set(t, []), i.length > 0 && this.#o.add(t), y;
|
|
6937
6963
|
}
|
|
6938
|
-
const m = c ?
|
|
6964
|
+
const m = c ? Tf(h, a, d) : [], g = i.length > 0 ? $f(h, i, p) : [];
|
|
6939
6965
|
if (m && g) {
|
|
6940
6966
|
const y = { compiled: h.compiled, slots: m, variableSlots: g };
|
|
6941
6967
|
return {
|
|
@@ -6970,14 +6996,14 @@ class Ef {
|
|
|
6970
6996
|
#d(t) {
|
|
6971
6997
|
const n = t.fieldNodes[0];
|
|
6972
6998
|
let i = this.#i.get(n);
|
|
6973
|
-
return i === void 0 && (i =
|
|
6999
|
+
return i === void 0 && (i = Af(t.fieldNodes, t.fragments), this.#i.set(n, i)), i;
|
|
6974
7000
|
}
|
|
6975
7001
|
}
|
|
6976
|
-
function
|
|
7002
|
+
function vf(e, t, n) {
|
|
6977
7003
|
let i = 2 * e.length;
|
|
6978
7004
|
for (const [s, o] of t) i += s.length + o.length;
|
|
6979
7005
|
for (const s of n.statements) i += s.text.length;
|
|
6980
|
-
return 2 * i +
|
|
7006
|
+
return 2 * i + Ef;
|
|
6981
7007
|
}
|
|
6982
7008
|
function ni(e) {
|
|
6983
7009
|
return typeof e == "string" && e.length > 0;
|
|
@@ -6986,10 +7012,10 @@ function Ii(e, t) {
|
|
|
6986
7012
|
return t === "" ? e : Dt(e, t);
|
|
6987
7013
|
}
|
|
6988
7014
|
const ns = "\0lora-claim-", Ts = "\0lora-variable-", sr = JSON.stringify(Ts).slice(1, -1), Ac = Number.MIN_SAFE_INTEGER + 1024;
|
|
6989
|
-
function
|
|
7015
|
+
function bf(e) {
|
|
6990
7016
|
return typeof e == "string" && e.length > 0 && !e.includes("\0") || typeof e == "number" && Number.isSafeInteger(e) && e > Ac;
|
|
6991
7017
|
}
|
|
6992
|
-
function
|
|
7018
|
+
function $f(e, t, n) {
|
|
6993
7019
|
const i = [], s = e.compiled.statements;
|
|
6994
7020
|
for (let o = 0; o < s.length; o++) {
|
|
6995
7021
|
const { text: r, params: a } = s[o];
|
|
@@ -7011,7 +7037,7 @@ function bf(e, t, n) {
|
|
|
7011
7037
|
}
|
|
7012
7038
|
return t.every((o) => i.some((r) => r.name === o)) ? i : void 0;
|
|
7013
7039
|
}
|
|
7014
|
-
function
|
|
7040
|
+
function Tf(e, t, n) {
|
|
7015
7041
|
for (const o of t)
|
|
7016
7042
|
if (!e.ctx.claimReads.get(o)?.bound) return;
|
|
7017
7043
|
const i = [], s = e.compiled.statements;
|
|
@@ -7050,7 +7076,7 @@ function ir(e, t, n) {
|
|
|
7050
7076
|
o(r.statement, r.param, n?.[r.name]);
|
|
7051
7077
|
return { ...e.compiled, statements: i };
|
|
7052
7078
|
}
|
|
7053
|
-
function
|
|
7079
|
+
function Af(e, t) {
|
|
7054
7080
|
const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
7055
7081
|
let s = !0;
|
|
7056
7082
|
const o = (r) => {
|
|
@@ -7105,25 +7131,25 @@ function kn(e, t, n, i, s) {
|
|
|
7105
7131
|
const o = Ce(s);
|
|
7106
7132
|
switch (t) {
|
|
7107
7133
|
case "list":
|
|
7108
|
-
return kf(e, n, i, o);
|
|
7109
|
-
case "single":
|
|
7110
7134
|
return Nf(e, n, i, o);
|
|
7111
|
-
case "
|
|
7135
|
+
case "single":
|
|
7112
7136
|
return Sf(e, n, i, o);
|
|
7137
|
+
case "connection":
|
|
7138
|
+
return Rf(e, n, i, o);
|
|
7113
7139
|
case "aggregate":
|
|
7114
|
-
return Zu(e, n, i, o);
|
|
7115
|
-
case "grouped":
|
|
7116
7140
|
return ed(e, n, i, o);
|
|
7141
|
+
case "grouped":
|
|
7142
|
+
return td(e, n, i, o);
|
|
7117
7143
|
}
|
|
7118
7144
|
}
|
|
7119
|
-
function
|
|
7145
|
+
function kf(e, t, n) {
|
|
7120
7146
|
if (e !== "single" || n.length !== 1) return;
|
|
7121
7147
|
const i = n[0].arguments?.find(
|
|
7122
7148
|
(s) => s.name.value === t.key.name
|
|
7123
7149
|
)?.value;
|
|
7124
7150
|
return i?.kind === fe.VARIABLE ? [i.name.value] : void 0;
|
|
7125
7151
|
}
|
|
7126
|
-
function
|
|
7152
|
+
function Nf(e, t, n, i) {
|
|
7127
7153
|
const s = Ot(n.limit, t.limit, "limit"), o = qs(e, t, n.sort, !1), r = n.where, a = Un(e, t, r, o);
|
|
7128
7154
|
e.cost += zt(e, t, r, s);
|
|
7129
7155
|
const c = Ze(e, t, "this", i, s), l = [
|
|
@@ -7148,7 +7174,7 @@ function kf(e, t, n, i) {
|
|
|
7148
7174
|
a.expectation
|
|
7149
7175
|
);
|
|
7150
7176
|
}
|
|
7151
|
-
function
|
|
7177
|
+
function Sf(e, t, n, i) {
|
|
7152
7178
|
me(e, t, "READ");
|
|
7153
7179
|
const s = t.labels[0];
|
|
7154
7180
|
e.reads.labels.add(s);
|
|
@@ -7181,7 +7207,7 @@ function Nf(e, t, n, i) {
|
|
|
7181
7207
|
}
|
|
7182
7208
|
) && c.reads.relationships.length === 0 && c.statements.length === 1 && (c.bounded = !0), c;
|
|
7183
7209
|
}
|
|
7184
|
-
function
|
|
7210
|
+
function Rf(e, t, n, i) {
|
|
7185
7211
|
const { first: s, sort: o, signature: r, cursor: a, backward: c } = Ia(
|
|
7186
7212
|
e,
|
|
7187
7213
|
t,
|
|
@@ -7281,7 +7307,7 @@ function Sf(e, t, n, i) {
|
|
|
7281
7307
|
if (f.aggregate) {
|
|
7282
7308
|
I = { count: D?.totalCount ?? 0 };
|
|
7283
7309
|
for (const { column: k, path: C } of E)
|
|
7284
|
-
|
|
7310
|
+
If(I, C, D?.[k] ?? null);
|
|
7285
7311
|
}
|
|
7286
7312
|
return {
|
|
7287
7313
|
__rows: ($?.rows ?? []).map((k) => ({
|
|
@@ -7298,18 +7324,18 @@ function Sf(e, t, n, i) {
|
|
|
7298
7324
|
}
|
|
7299
7325
|
};
|
|
7300
7326
|
}
|
|
7301
|
-
function
|
|
7327
|
+
function If(e, t, n) {
|
|
7302
7328
|
let i = e;
|
|
7303
7329
|
for (const s of t.slice(0, -1))
|
|
7304
7330
|
i = i[s] ??= {};
|
|
7305
7331
|
i[t[t.length - 1]] = n;
|
|
7306
7332
|
}
|
|
7307
|
-
const
|
|
7333
|
+
const Df = "score:DESC,key:ASC";
|
|
7308
7334
|
function or(e, t, n, i, s, o = !1) {
|
|
7309
7335
|
me(e, t, "READ");
|
|
7310
7336
|
const r = t.labels[0];
|
|
7311
7337
|
e.reads.labels.add(r);
|
|
7312
|
-
const a = o ? Ot(i.first, t.limit, "first") : Ot(i.limit, t.limit, "limit"), c = o ? i.after : null, l = i.sort, u = l && l.length > 0 ? qs(e, t, l, !0) : void 0, d = u ? Da(u) :
|
|
7338
|
+
const a = o ? Ot(i.first, t.limit, "first") : Ot(i.limit, t.limit, "limit"), c = o ? i.after : null, l = i.sort, u = l && l.length > 0 ? qs(e, t, l, !0) : void 0, d = u ? Da(u) : Df, f = c != null ? Ta(
|
|
7313
7339
|
c,
|
|
7314
7340
|
d,
|
|
7315
7341
|
u ? u.length : 2,
|
|
@@ -7327,7 +7353,7 @@ function or(e, t, n, i, s, o = !1) {
|
|
|
7327
7353
|
$
|
|
7328
7354
|
), D = [];
|
|
7329
7355
|
if (n.kind === "fulltext") {
|
|
7330
|
-
const O =
|
|
7356
|
+
const O = Of(
|
|
7331
7357
|
i.query,
|
|
7332
7358
|
n.minPrefixLength
|
|
7333
7359
|
);
|
|
@@ -7390,7 +7416,7 @@ function or(e, t, n, i, s, o = !1) {
|
|
|
7390
7416
|
yields: [{ item: "node", alias: "this" }, { item: "score" }],
|
|
7391
7417
|
where: pe(A, C, N)
|
|
7392
7418
|
}), D;
|
|
7393
|
-
}, m = o ?
|
|
7419
|
+
}, m = o ? Cf(e, t, s) : void 0;
|
|
7394
7420
|
if (m && !m.page)
|
|
7395
7421
|
return rr(e, t, n, i, h, (v) => ({
|
|
7396
7422
|
__rows: [],
|
|
@@ -7402,7 +7428,7 @@ function or(e, t, n, i, s, o = !1) {
|
|
|
7402
7428
|
}));
|
|
7403
7429
|
const g = h(e, p);
|
|
7404
7430
|
e.cost += Nc(e, t, n, i);
|
|
7405
|
-
const y = m ? m.node :
|
|
7431
|
+
const y = m ? m.node : _f(e, t, s), E = Ze(e, t, "this", y, a);
|
|
7406
7432
|
if (g.push(
|
|
7407
7433
|
{
|
|
7408
7434
|
kind: "with",
|
|
@@ -7502,13 +7528,13 @@ function Nc(e, t, n, i) {
|
|
|
7502
7528
|
ca(e, t, t.limit.default)
|
|
7503
7529
|
) * (1 + pt(e, t, i.where));
|
|
7504
7530
|
}
|
|
7505
|
-
function
|
|
7531
|
+
function Of(e, t) {
|
|
7506
7532
|
return t === void 0 || t <= 1 ? e : e.replace(
|
|
7507
7533
|
/([\p{L}\p{N}]+)\*/gu,
|
|
7508
7534
|
(n, i) => [...i].length < t ? i : n
|
|
7509
7535
|
);
|
|
7510
7536
|
}
|
|
7511
|
-
function
|
|
7537
|
+
function Cf(e, t, n) {
|
|
7512
7538
|
const i = e.schema.getType(
|
|
7513
7539
|
Z.searchConnection(t.name)
|
|
7514
7540
|
), s = e.schema.getType(
|
|
@@ -7523,7 +7549,7 @@ function Of(e, t, n) {
|
|
|
7523
7549
|
void 0
|
|
7524
7550
|
);
|
|
7525
7551
|
}
|
|
7526
|
-
function
|
|
7552
|
+
function _f(e, t, n) {
|
|
7527
7553
|
const i = e.schema.getType(
|
|
7528
7554
|
Z.match(t.name)
|
|
7529
7555
|
), s = [];
|
|
@@ -7535,7 +7561,7 @@ function Cf(e, t, n) {
|
|
|
7535
7561
|
o[0].name.value === "node" && s.push(...Ce(o));
|
|
7536
7562
|
return s;
|
|
7537
7563
|
}
|
|
7538
|
-
function
|
|
7564
|
+
function dm(e) {
|
|
7539
7565
|
const t = typeof e.execute == "function" ? e.execute.bind(e) : void 0, n = typeof e.stream == "function" ? e.stream.bind(e) : void 0, i = {
|
|
7540
7566
|
async run(s, o) {
|
|
7541
7567
|
const r = o.mode === "read" && o.verified && s.length === 1 ? s[0] : void 0;
|
|
@@ -7563,7 +7589,7 @@ function um(e) {
|
|
|
7563
7589
|
if (typeof e.begin == "function") {
|
|
7564
7590
|
const s = e.begin.bind(e);
|
|
7565
7591
|
i.begin = async (o) => {
|
|
7566
|
-
const r = Qn(o), a = await
|
|
7592
|
+
const r = Qn(o), a = await Uf(
|
|
7567
7593
|
s(o.mode === "read" ? "read_only" : "read_write", r),
|
|
7568
7594
|
r
|
|
7569
7595
|
), c = typeof a.executeMany == "function" ? a.executeMany.bind(a) : void 0;
|
|
@@ -7600,9 +7626,9 @@ function um(e) {
|
|
|
7600
7626
|
const s = e.explain.bind(e);
|
|
7601
7627
|
i.explain = (o) => s(o.text, o.params);
|
|
7602
7628
|
}
|
|
7603
|
-
return typeof e.changes == "function" && (i.changes = e.changes.bind(e)), i;
|
|
7629
|
+
return typeof e.changes == "function" && (i.changes = e.changes.bind(e)), typeof e.snapshot == "function" && (i.snapshot = e.snapshot.bind(e)), i;
|
|
7604
7630
|
}
|
|
7605
|
-
function
|
|
7631
|
+
function Mf(e, t, n) {
|
|
7606
7632
|
const i = e?.begin?.bind(e);
|
|
7607
7633
|
if (!i || !Number.isFinite(t)) return e;
|
|
7608
7634
|
let s = 0;
|
|
@@ -7632,6 +7658,7 @@ function _f(e, t, n) {
|
|
|
7632
7658
|
...e.changes ? {
|
|
7633
7659
|
changes: (c) => e.changes(c)
|
|
7634
7660
|
} : {},
|
|
7661
|
+
...e.snapshot ? { snapshot: (c) => e.snapshot(c) } : {},
|
|
7635
7662
|
begin: async (c) => {
|
|
7636
7663
|
if (c.mode !== "write") return i(c);
|
|
7637
7664
|
const l = await o(() => i(c));
|
|
@@ -7639,7 +7666,7 @@ function _f(e, t, n) {
|
|
|
7639
7666
|
}
|
|
7640
7667
|
};
|
|
7641
7668
|
}
|
|
7642
|
-
function
|
|
7669
|
+
function Uf(e, t) {
|
|
7643
7670
|
const { timeoutMs: n, signal: i } = t;
|
|
7644
7671
|
return !(n !== void 0 && n > 0) && !i ? e : new Promise((s, o) => {
|
|
7645
7672
|
let r = !1, a;
|
|
@@ -7683,7 +7710,7 @@ function gt(e) {
|
|
|
7683
7710
|
throw U("FORBIDDEN", "not allowed to read this node");
|
|
7684
7711
|
return e;
|
|
7685
7712
|
}
|
|
7686
|
-
async function
|
|
7713
|
+
async function jf(e, t, n, i, s) {
|
|
7687
7714
|
const o = e.transaction;
|
|
7688
7715
|
if (!o && !e.driver.begin)
|
|
7689
7716
|
throw U(
|
|
@@ -7753,8 +7780,8 @@ async function Uf(e, t, n, i, s) {
|
|
|
7753
7780
|
throw l.isOpen && await l.rollback(), u;
|
|
7754
7781
|
}
|
|
7755
7782
|
}
|
|
7756
|
-
const
|
|
7757
|
-
class
|
|
7783
|
+
const Lf = 2, Pf = 2;
|
|
7784
|
+
class xf {
|
|
7758
7785
|
#e = new AbortController();
|
|
7759
7786
|
#t;
|
|
7760
7787
|
#i;
|
|
@@ -7810,7 +7837,7 @@ class Pf {
|
|
|
7810
7837
|
);
|
|
7811
7838
|
}
|
|
7812
7839
|
}
|
|
7813
|
-
function
|
|
7840
|
+
function Ff(e, t) {
|
|
7814
7841
|
if (!e) return t;
|
|
7815
7842
|
if (e = Nn(e), t = Nn(t), typeof AbortSignal.any == "function")
|
|
7816
7843
|
try {
|
|
@@ -7881,7 +7908,7 @@ function Ic(e, t, n, i) {
|
|
|
7881
7908
|
{ type: e.name, field: t.name }
|
|
7882
7909
|
);
|
|
7883
7910
|
}
|
|
7884
|
-
function
|
|
7911
|
+
function zf(e, t) {
|
|
7885
7912
|
const n = t.code, i = t instanceof Error ? t.message : String(t);
|
|
7886
7913
|
if (n !== "LORA_UNIQUE_CONSTRAINT" && n !== "LORA_NOT_NULL_CONSTRAINT")
|
|
7887
7914
|
return t;
|
|
@@ -7895,7 +7922,7 @@ function Ff(e, t) {
|
|
|
7895
7922
|
{ type: r?.name ?? s, field: a?.name ?? o }
|
|
7896
7923
|
);
|
|
7897
7924
|
}
|
|
7898
|
-
async function
|
|
7925
|
+
async function Bf(e, t) {
|
|
7899
7926
|
const n = e.env.model;
|
|
7900
7927
|
for (const { field: i, keys: s } of Cc(e, t)) {
|
|
7901
7928
|
const o = n.nodes.get(i.owner), r = e.ctx(), a = `UNWIND ${P(B(r, s))} AS k
|
|
@@ -7913,7 +7940,7 @@ RETURN a.${R(o.key.property)} AS key, c AS count, ${Oc(e, r, i)} AS seen`, c = a
|
|
|
7913
7940
|
}
|
|
7914
7941
|
}
|
|
7915
7942
|
}
|
|
7916
|
-
function
|
|
7943
|
+
function qf(e, t) {
|
|
7917
7944
|
const n = e.env.model;
|
|
7918
7945
|
for (const { field: i, keys: s } of Cc(e, t))
|
|
7919
7946
|
e.inPlace(() => {
|
|
@@ -8040,7 +8067,7 @@ function _c(e, t) {
|
|
|
8040
8067
|
return Promise.all(n).then(() => {
|
|
8041
8068
|
});
|
|
8042
8069
|
}
|
|
8043
|
-
async function
|
|
8070
|
+
async function Wf(e) {
|
|
8044
8071
|
const t = e.env.model, n = /* @__PURE__ */ new Map();
|
|
8045
8072
|
for (const i of e.disconnected) {
|
|
8046
8073
|
const [s, o] = i.field.split("."), r = t.nodes.get(s).fields.get(o), a = Ye(t, r).find((c) => c.target === i.to.type) ?? r;
|
|
@@ -8163,7 +8190,7 @@ RETURN DISTINCT o.${R(p.key.property)} AS key, ${ys(m, p, "o")} AS visible`,
|
|
|
8163
8190
|
keys: [...u.values()]
|
|
8164
8191
|
})),
|
|
8165
8192
|
(l) => Lt(e.env, e.tx, l)
|
|
8166
|
-
), await
|
|
8193
|
+
), await bd(
|
|
8167
8194
|
e,
|
|
8168
8195
|
[...s].map(([l, u]) => ({
|
|
8169
8196
|
node: l,
|
|
@@ -8172,7 +8199,7 @@ RETURN DISTINCT o.${R(p.key.property)} AS key, ${ys(m, p, "o")} AS visible`,
|
|
|
8172
8199
|
);
|
|
8173
8200
|
const c = /* @__PURE__ */ new Set();
|
|
8174
8201
|
for (const [l, u] of s) {
|
|
8175
|
-
const { refs: d, ids: f } = await
|
|
8202
|
+
const { refs: d, ids: f } = await Hf(e, l, [
|
|
8176
8203
|
...u.values()
|
|
8177
8204
|
]);
|
|
8178
8205
|
e.disconnected.push(...d);
|
|
@@ -8206,7 +8233,7 @@ DETACH DELETE n`,
|
|
|
8206
8233
|
}
|
|
8207
8234
|
e.info.relationshipsDeleted += c.size;
|
|
8208
8235
|
}
|
|
8209
|
-
async function
|
|
8236
|
+
async function Hf(e, t, n) {
|
|
8210
8237
|
const i = e.env.model, s = [...t.fields.values()].flatMap(
|
|
8211
8238
|
(d) => d.kind === "relationship" ? Ye(i, d) : []
|
|
8212
8239
|
), o = [...i.nodes.values()].flatMap(
|
|
@@ -8366,7 +8393,7 @@ class Sn {
|
|
|
8366
8393
|
});
|
|
8367
8394
|
return this.#a = !0, n;
|
|
8368
8395
|
} catch (n) {
|
|
8369
|
-
throw
|
|
8396
|
+
throw Vf(n);
|
|
8370
8397
|
} finally {
|
|
8371
8398
|
this.#r = !1;
|
|
8372
8399
|
}
|
|
@@ -8381,7 +8408,7 @@ class Sn {
|
|
|
8381
8408
|
return this.#n ? this.#n.isOpen : this.#r;
|
|
8382
8409
|
}
|
|
8383
8410
|
}
|
|
8384
|
-
function
|
|
8411
|
+
function Vf(e) {
|
|
8385
8412
|
if (e instanceof Error && / \(statement \d+ of \d+\)$/.test(e.message))
|
|
8386
8413
|
try {
|
|
8387
8414
|
e.message = e.message.replace(/ \(statement \d+ of \d+\)$/, "");
|
|
@@ -8390,7 +8417,7 @@ function Hf(e) {
|
|
|
8390
8417
|
return e;
|
|
8391
8418
|
}
|
|
8392
8419
|
const ii = /* @__PURE__ */ new WeakMap();
|
|
8393
|
-
function
|
|
8420
|
+
function Gf(e) {
|
|
8394
8421
|
let t = ii.get(e);
|
|
8395
8422
|
return t || (t = e.run([{ text: "RETURN assert(true) AS ok", params: {} }], {
|
|
8396
8423
|
mode: "read",
|
|
@@ -8404,7 +8431,7 @@ function Vf(e) {
|
|
|
8404
8431
|
), ii.set(e, t)), t;
|
|
8405
8432
|
}
|
|
8406
8433
|
const ur = /* @__PURE__ */ new WeakMap();
|
|
8407
|
-
function
|
|
8434
|
+
function Qf(e) {
|
|
8408
8435
|
let t = ur.get(e);
|
|
8409
8436
|
if (t === void 0) {
|
|
8410
8437
|
const n = (i) => !!i?.validate.some((s) => s.operations.has("READ"));
|
|
@@ -8415,7 +8442,7 @@ function Gf(e) {
|
|
|
8415
8442
|
return t;
|
|
8416
8443
|
}
|
|
8417
8444
|
const Mc = Symbol("lora-graphql: no node to update");
|
|
8418
|
-
function
|
|
8445
|
+
function Kf(e) {
|
|
8419
8446
|
const t = e.model, n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
8420
8447
|
for (const { rel: s, from: o, to: r, refused: a } of e.links) {
|
|
8421
8448
|
if (a) return !1;
|
|
@@ -8436,7 +8463,7 @@ const Uc = "lora-graphql:";
|
|
|
8436
8463
|
function ss(e, t, n) {
|
|
8437
8464
|
return `${Uc}${e}:${t}:${n}`;
|
|
8438
8465
|
}
|
|
8439
|
-
function
|
|
8466
|
+
function Xf(e, t) {
|
|
8440
8467
|
const n = t instanceof Error ? t.message : String(t), i = /assertion failed: lora-graphql:(forbidden|hidden|taken):([^:\s]+):([^\s(]+)/.exec(
|
|
8441
8468
|
n
|
|
8442
8469
|
);
|
|
@@ -8452,7 +8479,7 @@ function Kf(e, t) {
|
|
|
8452
8479
|
s === "hidden" ? "CREATE" : r
|
|
8453
8480
|
) : t;
|
|
8454
8481
|
}
|
|
8455
|
-
class
|
|
8482
|
+
class Jf {
|
|
8456
8483
|
#e = [];
|
|
8457
8484
|
/**
|
|
8458
8485
|
* The message, a Cypher expression, of an assertion that stands for
|
|
@@ -8487,7 +8514,7 @@ function jc(e) {
|
|
|
8487
8514
|
}
|
|
8488
8515
|
return n;
|
|
8489
8516
|
}
|
|
8490
|
-
function
|
|
8517
|
+
function Yf(e, t) {
|
|
8491
8518
|
e.linking();
|
|
8492
8519
|
const n = (i) => {
|
|
8493
8520
|
i && e.defer(e.run(i.text, i.ctx));
|
|
@@ -8599,7 +8626,7 @@ function Oi(e, t, n, i, s) {
|
|
|
8599
8626
|
);
|
|
8600
8627
|
return { text: `UNWIND ${c} AS row
|
|
8601
8628
|
MATCH (a:${R(o.labels[0])}) WHERE a.${R(o.key.property)} = row.from` + ke(ce(a, o, "a", "CREATE_RELATIONSHIP")) + `
|
|
8602
|
-
MATCH (b:${R(r.labels[0])}) WHERE b.${R(r.key.property)} = row.to` + ke(
|
|
8629
|
+
MATCH (b:${R(r.labels[0])}) WHERE b.${R(r.key.property)} = row.to` + ke(yd(ce(a, r, "b", "READ"))) + ke(ce(a, r, "b", "CREATE_RELATIONSHIP")) + (typeof s == "string" ? "" : `
|
|
8603
8630
|
WITH a, b, row, size([(a)${Je(n, "", "b", void 0)} | 1]) > 0 AS existed`) + `
|
|
8604
8631
|
MERGE (a)${Je(n, "r", "b", void 0)}
|
|
8605
8632
|
ON CREATE SET ${u.join(", ")}
|
|
@@ -8607,7 +8634,7 @@ ON CREATE SET ${u.join(", ")}
|
|
|
8607
8634
|
` : "") + `SET r += row.props
|
|
8608
8635
|
` + (typeof s == "function" ? s(a) : s ?? "RETURN row.from AS from, row.to AS key, existed"), ctx: a };
|
|
8609
8636
|
}
|
|
8610
|
-
async function
|
|
8637
|
+
async function Zf(e, t) {
|
|
8611
8638
|
for (const [n, i] of jc(t)) {
|
|
8612
8639
|
const s = e.env.model.nodes.get(n.owner), o = e.env.model.nodes.get(n.target), r = i.map((f) => ({ from: f.from, to: f.to }));
|
|
8613
8640
|
await ks(
|
|
@@ -8687,7 +8714,7 @@ RETURN ${e.single ? `assert(${c}, ${e.assertions.failsAs(() => uo(t, n))})` : c}
|
|
|
8687
8714
|
ctx: s
|
|
8688
8715
|
};
|
|
8689
8716
|
}
|
|
8690
|
-
function
|
|
8717
|
+
function ep(e, t, n, i) {
|
|
8691
8718
|
return [e, t].some(
|
|
8692
8719
|
(s) => s.authorization?.validate.some(
|
|
8693
8720
|
(o) => o.operations.has(n) && o.when.has(i)
|
|
@@ -8716,7 +8743,7 @@ RETURN ${l(a, n)} AS a, ${l(c, i)} AS b`,
|
|
|
8716
8743
|
};
|
|
8717
8744
|
}
|
|
8718
8745
|
const wt = (e) => e == null ? [] : Array.isArray(e) ? e : [e];
|
|
8719
|
-
class
|
|
8746
|
+
class tp {
|
|
8720
8747
|
constructor(t, n) {
|
|
8721
8748
|
this.env = t, this.ctx = n;
|
|
8722
8749
|
}
|
|
@@ -8999,7 +9026,7 @@ function fr(e, t, n, i) {
|
|
|
8999
9026
|
`not allowed to ${n.toLowerCase()} ${e}.${t.name}`
|
|
9000
9027
|
);
|
|
9001
9028
|
}
|
|
9002
|
-
const
|
|
9029
|
+
const np = {
|
|
9003
9030
|
Date: "date",
|
|
9004
9031
|
Time: "time",
|
|
9005
9032
|
LocalTime: "localtime",
|
|
@@ -9008,7 +9035,7 @@ const tp = {
|
|
|
9008
9035
|
Duration: "duration"
|
|
9009
9036
|
};
|
|
9010
9037
|
function xc(e) {
|
|
9011
|
-
const t = e.defaultValue.value, n =
|
|
9038
|
+
const t = e.defaultValue.value, n = np[e.type];
|
|
9012
9039
|
if (!n) return t;
|
|
9013
9040
|
const i = (s) => ({ kind: n, iso: s });
|
|
9014
9041
|
return Array.isArray(t) ? t.map(i) : i(t);
|
|
@@ -9029,7 +9056,7 @@ function pr(e) {
|
|
|
9029
9056
|
}
|
|
9030
9057
|
}
|
|
9031
9058
|
}
|
|
9032
|
-
class
|
|
9059
|
+
class sp {
|
|
9033
9060
|
constructor(t, n, i) {
|
|
9034
9061
|
this.env = t, this.tx = n, this.change = i;
|
|
9035
9062
|
}
|
|
@@ -9072,7 +9099,7 @@ class np {
|
|
|
9072
9099
|
*/
|
|
9073
9100
|
takenUnique;
|
|
9074
9101
|
/** What the assertions of a single call stand for. */
|
|
9075
|
-
assertions = new
|
|
9102
|
+
assertions = new Jf();
|
|
9076
9103
|
/** Statements issued so far, and how many when the links began. */
|
|
9077
9104
|
#t = 0;
|
|
9078
9105
|
#i;
|
|
@@ -9194,12 +9221,12 @@ RETURN assert(count(n) = 0, ${P(G(ss(t, n.name, s)))}) AS ok`,
|
|
|
9194
9221
|
async #r() {
|
|
9195
9222
|
if (this.#a) return;
|
|
9196
9223
|
if (this.#s) {
|
|
9197
|
-
this.#s = !1,
|
|
9224
|
+
this.#s = !1, rp(() => void this.#r());
|
|
9198
9225
|
return;
|
|
9199
9226
|
}
|
|
9200
9227
|
const t = this.#n;
|
|
9201
9228
|
this.#n = [];
|
|
9202
|
-
const n = () => t.length > 1 && this.tx.executeMany ? this.tx.executeMany(t.map((i) => i.statement)) :
|
|
9229
|
+
const n = () => t.length > 1 && this.tx.executeMany ? this.tx.executeMany(t.map((i) => i.statement)) : op(this.tx, t);
|
|
9203
9230
|
try {
|
|
9204
9231
|
const i = this.env.observe;
|
|
9205
9232
|
let s;
|
|
@@ -9425,7 +9452,7 @@ RETURN assert(found > 0, ${this.assertions.failsAs(() => Mc)}) AS ok`,
|
|
|
9425
9452
|
* each link's outcome known or told in the database.
|
|
9426
9453
|
*/
|
|
9427
9454
|
#u(t) {
|
|
9428
|
-
return t.disconnects.length === 0 &&
|
|
9455
|
+
return t.disconnects.length === 0 && Kf(t) && t.edgeUpdates.length === 0 && t.nodeUpdates.length === 0 && t.nestedDeletes.length === 0 && this.disconnected.length === 0;
|
|
9429
9456
|
}
|
|
9430
9457
|
/**
|
|
9431
9458
|
* `send()` for a statement's rows. The promise is safe to leave
|
|
@@ -9439,7 +9466,7 @@ RETURN assert(found > 0, ${this.assertions.failsAs(() => Mc)}) AS ok`,
|
|
|
9439
9466
|
);
|
|
9440
9467
|
}
|
|
9441
9468
|
plan() {
|
|
9442
|
-
return new
|
|
9469
|
+
return new tp(this.env, this.ctx());
|
|
9443
9470
|
}
|
|
9444
9471
|
/** Every planned write, in order, with the checks that follow them. */
|
|
9445
9472
|
/**
|
|
@@ -9456,7 +9483,7 @@ RETURN assert(found > 0, ${this.assertions.failsAs(() => Mc)}) AS ok`,
|
|
|
9456
9483
|
this.moveTakenUniques(t),
|
|
9457
9484
|
this.applyCreates(t)
|
|
9458
9485
|
].map((r) => this.watch(r)), s = t.disconnects.length === 0 && t.links.length === 0 && t.edgeUpdates.length === 0 && t.nodeUpdates.length === 0 && t.nestedDeletes.length === 0 && this.disconnected.length === 0;
|
|
9459
|
-
!s && this.single ? (
|
|
9486
|
+
!s && this.single ? (Yf(this, t), qf(this, t)) : s || (this.#n.length > 0 && (this.#s = !0), await this.applyDisconnects(t), await Zf(this, t), await this.applyEdgeUpdates(t), await this.applyNodeUpdates(t), await this.applyNestedDeletes(t), await Bf(this, t), await Wf(this));
|
|
9460
9487
|
const o = this.watch(this.validateCreated(t));
|
|
9461
9488
|
n?.();
|
|
9462
9489
|
for (const r of i) await r;
|
|
@@ -9496,7 +9523,7 @@ RETURN assert(found > 0, ${this.assertions.failsAs(() => Mc)}) AS ok`,
|
|
|
9496
9523
|
for (const [i, s] of t.creates) {
|
|
9497
9524
|
const o = this.ctx(), r = ce(o, i, "n", "READ");
|
|
9498
9525
|
if (!r) continue;
|
|
9499
|
-
const a = s.map((l) => ({ key: l.key, to:
|
|
9526
|
+
const a = s.map((l) => ({ key: l.key, to: ip(i) }));
|
|
9500
9527
|
this.#e.push({
|
|
9501
9528
|
kind: "hidden",
|
|
9502
9529
|
node: i,
|
|
@@ -9632,7 +9659,7 @@ CREATE (n:${r} { ${p.join(", ")} })`,
|
|
|
9632
9659
|
const g = await this.run(`${f}RETURN ${p}`, c);
|
|
9633
9660
|
await As(this, "DISCONNECT", i, h(g));
|
|
9634
9661
|
}
|
|
9635
|
-
if (
|
|
9662
|
+
if (ep(r, a, "DELETE_RELATIONSHIP", "BEFORE")) {
|
|
9636
9663
|
const g = await this.run(`${f}RETURN ${p}`, c);
|
|
9637
9664
|
await ks(
|
|
9638
9665
|
this,
|
|
@@ -9671,7 +9698,7 @@ CREATE (n:${r} { ${p.join(", ")} })`,
|
|
|
9671
9698
|
"b",
|
|
9672
9699
|
s
|
|
9673
9700
|
) + (n.to !== void 0 ? ` AND b.${R(s.key.property)} = ${P(B(o, n.to))}` : "") + ke(ce(o, s, "b", "READ")) + `
|
|
9674
|
-
SET r += ${P(B(o, n.set))}` +
|
|
9701
|
+
SET r += ${P(B(o, n.set))}` + gd(this.env.model, n.rel) + (n.remove.length > 0 ? `
|
|
9675
9702
|
REMOVE ${n.remove.map((c) => `r.${R(c)}`).join(", ")}` : "") + `
|
|
9676
9703
|
RETURN b.${R(s.key.property)} AS key`, a = await this.run(r, o);
|
|
9677
9704
|
if (a.length === 0) throw si(i, n.rel, s, n.to);
|
|
@@ -9945,19 +9972,19 @@ RETURN this.${R(t.key.property)} AS key ORDER BY key LIMIT ${P(B(o, s + 1))}`,
|
|
|
9945
9972
|
return a.map((c) => c.key);
|
|
9946
9973
|
}
|
|
9947
9974
|
}
|
|
9948
|
-
function
|
|
9975
|
+
function ip(e) {
|
|
9949
9976
|
if (e.key.type === "Int" || e.key.type === "BigInt") {
|
|
9950
9977
|
const [t, n] = globalThis.crypto.getRandomValues(new Uint32Array(2));
|
|
9951
9978
|
return -(2n ** 62n) - (BigInt(t & 1073741823) << 32n | BigInt(n));
|
|
9952
9979
|
}
|
|
9953
9980
|
return `\0lora-graphql:hidden:${globalThis.crypto.randomUUID()}`;
|
|
9954
9981
|
}
|
|
9955
|
-
async function
|
|
9982
|
+
async function op(e, t) {
|
|
9956
9983
|
const n = [];
|
|
9957
9984
|
for (const { statement: i } of t) n.push(await e.execute(i));
|
|
9958
9985
|
return n;
|
|
9959
9986
|
}
|
|
9960
|
-
const
|
|
9987
|
+
const rp = typeof setImmediate == "function" ? setImmediate : (e) => setTimeout(e, 0);
|
|
9961
9988
|
function xe(e) {
|
|
9962
9989
|
return e.catch(() => {
|
|
9963
9990
|
}), e;
|
|
@@ -9967,12 +9994,12 @@ function hr(e) {
|
|
|
9967
9994
|
});
|
|
9968
9995
|
return e;
|
|
9969
9996
|
}
|
|
9970
|
-
async function
|
|
9997
|
+
async function ap(e, t, n) {
|
|
9971
9998
|
const i = e.ctx(), s = [...t.fields.values()].some(
|
|
9972
9999
|
(m) => m.kind === "scalar" && m.populatedBy?.operations.has("UPDATE")
|
|
9973
10000
|
), o = /* @__PURE__ */ new Map(), r = [], a = [], c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
9974
10001
|
for (const { key: m, input: g } of n) {
|
|
9975
|
-
const y = s ? void 0 :
|
|
10002
|
+
const y = s ? void 0 : cp(i, o, t, m, g);
|
|
9976
10003
|
if (!y) {
|
|
9977
10004
|
a.push({ key: m });
|
|
9978
10005
|
continue;
|
|
@@ -10035,7 +10062,7 @@ RETURN n.${R(t.key.property)} AS key, coalesce(${p.join(`
|
|
|
10035
10062
|
)
|
|
10036
10063
|
};
|
|
10037
10064
|
}
|
|
10038
|
-
function
|
|
10065
|
+
function cp(e, t, n, i, s) {
|
|
10039
10066
|
const o = {}, r = [], a = /* @__PURE__ */ new Map();
|
|
10040
10067
|
try {
|
|
10041
10068
|
for (const [c, l] of Object.entries(s)) {
|
|
@@ -10052,8 +10079,8 @@ function ap(e, t, n, i, s) {
|
|
|
10052
10079
|
if (u?.kind !== "relationship") return;
|
|
10053
10080
|
if (l == null) continue;
|
|
10054
10081
|
let d = t.get(u);
|
|
10055
|
-
if (d === void 0 && (d =
|
|
10056
|
-
const f =
|
|
10082
|
+
if (d === void 0 && (d = lp(e, n, u), t.set(u, d)), !d) return;
|
|
10083
|
+
const f = up(e, u, l);
|
|
10057
10084
|
if (!f) return;
|
|
10058
10085
|
a.set(u, f);
|
|
10059
10086
|
}
|
|
@@ -10065,7 +10092,7 @@ function ap(e, t, n, i, s) {
|
|
|
10065
10092
|
row: r.length > 0 ? { key: i, set: o, remove: r } : { key: i, set: o }
|
|
10066
10093
|
};
|
|
10067
10094
|
}
|
|
10068
|
-
function
|
|
10095
|
+
function lp(e, t, n) {
|
|
10069
10096
|
const i = e.model.nodes.get(n.target);
|
|
10070
10097
|
if (!i || n.via) return !1;
|
|
10071
10098
|
const s = { owner: "a", target: "b", rel: "r" }, o = [
|
|
@@ -10089,7 +10116,7 @@ function cp(e, t, n) {
|
|
|
10089
10116
|
}
|
|
10090
10117
|
return !0;
|
|
10091
10118
|
}
|
|
10092
|
-
function
|
|
10119
|
+
function up(e, t, n) {
|
|
10093
10120
|
const i = e.model, s = i.nodes.get(t.target);
|
|
10094
10121
|
for (const [u, d] of Object.entries(n))
|
|
10095
10122
|
if (u !== "connect" && d !== null && d !== void 0) return;
|
|
@@ -10122,7 +10149,7 @@ function Ci(e) {
|
|
|
10122
10149
|
const t = e["~standard"];
|
|
10123
10150
|
return t !== null && typeof t == "object" && typeof t.validate == "function";
|
|
10124
10151
|
}
|
|
10125
|
-
class
|
|
10152
|
+
class dp {
|
|
10126
10153
|
constructor(t, n) {
|
|
10127
10154
|
this.model = t, this.validators = n;
|
|
10128
10155
|
}
|
|
@@ -10149,7 +10176,7 @@ class up {
|
|
|
10149
10176
|
}
|
|
10150
10177
|
}
|
|
10151
10178
|
}
|
|
10152
|
-
function
|
|
10179
|
+
function fp(e, t) {
|
|
10153
10180
|
if (e !== void 0)
|
|
10154
10181
|
return Ci(e) ? e : e[t];
|
|
10155
10182
|
}
|
|
@@ -10167,7 +10194,7 @@ function oi(e, t, n, i) {
|
|
|
10167
10194
|
for (const o of s.fields.values())
|
|
10168
10195
|
i.field(s.name, o, t, n);
|
|
10169
10196
|
}
|
|
10170
|
-
function
|
|
10197
|
+
function pp(e, t, n, i) {
|
|
10171
10198
|
const { model: s } = i, o = (r) => {
|
|
10172
10199
|
const a = t[r];
|
|
10173
10200
|
if (a == null) return [];
|
|
@@ -10207,9 +10234,9 @@ function Ns(e, t, n, i, s) {
|
|
|
10207
10234
|
const o = t;
|
|
10208
10235
|
for (const a of e.fields.values()) {
|
|
10209
10236
|
const c = o[a.name];
|
|
10210
|
-
c != null && (a.kind === "scalar" ? s.field(e.name, a, o, n) : a.kind === "relationship" && typeof c == "object" &&
|
|
10237
|
+
c != null && (a.kind === "scalar" ? s.field(e.name, a, o, n) : a.kind === "relationship" && typeof c == "object" && pp(a, c, [...n, a.name], s));
|
|
10211
10238
|
}
|
|
10212
|
-
const r =
|
|
10239
|
+
const r = fp(s.validators[e.name], i);
|
|
10213
10240
|
r && s.jobs.push({ schema: r, node: e, input: o, path: n });
|
|
10214
10241
|
}
|
|
10215
10242
|
const zc = {
|
|
@@ -10220,13 +10247,13 @@ const zc = {
|
|
|
10220
10247
|
LocalDateTime: "localdatetime",
|
|
10221
10248
|
Duration: "duration"
|
|
10222
10249
|
}, mr = (e, t) => Array.isArray(e) ? e.map(t) : t(e);
|
|
10223
|
-
function
|
|
10250
|
+
function hp(e) {
|
|
10224
10251
|
return [...e.fields.values()].filter(
|
|
10225
10252
|
(t) => t.kind === "scalar" && t.type in zc
|
|
10226
10253
|
);
|
|
10227
10254
|
}
|
|
10228
|
-
async function
|
|
10229
|
-
const { schema: n, node: i, input: s, path: o } = e, r =
|
|
10255
|
+
async function mp(e, t) {
|
|
10256
|
+
const { schema: n, node: i, input: s, path: o } = e, r = hp(i), a = { ...s };
|
|
10230
10257
|
for (const u of r)
|
|
10231
10258
|
a[u.name] = mr(
|
|
10232
10259
|
s[u.name],
|
|
@@ -10260,19 +10287,19 @@ async function hp(e, t) {
|
|
|
10260
10287
|
);
|
|
10261
10288
|
}
|
|
10262
10289
|
}
|
|
10263
|
-
async function
|
|
10264
|
-
const o = new
|
|
10290
|
+
async function gp(e, t, n, i, s) {
|
|
10291
|
+
const o = new dp(e, t);
|
|
10265
10292
|
if (n === "CREATE" || n === "UPSERT") {
|
|
10266
10293
|
const r = n === "CREATE" ? "create" : "upsert";
|
|
10267
10294
|
for (const [a, c] of is(s.input, ["input"]))
|
|
10268
10295
|
Ns(i, a, c, r, o);
|
|
10269
10296
|
} else (n === "UPDATE" || n === "UPDATE_MANY") && Ns(i, s.update, ["update"], "update", o);
|
|
10270
10297
|
if (o.total === 0)
|
|
10271
|
-
for (const r of o.jobs) await
|
|
10298
|
+
for (const r of o.jobs) await mp(r, o);
|
|
10272
10299
|
if (o.total > 0)
|
|
10273
10300
|
throw Ms("BAD_USER_INPUT", o.violations, o.total);
|
|
10274
10301
|
}
|
|
10275
|
-
function
|
|
10302
|
+
function yp(e, t, n, i) {
|
|
10276
10303
|
const s = [];
|
|
10277
10304
|
for (const [, o] of Qe(
|
|
10278
10305
|
e.selection,
|
|
@@ -10282,7 +10309,7 @@ function gp(e, t, n, i) {
|
|
|
10282
10309
|
o[0].name.value === i && s.push(...Ce(o));
|
|
10283
10310
|
return s;
|
|
10284
10311
|
}
|
|
10285
|
-
function
|
|
10312
|
+
function Ep(e, t, n) {
|
|
10286
10313
|
const i = { ...e, params: {}, vars: new Set(e.vars) };
|
|
10287
10314
|
Re(i, t, "n", n, "BEFORE"), Re(i, t, "n", n, "AFTER");
|
|
10288
10315
|
}
|
|
@@ -10290,7 +10317,7 @@ function Bc(e) {
|
|
|
10290
10317
|
const t = e.model.viewer, n = t && e.model.nodes.get(t.type);
|
|
10291
10318
|
return !!(t && n && t.field !== n.key.name && e.jwt && [...e.model.nodes.values()].some((i) => i.key.keyScope));
|
|
10292
10319
|
}
|
|
10293
|
-
async function
|
|
10320
|
+
async function wp(e, t, n) {
|
|
10294
10321
|
const i = e.model.viewer, s = i && e.model.nodes.get(i.type);
|
|
10295
10322
|
if (!Bc(e) || !i || !s) return;
|
|
10296
10323
|
const o = rt(n, i.claim);
|
|
@@ -10302,7 +10329,7 @@ RETURN v.${R(s.key.property)} AS key LIMIT 1`,
|
|
|
10302
10329
|
params: { claim: o }
|
|
10303
10330
|
})).rows[0]?.key ?? null;
|
|
10304
10331
|
}
|
|
10305
|
-
function
|
|
10332
|
+
function vp(e, t, n, i) {
|
|
10306
10333
|
const s = t === "CREATE" || t === "UPDATE" ? t : void 0, o = [...n.fields.values()].filter(
|
|
10307
10334
|
(c) => c.kind === "scalar" && !c.key && !!s && !!c.populatedBy?.operations.has(s)
|
|
10308
10335
|
);
|
|
@@ -10332,7 +10359,7 @@ function wp(e, t, n, i) {
|
|
|
10332
10359
|
}
|
|
10333
10360
|
return a;
|
|
10334
10361
|
}
|
|
10335
|
-
async function
|
|
10362
|
+
async function bp(e, t, n, i, s, o) {
|
|
10336
10363
|
const r = e.transaction;
|
|
10337
10364
|
if (!r && !e.driver.begin)
|
|
10338
10365
|
throw U(
|
|
@@ -10348,14 +10375,14 @@ async function vp(e, t, n, i, s, o) {
|
|
|
10348
10375
|
maxListFilter: e.maxListFilter,
|
|
10349
10376
|
maxStringFilter: e.maxStringFilter
|
|
10350
10377
|
}), c = t === "UPSERT" ? "CREATE" : t === "UPDATE_MANY" ? "UPDATE" : t === "DELETE_MANY" ? "DELETE" : t;
|
|
10351
|
-
me(a, n, c), t !== "UPSERT" &&
|
|
10378
|
+
me(a, n, c), t !== "UPSERT" && Ep(a, n, c), await gp(e.model, e.validators ?? {}, t, n, i), t === "UPDATE" && !i.update && (i = { ...i, update: {} }), e = { ...e, computed: vp(e, t, n, i) };
|
|
10352
10379
|
const l = {
|
|
10353
10380
|
mode: "write",
|
|
10354
10381
|
timeoutMs: e.timeoutMs,
|
|
10355
10382
|
signal: e.signal
|
|
10356
|
-
}, u = (t === "CREATE" || t === "UPDATE") && !r && e.singleCall !== !1 && !Es(e) && !
|
|
10383
|
+
}, u = (t === "CREATE" || t === "UPDATE") && !r && e.singleCall !== !1 && !Es(e) && !Qf(e.model) && !Bc(e) && await Gf(e.driver), d = r ?? new Sn(e.driver, l, u), f = Tp(t, o), p = await wp(e, d, a);
|
|
10357
10384
|
p !== void 0 && (e = { ...e, viewerKey: p });
|
|
10358
|
-
const h = new
|
|
10385
|
+
const h = new sp(e, d, f), m = e.selection.schema;
|
|
10359
10386
|
let g;
|
|
10360
10387
|
const y = Es(e);
|
|
10361
10388
|
let E;
|
|
@@ -10366,13 +10393,13 @@ async function vp(e, t, n, i, s, o) {
|
|
|
10366
10393
|
);
|
|
10367
10394
|
let $;
|
|
10368
10395
|
const N = () => $ ??= xe(
|
|
10369
|
-
h.hiddenKey || h.takenUnique ? Promise.resolve() :
|
|
10396
|
+
h.hiddenKey || h.takenUnique ? Promise.resolve() : vd(h)
|
|
10370
10397
|
), D = async (I, k, C) => {
|
|
10371
|
-
const x = m.getType(I), X =
|
|
10398
|
+
const x = m.getType(I), X = yp(e, x, s, k);
|
|
10372
10399
|
if (!y) return h.payload(n, C, X);
|
|
10373
10400
|
await v();
|
|
10374
10401
|
const b = N();
|
|
10375
|
-
|
|
10402
|
+
Ed(e) && await b;
|
|
10376
10403
|
const A = xe(h.payload(n, C, X));
|
|
10377
10404
|
return await b, A;
|
|
10378
10405
|
};
|
|
@@ -10478,7 +10505,7 @@ async function vp(e, t, n, i, s, o) {
|
|
|
10478
10505
|
break;
|
|
10479
10506
|
}
|
|
10480
10507
|
case "UPSERT":
|
|
10481
|
-
I = await
|
|
10508
|
+
I = await $p(h, k, n, i, D);
|
|
10482
10509
|
break;
|
|
10483
10510
|
case "DELETE": {
|
|
10484
10511
|
const C = h.ctx(), x = await h.run(
|
|
@@ -10524,10 +10551,10 @@ RETURN n.${R(n.key.property)} AS key`,
|
|
|
10524
10551
|
throw h.abandon(I), d.isOpen && await d.rollback(), d instanceof Sn && d.committed ? new Error(
|
|
10525
10552
|
`lora-graphql: a single-call mutation failed after its commit (${I instanceof Error ? I.message : String(I)}); the write is in the database. Set singleCallMutations: false and report this`,
|
|
10526
10553
|
{ cause: I }
|
|
10527
|
-
) : d instanceof Sn && d.single ? h.assertions.refusedBy(I) ??
|
|
10554
|
+
) : d instanceof Sn && d.single ? h.assertions.refusedBy(I) ?? Xf(e.model, I) : I;
|
|
10528
10555
|
}
|
|
10529
10556
|
}
|
|
10530
|
-
async function
|
|
10557
|
+
async function $p(e, t, n, i, s) {
|
|
10531
10558
|
const o = i.input;
|
|
10532
10559
|
if (o.length > e.env.maxBatch)
|
|
10533
10560
|
throw U(
|
|
@@ -10549,7 +10576,7 @@ async function bp(e, t, n, i, s) {
|
|
|
10549
10576
|
return h?.kind !== "scalar" && h?.kind !== "relationship" || Se(h, "UPDATE");
|
|
10550
10577
|
})
|
|
10551
10578
|
)
|
|
10552
|
-
), { existing: c, same: l } = await
|
|
10579
|
+
), { existing: c, same: l } = await ap(
|
|
10553
10580
|
e,
|
|
10554
10581
|
n,
|
|
10555
10582
|
r.map((f, p) => ({ key: f, input: a[p] }))
|
|
@@ -10579,7 +10606,7 @@ function gr(e, t) {
|
|
|
10579
10606
|
);
|
|
10580
10607
|
return e;
|
|
10581
10608
|
}
|
|
10582
|
-
function
|
|
10609
|
+
function Tp(e, t) {
|
|
10583
10610
|
return {
|
|
10584
10611
|
operation: e === "UPDATE_MANY" ? "UPDATE" : e === "DELETE_MANY" ? "DELETE" : e,
|
|
10585
10612
|
field: t,
|
|
@@ -10595,7 +10622,7 @@ function $p(e, t) {
|
|
|
10595
10622
|
};
|
|
10596
10623
|
}
|
|
10597
10624
|
const yr = 1e3;
|
|
10598
|
-
class
|
|
10625
|
+
class Ap {
|
|
10599
10626
|
#e;
|
|
10600
10627
|
#t;
|
|
10601
10628
|
#i;
|
|
@@ -10778,7 +10805,7 @@ REMOVE n.${Te.lease}, n.${Te.at}, n.${Te.error}`,
|
|
|
10778
10805
|
}
|
|
10779
10806
|
}
|
|
10780
10807
|
}
|
|
10781
|
-
const
|
|
10808
|
+
const kp = {
|
|
10782
10809
|
String: { type: "string" },
|
|
10783
10810
|
ID: { type: "string" },
|
|
10784
10811
|
Int: { type: "integer" },
|
|
@@ -10795,19 +10822,19 @@ const Ap = {
|
|
|
10795
10822
|
Point: { type: "object" },
|
|
10796
10823
|
CartesianPoint: { type: "object" }
|
|
10797
10824
|
};
|
|
10798
|
-
function
|
|
10825
|
+
function Np(e, t, n) {
|
|
10799
10826
|
const { item: i, list: s } = ju(t.constraints), r = { ...t.type === "Enum" ? {
|
|
10800
10827
|
enum: (e.enums.get(t.enumName ?? "")?.values ?? []).map(
|
|
10801
10828
|
(c) => c.name
|
|
10802
10829
|
)
|
|
10803
|
-
} : { ...
|
|
10830
|
+
} : { ...kp[t.type] }, ...i };
|
|
10804
10831
|
let a = t.list ? { type: "array", items: r, ...s } : r;
|
|
10805
10832
|
return n && (a = { anyOf: [a, { type: "null" }] }), t.description && (a = { description: t.description, ...a }), a;
|
|
10806
10833
|
}
|
|
10807
10834
|
function ri(e, t, n, i) {
|
|
10808
10835
|
const s = {}, o = [];
|
|
10809
10836
|
for (const r of n)
|
|
10810
|
-
Se(r, i) && (s[r.name] =
|
|
10837
|
+
Se(r, i) && (s[r.name] = Np(e, r, i === "UPDATE" && !r.required), i === "CREATE" && $s(r) && o.push(r.name));
|
|
10811
10838
|
return {
|
|
10812
10839
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
10813
10840
|
title: t,
|
|
@@ -10819,7 +10846,7 @@ function ri(e, t, n, i) {
|
|
|
10819
10846
|
};
|
|
10820
10847
|
}
|
|
10821
10848
|
const Er = (e) => [...e.values()].filter((t) => t.kind === "scalar");
|
|
10822
|
-
function
|
|
10849
|
+
function Sp(e) {
|
|
10823
10850
|
const t = {};
|
|
10824
10851
|
for (const n of e.nodes.values()) {
|
|
10825
10852
|
const i = Er(n.fields);
|
|
@@ -10940,7 +10967,7 @@ function qc(e) {
|
|
|
10940
10967
|
);
|
|
10941
10968
|
return Array.from(t, (n) => n.toString(16).padStart(2, "0")).join("");
|
|
10942
10969
|
}
|
|
10943
|
-
function
|
|
10970
|
+
function Rp(e, t, n = []) {
|
|
10944
10971
|
const i = {}, s = [];
|
|
10945
10972
|
for (const [o, r] of Object.entries(t)) {
|
|
10946
10973
|
let a;
|
|
@@ -10995,7 +11022,7 @@ const $r = {
|
|
|
10995
11022
|
LocalDateTime: "string",
|
|
10996
11023
|
Duration: "string"
|
|
10997
11024
|
};
|
|
10998
|
-
function
|
|
11025
|
+
function Ip(e, t, n = /* @__PURE__ */ new Map()) {
|
|
10999
11026
|
const i = /* @__PURE__ */ new Map(), s = [
|
|
11000
11027
|
"// Generated by lora-graphql compile. Do not edit.",
|
|
11001
11028
|
""
|
|
@@ -11028,7 +11055,7 @@ ${f.join(`
|
|
|
11028
11055
|
p.definitions.filter(
|
|
11029
11056
|
(D) => D.kind === fe.FRAGMENT_DEFINITION
|
|
11030
11057
|
).map((D) => [D.name.value, D])
|
|
11031
|
-
), g =
|
|
11058
|
+
), g = Op(h.name?.value ?? d), y = (h.variableDefinitions ?? []).map((D) => {
|
|
11032
11059
|
const I = pl(e, D.type), k = !dt(I) || D.defaultValue !== void 0;
|
|
11033
11060
|
return ` ${D.variable.name.value}${k ? "?" : ""}: ${c(I)};`;
|
|
11034
11061
|
});
|
|
@@ -11050,7 +11077,7 @@ ${y.join(`
|
|
|
11050
11077
|
const F = T.alias?.value ?? T.name.value;
|
|
11051
11078
|
let q;
|
|
11052
11079
|
if (T.name.value === "__typename")
|
|
11053
|
-
q =
|
|
11080
|
+
q = Dp(e, b).map((ee) => JSON.stringify(ee)).join(" | ");
|
|
11054
11081
|
else {
|
|
11055
11082
|
const ee = Rt(b) || et(b) ? b.getFields()[T.name.value] : void 0;
|
|
11056
11083
|
if (!ee) continue;
|
|
@@ -11105,14 +11132,14 @@ ${k}}`;
|
|
|
11105
11132
|
].join(`
|
|
11106
11133
|
`);
|
|
11107
11134
|
}
|
|
11108
|
-
function
|
|
11135
|
+
function Dp(e, t) {
|
|
11109
11136
|
return Rt(t) ? [t.name] : _s(t) || et(t) ? e.getPossibleTypes(t).map((n) => n.name) : [];
|
|
11110
11137
|
}
|
|
11111
|
-
function
|
|
11138
|
+
function Op(e) {
|
|
11112
11139
|
const n = e.split(/[^A-Za-z0-9]+/).filter(Boolean).map((i) => i[0].toUpperCase() + i.slice(1)).join("");
|
|
11113
11140
|
return /^[0-9]/.test(n) ? `Op${n}` : n || "Operation";
|
|
11114
11141
|
}
|
|
11115
|
-
function
|
|
11142
|
+
function fm(e, t) {
|
|
11116
11143
|
const n = /* @__PURE__ */ new Map(), i = (s) => Qr(s, {
|
|
11117
11144
|
FragmentSpread(o) {
|
|
11118
11145
|
const r = t.get(o.name.value);
|
|
@@ -11140,21 +11167,21 @@ function Wc(e = {}) {
|
|
|
11140
11167
|
}
|
|
11141
11168
|
function Hc(e = {}) {
|
|
11142
11169
|
const t = Wc(e), n = [
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
11170
|
+
Up(t.maxDepth, t.maxIntrospectionDepth),
|
|
11171
|
+
jp(t.maxAliases),
|
|
11172
|
+
Lp(t.maxRootFields)
|
|
11146
11173
|
];
|
|
11147
|
-
return t.introspection || n.push(
|
|
11174
|
+
return t.introspection || n.push(Pp), n;
|
|
11148
11175
|
}
|
|
11149
11176
|
function Vc(e = {}) {
|
|
11150
11177
|
return { maxTokens: Wc(e).maxTokens };
|
|
11151
11178
|
}
|
|
11152
|
-
function
|
|
11179
|
+
function Cp(e = {}, t = Mp) {
|
|
11153
11180
|
const n = Hc(e), i = Vc(e);
|
|
11154
11181
|
let s = !1;
|
|
11155
11182
|
const o = (a, c) => {
|
|
11156
11183
|
if (s) return;
|
|
11157
|
-
const l =
|
|
11184
|
+
const l = _p(a, c);
|
|
11158
11185
|
l && (s = !0, t(l));
|
|
11159
11186
|
}, r = (a) => (o(a, "validation"), {});
|
|
11160
11187
|
return {
|
|
@@ -11177,13 +11204,13 @@ function Op(e = {}, t = _p) {
|
|
|
11177
11204
|
}
|
|
11178
11205
|
};
|
|
11179
11206
|
}
|
|
11180
|
-
function
|
|
11207
|
+
function _p(e, t) {
|
|
11181
11208
|
if (typeof e != "object" || e === null || e instanceof (t === "schema" ? Jr : hl)) return;
|
|
11182
11209
|
const i = e[Symbol.toStringTag], s = t === "schema" ? "GraphQLSchema" : "ValidationContext";
|
|
11183
11210
|
if (!(i !== s && e.constructor?.name !== s))
|
|
11184
11211
|
return `@loradb/lora-graphql: the server's ${s} comes from a different copy of the "graphql" package than the one @loradb/lora-graphql imports. With two copies, errors the library raises are not instances of the server's GraphQLError, so they are masked (Yoga reports "Unexpected error") and their extensions.code is lost. Fix: install a single graphql version (npm dedupe, or pin it with pnpm.overrides / yarn resolutions / npm overrides) and check that \`npm ls graphql\` shows one copy.`;
|
|
11185
11212
|
}
|
|
11186
|
-
function
|
|
11213
|
+
function Mp(e) {
|
|
11187
11214
|
console.error(e);
|
|
11188
11215
|
}
|
|
11189
11216
|
const Ss = (e) => new ve(e, { extensions: { code: "LIMIT_EXCEEDED" } });
|
|
@@ -11233,7 +11260,7 @@ function os(e, t, n, i = /* @__PURE__ */ new Set()) {
|
|
|
11233
11260
|
}
|
|
11234
11261
|
return s;
|
|
11235
11262
|
}
|
|
11236
|
-
function
|
|
11263
|
+
function Up(e, t) {
|
|
11237
11264
|
return (n) => {
|
|
11238
11265
|
const i = Gc(n);
|
|
11239
11266
|
return {
|
|
@@ -11254,7 +11281,7 @@ function Mp(e, t) {
|
|
|
11254
11281
|
};
|
|
11255
11282
|
};
|
|
11256
11283
|
}
|
|
11257
|
-
function
|
|
11284
|
+
function jp(e) {
|
|
11258
11285
|
return (t) => {
|
|
11259
11286
|
let n = 0, i = !1;
|
|
11260
11287
|
return {
|
|
@@ -11279,7 +11306,7 @@ function _i(e, t, n) {
|
|
|
11279
11306
|
}
|
|
11280
11307
|
return i;
|
|
11281
11308
|
}
|
|
11282
|
-
function
|
|
11309
|
+
function Lp(e) {
|
|
11283
11310
|
return (t) => {
|
|
11284
11311
|
const n = Gc(t);
|
|
11285
11312
|
return {
|
|
@@ -11291,7 +11318,7 @@ function jp(e) {
|
|
|
11291
11318
|
};
|
|
11292
11319
|
};
|
|
11293
11320
|
}
|
|
11294
|
-
const
|
|
11321
|
+
const Pp = (e) => ({
|
|
11295
11322
|
Field(t) {
|
|
11296
11323
|
const n = t.name.value;
|
|
11297
11324
|
(n === "__schema" || n === "__type") && e.reportError(
|
|
@@ -11811,7 +11838,7 @@ const Xc = (
|
|
|
11811
11838
|
crs: String!
|
|
11812
11839
|
}
|
|
11813
11840
|
`
|
|
11814
|
-
),
|
|
11841
|
+
), xp = /* @__PURE__ */ new Set([
|
|
11815
11842
|
"KeyScope",
|
|
11816
11843
|
"TextCase",
|
|
11817
11844
|
"UnicodeForm",
|
|
@@ -11844,7 +11871,7 @@ const Xc = (
|
|
|
11844
11871
|
"Duration",
|
|
11845
11872
|
"Point",
|
|
11846
11873
|
"CartesianPoint"
|
|
11847
|
-
]),
|
|
11874
|
+
]), Fp = /* @__PURE__ */ new Set([
|
|
11848
11875
|
"size",
|
|
11849
11876
|
"range",
|
|
11850
11877
|
"length",
|
|
@@ -11852,7 +11879,7 @@ const Xc = (
|
|
|
11852
11879
|
"format",
|
|
11853
11880
|
"multipleOf",
|
|
11854
11881
|
"normalize"
|
|
11855
|
-
]),
|
|
11882
|
+
]), zp = {
|
|
11856
11883
|
"node type": [
|
|
11857
11884
|
"node",
|
|
11858
11885
|
"authorizationRule",
|
|
@@ -12018,29 +12045,29 @@ const Xc = (
|
|
|
12018
12045
|
"interface relationship field": ["declareRelationship"],
|
|
12019
12046
|
"field of an object type without @node": ["cacheControl"],
|
|
12020
12047
|
"@jwt claim": ["jwtClaim", "viewer"]
|
|
12021
|
-
},
|
|
12048
|
+
}, Bp = {
|
|
12022
12049
|
"interface field": "; put it on the field of each implementation",
|
|
12023
12050
|
"@customResolver field": "; the resolver decides what it returns",
|
|
12024
12051
|
"field of an object type without @node": "; this type only shapes @cypher results",
|
|
12025
12052
|
"object type without @node": "; this type only shapes @cypher results"
|
|
12026
12053
|
};
|
|
12027
12054
|
let Tr;
|
|
12028
|
-
function
|
|
12055
|
+
function qp() {
|
|
12029
12056
|
return Tr ??= new Set(
|
|
12030
12057
|
tt(Xc).definitions.flatMap(
|
|
12031
12058
|
(e) => e.kind === "DirectiveDefinition" ? [e.name.value] : []
|
|
12032
12059
|
)
|
|
12033
12060
|
), Tr;
|
|
12034
12061
|
}
|
|
12035
|
-
function
|
|
12036
|
-
const n =
|
|
12037
|
-
const u =
|
|
12062
|
+
function Wp(e, t) {
|
|
12063
|
+
const n = qp(), i = (r, a, c, l) => {
|
|
12064
|
+
const u = zp[a];
|
|
12038
12065
|
for (const d of r) {
|
|
12039
12066
|
const f = d.name.value;
|
|
12040
12067
|
!n.has(f) || u.includes(f) || t.push({
|
|
12041
12068
|
type: c,
|
|
12042
12069
|
...l ? { field: l } : {},
|
|
12043
|
-
message: `@${f} is not supported on ${/^[aeiou]/.test(a) ? "an" : "a"} ${a}${
|
|
12070
|
+
message: `@${f} is not supported on ${/^[aeiou]/.test(a) ? "an" : "a"} ${a}${Bp[a] ?? ""}`
|
|
12044
12071
|
});
|
|
12045
12072
|
}
|
|
12046
12073
|
}, s = (r) => [
|
|
@@ -12089,7 +12116,7 @@ function qp(e, t) {
|
|
|
12089
12116
|
for (const l of a.args)
|
|
12090
12117
|
for (const u of l.astNode?.directives ?? []) {
|
|
12091
12118
|
const d = u.name.value;
|
|
12092
|
-
!n.has(d) || c &&
|
|
12119
|
+
!n.has(d) || c && Fp.has(d) || t.push({
|
|
12093
12120
|
type: r.name,
|
|
12094
12121
|
field: a.name,
|
|
12095
12122
|
message: `argument ${l.name}: @${d} applies to arguments of @cypher fields`
|
|
@@ -12097,9 +12124,9 @@ function qp(e, t) {
|
|
|
12097
12124
|
}
|
|
12098
12125
|
}
|
|
12099
12126
|
}
|
|
12100
|
-
const
|
|
12101
|
-
function
|
|
12102
|
-
const t = e.maxLimit ?? Jc, n = Math.min(e.defaultLimit ??
|
|
12127
|
+
const Hp = 25, Jc = 100;
|
|
12128
|
+
function Vp(e) {
|
|
12129
|
+
const t = e.maxLimit ?? Jc, n = Math.min(e.defaultLimit ?? Hp, t);
|
|
12103
12130
|
if (!(t >= 1) || !(n >= 1))
|
|
12104
12131
|
throw new Gt([
|
|
12105
12132
|
{ message: "defaultLimit and maxLimit must be at least 1" }
|
|
@@ -12114,7 +12141,7 @@ function Mi(e, t, n, i, s) {
|
|
|
12114
12141
|
max: Math.min(o, t.max)
|
|
12115
12142
|
};
|
|
12116
12143
|
}
|
|
12117
|
-
const
|
|
12144
|
+
const Gp = /* @__PURE__ */ new Set(["String", "ID"]), Qp = /* @__PURE__ */ new Set(["Int", "Float", "BigInt"]), vt = (e, t) => typeof e[t] == "number" ? e[t] : void 0, Xt = (e) => typeof e.message == "string" ? { message: e.message } : {};
|
|
12118
12145
|
function Yc(e, t, n, i) {
|
|
12119
12146
|
const s = (y) => i.skip?.has(y) ? void 0 : K(e(y), t, n) ?? (i.scalar ? K(
|
|
12120
12147
|
e(y),
|
|
@@ -12139,7 +12166,7 @@ function Yc(e, t, n, i) {
|
|
|
12139
12166
|
n(`${p}: a @vector is bounded by its dimensions`);
|
|
12140
12167
|
return;
|
|
12141
12168
|
}
|
|
12142
|
-
const h = {}, m =
|
|
12169
|
+
const h = {}, m = Gp.has(i.type), g = Qp.has(i.type);
|
|
12143
12170
|
if (o) {
|
|
12144
12171
|
const y = vt(o, "min"), E = vt(o, "max");
|
|
12145
12172
|
m ? y === void 0 && E === void 0 ? n("@length needs min, max or both") : (y ?? 0) < 0 || (E ?? 0) < 0 ? n("@length bounds cannot be negative") : y !== void 0 && E !== void 0 && y > E ? n("@length(min:) is greater than max") : h.length = {
|
|
@@ -12221,7 +12248,7 @@ function Yc(e, t, n, i) {
|
|
|
12221
12248
|
}
|
|
12222
12249
|
}
|
|
12223
12250
|
const Zc = /* @__PURE__ */ new WeakMap();
|
|
12224
|
-
function
|
|
12251
|
+
function Kp(e, t, n, i, s, o, r) {
|
|
12225
12252
|
const a = (p) => r.push({ type: e, message: p }), c = Zs(i ?? n), l = [];
|
|
12226
12253
|
(o?.indexes ?? []).forEach((p, h) => {
|
|
12227
12254
|
h > 0 && !p.name && a("@fulltext: every index after the first needs a name");
|
|
@@ -12267,7 +12294,7 @@ function Ar(e) {
|
|
|
12267
12294
|
return "@authorization(validate:) for READ";
|
|
12268
12295
|
if (e.authentication?.has("READ")) return "@authentication for READ";
|
|
12269
12296
|
}
|
|
12270
|
-
const kr = ["CONTAINS", "STARTS_WITH", "ENDS_WITH"], it = ["LT", "LTE", "GT", "GTE"],
|
|
12297
|
+
const kr = ["CONTAINS", "STARTS_WITH", "ENDS_WITH"], it = ["LT", "LTE", "GT", "GTE"], Xp = {
|
|
12271
12298
|
String: ["EQ", "IN", ...it, ...kr],
|
|
12272
12299
|
ID: ["EQ", "IN", ...it, ...kr],
|
|
12273
12300
|
Int: ["EQ", "IN", ...it],
|
|
@@ -12283,7 +12310,7 @@ const kr = ["CONTAINS", "STARTS_WITH", "ENDS_WITH"], it = ["LT", "LTE", "GT", "G
|
|
|
12283
12310
|
Enum: ["EQ", "IN"],
|
|
12284
12311
|
Point: ["WITHIN_BBOX", "DISTANCE"],
|
|
12285
12312
|
CartesianPoint: ["WITHIN_BBOX", "DISTANCE"]
|
|
12286
|
-
},
|
|
12313
|
+
}, Jp = /* @__PURE__ */ new Set(["String", "ID", "Int", "BigInt"]), Yp = /* @__PURE__ */ new Set(["Point", "CartesianPoint", "Duration"]);
|
|
12287
12314
|
function rs(e, t, n, i, s) {
|
|
12288
12315
|
const o = (ie) => i.push({ type: e.name, field: t.name, message: ie }), r = _n(t.type), a = We(t.type);
|
|
12289
12316
|
let c, l;
|
|
@@ -12319,11 +12346,11 @@ function rs(e, t, n, i, s) {
|
|
|
12319
12346
|
const ie = $.value;
|
|
12320
12347
|
po(c, r.list, ie) || o(`@default(value:) does not fit ${r.list ? `[${c}]` : c}`), d && o("@key cannot have a @default; use @key(generate: true)"), (c === "Point" || c === "CartesianPoint") && o("Point fields cannot have a @default"), te = { value: ie };
|
|
12321
12348
|
}
|
|
12322
|
-
!s.allowKey && (d || f || h || v) && o("@key, @unique, @relayId and @index are not allowed here"), d && (
|
|
12349
|
+
!s.allowKey && (d || f || h || v) && o("@key, @unique, @relayId and @index are not allowed here"), d && (Jp.has(c) || o("@key must be String, ID, Int or BigInt"), r.required || o("@key fields must be non-null"), r.list && o("@key cannot be a list"), p && o("@key cannot be @private")), h && !d && o("@relayId belongs on the @key field"), f && r.list && o("@unique cannot be a list");
|
|
12323
12350
|
let ee = /* @__PURE__ */ new Set();
|
|
12324
12351
|
if (y) {
|
|
12325
12352
|
const ie = r.list ? c === "Point" || c === "CartesianPoint" || b ? [] : ["INCLUDES", ...r.required ? [] : ["IS_NULL"]] : [
|
|
12326
|
-
...
|
|
12353
|
+
...Xp[c],
|
|
12327
12354
|
...r.required ? [] : ["IS_NULL"],
|
|
12328
12355
|
...c === "String" || c === "ID" ? ["CASE_INSENSITIVE"] : []
|
|
12329
12356
|
], ge = y.byValue ?? (r.list ? ["INCLUDES"] : ["EQ", "IN"]).filter((Ie) => ie.includes(Ie)), Me = ge.filter((Ie) => !ie.includes(Ie));
|
|
@@ -12331,7 +12358,7 @@ function rs(e, t, n, i, s) {
|
|
|
12331
12358
|
`${c} does not support ${Me.join(", ")}` + (ie.length > 0 ? ` (allowed: ${ie.join(", ")})` : "")
|
|
12332
12359
|
), ee = new Set(ge.filter((Ie) => ie.includes(Ie)));
|
|
12333
12360
|
}
|
|
12334
|
-
d && (ee.add("EQ"), ee.add("IN")), p && (y || m) && o("@private fields cannot be @filterable or @sortable"), m && (r.list ||
|
|
12361
|
+
d && (ee.add("EQ"), ee.add("IN")), p && (y || m) && o("@private fields cannot be @filterable or @sortable"), m && (r.list || Yp.has(c)) && o(`${r.list ? "lists" : c} cannot be @sortable`), g && (r.list || c === "Point" || c === "CartesianPoint" || p || !s.allowKey) && o("@groupBy needs a readable, non-list, non-Point field of a @node type");
|
|
12335
12362
|
const re = E?.property ?? t.name;
|
|
12336
12363
|
re.length === 0 && o("@alias(property:) is empty");
|
|
12337
12364
|
const _ = [];
|
|
@@ -12434,8 +12461,8 @@ function po(e, t, n) {
|
|
|
12434
12461
|
return typeof n == "string";
|
|
12435
12462
|
}
|
|
12436
12463
|
}
|
|
12437
|
-
const
|
|
12438
|
-
function
|
|
12464
|
+
const Zp = /^[A-Z][A-Z0-9_]*$/;
|
|
12465
|
+
function eh(e, t, n, i) {
|
|
12439
12466
|
let s;
|
|
12440
12467
|
for (const o of n) {
|
|
12441
12468
|
const r = i.get(o)?.fields.get(t.name);
|
|
@@ -12452,7 +12479,7 @@ function Zp(e, t, n, i) {
|
|
|
12452
12479
|
description: t.description ?? void 0
|
|
12453
12480
|
} : "has no @node implementations";
|
|
12454
12481
|
}
|
|
12455
|
-
function
|
|
12482
|
+
function th(e, t, n, i, s, o) {
|
|
12456
12483
|
const r = (v) => i.push({ type: e.name, field: t.name, message: v }), a = fc(
|
|
12457
12484
|
K(n("authorization"), t, r),
|
|
12458
12485
|
r,
|
|
@@ -12467,7 +12494,7 @@ function eh(e, t, n, i, s, o) {
|
|
|
12467
12494
|
const l = _n(t.type);
|
|
12468
12495
|
l.list && (!l.itemRequired || !l.required) && r("relationship lists must be written [T!]!"), l.depth > 1 && r("nested lists are not supported");
|
|
12469
12496
|
const u = c.type;
|
|
12470
|
-
|
|
12497
|
+
Zp.test(u) || r(`relationship type \`${u}\` must be SCREAMING_SNAKE_CASE`);
|
|
12471
12498
|
const d = c.properties;
|
|
12472
12499
|
d !== void 0 && !s.has(d) && r(`${d} is not a @relationshipProperties type`);
|
|
12473
12500
|
for (const v of [
|
|
@@ -12531,7 +12558,7 @@ function eh(e, t, n, i, s, o) {
|
|
|
12531
12558
|
description: t.description ?? void 0
|
|
12532
12559
|
};
|
|
12533
12560
|
}
|
|
12534
|
-
const
|
|
12561
|
+
const nh = /\b(CREATE|MERGE|SET|DELETE|REMOVE|DETACH)\b/i;
|
|
12535
12562
|
function el(e) {
|
|
12536
12563
|
const t = Zi(e), n = [...t.matchAll(/\bRETURN\b/gi)], i = n[n.length - 1];
|
|
12537
12564
|
return i ? (
|
|
@@ -12541,8 +12568,8 @@ function el(e) {
|
|
|
12541
12568
|
) || /\b[Aa][Ss]\s+`(created|updated)`/.test(e.slice(i.index))
|
|
12542
12569
|
) : !1;
|
|
12543
12570
|
}
|
|
12544
|
-
const
|
|
12545
|
-
function
|
|
12571
|
+
const sh = ["jwt", "viewer", "operation"];
|
|
12572
|
+
function ih(e, t, n, i, s) {
|
|
12546
12573
|
const o = [];
|
|
12547
12574
|
for (const { node: r } of un("trigger", e)) {
|
|
12548
12575
|
let a = !0;
|
|
@@ -12585,7 +12612,7 @@ function sh(e, t, n, i, s) {
|
|
|
12585
12612
|
}
|
|
12586
12613
|
const m = [...new Set(Bn(d).map((g) => g.name))];
|
|
12587
12614
|
for (const g of m)
|
|
12588
|
-
|
|
12615
|
+
sh.includes(g) ? g === "viewer" && !s && c("the statement uses $viewer, but no @jwt claim has @viewer") : c(
|
|
12589
12616
|
`the statement uses $${g}; a trigger statement has $jwt, $viewer and $operation`
|
|
12590
12617
|
);
|
|
12591
12618
|
a && o.push({
|
|
@@ -12594,7 +12621,7 @@ function sh(e, t, n, i, s) {
|
|
|
12594
12621
|
statement: d,
|
|
12595
12622
|
fields: f,
|
|
12596
12623
|
params: m,
|
|
12597
|
-
writes:
|
|
12624
|
+
writes: nh.test(Fa(d)),
|
|
12598
12625
|
reports: el(d)
|
|
12599
12626
|
});
|
|
12600
12627
|
}
|
|
@@ -12604,7 +12631,7 @@ const Rr = /\b(CREATE|MERGE|SET|DELETE|REMOVE|DETACH)\b/;
|
|
|
12604
12631
|
function Ir(e, t, n, i, s, o) {
|
|
12605
12632
|
const r = (C) => i.push({ type: e, field: t.name, message: C }), a = (C) => s.push({ type: e, field: t.name, message: C }), c = K(n("cypher"), t, r);
|
|
12606
12633
|
if (!c) return;
|
|
12607
|
-
const l = o.root ?
|
|
12634
|
+
const l = o.root ? Pd(K(n("authorization"), t, r), r) : fc(K(n("authorization"), t, r), r), u = c.statement;
|
|
12608
12635
|
for (const C of [
|
|
12609
12636
|
"relationship",
|
|
12610
12637
|
"key",
|
|
@@ -12626,7 +12653,7 @@ function Ir(e, t, n, i, s, o) {
|
|
|
12626
12653
|
d.depth > 1 && r("nested lists are not supported"), d.list && !d.itemRequired && r("list items must be non-null, e.g. [Festival!]");
|
|
12627
12654
|
const y = c.cost ?? 0;
|
|
12628
12655
|
y < 0 && r("cost must not be negative");
|
|
12629
|
-
const E = c.columnName ??
|
|
12656
|
+
const E = c.columnName ?? ah(u);
|
|
12630
12657
|
if (!E) {
|
|
12631
12658
|
r("cannot tell which column holds the value; set @cypher(columnName:)");
|
|
12632
12659
|
return;
|
|
@@ -12643,7 +12670,7 @@ function Ir(e, t, n, i, s, o) {
|
|
|
12643
12670
|
}, A = K(n("size"), C, b), O = K(n("range"), C, b), T = A !== void 0 && A.min == null && A.unique == null && A.message == null, F = O !== void 0 && O.exclusiveMin == null && O.exclusiveMax == null && O.message == null;
|
|
12644
12671
|
let q;
|
|
12645
12672
|
T && (K(n("size"), C, r), q = A.max ?? void 0, q === void 0 ? r(`argument ${C.name}: @size needs max, min or unique`) : X.list ? q < 1 && r(`argument ${C.name}: @size(max:) must be at least 1`) : r(`argument ${C.name}: @size applies to list arguments`));
|
|
12646
|
-
const J = F ?
|
|
12673
|
+
const J = F ? oh(C, x, n("range"), r) : void 0, te = rh(C);
|
|
12647
12674
|
J && eo(te, J) !== void 0 && r(`argument ${C.name}: its default is outside @range`);
|
|
12648
12675
|
const ee = o.schema.getType(x), re = Yc(
|
|
12649
12676
|
n,
|
|
@@ -12727,7 +12754,7 @@ function Ir(e, t, n, i, s, o) {
|
|
|
12727
12754
|
};
|
|
12728
12755
|
return I && (I.computedBy = k), k;
|
|
12729
12756
|
}
|
|
12730
|
-
function
|
|
12757
|
+
function oh(e, t, n, i) {
|
|
12731
12758
|
const s = K(n, e, i);
|
|
12732
12759
|
if (!s) return;
|
|
12733
12760
|
const o = s.min, r = s.max;
|
|
@@ -12748,13 +12775,13 @@ function ih(e, t, n, i) {
|
|
|
12748
12775
|
...r != null ? { max: r } : {}
|
|
12749
12776
|
};
|
|
12750
12777
|
}
|
|
12751
|
-
function
|
|
12778
|
+
function rh(e) {
|
|
12752
12779
|
if (e.defaultValue !== void 0) return e.defaultValue;
|
|
12753
12780
|
const t = e.default;
|
|
12754
12781
|
if (t)
|
|
12755
12782
|
return "value" in t ? t.value : t.literal ? ml(t.literal, e.type) : void 0;
|
|
12756
12783
|
}
|
|
12757
|
-
function
|
|
12784
|
+
function ah(e) {
|
|
12758
12785
|
const t = Zi(e), n = [];
|
|
12759
12786
|
let i = 0;
|
|
12760
12787
|
for (const p of t)
|
|
@@ -12881,7 +12908,7 @@ const Vs = /* @__PURE__ */ new Set([
|
|
|
12881
12908
|
"startsWith",
|
|
12882
12909
|
"endsWith",
|
|
12883
12910
|
"isNull"
|
|
12884
|
-
]),
|
|
12911
|
+
]), ch = /* @__PURE__ */ new Set([...Vs, "includes", "exists"]), lh = /* @__PURE__ */ new Set(["eq", "lt", "lte", "gt", "gte"]);
|
|
12885
12912
|
function Kn(e, t, n, i, s, o, r) {
|
|
12886
12913
|
$t(
|
|
12887
12914
|
e,
|
|
@@ -12946,7 +12973,7 @@ function $t(e, t, n, i, s, o, r, a, c, l, u = "rules on relationship properties
|
|
|
12946
12973
|
d(`${$}.${N} must be an operator object`);
|
|
12947
12974
|
else
|
|
12948
12975
|
for (const [I, k] of Object.entries(D))
|
|
12949
|
-
|
|
12976
|
+
ch.has(I) || d(`${$}.${N}: unknown operator ${I}`), JSON.stringify(k ?? null).includes("${") && d(
|
|
12950
12977
|
`${$}.${N}.${I}: claim tests compare with literals; \${...} placeholders belong in node parts`
|
|
12951
12978
|
);
|
|
12952
12979
|
else
|
|
@@ -12956,7 +12983,7 @@ function $t(e, t, n, i, s, o, r, a, c, l, u = "rules on relationship properties
|
|
|
12956
12983
|
};
|
|
12957
12984
|
m(o, "");
|
|
12958
12985
|
}
|
|
12959
|
-
function
|
|
12986
|
+
function uh(e, t, n, i, s, o, r) {
|
|
12960
12987
|
if (!i.memberAuthorization) return;
|
|
12961
12988
|
const a = i.properties ? t.get(i.properties) : void 0, c = (l, u) => l.type === u.type && l.field === u.field && l.message === u.message;
|
|
12962
12989
|
for (const [l, u] of i.memberAuthorization) {
|
|
@@ -13008,7 +13035,7 @@ function Ht(e, t, n, i, s, o) {
|
|
|
13008
13035
|
if (!l && d?.kind === "relationship" && !d.list)
|
|
13009
13036
|
typeof a != "boolean" && o(`${c} must be true or false`);
|
|
13010
13037
|
else if (!l && u?.kind === "relationship" && u.list && u.properties)
|
|
13011
|
-
|
|
13038
|
+
dh(e, t, u, a, c, o);
|
|
13012
13039
|
else if (!l)
|
|
13013
13040
|
o(`${c}: ${n.name} has no field ${r}`);
|
|
13014
13041
|
else if (l.kind === "cypher" || l.kind === "custom")
|
|
@@ -13037,7 +13064,7 @@ function Ht(e, t, n, i, s, o) {
|
|
|
13037
13064
|
if (!qe(g)) o(`${c}.count must be an operator object`);
|
|
13038
13065
|
else
|
|
13039
13066
|
for (const y of Object.keys(g))
|
|
13040
|
-
|
|
13067
|
+
lh.has(y) || o(`${c}.count: unknown operator ${y}`);
|
|
13041
13068
|
else ["some", "all", "none", "single"].includes(m) ? h(g, `${c}.${m}`) : o(`${c}: expected some, all, none, single or count`);
|
|
13042
13069
|
}
|
|
13043
13070
|
}
|
|
@@ -13077,7 +13104,7 @@ function Li(e, t, n, i, s, o) {
|
|
|
13077
13104
|
}
|
|
13078
13105
|
}
|
|
13079
13106
|
}
|
|
13080
|
-
function
|
|
13107
|
+
function dh(e, t, n, i, s, o) {
|
|
13081
13108
|
if (!qe(i) || Object.keys(i).length === 0)
|
|
13082
13109
|
return o(`${s} must be a non-empty object`);
|
|
13083
13110
|
const r = e.get(n.target), a = t.get(n.properties);
|
|
@@ -13117,7 +13144,7 @@ function Ds(e, t, n, i) {
|
|
|
13117
13144
|
Vs.has(a) ? c === null ? i(`${r}.${a} is null`) : a === "isNull" && typeof c != "boolean" && i(`${r}.isNull must be true or false`) : i(`${r}: unknown operator ${a}`);
|
|
13118
13145
|
}
|
|
13119
13146
|
}
|
|
13120
|
-
function
|
|
13147
|
+
function fh(e, t, n) {
|
|
13121
13148
|
const i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = (r, a, c) => {
|
|
13122
13149
|
const l = K(t, r, c);
|
|
13123
13150
|
if (!l) return;
|
|
@@ -13141,7 +13168,7 @@ function dh(e, t, n) {
|
|
|
13141
13168
|
}
|
|
13142
13169
|
return { types: i, fields: s };
|
|
13143
13170
|
}
|
|
13144
|
-
function
|
|
13171
|
+
function ph(e, t, n, i, s, o) {
|
|
13145
13172
|
const r = [];
|
|
13146
13173
|
for (const { node: a } of un("uniqueTogether", e)) {
|
|
13147
13174
|
let c = !0;
|
|
@@ -13170,9 +13197,9 @@ function fh(e, t, n, i, s, o) {
|
|
|
13170
13197
|
}
|
|
13171
13198
|
return r;
|
|
13172
13199
|
}
|
|
13173
|
-
const
|
|
13174
|
-
function
|
|
13175
|
-
const n =
|
|
13200
|
+
const hh = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
|
|
13201
|
+
function mh(e, t = {}) {
|
|
13202
|
+
const n = Vp(t);
|
|
13176
13203
|
let i;
|
|
13177
13204
|
try {
|
|
13178
13205
|
const w = typeof e == "string" ? tt(e) : e;
|
|
@@ -13185,7 +13212,7 @@ function hh(e, t = {}) {
|
|
|
13185
13212
|
);
|
|
13186
13213
|
}
|
|
13187
13214
|
const s = [], o = (w) => i.getDirective(w), r = (w) => (S) => s.push({ type: w, message: S }), a = Object.values(i.getTypeMap()).filter(
|
|
13188
|
-
(w) => !w.name.startsWith("__") && !
|
|
13215
|
+
(w) => !w.name.startsWith("__") && !xp.has(w.name)
|
|
13189
13216
|
), c = {}, l = K(
|
|
13190
13217
|
o("authorizationDefaults"),
|
|
13191
13218
|
i,
|
|
@@ -13243,7 +13270,7 @@ function hh(e, t = {}) {
|
|
|
13243
13270
|
});
|
|
13244
13271
|
continue;
|
|
13245
13272
|
}
|
|
13246
|
-
if (
|
|
13273
|
+
if (hh.has(w.name)) {
|
|
13247
13274
|
w.name === "Subscription" ? s.push({
|
|
13248
13275
|
type: w.name,
|
|
13249
13276
|
message: "custom subscriptions are not supported; use LoraGraphQL.onWrite / changes()"
|
|
@@ -13306,7 +13333,7 @@ function hh(e, t = {}) {
|
|
|
13306
13333
|
...E.map((w) => w.name),
|
|
13307
13334
|
...v.map((w) => w.name)
|
|
13308
13335
|
]), b = new Set(m.map((w) => w.name));
|
|
13309
|
-
|
|
13336
|
+
Wp(
|
|
13310
13337
|
{ nodeNames: k, propsNames: b, jwtType: N, targetNames: X, userTypes: a },
|
|
13311
13338
|
s
|
|
13312
13339
|
);
|
|
@@ -13396,7 +13423,7 @@ function hh(e, t = {}) {
|
|
|
13396
13423
|
continue;
|
|
13397
13424
|
}
|
|
13398
13425
|
if (X.has(lt.name)) {
|
|
13399
|
-
const Ge =
|
|
13426
|
+
const Ge = th(
|
|
13400
13427
|
w,
|
|
13401
13428
|
oe,
|
|
13402
13429
|
o,
|
|
@@ -13450,7 +13477,7 @@ function hh(e, t = {}) {
|
|
|
13450
13477
|
field: "id",
|
|
13451
13478
|
message: "@relayId adds a global `id` field; rename this field or map it with @alias"
|
|
13452
13479
|
});
|
|
13453
|
-
const yt =
|
|
13480
|
+
const yt = Kp(
|
|
13454
13481
|
w.name,
|
|
13455
13482
|
L[0],
|
|
13456
13483
|
Ys(w.name),
|
|
@@ -13531,7 +13558,7 @@ function hh(e, t = {}) {
|
|
|
13531
13558
|
if (et(w))
|
|
13532
13559
|
for (const Pe of Object.values(w.getFields())) {
|
|
13533
13560
|
if (K(o("declareRelationship"), Pe, S) !== void 0) {
|
|
13534
|
-
const Et =
|
|
13561
|
+
const Et = eh(w.name, Pe, L, T);
|
|
13535
13562
|
typeof Et == "string" ? s.push({
|
|
13536
13563
|
type: w.name,
|
|
13537
13564
|
field: Pe.name,
|
|
@@ -13748,7 +13775,7 @@ function hh(e, t = {}) {
|
|
|
13748
13775
|
tl.set(T, J);
|
|
13749
13776
|
for (const w of h) {
|
|
13750
13777
|
const S = T.get(w.name);
|
|
13751
|
-
S && (S.uniqueTogether =
|
|
13778
|
+
S && (S.uniqueTogether = ph(w, S, T, A, o, s), S.triggers = ih(
|
|
13752
13779
|
w,
|
|
13753
13780
|
S,
|
|
13754
13781
|
o,
|
|
@@ -13814,7 +13841,7 @@ function hh(e, t = {}) {
|
|
|
13814
13841
|
...S.authorization.validate.filter((V) => !tn(V))
|
|
13815
13842
|
]);
|
|
13816
13843
|
const Q = S.kind === "relationship" ? H(S) : void 0;
|
|
13817
|
-
Q ? ae(void 0, w.name, S.name, L, Q) : S.kind === "relationship" && L.length > 0 && J.has(S.target) && (S.memberAuthorization =
|
|
13844
|
+
Q ? ae(void 0, w.name, S.name, L, Q) : S.kind === "relationship" && L.length > 0 && J.has(S.target) && (S.memberAuthorization = Fd(
|
|
13818
13845
|
S,
|
|
13819
13846
|
T,
|
|
13820
13847
|
(V, le) => ae(
|
|
@@ -13927,7 +13954,7 @@ function hh(e, t = {}) {
|
|
|
13927
13954
|
V
|
|
13928
13955
|
);
|
|
13929
13956
|
}
|
|
13930
|
-
L.kind === "relationship" &&
|
|
13957
|
+
L.kind === "relationship" && uh(
|
|
13931
13958
|
T,
|
|
13932
13959
|
A,
|
|
13933
13960
|
w,
|
|
@@ -14011,7 +14038,7 @@ function hh(e, t = {}) {
|
|
|
14011
14038
|
...(S.authorization?.validate ?? []).flatMap((le) => [...le.operations]),
|
|
14012
14039
|
...S.authentication ?? []
|
|
14013
14040
|
], V = [
|
|
14014
|
-
...new Set(Q.filter((le) => !
|
|
14041
|
+
...new Set(Q.filter((le) => !xd.has(le)))
|
|
14015
14042
|
];
|
|
14016
14043
|
V.length > 0 && L(
|
|
14017
14044
|
`rules on a relationship property apply to READ, CREATE and UPDATE, not ${V.join(", ")}`
|
|
@@ -14066,8 +14093,8 @@ function hh(e, t = {}) {
|
|
|
14066
14093
|
type: w,
|
|
14067
14094
|
message: "object types need @node or @relationshipProperties, unless a @cypher field returns them"
|
|
14068
14095
|
});
|
|
14069
|
-
const Me =
|
|
14070
|
-
if (s.length > 0) throw new Gt(
|
|
14096
|
+
const Me = fh(a, o("cacheControl"), r);
|
|
14097
|
+
if (s.length > 0) throw new Gt(gh(s));
|
|
14071
14098
|
const Ie = {
|
|
14072
14099
|
nodes: T,
|
|
14073
14100
|
abstracts: J,
|
|
@@ -14101,7 +14128,7 @@ function hh(e, t = {}) {
|
|
|
14101
14128
|
});
|
|
14102
14129
|
return Ie;
|
|
14103
14130
|
}
|
|
14104
|
-
function
|
|
14131
|
+
function gh(e) {
|
|
14105
14132
|
const t = /* @__PURE__ */ new Set();
|
|
14106
14133
|
return e.filter((n) => {
|
|
14107
14134
|
const i = `${n.type}\0${n.field}\0${n.message}`;
|
|
@@ -14119,8 +14146,8 @@ function Or(e, t, n) {
|
|
|
14119
14146
|
}), i.set(s.property, s.name);
|
|
14120
14147
|
}
|
|
14121
14148
|
}
|
|
14122
|
-
const
|
|
14123
|
-
class
|
|
14149
|
+
const yh = 2;
|
|
14150
|
+
class Eh {
|
|
14124
14151
|
#e;
|
|
14125
14152
|
constructor(t) {
|
|
14126
14153
|
this.#e = t;
|
|
@@ -14160,7 +14187,7 @@ class yh {
|
|
|
14160
14187
|
} catch (u) {
|
|
14161
14188
|
throw l = u, r && _r(r, u), u;
|
|
14162
14189
|
} finally {
|
|
14163
|
-
const u = performance.now() - a, d = c === void 0 ? 0 :
|
|
14190
|
+
const u = performance.now() - a, d = c === void 0 ? 0 : wh(c);
|
|
14164
14191
|
r && (r.setAttribute("db.response.returned_rows", d), r.end()), this.#t(t, n, u, d, l);
|
|
14165
14192
|
}
|
|
14166
14193
|
};
|
|
@@ -14209,16 +14236,16 @@ function Cr(e) {
|
|
|
14209
14236
|
end: t(() => e.end())
|
|
14210
14237
|
};
|
|
14211
14238
|
}
|
|
14212
|
-
function
|
|
14239
|
+
function wh(e) {
|
|
14213
14240
|
return Array.isArray(e) ? e.reduce((t, n) => t + n.rows.length, 0) : e.rows.length;
|
|
14214
14241
|
}
|
|
14215
14242
|
function _r(e, t) {
|
|
14216
14243
|
e.recordException(t instanceof Error ? t : String(t)), e.setStatus({
|
|
14217
|
-
code:
|
|
14244
|
+
code: yh,
|
|
14218
14245
|
message: t instanceof Error ? t.message : String(t)
|
|
14219
14246
|
});
|
|
14220
14247
|
}
|
|
14221
|
-
function
|
|
14248
|
+
function vh(e, t) {
|
|
14222
14249
|
const n = [];
|
|
14223
14250
|
for (const i of e.nodes.values())
|
|
14224
14251
|
for (const s of i.fields.values()) {
|
|
@@ -14245,7 +14272,7 @@ function wh(e, t) {
|
|
|
14245
14272
|
field: s.name,
|
|
14246
14273
|
message: `requires: ${a.message}`
|
|
14247
14274
|
});
|
|
14248
|
-
for (const a of
|
|
14275
|
+
for (const a of bh(i, s.requires))
|
|
14249
14276
|
n.push({
|
|
14250
14277
|
type: i.name,
|
|
14251
14278
|
field: s.name,
|
|
@@ -14254,16 +14281,16 @@ function wh(e, t) {
|
|
|
14254
14281
|
}
|
|
14255
14282
|
if (n.length > 0) throw new Gt(n);
|
|
14256
14283
|
}
|
|
14257
|
-
function
|
|
14284
|
+
function bh(e, t) {
|
|
14258
14285
|
return tt(`{ ${t} }`).definitions[0].selectionSet.selections.flatMap(
|
|
14259
14286
|
(s) => s.kind === fe.FIELD && e.fields.get(s.name.value)?.kind === "custom" ? [s.name.value] : []
|
|
14260
14287
|
);
|
|
14261
14288
|
}
|
|
14262
|
-
function
|
|
14289
|
+
function $h(e, t, n) {
|
|
14263
14290
|
let i;
|
|
14264
14291
|
if (n instanceof ve) i = n;
|
|
14265
14292
|
else {
|
|
14266
|
-
const s =
|
|
14293
|
+
const s = zf(e.model, n);
|
|
14267
14294
|
s !== n ? i = s : n.code === "LORA_INVALID_VECTOR" ? i = U(
|
|
14268
14295
|
"BAD_USER_INPUT",
|
|
14269
14296
|
n instanceof Error ? n.message : String(n),
|
|
@@ -14295,7 +14322,7 @@ function bh(e, t, n) {
|
|
|
14295
14322
|
}
|
|
14296
14323
|
return e.maskErrors && i.originalError ? new ve(i.message, { extensions: i.extensions }) : i;
|
|
14297
14324
|
}
|
|
14298
|
-
function
|
|
14325
|
+
function Th(e, t, n, i) {
|
|
14299
14326
|
const s = t.cacheHints;
|
|
14300
14327
|
if (!s || s.types.size === 0 && s.fields.size === 0)
|
|
14301
14328
|
return;
|
|
@@ -14308,7 +14335,7 @@ function $h(e, t, n, i) {
|
|
|
14308
14335
|
...t.nodes.keys(),
|
|
14309
14336
|
...t.abstracts.keys(),
|
|
14310
14337
|
...t.objects.keys()
|
|
14311
|
-
]), l =
|
|
14338
|
+
]), l = Ah(t), u = (g) => s.types.get(l.get(g) ?? g);
|
|
14312
14339
|
let d = 1 / 0, f = "PUBLIC", p = 0;
|
|
14313
14340
|
const h = (g) => {
|
|
14314
14341
|
p++, d = Math.min(d, g.maxAge), g.scope === "PRIVATE" && (f = "PRIVATE");
|
|
@@ -14334,7 +14361,7 @@ function $h(e, t, n, i) {
|
|
|
14334
14361
|
if (!(!m(r, o.selectionSet, !0) || p === 0))
|
|
14335
14362
|
return { maxAge: d, scope: f };
|
|
14336
14363
|
}
|
|
14337
|
-
function
|
|
14364
|
+
function Ah(e) {
|
|
14338
14365
|
const t = /* @__PURE__ */ new Map();
|
|
14339
14366
|
for (const n of [...e.nodes.keys(), ...e.abstracts.keys()])
|
|
14340
14367
|
for (const i of [
|
|
@@ -14348,8 +14375,8 @@ function Th(e) {
|
|
|
14348
14375
|
t.set(i(n), n);
|
|
14349
14376
|
return t;
|
|
14350
14377
|
}
|
|
14351
|
-
const
|
|
14352
|
-
class
|
|
14378
|
+
const kh = 500, Mr = (e) => 100 * e.length;
|
|
14379
|
+
class Nh {
|
|
14353
14380
|
#e;
|
|
14354
14381
|
#t;
|
|
14355
14382
|
#i;
|
|
@@ -14452,7 +14479,7 @@ class kh {
|
|
|
14452
14479
|
if (i.length > 0) return { errors: i };
|
|
14453
14480
|
const s = Mr(t.source);
|
|
14454
14481
|
if (s <= this.#r) {
|
|
14455
|
-
for (; this.#s.size > 0 && (this.#s.size >=
|
|
14482
|
+
for (; this.#s.size > 0 && (this.#s.size >= kh || this.#c + s > this.#r); ) {
|
|
14456
14483
|
const o = this.#s.keys().next().value;
|
|
14457
14484
|
this.#s.delete(o), this.#c -= Mr(o);
|
|
14458
14485
|
}
|
|
@@ -14466,7 +14493,7 @@ class kh {
|
|
|
14466
14493
|
return n;
|
|
14467
14494
|
}
|
|
14468
14495
|
}
|
|
14469
|
-
class
|
|
14496
|
+
class Sh {
|
|
14470
14497
|
#e;
|
|
14471
14498
|
#t;
|
|
14472
14499
|
/** Deadline and statement slots per request context and operation. */
|
|
@@ -14536,7 +14563,7 @@ class Nh {
|
|
|
14536
14563
|
let i = this.#i.get(t);
|
|
14537
14564
|
i || (i = /* @__PURE__ */ new Map(), this.#i.set(t, i));
|
|
14538
14565
|
let s = i.get(n.operation);
|
|
14539
|
-
return s || (s = new
|
|
14566
|
+
return s || (s = new xf(
|
|
14540
14567
|
this.#e,
|
|
14541
14568
|
this.#t
|
|
14542
14569
|
), i.set(n.operation, s)), s.active++, s;
|
|
@@ -14556,7 +14583,7 @@ class Nh {
|
|
|
14556
14583
|
}, 0);
|
|
14557
14584
|
}
|
|
14558
14585
|
}
|
|
14559
|
-
function
|
|
14586
|
+
function Rh(e, t) {
|
|
14560
14587
|
for (const n of e.nodes.values())
|
|
14561
14588
|
if (n.read) {
|
|
14562
14589
|
if (t === Z.listRoot(n)) return { kind: "list", node: n };
|
|
@@ -14569,7 +14596,7 @@ function Sh(e, t) {
|
|
|
14569
14596
|
return { kind: "grouped", node: n };
|
|
14570
14597
|
}
|
|
14571
14598
|
}
|
|
14572
|
-
function
|
|
14599
|
+
function Ih(e, t) {
|
|
14573
14600
|
for (const n of e.nodes.values())
|
|
14574
14601
|
if (n.read)
|
|
14575
14602
|
for (const i of n.search) {
|
|
@@ -14655,27 +14682,27 @@ function mn(e, t, n) {
|
|
|
14655
14682
|
}
|
|
14656
14683
|
});
|
|
14657
14684
|
}
|
|
14658
|
-
const
|
|
14685
|
+
const Dh = mn(
|
|
14659
14686
|
"Date",
|
|
14660
14687
|
"date",
|
|
14661
14688
|
"A calendar date, e.g. `2026-06-21`."
|
|
14662
|
-
),
|
|
14689
|
+
), Oh = mn(
|
|
14663
14690
|
"Time",
|
|
14664
14691
|
"time",
|
|
14665
14692
|
"A time of day with offset, e.g. `21:00:00+02:00`."
|
|
14666
|
-
),
|
|
14693
|
+
), Ch = mn(
|
|
14667
14694
|
"LocalTime",
|
|
14668
14695
|
"localtime",
|
|
14669
14696
|
"A time of day without offset, e.g. `21:00:00`."
|
|
14670
|
-
),
|
|
14697
|
+
), _h = mn(
|
|
14671
14698
|
"DateTime",
|
|
14672
14699
|
"datetime",
|
|
14673
14700
|
"An instant with offset, e.g. `2026-06-21T21:00:00Z`."
|
|
14674
|
-
),
|
|
14701
|
+
), Mh = mn(
|
|
14675
14702
|
"LocalDateTime",
|
|
14676
14703
|
"localdatetime",
|
|
14677
14704
|
"A date and time without offset, e.g. `2026-06-21T21:00:00`."
|
|
14678
|
-
),
|
|
14705
|
+
), Uh = mn(
|
|
14679
14706
|
"Duration",
|
|
14680
14707
|
"duration",
|
|
14681
14708
|
"An ISO-8601 duration, e.g. `P1DT2H`."
|
|
@@ -14689,11 +14716,11 @@ function Fr(e) {
|
|
|
14689
14716
|
}
|
|
14690
14717
|
throw Os("BigInt must be an integer or a decimal string");
|
|
14691
14718
|
}
|
|
14692
|
-
const
|
|
14719
|
+
const jh = -(2n ** 31n), Lh = 2n ** 32n;
|
|
14693
14720
|
function zr(e) {
|
|
14694
|
-
return e >=
|
|
14721
|
+
return e >= jh && e < Lh ? Number(e) : e;
|
|
14695
14722
|
}
|
|
14696
|
-
const
|
|
14723
|
+
const Ph = new as({
|
|
14697
14724
|
name: "BigInt",
|
|
14698
14725
|
description: "A 64-bit integer, serialised as a decimal string.",
|
|
14699
14726
|
serialize(e) {
|
|
@@ -14708,16 +14735,16 @@ const Lh = new as({
|
|
|
14708
14735
|
return zr(Fr(e.value));
|
|
14709
14736
|
throw Os("BigInt must be an integer or a decimal string", e);
|
|
14710
14737
|
}
|
|
14711
|
-
}),
|
|
14712
|
-
BigInt:
|
|
14713
|
-
Date:
|
|
14714
|
-
Time:
|
|
14715
|
-
LocalTime:
|
|
14716
|
-
DateTime:
|
|
14717
|
-
LocalDateTime:
|
|
14718
|
-
Duration:
|
|
14738
|
+
}), xh = {
|
|
14739
|
+
BigInt: Ph,
|
|
14740
|
+
Date: Dh,
|
|
14741
|
+
Time: Oh,
|
|
14742
|
+
LocalTime: Ch,
|
|
14743
|
+
DateTime: _h,
|
|
14744
|
+
LocalDateTime: Mh,
|
|
14745
|
+
Duration: Uh
|
|
14719
14746
|
}, j = (e) => new Ve(e), Ee = (e) => new xi(e);
|
|
14720
|
-
function
|
|
14747
|
+
function Fh(e, t) {
|
|
14721
14748
|
const n = new In({
|
|
14722
14749
|
name: "SortDirection",
|
|
14723
14750
|
values: {
|
|
@@ -14841,7 +14868,7 @@ function xh(e, t) {
|
|
|
14841
14868
|
case "Enum":
|
|
14842
14869
|
return a.get(g);
|
|
14843
14870
|
default:
|
|
14844
|
-
return
|
|
14871
|
+
return xh[m];
|
|
14845
14872
|
}
|
|
14846
14873
|
};
|
|
14847
14874
|
return {
|
|
@@ -14859,8 +14886,8 @@ function xh(e, t) {
|
|
|
14859
14886
|
}
|
|
14860
14887
|
};
|
|
14861
14888
|
}
|
|
14862
|
-
const nl = (e) => !e.list && !e.private && e.selectableOn.aggregate && e.selectableOn.read && !["Boolean", "Enum", "Point", "CartesianPoint"].includes(e.type),
|
|
14863
|
-
function
|
|
14889
|
+
const nl = (e) => !e.list && !e.private && e.selectableOn.aggregate && e.selectableOn.read && !["Boolean", "Enum", "Point", "CartesianPoint"].includes(e.type), zh = (e) => e.type === "Int" || e.type === "Float" || e.type === "BigInt";
|
|
14890
|
+
function Bh(e) {
|
|
14864
14891
|
const { scalarType: t } = e, n = /* @__PURE__ */ new Map();
|
|
14865
14892
|
return (s) => {
|
|
14866
14893
|
const o = t(s), r = s.type === "Int" || s.type === "Float" || s.type === "BigInt", a = `${o.name}Aggregate`;
|
|
@@ -14883,7 +14910,7 @@ function zh(e) {
|
|
|
14883
14910
|
}), n.set(a, c)), c;
|
|
14884
14911
|
};
|
|
14885
14912
|
}
|
|
14886
|
-
function
|
|
14913
|
+
function qh(e, t, n) {
|
|
14887
14914
|
const { scalarType: i } = t, s = /* @__PURE__ */ new Map();
|
|
14888
14915
|
for (const r of e.nodes.values()) {
|
|
14889
14916
|
if (!r.aggregate) continue;
|
|
@@ -14955,7 +14982,7 @@ const Br = {
|
|
|
14955
14982
|
IS_NULL: "true: the value is absent; false: it is present.",
|
|
14956
14983
|
CASE_INSENSITIVE: "The same string operators, ignoring case. Not index-backed: prefer @fulltext for search."
|
|
14957
14984
|
};
|
|
14958
|
-
function
|
|
14985
|
+
function Wh(e, t) {
|
|
14959
14986
|
const { countFilter: n, scalarType: i, baseType: s } = t, o = new Ae({
|
|
14960
14987
|
name: "PointInput",
|
|
14961
14988
|
description: "A WGS-84 point. Add height for 3D.",
|
|
@@ -15180,7 +15207,7 @@ function qh(e, t) {
|
|
|
15180
15207
|
fields: {
|
|
15181
15208
|
min: { type: $(A) },
|
|
15182
15209
|
max: { type: $(A) },
|
|
15183
|
-
...
|
|
15210
|
+
...zh(b) ? {
|
|
15184
15211
|
avg: { type: $(Ne) },
|
|
15185
15212
|
sum: {
|
|
15186
15213
|
type: $(b.type === "Int" ? Ne : A)
|
|
@@ -15244,12 +15271,12 @@ function qh(e, t) {
|
|
|
15244
15271
|
};
|
|
15245
15272
|
return { inputTypeOf: l, whereOf: p, polymorphic: h, connectionWhere: y };
|
|
15246
15273
|
}
|
|
15247
|
-
function
|
|
15274
|
+
function Hh(e, t) {
|
|
15248
15275
|
return ka(
|
|
15249
15276
|
JSON.stringify([e, typeof t == "bigint" ? t.toString() : t])
|
|
15250
15277
|
);
|
|
15251
15278
|
}
|
|
15252
|
-
function
|
|
15279
|
+
function Vh(e) {
|
|
15253
15280
|
try {
|
|
15254
15281
|
const t = JSON.parse(Na(e));
|
|
15255
15282
|
if (Array.isArray(t) && t.length === 2 && typeof t[0] == "string" && (typeof t[1] == "string" || typeof t[1] == "number"))
|
|
@@ -15274,14 +15301,14 @@ function ho(e, t) {
|
|
|
15274
15301
|
const bn = (e, t, n, i) => {
|
|
15275
15302
|
const s = e[i.path.key];
|
|
15276
15303
|
return ho(s, i), s;
|
|
15277
|
-
},
|
|
15304
|
+
}, Gh = (e, t, n, i) => {
|
|
15278
15305
|
const s = e[i.path.key];
|
|
15279
15306
|
return ho(s, i), s && !Array.isArray(s) ? s.values ?? null : s;
|
|
15280
15307
|
}, li = (e, t, n, i) => {
|
|
15281
15308
|
const s = e[i.path.key];
|
|
15282
15309
|
return ho(s, i), gt(s);
|
|
15283
15310
|
};
|
|
15284
|
-
function
|
|
15311
|
+
function Qh(e, t, n, i, s, o) {
|
|
15285
15312
|
const {
|
|
15286
15313
|
sortDirection: r,
|
|
15287
15314
|
pageInfo: a,
|
|
@@ -15516,7 +15543,7 @@ function Gh(e, t, n, i, s, o) {
|
|
|
15516
15543
|
_.key.relayId && (H.id = {
|
|
15517
15544
|
type: j(Dn),
|
|
15518
15545
|
description: "Global id.",
|
|
15519
|
-
resolve: (W, ae, ie, ge) =>
|
|
15546
|
+
resolve: (W, ae, ie, ge) => Hh(_.name, W[ge.path.key])
|
|
15520
15547
|
});
|
|
15521
15548
|
for (const W of _.fields.values()) {
|
|
15522
15549
|
if (W.kind === "scalar") {
|
|
@@ -15525,7 +15552,7 @@ function Gh(e, t, n, i, s, o) {
|
|
|
15525
15552
|
type: f(W),
|
|
15526
15553
|
description: W.description,
|
|
15527
15554
|
// Vectors are stored tagged; clients see the numbers.
|
|
15528
|
-
resolve: W.vector ?
|
|
15555
|
+
resolve: W.vector ? Gh : bn
|
|
15529
15556
|
};
|
|
15530
15557
|
continue;
|
|
15531
15558
|
}
|
|
@@ -15674,7 +15701,7 @@ function Gh(e, t, n, i, s, o) {
|
|
|
15674
15701
|
cypherArgs: re
|
|
15675
15702
|
};
|
|
15676
15703
|
}
|
|
15677
|
-
function
|
|
15704
|
+
function Kh(e, t, n, i, s, o) {
|
|
15678
15705
|
const { resolveRoot: r, resolveNode: a } = t, { pageInfo: c, nodeInterface: l, scalarType: u } = n, { whereOf: d } = i, {
|
|
15679
15706
|
objects: f,
|
|
15680
15707
|
connections: p,
|
|
@@ -15841,7 +15868,7 @@ function Qh(e, t, n, i, s, o) {
|
|
|
15841
15868
|
};
|
|
15842
15869
|
return D;
|
|
15843
15870
|
}
|
|
15844
|
-
function
|
|
15871
|
+
function Xh(e, t) {
|
|
15845
15872
|
const { sortDirection: n } = t, i = /* @__PURE__ */ new Map();
|
|
15846
15873
|
for (const s of e.nodes.values()) {
|
|
15847
15874
|
const o = {};
|
|
@@ -15874,7 +15901,7 @@ function Kh(e, t) {
|
|
|
15874
15901
|
}
|
|
15875
15902
|
return i;
|
|
15876
15903
|
}
|
|
15877
|
-
function
|
|
15904
|
+
function Jh(e, t, n, i, s) {
|
|
15878
15905
|
const { scalarType: o, scalarOutput: r } = n, { whereOf: a } = i, { objects: c } = s, l = {}, u = new In({
|
|
15879
15906
|
name: "ChangeOperation",
|
|
15880
15907
|
values: {
|
|
@@ -15977,22 +16004,22 @@ function Xh(e, t, n, i, s) {
|
|
|
15977
16004
|
}
|
|
15978
16005
|
return l;
|
|
15979
16006
|
}
|
|
15980
|
-
function
|
|
15981
|
-
const n =
|
|
16007
|
+
function Yh(e, t) {
|
|
16008
|
+
const n = Fh(e, t), i = Wh(e, n), { inputTypeOf: s, whereOf: o } = i, r = Xh(e, n), a = Bh(n), c = Qh(
|
|
15982
16009
|
e,
|
|
15983
16010
|
t,
|
|
15984
16011
|
n,
|
|
15985
16012
|
i,
|
|
15986
16013
|
r,
|
|
15987
16014
|
a
|
|
15988
|
-
), { objects: l, abstractTypes: u, plainObjects: d, cypherOutput: f, cypherArgs: p } = c, h =
|
|
16015
|
+
), { objects: l, abstractTypes: u, plainObjects: d, cypherOutput: f, cypherArgs: p } = c, h = qh(e, n, a), m = Kh(
|
|
15989
16016
|
e,
|
|
15990
16017
|
t,
|
|
15991
16018
|
n,
|
|
15992
16019
|
i,
|
|
15993
16020
|
c,
|
|
15994
16021
|
h
|
|
15995
|
-
), g =
|
|
16022
|
+
), g = uf(
|
|
15996
16023
|
{
|
|
15997
16024
|
model: e,
|
|
15998
16025
|
object: (E) => l.get(E),
|
|
@@ -16008,7 +16035,7 @@ function Jh(e, t) {
|
|
|
16008
16035
|
args: p(E),
|
|
16009
16036
|
resolve: (v, $, N, D) => t.resolveCypher(E, D, N)
|
|
16010
16037
|
};
|
|
16011
|
-
const y =
|
|
16038
|
+
const y = Jh(
|
|
16012
16039
|
e,
|
|
16013
16040
|
t,
|
|
16014
16041
|
n,
|
|
@@ -16030,8 +16057,8 @@ function Jh(e, t) {
|
|
|
16030
16057
|
]
|
|
16031
16058
|
});
|
|
16032
16059
|
}
|
|
16033
|
-
const
|
|
16034
|
-
class
|
|
16060
|
+
const Zh = 5e4;
|
|
16061
|
+
class em {
|
|
16035
16062
|
#e;
|
|
16036
16063
|
#t;
|
|
16037
16064
|
#i;
|
|
@@ -16122,7 +16149,7 @@ class Zh {
|
|
|
16122
16149
|
i.push(s);
|
|
16123
16150
|
continue;
|
|
16124
16151
|
}
|
|
16125
|
-
if (s.kind === "nodeUpdated" &&
|
|
16152
|
+
if (s.kind === "nodeUpdated" && nm(s)) continue;
|
|
16126
16153
|
const o = this.#d(s.labels ?? [], s.properties ?? {});
|
|
16127
16154
|
o && (this.#h(s.id, o), s.kind === "nodeCreated" ? n.created.push(o) : s.kind === "nodeDeleted" ? n.deleted.push(o) : n.updated.push(o));
|
|
16128
16155
|
}
|
|
@@ -16133,7 +16160,7 @@ class Zh {
|
|
|
16133
16160
|
const a = this.#p(s.type, o, r);
|
|
16134
16161
|
s.kind === "relationshipDeleted" ? n.disconnected.push(a) : s.kind === "relationshipCreated" ? n.connected.push(a) : n.updated.push(o, r);
|
|
16135
16162
|
}
|
|
16136
|
-
return
|
|
16163
|
+
return tm(n), n.entities.length > 0 || n.broad ? n : void 0;
|
|
16137
16164
|
}
|
|
16138
16165
|
/** The @node type and key of a node, from its labels and properties. */
|
|
16139
16166
|
#d(t, n) {
|
|
@@ -16145,7 +16172,7 @@ class Zh {
|
|
|
16145
16172
|
}
|
|
16146
16173
|
}
|
|
16147
16174
|
#h(t, n) {
|
|
16148
|
-
this.#s.delete(t), this.#s.set(t, n), this.#s.size >
|
|
16175
|
+
this.#s.delete(t), this.#s.set(t, n), this.#s.size > Zh && this.#s.delete(this.#s.keys().next().value);
|
|
16149
16176
|
}
|
|
16150
16177
|
/** Look up relationship ends the feed has not shown yet. */
|
|
16151
16178
|
async #m(t) {
|
|
@@ -16193,7 +16220,7 @@ class Zh {
|
|
|
16193
16220
|
return { type: t, field: "", from: n, to: i };
|
|
16194
16221
|
}
|
|
16195
16222
|
}
|
|
16196
|
-
function
|
|
16223
|
+
function tm(e) {
|
|
16197
16224
|
const t = /* @__PURE__ */ new Map(), n = (i) => t.set(`${i.type}\0${Y(i.key)}`, i);
|
|
16198
16225
|
for (const i of [...e.created, ...e.updated, ...e.deleted])
|
|
16199
16226
|
n(i);
|
|
@@ -16205,7 +16232,7 @@ function em(e) {
|
|
|
16205
16232
|
)
|
|
16206
16233
|
].sort();
|
|
16207
16234
|
}
|
|
16208
|
-
function
|
|
16235
|
+
function nm(e) {
|
|
16209
16236
|
const t = [...e.setKeys ?? [], ...e.removedKeys ?? []];
|
|
16210
16237
|
return t.length > 0 && t.every($l) && (e.addedLabels ?? []).length === 0 && (e.removedLabels ?? []).length === 0;
|
|
16211
16238
|
}
|
|
@@ -16219,7 +16246,7 @@ function Hr(e, t) {
|
|
|
16219
16246
|
}
|
|
16220
16247
|
});
|
|
16221
16248
|
}
|
|
16222
|
-
class
|
|
16249
|
+
class sm {
|
|
16223
16250
|
#e;
|
|
16224
16251
|
#t;
|
|
16225
16252
|
#i = /* @__PURE__ */ new Set();
|
|
@@ -16233,7 +16260,7 @@ class nm {
|
|
|
16233
16260
|
throw new Error(
|
|
16234
16261
|
"changeFeed needs a driver with changes() (@loradb/lora-node)"
|
|
16235
16262
|
);
|
|
16236
|
-
this.#o = new
|
|
16263
|
+
this.#o = new em(
|
|
16237
16264
|
t.driver,
|
|
16238
16265
|
t.model,
|
|
16239
16266
|
(n) => {
|
|
@@ -16323,7 +16350,7 @@ class nm {
|
|
|
16323
16350
|
}
|
|
16324
16351
|
}
|
|
16325
16352
|
const mo = Symbol("change"), sl = Symbol("selfOwns");
|
|
16326
|
-
function
|
|
16353
|
+
function im(e, t) {
|
|
16327
16354
|
const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
16328
16355
|
for (const a of e.before ?? [])
|
|
16329
16356
|
a.type === t.name && i.set(Y(a.key), a.properties);
|
|
@@ -16458,7 +16485,7 @@ function $n(e, t, n, i) {
|
|
|
16458
16485
|
}
|
|
16459
16486
|
return s;
|
|
16460
16487
|
}
|
|
16461
|
-
class
|
|
16488
|
+
class om {
|
|
16462
16489
|
#e;
|
|
16463
16490
|
#t;
|
|
16464
16491
|
#i;
|
|
@@ -16621,7 +16648,7 @@ class im {
|
|
|
16621
16648
|
for (const s of n) {
|
|
16622
16649
|
const o = this.#l.get(s);
|
|
16623
16650
|
if (!o) continue;
|
|
16624
|
-
const r =
|
|
16651
|
+
const r = im(t, o.node);
|
|
16625
16652
|
if (r.length === 0 || (o.all.size > 0 && i(o.all, r), o.byKey.size === 0)) continue;
|
|
16626
16653
|
const a = /* @__PURE__ */ new Map();
|
|
16627
16654
|
for (const c of r) {
|
|
@@ -16923,7 +16950,7 @@ class im {
|
|
|
16923
16950
|
return a || (a = i(), r.set(o, a)), a;
|
|
16924
16951
|
}
|
|
16925
16952
|
}
|
|
16926
|
-
class
|
|
16953
|
+
class pm {
|
|
16927
16954
|
model;
|
|
16928
16955
|
#e;
|
|
16929
16956
|
#t;
|
|
@@ -16977,7 +17004,7 @@ class fm {
|
|
|
16977
17004
|
/** Per-request timing collectors, by GraphQL context (see `timing`). */
|
|
16978
17005
|
#W = /* @__PURE__ */ new WeakMap();
|
|
16979
17006
|
constructor(t) {
|
|
16980
|
-
this.model =
|
|
17007
|
+
this.model = mh(t.typeDefs, t), this.#e = Mf(
|
|
16981
17008
|
t.driver,
|
|
16982
17009
|
t.maxQueuedWrites ?? 512,
|
|
16983
17010
|
(s) => U(
|
|
@@ -16986,9 +17013,9 @@ class fm {
|
|
|
16986
17013
|
)
|
|
16987
17014
|
), this.#t = t.timeoutMs ?? 1e4;
|
|
16988
17015
|
const n = t.compileCacheBytes ?? Tc;
|
|
16989
|
-
if (this.#z = new
|
|
16990
|
-
operationTimeoutMs: t.operationTimeoutMs ?? this.#t *
|
|
16991
|
-
maxConcurrentStatements: t.maxConcurrentStatements ??
|
|
17016
|
+
if (this.#z = new wf($c, n), this.#i = new Sh({
|
|
17017
|
+
operationTimeoutMs: t.operationTimeoutMs ?? this.#t * Pf,
|
|
17018
|
+
maxConcurrentStatements: t.maxConcurrentStatements ?? Lf,
|
|
16992
17019
|
maxCost: t.maxCost ?? 5e4,
|
|
16993
17020
|
budget: t.budget,
|
|
16994
17021
|
onCost: t.onCost
|
|
@@ -17029,14 +17056,14 @@ class fm {
|
|
|
17029
17056
|
);
|
|
17030
17057
|
if (i.length > 0)
|
|
17031
17058
|
throw new Gt(i.map((s) => ({ message: s })));
|
|
17032
|
-
this.#E = t.jwt ?? ((s) => s?.jwt), this.#$ = t.onStatement, this.#A = t.maskErrors ?? Kc() === "production", this.#C = t.onError, this.#g = t.guards ?? {}, this.#w = new
|
|
17059
|
+
this.#E = t.jwt ?? ((s) => s?.jwt), this.#$ = t.onStatement, this.#A = t.maskErrors ?? Kc() === "production", this.#C = t.onError, this.#g = t.guards ?? {}, this.#w = new sm({
|
|
17033
17060
|
driver: t.driver,
|
|
17034
17061
|
model: this.model,
|
|
17035
17062
|
changeFeed: t.changeFeed,
|
|
17036
17063
|
maxQueued: t.maxQueuedChanges ?? 1e3,
|
|
17037
17064
|
onError: this.#C,
|
|
17038
17065
|
onWrite: (s) => this.onWrite(s)
|
|
17039
|
-
}), this.#I = new
|
|
17066
|
+
}), this.#I = new om({
|
|
17040
17067
|
model: this.model,
|
|
17041
17068
|
driver: this.#e,
|
|
17042
17069
|
changes: this.#w,
|
|
@@ -17051,7 +17078,7 @@ class fm {
|
|
|
17051
17078
|
statisticsVersion: () => this.#L,
|
|
17052
17079
|
charge: (s, o, r) => this.#i.charge(s, o, r),
|
|
17053
17080
|
run: (s, o, r, a, c, l) => this.#R(s, o, r, a, c, l)
|
|
17054
|
-
}), this.#y = new
|
|
17081
|
+
}), this.#y = new Eh(t), this.#v = new Nh({
|
|
17055
17082
|
guards: this.#g,
|
|
17056
17083
|
persistedOnly: t.persistedOnly ?? !1,
|
|
17057
17084
|
bytesMax: n,
|
|
@@ -17077,7 +17104,7 @@ class fm {
|
|
|
17077
17104
|
* errors across list indices, as `execute()` does.
|
|
17078
17105
|
*/
|
|
17079
17106
|
envelopPlugin() {
|
|
17080
|
-
const t =
|
|
17107
|
+
const t = Cp(
|
|
17081
17108
|
this.#g === !1 ? {
|
|
17082
17109
|
maxDepth: 1 / 0,
|
|
17083
17110
|
maxIntrospectionDepth: 1 / 0,
|
|
@@ -17139,7 +17166,7 @@ class fm {
|
|
|
17139
17166
|
});
|
|
17140
17167
|
};
|
|
17141
17168
|
if (this.#P) return this.#P;
|
|
17142
|
-
const n =
|
|
17169
|
+
const n = Yh(this.model, {
|
|
17143
17170
|
scalars: this.#T,
|
|
17144
17171
|
customResolver: (s, o) => this.#b[s.name][o.name],
|
|
17145
17172
|
subscribe: (s, o, r) => this.#I.subscribe(s, o, r),
|
|
@@ -17188,7 +17215,7 @@ class fm {
|
|
|
17188
17215
|
() => this.#re(s, o, r, a)
|
|
17189
17216
|
)
|
|
17190
17217
|
});
|
|
17191
|
-
|
|
17218
|
+
vh(this.model, n);
|
|
17192
17219
|
const i = wl(n);
|
|
17193
17220
|
if (i.length > 0)
|
|
17194
17221
|
throw new Gt(
|
|
@@ -17230,7 +17257,7 @@ class fm {
|
|
|
17230
17257
|
* degrees (see `src/compile/cost.ts`).
|
|
17231
17258
|
*/
|
|
17232
17259
|
async analyze(t = {}) {
|
|
17233
|
-
const n = await
|
|
17260
|
+
const n = await hf(this.#e, this.model, {
|
|
17234
17261
|
...t,
|
|
17235
17262
|
timeoutMs: this.#t
|
|
17236
17263
|
});
|
|
@@ -17253,7 +17280,7 @@ class fm {
|
|
|
17253
17280
|
* model; stable, so it can be snapshotted and reviewed as a diff.
|
|
17254
17281
|
*/
|
|
17255
17282
|
accessMatrix() {
|
|
17256
|
-
return
|
|
17283
|
+
return pf(this.model, this.getSchema());
|
|
17257
17284
|
}
|
|
17258
17285
|
/**
|
|
17259
17286
|
* Who may run an operation: per root field, the verdict for each kind
|
|
@@ -17275,7 +17302,7 @@ class fm {
|
|
|
17275
17302
|
const r = /* @__PURE__ */ new Map();
|
|
17276
17303
|
for (const a of s.definitions)
|
|
17277
17304
|
a.kind === fe.FRAGMENT_DEFINITION && r.set(a.name.value, a);
|
|
17278
|
-
return
|
|
17305
|
+
return ff(
|
|
17279
17306
|
this.model,
|
|
17280
17307
|
this.getSchema(),
|
|
17281
17308
|
o,
|
|
@@ -17290,7 +17317,7 @@ class fm {
|
|
|
17290
17317
|
* validate with any JSON Schema library.
|
|
17291
17318
|
*/
|
|
17292
17319
|
inputSchemas() {
|
|
17293
|
-
return
|
|
17320
|
+
return Sp(this.model);
|
|
17294
17321
|
}
|
|
17295
17322
|
/**
|
|
17296
17323
|
* Stored values that break a validation rule of their field: rules are
|
|
@@ -17312,7 +17339,7 @@ class fm {
|
|
|
17312
17339
|
const n = {
|
|
17313
17340
|
ok: !0,
|
|
17314
17341
|
warnings: this.model.warnings,
|
|
17315
|
-
cypher: await
|
|
17342
|
+
cypher: await Nd(this.#e, this.model),
|
|
17316
17343
|
// An index defined differently from the model is as good as missing.
|
|
17317
17344
|
missing: await this.assertSchema().then((i) => [
|
|
17318
17345
|
...i.missing,
|
|
@@ -17320,10 +17347,10 @@ class fm {
|
|
|
17320
17347
|
]),
|
|
17321
17348
|
unused: await Sl(this.#H()),
|
|
17322
17349
|
lint: [
|
|
17323
|
-
...
|
|
17324
|
-
...
|
|
17350
|
+
...jd(this.model, { statistics: !!this.#D }),
|
|
17351
|
+
...Kd(this.model, this.getSchema())
|
|
17325
17352
|
],
|
|
17326
|
-
security:
|
|
17353
|
+
security: Ld(this.model),
|
|
17327
17354
|
plans: [],
|
|
17328
17355
|
errors: [],
|
|
17329
17356
|
stored: (await vr(this.#e, this.model)).violations
|
|
@@ -17377,7 +17404,7 @@ class fm {
|
|
|
17377
17404
|
for (const [l, u] of a)
|
|
17378
17405
|
c.push({
|
|
17379
17406
|
field: l,
|
|
17380
|
-
reports: await
|
|
17407
|
+
reports: await Cd(this.#e, u, {
|
|
17381
17408
|
...i !== void 0 ? { rowBudget: i } : {}
|
|
17382
17409
|
})
|
|
17383
17410
|
});
|
|
@@ -17411,7 +17438,7 @@ class fm {
|
|
|
17411
17438
|
if (p.kind !== fe.FIELD || p.name.value.startsWith("__")) continue;
|
|
17412
17439
|
const h = d.getFields()[p.name.value];
|
|
17413
17440
|
if (!h) continue;
|
|
17414
|
-
const m = this.#k(u, i.context), g = Ei(m, h, p), y = this.model.queries.find((D) => D.name === p.name.value), E =
|
|
17441
|
+
const m = this.#k(u, i.context), g = Ei(m, h, p), y = this.model.queries.find((D) => D.name === p.name.value), E = Rh(this.model, p.name.value), v = Ih(this.model, p.name.value);
|
|
17415
17442
|
let $;
|
|
17416
17443
|
const N = [...this.model.abstracts.values()].find(
|
|
17417
17444
|
(D) => D.read && D.plural === p.name.value
|
|
@@ -17437,7 +17464,7 @@ class fm {
|
|
|
17437
17464
|
))
|
|
17438
17465
|
s.push({
|
|
17439
17466
|
field: o,
|
|
17440
|
-
reports: await
|
|
17467
|
+
reports: await Sd(this.#e, r, {
|
|
17441
17468
|
...i.rowBudget !== void 0 ? { rowBudget: i.rowBudget } : {}
|
|
17442
17469
|
})
|
|
17443
17470
|
});
|
|
@@ -17459,11 +17486,11 @@ class fm {
|
|
|
17459
17486
|
* `loadManifest()`, built once at build time (`lora-graphql compile`).
|
|
17460
17487
|
*/
|
|
17461
17488
|
buildManifest(t) {
|
|
17462
|
-
return
|
|
17489
|
+
return Rp(this.getSchema(), t, this.validationRules());
|
|
17463
17490
|
}
|
|
17464
17491
|
/** TypeScript types for a manifest's variables and results. */
|
|
17465
17492
|
generateTypes(t) {
|
|
17466
|
-
return
|
|
17493
|
+
return Ip(this.getSchema(), t, this.model.scalars);
|
|
17467
17494
|
}
|
|
17468
17495
|
/**
|
|
17469
17496
|
* Register a manifest's operations as persisted operations, without
|
|
@@ -17511,7 +17538,7 @@ class fm {
|
|
|
17511
17538
|
const o = t.operationName ?? "";
|
|
17512
17539
|
return s.has(o) || s.set(
|
|
17513
17540
|
o,
|
|
17514
|
-
|
|
17541
|
+
Th(
|
|
17515
17542
|
this.getSchema(),
|
|
17516
17543
|
this.model,
|
|
17517
17544
|
i,
|
|
@@ -17660,7 +17687,7 @@ class fm {
|
|
|
17660
17687
|
}
|
|
17661
17688
|
/** Whether a read with this read-set may observe the change. */
|
|
17662
17689
|
affects(t, n) {
|
|
17663
|
-
return
|
|
17690
|
+
return pd(
|
|
17664
17691
|
t,
|
|
17665
17692
|
n,
|
|
17666
17693
|
(i) => this.model.nodes.get(i)?.labels ?? []
|
|
@@ -17706,7 +17733,7 @@ class fm {
|
|
|
17706
17733
|
const h = (m) => this.#e.run(n.statements, {
|
|
17707
17734
|
mode: n.mode,
|
|
17708
17735
|
timeoutMs: u && this.#t > 0 ? Math.max(1, Math.min(this.#t, u.remaining())) : this.#t,
|
|
17709
|
-
signal: m ?
|
|
17736
|
+
signal: m ? Ff(c, m) : c,
|
|
17710
17737
|
// Queries and object @cypher fields are checked read-only
|
|
17711
17738
|
// when the model is built; writes never reach this path.
|
|
17712
17739
|
verified: n.mode === "read",
|
|
@@ -17768,7 +17795,7 @@ class fm {
|
|
|
17768
17795
|
);
|
|
17769
17796
|
}
|
|
17770
17797
|
#O(t, n) {
|
|
17771
|
-
return
|
|
17798
|
+
return $h(
|
|
17772
17799
|
{
|
|
17773
17800
|
model: this.model,
|
|
17774
17801
|
maskErrors: this.#A,
|
|
@@ -17789,7 +17816,7 @@ class fm {
|
|
|
17789
17816
|
this.#S(r, i.parentType, i.fieldNodes),
|
|
17790
17817
|
i.fieldNodes
|
|
17791
17818
|
),
|
|
17792
|
-
|
|
17819
|
+
kf(t, n, i.fieldNodes)
|
|
17793
17820
|
);
|
|
17794
17821
|
return this.#R(i.fieldName, o, s, i);
|
|
17795
17822
|
}
|
|
@@ -17809,7 +17836,7 @@ class fm {
|
|
|
17809
17836
|
return this.#R(i.fieldName, r, s, i);
|
|
17810
17837
|
}
|
|
17811
17838
|
async #se(t, n, i) {
|
|
17812
|
-
const s =
|
|
17839
|
+
const s = Vh(t), o = s && this.model.nodes.get(s.type);
|
|
17813
17840
|
if (!s || !o || !o.key.relayId || !o.read) return null;
|
|
17814
17841
|
let r = s.key;
|
|
17815
17842
|
if (o.key.type === "BigInt" && typeof r == "string") {
|
|
@@ -17853,7 +17880,7 @@ class fm {
|
|
|
17853
17880
|
this.#J(n, i);
|
|
17854
17881
|
let l, u;
|
|
17855
17882
|
try {
|
|
17856
|
-
({ value: l, written: u } = await
|
|
17883
|
+
({ value: l, written: u } = await jf(
|
|
17857
17884
|
this.#G(n, i, s.jwt),
|
|
17858
17885
|
t,
|
|
17859
17886
|
c,
|
|
@@ -17904,7 +17931,7 @@ class fm {
|
|
|
17904
17931
|
this.#J(i, s);
|
|
17905
17932
|
const o = this.#k(Ut(i), s), r = this.#S(o, i.parentType, i.fieldNodes);
|
|
17906
17933
|
try {
|
|
17907
|
-
const { payload: a, change: c } = await
|
|
17934
|
+
const { payload: a, change: c } = await bp(
|
|
17908
17935
|
this.#G(i, s, o.jwt),
|
|
17909
17936
|
t,
|
|
17910
17937
|
n,
|
|
@@ -18061,7 +18088,7 @@ class fm {
|
|
|
18061
18088
|
throw new Error(
|
|
18062
18089
|
i ? `worker("${t}"): ${t} has no @outbox` : `worker("${t}"): no @node type ${t}`
|
|
18063
18090
|
);
|
|
18064
|
-
const s = new
|
|
18091
|
+
const s = new Ap(
|
|
18065
18092
|
{
|
|
18066
18093
|
driver: this.#e,
|
|
18067
18094
|
node: i,
|
|
@@ -18073,6 +18100,25 @@ class fm {
|
|
|
18073
18100
|
);
|
|
18074
18101
|
return this.#h.add(s), s;
|
|
18075
18102
|
}
|
|
18103
|
+
/**
|
|
18104
|
+
* Write an online copy of the database into `targetDir` (missing or
|
|
18105
|
+
* empty) while requests keep running: the graph as of one committed
|
|
18106
|
+
* transaction, as `<targetDir>/<name>.loradb`, which opens with
|
|
18107
|
+
* `createDatabase(name, { databaseDir: targetDir })`. Mutations wait
|
|
18108
|
+
* only while the graph is taken, not while it is written. For an
|
|
18109
|
+
* off-host backup of a database this process owns.
|
|
18110
|
+
*
|
|
18111
|
+
* Needs a driver with `snapshot()`: `loraDriver(db)` over a lora-node
|
|
18112
|
+
* database opened with a name and `databaseDir`.
|
|
18113
|
+
*/
|
|
18114
|
+
async snapshot(t) {
|
|
18115
|
+
const n = this.#e;
|
|
18116
|
+
if (!n?.snapshot)
|
|
18117
|
+
throw new Error(
|
|
18118
|
+
"snapshot() needs a driver with snapshot(): pass loraDriver(db) over a lora-node database opened with a name and databaseDir"
|
|
18119
|
+
);
|
|
18120
|
+
return n.snapshot(t);
|
|
18121
|
+
}
|
|
18076
18122
|
/** Stop the workers, and the engine change feed (with `changeFeed: true`). */
|
|
18077
18123
|
close() {
|
|
18078
18124
|
for (const t of this.#h) t.stop();
|
|
@@ -18083,30 +18129,30 @@ export {
|
|
|
18083
18129
|
vn as D,
|
|
18084
18130
|
Ml as L,
|
|
18085
18131
|
Gt as M,
|
|
18086
|
-
|
|
18132
|
+
pm as a,
|
|
18087
18133
|
tc as b,
|
|
18088
|
-
|
|
18089
|
-
|
|
18134
|
+
mh as c,
|
|
18135
|
+
Sd as d,
|
|
18090
18136
|
Xc as e,
|
|
18091
|
-
|
|
18137
|
+
Cp as f,
|
|
18092
18138
|
_l as g,
|
|
18093
|
-
|
|
18139
|
+
Vh as h,
|
|
18094
18140
|
kl as i,
|
|
18095
|
-
|
|
18096
|
-
|
|
18097
|
-
|
|
18141
|
+
Sp as j,
|
|
18142
|
+
lm as k,
|
|
18143
|
+
dm as l,
|
|
18098
18144
|
qc as m,
|
|
18099
|
-
|
|
18145
|
+
am as n,
|
|
18100
18146
|
R as o,
|
|
18101
18147
|
Vc as p,
|
|
18102
|
-
|
|
18148
|
+
Yh as q,
|
|
18103
18149
|
vo as r,
|
|
18104
|
-
|
|
18105
|
-
|
|
18106
|
-
|
|
18150
|
+
Dd as s,
|
|
18151
|
+
Hh as t,
|
|
18152
|
+
um as u,
|
|
18107
18153
|
Hc as v,
|
|
18108
18154
|
Ys as w,
|
|
18109
|
-
|
|
18110
|
-
|
|
18155
|
+
cm as x,
|
|
18156
|
+
fm as y
|
|
18111
18157
|
};
|
|
18112
|
-
//# sourceMappingURL=lora-graphql-
|
|
18158
|
+
//# sourceMappingURL=lora-graphql-BW8S6TRu.js.map
|