@nicia-ai/typegraph 0.55.0 → 0.56.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/CHANGELOG.md +14 -0
- package/dist/backend/index.cjs +86 -86
- package/dist/backend/index.js +7 -7
- package/dist/backend/postgres/index.cjs +22 -22
- package/dist/backend/postgres/index.js +8 -8
- package/dist/backend/postgres/pglite-store.cjs +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +2 -2
- package/dist/backend/postgres/pglite-store.d.ts +2 -2
- package/dist/backend/postgres/pglite-store.js +1 -1
- package/dist/backend/postgres/pglite.cjs +10 -10
- package/dist/backend/postgres/pglite.js +9 -9
- package/dist/backend/sqlite/index.cjs +21 -21
- package/dist/backend/sqlite/index.js +8 -8
- package/dist/backend/sqlite/libsql.cjs +12 -12
- package/dist/backend/sqlite/libsql.js +8 -8
- package/dist/backend/sqlite/local-store.cjs +1 -1
- package/dist/backend/sqlite/local-store.d.cts +2 -2
- package/dist/backend/sqlite/local-store.d.ts +2 -2
- package/dist/backend/sqlite/local-store.js +1 -1
- package/dist/backend/sqlite/local.cjs +10 -10
- package/dist/backend/sqlite/local.js +9 -9
- package/dist/{chunk-S5WG5AFG.cjs → chunk-2XUAUSMI.cjs} +12 -12
- package/dist/{chunk-S5WG5AFG.cjs.map → chunk-2XUAUSMI.cjs.map} +1 -1
- package/dist/{chunk-MTE255N3.cjs → chunk-36XLQHZA.cjs} +4 -4
- package/dist/{chunk-MTE255N3.cjs.map → chunk-36XLQHZA.cjs.map} +1 -1
- package/dist/{chunk-FWSGKOBN.js → chunk-6LTRZOUU.js} +6 -6
- package/dist/{chunk-FWSGKOBN.js.map → chunk-6LTRZOUU.js.map} +1 -1
- package/dist/{chunk-YVKPUSHS.js → chunk-75KH6Y2W.js} +16 -7
- package/dist/chunk-75KH6Y2W.js.map +1 -0
- package/dist/{chunk-MJXEO7YA.js → chunk-762VPGHN.js} +5 -5
- package/dist/{chunk-MJXEO7YA.js.map → chunk-762VPGHN.js.map} +1 -1
- package/dist/{chunk-GGDTMBNA.cjs → chunk-7CCVR2QF.cjs} +54 -54
- package/dist/{chunk-GGDTMBNA.cjs.map → chunk-7CCVR2QF.cjs.map} +1 -1
- package/dist/{chunk-7EOJO6QB.js → chunk-7MHENVRG.js} +3 -3
- package/dist/{chunk-7EOJO6QB.js.map → chunk-7MHENVRG.js.map} +1 -1
- package/dist/{chunk-7B3DSFX3.cjs → chunk-AUTRK6WM.cjs} +4 -4
- package/dist/{chunk-7B3DSFX3.cjs.map → chunk-AUTRK6WM.cjs.map} +1 -1
- package/dist/{chunk-SIQ4BFL5.js → chunk-AZP5CCHL.js} +4 -4
- package/dist/{chunk-SIQ4BFL5.js.map → chunk-AZP5CCHL.js.map} +1 -1
- package/dist/{chunk-WTW7RWAG.cjs → chunk-BYUIOM4L.cjs} +6 -6
- package/dist/{chunk-WTW7RWAG.cjs.map → chunk-BYUIOM4L.cjs.map} +1 -1
- package/dist/{chunk-74FNI3PT.js → chunk-C3TJU4KQ.js} +6 -6
- package/dist/chunk-C3TJU4KQ.js.map +1 -0
- package/dist/{chunk-7V2R4MH6.js → chunk-CEQOTZGB.js} +5 -5
- package/dist/{chunk-7V2R4MH6.js.map → chunk-CEQOTZGB.js.map} +1 -1
- package/dist/{chunk-TKFQLKH2.cjs → chunk-CYKHSH5O.cjs} +36 -36
- package/dist/{chunk-TKFQLKH2.cjs.map → chunk-CYKHSH5O.cjs.map} +1 -1
- package/dist/{chunk-D5TCKAQT.cjs → chunk-DGIA64DM.cjs} +4 -4
- package/dist/{chunk-D5TCKAQT.cjs.map → chunk-DGIA64DM.cjs.map} +1 -1
- package/dist/{chunk-FFR3YUY2.js → chunk-E4QYEWVH.js} +5 -5
- package/dist/{chunk-FFR3YUY2.js.map → chunk-E4QYEWVH.js.map} +1 -1
- package/dist/{chunk-467YITD4.cjs → chunk-ETU5IILQ.cjs} +13 -13
- package/dist/{chunk-467YITD4.cjs.map → chunk-ETU5IILQ.cjs.map} +1 -1
- package/dist/{chunk-HW3IX2RF.js → chunk-EWRLWI7W.js} +4 -4
- package/dist/{chunk-HW3IX2RF.js.map → chunk-EWRLWI7W.js.map} +1 -1
- package/dist/{chunk-KZ6OHFDV.js → chunk-F2S5JWCT.js} +3 -3
- package/dist/{chunk-KZ6OHFDV.js.map → chunk-F2S5JWCT.js.map} +1 -1
- package/dist/{chunk-45WPPI64.js → chunk-FMCPKMQI.js} +3 -3
- package/dist/{chunk-45WPPI64.js.map → chunk-FMCPKMQI.js.map} +1 -1
- package/dist/{chunk-QM6IQW7B.js → chunk-ILHVYKXJ.js} +7 -7
- package/dist/{chunk-QM6IQW7B.js.map → chunk-ILHVYKXJ.js.map} +1 -1
- package/dist/{chunk-ECYEWFEH.cjs → chunk-J34FSPSC.cjs} +16 -6
- package/dist/chunk-J34FSPSC.cjs.map +1 -0
- package/dist/{chunk-GFYCLCGU.cjs → chunk-KM3CLHDB.cjs} +9 -9
- package/dist/{chunk-GFYCLCGU.cjs.map → chunk-KM3CLHDB.cjs.map} +1 -1
- package/dist/{chunk-SLNH62T3.js → chunk-KQYUKOGX.js} +3 -3
- package/dist/{chunk-SLNH62T3.js.map → chunk-KQYUKOGX.js.map} +1 -1
- package/dist/{chunk-7I2PYI4U.cjs → chunk-KR3N6Y7O.cjs} +67 -67
- package/dist/{chunk-7I2PYI4U.cjs.map → chunk-KR3N6Y7O.cjs.map} +1 -1
- package/dist/{chunk-HZCOCNIX.cjs → chunk-L2REUAJB.cjs} +24 -24
- package/dist/{chunk-HZCOCNIX.cjs.map → chunk-L2REUAJB.cjs.map} +1 -1
- package/dist/{chunk-VU65FXEG.js → chunk-LFXBFPI2.js} +66 -29
- package/dist/chunk-LFXBFPI2.js.map +1 -0
- package/dist/{chunk-NXRSR6QG.js → chunk-MHM6OGZR.js} +9 -9
- package/dist/{chunk-NXRSR6QG.js.map → chunk-MHM6OGZR.js.map} +1 -1
- package/dist/{chunk-FCUSVSYX.js → chunk-MRGWM5LE.js} +10 -10
- package/dist/{chunk-FCUSVSYX.js.map → chunk-MRGWM5LE.js.map} +1 -1
- package/dist/{chunk-WXGMDROJ.js → chunk-QDNEXTON.js} +7 -7
- package/dist/{chunk-WXGMDROJ.js.map → chunk-QDNEXTON.js.map} +1 -1
- package/dist/{chunk-VYU5H4FO.js → chunk-RXA2D3UR.js} +3 -3
- package/dist/{chunk-VYU5H4FO.js.map → chunk-RXA2D3UR.js.map} +1 -1
- package/dist/{chunk-XODNY4QI.js → chunk-TIBSLFHR.js} +6 -6
- package/dist/{chunk-XODNY4QI.js.map → chunk-TIBSLFHR.js.map} +1 -1
- package/dist/{chunk-KZG7HQSN.cjs → chunk-UVMSWO6X.cjs} +173 -173
- package/dist/{chunk-KZG7HQSN.cjs.map → chunk-UVMSWO6X.cjs.map} +1 -1
- package/dist/{chunk-ORPT5EQW.cjs → chunk-UZ6CJUC5.cjs} +27 -27
- package/dist/chunk-UZ6CJUC5.cjs.map +1 -0
- package/dist/{chunk-GNF3PHEQ.cjs → chunk-VF2IMMZT.cjs} +17 -17
- package/dist/{chunk-GNF3PHEQ.cjs.map → chunk-VF2IMMZT.cjs.map} +1 -1
- package/dist/{chunk-PGZV3E3I.cjs → chunk-VXEHEPC4.cjs} +4 -4
- package/dist/{chunk-PGZV3E3I.cjs.map → chunk-VXEHEPC4.cjs.map} +1 -1
- package/dist/{chunk-OJ47LMOB.cjs → chunk-WIUHN6SZ.cjs} +669 -628
- package/dist/chunk-WIUHN6SZ.cjs.map +1 -0
- package/dist/{chunk-HNW5IDB3.js → chunk-WIZB5U6N.js} +7 -7
- package/dist/{chunk-HNW5IDB3.js.map → chunk-WIZB5U6N.js.map} +1 -1
- package/dist/{chunk-IDQZI6GL.js → chunk-XH75W3O5.js} +3 -3
- package/dist/{chunk-IDQZI6GL.js.map → chunk-XH75W3O5.js.map} +1 -1
- package/dist/{chunk-T7LSSV7J.cjs → chunk-XXEFDJHY.cjs} +45 -45
- package/dist/{chunk-T7LSSV7J.cjs.map → chunk-XXEFDJHY.cjs.map} +1 -1
- package/dist/{chunk-GORCU2GR.cjs → chunk-Z4NU4MYB.cjs} +123 -123
- package/dist/{chunk-GORCU2GR.cjs.map → chunk-Z4NU4MYB.cjs.map} +1 -1
- package/dist/{chunk-KFC3OUV4.cjs → chunk-ZHK3HEZ2.cjs} +130 -130
- package/dist/{chunk-KFC3OUV4.cjs.map → chunk-ZHK3HEZ2.cjs.map} +1 -1
- package/dist/{chunk-FYMYLZGX.cjs → chunk-ZXXGMQC3.cjs} +10 -10
- package/dist/{chunk-FYMYLZGX.cjs.map → chunk-ZXXGMQC3.cjs.map} +1 -1
- package/dist/graph-merge/index.cjs +577 -99
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +108 -4
- package/dist/graph-merge/index.d.ts +108 -4
- package/dist/graph-merge/index.js +495 -21
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{graph-templates-qraW63Ry.d.ts → graph-templates-BSA9VU_O.d.ts} +1 -1
- package/dist/{graph-templates--hp2U4kn.d.cts → graph-templates-Cg7DpEOF.d.cts} +1 -1
- package/dist/index.cjs +95 -95
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -16
- package/dist/interchange/index.cjs +33 -33
- package/dist/interchange/index.d.cts +1 -1
- package/dist/interchange/index.d.ts +1 -1
- package/dist/interchange/index.js +10 -10
- package/dist/{local-store-impl-HXBO3VF4.js → local-store-impl-77DCLAAY.js} +18 -18
- package/dist/{local-store-impl-HXBO3VF4.js.map → local-store-impl-77DCLAAY.js.map} +1 -1
- package/dist/{local-store-impl-CUQKHHOZ.cjs → local-store-impl-NJCWM3KR.cjs} +22 -22
- package/dist/{local-store-impl-CUQKHHOZ.cjs.map → local-store-impl-NJCWM3KR.cjs.map} +1 -1
- package/dist/{pglite-store-impl-BD3AVOUH.js → pglite-store-impl-3VFSYLAJ.js} +18 -18
- package/dist/{pglite-store-impl-BD3AVOUH.js.map → pglite-store-impl-3VFSYLAJ.js.map} +1 -1
- package/dist/{pglite-store-impl-C3MQ72LT.cjs → pglite-store-impl-LHLJ3GBQ.cjs} +22 -22
- package/dist/{pglite-store-impl-C3MQ72LT.cjs.map → pglite-store-impl-LHLJ3GBQ.cjs.map} +1 -1
- package/dist/profiler/index.d.cts +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/provenance/index.cjs +21 -21
- package/dist/provenance/index.d.cts +1 -1
- package/dist/provenance/index.d.ts +1 -1
- package/dist/provenance/index.js +5 -5
- package/dist/schema/index.cjs +36 -36
- package/dist/schema/index.d.cts +3 -3
- package/dist/schema/index.d.ts +3 -3
- package/dist/schema/index.js +6 -6
- package/dist/{store-stw2AEB4.d.ts → store-CQ3uzXla.d.ts} +58 -27
- package/dist/{store-DTEkUQ0k.d.cts → store-DbHAgVMH.d.cts} +58 -27
- package/package.json +1 -1
- package/dist/chunk-74FNI3PT.js.map +0 -1
- package/dist/chunk-ECYEWFEH.cjs.map +0 -1
- package/dist/chunk-OJ47LMOB.cjs.map +0 -1
- package/dist/chunk-ORPT5EQW.cjs.map +0 -1
- package/dist/chunk-VU65FXEG.js.map +0 -1
- package/dist/chunk-YVKPUSHS.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
3
|
+
var chunkBYUIOM4L_cjs = require('./chunk-BYUIOM4L.cjs');
|
|
4
|
+
var chunkUVMSWO6X_cjs = require('./chunk-UVMSWO6X.cjs');
|
|
5
|
+
var chunkUZ6CJUC5_cjs = require('./chunk-UZ6CJUC5.cjs');
|
|
6
|
+
var chunkVXEHEPC4_cjs = require('./chunk-VXEHEPC4.cjs');
|
|
7
|
+
var chunk36XLQHZA_cjs = require('./chunk-36XLQHZA.cjs');
|
|
8
|
+
var chunkDGIA64DM_cjs = require('./chunk-DGIA64DM.cjs');
|
|
9
|
+
var chunkL2REUAJB_cjs = require('./chunk-L2REUAJB.cjs');
|
|
10
10
|
var chunk6YKISECL_cjs = require('./chunk-6YKISECL.cjs');
|
|
11
11
|
var chunkOGZA7IS4_cjs = require('./chunk-OGZA7IS4.cjs');
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var chunkXXEFDJHY_cjs = require('./chunk-XXEFDJHY.cjs');
|
|
13
|
+
var chunkCYKHSH5O_cjs = require('./chunk-CYKHSH5O.cjs');
|
|
14
14
|
var chunk5X46XWNH_cjs = require('./chunk-5X46XWNH.cjs');
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var chunkZXXGMQC3_cjs = require('./chunk-ZXXGMQC3.cjs');
|
|
16
|
+
var chunkJ34FSPSC_cjs = require('./chunk-J34FSPSC.cjs');
|
|
17
17
|
var chunkV32ES2Q2_cjs = require('./chunk-V32ES2Q2.cjs');
|
|
18
18
|
var chunkOJHFXL7Y_cjs = require('./chunk-OJHFXL7Y.cjs');
|
|
19
19
|
var chunkF2HGOZJR_cjs = require('./chunk-F2HGOZJR.cjs');
|
|
@@ -37,6 +37,12 @@ var chunkOZ3ZU7Q2_cjs = require('./chunk-OZ3ZU7Q2.cjs');
|
|
|
37
37
|
var chunkBXHAPCQG_cjs = require('./chunk-BXHAPCQG.cjs');
|
|
38
38
|
|
|
39
39
|
// src/store/collection-surface.ts
|
|
40
|
+
var NODE_TEMPORAL_READ_NAMES = [
|
|
41
|
+
"getById",
|
|
42
|
+
"getByIds",
|
|
43
|
+
"find",
|
|
44
|
+
"count"
|
|
45
|
+
];
|
|
40
46
|
var CURRENT_ONLY_READ_NAMES = [
|
|
41
47
|
"findByConstraint",
|
|
42
48
|
"bulkFindByConstraint",
|
|
@@ -60,6 +66,17 @@ var NODE_WRITE_NAMES = [
|
|
|
60
66
|
"getOrCreateByConstraint",
|
|
61
67
|
"bulkGetOrCreateByConstraint"
|
|
62
68
|
];
|
|
69
|
+
var EDGE_TEMPORAL_READ_NAMES = [
|
|
70
|
+
"getById",
|
|
71
|
+
"getByIds",
|
|
72
|
+
"find",
|
|
73
|
+
"count",
|
|
74
|
+
"findFrom",
|
|
75
|
+
"findTo",
|
|
76
|
+
"bulkFindFrom",
|
|
77
|
+
"bulkFindTo",
|
|
78
|
+
"findByEndpoints"
|
|
79
|
+
];
|
|
63
80
|
var EDGE_BATCH_READ_NAMES = [
|
|
64
81
|
"batchFindFrom",
|
|
65
82
|
"batchFindTo",
|
|
@@ -77,6 +94,14 @@ var EDGE_WRITE_NAMES = [
|
|
|
77
94
|
"getOrCreateByEndpoints",
|
|
78
95
|
"bulkGetOrCreateByEndpoints"
|
|
79
96
|
];
|
|
97
|
+
var IDENTITY_READ_NAMES = [
|
|
98
|
+
"representativeOf",
|
|
99
|
+
"membersOf",
|
|
100
|
+
"nodesOf",
|
|
101
|
+
"areSame",
|
|
102
|
+
"areDifferent",
|
|
103
|
+
"assertionsOf"
|
|
104
|
+
];
|
|
80
105
|
|
|
81
106
|
// src/store/recorded-coordinate-guard.ts
|
|
82
107
|
function hasOwnRecordedAsOf(options) {
|
|
@@ -326,17 +351,17 @@ function pinnedEdgeCollectionsFor(store, coordinate, wrap) {
|
|
|
326
351
|
}
|
|
327
352
|
function recordedNodeCollection(store, kind, live, coordinate) {
|
|
328
353
|
const reads = {
|
|
329
|
-
getById: (id) =>
|
|
330
|
-
getByIds: (ids) =>
|
|
331
|
-
scan: (options) =>
|
|
354
|
+
getById: (id) => chunkUZ6CJUC5_cjs.storeRuntime(store).recordedNodeGetById(kind, id, coordinate),
|
|
355
|
+
getByIds: (ids) => chunkUZ6CJUC5_cjs.storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate),
|
|
356
|
+
scan: (options) => chunkUZ6CJUC5_cjs.storeRuntime(store).recordedNodeScan(kind, coordinate, options)
|
|
332
357
|
};
|
|
333
358
|
return recordedCollectionProxy(reads, live, coordinate, "node");
|
|
334
359
|
}
|
|
335
360
|
function recordedEdgeCollection(store, kind, live, coordinate) {
|
|
336
361
|
const reads = {
|
|
337
|
-
getById: (id) =>
|
|
338
|
-
getByIds: (ids) =>
|
|
339
|
-
scan: (options) =>
|
|
362
|
+
getById: (id) => chunkUZ6CJUC5_cjs.storeRuntime(store).recordedEdgeGetById(kind, id, coordinate),
|
|
363
|
+
getByIds: (ids) => chunkUZ6CJUC5_cjs.storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate),
|
|
364
|
+
scan: (options) => chunkUZ6CJUC5_cjs.storeRuntime(store).recordedEdgeScan(kind, coordinate, options)
|
|
340
365
|
};
|
|
341
366
|
return recordedCollectionProxy(reads, live, coordinate, "edge");
|
|
342
367
|
}
|
|
@@ -423,7 +448,7 @@ var CoordinatePinnedView = class {
|
|
|
423
448
|
this.coordinate = coordinate;
|
|
424
449
|
Object.defineProperty(this, "identity", {
|
|
425
450
|
enumerable: false,
|
|
426
|
-
get: () =>
|
|
451
|
+
get: () => chunkUZ6CJUC5_cjs.storeRuntime(this.store).identityAtCoordinate(this.coordinate)
|
|
427
452
|
});
|
|
428
453
|
}
|
|
429
454
|
/** The temporal mode this view reads in. */
|
|
@@ -440,10 +465,10 @@ var CoordinatePinnedView = class {
|
|
|
440
465
|
* view's coordinate cannot be overridden on a per-query basis.
|
|
441
466
|
*/
|
|
442
467
|
query() {
|
|
443
|
-
return
|
|
468
|
+
return chunkUZ6CJUC5_cjs.storeRuntime(this.store).sealedQuery(this.coordinate);
|
|
444
469
|
}
|
|
445
470
|
internalAlgorithms() {
|
|
446
|
-
this.#internalAlgorithms ??=
|
|
471
|
+
this.#internalAlgorithms ??= chunkUZ6CJUC5_cjs.storeRuntime(
|
|
447
472
|
this.store
|
|
448
473
|
).algorithmsAtCoordinate(this.coordinate);
|
|
449
474
|
return this.#internalAlgorithms;
|
|
@@ -470,7 +495,7 @@ var CoordinatePinnedView = class {
|
|
|
470
495
|
...options,
|
|
471
496
|
...withCoordinate(this.coordinate)
|
|
472
497
|
};
|
|
473
|
-
return
|
|
498
|
+
return chunkUZ6CJUC5_cjs.storeRuntime(this.store).subgraphAtCoordinate(
|
|
474
499
|
rootId,
|
|
475
500
|
internalOptions
|
|
476
501
|
);
|
|
@@ -560,6 +585,10 @@ var StoreViewImplementation = class extends CoordinatePinnedView {
|
|
|
560
585
|
)
|
|
561
586
|
);
|
|
562
587
|
}
|
|
588
|
+
getEdgeCollection(kind) {
|
|
589
|
+
if (this.store.getEdgeCollection(kind) === void 0) return void 0;
|
|
590
|
+
return this.edges[kind];
|
|
591
|
+
}
|
|
563
592
|
/** Adds a recorded-time pin, returning the narrow reconstructing view. */
|
|
564
593
|
asOfRecorded(recordedAsOf) {
|
|
565
594
|
return new RecordedStoreView(
|
|
@@ -1113,11 +1142,11 @@ function compileIdentityClassCte(input) {
|
|
|
1113
1142
|
if (!expandsIdentity) return void 0;
|
|
1114
1143
|
const coordinate = historicalCoordinate({ ast, temporalFilterPass });
|
|
1115
1144
|
if (coordinate === void 0) return void 0;
|
|
1116
|
-
const recursiveTraversal =
|
|
1145
|
+
const recursiveTraversal = chunkCYKHSH5O_cjs.requireRecursiveTraversalVerdict(
|
|
1117
1146
|
ctx,
|
|
1118
1147
|
"historical identity expansion"
|
|
1119
1148
|
);
|
|
1120
|
-
const peerClasses =
|
|
1149
|
+
const peerClasses = chunkCYKHSH5O_cjs.historicalIdentityPeerClassQuery({
|
|
1121
1150
|
schema: ctx.schema,
|
|
1122
1151
|
graphId,
|
|
1123
1152
|
coordinate,
|
|
@@ -1125,7 +1154,7 @@ function compileIdentityClassCte(input) {
|
|
|
1125
1154
|
recursiveTraversal
|
|
1126
1155
|
});
|
|
1127
1156
|
return chunkAYQBEVQY_cjs.sql`
|
|
1128
|
-
${chunkAYQBEVQY_cjs.sql.identifier(IDENTITY_CLASS_CTE_ALIAS)}(${
|
|
1157
|
+
${chunkAYQBEVQY_cjs.sql.identifier(IDENTITY_CLASS_CTE_ALIAS)}(${chunkCYKHSH5O_cjs.IDENTITY_PEER_CLASS_COLUMNS}) AS MATERIALIZED (
|
|
1129
1158
|
${peerClasses}
|
|
1130
1159
|
)
|
|
1131
1160
|
`;
|
|
@@ -1305,7 +1334,7 @@ function markSelectiveFieldAsRequired(requiredColumnsByAlias, field2) {
|
|
|
1305
1334
|
addRequiredColumn(requiredColumnsByAlias, field2.alias, "props");
|
|
1306
1335
|
}
|
|
1307
1336
|
function getTopLevelPropsFieldName(field2) {
|
|
1308
|
-
const pointer =
|
|
1337
|
+
const pointer = chunkCYKHSH5O_cjs.getFieldPointer(field2);
|
|
1309
1338
|
if (pointer === void 0) return void 0;
|
|
1310
1339
|
const segments = chunkOZ3ZU7Q2_cjs.parseJsonPointer(pointer);
|
|
1311
1340
|
return segments.length === 1 ? segments[0] : void 0;
|
|
@@ -1344,7 +1373,7 @@ function selectivePropsCteColumnName(field2) {
|
|
|
1344
1373
|
return boundPgIdentifier(encoded, `${alias}\0${fieldName}`);
|
|
1345
1374
|
}
|
|
1346
1375
|
function buildScopedNodeIdsSubquery(nodeAlias) {
|
|
1347
|
-
const cteAlias = `${
|
|
1376
|
+
const cteAlias = `${chunkJ34FSPSC_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`;
|
|
1348
1377
|
return chunkAYQBEVQY_cjs.sql`
|
|
1349
1378
|
(
|
|
1350
1379
|
SELECT DISTINCT
|
|
@@ -1406,11 +1435,11 @@ function buildStandardStartCte(input) {
|
|
|
1406
1435
|
const alias = ast.start.alias;
|
|
1407
1436
|
const kinds = ast.start.kinds;
|
|
1408
1437
|
const cteMaterialization = ctx.dialect.capabilities.emitNotMaterializedHint ? chunkAYQBEVQY_cjs.sql`NOT MATERIALIZED ` : chunkAYQBEVQY_cjs.sql``;
|
|
1409
|
-
const kindFilter =
|
|
1438
|
+
const kindFilter = chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("kind"), kinds);
|
|
1410
1439
|
const temporalFilter = input.temporalFilterPass.forAlias();
|
|
1411
1440
|
const cteContext = { ...ctx, cteColumnPrefix: "" };
|
|
1412
|
-
const predicateClauses =
|
|
1413
|
-
|
|
1441
|
+
const predicateClauses = chunkCYKHSH5O_cjs.compilePredicateClauses(
|
|
1442
|
+
chunkCYKHSH5O_cjs.getPredicatesForAlias(predicateIndex, alias, "node"),
|
|
1414
1443
|
cteContext
|
|
1415
1444
|
);
|
|
1416
1445
|
const whereClauses = [
|
|
@@ -1457,27 +1486,27 @@ function buildStandardTraversalCte(input) {
|
|
|
1457
1486
|
} = input;
|
|
1458
1487
|
const traversal = chunkBXHAPCQG_cjs.requireDefined(ast.traversals[traversalIndex]);
|
|
1459
1488
|
const traversalLimitValue = traversalIndex === ast.traversals.length - 1 ? traversalLimit : void 0;
|
|
1460
|
-
const previousNodeKinds =
|
|
1489
|
+
const previousNodeKinds = chunkCYKHSH5O_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
1461
1490
|
const directEdgeKinds = [...new Set(traversal.edgeKinds)];
|
|
1462
1491
|
const inverseEdgeKinds = traversal.inverseEdgeKinds === void 0 ? [] : [...new Set(traversal.inverseEdgeKinds)];
|
|
1463
1492
|
const nodeKinds = traversal.nodeKinds;
|
|
1464
|
-
const nodeKindFilter =
|
|
1493
|
+
const nodeKindFilter = chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("n.kind"), nodeKinds);
|
|
1465
1494
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
1466
1495
|
const nodeTemporalFilter = temporalFilterPass.forAlias("n");
|
|
1467
1496
|
const nodeCteContext = {
|
|
1468
1497
|
...ctx,
|
|
1469
1498
|
cteColumnPrefix: "n"
|
|
1470
1499
|
};
|
|
1471
|
-
const nodePredicateClauses =
|
|
1472
|
-
|
|
1500
|
+
const nodePredicateClauses = chunkCYKHSH5O_cjs.compilePredicateClauses(
|
|
1501
|
+
chunkCYKHSH5O_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
1473
1502
|
nodeCteContext
|
|
1474
1503
|
);
|
|
1475
1504
|
const edgeCteContext = {
|
|
1476
1505
|
...ctx,
|
|
1477
1506
|
cteColumnPrefix: "e"
|
|
1478
1507
|
};
|
|
1479
|
-
const edgePredicateClauses =
|
|
1480
|
-
|
|
1508
|
+
const edgePredicateClauses = chunkCYKHSH5O_cjs.compilePredicateClauses(
|
|
1509
|
+
chunkCYKHSH5O_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
1481
1510
|
edgeCteContext
|
|
1482
1511
|
);
|
|
1483
1512
|
const baseWhereClauses = [
|
|
@@ -1547,12 +1576,12 @@ function buildStandardTraversalCte(input) {
|
|
|
1547
1576
|
// currently the member-visibility guard. Every branch of the step carries
|
|
1548
1577
|
// them, because every branch reads the widened frontier.
|
|
1549
1578
|
...identityFrontierExpansion?.whereClauses ?? [],
|
|
1550
|
-
|
|
1551
|
-
|
|
1579
|
+
chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("e.kind"), branch.edgeKinds),
|
|
1580
|
+
chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw(`e.${branch.targetKindField}`), nodeKinds)
|
|
1552
1581
|
];
|
|
1553
1582
|
if (traversal.includeIdentityMembers !== true) {
|
|
1554
1583
|
whereClauses.push(
|
|
1555
|
-
|
|
1584
|
+
chunkCYKHSH5O_cjs.compileKindFilter(
|
|
1556
1585
|
chunkAYQBEVQY_cjs.sql.raw(`e.${branch.joinKindField}`),
|
|
1557
1586
|
previousNodeKinds
|
|
1558
1587
|
)
|
|
@@ -1621,7 +1650,7 @@ function buildStandardTraversalCte(input) {
|
|
|
1621
1650
|
const duplicateGuard = compileInverseTraversalDuplicateGuard(
|
|
1622
1651
|
directEdgeKinds,
|
|
1623
1652
|
inverseEdgeKinds,
|
|
1624
|
-
(overlappingKinds) =>
|
|
1653
|
+
(overlappingKinds) => chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("e.kind"), overlappingKinds)
|
|
1625
1654
|
);
|
|
1626
1655
|
const inverseBranch = compileTraversalBranch({
|
|
1627
1656
|
duplicateGuard,
|
|
@@ -1662,7 +1691,7 @@ function compileAggregateExprFromSource(expr, dialect) {
|
|
|
1662
1691
|
case "min":
|
|
1663
1692
|
case "max": {
|
|
1664
1693
|
const cteAlias = `cte_${field2.alias}`;
|
|
1665
|
-
const column =
|
|
1694
|
+
const column = chunkCYKHSH5O_cjs.compileFieldValue(
|
|
1666
1695
|
field2,
|
|
1667
1696
|
dialect,
|
|
1668
1697
|
field2.valueType,
|
|
@@ -1685,7 +1714,7 @@ function compileProjectedSource(field2, dialect) {
|
|
|
1685
1714
|
return compileAggregateExprFromSource(field2.source, dialect);
|
|
1686
1715
|
}
|
|
1687
1716
|
const cteAlias = field2.cteAlias ?? `cte_${field2.source.alias}`;
|
|
1688
|
-
return
|
|
1717
|
+
return chunkCYKHSH5O_cjs.compileFieldValue(
|
|
1689
1718
|
field2.source,
|
|
1690
1719
|
dialect,
|
|
1691
1720
|
field2.source.valueType,
|
|
@@ -1741,43 +1770,43 @@ function compileOrderFieldValue(ast, field2, dialect, cteAlias) {
|
|
|
1741
1770
|
if (selectiveField !== void 0) {
|
|
1742
1771
|
return chunkAYQBEVQY_cjs.sql`${chunkAYQBEVQY_cjs.sql.raw(cteAlias)}.${quoteIdentifier(selectivePropsCteColumnName(selectiveField))}`;
|
|
1743
1772
|
}
|
|
1744
|
-
return
|
|
1773
|
+
return chunkCYKHSH5O_cjs.compileFieldValue(field2, dialect, field2.valueType, cteAlias);
|
|
1745
1774
|
}
|
|
1746
1775
|
function buildRelevanceJoins(vectorPredicate, fulltextPredicate) {
|
|
1747
|
-
const hybridTargetAlias =
|
|
1776
|
+
const hybridTargetAlias = chunkCYKHSH5O_cjs.getHybridTargetAlias(
|
|
1748
1777
|
vectorPredicate,
|
|
1749
1778
|
fulltextPredicate
|
|
1750
1779
|
);
|
|
1751
1780
|
if (hybridTargetAlias !== void 0) {
|
|
1752
1781
|
return [
|
|
1753
1782
|
buildHybridCandidateJoin(hybridTargetAlias),
|
|
1754
|
-
buildRelevanceJoin(
|
|
1755
|
-
buildRelevanceJoin(
|
|
1783
|
+
buildRelevanceJoin(chunkJ34FSPSC_cjs.EMBEDDINGS_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN"),
|
|
1784
|
+
buildRelevanceJoin(chunkJ34FSPSC_cjs.FULLTEXT_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN")
|
|
1756
1785
|
];
|
|
1757
1786
|
}
|
|
1758
1787
|
const joins = [];
|
|
1759
1788
|
if (vectorPredicate) {
|
|
1760
1789
|
joins.push(
|
|
1761
|
-
buildRelevanceJoin(
|
|
1790
|
+
buildRelevanceJoin(chunkJ34FSPSC_cjs.EMBEDDINGS_CTE_ALIAS, vectorPredicate.field.alias)
|
|
1762
1791
|
);
|
|
1763
1792
|
}
|
|
1764
1793
|
if (fulltextPredicate) {
|
|
1765
1794
|
joins.push(
|
|
1766
|
-
buildRelevanceJoin(
|
|
1795
|
+
buildRelevanceJoin(chunkJ34FSPSC_cjs.FULLTEXT_CTE_ALIAS, fulltextPredicate.field.alias)
|
|
1767
1796
|
);
|
|
1768
1797
|
}
|
|
1769
1798
|
return joins;
|
|
1770
1799
|
}
|
|
1771
1800
|
function buildHybridCandidateJoin(nodeAlias) {
|
|
1772
|
-
const candidateCte = chunkAYQBEVQY_cjs.sql.raw(
|
|
1773
|
-
const node = chunkAYQBEVQY_cjs.sql.raw(`${
|
|
1801
|
+
const candidateCte = chunkAYQBEVQY_cjs.sql.raw(chunkJ34FSPSC_cjs.HYBRID_CANDIDATES_CTE_ALIAS);
|
|
1802
|
+
const node = chunkAYQBEVQY_cjs.sql.raw(`${chunkJ34FSPSC_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
|
|
1774
1803
|
const idColumn = chunkAYQBEVQY_cjs.sql.raw(`${nodeAlias}_id`);
|
|
1775
1804
|
const kindColumn = chunkAYQBEVQY_cjs.sql.raw(`${nodeAlias}_kind`);
|
|
1776
1805
|
return chunkAYQBEVQY_cjs.sql`INNER JOIN ${candidateCte} ON ${candidateCte}.node_id = ${node}.${idColumn} AND ${candidateCte}.node_kind = ${node}.${kindColumn}`;
|
|
1777
1806
|
}
|
|
1778
1807
|
function buildRelevanceJoin(cteAlias, nodeAlias, joinType = "INNER JOIN") {
|
|
1779
1808
|
const cte = chunkAYQBEVQY_cjs.sql.raw(cteAlias);
|
|
1780
|
-
const node = chunkAYQBEVQY_cjs.sql.raw(`${
|
|
1809
|
+
const node = chunkAYQBEVQY_cjs.sql.raw(`${chunkJ34FSPSC_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
|
|
1781
1810
|
const idColumn = chunkAYQBEVQY_cjs.sql.raw(`${nodeAlias}_id`);
|
|
1782
1811
|
const kindColumn = chunkAYQBEVQY_cjs.sql.raw(`${nodeAlias}_kind`);
|
|
1783
1812
|
return chunkAYQBEVQY_cjs.sql`${chunkAYQBEVQY_cjs.sql.raw(joinType)} ${cte} ON ${cte}.node_id = ${node}.${idColumn} AND ${cte}.node_kind = ${node}.${kindColumn}`;
|
|
@@ -1874,7 +1903,7 @@ function lateMaterializedProjectedNodeAliases(ast) {
|
|
|
1874
1903
|
function buildLateMaterializedTopKCte(input) {
|
|
1875
1904
|
const { ast, collapsedTraversalCteAlias, dialect, fromClause } = input;
|
|
1876
1905
|
const aliasToCte = buildAliasToCteMap(ast);
|
|
1877
|
-
const cteAliasFor = (alias) => collapsedTraversalCteAlias ?? aliasToCte.get(alias) ?? `${
|
|
1906
|
+
const cteAliasFor = (alias) => collapsedTraversalCteAlias ?? aliasToCte.get(alias) ?? `${chunkJ34FSPSC_cjs.ALIAS_CTE_PREFIX}${alias}`;
|
|
1878
1907
|
const columns = [];
|
|
1879
1908
|
for (const alias of lateMaterializedNodeAliases(ast)) {
|
|
1880
1909
|
const cteAlias = cteAliasFor(alias);
|
|
@@ -1985,7 +2014,7 @@ function buildStandardGroupBy(input) {
|
|
|
1985
2014
|
}
|
|
1986
2015
|
const aliasToCte = buildAliasToCteMap(ast);
|
|
1987
2016
|
const parts = allFields.map(
|
|
1988
|
-
(field2) =>
|
|
2017
|
+
(field2) => chunkCYKHSH5O_cjs.compileFieldValue(
|
|
1989
2018
|
field2,
|
|
1990
2019
|
dialect,
|
|
1991
2020
|
field2.valueType,
|
|
@@ -1999,7 +2028,7 @@ function buildStandardHaving(input) {
|
|
|
1999
2028
|
if (!ast.having) {
|
|
2000
2029
|
return void 0;
|
|
2001
2030
|
}
|
|
2002
|
-
const condition =
|
|
2031
|
+
const condition = chunkCYKHSH5O_cjs.compilePredicateExpression(ast.having, ctx);
|
|
2003
2032
|
return chunkAYQBEVQY_cjs.sql`HAVING ${condition}`;
|
|
2004
2033
|
}
|
|
2005
2034
|
function buildStandardEmbeddingsCte(input) {
|
|
@@ -2020,11 +2049,11 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
2020
2049
|
const vectorSlots = ctx.vectorSlots;
|
|
2021
2050
|
const scopedNodes = buildScopedNodeIdsSubquery(field2.alias);
|
|
2022
2051
|
const declaringKinds = nodeKinds.filter(
|
|
2023
|
-
(kind) => vectorSlots?.has(
|
|
2052
|
+
(kind) => vectorSlots?.has(chunkJ34FSPSC_cjs.vectorSlotKey(kind, fieldPath))
|
|
2024
2053
|
);
|
|
2025
2054
|
const branches = declaringKinds.map((kind) => {
|
|
2026
2055
|
const tableName = vectorStrategy.tableName(graphId, kind, fieldPath);
|
|
2027
|
-
const slotDescriptor = vectorSlots?.get(
|
|
2056
|
+
const slotDescriptor = vectorSlots?.get(chunkJ34FSPSC_cjs.vectorSlotKey(kind, fieldPath));
|
|
2028
2057
|
const branchMetric = metric ?? slotDescriptor?.metric ?? "cosine";
|
|
2029
2058
|
if (slotDescriptor !== void 0) {
|
|
2030
2059
|
chunkI2W5N2LC_cjs.assertApproximateMetricSupported({
|
|
@@ -2040,7 +2069,7 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
2040
2069
|
const annSlot = engineFormEligible && branchMetric === slotDescriptor?.metric ? slotDescriptor : void 0;
|
|
2041
2070
|
if (annSlot !== void 0) {
|
|
2042
2071
|
ctx.annIndexTypes?.add(annSlot.indexType);
|
|
2043
|
-
const candidateCte = `${
|
|
2072
|
+
const candidateCte = `${chunkJ34FSPSC_cjs.ALIAS_CTE_PREFIX}${field2.alias}`;
|
|
2044
2073
|
const kindCandidates = chunkAYQBEVQY_cjs.sql`SELECT ${qualifyColumn(candidateCte, `${field2.alias}_id`)} FROM ${quoteIdentifier(candidateCte)} WHERE ${qualifyColumn(candidateCte, `${field2.alias}_kind`)} = ${kind}`;
|
|
2045
2074
|
const annSql = vectorStrategy.buildSearch(
|
|
2046
2075
|
{
|
|
@@ -2106,7 +2135,7 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
2106
2135
|
`
|
|
2107
2136
|
);
|
|
2108
2137
|
return chunkAYQBEVQY_cjs.sql`
|
|
2109
|
-
${chunkAYQBEVQY_cjs.sql.raw(
|
|
2138
|
+
${chunkAYQBEVQY_cjs.sql.raw(chunkJ34FSPSC_cjs.EMBEDDINGS_CTE_ALIAS)} AS (
|
|
2110
2139
|
SELECT
|
|
2111
2140
|
node_id,
|
|
2112
2141
|
node_kind,
|
|
@@ -2163,14 +2192,14 @@ function buildStandardFulltextCte(input) {
|
|
|
2163
2192
|
);
|
|
2164
2193
|
const conditions = [
|
|
2165
2194
|
chunkAYQBEVQY_cjs.sql`${qualifyColumn(tableName, "graph_id")} = ${graphId}`,
|
|
2166
|
-
|
|
2195
|
+
chunkCYKHSH5O_cjs.compileKindFilter(qualifyColumn(tableName, "node_kind"), nodeKinds),
|
|
2167
2196
|
matchCondition
|
|
2168
2197
|
];
|
|
2169
2198
|
if (minScore !== void 0) {
|
|
2170
2199
|
conditions.push(chunkAYQBEVQY_cjs.sql`${rankExpression} >= ${minScore}`);
|
|
2171
2200
|
}
|
|
2172
2201
|
return chunkAYQBEVQY_cjs.sql`
|
|
2173
|
-
${chunkAYQBEVQY_cjs.sql.raw(
|
|
2202
|
+
${chunkAYQBEVQY_cjs.sql.raw(chunkJ34FSPSC_cjs.FULLTEXT_CTE_ALIAS)} AS (
|
|
2174
2203
|
SELECT
|
|
2175
2204
|
node_id,
|
|
2176
2205
|
node_kind,
|
|
@@ -2206,10 +2235,10 @@ function sharedDeclaredLanguage(fulltextLanguages, nodeKinds) {
|
|
|
2206
2235
|
}
|
|
2207
2236
|
function buildStandardHybridCandidateCte() {
|
|
2208
2237
|
return chunkAYQBEVQY_cjs.sql`
|
|
2209
|
-
${chunkAYQBEVQY_cjs.sql.raw(
|
|
2210
|
-
SELECT node_id, node_kind FROM ${chunkAYQBEVQY_cjs.sql.raw(
|
|
2238
|
+
${chunkAYQBEVQY_cjs.sql.raw(chunkJ34FSPSC_cjs.HYBRID_CANDIDATES_CTE_ALIAS)} AS (
|
|
2239
|
+
SELECT node_id, node_kind FROM ${chunkAYQBEVQY_cjs.sql.raw(chunkJ34FSPSC_cjs.EMBEDDINGS_CTE_ALIAS)}
|
|
2211
2240
|
UNION
|
|
2212
|
-
SELECT node_id, node_kind FROM ${chunkAYQBEVQY_cjs.sql.raw(
|
|
2241
|
+
SELECT node_id, node_kind FROM ${chunkAYQBEVQY_cjs.sql.raw(chunkJ34FSPSC_cjs.FULLTEXT_CTE_ALIAS)}
|
|
2213
2242
|
)
|
|
2214
2243
|
`;
|
|
2215
2244
|
}
|
|
@@ -2224,7 +2253,7 @@ function compileUserOrderBy(ast, dialect) {
|
|
|
2224
2253
|
"Ordering by JSON arrays or objects is not supported"
|
|
2225
2254
|
);
|
|
2226
2255
|
}
|
|
2227
|
-
const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${
|
|
2256
|
+
const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${chunkJ34FSPSC_cjs.ALIAS_CTE_PREFIX}${orderSpec.field.alias}`;
|
|
2228
2257
|
const field2 = compileOrderFieldValue(
|
|
2229
2258
|
ast,
|
|
2230
2259
|
orderSpec.field,
|
|
@@ -2243,7 +2272,7 @@ function compileUserOrderBy(ast, dialect) {
|
|
|
2243
2272
|
}
|
|
2244
2273
|
function buildStandardFulltextOrderBy(input) {
|
|
2245
2274
|
const { ast, dialect } = input;
|
|
2246
|
-
const rankOrder = chunkAYQBEVQY_cjs.sql.raw(`${
|
|
2275
|
+
const rankOrder = chunkAYQBEVQY_cjs.sql.raw(`${chunkJ34FSPSC_cjs.FULLTEXT_CTE_ALIAS}.rank DESC`);
|
|
2247
2276
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2248
2277
|
return chunkAYQBEVQY_cjs.sql`ORDER BY ${chunkAYQBEVQY_cjs.sql.join([rankOrder, ...userOrders], chunkAYQBEVQY_cjs.sql`, `)}`;
|
|
2249
2278
|
}
|
|
@@ -2253,17 +2282,17 @@ function buildStandardHybridRrfOrderBy(input) {
|
|
|
2253
2282
|
const vectorWeight = fusion?.weights?.vector ?? DEFAULT_RRF_WEIGHT;
|
|
2254
2283
|
const fulltextWeight = fusion?.weights?.fulltext ?? DEFAULT_RRF_WEIGHT;
|
|
2255
2284
|
const rrfOrder = chunkAYQBEVQY_cjs.sql.raw(
|
|
2256
|
-
`(COALESCE((${vectorWeight} * 1.0) / (${k} + ${
|
|
2285
|
+
`(COALESCE((${vectorWeight} * 1.0) / (${k} + ${chunkJ34FSPSC_cjs.EMBEDDINGS_CTE_ALIAS}.ord), 0) + COALESCE((${fulltextWeight} * 1.0) / (${k} + ${chunkJ34FSPSC_cjs.FULLTEXT_CTE_ALIAS}.ord), 0)) DESC`
|
|
2257
2286
|
);
|
|
2258
2287
|
const idTiebreak = chunkAYQBEVQY_cjs.sql.raw(
|
|
2259
|
-
`COALESCE(${
|
|
2288
|
+
`COALESCE(${chunkJ34FSPSC_cjs.FULLTEXT_CTE_ALIAS}.node_id, ${chunkJ34FSPSC_cjs.EMBEDDINGS_CTE_ALIAS}.node_id) ASC`
|
|
2260
2289
|
);
|
|
2261
2290
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2262
2291
|
return chunkAYQBEVQY_cjs.sql`ORDER BY ${chunkAYQBEVQY_cjs.sql.join([rrfOrder, ...userOrders, idTiebreak], chunkAYQBEVQY_cjs.sql`, `)}`;
|
|
2263
2292
|
}
|
|
2264
2293
|
function buildStandardVectorOrderBy(input) {
|
|
2265
2294
|
const { ast, dialect } = input;
|
|
2266
|
-
const distanceOrder = chunkAYQBEVQY_cjs.sql.raw(`${
|
|
2295
|
+
const distanceOrder = chunkAYQBEVQY_cjs.sql.raw(`${chunkJ34FSPSC_cjs.EMBEDDINGS_CTE_ALIAS}.distance ASC`);
|
|
2267
2296
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2268
2297
|
return chunkAYQBEVQY_cjs.sql`ORDER BY ${chunkAYQBEVQY_cjs.sql.join([distanceOrder, ...userOrders], chunkAYQBEVQY_cjs.sql`, `)}`;
|
|
2269
2298
|
}
|
|
@@ -2281,7 +2310,7 @@ function buildLimitOffsetClause(input) {
|
|
|
2281
2310
|
|
|
2282
2311
|
// src/query/compiler/passes/fulltext.ts
|
|
2283
2312
|
function runFulltextPredicatePass(ast, dialect) {
|
|
2284
|
-
const fulltextPredicates =
|
|
2313
|
+
const fulltextPredicates = chunkCYKHSH5O_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2285
2314
|
if (fulltextPredicates.length > 1) {
|
|
2286
2315
|
throw new chunkASKXTVK5_cjs.UnsupportedPredicateError(
|
|
2287
2316
|
"Multiple fulltext match predicates in a single query are not supported"
|
|
@@ -2378,11 +2407,11 @@ function runCompilerPass(state, pass) {
|
|
|
2378
2407
|
|
|
2379
2408
|
// src/query/compiler/passes/temporal.ts
|
|
2380
2409
|
function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
2381
|
-
const currentTimestamp =
|
|
2410
|
+
const currentTimestamp = chunkCYKHSH5O_cjs.currentReadInstantFor(readInstant);
|
|
2382
2411
|
return {
|
|
2383
2412
|
forAlias(tableAlias) {
|
|
2384
|
-
return
|
|
2385
|
-
...
|
|
2413
|
+
return chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
2414
|
+
...chunkCYKHSH5O_cjs.extractTemporalOptions(ast, tableAlias),
|
|
2386
2415
|
currentTimestamp
|
|
2387
2416
|
});
|
|
2388
2417
|
},
|
|
@@ -2392,7 +2421,7 @@ function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
|
2392
2421
|
|
|
2393
2422
|
// src/query/compiler/passes/vector.ts
|
|
2394
2423
|
function runVectorPredicatePass(ast, dialect, vectorStrategy) {
|
|
2395
|
-
const vectorPredicates =
|
|
2424
|
+
const vectorPredicates = chunkCYKHSH5O_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2396
2425
|
if (vectorPredicates.length > 1) {
|
|
2397
2426
|
throw new chunkASKXTVK5_cjs.UnsupportedPredicateError(
|
|
2398
2427
|
"Multiple vector similarity predicates in a single query are not supported"
|
|
@@ -2805,8 +2834,8 @@ function assertRecordedQueryDoesNotUseCurrentIndexes(ast, vectorPredicate, fullt
|
|
|
2805
2834
|
}
|
|
2806
2835
|
function assertRecordedQueryAstDoesNotUseCurrentIndexes(ast) {
|
|
2807
2836
|
if (ast.recordedAsOf === void 0) return;
|
|
2808
|
-
const vectorPredicates =
|
|
2809
|
-
const fulltextPredicates =
|
|
2837
|
+
const vectorPredicates = chunkCYKHSH5O_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2838
|
+
const fulltextPredicates = chunkCYKHSH5O_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2810
2839
|
assertRecordedQueryHasNoCurrentIndexUsage(ast, {
|
|
2811
2840
|
usesVectorPredicate: vectorPredicates.length > 0,
|
|
2812
2841
|
usesFulltextPredicate: fulltextPredicates.length > 0
|
|
@@ -2921,7 +2950,7 @@ function runRecursiveQueryPassPipeline(ast, graphId, ctx) {
|
|
|
2921
2950
|
return state;
|
|
2922
2951
|
}
|
|
2923
2952
|
function compileVariableLengthQuery(ast, graphId, ctx) {
|
|
2924
|
-
|
|
2953
|
+
chunkCYKHSH5O_cjs.assertRecursiveTraversalSupported(ctx, "variable-length traversal");
|
|
2925
2954
|
const strategy = ctx.dialect.capabilities.recursiveQueryStrategy;
|
|
2926
2955
|
const handler = RECURSIVE_QUERY_STRATEGY_HANDLERS[strategy];
|
|
2927
2956
|
return handler(ast, graphId, ctx);
|
|
@@ -3221,13 +3250,13 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
3221
3250
|
`;
|
|
3222
3251
|
}
|
|
3223
3252
|
function compileKindFilter2(kinds, columnExpr) {
|
|
3224
|
-
return
|
|
3253
|
+
return chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw(columnExpr), kinds);
|
|
3225
3254
|
}
|
|
3226
3255
|
function compileNodePredicates(ast, alias, ctx) {
|
|
3227
|
-
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) =>
|
|
3256
|
+
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) => chunkCYKHSH5O_cjs.compilePredicateExpression(p.expression, ctx));
|
|
3228
3257
|
}
|
|
3229
3258
|
function compileEdgePredicates(ast, edgeAlias, ctx) {
|
|
3230
|
-
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) =>
|
|
3259
|
+
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) => chunkCYKHSH5O_cjs.compilePredicateExpression(p.expression, ctx));
|
|
3231
3260
|
}
|
|
3232
3261
|
function collectRequiredColumnsByAlias(ast, traversal) {
|
|
3233
3262
|
const selectiveFields = ast.selectiveFields;
|
|
@@ -3346,7 +3375,7 @@ function compileRecursiveOrderBy(ast, dialect) {
|
|
|
3346
3375
|
"Ordering by JSON arrays or objects is not supported"
|
|
3347
3376
|
);
|
|
3348
3377
|
}
|
|
3349
|
-
const field2 =
|
|
3378
|
+
const field2 = chunkCYKHSH5O_cjs.compileFieldValue(orderSpec.field, dialect, valueType);
|
|
3350
3379
|
const direction = chunkAYQBEVQY_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
3351
3380
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
3352
3381
|
const nullsDirection = chunkAYQBEVQY_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
@@ -3427,28 +3456,28 @@ function decodeByValueType(value, valueType) {
|
|
|
3427
3456
|
|
|
3428
3457
|
// src/store/recursive-cte.ts
|
|
3429
3458
|
function buildReachableCte(options) {
|
|
3430
|
-
|
|
3459
|
+
chunkZXXGMQC3_cjs.assertRecursiveTraversal(options.recursiveTraversal, options.operation);
|
|
3431
3460
|
const trackPath = options.cyclePolicy === "prevent" || options.includePath;
|
|
3432
|
-
const edgeKindFilter =
|
|
3461
|
+
const edgeKindFilter = chunkCYKHSH5O_cjs.compileKindFilter(
|
|
3433
3462
|
chunkAYQBEVQY_cjs.sql.raw("e.kind"),
|
|
3434
3463
|
options.edgeKinds
|
|
3435
3464
|
);
|
|
3436
|
-
const currentTimestamp =
|
|
3437
|
-
const nodeTemporalFilter =
|
|
3465
|
+
const currentTimestamp = chunkCYKHSH5O_cjs.currentReadInstant();
|
|
3466
|
+
const nodeTemporalFilter = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
3438
3467
|
mode: options.temporalMode,
|
|
3439
3468
|
asOf: options.asOf,
|
|
3440
3469
|
recordedAsOf: options.recordedAsOf,
|
|
3441
3470
|
tableAlias: "n",
|
|
3442
3471
|
currentTimestamp
|
|
3443
3472
|
});
|
|
3444
|
-
const edgeTemporalFilter =
|
|
3473
|
+
const edgeTemporalFilter = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
3445
3474
|
mode: options.temporalMode,
|
|
3446
3475
|
asOf: options.asOf,
|
|
3447
3476
|
recordedAsOf: options.recordedAsOf,
|
|
3448
3477
|
tableAlias: "e",
|
|
3449
3478
|
currentTimestamp
|
|
3450
3479
|
});
|
|
3451
|
-
const schema =
|
|
3480
|
+
const schema = chunkJ34FSPSC_cjs.recordedReadSchemaFor(
|
|
3452
3481
|
options.schema,
|
|
3453
3482
|
options.recordedAsOf,
|
|
3454
3483
|
options.recordedReadBinding,
|
|
@@ -3570,7 +3599,7 @@ async function executeSubgraph(params) {
|
|
|
3570
3599
|
);
|
|
3571
3600
|
const temporalMode = coordinate.mode;
|
|
3572
3601
|
const recordedAsOf = options.recordedAsOf;
|
|
3573
|
-
const baseSchema = params.schema ??
|
|
3602
|
+
const baseSchema = params.schema ?? chunkJ34FSPSC_cjs.DEFAULT_SQL_SCHEMA;
|
|
3574
3603
|
const maxDepth = Math.min(
|
|
3575
3604
|
options.maxDepth ?? DEFAULT_SUBGRAPH_MAX_DEPTH,
|
|
3576
3605
|
MAX_EXPLICIT_RECURSIVE_DEPTH
|
|
@@ -3588,7 +3617,7 @@ async function executeSubgraph(params) {
|
|
|
3588
3617
|
asOf: coordinate.asOf,
|
|
3589
3618
|
recordedAsOf,
|
|
3590
3619
|
dialect: params.dialect,
|
|
3591
|
-
schema:
|
|
3620
|
+
schema: chunkJ34FSPSC_cjs.recordedReadSchemaFor(
|
|
3592
3621
|
baseSchema,
|
|
3593
3622
|
recordedAsOf,
|
|
3594
3623
|
params.recordedReadBinding,
|
|
@@ -3625,7 +3654,7 @@ async function executeSubgraph(params) {
|
|
|
3625
3654
|
// Base schema: buildReachableCte derives the recorded swap from recordedAsOf.
|
|
3626
3655
|
schema: baseSchema,
|
|
3627
3656
|
...ctx.recordedReadBinding === void 0 ? {} : { recordedReadBinding: ctx.recordedReadBinding },
|
|
3628
|
-
recursiveTraversal:
|
|
3657
|
+
recursiveTraversal: chunkZXXGMQC3_cjs.resolveRecursiveTraversal(params.backend.capabilities),
|
|
3629
3658
|
operation: "subgraph"
|
|
3630
3659
|
});
|
|
3631
3660
|
const includedIdsCte = buildIncludedIdsCte(ctx);
|
|
@@ -3754,7 +3783,7 @@ function dedupeStrings(values) {
|
|
|
3754
3783
|
function buildIncludedIdsCte(ctx) {
|
|
3755
3784
|
const filters = [];
|
|
3756
3785
|
if (ctx.includeKinds !== void 0 && ctx.includeKinds.length > 0) {
|
|
3757
|
-
filters.push(
|
|
3786
|
+
filters.push(chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("kind"), ctx.includeKinds));
|
|
3758
3787
|
}
|
|
3759
3788
|
if (ctx.excludeRoot) {
|
|
3760
3789
|
filters.push(chunkAYQBEVQY_cjs.sql`id != ${ctx.rootId}`);
|
|
@@ -3777,12 +3806,12 @@ async function fetchIncludedIds(ctx, reachableCte, includedIdsCte) {
|
|
|
3777
3806
|
return rows.map((row) => row.id);
|
|
3778
3807
|
}
|
|
3779
3808
|
async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
3780
|
-
const nodeTemporalFilter =
|
|
3809
|
+
const nodeTemporalFilter = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
3781
3810
|
mode: ctx.temporalMode,
|
|
3782
3811
|
asOf: ctx.asOf,
|
|
3783
3812
|
recordedAsOf: ctx.recordedAsOf,
|
|
3784
3813
|
tableAlias: "n",
|
|
3785
|
-
currentTimestamp:
|
|
3814
|
+
currentTimestamp: chunkCYKHSH5O_cjs.currentReadInstant()
|
|
3786
3815
|
});
|
|
3787
3816
|
const columns = [
|
|
3788
3817
|
chunkAYQBEVQY_cjs.sql`n.kind`,
|
|
@@ -3805,13 +3834,13 @@ async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
|
3805
3834
|
);
|
|
3806
3835
|
}
|
|
3807
3836
|
async function fetchSubgraphEdges(ctx, membership, projectionPlan) {
|
|
3808
|
-
const edgeKindFilter =
|
|
3809
|
-
const edgeTemporalFilter =
|
|
3837
|
+
const edgeKindFilter = chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("e.kind"), ctx.edgeKinds);
|
|
3838
|
+
const edgeTemporalFilter = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
3810
3839
|
mode: ctx.temporalMode,
|
|
3811
3840
|
asOf: ctx.asOf,
|
|
3812
3841
|
recordedAsOf: ctx.recordedAsOf,
|
|
3813
3842
|
tableAlias: "e",
|
|
3814
|
-
currentTimestamp:
|
|
3843
|
+
currentTimestamp: chunkCYKHSH5O_cjs.currentReadInstant()
|
|
3815
3844
|
});
|
|
3816
3845
|
const columns = [
|
|
3817
3846
|
chunkAYQBEVQY_cjs.sql`e.id`,
|
|
@@ -3850,7 +3879,7 @@ function buildMetadataColumns(alias, plan, columns) {
|
|
|
3850
3879
|
if (metaKinds.length === plan.fullKinds.length + plan.projectedKinds.size) {
|
|
3851
3880
|
return columns.map((col) => chunkAYQBEVQY_cjs.sql`${chunkAYQBEVQY_cjs.sql.raw(`${alias}.${col}`)}`);
|
|
3852
3881
|
}
|
|
3853
|
-
const filter =
|
|
3882
|
+
const filter = chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw(`${alias}.kind`), metaKinds);
|
|
3854
3883
|
return columns.map(
|
|
3855
3884
|
(col) => chunkAYQBEVQY_cjs.sql`CASE WHEN ${filter} THEN ${chunkAYQBEVQY_cjs.sql.raw(`${alias}.${col}`)} ELSE NULL END AS ${chunkAYQBEVQY_cjs.sql.raw(col)}`
|
|
3856
3885
|
);
|
|
@@ -3862,7 +3891,7 @@ function buildFullPropsColumn(alias, plan) {
|
|
|
3862
3891
|
if (plan.fullKinds.length === 0) {
|
|
3863
3892
|
return chunkAYQBEVQY_cjs.sql`NULL AS props`;
|
|
3864
3893
|
}
|
|
3865
|
-
const filter =
|
|
3894
|
+
const filter = chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw(`${alias}.kind`), plan.fullKinds);
|
|
3866
3895
|
return chunkAYQBEVQY_cjs.sql`CASE WHEN ${filter} THEN ${chunkAYQBEVQY_cjs.sql.raw(`${alias}.props`)} ELSE NULL END AS props`;
|
|
3867
3896
|
}
|
|
3868
3897
|
function buildProjectedPropertyColumns(alias, plan, dialect) {
|
|
@@ -3906,7 +3935,7 @@ function applyProjectedFields(target, row, kindPlan) {
|
|
|
3906
3935
|
function mapSubgraphNodeRow(row, projectionPlan) {
|
|
3907
3936
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3908
3937
|
if (kindPlan === void 0) {
|
|
3909
|
-
return
|
|
3938
|
+
return chunkUVMSWO6X_cjs.rowToNode({
|
|
3910
3939
|
...row,
|
|
3911
3940
|
props: normalizeProps(row.props)
|
|
3912
3941
|
});
|
|
@@ -3916,7 +3945,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3916
3945
|
id: row.id
|
|
3917
3946
|
};
|
|
3918
3947
|
if (kindPlan.includeMeta) {
|
|
3919
|
-
projectedNode["meta"] =
|
|
3948
|
+
projectedNode["meta"] = chunkUVMSWO6X_cjs.rowToNodeMeta(row);
|
|
3920
3949
|
}
|
|
3921
3950
|
applyProjectedFields(projectedNode, row, kindPlan);
|
|
3922
3951
|
return projectedNode;
|
|
@@ -3924,7 +3953,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3924
3953
|
function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
3925
3954
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3926
3955
|
if (kindPlan === void 0) {
|
|
3927
|
-
return
|
|
3956
|
+
return chunkUVMSWO6X_cjs.rowToEdge({
|
|
3928
3957
|
...row,
|
|
3929
3958
|
props: normalizeProps(row.props)
|
|
3930
3959
|
});
|
|
@@ -3938,7 +3967,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
|
3938
3967
|
toId: row.to_id
|
|
3939
3968
|
};
|
|
3940
3969
|
if (kindPlan.includeMeta) {
|
|
3941
|
-
projectedEdge["meta"] =
|
|
3970
|
+
projectedEdge["meta"] = chunkUVMSWO6X_cjs.rowToEdgeMeta(row);
|
|
3942
3971
|
}
|
|
3943
3972
|
applyProjectedFields(projectedEdge, row, kindPlan);
|
|
3944
3973
|
return projectedEdge;
|
|
@@ -4264,7 +4293,7 @@ function hasIdEqualityPredicate(expression, alias) {
|
|
|
4264
4293
|
}
|
|
4265
4294
|
}
|
|
4266
4295
|
function isStartAliasBoundToSingleId(ast, predicateIndex) {
|
|
4267
|
-
return
|
|
4296
|
+
return chunkCYKHSH5O_cjs.getPredicatesForAlias(predicateIndex, ast.start.alias, "node").some(
|
|
4268
4297
|
(predicate) => hasIdEqualityPredicate(predicate.expression, ast.start.alias)
|
|
4269
4298
|
);
|
|
4270
4299
|
}
|
|
@@ -4348,7 +4377,7 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
|
|
|
4348
4377
|
fulltextPredicate: void 0,
|
|
4349
4378
|
fusion: void 0,
|
|
4350
4379
|
logicalPlan: void 0,
|
|
4351
|
-
predicateIndex:
|
|
4380
|
+
predicateIndex: chunkCYKHSH5O_cjs.buildPredicateIndex(ast),
|
|
4352
4381
|
requiredColumnsByAlias: void 0,
|
|
4353
4382
|
shouldCollapseSelectiveTraversalRowset: false,
|
|
4354
4383
|
temporalFilterPass: void 0,
|
|
@@ -4513,12 +4542,12 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
|
|
|
4513
4542
|
}
|
|
4514
4543
|
|
|
4515
4544
|
// src/query/compiler/index.ts
|
|
4516
|
-
var COMPILER_DEFAULT_RECURSIVE_TRAVERSAL =
|
|
4545
|
+
var COMPILER_DEFAULT_RECURSIVE_TRAVERSAL = chunkZXXGMQC3_cjs.assumeRecursiveTraversalSupported("compileQuery called without a backend");
|
|
4517
4546
|
function compileQuery(ast, graphId, options = "sqlite") {
|
|
4518
4547
|
const options_ = typeof options === "string" ? { dialect: options } : options;
|
|
4519
4548
|
const dialect = options_.dialect ?? "sqlite";
|
|
4520
|
-
const baseSchema = options_.schema === void 0 ?
|
|
4521
|
-
const schema =
|
|
4549
|
+
const baseSchema = options_.schema === void 0 ? chunkJ34FSPSC_cjs.DEFAULT_SQL_SCHEMA : chunkJ34FSPSC_cjs.requireSqlSchema(options_.schema, "compileQuery schema");
|
|
4550
|
+
const schema = chunkJ34FSPSC_cjs.recordedReadSchemaFor(
|
|
4522
4551
|
baseSchema,
|
|
4523
4552
|
ast.recordedAsOf,
|
|
4524
4553
|
options_.recordedReadBinding,
|
|
@@ -4591,7 +4620,7 @@ function compileSetOperation2(op, graphId, options = "sqlite") {
|
|
|
4591
4620
|
}
|
|
4592
4621
|
return compiled;
|
|
4593
4622
|
};
|
|
4594
|
-
const combined =
|
|
4623
|
+
const combined = chunkCYKHSH5O_cjs.withPinnedReadInstant(
|
|
4595
4624
|
() => compileSetOperation(op, graphId, adapter, compileOperand, options_.vectorStrategy)
|
|
4596
4625
|
);
|
|
4597
4626
|
if (annIndexTypes.size > 0) {
|
|
@@ -4740,7 +4769,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4740
4769
|
const nodeCountDistinctColumn = `${traversal.nodeAlias}_count_distinct`;
|
|
4741
4770
|
const edgeCountColumn = `${traversal.edgeAlias}_count`;
|
|
4742
4771
|
const edgeCountDistinctColumn = `${traversal.edgeAlias}_count_distinct`;
|
|
4743
|
-
const previousNodeKinds =
|
|
4772
|
+
const previousNodeKinds = chunkCYKHSH5O_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
4744
4773
|
const edgeKinds = [...new Set(traversal.edgeKinds)];
|
|
4745
4774
|
const nodeKinds = traversal.nodeKinds;
|
|
4746
4775
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
@@ -4749,16 +4778,16 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4749
4778
|
...ctx,
|
|
4750
4779
|
cteColumnPrefix: "n"
|
|
4751
4780
|
};
|
|
4752
|
-
const nodePredicateClauses =
|
|
4753
|
-
|
|
4781
|
+
const nodePredicateClauses = chunkCYKHSH5O_cjs.compilePredicateClauses(
|
|
4782
|
+
chunkCYKHSH5O_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
4754
4783
|
nodePredicateContext
|
|
4755
4784
|
);
|
|
4756
4785
|
const edgePredicateContext = {
|
|
4757
4786
|
...ctx,
|
|
4758
4787
|
cteColumnPrefix: "e"
|
|
4759
4788
|
};
|
|
4760
|
-
const edgePredicateClauses =
|
|
4761
|
-
|
|
4789
|
+
const edgePredicateClauses = chunkCYKHSH5O_cjs.compilePredicateClauses(
|
|
4790
|
+
chunkCYKHSH5O_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
4762
4791
|
edgePredicateContext
|
|
4763
4792
|
);
|
|
4764
4793
|
const joinField = traversal.direction === "out" ? "from_id" : "to_id";
|
|
@@ -4770,14 +4799,14 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4770
4799
|
const useInnerJoin = hasNodePredicates;
|
|
4771
4800
|
const whereClauses = [
|
|
4772
4801
|
chunkAYQBEVQY_cjs.sql`e.graph_id = ${graphId}`,
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4802
|
+
chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("e.kind"), edgeKinds),
|
|
4803
|
+
chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw(`e.${joinKindField}`), previousNodeKinds),
|
|
4804
|
+
chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw(`e.${targetKindField}`), nodeKinds),
|
|
4776
4805
|
edgeTemporalFilter,
|
|
4777
4806
|
...edgePredicateClauses,
|
|
4778
4807
|
// INNER JOIN mode: node-side filters in WHERE constrain every aggregate.
|
|
4779
4808
|
...requiresNodeJoin && useInnerJoin ? [
|
|
4780
|
-
|
|
4809
|
+
chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4781
4810
|
nodeTemporalFilter,
|
|
4782
4811
|
...nodePredicateClauses
|
|
4783
4812
|
] : []
|
|
@@ -4793,7 +4822,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4793
4822
|
chunkAYQBEVQY_cjs.sql`n.graph_id = e.graph_id`,
|
|
4794
4823
|
chunkAYQBEVQY_cjs.sql`n.id = e.${chunkAYQBEVQY_cjs.sql.raw(targetField)}`,
|
|
4795
4824
|
chunkAYQBEVQY_cjs.sql`n.kind = e.${chunkAYQBEVQY_cjs.sql.raw(targetKindField)}`,
|
|
4796
|
-
|
|
4825
|
+
chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4797
4826
|
nodeTemporalFilter
|
|
4798
4827
|
] : [];
|
|
4799
4828
|
const aggregateColumns = [];
|
|
@@ -4853,7 +4882,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4853
4882
|
ast.projection.fields.map((projectedField) => {
|
|
4854
4883
|
const source = projectedField.source;
|
|
4855
4884
|
if (!isAggregateExpr(source)) {
|
|
4856
|
-
const value =
|
|
4885
|
+
const value = chunkCYKHSH5O_cjs.compileFieldValue(
|
|
4857
4886
|
source,
|
|
4858
4887
|
dialect,
|
|
4859
4888
|
source.valueType,
|
|
@@ -5193,7 +5222,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
5193
5222
|
traversalLimit: traversalCteLimit
|
|
5194
5223
|
});
|
|
5195
5224
|
if (vectorPredicate) {
|
|
5196
|
-
const nodeKinds =
|
|
5225
|
+
const nodeKinds = chunkCYKHSH5O_cjs.getNodeKindsForAlias(ast, vectorPredicate.field.alias);
|
|
5197
5226
|
ctes.push(
|
|
5198
5227
|
buildStandardEmbeddingsCte({
|
|
5199
5228
|
ctx,
|
|
@@ -5204,7 +5233,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
5204
5233
|
);
|
|
5205
5234
|
}
|
|
5206
5235
|
if (fulltextPredicate) {
|
|
5207
|
-
const nodeKinds =
|
|
5236
|
+
const nodeKinds = chunkCYKHSH5O_cjs.getNodeKindsForAlias(ast, fulltextPredicate.field.alias);
|
|
5208
5237
|
ctes.push(
|
|
5209
5238
|
buildStandardFulltextCte({
|
|
5210
5239
|
ctx,
|
|
@@ -5214,7 +5243,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
5214
5243
|
})
|
|
5215
5244
|
);
|
|
5216
5245
|
}
|
|
5217
|
-
if (
|
|
5246
|
+
if (chunkCYKHSH5O_cjs.getHybridTargetAlias(vectorPredicate, fulltextPredicate) !== void 0) {
|
|
5218
5247
|
ctes.push(buildStandardHybridCandidateCte());
|
|
5219
5248
|
}
|
|
5220
5249
|
const projection = buildStandardProjection({
|
|
@@ -5316,23 +5345,23 @@ function buildSelectableNode(row, alias) {
|
|
|
5316
5345
|
const propsRaw = row[`${alias}_props`];
|
|
5317
5346
|
const rawProps = typeof propsRaw === "string" ? JSON.parse(propsRaw) : propsRaw ?? {};
|
|
5318
5347
|
const version = row[`${alias}_version`];
|
|
5319
|
-
const validFrom =
|
|
5348
|
+
const validFrom = chunkBYUIOM4L_cjs.normalizeRowTimestamp(
|
|
5320
5349
|
row[`${alias}_valid_from`],
|
|
5321
5350
|
`${alias}_valid_from`
|
|
5322
5351
|
);
|
|
5323
|
-
const validTo =
|
|
5352
|
+
const validTo = chunkBYUIOM4L_cjs.normalizeRowTimestamp(
|
|
5324
5353
|
row[`${alias}_valid_to`],
|
|
5325
5354
|
`${alias}_valid_to`
|
|
5326
5355
|
);
|
|
5327
|
-
const createdAt =
|
|
5356
|
+
const createdAt = chunkBYUIOM4L_cjs.normalizeRequiredRowTimestamp(
|
|
5328
5357
|
row[`${alias}_created_at`],
|
|
5329
5358
|
`${alias}_created_at`
|
|
5330
5359
|
);
|
|
5331
|
-
const updatedAt =
|
|
5360
|
+
const updatedAt = chunkBYUIOM4L_cjs.normalizeRequiredRowTimestamp(
|
|
5332
5361
|
row[`${alias}_updated_at`],
|
|
5333
5362
|
`${alias}_updated_at`
|
|
5334
5363
|
);
|
|
5335
|
-
const deletedAt =
|
|
5364
|
+
const deletedAt = chunkBYUIOM4L_cjs.normalizeRowTimestamp(
|
|
5336
5365
|
row[`${alias}_deleted_at`],
|
|
5337
5366
|
`${alias}_deleted_at`
|
|
5338
5367
|
);
|
|
@@ -5368,23 +5397,23 @@ function buildSelectableEdge(row, alias) {
|
|
|
5368
5397
|
const toId = row[`${alias}_to_id`];
|
|
5369
5398
|
const propsRaw = row[`${alias}_props`];
|
|
5370
5399
|
const rawProps = typeof propsRaw === "string" ? JSON.parse(propsRaw) : propsRaw ?? {};
|
|
5371
|
-
const validFrom =
|
|
5400
|
+
const validFrom = chunkBYUIOM4L_cjs.normalizeRowTimestamp(
|
|
5372
5401
|
row[`${alias}_valid_from`],
|
|
5373
5402
|
`${alias}_valid_from`
|
|
5374
5403
|
);
|
|
5375
|
-
const validTo =
|
|
5404
|
+
const validTo = chunkBYUIOM4L_cjs.normalizeRowTimestamp(
|
|
5376
5405
|
row[`${alias}_valid_to`],
|
|
5377
5406
|
`${alias}_valid_to`
|
|
5378
5407
|
);
|
|
5379
|
-
const createdAt =
|
|
5408
|
+
const createdAt = chunkBYUIOM4L_cjs.normalizeRequiredRowTimestamp(
|
|
5380
5409
|
row[`${alias}_created_at`],
|
|
5381
5410
|
`${alias}_created_at`
|
|
5382
5411
|
);
|
|
5383
|
-
const updatedAt =
|
|
5412
|
+
const updatedAt = chunkBYUIOM4L_cjs.normalizeRequiredRowTimestamp(
|
|
5384
5413
|
row[`${alias}_updated_at`],
|
|
5385
5414
|
`${alias}_updated_at`
|
|
5386
5415
|
);
|
|
5387
|
-
const deletedAt =
|
|
5416
|
+
const deletedAt = chunkBYUIOM4L_cjs.normalizeRowTimestamp(
|
|
5388
5417
|
row[`${alias}_deleted_at`],
|
|
5389
5418
|
`${alias}_deleted_at`
|
|
5390
5419
|
);
|
|
@@ -5960,9 +5989,9 @@ function normalizeMetaValue(value, metaKey, alias) {
|
|
|
5960
5989
|
if (metaKey === "version") return nullToUndefined(value);
|
|
5961
5990
|
const field2 = `${alias}_${metaKey}`;
|
|
5962
5991
|
if (metaKey === "createdAt" || metaKey === "updatedAt") {
|
|
5963
|
-
return
|
|
5992
|
+
return chunkBYUIOM4L_cjs.normalizeRequiredRowTimestamp(value, field2);
|
|
5964
5993
|
}
|
|
5965
|
-
return
|
|
5994
|
+
return chunkBYUIOM4L_cjs.normalizeRowTimestamp(value, field2);
|
|
5966
5995
|
}
|
|
5967
5996
|
var SELECTABLE_ALIAS_MARKER = /* @__PURE__ */ Symbol("selectable_alias_marker");
|
|
5968
5997
|
function isSelectableAliasObject(value) {
|
|
@@ -6169,7 +6198,7 @@ function createGuardedProxy(target, debugPath) {
|
|
|
6169
6198
|
// src/query/builder/read-instant-template.ts
|
|
6170
6199
|
function templateHasReadInstant(template) {
|
|
6171
6200
|
return template.params.some(
|
|
6172
|
-
(parameter) => chunkAYQBEVQY_cjs.isSqlPlaceholder(parameter) && parameter.name ===
|
|
6201
|
+
(parameter) => chunkAYQBEVQY_cjs.isSqlPlaceholder(parameter) && parameter.name === chunkCYKHSH5O_cjs.CURRENT_READ_INSTANT_PLACEHOLDER
|
|
6173
6202
|
);
|
|
6174
6203
|
}
|
|
6175
6204
|
function queryAstNeedsCurrentReadInstant(ast) {
|
|
@@ -6208,7 +6237,7 @@ function fillTemplateParams(params, bindings, dialect, listParameters = EMPTY_LI
|
|
|
6208
6237
|
return params.map((parameter) => {
|
|
6209
6238
|
if (!chunkAYQBEVQY_cjs.isSqlPlaceholder(parameter)) return parameter;
|
|
6210
6239
|
const name = parameter.name;
|
|
6211
|
-
if (name ===
|
|
6240
|
+
if (name === chunkCYKHSH5O_cjs.CURRENT_READ_INSTANT_PLACEHOLDER) {
|
|
6212
6241
|
readInstant ??= chunkNI2XPJQ2_cjs.nowIso();
|
|
6213
6242
|
return readInstant;
|
|
6214
6243
|
}
|
|
@@ -6268,7 +6297,7 @@ function toLiteralList(parameterName, value) {
|
|
|
6268
6297
|
function substitutePredicateExpression(expr, bindings) {
|
|
6269
6298
|
switch (expr.__type) {
|
|
6270
6299
|
case "comparison": {
|
|
6271
|
-
if (
|
|
6300
|
+
if (chunkCYKHSH5O_cjs.isParameterRef(expr.right)) {
|
|
6272
6301
|
const value = resolveBinding(bindings, expr.right.name);
|
|
6273
6302
|
return {
|
|
6274
6303
|
...expr,
|
|
@@ -6278,7 +6307,7 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
6278
6307
|
return expr;
|
|
6279
6308
|
}
|
|
6280
6309
|
case "string_op": {
|
|
6281
|
-
if (
|
|
6310
|
+
if (chunkCYKHSH5O_cjs.isParameterRef(expr.pattern)) {
|
|
6282
6311
|
const value = chunkBXHAPCQG_cjs.readOwnProperty(bindings, expr.pattern.name);
|
|
6283
6312
|
if (value === void 0) {
|
|
6284
6313
|
throw new chunkASKXTVK5_cjs.ConfigurationError(
|
|
@@ -6300,8 +6329,8 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
6300
6329
|
return expr;
|
|
6301
6330
|
}
|
|
6302
6331
|
case "between": {
|
|
6303
|
-
const lowerIsParam =
|
|
6304
|
-
const upperIsParam =
|
|
6332
|
+
const lowerIsParam = chunkCYKHSH5O_cjs.isParameterRef(expr.lower);
|
|
6333
|
+
const upperIsParam = chunkCYKHSH5O_cjs.isParameterRef(expr.upper);
|
|
6305
6334
|
if (!lowerIsParam && !upperIsParam) return expr;
|
|
6306
6335
|
const lower = lowerIsParam ? toLiteral(resolveBinding(bindings, expr.lower.name)) : expr.lower;
|
|
6307
6336
|
const upper = upperIsParam ? toLiteral(resolveBinding(bindings, expr.upper.name)) : expr.upper;
|
|
@@ -6571,14 +6600,14 @@ function collectParameterMetadataFromAst(ast, accumulator) {
|
|
|
6571
6600
|
function collectParameterMetadataFromExpression(expression, accumulator) {
|
|
6572
6601
|
switch (expression.__type) {
|
|
6573
6602
|
case "comparison": {
|
|
6574
|
-
if (
|
|
6603
|
+
if (chunkCYKHSH5O_cjs.isParameterRef(expression.right)) {
|
|
6575
6604
|
const name = expression.right.name;
|
|
6576
6605
|
accumulator.names.add(name);
|
|
6577
6606
|
if (isListComparisonOp(expression.op)) {
|
|
6578
6607
|
recordListElementType(
|
|
6579
6608
|
accumulator,
|
|
6580
6609
|
name,
|
|
6581
|
-
|
|
6610
|
+
chunkCYKHSH5O_cjs.resolveParameterValueType(expression.left, expression.right)
|
|
6582
6611
|
);
|
|
6583
6612
|
} else {
|
|
6584
6613
|
accumulator.scalarParameters.add(name);
|
|
@@ -6587,7 +6616,7 @@ function collectParameterMetadataFromExpression(expression, accumulator) {
|
|
|
6587
6616
|
return;
|
|
6588
6617
|
}
|
|
6589
6618
|
case "string_op": {
|
|
6590
|
-
if (
|
|
6619
|
+
if (chunkCYKHSH5O_cjs.isParameterRef(expression.pattern)) {
|
|
6591
6620
|
accumulator.names.add(expression.pattern.name);
|
|
6592
6621
|
accumulator.scalarParameters.add(expression.pattern.name);
|
|
6593
6622
|
accumulator.stringOpParameters.add(expression.pattern.name);
|
|
@@ -6596,7 +6625,7 @@ function collectParameterMetadataFromExpression(expression, accumulator) {
|
|
|
6596
6625
|
}
|
|
6597
6626
|
case "between": {
|
|
6598
6627
|
for (const bound of [expression.lower, expression.upper]) {
|
|
6599
|
-
if (
|
|
6628
|
+
if (chunkCYKHSH5O_cjs.isParameterRef(bound)) {
|
|
6600
6629
|
accumulator.names.add(bound.name);
|
|
6601
6630
|
accumulator.scalarParameters.add(bound.name);
|
|
6602
6631
|
}
|
|
@@ -7044,7 +7073,7 @@ function buildCompileOptions(config) {
|
|
|
7044
7073
|
dialect: config.dialect ?? "sqlite",
|
|
7045
7074
|
schema: config.schema,
|
|
7046
7075
|
windowFunctions: config.backend?.capabilities.windowFunctions ?? true,
|
|
7047
|
-
recursiveTraversal: config.backend === void 0 ? COMPILER_DEFAULT_RECURSIVE_TRAVERSAL :
|
|
7076
|
+
recursiveTraversal: config.backend === void 0 ? COMPILER_DEFAULT_RECURSIVE_TRAVERSAL : chunkZXXGMQC3_cjs.resolveRecursiveTraversal(config.backend.capabilities),
|
|
7048
7077
|
identitySameIdAcrossKinds: config.identitySameIdAcrossKinds,
|
|
7049
7078
|
...fulltextStrategy === void 0 ? {} : {
|
|
7050
7079
|
fulltextStrategy,
|
|
@@ -7073,7 +7102,7 @@ function buildVectorSlots(registry) {
|
|
|
7073
7102
|
const slots = /* @__PURE__ */ new Map();
|
|
7074
7103
|
for (const [nodeKind, nodeType] of registry.nodeKinds) {
|
|
7075
7104
|
for (const field2 of chunkHAHNRASW_cjs.resolveEmbeddingFields(nodeType.schema)) {
|
|
7076
|
-
slots.set(
|
|
7105
|
+
slots.set(chunkJ34FSPSC_cjs.vectorSlotKey(nodeKind, field2.fieldPath), {
|
|
7077
7106
|
dimensions: field2.dimensions,
|
|
7078
7107
|
metric: field2.metric,
|
|
7079
7108
|
indexType: field2.indexType
|
|
@@ -7110,11 +7139,11 @@ function resolveSystemOrderField(alias, field2, isEdge, hasDeclaredProperty) {
|
|
|
7110
7139
|
return void 0;
|
|
7111
7140
|
}
|
|
7112
7141
|
const valueType = COMMON_SYSTEM_ORDER_FIELDS.get(field2) ?? (isEdge ? EDGE_SYSTEM_ORDER_FIELDS.get(field2) : void 0);
|
|
7113
|
-
return valueType === void 0 ? void 0 :
|
|
7142
|
+
return valueType === void 0 ? void 0 : chunkCYKHSH5O_cjs.fieldRef(alias, [field2], { valueType });
|
|
7114
7143
|
}
|
|
7115
7144
|
function buildOrderSpec(alias, field2, direction, systemField, typeInfo) {
|
|
7116
7145
|
return {
|
|
7117
|
-
field: systemField ??
|
|
7146
|
+
field: systemField ?? chunkCYKHSH5O_cjs.fieldRef(alias, ["props"], {
|
|
7118
7147
|
jsonPointer: chunkOZ3ZU7Q2_cjs.jsonPointer([field2]),
|
|
7119
7148
|
valueType: typeInfo?.valueType,
|
|
7120
7149
|
elementType: typeInfo?.elementType
|
|
@@ -8361,12 +8390,12 @@ function createDynamicFieldBuilder(introspector, alias, name, kindNames, entity)
|
|
|
8361
8390
|
if (typeInfo === void 0) {
|
|
8362
8391
|
throw new Error(`Property "${name}" is not declared on ${where}.`);
|
|
8363
8392
|
}
|
|
8364
|
-
const ref =
|
|
8393
|
+
const ref = chunkCYKHSH5O_cjs.fieldRef(alias, ["props"], {
|
|
8365
8394
|
jsonPointer: chunkOZ3ZU7Q2_cjs.jsonPointer([name]),
|
|
8366
8395
|
valueType: typeInfo.valueType,
|
|
8367
8396
|
elementType: typeInfo.elementType
|
|
8368
8397
|
});
|
|
8369
|
-
const base =
|
|
8398
|
+
const base = chunkCYKHSH5O_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
8370
8399
|
const expect = (asserted) => {
|
|
8371
8400
|
if (typeInfo.valueType !== asserted) {
|
|
8372
8401
|
throw new TypeError(
|
|
@@ -8540,17 +8569,17 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8540
8569
|
(kind) => !this.#edgeKinds.includes(kind)
|
|
8541
8570
|
)
|
|
8542
8571
|
];
|
|
8543
|
-
const idAccessor =
|
|
8544
|
-
|
|
8572
|
+
const idAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
8573
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8545
8574
|
);
|
|
8546
|
-
const kindAccessor =
|
|
8547
|
-
|
|
8575
|
+
const kindAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
8576
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8548
8577
|
);
|
|
8549
|
-
const fromIdAccessor =
|
|
8550
|
-
|
|
8578
|
+
const fromIdAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
8579
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
8551
8580
|
);
|
|
8552
|
-
const toIdAccessor =
|
|
8553
|
-
|
|
8581
|
+
const toIdAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
8582
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
8554
8583
|
);
|
|
8555
8584
|
const buildFieldAccessor = (propertyName) => {
|
|
8556
8585
|
const typeInfo = this.#config.schemaIntrospector.getSharedEdgeFieldTypeInfo(
|
|
@@ -8559,34 +8588,34 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8559
8588
|
);
|
|
8560
8589
|
const valueType = typeInfo?.valueType;
|
|
8561
8590
|
const elementType = typeInfo?.elementType;
|
|
8562
|
-
const ref =
|
|
8591
|
+
const ref = chunkCYKHSH5O_cjs.fieldRef(alias, ["props"], {
|
|
8563
8592
|
jsonPointer: chunkOZ3ZU7Q2_cjs.jsonPointer([propertyName]),
|
|
8564
8593
|
valueType,
|
|
8565
8594
|
elementType
|
|
8566
8595
|
});
|
|
8567
8596
|
switch (valueType) {
|
|
8568
8597
|
case "string": {
|
|
8569
|
-
return
|
|
8598
|
+
return chunkCYKHSH5O_cjs.stringField(ref);
|
|
8570
8599
|
}
|
|
8571
8600
|
case "number": {
|
|
8572
|
-
return
|
|
8601
|
+
return chunkCYKHSH5O_cjs.numberField(ref);
|
|
8573
8602
|
}
|
|
8574
8603
|
case "boolean": {
|
|
8575
|
-
return
|
|
8604
|
+
return chunkCYKHSH5O_cjs.baseField(ref);
|
|
8576
8605
|
}
|
|
8577
8606
|
case "date": {
|
|
8578
|
-
return
|
|
8607
|
+
return chunkCYKHSH5O_cjs.dateField(ref);
|
|
8579
8608
|
}
|
|
8580
8609
|
case "array": {
|
|
8581
|
-
return
|
|
8610
|
+
return chunkCYKHSH5O_cjs.arrayField(ref);
|
|
8582
8611
|
}
|
|
8583
8612
|
case "object": {
|
|
8584
|
-
return
|
|
8613
|
+
return chunkCYKHSH5O_cjs.objectField(ref);
|
|
8585
8614
|
}
|
|
8586
8615
|
case "embedding":
|
|
8587
8616
|
case "unknown":
|
|
8588
8617
|
case void 0: {
|
|
8589
|
-
return
|
|
8618
|
+
return chunkCYKHSH5O_cjs.baseField(ref);
|
|
8590
8619
|
}
|
|
8591
8620
|
}
|
|
8592
8621
|
};
|
|
@@ -8751,39 +8780,39 @@ function buildNodeFields(alias) {
|
|
|
8751
8780
|
return [
|
|
8752
8781
|
{
|
|
8753
8782
|
outputName: `${alias}_id`,
|
|
8754
|
-
source:
|
|
8783
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["id"])
|
|
8755
8784
|
},
|
|
8756
8785
|
{
|
|
8757
8786
|
outputName: `${alias}_kind`,
|
|
8758
|
-
source:
|
|
8787
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["kind"])
|
|
8759
8788
|
},
|
|
8760
8789
|
{
|
|
8761
8790
|
outputName: `${alias}_props`,
|
|
8762
|
-
source:
|
|
8791
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["props"])
|
|
8763
8792
|
},
|
|
8764
8793
|
{
|
|
8765
8794
|
outputName: `${alias}_version`,
|
|
8766
|
-
source:
|
|
8795
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["version"])
|
|
8767
8796
|
},
|
|
8768
8797
|
{
|
|
8769
8798
|
outputName: `${alias}_valid_from`,
|
|
8770
|
-
source:
|
|
8799
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["valid_from"])
|
|
8771
8800
|
},
|
|
8772
8801
|
{
|
|
8773
8802
|
outputName: `${alias}_valid_to`,
|
|
8774
|
-
source:
|
|
8803
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["valid_to"])
|
|
8775
8804
|
},
|
|
8776
8805
|
{
|
|
8777
8806
|
outputName: `${alias}_created_at`,
|
|
8778
|
-
source:
|
|
8807
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["created_at"])
|
|
8779
8808
|
},
|
|
8780
8809
|
{
|
|
8781
8810
|
outputName: `${alias}_updated_at`,
|
|
8782
|
-
source:
|
|
8811
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["updated_at"])
|
|
8783
8812
|
},
|
|
8784
8813
|
{
|
|
8785
8814
|
outputName: `${alias}_deleted_at`,
|
|
8786
|
-
source:
|
|
8815
|
+
source: chunkCYKHSH5O_cjs.fieldRef(alias, ["deleted_at"])
|
|
8787
8816
|
}
|
|
8788
8817
|
];
|
|
8789
8818
|
}
|
|
@@ -8792,52 +8821,52 @@ function buildEdgeFields(edgeAlias, nodeCteAlias) {
|
|
|
8792
8821
|
return [
|
|
8793
8822
|
{
|
|
8794
8823
|
outputName: `${edgeAlias}_id`,
|
|
8795
|
-
source:
|
|
8824
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["id"]),
|
|
8796
8825
|
cteAlias
|
|
8797
8826
|
},
|
|
8798
8827
|
{
|
|
8799
8828
|
outputName: `${edgeAlias}_kind`,
|
|
8800
|
-
source:
|
|
8829
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["kind"]),
|
|
8801
8830
|
cteAlias
|
|
8802
8831
|
},
|
|
8803
8832
|
{
|
|
8804
8833
|
outputName: `${edgeAlias}_from_id`,
|
|
8805
|
-
source:
|
|
8834
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["from_id"]),
|
|
8806
8835
|
cteAlias
|
|
8807
8836
|
},
|
|
8808
8837
|
{
|
|
8809
8838
|
outputName: `${edgeAlias}_to_id`,
|
|
8810
|
-
source:
|
|
8839
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["to_id"]),
|
|
8811
8840
|
cteAlias
|
|
8812
8841
|
},
|
|
8813
8842
|
{
|
|
8814
8843
|
outputName: `${edgeAlias}_props`,
|
|
8815
|
-
source:
|
|
8844
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["props"]),
|
|
8816
8845
|
cteAlias
|
|
8817
8846
|
},
|
|
8818
8847
|
{
|
|
8819
8848
|
outputName: `${edgeAlias}_valid_from`,
|
|
8820
|
-
source:
|
|
8849
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["valid_from"]),
|
|
8821
8850
|
cteAlias
|
|
8822
8851
|
},
|
|
8823
8852
|
{
|
|
8824
8853
|
outputName: `${edgeAlias}_valid_to`,
|
|
8825
|
-
source:
|
|
8854
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["valid_to"]),
|
|
8826
8855
|
cteAlias
|
|
8827
8856
|
},
|
|
8828
8857
|
{
|
|
8829
8858
|
outputName: `${edgeAlias}_created_at`,
|
|
8830
|
-
source:
|
|
8859
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["created_at"]),
|
|
8831
8860
|
cteAlias
|
|
8832
8861
|
},
|
|
8833
8862
|
{
|
|
8834
8863
|
outputName: `${edgeAlias}_updated_at`,
|
|
8835
|
-
source:
|
|
8864
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["updated_at"]),
|
|
8836
8865
|
cteAlias
|
|
8837
8866
|
},
|
|
8838
8867
|
{
|
|
8839
8868
|
outputName: `${edgeAlias}_deleted_at`,
|
|
8840
|
-
source:
|
|
8869
|
+
source: chunkCYKHSH5O_cjs.fieldRef(edgeAlias, ["deleted_at"]),
|
|
8841
8870
|
cteAlias
|
|
8842
8871
|
}
|
|
8843
8872
|
];
|
|
@@ -9365,7 +9394,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9365
9394
|
kindNames,
|
|
9366
9395
|
property
|
|
9367
9396
|
) : void 0;
|
|
9368
|
-
const ref =
|
|
9397
|
+
const ref = chunkCYKHSH5O_cjs.fieldRef(alias, ["props"], {
|
|
9369
9398
|
jsonPointer: chunkOZ3ZU7Q2_cjs.jsonPointer([property]),
|
|
9370
9399
|
valueType: typeInfo?.valueType,
|
|
9371
9400
|
elementType: typeInfo?.elementType
|
|
@@ -9373,17 +9402,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9373
9402
|
return this.#buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
9374
9403
|
}
|
|
9375
9404
|
#buildFieldBuilderForTypeInfo(ref, typeInfo) {
|
|
9376
|
-
return
|
|
9405
|
+
return chunkCYKHSH5O_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
9377
9406
|
}
|
|
9378
9407
|
#createNodeAccessor(alias) {
|
|
9379
9408
|
const kindNames = this.#getKindNamesForAlias(alias);
|
|
9380
|
-
const idAccessor =
|
|
9381
|
-
|
|
9409
|
+
const idAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
9410
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
9382
9411
|
);
|
|
9383
|
-
const kindAccessor =
|
|
9384
|
-
|
|
9412
|
+
const kindAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
9413
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
9385
9414
|
);
|
|
9386
|
-
const fulltextAccessor =
|
|
9415
|
+
const fulltextAccessor = chunkCYKHSH5O_cjs.createFulltextAccessor(
|
|
9387
9416
|
alias,
|
|
9388
9417
|
() => this.#hasSearchableField(kindNames)
|
|
9389
9418
|
);
|
|
@@ -9477,7 +9506,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9477
9506
|
edgeKindNames,
|
|
9478
9507
|
property
|
|
9479
9508
|
) : void 0;
|
|
9480
|
-
const ref =
|
|
9509
|
+
const ref = chunkCYKHSH5O_cjs.fieldRef(alias, ["props"], {
|
|
9481
9510
|
jsonPointer: chunkOZ3ZU7Q2_cjs.jsonPointer([property]),
|
|
9482
9511
|
valueType: typeInfo?.valueType,
|
|
9483
9512
|
elementType: typeInfo?.elementType
|
|
@@ -9486,17 +9515,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
9486
9515
|
}
|
|
9487
9516
|
#createEdgeAccessor(alias) {
|
|
9488
9517
|
const edgeKindNames = this.#getEdgeKindNamesForAlias(alias);
|
|
9489
|
-
const idAccessor =
|
|
9490
|
-
|
|
9518
|
+
const idAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
9519
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
9491
9520
|
);
|
|
9492
|
-
const kindAccessor =
|
|
9493
|
-
|
|
9521
|
+
const kindAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
9522
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
9494
9523
|
);
|
|
9495
|
-
const fromIdAccessor =
|
|
9496
|
-
|
|
9524
|
+
const fromIdAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
9525
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
9497
9526
|
);
|
|
9498
|
-
const toIdAccessor =
|
|
9499
|
-
|
|
9527
|
+
const toIdAccessor = chunkCYKHSH5O_cjs.stringField(
|
|
9528
|
+
chunkCYKHSH5O_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
9500
9529
|
);
|
|
9501
9530
|
if (this.#state.dynamicEdgeAliases.has(alias)) {
|
|
9502
9531
|
return {
|
|
@@ -10085,7 +10114,7 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
|
|
|
10085
10114
|
return runFulltextRebuild(
|
|
10086
10115
|
{
|
|
10087
10116
|
read: backend,
|
|
10088
|
-
runPage: (write) =>
|
|
10117
|
+
runPage: (write) => chunkJ34FSPSC_cjs.runOptionallyInTransaction(backend, write)
|
|
10089
10118
|
},
|
|
10090
10119
|
ctx,
|
|
10091
10120
|
nodeKind,
|
|
@@ -10214,7 +10243,7 @@ function processPage(schema, rows) {
|
|
|
10214
10243
|
}
|
|
10215
10244
|
let parsed;
|
|
10216
10245
|
try {
|
|
10217
|
-
parsed =
|
|
10246
|
+
parsed = chunkJ34FSPSC_cjs.rowPropsToObject(row.props);
|
|
10218
10247
|
} catch {
|
|
10219
10248
|
skipped += 1;
|
|
10220
10249
|
skippedIds.push(row.id);
|
|
@@ -10225,7 +10254,7 @@ function processPage(schema, rows) {
|
|
|
10225
10254
|
skippedIds.push(row.id);
|
|
10226
10255
|
continue;
|
|
10227
10256
|
}
|
|
10228
|
-
const computed =
|
|
10257
|
+
const computed = chunkUZ6CJUC5_cjs.computeFulltextContent(schema, parsed);
|
|
10229
10258
|
if (computed === void 0) {
|
|
10230
10259
|
toDelete.push(row.id);
|
|
10231
10260
|
} else {
|
|
@@ -10312,7 +10341,7 @@ async function fetchNodesForRows(backend, batchPointRead, graphId, rows) {
|
|
|
10312
10341
|
function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
|
|
10313
10342
|
const nodeType = ctx.registry.getNodeType(nodeKind);
|
|
10314
10343
|
if (nodeType === void 0) return void 0;
|
|
10315
|
-
const fields =
|
|
10344
|
+
const fields = chunkUZ6CJUC5_cjs.getEmbeddingFields(nodeType.schema);
|
|
10316
10345
|
const field2 = fields.find((entry2) => entry2.fieldPath === fieldPath);
|
|
10317
10346
|
if (field2 === void 0) return void 0;
|
|
10318
10347
|
return {
|
|
@@ -10632,7 +10661,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
|
|
|
10632
10661
|
...candidates === void 0 ? {} : { candidates }
|
|
10633
10662
|
});
|
|
10634
10663
|
return rows.map((row, index) => {
|
|
10635
|
-
const typedNode =
|
|
10664
|
+
const typedNode = chunkUVMSWO6X_cjs.rowToNode(row.node);
|
|
10636
10665
|
return {
|
|
10637
10666
|
node: typedNode,
|
|
10638
10667
|
score: row.fusedScore,
|
|
@@ -10893,22 +10922,22 @@ function warnIfLanguageNotAdvertised(dialect, capabilities, language) {
|
|
|
10893
10922
|
async function fetchNodesByIds(backend, batchPointRead, graphId, nodeKind, ids) {
|
|
10894
10923
|
if (ids.length === 0) return /* @__PURE__ */ new Map();
|
|
10895
10924
|
const map = /* @__PURE__ */ new Map();
|
|
10896
|
-
const bound =
|
|
10925
|
+
const bound = chunkJ34FSPSC_cjs.bindExtraIfReachable(
|
|
10897
10926
|
backend,
|
|
10898
10927
|
batchPointRead.extras.getNodes,
|
|
10899
|
-
|
|
10928
|
+
chunkJ34FSPSC_cjs.BATCH_POINT_READ.id
|
|
10900
10929
|
);
|
|
10901
10930
|
if (bound !== void 0) {
|
|
10902
10931
|
const rows = await bound.getNodes(graphId, nodeKind, ids);
|
|
10903
10932
|
for (const row of rows) {
|
|
10904
10933
|
if (row.deleted_at !== void 0) continue;
|
|
10905
|
-
map.set(row.id,
|
|
10934
|
+
map.set(row.id, chunkUVMSWO6X_cjs.rowToNode(row));
|
|
10906
10935
|
}
|
|
10907
10936
|
return map;
|
|
10908
10937
|
}
|
|
10909
10938
|
for (const id of ids) {
|
|
10910
10939
|
const row = await backend.getNode(graphId, nodeKind, id);
|
|
10911
|
-
if (row && row.deleted_at === void 0) map.set(row.id,
|
|
10940
|
+
if (row && row.deleted_at === void 0) map.set(row.id, chunkUVMSWO6X_cjs.rowToNode(row));
|
|
10912
10941
|
}
|
|
10913
10942
|
return map;
|
|
10914
10943
|
}
|
|
@@ -10919,7 +10948,7 @@ var StoreSearch = class {
|
|
|
10919
10948
|
constructor(context) {
|
|
10920
10949
|
this.#context = {
|
|
10921
10950
|
...context,
|
|
10922
|
-
batchPointRead: context.batchPointRead ??
|
|
10951
|
+
batchPointRead: context.batchPointRead ?? chunkZXXGMQC3_cjs.batchPointReadVerdict(context.backend)
|
|
10923
10952
|
};
|
|
10924
10953
|
}
|
|
10925
10954
|
/**
|
|
@@ -11189,7 +11218,7 @@ function declaredPathsForEntity(graph, entity) {
|
|
|
11189
11218
|
);
|
|
11190
11219
|
for (const schema of schemas) {
|
|
11191
11220
|
for (const path of declaredPropertyPaths(
|
|
11192
|
-
|
|
11221
|
+
chunkL2REUAJB_cjs.serializeSchemaProperties(schema)
|
|
11193
11222
|
)) {
|
|
11194
11223
|
paths.add(pathToPointer(path));
|
|
11195
11224
|
}
|
|
@@ -11199,7 +11228,7 @@ function declaredPathsForEntity(graph, entity) {
|
|
|
11199
11228
|
function populationSelect(ctx, entity, paths, currentTimestamp) {
|
|
11200
11229
|
const table = entity === "node" ? ctx.schema.nodesTable : ctx.schema.edgesTable;
|
|
11201
11230
|
const dialect = chunkRNI64RB4_cjs.getDialect(ctx.backend.dialect);
|
|
11202
|
-
const temporal =
|
|
11231
|
+
const temporal = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
11203
11232
|
mode: "current",
|
|
11204
11233
|
currentTimestamp: chunkAYQBEVQY_cjs.sql`${currentTimestamp}`
|
|
11205
11234
|
});
|
|
@@ -11254,7 +11283,7 @@ async function readEntityPopulation(ctx, entity, paths, currentTimestamp) {
|
|
|
11254
11283
|
function populationForKind(entity, kind, schema, populations) {
|
|
11255
11284
|
const population = populations.get(kind);
|
|
11256
11285
|
const count2 = population?.count ?? 0;
|
|
11257
|
-
const declaredPaths = declaredPropertyPaths(
|
|
11286
|
+
const declaredPaths = declaredPropertyPaths(chunkL2REUAJB_cjs.serializeSchemaProperties(schema)).map((path) => pathToPointer(path)).toSorted();
|
|
11258
11287
|
return {
|
|
11259
11288
|
entity,
|
|
11260
11289
|
kind,
|
|
@@ -11276,7 +11305,7 @@ function populationForKind(entity, kind, schema, populations) {
|
|
|
11276
11305
|
function zodFailures(entity, kind, schema, rows) {
|
|
11277
11306
|
const failures = [];
|
|
11278
11307
|
for (const row of rows) {
|
|
11279
|
-
const parsed = schema.safeParse(
|
|
11308
|
+
const parsed = schema.safeParse(chunkJ34FSPSC_cjs.rowPropsToObject(row.props));
|
|
11280
11309
|
if (parsed.success) continue;
|
|
11281
11310
|
for (const issue of parsed.error.issues) {
|
|
11282
11311
|
if (issue.code === "unrecognized_keys") continue;
|
|
@@ -11297,7 +11326,7 @@ function zodFailures(entity, kind, schema, rows) {
|
|
|
11297
11326
|
}
|
|
11298
11327
|
async function readValidationRows(ctx, options, afterId, limit) {
|
|
11299
11328
|
const table = options.entity === "node" ? ctx.schema.nodesTable : ctx.schema.edgesTable;
|
|
11300
|
-
const temporal =
|
|
11329
|
+
const temporal = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
11301
11330
|
mode: "current",
|
|
11302
11331
|
currentTimestamp: chunkAYQBEVQY_cjs.sql`${chunkNI2XPJQ2_cjs.nowIso()}`
|
|
11303
11332
|
});
|
|
@@ -11806,7 +11835,7 @@ function resolveTemporalOptions(ctx, options) {
|
|
|
11806
11835
|
};
|
|
11807
11836
|
}
|
|
11808
11837
|
function resolveReadSchema(ctx, options) {
|
|
11809
|
-
return
|
|
11838
|
+
return chunkJ34FSPSC_cjs.recordedReadSchemaFor(
|
|
11810
11839
|
ctx.schema,
|
|
11811
11840
|
options.recordedAsOf,
|
|
11812
11841
|
ctx.recordedReadBinding,
|
|
@@ -11820,9 +11849,9 @@ function resolveTemporalFilter(ctx, options, tableAlias) {
|
|
|
11820
11849
|
asOf: resolved.asOf,
|
|
11821
11850
|
recordedAsOf: resolved.recordedAsOf,
|
|
11822
11851
|
tableAlias,
|
|
11823
|
-
currentTimestamp:
|
|
11852
|
+
currentTimestamp: chunkCYKHSH5O_cjs.currentReadInstant()
|
|
11824
11853
|
};
|
|
11825
|
-
return
|
|
11854
|
+
return chunkCYKHSH5O_cjs.compileTemporalFilter(filterOptions);
|
|
11826
11855
|
}
|
|
11827
11856
|
function resolveMaxHops(rawMaxHops, fallback, optionName) {
|
|
11828
11857
|
const value = rawMaxHops ?? fallback;
|
|
@@ -11898,7 +11927,7 @@ async function executeDegree(ctx, nodeId, options = {}) {
|
|
|
11898
11927
|
compileDirectionFilter(ctx, direction, nodeId, schema.nodesTable)
|
|
11899
11928
|
];
|
|
11900
11929
|
if (options.edges !== void 0) {
|
|
11901
|
-
whereClauses.push(
|
|
11930
|
+
whereClauses.push(chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("kind"), options.edges));
|
|
11902
11931
|
}
|
|
11903
11932
|
const countExpr = direction === "both" ? chunkAYQBEVQY_cjs.sql`COUNT(DISTINCT id)` : chunkAYQBEVQY_cjs.sql`COUNT(*)`;
|
|
11904
11933
|
const query = chunkAYQBEVQY_cjs.sql`SELECT ${countExpr} AS count FROM ${schema.edgesTable} WHERE ${chunkAYQBEVQY_cjs.sql.join(whereClauses, chunkAYQBEVQY_cjs.sql` AND `)}`;
|
|
@@ -11983,7 +12012,7 @@ async function seedWorkingTableFromNodes(context, nodeKinds, seedColumns) {
|
|
|
11983
12012
|
);
|
|
11984
12013
|
for (const kindChunk of chunkValues(normalizedKinds, kindBindBudget)) {
|
|
11985
12014
|
await context.executeTemporary(
|
|
11986
|
-
compileSeedStatement(
|
|
12015
|
+
compileSeedStatement(chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("n.kind"), kindChunk))
|
|
11987
12016
|
);
|
|
11988
12017
|
}
|
|
11989
12018
|
}
|
|
@@ -12046,7 +12075,7 @@ async function runIterativeGraphOperation(ctx, options, plan) {
|
|
|
12046
12075
|
const transactionOptions = {
|
|
12047
12076
|
isolationLevel: "repeatable_read",
|
|
12048
12077
|
accessMode: "read_only",
|
|
12049
|
-
temporaryWrites:
|
|
12078
|
+
temporaryWrites: chunkJ34FSPSC_cjs.INTERNAL_TEMPORARY_WRITES
|
|
12050
12079
|
};
|
|
12051
12080
|
const rounds = { started: false };
|
|
12052
12081
|
try {
|
|
@@ -12082,7 +12111,7 @@ function temporaryTableCapabilityError(ctx, algorithm, sqlState, cause) {
|
|
|
12082
12111
|
}
|
|
12083
12112
|
async function runWorkingTableRounds(ctx, options, plan, backend) {
|
|
12084
12113
|
const temporaryBackend = requireTemporaryStatements(backend);
|
|
12085
|
-
const runId =
|
|
12114
|
+
const runId = chunkCYKHSH5O_cjs.generateId();
|
|
12086
12115
|
const workingTable = chunkAYQBEVQY_cjs.sql.identifier(
|
|
12087
12116
|
`typegraph_iterative_${runId.replaceAll("-", "_")}`
|
|
12088
12117
|
);
|
|
@@ -12185,7 +12214,7 @@ async function cleanupWorkingTables(context, cleanup, operationFailure) {
|
|
|
12185
12214
|
async function fetchVisibleWorkingNodes(operation, nodeIds) {
|
|
12186
12215
|
const nodes = /* @__PURE__ */ new Map();
|
|
12187
12216
|
for (const chunk2 of chunkValues(nodeIds, operation.maxWorkingSetSize)) {
|
|
12188
|
-
const query = chunkAYQBEVQY_cjs.sql`SELECT n.id, n.kind FROM ${operation.schema.nodesTable} n WHERE n.graph_id = ${operation.ctx.graphId} AND n.id IN (${
|
|
12217
|
+
const query = chunkAYQBEVQY_cjs.sql`SELECT n.id, n.kind FROM ${operation.schema.nodesTable} n WHERE n.graph_id = ${operation.ctx.graphId} AND n.id IN (${chunkCYKHSH5O_cjs.sqlValueList(chunk2)}) AND ${operation.nodeTemporalFilter}`;
|
|
12189
12218
|
const rows = await operation.backend.execute(
|
|
12190
12219
|
chunkAYQBEVQY_cjs.asCompiledRowsSql(query)
|
|
12191
12220
|
);
|
|
@@ -12336,7 +12365,7 @@ function compileDirectionalExpansion(operation, workingRelation, sourceFilter, e
|
|
|
12336
12365
|
return chunkAYQBEVQY_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}`;
|
|
12337
12366
|
}
|
|
12338
12367
|
function compileDirectionalEdgeExpansion(operation, workingRelation, sourceFilter, edgeKinds, joinField, joinKindField, targetField, targetKindField, sourceProjection) {
|
|
12339
|
-
const edgeKindFilter =
|
|
12368
|
+
const edgeKindFilter = chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("e.kind"), edgeKinds);
|
|
12340
12369
|
const weightColumn = operation.weightExpression === void 0 ? chunkAYQBEVQY_cjs.sql`` : chunkAYQBEVQY_cjs.sql`, ${operation.weightExpression} AS weight`;
|
|
12341
12370
|
const sourceColumns = sourceProjection === void 0 ? chunkAYQBEVQY_cjs.sql`` : chunkAYQBEVQY_cjs.sql`, ${sourceProjection}`;
|
|
12342
12371
|
return chunkAYQBEVQY_cjs.sql`SELECT w.node_id AS source_id, w.node_kind AS source_kind${sourceColumns}, e.${chunkAYQBEVQY_cjs.sql.raw(targetField)} AS target_id, e.${chunkAYQBEVQY_cjs.sql.raw(targetKindField)} AS target_kind${weightColumn} FROM ${workingRelation} w JOIN ${operation.schema.edgesTable} e ON e.${chunkAYQBEVQY_cjs.sql.raw(joinField)} = w.node_id AND e.${chunkAYQBEVQY_cjs.sql.raw(joinKindField)} = w.node_kind AND e.graph_id = ${operation.ctx.graphId} WHERE ${sourceFilter} AND ${edgeKindFilter} AND ${operation.edgeTemporalFilter}`;
|
|
@@ -12350,15 +12379,15 @@ function chunkValues(values, chunkSize) {
|
|
|
12350
12379
|
}
|
|
12351
12380
|
function createOperation(ctx, options, backend) {
|
|
12352
12381
|
const temporal = resolveTemporalOptions(ctx, options);
|
|
12353
|
-
const currentTimestamp =
|
|
12354
|
-
const nodeTemporalFilter =
|
|
12382
|
+
const currentTimestamp = chunkCYKHSH5O_cjs.currentReadInstant();
|
|
12383
|
+
const nodeTemporalFilter = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
12355
12384
|
mode: temporal.temporalMode,
|
|
12356
12385
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
12357
12386
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
12358
12387
|
tableAlias: "n",
|
|
12359
12388
|
currentTimestamp
|
|
12360
12389
|
});
|
|
12361
|
-
const edgeTemporalFilter =
|
|
12390
|
+
const edgeTemporalFilter = chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
12362
12391
|
mode: temporal.temporalMode,
|
|
12363
12392
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
12364
12393
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
@@ -13983,7 +14012,7 @@ async function assertValidEdgeWeights(operation, weightProperty, defaultWeight)
|
|
|
13983
14012
|
const negativeViolation = chunkAYQBEVQY_cjs.sql`audited.is_number = 1 AND audited.weight_number < 0`;
|
|
13984
14013
|
const outOfRangeViolation = chunkAYQBEVQY_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)))`;
|
|
13985
14014
|
for (const edgeKinds of operation.edgeKindChunks) {
|
|
13986
|
-
const edgeKindFilter =
|
|
14015
|
+
const edgeKindFilter = chunkCYKHSH5O_cjs.compileKindFilter(chunkAYQBEVQY_cjs.sql.raw("e.kind"), edgeKinds);
|
|
13987
14016
|
const rows = await operation.backend.execute(
|
|
13988
14017
|
chunkAYQBEVQY_cjs.asCompiledRowsSql(chunkAYQBEVQY_cjs.sql`
|
|
13989
14018
|
SELECT audited.edge_id, audited.edge_kind, audited.weight_text,
|
|
@@ -14090,7 +14119,7 @@ async function findWeightedShortestPathInWorkingTable(ctx, sourceId, targetId, m
|
|
|
14090
14119
|
return state.frontierCount === 0;
|
|
14091
14120
|
},
|
|
14092
14121
|
async extractResult(context) {
|
|
14093
|
-
const recursiveTraversal =
|
|
14122
|
+
const recursiveTraversal = chunkZXXGMQC3_cjs.resolveRecursiveTraversal(
|
|
14094
14123
|
ctx.backend.capabilities
|
|
14095
14124
|
);
|
|
14096
14125
|
return recursiveTraversal.supported ? extractPathFromWorkingTable(context, targetId, maxIterations) : extractPathByPredecessorWalk(context, targetId, maxIterations);
|
|
@@ -14460,7 +14489,7 @@ function createGraphAlgorithms(params) {
|
|
|
14460
14489
|
registry: params.registry,
|
|
14461
14490
|
backend: params.backend,
|
|
14462
14491
|
dialect: chunkRNI64RB4_cjs.getDialect(params.backend.dialect),
|
|
14463
|
-
schema: params.schema ??
|
|
14492
|
+
schema: params.schema ?? chunkJ34FSPSC_cjs.createSqlSchema(params.backend.tableNames),
|
|
14464
14493
|
recordedReadBinding: params.recordedReadBinding,
|
|
14465
14494
|
defaultTemporalMode: params.defaultTemporalMode
|
|
14466
14495
|
};
|
|
@@ -14630,7 +14659,7 @@ function disjointnessViolations(overlaps, registry, graphId) {
|
|
|
14630
14659
|
function edgeCardinalityViolations(rows, graphId) {
|
|
14631
14660
|
const byAxis = /* @__PURE__ */ new Map();
|
|
14632
14661
|
for (const row of rows) {
|
|
14633
|
-
const target =
|
|
14662
|
+
const target = chunk36XLQHZA_cjs.edgeCardinalityClaimTarget({ ...row, graphId });
|
|
14634
14663
|
const identity = targetIdentity(target);
|
|
14635
14664
|
const entry2 = byAxis.get(identity) ?? { target, edgeIds: [] };
|
|
14636
14665
|
entry2.edgeIds.push(row.edgeId);
|
|
@@ -14758,18 +14787,18 @@ function lowerBoundRequiresWrite(requested, stored) {
|
|
|
14758
14787
|
return requestedValidFrom !== void 0 && requestedValidFrom !== null && !chunkNI2XPJQ2_cjs.isCanonicalIsoDate(requestedValidFrom);
|
|
14759
14788
|
}
|
|
14760
14789
|
function upsertWindowChanges(requested, current) {
|
|
14761
|
-
return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true &&
|
|
14790
|
+
return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true && chunkUVMSWO6X_cjs.validityEndAfterMutation(requested, current.valid_to) !== current.valid_to || requested?.clearValidTo === true && requested.validTo !== void 0 || windowFieldChanges("validTo", requested?.validTo, current.valid_to);
|
|
14762
14791
|
}
|
|
14763
14792
|
function windowAfterUpsertCreate(requested) {
|
|
14764
14793
|
return {
|
|
14765
14794
|
valid_from: requested.validFrom === null ? void 0 : requested.validFrom ?? UNKNOWN_VALIDITY_LOWER_BOUND,
|
|
14766
|
-
valid_to:
|
|
14795
|
+
valid_to: chunkUVMSWO6X_cjs.validityEndAfterMutation(requested, void 0)
|
|
14767
14796
|
};
|
|
14768
14797
|
}
|
|
14769
14798
|
function windowAfterUpsertUpdate(current, requested) {
|
|
14770
14799
|
return {
|
|
14771
14800
|
valid_from: current.valid_from,
|
|
14772
|
-
valid_to:
|
|
14801
|
+
valid_to: chunkUVMSWO6X_cjs.validityEndAfterMutation(requested, current.valid_to)
|
|
14773
14802
|
};
|
|
14774
14803
|
}
|
|
14775
14804
|
function shouldCoalesceUpsert(existing, options, runDirtyCheck) {
|
|
@@ -14975,7 +15004,7 @@ function createEdgeCollection(config) {
|
|
|
14975
15004
|
},
|
|
14976
15005
|
async getByIds(ids, options) {
|
|
14977
15006
|
if (ids.length === 0) return [];
|
|
14978
|
-
const rowsById = await
|
|
15007
|
+
const rowsById = await chunkCYKHSH5O_cjs.getEdgeRowsByIds(
|
|
14979
15008
|
backend,
|
|
14980
15009
|
batchPointRead,
|
|
14981
15010
|
graphId,
|
|
@@ -15080,18 +15109,18 @@ function createEdgeCollection(config) {
|
|
|
15080
15109
|
async bulkUpsertById(items) {
|
|
15081
15110
|
if (items.length === 0) return [];
|
|
15082
15111
|
for (const item of items) {
|
|
15083
|
-
|
|
15112
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(item, {
|
|
15084
15113
|
entityType: "edge",
|
|
15085
15114
|
kind,
|
|
15086
15115
|
id: item.id
|
|
15087
15116
|
});
|
|
15088
15117
|
if (item.clearValidTo === true) {
|
|
15089
|
-
|
|
15118
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "edge");
|
|
15090
15119
|
}
|
|
15091
15120
|
}
|
|
15092
15121
|
const upsertAll = async (target) => {
|
|
15093
15122
|
const ids = items.map((item) => item.id);
|
|
15094
|
-
const existingMap = await
|
|
15123
|
+
const existingMap = await chunkCYKHSH5O_cjs.getEdgeRowsByIds(
|
|
15095
15124
|
target,
|
|
15096
15125
|
batchPointRead,
|
|
15097
15126
|
graphId,
|
|
@@ -15162,7 +15191,7 @@ function createEdgeCollection(config) {
|
|
|
15162
15191
|
actualIdentity,
|
|
15163
15192
|
"update"
|
|
15164
15193
|
);
|
|
15165
|
-
const currentProps = pendingEntry === void 0 ?
|
|
15194
|
+
const currentProps = pendingEntry === void 0 ? chunkJ34FSPSC_cjs.rowPropsToObject(chunkBXHAPCQG_cjs.requireDefined(original).props) : pendingEntry.props;
|
|
15166
15195
|
const dirty = currentProps === void 0 ? void 0 : runDirtyCheck(
|
|
15167
15196
|
original?.kind ?? kind,
|
|
15168
15197
|
item.id,
|
|
@@ -15259,10 +15288,10 @@ function createEdgeCollection(config) {
|
|
|
15259
15288
|
}
|
|
15260
15289
|
return { results: results2, mutations: toCreate.length + toUpdate.length };
|
|
15261
15290
|
};
|
|
15262
|
-
const { results, mutations } = await
|
|
15291
|
+
const { results, mutations } = await chunkUVMSWO6X_cjs.runResolvedMutationSetConverging(
|
|
15263
15292
|
"edge",
|
|
15264
15293
|
backend,
|
|
15265
|
-
() =>
|
|
15294
|
+
() => chunkJ34FSPSC_cjs.runOptionallyInTransaction(backend, (target) => upsertAll(target))
|
|
15266
15295
|
);
|
|
15267
15296
|
await config.maybeRefreshStatisticsAfterBulk?.(mutations);
|
|
15268
15297
|
return results;
|
|
@@ -15289,7 +15318,7 @@ function createEdgeCollection(config) {
|
|
|
15289
15318
|
return result === void 0 ? void 0 : narrowEdge(result);
|
|
15290
15319
|
},
|
|
15291
15320
|
async getOrCreateByEndpoints(from, to, props, options) {
|
|
15292
|
-
|
|
15321
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(options ?? {}, {
|
|
15293
15322
|
entityType: "edge",
|
|
15294
15323
|
kind
|
|
15295
15324
|
});
|
|
@@ -15324,7 +15353,7 @@ function createEdgeCollection(config) {
|
|
|
15324
15353
|
async bulkGetOrCreateByEndpoints(items, options) {
|
|
15325
15354
|
if (items.length === 0) return [];
|
|
15326
15355
|
for (const item of items) {
|
|
15327
|
-
|
|
15356
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(item, {
|
|
15328
15357
|
entityType: "edge",
|
|
15329
15358
|
kind
|
|
15330
15359
|
});
|
|
@@ -15480,7 +15509,7 @@ function createNodeCollection(config) {
|
|
|
15480
15509
|
},
|
|
15481
15510
|
async getByIds(ids, options) {
|
|
15482
15511
|
if (ids.length === 0) return [];
|
|
15483
|
-
const rowsById = await
|
|
15512
|
+
const rowsById = await chunkCYKHSH5O_cjs.getNodeRowsByIds(
|
|
15484
15513
|
backend,
|
|
15485
15514
|
batchPointRead,
|
|
15486
15515
|
graphId,
|
|
@@ -15648,25 +15677,25 @@ function createNodeCollection(config) {
|
|
|
15648
15677
|
return this.upsertByIdFromRecord(id, props, options);
|
|
15649
15678
|
},
|
|
15650
15679
|
async upsertByIdFromRecord(id, data, options) {
|
|
15651
|
-
|
|
15680
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(options ?? {}, {
|
|
15652
15681
|
entityType: "node",
|
|
15653
15682
|
kind,
|
|
15654
15683
|
id
|
|
15655
15684
|
});
|
|
15656
15685
|
if (options?.clearValidTo === true) {
|
|
15657
|
-
|
|
15686
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "node");
|
|
15658
15687
|
}
|
|
15659
15688
|
const existing = await backend.getNode(graphId, kind, id);
|
|
15660
15689
|
const coalesces = (row) => {
|
|
15661
15690
|
const runDirtyCheck = config.upsertDirtyCheck && (() => chunkBXHAPCQG_cjs.requireDefined(config.upsertDirtyCheck)(
|
|
15662
15691
|
kind,
|
|
15663
15692
|
id,
|
|
15664
|
-
|
|
15693
|
+
chunkJ34FSPSC_cjs.rowPropsToObject(row.props),
|
|
15665
15694
|
data
|
|
15666
15695
|
));
|
|
15667
15696
|
return shouldCoalesceUpsert(row, options, runDirtyCheck);
|
|
15668
15697
|
};
|
|
15669
|
-
const decision = existing !== void 0 && coalesces(existing) ? await
|
|
15698
|
+
const decision = existing !== void 0 && coalesces(existing) ? await chunkJ34FSPSC_cjs.runOptionallyInTransaction(
|
|
15670
15699
|
backend,
|
|
15671
15700
|
async (target) => {
|
|
15672
15701
|
const confirmed = await target.getNode(graphId, kind, id);
|
|
@@ -15727,11 +15756,11 @@ function createNodeCollection(config) {
|
|
|
15727
15756
|
await config.maybeRefreshStatisticsAfterBulk?.(attempt.value.length);
|
|
15728
15757
|
return narrowNodes(attempt.value);
|
|
15729
15758
|
}
|
|
15730
|
-
const results = await
|
|
15759
|
+
const results = await chunkUVMSWO6X_cjs.runResolvedMutationSetConverging(
|
|
15731
15760
|
"node",
|
|
15732
15761
|
backend,
|
|
15733
|
-
() =>
|
|
15734
|
-
const rows = await
|
|
15762
|
+
() => chunkJ34FSPSC_cjs.runOptionallyInTransaction(backend, async (target) => {
|
|
15763
|
+
const rows = await chunkCYKHSH5O_cjs.getNodeRowsByIds(
|
|
15735
15764
|
target,
|
|
15736
15765
|
batchPointRead,
|
|
15737
15766
|
graphId,
|
|
@@ -15778,22 +15807,22 @@ function createNodeCollection(config) {
|
|
|
15778
15807
|
async bulkUpsertById(items) {
|
|
15779
15808
|
if (items.length === 0) return [];
|
|
15780
15809
|
for (const item of items) {
|
|
15781
|
-
|
|
15810
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(item, {
|
|
15782
15811
|
entityType: "node",
|
|
15783
15812
|
kind,
|
|
15784
15813
|
id: item.id
|
|
15785
15814
|
});
|
|
15786
15815
|
if (item.clearValidTo === true) {
|
|
15787
|
-
|
|
15816
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "node");
|
|
15788
15817
|
}
|
|
15789
15818
|
}
|
|
15790
15819
|
const upsertAll = async (target) => {
|
|
15791
15820
|
const ids = items.map((item) => item.id);
|
|
15792
15821
|
const existingMap = /* @__PURE__ */ new Map();
|
|
15793
|
-
const boundGetNodes =
|
|
15822
|
+
const boundGetNodes = chunkJ34FSPSC_cjs.bindExtraIfReachable(
|
|
15794
15823
|
target,
|
|
15795
15824
|
batchPointRead.extras.getNodes,
|
|
15796
|
-
|
|
15825
|
+
chunkJ34FSPSC_cjs.BATCH_POINT_READ.id
|
|
15797
15826
|
);
|
|
15798
15827
|
if (boundGetNodes === void 0) {
|
|
15799
15828
|
const rows = await Promise.all(
|
|
@@ -15840,7 +15869,7 @@ function createNodeCollection(config) {
|
|
|
15840
15869
|
continue;
|
|
15841
15870
|
}
|
|
15842
15871
|
const deletedAt = pendingEntry === void 0 ? chunkBXHAPCQG_cjs.requireDefined(original).deleted_at : void 0;
|
|
15843
|
-
const currentProps = pendingEntry === void 0 ?
|
|
15872
|
+
const currentProps = pendingEntry === void 0 ? chunkJ34FSPSC_cjs.rowPropsToObject(chunkBXHAPCQG_cjs.requireDefined(original).props) : pendingEntry.props;
|
|
15844
15873
|
const dirty = currentProps === void 0 ? void 0 : runDirtyCheck(item.id, currentProps, item.props);
|
|
15845
15874
|
const currentWindow = pendingEntry === void 0 ? {
|
|
15846
15875
|
valid_from: chunkBXHAPCQG_cjs.requireDefined(original).valid_from,
|
|
@@ -15924,10 +15953,10 @@ function createNodeCollection(config) {
|
|
|
15924
15953
|
}
|
|
15925
15954
|
return { results: results2, mutations: toCreate.length + toUpdate.length };
|
|
15926
15955
|
};
|
|
15927
|
-
const { results, mutations } = await
|
|
15956
|
+
const { results, mutations } = await chunkUVMSWO6X_cjs.runResolvedMutationSetConverging(
|
|
15928
15957
|
"node",
|
|
15929
15958
|
backend,
|
|
15930
|
-
() =>
|
|
15959
|
+
() => chunkJ34FSPSC_cjs.runOptionallyInTransaction(backend, (target) => upsertAll(target))
|
|
15931
15960
|
);
|
|
15932
15961
|
await config.maybeRefreshStatisticsAfterBulk?.(mutations);
|
|
15933
15962
|
return results;
|
|
@@ -16195,13 +16224,13 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
16195
16224
|
"verifyContributions"
|
|
16196
16225
|
];
|
|
16197
16226
|
function createHistoryStoreBackendProjection(backend) {
|
|
16198
|
-
return Object.freeze(
|
|
16227
|
+
return Object.freeze(chunkJ34FSPSC_cjs.projectBackend(backend, HISTORY_STORE_BACKEND_KEYS));
|
|
16199
16228
|
}
|
|
16200
16229
|
|
|
16201
16230
|
// src/store/introspect.ts
|
|
16202
16231
|
function introspectSchema(graph, context) {
|
|
16203
16232
|
const extension = graph.extension;
|
|
16204
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
16233
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkL2REUAJB_cjs.extensionKindNames(extension);
|
|
16205
16234
|
const deprecated = graph.deprecatedKinds;
|
|
16206
16235
|
const kinds = [];
|
|
16207
16236
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
@@ -16212,7 +16241,7 @@ function introspectSchema(graph, context) {
|
|
|
16212
16241
|
description: reg.type.description,
|
|
16213
16242
|
annotations: reg.type.annotations,
|
|
16214
16243
|
deprecated: deprecated.has(name),
|
|
16215
|
-
properties:
|
|
16244
|
+
properties: chunkL2REUAJB_cjs.serializeSchemaProperties(reg.type.schema),
|
|
16216
16245
|
unique: (reg.unique ?? []).map((constraint) => ({
|
|
16217
16246
|
name: constraint.name,
|
|
16218
16247
|
fields: [...constraint.fields],
|
|
@@ -16233,17 +16262,17 @@ function introspectSchema(graph, context) {
|
|
|
16233
16262
|
to: chunkOJHFXL7Y_cjs.projectTargetKinds(reg.to),
|
|
16234
16263
|
cardinality: reg.cardinality ?? "many",
|
|
16235
16264
|
endpointExistence: reg.endpointExistence ?? "notDeleted",
|
|
16236
|
-
properties:
|
|
16265
|
+
properties: chunkL2REUAJB_cjs.serializeSchemaProperties(edgeType.schema),
|
|
16237
16266
|
annotations: edgeType.annotations,
|
|
16238
16267
|
deprecated: deprecated.has(name)
|
|
16239
16268
|
});
|
|
16240
16269
|
}
|
|
16241
|
-
const runtimeOntologyKeys =
|
|
16270
|
+
const runtimeOntologyKeys = chunkL2REUAJB_cjs.buildGraphExtensionOntologyKeySet(extension);
|
|
16242
16271
|
const ontology = graph.ontology.map((relation) => ({
|
|
16243
16272
|
metaEdge: relation.metaEdge.name,
|
|
16244
16273
|
from: chunkOGZA7IS4_cjs.getTypeName(relation.from),
|
|
16245
16274
|
to: chunkOGZA7IS4_cjs.getTypeName(relation.to),
|
|
16246
|
-
origin: runtimeOntologyKeys.has(
|
|
16275
|
+
origin: runtimeOntologyKeys.has(chunkL2REUAJB_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
|
|
16247
16276
|
}));
|
|
16248
16277
|
return {
|
|
16249
16278
|
graphId: context.graphId,
|
|
@@ -16764,7 +16793,7 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
16764
16793
|
chunkAYQBEVQY_cjs.asCompiledRowsSql(chunkAYQBEVQY_cjs.sql`
|
|
16765
16794
|
SELECT c.relname AS name
|
|
16766
16795
|
FROM pg_class c
|
|
16767
|
-
WHERE c.relname IN (${
|
|
16796
|
+
WHERE c.relname IN (${chunkCYKHSH5O_cjs.sqlValueList(tableNames)})
|
|
16768
16797
|
AND c.relkind IN ('r', 'p')
|
|
16769
16798
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
16770
16799
|
`)
|
|
@@ -16777,7 +16806,7 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
16777
16806
|
SELECT name
|
|
16778
16807
|
FROM sqlite_master
|
|
16779
16808
|
WHERE type = 'table'
|
|
16780
|
-
AND name IN (${
|
|
16809
|
+
AND name IN (${chunkCYKHSH5O_cjs.sqlValueList(tableNames)})
|
|
16781
16810
|
`)
|
|
16782
16811
|
);
|
|
16783
16812
|
return new Set(rows.map((row) => row.name));
|
|
@@ -16798,7 +16827,7 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
16798
16827
|
SELECT c.relname AS name, i.indisvalid AS valid
|
|
16799
16828
|
FROM pg_class c
|
|
16800
16829
|
JOIN pg_index i ON i.indexrelid = c.oid
|
|
16801
|
-
WHERE c.relname IN (${
|
|
16830
|
+
WHERE c.relname IN (${chunkCYKHSH5O_cjs.sqlValueList(physicalIndexNames)})
|
|
16802
16831
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
16803
16832
|
`)
|
|
16804
16833
|
);
|
|
@@ -16811,7 +16840,7 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
16811
16840
|
SELECT name
|
|
16812
16841
|
FROM sqlite_master
|
|
16813
16842
|
WHERE type = 'index'
|
|
16814
|
-
AND name IN (${
|
|
16843
|
+
AND name IN (${chunkCYKHSH5O_cjs.sqlValueList(physicalIndexNames)})
|
|
16815
16844
|
`)
|
|
16816
16845
|
);
|
|
16817
16846
|
for (const row of rows) valid.add(row.name);
|
|
@@ -16999,7 +17028,7 @@ async function computeIndexSignature(dialect, targetTableName, declaration) {
|
|
|
16999
17028
|
const hashable = {
|
|
17000
17029
|
dialect,
|
|
17001
17030
|
targetTableName,
|
|
17002
|
-
declaration:
|
|
17031
|
+
declaration: chunkL2REUAJB_cjs.serializeIndexDeclaration(declaration)
|
|
17003
17032
|
};
|
|
17004
17033
|
const json = JSON.stringify(hashable, chunk5X46XWNH_cjs.sortedReplacer);
|
|
17005
17034
|
return chunkZY4GXIVN_cjs.sha256Hex(json, 16);
|
|
@@ -17021,7 +17050,7 @@ async function materializeRemovals(context, options = {}) {
|
|
|
17021
17050
|
await ensureFocusedStatusTable(backend, backend.ensureKindRemovalsTable);
|
|
17022
17051
|
await reconcilePendingRemovals(context);
|
|
17023
17052
|
const activeRow = await backend.getActiveSchema(graphId);
|
|
17024
|
-
const activeSchema = activeRow === void 0 ? void 0 :
|
|
17053
|
+
const activeSchema = activeRow === void 0 ? void 0 : chunkL2REUAJB_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
17025
17054
|
const reclaimedVectorFields = await reclaimRemovedVectorFieldTables(
|
|
17026
17055
|
context,
|
|
17027
17056
|
activeRow
|
|
@@ -17060,7 +17089,7 @@ async function materializeRemovals(context, options = {}) {
|
|
|
17060
17089
|
uniquesTable,
|
|
17061
17090
|
edgeClaimsTable,
|
|
17062
17091
|
captureRecordedRemovals,
|
|
17063
|
-
recordedSchema: captureRecordedRemovals ? context.recordedSchema ??
|
|
17092
|
+
recordedSchema: captureRecordedRemovals ? context.recordedSchema ?? chunkJ34FSPSC_cjs.createSqlSchema(backend.tableNames) : void 0
|
|
17064
17093
|
};
|
|
17065
17094
|
const materialized = [];
|
|
17066
17095
|
for (const candidate of candidates) {
|
|
@@ -17090,14 +17119,14 @@ async function reconcilePendingRemovals(context) {
|
|
|
17090
17119
|
const reconciliations = [];
|
|
17091
17120
|
const stopAtVersion = marker ?? 1;
|
|
17092
17121
|
let currentRow = activeRow;
|
|
17093
|
-
let currentSchema =
|
|
17122
|
+
let currentSchema = chunkL2REUAJB_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
17094
17123
|
while (currentRow.version > stopAtVersion) {
|
|
17095
17124
|
const priorRow = await backend.getSchemaVersion(
|
|
17096
17125
|
graphId,
|
|
17097
17126
|
currentRow.version - 1
|
|
17098
17127
|
);
|
|
17099
17128
|
if (priorRow === void 0) break;
|
|
17100
|
-
const priorSchema =
|
|
17129
|
+
const priorSchema = chunkL2REUAJB_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
17101
17130
|
for (const entity of ENTITY_KINDS) {
|
|
17102
17131
|
const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
|
|
17103
17132
|
const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
|
|
@@ -17162,7 +17191,7 @@ async function materializeOne2(row, ctx) {
|
|
|
17162
17191
|
ctx.graphId,
|
|
17163
17192
|
async (target) => {
|
|
17164
17193
|
const activeRow = await target.getActiveSchema(ctx.graphId);
|
|
17165
|
-
const activeSchema = activeRow === void 0 ? void 0 :
|
|
17194
|
+
const activeSchema = activeRow === void 0 ? void 0 : chunkL2REUAJB_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
17166
17195
|
if (liveKindNamesFrom(activeSchema)[row.entity].has(row.kindName)) {
|
|
17167
17196
|
return "skipped";
|
|
17168
17197
|
}
|
|
@@ -17237,7 +17266,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
|
|
|
17237
17266
|
await executeDeleteStatements(target, deleteStatements);
|
|
17238
17267
|
return;
|
|
17239
17268
|
}
|
|
17240
|
-
await
|
|
17269
|
+
await chunkCYKHSH5O_cjs.closeRecordedHardDeletedKind(
|
|
17241
17270
|
target,
|
|
17242
17271
|
recordedSchema,
|
|
17243
17272
|
ctx.graphId,
|
|
@@ -17254,7 +17283,7 @@ function buildRemovedKindLiveDeleteStatements(ctx, row, reapsEdgeClaims) {
|
|
|
17254
17283
|
// Must precede the edge delete: ownership is discovered by selecting the
|
|
17255
17284
|
// connected edge ids, which no longer exist afterward.
|
|
17256
17285
|
...reapsEdgeClaims ? [
|
|
17257
|
-
|
|
17286
|
+
chunkBYUIOM4L_cjs.buildHardDeleteEdgeClaimsByNodeKind(
|
|
17258
17287
|
ctx.edgeClaimsTable,
|
|
17259
17288
|
ctx.edgesTable,
|
|
17260
17289
|
{ graphId: ctx.graphId, nodeKind: row.kindName }
|
|
@@ -17269,7 +17298,7 @@ function buildRemovedKindLiveDeleteStatements(ctx, row, reapsEdgeClaims) {
|
|
|
17269
17298
|
chunkAYQBEVQY_cjs.sql.raw(
|
|
17270
17299
|
`DELETE FROM ${quote(ctx.fulltextTable)} WHERE graph_id = ${graphLit} AND node_kind = ${kindLit}`
|
|
17271
17300
|
),
|
|
17272
|
-
|
|
17301
|
+
chunkBYUIOM4L_cjs.buildHardDeleteUniquesByConcreteKind(ctx.uniquesTable, {
|
|
17273
17302
|
graphId: ctx.graphId,
|
|
17274
17303
|
concreteKind: row.kindName
|
|
17275
17304
|
})
|
|
@@ -17284,7 +17313,7 @@ function buildRemovedKindLiveDeleteStatements(ctx, row, reapsEdgeClaims) {
|
|
|
17284
17313
|
// but nothing would ever reap them, so the relation would grow by one row
|
|
17285
17314
|
// per removed constrained kind forever.
|
|
17286
17315
|
...reapsEdgeClaims ? [
|
|
17287
|
-
|
|
17316
|
+
chunkBYUIOM4L_cjs.buildHardDeleteEdgeClaimsByEdgeKind(ctx.edgeClaimsTable, {
|
|
17288
17317
|
graphId: ctx.graphId,
|
|
17289
17318
|
edgeKind: row.kindName
|
|
17290
17319
|
})
|
|
@@ -17321,7 +17350,7 @@ async function resolveRemovedKindEmbeddingSlots(backend, row) {
|
|
|
17321
17350
|
if (priorVersion < 1) return [];
|
|
17322
17351
|
const priorRow = await backend.getSchemaVersion(row.graphId, priorVersion);
|
|
17323
17352
|
if (priorRow === void 0) return [];
|
|
17324
|
-
const priorSchema =
|
|
17353
|
+
const priorSchema = chunkL2REUAJB_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
17325
17354
|
const slots = /* @__PURE__ */ new Map();
|
|
17326
17355
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
17327
17356
|
if (declaration.entity === "vector" && declaration.kind === row.kindName) {
|
|
@@ -17358,14 +17387,14 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
|
|
|
17358
17387
|
let perBackend = reclaimCache.get(backend);
|
|
17359
17388
|
const cached = perBackend?.get(cacheKey);
|
|
17360
17389
|
if (cached !== void 0) return cached;
|
|
17361
|
-
const activeSchema =
|
|
17390
|
+
const activeSchema = chunkL2REUAJB_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
17362
17391
|
const activeVectorFields = vectorFieldKeysFrom(activeSchema);
|
|
17363
17392
|
const survivingKinds = new Set(Object.keys(activeSchema.nodes));
|
|
17364
17393
|
const historical = /* @__PURE__ */ new Map();
|
|
17365
17394
|
for (let version = activeRow.version - 1; version >= 1; version -= 1) {
|
|
17366
17395
|
const priorRow = await backend.getSchemaVersion(graphId, version);
|
|
17367
17396
|
if (priorRow === void 0) continue;
|
|
17368
|
-
const priorSchema =
|
|
17397
|
+
const priorSchema = chunkL2REUAJB_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
17369
17398
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
17370
17399
|
if (declaration.entity !== "vector") continue;
|
|
17371
17400
|
const key = vectorFieldKey(declaration.kind, declaration.fieldPath);
|
|
@@ -17403,7 +17432,7 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
|
|
|
17403
17432
|
async (target) => {
|
|
17404
17433
|
const lockedActiveRow = await target.getActiveSchema(graphId);
|
|
17405
17434
|
if (lockedActiveRow === void 0) return false;
|
|
17406
|
-
const lockedActiveSchema =
|
|
17435
|
+
const lockedActiveSchema = chunkL2REUAJB_cjs.parseSerializedSchema(
|
|
17407
17436
|
lockedActiveRow.schema_doc
|
|
17408
17437
|
);
|
|
17409
17438
|
const lockedVectorFields = vectorFieldKeysFrom(lockedActiveSchema);
|
|
@@ -17497,7 +17526,7 @@ function getEdgeRegistration(graph, kind) {
|
|
|
17497
17526
|
return registration;
|
|
17498
17527
|
}
|
|
17499
17528
|
function edgeInsertWork(prepared) {
|
|
17500
|
-
const claim =
|
|
17529
|
+
const claim = chunk36XLQHZA_cjs.edgeCardinalityClaim(
|
|
17501
17530
|
prepared.cardinality,
|
|
17502
17531
|
prepared.insertParams
|
|
17503
17532
|
);
|
|
@@ -17528,7 +17557,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
|
|
|
17528
17557
|
const toKind = input.toKind;
|
|
17529
17558
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
17530
17559
|
const edgeKind = registration.type;
|
|
17531
|
-
|
|
17560
|
+
chunkXXEFDJHY_cjs.assertEdgeMatchIdentityBackendSupport(
|
|
17532
17561
|
registration.matchIdentity,
|
|
17533
17562
|
backend.capabilities,
|
|
17534
17563
|
kind
|
|
@@ -17552,11 +17581,11 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
|
|
|
17552
17581
|
backend
|
|
17553
17582
|
);
|
|
17554
17583
|
}
|
|
17555
|
-
const validatedProps =
|
|
17584
|
+
const validatedProps = chunkCYKHSH5O_cjs.validateEdgeProps(edgeKind.schema, input.props, {
|
|
17556
17585
|
kind,
|
|
17557
17586
|
operation: "create"
|
|
17558
17587
|
});
|
|
17559
|
-
const matchIdentity =
|
|
17588
|
+
const matchIdentity = chunkUVMSWO6X_cjs.resolveEdgeMatchIdentityStorage(
|
|
17560
17589
|
registration.matchIdentity,
|
|
17561
17590
|
{
|
|
17562
17591
|
fromKind,
|
|
@@ -17580,7 +17609,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
|
|
|
17580
17609
|
backend
|
|
17581
17610
|
};
|
|
17582
17611
|
if (options?.validateCardinality ?? true) {
|
|
17583
|
-
await
|
|
17612
|
+
await chunkUVMSWO6X_cjs.checkCardinalityConstraint(
|
|
17584
17613
|
constraintContext,
|
|
17585
17614
|
kind,
|
|
17586
17615
|
cardinality,
|
|
@@ -17632,7 +17661,7 @@ function createdEdgeResult(edge) {
|
|
|
17632
17661
|
return { outcome: "created", edge };
|
|
17633
17662
|
}
|
|
17634
17663
|
function foundEdgeResult(row) {
|
|
17635
|
-
return { outcome: "found", edge:
|
|
17664
|
+
return { outcome: "found", edge: chunkUVMSWO6X_cjs.rowToEdge(row), row };
|
|
17636
17665
|
}
|
|
17637
17666
|
function edgeCreateDidWrite(result) {
|
|
17638
17667
|
return result.outcome === "created";
|
|
@@ -17675,9 +17704,9 @@ async function durableIdentityIdConflict(target, graphId, id, identity, kind) {
|
|
|
17675
17704
|
}
|
|
17676
17705
|
async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
17677
17706
|
const kind = input.kind;
|
|
17678
|
-
const id = input.id ??
|
|
17707
|
+
const id = input.id ?? chunkCYKHSH5O_cjs.generateId();
|
|
17679
17708
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
17680
|
-
|
|
17709
|
+
chunkXXEFDJHY_cjs.assertEdgeMatchIdentityBackendSupport(
|
|
17681
17710
|
registration.matchIdentity,
|
|
17682
17711
|
backend.capabilities,
|
|
17683
17712
|
kind
|
|
@@ -17686,7 +17715,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17686
17715
|
const shouldReturnRow = options?.returnRow ?? true;
|
|
17687
17716
|
const convergeOn = options?.convergeOn;
|
|
17688
17717
|
const durableConvergence = convergeOn !== void 0 && registration.matchIdentity !== void 0;
|
|
17689
|
-
const autocommitBackend =
|
|
17718
|
+
const autocommitBackend = chunkVXEHEPC4_cjs.isBundledRootAutocommitEligible(backend) ? backend : void 0;
|
|
17690
17719
|
const candidate = chunkBXHAPCQG_cjs.hasOwnKey(ctx.graph.edges, kind) ? {
|
|
17691
17720
|
backend,
|
|
17692
17721
|
schemaVersion: ctx.schemaVersion,
|
|
@@ -17696,26 +17725,26 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17696
17725
|
convergesDynamically: convergeOn !== void 0 && !durableConvergence,
|
|
17697
17726
|
cardinality: edgeCardinality(ctx, kind)
|
|
17698
17727
|
} : void 0;
|
|
17699
|
-
const schemaFenceInFirstWrite = candidate !== void 0 &&
|
|
17700
|
-
const autocommitSingleStatement = autocommitBackend !== void 0 && candidate !== void 0 &&
|
|
17701
|
-
const plan =
|
|
17702
|
-
convergeOn === void 0 || durableConvergence ?
|
|
17728
|
+
const schemaFenceInFirstWrite = candidate !== void 0 && chunkUVMSWO6X_cjs.canFuseSchemaFenceInFirstWrite({ kind: "edge", candidate });
|
|
17729
|
+
const autocommitSingleStatement = autocommitBackend !== void 0 && candidate !== void 0 && chunkUVMSWO6X_cjs.isAutocommitSingleStatementWrite({ kind: "edge", candidate });
|
|
17730
|
+
const plan = chunkUVMSWO6X_cjs.edgeWritePlan(
|
|
17731
|
+
convergeOn === void 0 || durableConvergence ? chunkUVMSWO6X_cjs.edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
|
|
17703
17732
|
);
|
|
17704
17733
|
const rowWork = async (session, target, _overlaidSession, lock, transactionMode) => {
|
|
17705
|
-
const targetBackend =
|
|
17706
|
-
const fuseSchemaFenceInFirstWrite = schemaFenceInFirstWrite &&
|
|
17734
|
+
const targetBackend = chunkUVMSWO6X_cjs.unfencedTarget(target);
|
|
17735
|
+
const fuseSchemaFenceInFirstWrite = schemaFenceInFirstWrite && chunkJ34FSPSC_cjs.isSchemaFencedInsertEligible(targetBackend) && !chunkCYKHSH5O_cjs.hasLeasedSchemaFence(ctx, targetBackend);
|
|
17707
17736
|
if (schemaFenceInFirstWrite && !fuseSchemaFenceInFirstWrite) {
|
|
17708
|
-
await
|
|
17737
|
+
await chunkCYKHSH5O_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
|
|
17709
17738
|
}
|
|
17710
17739
|
const diagnoseFusedCreateNoRow = async (validateCardinality) => {
|
|
17711
17740
|
if (fuseSchemaFenceInFirstWrite) {
|
|
17712
|
-
await
|
|
17741
|
+
await chunkCYKHSH5O_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
|
|
17713
17742
|
const directInteractiveAutocommit = autocommitSingleStatement && transactionMode === "none" && targetBackend.capabilities.execution.interactiveTransactions;
|
|
17714
17743
|
if (directInteractiveAutocommit) {
|
|
17715
|
-
throw new
|
|
17744
|
+
throw new chunkUVMSWO6X_cjs.AutocommitWriteRequiresTransaction();
|
|
17716
17745
|
}
|
|
17717
17746
|
if (transactionMode !== "none") {
|
|
17718
|
-
await
|
|
17747
|
+
await chunkCYKHSH5O_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
|
|
17719
17748
|
}
|
|
17720
17749
|
const prepared2 = await validateAndPrepareEdgeCreate(
|
|
17721
17750
|
ctx,
|
|
@@ -17725,7 +17754,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17725
17754
|
{ validateEndpoints: true, validateCardinality }
|
|
17726
17755
|
);
|
|
17727
17756
|
if (transactionMode === "none") {
|
|
17728
|
-
await
|
|
17757
|
+
await chunkCYKHSH5O_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
|
|
17729
17758
|
}
|
|
17730
17759
|
return prepared2;
|
|
17731
17760
|
}
|
|
@@ -17735,7 +17764,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17735
17764
|
});
|
|
17736
17765
|
};
|
|
17737
17766
|
const declaredCardinality = edgeCardinality(ctx, kind);
|
|
17738
|
-
const usesGuardedCardinalityClaim = declaredCardinality !== "many" &&
|
|
17767
|
+
const usesGuardedCardinalityClaim = declaredCardinality !== "many" && chunk36XLQHZA_cjs.edgeCardinalityClaimMode(target, ctx.claimsVerdict()).kind === "guarded";
|
|
17739
17768
|
const usesFusedCardinalityInsert = usesGuardedCardinalityClaim;
|
|
17740
17769
|
const delaysCardinalityProbe = convergeOn !== void 0 && !usesGuardedCardinalityClaim;
|
|
17741
17770
|
const canFuseEndpointCheck = declaredCardinality === "many" || usesGuardedCardinalityClaim;
|
|
@@ -17779,9 +17808,9 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17779
17808
|
match: durableMatchIdentity === void 0 ? { kind: "dynamic", ...chunkBXHAPCQG_cjs.requireDefined(convergeOn) } : { kind: "durable", identity: durableMatchIdentity }
|
|
17780
17809
|
};
|
|
17781
17810
|
const result = lock.coordination === void 0 && command.match.kind === "dynamic" ? {
|
|
17782
|
-
outcome: "unsupported"} : await
|
|
17811
|
+
outcome: "unsupported"} : await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation(
|
|
17783
17812
|
"edge",
|
|
17784
|
-
() =>
|
|
17813
|
+
() => chunkJ34FSPSC_cjs.executeAuthoritativeGraphCommand(
|
|
17785
17814
|
target.commands,
|
|
17786
17815
|
command,
|
|
17787
17816
|
lock.coordination ?? "none"
|
|
@@ -17789,9 +17818,9 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17789
17818
|
);
|
|
17790
17819
|
if (result.outcome === "created") {
|
|
17791
17820
|
if (durableMatchIdentity !== void 0 && work2.claim !== void 0) {
|
|
17792
|
-
await
|
|
17821
|
+
await chunk36XLQHZA_cjs.claimEdgeCardinality(target, ctx.claimsVerdict(), work2.claim);
|
|
17793
17822
|
}
|
|
17794
|
-
return createdEdgeResult(
|
|
17823
|
+
return createdEdgeResult(chunkUVMSWO6X_cjs.rowToEdge(result.row));
|
|
17795
17824
|
}
|
|
17796
17825
|
if (result.outcome === "found") {
|
|
17797
17826
|
if (command.match.kind === "dynamic") {
|
|
@@ -17855,7 +17884,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17855
17884
|
kind
|
|
17856
17885
|
);
|
|
17857
17886
|
if (identityConflict !== void 0) {
|
|
17858
|
-
await
|
|
17887
|
+
await chunkCYKHSH5O_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
|
|
17859
17888
|
await validateAndPrepareEdgeCreate(ctx, input, id, target, {
|
|
17860
17889
|
validateEndpoints: true,
|
|
17861
17890
|
validateCardinality: false
|
|
@@ -17898,28 +17927,28 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17898
17927
|
...usesFusedCardinalityInsert && fusedWork.claim !== void 0 ? { cardinalityClaim: fusedWork.claim } : {}
|
|
17899
17928
|
}
|
|
17900
17929
|
};
|
|
17901
|
-
const fusedResult = await
|
|
17930
|
+
const fusedResult = await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation(
|
|
17902
17931
|
"edge",
|
|
17903
17932
|
() => session.createEdgeWithPlan(fusedCommand)
|
|
17904
17933
|
);
|
|
17905
17934
|
if (fusedResult.outcome === "created") {
|
|
17906
17935
|
if (fuseSchemaFenceInFirstWrite) {
|
|
17907
|
-
|
|
17936
|
+
chunkCYKHSH5O_cjs.memoizeLeasedSchemaFence(ctx, targetBackend);
|
|
17908
17937
|
}
|
|
17909
|
-
return createdEdgeResult(
|
|
17938
|
+
return createdEdgeResult(chunkUVMSWO6X_cjs.rowToEdge(fusedResult.row));
|
|
17910
17939
|
}
|
|
17911
17940
|
prepared = await diagnoseFusedCreateNoRow(true);
|
|
17912
17941
|
}
|
|
17913
17942
|
const work = edgeInsertWork(prepared);
|
|
17914
|
-
const row = await
|
|
17943
|
+
const row = await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation("edge", async () => {
|
|
17915
17944
|
if (shouldReturnRow) return session.createEdge(work);
|
|
17916
17945
|
await session.createEdgeNoReturn(work);
|
|
17917
17946
|
return;
|
|
17918
17947
|
});
|
|
17919
|
-
return createdEdgeResult(row === void 0 ? void 0 :
|
|
17948
|
+
return createdEdgeResult(row === void 0 ? void 0 : chunkUVMSWO6X_cjs.rowToEdge(row));
|
|
17920
17949
|
};
|
|
17921
17950
|
if (autocommitSingleStatement) {
|
|
17922
|
-
return
|
|
17951
|
+
return chunkUVMSWO6X_cjs.runAutocommitSingleStatementWritePlan(
|
|
17923
17952
|
ctx,
|
|
17924
17953
|
opContext,
|
|
17925
17954
|
plan,
|
|
@@ -17932,12 +17961,12 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
17932
17961
|
);
|
|
17933
17962
|
}
|
|
17934
17963
|
if (options?.skipHooks === true) {
|
|
17935
|
-
return
|
|
17964
|
+
return chunkUVMSWO6X_cjs.runWritePlan(ctx, plan, backend, rowWork, {
|
|
17936
17965
|
schemaFenceInFirstWrite,
|
|
17937
17966
|
didWrite: edgeCreateDidWrite
|
|
17938
17967
|
});
|
|
17939
17968
|
}
|
|
17940
|
-
return
|
|
17969
|
+
return chunkUVMSWO6X_cjs.runHookedWritePlan(ctx, opContext, plan, backend, rowWork, {
|
|
17941
17970
|
schemaFenceInFirstWrite,
|
|
17942
17971
|
didWrite: edgeCreateDidWrite
|
|
17943
17972
|
});
|
|
@@ -17961,10 +17990,10 @@ async function executeEdgeCreate(ctx, input, backend) {
|
|
|
17961
17990
|
return result.edge;
|
|
17962
17991
|
}
|
|
17963
17992
|
function bindBatchNodeRead(ctx, backend) {
|
|
17964
|
-
const bound =
|
|
17993
|
+
const bound = chunkJ34FSPSC_cjs.bindExtraIfReachable(
|
|
17965
17994
|
backend,
|
|
17966
17995
|
ctx.batchPointRead.extras.getNodes,
|
|
17967
|
-
|
|
17996
|
+
chunkJ34FSPSC_cjs.BATCH_POINT_READ.id
|
|
17968
17997
|
);
|
|
17969
17998
|
if (bound === void 0) return;
|
|
17970
17999
|
return (kind, ids) => bound.getNodes(ctx.graphId, kind, ids);
|
|
@@ -17987,11 +18016,11 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
|
|
|
17987
18016
|
backend: validationBackend,
|
|
17988
18017
|
registerPendingEdgeForCardinality,
|
|
17989
18018
|
seedEndpointRow
|
|
17990
|
-
} =
|
|
18019
|
+
} = chunkUVMSWO6X_cjs.createEdgeBatchValidationBackend(backend);
|
|
17991
18020
|
await primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow);
|
|
17992
18021
|
const preparedCreates = [];
|
|
17993
18022
|
for (const input of inputs) {
|
|
17994
|
-
const id = input.id ??
|
|
18023
|
+
const id = input.id ?? chunkCYKHSH5O_cjs.generateId();
|
|
17995
18024
|
const prepared = await validateAndPrepareEdgeCreate(
|
|
17996
18025
|
ctx,
|
|
17997
18026
|
input,
|
|
@@ -18017,17 +18046,17 @@ async function prepareAtomicEdgeBatchCreates(ctx, inputs, backend) {
|
|
|
18017
18046
|
const prepared = await validateAndPrepareEdgeCreate(
|
|
18018
18047
|
ctx,
|
|
18019
18048
|
input,
|
|
18020
|
-
input.id ??
|
|
18049
|
+
input.id ?? chunkCYKHSH5O_cjs.generateId(),
|
|
18021
18050
|
backend,
|
|
18022
18051
|
{ validateEndpoints: false, validateCardinality: false }
|
|
18023
18052
|
);
|
|
18024
18053
|
preparedCreates.push(prepared);
|
|
18025
18054
|
const claim = edgeInsertWork(prepared).claim;
|
|
18026
18055
|
if (claim === void 0) continue;
|
|
18027
|
-
const target =
|
|
18056
|
+
const target = chunk36XLQHZA_cjs.edgeCardinalityClaimTarget(claim);
|
|
18028
18057
|
const targetKey = `${target.axis}\0${target.key}`;
|
|
18029
18058
|
if (claimedTargets.has(targetKey)) {
|
|
18030
|
-
throw
|
|
18059
|
+
throw chunk36XLQHZA_cjs.edgeCardinalityClaimRefusal(claim);
|
|
18031
18060
|
}
|
|
18032
18061
|
claimedTargets.add(targetKey);
|
|
18033
18062
|
claims.push(claim);
|
|
@@ -18035,8 +18064,8 @@ async function prepareAtomicEdgeBatchCreates(ctx, inputs, backend) {
|
|
|
18035
18064
|
return {
|
|
18036
18065
|
claims: claims.toSorted(
|
|
18037
18066
|
(left, right) => chunkOJHFXL7Y_cjs.compareClaimTargets(
|
|
18038
|
-
|
|
18039
|
-
|
|
18067
|
+
chunk36XLQHZA_cjs.edgeCardinalityClaimTarget(left),
|
|
18068
|
+
chunk36XLQHZA_cjs.edgeCardinalityClaimTarget(right)
|
|
18040
18069
|
)
|
|
18041
18070
|
),
|
|
18042
18071
|
preparedCreates
|
|
@@ -18136,7 +18165,7 @@ async function assertAtomicEdgeBatchCardinality(ctx, inputs, backend) {
|
|
|
18136
18165
|
const errors = await Promise.all(
|
|
18137
18166
|
window.map(async (input) => {
|
|
18138
18167
|
try {
|
|
18139
|
-
await
|
|
18168
|
+
await chunkUVMSWO6X_cjs.checkCardinalityConstraint(
|
|
18140
18169
|
constraintContext,
|
|
18141
18170
|
input.kind,
|
|
18142
18171
|
edgeCardinality(ctx, input.kind),
|
|
@@ -18165,7 +18194,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
|
|
|
18165
18194
|
graphId: ctx.graphId,
|
|
18166
18195
|
expectedVersion: chunkBXHAPCQG_cjs.requireDefined(ctx.schemaVersion)
|
|
18167
18196
|
};
|
|
18168
|
-
const result = await
|
|
18197
|
+
const result = await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation("edge", async () => {
|
|
18169
18198
|
try {
|
|
18170
18199
|
if (resultMode === "count") {
|
|
18171
18200
|
return await atomicExecutor({
|
|
@@ -18182,7 +18211,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
|
|
|
18182
18211
|
schemaFence
|
|
18183
18212
|
});
|
|
18184
18213
|
} catch (error) {
|
|
18185
|
-
if (error instanceof
|
|
18214
|
+
if (error instanceof chunkDGIA64DM_cjs.AtomicEdgeBatchEndpointRefusalError) {
|
|
18186
18215
|
await diagnoseAtomicEdgeBatchEndpointRefusal(
|
|
18187
18216
|
ctx,
|
|
18188
18217
|
inputs,
|
|
@@ -18190,7 +18219,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
|
|
|
18190
18219
|
error.cause
|
|
18191
18220
|
);
|
|
18192
18221
|
}
|
|
18193
|
-
if (error instanceof
|
|
18222
|
+
if (error instanceof chunkDGIA64DM_cjs.AtomicEdgeBatchCardinalityRefusalError) {
|
|
18194
18223
|
await assertAtomicEdgeBatchCardinality(ctx, inputs, backend);
|
|
18195
18224
|
throw new chunkASKXTVK5_cjs.DatabaseOperationError(
|
|
18196
18225
|
"Atomic edge batch refused a cardinality claim, but no current competing edge could be diagnosed.",
|
|
@@ -18206,7 +18235,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
|
|
|
18206
18235
|
});
|
|
18207
18236
|
const insertedCount = typeof result === "number" ? result : result.length;
|
|
18208
18237
|
if (insertedCount === 0) {
|
|
18209
|
-
await
|
|
18238
|
+
await chunkCYKHSH5O_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
|
|
18210
18239
|
await assertAtomicEdgeBatchEndpoints(ctx, inputs, backend);
|
|
18211
18240
|
}
|
|
18212
18241
|
if (insertedCount !== inputs.length) {
|
|
@@ -18219,11 +18248,11 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
|
|
|
18219
18248
|
}
|
|
18220
18249
|
);
|
|
18221
18250
|
}
|
|
18222
|
-
|
|
18251
|
+
chunkCYKHSH5O_cjs.memoizeLeasedSchemaFence(ctx, backend);
|
|
18223
18252
|
return result;
|
|
18224
18253
|
}
|
|
18225
18254
|
function assertDurableBatchRows(work, rows) {
|
|
18226
|
-
const outcomes =
|
|
18255
|
+
const outcomes = chunkUVMSWO6X_cjs.classifyDurableEdgeBatchOutcomes(
|
|
18227
18256
|
work.map((item) => item.params),
|
|
18228
18257
|
rows
|
|
18229
18258
|
);
|
|
@@ -18247,7 +18276,7 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
18247
18276
|
if (inputs.length === 0) {
|
|
18248
18277
|
return;
|
|
18249
18278
|
}
|
|
18250
|
-
const atomicExecutor =
|
|
18279
|
+
const atomicExecutor = chunkUVMSWO6X_cjs.resolveAtomicEdgeBatchExecutor({
|
|
18251
18280
|
backend,
|
|
18252
18281
|
graph: ctx.graph,
|
|
18253
18282
|
inputs,
|
|
@@ -18271,9 +18300,9 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
18271
18300
|
);
|
|
18272
18301
|
return;
|
|
18273
18302
|
}
|
|
18274
|
-
await
|
|
18303
|
+
await chunkUVMSWO6X_cjs.runWritePlan(
|
|
18275
18304
|
ctx,
|
|
18276
|
-
|
|
18305
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
|
|
18277
18306
|
backend,
|
|
18278
18307
|
async (session, target) => {
|
|
18279
18308
|
const { batchInsertWork } = await prepareEdgeBatchCreates(
|
|
@@ -18290,7 +18319,7 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
18290
18319
|
await executeEdgeCreateInternal(
|
|
18291
18320
|
ctx,
|
|
18292
18321
|
input,
|
|
18293
|
-
|
|
18322
|
+
chunkUVMSWO6X_cjs.nestedManagedWriteTarget(target),
|
|
18294
18323
|
{
|
|
18295
18324
|
returnRow: false,
|
|
18296
18325
|
skipHooks: true
|
|
@@ -18299,14 +18328,14 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
18299
18328
|
}
|
|
18300
18329
|
return;
|
|
18301
18330
|
}
|
|
18302
|
-
const rows = await
|
|
18331
|
+
const rows = await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation(
|
|
18303
18332
|
"edge",
|
|
18304
18333
|
() => chunkBXHAPCQG_cjs.requireDefined(session.createEdgesDurable)(batchInsertWork)
|
|
18305
18334
|
);
|
|
18306
18335
|
assertDurableBatchRows(batchInsertWork, rows);
|
|
18307
18336
|
return;
|
|
18308
18337
|
}
|
|
18309
|
-
await
|
|
18338
|
+
await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation(
|
|
18310
18339
|
"edge",
|
|
18311
18340
|
() => session.createEdgesNoReturn(batchInsertWork)
|
|
18312
18341
|
);
|
|
@@ -18317,7 +18346,7 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
|
18317
18346
|
if (inputs.length === 0) {
|
|
18318
18347
|
return [];
|
|
18319
18348
|
}
|
|
18320
|
-
const atomicExecutor =
|
|
18349
|
+
const atomicExecutor = chunkUVMSWO6X_cjs.resolveAtomicEdgeBatchExecutor({
|
|
18321
18350
|
backend,
|
|
18322
18351
|
graph: ctx.graph,
|
|
18323
18352
|
inputs,
|
|
@@ -18339,11 +18368,11 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
|
18339
18368
|
atomicExecutor,
|
|
18340
18369
|
"rows"
|
|
18341
18370
|
);
|
|
18342
|
-
return rows.map((row) =>
|
|
18371
|
+
return rows.map((row) => chunkUVMSWO6X_cjs.rowToEdge(row));
|
|
18343
18372
|
}
|
|
18344
|
-
return
|
|
18373
|
+
return chunkUVMSWO6X_cjs.runWritePlan(
|
|
18345
18374
|
ctx,
|
|
18346
|
-
|
|
18375
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
|
|
18347
18376
|
backend,
|
|
18348
18377
|
async (session, target) => {
|
|
18349
18378
|
const { batchInsertWork } = await prepareEdgeBatchCreates(
|
|
@@ -18361,7 +18390,7 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
|
18361
18390
|
const result = await executeEdgeCreateInternal(
|
|
18362
18391
|
ctx,
|
|
18363
18392
|
input,
|
|
18364
|
-
|
|
18393
|
+
chunkUVMSWO6X_cjs.nestedManagedWriteTarget(target),
|
|
18365
18394
|
{ returnRow: true, skipHooks: true }
|
|
18366
18395
|
);
|
|
18367
18396
|
if (result.outcome !== "created") {
|
|
@@ -18380,24 +18409,24 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
|
18380
18409
|
}
|
|
18381
18410
|
return fallbackRows;
|
|
18382
18411
|
}
|
|
18383
|
-
const rows2 = await
|
|
18412
|
+
const rows2 = await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation(
|
|
18384
18413
|
"edge",
|
|
18385
18414
|
() => chunkBXHAPCQG_cjs.requireDefined(session.createEdgesDurable)(batchInsertWork)
|
|
18386
18415
|
);
|
|
18387
18416
|
assertDurableBatchRows(batchInsertWork, rows2);
|
|
18388
|
-
return rows2.map((row) =>
|
|
18417
|
+
return rows2.map((row) => chunkUVMSWO6X_cjs.rowToEdge(row));
|
|
18389
18418
|
}
|
|
18390
|
-
const rows = await
|
|
18419
|
+
const rows = await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation(
|
|
18391
18420
|
"edge",
|
|
18392
18421
|
() => session.createEdges(batchInsertWork)
|
|
18393
18422
|
);
|
|
18394
|
-
return rows.map((row) =>
|
|
18423
|
+
return rows.map((row) => chunkUVMSWO6X_cjs.rowToEdge(row));
|
|
18395
18424
|
}
|
|
18396
18425
|
);
|
|
18397
18426
|
}
|
|
18398
18427
|
function batchFencesConstraintProbe(ctx, inputs) {
|
|
18399
18428
|
for (const input of inputs) {
|
|
18400
|
-
const reason =
|
|
18429
|
+
const reason = chunkUVMSWO6X_cjs.edgeWriteNeedsConstraintFence(
|
|
18401
18430
|
edgeCardinality(ctx, input.kind)
|
|
18402
18431
|
);
|
|
18403
18432
|
if (reason !== void 0) return reason;
|
|
@@ -18406,12 +18435,12 @@ function batchFencesConstraintProbe(ctx, inputs) {
|
|
|
18406
18435
|
}
|
|
18407
18436
|
function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
18408
18437
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
18409
|
-
const validatedProps =
|
|
18438
|
+
const validatedProps = chunkCYKHSH5O_cjs.validateEdgeProps(
|
|
18410
18439
|
registration.type.schema,
|
|
18411
18440
|
{ ...existingProps, ...inputProps },
|
|
18412
18441
|
{ kind, operation: "update", id }
|
|
18413
18442
|
);
|
|
18414
|
-
const identityRefusal =
|
|
18443
|
+
const identityRefusal = chunkUVMSWO6X_cjs.edgeMatchIdentityUpdateRefusal({
|
|
18415
18444
|
identity: registration.matchIdentity,
|
|
18416
18445
|
kind,
|
|
18417
18446
|
id,
|
|
@@ -18422,7 +18451,7 @@ function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
|
18422
18451
|
return validatedProps;
|
|
18423
18452
|
}
|
|
18424
18453
|
function resolveEdgeUpdateProps(ctx, existing, inputProps) {
|
|
18425
|
-
const existingProps =
|
|
18454
|
+
const existingProps = chunkJ34FSPSC_cjs.rowPropsToObject(existing.props);
|
|
18426
18455
|
const validatedProps = computeEdgeUpdate(
|
|
18427
18456
|
ctx,
|
|
18428
18457
|
existing.kind,
|
|
@@ -18447,7 +18476,7 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
|
|
|
18447
18476
|
}
|
|
18448
18477
|
async function performEdgeUpdate(ctx, input, session, target, options, resolvedExisting) {
|
|
18449
18478
|
const id = input.id;
|
|
18450
|
-
|
|
18479
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(input, {
|
|
18451
18480
|
entityType: "edge",
|
|
18452
18481
|
kind: input.identity.kind,
|
|
18453
18482
|
id
|
|
@@ -18473,7 +18502,7 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
|
|
|
18473
18502
|
const preservesLiveLowerBound = options?.clearDeleted !== true && chunkNI2XPJQ2_cjs.preservesImmutableLowerBound(input.onImmutableLowerBound);
|
|
18474
18503
|
const appliedValidFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
|
|
18475
18504
|
const validTo = chunkNI2XPJQ2_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
18476
|
-
const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo :
|
|
18505
|
+
const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : chunkUVMSWO6X_cjs.validityEndAfterMutation(
|
|
18477
18506
|
input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
|
|
18478
18507
|
existing.valid_to
|
|
18479
18508
|
);
|
|
@@ -18482,7 +18511,7 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
|
|
|
18482
18511
|
let reentryClaim;
|
|
18483
18512
|
const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
|
|
18484
18513
|
if (reentersLivePopulation || reentersActivePopulation) {
|
|
18485
|
-
await
|
|
18514
|
+
await chunkUVMSWO6X_cjs.checkCardinalityConstraint(
|
|
18486
18515
|
{
|
|
18487
18516
|
graphId: ctx.graphId,
|
|
18488
18517
|
registry: ctx.registry,
|
|
@@ -18496,7 +18525,7 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
|
|
|
18496
18525
|
existing.to_id,
|
|
18497
18526
|
effectiveValidTo
|
|
18498
18527
|
);
|
|
18499
|
-
reentryClaim =
|
|
18528
|
+
reentryClaim = chunk36XLQHZA_cjs.edgeCardinalityClaim(cardinality, {
|
|
18500
18529
|
graphId: ctx.graphId,
|
|
18501
18530
|
id,
|
|
18502
18531
|
kind: input.identity.kind,
|
|
@@ -18543,10 +18572,10 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
|
|
|
18543
18572
|
// "Did this write assert any window state?" is one predicate with one
|
|
18544
18573
|
// owner, consulted here and by the fence appliers that carry it, rather
|
|
18545
18574
|
// than re-derived from the params the diagnosis never sees.
|
|
18546
|
-
|
|
18575
|
+
chunkUVMSWO6X_cjs.assertsStoredWindowState(fences),
|
|
18547
18576
|
() => session.reviseEdge(work, fences)
|
|
18548
18577
|
);
|
|
18549
|
-
return
|
|
18578
|
+
return chunkUVMSWO6X_cjs.rowToEdge(row);
|
|
18550
18579
|
}
|
|
18551
18580
|
var EDGE_UPDATE_ATTEMPTS = 2;
|
|
18552
18581
|
async function performEdgeUpdateConverging(ctx, input, session, target, options, resolvedExisting) {
|
|
@@ -18582,7 +18611,7 @@ function resolveAtomicEdgeUpdateExecutor(ctx, entries, backend) {
|
|
|
18582
18611
|
)) {
|
|
18583
18612
|
return;
|
|
18584
18613
|
}
|
|
18585
|
-
return
|
|
18614
|
+
return chunkUVMSWO6X_cjs.resolveAtomicEdgeResolvedUpdateBatchExecutor({
|
|
18586
18615
|
backend,
|
|
18587
18616
|
graph: ctx.graph,
|
|
18588
18617
|
schemaVersion: ctx.schemaVersion,
|
|
@@ -18606,7 +18635,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
18606
18635
|
);
|
|
18607
18636
|
const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
|
|
18608
18637
|
if (input.clearValidTo === true) {
|
|
18609
|
-
|
|
18638
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "edge");
|
|
18610
18639
|
}
|
|
18611
18640
|
const atomicEntry = {
|
|
18612
18641
|
input,
|
|
@@ -18619,7 +18648,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
18619
18648
|
backend
|
|
18620
18649
|
);
|
|
18621
18650
|
if (atomicExecutor !== void 0) {
|
|
18622
|
-
return
|
|
18651
|
+
return chunkUVMSWO6X_cjs.runAtomicProgramWithHooks(
|
|
18623
18652
|
ctx,
|
|
18624
18653
|
opContext,
|
|
18625
18654
|
async () => {
|
|
@@ -18631,36 +18660,36 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
18631
18660
|
);
|
|
18632
18661
|
return chunkBXHAPCQG_cjs.requireDefined(edges[0]);
|
|
18633
18662
|
},
|
|
18634
|
-
|
|
18663
|
+
chunkUVMSWO6X_cjs.writeResultAlwaysChanges
|
|
18635
18664
|
);
|
|
18636
18665
|
}
|
|
18637
|
-
return
|
|
18666
|
+
return chunkUVMSWO6X_cjs.runHookedWritePlan(
|
|
18638
18667
|
ctx,
|
|
18639
18668
|
opContext,
|
|
18640
18669
|
// An in-place props update on a live edge re-derives no constraint verdict.
|
|
18641
18670
|
// Clearing an `oneActive` edge's end DOES: it re-admits the row to the
|
|
18642
18671
|
// counted active population.
|
|
18643
|
-
|
|
18644
|
-
input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ?
|
|
18672
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(
|
|
18673
|
+
input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? chunkUVMSWO6X_cjs.edgeWriteNeedsConstraintFence("oneActive") : void 0
|
|
18645
18674
|
),
|
|
18646
18675
|
backend,
|
|
18647
18676
|
(session, target) => performEdgeUpdateConverging(ctx, input, session, target),
|
|
18648
|
-
{ didWrite:
|
|
18677
|
+
{ didWrite: chunkUVMSWO6X_cjs.writeResultAlwaysChanges }
|
|
18649
18678
|
);
|
|
18650
18679
|
}
|
|
18651
18680
|
async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
|
|
18652
18681
|
if (input.clearValidTo === true) {
|
|
18653
|
-
|
|
18682
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "edge");
|
|
18654
18683
|
}
|
|
18655
|
-
return
|
|
18684
|
+
return chunkUVMSWO6X_cjs.runWritePlan(
|
|
18656
18685
|
ctx,
|
|
18657
18686
|
// An in-place props update re-derives no constraint verdict: endpoints
|
|
18658
18687
|
// are immutable, so cardinality cannot change under it. A coalescing upsert
|
|
18659
18688
|
// converges on a match key no database key backs; a resurrect or a cleared
|
|
18660
18689
|
// end re-admits the row to the counted population its cardinality
|
|
18661
18690
|
// constrains.
|
|
18662
|
-
|
|
18663
|
-
options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ?
|
|
18691
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(
|
|
18692
|
+
options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? chunkUVMSWO6X_cjs.edgeWriteNeedsConstraintFence(edgeCardinality(ctx, input.identity.kind)) : void 0
|
|
18664
18693
|
),
|
|
18665
18694
|
backend,
|
|
18666
18695
|
async (session, target) => {
|
|
@@ -18680,11 +18709,11 @@ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options)
|
|
|
18680
18709
|
ctx,
|
|
18681
18710
|
existing.kind,
|
|
18682
18711
|
existing.id,
|
|
18683
|
-
|
|
18712
|
+
chunkJ34FSPSC_cjs.rowPropsToObject(existing.props),
|
|
18684
18713
|
input.props
|
|
18685
18714
|
);
|
|
18686
18715
|
if (shouldCoalesceUpsert(existing, input, runDirtyCheck)) {
|
|
18687
|
-
return { edge:
|
|
18716
|
+
return { edge: chunkUVMSWO6X_cjs.rowToEdge(existing), wrote: false };
|
|
18688
18717
|
}
|
|
18689
18718
|
}
|
|
18690
18719
|
}
|
|
@@ -18713,10 +18742,10 @@ async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
|
|
|
18713
18742
|
}
|
|
18714
18743
|
async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
|
|
18715
18744
|
if (creates.length === 0 || updates.length === 0) {
|
|
18716
|
-
return
|
|
18745
|
+
return chunkUVMSWO6X_cjs.unsupportedResolvedMutationSet();
|
|
18717
18746
|
}
|
|
18718
18747
|
const firstUpdate = chunkBXHAPCQG_cjs.requireDefined(updates[0]);
|
|
18719
|
-
const executor =
|
|
18748
|
+
const executor = chunkUVMSWO6X_cjs.resolveAtomicEdgeResolvedMutationSetExecutor({
|
|
18720
18749
|
backend,
|
|
18721
18750
|
graph: ctx.graph,
|
|
18722
18751
|
schemaVersion: ctx.schemaVersion,
|
|
@@ -18726,18 +18755,18 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
|
|
|
18726
18755
|
creates,
|
|
18727
18756
|
updateCount: updates.length
|
|
18728
18757
|
});
|
|
18729
|
-
if (executor === void 0) return
|
|
18758
|
+
if (executor === void 0) return chunkUVMSWO6X_cjs.unsupportedResolvedMutationSet();
|
|
18730
18759
|
const ids = /* @__PURE__ */ new Set([
|
|
18731
18760
|
...creates.map((input) => chunkBXHAPCQG_cjs.requireDefined(input.id)),
|
|
18732
18761
|
...updates.map((entry2) => entry2.input.id)
|
|
18733
18762
|
]);
|
|
18734
18763
|
if (ids.size !== creates.length + updates.length) {
|
|
18735
|
-
return
|
|
18764
|
+
return chunkUVMSWO6X_cjs.unsupportedResolvedMutationSet();
|
|
18736
18765
|
}
|
|
18737
18766
|
if (updates.some(
|
|
18738
18767
|
(entry2) => entry2.clearDeleted || entry2.existing === void 0 || entry2.input.validFrom !== void 0 || entry2.input.validTo !== void 0 || entry2.input.clearValidTo === true
|
|
18739
18768
|
)) {
|
|
18740
|
-
return
|
|
18769
|
+
return chunkUVMSWO6X_cjs.unsupportedResolvedMutationSet();
|
|
18741
18770
|
}
|
|
18742
18771
|
const preparation = await prepareAtomicEdgeBatchCreates(
|
|
18743
18772
|
ctx,
|
|
@@ -18767,7 +18796,7 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
|
|
|
18767
18796
|
);
|
|
18768
18797
|
return { existing, props: validatedProps };
|
|
18769
18798
|
});
|
|
18770
|
-
const result = await
|
|
18799
|
+
const result = await chunkUVMSWO6X_cjs.withAlreadyExistsTranslation("edge", async () => {
|
|
18771
18800
|
try {
|
|
18772
18801
|
return await executor({
|
|
18773
18802
|
kind: "resolved-set",
|
|
@@ -18779,7 +18808,7 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
|
|
|
18779
18808
|
}
|
|
18780
18809
|
});
|
|
18781
18810
|
} catch (error) {
|
|
18782
|
-
if (error instanceof
|
|
18811
|
+
if (error instanceof chunkDGIA64DM_cjs.AtomicEdgeBatchEndpointRefusalError) {
|
|
18783
18812
|
await diagnoseAtomicEdgeBatchEndpointRefusal(
|
|
18784
18813
|
ctx,
|
|
18785
18814
|
creates,
|
|
@@ -18791,23 +18820,23 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
|
|
|
18791
18820
|
}
|
|
18792
18821
|
});
|
|
18793
18822
|
if (result.created.length === 0 && result.updated.length === 0) {
|
|
18794
|
-
await
|
|
18795
|
-
throw new
|
|
18823
|
+
await chunkCYKHSH5O_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
|
|
18824
|
+
throw new chunkUVMSWO6X_cjs.ResolvedMutationSetMoved("edge", executor);
|
|
18796
18825
|
}
|
|
18797
18826
|
if (result.created.length !== creates.length || result.updated.length !== updates.length) {
|
|
18798
18827
|
throw new chunkASKXTVK5_cjs.CompilerInvariantError(
|
|
18799
18828
|
"Atomic resolved edge mutation set returned a partial result."
|
|
18800
18829
|
);
|
|
18801
18830
|
}
|
|
18802
|
-
|
|
18831
|
+
chunkCYKHSH5O_cjs.memoizeLeasedSchemaFence(ctx, backend);
|
|
18803
18832
|
const createdById = new Map(result.created.map((row) => [row.id, row]));
|
|
18804
18833
|
const updatedById = new Map(result.updated.map((row) => [row.id, row]));
|
|
18805
|
-
return
|
|
18834
|
+
return chunkUVMSWO6X_cjs.appliedResolvedMutationSet({
|
|
18806
18835
|
created: creates.map(
|
|
18807
|
-
(input) =>
|
|
18836
|
+
(input) => chunkUVMSWO6X_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(createdById.get(chunkBXHAPCQG_cjs.requireDefined(input.id))))
|
|
18808
18837
|
),
|
|
18809
18838
|
updated: updates.map(
|
|
18810
|
-
(entry2) =>
|
|
18839
|
+
(entry2) => chunkUVMSWO6X_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(updatedById.get(entry2.input.id)))
|
|
18811
18840
|
)
|
|
18812
18841
|
});
|
|
18813
18842
|
}
|
|
@@ -18815,7 +18844,7 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
|
|
|
18815
18844
|
if (entries.length === 0) return [];
|
|
18816
18845
|
for (const entry2 of entries) {
|
|
18817
18846
|
if (entry2.input.clearValidTo === true) {
|
|
18818
|
-
|
|
18847
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "edge");
|
|
18819
18848
|
}
|
|
18820
18849
|
}
|
|
18821
18850
|
const first = chunkBXHAPCQG_cjs.requireDefined(entries[0]);
|
|
@@ -18832,16 +18861,16 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
|
|
|
18832
18861
|
const needsConstraintFence = entries.some(
|
|
18833
18862
|
(entry2) => entry2.clearDeleted || entry2.input.clearValidTo === true
|
|
18834
18863
|
);
|
|
18835
|
-
return
|
|
18864
|
+
return chunkUVMSWO6X_cjs.runWritePlan(
|
|
18836
18865
|
ctx,
|
|
18837
|
-
|
|
18838
|
-
needsConstraintFence ?
|
|
18866
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(
|
|
18867
|
+
needsConstraintFence ? chunkUVMSWO6X_cjs.edgeWriteNeedsConstraintFence(
|
|
18839
18868
|
edgeCardinality(ctx, first.input.identity.kind)
|
|
18840
18869
|
) : void 0
|
|
18841
18870
|
),
|
|
18842
18871
|
backend,
|
|
18843
18872
|
async (session, target) => {
|
|
18844
|
-
const resolvedRows = target.capabilities.execution.interactiveTransactions && distinctIds.size === entries.length ? await
|
|
18873
|
+
const resolvedRows = target.capabilities.execution.interactiveTransactions && distinctIds.size === entries.length ? await chunkCYKHSH5O_cjs.getEdgeRowsByIds(target, ctx.batchPointRead, ctx.graphId, [
|
|
18845
18874
|
...distinctIds
|
|
18846
18875
|
]) : void 0;
|
|
18847
18876
|
const edges = [];
|
|
@@ -18859,11 +18888,11 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
|
|
|
18859
18888
|
}
|
|
18860
18889
|
return edges;
|
|
18861
18890
|
},
|
|
18862
|
-
{ didWrite:
|
|
18891
|
+
{ didWrite: chunkUVMSWO6X_cjs.writeResultAlwaysChanges }
|
|
18863
18892
|
);
|
|
18864
18893
|
}
|
|
18865
18894
|
async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExecutor) {
|
|
18866
|
-
const maxAttempts =
|
|
18895
|
+
const maxAttempts = chunkUVMSWO6X_cjs.atomicResolvedUpdateAttemptBudget(
|
|
18867
18896
|
entries.length,
|
|
18868
18897
|
EDGE_UPDATE_ATTEMPTS
|
|
18869
18898
|
);
|
|
@@ -18872,7 +18901,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
|
|
|
18872
18901
|
const supplied = entries.flatMap(
|
|
18873
18902
|
(entry2) => entry2.existing === void 0 ? [] : [entry2.existing]
|
|
18874
18903
|
);
|
|
18875
|
-
const fetched = supplied.length === entries.length ? void 0 : await
|
|
18904
|
+
const fetched = supplied.length === entries.length ? void 0 : await chunkCYKHSH5O_cjs.getEdgeRowsByIds(backend, ctx.batchPointRead, ctx.graphId, [
|
|
18876
18905
|
...distinctIds
|
|
18877
18906
|
]);
|
|
18878
18907
|
let existing = fetched === void 0 ? supplied : [...fetched.values()];
|
|
@@ -18908,10 +18937,10 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
|
|
|
18908
18937
|
}
|
|
18909
18938
|
});
|
|
18910
18939
|
if (rows.length === entries.length) {
|
|
18911
|
-
|
|
18940
|
+
chunkCYKHSH5O_cjs.memoizeLeasedSchemaFence(ctx, backend);
|
|
18912
18941
|
const returned = new Map(rows.map((row) => [row.id, row]));
|
|
18913
18942
|
return entries.map(
|
|
18914
|
-
(entry2) =>
|
|
18943
|
+
(entry2) => chunkUVMSWO6X_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(returned.get(entry2.input.id)))
|
|
18915
18944
|
);
|
|
18916
18945
|
}
|
|
18917
18946
|
if (rows.length > 0) {
|
|
@@ -18920,7 +18949,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
|
|
|
18920
18949
|
{ expected: entries.length, actual: rows.length }
|
|
18921
18950
|
);
|
|
18922
18951
|
}
|
|
18923
|
-
await
|
|
18952
|
+
await chunkCYKHSH5O_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
|
|
18924
18953
|
if (attempt === maxAttempts) {
|
|
18925
18954
|
throw new chunkASKXTVK5_cjs.DatabaseOperationError(
|
|
18926
18955
|
`Atomic edge update could not be applied to stable rows after ${maxAttempts} attempts.`,
|
|
@@ -18934,7 +18963,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
|
|
|
18934
18963
|
}
|
|
18935
18964
|
);
|
|
18936
18965
|
}
|
|
18937
|
-
const refreshed = await
|
|
18966
|
+
const refreshed = await chunkCYKHSH5O_cjs.getEdgeRowsByIds(
|
|
18938
18967
|
backend,
|
|
18939
18968
|
ctx.batchPointRead,
|
|
18940
18969
|
ctx.graphId,
|
|
@@ -18957,7 +18986,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
|
|
|
18957
18986
|
);
|
|
18958
18987
|
if (gate.deleted_at) return;
|
|
18959
18988
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
18960
|
-
const atomicExecutor =
|
|
18989
|
+
const atomicExecutor = chunkUVMSWO6X_cjs.resolveAtomicEdgeDeleteBatchExecutor({
|
|
18961
18990
|
backend,
|
|
18962
18991
|
graph: ctx.graph,
|
|
18963
18992
|
expectedKind,
|
|
@@ -18967,7 +18996,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
|
|
|
18967
18996
|
revisionTrackingEnabled: ctx.revisionTrackingEnabled
|
|
18968
18997
|
});
|
|
18969
18998
|
if (atomicExecutor !== void 0) {
|
|
18970
|
-
await
|
|
18999
|
+
await chunkUVMSWO6X_cjs.runAtomicProgramWithHooks(
|
|
18971
19000
|
ctx,
|
|
18972
19001
|
opContext,
|
|
18973
19002
|
() => executeAtomicEdgeDeletes(
|
|
@@ -18981,11 +19010,11 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
|
|
|
18981
19010
|
);
|
|
18982
19011
|
return;
|
|
18983
19012
|
}
|
|
18984
|
-
return
|
|
19013
|
+
return chunkUVMSWO6X_cjs.runHookedWritePlan(
|
|
18985
19014
|
ctx,
|
|
18986
19015
|
opContext,
|
|
18987
19016
|
// A soft delete decides nothing a concurrent write could invalidate.
|
|
18988
|
-
|
|
19017
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(void 0),
|
|
18989
19018
|
backend,
|
|
18990
19019
|
async (session) => {
|
|
18991
19020
|
await session.retireEdge({ id, kind: expectedKind });
|
|
@@ -18993,7 +19022,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
|
|
|
18993
19022
|
);
|
|
18994
19023
|
}
|
|
18995
19024
|
async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
|
|
18996
|
-
const atomicExecutor =
|
|
19025
|
+
const atomicExecutor = chunkUVMSWO6X_cjs.resolveAtomicEdgeDeleteBatchExecutor({
|
|
18997
19026
|
backend,
|
|
18998
19027
|
graph: ctx.graph,
|
|
18999
19028
|
expectedKind,
|
|
@@ -19012,12 +19041,12 @@ async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
|
|
|
19012
19041
|
);
|
|
19013
19042
|
return;
|
|
19014
19043
|
}
|
|
19015
|
-
await
|
|
19044
|
+
await chunkUVMSWO6X_cjs.runWritePlan(
|
|
19016
19045
|
ctx,
|
|
19017
|
-
|
|
19046
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(void 0),
|
|
19018
19047
|
backend,
|
|
19019
19048
|
async (session, target) => {
|
|
19020
|
-
const rowsById = await
|
|
19049
|
+
const rowsById = await chunkCYKHSH5O_cjs.getEdgeRowsByIds(
|
|
19021
19050
|
target,
|
|
19022
19051
|
ctx.batchPointRead,
|
|
19023
19052
|
ctx.graphId,
|
|
@@ -19056,7 +19085,7 @@ async function executeAtomicEdgeDeletes(ctx, expectedKind, ids, backend, atomicE
|
|
|
19056
19085
|
expectedVersion: chunkBXHAPCQG_cjs.requireDefined(ctx.schemaVersion)
|
|
19057
19086
|
}
|
|
19058
19087
|
});
|
|
19059
|
-
await
|
|
19088
|
+
await chunkUVMSWO6X_cjs.assertAtomicDeleteSchemaFenceMatched(
|
|
19060
19089
|
result.schemaFenceMatched,
|
|
19061
19090
|
ctx,
|
|
19062
19091
|
backend,
|
|
@@ -19064,8 +19093,8 @@ async function executeAtomicEdgeDeletes(ctx, expectedKind, ids, backend, atomicE
|
|
|
19064
19093
|
);
|
|
19065
19094
|
return result.affectedCount;
|
|
19066
19095
|
} catch (error) {
|
|
19067
|
-
if (!(error instanceof
|
|
19068
|
-
const rowsById = await
|
|
19096
|
+
if (!(error instanceof chunkDGIA64DM_cjs.AtomicEdgeDeleteIdentityRefusalError)) throw error;
|
|
19097
|
+
const rowsById = await chunkCYKHSH5O_cjs.getEdgeRowsByIds(
|
|
19069
19098
|
backend,
|
|
19070
19099
|
ctx.batchPointRead,
|
|
19071
19100
|
ctx.graphId,
|
|
@@ -19098,10 +19127,10 @@ async function executeEdgeHardDelete(ctx, expectedKind, id, backend) {
|
|
|
19098
19127
|
"hardDelete"
|
|
19099
19128
|
);
|
|
19100
19129
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
19101
|
-
return
|
|
19130
|
+
return chunkUVMSWO6X_cjs.runHookedWritePlan(
|
|
19102
19131
|
ctx,
|
|
19103
19132
|
opContext,
|
|
19104
|
-
|
|
19133
|
+
chunkUVMSWO6X_cjs.edgeWritePlan(void 0),
|
|
19105
19134
|
backend,
|
|
19106
19135
|
async (session) => {
|
|
19107
19136
|
await session.purgeEdge({
|
|
@@ -19168,9 +19197,9 @@ function findMatchingEdge(rows, matchOn, inputProps) {
|
|
|
19168
19197
|
let deletedRow;
|
|
19169
19198
|
for (const row of rows) {
|
|
19170
19199
|
if (matchOn.length > 0) {
|
|
19171
|
-
const rowProps =
|
|
19200
|
+
const rowProps = chunkJ34FSPSC_cjs.rowPropsToObject(row.props);
|
|
19172
19201
|
const matches = matchOn.every(
|
|
19173
|
-
(field2) =>
|
|
19202
|
+
(field2) => chunkUVMSWO6X_cjs.canonicalPersistedJsonValue(chunkBXHAPCQG_cjs.readOwnProperty(rowProps, field2)) === chunkUVMSWO6X_cjs.canonicalPersistedJsonValue(chunkBXHAPCQG_cjs.readOwnProperty(inputProps, field2))
|
|
19174
19203
|
);
|
|
19175
19204
|
if (!matches) continue;
|
|
19176
19205
|
}
|
|
@@ -19191,7 +19220,7 @@ function assertEdgeMatchKey(row, matchOn, matchProps) {
|
|
|
19191
19220
|
}
|
|
19192
19221
|
async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, backend, options) {
|
|
19193
19222
|
const matchOn = options?.matchOn ?? [];
|
|
19194
|
-
const matchProps =
|
|
19223
|
+
const matchProps = chunkUVMSWO6X_cjs.normalizePersistedEdgeMatchProps(options?.props ?? {});
|
|
19195
19224
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
19196
19225
|
const edgeKind = registration.type;
|
|
19197
19226
|
if (matchOn.length > 0) {
|
|
@@ -19211,9 +19240,9 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
|
|
|
19211
19240
|
...options?.asOf !== void 0 && { asOf: options.asOf }
|
|
19212
19241
|
});
|
|
19213
19242
|
if (candidateRows.length === 0) return void 0;
|
|
19214
|
-
if (matchOn.length === 0) return
|
|
19243
|
+
if (matchOn.length === 0) return chunkUVMSWO6X_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(candidateRows[0]));
|
|
19215
19244
|
const { liveRow } = findMatchingEdge(candidateRows, matchOn, matchProps);
|
|
19216
|
-
return liveRow === void 0 ? void 0 :
|
|
19245
|
+
return liveRow === void 0 ? void 0 : chunkUVMSWO6X_cjs.rowToEdge(liveRow);
|
|
19217
19246
|
}
|
|
19218
19247
|
function defersEndpointWindowOrdering(ifExists, onImmutableLowerBound) {
|
|
19219
19248
|
return ifExists === "update" && chunkNI2XPJQ2_cjs.preservesImmutableLowerBound(onImmutableLowerBound);
|
|
@@ -19238,15 +19267,15 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
19238
19267
|
registration.matchIdentity?.fields,
|
|
19239
19268
|
options?.matchOn
|
|
19240
19269
|
);
|
|
19241
|
-
|
|
19270
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
|
|
19242
19271
|
if (options?.clearValidTo === true) {
|
|
19243
|
-
|
|
19272
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "edge");
|
|
19244
19273
|
}
|
|
19245
|
-
const validatedProps =
|
|
19274
|
+
const validatedProps = chunkCYKHSH5O_cjs.validateEdgeProps(edgeKind.schema, props, {
|
|
19246
19275
|
kind,
|
|
19247
19276
|
operation: "create"
|
|
19248
19277
|
});
|
|
19249
|
-
const matchProps =
|
|
19278
|
+
const matchProps = chunkUVMSWO6X_cjs.normalizePersistedEdgeMatchProps(validatedProps);
|
|
19250
19279
|
validateMatchOnFields(edgeKind.schema, matchOn, kind);
|
|
19251
19280
|
const validFrom = chunkNI2XPJQ2_cjs.validateStatedValidityLowerBound(
|
|
19252
19281
|
options?.validFrom,
|
|
@@ -19271,7 +19300,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
19271
19300
|
temporalMode: "includeTombstones"
|
|
19272
19301
|
});
|
|
19273
19302
|
async function findCandidatesInTransaction() {
|
|
19274
|
-
return
|
|
19303
|
+
return chunkJ34FSPSC_cjs.runOptionallyInTransaction(
|
|
19275
19304
|
backend,
|
|
19276
19305
|
(target) => findCandidates(target),
|
|
19277
19306
|
{ transaction: { accessMode: "read_only" } }
|
|
@@ -19290,7 +19319,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
19290
19319
|
);
|
|
19291
19320
|
if (currentLiveRow !== void 0) {
|
|
19292
19321
|
assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
|
|
19293
|
-
return { edge:
|
|
19322
|
+
return { edge: chunkUVMSWO6X_cjs.rowToEdge(currentLiveRow), action: "found" };
|
|
19294
19323
|
}
|
|
19295
19324
|
initialCandidateRead = {
|
|
19296
19325
|
rows: currentRows,
|
|
@@ -19307,7 +19336,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
19307
19336
|
if (!isDeleted) {
|
|
19308
19337
|
if (ifExists === "return") {
|
|
19309
19338
|
assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
|
|
19310
|
-
return { edge:
|
|
19339
|
+
return { edge: chunkUVMSWO6X_cjs.rowToEdge(matchedRow), action: "found" };
|
|
19311
19340
|
}
|
|
19312
19341
|
const outcome = await executeEdgeUpsertUpdateWithOutcome(
|
|
19313
19342
|
ctx,
|
|
@@ -19333,7 +19362,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
19333
19362
|
ctx,
|
|
19334
19363
|
matchedRow.kind,
|
|
19335
19364
|
matchedRow.id,
|
|
19336
|
-
|
|
19365
|
+
chunkJ34FSPSC_cjs.rowPropsToObject(matchedRow.props),
|
|
19337
19366
|
validatedProps
|
|
19338
19367
|
)
|
|
19339
19368
|
),
|
|
@@ -19502,7 +19531,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19502
19531
|
const ifExists = options?.ifExists ?? "return";
|
|
19503
19532
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
19504
19533
|
const edgeKind = registration.type;
|
|
19505
|
-
|
|
19534
|
+
chunkXXEFDJHY_cjs.assertEdgeMatchIdentityBackendSupport(
|
|
19506
19535
|
registration.matchIdentity,
|
|
19507
19536
|
backend.capabilities,
|
|
19508
19537
|
kind
|
|
@@ -19515,15 +19544,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19515
19544
|
validateMatchOnFields(edgeKind.schema, matchOn, kind);
|
|
19516
19545
|
const validated = [];
|
|
19517
19546
|
for (const item of items) {
|
|
19518
|
-
|
|
19547
|
+
chunkUVMSWO6X_cjs.assertValidityEndMutation(item, { entityType: "edge", kind });
|
|
19519
19548
|
if (item.clearValidTo === true) {
|
|
19520
|
-
|
|
19549
|
+
chunkUVMSWO6X_cjs.assertClearValidToSupported(backend, "edge");
|
|
19521
19550
|
}
|
|
19522
|
-
const validatedProps =
|
|
19551
|
+
const validatedProps = chunkCYKHSH5O_cjs.validateEdgeProps(edgeKind.schema, item.props, {
|
|
19523
19552
|
kind,
|
|
19524
19553
|
operation: "create"
|
|
19525
19554
|
});
|
|
19526
|
-
const matchProps =
|
|
19555
|
+
const matchProps = chunkUVMSWO6X_cjs.normalizePersistedEdgeMatchProps(validatedProps);
|
|
19527
19556
|
const validFrom = chunkNI2XPJQ2_cjs.validateStatedValidityLowerBound(
|
|
19528
19557
|
item.validFrom,
|
|
19529
19558
|
"validFrom"
|
|
@@ -19536,7 +19565,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19536
19565
|
validTo
|
|
19537
19566
|
);
|
|
19538
19567
|
}
|
|
19539
|
-
const compositeKey =
|
|
19568
|
+
const compositeKey = chunkUVMSWO6X_cjs.buildEdgeMatchKey({
|
|
19540
19569
|
fromKind: item.fromKind,
|
|
19541
19570
|
fromId: item.fromId,
|
|
19542
19571
|
toKind: item.toKind,
|
|
@@ -19567,7 +19596,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19567
19596
|
}
|
|
19568
19597
|
});
|
|
19569
19598
|
}
|
|
19570
|
-
const atomicConvergenceExecutor =
|
|
19599
|
+
const atomicConvergenceExecutor = chunkUVMSWO6X_cjs.resolveAtomicEdgeConvergenceExecutor({
|
|
19571
19600
|
backend,
|
|
19572
19601
|
graph: ctx.graph,
|
|
19573
19602
|
schemaVersion: ctx.schemaVersion,
|
|
@@ -19593,7 +19622,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19593
19622
|
ctx.registry
|
|
19594
19623
|
);
|
|
19595
19624
|
if (endpointError) throw endpointError;
|
|
19596
|
-
const matchIdentity =
|
|
19625
|
+
const matchIdentity = chunkUVMSWO6X_cjs.resolveEdgeMatchIdentityStorage(
|
|
19597
19626
|
registration.matchIdentity,
|
|
19598
19627
|
{
|
|
19599
19628
|
fromKind: entry2.fromKind,
|
|
@@ -19612,7 +19641,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19612
19641
|
}
|
|
19613
19642
|
const params = buildInsertEdgeParams(
|
|
19614
19643
|
ctx.graphId,
|
|
19615
|
-
|
|
19644
|
+
chunkCYKHSH5O_cjs.generateId(),
|
|
19616
19645
|
kind,
|
|
19617
19646
|
entry2.fromKind,
|
|
19618
19647
|
entry2.fromId,
|
|
@@ -19645,7 +19674,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19645
19674
|
schemaFence
|
|
19646
19675
|
});
|
|
19647
19676
|
} catch (error) {
|
|
19648
|
-
if (error instanceof
|
|
19677
|
+
if (error instanceof chunkDGIA64DM_cjs.AtomicEdgeBatchEndpointRefusalError) {
|
|
19649
19678
|
await diagnoseAtomicEdgeBatchEndpointRefusal(
|
|
19650
19679
|
ctx,
|
|
19651
19680
|
nativeEntries.map((entry2) => entry2.params),
|
|
@@ -19653,7 +19682,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19653
19682
|
error.cause
|
|
19654
19683
|
);
|
|
19655
19684
|
}
|
|
19656
|
-
if (error instanceof
|
|
19685
|
+
if (error instanceof chunkDGIA64DM_cjs.AtomicEdgeConvergenceTombstoneRefusalError) {
|
|
19657
19686
|
nativeResults = void 0;
|
|
19658
19687
|
} else {
|
|
19659
19688
|
throw error;
|
|
@@ -19661,7 +19690,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19661
19690
|
}
|
|
19662
19691
|
if (nativeResults !== void 0) {
|
|
19663
19692
|
if (nativeResults.length !== nativeEntries.length) {
|
|
19664
|
-
await
|
|
19693
|
+
await chunkCYKHSH5O_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
|
|
19665
19694
|
throw new chunkASKXTVK5_cjs.DatabaseOperationError(
|
|
19666
19695
|
`Atomic edge convergence returned ${nativeResults.length} results, expected ${nativeEntries.length}.`,
|
|
19667
19696
|
{ operation: "insert", entity: "edge" }
|
|
@@ -19672,7 +19701,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19672
19701
|
for (const [nativeIndex, nativeResult] of nativeResults.entries()) {
|
|
19673
19702
|
const nativeEntry = chunkBXHAPCQG_cjs.requireDefined(nativeEntries[nativeIndex]);
|
|
19674
19703
|
const result = {
|
|
19675
|
-
edge:
|
|
19704
|
+
edge: chunkUVMSWO6X_cjs.rowToEdge(nativeResult.row),
|
|
19676
19705
|
action: nativeResult.outcome
|
|
19677
19706
|
};
|
|
19678
19707
|
results[nativeEntry.index] = result;
|
|
@@ -19844,7 +19873,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19844
19873
|
const found = Array.from({ length: items.length });
|
|
19845
19874
|
for (const entry2 of partition.toFetch) {
|
|
19846
19875
|
assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
|
|
19847
|
-
found[entry2.index] = { edge:
|
|
19876
|
+
found[entry2.index] = { edge: chunkUVMSWO6X_cjs.rowToEdge(entry2.row), action: "found" };
|
|
19848
19877
|
}
|
|
19849
19878
|
for (const { index, sourceIndex } of partition.duplicateOf) {
|
|
19850
19879
|
found[index] = {
|
|
@@ -19861,15 +19890,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19861
19890
|
if (found !== void 0) return found;
|
|
19862
19891
|
}
|
|
19863
19892
|
function runBatch() {
|
|
19864
|
-
return
|
|
19893
|
+
return chunkUVMSWO6X_cjs.runWritePlan(
|
|
19865
19894
|
ctx,
|
|
19866
19895
|
// A bulk getOrCreate always converges on a match key no database key
|
|
19867
19896
|
// backs, whatever its cardinality — the same reason the single-item path
|
|
19868
19897
|
// fences unconditionally.
|
|
19869
|
-
|
|
19898
|
+
chunkUVMSWO6X_cjs.edgeWritePlan("edgeMatchKeyConvergence"),
|
|
19870
19899
|
backend,
|
|
19871
19900
|
async (session, target, _overlaidSession, lock) => {
|
|
19872
|
-
const rawTarget =
|
|
19901
|
+
const rawTarget = chunkUVMSWO6X_cjs.nestedManagedWriteTarget(target);
|
|
19873
19902
|
const { toCreate, toFetch, duplicateOf } = partitionEntries(
|
|
19874
19903
|
await fetchRowsByEndpoint(target)
|
|
19875
19904
|
);
|
|
@@ -19877,7 +19906,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19877
19906
|
let writes = 0;
|
|
19878
19907
|
if (toCreate.length > 0) {
|
|
19879
19908
|
if (lock.coordination !== void 0) {
|
|
19880
|
-
|
|
19909
|
+
chunkJ34FSPSC_cjs.assertGraphCommandConvergenceIsolation(
|
|
19881
19910
|
target.commands,
|
|
19882
19911
|
lock.coordination
|
|
19883
19912
|
);
|
|
@@ -19947,7 +19976,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19947
19976
|
if (entry2.isDeleted) continue;
|
|
19948
19977
|
assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
|
|
19949
19978
|
results[entry2.index] = {
|
|
19950
|
-
edge:
|
|
19979
|
+
edge: chunkUVMSWO6X_cjs.rowToEdge(entry2.row),
|
|
19951
19980
|
action: "found"
|
|
19952
19981
|
};
|
|
19953
19982
|
}
|
|
@@ -19982,7 +20011,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
19982
20011
|
} else {
|
|
19983
20012
|
assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
|
|
19984
20013
|
results[entry2.index] = {
|
|
19985
|
-
edge:
|
|
20014
|
+
edge: chunkUVMSWO6X_cjs.rowToEdge(entry2.row),
|
|
19986
20015
|
action: "found"
|
|
19987
20016
|
};
|
|
19988
20017
|
}
|
|
@@ -20020,7 +20049,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
20020
20049
|
var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
|
|
20021
20050
|
var RECORDED_SCAN_LIMIT = 1e3;
|
|
20022
20051
|
function recordedPointReadIdChunk(backend) {
|
|
20023
|
-
const budget =
|
|
20052
|
+
const budget = chunkCYKHSH5O_cjs.recordedBindParamBudget(backend);
|
|
20024
20053
|
return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
|
|
20025
20054
|
}
|
|
20026
20055
|
function recordedRelationErrorDetails(backend, surface) {
|
|
@@ -20033,8 +20062,8 @@ function withRelationsPrecondition(backend, promise, surface) {
|
|
|
20033
20062
|
);
|
|
20034
20063
|
}
|
|
20035
20064
|
function createRecordedReadBackend(backend, surface) {
|
|
20036
|
-
const projectedBackend =
|
|
20037
|
-
return
|
|
20065
|
+
const projectedBackend = chunkJ34FSPSC_cjs.projectGraphBackend(backend);
|
|
20066
|
+
return chunkJ34FSPSC_cjs.deriveBackend(projectedBackend, {
|
|
20038
20067
|
execute: (query) => withRelationsPrecondition(backend, backend.execute(query), surface),
|
|
20039
20068
|
...backend.executeRaw === void 0 ? {} : {
|
|
20040
20069
|
executeRaw: (sqlText, params) => withRelationsPrecondition(
|
|
@@ -20053,12 +20082,12 @@ function recordedTemporalFilter(backend, coordinate, tableAlias) {
|
|
|
20053
20082
|
{ code: "RECORDED_POINT_READ_MISSING_COORDINATE" }
|
|
20054
20083
|
);
|
|
20055
20084
|
}
|
|
20056
|
-
return
|
|
20085
|
+
return chunkCYKHSH5O_cjs.compileTemporalFilter({
|
|
20057
20086
|
mode: coordinate.valid.mode,
|
|
20058
20087
|
asOf: coordinate.valid.asOf,
|
|
20059
20088
|
recordedAsOf,
|
|
20060
20089
|
tableAlias,
|
|
20061
|
-
currentTimestamp:
|
|
20090
|
+
currentTimestamp: chunkCYKHSH5O_cjs.currentReadInstant()
|
|
20062
20091
|
});
|
|
20063
20092
|
}
|
|
20064
20093
|
function recordedRelationInvariantError(params) {
|
|
@@ -20138,10 +20167,10 @@ function createRecordedReadService(params) {
|
|
|
20138
20167
|
mapRecordedNodeRow,
|
|
20139
20168
|
mapRecordedEdgeRow
|
|
20140
20169
|
} = params;
|
|
20141
|
-
const recordedSchema = recordedReadBinding === void 0 ? void 0 :
|
|
20170
|
+
const recordedSchema = recordedReadBinding === void 0 ? void 0 : chunkJ34FSPSC_cjs.recordedReadSqlSchema(recordedReadBinding);
|
|
20142
20171
|
function schemaForRecordedRead(surface) {
|
|
20143
|
-
return recordedSchema ??
|
|
20144
|
-
|
|
20172
|
+
return recordedSchema ?? chunkJ34FSPSC_cjs.recordedReadSqlSchema(
|
|
20173
|
+
chunkJ34FSPSC_cjs.requireRecordedReadBinding(recordedReadBinding, surface)
|
|
20145
20174
|
);
|
|
20146
20175
|
}
|
|
20147
20176
|
async function recordedGetByIds(read) {
|
|
@@ -20159,7 +20188,7 @@ function createRecordedReadService(params) {
|
|
|
20159
20188
|
SELECT * FROM ${table} ${aliasSql}
|
|
20160
20189
|
WHERE ${aliasSql}.graph_id = ${graphId}
|
|
20161
20190
|
AND ${aliasSql}.kind = ${kind}
|
|
20162
|
-
AND ${aliasSql}.id IN (${
|
|
20191
|
+
AND ${aliasSql}.id IN (${chunkCYKHSH5O_cjs.sqlValueList(idChunk)})
|
|
20163
20192
|
AND ${temporalFilter}
|
|
20164
20193
|
ORDER BY ${aliasSql}.recorded_from
|
|
20165
20194
|
`)
|
|
@@ -20238,7 +20267,7 @@ function createRecordedReadService(params) {
|
|
|
20238
20267
|
kind,
|
|
20239
20268
|
ids,
|
|
20240
20269
|
coordinate,
|
|
20241
|
-
toEntity: (row) =>
|
|
20270
|
+
toEntity: (row) => chunkUVMSWO6X_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
20242
20271
|
});
|
|
20243
20272
|
}
|
|
20244
20273
|
function edgeGetByIds(kind, ids, coordinate) {
|
|
@@ -20250,7 +20279,7 @@ function createRecordedReadService(params) {
|
|
|
20250
20279
|
kind,
|
|
20251
20280
|
ids,
|
|
20252
20281
|
coordinate,
|
|
20253
|
-
toEntity: (row) =>
|
|
20282
|
+
toEntity: (row) => chunkUVMSWO6X_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
20254
20283
|
});
|
|
20255
20284
|
}
|
|
20256
20285
|
function nodeScan(kind, coordinate, options) {
|
|
@@ -20262,7 +20291,7 @@ function createRecordedReadService(params) {
|
|
|
20262
20291
|
kind,
|
|
20263
20292
|
coordinate,
|
|
20264
20293
|
options,
|
|
20265
|
-
toEntity: (row) =>
|
|
20294
|
+
toEntity: (row) => chunkUVMSWO6X_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
20266
20295
|
});
|
|
20267
20296
|
}
|
|
20268
20297
|
function edgeScan(kind, coordinate, options) {
|
|
@@ -20274,13 +20303,13 @@ function createRecordedReadService(params) {
|
|
|
20274
20303
|
kind,
|
|
20275
20304
|
coordinate,
|
|
20276
20305
|
options,
|
|
20277
|
-
toEntity: (row) =>
|
|
20306
|
+
toEntity: (row) => chunkUVMSWO6X_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
20278
20307
|
});
|
|
20279
20308
|
}
|
|
20280
20309
|
return {
|
|
20281
20310
|
backendForCoordinate(coordinate, surface) {
|
|
20282
20311
|
if (coordinate.recorded === void 0) return backend;
|
|
20283
|
-
|
|
20312
|
+
chunkJ34FSPSC_cjs.requireRecordedReadBinding(recordedReadBinding, surface);
|
|
20284
20313
|
return createRecordedReadBackend(backend, surface);
|
|
20285
20314
|
},
|
|
20286
20315
|
async nodeGetById(kind, id, coordinate) {
|
|
@@ -20575,8 +20604,8 @@ var CAUGHT_UP_VERB_DETAILS = {
|
|
|
20575
20604
|
}
|
|
20576
20605
|
};
|
|
20577
20606
|
var ROW_MAPPER_CONFIGS = {
|
|
20578
|
-
postgres:
|
|
20579
|
-
sqlite:
|
|
20607
|
+
postgres: chunkBYUIOM4L_cjs.POSTGRES_ROW_MAPPER_CONFIG,
|
|
20608
|
+
sqlite: chunkBYUIOM4L_cjs.SQLITE_ROW_MAPPER_CONFIG
|
|
20580
20609
|
};
|
|
20581
20610
|
function rowMapperConfigFor(backend) {
|
|
20582
20611
|
return ROW_MAPPER_CONFIGS[backend.dialect];
|
|
@@ -20612,7 +20641,7 @@ function syncStoreReplacementRef(ref, replacement) {
|
|
|
20612
20641
|
ref.current = replacement;
|
|
20613
20642
|
}
|
|
20614
20643
|
async function commitEvolvedSchemaWhenRequiredKindsAreEmpty(backend, graph, currentVersion, classification, storedSchema) {
|
|
20615
|
-
const result = await
|
|
20644
|
+
const result = await chunkL2REUAJB_cjs.commitNewSchemaVersionIfKindsEmpty(
|
|
20616
20645
|
backend,
|
|
20617
20646
|
graph,
|
|
20618
20647
|
currentVersion,
|
|
@@ -20665,7 +20694,7 @@ async function assertEvolvedSchemaRequiredKindsEmpty(backend, graphId, classific
|
|
|
20665
20694
|
}
|
|
20666
20695
|
var IDENTITY_FACADES = /* @__PURE__ */ new WeakMap();
|
|
20667
20696
|
var StoreImplementation = class _StoreImplementation {
|
|
20668
|
-
[
|
|
20697
|
+
[chunkUZ6CJUC5_cjs.STORE_RUNTIME];
|
|
20669
20698
|
#graph;
|
|
20670
20699
|
/**
|
|
20671
20700
|
* Bare backend for DDL, vector-storage, and bulk-materialization work that must
|
|
@@ -20724,7 +20753,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20724
20753
|
#search;
|
|
20725
20754
|
constructor(graph, backend, options, schemaMetadata, adapterBackend) {
|
|
20726
20755
|
this.#graph = graph;
|
|
20727
|
-
const statementExecution =
|
|
20756
|
+
const statementExecution = chunkZXXGMQC3_cjs.statementExecutionVerdict(backend);
|
|
20728
20757
|
if (graph.identity !== void 0 && (!backend.capabilities.execution.interactiveTransactions || !statementExecution.supported)) {
|
|
20729
20758
|
throw new chunkASKXTVK5_cjs.ConfigurationError(
|
|
20730
20759
|
"Operational Identity requires an atomic transactional backend with statement execution support.",
|
|
@@ -20738,8 +20767,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20738
20767
|
}
|
|
20739
20768
|
);
|
|
20740
20769
|
}
|
|
20741
|
-
if (graph.identity !== void 0 &&
|
|
20742
|
-
|
|
20770
|
+
if (graph.identity !== void 0 && chunkJ34FSPSC_cjs.resolveWriteFencePlan(backend).kind === "unfenced") {
|
|
20771
|
+
chunkJ34FSPSC_cjs.refuseUnfencedOperationalIdentity(backend.dialect);
|
|
20743
20772
|
}
|
|
20744
20773
|
this.#baseBackend = asRawBackend(backend);
|
|
20745
20774
|
this.#adapterBackend = adapterBackend;
|
|
@@ -20750,14 +20779,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20750
20779
|
if (ownership === "engine-native") {
|
|
20751
20780
|
refuseEngineNativeRecordedTimeNotYetImplemented();
|
|
20752
20781
|
}
|
|
20753
|
-
if (
|
|
20754
|
-
|
|
20782
|
+
if (chunkJ34FSPSC_cjs.resolveWriteFencePlan(backend).kind === "unfenced") {
|
|
20783
|
+
chunkJ34FSPSC_cjs.refuseUnfencedClockAllocation(backend.dialect);
|
|
20755
20784
|
}
|
|
20756
|
-
|
|
20785
|
+
chunkCYKHSH5O_cjs.assertRevisionTrackableBackend(backend);
|
|
20757
20786
|
}
|
|
20758
|
-
const explicitSchema = options?.schema === void 0 ? void 0 :
|
|
20759
|
-
const resolvedSchema = explicitSchema ?? (backend.tableNames ?
|
|
20760
|
-
const readSchema = resolvedSchema ??
|
|
20787
|
+
const explicitSchema = options?.schema === void 0 ? void 0 : chunkJ34FSPSC_cjs.requireSqlSchema(options.schema, "store schema");
|
|
20788
|
+
const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunkJ34FSPSC_cjs.createSqlSchema(backend.tableNames) : void 0);
|
|
20789
|
+
const readSchema = resolvedSchema ?? chunkJ34FSPSC_cjs.createSqlSchema(backend.tableNames);
|
|
20761
20790
|
if (this.#captureEnabled && options?.recordedRead !== void 0) {
|
|
20762
20791
|
throw new chunkASKXTVK5_cjs.ConfigurationError(
|
|
20763
20792
|
"recordedRead cannot be combined with history: true.",
|
|
@@ -20767,17 +20796,17 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20767
20796
|
}
|
|
20768
20797
|
);
|
|
20769
20798
|
}
|
|
20770
|
-
const externalRecordedRead =
|
|
20799
|
+
const externalRecordedRead = chunkJ34FSPSC_cjs.requireExternalRecordedReadSource(
|
|
20771
20800
|
options?.recordedRead
|
|
20772
20801
|
);
|
|
20773
|
-
this.#recordedReadBinding = this.#captureEnabled ?
|
|
20774
|
-
this.#backend = this.#captureEnabled ? asGraphWriteBackend(
|
|
20775
|
-
this.#claimsVerdict =
|
|
20776
|
-
this.#batchPointRead =
|
|
20777
|
-
this.#uniqueSidecarBatch =
|
|
20802
|
+
this.#recordedReadBinding = this.#captureEnabled ? chunkJ34FSPSC_cjs.createRecordedReadBinding(readSchema) : externalRecordedRead;
|
|
20803
|
+
this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunkCYKHSH5O_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
|
|
20804
|
+
this.#claimsVerdict = chunkZXXGMQC3_cjs.createClaimsVerdictThunk(this.#backend);
|
|
20805
|
+
this.#batchPointRead = chunkZXXGMQC3_cjs.batchPointReadVerdict(this.#backend);
|
|
20806
|
+
this.#uniqueSidecarBatch = chunkZXXGMQC3_cjs.uniqueSidecarBatchVerdict(this.#backend);
|
|
20778
20807
|
this.#statementExecution = statementExecution;
|
|
20779
|
-
this.#contributionHealth =
|
|
20780
|
-
this.#recordedRevisionOrigins =
|
|
20808
|
+
this.#contributionHealth = chunkZXXGMQC3_cjs.contributionHealthVerdict(this.#baseBackend);
|
|
20809
|
+
this.#recordedRevisionOrigins = chunkZXXGMQC3_cjs.recordedRevisionOriginsVerdict(
|
|
20781
20810
|
this.#baseBackend
|
|
20782
20811
|
);
|
|
20783
20812
|
this.#schema = resolvedSchema;
|
|
@@ -20786,21 +20815,21 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20786
20815
|
graphId: graph.id,
|
|
20787
20816
|
backend: this.#backend,
|
|
20788
20817
|
recordedReadBinding: this.#recordedReadBinding,
|
|
20789
|
-
mapRecordedNodeRow:
|
|
20790
|
-
mapRecordedEdgeRow:
|
|
20818
|
+
mapRecordedNodeRow: chunkBYUIOM4L_cjs.createNodeRowMapper(rowMapperConfig),
|
|
20819
|
+
mapRecordedEdgeRow: chunkBYUIOM4L_cjs.createEdgeRowMapper(rowMapperConfig)
|
|
20791
20820
|
});
|
|
20792
|
-
this.#registry =
|
|
20821
|
+
this.#registry = chunkL2REUAJB_cjs.buildKindRegistry(graph);
|
|
20793
20822
|
this.#hooks = options?.hooks ?? {};
|
|
20794
20823
|
this.#defaultTraversalExpansion = options?.queryDefaults?.traversalExpansion ?? "inverse";
|
|
20795
20824
|
this.#options = options;
|
|
20796
20825
|
this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
|
|
20797
|
-
this[
|
|
20826
|
+
this[chunkUZ6CJUC5_cjs.STORE_RUNTIME] = {
|
|
20798
20827
|
backend: this.#backend,
|
|
20799
20828
|
uniqueSidecarBatch: this.#uniqueSidecarBatch,
|
|
20800
20829
|
// The query path's own construction, not a second spelling of it: a
|
|
20801
20830
|
// caller that could only rebuild this object could not observe the one
|
|
20802
20831
|
// the queries actually run on.
|
|
20803
|
-
queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[
|
|
20832
|
+
queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[chunkUZ6CJUC5_cjs.STORE_RUNTIME].backend),
|
|
20804
20833
|
sealedQuery: (coordinate) => this.sealedQuery(coordinate),
|
|
20805
20834
|
recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
|
|
20806
20835
|
recordedNodeGetByIds: (kind, ids, coordinate) => this.recordedNodeGetByIds(kind, ids, coordinate),
|
|
@@ -20847,8 +20876,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20847
20876
|
if (upserts.every((upsert) => upsert.constraints.length === 0) && releases.length === 0) {
|
|
20848
20877
|
return apply();
|
|
20849
20878
|
}
|
|
20850
|
-
const lock = await
|
|
20851
|
-
return
|
|
20879
|
+
const lock = await chunkCYKHSH5O_cjs.lockRecordedGraphWrite(target, this.graphId);
|
|
20880
|
+
return chunkUZ6CJUC5_cjs.applyResolvedNodeClaims(
|
|
20852
20881
|
{
|
|
20853
20882
|
graphId: this.graphId,
|
|
20854
20883
|
registry: this.#registry,
|
|
@@ -20864,7 +20893,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20864
20893
|
},
|
|
20865
20894
|
liveNodesSharingIds: async (ids, target) => {
|
|
20866
20895
|
const backend2 = target ?? this.#baseBackend;
|
|
20867
|
-
const liveKindsById = await
|
|
20896
|
+
const liveKindsById = await chunkXXEFDJHY_cjs.liveNodeKindsSharingIds(
|
|
20868
20897
|
this.#identityContext(backend2),
|
|
20869
20898
|
backend2,
|
|
20870
20899
|
ids
|
|
@@ -20879,21 +20908,21 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20879
20908
|
if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
|
|
20880
20909
|
const backend2 = target ?? this.#baseBackend;
|
|
20881
20910
|
const ctx = this.#identityContext(backend2);
|
|
20882
|
-
const rows = await
|
|
20911
|
+
const rows = await chunkXXEFDJHY_cjs.loadAssertionsByIds(
|
|
20883
20912
|
backend2,
|
|
20884
20913
|
ctx.schema,
|
|
20885
20914
|
this.graphId,
|
|
20886
20915
|
ids
|
|
20887
20916
|
);
|
|
20888
20917
|
return new Map(
|
|
20889
|
-
[...rows].map(([id, row]) => [id,
|
|
20918
|
+
[...rows].map(([id, row]) => [id, chunkXXEFDJHY_cjs.toTransferAssertion(row)])
|
|
20890
20919
|
);
|
|
20891
20920
|
},
|
|
20892
20921
|
structuralIdentityClasses: async (references, target) => {
|
|
20893
20922
|
if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
|
|
20894
20923
|
const backend2 = target ?? this.#baseBackend;
|
|
20895
20924
|
const ctx = this.#identityContext(backend2);
|
|
20896
|
-
return
|
|
20925
|
+
return chunkXXEFDJHY_cjs.loadCurrentStructuralClasses(
|
|
20897
20926
|
backend2,
|
|
20898
20927
|
ctx.schema,
|
|
20899
20928
|
this.graphId,
|
|
@@ -20909,7 +20938,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20909
20938
|
applyIdentityMergeAtTarget: (target, retractions, assertions) => this.applyIdentityMergeAtTarget(target, retractions, assertions),
|
|
20910
20939
|
assertIdentityClassesConsistentAtTarget: (target, seeds) => this.assertIdentityClassesConsistentAtTarget(target, seeds)
|
|
20911
20940
|
};
|
|
20912
|
-
Object.defineProperty(this,
|
|
20941
|
+
Object.defineProperty(this, chunkUZ6CJUC5_cjs.STORE_RUNTIME, {
|
|
20913
20942
|
configurable: false,
|
|
20914
20943
|
enumerable: false,
|
|
20915
20944
|
writable: false
|
|
@@ -20946,7 +20975,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20946
20975
|
);
|
|
20947
20976
|
const existing = IDENTITY_FACADES.get(this);
|
|
20948
20977
|
if (existing !== void 0) return existing;
|
|
20949
|
-
const facade =
|
|
20978
|
+
const facade = chunkXXEFDJHY_cjs.createIdentityFacade(this.#identityContext(this.#backend));
|
|
20950
20979
|
IDENTITY_FACADES.set(this, facade);
|
|
20951
20980
|
return facade;
|
|
20952
20981
|
}
|
|
@@ -20970,13 +20999,13 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
20970
20999
|
coordinate,
|
|
20971
21000
|
"recorded-identity"
|
|
20972
21001
|
);
|
|
20973
|
-
const schema =
|
|
21002
|
+
const schema = chunkJ34FSPSC_cjs.recordedReadSchemaFor(
|
|
20974
21003
|
this.#sqlSchema(),
|
|
20975
21004
|
recordedAsOf,
|
|
20976
21005
|
this.#recordedReadBinding,
|
|
20977
21006
|
"recorded-identity"
|
|
20978
21007
|
);
|
|
20979
|
-
return
|
|
21008
|
+
return chunkXXEFDJHY_cjs.createIdentityReadFacade({
|
|
20980
21009
|
...this.#identityContext(backend),
|
|
20981
21010
|
schema,
|
|
20982
21011
|
coordinate
|
|
@@ -21005,7 +21034,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21005
21034
|
* fails leaves no half-published derived relation behind.
|
|
21006
21035
|
*/
|
|
21007
21036
|
async identitySchemaPreflight(target, provisionDerivedRelations) {
|
|
21008
|
-
await
|
|
21037
|
+
await chunkL2REUAJB_cjs.identitySchemaCommitPreflight(this.#identityContext(this.#backend), {
|
|
21009
21038
|
enablement: false,
|
|
21010
21039
|
provisionDerivedRelations
|
|
21011
21040
|
})(target);
|
|
@@ -21013,25 +21042,25 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21013
21042
|
/** @internal Read-only startup integrity verification. */
|
|
21014
21043
|
async validateIdentity() {
|
|
21015
21044
|
if (this.#graph.identity === void 0) return;
|
|
21016
|
-
await
|
|
21045
|
+
await chunkXXEFDJHY_cjs.validateIdentityForContext(this.#identityContext(this.#baseBackend));
|
|
21017
21046
|
}
|
|
21018
21047
|
/** @internal Cascades removed kinds in the schema-commit transaction. */
|
|
21019
21048
|
async removeIdentityKindsInSchemaPreflight(target, kinds, options) {
|
|
21020
21049
|
if (!this.#captureEnabled) {
|
|
21021
|
-
await
|
|
21050
|
+
await chunkXXEFDJHY_cjs.removeIdentityKindsForContext(
|
|
21022
21051
|
this.#identityContext(target),
|
|
21023
21052
|
kinds,
|
|
21024
21053
|
options
|
|
21025
21054
|
);
|
|
21026
21055
|
return;
|
|
21027
21056
|
}
|
|
21028
|
-
const scope =
|
|
21057
|
+
const scope = chunkCYKHSH5O_cjs.createRecordedTransactionScope(
|
|
21029
21058
|
target,
|
|
21030
21059
|
this.#batchPointRead,
|
|
21031
21060
|
this.#sqlSchema(),
|
|
21032
21061
|
target.dialect === "sqlite"
|
|
21033
21062
|
);
|
|
21034
|
-
await
|
|
21063
|
+
await chunkXXEFDJHY_cjs.removeIdentityKindsForContext(
|
|
21035
21064
|
this.#identityContext(scope.backend),
|
|
21036
21065
|
kinds,
|
|
21037
21066
|
options
|
|
@@ -21045,7 +21074,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21045
21074
|
*/
|
|
21046
21075
|
readCurrentIdentityAssertions(mode, options) {
|
|
21047
21076
|
if (this.#graph.identity === void 0) return Promise.resolve([]);
|
|
21048
|
-
return
|
|
21077
|
+
return chunkXXEFDJHY_cjs.readIdentityAssertionsForInterchange(
|
|
21049
21078
|
this.#identityContext(this.#baseBackend),
|
|
21050
21079
|
mode,
|
|
21051
21080
|
options
|
|
@@ -21054,7 +21083,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21054
21083
|
/** @internal Reads identity truth through an already-bound transaction. */
|
|
21055
21084
|
identityAssertionsAtTarget(target, mode = "state") {
|
|
21056
21085
|
if (this.#graph.identity === void 0) return Promise.resolve([]);
|
|
21057
|
-
return
|
|
21086
|
+
return chunkXXEFDJHY_cjs.readIdentityAssertionsForInterchange(
|
|
21058
21087
|
this.#identityContext(target),
|
|
21059
21088
|
mode
|
|
21060
21089
|
);
|
|
@@ -21064,7 +21093,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21064
21093
|
if (this.#graph.identity === void 0) {
|
|
21065
21094
|
return Promise.resolve({ assertions: [], done: true });
|
|
21066
21095
|
}
|
|
21067
|
-
return
|
|
21096
|
+
return chunkXXEFDJHY_cjs.readIdentityAssertionPageAtTarget(
|
|
21068
21097
|
this.#identityContext(target),
|
|
21069
21098
|
target,
|
|
21070
21099
|
mode,
|
|
@@ -21073,14 +21102,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21073
21102
|
}
|
|
21074
21103
|
/** @internal Acquires the enabled graph's identity lock for an import. */
|
|
21075
21104
|
lockIdentityImportTarget(target) {
|
|
21076
|
-
return this.#graph.identity === void 0 ? Promise.resolve() :
|
|
21105
|
+
return this.#graph.identity === void 0 ? Promise.resolve() : chunkXXEFDJHY_cjs.lockIdentityGraph(target, this.graphId);
|
|
21077
21106
|
}
|
|
21078
21107
|
/** @internal Restores same-id folding after the ops-layer import bypass. */
|
|
21079
21108
|
foldImportedIdentityNodes(target, references) {
|
|
21080
21109
|
if (this.#graph.identity === void 0 || references.length === 0) {
|
|
21081
21110
|
return Promise.resolve();
|
|
21082
21111
|
}
|
|
21083
|
-
return
|
|
21112
|
+
return chunkXXEFDJHY_cjs.foldIdentityForCreatedNodes(
|
|
21084
21113
|
{
|
|
21085
21114
|
graphId: this.graphId,
|
|
21086
21115
|
registry: this.#registry,
|
|
@@ -21102,7 +21131,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21102
21131
|
{ code: "IDENTITY_IMPORT_REQUIRES_PROFILE", graphId: this.graphId }
|
|
21103
21132
|
);
|
|
21104
21133
|
}
|
|
21105
|
-
return
|
|
21134
|
+
return chunkXXEFDJHY_cjs.importIdentityAssertionsIntoTarget(
|
|
21106
21135
|
// The slice the coordinator reads — graph, registry, schema, folding
|
|
21107
21136
|
// mode — none of which depend on the target. The target it writes
|
|
21108
21137
|
// through is the parameter beside it, which is why this method can take
|
|
@@ -21122,7 +21151,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21122
21151
|
if (this.#graph.identity === void 0 || seeds.length === 0) {
|
|
21123
21152
|
return Promise.resolve();
|
|
21124
21153
|
}
|
|
21125
|
-
return
|
|
21154
|
+
return chunkXXEFDJHY_cjs.assertAffectedIdentityClassesConsistent(
|
|
21126
21155
|
this.#identityContext(target),
|
|
21127
21156
|
target,
|
|
21128
21157
|
seeds
|
|
@@ -21139,7 +21168,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21139
21168
|
{ code: "IDENTITY_MERGE_REQUIRES_PROFILE", graphId: this.graphId }
|
|
21140
21169
|
);
|
|
21141
21170
|
}
|
|
21142
|
-
return
|
|
21171
|
+
return chunkXXEFDJHY_cjs.applyIdentityChangesForContext(
|
|
21143
21172
|
this.#identityContext(target),
|
|
21144
21173
|
retractions,
|
|
21145
21174
|
assertions
|
|
@@ -21390,27 +21419,33 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21390
21419
|
}
|
|
21391
21420
|
return collection;
|
|
21392
21421
|
}
|
|
21393
|
-
/**
|
|
21394
|
-
* Returns the edge collection for the given kind, or undefined if the kind
|
|
21395
|
-
* is not registered in this graph.
|
|
21396
|
-
*
|
|
21397
|
-
* Use this for runtime string-keyed access when the kind is not known at
|
|
21398
|
-
* compile time. For post-evolve access, prefer `getEdgeCollectionOrThrow`.
|
|
21399
|
-
*/
|
|
21400
21422
|
getEdgeCollection(kind) {
|
|
21401
|
-
|
|
21402
|
-
return this.edges[kind];
|
|
21423
|
+
return this.#resolveDynamicEdgeCollection(this.edges, kind);
|
|
21403
21424
|
}
|
|
21404
21425
|
getEdgeCollectionOrThrow(kindOrToken) {
|
|
21426
|
+
return this.#requireDynamicEdgeCollection(this.edges, kindOrToken);
|
|
21427
|
+
}
|
|
21428
|
+
#requireDynamicEdgeCollection(collections, kindOrToken) {
|
|
21405
21429
|
const kind = this.#resolveRuntimeKind(kindOrToken, "edge");
|
|
21406
|
-
const collection = this
|
|
21430
|
+
const collection = this.#resolveDynamicEdgeCollection(collections, kind);
|
|
21407
21431
|
if (collection === void 0) {
|
|
21408
|
-
throw new chunkASKXTVK5_cjs.KindNotFoundError(kind, "edge", {
|
|
21409
|
-
graphId: this.graphId
|
|
21410
|
-
});
|
|
21432
|
+
throw new chunkASKXTVK5_cjs.KindNotFoundError(kind, "edge", { graphId: this.graphId });
|
|
21411
21433
|
}
|
|
21412
21434
|
return collection;
|
|
21413
21435
|
}
|
|
21436
|
+
#resolveDynamicEdgeCollection(collections, kind) {
|
|
21437
|
+
if (!Object.hasOwn(this.#graph.edges, kind)) return void 0;
|
|
21438
|
+
return collections[kind];
|
|
21439
|
+
}
|
|
21440
|
+
/** Resolve through the supplied context's wrappers, preserving transaction and receipt ownership. */
|
|
21441
|
+
#edgeCollectionAccess(collections) {
|
|
21442
|
+
const getEdgeCollection = (kind) => this.#resolveDynamicEdgeCollection(collections, kind);
|
|
21443
|
+
const getEdgeCollectionOrThrow = (kindOrToken) => this.#requireDynamicEdgeCollection(collections, kindOrToken);
|
|
21444
|
+
return {
|
|
21445
|
+
getEdgeCollection,
|
|
21446
|
+
getEdgeCollectionOrThrow
|
|
21447
|
+
};
|
|
21448
|
+
}
|
|
21414
21449
|
// === Dynamic Props Schema Access ===
|
|
21415
21450
|
/**
|
|
21416
21451
|
* Returns the Zod props schema for the given node kind, or `undefined`
|
|
@@ -21515,7 +21550,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21515
21550
|
* between "proceed" and "ask the user" *before* attempting a commit.
|
|
21516
21551
|
*/
|
|
21517
21552
|
async schemaChanges() {
|
|
21518
|
-
return
|
|
21553
|
+
return chunkL2REUAJB_cjs.getSchemaChanges(this.#backend, this.#graph);
|
|
21519
21554
|
}
|
|
21520
21555
|
/**
|
|
21521
21556
|
* Whether committing this store's graph would require a schema migration —
|
|
@@ -21527,7 +21562,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21527
21562
|
* through a user's request.
|
|
21528
21563
|
*/
|
|
21529
21564
|
async requiresMigration() {
|
|
21530
|
-
return
|
|
21565
|
+
return chunkL2REUAJB_cjs.requiresMigration(this.#backend, this.#graph);
|
|
21531
21566
|
}
|
|
21532
21567
|
/**
|
|
21533
21568
|
* Node operations bound to this store instance.
|
|
@@ -21543,7 +21578,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21543
21578
|
async #maybeRefreshStatisticsAfterBulk(rowCount) {
|
|
21544
21579
|
const configured = this.#options?.autoRefreshStatistics;
|
|
21545
21580
|
if (configured === false) return;
|
|
21546
|
-
const threshold = configured ??
|
|
21581
|
+
const threshold = configured ?? chunkUZ6CJUC5_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
|
|
21547
21582
|
if (rowCount < threshold) return;
|
|
21548
21583
|
try {
|
|
21549
21584
|
await this.refreshStatistics();
|
|
@@ -21557,13 +21592,13 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21557
21592
|
#buildNodeOperations(ctx) {
|
|
21558
21593
|
return {
|
|
21559
21594
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
21560
|
-
rowToNode: (row) =>
|
|
21595
|
+
rowToNode: (row) => chunkUVMSWO6X_cjs.rowToNode(row),
|
|
21561
21596
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
21562
|
-
executeCreate: (input, backend) =>
|
|
21563
|
-
executeCreateBatch: (inputs, backend, options) =>
|
|
21564
|
-
executeCreateNoReturnBatch: (inputs, backend) =>
|
|
21565
|
-
executeUpdate: (input, backend, options) =>
|
|
21566
|
-
executeNodeSetUpdate: (kind, patch, candidateIds, candidateIdColumn, backend, options) =>
|
|
21597
|
+
executeCreate: (input, backend) => chunkUVMSWO6X_cjs.executeNodeCreate(ctx, input, backend),
|
|
21598
|
+
executeCreateBatch: (inputs, backend, options) => chunkUVMSWO6X_cjs.executeNodeCreateBatch(ctx, inputs, backend, options),
|
|
21599
|
+
executeCreateNoReturnBatch: (inputs, backend) => chunkUVMSWO6X_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
|
|
21600
|
+
executeUpdate: (input, backend, options) => chunkUVMSWO6X_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
|
|
21601
|
+
executeNodeSetUpdate: (kind, patch, candidateIds, candidateIdColumn, backend, options) => chunkUVMSWO6X_cjs.executeNodeSetUpdate(
|
|
21567
21602
|
ctx,
|
|
21568
21603
|
kind,
|
|
21569
21604
|
patch,
|
|
@@ -21572,20 +21607,20 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21572
21607
|
backend,
|
|
21573
21608
|
options
|
|
21574
21609
|
),
|
|
21575
|
-
executeUpsertUpdateBatch: (entries, backend) =>
|
|
21576
|
-
executeResolvedMutationSet: (creates, updates, backend) =>
|
|
21577
|
-
prepareReplacement: (kind, props) =>
|
|
21578
|
-
executeReplacementBatch: (kind, items, backend) =>
|
|
21610
|
+
executeUpsertUpdateBatch: (entries, backend) => chunkUVMSWO6X_cjs.executeNodeUpsertUpdateBatch(ctx, entries, backend),
|
|
21611
|
+
executeResolvedMutationSet: (creates, updates, backend) => chunkUVMSWO6X_cjs.executeNodeResolvedMutationSet(ctx, creates, updates, backend),
|
|
21612
|
+
prepareReplacement: (kind, props) => chunkUVMSWO6X_cjs.prepareNodeReplacement(ctx, kind, props),
|
|
21613
|
+
executeReplacementBatch: (kind, items, backend) => chunkUVMSWO6X_cjs.executeNodeReplacementBatch(ctx, kind, items, backend),
|
|
21579
21614
|
// Present only when opted in; its absence is the coalesce off switch.
|
|
21580
21615
|
...ctx.coalesceUnchangedUpsertsEnabled && {
|
|
21581
|
-
upsertDirtyCheck: (kind, id, existingProps, inputProps) =>
|
|
21616
|
+
upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunkUVMSWO6X_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
|
|
21582
21617
|
},
|
|
21583
|
-
executeDelete: (kind, id, backend) =>
|
|
21584
|
-
executeDeleteBatch: (kind, ids, backend) =>
|
|
21585
|
-
executeHardDelete: (kind, id, backend) =>
|
|
21618
|
+
executeDelete: (kind, id, backend) => chunkUVMSWO6X_cjs.executeNodeDelete(ctx, kind, id, backend),
|
|
21619
|
+
executeDeleteBatch: (kind, ids, backend) => chunkUVMSWO6X_cjs.executeNodeDeleteBatch(ctx, kind, ids, backend),
|
|
21620
|
+
executeHardDelete: (kind, id, backend) => chunkUVMSWO6X_cjs.executeNodeHardDelete(ctx, kind, id, backend),
|
|
21586
21621
|
temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
|
|
21587
21622
|
createQuery: () => this.query(),
|
|
21588
|
-
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) =>
|
|
21623
|
+
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkUVMSWO6X_cjs.executeNodeGetOrCreateByConstraint(
|
|
21589
21624
|
ctx,
|
|
21590
21625
|
kind,
|
|
21591
21626
|
constraintName,
|
|
@@ -21593,7 +21628,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21593
21628
|
backend,
|
|
21594
21629
|
options
|
|
21595
21630
|
),
|
|
21596
|
-
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) =>
|
|
21631
|
+
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkUVMSWO6X_cjs.executeNodeBulkGetOrCreateByConstraint(
|
|
21597
21632
|
ctx,
|
|
21598
21633
|
kind,
|
|
21599
21634
|
constraintName,
|
|
@@ -21601,15 +21636,15 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21601
21636
|
backend,
|
|
21602
21637
|
options
|
|
21603
21638
|
),
|
|
21604
|
-
executeFindByConstraint: (kind, constraintName, props, backend) =>
|
|
21605
|
-
executeBulkFindByConstraint: (kind, constraintName, items, backend) =>
|
|
21639
|
+
executeFindByConstraint: (kind, constraintName, props, backend) => chunkUVMSWO6X_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
|
|
21640
|
+
executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunkUVMSWO6X_cjs.executeNodeBulkFindByConstraint(
|
|
21606
21641
|
ctx,
|
|
21607
21642
|
kind,
|
|
21608
21643
|
constraintName,
|
|
21609
21644
|
items,
|
|
21610
21645
|
backend
|
|
21611
21646
|
),
|
|
21612
|
-
executeBulkFindByIndex: (kind, indexName, items, backend, options) =>
|
|
21647
|
+
executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkUVMSWO6X_cjs.executeNodeBulkFindByIndex(
|
|
21613
21648
|
ctx,
|
|
21614
21649
|
kind,
|
|
21615
21650
|
indexName,
|
|
@@ -21628,7 +21663,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21628
21663
|
#buildEdgeOperations(ctx) {
|
|
21629
21664
|
return {
|
|
21630
21665
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
21631
|
-
rowToEdge: (row) =>
|
|
21666
|
+
rowToEdge: (row) => chunkUVMSWO6X_cjs.rowToEdge(row),
|
|
21632
21667
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
21633
21668
|
executeCreate: (input, backend) => executeEdgeCreate(ctx, input, backend),
|
|
21634
21669
|
executeCreateBatch: (inputs, backend) => executeEdgeCreateBatch(ctx, inputs, backend),
|
|
@@ -21704,7 +21739,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21704
21739
|
);
|
|
21705
21740
|
}
|
|
21706
21741
|
#sqlSchema() {
|
|
21707
|
-
return this.#schema ??
|
|
21742
|
+
return this.#schema ?? chunkJ34FSPSC_cjs.createSqlSchema(this.#backend.tableNames);
|
|
21708
21743
|
}
|
|
21709
21744
|
/**
|
|
21710
21745
|
* Internal seam for {@link RecordedStoreView}: reconstruct a node point read
|
|
@@ -21841,7 +21876,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21841
21876
|
);
|
|
21842
21877
|
}
|
|
21843
21878
|
const recordedAt = await chunk5X46XWNH_cjs.withRecordedRelationsPrecondition(
|
|
21844
|
-
|
|
21879
|
+
chunkCYKHSH5O_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
|
|
21845
21880
|
{ dialect: this.#backend.dialect, surface: "recorded-now" }
|
|
21846
21881
|
);
|
|
21847
21882
|
return recordedAt === void 0 ? void 0 : chunkF2HGOZJR_cjs.asRecordedInstant(recordedAt);
|
|
@@ -21856,7 +21891,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21856
21891
|
*/
|
|
21857
21892
|
async revisionNow() {
|
|
21858
21893
|
if (!this.#revisionTrackingEnabled) return void 0;
|
|
21859
|
-
return
|
|
21894
|
+
return chunkCYKHSH5O_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
|
|
21860
21895
|
}
|
|
21861
21896
|
/**
|
|
21862
21897
|
* Returns the durable random namespace for this graph's revision clock. A
|
|
@@ -21873,7 +21908,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
21873
21908
|
{ code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
|
|
21874
21909
|
);
|
|
21875
21910
|
}
|
|
21876
|
-
const pendingOrigin = this.#revisionOrigin ??
|
|
21911
|
+
const pendingOrigin = this.#revisionOrigin ?? chunkCYKHSH5O_cjs.ensureRevisionOrigin(
|
|
21877
21912
|
this.#baseBackend,
|
|
21878
21913
|
this.#recordedRevisionOrigins,
|
|
21879
21914
|
this.#sqlSchema(),
|
|
@@ -22039,7 +22074,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22039
22074
|
* @returns A tuple with per-query typed results, preserving input order
|
|
22040
22075
|
*/
|
|
22041
22076
|
async batch(...queries) {
|
|
22042
|
-
return
|
|
22077
|
+
return chunkJ34FSPSC_cjs.runOptionallyInTransaction(this.#baseBackend, async (target) => {
|
|
22043
22078
|
const queryBackend = this.#createHookedQueryBackend(target);
|
|
22044
22079
|
const results = [];
|
|
22045
22080
|
for (const query of queries) {
|
|
@@ -22127,7 +22162,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22127
22162
|
});
|
|
22128
22163
|
const edgesBySource = /* @__PURE__ */ new Map();
|
|
22129
22164
|
for (const row of rows) {
|
|
22130
|
-
const edge =
|
|
22165
|
+
const edge = chunkUVMSWO6X_cjs.rowToEdge(row);
|
|
22131
22166
|
const key = `${edge.fromKind}\0${edge.fromId}`;
|
|
22132
22167
|
const bucket = edgesBySource.get(key);
|
|
22133
22168
|
if (bucket === void 0) edgesBySource.set(key, [edge]);
|
|
@@ -22283,7 +22318,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22283
22318
|
const runHooks = this.#createBufferedHookRunner(pending);
|
|
22284
22319
|
const runBulkHooks = this.#createBufferedBulkHookRunner(pending);
|
|
22285
22320
|
let recordedByGraph;
|
|
22286
|
-
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ?
|
|
22321
|
+
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunkCYKHSH5O_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
|
|
22287
22322
|
recordedByGraph = instants;
|
|
22288
22323
|
}) : backendOptions;
|
|
22289
22324
|
try {
|
|
@@ -22297,7 +22332,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22297
22332
|
runBulkHooks
|
|
22298
22333
|
)
|
|
22299
22334
|
);
|
|
22300
|
-
const invokeWithSchemaFenceLease = () => this.#adapterBackend === void 0 ?
|
|
22335
|
+
const invokeWithSchemaFenceLease = () => this.#adapterBackend === void 0 ? chunkCYKHSH5O_cjs.withTransactionSchemaFenceLease(
|
|
22301
22336
|
{
|
|
22302
22337
|
graphId: this.graphId,
|
|
22303
22338
|
schemaVersion: this.#schemaMetadata.schemaVersion
|
|
@@ -22305,7 +22340,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22305
22340
|
txBackend,
|
|
22306
22341
|
invokeTransaction
|
|
22307
22342
|
) : invokeTransaction();
|
|
22308
|
-
return
|
|
22343
|
+
return chunkCYKHSH5O_cjs.withWriteTransactionSession(
|
|
22309
22344
|
txBackend,
|
|
22310
22345
|
{
|
|
22311
22346
|
graphId: this.graphId,
|
|
@@ -22431,7 +22466,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22431
22466
|
*/
|
|
22432
22467
|
withTransaction(externalTx) {
|
|
22433
22468
|
if (this.#captureEnabled) {
|
|
22434
|
-
throw
|
|
22469
|
+
throw chunkCYKHSH5O_cjs.recordedCaptureRequiresCallbackTransactionError();
|
|
22435
22470
|
}
|
|
22436
22471
|
const adopt = this.#adapterBackend?.adoptTransaction;
|
|
22437
22472
|
if (adopt === void 0) {
|
|
@@ -22455,8 +22490,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22455
22490
|
}
|
|
22456
22491
|
const txBackend = adopt(externalTx);
|
|
22457
22492
|
if (this.#captureEnabled) {
|
|
22458
|
-
await
|
|
22459
|
-
await
|
|
22493
|
+
await chunkCYKHSH5O_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
|
|
22494
|
+
await chunkCYKHSH5O_cjs.lockSchemaVersionForStoreWrite(
|
|
22460
22495
|
{
|
|
22461
22496
|
graphId: this.graphId,
|
|
22462
22497
|
schemaVersion: this.#schemaMetadata.schemaVersion
|
|
@@ -22464,7 +22499,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22464
22499
|
txBackend
|
|
22465
22500
|
);
|
|
22466
22501
|
}
|
|
22467
|
-
const scope = this.#captureEnabled ?
|
|
22502
|
+
const scope = this.#captureEnabled ? chunkCYKHSH5O_cjs.createRecordedTransactionScope(
|
|
22468
22503
|
txBackend,
|
|
22469
22504
|
this.#batchPointRead,
|
|
22470
22505
|
this.#sqlSchema()
|
|
@@ -22473,7 +22508,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22473
22508
|
flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
|
|
22474
22509
|
};
|
|
22475
22510
|
if (this.#captureEnabled) {
|
|
22476
|
-
await
|
|
22511
|
+
await chunkCYKHSH5O_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
|
|
22477
22512
|
}
|
|
22478
22513
|
const receiptRecorder = createTransactionReceiptRecorder();
|
|
22479
22514
|
const invoke = fn;
|
|
@@ -22503,7 +22538,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22503
22538
|
* `context` never reaches the scope recorder. This makes overlapping/concurrent
|
|
22504
22539
|
* measures safe by construction (each holds its own scope recorder) and lets
|
|
22505
22540
|
* scopes nest: the scoped context is itself decorated, so `scoped.measure(...)`
|
|
22506
|
-
* chains one more wrapper. The scoped context's
|
|
22541
|
+
* chains one more wrapper. The scoped context's dynamic collection lookups resolve
|
|
22507
22542
|
* against the scope-wrapped map too, so dynamic-kind writes are attributed like
|
|
22508
22543
|
* `scoped.nodes.<Kind>`. The scope receipt's `recorded` is always undefined —
|
|
22509
22544
|
* the recorded instant is a whole-transaction flush concern.
|
|
@@ -22525,6 +22560,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22525
22560
|
nodes,
|
|
22526
22561
|
edges,
|
|
22527
22562
|
...identity === void 0 ? {} : { identity },
|
|
22563
|
+
...this.#edgeCollectionAccess(edges),
|
|
22528
22564
|
getNodeCollection: (kind) => this.#resolveDynamicNodeCollection(nodes, kind)
|
|
22529
22565
|
})
|
|
22530
22566
|
);
|
|
@@ -22580,16 +22616,17 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22580
22616
|
receiptRecorder
|
|
22581
22617
|
));
|
|
22582
22618
|
}
|
|
22583
|
-
const identity = this.#graph.identity === void 0 ? void 0 :
|
|
22619
|
+
const identity = this.#graph.identity === void 0 ? void 0 : chunkXXEFDJHY_cjs.createIdentityFacade(this.#identityContext(txBackend));
|
|
22584
22620
|
const receiptIdentity = identity === void 0 || receiptRecorder === void 0 ? identity : wrapTransactionIdentity(identity, receiptRecorder);
|
|
22585
22621
|
const getNodeCollection = (kind) => this.#resolveDynamicNodeCollection(nodes, kind);
|
|
22586
22622
|
const base = {
|
|
22587
22623
|
nodes,
|
|
22588
22624
|
edges,
|
|
22589
22625
|
...receiptIdentity === void 0 ? {} : { identity: receiptIdentity },
|
|
22590
|
-
backend:
|
|
22591
|
-
[
|
|
22592
|
-
getNodeCollection
|
|
22626
|
+
backend: chunkJ34FSPSC_cjs.createTransactionReadBackend(txBackend),
|
|
22627
|
+
[chunkUZ6CJUC5_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
|
|
22628
|
+
getNodeCollection,
|
|
22629
|
+
...this.#edgeCollectionAccess(edges)
|
|
22593
22630
|
};
|
|
22594
22631
|
let withSql;
|
|
22595
22632
|
if (this.#captureEnabled) {
|
|
@@ -22597,7 +22634,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22597
22634
|
...base,
|
|
22598
22635
|
sqlAvailability: "history"
|
|
22599
22636
|
};
|
|
22600
|
-
defineUnavailableSqlGuard(withSql, () =>
|
|
22637
|
+
defineUnavailableSqlGuard(withSql, () => chunkCYKHSH5O_cjs.throwHistoryUnsafeSqlAccess());
|
|
22601
22638
|
} else if (this.#revisionTrackingEnabled) {
|
|
22602
22639
|
withSql = {
|
|
22603
22640
|
...base,
|
|
@@ -22605,14 +22642,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22605
22642
|
};
|
|
22606
22643
|
defineUnavailableSqlGuard(
|
|
22607
22644
|
withSql,
|
|
22608
|
-
() =>
|
|
22645
|
+
() => chunkCYKHSH5O_cjs.throwRevisionTrackingUnsafeSqlAccess()
|
|
22609
22646
|
);
|
|
22610
22647
|
} else if (sql2 === void 0) {
|
|
22611
22648
|
withSql = { ...base, sqlAvailability: "unavailable" };
|
|
22612
22649
|
} else {
|
|
22613
22650
|
withSql = { ...base, sql: sql2, sqlAvailability: "available" };
|
|
22614
22651
|
}
|
|
22615
|
-
Object.defineProperty(withSql,
|
|
22652
|
+
Object.defineProperty(withSql, chunkUZ6CJUC5_cjs.TRANSACTION_RUNTIME, {
|
|
22616
22653
|
configurable: false,
|
|
22617
22654
|
enumerable: false,
|
|
22618
22655
|
writable: false
|
|
@@ -22653,17 +22690,17 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22653
22690
|
for (const [index, node] of nodes.entries()) {
|
|
22654
22691
|
if (node !== void 0) {
|
|
22655
22692
|
loadedByReference.set(
|
|
22656
|
-
|
|
22693
|
+
chunkXXEFDJHY_cjs.refKey({ kind, id: chunkBXHAPCQG_cjs.requireDefined(ids[index]) }),
|
|
22657
22694
|
node
|
|
22658
22695
|
);
|
|
22659
22696
|
}
|
|
22660
22697
|
}
|
|
22661
22698
|
return;
|
|
22662
22699
|
}
|
|
22663
|
-
const boundGetNodes =
|
|
22700
|
+
const boundGetNodes = chunkJ34FSPSC_cjs.bindExtraIfReachable(
|
|
22664
22701
|
backend,
|
|
22665
22702
|
this.#batchPointRead.extras.getNodes,
|
|
22666
|
-
|
|
22703
|
+
chunkJ34FSPSC_cjs.BATCH_POINT_READ.id
|
|
22667
22704
|
);
|
|
22668
22705
|
const rows = boundGetNodes === void 0 ? await Promise.all(
|
|
22669
22706
|
ids.map((id) => backend.getNode(this.graphId, kind, id))
|
|
@@ -22673,14 +22710,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22673
22710
|
if (row === void 0) continue;
|
|
22674
22711
|
if (!includeTombstoned && row.deleted_at !== void 0) continue;
|
|
22675
22712
|
loadedByReference.set(
|
|
22676
|
-
|
|
22677
|
-
|
|
22713
|
+
chunkXXEFDJHY_cjs.refKey({ kind, id: row.id }),
|
|
22714
|
+
chunkUVMSWO6X_cjs.rowToNode(row)
|
|
22678
22715
|
);
|
|
22679
22716
|
}
|
|
22680
22717
|
})
|
|
22681
22718
|
);
|
|
22682
22719
|
return references.map(
|
|
22683
|
-
(reference) => loadedByReference.get(
|
|
22720
|
+
(reference) => loadedByReference.get(chunkXXEFDJHY_cjs.refKey(reference))
|
|
22684
22721
|
);
|
|
22685
22722
|
}
|
|
22686
22723
|
};
|
|
@@ -22698,15 +22735,15 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22698
22735
|
async clear() {
|
|
22699
22736
|
const doClear = async (target) => {
|
|
22700
22737
|
if (this.#revisionTrackingEnabled) {
|
|
22701
|
-
await
|
|
22738
|
+
await chunkCYKHSH5O_cjs.lockRecordedGraphWrite(target, this.graphId);
|
|
22702
22739
|
}
|
|
22703
22740
|
if (this.#graph.identity !== void 0) {
|
|
22704
|
-
await
|
|
22741
|
+
await chunkXXEFDJHY_cjs.lockIdentityGraph(target, this.graphId);
|
|
22705
22742
|
}
|
|
22706
|
-
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await
|
|
22743
|
+
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunkCYKHSH5O_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
|
|
22707
22744
|
await target.clearGraph(this.graphId);
|
|
22708
22745
|
if (this.#revisionTrackingEnabled && !this.#captureEnabled) {
|
|
22709
|
-
await
|
|
22746
|
+
await chunkCYKHSH5O_cjs.advanceRevisionClock(
|
|
22710
22747
|
target,
|
|
22711
22748
|
this.#sqlSchema(),
|
|
22712
22749
|
this.graphId,
|
|
@@ -22837,7 +22874,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22837
22874
|
*/
|
|
22838
22875
|
async evolve(extension, options) {
|
|
22839
22876
|
const { activeRow, storedSchema, baseline } = await this.#loadCaughtUp("evolve");
|
|
22840
|
-
const merged =
|
|
22877
|
+
const merged = chunkL2REUAJB_cjs.mergeGraphExtension(baseline, extension);
|
|
22841
22878
|
if (merged === baseline) {
|
|
22842
22879
|
if (baseline === this.#graph) {
|
|
22843
22880
|
syncStoreReplacementRef(options?.ref, this);
|
|
@@ -22866,7 +22903,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22866
22903
|
);
|
|
22867
22904
|
}
|
|
22868
22905
|
const identityCandidate = merged.identity === void 0 ? void 0 : this.#cloneWithGraph(merged, void 0);
|
|
22869
|
-
const identityProvisioning = identityCandidate === void 0 ? void 0 : await
|
|
22906
|
+
const identityProvisioning = identityCandidate === void 0 ? void 0 : await chunkL2REUAJB_cjs.ensureIdentitySchemaStorage(
|
|
22870
22907
|
this.#baseBackend,
|
|
22871
22908
|
this.#sqlSchema(),
|
|
22872
22909
|
{
|
|
@@ -22875,7 +22912,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22875
22912
|
// The evolved graph's registry — the one the candidate's own
|
|
22876
22913
|
// preflight rebuilds through, so the predicate and the fill agree
|
|
22877
22914
|
// on which assertions count.
|
|
22878
|
-
registry:
|
|
22915
|
+
registry: chunkL2REUAJB_cjs.buildKindRegistry(merged)
|
|
22879
22916
|
}
|
|
22880
22917
|
);
|
|
22881
22918
|
const committed = identityCandidate === void 0 ? classification.requireEmpty.length > 0 ? await commitEvolvedSchemaWhenRequiredKindsAreEmpty(
|
|
@@ -22884,12 +22921,12 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
22884
22921
|
activeRow.version,
|
|
22885
22922
|
classification,
|
|
22886
22923
|
storedSchema
|
|
22887
|
-
) : await
|
|
22924
|
+
) : await chunkL2REUAJB_cjs.commitNewSchemaVersion(
|
|
22888
22925
|
this.#backend,
|
|
22889
22926
|
merged,
|
|
22890
22927
|
activeRow.version,
|
|
22891
22928
|
storedSchema
|
|
22892
|
-
) : await
|
|
22929
|
+
) : await chunkL2REUAJB_cjs.commitNewSchemaVersionWithPreflight(
|
|
22893
22930
|
this.#backend,
|
|
22894
22931
|
merged,
|
|
22895
22932
|
activeRow.version,
|
|
@@ -23226,8 +23263,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23226
23263
|
*/
|
|
23227
23264
|
async verifyContributions() {
|
|
23228
23265
|
const backend = this.#baseBackend;
|
|
23229
|
-
|
|
23230
|
-
|
|
23266
|
+
chunkZXXGMQC3_cjs.requireExtras(
|
|
23267
|
+
chunkJ34FSPSC_cjs.CONTRIBUTION_HEALTH,
|
|
23231
23268
|
this.#contributionHealth,
|
|
23232
23269
|
"contribution verify",
|
|
23233
23270
|
() => {
|
|
@@ -23241,10 +23278,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23241
23278
|
);
|
|
23242
23279
|
}
|
|
23243
23280
|
);
|
|
23244
|
-
const { verifyContributions: verify } =
|
|
23281
|
+
const { verifyContributions: verify } = chunkJ34FSPSC_cjs.bindExtra(
|
|
23245
23282
|
backend,
|
|
23246
23283
|
this.#contributionHealth.extras.verifyContributions,
|
|
23247
|
-
|
|
23284
|
+
chunkJ34FSPSC_cjs.CONTRIBUTION_HEALTH.id
|
|
23248
23285
|
);
|
|
23249
23286
|
const vectorSlots = backend.capabilities.vector?.supported === true ? chunkHAHNRASW_cjs.resolveGraphVectorSlots(this.#graph) : [];
|
|
23250
23287
|
return verify(this.graphId, vectorSlots);
|
|
@@ -23275,8 +23312,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23275
23312
|
*/
|
|
23276
23313
|
async verifyConstraintFences() {
|
|
23277
23314
|
const activeRow = await this.#baseBackend.getActiveSchema(this.graphId);
|
|
23278
|
-
const graph = activeRow === void 0 ? this.#graph : this.#catchUpToStored(
|
|
23279
|
-
const registry = graph === this.#graph ? this.#registry :
|
|
23315
|
+
const graph = activeRow === void 0 ? this.#graph : this.#catchUpToStored(chunkL2REUAJB_cjs.parseSerializedSchema(activeRow.schema_doc));
|
|
23316
|
+
const registry = graph === this.#graph ? this.#registry : chunkL2REUAJB_cjs.buildKindRegistry(graph);
|
|
23280
23317
|
return verifyConstraintFences({
|
|
23281
23318
|
graph,
|
|
23282
23319
|
registry,
|
|
@@ -23302,8 +23339,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23302
23339
|
*/
|
|
23303
23340
|
async repairContributions() {
|
|
23304
23341
|
const backend = this.#baseBackend;
|
|
23305
|
-
|
|
23306
|
-
|
|
23342
|
+
chunkZXXGMQC3_cjs.requireExtras(
|
|
23343
|
+
chunkJ34FSPSC_cjs.CONTRIBUTION_HEALTH,
|
|
23307
23344
|
this.#contributionHealth,
|
|
23308
23345
|
"contribution repair",
|
|
23309
23346
|
() => {
|
|
@@ -23317,10 +23354,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23317
23354
|
);
|
|
23318
23355
|
}
|
|
23319
23356
|
);
|
|
23320
|
-
const { repairContributions: repair } =
|
|
23357
|
+
const { repairContributions: repair } = chunkJ34FSPSC_cjs.bindExtra(
|
|
23321
23358
|
backend,
|
|
23322
23359
|
this.#contributionHealth.extras.repairContributions,
|
|
23323
|
-
|
|
23360
|
+
chunkJ34FSPSC_cjs.CONTRIBUTION_HEALTH.id
|
|
23324
23361
|
);
|
|
23325
23362
|
const { baseline } = await this.#loadCaughtUp("repair");
|
|
23326
23363
|
const vectorSlots = backend.capabilities.vector?.supported === true ? chunkHAHNRASW_cjs.resolveGraphVectorSlots(baseline) : [];
|
|
@@ -23375,10 +23412,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23375
23412
|
}
|
|
23376
23413
|
);
|
|
23377
23414
|
}
|
|
23378
|
-
const { probeContributions: probe } =
|
|
23415
|
+
const { probeContributions: probe } = chunkJ34FSPSC_cjs.bindExtra(
|
|
23379
23416
|
backend,
|
|
23380
23417
|
probeVerdict,
|
|
23381
|
-
|
|
23418
|
+
chunkJ34FSPSC_cjs.CONTRIBUTION_HEALTH.id
|
|
23382
23419
|
);
|
|
23383
23420
|
const vectorSlots = backend.capabilities.vector?.supported === true ? chunkHAHNRASW_cjs.resolveGraphVectorSlots(this.#graph) : [];
|
|
23384
23421
|
const entries = await probe(this.graphId, vectorSlots);
|
|
@@ -23461,8 +23498,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23461
23498
|
*/
|
|
23462
23499
|
async rebuildContribution(scope, options) {
|
|
23463
23500
|
const backend = this.#baseBackend;
|
|
23464
|
-
|
|
23465
|
-
|
|
23501
|
+
chunkZXXGMQC3_cjs.requireExtras(
|
|
23502
|
+
chunkJ34FSPSC_cjs.CONTRIBUTION_HEALTH,
|
|
23466
23503
|
this.#contributionHealth,
|
|
23467
23504
|
"contribution rebuild",
|
|
23468
23505
|
() => {
|
|
@@ -23476,10 +23513,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23476
23513
|
);
|
|
23477
23514
|
}
|
|
23478
23515
|
);
|
|
23479
|
-
const { rebuildContribution: rebuild } =
|
|
23516
|
+
const { rebuildContribution: rebuild } = chunkJ34FSPSC_cjs.bindExtra(
|
|
23480
23517
|
backend,
|
|
23481
23518
|
this.#contributionHealth.extras.rebuildContribution,
|
|
23482
|
-
|
|
23519
|
+
chunkJ34FSPSC_cjs.CONTRIBUTION_HEALTH.id
|
|
23483
23520
|
);
|
|
23484
23521
|
await this.#loadCaughtUp("rebuild");
|
|
23485
23522
|
const registry = this.#registry;
|
|
@@ -23535,7 +23572,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23535
23572
|
*/
|
|
23536
23573
|
async removeKinds(names, options) {
|
|
23537
23574
|
const { activeRow, storedSchema, baseline } = await this.#loadCaughtUp("remove");
|
|
23538
|
-
const plan =
|
|
23575
|
+
const plan = chunkL2REUAJB_cjs.planRemovals(baseline, names);
|
|
23539
23576
|
if (plan.removedNodeKinds.length === 0 && plan.removedEdgeKinds.length === 0) {
|
|
23540
23577
|
if (baseline === this.#graph) {
|
|
23541
23578
|
syncStoreReplacementRef(options?.ref, this);
|
|
@@ -23547,19 +23584,19 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23547
23584
|
schemaMetadataFromRow(activeRow)
|
|
23548
23585
|
);
|
|
23549
23586
|
}
|
|
23550
|
-
const compileTimeGraph =
|
|
23551
|
-
const merged = plan.document === void 0 ? compileTimeGraph :
|
|
23552
|
-
const finalGraph =
|
|
23587
|
+
const compileTimeGraph = chunkL2REUAJB_cjs.stripGraphExtension(this.#graph);
|
|
23588
|
+
const merged = plan.document === void 0 ? compileTimeGraph : chunkL2REUAJB_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
|
|
23589
|
+
const finalGraph = chunkL2REUAJB_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
|
|
23553
23590
|
const identityCascade = await this.#identityRemovalPreflight(
|
|
23554
23591
|
finalGraph,
|
|
23555
23592
|
plan.removedNodeKinds
|
|
23556
23593
|
);
|
|
23557
|
-
const committedRow = identityCascade === void 0 ? await
|
|
23594
|
+
const committedRow = identityCascade === void 0 ? await chunkL2REUAJB_cjs.commitNewSchemaVersion(
|
|
23558
23595
|
this.#backend,
|
|
23559
23596
|
finalGraph,
|
|
23560
23597
|
activeRow.version,
|
|
23561
23598
|
storedSchema
|
|
23562
|
-
) : await
|
|
23599
|
+
) : await chunkL2REUAJB_cjs.commitNewSchemaVersionWithPreflight(
|
|
23563
23600
|
this.#backend,
|
|
23564
23601
|
finalGraph,
|
|
23565
23602
|
activeRow.version,
|
|
@@ -23618,7 +23655,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23618
23655
|
async #identityRemovalPreflight(finalGraph, removedNodeKinds) {
|
|
23619
23656
|
if (removedNodeKinds.length === 0) return void 0;
|
|
23620
23657
|
const repairClosure = finalGraph.identity !== void 0;
|
|
23621
|
-
if (!repairClosure && !await
|
|
23658
|
+
if (!repairClosure && !await chunkL2REUAJB_cjs.identityKindCascadeNeeded(
|
|
23622
23659
|
this.#backend,
|
|
23623
23660
|
this.#sqlSchema(),
|
|
23624
23661
|
this.graphId,
|
|
@@ -23679,8 +23716,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23679
23716
|
schemaMetadataFromRow(activeRow)
|
|
23680
23717
|
);
|
|
23681
23718
|
}
|
|
23682
|
-
const merged =
|
|
23683
|
-
const result = await
|
|
23719
|
+
const merged = chunkL2REUAJB_cjs.applyDeprecatedKinds(baseline, nextSet);
|
|
23720
|
+
const result = await chunkL2REUAJB_cjs.ensureSchema(this.#backend, merged, {
|
|
23684
23721
|
preloaded: { activeRow, storedSchema },
|
|
23685
23722
|
autoMigrate: true
|
|
23686
23723
|
});
|
|
@@ -23688,9 +23725,9 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23688
23725
|
return this.#cloneWithGraph(merged, options?.ref, metadata);
|
|
23689
23726
|
}
|
|
23690
23727
|
#catchUpToStored(storedSchema) {
|
|
23691
|
-
const compileTimeGraph =
|
|
23692
|
-
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph :
|
|
23693
|
-
return
|
|
23728
|
+
const compileTimeGraph = chunkL2REUAJB_cjs.stripGraphExtension(this.#graph);
|
|
23729
|
+
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkL2REUAJB_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
|
|
23730
|
+
return chunkL2REUAJB_cjs.applyDeprecatedKinds(
|
|
23694
23731
|
withGraphExtension,
|
|
23695
23732
|
storedSchema.deprecatedKinds
|
|
23696
23733
|
);
|
|
@@ -23708,7 +23745,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23708
23745
|
* serializes the actual commit.
|
|
23709
23746
|
*/
|
|
23710
23747
|
async #loadCaughtUp(verb) {
|
|
23711
|
-
const activeRow = await
|
|
23748
|
+
const activeRow = await chunkL2REUAJB_cjs.loadActiveSchemaWithBootstrap(
|
|
23712
23749
|
this.#backend,
|
|
23713
23750
|
this.graphId
|
|
23714
23751
|
);
|
|
@@ -23719,7 +23756,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23719
23756
|
{ code }
|
|
23720
23757
|
);
|
|
23721
23758
|
}
|
|
23722
|
-
const storedSchema =
|
|
23759
|
+
const storedSchema = chunkL2REUAJB_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
23723
23760
|
const baseline = this.#catchUpToStored(storedSchema);
|
|
23724
23761
|
return { activeRow, storedSchema, baseline };
|
|
23725
23762
|
}
|
|
@@ -23809,8 +23846,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23809
23846
|
uniqueSidecarBatch: this.#uniqueSidecarBatch,
|
|
23810
23847
|
...identityConfig === void 0 ? {} : {
|
|
23811
23848
|
identity: {
|
|
23812
|
-
lock: (target) =>
|
|
23813
|
-
foldCreated: (target, references) =>
|
|
23849
|
+
lock: (target) => chunkXXEFDJHY_cjs.lockIdentityGraph(target, this.graphId),
|
|
23850
|
+
foldCreated: (target, references) => chunkXXEFDJHY_cjs.foldIdentityForCreatedNodes(
|
|
23814
23851
|
{
|
|
23815
23852
|
graphId: this.graphId,
|
|
23816
23853
|
registry: this.#registry,
|
|
@@ -23820,7 +23857,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23820
23857
|
target,
|
|
23821
23858
|
references
|
|
23822
23859
|
),
|
|
23823
|
-
detachDeleted: (target, ref, mode) =>
|
|
23860
|
+
detachDeleted: (target, ref, mode) => chunkXXEFDJHY_cjs.detachIdentityForNode(
|
|
23824
23861
|
{
|
|
23825
23862
|
graphId: this.graphId,
|
|
23826
23863
|
sameIdAcrossKinds: identityConfig.sameIdAcrossKinds,
|
|
@@ -23830,7 +23867,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23830
23867
|
ref,
|
|
23831
23868
|
mode
|
|
23832
23869
|
),
|
|
23833
|
-
requireValidityEndCompatible: (target, ref, validTo) =>
|
|
23870
|
+
requireValidityEndCompatible: (target, ref, validTo) => chunkXXEFDJHY_cjs.requireNodeValidityEndCompatible(
|
|
23834
23871
|
{
|
|
23835
23872
|
graphId: this.graphId,
|
|
23836
23873
|
schema: this.#sqlSchema()
|
|
@@ -23891,8 +23928,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23891
23928
|
}
|
|
23892
23929
|
const executeRaw = backend.executeRaw;
|
|
23893
23930
|
const compileSql = backend.compileSql;
|
|
23894
|
-
const projected =
|
|
23895
|
-
return
|
|
23931
|
+
const projected = chunkJ34FSPSC_cjs.projectGraphBackend(backend);
|
|
23932
|
+
return chunkJ34FSPSC_cjs.deriveBackend(projected, {
|
|
23896
23933
|
execute: (query) => {
|
|
23897
23934
|
const compiled = compileSql === void 0 ? chunkAYQBEVQY_cjs.renderSql(query, backend.dialect) : compileSql(query);
|
|
23898
23935
|
return this.#withQueryHooks(
|
|
@@ -23932,7 +23969,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
23932
23969
|
}
|
|
23933
23970
|
#createHookContext() {
|
|
23934
23971
|
return {
|
|
23935
|
-
operationId:
|
|
23972
|
+
operationId: chunkCYKHSH5O_cjs.generateId(),
|
|
23936
23973
|
graphId: this.graphId,
|
|
23937
23974
|
startedAt: /* @__PURE__ */ new Date()
|
|
23938
23975
|
};
|
|
@@ -24076,7 +24113,7 @@ var AdapterStoreImplementation = class _AdapterStoreImplementation extends Store
|
|
|
24076
24113
|
backend;
|
|
24077
24114
|
constructor(graph, backend, options, schemaMetadata) {
|
|
24078
24115
|
super(graph, backend, options, schemaMetadata, backend);
|
|
24079
|
-
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[
|
|
24116
|
+
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[chunkUZ6CJUC5_cjs.STORE_RUNTIME].backend) : Object.freeze(chunkJ34FSPSC_cjs.projectGraphBackend(this[chunkUZ6CJUC5_cjs.STORE_RUNTIME].backend));
|
|
24080
24117
|
}
|
|
24081
24118
|
/**
|
|
24082
24119
|
* Rebind this store's already-reconciled schema onto a fresh backend/
|
|
@@ -24267,8 +24304,8 @@ async function createStoreWithSchema(graph, backend, options) {
|
|
|
24267
24304
|
}
|
|
24268
24305
|
async function assertHistorySchemaOnOpen(backend, graph, options) {
|
|
24269
24306
|
if (options?.history !== true) return;
|
|
24270
|
-
const schema = options.schema === void 0 ?
|
|
24271
|
-
await
|
|
24307
|
+
const schema = options.schema === void 0 ? chunkJ34FSPSC_cjs.createSqlSchema(backend.tableNames) : chunkJ34FSPSC_cjs.requireSqlSchema(options.schema, "store schema");
|
|
24308
|
+
await chunkCYKHSH5O_cjs.assertCurrentRecordedSchema(
|
|
24272
24309
|
backend,
|
|
24273
24310
|
schema,
|
|
24274
24311
|
graph.identity !== void 0
|
|
@@ -24295,7 +24332,7 @@ var IDENTITY_GATE_CODES = {
|
|
|
24295
24332
|
};
|
|
24296
24333
|
async function ensureSchemaWithIdentityPrecedence(backend, graph, options, gate) {
|
|
24297
24334
|
try {
|
|
24298
|
-
return await
|
|
24335
|
+
return await chunkL2REUAJB_cjs.ensureSchema(backend, graph, options);
|
|
24299
24336
|
} catch (error) {
|
|
24300
24337
|
if (gate === void 0 || !isIdentityOnlyBreakingChange(error)) throw error;
|
|
24301
24338
|
throw identityMigrationRequiredError(graph.id, gate, {
|
|
@@ -24331,10 +24368,10 @@ function identityMigrationRequiredError(graphId, gate, context) {
|
|
|
24331
24368
|
);
|
|
24332
24369
|
}
|
|
24333
24370
|
function rebuildIdentityClosureWithSchemaFence(identityContext, writeContext) {
|
|
24334
|
-
return
|
|
24371
|
+
return chunkCYKHSH5O_cjs.runInWriteTransaction(
|
|
24335
24372
|
writeContext,
|
|
24336
24373
|
identityContext.backend,
|
|
24337
|
-
async (target) =>
|
|
24374
|
+
async (target) => chunkXXEFDJHY_cjs.rebuildIdentityClosureForContext({ ...identityContext, backend: target }),
|
|
24338
24375
|
{ didWrite: () => false }
|
|
24339
24376
|
);
|
|
24340
24377
|
}
|
|
@@ -24343,20 +24380,20 @@ async function prepareStoreWithSchema(graph, backend, options) {
|
|
|
24343
24380
|
graph: merged,
|
|
24344
24381
|
activeRow,
|
|
24345
24382
|
storedSchema
|
|
24346
|
-
} = await
|
|
24383
|
+
} = await chunkL2REUAJB_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
|
|
24347
24384
|
const identityProfileChanged = activeRow !== void 0 && storedSchema?.identity?.sameIdAcrossKinds !== merged.identity?.sameIdAcrossKinds;
|
|
24348
24385
|
const identityInitialization = activeRow === void 0 && merged.identity !== void 0;
|
|
24349
24386
|
const identityEnablement = identityInitialization || identityProfileChanged && storedSchema?.identity === void 0 && merged.identity !== void 0;
|
|
24350
24387
|
const identitySemanticsChanged = identityProfileChanged || activeRow !== void 0 && storedSchema !== void 0 && merged.identity !== void 0 && identityOntologyChanged(
|
|
24351
24388
|
storedSchema,
|
|
24352
|
-
|
|
24389
|
+
chunkL2REUAJB_cjs.serializeSchema(merged, activeRow.version + 1)
|
|
24353
24390
|
);
|
|
24354
24391
|
const identityGate = identitySemanticsChanged ? identityEnablement ? "enablement" : identityProfileChanged ? "profile" : "ontology" : void 0;
|
|
24355
24392
|
const identityProfile = merged.identity;
|
|
24356
24393
|
if (identityProfile !== void 0) {
|
|
24357
|
-
const resolvedIdentitySchema = options?.schema === void 0 ?
|
|
24358
|
-
const identityRegistry =
|
|
24359
|
-
await
|
|
24394
|
+
const resolvedIdentitySchema = options?.schema === void 0 ? chunkJ34FSPSC_cjs.createSqlSchema(backend.tableNames) : chunkJ34FSPSC_cjs.requireSqlSchema(options.schema, "store schema");
|
|
24395
|
+
const identityRegistry = chunkL2REUAJB_cjs.buildKindRegistry(merged);
|
|
24396
|
+
await chunkL2REUAJB_cjs.ensureIdentitySchemaStorage(backend, resolvedIdentitySchema, {
|
|
24360
24397
|
graphId: merged.id,
|
|
24361
24398
|
enablement: identityEnablement,
|
|
24362
24399
|
registry: identityRegistry,
|
|
@@ -24486,7 +24523,7 @@ async function prepareVerifiedStore(graph, backend, options) {
|
|
|
24486
24523
|
graph: merged,
|
|
24487
24524
|
activeRow,
|
|
24488
24525
|
result
|
|
24489
|
-
} = await
|
|
24526
|
+
} = await chunkL2REUAJB_cjs.loadAndVerifyGraph(backend, graph);
|
|
24490
24527
|
await assertHistorySchemaOnOpen(backend, merged, options);
|
|
24491
24528
|
return {
|
|
24492
24529
|
graph: merged,
|
|
@@ -24506,10 +24543,14 @@ async function createVerifiedAdapterStore(graph, backend, options) {
|
|
|
24506
24543
|
return [asAdapterStoreSurface(store), prepared.result];
|
|
24507
24544
|
}
|
|
24508
24545
|
|
|
24546
|
+
exports.CURRENT_ONLY_READ_NAMES = CURRENT_ONLY_READ_NAMES;
|
|
24547
|
+
exports.EDGE_TEMPORAL_READ_NAMES = EDGE_TEMPORAL_READ_NAMES;
|
|
24509
24548
|
exports.ExecutableAggregateQuery = ExecutableAggregateQuery;
|
|
24510
24549
|
exports.ExecutableQuery = ExecutableQuery;
|
|
24550
|
+
exports.IDENTITY_READ_NAMES = IDENTITY_READ_NAMES;
|
|
24511
24551
|
exports.MAX_EXPLICIT_RECURSIVE_DEPTH = MAX_EXPLICIT_RECURSIVE_DEPTH;
|
|
24512
24552
|
exports.MAX_RECURSIVE_DEPTH = MAX_RECURSIVE_DEPTH;
|
|
24553
|
+
exports.NODE_TEMPORAL_READ_NAMES = NODE_TEMPORAL_READ_NAMES;
|
|
24513
24554
|
exports.PreparedQuery = PreparedQuery;
|
|
24514
24555
|
exports.QueryBuilder = QueryBuilder;
|
|
24515
24556
|
exports.RecordedStoreView = RecordedStoreView;
|
|
@@ -24545,5 +24586,5 @@ exports.min = min;
|
|
|
24545
24586
|
exports.offsetFragment = offsetFragment;
|
|
24546
24587
|
exports.orderByFragment = orderByFragment;
|
|
24547
24588
|
exports.sum = sum;
|
|
24548
|
-
//# sourceMappingURL=chunk-
|
|
24549
|
-
//# sourceMappingURL=chunk-
|
|
24589
|
+
//# sourceMappingURL=chunk-WIUHN6SZ.cjs.map
|
|
24590
|
+
//# sourceMappingURL=chunk-WIUHN6SZ.cjs.map
|