@nicia-ai/typegraph 0.47.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/index.cjs +27 -19
- package/dist/backend/index.d.cts +37 -55
- package/dist/backend/index.d.ts +37 -55
- package/dist/backend/index.js +4 -4
- package/dist/backend/postgres/index.cjs +7 -7
- package/dist/backend/postgres/index.d.cts +21 -7
- package/dist/backend/postgres/index.d.ts +21 -7
- package/dist/backend/postgres/index.js +6 -6
- package/dist/backend/postgres/pglite-store.cjs +17 -17
- package/dist/backend/postgres/pglite-store.d.cts +8 -8
- package/dist/backend/postgres/pglite-store.d.ts +8 -8
- package/dist/backend/postgres/pglite-store.js +14 -14
- package/dist/backend/postgres/pglite.cjs +8 -8
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +7 -7
- package/dist/backend/sqlite/index.cjs +7 -7
- package/dist/backend/sqlite/index.d.cts +20 -7
- package/dist/backend/sqlite/index.d.ts +20 -7
- package/dist/backend/sqlite/index.js +6 -6
- package/dist/backend/sqlite/libsql.cjs +8 -8
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +6 -6
- package/dist/backend/sqlite/local-store.cjs +18 -18
- package/dist/backend/sqlite/local-store.d.cts +8 -8
- package/dist/backend/sqlite/local-store.d.ts +8 -8
- package/dist/backend/sqlite/local-store.js +15 -15
- package/dist/backend/sqlite/local.cjs +9 -9
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +7 -7
- package/dist/{chunk-EMIB2RXD.cjs → chunk-2HIYYMWY.cjs} +99 -96
- package/dist/chunk-2HIYYMWY.cjs.map +1 -0
- package/dist/{chunk-6KFLYYOC.cjs → chunk-2QGYQBS2.cjs} +5 -5
- package/dist/{chunk-6KFLYYOC.cjs.map → chunk-2QGYQBS2.cjs.map} +1 -1
- package/dist/{chunk-5FT3TLPK.js → chunk-2SYZXD54.js} +16 -13
- package/dist/chunk-2SYZXD54.js.map +1 -0
- package/dist/{chunk-XYBQI6LE.js → chunk-2TYSSBU5.js} +6 -6
- package/dist/{chunk-XYBQI6LE.js.map → chunk-2TYSSBU5.js.map} +1 -1
- package/dist/{chunk-6JVZSOHQ.cjs → chunk-3FPR224C.cjs} +26 -26
- package/dist/{chunk-6JVZSOHQ.cjs.map → chunk-3FPR224C.cjs.map} +1 -1
- package/dist/{chunk-MFZR4QKM.cjs → chunk-3KOY4FH3.cjs} +181 -4
- package/dist/chunk-3KOY4FH3.cjs.map +1 -0
- package/dist/{chunk-6FWSNSRE.js → chunk-4WMMBDS5.js} +4 -4
- package/dist/chunk-4WMMBDS5.js.map +1 -0
- package/dist/{chunk-NG2RB5WL.js → chunk-5K2BKEBD.js} +18 -3
- package/dist/chunk-5K2BKEBD.js.map +1 -0
- package/dist/chunk-5PRKMB24.cjs +124 -0
- package/dist/chunk-5PRKMB24.cjs.map +1 -0
- package/dist/chunk-6LN7FIVU.js +107 -0
- package/dist/chunk-6LN7FIVU.js.map +1 -0
- package/dist/{chunk-I4G3SQPF.cjs → chunk-7XUYFFR4.cjs} +7 -7
- package/dist/chunk-7XUYFFR4.cjs.map +1 -0
- package/dist/{chunk-KH7XW7VV.js → chunk-ACGSAMD3.js} +24 -27
- package/dist/chunk-ACGSAMD3.js.map +1 -0
- package/dist/{chunk-QS3NQZVC.js → chunk-AX6JGVTZ.js} +16 -11
- package/dist/chunk-AX6JGVTZ.js.map +1 -0
- package/dist/{chunk-DJZTXBWY.js → chunk-BRRP76WO.js} +71 -30
- package/dist/chunk-BRRP76WO.js.map +1 -0
- package/dist/{chunk-5UMTUOM5.js → chunk-CT3ZKTOF.js} +5 -4
- package/dist/chunk-CT3ZKTOF.js.map +1 -0
- package/dist/{chunk-XY5OMOJD.js → chunk-DZAICA5J.js} +3 -3
- package/dist/{chunk-XY5OMOJD.js.map → chunk-DZAICA5J.js.map} +1 -1
- package/dist/{chunk-OIFSOPSR.cjs → chunk-EZEEWCFJ.cjs} +38 -156
- package/dist/chunk-EZEEWCFJ.cjs.map +1 -0
- package/dist/{chunk-AMMWA76F.cjs → chunk-FA2AFWLP.cjs} +6 -6
- package/dist/{chunk-AMMWA76F.cjs.map → chunk-FA2AFWLP.cjs.map} +1 -1
- package/dist/{chunk-FNOMT74T.js → chunk-I4GAZH5Z.js} +180 -5
- package/dist/chunk-I4GAZH5Z.js.map +1 -0
- package/dist/{chunk-WGX7JH7E.cjs → chunk-JB6T4GLL.cjs} +106 -134
- package/dist/chunk-JB6T4GLL.cjs.map +1 -0
- package/dist/{chunk-MX4DHSQP.cjs → chunk-JFRT7S3B.cjs} +92 -98
- package/dist/chunk-JFRT7S3B.cjs.map +1 -0
- package/dist/{chunk-SE6EGQSD.js → chunk-KF6K7TGH.js} +38 -66
- package/dist/chunk-KF6K7TGH.js.map +1 -0
- package/dist/{chunk-ZHNXLS3C.js → chunk-NACVVDWB.js} +208 -8
- package/dist/chunk-NACVVDWB.js.map +1 -0
- package/dist/{chunk-M35DF33T.js → chunk-OD4SSY2U.js} +29 -16
- package/dist/chunk-OD4SSY2U.js.map +1 -0
- package/dist/{chunk-U5EDAVOJ.cjs → chunk-OTUPEF2W.cjs} +54 -49
- package/dist/chunk-OTUPEF2W.cjs.map +1 -0
- package/dist/{chunk-BCQ76AXA.cjs → chunk-PFBRJBUL.cjs} +107 -94
- package/dist/chunk-PFBRJBUL.cjs.map +1 -0
- package/dist/{chunk-AVGUJWVX.js → chunk-S5TERQVW.js} +15 -132
- package/dist/chunk-S5TERQVW.js.map +1 -0
- package/dist/chunk-SIT26LAZ.cjs +614 -0
- package/dist/chunk-SIT26LAZ.cjs.map +1 -0
- package/dist/{chunk-BR7SHKGM.cjs → chunk-SR725PWF.cjs} +548 -507
- package/dist/chunk-SR725PWF.cjs.map +1 -0
- package/dist/{chunk-5FBRVORR.cjs → chunk-TKZXMWQF.cjs} +8 -7
- package/dist/chunk-TKZXMWQF.cjs.map +1 -0
- package/dist/{chunk-425IZOQ5.cjs → chunk-TQHGE7UC.cjs} +20 -2
- package/dist/chunk-TQHGE7UC.cjs.map +1 -0
- package/dist/{chunk-GYUJZARH.cjs → chunk-TUNPBZY3.cjs} +4 -4
- package/dist/{chunk-GYUJZARH.cjs.map → chunk-TUNPBZY3.cjs.map} +1 -1
- package/dist/chunk-UGHG7PGX.js +592 -0
- package/dist/chunk-UGHG7PGX.js.map +1 -0
- package/dist/{chunk-KABFHAL7.cjs → chunk-UMGZDVOA.cjs} +213 -12
- package/dist/chunk-UMGZDVOA.cjs.map +1 -0
- package/dist/{chunk-UPAJHMW3.cjs → chunk-WCCATHMB.cjs} +54 -57
- package/dist/chunk-WCCATHMB.cjs.map +1 -0
- package/dist/{chunk-LEWHMOUY.js → chunk-YIURNGXI.js} +4 -4
- package/dist/{chunk-LEWHMOUY.js.map → chunk-YIURNGXI.js.map} +1 -1
- package/dist/{chunk-EP4RUYD6.js → chunk-YVF2EM7B.js} +3 -3
- package/dist/{chunk-EP4RUYD6.js.map → chunk-YVF2EM7B.js.map} +1 -1
- package/dist/{chunk-NNQ6A3RM.js → chunk-ZFMCDJGB.js} +7 -12
- package/dist/chunk-ZFMCDJGB.js.map +1 -0
- package/dist/core/index.cjs +6 -6
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +2 -2
- package/dist/ddl-BL1NZLMY.d.cts +78 -0
- package/dist/ddl-D_oW-EVO.d.ts +78 -0
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-merge/index.cjs +334 -191
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +65 -15
- package/dist/graph-merge/index.d.ts +65 -15
- package/dist/graph-merge/index.js +174 -32
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-CHTv4XMZ.d.cts → index-COs_z6nV.d.cts} +2 -2
- package/dist/{index-CzoJ3MUw.d.ts → index-D7d1u2gr.d.ts} +2 -2
- package/dist/index.cjs +90 -86
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +13 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/interchange/index.cjs +38 -38
- package/dist/interchange/index.d.cts +7 -7
- package/dist/interchange/index.d.ts +7 -7
- package/dist/interchange/index.js +10 -10
- package/dist/{manager-DlY1vlla.d.cts → manager-CYaff3n3.d.cts} +2 -2
- package/dist/{manager-B6sOQzcQ.d.ts → manager-D9eRT_ns.d.ts} +2 -2
- package/dist/{materialize-indexes-DQL4xcpf.d.ts → materialize-indexes-DJ3ykH59.d.ts} +1 -1
- package/dist/{materialize-indexes-sskhp-c_.d.cts → materialize-indexes-DTtAnvfY.d.cts} +1 -1
- package/dist/{postgres-BXy_nyMs.d.cts → postgres-CcL4bAHS.d.ts} +1 -1
- package/dist/{postgres-B6YOUcaK.d.ts → postgres-DMj39MEu.d.cts} +1 -1
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +25 -26
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +9 -10
- package/dist/provenance/index.js.map +1 -1
- package/dist/repair-validity-windows-BFNZvd_H.d.cts +166 -0
- package/dist/repair-validity-windows-DlUSqwCg.d.ts +166 -0
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +8 -8
- package/dist/{searchable-D9gMiwcS.d.ts → searchable-DHJMh_nj.d.cts} +1 -1
- package/dist/{searchable-0Cn_lY8U.d.cts → searchable-bpE1bBfc.d.ts} +1 -1
- package/dist/{sqlite-DioSxaPe.d.cts → sqlite-D7Oz0SQh.d.ts} +1 -1
- package/dist/{sqlite-ClXuBYAj.d.ts → sqlite-YppHrNFb.d.cts} +1 -1
- package/dist/{store-5j-w5onJ.d.ts → store-JUVvtmR4.d.cts} +113 -26
- package/dist/{store-CFedKGU5.d.cts → store-UzrGvZOo.d.ts} +113 -26
- package/dist/{temporal-CjO9FH1l.d.ts → temporal-5GqpYCk2.d.cts} +1 -1
- package/dist/{temporal-Ce1pG0S1.d.cts → temporal-CbnLzTmM.d.ts} +1 -1
- package/dist/{types-DKkMJZjR.d.cts → types-BqFZTQmV.d.cts} +29 -4
- package/dist/{types-DKkMJZjR.d.ts → types-BqFZTQmV.d.ts} +29 -4
- package/dist/{types-BrdOFu48.d.ts → types-Bx74kaTt.d.ts} +1 -1
- package/dist/{types-oj_OGAaZ.d.cts → types-CXAhpW-c.d.cts} +1 -1
- package/dist/{where-D1wKCJ4Q.d.cts → where-DI_Fqz-X.d.cts} +1 -1
- package/dist/{where-C8w2627G.d.ts → where-O-k2wgYm.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HGRTCDU.cjs +0 -269
- package/dist/chunk-3HGRTCDU.cjs.map +0 -1
- package/dist/chunk-425IZOQ5.cjs.map +0 -1
- package/dist/chunk-5FBRVORR.cjs.map +0 -1
- package/dist/chunk-5FT3TLPK.js.map +0 -1
- package/dist/chunk-5UMTUOM5.js.map +0 -1
- package/dist/chunk-6FWSNSRE.js.map +0 -1
- package/dist/chunk-AVGUJWVX.js.map +0 -1
- package/dist/chunk-BCQ76AXA.cjs.map +0 -1
- package/dist/chunk-BR7SHKGM.cjs.map +0 -1
- package/dist/chunk-DJZTXBWY.js.map +0 -1
- package/dist/chunk-EMIB2RXD.cjs.map +0 -1
- package/dist/chunk-FNOMT74T.js.map +0 -1
- package/dist/chunk-I4G3SQPF.cjs.map +0 -1
- package/dist/chunk-JR6SX5RH.cjs +0 -268
- package/dist/chunk-JR6SX5RH.cjs.map +0 -1
- package/dist/chunk-KABFHAL7.cjs.map +0 -1
- package/dist/chunk-KH7XW7VV.js.map +0 -1
- package/dist/chunk-M35DF33T.js.map +0 -1
- package/dist/chunk-MFZR4QKM.cjs.map +0 -1
- package/dist/chunk-MX4DHSQP.cjs.map +0 -1
- package/dist/chunk-NAZ2RA4L.js +0 -254
- package/dist/chunk-NAZ2RA4L.js.map +0 -1
- package/dist/chunk-NG2RB5WL.js.map +0 -1
- package/dist/chunk-NNQ6A3RM.js.map +0 -1
- package/dist/chunk-OIFSOPSR.cjs.map +0 -1
- package/dist/chunk-QS3NQZVC.js.map +0 -1
- package/dist/chunk-SE6EGQSD.js.map +0 -1
- package/dist/chunk-SHSSRCFR.js +0 -246
- package/dist/chunk-SHSSRCFR.js.map +0 -1
- package/dist/chunk-U5EDAVOJ.cjs.map +0 -1
- package/dist/chunk-UPAJHMW3.cjs.map +0 -1
- package/dist/chunk-WGX7JH7E.cjs.map +0 -1
- package/dist/chunk-ZHNXLS3C.js.map +0 -1
- package/dist/ddl-CprnMXJ-.d.ts +0 -38
- package/dist/ddl-DJA7Lci5.d.cts +0 -38
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkFA2AFWLP_cjs = require('./chunk-FA2AFWLP.cjs');
|
|
4
|
+
var chunkJB6T4GLL_cjs = require('./chunk-JB6T4GLL.cjs');
|
|
5
|
+
var chunk3KOY4FH3_cjs = require('./chunk-3KOY4FH3.cjs');
|
|
6
|
+
var chunk3FPR224C_cjs = require('./chunk-3FPR224C.cjs');
|
|
7
7
|
var chunk26YKDNUD_cjs = require('./chunk-26YKDNUD.cjs');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var chunkJFRT7S3B_cjs = require('./chunk-JFRT7S3B.cjs');
|
|
9
|
+
var chunkEZEEWCFJ_cjs = require('./chunk-EZEEWCFJ.cjs');
|
|
10
10
|
var chunkPWLJ77UV_cjs = require('./chunk-PWLJ77UV.cjs');
|
|
11
|
-
var
|
|
11
|
+
var chunkSIT26LAZ_cjs = require('./chunk-SIT26LAZ.cjs');
|
|
12
12
|
var chunk3U5ABFDW_cjs = require('./chunk-3U5ABFDW.cjs');
|
|
13
|
-
var
|
|
13
|
+
var chunk5PRKMB24_cjs = require('./chunk-5PRKMB24.cjs');
|
|
14
14
|
var chunkBFUOME67_cjs = require('./chunk-BFUOME67.cjs');
|
|
15
15
|
var chunkFQPEMEWX_cjs = require('./chunk-FQPEMEWX.cjs');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var chunk2QGYQBS2_cjs = require('./chunk-2QGYQBS2.cjs');
|
|
17
|
+
var chunkTQHGE7UC_cjs = require('./chunk-TQHGE7UC.cjs');
|
|
18
18
|
var chunkAOSSQDVO_cjs = require('./chunk-AOSSQDVO.cjs');
|
|
19
19
|
var chunkOI2GQ25X_cjs = require('./chunk-OI2GQ25X.cjs');
|
|
20
20
|
var chunkLRQKXRXO_cjs = require('./chunk-LRQKXRXO.cjs');
|
|
@@ -117,7 +117,7 @@ function resolveTemporalReadParams(options, defaultTemporalMode) {
|
|
|
117
117
|
message: "Broad collection reads cannot honor recorded-time coordinates.",
|
|
118
118
|
suggestion: "Use store.asOfRecorded(...).nodes.Kind.getById/getByIds for point reads, or query() for recorded-time scans."
|
|
119
119
|
});
|
|
120
|
-
const { valid } =
|
|
120
|
+
const { valid } = chunk2QGYQBS2_cjs.resolveReadCoordinate(
|
|
121
121
|
options?.temporalMode ?? defaultTemporalMode,
|
|
122
122
|
options?.asOf
|
|
123
123
|
);
|
|
@@ -129,7 +129,7 @@ function resolveTemporalReadParams(options, defaultTemporalMode) {
|
|
|
129
129
|
if (mode === "current" || mode === "asOf") {
|
|
130
130
|
return {
|
|
131
131
|
...base,
|
|
132
|
-
asOf: asOf ??
|
|
132
|
+
asOf: asOf ?? chunkTQHGE7UC_cjs.nowIso()
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
return base;
|
|
@@ -148,12 +148,12 @@ var NON_KIND_KEYS = /* @__PURE__ */ new Set([
|
|
|
148
148
|
function createReadOnlyRefusal(entity, method, coordinate) {
|
|
149
149
|
return () => {
|
|
150
150
|
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
151
|
-
`'${method}' is not available on a read-only StoreView (${
|
|
151
|
+
`'${method}' is not available on a read-only StoreView (${chunk2QGYQBS2_cjs.describeCoordinate(coordinate)}). A time-pinned view is a read perspective \u2014 perform writes on the live Store.`,
|
|
152
152
|
{
|
|
153
153
|
code: "STORE_VIEW_READ_ONLY",
|
|
154
154
|
entity,
|
|
155
155
|
method,
|
|
156
|
-
...
|
|
156
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate)
|
|
157
157
|
}
|
|
158
158
|
);
|
|
159
159
|
};
|
|
@@ -161,12 +161,12 @@ function createReadOnlyRefusal(entity, method, coordinate) {
|
|
|
161
161
|
function createCurrentOnlyRefusal(entity, method, coordinate) {
|
|
162
162
|
return () => Promise.reject(
|
|
163
163
|
new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
164
|
-
`'${method}' is not available on a StoreView (${
|
|
164
|
+
`'${method}' is not available on a StoreView (${chunk2QGYQBS2_cjs.describeCoordinate(coordinate)}). Constraint / index / endpoint lookups read current state only and cannot honor a temporal coordinate \u2014 use a current-mode view or the live Store.`,
|
|
165
165
|
{
|
|
166
166
|
code: "STORE_VIEW_CURRENT_ONLY",
|
|
167
167
|
entity,
|
|
168
168
|
method,
|
|
169
|
-
...
|
|
169
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate)
|
|
170
170
|
}
|
|
171
171
|
)
|
|
172
172
|
);
|
|
@@ -174,12 +174,12 @@ function createCurrentOnlyRefusal(entity, method, coordinate) {
|
|
|
174
174
|
function createBatchReadRefusal(entity, method, coordinate) {
|
|
175
175
|
return () => {
|
|
176
176
|
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
177
|
-
`'${method}' is not available on a read-only StoreView (${
|
|
177
|
+
`'${method}' is not available on a read-only StoreView (${chunk2QGYQBS2_cjs.describeCoordinate(coordinate)}). Batch endpoint reads resolve through store.batch(...), which a view does not expose \u2014 use the live Store's batch(...), or the view's findFrom / findTo / findByEndpoints for single reads.`,
|
|
178
178
|
{
|
|
179
179
|
code: "STORE_VIEW_BATCH_UNAVAILABLE",
|
|
180
180
|
entity,
|
|
181
181
|
method,
|
|
182
|
-
...
|
|
182
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate)
|
|
183
183
|
}
|
|
184
184
|
);
|
|
185
185
|
};
|
|
@@ -187,12 +187,12 @@ function createBatchReadRefusal(entity, method, coordinate) {
|
|
|
187
187
|
function createRecordedUnsupportedRefusal(entity, method, coordinate) {
|
|
188
188
|
return () => Promise.reject(
|
|
189
189
|
new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
190
|
-
`'${method}' is not available on a RecordedStoreView (${
|
|
190
|
+
`'${method}' is not available on a RecordedStoreView (${chunk2QGYQBS2_cjs.describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and collection getById/getByIds/scan reads.`,
|
|
191
191
|
{
|
|
192
192
|
code: "RECORDED_STORE_VIEW_UNSUPPORTED",
|
|
193
193
|
entity,
|
|
194
194
|
method,
|
|
195
|
-
...
|
|
195
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate)
|
|
196
196
|
}
|
|
197
197
|
)
|
|
198
198
|
);
|
|
@@ -319,17 +319,17 @@ function pinnedEdgeCollectionsFor(store, coordinate, wrap) {
|
|
|
319
319
|
}
|
|
320
320
|
function recordedNodeCollection(store, kind, live, coordinate) {
|
|
321
321
|
const reads = {
|
|
322
|
-
getById: (id) =>
|
|
323
|
-
getByIds: (ids) =>
|
|
324
|
-
scan: (options) =>
|
|
322
|
+
getById: (id) => chunk3KOY4FH3_cjs.storeRuntime(store).recordedNodeGetById(kind, id, coordinate),
|
|
323
|
+
getByIds: (ids) => chunk3KOY4FH3_cjs.storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate),
|
|
324
|
+
scan: (options) => chunk3KOY4FH3_cjs.storeRuntime(store).recordedNodeScan(kind, coordinate, options)
|
|
325
325
|
};
|
|
326
326
|
return recordedCollectionProxy(reads, live, coordinate, "node");
|
|
327
327
|
}
|
|
328
328
|
function recordedEdgeCollection(store, kind, live, coordinate) {
|
|
329
329
|
const reads = {
|
|
330
|
-
getById: (id) =>
|
|
331
|
-
getByIds: (ids) =>
|
|
332
|
-
scan: (options) =>
|
|
330
|
+
getById: (id) => chunk3KOY4FH3_cjs.storeRuntime(store).recordedEdgeGetById(kind, id, coordinate),
|
|
331
|
+
getByIds: (ids) => chunk3KOY4FH3_cjs.storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate),
|
|
332
|
+
scan: (options) => chunk3KOY4FH3_cjs.storeRuntime(store).recordedEdgeScan(kind, coordinate, options)
|
|
333
333
|
};
|
|
334
334
|
return recordedCollectionProxy(reads, live, coordinate, "edge");
|
|
335
335
|
}
|
|
@@ -367,14 +367,14 @@ function searchRefusal(method, coordinate, isCurrent) {
|
|
|
367
367
|
{
|
|
368
368
|
code: "STORE_VIEW_READ_ONLY",
|
|
369
369
|
method,
|
|
370
|
-
...
|
|
370
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate)
|
|
371
371
|
}
|
|
372
372
|
) : new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
373
|
-
`store.search.${method} is not available on a StoreView (${
|
|
373
|
+
`store.search.${method} is not available on a StoreView (${chunk2QGYQBS2_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only; historical relevance is out of scope for a temporal view. Use a current-mode view or query the live Store.`,
|
|
374
374
|
{
|
|
375
375
|
code: "STORE_VIEW_SEARCH_UNSUPPORTED",
|
|
376
376
|
method,
|
|
377
|
-
...
|
|
377
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate)
|
|
378
378
|
}
|
|
379
379
|
);
|
|
380
380
|
}
|
|
@@ -393,11 +393,11 @@ function pinnedSearch(store, coordinate) {
|
|
|
393
393
|
}
|
|
394
394
|
function recordedSearchRefusal(method, coordinate) {
|
|
395
395
|
return new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
396
|
-
`store.search.${method} is not available on a RecordedStoreView (${
|
|
396
|
+
`store.search.${method} is not available on a RecordedStoreView (${chunk2QGYQBS2_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only and cannot answer a recorded-time query. Run search on the live Store.`,
|
|
397
397
|
{
|
|
398
398
|
code: "RECORDED_STORE_VIEW_SEARCH_UNSUPPORTED",
|
|
399
399
|
method,
|
|
400
|
-
...
|
|
400
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate)
|
|
401
401
|
}
|
|
402
402
|
);
|
|
403
403
|
}
|
|
@@ -416,7 +416,7 @@ var CoordinatePinnedView = class {
|
|
|
416
416
|
this.coordinate = coordinate;
|
|
417
417
|
Object.defineProperty(this, "identity", {
|
|
418
418
|
enumerable: false,
|
|
419
|
-
get: () =>
|
|
419
|
+
get: () => chunk3KOY4FH3_cjs.storeRuntime(this.store).identityAtCoordinate(this.coordinate)
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
422
|
/** The temporal mode this view reads in. */
|
|
@@ -433,10 +433,10 @@ var CoordinatePinnedView = class {
|
|
|
433
433
|
* view's coordinate cannot be overridden on a per-query basis.
|
|
434
434
|
*/
|
|
435
435
|
query() {
|
|
436
|
-
return
|
|
436
|
+
return chunk3KOY4FH3_cjs.storeRuntime(this.store).sealedQuery(this.coordinate);
|
|
437
437
|
}
|
|
438
438
|
internalAlgorithms() {
|
|
439
|
-
this.#internalAlgorithms ??=
|
|
439
|
+
this.#internalAlgorithms ??= chunk3KOY4FH3_cjs.storeRuntime(
|
|
440
440
|
this.store
|
|
441
441
|
).algorithmsAtCoordinate(this.coordinate);
|
|
442
442
|
return this.#internalAlgorithms;
|
|
@@ -463,7 +463,7 @@ var CoordinatePinnedView = class {
|
|
|
463
463
|
...options,
|
|
464
464
|
...withCoordinate(this.coordinate)
|
|
465
465
|
};
|
|
466
|
-
return
|
|
466
|
+
return chunk3KOY4FH3_cjs.storeRuntime(this.store).subgraphAtCoordinate(
|
|
467
467
|
rootId,
|
|
468
468
|
internalOptions
|
|
469
469
|
);
|
|
@@ -546,7 +546,7 @@ var StoreViewImplementation = class extends CoordinatePinnedView {
|
|
|
546
546
|
constructor(store, coordinate) {
|
|
547
547
|
super(
|
|
548
548
|
store,
|
|
549
|
-
isReadCoordinate(coordinate) ? coordinate :
|
|
549
|
+
isReadCoordinate(coordinate) ? coordinate : chunk2QGYQBS2_cjs.resolveReadCoordinate(
|
|
550
550
|
coordinate.mode,
|
|
551
551
|
coordinate.asOf,
|
|
552
552
|
'Use store.asOf("2026-01-01T00:00:00.000Z") or store.view({ mode: "asOf", asOf }).'
|
|
@@ -557,7 +557,7 @@ var StoreViewImplementation = class extends CoordinatePinnedView {
|
|
|
557
557
|
asOfRecorded(recordedAsOf) {
|
|
558
558
|
return new RecordedStoreView(
|
|
559
559
|
this.store,
|
|
560
|
-
|
|
560
|
+
chunk2QGYQBS2_cjs.withRecordedCoordinate(this.coordinate, recordedAsOf)
|
|
561
561
|
);
|
|
562
562
|
}
|
|
563
563
|
/** Read-only node collections pinned to this view's coordinate. */
|
|
@@ -1084,7 +1084,7 @@ var CURRENT_SEED_CLASS_ALIAS = "identity_seed_class";
|
|
|
1084
1084
|
var CURRENT_MEMBER_NODE_ALIAS = "identity_peer_node";
|
|
1085
1085
|
function historicalCoordinate(input) {
|
|
1086
1086
|
const { ast, temporalFilterPass } = input;
|
|
1087
|
-
const recorded =
|
|
1087
|
+
const recorded = chunk2QGYQBS2_cjs.optionalRecordedInstantParts(
|
|
1088
1088
|
ast.recordedAsOf,
|
|
1089
1089
|
"recordedAsOf"
|
|
1090
1090
|
);
|
|
@@ -1106,14 +1106,14 @@ function compileIdentityClassCte(input) {
|
|
|
1106
1106
|
if (!expandsIdentity) return void 0;
|
|
1107
1107
|
const coordinate = historicalCoordinate({ ast, temporalFilterPass });
|
|
1108
1108
|
if (coordinate === void 0) return void 0;
|
|
1109
|
-
const peerClasses =
|
|
1109
|
+
const peerClasses = chunkEZEEWCFJ_cjs.historicalIdentityPeerClassQuery({
|
|
1110
1110
|
schema: ctx.schema,
|
|
1111
1111
|
graphId,
|
|
1112
1112
|
coordinate,
|
|
1113
1113
|
sameIdAcrossKinds: ctx.identitySameIdAcrossKinds ?? "fold"
|
|
1114
1114
|
});
|
|
1115
1115
|
return chunkEDN4Y4ZG_cjs.sql`
|
|
1116
|
-
${chunkEDN4Y4ZG_cjs.sql.identifier(IDENTITY_CLASS_CTE_ALIAS)}(${
|
|
1116
|
+
${chunkEDN4Y4ZG_cjs.sql.identifier(IDENTITY_CLASS_CTE_ALIAS)}(${chunkEZEEWCFJ_cjs.IDENTITY_PEER_CLASS_COLUMNS}) AS MATERIALIZED (
|
|
1117
1117
|
${peerClasses}
|
|
1118
1118
|
)
|
|
1119
1119
|
`;
|
|
@@ -1293,7 +1293,7 @@ function markSelectiveFieldAsRequired(requiredColumnsByAlias, field2) {
|
|
|
1293
1293
|
addRequiredColumn(requiredColumnsByAlias, field2.alias, "props");
|
|
1294
1294
|
}
|
|
1295
1295
|
function getTopLevelPropsFieldName(field2) {
|
|
1296
|
-
const pointer =
|
|
1296
|
+
const pointer = chunkEZEEWCFJ_cjs.getFieldPointer(field2);
|
|
1297
1297
|
if (pointer === void 0) return void 0;
|
|
1298
1298
|
const segments = chunkA7J2YDDI_cjs.parseJsonPointer(pointer);
|
|
1299
1299
|
return segments.length === 1 ? segments[0] : void 0;
|
|
@@ -1394,11 +1394,11 @@ function buildStandardStartCte(input) {
|
|
|
1394
1394
|
const alias = ast.start.alias;
|
|
1395
1395
|
const kinds = ast.start.kinds;
|
|
1396
1396
|
const cteMaterialization = ctx.dialect.capabilities.emitNotMaterializedHint ? chunkEDN4Y4ZG_cjs.sql`NOT MATERIALIZED ` : chunkEDN4Y4ZG_cjs.sql``;
|
|
1397
|
-
const kindFilter =
|
|
1397
|
+
const kindFilter = chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("kind"), kinds);
|
|
1398
1398
|
const temporalFilter = input.temporalFilterPass.forAlias();
|
|
1399
1399
|
const cteContext = { ...ctx, cteColumnPrefix: "" };
|
|
1400
|
-
const predicateClauses =
|
|
1401
|
-
|
|
1400
|
+
const predicateClauses = chunkEZEEWCFJ_cjs.compilePredicateClauses(
|
|
1401
|
+
chunkEZEEWCFJ_cjs.getPredicatesForAlias(predicateIndex, alias, "node"),
|
|
1402
1402
|
cteContext
|
|
1403
1403
|
);
|
|
1404
1404
|
const whereClauses = [
|
|
@@ -1445,27 +1445,27 @@ function buildStandardTraversalCte(input) {
|
|
|
1445
1445
|
} = input;
|
|
1446
1446
|
const traversal = chunkN66HCGCY_cjs.requireDefined(ast.traversals[traversalIndex]);
|
|
1447
1447
|
const traversalLimitValue = traversalIndex === ast.traversals.length - 1 ? traversalLimit : void 0;
|
|
1448
|
-
const previousNodeKinds =
|
|
1448
|
+
const previousNodeKinds = chunkEZEEWCFJ_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
1449
1449
|
const directEdgeKinds = [...new Set(traversal.edgeKinds)];
|
|
1450
1450
|
const inverseEdgeKinds = traversal.inverseEdgeKinds === void 0 ? [] : [...new Set(traversal.inverseEdgeKinds)];
|
|
1451
1451
|
const nodeKinds = traversal.nodeKinds;
|
|
1452
|
-
const nodeKindFilter =
|
|
1452
|
+
const nodeKindFilter = chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("n.kind"), nodeKinds);
|
|
1453
1453
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
1454
1454
|
const nodeTemporalFilter = temporalFilterPass.forAlias("n");
|
|
1455
1455
|
const nodeCteContext = {
|
|
1456
1456
|
...ctx,
|
|
1457
1457
|
cteColumnPrefix: "n"
|
|
1458
1458
|
};
|
|
1459
|
-
const nodePredicateClauses =
|
|
1460
|
-
|
|
1459
|
+
const nodePredicateClauses = chunkEZEEWCFJ_cjs.compilePredicateClauses(
|
|
1460
|
+
chunkEZEEWCFJ_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
1461
1461
|
nodeCteContext
|
|
1462
1462
|
);
|
|
1463
1463
|
const edgeCteContext = {
|
|
1464
1464
|
...ctx,
|
|
1465
1465
|
cteColumnPrefix: "e"
|
|
1466
1466
|
};
|
|
1467
|
-
const edgePredicateClauses =
|
|
1468
|
-
|
|
1467
|
+
const edgePredicateClauses = chunkEZEEWCFJ_cjs.compilePredicateClauses(
|
|
1468
|
+
chunkEZEEWCFJ_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
1469
1469
|
edgeCteContext
|
|
1470
1470
|
);
|
|
1471
1471
|
const baseWhereClauses = [
|
|
@@ -1535,12 +1535,12 @@ function buildStandardTraversalCte(input) {
|
|
|
1535
1535
|
// currently the member-visibility guard. Every branch of the step carries
|
|
1536
1536
|
// them, because every branch reads the widened frontier.
|
|
1537
1537
|
...identityFrontierExpansion?.whereClauses ?? [],
|
|
1538
|
-
|
|
1539
|
-
|
|
1538
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("e.kind"), branch.edgeKinds),
|
|
1539
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw(`e.${branch.targetKindField}`), nodeKinds)
|
|
1540
1540
|
];
|
|
1541
1541
|
if (traversal.includeIdentityMembers !== true) {
|
|
1542
1542
|
whereClauses.push(
|
|
1543
|
-
|
|
1543
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(
|
|
1544
1544
|
chunkEDN4Y4ZG_cjs.sql.raw(`e.${branch.joinKindField}`),
|
|
1545
1545
|
previousNodeKinds
|
|
1546
1546
|
)
|
|
@@ -1609,7 +1609,7 @@ function buildStandardTraversalCte(input) {
|
|
|
1609
1609
|
const duplicateGuard = compileInverseTraversalDuplicateGuard(
|
|
1610
1610
|
directEdgeKinds,
|
|
1611
1611
|
inverseEdgeKinds,
|
|
1612
|
-
(overlappingKinds) =>
|
|
1612
|
+
(overlappingKinds) => chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("e.kind"), overlappingKinds)
|
|
1613
1613
|
);
|
|
1614
1614
|
const inverseBranch = compileTraversalBranch({
|
|
1615
1615
|
duplicateGuard,
|
|
@@ -1650,7 +1650,7 @@ function compileAggregateExprFromSource(expr, dialect) {
|
|
|
1650
1650
|
case "min":
|
|
1651
1651
|
case "max": {
|
|
1652
1652
|
const cteAlias = `cte_${field2.alias}`;
|
|
1653
|
-
const column =
|
|
1653
|
+
const column = chunkEZEEWCFJ_cjs.compileFieldValue(
|
|
1654
1654
|
field2,
|
|
1655
1655
|
dialect,
|
|
1656
1656
|
field2.valueType,
|
|
@@ -1673,7 +1673,7 @@ function compileProjectedSource(field2, dialect) {
|
|
|
1673
1673
|
return compileAggregateExprFromSource(field2.source, dialect);
|
|
1674
1674
|
}
|
|
1675
1675
|
const cteAlias = field2.cteAlias ?? `cte_${field2.source.alias}`;
|
|
1676
|
-
return
|
|
1676
|
+
return chunkEZEEWCFJ_cjs.compileFieldValue(
|
|
1677
1677
|
field2.source,
|
|
1678
1678
|
dialect,
|
|
1679
1679
|
field2.source.valueType,
|
|
@@ -1729,10 +1729,10 @@ function compileOrderFieldValue(ast, field2, dialect, cteAlias) {
|
|
|
1729
1729
|
if (selectiveField !== void 0) {
|
|
1730
1730
|
return chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.raw(cteAlias)}.${quoteIdentifier(selectivePropsCteColumnName(selectiveField))}`;
|
|
1731
1731
|
}
|
|
1732
|
-
return
|
|
1732
|
+
return chunkEZEEWCFJ_cjs.compileFieldValue(field2, dialect, field2.valueType, cteAlias);
|
|
1733
1733
|
}
|
|
1734
1734
|
function buildRelevanceJoins(vectorPredicate, fulltextPredicate) {
|
|
1735
|
-
const hybridTargetAlias =
|
|
1735
|
+
const hybridTargetAlias = chunkEZEEWCFJ_cjs.getHybridTargetAlias(
|
|
1736
1736
|
vectorPredicate,
|
|
1737
1737
|
fulltextPredicate
|
|
1738
1738
|
);
|
|
@@ -1973,7 +1973,7 @@ function buildStandardGroupBy(input) {
|
|
|
1973
1973
|
}
|
|
1974
1974
|
const aliasToCte = buildAliasToCteMap(ast);
|
|
1975
1975
|
const parts = allFields.map(
|
|
1976
|
-
(field2) =>
|
|
1976
|
+
(field2) => chunkEZEEWCFJ_cjs.compileFieldValue(
|
|
1977
1977
|
field2,
|
|
1978
1978
|
dialect,
|
|
1979
1979
|
field2.valueType,
|
|
@@ -1987,7 +1987,7 @@ function buildStandardHaving(input) {
|
|
|
1987
1987
|
if (!ast.having) {
|
|
1988
1988
|
return void 0;
|
|
1989
1989
|
}
|
|
1990
|
-
const condition =
|
|
1990
|
+
const condition = chunkEZEEWCFJ_cjs.compilePredicateExpression(ast.having, ctx);
|
|
1991
1991
|
return chunkEDN4Y4ZG_cjs.sql`HAVING ${condition}`;
|
|
1992
1992
|
}
|
|
1993
1993
|
function buildStandardEmbeddingsCte(input) {
|
|
@@ -2151,7 +2151,7 @@ function buildStandardFulltextCte(input) {
|
|
|
2151
2151
|
);
|
|
2152
2152
|
const conditions = [
|
|
2153
2153
|
chunkEDN4Y4ZG_cjs.sql`${qualifyColumn(tableName, "graph_id")} = ${graphId}`,
|
|
2154
|
-
|
|
2154
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(qualifyColumn(tableName, "node_kind"), nodeKinds),
|
|
2155
2155
|
matchCondition
|
|
2156
2156
|
];
|
|
2157
2157
|
if (minScore !== void 0) {
|
|
@@ -2269,7 +2269,7 @@ function buildLimitOffsetClause(input) {
|
|
|
2269
2269
|
|
|
2270
2270
|
// src/query/compiler/passes/fulltext.ts
|
|
2271
2271
|
function runFulltextPredicatePass(ast, dialect) {
|
|
2272
|
-
const fulltextPredicates =
|
|
2272
|
+
const fulltextPredicates = chunkEZEEWCFJ_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2273
2273
|
if (fulltextPredicates.length > 1) {
|
|
2274
2274
|
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
2275
2275
|
"Multiple fulltext match predicates in a single query are not supported"
|
|
@@ -2366,11 +2366,11 @@ function runCompilerPass(state, pass) {
|
|
|
2366
2366
|
|
|
2367
2367
|
// src/query/compiler/passes/temporal.ts
|
|
2368
2368
|
function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
2369
|
-
const currentTimestamp =
|
|
2369
|
+
const currentTimestamp = chunkEZEEWCFJ_cjs.currentReadInstantFor(readInstant);
|
|
2370
2370
|
return {
|
|
2371
2371
|
forAlias(tableAlias) {
|
|
2372
|
-
return
|
|
2373
|
-
...
|
|
2372
|
+
return chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
2373
|
+
...chunkEZEEWCFJ_cjs.extractTemporalOptions(ast, tableAlias),
|
|
2374
2374
|
currentTimestamp
|
|
2375
2375
|
});
|
|
2376
2376
|
},
|
|
@@ -2380,7 +2380,7 @@ function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
|
2380
2380
|
|
|
2381
2381
|
// src/query/compiler/passes/vector.ts
|
|
2382
2382
|
function runVectorPredicatePass(ast, dialect, vectorStrategy) {
|
|
2383
|
-
const vectorPredicates =
|
|
2383
|
+
const vectorPredicates = chunkEZEEWCFJ_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2384
2384
|
if (vectorPredicates.length > 1) {
|
|
2385
2385
|
throw new chunkMRDBBHIZ_cjs.UnsupportedPredicateError(
|
|
2386
2386
|
"Multiple vector similarity predicates in a single query are not supported"
|
|
@@ -2793,8 +2793,8 @@ function assertRecordedQueryDoesNotUseCurrentIndexes(ast, vectorPredicate, fullt
|
|
|
2793
2793
|
}
|
|
2794
2794
|
function assertRecordedQueryAstDoesNotUseCurrentIndexes(ast) {
|
|
2795
2795
|
if (ast.recordedAsOf === void 0) return;
|
|
2796
|
-
const vectorPredicates =
|
|
2797
|
-
const fulltextPredicates =
|
|
2796
|
+
const vectorPredicates = chunkEZEEWCFJ_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2797
|
+
const fulltextPredicates = chunkEZEEWCFJ_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2798
2798
|
assertRecordedQueryHasNoCurrentIndexUsage(ast, {
|
|
2799
2799
|
usesVectorPredicate: vectorPredicates.length > 0,
|
|
2800
2800
|
usesFulltextPredicate: fulltextPredicates.length > 0
|
|
@@ -3208,13 +3208,13 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
3208
3208
|
`;
|
|
3209
3209
|
}
|
|
3210
3210
|
function compileKindFilter2(kinds, columnExpr) {
|
|
3211
|
-
return
|
|
3211
|
+
return chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw(columnExpr), kinds);
|
|
3212
3212
|
}
|
|
3213
3213
|
function compileNodePredicates(ast, alias, ctx) {
|
|
3214
|
-
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) =>
|
|
3214
|
+
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) => chunkEZEEWCFJ_cjs.compilePredicateExpression(p.expression, ctx));
|
|
3215
3215
|
}
|
|
3216
3216
|
function compileEdgePredicates(ast, edgeAlias, ctx) {
|
|
3217
|
-
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) =>
|
|
3217
|
+
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) => chunkEZEEWCFJ_cjs.compilePredicateExpression(p.expression, ctx));
|
|
3218
3218
|
}
|
|
3219
3219
|
function collectRequiredColumnsByAlias(ast, traversal) {
|
|
3220
3220
|
const selectiveFields = ast.selectiveFields;
|
|
@@ -3333,7 +3333,7 @@ function compileRecursiveOrderBy(ast, dialect) {
|
|
|
3333
3333
|
"Ordering by JSON arrays or objects is not supported"
|
|
3334
3334
|
);
|
|
3335
3335
|
}
|
|
3336
|
-
const field2 =
|
|
3336
|
+
const field2 = chunkEZEEWCFJ_cjs.compileFieldValue(orderSpec.field, dialect, valueType);
|
|
3337
3337
|
const direction = chunkEDN4Y4ZG_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
3338
3338
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
3339
3339
|
const nullsDirection = chunkEDN4Y4ZG_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
@@ -3415,19 +3415,19 @@ function decodeByValueType(value, valueType) {
|
|
|
3415
3415
|
// src/store/recursive-cte.ts
|
|
3416
3416
|
function buildReachableCte(options) {
|
|
3417
3417
|
const trackPath = options.cyclePolicy === "prevent" || options.includePath;
|
|
3418
|
-
const edgeKindFilter =
|
|
3418
|
+
const edgeKindFilter = chunkEZEEWCFJ_cjs.compileKindFilter(
|
|
3419
3419
|
chunkEDN4Y4ZG_cjs.sql.raw("e.kind"),
|
|
3420
3420
|
options.edgeKinds
|
|
3421
3421
|
);
|
|
3422
|
-
const currentTimestamp =
|
|
3423
|
-
const nodeTemporalFilter =
|
|
3422
|
+
const currentTimestamp = chunkEZEEWCFJ_cjs.currentReadInstant();
|
|
3423
|
+
const nodeTemporalFilter = chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
3424
3424
|
mode: options.temporalMode,
|
|
3425
3425
|
asOf: options.asOf,
|
|
3426
3426
|
recordedAsOf: options.recordedAsOf,
|
|
3427
3427
|
tableAlias: "n",
|
|
3428
3428
|
currentTimestamp
|
|
3429
3429
|
});
|
|
3430
|
-
const edgeTemporalFilter =
|
|
3430
|
+
const edgeTemporalFilter = chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
3431
3431
|
mode: options.temporalMode,
|
|
3432
3432
|
asOf: options.asOf,
|
|
3433
3433
|
recordedAsOf: options.recordedAsOf,
|
|
@@ -3550,7 +3550,7 @@ function defineSubgraphProject(_graph) {
|
|
|
3550
3550
|
}
|
|
3551
3551
|
async function executeSubgraph(params) {
|
|
3552
3552
|
const { options } = params;
|
|
3553
|
-
const { valid: coordinate } =
|
|
3553
|
+
const { valid: coordinate } = chunk2QGYQBS2_cjs.resolveReadCoordinate(
|
|
3554
3554
|
options.temporalMode ?? params.graph.defaults.temporalMode,
|
|
3555
3555
|
options.asOf
|
|
3556
3556
|
);
|
|
@@ -3738,7 +3738,7 @@ function dedupeStrings(values) {
|
|
|
3738
3738
|
function buildIncludedIdsCte(ctx) {
|
|
3739
3739
|
const filters = [];
|
|
3740
3740
|
if (ctx.includeKinds !== void 0 && ctx.includeKinds.length > 0) {
|
|
3741
|
-
filters.push(
|
|
3741
|
+
filters.push(chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("kind"), ctx.includeKinds));
|
|
3742
3742
|
}
|
|
3743
3743
|
if (ctx.excludeRoot) {
|
|
3744
3744
|
filters.push(chunkEDN4Y4ZG_cjs.sql`id != ${ctx.rootId}`);
|
|
@@ -3761,12 +3761,12 @@ async function fetchIncludedIds(ctx, reachableCte, includedIdsCte) {
|
|
|
3761
3761
|
return rows.map((row) => row.id);
|
|
3762
3762
|
}
|
|
3763
3763
|
async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
3764
|
-
const nodeTemporalFilter =
|
|
3764
|
+
const nodeTemporalFilter = chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
3765
3765
|
mode: ctx.temporalMode,
|
|
3766
3766
|
asOf: ctx.asOf,
|
|
3767
3767
|
recordedAsOf: ctx.recordedAsOf,
|
|
3768
3768
|
tableAlias: "n",
|
|
3769
|
-
currentTimestamp:
|
|
3769
|
+
currentTimestamp: chunkEZEEWCFJ_cjs.currentReadInstant()
|
|
3770
3770
|
});
|
|
3771
3771
|
const columns = [
|
|
3772
3772
|
chunkEDN4Y4ZG_cjs.sql`n.kind`,
|
|
@@ -3789,13 +3789,13 @@ async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
|
3789
3789
|
);
|
|
3790
3790
|
}
|
|
3791
3791
|
async function fetchSubgraphEdges(ctx, membership, projectionPlan) {
|
|
3792
|
-
const edgeKindFilter =
|
|
3793
|
-
const edgeTemporalFilter =
|
|
3792
|
+
const edgeKindFilter = chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("e.kind"), ctx.edgeKinds);
|
|
3793
|
+
const edgeTemporalFilter = chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
3794
3794
|
mode: ctx.temporalMode,
|
|
3795
3795
|
asOf: ctx.asOf,
|
|
3796
3796
|
recordedAsOf: ctx.recordedAsOf,
|
|
3797
3797
|
tableAlias: "e",
|
|
3798
|
-
currentTimestamp:
|
|
3798
|
+
currentTimestamp: chunkEZEEWCFJ_cjs.currentReadInstant()
|
|
3799
3799
|
});
|
|
3800
3800
|
const columns = [
|
|
3801
3801
|
chunkEDN4Y4ZG_cjs.sql`e.id`,
|
|
@@ -3834,7 +3834,7 @@ function buildMetadataColumns(alias, plan, columns) {
|
|
|
3834
3834
|
if (metaKinds.length === plan.fullKinds.length + plan.projectedKinds.size) {
|
|
3835
3835
|
return columns.map((col) => chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.raw(`${alias}.${col}`)}`);
|
|
3836
3836
|
}
|
|
3837
|
-
const filter =
|
|
3837
|
+
const filter = chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw(`${alias}.kind`), metaKinds);
|
|
3838
3838
|
return columns.map(
|
|
3839
3839
|
(col) => chunkEDN4Y4ZG_cjs.sql`CASE WHEN ${filter} THEN ${chunkEDN4Y4ZG_cjs.sql.raw(`${alias}.${col}`)} ELSE NULL END AS ${chunkEDN4Y4ZG_cjs.sql.raw(col)}`
|
|
3840
3840
|
);
|
|
@@ -3846,7 +3846,7 @@ function buildFullPropsColumn(alias, plan) {
|
|
|
3846
3846
|
if (plan.fullKinds.length === 0) {
|
|
3847
3847
|
return chunkEDN4Y4ZG_cjs.sql`NULL AS props`;
|
|
3848
3848
|
}
|
|
3849
|
-
const filter =
|
|
3849
|
+
const filter = chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw(`${alias}.kind`), plan.fullKinds);
|
|
3850
3850
|
return chunkEDN4Y4ZG_cjs.sql`CASE WHEN ${filter} THEN ${chunkEDN4Y4ZG_cjs.sql.raw(`${alias}.props`)} ELSE NULL END AS props`;
|
|
3851
3851
|
}
|
|
3852
3852
|
function buildProjectedPropertyColumns(alias, plan, dialect) {
|
|
@@ -3890,7 +3890,7 @@ function applyProjectedFields(target, row, kindPlan) {
|
|
|
3890
3890
|
function mapSubgraphNodeRow(row, projectionPlan) {
|
|
3891
3891
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3892
3892
|
if (kindPlan === void 0) {
|
|
3893
|
-
return
|
|
3893
|
+
return chunkJB6T4GLL_cjs.rowToNode({
|
|
3894
3894
|
...row,
|
|
3895
3895
|
props: normalizeProps(row.props)
|
|
3896
3896
|
});
|
|
@@ -3900,7 +3900,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3900
3900
|
id: row.id
|
|
3901
3901
|
};
|
|
3902
3902
|
if (kindPlan.includeMeta) {
|
|
3903
|
-
projectedNode["meta"] =
|
|
3903
|
+
projectedNode["meta"] = chunkJB6T4GLL_cjs.rowToNodeMeta(row);
|
|
3904
3904
|
}
|
|
3905
3905
|
applyProjectedFields(projectedNode, row, kindPlan);
|
|
3906
3906
|
return projectedNode;
|
|
@@ -3908,7 +3908,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3908
3908
|
function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
3909
3909
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3910
3910
|
if (kindPlan === void 0) {
|
|
3911
|
-
return
|
|
3911
|
+
return chunkJB6T4GLL_cjs.rowToEdge({
|
|
3912
3912
|
...row,
|
|
3913
3913
|
props: normalizeProps(row.props)
|
|
3914
3914
|
});
|
|
@@ -3922,7 +3922,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
|
3922
3922
|
toId: row.to_id
|
|
3923
3923
|
};
|
|
3924
3924
|
if (kindPlan.includeMeta) {
|
|
3925
|
-
projectedEdge["meta"] =
|
|
3925
|
+
projectedEdge["meta"] = chunkJB6T4GLL_cjs.rowToEdgeMeta(row);
|
|
3926
3926
|
}
|
|
3927
3927
|
applyProjectedFields(projectedEdge, row, kindPlan);
|
|
3928
3928
|
return projectedEdge;
|
|
@@ -4248,7 +4248,7 @@ function hasIdEqualityPredicate(expression, alias) {
|
|
|
4248
4248
|
}
|
|
4249
4249
|
}
|
|
4250
4250
|
function isStartAliasBoundToSingleId(ast, predicateIndex) {
|
|
4251
|
-
return
|
|
4251
|
+
return chunkEZEEWCFJ_cjs.getPredicatesForAlias(predicateIndex, ast.start.alias, "node").some(
|
|
4252
4252
|
(predicate) => hasIdEqualityPredicate(predicate.expression, ast.start.alias)
|
|
4253
4253
|
);
|
|
4254
4254
|
}
|
|
@@ -4332,7 +4332,7 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
|
|
|
4332
4332
|
fulltextPredicate: void 0,
|
|
4333
4333
|
fusion: void 0,
|
|
4334
4334
|
logicalPlan: void 0,
|
|
4335
|
-
predicateIndex:
|
|
4335
|
+
predicateIndex: chunkEZEEWCFJ_cjs.buildPredicateIndex(ast),
|
|
4336
4336
|
requiredColumnsByAlias: void 0,
|
|
4337
4337
|
shouldCollapseSelectiveTraversalRowset: false,
|
|
4338
4338
|
temporalFilterPass: void 0,
|
|
@@ -4573,7 +4573,7 @@ function compileSetOperation2(op, graphId, options = "sqlite") {
|
|
|
4573
4573
|
}
|
|
4574
4574
|
return compiled;
|
|
4575
4575
|
};
|
|
4576
|
-
const combined =
|
|
4576
|
+
const combined = chunkEZEEWCFJ_cjs.withPinnedReadInstant(
|
|
4577
4577
|
() => compileSetOperation(op, graphId, adapter, compileOperand, options_.vectorStrategy)
|
|
4578
4578
|
);
|
|
4579
4579
|
if (annIndexTypes.size > 0) {
|
|
@@ -4721,7 +4721,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4721
4721
|
const nodeCountDistinctColumn = `${traversal.nodeAlias}_count_distinct`;
|
|
4722
4722
|
const edgeCountColumn = `${traversal.edgeAlias}_count`;
|
|
4723
4723
|
const edgeCountDistinctColumn = `${traversal.edgeAlias}_count_distinct`;
|
|
4724
|
-
const previousNodeKinds =
|
|
4724
|
+
const previousNodeKinds = chunkEZEEWCFJ_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
4725
4725
|
const edgeKinds = [...new Set(traversal.edgeKinds)];
|
|
4726
4726
|
const nodeKinds = traversal.nodeKinds;
|
|
4727
4727
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
@@ -4730,16 +4730,16 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4730
4730
|
...ctx,
|
|
4731
4731
|
cteColumnPrefix: "n"
|
|
4732
4732
|
};
|
|
4733
|
-
const nodePredicateClauses =
|
|
4734
|
-
|
|
4733
|
+
const nodePredicateClauses = chunkEZEEWCFJ_cjs.compilePredicateClauses(
|
|
4734
|
+
chunkEZEEWCFJ_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
4735
4735
|
nodePredicateContext
|
|
4736
4736
|
);
|
|
4737
4737
|
const edgePredicateContext = {
|
|
4738
4738
|
...ctx,
|
|
4739
4739
|
cteColumnPrefix: "e"
|
|
4740
4740
|
};
|
|
4741
|
-
const edgePredicateClauses =
|
|
4742
|
-
|
|
4741
|
+
const edgePredicateClauses = chunkEZEEWCFJ_cjs.compilePredicateClauses(
|
|
4742
|
+
chunkEZEEWCFJ_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
4743
4743
|
edgePredicateContext
|
|
4744
4744
|
);
|
|
4745
4745
|
const joinField = traversal.direction === "out" ? "from_id" : "to_id";
|
|
@@ -4751,14 +4751,14 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4751
4751
|
const useInnerJoin = hasNodePredicates;
|
|
4752
4752
|
const whereClauses = [
|
|
4753
4753
|
chunkEDN4Y4ZG_cjs.sql`e.graph_id = ${graphId}`,
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4754
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("e.kind"), edgeKinds),
|
|
4755
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw(`e.${joinKindField}`), previousNodeKinds),
|
|
4756
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw(`e.${targetKindField}`), nodeKinds),
|
|
4757
4757
|
edgeTemporalFilter,
|
|
4758
4758
|
...edgePredicateClauses,
|
|
4759
4759
|
// INNER JOIN mode: node-side filters in WHERE constrain every aggregate.
|
|
4760
4760
|
...requiresNodeJoin && useInnerJoin ? [
|
|
4761
|
-
|
|
4761
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4762
4762
|
nodeTemporalFilter,
|
|
4763
4763
|
...nodePredicateClauses
|
|
4764
4764
|
] : []
|
|
@@ -4774,7 +4774,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4774
4774
|
chunkEDN4Y4ZG_cjs.sql`n.graph_id = e.graph_id`,
|
|
4775
4775
|
chunkEDN4Y4ZG_cjs.sql`n.id = e.${chunkEDN4Y4ZG_cjs.sql.raw(targetField)}`,
|
|
4776
4776
|
chunkEDN4Y4ZG_cjs.sql`n.kind = e.${chunkEDN4Y4ZG_cjs.sql.raw(targetKindField)}`,
|
|
4777
|
-
|
|
4777
|
+
chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4778
4778
|
nodeTemporalFilter
|
|
4779
4779
|
] : [];
|
|
4780
4780
|
const aggregateColumns = [];
|
|
@@ -4834,7 +4834,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4834
4834
|
ast.projection.fields.map((projectedField) => {
|
|
4835
4835
|
const source = projectedField.source;
|
|
4836
4836
|
if (!isAggregateExpr(source)) {
|
|
4837
|
-
const value =
|
|
4837
|
+
const value = chunkEZEEWCFJ_cjs.compileFieldValue(
|
|
4838
4838
|
source,
|
|
4839
4839
|
dialect,
|
|
4840
4840
|
source.valueType,
|
|
@@ -5174,7 +5174,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
5174
5174
|
traversalLimit: traversalCteLimit
|
|
5175
5175
|
});
|
|
5176
5176
|
if (vectorPredicate) {
|
|
5177
|
-
const nodeKinds =
|
|
5177
|
+
const nodeKinds = chunkEZEEWCFJ_cjs.getNodeKindsForAlias(ast, vectorPredicate.field.alias);
|
|
5178
5178
|
ctes.push(
|
|
5179
5179
|
buildStandardEmbeddingsCte({
|
|
5180
5180
|
ctx,
|
|
@@ -5185,7 +5185,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
5185
5185
|
);
|
|
5186
5186
|
}
|
|
5187
5187
|
if (fulltextPredicate) {
|
|
5188
|
-
const nodeKinds =
|
|
5188
|
+
const nodeKinds = chunkEZEEWCFJ_cjs.getNodeKindsForAlias(ast, fulltextPredicate.field.alias);
|
|
5189
5189
|
ctes.push(
|
|
5190
5190
|
buildStandardFulltextCte({
|
|
5191
5191
|
ctx,
|
|
@@ -5195,7 +5195,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
5195
5195
|
})
|
|
5196
5196
|
);
|
|
5197
5197
|
}
|
|
5198
|
-
if (
|
|
5198
|
+
if (chunkEZEEWCFJ_cjs.getHybridTargetAlias(vectorPredicate, fulltextPredicate) !== void 0) {
|
|
5199
5199
|
ctes.push(buildStandardHybridCandidateCte());
|
|
5200
5200
|
}
|
|
5201
5201
|
const projection = buildStandardProjection({
|
|
@@ -5297,23 +5297,23 @@ function buildSelectableNode(row, alias) {
|
|
|
5297
5297
|
const propsRaw = row[`${alias}_props`];
|
|
5298
5298
|
const rawProps = typeof propsRaw === "string" ? JSON.parse(propsRaw) : propsRaw ?? {};
|
|
5299
5299
|
const version = row[`${alias}_version`];
|
|
5300
|
-
const validFrom =
|
|
5300
|
+
const validFrom = chunkFA2AFWLP_cjs.normalizeRowTimestamp(
|
|
5301
5301
|
row[`${alias}_valid_from`],
|
|
5302
5302
|
`${alias}_valid_from`
|
|
5303
5303
|
);
|
|
5304
|
-
const validTo =
|
|
5304
|
+
const validTo = chunkFA2AFWLP_cjs.normalizeRowTimestamp(
|
|
5305
5305
|
row[`${alias}_valid_to`],
|
|
5306
5306
|
`${alias}_valid_to`
|
|
5307
5307
|
);
|
|
5308
|
-
const createdAt =
|
|
5308
|
+
const createdAt = chunkFA2AFWLP_cjs.normalizeRequiredRowTimestamp(
|
|
5309
5309
|
row[`${alias}_created_at`],
|
|
5310
5310
|
`${alias}_created_at`
|
|
5311
5311
|
);
|
|
5312
|
-
const updatedAt =
|
|
5312
|
+
const updatedAt = chunkFA2AFWLP_cjs.normalizeRequiredRowTimestamp(
|
|
5313
5313
|
row[`${alias}_updated_at`],
|
|
5314
5314
|
`${alias}_updated_at`
|
|
5315
5315
|
);
|
|
5316
|
-
const deletedAt =
|
|
5316
|
+
const deletedAt = chunkFA2AFWLP_cjs.normalizeRowTimestamp(
|
|
5317
5317
|
row[`${alias}_deleted_at`],
|
|
5318
5318
|
`${alias}_deleted_at`
|
|
5319
5319
|
);
|
|
@@ -5349,23 +5349,23 @@ function buildSelectableEdge(row, alias) {
|
|
|
5349
5349
|
const toId = row[`${alias}_to_id`];
|
|
5350
5350
|
const propsRaw = row[`${alias}_props`];
|
|
5351
5351
|
const rawProps = typeof propsRaw === "string" ? JSON.parse(propsRaw) : propsRaw ?? {};
|
|
5352
|
-
const validFrom =
|
|
5352
|
+
const validFrom = chunkFA2AFWLP_cjs.normalizeRowTimestamp(
|
|
5353
5353
|
row[`${alias}_valid_from`],
|
|
5354
5354
|
`${alias}_valid_from`
|
|
5355
5355
|
);
|
|
5356
|
-
const validTo =
|
|
5356
|
+
const validTo = chunkFA2AFWLP_cjs.normalizeRowTimestamp(
|
|
5357
5357
|
row[`${alias}_valid_to`],
|
|
5358
5358
|
`${alias}_valid_to`
|
|
5359
5359
|
);
|
|
5360
|
-
const createdAt =
|
|
5360
|
+
const createdAt = chunkFA2AFWLP_cjs.normalizeRequiredRowTimestamp(
|
|
5361
5361
|
row[`${alias}_created_at`],
|
|
5362
5362
|
`${alias}_created_at`
|
|
5363
5363
|
);
|
|
5364
|
-
const updatedAt =
|
|
5364
|
+
const updatedAt = chunkFA2AFWLP_cjs.normalizeRequiredRowTimestamp(
|
|
5365
5365
|
row[`${alias}_updated_at`],
|
|
5366
5366
|
`${alias}_updated_at`
|
|
5367
5367
|
);
|
|
5368
|
-
const deletedAt =
|
|
5368
|
+
const deletedAt = chunkFA2AFWLP_cjs.normalizeRowTimestamp(
|
|
5369
5369
|
row[`${alias}_deleted_at`],
|
|
5370
5370
|
`${alias}_deleted_at`
|
|
5371
5371
|
);
|
|
@@ -5837,9 +5837,9 @@ function buildSelectiveFields(accessedFields, options) {
|
|
|
5837
5837
|
valueType: typeInfo?.valueType
|
|
5838
5838
|
};
|
|
5839
5839
|
}).toSorted((a, b) => {
|
|
5840
|
-
const aliasCompare =
|
|
5840
|
+
const aliasCompare = chunkEZEEWCFJ_cjs.compareStrings(a.alias, b.alias);
|
|
5841
5841
|
if (aliasCompare !== 0) return aliasCompare;
|
|
5842
|
-
return
|
|
5842
|
+
return chunkEZEEWCFJ_cjs.compareStrings(a.field, b.field);
|
|
5843
5843
|
});
|
|
5844
5844
|
}
|
|
5845
5845
|
function buildAliasKindMap(state) {
|
|
@@ -5941,9 +5941,9 @@ function normalizeMetaValue(value, metaKey, alias) {
|
|
|
5941
5941
|
if (metaKey === "version") return nullToUndefined(value);
|
|
5942
5942
|
const field2 = `${alias}_${metaKey}`;
|
|
5943
5943
|
if (metaKey === "createdAt" || metaKey === "updatedAt") {
|
|
5944
|
-
return
|
|
5944
|
+
return chunkFA2AFWLP_cjs.normalizeRequiredRowTimestamp(value, field2);
|
|
5945
5945
|
}
|
|
5946
|
-
return
|
|
5946
|
+
return chunkFA2AFWLP_cjs.normalizeRowTimestamp(value, field2);
|
|
5947
5947
|
}
|
|
5948
5948
|
var SELECTABLE_ALIAS_MARKER = /* @__PURE__ */ Symbol("selectable_alias_marker");
|
|
5949
5949
|
function isSelectableAliasObject(value) {
|
|
@@ -6067,7 +6067,7 @@ function buildAliasPlans(state, selectiveFields, schemaIntrospector) {
|
|
|
6067
6067
|
systemOutputNames: new Set(systemFields.map((f) => f.outputName))
|
|
6068
6068
|
});
|
|
6069
6069
|
}
|
|
6070
|
-
return plans.toSorted((a, b) =>
|
|
6070
|
+
return plans.toSorted((a, b) => chunkEZEEWCFJ_cjs.compareStrings(a.alias, b.alias));
|
|
6071
6071
|
}
|
|
6072
6072
|
function buildSelectiveContext(row, plans, traversals) {
|
|
6073
6073
|
const context = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
@@ -6150,7 +6150,7 @@ function createGuardedProxy(target, debugPath) {
|
|
|
6150
6150
|
// src/query/builder/read-instant-template.ts
|
|
6151
6151
|
function templateHasReadInstant(template) {
|
|
6152
6152
|
return template.params.some(
|
|
6153
|
-
(parameter) => chunkEDN4Y4ZG_cjs.isSqlPlaceholder(parameter) && parameter.name ===
|
|
6153
|
+
(parameter) => chunkEDN4Y4ZG_cjs.isSqlPlaceholder(parameter) && parameter.name === chunkEZEEWCFJ_cjs.CURRENT_READ_INSTANT_PLACEHOLDER
|
|
6154
6154
|
);
|
|
6155
6155
|
}
|
|
6156
6156
|
function queryAstNeedsCurrentReadInstant(ast) {
|
|
@@ -6189,8 +6189,8 @@ function fillTemplateParams(params, bindings, dialect, listParameters = EMPTY_LI
|
|
|
6189
6189
|
return params.map((parameter) => {
|
|
6190
6190
|
if (!chunkEDN4Y4ZG_cjs.isSqlPlaceholder(parameter)) return parameter;
|
|
6191
6191
|
const name = parameter.name;
|
|
6192
|
-
if (name ===
|
|
6193
|
-
readInstant ??=
|
|
6192
|
+
if (name === chunkEZEEWCFJ_cjs.CURRENT_READ_INSTANT_PLACEHOLDER) {
|
|
6193
|
+
readInstant ??= chunkTQHGE7UC_cjs.nowIso();
|
|
6194
6194
|
return readInstant;
|
|
6195
6195
|
}
|
|
6196
6196
|
const value = chunkN66HCGCY_cjs.readOwnProperty(bindings, name);
|
|
@@ -6249,7 +6249,7 @@ function toLiteralList(parameterName, value) {
|
|
|
6249
6249
|
function substitutePredicateExpression(expr, bindings) {
|
|
6250
6250
|
switch (expr.__type) {
|
|
6251
6251
|
case "comparison": {
|
|
6252
|
-
if (
|
|
6252
|
+
if (chunkEZEEWCFJ_cjs.isParameterRef(expr.right)) {
|
|
6253
6253
|
const value = resolveBinding(bindings, expr.right.name);
|
|
6254
6254
|
return {
|
|
6255
6255
|
...expr,
|
|
@@ -6259,7 +6259,7 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
6259
6259
|
return expr;
|
|
6260
6260
|
}
|
|
6261
6261
|
case "string_op": {
|
|
6262
|
-
if (
|
|
6262
|
+
if (chunkEZEEWCFJ_cjs.isParameterRef(expr.pattern)) {
|
|
6263
6263
|
const value = chunkN66HCGCY_cjs.readOwnProperty(bindings, expr.pattern.name);
|
|
6264
6264
|
if (value === void 0) {
|
|
6265
6265
|
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
@@ -6281,8 +6281,8 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
6281
6281
|
return expr;
|
|
6282
6282
|
}
|
|
6283
6283
|
case "between": {
|
|
6284
|
-
const lowerIsParam =
|
|
6285
|
-
const upperIsParam =
|
|
6284
|
+
const lowerIsParam = chunkEZEEWCFJ_cjs.isParameterRef(expr.lower);
|
|
6285
|
+
const upperIsParam = chunkEZEEWCFJ_cjs.isParameterRef(expr.upper);
|
|
6286
6286
|
if (!lowerIsParam && !upperIsParam) return expr;
|
|
6287
6287
|
const lower = lowerIsParam ? toLiteral(resolveBinding(bindings, expr.lower.name)) : expr.lower;
|
|
6288
6288
|
const upper = upperIsParam ? toLiteral(resolveBinding(bindings, expr.upper.name)) : expr.upper;
|
|
@@ -6552,14 +6552,14 @@ function collectParameterMetadataFromAst(ast, accumulator) {
|
|
|
6552
6552
|
function collectParameterMetadataFromExpression(expression, accumulator) {
|
|
6553
6553
|
switch (expression.__type) {
|
|
6554
6554
|
case "comparison": {
|
|
6555
|
-
if (
|
|
6555
|
+
if (chunkEZEEWCFJ_cjs.isParameterRef(expression.right)) {
|
|
6556
6556
|
const name = expression.right.name;
|
|
6557
6557
|
accumulator.names.add(name);
|
|
6558
6558
|
if (isListComparisonOp(expression.op)) {
|
|
6559
6559
|
recordListElementType(
|
|
6560
6560
|
accumulator,
|
|
6561
6561
|
name,
|
|
6562
|
-
|
|
6562
|
+
chunkEZEEWCFJ_cjs.resolveParameterValueType(expression.left, expression.right)
|
|
6563
6563
|
);
|
|
6564
6564
|
} else {
|
|
6565
6565
|
accumulator.scalarParameters.add(name);
|
|
@@ -6568,7 +6568,7 @@ function collectParameterMetadataFromExpression(expression, accumulator) {
|
|
|
6568
6568
|
return;
|
|
6569
6569
|
}
|
|
6570
6570
|
case "string_op": {
|
|
6571
|
-
if (
|
|
6571
|
+
if (chunkEZEEWCFJ_cjs.isParameterRef(expression.pattern)) {
|
|
6572
6572
|
accumulator.names.add(expression.pattern.name);
|
|
6573
6573
|
accumulator.scalarParameters.add(expression.pattern.name);
|
|
6574
6574
|
accumulator.stringOpParameters.add(expression.pattern.name);
|
|
@@ -6577,7 +6577,7 @@ function collectParameterMetadataFromExpression(expression, accumulator) {
|
|
|
6577
6577
|
}
|
|
6578
6578
|
case "between": {
|
|
6579
6579
|
for (const bound of [expression.lower, expression.upper]) {
|
|
6580
|
-
if (
|
|
6580
|
+
if (chunkEZEEWCFJ_cjs.isParameterRef(bound)) {
|
|
6581
6581
|
accumulator.names.add(bound.name);
|
|
6582
6582
|
accumulator.scalarParameters.add(bound.name);
|
|
6583
6583
|
}
|
|
@@ -7132,10 +7132,10 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7132
7132
|
}
|
|
7133
7133
|
}
|
|
7134
7134
|
const orderSpec = isSystem ? {
|
|
7135
|
-
field:
|
|
7135
|
+
field: chunkEZEEWCFJ_cjs.fieldRef(alias, [field2], { valueType: "string" }),
|
|
7136
7136
|
direction
|
|
7137
7137
|
} : {
|
|
7138
|
-
field:
|
|
7138
|
+
field: chunkEZEEWCFJ_cjs.fieldRef(alias, ["props"], {
|
|
7139
7139
|
jsonPointer: chunkA7J2YDDI_cjs.jsonPointer([field2]),
|
|
7140
7140
|
valueType: typeInfo?.valueType,
|
|
7141
7141
|
elementType: typeInfo?.elementType
|
|
@@ -7352,7 +7352,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7352
7352
|
}
|
|
7353
7353
|
#executeOnBackend(backend, promise, surface) {
|
|
7354
7354
|
if (this.#state.recordedAsOf === void 0) return promise;
|
|
7355
|
-
return
|
|
7355
|
+
return chunkSIT26LAZ_cjs.withRecordedRelationsPrecondition(promise, {
|
|
7356
7356
|
dialect: backend.dialect,
|
|
7357
7357
|
surface
|
|
7358
7358
|
});
|
|
@@ -7651,9 +7651,9 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7651
7651
|
add(traversal.edgeAlias);
|
|
7652
7652
|
}
|
|
7653
7653
|
return result.toSorted((a, b) => {
|
|
7654
|
-
const aliasCompare =
|
|
7654
|
+
const aliasCompare = chunkEZEEWCFJ_cjs.compareStrings(a.alias, b.alias);
|
|
7655
7655
|
if (aliasCompare !== 0) return aliasCompare;
|
|
7656
|
-
return
|
|
7656
|
+
return chunkEZEEWCFJ_cjs.compareStrings(a.field, b.field);
|
|
7657
7657
|
});
|
|
7658
7658
|
}
|
|
7659
7659
|
async #tryOptimizedPaginate(cursorData, direction, pageLimit, fetchLimit, cursor, isBackward) {
|
|
@@ -8246,12 +8246,12 @@ function createDynamicFieldBuilder(introspector, alias, name, kindNames, entity)
|
|
|
8246
8246
|
if (typeInfo === void 0) {
|
|
8247
8247
|
throw new Error(`Property "${name}" is not declared on ${where}.`);
|
|
8248
8248
|
}
|
|
8249
|
-
const ref =
|
|
8249
|
+
const ref = chunkEZEEWCFJ_cjs.fieldRef(alias, ["props"], {
|
|
8250
8250
|
jsonPointer: chunkA7J2YDDI_cjs.jsonPointer([name]),
|
|
8251
8251
|
valueType: typeInfo.valueType,
|
|
8252
8252
|
elementType: typeInfo.elementType
|
|
8253
8253
|
});
|
|
8254
|
-
const base =
|
|
8254
|
+
const base = chunkEZEEWCFJ_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
8255
8255
|
const expect = (asserted) => {
|
|
8256
8256
|
if (typeInfo.valueType !== asserted) {
|
|
8257
8257
|
throw new TypeError(
|
|
@@ -8427,17 +8427,17 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8427
8427
|
(kind) => !this.#edgeKinds.includes(kind)
|
|
8428
8428
|
)
|
|
8429
8429
|
];
|
|
8430
|
-
const idAccessor =
|
|
8431
|
-
|
|
8430
|
+
const idAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
8431
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8432
8432
|
);
|
|
8433
|
-
const kindAccessor =
|
|
8434
|
-
|
|
8433
|
+
const kindAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
8434
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8435
8435
|
);
|
|
8436
|
-
const fromIdAccessor =
|
|
8437
|
-
|
|
8436
|
+
const fromIdAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
8437
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
8438
8438
|
);
|
|
8439
|
-
const toIdAccessor =
|
|
8440
|
-
|
|
8439
|
+
const toIdAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
8440
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
8441
8441
|
);
|
|
8442
8442
|
const buildFieldAccessor = (propertyName) => {
|
|
8443
8443
|
const typeInfo = this.#config.schemaIntrospector.getSharedEdgeFieldTypeInfo(
|
|
@@ -8446,34 +8446,34 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8446
8446
|
);
|
|
8447
8447
|
const valueType = typeInfo?.valueType;
|
|
8448
8448
|
const elementType = typeInfo?.elementType;
|
|
8449
|
-
const ref =
|
|
8449
|
+
const ref = chunkEZEEWCFJ_cjs.fieldRef(alias, ["props"], {
|
|
8450
8450
|
jsonPointer: chunkA7J2YDDI_cjs.jsonPointer([propertyName]),
|
|
8451
8451
|
valueType,
|
|
8452
8452
|
elementType
|
|
8453
8453
|
});
|
|
8454
8454
|
switch (valueType) {
|
|
8455
8455
|
case "string": {
|
|
8456
|
-
return
|
|
8456
|
+
return chunkEZEEWCFJ_cjs.stringField(ref);
|
|
8457
8457
|
}
|
|
8458
8458
|
case "number": {
|
|
8459
|
-
return
|
|
8459
|
+
return chunkEZEEWCFJ_cjs.numberField(ref);
|
|
8460
8460
|
}
|
|
8461
8461
|
case "boolean": {
|
|
8462
|
-
return
|
|
8462
|
+
return chunkEZEEWCFJ_cjs.baseField(ref);
|
|
8463
8463
|
}
|
|
8464
8464
|
case "date": {
|
|
8465
|
-
return
|
|
8465
|
+
return chunkEZEEWCFJ_cjs.dateField(ref);
|
|
8466
8466
|
}
|
|
8467
8467
|
case "array": {
|
|
8468
|
-
return
|
|
8468
|
+
return chunkEZEEWCFJ_cjs.arrayField(ref);
|
|
8469
8469
|
}
|
|
8470
8470
|
case "object": {
|
|
8471
|
-
return
|
|
8471
|
+
return chunkEZEEWCFJ_cjs.objectField(ref);
|
|
8472
8472
|
}
|
|
8473
8473
|
case "embedding":
|
|
8474
8474
|
case "unknown":
|
|
8475
8475
|
case void 0: {
|
|
8476
|
-
return
|
|
8476
|
+
return chunkEZEEWCFJ_cjs.baseField(ref);
|
|
8477
8477
|
}
|
|
8478
8478
|
}
|
|
8479
8479
|
};
|
|
@@ -8623,39 +8623,39 @@ function buildNodeFields(alias) {
|
|
|
8623
8623
|
return [
|
|
8624
8624
|
{
|
|
8625
8625
|
outputName: `${alias}_id`,
|
|
8626
|
-
source:
|
|
8626
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["id"])
|
|
8627
8627
|
},
|
|
8628
8628
|
{
|
|
8629
8629
|
outputName: `${alias}_kind`,
|
|
8630
|
-
source:
|
|
8630
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["kind"])
|
|
8631
8631
|
},
|
|
8632
8632
|
{
|
|
8633
8633
|
outputName: `${alias}_props`,
|
|
8634
|
-
source:
|
|
8634
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["props"])
|
|
8635
8635
|
},
|
|
8636
8636
|
{
|
|
8637
8637
|
outputName: `${alias}_version`,
|
|
8638
|
-
source:
|
|
8638
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["version"])
|
|
8639
8639
|
},
|
|
8640
8640
|
{
|
|
8641
8641
|
outputName: `${alias}_valid_from`,
|
|
8642
|
-
source:
|
|
8642
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["valid_from"])
|
|
8643
8643
|
},
|
|
8644
8644
|
{
|
|
8645
8645
|
outputName: `${alias}_valid_to`,
|
|
8646
|
-
source:
|
|
8646
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["valid_to"])
|
|
8647
8647
|
},
|
|
8648
8648
|
{
|
|
8649
8649
|
outputName: `${alias}_created_at`,
|
|
8650
|
-
source:
|
|
8650
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["created_at"])
|
|
8651
8651
|
},
|
|
8652
8652
|
{
|
|
8653
8653
|
outputName: `${alias}_updated_at`,
|
|
8654
|
-
source:
|
|
8654
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["updated_at"])
|
|
8655
8655
|
},
|
|
8656
8656
|
{
|
|
8657
8657
|
outputName: `${alias}_deleted_at`,
|
|
8658
|
-
source:
|
|
8658
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(alias, ["deleted_at"])
|
|
8659
8659
|
}
|
|
8660
8660
|
];
|
|
8661
8661
|
}
|
|
@@ -8664,52 +8664,52 @@ function buildEdgeFields(edgeAlias, nodeCteAlias) {
|
|
|
8664
8664
|
return [
|
|
8665
8665
|
{
|
|
8666
8666
|
outputName: `${edgeAlias}_id`,
|
|
8667
|
-
source:
|
|
8667
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["id"]),
|
|
8668
8668
|
cteAlias
|
|
8669
8669
|
},
|
|
8670
8670
|
{
|
|
8671
8671
|
outputName: `${edgeAlias}_kind`,
|
|
8672
|
-
source:
|
|
8672
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["kind"]),
|
|
8673
8673
|
cteAlias
|
|
8674
8674
|
},
|
|
8675
8675
|
{
|
|
8676
8676
|
outputName: `${edgeAlias}_from_id`,
|
|
8677
|
-
source:
|
|
8677
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["from_id"]),
|
|
8678
8678
|
cteAlias
|
|
8679
8679
|
},
|
|
8680
8680
|
{
|
|
8681
8681
|
outputName: `${edgeAlias}_to_id`,
|
|
8682
|
-
source:
|
|
8682
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["to_id"]),
|
|
8683
8683
|
cteAlias
|
|
8684
8684
|
},
|
|
8685
8685
|
{
|
|
8686
8686
|
outputName: `${edgeAlias}_props`,
|
|
8687
|
-
source:
|
|
8687
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["props"]),
|
|
8688
8688
|
cteAlias
|
|
8689
8689
|
},
|
|
8690
8690
|
{
|
|
8691
8691
|
outputName: `${edgeAlias}_valid_from`,
|
|
8692
|
-
source:
|
|
8692
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["valid_from"]),
|
|
8693
8693
|
cteAlias
|
|
8694
8694
|
},
|
|
8695
8695
|
{
|
|
8696
8696
|
outputName: `${edgeAlias}_valid_to`,
|
|
8697
|
-
source:
|
|
8697
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["valid_to"]),
|
|
8698
8698
|
cteAlias
|
|
8699
8699
|
},
|
|
8700
8700
|
{
|
|
8701
8701
|
outputName: `${edgeAlias}_created_at`,
|
|
8702
|
-
source:
|
|
8702
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["created_at"]),
|
|
8703
8703
|
cteAlias
|
|
8704
8704
|
},
|
|
8705
8705
|
{
|
|
8706
8706
|
outputName: `${edgeAlias}_updated_at`,
|
|
8707
|
-
source:
|
|
8707
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["updated_at"]),
|
|
8708
8708
|
cteAlias
|
|
8709
8709
|
},
|
|
8710
8710
|
{
|
|
8711
8711
|
outputName: `${edgeAlias}_deleted_at`,
|
|
8712
|
-
source:
|
|
8712
|
+
source: chunkEZEEWCFJ_cjs.fieldRef(edgeAlias, ["deleted_at"]),
|
|
8713
8713
|
cteAlias
|
|
8714
8714
|
}
|
|
8715
8715
|
];
|
|
@@ -8739,15 +8739,15 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8739
8739
|
if (sealedCoordinate !== void 0) {
|
|
8740
8740
|
const coordinate2 = sealedCoordinate;
|
|
8741
8741
|
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
8742
|
-
`.temporal() is not available on a StoreView query \u2014 the view's temporal coordinate (${
|
|
8742
|
+
`.temporal() is not available on a StoreView query \u2014 the view's temporal coordinate (${chunk2QGYQBS2_cjs.describeCoordinate(coordinate2)}) is sealed. Re-coordinate on the live Store via store.query() or store.view(...).`,
|
|
8743
8743
|
{
|
|
8744
8744
|
code: "STORE_VIEW_SEALED_QUERY",
|
|
8745
|
-
...
|
|
8745
|
+
...chunk2QGYQBS2_cjs.coordinateContext(coordinate2),
|
|
8746
8746
|
requestedMode: mode
|
|
8747
8747
|
}
|
|
8748
8748
|
);
|
|
8749
8749
|
}
|
|
8750
|
-
const coordinate =
|
|
8750
|
+
const coordinate = chunk2QGYQBS2_cjs.resolveReadCoordinate(
|
|
8751
8751
|
mode,
|
|
8752
8752
|
asOf,
|
|
8753
8753
|
`Use .temporal("asOf", "2024-01-15T10:00:00.000Z") or .temporal("current") for current time.`
|
|
@@ -9040,10 +9040,10 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9040
9040
|
field2
|
|
9041
9041
|
) : this.#getOrderByTypeInfo(alias, field2);
|
|
9042
9042
|
const orderSpec = isSystem ? {
|
|
9043
|
-
field:
|
|
9043
|
+
field: chunkEZEEWCFJ_cjs.fieldRef(alias, [field2], { valueType: "string" }),
|
|
9044
9044
|
direction
|
|
9045
9045
|
} : {
|
|
9046
|
-
field:
|
|
9046
|
+
field: chunkEZEEWCFJ_cjs.fieldRef(alias, ["props"], {
|
|
9047
9047
|
jsonPointer: chunkA7J2YDDI_cjs.jsonPointer([field2]),
|
|
9048
9048
|
valueType: typeInfo?.valueType,
|
|
9049
9049
|
elementType: typeInfo?.elementType
|
|
@@ -9219,7 +9219,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9219
9219
|
kindNames,
|
|
9220
9220
|
property
|
|
9221
9221
|
) : void 0;
|
|
9222
|
-
const ref =
|
|
9222
|
+
const ref = chunkEZEEWCFJ_cjs.fieldRef(alias, ["props"], {
|
|
9223
9223
|
jsonPointer: chunkA7J2YDDI_cjs.jsonPointer([property]),
|
|
9224
9224
|
valueType: typeInfo?.valueType,
|
|
9225
9225
|
elementType: typeInfo?.elementType
|
|
@@ -9227,17 +9227,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9227
9227
|
return this.#buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
9228
9228
|
}
|
|
9229
9229
|
#buildFieldBuilderForTypeInfo(ref, typeInfo) {
|
|
9230
|
-
return
|
|
9230
|
+
return chunkEZEEWCFJ_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
9231
9231
|
}
|
|
9232
9232
|
#createNodeAccessor(alias) {
|
|
9233
9233
|
const kindNames = this.#getKindNamesForAlias(alias);
|
|
9234
|
-
const idAccessor =
|
|
9235
|
-
|
|
9234
|
+
const idAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
9235
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
9236
9236
|
);
|
|
9237
|
-
const kindAccessor =
|
|
9238
|
-
|
|
9237
|
+
const kindAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
9238
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
9239
9239
|
);
|
|
9240
|
-
const fulltextAccessor =
|
|
9240
|
+
const fulltextAccessor = chunkEZEEWCFJ_cjs.createFulltextAccessor(
|
|
9241
9241
|
alias,
|
|
9242
9242
|
() => this.#hasSearchableField(kindNames)
|
|
9243
9243
|
);
|
|
@@ -9331,7 +9331,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9331
9331
|
edgeKindNames,
|
|
9332
9332
|
property
|
|
9333
9333
|
) : void 0;
|
|
9334
|
-
const ref =
|
|
9334
|
+
const ref = chunkEZEEWCFJ_cjs.fieldRef(alias, ["props"], {
|
|
9335
9335
|
jsonPointer: chunkA7J2YDDI_cjs.jsonPointer([property]),
|
|
9336
9336
|
valueType: typeInfo?.valueType,
|
|
9337
9337
|
elementType: typeInfo?.elementType
|
|
@@ -9340,17 +9340,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9340
9340
|
}
|
|
9341
9341
|
#createEdgeAccessor(alias) {
|
|
9342
9342
|
const edgeKindNames = this.#getEdgeKindNamesForAlias(alias);
|
|
9343
|
-
const idAccessor =
|
|
9344
|
-
|
|
9343
|
+
const idAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
9344
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
9345
9345
|
);
|
|
9346
|
-
const kindAccessor =
|
|
9347
|
-
|
|
9346
|
+
const kindAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
9347
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
9348
9348
|
);
|
|
9349
|
-
const fromIdAccessor =
|
|
9350
|
-
|
|
9349
|
+
const fromIdAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
9350
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
9351
9351
|
);
|
|
9352
|
-
const toIdAccessor =
|
|
9353
|
-
|
|
9352
|
+
const toIdAccessor = chunkEZEEWCFJ_cjs.stringField(
|
|
9353
|
+
chunkEZEEWCFJ_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
9354
9354
|
);
|
|
9355
9355
|
if (this.#state.dynamicEdgeAliases.has(alias)) {
|
|
9356
9356
|
return {
|
|
@@ -9393,7 +9393,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9393
9393
|
// src/query/builder/unionable-query.ts
|
|
9394
9394
|
function executeOnBackend(backend, recordedAsOf, promise, surface) {
|
|
9395
9395
|
if (recordedAsOf === void 0) return promise;
|
|
9396
|
-
return
|
|
9396
|
+
return chunkSIT26LAZ_cjs.withRecordedRelationsPrecondition(promise, {
|
|
9397
9397
|
dialect: backend.dialect,
|
|
9398
9398
|
surface
|
|
9399
9399
|
});
|
|
@@ -9936,7 +9936,7 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
|
|
|
9936
9936
|
return runFulltextRebuild(
|
|
9937
9937
|
{
|
|
9938
9938
|
read: backend,
|
|
9939
|
-
runPage: (write) =>
|
|
9939
|
+
runPage: (write) => chunk5PRKMB24_cjs.runOptionallyInTransaction(backend, write)
|
|
9940
9940
|
},
|
|
9941
9941
|
ctx,
|
|
9942
9942
|
nodeKind,
|
|
@@ -10065,7 +10065,7 @@ function processPage(schema, rows) {
|
|
|
10065
10065
|
}
|
|
10066
10066
|
let parsed;
|
|
10067
10067
|
try {
|
|
10068
|
-
parsed =
|
|
10068
|
+
parsed = chunk5PRKMB24_cjs.rowPropsToObject(row.props);
|
|
10069
10069
|
} catch {
|
|
10070
10070
|
skipped += 1;
|
|
10071
10071
|
skippedIds.push(row.id);
|
|
@@ -10076,7 +10076,7 @@ function processPage(schema, rows) {
|
|
|
10076
10076
|
skippedIds.push(row.id);
|
|
10077
10077
|
continue;
|
|
10078
10078
|
}
|
|
10079
|
-
const computed =
|
|
10079
|
+
const computed = chunk3KOY4FH3_cjs.computeFulltextContent(schema, parsed);
|
|
10080
10080
|
if (computed === void 0) {
|
|
10081
10081
|
toDelete.push(row.id);
|
|
10082
10082
|
} else {
|
|
@@ -10157,7 +10157,7 @@ async function fetchNodesForRows(backend, graphId, rows) {
|
|
|
10157
10157
|
function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
|
|
10158
10158
|
const nodeType = ctx.registry.getNodeType(nodeKind);
|
|
10159
10159
|
if (nodeType === void 0) return void 0;
|
|
10160
|
-
const fields =
|
|
10160
|
+
const fields = chunk3KOY4FH3_cjs.getEmbeddingFields(nodeType.schema);
|
|
10161
10161
|
const field2 = fields.find((entry2) => entry2.fieldPath === fieldPath);
|
|
10162
10162
|
if (field2 === void 0) return void 0;
|
|
10163
10163
|
return {
|
|
@@ -10223,7 +10223,7 @@ async function executeFulltextSearch(ctx, nodeKind, options) {
|
|
|
10223
10223
|
})
|
|
10224
10224
|
);
|
|
10225
10225
|
const merged = singleKind ? chunkN66HCGCY_cjs.requireDefined(perKindRows[0]) : perKindRows.flat().toSorted(
|
|
10226
|
-
(a, b) => b.score - a.score ||
|
|
10226
|
+
(a, b) => b.score - a.score || chunkEZEEWCFJ_cjs.compareCodePoints(a.kind, b.kind) || chunkEZEEWCFJ_cjs.compareCodePoints(a.nodeId, b.nodeId)
|
|
10227
10227
|
).slice(offset, offset + options.limit);
|
|
10228
10228
|
if (merged.length === 0) return [];
|
|
10229
10229
|
const nodeMap = await fetchNodesForRows(backend, graphId, merged);
|
|
@@ -10348,12 +10348,12 @@ function resolveVectorSearchKinds(ctx, nodeKind, fieldPath, includeSubClasses, l
|
|
|
10348
10348
|
function mergeVectorRows(perKindRows, metric) {
|
|
10349
10349
|
const descending = scoreDescending(metric);
|
|
10350
10350
|
return perKindRows.flat().toSorted(
|
|
10351
|
-
(a, b) => (descending ? b.score - a.score : a.score - b.score) ||
|
|
10351
|
+
(a, b) => (descending ? b.score - a.score : a.score - b.score) || chunkEZEEWCFJ_cjs.compareCodePoints(a.kind, b.kind) || chunkEZEEWCFJ_cjs.compareCodePoints(a.nodeId, b.nodeId)
|
|
10352
10352
|
);
|
|
10353
10353
|
}
|
|
10354
10354
|
function mergeFulltextRows(perKindRows) {
|
|
10355
10355
|
return perKindRows.flat().toSorted(
|
|
10356
|
-
(a, b) => b.score - a.score ||
|
|
10356
|
+
(a, b) => b.score - a.score || chunkEZEEWCFJ_cjs.compareCodePoints(a.kind, b.kind) || chunkEZEEWCFJ_cjs.compareCodePoints(a.nodeId, b.nodeId)
|
|
10357
10357
|
);
|
|
10358
10358
|
}
|
|
10359
10359
|
async function executeHybridSearch(ctx, nodeKind, options) {
|
|
@@ -10467,7 +10467,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
|
|
|
10467
10467
|
...candidates === void 0 ? {} : { candidates }
|
|
10468
10468
|
});
|
|
10469
10469
|
return rows.map((row, index) => {
|
|
10470
|
-
const typedNode =
|
|
10470
|
+
const typedNode = chunkJB6T4GLL_cjs.rowToNode(row.node);
|
|
10471
10471
|
return {
|
|
10472
10472
|
node: typedNode,
|
|
10473
10473
|
score: row.fusedScore,
|
|
@@ -10580,7 +10580,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
|
|
|
10580
10580
|
fused.set(key, entry2);
|
|
10581
10581
|
}
|
|
10582
10582
|
const ranked = [...fused.values()].toSorted(
|
|
10583
|
-
(a, b) => b.fusedScore - a.fusedScore ||
|
|
10583
|
+
(a, b) => b.fusedScore - a.fusedScore || chunkEZEEWCFJ_cjs.compareCodePoints(a.kind, b.kind) || chunkEZEEWCFJ_cjs.compareCodePoints(a.nodeId, b.nodeId)
|
|
10584
10584
|
).slice(offset, offset + options.limit);
|
|
10585
10585
|
const nodeMap = await fetchNodesForRows(
|
|
10586
10586
|
backend,
|
|
@@ -10731,13 +10731,13 @@ async function fetchNodesByIds(backend, graphId, nodeKind, ids) {
|
|
|
10731
10731
|
const rows = await backend.getNodes(graphId, nodeKind, ids);
|
|
10732
10732
|
for (const row of rows) {
|
|
10733
10733
|
if (row.deleted_at !== void 0) continue;
|
|
10734
|
-
map.set(row.id,
|
|
10734
|
+
map.set(row.id, chunkJB6T4GLL_cjs.rowToNode(row));
|
|
10735
10735
|
}
|
|
10736
10736
|
return map;
|
|
10737
10737
|
}
|
|
10738
10738
|
for (const id of ids) {
|
|
10739
10739
|
const row = await backend.getNode(graphId, nodeKind, id);
|
|
10740
|
-
if (row && row.deleted_at === void 0) map.set(row.id,
|
|
10740
|
+
if (row && row.deleted_at === void 0) map.set(row.id, chunkJB6T4GLL_cjs.rowToNode(row));
|
|
10741
10741
|
}
|
|
10742
10742
|
return map;
|
|
10743
10743
|
}
|
|
@@ -11225,12 +11225,12 @@ function pickTemporalOptions(options) {
|
|
|
11225
11225
|
};
|
|
11226
11226
|
}
|
|
11227
11227
|
function resolveTemporalOptions(ctx, options) {
|
|
11228
|
-
const { valid } =
|
|
11228
|
+
const { valid } = chunk2QGYQBS2_cjs.resolveReadCoordinate(
|
|
11229
11229
|
options.temporalMode ?? ctx.defaultTemporalMode,
|
|
11230
11230
|
options.asOf
|
|
11231
11231
|
);
|
|
11232
11232
|
if (options.recordedAsOf !== void 0) {
|
|
11233
|
-
|
|
11233
|
+
chunk2QGYQBS2_cjs.assertValidRecordedInstant(options.recordedAsOf, "recordedAsOf");
|
|
11234
11234
|
}
|
|
11235
11235
|
return {
|
|
11236
11236
|
temporalMode: valid.mode,
|
|
@@ -11253,9 +11253,9 @@ function resolveTemporalFilter(ctx, options, tableAlias) {
|
|
|
11253
11253
|
asOf: resolved.asOf,
|
|
11254
11254
|
recordedAsOf: resolved.recordedAsOf,
|
|
11255
11255
|
tableAlias,
|
|
11256
|
-
currentTimestamp:
|
|
11256
|
+
currentTimestamp: chunkEZEEWCFJ_cjs.currentReadInstant()
|
|
11257
11257
|
};
|
|
11258
|
-
return
|
|
11258
|
+
return chunkEZEEWCFJ_cjs.compileTemporalFilter(filterOptions);
|
|
11259
11259
|
}
|
|
11260
11260
|
function resolveMaxHops(rawMaxHops, fallback, optionName) {
|
|
11261
11261
|
const value = rawMaxHops ?? fallback;
|
|
@@ -11331,7 +11331,7 @@ async function executeDegree(ctx, nodeId, options = {}) {
|
|
|
11331
11331
|
compileDirectionFilter(ctx, direction, nodeId, schema.nodesTable)
|
|
11332
11332
|
];
|
|
11333
11333
|
if (options.edges !== void 0) {
|
|
11334
|
-
whereClauses.push(
|
|
11334
|
+
whereClauses.push(chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("kind"), options.edges));
|
|
11335
11335
|
}
|
|
11336
11336
|
const countExpr = direction === "both" ? chunkEDN4Y4ZG_cjs.sql`COUNT(DISTINCT id)` : chunkEDN4Y4ZG_cjs.sql`COUNT(*)`;
|
|
11337
11337
|
const query = chunkEDN4Y4ZG_cjs.sql`SELECT ${countExpr} AS count FROM ${schema.edgesTable} WHERE ${chunkEDN4Y4ZG_cjs.sql.join(whereClauses, chunkEDN4Y4ZG_cjs.sql` AND `)}`;
|
|
@@ -11412,11 +11412,11 @@ async function seedWorkingTableFromNodes(context, nodeKinds, seedColumns) {
|
|
|
11412
11412
|
return;
|
|
11413
11413
|
}
|
|
11414
11414
|
const normalizedKinds = [...new Set(nodeKinds)].toSorted(
|
|
11415
|
-
(left, right) =>
|
|
11415
|
+
(left, right) => chunkEZEEWCFJ_cjs.compareCodePoints(left, right)
|
|
11416
11416
|
);
|
|
11417
11417
|
for (const kindChunk of chunkValues(normalizedKinds, kindBindBudget)) {
|
|
11418
11418
|
await context.executeTemporary(
|
|
11419
|
-
compileSeedStatement(
|
|
11419
|
+
compileSeedStatement(chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("n.kind"), kindChunk))
|
|
11420
11420
|
);
|
|
11421
11421
|
}
|
|
11422
11422
|
}
|
|
@@ -11479,7 +11479,7 @@ async function runIterativeGraphOperation(ctx, options, plan) {
|
|
|
11479
11479
|
const transactionOptions = {
|
|
11480
11480
|
isolationLevel: "repeatable_read",
|
|
11481
11481
|
accessMode: "read_only",
|
|
11482
|
-
temporaryWrites:
|
|
11482
|
+
temporaryWrites: chunk5PRKMB24_cjs.INTERNAL_TEMPORARY_WRITES
|
|
11483
11483
|
};
|
|
11484
11484
|
const rounds = { started: false };
|
|
11485
11485
|
try {
|
|
@@ -11489,7 +11489,7 @@ async function runIterativeGraphOperation(ctx, options, plan) {
|
|
|
11489
11489
|
}, transactionOptions);
|
|
11490
11490
|
} catch (error) {
|
|
11491
11491
|
if (rounds.started || ctx.backend.dialect !== "postgres") throw error;
|
|
11492
|
-
const sqlState =
|
|
11492
|
+
const sqlState = chunkSIT26LAZ_cjs.postgresReadWriteRefusedSqlState(error);
|
|
11493
11493
|
if (sqlState === void 0) throw error;
|
|
11494
11494
|
throw temporaryTableCapabilityError(ctx, plan.algorithm, sqlState, error);
|
|
11495
11495
|
}
|
|
@@ -11515,7 +11515,7 @@ function temporaryTableCapabilityError(ctx, algorithm, sqlState, cause) {
|
|
|
11515
11515
|
}
|
|
11516
11516
|
async function runWorkingTableRounds(ctx, options, plan, backend) {
|
|
11517
11517
|
const temporaryBackend = requireTemporaryStatements(backend);
|
|
11518
|
-
const runId =
|
|
11518
|
+
const runId = chunkEZEEWCFJ_cjs.generateId();
|
|
11519
11519
|
const workingTable = chunkEDN4Y4ZG_cjs.sql.identifier(
|
|
11520
11520
|
`typegraph_iterative_${runId.replaceAll("-", "_")}`
|
|
11521
11521
|
);
|
|
@@ -11542,7 +11542,7 @@ async function runWorkingTableRounds(ctx, options, plan, backend) {
|
|
|
11542
11542
|
try {
|
|
11543
11543
|
await context.executeTemporary(plan.createWorkingTable(context));
|
|
11544
11544
|
} catch (error) {
|
|
11545
|
-
const sqlState = ctx.backend.dialect === "postgres" ?
|
|
11545
|
+
const sqlState = ctx.backend.dialect === "postgres" ? chunkSIT26LAZ_cjs.postgresTemporaryTableUnavailableSqlState(error) : void 0;
|
|
11546
11546
|
if (sqlState === void 0) throw error;
|
|
11547
11547
|
throw temporaryTableCapabilityError(ctx, plan.algorithm, sqlState, error);
|
|
11548
11548
|
}
|
|
@@ -11618,7 +11618,7 @@ async function cleanupWorkingTables(context, cleanup, operationFailure) {
|
|
|
11618
11618
|
async function fetchVisibleWorkingNodes(operation, nodeIds) {
|
|
11619
11619
|
const nodes = /* @__PURE__ */ new Map();
|
|
11620
11620
|
for (const chunk2 of chunkValues(nodeIds, operation.maxWorkingSetSize)) {
|
|
11621
|
-
const query = chunkEDN4Y4ZG_cjs.sql`SELECT n.id, n.kind FROM ${operation.schema.nodesTable} n WHERE n.graph_id = ${operation.ctx.graphId} AND n.id IN (${
|
|
11621
|
+
const query = chunkEDN4Y4ZG_cjs.sql`SELECT n.id, n.kind FROM ${operation.schema.nodesTable} n WHERE n.graph_id = ${operation.ctx.graphId} AND n.id IN (${chunkEZEEWCFJ_cjs.sqlValueList(chunk2)}) AND ${operation.nodeTemporalFilter}`;
|
|
11622
11622
|
const rows = await operation.backend.execute(
|
|
11623
11623
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(query)
|
|
11624
11624
|
);
|
|
@@ -11665,7 +11665,7 @@ function nodeIdentityKeyFromRow(id, kind) {
|
|
|
11665
11665
|
return nodeIdentityKey({ id, kind });
|
|
11666
11666
|
}
|
|
11667
11667
|
function compareNodeIdentity(left, right) {
|
|
11668
|
-
return
|
|
11668
|
+
return chunkEZEEWCFJ_cjs.compareCodePoints(left.id, right.id) || chunkEZEEWCFJ_cjs.compareCodePoints(left.kind, right.kind);
|
|
11669
11669
|
}
|
|
11670
11670
|
var OUTGOING_DIRECTION_FIELDS = {
|
|
11671
11671
|
joinField: "from_id",
|
|
@@ -11765,7 +11765,7 @@ function compileDirectionalExpansion(operation, workingRelation, sourceFilter, e
|
|
|
11765
11765
|
return chunkEDN4Y4ZG_cjs.sql`SELECT expanded.source_id, expanded.source_kind, n.id AS target_id, n.kind AS target_kind${weightColumn} FROM (${edgeExpansion}) expanded JOIN ${operation.schema.nodesTable} n ON n.graph_id = ${operation.ctx.graphId} AND n.id = expanded.target_id AND n.kind = expanded.target_kind WHERE ${operation.nodeTemporalFilter}`;
|
|
11766
11766
|
}
|
|
11767
11767
|
function compileDirectionalEdgeExpansion(operation, workingRelation, sourceFilter, edgeKinds, joinField, joinKindField, targetField, targetKindField, sourceProjection) {
|
|
11768
|
-
const edgeKindFilter =
|
|
11768
|
+
const edgeKindFilter = chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("e.kind"), edgeKinds);
|
|
11769
11769
|
const weightColumn = operation.weightExpression === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`, ${operation.weightExpression} AS weight`;
|
|
11770
11770
|
const sourceColumns = sourceProjection === void 0 ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`, ${sourceProjection}`;
|
|
11771
11771
|
return chunkEDN4Y4ZG_cjs.sql`SELECT w.node_id AS source_id, w.node_kind AS source_kind${sourceColumns}, e.${chunkEDN4Y4ZG_cjs.sql.raw(targetField)} AS target_id, e.${chunkEDN4Y4ZG_cjs.sql.raw(targetKindField)} AS target_kind${weightColumn} FROM ${workingRelation} w JOIN ${operation.schema.edgesTable} e ON e.${chunkEDN4Y4ZG_cjs.sql.raw(joinField)} = w.node_id AND e.${chunkEDN4Y4ZG_cjs.sql.raw(joinKindField)} = w.node_kind AND e.graph_id = ${operation.ctx.graphId} WHERE ${sourceFilter} AND ${edgeKindFilter} AND ${operation.edgeTemporalFilter}`;
|
|
@@ -11779,15 +11779,15 @@ function chunkValues(values, chunkSize) {
|
|
|
11779
11779
|
}
|
|
11780
11780
|
function createOperation(ctx, options, backend) {
|
|
11781
11781
|
const temporal = resolveTemporalOptions(ctx, options);
|
|
11782
|
-
const currentTimestamp =
|
|
11783
|
-
const nodeTemporalFilter =
|
|
11782
|
+
const currentTimestamp = chunkEZEEWCFJ_cjs.currentReadInstant();
|
|
11783
|
+
const nodeTemporalFilter = chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
11784
11784
|
mode: temporal.temporalMode,
|
|
11785
11785
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
11786
11786
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
11787
11787
|
tableAlias: "n",
|
|
11788
11788
|
currentTimestamp
|
|
11789
11789
|
});
|
|
11790
|
-
const edgeTemporalFilter =
|
|
11790
|
+
const edgeTemporalFilter = chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
11791
11791
|
mode: temporal.temporalMode,
|
|
11792
11792
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
11793
11793
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
@@ -11814,7 +11814,7 @@ function createOperation(ctx, options, backend) {
|
|
|
11814
11814
|
}
|
|
11815
11815
|
const edgeKindChunks = chunkValues(
|
|
11816
11816
|
[...new Set(options.edges)].toSorted(
|
|
11817
|
-
(left, right) =>
|
|
11817
|
+
(left, right) => chunkEZEEWCFJ_cjs.compareStrings(left, right)
|
|
11818
11818
|
),
|
|
11819
11819
|
maxEdgeKindsPerQuery
|
|
11820
11820
|
);
|
|
@@ -13412,7 +13412,7 @@ async function assertValidEdgeWeights(operation, weightProperty, defaultWeight)
|
|
|
13412
13412
|
const negativeViolation = chunkEDN4Y4ZG_cjs.sql`audited.is_number = 1 AND audited.weight_number < 0`;
|
|
13413
13413
|
const outOfRangeViolation = chunkEDN4Y4ZG_cjs.sql`audited.is_number = 1 AND (ABS(audited.weight_number) > CAST(${MAX_EDGE_WEIGHT} AS NUMERIC) OR (audited.weight_number <> 0 AND ABS(audited.weight_number) < CAST(${MIN_EDGE_WEIGHT} AS NUMERIC)))`;
|
|
13414
13414
|
for (const edgeKinds of operation.edgeKindChunks) {
|
|
13415
|
-
const edgeKindFilter =
|
|
13415
|
+
const edgeKindFilter = chunkEZEEWCFJ_cjs.compileKindFilter(chunkEDN4Y4ZG_cjs.sql.raw("e.kind"), edgeKinds);
|
|
13416
13416
|
const rows = await operation.backend.execute(
|
|
13417
13417
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
13418
13418
|
SELECT audited.edge_id, audited.edge_kind, audited.weight_text,
|
|
@@ -13972,31 +13972,31 @@ function windowFieldChanges(requested, stored) {
|
|
|
13972
13972
|
if (requested === void 0) {
|
|
13973
13973
|
return false;
|
|
13974
13974
|
}
|
|
13975
|
-
if (!
|
|
13975
|
+
if (!chunkTQHGE7UC_cjs.isCanonicalIsoDate(requested)) {
|
|
13976
13976
|
return true;
|
|
13977
13977
|
}
|
|
13978
|
-
return !
|
|
13978
|
+
return !chunkTQHGE7UC_cjs.statedBoundMatchesStored(requested, stored);
|
|
13979
13979
|
}
|
|
13980
13980
|
function lowerBoundRequiresWrite(requested, stored) {
|
|
13981
13981
|
const requestedValidFrom = requested?.validFrom;
|
|
13982
|
-
if (!
|
|
13982
|
+
if (!chunkTQHGE7UC_cjs.preservesImmutableLowerBound(requested?.onImmutableLowerBound)) {
|
|
13983
13983
|
return windowFieldChanges(requestedValidFrom, stored);
|
|
13984
13984
|
}
|
|
13985
|
-
return requestedValidFrom !== void 0 && !
|
|
13985
|
+
return requestedValidFrom !== void 0 && !chunkTQHGE7UC_cjs.isCanonicalIsoDate(requestedValidFrom);
|
|
13986
13986
|
}
|
|
13987
13987
|
function upsertWindowChanges(requested, current) {
|
|
13988
|
-
return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true &&
|
|
13988
|
+
return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true && chunkJB6T4GLL_cjs.validityEndAfterMutation(requested, current.valid_to) !== current.valid_to || requested?.clearValidTo === true && requested.validTo !== void 0 || windowFieldChanges(requested?.validTo, current.valid_to);
|
|
13989
13989
|
}
|
|
13990
13990
|
function windowAfterUpsertCreate(requested) {
|
|
13991
13991
|
return {
|
|
13992
13992
|
valid_from: requested.validFrom,
|
|
13993
|
-
valid_to:
|
|
13993
|
+
valid_to: chunkJB6T4GLL_cjs.validityEndAfterMutation(requested, void 0)
|
|
13994
13994
|
};
|
|
13995
13995
|
}
|
|
13996
13996
|
function windowAfterUpsertUpdate(current, requested) {
|
|
13997
13997
|
return {
|
|
13998
13998
|
valid_from: current.valid_from,
|
|
13999
|
-
valid_to:
|
|
13999
|
+
valid_to: chunkJB6T4GLL_cjs.validityEndAfterMutation(requested, current.valid_to)
|
|
14000
14000
|
};
|
|
14001
14001
|
}
|
|
14002
14002
|
function shouldCoalesceUpsert(existing, options, runDirtyCheck) {
|
|
@@ -14056,10 +14056,10 @@ function buildUpsertUpdateEdgeInput(kind, id, from, to, props, options) {
|
|
|
14056
14056
|
return input;
|
|
14057
14057
|
}
|
|
14058
14058
|
function endpointKey(endpointKind, id) {
|
|
14059
|
-
return
|
|
14059
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([endpointKind, id]);
|
|
14060
14060
|
}
|
|
14061
14061
|
function groupEndpointIdsByKind(references) {
|
|
14062
|
-
const referencesByKind =
|
|
14062
|
+
const referencesByKind = chunkSIT26LAZ_cjs.groupBy(references, (ref) => ref.kind);
|
|
14063
14063
|
return new Map(
|
|
14064
14064
|
[...referencesByKind].map(([endpointKind, group]) => [
|
|
14065
14065
|
endpointKind,
|
|
@@ -14200,7 +14200,7 @@ function createEdgeCollection(config) {
|
|
|
14200
14200
|
},
|
|
14201
14201
|
async getByIds(ids, options) {
|
|
14202
14202
|
if (ids.length === 0) return [];
|
|
14203
|
-
const rowsById = await
|
|
14203
|
+
const rowsById = await chunkEZEEWCFJ_cjs.getEdgeRowsByIds(backend, graphId, ids);
|
|
14204
14204
|
const matches = temporalRowMatcher(options);
|
|
14205
14205
|
return ids.map((id) => {
|
|
14206
14206
|
const row = rowsById.get(id);
|
|
@@ -14307,18 +14307,18 @@ function createEdgeCollection(config) {
|
|
|
14307
14307
|
async bulkUpsertById(items) {
|
|
14308
14308
|
if (items.length === 0) return [];
|
|
14309
14309
|
for (const item of items) {
|
|
14310
|
-
|
|
14310
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(item, {
|
|
14311
14311
|
entityType: "edge",
|
|
14312
14312
|
kind,
|
|
14313
14313
|
id: item.id
|
|
14314
14314
|
});
|
|
14315
14315
|
if (item.clearValidTo === true) {
|
|
14316
|
-
|
|
14316
|
+
chunkJB6T4GLL_cjs.assertClearValidToSupported(backend, "edge");
|
|
14317
14317
|
}
|
|
14318
14318
|
}
|
|
14319
14319
|
const upsertAll = async (target) => {
|
|
14320
14320
|
const ids = items.map((item) => item.id);
|
|
14321
|
-
const existingMap = await
|
|
14321
|
+
const existingMap = await chunkEZEEWCFJ_cjs.getEdgeRowsByIds(target, graphId, ids);
|
|
14322
14322
|
const results2 = Array.from({ length: items.length });
|
|
14323
14323
|
const toCreate = [];
|
|
14324
14324
|
const toUpdate = [];
|
|
@@ -14384,7 +14384,7 @@ function createEdgeCollection(config) {
|
|
|
14384
14384
|
actualIdentity,
|
|
14385
14385
|
"update"
|
|
14386
14386
|
);
|
|
14387
|
-
const currentProps = pendingEntry === void 0 ?
|
|
14387
|
+
const currentProps = pendingEntry === void 0 ? chunk5PRKMB24_cjs.rowPropsToObject(chunkN66HCGCY_cjs.requireDefined(original).props) : pendingEntry.props;
|
|
14388
14388
|
const dirty = currentProps === void 0 ? void 0 : runDirtyCheck(
|
|
14389
14389
|
original?.kind ?? kind,
|
|
14390
14390
|
item.id,
|
|
@@ -14452,7 +14452,7 @@ function createEdgeCollection(config) {
|
|
|
14452
14452
|
}
|
|
14453
14453
|
return { results: results2, mutations: toCreate.length + toUpdate.length };
|
|
14454
14454
|
};
|
|
14455
|
-
const { results, mutations } = await
|
|
14455
|
+
const { results, mutations } = await chunk5PRKMB24_cjs.runOptionallyInTransaction(
|
|
14456
14456
|
backend,
|
|
14457
14457
|
(target) => upsertAll(target)
|
|
14458
14458
|
);
|
|
@@ -14488,7 +14488,7 @@ function createEdgeCollection(config) {
|
|
|
14488
14488
|
return result === void 0 ? void 0 : narrowEdge(result);
|
|
14489
14489
|
},
|
|
14490
14490
|
async getOrCreateByEndpoints(from, to, props, options) {
|
|
14491
|
-
|
|
14491
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(options ?? {}, {
|
|
14492
14492
|
entityType: "edge",
|
|
14493
14493
|
kind
|
|
14494
14494
|
});
|
|
@@ -14523,7 +14523,7 @@ function createEdgeCollection(config) {
|
|
|
14523
14523
|
async bulkGetOrCreateByEndpoints(items, options) {
|
|
14524
14524
|
if (items.length === 0) return [];
|
|
14525
14525
|
for (const item of items) {
|
|
14526
|
-
|
|
14526
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(item, {
|
|
14527
14527
|
entityType: "edge",
|
|
14528
14528
|
kind
|
|
14529
14529
|
});
|
|
@@ -14675,7 +14675,7 @@ function createNodeCollection(config) {
|
|
|
14675
14675
|
},
|
|
14676
14676
|
async getByIds(ids, options) {
|
|
14677
14677
|
if (ids.length === 0) return [];
|
|
14678
|
-
const rowsById = await
|
|
14678
|
+
const rowsById = await chunkEZEEWCFJ_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
|
|
14679
14679
|
const matches = temporalRowMatcher(options);
|
|
14680
14680
|
return ids.map((id) => {
|
|
14681
14681
|
const row = rowsById.get(id);
|
|
@@ -14706,7 +14706,7 @@ function createNodeCollection(config) {
|
|
|
14706
14706
|
);
|
|
14707
14707
|
}
|
|
14708
14708
|
const rootAlias = "update_candidate";
|
|
14709
|
-
const readInstant =
|
|
14709
|
+
const readInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
14710
14710
|
let base = createQuery().fromDynamic(kind, rootAlias).temporal("asOf", readInstant);
|
|
14711
14711
|
const where = params.where;
|
|
14712
14712
|
if (where !== void 0) {
|
|
@@ -14816,25 +14816,25 @@ function createNodeCollection(config) {
|
|
|
14816
14816
|
return this.upsertByIdFromRecord(id, props, options);
|
|
14817
14817
|
},
|
|
14818
14818
|
async upsertByIdFromRecord(id, data, options) {
|
|
14819
|
-
|
|
14819
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(options ?? {}, {
|
|
14820
14820
|
entityType: "node",
|
|
14821
14821
|
kind,
|
|
14822
14822
|
id
|
|
14823
14823
|
});
|
|
14824
14824
|
if (options?.clearValidTo === true) {
|
|
14825
|
-
|
|
14825
|
+
chunkJB6T4GLL_cjs.assertClearValidToSupported(backend, "node");
|
|
14826
14826
|
}
|
|
14827
14827
|
const existing = await backend.getNode(graphId, kind, id);
|
|
14828
14828
|
const coalesces = (row) => {
|
|
14829
14829
|
const runDirtyCheck = config.upsertDirtyCheck && (() => chunkN66HCGCY_cjs.requireDefined(config.upsertDirtyCheck)(
|
|
14830
14830
|
kind,
|
|
14831
14831
|
id,
|
|
14832
|
-
|
|
14832
|
+
chunk5PRKMB24_cjs.rowPropsToObject(row.props),
|
|
14833
14833
|
data
|
|
14834
14834
|
));
|
|
14835
14835
|
return shouldCoalesceUpsert(row, options, runDirtyCheck);
|
|
14836
14836
|
};
|
|
14837
|
-
const decision = existing !== void 0 && coalesces(existing) ? await
|
|
14837
|
+
const decision = existing !== void 0 && coalesces(existing) ? await chunk5PRKMB24_cjs.runOptionallyInTransaction(
|
|
14838
14838
|
backend,
|
|
14839
14839
|
async (target) => {
|
|
14840
14840
|
const confirmed = await target.getNode(graphId, kind, id);
|
|
@@ -14874,13 +14874,13 @@ function createNodeCollection(config) {
|
|
|
14874
14874
|
async bulkUpsertById(items) {
|
|
14875
14875
|
if (items.length === 0) return [];
|
|
14876
14876
|
for (const item of items) {
|
|
14877
|
-
|
|
14877
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(item, {
|
|
14878
14878
|
entityType: "node",
|
|
14879
14879
|
kind,
|
|
14880
14880
|
id: item.id
|
|
14881
14881
|
});
|
|
14882
14882
|
if (item.clearValidTo === true) {
|
|
14883
|
-
|
|
14883
|
+
chunkJB6T4GLL_cjs.assertClearValidToSupported(backend, "node");
|
|
14884
14884
|
}
|
|
14885
14885
|
}
|
|
14886
14886
|
const upsertAll = async (target) => {
|
|
@@ -14931,7 +14931,7 @@ function createNodeCollection(config) {
|
|
|
14931
14931
|
continue;
|
|
14932
14932
|
}
|
|
14933
14933
|
const deletedAt = pendingEntry === void 0 ? chunkN66HCGCY_cjs.requireDefined(original).deleted_at : void 0;
|
|
14934
|
-
const currentProps = pendingEntry === void 0 ?
|
|
14934
|
+
const currentProps = pendingEntry === void 0 ? chunk5PRKMB24_cjs.rowPropsToObject(chunkN66HCGCY_cjs.requireDefined(original).props) : pendingEntry.props;
|
|
14935
14935
|
const dirty = currentProps === void 0 ? void 0 : runDirtyCheck(item.id, currentProps, item.props);
|
|
14936
14936
|
const currentWindow = pendingEntry === void 0 ? {
|
|
14937
14937
|
valid_from: chunkN66HCGCY_cjs.requireDefined(original).valid_from,
|
|
@@ -14986,7 +14986,7 @@ function createNodeCollection(config) {
|
|
|
14986
14986
|
}
|
|
14987
14987
|
return { results: results2, mutations: toCreate.length + toUpdate.length };
|
|
14988
14988
|
};
|
|
14989
|
-
const { results, mutations } = await
|
|
14989
|
+
const { results, mutations } = await chunk5PRKMB24_cjs.runOptionallyInTransaction(
|
|
14990
14990
|
backend,
|
|
14991
14991
|
(target) => upsertAll(target)
|
|
14992
14992
|
);
|
|
@@ -15226,15 +15226,13 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
15226
15226
|
"verifyContributions"
|
|
15227
15227
|
];
|
|
15228
15228
|
function createHistoryStoreBackendProjection(backend) {
|
|
15229
|
-
return Object.freeze(
|
|
15230
|
-
chunkOIFSOPSR_cjs.projectBackendMembers(backend, HISTORY_STORE_BACKEND_KEYS)
|
|
15231
|
-
);
|
|
15229
|
+
return Object.freeze(chunkSIT26LAZ_cjs.projectBackend(backend, HISTORY_STORE_BACKEND_KEYS));
|
|
15232
15230
|
}
|
|
15233
15231
|
|
|
15234
15232
|
// src/store/introspect.ts
|
|
15235
15233
|
function introspectSchema(graph, context) {
|
|
15236
15234
|
const extension = graph.extension;
|
|
15237
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
15235
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunk3FPR224C_cjs.extensionKindNames(extension);
|
|
15238
15236
|
const deprecated = graph.deprecatedKinds;
|
|
15239
15237
|
const kinds = [];
|
|
15240
15238
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
@@ -15245,7 +15243,7 @@ function introspectSchema(graph, context) {
|
|
|
15245
15243
|
description: reg.type.description,
|
|
15246
15244
|
annotations: reg.type.annotations,
|
|
15247
15245
|
deprecated: deprecated.has(name),
|
|
15248
|
-
properties:
|
|
15246
|
+
properties: chunk3FPR224C_cjs.serializeSchemaProperties(reg.type.schema),
|
|
15249
15247
|
unique: (reg.unique ?? []).map((constraint) => ({
|
|
15250
15248
|
name: constraint.name,
|
|
15251
15249
|
fields: [...constraint.fields],
|
|
@@ -15266,17 +15264,17 @@ function introspectSchema(graph, context) {
|
|
|
15266
15264
|
to: reg.to.map((entry2) => entry2.kind),
|
|
15267
15265
|
cardinality: reg.cardinality ?? "many",
|
|
15268
15266
|
endpointExistence: reg.endpointExistence ?? "notDeleted",
|
|
15269
|
-
properties:
|
|
15267
|
+
properties: chunk3FPR224C_cjs.serializeSchemaProperties(edgeType.schema),
|
|
15270
15268
|
annotations: edgeType.annotations,
|
|
15271
15269
|
deprecated: deprecated.has(name)
|
|
15272
15270
|
});
|
|
15273
15271
|
}
|
|
15274
|
-
const runtimeOntologyKeys =
|
|
15272
|
+
const runtimeOntologyKeys = chunk3FPR224C_cjs.buildGraphExtensionOntologyKeySet(extension);
|
|
15275
15273
|
const ontology = graph.ontology.map((relation) => ({
|
|
15276
15274
|
metaEdge: relation.metaEdge.name,
|
|
15277
15275
|
from: chunk26YKDNUD_cjs.getTypeName(relation.from),
|
|
15278
15276
|
to: chunk26YKDNUD_cjs.getTypeName(relation.to),
|
|
15279
|
-
origin: runtimeOntologyKeys.has(
|
|
15277
|
+
origin: runtimeOntologyKeys.has(chunk3FPR224C_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
|
|
15280
15278
|
}));
|
|
15281
15279
|
return {
|
|
15282
15280
|
graphId: context.graphId,
|
|
@@ -15360,7 +15358,7 @@ async function ensureTrigramExtension(backend) {
|
|
|
15360
15358
|
try {
|
|
15361
15359
|
await executeDdl(TRIGRAM_EXTENSION_DDL);
|
|
15362
15360
|
} catch (error) {
|
|
15363
|
-
if (!
|
|
15361
|
+
if (!chunkSIT26LAZ_cjs.isPostgresConcurrentDdlRaceError(error)) throw error;
|
|
15364
15362
|
await executeDdl(TRIGRAM_EXTENSION_DDL);
|
|
15365
15363
|
}
|
|
15366
15364
|
}
|
|
@@ -15602,7 +15600,7 @@ async function materializeOne(declaration, backend, graphId, schemaVersion, acti
|
|
|
15602
15600
|
}
|
|
15603
15601
|
try {
|
|
15604
15602
|
await run();
|
|
15605
|
-
const attemptedAt =
|
|
15603
|
+
const attemptedAt = chunkTQHGE7UC_cjs.nowIso();
|
|
15606
15604
|
await recordIndexMaterialization(
|
|
15607
15605
|
buildAttempt({
|
|
15608
15606
|
declaration,
|
|
@@ -15663,7 +15661,7 @@ async function materializeWithClaim(declaration, backend, graphId, schemaVersion
|
|
|
15663
15661
|
const recordIndexMaterialization = chunkN66HCGCY_cjs.requireDefined(
|
|
15664
15662
|
backend.recordIndexMaterialization
|
|
15665
15663
|
);
|
|
15666
|
-
const token = `${statusKey}:${
|
|
15664
|
+
const token = `${statusKey}:${chunkTQHGE7UC_cjs.nowIso()}:${Math.floor(performance.now() * 1e3)}`;
|
|
15667
15665
|
const deadline = Date.now() + CLAIM_WAIT_TIMEOUT_MS;
|
|
15668
15666
|
for (; ; ) {
|
|
15669
15667
|
const claimed = await chunkN66HCGCY_cjs.requireDefined(backend.claimIndexMaterialization)({
|
|
@@ -15715,7 +15713,7 @@ async function materializeWithClaim(declaration, backend, graphId, schemaVersion
|
|
|
15715
15713
|
}
|
|
15716
15714
|
try {
|
|
15717
15715
|
await run();
|
|
15718
|
-
const attemptedAt =
|
|
15716
|
+
const attemptedAt = chunkTQHGE7UC_cjs.nowIso();
|
|
15719
15717
|
await recordIndexMaterialization(
|
|
15720
15718
|
buildAttempt({
|
|
15721
15719
|
declaration,
|
|
@@ -15792,7 +15790,7 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
15792
15790
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
15793
15791
|
SELECT c.relname AS name
|
|
15794
15792
|
FROM pg_class c
|
|
15795
|
-
WHERE c.relname IN (${
|
|
15793
|
+
WHERE c.relname IN (${chunkEZEEWCFJ_cjs.sqlValueList(tableNames)})
|
|
15796
15794
|
AND c.relkind IN ('r', 'p')
|
|
15797
15795
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
15798
15796
|
`)
|
|
@@ -15805,7 +15803,7 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
15805
15803
|
SELECT name
|
|
15806
15804
|
FROM sqlite_master
|
|
15807
15805
|
WHERE type = 'table'
|
|
15808
|
-
AND name IN (${
|
|
15806
|
+
AND name IN (${chunkEZEEWCFJ_cjs.sqlValueList(tableNames)})
|
|
15809
15807
|
`)
|
|
15810
15808
|
);
|
|
15811
15809
|
return new Set(rows.map((row) => row.name));
|
|
@@ -15826,7 +15824,7 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
15826
15824
|
SELECT c.relname AS name, i.indisvalid AS valid
|
|
15827
15825
|
FROM pg_class c
|
|
15828
15826
|
JOIN pg_index i ON i.indexrelid = c.oid
|
|
15829
|
-
WHERE c.relname IN (${
|
|
15827
|
+
WHERE c.relname IN (${chunkEZEEWCFJ_cjs.sqlValueList(physicalIndexNames)})
|
|
15830
15828
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
15831
15829
|
`)
|
|
15832
15830
|
);
|
|
@@ -15839,7 +15837,7 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
15839
15837
|
SELECT name
|
|
15840
15838
|
FROM sqlite_master
|
|
15841
15839
|
WHERE type = 'index'
|
|
15842
|
-
AND name IN (${
|
|
15840
|
+
AND name IN (${chunkEZEEWCFJ_cjs.sqlValueList(physicalIndexNames)})
|
|
15843
15841
|
`)
|
|
15844
15842
|
);
|
|
15845
15843
|
for (const row of rows) valid.add(row.name);
|
|
@@ -15903,7 +15901,7 @@ function buildAttempt(args) {
|
|
|
15903
15901
|
kind: args.declaration.kind,
|
|
15904
15902
|
signature: args.signature,
|
|
15905
15903
|
schemaVersion: args.schemaVersion,
|
|
15906
|
-
attemptedAt: args.attemptedAt ??
|
|
15904
|
+
attemptedAt: args.attemptedAt ?? chunkTQHGE7UC_cjs.nowIso(),
|
|
15907
15905
|
materializedAt: args.materializedAt,
|
|
15908
15906
|
error: args.error?.message
|
|
15909
15907
|
};
|
|
@@ -16027,7 +16025,7 @@ async function computeIndexSignature(dialect, targetTableName, declaration) {
|
|
|
16027
16025
|
const hashable = {
|
|
16028
16026
|
dialect,
|
|
16029
16027
|
targetTableName,
|
|
16030
|
-
declaration:
|
|
16028
|
+
declaration: chunk3FPR224C_cjs.serializeIndexDeclaration(declaration)
|
|
16031
16029
|
};
|
|
16032
16030
|
const json = JSON.stringify(hashable, chunkPWLJ77UV_cjs.sortedReplacer);
|
|
16033
16031
|
return chunkZY4GXIVN_cjs.sha256Hex(json, 16);
|
|
@@ -16049,7 +16047,7 @@ async function materializeRemovals(context, options = {}) {
|
|
|
16049
16047
|
await ensureFocusedStatusTable(backend, backend.ensureKindRemovalsTable);
|
|
16050
16048
|
await reconcilePendingRemovals(context);
|
|
16051
16049
|
const activeRow = await backend.getActiveSchema(graphId);
|
|
16052
|
-
const activeSchema = activeRow === void 0 ? void 0 :
|
|
16050
|
+
const activeSchema = activeRow === void 0 ? void 0 : chunk3FPR224C_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
16053
16051
|
const reclaimedVectorFields = await reclaimRemovedVectorFieldTables(
|
|
16054
16052
|
context,
|
|
16055
16053
|
activeRow
|
|
@@ -16116,14 +16114,14 @@ async function reconcilePendingRemovals(context) {
|
|
|
16116
16114
|
const reconciliations = [];
|
|
16117
16115
|
const stopAtVersion = marker ?? 1;
|
|
16118
16116
|
let currentRow = activeRow;
|
|
16119
|
-
let currentSchema =
|
|
16117
|
+
let currentSchema = chunk3FPR224C_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
16120
16118
|
while (currentRow.version > stopAtVersion) {
|
|
16121
16119
|
const priorRow = await backend.getSchemaVersion(
|
|
16122
16120
|
graphId,
|
|
16123
16121
|
currentRow.version - 1
|
|
16124
16122
|
);
|
|
16125
16123
|
if (priorRow === void 0) break;
|
|
16126
|
-
const priorSchema =
|
|
16124
|
+
const priorSchema = chunk3FPR224C_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
16127
16125
|
for (const entity of ENTITY_KINDS) {
|
|
16128
16126
|
const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
|
|
16129
16127
|
const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
|
|
@@ -16143,7 +16141,7 @@ async function reconcilePendingRemovals(context) {
|
|
|
16143
16141
|
currentSchema = priorSchema;
|
|
16144
16142
|
}
|
|
16145
16143
|
if (reconciliations.length > 0) {
|
|
16146
|
-
const attemptedAt =
|
|
16144
|
+
const attemptedAt = chunkTQHGE7UC_cjs.nowIso();
|
|
16147
16145
|
await Promise.all(
|
|
16148
16146
|
reconciliations.map(
|
|
16149
16147
|
(entry2) => recordKindRemoval(
|
|
@@ -16188,7 +16186,7 @@ async function materializeOne2(row, ctx) {
|
|
|
16188
16186
|
ctx.graphId,
|
|
16189
16187
|
async (target) => {
|
|
16190
16188
|
const activeRow = await target.getActiveSchema(ctx.graphId);
|
|
16191
|
-
const activeSchema = activeRow === void 0 ? void 0 :
|
|
16189
|
+
const activeSchema = activeRow === void 0 ? void 0 : chunk3FPR224C_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
16192
16190
|
if (liveKindNamesFrom(activeSchema)[row.entity].has(row.kindName)) {
|
|
16193
16191
|
return "skipped";
|
|
16194
16192
|
}
|
|
@@ -16205,7 +16203,7 @@ async function materializeOne2(row, ctx) {
|
|
|
16205
16203
|
reason: "kind-is-live"
|
|
16206
16204
|
};
|
|
16207
16205
|
}
|
|
16208
|
-
const removedAt =
|
|
16206
|
+
const removedAt = chunkTQHGE7UC_cjs.nowIso();
|
|
16209
16207
|
await recordKindRemoval({
|
|
16210
16208
|
graphId: ctx.graphId,
|
|
16211
16209
|
kindName: row.kindName,
|
|
@@ -16227,7 +16225,7 @@ async function materializeOne2(row, ctx) {
|
|
|
16227
16225
|
kindName: row.kindName,
|
|
16228
16226
|
entity: row.entity,
|
|
16229
16227
|
schemaVersion: row.schemaVersion,
|
|
16230
|
-
attemptedAt:
|
|
16228
|
+
attemptedAt: chunkTQHGE7UC_cjs.nowIso(),
|
|
16231
16229
|
removedAt: void 0,
|
|
16232
16230
|
error: error.message
|
|
16233
16231
|
});
|
|
@@ -16258,7 +16256,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
|
|
|
16258
16256
|
await executeDeleteStatements(target, deleteStatements);
|
|
16259
16257
|
return;
|
|
16260
16258
|
}
|
|
16261
|
-
await
|
|
16259
|
+
await chunkEZEEWCFJ_cjs.closeRecordedHardDeletedKind(
|
|
16262
16260
|
target,
|
|
16263
16261
|
recordedSchema,
|
|
16264
16262
|
ctx.graphId,
|
|
@@ -16304,7 +16302,7 @@ async function dropVectorSlotStorage(strategy, executeDdl, slot) {
|
|
|
16304
16302
|
await executeDdl(ddl);
|
|
16305
16303
|
}
|
|
16306
16304
|
} catch (error) {
|
|
16307
|
-
if (!
|
|
16305
|
+
if (!chunkSIT26LAZ_cjs.isMissingTableError(error)) throw error;
|
|
16308
16306
|
}
|
|
16309
16307
|
}
|
|
16310
16308
|
async function resolveRemovedKindEmbeddingSlots(backend, row) {
|
|
@@ -16312,7 +16310,7 @@ async function resolveRemovedKindEmbeddingSlots(backend, row) {
|
|
|
16312
16310
|
if (priorVersion < 1) return [];
|
|
16313
16311
|
const priorRow = await backend.getSchemaVersion(row.graphId, priorVersion);
|
|
16314
16312
|
if (priorRow === void 0) return [];
|
|
16315
|
-
const priorSchema =
|
|
16313
|
+
const priorSchema = chunk3FPR224C_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
16316
16314
|
const slots = /* @__PURE__ */ new Map();
|
|
16317
16315
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
16318
16316
|
if (declaration.entity === "vector" && declaration.kind === row.kindName) {
|
|
@@ -16349,14 +16347,14 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
|
|
|
16349
16347
|
let perBackend = reclaimCache.get(backend);
|
|
16350
16348
|
const cached = perBackend?.get(cacheKey);
|
|
16351
16349
|
if (cached !== void 0) return cached;
|
|
16352
|
-
const activeSchema =
|
|
16350
|
+
const activeSchema = chunk3FPR224C_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
16353
16351
|
const activeVectorFields = vectorFieldKeysFrom(activeSchema);
|
|
16354
16352
|
const survivingKinds = new Set(Object.keys(activeSchema.nodes));
|
|
16355
16353
|
const historical = /* @__PURE__ */ new Map();
|
|
16356
16354
|
for (let version = activeRow.version - 1; version >= 1; version -= 1) {
|
|
16357
16355
|
const priorRow = await backend.getSchemaVersion(graphId, version);
|
|
16358
16356
|
if (priorRow === void 0) continue;
|
|
16359
|
-
const priorSchema =
|
|
16357
|
+
const priorSchema = chunk3FPR224C_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
16360
16358
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
16361
16359
|
if (declaration.entity !== "vector") continue;
|
|
16362
16360
|
const key = vectorFieldKey(declaration.kind, declaration.fieldPath);
|
|
@@ -16394,7 +16392,7 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
|
|
|
16394
16392
|
async (target) => {
|
|
16395
16393
|
const lockedActiveRow = await target.getActiveSchema(graphId);
|
|
16396
16394
|
if (lockedActiveRow === void 0) return false;
|
|
16397
|
-
const lockedActiveSchema =
|
|
16395
|
+
const lockedActiveSchema = chunk3FPR224C_cjs.parseSerializedSchema(
|
|
16398
16396
|
lockedActiveRow.schema_doc
|
|
16399
16397
|
);
|
|
16400
16398
|
const lockedVectorFields = vectorFieldKeysFrom(lockedActiveSchema);
|
|
@@ -16455,17 +16453,17 @@ function getEdgeRegistration(graph, kind) {
|
|
|
16455
16453
|
return registration;
|
|
16456
16454
|
}
|
|
16457
16455
|
function buildEdgeEndpointCacheKey(graphId, kind, id) {
|
|
16458
|
-
return
|
|
16456
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([graphId, kind, id]);
|
|
16459
16457
|
}
|
|
16460
16458
|
function buildEdgeFromCacheKey(graphId, edgeKind, fromKind, fromId) {
|
|
16461
|
-
return
|
|
16459
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([graphId, edgeKind, fromKind, fromId]);
|
|
16462
16460
|
}
|
|
16463
16461
|
function buildEdgeBetweenCacheKey(graphId, edgeKind, fromKind, fromId, toKind, toId) {
|
|
16464
|
-
return
|
|
16462
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([graphId, edgeKind, fromKind, fromId, toKind, toId]);
|
|
16465
16463
|
}
|
|
16466
16464
|
function buildCountEdgesFromCacheKey(params) {
|
|
16467
16465
|
const activeOnly = params.activeOnly === true ? "1" : "0";
|
|
16468
|
-
return
|
|
16466
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([
|
|
16469
16467
|
params.graphId,
|
|
16470
16468
|
params.edgeKind,
|
|
16471
16469
|
params.fromKind,
|
|
@@ -16577,7 +16575,7 @@ function createEdgeBatchValidationBackend(backend) {
|
|
|
16577
16575
|
pendingUniquePairs.add(uniqueCacheKey);
|
|
16578
16576
|
}
|
|
16579
16577
|
}
|
|
16580
|
-
const validationBackend =
|
|
16578
|
+
const validationBackend = chunkSIT26LAZ_cjs.deriveBackend(backend, {
|
|
16581
16579
|
getNode: getNodeCached,
|
|
16582
16580
|
countEdgesFrom: countEdgesFromCached,
|
|
16583
16581
|
edgeExistsBetween: edgeExistsBetweenCached
|
|
@@ -16620,23 +16618,23 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
16620
16618
|
nodeId: input.toId
|
|
16621
16619
|
});
|
|
16622
16620
|
}
|
|
16623
|
-
const validatedProps =
|
|
16621
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateEdgeProps(edgeKind.schema, input.props, {
|
|
16624
16622
|
kind,
|
|
16625
16623
|
operation: "create"
|
|
16626
16624
|
});
|
|
16627
|
-
const validFrom =
|
|
16625
|
+
const validFrom = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
16628
16626
|
input.validFrom,
|
|
16629
16627
|
"validFrom"
|
|
16630
16628
|
);
|
|
16631
|
-
const validTo =
|
|
16632
|
-
|
|
16629
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
16630
|
+
chunkTQHGE7UC_cjs.assertOrderedValidityWindow(`edge "${id}"`, validFrom, validTo);
|
|
16633
16631
|
const cardinality = registration.cardinality ?? "many";
|
|
16634
16632
|
const constraintContext = {
|
|
16635
16633
|
graphId: ctx.graphId,
|
|
16636
16634
|
registry: ctx.registry,
|
|
16637
16635
|
backend
|
|
16638
16636
|
};
|
|
16639
|
-
await
|
|
16637
|
+
await chunkJB6T4GLL_cjs.checkCardinalityConstraint(
|
|
16640
16638
|
constraintContext,
|
|
16641
16639
|
kind,
|
|
16642
16640
|
cardinality,
|
|
@@ -16676,11 +16674,11 @@ var EdgeConvergenceRaced = class extends Error {
|
|
|
16676
16674
|
};
|
|
16677
16675
|
async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
16678
16676
|
const kind = input.kind;
|
|
16679
|
-
const id = input.id ??
|
|
16677
|
+
const id = input.id ?? chunkEZEEWCFJ_cjs.generateId();
|
|
16680
16678
|
const opContext = ctx.createOperationContext("create", "edge", kind, id);
|
|
16681
16679
|
const shouldReturnRow = options?.returnRow ?? true;
|
|
16682
16680
|
const convergeOn = options?.convergeOn;
|
|
16683
|
-
return
|
|
16681
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(
|
|
16684
16682
|
ctx,
|
|
16685
16683
|
opContext,
|
|
16686
16684
|
backend,
|
|
@@ -16711,21 +16709,21 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
16711
16709
|
id,
|
|
16712
16710
|
target
|
|
16713
16711
|
);
|
|
16714
|
-
const row = await
|
|
16712
|
+
const row = await chunkJB6T4GLL_cjs.withAlreadyExistsTranslation("edge", async () => {
|
|
16715
16713
|
if (shouldReturnRow) return target.insertEdge(prepared.insertParams);
|
|
16716
|
-
await
|
|
16717
|
-
|
|
16714
|
+
await chunkEZEEWCFJ_cjs.runInsertNoReturn(
|
|
16715
|
+
chunkEZEEWCFJ_cjs.edgeInsertDispatch(target),
|
|
16718
16716
|
prepared.insertParams
|
|
16719
16717
|
);
|
|
16720
16718
|
return;
|
|
16721
16719
|
});
|
|
16722
|
-
return row === void 0 ? void 0 :
|
|
16720
|
+
return row === void 0 ? void 0 : chunkJB6T4GLL_cjs.rowToEdge(row);
|
|
16723
16721
|
},
|
|
16724
16722
|
{
|
|
16725
16723
|
// A create that runs a cardinality probe, or one converging on a match
|
|
16726
16724
|
// key, decides something the write must not have invalidated. A plain
|
|
16727
16725
|
// `many` create decides nothing and takes no lock.
|
|
16728
|
-
fencesConstraintProbe: convergeOn === void 0 ?
|
|
16726
|
+
fencesConstraintProbe: convergeOn === void 0 ? chunkJB6T4GLL_cjs.edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
|
|
16729
16727
|
}
|
|
16730
16728
|
);
|
|
16731
16729
|
}
|
|
@@ -16771,7 +16769,7 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
|
|
|
16771
16769
|
await primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow);
|
|
16772
16770
|
const preparedCreates = [];
|
|
16773
16771
|
for (const input of inputs) {
|
|
16774
|
-
const id = input.id ??
|
|
16772
|
+
const id = input.id ?? chunkEZEEWCFJ_cjs.generateId();
|
|
16775
16773
|
const prepared = await validateAndPrepareEdgeCreate(
|
|
16776
16774
|
ctx,
|
|
16777
16775
|
input,
|
|
@@ -16793,7 +16791,7 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
16793
16791
|
if (inputs.length === 0) {
|
|
16794
16792
|
return;
|
|
16795
16793
|
}
|
|
16796
|
-
await
|
|
16794
|
+
await chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
16797
16795
|
ctx,
|
|
16798
16796
|
backend,
|
|
16799
16797
|
async (target) => {
|
|
@@ -16802,9 +16800,9 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
16802
16800
|
inputs,
|
|
16803
16801
|
target
|
|
16804
16802
|
);
|
|
16805
|
-
await
|
|
16803
|
+
await chunkJB6T4GLL_cjs.withAlreadyExistsTranslation(
|
|
16806
16804
|
"edge",
|
|
16807
|
-
() =>
|
|
16805
|
+
() => chunkEZEEWCFJ_cjs.runInsertBatch(chunkEZEEWCFJ_cjs.edgeInsertDispatch(target), batchInsertParams)
|
|
16808
16806
|
);
|
|
16809
16807
|
},
|
|
16810
16808
|
{ fencesConstraintProbe: batchFencesConstraintProbe(ctx, inputs) }
|
|
@@ -16814,7 +16812,7 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
|
16814
16812
|
if (inputs.length === 0) {
|
|
16815
16813
|
return [];
|
|
16816
16814
|
}
|
|
16817
|
-
return
|
|
16815
|
+
return chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
16818
16816
|
ctx,
|
|
16819
16817
|
backend,
|
|
16820
16818
|
async (target) => {
|
|
@@ -16823,18 +16821,18 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
|
16823
16821
|
inputs,
|
|
16824
16822
|
target
|
|
16825
16823
|
);
|
|
16826
|
-
const rows = await
|
|
16824
|
+
const rows = await chunkJB6T4GLL_cjs.withAlreadyExistsTranslation(
|
|
16827
16825
|
"edge",
|
|
16828
|
-
() =>
|
|
16826
|
+
() => chunkEZEEWCFJ_cjs.runInsertBatchReturning(chunkEZEEWCFJ_cjs.edgeInsertDispatch(target), batchInsertParams)
|
|
16829
16827
|
);
|
|
16830
|
-
return rows.map((row) =>
|
|
16828
|
+
return rows.map((row) => chunkJB6T4GLL_cjs.rowToEdge(row));
|
|
16831
16829
|
},
|
|
16832
16830
|
{ fencesConstraintProbe: batchFencesConstraintProbe(ctx, inputs) }
|
|
16833
16831
|
);
|
|
16834
16832
|
}
|
|
16835
16833
|
function batchFencesConstraintProbe(ctx, inputs) {
|
|
16836
16834
|
for (const input of inputs) {
|
|
16837
|
-
const reason =
|
|
16835
|
+
const reason = chunkJB6T4GLL_cjs.edgeWriteNeedsConstraintFence(
|
|
16838
16836
|
edgeCardinality(ctx, input.kind)
|
|
16839
16837
|
);
|
|
16840
16838
|
if (reason !== void 0) return reason;
|
|
@@ -16843,14 +16841,14 @@ function batchFencesConstraintProbe(ctx, inputs) {
|
|
|
16843
16841
|
}
|
|
16844
16842
|
function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
16845
16843
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
16846
|
-
return
|
|
16844
|
+
return chunkJFRT7S3B_cjs.validateEdgeProps(
|
|
16847
16845
|
registration.type.schema,
|
|
16848
16846
|
{ ...existingProps, ...inputProps },
|
|
16849
16847
|
{ kind, operation: "update", id }
|
|
16850
16848
|
);
|
|
16851
16849
|
}
|
|
16852
16850
|
function resolveEdgeUpdateProps(ctx, existing, inputProps) {
|
|
16853
|
-
const existingProps =
|
|
16851
|
+
const existingProps = chunk5PRKMB24_cjs.rowPropsToObject(existing.props);
|
|
16854
16852
|
const validatedProps = computeEdgeUpdate(
|
|
16855
16853
|
ctx,
|
|
16856
16854
|
existing.kind,
|
|
@@ -16875,7 +16873,7 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
|
|
|
16875
16873
|
}
|
|
16876
16874
|
async function performEdgeUpdate(ctx, input, target, options) {
|
|
16877
16875
|
const id = input.id;
|
|
16878
|
-
|
|
16876
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(input, {
|
|
16879
16877
|
entityType: "edge",
|
|
16880
16878
|
kind: input.identity.kind,
|
|
16881
16879
|
id
|
|
@@ -16891,14 +16889,14 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
16891
16889
|
"update"
|
|
16892
16890
|
);
|
|
16893
16891
|
const { validatedProps } = resolveEdgeUpdateProps(ctx, existing, input.props);
|
|
16894
|
-
const statedValidFrom =
|
|
16892
|
+
const statedValidFrom = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
16895
16893
|
input.validFrom,
|
|
16896
16894
|
"validFrom"
|
|
16897
16895
|
);
|
|
16898
|
-
const preservesLiveLowerBound = options?.clearDeleted !== true &&
|
|
16896
|
+
const preservesLiveLowerBound = options?.clearDeleted !== true && chunkTQHGE7UC_cjs.preservesImmutableLowerBound(input.onImmutableLowerBound);
|
|
16899
16897
|
const appliedValidFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
|
|
16900
|
-
const validTo =
|
|
16901
|
-
const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo :
|
|
16898
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
16899
|
+
const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : chunkJB6T4GLL_cjs.validityEndAfterMutation(
|
|
16902
16900
|
input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
|
|
16903
16901
|
existing.valid_to
|
|
16904
16902
|
);
|
|
@@ -16906,7 +16904,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
16906
16904
|
const reentersLivePopulation = options?.clearDeleted === true && existing.deleted_at !== void 0;
|
|
16907
16905
|
const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
|
|
16908
16906
|
if (reentersLivePopulation || reentersActivePopulation) {
|
|
16909
|
-
await
|
|
16907
|
+
await chunkJB6T4GLL_cjs.checkCardinalityConstraint(
|
|
16910
16908
|
{
|
|
16911
16909
|
graphId: ctx.graphId,
|
|
16912
16910
|
registry: ctx.registry,
|
|
@@ -16921,7 +16919,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
16921
16919
|
effectiveValidTo
|
|
16922
16920
|
);
|
|
16923
16921
|
}
|
|
16924
|
-
const windowVerdict =
|
|
16922
|
+
const windowVerdict = chunkTQHGE7UC_cjs.assertWritableValidityWindow(
|
|
16925
16923
|
`edge "${id}"`,
|
|
16926
16924
|
appliedValidFrom,
|
|
16927
16925
|
{
|
|
@@ -16975,7 +16973,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
16975
16973
|
...input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo }
|
|
16976
16974
|
})
|
|
16977
16975
|
);
|
|
16978
|
-
return
|
|
16976
|
+
return chunkJB6T4GLL_cjs.rowToEdge(row);
|
|
16979
16977
|
}
|
|
16980
16978
|
function isEdgeUpdateNoRowError(error) {
|
|
16981
16979
|
return error instanceof chunkMRDBBHIZ_cjs.DatabaseOperationError && error.details.operation === "update" && error.details.entity === "edge" && error.details.reason === "no_row_returned";
|
|
@@ -17039,26 +17037,26 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
17039
17037
|
"update"
|
|
17040
17038
|
);
|
|
17041
17039
|
const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
|
|
17042
|
-
return
|
|
17040
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(
|
|
17043
17041
|
ctx,
|
|
17044
17042
|
opContext,
|
|
17045
17043
|
backend,
|
|
17046
17044
|
(target) => {
|
|
17047
17045
|
if (input.clearValidTo === true) {
|
|
17048
|
-
|
|
17046
|
+
chunkJB6T4GLL_cjs.assertClearValidToSupported(backend, "edge");
|
|
17049
17047
|
}
|
|
17050
17048
|
return performEdgeUpdateConverging(ctx, input, target);
|
|
17051
17049
|
},
|
|
17052
17050
|
{
|
|
17053
|
-
fencesConstraintProbe: input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ?
|
|
17051
|
+
fencesConstraintProbe: input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? chunkJB6T4GLL_cjs.edgeWriteNeedsConstraintFence("oneActive") : void 0
|
|
17054
17052
|
}
|
|
17055
17053
|
);
|
|
17056
17054
|
}
|
|
17057
17055
|
async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
|
|
17058
17056
|
if (input.clearValidTo === true) {
|
|
17059
|
-
|
|
17057
|
+
chunkJB6T4GLL_cjs.assertClearValidToSupported(backend, "edge");
|
|
17060
17058
|
}
|
|
17061
|
-
return
|
|
17059
|
+
return chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
17062
17060
|
ctx,
|
|
17063
17061
|
backend,
|
|
17064
17062
|
async (target) => {
|
|
@@ -17075,11 +17073,11 @@ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options)
|
|
|
17075
17073
|
ctx,
|
|
17076
17074
|
existing.kind,
|
|
17077
17075
|
existing.id,
|
|
17078
|
-
|
|
17076
|
+
chunk5PRKMB24_cjs.rowPropsToObject(existing.props),
|
|
17079
17077
|
input.props
|
|
17080
17078
|
);
|
|
17081
17079
|
if (shouldCoalesceUpsert(existing, input, runDirtyCheck)) {
|
|
17082
|
-
return { edge:
|
|
17080
|
+
return { edge: chunkJB6T4GLL_cjs.rowToEdge(existing), wrote: false };
|
|
17083
17081
|
}
|
|
17084
17082
|
}
|
|
17085
17083
|
}
|
|
@@ -17094,7 +17092,7 @@ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options)
|
|
|
17094
17092
|
{
|
|
17095
17093
|
// An in-place props update re-derives no constraint verdict: endpoints
|
|
17096
17094
|
// are immutable, so cardinality cannot change under it.
|
|
17097
|
-
fencesConstraintProbe: options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ?
|
|
17095
|
+
fencesConstraintProbe: options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? chunkJB6T4GLL_cjs.edgeWriteNeedsConstraintFence(
|
|
17098
17096
|
edgeCardinality(ctx, input.identity.kind)
|
|
17099
17097
|
) : void 0,
|
|
17100
17098
|
didWrite: (outcome) => outcome.wrote
|
|
@@ -17121,7 +17119,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
|
|
|
17121
17119
|
);
|
|
17122
17120
|
if (gate.deleted_at) return;
|
|
17123
17121
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
17124
|
-
return
|
|
17122
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
17125
17123
|
await target.deleteEdge({
|
|
17126
17124
|
graphId: ctx.graphId,
|
|
17127
17125
|
id,
|
|
@@ -17130,7 +17128,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
|
|
|
17130
17128
|
});
|
|
17131
17129
|
}
|
|
17132
17130
|
async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
|
|
17133
|
-
await
|
|
17131
|
+
await chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
17134
17132
|
ctx,
|
|
17135
17133
|
backend,
|
|
17136
17134
|
async (target) => {
|
|
@@ -17167,7 +17165,7 @@ async function executeEdgeHardDelete(ctx, expectedKind, id, backend) {
|
|
|
17167
17165
|
"hardDelete"
|
|
17168
17166
|
);
|
|
17169
17167
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
17170
|
-
return
|
|
17168
|
+
return chunkJFRT7S3B_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
17171
17169
|
await target.hardDeleteEdge({
|
|
17172
17170
|
graphId: ctx.graphId,
|
|
17173
17171
|
id,
|
|
@@ -17221,7 +17219,7 @@ function stableStringify(value) {
|
|
|
17221
17219
|
}
|
|
17222
17220
|
function buildEdgeCompositeKey(fromKind, fromId, toKind, toId, props, matchOn) {
|
|
17223
17221
|
const sortedFields = [...matchOn].toSorted();
|
|
17224
|
-
return
|
|
17222
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([
|
|
17225
17223
|
fromKind,
|
|
17226
17224
|
fromId,
|
|
17227
17225
|
toKind,
|
|
@@ -17233,14 +17231,14 @@ function buildEdgeCompositeKey(fromKind, fromId, toKind, toId, props, matchOn) {
|
|
|
17233
17231
|
]);
|
|
17234
17232
|
}
|
|
17235
17233
|
function buildEndpointPairKey(fromKind, fromId, toKind, toId) {
|
|
17236
|
-
return
|
|
17234
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([fromKind, fromId, toKind, toId]);
|
|
17237
17235
|
}
|
|
17238
17236
|
function findMatchingEdge(rows, matchOn, inputProps) {
|
|
17239
17237
|
let liveRow;
|
|
17240
17238
|
let deletedRow;
|
|
17241
17239
|
for (const row of rows) {
|
|
17242
17240
|
if (matchOn.length > 0) {
|
|
17243
|
-
const rowProps =
|
|
17241
|
+
const rowProps = chunk5PRKMB24_cjs.rowPropsToObject(row.props);
|
|
17244
17242
|
const matches = matchOn.every(
|
|
17245
17243
|
(field2) => stableStringify(chunkN66HCGCY_cjs.readOwnProperty(rowProps, field2)) === stableStringify(chunkN66HCGCY_cjs.readOwnProperty(inputProps, field2))
|
|
17246
17244
|
);
|
|
@@ -17277,12 +17275,12 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
|
|
|
17277
17275
|
...options?.asOf !== void 0 && { asOf: options.asOf }
|
|
17278
17276
|
});
|
|
17279
17277
|
if (candidateRows.length === 0) return void 0;
|
|
17280
|
-
if (matchOn.length === 0) return
|
|
17278
|
+
if (matchOn.length === 0) return chunkJB6T4GLL_cjs.rowToEdge(chunkN66HCGCY_cjs.requireDefined(candidateRows[0]));
|
|
17281
17279
|
const { liveRow } = findMatchingEdge(candidateRows, matchOn, props);
|
|
17282
|
-
return liveRow === void 0 ? void 0 :
|
|
17280
|
+
return liveRow === void 0 ? void 0 : chunkJB6T4GLL_cjs.rowToEdge(liveRow);
|
|
17283
17281
|
}
|
|
17284
17282
|
function defersEndpointWindowOrdering(ifExists, onImmutableLowerBound) {
|
|
17285
|
-
return ifExists === "update" &&
|
|
17283
|
+
return ifExists === "update" && chunkTQHGE7UC_cjs.preservesImmutableLowerBound(onImmutableLowerBound);
|
|
17286
17284
|
}
|
|
17287
17285
|
function assertEndpointClearCanApply(ifExists, clearValidTo, kind) {
|
|
17288
17286
|
if (ifExists !== "return" || clearValidTo !== true) return;
|
|
@@ -17300,22 +17298,22 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
17300
17298
|
const matchOn = options?.matchOn ?? [];
|
|
17301
17299
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
17302
17300
|
const edgeKind = registration.type;
|
|
17303
|
-
|
|
17301
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
|
|
17304
17302
|
if (options?.clearValidTo === true) {
|
|
17305
|
-
|
|
17303
|
+
chunkJB6T4GLL_cjs.assertClearValidToSupported(backend, "edge");
|
|
17306
17304
|
}
|
|
17307
|
-
const validatedProps =
|
|
17305
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateEdgeProps(edgeKind.schema, props, {
|
|
17308
17306
|
kind,
|
|
17309
17307
|
operation: "create"
|
|
17310
17308
|
});
|
|
17311
17309
|
validateMatchOnFields(edgeKind.schema, matchOn, kind);
|
|
17312
|
-
const validFrom =
|
|
17310
|
+
const validFrom = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
17313
17311
|
options?.validFrom,
|
|
17314
17312
|
"validFrom"
|
|
17315
17313
|
);
|
|
17316
|
-
const validTo =
|
|
17314
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(options?.validTo, "validTo");
|
|
17317
17315
|
if (!defersEndpointWindowOrdering(ifExists, options?.onImmutableLowerBound)) {
|
|
17318
|
-
|
|
17316
|
+
chunkTQHGE7UC_cjs.assertOrderedValidityWindow(
|
|
17319
17317
|
`${kind} edge between ${fromKind} "${fromId}" and ${toKind} "${toId}"`,
|
|
17320
17318
|
validFrom,
|
|
17321
17319
|
validTo
|
|
@@ -17339,7 +17337,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
17339
17337
|
);
|
|
17340
17338
|
if (probedLiveRow !== void 0) {
|
|
17341
17339
|
assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
|
|
17342
|
-
return { edge:
|
|
17340
|
+
return { edge: chunkJB6T4GLL_cjs.rowToEdge(probedLiveRow), action: "found" };
|
|
17343
17341
|
}
|
|
17344
17342
|
}
|
|
17345
17343
|
async function attempt() {
|
|
@@ -17384,7 +17382,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
17384
17382
|
if (liveRow !== void 0) {
|
|
17385
17383
|
if (ifExists === "return") {
|
|
17386
17384
|
assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
|
|
17387
|
-
return { edge:
|
|
17385
|
+
return { edge: chunkJB6T4GLL_cjs.rowToEdge(liveRow), action: "found" };
|
|
17388
17386
|
}
|
|
17389
17387
|
const outcome = await executeEdgeUpsertUpdateWithOutcome(
|
|
17390
17388
|
ctx,
|
|
@@ -17410,7 +17408,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
17410
17408
|
ctx,
|
|
17411
17409
|
liveRow.kind,
|
|
17412
17410
|
liveRow.id,
|
|
17413
|
-
|
|
17411
|
+
chunk5PRKMB24_cjs.rowPropsToObject(liveRow.props),
|
|
17414
17412
|
validatedProps
|
|
17415
17413
|
)
|
|
17416
17414
|
)
|
|
@@ -17475,21 +17473,21 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17475
17473
|
validateMatchOnFields(edgeKind.schema, matchOn, kind);
|
|
17476
17474
|
const validated = [];
|
|
17477
17475
|
for (const item of items) {
|
|
17478
|
-
|
|
17476
|
+
chunkJB6T4GLL_cjs.assertValidityEndMutation(item, { entityType: "edge", kind });
|
|
17479
17477
|
if (item.clearValidTo === true) {
|
|
17480
|
-
|
|
17478
|
+
chunkJB6T4GLL_cjs.assertClearValidToSupported(backend, "edge");
|
|
17481
17479
|
}
|
|
17482
|
-
const validatedProps =
|
|
17480
|
+
const validatedProps = chunkJFRT7S3B_cjs.validateEdgeProps(edgeKind.schema, item.props, {
|
|
17483
17481
|
kind,
|
|
17484
17482
|
operation: "create"
|
|
17485
17483
|
});
|
|
17486
|
-
const validFrom =
|
|
17484
|
+
const validFrom = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(
|
|
17487
17485
|
item.validFrom,
|
|
17488
17486
|
"validFrom"
|
|
17489
17487
|
);
|
|
17490
|
-
const validTo =
|
|
17488
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(item.validTo, "validTo");
|
|
17491
17489
|
if (!defersEndpointWindowOrdering(ifExists, item.onImmutableLowerBound)) {
|
|
17492
|
-
|
|
17490
|
+
chunkTQHGE7UC_cjs.assertOrderedValidityWindow(
|
|
17493
17491
|
`${kind} edge between ${item.fromKind} "${item.fromId}" and ${item.toKind} "${item.toId}"`,
|
|
17494
17492
|
validFrom,
|
|
17495
17493
|
validTo
|
|
@@ -17561,8 +17559,8 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17561
17559
|
for (const [index, entry2] of validated.entries()) {
|
|
17562
17560
|
const previousIndex = seenKeys.get(entry2.compositeKey);
|
|
17563
17561
|
if (previousIndex !== void 0) {
|
|
17564
|
-
if (
|
|
17565
|
-
|
|
17562
|
+
if (chunkTQHGE7UC_cjs.preservesImmutableLowerBound(entry2.onImmutableLowerBound)) {
|
|
17563
|
+
chunkTQHGE7UC_cjs.assertOrderedValidityWindow(
|
|
17566
17564
|
`${kind} edge between ${entry2.fromKind} "${entry2.fromId}" and ${entry2.toKind} "${entry2.toId}"`,
|
|
17567
17565
|
entry2.validFrom,
|
|
17568
17566
|
entry2.validTo
|
|
@@ -17630,7 +17628,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17630
17628
|
const found = Array.from({ length: items.length });
|
|
17631
17629
|
for (const entry2 of probe.toFetch) {
|
|
17632
17630
|
assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
|
|
17633
|
-
found[entry2.index] = { edge:
|
|
17631
|
+
found[entry2.index] = { edge: chunkJB6T4GLL_cjs.rowToEdge(entry2.row), action: "found" };
|
|
17634
17632
|
}
|
|
17635
17633
|
for (const { index, sourceIndex } of probe.duplicateOf) {
|
|
17636
17634
|
found[index] = {
|
|
@@ -17642,7 +17640,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17642
17640
|
}
|
|
17643
17641
|
}
|
|
17644
17642
|
function runBatch() {
|
|
17645
|
-
return
|
|
17643
|
+
return chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
17646
17644
|
ctx,
|
|
17647
17645
|
backend,
|
|
17648
17646
|
async (target) => {
|
|
@@ -17734,7 +17732,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17734
17732
|
} else {
|
|
17735
17733
|
assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
|
|
17736
17734
|
results[entry2.index] = {
|
|
17737
|
-
edge:
|
|
17735
|
+
edge: chunkJB6T4GLL_cjs.rowToEdge(entry2.row),
|
|
17738
17736
|
action: "found"
|
|
17739
17737
|
};
|
|
17740
17738
|
}
|
|
@@ -17777,21 +17775,21 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
17777
17775
|
var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
|
|
17778
17776
|
var RECORDED_SCAN_LIMIT = 1e3;
|
|
17779
17777
|
function recordedPointReadIdChunk(backend) {
|
|
17780
|
-
const budget =
|
|
17778
|
+
const budget = chunkEZEEWCFJ_cjs.recordedBindParamBudget(backend);
|
|
17781
17779
|
return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
|
|
17782
17780
|
}
|
|
17783
17781
|
function recordedRelationErrorDetails(backend, surface) {
|
|
17784
17782
|
return { dialect: backend.dialect, surface };
|
|
17785
17783
|
}
|
|
17786
17784
|
function withRelationsPrecondition(backend, promise, surface) {
|
|
17787
|
-
return
|
|
17785
|
+
return chunkSIT26LAZ_cjs.withRecordedRelationsPrecondition(
|
|
17788
17786
|
promise,
|
|
17789
17787
|
recordedRelationErrorDetails(backend, surface)
|
|
17790
17788
|
);
|
|
17791
17789
|
}
|
|
17792
17790
|
function createRecordedReadBackend(backend, surface) {
|
|
17793
|
-
const projectedBackend =
|
|
17794
|
-
return
|
|
17791
|
+
const projectedBackend = chunkSIT26LAZ_cjs.projectGraphBackend(backend);
|
|
17792
|
+
return chunkSIT26LAZ_cjs.deriveBackend(projectedBackend, {
|
|
17795
17793
|
execute: (query) => withRelationsPrecondition(backend, backend.execute(query), surface),
|
|
17796
17794
|
...backend.executeRaw === void 0 ? {} : {
|
|
17797
17795
|
executeRaw: (sqlText, params) => withRelationsPrecondition(
|
|
@@ -17810,12 +17808,12 @@ function recordedTemporalFilter(backend, coordinate, tableAlias) {
|
|
|
17810
17808
|
{ code: "RECORDED_POINT_READ_MISSING_COORDINATE" }
|
|
17811
17809
|
);
|
|
17812
17810
|
}
|
|
17813
|
-
return
|
|
17811
|
+
return chunkEZEEWCFJ_cjs.compileTemporalFilter({
|
|
17814
17812
|
mode: coordinate.valid.mode,
|
|
17815
17813
|
asOf: coordinate.valid.asOf,
|
|
17816
17814
|
recordedAsOf,
|
|
17817
17815
|
tableAlias,
|
|
17818
|
-
currentTimestamp:
|
|
17816
|
+
currentTimestamp: chunkEZEEWCFJ_cjs.currentReadInstant()
|
|
17819
17817
|
});
|
|
17820
17818
|
}
|
|
17821
17819
|
function recordedRelationInvariantError(params) {
|
|
@@ -17910,13 +17908,13 @@ function createRecordedReadService(params) {
|
|
|
17910
17908
|
const chunkResults = await withRelationsPrecondition(
|
|
17911
17909
|
backend,
|
|
17912
17910
|
Promise.all(
|
|
17913
|
-
|
|
17911
|
+
chunkSIT26LAZ_cjs.chunk(uniqueIds, recordedPointReadIdChunk(backend)).map(
|
|
17914
17912
|
(idChunk) => backend.execute(
|
|
17915
17913
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
17916
17914
|
SELECT * FROM ${table} ${aliasSql}
|
|
17917
17915
|
WHERE ${aliasSql}.graph_id = ${graphId}
|
|
17918
17916
|
AND ${aliasSql}.kind = ${kind}
|
|
17919
|
-
AND ${aliasSql}.id IN (${
|
|
17917
|
+
AND ${aliasSql}.id IN (${chunkEZEEWCFJ_cjs.sqlValueList(idChunk)})
|
|
17920
17918
|
AND ${temporalFilter}
|
|
17921
17919
|
ORDER BY ${aliasSql}.recorded_from
|
|
17922
17920
|
`)
|
|
@@ -17995,7 +17993,7 @@ function createRecordedReadService(params) {
|
|
|
17995
17993
|
kind,
|
|
17996
17994
|
ids,
|
|
17997
17995
|
coordinate,
|
|
17998
|
-
toEntity: (row) =>
|
|
17996
|
+
toEntity: (row) => chunkJB6T4GLL_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
17999
17997
|
});
|
|
18000
17998
|
}
|
|
18001
17999
|
function edgeGetByIds(kind, ids, coordinate) {
|
|
@@ -18007,7 +18005,7 @@ function createRecordedReadService(params) {
|
|
|
18007
18005
|
kind,
|
|
18008
18006
|
ids,
|
|
18009
18007
|
coordinate,
|
|
18010
|
-
toEntity: (row) =>
|
|
18008
|
+
toEntity: (row) => chunkJB6T4GLL_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
18011
18009
|
});
|
|
18012
18010
|
}
|
|
18013
18011
|
function nodeScan(kind, coordinate, options) {
|
|
@@ -18019,7 +18017,7 @@ function createRecordedReadService(params) {
|
|
|
18019
18017
|
kind,
|
|
18020
18018
|
coordinate,
|
|
18021
18019
|
options,
|
|
18022
|
-
toEntity: (row) =>
|
|
18020
|
+
toEntity: (row) => chunkJB6T4GLL_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
18023
18021
|
});
|
|
18024
18022
|
}
|
|
18025
18023
|
function edgeScan(kind, coordinate, options) {
|
|
@@ -18031,7 +18029,7 @@ function createRecordedReadService(params) {
|
|
|
18031
18029
|
kind,
|
|
18032
18030
|
coordinate,
|
|
18033
18031
|
options,
|
|
18034
|
-
toEntity: (row) =>
|
|
18032
|
+
toEntity: (row) => chunkJB6T4GLL_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
18035
18033
|
});
|
|
18036
18034
|
}
|
|
18037
18035
|
return {
|
|
@@ -18330,8 +18328,8 @@ var CAUGHT_UP_VERB_DETAILS = {
|
|
|
18330
18328
|
}
|
|
18331
18329
|
};
|
|
18332
18330
|
var ROW_MAPPER_CONFIGS = {
|
|
18333
|
-
postgres:
|
|
18334
|
-
sqlite:
|
|
18331
|
+
postgres: chunkFA2AFWLP_cjs.POSTGRES_ROW_MAPPER_CONFIG,
|
|
18332
|
+
sqlite: chunkFA2AFWLP_cjs.SQLITE_ROW_MAPPER_CONFIG
|
|
18335
18333
|
};
|
|
18336
18334
|
function rowMapperConfigFor(backend) {
|
|
18337
18335
|
return ROW_MAPPER_CONFIGS[backend.dialect];
|
|
@@ -18345,7 +18343,7 @@ function transactionOutcome(result, recorder, recordedByGraph, graphId) {
|
|
|
18345
18343
|
return {
|
|
18346
18344
|
result,
|
|
18347
18345
|
receipt: recorder.snapshot(
|
|
18348
|
-
recorded === void 0 ? void 0 :
|
|
18346
|
+
recorded === void 0 ? void 0 : chunk2QGYQBS2_cjs.asRecordedInstant(recorded)
|
|
18349
18347
|
)
|
|
18350
18348
|
};
|
|
18351
18349
|
}
|
|
@@ -18367,7 +18365,7 @@ function syncStoreReplacementRef(ref, replacement) {
|
|
|
18367
18365
|
ref.current = replacement;
|
|
18368
18366
|
}
|
|
18369
18367
|
async function commitEvolvedSchemaWhenRequiredKindsAreEmpty(backend, graph, currentVersion, classification) {
|
|
18370
|
-
const result = await
|
|
18368
|
+
const result = await chunk3FPR224C_cjs.commitNewSchemaVersionIfKindsEmpty(
|
|
18371
18369
|
backend,
|
|
18372
18370
|
graph,
|
|
18373
18371
|
currentVersion,
|
|
@@ -18414,7 +18412,7 @@ async function assertEvolvedSchemaRequiredKindsEmpty(backend, graphId, classific
|
|
|
18414
18412
|
}
|
|
18415
18413
|
var IDENTITY_FACADES = /* @__PURE__ */ new WeakMap();
|
|
18416
18414
|
var StoreImplementation = class _StoreImplementation {
|
|
18417
|
-
[
|
|
18415
|
+
[chunk3KOY4FH3_cjs.STORE_RUNTIME];
|
|
18418
18416
|
#graph;
|
|
18419
18417
|
/**
|
|
18420
18418
|
* Bare backend for DDL, vector-storage, and bulk-materialization work that must
|
|
@@ -18462,7 +18460,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18462
18460
|
this.#captureEnabled = options?.history === true;
|
|
18463
18461
|
this.#revisionTrackingEnabled = this.#captureEnabled || options?.revisionTracking === true;
|
|
18464
18462
|
if (this.#revisionTrackingEnabled) {
|
|
18465
|
-
|
|
18463
|
+
chunkEZEEWCFJ_cjs.assertRevisionTrackableBackend(backend);
|
|
18466
18464
|
}
|
|
18467
18465
|
const explicitSchema = options?.schema === void 0 ? void 0 : chunk3U5ABFDW_cjs.requireSqlSchema(options.schema, "store schema");
|
|
18468
18466
|
const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunk3U5ABFDW_cjs.createSqlSchema(backend.tableNames) : void 0);
|
|
@@ -18480,23 +18478,27 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18480
18478
|
options?.recordedRead
|
|
18481
18479
|
);
|
|
18482
18480
|
this.#recordedReadBinding = this.#captureEnabled ? chunk3U5ABFDW_cjs.createRecordedReadBinding(readSchema) : externalRecordedRead;
|
|
18483
|
-
this.#backend = this.#captureEnabled ? asGraphWriteBackend(
|
|
18481
|
+
this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunkEZEEWCFJ_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
|
|
18484
18482
|
this.#schema = resolvedSchema;
|
|
18485
18483
|
const rowMapperConfig = rowMapperConfigFor(this.#backend);
|
|
18486
18484
|
this.#recordedReads = createRecordedReadService({
|
|
18487
18485
|
graphId: graph.id,
|
|
18488
18486
|
backend: this.#backend,
|
|
18489
18487
|
recordedReadBinding: this.#recordedReadBinding,
|
|
18490
|
-
mapRecordedNodeRow:
|
|
18491
|
-
mapRecordedEdgeRow:
|
|
18488
|
+
mapRecordedNodeRow: chunkFA2AFWLP_cjs.createNodeRowMapper(rowMapperConfig),
|
|
18489
|
+
mapRecordedEdgeRow: chunkFA2AFWLP_cjs.createEdgeRowMapper(rowMapperConfig)
|
|
18492
18490
|
});
|
|
18493
|
-
this.#registry =
|
|
18491
|
+
this.#registry = chunk3FPR224C_cjs.buildKindRegistry(graph);
|
|
18494
18492
|
this.#hooks = options?.hooks ?? {};
|
|
18495
18493
|
this.#defaultTraversalExpansion = options?.queryDefaults?.traversalExpansion ?? "inverse";
|
|
18496
18494
|
this.#options = options;
|
|
18497
18495
|
this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
|
|
18498
|
-
this[
|
|
18496
|
+
this[chunk3KOY4FH3_cjs.STORE_RUNTIME] = {
|
|
18499
18497
|
backend: this.#backend,
|
|
18498
|
+
// The query path's own construction, not a second spelling of it: a
|
|
18499
|
+
// caller that could only rebuild this object could not observe the one
|
|
18500
|
+
// the queries actually run on.
|
|
18501
|
+
queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[chunk3KOY4FH3_cjs.STORE_RUNTIME].backend),
|
|
18500
18502
|
sealedQuery: (coordinate) => this.sealedQuery(coordinate),
|
|
18501
18503
|
recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
|
|
18502
18504
|
recordedNodeGetByIds: (kind, ids, coordinate) => this.recordedNodeGetByIds(kind, ids, coordinate),
|
|
@@ -18509,9 +18511,50 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18509
18511
|
identityAtCoordinate: (coordinate) => this.identityAtCoordinate(coordinate),
|
|
18510
18512
|
rebuildIdentityClosure: () => this.rebuildIdentityClosure(),
|
|
18511
18513
|
validateIdentity: () => this.validateIdentity(),
|
|
18514
|
+
applyResolvedNodeUniqueness: async (target, writes, apply) => {
|
|
18515
|
+
const upserts = writes.upserts.map((upsert) => {
|
|
18516
|
+
if (!chunkN66HCGCY_cjs.hasOwnKey(this.#graph.nodes, upsert.kind)) {
|
|
18517
|
+
throw new chunkMRDBBHIZ_cjs.KindNotFoundError(upsert.kind, "node", {
|
|
18518
|
+
graphId: this.graphId
|
|
18519
|
+
});
|
|
18520
|
+
}
|
|
18521
|
+
const registration = this.#graph.nodes[upsert.kind];
|
|
18522
|
+
if (registration === void 0) {
|
|
18523
|
+
throw new chunkMRDBBHIZ_cjs.KindNotFoundError(upsert.kind, "node", {
|
|
18524
|
+
graphId: this.graphId
|
|
18525
|
+
});
|
|
18526
|
+
}
|
|
18527
|
+
return {
|
|
18528
|
+
...upsert,
|
|
18529
|
+
constraints: registration.unique ?? []
|
|
18530
|
+
};
|
|
18531
|
+
});
|
|
18532
|
+
const constrainedKinds = new Set(
|
|
18533
|
+
Object.entries(this.#graph.nodes).filter(
|
|
18534
|
+
([, registration]) => (registration.unique ?? []).length > 0
|
|
18535
|
+
).map(([kind]) => kind)
|
|
18536
|
+
);
|
|
18537
|
+
const releases = writes.releases.filter((release) => {
|
|
18538
|
+
if (!Object.hasOwn(this.#graph.nodes, release.kind)) {
|
|
18539
|
+
throw new chunkMRDBBHIZ_cjs.KindNotFoundError(release.kind, "node", {
|
|
18540
|
+
graphId: this.graphId
|
|
18541
|
+
});
|
|
18542
|
+
}
|
|
18543
|
+
return constrainedKinds.has(release.kind);
|
|
18544
|
+
});
|
|
18545
|
+
if (upserts.every((upsert) => upsert.constraints.length === 0) && releases.length === 0) {
|
|
18546
|
+
return apply();
|
|
18547
|
+
}
|
|
18548
|
+
return chunk3KOY4FH3_cjs.applyResolvedNodeUniqueness(
|
|
18549
|
+
chunk3KOY4FH3_cjs.createUniquenessContext(this.graphId, this.#registry, target),
|
|
18550
|
+
upserts,
|
|
18551
|
+
releases,
|
|
18552
|
+
apply
|
|
18553
|
+
);
|
|
18554
|
+
},
|
|
18512
18555
|
liveNodesSharingIds: async (ids, target) => {
|
|
18513
18556
|
const backend2 = target ?? this.#baseBackend;
|
|
18514
|
-
const liveKindsById = await
|
|
18557
|
+
const liveKindsById = await chunkJFRT7S3B_cjs.liveNodeKindsSharingIds(
|
|
18515
18558
|
this.#identityContext(backend2),
|
|
18516
18559
|
backend2,
|
|
18517
18560
|
ids
|
|
@@ -18526,21 +18569,21 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18526
18569
|
if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
|
|
18527
18570
|
const backend2 = target ?? this.#baseBackend;
|
|
18528
18571
|
const ctx = this.#identityContext(backend2);
|
|
18529
|
-
const rows = await
|
|
18572
|
+
const rows = await chunkJFRT7S3B_cjs.loadAssertionsByIds(
|
|
18530
18573
|
backend2,
|
|
18531
18574
|
ctx.schema,
|
|
18532
18575
|
this.graphId,
|
|
18533
18576
|
ids
|
|
18534
18577
|
);
|
|
18535
18578
|
return new Map(
|
|
18536
|
-
[...rows].map(([id, row]) => [id,
|
|
18579
|
+
[...rows].map(([id, row]) => [id, chunkJFRT7S3B_cjs.toTransferAssertion(row)])
|
|
18537
18580
|
);
|
|
18538
18581
|
},
|
|
18539
18582
|
structuralIdentityClasses: async (references, target) => {
|
|
18540
18583
|
if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
|
|
18541
18584
|
const backend2 = target ?? this.#baseBackend;
|
|
18542
18585
|
const ctx = this.#identityContext(backend2);
|
|
18543
|
-
return
|
|
18586
|
+
return chunkJFRT7S3B_cjs.loadCurrentStructuralClasses(
|
|
18544
18587
|
backend2,
|
|
18545
18588
|
ctx.schema,
|
|
18546
18589
|
this.graphId,
|
|
@@ -18556,7 +18599,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18556
18599
|
applyIdentityMergeAtTarget: (target, retractions, assertions) => this.applyIdentityMergeAtTarget(target, retractions, assertions),
|
|
18557
18600
|
assertIdentityClassesConsistentAtTarget: (target, seeds) => this.assertIdentityClassesConsistentAtTarget(target, seeds)
|
|
18558
18601
|
};
|
|
18559
|
-
Object.defineProperty(this,
|
|
18602
|
+
Object.defineProperty(this, chunk3KOY4FH3_cjs.STORE_RUNTIME, {
|
|
18560
18603
|
configurable: false,
|
|
18561
18604
|
enumerable: false,
|
|
18562
18605
|
writable: false
|
|
@@ -18593,7 +18636,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18593
18636
|
);
|
|
18594
18637
|
const existing = IDENTITY_FACADES.get(this);
|
|
18595
18638
|
if (existing !== void 0) return existing;
|
|
18596
|
-
const facade =
|
|
18639
|
+
const facade = chunkJFRT7S3B_cjs.createIdentityFacade(this.#identityContext(this.#backend));
|
|
18597
18640
|
IDENTITY_FACADES.set(this, facade);
|
|
18598
18641
|
return facade;
|
|
18599
18642
|
}
|
|
@@ -18623,7 +18666,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18623
18666
|
this.#recordedReadBinding,
|
|
18624
18667
|
"recorded-identity"
|
|
18625
18668
|
);
|
|
18626
|
-
return
|
|
18669
|
+
return chunkJFRT7S3B_cjs.createIdentityReadFacade({
|
|
18627
18670
|
...this.#identityContext(backend),
|
|
18628
18671
|
schema,
|
|
18629
18672
|
coordinate
|
|
@@ -18632,7 +18675,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18632
18675
|
/** Rebuilds derived current identity closure without advancing revision. */
|
|
18633
18676
|
async rebuildIdentityClosure() {
|
|
18634
18677
|
this.#requireIdentityEnabled();
|
|
18635
|
-
await
|
|
18678
|
+
await chunkJFRT7S3B_cjs.runInWriteTransaction(
|
|
18636
18679
|
{
|
|
18637
18680
|
graphId: this.graphId,
|
|
18638
18681
|
schemaVersion: this.#schemaMetadata.schemaVersion,
|
|
@@ -18641,7 +18684,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18641
18684
|
revisionSchema: this.#sqlSchema()
|
|
18642
18685
|
},
|
|
18643
18686
|
this.#baseBackend,
|
|
18644
|
-
async (target) =>
|
|
18687
|
+
async (target) => chunkJFRT7S3B_cjs.rebuildIdentityClosureForContext(this.#identityContext(target)),
|
|
18645
18688
|
{ didWrite: () => false }
|
|
18646
18689
|
);
|
|
18647
18690
|
}
|
|
@@ -18653,7 +18696,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18653
18696
|
* fails leaves no half-published derived relation behind.
|
|
18654
18697
|
*/
|
|
18655
18698
|
async identitySchemaPreflight(target, provisionDerivedRelations) {
|
|
18656
|
-
await
|
|
18699
|
+
await chunk3FPR224C_cjs.identitySchemaCommitPreflight(this.#identityContext(this.#backend), {
|
|
18657
18700
|
enablement: false,
|
|
18658
18701
|
provisionDerivedRelations
|
|
18659
18702
|
})(target);
|
|
@@ -18661,24 +18704,24 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18661
18704
|
/** @internal Read-only startup integrity verification. */
|
|
18662
18705
|
async validateIdentity() {
|
|
18663
18706
|
if (this.#graph.identity === void 0) return;
|
|
18664
|
-
await
|
|
18707
|
+
await chunkJFRT7S3B_cjs.validateIdentityForContext(this.#identityContext(this.#baseBackend));
|
|
18665
18708
|
}
|
|
18666
18709
|
/** @internal Cascades removed kinds in the schema-commit transaction. */
|
|
18667
18710
|
async removeIdentityKindsInSchemaPreflight(target, kinds, options) {
|
|
18668
18711
|
if (!this.#captureEnabled) {
|
|
18669
|
-
await
|
|
18712
|
+
await chunkJFRT7S3B_cjs.removeIdentityKindsForContext(
|
|
18670
18713
|
this.#identityContext(target),
|
|
18671
18714
|
kinds,
|
|
18672
18715
|
options
|
|
18673
18716
|
);
|
|
18674
18717
|
return;
|
|
18675
18718
|
}
|
|
18676
|
-
const scope =
|
|
18719
|
+
const scope = chunkEZEEWCFJ_cjs.createRecordedTransactionScope(
|
|
18677
18720
|
target,
|
|
18678
18721
|
this.#sqlSchema(),
|
|
18679
18722
|
target.dialect === "sqlite"
|
|
18680
18723
|
);
|
|
18681
|
-
await
|
|
18724
|
+
await chunkJFRT7S3B_cjs.removeIdentityKindsForContext(
|
|
18682
18725
|
this.#identityContext(scope.backend),
|
|
18683
18726
|
kinds,
|
|
18684
18727
|
options
|
|
@@ -18692,7 +18735,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18692
18735
|
*/
|
|
18693
18736
|
readCurrentIdentityAssertions(mode, options) {
|
|
18694
18737
|
if (this.#graph.identity === void 0) return Promise.resolve([]);
|
|
18695
|
-
return
|
|
18738
|
+
return chunkJFRT7S3B_cjs.readIdentityAssertionsForInterchange(
|
|
18696
18739
|
this.#identityContext(this.#baseBackend),
|
|
18697
18740
|
mode,
|
|
18698
18741
|
options
|
|
@@ -18701,7 +18744,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18701
18744
|
/** @internal Reads identity truth through an already-bound transaction. */
|
|
18702
18745
|
identityAssertionsAtTarget(target, mode = "state") {
|
|
18703
18746
|
if (this.#graph.identity === void 0) return Promise.resolve([]);
|
|
18704
|
-
return
|
|
18747
|
+
return chunkJFRT7S3B_cjs.readIdentityAssertionsForInterchange(
|
|
18705
18748
|
this.#identityContext(target),
|
|
18706
18749
|
mode
|
|
18707
18750
|
);
|
|
@@ -18711,7 +18754,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18711
18754
|
if (this.#graph.identity === void 0) {
|
|
18712
18755
|
return Promise.resolve({ assertions: [], done: true });
|
|
18713
18756
|
}
|
|
18714
|
-
return
|
|
18757
|
+
return chunkJFRT7S3B_cjs.readIdentityAssertionPageAtTarget(
|
|
18715
18758
|
this.#identityContext(target),
|
|
18716
18759
|
target,
|
|
18717
18760
|
mode,
|
|
@@ -18720,14 +18763,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18720
18763
|
}
|
|
18721
18764
|
/** @internal Acquires the enabled graph's identity lock for an import. */
|
|
18722
18765
|
lockIdentityImportTarget(target) {
|
|
18723
|
-
return this.#graph.identity === void 0 ? Promise.resolve() :
|
|
18766
|
+
return this.#graph.identity === void 0 ? Promise.resolve() : chunkJFRT7S3B_cjs.lockIdentityGraph(target, this.graphId);
|
|
18724
18767
|
}
|
|
18725
18768
|
/** @internal Restores same-id folding after the ops-layer import bypass. */
|
|
18726
18769
|
foldImportedIdentityNodes(target, references) {
|
|
18727
18770
|
if (this.#graph.identity === void 0 || references.length === 0) {
|
|
18728
18771
|
return Promise.resolve();
|
|
18729
18772
|
}
|
|
18730
|
-
return
|
|
18773
|
+
return chunkJFRT7S3B_cjs.foldIdentityForCreatedNodes(
|
|
18731
18774
|
{
|
|
18732
18775
|
graphId: this.graphId,
|
|
18733
18776
|
registry: this.#registry,
|
|
@@ -18749,7 +18792,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18749
18792
|
{ code: "IDENTITY_IMPORT_REQUIRES_PROFILE", graphId: this.graphId }
|
|
18750
18793
|
);
|
|
18751
18794
|
}
|
|
18752
|
-
return
|
|
18795
|
+
return chunkJFRT7S3B_cjs.importIdentityAssertionsIntoTarget(
|
|
18753
18796
|
this.#identityContext(target),
|
|
18754
18797
|
target,
|
|
18755
18798
|
assertions,
|
|
@@ -18765,7 +18808,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18765
18808
|
if (this.#graph.identity === void 0 || seeds.length === 0) {
|
|
18766
18809
|
return Promise.resolve();
|
|
18767
18810
|
}
|
|
18768
|
-
return
|
|
18811
|
+
return chunkJFRT7S3B_cjs.assertAffectedIdentityClassesConsistent(
|
|
18769
18812
|
this.#identityContext(target),
|
|
18770
18813
|
target,
|
|
18771
18814
|
seeds
|
|
@@ -18782,7 +18825,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18782
18825
|
{ code: "IDENTITY_MERGE_REQUIRES_PROFILE", graphId: this.graphId }
|
|
18783
18826
|
);
|
|
18784
18827
|
}
|
|
18785
|
-
return
|
|
18828
|
+
return chunkJFRT7S3B_cjs.applyIdentityChangesForContext(
|
|
18786
18829
|
this.#identityContext(target),
|
|
18787
18830
|
retractions,
|
|
18788
18831
|
assertions
|
|
@@ -19093,7 +19136,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19093
19136
|
* between "proceed" and "ask the user" *before* attempting a commit.
|
|
19094
19137
|
*/
|
|
19095
19138
|
async schemaChanges() {
|
|
19096
|
-
return
|
|
19139
|
+
return chunk3FPR224C_cjs.getSchemaChanges(this.#backend, this.#graph);
|
|
19097
19140
|
}
|
|
19098
19141
|
/**
|
|
19099
19142
|
* Whether committing this store's graph would require a schema migration —
|
|
@@ -19105,7 +19148,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19105
19148
|
* through a user's request.
|
|
19106
19149
|
*/
|
|
19107
19150
|
async requiresMigration() {
|
|
19108
|
-
return
|
|
19151
|
+
return chunk3FPR224C_cjs.requiresMigration(this.#backend, this.#graph);
|
|
19109
19152
|
}
|
|
19110
19153
|
/**
|
|
19111
19154
|
* Node operations bound to this store instance.
|
|
@@ -19121,7 +19164,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19121
19164
|
async #maybeRefreshStatisticsAfterBulk(rowCount) {
|
|
19122
19165
|
const configured = this.#options?.autoRefreshStatistics;
|
|
19123
19166
|
if (configured === false) return;
|
|
19124
|
-
const threshold = configured ??
|
|
19167
|
+
const threshold = configured ?? chunk3KOY4FH3_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
|
|
19125
19168
|
if (rowCount < threshold) return;
|
|
19126
19169
|
try {
|
|
19127
19170
|
await this.refreshStatistics();
|
|
@@ -19135,13 +19178,13 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19135
19178
|
#buildNodeOperations(ctx) {
|
|
19136
19179
|
return {
|
|
19137
19180
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
19138
|
-
rowToNode: (row) =>
|
|
19181
|
+
rowToNode: (row) => chunkJB6T4GLL_cjs.rowToNode(row),
|
|
19139
19182
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
19140
|
-
executeCreate: (input, backend) =>
|
|
19141
|
-
executeCreateBatch: (inputs, backend) =>
|
|
19142
|
-
executeCreateNoReturnBatch: (inputs, backend) =>
|
|
19143
|
-
executeUpdate: (input, backend, options) =>
|
|
19144
|
-
executeUpdateWhere: (kind, patch, candidateIds, candidateIdColumn, backend) =>
|
|
19183
|
+
executeCreate: (input, backend) => chunkJB6T4GLL_cjs.executeNodeCreate(ctx, input, backend),
|
|
19184
|
+
executeCreateBatch: (inputs, backend) => chunkJB6T4GLL_cjs.executeNodeCreateBatch(ctx, inputs, backend),
|
|
19185
|
+
executeCreateNoReturnBatch: (inputs, backend) => chunkJB6T4GLL_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
|
|
19186
|
+
executeUpdate: (input, backend, options) => chunkJB6T4GLL_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
|
|
19187
|
+
executeUpdateWhere: (kind, patch, candidateIds, candidateIdColumn, backend) => chunkJB6T4GLL_cjs.executeNodeUpdateWhere(
|
|
19145
19188
|
ctx,
|
|
19146
19189
|
kind,
|
|
19147
19190
|
patch,
|
|
@@ -19149,7 +19192,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19149
19192
|
candidateIdColumn,
|
|
19150
19193
|
backend
|
|
19151
19194
|
),
|
|
19152
|
-
executeUpsertUpdate: (input, backend, options) =>
|
|
19195
|
+
executeUpsertUpdate: (input, backend, options) => chunkJB6T4GLL_cjs.executeNodeUpsertUpdate(
|
|
19153
19196
|
ctx,
|
|
19154
19197
|
{ ...input, id: input.id },
|
|
19155
19198
|
backend,
|
|
@@ -19157,14 +19200,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19157
19200
|
),
|
|
19158
19201
|
// Present only when opted in; its absence is the coalesce off switch.
|
|
19159
19202
|
...ctx.coalesceUnchangedUpsertsEnabled && {
|
|
19160
|
-
upsertDirtyCheck: (kind, id, existingProps, inputProps) =>
|
|
19203
|
+
upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunkJB6T4GLL_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
|
|
19161
19204
|
},
|
|
19162
|
-
executeDelete: (kind, id, backend) =>
|
|
19163
|
-
executeDeleteBatch: (kind, ids, backend) =>
|
|
19164
|
-
executeHardDelete: (kind, id, backend) =>
|
|
19205
|
+
executeDelete: (kind, id, backend) => chunkJB6T4GLL_cjs.executeNodeDelete(ctx, kind, id, backend),
|
|
19206
|
+
executeDeleteBatch: (kind, ids, backend) => chunkJB6T4GLL_cjs.executeNodeDeleteBatch(ctx, kind, ids, backend),
|
|
19207
|
+
executeHardDelete: (kind, id, backend) => chunkJB6T4GLL_cjs.executeNodeHardDelete(ctx, kind, id, backend),
|
|
19165
19208
|
temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
|
|
19166
19209
|
createQuery: () => this.query(),
|
|
19167
|
-
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) =>
|
|
19210
|
+
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkJB6T4GLL_cjs.executeNodeGetOrCreateByConstraint(
|
|
19168
19211
|
ctx,
|
|
19169
19212
|
kind,
|
|
19170
19213
|
constraintName,
|
|
@@ -19172,7 +19215,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19172
19215
|
backend,
|
|
19173
19216
|
options
|
|
19174
19217
|
),
|
|
19175
|
-
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) =>
|
|
19218
|
+
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkJB6T4GLL_cjs.executeNodeBulkGetOrCreateByConstraint(
|
|
19176
19219
|
ctx,
|
|
19177
19220
|
kind,
|
|
19178
19221
|
constraintName,
|
|
@@ -19180,15 +19223,15 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19180
19223
|
backend,
|
|
19181
19224
|
options
|
|
19182
19225
|
),
|
|
19183
|
-
executeFindByConstraint: (kind, constraintName, props, backend) =>
|
|
19184
|
-
executeBulkFindByConstraint: (kind, constraintName, items, backend) =>
|
|
19226
|
+
executeFindByConstraint: (kind, constraintName, props, backend) => chunkJB6T4GLL_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
|
|
19227
|
+
executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunkJB6T4GLL_cjs.executeNodeBulkFindByConstraint(
|
|
19185
19228
|
ctx,
|
|
19186
19229
|
kind,
|
|
19187
19230
|
constraintName,
|
|
19188
19231
|
items,
|
|
19189
19232
|
backend
|
|
19190
19233
|
),
|
|
19191
|
-
executeBulkFindByIndex: (kind, indexName, items, backend, options) =>
|
|
19234
|
+
executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkJB6T4GLL_cjs.executeNodeBulkFindByIndex(
|
|
19192
19235
|
ctx,
|
|
19193
19236
|
kind,
|
|
19194
19237
|
indexName,
|
|
@@ -19207,7 +19250,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19207
19250
|
#buildEdgeOperations(ctx) {
|
|
19208
19251
|
return {
|
|
19209
19252
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
19210
|
-
rowToEdge: (row) =>
|
|
19253
|
+
rowToEdge: (row) => chunkJB6T4GLL_cjs.rowToEdge(row),
|
|
19211
19254
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
19212
19255
|
executeCreate: (input, backend) => executeEdgeCreate(ctx, input, backend),
|
|
19213
19256
|
executeCreateBatch: (inputs, backend) => executeEdgeCreateBatch(ctx, inputs, backend),
|
|
@@ -19374,14 +19417,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19374
19417
|
* increments.
|
|
19375
19418
|
*/
|
|
19376
19419
|
asOfRecorded(recordedAsOf) {
|
|
19377
|
-
const validCoordinate =
|
|
19420
|
+
const validCoordinate = chunk2QGYQBS2_cjs.resolveReadCoordinate(
|
|
19378
19421
|
"asOf",
|
|
19379
|
-
|
|
19422
|
+
chunk2QGYQBS2_cjs.recordedInstantWallTime(recordedAsOf),
|
|
19380
19423
|
"Use await store.recordedNow() as the anchor, or asRecordedInstant(value) only for an instant previously read from recordedNow()."
|
|
19381
19424
|
);
|
|
19382
19425
|
return new RecordedStoreView(
|
|
19383
19426
|
this,
|
|
19384
|
-
|
|
19427
|
+
chunk2QGYQBS2_cjs.withRecordedCoordinate(validCoordinate, recordedAsOf)
|
|
19385
19428
|
);
|
|
19386
19429
|
}
|
|
19387
19430
|
/**
|
|
@@ -19418,11 +19461,11 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19418
19461
|
}
|
|
19419
19462
|
);
|
|
19420
19463
|
}
|
|
19421
|
-
const recordedAt = await
|
|
19422
|
-
|
|
19464
|
+
const recordedAt = await chunkSIT26LAZ_cjs.withRecordedRelationsPrecondition(
|
|
19465
|
+
chunkEZEEWCFJ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
|
|
19423
19466
|
{ dialect: this.#backend.dialect, surface: "recorded-now" }
|
|
19424
19467
|
);
|
|
19425
|
-
return recordedAt === void 0 ? void 0 :
|
|
19468
|
+
return recordedAt === void 0 ? void 0 : chunk2QGYQBS2_cjs.asRecordedInstant(recordedAt);
|
|
19426
19469
|
}
|
|
19427
19470
|
/**
|
|
19428
19471
|
* Returns the durable graph revision used by graph branching. It is undefined
|
|
@@ -19434,7 +19477,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19434
19477
|
*/
|
|
19435
19478
|
async revisionNow() {
|
|
19436
19479
|
if (!this.#revisionTrackingEnabled) return void 0;
|
|
19437
|
-
return
|
|
19480
|
+
return chunkEZEEWCFJ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
|
|
19438
19481
|
}
|
|
19439
19482
|
/**
|
|
19440
19483
|
* Returns the durable random namespace for this graph's revision clock. A
|
|
@@ -19451,7 +19494,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19451
19494
|
{ code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
|
|
19452
19495
|
);
|
|
19453
19496
|
}
|
|
19454
|
-
const pendingOrigin = this.#revisionOrigin ??
|
|
19497
|
+
const pendingOrigin = this.#revisionOrigin ?? chunkEZEEWCFJ_cjs.ensureRevisionOrigin(this.#baseBackend, this.#sqlSchema(), this.graphId);
|
|
19455
19498
|
this.#revisionOrigin = pendingOrigin;
|
|
19456
19499
|
try {
|
|
19457
19500
|
return await pendingOrigin;
|
|
@@ -19497,7 +19540,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19497
19540
|
* ```
|
|
19498
19541
|
*/
|
|
19499
19542
|
snapshot() {
|
|
19500
|
-
return this.asOf(
|
|
19543
|
+
return this.asOf(chunkTQHGE7UC_cjs.nowIso());
|
|
19501
19544
|
}
|
|
19502
19545
|
// === Search ===
|
|
19503
19546
|
/**
|
|
@@ -19611,7 +19654,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19611
19654
|
* @returns A tuple with per-query typed results, preserving input order
|
|
19612
19655
|
*/
|
|
19613
19656
|
async batch(...queries) {
|
|
19614
|
-
return
|
|
19657
|
+
return chunk5PRKMB24_cjs.runOptionallyInTransaction(this.#baseBackend, async (target) => {
|
|
19615
19658
|
const queryBackend = this.#createHookedQueryBackend(target);
|
|
19616
19659
|
const results = [];
|
|
19617
19660
|
for (const query of queries) {
|
|
@@ -19699,7 +19742,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19699
19742
|
});
|
|
19700
19743
|
const edgesBySource = /* @__PURE__ */ new Map();
|
|
19701
19744
|
for (const row of rows) {
|
|
19702
|
-
const edge =
|
|
19745
|
+
const edge = chunkJB6T4GLL_cjs.rowToEdge(row);
|
|
19703
19746
|
const key = `${edge.fromKind}\0${edge.fromId}`;
|
|
19704
19747
|
const bucket = edgesBySource.get(key);
|
|
19705
19748
|
if (bucket === void 0) edgesBySource.set(key, [edge]);
|
|
@@ -19755,11 +19798,11 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19755
19798
|
* @internal
|
|
19756
19799
|
*/
|
|
19757
19800
|
subgraphAtCoordinate(rootId, options) {
|
|
19758
|
-
const coordinate =
|
|
19801
|
+
const coordinate = chunk2QGYQBS2_cjs.resolveReadCoordinate(
|
|
19759
19802
|
options.temporalMode ?? this.#graph.defaults.temporalMode,
|
|
19760
19803
|
options.asOf
|
|
19761
19804
|
);
|
|
19762
|
-
const readCoordinate = options.recordedAsOf === void 0 ? coordinate :
|
|
19805
|
+
const readCoordinate = options.recordedAsOf === void 0 ? coordinate : chunk2QGYQBS2_cjs.withRecordedCoordinate(coordinate, options.recordedAsOf);
|
|
19763
19806
|
return executeSubgraph({
|
|
19764
19807
|
graph: this.#graph,
|
|
19765
19808
|
graphId: this.graphId,
|
|
@@ -19825,7 +19868,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19825
19868
|
receiptRecorder
|
|
19826
19869
|
));
|
|
19827
19870
|
}
|
|
19828
|
-
const identity = this.#graph.identity === void 0 ? void 0 :
|
|
19871
|
+
const identity = this.#graph.identity === void 0 ? void 0 : chunkJFRT7S3B_cjs.createIdentityFacade(this.#identityContext(this.#backend));
|
|
19829
19872
|
const receiptIdentity = identity === void 0 || receiptRecorder === void 0 ? identity : wrapTransactionIdentity(identity, receiptRecorder);
|
|
19830
19873
|
const fallbackContext = {
|
|
19831
19874
|
nodes,
|
|
@@ -19833,8 +19876,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19833
19876
|
...receiptIdentity === void 0 ? {} : { identity: receiptIdentity },
|
|
19834
19877
|
// No real transaction: `tx.sql` is absent and there is no atomicity.
|
|
19835
19878
|
sqlAvailability: "unavailable",
|
|
19836
|
-
backend:
|
|
19837
|
-
[
|
|
19879
|
+
backend: chunk5PRKMB24_cjs.createTransactionReadBackend(this.#backend),
|
|
19880
|
+
[chunk3KOY4FH3_cjs.TRANSACTION_RUNTIME]: {
|
|
19838
19881
|
backend: this.#backend,
|
|
19839
19882
|
runNodeOperationHooks: (operation, kind, id, hookedFunction) => this.#withOperationHooks(
|
|
19840
19883
|
this.#createOperationContext(operation, "node", kind, id),
|
|
@@ -19843,7 +19886,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19843
19886
|
},
|
|
19844
19887
|
getNodeCollection: (kind) => this.#resolveDynamicNodeCollection(nodes, kind)
|
|
19845
19888
|
};
|
|
19846
|
-
Object.defineProperty(fallbackContext,
|
|
19889
|
+
Object.defineProperty(fallbackContext, chunk3KOY4FH3_cjs.TRANSACTION_RUNTIME, {
|
|
19847
19890
|
configurable: false,
|
|
19848
19891
|
enumerable: false,
|
|
19849
19892
|
writable: false
|
|
@@ -19857,7 +19900,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19857
19900
|
const runHooks = this.#createBufferedHookRunner(pending);
|
|
19858
19901
|
const runBulkHooks = this.#createBufferedBulkHookRunner(pending);
|
|
19859
19902
|
let recordedByGraph;
|
|
19860
|
-
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ?
|
|
19903
|
+
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunkEZEEWCFJ_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
|
|
19861
19904
|
recordedByGraph = instants;
|
|
19862
19905
|
}) : backendOptions;
|
|
19863
19906
|
try {
|
|
@@ -19874,7 +19917,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19874
19917
|
if (!this.#captureEnabled && !this.#revisionTrackingEnabled) {
|
|
19875
19918
|
return invokeTransaction();
|
|
19876
19919
|
}
|
|
19877
|
-
return
|
|
19920
|
+
return chunkJFRT7S3B_cjs.withWriteTransactionSession(
|
|
19878
19921
|
txBackend,
|
|
19879
19922
|
{
|
|
19880
19923
|
graphId: this.graphId,
|
|
@@ -19990,7 +20033,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
19990
20033
|
*/
|
|
19991
20034
|
withTransaction(externalTx) {
|
|
19992
20035
|
if (this.#captureEnabled) {
|
|
19993
|
-
throw
|
|
20036
|
+
throw chunkEZEEWCFJ_cjs.recordedCaptureRequiresCallbackTransactionError();
|
|
19994
20037
|
}
|
|
19995
20038
|
const adopt = this.#adapterBackend?.adoptTransaction;
|
|
19996
20039
|
if (adopt === void 0) {
|
|
@@ -20014,8 +20057,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20014
20057
|
}
|
|
20015
20058
|
const txBackend = adopt(externalTx);
|
|
20016
20059
|
if (this.#captureEnabled) {
|
|
20017
|
-
await
|
|
20018
|
-
await
|
|
20060
|
+
await chunkEZEEWCFJ_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
|
|
20061
|
+
await chunkJFRT7S3B_cjs.lockSchemaVersionForStoreWrite(
|
|
20019
20062
|
{
|
|
20020
20063
|
graphId: this.graphId,
|
|
20021
20064
|
schemaVersion: this.#schemaMetadata.schemaVersion
|
|
@@ -20023,12 +20066,12 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20023
20066
|
txBackend
|
|
20024
20067
|
);
|
|
20025
20068
|
}
|
|
20026
|
-
const scope = this.#captureEnabled ?
|
|
20069
|
+
const scope = this.#captureEnabled ? chunkEZEEWCFJ_cjs.createRecordedTransactionScope(txBackend, this.#sqlSchema()) : {
|
|
20027
20070
|
backend: txBackend,
|
|
20028
20071
|
flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
|
|
20029
20072
|
};
|
|
20030
20073
|
if (this.#captureEnabled) {
|
|
20031
|
-
await
|
|
20074
|
+
await chunkEZEEWCFJ_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
|
|
20032
20075
|
}
|
|
20033
20076
|
const receiptRecorder = createTransactionReceiptRecorder();
|
|
20034
20077
|
const invoke = fn;
|
|
@@ -20133,15 +20176,15 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20133
20176
|
receiptRecorder
|
|
20134
20177
|
));
|
|
20135
20178
|
}
|
|
20136
|
-
const identity = this.#graph.identity === void 0 ? void 0 :
|
|
20179
|
+
const identity = this.#graph.identity === void 0 ? void 0 : chunkJFRT7S3B_cjs.createIdentityFacade(this.#identityContext(txBackend));
|
|
20137
20180
|
const receiptIdentity = identity === void 0 || receiptRecorder === void 0 ? identity : wrapTransactionIdentity(identity, receiptRecorder);
|
|
20138
20181
|
const getNodeCollection = (kind) => this.#resolveDynamicNodeCollection(nodes, kind);
|
|
20139
20182
|
const base = {
|
|
20140
20183
|
nodes,
|
|
20141
20184
|
edges,
|
|
20142
20185
|
...receiptIdentity === void 0 ? {} : { identity: receiptIdentity },
|
|
20143
|
-
backend:
|
|
20144
|
-
[
|
|
20186
|
+
backend: chunk5PRKMB24_cjs.createTransactionReadBackend(txBackend),
|
|
20187
|
+
[chunk3KOY4FH3_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
|
|
20145
20188
|
getNodeCollection
|
|
20146
20189
|
};
|
|
20147
20190
|
let withSql;
|
|
@@ -20150,7 +20193,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20150
20193
|
...base,
|
|
20151
20194
|
sqlAvailability: "history"
|
|
20152
20195
|
};
|
|
20153
|
-
defineUnavailableSqlGuard(withSql, () =>
|
|
20196
|
+
defineUnavailableSqlGuard(withSql, () => chunkEZEEWCFJ_cjs.throwHistoryUnsafeSqlAccess());
|
|
20154
20197
|
} else if (this.#revisionTrackingEnabled) {
|
|
20155
20198
|
withSql = {
|
|
20156
20199
|
...base,
|
|
@@ -20158,14 +20201,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20158
20201
|
};
|
|
20159
20202
|
defineUnavailableSqlGuard(
|
|
20160
20203
|
withSql,
|
|
20161
|
-
() =>
|
|
20204
|
+
() => chunkEZEEWCFJ_cjs.throwRevisionTrackingUnsafeSqlAccess()
|
|
20162
20205
|
);
|
|
20163
20206
|
} else if (sql2 === void 0) {
|
|
20164
20207
|
withSql = { ...base, sqlAvailability: "unavailable" };
|
|
20165
20208
|
} else {
|
|
20166
20209
|
withSql = { ...base, sql: sql2, sqlAvailability: "available" };
|
|
20167
20210
|
}
|
|
20168
|
-
Object.defineProperty(withSql,
|
|
20211
|
+
Object.defineProperty(withSql, chunk3KOY4FH3_cjs.TRANSACTION_RUNTIME, {
|
|
20169
20212
|
configurable: false,
|
|
20170
20213
|
enumerable: false,
|
|
20171
20214
|
writable: false
|
|
@@ -20206,7 +20249,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20206
20249
|
for (const [index, node] of nodes.entries()) {
|
|
20207
20250
|
if (node !== void 0) {
|
|
20208
20251
|
loadedByReference.set(
|
|
20209
|
-
|
|
20252
|
+
chunkJFRT7S3B_cjs.refKey({ kind, id: chunkN66HCGCY_cjs.requireDefined(ids[index]) }),
|
|
20210
20253
|
node
|
|
20211
20254
|
);
|
|
20212
20255
|
}
|
|
@@ -20221,14 +20264,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20221
20264
|
if (row === void 0) continue;
|
|
20222
20265
|
if (!includeTombstoned && row.deleted_at !== void 0) continue;
|
|
20223
20266
|
loadedByReference.set(
|
|
20224
|
-
|
|
20225
|
-
|
|
20267
|
+
chunkJFRT7S3B_cjs.refKey({ kind, id: row.id }),
|
|
20268
|
+
chunkJB6T4GLL_cjs.rowToNode(row)
|
|
20226
20269
|
);
|
|
20227
20270
|
}
|
|
20228
20271
|
})
|
|
20229
20272
|
);
|
|
20230
20273
|
return references.map(
|
|
20231
|
-
(reference) => loadedByReference.get(
|
|
20274
|
+
(reference) => loadedByReference.get(chunkJFRT7S3B_cjs.refKey(reference))
|
|
20232
20275
|
);
|
|
20233
20276
|
}
|
|
20234
20277
|
};
|
|
@@ -20246,15 +20289,15 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20246
20289
|
async clear() {
|
|
20247
20290
|
const doClear = async (target) => {
|
|
20248
20291
|
if (this.#revisionTrackingEnabled) {
|
|
20249
|
-
await
|
|
20292
|
+
await chunkEZEEWCFJ_cjs.lockRecordedGraphWrite(target, this.graphId);
|
|
20250
20293
|
}
|
|
20251
20294
|
if (this.#graph.identity !== void 0) {
|
|
20252
|
-
await
|
|
20295
|
+
await chunkJFRT7S3B_cjs.lockIdentityGraph(target, this.graphId);
|
|
20253
20296
|
}
|
|
20254
|
-
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await
|
|
20297
|
+
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunkEZEEWCFJ_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
|
|
20255
20298
|
await target.clearGraph(this.graphId);
|
|
20256
20299
|
if (this.#revisionTrackingEnabled && !this.#captureEnabled) {
|
|
20257
|
-
await
|
|
20300
|
+
await chunkEZEEWCFJ_cjs.advanceRevisionClock(
|
|
20258
20301
|
target,
|
|
20259
20302
|
this.#sqlSchema(),
|
|
20260
20303
|
this.graphId,
|
|
@@ -20385,7 +20428,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20385
20428
|
*/
|
|
20386
20429
|
async evolve(extension, options) {
|
|
20387
20430
|
const { activeRow, baseline } = await this.#loadCaughtUp("evolve");
|
|
20388
|
-
const merged =
|
|
20431
|
+
const merged = chunk3FPR224C_cjs.mergeGraphExtension(baseline, extension);
|
|
20389
20432
|
if (merged === baseline) {
|
|
20390
20433
|
if (baseline === this.#graph) {
|
|
20391
20434
|
syncStoreReplacementRef(options?.ref, this);
|
|
@@ -20414,7 +20457,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20414
20457
|
);
|
|
20415
20458
|
}
|
|
20416
20459
|
const identityCandidate = merged.identity === void 0 ? void 0 : this.#cloneWithGraph(merged, void 0);
|
|
20417
|
-
const identityProvisioning = identityCandidate === void 0 ? void 0 : await
|
|
20460
|
+
const identityProvisioning = identityCandidate === void 0 ? void 0 : await chunk3FPR224C_cjs.ensureIdentitySchemaStorage(
|
|
20418
20461
|
this.#baseBackend,
|
|
20419
20462
|
this.#sqlSchema(),
|
|
20420
20463
|
{
|
|
@@ -20423,7 +20466,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20423
20466
|
// The evolved graph's registry — the one the candidate's own
|
|
20424
20467
|
// preflight rebuilds through, so the predicate and the fill agree
|
|
20425
20468
|
// on which assertions count.
|
|
20426
|
-
registry:
|
|
20469
|
+
registry: chunk3FPR224C_cjs.buildKindRegistry(merged)
|
|
20427
20470
|
}
|
|
20428
20471
|
);
|
|
20429
20472
|
const committed = identityCandidate === void 0 ? classification.requireEmpty.length > 0 ? await commitEvolvedSchemaWhenRequiredKindsAreEmpty(
|
|
@@ -20431,7 +20474,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20431
20474
|
merged,
|
|
20432
20475
|
activeRow.version,
|
|
20433
20476
|
classification
|
|
20434
|
-
) : await
|
|
20477
|
+
) : await chunk3FPR224C_cjs.commitNewSchemaVersion(this.#backend, merged, activeRow.version) : await chunk3FPR224C_cjs.commitNewSchemaVersionWithPreflight(
|
|
20435
20478
|
this.#backend,
|
|
20436
20479
|
merged,
|
|
20437
20480
|
activeRow.version,
|
|
@@ -20663,7 +20706,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20663
20706
|
tableName,
|
|
20664
20707
|
declaration
|
|
20665
20708
|
);
|
|
20666
|
-
const now =
|
|
20709
|
+
const now = chunkTQHGE7UC_cjs.nowIso();
|
|
20667
20710
|
await backend.recordIndexMaterialization({
|
|
20668
20711
|
indexName: vectorStatusKey(this.graphId, declaration.name),
|
|
20669
20712
|
graphId: this.graphId,
|
|
@@ -21009,7 +21052,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21009
21052
|
*/
|
|
21010
21053
|
async removeKinds(names, options) {
|
|
21011
21054
|
const { activeRow, baseline } = await this.#loadCaughtUp("remove");
|
|
21012
|
-
const plan =
|
|
21055
|
+
const plan = chunk3FPR224C_cjs.planRemovals(baseline, names);
|
|
21013
21056
|
if (plan.removedNodeKinds.length === 0 && plan.removedEdgeKinds.length === 0) {
|
|
21014
21057
|
if (baseline === this.#graph) {
|
|
21015
21058
|
syncStoreReplacementRef(options?.ref, this);
|
|
@@ -21021,18 +21064,18 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21021
21064
|
schemaMetadataFromRow(activeRow)
|
|
21022
21065
|
);
|
|
21023
21066
|
}
|
|
21024
|
-
const compileTimeGraph =
|
|
21025
|
-
const merged = plan.document === void 0 ? compileTimeGraph :
|
|
21026
|
-
const finalGraph =
|
|
21067
|
+
const compileTimeGraph = chunk3FPR224C_cjs.stripGraphExtension(this.#graph);
|
|
21068
|
+
const merged = plan.document === void 0 ? compileTimeGraph : chunk3FPR224C_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
|
|
21069
|
+
const finalGraph = chunk3FPR224C_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
|
|
21027
21070
|
const identityCascade = await this.#identityRemovalPreflight(
|
|
21028
21071
|
finalGraph,
|
|
21029
21072
|
plan.removedNodeKinds
|
|
21030
21073
|
);
|
|
21031
|
-
const committedRow = identityCascade === void 0 ? await
|
|
21074
|
+
const committedRow = identityCascade === void 0 ? await chunk3FPR224C_cjs.commitNewSchemaVersion(
|
|
21032
21075
|
this.#backend,
|
|
21033
21076
|
finalGraph,
|
|
21034
21077
|
activeRow.version
|
|
21035
|
-
) : await
|
|
21078
|
+
) : await chunk3FPR224C_cjs.commitNewSchemaVersionWithPreflight(
|
|
21036
21079
|
this.#backend,
|
|
21037
21080
|
finalGraph,
|
|
21038
21081
|
activeRow.version,
|
|
@@ -21044,7 +21087,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21044
21087
|
this.#backend,
|
|
21045
21088
|
this.#backend.ensureKindRemovalsTable
|
|
21046
21089
|
);
|
|
21047
|
-
const attemptedAt =
|
|
21090
|
+
const attemptedAt = chunkTQHGE7UC_cjs.nowIso();
|
|
21048
21091
|
const newSchemaVersion = committedRow.version;
|
|
21049
21092
|
const queue = (kindName, entity) => recordKindRemoval(
|
|
21050
21093
|
buildPendingKindRemoval({
|
|
@@ -21090,7 +21133,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21090
21133
|
async #identityRemovalPreflight(finalGraph, removedNodeKinds) {
|
|
21091
21134
|
if (removedNodeKinds.length === 0) return void 0;
|
|
21092
21135
|
const repairClosure = finalGraph.identity !== void 0;
|
|
21093
|
-
if (!repairClosure && !await
|
|
21136
|
+
if (!repairClosure && !await chunk3FPR224C_cjs.identityKindCascadeNeeded(
|
|
21094
21137
|
this.#backend,
|
|
21095
21138
|
this.#sqlSchema(),
|
|
21096
21139
|
this.graphId,
|
|
@@ -21151,8 +21194,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21151
21194
|
schemaMetadataFromRow(activeRow)
|
|
21152
21195
|
);
|
|
21153
21196
|
}
|
|
21154
|
-
const merged =
|
|
21155
|
-
const result = await
|
|
21197
|
+
const merged = chunk3FPR224C_cjs.applyDeprecatedKinds(baseline, nextSet);
|
|
21198
|
+
const result = await chunk3FPR224C_cjs.ensureSchema(this.#backend, merged, {
|
|
21156
21199
|
preloaded: { activeRow, storedSchema },
|
|
21157
21200
|
autoMigrate: true
|
|
21158
21201
|
});
|
|
@@ -21160,9 +21203,9 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21160
21203
|
return this.#cloneWithGraph(merged, options?.ref, metadata);
|
|
21161
21204
|
}
|
|
21162
21205
|
#catchUpToStored(storedSchema) {
|
|
21163
|
-
const compileTimeGraph =
|
|
21164
|
-
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph :
|
|
21165
|
-
return
|
|
21206
|
+
const compileTimeGraph = chunk3FPR224C_cjs.stripGraphExtension(this.#graph);
|
|
21207
|
+
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunk3FPR224C_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
|
|
21208
|
+
return chunk3FPR224C_cjs.applyDeprecatedKinds(
|
|
21166
21209
|
withGraphExtension,
|
|
21167
21210
|
storedSchema.deprecatedKinds
|
|
21168
21211
|
);
|
|
@@ -21180,7 +21223,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21180
21223
|
* serializes the actual commit.
|
|
21181
21224
|
*/
|
|
21182
21225
|
async #loadCaughtUp(verb) {
|
|
21183
|
-
const activeRow = await
|
|
21226
|
+
const activeRow = await chunk3FPR224C_cjs.loadActiveSchemaWithBootstrap(
|
|
21184
21227
|
this.#backend,
|
|
21185
21228
|
this.graphId
|
|
21186
21229
|
);
|
|
@@ -21191,7 +21234,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21191
21234
|
{ code }
|
|
21192
21235
|
);
|
|
21193
21236
|
}
|
|
21194
|
-
const storedSchema =
|
|
21237
|
+
const storedSchema = chunk3FPR224C_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
21195
21238
|
const baseline = this.#catchUpToStored(storedSchema);
|
|
21196
21239
|
return { activeRow, storedSchema, baseline };
|
|
21197
21240
|
}
|
|
@@ -21277,8 +21320,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21277
21320
|
registry: this.#registry,
|
|
21278
21321
|
...identityConfig === void 0 ? {} : {
|
|
21279
21322
|
identity: {
|
|
21280
|
-
lock: (target) =>
|
|
21281
|
-
foldCreated: (target, references) =>
|
|
21323
|
+
lock: (target) => chunkJFRT7S3B_cjs.lockIdentityGraph(target, this.graphId),
|
|
21324
|
+
foldCreated: (target, references) => chunkJFRT7S3B_cjs.foldIdentityForCreatedNodes(
|
|
21282
21325
|
{
|
|
21283
21326
|
graphId: this.graphId,
|
|
21284
21327
|
registry: this.#registry,
|
|
@@ -21288,7 +21331,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21288
21331
|
target,
|
|
21289
21332
|
references
|
|
21290
21333
|
),
|
|
21291
|
-
detachDeleted: (target, ref, mode) =>
|
|
21334
|
+
detachDeleted: (target, ref, mode) => chunkJFRT7S3B_cjs.detachIdentityForNode(
|
|
21292
21335
|
{
|
|
21293
21336
|
graphId: this.graphId,
|
|
21294
21337
|
sameIdAcrossKinds: identityConfig.sameIdAcrossKinds,
|
|
@@ -21298,7 +21341,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21298
21341
|
ref,
|
|
21299
21342
|
mode
|
|
21300
21343
|
),
|
|
21301
|
-
requireValidityEndCompatible: (target, ref, validTo) =>
|
|
21344
|
+
requireValidityEndCompatible: (target, ref, validTo) => chunkJFRT7S3B_cjs.requireNodeValidityEndCompatible(
|
|
21302
21345
|
{
|
|
21303
21346
|
graphId: this.graphId,
|
|
21304
21347
|
schema: this.#sqlSchema()
|
|
@@ -21344,7 +21387,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21344
21387
|
* query builder submits to the backend. A selective-projection retry
|
|
21345
21388
|
* therefore emits two independent start/end pairs with their actual SQL.
|
|
21346
21389
|
*
|
|
21347
|
-
* Decoration goes through {@link
|
|
21390
|
+
* Decoration goes through {@link deriveBackend}, which carries the
|
|
21348
21391
|
* projection's serialized-resource ownership: the hooked backend still
|
|
21349
21392
|
* executes on the source's connection, so it must answer the same "shares one
|
|
21350
21393
|
* serialized connection" question as its source.
|
|
@@ -21355,8 +21398,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21355
21398
|
}
|
|
21356
21399
|
const executeRaw = backend.executeRaw;
|
|
21357
21400
|
const compileSql = backend.compileSql;
|
|
21358
|
-
const projected =
|
|
21359
|
-
return
|
|
21401
|
+
const projected = chunkSIT26LAZ_cjs.projectGraphBackend(backend);
|
|
21402
|
+
return chunkSIT26LAZ_cjs.deriveBackend(projected, {
|
|
21360
21403
|
execute: (query) => {
|
|
21361
21404
|
const compiled = compileSql === void 0 ? chunkEDN4Y4ZG_cjs.renderSql(query, backend.dialect) : compileSql(query);
|
|
21362
21405
|
return this.#withQueryHooks(
|
|
@@ -21396,7 +21439,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21396
21439
|
}
|
|
21397
21440
|
#createHookContext() {
|
|
21398
21441
|
return {
|
|
21399
|
-
operationId:
|
|
21442
|
+
operationId: chunkEZEEWCFJ_cjs.generateId(),
|
|
21400
21443
|
graphId: this.graphId,
|
|
21401
21444
|
startedAt: /* @__PURE__ */ new Date()
|
|
21402
21445
|
};
|
|
@@ -21497,12 +21540,12 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21497
21540
|
switch (temporalMode) {
|
|
21498
21541
|
case "current":
|
|
21499
21542
|
case "asOf": {
|
|
21500
|
-
if (row.deleted_at) return false;
|
|
21501
|
-
|
|
21502
|
-
|
|
21503
|
-
|
|
21504
|
-
|
|
21505
|
-
|
|
21543
|
+
if (row.deleted_at || asOf === void 0) return false;
|
|
21544
|
+
return chunkTQHGE7UC_cjs.validityWindowContainsInstant(
|
|
21545
|
+
row.valid_from,
|
|
21546
|
+
row.valid_to,
|
|
21547
|
+
asOf
|
|
21548
|
+
);
|
|
21506
21549
|
}
|
|
21507
21550
|
case "includeEnded": {
|
|
21508
21551
|
return !row.deleted_at;
|
|
@@ -21537,9 +21580,7 @@ var AdapterStoreImplementation = class _AdapterStoreImplementation extends Store
|
|
|
21537
21580
|
backend;
|
|
21538
21581
|
constructor(graph, backend, options, schemaMetadata) {
|
|
21539
21582
|
super(graph, backend, options, schemaMetadata, backend);
|
|
21540
|
-
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[
|
|
21541
|
-
chunkOIFSOPSR_cjs.createGraphBackendProjection(this[chunkMFZR4QKM_cjs.STORE_RUNTIME].backend)
|
|
21542
|
-
);
|
|
21583
|
+
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[chunk3KOY4FH3_cjs.STORE_RUNTIME].backend) : Object.freeze(chunkSIT26LAZ_cjs.projectGraphBackend(this[chunk3KOY4FH3_cjs.STORE_RUNTIME].backend));
|
|
21543
21584
|
}
|
|
21544
21585
|
/**
|
|
21545
21586
|
* Rebind this store's already-reconciled schema onto a fresh backend/
|
|
@@ -21731,7 +21772,7 @@ async function createStoreWithSchema(graph, backend, options) {
|
|
|
21731
21772
|
async function assertHistorySchemaOnOpen(backend, graph, options) {
|
|
21732
21773
|
if (options?.history !== true) return;
|
|
21733
21774
|
const schema = options.schema === void 0 ? chunk3U5ABFDW_cjs.createSqlSchema(backend.tableNames) : chunk3U5ABFDW_cjs.requireSqlSchema(options.schema, "store schema");
|
|
21734
|
-
await
|
|
21775
|
+
await chunkEZEEWCFJ_cjs.assertCurrentRecordedSchema(
|
|
21735
21776
|
backend,
|
|
21736
21777
|
schema,
|
|
21737
21778
|
graph.identity !== void 0
|
|
@@ -21758,7 +21799,7 @@ var IDENTITY_GATE_CODES = {
|
|
|
21758
21799
|
};
|
|
21759
21800
|
async function ensureSchemaWithIdentityPrecedence(backend, graph, options, gate) {
|
|
21760
21801
|
try {
|
|
21761
|
-
return await
|
|
21802
|
+
return await chunk3FPR224C_cjs.ensureSchema(backend, graph, options);
|
|
21762
21803
|
} catch (error) {
|
|
21763
21804
|
if (gate === void 0 || !isIdentityOnlyBreakingChange(error)) throw error;
|
|
21764
21805
|
throw identityMigrationRequiredError(graph.id, gate, {
|
|
@@ -21798,20 +21839,20 @@ async function prepareStoreWithSchema(graph, backend, options) {
|
|
|
21798
21839
|
graph: merged,
|
|
21799
21840
|
activeRow,
|
|
21800
21841
|
storedSchema
|
|
21801
|
-
} = await
|
|
21842
|
+
} = await chunk3FPR224C_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
|
|
21802
21843
|
const identityProfileChanged = activeRow !== void 0 && storedSchema?.identity?.sameIdAcrossKinds !== merged.identity?.sameIdAcrossKinds;
|
|
21803
21844
|
const identityInitialization = activeRow === void 0 && merged.identity !== void 0;
|
|
21804
21845
|
const identityEnablement = identityInitialization || identityProfileChanged && storedSchema?.identity === void 0 && merged.identity !== void 0;
|
|
21805
21846
|
const identitySemanticsChanged = identityProfileChanged || activeRow !== void 0 && storedSchema !== void 0 && merged.identity !== void 0 && identityOntologyChanged(
|
|
21806
21847
|
storedSchema,
|
|
21807
|
-
|
|
21848
|
+
chunk3FPR224C_cjs.serializeSchema(merged, activeRow.version + 1)
|
|
21808
21849
|
);
|
|
21809
21850
|
const identityGate = identitySemanticsChanged ? identityEnablement ? "enablement" : identityProfileChanged ? "profile" : "ontology" : void 0;
|
|
21810
21851
|
const identityProfile = merged.identity;
|
|
21811
21852
|
if (identityProfile !== void 0) {
|
|
21812
21853
|
const resolvedIdentitySchema = options?.schema === void 0 ? chunk3U5ABFDW_cjs.createSqlSchema(backend.tableNames) : chunk3U5ABFDW_cjs.requireSqlSchema(options.schema, "store schema");
|
|
21813
|
-
const identityRegistry =
|
|
21814
|
-
await
|
|
21854
|
+
const identityRegistry = chunk3FPR224C_cjs.buildKindRegistry(merged);
|
|
21855
|
+
await chunk3FPR224C_cjs.ensureIdentitySchemaStorage(backend, resolvedIdentitySchema, {
|
|
21815
21856
|
graphId: merged.id,
|
|
21816
21857
|
enablement: identityEnablement,
|
|
21817
21858
|
registry: identityRegistry,
|
|
@@ -21832,7 +21873,7 @@ async function prepareStoreWithSchema(graph, backend, options) {
|
|
|
21832
21873
|
// the relation absent rather than readable-empty, and the next open of a
|
|
21833
21874
|
// graph whose semantics ARE committed heals it here.
|
|
21834
21875
|
...identityGate === void 0 ? {
|
|
21835
|
-
recomputeDerivedRelations: (target) =>
|
|
21876
|
+
recomputeDerivedRelations: (target) => chunkJFRT7S3B_cjs.rebuildIdentityClosureForContext({
|
|
21836
21877
|
backend: target,
|
|
21837
21878
|
graphId: merged.id,
|
|
21838
21879
|
registry: identityRegistry,
|
|
@@ -21928,7 +21969,7 @@ async function prepareVerifiedStore(graph, backend, options) {
|
|
|
21928
21969
|
graph: merged,
|
|
21929
21970
|
activeRow,
|
|
21930
21971
|
result
|
|
21931
|
-
} = await
|
|
21972
|
+
} = await chunk3FPR224C_cjs.loadAndVerifyGraph(backend, graph);
|
|
21932
21973
|
await assertHistorySchemaOnOpen(backend, merged, options);
|
|
21933
21974
|
return {
|
|
21934
21975
|
graph: merged,
|
|
@@ -21986,5 +22027,5 @@ exports.min = min;
|
|
|
21986
22027
|
exports.offsetFragment = offsetFragment;
|
|
21987
22028
|
exports.orderByFragment = orderByFragment;
|
|
21988
22029
|
exports.sum = sum;
|
|
21989
|
-
//# sourceMappingURL=chunk-
|
|
21990
|
-
//# sourceMappingURL=chunk-
|
|
22030
|
+
//# sourceMappingURL=chunk-SR725PWF.cjs.map
|
|
22031
|
+
//# sourceMappingURL=chunk-SR725PWF.cjs.map
|