@nicia-ai/typegraph 0.37.1 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/dist/backend/drizzle/indexes.cjs +32 -0
- package/dist/backend/drizzle/indexes.cjs.map +1 -0
- package/dist/backend/drizzle/indexes.d.cts +43 -0
- package/dist/backend/drizzle/indexes.d.ts +43 -0
- package/dist/backend/drizzle/indexes.js +11 -0
- package/dist/backend/drizzle/indexes.js.map +1 -0
- package/dist/backend/index.cjs +161 -0
- package/dist/backend/index.cjs.map +1 -0
- package/dist/backend/index.d.cts +3 -0
- package/dist/backend/index.d.ts +3 -0
- package/dist/backend/index.js +8 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/postgres/index.cjs +32 -28
- package/dist/backend/postgres/index.d.cts +13 -12
- package/dist/backend/postgres/index.d.ts +13 -12
- package/dist/backend/postgres/index.js +19 -15
- package/dist/backend/postgres/pglite-store.cjs +67 -0
- package/dist/backend/postgres/pglite-store.cjs.map +1 -0
- package/dist/backend/postgres/pglite-store.d.cts +38 -0
- package/dist/backend/postgres/pglite-store.d.ts +38 -0
- package/dist/backend/postgres/pglite-store.js +65 -0
- package/dist/backend/postgres/pglite-store.js.map +1 -0
- package/dist/backend/postgres/pglite.cjs +25 -50
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +10 -9
- package/dist/backend/postgres/pglite.d.ts +10 -9
- package/dist/backend/postgres/pglite.js +20 -52
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +29 -25
- package/dist/backend/sqlite/index.d.cts +11 -11
- package/dist/backend/sqlite/index.d.ts +11 -11
- package/dist/backend/sqlite/index.js +17 -13
- package/dist/backend/sqlite/libsql.cjs +23 -19
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +9 -10
- package/dist/backend/sqlite/libsql.d.ts +9 -10
- package/dist/backend/sqlite/libsql.js +19 -15
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +72 -0
- package/dist/backend/sqlite/local-store.cjs.map +1 -0
- package/dist/backend/sqlite/local-store.d.cts +42 -0
- package/dist/backend/sqlite/local-store.d.ts +42 -0
- package/dist/backend/sqlite/local-store.js +67 -0
- package/dist/backend/sqlite/local-store.js.map +1 -0
- package/dist/backend/sqlite/local.cjs +28 -183
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +8 -81
- package/dist/backend/sqlite/local.d.ts +8 -81
- package/dist/backend/sqlite/local.js +20 -180
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/chunk-2EBMPJBO.js +16 -0
- package/dist/chunk-2EBMPJBO.js.map +1 -0
- package/dist/chunk-35S6P5ZU.js +27 -0
- package/dist/chunk-35S6P5ZU.js.map +1 -0
- package/dist/chunk-3LKL3S6X.js +50 -0
- package/dist/chunk-3LKL3S6X.js.map +1 -0
- package/dist/{chunk-RCVLFTCT.js → chunk-3SK4SVTW.js} +13 -12
- package/dist/chunk-3SK4SVTW.js.map +1 -0
- package/dist/chunk-3YFDFOYB.cjs +192 -0
- package/dist/chunk-3YFDFOYB.cjs.map +1 -0
- package/dist/{chunk-WOJMKB3N.cjs → chunk-5ELKD2FQ.cjs} +1677 -308
- package/dist/chunk-5ELKD2FQ.cjs.map +1 -0
- package/dist/{chunk-5AVRFNP4.cjs → chunk-6SRLCSAV.cjs} +3012 -1513
- package/dist/chunk-6SRLCSAV.cjs.map +1 -0
- package/dist/chunk-6XDBRDZE.js +312 -0
- package/dist/chunk-6XDBRDZE.js.map +1 -0
- package/dist/chunk-764JHTLT.cjs +15 -0
- package/dist/chunk-764JHTLT.cjs.map +1 -0
- package/dist/chunk-76HE7DJP.js +68 -0
- package/dist/chunk-76HE7DJP.js.map +1 -0
- package/dist/{chunk-VGDDG3XJ.cjs → chunk-7M3NACL3.cjs} +12 -12
- package/dist/{chunk-VGDDG3XJ.cjs.map → chunk-7M3NACL3.cjs.map} +1 -1
- package/dist/chunk-AOL64O4Z.js +165 -0
- package/dist/chunk-AOL64O4Z.js.map +1 -0
- package/dist/{chunk-27SSDCEP.cjs → chunk-B63IFHXR.cjs} +53 -74
- package/dist/chunk-B63IFHXR.cjs.map +1 -0
- package/dist/{chunk-3XXGYU62.cjs → chunk-BKAKAVRW.cjs} +56 -53
- package/dist/chunk-BKAKAVRW.cjs.map +1 -0
- package/dist/{chunk-YTSN73ND.js → chunk-BQITNFQJ.js} +3 -3
- package/dist/{chunk-YTSN73ND.js.map → chunk-BQITNFQJ.js.map} +1 -1
- package/dist/{chunk-GA4TT3DH.js → chunk-CBK2IVI2.js} +1999 -503
- package/dist/chunk-CBK2IVI2.js.map +1 -0
- package/dist/{chunk-6EEO3OVU.cjs → chunk-CWX77JB4.cjs} +22 -59
- package/dist/chunk-CWX77JB4.cjs.map +1 -0
- package/dist/{chunk-UGZUAYAR.js → chunk-D7PG5D5K.js} +4 -3
- package/dist/chunk-D7PG5D5K.js.map +1 -0
- package/dist/chunk-DDCIXXOO.js +9 -0
- package/dist/chunk-DDCIXXOO.js.map +1 -0
- package/dist/chunk-DDCYVIVV.cjs +44 -0
- package/dist/chunk-DDCYVIVV.cjs.map +1 -0
- package/dist/{chunk-UV3WP5WZ.js → chunk-DOKUXLFH.js} +61 -29
- package/dist/chunk-DOKUXLFH.js.map +1 -0
- package/dist/{chunk-XPCZADMT.cjs → chunk-DOVMTPKE.cjs} +89 -27
- package/dist/chunk-DOVMTPKE.cjs.map +1 -0
- package/dist/{chunk-5PNMDJ7J.js → chunk-DPNA466P.js} +14 -9
- package/dist/chunk-DPNA466P.js.map +1 -0
- package/dist/{chunk-BYPOGQWK.js → chunk-DRACN6XG.js} +6 -4
- package/dist/chunk-DRACN6XG.js.map +1 -0
- package/dist/{chunk-TGOMW4MB.cjs → chunk-E2Q7SP2K.cjs} +110 -109
- package/dist/chunk-E2Q7SP2K.cjs.map +1 -0
- package/dist/chunk-E6TXEISH.cjs +175 -0
- package/dist/chunk-E6TXEISH.cjs.map +1 -0
- package/dist/{chunk-3C2RYI6L.cjs → chunk-EOJFGECD.cjs} +11 -11
- package/dist/chunk-EOJFGECD.cjs.map +1 -0
- package/dist/{chunk-XWV4JT34.js → chunk-ERZ4QPQX.js} +27 -22
- package/dist/chunk-ERZ4QPQX.js.map +1 -0
- package/dist/{chunk-DFVLCOP6.js → chunk-EZH7FNUS.js} +3 -3
- package/dist/{chunk-DFVLCOP6.js.map → chunk-EZH7FNUS.js.map} +1 -1
- package/dist/{chunk-WWFHO375.cjs → chunk-FJMPR3OH.cjs} +4 -3
- package/dist/chunk-FJMPR3OH.cjs.map +1 -0
- package/dist/chunk-FMNUSGZ4.cjs +12 -0
- package/dist/chunk-FMNUSGZ4.cjs.map +1 -0
- package/dist/{chunk-EXU3RASM.js → chunk-G3CSQLLT.js} +20 -474
- package/dist/chunk-G3CSQLLT.js.map +1 -0
- package/dist/{chunk-EJYMTO3K.cjs → chunk-GKQU44SQ.cjs} +150 -118
- package/dist/chunk-GKQU44SQ.cjs.map +1 -0
- package/dist/chunk-GNPGGLAE.cjs +212 -0
- package/dist/chunk-GNPGGLAE.cjs.map +1 -0
- package/dist/{chunk-QARBLBXT.cjs → chunk-GUUWKPTK.cjs} +7 -7
- package/dist/{chunk-QARBLBXT.cjs.map → chunk-GUUWKPTK.cjs.map} +1 -1
- package/dist/chunk-GYA4JRP5.js +31 -0
- package/dist/chunk-GYA4JRP5.js.map +1 -0
- package/dist/{chunk-3GH67G4Z.cjs → chunk-HP6LWBLB.cjs} +16 -42
- package/dist/chunk-HP6LWBLB.cjs.map +1 -0
- package/dist/{chunk-NXQFATMF.cjs → chunk-HTQOBY75.cjs} +153 -123
- package/dist/chunk-HTQOBY75.cjs.map +1 -0
- package/dist/chunk-I6FX7AAG.js +39 -0
- package/dist/chunk-I6FX7AAG.js.map +1 -0
- package/dist/{chunk-VKGKDOKR.js → chunk-IFDXG2YJ.js} +1539 -206
- package/dist/chunk-IFDXG2YJ.js.map +1 -0
- package/dist/{chunk-IXGYRP2P.js → chunk-IFRPHG7O.js} +79 -49
- package/dist/chunk-IFRPHG7O.js.map +1 -0
- package/dist/chunk-IMQKXL4E.cjs +12 -0
- package/dist/{chunk-QSXTWU4U.cjs.map → chunk-IMQKXL4E.cjs.map} +1 -1
- package/dist/chunk-J6IJARLG.js +94 -0
- package/dist/chunk-J6IJARLG.js.map +1 -0
- package/dist/{chunk-3DS7Z4T4.cjs → chunk-JD2YC62H.cjs} +44 -43
- package/dist/chunk-JD2YC62H.cjs.map +1 -0
- package/dist/{chunk-W63OVYY4.js → chunk-K34OPSJK.js} +3 -3
- package/dist/{chunk-W63OVYY4.js.map → chunk-K34OPSJK.js.map} +1 -1
- package/dist/chunk-KAFXPB2L.js +184 -0
- package/dist/chunk-KAFXPB2L.js.map +1 -0
- package/dist/chunk-KIZSHRUI.cjs +49 -0
- package/dist/chunk-KIZSHRUI.cjs.map +1 -0
- package/dist/{chunk-K3Q3LJY3.js → chunk-KXFUQNF2.js} +201 -100
- package/dist/chunk-KXFUQNF2.js.map +1 -0
- package/dist/{chunk-UXLSNRYL.js → chunk-MTNEGGM2.js} +4 -4
- package/dist/chunk-MTNEGGM2.js.map +1 -0
- package/dist/{chunk-IP3CGGPA.cjs → chunk-N2V3HJFV.cjs} +92 -185
- package/dist/chunk-N2V3HJFV.cjs.map +1 -0
- package/dist/chunk-NAUA4PW5.cjs +28 -0
- package/dist/chunk-NAUA4PW5.cjs.map +1 -0
- package/dist/chunk-NMQ6C6TS.cjs +61 -0
- package/dist/chunk-NMQ6C6TS.cjs.map +1 -0
- package/dist/{chunk-2N6EOBTH.cjs → chunk-NPWACFQJ.cjs} +58 -53
- package/dist/chunk-NPWACFQJ.cjs.map +1 -0
- package/dist/{chunk-TKT2XHED.js → chunk-NQBYTLPW.js} +13 -12
- package/dist/chunk-NQBYTLPW.js.map +1 -0
- package/dist/{chunk-5KEQ74YU.cjs → chunk-NT6ILURI.cjs} +9 -86
- package/dist/chunk-NT6ILURI.cjs.map +1 -0
- package/dist/{chunk-3SLPDKHQ.js → chunk-PH4IJ3V5.js} +5 -77
- package/dist/chunk-PH4IJ3V5.js.map +1 -0
- package/dist/chunk-PWXGB77L.cjs +56 -0
- package/dist/chunk-PWXGB77L.cjs.map +1 -0
- package/dist/chunk-PZHC5GCD.js +193 -0
- package/dist/chunk-PZHC5GCD.js.map +1 -0
- package/dist/chunk-QMQLUA66.js +12 -0
- package/dist/chunk-QMQLUA66.js.map +1 -0
- package/dist/{chunk-5WWVZMVX.js → chunk-QZ7A6HBM.js} +2 -2
- package/dist/{chunk-5WWVZMVX.js.map → chunk-QZ7A6HBM.js.map} +1 -1
- package/dist/chunk-RW24SAHI.cjs +74 -0
- package/dist/chunk-RW24SAHI.cjs.map +1 -0
- package/dist/{chunk-BVRDGYXQ.cjs → chunk-SAFZ6JTI.cjs} +14 -9
- package/dist/chunk-SAFZ6JTI.cjs.map +1 -0
- package/dist/{chunk-L7HQ2OSI.js → chunk-SCTZRFW5.js} +87 -166
- package/dist/chunk-SCTZRFW5.js.map +1 -0
- package/dist/{chunk-5KPNWT6X.js → chunk-SDHV2MWU.js} +24 -45
- package/dist/chunk-SDHV2MWU.js.map +1 -0
- package/dist/{chunk-3RWZPJKV.js → chunk-SU7VQOJ3.js} +21 -78
- package/dist/chunk-SU7VQOJ3.js.map +1 -0
- package/dist/chunk-SVJ5GEXW.cjs +45 -0
- package/dist/chunk-SVJ5GEXW.cjs.map +1 -0
- package/dist/chunk-SVUKGWSN.cjs +102 -0
- package/dist/chunk-SVUKGWSN.cjs.map +1 -0
- package/dist/chunk-TAUGGLNQ.js +59 -0
- package/dist/chunk-TAUGGLNQ.js.map +1 -0
- package/dist/{chunk-A42GCBGX.cjs → chunk-TRF4EBJT.cjs} +6 -4
- package/dist/chunk-TRF4EBJT.cjs.map +1 -0
- package/dist/{chunk-KQJ54OG5.js → chunk-U4JDJKPD.js} +19 -56
- package/dist/chunk-U4JDJKPD.js.map +1 -0
- package/dist/chunk-UH2USOMG.cjs +627 -0
- package/dist/chunk-UH2USOMG.cjs.map +1 -0
- package/dist/{chunk-XGPUQ56G.js → chunk-UUIBACKJ.js} +15 -38
- package/dist/chunk-UUIBACKJ.js.map +1 -0
- package/dist/{chunk-5VQM6VWP.cjs → chunk-UWG5GX6E.cjs} +2 -2
- package/dist/{chunk-5VQM6VWP.cjs.map → chunk-UWG5GX6E.cjs.map} +1 -1
- package/dist/{chunk-K5UBVGJN.js → chunk-VDYA2HMS.js} +6 -6
- package/dist/{chunk-K5UBVGJN.js.map → chunk-VDYA2HMS.js.map} +1 -1
- package/dist/{chunk-NUIG3BCV.cjs → chunk-VXAFOF6Z.cjs} +93 -155
- package/dist/chunk-VXAFOF6Z.cjs.map +1 -0
- package/dist/chunk-X4PVHAZ6.cjs +83 -0
- package/dist/chunk-X4PVHAZ6.cjs.map +1 -0
- package/dist/{chunk-UYQMBBWJ.js → chunk-X6CNEA32.js} +23 -20
- package/dist/chunk-X6CNEA32.js.map +1 -0
- package/dist/chunk-X6RDQ5NB.cjs +335 -0
- package/dist/chunk-X6RDQ5NB.cjs.map +1 -0
- package/dist/{chunk-DEFQM7JU.cjs → chunk-XRU7V7FF.cjs} +7 -7
- package/dist/{chunk-DEFQM7JU.cjs.map → chunk-XRU7V7FF.cjs.map} +1 -1
- package/dist/{chunk-TPF25IG6.js → chunk-XZA3Y4YH.js} +3 -3
- package/dist/{chunk-TPF25IG6.js.map → chunk-XZA3Y4YH.js.map} +1 -1
- package/dist/{chunk-DIQ3AV5W.cjs → chunk-Y6UA55YS.cjs} +324 -224
- package/dist/chunk-Y6UA55YS.cjs.map +1 -0
- package/dist/chunk-Y7M44XEK.js +462 -0
- package/dist/chunk-Y7M44XEK.js.map +1 -0
- package/dist/{chunk-RRSNR3TP.js → chunk-YIRLBUNN.js} +3 -3
- package/dist/{chunk-RRSNR3TP.js.map → chunk-YIRLBUNN.js.map} +1 -1
- package/dist/chunk-YPUNPG2T.js +47 -0
- package/dist/chunk-YPUNPG2T.js.map +1 -0
- package/dist/{chunk-QERAIDRJ.js → chunk-Z2PPIVOO.js} +82 -22
- package/dist/chunk-Z2PPIVOO.js.map +1 -0
- package/dist/chunk-Z5QHVL5U.cjs +12 -0
- package/dist/chunk-Z5QHVL5U.cjs.map +1 -0
- package/dist/chunk-ZDH3DX3C.cjs +30 -0
- package/dist/chunk-ZDH3DX3C.cjs.map +1 -0
- package/dist/chunk-ZE6NVENI.js +77 -0
- package/dist/chunk-ZE6NVENI.js.map +1 -0
- package/dist/chunk-ZKZAIX42.cjs +479 -0
- package/dist/chunk-ZKZAIX42.cjs.map +1 -0
- package/dist/{chunk-TEDRJXOG.cjs → chunk-ZY4GXIVN.cjs} +5 -5
- package/dist/{chunk-TEDRJXOG.cjs.map → chunk-ZY4GXIVN.cjs.map} +1 -1
- package/dist/core/index.cjs +117 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +225 -0
- package/dist/core/index.d.ts +225 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/{ddl-CS0KUVwB.d.ts → ddl-Dx3Z0_WC.d.ts} +3 -3
- package/dist/{ddl-BD-ZfKeX.d.cts → ddl-J6sDyABg.d.cts} +3 -3
- package/dist/define-graph-CzEvA_8F.d.cts +174 -0
- package/dist/define-graph-DRo9xpYN.d.ts +174 -0
- package/dist/{extension-types-BM2ACfYO.d.cts → extension-types-BLEVH4SG.d.cts} +1 -1
- package/dist/{extension-types-BM2ACfYO.d.ts → extension-types-BLEVH4SG.d.ts} +1 -1
- package/dist/graph-extension/index.cjs +21 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +6 -4
- package/dist/graph-merge/index.cjs +267 -218
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +17 -93
- package/dist/graph-merge/index.d.ts +17 -93
- package/dist/graph-merge/index.js +143 -94
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-BeacbPoe.d.ts → index-BD_3TCgh.d.ts} +6 -4
- package/dist/{index-BPM59vsg.d.cts → index-BihFPsPu.d.cts} +6 -4
- package/dist/{fulltext-strategy-C27vXaeB.d.cts → index-Bq7vSPHy.d.ts} +3195 -2646
- package/dist/{fulltext-strategy-DebsMrqg.d.ts → index-CrFL_ENI.d.cts} +3195 -2646
- package/dist/index.cjs +326 -315
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -240
- package/dist/index.d.ts +59 -240
- package/dist/index.js +46 -79
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +26 -38
- package/dist/indexes/index.d.cts +6 -41
- package/dist/indexes/index.d.ts +6 -41
- package/dist/indexes/index.js +14 -10
- package/dist/interchange/index.cjs +48 -39
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +7 -8
- package/dist/interchange/index.d.ts +7 -8
- package/dist/interchange/index.js +23 -14
- package/dist/interchange/index.js.map +1 -1
- package/dist/local-options-CZ1BnIoF.d.cts +29 -0
- package/dist/local-options-CZ1BnIoF.d.ts +29 -0
- package/dist/{manager-D00_NXvT.d.ts → manager-CASfhmzV.d.ts} +4 -173
- package/dist/{manager-nU1vTJLy.d.cts → manager-nCEJiYBb.d.cts} +4 -173
- package/dist/{materialize-indexes-zK2J_flP.d.ts → materialize-indexes-D4iei4Kp.d.ts} +1 -1
- package/dist/{materialize-indexes-CuR3gAZb.d.cts → materialize-indexes-ExQ6OrAh.d.cts} +1 -1
- package/dist/{postgres-IaBA4RgE.d.ts → postgres-Cl1ZAN1G.d.ts} +1 -1
- package/dist/{postgres-YrYmPlaU.d.cts → postgres-DMgIKQU-.d.cts} +1 -1
- package/dist/postgres-execution-fKW0qRiN.d.cts +14 -0
- package/dist/postgres-execution-fKW0qRiN.d.ts +14 -0
- package/dist/profiler/index.cjs +9 -8
- package/dist/profiler/index.cjs.map +1 -1
- package/dist/profiler/index.d.cts +9 -17
- package/dist/profiler/index.d.ts +9 -17
- package/dist/profiler/index.js +8 -7
- package/dist/profiler/index.js.map +1 -1
- package/dist/provenance/index.cjs +61 -55
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -8
- package/dist/provenance/index.d.ts +7 -8
- package/dist/provenance/index.js +34 -28
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +46 -37
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +8 -10
- package/dist/schema/index.d.ts +8 -10
- package/dist/schema/index.js +22 -13
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-BUOHPx7p.d.ts → sqlite-BDkW39aa.d.cts} +1 -1
- package/dist/{sqlite-Pp8O19WE.d.cts → sqlite-CYfhvESj.d.ts} +1 -1
- package/dist/sqlite-execution-DwbE2a9y.d.cts +32 -0
- package/dist/sqlite-execution-DwbE2a9y.d.ts +32 -0
- package/dist/{store-view-X96Rd00T.d.cts → store-view-BJd6Vwpt.d.cts} +427 -1404
- package/dist/{store-view-ANL6mTph.d.ts → store-view-CLIhwMMX.d.ts} +427 -1404
- package/dist/temporal-BC_NQV5Y.d.cts +281 -0
- package/dist/temporal-DqtOEo_B.d.ts +281 -0
- package/dist/{types-r-Zyq2Hz.d.cts → types-COq3-vMC.d.cts} +2 -2
- package/dist/{types-wsvuBgPK.d.ts → types-CUevi_D1.d.ts} +2 -2
- package/dist/{where-CJOpJj3a.d.ts → where-BdE_cYtx.d.ts} +5 -5
- package/dist/{where-K3uBP33l.d.cts → where-C92TXCzT.d.cts} +5 -5
- package/package.json +37 -6
- package/dist/chunk-27SSDCEP.cjs.map +0 -1
- package/dist/chunk-2N6EOBTH.cjs.map +0 -1
- package/dist/chunk-3C2RYI6L.cjs.map +0 -1
- package/dist/chunk-3DS7Z4T4.cjs.map +0 -1
- package/dist/chunk-3GH67G4Z.cjs.map +0 -1
- package/dist/chunk-3RWZPJKV.js.map +0 -1
- package/dist/chunk-3SLPDKHQ.js.map +0 -1
- package/dist/chunk-3XXGYU62.cjs.map +0 -1
- package/dist/chunk-44TA22QT.js +0 -1478
- package/dist/chunk-44TA22QT.js.map +0 -1
- package/dist/chunk-5AVRFNP4.cjs.map +0 -1
- package/dist/chunk-5KEQ74YU.cjs.map +0 -1
- package/dist/chunk-5KPNWT6X.js.map +0 -1
- package/dist/chunk-5PNMDJ7J.js.map +0 -1
- package/dist/chunk-6EEO3OVU.cjs.map +0 -1
- package/dist/chunk-7YSP4V4R.cjs +0 -69
- package/dist/chunk-7YSP4V4R.cjs.map +0 -1
- package/dist/chunk-A42GCBGX.cjs.map +0 -1
- package/dist/chunk-BVRDGYXQ.cjs.map +0 -1
- package/dist/chunk-BYPOGQWK.js.map +0 -1
- package/dist/chunk-CUHM5CWJ.cjs +0 -12
- package/dist/chunk-CUHM5CWJ.cjs.map +0 -1
- package/dist/chunk-DIQ3AV5W.cjs.map +0 -1
- package/dist/chunk-EJYMTO3K.cjs.map +0 -1
- package/dist/chunk-EXU3RASM.js.map +0 -1
- package/dist/chunk-GA4TT3DH.js.map +0 -1
- package/dist/chunk-IP3CGGPA.cjs.map +0 -1
- package/dist/chunk-IPSVVTWT.cjs +0 -1540
- package/dist/chunk-IPSVVTWT.cjs.map +0 -1
- package/dist/chunk-IXGYRP2P.js.map +0 -1
- package/dist/chunk-K3Q3LJY3.js.map +0 -1
- package/dist/chunk-KQJ54OG5.js.map +0 -1
- package/dist/chunk-L7HQ2OSI.js.map +0 -1
- package/dist/chunk-M6VES7V6.js +0 -239
- package/dist/chunk-M6VES7V6.js.map +0 -1
- package/dist/chunk-NUIG3BCV.cjs.map +0 -1
- package/dist/chunk-NXQFATMF.cjs.map +0 -1
- package/dist/chunk-OHMP6N2J.js +0 -47
- package/dist/chunk-OHMP6N2J.js.map +0 -1
- package/dist/chunk-QERAIDRJ.js.map +0 -1
- package/dist/chunk-QSXTWU4U.cjs +0 -12
- package/dist/chunk-RCVLFTCT.js.map +0 -1
- package/dist/chunk-TGOMW4MB.cjs.map +0 -1
- package/dist/chunk-TKT2XHED.js.map +0 -1
- package/dist/chunk-UGZUAYAR.js.map +0 -1
- package/dist/chunk-UV3WP5WZ.js.map +0 -1
- package/dist/chunk-UXLSNRYL.js.map +0 -1
- package/dist/chunk-UYQMBBWJ.js.map +0 -1
- package/dist/chunk-VKGKDOKR.js.map +0 -1
- package/dist/chunk-VL2V6PEN.cjs +0 -261
- package/dist/chunk-VL2V6PEN.cjs.map +0 -1
- package/dist/chunk-WOJMKB3N.cjs.map +0 -1
- package/dist/chunk-WWFHO375.cjs.map +0 -1
- package/dist/chunk-XGPUQ56G.js.map +0 -1
- package/dist/chunk-XGU7DZDA.cjs +0 -1095
- package/dist/chunk-XGU7DZDA.cjs.map +0 -1
- package/dist/chunk-XPCZADMT.cjs.map +0 -1
- package/dist/chunk-XWV4JT34.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/ontology/constants.ts
|
|
4
|
+
var META_EDGE_SUB_CLASS_OF = "subClassOf";
|
|
5
|
+
var META_EDGE_BROADER = "broader";
|
|
6
|
+
var META_EDGE_NARROWER = "narrower";
|
|
7
|
+
var META_EDGE_RELATED_TO = "relatedTo";
|
|
8
|
+
var META_EDGE_EQUIVALENT_TO = "equivalentTo";
|
|
9
|
+
var META_EDGE_SAME_AS = "sameAs";
|
|
10
|
+
var META_EDGE_DIFFERENT_FROM = "differentFrom";
|
|
11
|
+
var META_EDGE_DISJOINT_WITH = "disjointWith";
|
|
12
|
+
var META_EDGE_PART_OF = "partOf";
|
|
13
|
+
var META_EDGE_HAS_PART = "hasPart";
|
|
14
|
+
var META_EDGE_INVERSE_OF = "inverseOf";
|
|
15
|
+
var META_EDGE_IMPLIES = "implies";
|
|
16
|
+
var ALL_META_EDGE_NAMES = [
|
|
17
|
+
META_EDGE_SUB_CLASS_OF,
|
|
18
|
+
META_EDGE_BROADER,
|
|
19
|
+
META_EDGE_NARROWER,
|
|
20
|
+
META_EDGE_RELATED_TO,
|
|
21
|
+
META_EDGE_EQUIVALENT_TO,
|
|
22
|
+
META_EDGE_SAME_AS,
|
|
23
|
+
META_EDGE_DIFFERENT_FROM,
|
|
24
|
+
META_EDGE_DISJOINT_WITH,
|
|
25
|
+
META_EDGE_PART_OF,
|
|
26
|
+
META_EDGE_HAS_PART,
|
|
27
|
+
META_EDGE_INVERSE_OF,
|
|
28
|
+
META_EDGE_IMPLIES
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
exports.ALL_META_EDGE_NAMES = ALL_META_EDGE_NAMES;
|
|
32
|
+
exports.META_EDGE_BROADER = META_EDGE_BROADER;
|
|
33
|
+
exports.META_EDGE_DIFFERENT_FROM = META_EDGE_DIFFERENT_FROM;
|
|
34
|
+
exports.META_EDGE_DISJOINT_WITH = META_EDGE_DISJOINT_WITH;
|
|
35
|
+
exports.META_EDGE_EQUIVALENT_TO = META_EDGE_EQUIVALENT_TO;
|
|
36
|
+
exports.META_EDGE_HAS_PART = META_EDGE_HAS_PART;
|
|
37
|
+
exports.META_EDGE_IMPLIES = META_EDGE_IMPLIES;
|
|
38
|
+
exports.META_EDGE_INVERSE_OF = META_EDGE_INVERSE_OF;
|
|
39
|
+
exports.META_EDGE_NARROWER = META_EDGE_NARROWER;
|
|
40
|
+
exports.META_EDGE_PART_OF = META_EDGE_PART_OF;
|
|
41
|
+
exports.META_EDGE_RELATED_TO = META_EDGE_RELATED_TO;
|
|
42
|
+
exports.META_EDGE_SAME_AS = META_EDGE_SAME_AS;
|
|
43
|
+
exports.META_EDGE_SUB_CLASS_OF = META_EDGE_SUB_CLASS_OF;
|
|
44
|
+
//# sourceMappingURL=chunk-SVJ5GEXW.cjs.map
|
|
45
|
+
//# sourceMappingURL=chunk-SVJ5GEXW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ontology/constants.ts"],"names":[],"mappings":";;;AAYO,IAAM,sBAAA,GAAyB;AAG/B,IAAM,iBAAA,GAAoB;AAG1B,IAAM,kBAAA,GAAqB;AAG3B,IAAM,oBAAA,GAAuB;AAG7B,IAAM,uBAAA,GAA0B;AAGhC,IAAM,iBAAA,GAAoB;AAG1B,IAAM,wBAAA,GAA2B;AAGjC,IAAM,uBAAA,GAA0B;AAGhC,IAAM,iBAAA,GAAoB;AAG1B,IAAM,kBAAA,GAAqB;AAG3B,IAAM,oBAAA,GAAuB;AAG7B,IAAM,iBAAA,GAAoB;AAM1B,IAAM,mBAAA,GAAsB;AAAA,EACjC,sBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,oBAAA;AAAA,EACA,uBAAA;AAAA,EACA,iBAAA;AAAA,EACA,wBAAA;AAAA,EACA,uBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF","file":"chunk-SVJ5GEXW.cjs","sourcesContent":["/**\n * Named constants for ontology meta-edge names.\n *\n * Use these constants instead of string literals for type safety\n * and IDE support.\n */\n\n// ============================================================\n// Meta-Edge Names\n// ============================================================\n\n/** Type inheritance (Podcast subClassOf Media) */\nexport const META_EDGE_SUB_CLASS_OF = \"subClassOf\" as const;\n\n/** Broader concept (ML broader AI) */\nexport const META_EDGE_BROADER = \"broader\" as const;\n\n/** Narrower concept (AI narrower ML) */\nexport const META_EDGE_NARROWER = \"narrower\" as const;\n\n/** Non-hierarchical association */\nexport const META_EDGE_RELATED_TO = \"relatedTo\" as const;\n\n/** Same class, different representation */\nexport const META_EDGE_EQUIVALENT_TO = \"equivalentTo\" as const;\n\n/** Same individual (for deduplication) */\nexport const META_EDGE_SAME_AS = \"sameAs\" as const;\n\n/** Explicitly different individuals */\nexport const META_EDGE_DIFFERENT_FROM = \"differentFrom\" as const;\n\n/** Mutually exclusive types */\nexport const META_EDGE_DISJOINT_WITH = \"disjointWith\" as const;\n\n/** X is part of Y */\nexport const META_EDGE_PART_OF = \"partOf\" as const;\n\n/** Y has part X */\nexport const META_EDGE_HAS_PART = \"hasPart\" as const;\n\n/** Edge A is inverse of edge B */\nexport const META_EDGE_INVERSE_OF = \"inverseOf\" as const;\n\n/** Edge A implies edge B exists */\nexport const META_EDGE_IMPLIES = \"implies\" as const;\n\n// ============================================================\n// All Meta-Edge Names (for validation)\n// ============================================================\n\nexport const ALL_META_EDGE_NAMES = [\n META_EDGE_SUB_CLASS_OF,\n META_EDGE_BROADER,\n META_EDGE_NARROWER,\n META_EDGE_RELATED_TO,\n META_EDGE_EQUIVALENT_TO,\n META_EDGE_SAME_AS,\n META_EDGE_DIFFERENT_FROM,\n META_EDGE_DISJOINT_WITH,\n META_EDGE_PART_OF,\n META_EDGE_HAS_PART,\n META_EDGE_INVERSE_OF,\n META_EDGE_IMPLIES,\n] as const;\n\nexport type MetaEdgeName = (typeof ALL_META_EDGE_NAMES)[number];\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkDDCYVIVV_cjs = require('./chunk-DDCYVIVV.cjs');
|
|
4
|
+
var chunkSAFZ6JTI_cjs = require('./chunk-SAFZ6JTI.cjs');
|
|
5
|
+
|
|
6
|
+
// src/core/temporal.ts
|
|
7
|
+
var RECORDED_MAX = "9999-12-31T23:59:59.999Z";
|
|
8
|
+
function assertValidRecordedInstant(value, path) {
|
|
9
|
+
chunkDDCYVIVV_cjs.validateCanonicalIsoDate(value, path);
|
|
10
|
+
if (value >= RECORDED_MAX) {
|
|
11
|
+
throw new chunkSAFZ6JTI_cjs.ValidationError(
|
|
12
|
+
`${path} must be before the recorded-time open sentinel ${RECORDED_MAX}.`,
|
|
13
|
+
{
|
|
14
|
+
issues: [
|
|
15
|
+
{
|
|
16
|
+
path,
|
|
17
|
+
message: `Expected a timestamp before ${RECORDED_MAX}, got "${value}"`
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
suggestion: "Use a real recorded-time commit instant, not the open-interval sentinel."
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function asRecordedInstant(value) {
|
|
28
|
+
assertValidRecordedInstant(value, "asRecordedInstant");
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
function resolveReadCoordinate(mode, asOf, suggestion) {
|
|
32
|
+
if (mode !== "asOf" && asOf !== void 0) {
|
|
33
|
+
throw new chunkSAFZ6JTI_cjs.ValidationError(
|
|
34
|
+
`Temporal mode "${mode}" does not take an asOf timestamp.`,
|
|
35
|
+
{
|
|
36
|
+
issues: [
|
|
37
|
+
{
|
|
38
|
+
path: "asOf",
|
|
39
|
+
message: `asOf is only valid with mode "asOf", not "${mode}"`
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
suggestion: 'Pin an instant with store.asOf(timestamp) or store.view({ mode: "asOf", asOf }); drop asOf for other modes.'
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
assertValidAsOf(
|
|
49
|
+
mode,
|
|
50
|
+
asOf,
|
|
51
|
+
suggestion === void 0 ? void 0 : { suggestion }
|
|
52
|
+
);
|
|
53
|
+
return { valid: asOf === void 0 ? { mode } : { mode, asOf } };
|
|
54
|
+
}
|
|
55
|
+
function withRecordedCoordinate(coordinate, recordedAsOf) {
|
|
56
|
+
assertValidRecordedInstant(recordedAsOf, "asOfRecorded");
|
|
57
|
+
return {
|
|
58
|
+
...coordinate,
|
|
59
|
+
recorded: { asOf: recordedAsOf }
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function assertValidAsOf(mode, asOf, options) {
|
|
63
|
+
if (mode === "asOf" && asOf === void 0) {
|
|
64
|
+
throw new chunkSAFZ6JTI_cjs.ValidationError(
|
|
65
|
+
'Temporal mode "asOf" requires a timestamp',
|
|
66
|
+
{
|
|
67
|
+
issues: [
|
|
68
|
+
{ path: "asOf", message: "Timestamp is required for asOf mode" }
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
suggestion: options?.suggestion ?? 'Provide an ISO-8601 timestamp for asOf mode, e.g. "2026-01-01T00:00:00.000Z".'
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (asOf !== void 0) {
|
|
77
|
+
chunkDDCYVIVV_cjs.validateCanonicalIsoDate(asOf, "asOf");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function describeCoordinate(coordinate) {
|
|
81
|
+
const { mode, asOf } = coordinate.valid;
|
|
82
|
+
const valid = asOf === void 0 ? `mode "${mode}"` : `mode "${mode}" asOf ${asOf}`;
|
|
83
|
+
return coordinate.recorded === void 0 ? valid : `${valid}, recorded asOf ${coordinate.recorded.asOf}`;
|
|
84
|
+
}
|
|
85
|
+
function coordinateContext(coordinate) {
|
|
86
|
+
const { mode, asOf } = coordinate.valid;
|
|
87
|
+
return {
|
|
88
|
+
temporalMode: mode,
|
|
89
|
+
...asOf !== void 0 && { asOf },
|
|
90
|
+
...coordinate.recorded === void 0 ? {} : { recordedAsOf: coordinate.recorded.asOf }
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
exports.RECORDED_MAX = RECORDED_MAX;
|
|
95
|
+
exports.asRecordedInstant = asRecordedInstant;
|
|
96
|
+
exports.assertValidRecordedInstant = assertValidRecordedInstant;
|
|
97
|
+
exports.coordinateContext = coordinateContext;
|
|
98
|
+
exports.describeCoordinate = describeCoordinate;
|
|
99
|
+
exports.resolveReadCoordinate = resolveReadCoordinate;
|
|
100
|
+
exports.withRecordedCoordinate = withRecordedCoordinate;
|
|
101
|
+
//# sourceMappingURL=chunk-SVUKGWSN.cjs.map
|
|
102
|
+
//# sourceMappingURL=chunk-SVUKGWSN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources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W,KAAA;AAClC,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,IAAA;AAAA,IACd,GAAI,IAAA,KAAS,MAAA,IAAa,EAAE,IAAA,EAAK;AAAA,IACjC,GAAI,UAAA,CAAW,QAAA,KAAa,MAAA,GAC1B,KACA,EAAE,YAAA,EAAc,UAAA,CAAW,QAAA,CAAS,IAAA;AAAK,GAC7C;AACF","file":"chunk-SVUKGWSN.cjs","sourcesContent":["/**\n * Shared temporal coordinate + validation.\n */\nimport { ValidationError } from \"../errors\";\nimport { validateCanonicalIsoDate } from \"../utils/date\";\nimport { type TemporalMode } from \"./types\";\n\n/**\n * Open-ended recorded-time sentinel. Chosen so SQLite text ordering and\n * PostgreSQL `timestamptz` ordering both put every real commit instant before\n * the open interval end.\n */\nexport const RECORDED_MAX = \"9999-12-31T23:59:59.999Z\";\n\ndeclare const RECORDED_INSTANT_BRAND: unique symbol;\n\n/**\n * A canonical UTC ISO-8601 recorded-time instant (`YYYY-MM-DDTHH:mm:ss.sssZ`),\n * nominally branded so it can only originate from a recorded-time source —\n * {@link Store.recordedNow} or an explicit {@link asRecordedInstant} — never an\n * ad-hoc wall-clock string.\n *\n * The recorded commit clock is a logical, monotonic per-graph instant that can\n * run briefly ahead of wall time under bursty same-millisecond writes, so a raw\n * `new Date().toISOString()` may sort *before* the most recent commits and\n * silently omit them. The brand turns that footgun into a compile error:\n * `store.asOfRecorded` accepts only a `RecordedInstant`, so a bare wall-clock\n * string no longer type-checks — callers reach for `await store.recordedNow()`\n * (the monotonic high-water mark) or {@link asRecordedInstant} instead.\n */\nexport type RecordedInstant = string & {\n readonly [RECORDED_INSTANT_BRAND]: \"RecordedInstant\";\n};\n\nexport function assertValidRecordedInstant(value: string, path: string): void {\n validateCanonicalIsoDate(value, path);\n if (value >= RECORDED_MAX) {\n throw new ValidationError(\n `${path} must be before the recorded-time open sentinel ${RECORDED_MAX}.`,\n {\n issues: [\n {\n path,\n message: `Expected a timestamp before ${RECORDED_MAX}, got \"${value}\"`,\n },\n ],\n },\n {\n suggestion:\n \"Use a real recorded-time commit instant, not the open-interval sentinel.\",\n },\n );\n }\n}\n\n/**\n * Brands a canonical UTC ISO-8601 string as a {@link RecordedInstant}.\n *\n * The escape hatch for an instant that round-trips through untyped storage:\n * captured from {@link Store.recordedNow}, persisted as a plain string, read\n * back, and replayed into `asOfRecorded`. Validates the canonical form eagerly —\n * the same check `asOfRecorded` applies — so a malformed value fails here, at the\n * brand site, rather than deeper in a read. Does *not* assert the instant is a\n * real captured commit; it only guarantees the value is well-formed enough to\n * compare correctly against the recorded relations.\n *\n * @throws {ValidationError} when `value` is not a canonical UTC ISO-8601 string.\n */\nexport function asRecordedInstant(value: string): RecordedInstant {\n assertValidRecordedInstant(value, \"asRecordedInstant\");\n return value as RecordedInstant;\n}\n\n/**\n * The single opaque temporal coordinate every pinned read is resolved\n * against. It carries the valid-time axis plus an optional recorded/system-time\n * axis, so every surface can inject one coordinate object instead of threading\n * each temporal dimension separately.\n */\nexport type ReadCoordinate = Readonly<{\n /**\n * The valid-time axis: a resolved temporal mode and (only for `\"asOf\"`) the\n * instant it is pinned to.\n */\n valid: Readonly<{\n mode: TemporalMode;\n /** Defined only when `mode` is `\"asOf\"`. */\n asOf?: string;\n }>;\n /** The recorded/system-time axis. Defined only for recorded-pinned views. */\n recorded?: Readonly<{ asOf: RecordedInstant }>;\n}>;\n\n/**\n * Resolves and validates a `(mode, asOf)` pair into a {@link ReadCoordinate}.\n * Rejects an `asOf` paired with any non-`\"asOf\"` mode rather than silently\n * dropping it — pinning an instant is only meaningful in `\"asOf\"` mode, so a\n * `view({ mode: \"current\", asOf })` is a caller mistake, not a coordinate to\n * quietly discard. Then validates via {@link assertValidAsOf}.\n *\n * @param mode - The temporal mode to pin.\n * @param asOf - The supplied timestamp. Required for `\"asOf\"`; rejected for\n * every other mode.\n * @param suggestion - Caller-specific remediation hint for the\n * missing/invalid-timestamp case.\n */\nexport function resolveReadCoordinate(\n mode: TemporalMode,\n asOf: string | undefined,\n suggestion?: string,\n): ReadCoordinate {\n if (mode !== \"asOf\" && asOf !== undefined) {\n throw new ValidationError(\n `Temporal mode \"${mode}\" does not take an asOf timestamp.`,\n {\n issues: [\n {\n path: \"asOf\",\n message: `asOf is only valid with mode \"asOf\", not \"${mode}\"`,\n },\n ],\n },\n {\n suggestion:\n 'Pin an instant with store.asOf(timestamp) or store.view({ mode: \"asOf\", asOf }); drop asOf for other modes.',\n },\n );\n }\n assertValidAsOf(\n mode,\n asOf,\n suggestion === undefined ? undefined : { suggestion },\n );\n return { valid: asOf === undefined ? { mode } : { mode, asOf } };\n}\n\n/**\n * Adds a recorded/system-time pin to an existing valid-time coordinate.\n * Direct `store.asOfRecorded(T)` passes the diagonal valid-time coordinate\n * (`mode: \"asOf\", asOf: T`); `store.asOf(vt).asOfRecorded(rt)` passes the\n * already-resolved valid coordinate and adds the recorded sibling.\n */\nexport function withRecordedCoordinate(\n coordinate: ReadCoordinate,\n recordedAsOf: RecordedInstant,\n): ReadCoordinate {\n assertValidRecordedInstant(recordedAsOf, \"asOfRecorded\");\n return {\n ...coordinate,\n recorded: { asOf: recordedAsOf },\n };\n}\n\n/**\n * Validates the `asOf` coordinate of a temporal read: `\"asOf\"` mode\n * requires a timestamp, and any supplied timestamp must be a canonical\n * fixed-width UTC ISO-8601 string (`YYYY-MM-DDTHH:mm:ss.sssZ`). The latter\n * is load-bearing — temporal filters compare `asOf` against `valid_from` /\n * `valid_to` as text on SQLite, so a non-canonical value (date-only, an\n * offset, natural language, or variable-width / missing milliseconds like\n * `.1Z`) would sort and compare wrong rather than error. Reached only through\n * {@link resolveReadCoordinate}, which every temporal read entry point routes\n * through (direct reads, queries, subgraphs, algorithms, and StoreView), so\n * they all fail identically.\n *\n * @param mode - The resolved temporal mode.\n * @param asOf - The supplied timestamp (may be `undefined`).\n * @param options.suggestion - A caller-specific remediation hint for the\n * missing-timestamp case.\n *\n * @throws {ValidationError} when `mode` is `\"asOf\"` and `asOf` is missing, or\n * when any supplied `asOf` is not a canonical UTC ISO-8601 timestamp. The\n * canonical check runs for *every* mode that consumes `asOf`, so a\n * non-canonical value can never reach a text comparison.\n */\nfunction assertValidAsOf(\n mode: TemporalMode,\n asOf: string | undefined,\n options?: Readonly<{ suggestion?: string }>,\n): void {\n if (mode === \"asOf\" && asOf === undefined) {\n throw new ValidationError(\n 'Temporal mode \"asOf\" requires a timestamp',\n {\n issues: [\n { path: \"asOf\", message: \"Timestamp is required for asOf mode\" },\n ],\n },\n {\n suggestion:\n options?.suggestion ??\n 'Provide an ISO-8601 timestamp for asOf mode, e.g. \"2026-01-01T00:00:00.000Z\".',\n },\n );\n }\n if (asOf !== undefined) {\n validateCanonicalIsoDate(asOf, \"asOf\");\n }\n}\n\n/**\n * A human-readable description of a coordinate for error messages, e.g.\n * `mode \"current\"` or `mode \"asOf\" asOf 2026-01-01T00:00:00.000Z`. Shared by\n * every refusal path (the `StoreView` read-only / current-only / search facades\n * and the sealed-query builder) so they describe a coordinate identically — and\n * a future axis (recorded time) is reflected everywhere from one place.\n */\nexport function describeCoordinate(coordinate: ReadCoordinate): string {\n const { mode, asOf } = coordinate.valid;\n const valid =\n asOf === undefined ? `mode \"${mode}\"` : `mode \"${mode}\" asOf ${asOf}`;\n return coordinate.recorded === undefined ?\n valid\n : `${valid}, recorded asOf ${coordinate.recorded.asOf}`;\n}\n\n/**\n * The structured error-context fields describing a coordinate, shared by the\n * same refusal paths as {@link describeCoordinate}.\n */\nexport function coordinateContext(\n coordinate: ReadCoordinate,\n): Record<string, unknown> {\n const { mode, asOf } = coordinate.valid;\n return {\n temporalMode: mode,\n ...(asOf !== undefined && { asOf }),\n ...(coordinate.recorded === undefined ?\n {}\n : { recordedAsOf: coordinate.recorded.asOf }),\n };\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isPlainObject } from './chunk-ITE4IXAK.js';
|
|
2
|
+
import { ConfigurationError } from './chunk-DPNA466P.js';
|
|
3
|
+
|
|
4
|
+
// src/core/json-value.ts
|
|
5
|
+
function assertJsonValue(value, rootLabel, ownerKind) {
|
|
6
|
+
walk(value, rootLabel, ownerKind);
|
|
7
|
+
}
|
|
8
|
+
function walk(value, path, ownerKind) {
|
|
9
|
+
if (value === null) return;
|
|
10
|
+
const valueType = typeof value;
|
|
11
|
+
if (valueType === "number") {
|
|
12
|
+
if (!Number.isFinite(value)) {
|
|
13
|
+
throwInvalid(path, describeNonFinite(value), ownerKind);
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (valueType === "string" || valueType === "boolean") return;
|
|
18
|
+
if (valueType === "bigint" || valueType === "function" || valueType === "symbol" || valueType === "undefined") {
|
|
19
|
+
throwInvalid(path, valueType, ownerKind);
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
for (const [index, element] of value.entries()) {
|
|
23
|
+
walk(element, `${path}[${index}]`, ownerKind);
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!isPlainObject(value)) {
|
|
28
|
+
throwInvalid(path, describeNonPlain(value), ownerKind);
|
|
29
|
+
}
|
|
30
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
31
|
+
walk(nested, `${path}.${key}`, ownerKind);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function describeNonFinite(value) {
|
|
35
|
+
if (Number.isNaN(value)) return "NaN";
|
|
36
|
+
if (value === Number.POSITIVE_INFINITY) return "Infinity";
|
|
37
|
+
if (value === Number.NEGATIVE_INFINITY) return "-Infinity";
|
|
38
|
+
return "non-finite number";
|
|
39
|
+
}
|
|
40
|
+
function describeNonPlain(value) {
|
|
41
|
+
const constructorName = value?.constructor?.name;
|
|
42
|
+
if (typeof constructorName === "string" && constructorName.length > 0) {
|
|
43
|
+
return `${constructorName} instance`;
|
|
44
|
+
}
|
|
45
|
+
return "non-plain object";
|
|
46
|
+
}
|
|
47
|
+
function throwInvalid(path, kind, ownerKind) {
|
|
48
|
+
throw new ConfigurationError(
|
|
49
|
+
`${ownerKind} ${path} contains a non-JSON value (${kind}). Annotations must be JSON-serializable.`,
|
|
50
|
+
{ path, valueKind: kind },
|
|
51
|
+
{
|
|
52
|
+
suggestion: "Use only strings, numbers, booleans, null, arrays, and plain objects in annotations."
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { assertJsonValue };
|
|
58
|
+
//# sourceMappingURL=chunk-TAUGGLNQ.js.map
|
|
59
|
+
//# sourceMappingURL=chunk-TAUGGLNQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/json-value.ts"],"names":[],"mappings":";;;;AAyBO,SAAS,eAAA,CACd,KAAA,EACA,SAAA,EACA,SAAA,EACM;AACN,EAAA,IAAA,CAAK,KAAA,EAAO,WAAW,SAAS,CAAA;AAClC;AAEA,SAAS,IAAA,CAAK,KAAA,EAAgB,IAAA,EAAc,SAAA,EAAyB;AACnE,EAAA,IAAI,UAAU,IAAA,EAAM;AACpB,EAAA,MAAM,YAAY,OAAO,KAAA;AACzB,EAAA,IAAI,cAAc,QAAA,EAAU;AAI1B,IAAA,IAAI,CAAC,MAAA,CAAO,QAAA,CAAS,KAAK,CAAA,EAAG;AAC3B,MAAA,YAAA,CAAa,IAAA,EAAM,iBAAA,CAAkB,KAAe,CAAA,EAAG,SAAS,CAAA;AAAA,IAClE;AACA,IAAA;AAAA,EACF;AACA,EAAA,IAAI,SAAA,KAAc,QAAA,IAAY,SAAA,KAAc,SAAA,EAAW;AACvD,EAAA,IACE,cAAc,QAAA,IACd,SAAA,KAAc,cACd,SAAA,KAAc,QAAA,IACd,cAAc,WAAA,EACd;AACA,IAAA,YAAA,CAAa,IAAA,EAAM,WAAW,SAAS,CAAA;AAAA,EACzC;AACA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,KAAA,MAAW,CAAC,KAAA,EAAO,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AAA;AAAA,IACvD,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAK;AAAA,IACxB;AAAA,MACE,UAAA,EACE;AAAA;AACJ,GACF;AACF","file":"chunk-TAUGGLNQ.js","sourcesContent":["/**\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,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunk764JHTLT_cjs = require('./chunk-764JHTLT.cjs');
|
|
4
|
+
|
|
3
5
|
// src/utils/compare.ts
|
|
4
6
|
function compareStrings(left, right) {
|
|
5
7
|
if (left < right) return -1;
|
|
@@ -10,8 +12,8 @@ function compareCodePoints(left, right) {
|
|
|
10
12
|
let leftIndex = 0;
|
|
11
13
|
let rightIndex = 0;
|
|
12
14
|
while (leftIndex < left.length && rightIndex < right.length) {
|
|
13
|
-
const leftPoint = left.codePointAt(leftIndex);
|
|
14
|
-
const rightPoint = right.codePointAt(rightIndex);
|
|
15
|
+
const leftPoint = chunk764JHTLT_cjs.requireDefined(left.codePointAt(leftIndex));
|
|
16
|
+
const rightPoint = chunk764JHTLT_cjs.requireDefined(right.codePointAt(rightIndex));
|
|
15
17
|
if (leftPoint !== rightPoint) return leftPoint < rightPoint ? -1 : 1;
|
|
16
18
|
leftIndex += leftPoint > 65535 ? 2 : 1;
|
|
17
19
|
rightIndex += rightPoint > 65535 ? 2 : 1;
|
|
@@ -24,5 +26,5 @@ function compareCodePoints(left, right) {
|
|
|
24
26
|
|
|
25
27
|
exports.compareCodePoints = compareCodePoints;
|
|
26
28
|
exports.compareStrings = compareStrings;
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-TRF4EBJT.cjs.map
|
|
30
|
+
//# sourceMappingURL=chunk-TRF4EBJT.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/compare.ts"],"names":["requireDefined"],"mappings":";;;;;AAgBO,SAAS,cAAA,CAAe,MAAc,KAAA,EAAuB;AAClE,EAAA,IAAI,IAAA,GAAO,OAAO,OAAO,EAAA;AACzB,EAAA,OAAO,IAAA,GAAO,QAAQ,CAAA,GAAI,CAAA;AAC5B;AAiBO,SAAS,iBAAA,CAAkB,MAAc,KAAA,EAAuB;AACrE,EAAA,IAAI,IAAA,KAAS,OAAO,OAAO,CAAA;AAG3B,EAAA,IAAI,SAAA,GAAY,CAAA;AAChB,EAAA,IAAI,UAAA,GAAa,CAAA;AACjB,EAAA,OAAO,SAAA,GAAY,IAAA,CAAK,MAAA,IAAU,UAAA,GAAa,MAAM,MAAA,EAAQ;AAC3D,IAAA,MAAM,SAAA,GAAYA,gCAAA,CAAe,IAAA,CAAK,WAAA,CAAY,SAAS,CAAC,CAAA;AAC5D,IAAA,MAAM,UAAA,GAAaA,gCAAA,CAAe,KAAA,CAAM,WAAA,CAAY,UAAU,CAAC,CAAA;AAC/D,IAAA,IAAI,SAAA,KAAc,UAAA,EAAY,OAAO,SAAA,GAAY,aAAa,EAAA,GAAK,CAAA;AACnE,IAAA,SAAA,IAAa,SAAA,GAAY,QAAU,CAAA,GAAI,CAAA;AACvC,IAAA,UAAA,IAAc,UAAA,GAAa,QAAU,CAAA,GAAI,CAAA;AAAA,EAC3C;AACA,EAAA,MAAM,aAAA,GAAgB,aAAa,IAAA,CAAK,MAAA;AACxC,EAAA,MAAM,cAAA,GAAiB,cAAc,KAAA,CAAM,MAAA;AAC3C,EAAA,IAAI,aAAA,IAAiB,gBAAgB,OAAO,CAAA;AAC5C,EAAA,OAAO,gBAAgB,EAAA,GAAK,CAAA;AAC9B","file":"chunk-TRF4EBJT.cjs","sourcesContent":["import { requireDefined } from \"./presence\";\n/**\n * Deterministic UTF-16 code-unit string comparison.\n *\n * `localeCompare` (and any `Intl`-backed collation) varies with the host's\n * ICU configuration, so two processes can order the same strings differently\n * — which turns \"sorted\" lock-acquisition sequences into cross-process\n * deadlocks and makes result/report ordering flap between environments.\n * Code-unit order is identical everywhere, matches SQLite's BINARY collation\n * for ASCII identifiers, and sorts NUL below every other character, so\n * NUL-separated composite keys compare as true tuples.\n *\n * Use this (or `Array.prototype.toSorted()` with no comparator, which is the\n * same order) for every internal ordering; locale-aware collation belongs\n * only in user-facing presentation code, which this library does not have.\n */\nexport function compareStrings(left: string, right: string): number {\n if (left < right) return -1;\n return left > right ? 1 : 0;\n}\n\n/**\n * Deterministic code-point string comparison — the order a SQL engine uses.\n *\n * {@link compareStrings} compares UTF-16 code *units*, which disagrees with\n * SQL byte order for astral characters: `\"\\u{10000}\"` is stored as the\n * surrogate pair `𐀀`, so code-unit order sorts it below `\"\"`\n * even though its code point (and its UTF-8 encoding) is far above. SQLite's\n * `BINARY` collation, Postgres's `C` collation, and UTF-8 byte order all agree\n * with code-point order.\n *\n * Use this wherever a JS-side ordering must reproduce an ORDER BY the database\n * could equally have performed — notably the hybrid-search fusion fallback,\n * whose ranks and page boundary must match the single-statement SQL path row\n * for row. Everywhere else {@link compareStrings} is cheaper and sufficient.\n */\nexport function compareCodePoints(left: string, right: string): number {\n if (left === right) return 0;\n // Walks by code point, stepping over the low surrogate of an astral pair.\n // `codePointAt` at a valid index always yields a number.\n let leftIndex = 0;\n let rightIndex = 0;\n while (leftIndex < left.length && rightIndex < right.length) {\n const leftPoint = requireDefined(left.codePointAt(leftIndex));\n const rightPoint = requireDefined(right.codePointAt(rightIndex));\n if (leftPoint !== rightPoint) return leftPoint < rightPoint ? -1 : 1;\n leftIndex += leftPoint > 0xff_ff ? 2 : 1;\n rightIndex += rightPoint > 0xff_ff ? 2 : 1;\n }\n const leftExhausted = leftIndex >= left.length;\n const rightExhausted = rightIndex >= right.length;\n if (leftExhausted && rightExhausted) return 0;\n return leftExhausted ? -1 : 1;\n}\n"]}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { compileNodeIndexKeys, compileEdgeIndexKeys, compileIndexWhere, getDialect } from './chunk-
|
|
2
|
-
import { sql } from '
|
|
3
|
-
import {
|
|
1
|
+
import { compileNodeIndexKeys, compileEdgeIndexKeys, compileIndexWhere, getDialect } from './chunk-G3CSQLLT.js';
|
|
2
|
+
import { sql, renderSqlInline } from './chunk-6XDBRDZE.js';
|
|
3
|
+
import { requireDefined } from './chunk-QMQLUA66.js';
|
|
4
4
|
|
|
5
|
+
// src/indexes/ddl.ts
|
|
6
|
+
var INDEX_DDL_BEHAVIOR = {
|
|
7
|
+
postgres: { concurrentBuilds: true, supportsGinFamily: true },
|
|
8
|
+
sqlite: { concurrentBuilds: false, supportsGinFamily: false }
|
|
9
|
+
};
|
|
5
10
|
function generateIndexDDL(index, dialect, options = {}) {
|
|
6
11
|
if (index.entity === "node") {
|
|
7
12
|
return generateNodeIndexDDL(index, dialect, options);
|
|
@@ -21,10 +26,10 @@ function generateTableIndexDDL(index, dialect, tableName, options) {
|
|
|
21
26
|
return generateGinFamilyIndexDDL(index, dialect, tableName, options);
|
|
22
27
|
}
|
|
23
28
|
const ifNotExists = options.ifNotExists ?? true;
|
|
24
|
-
const propsColumn = sql.
|
|
25
|
-
const systemColumn = (column) => sql.
|
|
29
|
+
const propsColumn = sql.identifier("props");
|
|
30
|
+
const systemColumn = (column) => sql.identifier(column);
|
|
26
31
|
const keys = index.entity === "node" ? compileNodeIndexKeys(index, dialect, propsColumn, systemColumn).keys : compileEdgeIndexKeys(index, dialect, propsColumn, systemColumn).keys;
|
|
27
|
-
const whereSql = index.where ?
|
|
32
|
+
const whereSql = index.where ? renderSqlInline(
|
|
28
33
|
compileIndexWhere(
|
|
29
34
|
{
|
|
30
35
|
dialect,
|
|
@@ -35,74 +40,32 @@ function generateTableIndexDDL(index, dialect, tableName, options) {
|
|
|
35
40
|
),
|
|
36
41
|
dialect
|
|
37
42
|
) : void 0;
|
|
38
|
-
const keySql = keys.map((
|
|
43
|
+
const keySql = keys.map((key) => renderSqlInline(key, dialect)).join(", ");
|
|
39
44
|
const unique = index.unique ? "UNIQUE " : "";
|
|
40
|
-
const concurrent = options.concurrent === true && dialect
|
|
45
|
+
const concurrent = options.concurrent === true && INDEX_DDL_BEHAVIOR[dialect].concurrentBuilds ? "CONCURRENTLY " : "";
|
|
41
46
|
const ifNotExistsSql = ifNotExists ? "IF NOT EXISTS " : "";
|
|
42
47
|
const whereClause = whereSql ? ` WHERE ${whereSql}` : "";
|
|
43
48
|
return `CREATE ${unique}INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} (${keySql})${whereClause};`;
|
|
44
49
|
}
|
|
45
50
|
function generateGinFamilyIndexDDL(index, dialect, tableName, options) {
|
|
46
|
-
if (dialect
|
|
51
|
+
if (!INDEX_DDL_BEHAVIOR[dialect].supportsGinFamily) {
|
|
47
52
|
throw new Error(
|
|
48
53
|
`Index "${index.name}" declares method "${index.method}", which requires PostgreSQL. materializeIndexes() reports such declarations as skipped on SQLite instead of calling this.`
|
|
49
54
|
);
|
|
50
55
|
}
|
|
51
56
|
const adapter = getDialect(dialect);
|
|
52
|
-
const propsColumn = sql.
|
|
53
|
-
const pointer = index.fields[0];
|
|
57
|
+
const propsColumn = sql.identifier("props");
|
|
58
|
+
const pointer = requireDefined(index.fields[0]);
|
|
54
59
|
const expression = index.method === "gin" ? adapter.jsonExtract(propsColumn, pointer) : adapter.jsonExtractText(propsColumn, pointer);
|
|
55
60
|
const operatorClass = index.method === "gin" ? "jsonb_path_ops" : "gin_trgm_ops";
|
|
56
61
|
const concurrent = options.concurrent === true ? "CONCURRENTLY " : "";
|
|
57
62
|
const ifNotExistsSql = options.ifNotExists ?? true ? "IF NOT EXISTS " : "";
|
|
58
|
-
return `CREATE INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} USING GIN ((${
|
|
63
|
+
return `CREATE INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} USING GIN ((${renderSqlInline(expression, dialect)}) ${operatorClass});`;
|
|
59
64
|
}
|
|
60
65
|
function quoteIdentifier(identifier) {
|
|
61
66
|
return `"${identifier.replaceAll('"', '""')}"`;
|
|
62
67
|
}
|
|
63
|
-
function sqlToInlineString(object, dialect) {
|
|
64
|
-
const query = object.toQuery({
|
|
65
|
-
casing: new CasingCache(),
|
|
66
|
-
escapeName: (name) => name,
|
|
67
|
-
escapeParam: (_number, value) => inlineParam(value, dialect),
|
|
68
|
-
escapeString: (value) => escapeStringLiteral(value),
|
|
69
|
-
inlineParams: true,
|
|
70
|
-
invokeSource: "indexes"
|
|
71
|
-
});
|
|
72
|
-
if (query.params.length > 0) {
|
|
73
|
-
throw new Error(
|
|
74
|
-
"Index DDL generation produced parameters; expected fully inlined SQL"
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return query.sql;
|
|
78
|
-
}
|
|
79
|
-
function inlineParam(value, dialect) {
|
|
80
|
-
if (value === null || value === void 0) {
|
|
81
|
-
return "NULL";
|
|
82
|
-
}
|
|
83
|
-
if (value instanceof Date) {
|
|
84
|
-
return escapeStringLiteral(value.toISOString());
|
|
85
|
-
}
|
|
86
|
-
if (typeof value === "string") {
|
|
87
|
-
return escapeStringLiteral(value);
|
|
88
|
-
}
|
|
89
|
-
if (typeof value === "number") {
|
|
90
|
-
return value.toString();
|
|
91
|
-
}
|
|
92
|
-
if (typeof value === "boolean") {
|
|
93
|
-
return getDialect(dialect).booleanLiteralString(value);
|
|
94
|
-
}
|
|
95
|
-
if (typeof value === "bigint") {
|
|
96
|
-
return value.toString();
|
|
97
|
-
}
|
|
98
|
-
throw new TypeError(
|
|
99
|
-
"Index DDL generation received an unsupported SQL parameter value"
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
function escapeStringLiteral(value) {
|
|
103
|
-
return `'${value.replaceAll("'", "''")}'`;
|
|
104
|
-
}
|
|
105
68
|
|
|
106
69
|
export { generateEdgeIndexDDL, generateIndexDDL, generateNodeIndexDDL };
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
108
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-U4JDJKPD.js.map
|
|
71
|
+
//# sourceMappingURL=chunk-U4JDJKPD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/indexes/ddl.ts"],"names":[],"mappings":";;;;;AA+BA,IAAM,kBAAA,GAAqB;AAAA,EACzB,QAAA,EAAU,EAAE,gBAAA,EAAkB,IAAA,EAAM,mBAAmB,IAAA,EAAK;AAAA,EAC5D,MAAA,EAAQ,EAAE,gBAAA,EAAkB,KAAA,EAAO,mBAAmB,KAAA;AACxD,CAAA;AAeO,SAAS,gBAAA,CACd,KAAA,EACA,OAAA,EACA,OAAA,GAAmC,EAAC,EAC5B;AACR,EAAA,IAAI,KAAA,CAAM,WAAW,MAAA,EAAQ;AAC3B,IAAA,OAAO,oBAAA,CAAqB,KAAA,EAAO,OAAA,EAAS,OAAO,CAAA;AAAA,EACrD;AACA,EAAA,OAAO,oBAAA,CAAqB,KAAA,EAAO,OAAA,EAAS,OAAO,CAAA;AACrD;AAEO,SAAS,oBAAA,CACd,KAAA,EACA,OAAA,EACA,OAAA,GAAmC,EAAC,EAC5B;AACR,EAAA,MAAM,SAAA,GAAY,QAAQ,cAAA,IAAkB,iBAAA;AAC5C,EAAA,OAAO,q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,MAAM,aAAA,GACJ,KAAA,CAAM,MAAA,KAAW,KAAA,GAAQ,gBAAA,GAAmB,cAAA;AAC9C,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,UAAA,KAAe,IAAA,GAAO,eAAA,GAAkB,EAAA;AACnE,EAAA,MAAM,cAAA,GAAkB,OAAA,CAAQ,WAAA,IAAe,IAAA,GAAQ,gBAAA,GAAmB,EAAA;AAC1E,EAAA,OAAO,gBAAgB,UAAU,CAAA,EAAG,cAAc,CAAA,EAAG,eAAA,CAAgB,MAAM,IAAI,CAAC,OAAO,eAAA,CAAgB,SAAS,CAAC,CAAA,aAAA,EAAgB,eAAA,CAAgB,YAAY,OAAO,CAAC,KAAK,aAAa,CAAA,EAAA,CAAA;AACzL;AAEA,SAAS,gBAAgB,UAAA,EAA4B;AACnD,EAAA,OAAO,CAAA,CAAA,EAAI,UAAA,CAAW,UAAA,CAAW,GAAA,EAAK,IAAI,CAAC,CAAA,CAAA,CAAA;AAC7C","file":"chunk-U4JDJKPD.js","sourcesContent":["import { getDialect } from \"../query/dialect\";\nimport { type SqlDialect } from \"../query/dialect/types\";\nimport { renderSqlInline, sql, type SqlFragment } from \"../query/sql-fragment\";\nimport { requireDefined } from \"../utils/presence\";\nimport {\n compileEdgeIndexKeys,\n compileIndexWhere,\n compileNodeIndexKeys,\n type IndexCompilationContext,\n} from \"./compiler\";\nimport {\n type EdgeIndexDeclaration,\n type NodeIndexDeclaration,\n type RelationalIndexDeclaration,\n type SystemColumnName,\n} from \"./types\";\n\nexport type GenerateIndexDdlOptions = Readonly<{\n nodesTableName?: string | undefined;\n edgesTableName?: string | undefined;\n ifNotExists?: boolean | undefined;\n /**\n * Emit `CREATE INDEX CONCURRENTLY` (Postgres only). Required for\n * `store.materializeIndexes()` so live tables don't take an\n * `AccessExclusiveLock`. Ignored on SQLite (no equivalent; SQLite is\n * single-writer regardless). When true on Postgres, the resulting\n * statement cannot be executed inside a transaction.\n */\n concurrent?: boolean | undefined;\n}>;\n\nconst INDEX_DDL_BEHAVIOR = {\n postgres: { concurrentBuilds: true, supportsGinFamily: true },\n sqlite: { concurrentBuilds: false, supportsGinFamily: false },\n} as const satisfies Record<\n SqlDialect,\n Readonly<{ concurrentBuilds: boolean; supportsGinFamily: boolean }>\n>;\n\n/**\n * Generate `CREATE INDEX` DDL for a single relational index declaration.\n *\n * Vector index declarations (`entity: \"vector\"`) are NOT handled here —\n * they go through `backend.createVectorIndex` instead because the DDL\n * is dialect-specific (`USING hnsw (...) WITH (m=..., ef_construction=...)`\n * on Postgres) and operates on the strategy's per-`(kind, field)` embedding\n * tables, not `typegraph_nodes` / `typegraph_edges`. Callers narrow to the\n * relational subset before calling this function.\n */\nexport function generateIndexDDL(\n index: RelationalIndexDeclaration,\n dialect: SqlDialect,\n options: GenerateIndexDdlOptions = {},\n): string {\n if (index.entity === \"node\") {\n return generateNodeIndexDDL(index, dialect, options);\n }\n return generateEdgeIndexDDL(index, dialect, options);\n}\n\nexport function generateNodeIndexDDL(\n index: NodeIndexDeclaration,\n dialect: SqlDialect,\n options: GenerateIndexDdlOptions = {},\n): string {\n const tableName = options.nodesTableName ?? \"typegraph_nodes\";\n return generateTableIndexDDL(index, dialect, tableName, options);\n}\n\nexport function generateEdgeIndexDDL(\n index: EdgeIndexDeclaration,\n dialect: SqlDialect,\n options: GenerateIndexDdlOptions = {},\n): string {\n const tableName = options.edgesTableName ?? \"typegraph_edges\";\n return generateTableIndexDDL(index, dialect, tableName, options);\n}\n\nfunction generateTableIndexDDL(\n index: RelationalIndexDeclaration,\n dialect: SqlDialect,\n tableName: string,\n options: GenerateIndexDdlOptions,\n): string {\n if (index.method !== undefined) {\n return generateGinFamilyIndexDDL(index, dialect, tableName, options);\n }\n const ifNotExists = options.ifNotExists ?? true;\n const propsColumn = sql.identifier(\"props\");\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n sql.identifier(column);\n\n const keys =\n index.entity === \"node\" ?\n compileNodeIndexKeys(index, dialect, propsColumn, systemColumn).keys\n : compileEdgeIndexKeys(index, dialect, propsColumn, systemColumn).keys;\n\n const whereSql =\n index.where ?\n renderSqlInline(\n compileIndexWhere(\n {\n dialect,\n propsColumn,\n systemColumn,\n } satisfies IndexCompilationContext,\n index.where,\n ),\n dialect,\n )\n : undefined;\n\n const keySql = keys.map((key) => renderSqlInline(key, dialect)).join(\", \");\n const unique = index.unique ? \"UNIQUE \" : \"\";\n const concurrent =\n (\n options.concurrent === true &&\n INDEX_DDL_BEHAVIOR[dialect].concurrentBuilds\n ) ?\n \"CONCURRENTLY \"\n : \"\";\n const ifNotExistsSql = ifNotExists ? \"IF NOT EXISTS \" : \"\";\n\n const whereClause = whereSql ? ` WHERE ${whereSql}` : \"\";\n\n return `CREATE ${unique}INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} (${keySql})${whereClause};`;\n}\n\n/**\n * DDL for the GIN-family methods (`\"gin\"` / `\"trigram\"`) — a PostgreSQL\n * expression GIN over the declaration's single field.\n *\n * The indexed expression is built from the SAME dialect extraction the\n * query compiler emits for the field (`jsonExtract` → `\"props\" #> ARRAY[…]`\n * for containment, `jsonExtractText` → `#>>` for text), because Postgres\n * matches expression indexes structurally: `(props #> ARRAY['tags']) @> $1`\n * and `(props #>> ARRAY['name']) ILIKE $1 ESCAPE '\\'` both hit their GIN\n * (verified against parameterized prepared statements). No scope prefix\n * columns, uniqueness, or partial clause: a GIN indexes one expression, and\n * the query's `graph_id` / `kind` equality filters apply as residual\n * conditions over the candidate rows.\n */\nfunction generateGinFamilyIndexDDL(\n index: RelationalIndexDeclaration,\n dialect: SqlDialect,\n tableName: string,\n options: GenerateIndexDdlOptions,\n): string {\n if (!INDEX_DDL_BEHAVIOR[dialect].supportsGinFamily) {\n throw new Error(\n `Index \"${index.name}\" declares method \"${index.method}\", which ` +\n \"requires PostgreSQL. materializeIndexes() reports such \" +\n \"declarations as skipped on SQLite instead of calling this.\",\n );\n }\n const adapter = getDialect(dialect);\n const propsColumn = sql.identifier(\"props\");\n const pointer = requireDefined(index.fields[0]);\n const expression =\n index.method === \"gin\" ?\n adapter.jsonExtract(propsColumn, pointer)\n : adapter.jsonExtractText(propsColumn, pointer);\n const operatorClass =\n index.method === \"gin\" ? \"jsonb_path_ops\" : \"gin_trgm_ops\";\n const concurrent = options.concurrent === true ? \"CONCURRENTLY \" : \"\";\n const ifNotExistsSql = (options.ifNotExists ?? true) ? \"IF NOT EXISTS \" : \"\";\n return `CREATE INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} USING GIN ((${renderSqlInline(expression, dialect)}) ${operatorClass});`;\n}\n\nfunction quoteIdentifier(identifier: string): string {\n return `\"${identifier.replaceAll('\"', '\"\"')}\"`;\n}\n"]}
|