@nicia-ai/typegraph 0.38.0 → 0.39.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/postgres/index.cjs +16 -16
- package/dist/backend/postgres/index.js +3 -3
- package/dist/backend/postgres/pglite-store.cjs +11 -11
- package/dist/backend/postgres/pglite-store.d.cts +1 -1
- package/dist/backend/postgres/pglite-store.d.ts +1 -1
- package/dist/backend/postgres/pglite-store.js +8 -8
- package/dist/backend/postgres/pglite.cjs +5 -5
- package/dist/backend/postgres/pglite.js +4 -4
- package/dist/backend/sqlite/index.cjs +6 -6
- package/dist/backend/sqlite/index.js +3 -3
- package/dist/backend/sqlite/libsql.cjs +5 -5
- package/dist/backend/sqlite/libsql.js +3 -3
- package/dist/backend/sqlite/local-store.cjs +11 -11
- package/dist/backend/sqlite/local-store.d.cts +1 -1
- package/dist/backend/sqlite/local-store.d.ts +1 -1
- package/dist/backend/sqlite/local-store.js +9 -9
- package/dist/backend/sqlite/local.cjs +6 -6
- package/dist/backend/sqlite/local.js +4 -4
- package/dist/{chunk-UPXDVI3T.js → chunk-3SK4SVTW.js} +3 -3
- package/dist/{chunk-UPXDVI3T.js.map → chunk-3SK4SVTW.js.map} +1 -1
- package/dist/{chunk-NU23DUSJ.cjs → chunk-3YFDFOYB.cjs} +7 -7
- package/dist/{chunk-NU23DUSJ.cjs.map → chunk-3YFDFOYB.cjs.map} +1 -1
- package/dist/{chunk-NWYCOFEZ.cjs → chunk-5ELKD2FQ.cjs} +4 -4
- package/dist/chunk-5ELKD2FQ.cjs.map +1 -0
- package/dist/{chunk-2SL7OGPR.cjs → chunk-6SRLCSAV.cjs} +478 -338
- package/dist/chunk-6SRLCSAV.cjs.map +1 -0
- package/dist/{chunk-A2FGSWMQ.js → chunk-CBK2IVI2.js} +167 -27
- package/dist/chunk-CBK2IVI2.js.map +1 -0
- package/dist/{chunk-TE5ZA4VX.js → chunk-DOKUXLFH.js} +14 -10
- package/dist/chunk-DOKUXLFH.js.map +1 -0
- package/dist/{chunk-KCLZHYPU.cjs → chunk-E2Q7SP2K.cjs} +52 -52
- package/dist/{chunk-KCLZHYPU.cjs.map → chunk-E2Q7SP2K.cjs.map} +1 -1
- package/dist/{chunk-YLINFV7Z.cjs → chunk-GKQU44SQ.cjs} +67 -63
- package/dist/chunk-GKQU44SQ.cjs.map +1 -0
- package/dist/{chunk-O5H62ZWJ.cjs → chunk-HP6LWBLB.cjs} +14 -2
- package/dist/chunk-HP6LWBLB.cjs.map +1 -0
- package/dist/{chunk-7VLCN3JB.cjs → chunk-HTQOBY75.cjs} +59 -59
- package/dist/{chunk-7VLCN3JB.cjs.map → chunk-HTQOBY75.cjs.map} +1 -1
- package/dist/{chunk-RQPRCEIO.js → chunk-IFDXG2YJ.js} +3 -3
- package/dist/chunk-IFDXG2YJ.js.map +1 -0
- package/dist/{chunk-YJDSPA5E.js → chunk-IFRPHG7O.js} +4 -4
- package/dist/{chunk-YJDSPA5E.js.map → chunk-IFRPHG7O.js.map} +1 -1
- package/dist/{chunk-LZ3TVJY4.cjs → chunk-JD2YC62H.cjs} +17 -17
- package/dist/{chunk-LZ3TVJY4.cjs.map → chunk-JD2YC62H.cjs.map} +1 -1
- package/dist/{chunk-XD6X7O5R.js → chunk-KAFXPB2L.js} +4 -4
- package/dist/{chunk-XD6X7O5R.js.map → chunk-KAFXPB2L.js.map} +1 -1
- package/dist/{chunk-ZHX4KEM7.cjs → chunk-KIZSHRUI.cjs} +7 -7
- package/dist/{chunk-ZHX4KEM7.cjs.map → chunk-KIZSHRUI.cjs.map} +1 -1
- package/dist/{chunk-G32AO634.js → chunk-KXFUQNF2.js} +3 -3
- package/dist/{chunk-G32AO634.js.map → chunk-KXFUQNF2.js.map} +1 -1
- package/dist/{chunk-E6YZRKMM.js → chunk-NQBYTLPW.js} +4 -4
- package/dist/{chunk-E6YZRKMM.js.map → chunk-NQBYTLPW.js.map} +1 -1
- package/dist/{chunk-VBH7ZXSZ.js → chunk-SU7VQOJ3.js} +3 -3
- package/dist/{chunk-VBH7ZXSZ.js.map → chunk-SU7VQOJ3.js.map} +1 -1
- package/dist/{chunk-KFLXWVUJ.js → chunk-UUIBACKJ.js} +14 -3
- package/dist/chunk-UUIBACKJ.js.map +1 -0
- package/dist/{chunk-CQC6VBAF.cjs → chunk-VXAFOF6Z.cjs} +5 -5
- package/dist/{chunk-CQC6VBAF.cjs.map → chunk-VXAFOF6Z.cjs.map} +1 -1
- package/dist/{chunk-XFY73JWD.cjs → chunk-Y6UA55YS.cjs} +5 -5
- package/dist/{chunk-XFY73JWD.cjs.map → chunk-Y6UA55YS.cjs.map} +1 -1
- package/dist/{chunk-6G5CQ6JX.js → chunk-YPUNPG2T.js} +4 -4
- package/dist/{chunk-6G5CQ6JX.js.map → chunk-YPUNPG2T.js.map} +1 -1
- package/dist/graph-merge/index.cjs +30 -32
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +10 -5
- package/dist/graph-merge/index.d.ts +10 -5
- package/dist/graph-merge/index.js +9 -11
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/index.cjs +68 -68
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/interchange/index.cjs +23 -23
- package/dist/interchange/index.d.cts +1 -1
- package/dist/interchange/index.d.ts +1 -1
- package/dist/interchange/index.js +4 -4
- package/dist/profiler/index.d.cts +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/provenance/index.cjs +11 -11
- package/dist/provenance/index.d.cts +1 -1
- package/dist/provenance/index.d.ts +1 -1
- package/dist/provenance/index.js +2 -2
- package/dist/schema/index.cjs +22 -22
- package/dist/schema/index.js +3 -3
- package/dist/{store-view-BoHqdHjB.d.cts → store-view-BJd6Vwpt.d.cts} +39 -17
- package/dist/{store-view-Ctq-3OHy.d.ts → store-view-CLIhwMMX.d.ts} +39 -17
- package/package.json +1 -1
- package/dist/chunk-2SL7OGPR.cjs.map +0 -1
- package/dist/chunk-A2FGSWMQ.js.map +0 -1
- package/dist/chunk-KFLXWVUJ.js.map +0 -1
- package/dist/chunk-NWYCOFEZ.cjs.map +0 -1
- package/dist/chunk-O5H62ZWJ.cjs.map +0 -1
- package/dist/chunk-RQPRCEIO.js.map +0 -1
- package/dist/chunk-TE5ZA4VX.js.map +0 -1
- package/dist/chunk-YLINFV7Z.cjs.map +0 -1
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkTRF4EBJT_cjs = require('./chunk-TRF4EBJT.cjs');
|
|
4
4
|
var chunkE6TXEISH_cjs = require('./chunk-E6TXEISH.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkE2Q7SP2K_cjs = require('./chunk-E2Q7SP2K.cjs');
|
|
6
|
+
var chunk5ELKD2FQ_cjs = require('./chunk-5ELKD2FQ.cjs');
|
|
7
7
|
var chunkZDH3DX3C_cjs = require('./chunk-ZDH3DX3C.cjs');
|
|
8
8
|
var chunkGNPGGLAE_cjs = require('./chunk-GNPGGLAE.cjs');
|
|
9
9
|
var chunkSVUKGWSN_cjs = require('./chunk-SVUKGWSN.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkVXAFOF6Z_cjs = require('./chunk-VXAFOF6Z.cjs');
|
|
11
11
|
var chunkRW24SAHI_cjs = require('./chunk-RW24SAHI.cjs');
|
|
12
12
|
var chunkX4PVHAZ6_cjs = require('./chunk-X4PVHAZ6.cjs');
|
|
13
13
|
var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
|
|
14
|
-
var
|
|
14
|
+
var chunkHP6LWBLB_cjs = require('./chunk-HP6LWBLB.cjs');
|
|
15
15
|
var chunkNT6ILURI_cjs = require('./chunk-NT6ILURI.cjs');
|
|
16
16
|
var chunkDDCYVIVV_cjs = require('./chunk-DDCYVIVV.cjs');
|
|
17
17
|
var chunkCWX77JB4_cjs = require('./chunk-CWX77JB4.cjs');
|
|
@@ -185,7 +185,7 @@ function createBatchReadRefusal(entity, method, coordinate) {
|
|
|
185
185
|
function createRecordedUnsupportedRefusal(entity, method, coordinate) {
|
|
186
186
|
return () => Promise.reject(
|
|
187
187
|
new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
188
|
-
`'${method}' is not available on a RecordedStoreView (${chunkSVUKGWSN_cjs.describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and
|
|
188
|
+
`'${method}' is not available on a RecordedStoreView (${chunkSVUKGWSN_cjs.describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and collection getById/getByIds/scan reads.`,
|
|
189
189
|
{
|
|
190
190
|
code: "RECORDED_STORE_VIEW_UNSUPPORTED",
|
|
191
191
|
entity,
|
|
@@ -315,15 +315,17 @@ function pinnedEdgeCollectionsFor(store, coordinate, wrap) {
|
|
|
315
315
|
}
|
|
316
316
|
function recordedNodeCollection(store, kind, live, coordinate) {
|
|
317
317
|
const reads = {
|
|
318
|
-
getById: (id) =>
|
|
319
|
-
getByIds: (ids) =>
|
|
318
|
+
getById: (id) => chunk5ELKD2FQ_cjs.storeRuntime(store).recordedNodeGetById(kind, id, coordinate),
|
|
319
|
+
getByIds: (ids) => chunk5ELKD2FQ_cjs.storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate),
|
|
320
|
+
scan: (options) => chunk5ELKD2FQ_cjs.storeRuntime(store).recordedNodeScan(kind, coordinate, options)
|
|
320
321
|
};
|
|
321
322
|
return recordedCollectionProxy(reads, live, coordinate, "node");
|
|
322
323
|
}
|
|
323
324
|
function recordedEdgeCollection(store, kind, live, coordinate) {
|
|
324
325
|
const reads = {
|
|
325
|
-
getById: (id) =>
|
|
326
|
-
getByIds: (ids) =>
|
|
326
|
+
getById: (id) => chunk5ELKD2FQ_cjs.storeRuntime(store).recordedEdgeGetById(kind, id, coordinate),
|
|
327
|
+
getByIds: (ids) => chunk5ELKD2FQ_cjs.storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate),
|
|
328
|
+
scan: (options) => chunk5ELKD2FQ_cjs.storeRuntime(store).recordedEdgeScan(kind, coordinate, options)
|
|
327
329
|
};
|
|
328
330
|
return recordedCollectionProxy(reads, live, coordinate, "edge");
|
|
329
331
|
}
|
|
@@ -423,10 +425,10 @@ var CoordinatePinnedView = class {
|
|
|
423
425
|
* view's coordinate cannot be overridden on a per-query basis.
|
|
424
426
|
*/
|
|
425
427
|
query() {
|
|
426
|
-
return
|
|
428
|
+
return chunk5ELKD2FQ_cjs.storeRuntime(this.store).sealedQuery(this.coordinate);
|
|
427
429
|
}
|
|
428
430
|
internalAlgorithms() {
|
|
429
|
-
this.#internalAlgorithms ??=
|
|
431
|
+
this.#internalAlgorithms ??= chunk5ELKD2FQ_cjs.storeRuntime(
|
|
430
432
|
this.store
|
|
431
433
|
).algorithmsAtCoordinate(this.coordinate);
|
|
432
434
|
return this.#internalAlgorithms;
|
|
@@ -453,7 +455,7 @@ var CoordinatePinnedView = class {
|
|
|
453
455
|
...options,
|
|
454
456
|
...withCoordinate(this.coordinate)
|
|
455
457
|
};
|
|
456
|
-
return
|
|
458
|
+
return chunk5ELKD2FQ_cjs.storeRuntime(this.store).subgraphAtCoordinate(
|
|
457
459
|
rootId,
|
|
458
460
|
internalOptions
|
|
459
461
|
);
|
|
@@ -621,7 +623,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
|
|
|
621
623
|
}
|
|
622
624
|
return recorded.asOf;
|
|
623
625
|
}
|
|
624
|
-
/** Recorded-time node
|
|
626
|
+
/** Recorded-time node reconstructing-read collections. */
|
|
625
627
|
get nodes() {
|
|
626
628
|
this.#nodes ??= pinnedNodeCollectionsFor(
|
|
627
629
|
this.store,
|
|
@@ -630,7 +632,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
|
|
|
630
632
|
);
|
|
631
633
|
return this.#nodes;
|
|
632
634
|
}
|
|
633
|
-
/** Recorded-time edge
|
|
635
|
+
/** Recorded-time edge reconstructing-read collections. */
|
|
634
636
|
get edges() {
|
|
635
637
|
this.#edges ??= pinnedEdgeCollectionsFor(
|
|
636
638
|
this.store,
|
|
@@ -1117,7 +1119,7 @@ function markSelectiveFieldAsRequired(requiredColumnsByAlias, field2) {
|
|
|
1117
1119
|
addRequiredColumn(requiredColumnsByAlias, field2.alias, "props");
|
|
1118
1120
|
}
|
|
1119
1121
|
function getTopLevelPropsFieldName(field2) {
|
|
1120
|
-
const pointer =
|
|
1122
|
+
const pointer = chunk5ELKD2FQ_cjs.getFieldPointer(field2);
|
|
1121
1123
|
if (pointer === void 0) return void 0;
|
|
1122
1124
|
const segments = chunkTDXIBCGY_cjs.parseJsonPointer(pointer);
|
|
1123
1125
|
return segments.length === 1 ? segments[0] : void 0;
|
|
@@ -1156,7 +1158,7 @@ function selectivePropsCteColumnName(field2) {
|
|
|
1156
1158
|
return boundPgIdentifier(encoded, `${alias}\0${fieldName}`);
|
|
1157
1159
|
}
|
|
1158
1160
|
function buildScopedNodeIdsSubquery(nodeAlias) {
|
|
1159
|
-
const cteAlias = `${
|
|
1161
|
+
const cteAlias = `${chunk5ELKD2FQ_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`;
|
|
1160
1162
|
return chunkX6RDQ5NB_cjs.sql`
|
|
1161
1163
|
(
|
|
1162
1164
|
SELECT DISTINCT
|
|
@@ -1218,11 +1220,11 @@ function buildStandardStartCte(input) {
|
|
|
1218
1220
|
const alias = ast.start.alias;
|
|
1219
1221
|
const kinds = ast.start.kinds;
|
|
1220
1222
|
const cteMaterialization = ctx.dialect.capabilities.emitNotMaterializedHint ? chunkX6RDQ5NB_cjs.sql`NOT MATERIALIZED ` : chunkX6RDQ5NB_cjs.sql``;
|
|
1221
|
-
const kindFilter =
|
|
1223
|
+
const kindFilter = chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("kind"), kinds);
|
|
1222
1224
|
const temporalFilter = input.temporalFilterPass.forAlias();
|
|
1223
1225
|
const cteContext = { ...ctx, cteColumnPrefix: "" };
|
|
1224
|
-
const predicateClauses =
|
|
1225
|
-
|
|
1226
|
+
const predicateClauses = chunk5ELKD2FQ_cjs.compilePredicateClauses(
|
|
1227
|
+
chunk5ELKD2FQ_cjs.getPredicatesForAlias(predicateIndex, alias, "node"),
|
|
1226
1228
|
cteContext
|
|
1227
1229
|
);
|
|
1228
1230
|
const whereClauses = [
|
|
@@ -1269,27 +1271,27 @@ function buildStandardTraversalCte(input) {
|
|
|
1269
1271
|
} = input;
|
|
1270
1272
|
const traversal = chunk764JHTLT_cjs.requireDefined(ast.traversals[traversalIndex]);
|
|
1271
1273
|
const traversalLimitValue = traversalIndex === ast.traversals.length - 1 ? traversalLimit : void 0;
|
|
1272
|
-
const previousNodeKinds =
|
|
1274
|
+
const previousNodeKinds = chunk5ELKD2FQ_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
1273
1275
|
const directEdgeKinds = [...new Set(traversal.edgeKinds)];
|
|
1274
1276
|
const inverseEdgeKinds = traversal.inverseEdgeKinds === void 0 ? [] : [...new Set(traversal.inverseEdgeKinds)];
|
|
1275
1277
|
const nodeKinds = traversal.nodeKinds;
|
|
1276
|
-
const nodeKindFilter =
|
|
1278
|
+
const nodeKindFilter = chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("n.kind"), nodeKinds);
|
|
1277
1279
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
1278
1280
|
const nodeTemporalFilter = temporalFilterPass.forAlias("n");
|
|
1279
1281
|
const nodeCteContext = {
|
|
1280
1282
|
...ctx,
|
|
1281
1283
|
cteColumnPrefix: "n"
|
|
1282
1284
|
};
|
|
1283
|
-
const nodePredicateClauses =
|
|
1284
|
-
|
|
1285
|
+
const nodePredicateClauses = chunk5ELKD2FQ_cjs.compilePredicateClauses(
|
|
1286
|
+
chunk5ELKD2FQ_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
1285
1287
|
nodeCteContext
|
|
1286
1288
|
);
|
|
1287
1289
|
const edgeCteContext = {
|
|
1288
1290
|
...ctx,
|
|
1289
1291
|
cteColumnPrefix: "e"
|
|
1290
1292
|
};
|
|
1291
|
-
const edgePredicateClauses =
|
|
1292
|
-
|
|
1293
|
+
const edgePredicateClauses = chunk5ELKD2FQ_cjs.compilePredicateClauses(
|
|
1294
|
+
chunk5ELKD2FQ_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
1293
1295
|
edgeCteContext
|
|
1294
1296
|
);
|
|
1295
1297
|
const baseWhereClauses = [
|
|
@@ -1330,12 +1332,12 @@ function buildStandardTraversalCte(input) {
|
|
|
1330
1332
|
function compileTraversalBranch(branch) {
|
|
1331
1333
|
const whereClauses = [
|
|
1332
1334
|
...baseWhereClauses,
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("e.kind"), branch.edgeKinds),
|
|
1336
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(
|
|
1335
1337
|
chunkX6RDQ5NB_cjs.sql.raw(`e.${branch.joinKindField}`),
|
|
1336
1338
|
previousNodeKinds
|
|
1337
1339
|
),
|
|
1338
|
-
|
|
1340
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw(`e.${branch.targetKindField}`), nodeKinds)
|
|
1339
1341
|
];
|
|
1340
1342
|
if (branch.duplicateGuard !== void 0) {
|
|
1341
1343
|
whereClauses.push(branch.duplicateGuard);
|
|
@@ -1386,7 +1388,7 @@ function buildStandardTraversalCte(input) {
|
|
|
1386
1388
|
const overlappingKinds = inverseEdgeKinds.filter(
|
|
1387
1389
|
(kind) => directEdgeKinds.includes(kind)
|
|
1388
1390
|
);
|
|
1389
|
-
const duplicateGuard = overlappingKinds.length > 0 ? chunkX6RDQ5NB_cjs.sql`NOT (e.from_id = e.to_id AND ${
|
|
1391
|
+
const duplicateGuard = overlappingKinds.length > 0 ? chunkX6RDQ5NB_cjs.sql`NOT (e.from_id = e.to_id AND ${chunk5ELKD2FQ_cjs.compileKindFilter(
|
|
1390
1392
|
chunkX6RDQ5NB_cjs.sql.raw("e.kind"),
|
|
1391
1393
|
overlappingKinds
|
|
1392
1394
|
)})` : void 0;
|
|
@@ -1429,7 +1431,7 @@ function compileAggregateExprFromSource(expr, dialect) {
|
|
|
1429
1431
|
case "min":
|
|
1430
1432
|
case "max": {
|
|
1431
1433
|
const cteAlias = `cte_${field2.alias}`;
|
|
1432
|
-
const column =
|
|
1434
|
+
const column = chunk5ELKD2FQ_cjs.compileFieldValue(
|
|
1433
1435
|
field2,
|
|
1434
1436
|
dialect,
|
|
1435
1437
|
field2.valueType,
|
|
@@ -1452,7 +1454,7 @@ function compileProjectedSource(field2, dialect) {
|
|
|
1452
1454
|
return compileAggregateExprFromSource(field2.source, dialect);
|
|
1453
1455
|
}
|
|
1454
1456
|
const cteAlias = field2.cteAlias ?? `cte_${field2.source.alias}`;
|
|
1455
|
-
return
|
|
1457
|
+
return chunk5ELKD2FQ_cjs.compileFieldValue(
|
|
1456
1458
|
field2.source,
|
|
1457
1459
|
dialect,
|
|
1458
1460
|
field2.source.valueType,
|
|
@@ -1508,43 +1510,43 @@ function compileOrderFieldValue(ast, field2, dialect, cteAlias) {
|
|
|
1508
1510
|
if (selectiveField !== void 0) {
|
|
1509
1511
|
return chunkX6RDQ5NB_cjs.sql`${chunkX6RDQ5NB_cjs.sql.raw(cteAlias)}.${quoteIdentifier(selectivePropsCteColumnName(selectiveField))}`;
|
|
1510
1512
|
}
|
|
1511
|
-
return
|
|
1513
|
+
return chunk5ELKD2FQ_cjs.compileFieldValue(field2, dialect, field2.valueType, cteAlias);
|
|
1512
1514
|
}
|
|
1513
1515
|
function buildRelevanceJoins(vectorPredicate, fulltextPredicate) {
|
|
1514
|
-
const hybridTargetAlias =
|
|
1516
|
+
const hybridTargetAlias = chunk5ELKD2FQ_cjs.getHybridTargetAlias(
|
|
1515
1517
|
vectorPredicate,
|
|
1516
1518
|
fulltextPredicate
|
|
1517
1519
|
);
|
|
1518
1520
|
if (hybridTargetAlias !== void 0) {
|
|
1519
1521
|
return [
|
|
1520
1522
|
buildHybridCandidateJoin(hybridTargetAlias),
|
|
1521
|
-
buildRelevanceJoin(
|
|
1522
|
-
buildRelevanceJoin(
|
|
1523
|
+
buildRelevanceJoin(chunk5ELKD2FQ_cjs.EMBEDDINGS_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN"),
|
|
1524
|
+
buildRelevanceJoin(chunk5ELKD2FQ_cjs.FULLTEXT_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN")
|
|
1523
1525
|
];
|
|
1524
1526
|
}
|
|
1525
1527
|
const joins = [];
|
|
1526
1528
|
if (vectorPredicate) {
|
|
1527
1529
|
joins.push(
|
|
1528
|
-
buildRelevanceJoin(
|
|
1530
|
+
buildRelevanceJoin(chunk5ELKD2FQ_cjs.EMBEDDINGS_CTE_ALIAS, vectorPredicate.field.alias)
|
|
1529
1531
|
);
|
|
1530
1532
|
}
|
|
1531
1533
|
if (fulltextPredicate) {
|
|
1532
1534
|
joins.push(
|
|
1533
|
-
buildRelevanceJoin(
|
|
1535
|
+
buildRelevanceJoin(chunk5ELKD2FQ_cjs.FULLTEXT_CTE_ALIAS, fulltextPredicate.field.alias)
|
|
1534
1536
|
);
|
|
1535
1537
|
}
|
|
1536
1538
|
return joins;
|
|
1537
1539
|
}
|
|
1538
1540
|
function buildHybridCandidateJoin(nodeAlias) {
|
|
1539
|
-
const candidateCte = chunkX6RDQ5NB_cjs.sql.raw(
|
|
1540
|
-
const node = chunkX6RDQ5NB_cjs.sql.raw(`${
|
|
1541
|
+
const candidateCte = chunkX6RDQ5NB_cjs.sql.raw(chunk5ELKD2FQ_cjs.HYBRID_CANDIDATES_CTE_ALIAS);
|
|
1542
|
+
const node = chunkX6RDQ5NB_cjs.sql.raw(`${chunk5ELKD2FQ_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
|
|
1541
1543
|
const idColumn = chunkX6RDQ5NB_cjs.sql.raw(`${nodeAlias}_id`);
|
|
1542
1544
|
const kindColumn = chunkX6RDQ5NB_cjs.sql.raw(`${nodeAlias}_kind`);
|
|
1543
1545
|
return chunkX6RDQ5NB_cjs.sql`INNER JOIN ${candidateCte} ON ${candidateCte}.node_id = ${node}.${idColumn} AND ${candidateCte}.node_kind = ${node}.${kindColumn}`;
|
|
1544
1546
|
}
|
|
1545
1547
|
function buildRelevanceJoin(cteAlias, nodeAlias, joinType = "INNER JOIN") {
|
|
1546
1548
|
const cte = chunkX6RDQ5NB_cjs.sql.raw(cteAlias);
|
|
1547
|
-
const node = chunkX6RDQ5NB_cjs.sql.raw(`${
|
|
1549
|
+
const node = chunkX6RDQ5NB_cjs.sql.raw(`${chunk5ELKD2FQ_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
|
|
1548
1550
|
const idColumn = chunkX6RDQ5NB_cjs.sql.raw(`${nodeAlias}_id`);
|
|
1549
1551
|
const kindColumn = chunkX6RDQ5NB_cjs.sql.raw(`${nodeAlias}_kind`);
|
|
1550
1552
|
return chunkX6RDQ5NB_cjs.sql`${chunkX6RDQ5NB_cjs.sql.raw(joinType)} ${cte} ON ${cte}.node_id = ${node}.${idColumn} AND ${cte}.node_kind = ${node}.${kindColumn}`;
|
|
@@ -1641,7 +1643,7 @@ function lateMaterializedProjectedNodeAliases(ast) {
|
|
|
1641
1643
|
function buildLateMaterializedTopKCte(input) {
|
|
1642
1644
|
const { ast, collapsedTraversalCteAlias, dialect, fromClause } = input;
|
|
1643
1645
|
const aliasToCte = buildAliasToCteMap(ast);
|
|
1644
|
-
const cteAliasFor = (alias) => collapsedTraversalCteAlias ?? aliasToCte.get(alias) ?? `${
|
|
1646
|
+
const cteAliasFor = (alias) => collapsedTraversalCteAlias ?? aliasToCte.get(alias) ?? `${chunk5ELKD2FQ_cjs.ALIAS_CTE_PREFIX}${alias}`;
|
|
1645
1647
|
const columns = [];
|
|
1646
1648
|
for (const alias of lateMaterializedNodeAliases(ast)) {
|
|
1647
1649
|
const cteAlias = cteAliasFor(alias);
|
|
@@ -1752,7 +1754,7 @@ function buildStandardGroupBy(input) {
|
|
|
1752
1754
|
}
|
|
1753
1755
|
const aliasToCte = buildAliasToCteMap(ast);
|
|
1754
1756
|
const parts = allFields.map(
|
|
1755
|
-
(field2) =>
|
|
1757
|
+
(field2) => chunk5ELKD2FQ_cjs.compileFieldValue(
|
|
1756
1758
|
field2,
|
|
1757
1759
|
dialect,
|
|
1758
1760
|
field2.valueType,
|
|
@@ -1766,7 +1768,7 @@ function buildStandardHaving(input) {
|
|
|
1766
1768
|
if (!ast.having) {
|
|
1767
1769
|
return void 0;
|
|
1768
1770
|
}
|
|
1769
|
-
const condition =
|
|
1771
|
+
const condition = chunk5ELKD2FQ_cjs.compilePredicateExpression(ast.having, ctx);
|
|
1770
1772
|
return chunkX6RDQ5NB_cjs.sql`HAVING ${condition}`;
|
|
1771
1773
|
}
|
|
1772
1774
|
function buildStandardEmbeddingsCte(input) {
|
|
@@ -1787,17 +1789,17 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
1787
1789
|
const vectorSlots = ctx.vectorSlots;
|
|
1788
1790
|
const scopedNodes = buildScopedNodeIdsSubquery(field2.alias);
|
|
1789
1791
|
const declaringKinds = nodeKinds.filter(
|
|
1790
|
-
(kind) => vectorSlots?.has(
|
|
1792
|
+
(kind) => vectorSlots?.has(chunk5ELKD2FQ_cjs.vectorSlotKey(kind, fieldPath))
|
|
1791
1793
|
);
|
|
1792
1794
|
const branches = declaringKinds.map((kind) => {
|
|
1793
1795
|
const tableName = vectorStrategy.tableName(graphId, kind, fieldPath);
|
|
1794
|
-
const slotDescriptor = vectorSlots?.get(
|
|
1796
|
+
const slotDescriptor = vectorSlots?.get(chunk5ELKD2FQ_cjs.vectorSlotKey(kind, fieldPath));
|
|
1795
1797
|
const branchMetric = metric ?? slotDescriptor?.metric ?? "cosine";
|
|
1796
1798
|
const engineFormEligible = vectorPredicate.approximate === true || vectorStrategy.searchIsExact === true;
|
|
1797
1799
|
const annSlot = engineFormEligible && branchMetric === slotDescriptor?.metric ? slotDescriptor : void 0;
|
|
1798
1800
|
if (annSlot !== void 0) {
|
|
1799
1801
|
ctx.annIndexTypes?.add(annSlot.indexType);
|
|
1800
|
-
const candidateCte = `${
|
|
1802
|
+
const candidateCte = `${chunk5ELKD2FQ_cjs.ALIAS_CTE_PREFIX}${field2.alias}`;
|
|
1801
1803
|
const kindCandidates = chunkX6RDQ5NB_cjs.sql`SELECT ${qualifyColumn(candidateCte, `${field2.alias}_id`)} FROM ${quoteIdentifier(candidateCte)} WHERE ${qualifyColumn(candidateCte, `${field2.alias}_kind`)} = ${kind}`;
|
|
1802
1804
|
const annSql = vectorStrategy.buildSearch(
|
|
1803
1805
|
{
|
|
@@ -1863,7 +1865,7 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
1863
1865
|
`
|
|
1864
1866
|
);
|
|
1865
1867
|
return chunkX6RDQ5NB_cjs.sql`
|
|
1866
|
-
${chunkX6RDQ5NB_cjs.sql.raw(
|
|
1868
|
+
${chunkX6RDQ5NB_cjs.sql.raw(chunk5ELKD2FQ_cjs.EMBEDDINGS_CTE_ALIAS)} AS (
|
|
1867
1869
|
SELECT
|
|
1868
1870
|
node_id,
|
|
1869
1871
|
node_kind,
|
|
@@ -1920,14 +1922,14 @@ function buildStandardFulltextCte(input) {
|
|
|
1920
1922
|
);
|
|
1921
1923
|
const conditions = [
|
|
1922
1924
|
chunkX6RDQ5NB_cjs.sql`${qualifyColumn(tableName, "graph_id")} = ${graphId}`,
|
|
1923
|
-
|
|
1925
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(qualifyColumn(tableName, "node_kind"), nodeKinds),
|
|
1924
1926
|
matchCondition
|
|
1925
1927
|
];
|
|
1926
1928
|
if (minScore !== void 0) {
|
|
1927
1929
|
conditions.push(chunkX6RDQ5NB_cjs.sql`${rankExpression} >= ${minScore}`);
|
|
1928
1930
|
}
|
|
1929
1931
|
return chunkX6RDQ5NB_cjs.sql`
|
|
1930
|
-
${chunkX6RDQ5NB_cjs.sql.raw(
|
|
1932
|
+
${chunkX6RDQ5NB_cjs.sql.raw(chunk5ELKD2FQ_cjs.FULLTEXT_CTE_ALIAS)} AS (
|
|
1931
1933
|
SELECT
|
|
1932
1934
|
node_id,
|
|
1933
1935
|
node_kind,
|
|
@@ -1963,10 +1965,10 @@ function sharedDeclaredLanguage(fulltextLanguages, nodeKinds) {
|
|
|
1963
1965
|
}
|
|
1964
1966
|
function buildStandardHybridCandidateCte() {
|
|
1965
1967
|
return chunkX6RDQ5NB_cjs.sql`
|
|
1966
|
-
${chunkX6RDQ5NB_cjs.sql.raw(
|
|
1967
|
-
SELECT node_id, node_kind FROM ${chunkX6RDQ5NB_cjs.sql.raw(
|
|
1968
|
+
${chunkX6RDQ5NB_cjs.sql.raw(chunk5ELKD2FQ_cjs.HYBRID_CANDIDATES_CTE_ALIAS)} AS (
|
|
1969
|
+
SELECT node_id, node_kind FROM ${chunkX6RDQ5NB_cjs.sql.raw(chunk5ELKD2FQ_cjs.EMBEDDINGS_CTE_ALIAS)}
|
|
1968
1970
|
UNION
|
|
1969
|
-
SELECT node_id, node_kind FROM ${chunkX6RDQ5NB_cjs.sql.raw(
|
|
1971
|
+
SELECT node_id, node_kind FROM ${chunkX6RDQ5NB_cjs.sql.raw(chunk5ELKD2FQ_cjs.FULLTEXT_CTE_ALIAS)}
|
|
1970
1972
|
)
|
|
1971
1973
|
`;
|
|
1972
1974
|
}
|
|
@@ -1981,7 +1983,7 @@ function compileUserOrderBy(ast, dialect) {
|
|
|
1981
1983
|
"Ordering by JSON arrays or objects is not supported"
|
|
1982
1984
|
);
|
|
1983
1985
|
}
|
|
1984
|
-
const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${
|
|
1986
|
+
const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${chunk5ELKD2FQ_cjs.ALIAS_CTE_PREFIX}${orderSpec.field.alias}`;
|
|
1985
1987
|
const field2 = compileOrderFieldValue(
|
|
1986
1988
|
ast,
|
|
1987
1989
|
orderSpec.field,
|
|
@@ -2000,7 +2002,7 @@ function compileUserOrderBy(ast, dialect) {
|
|
|
2000
2002
|
}
|
|
2001
2003
|
function buildStandardFulltextOrderBy(input) {
|
|
2002
2004
|
const { ast, dialect } = input;
|
|
2003
|
-
const rankOrder = chunkX6RDQ5NB_cjs.sql.raw(`${
|
|
2005
|
+
const rankOrder = chunkX6RDQ5NB_cjs.sql.raw(`${chunk5ELKD2FQ_cjs.FULLTEXT_CTE_ALIAS}.rank DESC`);
|
|
2004
2006
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2005
2007
|
return chunkX6RDQ5NB_cjs.sql`ORDER BY ${chunkX6RDQ5NB_cjs.sql.join([rankOrder, ...userOrders], chunkX6RDQ5NB_cjs.sql`, `)}`;
|
|
2006
2008
|
}
|
|
@@ -2010,17 +2012,17 @@ function buildStandardHybridRrfOrderBy(input) {
|
|
|
2010
2012
|
const vectorWeight = fusion?.weights?.vector ?? DEFAULT_RRF_WEIGHT;
|
|
2011
2013
|
const fulltextWeight = fusion?.weights?.fulltext ?? DEFAULT_RRF_WEIGHT;
|
|
2012
2014
|
const rrfOrder = chunkX6RDQ5NB_cjs.sql.raw(
|
|
2013
|
-
`(COALESCE(${vectorWeight} / (${k} + ${
|
|
2015
|
+
`(COALESCE(${vectorWeight} / (${k} + ${chunk5ELKD2FQ_cjs.EMBEDDINGS_CTE_ALIAS}.ord), 0) + COALESCE(${fulltextWeight} / (${k} + ${chunk5ELKD2FQ_cjs.FULLTEXT_CTE_ALIAS}.ord), 0)) DESC`
|
|
2014
2016
|
);
|
|
2015
2017
|
const idTiebreak = chunkX6RDQ5NB_cjs.sql.raw(
|
|
2016
|
-
`COALESCE(${
|
|
2018
|
+
`COALESCE(${chunk5ELKD2FQ_cjs.FULLTEXT_CTE_ALIAS}.node_id, ${chunk5ELKD2FQ_cjs.EMBEDDINGS_CTE_ALIAS}.node_id) ASC`
|
|
2017
2019
|
);
|
|
2018
2020
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2019
2021
|
return chunkX6RDQ5NB_cjs.sql`ORDER BY ${chunkX6RDQ5NB_cjs.sql.join([rrfOrder, ...userOrders, idTiebreak], chunkX6RDQ5NB_cjs.sql`, `)}`;
|
|
2020
2022
|
}
|
|
2021
2023
|
function buildStandardVectorOrderBy(input) {
|
|
2022
2024
|
const { ast, dialect } = input;
|
|
2023
|
-
const distanceOrder = chunkX6RDQ5NB_cjs.sql.raw(`${
|
|
2025
|
+
const distanceOrder = chunkX6RDQ5NB_cjs.sql.raw(`${chunk5ELKD2FQ_cjs.EMBEDDINGS_CTE_ALIAS}.distance ASC`);
|
|
2024
2026
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2025
2027
|
return chunkX6RDQ5NB_cjs.sql`ORDER BY ${chunkX6RDQ5NB_cjs.sql.join([distanceOrder, ...userOrders], chunkX6RDQ5NB_cjs.sql`, `)}`;
|
|
2026
2028
|
}
|
|
@@ -2038,7 +2040,7 @@ function buildLimitOffsetClause(input) {
|
|
|
2038
2040
|
|
|
2039
2041
|
// src/query/compiler/passes/fulltext.ts
|
|
2040
2042
|
function runFulltextPredicatePass(ast, dialect) {
|
|
2041
|
-
const fulltextPredicates =
|
|
2043
|
+
const fulltextPredicates = chunk5ELKD2FQ_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2042
2044
|
if (fulltextPredicates.length > 1) {
|
|
2043
2045
|
throw new chunkSAFZ6JTI_cjs.UnsupportedPredicateError(
|
|
2044
2046
|
"Multiple fulltext match predicates in a single query are not supported"
|
|
@@ -2135,11 +2137,11 @@ function runCompilerPass(state, pass) {
|
|
|
2135
2137
|
|
|
2136
2138
|
// src/query/compiler/passes/temporal.ts
|
|
2137
2139
|
function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
2138
|
-
const currentTimestamp =
|
|
2140
|
+
const currentTimestamp = chunk5ELKD2FQ_cjs.currentReadInstantFor(readInstant);
|
|
2139
2141
|
return {
|
|
2140
2142
|
forAlias(tableAlias) {
|
|
2141
|
-
return
|
|
2142
|
-
...
|
|
2143
|
+
return chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
2144
|
+
...chunk5ELKD2FQ_cjs.extractTemporalOptions(ast, tableAlias),
|
|
2143
2145
|
currentTimestamp
|
|
2144
2146
|
});
|
|
2145
2147
|
}
|
|
@@ -2148,7 +2150,7 @@ function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
|
2148
2150
|
|
|
2149
2151
|
// src/query/compiler/passes/vector.ts
|
|
2150
2152
|
function runVectorPredicatePass(ast, dialect, vectorStrategy) {
|
|
2151
|
-
const vectorPredicates =
|
|
2153
|
+
const vectorPredicates = chunk5ELKD2FQ_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2152
2154
|
if (vectorPredicates.length > 1) {
|
|
2153
2155
|
throw new chunkSAFZ6JTI_cjs.UnsupportedPredicateError(
|
|
2154
2156
|
"Multiple vector similarity predicates in a single query are not supported"
|
|
@@ -2561,8 +2563,8 @@ function assertRecordedQueryDoesNotUseCurrentIndexes(ast, vectorPredicate, fullt
|
|
|
2561
2563
|
}
|
|
2562
2564
|
function assertRecordedQueryAstDoesNotUseCurrentIndexes(ast) {
|
|
2563
2565
|
if (ast.recordedAsOf === void 0) return;
|
|
2564
|
-
const vectorPredicates =
|
|
2565
|
-
const fulltextPredicates =
|
|
2566
|
+
const vectorPredicates = chunk5ELKD2FQ_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2567
|
+
const fulltextPredicates = chunk5ELKD2FQ_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2566
2568
|
assertRecordedQueryHasNoCurrentIndexUsage(ast, {
|
|
2567
2569
|
usesVectorPredicate: vectorPredicates.length > 0,
|
|
2568
2570
|
usesFulltextPredicate: fulltextPredicates.length > 0
|
|
@@ -2925,13 +2927,13 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2925
2927
|
`;
|
|
2926
2928
|
}
|
|
2927
2929
|
function compileKindFilter2(kinds, columnExpr) {
|
|
2928
|
-
return
|
|
2930
|
+
return chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw(columnExpr), kinds);
|
|
2929
2931
|
}
|
|
2930
2932
|
function compileNodePredicates(ast, alias, ctx) {
|
|
2931
|
-
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) =>
|
|
2933
|
+
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) => chunk5ELKD2FQ_cjs.compilePredicateExpression(p.expression, ctx));
|
|
2932
2934
|
}
|
|
2933
2935
|
function compileEdgePredicates(ast, edgeAlias, ctx) {
|
|
2934
|
-
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) =>
|
|
2936
|
+
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) => chunk5ELKD2FQ_cjs.compilePredicateExpression(p.expression, ctx));
|
|
2935
2937
|
}
|
|
2936
2938
|
function collectRequiredColumnsByAlias(ast, traversal) {
|
|
2937
2939
|
const selectiveFields = ast.selectiveFields;
|
|
@@ -3050,7 +3052,7 @@ function compileRecursiveOrderBy(ast, dialect) {
|
|
|
3050
3052
|
"Ordering by JSON arrays or objects is not supported"
|
|
3051
3053
|
);
|
|
3052
3054
|
}
|
|
3053
|
-
const field2 =
|
|
3055
|
+
const field2 = chunk5ELKD2FQ_cjs.compileFieldValue(orderSpec.field, dialect, valueType);
|
|
3054
3056
|
const direction = chunkX6RDQ5NB_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
3055
3057
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
3056
3058
|
const nullsDirection = chunkX6RDQ5NB_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
@@ -3132,26 +3134,26 @@ function decodeByValueType(value, valueType) {
|
|
|
3132
3134
|
// src/store/recursive-cte.ts
|
|
3133
3135
|
function buildReachableCte(options) {
|
|
3134
3136
|
const trackPath = options.cyclePolicy === "prevent" || options.includePath;
|
|
3135
|
-
const edgeKindFilter =
|
|
3137
|
+
const edgeKindFilter = chunk5ELKD2FQ_cjs.compileKindFilter(
|
|
3136
3138
|
chunkX6RDQ5NB_cjs.sql.raw("e.kind"),
|
|
3137
3139
|
options.edgeKinds
|
|
3138
3140
|
);
|
|
3139
|
-
const currentTimestamp =
|
|
3140
|
-
const nodeTemporalFilter =
|
|
3141
|
+
const currentTimestamp = chunk5ELKD2FQ_cjs.currentReadInstant();
|
|
3142
|
+
const nodeTemporalFilter = chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
3141
3143
|
mode: options.temporalMode,
|
|
3142
3144
|
asOf: options.asOf,
|
|
3143
3145
|
recordedAsOf: options.recordedAsOf,
|
|
3144
3146
|
tableAlias: "n",
|
|
3145
3147
|
currentTimestamp
|
|
3146
3148
|
});
|
|
3147
|
-
const edgeTemporalFilter =
|
|
3149
|
+
const edgeTemporalFilter = chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
3148
3150
|
mode: options.temporalMode,
|
|
3149
3151
|
asOf: options.asOf,
|
|
3150
3152
|
recordedAsOf: options.recordedAsOf,
|
|
3151
3153
|
tableAlias: "e",
|
|
3152
3154
|
currentTimestamp
|
|
3153
3155
|
});
|
|
3154
|
-
const schema =
|
|
3156
|
+
const schema = chunk5ELKD2FQ_cjs.recordedReadSchemaFor(
|
|
3155
3157
|
options.schema,
|
|
3156
3158
|
options.recordedAsOf,
|
|
3157
3159
|
options.recordedReadBinding,
|
|
@@ -3273,7 +3275,7 @@ async function executeSubgraph(params) {
|
|
|
3273
3275
|
);
|
|
3274
3276
|
const temporalMode = coordinate.mode;
|
|
3275
3277
|
const recordedAsOf = options.recordedAsOf;
|
|
3276
|
-
const baseSchema = params.schema ??
|
|
3278
|
+
const baseSchema = params.schema ?? chunk5ELKD2FQ_cjs.DEFAULT_SQL_SCHEMA;
|
|
3277
3279
|
const maxDepth = Math.min(
|
|
3278
3280
|
options.maxDepth ?? DEFAULT_SUBGRAPH_MAX_DEPTH,
|
|
3279
3281
|
MAX_EXPLICIT_RECURSIVE_DEPTH
|
|
@@ -3291,7 +3293,7 @@ async function executeSubgraph(params) {
|
|
|
3291
3293
|
asOf: coordinate.asOf,
|
|
3292
3294
|
recordedAsOf,
|
|
3293
3295
|
dialect: params.dialect,
|
|
3294
|
-
schema:
|
|
3296
|
+
schema: chunk5ELKD2FQ_cjs.recordedReadSchemaFor(
|
|
3295
3297
|
baseSchema,
|
|
3296
3298
|
recordedAsOf,
|
|
3297
3299
|
params.recordedReadBinding,
|
|
@@ -3455,7 +3457,7 @@ function dedupeStrings(values) {
|
|
|
3455
3457
|
function buildIncludedIdsCte(ctx) {
|
|
3456
3458
|
const filters = [];
|
|
3457
3459
|
if (ctx.includeKinds !== void 0 && ctx.includeKinds.length > 0) {
|
|
3458
|
-
filters.push(
|
|
3460
|
+
filters.push(chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("kind"), ctx.includeKinds));
|
|
3459
3461
|
}
|
|
3460
3462
|
if (ctx.excludeRoot) {
|
|
3461
3463
|
filters.push(chunkX6RDQ5NB_cjs.sql`id != ${ctx.rootId}`);
|
|
@@ -3478,12 +3480,12 @@ async function fetchIncludedIds(ctx, reachableCte, includedIdsCte) {
|
|
|
3478
3480
|
return rows.map((row) => row.id);
|
|
3479
3481
|
}
|
|
3480
3482
|
async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
3481
|
-
const nodeTemporalFilter =
|
|
3483
|
+
const nodeTemporalFilter = chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
3482
3484
|
mode: ctx.temporalMode,
|
|
3483
3485
|
asOf: ctx.asOf,
|
|
3484
3486
|
recordedAsOf: ctx.recordedAsOf,
|
|
3485
3487
|
tableAlias: "n",
|
|
3486
|
-
currentTimestamp:
|
|
3488
|
+
currentTimestamp: chunk5ELKD2FQ_cjs.currentReadInstant()
|
|
3487
3489
|
});
|
|
3488
3490
|
const columns = [
|
|
3489
3491
|
chunkX6RDQ5NB_cjs.sql`n.kind`,
|
|
@@ -3506,13 +3508,13 @@ async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
|
3506
3508
|
);
|
|
3507
3509
|
}
|
|
3508
3510
|
async function fetchSubgraphEdges(ctx, membership, projectionPlan) {
|
|
3509
|
-
const edgeKindFilter =
|
|
3510
|
-
const edgeTemporalFilter =
|
|
3511
|
+
const edgeKindFilter = chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("e.kind"), ctx.edgeKinds);
|
|
3512
|
+
const edgeTemporalFilter = chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
3511
3513
|
mode: ctx.temporalMode,
|
|
3512
3514
|
asOf: ctx.asOf,
|
|
3513
3515
|
recordedAsOf: ctx.recordedAsOf,
|
|
3514
3516
|
tableAlias: "e",
|
|
3515
|
-
currentTimestamp:
|
|
3517
|
+
currentTimestamp: chunk5ELKD2FQ_cjs.currentReadInstant()
|
|
3516
3518
|
});
|
|
3517
3519
|
const columns = [
|
|
3518
3520
|
chunkX6RDQ5NB_cjs.sql`e.id`,
|
|
@@ -3551,7 +3553,7 @@ function buildMetadataColumns(alias, plan, columns) {
|
|
|
3551
3553
|
if (metaKinds.length === plan.fullKinds.length + plan.projectedKinds.size) {
|
|
3552
3554
|
return columns.map((col) => chunkX6RDQ5NB_cjs.sql`${chunkX6RDQ5NB_cjs.sql.raw(`${alias}.${col}`)}`);
|
|
3553
3555
|
}
|
|
3554
|
-
const filter =
|
|
3556
|
+
const filter = chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw(`${alias}.kind`), metaKinds);
|
|
3555
3557
|
return columns.map(
|
|
3556
3558
|
(col) => chunkX6RDQ5NB_cjs.sql`CASE WHEN ${filter} THEN ${chunkX6RDQ5NB_cjs.sql.raw(`${alias}.${col}`)} ELSE NULL END AS ${chunkX6RDQ5NB_cjs.sql.raw(col)}`
|
|
3557
3559
|
);
|
|
@@ -3563,7 +3565,7 @@ function buildFullPropsColumn(alias, plan) {
|
|
|
3563
3565
|
if (plan.fullKinds.length === 0) {
|
|
3564
3566
|
return chunkX6RDQ5NB_cjs.sql`NULL AS props`;
|
|
3565
3567
|
}
|
|
3566
|
-
const filter =
|
|
3568
|
+
const filter = chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw(`${alias}.kind`), plan.fullKinds);
|
|
3567
3569
|
return chunkX6RDQ5NB_cjs.sql`CASE WHEN ${filter} THEN ${chunkX6RDQ5NB_cjs.sql.raw(`${alias}.props`)} ELSE NULL END AS props`;
|
|
3568
3570
|
}
|
|
3569
3571
|
function buildProjectedPropertyColumns(alias, plan, dialect) {
|
|
@@ -3607,7 +3609,7 @@ function applyProjectedFields(target, row, kindPlan) {
|
|
|
3607
3609
|
function mapSubgraphNodeRow(row, projectionPlan) {
|
|
3608
3610
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3609
3611
|
if (kindPlan === void 0) {
|
|
3610
|
-
return
|
|
3612
|
+
return chunkE2Q7SP2K_cjs.rowToNode({
|
|
3611
3613
|
...row,
|
|
3612
3614
|
props: normalizeProps(row.props)
|
|
3613
3615
|
});
|
|
@@ -3617,7 +3619,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3617
3619
|
id: row.id
|
|
3618
3620
|
};
|
|
3619
3621
|
if (kindPlan.includeMeta) {
|
|
3620
|
-
projectedNode["meta"] =
|
|
3622
|
+
projectedNode["meta"] = chunkE2Q7SP2K_cjs.rowToNodeMeta(row);
|
|
3621
3623
|
}
|
|
3622
3624
|
applyProjectedFields(projectedNode, row, kindPlan);
|
|
3623
3625
|
return projectedNode;
|
|
@@ -3625,7 +3627,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3625
3627
|
function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
3626
3628
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3627
3629
|
if (kindPlan === void 0) {
|
|
3628
|
-
return
|
|
3630
|
+
return chunkE2Q7SP2K_cjs.rowToEdge({
|
|
3629
3631
|
...row,
|
|
3630
3632
|
props: normalizeProps(row.props)
|
|
3631
3633
|
});
|
|
@@ -3639,7 +3641,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
|
3639
3641
|
toId: row.to_id
|
|
3640
3642
|
};
|
|
3641
3643
|
if (kindPlan.includeMeta) {
|
|
3642
|
-
projectedEdge["meta"] =
|
|
3644
|
+
projectedEdge["meta"] = chunkE2Q7SP2K_cjs.rowToEdgeMeta(row);
|
|
3643
3645
|
}
|
|
3644
3646
|
applyProjectedFields(projectedEdge, row, kindPlan);
|
|
3645
3647
|
return projectedEdge;
|
|
@@ -3965,7 +3967,7 @@ function hasIdEqualityPredicate(expression, alias) {
|
|
|
3965
3967
|
}
|
|
3966
3968
|
}
|
|
3967
3969
|
function isStartAliasBoundToSingleId(ast, predicateIndex) {
|
|
3968
|
-
return
|
|
3970
|
+
return chunk5ELKD2FQ_cjs.getPredicatesForAlias(predicateIndex, ast.start.alias, "node").some(
|
|
3969
3971
|
(predicate) => hasIdEqualityPredicate(predicate.expression, ast.start.alias)
|
|
3970
3972
|
);
|
|
3971
3973
|
}
|
|
@@ -4049,7 +4051,7 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
|
|
|
4049
4051
|
fulltextPredicate: void 0,
|
|
4050
4052
|
fusion: void 0,
|
|
4051
4053
|
logicalPlan: void 0,
|
|
4052
|
-
predicateIndex:
|
|
4054
|
+
predicateIndex: chunk5ELKD2FQ_cjs.buildPredicateIndex(ast),
|
|
4053
4055
|
requiredColumnsByAlias: void 0,
|
|
4054
4056
|
shouldCollapseSelectiveTraversalRowset: false,
|
|
4055
4057
|
temporalFilterPass: void 0,
|
|
@@ -4217,8 +4219,8 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
|
|
|
4217
4219
|
function compileQuery(ast, graphId, options = "sqlite") {
|
|
4218
4220
|
const options_ = typeof options === "string" ? { dialect: options } : options;
|
|
4219
4221
|
const dialect = options_.dialect ?? "sqlite";
|
|
4220
|
-
const baseSchema = options_.schema === void 0 ?
|
|
4221
|
-
const schema =
|
|
4222
|
+
const baseSchema = options_.schema === void 0 ? chunk5ELKD2FQ_cjs.DEFAULT_SQL_SCHEMA : chunk5ELKD2FQ_cjs.requireSqlSchema(options_.schema, "compileQuery schema");
|
|
4223
|
+
const schema = chunk5ELKD2FQ_cjs.recordedReadSchemaFor(
|
|
4222
4224
|
baseSchema,
|
|
4223
4225
|
ast.recordedAsOf,
|
|
4224
4226
|
options_.recordedReadBinding,
|
|
@@ -4289,7 +4291,7 @@ function compileSetOperation2(op, graphId, options = "sqlite") {
|
|
|
4289
4291
|
}
|
|
4290
4292
|
return compiled;
|
|
4291
4293
|
};
|
|
4292
|
-
const combined =
|
|
4294
|
+
const combined = chunk5ELKD2FQ_cjs.withPinnedReadInstant(
|
|
4293
4295
|
() => compileSetOperation(op, graphId, adapter, compileOperand, options_.vectorStrategy)
|
|
4294
4296
|
);
|
|
4295
4297
|
if (annIndexTypes.size > 0) {
|
|
@@ -4429,7 +4431,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4429
4431
|
const nodeCountDistinctColumn = `${traversal.nodeAlias}_count_distinct`;
|
|
4430
4432
|
const edgeCountColumn = `${traversal.edgeAlias}_count`;
|
|
4431
4433
|
const edgeCountDistinctColumn = `${traversal.edgeAlias}_count_distinct`;
|
|
4432
|
-
const previousNodeKinds =
|
|
4434
|
+
const previousNodeKinds = chunk5ELKD2FQ_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
4433
4435
|
const edgeKinds = [...new Set(traversal.edgeKinds)];
|
|
4434
4436
|
const nodeKinds = traversal.nodeKinds;
|
|
4435
4437
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
@@ -4438,16 +4440,16 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4438
4440
|
...ctx,
|
|
4439
4441
|
cteColumnPrefix: "n"
|
|
4440
4442
|
};
|
|
4441
|
-
const nodePredicateClauses =
|
|
4442
|
-
|
|
4443
|
+
const nodePredicateClauses = chunk5ELKD2FQ_cjs.compilePredicateClauses(
|
|
4444
|
+
chunk5ELKD2FQ_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
4443
4445
|
nodePredicateContext
|
|
4444
4446
|
);
|
|
4445
4447
|
const edgePredicateContext = {
|
|
4446
4448
|
...ctx,
|
|
4447
4449
|
cteColumnPrefix: "e"
|
|
4448
4450
|
};
|
|
4449
|
-
const edgePredicateClauses =
|
|
4450
|
-
|
|
4451
|
+
const edgePredicateClauses = chunk5ELKD2FQ_cjs.compilePredicateClauses(
|
|
4452
|
+
chunk5ELKD2FQ_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
4451
4453
|
edgePredicateContext
|
|
4452
4454
|
);
|
|
4453
4455
|
const joinField = traversal.direction === "out" ? "from_id" : "to_id";
|
|
@@ -4459,14 +4461,14 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4459
4461
|
const useInnerJoin = hasNodePredicates;
|
|
4460
4462
|
const whereClauses = [
|
|
4461
4463
|
chunkX6RDQ5NB_cjs.sql`e.graph_id = ${graphId}`,
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4464
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("e.kind"), edgeKinds),
|
|
4465
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw(`e.${joinKindField}`), previousNodeKinds),
|
|
4466
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw(`e.${targetKindField}`), nodeKinds),
|
|
4465
4467
|
edgeTemporalFilter,
|
|
4466
4468
|
...edgePredicateClauses,
|
|
4467
4469
|
// INNER JOIN mode: node-side filters in WHERE constrain every aggregate.
|
|
4468
4470
|
...requiresNodeJoin && useInnerJoin ? [
|
|
4469
|
-
|
|
4471
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4470
4472
|
nodeTemporalFilter,
|
|
4471
4473
|
...nodePredicateClauses
|
|
4472
4474
|
] : []
|
|
@@ -4482,7 +4484,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4482
4484
|
chunkX6RDQ5NB_cjs.sql`n.graph_id = e.graph_id`,
|
|
4483
4485
|
chunkX6RDQ5NB_cjs.sql`n.id = e.${chunkX6RDQ5NB_cjs.sql.raw(targetField)}`,
|
|
4484
4486
|
chunkX6RDQ5NB_cjs.sql`n.kind = e.${chunkX6RDQ5NB_cjs.sql.raw(targetKindField)}`,
|
|
4485
|
-
|
|
4487
|
+
chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4486
4488
|
nodeTemporalFilter
|
|
4487
4489
|
] : [];
|
|
4488
4490
|
const aggregateColumns = [];
|
|
@@ -4542,7 +4544,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4542
4544
|
ast.projection.fields.map((projectedField) => {
|
|
4543
4545
|
const source = projectedField.source;
|
|
4544
4546
|
if (!isAggregateExpr(source)) {
|
|
4545
|
-
const value =
|
|
4547
|
+
const value = chunk5ELKD2FQ_cjs.compileFieldValue(
|
|
4546
4548
|
source,
|
|
4547
4549
|
dialect,
|
|
4548
4550
|
source.valueType,
|
|
@@ -4875,7 +4877,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
4875
4877
|
traversalLimit: traversalCteLimit
|
|
4876
4878
|
});
|
|
4877
4879
|
if (vectorPredicate) {
|
|
4878
|
-
const nodeKinds =
|
|
4880
|
+
const nodeKinds = chunk5ELKD2FQ_cjs.getNodeKindsForAlias(ast, vectorPredicate.field.alias);
|
|
4879
4881
|
ctes.push(
|
|
4880
4882
|
buildStandardEmbeddingsCte({
|
|
4881
4883
|
ctx,
|
|
@@ -4886,7 +4888,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
4886
4888
|
);
|
|
4887
4889
|
}
|
|
4888
4890
|
if (fulltextPredicate) {
|
|
4889
|
-
const nodeKinds =
|
|
4891
|
+
const nodeKinds = chunk5ELKD2FQ_cjs.getNodeKindsForAlias(ast, fulltextPredicate.field.alias);
|
|
4890
4892
|
ctes.push(
|
|
4891
4893
|
buildStandardFulltextCte({
|
|
4892
4894
|
ctx,
|
|
@@ -4896,7 +4898,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
4896
4898
|
})
|
|
4897
4899
|
);
|
|
4898
4900
|
}
|
|
4899
|
-
if (
|
|
4901
|
+
if (chunk5ELKD2FQ_cjs.getHybridTargetAlias(vectorPredicate, fulltextPredicate) !== void 0) {
|
|
4900
4902
|
ctes.push(buildStandardHybridCandidateCte());
|
|
4901
4903
|
}
|
|
4902
4904
|
const projection = buildStandardProjection({
|
|
@@ -5826,7 +5828,7 @@ function createGuardedProxy(target, debugPath) {
|
|
|
5826
5828
|
// src/query/builder/read-instant-template.ts
|
|
5827
5829
|
function templateHasReadInstant(template) {
|
|
5828
5830
|
return template.params.some(
|
|
5829
|
-
(parameter) => chunkX6RDQ5NB_cjs.isSqlPlaceholder(parameter) && parameter.name ===
|
|
5831
|
+
(parameter) => chunkX6RDQ5NB_cjs.isSqlPlaceholder(parameter) && parameter.name === chunk5ELKD2FQ_cjs.CURRENT_READ_INSTANT_PLACEHOLDER
|
|
5830
5832
|
);
|
|
5831
5833
|
}
|
|
5832
5834
|
function queryAstNeedsCurrentReadInstant(ast) {
|
|
@@ -5864,7 +5866,7 @@ function fillTemplateParams(params, bindings, dialect) {
|
|
|
5864
5866
|
return params.map((parameter) => {
|
|
5865
5867
|
if (!chunkX6RDQ5NB_cjs.isSqlPlaceholder(parameter)) return parameter;
|
|
5866
5868
|
const name = parameter.name;
|
|
5867
|
-
if (name ===
|
|
5869
|
+
if (name === chunk5ELKD2FQ_cjs.CURRENT_READ_INSTANT_PLACEHOLDER) {
|
|
5868
5870
|
readInstant ??= chunkDDCYVIVV_cjs.nowIso();
|
|
5869
5871
|
return readInstant;
|
|
5870
5872
|
}
|
|
@@ -5906,7 +5908,7 @@ function toLiteral(value) {
|
|
|
5906
5908
|
function substitutePredicateExpression(expr, bindings) {
|
|
5907
5909
|
switch (expr.__type) {
|
|
5908
5910
|
case "comparison": {
|
|
5909
|
-
if (
|
|
5911
|
+
if (chunk5ELKD2FQ_cjs.isParameterRef(expr.right)) {
|
|
5910
5912
|
const value = bindings[expr.right.name];
|
|
5911
5913
|
if (value === void 0) {
|
|
5912
5914
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
@@ -5922,7 +5924,7 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
5922
5924
|
return expr;
|
|
5923
5925
|
}
|
|
5924
5926
|
case "string_op": {
|
|
5925
|
-
if (
|
|
5927
|
+
if (chunk5ELKD2FQ_cjs.isParameterRef(expr.pattern)) {
|
|
5926
5928
|
const value = bindings[expr.pattern.name];
|
|
5927
5929
|
if (value === void 0) {
|
|
5928
5930
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
@@ -5944,8 +5946,8 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
5944
5946
|
return expr;
|
|
5945
5947
|
}
|
|
5946
5948
|
case "between": {
|
|
5947
|
-
const lowerIsParam =
|
|
5948
|
-
const upperIsParam =
|
|
5949
|
+
const lowerIsParam = chunk5ELKD2FQ_cjs.isParameterRef(expr.lower);
|
|
5950
|
+
const upperIsParam = chunk5ELKD2FQ_cjs.isParameterRef(expr.upper);
|
|
5949
5951
|
if (!lowerIsParam && !upperIsParam) return expr;
|
|
5950
5952
|
const lower = lowerIsParam ? toLiteral(resolveBinding(bindings, expr.lower.name)) : expr.lower;
|
|
5951
5953
|
const upper = upperIsParam ? toLiteral(resolveBinding(bindings, expr.upper.name)) : expr.upper;
|
|
@@ -6180,23 +6182,23 @@ function collectParameterMetadataFromAst(ast, names, stringOpParameters) {
|
|
|
6180
6182
|
function collectParameterMetadataFromExpression(expression, names, stringOpParameters) {
|
|
6181
6183
|
switch (expression.__type) {
|
|
6182
6184
|
case "comparison": {
|
|
6183
|
-
if (
|
|
6185
|
+
if (chunk5ELKD2FQ_cjs.isParameterRef(expression.right)) {
|
|
6184
6186
|
names.add(expression.right.name);
|
|
6185
6187
|
}
|
|
6186
6188
|
return;
|
|
6187
6189
|
}
|
|
6188
6190
|
case "string_op": {
|
|
6189
|
-
if (
|
|
6191
|
+
if (chunk5ELKD2FQ_cjs.isParameterRef(expression.pattern)) {
|
|
6190
6192
|
names.add(expression.pattern.name);
|
|
6191
6193
|
stringOpParameters.add(expression.pattern.name);
|
|
6192
6194
|
}
|
|
6193
6195
|
return;
|
|
6194
6196
|
}
|
|
6195
6197
|
case "between": {
|
|
6196
|
-
if (
|
|
6198
|
+
if (chunk5ELKD2FQ_cjs.isParameterRef(expression.lower)) {
|
|
6197
6199
|
names.add(expression.lower.name);
|
|
6198
6200
|
}
|
|
6199
|
-
if (
|
|
6201
|
+
if (chunk5ELKD2FQ_cjs.isParameterRef(expression.upper)) {
|
|
6200
6202
|
names.add(expression.upper.name);
|
|
6201
6203
|
}
|
|
6202
6204
|
return;
|
|
@@ -6635,7 +6637,7 @@ function buildVectorSlots(registry) {
|
|
|
6635
6637
|
const slots = /* @__PURE__ */ new Map();
|
|
6636
6638
|
for (const [nodeKind, nodeType] of registry.nodeKinds) {
|
|
6637
6639
|
for (const field2 of chunkHAHNRASW_cjs.resolveEmbeddingFields(nodeType.schema)) {
|
|
6638
|
-
slots.set(
|
|
6640
|
+
slots.set(chunk5ELKD2FQ_cjs.vectorSlotKey(nodeKind, field2.fieldPath), {
|
|
6639
6641
|
dimensions: field2.dimensions,
|
|
6640
6642
|
metric: field2.metric,
|
|
6641
6643
|
indexType: field2.indexType
|
|
@@ -6714,10 +6716,10 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
6714
6716
|
}
|
|
6715
6717
|
}
|
|
6716
6718
|
const orderSpec = isSystem ? {
|
|
6717
|
-
field:
|
|
6719
|
+
field: chunk5ELKD2FQ_cjs.fieldRef(alias, [field2], { valueType: "string" }),
|
|
6718
6720
|
direction
|
|
6719
6721
|
} : {
|
|
6720
|
-
field:
|
|
6722
|
+
field: chunk5ELKD2FQ_cjs.fieldRef(alias, ["props"], {
|
|
6721
6723
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([field2]),
|
|
6722
6724
|
valueType: typeInfo?.valueType,
|
|
6723
6725
|
elementType: typeInfo?.elementType
|
|
@@ -6932,7 +6934,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
6932
6934
|
}
|
|
6933
6935
|
#executeOnBackend(backend, promise, surface) {
|
|
6934
6936
|
if (this.#state.recordedAsOf === void 0) return promise;
|
|
6935
|
-
return
|
|
6937
|
+
return chunkHP6LWBLB_cjs.withRecordedRelationsPrecondition(promise, {
|
|
6936
6938
|
dialect: backend.dialect,
|
|
6937
6939
|
surface
|
|
6938
6940
|
});
|
|
@@ -7830,12 +7832,12 @@ function createDynamicFieldBuilder(introspector, alias, name, kindNames, entity)
|
|
|
7830
7832
|
if (typeInfo === void 0) {
|
|
7831
7833
|
throw new Error(`Property "${name}" is not declared on ${where}.`);
|
|
7832
7834
|
}
|
|
7833
|
-
const ref =
|
|
7835
|
+
const ref = chunk5ELKD2FQ_cjs.fieldRef(alias, ["props"], {
|
|
7834
7836
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([name]),
|
|
7835
7837
|
valueType: typeInfo.valueType,
|
|
7836
7838
|
elementType: typeInfo.elementType
|
|
7837
7839
|
});
|
|
7838
|
-
const base =
|
|
7840
|
+
const base = chunk5ELKD2FQ_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
7839
7841
|
const expect = (asserted) => {
|
|
7840
7842
|
if (typeInfo.valueType !== asserted) {
|
|
7841
7843
|
throw new TypeError(
|
|
@@ -8007,17 +8009,17 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8007
8009
|
(kind) => !this.#edgeKinds.includes(kind)
|
|
8008
8010
|
)
|
|
8009
8011
|
];
|
|
8010
|
-
const idAccessor =
|
|
8011
|
-
|
|
8012
|
+
const idAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8013
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8012
8014
|
);
|
|
8013
|
-
const kindAccessor =
|
|
8014
|
-
|
|
8015
|
+
const kindAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8016
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8015
8017
|
);
|
|
8016
|
-
const fromIdAccessor =
|
|
8017
|
-
|
|
8018
|
+
const fromIdAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8019
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
8018
8020
|
);
|
|
8019
|
-
const toIdAccessor =
|
|
8020
|
-
|
|
8021
|
+
const toIdAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8022
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
8021
8023
|
);
|
|
8022
8024
|
const buildFieldAccessor = (propertyName) => {
|
|
8023
8025
|
const typeInfo = this.#config.schemaIntrospector.getSharedEdgeFieldTypeInfo(
|
|
@@ -8026,34 +8028,34 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8026
8028
|
);
|
|
8027
8029
|
const valueType = typeInfo?.valueType;
|
|
8028
8030
|
const elementType = typeInfo?.elementType;
|
|
8029
|
-
const ref =
|
|
8031
|
+
const ref = chunk5ELKD2FQ_cjs.fieldRef(alias, ["props"], {
|
|
8030
8032
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([propertyName]),
|
|
8031
8033
|
valueType,
|
|
8032
8034
|
elementType
|
|
8033
8035
|
});
|
|
8034
8036
|
switch (valueType) {
|
|
8035
8037
|
case "string": {
|
|
8036
|
-
return
|
|
8038
|
+
return chunk5ELKD2FQ_cjs.stringField(ref);
|
|
8037
8039
|
}
|
|
8038
8040
|
case "number": {
|
|
8039
|
-
return
|
|
8041
|
+
return chunk5ELKD2FQ_cjs.numberField(ref);
|
|
8040
8042
|
}
|
|
8041
8043
|
case "boolean": {
|
|
8042
|
-
return
|
|
8044
|
+
return chunk5ELKD2FQ_cjs.baseField(ref);
|
|
8043
8045
|
}
|
|
8044
8046
|
case "date": {
|
|
8045
|
-
return
|
|
8047
|
+
return chunk5ELKD2FQ_cjs.dateField(ref);
|
|
8046
8048
|
}
|
|
8047
8049
|
case "array": {
|
|
8048
|
-
return
|
|
8050
|
+
return chunk5ELKD2FQ_cjs.arrayField(ref);
|
|
8049
8051
|
}
|
|
8050
8052
|
case "object": {
|
|
8051
|
-
return
|
|
8053
|
+
return chunk5ELKD2FQ_cjs.objectField(ref);
|
|
8052
8054
|
}
|
|
8053
8055
|
case "embedding":
|
|
8054
8056
|
case "unknown":
|
|
8055
8057
|
case void 0: {
|
|
8056
|
-
return
|
|
8058
|
+
return chunk5ELKD2FQ_cjs.baseField(ref);
|
|
8057
8059
|
}
|
|
8058
8060
|
}
|
|
8059
8061
|
};
|
|
@@ -8198,39 +8200,39 @@ function buildNodeFields(alias) {
|
|
|
8198
8200
|
return [
|
|
8199
8201
|
{
|
|
8200
8202
|
outputName: `${alias}_id`,
|
|
8201
|
-
source:
|
|
8203
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["id"])
|
|
8202
8204
|
},
|
|
8203
8205
|
{
|
|
8204
8206
|
outputName: `${alias}_kind`,
|
|
8205
|
-
source:
|
|
8207
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["kind"])
|
|
8206
8208
|
},
|
|
8207
8209
|
{
|
|
8208
8210
|
outputName: `${alias}_props`,
|
|
8209
|
-
source:
|
|
8211
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["props"])
|
|
8210
8212
|
},
|
|
8211
8213
|
{
|
|
8212
8214
|
outputName: `${alias}_version`,
|
|
8213
|
-
source:
|
|
8215
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["version"])
|
|
8214
8216
|
},
|
|
8215
8217
|
{
|
|
8216
8218
|
outputName: `${alias}_valid_from`,
|
|
8217
|
-
source:
|
|
8219
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["valid_from"])
|
|
8218
8220
|
},
|
|
8219
8221
|
{
|
|
8220
8222
|
outputName: `${alias}_valid_to`,
|
|
8221
|
-
source:
|
|
8223
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["valid_to"])
|
|
8222
8224
|
},
|
|
8223
8225
|
{
|
|
8224
8226
|
outputName: `${alias}_created_at`,
|
|
8225
|
-
source:
|
|
8227
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["created_at"])
|
|
8226
8228
|
},
|
|
8227
8229
|
{
|
|
8228
8230
|
outputName: `${alias}_updated_at`,
|
|
8229
|
-
source:
|
|
8231
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["updated_at"])
|
|
8230
8232
|
},
|
|
8231
8233
|
{
|
|
8232
8234
|
outputName: `${alias}_deleted_at`,
|
|
8233
|
-
source:
|
|
8235
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(alias, ["deleted_at"])
|
|
8234
8236
|
}
|
|
8235
8237
|
];
|
|
8236
8238
|
}
|
|
@@ -8239,52 +8241,52 @@ function buildEdgeFields(edgeAlias, nodeCteAlias) {
|
|
|
8239
8241
|
return [
|
|
8240
8242
|
{
|
|
8241
8243
|
outputName: `${edgeAlias}_id`,
|
|
8242
|
-
source:
|
|
8244
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["id"]),
|
|
8243
8245
|
cteAlias
|
|
8244
8246
|
},
|
|
8245
8247
|
{
|
|
8246
8248
|
outputName: `${edgeAlias}_kind`,
|
|
8247
|
-
source:
|
|
8249
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["kind"]),
|
|
8248
8250
|
cteAlias
|
|
8249
8251
|
},
|
|
8250
8252
|
{
|
|
8251
8253
|
outputName: `${edgeAlias}_from_id`,
|
|
8252
|
-
source:
|
|
8254
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["from_id"]),
|
|
8253
8255
|
cteAlias
|
|
8254
8256
|
},
|
|
8255
8257
|
{
|
|
8256
8258
|
outputName: `${edgeAlias}_to_id`,
|
|
8257
|
-
source:
|
|
8259
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["to_id"]),
|
|
8258
8260
|
cteAlias
|
|
8259
8261
|
},
|
|
8260
8262
|
{
|
|
8261
8263
|
outputName: `${edgeAlias}_props`,
|
|
8262
|
-
source:
|
|
8264
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["props"]),
|
|
8263
8265
|
cteAlias
|
|
8264
8266
|
},
|
|
8265
8267
|
{
|
|
8266
8268
|
outputName: `${edgeAlias}_valid_from`,
|
|
8267
|
-
source:
|
|
8269
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["valid_from"]),
|
|
8268
8270
|
cteAlias
|
|
8269
8271
|
},
|
|
8270
8272
|
{
|
|
8271
8273
|
outputName: `${edgeAlias}_valid_to`,
|
|
8272
|
-
source:
|
|
8274
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["valid_to"]),
|
|
8273
8275
|
cteAlias
|
|
8274
8276
|
},
|
|
8275
8277
|
{
|
|
8276
8278
|
outputName: `${edgeAlias}_created_at`,
|
|
8277
|
-
source:
|
|
8279
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["created_at"]),
|
|
8278
8280
|
cteAlias
|
|
8279
8281
|
},
|
|
8280
8282
|
{
|
|
8281
8283
|
outputName: `${edgeAlias}_updated_at`,
|
|
8282
|
-
source:
|
|
8284
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["updated_at"]),
|
|
8283
8285
|
cteAlias
|
|
8284
8286
|
},
|
|
8285
8287
|
{
|
|
8286
8288
|
outputName: `${edgeAlias}_deleted_at`,
|
|
8287
|
-
source:
|
|
8289
|
+
source: chunk5ELKD2FQ_cjs.fieldRef(edgeAlias, ["deleted_at"]),
|
|
8288
8290
|
cteAlias
|
|
8289
8291
|
}
|
|
8290
8292
|
];
|
|
@@ -8597,10 +8599,10 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8597
8599
|
field2
|
|
8598
8600
|
) : this.#getOrderByTypeInfo(alias, field2);
|
|
8599
8601
|
const orderSpec = isSystem ? {
|
|
8600
|
-
field:
|
|
8602
|
+
field: chunk5ELKD2FQ_cjs.fieldRef(alias, [field2], { valueType: "string" }),
|
|
8601
8603
|
direction
|
|
8602
8604
|
} : {
|
|
8603
|
-
field:
|
|
8605
|
+
field: chunk5ELKD2FQ_cjs.fieldRef(alias, ["props"], {
|
|
8604
8606
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([field2]),
|
|
8605
8607
|
valueType: typeInfo?.valueType,
|
|
8606
8608
|
elementType: typeInfo?.elementType
|
|
@@ -8776,7 +8778,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8776
8778
|
kindNames,
|
|
8777
8779
|
property
|
|
8778
8780
|
) : void 0;
|
|
8779
|
-
const ref =
|
|
8781
|
+
const ref = chunk5ELKD2FQ_cjs.fieldRef(alias, ["props"], {
|
|
8780
8782
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([property]),
|
|
8781
8783
|
valueType: typeInfo?.valueType,
|
|
8782
8784
|
elementType: typeInfo?.elementType
|
|
@@ -8784,17 +8786,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8784
8786
|
return this.#buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
8785
8787
|
}
|
|
8786
8788
|
#buildFieldBuilderForTypeInfo(ref, typeInfo) {
|
|
8787
|
-
return
|
|
8789
|
+
return chunk5ELKD2FQ_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
8788
8790
|
}
|
|
8789
8791
|
#createNodeAccessor(alias) {
|
|
8790
8792
|
const kindNames = this.#getKindNamesForAlias(alias);
|
|
8791
|
-
const idAccessor =
|
|
8792
|
-
|
|
8793
|
+
const idAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8794
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8793
8795
|
);
|
|
8794
|
-
const kindAccessor =
|
|
8795
|
-
|
|
8796
|
+
const kindAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8797
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8796
8798
|
);
|
|
8797
|
-
const fulltextAccessor =
|
|
8799
|
+
const fulltextAccessor = chunk5ELKD2FQ_cjs.createFulltextAccessor(
|
|
8798
8800
|
alias,
|
|
8799
8801
|
() => this.#hasSearchableField(kindNames)
|
|
8800
8802
|
);
|
|
@@ -8869,7 +8871,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8869
8871
|
edgeKindNames,
|
|
8870
8872
|
property
|
|
8871
8873
|
) : void 0;
|
|
8872
|
-
const ref =
|
|
8874
|
+
const ref = chunk5ELKD2FQ_cjs.fieldRef(alias, ["props"], {
|
|
8873
8875
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([property]),
|
|
8874
8876
|
valueType: typeInfo?.valueType,
|
|
8875
8877
|
elementType: typeInfo?.elementType
|
|
@@ -8878,17 +8880,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8878
8880
|
}
|
|
8879
8881
|
#createEdgeAccessor(alias) {
|
|
8880
8882
|
const edgeKindNames = this.#getEdgeKindNamesForAlias(alias);
|
|
8881
|
-
const idAccessor =
|
|
8882
|
-
|
|
8883
|
+
const idAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8884
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8883
8885
|
);
|
|
8884
|
-
const kindAccessor =
|
|
8885
|
-
|
|
8886
|
+
const kindAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8887
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8886
8888
|
);
|
|
8887
|
-
const fromIdAccessor =
|
|
8888
|
-
|
|
8889
|
+
const fromIdAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8890
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
8889
8891
|
);
|
|
8890
|
-
const toIdAccessor =
|
|
8891
|
-
|
|
8892
|
+
const toIdAccessor = chunk5ELKD2FQ_cjs.stringField(
|
|
8893
|
+
chunk5ELKD2FQ_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
8892
8894
|
);
|
|
8893
8895
|
if (this.#state.dynamicEdgeAliases.has(alias)) {
|
|
8894
8896
|
return {
|
|
@@ -8927,7 +8929,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8927
8929
|
// src/query/builder/unionable-query.ts
|
|
8928
8930
|
function executeOnBackend(backend, recordedAsOf, promise, surface) {
|
|
8929
8931
|
if (recordedAsOf === void 0) return promise;
|
|
8930
|
-
return
|
|
8932
|
+
return chunkHP6LWBLB_cjs.withRecordedRelationsPrecondition(promise, {
|
|
8931
8933
|
dialect: backend.dialect,
|
|
8932
8934
|
surface
|
|
8933
8935
|
});
|
|
@@ -9565,7 +9567,7 @@ function processPage(schema, rows) {
|
|
|
9565
9567
|
skippedIds.push(row.id);
|
|
9566
9568
|
continue;
|
|
9567
9569
|
}
|
|
9568
|
-
const computed =
|
|
9570
|
+
const computed = chunk5ELKD2FQ_cjs.computeFulltextContent(schema, parsed);
|
|
9569
9571
|
if (computed === void 0) {
|
|
9570
9572
|
toDelete.push(row.id);
|
|
9571
9573
|
} else {
|
|
@@ -9646,7 +9648,7 @@ async function fetchNodesForRows(backend, graphId, rows) {
|
|
|
9646
9648
|
function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
|
|
9647
9649
|
const nodeType = ctx.registry.getNodeType(nodeKind);
|
|
9648
9650
|
if (nodeType === void 0) return void 0;
|
|
9649
|
-
const fields =
|
|
9651
|
+
const fields = chunk5ELKD2FQ_cjs.getEmbeddingFields(nodeType.schema);
|
|
9650
9652
|
const field2 = fields.find((entry2) => entry2.fieldPath === fieldPath);
|
|
9651
9653
|
if (field2 === void 0) return void 0;
|
|
9652
9654
|
return {
|
|
@@ -9956,7 +9958,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
|
|
|
9956
9958
|
...candidates === void 0 ? {} : { candidates }
|
|
9957
9959
|
});
|
|
9958
9960
|
return rows.map((row, index) => {
|
|
9959
|
-
const typedNode =
|
|
9961
|
+
const typedNode = chunkE2Q7SP2K_cjs.rowToNode(row.node);
|
|
9960
9962
|
return {
|
|
9961
9963
|
node: typedNode,
|
|
9962
9964
|
score: row.fusedScore,
|
|
@@ -10220,13 +10222,13 @@ async function fetchNodesByIds(backend, graphId, nodeKind, ids) {
|
|
|
10220
10222
|
const rows = await backend.getNodes(graphId, nodeKind, ids);
|
|
10221
10223
|
for (const row of rows) {
|
|
10222
10224
|
if (row.deleted_at !== void 0) continue;
|
|
10223
|
-
map.set(row.id,
|
|
10225
|
+
map.set(row.id, chunkE2Q7SP2K_cjs.rowToNode(row));
|
|
10224
10226
|
}
|
|
10225
10227
|
return map;
|
|
10226
10228
|
}
|
|
10227
10229
|
for (const id of ids) {
|
|
10228
10230
|
const row = await backend.getNode(graphId, nodeKind, id);
|
|
10229
|
-
if (row && row.deleted_at === void 0) map.set(row.id,
|
|
10231
|
+
if (row && row.deleted_at === void 0) map.set(row.id, chunkE2Q7SP2K_cjs.rowToNode(row));
|
|
10230
10232
|
}
|
|
10231
10233
|
return map;
|
|
10232
10234
|
}
|
|
@@ -10708,7 +10710,7 @@ function planRemovals(graph, names) {
|
|
|
10708
10710
|
if (namesSet.size === 0) {
|
|
10709
10711
|
return { document, removedNodeKinds: [], removedEdgeKinds: [] };
|
|
10710
10712
|
}
|
|
10711
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
10713
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkVXAFOF6Z_cjs.extensionKindNames(document);
|
|
10712
10714
|
const compileTimeNodeNames = new Set(
|
|
10713
10715
|
Object.keys(graph.nodes).filter((name) => !runtimeNodeNames.has(name))
|
|
10714
10716
|
);
|
|
@@ -10808,8 +10810,8 @@ function planRemovals(graph, names) {
|
|
|
10808
10810
|
function stripGraphExtension(graph) {
|
|
10809
10811
|
const document = graph.extension;
|
|
10810
10812
|
if (document === void 0) return graph;
|
|
10811
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
10812
|
-
const runtimeOntologyKeys =
|
|
10813
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkVXAFOF6Z_cjs.extensionKindNames(document);
|
|
10814
|
+
const runtimeOntologyKeys = chunkVXAFOF6Z_cjs.buildGraphExtensionOntologyKeySet(document);
|
|
10813
10815
|
const compileNodes = {};
|
|
10814
10816
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
10815
10817
|
if (runtimeNodeNames.has(name)) continue;
|
|
@@ -10821,7 +10823,7 @@ function stripGraphExtension(graph) {
|
|
|
10821
10823
|
compileEdges[name] = registration;
|
|
10822
10824
|
}
|
|
10823
10825
|
const compileOntology = graph.ontology.filter(
|
|
10824
|
-
(relation) => !runtimeOntologyKeys.has(
|
|
10826
|
+
(relation) => !runtimeOntologyKeys.has(chunkVXAFOF6Z_cjs.compileTimeOntologyKey(relation))
|
|
10825
10827
|
);
|
|
10826
10828
|
const compileIndexes = (graph.indexes ?? []).filter(
|
|
10827
10829
|
(index) => index.origin !== "runtime"
|
|
@@ -10861,11 +10863,11 @@ function buildCompileTimeReferentIndex(graph, runtimeEdgeNames) {
|
|
|
10861
10863
|
append(endpoint.kind, referent);
|
|
10862
10864
|
}
|
|
10863
10865
|
}
|
|
10864
|
-
const runtimeOntologyKeys =
|
|
10866
|
+
const runtimeOntologyKeys = chunkVXAFOF6Z_cjs.buildGraphExtensionOntologyKeySet(
|
|
10865
10867
|
graph.extension
|
|
10866
10868
|
);
|
|
10867
10869
|
for (const relation of graph.ontology) {
|
|
10868
|
-
if (runtimeOntologyKeys.has(
|
|
10870
|
+
if (runtimeOntologyKeys.has(chunkVXAFOF6Z_cjs.compileTimeOntologyKey(relation))) continue;
|
|
10869
10871
|
const fromName = chunkRW24SAHI_cjs.getTypeName(relation.from);
|
|
10870
10872
|
const toName = chunkRW24SAHI_cjs.getTypeName(relation.to);
|
|
10871
10873
|
const referent = {
|
|
@@ -10903,7 +10905,7 @@ function resolveTemporalOptions(ctx, options) {
|
|
|
10903
10905
|
};
|
|
10904
10906
|
}
|
|
10905
10907
|
function resolveReadSchema(ctx, options) {
|
|
10906
|
-
return
|
|
10908
|
+
return chunk5ELKD2FQ_cjs.recordedReadSchemaFor(
|
|
10907
10909
|
ctx.schema,
|
|
10908
10910
|
options.recordedAsOf,
|
|
10909
10911
|
ctx.recordedReadBinding,
|
|
@@ -10917,9 +10919,9 @@ function resolveTemporalFilter(ctx, options, tableAlias) {
|
|
|
10917
10919
|
asOf: resolved.asOf,
|
|
10918
10920
|
recordedAsOf: resolved.recordedAsOf,
|
|
10919
10921
|
tableAlias,
|
|
10920
|
-
currentTimestamp:
|
|
10922
|
+
currentTimestamp: chunk5ELKD2FQ_cjs.currentReadInstant()
|
|
10921
10923
|
};
|
|
10922
|
-
return
|
|
10924
|
+
return chunk5ELKD2FQ_cjs.compileTemporalFilter(filterOptions);
|
|
10923
10925
|
}
|
|
10924
10926
|
function resolveMaxHops(rawMaxHops, fallback, optionName) {
|
|
10925
10927
|
const value = rawMaxHops ?? fallback;
|
|
@@ -10963,7 +10965,7 @@ function assertEdgeKinds(edges) {
|
|
|
10963
10965
|
}
|
|
10964
10966
|
function compileNodeKindSeedFilter(nodeKinds) {
|
|
10965
10967
|
if (nodeKinds === void 0) return chunkX6RDQ5NB_cjs.sql`TRUE`;
|
|
10966
|
-
return
|
|
10968
|
+
return chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("n.kind"), nodeKinds);
|
|
10967
10969
|
}
|
|
10968
10970
|
function normalizeNodeKinds(nodeKinds) {
|
|
10969
10971
|
if (nodeKinds === void 0) return void 0;
|
|
@@ -11001,7 +11003,7 @@ async function executeDegree(ctx, nodeId, options = {}) {
|
|
|
11001
11003
|
compileDirectionFilter(ctx, direction, nodeId, schema.nodesTable)
|
|
11002
11004
|
];
|
|
11003
11005
|
if (options.edges !== void 0) {
|
|
11004
|
-
whereClauses.push(
|
|
11006
|
+
whereClauses.push(chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("kind"), options.edges));
|
|
11005
11007
|
}
|
|
11006
11008
|
const countExpr = direction === "both" ? chunkX6RDQ5NB_cjs.sql`COUNT(DISTINCT id)` : chunkX6RDQ5NB_cjs.sql`COUNT(*)`;
|
|
11007
11009
|
const query = chunkX6RDQ5NB_cjs.sql`SELECT ${countExpr} AS count FROM ${schema.edgesTable} WHERE ${chunkX6RDQ5NB_cjs.sql.join(whereClauses, chunkX6RDQ5NB_cjs.sql` AND `)}`;
|
|
@@ -11103,7 +11105,7 @@ async function runIterativeGraphOperation(ctx, options, plan) {
|
|
|
11103
11105
|
};
|
|
11104
11106
|
return ctx.backend.transaction(async (backend) => {
|
|
11105
11107
|
const temporaryBackend = requireTemporaryStatements(backend);
|
|
11106
|
-
const runId =
|
|
11108
|
+
const runId = chunk5ELKD2FQ_cjs.generateId();
|
|
11107
11109
|
const workingTable = chunkX6RDQ5NB_cjs.sql.identifier(
|
|
11108
11110
|
`typegraph_iterative_${runId.replaceAll("-", "_")}`
|
|
11109
11111
|
);
|
|
@@ -11201,7 +11203,7 @@ async function cleanupWorkingTables(context, cleanup, operationFailure) {
|
|
|
11201
11203
|
async function fetchVisibleWorkingNodes(operation, nodeIds) {
|
|
11202
11204
|
const nodes = /* @__PURE__ */ new Map();
|
|
11203
11205
|
for (const chunk2 of chunkValues(nodeIds, operation.maxWorkingSetSize)) {
|
|
11204
|
-
const query = chunkX6RDQ5NB_cjs.sql`SELECT n.id, n.kind FROM ${operation.schema.nodesTable} n WHERE n.graph_id = ${operation.ctx.graphId} AND n.id IN (${
|
|
11206
|
+
const query = chunkX6RDQ5NB_cjs.sql`SELECT n.id, n.kind FROM ${operation.schema.nodesTable} n WHERE n.graph_id = ${operation.ctx.graphId} AND n.id IN (${chunk5ELKD2FQ_cjs.sqlValueList(chunk2)}) AND ${operation.nodeTemporalFilter}`;
|
|
11205
11207
|
const rows = await operation.backend.execute(
|
|
11206
11208
|
chunkX6RDQ5NB_cjs.asCompiledRowsSql(query)
|
|
11207
11209
|
);
|
|
@@ -11348,7 +11350,7 @@ function compileDirectionalExpansion(operation, workingRelation, sourceFilter, e
|
|
|
11348
11350
|
return chunkX6RDQ5NB_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}`;
|
|
11349
11351
|
}
|
|
11350
11352
|
function compileDirectionalEdgeExpansion(operation, workingRelation, sourceFilter, edgeKinds, joinField, joinKindField, targetField, targetKindField, sourceProjection) {
|
|
11351
|
-
const edgeKindFilter =
|
|
11353
|
+
const edgeKindFilter = chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("e.kind"), edgeKinds);
|
|
11352
11354
|
const weightColumn = operation.weightExpression === void 0 ? chunkX6RDQ5NB_cjs.sql`` : chunkX6RDQ5NB_cjs.sql`, ${operation.weightExpression} AS weight`;
|
|
11353
11355
|
const sourceColumns = sourceProjection === void 0 ? chunkX6RDQ5NB_cjs.sql`` : chunkX6RDQ5NB_cjs.sql`, ${sourceProjection}`;
|
|
11354
11356
|
return chunkX6RDQ5NB_cjs.sql`SELECT w.node_id AS source_id, w.node_kind AS source_kind${sourceColumns}, e.${chunkX6RDQ5NB_cjs.sql.raw(targetField)} AS target_id, e.${chunkX6RDQ5NB_cjs.sql.raw(targetKindField)} AS target_kind${weightColumn} FROM ${workingRelation} w JOIN ${operation.schema.edgesTable} e ON e.${chunkX6RDQ5NB_cjs.sql.raw(joinField)} = w.node_id AND e.${chunkX6RDQ5NB_cjs.sql.raw(joinKindField)} = w.node_kind AND e.graph_id = ${operation.ctx.graphId} WHERE ${sourceFilter} AND ${edgeKindFilter} AND ${operation.edgeTemporalFilter}`;
|
|
@@ -11362,15 +11364,15 @@ function chunkValues(values, chunkSize) {
|
|
|
11362
11364
|
}
|
|
11363
11365
|
function createOperation(ctx, options, backend) {
|
|
11364
11366
|
const temporal = resolveTemporalOptions(ctx, options);
|
|
11365
|
-
const currentTimestamp =
|
|
11366
|
-
const nodeTemporalFilter =
|
|
11367
|
+
const currentTimestamp = chunk5ELKD2FQ_cjs.currentReadInstant();
|
|
11368
|
+
const nodeTemporalFilter = chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
11367
11369
|
mode: temporal.temporalMode,
|
|
11368
11370
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
11369
11371
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
11370
11372
|
tableAlias: "n",
|
|
11371
11373
|
currentTimestamp
|
|
11372
11374
|
});
|
|
11373
|
-
const edgeTemporalFilter =
|
|
11375
|
+
const edgeTemporalFilter = chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
11374
11376
|
mode: temporal.temporalMode,
|
|
11375
11377
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
11376
11378
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
@@ -12996,7 +12998,7 @@ async function assertValidEdgeWeights(operation, weightProperty, defaultWeight)
|
|
|
12996
12998
|
const negativeViolation = chunkX6RDQ5NB_cjs.sql`audited.is_number = 1 AND audited.weight_number < 0`;
|
|
12997
12999
|
const outOfRangeViolation = chunkX6RDQ5NB_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)))`;
|
|
12998
13000
|
for (const edgeKinds of operation.edgeKindChunks) {
|
|
12999
|
-
const edgeKindFilter =
|
|
13001
|
+
const edgeKindFilter = chunk5ELKD2FQ_cjs.compileKindFilter(chunkX6RDQ5NB_cjs.sql.raw("e.kind"), edgeKinds);
|
|
13000
13002
|
const rows = await operation.backend.execute(
|
|
13001
13003
|
chunkX6RDQ5NB_cjs.asCompiledRowsSql(chunkX6RDQ5NB_cjs.sql`
|
|
13002
13004
|
SELECT audited.edge_id, audited.edge_kind, audited.weight_text,
|
|
@@ -13421,7 +13423,7 @@ function createGraphAlgorithms(params) {
|
|
|
13421
13423
|
registry: params.registry,
|
|
13422
13424
|
backend: params.backend,
|
|
13423
13425
|
dialect: chunkUH2USOMG_cjs.getDialect(params.backend.dialect),
|
|
13424
|
-
schema: params.schema ??
|
|
13426
|
+
schema: params.schema ?? chunk5ELKD2FQ_cjs.createSqlSchema(params.backend.tableNames),
|
|
13425
13427
|
recordedReadBinding: params.recordedReadBinding,
|
|
13426
13428
|
defaultTemporalMode: params.defaultTemporalMode
|
|
13427
13429
|
};
|
|
@@ -13599,7 +13601,7 @@ function createEdgeCollection(config) {
|
|
|
13599
13601
|
},
|
|
13600
13602
|
async getByIds(ids, options) {
|
|
13601
13603
|
if (ids.length === 0) return [];
|
|
13602
|
-
const rowsById = await
|
|
13604
|
+
const rowsById = await chunk5ELKD2FQ_cjs.getEdgeRowsByIds(backend, graphId, ids);
|
|
13603
13605
|
const matches = temporalRowMatcher(options);
|
|
13604
13606
|
return ids.map((id) => {
|
|
13605
13607
|
const row = rowsById.get(id);
|
|
@@ -13701,7 +13703,7 @@ function createEdgeCollection(config) {
|
|
|
13701
13703
|
if (items.length === 0) return [];
|
|
13702
13704
|
const upsertAll = async (target) => {
|
|
13703
13705
|
const ids = items.map((item) => item.id);
|
|
13704
|
-
const existingMap = await
|
|
13706
|
+
const existingMap = await chunk5ELKD2FQ_cjs.getEdgeRowsByIds(target, graphId, ids);
|
|
13705
13707
|
const results2 = Array.from({ length: items.length });
|
|
13706
13708
|
const toCreate = [];
|
|
13707
13709
|
const toUpdate = [];
|
|
@@ -13958,7 +13960,7 @@ function createNodeCollection(config) {
|
|
|
13958
13960
|
},
|
|
13959
13961
|
async getByIds(ids, options) {
|
|
13960
13962
|
if (ids.length === 0) return [];
|
|
13961
|
-
const rowsById = await
|
|
13963
|
+
const rowsById = await chunk5ELKD2FQ_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
|
|
13962
13964
|
const matches = temporalRowMatcher(options);
|
|
13963
13965
|
return ids.map((id) => {
|
|
13964
13966
|
const row = rowsById.get(id);
|
|
@@ -14391,14 +14393,14 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
14391
14393
|
];
|
|
14392
14394
|
function createHistoryStoreBackendProjection(backend) {
|
|
14393
14395
|
return Object.freeze(
|
|
14394
|
-
|
|
14396
|
+
chunk5ELKD2FQ_cjs.projectBackendMembers(backend, HISTORY_STORE_BACKEND_KEYS)
|
|
14395
14397
|
);
|
|
14396
14398
|
}
|
|
14397
14399
|
|
|
14398
14400
|
// src/store/introspect.ts
|
|
14399
14401
|
function introspectSchema(graph, context) {
|
|
14400
14402
|
const extension = graph.extension;
|
|
14401
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
14403
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkVXAFOF6Z_cjs.extensionKindNames(extension);
|
|
14402
14404
|
const deprecated = graph.deprecatedKinds;
|
|
14403
14405
|
const kinds = [];
|
|
14404
14406
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
@@ -14409,7 +14411,7 @@ function introspectSchema(graph, context) {
|
|
|
14409
14411
|
description: reg.type.description,
|
|
14410
14412
|
annotations: reg.type.annotations,
|
|
14411
14413
|
deprecated: deprecated.has(name),
|
|
14412
|
-
properties:
|
|
14414
|
+
properties: chunkVXAFOF6Z_cjs.serializeSchemaProperties(reg.type.schema),
|
|
14413
14415
|
unique: (reg.unique ?? []).map((constraint) => ({
|
|
14414
14416
|
name: constraint.name,
|
|
14415
14417
|
fields: [...constraint.fields],
|
|
@@ -14430,17 +14432,17 @@ function introspectSchema(graph, context) {
|
|
|
14430
14432
|
to: reg.to.map((entry2) => entry2.kind),
|
|
14431
14433
|
cardinality: reg.cardinality ?? "many",
|
|
14432
14434
|
endpointExistence: reg.endpointExistence ?? "notDeleted",
|
|
14433
|
-
properties:
|
|
14435
|
+
properties: chunkVXAFOF6Z_cjs.serializeSchemaProperties(edgeType.schema),
|
|
14434
14436
|
annotations: edgeType.annotations,
|
|
14435
14437
|
deprecated: deprecated.has(name)
|
|
14436
14438
|
});
|
|
14437
14439
|
}
|
|
14438
|
-
const runtimeOntologyKeys =
|
|
14440
|
+
const runtimeOntologyKeys = chunkVXAFOF6Z_cjs.buildGraphExtensionOntologyKeySet(extension);
|
|
14439
14441
|
const ontology = graph.ontology.map((relation) => ({
|
|
14440
14442
|
metaEdge: relation.metaEdge.name,
|
|
14441
14443
|
from: chunkRW24SAHI_cjs.getTypeName(relation.from),
|
|
14442
14444
|
to: chunkRW24SAHI_cjs.getTypeName(relation.to),
|
|
14443
|
-
origin: runtimeOntologyKeys.has(
|
|
14445
|
+
origin: runtimeOntologyKeys.has(chunkVXAFOF6Z_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
|
|
14444
14446
|
}));
|
|
14445
14447
|
return {
|
|
14446
14448
|
graphId: context.graphId,
|
|
@@ -14956,7 +14958,7 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
14956
14958
|
chunkX6RDQ5NB_cjs.asCompiledRowsSql(chunkX6RDQ5NB_cjs.sql`
|
|
14957
14959
|
SELECT c.relname AS name
|
|
14958
14960
|
FROM pg_class c
|
|
14959
|
-
WHERE c.relname IN (${
|
|
14961
|
+
WHERE c.relname IN (${chunk5ELKD2FQ_cjs.sqlValueList(tableNames)})
|
|
14960
14962
|
AND c.relkind IN ('r', 'p')
|
|
14961
14963
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
14962
14964
|
`)
|
|
@@ -14969,7 +14971,7 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
14969
14971
|
SELECT name
|
|
14970
14972
|
FROM sqlite_master
|
|
14971
14973
|
WHERE type = 'table'
|
|
14972
|
-
AND name IN (${
|
|
14974
|
+
AND name IN (${chunk5ELKD2FQ_cjs.sqlValueList(tableNames)})
|
|
14973
14975
|
`)
|
|
14974
14976
|
);
|
|
14975
14977
|
return new Set(rows.map((row) => row.name));
|
|
@@ -14990,7 +14992,7 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
14990
14992
|
SELECT c.relname AS name, i.indisvalid AS valid
|
|
14991
14993
|
FROM pg_class c
|
|
14992
14994
|
JOIN pg_index i ON i.indexrelid = c.oid
|
|
14993
|
-
WHERE c.relname IN (${
|
|
14995
|
+
WHERE c.relname IN (${chunk5ELKD2FQ_cjs.sqlValueList(physicalIndexNames)})
|
|
14994
14996
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
14995
14997
|
`)
|
|
14996
14998
|
);
|
|
@@ -15003,7 +15005,7 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
15003
15005
|
SELECT name
|
|
15004
15006
|
FROM sqlite_master
|
|
15005
15007
|
WHERE type = 'index'
|
|
15006
|
-
AND name IN (${
|
|
15008
|
+
AND name IN (${chunk5ELKD2FQ_cjs.sqlValueList(physicalIndexNames)})
|
|
15007
15009
|
`)
|
|
15008
15010
|
);
|
|
15009
15011
|
for (const row of rows) valid.add(row.name);
|
|
@@ -15191,7 +15193,7 @@ async function computeIndexSignature(dialect, targetTableName, declaration) {
|
|
|
15191
15193
|
const hashable = {
|
|
15192
15194
|
dialect,
|
|
15193
15195
|
targetTableName,
|
|
15194
|
-
declaration:
|
|
15196
|
+
declaration: chunkVXAFOF6Z_cjs.serializeIndexDeclaration(declaration)
|
|
15195
15197
|
};
|
|
15196
15198
|
const json = JSON.stringify(hashable, chunkACSVZPK7_cjs.sortedReplacer);
|
|
15197
15199
|
return chunkZY4GXIVN_cjs.sha256Hex(json, 16);
|
|
@@ -15233,7 +15235,7 @@ async function materializeRemovals(context, options = {}) {
|
|
|
15233
15235
|
fulltextTable,
|
|
15234
15236
|
uniquesTable,
|
|
15235
15237
|
captureRecordedRemovals,
|
|
15236
|
-
recordedSchema: captureRecordedRemovals ? context.recordedSchema ??
|
|
15238
|
+
recordedSchema: captureRecordedRemovals ? context.recordedSchema ?? chunk5ELKD2FQ_cjs.createSqlSchema(backend.tableNames) : void 0
|
|
15237
15239
|
};
|
|
15238
15240
|
return {
|
|
15239
15241
|
results: await runMaterialization(
|
|
@@ -15264,14 +15266,14 @@ async function reconcilePendingRemovals(context) {
|
|
|
15264
15266
|
const reconciliations = [];
|
|
15265
15267
|
const stopAtVersion = marker ?? 1;
|
|
15266
15268
|
let currentRow = activeRow;
|
|
15267
|
-
let currentSchema =
|
|
15269
|
+
let currentSchema = chunkVXAFOF6Z_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
15268
15270
|
while (currentRow.version > stopAtVersion) {
|
|
15269
15271
|
const priorRow = await backend.getSchemaVersion(
|
|
15270
15272
|
graphId,
|
|
15271
15273
|
currentRow.version - 1
|
|
15272
15274
|
);
|
|
15273
15275
|
if (priorRow === void 0) break;
|
|
15274
|
-
const priorSchema =
|
|
15276
|
+
const priorSchema = chunkVXAFOF6Z_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
15275
15277
|
for (const entity of ENTITY_KINDS) {
|
|
15276
15278
|
const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
|
|
15277
15279
|
const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
|
|
@@ -15361,7 +15363,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row) {
|
|
|
15361
15363
|
const recordedSchema = ctx.recordedSchema;
|
|
15362
15364
|
try {
|
|
15363
15365
|
await ctx.backend.transaction(async (target) => {
|
|
15364
|
-
await
|
|
15366
|
+
await chunk5ELKD2FQ_cjs.closeRecordedHardDeletedKind(
|
|
15365
15367
|
target,
|
|
15366
15368
|
recordedSchema,
|
|
15367
15369
|
ctx.graphId,
|
|
@@ -15371,7 +15373,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row) {
|
|
|
15371
15373
|
await executeDeleteStatements(target, deleteStatements);
|
|
15372
15374
|
});
|
|
15373
15375
|
} catch (error) {
|
|
15374
|
-
if (!
|
|
15376
|
+
if (!chunkHP6LWBLB_cjs.isMissingTableError(error)) throw error;
|
|
15375
15377
|
await executeDeleteStatements(ctx.backend, deleteStatements);
|
|
15376
15378
|
}
|
|
15377
15379
|
}
|
|
@@ -15431,7 +15433,7 @@ async function dropVectorSlotStorage(backend, strategy, executeDdl, slot) {
|
|
|
15431
15433
|
await executeDdl(ddl);
|
|
15432
15434
|
}
|
|
15433
15435
|
} catch (error) {
|
|
15434
|
-
if (!
|
|
15436
|
+
if (!chunkHP6LWBLB_cjs.isMissingTableError(error)) throw error;
|
|
15435
15437
|
}
|
|
15436
15438
|
await backend.deleteVectorSlotContribution?.(slot);
|
|
15437
15439
|
}
|
|
@@ -15440,7 +15442,7 @@ async function resolveRemovedKindEmbeddingSlots(backend, row) {
|
|
|
15440
15442
|
if (priorVersion < 1) return [];
|
|
15441
15443
|
const priorRow = await backend.getSchemaVersion(row.graphId, priorVersion);
|
|
15442
15444
|
if (priorRow === void 0) return [];
|
|
15443
|
-
const priorSchema =
|
|
15445
|
+
const priorSchema = chunkVXAFOF6Z_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
15444
15446
|
const slots = /* @__PURE__ */ new Map();
|
|
15445
15447
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
15446
15448
|
if (declaration.entity === "vector" && declaration.kind === row.kindName) {
|
|
@@ -15470,7 +15472,7 @@ async function reclaimRemovedVectorFieldTables(context) {
|
|
|
15470
15472
|
let perBackend = reclaimCache.get(backend);
|
|
15471
15473
|
const cached = perBackend?.get(cacheKey);
|
|
15472
15474
|
if (cached !== void 0) return cached;
|
|
15473
|
-
const activeSchema =
|
|
15475
|
+
const activeSchema = chunkVXAFOF6Z_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
15474
15476
|
const activeVectorFields = /* @__PURE__ */ new Set();
|
|
15475
15477
|
for (const declaration of activeSchema.indexes ?? []) {
|
|
15476
15478
|
if (declaration.entity === "vector") {
|
|
@@ -15484,7 +15486,7 @@ async function reclaimRemovedVectorFieldTables(context) {
|
|
|
15484
15486
|
for (let version = activeRow.version - 1; version >= 1; version -= 1) {
|
|
15485
15487
|
const priorRow = await backend.getSchemaVersion(graphId, version);
|
|
15486
15488
|
if (priorRow === void 0) continue;
|
|
15487
|
-
const priorSchema =
|
|
15489
|
+
const priorSchema = chunkVXAFOF6Z_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
15488
15490
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
15489
15491
|
if (declaration.entity !== "vector") continue;
|
|
15490
15492
|
const key = vectorFieldKey(declaration.kind, declaration.fieldPath);
|
|
@@ -15686,7 +15688,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
15686
15688
|
const toKind = input.toKind;
|
|
15687
15689
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
15688
15690
|
const edgeKind = registration.type;
|
|
15689
|
-
const endpointError =
|
|
15691
|
+
const endpointError = chunk5ELKD2FQ_cjs.validateEdgeEndpoints(
|
|
15690
15692
|
kind,
|
|
15691
15693
|
fromKind,
|
|
15692
15694
|
toKind,
|
|
@@ -15727,7 +15729,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
15727
15729
|
registry: ctx.registry,
|
|
15728
15730
|
backend
|
|
15729
15731
|
};
|
|
15730
|
-
await
|
|
15732
|
+
await chunkE2Q7SP2K_cjs.checkCardinalityConstraint(
|
|
15731
15733
|
constraintContext,
|
|
15732
15734
|
kind,
|
|
15733
15735
|
cardinality,
|
|
@@ -15755,16 +15757,16 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
15755
15757
|
}
|
|
15756
15758
|
async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
15757
15759
|
const kind = input.kind;
|
|
15758
|
-
const id = input.id ??
|
|
15760
|
+
const id = input.id ?? chunk5ELKD2FQ_cjs.generateId();
|
|
15759
15761
|
const opContext = ctx.createOperationContext("create", "edge", kind, id);
|
|
15760
|
-
return
|
|
15762
|
+
return chunkE2Q7SP2K_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
15761
15763
|
const prepared = await validateAndPrepareEdgeCreate(ctx, input, id, target);
|
|
15762
15764
|
let row;
|
|
15763
15765
|
{
|
|
15764
15766
|
row = await target.insertEdge(prepared.insertParams);
|
|
15765
15767
|
}
|
|
15766
15768
|
if (row === void 0) return;
|
|
15767
|
-
return
|
|
15769
|
+
return chunkE2Q7SP2K_cjs.rowToEdge(row);
|
|
15768
15770
|
});
|
|
15769
15771
|
}
|
|
15770
15772
|
async function executeEdgeCreate(ctx, input, backend) {
|
|
@@ -15807,7 +15809,7 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
|
|
|
15807
15809
|
await primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow);
|
|
15808
15810
|
const preparedCreates = [];
|
|
15809
15811
|
for (const input of inputs) {
|
|
15810
|
-
const id = input.id ??
|
|
15812
|
+
const id = input.id ?? chunk5ELKD2FQ_cjs.generateId();
|
|
15811
15813
|
const prepared = await validateAndPrepareEdgeCreate(
|
|
15812
15814
|
ctx,
|
|
15813
15815
|
input,
|
|
@@ -15829,30 +15831,30 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
15829
15831
|
if (inputs.length === 0) {
|
|
15830
15832
|
return;
|
|
15831
15833
|
}
|
|
15832
|
-
await
|
|
15834
|
+
await chunkE2Q7SP2K_cjs.runInWriteTransaction(ctx, backend, async (target) => {
|
|
15833
15835
|
const { batchInsertParams } = await prepareEdgeBatchCreates(
|
|
15834
15836
|
ctx,
|
|
15835
15837
|
inputs,
|
|
15836
15838
|
target
|
|
15837
15839
|
);
|
|
15838
|
-
await
|
|
15840
|
+
await chunk5ELKD2FQ_cjs.runInsertBatch(chunk5ELKD2FQ_cjs.edgeInsertDispatch(target), batchInsertParams);
|
|
15839
15841
|
});
|
|
15840
15842
|
}
|
|
15841
15843
|
async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
15842
15844
|
if (inputs.length === 0) {
|
|
15843
15845
|
return [];
|
|
15844
15846
|
}
|
|
15845
|
-
return
|
|
15847
|
+
return chunkE2Q7SP2K_cjs.runInWriteTransaction(ctx, backend, async (target) => {
|
|
15846
15848
|
const { batchInsertParams } = await prepareEdgeBatchCreates(
|
|
15847
15849
|
ctx,
|
|
15848
15850
|
inputs,
|
|
15849
15851
|
target
|
|
15850
15852
|
);
|
|
15851
|
-
const rows = await
|
|
15852
|
-
|
|
15853
|
+
const rows = await chunk5ELKD2FQ_cjs.runInsertBatchReturning(
|
|
15854
|
+
chunk5ELKD2FQ_cjs.edgeInsertDispatch(target),
|
|
15853
15855
|
batchInsertParams
|
|
15854
15856
|
);
|
|
15855
|
-
return rows.map((row) =>
|
|
15857
|
+
return rows.map((row) => chunkE2Q7SP2K_cjs.rowToEdge(row));
|
|
15856
15858
|
});
|
|
15857
15859
|
}
|
|
15858
15860
|
function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
@@ -15903,7 +15905,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
15903
15905
|
if (validTo !== void 0) updateParams.validTo = validTo;
|
|
15904
15906
|
if (options?.clearDeleted) updateParams.clearDeleted = true;
|
|
15905
15907
|
const row = await target.updateEdge(updateParams);
|
|
15906
|
-
return
|
|
15908
|
+
return chunkE2Q7SP2K_cjs.rowToEdge(row);
|
|
15907
15909
|
}
|
|
15908
15910
|
async function executeEdgeUpdate(ctx, input, backend) {
|
|
15909
15911
|
const id = input.id;
|
|
@@ -15912,7 +15914,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
15912
15914
|
throw new chunkSAFZ6JTI_cjs.EdgeNotFoundError("unknown", id);
|
|
15913
15915
|
}
|
|
15914
15916
|
const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
|
|
15915
|
-
return
|
|
15917
|
+
return chunkE2Q7SP2K_cjs.runHookedWriteOperation(
|
|
15916
15918
|
ctx,
|
|
15917
15919
|
opContext,
|
|
15918
15920
|
backend,
|
|
@@ -15920,7 +15922,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
15920
15922
|
);
|
|
15921
15923
|
}
|
|
15922
15924
|
async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
|
|
15923
|
-
return
|
|
15925
|
+
return chunkE2Q7SP2K_cjs.runInWriteTransaction(
|
|
15924
15926
|
ctx,
|
|
15925
15927
|
backend,
|
|
15926
15928
|
(target) => performEdgeUpdate(ctx, input, target, options)
|
|
@@ -15930,7 +15932,7 @@ async function executeEdgeDelete(ctx, id, backend) {
|
|
|
15930
15932
|
const gate = await backend.getEdge(ctx.graphId, id);
|
|
15931
15933
|
if (!gate || gate.deleted_at) return;
|
|
15932
15934
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
15933
|
-
return
|
|
15935
|
+
return chunkE2Q7SP2K_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
15934
15936
|
await target.deleteEdge({
|
|
15935
15937
|
graphId: ctx.graphId,
|
|
15936
15938
|
id
|
|
@@ -15941,7 +15943,7 @@ async function executeEdgeHardDelete(ctx, id, backend) {
|
|
|
15941
15943
|
const gate = await backend.getEdge(ctx.graphId, id);
|
|
15942
15944
|
if (!gate) return;
|
|
15943
15945
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
15944
|
-
return
|
|
15946
|
+
return chunkE2Q7SP2K_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
15945
15947
|
await target.hardDeleteEdge({
|
|
15946
15948
|
graphId: ctx.graphId,
|
|
15947
15949
|
id
|
|
@@ -16048,9 +16050,9 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
|
|
|
16048
16050
|
...options?.asOf !== void 0 && { asOf: options.asOf }
|
|
16049
16051
|
});
|
|
16050
16052
|
if (candidateRows.length === 0) return void 0;
|
|
16051
|
-
if (matchOn.length === 0) return
|
|
16053
|
+
if (matchOn.length === 0) return chunkE2Q7SP2K_cjs.rowToEdge(chunk764JHTLT_cjs.requireDefined(candidateRows[0]));
|
|
16052
16054
|
const { liveRow } = findMatchingEdge(candidateRows, matchOn, props);
|
|
16053
|
-
return liveRow === void 0 ? void 0 :
|
|
16055
|
+
return liveRow === void 0 ? void 0 : chunkE2Q7SP2K_cjs.rowToEdge(liveRow);
|
|
16054
16056
|
}
|
|
16055
16057
|
async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, props, backend, options) {
|
|
16056
16058
|
const ifExists = options?.ifExists ?? "return";
|
|
@@ -16079,7 +16081,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
16079
16081
|
validatedProps
|
|
16080
16082
|
);
|
|
16081
16083
|
if (probedLiveRow !== void 0) {
|
|
16082
|
-
return { edge:
|
|
16084
|
+
return { edge: chunkE2Q7SP2K_cjs.rowToEdge(probedLiveRow), action: "found" };
|
|
16083
16085
|
}
|
|
16084
16086
|
}
|
|
16085
16087
|
async function attempt() {
|
|
@@ -16112,7 +16114,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
16112
16114
|
}
|
|
16113
16115
|
if (liveRow !== void 0) {
|
|
16114
16116
|
if (ifExists === "return") {
|
|
16115
|
-
return { edge:
|
|
16117
|
+
return { edge: chunkE2Q7SP2K_cjs.rowToEdge(liveRow), action: "found" };
|
|
16116
16118
|
}
|
|
16117
16119
|
const edge2 = await executeEdgeUpsertUpdate(
|
|
16118
16120
|
ctx,
|
|
@@ -16132,7 +16134,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
16132
16134
|
registry: ctx.registry,
|
|
16133
16135
|
backend
|
|
16134
16136
|
};
|
|
16135
|
-
await
|
|
16137
|
+
await chunkE2Q7SP2K_cjs.checkCardinalityConstraint(
|
|
16136
16138
|
constraintContext,
|
|
16137
16139
|
kind,
|
|
16138
16140
|
cardinality,
|
|
@@ -16278,7 +16280,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16278
16280
|
if (allFoundLive) {
|
|
16279
16281
|
const found = Array.from({ length: items.length });
|
|
16280
16282
|
for (const entry2 of probe.toFetch) {
|
|
16281
|
-
found[entry2.index] = { edge:
|
|
16283
|
+
found[entry2.index] = { edge: chunkE2Q7SP2K_cjs.rowToEdge(entry2.row), action: "found" };
|
|
16282
16284
|
}
|
|
16283
16285
|
for (const { index, sourceIndex } of probe.duplicateOf) {
|
|
16284
16286
|
found[index] = {
|
|
@@ -16289,7 +16291,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16289
16291
|
return found;
|
|
16290
16292
|
}
|
|
16291
16293
|
}
|
|
16292
|
-
return
|
|
16294
|
+
return chunkE2Q7SP2K_cjs.runInWriteTransaction(ctx, backend, async (target) => {
|
|
16293
16295
|
const { toCreate, toFetch, duplicateOf } = partitionEntries(
|
|
16294
16296
|
await fetchRowsByEndpoint(target)
|
|
16295
16297
|
);
|
|
@@ -16316,7 +16318,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16316
16318
|
registry: ctx.registry,
|
|
16317
16319
|
backend: target
|
|
16318
16320
|
};
|
|
16319
|
-
await
|
|
16321
|
+
await chunkE2Q7SP2K_cjs.checkCardinalityConstraint(
|
|
16320
16322
|
constraintContext,
|
|
16321
16323
|
kind,
|
|
16322
16324
|
cardinality,
|
|
@@ -16341,7 +16343,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16341
16343
|
);
|
|
16342
16344
|
results[entry2.index] = { edge, action: "updated" };
|
|
16343
16345
|
} else {
|
|
16344
|
-
results[entry2.index] = { edge:
|
|
16346
|
+
results[entry2.index] = { edge: chunkE2Q7SP2K_cjs.rowToEdge(entry2.row), action: "found" };
|
|
16345
16347
|
}
|
|
16346
16348
|
}
|
|
16347
16349
|
for (const { index, sourceIndex } of duplicateOf) {
|
|
@@ -16354,21 +16356,22 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16354
16356
|
|
|
16355
16357
|
// src/store/recorded-read-service.ts
|
|
16356
16358
|
var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
|
|
16359
|
+
var RECORDED_SCAN_LIMIT = 1e3;
|
|
16357
16360
|
function recordedPointReadIdChunk(backend) {
|
|
16358
|
-
const budget =
|
|
16361
|
+
const budget = chunk5ELKD2FQ_cjs.recordedBindParamBudget(backend);
|
|
16359
16362
|
return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
|
|
16360
16363
|
}
|
|
16361
16364
|
function recordedRelationErrorDetails(backend, surface) {
|
|
16362
16365
|
return { dialect: backend.dialect, surface };
|
|
16363
16366
|
}
|
|
16364
16367
|
function withRelationsPrecondition(backend, promise, surface) {
|
|
16365
|
-
return
|
|
16368
|
+
return chunkHP6LWBLB_cjs.withRecordedRelationsPrecondition(
|
|
16366
16369
|
promise,
|
|
16367
16370
|
recordedRelationErrorDetails(backend, surface)
|
|
16368
16371
|
);
|
|
16369
16372
|
}
|
|
16370
16373
|
function createRecordedReadBackend(backend, surface) {
|
|
16371
|
-
const projectedBackend =
|
|
16374
|
+
const projectedBackend = chunk5ELKD2FQ_cjs.createGraphBackendProjection(backend);
|
|
16372
16375
|
return chunkGNPGGLAE_cjs.createBackendOverlay(projectedBackend, {
|
|
16373
16376
|
execute: (query) => withRelationsPrecondition(backend, backend.execute(query), surface),
|
|
16374
16377
|
...backend.executeRaw === void 0 ? {} : {
|
|
@@ -16388,17 +16391,17 @@ function recordedTemporalFilter(backend, coordinate, tableAlias) {
|
|
|
16388
16391
|
{ code: "RECORDED_POINT_READ_MISSING_COORDINATE" }
|
|
16389
16392
|
);
|
|
16390
16393
|
}
|
|
16391
|
-
return
|
|
16394
|
+
return chunk5ELKD2FQ_cjs.compileTemporalFilter({
|
|
16392
16395
|
mode: coordinate.valid.mode,
|
|
16393
16396
|
asOf: coordinate.valid.asOf,
|
|
16394
16397
|
recordedAsOf,
|
|
16395
16398
|
tableAlias,
|
|
16396
|
-
currentTimestamp:
|
|
16399
|
+
currentTimestamp: chunk5ELKD2FQ_cjs.currentReadInstant()
|
|
16397
16400
|
});
|
|
16398
16401
|
}
|
|
16399
16402
|
function recordedRelationInvariantError(params) {
|
|
16400
16403
|
return new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
16401
|
-
"Recorded relation invariant violation: more than one recorded row matched the requested
|
|
16404
|
+
"Recorded relation invariant violation: more than one recorded row matched the requested read.",
|
|
16402
16405
|
{
|
|
16403
16406
|
code: "RECORDED_RELATION_INVARIANT_VIOLATION",
|
|
16404
16407
|
graphId: params.graphId,
|
|
@@ -16414,6 +16417,57 @@ function recordedRelationInvariantError(params) {
|
|
|
16414
16417
|
}
|
|
16415
16418
|
);
|
|
16416
16419
|
}
|
|
16420
|
+
function validateRecordedScanLimit(limit) {
|
|
16421
|
+
if (limit === void 0) return RECORDED_SCAN_LIMIT;
|
|
16422
|
+
if (!Number.isInteger(limit) || limit <= 0 || limit > RECORDED_SCAN_LIMIT) {
|
|
16423
|
+
throw new chunkSAFZ6JTI_cjs.ValidationError(
|
|
16424
|
+
`Recorded scan limit must be an integer between 1 and ${RECORDED_SCAN_LIMIT}, got: ${String(limit)}`,
|
|
16425
|
+
{
|
|
16426
|
+
issues: [
|
|
16427
|
+
{
|
|
16428
|
+
path: "limit",
|
|
16429
|
+
message: `Must be an integer between 1 and ${RECORDED_SCAN_LIMIT}.`
|
|
16430
|
+
}
|
|
16431
|
+
]
|
|
16432
|
+
}
|
|
16433
|
+
);
|
|
16434
|
+
}
|
|
16435
|
+
return limit;
|
|
16436
|
+
}
|
|
16437
|
+
function recordedScanCursorScope(graphId, entity, kind, coordinate) {
|
|
16438
|
+
return JSON.stringify([
|
|
16439
|
+
"recorded-scan",
|
|
16440
|
+
graphId,
|
|
16441
|
+
entity,
|
|
16442
|
+
kind,
|
|
16443
|
+
coordinate.valid.mode,
|
|
16444
|
+
coordinate.valid.asOf,
|
|
16445
|
+
coordinate.recorded?.asOf
|
|
16446
|
+
]);
|
|
16447
|
+
}
|
|
16448
|
+
function invalidRecordedScanCursor() {
|
|
16449
|
+
return new chunkSAFZ6JTI_cjs.ValidationError(
|
|
16450
|
+
"Recorded scan cursor does not match this graph, collection, or temporal coordinate.",
|
|
16451
|
+
{
|
|
16452
|
+
issues: [
|
|
16453
|
+
{
|
|
16454
|
+
path: "after",
|
|
16455
|
+
message: "Use a cursor returned by the same recorded collection scan."
|
|
16456
|
+
}
|
|
16457
|
+
]
|
|
16458
|
+
}
|
|
16459
|
+
);
|
|
16460
|
+
}
|
|
16461
|
+
function decodeRecordedScanCursor(cursor, expectedScope) {
|
|
16462
|
+
const decoded = decodeCursor(cursor);
|
|
16463
|
+
if (decoded.d !== "f" || decoded.cols.length !== 1 || decoded.cols[0] !== expectedScope || decoded.vals.length !== 1 || typeof decoded.vals[0] !== "string") {
|
|
16464
|
+
throw invalidRecordedScanCursor();
|
|
16465
|
+
}
|
|
16466
|
+
return decoded.vals[0];
|
|
16467
|
+
}
|
|
16468
|
+
function encodeRecordedScanCursor(id, scope) {
|
|
16469
|
+
return encodeCursor({ v: 1, d: "f", vals: [id], cols: [scope] });
|
|
16470
|
+
}
|
|
16417
16471
|
function createRecordedReadService(params) {
|
|
16418
16472
|
const {
|
|
16419
16473
|
graphId,
|
|
@@ -16422,7 +16476,12 @@ function createRecordedReadService(params) {
|
|
|
16422
16476
|
mapRecordedNodeRow,
|
|
16423
16477
|
mapRecordedEdgeRow
|
|
16424
16478
|
} = params;
|
|
16425
|
-
const recordedSchema = recordedReadBinding === void 0 ? void 0 :
|
|
16479
|
+
const recordedSchema = recordedReadBinding === void 0 ? void 0 : chunk5ELKD2FQ_cjs.recordedReadSqlSchema(recordedReadBinding);
|
|
16480
|
+
function schemaForRecordedRead(surface) {
|
|
16481
|
+
return recordedSchema ?? chunk5ELKD2FQ_cjs.recordedReadSqlSchema(
|
|
16482
|
+
chunk5ELKD2FQ_cjs.requireRecordedReadBinding(recordedReadBinding, surface)
|
|
16483
|
+
);
|
|
16484
|
+
}
|
|
16426
16485
|
async function recordedGetByIds(read) {
|
|
16427
16486
|
const { table, alias, kind, ids, coordinate, toEntity, entity } = read;
|
|
16428
16487
|
if (ids.length === 0) return [];
|
|
@@ -16438,7 +16497,7 @@ function createRecordedReadService(params) {
|
|
|
16438
16497
|
SELECT * FROM ${table} ${aliasSql}
|
|
16439
16498
|
WHERE ${aliasSql}.graph_id = ${graphId}
|
|
16440
16499
|
AND ${aliasSql}.kind = ${kind}
|
|
16441
|
-
AND ${aliasSql}.id IN (${
|
|
16500
|
+
AND ${aliasSql}.id IN (${chunk5ELKD2FQ_cjs.sqlValueList(idChunk)})
|
|
16442
16501
|
AND ${temporalFilter}
|
|
16443
16502
|
ORDER BY ${aliasSql}.recorded_from
|
|
16444
16503
|
`)
|
|
@@ -16465,10 +16524,51 @@ function createRecordedReadService(params) {
|
|
|
16465
16524
|
}
|
|
16466
16525
|
return ids.map((id) => byId.get(id));
|
|
16467
16526
|
}
|
|
16527
|
+
async function recordedScan(scan) {
|
|
16528
|
+
const { table, alias, kind, coordinate, options, toEntity, entity } = scan;
|
|
16529
|
+
const limit = validateRecordedScanLimit(options?.limit);
|
|
16530
|
+
const scope = recordedScanCursorScope(graphId, entity, kind, coordinate);
|
|
16531
|
+
const after = options?.after === void 0 ? void 0 : decodeRecordedScanCursor(options.after, scope);
|
|
16532
|
+
const aliasSql = chunkX6RDQ5NB_cjs.sql.raw(alias);
|
|
16533
|
+
const temporalFilter = recordedTemporalFilter(backend, coordinate, alias);
|
|
16534
|
+
const rows = await withRelationsPrecondition(
|
|
16535
|
+
backend,
|
|
16536
|
+
backend.execute(
|
|
16537
|
+
chunkX6RDQ5NB_cjs.asCompiledRowsSql(chunkX6RDQ5NB_cjs.sql`
|
|
16538
|
+
SELECT * FROM ${table} ${aliasSql}
|
|
16539
|
+
WHERE ${aliasSql}.graph_id = ${graphId}
|
|
16540
|
+
AND ${aliasSql}.kind = ${kind}
|
|
16541
|
+
${after === void 0 ? chunkX6RDQ5NB_cjs.sql.raw("") : chunkX6RDQ5NB_cjs.sql`AND ${aliasSql}.id > ${after}`}
|
|
16542
|
+
AND ${temporalFilter}
|
|
16543
|
+
ORDER BY ${aliasSql}.id ASC, ${aliasSql}.recorded_from ASC
|
|
16544
|
+
LIMIT ${limit + 1}
|
|
16545
|
+
`)
|
|
16546
|
+
),
|
|
16547
|
+
"recorded-scan"
|
|
16548
|
+
);
|
|
16549
|
+
const entities = rows.map((row) => toEntity(row));
|
|
16550
|
+
for (let index = 1; index < entities.length; index += 1) {
|
|
16551
|
+
const previous = chunk764JHTLT_cjs.requireDefined(entities[index - 1]);
|
|
16552
|
+
const current = chunk764JHTLT_cjs.requireDefined(entities[index]);
|
|
16553
|
+
if (previous.id !== current.id) continue;
|
|
16554
|
+
throw recordedRelationInvariantError({
|
|
16555
|
+
graphId,
|
|
16556
|
+
entity,
|
|
16557
|
+
kind,
|
|
16558
|
+
id: current.id,
|
|
16559
|
+
coordinate
|
|
16560
|
+
});
|
|
16561
|
+
}
|
|
16562
|
+
const hasNextPage = entities.length > limit;
|
|
16563
|
+
const data = hasNextPage ? entities.slice(0, limit) : entities;
|
|
16564
|
+
return {
|
|
16565
|
+
data,
|
|
16566
|
+
nextCursor: hasNextPage ? encodeRecordedScanCursor(chunk764JHTLT_cjs.requireDefined(data.at(-1)).id, scope) : void 0,
|
|
16567
|
+
hasNextPage
|
|
16568
|
+
};
|
|
16569
|
+
}
|
|
16468
16570
|
function nodeGetByIds(kind, ids, coordinate) {
|
|
16469
|
-
const schema =
|
|
16470
|
-
chunkNWYCOFEZ_cjs.requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
|
|
16471
|
-
);
|
|
16571
|
+
const schema = schemaForRecordedRead("recorded-point-read");
|
|
16472
16572
|
return recordedGetByIds({
|
|
16473
16573
|
entity: "node",
|
|
16474
16574
|
table: schema.nodesTable,
|
|
@@ -16476,13 +16576,11 @@ function createRecordedReadService(params) {
|
|
|
16476
16576
|
kind,
|
|
16477
16577
|
ids,
|
|
16478
16578
|
coordinate,
|
|
16479
|
-
toEntity: (row) =>
|
|
16579
|
+
toEntity: (row) => chunkE2Q7SP2K_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
16480
16580
|
});
|
|
16481
16581
|
}
|
|
16482
16582
|
function edgeGetByIds(kind, ids, coordinate) {
|
|
16483
|
-
const schema =
|
|
16484
|
-
chunkNWYCOFEZ_cjs.requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
|
|
16485
|
-
);
|
|
16583
|
+
const schema = schemaForRecordedRead("recorded-point-read");
|
|
16486
16584
|
return recordedGetByIds({
|
|
16487
16585
|
entity: "edge",
|
|
16488
16586
|
table: schema.edgesTable,
|
|
@@ -16490,13 +16588,37 @@ function createRecordedReadService(params) {
|
|
|
16490
16588
|
kind,
|
|
16491
16589
|
ids,
|
|
16492
16590
|
coordinate,
|
|
16493
|
-
toEntity: (row) =>
|
|
16591
|
+
toEntity: (row) => chunkE2Q7SP2K_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
16592
|
+
});
|
|
16593
|
+
}
|
|
16594
|
+
function nodeScan(kind, coordinate, options) {
|
|
16595
|
+
const schema = schemaForRecordedRead("recorded-scan");
|
|
16596
|
+
return recordedScan({
|
|
16597
|
+
entity: "node",
|
|
16598
|
+
table: schema.nodesTable,
|
|
16599
|
+
alias: "n",
|
|
16600
|
+
kind,
|
|
16601
|
+
coordinate,
|
|
16602
|
+
options,
|
|
16603
|
+
toEntity: (row) => chunkE2Q7SP2K_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
16604
|
+
});
|
|
16605
|
+
}
|
|
16606
|
+
function edgeScan(kind, coordinate, options) {
|
|
16607
|
+
const schema = schemaForRecordedRead("recorded-scan");
|
|
16608
|
+
return recordedScan({
|
|
16609
|
+
entity: "edge",
|
|
16610
|
+
table: schema.edgesTable,
|
|
16611
|
+
alias: "e",
|
|
16612
|
+
kind,
|
|
16613
|
+
coordinate,
|
|
16614
|
+
options,
|
|
16615
|
+
toEntity: (row) => chunkE2Q7SP2K_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
16494
16616
|
});
|
|
16495
16617
|
}
|
|
16496
16618
|
return {
|
|
16497
16619
|
backendForCoordinate(coordinate, surface) {
|
|
16498
16620
|
if (coordinate.recorded === void 0) return backend;
|
|
16499
|
-
|
|
16621
|
+
chunk5ELKD2FQ_cjs.requireRecordedReadBinding(recordedReadBinding, surface);
|
|
16500
16622
|
return createRecordedReadBackend(backend, surface);
|
|
16501
16623
|
},
|
|
16502
16624
|
async nodeGetById(kind, id, coordinate) {
|
|
@@ -16504,11 +16626,13 @@ function createRecordedReadService(params) {
|
|
|
16504
16626
|
return results[0];
|
|
16505
16627
|
},
|
|
16506
16628
|
nodeGetByIds,
|
|
16629
|
+
nodeScan,
|
|
16507
16630
|
async edgeGetById(kind, id, coordinate) {
|
|
16508
16631
|
const results = await edgeGetByIds(kind, [id], coordinate);
|
|
16509
16632
|
return results[0];
|
|
16510
16633
|
},
|
|
16511
|
-
edgeGetByIds
|
|
16634
|
+
edgeGetByIds,
|
|
16635
|
+
edgeScan
|
|
16512
16636
|
};
|
|
16513
16637
|
}
|
|
16514
16638
|
|
|
@@ -16734,12 +16858,19 @@ function overlayPropertyDescriptors(base, overlay) {
|
|
|
16734
16858
|
...Object.getOwnPropertyDescriptors(overlay)
|
|
16735
16859
|
});
|
|
16736
16860
|
}
|
|
16861
|
+
function defineUnavailableSqlGuard(context, guard) {
|
|
16862
|
+
Object.defineProperty(context, "sql", {
|
|
16863
|
+
configurable: false,
|
|
16864
|
+
enumerable: true,
|
|
16865
|
+
get: guard
|
|
16866
|
+
});
|
|
16867
|
+
}
|
|
16737
16868
|
function syncStoreReplacementRef(ref, replacement) {
|
|
16738
16869
|
if (ref === void 0) return;
|
|
16739
16870
|
ref.current = replacement;
|
|
16740
16871
|
}
|
|
16741
16872
|
var StoreImplementation = class _StoreImplementation {
|
|
16742
|
-
[
|
|
16873
|
+
[chunk5ELKD2FQ_cjs.STORE_RUNTIME];
|
|
16743
16874
|
#graph;
|
|
16744
16875
|
/**
|
|
16745
16876
|
* Bare backend for DDL, vector-storage, and bulk-materialization work that must
|
|
@@ -16774,11 +16905,11 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
16774
16905
|
this.#captureEnabled = options?.history === true;
|
|
16775
16906
|
this.#revisionTrackingEnabled = this.#captureEnabled || options?.revisionTracking === true;
|
|
16776
16907
|
if (this.#revisionTrackingEnabled) {
|
|
16777
|
-
|
|
16908
|
+
chunk5ELKD2FQ_cjs.assertRevisionTrackableBackend(backend);
|
|
16778
16909
|
}
|
|
16779
|
-
const explicitSchema = options?.schema === void 0 ? void 0 :
|
|
16780
|
-
const resolvedSchema = explicitSchema ?? (backend.tableNames ?
|
|
16781
|
-
const readSchema = resolvedSchema ??
|
|
16910
|
+
const explicitSchema = options?.schema === void 0 ? void 0 : chunk5ELKD2FQ_cjs.requireSqlSchema(options.schema, "store schema");
|
|
16911
|
+
const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunk5ELKD2FQ_cjs.createSqlSchema(backend.tableNames) : void 0);
|
|
16912
|
+
const readSchema = resolvedSchema ?? chunk5ELKD2FQ_cjs.createSqlSchema(backend.tableNames);
|
|
16782
16913
|
if (this.#captureEnabled && options?.recordedRead !== void 0) {
|
|
16783
16914
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
16784
16915
|
"recordedRead cannot be combined with history: true.",
|
|
@@ -16788,11 +16919,11 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
16788
16919
|
}
|
|
16789
16920
|
);
|
|
16790
16921
|
}
|
|
16791
|
-
const externalRecordedRead =
|
|
16922
|
+
const externalRecordedRead = chunk5ELKD2FQ_cjs.requireExternalRecordedReadSource(
|
|
16792
16923
|
options?.recordedRead
|
|
16793
16924
|
);
|
|
16794
|
-
this.#recordedReadBinding = this.#captureEnabled ?
|
|
16795
|
-
this.#backend = this.#captureEnabled ? asGraphWriteBackend(
|
|
16925
|
+
this.#recordedReadBinding = this.#captureEnabled ? chunk5ELKD2FQ_cjs.createRecordedReadBinding(readSchema) : externalRecordedRead;
|
|
16926
|
+
this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunk5ELKD2FQ_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
|
|
16796
16927
|
this.#schema = resolvedSchema;
|
|
16797
16928
|
const rowMapperConfig = rowMapperConfigFor(this.#backend);
|
|
16798
16929
|
this.#recordedReads = createRecordedReadService({
|
|
@@ -16802,22 +16933,24 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
16802
16933
|
mapRecordedNodeRow: chunkE6TXEISH_cjs.createNodeRowMapper(rowMapperConfig),
|
|
16803
16934
|
mapRecordedEdgeRow: chunkE6TXEISH_cjs.createEdgeRowMapper(rowMapperConfig)
|
|
16804
16935
|
});
|
|
16805
|
-
this.#registry =
|
|
16936
|
+
this.#registry = chunkVXAFOF6Z_cjs.buildKindRegistry(graph);
|
|
16806
16937
|
this.#hooks = options?.hooks ?? {};
|
|
16807
16938
|
this.#defaultTraversalExpansion = options?.queryDefaults?.traversalExpansion ?? "inverse";
|
|
16808
16939
|
this.#options = options;
|
|
16809
16940
|
this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
|
|
16810
|
-
this[
|
|
16941
|
+
this[chunk5ELKD2FQ_cjs.STORE_RUNTIME] = {
|
|
16811
16942
|
backend: this.#backend,
|
|
16812
16943
|
sealedQuery: (coordinate) => this.sealedQuery(coordinate),
|
|
16813
16944
|
recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
|
|
16814
16945
|
recordedNodeGetByIds: (kind, ids, coordinate) => this.recordedNodeGetByIds(kind, ids, coordinate),
|
|
16946
|
+
recordedNodeScan: (kind, coordinate, options2) => this.recordedNodeScan(kind, coordinate, options2),
|
|
16815
16947
|
recordedEdgeGetById: (kind, id, coordinate) => this.recordedEdgeGetById(kind, id, coordinate),
|
|
16816
16948
|
recordedEdgeGetByIds: (kind, ids, coordinate) => this.recordedEdgeGetByIds(kind, ids, coordinate),
|
|
16949
|
+
recordedEdgeScan: (kind, coordinate, options2) => this.recordedEdgeScan(kind, coordinate, options2),
|
|
16817
16950
|
subgraphAtCoordinate: (rootId, subgraphOptions) => this.subgraphAtCoordinate(rootId, subgraphOptions),
|
|
16818
16951
|
algorithmsAtCoordinate: (coordinate) => this.algorithmsAtCoordinate(coordinate)
|
|
16819
16952
|
};
|
|
16820
|
-
Object.defineProperty(this,
|
|
16953
|
+
Object.defineProperty(this, chunk5ELKD2FQ_cjs.STORE_RUNTIME, {
|
|
16821
16954
|
configurable: false,
|
|
16822
16955
|
enumerable: false,
|
|
16823
16956
|
writable: false
|
|
@@ -17117,7 +17250,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17117
17250
|
async #maybeRefreshStatisticsAfterBulk(rowCount) {
|
|
17118
17251
|
const configured = this.#options?.autoRefreshStatistics;
|
|
17119
17252
|
if (configured === false) return;
|
|
17120
|
-
const threshold = configured ??
|
|
17253
|
+
const threshold = configured ?? chunk5ELKD2FQ_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
|
|
17121
17254
|
if (rowCount < threshold) return;
|
|
17122
17255
|
try {
|
|
17123
17256
|
await this.refreshStatistics();
|
|
@@ -17131,13 +17264,13 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17131
17264
|
#buildNodeOperations(ctx) {
|
|
17132
17265
|
return {
|
|
17133
17266
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
17134
|
-
rowToNode: (row) =>
|
|
17267
|
+
rowToNode: (row) => chunkE2Q7SP2K_cjs.rowToNode(row),
|
|
17135
17268
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
17136
|
-
executeCreate: (input, backend) =>
|
|
17137
|
-
executeCreateBatch: (inputs, backend) =>
|
|
17138
|
-
executeCreateNoReturnBatch: (inputs, backend) =>
|
|
17139
|
-
executeUpdate: (input, backend, options) =>
|
|
17140
|
-
executeUpsertUpdate: (input, backend, options) =>
|
|
17269
|
+
executeCreate: (input, backend) => chunkE2Q7SP2K_cjs.executeNodeCreate(ctx, input, backend),
|
|
17270
|
+
executeCreateBatch: (inputs, backend) => chunkE2Q7SP2K_cjs.executeNodeCreateBatch(ctx, inputs, backend),
|
|
17271
|
+
executeCreateNoReturnBatch: (inputs, backend) => chunkE2Q7SP2K_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
|
|
17272
|
+
executeUpdate: (input, backend, options) => chunkE2Q7SP2K_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
|
|
17273
|
+
executeUpsertUpdate: (input, backend, options) => chunkE2Q7SP2K_cjs.executeNodeUpsertUpdate(
|
|
17141
17274
|
ctx,
|
|
17142
17275
|
{ ...input, id: input.id },
|
|
17143
17276
|
backend,
|
|
@@ -17145,13 +17278,13 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17145
17278
|
),
|
|
17146
17279
|
// Present only when opted in; its absence is the coalesce off switch.
|
|
17147
17280
|
...this.#options?.coalesceUnchangedUpserts === true && {
|
|
17148
|
-
upsertDirtyCheck: (kind, id, existingProps, inputProps) =>
|
|
17281
|
+
upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunkE2Q7SP2K_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
|
|
17149
17282
|
},
|
|
17150
|
-
executeDelete: (kind, id, backend) =>
|
|
17151
|
-
executeHardDelete: (kind, id, backend) =>
|
|
17283
|
+
executeDelete: (kind, id, backend) => chunkE2Q7SP2K_cjs.executeNodeDelete(ctx, kind, id, backend),
|
|
17284
|
+
executeHardDelete: (kind, id, backend) => chunkE2Q7SP2K_cjs.executeNodeHardDelete(ctx, kind, id, backend),
|
|
17152
17285
|
temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
|
|
17153
17286
|
createQuery: () => this.query(),
|
|
17154
|
-
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) =>
|
|
17287
|
+
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkE2Q7SP2K_cjs.executeNodeGetOrCreateByConstraint(
|
|
17155
17288
|
ctx,
|
|
17156
17289
|
kind,
|
|
17157
17290
|
constraintName,
|
|
@@ -17159,7 +17292,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17159
17292
|
backend,
|
|
17160
17293
|
options
|
|
17161
17294
|
),
|
|
17162
|
-
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) =>
|
|
17295
|
+
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkE2Q7SP2K_cjs.executeNodeBulkGetOrCreateByConstraint(
|
|
17163
17296
|
ctx,
|
|
17164
17297
|
kind,
|
|
17165
17298
|
constraintName,
|
|
@@ -17167,15 +17300,15 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17167
17300
|
backend,
|
|
17168
17301
|
options
|
|
17169
17302
|
),
|
|
17170
|
-
executeFindByConstraint: (kind, constraintName, props, backend) =>
|
|
17171
|
-
executeBulkFindByConstraint: (kind, constraintName, items, backend) =>
|
|
17303
|
+
executeFindByConstraint: (kind, constraintName, props, backend) => chunkE2Q7SP2K_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
|
|
17304
|
+
executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunkE2Q7SP2K_cjs.executeNodeBulkFindByConstraint(
|
|
17172
17305
|
ctx,
|
|
17173
17306
|
kind,
|
|
17174
17307
|
constraintName,
|
|
17175
17308
|
items,
|
|
17176
17309
|
backend
|
|
17177
17310
|
),
|
|
17178
|
-
executeBulkFindByIndex: (kind, indexName, items, backend, options) =>
|
|
17311
|
+
executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkE2Q7SP2K_cjs.executeNodeBulkFindByIndex(
|
|
17179
17312
|
ctx,
|
|
17180
17313
|
kind,
|
|
17181
17314
|
indexName,
|
|
@@ -17194,7 +17327,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17194
17327
|
#buildEdgeOperations(ctx) {
|
|
17195
17328
|
return {
|
|
17196
17329
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
17197
|
-
rowToEdge: (row) =>
|
|
17330
|
+
rowToEdge: (row) => chunkE2Q7SP2K_cjs.rowToEdge(row),
|
|
17198
17331
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
17199
17332
|
executeCreate: (input, backend) => executeEdgeCreate(ctx, input, backend),
|
|
17200
17333
|
executeCreateBatch: (inputs, backend) => executeEdgeCreateBatch(ctx, inputs, backend),
|
|
@@ -17268,7 +17401,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17268
17401
|
);
|
|
17269
17402
|
}
|
|
17270
17403
|
#sqlSchema() {
|
|
17271
|
-
return this.#schema ??
|
|
17404
|
+
return this.#schema ?? chunk5ELKD2FQ_cjs.createSqlSchema(this.#backend.tableNames);
|
|
17272
17405
|
}
|
|
17273
17406
|
/**
|
|
17274
17407
|
* Internal seam for {@link RecordedStoreView}: reconstruct a node point read
|
|
@@ -17289,6 +17422,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17289
17422
|
async recordedNodeGetByIds(kind, ids, coordinate) {
|
|
17290
17423
|
return this.#recordedReads.nodeGetByIds(kind, ids, coordinate);
|
|
17291
17424
|
}
|
|
17425
|
+
/** @internal Bounded recorded-time node enumeration for RecordedStoreView. */
|
|
17426
|
+
async recordedNodeScan(kind, coordinate, options) {
|
|
17427
|
+
return this.#recordedReads.nodeScan(kind, coordinate, options);
|
|
17428
|
+
}
|
|
17292
17429
|
/**
|
|
17293
17430
|
* Internal seam for {@link RecordedStoreView}: reconstruct an edge point read
|
|
17294
17431
|
* from the recorded-time relation while preserving live getById behavior.
|
|
@@ -17307,6 +17444,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17307
17444
|
async recordedEdgeGetByIds(kind, ids, coordinate) {
|
|
17308
17445
|
return this.#recordedReads.edgeGetByIds(kind, ids, coordinate);
|
|
17309
17446
|
}
|
|
17447
|
+
/** @internal Bounded recorded-time edge enumeration for RecordedStoreView. */
|
|
17448
|
+
async recordedEdgeScan(kind, coordinate, options) {
|
|
17449
|
+
return this.#recordedReads.edgeScan(kind, coordinate, options);
|
|
17450
|
+
}
|
|
17310
17451
|
// === Temporal Views ===
|
|
17311
17452
|
/**
|
|
17312
17453
|
* Returns a read-only {@link StoreView} pinned to a valid-time instant.
|
|
@@ -17393,8 +17534,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17393
17534
|
}
|
|
17394
17535
|
);
|
|
17395
17536
|
}
|
|
17396
|
-
const recordedAt = await
|
|
17397
|
-
|
|
17537
|
+
const recordedAt = await chunkHP6LWBLB_cjs.withRecordedRelationsPrecondition(
|
|
17538
|
+
chunk5ELKD2FQ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
|
|
17398
17539
|
{ dialect: this.#backend.dialect, surface: "recorded-now" }
|
|
17399
17540
|
);
|
|
17400
17541
|
return recordedAt === void 0 ? void 0 : chunkSVUKGWSN_cjs.asRecordedInstant(recordedAt);
|
|
@@ -17409,7 +17550,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17409
17550
|
*/
|
|
17410
17551
|
async revisionNow() {
|
|
17411
17552
|
if (!this.#revisionTrackingEnabled) return void 0;
|
|
17412
|
-
return
|
|
17553
|
+
return chunk5ELKD2FQ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
|
|
17413
17554
|
}
|
|
17414
17555
|
/**
|
|
17415
17556
|
* Returns the durable random namespace for this graph's revision clock. A
|
|
@@ -17426,7 +17567,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17426
17567
|
{ code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
|
|
17427
17568
|
);
|
|
17428
17569
|
}
|
|
17429
|
-
const pendingOrigin = this.#revisionOrigin ??
|
|
17570
|
+
const pendingOrigin = this.#revisionOrigin ?? chunk5ELKD2FQ_cjs.ensureRevisionOrigin(this.#baseBackend, this.#sqlSchema(), this.graphId);
|
|
17430
17571
|
this.#revisionOrigin = pendingOrigin;
|
|
17431
17572
|
try {
|
|
17432
17573
|
return await pendingOrigin;
|
|
@@ -17680,7 +17821,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17680
17821
|
// No real transaction: `tx.sql` is absent and there is no atomicity.
|
|
17681
17822
|
sqlAvailability: "unavailable",
|
|
17682
17823
|
backend: chunkGNPGGLAE_cjs.createTransactionReadBackend(this.#backend),
|
|
17683
|
-
[
|
|
17824
|
+
[chunk5ELKD2FQ_cjs.TRANSACTION_RUNTIME]: {
|
|
17684
17825
|
backend: this.#backend,
|
|
17685
17826
|
runNodeOperationHooks: (operation, kind, id, hookedFunction) => this.#withOperationHooks(
|
|
17686
17827
|
this.#createOperationContext(operation, "node", kind, id),
|
|
@@ -17689,7 +17830,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17689
17830
|
},
|
|
17690
17831
|
getNodeCollection: (kind) => this.#resolveDynamicNodeCollection(nodes, kind)
|
|
17691
17832
|
};
|
|
17692
|
-
Object.defineProperty(fallbackContext,
|
|
17833
|
+
Object.defineProperty(fallbackContext, chunk5ELKD2FQ_cjs.TRANSACTION_RUNTIME, {
|
|
17693
17834
|
configurable: false,
|
|
17694
17835
|
enumerable: false,
|
|
17695
17836
|
writable: false
|
|
@@ -17702,7 +17843,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17702
17843
|
const pending = [];
|
|
17703
17844
|
const runHooks = this.#createBufferedHookRunner(pending);
|
|
17704
17845
|
let recordedByGraph;
|
|
17705
|
-
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ?
|
|
17846
|
+
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunk5ELKD2FQ_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
|
|
17706
17847
|
recordedByGraph = instants;
|
|
17707
17848
|
}) : backendOptions;
|
|
17708
17849
|
try {
|
|
@@ -17811,7 +17952,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17811
17952
|
*/
|
|
17812
17953
|
withTransaction(externalTx) {
|
|
17813
17954
|
if (this.#captureEnabled) {
|
|
17814
|
-
throw
|
|
17955
|
+
throw chunk5ELKD2FQ_cjs.recordedCaptureRequiresCallbackTransactionError();
|
|
17815
17956
|
}
|
|
17816
17957
|
const adopt = this.#adapterBackend?.adoptTransaction;
|
|
17817
17958
|
if (adopt === void 0) {
|
|
@@ -17835,14 +17976,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17835
17976
|
}
|
|
17836
17977
|
const txBackend = adopt(externalTx);
|
|
17837
17978
|
if (this.#captureEnabled) {
|
|
17838
|
-
await
|
|
17979
|
+
await chunk5ELKD2FQ_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
|
|
17839
17980
|
}
|
|
17840
|
-
const scope = this.#captureEnabled ?
|
|
17981
|
+
const scope = this.#captureEnabled ? chunk5ELKD2FQ_cjs.createRecordedTransactionScope(txBackend, this.#sqlSchema()) : {
|
|
17841
17982
|
backend: txBackend,
|
|
17842
17983
|
flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
|
|
17843
17984
|
};
|
|
17844
17985
|
if (this.#captureEnabled) {
|
|
17845
|
-
await
|
|
17986
|
+
await chunk5ELKD2FQ_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
|
|
17846
17987
|
}
|
|
17847
17988
|
const receiptRecorder = createTransactionReceiptRecorder();
|
|
17848
17989
|
const invoke = fn;
|
|
@@ -17945,32 +18086,31 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17945
18086
|
nodes,
|
|
17946
18087
|
edges,
|
|
17947
18088
|
backend: chunkGNPGGLAE_cjs.createTransactionReadBackend(txBackend),
|
|
17948
|
-
[
|
|
18089
|
+
[chunk5ELKD2FQ_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
|
|
17949
18090
|
getNodeCollection
|
|
17950
18091
|
};
|
|
17951
18092
|
let withSql;
|
|
17952
18093
|
if (this.#captureEnabled) {
|
|
17953
18094
|
withSql = {
|
|
17954
18095
|
...base,
|
|
17955
|
-
sqlAvailability: "history"
|
|
17956
|
-
get sql() {
|
|
17957
|
-
return chunkNWYCOFEZ_cjs.throwHistoryUnsafeSqlAccess();
|
|
17958
|
-
}
|
|
18096
|
+
sqlAvailability: "history"
|
|
17959
18097
|
};
|
|
18098
|
+
defineUnavailableSqlGuard(withSql, () => chunk5ELKD2FQ_cjs.throwHistoryUnsafeSqlAccess());
|
|
17960
18099
|
} else if (this.#revisionTrackingEnabled) {
|
|
17961
18100
|
withSql = {
|
|
17962
18101
|
...base,
|
|
17963
|
-
sqlAvailability: "revisionTracking"
|
|
17964
|
-
get sql() {
|
|
17965
|
-
return chunkNWYCOFEZ_cjs.throwRevisionTrackingUnsafeSqlAccess();
|
|
17966
|
-
}
|
|
18102
|
+
sqlAvailability: "revisionTracking"
|
|
17967
18103
|
};
|
|
18104
|
+
defineUnavailableSqlGuard(
|
|
18105
|
+
withSql,
|
|
18106
|
+
() => chunk5ELKD2FQ_cjs.throwRevisionTrackingUnsafeSqlAccess()
|
|
18107
|
+
);
|
|
17968
18108
|
} else if (sql2 === void 0) {
|
|
17969
18109
|
withSql = { ...base, sqlAvailability: "unavailable" };
|
|
17970
18110
|
} else {
|
|
17971
18111
|
withSql = { ...base, sql: sql2, sqlAvailability: "available" };
|
|
17972
18112
|
}
|
|
17973
|
-
Object.defineProperty(withSql,
|
|
18113
|
+
Object.defineProperty(withSql, chunk5ELKD2FQ_cjs.TRANSACTION_RUNTIME, {
|
|
17974
18114
|
configurable: false,
|
|
17975
18115
|
enumerable: false,
|
|
17976
18116
|
writable: false
|
|
@@ -17990,12 +18130,12 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17990
18130
|
async clear() {
|
|
17991
18131
|
const doClear = async (target) => {
|
|
17992
18132
|
if (this.#revisionTrackingEnabled) {
|
|
17993
|
-
await
|
|
18133
|
+
await chunk5ELKD2FQ_cjs.lockRecordedGraphWrite(target, this.graphId);
|
|
17994
18134
|
}
|
|
17995
|
-
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await
|
|
18135
|
+
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunk5ELKD2FQ_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
|
|
17996
18136
|
await target.clearGraph(this.graphId);
|
|
17997
18137
|
if (this.#revisionTrackingEnabled && !this.#captureEnabled) {
|
|
17998
|
-
await
|
|
18138
|
+
await chunk5ELKD2FQ_cjs.advanceRevisionClock(
|
|
17999
18139
|
target,
|
|
18000
18140
|
this.#sqlSchema(),
|
|
18001
18141
|
this.graphId,
|
|
@@ -18123,7 +18263,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18123
18263
|
*/
|
|
18124
18264
|
async evolve(extension, options) {
|
|
18125
18265
|
const { activeRow, baseline } = await this.#loadCaughtUp("evolve");
|
|
18126
|
-
const merged =
|
|
18266
|
+
const merged = chunkVXAFOF6Z_cjs.mergeGraphExtension(baseline, extension);
|
|
18127
18267
|
if (merged === baseline) {
|
|
18128
18268
|
if (baseline === this.#graph) {
|
|
18129
18269
|
syncStoreReplacementRef(options?.ref, this);
|
|
@@ -18159,7 +18299,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18159
18299
|
);
|
|
18160
18300
|
if (error !== void 0) throw error;
|
|
18161
18301
|
}
|
|
18162
|
-
const committed = await
|
|
18302
|
+
const committed = await chunkVXAFOF6Z_cjs.commitNewSchemaVersion(
|
|
18163
18303
|
this.#backend,
|
|
18164
18304
|
merged,
|
|
18165
18305
|
activeRow.version
|
|
@@ -18483,9 +18623,9 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18483
18623
|
);
|
|
18484
18624
|
}
|
|
18485
18625
|
const compileTimeGraph = stripGraphExtension(this.#graph);
|
|
18486
|
-
const merged = plan.document === void 0 ? compileTimeGraph :
|
|
18487
|
-
const finalGraph =
|
|
18488
|
-
const committedRow = await
|
|
18626
|
+
const merged = plan.document === void 0 ? compileTimeGraph : chunkVXAFOF6Z_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
|
|
18627
|
+
const finalGraph = chunkVXAFOF6Z_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
|
|
18628
|
+
const committedRow = await chunkVXAFOF6Z_cjs.commitNewSchemaVersion(
|
|
18489
18629
|
this.#backend,
|
|
18490
18630
|
finalGraph,
|
|
18491
18631
|
activeRow.version
|
|
@@ -18573,8 +18713,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18573
18713
|
schemaMetadataFromRow(activeRow)
|
|
18574
18714
|
);
|
|
18575
18715
|
}
|
|
18576
|
-
const merged =
|
|
18577
|
-
const result = await
|
|
18716
|
+
const merged = chunkVXAFOF6Z_cjs.applyDeprecatedKinds(baseline, nextSet);
|
|
18717
|
+
const result = await chunkVXAFOF6Z_cjs.ensureSchema(this.#backend, merged, {
|
|
18578
18718
|
preloaded: { activeRow, storedSchema },
|
|
18579
18719
|
autoMigrate: true
|
|
18580
18720
|
});
|
|
@@ -18583,8 +18723,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18583
18723
|
}
|
|
18584
18724
|
#catchUpToStored(storedSchema) {
|
|
18585
18725
|
const compileTimeGraph = stripGraphExtension(this.#graph);
|
|
18586
|
-
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph :
|
|
18587
|
-
return
|
|
18726
|
+
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkVXAFOF6Z_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
|
|
18727
|
+
return chunkVXAFOF6Z_cjs.applyDeprecatedKinds(
|
|
18588
18728
|
withGraphExtension,
|
|
18589
18729
|
storedSchema.deprecatedKinds
|
|
18590
18730
|
);
|
|
@@ -18602,7 +18742,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18602
18742
|
* serializes the actual commit.
|
|
18603
18743
|
*/
|
|
18604
18744
|
async #loadCaughtUp(verb) {
|
|
18605
|
-
const activeRow = await
|
|
18745
|
+
const activeRow = await chunkVXAFOF6Z_cjs.loadActiveSchemaWithBootstrap(
|
|
18606
18746
|
this.#backend,
|
|
18607
18747
|
this.graphId
|
|
18608
18748
|
);
|
|
@@ -18613,7 +18753,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18613
18753
|
{ code }
|
|
18614
18754
|
);
|
|
18615
18755
|
}
|
|
18616
|
-
const storedSchema =
|
|
18756
|
+
const storedSchema = chunkVXAFOF6Z_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
18617
18757
|
const baseline = this.#catchUpToStored(storedSchema);
|
|
18618
18758
|
return { activeRow, storedSchema, baseline };
|
|
18619
18759
|
}
|
|
@@ -18712,7 +18852,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18712
18852
|
// === Internal: Hook Helpers ===
|
|
18713
18853
|
#createHookContext() {
|
|
18714
18854
|
return {
|
|
18715
|
-
operationId:
|
|
18855
|
+
operationId: chunk5ELKD2FQ_cjs.generateId(),
|
|
18716
18856
|
graphId: this.graphId,
|
|
18717
18857
|
startedAt: /* @__PURE__ */ new Date()
|
|
18718
18858
|
};
|
|
@@ -18813,8 +18953,8 @@ var AdapterStoreImplementation = class extends StoreImplementation {
|
|
|
18813
18953
|
backend;
|
|
18814
18954
|
constructor(graph, backend, options, schemaMetadata) {
|
|
18815
18955
|
super(graph, backend, options, schemaMetadata, backend);
|
|
18816
|
-
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[
|
|
18817
|
-
|
|
18956
|
+
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[chunk5ELKD2FQ_cjs.STORE_RUNTIME].backend) : Object.freeze(
|
|
18957
|
+
chunk5ELKD2FQ_cjs.createGraphBackendProjection(this[chunk5ELKD2FQ_cjs.STORE_RUNTIME].backend)
|
|
18818
18958
|
);
|
|
18819
18959
|
}
|
|
18820
18960
|
async evolve(extension, options) {
|
|
@@ -18963,8 +19103,8 @@ async function prepareStoreWithSchema(graph, backend, options) {
|
|
|
18963
19103
|
graph: merged,
|
|
18964
19104
|
activeRow,
|
|
18965
19105
|
storedSchema
|
|
18966
|
-
} = await
|
|
18967
|
-
const result = await
|
|
19106
|
+
} = await chunkVXAFOF6Z_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
|
|
19107
|
+
const result = await chunkVXAFOF6Z_cjs.ensureSchema(backend, merged, {
|
|
18968
19108
|
...options,
|
|
18969
19109
|
preloaded: { activeRow, storedSchema }
|
|
18970
19110
|
});
|
|
@@ -19034,7 +19174,7 @@ async function prepareVerifiedStore(graph, backend) {
|
|
|
19034
19174
|
graph: merged,
|
|
19035
19175
|
activeRow,
|
|
19036
19176
|
result
|
|
19037
|
-
} = await
|
|
19177
|
+
} = await chunkVXAFOF6Z_cjs.loadAndVerifyGraph(backend, graph);
|
|
19038
19178
|
return {
|
|
19039
19179
|
graph: merged,
|
|
19040
19180
|
result,
|
|
@@ -19094,5 +19234,5 @@ exports.min = min;
|
|
|
19094
19234
|
exports.offsetFragment = offsetFragment;
|
|
19095
19235
|
exports.orderByFragment = orderByFragment;
|
|
19096
19236
|
exports.sum = sum;
|
|
19097
|
-
//# sourceMappingURL=chunk-
|
|
19098
|
-
//# sourceMappingURL=chunk-
|
|
19237
|
+
//# sourceMappingURL=chunk-6SRLCSAV.cjs.map
|
|
19238
|
+
//# sourceMappingURL=chunk-6SRLCSAV.cjs.map
|