@nicia-ai/typegraph 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/drizzle/indexes.cjs +8 -10
- package/dist/backend/drizzle/indexes.d.cts +2 -2
- package/dist/backend/drizzle/indexes.d.ts +2 -2
- package/dist/backend/drizzle/indexes.js +4 -6
- package/dist/backend/index.cjs +60 -39
- package/dist/backend/index.d.cts +60 -1
- package/dist/backend/index.d.ts +60 -1
- package/dist/backend/index.js +12 -3
- package/dist/backend/postgres/index.cjs +24 -26
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -13
- package/dist/backend/postgres/pglite-store.cjs +25 -26
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +6 -5
- package/dist/backend/postgres/pglite-store.d.ts +6 -5
- package/dist/backend/postgres/pglite-store.js +21 -22
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +13 -15
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +12 -14
- package/dist/backend/sqlite/index.cjs +25 -27
- package/dist/backend/sqlite/index.d.cts +6 -6
- package/dist/backend/sqlite/index.d.ts +6 -6
- package/dist/backend/sqlite/index.js +9 -11
- package/dist/backend/sqlite/libsql.cjs +15 -17
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +14 -16
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +26 -27
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +6 -5
- package/dist/backend/sqlite/local-store.d.ts +6 -5
- package/dist/backend/sqlite/local-store.js +22 -23
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +14 -16
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +12 -14
- package/dist/{chunk-U4JDJKPD.js → chunk-2I3DNNBU.js} +4 -4
- package/dist/{chunk-U4JDJKPD.js.map → chunk-2I3DNNBU.js.map} +1 -1
- package/dist/{chunk-NPWACFQJ.cjs → chunk-2J5NMMVR.cjs} +43 -43
- package/dist/{chunk-NPWACFQJ.cjs.map → chunk-2J5NMMVR.cjs.map} +1 -1
- package/dist/{chunk-3YFDFOYB.cjs → chunk-2X73QTIC.cjs} +12 -13
- package/dist/chunk-2X73QTIC.cjs.map +1 -0
- package/dist/{chunk-CBK2IVI2.js → chunk-3BL3JFHL.js} +40 -30
- package/dist/chunk-3BL3JFHL.js.map +1 -0
- package/dist/chunk-3SHAUJRB.js +79 -0
- package/dist/chunk-3SHAUJRB.js.map +1 -0
- package/dist/{chunk-3SK4SVTW.js → chunk-53BSOG3O.js} +8 -7
- package/dist/chunk-53BSOG3O.js.map +1 -0
- package/dist/chunk-5J4VNCUD.js +856 -0
- package/dist/chunk-5J4VNCUD.js.map +1 -0
- package/dist/chunk-5YBDB7UG.cjs +12 -0
- package/dist/{chunk-FMNUSGZ4.cjs.map → chunk-5YBDB7UG.cjs.map} +1 -1
- package/dist/{chunk-6XDBRDZE.js → chunk-6N7QBIWN.js} +7 -3
- package/dist/chunk-6N7QBIWN.js.map +1 -0
- package/dist/{chunk-EZH7FNUS.js → chunk-6QP4QXBR.js} +3 -3
- package/dist/{chunk-EZH7FNUS.js.map → chunk-6QP4QXBR.js.map} +1 -1
- package/dist/{chunk-E6TXEISH.cjs → chunk-7UTUKH4E.cjs} +4 -4
- package/dist/{chunk-E6TXEISH.cjs.map → chunk-7UTUKH4E.cjs.map} +1 -1
- package/dist/chunk-7WLEQIHA.cjs +605 -0
- package/dist/chunk-7WLEQIHA.cjs.map +1 -0
- package/dist/{chunk-BQITNFQJ.js → chunk-AQVDAKXH.js} +3 -3
- package/dist/{chunk-BQITNFQJ.js.map → chunk-AQVDAKXH.js.map} +1 -1
- package/dist/{chunk-X6CNEA32.js → chunk-BUZWMDNL.js} +5 -5
- package/dist/{chunk-X6CNEA32.js.map → chunk-BUZWMDNL.js.map} +1 -1
- package/dist/{chunk-7M3NACL3.cjs → chunk-CKFBZ4LV.cjs} +4 -4
- package/dist/{chunk-7M3NACL3.cjs.map → chunk-CKFBZ4LV.cjs.map} +1 -1
- package/dist/{chunk-SU7VQOJ3.js → chunk-CU3LPYNB.js} +4 -4
- package/dist/{chunk-SU7VQOJ3.js.map → chunk-CU3LPYNB.js.map} +1 -1
- package/dist/{chunk-IFRPHG7O.js → chunk-EFZ4S22A.js} +10 -9
- package/dist/chunk-EFZ4S22A.js.map +1 -0
- package/dist/chunk-ELA3V6UN.js +601 -0
- package/dist/chunk-ELA3V6UN.js.map +1 -0
- package/dist/{chunk-6SRLCSAV.cjs → chunk-H6I36MGT.cjs} +883 -873
- package/dist/chunk-H6I36MGT.cjs.map +1 -0
- package/dist/chunk-HAQVISUF.cjs +1098 -0
- package/dist/chunk-HAQVISUF.cjs.map +1 -0
- package/dist/{chunk-BKAKAVRW.cjs → chunk-HQRZEYYB.cjs} +44 -44
- package/dist/{chunk-BKAKAVRW.cjs.map → chunk-HQRZEYYB.cjs.map} +1 -1
- package/dist/{chunk-KAFXPB2L.js → chunk-I5CRUPKO.js} +9 -10
- package/dist/{chunk-KAFXPB2L.js.map → chunk-I5CRUPKO.js.map} +1 -1
- package/dist/{chunk-IFDXG2YJ.js → chunk-JHK6NPFV.js} +217 -305
- package/dist/chunk-JHK6NPFV.js.map +1 -0
- package/dist/chunk-JZYMOHHM.cjs +226 -0
- package/dist/chunk-JZYMOHHM.cjs.map +1 -0
- package/dist/{chunk-VXAFOF6Z.cjs → chunk-K4FB2RMO.cjs} +7 -7
- package/dist/{chunk-VXAFOF6Z.cjs.map → chunk-K4FB2RMO.cjs.map} +1 -1
- package/dist/{chunk-ERZ4QPQX.js → chunk-K6CD6W5J.js} +5 -5
- package/dist/{chunk-ERZ4QPQX.js.map → chunk-K6CD6W5J.js.map} +1 -1
- package/dist/{chunk-JD2YC62H.cjs → chunk-KHNKYSGP.cjs} +34 -34
- package/dist/{chunk-JD2YC62H.cjs.map → chunk-KHNKYSGP.cjs.map} +1 -1
- package/dist/{chunk-CWX77JB4.cjs → chunk-KLR77R5A.cjs} +13 -13
- package/dist/{chunk-CWX77JB4.cjs.map → chunk-KLR77R5A.cjs.map} +1 -1
- package/dist/{chunk-AOL64O4Z.js → chunk-L3DDZUZP.js} +3 -3
- package/dist/{chunk-AOL64O4Z.js.map → chunk-L3DDZUZP.js.map} +1 -1
- package/dist/{chunk-PZHC5GCD.js → chunk-L5ET7FYQ.js} +3 -3
- package/dist/{chunk-PZHC5GCD.js.map → chunk-L5ET7FYQ.js.map} +1 -1
- package/dist/{chunk-B63IFHXR.cjs → chunk-LFFVD5ZR.cjs} +41 -41
- package/dist/{chunk-B63IFHXR.cjs.map → chunk-LFFVD5ZR.cjs.map} +1 -1
- package/dist/chunk-LL5D5T5W.cjs +157 -0
- package/dist/chunk-LL5D5T5W.cjs.map +1 -0
- package/dist/{chunk-GUUWKPTK.cjs → chunk-LLE25NRD.cjs} +7 -7
- package/dist/{chunk-GUUWKPTK.cjs.map → chunk-LLE25NRD.cjs.map} +1 -1
- package/dist/chunk-LLHMAHG4.cjs +886 -0
- package/dist/chunk-LLHMAHG4.cjs.map +1 -0
- package/dist/{chunk-KIZSHRUI.cjs → chunk-M2RPZS7J.cjs} +10 -10
- package/dist/{chunk-KIZSHRUI.cjs.map → chunk-M2RPZS7J.cjs.map} +1 -1
- package/dist/chunk-MNURF4RF.cjs +85 -0
- package/dist/chunk-MNURF4RF.cjs.map +1 -0
- package/dist/chunk-QOHTVDHU.js +144 -0
- package/dist/chunk-QOHTVDHU.js.map +1 -0
- package/dist/{chunk-HTQOBY75.cjs → chunk-QXKVUJLI.cjs} +110 -109
- package/dist/chunk-QXKVUJLI.cjs.map +1 -0
- package/dist/{chunk-GNPGGLAE.cjs → chunk-QYDUCWD2.cjs} +4 -4
- package/dist/{chunk-GNPGGLAE.cjs.map → chunk-QYDUCWD2.cjs.map} +1 -1
- package/dist/{chunk-DOKUXLFH.js → chunk-QZYGZVUI.js} +34 -34
- package/dist/chunk-QZYGZVUI.js.map +1 -0
- package/dist/{chunk-GKQU44SQ.cjs → chunk-SAMJLDGG.cjs} +103 -103
- package/dist/{chunk-GKQU44SQ.cjs.map → chunk-SAMJLDGG.cjs.map} +1 -1
- package/dist/{chunk-DOVMTPKE.cjs → chunk-SE422RES.cjs} +27 -27
- package/dist/{chunk-DOVMTPKE.cjs.map → chunk-SE422RES.cjs.map} +1 -1
- package/dist/{chunk-5ELKD2FQ.cjs → chunk-UCHW2MGP.cjs} +330 -431
- package/dist/chunk-UCHW2MGP.cjs.map +1 -0
- package/dist/{chunk-Y6UA55YS.cjs → chunk-UDS5DZNY.cjs} +495 -1095
- package/dist/chunk-UDS5DZNY.cjs.map +1 -0
- package/dist/{chunk-VDYA2HMS.js → chunk-VWEFXG73.js} +3 -3
- package/dist/{chunk-VDYA2HMS.js.map → chunk-VWEFXG73.js.map} +1 -1
- package/dist/{chunk-KXFUQNF2.js → chunk-W66YCXWT.js} +463 -1047
- package/dist/chunk-W66YCXWT.js.map +1 -0
- package/dist/{chunk-NQBYTLPW.js → chunk-XMEYZYGE.js} +6 -6
- package/dist/{chunk-NQBYTLPW.js.map → chunk-XMEYZYGE.js.map} +1 -1
- package/dist/{chunk-G3CSQLLT.js → chunk-Y5UC3IXF.js} +461 -6
- package/dist/chunk-Y5UC3IXF.js.map +1 -0
- package/dist/{chunk-SDHV2MWU.js → chunk-YGX4PMG6.js} +5 -5
- package/dist/{chunk-SDHV2MWU.js.map → chunk-YGX4PMG6.js.map} +1 -1
- package/dist/{chunk-E2Q7SP2K.cjs → chunk-YIX3BEBR.cjs} +86 -85
- package/dist/chunk-YIX3BEBR.cjs.map +1 -0
- package/dist/{chunk-X6RDQ5NB.cjs → chunk-YX3H63VV.cjs} +8 -2
- package/dist/chunk-YX3H63VV.cjs.map +1 -0
- package/dist/chunk-YYLMXERH.js +211 -0
- package/dist/chunk-YYLMXERH.js.map +1 -0
- package/dist/{chunk-YPUNPG2T.js → chunk-ZE7E46IZ.js} +5 -5
- package/dist/{chunk-YPUNPG2T.js.map → chunk-ZE7E46IZ.js.map} +1 -1
- package/dist/{chunk-Z2PPIVOO.js → chunk-ZVME6OSV.js} +5 -5
- package/dist/{chunk-Z2PPIVOO.js.map → chunk-ZVME6OSV.js.map} +1 -1
- package/dist/core/index.cjs +15 -3
- package/dist/core/index.d.cts +4 -3
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.js +2 -2
- package/dist/{ddl-Dx3Z0_WC.d.ts → ddl-BLEzHw6j.d.ts} +3 -3
- package/dist/{ddl-J6sDyABg.d.cts → ddl-KnCdF_le.d.cts} +3 -3
- package/dist/{define-graph-CzEvA_8F.d.cts → define-graph-Cv3CFwKm.d.cts} +1 -1
- package/dist/{define-graph-DRo9xpYN.d.ts → define-graph-DQnj3fNH.d.ts} +1 -1
- package/dist/graph-merge/index.cjs +37 -38
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +6 -5
- package/dist/graph-merge/index.d.ts +6 -5
- package/dist/graph-merge/index.js +15 -16
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/index.cjs +141 -117
- package/dist/index.d.cts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.js +22 -22
- package/dist/indexes/index.cjs +12 -14
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +5 -7
- package/dist/interchange/index.cjs +28 -29
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +6 -5
- package/dist/interchange/index.d.ts +6 -5
- package/dist/interchange/index.js +9 -10
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-CASfhmzV.d.ts → manager-DjE6Mhag.d.ts} +2 -2
- package/dist/{manager-nCEJiYBb.d.cts → manager-mqee5MVB.d.cts} +2 -2
- package/dist/{postgres-DMgIKQU-.d.cts → postgres-Bm4DyFQU.d.cts} +100 -49
- package/dist/{postgres-Cl1ZAN1G.d.ts → postgres-DtaVALOZ.d.ts} +100 -49
- package/dist/profiler/index.d.cts +8 -7
- package/dist/profiler/index.d.ts +8 -7
- package/dist/provenance/index.cjs +19 -19
- package/dist/provenance/index.d.cts +6 -5
- package/dist/provenance/index.d.ts +6 -5
- package/dist/provenance/index.js +6 -6
- package/dist/schema/index.cjs +25 -27
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +5 -5
- package/dist/schema/index.d.ts +5 -5
- package/dist/schema/index.js +6 -8
- package/dist/schema/index.js.map +1 -1
- package/dist/{temporal-DqtOEo_B.d.ts → searchable-BxlJQVFw.d.cts} +3 -58
- package/dist/{temporal-BC_NQV5Y.d.cts → searchable-ChJ29MCd.d.ts} +3 -58
- package/dist/{sqlite-BDkW39aa.d.cts → sqlite-DT6tTHOG.d.cts} +124 -97
- package/dist/{sqlite-CYfhvESj.d.ts → sqlite-m9Izphk_.d.ts} +124 -97
- package/dist/{store-view-BJd6Vwpt.d.cts → store-view-C-buB8Q8.d.cts} +7 -14
- package/dist/{store-view-CLIhwMMX.d.ts → store-view-CagdeyNn.d.ts} +7 -14
- package/dist/temporal-CyFsSPe8.d.ts +73 -0
- package/dist/temporal-Dn_JADWY.d.cts +73 -0
- package/dist/{types-CUevi_D1.d.ts → types-CYdXzZef.d.ts} +1 -1
- package/dist/{types-COq3-vMC.d.cts → types-CqSfMRW3.d.cts} +1 -1
- package/dist/{where-C92TXCzT.d.cts → where-C3-HRgUq.d.cts} +1 -1
- package/dist/{where-BdE_cYtx.d.ts → where-sQL4u5h-.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-3SK4SVTW.js.map +0 -1
- package/dist/chunk-3YFDFOYB.cjs.map +0 -1
- package/dist/chunk-5ELKD2FQ.cjs.map +0 -1
- package/dist/chunk-6SRLCSAV.cjs.map +0 -1
- package/dist/chunk-6XDBRDZE.js.map +0 -1
- package/dist/chunk-CBK2IVI2.js.map +0 -1
- package/dist/chunk-DDCIXXOO.js +0 -9
- package/dist/chunk-DDCIXXOO.js.map +0 -1
- package/dist/chunk-DDCYVIVV.cjs +0 -44
- package/dist/chunk-DDCYVIVV.cjs.map +0 -1
- package/dist/chunk-DOKUXLFH.js.map +0 -1
- package/dist/chunk-E2Q7SP2K.cjs.map +0 -1
- package/dist/chunk-EOJFGECD.cjs +0 -284
- package/dist/chunk-EOJFGECD.cjs.map +0 -1
- package/dist/chunk-FMNUSGZ4.cjs +0 -12
- package/dist/chunk-G3CSQLLT.js.map +0 -1
- package/dist/chunk-HTQOBY75.cjs.map +0 -1
- package/dist/chunk-I6FX7AAG.js +0 -39
- package/dist/chunk-I6FX7AAG.js.map +0 -1
- package/dist/chunk-IFDXG2YJ.js.map +0 -1
- package/dist/chunk-IFRPHG7O.js.map +0 -1
- package/dist/chunk-J6IJARLG.js +0 -94
- package/dist/chunk-J6IJARLG.js.map +0 -1
- package/dist/chunk-KXFUQNF2.js.map +0 -1
- package/dist/chunk-MTNEGGM2.js +0 -273
- package/dist/chunk-MTNEGGM2.js.map +0 -1
- package/dist/chunk-SVUKGWSN.cjs +0 -102
- package/dist/chunk-SVUKGWSN.cjs.map +0 -1
- package/dist/chunk-UH2USOMG.cjs +0 -627
- package/dist/chunk-UH2USOMG.cjs.map +0 -1
- package/dist/chunk-X6RDQ5NB.cjs.map +0 -1
- package/dist/chunk-Y6UA55YS.cjs.map +0 -1
- package/dist/chunk-Y7M44XEK.js +0 -462
- package/dist/chunk-Y7M44XEK.js.map +0 -1
- package/dist/chunk-Z5QHVL5U.cjs +0 -12
- package/dist/chunk-Z5QHVL5U.cjs.map +0 -1
- package/dist/chunk-ZKZAIX42.cjs +0 -479
- package/dist/chunk-ZKZAIX42.cjs.map +0 -1
- package/dist/{index-CrFL_ENI.d.cts → types-C5pZeKTl.d.cts} +1 -1
- package/dist/{index-Bq7vSPHy.d.ts → types-D8szWDUo.d.ts} +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkTRF4EBJT_cjs = require('./chunk-TRF4EBJT.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var chunk7UTUKH4E_cjs = require('./chunk-7UTUKH4E.cjs');
|
|
5
|
+
var chunkYIX3BEBR_cjs = require('./chunk-YIX3BEBR.cjs');
|
|
6
|
+
var chunkUCHW2MGP_cjs = require('./chunk-UCHW2MGP.cjs');
|
|
7
7
|
var chunkZDH3DX3C_cjs = require('./chunk-ZDH3DX3C.cjs');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
8
|
+
var chunkJZYMOHHM_cjs = require('./chunk-JZYMOHHM.cjs');
|
|
9
|
+
var chunkQYDUCWD2_cjs = require('./chunk-QYDUCWD2.cjs');
|
|
10
|
+
var chunkLL5D5T5W_cjs = require('./chunk-LL5D5T5W.cjs');
|
|
11
|
+
var chunkK4FB2RMO_cjs = require('./chunk-K4FB2RMO.cjs');
|
|
11
12
|
var chunkRW24SAHI_cjs = require('./chunk-RW24SAHI.cjs');
|
|
12
13
|
var chunkX4PVHAZ6_cjs = require('./chunk-X4PVHAZ6.cjs');
|
|
13
14
|
var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
|
|
14
15
|
var chunkHP6LWBLB_cjs = require('./chunk-HP6LWBLB.cjs');
|
|
15
16
|
var chunkNT6ILURI_cjs = require('./chunk-NT6ILURI.cjs');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
17
|
+
var chunkMNURF4RF_cjs = require('./chunk-MNURF4RF.cjs');
|
|
18
|
+
var chunkKLR77R5A_cjs = require('./chunk-KLR77R5A.cjs');
|
|
19
|
+
var chunkLLE25NRD_cjs = require('./chunk-LLE25NRD.cjs');
|
|
20
|
+
var chunkCKFBZ4LV_cjs = require('./chunk-CKFBZ4LV.cjs');
|
|
20
21
|
var chunkZY4GXIVN_cjs = require('./chunk-ZY4GXIVN.cjs');
|
|
21
22
|
var chunkNAUA4PW5_cjs = require('./chunk-NAUA4PW5.cjs');
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var chunkX6RDQ5NB_cjs = require('./chunk-X6RDQ5NB.cjs');
|
|
23
|
+
var chunkHAQVISUF_cjs = require('./chunk-HAQVISUF.cjs');
|
|
24
|
+
var chunkYX3H63VV_cjs = require('./chunk-YX3H63VV.cjs');
|
|
25
25
|
var chunkFJMPR3OH_cjs = require('./chunk-FJMPR3OH.cjs');
|
|
26
26
|
var chunk764JHTLT_cjs = require('./chunk-764JHTLT.cjs');
|
|
27
27
|
var chunkHAHNRASW_cjs = require('./chunk-HAHNRASW.cjs');
|
|
@@ -115,7 +115,7 @@ function resolveTemporalReadParams(options, defaultTemporalMode) {
|
|
|
115
115
|
message: "Broad collection reads cannot honor recorded-time coordinates.",
|
|
116
116
|
suggestion: "Use store.asOfRecorded(...).nodes.Kind.getById/getByIds for point reads, or query() for recorded-time scans."
|
|
117
117
|
});
|
|
118
|
-
const { valid } =
|
|
118
|
+
const { valid } = chunkLL5D5T5W_cjs.resolveReadCoordinate(
|
|
119
119
|
options?.temporalMode ?? defaultTemporalMode,
|
|
120
120
|
options?.asOf
|
|
121
121
|
);
|
|
@@ -127,7 +127,7 @@ function resolveTemporalReadParams(options, defaultTemporalMode) {
|
|
|
127
127
|
if (mode === "current" || mode === "asOf") {
|
|
128
128
|
return {
|
|
129
129
|
...base,
|
|
130
|
-
asOf: asOf ??
|
|
130
|
+
asOf: asOf ?? chunkMNURF4RF_cjs.nowIso()
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
return base;
|
|
@@ -146,12 +146,12 @@ var NON_KIND_KEYS = /* @__PURE__ */ new Set([
|
|
|
146
146
|
function createReadOnlyRefusal(entity, method, coordinate) {
|
|
147
147
|
return () => {
|
|
148
148
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
149
|
-
`'${method}' is not available on a read-only StoreView (${
|
|
149
|
+
`'${method}' is not available on a read-only StoreView (${chunkLL5D5T5W_cjs.describeCoordinate(coordinate)}). A time-pinned view is a read perspective \u2014 perform writes on the live Store.`,
|
|
150
150
|
{
|
|
151
151
|
code: "STORE_VIEW_READ_ONLY",
|
|
152
152
|
entity,
|
|
153
153
|
method,
|
|
154
|
-
...
|
|
154
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate)
|
|
155
155
|
}
|
|
156
156
|
);
|
|
157
157
|
};
|
|
@@ -159,12 +159,12 @@ function createReadOnlyRefusal(entity, method, coordinate) {
|
|
|
159
159
|
function createCurrentOnlyRefusal(entity, method, coordinate) {
|
|
160
160
|
return () => Promise.reject(
|
|
161
161
|
new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
162
|
-
`'${method}' is not available on a StoreView (${
|
|
162
|
+
`'${method}' is not available on a StoreView (${chunkLL5D5T5W_cjs.describeCoordinate(coordinate)}). Constraint / index / endpoint lookups read current state only and cannot honor a temporal coordinate \u2014 use a current-mode view or the live Store.`,
|
|
163
163
|
{
|
|
164
164
|
code: "STORE_VIEW_CURRENT_ONLY",
|
|
165
165
|
entity,
|
|
166
166
|
method,
|
|
167
|
-
...
|
|
167
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate)
|
|
168
168
|
}
|
|
169
169
|
)
|
|
170
170
|
);
|
|
@@ -172,12 +172,12 @@ function createCurrentOnlyRefusal(entity, method, coordinate) {
|
|
|
172
172
|
function createBatchReadRefusal(entity, method, coordinate) {
|
|
173
173
|
return () => {
|
|
174
174
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
175
|
-
`'${method}' is not available on a read-only StoreView (${
|
|
175
|
+
`'${method}' is not available on a read-only StoreView (${chunkLL5D5T5W_cjs.describeCoordinate(coordinate)}). Batch endpoint reads resolve through store.batch(...), which a view does not expose \u2014 use the live Store's batch loader, or the view's findFrom / findTo / findByEndpoints for single reads.`,
|
|
176
176
|
{
|
|
177
177
|
code: "STORE_VIEW_BATCH_UNAVAILABLE",
|
|
178
178
|
entity,
|
|
179
179
|
method,
|
|
180
|
-
...
|
|
180
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate)
|
|
181
181
|
}
|
|
182
182
|
);
|
|
183
183
|
};
|
|
@@ -185,12 +185,12 @@ function createBatchReadRefusal(entity, method, coordinate) {
|
|
|
185
185
|
function createRecordedUnsupportedRefusal(entity, method, coordinate) {
|
|
186
186
|
return () => Promise.reject(
|
|
187
187
|
new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
188
|
-
`'${method}' is not available on a RecordedStoreView (${
|
|
188
|
+
`'${method}' is not available on a RecordedStoreView (${chunkLL5D5T5W_cjs.describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and collection getById/getByIds/scan reads.`,
|
|
189
189
|
{
|
|
190
190
|
code: "RECORDED_STORE_VIEW_UNSUPPORTED",
|
|
191
191
|
entity,
|
|
192
192
|
method,
|
|
193
|
-
...
|
|
193
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate)
|
|
194
194
|
}
|
|
195
195
|
)
|
|
196
196
|
);
|
|
@@ -315,17 +315,17 @@ function pinnedEdgeCollectionsFor(store, coordinate, wrap) {
|
|
|
315
315
|
}
|
|
316
316
|
function recordedNodeCollection(store, kind, live, coordinate) {
|
|
317
317
|
const reads = {
|
|
318
|
-
getById: (id) =>
|
|
319
|
-
getByIds: (ids) =>
|
|
320
|
-
scan: (options) =>
|
|
318
|
+
getById: (id) => chunkUCHW2MGP_cjs.storeRuntime(store).recordedNodeGetById(kind, id, coordinate),
|
|
319
|
+
getByIds: (ids) => chunkUCHW2MGP_cjs.storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate),
|
|
320
|
+
scan: (options) => chunkUCHW2MGP_cjs.storeRuntime(store).recordedNodeScan(kind, coordinate, options)
|
|
321
321
|
};
|
|
322
322
|
return recordedCollectionProxy(reads, live, coordinate, "node");
|
|
323
323
|
}
|
|
324
324
|
function recordedEdgeCollection(store, kind, live, coordinate) {
|
|
325
325
|
const reads = {
|
|
326
|
-
getById: (id) =>
|
|
327
|
-
getByIds: (ids) =>
|
|
328
|
-
scan: (options) =>
|
|
326
|
+
getById: (id) => chunkUCHW2MGP_cjs.storeRuntime(store).recordedEdgeGetById(kind, id, coordinate),
|
|
327
|
+
getByIds: (ids) => chunkUCHW2MGP_cjs.storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate),
|
|
328
|
+
scan: (options) => chunkUCHW2MGP_cjs.storeRuntime(store).recordedEdgeScan(kind, coordinate, options)
|
|
329
329
|
};
|
|
330
330
|
return recordedCollectionProxy(reads, live, coordinate, "edge");
|
|
331
331
|
}
|
|
@@ -363,14 +363,14 @@ function searchRefusal(method, coordinate, isCurrent) {
|
|
|
363
363
|
{
|
|
364
364
|
code: "STORE_VIEW_READ_ONLY",
|
|
365
365
|
method,
|
|
366
|
-
...
|
|
366
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate)
|
|
367
367
|
}
|
|
368
368
|
) : new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
369
|
-
`store.search.${method} is not available on a StoreView (${
|
|
369
|
+
`store.search.${method} is not available on a StoreView (${chunkLL5D5T5W_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only; historical relevance is out of scope for a temporal view. Use a current-mode view or query the live Store.`,
|
|
370
370
|
{
|
|
371
371
|
code: "STORE_VIEW_SEARCH_UNSUPPORTED",
|
|
372
372
|
method,
|
|
373
|
-
...
|
|
373
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate)
|
|
374
374
|
}
|
|
375
375
|
);
|
|
376
376
|
}
|
|
@@ -389,11 +389,11 @@ function pinnedSearch(store, coordinate) {
|
|
|
389
389
|
}
|
|
390
390
|
function recordedSearchRefusal(method, coordinate) {
|
|
391
391
|
return new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
392
|
-
`store.search.${method} is not available on a RecordedStoreView (${
|
|
392
|
+
`store.search.${method} is not available on a RecordedStoreView (${chunkLL5D5T5W_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only and cannot answer a recorded-time query. Run search on the live Store.`,
|
|
393
393
|
{
|
|
394
394
|
code: "RECORDED_STORE_VIEW_SEARCH_UNSUPPORTED",
|
|
395
395
|
method,
|
|
396
|
-
...
|
|
396
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate)
|
|
397
397
|
}
|
|
398
398
|
);
|
|
399
399
|
}
|
|
@@ -425,10 +425,10 @@ var CoordinatePinnedView = class {
|
|
|
425
425
|
* view's coordinate cannot be overridden on a per-query basis.
|
|
426
426
|
*/
|
|
427
427
|
query() {
|
|
428
|
-
return
|
|
428
|
+
return chunkUCHW2MGP_cjs.storeRuntime(this.store).sealedQuery(this.coordinate);
|
|
429
429
|
}
|
|
430
430
|
internalAlgorithms() {
|
|
431
|
-
this.#internalAlgorithms ??=
|
|
431
|
+
this.#internalAlgorithms ??= chunkUCHW2MGP_cjs.storeRuntime(
|
|
432
432
|
this.store
|
|
433
433
|
).algorithmsAtCoordinate(this.coordinate);
|
|
434
434
|
return this.#internalAlgorithms;
|
|
@@ -455,7 +455,7 @@ var CoordinatePinnedView = class {
|
|
|
455
455
|
...options,
|
|
456
456
|
...withCoordinate(this.coordinate)
|
|
457
457
|
};
|
|
458
|
-
return
|
|
458
|
+
return chunkUCHW2MGP_cjs.storeRuntime(this.store).subgraphAtCoordinate(
|
|
459
459
|
rootId,
|
|
460
460
|
internalOptions
|
|
461
461
|
);
|
|
@@ -538,7 +538,7 @@ var StoreView = class extends CoordinatePinnedView {
|
|
|
538
538
|
constructor(store, coordinate) {
|
|
539
539
|
super(
|
|
540
540
|
store,
|
|
541
|
-
isReadCoordinate(coordinate) ? coordinate :
|
|
541
|
+
isReadCoordinate(coordinate) ? coordinate : chunkLL5D5T5W_cjs.resolveReadCoordinate(
|
|
542
542
|
coordinate.mode,
|
|
543
543
|
coordinate.asOf,
|
|
544
544
|
'Use store.asOf("2026-01-01T00:00:00.000Z") or store.view({ mode: "asOf", asOf }).'
|
|
@@ -549,7 +549,7 @@ var StoreView = class extends CoordinatePinnedView {
|
|
|
549
549
|
asOfRecorded(recordedAsOf) {
|
|
550
550
|
return new RecordedStoreView(
|
|
551
551
|
this.store,
|
|
552
|
-
|
|
552
|
+
chunkLL5D5T5W_cjs.withRecordedCoordinate(this.coordinate, recordedAsOf)
|
|
553
553
|
);
|
|
554
554
|
}
|
|
555
555
|
/** Read-only node collections pinned to this view's coordinate. */
|
|
@@ -612,7 +612,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
|
|
|
612
612
|
}
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
|
-
/** The recorded/system-time
|
|
615
|
+
/** The recorded/system-time anchor this view reconstructs. */
|
|
616
616
|
get asOfRecorded() {
|
|
617
617
|
const recorded = this.coordinate.recorded;
|
|
618
618
|
if (recorded === void 0) {
|
|
@@ -858,10 +858,10 @@ function assertRecursiveEmitterClauseAlignment(logicalPlan, input) {
|
|
|
858
858
|
function emitRecursiveQuerySql(input) {
|
|
859
859
|
assertRecursiveEmitterClauseAlignment(input.logicalPlan, input);
|
|
860
860
|
const parts = [
|
|
861
|
-
|
|
861
|
+
chunkYX3H63VV_cjs.sql`WITH RECURSIVE`,
|
|
862
862
|
input.recursiveCte,
|
|
863
|
-
|
|
864
|
-
|
|
863
|
+
chunkYX3H63VV_cjs.sql`SELECT ${input.projection}`,
|
|
864
|
+
chunkYX3H63VV_cjs.sql`FROM recursive_cte`,
|
|
865
865
|
input.depthFilter
|
|
866
866
|
];
|
|
867
867
|
if (input.orderBy !== void 0) {
|
|
@@ -870,7 +870,7 @@ function emitRecursiveQuerySql(input) {
|
|
|
870
870
|
if (input.limitOffset !== void 0) {
|
|
871
871
|
parts.push(input.limitOffset);
|
|
872
872
|
}
|
|
873
|
-
return
|
|
873
|
+
return chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql` `);
|
|
874
874
|
}
|
|
875
875
|
|
|
876
876
|
// src/query/compiler/emitter/set-operations.ts
|
|
@@ -908,13 +908,13 @@ function emitSetOperationQuerySql(input) {
|
|
|
908
908
|
);
|
|
909
909
|
const parts = [];
|
|
910
910
|
if (input.ctes !== void 0 && input.ctes.length > 0) {
|
|
911
|
-
parts.push(
|
|
911
|
+
parts.push(chunkYX3H63VV_cjs.sql`WITH ${chunkYX3H63VV_cjs.sql.join([...input.ctes], chunkYX3H63VV_cjs.sql`, `)}`);
|
|
912
912
|
}
|
|
913
913
|
parts.push(input.baseQuery);
|
|
914
914
|
if (input.suffixClauses !== void 0 && input.suffixClauses.length > 0) {
|
|
915
915
|
parts.push(...input.suffixClauses);
|
|
916
916
|
}
|
|
917
|
-
return
|
|
917
|
+
return chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql` `);
|
|
918
918
|
}
|
|
919
919
|
|
|
920
920
|
// src/query/compiler/emitter/standard.ts
|
|
@@ -962,9 +962,9 @@ function emitStandardQuerySql(input) {
|
|
|
962
962
|
assertStandardEmitterClauseAlignment(input.logicalPlan, input);
|
|
963
963
|
const parts = [];
|
|
964
964
|
if (input.ctes.length > 0) {
|
|
965
|
-
parts.push(
|
|
965
|
+
parts.push(chunkYX3H63VV_cjs.sql`WITH ${chunkYX3H63VV_cjs.sql.join([...input.ctes], chunkYX3H63VV_cjs.sql`, `)}`);
|
|
966
966
|
}
|
|
967
|
-
parts.push(
|
|
967
|
+
parts.push(chunkYX3H63VV_cjs.sql`SELECT ${input.projection}`, input.fromClause);
|
|
968
968
|
if (input.groupBy !== void 0) {
|
|
969
969
|
parts.push(input.groupBy);
|
|
970
970
|
}
|
|
@@ -977,7 +977,7 @@ function emitStandardQuerySql(input) {
|
|
|
977
977
|
if (input.limitOffset !== void 0) {
|
|
978
978
|
parts.push(input.limitOffset);
|
|
979
979
|
}
|
|
980
|
-
return
|
|
980
|
+
return chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql` `);
|
|
981
981
|
}
|
|
982
982
|
|
|
983
983
|
// src/utils/identifier.ts
|
|
@@ -1079,7 +1079,7 @@ var EDGE_COLUMNS = [
|
|
|
1079
1079
|
];
|
|
1080
1080
|
var EMPTY_REQUIRED_COLUMNS = /* @__PURE__ */ new Set();
|
|
1081
1081
|
function quoteIdentifier(identifier) {
|
|
1082
|
-
return
|
|
1082
|
+
return chunkYX3H63VV_cjs.sql.identifier(identifier);
|
|
1083
1083
|
}
|
|
1084
1084
|
function shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns) {
|
|
1085
1085
|
if (alwaysRequiredColumns?.has(column)) return true;
|
|
@@ -1119,7 +1119,7 @@ function markSelectiveFieldAsRequired(requiredColumnsByAlias, field2) {
|
|
|
1119
1119
|
addRequiredColumn(requiredColumnsByAlias, field2.alias, "props");
|
|
1120
1120
|
}
|
|
1121
1121
|
function getTopLevelPropsFieldName(field2) {
|
|
1122
|
-
const pointer =
|
|
1122
|
+
const pointer = chunkUCHW2MGP_cjs.getFieldPointer(field2);
|
|
1123
1123
|
if (pointer === void 0) return void 0;
|
|
1124
1124
|
const segments = chunkTDXIBCGY_cjs.parseJsonPointer(pointer);
|
|
1125
1125
|
return segments.length === 1 ? segments[0] : void 0;
|
|
@@ -1144,12 +1144,12 @@ function isAggregateExpr(source) {
|
|
|
1144
1144
|
// src/query/compiler/emitter/standard-builders.ts
|
|
1145
1145
|
function compileColumnReference(tableAlias, column) {
|
|
1146
1146
|
if (tableAlias === void 0) {
|
|
1147
|
-
return
|
|
1147
|
+
return chunkYX3H63VV_cjs.sql.raw(column);
|
|
1148
1148
|
}
|
|
1149
|
-
return
|
|
1149
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(tableAlias)}.${chunkYX3H63VV_cjs.sql.raw(column)}`;
|
|
1150
1150
|
}
|
|
1151
1151
|
function qualifyColumn(owner, name) {
|
|
1152
|
-
return
|
|
1152
|
+
return chunkYX3H63VV_cjs.sql`${quoteIdentifier(owner)}.${quoteIdentifier(name)}`;
|
|
1153
1153
|
}
|
|
1154
1154
|
var SCOPED_RELEVANCE_NODES_ALIAS = "scoped_relevance_nodes";
|
|
1155
1155
|
function selectivePropsCteColumnName(field2) {
|
|
@@ -1158,14 +1158,14 @@ function selectivePropsCteColumnName(field2) {
|
|
|
1158
1158
|
return boundPgIdentifier(encoded, `${alias}\0${fieldName}`);
|
|
1159
1159
|
}
|
|
1160
1160
|
function buildScopedNodeIdsSubquery(nodeAlias) {
|
|
1161
|
-
const cteAlias = `${
|
|
1162
|
-
return
|
|
1161
|
+
const cteAlias = `${chunkJZYMOHHM_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`;
|
|
1162
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1163
1163
|
(
|
|
1164
1164
|
SELECT DISTINCT
|
|
1165
1165
|
${qualifyColumn(cteAlias, `${nodeAlias}_id`)} AS node_id,
|
|
1166
1166
|
${qualifyColumn(cteAlias, `${nodeAlias}_kind`)} AS node_kind
|
|
1167
1167
|
FROM ${quoteIdentifier(cteAlias)}
|
|
1168
|
-
) AS ${
|
|
1168
|
+
) AS ${chunkYX3H63VV_cjs.sql.raw(SCOPED_RELEVANCE_NODES_ALIAS)}
|
|
1169
1169
|
`;
|
|
1170
1170
|
}
|
|
1171
1171
|
function compileSelectivePropsSelectColumns(input) {
|
|
@@ -1181,7 +1181,7 @@ function compileSelectivePropsSelectColumns(input) {
|
|
|
1181
1181
|
propsColumn,
|
|
1182
1182
|
dialect
|
|
1183
1183
|
);
|
|
1184
|
-
return
|
|
1184
|
+
return chunkYX3H63VV_cjs.sql`${extracted} AS ${quoteIdentifier(selectivePropsCteColumnName(field2))}`;
|
|
1185
1185
|
});
|
|
1186
1186
|
}
|
|
1187
1187
|
function appendSelectivePropsColumns(baseColumns, input) {
|
|
@@ -1192,7 +1192,7 @@ function compileNodeSelectColumns(input) {
|
|
|
1192
1192
|
const baseColumns = NODE_COLUMNS.filter(
|
|
1193
1193
|
(column) => column === "id" || column === "kind" || shouldProjectColumn(requiredColumns, column)
|
|
1194
1194
|
).map(
|
|
1195
|
-
(column) =>
|
|
1195
|
+
(column) => chunkYX3H63VV_cjs.sql`${compileColumnReference(tableAlias, column)} AS ${chunkYX3H63VV_cjs.sql.raw(`${alias}_${column}`)}`
|
|
1196
1196
|
);
|
|
1197
1197
|
return appendSelectivePropsColumns(baseColumns, {
|
|
1198
1198
|
alias,
|
|
@@ -1206,7 +1206,7 @@ function compileEdgeSelectColumns(input) {
|
|
|
1206
1206
|
const baseColumns = EDGE_COLUMNS.filter(
|
|
1207
1207
|
(column) => shouldProjectColumn(requiredColumns, column)
|
|
1208
1208
|
).map(
|
|
1209
|
-
(column) =>
|
|
1209
|
+
(column) => chunkYX3H63VV_cjs.sql`${compileColumnReference(tableAlias, column)} AS ${chunkYX3H63VV_cjs.sql.raw(`${alias}_${column}`)}`
|
|
1210
1210
|
);
|
|
1211
1211
|
return appendSelectivePropsColumns(baseColumns, {
|
|
1212
1212
|
alias,
|
|
@@ -1219,29 +1219,29 @@ function buildStandardStartCte(input) {
|
|
|
1219
1219
|
const { ast, ctx, graphId, predicateIndex, requiredColumnsByAlias } = input;
|
|
1220
1220
|
const alias = ast.start.alias;
|
|
1221
1221
|
const kinds = ast.start.kinds;
|
|
1222
|
-
const cteMaterialization = ctx.dialect.capabilities.emitNotMaterializedHint ?
|
|
1223
|
-
const kindFilter =
|
|
1222
|
+
const cteMaterialization = ctx.dialect.capabilities.emitNotMaterializedHint ? chunkYX3H63VV_cjs.sql`NOT MATERIALIZED ` : chunkYX3H63VV_cjs.sql``;
|
|
1223
|
+
const kindFilter = chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("kind"), kinds);
|
|
1224
1224
|
const temporalFilter = input.temporalFilterPass.forAlias();
|
|
1225
1225
|
const cteContext = { ...ctx, cteColumnPrefix: "" };
|
|
1226
|
-
const predicateClauses =
|
|
1227
|
-
|
|
1226
|
+
const predicateClauses = chunkUCHW2MGP_cjs.compilePredicateClauses(
|
|
1227
|
+
chunkUCHW2MGP_cjs.getPredicatesForAlias(predicateIndex, alias, "node"),
|
|
1228
1228
|
cteContext
|
|
1229
1229
|
);
|
|
1230
1230
|
const whereClauses = [
|
|
1231
|
-
|
|
1231
|
+
chunkYX3H63VV_cjs.sql`graph_id = ${graphId}`,
|
|
1232
1232
|
kindFilter,
|
|
1233
1233
|
temporalFilter,
|
|
1234
1234
|
...predicateClauses
|
|
1235
1235
|
];
|
|
1236
1236
|
const effectiveRequiredColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(alias) ?? EMPTY_REQUIRED_COLUMNS : void 0;
|
|
1237
|
-
const limitClause = input.limitOffset === void 0 ?
|
|
1237
|
+
const limitClause = input.limitOffset === void 0 ? chunkYX3H63VV_cjs.sql`` : input.limitOffset.offset === void 0 ? chunkYX3H63VV_cjs.sql`
|
|
1238
1238
|
LIMIT ${input.limitOffset.limit}
|
|
1239
|
-
` :
|
|
1239
|
+
` : chunkYX3H63VV_cjs.sql`
|
|
1240
1240
|
LIMIT ${input.limitOffset.limit} OFFSET ${input.limitOffset.offset}
|
|
1241
1241
|
`;
|
|
1242
|
-
return
|
|
1243
|
-
cte_${
|
|
1244
|
-
SELECT ${
|
|
1242
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1243
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(alias)} AS ${cteMaterialization}(
|
|
1244
|
+
SELECT ${chunkYX3H63VV_cjs.sql.join(
|
|
1245
1245
|
compileNodeSelectColumns({
|
|
1246
1246
|
alias,
|
|
1247
1247
|
dialect: ctx.dialect,
|
|
@@ -1249,10 +1249,10 @@ function buildStandardStartCte(input) {
|
|
|
1249
1249
|
selectiveFields: ast.selectiveFields,
|
|
1250
1250
|
tableAlias: void 0
|
|
1251
1251
|
}),
|
|
1252
|
-
|
|
1252
|
+
chunkYX3H63VV_cjs.sql`, `
|
|
1253
1253
|
)}
|
|
1254
1254
|
FROM ${ctx.schema.nodesTable}
|
|
1255
|
-
WHERE ${
|
|
1255
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(whereClauses, chunkYX3H63VV_cjs.sql` AND `)}${limitClause}
|
|
1256
1256
|
)
|
|
1257
1257
|
`;
|
|
1258
1258
|
}
|
|
@@ -1271,31 +1271,31 @@ function buildStandardTraversalCte(input) {
|
|
|
1271
1271
|
} = input;
|
|
1272
1272
|
const traversal = chunk764JHTLT_cjs.requireDefined(ast.traversals[traversalIndex]);
|
|
1273
1273
|
const traversalLimitValue = traversalIndex === ast.traversals.length - 1 ? traversalLimit : void 0;
|
|
1274
|
-
const previousNodeKinds =
|
|
1274
|
+
const previousNodeKinds = chunkUCHW2MGP_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
1275
1275
|
const directEdgeKinds = [...new Set(traversal.edgeKinds)];
|
|
1276
1276
|
const inverseEdgeKinds = traversal.inverseEdgeKinds === void 0 ? [] : [...new Set(traversal.inverseEdgeKinds)];
|
|
1277
1277
|
const nodeKinds = traversal.nodeKinds;
|
|
1278
|
-
const nodeKindFilter =
|
|
1278
|
+
const nodeKindFilter = chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("n.kind"), nodeKinds);
|
|
1279
1279
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
1280
1280
|
const nodeTemporalFilter = temporalFilterPass.forAlias("n");
|
|
1281
1281
|
const nodeCteContext = {
|
|
1282
1282
|
...ctx,
|
|
1283
1283
|
cteColumnPrefix: "n"
|
|
1284
1284
|
};
|
|
1285
|
-
const nodePredicateClauses =
|
|
1286
|
-
|
|
1285
|
+
const nodePredicateClauses = chunkUCHW2MGP_cjs.compilePredicateClauses(
|
|
1286
|
+
chunkUCHW2MGP_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
1287
1287
|
nodeCteContext
|
|
1288
1288
|
);
|
|
1289
1289
|
const edgeCteContext = {
|
|
1290
1290
|
...ctx,
|
|
1291
1291
|
cteColumnPrefix: "e"
|
|
1292
1292
|
};
|
|
1293
|
-
const edgePredicateClauses =
|
|
1294
|
-
|
|
1293
|
+
const edgePredicateClauses = chunkUCHW2MGP_cjs.compilePredicateClauses(
|
|
1294
|
+
chunkUCHW2MGP_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
1295
1295
|
edgeCteContext
|
|
1296
1296
|
);
|
|
1297
1297
|
const baseWhereClauses = [
|
|
1298
|
-
|
|
1298
|
+
chunkYX3H63VV_cjs.sql`e.graph_id = ${graphId}`,
|
|
1299
1299
|
nodeKindFilter,
|
|
1300
1300
|
edgeTemporalFilter,
|
|
1301
1301
|
nodeTemporalFilter,
|
|
@@ -1307,9 +1307,9 @@ function buildStandardTraversalCte(input) {
|
|
|
1307
1307
|
const nodeAlias = traversal.nodeAlias;
|
|
1308
1308
|
const requiredNodeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(nodeAlias) ?? EMPTY_REQUIRED_COLUMNS : void 0;
|
|
1309
1309
|
const requiredEdgeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(edgeAlias) ?? EMPTY_REQUIRED_COLUMNS : void 0;
|
|
1310
|
-
const previousRowColumns = carryForwardPreviousColumns ? [
|
|
1311
|
-
|
|
1312
|
-
|
|
1310
|
+
const previousRowColumns = carryForwardPreviousColumns ? [chunkYX3H63VV_cjs.sql`cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.*`] : [
|
|
1311
|
+
chunkYX3H63VV_cjs.sql`cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_id AS ${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_id`,
|
|
1312
|
+
chunkYX3H63VV_cjs.sql`cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_kind AS ${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_kind`
|
|
1313
1313
|
];
|
|
1314
1314
|
const selectColumns = [
|
|
1315
1315
|
...previousRowColumns,
|
|
@@ -1328,29 +1328,29 @@ function buildStandardTraversalCte(input) {
|
|
|
1328
1328
|
tableAlias: "n"
|
|
1329
1329
|
})
|
|
1330
1330
|
];
|
|
1331
|
-
const cteMaterialization = materializeCte ?
|
|
1331
|
+
const cteMaterialization = materializeCte ? chunkYX3H63VV_cjs.sql`MATERIALIZED ` : ctx.dialect.capabilities.emitNotMaterializedHint ? chunkYX3H63VV_cjs.sql`NOT MATERIALIZED ` : chunkYX3H63VV_cjs.sql``;
|
|
1332
1332
|
function compileTraversalBranch(branch) {
|
|
1333
1333
|
const whereClauses = [
|
|
1334
1334
|
...baseWhereClauses,
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1335
|
+
chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("e.kind"), branch.edgeKinds),
|
|
1336
|
+
chunkUCHW2MGP_cjs.compileKindFilter(
|
|
1337
|
+
chunkYX3H63VV_cjs.sql.raw(`e.${branch.joinKindField}`),
|
|
1338
1338
|
previousNodeKinds
|
|
1339
1339
|
),
|
|
1340
|
-
|
|
1340
|
+
chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw(`e.${branch.targetKindField}`), nodeKinds)
|
|
1341
1341
|
];
|
|
1342
1342
|
if (branch.duplicateGuard !== void 0) {
|
|
1343
1343
|
whereClauses.push(branch.duplicateGuard);
|
|
1344
1344
|
}
|
|
1345
|
-
return
|
|
1346
|
-
SELECT ${
|
|
1347
|
-
FROM cte_${
|
|
1348
|
-
JOIN ${ctx.schema.edgesTable} e ON cte_${
|
|
1349
|
-
AND cte_${
|
|
1345
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1346
|
+
SELECT ${chunkYX3H63VV_cjs.sql.join(selectColumns, chunkYX3H63VV_cjs.sql`, `)}
|
|
1347
|
+
FROM cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}
|
|
1348
|
+
JOIN ${ctx.schema.edgesTable} e ON cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_id = e.${chunkYX3H63VV_cjs.sql.raw(branch.joinField)}
|
|
1349
|
+
AND cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_kind = e.${chunkYX3H63VV_cjs.sql.raw(branch.joinKindField)}
|
|
1350
1350
|
JOIN ${ctx.schema.nodesTable} n ON n.graph_id = e.graph_id
|
|
1351
|
-
AND n.id = e.${
|
|
1352
|
-
AND n.kind = e.${
|
|
1353
|
-
WHERE ${
|
|
1351
|
+
AND n.id = e.${chunkYX3H63VV_cjs.sql.raw(branch.targetField)}
|
|
1352
|
+
AND n.kind = e.${chunkYX3H63VV_cjs.sql.raw(branch.targetKindField)}
|
|
1353
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(whereClauses, chunkYX3H63VV_cjs.sql` AND `)}
|
|
1354
1354
|
`;
|
|
1355
1355
|
}
|
|
1356
1356
|
const directJoinField = traversal.direction === "out" ? "from_id" : "to_id";
|
|
@@ -1366,8 +1366,8 @@ function buildStandardTraversalCte(input) {
|
|
|
1366
1366
|
});
|
|
1367
1367
|
if (inverseEdgeKinds.length === 0) {
|
|
1368
1368
|
if (traversalLimitValue !== void 0) {
|
|
1369
|
-
return
|
|
1370
|
-
cte_${
|
|
1369
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1370
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(nodeAlias)} AS ${cteMaterialization}(
|
|
1371
1371
|
SELECT * FROM (
|
|
1372
1372
|
${directBranch}
|
|
1373
1373
|
) AS traversal_rows
|
|
@@ -1375,8 +1375,8 @@ function buildStandardTraversalCte(input) {
|
|
|
1375
1375
|
)
|
|
1376
1376
|
`;
|
|
1377
1377
|
}
|
|
1378
|
-
return
|
|
1379
|
-
cte_${
|
|
1378
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1379
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(nodeAlias)} AS ${cteMaterialization}(
|
|
1380
1380
|
${directBranch}
|
|
1381
1381
|
)
|
|
1382
1382
|
`;
|
|
@@ -1388,8 +1388,8 @@ function buildStandardTraversalCte(input) {
|
|
|
1388
1388
|
const overlappingKinds = inverseEdgeKinds.filter(
|
|
1389
1389
|
(kind) => directEdgeKinds.includes(kind)
|
|
1390
1390
|
);
|
|
1391
|
-
const duplicateGuard = overlappingKinds.length > 0 ?
|
|
1392
|
-
|
|
1391
|
+
const duplicateGuard = overlappingKinds.length > 0 ? chunkYX3H63VV_cjs.sql`NOT (e.from_id = e.to_id AND ${chunkUCHW2MGP_cjs.compileKindFilter(
|
|
1392
|
+
chunkYX3H63VV_cjs.sql.raw("e.kind"),
|
|
1393
1393
|
overlappingKinds
|
|
1394
1394
|
)})` : void 0;
|
|
1395
1395
|
const inverseBranch = compileTraversalBranch({
|
|
@@ -1401,8 +1401,8 @@ function buildStandardTraversalCte(input) {
|
|
|
1401
1401
|
targetKindField: inverseTargetKindField
|
|
1402
1402
|
});
|
|
1403
1403
|
if (traversalLimitValue !== void 0) {
|
|
1404
|
-
return
|
|
1405
|
-
cte_${
|
|
1404
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1405
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(nodeAlias)} AS ${cteMaterialization}(
|
|
1406
1406
|
SELECT * FROM (
|
|
1407
1407
|
${directBranch}
|
|
1408
1408
|
UNION ALL
|
|
@@ -1412,8 +1412,8 @@ function buildStandardTraversalCte(input) {
|
|
|
1412
1412
|
)
|
|
1413
1413
|
`;
|
|
1414
1414
|
}
|
|
1415
|
-
return
|
|
1416
|
-
cte_${
|
|
1415
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1416
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(nodeAlias)} AS ${cteMaterialization}(
|
|
1417
1417
|
${directBranch}
|
|
1418
1418
|
UNION ALL
|
|
1419
1419
|
${inverseBranch}
|
|
@@ -1431,16 +1431,16 @@ function compileAggregateExprFromSource(expr, dialect) {
|
|
|
1431
1431
|
case "min":
|
|
1432
1432
|
case "max": {
|
|
1433
1433
|
const cteAlias = `cte_${field2.alias}`;
|
|
1434
|
-
const column =
|
|
1434
|
+
const column = chunkUCHW2MGP_cjs.compileFieldValue(
|
|
1435
1435
|
field2,
|
|
1436
1436
|
dialect,
|
|
1437
1437
|
field2.valueType,
|
|
1438
1438
|
cteAlias
|
|
1439
1439
|
);
|
|
1440
1440
|
if (fn === "countDistinct") {
|
|
1441
|
-
return
|
|
1441
|
+
return chunkYX3H63VV_cjs.sql`COUNT(DISTINCT ${column})`;
|
|
1442
1442
|
}
|
|
1443
|
-
return
|
|
1443
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(fn.toUpperCase())}(${column})`;
|
|
1444
1444
|
}
|
|
1445
1445
|
default: {
|
|
1446
1446
|
throw new chunkSAFZ6JTI_cjs.UnsupportedPredicateError(
|
|
@@ -1454,7 +1454,7 @@ function compileProjectedSource(field2, dialect) {
|
|
|
1454
1454
|
return compileAggregateExprFromSource(field2.source, dialect);
|
|
1455
1455
|
}
|
|
1456
1456
|
const cteAlias = field2.cteAlias ?? `cte_${field2.source.alias}`;
|
|
1457
|
-
return
|
|
1457
|
+
return chunkUCHW2MGP_cjs.compileFieldValue(
|
|
1458
1458
|
field2.source,
|
|
1459
1459
|
dialect,
|
|
1460
1460
|
field2.source.valueType,
|
|
@@ -1472,13 +1472,13 @@ function buildStandardProjection(input) {
|
|
|
1472
1472
|
}
|
|
1473
1473
|
const fields = ast.projection.fields;
|
|
1474
1474
|
if (fields.length === 0) {
|
|
1475
|
-
return
|
|
1475
|
+
return chunkYX3H63VV_cjs.sql.raw("*");
|
|
1476
1476
|
}
|
|
1477
1477
|
const projectedFields = fields.map((field2) => {
|
|
1478
1478
|
const source = compileProjectedSource(field2, dialect);
|
|
1479
|
-
return
|
|
1479
|
+
return chunkYX3H63VV_cjs.sql`${source} AS ${quoteIdentifier(field2.outputName)}`;
|
|
1480
1480
|
});
|
|
1481
|
-
return
|
|
1481
|
+
return chunkYX3H63VV_cjs.sql.join(projectedFields, chunkYX3H63VV_cjs.sql`, `);
|
|
1482
1482
|
}
|
|
1483
1483
|
function buildAliasToCteMap(ast) {
|
|
1484
1484
|
const map = /* @__PURE__ */ new Map([
|
|
@@ -1496,11 +1496,11 @@ function compileSelectiveProjection(fields, ast, collapsedTraversalCteAlias) {
|
|
|
1496
1496
|
const cteAlias = collapsedTraversalCteAlias ?? aliasToCte.get(field2.alias) ?? `cte_${field2.alias}`;
|
|
1497
1497
|
if (field2.isSystemField) {
|
|
1498
1498
|
const dbColumn = mapSelectiveSystemFieldToColumn(field2.field);
|
|
1499
|
-
return
|
|
1499
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(cteAlias)}.${chunkYX3H63VV_cjs.sql.raw(`${field2.alias}_${dbColumn}`)} AS ${quoteIdentifier(field2.outputName)}`;
|
|
1500
1500
|
}
|
|
1501
|
-
return
|
|
1501
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(cteAlias)}.${quoteIdentifier(selectivePropsCteColumnName(field2))} AS ${quoteIdentifier(field2.outputName)}`;
|
|
1502
1502
|
});
|
|
1503
|
-
return
|
|
1503
|
+
return chunkYX3H63VV_cjs.sql.join(columns, chunkYX3H63VV_cjs.sql`, `);
|
|
1504
1504
|
}
|
|
1505
1505
|
function compileOrderFieldValue(ast, field2, dialect, cteAlias) {
|
|
1506
1506
|
const selectiveField = findSelectivePropsFieldForFieldRef(
|
|
@@ -1508,48 +1508,48 @@ function compileOrderFieldValue(ast, field2, dialect, cteAlias) {
|
|
|
1508
1508
|
field2
|
|
1509
1509
|
);
|
|
1510
1510
|
if (selectiveField !== void 0) {
|
|
1511
|
-
return
|
|
1511
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(cteAlias)}.${quoteIdentifier(selectivePropsCteColumnName(selectiveField))}`;
|
|
1512
1512
|
}
|
|
1513
|
-
return
|
|
1513
|
+
return chunkUCHW2MGP_cjs.compileFieldValue(field2, dialect, field2.valueType, cteAlias);
|
|
1514
1514
|
}
|
|
1515
1515
|
function buildRelevanceJoins(vectorPredicate, fulltextPredicate) {
|
|
1516
|
-
const hybridTargetAlias =
|
|
1516
|
+
const hybridTargetAlias = chunkUCHW2MGP_cjs.getHybridTargetAlias(
|
|
1517
1517
|
vectorPredicate,
|
|
1518
1518
|
fulltextPredicate
|
|
1519
1519
|
);
|
|
1520
1520
|
if (hybridTargetAlias !== void 0) {
|
|
1521
1521
|
return [
|
|
1522
1522
|
buildHybridCandidateJoin(hybridTargetAlias),
|
|
1523
|
-
buildRelevanceJoin(
|
|
1524
|
-
buildRelevanceJoin(
|
|
1523
|
+
buildRelevanceJoin(chunkJZYMOHHM_cjs.EMBEDDINGS_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN"),
|
|
1524
|
+
buildRelevanceJoin(chunkJZYMOHHM_cjs.FULLTEXT_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN")
|
|
1525
1525
|
];
|
|
1526
1526
|
}
|
|
1527
1527
|
const joins = [];
|
|
1528
1528
|
if (vectorPredicate) {
|
|
1529
1529
|
joins.push(
|
|
1530
|
-
buildRelevanceJoin(
|
|
1530
|
+
buildRelevanceJoin(chunkJZYMOHHM_cjs.EMBEDDINGS_CTE_ALIAS, vectorPredicate.field.alias)
|
|
1531
1531
|
);
|
|
1532
1532
|
}
|
|
1533
1533
|
if (fulltextPredicate) {
|
|
1534
1534
|
joins.push(
|
|
1535
|
-
buildRelevanceJoin(
|
|
1535
|
+
buildRelevanceJoin(chunkJZYMOHHM_cjs.FULLTEXT_CTE_ALIAS, fulltextPredicate.field.alias)
|
|
1536
1536
|
);
|
|
1537
1537
|
}
|
|
1538
1538
|
return joins;
|
|
1539
1539
|
}
|
|
1540
1540
|
function buildHybridCandidateJoin(nodeAlias) {
|
|
1541
|
-
const candidateCte =
|
|
1542
|
-
const node =
|
|
1543
|
-
const idColumn =
|
|
1544
|
-
const kindColumn =
|
|
1545
|
-
return
|
|
1541
|
+
const candidateCte = chunkYX3H63VV_cjs.sql.raw(chunkJZYMOHHM_cjs.HYBRID_CANDIDATES_CTE_ALIAS);
|
|
1542
|
+
const node = chunkYX3H63VV_cjs.sql.raw(`${chunkJZYMOHHM_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
|
|
1543
|
+
const idColumn = chunkYX3H63VV_cjs.sql.raw(`${nodeAlias}_id`);
|
|
1544
|
+
const kindColumn = chunkYX3H63VV_cjs.sql.raw(`${nodeAlias}_kind`);
|
|
1545
|
+
return chunkYX3H63VV_cjs.sql`INNER JOIN ${candidateCte} ON ${candidateCte}.node_id = ${node}.${idColumn} AND ${candidateCte}.node_kind = ${node}.${kindColumn}`;
|
|
1546
1546
|
}
|
|
1547
1547
|
function buildRelevanceJoin(cteAlias, nodeAlias, joinType = "INNER JOIN") {
|
|
1548
|
-
const cte =
|
|
1549
|
-
const node =
|
|
1550
|
-
const idColumn =
|
|
1551
|
-
const kindColumn =
|
|
1552
|
-
return
|
|
1548
|
+
const cte = chunkYX3H63VV_cjs.sql.raw(cteAlias);
|
|
1549
|
+
const node = chunkYX3H63VV_cjs.sql.raw(`${chunkJZYMOHHM_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
|
|
1550
|
+
const idColumn = chunkYX3H63VV_cjs.sql.raw(`${nodeAlias}_id`);
|
|
1551
|
+
const kindColumn = chunkYX3H63VV_cjs.sql.raw(`${nodeAlias}_kind`);
|
|
1552
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(joinType)} ${cte} ON ${cte}.node_id = ${node}.${idColumn} AND ${cte}.node_kind = ${node}.${kindColumn}`;
|
|
1553
1553
|
}
|
|
1554
1554
|
function buildStandardFromClause(input) {
|
|
1555
1555
|
const {
|
|
@@ -1559,23 +1559,23 @@ function buildStandardFromClause(input) {
|
|
|
1559
1559
|
vectorPredicate
|
|
1560
1560
|
} = input;
|
|
1561
1561
|
if (collapsedTraversalCteAlias !== void 0) {
|
|
1562
|
-
return
|
|
1562
|
+
return chunkYX3H63VV_cjs.sql`FROM ${chunkYX3H63VV_cjs.sql.raw(collapsedTraversalCteAlias)}`;
|
|
1563
1563
|
}
|
|
1564
1564
|
const startAlias = ast.start.alias;
|
|
1565
|
-
const fromClause =
|
|
1565
|
+
const fromClause = chunkYX3H63VV_cjs.sql`FROM cte_${chunkYX3H63VV_cjs.sql.raw(startAlias)}`;
|
|
1566
1566
|
const joins = [];
|
|
1567
1567
|
for (const traversal of ast.traversals) {
|
|
1568
1568
|
const cteAlias = `cte_${traversal.nodeAlias}`;
|
|
1569
1569
|
const previousAlias = traversal.joinFromAlias;
|
|
1570
1570
|
const joinType = traversal.optional ? "LEFT JOIN" : "INNER JOIN";
|
|
1571
1571
|
joins.push(
|
|
1572
|
-
|
|
1572
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(joinType)} ${chunkYX3H63VV_cjs.sql.raw(cteAlias)} ON ${chunkYX3H63VV_cjs.sql.raw(cteAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_id = cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_id AND ${chunkYX3H63VV_cjs.sql.raw(cteAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_kind = cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAlias)}_kind`
|
|
1573
1573
|
);
|
|
1574
1574
|
}
|
|
1575
1575
|
for (const join of buildRelevanceJoins(vectorPredicate, fulltextPredicate)) {
|
|
1576
1576
|
joins.push(join);
|
|
1577
1577
|
}
|
|
1578
|
-
return joins.length === 0 ? fromClause :
|
|
1578
|
+
return joins.length === 0 ? fromClause : chunkYX3H63VV_cjs.sql`${fromClause} ${chunkYX3H63VV_cjs.sql.join(joins, chunkYX3H63VV_cjs.sql` `)}`;
|
|
1579
1579
|
}
|
|
1580
1580
|
function buildStandardOrderBy(input) {
|
|
1581
1581
|
const { ast, collapsedTraversalCteAlias, dialect } = input;
|
|
@@ -1600,24 +1600,24 @@ function buildStandardOrderBy(input) {
|
|
|
1600
1600
|
dialect,
|
|
1601
1601
|
cteAlias
|
|
1602
1602
|
);
|
|
1603
|
-
const direction =
|
|
1603
|
+
const direction = chunkYX3H63VV_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
1604
1604
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
1605
|
-
const nullsDirection =
|
|
1605
|
+
const nullsDirection = chunkYX3H63VV_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
1606
1606
|
parts.push(
|
|
1607
|
-
|
|
1608
|
-
|
|
1607
|
+
chunkYX3H63VV_cjs.sql`(${field2} IS NULL) ${nullsDirection}`,
|
|
1608
|
+
chunkYX3H63VV_cjs.sql`${field2} ${direction}`
|
|
1609
1609
|
);
|
|
1610
1610
|
}
|
|
1611
1611
|
for (const orderSpec of aggregateOrderBy) {
|
|
1612
1612
|
const column = quoteIdentifier(orderSpec.outputName);
|
|
1613
|
-
const direction =
|
|
1613
|
+
const direction = chunkYX3H63VV_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
1614
1614
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
1615
|
-
const nullsKeyword =
|
|
1615
|
+
const nullsKeyword = chunkYX3H63VV_cjs.sql.raw(
|
|
1616
1616
|
nulls === "first" ? "NULLS FIRST" : "NULLS LAST"
|
|
1617
1617
|
);
|
|
1618
|
-
parts.push(
|
|
1618
|
+
parts.push(chunkYX3H63VV_cjs.sql`${column} ${direction} ${nullsKeyword}`);
|
|
1619
1619
|
}
|
|
1620
|
-
return
|
|
1620
|
+
return chunkYX3H63VV_cjs.sql`ORDER BY ${chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql`, `)}`;
|
|
1621
1621
|
}
|
|
1622
1622
|
var LATE_MAT_TOPK_CTE_ALIAS = "cte_lm_topk";
|
|
1623
1623
|
var LATE_MAT_SORT_KEY_PREFIX = "__lm_sk";
|
|
@@ -1643,13 +1643,13 @@ function lateMaterializedProjectedNodeAliases(ast) {
|
|
|
1643
1643
|
function buildLateMaterializedTopKCte(input) {
|
|
1644
1644
|
const { ast, collapsedTraversalCteAlias, dialect, fromClause } = input;
|
|
1645
1645
|
const aliasToCte = buildAliasToCteMap(ast);
|
|
1646
|
-
const cteAliasFor = (alias) => collapsedTraversalCteAlias ?? aliasToCte.get(alias) ?? `${
|
|
1646
|
+
const cteAliasFor = (alias) => collapsedTraversalCteAlias ?? aliasToCte.get(alias) ?? `${chunkJZYMOHHM_cjs.ALIAS_CTE_PREFIX}${alias}`;
|
|
1647
1647
|
const columns = [];
|
|
1648
1648
|
for (const alias of lateMaterializedNodeAliases(ast)) {
|
|
1649
1649
|
const cteAlias = cteAliasFor(alias);
|
|
1650
1650
|
columns.push(
|
|
1651
|
-
|
|
1652
|
-
|
|
1651
|
+
chunkYX3H63VV_cjs.sql`${qualifyColumn(cteAlias, `${alias}_id`)} AS ${chunkYX3H63VV_cjs.sql.raw(`${alias}_id`)}`,
|
|
1652
|
+
chunkYX3H63VV_cjs.sql`${qualifyColumn(cteAlias, `${alias}_kind`)} AS ${chunkYX3H63VV_cjs.sql.raw(`${alias}_kind`)}`
|
|
1653
1653
|
);
|
|
1654
1654
|
}
|
|
1655
1655
|
for (const [index, orderSpec] of (ast.orderBy ?? []).entries()) {
|
|
@@ -1660,7 +1660,7 @@ function buildLateMaterializedTopKCte(input) {
|
|
|
1660
1660
|
cteAliasFor(orderSpec.field.alias)
|
|
1661
1661
|
);
|
|
1662
1662
|
columns.push(
|
|
1663
|
-
|
|
1663
|
+
chunkYX3H63VV_cjs.sql`${value} AS ${chunkYX3H63VV_cjs.sql.raw(`${LATE_MAT_SORT_KEY_PREFIX}${index}`)}`
|
|
1664
1664
|
);
|
|
1665
1665
|
}
|
|
1666
1666
|
const innerOrderBy = buildStandardOrderBy({
|
|
@@ -1673,45 +1673,45 @@ function buildLateMaterializedTopKCte(input) {
|
|
|
1673
1673
|
offset: input.offset
|
|
1674
1674
|
});
|
|
1675
1675
|
const parts = [
|
|
1676
|
-
|
|
1676
|
+
chunkYX3H63VV_cjs.sql`SELECT ${chunkYX3H63VV_cjs.sql.join(columns, chunkYX3H63VV_cjs.sql`, `)}`,
|
|
1677
1677
|
fromClause
|
|
1678
1678
|
];
|
|
1679
1679
|
if (innerOrderBy !== void 0) parts.push(innerOrderBy);
|
|
1680
1680
|
if (limitOffset !== void 0) parts.push(limitOffset);
|
|
1681
|
-
return
|
|
1681
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(LATE_MAT_TOPK_CTE_ALIAS)} AS (${chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql` `)})`;
|
|
1682
1682
|
}
|
|
1683
1683
|
function buildLateMaterializedOuterProjection(ast, dialect) {
|
|
1684
1684
|
const columns = (ast.selectiveFields ?? []).map((field2) => {
|
|
1685
1685
|
const physicalAlias = lateMaterializedPhysicalAlias(field2.alias);
|
|
1686
1686
|
if (field2.isSystemField) {
|
|
1687
1687
|
const dbColumn = mapSelectiveSystemFieldToColumn(field2.field);
|
|
1688
|
-
return
|
|
1688
|
+
return chunkYX3H63VV_cjs.sql`${compileColumnReference(physicalAlias, dbColumn)} AS ${quoteIdentifier(field2.outputName)}`;
|
|
1689
1689
|
}
|
|
1690
1690
|
const extracted = compileSelectivePropsExtraction(
|
|
1691
1691
|
field2,
|
|
1692
1692
|
compileColumnReference(physicalAlias, "props"),
|
|
1693
1693
|
dialect
|
|
1694
1694
|
);
|
|
1695
|
-
return
|
|
1695
|
+
return chunkYX3H63VV_cjs.sql`${extracted} AS ${quoteIdentifier(field2.outputName)}`;
|
|
1696
1696
|
});
|
|
1697
|
-
return
|
|
1697
|
+
return chunkYX3H63VV_cjs.sql.join(columns, chunkYX3H63VV_cjs.sql`, `);
|
|
1698
1698
|
}
|
|
1699
1699
|
function buildLateMaterializedOuterOrderBy(ast) {
|
|
1700
1700
|
const orderBy = ast.orderBy ?? [];
|
|
1701
1701
|
if (orderBy.length === 0) return void 0;
|
|
1702
|
-
const topk =
|
|
1702
|
+
const topk = chunkYX3H63VV_cjs.sql.raw(LATE_MAT_TOPK_CTE_ALIAS);
|
|
1703
1703
|
const parts = [];
|
|
1704
1704
|
for (const [index, orderSpec] of orderBy.entries()) {
|
|
1705
|
-
const column =
|
|
1706
|
-
const direction =
|
|
1705
|
+
const column = chunkYX3H63VV_cjs.sql`${topk}.${chunkYX3H63VV_cjs.sql.raw(`${LATE_MAT_SORT_KEY_PREFIX}${index}`)}`;
|
|
1706
|
+
const direction = chunkYX3H63VV_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
1707
1707
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
1708
|
-
const nullsDirection =
|
|
1708
|
+
const nullsDirection = chunkYX3H63VV_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
1709
1709
|
parts.push(
|
|
1710
|
-
|
|
1711
|
-
|
|
1710
|
+
chunkYX3H63VV_cjs.sql`(${column} IS NULL) ${nullsDirection}`,
|
|
1711
|
+
chunkYX3H63VV_cjs.sql`${column} ${direction}`
|
|
1712
1712
|
);
|
|
1713
1713
|
}
|
|
1714
|
-
return
|
|
1714
|
+
return chunkYX3H63VV_cjs.sql`ORDER BY ${chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql`, `)}`;
|
|
1715
1715
|
}
|
|
1716
1716
|
function fieldRefKey(field2) {
|
|
1717
1717
|
const pointer = field2.jsonPointer ?? "";
|
|
@@ -1754,22 +1754,22 @@ function buildStandardGroupBy(input) {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
const aliasToCte = buildAliasToCteMap(ast);
|
|
1756
1756
|
const parts = allFields.map(
|
|
1757
|
-
(field2) =>
|
|
1757
|
+
(field2) => chunkUCHW2MGP_cjs.compileFieldValue(
|
|
1758
1758
|
field2,
|
|
1759
1759
|
dialect,
|
|
1760
1760
|
field2.valueType,
|
|
1761
1761
|
aliasToCte.get(field2.alias) ?? `cte_${field2.alias}`
|
|
1762
1762
|
)
|
|
1763
1763
|
);
|
|
1764
|
-
return
|
|
1764
|
+
return chunkYX3H63VV_cjs.sql`GROUP BY ${chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql`, `)}`;
|
|
1765
1765
|
}
|
|
1766
1766
|
function buildStandardHaving(input) {
|
|
1767
1767
|
const { ast, ctx } = input;
|
|
1768
1768
|
if (!ast.having) {
|
|
1769
1769
|
return void 0;
|
|
1770
1770
|
}
|
|
1771
|
-
const condition =
|
|
1772
|
-
return
|
|
1771
|
+
const condition = chunkUCHW2MGP_cjs.compilePredicateExpression(ast.having, ctx);
|
|
1772
|
+
return chunkYX3H63VV_cjs.sql`HAVING ${condition}`;
|
|
1773
1773
|
}
|
|
1774
1774
|
function buildStandardEmbeddingsCte(input) {
|
|
1775
1775
|
const { ctx, graphId, nodeKinds, vectorPredicate } = input;
|
|
@@ -1789,18 +1789,18 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
1789
1789
|
const vectorSlots = ctx.vectorSlots;
|
|
1790
1790
|
const scopedNodes = buildScopedNodeIdsSubquery(field2.alias);
|
|
1791
1791
|
const declaringKinds = nodeKinds.filter(
|
|
1792
|
-
(kind) => vectorSlots?.has(
|
|
1792
|
+
(kind) => vectorSlots?.has(chunkJZYMOHHM_cjs.vectorSlotKey(kind, fieldPath))
|
|
1793
1793
|
);
|
|
1794
1794
|
const branches = declaringKinds.map((kind) => {
|
|
1795
1795
|
const tableName = vectorStrategy.tableName(graphId, kind, fieldPath);
|
|
1796
|
-
const slotDescriptor = vectorSlots?.get(
|
|
1796
|
+
const slotDescriptor = vectorSlots?.get(chunkJZYMOHHM_cjs.vectorSlotKey(kind, fieldPath));
|
|
1797
1797
|
const branchMetric = metric ?? slotDescriptor?.metric ?? "cosine";
|
|
1798
1798
|
const engineFormEligible = vectorPredicate.approximate === true || vectorStrategy.searchIsExact === true;
|
|
1799
1799
|
const annSlot = engineFormEligible && branchMetric === slotDescriptor?.metric ? slotDescriptor : void 0;
|
|
1800
1800
|
if (annSlot !== void 0) {
|
|
1801
1801
|
ctx.annIndexTypes?.add(annSlot.indexType);
|
|
1802
|
-
const candidateCte = `${
|
|
1803
|
-
const kindCandidates =
|
|
1802
|
+
const candidateCte = `${chunkJZYMOHHM_cjs.ALIAS_CTE_PREFIX}${field2.alias}`;
|
|
1803
|
+
const kindCandidates = chunkYX3H63VV_cjs.sql`SELECT ${qualifyColumn(candidateCte, `${field2.alias}_id`)} FROM ${quoteIdentifier(candidateCte)} WHERE ${qualifyColumn(candidateCte, `${field2.alias}_kind`)} = ${kind}`;
|
|
1804
1804
|
const annSql = vectorStrategy.buildSearch(
|
|
1805
1805
|
{
|
|
1806
1806
|
graphId,
|
|
@@ -1823,8 +1823,8 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
1823
1823
|
},
|
|
1824
1824
|
kindCandidates
|
|
1825
1825
|
);
|
|
1826
|
-
const distanceFromScore = branchMetric === "cosine" ?
|
|
1827
|
-
return
|
|
1826
|
+
const distanceFromScore = branchMetric === "cosine" ? chunkYX3H63VV_cjs.sql.raw("(1.0 - score)") : chunkYX3H63VV_cjs.sql.raw("score");
|
|
1827
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1828
1828
|
SELECT node_id, ${kind} AS node_kind, ${distanceFromScore} AS distance, score
|
|
1829
1829
|
FROM (${annSql}) AS tg_ann_src
|
|
1830
1830
|
`;
|
|
@@ -1834,17 +1834,17 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
1834
1834
|
queryEmbedding,
|
|
1835
1835
|
branchMetric
|
|
1836
1836
|
);
|
|
1837
|
-
const exactDistanceExpr =
|
|
1838
|
-
const scoreExpr =
|
|
1837
|
+
const exactDistanceExpr = chunkYX3H63VV_cjs.sql`(${distanceExpr} + 0.0)`;
|
|
1838
|
+
const scoreExpr = chunkHAQVISUF_cjs.vectorScoreExpression(distanceExpr, branchMetric);
|
|
1839
1839
|
const conditions = [
|
|
1840
|
-
|
|
1840
|
+
chunkYX3H63VV_cjs.sql`${qualifyColumn(tableName, "graph_id")} = ${graphId}`
|
|
1841
1841
|
];
|
|
1842
1842
|
if (minScore !== void 0) {
|
|
1843
1843
|
conditions.push(
|
|
1844
|
-
|
|
1844
|
+
chunkHAQVISUF_cjs.vectorMinScoreCondition(distanceExpr, branchMetric, minScore)
|
|
1845
1845
|
);
|
|
1846
1846
|
}
|
|
1847
|
-
return
|
|
1847
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1848
1848
|
SELECT
|
|
1849
1849
|
${qualifyColumn(tableName, "node_id")} AS node_id,
|
|
1850
1850
|
${kind} AS node_kind,
|
|
@@ -1852,20 +1852,20 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
1852
1852
|
${scoreExpr} AS score
|
|
1853
1853
|
FROM ${quoteIdentifier(tableName)}
|
|
1854
1854
|
INNER JOIN ${scopedNodes}
|
|
1855
|
-
ON ${
|
|
1855
|
+
ON ${chunkYX3H63VV_cjs.sql.raw(`${SCOPED_RELEVANCE_NODES_ALIAS}.node_id`)} =
|
|
1856
1856
|
${qualifyColumn(tableName, "node_id")}
|
|
1857
|
-
AND ${
|
|
1858
|
-
WHERE ${
|
|
1857
|
+
AND ${chunkYX3H63VV_cjs.sql.raw(`${SCOPED_RELEVANCE_NODES_ALIAS}.node_kind`)} = ${kind}
|
|
1858
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(conditions, chunkYX3H63VV_cjs.sql` AND `)}
|
|
1859
1859
|
`;
|
|
1860
1860
|
});
|
|
1861
|
-
const unionBody = branches.length === 0 ? emptyEmbeddingsBody() :
|
|
1861
|
+
const unionBody = branches.length === 0 ? emptyEmbeddingsBody() : chunkYX3H63VV_cjs.sql.join(
|
|
1862
1862
|
branches,
|
|
1863
|
-
|
|
1863
|
+
chunkYX3H63VV_cjs.sql`
|
|
1864
1864
|
UNION ALL
|
|
1865
1865
|
`
|
|
1866
1866
|
);
|
|
1867
|
-
return
|
|
1868
|
-
${
|
|
1867
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1868
|
+
${chunkYX3H63VV_cjs.sql.raw(chunkJZYMOHHM_cjs.EMBEDDINGS_CTE_ALIAS)} AS (
|
|
1869
1869
|
SELECT
|
|
1870
1870
|
node_id,
|
|
1871
1871
|
node_kind,
|
|
@@ -1881,7 +1881,7 @@ function buildStandardEmbeddingsCte(input) {
|
|
|
1881
1881
|
`;
|
|
1882
1882
|
}
|
|
1883
1883
|
function emptyEmbeddingsBody() {
|
|
1884
|
-
return
|
|
1884
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1885
1885
|
SELECT
|
|
1886
1886
|
CAST(NULL AS TEXT) AS node_id,
|
|
1887
1887
|
CAST(NULL AS TEXT) AS node_kind,
|
|
@@ -1921,15 +1921,15 @@ function buildStandardFulltextCte(input) {
|
|
|
1921
1921
|
effectiveLanguage
|
|
1922
1922
|
);
|
|
1923
1923
|
const conditions = [
|
|
1924
|
-
|
|
1925
|
-
|
|
1924
|
+
chunkYX3H63VV_cjs.sql`${qualifyColumn(tableName, "graph_id")} = ${graphId}`,
|
|
1925
|
+
chunkUCHW2MGP_cjs.compileKindFilter(qualifyColumn(tableName, "node_kind"), nodeKinds),
|
|
1926
1926
|
matchCondition
|
|
1927
1927
|
];
|
|
1928
1928
|
if (minScore !== void 0) {
|
|
1929
|
-
conditions.push(
|
|
1929
|
+
conditions.push(chunkYX3H63VV_cjs.sql`${rankExpression} >= ${minScore}`);
|
|
1930
1930
|
}
|
|
1931
|
-
return
|
|
1932
|
-
${
|
|
1931
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1932
|
+
${chunkYX3H63VV_cjs.sql.raw(chunkJZYMOHHM_cjs.FULLTEXT_CTE_ALIAS)} AS (
|
|
1933
1933
|
SELECT
|
|
1934
1934
|
node_id,
|
|
1935
1935
|
node_kind,
|
|
@@ -1942,11 +1942,11 @@ function buildStandardFulltextCte(input) {
|
|
|
1942
1942
|
${rankExpression} AS rank
|
|
1943
1943
|
FROM ${schema.fulltextTable}
|
|
1944
1944
|
INNER JOIN ${scopedNodes}
|
|
1945
|
-
ON ${
|
|
1945
|
+
ON ${chunkYX3H63VV_cjs.sql.raw(`${SCOPED_RELEVANCE_NODES_ALIAS}.node_id`)} =
|
|
1946
1946
|
${qualifyColumn(tableName, "node_id")}
|
|
1947
|
-
AND ${
|
|
1947
|
+
AND ${chunkYX3H63VV_cjs.sql.raw(`${SCOPED_RELEVANCE_NODES_ALIAS}.node_kind`)} =
|
|
1948
1948
|
${qualifyColumn(tableName, "node_kind")}
|
|
1949
|
-
WHERE ${
|
|
1949
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(conditions, chunkYX3H63VV_cjs.sql` AND `)}
|
|
1950
1950
|
ORDER BY rank DESC, ${qualifyColumn(tableName, "node_id")} ASC
|
|
1951
1951
|
LIMIT ${limit}
|
|
1952
1952
|
) AS fts_inner
|
|
@@ -1964,11 +1964,11 @@ function sharedDeclaredLanguage(fulltextLanguages, nodeKinds) {
|
|
|
1964
1964
|
return [...languages][0];
|
|
1965
1965
|
}
|
|
1966
1966
|
function buildStandardHybridCandidateCte() {
|
|
1967
|
-
return
|
|
1968
|
-
${
|
|
1969
|
-
SELECT node_id, node_kind FROM ${
|
|
1967
|
+
return chunkYX3H63VV_cjs.sql`
|
|
1968
|
+
${chunkYX3H63VV_cjs.sql.raw(chunkJZYMOHHM_cjs.HYBRID_CANDIDATES_CTE_ALIAS)} AS (
|
|
1969
|
+
SELECT node_id, node_kind FROM ${chunkYX3H63VV_cjs.sql.raw(chunkJZYMOHHM_cjs.EMBEDDINGS_CTE_ALIAS)}
|
|
1970
1970
|
UNION
|
|
1971
|
-
SELECT node_id, node_kind FROM ${
|
|
1971
|
+
SELECT node_id, node_kind FROM ${chunkYX3H63VV_cjs.sql.raw(chunkJZYMOHHM_cjs.FULLTEXT_CTE_ALIAS)}
|
|
1972
1972
|
)
|
|
1973
1973
|
`;
|
|
1974
1974
|
}
|
|
@@ -1983,64 +1983,64 @@ function compileUserOrderBy(ast, dialect) {
|
|
|
1983
1983
|
"Ordering by JSON arrays or objects is not supported"
|
|
1984
1984
|
);
|
|
1985
1985
|
}
|
|
1986
|
-
const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${
|
|
1986
|
+
const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${chunkJZYMOHHM_cjs.ALIAS_CTE_PREFIX}${orderSpec.field.alias}`;
|
|
1987
1987
|
const field2 = compileOrderFieldValue(
|
|
1988
1988
|
ast,
|
|
1989
1989
|
orderSpec.field,
|
|
1990
1990
|
dialect,
|
|
1991
1991
|
cteAlias
|
|
1992
1992
|
);
|
|
1993
|
-
const direction =
|
|
1993
|
+
const direction = chunkYX3H63VV_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
1994
1994
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
1995
|
-
const nullsDirection =
|
|
1995
|
+
const nullsDirection = chunkYX3H63VV_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
1996
1996
|
fragments.push(
|
|
1997
|
-
|
|
1998
|
-
|
|
1997
|
+
chunkYX3H63VV_cjs.sql`(${field2} IS NULL) ${nullsDirection}`,
|
|
1998
|
+
chunkYX3H63VV_cjs.sql`${field2} ${direction}`
|
|
1999
1999
|
);
|
|
2000
2000
|
}
|
|
2001
2001
|
return fragments;
|
|
2002
2002
|
}
|
|
2003
2003
|
function buildStandardFulltextOrderBy(input) {
|
|
2004
2004
|
const { ast, dialect } = input;
|
|
2005
|
-
const rankOrder =
|
|
2005
|
+
const rankOrder = chunkYX3H63VV_cjs.sql.raw(`${chunkJZYMOHHM_cjs.FULLTEXT_CTE_ALIAS}.rank DESC`);
|
|
2006
2006
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2007
|
-
return
|
|
2007
|
+
return chunkYX3H63VV_cjs.sql`ORDER BY ${chunkYX3H63VV_cjs.sql.join([rankOrder, ...userOrders], chunkYX3H63VV_cjs.sql`, `)}`;
|
|
2008
2008
|
}
|
|
2009
2009
|
function buildStandardHybridRrfOrderBy(input) {
|
|
2010
2010
|
const { ast, dialect, fusion } = input;
|
|
2011
2011
|
const k = fusion?.k ?? DEFAULT_RRF_K;
|
|
2012
2012
|
const vectorWeight = fusion?.weights?.vector ?? DEFAULT_RRF_WEIGHT;
|
|
2013
2013
|
const fulltextWeight = fusion?.weights?.fulltext ?? DEFAULT_RRF_WEIGHT;
|
|
2014
|
-
const rrfOrder =
|
|
2015
|
-
`(COALESCE(${vectorWeight} / (${k} + ${
|
|
2014
|
+
const rrfOrder = chunkYX3H63VV_cjs.sql.raw(
|
|
2015
|
+
`(COALESCE(${vectorWeight} / (${k} + ${chunkJZYMOHHM_cjs.EMBEDDINGS_CTE_ALIAS}.ord), 0) + COALESCE(${fulltextWeight} / (${k} + ${chunkJZYMOHHM_cjs.FULLTEXT_CTE_ALIAS}.ord), 0)) DESC`
|
|
2016
2016
|
);
|
|
2017
|
-
const idTiebreak =
|
|
2018
|
-
`COALESCE(${
|
|
2017
|
+
const idTiebreak = chunkYX3H63VV_cjs.sql.raw(
|
|
2018
|
+
`COALESCE(${chunkJZYMOHHM_cjs.FULLTEXT_CTE_ALIAS}.node_id, ${chunkJZYMOHHM_cjs.EMBEDDINGS_CTE_ALIAS}.node_id) ASC`
|
|
2019
2019
|
);
|
|
2020
2020
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2021
|
-
return
|
|
2021
|
+
return chunkYX3H63VV_cjs.sql`ORDER BY ${chunkYX3H63VV_cjs.sql.join([rrfOrder, ...userOrders, idTiebreak], chunkYX3H63VV_cjs.sql`, `)}`;
|
|
2022
2022
|
}
|
|
2023
2023
|
function buildStandardVectorOrderBy(input) {
|
|
2024
2024
|
const { ast, dialect } = input;
|
|
2025
|
-
const distanceOrder =
|
|
2025
|
+
const distanceOrder = chunkYX3H63VV_cjs.sql.raw(`${chunkJZYMOHHM_cjs.EMBEDDINGS_CTE_ALIAS}.distance ASC`);
|
|
2026
2026
|
const userOrders = compileUserOrderBy(ast, dialect);
|
|
2027
|
-
return
|
|
2027
|
+
return chunkYX3H63VV_cjs.sql`ORDER BY ${chunkYX3H63VV_cjs.sql.join([distanceOrder, ...userOrders], chunkYX3H63VV_cjs.sql`, `)}`;
|
|
2028
2028
|
}
|
|
2029
2029
|
function buildLimitOffsetClause(input) {
|
|
2030
2030
|
const { limit, offset } = input;
|
|
2031
2031
|
const parts = [];
|
|
2032
2032
|
if (limit !== void 0) {
|
|
2033
|
-
parts.push(
|
|
2033
|
+
parts.push(chunkYX3H63VV_cjs.sql`LIMIT ${limit}`);
|
|
2034
2034
|
}
|
|
2035
2035
|
if (offset !== void 0) {
|
|
2036
|
-
parts.push(
|
|
2036
|
+
parts.push(chunkYX3H63VV_cjs.sql`OFFSET ${offset}`);
|
|
2037
2037
|
}
|
|
2038
|
-
return parts.length > 0 ?
|
|
2038
|
+
return parts.length > 0 ? chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql` `) : void 0;
|
|
2039
2039
|
}
|
|
2040
2040
|
|
|
2041
2041
|
// src/query/compiler/passes/fulltext.ts
|
|
2042
2042
|
function runFulltextPredicatePass(ast, dialect) {
|
|
2043
|
-
const fulltextPredicates =
|
|
2043
|
+
const fulltextPredicates = chunkUCHW2MGP_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2044
2044
|
if (fulltextPredicates.length > 1) {
|
|
2045
2045
|
throw new chunkSAFZ6JTI_cjs.UnsupportedPredicateError(
|
|
2046
2046
|
"Multiple fulltext match predicates in a single query are not supported"
|
|
@@ -2137,11 +2137,11 @@ function runCompilerPass(state, pass) {
|
|
|
2137
2137
|
|
|
2138
2138
|
// src/query/compiler/passes/temporal.ts
|
|
2139
2139
|
function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
2140
|
-
const currentTimestamp =
|
|
2140
|
+
const currentTimestamp = chunkUCHW2MGP_cjs.currentReadInstantFor(readInstant);
|
|
2141
2141
|
return {
|
|
2142
2142
|
forAlias(tableAlias) {
|
|
2143
|
-
return
|
|
2144
|
-
...
|
|
2143
|
+
return chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
2144
|
+
...chunkUCHW2MGP_cjs.extractTemporalOptions(ast, tableAlias),
|
|
2145
2145
|
currentTimestamp
|
|
2146
2146
|
});
|
|
2147
2147
|
}
|
|
@@ -2150,7 +2150,7 @@ function createTemporalFilterPass(ast, readInstant = "literal") {
|
|
|
2150
2150
|
|
|
2151
2151
|
// src/query/compiler/passes/vector.ts
|
|
2152
2152
|
function runVectorPredicatePass(ast, dialect, vectorStrategy) {
|
|
2153
|
-
const vectorPredicates =
|
|
2153
|
+
const vectorPredicates = chunkUCHW2MGP_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2154
2154
|
if (vectorPredicates.length > 1) {
|
|
2155
2155
|
throw new chunkSAFZ6JTI_cjs.UnsupportedPredicateError(
|
|
2156
2156
|
"Multiple vector similarity predicates in a single query are not supported"
|
|
@@ -2439,7 +2439,7 @@ function lowerComposableQueryToLogicalPlanNode(query, dialect, graphId, nextPlan
|
|
|
2439
2439
|
nextPlanNodeId
|
|
2440
2440
|
});
|
|
2441
2441
|
}
|
|
2442
|
-
const dialectAdapter =
|
|
2442
|
+
const dialectAdapter = chunkHAQVISUF_cjs.getDialect(dialect);
|
|
2443
2443
|
const vectorPredicate = runVectorPredicatePass(
|
|
2444
2444
|
query,
|
|
2445
2445
|
dialectAdapter,
|
|
@@ -2563,8 +2563,8 @@ function assertRecordedQueryDoesNotUseCurrentIndexes(ast, vectorPredicate, fullt
|
|
|
2563
2563
|
}
|
|
2564
2564
|
function assertRecordedQueryAstDoesNotUseCurrentIndexes(ast) {
|
|
2565
2565
|
if (ast.recordedAsOf === void 0) return;
|
|
2566
|
-
const vectorPredicates =
|
|
2567
|
-
const fulltextPredicates =
|
|
2566
|
+
const vectorPredicates = chunkUCHW2MGP_cjs.extractVectorSimilarityPredicates(ast.predicates);
|
|
2567
|
+
const fulltextPredicates = chunkUCHW2MGP_cjs.extractFulltextMatchPredicates(ast.predicates);
|
|
2568
2568
|
assertRecordedQueryHasNoCurrentIndexUsage(ast, {
|
|
2569
2569
|
usesVectorPredicate: vectorPredicates.length > 0,
|
|
2570
2570
|
usesFulltextPredicate: fulltextPredicates.length > 0
|
|
@@ -2714,7 +2714,7 @@ function compileVariableLengthQueryWithRecursiveCteStrategy(ast, graphId, ctx) {
|
|
|
2714
2714
|
);
|
|
2715
2715
|
const projection = compileRecursiveProjection(ast, vlTraversal, dialect);
|
|
2716
2716
|
const minDepth = vlTraversal.variableLength.minDepth;
|
|
2717
|
-
const depthFilter = minDepth > 0 ?
|
|
2717
|
+
const depthFilter = minDepth > 0 ? chunkYX3H63VV_cjs.sql`WHERE depth >= ${minDepth}` : chunkYX3H63VV_cjs.sql.raw("");
|
|
2718
2718
|
const orderBy = compileRecursiveOrderBy(ast, dialect);
|
|
2719
2719
|
const limitOffset = compileLimitOffset(ast);
|
|
2720
2720
|
return emitRecursiveQuerySql({
|
|
@@ -2797,18 +2797,18 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2797
2797
|
);
|
|
2798
2798
|
}
|
|
2799
2799
|
const effectiveMaxDepth = vl.maxDepth > 0 ? vl.maxDepth : MAX_RECURSIVE_DEPTH;
|
|
2800
|
-
const maxDepthCondition =
|
|
2801
|
-
const cycleCheck = shouldEnforceCycleCheck ? dialect.cycleCheck(
|
|
2802
|
-
const initialPath = shouldTrackPath ? dialect.initializePath(
|
|
2803
|
-
const pathExtension = shouldTrackPath ? dialect.extendPath(
|
|
2800
|
+
const maxDepthCondition = chunkYX3H63VV_cjs.sql`r.depth < ${effectiveMaxDepth}`;
|
|
2801
|
+
const cycleCheck = shouldEnforceCycleCheck ? dialect.cycleCheck(chunkYX3H63VV_cjs.sql.raw("n.id"), chunkYX3H63VV_cjs.sql.raw("r.path")) : void 0;
|
|
2802
|
+
const initialPath = shouldTrackPath ? dialect.initializePath(chunkYX3H63VV_cjs.sql.raw("n0.id")) : void 0;
|
|
2803
|
+
const pathExtension = shouldTrackPath ? dialect.extendPath(chunkYX3H63VV_cjs.sql.raw("r.path"), chunkYX3H63VV_cjs.sql.raw("n.id")) : void 0;
|
|
2804
2804
|
const baseWhereClauses = [
|
|
2805
|
-
|
|
2805
|
+
chunkYX3H63VV_cjs.sql`n0.graph_id = ${graphId}`,
|
|
2806
2806
|
startKindFilter,
|
|
2807
2807
|
startTemporalFilter,
|
|
2808
2808
|
...startPredicates
|
|
2809
2809
|
];
|
|
2810
2810
|
const recursiveBaseWhereClauses = [
|
|
2811
|
-
|
|
2811
|
+
chunkYX3H63VV_cjs.sql`e.graph_id = ${graphId}`,
|
|
2812
2812
|
nodeKindFilter,
|
|
2813
2813
|
edgeTemporalFilter,
|
|
2814
2814
|
nodeTemporalFilter,
|
|
@@ -2831,17 +2831,17 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2831
2831
|
const recursiveSelectColumns = [
|
|
2832
2832
|
...startColumnsFromRecursive,
|
|
2833
2833
|
...nodeColumnsFromRecursive,
|
|
2834
|
-
|
|
2834
|
+
chunkYX3H63VV_cjs.sql`r.depth + 1 AS depth`
|
|
2835
2835
|
];
|
|
2836
2836
|
if (pathExtension !== void 0) {
|
|
2837
|
-
recursiveSelectColumns.push(
|
|
2837
|
+
recursiveSelectColumns.push(chunkYX3H63VV_cjs.sql`${pathExtension} AS path`);
|
|
2838
2838
|
}
|
|
2839
2839
|
const recursiveJoinClauses = [
|
|
2840
|
-
|
|
2840
|
+
chunkYX3H63VV_cjs.sql`e.${chunkYX3H63VV_cjs.sql.raw(branch.joinField)} = r.${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_id`
|
|
2841
2841
|
];
|
|
2842
2842
|
if (previousNodeKinds.length > 1) {
|
|
2843
2843
|
recursiveJoinClauses.push(
|
|
2844
|
-
|
|
2844
|
+
chunkYX3H63VV_cjs.sql`e.${chunkYX3H63VV_cjs.sql.raw(branch.joinKindField)} = r.${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_kind`
|
|
2845
2845
|
);
|
|
2846
2846
|
}
|
|
2847
2847
|
if (forceWorktableOuterJoinOrder) {
|
|
@@ -2849,24 +2849,24 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2849
2849
|
...recursiveJoinClauses,
|
|
2850
2850
|
...recursiveFilterClauses
|
|
2851
2851
|
];
|
|
2852
|
-
return
|
|
2853
|
-
SELECT ${
|
|
2852
|
+
return chunkYX3H63VV_cjs.sql`
|
|
2853
|
+
SELECT ${chunkYX3H63VV_cjs.sql.join(recursiveSelectColumns, chunkYX3H63VV_cjs.sql`, `)}
|
|
2854
2854
|
FROM recursive_cte r
|
|
2855
2855
|
CROSS JOIN ${ctx.schema.edgesTable} e
|
|
2856
2856
|
JOIN ${ctx.schema.nodesTable} n ON n.graph_id = e.graph_id
|
|
2857
|
-
AND n.id = e.${
|
|
2858
|
-
AND n.kind = e.${
|
|
2859
|
-
WHERE ${
|
|
2857
|
+
AND n.id = e.${chunkYX3H63VV_cjs.sql.raw(branch.targetField)}
|
|
2858
|
+
AND n.kind = e.${chunkYX3H63VV_cjs.sql.raw(branch.targetKindField)}
|
|
2859
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(recursiveWhereClauses, chunkYX3H63VV_cjs.sql` AND `)}
|
|
2860
2860
|
`;
|
|
2861
2861
|
}
|
|
2862
|
-
return
|
|
2863
|
-
SELECT ${
|
|
2862
|
+
return chunkYX3H63VV_cjs.sql`
|
|
2863
|
+
SELECT ${chunkYX3H63VV_cjs.sql.join(recursiveSelectColumns, chunkYX3H63VV_cjs.sql`, `)}
|
|
2864
2864
|
FROM recursive_cte r
|
|
2865
|
-
JOIN ${ctx.schema.edgesTable} e ON ${
|
|
2865
|
+
JOIN ${ctx.schema.edgesTable} e ON ${chunkYX3H63VV_cjs.sql.join(recursiveJoinClauses, chunkYX3H63VV_cjs.sql` AND `)}
|
|
2866
2866
|
JOIN ${ctx.schema.nodesTable} n ON n.graph_id = e.graph_id
|
|
2867
|
-
AND n.id = e.${
|
|
2868
|
-
AND n.kind = e.${
|
|
2869
|
-
WHERE ${
|
|
2867
|
+
AND n.id = e.${chunkYX3H63VV_cjs.sql.raw(branch.targetField)}
|
|
2868
|
+
AND n.kind = e.${chunkYX3H63VV_cjs.sql.raw(branch.targetKindField)}
|
|
2869
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(recursiveFilterClauses, chunkYX3H63VV_cjs.sql` AND `)}
|
|
2870
2870
|
`;
|
|
2871
2871
|
}
|
|
2872
2872
|
const directJoinField = direction === "out" ? "from_id" : "to_id";
|
|
@@ -2888,7 +2888,7 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2888
2888
|
const overlappingKinds = inverseEdgeKinds.filter(
|
|
2889
2889
|
(kind) => directEdgeKinds.includes(kind)
|
|
2890
2890
|
);
|
|
2891
|
-
const duplicateGuard = overlappingKinds.length > 0 ?
|
|
2891
|
+
const duplicateGuard = overlappingKinds.length > 0 ? chunkYX3H63VV_cjs.sql`NOT (e.from_id = e.to_id AND ${compileKindFilter2(overlappingKinds, "e.kind")})` : void 0;
|
|
2892
2892
|
const inverseBranch = compileRecursiveBranch2({
|
|
2893
2893
|
joinField: inverseJoinField,
|
|
2894
2894
|
targetField: inverseTargetField,
|
|
@@ -2897,7 +2897,7 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2897
2897
|
edgeKinds: inverseEdgeKinds,
|
|
2898
2898
|
duplicateGuard
|
|
2899
2899
|
});
|
|
2900
|
-
return
|
|
2900
|
+
return chunkYX3H63VV_cjs.sql`
|
|
2901
2901
|
${directBranch}
|
|
2902
2902
|
UNION ALL
|
|
2903
2903
|
${inverseBranch}
|
|
@@ -2907,17 +2907,17 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2907
2907
|
const baseSelectColumns = [
|
|
2908
2908
|
...startColumnsFromBase,
|
|
2909
2909
|
...nodeColumnsFromBase,
|
|
2910
|
-
|
|
2910
|
+
chunkYX3H63VV_cjs.sql`0 AS depth`
|
|
2911
2911
|
];
|
|
2912
2912
|
if (initialPath !== void 0) {
|
|
2913
|
-
baseSelectColumns.push(
|
|
2913
|
+
baseSelectColumns.push(chunkYX3H63VV_cjs.sql`${initialPath} AS path`);
|
|
2914
2914
|
}
|
|
2915
|
-
return
|
|
2915
|
+
return chunkYX3H63VV_cjs.sql`
|
|
2916
2916
|
recursive_cte AS (
|
|
2917
2917
|
-- Base case: starting nodes
|
|
2918
|
-
SELECT ${
|
|
2918
|
+
SELECT ${chunkYX3H63VV_cjs.sql.join(baseSelectColumns, chunkYX3H63VV_cjs.sql`, `)}
|
|
2919
2919
|
FROM ${ctx.schema.nodesTable} n0
|
|
2920
|
-
WHERE ${
|
|
2920
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(baseWhereClauses, chunkYX3H63VV_cjs.sql` AND `)}
|
|
2921
2921
|
|
|
2922
2922
|
UNION ALL
|
|
2923
2923
|
|
|
@@ -2927,13 +2927,13 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
2927
2927
|
`;
|
|
2928
2928
|
}
|
|
2929
2929
|
function compileKindFilter2(kinds, columnExpr) {
|
|
2930
|
-
return
|
|
2930
|
+
return chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw(columnExpr), kinds);
|
|
2931
2931
|
}
|
|
2932
2932
|
function compileNodePredicates(ast, alias, ctx) {
|
|
2933
|
-
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) =>
|
|
2933
|
+
return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) => chunkUCHW2MGP_cjs.compilePredicateExpression(p.expression, ctx));
|
|
2934
2934
|
}
|
|
2935
2935
|
function compileEdgePredicates(ast, edgeAlias, ctx) {
|
|
2936
|
-
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) =>
|
|
2936
|
+
return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) => chunkUCHW2MGP_cjs.compilePredicateExpression(p.expression, ctx));
|
|
2937
2937
|
}
|
|
2938
2938
|
function collectRequiredColumnsByAlias(ast, traversal) {
|
|
2939
2939
|
const selectiveFields = ast.selectiveFields;
|
|
@@ -2962,7 +2962,7 @@ function compileNodeSelectColumnsFromTable(tableAlias, alias, requiredColumns, a
|
|
|
2962
2962
|
return NODE_COLUMNS.filter(
|
|
2963
2963
|
(column) => shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns)
|
|
2964
2964
|
).map(
|
|
2965
|
-
(column) =>
|
|
2965
|
+
(column) => chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(tableAlias)}.${chunkYX3H63VV_cjs.sql.raw(column)} AS ${chunkYX3H63VV_cjs.sql.raw(`${alias}_${column}`)}`
|
|
2966
2966
|
);
|
|
2967
2967
|
}
|
|
2968
2968
|
function compileNodeSelectColumnsFromRecursiveRow(alias, requiredColumns, alwaysRequiredColumns) {
|
|
@@ -2970,7 +2970,7 @@ function compileNodeSelectColumnsFromRecursiveRow(alias, requiredColumns, always
|
|
|
2970
2970
|
(column) => shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns)
|
|
2971
2971
|
).map((column) => {
|
|
2972
2972
|
const projected = `${alias}_${column}`;
|
|
2973
|
-
return
|
|
2973
|
+
return chunkYX3H63VV_cjs.sql`r.${chunkYX3H63VV_cjs.sql.raw(projected)} AS ${chunkYX3H63VV_cjs.sql.raw(projected)}`;
|
|
2974
2974
|
});
|
|
2975
2975
|
}
|
|
2976
2976
|
function compileRecursiveProjection(ast, traversal, dialect) {
|
|
@@ -2987,33 +2987,33 @@ function compileRecursiveProjection(ast, traversal, dialect) {
|
|
|
2987
2987
|
const vl = traversal.variableLength;
|
|
2988
2988
|
const fields = [
|
|
2989
2989
|
// Start alias fields with metadata
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2990
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_id`,
|
|
2991
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_kind`,
|
|
2992
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_props`,
|
|
2993
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_version`,
|
|
2994
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_valid_from`,
|
|
2995
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_valid_to`,
|
|
2996
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_created_at`,
|
|
2997
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_updated_at`,
|
|
2998
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(startAlias)}_deleted_at`,
|
|
2999
2999
|
// Node alias fields with metadata
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3000
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_id`,
|
|
3001
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_kind`,
|
|
3002
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_props`,
|
|
3003
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_version`,
|
|
3004
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_valid_from`,
|
|
3005
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_valid_to`,
|
|
3006
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_created_at`,
|
|
3007
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_updated_at`,
|
|
3008
|
+
chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(nodeAlias)}_deleted_at`
|
|
3009
3009
|
];
|
|
3010
3010
|
if (vl.depthAlias !== void 0) {
|
|
3011
|
-
fields.push(
|
|
3011
|
+
fields.push(chunkYX3H63VV_cjs.sql`depth AS ${quoteIdentifier(vl.depthAlias)}`);
|
|
3012
3012
|
}
|
|
3013
3013
|
if (vl.pathAlias !== void 0) {
|
|
3014
|
-
fields.push(
|
|
3014
|
+
fields.push(chunkYX3H63VV_cjs.sql`path AS ${quoteIdentifier(vl.pathAlias)}`);
|
|
3015
3015
|
}
|
|
3016
|
-
return
|
|
3016
|
+
return chunkYX3H63VV_cjs.sql.join(fields, chunkYX3H63VV_cjs.sql`, `);
|
|
3017
3017
|
}
|
|
3018
3018
|
function compileRecursiveSelectiveProjection(fields, ast, traversal, dialect) {
|
|
3019
3019
|
const allowedAliases = /* @__PURE__ */ new Set([ast.start.alias, traversal.nodeAlias]);
|
|
@@ -3025,20 +3025,20 @@ function compileRecursiveSelectiveProjection(fields, ast, traversal, dialect) {
|
|
|
3025
3025
|
}
|
|
3026
3026
|
if (field2.isSystemField) {
|
|
3027
3027
|
const dbColumn = mapSelectiveSystemFieldToColumn(field2.field);
|
|
3028
|
-
return
|
|
3028
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(`${field2.alias}_${dbColumn}`)} AS ${quoteIdentifier(field2.outputName)}`;
|
|
3029
3029
|
}
|
|
3030
|
-
const column =
|
|
3030
|
+
const column = chunkYX3H63VV_cjs.sql.raw(`${field2.alias}_props`);
|
|
3031
3031
|
const extracted = compileSelectivePropsExtraction(field2, column, dialect);
|
|
3032
|
-
return
|
|
3032
|
+
return chunkYX3H63VV_cjs.sql`${extracted} AS ${quoteIdentifier(field2.outputName)}`;
|
|
3033
3033
|
});
|
|
3034
3034
|
const vl = traversal.variableLength;
|
|
3035
3035
|
if (vl.depthAlias !== void 0) {
|
|
3036
|
-
columns.push(
|
|
3036
|
+
columns.push(chunkYX3H63VV_cjs.sql`depth AS ${quoteIdentifier(vl.depthAlias)}`);
|
|
3037
3037
|
}
|
|
3038
3038
|
if (vl.pathAlias !== void 0) {
|
|
3039
|
-
columns.push(
|
|
3039
|
+
columns.push(chunkYX3H63VV_cjs.sql`path AS ${quoteIdentifier(vl.pathAlias)}`);
|
|
3040
3040
|
}
|
|
3041
|
-
return
|
|
3041
|
+
return chunkYX3H63VV_cjs.sql.join(columns, chunkYX3H63VV_cjs.sql`, `);
|
|
3042
3042
|
}
|
|
3043
3043
|
function compileRecursiveOrderBy(ast, dialect) {
|
|
3044
3044
|
if (!ast.orderBy || ast.orderBy.length === 0) {
|
|
@@ -3052,26 +3052,26 @@ function compileRecursiveOrderBy(ast, dialect) {
|
|
|
3052
3052
|
"Ordering by JSON arrays or objects is not supported"
|
|
3053
3053
|
);
|
|
3054
3054
|
}
|
|
3055
|
-
const field2 =
|
|
3056
|
-
const direction =
|
|
3055
|
+
const field2 = chunkUCHW2MGP_cjs.compileFieldValue(orderSpec.field, dialect, valueType);
|
|
3056
|
+
const direction = chunkYX3H63VV_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
3057
3057
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
3058
|
-
const nullsDirection =
|
|
3058
|
+
const nullsDirection = chunkYX3H63VV_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
3059
3059
|
parts.push(
|
|
3060
|
-
|
|
3061
|
-
|
|
3060
|
+
chunkYX3H63VV_cjs.sql`(${field2} IS NULL) ${nullsDirection}`,
|
|
3061
|
+
chunkYX3H63VV_cjs.sql`${field2} ${direction}`
|
|
3062
3062
|
);
|
|
3063
3063
|
}
|
|
3064
|
-
return
|
|
3064
|
+
return chunkYX3H63VV_cjs.sql`ORDER BY ${chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql`, `)}`;
|
|
3065
3065
|
}
|
|
3066
3066
|
function compileLimitOffset(ast) {
|
|
3067
3067
|
const parts = [];
|
|
3068
3068
|
if (ast.limit !== void 0) {
|
|
3069
|
-
parts.push(
|
|
3069
|
+
parts.push(chunkYX3H63VV_cjs.sql`LIMIT ${ast.limit}`);
|
|
3070
3070
|
}
|
|
3071
3071
|
if (ast.offset !== void 0) {
|
|
3072
|
-
parts.push(
|
|
3072
|
+
parts.push(chunkYX3H63VV_cjs.sql`OFFSET ${ast.offset}`);
|
|
3073
3073
|
}
|
|
3074
|
-
return parts.length > 0 ?
|
|
3074
|
+
return parts.length > 0 ? chunkYX3H63VV_cjs.sql.join(parts, chunkYX3H63VV_cjs.sql` `) : void 0;
|
|
3075
3075
|
}
|
|
3076
3076
|
|
|
3077
3077
|
// src/query/execution/value-decoder.ts
|
|
@@ -3134,53 +3134,53 @@ function decodeByValueType(value, valueType) {
|
|
|
3134
3134
|
// src/store/recursive-cte.ts
|
|
3135
3135
|
function buildReachableCte(options) {
|
|
3136
3136
|
const trackPath = options.cyclePolicy === "prevent" || options.includePath;
|
|
3137
|
-
const edgeKindFilter =
|
|
3138
|
-
|
|
3137
|
+
const edgeKindFilter = chunkUCHW2MGP_cjs.compileKindFilter(
|
|
3138
|
+
chunkYX3H63VV_cjs.sql.raw("e.kind"),
|
|
3139
3139
|
options.edgeKinds
|
|
3140
3140
|
);
|
|
3141
|
-
const currentTimestamp =
|
|
3142
|
-
const nodeTemporalFilter =
|
|
3141
|
+
const currentTimestamp = chunkUCHW2MGP_cjs.currentReadInstant();
|
|
3142
|
+
const nodeTemporalFilter = chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
3143
3143
|
mode: options.temporalMode,
|
|
3144
3144
|
asOf: options.asOf,
|
|
3145
3145
|
recordedAsOf: options.recordedAsOf,
|
|
3146
3146
|
tableAlias: "n",
|
|
3147
3147
|
currentTimestamp
|
|
3148
3148
|
});
|
|
3149
|
-
const edgeTemporalFilter =
|
|
3149
|
+
const edgeTemporalFilter = chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
3150
3150
|
mode: options.temporalMode,
|
|
3151
3151
|
asOf: options.asOf,
|
|
3152
3152
|
recordedAsOf: options.recordedAsOf,
|
|
3153
3153
|
tableAlias: "e",
|
|
3154
3154
|
currentTimestamp
|
|
3155
3155
|
});
|
|
3156
|
-
const schema =
|
|
3156
|
+
const schema = chunkJZYMOHHM_cjs.recordedReadSchemaFor(
|
|
3157
3157
|
options.schema,
|
|
3158
3158
|
options.recordedAsOf,
|
|
3159
3159
|
options.recordedReadBinding,
|
|
3160
3160
|
"recorded-recursive-cte"
|
|
3161
3161
|
);
|
|
3162
|
-
const initialPath = trackPath ? options.dialect.initializePath(
|
|
3163
|
-
const pathExtension = trackPath ? options.dialect.extendPath(
|
|
3164
|
-
const cycleCheck = options.cyclePolicy === "prevent" ? options.dialect.cycleCheck(
|
|
3165
|
-
const baseColumns = [
|
|
3162
|
+
const initialPath = trackPath ? options.dialect.initializePath(chunkYX3H63VV_cjs.sql.raw("n.id")) : void 0;
|
|
3163
|
+
const pathExtension = trackPath ? options.dialect.extendPath(chunkYX3H63VV_cjs.sql.raw("r.path"), chunkYX3H63VV_cjs.sql.raw("n.id")) : void 0;
|
|
3164
|
+
const cycleCheck = options.cyclePolicy === "prevent" ? options.dialect.cycleCheck(chunkYX3H63VV_cjs.sql.raw("n.id"), chunkYX3H63VV_cjs.sql.raw("r.path")) : void 0;
|
|
3165
|
+
const baseColumns = [chunkYX3H63VV_cjs.sql`n.id`, chunkYX3H63VV_cjs.sql`n.kind`, chunkYX3H63VV_cjs.sql`0 AS depth`];
|
|
3166
3166
|
if (initialPath !== void 0) {
|
|
3167
|
-
baseColumns.push(
|
|
3167
|
+
baseColumns.push(chunkYX3H63VV_cjs.sql`${initialPath} AS path`);
|
|
3168
3168
|
}
|
|
3169
|
-
const baseCase =
|
|
3169
|
+
const baseCase = chunkYX3H63VV_cjs.sql`SELECT ${chunkYX3H63VV_cjs.sql.join(baseColumns, chunkYX3H63VV_cjs.sql`, `)} FROM ${schema.nodesTable} n WHERE n.graph_id = ${options.graphId} AND n.id = ${options.sourceId} AND ${nodeTemporalFilter}`;
|
|
3170
3170
|
const recursiveColumns = [
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3171
|
+
chunkYX3H63VV_cjs.sql`n.id`,
|
|
3172
|
+
chunkYX3H63VV_cjs.sql`n.kind`,
|
|
3173
|
+
chunkYX3H63VV_cjs.sql`r.depth + 1 AS depth`
|
|
3174
3174
|
];
|
|
3175
3175
|
if (pathExtension !== void 0) {
|
|
3176
|
-
recursiveColumns.push(
|
|
3176
|
+
recursiveColumns.push(chunkYX3H63VV_cjs.sql`${pathExtension} AS path`);
|
|
3177
3177
|
}
|
|
3178
3178
|
const recursiveWhere = [
|
|
3179
|
-
|
|
3179
|
+
chunkYX3H63VV_cjs.sql`e.graph_id = ${options.graphId}`,
|
|
3180
3180
|
edgeKindFilter,
|
|
3181
3181
|
edgeTemporalFilter,
|
|
3182
3182
|
nodeTemporalFilter,
|
|
3183
|
-
|
|
3183
|
+
chunkYX3H63VV_cjs.sql`r.depth < ${options.maxHops}`
|
|
3184
3184
|
];
|
|
3185
3185
|
if (cycleCheck !== void 0) recursiveWhere.push(cycleCheck);
|
|
3186
3186
|
const forceWorktableOuterJoinOrder = options.dialect.capabilities.forceRecursiveWorktableOuterJoinOrder;
|
|
@@ -3191,10 +3191,10 @@ function buildReachableCte(options) {
|
|
|
3191
3191
|
forceWorktableOuterJoinOrder,
|
|
3192
3192
|
schema
|
|
3193
3193
|
});
|
|
3194
|
-
return
|
|
3194
|
+
return chunkYX3H63VV_cjs.sql`WITH RECURSIVE reachable AS (${baseCase} UNION ALL ${recursiveCase})`;
|
|
3195
3195
|
}
|
|
3196
3196
|
function compileRecursiveBranch(options) {
|
|
3197
|
-
const selectClause =
|
|
3197
|
+
const selectClause = chunkYX3H63VV_cjs.sql`SELECT ${chunkYX3H63VV_cjs.sql.join([...options.recursiveColumns], chunkYX3H63VV_cjs.sql`, `)}`;
|
|
3198
3198
|
switch (options.direction) {
|
|
3199
3199
|
case "out": {
|
|
3200
3200
|
return buildDirectionalBranch({
|
|
@@ -3229,26 +3229,26 @@ function compileRecursiveBranch(options) {
|
|
|
3229
3229
|
}
|
|
3230
3230
|
}
|
|
3231
3231
|
function buildDirectionalBranch(options) {
|
|
3232
|
-
const nodeJoin =
|
|
3232
|
+
const nodeJoin = chunkYX3H63VV_cjs.sql`JOIN ${options.schema.nodesTable} n ON n.graph_id = e.graph_id AND n.id = e.${chunkYX3H63VV_cjs.sql.raw(options.targetField)} AND n.kind = e.${chunkYX3H63VV_cjs.sql.raw(options.targetKindField)}`;
|
|
3233
3233
|
if (options.forceWorktableOuterJoinOrder) {
|
|
3234
3234
|
const allWhere = [
|
|
3235
3235
|
...options.whereClauses,
|
|
3236
|
-
|
|
3236
|
+
chunkYX3H63VV_cjs.sql`e.${chunkYX3H63VV_cjs.sql.raw(options.joinField)} = r.id`
|
|
3237
3237
|
];
|
|
3238
|
-
return
|
|
3238
|
+
return chunkYX3H63VV_cjs.sql`${options.selectClause} FROM reachable r CROSS JOIN ${options.schema.edgesTable} e ${nodeJoin} WHERE ${chunkYX3H63VV_cjs.sql.join(allWhere, chunkYX3H63VV_cjs.sql` AND `)}`;
|
|
3239
3239
|
}
|
|
3240
|
-
return
|
|
3240
|
+
return chunkYX3H63VV_cjs.sql`${options.selectClause} FROM reachable r JOIN ${options.schema.edgesTable} e ON e.${chunkYX3H63VV_cjs.sql.raw(options.joinField)} = r.id ${nodeJoin} WHERE ${chunkYX3H63VV_cjs.sql.join([...options.whereClauses], chunkYX3H63VV_cjs.sql` AND `)}`;
|
|
3241
3241
|
}
|
|
3242
3242
|
function buildBidirectionalBranch(options) {
|
|
3243
|
-
const nodeJoin =
|
|
3243
|
+
const nodeJoin = chunkYX3H63VV_cjs.sql`JOIN ${options.schema.nodesTable} n ON n.graph_id = e.graph_id AND ((e.to_id = r.id AND n.id = e.from_id AND n.kind = e.from_kind) OR (e.from_id = r.id AND n.id = e.to_id AND n.kind = e.to_kind))`;
|
|
3244
3244
|
if (options.forceWorktableOuterJoinOrder) {
|
|
3245
3245
|
const allWhere = [
|
|
3246
3246
|
...options.whereClauses,
|
|
3247
|
-
|
|
3247
|
+
chunkYX3H63VV_cjs.sql`(e.from_id = r.id OR e.to_id = r.id)`
|
|
3248
3248
|
];
|
|
3249
|
-
return
|
|
3249
|
+
return chunkYX3H63VV_cjs.sql`${options.selectClause} FROM reachable r CROSS JOIN ${options.schema.edgesTable} e ${nodeJoin} WHERE ${chunkYX3H63VV_cjs.sql.join(allWhere, chunkYX3H63VV_cjs.sql` AND `)}`;
|
|
3250
3250
|
}
|
|
3251
|
-
return
|
|
3251
|
+
return chunkYX3H63VV_cjs.sql`${options.selectClause} FROM reachable r JOIN ${options.schema.edgesTable} e ON (e.from_id = r.id OR e.to_id = r.id) ${nodeJoin} WHERE ${chunkYX3H63VV_cjs.sql.join([...options.whereClauses], chunkYX3H63VV_cjs.sql` AND `)}`;
|
|
3252
3252
|
}
|
|
3253
3253
|
|
|
3254
3254
|
// src/store/subgraph.ts
|
|
@@ -3269,13 +3269,13 @@ function defineSubgraphProject(_graph) {
|
|
|
3269
3269
|
}
|
|
3270
3270
|
async function executeSubgraph(params) {
|
|
3271
3271
|
const { options } = params;
|
|
3272
|
-
const { valid: coordinate } =
|
|
3272
|
+
const { valid: coordinate } = chunkLL5D5T5W_cjs.resolveReadCoordinate(
|
|
3273
3273
|
options.temporalMode ?? params.graph.defaults.temporalMode,
|
|
3274
3274
|
options.asOf
|
|
3275
3275
|
);
|
|
3276
3276
|
const temporalMode = coordinate.mode;
|
|
3277
3277
|
const recordedAsOf = options.recordedAsOf;
|
|
3278
|
-
const baseSchema = params.schema ??
|
|
3278
|
+
const baseSchema = params.schema ?? chunkJZYMOHHM_cjs.DEFAULT_SQL_SCHEMA;
|
|
3279
3279
|
const maxDepth = Math.min(
|
|
3280
3280
|
options.maxDepth ?? DEFAULT_SUBGRAPH_MAX_DEPTH,
|
|
3281
3281
|
MAX_EXPLICIT_RECURSIVE_DEPTH
|
|
@@ -3293,7 +3293,7 @@ async function executeSubgraph(params) {
|
|
|
3293
3293
|
asOf: coordinate.asOf,
|
|
3294
3294
|
recordedAsOf,
|
|
3295
3295
|
dialect: params.dialect,
|
|
3296
|
-
schema:
|
|
3296
|
+
schema: chunkJZYMOHHM_cjs.recordedReadSchemaFor(
|
|
3297
3297
|
baseSchema,
|
|
3298
3298
|
recordedAsOf,
|
|
3299
3299
|
params.recordedReadBinding,
|
|
@@ -3343,18 +3343,18 @@ async function executeSubgraph(params) {
|
|
|
3343
3343
|
);
|
|
3344
3344
|
const idsArray = textArrayParam(includedIds);
|
|
3345
3345
|
membership = {
|
|
3346
|
-
prefix:
|
|
3347
|
-
idFilter: (column) =>
|
|
3346
|
+
prefix: chunkYX3H63VV_cjs.sql``,
|
|
3347
|
+
idFilter: (column) => chunkYX3H63VV_cjs.sql`EXISTS (SELECT 1 FROM unnest(${idsArray}) AS tg_included(id) WHERE tg_included.id = ${column})`,
|
|
3348
3348
|
parameterDependentPlan: true
|
|
3349
3349
|
};
|
|
3350
3350
|
break;
|
|
3351
3351
|
}
|
|
3352
3352
|
case "sqlite": {
|
|
3353
3353
|
membership = {
|
|
3354
|
-
prefix:
|
|
3354
|
+
prefix: chunkYX3H63VV_cjs.sql`${reachableCte}${includedIdsCte} `,
|
|
3355
3355
|
// SQLite: `column IN (subquery)` evaluates via a transient index —
|
|
3356
3356
|
// optimal as-is. (Postgres takes the parameterized text[] form above.)
|
|
3357
|
-
idFilter: (column) =>
|
|
3357
|
+
idFilter: (column) => chunkYX3H63VV_cjs.sql`${column} IN (SELECT id FROM included_ids)`,
|
|
3358
3358
|
parameterDependentPlan: false
|
|
3359
3359
|
};
|
|
3360
3360
|
break;
|
|
@@ -3457,39 +3457,39 @@ function dedupeStrings(values) {
|
|
|
3457
3457
|
function buildIncludedIdsCte(ctx) {
|
|
3458
3458
|
const filters = [];
|
|
3459
3459
|
if (ctx.includeKinds !== void 0 && ctx.includeKinds.length > 0) {
|
|
3460
|
-
filters.push(
|
|
3460
|
+
filters.push(chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("kind"), ctx.includeKinds));
|
|
3461
3461
|
}
|
|
3462
3462
|
if (ctx.excludeRoot) {
|
|
3463
|
-
filters.push(
|
|
3463
|
+
filters.push(chunkYX3H63VV_cjs.sql`id != ${ctx.rootId}`);
|
|
3464
3464
|
}
|
|
3465
|
-
const whereClause = filters.length > 0 ?
|
|
3466
|
-
return
|
|
3465
|
+
const whereClause = filters.length > 0 ? chunkYX3H63VV_cjs.sql` WHERE ${chunkYX3H63VV_cjs.sql.join(filters, chunkYX3H63VV_cjs.sql` AND `)}` : chunkYX3H63VV_cjs.sql``;
|
|
3466
|
+
return chunkYX3H63VV_cjs.sql`, included_ids AS (SELECT DISTINCT id FROM reachable${whereClause})`;
|
|
3467
3467
|
}
|
|
3468
3468
|
function textArrayParam(values) {
|
|
3469
3469
|
const elements = values.map(
|
|
3470
3470
|
(value) => `"${value.replaceAll("\\", "\\\\").replaceAll('"', String.raw`\"`)}"`
|
|
3471
3471
|
);
|
|
3472
|
-
return
|
|
3472
|
+
return chunkYX3H63VV_cjs.sql`${`{${elements.join(",")}}`}::text[]`;
|
|
3473
3473
|
}
|
|
3474
3474
|
async function fetchIncludedIds(ctx, reachableCte, includedIdsCte) {
|
|
3475
3475
|
const rows = await ctx.backend.execute(
|
|
3476
|
-
|
|
3477
|
-
|
|
3476
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(
|
|
3477
|
+
chunkYX3H63VV_cjs.sql`${reachableCte}${includedIdsCte} SELECT id FROM included_ids`
|
|
3478
3478
|
)
|
|
3479
3479
|
);
|
|
3480
3480
|
return rows.map((row) => row.id);
|
|
3481
3481
|
}
|
|
3482
3482
|
async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
3483
|
-
const nodeTemporalFilter =
|
|
3483
|
+
const nodeTemporalFilter = chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
3484
3484
|
mode: ctx.temporalMode,
|
|
3485
3485
|
asOf: ctx.asOf,
|
|
3486
3486
|
recordedAsOf: ctx.recordedAsOf,
|
|
3487
3487
|
tableAlias: "n",
|
|
3488
|
-
currentTimestamp:
|
|
3488
|
+
currentTimestamp: chunkUCHW2MGP_cjs.currentReadInstant()
|
|
3489
3489
|
});
|
|
3490
3490
|
const columns = [
|
|
3491
|
-
|
|
3492
|
-
|
|
3491
|
+
chunkYX3H63VV_cjs.sql`n.kind`,
|
|
3492
|
+
chunkYX3H63VV_cjs.sql`n.id`,
|
|
3493
3493
|
buildFullPropsColumn("n", projectionPlan),
|
|
3494
3494
|
...buildMetadataColumns("n", projectionPlan, [
|
|
3495
3495
|
"version",
|
|
@@ -3501,28 +3501,28 @@ async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
|
|
|
3501
3501
|
]),
|
|
3502
3502
|
...buildProjectedPropertyColumns("n", projectionPlan, ctx.dialect)
|
|
3503
3503
|
];
|
|
3504
|
-
const query =
|
|
3505
|
-
if (membership.parameterDependentPlan)
|
|
3504
|
+
const query = chunkYX3H63VV_cjs.sql`${membership.prefix}SELECT ${chunkYX3H63VV_cjs.sql.join(columns, chunkYX3H63VV_cjs.sql`, `)} FROM ${ctx.schema.nodesTable} n WHERE n.graph_id = ${ctx.graphId} AND ${nodeTemporalFilter} AND ${membership.idFilter(chunkYX3H63VV_cjs.sql.raw("n.id"))}`;
|
|
3505
|
+
if (membership.parameterDependentPlan) chunkYX3H63VV_cjs.markForceCustomPlan(query);
|
|
3506
3506
|
return ctx.backend.execute(
|
|
3507
|
-
|
|
3507
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(query)
|
|
3508
3508
|
);
|
|
3509
3509
|
}
|
|
3510
3510
|
async function fetchSubgraphEdges(ctx, membership, projectionPlan) {
|
|
3511
|
-
const edgeKindFilter =
|
|
3512
|
-
const edgeTemporalFilter =
|
|
3511
|
+
const edgeKindFilter = chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("e.kind"), ctx.edgeKinds);
|
|
3512
|
+
const edgeTemporalFilter = chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
3513
3513
|
mode: ctx.temporalMode,
|
|
3514
3514
|
asOf: ctx.asOf,
|
|
3515
3515
|
recordedAsOf: ctx.recordedAsOf,
|
|
3516
3516
|
tableAlias: "e",
|
|
3517
|
-
currentTimestamp:
|
|
3517
|
+
currentTimestamp: chunkUCHW2MGP_cjs.currentReadInstant()
|
|
3518
3518
|
});
|
|
3519
3519
|
const columns = [
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3520
|
+
chunkYX3H63VV_cjs.sql`e.id`,
|
|
3521
|
+
chunkYX3H63VV_cjs.sql`e.kind`,
|
|
3522
|
+
chunkYX3H63VV_cjs.sql`e.from_kind`,
|
|
3523
|
+
chunkYX3H63VV_cjs.sql`e.from_id`,
|
|
3524
|
+
chunkYX3H63VV_cjs.sql`e.to_kind`,
|
|
3525
|
+
chunkYX3H63VV_cjs.sql`e.to_id`,
|
|
3526
3526
|
buildFullPropsColumn("e", projectionPlan),
|
|
3527
3527
|
...buildMetadataColumns("e", projectionPlan, [
|
|
3528
3528
|
"valid_from",
|
|
@@ -3533,53 +3533,53 @@ async function fetchSubgraphEdges(ctx, membership, projectionPlan) {
|
|
|
3533
3533
|
]),
|
|
3534
3534
|
...buildProjectedPropertyColumns("e", projectionPlan, ctx.dialect)
|
|
3535
3535
|
];
|
|
3536
|
-
const query =
|
|
3537
|
-
if (membership.parameterDependentPlan)
|
|
3536
|
+
const query = chunkYX3H63VV_cjs.sql`${membership.prefix}SELECT ${chunkYX3H63VV_cjs.sql.join(columns, chunkYX3H63VV_cjs.sql`, `)} FROM ${ctx.schema.edgesTable} e WHERE e.graph_id = ${ctx.graphId} AND ${edgeKindFilter} AND ${edgeTemporalFilter} AND ${membership.idFilter(chunkYX3H63VV_cjs.sql.raw("e.from_id"))} AND ${membership.idFilter(chunkYX3H63VV_cjs.sql.raw("e.to_id"))}`;
|
|
3537
|
+
if (membership.parameterDependentPlan) chunkYX3H63VV_cjs.markForceCustomPlan(query);
|
|
3538
3538
|
return ctx.backend.execute(
|
|
3539
|
-
|
|
3539
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(query)
|
|
3540
3540
|
);
|
|
3541
3541
|
}
|
|
3542
3542
|
function buildMetadataColumns(alias, plan, columns) {
|
|
3543
3543
|
if (plan.projectedKinds.size === 0) {
|
|
3544
|
-
return columns.map((col) =>
|
|
3544
|
+
return columns.map((col) => chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(`${alias}.${col}`)}`);
|
|
3545
3545
|
}
|
|
3546
3546
|
const metaKinds = [...plan.fullKinds];
|
|
3547
3547
|
for (const [kind, kindPlan] of plan.projectedKinds) {
|
|
3548
3548
|
if (kindPlan.includeMeta) metaKinds.push(kind);
|
|
3549
3549
|
}
|
|
3550
3550
|
if (metaKinds.length === 0) {
|
|
3551
|
-
return columns.map((col) =>
|
|
3551
|
+
return columns.map((col) => chunkYX3H63VV_cjs.sql`NULL AS ${chunkYX3H63VV_cjs.sql.raw(col)}`);
|
|
3552
3552
|
}
|
|
3553
3553
|
if (metaKinds.length === plan.fullKinds.length + plan.projectedKinds.size) {
|
|
3554
|
-
return columns.map((col) =>
|
|
3554
|
+
return columns.map((col) => chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(`${alias}.${col}`)}`);
|
|
3555
3555
|
}
|
|
3556
|
-
const filter =
|
|
3556
|
+
const filter = chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw(`${alias}.kind`), metaKinds);
|
|
3557
3557
|
return columns.map(
|
|
3558
|
-
(col) =>
|
|
3558
|
+
(col) => chunkYX3H63VV_cjs.sql`CASE WHEN ${filter} THEN ${chunkYX3H63VV_cjs.sql.raw(`${alias}.${col}`)} ELSE NULL END AS ${chunkYX3H63VV_cjs.sql.raw(col)}`
|
|
3559
3559
|
);
|
|
3560
3560
|
}
|
|
3561
3561
|
function buildFullPropsColumn(alias, plan) {
|
|
3562
3562
|
if (plan.projectedKinds.size === 0) {
|
|
3563
|
-
return
|
|
3563
|
+
return chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(`${alias}.props`)} AS props`;
|
|
3564
3564
|
}
|
|
3565
3565
|
if (plan.fullKinds.length === 0) {
|
|
3566
|
-
return
|
|
3566
|
+
return chunkYX3H63VV_cjs.sql`NULL AS props`;
|
|
3567
3567
|
}
|
|
3568
|
-
const filter =
|
|
3569
|
-
return
|
|
3568
|
+
const filter = chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw(`${alias}.kind`), plan.fullKinds);
|
|
3569
|
+
return chunkYX3H63VV_cjs.sql`CASE WHEN ${filter} THEN ${chunkYX3H63VV_cjs.sql.raw(`${alias}.props`)} ELSE NULL END AS props`;
|
|
3570
3570
|
}
|
|
3571
3571
|
function buildProjectedPropertyColumns(alias, plan, dialect) {
|
|
3572
3572
|
const columns = [];
|
|
3573
3573
|
for (const [kind, kindPlan] of plan.projectedKinds.entries()) {
|
|
3574
3574
|
for (const fieldPlan of kindPlan.propertyFields) {
|
|
3575
3575
|
const extracted = compileTypedJsonExtract({
|
|
3576
|
-
column:
|
|
3576
|
+
column: chunkYX3H63VV_cjs.sql.raw(`${alias}.props`),
|
|
3577
3577
|
dialect,
|
|
3578
3578
|
pointer: chunkTDXIBCGY_cjs.jsonPointer([fieldPlan.field]),
|
|
3579
3579
|
valueType: fieldPlan.typeInfo?.valueType
|
|
3580
3580
|
});
|
|
3581
3581
|
columns.push(
|
|
3582
|
-
|
|
3582
|
+
chunkYX3H63VV_cjs.sql`CASE WHEN ${chunkYX3H63VV_cjs.sql.raw(alias)}.kind = ${kind} THEN ${extracted} ELSE NULL END AS ${quoteIdentifier(fieldPlan.outputName)}`
|
|
3583
3583
|
);
|
|
3584
3584
|
}
|
|
3585
3585
|
}
|
|
@@ -3609,7 +3609,7 @@ function applyProjectedFields(target, row, kindPlan) {
|
|
|
3609
3609
|
function mapSubgraphNodeRow(row, projectionPlan) {
|
|
3610
3610
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3611
3611
|
if (kindPlan === void 0) {
|
|
3612
|
-
return
|
|
3612
|
+
return chunkYIX3BEBR_cjs.rowToNode({
|
|
3613
3613
|
...row,
|
|
3614
3614
|
props: normalizeProps(row.props)
|
|
3615
3615
|
});
|
|
@@ -3619,7 +3619,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3619
3619
|
id: row.id
|
|
3620
3620
|
};
|
|
3621
3621
|
if (kindPlan.includeMeta) {
|
|
3622
|
-
projectedNode["meta"] =
|
|
3622
|
+
projectedNode["meta"] = chunkYIX3BEBR_cjs.rowToNodeMeta(row);
|
|
3623
3623
|
}
|
|
3624
3624
|
applyProjectedFields(projectedNode, row, kindPlan);
|
|
3625
3625
|
return projectedNode;
|
|
@@ -3627,7 +3627,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
|
|
|
3627
3627
|
function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
3628
3628
|
const kindPlan = projectionPlan.projectedKinds.get(row.kind);
|
|
3629
3629
|
if (kindPlan === void 0) {
|
|
3630
|
-
return
|
|
3630
|
+
return chunkYIX3BEBR_cjs.rowToEdge({
|
|
3631
3631
|
...row,
|
|
3632
3632
|
props: normalizeProps(row.props)
|
|
3633
3633
|
});
|
|
@@ -3641,7 +3641,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
|
|
|
3641
3641
|
toId: row.to_id
|
|
3642
3642
|
};
|
|
3643
3643
|
if (kindPlan.includeMeta) {
|
|
3644
|
-
projectedEdge["meta"] =
|
|
3644
|
+
projectedEdge["meta"] = chunkYIX3BEBR_cjs.rowToEdgeMeta(row);
|
|
3645
3645
|
}
|
|
3646
3646
|
applyProjectedFields(projectedEdge, row, kindPlan);
|
|
3647
3647
|
return projectedEdge;
|
|
@@ -3734,8 +3734,8 @@ function compileSetOperationCore(op, graphId, compileQuery2, dialect) {
|
|
|
3734
3734
|
compileQuery2,
|
|
3735
3735
|
dialect
|
|
3736
3736
|
);
|
|
3737
|
-
const opSql =
|
|
3738
|
-
return
|
|
3737
|
+
const opSql = chunkYX3H63VV_cjs.sql.raw(OPERATOR_MAP[op.operator]);
|
|
3738
|
+
return chunkYX3H63VV_cjs.sql`${dialect.wrapSetOperationOperand(left)} ${opSql} ${dialect.wrapSetOperationOperand(right)}`;
|
|
3739
3739
|
}
|
|
3740
3740
|
function compileComposableQuery(query, graphId, compileQuery2, dialect) {
|
|
3741
3741
|
if ("__type" in query) {
|
|
@@ -3747,7 +3747,7 @@ function compileSetOperationCompound(op, graphId, compileQuery2, dialect) {
|
|
|
3747
3747
|
const core = compileSetOperationCore(op, graphId, compileQuery2, dialect);
|
|
3748
3748
|
const suffixClauses = buildSetOperationSuffixClauses(op, dialect);
|
|
3749
3749
|
if (suffixClauses.length === 0) return core;
|
|
3750
|
-
return
|
|
3750
|
+
return chunkYX3H63VV_cjs.sql.join([core, ...suffixClauses], chunkYX3H63VV_cjs.sql` `);
|
|
3751
3751
|
}
|
|
3752
3752
|
function getLeftmostProjection(op) {
|
|
3753
3753
|
let current = op.left;
|
|
@@ -3794,22 +3794,22 @@ function buildSetOperationSuffixClauses(op, dialect) {
|
|
|
3794
3794
|
`Set operation ORDER BY field "${fieldDesc}" is not in the projection. ORDER BY for UNION/INTERSECT/EXCEPT must reference projected columns. Available columns: ${availableFields}`
|
|
3795
3795
|
);
|
|
3796
3796
|
}
|
|
3797
|
-
const columnRef =
|
|
3798
|
-
const dir =
|
|
3797
|
+
const columnRef = chunkYX3H63VV_cjs.sql.raw(dialect.quoteIdentifier(projected.outputName));
|
|
3798
|
+
const dir = chunkYX3H63VV_cjs.sql.raw(orderSpec.direction.toUpperCase());
|
|
3799
3799
|
const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
|
|
3800
|
-
const nullsDir =
|
|
3800
|
+
const nullsDir = chunkYX3H63VV_cjs.sql.raw(nulls === "first" ? "DESC" : "ASC");
|
|
3801
3801
|
orderParts.push(
|
|
3802
|
-
|
|
3803
|
-
|
|
3802
|
+
chunkYX3H63VV_cjs.sql`(${columnRef} IS NULL) ${nullsDir}`,
|
|
3803
|
+
chunkYX3H63VV_cjs.sql`${columnRef} ${dir}`
|
|
3804
3804
|
);
|
|
3805
3805
|
}
|
|
3806
|
-
clauses.push(
|
|
3806
|
+
clauses.push(chunkYX3H63VV_cjs.sql`ORDER BY ${chunkYX3H63VV_cjs.sql.join(orderParts, chunkYX3H63VV_cjs.sql`, `)}`);
|
|
3807
3807
|
}
|
|
3808
3808
|
if (op.limit !== void 0) {
|
|
3809
|
-
clauses.push(
|
|
3809
|
+
clauses.push(chunkYX3H63VV_cjs.sql`LIMIT ${op.limit}`);
|
|
3810
3810
|
}
|
|
3811
3811
|
if (op.offset !== void 0) {
|
|
3812
|
-
clauses.push(
|
|
3812
|
+
clauses.push(chunkYX3H63VV_cjs.sql`OFFSET ${op.offset}`);
|
|
3813
3813
|
}
|
|
3814
3814
|
return clauses;
|
|
3815
3815
|
}
|
|
@@ -3967,7 +3967,7 @@ function hasIdEqualityPredicate(expression, alias) {
|
|
|
3967
3967
|
}
|
|
3968
3968
|
}
|
|
3969
3969
|
function isStartAliasBoundToSingleId(ast, predicateIndex) {
|
|
3970
|
-
return
|
|
3970
|
+
return chunkUCHW2MGP_cjs.getPredicatesForAlias(predicateIndex, ast.start.alias, "node").some(
|
|
3971
3971
|
(predicate) => hasIdEqualityPredicate(predicate.expression, ast.start.alias)
|
|
3972
3972
|
);
|
|
3973
3973
|
}
|
|
@@ -4051,7 +4051,7 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
|
|
|
4051
4051
|
fulltextPredicate: void 0,
|
|
4052
4052
|
fusion: void 0,
|
|
4053
4053
|
logicalPlan: void 0,
|
|
4054
|
-
predicateIndex:
|
|
4054
|
+
predicateIndex: chunkUCHW2MGP_cjs.buildPredicateIndex(ast),
|
|
4055
4055
|
requiredColumnsByAlias: void 0,
|
|
4056
4056
|
shouldCollapseSelectiveTraversalRowset: false,
|
|
4057
4057
|
temporalFilterPass: void 0,
|
|
@@ -4219,8 +4219,8 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
|
|
|
4219
4219
|
function compileQuery(ast, graphId, options = "sqlite") {
|
|
4220
4220
|
const options_ = typeof options === "string" ? { dialect: options } : options;
|
|
4221
4221
|
const dialect = options_.dialect ?? "sqlite";
|
|
4222
|
-
const baseSchema = options_.schema === void 0 ?
|
|
4223
|
-
const schema =
|
|
4222
|
+
const baseSchema = options_.schema === void 0 ? chunkJZYMOHHM_cjs.DEFAULT_SQL_SCHEMA : chunkJZYMOHHM_cjs.requireSqlSchema(options_.schema, "compileQuery schema");
|
|
4223
|
+
const schema = chunkJZYMOHHM_cjs.recordedReadSchemaFor(
|
|
4224
4224
|
baseSchema,
|
|
4225
4225
|
ast.recordedAsOf,
|
|
4226
4226
|
options_.recordedReadBinding,
|
|
@@ -4245,9 +4245,9 @@ function compileQuery(ast, graphId, options = "sqlite") {
|
|
|
4245
4245
|
};
|
|
4246
4246
|
function finish(compiled) {
|
|
4247
4247
|
if (annIndexTypes.size > 0) {
|
|
4248
|
-
|
|
4248
|
+
chunkYX3H63VV_cjs.markAnnIndexScan(compiled, [...annIndexTypes]);
|
|
4249
4249
|
}
|
|
4250
|
-
return
|
|
4250
|
+
return chunkYX3H63VV_cjs.asCompiledSelectSql(compiled);
|
|
4251
4251
|
}
|
|
4252
4252
|
if (hasVariableLengthTraversal(ast)) {
|
|
4253
4253
|
const lowered = tryLowerSingleHopRecursiveTraversal(ast);
|
|
@@ -4286,21 +4286,21 @@ function compileSetOperation2(op, graphId, options = "sqlite") {
|
|
|
4286
4286
|
const annIndexTypes = /* @__PURE__ */ new Set();
|
|
4287
4287
|
const compileOperand = (ast, gid) => {
|
|
4288
4288
|
const compiled = compileQuery(ast, gid, propagateOptions(options_));
|
|
4289
|
-
for (const indexType of
|
|
4289
|
+
for (const indexType of chunkYX3H63VV_cjs.annIndexScanTypes(compiled) ?? []) {
|
|
4290
4290
|
annIndexTypes.add(indexType);
|
|
4291
4291
|
}
|
|
4292
4292
|
return compiled;
|
|
4293
4293
|
};
|
|
4294
|
-
const combined =
|
|
4294
|
+
const combined = chunkUCHW2MGP_cjs.withPinnedReadInstant(
|
|
4295
4295
|
() => compileSetOperation(op, graphId, adapter, compileOperand, options_.vectorStrategy)
|
|
4296
4296
|
);
|
|
4297
4297
|
if (annIndexTypes.size > 0) {
|
|
4298
|
-
|
|
4298
|
+
chunkYX3H63VV_cjs.markAnnIndexScan(combined, [...annIndexTypes]);
|
|
4299
4299
|
}
|
|
4300
|
-
return
|
|
4300
|
+
return chunkYX3H63VV_cjs.asCompiledSelectSql(combined);
|
|
4301
4301
|
}
|
|
4302
4302
|
function resolveDialectAdapter(dialect, fulltextStrategy) {
|
|
4303
|
-
const baseAdapter =
|
|
4303
|
+
const baseAdapter = chunkHAQVISUF_cjs.getDialect(dialect);
|
|
4304
4304
|
if (fulltextStrategy === void 0 || fulltextStrategy === baseAdapter.fulltext) {
|
|
4305
4305
|
return baseAdapter;
|
|
4306
4306
|
}
|
|
@@ -4431,7 +4431,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4431
4431
|
const nodeCountDistinctColumn = `${traversal.nodeAlias}_count_distinct`;
|
|
4432
4432
|
const edgeCountColumn = `${traversal.edgeAlias}_count`;
|
|
4433
4433
|
const edgeCountDistinctColumn = `${traversal.edgeAlias}_count_distinct`;
|
|
4434
|
-
const previousNodeKinds =
|
|
4434
|
+
const previousNodeKinds = chunkUCHW2MGP_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
|
|
4435
4435
|
const edgeKinds = [...new Set(traversal.edgeKinds)];
|
|
4436
4436
|
const nodeKinds = traversal.nodeKinds;
|
|
4437
4437
|
const edgeTemporalFilter = temporalFilterPass.forAlias("e");
|
|
@@ -4440,16 +4440,16 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4440
4440
|
...ctx,
|
|
4441
4441
|
cteColumnPrefix: "n"
|
|
4442
4442
|
};
|
|
4443
|
-
const nodePredicateClauses =
|
|
4444
|
-
|
|
4443
|
+
const nodePredicateClauses = chunkUCHW2MGP_cjs.compilePredicateClauses(
|
|
4444
|
+
chunkUCHW2MGP_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
|
|
4445
4445
|
nodePredicateContext
|
|
4446
4446
|
);
|
|
4447
4447
|
const edgePredicateContext = {
|
|
4448
4448
|
...ctx,
|
|
4449
4449
|
cteColumnPrefix: "e"
|
|
4450
4450
|
};
|
|
4451
|
-
const edgePredicateClauses =
|
|
4452
|
-
|
|
4451
|
+
const edgePredicateClauses = chunkUCHW2MGP_cjs.compilePredicateClauses(
|
|
4452
|
+
chunkUCHW2MGP_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
|
|
4453
4453
|
edgePredicateContext
|
|
4454
4454
|
);
|
|
4455
4455
|
const joinField = traversal.direction === "out" ? "from_id" : "to_id";
|
|
@@ -4460,15 +4460,15 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4460
4460
|
const requiresNodeJoin = requiresNodeCount || requiresNodeCountDistinct || hasNodePredicates;
|
|
4461
4461
|
const useInnerJoin = hasNodePredicates;
|
|
4462
4462
|
const whereClauses = [
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4463
|
+
chunkYX3H63VV_cjs.sql`e.graph_id = ${graphId}`,
|
|
4464
|
+
chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("e.kind"), edgeKinds),
|
|
4465
|
+
chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw(`e.${joinKindField}`), previousNodeKinds),
|
|
4466
|
+
chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw(`e.${targetKindField}`), nodeKinds),
|
|
4467
4467
|
edgeTemporalFilter,
|
|
4468
4468
|
...edgePredicateClauses,
|
|
4469
4469
|
// INNER JOIN mode: node-side filters in WHERE constrain every aggregate.
|
|
4470
4470
|
...requiresNodeJoin && useInnerJoin ? [
|
|
4471
|
-
|
|
4471
|
+
chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4472
4472
|
nodeTemporalFilter,
|
|
4473
4473
|
...nodePredicateClauses
|
|
4474
4474
|
] : []
|
|
@@ -4476,32 +4476,32 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4476
4476
|
const nodeJoinOnClauses = requiresNodeJoin ? useInnerJoin ? (
|
|
4477
4477
|
// INNER JOIN: only the key conditions; filters live in WHERE.
|
|
4478
4478
|
[
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4479
|
+
chunkYX3H63VV_cjs.sql`n.graph_id = e.graph_id`,
|
|
4480
|
+
chunkYX3H63VV_cjs.sql`n.id = e.${chunkYX3H63VV_cjs.sql.raw(targetField)}`,
|
|
4481
|
+
chunkYX3H63VV_cjs.sql`n.kind = e.${chunkYX3H63VV_cjs.sql.raw(targetKindField)}`
|
|
4482
4482
|
]
|
|
4483
4483
|
) : [
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4484
|
+
chunkYX3H63VV_cjs.sql`n.graph_id = e.graph_id`,
|
|
4485
|
+
chunkYX3H63VV_cjs.sql`n.id = e.${chunkYX3H63VV_cjs.sql.raw(targetField)}`,
|
|
4486
|
+
chunkYX3H63VV_cjs.sql`n.kind = e.${chunkYX3H63VV_cjs.sql.raw(targetKindField)}`,
|
|
4487
|
+
chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("n.kind"), nodeKinds),
|
|
4488
4488
|
nodeTemporalFilter
|
|
4489
4489
|
] : [];
|
|
4490
4490
|
const aggregateColumns = [];
|
|
4491
4491
|
if (requiresNodeCount) {
|
|
4492
|
-
aggregateColumns.push(
|
|
4492
|
+
aggregateColumns.push(chunkYX3H63VV_cjs.sql`COUNT(n.id) AS ${chunkYX3H63VV_cjs.sql.raw(nodeCountColumn)}`);
|
|
4493
4493
|
}
|
|
4494
4494
|
if (requiresNodeCountDistinct) {
|
|
4495
4495
|
aggregateColumns.push(
|
|
4496
|
-
|
|
4496
|
+
chunkYX3H63VV_cjs.sql`COUNT(DISTINCT n.id) AS ${chunkYX3H63VV_cjs.sql.raw(nodeCountDistinctColumn)}`
|
|
4497
4497
|
);
|
|
4498
4498
|
}
|
|
4499
4499
|
if (requiresEdgeCount) {
|
|
4500
|
-
aggregateColumns.push(
|
|
4500
|
+
aggregateColumns.push(chunkYX3H63VV_cjs.sql`COUNT(e.id) AS ${chunkYX3H63VV_cjs.sql.raw(edgeCountColumn)}`);
|
|
4501
4501
|
}
|
|
4502
4502
|
if (requiresEdgeCountDistinct) {
|
|
4503
4503
|
aggregateColumns.push(
|
|
4504
|
-
|
|
4504
|
+
chunkYX3H63VV_cjs.sql`COUNT(DISTINCT e.id) AS ${chunkYX3H63VV_cjs.sql.raw(edgeCountDistinctColumn)}`
|
|
4505
4505
|
);
|
|
4506
4506
|
}
|
|
4507
4507
|
const startCteLimit = traversal.optional && ast.orderBy === void 0 && ast.aggregateOrderBy === void 0 && ast.limit !== void 0 ? { limit: ast.limit, offset: ast.offset } : void 0;
|
|
@@ -4515,22 +4515,22 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4515
4515
|
...startCteLimit === void 0 ? {} : { limitOffset: startCteLimit }
|
|
4516
4516
|
});
|
|
4517
4517
|
const targetNodeJoinKeyword = useInnerJoin ? "JOIN" : "LEFT JOIN";
|
|
4518
|
-
const targetNodeJoin = requiresNodeJoin ?
|
|
4519
|
-
${
|
|
4520
|
-
` :
|
|
4521
|
-
const countCte =
|
|
4522
|
-
${
|
|
4518
|
+
const targetNodeJoin = requiresNodeJoin ? chunkYX3H63VV_cjs.sql`
|
|
4519
|
+
${chunkYX3H63VV_cjs.sql.raw(targetNodeJoinKeyword)} ${ctx.schema.nodesTable} n ON ${chunkYX3H63VV_cjs.sql.join(nodeJoinOnClauses, chunkYX3H63VV_cjs.sql` AND `)}
|
|
4520
|
+
` : chunkYX3H63VV_cjs.sql``;
|
|
4521
|
+
const countCte = chunkYX3H63VV_cjs.sql`
|
|
4522
|
+
${chunkYX3H63VV_cjs.sql.raw(countCteAlias)} AS (
|
|
4523
4523
|
SELECT
|
|
4524
|
-
cte_${
|
|
4525
|
-
cte_${
|
|
4526
|
-
${
|
|
4527
|
-
FROM cte_${
|
|
4528
|
-
JOIN ${ctx.schema.edgesTable} e ON cte_${
|
|
4529
|
-
AND cte_${
|
|
4530
|
-
WHERE ${
|
|
4524
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasIdColumn)} AS ${chunkYX3H63VV_cjs.sql.raw(previousAliasIdColumn)},
|
|
4525
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasKindColumn)} AS ${chunkYX3H63VV_cjs.sql.raw(previousAliasKindColumn)},
|
|
4526
|
+
${chunkYX3H63VV_cjs.sql.join(aggregateColumns, chunkYX3H63VV_cjs.sql`, `)}
|
|
4527
|
+
FROM cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}
|
|
4528
|
+
JOIN ${ctx.schema.edgesTable} e ON cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasIdColumn)} = e.${chunkYX3H63VV_cjs.sql.raw(joinField)}
|
|
4529
|
+
AND cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasKindColumn)} = e.${chunkYX3H63VV_cjs.sql.raw(joinKindField)}${targetNodeJoin}
|
|
4530
|
+
WHERE ${chunkYX3H63VV_cjs.sql.join(whereClauses, chunkYX3H63VV_cjs.sql` AND `)}
|
|
4531
4531
|
GROUP BY
|
|
4532
|
-
cte_${
|
|
4533
|
-
cte_${
|
|
4532
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasIdColumn)},
|
|
4533
|
+
cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasKindColumn)}
|
|
4534
4534
|
)
|
|
4535
4535
|
`;
|
|
4536
4536
|
function resolveCountColumn(source) {
|
|
@@ -4540,31 +4540,31 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
4540
4540
|
}
|
|
4541
4541
|
return isEdge ? edgeCountColumn : nodeCountColumn;
|
|
4542
4542
|
}
|
|
4543
|
-
const projection =
|
|
4543
|
+
const projection = chunkYX3H63VV_cjs.sql.join(
|
|
4544
4544
|
ast.projection.fields.map((projectedField) => {
|
|
4545
4545
|
const source = projectedField.source;
|
|
4546
4546
|
if (!isAggregateExpr(source)) {
|
|
4547
|
-
const value =
|
|
4547
|
+
const value = chunkUCHW2MGP_cjs.compileFieldValue(
|
|
4548
4548
|
source,
|
|
4549
4549
|
dialect,
|
|
4550
4550
|
source.valueType,
|
|
4551
4551
|
`cte_${source.alias}`
|
|
4552
4552
|
);
|
|
4553
|
-
return
|
|
4553
|
+
return chunkYX3H63VV_cjs.sql`${value} AS ${quoteIdentifier(projectedField.outputName)}`;
|
|
4554
4554
|
}
|
|
4555
4555
|
const projectedCountColumn = resolveCountColumn(source);
|
|
4556
|
-
const countValue =
|
|
4557
|
-
const aggregateValue = traversal.optional ?
|
|
4558
|
-
return
|
|
4556
|
+
const countValue = chunkYX3H63VV_cjs.sql`${chunkYX3H63VV_cjs.sql.raw(countCteAlias)}.${chunkYX3H63VV_cjs.sql.raw(projectedCountColumn)}`;
|
|
4557
|
+
const aggregateValue = traversal.optional ? chunkYX3H63VV_cjs.sql`COALESCE(${countValue}, 0)` : countValue;
|
|
4558
|
+
return chunkYX3H63VV_cjs.sql`${aggregateValue} AS ${quoteIdentifier(projectedField.outputName)}`;
|
|
4559
4559
|
}),
|
|
4560
|
-
|
|
4560
|
+
chunkYX3H63VV_cjs.sql`, `
|
|
4561
4561
|
);
|
|
4562
4562
|
const joinType = traversal.optional ? "LEFT JOIN" : "INNER JOIN";
|
|
4563
|
-
const fromClause =
|
|
4564
|
-
FROM cte_${
|
|
4565
|
-
${
|
|
4566
|
-
ON ${
|
|
4567
|
-
AND ${
|
|
4563
|
+
const fromClause = chunkYX3H63VV_cjs.sql`
|
|
4564
|
+
FROM cte_${chunkYX3H63VV_cjs.sql.raw(startAlias)}
|
|
4565
|
+
${chunkYX3H63VV_cjs.sql.raw(joinType)} ${chunkYX3H63VV_cjs.sql.raw(countCteAlias)}
|
|
4566
|
+
ON ${chunkYX3H63VV_cjs.sql.raw(countCteAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasIdColumn)} = cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasIdColumn)}
|
|
4567
|
+
AND ${chunkYX3H63VV_cjs.sql.raw(countCteAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasKindColumn)} = cte_${chunkYX3H63VV_cjs.sql.raw(previousAlias)}.${chunkYX3H63VV_cjs.sql.raw(previousAliasKindColumn)}
|
|
4568
4568
|
`;
|
|
4569
4569
|
const orderBy = buildStandardOrderBy({ ast, dialect });
|
|
4570
4570
|
const emittedLogicalPlan = startCteLimit === void 0 ? logicalPlan : stripLimitOffsetFromPlan(logicalPlan);
|
|
@@ -4704,12 +4704,12 @@ function resolveLateMaterializationPlan(ast) {
|
|
|
4704
4704
|
};
|
|
4705
4705
|
}
|
|
4706
4706
|
function buildLateMaterializedOuterFromClause(ast, graphId, ctx) {
|
|
4707
|
-
const topk =
|
|
4707
|
+
const topk = chunkYX3H63VV_cjs.sql.raw(LATE_MAT_TOPK_CTE_ALIAS);
|
|
4708
4708
|
const joins = lateMaterializedProjectedNodeAliases(ast).map((alias) => {
|
|
4709
|
-
const physical =
|
|
4710
|
-
return
|
|
4709
|
+
const physical = chunkYX3H63VV_cjs.sql.raw(lateMaterializedPhysicalAlias(alias));
|
|
4710
|
+
return chunkYX3H63VV_cjs.sql`JOIN ${ctx.schema.nodesTable} ${physical} ON ${physical}.graph_id = ${graphId} AND ${physical}.kind = ${topk}.${chunkYX3H63VV_cjs.sql.raw(`${alias}_kind`)} AND ${physical}.id = ${topk}.${chunkYX3H63VV_cjs.sql.raw(`${alias}_id`)}`;
|
|
4711
4711
|
});
|
|
4712
|
-
return joins.length === 0 ?
|
|
4712
|
+
return joins.length === 0 ? chunkYX3H63VV_cjs.sql`FROM ${topk}` : chunkYX3H63VV_cjs.sql`FROM ${topk} ${chunkYX3H63VV_cjs.sql.join(joins, chunkYX3H63VV_cjs.sql` `)}`;
|
|
4713
4713
|
}
|
|
4714
4714
|
function compileLateMaterializedQuery(ast, graphId, ctx, logicalPlan, predicateIndex, temporalFilterPass, collapsedTraversalCteAlias, shouldCollapseSelectiveTraversalRowset) {
|
|
4715
4715
|
const plan = resolveLateMaterializationPlan(ast);
|
|
@@ -4877,7 +4877,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
4877
4877
|
traversalLimit: traversalCteLimit
|
|
4878
4878
|
});
|
|
4879
4879
|
if (vectorPredicate) {
|
|
4880
|
-
const nodeKinds =
|
|
4880
|
+
const nodeKinds = chunkUCHW2MGP_cjs.getNodeKindsForAlias(ast, vectorPredicate.field.alias);
|
|
4881
4881
|
ctes.push(
|
|
4882
4882
|
buildStandardEmbeddingsCte({
|
|
4883
4883
|
ctx,
|
|
@@ -4888,7 +4888,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
4888
4888
|
);
|
|
4889
4889
|
}
|
|
4890
4890
|
if (fulltextPredicate) {
|
|
4891
|
-
const nodeKinds =
|
|
4891
|
+
const nodeKinds = chunkUCHW2MGP_cjs.getNodeKindsForAlias(ast, fulltextPredicate.field.alias);
|
|
4892
4892
|
ctes.push(
|
|
4893
4893
|
buildStandardFulltextCte({
|
|
4894
4894
|
ctx,
|
|
@@ -4898,7 +4898,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
4898
4898
|
})
|
|
4899
4899
|
);
|
|
4900
4900
|
}
|
|
4901
|
-
if (
|
|
4901
|
+
if (chunkUCHW2MGP_cjs.getHybridTargetAlias(vectorPredicate, fulltextPredicate) !== void 0) {
|
|
4902
4902
|
ctes.push(buildStandardHybridCandidateCte());
|
|
4903
4903
|
}
|
|
4904
4904
|
const projection = buildStandardProjection({
|
|
@@ -5453,7 +5453,7 @@ function createNodeTrackingProxy(alias, kindNames, tracker, options) {
|
|
|
5453
5453
|
return getPlaceholderForSystemField(property, options.mode);
|
|
5454
5454
|
}
|
|
5455
5455
|
if (property === "meta") {
|
|
5456
|
-
for (const key of
|
|
5456
|
+
for (const key of chunkCKFBZ4LV_cjs.NODE_META_KEYS) {
|
|
5457
5457
|
tracker.record(alias, `meta.${key}`, true);
|
|
5458
5458
|
}
|
|
5459
5459
|
return buildNodeMetaPlaceholder(options.mode);
|
|
@@ -5486,7 +5486,7 @@ function createEdgeTrackingProxy(alias, edgeKindNames, tracker, options) {
|
|
|
5486
5486
|
return getPlaceholderForSystemField(property, options.mode);
|
|
5487
5487
|
}
|
|
5488
5488
|
if (property === "meta") {
|
|
5489
|
-
for (const key of
|
|
5489
|
+
for (const key of chunkCKFBZ4LV_cjs.EDGE_META_KEYS) {
|
|
5490
5490
|
tracker.record(alias, `meta.${key}`, true);
|
|
5491
5491
|
}
|
|
5492
5492
|
return buildEdgeMetaPlaceholder(options.mode);
|
|
@@ -5828,7 +5828,7 @@ function createGuardedProxy(target, debugPath) {
|
|
|
5828
5828
|
// src/query/builder/read-instant-template.ts
|
|
5829
5829
|
function templateHasReadInstant(template) {
|
|
5830
5830
|
return template.params.some(
|
|
5831
|
-
(parameter) =>
|
|
5831
|
+
(parameter) => chunkYX3H63VV_cjs.isSqlPlaceholder(parameter) && parameter.name === chunkUCHW2MGP_cjs.CURRENT_READ_INSTANT_PLACEHOLDER
|
|
5832
5832
|
);
|
|
5833
5833
|
}
|
|
5834
5834
|
function queryAstNeedsCurrentReadInstant(ast) {
|
|
@@ -5844,7 +5844,7 @@ function buildReadInstantTemplate(args) {
|
|
|
5844
5844
|
const { backend } = args;
|
|
5845
5845
|
if (backend?.compileSql === void 0) return void 0;
|
|
5846
5846
|
const compiled = args.compile();
|
|
5847
|
-
if (!
|
|
5847
|
+
if (!chunkYX3H63VV_cjs.isRawExecutable(compiled)) return void 0;
|
|
5848
5848
|
const template = backend.compileSql(compiled);
|
|
5849
5849
|
if (args.needsReadInstant && !templateHasReadInstant(template)) {
|
|
5850
5850
|
return void 0;
|
|
@@ -5864,10 +5864,10 @@ function buildQueryTemplate(ast, graphId, compileOptions, backend) {
|
|
|
5864
5864
|
function fillTemplateParams(params, bindings, dialect) {
|
|
5865
5865
|
let readInstant;
|
|
5866
5866
|
return params.map((parameter) => {
|
|
5867
|
-
if (!
|
|
5867
|
+
if (!chunkYX3H63VV_cjs.isSqlPlaceholder(parameter)) return parameter;
|
|
5868
5868
|
const name = parameter.name;
|
|
5869
|
-
if (name ===
|
|
5870
|
-
readInstant ??=
|
|
5869
|
+
if (name === chunkUCHW2MGP_cjs.CURRENT_READ_INSTANT_PLACEHOLDER) {
|
|
5870
|
+
readInstant ??= chunkMNURF4RF_cjs.nowIso();
|
|
5871
5871
|
return readInstant;
|
|
5872
5872
|
}
|
|
5873
5873
|
const value = bindings[name];
|
|
@@ -5876,7 +5876,7 @@ function fillTemplateParams(params, bindings, dialect) {
|
|
|
5876
5876
|
parameterName: name
|
|
5877
5877
|
});
|
|
5878
5878
|
}
|
|
5879
|
-
return
|
|
5879
|
+
return chunkYX3H63VV_cjs.bindSqlValue(value, dialect);
|
|
5880
5880
|
});
|
|
5881
5881
|
}
|
|
5882
5882
|
|
|
@@ -5908,7 +5908,7 @@ function toLiteral(value) {
|
|
|
5908
5908
|
function substitutePredicateExpression(expr, bindings) {
|
|
5909
5909
|
switch (expr.__type) {
|
|
5910
5910
|
case "comparison": {
|
|
5911
|
-
if (
|
|
5911
|
+
if (chunkUCHW2MGP_cjs.isParameterRef(expr.right)) {
|
|
5912
5912
|
const value = bindings[expr.right.name];
|
|
5913
5913
|
if (value === void 0) {
|
|
5914
5914
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
@@ -5924,7 +5924,7 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
5924
5924
|
return expr;
|
|
5925
5925
|
}
|
|
5926
5926
|
case "string_op": {
|
|
5927
|
-
if (
|
|
5927
|
+
if (chunkUCHW2MGP_cjs.isParameterRef(expr.pattern)) {
|
|
5928
5928
|
const value = bindings[expr.pattern.name];
|
|
5929
5929
|
if (value === void 0) {
|
|
5930
5930
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
@@ -5946,8 +5946,8 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
5946
5946
|
return expr;
|
|
5947
5947
|
}
|
|
5948
5948
|
case "between": {
|
|
5949
|
-
const lowerIsParam =
|
|
5950
|
-
const upperIsParam =
|
|
5949
|
+
const lowerIsParam = chunkUCHW2MGP_cjs.isParameterRef(expr.lower);
|
|
5950
|
+
const upperIsParam = chunkUCHW2MGP_cjs.isParameterRef(expr.upper);
|
|
5951
5951
|
if (!lowerIsParam && !upperIsParam) return expr;
|
|
5952
5952
|
const lower = lowerIsParam ? toLiteral(resolveBinding(bindings, expr.lower.name)) : expr.lower;
|
|
5953
5953
|
const upper = upperIsParam ? toLiteral(resolveBinding(bindings, expr.upper.name)) : expr.upper;
|
|
@@ -6182,23 +6182,23 @@ function collectParameterMetadataFromAst(ast, names, stringOpParameters) {
|
|
|
6182
6182
|
function collectParameterMetadataFromExpression(expression, names, stringOpParameters) {
|
|
6183
6183
|
switch (expression.__type) {
|
|
6184
6184
|
case "comparison": {
|
|
6185
|
-
if (
|
|
6185
|
+
if (chunkUCHW2MGP_cjs.isParameterRef(expression.right)) {
|
|
6186
6186
|
names.add(expression.right.name);
|
|
6187
6187
|
}
|
|
6188
6188
|
return;
|
|
6189
6189
|
}
|
|
6190
6190
|
case "string_op": {
|
|
6191
|
-
if (
|
|
6191
|
+
if (chunkUCHW2MGP_cjs.isParameterRef(expression.pattern)) {
|
|
6192
6192
|
names.add(expression.pattern.name);
|
|
6193
6193
|
stringOpParameters.add(expression.pattern.name);
|
|
6194
6194
|
}
|
|
6195
6195
|
return;
|
|
6196
6196
|
}
|
|
6197
6197
|
case "between": {
|
|
6198
|
-
if (
|
|
6198
|
+
if (chunkUCHW2MGP_cjs.isParameterRef(expression.lower)) {
|
|
6199
6199
|
names.add(expression.lower.name);
|
|
6200
6200
|
}
|
|
6201
|
-
if (
|
|
6201
|
+
if (chunkUCHW2MGP_cjs.isParameterRef(expression.upper)) {
|
|
6202
6202
|
names.add(expression.upper.name);
|
|
6203
6203
|
}
|
|
6204
6204
|
return;
|
|
@@ -6637,7 +6637,7 @@ function buildVectorSlots(registry) {
|
|
|
6637
6637
|
const slots = /* @__PURE__ */ new Map();
|
|
6638
6638
|
for (const [nodeKind, nodeType] of registry.nodeKinds) {
|
|
6639
6639
|
for (const field2 of chunkHAHNRASW_cjs.resolveEmbeddingFields(nodeType.schema)) {
|
|
6640
|
-
slots.set(
|
|
6640
|
+
slots.set(chunkJZYMOHHM_cjs.vectorSlotKey(nodeKind, field2.fieldPath), {
|
|
6641
6641
|
dimensions: field2.dimensions,
|
|
6642
6642
|
metric: field2.metric,
|
|
6643
6643
|
indexType: field2.indexType
|
|
@@ -6716,10 +6716,10 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
6716
6716
|
}
|
|
6717
6717
|
}
|
|
6718
6718
|
const orderSpec = isSystem ? {
|
|
6719
|
-
field:
|
|
6719
|
+
field: chunkUCHW2MGP_cjs.fieldRef(alias, [field2], { valueType: "string" }),
|
|
6720
6720
|
direction
|
|
6721
6721
|
} : {
|
|
6722
|
-
field:
|
|
6722
|
+
field: chunkUCHW2MGP_cjs.fieldRef(alias, ["props"], {
|
|
6723
6723
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([field2]),
|
|
6724
6724
|
valueType: typeInfo?.valueType,
|
|
6725
6725
|
elementType: typeInfo?.elementType
|
|
@@ -7832,12 +7832,12 @@ function createDynamicFieldBuilder(introspector, alias, name, kindNames, entity)
|
|
|
7832
7832
|
if (typeInfo === void 0) {
|
|
7833
7833
|
throw new Error(`Property "${name}" is not declared on ${where}.`);
|
|
7834
7834
|
}
|
|
7835
|
-
const ref =
|
|
7835
|
+
const ref = chunkUCHW2MGP_cjs.fieldRef(alias, ["props"], {
|
|
7836
7836
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([name]),
|
|
7837
7837
|
valueType: typeInfo.valueType,
|
|
7838
7838
|
elementType: typeInfo.elementType
|
|
7839
7839
|
});
|
|
7840
|
-
const base =
|
|
7840
|
+
const base = chunkUCHW2MGP_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
7841
7841
|
const expect = (asserted) => {
|
|
7842
7842
|
if (typeInfo.valueType !== asserted) {
|
|
7843
7843
|
throw new TypeError(
|
|
@@ -8009,17 +8009,17 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8009
8009
|
(kind) => !this.#edgeKinds.includes(kind)
|
|
8010
8010
|
)
|
|
8011
8011
|
];
|
|
8012
|
-
const idAccessor =
|
|
8013
|
-
|
|
8012
|
+
const idAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8013
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8014
8014
|
);
|
|
8015
|
-
const kindAccessor =
|
|
8016
|
-
|
|
8015
|
+
const kindAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8016
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8017
8017
|
);
|
|
8018
|
-
const fromIdAccessor =
|
|
8019
|
-
|
|
8018
|
+
const fromIdAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8019
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
8020
8020
|
);
|
|
8021
|
-
const toIdAccessor =
|
|
8022
|
-
|
|
8021
|
+
const toIdAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8022
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
8023
8023
|
);
|
|
8024
8024
|
const buildFieldAccessor = (propertyName) => {
|
|
8025
8025
|
const typeInfo = this.#config.schemaIntrospector.getSharedEdgeFieldTypeInfo(
|
|
@@ -8028,34 +8028,34 @@ var TraversalBuilder = class _TraversalBuilder {
|
|
|
8028
8028
|
);
|
|
8029
8029
|
const valueType = typeInfo?.valueType;
|
|
8030
8030
|
const elementType = typeInfo?.elementType;
|
|
8031
|
-
const ref =
|
|
8031
|
+
const ref = chunkUCHW2MGP_cjs.fieldRef(alias, ["props"], {
|
|
8032
8032
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([propertyName]),
|
|
8033
8033
|
valueType,
|
|
8034
8034
|
elementType
|
|
8035
8035
|
});
|
|
8036
8036
|
switch (valueType) {
|
|
8037
8037
|
case "string": {
|
|
8038
|
-
return
|
|
8038
|
+
return chunkUCHW2MGP_cjs.stringField(ref);
|
|
8039
8039
|
}
|
|
8040
8040
|
case "number": {
|
|
8041
|
-
return
|
|
8041
|
+
return chunkUCHW2MGP_cjs.numberField(ref);
|
|
8042
8042
|
}
|
|
8043
8043
|
case "boolean": {
|
|
8044
|
-
return
|
|
8044
|
+
return chunkUCHW2MGP_cjs.baseField(ref);
|
|
8045
8045
|
}
|
|
8046
8046
|
case "date": {
|
|
8047
|
-
return
|
|
8047
|
+
return chunkUCHW2MGP_cjs.dateField(ref);
|
|
8048
8048
|
}
|
|
8049
8049
|
case "array": {
|
|
8050
|
-
return
|
|
8050
|
+
return chunkUCHW2MGP_cjs.arrayField(ref);
|
|
8051
8051
|
}
|
|
8052
8052
|
case "object": {
|
|
8053
|
-
return
|
|
8053
|
+
return chunkUCHW2MGP_cjs.objectField(ref);
|
|
8054
8054
|
}
|
|
8055
8055
|
case "embedding":
|
|
8056
8056
|
case "unknown":
|
|
8057
8057
|
case void 0: {
|
|
8058
|
-
return
|
|
8058
|
+
return chunkUCHW2MGP_cjs.baseField(ref);
|
|
8059
8059
|
}
|
|
8060
8060
|
}
|
|
8061
8061
|
};
|
|
@@ -8200,39 +8200,39 @@ function buildNodeFields(alias) {
|
|
|
8200
8200
|
return [
|
|
8201
8201
|
{
|
|
8202
8202
|
outputName: `${alias}_id`,
|
|
8203
|
-
source:
|
|
8203
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["id"])
|
|
8204
8204
|
},
|
|
8205
8205
|
{
|
|
8206
8206
|
outputName: `${alias}_kind`,
|
|
8207
|
-
source:
|
|
8207
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["kind"])
|
|
8208
8208
|
},
|
|
8209
8209
|
{
|
|
8210
8210
|
outputName: `${alias}_props`,
|
|
8211
|
-
source:
|
|
8211
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["props"])
|
|
8212
8212
|
},
|
|
8213
8213
|
{
|
|
8214
8214
|
outputName: `${alias}_version`,
|
|
8215
|
-
source:
|
|
8215
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["version"])
|
|
8216
8216
|
},
|
|
8217
8217
|
{
|
|
8218
8218
|
outputName: `${alias}_valid_from`,
|
|
8219
|
-
source:
|
|
8219
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["valid_from"])
|
|
8220
8220
|
},
|
|
8221
8221
|
{
|
|
8222
8222
|
outputName: `${alias}_valid_to`,
|
|
8223
|
-
source:
|
|
8223
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["valid_to"])
|
|
8224
8224
|
},
|
|
8225
8225
|
{
|
|
8226
8226
|
outputName: `${alias}_created_at`,
|
|
8227
|
-
source:
|
|
8227
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["created_at"])
|
|
8228
8228
|
},
|
|
8229
8229
|
{
|
|
8230
8230
|
outputName: `${alias}_updated_at`,
|
|
8231
|
-
source:
|
|
8231
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["updated_at"])
|
|
8232
8232
|
},
|
|
8233
8233
|
{
|
|
8234
8234
|
outputName: `${alias}_deleted_at`,
|
|
8235
|
-
source:
|
|
8235
|
+
source: chunkUCHW2MGP_cjs.fieldRef(alias, ["deleted_at"])
|
|
8236
8236
|
}
|
|
8237
8237
|
];
|
|
8238
8238
|
}
|
|
@@ -8241,52 +8241,52 @@ function buildEdgeFields(edgeAlias, nodeCteAlias) {
|
|
|
8241
8241
|
return [
|
|
8242
8242
|
{
|
|
8243
8243
|
outputName: `${edgeAlias}_id`,
|
|
8244
|
-
source:
|
|
8244
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["id"]),
|
|
8245
8245
|
cteAlias
|
|
8246
8246
|
},
|
|
8247
8247
|
{
|
|
8248
8248
|
outputName: `${edgeAlias}_kind`,
|
|
8249
|
-
source:
|
|
8249
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["kind"]),
|
|
8250
8250
|
cteAlias
|
|
8251
8251
|
},
|
|
8252
8252
|
{
|
|
8253
8253
|
outputName: `${edgeAlias}_from_id`,
|
|
8254
|
-
source:
|
|
8254
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["from_id"]),
|
|
8255
8255
|
cteAlias
|
|
8256
8256
|
},
|
|
8257
8257
|
{
|
|
8258
8258
|
outputName: `${edgeAlias}_to_id`,
|
|
8259
|
-
source:
|
|
8259
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["to_id"]),
|
|
8260
8260
|
cteAlias
|
|
8261
8261
|
},
|
|
8262
8262
|
{
|
|
8263
8263
|
outputName: `${edgeAlias}_props`,
|
|
8264
|
-
source:
|
|
8264
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["props"]),
|
|
8265
8265
|
cteAlias
|
|
8266
8266
|
},
|
|
8267
8267
|
{
|
|
8268
8268
|
outputName: `${edgeAlias}_valid_from`,
|
|
8269
|
-
source:
|
|
8269
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["valid_from"]),
|
|
8270
8270
|
cteAlias
|
|
8271
8271
|
},
|
|
8272
8272
|
{
|
|
8273
8273
|
outputName: `${edgeAlias}_valid_to`,
|
|
8274
|
-
source:
|
|
8274
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["valid_to"]),
|
|
8275
8275
|
cteAlias
|
|
8276
8276
|
},
|
|
8277
8277
|
{
|
|
8278
8278
|
outputName: `${edgeAlias}_created_at`,
|
|
8279
|
-
source:
|
|
8279
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["created_at"]),
|
|
8280
8280
|
cteAlias
|
|
8281
8281
|
},
|
|
8282
8282
|
{
|
|
8283
8283
|
outputName: `${edgeAlias}_updated_at`,
|
|
8284
|
-
source:
|
|
8284
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["updated_at"]),
|
|
8285
8285
|
cteAlias
|
|
8286
8286
|
},
|
|
8287
8287
|
{
|
|
8288
8288
|
outputName: `${edgeAlias}_deleted_at`,
|
|
8289
|
-
source:
|
|
8289
|
+
source: chunkUCHW2MGP_cjs.fieldRef(edgeAlias, ["deleted_at"]),
|
|
8290
8290
|
cteAlias
|
|
8291
8291
|
}
|
|
8292
8292
|
];
|
|
@@ -8316,15 +8316,15 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8316
8316
|
if (sealedCoordinate !== void 0) {
|
|
8317
8317
|
const coordinate2 = sealedCoordinate;
|
|
8318
8318
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
8319
|
-
`.temporal() is not available on a StoreView query \u2014 the view's temporal coordinate (${
|
|
8319
|
+
`.temporal() is not available on a StoreView query \u2014 the view's temporal coordinate (${chunkLL5D5T5W_cjs.describeCoordinate(coordinate2)}) is sealed. Re-coordinate on the live Store via store.query() or store.view(...).`,
|
|
8320
8320
|
{
|
|
8321
8321
|
code: "STORE_VIEW_SEALED_QUERY",
|
|
8322
|
-
...
|
|
8322
|
+
...chunkLL5D5T5W_cjs.coordinateContext(coordinate2),
|
|
8323
8323
|
requestedMode: mode
|
|
8324
8324
|
}
|
|
8325
8325
|
);
|
|
8326
8326
|
}
|
|
8327
|
-
const coordinate =
|
|
8327
|
+
const coordinate = chunkLL5D5T5W_cjs.resolveReadCoordinate(
|
|
8328
8328
|
mode,
|
|
8329
8329
|
asOf,
|
|
8330
8330
|
`Use .temporal("asOf", "2024-01-15T10:00:00.000Z") or .temporal("current") for current time.`
|
|
@@ -8599,10 +8599,10 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8599
8599
|
field2
|
|
8600
8600
|
) : this.#getOrderByTypeInfo(alias, field2);
|
|
8601
8601
|
const orderSpec = isSystem ? {
|
|
8602
|
-
field:
|
|
8602
|
+
field: chunkUCHW2MGP_cjs.fieldRef(alias, [field2], { valueType: "string" }),
|
|
8603
8603
|
direction
|
|
8604
8604
|
} : {
|
|
8605
|
-
field:
|
|
8605
|
+
field: chunkUCHW2MGP_cjs.fieldRef(alias, ["props"], {
|
|
8606
8606
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([field2]),
|
|
8607
8607
|
valueType: typeInfo?.valueType,
|
|
8608
8608
|
elementType: typeInfo?.elementType
|
|
@@ -8778,7 +8778,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8778
8778
|
kindNames,
|
|
8779
8779
|
property
|
|
8780
8780
|
) : void 0;
|
|
8781
|
-
const ref =
|
|
8781
|
+
const ref = chunkUCHW2MGP_cjs.fieldRef(alias, ["props"], {
|
|
8782
8782
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([property]),
|
|
8783
8783
|
valueType: typeInfo?.valueType,
|
|
8784
8784
|
elementType: typeInfo?.elementType
|
|
@@ -8786,17 +8786,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8786
8786
|
return this.#buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
8787
8787
|
}
|
|
8788
8788
|
#buildFieldBuilderForTypeInfo(ref, typeInfo) {
|
|
8789
|
-
return
|
|
8789
|
+
return chunkUCHW2MGP_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
|
|
8790
8790
|
}
|
|
8791
8791
|
#createNodeAccessor(alias) {
|
|
8792
8792
|
const kindNames = this.#getKindNamesForAlias(alias);
|
|
8793
|
-
const idAccessor =
|
|
8794
|
-
|
|
8793
|
+
const idAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8794
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8795
8795
|
);
|
|
8796
|
-
const kindAccessor =
|
|
8797
|
-
|
|
8796
|
+
const kindAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8797
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8798
8798
|
);
|
|
8799
|
-
const fulltextAccessor =
|
|
8799
|
+
const fulltextAccessor = chunkUCHW2MGP_cjs.createFulltextAccessor(
|
|
8800
8800
|
alias,
|
|
8801
8801
|
() => this.#hasSearchableField(kindNames)
|
|
8802
8802
|
);
|
|
@@ -8871,7 +8871,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8871
8871
|
edgeKindNames,
|
|
8872
8872
|
property
|
|
8873
8873
|
) : void 0;
|
|
8874
|
-
const ref =
|
|
8874
|
+
const ref = chunkUCHW2MGP_cjs.fieldRef(alias, ["props"], {
|
|
8875
8875
|
jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([property]),
|
|
8876
8876
|
valueType: typeInfo?.valueType,
|
|
8877
8877
|
elementType: typeInfo?.elementType
|
|
@@ -8880,17 +8880,17 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8880
8880
|
}
|
|
8881
8881
|
#createEdgeAccessor(alias) {
|
|
8882
8882
|
const edgeKindNames = this.#getEdgeKindNamesForAlias(alias);
|
|
8883
|
-
const idAccessor =
|
|
8884
|
-
|
|
8883
|
+
const idAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8884
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["id"], { valueType: "string" })
|
|
8885
8885
|
);
|
|
8886
|
-
const kindAccessor =
|
|
8887
|
-
|
|
8886
|
+
const kindAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8887
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
|
|
8888
8888
|
);
|
|
8889
|
-
const fromIdAccessor =
|
|
8890
|
-
|
|
8889
|
+
const fromIdAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8890
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
|
|
8891
8891
|
);
|
|
8892
|
-
const toIdAccessor =
|
|
8893
|
-
|
|
8892
|
+
const toIdAccessor = chunkUCHW2MGP_cjs.stringField(
|
|
8893
|
+
chunkUCHW2MGP_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
|
|
8894
8894
|
);
|
|
8895
8895
|
if (this.#state.dynamicEdgeAliases.has(alias)) {
|
|
8896
8896
|
return {
|
|
@@ -9524,7 +9524,7 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
|
|
|
9524
9524
|
}
|
|
9525
9525
|
}
|
|
9526
9526
|
};
|
|
9527
|
-
await
|
|
9527
|
+
await chunkQYDUCWD2_cjs.runOptionallyInTransaction(backend, writePage);
|
|
9528
9528
|
processed += rows.length;
|
|
9529
9529
|
upserted += pageResult.toUpsert.length;
|
|
9530
9530
|
cleared += pageResult.toDelete.length;
|
|
@@ -9556,7 +9556,7 @@ function processPage(schema, rows) {
|
|
|
9556
9556
|
}
|
|
9557
9557
|
let parsed;
|
|
9558
9558
|
try {
|
|
9559
|
-
parsed =
|
|
9559
|
+
parsed = chunkQYDUCWD2_cjs.rowPropsToObject(row.props);
|
|
9560
9560
|
} catch {
|
|
9561
9561
|
skipped += 1;
|
|
9562
9562
|
skippedIds.push(row.id);
|
|
@@ -9567,7 +9567,7 @@ function processPage(schema, rows) {
|
|
|
9567
9567
|
skippedIds.push(row.id);
|
|
9568
9568
|
continue;
|
|
9569
9569
|
}
|
|
9570
|
-
const computed =
|
|
9570
|
+
const computed = chunkUCHW2MGP_cjs.computeFulltextContent(schema, parsed);
|
|
9571
9571
|
if (computed === void 0) {
|
|
9572
9572
|
toDelete.push(row.id);
|
|
9573
9573
|
} else {
|
|
@@ -9595,7 +9595,7 @@ function buildKindCandidates(ctx, nodeKind, where) {
|
|
|
9595
9595
|
const compiled = chain.select(
|
|
9596
9596
|
(aliases) => aliases[SEARCH_CANDIDATE_ALIAS]
|
|
9597
9597
|
).compile();
|
|
9598
|
-
return
|
|
9598
|
+
return chunkYX3H63VV_cjs.sql`SELECT ${chunkYX3H63VV_cjs.sql.raw(`"${SEARCH_CANDIDATE_ALIAS}_id"`)} AS node_id FROM (${compiled}) AS tg_search_candidates`;
|
|
9599
9599
|
}
|
|
9600
9600
|
function resolveSearchKinds(ctx, nodeKind, includeSubClasses) {
|
|
9601
9601
|
if (includeSubClasses !== true) return [nodeKind];
|
|
@@ -9648,7 +9648,7 @@ async function fetchNodesForRows(backend, graphId, rows) {
|
|
|
9648
9648
|
function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
|
|
9649
9649
|
const nodeType = ctx.registry.getNodeType(nodeKind);
|
|
9650
9650
|
if (nodeType === void 0) return void 0;
|
|
9651
|
-
const fields =
|
|
9651
|
+
const fields = chunkUCHW2MGP_cjs.getEmbeddingFields(nodeType.schema);
|
|
9652
9652
|
const field2 = fields.find((entry2) => entry2.fieldPath === fieldPath);
|
|
9653
9653
|
if (field2 === void 0) return void 0;
|
|
9654
9654
|
return {
|
|
@@ -9958,7 +9958,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
|
|
|
9958
9958
|
...candidates === void 0 ? {} : { candidates }
|
|
9959
9959
|
});
|
|
9960
9960
|
return rows.map((row, index) => {
|
|
9961
|
-
const typedNode =
|
|
9961
|
+
const typedNode = chunkYIX3BEBR_cjs.rowToNode(row.node);
|
|
9962
9962
|
return {
|
|
9963
9963
|
node: typedNode,
|
|
9964
9964
|
score: row.fusedScore,
|
|
@@ -10123,7 +10123,7 @@ function assertEfSearch(efSearch, label) {
|
|
|
10123
10123
|
}
|
|
10124
10124
|
function assertMinScore(minScore, metric, label) {
|
|
10125
10125
|
if (minScore === void 0) return;
|
|
10126
|
-
|
|
10126
|
+
chunkHAQVISUF_cjs.assertVectorMinScore(minScore, metric, label);
|
|
10127
10127
|
}
|
|
10128
10128
|
function assertVectorQueryCompatible(backend, slot, options, label) {
|
|
10129
10129
|
if (options.metric !== void 0 && options.metric !== slot.metric) {
|
|
@@ -10222,13 +10222,13 @@ async function fetchNodesByIds(backend, graphId, nodeKind, ids) {
|
|
|
10222
10222
|
const rows = await backend.getNodes(graphId, nodeKind, ids);
|
|
10223
10223
|
for (const row of rows) {
|
|
10224
10224
|
if (row.deleted_at !== void 0) continue;
|
|
10225
|
-
map.set(row.id,
|
|
10225
|
+
map.set(row.id, chunkYIX3BEBR_cjs.rowToNode(row));
|
|
10226
10226
|
}
|
|
10227
10227
|
return map;
|
|
10228
10228
|
}
|
|
10229
10229
|
for (const id of ids) {
|
|
10230
10230
|
const row = await backend.getNode(graphId, nodeKind, id);
|
|
10231
|
-
if (row && row.deleted_at === void 0) map.set(row.id,
|
|
10231
|
+
if (row && row.deleted_at === void 0) map.set(row.id, chunkYIX3BEBR_cjs.rowToNode(row));
|
|
10232
10232
|
}
|
|
10233
10233
|
return map;
|
|
10234
10234
|
}
|
|
@@ -10710,7 +10710,7 @@ function planRemovals(graph, names) {
|
|
|
10710
10710
|
if (namesSet.size === 0) {
|
|
10711
10711
|
return { document, removedNodeKinds: [], removedEdgeKinds: [] };
|
|
10712
10712
|
}
|
|
10713
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
10713
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkK4FB2RMO_cjs.extensionKindNames(document);
|
|
10714
10714
|
const compileTimeNodeNames = new Set(
|
|
10715
10715
|
Object.keys(graph.nodes).filter((name) => !runtimeNodeNames.has(name))
|
|
10716
10716
|
);
|
|
@@ -10810,8 +10810,8 @@ function planRemovals(graph, names) {
|
|
|
10810
10810
|
function stripGraphExtension(graph) {
|
|
10811
10811
|
const document = graph.extension;
|
|
10812
10812
|
if (document === void 0) return graph;
|
|
10813
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
10814
|
-
const runtimeOntologyKeys =
|
|
10813
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkK4FB2RMO_cjs.extensionKindNames(document);
|
|
10814
|
+
const runtimeOntologyKeys = chunkK4FB2RMO_cjs.buildGraphExtensionOntologyKeySet(document);
|
|
10815
10815
|
const compileNodes = {};
|
|
10816
10816
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
10817
10817
|
if (runtimeNodeNames.has(name)) continue;
|
|
@@ -10823,7 +10823,7 @@ function stripGraphExtension(graph) {
|
|
|
10823
10823
|
compileEdges[name] = registration;
|
|
10824
10824
|
}
|
|
10825
10825
|
const compileOntology = graph.ontology.filter(
|
|
10826
|
-
(relation) => !runtimeOntologyKeys.has(
|
|
10826
|
+
(relation) => !runtimeOntologyKeys.has(chunkK4FB2RMO_cjs.compileTimeOntologyKey(relation))
|
|
10827
10827
|
);
|
|
10828
10828
|
const compileIndexes = (graph.indexes ?? []).filter(
|
|
10829
10829
|
(index) => index.origin !== "runtime"
|
|
@@ -10863,11 +10863,11 @@ function buildCompileTimeReferentIndex(graph, runtimeEdgeNames) {
|
|
|
10863
10863
|
append(endpoint.kind, referent);
|
|
10864
10864
|
}
|
|
10865
10865
|
}
|
|
10866
|
-
const runtimeOntologyKeys =
|
|
10866
|
+
const runtimeOntologyKeys = chunkK4FB2RMO_cjs.buildGraphExtensionOntologyKeySet(
|
|
10867
10867
|
graph.extension
|
|
10868
10868
|
);
|
|
10869
10869
|
for (const relation of graph.ontology) {
|
|
10870
|
-
if (runtimeOntologyKeys.has(
|
|
10870
|
+
if (runtimeOntologyKeys.has(chunkK4FB2RMO_cjs.compileTimeOntologyKey(relation))) continue;
|
|
10871
10871
|
const fromName = chunkRW24SAHI_cjs.getTypeName(relation.from);
|
|
10872
10872
|
const toName = chunkRW24SAHI_cjs.getTypeName(relation.to);
|
|
10873
10873
|
const referent = {
|
|
@@ -10891,12 +10891,12 @@ function pickTemporalOptions(options) {
|
|
|
10891
10891
|
};
|
|
10892
10892
|
}
|
|
10893
10893
|
function resolveTemporalOptions(ctx, options) {
|
|
10894
|
-
const { valid } =
|
|
10894
|
+
const { valid } = chunkLL5D5T5W_cjs.resolveReadCoordinate(
|
|
10895
10895
|
options.temporalMode ?? ctx.defaultTemporalMode,
|
|
10896
10896
|
options.asOf
|
|
10897
10897
|
);
|
|
10898
10898
|
if (options.recordedAsOf !== void 0) {
|
|
10899
|
-
|
|
10899
|
+
chunkLL5D5T5W_cjs.assertValidRecordedInstant(options.recordedAsOf, "recordedAsOf");
|
|
10900
10900
|
}
|
|
10901
10901
|
return {
|
|
10902
10902
|
temporalMode: valid.mode,
|
|
@@ -10905,7 +10905,7 @@ function resolveTemporalOptions(ctx, options) {
|
|
|
10905
10905
|
};
|
|
10906
10906
|
}
|
|
10907
10907
|
function resolveReadSchema(ctx, options) {
|
|
10908
|
-
return
|
|
10908
|
+
return chunkJZYMOHHM_cjs.recordedReadSchemaFor(
|
|
10909
10909
|
ctx.schema,
|
|
10910
10910
|
options.recordedAsOf,
|
|
10911
10911
|
ctx.recordedReadBinding,
|
|
@@ -10919,9 +10919,9 @@ function resolveTemporalFilter(ctx, options, tableAlias) {
|
|
|
10919
10919
|
asOf: resolved.asOf,
|
|
10920
10920
|
recordedAsOf: resolved.recordedAsOf,
|
|
10921
10921
|
tableAlias,
|
|
10922
|
-
currentTimestamp:
|
|
10922
|
+
currentTimestamp: chunkUCHW2MGP_cjs.currentReadInstant()
|
|
10923
10923
|
};
|
|
10924
|
-
return
|
|
10924
|
+
return chunkUCHW2MGP_cjs.compileTemporalFilter(filterOptions);
|
|
10925
10925
|
}
|
|
10926
10926
|
function resolveMaxHops(rawMaxHops, fallback, optionName) {
|
|
10927
10927
|
const value = rawMaxHops ?? fallback;
|
|
@@ -10964,8 +10964,8 @@ function assertEdgeKinds(edges) {
|
|
|
10964
10964
|
}
|
|
10965
10965
|
}
|
|
10966
10966
|
function compileNodeKindSeedFilter(nodeKinds) {
|
|
10967
|
-
if (nodeKinds === void 0) return
|
|
10968
|
-
return
|
|
10967
|
+
if (nodeKinds === void 0) return chunkYX3H63VV_cjs.sql`TRUE`;
|
|
10968
|
+
return chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("n.kind"), nodeKinds);
|
|
10969
10969
|
}
|
|
10970
10970
|
function normalizeNodeKinds(nodeKinds) {
|
|
10971
10971
|
if (nodeKinds === void 0) return void 0;
|
|
@@ -10998,27 +10998,27 @@ async function executeDegree(ctx, nodeId, options = {}) {
|
|
|
10998
10998
|
if (edgeKinds.length === 0) return 0;
|
|
10999
10999
|
const schema = resolveReadSchema(ctx, options);
|
|
11000
11000
|
const whereClauses = [
|
|
11001
|
-
|
|
11001
|
+
chunkYX3H63VV_cjs.sql`graph_id = ${ctx.graphId}`,
|
|
11002
11002
|
resolveTemporalFilter(ctx, options),
|
|
11003
11003
|
compileDirectionFilter(ctx, direction, nodeId, schema.nodesTable)
|
|
11004
11004
|
];
|
|
11005
11005
|
if (options.edges !== void 0) {
|
|
11006
|
-
whereClauses.push(
|
|
11006
|
+
whereClauses.push(chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("kind"), options.edges));
|
|
11007
11007
|
}
|
|
11008
|
-
const countExpr = direction === "both" ?
|
|
11009
|
-
const query =
|
|
11008
|
+
const countExpr = direction === "both" ? chunkYX3H63VV_cjs.sql`COUNT(DISTINCT id)` : chunkYX3H63VV_cjs.sql`COUNT(*)`;
|
|
11009
|
+
const query = chunkYX3H63VV_cjs.sql`SELECT ${countExpr} AS count FROM ${schema.edgesTable} WHERE ${chunkYX3H63VV_cjs.sql.join(whereClauses, chunkYX3H63VV_cjs.sql` AND `)}`;
|
|
11010
11010
|
const rows = await ctx.backend.execute(
|
|
11011
|
-
|
|
11011
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(query)
|
|
11012
11012
|
);
|
|
11013
11013
|
return Number(rows[0]?.count ?? 0);
|
|
11014
11014
|
}
|
|
11015
11015
|
function nodeKindSubquery(ctx, nodeId, nodesTable) {
|
|
11016
|
-
return
|
|
11016
|
+
return chunkYX3H63VV_cjs.sql`(SELECT kind FROM ${nodesTable} WHERE graph_id = ${ctx.graphId} AND id = ${nodeId} LIMIT 1)`;
|
|
11017
11017
|
}
|
|
11018
11018
|
function compileDirectionFilter(ctx, direction, nodeId, nodesTable) {
|
|
11019
11019
|
const nodeKind = nodeKindSubquery(ctx, nodeId, nodesTable);
|
|
11020
|
-
const fromSide =
|
|
11021
|
-
const toSide =
|
|
11020
|
+
const fromSide = chunkYX3H63VV_cjs.sql`(from_kind = ${nodeKind} AND from_id = ${nodeId})`;
|
|
11021
|
+
const toSide = chunkYX3H63VV_cjs.sql`(to_kind = ${nodeKind} AND to_id = ${nodeId})`;
|
|
11022
11022
|
switch (direction) {
|
|
11023
11023
|
case "out": {
|
|
11024
11024
|
return fromSide;
|
|
@@ -11027,20 +11027,20 @@ function compileDirectionFilter(ctx, direction, nodeId, nodesTable) {
|
|
|
11027
11027
|
return toSide;
|
|
11028
11028
|
}
|
|
11029
11029
|
case "both": {
|
|
11030
|
-
return
|
|
11030
|
+
return chunkYX3H63VV_cjs.sql`(${fromSide} OR ${toSide})`;
|
|
11031
11031
|
}
|
|
11032
11032
|
}
|
|
11033
11033
|
}
|
|
11034
11034
|
|
|
11035
11035
|
// src/store/algorithms/iterative-graph-operation.ts
|
|
11036
11036
|
function frontierIndexIdentifier(context) {
|
|
11037
|
-
return
|
|
11037
|
+
return chunkYX3H63VV_cjs.sql.identifier(
|
|
11038
11038
|
`typegraph_iterative_${context.runId.replaceAll("-", "_")}_frontier`
|
|
11039
11039
|
);
|
|
11040
11040
|
}
|
|
11041
11041
|
async function countWorkingTableRows(context) {
|
|
11042
11042
|
const rows = await context.backend.execute(
|
|
11043
|
-
|
|
11043
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
11044
11044
|
SELECT COUNT(*) AS count
|
|
11045
11045
|
FROM ${context.workingTable}
|
|
11046
11046
|
WHERE graph_id = ${context.graphId} AND run_id = ${context.runId}
|
|
@@ -11101,12 +11101,12 @@ async function runIterativeGraphOperation(ctx, options, plan) {
|
|
|
11101
11101
|
const transactionOptions = {
|
|
11102
11102
|
isolationLevel: "repeatable_read",
|
|
11103
11103
|
accessMode: "read_only",
|
|
11104
|
-
temporaryWrites:
|
|
11104
|
+
temporaryWrites: chunkQYDUCWD2_cjs.INTERNAL_TEMPORARY_WRITES
|
|
11105
11105
|
};
|
|
11106
11106
|
return ctx.backend.transaction(async (backend) => {
|
|
11107
11107
|
const temporaryBackend = requireTemporaryStatements(backend);
|
|
11108
|
-
const runId =
|
|
11109
|
-
const workingTable =
|
|
11108
|
+
const runId = chunkUCHW2MGP_cjs.generateId();
|
|
11109
|
+
const workingTable = chunkYX3H63VV_cjs.sql.identifier(
|
|
11110
11110
|
`typegraph_iterative_${runId.replaceAll("-", "_")}`
|
|
11111
11111
|
);
|
|
11112
11112
|
const context = {
|
|
@@ -11117,7 +11117,7 @@ async function runIterativeGraphOperation(ctx, options, plan) {
|
|
|
11117
11117
|
runId,
|
|
11118
11118
|
executeTemporary: async (query) => {
|
|
11119
11119
|
await temporaryBackend.executeTemporaryStatement(
|
|
11120
|
-
|
|
11120
|
+
chunkYX3H63VV_cjs.asCompiledTemporaryStatementSql(query)
|
|
11121
11121
|
);
|
|
11122
11122
|
}
|
|
11123
11123
|
};
|
|
@@ -11181,7 +11181,7 @@ async function refreshWorkingTableStatistics(context, workingTableSize, analyzed
|
|
|
11181
11181
|
async function dropWorkingTable(context, hasPrimaryFailure) {
|
|
11182
11182
|
try {
|
|
11183
11183
|
await context.executeTemporary(
|
|
11184
|
-
|
|
11184
|
+
chunkYX3H63VV_cjs.sql`DROP TABLE IF EXISTS ${context.workingTable}`
|
|
11185
11185
|
);
|
|
11186
11186
|
} catch (cleanupError) {
|
|
11187
11187
|
if (!hasPrimaryFailure) throw cleanupError;
|
|
@@ -11203,9 +11203,9 @@ async function cleanupWorkingTables(context, cleanup, operationFailure) {
|
|
|
11203
11203
|
async function fetchVisibleWorkingNodes(operation, nodeIds) {
|
|
11204
11204
|
const nodes = /* @__PURE__ */ new Map();
|
|
11205
11205
|
for (const chunk2 of chunkValues(nodeIds, operation.maxWorkingSetSize)) {
|
|
11206
|
-
const query =
|
|
11206
|
+
const query = chunkYX3H63VV_cjs.sql`SELECT n.id, n.kind FROM ${operation.schema.nodesTable} n WHERE n.graph_id = ${operation.ctx.graphId} AND n.id IN (${chunkUCHW2MGP_cjs.sqlValueList(chunk2)}) AND ${operation.nodeTemporalFilter}`;
|
|
11207
11207
|
const rows = await operation.backend.execute(
|
|
11208
|
-
|
|
11208
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(query)
|
|
11209
11209
|
);
|
|
11210
11210
|
for (const row of rows) nodes.set(nodeIdentityKey(row), row);
|
|
11211
11211
|
}
|
|
@@ -11218,7 +11218,7 @@ async function reduceExpandedWorkingSet(operation, workingSet, direction, reduce
|
|
|
11218
11218
|
for (const edgeKinds of operation.edgeKindChunks) {
|
|
11219
11219
|
for (const chunk2 of chunkValues(workingSet, operation.maxWorkingSetSize)) {
|
|
11220
11220
|
const rows = await operation.backend.execute(
|
|
11221
|
-
|
|
11221
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(
|
|
11222
11222
|
compileExpansionQuery(operation, chunk2, direction, edgeKinds)
|
|
11223
11223
|
)
|
|
11224
11224
|
);
|
|
@@ -11278,23 +11278,23 @@ function fieldsForDirection(direction) {
|
|
|
11278
11278
|
}
|
|
11279
11279
|
}
|
|
11280
11280
|
function compileDirectionUnion(direction, compileDirection) {
|
|
11281
|
-
return
|
|
11281
|
+
return chunkYX3H63VV_cjs.sql.join(
|
|
11282
11282
|
fieldsForDirection(direction).map((fields) => compileDirection(fields)),
|
|
11283
|
-
|
|
11283
|
+
chunkYX3H63VV_cjs.sql` UNION ALL `
|
|
11284
11284
|
);
|
|
11285
11285
|
}
|
|
11286
11286
|
function compileExpansionQuery(operation, workingSet, direction, edgeKinds) {
|
|
11287
|
-
const workingValues =
|
|
11288
|
-
workingSet.map((node) =>
|
|
11289
|
-
|
|
11287
|
+
const workingValues = chunkYX3H63VV_cjs.sql.join(
|
|
11288
|
+
workingSet.map((node) => chunkYX3H63VV_cjs.sql`(${node.id}, ${node.kind})`),
|
|
11289
|
+
chunkYX3H63VV_cjs.sql`, `
|
|
11290
11290
|
);
|
|
11291
|
-
const workingCte =
|
|
11291
|
+
const workingCte = chunkYX3H63VV_cjs.sql`WITH working_set(node_id, node_kind) AS (VALUES ${workingValues})`;
|
|
11292
11292
|
const expansion = compileDirectionUnion(
|
|
11293
11293
|
direction,
|
|
11294
11294
|
(fields) => compileDirectionalExpansion(
|
|
11295
11295
|
operation,
|
|
11296
|
-
|
|
11297
|
-
|
|
11296
|
+
chunkYX3H63VV_cjs.sql`working_set`,
|
|
11297
|
+
chunkYX3H63VV_cjs.sql`TRUE`,
|
|
11298
11298
|
edgeKinds,
|
|
11299
11299
|
fields.joinField,
|
|
11300
11300
|
fields.joinKindField,
|
|
@@ -11302,7 +11302,7 @@ function compileExpansionQuery(operation, workingSet, direction, edgeKinds) {
|
|
|
11302
11302
|
fields.targetKindField
|
|
11303
11303
|
)
|
|
11304
11304
|
);
|
|
11305
|
-
return
|
|
11305
|
+
return chunkYX3H63VV_cjs.sql`${workingCte} ${expansion}`;
|
|
11306
11306
|
}
|
|
11307
11307
|
function compileWorkingTableExpansion(operation, workingTable, sourceFilter, direction, edgeKinds) {
|
|
11308
11308
|
return compileDirectionUnion(
|
|
@@ -11346,14 +11346,14 @@ function compileDirectionalExpansion(operation, workingRelation, sourceFilter, e
|
|
|
11346
11346
|
targetField,
|
|
11347
11347
|
targetKindField
|
|
11348
11348
|
);
|
|
11349
|
-
const weightColumn = operation.weightExpression === void 0 ?
|
|
11350
|
-
return
|
|
11349
|
+
const weightColumn = operation.weightExpression === void 0 ? chunkYX3H63VV_cjs.sql`` : chunkYX3H63VV_cjs.sql`, expanded.weight`;
|
|
11350
|
+
return chunkYX3H63VV_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}`;
|
|
11351
11351
|
}
|
|
11352
11352
|
function compileDirectionalEdgeExpansion(operation, workingRelation, sourceFilter, edgeKinds, joinField, joinKindField, targetField, targetKindField, sourceProjection) {
|
|
11353
|
-
const edgeKindFilter =
|
|
11354
|
-
const weightColumn = operation.weightExpression === void 0 ?
|
|
11355
|
-
const sourceColumns = sourceProjection === void 0 ?
|
|
11356
|
-
return
|
|
11353
|
+
const edgeKindFilter = chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("e.kind"), edgeKinds);
|
|
11354
|
+
const weightColumn = operation.weightExpression === void 0 ? chunkYX3H63VV_cjs.sql`` : chunkYX3H63VV_cjs.sql`, ${operation.weightExpression} AS weight`;
|
|
11355
|
+
const sourceColumns = sourceProjection === void 0 ? chunkYX3H63VV_cjs.sql`` : chunkYX3H63VV_cjs.sql`, ${sourceProjection}`;
|
|
11356
|
+
return chunkYX3H63VV_cjs.sql`SELECT w.node_id AS source_id, w.node_kind AS source_kind${sourceColumns}, e.${chunkYX3H63VV_cjs.sql.raw(targetField)} AS target_id, e.${chunkYX3H63VV_cjs.sql.raw(targetKindField)} AS target_kind${weightColumn} FROM ${workingRelation} w JOIN ${operation.schema.edgesTable} e ON e.${chunkYX3H63VV_cjs.sql.raw(joinField)} = w.node_id AND e.${chunkYX3H63VV_cjs.sql.raw(joinKindField)} = w.node_kind AND e.graph_id = ${operation.ctx.graphId} WHERE ${sourceFilter} AND ${edgeKindFilter} AND ${operation.edgeTemporalFilter}`;
|
|
11357
11357
|
}
|
|
11358
11358
|
function chunkValues(values, chunkSize) {
|
|
11359
11359
|
const chunks = [];
|
|
@@ -11364,15 +11364,15 @@ function chunkValues(values, chunkSize) {
|
|
|
11364
11364
|
}
|
|
11365
11365
|
function createOperation(ctx, options, backend) {
|
|
11366
11366
|
const temporal = resolveTemporalOptions(ctx, options);
|
|
11367
|
-
const currentTimestamp =
|
|
11368
|
-
const nodeTemporalFilter =
|
|
11367
|
+
const currentTimestamp = chunkUCHW2MGP_cjs.currentReadInstant();
|
|
11368
|
+
const nodeTemporalFilter = chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
11369
11369
|
mode: temporal.temporalMode,
|
|
11370
11370
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
11371
11371
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
11372
11372
|
tableAlias: "n",
|
|
11373
11373
|
currentTimestamp
|
|
11374
11374
|
});
|
|
11375
|
-
const edgeTemporalFilter =
|
|
11375
|
+
const edgeTemporalFilter = chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
11376
11376
|
mode: temporal.temporalMode,
|
|
11377
11377
|
...temporal.asOf === void 0 ? {} : { asOf: temporal.asOf },
|
|
11378
11378
|
...temporal.recordedAsOf === void 0 ? {} : { recordedAsOf: temporal.recordedAsOf },
|
|
@@ -11430,10 +11430,10 @@ function createOperation(ctx, options, backend) {
|
|
|
11430
11430
|
}
|
|
11431
11431
|
function compileWeightExpression(dialect, weightProperty, defaultWeight) {
|
|
11432
11432
|
const extracted = dialect.jsonExtractDouble(
|
|
11433
|
-
|
|
11433
|
+
chunkYX3H63VV_cjs.sql.raw("e.props"),
|
|
11434
11434
|
chunkTDXIBCGY_cjs.jsonPointer([weightProperty])
|
|
11435
11435
|
);
|
|
11436
|
-
return defaultWeight === void 0 ? extracted :
|
|
11436
|
+
return defaultWeight === void 0 ? extracted : chunkYX3H63VV_cjs.sql`COALESCE(${extracted}, ${defaultWeight})`;
|
|
11437
11437
|
}
|
|
11438
11438
|
function supportsTemporaryIteration(ctx) {
|
|
11439
11439
|
return ctx.backend.capabilities.transactions && ctx.backend.capabilities.graphAnalytics?.supported !== false && ctx.backend.capabilities.returning !== false && ctx.backend.executeTemporaryStatement !== void 0;
|
|
@@ -11517,7 +11517,7 @@ function createOscillationDetector() {
|
|
|
11517
11517
|
};
|
|
11518
11518
|
}
|
|
11519
11519
|
function createWorkingTable(context) {
|
|
11520
|
-
return
|
|
11520
|
+
return chunkYX3H63VV_cjs.sql`
|
|
11521
11521
|
CREATE TEMP TABLE ${context.workingTable} (
|
|
11522
11522
|
graph_id TEXT NOT NULL,
|
|
11523
11523
|
run_id TEXT NOT NULL,
|
|
@@ -11534,19 +11534,19 @@ function createWorkingTable(context) {
|
|
|
11534
11534
|
`;
|
|
11535
11535
|
}
|
|
11536
11536
|
function neighborTableIdentifier(context) {
|
|
11537
|
-
return
|
|
11537
|
+
return chunkYX3H63VV_cjs.sql.identifier(
|
|
11538
11538
|
`typegraph_iterative_n_${context.runId.replaceAll("-", "_")}`
|
|
11539
11539
|
);
|
|
11540
11540
|
}
|
|
11541
11541
|
function activeIndexIdentifier(context) {
|
|
11542
|
-
return
|
|
11542
|
+
return chunkYX3H63VV_cjs.sql.identifier(
|
|
11543
11543
|
`typegraph_iterative_a_${context.runId.replaceAll("-", "_")}`
|
|
11544
11544
|
);
|
|
11545
11545
|
}
|
|
11546
11546
|
async function initializeWorkingTables(context, nodeKinds) {
|
|
11547
11547
|
const { operation, workingTable, graphId, runId } = context;
|
|
11548
11548
|
const nodeKindFilter = compileNodeKindSeedFilter(nodeKinds);
|
|
11549
|
-
await context.executeTemporary(
|
|
11549
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11550
11550
|
INSERT INTO ${workingTable}
|
|
11551
11551
|
(graph_id, run_id, node_id, node_kind, label_id, label_kind,
|
|
11552
11552
|
next_label_id, next_label_kind, changed_round, active_round)
|
|
@@ -11557,16 +11557,16 @@ async function initializeWorkingTables(context, nodeKinds) {
|
|
|
11557
11557
|
AND ${nodeKindFilter}
|
|
11558
11558
|
AND ${operation.nodeTemporalFilter}
|
|
11559
11559
|
`);
|
|
11560
|
-
await context.executeTemporary(
|
|
11560
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11561
11561
|
CREATE INDEX ${frontierIndexIdentifier(context)}
|
|
11562
11562
|
ON ${workingTable} (graph_id, run_id, changed_round)
|
|
11563
11563
|
`);
|
|
11564
|
-
await context.executeTemporary(
|
|
11564
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11565
11565
|
CREATE INDEX ${activeIndexIdentifier(context)}
|
|
11566
11566
|
ON ${workingTable} (graph_id, run_id, active_round)
|
|
11567
11567
|
`);
|
|
11568
11568
|
const neighborTable = neighborTableIdentifier(context);
|
|
11569
|
-
await context.executeTemporary(
|
|
11569
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11570
11570
|
CREATE TEMP TABLE ${neighborTable} (
|
|
11571
11571
|
target_id TEXT NOT NULL,
|
|
11572
11572
|
target_kind TEXT NOT NULL,
|
|
@@ -11627,7 +11627,7 @@ function resolveOscillation(state, iteration, policy) {
|
|
|
11627
11627
|
async function markActiveNeighbors(context, iteration) {
|
|
11628
11628
|
const { workingTable, graphId, runId } = context;
|
|
11629
11629
|
const neighborTable = neighborTableIdentifier(context);
|
|
11630
|
-
await context.executeTemporary(
|
|
11630
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11631
11631
|
WITH candidates AS (
|
|
11632
11632
|
SELECT DISTINCT neighbors.neighbor_id, neighbors.neighbor_kind
|
|
11633
11633
|
FROM ${workingTable} changed
|
|
@@ -11652,7 +11652,7 @@ async function materializeChunkNeighbors(context, edgeKinds) {
|
|
|
11652
11652
|
const expansion = compileWorkingTableEdgeExpansion(
|
|
11653
11653
|
operation,
|
|
11654
11654
|
workingTable,
|
|
11655
|
-
|
|
11655
|
+
chunkYX3H63VV_cjs.sql`
|
|
11656
11656
|
w.graph_id = ${graphId}
|
|
11657
11657
|
AND w.run_id = ${runId}
|
|
11658
11658
|
`,
|
|
@@ -11660,7 +11660,7 @@ async function materializeChunkNeighbors(context, edgeKinds) {
|
|
|
11660
11660
|
edgeKinds
|
|
11661
11661
|
);
|
|
11662
11662
|
const neighborTable = neighborTableIdentifier(context);
|
|
11663
|
-
await context.executeTemporary(
|
|
11663
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11664
11664
|
INSERT INTO ${neighborTable}
|
|
11665
11665
|
(target_id, target_kind, neighbor_id, neighbor_kind)
|
|
11666
11666
|
SELECT DISTINCT
|
|
@@ -11683,11 +11683,11 @@ async function materializeChunkNeighbors(context, edgeKinds) {
|
|
|
11683
11683
|
async function selectWinningLabels(context, iteration) {
|
|
11684
11684
|
const { operation, workingTable, graphId, runId } = context;
|
|
11685
11685
|
const neighborTable = neighborTableIdentifier(context);
|
|
11686
|
-
const targetId = operation.ctx.dialect.binaryText(
|
|
11687
|
-
const targetKind = operation.ctx.dialect.binaryText(
|
|
11688
|
-
const labelId = operation.ctx.dialect.binaryText(
|
|
11689
|
-
const labelKind = operation.ctx.dialect.binaryText(
|
|
11690
|
-
await context.executeTemporary(
|
|
11686
|
+
const targetId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`totals.target_id`);
|
|
11687
|
+
const targetKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`totals.target_kind`);
|
|
11688
|
+
const labelId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`totals.label_id`);
|
|
11689
|
+
const labelKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`totals.label_kind`);
|
|
11690
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11691
11691
|
WITH totals AS (
|
|
11692
11692
|
SELECT
|
|
11693
11693
|
neighbors.target_id,
|
|
@@ -11742,7 +11742,7 @@ async function selectWinningLabels(context, iteration) {
|
|
|
11742
11742
|
}
|
|
11743
11743
|
function applyNextLabels(context, iteration) {
|
|
11744
11744
|
return context.backend.execute(
|
|
11745
|
-
|
|
11745
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
11746
11746
|
UPDATE ${context.workingTable}
|
|
11747
11747
|
SET label_id = next_label_id,
|
|
11748
11748
|
label_kind = next_label_kind,
|
|
@@ -11759,12 +11759,12 @@ function applyNextLabels(context, iteration) {
|
|
|
11759
11759
|
}
|
|
11760
11760
|
async function extractMemberships(context) {
|
|
11761
11761
|
const { operation } = context;
|
|
11762
|
-
const labelId = operation.ctx.dialect.binaryText(
|
|
11763
|
-
const labelKind = operation.ctx.dialect.binaryText(
|
|
11764
|
-
const nodeId = operation.ctx.dialect.binaryText(
|
|
11765
|
-
const nodeKind = operation.ctx.dialect.binaryText(
|
|
11762
|
+
const labelId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`label_id`);
|
|
11763
|
+
const labelKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`label_kind`);
|
|
11764
|
+
const nodeId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`node_id`);
|
|
11765
|
+
const nodeKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`node_kind`);
|
|
11766
11766
|
const rows = await context.backend.execute(
|
|
11767
|
-
|
|
11767
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
11768
11768
|
SELECT
|
|
11769
11769
|
node_id,
|
|
11770
11770
|
node_kind,
|
|
@@ -11784,7 +11784,7 @@ async function extractMemberships(context) {
|
|
|
11784
11784
|
}
|
|
11785
11785
|
async function dropNeighborTable(context) {
|
|
11786
11786
|
await context.executeTemporary(
|
|
11787
|
-
|
|
11787
|
+
chunkYX3H63VV_cjs.sql`DROP TABLE IF EXISTS ${neighborTableIdentifier(context)}`
|
|
11788
11788
|
);
|
|
11789
11789
|
}
|
|
11790
11790
|
|
|
@@ -11903,7 +11903,7 @@ function normalizeSeeds(seeds) {
|
|
|
11903
11903
|
}).toSorted((left, right) => compareNodeIdentity(left, right));
|
|
11904
11904
|
}
|
|
11905
11905
|
function createWorkingTable2(context) {
|
|
11906
|
-
return
|
|
11906
|
+
return chunkYX3H63VV_cjs.sql`
|
|
11907
11907
|
CREATE TEMP TABLE ${context.workingTable} (
|
|
11908
11908
|
graph_id TEXT NOT NULL,
|
|
11909
11909
|
run_id TEXT NOT NULL,
|
|
@@ -11920,7 +11920,7 @@ function createWorkingTable2(context) {
|
|
|
11920
11920
|
async function initializeWorkingTable(context, nodeKinds, seeds) {
|
|
11921
11921
|
const { operation, workingTable, graphId, runId } = context;
|
|
11922
11922
|
const nodeKindFilter = compileNodeKindSeedFilter(nodeKinds);
|
|
11923
|
-
await context.executeTemporary(
|
|
11923
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11924
11924
|
INSERT INTO ${workingTable}
|
|
11925
11925
|
(graph_id, run_id, node_id, node_kind, score, next_score,
|
|
11926
11926
|
personalization, out_weight)
|
|
@@ -11943,7 +11943,7 @@ async function initializeWorkingTable(context, nodeKinds, seeds) {
|
|
|
11943
11943
|
}
|
|
11944
11944
|
if (seeds === void 0) {
|
|
11945
11945
|
const uniformWeight = 1 / workingTableSize;
|
|
11946
|
-
await context.executeTemporary(
|
|
11946
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11947
11947
|
UPDATE ${workingTable}
|
|
11948
11948
|
SET score = ${uniformWeight},
|
|
11949
11949
|
personalization = ${uniformWeight}
|
|
@@ -11974,13 +11974,13 @@ async function initializePersonalization(context, seeds) {
|
|
|
11974
11974
|
}
|
|
11975
11975
|
for (let offset = 0; offset < seeds.length; offset += seedChunkSize) {
|
|
11976
11976
|
const chunk2 = seeds.slice(offset, offset + seedChunkSize);
|
|
11977
|
-
const values =
|
|
11977
|
+
const values = chunkYX3H63VV_cjs.sql.join(
|
|
11978
11978
|
chunk2.map(
|
|
11979
|
-
(seed) =>
|
|
11979
|
+
(seed) => chunkYX3H63VV_cjs.sql`(${seed.id}, ${seed.kind}, CAST(${seed.weight} AS DOUBLE PRECISION))`
|
|
11980
11980
|
),
|
|
11981
|
-
|
|
11981
|
+
chunkYX3H63VV_cjs.sql`, `
|
|
11982
11982
|
);
|
|
11983
|
-
await context.executeTemporary(
|
|
11983
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
11984
11984
|
WITH seed_values(node_id, node_kind, weight) AS (VALUES ${values})
|
|
11985
11985
|
UPDATE ${context.workingTable} AS target
|
|
11986
11986
|
SET score = seed_values.weight,
|
|
@@ -11993,7 +11993,7 @@ async function initializePersonalization(context, seeds) {
|
|
|
11993
11993
|
`);
|
|
11994
11994
|
}
|
|
11995
11995
|
const matchedRows = await context.backend.execute(
|
|
11996
|
-
|
|
11996
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
11997
11997
|
SELECT node_id, node_kind
|
|
11998
11998
|
FROM ${context.workingTable}
|
|
11999
11999
|
WHERE graph_id = ${context.graphId}
|
|
@@ -12020,12 +12020,12 @@ async function accumulateOutWeights(context, edgeKinds) {
|
|
|
12020
12020
|
const expansion = compileWorkingTableEdgeExpansion(
|
|
12021
12021
|
operation,
|
|
12022
12022
|
workingTable,
|
|
12023
|
-
|
|
12023
|
+
chunkYX3H63VV_cjs.sql`w.graph_id = ${graphId} AND w.run_id = ${runId}`,
|
|
12024
12024
|
operation.direction,
|
|
12025
12025
|
edgeKinds
|
|
12026
12026
|
);
|
|
12027
12027
|
const transitionWeight = compileTransitionWeight(operation.direction);
|
|
12028
|
-
await context.executeTemporary(
|
|
12028
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
12029
12029
|
WITH scoped_edges AS (
|
|
12030
12030
|
SELECT
|
|
12031
12031
|
expanded.source_id,
|
|
@@ -12052,8 +12052,8 @@ async function accumulateOutWeights(context, edgeKinds) {
|
|
|
12052
12052
|
`);
|
|
12053
12053
|
}
|
|
12054
12054
|
function compileTransitionWeight(direction) {
|
|
12055
|
-
if (direction !== "both") return
|
|
12056
|
-
return
|
|
12055
|
+
if (direction !== "both") return chunkYX3H63VV_cjs.sql`1.0`;
|
|
12056
|
+
return chunkYX3H63VV_cjs.sql`
|
|
12057
12057
|
CASE
|
|
12058
12058
|
WHEN expanded.source_id = expanded.target_id
|
|
12059
12059
|
AND expanded.source_kind = expanded.target_kind
|
|
@@ -12092,9 +12092,9 @@ async function runPowerIterationRound(context, state, dampingFactor) {
|
|
|
12092
12092
|
};
|
|
12093
12093
|
}
|
|
12094
12094
|
async function resetTargetScores(context, sourceScoreColumn, targetScoreColumn, dampingFactor) {
|
|
12095
|
-
const sourceScore =
|
|
12096
|
-
const targetScore =
|
|
12097
|
-
await context.executeTemporary(
|
|
12095
|
+
const sourceScore = chunkYX3H63VV_cjs.sql.identifier(sourceScoreColumn);
|
|
12096
|
+
const targetScore = chunkYX3H63VV_cjs.sql.identifier(targetScoreColumn);
|
|
12097
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
12098
12098
|
UPDATE ${context.workingTable}
|
|
12099
12099
|
SET ${targetScore} = personalization * (
|
|
12100
12100
|
${1 - dampingFactor} + ${dampingFactor} * (
|
|
@@ -12110,18 +12110,18 @@ async function resetTargetScores(context, sourceScoreColumn, targetScoreColumn,
|
|
|
12110
12110
|
}
|
|
12111
12111
|
async function accumulateContributions(context, edgeKinds, dampingFactor, sourceScoreColumn, targetScoreColumn) {
|
|
12112
12112
|
const { operation, workingTable, graphId, runId } = context;
|
|
12113
|
-
const sourceScore =
|
|
12114
|
-
const targetScore =
|
|
12113
|
+
const sourceScore = chunkYX3H63VV_cjs.sql.identifier(sourceScoreColumn);
|
|
12114
|
+
const targetScore = chunkYX3H63VV_cjs.sql.identifier(targetScoreColumn);
|
|
12115
12115
|
const expansion = compileWorkingTableEdgeExpansion(
|
|
12116
12116
|
operation,
|
|
12117
12117
|
workingTable,
|
|
12118
|
-
|
|
12118
|
+
chunkYX3H63VV_cjs.sql`w.graph_id = ${graphId} AND w.run_id = ${runId}`,
|
|
12119
12119
|
operation.direction,
|
|
12120
12120
|
edgeKinds,
|
|
12121
|
-
|
|
12121
|
+
chunkYX3H63VV_cjs.sql`w.${sourceScore} AS source_score, w.out_weight AS source_out_weight`
|
|
12122
12122
|
);
|
|
12123
12123
|
const transitionWeight = compileTransitionWeight(operation.direction);
|
|
12124
|
-
await context.executeTemporary(
|
|
12124
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
12125
12125
|
WITH scoped_edges AS (
|
|
12126
12126
|
SELECT
|
|
12127
12127
|
expanded.target_id,
|
|
@@ -12154,10 +12154,10 @@ async function accumulateContributions(context, edgeKinds, dampingFactor, source
|
|
|
12154
12154
|
`);
|
|
12155
12155
|
}
|
|
12156
12156
|
async function readMaximumChange(context, sourceScoreColumn, targetScoreColumn) {
|
|
12157
|
-
const sourceScore =
|
|
12158
|
-
const targetScore =
|
|
12157
|
+
const sourceScore = chunkYX3H63VV_cjs.sql.identifier(sourceScoreColumn);
|
|
12158
|
+
const targetScore = chunkYX3H63VV_cjs.sql.identifier(targetScoreColumn);
|
|
12159
12159
|
const rows = await context.backend.execute(
|
|
12160
|
-
|
|
12160
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12161
12161
|
SELECT COALESCE(MAX(ABS(${targetScore} - ${sourceScore})), 0.0) AS value
|
|
12162
12162
|
FROM ${context.workingTable}
|
|
12163
12163
|
WHERE graph_id = ${context.graphId} AND run_id = ${context.runId}
|
|
@@ -12166,11 +12166,11 @@ async function readMaximumChange(context, sourceScoreColumn, targetScoreColumn)
|
|
|
12166
12166
|
return Number(rows[0]?.value ?? 0);
|
|
12167
12167
|
}
|
|
12168
12168
|
async function extractScores(context, state) {
|
|
12169
|
-
const score =
|
|
12170
|
-
const nodeId = context.operation.ctx.dialect.binaryText(
|
|
12171
|
-
const nodeKind = context.operation.ctx.dialect.binaryText(
|
|
12169
|
+
const score = chunkYX3H63VV_cjs.sql.identifier(state.activeScoreColumn);
|
|
12170
|
+
const nodeId = context.operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`node_id`);
|
|
12171
|
+
const nodeKind = context.operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`node_kind`);
|
|
12172
12172
|
const rows = await context.backend.execute(
|
|
12173
|
-
|
|
12173
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12174
12174
|
SELECT node_id, node_kind, ${score} AS score
|
|
12175
12175
|
FROM ${context.workingTable}
|
|
12176
12176
|
WHERE graph_id = ${context.graphId} AND run_id = ${context.runId}
|
|
@@ -12301,7 +12301,7 @@ async function findShortestPathInWorkingTable(ctx, sourceId, targetId, maxHops,
|
|
|
12301
12301
|
});
|
|
12302
12302
|
}
|
|
12303
12303
|
function createWorkingTable3(context) {
|
|
12304
|
-
return
|
|
12304
|
+
return chunkYX3H63VV_cjs.sql`
|
|
12305
12305
|
CREATE TEMP TABLE ${context.workingTable} (
|
|
12306
12306
|
graph_id TEXT NOT NULL,
|
|
12307
12307
|
run_id TEXT NOT NULL,
|
|
@@ -12319,7 +12319,7 @@ function createWorkingTable3(context) {
|
|
|
12319
12319
|
async function seedWorkingSide(context, nodeId, side) {
|
|
12320
12320
|
const { operation, workingTable, graphId, runId } = context;
|
|
12321
12321
|
return context.backend.execute(
|
|
12322
|
-
|
|
12322
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12323
12323
|
INSERT INTO ${workingTable}
|
|
12324
12324
|
(graph_id, run_id, side, node_id, node_kind, depth,
|
|
12325
12325
|
predecessor_id, predecessor_kind)
|
|
@@ -12354,12 +12354,12 @@ async function expandWorkingTableRound(context, side, currentDepth, nextDepth, d
|
|
|
12354
12354
|
let insertedCount = 0;
|
|
12355
12355
|
let meeting;
|
|
12356
12356
|
const { dialect } = context.operation.ctx;
|
|
12357
|
-
const targetKind = dialect.binaryText(
|
|
12358
|
-
const targetId = dialect.binaryText(
|
|
12359
|
-
const sourceId = dialect.binaryText(
|
|
12360
|
-
const sourceKind = dialect.binaryText(
|
|
12357
|
+
const targetKind = dialect.binaryText(chunkYX3H63VV_cjs.sql`expanded.target_kind`);
|
|
12358
|
+
const targetId = dialect.binaryText(chunkYX3H63VV_cjs.sql`expanded.target_id`);
|
|
12359
|
+
const sourceId = dialect.binaryText(chunkYX3H63VV_cjs.sql`expanded.source_id`);
|
|
12360
|
+
const sourceKind = dialect.binaryText(chunkYX3H63VV_cjs.sql`expanded.source_kind`);
|
|
12361
12361
|
for (const edgeKinds of context.operation.edgeKindChunks) {
|
|
12362
|
-
const sourceFilter =
|
|
12362
|
+
const sourceFilter = chunkYX3H63VV_cjs.sql`
|
|
12363
12363
|
w.graph_id = ${context.graphId}
|
|
12364
12364
|
AND w.run_id = ${context.runId}
|
|
12365
12365
|
AND w.side = ${side}
|
|
@@ -12373,7 +12373,7 @@ async function expandWorkingTableRound(context, side, currentDepth, nextDepth, d
|
|
|
12373
12373
|
edgeKinds
|
|
12374
12374
|
);
|
|
12375
12375
|
const rows = await context.backend.execute(
|
|
12376
|
-
|
|
12376
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12377
12377
|
INSERT INTO ${context.workingTable}
|
|
12378
12378
|
(graph_id, run_id, side, node_id, node_kind, depth,
|
|
12379
12379
|
predecessor_id, predecessor_kind, meeting_depth)
|
|
@@ -12439,7 +12439,7 @@ function selectRoundMeeting(currentMeeting, rows, nextDepth, maxHops) {
|
|
|
12439
12439
|
async function expandReachableWorkingTableRound(context, side, currentDepth, nextDepth, direction) {
|
|
12440
12440
|
let insertedCount = 0;
|
|
12441
12441
|
for (const edgeKinds of context.operation.edgeKindChunks) {
|
|
12442
|
-
const sourceFilter =
|
|
12442
|
+
const sourceFilter = chunkYX3H63VV_cjs.sql`
|
|
12443
12443
|
w.graph_id = ${context.graphId}
|
|
12444
12444
|
AND w.run_id = ${context.runId}
|
|
12445
12445
|
AND w.side = ${side}
|
|
@@ -12453,7 +12453,7 @@ async function expandReachableWorkingTableRound(context, side, currentDepth, nex
|
|
|
12453
12453
|
edgeKinds
|
|
12454
12454
|
);
|
|
12455
12455
|
const rows = await context.backend.execute(
|
|
12456
|
-
|
|
12456
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12457
12457
|
INSERT INTO ${context.workingTable}
|
|
12458
12458
|
(graph_id, run_id, side, node_id, node_kind, depth,
|
|
12459
12459
|
predecessor_id, predecessor_kind)
|
|
@@ -12488,9 +12488,9 @@ async function expandReachableWorkingTableRound(context, side, currentDepth, nex
|
|
|
12488
12488
|
return insertedCount;
|
|
12489
12489
|
}
|
|
12490
12490
|
async function readWorkingRows(context, side) {
|
|
12491
|
-
const sideFilter = side === void 0 ?
|
|
12491
|
+
const sideFilter = side === void 0 ? chunkYX3H63VV_cjs.sql`TRUE` : chunkYX3H63VV_cjs.sql`side = ${side}`;
|
|
12492
12492
|
return context.backend.execute(
|
|
12493
|
-
|
|
12493
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12494
12494
|
SELECT side, node_id, node_kind, depth,
|
|
12495
12495
|
predecessor_id, predecessor_kind
|
|
12496
12496
|
FROM ${context.workingTable}
|
|
@@ -12777,7 +12777,7 @@ async function executeWeaklyConnectedComponents(ctx, options) {
|
|
|
12777
12777
|
});
|
|
12778
12778
|
}
|
|
12779
12779
|
function createWorkingTable4(context) {
|
|
12780
|
-
return
|
|
12780
|
+
return chunkYX3H63VV_cjs.sql`
|
|
12781
12781
|
CREATE TEMP TABLE ${context.workingTable} (
|
|
12782
12782
|
graph_id TEXT NOT NULL,
|
|
12783
12783
|
run_id TEXT NOT NULL,
|
|
@@ -12795,7 +12795,7 @@ function createWorkingTable4(context) {
|
|
|
12795
12795
|
async function initializeWorkingTable2(context, nodeKinds) {
|
|
12796
12796
|
const { operation, workingTable, graphId, runId } = context;
|
|
12797
12797
|
const nodeKindFilter = compileNodeKindSeedFilter(nodeKinds);
|
|
12798
|
-
await context.executeTemporary(
|
|
12798
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
12799
12799
|
INSERT INTO ${workingTable}
|
|
12800
12800
|
(graph_id, run_id, node_id, node_kind, label_id, label_kind,
|
|
12801
12801
|
next_label_id, next_label_kind, improved_round)
|
|
@@ -12806,7 +12806,7 @@ async function initializeWorkingTable2(context, nodeKinds) {
|
|
|
12806
12806
|
AND ${nodeKindFilter}
|
|
12807
12807
|
AND ${operation.nodeTemporalFilter}
|
|
12808
12808
|
`);
|
|
12809
|
-
await context.executeTemporary(
|
|
12809
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
12810
12810
|
CREATE INDEX ${frontierIndexIdentifier(context)}
|
|
12811
12811
|
ON ${workingTable} (graph_id, run_id, improved_round)
|
|
12812
12812
|
`);
|
|
@@ -12828,28 +12828,28 @@ async function propagateChunkLabels(context, edgeKinds, iteration) {
|
|
|
12828
12828
|
const expansion = compileWorkingTableEdgeExpansion(
|
|
12829
12829
|
operation,
|
|
12830
12830
|
workingTable,
|
|
12831
|
-
|
|
12831
|
+
chunkYX3H63VV_cjs.sql`
|
|
12832
12832
|
w.graph_id = ${graphId}
|
|
12833
12833
|
AND w.run_id = ${runId}
|
|
12834
12834
|
AND w.improved_round = ${iteration - 1}
|
|
12835
12835
|
`,
|
|
12836
12836
|
"both",
|
|
12837
12837
|
edgeKinds,
|
|
12838
|
-
|
|
12838
|
+
chunkYX3H63VV_cjs.sql`w.label_id AS source_label_id, w.label_kind AS source_label_kind`
|
|
12839
12839
|
);
|
|
12840
|
-
const candidateId = operation.ctx.dialect.binaryText(
|
|
12840
|
+
const candidateId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`ranked.label_id`);
|
|
12841
12841
|
const candidateKind = operation.ctx.dialect.binaryText(
|
|
12842
|
-
|
|
12842
|
+
chunkYX3H63VV_cjs.sql`ranked.label_kind`
|
|
12843
12843
|
);
|
|
12844
|
-
const currentId = operation.ctx.dialect.binaryText(
|
|
12844
|
+
const currentId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`target.next_label_id`);
|
|
12845
12845
|
const currentKind = operation.ctx.dialect.binaryText(
|
|
12846
|
-
|
|
12846
|
+
chunkYX3H63VV_cjs.sql`target.next_label_kind`
|
|
12847
12847
|
);
|
|
12848
|
-
const sourceId = operation.ctx.dialect.binaryText(
|
|
12849
|
-
const sourceKind = operation.ctx.dialect.binaryText(
|
|
12850
|
-
const targetId = operation.ctx.dialect.binaryText(
|
|
12851
|
-
const targetKind = operation.ctx.dialect.binaryText(
|
|
12852
|
-
await context.executeTemporary(
|
|
12848
|
+
const sourceId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`source.label_id`);
|
|
12849
|
+
const sourceKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`source.label_kind`);
|
|
12850
|
+
const targetId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`source.target_id`);
|
|
12851
|
+
const targetKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`source.target_kind`);
|
|
12852
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
12853
12853
|
WITH candidates AS (
|
|
12854
12854
|
SELECT
|
|
12855
12855
|
expanded.target_id,
|
|
@@ -12894,7 +12894,7 @@ async function propagateChunkLabels(context, edgeKinds, iteration) {
|
|
|
12894
12894
|
}
|
|
12895
12895
|
function applyNextLabels2(context, iteration) {
|
|
12896
12896
|
return context.backend.execute(
|
|
12897
|
-
|
|
12897
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12898
12898
|
UPDATE ${context.workingTable}
|
|
12899
12899
|
SET label_id = next_label_id,
|
|
12900
12900
|
label_kind = next_label_kind,
|
|
@@ -12910,12 +12910,12 @@ function applyNextLabels2(context, iteration) {
|
|
|
12910
12910
|
}
|
|
12911
12911
|
async function extractMemberships2(context) {
|
|
12912
12912
|
const { operation } = context;
|
|
12913
|
-
const componentId = operation.ctx.dialect.binaryText(
|
|
12914
|
-
const componentKind = operation.ctx.dialect.binaryText(
|
|
12915
|
-
const nodeId = operation.ctx.dialect.binaryText(
|
|
12916
|
-
const nodeKind = operation.ctx.dialect.binaryText(
|
|
12913
|
+
const componentId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`label_id`);
|
|
12914
|
+
const componentKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`label_kind`);
|
|
12915
|
+
const nodeId = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`node_id`);
|
|
12916
|
+
const nodeKind = operation.ctx.dialect.binaryText(chunkYX3H63VV_cjs.sql`node_kind`);
|
|
12917
12917
|
const rows = await context.backend.execute(
|
|
12918
|
-
|
|
12918
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
12919
12919
|
SELECT
|
|
12920
12920
|
node_id,
|
|
12921
12921
|
node_kind,
|
|
@@ -12989,18 +12989,18 @@ function assertWeightOptions(weightProperty, defaultWeight) {
|
|
|
12989
12989
|
async function assertValidEdgeWeights(operation, weightProperty, defaultWeight) {
|
|
12990
12990
|
const { dialect } = operation.ctx;
|
|
12991
12991
|
const pointer = chunkTDXIBCGY_cjs.jsonPointer([weightProperty]);
|
|
12992
|
-
const propsColumn =
|
|
12992
|
+
const propsColumn = chunkYX3H63VV_cjs.sql.raw("e.props");
|
|
12993
12993
|
const isNumber = dialect.jsonPathIsNumber(propsColumn, pointer);
|
|
12994
12994
|
const isMissing = dialect.jsonPathIsNull(propsColumn, pointer);
|
|
12995
12995
|
const weightText = dialect.jsonExtractText(propsColumn, pointer);
|
|
12996
|
-
const weightNumber =
|
|
12997
|
-
const missingViolation = defaultWeight === void 0 ?
|
|
12998
|
-
const negativeViolation =
|
|
12999
|
-
const outOfRangeViolation =
|
|
12996
|
+
const weightNumber = chunkYX3H63VV_cjs.sql`CASE WHEN ${isNumber} THEN ${dialect.jsonExtractNumber(propsColumn, pointer)} END`;
|
|
12997
|
+
const missingViolation = defaultWeight === void 0 ? chunkYX3H63VV_cjs.sql`audited.is_missing = 1` : dialect.booleanLiteral(false);
|
|
12998
|
+
const negativeViolation = chunkYX3H63VV_cjs.sql`audited.is_number = 1 AND audited.weight_number < 0`;
|
|
12999
|
+
const outOfRangeViolation = chunkYX3H63VV_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)))`;
|
|
13000
13000
|
for (const edgeKinds of operation.edgeKindChunks) {
|
|
13001
|
-
const edgeKindFilter =
|
|
13001
|
+
const edgeKindFilter = chunkUCHW2MGP_cjs.compileKindFilter(chunkYX3H63VV_cjs.sql.raw("e.kind"), edgeKinds);
|
|
13002
13002
|
const rows = await operation.backend.execute(
|
|
13003
|
-
|
|
13003
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
13004
13004
|
SELECT audited.edge_id, audited.edge_kind, audited.weight_text,
|
|
13005
13005
|
audited.is_number, audited.is_missing
|
|
13006
13006
|
FROM (
|
|
@@ -13018,7 +13018,7 @@ async function assertValidEdgeWeights(operation, weightProperty, defaultWeight)
|
|
|
13018
13018
|
OR (audited.is_missing = 0 AND audited.is_number = 0)
|
|
13019
13019
|
OR (${negativeViolation})
|
|
13020
13020
|
OR (${outOfRangeViolation})
|
|
13021
|
-
ORDER BY ${dialect.binaryText(
|
|
13021
|
+
ORDER BY ${dialect.binaryText(chunkYX3H63VV_cjs.sql`audited.edge_id`)}
|
|
13022
13022
|
LIMIT 1
|
|
13023
13023
|
`)
|
|
13024
13024
|
);
|
|
@@ -13072,7 +13072,7 @@ async function findWeightedShortestPathInWorkingTable(ctx, sourceId, targetId, m
|
|
|
13072
13072
|
bestTargetDistance: void 0
|
|
13073
13073
|
};
|
|
13074
13074
|
}
|
|
13075
|
-
await context.executeTemporary(
|
|
13075
|
+
await context.executeTemporary(chunkYX3H63VV_cjs.sql`
|
|
13076
13076
|
CREATE INDEX ${frontierIndexIdentifier(context)}
|
|
13077
13077
|
ON ${context.workingTable} (graph_id, run_id, improved_round)
|
|
13078
13078
|
`);
|
|
@@ -13111,7 +13111,7 @@ async function findWeightedShortestPathInWorkingTable(ctx, sourceId, targetId, m
|
|
|
13111
13111
|
}
|
|
13112
13112
|
async function hasVisibleNode(operation, nodeId) {
|
|
13113
13113
|
const rows = await operation.backend.execute(
|
|
13114
|
-
|
|
13114
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
13115
13115
|
SELECT n.id FROM ${operation.schema.nodesTable} n
|
|
13116
13116
|
WHERE n.graph_id = ${operation.ctx.graphId}
|
|
13117
13117
|
AND n.id = ${nodeId}
|
|
@@ -13122,7 +13122,7 @@ async function hasVisibleNode(operation, nodeId) {
|
|
|
13122
13122
|
return rows.length > 0;
|
|
13123
13123
|
}
|
|
13124
13124
|
function createWorkingTable5(context) {
|
|
13125
|
-
return
|
|
13125
|
+
return chunkYX3H63VV_cjs.sql`
|
|
13126
13126
|
CREATE TEMP TABLE ${context.workingTable} (
|
|
13127
13127
|
graph_id TEXT NOT NULL,
|
|
13128
13128
|
run_id TEXT NOT NULL,
|
|
@@ -13140,7 +13140,7 @@ function createWorkingTable5(context) {
|
|
|
13140
13140
|
async function seedDistances(context, sourceId) {
|
|
13141
13141
|
const { operation, workingTable, graphId, runId } = context;
|
|
13142
13142
|
return context.backend.execute(
|
|
13143
|
-
|
|
13143
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
13144
13144
|
INSERT INTO ${workingTable}
|
|
13145
13145
|
(graph_id, run_id, node_id, node_kind, distance, hops,
|
|
13146
13146
|
predecessor_id, predecessor_kind, improved_round)
|
|
@@ -13160,7 +13160,7 @@ async function relaxFrontierRound(context, targetId, iteration, roundBound) {
|
|
|
13160
13160
|
let frontierCount = 0;
|
|
13161
13161
|
let bestTargetDistance = roundBound;
|
|
13162
13162
|
for (const edgeKinds of operation.edgeKindChunks) {
|
|
13163
|
-
const sourceFilter =
|
|
13163
|
+
const sourceFilter = chunkYX3H63VV_cjs.sql`
|
|
13164
13164
|
w.graph_id = ${graphId}
|
|
13165
13165
|
AND w.run_id = ${runId}
|
|
13166
13166
|
AND w.improved_round = ${iteration - 1}
|
|
@@ -13173,7 +13173,7 @@ async function relaxFrontierRound(context, targetId, iteration, roundBound) {
|
|
|
13173
13173
|
edgeKinds
|
|
13174
13174
|
);
|
|
13175
13175
|
const rows = await context.backend.execute(
|
|
13176
|
-
|
|
13176
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
13177
13177
|
INSERT INTO ${workingTable}
|
|
13178
13178
|
(graph_id, run_id, node_id, node_kind, distance, hops,
|
|
13179
13179
|
predecessor_id, predecessor_kind, improved_round)
|
|
@@ -13184,11 +13184,11 @@ async function relaxFrontierRound(context, targetId, iteration, roundBound) {
|
|
|
13184
13184
|
FROM (
|
|
13185
13185
|
SELECT candidates.*,
|
|
13186
13186
|
ROW_NUMBER() OVER (
|
|
13187
|
-
PARTITION BY ${dialect.binaryText(
|
|
13188
|
-
${dialect.binaryText(
|
|
13187
|
+
PARTITION BY ${dialect.binaryText(chunkYX3H63VV_cjs.sql`candidates.target_kind`)},
|
|
13188
|
+
${dialect.binaryText(chunkYX3H63VV_cjs.sql`candidates.target_id`)}
|
|
13189
13189
|
ORDER BY candidates.candidate_distance,
|
|
13190
|
-
${dialect.binaryText(
|
|
13191
|
-
${dialect.binaryText(
|
|
13190
|
+
${dialect.binaryText(chunkYX3H63VV_cjs.sql`candidates.source_id`)},
|
|
13191
|
+
${dialect.binaryText(chunkYX3H63VV_cjs.sql`candidates.source_kind`)}
|
|
13192
13192
|
) AS candidate_rank
|
|
13193
13193
|
FROM (
|
|
13194
13194
|
SELECT expanded.source_id, expanded.source_kind,
|
|
@@ -13202,7 +13202,7 @@ async function relaxFrontierRound(context, targetId, iteration, roundBound) {
|
|
|
13202
13202
|
AND frontier.node_id = expanded.source_id
|
|
13203
13203
|
AND frontier.node_kind = expanded.source_kind
|
|
13204
13204
|
) candidates
|
|
13205
|
-
WHERE ${roundBound === void 0 ?
|
|
13205
|
+
WHERE ${roundBound === void 0 ? chunkYX3H63VV_cjs.sql`TRUE` : chunkYX3H63VV_cjs.sql`candidates.candidate_distance <= ${roundBound}`}
|
|
13206
13206
|
) ranked
|
|
13207
13207
|
WHERE ranked.candidate_rank = 1
|
|
13208
13208
|
ON CONFLICT (graph_id, run_id, node_kind, node_id) DO UPDATE SET
|
|
@@ -13230,7 +13230,7 @@ async function extractPathFromWorkingTable(context, targetId, maxIterations) {
|
|
|
13230
13230
|
const { operation, workingTable, graphId, runId } = context;
|
|
13231
13231
|
const { dialect } = operation.ctx;
|
|
13232
13232
|
const rows = await context.backend.execute(
|
|
13233
|
-
|
|
13233
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
13234
13234
|
WITH RECURSIVE chain AS (
|
|
13235
13235
|
SELECT best.node_id, best.node_kind, best.distance, best.hops,
|
|
13236
13236
|
best.predecessor_id, best.predecessor_kind, 0 AS position
|
|
@@ -13241,7 +13241,7 @@ async function extractPathFromWorkingTable(context, targetId, maxIterations) {
|
|
|
13241
13241
|
WHERE graph_id = ${graphId}
|
|
13242
13242
|
AND run_id = ${runId}
|
|
13243
13243
|
AND node_id = ${targetId}
|
|
13244
|
-
ORDER BY distance ASC, ${dialect.binaryText(
|
|
13244
|
+
ORDER BY distance ASC, ${dialect.binaryText(chunkYX3H63VV_cjs.sql`node_kind`)}
|
|
13245
13245
|
LIMIT 1
|
|
13246
13246
|
) best
|
|
13247
13247
|
UNION ALL
|
|
@@ -13422,8 +13422,8 @@ function createGraphAlgorithms(params) {
|
|
|
13422
13422
|
graph: params.graph,
|
|
13423
13423
|
registry: params.registry,
|
|
13424
13424
|
backend: params.backend,
|
|
13425
|
-
dialect:
|
|
13426
|
-
schema: params.schema ??
|
|
13425
|
+
dialect: chunkHAQVISUF_cjs.getDialect(params.backend.dialect),
|
|
13426
|
+
schema: params.schema ?? chunkJZYMOHHM_cjs.createSqlSchema(params.backend.tableNames),
|
|
13427
13427
|
recordedReadBinding: params.recordedReadBinding,
|
|
13428
13428
|
defaultTemporalMode: params.defaultTemporalMode
|
|
13429
13429
|
};
|
|
@@ -13601,7 +13601,7 @@ function createEdgeCollection(config) {
|
|
|
13601
13601
|
},
|
|
13602
13602
|
async getByIds(ids, options) {
|
|
13603
13603
|
if (ids.length === 0) return [];
|
|
13604
|
-
const rowsById = await
|
|
13604
|
+
const rowsById = await chunkUCHW2MGP_cjs.getEdgeRowsByIds(backend, graphId, ids);
|
|
13605
13605
|
const matches = temporalRowMatcher(options);
|
|
13606
13606
|
return ids.map((id) => {
|
|
13607
13607
|
const row = rowsById.get(id);
|
|
@@ -13703,7 +13703,7 @@ function createEdgeCollection(config) {
|
|
|
13703
13703
|
if (items.length === 0) return [];
|
|
13704
13704
|
const upsertAll = async (target) => {
|
|
13705
13705
|
const ids = items.map((item) => item.id);
|
|
13706
|
-
const existingMap = await
|
|
13706
|
+
const existingMap = await chunkUCHW2MGP_cjs.getEdgeRowsByIds(target, graphId, ids);
|
|
13707
13707
|
const results2 = Array.from({ length: items.length });
|
|
13708
13708
|
const toCreate = [];
|
|
13709
13709
|
const toUpdate = [];
|
|
@@ -13731,7 +13731,7 @@ function createEdgeCollection(config) {
|
|
|
13731
13731
|
const deletedAt = pendingEntry === void 0 ? chunk764JHTLT_cjs.requireDefined(original).deleted_at : void 0;
|
|
13732
13732
|
let dirty;
|
|
13733
13733
|
if (config.upsertDirtyCheck !== void 0) {
|
|
13734
|
-
const currentProps = pendingEntry?.props ??
|
|
13734
|
+
const currentProps = pendingEntry?.props ?? chunkQYDUCWD2_cjs.rowPropsToObject(chunk764JHTLT_cjs.requireDefined(original).props);
|
|
13735
13735
|
try {
|
|
13736
13736
|
dirty = config.upsertDirtyCheck(
|
|
13737
13737
|
original?.kind ?? kind,
|
|
@@ -13960,7 +13960,7 @@ function createNodeCollection(config) {
|
|
|
13960
13960
|
},
|
|
13961
13961
|
async getByIds(ids, options) {
|
|
13962
13962
|
if (ids.length === 0) return [];
|
|
13963
|
-
const rowsById = await
|
|
13963
|
+
const rowsById = await chunkUCHW2MGP_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
|
|
13964
13964
|
const matches = temporalRowMatcher(options);
|
|
13965
13965
|
return ids.map((id) => {
|
|
13966
13966
|
const row = rowsById.get(id);
|
|
@@ -14027,7 +14027,7 @@ function createNodeCollection(config) {
|
|
|
14027
14027
|
const runDirtyCheck = config.upsertDirtyCheck && (() => chunk764JHTLT_cjs.requireDefined(config.upsertDirtyCheck)(
|
|
14028
14028
|
kind,
|
|
14029
14029
|
id,
|
|
14030
|
-
|
|
14030
|
+
chunkQYDUCWD2_cjs.rowPropsToObject(existing.props),
|
|
14031
14031
|
data
|
|
14032
14032
|
));
|
|
14033
14033
|
if (shouldCoalesceUpsert(existing, options, runDirtyCheck)) {
|
|
@@ -14097,7 +14097,7 @@ function createNodeCollection(config) {
|
|
|
14097
14097
|
const deletedAt = pendingEntry === void 0 ? chunk764JHTLT_cjs.requireDefined(original).deleted_at : void 0;
|
|
14098
14098
|
let dirty;
|
|
14099
14099
|
if (config.upsertDirtyCheck !== void 0) {
|
|
14100
|
-
const currentProps = pendingEntry?.props ??
|
|
14100
|
+
const currentProps = pendingEntry?.props ?? chunkQYDUCWD2_cjs.rowPropsToObject(chunk764JHTLT_cjs.requireDefined(original).props);
|
|
14101
14101
|
try {
|
|
14102
14102
|
dirty = config.upsertDirtyCheck(
|
|
14103
14103
|
kind,
|
|
@@ -14393,14 +14393,14 @@ var HISTORY_STORE_BACKEND_KEYS = [
|
|
|
14393
14393
|
];
|
|
14394
14394
|
function createHistoryStoreBackendProjection(backend) {
|
|
14395
14395
|
return Object.freeze(
|
|
14396
|
-
|
|
14396
|
+
chunkUCHW2MGP_cjs.projectBackendMembers(backend, HISTORY_STORE_BACKEND_KEYS)
|
|
14397
14397
|
);
|
|
14398
14398
|
}
|
|
14399
14399
|
|
|
14400
14400
|
// src/store/introspect.ts
|
|
14401
14401
|
function introspectSchema(graph, context) {
|
|
14402
14402
|
const extension = graph.extension;
|
|
14403
|
-
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } =
|
|
14403
|
+
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkK4FB2RMO_cjs.extensionKindNames(extension);
|
|
14404
14404
|
const deprecated = graph.deprecatedKinds;
|
|
14405
14405
|
const kinds = [];
|
|
14406
14406
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
@@ -14411,7 +14411,7 @@ function introspectSchema(graph, context) {
|
|
|
14411
14411
|
description: reg.type.description,
|
|
14412
14412
|
annotations: reg.type.annotations,
|
|
14413
14413
|
deprecated: deprecated.has(name),
|
|
14414
|
-
properties:
|
|
14414
|
+
properties: chunkK4FB2RMO_cjs.serializeSchemaProperties(reg.type.schema),
|
|
14415
14415
|
unique: (reg.unique ?? []).map((constraint) => ({
|
|
14416
14416
|
name: constraint.name,
|
|
14417
14417
|
fields: [...constraint.fields],
|
|
@@ -14432,17 +14432,17 @@ function introspectSchema(graph, context) {
|
|
|
14432
14432
|
to: reg.to.map((entry2) => entry2.kind),
|
|
14433
14433
|
cardinality: reg.cardinality ?? "many",
|
|
14434
14434
|
endpointExistence: reg.endpointExistence ?? "notDeleted",
|
|
14435
|
-
properties:
|
|
14435
|
+
properties: chunkK4FB2RMO_cjs.serializeSchemaProperties(edgeType.schema),
|
|
14436
14436
|
annotations: edgeType.annotations,
|
|
14437
14437
|
deprecated: deprecated.has(name)
|
|
14438
14438
|
});
|
|
14439
14439
|
}
|
|
14440
|
-
const runtimeOntologyKeys =
|
|
14440
|
+
const runtimeOntologyKeys = chunkK4FB2RMO_cjs.buildGraphExtensionOntologyKeySet(extension);
|
|
14441
14441
|
const ontology = graph.ontology.map((relation) => ({
|
|
14442
14442
|
metaEdge: relation.metaEdge.name,
|
|
14443
14443
|
from: chunkRW24SAHI_cjs.getTypeName(relation.from),
|
|
14444
14444
|
to: chunkRW24SAHI_cjs.getTypeName(relation.to),
|
|
14445
|
-
origin: runtimeOntologyKeys.has(
|
|
14445
|
+
origin: runtimeOntologyKeys.has(chunkK4FB2RMO_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
|
|
14446
14446
|
}));
|
|
14447
14447
|
return {
|
|
14448
14448
|
graphId: context.graphId,
|
|
@@ -14580,7 +14580,7 @@ async function materializeIndexes(context, options = {}) {
|
|
|
14580
14580
|
backend,
|
|
14581
14581
|
relationalPhysicalNames
|
|
14582
14582
|
);
|
|
14583
|
-
const reservedSystemNames =
|
|
14583
|
+
const reservedSystemNames = chunkLLE25NRD_cjs.resolveSystemIndexNames(backend.tableNames);
|
|
14584
14584
|
const materializeEntry = (declaration) => {
|
|
14585
14585
|
if (declaration.entity !== "vector" && reservedSystemNames.has(declaration.name)) {
|
|
14586
14586
|
return Promise.resolve(
|
|
@@ -14654,7 +14654,7 @@ async function materializeRelationalIndex(declaration, backend, dialect, ddlOpti
|
|
|
14654
14654
|
reason: `Index method "${declaration.method}" requires PostgreSQL (expression GIN${declaration.method === "trigram" ? " + pg_trgm" : ""}); SQLite serves substring search via FTS5 fulltext instead.`
|
|
14655
14655
|
};
|
|
14656
14656
|
}
|
|
14657
|
-
const ddl =
|
|
14657
|
+
const ddl = chunkKLR77R5A_cjs.generateIndexDDL(declaration, dialect, ddlOptions);
|
|
14658
14658
|
const targetTable = declaration.entity === "node" ? ddlOptions.nodesTableName ?? "typegraph_nodes" : ddlOptions.edgesTableName ?? "typegraph_edges";
|
|
14659
14659
|
const signature = await computeIndexSignature(
|
|
14660
14660
|
dialect,
|
|
@@ -14768,7 +14768,7 @@ async function materializeOne(declaration, backend, graphId, schemaVersion, acti
|
|
|
14768
14768
|
}
|
|
14769
14769
|
try {
|
|
14770
14770
|
await run();
|
|
14771
|
-
const attemptedAt =
|
|
14771
|
+
const attemptedAt = chunkMNURF4RF_cjs.nowIso();
|
|
14772
14772
|
await recordIndexMaterialization(
|
|
14773
14773
|
buildAttempt({
|
|
14774
14774
|
declaration,
|
|
@@ -14829,7 +14829,7 @@ async function materializeWithClaim(declaration, backend, graphId, schemaVersion
|
|
|
14829
14829
|
const recordIndexMaterialization = chunk764JHTLT_cjs.requireDefined(
|
|
14830
14830
|
backend.recordIndexMaterialization
|
|
14831
14831
|
);
|
|
14832
|
-
const token = `${statusKey}:${
|
|
14832
|
+
const token = `${statusKey}:${chunkMNURF4RF_cjs.nowIso()}:${Math.floor(performance.now() * 1e3)}`;
|
|
14833
14833
|
const deadline = Date.now() + CLAIM_WAIT_TIMEOUT_MS;
|
|
14834
14834
|
for (; ; ) {
|
|
14835
14835
|
const claimed = await chunk764JHTLT_cjs.requireDefined(backend.claimIndexMaterialization)({
|
|
@@ -14881,7 +14881,7 @@ async function materializeWithClaim(declaration, backend, graphId, schemaVersion
|
|
|
14881
14881
|
}
|
|
14882
14882
|
try {
|
|
14883
14883
|
await run();
|
|
14884
|
-
const attemptedAt =
|
|
14884
|
+
const attemptedAt = chunkMNURF4RF_cjs.nowIso();
|
|
14885
14885
|
await recordIndexMaterialization(
|
|
14886
14886
|
buildAttempt({
|
|
14887
14887
|
declaration,
|
|
@@ -14930,7 +14930,7 @@ async function hasInvalidIndexLeftover(backend, physicalIndexName) {
|
|
|
14930
14930
|
return false;
|
|
14931
14931
|
}
|
|
14932
14932
|
const rows = await backend.execute(
|
|
14933
|
-
|
|
14933
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
14934
14934
|
SELECT NOT i.indisvalid AS invalid
|
|
14935
14935
|
FROM pg_class c
|
|
14936
14936
|
JOIN pg_index i ON i.indexrelid = c.oid
|
|
@@ -14955,10 +14955,10 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
14955
14955
|
switch (backend.dialect) {
|
|
14956
14956
|
case "postgres": {
|
|
14957
14957
|
const rows = await backend.execute(
|
|
14958
|
-
|
|
14958
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
14959
14959
|
SELECT c.relname AS name
|
|
14960
14960
|
FROM pg_class c
|
|
14961
|
-
WHERE c.relname IN (${
|
|
14961
|
+
WHERE c.relname IN (${chunkUCHW2MGP_cjs.sqlValueList(tableNames)})
|
|
14962
14962
|
AND c.relkind IN ('r', 'p')
|
|
14963
14963
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
14964
14964
|
`)
|
|
@@ -14967,11 +14967,11 @@ async function preloadExistingTables(backend, tableNames) {
|
|
|
14967
14967
|
}
|
|
14968
14968
|
case "sqlite": {
|
|
14969
14969
|
const rows = await backend.execute(
|
|
14970
|
-
|
|
14970
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
14971
14971
|
SELECT name
|
|
14972
14972
|
FROM sqlite_master
|
|
14973
14973
|
WHERE type = 'table'
|
|
14974
|
-
AND name IN (${
|
|
14974
|
+
AND name IN (${chunkUCHW2MGP_cjs.sqlValueList(tableNames)})
|
|
14975
14975
|
`)
|
|
14976
14976
|
);
|
|
14977
14977
|
return new Set(rows.map((row) => row.name));
|
|
@@ -14988,11 +14988,11 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
14988
14988
|
switch (backend.dialect) {
|
|
14989
14989
|
case "postgres": {
|
|
14990
14990
|
const rows = await backend.execute(
|
|
14991
|
-
|
|
14991
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
14992
14992
|
SELECT c.relname AS name, i.indisvalid AS valid
|
|
14993
14993
|
FROM pg_class c
|
|
14994
14994
|
JOIN pg_index i ON i.indexrelid = c.oid
|
|
14995
|
-
WHERE c.relname IN (${
|
|
14995
|
+
WHERE c.relname IN (${chunkUCHW2MGP_cjs.sqlValueList(physicalIndexNames)})
|
|
14996
14996
|
AND pg_catalog.pg_table_is_visible(c.oid)
|
|
14997
14997
|
`)
|
|
14998
14998
|
);
|
|
@@ -15001,11 +15001,11 @@ async function preloadPhysicalIndexStates(backend, physicalIndexNames) {
|
|
|
15001
15001
|
}
|
|
15002
15002
|
case "sqlite": {
|
|
15003
15003
|
const rows = await backend.execute(
|
|
15004
|
-
|
|
15004
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
15005
15005
|
SELECT name
|
|
15006
15006
|
FROM sqlite_master
|
|
15007
15007
|
WHERE type = 'index'
|
|
15008
|
-
AND name IN (${
|
|
15008
|
+
AND name IN (${chunkUCHW2MGP_cjs.sqlValueList(physicalIndexNames)})
|
|
15009
15009
|
`)
|
|
15010
15010
|
);
|
|
15011
15011
|
for (const row of rows) valid.add(row.name);
|
|
@@ -15069,7 +15069,7 @@ function buildAttempt(args) {
|
|
|
15069
15069
|
kind: args.declaration.kind,
|
|
15070
15070
|
signature: args.signature,
|
|
15071
15071
|
schemaVersion: args.schemaVersion,
|
|
15072
|
-
attemptedAt: args.attemptedAt ??
|
|
15072
|
+
attemptedAt: args.attemptedAt ?? chunkMNURF4RF_cjs.nowIso(),
|
|
15073
15073
|
materializedAt: args.materializedAt,
|
|
15074
15074
|
error: args.error?.message
|
|
15075
15075
|
};
|
|
@@ -15095,15 +15095,15 @@ async function materializeSystemIndexes(context, options = {}) {
|
|
|
15095
15095
|
backend.ensureIndexMaterializationsTable
|
|
15096
15096
|
);
|
|
15097
15097
|
const concurrent = INDEX_DIALECT_BEHAVIOR[backend.dialect].concurrentBuilds;
|
|
15098
|
-
const candidates =
|
|
15099
|
-
const physicalTable =
|
|
15098
|
+
const candidates = chunkLLE25NRD_cjs.SYSTEM_INDEX_DECLARATIONS.map((declaration) => {
|
|
15099
|
+
const physicalTable = chunkLLE25NRD_cjs.resolveSystemIndexTableName(
|
|
15100
15100
|
declaration.table,
|
|
15101
15101
|
backend.tableNames
|
|
15102
15102
|
);
|
|
15103
15103
|
return {
|
|
15104
15104
|
declaration,
|
|
15105
15105
|
physicalTable,
|
|
15106
|
-
name:
|
|
15106
|
+
name: chunkLLE25NRD_cjs.systemIndexName(physicalTable, declaration.suffix)
|
|
15107
15107
|
};
|
|
15108
15108
|
});
|
|
15109
15109
|
const statusKeys = candidates.map((candidate) => candidate.name);
|
|
@@ -15152,7 +15152,7 @@ async function materializeSystemIndexes(context, options = {}) {
|
|
|
15152
15152
|
candidate.physicalTable,
|
|
15153
15153
|
candidate.declaration
|
|
15154
15154
|
);
|
|
15155
|
-
const ddl =
|
|
15155
|
+
const ddl = chunkLLE25NRD_cjs.generateSystemIndexDDL(
|
|
15156
15156
|
candidate.declaration,
|
|
15157
15157
|
candidate.physicalTable,
|
|
15158
15158
|
{ concurrent }
|
|
@@ -15193,7 +15193,7 @@ async function computeIndexSignature(dialect, targetTableName, declaration) {
|
|
|
15193
15193
|
const hashable = {
|
|
15194
15194
|
dialect,
|
|
15195
15195
|
targetTableName,
|
|
15196
|
-
declaration:
|
|
15196
|
+
declaration: chunkK4FB2RMO_cjs.serializeIndexDeclaration(declaration)
|
|
15197
15197
|
};
|
|
15198
15198
|
const json = JSON.stringify(hashable, chunkACSVZPK7_cjs.sortedReplacer);
|
|
15199
15199
|
return chunkZY4GXIVN_cjs.sha256Hex(json, 16);
|
|
@@ -15235,7 +15235,7 @@ async function materializeRemovals(context, options = {}) {
|
|
|
15235
15235
|
fulltextTable,
|
|
15236
15236
|
uniquesTable,
|
|
15237
15237
|
captureRecordedRemovals,
|
|
15238
|
-
recordedSchema: captureRecordedRemovals ? context.recordedSchema ??
|
|
15238
|
+
recordedSchema: captureRecordedRemovals ? context.recordedSchema ?? chunkJZYMOHHM_cjs.createSqlSchema(backend.tableNames) : void 0
|
|
15239
15239
|
};
|
|
15240
15240
|
return {
|
|
15241
15241
|
results: await runMaterialization(
|
|
@@ -15266,14 +15266,14 @@ async function reconcilePendingRemovals(context) {
|
|
|
15266
15266
|
const reconciliations = [];
|
|
15267
15267
|
const stopAtVersion = marker ?? 1;
|
|
15268
15268
|
let currentRow = activeRow;
|
|
15269
|
-
let currentSchema =
|
|
15269
|
+
let currentSchema = chunkK4FB2RMO_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
15270
15270
|
while (currentRow.version > stopAtVersion) {
|
|
15271
15271
|
const priorRow = await backend.getSchemaVersion(
|
|
15272
15272
|
graphId,
|
|
15273
15273
|
currentRow.version - 1
|
|
15274
15274
|
);
|
|
15275
15275
|
if (priorRow === void 0) break;
|
|
15276
|
-
const priorSchema =
|
|
15276
|
+
const priorSchema = chunkK4FB2RMO_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
15277
15277
|
for (const entity of ENTITY_KINDS) {
|
|
15278
15278
|
const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
|
|
15279
15279
|
const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
|
|
@@ -15293,7 +15293,7 @@ async function reconcilePendingRemovals(context) {
|
|
|
15293
15293
|
currentSchema = priorSchema;
|
|
15294
15294
|
}
|
|
15295
15295
|
if (reconciliations.length > 0) {
|
|
15296
|
-
const attemptedAt =
|
|
15296
|
+
const attemptedAt = chunkMNURF4RF_cjs.nowIso();
|
|
15297
15297
|
await Promise.all(
|
|
15298
15298
|
reconciliations.map(
|
|
15299
15299
|
(entry2) => recordKindRemoval(
|
|
@@ -15320,7 +15320,7 @@ async function materializeOne2(row, ctx) {
|
|
|
15320
15320
|
try {
|
|
15321
15321
|
await closeRecordedAndDeleteLiveRows(ctx, row);
|
|
15322
15322
|
await Promise.all(buildEmbeddingTableCleanup(ctx, row));
|
|
15323
|
-
const removedAt =
|
|
15323
|
+
const removedAt = chunkMNURF4RF_cjs.nowIso();
|
|
15324
15324
|
await recordKindRemoval({
|
|
15325
15325
|
graphId: ctx.graphId,
|
|
15326
15326
|
kindName: row.kindName,
|
|
@@ -15342,7 +15342,7 @@ async function materializeOne2(row, ctx) {
|
|
|
15342
15342
|
kindName: row.kindName,
|
|
15343
15343
|
entity: row.entity,
|
|
15344
15344
|
schemaVersion: row.schemaVersion,
|
|
15345
|
-
attemptedAt:
|
|
15345
|
+
attemptedAt: chunkMNURF4RF_cjs.nowIso(),
|
|
15346
15346
|
removedAt: void 0,
|
|
15347
15347
|
error: error.message
|
|
15348
15348
|
});
|
|
@@ -15363,7 +15363,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row) {
|
|
|
15363
15363
|
const recordedSchema = ctx.recordedSchema;
|
|
15364
15364
|
try {
|
|
15365
15365
|
await ctx.backend.transaction(async (target) => {
|
|
15366
|
-
await
|
|
15366
|
+
await chunkUCHW2MGP_cjs.closeRecordedHardDeletedKind(
|
|
15367
15367
|
target,
|
|
15368
15368
|
recordedSchema,
|
|
15369
15369
|
ctx.graphId,
|
|
@@ -15397,7 +15397,7 @@ async function executeDeleteStatements(target, statements) {
|
|
|
15397
15397
|
await Promise.all(
|
|
15398
15398
|
statements.map(
|
|
15399
15399
|
(statement) => chunk764JHTLT_cjs.requireDefined(target.executeStatement)(
|
|
15400
|
-
|
|
15400
|
+
chunkYX3H63VV_cjs.asCompiledStatementSql(chunkYX3H63VV_cjs.sql.raw(statement))
|
|
15401
15401
|
)
|
|
15402
15402
|
)
|
|
15403
15403
|
);
|
|
@@ -15442,7 +15442,7 @@ async function resolveRemovedKindEmbeddingSlots(backend, row) {
|
|
|
15442
15442
|
if (priorVersion < 1) return [];
|
|
15443
15443
|
const priorRow = await backend.getSchemaVersion(row.graphId, priorVersion);
|
|
15444
15444
|
if (priorRow === void 0) return [];
|
|
15445
|
-
const priorSchema =
|
|
15445
|
+
const priorSchema = chunkK4FB2RMO_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
15446
15446
|
const slots = /* @__PURE__ */ new Map();
|
|
15447
15447
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
15448
15448
|
if (declaration.entity === "vector" && declaration.kind === row.kindName) {
|
|
@@ -15472,7 +15472,7 @@ async function reclaimRemovedVectorFieldTables(context) {
|
|
|
15472
15472
|
let perBackend = reclaimCache.get(backend);
|
|
15473
15473
|
const cached = perBackend?.get(cacheKey);
|
|
15474
15474
|
if (cached !== void 0) return cached;
|
|
15475
|
-
const activeSchema =
|
|
15475
|
+
const activeSchema = chunkK4FB2RMO_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
15476
15476
|
const activeVectorFields = /* @__PURE__ */ new Set();
|
|
15477
15477
|
for (const declaration of activeSchema.indexes ?? []) {
|
|
15478
15478
|
if (declaration.entity === "vector") {
|
|
@@ -15486,7 +15486,7 @@ async function reclaimRemovedVectorFieldTables(context) {
|
|
|
15486
15486
|
for (let version = activeRow.version - 1; version >= 1; version -= 1) {
|
|
15487
15487
|
const priorRow = await backend.getSchemaVersion(graphId, version);
|
|
15488
15488
|
if (priorRow === void 0) continue;
|
|
15489
|
-
const priorSchema =
|
|
15489
|
+
const priorSchema = chunkK4FB2RMO_cjs.parseSerializedSchema(priorRow.schema_doc);
|
|
15490
15490
|
for (const declaration of priorSchema.indexes ?? []) {
|
|
15491
15491
|
if (declaration.entity !== "vector") continue;
|
|
15492
15492
|
const key = vectorFieldKey(declaration.kind, declaration.fieldPath);
|
|
@@ -15671,7 +15671,7 @@ function createEdgeBatchValidationBackend(backend) {
|
|
|
15671
15671
|
pendingUniquePairs.add(uniqueCacheKey);
|
|
15672
15672
|
}
|
|
15673
15673
|
}
|
|
15674
|
-
const validationBackend =
|
|
15674
|
+
const validationBackend = chunkQYDUCWD2_cjs.createBackendOverlay(backend, {
|
|
15675
15675
|
getNode: getNodeCached,
|
|
15676
15676
|
countEdgesFrom: countEdgesFromCached,
|
|
15677
15677
|
edgeExistsBetween: edgeExistsBetweenCached
|
|
@@ -15688,7 +15688,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
15688
15688
|
const toKind = input.toKind;
|
|
15689
15689
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
15690
15690
|
const edgeKind = registration.type;
|
|
15691
|
-
const endpointError =
|
|
15691
|
+
const endpointError = chunkUCHW2MGP_cjs.validateEdgeEndpoints(
|
|
15692
15692
|
kind,
|
|
15693
15693
|
fromKind,
|
|
15694
15694
|
toKind,
|
|
@@ -15718,18 +15718,18 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
15718
15718
|
kind,
|
|
15719
15719
|
operation: "create"
|
|
15720
15720
|
});
|
|
15721
|
-
const validFrom =
|
|
15721
|
+
const validFrom = chunkMNURF4RF_cjs.validateOptionalCanonicalIsoDate(
|
|
15722
15722
|
input.validFrom,
|
|
15723
15723
|
"validFrom"
|
|
15724
15724
|
);
|
|
15725
|
-
const validTo =
|
|
15725
|
+
const validTo = chunkMNURF4RF_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
15726
15726
|
const cardinality = registration.cardinality ?? "many";
|
|
15727
15727
|
const constraintContext = {
|
|
15728
15728
|
graphId: ctx.graphId,
|
|
15729
15729
|
registry: ctx.registry,
|
|
15730
15730
|
backend
|
|
15731
15731
|
};
|
|
15732
|
-
await
|
|
15732
|
+
await chunkYIX3BEBR_cjs.checkCardinalityConstraint(
|
|
15733
15733
|
constraintContext,
|
|
15734
15734
|
kind,
|
|
15735
15735
|
cardinality,
|
|
@@ -15757,16 +15757,16 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
15757
15757
|
}
|
|
15758
15758
|
async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
15759
15759
|
const kind = input.kind;
|
|
15760
|
-
const id = input.id ??
|
|
15760
|
+
const id = input.id ?? chunkUCHW2MGP_cjs.generateId();
|
|
15761
15761
|
const opContext = ctx.createOperationContext("create", "edge", kind, id);
|
|
15762
|
-
return
|
|
15762
|
+
return chunkYIX3BEBR_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
15763
15763
|
const prepared = await validateAndPrepareEdgeCreate(ctx, input, id, target);
|
|
15764
15764
|
let row;
|
|
15765
15765
|
{
|
|
15766
15766
|
row = await target.insertEdge(prepared.insertParams);
|
|
15767
15767
|
}
|
|
15768
15768
|
if (row === void 0) return;
|
|
15769
|
-
return
|
|
15769
|
+
return chunkYIX3BEBR_cjs.rowToEdge(row);
|
|
15770
15770
|
});
|
|
15771
15771
|
}
|
|
15772
15772
|
async function executeEdgeCreate(ctx, input, backend) {
|
|
@@ -15809,7 +15809,7 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
|
|
|
15809
15809
|
await primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow);
|
|
15810
15810
|
const preparedCreates = [];
|
|
15811
15811
|
for (const input of inputs) {
|
|
15812
|
-
const id = input.id ??
|
|
15812
|
+
const id = input.id ?? chunkUCHW2MGP_cjs.generateId();
|
|
15813
15813
|
const prepared = await validateAndPrepareEdgeCreate(
|
|
15814
15814
|
ctx,
|
|
15815
15815
|
input,
|
|
@@ -15831,30 +15831,30 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
15831
15831
|
if (inputs.length === 0) {
|
|
15832
15832
|
return;
|
|
15833
15833
|
}
|
|
15834
|
-
await
|
|
15834
|
+
await chunkYIX3BEBR_cjs.runInWriteTransaction(ctx, backend, async (target) => {
|
|
15835
15835
|
const { batchInsertParams } = await prepareEdgeBatchCreates(
|
|
15836
15836
|
ctx,
|
|
15837
15837
|
inputs,
|
|
15838
15838
|
target
|
|
15839
15839
|
);
|
|
15840
|
-
await
|
|
15840
|
+
await chunkUCHW2MGP_cjs.runInsertBatch(chunkUCHW2MGP_cjs.edgeInsertDispatch(target), batchInsertParams);
|
|
15841
15841
|
});
|
|
15842
15842
|
}
|
|
15843
15843
|
async function executeEdgeCreateBatch(ctx, inputs, backend) {
|
|
15844
15844
|
if (inputs.length === 0) {
|
|
15845
15845
|
return [];
|
|
15846
15846
|
}
|
|
15847
|
-
return
|
|
15847
|
+
return chunkYIX3BEBR_cjs.runInWriteTransaction(ctx, backend, async (target) => {
|
|
15848
15848
|
const { batchInsertParams } = await prepareEdgeBatchCreates(
|
|
15849
15849
|
ctx,
|
|
15850
15850
|
inputs,
|
|
15851
15851
|
target
|
|
15852
15852
|
);
|
|
15853
|
-
const rows = await
|
|
15854
|
-
|
|
15853
|
+
const rows = await chunkUCHW2MGP_cjs.runInsertBatchReturning(
|
|
15854
|
+
chunkUCHW2MGP_cjs.edgeInsertDispatch(target),
|
|
15855
15855
|
batchInsertParams
|
|
15856
15856
|
);
|
|
15857
|
-
return rows.map((row) =>
|
|
15857
|
+
return rows.map((row) => chunkYIX3BEBR_cjs.rowToEdge(row));
|
|
15858
15858
|
});
|
|
15859
15859
|
}
|
|
15860
15860
|
function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
@@ -15866,7 +15866,7 @@ function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
|
15866
15866
|
);
|
|
15867
15867
|
}
|
|
15868
15868
|
function resolveEdgeUpdateProps(ctx, existing, inputProps) {
|
|
15869
|
-
const existingProps =
|
|
15869
|
+
const existingProps = chunkQYDUCWD2_cjs.rowPropsToObject(existing.props);
|
|
15870
15870
|
const validatedProps = computeEdgeUpdate(
|
|
15871
15871
|
ctx,
|
|
15872
15872
|
existing.kind,
|
|
@@ -15896,7 +15896,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
15896
15896
|
throw new chunkSAFZ6JTI_cjs.EdgeNotFoundError("unknown", id);
|
|
15897
15897
|
}
|
|
15898
15898
|
const { validatedProps } = resolveEdgeUpdateProps(ctx, existing, input.props);
|
|
15899
|
-
const validTo =
|
|
15899
|
+
const validTo = chunkMNURF4RF_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
15900
15900
|
const updateParams = {
|
|
15901
15901
|
graphId: ctx.graphId,
|
|
15902
15902
|
id,
|
|
@@ -15905,7 +15905,7 @@ async function performEdgeUpdate(ctx, input, target, options) {
|
|
|
15905
15905
|
if (validTo !== void 0) updateParams.validTo = validTo;
|
|
15906
15906
|
if (options?.clearDeleted) updateParams.clearDeleted = true;
|
|
15907
15907
|
const row = await target.updateEdge(updateParams);
|
|
15908
|
-
return
|
|
15908
|
+
return chunkYIX3BEBR_cjs.rowToEdge(row);
|
|
15909
15909
|
}
|
|
15910
15910
|
async function executeEdgeUpdate(ctx, input, backend) {
|
|
15911
15911
|
const id = input.id;
|
|
@@ -15914,7 +15914,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
15914
15914
|
throw new chunkSAFZ6JTI_cjs.EdgeNotFoundError("unknown", id);
|
|
15915
15915
|
}
|
|
15916
15916
|
const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
|
|
15917
|
-
return
|
|
15917
|
+
return chunkYIX3BEBR_cjs.runHookedWriteOperation(
|
|
15918
15918
|
ctx,
|
|
15919
15919
|
opContext,
|
|
15920
15920
|
backend,
|
|
@@ -15922,7 +15922,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
15922
15922
|
);
|
|
15923
15923
|
}
|
|
15924
15924
|
async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
|
|
15925
|
-
return
|
|
15925
|
+
return chunkYIX3BEBR_cjs.runInWriteTransaction(
|
|
15926
15926
|
ctx,
|
|
15927
15927
|
backend,
|
|
15928
15928
|
(target) => performEdgeUpdate(ctx, input, target, options)
|
|
@@ -15932,7 +15932,7 @@ async function executeEdgeDelete(ctx, id, backend) {
|
|
|
15932
15932
|
const gate = await backend.getEdge(ctx.graphId, id);
|
|
15933
15933
|
if (!gate || gate.deleted_at) return;
|
|
15934
15934
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
15935
|
-
return
|
|
15935
|
+
return chunkYIX3BEBR_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
15936
15936
|
await target.deleteEdge({
|
|
15937
15937
|
graphId: ctx.graphId,
|
|
15938
15938
|
id
|
|
@@ -15943,7 +15943,7 @@ async function executeEdgeHardDelete(ctx, id, backend) {
|
|
|
15943
15943
|
const gate = await backend.getEdge(ctx.graphId, id);
|
|
15944
15944
|
if (!gate) return;
|
|
15945
15945
|
const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
|
|
15946
|
-
return
|
|
15946
|
+
return chunkYIX3BEBR_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
|
|
15947
15947
|
await target.hardDeleteEdge({
|
|
15948
15948
|
graphId: ctx.graphId,
|
|
15949
15949
|
id
|
|
@@ -16013,7 +16013,7 @@ function findMatchingEdge(rows, matchOn, inputProps) {
|
|
|
16013
16013
|
let deletedRow;
|
|
16014
16014
|
for (const row of rows) {
|
|
16015
16015
|
if (matchOn.length > 0) {
|
|
16016
|
-
const rowProps =
|
|
16016
|
+
const rowProps = chunkQYDUCWD2_cjs.rowPropsToObject(row.props);
|
|
16017
16017
|
const matches = matchOn.every(
|
|
16018
16018
|
(field2) => stableStringify(rowProps[field2]) === stableStringify(inputProps[field2])
|
|
16019
16019
|
);
|
|
@@ -16050,9 +16050,9 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
|
|
|
16050
16050
|
...options?.asOf !== void 0 && { asOf: options.asOf }
|
|
16051
16051
|
});
|
|
16052
16052
|
if (candidateRows.length === 0) return void 0;
|
|
16053
|
-
if (matchOn.length === 0) return
|
|
16053
|
+
if (matchOn.length === 0) return chunkYIX3BEBR_cjs.rowToEdge(chunk764JHTLT_cjs.requireDefined(candidateRows[0]));
|
|
16054
16054
|
const { liveRow } = findMatchingEdge(candidateRows, matchOn, props);
|
|
16055
|
-
return liveRow === void 0 ? void 0 :
|
|
16055
|
+
return liveRow === void 0 ? void 0 : chunkYIX3BEBR_cjs.rowToEdge(liveRow);
|
|
16056
16056
|
}
|
|
16057
16057
|
async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, props, backend, options) {
|
|
16058
16058
|
const ifExists = options?.ifExists ?? "return";
|
|
@@ -16081,7 +16081,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
16081
16081
|
validatedProps
|
|
16082
16082
|
);
|
|
16083
16083
|
if (probedLiveRow !== void 0) {
|
|
16084
|
-
return { edge:
|
|
16084
|
+
return { edge: chunkYIX3BEBR_cjs.rowToEdge(probedLiveRow), action: "found" };
|
|
16085
16085
|
}
|
|
16086
16086
|
}
|
|
16087
16087
|
async function attempt() {
|
|
@@ -16114,7 +16114,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
16114
16114
|
}
|
|
16115
16115
|
if (liveRow !== void 0) {
|
|
16116
16116
|
if (ifExists === "return") {
|
|
16117
|
-
return { edge:
|
|
16117
|
+
return { edge: chunkYIX3BEBR_cjs.rowToEdge(liveRow), action: "found" };
|
|
16118
16118
|
}
|
|
16119
16119
|
const edge2 = await executeEdgeUpsertUpdate(
|
|
16120
16120
|
ctx,
|
|
@@ -16134,7 +16134,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
16134
16134
|
registry: ctx.registry,
|
|
16135
16135
|
backend
|
|
16136
16136
|
};
|
|
16137
|
-
await
|
|
16137
|
+
await chunkYIX3BEBR_cjs.checkCardinalityConstraint(
|
|
16138
16138
|
constraintContext,
|
|
16139
16139
|
kind,
|
|
16140
16140
|
cardinality,
|
|
@@ -16280,7 +16280,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16280
16280
|
if (allFoundLive) {
|
|
16281
16281
|
const found = Array.from({ length: items.length });
|
|
16282
16282
|
for (const entry2 of probe.toFetch) {
|
|
16283
|
-
found[entry2.index] = { edge:
|
|
16283
|
+
found[entry2.index] = { edge: chunkYIX3BEBR_cjs.rowToEdge(entry2.row), action: "found" };
|
|
16284
16284
|
}
|
|
16285
16285
|
for (const { index, sourceIndex } of probe.duplicateOf) {
|
|
16286
16286
|
found[index] = {
|
|
@@ -16291,7 +16291,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16291
16291
|
return found;
|
|
16292
16292
|
}
|
|
16293
16293
|
}
|
|
16294
|
-
return
|
|
16294
|
+
return chunkYIX3BEBR_cjs.runInWriteTransaction(ctx, backend, async (target) => {
|
|
16295
16295
|
const { toCreate, toFetch, duplicateOf } = partitionEntries(
|
|
16296
16296
|
await fetchRowsByEndpoint(target)
|
|
16297
16297
|
);
|
|
@@ -16318,7 +16318,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16318
16318
|
registry: ctx.registry,
|
|
16319
16319
|
backend: target
|
|
16320
16320
|
};
|
|
16321
|
-
await
|
|
16321
|
+
await chunkYIX3BEBR_cjs.checkCardinalityConstraint(
|
|
16322
16322
|
constraintContext,
|
|
16323
16323
|
kind,
|
|
16324
16324
|
cardinality,
|
|
@@ -16343,7 +16343,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16343
16343
|
);
|
|
16344
16344
|
results[entry2.index] = { edge, action: "updated" };
|
|
16345
16345
|
} else {
|
|
16346
|
-
results[entry2.index] = { edge:
|
|
16346
|
+
results[entry2.index] = { edge: chunkYIX3BEBR_cjs.rowToEdge(entry2.row), action: "found" };
|
|
16347
16347
|
}
|
|
16348
16348
|
}
|
|
16349
16349
|
for (const { index, sourceIndex } of duplicateOf) {
|
|
@@ -16358,7 +16358,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
16358
16358
|
var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
|
|
16359
16359
|
var RECORDED_SCAN_LIMIT = 1e3;
|
|
16360
16360
|
function recordedPointReadIdChunk(backend) {
|
|
16361
|
-
const budget =
|
|
16361
|
+
const budget = chunkUCHW2MGP_cjs.recordedBindParamBudget(backend);
|
|
16362
16362
|
return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
|
|
16363
16363
|
}
|
|
16364
16364
|
function recordedRelationErrorDetails(backend, surface) {
|
|
@@ -16371,8 +16371,8 @@ function withRelationsPrecondition(backend, promise, surface) {
|
|
|
16371
16371
|
);
|
|
16372
16372
|
}
|
|
16373
16373
|
function createRecordedReadBackend(backend, surface) {
|
|
16374
|
-
const projectedBackend =
|
|
16375
|
-
return
|
|
16374
|
+
const projectedBackend = chunkUCHW2MGP_cjs.createGraphBackendProjection(backend);
|
|
16375
|
+
return chunkQYDUCWD2_cjs.createBackendOverlay(projectedBackend, {
|
|
16376
16376
|
execute: (query) => withRelationsPrecondition(backend, backend.execute(query), surface),
|
|
16377
16377
|
...backend.executeRaw === void 0 ? {} : {
|
|
16378
16378
|
executeRaw: (sqlText, params) => withRelationsPrecondition(
|
|
@@ -16391,12 +16391,12 @@ function recordedTemporalFilter(backend, coordinate, tableAlias) {
|
|
|
16391
16391
|
{ code: "RECORDED_POINT_READ_MISSING_COORDINATE" }
|
|
16392
16392
|
);
|
|
16393
16393
|
}
|
|
16394
|
-
return
|
|
16394
|
+
return chunkUCHW2MGP_cjs.compileTemporalFilter({
|
|
16395
16395
|
mode: coordinate.valid.mode,
|
|
16396
16396
|
asOf: coordinate.valid.asOf,
|
|
16397
16397
|
recordedAsOf,
|
|
16398
16398
|
tableAlias,
|
|
16399
|
-
currentTimestamp:
|
|
16399
|
+
currentTimestamp: chunkUCHW2MGP_cjs.currentReadInstant()
|
|
16400
16400
|
});
|
|
16401
16401
|
}
|
|
16402
16402
|
function recordedRelationInvariantError(params) {
|
|
@@ -16476,28 +16476,28 @@ function createRecordedReadService(params) {
|
|
|
16476
16476
|
mapRecordedNodeRow,
|
|
16477
16477
|
mapRecordedEdgeRow
|
|
16478
16478
|
} = params;
|
|
16479
|
-
const recordedSchema = recordedReadBinding === void 0 ? void 0 :
|
|
16479
|
+
const recordedSchema = recordedReadBinding === void 0 ? void 0 : chunkJZYMOHHM_cjs.recordedReadSqlSchema(recordedReadBinding);
|
|
16480
16480
|
function schemaForRecordedRead(surface) {
|
|
16481
|
-
return recordedSchema ??
|
|
16482
|
-
|
|
16481
|
+
return recordedSchema ?? chunkJZYMOHHM_cjs.recordedReadSqlSchema(
|
|
16482
|
+
chunkJZYMOHHM_cjs.requireRecordedReadBinding(recordedReadBinding, surface)
|
|
16483
16483
|
);
|
|
16484
16484
|
}
|
|
16485
16485
|
async function recordedGetByIds(read) {
|
|
16486
16486
|
const { table, alias, kind, ids, coordinate, toEntity, entity } = read;
|
|
16487
16487
|
if (ids.length === 0) return [];
|
|
16488
16488
|
const uniqueIds = [...new Set(ids)];
|
|
16489
|
-
const aliasSql =
|
|
16489
|
+
const aliasSql = chunkYX3H63VV_cjs.sql.raw(alias);
|
|
16490
16490
|
const temporalFilter = recordedTemporalFilter(backend, coordinate, alias);
|
|
16491
16491
|
const chunkResults = await withRelationsPrecondition(
|
|
16492
16492
|
backend,
|
|
16493
16493
|
Promise.all(
|
|
16494
16494
|
chunkZDH3DX3C_cjs.chunk(uniqueIds, recordedPointReadIdChunk(backend)).map(
|
|
16495
16495
|
(idChunk) => backend.execute(
|
|
16496
|
-
|
|
16496
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
16497
16497
|
SELECT * FROM ${table} ${aliasSql}
|
|
16498
16498
|
WHERE ${aliasSql}.graph_id = ${graphId}
|
|
16499
16499
|
AND ${aliasSql}.kind = ${kind}
|
|
16500
|
-
AND ${aliasSql}.id IN (${
|
|
16500
|
+
AND ${aliasSql}.id IN (${chunkUCHW2MGP_cjs.sqlValueList(idChunk)})
|
|
16501
16501
|
AND ${temporalFilter}
|
|
16502
16502
|
ORDER BY ${aliasSql}.recorded_from
|
|
16503
16503
|
`)
|
|
@@ -16529,16 +16529,16 @@ function createRecordedReadService(params) {
|
|
|
16529
16529
|
const limit = validateRecordedScanLimit(options?.limit);
|
|
16530
16530
|
const scope = recordedScanCursorScope(graphId, entity, kind, coordinate);
|
|
16531
16531
|
const after = options?.after === void 0 ? void 0 : decodeRecordedScanCursor(options.after, scope);
|
|
16532
|
-
const aliasSql =
|
|
16532
|
+
const aliasSql = chunkYX3H63VV_cjs.sql.raw(alias);
|
|
16533
16533
|
const temporalFilter = recordedTemporalFilter(backend, coordinate, alias);
|
|
16534
16534
|
const rows = await withRelationsPrecondition(
|
|
16535
16535
|
backend,
|
|
16536
16536
|
backend.execute(
|
|
16537
|
-
|
|
16537
|
+
chunkYX3H63VV_cjs.asCompiledRowsSql(chunkYX3H63VV_cjs.sql`
|
|
16538
16538
|
SELECT * FROM ${table} ${aliasSql}
|
|
16539
16539
|
WHERE ${aliasSql}.graph_id = ${graphId}
|
|
16540
16540
|
AND ${aliasSql}.kind = ${kind}
|
|
16541
|
-
${after === void 0 ?
|
|
16541
|
+
${after === void 0 ? chunkYX3H63VV_cjs.sql.raw("") : chunkYX3H63VV_cjs.sql`AND ${aliasSql}.id > ${after}`}
|
|
16542
16542
|
AND ${temporalFilter}
|
|
16543
16543
|
ORDER BY ${aliasSql}.id ASC, ${aliasSql}.recorded_from ASC
|
|
16544
16544
|
LIMIT ${limit + 1}
|
|
@@ -16576,7 +16576,7 @@ function createRecordedReadService(params) {
|
|
|
16576
16576
|
kind,
|
|
16577
16577
|
ids,
|
|
16578
16578
|
coordinate,
|
|
16579
|
-
toEntity: (row) =>
|
|
16579
|
+
toEntity: (row) => chunkYIX3BEBR_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
16580
16580
|
});
|
|
16581
16581
|
}
|
|
16582
16582
|
function edgeGetByIds(kind, ids, coordinate) {
|
|
@@ -16588,7 +16588,7 @@ function createRecordedReadService(params) {
|
|
|
16588
16588
|
kind,
|
|
16589
16589
|
ids,
|
|
16590
16590
|
coordinate,
|
|
16591
|
-
toEntity: (row) =>
|
|
16591
|
+
toEntity: (row) => chunkYIX3BEBR_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
16592
16592
|
});
|
|
16593
16593
|
}
|
|
16594
16594
|
function nodeScan(kind, coordinate, options) {
|
|
@@ -16600,7 +16600,7 @@ function createRecordedReadService(params) {
|
|
|
16600
16600
|
kind,
|
|
16601
16601
|
coordinate,
|
|
16602
16602
|
options,
|
|
16603
|
-
toEntity: (row) =>
|
|
16603
|
+
toEntity: (row) => chunkYIX3BEBR_cjs.rowToNode(mapRecordedNodeRow(row))
|
|
16604
16604
|
});
|
|
16605
16605
|
}
|
|
16606
16606
|
function edgeScan(kind, coordinate, options) {
|
|
@@ -16612,13 +16612,13 @@ function createRecordedReadService(params) {
|
|
|
16612
16612
|
kind,
|
|
16613
16613
|
coordinate,
|
|
16614
16614
|
options,
|
|
16615
|
-
toEntity: (row) =>
|
|
16615
|
+
toEntity: (row) => chunkYIX3BEBR_cjs.rowToEdge(mapRecordedEdgeRow(row))
|
|
16616
16616
|
});
|
|
16617
16617
|
}
|
|
16618
16618
|
return {
|
|
16619
16619
|
backendForCoordinate(coordinate, surface) {
|
|
16620
16620
|
if (coordinate.recorded === void 0) return backend;
|
|
16621
|
-
|
|
16621
|
+
chunkJZYMOHHM_cjs.requireRecordedReadBinding(recordedReadBinding, surface);
|
|
16622
16622
|
return createRecordedReadBackend(backend, surface);
|
|
16623
16623
|
},
|
|
16624
16624
|
async nodeGetById(kind, id, coordinate) {
|
|
@@ -16833,8 +16833,8 @@ var CAUGHT_UP_VERB_DETAILS = {
|
|
|
16833
16833
|
}
|
|
16834
16834
|
};
|
|
16835
16835
|
var ROW_MAPPER_CONFIGS = {
|
|
16836
|
-
postgres:
|
|
16837
|
-
sqlite:
|
|
16836
|
+
postgres: chunk7UTUKH4E_cjs.POSTGRES_ROW_MAPPER_CONFIG,
|
|
16837
|
+
sqlite: chunk7UTUKH4E_cjs.SQLITE_ROW_MAPPER_CONFIG
|
|
16838
16838
|
};
|
|
16839
16839
|
function rowMapperConfigFor(backend) {
|
|
16840
16840
|
return ROW_MAPPER_CONFIGS[backend.dialect];
|
|
@@ -16848,7 +16848,7 @@ function transactionOutcome(result, recorder, recordedByGraph, graphId) {
|
|
|
16848
16848
|
return {
|
|
16849
16849
|
result,
|
|
16850
16850
|
receipt: recorder.snapshot(
|
|
16851
|
-
recorded === void 0 ? void 0 :
|
|
16851
|
+
recorded === void 0 ? void 0 : chunkLL5D5T5W_cjs.asRecordedInstant(recorded)
|
|
16852
16852
|
)
|
|
16853
16853
|
};
|
|
16854
16854
|
}
|
|
@@ -16870,7 +16870,7 @@ function syncStoreReplacementRef(ref, replacement) {
|
|
|
16870
16870
|
ref.current = replacement;
|
|
16871
16871
|
}
|
|
16872
16872
|
var StoreImplementation = class _StoreImplementation {
|
|
16873
|
-
[
|
|
16873
|
+
[chunkUCHW2MGP_cjs.STORE_RUNTIME];
|
|
16874
16874
|
#graph;
|
|
16875
16875
|
/**
|
|
16876
16876
|
* Bare backend for DDL, vector-storage, and bulk-materialization work that must
|
|
@@ -16905,11 +16905,11 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
16905
16905
|
this.#captureEnabled = options?.history === true;
|
|
16906
16906
|
this.#revisionTrackingEnabled = this.#captureEnabled || options?.revisionTracking === true;
|
|
16907
16907
|
if (this.#revisionTrackingEnabled) {
|
|
16908
|
-
|
|
16908
|
+
chunkUCHW2MGP_cjs.assertRevisionTrackableBackend(backend);
|
|
16909
16909
|
}
|
|
16910
|
-
const explicitSchema = options?.schema === void 0 ? void 0 :
|
|
16911
|
-
const resolvedSchema = explicitSchema ?? (backend.tableNames ?
|
|
16912
|
-
const readSchema = resolvedSchema ??
|
|
16910
|
+
const explicitSchema = options?.schema === void 0 ? void 0 : chunkJZYMOHHM_cjs.requireSqlSchema(options.schema, "store schema");
|
|
16911
|
+
const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunkJZYMOHHM_cjs.createSqlSchema(backend.tableNames) : void 0);
|
|
16912
|
+
const readSchema = resolvedSchema ?? chunkJZYMOHHM_cjs.createSqlSchema(backend.tableNames);
|
|
16913
16913
|
if (this.#captureEnabled && options?.recordedRead !== void 0) {
|
|
16914
16914
|
throw new chunkSAFZ6JTI_cjs.ConfigurationError(
|
|
16915
16915
|
"recordedRead cannot be combined with history: true.",
|
|
@@ -16919,26 +16919,26 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
16919
16919
|
}
|
|
16920
16920
|
);
|
|
16921
16921
|
}
|
|
16922
|
-
const externalRecordedRead =
|
|
16922
|
+
const externalRecordedRead = chunkJZYMOHHM_cjs.requireExternalRecordedReadSource(
|
|
16923
16923
|
options?.recordedRead
|
|
16924
16924
|
);
|
|
16925
|
-
this.#recordedReadBinding = this.#captureEnabled ?
|
|
16926
|
-
this.#backend = this.#captureEnabled ? asGraphWriteBackend(
|
|
16925
|
+
this.#recordedReadBinding = this.#captureEnabled ? chunkJZYMOHHM_cjs.createRecordedReadBinding(readSchema) : externalRecordedRead;
|
|
16926
|
+
this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunkUCHW2MGP_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
|
|
16927
16927
|
this.#schema = resolvedSchema;
|
|
16928
16928
|
const rowMapperConfig = rowMapperConfigFor(this.#backend);
|
|
16929
16929
|
this.#recordedReads = createRecordedReadService({
|
|
16930
16930
|
graphId: graph.id,
|
|
16931
16931
|
backend: this.#backend,
|
|
16932
16932
|
recordedReadBinding: this.#recordedReadBinding,
|
|
16933
|
-
mapRecordedNodeRow:
|
|
16934
|
-
mapRecordedEdgeRow:
|
|
16933
|
+
mapRecordedNodeRow: chunk7UTUKH4E_cjs.createNodeRowMapper(rowMapperConfig),
|
|
16934
|
+
mapRecordedEdgeRow: chunk7UTUKH4E_cjs.createEdgeRowMapper(rowMapperConfig)
|
|
16935
16935
|
});
|
|
16936
|
-
this.#registry =
|
|
16936
|
+
this.#registry = chunkK4FB2RMO_cjs.buildKindRegistry(graph);
|
|
16937
16937
|
this.#hooks = options?.hooks ?? {};
|
|
16938
16938
|
this.#defaultTraversalExpansion = options?.queryDefaults?.traversalExpansion ?? "inverse";
|
|
16939
16939
|
this.#options = options;
|
|
16940
16940
|
this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
|
|
16941
|
-
this[
|
|
16941
|
+
this[chunkUCHW2MGP_cjs.STORE_RUNTIME] = {
|
|
16942
16942
|
backend: this.#backend,
|
|
16943
16943
|
sealedQuery: (coordinate) => this.sealedQuery(coordinate),
|
|
16944
16944
|
recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
|
|
@@ -16950,7 +16950,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
16950
16950
|
subgraphAtCoordinate: (rootId, subgraphOptions) => this.subgraphAtCoordinate(rootId, subgraphOptions),
|
|
16951
16951
|
algorithmsAtCoordinate: (coordinate) => this.algorithmsAtCoordinate(coordinate)
|
|
16952
16952
|
};
|
|
16953
|
-
Object.defineProperty(this,
|
|
16953
|
+
Object.defineProperty(this, chunkUCHW2MGP_cjs.STORE_RUNTIME, {
|
|
16954
16954
|
configurable: false,
|
|
16955
16955
|
enumerable: false,
|
|
16956
16956
|
writable: false
|
|
@@ -17250,7 +17250,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17250
17250
|
async #maybeRefreshStatisticsAfterBulk(rowCount) {
|
|
17251
17251
|
const configured = this.#options?.autoRefreshStatistics;
|
|
17252
17252
|
if (configured === false) return;
|
|
17253
|
-
const threshold = configured ??
|
|
17253
|
+
const threshold = configured ?? chunkUCHW2MGP_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
|
|
17254
17254
|
if (rowCount < threshold) return;
|
|
17255
17255
|
try {
|
|
17256
17256
|
await this.refreshStatistics();
|
|
@@ -17264,13 +17264,13 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17264
17264
|
#buildNodeOperations(ctx) {
|
|
17265
17265
|
return {
|
|
17266
17266
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
17267
|
-
rowToNode: (row) =>
|
|
17267
|
+
rowToNode: (row) => chunkYIX3BEBR_cjs.rowToNode(row),
|
|
17268
17268
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
17269
|
-
executeCreate: (input, backend) =>
|
|
17270
|
-
executeCreateBatch: (inputs, backend) =>
|
|
17271
|
-
executeCreateNoReturnBatch: (inputs, backend) =>
|
|
17272
|
-
executeUpdate: (input, backend, options) =>
|
|
17273
|
-
executeUpsertUpdate: (input, backend, options) =>
|
|
17269
|
+
executeCreate: (input, backend) => chunkYIX3BEBR_cjs.executeNodeCreate(ctx, input, backend),
|
|
17270
|
+
executeCreateBatch: (inputs, backend) => chunkYIX3BEBR_cjs.executeNodeCreateBatch(ctx, inputs, backend),
|
|
17271
|
+
executeCreateNoReturnBatch: (inputs, backend) => chunkYIX3BEBR_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
|
|
17272
|
+
executeUpdate: (input, backend, options) => chunkYIX3BEBR_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
|
|
17273
|
+
executeUpsertUpdate: (input, backend, options) => chunkYIX3BEBR_cjs.executeNodeUpsertUpdate(
|
|
17274
17274
|
ctx,
|
|
17275
17275
|
{ ...input, id: input.id },
|
|
17276
17276
|
backend,
|
|
@@ -17278,13 +17278,13 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17278
17278
|
),
|
|
17279
17279
|
// Present only when opted in; its absence is the coalesce off switch.
|
|
17280
17280
|
...this.#options?.coalesceUnchangedUpserts === true && {
|
|
17281
|
-
upsertDirtyCheck: (kind, id, existingProps, inputProps) =>
|
|
17281
|
+
upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunkYIX3BEBR_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
|
|
17282
17282
|
},
|
|
17283
|
-
executeDelete: (kind, id, backend) =>
|
|
17284
|
-
executeHardDelete: (kind, id, backend) =>
|
|
17283
|
+
executeDelete: (kind, id, backend) => chunkYIX3BEBR_cjs.executeNodeDelete(ctx, kind, id, backend),
|
|
17284
|
+
executeHardDelete: (kind, id, backend) => chunkYIX3BEBR_cjs.executeNodeHardDelete(ctx, kind, id, backend),
|
|
17285
17285
|
temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
|
|
17286
17286
|
createQuery: () => this.query(),
|
|
17287
|
-
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) =>
|
|
17287
|
+
executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkYIX3BEBR_cjs.executeNodeGetOrCreateByConstraint(
|
|
17288
17288
|
ctx,
|
|
17289
17289
|
kind,
|
|
17290
17290
|
constraintName,
|
|
@@ -17292,7 +17292,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17292
17292
|
backend,
|
|
17293
17293
|
options
|
|
17294
17294
|
),
|
|
17295
|
-
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) =>
|
|
17295
|
+
executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkYIX3BEBR_cjs.executeNodeBulkGetOrCreateByConstraint(
|
|
17296
17296
|
ctx,
|
|
17297
17297
|
kind,
|
|
17298
17298
|
constraintName,
|
|
@@ -17300,15 +17300,15 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17300
17300
|
backend,
|
|
17301
17301
|
options
|
|
17302
17302
|
),
|
|
17303
|
-
executeFindByConstraint: (kind, constraintName, props, backend) =>
|
|
17304
|
-
executeBulkFindByConstraint: (kind, constraintName, items, backend) =>
|
|
17303
|
+
executeFindByConstraint: (kind, constraintName, props, backend) => chunkYIX3BEBR_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
|
|
17304
|
+
executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunkYIX3BEBR_cjs.executeNodeBulkFindByConstraint(
|
|
17305
17305
|
ctx,
|
|
17306
17306
|
kind,
|
|
17307
17307
|
constraintName,
|
|
17308
17308
|
items,
|
|
17309
17309
|
backend
|
|
17310
17310
|
),
|
|
17311
|
-
executeBulkFindByIndex: (kind, indexName, items, backend, options) =>
|
|
17311
|
+
executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkYIX3BEBR_cjs.executeNodeBulkFindByIndex(
|
|
17312
17312
|
ctx,
|
|
17313
17313
|
kind,
|
|
17314
17314
|
indexName,
|
|
@@ -17327,7 +17327,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17327
17327
|
#buildEdgeOperations(ctx) {
|
|
17328
17328
|
return {
|
|
17329
17329
|
defaultTemporalMode: this.#graph.defaults.temporalMode,
|
|
17330
|
-
rowToEdge: (row) =>
|
|
17330
|
+
rowToEdge: (row) => chunkYIX3BEBR_cjs.rowToEdge(row),
|
|
17331
17331
|
maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
|
|
17332
17332
|
executeCreate: (input, backend) => executeEdgeCreate(ctx, input, backend),
|
|
17333
17333
|
executeCreateBatch: (inputs, backend) => executeEdgeCreateBatch(ctx, inputs, backend),
|
|
@@ -17401,7 +17401,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17401
17401
|
);
|
|
17402
17402
|
}
|
|
17403
17403
|
#sqlSchema() {
|
|
17404
|
-
return this.#schema ??
|
|
17404
|
+
return this.#schema ?? chunkJZYMOHHM_cjs.createSqlSchema(this.#backend.tableNames);
|
|
17405
17405
|
}
|
|
17406
17406
|
/**
|
|
17407
17407
|
* Internal seam for {@link RecordedStoreView}: reconstruct a node point read
|
|
@@ -17478,36 +17478,39 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17478
17478
|
* Returns a narrow read-only view pinned to a recorded/system-time instant.
|
|
17479
17479
|
*
|
|
17480
17480
|
* Direct `store.asOfRecorded(T)` is diagonal bitemporal sugar: it reads the
|
|
17481
|
-
* recorded-time relation
|
|
17482
|
-
*
|
|
17483
|
-
*
|
|
17481
|
+
* recorded-time relation at the anchor's logical revision and uses the
|
|
17482
|
+
* anchor's wall-time component for the valid-time axis. Use
|
|
17483
|
+
* `store.asOf(validT).asOfRecorded(recordedT)` when the valid and recorded
|
|
17484
|
+
* axes should differ.
|
|
17484
17485
|
*
|
|
17485
17486
|
* The returned view exposes only reconstructing-safe reads: query,
|
|
17486
17487
|
* subgraph, graph algorithms, and collection point reads.
|
|
17487
17488
|
*
|
|
17488
|
-
* Prefer `await store.recordedNow()`
|
|
17489
|
-
*
|
|
17490
|
-
* wall
|
|
17491
|
-
*
|
|
17489
|
+
* Prefer `await store.recordedNow()` over a wall-clock timestamp. The anchor
|
|
17490
|
+
* carries both the graph's strict logical revision and a non-decreasing
|
|
17491
|
+
* physical wall-time high-water mark, so several commits in one millisecond
|
|
17492
|
+
* remain independently addressable without manufacturing timestamp
|
|
17493
|
+
* increments.
|
|
17492
17494
|
*/
|
|
17493
17495
|
asOfRecorded(recordedAsOf) {
|
|
17494
|
-
const validCoordinate =
|
|
17496
|
+
const validCoordinate = chunkLL5D5T5W_cjs.resolveReadCoordinate(
|
|
17495
17497
|
"asOf",
|
|
17496
|
-
recordedAsOf,
|
|
17498
|
+
chunkLL5D5T5W_cjs.recordedInstantWallTime(recordedAsOf),
|
|
17497
17499
|
"Use await store.recordedNow() as the anchor, or asRecordedInstant(value) only for an instant previously read from recordedNow()."
|
|
17498
17500
|
);
|
|
17499
17501
|
return new RecordedStoreView(
|
|
17500
17502
|
this,
|
|
17501
|
-
|
|
17503
|
+
chunkLL5D5T5W_cjs.withRecordedCoordinate(validCoordinate, recordedAsOf)
|
|
17502
17504
|
);
|
|
17503
17505
|
}
|
|
17504
17506
|
/**
|
|
17505
17507
|
* Returns the latest recorded-time instant captured for this graph — the
|
|
17506
17508
|
* recorded high-water mark. After guarding the `undefined` case,
|
|
17507
17509
|
* `store.asOfRecorded(checkpoint)` reconstructs everything committed so far, a
|
|
17508
|
-
* deterministic anchor that avoids guessing with the wall clock
|
|
17509
|
-
*
|
|
17510
|
-
*
|
|
17510
|
+
* deterministic anchor that avoids guessing with the wall clock. Its logical
|
|
17511
|
+
* revision is strictly monotonic per graph while its timestamp is a
|
|
17512
|
+
* non-decreasing physical wall-time high-water mark. Capture each anchor right
|
|
17513
|
+
* after the writes it should cover.
|
|
17511
17514
|
*
|
|
17512
17515
|
* Returns `undefined` until the first write has been captured, so on a
|
|
17513
17516
|
* brand-new graph guard the composition — `asOfRecorded(undefined)` rejects
|
|
@@ -17535,10 +17538,10 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17535
17538
|
);
|
|
17536
17539
|
}
|
|
17537
17540
|
const recordedAt = await chunkHP6LWBLB_cjs.withRecordedRelationsPrecondition(
|
|
17538
|
-
|
|
17541
|
+
chunkUCHW2MGP_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
|
|
17539
17542
|
{ dialect: this.#backend.dialect, surface: "recorded-now" }
|
|
17540
17543
|
);
|
|
17541
|
-
return recordedAt === void 0 ? void 0 :
|
|
17544
|
+
return recordedAt === void 0 ? void 0 : chunkLL5D5T5W_cjs.asRecordedInstant(recordedAt);
|
|
17542
17545
|
}
|
|
17543
17546
|
/**
|
|
17544
17547
|
* Returns the durable graph revision used by graph branching. It is undefined
|
|
@@ -17550,7 +17553,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17550
17553
|
*/
|
|
17551
17554
|
async revisionNow() {
|
|
17552
17555
|
if (!this.#revisionTrackingEnabled) return void 0;
|
|
17553
|
-
return
|
|
17556
|
+
return chunkUCHW2MGP_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
|
|
17554
17557
|
}
|
|
17555
17558
|
/**
|
|
17556
17559
|
* Returns the durable random namespace for this graph's revision clock. A
|
|
@@ -17567,7 +17570,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17567
17570
|
{ code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
|
|
17568
17571
|
);
|
|
17569
17572
|
}
|
|
17570
|
-
const pendingOrigin = this.#revisionOrigin ??
|
|
17573
|
+
const pendingOrigin = this.#revisionOrigin ?? chunkUCHW2MGP_cjs.ensureRevisionOrigin(this.#baseBackend, this.#sqlSchema(), this.graphId);
|
|
17571
17574
|
this.#revisionOrigin = pendingOrigin;
|
|
17572
17575
|
try {
|
|
17573
17576
|
return await pendingOrigin;
|
|
@@ -17613,7 +17616,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17613
17616
|
* ```
|
|
17614
17617
|
*/
|
|
17615
17618
|
snapshot() {
|
|
17616
|
-
return this.asOf(
|
|
17619
|
+
return this.asOf(chunkMNURF4RF_cjs.nowIso());
|
|
17617
17620
|
}
|
|
17618
17621
|
// === Search ===
|
|
17619
17622
|
/**
|
|
@@ -17692,7 +17695,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17692
17695
|
* @returns A tuple with per-query typed results, preserving input order
|
|
17693
17696
|
*/
|
|
17694
17697
|
async batch(...queries) {
|
|
17695
|
-
return
|
|
17698
|
+
return chunkQYDUCWD2_cjs.runOptionallyInTransaction(this.#baseBackend, async (target) => {
|
|
17696
17699
|
const results = [];
|
|
17697
17700
|
for (const query of queries) {
|
|
17698
17701
|
const result = await query.executeOn(target);
|
|
@@ -17745,11 +17748,11 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17745
17748
|
* @internal
|
|
17746
17749
|
*/
|
|
17747
17750
|
subgraphAtCoordinate(rootId, options) {
|
|
17748
|
-
const coordinate =
|
|
17751
|
+
const coordinate = chunkLL5D5T5W_cjs.resolveReadCoordinate(
|
|
17749
17752
|
options.temporalMode ?? this.#graph.defaults.temporalMode,
|
|
17750
17753
|
options.asOf
|
|
17751
17754
|
);
|
|
17752
|
-
const readCoordinate = options.recordedAsOf === void 0 ? coordinate :
|
|
17755
|
+
const readCoordinate = options.recordedAsOf === void 0 ? coordinate : chunkLL5D5T5W_cjs.withRecordedCoordinate(coordinate, options.recordedAsOf);
|
|
17753
17756
|
return executeSubgraph({
|
|
17754
17757
|
graph: this.#graph,
|
|
17755
17758
|
graphId: this.graphId,
|
|
@@ -17758,7 +17761,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17758
17761
|
readCoordinate,
|
|
17759
17762
|
"recorded-subgraph"
|
|
17760
17763
|
),
|
|
17761
|
-
dialect:
|
|
17764
|
+
dialect: chunkHAQVISUF_cjs.getDialect(this.#backend.dialect),
|
|
17762
17765
|
schema: this.#schema,
|
|
17763
17766
|
recordedReadBinding: this.#recordedReadBinding,
|
|
17764
17767
|
options
|
|
@@ -17820,8 +17823,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17820
17823
|
edges,
|
|
17821
17824
|
// No real transaction: `tx.sql` is absent and there is no atomicity.
|
|
17822
17825
|
sqlAvailability: "unavailable",
|
|
17823
|
-
backend:
|
|
17824
|
-
[
|
|
17826
|
+
backend: chunkQYDUCWD2_cjs.createTransactionReadBackend(this.#backend),
|
|
17827
|
+
[chunkUCHW2MGP_cjs.TRANSACTION_RUNTIME]: {
|
|
17825
17828
|
backend: this.#backend,
|
|
17826
17829
|
runNodeOperationHooks: (operation, kind, id, hookedFunction) => this.#withOperationHooks(
|
|
17827
17830
|
this.#createOperationContext(operation, "node", kind, id),
|
|
@@ -17830,7 +17833,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17830
17833
|
},
|
|
17831
17834
|
getNodeCollection: (kind) => this.#resolveDynamicNodeCollection(nodes, kind)
|
|
17832
17835
|
};
|
|
17833
|
-
Object.defineProperty(fallbackContext,
|
|
17836
|
+
Object.defineProperty(fallbackContext, chunkUCHW2MGP_cjs.TRANSACTION_RUNTIME, {
|
|
17834
17837
|
configurable: false,
|
|
17835
17838
|
enumerable: false,
|
|
17836
17839
|
writable: false
|
|
@@ -17843,7 +17846,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17843
17846
|
const pending = [];
|
|
17844
17847
|
const runHooks = this.#createBufferedHookRunner(pending);
|
|
17845
17848
|
let recordedByGraph;
|
|
17846
|
-
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ?
|
|
17849
|
+
const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunkUCHW2MGP_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
|
|
17847
17850
|
recordedByGraph = instants;
|
|
17848
17851
|
}) : backendOptions;
|
|
17849
17852
|
try {
|
|
@@ -17952,7 +17955,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17952
17955
|
*/
|
|
17953
17956
|
withTransaction(externalTx) {
|
|
17954
17957
|
if (this.#captureEnabled) {
|
|
17955
|
-
throw
|
|
17958
|
+
throw chunkUCHW2MGP_cjs.recordedCaptureRequiresCallbackTransactionError();
|
|
17956
17959
|
}
|
|
17957
17960
|
const adopt = this.#adapterBackend?.adoptTransaction;
|
|
17958
17961
|
if (adopt === void 0) {
|
|
@@ -17976,14 +17979,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
17976
17979
|
}
|
|
17977
17980
|
const txBackend = adopt(externalTx);
|
|
17978
17981
|
if (this.#captureEnabled) {
|
|
17979
|
-
await
|
|
17982
|
+
await chunkUCHW2MGP_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
|
|
17980
17983
|
}
|
|
17981
|
-
const scope = this.#captureEnabled ?
|
|
17984
|
+
const scope = this.#captureEnabled ? chunkUCHW2MGP_cjs.createRecordedTransactionScope(txBackend, this.#sqlSchema()) : {
|
|
17982
17985
|
backend: txBackend,
|
|
17983
17986
|
flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
|
|
17984
17987
|
};
|
|
17985
17988
|
if (this.#captureEnabled) {
|
|
17986
|
-
await
|
|
17989
|
+
await chunkUCHW2MGP_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
|
|
17987
17990
|
}
|
|
17988
17991
|
const receiptRecorder = createTransactionReceiptRecorder();
|
|
17989
17992
|
const invoke = fn;
|
|
@@ -18085,8 +18088,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18085
18088
|
const base = {
|
|
18086
18089
|
nodes,
|
|
18087
18090
|
edges,
|
|
18088
|
-
backend:
|
|
18089
|
-
[
|
|
18091
|
+
backend: chunkQYDUCWD2_cjs.createTransactionReadBackend(txBackend),
|
|
18092
|
+
[chunkUCHW2MGP_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
|
|
18090
18093
|
getNodeCollection
|
|
18091
18094
|
};
|
|
18092
18095
|
let withSql;
|
|
@@ -18095,7 +18098,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18095
18098
|
...base,
|
|
18096
18099
|
sqlAvailability: "history"
|
|
18097
18100
|
};
|
|
18098
|
-
defineUnavailableSqlGuard(withSql, () =>
|
|
18101
|
+
defineUnavailableSqlGuard(withSql, () => chunkUCHW2MGP_cjs.throwHistoryUnsafeSqlAccess());
|
|
18099
18102
|
} else if (this.#revisionTrackingEnabled) {
|
|
18100
18103
|
withSql = {
|
|
18101
18104
|
...base,
|
|
@@ -18103,14 +18106,14 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18103
18106
|
};
|
|
18104
18107
|
defineUnavailableSqlGuard(
|
|
18105
18108
|
withSql,
|
|
18106
|
-
() =>
|
|
18109
|
+
() => chunkUCHW2MGP_cjs.throwRevisionTrackingUnsafeSqlAccess()
|
|
18107
18110
|
);
|
|
18108
18111
|
} else if (sql2 === void 0) {
|
|
18109
18112
|
withSql = { ...base, sqlAvailability: "unavailable" };
|
|
18110
18113
|
} else {
|
|
18111
18114
|
withSql = { ...base, sql: sql2, sqlAvailability: "available" };
|
|
18112
18115
|
}
|
|
18113
|
-
Object.defineProperty(withSql,
|
|
18116
|
+
Object.defineProperty(withSql, chunkUCHW2MGP_cjs.TRANSACTION_RUNTIME, {
|
|
18114
18117
|
configurable: false,
|
|
18115
18118
|
enumerable: false,
|
|
18116
18119
|
writable: false
|
|
@@ -18130,12 +18133,12 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18130
18133
|
async clear() {
|
|
18131
18134
|
const doClear = async (target) => {
|
|
18132
18135
|
if (this.#revisionTrackingEnabled) {
|
|
18133
|
-
await
|
|
18136
|
+
await chunkUCHW2MGP_cjs.lockRecordedGraphWrite(target, this.graphId);
|
|
18134
18137
|
}
|
|
18135
|
-
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await
|
|
18138
|
+
const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunkUCHW2MGP_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
|
|
18136
18139
|
await target.clearGraph(this.graphId);
|
|
18137
18140
|
if (this.#revisionTrackingEnabled && !this.#captureEnabled) {
|
|
18138
|
-
await
|
|
18141
|
+
await chunkUCHW2MGP_cjs.advanceRevisionClock(
|
|
18139
18142
|
target,
|
|
18140
18143
|
this.#sqlSchema(),
|
|
18141
18144
|
this.graphId,
|
|
@@ -18263,7 +18266,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18263
18266
|
*/
|
|
18264
18267
|
async evolve(extension, options) {
|
|
18265
18268
|
const { activeRow, baseline } = await this.#loadCaughtUp("evolve");
|
|
18266
|
-
const merged =
|
|
18269
|
+
const merged = chunkK4FB2RMO_cjs.mergeGraphExtension(baseline, extension);
|
|
18267
18270
|
if (merged === baseline) {
|
|
18268
18271
|
if (baseline === this.#graph) {
|
|
18269
18272
|
syncStoreReplacementRef(options?.ref, this);
|
|
@@ -18299,7 +18302,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18299
18302
|
);
|
|
18300
18303
|
if (error !== void 0) throw error;
|
|
18301
18304
|
}
|
|
18302
|
-
const committed = await
|
|
18305
|
+
const committed = await chunkK4FB2RMO_cjs.commitNewSchemaVersion(
|
|
18303
18306
|
this.#backend,
|
|
18304
18307
|
merged,
|
|
18305
18308
|
activeRow.version
|
|
@@ -18520,7 +18523,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18520
18523
|
tableName,
|
|
18521
18524
|
declaration
|
|
18522
18525
|
);
|
|
18523
|
-
const now =
|
|
18526
|
+
const now = chunkMNURF4RF_cjs.nowIso();
|
|
18524
18527
|
await backend.recordIndexMaterialization({
|
|
18525
18528
|
indexName: vectorStatusKey(this.graphId, declaration.name),
|
|
18526
18529
|
graphId: this.graphId,
|
|
@@ -18623,9 +18626,9 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18623
18626
|
);
|
|
18624
18627
|
}
|
|
18625
18628
|
const compileTimeGraph = stripGraphExtension(this.#graph);
|
|
18626
|
-
const merged = plan.document === void 0 ? compileTimeGraph :
|
|
18627
|
-
const finalGraph =
|
|
18628
|
-
const committedRow = await
|
|
18629
|
+
const merged = plan.document === void 0 ? compileTimeGraph : chunkK4FB2RMO_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
|
|
18630
|
+
const finalGraph = chunkK4FB2RMO_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
|
|
18631
|
+
const committedRow = await chunkK4FB2RMO_cjs.commitNewSchemaVersion(
|
|
18629
18632
|
this.#backend,
|
|
18630
18633
|
finalGraph,
|
|
18631
18634
|
activeRow.version
|
|
@@ -18635,7 +18638,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18635
18638
|
if (this.#backend.ensureKindRemovalsTable !== void 0) {
|
|
18636
18639
|
await this.#backend.ensureKindRemovalsTable();
|
|
18637
18640
|
}
|
|
18638
|
-
const attemptedAt =
|
|
18641
|
+
const attemptedAt = chunkMNURF4RF_cjs.nowIso();
|
|
18639
18642
|
const newSchemaVersion = committedRow.version;
|
|
18640
18643
|
const queue = (kindName, entity) => recordKindRemoval(
|
|
18641
18644
|
buildPendingKindRemoval({
|
|
@@ -18713,8 +18716,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18713
18716
|
schemaMetadataFromRow(activeRow)
|
|
18714
18717
|
);
|
|
18715
18718
|
}
|
|
18716
|
-
const merged =
|
|
18717
|
-
const result = await
|
|
18719
|
+
const merged = chunkK4FB2RMO_cjs.applyDeprecatedKinds(baseline, nextSet);
|
|
18720
|
+
const result = await chunkK4FB2RMO_cjs.ensureSchema(this.#backend, merged, {
|
|
18718
18721
|
preloaded: { activeRow, storedSchema },
|
|
18719
18722
|
autoMigrate: true
|
|
18720
18723
|
});
|
|
@@ -18723,8 +18726,8 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18723
18726
|
}
|
|
18724
18727
|
#catchUpToStored(storedSchema) {
|
|
18725
18728
|
const compileTimeGraph = stripGraphExtension(this.#graph);
|
|
18726
|
-
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph :
|
|
18727
|
-
return
|
|
18729
|
+
const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkK4FB2RMO_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
|
|
18730
|
+
return chunkK4FB2RMO_cjs.applyDeprecatedKinds(
|
|
18728
18731
|
withGraphExtension,
|
|
18729
18732
|
storedSchema.deprecatedKinds
|
|
18730
18733
|
);
|
|
@@ -18742,7 +18745,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18742
18745
|
* serializes the actual commit.
|
|
18743
18746
|
*/
|
|
18744
18747
|
async #loadCaughtUp(verb) {
|
|
18745
|
-
const activeRow = await
|
|
18748
|
+
const activeRow = await chunkK4FB2RMO_cjs.loadActiveSchemaWithBootstrap(
|
|
18746
18749
|
this.#backend,
|
|
18747
18750
|
this.graphId
|
|
18748
18751
|
);
|
|
@@ -18753,7 +18756,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18753
18756
|
{ code }
|
|
18754
18757
|
);
|
|
18755
18758
|
}
|
|
18756
|
-
const storedSchema =
|
|
18759
|
+
const storedSchema = chunkK4FB2RMO_cjs.parseSerializedSchema(activeRow.schema_doc);
|
|
18757
18760
|
const baseline = this.#catchUpToStored(storedSchema);
|
|
18758
18761
|
return { activeRow, storedSchema, baseline };
|
|
18759
18762
|
}
|
|
@@ -18852,7 +18855,7 @@ var StoreImplementation = class _StoreImplementation {
|
|
|
18852
18855
|
// === Internal: Hook Helpers ===
|
|
18853
18856
|
#createHookContext() {
|
|
18854
18857
|
return {
|
|
18855
|
-
operationId:
|
|
18858
|
+
operationId: chunkUCHW2MGP_cjs.generateId(),
|
|
18856
18859
|
graphId: this.graphId,
|
|
18857
18860
|
startedAt: /* @__PURE__ */ new Date()
|
|
18858
18861
|
};
|
|
@@ -18953,8 +18956,8 @@ var AdapterStoreImplementation = class extends StoreImplementation {
|
|
|
18953
18956
|
backend;
|
|
18954
18957
|
constructor(graph, backend, options, schemaMetadata) {
|
|
18955
18958
|
super(graph, backend, options, schemaMetadata, backend);
|
|
18956
|
-
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[
|
|
18957
|
-
|
|
18959
|
+
this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[chunkUCHW2MGP_cjs.STORE_RUNTIME].backend) : Object.freeze(
|
|
18960
|
+
chunkUCHW2MGP_cjs.createGraphBackendProjection(this[chunkUCHW2MGP_cjs.STORE_RUNTIME].backend)
|
|
18958
18961
|
);
|
|
18959
18962
|
}
|
|
18960
18963
|
async evolve(extension, options) {
|
|
@@ -19098,16 +19101,22 @@ async function createStoreWithSchema(graph, backend, options) {
|
|
|
19098
19101
|
prepared.result
|
|
19099
19102
|
];
|
|
19100
19103
|
}
|
|
19104
|
+
async function assertHistorySchemaOnOpen(backend, options) {
|
|
19105
|
+
if (options?.history !== true) return;
|
|
19106
|
+
const schema = options.schema === void 0 ? chunkJZYMOHHM_cjs.createSqlSchema(backend.tableNames) : chunkJZYMOHHM_cjs.requireSqlSchema(options.schema, "store schema");
|
|
19107
|
+
await chunkUCHW2MGP_cjs.assertCurrentRecordedSchema(backend, schema);
|
|
19108
|
+
}
|
|
19101
19109
|
async function prepareStoreWithSchema(graph, backend, options) {
|
|
19102
19110
|
const {
|
|
19103
19111
|
graph: merged,
|
|
19104
19112
|
activeRow,
|
|
19105
19113
|
storedSchema
|
|
19106
|
-
} = await
|
|
19107
|
-
const result = await
|
|
19114
|
+
} = await chunkK4FB2RMO_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
|
|
19115
|
+
const result = await chunkK4FB2RMO_cjs.ensureSchema(backend, merged, {
|
|
19108
19116
|
...options,
|
|
19109
19117
|
preloaded: { activeRow, storedSchema }
|
|
19110
19118
|
});
|
|
19119
|
+
await assertHistorySchemaOnOpen(backend, options);
|
|
19111
19120
|
await materializeRuntimeContributions(backend, merged.id);
|
|
19112
19121
|
await materializeVectorContributions(backend, merged);
|
|
19113
19122
|
if (options?.systemIndexes !== "skip") {
|
|
@@ -19158,7 +19167,7 @@ async function materializeSystemIndexesOnBoot(backend, graphId, result) {
|
|
|
19158
19167
|
}
|
|
19159
19168
|
}
|
|
19160
19169
|
async function createVerifiedStore(graph, backend, options) {
|
|
19161
|
-
const prepared = await prepareVerifiedStore(graph, backend);
|
|
19170
|
+
const prepared = await prepareVerifiedStore(graph, backend, options);
|
|
19162
19171
|
return [
|
|
19163
19172
|
new StoreImplementation(
|
|
19164
19173
|
prepared.graph,
|
|
@@ -19169,12 +19178,13 @@ async function createVerifiedStore(graph, backend, options) {
|
|
|
19169
19178
|
prepared.result
|
|
19170
19179
|
];
|
|
19171
19180
|
}
|
|
19172
|
-
async function prepareVerifiedStore(graph, backend) {
|
|
19181
|
+
async function prepareVerifiedStore(graph, backend, options) {
|
|
19173
19182
|
const {
|
|
19174
19183
|
graph: merged,
|
|
19175
19184
|
activeRow,
|
|
19176
19185
|
result
|
|
19177
|
-
} = await
|
|
19186
|
+
} = await chunkK4FB2RMO_cjs.loadAndVerifyGraph(backend, graph);
|
|
19187
|
+
await assertHistorySchemaOnOpen(backend, options);
|
|
19178
19188
|
return {
|
|
19179
19189
|
graph: merged,
|
|
19180
19190
|
result,
|
|
@@ -19182,7 +19192,7 @@ async function prepareVerifiedStore(graph, backend) {
|
|
|
19182
19192
|
};
|
|
19183
19193
|
}
|
|
19184
19194
|
async function createVerifiedAdapterStore(graph, backend, options) {
|
|
19185
|
-
const prepared = await prepareVerifiedStore(graph, backend);
|
|
19195
|
+
const prepared = await prepareVerifiedStore(graph, backend, options);
|
|
19186
19196
|
return [
|
|
19187
19197
|
asAdapterStoreSurface(
|
|
19188
19198
|
new AdapterStoreImplementation(
|
|
@@ -19234,5 +19244,5 @@ exports.min = min;
|
|
|
19234
19244
|
exports.offsetFragment = offsetFragment;
|
|
19235
19245
|
exports.orderByFragment = orderByFragment;
|
|
19236
19246
|
exports.sum = sum;
|
|
19237
|
-
//# sourceMappingURL=chunk-
|
|
19238
|
-
//# sourceMappingURL=chunk-
|
|
19247
|
+
//# sourceMappingURL=chunk-H6I36MGT.cjs.map
|
|
19248
|
+
//# sourceMappingURL=chunk-H6I36MGT.cjs.map
|