@nicia-ai/typegraph 0.50.0 → 0.51.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/README.md +12 -0
- package/dist/backend/drizzle/indexes.cjs +10 -8
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/drizzle/indexes.js +6 -4
- package/dist/backend/index.cjs +183 -50
- package/dist/backend/index.d.cts +90 -4
- package/dist/backend/index.d.ts +90 -4
- package/dist/backend/index.js +6 -9
- package/dist/backend/postgres/index.cjs +30 -28
- package/dist/backend/postgres/index.d.cts +7 -7
- package/dist/backend/postgres/index.d.ts +7 -7
- package/dist/backend/postgres/index.js +16 -14
- package/dist/backend/postgres/pglite-store.cjs +6 -62
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +8 -8
- package/dist/backend/postgres/pglite-store.d.ts +8 -8
- package/dist/backend/postgres/pglite-store.js +6 -62
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +18 -16
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +17 -15
- package/dist/backend/sqlite/index.cjs +27 -25
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +14 -12
- package/dist/backend/sqlite/libsql.cjs +21 -19
- 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 +16 -14
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +8 -64
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +8 -8
- package/dist/backend/sqlite/local-store.d.ts +8 -8
- package/dist/backend/sqlite/local-store.js +7 -64
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +22 -19
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +18 -15
- package/dist/{chunk-TUVD4DFR.cjs → chunk-2CVDZCXH.cjs} +122 -51
- package/dist/chunk-2CVDZCXH.cjs.map +1 -0
- package/dist/{chunk-I5C6OTKR.js → chunk-2DWTBNSH.js} +3 -3
- package/dist/{chunk-I5C6OTKR.js.map → chunk-2DWTBNSH.js.map} +1 -1
- package/dist/{chunk-C76WFIVZ.cjs → chunk-2KCTP3U2.cjs} +180 -127
- package/dist/chunk-2KCTP3U2.cjs.map +1 -0
- package/dist/{chunk-BYBDM423.cjs → chunk-322TBTOQ.cjs} +48 -48
- package/dist/{chunk-BYBDM423.cjs.map → chunk-322TBTOQ.cjs.map} +1 -1
- package/dist/chunk-36SX6QXP.cjs +186 -0
- package/dist/chunk-36SX6QXP.cjs.map +1 -0
- package/dist/{chunk-H3XP6BAV.js → chunk-36VYWVQU.js} +3 -3
- package/dist/{chunk-H3XP6BAV.js.map → chunk-36VYWVQU.js.map} +1 -1
- package/dist/{chunk-VTJVMP4I.js → chunk-4DKY6RIU.js} +102 -31
- package/dist/chunk-4DKY6RIU.js.map +1 -0
- package/dist/chunk-4QKOZYMV.js +9 -0
- package/dist/chunk-4QKOZYMV.js.map +1 -0
- package/dist/{chunk-U3Z7XKAG.js → chunk-57JM6NW3.js} +8 -18
- package/dist/chunk-57JM6NW3.js.map +1 -0
- package/dist/{chunk-XMY2SXOH.cjs → chunk-5WWEYV4H.cjs} +2208 -579
- package/dist/chunk-5WWEYV4H.cjs.map +1 -0
- package/dist/{chunk-WQBAQZHR.js → chunk-6NLYIMJO.js} +4 -4
- package/dist/{chunk-WQBAQZHR.js.map → chunk-6NLYIMJO.js.map} +1 -1
- package/dist/{chunk-G2TLHH6T.cjs → chunk-7B7I7YAW.cjs} +6 -6
- package/dist/{chunk-G2TLHH6T.cjs.map → chunk-7B7I7YAW.cjs.map} +1 -1
- package/dist/{chunk-EDLKIQRI.js → chunk-7G5IYROL.js} +6 -548
- package/dist/chunk-7G5IYROL.js.map +1 -0
- package/dist/{chunk-46UGOVRW.js → chunk-7QFRK6PU.js} +3 -7
- package/dist/chunk-7QFRK6PU.js.map +1 -0
- package/dist/chunk-A4C4NJ5U.cjs +12 -0
- package/dist/chunk-A4C4NJ5U.cjs.map +1 -0
- package/dist/{chunk-TYGGUWMS.cjs → chunk-B3MN7EJR.cjs} +177 -137
- package/dist/chunk-B3MN7EJR.cjs.map +1 -0
- package/dist/{chunk-K6VKTBST.cjs → chunk-BZ5MVITP.cjs} +4 -4
- package/dist/{chunk-K6VKTBST.cjs.map → chunk-BZ5MVITP.cjs.map} +1 -1
- package/dist/{chunk-R7MRFE5P.js → chunk-CAI6SMP6.js} +3 -3
- package/dist/{chunk-R7MRFE5P.js.map → chunk-CAI6SMP6.js.map} +1 -1
- package/dist/{chunk-ZAQUKCUC.js → chunk-CBOD7TXH.js} +5 -5
- package/dist/{chunk-ZAQUKCUC.js.map → chunk-CBOD7TXH.js.map} +1 -1
- package/dist/{chunk-LLVOQOWE.cjs → chunk-CRZ56SZU.cjs} +6 -5
- package/dist/chunk-CRZ56SZU.cjs.map +1 -0
- package/dist/{chunk-ON47CBE4.cjs → chunk-D3GWARN7.cjs} +47 -47
- package/dist/{chunk-ON47CBE4.cjs.map → chunk-D3GWARN7.cjs.map} +1 -1
- package/dist/{chunk-W5SOCUBL.js → chunk-D3OUDFU7.js} +5 -5
- package/dist/{chunk-W5SOCUBL.js.map → chunk-D3OUDFU7.js.map} +1 -1
- package/dist/chunk-EKG2UXNX.cjs +23 -0
- package/dist/chunk-EKG2UXNX.cjs.map +1 -0
- package/dist/{chunk-7PRMDZIA.cjs → chunk-FMMW3KX7.cjs} +21 -55
- package/dist/chunk-FMMW3KX7.cjs.map +1 -0
- package/dist/chunk-H2VWDQWC.cjs +571 -0
- package/dist/chunk-H2VWDQWC.cjs.map +1 -0
- package/dist/chunk-H4FY6OZK.js +13 -0
- package/dist/chunk-H4FY6OZK.js.map +1 -0
- package/dist/{chunk-OJHD3LXJ.cjs → chunk-H5IJSROF.cjs} +2 -8
- package/dist/chunk-H5IJSROF.cjs.map +1 -0
- package/dist/{chunk-U5EL6JUV.js → chunk-I5IOSA27.js} +101 -103
- package/dist/chunk-I5IOSA27.js.map +1 -0
- package/dist/{chunk-SHC7BCG5.cjs → chunk-I7YAY2VQ.cjs} +7 -7
- package/dist/{chunk-SHC7BCG5.cjs.map → chunk-I7YAY2VQ.cjs.map} +1 -1
- package/dist/chunk-IRCWIA3R.js +20 -0
- package/dist/chunk-IRCWIA3R.js.map +1 -0
- package/dist/chunk-IVQBLXBK.cjs +55 -0
- package/dist/chunk-IVQBLXBK.cjs.map +1 -0
- package/dist/{chunk-5PP4KRPV.js → chunk-IZD4HTCP.js} +5 -5
- package/dist/{chunk-5PP4KRPV.js.map → chunk-IZD4HTCP.js.map} +1 -1
- package/dist/{chunk-7CCMCMJO.cjs → chunk-JHRUZ73O.cjs} +75 -66
- package/dist/chunk-JHRUZ73O.cjs.map +1 -0
- package/dist/{chunk-RDP6ZRSM.cjs → chunk-JQKMEKKW.cjs} +261 -204
- package/dist/chunk-JQKMEKKW.cjs.map +1 -0
- package/dist/chunk-JVA3KDEA.cjs +691 -0
- package/dist/chunk-JVA3KDEA.cjs.map +1 -0
- package/dist/{chunk-JG5XIJDY.js → chunk-K67P5DLL.js} +62 -22
- package/dist/chunk-K67P5DLL.js.map +1 -0
- package/dist/{chunk-CS6JTQQ2.cjs → chunk-KACEYDYV.cjs} +94 -62
- package/dist/chunk-KACEYDYV.cjs.map +1 -0
- package/dist/{chunk-5OWHU7Z7.cjs → chunk-L6EVYIID.cjs} +248 -210
- package/dist/chunk-L6EVYIID.cjs.map +1 -0
- package/dist/{chunk-7OWE7WD6.js → chunk-LI4K2KEJ.js} +4 -4
- package/dist/{chunk-7OWE7WD6.js.map → chunk-LI4K2KEJ.js.map} +1 -1
- package/dist/chunk-LKZDQ2B4.js +1581 -0
- package/dist/chunk-LKZDQ2B4.js.map +1 -0
- package/dist/{chunk-45YZXI6X.cjs → chunk-LLFPQOBA.cjs} +27 -27
- package/dist/{chunk-45YZXI6X.cjs.map → chunk-LLFPQOBA.cjs.map} +1 -1
- package/dist/{chunk-ZRJTM7MT.js → chunk-LZMQ3SFK.js} +3 -3
- package/dist/{chunk-ZRJTM7MT.js.map → chunk-LZMQ3SFK.js.map} +1 -1
- package/dist/{chunk-DI6VC62F.js → chunk-M3VTS3F6.js} +3 -3
- package/dist/{chunk-DI6VC62F.js.map → chunk-M3VTS3F6.js.map} +1 -1
- package/dist/{chunk-MZ34E2GN.js → chunk-NBOS7BY3.js} +60 -21
- package/dist/chunk-NBOS7BY3.js.map +1 -0
- package/dist/{chunk-YA36ABIL.js → chunk-NGQDGL5X.js} +14 -48
- package/dist/chunk-NGQDGL5X.js.map +1 -0
- package/dist/{chunk-ZBFZGLZE.cjs → chunk-NLX5OWK7.cjs} +6 -2
- package/dist/chunk-NLX5OWK7.cjs.map +1 -0
- package/dist/chunk-NUQ2YFFH.cjs +1637 -0
- package/dist/chunk-NUQ2YFFH.cjs.map +1 -0
- package/dist/{chunk-TTCOPKUL.cjs → chunk-OGL4X4PH.cjs} +182 -184
- package/dist/chunk-OGL4X4PH.cjs.map +1 -0
- package/dist/{chunk-HY5BNOUN.cjs → chunk-OTNTGEXR.cjs} +4 -4
- package/dist/{chunk-HY5BNOUN.cjs.map → chunk-OTNTGEXR.cjs.map} +1 -1
- package/dist/chunk-OTWE63BW.js +53 -0
- package/dist/chunk-OTWE63BW.js.map +1 -0
- package/dist/chunk-PC5NGH5A.js +549 -0
- package/dist/chunk-PC5NGH5A.js.map +1 -0
- package/dist/{chunk-IPRP6TDL.cjs → chunk-PS3TUWJM.cjs} +7 -7
- package/dist/{chunk-IPRP6TDL.cjs.map → chunk-PS3TUWJM.cjs.map} +1 -1
- package/dist/{chunk-V76FGHY3.js → chunk-PVFFH7TL.js} +5 -5
- package/dist/{chunk-V76FGHY3.js.map → chunk-PVFFH7TL.js.map} +1 -1
- package/dist/chunk-QCD5JKU4.cjs +15 -0
- package/dist/chunk-QCD5JKU4.cjs.map +1 -0
- package/dist/{chunk-IRPYOHRC.js → chunk-QG5VEOKX.js} +6 -2
- package/dist/chunk-QG5VEOKX.js.map +1 -0
- package/dist/{chunk-MM3JHVKZ.cjs → chunk-QLLZM5I3.cjs} +4 -4
- package/dist/{chunk-MM3JHVKZ.cjs.map → chunk-QLLZM5I3.cjs.map} +1 -1
- package/dist/{chunk-MX7EKQPM.js → chunk-RCBG6YMT.js} +345 -97
- package/dist/chunk-RCBG6YMT.js.map +1 -0
- package/dist/{chunk-2CYI5HRH.js → chunk-RI7RJH4G.js} +49 -17
- package/dist/chunk-RI7RJH4G.js.map +1 -0
- package/dist/{chunk-5LKOVCPP.js → chunk-RVUL2HXY.js} +6 -5
- package/dist/chunk-RVUL2HXY.js.map +1 -0
- package/dist/{chunk-WK23PGTP.cjs → chunk-S5GU4LUN.cjs} +11 -11
- package/dist/{chunk-WK23PGTP.cjs.map → chunk-S5GU4LUN.cjs.map} +1 -1
- package/dist/{chunk-S33YQEL7.js → chunk-SDPWO2Z5.js} +6 -6
- package/dist/{chunk-S33YQEL7.js.map → chunk-SDPWO2Z5.js.map} +1 -1
- package/dist/{chunk-6S3PTHL4.js → chunk-SLGGT2XD.js} +3 -3
- package/dist/{chunk-6S3PTHL4.js.map → chunk-SLGGT2XD.js.map} +1 -1
- package/dist/{chunk-HSEZ7X6Y.cjs → chunk-TIJUA4I6.cjs} +45 -45
- package/dist/{chunk-HSEZ7X6Y.cjs.map → chunk-TIJUA4I6.cjs.map} +1 -1
- package/dist/{chunk-CSNOYIB4.cjs → chunk-TM54OBHX.cjs} +13 -13
- package/dist/{chunk-CSNOYIB4.cjs.map → chunk-TM54OBHX.cjs.map} +1 -1
- package/dist/{chunk-2GIV5X4P.js → chunk-TYEYRCXL.js} +86 -33
- package/dist/chunk-TYEYRCXL.js.map +1 -0
- package/dist/{chunk-MJPZNEJZ.js → chunk-UKOVGCRN.js} +2095 -496
- package/dist/chunk-UKOVGCRN.js.map +1 -0
- package/dist/chunk-UYKDYE5D.cjs +12 -0
- package/dist/{chunk-KWNWG4RC.cjs.map → chunk-UYKDYE5D.cjs.map} +1 -1
- package/dist/{chunk-FX5ZW6PN.js → chunk-VAAC7L57.js} +95 -40
- package/dist/chunk-VAAC7L57.js.map +1 -0
- package/dist/{chunk-ISKCIQF2.cjs → chunk-VKHXYVN7.cjs} +14 -25
- package/dist/chunk-VKHXYVN7.cjs.map +1 -0
- package/dist/chunk-VUQZNUHU.js +171 -0
- package/dist/chunk-VUQZNUHU.js.map +1 -0
- package/dist/{chunk-K2XYLVVB.cjs → chunk-WDM5WQK4.cjs} +175 -136
- package/dist/chunk-WDM5WQK4.cjs.map +1 -0
- package/dist/{chunk-GVYVGGPJ.js → chunk-WFSYYU4W.js} +66 -28
- package/dist/chunk-WFSYYU4W.js.map +1 -0
- package/dist/{chunk-WCLMKNQE.cjs → chunk-WRBV2FNH.cjs} +1356 -1108
- package/dist/chunk-WRBV2FNH.cjs.map +1 -0
- package/dist/chunk-XORONCV3.js +202 -0
- package/dist/chunk-XORONCV3.js.map +1 -0
- package/dist/{chunk-2Q45FAIE.js → chunk-YT2IVFAI.js} +26 -17
- package/dist/chunk-YT2IVFAI.js.map +1 -0
- package/dist/chunk-ZGVTNKTX.cjs +217 -0
- package/dist/chunk-ZGVTNKTX.cjs.map +1 -0
- package/dist/core/index.cjs +20 -20
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +4 -4
- package/dist/{ddl-B49O7dB_.d.ts → ddl-BvcbgzHo.d.ts} +3 -3
- package/dist/{ddl-DcZG660s.d.cts → ddl-Ufebz5q5.d.cts} +3 -3
- package/dist/graph-extension/index.d.cts +2 -4
- package/dist/graph-extension/index.d.ts +2 -4
- package/dist/graph-merge/index.cjs +140 -125
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +8 -9
- package/dist/graph-merge/index.d.ts +8 -9
- package/dist/graph-merge/index.js +42 -27
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/index.cjs +144 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +30 -29
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +14 -12
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +7 -5
- package/dist/{ingestion-import-target-CI8OWIkM.d.ts → ingestion-import-target-CAs1OX-l.d.cts} +1 -1
- package/dist/{ingestion-import-target-DCpfM1PX.d.cts → ingestion-import-target-DCQSPfNx.d.ts} +1 -1
- package/dist/interchange/index.cjs +41 -39
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +8 -8
- package/dist/interchange/index.d.ts +8 -8
- package/dist/interchange/index.js +16 -14
- package/dist/interchange/index.js.map +1 -1
- package/dist/local-store-impl-6DDTFM32.cjs +77 -0
- package/dist/local-store-impl-6DDTFM32.cjs.map +1 -0
- package/dist/local-store-impl-OXTOVU2J.js +75 -0
- package/dist/local-store-impl-OXTOVU2J.js.map +1 -0
- package/dist/{manager-Cfg1ENj1.d.ts → manager-B68OrPR2.d.ts} +1 -2
- package/dist/{manager-D348fa6W.d.cts → manager-D_t7oK69.d.cts} +1 -2
- package/dist/pglite-store-impl-6EMZGL7K.js +73 -0
- package/dist/pglite-store-impl-6EMZGL7K.js.map +1 -0
- package/dist/pglite-store-impl-GJG3Y7RP.cjs +75 -0
- package/dist/pglite-store-impl-GJG3Y7RP.cjs.map +1 -0
- package/dist/{postgres-UStOycLI.d.ts → postgres-BPLSVyHM.d.ts} +1 -1
- package/dist/{postgres-CH1kkM5J.d.cts → postgres-CqvtFC2y.d.cts} +1 -1
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +33 -20
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +24 -11
- package/dist/provenance/index.js.map +1 -1
- package/dist/{repair-validity-windows-aWX7VNvv.d.cts → repair-validity-windows-DEzCKAdy.d.cts} +7 -3
- package/dist/{repair-validity-windows-BtOEe2pS.d.ts → repair-validity-windows-GMdaS2AH.d.ts} +7 -3
- package/dist/resolve-D_H8MHtq.d.ts +1805 -0
- package/dist/resolve-WEW8gWws.d.cts +1805 -0
- package/dist/schema/index.cjs +42 -40
- package/dist/schema/index.d.cts +4 -6
- package/dist/schema/index.d.ts +4 -6
- package/dist/schema/index.js +15 -13
- package/dist/{searchable-z4BiFfHI.d.ts → searchable-C_UREI9K.d.ts} +1 -1
- package/dist/{searchable-C8-RrL3l.d.cts → searchable-ClgET_i7.d.cts} +1 -1
- package/dist/{sqlite-axLw5Lo5.d.ts → sqlite-D1mXO9Kp.d.cts} +2 -1
- package/dist/{sqlite-Cyx9j9o6.d.cts → sqlite-MZA3oZNB.d.ts} +2 -1
- package/dist/{store-CTfQ9taw.d.ts → store-CuFX7fCx.d.cts} +38 -41
- package/dist/{store-DR9J7JVB.d.cts → store-D-ZjXQpW.d.ts} +38 -41
- package/dist/{temporal-CBOrERz5.d.ts → temporal-CpyEiRY8.d.cts} +1 -1
- package/dist/{temporal-B4Ky4wzh.d.cts → temporal-y0Aep9Su.d.ts} +1 -1
- package/dist/{types-CWg4dTjj.d.ts → types-6yf0Vv-_.d.cts} +1672 -1
- package/dist/{types-CWg4dTjj.d.cts → types-6yf0Vv-_.d.ts} +1672 -1
- package/dist/{types-BScHXVM7.d.ts → types-DzJ4dlzk.d.cts} +1 -1
- package/dist/{types-BE921wRl.d.cts → types-_vVSB9k-.d.ts} +1 -1
- package/dist/{where-BWXUPV3C.d.ts → where-DuG2LCLe.d.ts} +1 -1
- package/dist/{where-CNtx1aLc.d.cts → where-Mhf_yyKX.d.cts} +1 -1
- package/package.json +5 -1
- package/dist/chunk-2CYI5HRH.js.map +0 -1
- package/dist/chunk-2GIV5X4P.js.map +0 -1
- package/dist/chunk-2Q45FAIE.js.map +0 -1
- package/dist/chunk-46UGOVRW.js.map +0 -1
- package/dist/chunk-5LKOVCPP.js.map +0 -1
- package/dist/chunk-5OWHU7Z7.cjs.map +0 -1
- package/dist/chunk-6LEOAIIB.js +0 -1160
- package/dist/chunk-6LEOAIIB.js.map +0 -1
- package/dist/chunk-7CCMCMJO.cjs.map +0 -1
- package/dist/chunk-7PRMDZIA.cjs.map +0 -1
- package/dist/chunk-C76WFIVZ.cjs.map +0 -1
- package/dist/chunk-CS6JTQQ2.cjs.map +0 -1
- package/dist/chunk-EDLKIQRI.js.map +0 -1
- package/dist/chunk-EH3JZJUM.cjs +0 -567
- package/dist/chunk-EH3JZJUM.cjs.map +0 -1
- package/dist/chunk-FX5ZW6PN.js.map +0 -1
- package/dist/chunk-GHZPZNFC.cjs +0 -132
- package/dist/chunk-GHZPZNFC.cjs.map +0 -1
- package/dist/chunk-GVYVGGPJ.js.map +0 -1
- package/dist/chunk-IHK5KA2Q.cjs +0 -262
- package/dist/chunk-IHK5KA2Q.cjs.map +0 -1
- package/dist/chunk-IRPYOHRC.js.map +0 -1
- package/dist/chunk-ISKCIQF2.cjs.map +0 -1
- package/dist/chunk-JG5XIJDY.js.map +0 -1
- package/dist/chunk-K2XYLVVB.cjs.map +0 -1
- package/dist/chunk-KWNWG4RC.cjs +0 -12
- package/dist/chunk-LLVOQOWE.cjs.map +0 -1
- package/dist/chunk-MJPZNEJZ.js.map +0 -1
- package/dist/chunk-MX7EKQPM.js.map +0 -1
- package/dist/chunk-MZ34E2GN.js.map +0 -1
- package/dist/chunk-OJHD3LXJ.cjs.map +0 -1
- package/dist/chunk-PALYTHGM.js +0 -114
- package/dist/chunk-PALYTHGM.js.map +0 -1
- package/dist/chunk-RDP6ZRSM.cjs.map +0 -1
- package/dist/chunk-S3SDEQMC.js +0 -532
- package/dist/chunk-S3SDEQMC.js.map +0 -1
- package/dist/chunk-TEC24ZDA.cjs +0 -1254
- package/dist/chunk-TEC24ZDA.cjs.map +0 -1
- package/dist/chunk-TP4NJTI3.cjs +0 -1192
- package/dist/chunk-TP4NJTI3.cjs.map +0 -1
- package/dist/chunk-TTCOPKUL.cjs.map +0 -1
- package/dist/chunk-TUVD4DFR.cjs.map +0 -1
- package/dist/chunk-TYGGUWMS.cjs.map +0 -1
- package/dist/chunk-U3Z7XKAG.js.map +0 -1
- package/dist/chunk-U5EL6JUV.js.map +0 -1
- package/dist/chunk-VTJVMP4I.js.map +0 -1
- package/dist/chunk-WCLMKNQE.cjs.map +0 -1
- package/dist/chunk-XMY2SXOH.cjs.map +0 -1
- package/dist/chunk-Y55DLLEG.js +0 -247
- package/dist/chunk-Y55DLLEG.js.map +0 -1
- package/dist/chunk-YA36ABIL.js.map +0 -1
- package/dist/chunk-ZBFZGLZE.cjs.map +0 -1
- package/dist/index-B0PrmE3K.d.cts +0 -1146
- package/dist/index-CwcXsL5R.d.ts +0 -1146
- package/dist/materialize-indexes-C9GG3O3C.d.ts +0 -266
- package/dist/materialize-indexes-CrSiW_lT.d.cts +0 -266
package/dist/chunk-TEC24ZDA.cjs
DELETED
|
@@ -1,1254 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkOJHD3LXJ_cjs = require('./chunk-OJHD3LXJ.cjs');
|
|
4
|
-
var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
|
|
5
|
-
var chunkA7J2YDDI_cjs = require('./chunk-A7J2YDDI.cjs');
|
|
6
|
-
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
7
|
-
|
|
8
|
-
// src/backend/table-contribution.ts
|
|
9
|
-
var FULLTEXT_CONTRIBUTION_NAME = "fulltext";
|
|
10
|
-
var BASE_CONTRIBUTION_OWNER = "base";
|
|
11
|
-
|
|
12
|
-
// src/query/dialect/fulltext-strategy.ts
|
|
13
|
-
var ALL_FULLTEXT_MODES = [
|
|
14
|
-
"websearch",
|
|
15
|
-
"phrase",
|
|
16
|
-
"plain",
|
|
17
|
-
"raw"
|
|
18
|
-
];
|
|
19
|
-
function buildFulltextCapabilities(strategy) {
|
|
20
|
-
return {
|
|
21
|
-
supported: true,
|
|
22
|
-
languages: strategy.languages,
|
|
23
|
-
phraseQueries: strategy.supportedModes.includes("phrase"),
|
|
24
|
-
prefixQueries: strategy.supportsPrefix,
|
|
25
|
-
highlighting: strategy.supportsSnippets
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function buildFulltextGraphDelete(tableName, graphId) {
|
|
29
|
-
return chunkOJHD3LXJ_cjs.sql`
|
|
30
|
-
DELETE FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tableName)}
|
|
31
|
-
WHERE "graph_id" = ${graphId}
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
34
|
-
function buildForeignFulltextGraphProbe(tableName, graphId, limit) {
|
|
35
|
-
return chunkOJHD3LXJ_cjs.sql`
|
|
36
|
-
SELECT DISTINCT "graph_id"
|
|
37
|
-
FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tableName)}
|
|
38
|
-
WHERE "graph_id" <> ${graphId}
|
|
39
|
-
LIMIT ${limit}
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
function quoteIdentifier(name) {
|
|
43
|
-
return `"${name.replaceAll('"', '""')}"`;
|
|
44
|
-
}
|
|
45
|
-
function tsvectorColumn(tableName) {
|
|
46
|
-
return chunkOJHD3LXJ_cjs.sql`${chunkOJHD3LXJ_cjs.sql.identifier(tableName)}."tsv"`;
|
|
47
|
-
}
|
|
48
|
-
function dedupeFulltextBatchRows(rows) {
|
|
49
|
-
const seen = /* @__PURE__ */ new Map();
|
|
50
|
-
for (const row of rows) seen.set(row.nodeId, row);
|
|
51
|
-
return [...seen.values()];
|
|
52
|
-
}
|
|
53
|
-
function buildPkScopedDelete(tableName, params) {
|
|
54
|
-
const table = chunkOJHD3LXJ_cjs.sql.identifier(tableName);
|
|
55
|
-
return chunkOJHD3LXJ_cjs.sql`
|
|
56
|
-
DELETE FROM ${table}
|
|
57
|
-
WHERE "graph_id" = ${params.graphId}
|
|
58
|
-
AND "node_kind" = ${params.nodeKind}
|
|
59
|
-
AND "node_id" = ${params.nodeId}
|
|
60
|
-
`;
|
|
61
|
-
}
|
|
62
|
-
function buildPkScopedBatchDelete(tableName, params) {
|
|
63
|
-
if (params.nodeIds.length === 0) return void 0;
|
|
64
|
-
const unique = [...new Set(params.nodeIds)];
|
|
65
|
-
const table = chunkOJHD3LXJ_cjs.sql.identifier(tableName);
|
|
66
|
-
return chunkOJHD3LXJ_cjs.sql`
|
|
67
|
-
DELETE FROM ${table}
|
|
68
|
-
WHERE "graph_id" = ${params.graphId}
|
|
69
|
-
AND "node_kind" = ${params.nodeKind}
|
|
70
|
-
AND "node_id" IN (${chunkOJHD3LXJ_cjs.sql.join(
|
|
71
|
-
unique.map((id) => chunkOJHD3LXJ_cjs.sql`${id}`),
|
|
72
|
-
chunkOJHD3LXJ_cjs.sql`, `
|
|
73
|
-
)})
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
function postgresTsquery(mode, query, language) {
|
|
77
|
-
const langExpr = language === void 0 ? chunkOJHD3LXJ_cjs.sql`"language"` : chunkOJHD3LXJ_cjs.sql`${language}::regconfig`;
|
|
78
|
-
switch (mode) {
|
|
79
|
-
case "websearch": {
|
|
80
|
-
return chunkOJHD3LXJ_cjs.sql`websearch_to_tsquery(${langExpr}, ${query})`;
|
|
81
|
-
}
|
|
82
|
-
case "phrase": {
|
|
83
|
-
return chunkOJHD3LXJ_cjs.sql`phraseto_tsquery(${langExpr}, ${query})`;
|
|
84
|
-
}
|
|
85
|
-
case "plain": {
|
|
86
|
-
return chunkOJHD3LXJ_cjs.sql`plainto_tsquery(${langExpr}, ${query})`;
|
|
87
|
-
}
|
|
88
|
-
case "raw": {
|
|
89
|
-
return chunkOJHD3LXJ_cjs.sql`to_tsquery(${langExpr}, ${query})`;
|
|
90
|
-
}
|
|
91
|
-
default: {
|
|
92
|
-
const _exhaustive = mode;
|
|
93
|
-
throw new Error(`Unsupported fulltext mode: ${String(_exhaustive)}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
var tsvectorStrategy = {
|
|
98
|
-
name: "tsvector",
|
|
99
|
-
supportedModes: ALL_FULLTEXT_MODES,
|
|
100
|
-
supportsSnippets: true,
|
|
101
|
-
// `raw` mode exposes `foo:*` prefix-match syntax to callers.
|
|
102
|
-
supportsPrefix: true,
|
|
103
|
-
supportsLanguageOverride: true,
|
|
104
|
-
// Canonical Postgres stemmers; every stock install ships these plus a
|
|
105
|
-
// few others. Runtime `to_tsvector` accepts any installed regconfig
|
|
106
|
-
// name — this list is advisory for capability discovery.
|
|
107
|
-
languages: [
|
|
108
|
-
"simple",
|
|
109
|
-
"english",
|
|
110
|
-
"french",
|
|
111
|
-
"german",
|
|
112
|
-
"italian",
|
|
113
|
-
"portuguese",
|
|
114
|
-
"russian",
|
|
115
|
-
"spanish",
|
|
116
|
-
"swedish"
|
|
117
|
-
],
|
|
118
|
-
matchCondition(tableName, query, mode, language) {
|
|
119
|
-
const q = postgresTsquery(mode, query, language);
|
|
120
|
-
return chunkOJHD3LXJ_cjs.sql`${tsvectorColumn(tableName)} @@ ${q}`;
|
|
121
|
-
},
|
|
122
|
-
rankExpression(tableName, query, mode, language) {
|
|
123
|
-
const q = postgresTsquery(mode, query, language);
|
|
124
|
-
return chunkOJHD3LXJ_cjs.sql`ts_rank_cd(${tsvectorColumn(tableName)}, ${q})`;
|
|
125
|
-
},
|
|
126
|
-
snippetExpression(_tableName, query, mode, language) {
|
|
127
|
-
const langExpr = language === void 0 ? chunkOJHD3LXJ_cjs.sql`"language"` : chunkOJHD3LXJ_cjs.sql`${language}::regconfig`;
|
|
128
|
-
const q = postgresTsquery(mode, query, language);
|
|
129
|
-
return chunkOJHD3LXJ_cjs.sql`ts_headline(${langExpr}, "content", ${q}, 'StartSel=<mark>,StopSel=</mark>,MaxFragments=1,MinWords=5,MaxWords=30,ShortWord=3')`;
|
|
130
|
-
},
|
|
131
|
-
ownedTables(primaryTableName) {
|
|
132
|
-
const name = quoteIdentifier(primaryTableName);
|
|
133
|
-
const gin = quoteIdentifier(`${primaryTableName}_tsv_idx`);
|
|
134
|
-
const kind = quoteIdentifier(`${primaryTableName}_kind_idx`);
|
|
135
|
-
const createDdl = [
|
|
136
|
-
`CREATE TABLE IF NOT EXISTS ${name} (
|
|
137
|
-
"graph_id" TEXT NOT NULL,
|
|
138
|
-
"node_kind" TEXT NOT NULL,
|
|
139
|
-
"node_id" TEXT NOT NULL,
|
|
140
|
-
"content" TEXT NOT NULL,
|
|
141
|
-
"language" regconfig NOT NULL,
|
|
142
|
-
"tsv" tsvector NOT NULL
|
|
143
|
-
GENERATED ALWAYS AS (to_tsvector("language", "content")) STORED,
|
|
144
|
-
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
145
|
-
PRIMARY KEY ("graph_id", "node_kind", "node_id")
|
|
146
|
-
);`,
|
|
147
|
-
`CREATE INDEX IF NOT EXISTS ${gin} ON ${name} USING GIN ("tsv");`,
|
|
148
|
-
`CREATE INDEX IF NOT EXISTS ${kind} ON ${name} ("graph_id", "node_kind");`
|
|
149
|
-
];
|
|
150
|
-
return [
|
|
151
|
-
{
|
|
152
|
-
logicalName: FULLTEXT_CONTRIBUTION_NAME,
|
|
153
|
-
owner: "tsvector",
|
|
154
|
-
tableName: primaryTableName,
|
|
155
|
-
createDdl,
|
|
156
|
-
// Both indexes belong to the table, so Postgres drops them with
|
|
157
|
-
// it; no separate DROP INDEX is needed or wanted (naming them
|
|
158
|
-
// would break the moment a future createDdl renames one).
|
|
159
|
-
dropDdl: [`DROP TABLE IF EXISTS ${name};`],
|
|
160
|
-
runtimeEnsure: true
|
|
161
|
-
}
|
|
162
|
-
];
|
|
163
|
-
},
|
|
164
|
-
buildUpsert(tableName, params, timestamp) {
|
|
165
|
-
const table = chunkOJHD3LXJ_cjs.sql.identifier(tableName);
|
|
166
|
-
return [
|
|
167
|
-
chunkOJHD3LXJ_cjs.sql`
|
|
168
|
-
INSERT INTO ${table} ("graph_id", "node_kind", "node_id", "content", "language", "updated_at")
|
|
169
|
-
VALUES (
|
|
170
|
-
${params.graphId}, ${params.nodeKind}, ${params.nodeId},
|
|
171
|
-
${params.content}, ${params.language}::regconfig,
|
|
172
|
-
${timestamp}
|
|
173
|
-
)
|
|
174
|
-
ON CONFLICT ("graph_id", "node_kind", "node_id")
|
|
175
|
-
DO UPDATE SET
|
|
176
|
-
"content" = EXCLUDED."content",
|
|
177
|
-
"language" = EXCLUDED."language",
|
|
178
|
-
"updated_at" = EXCLUDED."updated_at"
|
|
179
|
-
`
|
|
180
|
-
];
|
|
181
|
-
},
|
|
182
|
-
buildBatchUpsert(tableName, params, timestamp) {
|
|
183
|
-
const rows = dedupeFulltextBatchRows(params.rows);
|
|
184
|
-
if (rows.length === 0) return [];
|
|
185
|
-
const table = chunkOJHD3LXJ_cjs.sql.identifier(tableName);
|
|
186
|
-
const valueTuples = rows.map(
|
|
187
|
-
(row) => chunkOJHD3LXJ_cjs.sql`
|
|
188
|
-
(
|
|
189
|
-
${params.graphId}, ${params.nodeKind}, ${row.nodeId},
|
|
190
|
-
${row.content}, ${row.language}::regconfig,
|
|
191
|
-
${timestamp}
|
|
192
|
-
)
|
|
193
|
-
`
|
|
194
|
-
);
|
|
195
|
-
return [
|
|
196
|
-
chunkOJHD3LXJ_cjs.sql`
|
|
197
|
-
INSERT INTO ${table} ("graph_id", "node_kind", "node_id", "content", "language", "updated_at")
|
|
198
|
-
VALUES ${chunkOJHD3LXJ_cjs.sql.join(valueTuples, chunkOJHD3LXJ_cjs.sql`, `)}
|
|
199
|
-
ON CONFLICT ("graph_id", "node_kind", "node_id")
|
|
200
|
-
DO UPDATE SET
|
|
201
|
-
"content" = EXCLUDED."content",
|
|
202
|
-
"language" = EXCLUDED."language",
|
|
203
|
-
"updated_at" = EXCLUDED."updated_at"
|
|
204
|
-
`
|
|
205
|
-
];
|
|
206
|
-
},
|
|
207
|
-
buildDelete(tableName, params) {
|
|
208
|
-
return [buildPkScopedDelete(tableName, params)];
|
|
209
|
-
},
|
|
210
|
-
buildBatchDelete(tableName, params) {
|
|
211
|
-
const stmt = buildPkScopedBatchDelete(tableName, params);
|
|
212
|
-
return stmt === void 0 ? [] : [stmt];
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
function translateToFts5Query(query, mode) {
|
|
216
|
-
switch (mode) {
|
|
217
|
-
case "phrase": {
|
|
218
|
-
return `"${query.replaceAll('"', '""')}"`;
|
|
219
|
-
}
|
|
220
|
-
case "plain": {
|
|
221
|
-
return query.trim().split(/\s+/u).filter((token) => token.length > 0).map((token) => `"${token.replaceAll('"', '""')}"`).join(" ");
|
|
222
|
-
}
|
|
223
|
-
case "websearch": {
|
|
224
|
-
return translateWebsearchToFts5(query);
|
|
225
|
-
}
|
|
226
|
-
case "raw": {
|
|
227
|
-
return query;
|
|
228
|
-
}
|
|
229
|
-
default: {
|
|
230
|
-
const _exhaustive = mode;
|
|
231
|
-
throw new Error(`Unsupported fulltext mode: ${String(_exhaustive)}`);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function translateWebsearchToFts5(query) {
|
|
236
|
-
const tokens = [];
|
|
237
|
-
let index = 0;
|
|
238
|
-
function skipWhitespace() {
|
|
239
|
-
while (index < query.length && /\s/u.test(query[index] ?? "")) {
|
|
240
|
-
index += 1;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function readPhrase() {
|
|
244
|
-
index += 1;
|
|
245
|
-
let content = "";
|
|
246
|
-
while (index < query.length && query[index] !== '"') {
|
|
247
|
-
content += query[index] ?? "";
|
|
248
|
-
index += 1;
|
|
249
|
-
}
|
|
250
|
-
if (query[index] === '"') index += 1;
|
|
251
|
-
return `"${content.replaceAll('"', '""')}"`;
|
|
252
|
-
}
|
|
253
|
-
function readBareTerm() {
|
|
254
|
-
let term = "";
|
|
255
|
-
while (index < query.length && !/\s/u.test(query[index] ?? "")) {
|
|
256
|
-
term += query[index] ?? "";
|
|
257
|
-
index += 1;
|
|
258
|
-
}
|
|
259
|
-
return term;
|
|
260
|
-
}
|
|
261
|
-
while (index < query.length) {
|
|
262
|
-
skipWhitespace();
|
|
263
|
-
if (index >= query.length) break;
|
|
264
|
-
const ch = query[index];
|
|
265
|
-
if (ch === '"') {
|
|
266
|
-
tokens.push(readPhrase());
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
if (ch === "-") {
|
|
270
|
-
index += 1;
|
|
271
|
-
const term = query[index] === '"' ? readPhrase() : `"${readBareTerm().replaceAll('"', '""')}"`;
|
|
272
|
-
tokens.push(`NOT ${term}`);
|
|
273
|
-
continue;
|
|
274
|
-
}
|
|
275
|
-
if (ch === "+") {
|
|
276
|
-
index += 1;
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
const bare = readBareTerm();
|
|
280
|
-
if (bare.length === 0) continue;
|
|
281
|
-
if (bare.toUpperCase() === "OR") {
|
|
282
|
-
tokens.push("OR");
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
tokens.push(`"${bare.replaceAll('"', '""')}"`);
|
|
286
|
-
}
|
|
287
|
-
if (tokens.length > 0 && tokens[0]?.startsWith("NOT ")) {
|
|
288
|
-
tokens.shift();
|
|
289
|
-
}
|
|
290
|
-
return tokens.join(" ");
|
|
291
|
-
}
|
|
292
|
-
var fts5Strategy = {
|
|
293
|
-
name: "fts5",
|
|
294
|
-
supportedModes: ALL_FULLTEXT_MODES,
|
|
295
|
-
supportsSnippets: true,
|
|
296
|
-
// FTS5 supports `foo*` prefix matching natively.
|
|
297
|
-
supportsPrefix: true,
|
|
298
|
-
// FTS5 tokenizer is fixed at table-create time; per-row / per-query
|
|
299
|
-
// language metadata is stored but not consulted.
|
|
300
|
-
supportsLanguageOverride: false,
|
|
301
|
-
// The built-in tokenizer is `porter unicode61 remove_diacritics 2`; the
|
|
302
|
-
// `language` field on searchable() is recorded for future use but not
|
|
303
|
-
// applied at query time.
|
|
304
|
-
languages: ["porter", "unicode61", "trigram"],
|
|
305
|
-
matchCondition(tableName, query, mode, _language) {
|
|
306
|
-
const matchExpression = translateToFts5Query(query, mode);
|
|
307
|
-
return chunkOJHD3LXJ_cjs.sql`${chunkOJHD3LXJ_cjs.sql.identifier(tableName)} MATCH ${matchExpression}`;
|
|
308
|
-
},
|
|
309
|
-
rankExpression(tableName, _query, _mode, _language) {
|
|
310
|
-
return chunkOJHD3LXJ_cjs.sql`-bm25(${chunkOJHD3LXJ_cjs.sql.identifier(tableName)})`;
|
|
311
|
-
},
|
|
312
|
-
snippetExpression(tableName, _query, _mode, _language) {
|
|
313
|
-
return chunkOJHD3LXJ_cjs.sql`snippet(${chunkOJHD3LXJ_cjs.sql.identifier(tableName)}, -1, '<mark>', '</mark>', '…', 20)`;
|
|
314
|
-
},
|
|
315
|
-
ownedTables(primaryTableName) {
|
|
316
|
-
const name = quoteIdentifier(primaryTableName);
|
|
317
|
-
return [
|
|
318
|
-
{
|
|
319
|
-
logicalName: FULLTEXT_CONTRIBUTION_NAME,
|
|
320
|
-
owner: "fts5",
|
|
321
|
-
tableName: primaryTableName,
|
|
322
|
-
createDdl: [
|
|
323
|
-
`CREATE VIRTUAL TABLE IF NOT EXISTS ${name} USING fts5(
|
|
324
|
-
graph_id UNINDEXED,
|
|
325
|
-
node_kind UNINDEXED,
|
|
326
|
-
node_id UNINDEXED,
|
|
327
|
-
language UNINDEXED,
|
|
328
|
-
updated_at UNINDEXED,
|
|
329
|
-
content,
|
|
330
|
-
tokenize='porter unicode61 remove_diacritics 2'
|
|
331
|
-
);`
|
|
332
|
-
],
|
|
333
|
-
// `DROP TABLE` on an FTS5 virtual table also removes the shadow
|
|
334
|
-
// tables (`_data`, `_idx`, `_content`, …) the module created, so
|
|
335
|
-
// one statement is the whole teardown.
|
|
336
|
-
dropDdl: [`DROP TABLE IF EXISTS ${name};`],
|
|
337
|
-
runtimeEnsure: true
|
|
338
|
-
}
|
|
339
|
-
];
|
|
340
|
-
},
|
|
341
|
-
buildUpsert(tableName, params, timestamp) {
|
|
342
|
-
const table = chunkOJHD3LXJ_cjs.sql.identifier(tableName);
|
|
343
|
-
return [
|
|
344
|
-
chunkOJHD3LXJ_cjs.sql`
|
|
345
|
-
DELETE FROM ${table}
|
|
346
|
-
WHERE "graph_id" = ${params.graphId}
|
|
347
|
-
AND "node_kind" = ${params.nodeKind}
|
|
348
|
-
AND "node_id" = ${params.nodeId}
|
|
349
|
-
`,
|
|
350
|
-
chunkOJHD3LXJ_cjs.sql`
|
|
351
|
-
INSERT INTO ${table} (graph_id, node_kind, node_id, content, language, updated_at)
|
|
352
|
-
VALUES (${params.graphId}, ${params.nodeKind}, ${params.nodeId}, ${params.content}, ${params.language}, ${timestamp})
|
|
353
|
-
`
|
|
354
|
-
];
|
|
355
|
-
},
|
|
356
|
-
buildBatchUpsert(tableName, params, timestamp) {
|
|
357
|
-
const rows = dedupeFulltextBatchRows(params.rows);
|
|
358
|
-
if (rows.length === 0) return [];
|
|
359
|
-
const table = chunkOJHD3LXJ_cjs.sql.identifier(tableName);
|
|
360
|
-
const nodeIds = rows.map((row) => row.nodeId);
|
|
361
|
-
const deleteStmt = chunkOJHD3LXJ_cjs.sql`
|
|
362
|
-
DELETE FROM ${table}
|
|
363
|
-
WHERE "graph_id" = ${params.graphId}
|
|
364
|
-
AND "node_kind" = ${params.nodeKind}
|
|
365
|
-
AND "node_id" IN (${chunkOJHD3LXJ_cjs.sql.join(
|
|
366
|
-
nodeIds.map((id) => chunkOJHD3LXJ_cjs.sql`${id}`),
|
|
367
|
-
chunkOJHD3LXJ_cjs.sql`, `
|
|
368
|
-
)})
|
|
369
|
-
`;
|
|
370
|
-
const valueTuples = rows.map(
|
|
371
|
-
(row) => chunkOJHD3LXJ_cjs.sql`
|
|
372
|
-
(
|
|
373
|
-
${params.graphId}, ${params.nodeKind}, ${row.nodeId},
|
|
374
|
-
${row.content}, ${row.language}, ${timestamp}
|
|
375
|
-
)
|
|
376
|
-
`
|
|
377
|
-
);
|
|
378
|
-
const insertStmt = chunkOJHD3LXJ_cjs.sql`
|
|
379
|
-
INSERT INTO ${table} (graph_id, node_kind, node_id, content, language, updated_at)
|
|
380
|
-
VALUES ${chunkOJHD3LXJ_cjs.sql.join(valueTuples, chunkOJHD3LXJ_cjs.sql`, `)}
|
|
381
|
-
`;
|
|
382
|
-
return [deleteStmt, insertStmt];
|
|
383
|
-
},
|
|
384
|
-
buildDelete(tableName, params) {
|
|
385
|
-
return [buildPkScopedDelete(tableName, params)];
|
|
386
|
-
},
|
|
387
|
-
buildBatchDelete(tableName, params) {
|
|
388
|
-
const stmt = buildPkScopedBatchDelete(tableName, params);
|
|
389
|
-
return stmt === void 0 ? [] : [stmt];
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
// src/query/dialect/vector-strategy.ts
|
|
394
|
-
var VECTOR_CONTRIBUTION_PREFIX = "vector";
|
|
395
|
-
function buildVectorCapabilities(strategy) {
|
|
396
|
-
return strategy.capabilities;
|
|
397
|
-
}
|
|
398
|
-
function vectorScoreExpression(distanceExpression, metric) {
|
|
399
|
-
switch (metric) {
|
|
400
|
-
case "cosine": {
|
|
401
|
-
return chunkOJHD3LXJ_cjs.sql`(1 - (${distanceExpression}))`;
|
|
402
|
-
}
|
|
403
|
-
case "l2":
|
|
404
|
-
case "inner_product": {
|
|
405
|
-
return distanceExpression;
|
|
406
|
-
}
|
|
407
|
-
default: {
|
|
408
|
-
const _exhaustive = metric;
|
|
409
|
-
throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
function vectorMinScoreCondition(distanceExpression, metric, minScore) {
|
|
414
|
-
assertVectorMinScore(minScore, metric);
|
|
415
|
-
switch (metric) {
|
|
416
|
-
case "cosine": {
|
|
417
|
-
return chunkOJHD3LXJ_cjs.sql`${distanceExpression} <= ${1 - minScore}`;
|
|
418
|
-
}
|
|
419
|
-
case "l2": {
|
|
420
|
-
return chunkOJHD3LXJ_cjs.sql`${distanceExpression} <= ${minScore}`;
|
|
421
|
-
}
|
|
422
|
-
case "inner_product": {
|
|
423
|
-
return chunkOJHD3LXJ_cjs.sql`${distanceExpression} <= ${-minScore}`;
|
|
424
|
-
}
|
|
425
|
-
default: {
|
|
426
|
-
const _exhaustive = metric;
|
|
427
|
-
throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
function assertFiniteEmbedding(embedding, name) {
|
|
432
|
-
for (const [index, value] of embedding.entries()) {
|
|
433
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
434
|
-
throw new TypeError(
|
|
435
|
-
`${name}[${index}] must be a finite number, got: ${value}`
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
function assertVectorSearchLimit(limit) {
|
|
441
|
-
if (!Number.isInteger(limit) || limit <= 0) {
|
|
442
|
-
throw new RangeError(
|
|
443
|
-
`vectorSearch limit must be a positive integer, got: ${limit}`
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
function vectorSearchFrontierTuning(strategy) {
|
|
448
|
-
return strategy?.capabilities.searchFrontierTuning ?? {
|
|
449
|
-
tunable: false,
|
|
450
|
-
reason: "vector support is disabled on this backend"
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
function resolveEfSearchOverride(applicability) {
|
|
454
|
-
const { efSearch, indexType, tuning, transactions, dialect, engine } = applicability;
|
|
455
|
-
if (efSearch === void 0) return void 0;
|
|
456
|
-
if (!tuning.tunable) {
|
|
457
|
-
throw new chunkX4GDXBOP_cjs.UnsupportedBackendCapabilityError(
|
|
458
|
-
`${dialect} efSearch override`,
|
|
459
|
-
"vector.searchFrontierTuning",
|
|
460
|
-
{ efSearch, engine, reason: tuning.reason },
|
|
461
|
-
`Omit efSearch: ${engine} has no per-search ANN frontier parameter (${tuning.reason}). Tune recall with the search limit, or use an exact search.`
|
|
462
|
-
);
|
|
463
|
-
}
|
|
464
|
-
if (indexType !== tuning.indexType) {
|
|
465
|
-
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
466
|
-
`${dialect} efSearch requires an ${tuning.indexType.toUpperCase()} vector index.`,
|
|
467
|
-
{ efSearch, indexType },
|
|
468
|
-
{
|
|
469
|
-
suggestion: `Configure the embedding with index: { type: "${tuning.indexType}" }, or omit efSearch.`
|
|
470
|
-
}
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
if (tuning.requiresTransactionScope && !transactions) {
|
|
474
|
-
throw new chunkX4GDXBOP_cjs.UnsupportedBackendCapabilityError(
|
|
475
|
-
`${dialect} efSearch override`,
|
|
476
|
-
"transactions",
|
|
477
|
-
{ efSearch, engine, parameter: tuning.parameter },
|
|
478
|
-
`Use a transactional ${dialect} driver: ${tuning.parameter} is scoped to the search's own transaction, and a session-wide setting would leak into concurrent searches.`
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
return tuning.parameter;
|
|
482
|
-
}
|
|
483
|
-
function assertApproximateMetricSupported(request) {
|
|
484
|
-
const {
|
|
485
|
-
approximate,
|
|
486
|
-
requestedMetric,
|
|
487
|
-
declaredMetric,
|
|
488
|
-
indexType,
|
|
489
|
-
nodeKind,
|
|
490
|
-
fieldPath
|
|
491
|
-
} = request;
|
|
492
|
-
if (approximate !== true) return;
|
|
493
|
-
if (indexType === "none") return;
|
|
494
|
-
if (requestedMetric === void 0 || requestedMetric === declaredMetric) {
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
throw new chunkX4GDXBOP_cjs.ConfigurationError(
|
|
498
|
-
`Approximate retrieval for "${nodeKind}.${fieldPath}" cannot use metric "${requestedMetric}": its ${indexType.toUpperCase()} index is built for "${declaredMetric}", and an ANN structure only retrieves under the metric it was built for.`,
|
|
499
|
-
{
|
|
500
|
-
nodeKind,
|
|
501
|
-
fieldPath,
|
|
502
|
-
requestedMetric,
|
|
503
|
-
declaredMetric,
|
|
504
|
-
indexType
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
suggestion: `Omit metric (or pass "${declaredMetric}") to keep approximate retrieval, or drop approximate to scan exactly under "${requestedMetric}".`
|
|
508
|
-
}
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
function assertVectorMinScore(minScore, metric, label = "minScore") {
|
|
512
|
-
if (!Number.isFinite(minScore)) {
|
|
513
|
-
throw new RangeError(`${label} must be a finite number, got: ${minScore}`);
|
|
514
|
-
}
|
|
515
|
-
if (metric === "cosine" && Math.abs(minScore) > 1) {
|
|
516
|
-
throw new RangeError(
|
|
517
|
-
`${label} for the cosine metric must be between -1 and 1, got: ${minScore}`
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
var MAX_VECTOR_IDENTIFIER_LENGTH = 63;
|
|
522
|
-
function sanitizeIdentifierPart(value) {
|
|
523
|
-
return value.toLowerCase().replaceAll(/[^a-z0-9_]/g, "_");
|
|
524
|
-
}
|
|
525
|
-
function shortHash(input) {
|
|
526
|
-
let h1 = 3735928559;
|
|
527
|
-
let h2 = 1103547991;
|
|
528
|
-
for (let index = 0; index < input.length; index++) {
|
|
529
|
-
const ch = chunkN66HCGCY_cjs.requireDefined(input.codePointAt(index));
|
|
530
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
531
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
532
|
-
}
|
|
533
|
-
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
534
|
-
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
535
|
-
const hi = (h2 >>> 0).toString(16).padStart(8, "0");
|
|
536
|
-
const lo = (h1 >>> 0).toString(16).padStart(8, "0");
|
|
537
|
-
return `${hi}${lo}`.slice(0, 8);
|
|
538
|
-
}
|
|
539
|
-
function vectorPhysicalName(prefix, graphId, nodeKind, fieldPath) {
|
|
540
|
-
const readable = `${prefix}_${sanitizeIdentifierPart(graphId)}_${sanitizeIdentifierPart(nodeKind)}_${sanitizeIdentifierPart(fieldPath)}`;
|
|
541
|
-
const hash = shortHash(JSON.stringify([graphId, nodeKind, fieldPath]));
|
|
542
|
-
const full = `${readable}_${hash}`;
|
|
543
|
-
if (full.length <= MAX_VECTOR_IDENTIFIER_LENGTH) return full;
|
|
544
|
-
return `${readable.slice(0, MAX_VECTOR_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;
|
|
545
|
-
}
|
|
546
|
-
function quoteIdentifier2(name) {
|
|
547
|
-
return `"${name.replaceAll('"', '""')}"`;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
// src/query/dialect/postgres.ts
|
|
551
|
-
function toPostgresPath(pointer) {
|
|
552
|
-
if (!pointer || pointer === "" || pointer === "/") {
|
|
553
|
-
return chunkOJHD3LXJ_cjs.sql.raw("ARRAY[]::text[]");
|
|
554
|
-
}
|
|
555
|
-
const segments = chunkA7J2YDDI_cjs.parseJsonPointer(pointer);
|
|
556
|
-
if (segments.length === 0) {
|
|
557
|
-
return chunkOJHD3LXJ_cjs.sql.raw("ARRAY[]::text[]");
|
|
558
|
-
}
|
|
559
|
-
const escapedSegments = segments.map((segment) => chunkOJHD3LXJ_cjs.inlineSqlStringLiteral(segment, "postgres")).join(", ");
|
|
560
|
-
return chunkOJHD3LXJ_cjs.sql.raw(`ARRAY[${escapedSegments}]`);
|
|
561
|
-
}
|
|
562
|
-
function postgresElementCast(elementType) {
|
|
563
|
-
switch (elementType) {
|
|
564
|
-
case "number": {
|
|
565
|
-
return chunkOJHD3LXJ_cjs.sql.raw("::numeric");
|
|
566
|
-
}
|
|
567
|
-
case "boolean": {
|
|
568
|
-
return chunkOJHD3LXJ_cjs.sql.raw("::boolean");
|
|
569
|
-
}
|
|
570
|
-
case "date": {
|
|
571
|
-
return chunkOJHD3LXJ_cjs.sql.raw("::timestamptz");
|
|
572
|
-
}
|
|
573
|
-
// `jsonExtractText` leaves these as text, so the elements must stay text
|
|
574
|
-
// too. The compiler rejects array/object/embedding before reaching here.
|
|
575
|
-
case "string":
|
|
576
|
-
case "array":
|
|
577
|
-
case "object":
|
|
578
|
-
case "embedding":
|
|
579
|
-
case "unknown":
|
|
580
|
-
case void 0: {
|
|
581
|
-
return chunkOJHD3LXJ_cjs.sql.empty();
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
var postgresDialect = {
|
|
586
|
-
name: "postgres",
|
|
587
|
-
capabilities: {
|
|
588
|
-
standardQueryStrategy: "cte_project",
|
|
589
|
-
recursiveQueryStrategy: "recursive_cte",
|
|
590
|
-
materializeIntermediateTraversalCtes: false,
|
|
591
|
-
emitNotMaterializedHint: true,
|
|
592
|
-
forceRecursiveWorktableOuterJoinOrder: false,
|
|
593
|
-
vectorPredicateStrategy: "native",
|
|
594
|
-
vectorMetrics: ["cosine", "l2", "inner_product"],
|
|
595
|
-
supportsFulltext: true
|
|
596
|
-
},
|
|
597
|
-
binaryText(expression) {
|
|
598
|
-
return chunkOJHD3LXJ_cjs.sql`${expression} COLLATE "C"`;
|
|
599
|
-
},
|
|
600
|
-
analyzeTemporaryTable(table) {
|
|
601
|
-
return chunkOJHD3LXJ_cjs.sql`ANALYZE ${table}`;
|
|
602
|
-
},
|
|
603
|
-
setTransactionWorkingMemory(workingMemory) {
|
|
604
|
-
return chunkOJHD3LXJ_cjs.sql`SELECT set_config('work_mem', ${workingMemory}, true)`;
|
|
605
|
-
},
|
|
606
|
-
// ============================================================
|
|
607
|
-
// JSON Path Operations
|
|
608
|
-
// ============================================================
|
|
609
|
-
compilePath(pointer) {
|
|
610
|
-
return toPostgresPath(pointer);
|
|
611
|
-
},
|
|
612
|
-
jsonExtract(column, pointer) {
|
|
613
|
-
const path = toPostgresPath(pointer);
|
|
614
|
-
return chunkOJHD3LXJ_cjs.sql`${column} #> ${path}`;
|
|
615
|
-
},
|
|
616
|
-
jsonExtractText(column, pointer) {
|
|
617
|
-
const path = toPostgresPath(pointer);
|
|
618
|
-
return chunkOJHD3LXJ_cjs.sql`${column} #>> ${path}`;
|
|
619
|
-
},
|
|
620
|
-
jsonExtractNumber(column, pointer) {
|
|
621
|
-
const path = toPostgresPath(pointer);
|
|
622
|
-
return chunkOJHD3LXJ_cjs.sql`(${column} #>> ${path})::numeric`;
|
|
623
|
-
},
|
|
624
|
-
jsonExtractDouble(column, pointer) {
|
|
625
|
-
const path = toPostgresPath(pointer);
|
|
626
|
-
return chunkOJHD3LXJ_cjs.sql`(${column} #>> ${path})::double precision`;
|
|
627
|
-
},
|
|
628
|
-
jsonExtractBoolean(column, pointer) {
|
|
629
|
-
const path = toPostgresPath(pointer);
|
|
630
|
-
return chunkOJHD3LXJ_cjs.sql`(${column} #>> ${path})::boolean`;
|
|
631
|
-
},
|
|
632
|
-
jsonExtractDate(column, pointer) {
|
|
633
|
-
const path = toPostgresPath(pointer);
|
|
634
|
-
return chunkOJHD3LXJ_cjs.sql`(${column} #>> ${path})::timestamptz`;
|
|
635
|
-
},
|
|
636
|
-
// ============================================================
|
|
637
|
-
// JSON Array Operations
|
|
638
|
-
// ============================================================
|
|
639
|
-
jsonArrayLength(column) {
|
|
640
|
-
return chunkOJHD3LXJ_cjs.sql`jsonb_array_length(${column})`;
|
|
641
|
-
},
|
|
642
|
-
jsonArrayContains(column, value) {
|
|
643
|
-
const jsonValue = JSON.stringify([value]);
|
|
644
|
-
return chunkOJHD3LXJ_cjs.sql`${column} @> ${jsonValue}::jsonb`;
|
|
645
|
-
},
|
|
646
|
-
jsonArrayContainsAll(column, values) {
|
|
647
|
-
if (values.length === 0) {
|
|
648
|
-
return chunkOJHD3LXJ_cjs.sql.raw("1=1");
|
|
649
|
-
}
|
|
650
|
-
const jsonValue = JSON.stringify(values);
|
|
651
|
-
return chunkOJHD3LXJ_cjs.sql`${column} @> ${jsonValue}::jsonb`;
|
|
652
|
-
},
|
|
653
|
-
jsonArrayContainsAny(column, values) {
|
|
654
|
-
if (values.length === 0) {
|
|
655
|
-
return chunkOJHD3LXJ_cjs.sql.raw("1=0");
|
|
656
|
-
}
|
|
657
|
-
const conditions = values.map((value) => {
|
|
658
|
-
const jsonValue = JSON.stringify([value]);
|
|
659
|
-
return chunkOJHD3LXJ_cjs.sql`${column} @> ${jsonValue}::jsonb`;
|
|
660
|
-
});
|
|
661
|
-
return chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(conditions, chunkOJHD3LXJ_cjs.sql` OR `)})`;
|
|
662
|
-
},
|
|
663
|
-
// ============================================================
|
|
664
|
-
// JSON Object Operations
|
|
665
|
-
// ============================================================
|
|
666
|
-
jsonHasPath(column, pointer) {
|
|
667
|
-
const path = toPostgresPath(pointer);
|
|
668
|
-
return chunkOJHD3LXJ_cjs.sql`${column} #> ${path} IS NOT NULL`;
|
|
669
|
-
},
|
|
670
|
-
jsonPathIsNull(column, pointer) {
|
|
671
|
-
const path = toPostgresPath(pointer);
|
|
672
|
-
return chunkOJHD3LXJ_cjs.sql`COALESCE(jsonb_typeof(${column} #> ${path}) = 'null', TRUE)`;
|
|
673
|
-
},
|
|
674
|
-
jsonPathIsNumber(column, pointer) {
|
|
675
|
-
const path = toPostgresPath(pointer);
|
|
676
|
-
return chunkOJHD3LXJ_cjs.sql`COALESCE(jsonb_typeof(${column} #> ${path}) = 'number', FALSE)`;
|
|
677
|
-
},
|
|
678
|
-
jsonPathIsNotNull(column, pointer) {
|
|
679
|
-
const path = toPostgresPath(pointer);
|
|
680
|
-
return chunkOJHD3LXJ_cjs.sql`COALESCE(jsonb_typeof(${column} #> ${path}) <> 'null', FALSE)`;
|
|
681
|
-
},
|
|
682
|
-
jsonSetProperties(column, patch, unsetProperties = []) {
|
|
683
|
-
const withReplacements = Object.keys(patch).length === 0 ? column : chunkOJHD3LXJ_cjs.sql`${column} || ${JSON.stringify(patch)}::jsonb`;
|
|
684
|
-
if (unsetProperties.length === 0) return withReplacements;
|
|
685
|
-
const properties = unsetProperties.map((property) => chunkOJHD3LXJ_cjs.sql`${property}`);
|
|
686
|
-
return chunkOJHD3LXJ_cjs.sql`(${withReplacements}) - ARRAY[${chunkOJHD3LXJ_cjs.sql.join(properties, chunkOJHD3LXJ_cjs.sql`, `)}]::text[]`;
|
|
687
|
-
},
|
|
688
|
-
// ============================================================
|
|
689
|
-
// Comparison Operations
|
|
690
|
-
// ============================================================
|
|
691
|
-
nullSafeEquals(left, right) {
|
|
692
|
-
return chunkOJHD3LXJ_cjs.sql`${left} IS NOT DISTINCT FROM ${right}`;
|
|
693
|
-
},
|
|
694
|
-
inList(left, values, negated) {
|
|
695
|
-
const operator = negated ? chunkOJHD3LXJ_cjs.sql.raw("NOT IN") : chunkOJHD3LXJ_cjs.sql.raw("IN");
|
|
696
|
-
const placeholders = values.map((value) => chunkOJHD3LXJ_cjs.sql`${value}`);
|
|
697
|
-
return chunkOJHD3LXJ_cjs.sql`${left} ${operator} (${chunkOJHD3LXJ_cjs.sql.join(placeholders, chunkOJHD3LXJ_cjs.sql`, `)})`;
|
|
698
|
-
},
|
|
699
|
-
inListParameter(left, packedValues, { negated, elementType }) {
|
|
700
|
-
const operator = negated ? chunkOJHD3LXJ_cjs.sql.raw("NOT IN") : chunkOJHD3LXJ_cjs.sql.raw("IN");
|
|
701
|
-
const element = chunkOJHD3LXJ_cjs.sql`in_list_element.value${postgresElementCast(elementType)}`;
|
|
702
|
-
return chunkOJHD3LXJ_cjs.sql`${left} ${operator} (SELECT ${element} FROM jsonb_array_elements_text(${packedValues}::jsonb) AS in_list_element(value))`;
|
|
703
|
-
},
|
|
704
|
-
packListValue(values) {
|
|
705
|
-
return chunkOJHD3LXJ_cjs.packSqlListValue(values, "postgres");
|
|
706
|
-
},
|
|
707
|
-
// ============================================================
|
|
708
|
-
// String Operations
|
|
709
|
-
// ============================================================
|
|
710
|
-
ilike(column, pattern) {
|
|
711
|
-
return chunkOJHD3LXJ_cjs.sql`${column} ILIKE ${pattern} ${chunkOJHD3LXJ_cjs.likeEscapeClause}`;
|
|
712
|
-
},
|
|
713
|
-
// ============================================================
|
|
714
|
-
// Set Operations
|
|
715
|
-
// ============================================================
|
|
716
|
-
wrapSetOperationOperand(inner) {
|
|
717
|
-
return chunkOJHD3LXJ_cjs.sql`(${inner})`;
|
|
718
|
-
},
|
|
719
|
-
// ============================================================
|
|
720
|
-
// Recursive CTE Path Operations
|
|
721
|
-
// ============================================================
|
|
722
|
-
initializePath(nodeId) {
|
|
723
|
-
return chunkOJHD3LXJ_cjs.sql`ARRAY[${nodeId}]`;
|
|
724
|
-
},
|
|
725
|
-
extendPath(currentPath, nodeId) {
|
|
726
|
-
return chunkOJHD3LXJ_cjs.sql`${currentPath} || ${nodeId}`;
|
|
727
|
-
},
|
|
728
|
-
cycleCheck(nodeId, path) {
|
|
729
|
-
return chunkOJHD3LXJ_cjs.sql`${nodeId} != ALL(${path})`;
|
|
730
|
-
},
|
|
731
|
-
// ============================================================
|
|
732
|
-
// Value Binding & Literals
|
|
733
|
-
// ============================================================
|
|
734
|
-
bindValue(value) {
|
|
735
|
-
return chunkOJHD3LXJ_cjs.getSqlDialectProfile("postgres").bindValue(value);
|
|
736
|
-
},
|
|
737
|
-
booleanLiteral(value) {
|
|
738
|
-
return chunkOJHD3LXJ_cjs.sql.raw(
|
|
739
|
-
chunkOJHD3LXJ_cjs.getSqlDialectProfile("postgres").booleanLiteralString(value)
|
|
740
|
-
);
|
|
741
|
-
},
|
|
742
|
-
booleanLiteralString(value) {
|
|
743
|
-
return chunkOJHD3LXJ_cjs.getSqlDialectProfile("postgres").booleanLiteralString(value);
|
|
744
|
-
},
|
|
745
|
-
quoteIdentifier(name) {
|
|
746
|
-
return `"${name.replaceAll('"', '""')}"`;
|
|
747
|
-
},
|
|
748
|
-
// ============================================================
|
|
749
|
-
// Vector Operations
|
|
750
|
-
// ============================================================
|
|
751
|
-
// Compile-time gate for `field.similarTo(...)`; the active
|
|
752
|
-
// `VectorStrategy` (pgvector) owns the distance SQL.
|
|
753
|
-
supportsVectors: true,
|
|
754
|
-
// ============================================================
|
|
755
|
-
// Fulltext Operations
|
|
756
|
-
// ============================================================
|
|
757
|
-
fulltext: tsvectorStrategy
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
// src/query/dialect/sqlite.ts
|
|
761
|
-
function escapeSqliteLiteral(value) {
|
|
762
|
-
return `'${value.replaceAll("'", "''")}'`;
|
|
763
|
-
}
|
|
764
|
-
function toSqlitePath(pointer) {
|
|
765
|
-
if (!pointer || pointer === "" || pointer === "/") {
|
|
766
|
-
return "$";
|
|
767
|
-
}
|
|
768
|
-
const segments = chunkA7J2YDDI_cjs.parseJsonPointer(pointer);
|
|
769
|
-
const parts = ["$"];
|
|
770
|
-
for (const segment of segments) {
|
|
771
|
-
if (isArrayIndex(segment)) {
|
|
772
|
-
parts.push(`[${segment}]`);
|
|
773
|
-
} else {
|
|
774
|
-
parts.push(`.${JSON.stringify(segment)}`);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
return parts.join("");
|
|
778
|
-
}
|
|
779
|
-
function toSqliteObjectPropertyPath(property) {
|
|
780
|
-
return `$.${JSON.stringify(property)}`;
|
|
781
|
-
}
|
|
782
|
-
var JSON_SET_REPLACEMENTS_PER_CALL = 50;
|
|
783
|
-
function isArrayIndex(segment) {
|
|
784
|
-
return /^\d+$/.test(segment);
|
|
785
|
-
}
|
|
786
|
-
var sqliteDialect = {
|
|
787
|
-
name: "sqlite",
|
|
788
|
-
capabilities: {
|
|
789
|
-
standardQueryStrategy: "cte_project",
|
|
790
|
-
recursiveQueryStrategy: "recursive_cte",
|
|
791
|
-
materializeIntermediateTraversalCtes: true,
|
|
792
|
-
emitNotMaterializedHint: false,
|
|
793
|
-
forceRecursiveWorktableOuterJoinOrder: true,
|
|
794
|
-
vectorPredicateStrategy: "native",
|
|
795
|
-
vectorMetrics: ["cosine", "l2"],
|
|
796
|
-
supportsFulltext: true
|
|
797
|
-
},
|
|
798
|
-
binaryText(expression) {
|
|
799
|
-
return expression;
|
|
800
|
-
},
|
|
801
|
-
analyzeTemporaryTable() {
|
|
802
|
-
return;
|
|
803
|
-
},
|
|
804
|
-
setTransactionWorkingMemory() {
|
|
805
|
-
return;
|
|
806
|
-
},
|
|
807
|
-
// ============================================================
|
|
808
|
-
// JSON Path Operations
|
|
809
|
-
// ============================================================
|
|
810
|
-
compilePath(pointer) {
|
|
811
|
-
return chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(toSqlitePath(pointer)));
|
|
812
|
-
},
|
|
813
|
-
jsonExtract(column, pointer) {
|
|
814
|
-
const path = toSqlitePath(pointer);
|
|
815
|
-
return chunkOJHD3LXJ_cjs.sql`json_extract(${column}, ${chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path))})`;
|
|
816
|
-
},
|
|
817
|
-
jsonExtractText(column, pointer) {
|
|
818
|
-
const path = toSqlitePath(pointer);
|
|
819
|
-
return chunkOJHD3LXJ_cjs.sql`json_extract(${column}, ${chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path))})`;
|
|
820
|
-
},
|
|
821
|
-
jsonExtractNumber(column, pointer) {
|
|
822
|
-
const path = toSqlitePath(pointer);
|
|
823
|
-
return chunkOJHD3LXJ_cjs.sql`json_extract(${column}, ${chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path))})`;
|
|
824
|
-
},
|
|
825
|
-
jsonExtractDouble(column, pointer) {
|
|
826
|
-
const path = toSqlitePath(pointer);
|
|
827
|
-
return chunkOJHD3LXJ_cjs.sql`json_extract(${column}, ${chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path))})`;
|
|
828
|
-
},
|
|
829
|
-
jsonExtractBoolean(column, pointer) {
|
|
830
|
-
const path = toSqlitePath(pointer);
|
|
831
|
-
return chunkOJHD3LXJ_cjs.sql`json_extract(${column}, ${chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path))})`;
|
|
832
|
-
},
|
|
833
|
-
jsonExtractDate(column, pointer) {
|
|
834
|
-
const path = toSqlitePath(pointer);
|
|
835
|
-
return chunkOJHD3LXJ_cjs.sql`json_extract(${column}, ${chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path))})`;
|
|
836
|
-
},
|
|
837
|
-
// ============================================================
|
|
838
|
-
// JSON Array Operations
|
|
839
|
-
// ============================================================
|
|
840
|
-
jsonArrayLength(column) {
|
|
841
|
-
return chunkOJHD3LXJ_cjs.sql`json_array_length(${column})`;
|
|
842
|
-
},
|
|
843
|
-
jsonArrayContains(column, value) {
|
|
844
|
-
return chunkOJHD3LXJ_cjs.sql`EXISTS (SELECT 1 FROM json_each(${column}) WHERE json_each.value = ${value})`;
|
|
845
|
-
},
|
|
846
|
-
jsonArrayContainsAll(column, values) {
|
|
847
|
-
if (values.length === 0) {
|
|
848
|
-
return chunkOJHD3LXJ_cjs.sql.raw("1=1");
|
|
849
|
-
}
|
|
850
|
-
const packedValues = JSON.stringify(values);
|
|
851
|
-
return chunkOJHD3LXJ_cjs.sql`
|
|
852
|
-
NOT EXISTS (
|
|
853
|
-
SELECT 1 FROM json_each(${packedValues}) AS tg_required
|
|
854
|
-
WHERE NOT EXISTS (
|
|
855
|
-
SELECT 1 FROM json_each(${column}) AS tg_actual
|
|
856
|
-
WHERE tg_actual.value = tg_required.value
|
|
857
|
-
)
|
|
858
|
-
)
|
|
859
|
-
`;
|
|
860
|
-
},
|
|
861
|
-
jsonArrayContainsAny(column, values) {
|
|
862
|
-
if (values.length === 0) {
|
|
863
|
-
return chunkOJHD3LXJ_cjs.sql.raw("1=0");
|
|
864
|
-
}
|
|
865
|
-
const packedValues = JSON.stringify(values);
|
|
866
|
-
return chunkOJHD3LXJ_cjs.sql`
|
|
867
|
-
EXISTS (
|
|
868
|
-
SELECT 1
|
|
869
|
-
FROM json_each(${column}) AS tg_actual
|
|
870
|
-
JOIN json_each(${packedValues}) AS tg_wanted
|
|
871
|
-
ON tg_actual.value = tg_wanted.value
|
|
872
|
-
)
|
|
873
|
-
`;
|
|
874
|
-
},
|
|
875
|
-
// ============================================================
|
|
876
|
-
// JSON Object Operations
|
|
877
|
-
// ============================================================
|
|
878
|
-
jsonHasPath(column, pointer) {
|
|
879
|
-
const path = toSqlitePath(pointer);
|
|
880
|
-
return chunkOJHD3LXJ_cjs.sql`json_type(${column}, ${chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path))}) IS NOT NULL`;
|
|
881
|
-
},
|
|
882
|
-
jsonPathIsNull(column, pointer) {
|
|
883
|
-
const path = toSqlitePath(pointer);
|
|
884
|
-
const pathSql = chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path));
|
|
885
|
-
return chunkOJHD3LXJ_cjs.sql`COALESCE(json_type(${column}, ${pathSql}) = 'null', 1)`;
|
|
886
|
-
},
|
|
887
|
-
jsonPathIsNumber(column, pointer) {
|
|
888
|
-
const path = toSqlitePath(pointer);
|
|
889
|
-
const pathSql = chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path));
|
|
890
|
-
return chunkOJHD3LXJ_cjs.sql`COALESCE(json_type(${column}, ${pathSql}) IN ('integer', 'real'), 0)`;
|
|
891
|
-
},
|
|
892
|
-
jsonPathIsNotNull(column, pointer) {
|
|
893
|
-
const path = toSqlitePath(pointer);
|
|
894
|
-
const pathSql = chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(path));
|
|
895
|
-
return chunkOJHD3LXJ_cjs.sql`COALESCE(json_type(${column}, ${pathSql}) <> 'null', 0)`;
|
|
896
|
-
},
|
|
897
|
-
jsonSetProperties(column, patch, unsetProperties = []) {
|
|
898
|
-
const entries = Object.entries(patch);
|
|
899
|
-
let patchedColumn = column;
|
|
900
|
-
for (let offset = 0; offset < entries.length; offset += JSON_SET_REPLACEMENTS_PER_CALL) {
|
|
901
|
-
const replacements = entries.slice(offset, offset + JSON_SET_REPLACEMENTS_PER_CALL).flatMap(([property, value]) => [
|
|
902
|
-
chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(toSqliteObjectPropertyPath(property))),
|
|
903
|
-
chunkOJHD3LXJ_cjs.sql`json(${JSON.stringify(value)})`
|
|
904
|
-
]);
|
|
905
|
-
patchedColumn = chunkOJHD3LXJ_cjs.sql`json_set(${patchedColumn}, ${chunkOJHD3LXJ_cjs.sql.join(replacements, chunkOJHD3LXJ_cjs.sql`, `)})`;
|
|
906
|
-
}
|
|
907
|
-
if (unsetProperties.length === 0) return patchedColumn;
|
|
908
|
-
const removalPaths = unsetProperties.map(
|
|
909
|
-
(property) => chunkOJHD3LXJ_cjs.sql.raw(escapeSqliteLiteral(toSqliteObjectPropertyPath(property)))
|
|
910
|
-
);
|
|
911
|
-
return chunkOJHD3LXJ_cjs.sql`json_remove(${patchedColumn}, ${chunkOJHD3LXJ_cjs.sql.join(removalPaths, chunkOJHD3LXJ_cjs.sql`, `)})`;
|
|
912
|
-
},
|
|
913
|
-
// ============================================================
|
|
914
|
-
// Comparison Operations
|
|
915
|
-
// ============================================================
|
|
916
|
-
nullSafeEquals(left, right) {
|
|
917
|
-
return chunkOJHD3LXJ_cjs.sql`${left} IS ${right}`;
|
|
918
|
-
},
|
|
919
|
-
inList(left, values, negated) {
|
|
920
|
-
const operator = negated ? chunkOJHD3LXJ_cjs.sql.raw("NOT IN") : chunkOJHD3LXJ_cjs.sql.raw("IN");
|
|
921
|
-
const packedValues = JSON.stringify(values);
|
|
922
|
-
return chunkOJHD3LXJ_cjs.sql`${left} ${operator} (SELECT value FROM json_each(${packedValues}))`;
|
|
923
|
-
},
|
|
924
|
-
inListParameter(left, packedValues, { negated }) {
|
|
925
|
-
const operator = negated ? chunkOJHD3LXJ_cjs.sql.raw("NOT IN") : chunkOJHD3LXJ_cjs.sql.raw("IN");
|
|
926
|
-
return chunkOJHD3LXJ_cjs.sql`${left} ${operator} (SELECT value FROM json_each(${packedValues}))`;
|
|
927
|
-
},
|
|
928
|
-
packListValue(values) {
|
|
929
|
-
return chunkOJHD3LXJ_cjs.packSqlListValue(values, "sqlite");
|
|
930
|
-
},
|
|
931
|
-
// ============================================================
|
|
932
|
-
// String Operations
|
|
933
|
-
// ============================================================
|
|
934
|
-
ilike(column, pattern) {
|
|
935
|
-
return chunkOJHD3LXJ_cjs.sql`LOWER(${column}) LIKE LOWER(${pattern}) ${chunkOJHD3LXJ_cjs.likeEscapeClause}`;
|
|
936
|
-
},
|
|
937
|
-
// ============================================================
|
|
938
|
-
// Set Operations
|
|
939
|
-
// ============================================================
|
|
940
|
-
wrapSetOperationOperand(inner) {
|
|
941
|
-
return chunkOJHD3LXJ_cjs.sql`SELECT * FROM (${inner})`;
|
|
942
|
-
},
|
|
943
|
-
// ============================================================
|
|
944
|
-
// Recursive CTE Path Operations
|
|
945
|
-
// ============================================================
|
|
946
|
-
initializePath(nodeId) {
|
|
947
|
-
return chunkOJHD3LXJ_cjs.sql`'|' || ${nodeId} || '|'`;
|
|
948
|
-
},
|
|
949
|
-
extendPath(currentPath, nodeId) {
|
|
950
|
-
return chunkOJHD3LXJ_cjs.sql`${currentPath} || ${nodeId} || '|'`;
|
|
951
|
-
},
|
|
952
|
-
cycleCheck(nodeId, path) {
|
|
953
|
-
return chunkOJHD3LXJ_cjs.sql`INSTR(${path}, '|' || ${nodeId} || '|') = 0`;
|
|
954
|
-
},
|
|
955
|
-
// ============================================================
|
|
956
|
-
// Value Binding & Literals
|
|
957
|
-
// ============================================================
|
|
958
|
-
bindValue(value) {
|
|
959
|
-
return chunkOJHD3LXJ_cjs.getSqlDialectProfile("sqlite").bindValue(value);
|
|
960
|
-
},
|
|
961
|
-
booleanLiteral(value) {
|
|
962
|
-
return chunkOJHD3LXJ_cjs.sql.raw(chunkOJHD3LXJ_cjs.getSqlDialectProfile("sqlite").booleanLiteralString(value));
|
|
963
|
-
},
|
|
964
|
-
booleanLiteralString(value) {
|
|
965
|
-
return chunkOJHD3LXJ_cjs.getSqlDialectProfile("sqlite").booleanLiteralString(value);
|
|
966
|
-
},
|
|
967
|
-
quoteIdentifier(name) {
|
|
968
|
-
return `"${name.replaceAll('"', '""')}"`;
|
|
969
|
-
},
|
|
970
|
-
// ============================================================
|
|
971
|
-
// Vector Operations
|
|
972
|
-
// ============================================================
|
|
973
|
-
// Compile-time gate for `field.similarTo(...)`; the active
|
|
974
|
-
// `VectorStrategy` (sqlite-vec / libSQL-native) owns the distance SQL.
|
|
975
|
-
supportsVectors: true,
|
|
976
|
-
// ============================================================
|
|
977
|
-
// Fulltext Operations
|
|
978
|
-
// ============================================================
|
|
979
|
-
fulltext: fts5Strategy
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
// src/query/dialect/index.ts
|
|
983
|
-
var DIALECT_ADAPTERS = {
|
|
984
|
-
sqlite: sqliteDialect,
|
|
985
|
-
postgres: postgresDialect
|
|
986
|
-
};
|
|
987
|
-
function getDialect(dialect) {
|
|
988
|
-
return DIALECT_ADAPTERS[dialect];
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
// src/indexes/compiler.ts
|
|
992
|
-
function compileNodeIndexKeys(index, dialect, propsColumn, systemColumn) {
|
|
993
|
-
const adapter = getDialect(dialect);
|
|
994
|
-
const keys = [];
|
|
995
|
-
const systemColumns = [
|
|
996
|
-
...getNodeScopeColumns(index.scope),
|
|
997
|
-
...index.keySystemColumns ?? []
|
|
998
|
-
];
|
|
999
|
-
for (const column of systemColumns) {
|
|
1000
|
-
keys.push(systemColumn(column));
|
|
1001
|
-
}
|
|
1002
|
-
const allPointers = [...index.fields, ...index.coveringFields];
|
|
1003
|
-
const allValueTypes = [
|
|
1004
|
-
...index.fieldValueTypes,
|
|
1005
|
-
...index.coveringFieldValueTypes
|
|
1006
|
-
];
|
|
1007
|
-
for (const [pointerIndex, pointer] of allPointers.entries()) {
|
|
1008
|
-
const valueType = allValueTypes[pointerIndex];
|
|
1009
|
-
const extracted = compileIndexKeyValue(
|
|
1010
|
-
adapter,
|
|
1011
|
-
propsColumn,
|
|
1012
|
-
pointer,
|
|
1013
|
-
valueType
|
|
1014
|
-
);
|
|
1015
|
-
keys.push(chunkOJHD3LXJ_cjs.sql`(${extracted})`);
|
|
1016
|
-
}
|
|
1017
|
-
return { keys };
|
|
1018
|
-
}
|
|
1019
|
-
function compileEdgeIndexKeys(index, dialect, propsColumn, systemColumn) {
|
|
1020
|
-
const adapter = getDialect(dialect);
|
|
1021
|
-
const keys = [];
|
|
1022
|
-
for (const column of getEdgeScopeColumns(index.scope, index.direction)) {
|
|
1023
|
-
keys.push(systemColumn(column));
|
|
1024
|
-
}
|
|
1025
|
-
const allPointers = [...index.fields, ...index.coveringFields];
|
|
1026
|
-
const allValueTypes = [
|
|
1027
|
-
...index.fieldValueTypes,
|
|
1028
|
-
...index.coveringFieldValueTypes
|
|
1029
|
-
];
|
|
1030
|
-
for (const [pointerIndex, pointer] of allPointers.entries()) {
|
|
1031
|
-
const valueType = allValueTypes[pointerIndex];
|
|
1032
|
-
const extracted = compileIndexKeyValue(
|
|
1033
|
-
adapter,
|
|
1034
|
-
propsColumn,
|
|
1035
|
-
pointer,
|
|
1036
|
-
valueType
|
|
1037
|
-
);
|
|
1038
|
-
keys.push(chunkOJHD3LXJ_cjs.sql`(${extracted})`);
|
|
1039
|
-
}
|
|
1040
|
-
return { keys };
|
|
1041
|
-
}
|
|
1042
|
-
function compileNodeIndexFieldKeys(index, ctx) {
|
|
1043
|
-
const adapter = getDialect(ctx.dialect);
|
|
1044
|
-
const keys = [];
|
|
1045
|
-
for (const [position, pointer] of index.fields.entries()) {
|
|
1046
|
-
const extracted = compileIndexKeyValue(
|
|
1047
|
-
adapter,
|
|
1048
|
-
ctx.propsColumn,
|
|
1049
|
-
pointer,
|
|
1050
|
-
index.fieldValueTypes[position]
|
|
1051
|
-
);
|
|
1052
|
-
keys.push(chunkOJHD3LXJ_cjs.sql`(${extracted})`);
|
|
1053
|
-
}
|
|
1054
|
-
return keys;
|
|
1055
|
-
}
|
|
1056
|
-
function compileIndexKeyValue(dialect, propsColumn, pointer, valueType) {
|
|
1057
|
-
switch (valueType) {
|
|
1058
|
-
case "number": {
|
|
1059
|
-
return dialect.jsonExtractNumber(propsColumn, pointer);
|
|
1060
|
-
}
|
|
1061
|
-
case "boolean": {
|
|
1062
|
-
return dialect.jsonExtractBoolean(propsColumn, pointer);
|
|
1063
|
-
}
|
|
1064
|
-
case "date": {
|
|
1065
|
-
return dialect.jsonExtractDate(propsColumn, pointer);
|
|
1066
|
-
}
|
|
1067
|
-
case "string":
|
|
1068
|
-
case "unknown":
|
|
1069
|
-
case void 0: {
|
|
1070
|
-
return dialect.jsonExtractText(propsColumn, pointer);
|
|
1071
|
-
}
|
|
1072
|
-
case "array":
|
|
1073
|
-
case "object":
|
|
1074
|
-
case "embedding": {
|
|
1075
|
-
return dialect.jsonExtract(propsColumn, pointer);
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
function getNodeScopeColumns(scope) {
|
|
1080
|
-
switch (scope) {
|
|
1081
|
-
case "graphAndKind": {
|
|
1082
|
-
return ["graph_id", "kind"];
|
|
1083
|
-
}
|
|
1084
|
-
case "graph": {
|
|
1085
|
-
return ["graph_id"];
|
|
1086
|
-
}
|
|
1087
|
-
case "none": {
|
|
1088
|
-
return [];
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
function getEdgeScopeColumns(scope, direction) {
|
|
1093
|
-
const base = scope === "graphAndKind" ? ["graph_id", "kind"] : scope === "graph" ? ["graph_id"] : [];
|
|
1094
|
-
if (direction === "out") {
|
|
1095
|
-
return [...base, "from_id"];
|
|
1096
|
-
}
|
|
1097
|
-
if (direction === "in") {
|
|
1098
|
-
return [...base, "to_id"];
|
|
1099
|
-
}
|
|
1100
|
-
return [...base];
|
|
1101
|
-
}
|
|
1102
|
-
function isIndexWhereLiteralList(value) {
|
|
1103
|
-
return Array.isArray(value);
|
|
1104
|
-
}
|
|
1105
|
-
function compileIndexWhere(ctx, expression) {
|
|
1106
|
-
switch (expression.__type) {
|
|
1107
|
-
case "index_where_and": {
|
|
1108
|
-
return chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(
|
|
1109
|
-
expression.predicates.map((p) => compileIndexWhere(ctx, p)),
|
|
1110
|
-
chunkOJHD3LXJ_cjs.sql` AND `
|
|
1111
|
-
)})`;
|
|
1112
|
-
}
|
|
1113
|
-
case "index_where_or": {
|
|
1114
|
-
return chunkOJHD3LXJ_cjs.sql`(${chunkOJHD3LXJ_cjs.sql.join(
|
|
1115
|
-
expression.predicates.map((p) => compileIndexWhere(ctx, p)),
|
|
1116
|
-
chunkOJHD3LXJ_cjs.sql` OR `
|
|
1117
|
-
)})`;
|
|
1118
|
-
}
|
|
1119
|
-
case "index_where_not": {
|
|
1120
|
-
return chunkOJHD3LXJ_cjs.sql`(NOT ${compileIndexWhere(ctx, expression.predicate)})`;
|
|
1121
|
-
}
|
|
1122
|
-
case "index_where_null_check": {
|
|
1123
|
-
const operand = compileIndexWhereOperand(ctx, expression.operand);
|
|
1124
|
-
return expression.op === "isNull" ? chunkOJHD3LXJ_cjs.sql`${operand} IS NULL` : chunkOJHD3LXJ_cjs.sql`${operand} IS NOT NULL`;
|
|
1125
|
-
}
|
|
1126
|
-
case "index_where_comparison": {
|
|
1127
|
-
const left = compileIndexWhereOperand(ctx, expression.left);
|
|
1128
|
-
const right = expression.right;
|
|
1129
|
-
if (isIndexWhereLiteralList(right)) {
|
|
1130
|
-
if (expression.op !== "in" && expression.op !== "notIn") {
|
|
1131
|
-
throw new Error(
|
|
1132
|
-
`Operator "${expression.op}" does not support list comparison in index WHERE clause`
|
|
1133
|
-
);
|
|
1134
|
-
}
|
|
1135
|
-
const values = right.map(
|
|
1136
|
-
(literal) => compileIndexWhereLiteral(ctx.dialect, literal)
|
|
1137
|
-
);
|
|
1138
|
-
const operator = expression.op === "in" ? chunkOJHD3LXJ_cjs.sql`IN` : chunkOJHD3LXJ_cjs.sql`NOT IN`;
|
|
1139
|
-
return chunkOJHD3LXJ_cjs.sql`${left} ${operator} (${chunkOJHD3LXJ_cjs.sql.join(values, chunkOJHD3LXJ_cjs.sql`, `)})`;
|
|
1140
|
-
}
|
|
1141
|
-
if (expression.op === "in" || expression.op === "notIn") {
|
|
1142
|
-
throw new Error(
|
|
1143
|
-
`Operator "${expression.op}" requires a list of values in index WHERE clause`
|
|
1144
|
-
);
|
|
1145
|
-
}
|
|
1146
|
-
const rightLiteral = compileIndexWhereLiteral(ctx.dialect, right);
|
|
1147
|
-
const opSql = compileComparisonOperator(expression.op);
|
|
1148
|
-
return chunkOJHD3LXJ_cjs.sql`${left} ${opSql} ${rightLiteral}`;
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
function compileIndexWhereOperand(ctx, operand) {
|
|
1153
|
-
if (operand.__type === "index_operand_system") {
|
|
1154
|
-
return ctx.systemColumn(operand.column);
|
|
1155
|
-
}
|
|
1156
|
-
const adapter = getDialect(ctx.dialect);
|
|
1157
|
-
const pointer = chunkA7J2YDDI_cjs.jsonPointer([operand.field]);
|
|
1158
|
-
switch (operand.valueType) {
|
|
1159
|
-
case "number": {
|
|
1160
|
-
return adapter.jsonExtractNumber(ctx.propsColumn, pointer);
|
|
1161
|
-
}
|
|
1162
|
-
case "boolean": {
|
|
1163
|
-
return adapter.jsonExtractBoolean(ctx.propsColumn, pointer);
|
|
1164
|
-
}
|
|
1165
|
-
case "date": {
|
|
1166
|
-
return adapter.jsonExtractDate(ctx.propsColumn, pointer);
|
|
1167
|
-
}
|
|
1168
|
-
case "array":
|
|
1169
|
-
case "object":
|
|
1170
|
-
case "embedding": {
|
|
1171
|
-
return adapter.jsonExtract(ctx.propsColumn, pointer);
|
|
1172
|
-
}
|
|
1173
|
-
case "string":
|
|
1174
|
-
case "unknown":
|
|
1175
|
-
case void 0: {
|
|
1176
|
-
return adapter.jsonExtractText(ctx.propsColumn, pointer);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
function compileIndexWhereLiteral(dialect, literal) {
|
|
1181
|
-
switch (literal.valueType) {
|
|
1182
|
-
case "string":
|
|
1183
|
-
case "date": {
|
|
1184
|
-
return chunkOJHD3LXJ_cjs.sql.raw(escapeStringLiteral(literal.value.toString()));
|
|
1185
|
-
}
|
|
1186
|
-
case "number": {
|
|
1187
|
-
return chunkOJHD3LXJ_cjs.sql.raw(literal.value.toString());
|
|
1188
|
-
}
|
|
1189
|
-
case "boolean": {
|
|
1190
|
-
return getDialect(dialect).booleanLiteral(literal.value);
|
|
1191
|
-
}
|
|
1192
|
-
case "array":
|
|
1193
|
-
case "object":
|
|
1194
|
-
case "embedding":
|
|
1195
|
-
case "unknown": {
|
|
1196
|
-
return chunkOJHD3LXJ_cjs.sql.raw(escapeStringLiteral(literal.value.toString()));
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
function compileComparisonOperator(op) {
|
|
1201
|
-
switch (op) {
|
|
1202
|
-
case "eq": {
|
|
1203
|
-
return chunkOJHD3LXJ_cjs.sql`=`;
|
|
1204
|
-
}
|
|
1205
|
-
case "neq": {
|
|
1206
|
-
return chunkOJHD3LXJ_cjs.sql`<>`;
|
|
1207
|
-
}
|
|
1208
|
-
case "gt": {
|
|
1209
|
-
return chunkOJHD3LXJ_cjs.sql`>`;
|
|
1210
|
-
}
|
|
1211
|
-
case "gte": {
|
|
1212
|
-
return chunkOJHD3LXJ_cjs.sql`>=`;
|
|
1213
|
-
}
|
|
1214
|
-
case "lt": {
|
|
1215
|
-
return chunkOJHD3LXJ_cjs.sql`<`;
|
|
1216
|
-
}
|
|
1217
|
-
case "lte": {
|
|
1218
|
-
return chunkOJHD3LXJ_cjs.sql`<=`;
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
function escapeStringLiteral(value) {
|
|
1223
|
-
return `'${value.replaceAll("'", "''")}'`;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
exports.ALL_FULLTEXT_MODES = ALL_FULLTEXT_MODES;
|
|
1227
|
-
exports.BASE_CONTRIBUTION_OWNER = BASE_CONTRIBUTION_OWNER;
|
|
1228
|
-
exports.FULLTEXT_CONTRIBUTION_NAME = FULLTEXT_CONTRIBUTION_NAME;
|
|
1229
|
-
exports.VECTOR_CONTRIBUTION_PREFIX = VECTOR_CONTRIBUTION_PREFIX;
|
|
1230
|
-
exports.assertApproximateMetricSupported = assertApproximateMetricSupported;
|
|
1231
|
-
exports.assertFiniteEmbedding = assertFiniteEmbedding;
|
|
1232
|
-
exports.assertVectorMinScore = assertVectorMinScore;
|
|
1233
|
-
exports.assertVectorSearchLimit = assertVectorSearchLimit;
|
|
1234
|
-
exports.buildForeignFulltextGraphProbe = buildForeignFulltextGraphProbe;
|
|
1235
|
-
exports.buildFulltextCapabilities = buildFulltextCapabilities;
|
|
1236
|
-
exports.buildFulltextGraphDelete = buildFulltextGraphDelete;
|
|
1237
|
-
exports.buildVectorCapabilities = buildVectorCapabilities;
|
|
1238
|
-
exports.compileEdgeIndexKeys = compileEdgeIndexKeys;
|
|
1239
|
-
exports.compileIndexWhere = compileIndexWhere;
|
|
1240
|
-
exports.compileNodeIndexFieldKeys = compileNodeIndexFieldKeys;
|
|
1241
|
-
exports.compileNodeIndexKeys = compileNodeIndexKeys;
|
|
1242
|
-
exports.fts5Strategy = fts5Strategy;
|
|
1243
|
-
exports.getDialect = getDialect;
|
|
1244
|
-
exports.getNodeScopeColumns = getNodeScopeColumns;
|
|
1245
|
-
exports.quoteIdentifier = quoteIdentifier2;
|
|
1246
|
-
exports.resolveEfSearchOverride = resolveEfSearchOverride;
|
|
1247
|
-
exports.shortHash = shortHash;
|
|
1248
|
-
exports.tsvectorStrategy = tsvectorStrategy;
|
|
1249
|
-
exports.vectorMinScoreCondition = vectorMinScoreCondition;
|
|
1250
|
-
exports.vectorPhysicalName = vectorPhysicalName;
|
|
1251
|
-
exports.vectorScoreExpression = vectorScoreExpression;
|
|
1252
|
-
exports.vectorSearchFrontierTuning = vectorSearchFrontierTuning;
|
|
1253
|
-
//# sourceMappingURL=chunk-TEC24ZDA.cjs.map
|
|
1254
|
-
//# sourceMappingURL=chunk-TEC24ZDA.cjs.map
|