@nicia-ai/typegraph 0.43.0 → 0.45.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 +9 -9
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/drizzle/indexes.js +5 -5
- package/dist/backend/index.cjs +50 -50
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +11 -11
- package/dist/backend/postgres/index.cjs +26 -26
- package/dist/backend/postgres/index.d.cts +6 -5
- package/dist/backend/postgres/index.d.ts +6 -5
- package/dist/backend/postgres/index.js +13 -13
- package/dist/backend/postgres/pglite-store.cjs +32 -33
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +7 -7
- package/dist/backend/postgres/pglite-store.d.ts +7 -7
- package/dist/backend/postgres/pglite-store.js +28 -29
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +15 -15
- package/dist/backend/postgres/pglite.d.cts +3 -2
- package/dist/backend/postgres/pglite.d.ts +3 -2
- package/dist/backend/postgres/pglite.js +14 -14
- package/dist/backend/sqlite/index.cjs +23 -23
- package/dist/backend/sqlite/index.d.cts +7 -6
- package/dist/backend/sqlite/index.d.ts +7 -6
- package/dist/backend/sqlite/index.js +11 -11
- package/dist/backend/sqlite/libsql.cjs +17 -17
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -2
- package/dist/backend/sqlite/libsql.d.ts +3 -2
- package/dist/backend/sqlite/libsql.js +13 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +33 -34
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +8 -7
- package/dist/backend/sqlite/local-store.d.ts +8 -7
- package/dist/backend/sqlite/local-store.js +29 -30
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +16 -16
- package/dist/backend/sqlite/local.d.cts +3 -2
- package/dist/backend/sqlite/local.d.ts +3 -2
- package/dist/backend/sqlite/local.js +14 -14
- package/dist/{chunk-2OOY4OYT.js → chunk-2L54C2C2.js} +4 -4
- package/dist/{chunk-2OOY4OYT.js.map → chunk-2L54C2C2.js.map} +1 -1
- package/dist/{chunk-4WYFRACU.js → chunk-42PYUGLS.js} +58 -4
- package/dist/chunk-42PYUGLS.js.map +1 -0
- package/dist/{chunk-EQOQOT55.js → chunk-4GUBTVPV.js} +4 -5
- package/dist/chunk-4GUBTVPV.js.map +1 -0
- package/dist/{chunk-ZIRC2U6G.js → chunk-4GUTQPVO.js} +102 -16
- package/dist/chunk-4GUTQPVO.js.map +1 -0
- package/dist/{chunk-OYJSYDIH.js → chunk-4MB3AQAQ.js} +13 -3
- package/dist/chunk-4MB3AQAQ.js.map +1 -0
- package/dist/{chunk-5Q3P6OIC.cjs → chunk-4MEWSUVM.cjs} +12 -12
- package/dist/chunk-4MEWSUVM.cjs.map +1 -0
- package/dist/{chunk-VC26BUNP.js → chunk-4QIKLIGG.js} +17 -5
- package/dist/chunk-4QIKLIGG.js.map +1 -0
- package/dist/chunk-4SZ6XPTG.cjs +12 -0
- package/dist/{chunk-VGMNGWBR.cjs.map → chunk-4SZ6XPTG.cjs.map} +1 -1
- package/dist/{chunk-UZLEQFTV.js → chunk-55ITBQJI.js} +4 -4
- package/dist/chunk-55ITBQJI.js.map +1 -0
- package/dist/{chunk-JOYPNY33.js → chunk-5EKPX6QU.js} +9 -9
- package/dist/{chunk-JOYPNY33.js.map → chunk-5EKPX6QU.js.map} +1 -1
- package/dist/{chunk-TRC646QQ.cjs → chunk-5GAONX5G.cjs} +7 -7
- package/dist/{chunk-TRC646QQ.cjs.map → chunk-5GAONX5G.cjs.map} +1 -1
- package/dist/{chunk-M4GYQF2H.js → chunk-6DCB664D.js} +7 -4
- package/dist/chunk-6DCB664D.js.map +1 -0
- package/dist/{chunk-64LERBFM.cjs → chunk-6RYPD3NJ.cjs} +75 -65
- package/dist/chunk-6RYPD3NJ.cjs.map +1 -0
- package/dist/{chunk-5AERZSHC.cjs → chunk-7PF2L3H6.cjs} +4 -4
- package/dist/{chunk-5AERZSHC.cjs.map → chunk-7PF2L3H6.cjs.map} +1 -1
- package/dist/chunk-B3F2D3SP.cjs +12 -0
- package/dist/{chunk-U3YRCZ5L.cjs.map → chunk-B3F2D3SP.cjs.map} +1 -1
- package/dist/{chunk-Z3WIL6S3.js → chunk-BGYJW37L.js} +5 -5
- package/dist/{chunk-Z3WIL6S3.js.map → chunk-BGYJW37L.js.map} +1 -1
- package/dist/{chunk-DMZEVJGL.cjs → chunk-BNS75YNF.cjs} +12 -13
- package/dist/chunk-BNS75YNF.cjs.map +1 -0
- package/dist/{chunk-KTBTSHU6.cjs → chunk-C4F7VJ5D.cjs} +13 -3
- package/dist/chunk-C4F7VJ5D.cjs.map +1 -0
- package/dist/{chunk-L2BYRYHC.js → chunk-CBKG6HEP.js} +43 -33
- package/dist/chunk-CBKG6HEP.js.map +1 -0
- package/dist/{chunk-CVK4T34X.cjs → chunk-CPEL3YIR.cjs} +22 -22
- package/dist/{chunk-CVK4T34X.cjs.map → chunk-CPEL3YIR.cjs.map} +1 -1
- package/dist/{chunk-O2GZM7UK.cjs → chunk-D54WH24V.cjs} +62 -7
- package/dist/chunk-D54WH24V.cjs.map +1 -0
- package/dist/{chunk-33PAKPED.cjs → chunk-D56XG4EI.cjs} +53 -41
- package/dist/chunk-D56XG4EI.cjs.map +1 -0
- package/dist/{chunk-O3USVVWS.js → chunk-DK2S42XB.js} +3 -3
- package/dist/{chunk-O3USVVWS.js.map → chunk-DK2S42XB.js.map} +1 -1
- package/dist/{chunk-HHBKGPEI.js → chunk-DXEEHSGN.js} +517 -26
- package/dist/chunk-DXEEHSGN.js.map +1 -0
- package/dist/{chunk-UJRWOV5B.js → chunk-EFEOOCJ3.js} +5 -5
- package/dist/{chunk-UJRWOV5B.js.map → chunk-EFEOOCJ3.js.map} +1 -1
- package/dist/{chunk-ECU53PMN.cjs → chunk-EKFUG4G7.cjs} +5 -5
- package/dist/chunk-EKFUG4G7.cjs.map +1 -0
- package/dist/{chunk-FSCJOTHF.cjs → chunk-EQ7JKLZO.cjs} +10 -10
- package/dist/{chunk-FSCJOTHF.cjs.map → chunk-EQ7JKLZO.cjs.map} +1 -1
- package/dist/{chunk-AQR6BHB3.cjs → chunk-F4NHQHEZ.cjs} +10 -10
- package/dist/{chunk-AQR6BHB3.cjs.map → chunk-F4NHQHEZ.cjs.map} +1 -1
- package/dist/{chunk-2G6ZEGYO.js → chunk-FL5UQRES.js} +4 -4
- package/dist/{chunk-2G6ZEGYO.js.map → chunk-FL5UQRES.js.map} +1 -1
- package/dist/{chunk-ZP2KPDNN.js → chunk-FLEQ2HBK.js} +3 -3
- package/dist/{chunk-ZP2KPDNN.js.map → chunk-FLEQ2HBK.js.map} +1 -1
- package/dist/{chunk-RAWG2FEU.js → chunk-FQ7ZPOTZ.js} +264 -18
- package/dist/chunk-FQ7ZPOTZ.js.map +1 -0
- package/dist/{chunk-O7XVCLXW.cjs → chunk-H7VE3FL4.cjs} +577 -82
- package/dist/chunk-H7VE3FL4.cjs.map +1 -0
- package/dist/{chunk-JNXZQBN3.js → chunk-ID4WXTKL.js} +1039 -482
- package/dist/chunk-ID4WXTKL.js.map +1 -0
- package/dist/{chunk-ZGOUVMVS.js → chunk-ISLPNELU.js} +17 -5
- package/dist/chunk-ISLPNELU.js.map +1 -0
- package/dist/{chunk-I73ATSAH.cjs → chunk-IX64T5OL.cjs} +4 -4
- package/dist/{chunk-I73ATSAH.cjs.map → chunk-IX64T5OL.cjs.map} +1 -1
- package/dist/{chunk-XDMPDUKL.cjs → chunk-J2ICGNHO.cjs} +8 -9
- package/dist/chunk-J2ICGNHO.cjs.map +1 -0
- package/dist/{chunk-KDRF3NR2.cjs → chunk-J7LXTUTP.cjs} +295 -201
- package/dist/chunk-J7LXTUTP.cjs.map +1 -0
- package/dist/{chunk-AO2WPYFZ.cjs → chunk-JQXSZHF2.cjs} +14 -4
- package/dist/chunk-JQXSZHF2.cjs.map +1 -0
- package/dist/{chunk-UTTW2Q3M.cjs → chunk-JXUTCSXX.cjs} +197 -133
- package/dist/chunk-JXUTCSXX.cjs.map +1 -0
- package/dist/{chunk-GT7NEXSU.js → chunk-KCO5EFJU.js} +3 -3
- package/dist/{chunk-GT7NEXSU.js.map → chunk-KCO5EFJU.js.map} +1 -1
- package/dist/{chunk-ARN3ZODS.cjs → chunk-KKYELPZ2.cjs} +6 -6
- package/dist/{chunk-ARN3ZODS.cjs.map → chunk-KKYELPZ2.cjs.map} +1 -1
- package/dist/{chunk-7Y6BV3TK.cjs → chunk-KMXWZLQX.cjs} +100 -100
- package/dist/{chunk-7Y6BV3TK.cjs.map → chunk-KMXWZLQX.cjs.map} +1 -1
- package/dist/{chunk-CDYRPI5U.js → chunk-MIJKEVV7.js} +4 -4
- package/dist/{chunk-CDYRPI5U.js.map → chunk-MIJKEVV7.js.map} +1 -1
- package/dist/{chunk-FFQGI67R.cjs → chunk-NAAMUYMS.cjs} +56 -44
- package/dist/chunk-NAAMUYMS.cjs.map +1 -0
- package/dist/{chunk-6TJ6PKPS.cjs → chunk-OOA273IJ.cjs} +27 -27
- package/dist/{chunk-6TJ6PKPS.cjs.map → chunk-OOA273IJ.cjs.map} +1 -1
- package/dist/{chunk-F2KVJ6FF.cjs → chunk-P7GTYOLB.cjs} +203 -117
- package/dist/chunk-P7GTYOLB.cjs.map +1 -0
- package/dist/{chunk-42XYPKZU.js → chunk-PVUI6KGR.js} +67 -3
- package/dist/chunk-PVUI6KGR.js.map +1 -0
- package/dist/{chunk-L5AUCL5P.js → chunk-Q6EDCUXV.js} +274 -14
- package/dist/chunk-Q6EDCUXV.js.map +1 -0
- package/dist/{chunk-ZPCKPLMX.cjs → chunk-QB6VMOJ2.cjs} +8 -8
- package/dist/{chunk-ZPCKPLMX.cjs.map → chunk-QB6VMOJ2.cjs.map} +1 -1
- package/dist/{chunk-3RPQDGUE.cjs → chunk-QC4MCOFV.cjs} +5 -5
- package/dist/{chunk-3RPQDGUE.cjs.map → chunk-QC4MCOFV.cjs.map} +1 -1
- package/dist/{chunk-4XRP2N6B.js → chunk-QLUXRWKL.js} +3 -3
- package/dist/{chunk-4XRP2N6B.js.map → chunk-QLUXRWKL.js.map} +1 -1
- package/dist/{chunk-OM6RIOA5.cjs → chunk-QR24DJDF.cjs} +13 -13
- package/dist/{chunk-OM6RIOA5.cjs.map → chunk-QR24DJDF.cjs.map} +1 -1
- package/dist/{chunk-YPVQYM3L.js → chunk-QRNYDV5Z.js} +138 -31
- package/dist/chunk-QRNYDV5Z.js.map +1 -0
- package/dist/{chunk-ZOHCFYXE.js → chunk-QT6V3YRH.js} +3 -3
- package/dist/{chunk-ZOHCFYXE.js.map → chunk-QT6V3YRH.js.map} +1 -1
- package/dist/{chunk-5C75HQYQ.js → chunk-RFRM3Q5K.js} +17 -5
- package/dist/chunk-RFRM3Q5K.js.map +1 -0
- package/dist/{chunk-NXIZL7ZZ.js → chunk-RUQS6M7G.js} +6 -6
- package/dist/chunk-RUQS6M7G.js.map +1 -0
- package/dist/{chunk-CI5NPLXX.js → chunk-S3ZRKJHY.js} +3 -3
- package/dist/{chunk-CI5NPLXX.js.map → chunk-S3ZRKJHY.js.map} +1 -1
- package/dist/{chunk-3V6D5DEC.js → chunk-S4KQ5LV4.js} +3 -3
- package/dist/{chunk-3V6D5DEC.js.map → chunk-S4KQ5LV4.js.map} +1 -1
- package/dist/{chunk-CTWZPYJW.js → chunk-TKORQCG4.js} +108 -15
- package/dist/chunk-TKORQCG4.js.map +1 -0
- package/dist/{chunk-2HKIID5K.js → chunk-TKP5T34P.js} +4 -5
- package/dist/chunk-TKP5T34P.js.map +1 -0
- package/dist/{chunk-X2XOQZT3.cjs → chunk-U5W4LKZV.cjs} +13 -9
- package/dist/chunk-U5W4LKZV.cjs.map +1 -0
- package/dist/{chunk-BLBG2VZ5.cjs → chunk-UCQ3BFSY.cjs} +372 -110
- package/dist/chunk-UCQ3BFSY.cjs.map +1 -0
- package/dist/{chunk-CUPJL6TS.js → chunk-V34A6R5V.js} +13 -4
- package/dist/chunk-V34A6R5V.js.map +1 -0
- package/dist/{chunk-LQLVJWUH.js → chunk-VTN3C3CH.js} +7 -7
- package/dist/chunk-VTN3C3CH.js.map +1 -0
- package/dist/{chunk-FY4VY5EV.cjs → chunk-VVQM4CZD.cjs} +20 -20
- package/dist/chunk-VVQM4CZD.cjs.map +1 -0
- package/dist/{chunk-LDCWO5B6.js → chunk-WDAVPX46.js} +3 -3
- package/dist/{chunk-LDCWO5B6.js.map → chunk-WDAVPX46.js.map} +1 -1
- package/dist/{chunk-5GV4JQNA.cjs → chunk-WDBXJOU5.cjs} +55 -43
- package/dist/chunk-WDBXJOU5.cjs.map +1 -0
- package/dist/{chunk-FMPZPOUD.js → chunk-WUFASQUO.js} +3 -3
- package/dist/{chunk-FMPZPOUD.js.map → chunk-WUFASQUO.js.map} +1 -1
- package/dist/{chunk-5ZPRE4CV.cjs → chunk-YDWLUT5V.cjs} +237 -130
- package/dist/chunk-YDWLUT5V.cjs.map +1 -0
- package/dist/{chunk-CVNGKTHO.js → chunk-YMTXMPV6.js} +4 -4
- package/dist/{chunk-CVNGKTHO.js.map → chunk-YMTXMPV6.js.map} +1 -1
- package/dist/{chunk-NDQLPKBX.cjs → chunk-YOALGKRE.cjs} +2092 -1535
- package/dist/chunk-YOALGKRE.cjs.map +1 -0
- package/dist/{chunk-OMQ2NBOR.cjs → chunk-Z3WO6MND.cjs} +27 -27
- package/dist/{chunk-OMQ2NBOR.cjs.map → chunk-Z3WO6MND.cjs.map} +1 -1
- package/dist/{chunk-V2GZBPY2.cjs → chunk-ZI6VQSZA.cjs} +310 -61
- package/dist/chunk-ZI6VQSZA.cjs.map +1 -0
- package/dist/{chunk-ZBV4LQD2.cjs → chunk-ZTAJL4DT.cjs} +4 -4
- package/dist/{chunk-ZBV4LQD2.cjs.map → chunk-ZTAJL4DT.cjs.map} +1 -1
- package/dist/core/index.cjs +27 -28
- package/dist/core/index.d.cts +5 -5
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +7 -8
- package/dist/{ddl-3unqC-kg.d.cts → ddl-BG4J805L.d.cts} +3 -3
- package/dist/{ddl-Bc4Dl8fu.d.ts → ddl-CgiS9QLj.d.ts} +3 -3
- package/dist/{define-graph-DBFnc7u_.d.ts → define-graph-BGrJahvp.d.ts} +1 -1
- package/dist/{define-graph-Byslw2OO.d.cts → define-graph-alREY2wj.d.cts} +1 -1
- package/dist/graph-extension/index.cjs +19 -20
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +4 -5
- package/dist/graph-merge/index.cjs +103 -104
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +9 -8
- package/dist/graph-merge/index.d.ts +9 -8
- package/dist/graph-merge/index.js +23 -24
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-DHXw7QAl.d.cts → index-BBxZCUdu.d.ts} +37 -7
- package/dist/{index-DQzVJBHa.d.ts → index-C3y_98iN.d.cts} +37 -7
- package/dist/index.cjs +209 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +33 -34
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +13 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +6 -6
- package/dist/interchange/index.cjs +50 -41
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +11 -11
- package/dist/interchange/index.d.ts +11 -11
- package/dist/interchange/index.js +24 -15
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-U9_zopqr.d.cts → manager-KS7CGQQT.d.cts} +44 -6
- package/dist/{manager-Dl0-er1G.d.ts → manager-YoLEfcc1.d.ts} +44 -6
- package/dist/{materialize-indexes-BM3u0aXE.d.ts → materialize-indexes-Bhhyb1B3.d.ts} +1 -1
- package/dist/{materialize-indexes-DzMCetZe.d.cts → materialize-indexes-OHRWypW6.d.cts} +1 -1
- package/dist/{postgres-DpJqtbSX.d.cts → postgres-DpkW3R5Y.d.cts} +1 -1
- package/dist/{postgres-C5-WMKFA.d.ts → postgres-DwqyIniy.d.ts} +1 -1
- package/dist/profiler/index.d.cts +10 -9
- package/dist/profiler/index.d.ts +10 -9
- package/dist/provenance/index.cjs +38 -38
- 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 +8 -8
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +40 -41
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +13 -14
- package/dist/{searchable-B4mUXZT6.d.cts → searchable-CIZL8Hyw.d.cts} +2 -2
- package/dist/{searchable-C7jmPNLT.d.ts → searchable-DLWEfC4a.d.ts} +2 -2
- package/dist/{sqlite-Ch5tSYQY.d.ts → sqlite-DY0WODUK.d.cts} +1 -1
- package/dist/{sqlite-Da7jiYu9.d.cts → sqlite-L-VIRzqA.d.ts} +1 -1
- package/dist/{store-view-DdwBNjZQ.d.ts → store-view-66p92IPi.d.ts} +1974 -1751
- package/dist/{store-view-D1F6KqsE.d.cts → store-view-A85FFRnk.d.cts} +1974 -1751
- package/dist/{temporal-CMpigMCW.d.cts → temporal-BNbjXqer.d.cts} +1 -1
- package/dist/{temporal-BtrTYTiB.d.ts → temporal-Bob6Nfbp.d.ts} +1 -1
- package/dist/{types-Dh-EgT-w.d.cts → types-Ch9a0Dx6.d.cts} +483 -20
- package/dist/{types-Dh-EgT-w.d.ts → types-Ch9a0Dx6.d.ts} +483 -20
- package/dist/{types-D2rU5Taq.d.ts → types-ClCzT-dT.d.ts} +1 -1
- package/dist/{types-G4sVM-76.d.cts → types-DeORZhxn.d.cts} +1 -1
- package/dist/{where-DbZ9XDOI.d.cts → where-DPw52ksb.d.cts} +1 -1
- package/dist/{where-B8Y21kig.d.ts → where-kWUZPvEA.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2HKIID5K.js.map +0 -1
- package/dist/chunk-33PAKPED.cjs.map +0 -1
- package/dist/chunk-42XYPKZU.js.map +0 -1
- package/dist/chunk-4WYFRACU.js.map +0 -1
- package/dist/chunk-5C75HQYQ.js.map +0 -1
- package/dist/chunk-5GV4JQNA.cjs.map +0 -1
- package/dist/chunk-5Q3P6OIC.cjs.map +0 -1
- package/dist/chunk-5ZPRE4CV.cjs.map +0 -1
- package/dist/chunk-64LERBFM.cjs.map +0 -1
- package/dist/chunk-AO2WPYFZ.cjs.map +0 -1
- package/dist/chunk-BLBG2VZ5.cjs.map +0 -1
- package/dist/chunk-CTWZPYJW.js.map +0 -1
- package/dist/chunk-CUPJL6TS.js.map +0 -1
- package/dist/chunk-DMZEVJGL.cjs.map +0 -1
- package/dist/chunk-ECU53PMN.cjs.map +0 -1
- package/dist/chunk-EQOQOT55.js.map +0 -1
- package/dist/chunk-F2KVJ6FF.cjs.map +0 -1
- package/dist/chunk-F7TDKSVB.cjs +0 -61
- package/dist/chunk-F7TDKSVB.cjs.map +0 -1
- package/dist/chunk-FFQGI67R.cjs.map +0 -1
- package/dist/chunk-FY4VY5EV.cjs.map +0 -1
- package/dist/chunk-HHBKGPEI.js.map +0 -1
- package/dist/chunk-JNXZQBN3.js.map +0 -1
- package/dist/chunk-KDRF3NR2.cjs.map +0 -1
- package/dist/chunk-KTBTSHU6.cjs.map +0 -1
- package/dist/chunk-L2BYRYHC.js.map +0 -1
- package/dist/chunk-L5AUCL5P.js.map +0 -1
- package/dist/chunk-LQLVJWUH.js.map +0 -1
- package/dist/chunk-M4GYQF2H.js.map +0 -1
- package/dist/chunk-NDQLPKBX.cjs.map +0 -1
- package/dist/chunk-NXIZL7ZZ.js.map +0 -1
- package/dist/chunk-O2GZM7UK.cjs.map +0 -1
- package/dist/chunk-O7XVCLXW.cjs.map +0 -1
- package/dist/chunk-OYJSYDIH.js.map +0 -1
- package/dist/chunk-RAWG2FEU.js.map +0 -1
- package/dist/chunk-RXOAXO3R.js +0 -59
- package/dist/chunk-RXOAXO3R.js.map +0 -1
- package/dist/chunk-U3YRCZ5L.cjs +0 -12
- package/dist/chunk-UTTW2Q3M.cjs.map +0 -1
- package/dist/chunk-UZLEQFTV.js.map +0 -1
- package/dist/chunk-V2GZBPY2.cjs.map +0 -1
- package/dist/chunk-VC26BUNP.js.map +0 -1
- package/dist/chunk-VGMNGWBR.cjs +0 -12
- package/dist/chunk-X2XOQZT3.cjs.map +0 -1
- package/dist/chunk-XDMPDUKL.cjs.map +0 -1
- package/dist/chunk-YPVQYM3L.js.map +0 -1
- package/dist/chunk-ZGOUVMVS.js.map +0 -1
- package/dist/chunk-ZIRC2U6G.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkNAUA4PW5_cjs = require('./chunk-NAUA4PW5.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkU5W4LKZV_cjs = require('./chunk-U5W4LKZV.cjs');
|
|
5
|
+
var chunkC4F7VJ5D_cjs = require('./chunk-C4F7VJ5D.cjs');
|
|
6
6
|
|
|
7
7
|
// src/query/compiler/schema.ts
|
|
8
|
-
var SQL_SCHEMA_BRAND =
|
|
8
|
+
var SQL_SCHEMA_BRAND = chunkU5W4LKZV_cjs.typeGraphGlobalSymbol("sql-schema-v1");
|
|
9
9
|
var SqlSchema = class {
|
|
10
10
|
};
|
|
11
11
|
var SqlSchemaDescriptor = class extends SqlSchema {
|
|
@@ -61,15 +61,15 @@ function resolveTableNames(names) {
|
|
|
61
61
|
var VALID_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/i;
|
|
62
62
|
function validateTableName(name, label) {
|
|
63
63
|
if (!name || name.length === 0) {
|
|
64
|
-
throw new
|
|
64
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(`${label} table name cannot be empty`);
|
|
65
65
|
}
|
|
66
66
|
if (name.length > chunkNAUA4PW5_cjs.MAX_PG_IDENTIFIER_LENGTH) {
|
|
67
|
-
throw new
|
|
67
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
68
68
|
`${label} table name exceeds maximum length of ${chunkNAUA4PW5_cjs.MAX_PG_IDENTIFIER_LENGTH} characters`
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
if (!VALID_IDENTIFIER_PATTERN.test(name)) {
|
|
72
|
-
throw new
|
|
72
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
73
73
|
`${label} table name "${name}" is not a valid SQL identifier. Table names must start with a letter or underscore and contain only letters, digits, underscores, or dollar signs.`
|
|
74
74
|
);
|
|
75
75
|
}
|
|
@@ -80,11 +80,11 @@ function freezeSqlSchema(fields) {
|
|
|
80
80
|
function isSqlSchema(schema) {
|
|
81
81
|
if (typeof schema !== "object" || schema === null) return false;
|
|
82
82
|
const candidate = schema;
|
|
83
|
-
return candidate[SQL_SCHEMA_BRAND] === true && typeof candidate["tables"] === "object" && candidate["tables"] !== null && Object.isFrozen(candidate["tables"]) &&
|
|
83
|
+
return candidate[SQL_SCHEMA_BRAND] === true && typeof candidate["tables"] === "object" && candidate["tables"] !== null && Object.isFrozen(candidate["tables"]) && chunkU5W4LKZV_cjs.isSqlFragment(candidate["nodesTable"]) && chunkU5W4LKZV_cjs.isSqlFragment(candidate["edgesTable"]) && chunkU5W4LKZV_cjs.isSqlFragment(candidate["recordedNodesTable"]) && chunkU5W4LKZV_cjs.isSqlFragment(candidate["recordedEdgesTable"]) && chunkU5W4LKZV_cjs.isSqlFragment(candidate["recordedClockTable"]) && chunkU5W4LKZV_cjs.isSqlFragment(candidate["revisionOriginsTable"]) && chunkU5W4LKZV_cjs.isSqlFragment(candidate["fulltextTable"]) && Object.isFrozen(candidate);
|
|
84
84
|
}
|
|
85
85
|
function requireSqlSchema(schema, surface = "SqlSchema") {
|
|
86
86
|
if (isSqlSchema(schema)) return schema;
|
|
87
|
-
throw new
|
|
87
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
88
88
|
`${surface} must be created with createSqlSchema(...).`,
|
|
89
89
|
{ code: "INVALID_SQL_SCHEMA", surface },
|
|
90
90
|
{
|
|
@@ -104,19 +104,19 @@ function createSqlSchema(names = {}) {
|
|
|
104
104
|
validateTableName(tables.uniques, "uniques");
|
|
105
105
|
return freezeSqlSchema({
|
|
106
106
|
tables: Object.freeze(tables),
|
|
107
|
-
nodesTable:
|
|
108
|
-
edgesTable:
|
|
109
|
-
recordedNodesTable:
|
|
110
|
-
recordedEdgesTable:
|
|
111
|
-
recordedClockTable:
|
|
112
|
-
revisionOriginsTable:
|
|
113
|
-
fulltextTable:
|
|
107
|
+
nodesTable: chunkU5W4LKZV_cjs.sql.identifier(tables.nodes),
|
|
108
|
+
edgesTable: chunkU5W4LKZV_cjs.sql.identifier(tables.edges),
|
|
109
|
+
recordedNodesTable: chunkU5W4LKZV_cjs.sql.identifier(tables.recordedNodes),
|
|
110
|
+
recordedEdgesTable: chunkU5W4LKZV_cjs.sql.identifier(tables.recordedEdges),
|
|
111
|
+
recordedClockTable: chunkU5W4LKZV_cjs.sql.identifier(tables.recordedClock),
|
|
112
|
+
revisionOriginsTable: chunkU5W4LKZV_cjs.sql.identifier(tables.revisionOrigins),
|
|
113
|
+
fulltextTable: chunkU5W4LKZV_cjs.sql.identifier(tables.fulltext)
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
var EXTERNAL_RECORDED_READ_SOURCE =
|
|
116
|
+
var EXTERNAL_RECORDED_READ_SOURCE = chunkU5W4LKZV_cjs.typeGraphGlobalSymbol(
|
|
117
117
|
"external-recorded-read-source-v1"
|
|
118
118
|
);
|
|
119
|
-
var TYPEGRAPH_RECORDED_READ_SOURCE =
|
|
119
|
+
var TYPEGRAPH_RECORDED_READ_SOURCE = chunkU5W4LKZV_cjs.typeGraphGlobalSymbol(
|
|
120
120
|
"typegraph-recorded-read-source-v1"
|
|
121
121
|
);
|
|
122
122
|
function recordedRelation(options) {
|
|
@@ -130,7 +130,7 @@ function recordedRelation(options) {
|
|
|
130
130
|
function requireExternalRecordedReadSource(source) {
|
|
131
131
|
if (source === void 0) return void 0;
|
|
132
132
|
if (isExternalRecordedReadSource(source)) return source;
|
|
133
|
-
throw new
|
|
133
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
134
134
|
"recordedRead must be created with recordedRelation({ schema }).",
|
|
135
135
|
{ code: "INVALID_RECORDED_READ_SOURCE" },
|
|
136
136
|
{
|
|
@@ -154,7 +154,7 @@ function createRecordedReadBinding(schema) {
|
|
|
154
154
|
function requireRecordedReadBinding(binding, surface) {
|
|
155
155
|
if (isRecordedReadBinding(binding)) return binding;
|
|
156
156
|
if (binding !== void 0) {
|
|
157
|
-
throw new
|
|
157
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
158
158
|
"Recorded-time reads require a recorded read relation created by TypeGraph.",
|
|
159
159
|
{ code: "INVALID_RECORDED_READ_BINDING", surface },
|
|
160
160
|
{
|
|
@@ -162,7 +162,7 @@ function requireRecordedReadBinding(binding, surface) {
|
|
|
162
162
|
}
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
166
166
|
"Recorded-time reads require a recorded read relation.",
|
|
167
167
|
{ code: "RECORDED_READ_REQUIRES_BINDING", surface },
|
|
168
168
|
{
|
|
@@ -222,5 +222,5 @@ exports.requireExternalRecordedReadSource = requireExternalRecordedReadSource;
|
|
|
222
222
|
exports.requireRecordedReadBinding = requireRecordedReadBinding;
|
|
223
223
|
exports.requireSqlSchema = requireSqlSchema;
|
|
224
224
|
exports.vectorSlotKey = vectorSlotKey;
|
|
225
|
-
//# sourceMappingURL=chunk-
|
|
226
|
-
//# sourceMappingURL=chunk-
|
|
225
|
+
//# sourceMappingURL=chunk-CPEL3YIR.cjs.map
|
|
226
|
+
//# sourceMappingURL=chunk-CPEL3YIR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/query/compiler/schema.ts"],"names":["typeGraphGlobalSymbol","ConfigurationError","MAX_PG_IDENTIFIER_LENGTH","isSqlFragment","sql"],"mappings":";;;;;;;AAaA,IAAM,gBAAA,GAAkCA,wCAAsB,eAAe,CAAA;AA6EtE,IAAe,YAAf,MAAoD;AAU3D,CAAA;AAEA,IAAM,mBAAA,GAAN,cAAkC,SAAA,CAAU;AAAA,EAEjC,MAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA,oBAAA;AAAA,EACA,aAAA;AAAA,EAET,YAAY,MAAA,EAAyB;AACnC,IAAA,KAAA,EAAM;AACN,IAAA,MAAA,CAAO,cAAA,CAAe,MAAM,gBAAA,EAAkB;AAAA,MAC5C,YAAA,EAAc,KAAA;AAAA,MACd,UAAA,EAAY,KAAA;AAAA,MACZ,KAAA,EAAO,IAAA;AAAA,MACP,QAAA,EAAU;AAAA,KACX,CAAA;AACD,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,qBAAqB,MAAA,CAAO,kBAAA;AACjC,IAAA,IAAA,CAAK,qBAAqB,MAAA,CAAO,kBAAA;AACjC,IAAA,IAAA,CAAK,qBAAqB,MAAA,CAAO,kBAAA;AACjC,IAAA,IAAA,CAAK,uBA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EzC;AAQO,SAAS,sBAAsB,OAAA,EAAyC;AAC7E,EAAA,MAAM,EAAE,QAAO,GAAI,0BAAA;AAAA,IACjB,OAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,OAAO,eAAA,CAAgB;AAAA,IACrB,QAAQ,MAAA,CAAO,MAAA;AAAA,IACf,YAAY,MAAA,CAAO,kBAAA;AAAA,IACnB,YAAY,MAAA,CAAO,kBAAA;AAAA,IACnB,oBAAoB,MAAA,CAAO,kBAAA;AAAA,IAC3B,oBAAoB,MAAA,CAAO,kBAAA;AAAA,IAC3B,oBAAoB,MAAA,CAAO,kBAAA;AAAA,IAC3B,sBAAsB,MAAA,CAAO,oBAAA;AAAA,IAC7B,eAAe,MAAA,CAAO;AAAA,GACvB,CAAA;AACH;AAOO,SAAS,qBAAA,CACd,MAAA,EACA,YAAA,EACA,OAAA,EACA,OAAA,EACW;AACX,EAAA,MAAM,UAAA,GAAa,gBAAA,CAAiB,MAAA,EAAQ,CAAA,EAAG,OAAO,CAAA,OAAA,CAAS,CAAA;AAC/D,EAAA,IAAI,YAAA,KAAiB,QAAW,OAAO,UAAA;AACvC,EAAA,OAAO,qBAAA,CAAsB,0BAAA,CAA2B,OAAA,EAAS,OAAO,CAAC,CAAA;AAC3E;AAKO,IAAM,qBAAgC,eAAA;AA0BtC,SAAS,aAAA,CAAc,UAAkB,SAAA,EAA2B;AACzE,EAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAS,SAAS,CAAA,CAAA;AACtC;AAOO,IAAM,gBAAA,GAAmB;AACzB,IAAM,oBAAA,GAAuB;AAC7B,IAAM,kBAAA,GAAqB;AAC3B,IAAM,2BAAA,GAA8B","file":"chunk-CVK4T34X.cjs","sourcesContent":["/**\n * SQL Schema Configuration for Query Compilation\n *\n * Provides table and column identifiers that the query compiler uses.\n * This allows the compiler to work with custom table names instead of\n * hard-coded defaults.\n */\nimport { type VectorIndexType, type VectorMetric } from \"../../backend/types\";\nimport { MAX_PG_IDENTIFIER_LENGTH } from \"../../constants\";\nimport { ConfigurationError } from \"../../errors\";\nimport { typeGraphGlobalSymbol } from \"../../utils/global-symbol\";\nimport { isSqlFragment, sql, type SqlFragment } from \"../sql-fragment\";\n\nconst SQL_SCHEMA_BRAND: unique symbol = typeGraphGlobalSymbol(\"sql-schema-v1\");\n\n/**\n * Table names for TypeGraph SQL schema.\n *\n * Carries every customizable physical-table name the backend exposes,\n * including the secondary tables (`uniques`) that the query compiler\n * itself doesn't reference but `materializeRemovals` and other\n * cleanup paths need to address by name. Backends without a\n * `uniques` table (custom embeddings-only stores) leave it as the\n * default — the cleanup path is a no-op for kinds with no unique\n * rows.\n */\nexport type SqlTableNames = Readonly<{\n /** Nodes table name (default: \"typegraph_nodes\") */\n nodes: string;\n /** Edges table name (default: \"typegraph_edges\") */\n edges: string;\n /** Recorded node relation table name (default: \"typegraph_recorded_nodes\") */\n recordedNodes?: string | undefined;\n /** Recorded edge relation table name (default: \"typegraph_recorded_edges\") */\n recordedEdges?: string | undefined;\n /** Recorded-time commit clock table name (default: \"typegraph_recorded_clock\") */\n recordedClock?: string | undefined;\n /** Durable per-graph revision-origin table name (default: \"typegraph_revision_origins\") */\n revisionOrigins?: string | undefined;\n /** Node fulltext table name (default: \"typegraph_node_fulltext\") */\n fulltext: string;\n /** Node uniques table name (default: \"typegraph_node_uniques\") */\n uniques: string;\n}>;\n\nexport type ResolvedSqlTableNames = Readonly<{\n /** Nodes table name */\n nodes: string;\n /** Edges table name */\n edges: string;\n /** Recorded node relation table name */\n recordedNodes: string;\n /** Recorded edge relation table name */\n recordedEdges: string;\n /** Recorded-time commit clock table name */\n recordedClock: string;\n /** Durable per-graph revision-origin table name */\n revisionOrigins: string;\n /** Node fulltext table name */\n fulltext: string;\n /** Node uniques table name */\n uniques: string;\n}>;\n\ntype SqlSchemaFields = Readonly<{\n /** Table names */\n tables: ResolvedSqlTableNames;\n /** Get a `SqlFragment` reference to the nodes table. */\n nodesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the edges table. */\n edgesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the recorded node relation. */\n recordedNodesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the recorded edge relation. */\n recordedEdgesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the recorded-time commit clock. */\n recordedClockTable: SqlFragment;\n /** Get a `SqlFragment` reference to the durable per-graph revision origins. */\n revisionOriginsTable: SqlFragment;\n /** Get a `SqlFragment` reference to the fulltext table. */\n fulltextTable: SqlFragment;\n}>;\n\n/**\n * SQL schema configuration for query compilation.\n * Contains table identifiers and utility methods for generating `SqlFragment` references.\n *\n * Branded and frozen by {@link createSqlSchema}; callers should not construct\n * schema-shaped objects by hand.\n */\nexport abstract class SqlSchema implements SqlSchemaFields {\n declare private readonly typeGraphSqlSchemaBrand: true;\n abstract readonly tables: ResolvedSqlTableNames;\n abstract readonly nodesTable: SqlFragment;\n abstract readonly edgesTable: SqlFragment;\n abstract readonly recordedNodesTable: SqlFragment;\n abstract readonly recordedEdgesTable: SqlFragment;\n abstract readonly recordedClockTable: SqlFragment;\n abstract readonly revisionOriginsTable: SqlFragment;\n abstract readonly fulltextTable: SqlFragment;\n}\n\nclass SqlSchemaDescriptor extends SqlSchema {\n declare readonly [SQL_SCHEMA_BRAND]: true;\n readonly tables: ResolvedSqlTableNames;\n readonly nodesTable: SqlFragment;\n readonly edgesTable: SqlFragment;\n readonly recordedNodesTable: SqlFragment;\n readonly recordedEdgesTable: SqlFragment;\n readonly recordedClockTable: SqlFragment;\n readonly revisionOriginsTable: SqlFragment;\n readonly fulltextTable: SqlFragment;\n\n constructor(fields: SqlSchemaFields) {\n super();\n Object.defineProperty(this, SQL_SCHEMA_BRAND, {\n configurable: false,\n enumerable: false,\n value: true,\n writable: false,\n });\n this.tables = fields.tables;\n this.nodesTable = fields.nodesTable;\n this.edgesTable = fields.edgesTable;\n this.recordedNodesTable = fields.recordedNodesTable;\n this.recordedEdgesTable = fields.recordedEdgesTable;\n this.recordedClockTable = fields.recordedClockTable;\n this.revisionOriginsTable = fields.revisionOriginsTable;\n this.fulltextTable = fields.fulltextTable;\n Object.freeze(this);\n }\n}\n\n/**\n * Default table names matching the standard TypeGraph schema.\n */\nconst DEFAULT_TABLE_NAMES: ResolvedSqlTableNames = {\n nodes: \"typegraph_nodes\",\n edges: \"typegraph_edges\",\n recordedNodes: \"typegraph_recorded_nodes\",\n recordedEdges: \"typegraph_recorded_edges\",\n recordedClock: \"typegraph_recorded_clock\",\n revisionOrigins: \"typegraph_revision_origins\",\n fulltext: \"typegraph_node_fulltext\",\n uniques: \"typegraph_node_uniques\",\n};\n\nfunction resolveTableNames(\n names: Partial<SqlTableNames>,\n): ResolvedSqlTableNames {\n return {\n nodes: names.nodes ?? DEFAULT_TABLE_NAMES.nodes,\n edges: names.edges ?? DEFAULT_TABLE_NAMES.edges,\n recordedNodes: names.recordedNodes ?? DEFAULT_TABLE_NAMES.recordedNodes,\n recordedEdges: names.recordedEdges ?? DEFAULT_TABLE_NAMES.recordedEdges,\n recordedClock: names.recordedClock ?? DEFAULT_TABLE_NAMES.recordedClock,\n revisionOrigins:\n names.revisionOrigins ?? DEFAULT_TABLE_NAMES.revisionOrigins,\n fulltext: names.fulltext ?? DEFAULT_TABLE_NAMES.fulltext,\n uniques: names.uniques ?? DEFAULT_TABLE_NAMES.uniques,\n };\n}\n\n/**\n * Regex for valid SQL identifiers.\n * Must start with a letter or underscore.\n * Can contain letters, digits, underscores, and dollar signs.\n * Dollar signs are a PostgreSQL extension but commonly supported.\n */\nconst VALID_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/i;\n\n/**\n * Validates that a table name is a valid SQL identifier.\n *\n * @throws Error if the table name is invalid\n */\nfunction validateTableName(name: string, label: string): void {\n if (!name || name.length === 0) {\n throw new ConfigurationError(`${label} table name cannot be empty`);\n }\n if (name.length > MAX_PG_IDENTIFIER_LENGTH) {\n throw new ConfigurationError(\n `${label} table name exceeds maximum length of ${MAX_PG_IDENTIFIER_LENGTH} characters`,\n );\n }\n if (!VALID_IDENTIFIER_PATTERN.test(name)) {\n throw new ConfigurationError(\n `${label} table name \"${name}\" is not a valid SQL identifier. ` +\n `Table names must start with a letter or underscore and contain only letters, digits, underscores, or dollar signs.`,\n );\n }\n}\n\nfunction freezeSqlSchema(fields: SqlSchemaFields): SqlSchema {\n return new SqlSchemaDescriptor(fields);\n}\n\nfunction isSqlSchema(schema: unknown): schema is SqlSchema {\n if (typeof schema !== \"object\" || schema === null) return false;\n const candidate = schema as Record<PropertyKey, unknown>;\n return (\n candidate[SQL_SCHEMA_BRAND] === true &&\n typeof candidate[\"tables\"] === \"object\" &&\n candidate[\"tables\"] !== null &&\n Object.isFrozen(candidate[\"tables\"]) &&\n isSqlFragment(candidate[\"nodesTable\"]) &&\n isSqlFragment(candidate[\"edgesTable\"]) &&\n isSqlFragment(candidate[\"recordedNodesTable\"]) &&\n isSqlFragment(candidate[\"recordedEdgesTable\"]) &&\n isSqlFragment(candidate[\"recordedClockTable\"]) &&\n isSqlFragment(candidate[\"revisionOriginsTable\"]) &&\n isSqlFragment(candidate[\"fulltextTable\"]) &&\n Object.isFrozen(candidate)\n );\n}\n\nexport function requireSqlSchema(\n schema: unknown,\n surface = \"SqlSchema\",\n): SqlSchema {\n if (isSqlSchema(schema)) return schema;\n throw new ConfigurationError(\n `${surface} must be created with createSqlSchema(...).`,\n { code: \"INVALID_SQL_SCHEMA\", surface },\n {\n suggestion:\n \"Pass the result of createSqlSchema(...) instead of a plain schema-shaped object.\",\n },\n );\n}\n\n/**\n * Creates a SqlSchema configuration from table names.\n *\n * Table names are validated to ensure they are valid SQL identifiers.\n * This prevents SQL injection and ensures compatibility across databases.\n *\n * @param names - Optional custom table names (defaults to standard names)\n * @returns SqlSchema configuration for query compilation\n * @throws Error if any table name is invalid\n *\n * @example\n * ```typescript\n * // Use default table names\n * const schema = createSqlSchema();\n *\n * // Use custom table names\n * const schema = createSqlSchema({\n * nodes: \"myapp_nodes\",\n * edges: \"myapp_edges\",\n * fulltext: \"myapp_fulltext\",\n * });\n * ```\n */\nexport function createSqlSchema(names: Partial<SqlTableNames> = {}): SqlSchema {\n const tables = resolveTableNames(names);\n\n // Validate all table names\n validateTableName(tables.nodes, \"nodes\");\n validateTableName(tables.edges, \"edges\");\n validateTableName(tables.recordedNodes, \"recordedNodes\");\n validateTableName(tables.recordedEdges, \"recordedEdges\");\n validateTableName(tables.recordedClock, \"recordedClock\");\n validateTableName(tables.revisionOrigins, \"revisionOrigins\");\n validateTableName(tables.fulltext, \"fulltext\");\n validateTableName(tables.uniques, \"uniques\");\n\n return freezeSqlSchema({\n tables: Object.freeze(tables),\n nodesTable: sql.identifier(tables.nodes),\n edgesTable: sql.identifier(tables.edges),\n recordedNodesTable: sql.identifier(tables.recordedNodes),\n recordedEdgesTable: sql.identifier(tables.recordedEdges),\n recordedClockTable: sql.identifier(tables.recordedClock),\n revisionOriginsTable: sql.identifier(tables.revisionOrigins),\n fulltextTable: sql.identifier(tables.fulltext),\n });\n}\n\n/**\n * The recorded/system-time relation a read coordinate may reconstruct from.\n *\n * TypeGraph's built-in capture relation is bound by `createStore(..., {\n * history: true })`. Hosts can also bind externally populated row-compatible\n * recorded relations through `recordedRelation({ schema })`. Keeping both as\n * explicit values separates the read contract from the write-capture mechanism\n * so future external/TMS-owned recorded relations can feed the same query\n * machinery without changing StoreView or ReadCoordinate.\n */\nconst EXTERNAL_RECORDED_READ_SOURCE: unique symbol = typeGraphGlobalSymbol(\n \"external-recorded-read-source-v1\",\n);\n\nexport type ExternalRecordedReadSource = Readonly<{\n source: \"external\";\n schema: SqlSchema;\n [EXTERNAL_RECORDED_READ_SOURCE]: true;\n}>;\n\ntype ExternalRecordedReadSourceCandidate = Readonly<{\n source?: unknown;\n schema?: unknown;\n [EXTERNAL_RECORDED_READ_SOURCE]?: unknown;\n}>;\n\nconst TYPEGRAPH_RECORDED_READ_SOURCE: unique symbol = typeGraphGlobalSymbol(\n \"typegraph-recorded-read-source-v1\",\n);\n\nexport type TypeGraphRecordedReadSource = Readonly<{\n source: \"typegraph-capture\";\n schema: SqlSchema;\n [TYPEGRAPH_RECORDED_READ_SOURCE]: true;\n}>;\n\ntype RecordedReadSource =\n ExternalRecordedReadSource | TypeGraphRecordedReadSource;\n\nexport type RecordedReadBinding = RecordedReadSource;\n\nexport type RecordedRelationOptions = Readonly<{\n schema: SqlSchema;\n}>;\n\nexport function recordedRelation(\n options: RecordedRelationOptions,\n): ExternalRecordedReadSource {\n const schema = requireSqlSchema(options.schema, \"recordedRelation schema\");\n return Object.freeze({\n source: \"external\",\n schema,\n [EXTERNAL_RECORDED_READ_SOURCE]: true as const,\n });\n}\n\nexport function requireExternalRecordedReadSource(\n source: unknown,\n): ExternalRecordedReadSource | undefined {\n if (source === undefined) return undefined;\n if (isExternalRecordedReadSource(source)) return source;\n throw new ConfigurationError(\n \"recordedRead must be created with recordedRelation({ schema }).\",\n { code: \"INVALID_RECORDED_READ_SOURCE\" },\n {\n suggestion:\n \"Pass { recordedRead: recordedRelation({ schema }) } for an externally populated recorded relation. Use { history: true } when TypeGraph should capture writes.\",\n },\n );\n}\n\nfunction isExternalRecordedReadSource(\n source: unknown,\n): source is ExternalRecordedReadSource {\n if (typeof source !== \"object\" || source === null) return false;\n const candidate = source as ExternalRecordedReadSourceCandidate;\n return (\n candidate.source === \"external\" &&\n candidate[EXTERNAL_RECORDED_READ_SOURCE] === true &&\n isSqlSchema(candidate.schema) &&\n Object.isFrozen(candidate)\n );\n}\n\nexport function createRecordedReadBinding(\n schema: SqlSchema,\n): TypeGraphRecordedReadSource {\n const readSchema = requireSqlSchema(schema, \"recorded read binding schema\");\n return Object.freeze({\n source: \"typegraph-capture\",\n schema: readSchema,\n [TYPEGRAPH_RECORDED_READ_SOURCE]: true as const,\n });\n}\n\nexport function requireRecordedReadBinding(\n binding: unknown,\n surface: string,\n): RecordedReadBinding {\n if (isRecordedReadBinding(binding)) return binding;\n if (binding !== undefined) {\n throw new ConfigurationError(\n \"Recorded-time reads require a recorded read relation created by TypeGraph.\",\n { code: \"INVALID_RECORDED_READ_BINDING\", surface },\n {\n suggestion:\n \"Use createStore(graph, backend, { history: true }) or { recordedRead: recordedRelation({ schema }) } instead of passing a plain object.\",\n },\n );\n }\n throw new ConfigurationError(\n \"Recorded-time reads require a recorded read relation.\",\n { code: \"RECORDED_READ_REQUIRES_BINDING\", surface },\n {\n suggestion:\n \"Create the store with createStore(graph, backend, { history: true }) to bind TypeGraph's built-in captured relation, or pass { recordedRead: recordedRelation({ schema }) } for an externally populated recorded relation.\",\n },\n );\n}\n\ntype TypeGraphRecordedReadSourceCandidate = Readonly<{\n source?: unknown;\n schema?: unknown;\n [TYPEGRAPH_RECORDED_READ_SOURCE]?: unknown;\n}>;\n\nfunction isTypeGraphRecordedReadSource(\n source: unknown,\n): source is TypeGraphRecordedReadSource {\n if (typeof source !== \"object\" || source === null) return false;\n const candidate = source as TypeGraphRecordedReadSourceCandidate;\n return (\n candidate.source === \"typegraph-capture\" &&\n candidate[TYPEGRAPH_RECORDED_READ_SOURCE] === true &&\n isSqlSchema(candidate.schema) &&\n Object.isFrozen(candidate)\n );\n}\n\nfunction isRecordedReadBinding(\n binding: unknown,\n): binding is RecordedReadBinding {\n return (\n isExternalRecordedReadSource(binding) ||\n isTypeGraphRecordedReadSource(binding)\n );\n}\n\n/**\n * Returns a schema view whose primary node/edge sources are the recorded-time\n * relations. The recorded relations are row-compatible with the live tables\n * for every column the query compiler, subgraph extractor, and algorithms\n * already read; the temporal filter adds the `recorded_from/to` predicate.\n */\nexport function recordedReadSqlSchema(binding: RecordedReadBinding): SqlSchema {\n const { schema } = requireRecordedReadBinding(\n binding,\n \"recorded-read-schema\",\n );\n return freezeSqlSchema({\n tables: schema.tables,\n nodesTable: schema.recordedNodesTable,\n edgesTable: schema.recordedEdgesTable,\n recordedNodesTable: schema.recordedNodesTable,\n recordedEdgesTable: schema.recordedEdgesTable,\n recordedClockTable: schema.recordedClockTable,\n revisionOriginsTable: schema.revisionOriginsTable,\n fulltextTable: schema.fulltextTable,\n });\n}\n\n/**\n * Resolves the read schema for a coordinate: the live schema when no recorded\n * pin is set, or the recorded-relation view when `recordedAsOf` is present. The\n * single place every read path decides whether to source the recorded tables.\n */\nexport function recordedReadSchemaFor(\n schema: SqlSchema,\n recordedAsOf: string | undefined,\n binding: RecordedReadBinding | undefined,\n surface: string,\n): SqlSchema {\n const baseSchema = requireSqlSchema(schema, `${surface} schema`);\n if (recordedAsOf === undefined) return baseSchema;\n return recordedReadSqlSchema(requireRecordedReadBinding(binding, surface));\n}\n\n/**\n * Default SqlSchema using standard TypeGraph table names.\n */\nexport const DEFAULT_SQL_SCHEMA: SqlSchema = createSqlSchema();\n\n/**\n * The compiler's resolved view of one declared embedding field — the\n * `(dimensions, metric, indexType)` a {@link VectorStrategy} needs to\n * name and scan the field's typed per-`(kind, field)` storage. Sourced\n * from the registered node schema's `embedding()` declaration when the\n * store builds its compile options.\n */\nexport type VectorSlotDescriptor = Readonly<{\n dimensions: number;\n metric: VectorMetric;\n indexType: VectorIndexType;\n}>;\n\n/**\n * Map of declared embedding slots keyed by {@link vectorSlotKey} -\n * `\"<nodeKind>\\0<fieldPath>\"` (NUL-separated). Carries every `(concrete kind,\n * fieldPath)` that declares an embedding field, so the compiler's\n * `field.similarTo(...)` CTE can UNION ALL the per-field tables for the\n * kinds in an alias that actually declare the field (only\n * `includeSubClasses` yields more than one).\n */\nexport type VectorSlotMap = ReadonlyMap<string, VectorSlotDescriptor>;\n\n/** NUL-delimited composite key for {@link VectorSlotMap}. */\nexport function vectorSlotKey(nodeKind: string, fieldPath: string): string {\n return `${nodeKind}\\u0000${fieldPath}`;\n}\n\n/**\n * CTE aliases used by the standard query emitter. Joining on these names\n * across multiple builder files is fragile when typed as raw strings —\n * import these constants instead.\n */\nexport const ALIAS_CTE_PREFIX = \"cte_\" as const;\nexport const EMBEDDINGS_CTE_ALIAS = \"cte_embeddings\" as const;\nexport const FULLTEXT_CTE_ALIAS = \"cte_fulltext\" as const;\nexport const HYBRID_CANDIDATES_CTE_ALIAS = \"cte_relevance_candidates\" as const;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/query/compiler/schema.ts"],"names":["typeGraphGlobalSymbol","ConfigurationError","MAX_PG_IDENTIFIER_LENGTH","isSqlFragment","sql"],"mappings":";;;;;;;AAaA,IAAM,gBAAA,GAAkCA,wCAAsB,eAAe,CAAA;AA6EtE,IAAe,YAAf,MAAoD;AAU3D,CAAA;AAEA,IAAM,mBAAA,GAAN,cAAkC,SAAA,CAAU;AAAA,EAEjC,MAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA,oBAAA;AAAA,EACA,aAAA;AAAA,EAET,YAAY,MAAA,EAAyB;AACnC,IAAA,KAAA,EAAM;AACN,IAAA,MAAA,CAAO,cAAA,CAAe,MAAM,gBAAA,EAAkB;AAAA,MAC5C,YAAA,EAAc,KAAA;AAAA,MACd,UAAA,EAAY,KAAA;AAAA,MACZ,KAAA,EAAO,IAAA;AAAA,MACP,QAAA,EAAU;AAAA,KACX,CAAA;AACD,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,qBAAqB,MAAA,CAAO,kBAAA;AACjC,IAAA,IAAA,CAAK,qBAAqB,MAAA,CAAO,kBAAA;AACjC,IAAA,IAAA,CAAK,qBAAqB,MAAA,CAAO,kBAAA;AACjC,IAAA,IAAA,CAAK,uBAAuB,MAAA,CAAO,oBAAA;AACnC,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,aAAA;AAC5B,IAAA,MAAA,CAAO,OAAO,IAAI,CAAA;AAAA,EACpB;AACF,CAAA;AAKA,IAAM,mBAAA,GAA6C;AAAA,EACjD,KAAA,EAAO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AAAA,IACf,YAAY,MAAA,CAAO,kBAAA;AAAA,IACnB,YAAY,MAAA,CAAO,kBAAA;AAAA,IACnB,oBAAoB,MAAA,CAAO,kBAAA;AAAA,IAC3B,oBAAoB,MAAA,CAAO,kBAAA;AAAA,IAC3B,oBAAoB,MAAA,CAAO,kBAAA;AAAA,IAC3B,sBAAsB,MAAA,CAAO,oBAAA;AAAA,IAC7B,eAAe,MAAA,CAAO;AAAA,GACvB,CAAA;AACH;AAOO,SAAS,qBAAA,CACd,MAAA,EACA,YAAA,EACA,OAAA,EACA,OAAA,EACW;AACX,EAAA,MAAM,UAAA,GAAa,gBAAA,CAAiB,MAAA,EAAQ,CAAA,EAAG,OAAO,CAAA,OAAA,CAAS,CAAA;AAC/D,EAAA,IAAI,YAAA,KAAiB,QAAW,OAAO,UAAA;AACvC,EAAA,OAAO,qBAAA,CAAsB,0BAAA,CAA2B,OAAA,EAAS,OAAO,CAAC,CAAA;AAC3E;AAKO,IAAM,qBAAgC,eAAA;AA0BtC,SAAS,aAAA,CAAc,UAAkB,SAAA,EAA2B;AACzE,EAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAS,SAAS,CAAA,CAAA;AACtC;AAOO,IAAM,gBAAA,GAAmB;AACzB,IAAM,oBAAA,GAAuB;AAC7B,IAAM,kBAAA,GAAqB;AAC3B,IAAM,2BAAA,GAA8B","file":"chunk-CPEL3YIR.cjs","sourcesContent":["/**\n * SQL Schema Configuration for Query Compilation\n *\n * Provides table and column identifiers that the query compiler uses.\n * This allows the compiler to work with custom table names instead of\n * hard-coded defaults.\n */\nimport { type VectorIndexType, type VectorMetric } from \"../../backend/types\";\nimport { MAX_PG_IDENTIFIER_LENGTH } from \"../../constants\";\nimport { ConfigurationError } from \"../../errors\";\nimport { typeGraphGlobalSymbol } from \"../../utils/global-symbol\";\nimport { isSqlFragment, sql, type SqlFragment } from \"../sql-fragment\";\n\nconst SQL_SCHEMA_BRAND: unique symbol = typeGraphGlobalSymbol(\"sql-schema-v1\");\n\n/**\n * Table names for TypeGraph SQL schema.\n *\n * Carries every customizable physical-table name the backend exposes,\n * including the secondary tables (`uniques`) that the query compiler\n * itself doesn't reference but `materializeRemovals` and other\n * cleanup paths need to address by name. Backends without a\n * `uniques` table (custom embeddings-only stores) leave it as the\n * default — the cleanup path is a no-op for kinds with no unique\n * rows.\n */\nexport type SqlTableNames = Readonly<{\n /** Nodes table name (default: \"typegraph_nodes\") */\n nodes: string;\n /** Edges table name (default: \"typegraph_edges\") */\n edges: string;\n /** Recorded node relation table name (default: \"typegraph_recorded_nodes\") */\n recordedNodes?: string | undefined;\n /** Recorded edge relation table name (default: \"typegraph_recorded_edges\") */\n recordedEdges?: string | undefined;\n /** Recorded-time commit clock table name (default: \"typegraph_recorded_clock\") */\n recordedClock?: string | undefined;\n /** Durable per-graph revision-origin table name (default: \"typegraph_revision_origins\") */\n revisionOrigins?: string | undefined;\n /** Node fulltext table name (default: \"typegraph_node_fulltext\") */\n fulltext: string;\n /** Node uniques table name (default: \"typegraph_node_uniques\") */\n uniques: string;\n}>;\n\nexport type ResolvedSqlTableNames = Readonly<{\n /** Nodes table name */\n nodes: string;\n /** Edges table name */\n edges: string;\n /** Recorded node relation table name */\n recordedNodes: string;\n /** Recorded edge relation table name */\n recordedEdges: string;\n /** Recorded-time commit clock table name */\n recordedClock: string;\n /** Durable per-graph revision-origin table name */\n revisionOrigins: string;\n /** Node fulltext table name */\n fulltext: string;\n /** Node uniques table name */\n uniques: string;\n}>;\n\ntype SqlSchemaFields = Readonly<{\n /** Table names */\n tables: ResolvedSqlTableNames;\n /** Get a `SqlFragment` reference to the nodes table. */\n nodesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the edges table. */\n edgesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the recorded node relation. */\n recordedNodesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the recorded edge relation. */\n recordedEdgesTable: SqlFragment;\n /** Get a `SqlFragment` reference to the recorded-time commit clock. */\n recordedClockTable: SqlFragment;\n /** Get a `SqlFragment` reference to the durable per-graph revision origins. */\n revisionOriginsTable: SqlFragment;\n /** Get a `SqlFragment` reference to the fulltext table. */\n fulltextTable: SqlFragment;\n}>;\n\n/**\n * SQL schema configuration for query compilation.\n * Contains table identifiers and utility methods for generating `SqlFragment` references.\n *\n * Branded and frozen by {@link createSqlSchema}; callers should not construct\n * schema-shaped objects by hand.\n */\nexport abstract class SqlSchema implements SqlSchemaFields {\n declare private readonly typeGraphSqlSchemaBrand: true;\n abstract readonly tables: ResolvedSqlTableNames;\n abstract readonly nodesTable: SqlFragment;\n abstract readonly edgesTable: SqlFragment;\n abstract readonly recordedNodesTable: SqlFragment;\n abstract readonly recordedEdgesTable: SqlFragment;\n abstract readonly recordedClockTable: SqlFragment;\n abstract readonly revisionOriginsTable: SqlFragment;\n abstract readonly fulltextTable: SqlFragment;\n}\n\nclass SqlSchemaDescriptor extends SqlSchema {\n declare readonly [SQL_SCHEMA_BRAND]: true;\n readonly tables: ResolvedSqlTableNames;\n readonly nodesTable: SqlFragment;\n readonly edgesTable: SqlFragment;\n readonly recordedNodesTable: SqlFragment;\n readonly recordedEdgesTable: SqlFragment;\n readonly recordedClockTable: SqlFragment;\n readonly revisionOriginsTable: SqlFragment;\n readonly fulltextTable: SqlFragment;\n\n constructor(fields: SqlSchemaFields) {\n super();\n Object.defineProperty(this, SQL_SCHEMA_BRAND, {\n configurable: false,\n enumerable: false,\n value: true,\n writable: false,\n });\n this.tables = fields.tables;\n this.nodesTable = fields.nodesTable;\n this.edgesTable = fields.edgesTable;\n this.recordedNodesTable = fields.recordedNodesTable;\n this.recordedEdgesTable = fields.recordedEdgesTable;\n this.recordedClockTable = fields.recordedClockTable;\n this.revisionOriginsTable = fields.revisionOriginsTable;\n this.fulltextTable = fields.fulltextTable;\n Object.freeze(this);\n }\n}\n\n/**\n * Default table names matching the standard TypeGraph schema.\n */\nconst DEFAULT_TABLE_NAMES: ResolvedSqlTableNames = {\n nodes: \"typegraph_nodes\",\n edges: \"typegraph_edges\",\n recordedNodes: \"typegraph_recorded_nodes\",\n recordedEdges: \"typegraph_recorded_edges\",\n recordedClock: \"typegraph_recorded_clock\",\n revisionOrigins: \"typegraph_revision_origins\",\n fulltext: \"typegraph_node_fulltext\",\n uniques: \"typegraph_node_uniques\",\n};\n\nfunction resolveTableNames(\n names: Partial<SqlTableNames>,\n): ResolvedSqlTableNames {\n return {\n nodes: names.nodes ?? DEFAULT_TABLE_NAMES.nodes,\n edges: names.edges ?? DEFAULT_TABLE_NAMES.edges,\n recordedNodes: names.recordedNodes ?? DEFAULT_TABLE_NAMES.recordedNodes,\n recordedEdges: names.recordedEdges ?? DEFAULT_TABLE_NAMES.recordedEdges,\n recordedClock: names.recordedClock ?? DEFAULT_TABLE_NAMES.recordedClock,\n revisionOrigins:\n names.revisionOrigins ?? DEFAULT_TABLE_NAMES.revisionOrigins,\n fulltext: names.fulltext ?? DEFAULT_TABLE_NAMES.fulltext,\n uniques: names.uniques ?? DEFAULT_TABLE_NAMES.uniques,\n };\n}\n\n/**\n * Regex for valid SQL identifiers.\n * Must start with a letter or underscore.\n * Can contain letters, digits, underscores, and dollar signs.\n * Dollar signs are a PostgreSQL extension but commonly supported.\n */\nconst VALID_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/i;\n\n/**\n * Validates that a table name is a valid SQL identifier.\n *\n * @throws Error if the table name is invalid\n */\nfunction validateTableName(name: string, label: string): void {\n if (!name || name.length === 0) {\n throw new ConfigurationError(`${label} table name cannot be empty`);\n }\n if (name.length > MAX_PG_IDENTIFIER_LENGTH) {\n throw new ConfigurationError(\n `${label} table name exceeds maximum length of ${MAX_PG_IDENTIFIER_LENGTH} characters`,\n );\n }\n if (!VALID_IDENTIFIER_PATTERN.test(name)) {\n throw new ConfigurationError(\n `${label} table name \"${name}\" is not a valid SQL identifier. ` +\n `Table names must start with a letter or underscore and contain only letters, digits, underscores, or dollar signs.`,\n );\n }\n}\n\nfunction freezeSqlSchema(fields: SqlSchemaFields): SqlSchema {\n return new SqlSchemaDescriptor(fields);\n}\n\nfunction isSqlSchema(schema: unknown): schema is SqlSchema {\n if (typeof schema !== \"object\" || schema === null) return false;\n const candidate = schema as Record<PropertyKey, unknown>;\n return (\n candidate[SQL_SCHEMA_BRAND] === true &&\n typeof candidate[\"tables\"] === \"object\" &&\n candidate[\"tables\"] !== null &&\n Object.isFrozen(candidate[\"tables\"]) &&\n isSqlFragment(candidate[\"nodesTable\"]) &&\n isSqlFragment(candidate[\"edgesTable\"]) &&\n isSqlFragment(candidate[\"recordedNodesTable\"]) &&\n isSqlFragment(candidate[\"recordedEdgesTable\"]) &&\n isSqlFragment(candidate[\"recordedClockTable\"]) &&\n isSqlFragment(candidate[\"revisionOriginsTable\"]) &&\n isSqlFragment(candidate[\"fulltextTable\"]) &&\n Object.isFrozen(candidate)\n );\n}\n\nexport function requireSqlSchema(\n schema: unknown,\n surface = \"SqlSchema\",\n): SqlSchema {\n if (isSqlSchema(schema)) return schema;\n throw new ConfigurationError(\n `${surface} must be created with createSqlSchema(...).`,\n { code: \"INVALID_SQL_SCHEMA\", surface },\n {\n suggestion:\n \"Pass the result of createSqlSchema(...) instead of a plain schema-shaped object.\",\n },\n );\n}\n\n/**\n * Creates a SqlSchema configuration from table names.\n *\n * Table names are validated to ensure they are valid SQL identifiers.\n * This prevents SQL injection and ensures compatibility across databases.\n *\n * @param names - Optional custom table names (defaults to standard names)\n * @returns SqlSchema configuration for query compilation\n * @throws Error if any table name is invalid\n *\n * @example\n * ```typescript\n * // Use default table names\n * const schema = createSqlSchema();\n *\n * // Use custom table names\n * const schema = createSqlSchema({\n * nodes: \"myapp_nodes\",\n * edges: \"myapp_edges\",\n * fulltext: \"myapp_fulltext\",\n * });\n * ```\n */\nexport function createSqlSchema(names: Partial<SqlTableNames> = {}): SqlSchema {\n const tables = resolveTableNames(names);\n\n // Validate all table names\n validateTableName(tables.nodes, \"nodes\");\n validateTableName(tables.edges, \"edges\");\n validateTableName(tables.recordedNodes, \"recordedNodes\");\n validateTableName(tables.recordedEdges, \"recordedEdges\");\n validateTableName(tables.recordedClock, \"recordedClock\");\n validateTableName(tables.revisionOrigins, \"revisionOrigins\");\n validateTableName(tables.fulltext, \"fulltext\");\n validateTableName(tables.uniques, \"uniques\");\n\n return freezeSqlSchema({\n tables: Object.freeze(tables),\n nodesTable: sql.identifier(tables.nodes),\n edgesTable: sql.identifier(tables.edges),\n recordedNodesTable: sql.identifier(tables.recordedNodes),\n recordedEdgesTable: sql.identifier(tables.recordedEdges),\n recordedClockTable: sql.identifier(tables.recordedClock),\n revisionOriginsTable: sql.identifier(tables.revisionOrigins),\n fulltextTable: sql.identifier(tables.fulltext),\n });\n}\n\n/**\n * The recorded/system-time relation a read coordinate may reconstruct from.\n *\n * TypeGraph's built-in capture relation is bound by `createStore(..., {\n * history: true })`. Hosts can also bind externally populated row-compatible\n * recorded relations through `recordedRelation({ schema })`. Keeping both as\n * explicit values separates the read contract from the write-capture mechanism\n * so future external/TMS-owned recorded relations can feed the same query\n * machinery without changing StoreView or ReadCoordinate.\n */\nconst EXTERNAL_RECORDED_READ_SOURCE: unique symbol = typeGraphGlobalSymbol(\n \"external-recorded-read-source-v1\",\n);\n\nexport type ExternalRecordedReadSource = Readonly<{\n source: \"external\";\n schema: SqlSchema;\n [EXTERNAL_RECORDED_READ_SOURCE]: true;\n}>;\n\ntype ExternalRecordedReadSourceCandidate = Readonly<{\n source?: unknown;\n schema?: unknown;\n [EXTERNAL_RECORDED_READ_SOURCE]?: unknown;\n}>;\n\nconst TYPEGRAPH_RECORDED_READ_SOURCE: unique symbol = typeGraphGlobalSymbol(\n \"typegraph-recorded-read-source-v1\",\n);\n\nexport type TypeGraphRecordedReadSource = Readonly<{\n source: \"typegraph-capture\";\n schema: SqlSchema;\n [TYPEGRAPH_RECORDED_READ_SOURCE]: true;\n}>;\n\ntype RecordedReadSource =\n ExternalRecordedReadSource | TypeGraphRecordedReadSource;\n\nexport type RecordedReadBinding = RecordedReadSource;\n\nexport type RecordedRelationOptions = Readonly<{\n schema: SqlSchema;\n}>;\n\nexport function recordedRelation(\n options: RecordedRelationOptions,\n): ExternalRecordedReadSource {\n const schema = requireSqlSchema(options.schema, \"recordedRelation schema\");\n return Object.freeze({\n source: \"external\",\n schema,\n [EXTERNAL_RECORDED_READ_SOURCE]: true as const,\n });\n}\n\nexport function requireExternalRecordedReadSource(\n source: unknown,\n): ExternalRecordedReadSource | undefined {\n if (source === undefined) return undefined;\n if (isExternalRecordedReadSource(source)) return source;\n throw new ConfigurationError(\n \"recordedRead must be created with recordedRelation({ schema }).\",\n { code: \"INVALID_RECORDED_READ_SOURCE\" },\n {\n suggestion:\n \"Pass { recordedRead: recordedRelation({ schema }) } for an externally populated recorded relation. Use { history: true } when TypeGraph should capture writes.\",\n },\n );\n}\n\nfunction isExternalRecordedReadSource(\n source: unknown,\n): source is ExternalRecordedReadSource {\n if (typeof source !== \"object\" || source === null) return false;\n const candidate = source as ExternalRecordedReadSourceCandidate;\n return (\n candidate.source === \"external\" &&\n candidate[EXTERNAL_RECORDED_READ_SOURCE] === true &&\n isSqlSchema(candidate.schema) &&\n Object.isFrozen(candidate)\n );\n}\n\nexport function createRecordedReadBinding(\n schema: SqlSchema,\n): TypeGraphRecordedReadSource {\n const readSchema = requireSqlSchema(schema, \"recorded read binding schema\");\n return Object.freeze({\n source: \"typegraph-capture\",\n schema: readSchema,\n [TYPEGRAPH_RECORDED_READ_SOURCE]: true as const,\n });\n}\n\nexport function requireRecordedReadBinding(\n binding: unknown,\n surface: string,\n): RecordedReadBinding {\n if (isRecordedReadBinding(binding)) return binding;\n if (binding !== undefined) {\n throw new ConfigurationError(\n \"Recorded-time reads require a recorded read relation created by TypeGraph.\",\n { code: \"INVALID_RECORDED_READ_BINDING\", surface },\n {\n suggestion:\n \"Use createStore(graph, backend, { history: true }) or { recordedRead: recordedRelation({ schema }) } instead of passing a plain object.\",\n },\n );\n }\n throw new ConfigurationError(\n \"Recorded-time reads require a recorded read relation.\",\n { code: \"RECORDED_READ_REQUIRES_BINDING\", surface },\n {\n suggestion:\n \"Create the store with createStore(graph, backend, { history: true }) to bind TypeGraph's built-in captured relation, or pass { recordedRead: recordedRelation({ schema }) } for an externally populated recorded relation.\",\n },\n );\n}\n\ntype TypeGraphRecordedReadSourceCandidate = Readonly<{\n source?: unknown;\n schema?: unknown;\n [TYPEGRAPH_RECORDED_READ_SOURCE]?: unknown;\n}>;\n\nfunction isTypeGraphRecordedReadSource(\n source: unknown,\n): source is TypeGraphRecordedReadSource {\n if (typeof source !== \"object\" || source === null) return false;\n const candidate = source as TypeGraphRecordedReadSourceCandidate;\n return (\n candidate.source === \"typegraph-capture\" &&\n candidate[TYPEGRAPH_RECORDED_READ_SOURCE] === true &&\n isSqlSchema(candidate.schema) &&\n Object.isFrozen(candidate)\n );\n}\n\nfunction isRecordedReadBinding(\n binding: unknown,\n): binding is RecordedReadBinding {\n return (\n isExternalRecordedReadSource(binding) ||\n isTypeGraphRecordedReadSource(binding)\n );\n}\n\n/**\n * Returns a schema view whose primary node/edge sources are the recorded-time\n * relations. The recorded relations are row-compatible with the live tables\n * for every column the query compiler, subgraph extractor, and algorithms\n * already read; the temporal filter adds the `recorded_from/to` predicate.\n */\nexport function recordedReadSqlSchema(binding: RecordedReadBinding): SqlSchema {\n const { schema } = requireRecordedReadBinding(\n binding,\n \"recorded-read-schema\",\n );\n return freezeSqlSchema({\n tables: schema.tables,\n nodesTable: schema.recordedNodesTable,\n edgesTable: schema.recordedEdgesTable,\n recordedNodesTable: schema.recordedNodesTable,\n recordedEdgesTable: schema.recordedEdgesTable,\n recordedClockTable: schema.recordedClockTable,\n revisionOriginsTable: schema.revisionOriginsTable,\n fulltextTable: schema.fulltextTable,\n });\n}\n\n/**\n * Resolves the read schema for a coordinate: the live schema when no recorded\n * pin is set, or the recorded-relation view when `recordedAsOf` is present. The\n * single place every read path decides whether to source the recorded tables.\n */\nexport function recordedReadSchemaFor(\n schema: SqlSchema,\n recordedAsOf: string | undefined,\n binding: RecordedReadBinding | undefined,\n surface: string,\n): SqlSchema {\n const baseSchema = requireSqlSchema(schema, `${surface} schema`);\n if (recordedAsOf === undefined) return baseSchema;\n return recordedReadSqlSchema(requireRecordedReadBinding(binding, surface));\n}\n\n/**\n * Default SqlSchema using standard TypeGraph table names.\n */\nexport const DEFAULT_SQL_SCHEMA: SqlSchema = createSqlSchema();\n\n/**\n * The compiler's resolved view of one declared embedding field — the\n * `(dimensions, metric, indexType)` a {@link VectorStrategy} needs to\n * name and scan the field's typed per-`(kind, field)` storage. Sourced\n * from the registered node schema's `embedding()` declaration when the\n * store builds its compile options.\n */\nexport type VectorSlotDescriptor = Readonly<{\n dimensions: number;\n metric: VectorMetric;\n indexType: VectorIndexType;\n}>;\n\n/**\n * Map of declared embedding slots keyed by {@link vectorSlotKey} -\n * `\"<nodeKind>\\0<fieldPath>\"` (NUL-separated). Carries every `(concrete kind,\n * fieldPath)` that declares an embedding field, so the compiler's\n * `field.similarTo(...)` CTE can UNION ALL the per-field tables for the\n * kinds in an alias that actually declare the field (only\n * `includeSubClasses` yields more than one).\n */\nexport type VectorSlotMap = ReadonlyMap<string, VectorSlotDescriptor>;\n\n/** NUL-delimited composite key for {@link VectorSlotMap}. */\nexport function vectorSlotKey(nodeKind: string, fieldPath: string): string {\n return `${nodeKind}\\u0000${fieldPath}`;\n}\n\n/**\n * CTE aliases used by the standard query emitter. Joining on these names\n * across multiple builder files is fragile when typed as raw strings —\n * import these constants instead.\n */\nexport const ALIAS_CTE_PREFIX = \"cte_\" as const;\nexport const EMBEDDINGS_CTE_ALIAS = \"cte_embeddings\" as const;\nexport const FULLTEXT_CTE_ALIAS = \"cte_fulltext\" as const;\nexport const HYBRID_CANDIDATES_CTE_ALIAS = \"cte_relevance_candidates\" as const;\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDI74SMXS_cjs = require('./chunk-DI74SMXS.cjs');
|
|
4
|
+
var chunkC4F7VJ5D_cjs = require('./chunk-C4F7VJ5D.cjs');
|
|
4
5
|
|
|
5
6
|
// src/store/reserved-keys.ts
|
|
6
7
|
var RESERVED_NODE_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -32,7 +33,7 @@ function assertSchemaKeysAreFree(entityKind, name, keys, reservedStructuralKeys)
|
|
|
32
33
|
);
|
|
33
34
|
if (structuralConflicts.length > 0) {
|
|
34
35
|
const label = entityKind.toLowerCase();
|
|
35
|
-
throw new
|
|
36
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
36
37
|
`${entityKind} "${name}" schema contains reserved property names: ${structuralConflicts.join(", ")}`,
|
|
37
38
|
{
|
|
38
39
|
[`${label}Type`]: name,
|
|
@@ -47,7 +48,7 @@ function assertSchemaKeysAreFree(entityKind, name, keys, reservedStructuralKeys)
|
|
|
47
48
|
const prefixConflicts = keys.filter((key) => isReservedPropertyName(key));
|
|
48
49
|
if (prefixConflicts.length > 0) {
|
|
49
50
|
const label = entityKind.toLowerCase();
|
|
50
|
-
throw new
|
|
51
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
51
52
|
`${entityKind} "${name}" schema uses the reserved "${RESERVED_PROPERTY_PREFIX}" prefix on: ${prefixConflicts.join(", ")}`,
|
|
52
53
|
{
|
|
53
54
|
[`${label}Type`]: name,
|
|
@@ -63,7 +64,7 @@ function assertSchemaKeysAreFree(entityKind, name, keys, reservedStructuralKeys)
|
|
|
63
64
|
function validateProjectionField(field, entityType, kind) {
|
|
64
65
|
const reserved = entityType === "node" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;
|
|
65
66
|
if (reserved.has(field)) {
|
|
66
|
-
throw new
|
|
67
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
67
68
|
`Projection field "${field}" on ${entityType} kind "${kind}" conflicts with a reserved structural key`,
|
|
68
69
|
{ field, kind, entityType, reservedKeys: [...reserved] },
|
|
69
70
|
{
|
|
@@ -72,7 +73,7 @@ function validateProjectionField(field, entityType, kind) {
|
|
|
72
73
|
);
|
|
73
74
|
}
|
|
74
75
|
if (PROTOTYPE_POLLUTION_KEYS.has(field)) {
|
|
75
|
-
throw new
|
|
76
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
76
77
|
`Projection field "${field}" on ${entityType} kind "${kind}" is not allowed`,
|
|
77
78
|
{ field, kind, entityType },
|
|
78
79
|
{
|
|
@@ -91,10 +92,64 @@ function filterReservedKeys(props, reservedKeys) {
|
|
|
91
92
|
return filtered;
|
|
92
93
|
}
|
|
93
94
|
|
|
95
|
+
// src/core/json-value.ts
|
|
96
|
+
function assertJsonValue(value, rootLabel, ownerKind) {
|
|
97
|
+
walk(value, rootLabel, ownerKind);
|
|
98
|
+
}
|
|
99
|
+
function walk(value, path, ownerKind) {
|
|
100
|
+
if (value === null) return;
|
|
101
|
+
const valueType = typeof value;
|
|
102
|
+
if (valueType === "number") {
|
|
103
|
+
if (!Number.isFinite(value)) {
|
|
104
|
+
throwInvalid(path, describeNonFinite(value), ownerKind);
|
|
105
|
+
}
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (valueType === "string" || valueType === "boolean") return;
|
|
109
|
+
if (valueType === "bigint" || valueType === "function" || valueType === "symbol" || valueType === "undefined") {
|
|
110
|
+
throwInvalid(path, valueType, ownerKind);
|
|
111
|
+
}
|
|
112
|
+
if (Array.isArray(value)) {
|
|
113
|
+
for (const [index, element] of value.entries()) {
|
|
114
|
+
walk(element, `${path}[${index}]`, ownerKind);
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (!chunkDI74SMXS_cjs.isPlainObject(value)) {
|
|
119
|
+
throwInvalid(path, describeNonPlain(value), ownerKind);
|
|
120
|
+
}
|
|
121
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
122
|
+
walk(nested, `${path}.${key}`, ownerKind);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function describeNonFinite(value) {
|
|
126
|
+
if (Number.isNaN(value)) return "NaN";
|
|
127
|
+
if (value === Number.POSITIVE_INFINITY) return "Infinity";
|
|
128
|
+
if (value === Number.NEGATIVE_INFINITY) return "-Infinity";
|
|
129
|
+
return "non-finite number";
|
|
130
|
+
}
|
|
131
|
+
function describeNonPlain(value) {
|
|
132
|
+
const constructorName = value?.constructor?.name;
|
|
133
|
+
if (typeof constructorName === "string" && constructorName.length > 0) {
|
|
134
|
+
return `${constructorName} instance`;
|
|
135
|
+
}
|
|
136
|
+
return "non-plain object";
|
|
137
|
+
}
|
|
138
|
+
function throwInvalid(path, kind, ownerKind) {
|
|
139
|
+
throw new chunkC4F7VJ5D_cjs.ConfigurationError(
|
|
140
|
+
`${ownerKind} ${path} contains a non-JSON value (${kind}). Annotations must be JSON-serializable.`,
|
|
141
|
+
{ path, valueKind: kind },
|
|
142
|
+
{
|
|
143
|
+
suggestion: "Use only strings, numbers, booleans, null, arrays, and plain objects in annotations."
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
94
148
|
exports.RESERVED_EDGE_KEYS = RESERVED_EDGE_KEYS;
|
|
95
149
|
exports.RESERVED_NODE_KEYS = RESERVED_NODE_KEYS;
|
|
150
|
+
exports.assertJsonValue = assertJsonValue;
|
|
96
151
|
exports.assertSchemaKeysAreFree = assertSchemaKeysAreFree;
|
|
97
152
|
exports.filterReservedKeys = filterReservedKeys;
|
|
98
153
|
exports.validateProjectionField = validateProjectionField;
|
|
99
|
-
//# sourceMappingURL=chunk-
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-D54WH24V.cjs.map
|
|
155
|
+
//# sourceMappingURL=chunk-D54WH24V.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/store/reserved-keys.ts","../src/core/json-value.ts"],"names":["ConfigurationError","isPlainObject"],"mappings":";;;;;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AAA,SAAA,CAAA;AAAA,EAC3B;AACA,EAAA,OAAO,kBAAA;AACT;AAEA,SAAS,YAAA,CAAa,IAAA,EAAc,IAAA,EAAc,SAAA,EAA0B;AAC1E,EAAA,MAAM,IAAID,oCAAA;AAAA,IACR,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,IAAI,+BAA+B,IAAI,CAAA,yCAAA,CAAA;AAAA,IACvD,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAK;AAAA,IACxB;AAAA,MACE,UAAA,EACE;AAAA;AACJ,GACF;AACF","file":"chunk-D54WH24V.cjs","sourcesContent":["/**\n * Reserved Keys for Store Entities\n *\n * Structural keys that cannot be overwritten by user-defined properties.\n * Shared across row-mappers, subgraph projection, and schema validation.\n */\nimport type { KindEntity } from \"../core/types\";\nimport { ConfigurationError } from \"../errors\";\n\nexport const RESERVED_NODE_KEYS: ReadonlySet<string> = new Set([\n \"id\",\n \"kind\",\n \"meta\",\n]);\n\nexport const RESERVED_EDGE_KEYS: ReadonlySet<string> = new Set([\n \"id\",\n \"kind\",\n \"meta\",\n \"fromKind\",\n \"fromId\",\n \"toKind\",\n \"toId\",\n]);\n\nconst PROTOTYPE_POLLUTION_KEYS: ReadonlySet<string> = new Set([\n \"__proto__\",\n \"constructor\",\n \"prototype\",\n]);\n\n/**\n * Properties starting with `$` are reserved for TypeGraph-owned accessors\n * on the query-builder node/edge proxies (today: `$fulltext`). Reserving\n * the whole prefix — not just the currently-used names — keeps future\n * accessors (e.g. `$vector`, `$json`) from colliding with user fields.\n */\nconst RESERVED_PROPERTY_PREFIX = \"$\";\n\n/**\n * True if a user-defined field name is reserved by TypeGraph's accessor\n * namespace. `defineNode` / `defineEdge` call this against schema keys so\n * the collision fails fast at graph-definition time rather than silently\n * at query time.\n */\nfunction isReservedPropertyName(name: string): boolean {\n return name.startsWith(RESERVED_PROPERTY_PREFIX);\n}\n\n/**\n * Validates that a node or edge schema does not use any reserved property\n * name. Covers both the structural keys (`id`, `kind`, etc.) and the\n * `$`-prefix accessor namespace. Throws a single `ConfigurationError`\n * per conflict class so the user sees all collisions in one pass.\n */\nexport function assertSchemaKeysAreFree(\n entityKind: \"Node\" | \"Edge\",\n name: string,\n keys: readonly string[],\n reservedStructuralKeys: ReadonlySet<string>,\n): void {\n const structuralConflicts = keys.filter((key) =>\n reservedStructuralKeys.has(key),\n );\n if (structuralConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema contains reserved property names: ${structuralConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: structuralConflicts,\n reservedKeys: [...reservedStructuralKeys],\n },\n {\n suggestion: `Rename the conflicting properties. Reserved names (${[...reservedStructuralKeys].join(\", \")}) are added automatically to all ${label}s.`,\n },\n );\n }\n\n const prefixConflicts = keys.filter((key) => isReservedPropertyName(key));\n if (prefixConflicts.length > 0) {\n const label = entityKind.toLowerCase();\n throw new ConfigurationError(\n `${entityKind} \"${name}\" schema uses the reserved \"${RESERVED_PROPERTY_PREFIX}\" prefix on: ${prefixConflicts.join(\", \")}`,\n {\n [`${label}Type`]: name,\n conflicts: prefixConflicts,\n reservedPrefix: RESERVED_PROPERTY_PREFIX,\n },\n {\n suggestion: `Property names starting with \"${RESERVED_PROPERTY_PREFIX}\" are reserved for TypeGraph accessors (e.g. $fulltext). Rename each field.`,\n },\n );\n }\n}\n\n/**\n * Validates that a projection field name is safe to assign onto a result object.\n * Rejects reserved structural keys and prototype-pollution vectors.\n *\n * @throws ConfigurationError if the field is reserved or dangerous\n */\nexport function validateProjectionField(\n field: string,\n entityType: KindEntity,\n kind: string,\n): void {\n const reserved =\n entityType === \"node\" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;\n\n if (reserved.has(field)) {\n throw new ConfigurationError(\n `Projection field \"${field}\" on ${entityType} kind \"${kind}\" conflicts with a reserved structural key`,\n { field, kind, entityType, reservedKeys: [...reserved] },\n {\n suggestion: `Remove \"${field}\" from the projection. Structural fields (${[...reserved].join(\", \")}) are included automatically when relevant.`,\n },\n );\n }\n\n if (PROTOTYPE_POLLUTION_KEYS.has(field)) {\n throw new ConfigurationError(\n `Projection field \"${field}\" on ${entityType} kind \"${kind}\" is not allowed`,\n { field, kind, entityType },\n {\n suggestion: `\"${field}\" cannot be used as a projection field name.`,\n },\n );\n }\n}\n\n/**\n * Filters out reserved keys from a props object to prevent runtime collisions.\n */\nexport function filterReservedKeys(\n props: Record<string, unknown>,\n reservedKeys: ReadonlySet<string>,\n): Record<string, unknown> {\n const filtered: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n if (!reservedKeys.has(key)) {\n filtered[key] = value;\n }\n }\n return filtered;\n}\n","/**\n * Runtime validation for JSON-serializable values.\n *\n * Used at definition-time boundaries (e.g., `defineNode`/`defineEdge` annotations)\n * to reject values that would silently break `JSON.stringify` round-trips or\n * throw at hash time. Catches accidental violations from untyped JS callers\n * and `as any` escape hatches that bypass the `JsonValue` type.\n */\nimport { ConfigurationError } from \"../errors\";\nimport { isPlainObject } from \"../utils/object\";\n\n/**\n * Asserts that `value` is JSON-serializable.\n *\n * Throws `ConfigurationError` with a dotted path identifying the offending\n * field. Rejects `bigint`, `function`, `symbol`, `undefined`, and class\n * instances such as `Date`, `Map`, `Set`, regex literals, and Buffers — all\n * of which either throw or silently coerce under `JSON.stringify`.\n *\n * @param value - The value to validate\n * @param rootLabel - Label for the root of the value (e.g., `\"annotations\"`)\n * used as the prefix of the error path\n * @param ownerKind - Human-readable owner identifier for the error message\n * (e.g., `'Node \"Person\"'`)\n */\nexport function assertJsonValue(\n value: unknown,\n rootLabel: string,\n ownerKind: string,\n): void {\n walk(value, rootLabel, ownerKind);\n}\n\nfunction walk(value: unknown, path: string, ownerKind: string): void {\n if (value === null) return;\n const valueType = typeof value;\n if (valueType === \"number\") {\n // NaN/Infinity/-Infinity are not JSON values; JSON.stringify silently\n // coerces them to `null`, which would change the canonical hash input\n // without the consumer noticing.\n if (!Number.isFinite(value)) {\n throwInvalid(path, describeNonFinite(value as number), ownerKind);\n }\n return;\n }\n if (valueType === \"string\" || valueType === \"boolean\") return;\n if (\n valueType === \"bigint\" ||\n valueType === \"function\" ||\n valueType === \"symbol\" ||\n valueType === \"undefined\"\n ) {\n throwInvalid(path, valueType, ownerKind);\n }\n if (Array.isArray(value)) {\n for (const [index, element] of value.entries()) {\n walk(element, `${path}[${index}]`, ownerKind);\n }\n return;\n }\n if (!isPlainObject(value)) {\n throwInvalid(path, describeNonPlain(value), ownerKind);\n }\n for (const [key, nested] of Object.entries(value)) {\n walk(nested, `${path}.${key}`, ownerKind);\n }\n}\n\nfunction describeNonFinite(value: number): string {\n if (Number.isNaN(value)) return \"NaN\";\n if (value === Number.POSITIVE_INFINITY) return \"Infinity\";\n if (value === Number.NEGATIVE_INFINITY) return \"-Infinity\";\n return \"non-finite number\";\n}\n\nfunction describeNonPlain(value: unknown): string {\n const constructorName = (value as { constructor?: { name?: unknown } } | null)\n ?.constructor?.name;\n if (typeof constructorName === \"string\" && constructorName.length > 0) {\n return `${constructorName} instance`;\n }\n return \"non-plain object\";\n}\n\nfunction throwInvalid(path: string, kind: string, ownerKind: string): never {\n throw new ConfigurationError(\n `${ownerKind} ${path} contains a non-JSON value (${kind}). Annotations must be JSON-serializable.`,\n { path, valueKind: kind },\n {\n suggestion:\n \"Use only strings, numbers, booleans, null, arrays, and plain objects in annotations.\",\n },\n );\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk4SZ6XPTG_cjs = require('./chunk-4SZ6XPTG.cjs');
|
|
4
|
+
var chunkJXUTCSXX_cjs = require('./chunk-JXUTCSXX.cjs');
|
|
5
|
+
var chunkU5W4LKZV_cjs = require('./chunk-U5W4LKZV.cjs');
|
|
6
6
|
|
|
7
7
|
// src/query/dialect/vector/pgvector-strategy.ts
|
|
8
8
|
var TABLE_PREFIX = "tg_vec";
|
|
@@ -63,20 +63,20 @@ function operatorClass(metric) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
function vectorLiteral(embedding, name) {
|
|
66
|
-
|
|
67
|
-
return
|
|
66
|
+
chunkJXUTCSXX_cjs.assertFiniteEmbedding(embedding, name);
|
|
67
|
+
return chunkU5W4LKZV_cjs.sql`${`[${embedding.join(",")}]`}::vector`;
|
|
68
68
|
}
|
|
69
69
|
function distanceExpression(embeddingColumn, queryEmbedding, metric) {
|
|
70
70
|
const query = vectorLiteral(queryEmbedding, "queryEmbedding");
|
|
71
71
|
switch (metric) {
|
|
72
72
|
case "cosine": {
|
|
73
|
-
return
|
|
73
|
+
return chunkU5W4LKZV_cjs.sql`(${embeddingColumn} <=> ${query})`;
|
|
74
74
|
}
|
|
75
75
|
case "l2": {
|
|
76
|
-
return
|
|
76
|
+
return chunkU5W4LKZV_cjs.sql`(${embeddingColumn} <-> ${query})`;
|
|
77
77
|
}
|
|
78
78
|
case "inner_product": {
|
|
79
|
-
return
|
|
79
|
+
return chunkU5W4LKZV_cjs.sql`(${embeddingColumn} <#> ${query})`;
|
|
80
80
|
}
|
|
81
81
|
default: {
|
|
82
82
|
const _exhaustive = metric;
|
|
@@ -85,7 +85,7 @@ function distanceExpression(embeddingColumn, queryEmbedding, metric) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
function tableName(graphId, nodeKind, fieldPath) {
|
|
88
|
-
return
|
|
88
|
+
return chunkJXUTCSXX_cjs.vectorPhysicalName(TABLE_PREFIX, graphId, nodeKind, fieldPath);
|
|
89
89
|
}
|
|
90
90
|
var pgvectorStrategy = {
|
|
91
91
|
name: "pgvector",
|
|
@@ -93,7 +93,7 @@ var pgvectorStrategy = {
|
|
|
93
93
|
tableName,
|
|
94
94
|
ownedTables(slot) {
|
|
95
95
|
const table = tableName(slot.graphId, slot.nodeKind, slot.fieldPath);
|
|
96
|
-
const name =
|
|
96
|
+
const name = chunkJXUTCSXX_cjs.quoteIdentifier(table);
|
|
97
97
|
const createDdl = [
|
|
98
98
|
`CREATE TABLE IF NOT EXISTS ${name} (
|
|
99
99
|
"graph_id" TEXT NOT NULL,
|
|
@@ -106,7 +106,7 @@ var pgvectorStrategy = {
|
|
|
106
106
|
];
|
|
107
107
|
return [
|
|
108
108
|
{
|
|
109
|
-
logicalName: `${
|
|
109
|
+
logicalName: `${chunkJXUTCSXX_cjs.VECTOR_CONTRIBUTION_PREFIX}:${slot.nodeKind}.${slot.fieldPath}`,
|
|
110
110
|
owner: "pgvector",
|
|
111
111
|
tableName: table,
|
|
112
112
|
createDdl,
|
|
@@ -115,12 +115,12 @@ var pgvectorStrategy = {
|
|
|
115
115
|
];
|
|
116
116
|
},
|
|
117
117
|
buildUpsert(slot, params, timestamp) {
|
|
118
|
-
const table =
|
|
118
|
+
const table = chunkU5W4LKZV_cjs.sql.identifier(
|
|
119
119
|
tableName(slot.graphId, slot.nodeKind, slot.fieldPath)
|
|
120
120
|
);
|
|
121
121
|
const value = vectorLiteral(params.embedding, "embedding");
|
|
122
122
|
return [
|
|
123
|
-
|
|
123
|
+
chunkU5W4LKZV_cjs.sql`
|
|
124
124
|
INSERT INTO ${table} ("graph_id", "node_id", "embedding", "created_at", "updated_at")
|
|
125
125
|
VALUES (${params.graphId}, ${params.nodeId}, ${value}, ${timestamp}, ${timestamp})
|
|
126
126
|
ON CONFLICT ("graph_id", "node_id")
|
|
@@ -129,17 +129,17 @@ var pgvectorStrategy = {
|
|
|
129
129
|
];
|
|
130
130
|
},
|
|
131
131
|
buildUpsertBatch(slot, params, timestamp) {
|
|
132
|
-
const table =
|
|
132
|
+
const table = chunkU5W4LKZV_cjs.sql.identifier(
|
|
133
133
|
tableName(slot.graphId, slot.nodeKind, slot.fieldPath)
|
|
134
134
|
);
|
|
135
|
-
const valueRows =
|
|
135
|
+
const valueRows = chunkU5W4LKZV_cjs.sql.join(
|
|
136
136
|
params.rows.map(
|
|
137
|
-
(row) =>
|
|
137
|
+
(row) => chunkU5W4LKZV_cjs.sql`(${params.graphId}, ${row.nodeId}, ${vectorLiteral(row.embedding, "embedding")}, ${timestamp}, ${timestamp})`
|
|
138
138
|
),
|
|
139
|
-
|
|
139
|
+
chunkU5W4LKZV_cjs.sql`, `
|
|
140
140
|
);
|
|
141
141
|
return [
|
|
142
|
-
|
|
142
|
+
chunkU5W4LKZV_cjs.sql`
|
|
143
143
|
INSERT INTO ${table} ("graph_id", "node_id", "embedding", "created_at", "updated_at")
|
|
144
144
|
VALUES ${valueRows}
|
|
145
145
|
ON CONFLICT ("graph_id", "node_id")
|
|
@@ -148,60 +148,72 @@ var pgvectorStrategy = {
|
|
|
148
148
|
];
|
|
149
149
|
},
|
|
150
150
|
buildDelete(slot, params) {
|
|
151
|
-
const table =
|
|
151
|
+
const table = chunkU5W4LKZV_cjs.sql.identifier(
|
|
152
152
|
tableName(slot.graphId, slot.nodeKind, slot.fieldPath)
|
|
153
153
|
);
|
|
154
154
|
return [
|
|
155
|
-
|
|
155
|
+
chunkU5W4LKZV_cjs.sql`
|
|
156
156
|
DELETE FROM ${table}
|
|
157
157
|
WHERE "graph_id" = ${params.graphId} AND "node_id" = ${params.nodeId}
|
|
158
158
|
`
|
|
159
159
|
];
|
|
160
160
|
},
|
|
161
|
+
buildDeleteBatch(slot, params) {
|
|
162
|
+
if (params.nodeIds.length === 0) return [];
|
|
163
|
+
const table = chunkU5W4LKZV_cjs.sql.identifier(
|
|
164
|
+
tableName(slot.graphId, slot.nodeKind, slot.fieldPath)
|
|
165
|
+
);
|
|
166
|
+
return [
|
|
167
|
+
chunkU5W4LKZV_cjs.sql`DELETE FROM ${table} WHERE "graph_id" = ${params.graphId} AND "node_id" IN (${chunkU5W4LKZV_cjs.sql.join(
|
|
168
|
+
params.nodeIds.map((nodeId) => chunkU5W4LKZV_cjs.sql`${nodeId}`),
|
|
169
|
+
chunkU5W4LKZV_cjs.sql`, `
|
|
170
|
+
)})`
|
|
171
|
+
];
|
|
172
|
+
},
|
|
161
173
|
buildSearch(slot, params, candidates) {
|
|
162
|
-
const table =
|
|
174
|
+
const table = chunkU5W4LKZV_cjs.sql.identifier(
|
|
163
175
|
tableName(slot.graphId, slot.nodeKind, slot.fieldPath)
|
|
164
176
|
);
|
|
165
|
-
const embeddingColumn =
|
|
177
|
+
const embeddingColumn = chunkU5W4LKZV_cjs.sql`${table}."embedding"`;
|
|
166
178
|
const distance = distanceExpression(
|
|
167
179
|
embeddingColumn,
|
|
168
180
|
params.queryEmbedding,
|
|
169
181
|
params.metric
|
|
170
182
|
);
|
|
171
|
-
const score =
|
|
183
|
+
const score = chunkJXUTCSXX_cjs.vectorScoreExpression(distance, params.metric);
|
|
172
184
|
const conditions = [
|
|
173
|
-
|
|
185
|
+
chunkU5W4LKZV_cjs.sql`${table}."graph_id" = ${params.graphId}`
|
|
174
186
|
];
|
|
175
187
|
if (params.minScore !== void 0) {
|
|
176
188
|
conditions.push(
|
|
177
|
-
|
|
189
|
+
chunkJXUTCSXX_cjs.vectorMinScoreCondition(distance, params.metric, params.minScore)
|
|
178
190
|
);
|
|
179
191
|
}
|
|
180
192
|
if (candidates !== void 0) {
|
|
181
|
-
conditions.push(
|
|
193
|
+
conditions.push(chunkU5W4LKZV_cjs.sql`${table}."node_id" IN (${candidates})`);
|
|
182
194
|
}
|
|
183
195
|
const pageOffset = params.offset ?? 0;
|
|
184
|
-
const pageClause =
|
|
196
|
+
const pageClause = chunk4SZ6XPTG_cjs.vectorPageClause(params.limit, params.offset);
|
|
185
197
|
if (slot.indexType === "ivfflat") {
|
|
186
|
-
const direction = params.metric === "cosine" ?
|
|
187
|
-
const relaxedBody =
|
|
198
|
+
const direction = params.metric === "cosine" ? chunkU5W4LKZV_cjs.sql.raw("DESC") : chunkU5W4LKZV_cjs.sql.raw("ASC");
|
|
199
|
+
const relaxedBody = chunkU5W4LKZV_cjs.sql`
|
|
188
200
|
SELECT ${table}."node_id" AS node_id, ${score} AS score
|
|
189
201
|
FROM ${table}
|
|
190
|
-
WHERE ${
|
|
202
|
+
WHERE ${chunkU5W4LKZV_cjs.sql.join(conditions, chunkU5W4LKZV_cjs.sql` AND `)}
|
|
191
203
|
ORDER BY ${distance} ASC
|
|
192
204
|
LIMIT ${params.limit + pageOffset}
|
|
193
205
|
`;
|
|
194
|
-
return
|
|
206
|
+
return chunkU5W4LKZV_cjs.sql`
|
|
195
207
|
WITH tg_vec_relaxed AS MATERIALIZED (${relaxedBody})
|
|
196
208
|
SELECT node_id, score FROM tg_vec_relaxed
|
|
197
209
|
ORDER BY score ${direction}, node_id ASC
|
|
198
210
|
${pageClause}
|
|
199
211
|
`;
|
|
200
212
|
}
|
|
201
|
-
return
|
|
213
|
+
return chunkU5W4LKZV_cjs.sql`
|
|
202
214
|
SELECT ${table}."node_id" AS node_id, ${score} AS score
|
|
203
215
|
FROM ${table}
|
|
204
|
-
WHERE ${
|
|
216
|
+
WHERE ${chunkU5W4LKZV_cjs.sql.join(conditions, chunkU5W4LKZV_cjs.sql` AND `)}
|
|
205
217
|
ORDER BY ${distance} ASC
|
|
206
218
|
${pageClause}
|
|
207
219
|
`;
|
|
@@ -211,7 +223,7 @@ var pgvectorStrategy = {
|
|
|
211
223
|
},
|
|
212
224
|
buildCreateIndex(slot, options) {
|
|
213
225
|
if (!usesAnnIndex(slot)) return void 0;
|
|
214
|
-
return
|
|
226
|
+
return chunkU5W4LKZV_cjs.sql.raw(
|
|
215
227
|
pgvectorIndexDdl(
|
|
216
228
|
tableName(slot.graphId, slot.nodeKind, slot.fieldPath),
|
|
217
229
|
slot,
|
|
@@ -222,17 +234,17 @@ var pgvectorStrategy = {
|
|
|
222
234
|
buildDropIndex(slot) {
|
|
223
235
|
if (!usesAnnIndex(slot)) return void 0;
|
|
224
236
|
const indexName = pgvectorIndexName(slot);
|
|
225
|
-
return
|
|
237
|
+
return chunkU5W4LKZV_cjs.sql.raw(`DROP INDEX IF EXISTS ${chunkJXUTCSXX_cjs.quoteIdentifier(indexName)}`);
|
|
226
238
|
},
|
|
227
239
|
buildDropStorage(slot) {
|
|
228
|
-
const table =
|
|
240
|
+
const table = chunkJXUTCSXX_cjs.quoteIdentifier(
|
|
229
241
|
tableName(slot.graphId, slot.nodeKind, slot.fieldPath)
|
|
230
242
|
);
|
|
231
243
|
return [`DROP TABLE IF EXISTS ${table} CASCADE`];
|
|
232
244
|
}
|
|
233
245
|
};
|
|
234
246
|
function pgvectorIndexName(slot) {
|
|
235
|
-
return
|
|
247
|
+
return chunkJXUTCSXX_cjs.vectorPhysicalName(
|
|
236
248
|
INDEX_PREFIX,
|
|
237
249
|
slot.graphId,
|
|
238
250
|
slot.nodeKind,
|
|
@@ -240,8 +252,8 @@ function pgvectorIndexName(slot) {
|
|
|
240
252
|
);
|
|
241
253
|
}
|
|
242
254
|
function pgvectorIndexDdl(table, slot, concurrent) {
|
|
243
|
-
const indexName =
|
|
244
|
-
const quotedTable =
|
|
255
|
+
const indexName = chunkJXUTCSXX_cjs.quoteIdentifier(pgvectorIndexName(slot));
|
|
256
|
+
const quotedTable = chunkJXUTCSXX_cjs.quoteIdentifier(table);
|
|
245
257
|
const opClass = operatorClass(slot.metric);
|
|
246
258
|
const m = slot.indexParams?.m ?? DEFAULT_HNSW_M;
|
|
247
259
|
const efConstruction = slot.indexParams?.efConstruction ?? DEFAULT_HNSW_EF_CONSTRUCTION;
|
|
@@ -268,5 +280,5 @@ function pgvectorIndexDdl(table, slot, concurrent) {
|
|
|
268
280
|
|
|
269
281
|
exports.assertPgvectorEfSearch = assertPgvectorEfSearch;
|
|
270
282
|
exports.pgvectorStrategy = pgvectorStrategy;
|
|
271
|
-
//# sourceMappingURL=chunk-
|
|
272
|
-
//# sourceMappingURL=chunk-
|
|
283
|
+
//# sourceMappingURL=chunk-D56XG4EI.cjs.map
|
|
284
|
+
//# sourceMappingURL=chunk-D56XG4EI.cjs.map
|