@nicia-ai/typegraph 0.41.0 → 0.42.1

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.
Files changed (265) hide show
  1. package/dist/backend/drizzle/indexes.cjs +9 -9
  2. package/dist/backend/drizzle/indexes.d.cts +1 -2
  3. package/dist/backend/drizzle/indexes.d.ts +1 -2
  4. package/dist/backend/drizzle/indexes.js +5 -5
  5. package/dist/backend/index.cjs +50 -50
  6. package/dist/backend/index.d.cts +3 -4
  7. package/dist/backend/index.d.ts +3 -4
  8. package/dist/backend/index.js +11 -11
  9. package/dist/backend/postgres/index.cjs +26 -26
  10. package/dist/backend/postgres/index.d.cts +5 -6
  11. package/dist/backend/postgres/index.d.ts +5 -6
  12. package/dist/backend/postgres/index.js +13 -13
  13. package/dist/backend/postgres/pglite-store.cjs +34 -34
  14. package/dist/backend/postgres/pglite-store.d.cts +7 -8
  15. package/dist/backend/postgres/pglite-store.d.ts +7 -8
  16. package/dist/backend/postgres/pglite-store.js +30 -30
  17. package/dist/backend/postgres/pglite.cjs +15 -15
  18. package/dist/backend/postgres/pglite.d.cts +2 -3
  19. package/dist/backend/postgres/pglite.d.ts +2 -3
  20. package/dist/backend/postgres/pglite.js +14 -14
  21. package/dist/backend/sqlite/index.cjs +23 -23
  22. package/dist/backend/sqlite/index.d.cts +5 -6
  23. package/dist/backend/sqlite/index.d.ts +5 -6
  24. package/dist/backend/sqlite/index.js +11 -11
  25. package/dist/backend/sqlite/libsql.cjs +17 -17
  26. package/dist/backend/sqlite/libsql.d.cts +2 -3
  27. package/dist/backend/sqlite/libsql.d.ts +2 -3
  28. package/dist/backend/sqlite/libsql.js +13 -13
  29. package/dist/backend/sqlite/local-store.cjs +35 -35
  30. package/dist/backend/sqlite/local-store.d.cts +7 -8
  31. package/dist/backend/sqlite/local-store.d.ts +7 -8
  32. package/dist/backend/sqlite/local-store.js +31 -31
  33. package/dist/backend/sqlite/local.cjs +16 -16
  34. package/dist/backend/sqlite/local.d.cts +2 -3
  35. package/dist/backend/sqlite/local.d.ts +2 -3
  36. package/dist/backend/sqlite/local.js +14 -14
  37. package/dist/{chunk-LOKG3KQV.cjs → chunk-277UZV7X.cjs} +1113 -1089
  38. package/dist/chunk-277UZV7X.cjs.map +1 -0
  39. package/dist/{chunk-2I3DNNBU.js → chunk-2G6ZEGYO.js} +4 -4
  40. package/dist/{chunk-2I3DNNBU.js.map → chunk-2G6ZEGYO.js.map} +1 -1
  41. package/dist/{chunk-76HE7DJP.js → chunk-2HKIID5K.js} +5 -5
  42. package/dist/{chunk-76HE7DJP.js.map → chunk-2HKIID5K.js.map} +1 -1
  43. package/dist/{chunk-QOHTVDHU.js → chunk-2OOY4OYT.js} +4 -4
  44. package/dist/{chunk-QOHTVDHU.js.map → chunk-2OOY4OYT.js.map} +1 -1
  45. package/dist/{chunk-UCHW2MGP.cjs → chunk-2SO5I5AI.cjs} +196 -196
  46. package/dist/{chunk-UCHW2MGP.cjs.map → chunk-2SO5I5AI.cjs.map} +1 -1
  47. package/dist/{chunk-LFFVD5ZR.cjs → chunk-33PAKPED.cjs} +41 -41
  48. package/dist/{chunk-LFFVD5ZR.cjs.map → chunk-33PAKPED.cjs.map} +1 -1
  49. package/dist/{chunk-QCKD3RCI.cjs → chunk-3RPQDGUE.cjs} +5 -5
  50. package/dist/{chunk-QCKD3RCI.cjs.map → chunk-3RPQDGUE.cjs.map} +1 -1
  51. package/dist/{chunk-PH4IJ3V5.js → chunk-3V6D5DEC.js} +3 -3
  52. package/dist/{chunk-PH4IJ3V5.js.map → chunk-3V6D5DEC.js.map} +1 -1
  53. package/dist/{chunk-Y5UC3IXF.js → chunk-42XYPKZU.js} +3 -3
  54. package/dist/{chunk-Y5UC3IXF.js.map → chunk-42XYPKZU.js.map} +1 -1
  55. package/dist/{chunk-XZA3Y4YH.js → chunk-4WYFRACU.js} +3 -3
  56. package/dist/{chunk-XZA3Y4YH.js.map → chunk-4WYFRACU.js.map} +1 -1
  57. package/dist/{chunk-AQVDAKXH.js → chunk-4XRP2N6B.js} +3 -3
  58. package/dist/{chunk-AQVDAKXH.js.map → chunk-4XRP2N6B.js.map} +1 -1
  59. package/dist/{chunk-PWXGB77L.cjs → chunk-5AERZSHC.cjs} +4 -4
  60. package/dist/{chunk-PWXGB77L.cjs.map → chunk-5AERZSHC.cjs.map} +1 -1
  61. package/dist/{chunk-K6CD6W5J.js → chunk-5C75HQYQ.js} +5 -5
  62. package/dist/{chunk-K6CD6W5J.js.map → chunk-5C75HQYQ.js.map} +1 -1
  63. package/dist/{chunk-2J5NMMVR.cjs → chunk-5GV4JQNA.cjs} +43 -43
  64. package/dist/{chunk-2J5NMMVR.cjs.map → chunk-5GV4JQNA.cjs.map} +1 -1
  65. package/dist/{chunk-KHNKYSGP.cjs → chunk-5P6IPIT6.cjs} +41 -41
  66. package/dist/{chunk-KHNKYSGP.cjs.map → chunk-5P6IPIT6.cjs.map} +1 -1
  67. package/dist/{chunk-M2RPZS7J.cjs → chunk-5Q3P6OIC.cjs} +12 -12
  68. package/dist/{chunk-M2RPZS7J.cjs.map → chunk-5Q3P6OIC.cjs.map} +1 -1
  69. package/dist/{chunk-QXKVUJLI.cjs → chunk-5ZPRE4CV.cjs} +206 -166
  70. package/dist/chunk-5ZPRE4CV.cjs.map +1 -0
  71. package/dist/{chunk-53BSOG3O.js → chunk-6NB73BXV.js} +11 -11
  72. package/dist/{chunk-53BSOG3O.js.map → chunk-6NB73BXV.js.map} +1 -1
  73. package/dist/{chunk-SE422RES.cjs → chunk-6TJ6PKPS.cjs} +27 -27
  74. package/dist/{chunk-SE422RES.cjs.map → chunk-6TJ6PKPS.cjs.map} +1 -1
  75. package/dist/{chunk-7WLEQIHA.cjs → chunk-7Y6BV3TK.cjs} +100 -100
  76. package/dist/{chunk-7WLEQIHA.cjs.map → chunk-7Y6BV3TK.cjs.map} +1 -1
  77. package/dist/{chunk-HP6LWBLB.cjs → chunk-AO2WPYFZ.cjs} +4 -4
  78. package/dist/{chunk-HP6LWBLB.cjs.map → chunk-AO2WPYFZ.cjs.map} +1 -1
  79. package/dist/{chunk-7UTUKH4E.cjs → chunk-AQR6BHB3.cjs} +10 -10
  80. package/dist/{chunk-7UTUKH4E.cjs.map → chunk-AQR6BHB3.cjs.map} +1 -1
  81. package/dist/{chunk-X4PVHAZ6.cjs → chunk-ARN3ZODS.cjs} +6 -6
  82. package/dist/{chunk-X4PVHAZ6.cjs.map → chunk-ARN3ZODS.cjs.map} +1 -1
  83. package/dist/{chunk-YYLMXERH.js → chunk-CDYRPI5U.js} +4 -4
  84. package/dist/{chunk-YYLMXERH.js.map → chunk-CDYRPI5U.js.map} +1 -1
  85. package/dist/{chunk-3LKL3S6X.js → chunk-CI5NPLXX.js} +3 -3
  86. package/dist/{chunk-3LKL3S6X.js.map → chunk-CI5NPLXX.js.map} +1 -1
  87. package/dist/{chunk-UUIBACKJ.js → chunk-CUPJL6TS.js} +3 -3
  88. package/dist/{chunk-UUIBACKJ.js.map → chunk-CUPJL6TS.js.map} +1 -1
  89. package/dist/{chunk-JZYMOHHM.cjs → chunk-CVK4T34X.cjs} +22 -22
  90. package/dist/{chunk-JZYMOHHM.cjs.map → chunk-CVK4T34X.cjs.map} +1 -1
  91. package/dist/{chunk-L3DDZUZP.js → chunk-CVNGKTHO.js} +4 -4
  92. package/dist/{chunk-L3DDZUZP.js.map → chunk-CVNGKTHO.js.map} +1 -1
  93. package/dist/{chunk-RW24SAHI.cjs → chunk-DMZEVJGL.cjs} +13 -13
  94. package/dist/{chunk-RW24SAHI.cjs.map → chunk-DMZEVJGL.cjs.map} +1 -1
  95. package/dist/{chunk-MQBF3XGY.js → chunk-DP7KC6CL.js} +47 -23
  96. package/dist/chunk-DP7KC6CL.js.map +1 -0
  97. package/dist/{chunk-QYDUCWD2.cjs → chunk-ECU53PMN.cjs} +4 -4
  98. package/dist/{chunk-QYDUCWD2.cjs.map → chunk-ECU53PMN.cjs.map} +1 -1
  99. package/dist/{chunk-SCTZRFW5.js → chunk-EQOQOT55.js} +5 -5
  100. package/dist/{chunk-SCTZRFW5.js.map → chunk-EQOQOT55.js.map} +1 -1
  101. package/dist/{chunk-JHK6NPFV.js → chunk-EVFL2ZY5.js} +9 -9
  102. package/dist/{chunk-JHK6NPFV.js.map → chunk-EVFL2ZY5.js.map} +1 -1
  103. package/dist/{chunk-SAMJLDGG.cjs → chunk-F2KVJ6FF.cjs} +112 -112
  104. package/dist/{chunk-SAMJLDGG.cjs.map → chunk-F2KVJ6FF.cjs.map} +1 -1
  105. package/dist/{chunk-NMQ6C6TS.cjs → chunk-F7TDKSVB.cjs} +4 -4
  106. package/dist/{chunk-NMQ6C6TS.cjs.map → chunk-F7TDKSVB.cjs.map} +1 -1
  107. package/dist/{chunk-HQRZEYYB.cjs → chunk-FFQGI67R.cjs} +44 -44
  108. package/dist/{chunk-HQRZEYYB.cjs.map → chunk-FFQGI67R.cjs.map} +1 -1
  109. package/dist/{chunk-YIRLBUNN.js → chunk-FMPZPOUD.js} +3 -3
  110. package/dist/{chunk-YIRLBUNN.js.map → chunk-FMPZPOUD.js.map} +1 -1
  111. package/dist/{chunk-LL5D5T5W.cjs → chunk-FSCJOTHF.cjs} +10 -10
  112. package/dist/{chunk-LL5D5T5W.cjs.map → chunk-FSCJOTHF.cjs.map} +1 -1
  113. package/dist/{chunk-2X73QTIC.cjs → chunk-FY4VY5EV.cjs} +20 -20
  114. package/dist/{chunk-2X73QTIC.cjs.map → chunk-FY4VY5EV.cjs.map} +1 -1
  115. package/dist/{chunk-3SHAUJRB.js → chunk-GT7NEXSU.js} +3 -3
  116. package/dist/{chunk-3SHAUJRB.js.map → chunk-GT7NEXSU.js.map} +1 -1
  117. package/dist/{chunk-W66YCXWT.js → chunk-HHBKGPEI.js} +11 -10
  118. package/dist/chunk-HHBKGPEI.js.map +1 -0
  119. package/dist/{chunk-CKFBZ4LV.cjs → chunk-I73ATSAH.cjs} +4 -4
  120. package/dist/{chunk-CKFBZ4LV.cjs.map → chunk-I73ATSAH.cjs.map} +1 -1
  121. package/dist/{chunk-ELA3V6UN.js → chunk-JOYPNY33.js} +9 -9
  122. package/dist/{chunk-ELA3V6UN.js.map → chunk-JOYPNY33.js.map} +1 -1
  123. package/dist/{chunk-YIX3BEBR.cjs → chunk-K2HHCWZO.cjs} +108 -108
  124. package/dist/{chunk-YIX3BEBR.cjs.map → chunk-K2HHCWZO.cjs.map} +1 -1
  125. package/dist/{chunk-SAFZ6JTI.cjs → chunk-KTBTSHU6.cjs} +19 -2
  126. package/dist/chunk-KTBTSHU6.cjs.map +1 -0
  127. package/dist/{chunk-KOI7UEI5.js → chunk-LDCWO5B6.js} +3 -3
  128. package/dist/{chunk-KOI7UEI5.js.map → chunk-LDCWO5B6.js.map} +1 -1
  129. package/dist/{chunk-I5CRUPKO.js → chunk-LQLVJWUH.js} +7 -7
  130. package/dist/{chunk-I5CRUPKO.js.map → chunk-LQLVJWUH.js.map} +1 -1
  131. package/dist/{chunk-6N7QBIWN.js → chunk-M4GYQF2H.js} +3 -3
  132. package/dist/{chunk-6N7QBIWN.js.map → chunk-M4GYQF2H.js.map} +1 -1
  133. package/dist/{chunk-ZE7E46IZ.js → chunk-NXIZL7ZZ.js} +6 -6
  134. package/dist/{chunk-ZE7E46IZ.js.map → chunk-NXIZL7ZZ.js.map} +1 -1
  135. package/dist/{chunk-XRU7V7FF.cjs → chunk-O2GZM7UK.cjs} +7 -7
  136. package/dist/{chunk-XRU7V7FF.cjs.map → chunk-O2GZM7UK.cjs.map} +1 -1
  137. package/dist/{chunk-ZE6NVENI.js → chunk-O3USVVWS.js} +3 -3
  138. package/dist/{chunk-ZE6NVENI.js.map → chunk-O3USVVWS.js.map} +1 -1
  139. package/dist/{chunk-UDS5DZNY.cjs → chunk-O7XVCLXW.cjs} +68 -67
  140. package/dist/chunk-O7XVCLXW.cjs.map +1 -0
  141. package/dist/{chunk-KLR77R5A.cjs → chunk-OM6RIOA5.cjs} +13 -13
  142. package/dist/{chunk-KLR77R5A.cjs.map → chunk-OM6RIOA5.cjs.map} +1 -1
  143. package/dist/{chunk-LLHMAHG4.cjs → chunk-OMQ2NBOR.cjs} +27 -27
  144. package/dist/{chunk-LLHMAHG4.cjs.map → chunk-OMQ2NBOR.cjs.map} +1 -1
  145. package/dist/{chunk-DPNA466P.js → chunk-OYJSYDIH.js} +19 -3
  146. package/dist/chunk-OYJSYDIH.js.map +1 -0
  147. package/dist/{chunk-V3S74J44.js → chunk-RAWG2FEU.js} +134 -22
  148. package/dist/chunk-RAWG2FEU.js.map +1 -0
  149. package/dist/{chunk-TAUGGLNQ.js → chunk-RXOAXO3R.js} +3 -3
  150. package/dist/{chunk-TAUGGLNQ.js.map → chunk-RXOAXO3R.js.map} +1 -1
  151. package/dist/{chunk-LLE25NRD.cjs → chunk-TRC646QQ.cjs} +7 -7
  152. package/dist/{chunk-LLE25NRD.cjs.map → chunk-TRC646QQ.cjs.map} +1 -1
  153. package/dist/chunk-U3YRCZ5L.cjs +12 -0
  154. package/dist/{chunk-IMQKXL4E.cjs.map → chunk-U3YRCZ5L.cjs.map} +1 -1
  155. package/dist/{chunk-ZVME6OSV.js → chunk-UJRWOV5B.js} +5 -5
  156. package/dist/{chunk-ZVME6OSV.js.map → chunk-UJRWOV5B.js.map} +1 -1
  157. package/dist/{chunk-HAQVISUF.cjs → chunk-UTTW2Q3M.cjs} +133 -133
  158. package/dist/{chunk-HAQVISUF.cjs.map → chunk-UTTW2Q3M.cjs.map} +1 -1
  159. package/dist/{chunk-L5ET7FYQ.js → chunk-UZLEQFTV.js} +3 -3
  160. package/dist/{chunk-L5ET7FYQ.js.map → chunk-UZLEQFTV.js.map} +1 -1
  161. package/dist/{chunk-JP5EICR6.cjs → chunk-V2GZBPY2.cjs} +179 -65
  162. package/dist/chunk-V2GZBPY2.cjs.map +1 -0
  163. package/dist/{chunk-BUZWMDNL.js → chunk-VC26BUNP.js} +5 -5
  164. package/dist/{chunk-BUZWMDNL.js.map → chunk-VC26BUNP.js.map} +1 -1
  165. package/dist/chunk-VGMNGWBR.cjs +12 -0
  166. package/dist/{chunk-5YBDB7UG.cjs.map → chunk-VGMNGWBR.cjs.map} +1 -1
  167. package/dist/{chunk-XMEYZYGE.js → chunk-WYQILW5V.js} +8 -8
  168. package/dist/{chunk-XMEYZYGE.js.map → chunk-WYQILW5V.js.map} +1 -1
  169. package/dist/{chunk-YX3H63VV.cjs → chunk-X2XOQZT3.cjs} +9 -9
  170. package/dist/{chunk-YX3H63VV.cjs.map → chunk-X2XOQZT3.cjs.map} +1 -1
  171. package/dist/{chunk-N2V3HJFV.cjs → chunk-XDMPDUKL.cjs} +9 -9
  172. package/dist/{chunk-N2V3HJFV.cjs.map → chunk-XDMPDUKL.cjs.map} +1 -1
  173. package/dist/{chunk-EFZ4S22A.js → chunk-YPVQYM3L.js} +107 -67
  174. package/dist/chunk-YPVQYM3L.js.map +1 -0
  175. package/dist/{chunk-5J4VNCUD.js → chunk-Z3WIL6S3.js} +5 -5
  176. package/dist/{chunk-5J4VNCUD.js.map → chunk-Z3WIL6S3.js.map} +1 -1
  177. package/dist/{chunk-MNURF4RF.cjs → chunk-ZBV4LQD2.cjs} +4 -4
  178. package/dist/{chunk-MNURF4RF.cjs.map → chunk-ZBV4LQD2.cjs.map} +1 -1
  179. package/dist/{chunk-YGX4PMG6.js → chunk-ZGOUVMVS.js} +5 -5
  180. package/dist/{chunk-YGX4PMG6.js.map → chunk-ZGOUVMVS.js.map} +1 -1
  181. package/dist/{chunk-QZYGZVUI.js → chunk-ZIRC2U6G.js} +11 -11
  182. package/dist/{chunk-QZYGZVUI.js.map → chunk-ZIRC2U6G.js.map} +1 -1
  183. package/dist/{chunk-6QP4QXBR.js → chunk-ZOHCFYXE.js} +3 -3
  184. package/dist/{chunk-6QP4QXBR.js.map → chunk-ZOHCFYXE.js.map} +1 -1
  185. package/dist/{chunk-VWEFXG73.js → chunk-ZP2KPDNN.js} +3 -3
  186. package/dist/{chunk-VWEFXG73.js.map → chunk-ZP2KPDNN.js.map} +1 -1
  187. package/dist/{chunk-NT6ILURI.cjs → chunk-ZPCKPLMX.cjs} +8 -8
  188. package/dist/{chunk-NT6ILURI.cjs.map → chunk-ZPCKPLMX.cjs.map} +1 -1
  189. package/dist/core/index.cjs +28 -28
  190. package/dist/core/index.d.cts +5 -6
  191. package/dist/core/index.d.ts +5 -6
  192. package/dist/core/index.js +8 -8
  193. package/dist/{ddl-BCXFRLWg.d.cts → ddl-3unqC-kg.d.cts} +3 -3
  194. package/dist/{ddl-ByLmGgn9.d.ts → ddl-Bc4Dl8fu.d.ts} +3 -3
  195. package/dist/{define-graph-BSviZubs.d.ts → define-graph-Byslw2OO.d.cts} +1 -2
  196. package/dist/{define-graph-XyJheaFm.d.cts → define-graph-DBFnc7u_.d.ts} +1 -2
  197. package/dist/graph-extension/index.cjs +20 -20
  198. package/dist/graph-extension/index.d.cts +4 -4
  199. package/dist/graph-extension/index.d.ts +4 -4
  200. package/dist/graph-extension/index.js +5 -5
  201. package/dist/graph-merge/index.cjs +105 -105
  202. package/dist/graph-merge/index.d.cts +8 -9
  203. package/dist/graph-merge/index.d.ts +8 -9
  204. package/dist/graph-merge/index.js +25 -25
  205. package/dist/{index-BD_3TCgh.d.ts → index-DHXw7QAl.d.cts} +19 -4
  206. package/dist/{index-BihFPsPu.d.cts → index-DQzVJBHa.d.ts} +19 -4
  207. package/dist/index.cjs +206 -202
  208. package/dist/index.d.cts +13 -15
  209. package/dist/index.d.ts +13 -15
  210. package/dist/index.js +35 -35
  211. package/dist/indexes/index.cjs +13 -13
  212. package/dist/indexes/index.d.cts +4 -5
  213. package/dist/indexes/index.d.ts +4 -5
  214. package/dist/indexes/index.js +6 -6
  215. package/dist/interchange/index.cjs +40 -40
  216. package/dist/interchange/index.d.cts +9 -10
  217. package/dist/interchange/index.d.ts +9 -10
  218. package/dist/interchange/index.js +14 -14
  219. package/dist/{manager-C7iC5bk_.d.ts → manager-Dl0-er1G.d.ts} +21 -156
  220. package/dist/{manager-Dm6MCYO7.d.cts → manager-U9_zopqr.d.cts} +21 -156
  221. package/dist/materialize-indexes-BM3u0aXE.d.ts +258 -0
  222. package/dist/materialize-indexes-DzMCetZe.d.cts +258 -0
  223. package/dist/{postgres-DZxwzCQ8.d.cts → postgres-C5-WMKFA.d.ts} +1 -1
  224. package/dist/{postgres-Cb6ceh4-.d.ts → postgres-DpJqtbSX.d.cts} +1 -1
  225. package/dist/profiler/index.d.cts +9 -10
  226. package/dist/profiler/index.d.ts +9 -10
  227. package/dist/provenance/index.cjs +39 -39
  228. package/dist/provenance/index.d.cts +7 -8
  229. package/dist/provenance/index.d.ts +7 -8
  230. package/dist/provenance/index.js +9 -9
  231. package/dist/schema/index.cjs +48 -39
  232. package/dist/schema/index.d.cts +7 -8
  233. package/dist/schema/index.d.ts +7 -8
  234. package/dist/schema/index.js +15 -14
  235. package/dist/{searchable-aUaKh3_r.d.cts → searchable-B4mUXZT6.d.cts} +2 -2
  236. package/dist/{searchable-Cet4Oztt.d.ts → searchable-C7jmPNLT.d.ts} +2 -2
  237. package/dist/{sqlite-Cb3Ilj9_.d.ts → sqlite-Ch5tSYQY.d.ts} +1 -1
  238. package/dist/{sqlite-Dxklpizv.d.cts → sqlite-Da7jiYu9.d.cts} +1 -1
  239. package/dist/{store-view-PCT7vTKH.d.cts → store-view-6C2vTWqf.d.ts} +8 -7
  240. package/dist/{store-view-BDjGFjpN.d.ts → store-view-CNcOG8bQ.d.cts} +8 -7
  241. package/dist/{temporal-CyFsSPe8.d.ts → temporal-BtrTYTiB.d.ts} +1 -1
  242. package/dist/{temporal-Dn_JADWY.d.cts → temporal-CMpigMCW.d.cts} +1 -1
  243. package/dist/{types-CFZiEEPh.d.ts → types-D2rU5Taq.d.ts} +1 -2
  244. package/dist/{types-D-vOo_pM.d.ts → types-Dh-EgT-w.d.cts} +569 -2
  245. package/dist/{types-ho4DJJb_.d.cts → types-Dh-EgT-w.d.ts} +569 -2
  246. package/dist/{types-CsaG00wS.d.cts → types-G4sVM-76.d.cts} +1 -2
  247. package/dist/{where-DLYaXa4L.d.ts → where-B8Y21kig.d.ts} +1 -2
  248. package/dist/{where-udes1WRA.d.cts → where-DbZ9XDOI.d.cts} +1 -2
  249. package/package.json +1 -1
  250. package/dist/chunk-5YBDB7UG.cjs +0 -12
  251. package/dist/chunk-DPNA466P.js.map +0 -1
  252. package/dist/chunk-EFZ4S22A.js.map +0 -1
  253. package/dist/chunk-IMQKXL4E.cjs +0 -12
  254. package/dist/chunk-JP5EICR6.cjs.map +0 -1
  255. package/dist/chunk-LOKG3KQV.cjs.map +0 -1
  256. package/dist/chunk-MQBF3XGY.js.map +0 -1
  257. package/dist/chunk-QXKVUJLI.cjs.map +0 -1
  258. package/dist/chunk-SAFZ6JTI.cjs.map +0 -1
  259. package/dist/chunk-UDS5DZNY.cjs.map +0 -1
  260. package/dist/chunk-V3S74J44.js.map +0 -1
  261. package/dist/chunk-W66YCXWT.js.map +0 -1
  262. package/dist/extension-types-BLEVH4SG.d.cts +0 -571
  263. package/dist/extension-types-BLEVH4SG.d.ts +0 -571
  264. package/dist/materialize-indexes-D4iei4Kp.d.ts +0 -90
  265. package/dist/materialize-indexes-ExQ6OrAh.d.cts +0 -90
@@ -1,5 +1,5 @@
1
1
  import { isPlainObject } from './chunk-ITE4IXAK.js';
2
- import { ConfigurationError } from './chunk-DPNA466P.js';
2
+ import { ConfigurationError } from './chunk-OYJSYDIH.js';
3
3
 
4
4
  // src/core/json-value.ts
5
5
  function assertJsonValue(value, rootLabel, ownerKind) {
@@ -55,5 +55,5 @@ function throwInvalid(path, kind, ownerKind) {
55
55
  }
56
56
 
57
57
  export { assertJsonValue };
58
- //# sourceMappingURL=chunk-TAUGGLNQ.js.map
59
- //# sourceMappingURL=chunk-TAUGGLNQ.js.map
58
+ //# sourceMappingURL=chunk-RXOAXO3R.js.map
59
+ //# sourceMappingURL=chunk-RXOAXO3R.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/json-value.ts"],"names":[],"mappings":";;;;AAyBO,SAAS,eAA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AI,CAAA,CAAA,EAAI,GAAG,IAAI,SAAS,CAAA;AAAA,EAC1C;AACF;AAEA,SAAS,kBAAkB,KAAA,EAAuB;AAChD,EAAA,IAAI,MAAA,CAAO,KAAA,CAAM,KAAK,CAAA,EAAG,OAAO,KAAA;AAChC,EAAA,IAAI,KAAA,KAAU,MAAA,CAAO,iBAAA,EAAmB,OAAO,UAAA;AAC/C,EAAA,IAAI,KAAA,KAAU,MAAA,CAAO,iBAAA,EAAmB,OAAO,WAAA;AAC/C,EAAA,OAAO,mBAAA;AACT;AAEA,SAAS,iBAAiB,KAAA,EAAwB;AAChD,EAAA,MAAM,eAAA,GAAmB,OACrB,WAAA,EAAa,IAAA;AACjB,EAAA,IAAI,OAAO,eAAA,KAAoB,QAAA,IAAY,eAAA,CAAgB,SAAS,CAAA,EAAG;AACrE,IAAA,OAAO,GAAG,eAAe,CAAA,SAAA,CAAA;AAAA,EAC3B;AACA,EAAA,OAAO,kBAAA;AACT;AAEA,SAAS,YAAA,CAAa,IAAA,EAAc,IAAA,EAAc,SAAA,EAA0B;AAC1E,EAAA,MAAM,IAAI,kBAAA;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-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
+ {"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,OAAO,CAAA,IAAK,KAAA,CAAM,SAAQ,EAAG;AAC9C,MAAA,IAAA,CAAK,SAAS,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,KAAK,KAAK,SAAS,CAAA;AAAA,IAC9C;AACA,IAAA;AAAA,EACF;AACA,EAAA,IAAI,CAAC,aAAA,CAAc,KAAK,CAAA,EAAG;AACzB,IAAA,YAAA,CAAa,IAAA,EAAM,gBAAA,CAAiB,KAAK,CAAA,EAAG,SAAS,CAAA;AAAA,EACvD;AACA,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,MAAM,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AACjD,IAAA,IAAA,CAAK,QAAQ,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,GAAG,IAAI,SAAS,CAAA;AAAA,EAC1C;AACF;AAEA,SAAS,kBAAkB,KAAA,EAAuB;AAChD,EAAA,IAAI,MAAA,CAAO,KAAA,CAAM,KAAK,CAAA,EAAG,OAAO,KAAA;AAChC,EAAA,IAAI,KAAA,KAAU,MAAA,CAAO,iBAAA,EAAmB,OAAO,UAAA;AAC/C,EAAA,IAAI,KAAA,KAAU,MAAA,CAAO,iBAAA,EAAmB,OAAO,WAAA;AAC/C,EAAA,OAAO,mBAAA;AACT;AAEA,SAAS,iBAAiB,KAAA,EAAwB;AAChD,EAAA,MAAM,eAAA,GAAmB,OACrB,WAAA,EAAa,IAAA;AACjB,EAAA,IAAI,OAAO,eAAA,KAAoB,QAAA,IAAY,eAAA,CAAgB,SAAS,CAAA,EAAG;AACrE,IAAA,OAAO,GAAG,eAAe,CAAA,SAAA,CAAA;AAAA,EAC3B;AACA,EAAA,OAAO,kBAAA;AACT;AAEA,SAAS,YAAA,CAAa,IAAA,EAAc,IAAA,EAAc,SAAA,EAA0B;AAC1E,EAAA,MAAM,IAAI,kBAAA;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-RXOAXO3R.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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHAQVISUF_cjs = require('./chunk-HAQVISUF.cjs');
3
+ var chunkUTTW2Q3M_cjs = require('./chunk-UTTW2Q3M.cjs');
4
4
 
5
5
  // src/indexes/system.ts
6
6
  var SYSTEM_INDEX_DECLARATIONS = [
@@ -175,7 +175,7 @@ var MAX_SQL_IDENTIFIER_LENGTH = 63;
175
175
  function systemIndexName(physicalTableName, suffix) {
176
176
  const full = `${physicalTableName}_${suffix}`;
177
177
  if (full.length <= MAX_SQL_IDENTIFIER_LENGTH) return full;
178
- const hash = chunkHAQVISUF_cjs.shortHash(JSON.stringify([physicalTableName, suffix]));
178
+ const hash = chunkUTTW2Q3M_cjs.shortHash(JSON.stringify([physicalTableName, suffix]));
179
179
  return `${full.slice(0, MAX_SQL_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;
180
180
  }
181
181
  function resolveSystemIndexNames(overrides) {
@@ -200,11 +200,11 @@ function assertNoSystemIndexNameCollision(indexes, overrides) {
200
200
  }
201
201
  }
202
202
  function generateSystemIndexDDL(declaration, physicalTableName, options) {
203
- const name = chunkHAQVISUF_cjs.quoteIdentifier(
203
+ const name = chunkUTTW2Q3M_cjs.quoteIdentifier(
204
204
  systemIndexName(physicalTableName, declaration.suffix)
205
205
  );
206
- const table = chunkHAQVISUF_cjs.quoteIdentifier(physicalTableName);
207
- const columns = declaration.columns.map((column) => chunkHAQVISUF_cjs.quoteIdentifier(column)).join(", ");
206
+ const table = chunkUTTW2Q3M_cjs.quoteIdentifier(physicalTableName);
207
+ const columns = declaration.columns.map((column) => chunkUTTW2Q3M_cjs.quoteIdentifier(column)).join(", ");
208
208
  const concurrently = options.concurrent ? "CONCURRENTLY " : "";
209
209
  return `CREATE INDEX ${concurrently}IF NOT EXISTS ${name} ON ${table} (${columns});`;
210
210
  }
@@ -215,5 +215,5 @@ exports.generateSystemIndexDDL = generateSystemIndexDDL;
215
215
  exports.resolveSystemIndexNames = resolveSystemIndexNames;
216
216
  exports.resolveSystemIndexTableName = resolveSystemIndexTableName;
217
217
  exports.systemIndexName = systemIndexName;
218
- //# sourceMappingURL=chunk-LLE25NRD.cjs.map
219
- //# sourceMappingURL=chunk-LLE25NRD.cjs.map
218
+ //# sourceMappingURL=chunk-TRC646QQ.cjs.map
219
+ //# sourceMappingURL=chunk-TRC646QQ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/indexes/system.ts"],"names":["shortHash","quoteIdentifier"],"mappings":";;;;;AA6EO,IAAM,yBAAA,GAA+D;AAAA;AAAA,EAE1E,EAAE,OAAO,OAAA,EAAS,MAAA,EAAQ,YAAY,OAAA,EAAS,CAAC,UAAA,EAAY,MAAM,CAAA,EAAE;AAAA;AAAA;AAAA;AAAA,EAIpE;AAAA,IACE,KAAA,EAAO,OAAA;AAAA,IACP,MAAA,EAAQ,kBAAA;AAAA,IACR,OAAA,EAAS,CAAC,UAAA,EAAY,MAAA,EAAQ,cAAc,YAAY;AAAA,GAC1D;AAAA,EACA;AAAA,IACE,KAAA,EAAO,OAAA;AAAA,IACP,MAAA,EAAQ,aAAA;AAAA,IACR,OAAA,EAAS,CAAC,UAAA,EAAY,YAAY;AAAA,GACpC;AAAA,EACA;AAAA,IACE,KAAA,EAAO,OAAA;AAAA,IACP,MAAA,EAAQ,WAAA;AAAA,IACR,OAAA,EAAS,CAAC,UAAA,EAAY,YAAA,EAAc,UAAU;AAAA,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A,IACT,yBAAA,CAA0B,GAAA;AAAA,MAAI,CAAC,WAAA,KAC7B,eAAA;AAAA,QACE,2BAAA,CAA4B,WAAA,CAAY,KAAA,EAAO,SAAS,CAAA;AAAA,QACxD,WAAA,CAAY;AAAA;AACd;AACF,GACF;AACF;AAUO,SAAS,gCAAA,CACd,SACA,SAAA,EAEM;AACN,EAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC1B,EAAA,MAAM,QAAA,GAAW,wBAAwB,SAAS,CAAA;AAClD,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,IAAI,QAAA,CAAS,GAAA,CAAI,KAAA,CAAM,IAAI,CAAA,EAAG;AAC5B,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,YAAA,EAAe,MAAM,IAAI,CAAA,yOAAA;AAAA,OAK3B;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,sBAAA,CACd,WAAA,EACA,iBAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,IAAA,GAAOC,iCAAA;AAAA,IACX,eAAA,CAAgB,iBAAA,EAAmB,WAAA,CAAY,MAAM;AAAA,GACvD;AACA,EAAA,MAAM,KAAA,GAAQA,kCAAgB,iBAAiB,CAAA;AAC/C,EAAA,MAAM,OAAA,GAAU,WAAA,CAAY,OAAA,CACzB,GAAA,CAAI,CAAC,MAAA,KAAWA,iCAAA,CAAgB,MAAM,CAAC,CAAA,CACvC,IAAA,CAAK,IAAI,CAAA;AACZ,EAAA,MAAM,YAAA,GAAe,OAAA,CAAQ,UAAA,GAAa,eAAA,GAAkB,EAAA;AAC5D,EAAA,OAAO,gBAAgB,YAAY,CAAA,cAAA,EAAiB,IAAI,CAAA,IAAA,EAAO,KAAK,KAAK,OAAO,CAAA,EAAA,CAAA;AAClF","file":"chunk-LLE25NRD.cjs","sourcesContent":["/**\n * System-index declarations — the single source of truth for the plain\n * btree indexes TypeGraph ships on its own relations.\n *\n * Both dialect schema factories (`createSqliteTables` /\n * `createPostgresTables`) derive their Drizzle index builders from this\n * list, so the two dialects cannot drift, and\n * `materializeSystemIndexes()` derives the same indexes as runtime DDL so\n * an index added in a new library version reaches already-initialized\n * databases (bootstrap DDL only runs on first boot — see\n * `loadActiveSchemaWithBootstrap`).\n *\n * Scope: non-unique btree column indexes on the four graph relations,\n * where performance iteration actually happens. Primary keys, unique /\n * partial-unique constraints, and status-table indexes are structural —\n * they are created with their table and never retrofitted — and stay in\n * the schema files.\n *\n * Changing a declaration's shape under the same suffix is a signature\n * drift: `materializeSystemIndexes` reports `failed` for it until the\n * operator drops the old physical index. Rename (new suffix) instead,\n * exactly like graph-declared indexes. Two acknowledged limits of that\n * contract: on databases whose indexes were bootstrap-created (no status\n * rows) an in-place reshape is undetectable at runtime — the rename rule\n * is enforced by review and the parity tests; and a renamed suffix\n * strands the old physical index (the runner only adds). When the first\n * rename actually happens, add a retired-suffixes list + drop path here.\n */\nimport { quoteIdentifier, shortHash } from \"../query/dialect/vector-strategy\";\n\n/** The TypeGraph relations that carry system indexes. */\nexport type SystemIndexTable =\n \"nodes\" | \"edges\" | \"recordedNodes\" | \"recordedEdges\";\n\ntype LiveColumn =\n | \"graph_id\"\n | \"kind\"\n | \"id\"\n | \"deleted_at\"\n | \"valid_from\"\n | \"valid_to\"\n | \"created_at\";\n\ntype LiveEdgeColumn =\n LiveColumn | \"from_kind\" | \"from_id\" | \"to_kind\" | \"to_id\";\n\ntype RecordedColumn =\n | \"graph_id\"\n | \"kind\"\n | \"id\"\n | \"valid_from\"\n | \"valid_to\"\n | \"recorded_from\"\n | \"recorded_to\";\n\ntype RecordedEdgeColumn =\n RecordedColumn | \"from_kind\" | \"from_id\" | \"to_kind\" | \"to_id\";\n\ntype SystemIndexColumnsFor<T extends SystemIndexTable> =\n T extends \"nodes\" ? LiveColumn\n : T extends \"edges\" ? LiveEdgeColumn\n : T extends \"recordedNodes\" ? RecordedColumn\n : RecordedEdgeColumn;\n\ntype SystemIndexDeclarationFor<T extends SystemIndexTable> = Readonly<{\n table: T;\n /** Physical index name is `${physicalTableName}_${suffix}`. */\n suffix: string;\n columns: readonly [SystemIndexColumnsFor<T>, ...SystemIndexColumnsFor<T>[]];\n}>;\n\nexport type SystemIndexDeclaration =\n | SystemIndexDeclarationFor<\"nodes\">\n | SystemIndexDeclarationFor<\"edges\">\n | SystemIndexDeclarationFor<\"recordedNodes\">\n | SystemIndexDeclarationFor<\"recordedEdges\">;\n\nexport const SYSTEM_INDEX_DECLARATIONS: readonly SystemIndexDeclaration[] = [\n // ---------------------------------------------------------- nodes\n { table: \"nodes\", suffix: \"kind_idx\", columns: [\"graph_id\", \"kind\"] },\n // Listing shape: kind partition ordered by creation with the\n // soft-delete column ahead of it so `deleted_at IS NULL` list queries\n // stay index-served.\n {\n table: \"nodes\",\n suffix: \"kind_created_idx\",\n columns: [\"graph_id\", \"kind\", \"deleted_at\", \"created_at\"],\n },\n {\n table: \"nodes\",\n suffix: \"deleted_idx\",\n columns: [\"graph_id\", \"deleted_at\"],\n },\n {\n table: \"nodes\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Bare-id lookup: the primary key leads with `kind` (graph_id, kind,\n // id), so a `WHERE graph_id = ? AND id = ?` probe that doesn't know the\n // kind can't seek it — SQLite falls back to a graph_id-only scan of\n // every node in the graph (~3M at LDBC SF1).\n // `store.algorithms.degree`'s node-kind subquery does exactly that\n // lookup (it resolves the seed's kind by id), so without this index\n // degree is a full nodes scan (~95ms at SF1). See typegraph#280.\n { table: \"nodes\", suffix: \"id_idx\", columns: [\"graph_id\", \"id\"] },\n\n // ---------------------------------------------------------- edges\n { table: \"edges\", suffix: \"kind_idx\", columns: [\"graph_id\", \"kind\"] },\n // Directional traversal index (outgoing): supports endpoint lookups\n // and extra filtering by edge kind / target kind. Includes every\n // system column the compiled query's soft-delete/temporal-validity\n // predicate touches (deleted_at, valid_from, valid_to), trailed by\n // to_id — the compiled traversal join reads `n.id = e.to_id` for an\n // outgoing traversal (standard-builders.ts), so without to_id here\n // the join still fetches the edge's heap row for that one column\n // even with the seek/predicate columns covered.\n {\n table: \"edges\",\n suffix: \"from_idx\",\n columns: [\n \"graph_id\",\n \"from_kind\",\n \"from_id\",\n \"kind\",\n \"to_kind\",\n \"deleted_at\",\n \"valid_from\",\n \"valid_to\",\n \"to_id\",\n ],\n },\n // Directional traversal index (incoming): mirrors from_idx for\n // reverse traversals, trailed by from_id for the same reason\n // (`n.id = e.from_id` for an incoming traversal).\n {\n table: \"edges\",\n suffix: \"to_idx\",\n columns: [\n \"graph_id\",\n \"to_kind\",\n \"to_id\",\n \"kind\",\n \"from_kind\",\n \"deleted_at\",\n \"valid_from\",\n \"valid_to\",\n \"from_id\",\n ],\n },\n {\n table: \"edges\",\n suffix: \"kind_created_idx\",\n columns: [\"graph_id\", \"kind\", \"deleted_at\", \"created_at\"],\n },\n {\n table: \"edges\",\n suffix: \"deleted_idx\",\n columns: [\"graph_id\", \"deleted_at\"],\n },\n {\n table: \"edges\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Cardinality enforcement: the one-per-endpoint check probes for a\n // currently-valid edge of a kind from a specific endpoint.\n {\n table: \"edges\",\n suffix: \"cardinality_idx\",\n columns: [\"graph_id\", \"kind\", \"from_kind\", \"from_id\", \"valid_to\"],\n },\n\n // ---------------------------------------------------------- recordedNodes\n {\n table: \"recordedNodes\",\n suffix: \"entity_idx\",\n columns: [\"graph_id\", \"kind\", \"id\", \"recorded_from\", \"recorded_to\"],\n },\n {\n table: \"recordedNodes\",\n suffix: \"open_idx\",\n columns: [\"graph_id\", \"recorded_to\"],\n },\n {\n table: \"recordedNodes\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Bare-id lookup parity with the live nodes table: recorded-pinned\n // reads swap this relation in as the node source, and `entity_idx`\n // leads with `kind`, so the same kind-by-bare-id probe (e.g.\n // `degree()` at a recorded coordinate) would otherwise scan every\n // historical version in the graph. See typegraph#280.\n { table: \"recordedNodes\", suffix: \"id_idx\", columns: [\"graph_id\", \"id\"] },\n\n // ---------------------------------------------------------- recordedEdges\n {\n table: \"recordedEdges\",\n suffix: \"entity_idx\",\n columns: [\"graph_id\", \"kind\", \"id\", \"recorded_from\", \"recorded_to\"],\n },\n {\n table: \"recordedEdges\",\n suffix: \"open_idx\",\n columns: [\"graph_id\", \"recorded_to\"],\n },\n {\n table: \"recordedEdges\",\n suffix: \"from_idx\",\n columns: [\n \"graph_id\",\n \"from_kind\",\n \"from_id\",\n \"kind\",\n \"to_kind\",\n \"recorded_from\",\n \"recorded_to\",\n ],\n },\n {\n table: \"recordedEdges\",\n suffix: \"to_idx\",\n columns: [\n \"graph_id\",\n \"to_kind\",\n \"to_id\",\n \"kind\",\n \"from_kind\",\n \"recorded_from\",\n \"recorded_to\",\n ],\n },\n {\n table: \"recordedEdges\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n];\n\n/** Default physical table names for the system-index relations. */\nconst DEFAULT_SYSTEM_INDEX_TABLE_NAMES: Readonly<\n Record<SystemIndexTable, string>\n> = {\n nodes: \"typegraph_nodes\",\n edges: \"typegraph_edges\",\n recordedNodes: \"typegraph_recorded_nodes\",\n recordedEdges: \"typegraph_recorded_edges\",\n};\n\n/**\n * Resolves the physical table name for a system-index relation, honoring\n * a backend's table-name overrides.\n */\nexport function resolveSystemIndexTableName(\n table: SystemIndexTable,\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): string {\n return overrides?.[table] ?? DEFAULT_SYSTEM_INDEX_TABLE_NAMES[table];\n}\n\n/**\n * PostgreSQL truncates identifiers to NAMEDATALEN-1 = 63 bytes SILENTLY —\n * two suffixes of one long custom table name would collide after\n * truncation, and the catalog probes (which compare by exact name) would\n * never match the stored name, re-attempting the build on every boot.\n * SQLite has no such limit but uses the same bound so the two dialects'\n * index sets stay in byte-for-byte parity. (Char-based like the vector\n * identifier bound — multibyte table names are out of scope.)\n */\nconst MAX_SQL_IDENTIFIER_LENGTH = 63;\n\n/**\n * Physical index name: `${physicalTableName}_${suffix}`, deterministically\n * truncated + hash-suffixed past the 63-char identifier bound so distinct\n * indexes stay distinct. Single choke point — the Drizzle builders, the\n * runtime DDL, the catalog probes, and the status keys all derive the\n * name here, so they can never disagree.\n */\nexport function systemIndexName(\n physicalTableName: string,\n suffix: string,\n): string {\n const full = `${physicalTableName}_${suffix}`;\n if (full.length <= MAX_SQL_IDENTIFIER_LENGTH) return full;\n const hash = shortHash(JSON.stringify([physicalTableName, suffix]));\n return `${full.slice(0, MAX_SQL_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;\n}\n\n/**\n * Every system index name for a deployment's (possibly overridden) table\n * names. Graph-declared index names must not collide with these: a\n * colliding `CREATE INDEX IF NOT EXISTS` would silently no-op against the\n * system index (wrong shape) while recording a false success — see the\n * guards in the schema factories and `materializeIndexes`.\n */\nexport function resolveSystemIndexNames(\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): ReadonlySet<string> {\n return new Set(\n SYSTEM_INDEX_DECLARATIONS.map((declaration) =>\n systemIndexName(\n resolveSystemIndexTableName(declaration.table, overrides),\n declaration.suffix,\n ),\n ),\n );\n}\n\n/**\n * Rejects graph-declared indexes whose names collide with this\n * deployment's system index names. Called by both dialect schema\n * factories so a colliding declaration fails at table-definition time\n * instead of silently no-opping against the (differently shaped) system\n * index at CREATE INDEX IF NOT EXISTS time. `materializeIndexes` applies\n * the same check per-declaration on its runtime path.\n */\nexport function assertNoSystemIndexNameCollision(\n indexes: readonly Readonly<{ name: string }>[],\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): void {\n if (indexes.length === 0) return;\n const reserved = resolveSystemIndexNames(overrides);\n for (const index of indexes) {\n if (reserved.has(index.name)) {\n throw new Error(\n `Index name \"${index.name}\" collides with a TypeGraph system ` +\n `index. Choose a different name — system index names are ` +\n `reserved, and a same-named CREATE INDEX IF NOT EXISTS would ` +\n `silently no-op against the system index instead of creating ` +\n `the declared one.`,\n );\n }\n }\n}\n\n/**\n * Runtime DDL for one system index — byte-compatible with the index the\n * bootstrap path creates from the Drizzle schema (same name, same\n * columns), plus `CONCURRENTLY` where the dialect supports building\n * without blocking writes.\n */\nexport function generateSystemIndexDDL(\n declaration: SystemIndexDeclaration,\n physicalTableName: string,\n options: Readonly<{ concurrent: boolean }>,\n): string {\n const name = quoteIdentifier(\n systemIndexName(physicalTableName, declaration.suffix),\n );\n const table = quoteIdentifier(physicalTableName);\n const columns = declaration.columns\n .map((column) => quoteIdentifier(column))\n .join(\", \");\n const concurrently = options.concurrent ? \"CONCURRENTLY \" : \"\";\n return `CREATE INDEX ${concurrently}IF NOT EXISTS ${name} ON ${table} (${columns});`;\n}\n"]}
1
+ {"version":3,"sources":["../src/indexes/system.ts"],"names":["shortHash","quoteIdentifier"],"mappings":";;;;;AA6EO,IAAM,yBAAA,GAA+D;AAAA;AAAA,EAE1E,EAAE,OAAO,OAAA,EAAS,MAAA,EAAQ,YAAY,OAAA,EAAS,CAAC,UAAA,EAAY,MAAM,CAAA,EAAE;AAAA;AAAA;AAAA;AAAA,EAIpE;AAAA,IACE,KAAA,EAAO,OAAA;AAAA,IACP,MAAA,EAAQ,kBAAA;AAAA,IACR,OAAA,EAAS,CAAC,UAAA,EAAY,MAAA,EAAQ,cAAc,YAAY;AAAA,GAC1D;AAAA,EACA;AAAA,IACE,KAAA,EAAO,OAAA;AAAA,IACP,MAAA,EAAQ,aAAA;AAAA,IACR,OAAA,EAAS,CAAC,UAAA,EAAY,YAAY;AAAA,GACpC;AAAA,EACA;AAAA,IACE,KAAA,EAAO,OAAA;AAAA,IACP,MAAA,EAAQ,WAAA;AAAA,IACR,OAAA,EAAS,CAAC,UAAA,EAAY,YAAA,EAAc,UAAU;AAAA,GAChD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AAC,WAAA,KAC7B,eAAA;AAAA,QACE,2BAAA,CAA4B,WAAA,CAAY,KAAA,EAAO,SAAS,CAAA;AAAA,QACxD,WAAA,CAAY;AAAA;AACd;AACF,GACF;AACF;AAUO,SAAS,gCAAA,CACd,SACA,SAAA,EAEM;AACN,EAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC1B,EAAA,MAAM,QAAA,GAAW,wBAAwB,SAAS,CAAA;AAClD,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,IAAI,QAAA,CAAS,GAAA,CAAI,KAAA,CAAM,IAAI,CAAA,EAAG;AAC5B,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,YAAA,EAAe,MAAM,IAAI,CAAA,yOAAA;AAAA,OAK3B;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,sBAAA,CACd,WAAA,EACA,iBAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,IAAA,GAAOC,iCAAA;AAAA,IACX,eAAA,CAAgB,iBAAA,EAAmB,WAAA,CAAY,MAAM;AAAA,GACvD;AACA,EAAA,MAAM,KAAA,GAAQA,kCAAgB,iBAAiB,CAAA;AAC/C,EAAA,MAAM,OAAA,GAAU,WAAA,CAAY,OAAA,CACzB,GAAA,CAAI,CAAC,MAAA,KAAWA,iCAAA,CAAgB,MAAM,CAAC,CAAA,CACvC,IAAA,CAAK,IAAI,CAAA;AACZ,EAAA,MAAM,YAAA,GAAe,OAAA,CAAQ,UAAA,GAAa,eAAA,GAAkB,EAAA;AAC5D,EAAA,OAAO,gBAAgB,YAAY,CAAA,cAAA,EAAiB,IAAI,CAAA,IAAA,EAAO,KAAK,KAAK,OAAO,CAAA,EAAA,CAAA;AAClF","file":"chunk-TRC646QQ.cjs","sourcesContent":["/**\n * System-index declarations — the single source of truth for the plain\n * btree indexes TypeGraph ships on its own relations.\n *\n * Both dialect schema factories (`createSqliteTables` /\n * `createPostgresTables`) derive their Drizzle index builders from this\n * list, so the two dialects cannot drift, and\n * `materializeSystemIndexes()` derives the same indexes as runtime DDL so\n * an index added in a new library version reaches already-initialized\n * databases (bootstrap DDL only runs on first boot — see\n * `loadActiveSchemaWithBootstrap`).\n *\n * Scope: non-unique btree column indexes on the four graph relations,\n * where performance iteration actually happens. Primary keys, unique /\n * partial-unique constraints, and status-table indexes are structural —\n * they are created with their table and never retrofitted — and stay in\n * the schema files.\n *\n * Changing a declaration's shape under the same suffix is a signature\n * drift: `materializeSystemIndexes` reports `failed` for it until the\n * operator drops the old physical index. Rename (new suffix) instead,\n * exactly like graph-declared indexes. Two acknowledged limits of that\n * contract: on databases whose indexes were bootstrap-created (no status\n * rows) an in-place reshape is undetectable at runtime — the rename rule\n * is enforced by review and the parity tests; and a renamed suffix\n * strands the old physical index (the runner only adds). When the first\n * rename actually happens, add a retired-suffixes list + drop path here.\n */\nimport { quoteIdentifier, shortHash } from \"../query/dialect/vector-strategy\";\n\n/** The TypeGraph relations that carry system indexes. */\nexport type SystemIndexTable =\n \"nodes\" | \"edges\" | \"recordedNodes\" | \"recordedEdges\";\n\ntype LiveColumn =\n | \"graph_id\"\n | \"kind\"\n | \"id\"\n | \"deleted_at\"\n | \"valid_from\"\n | \"valid_to\"\n | \"created_at\";\n\ntype LiveEdgeColumn =\n LiveColumn | \"from_kind\" | \"from_id\" | \"to_kind\" | \"to_id\";\n\ntype RecordedColumn =\n | \"graph_id\"\n | \"kind\"\n | \"id\"\n | \"valid_from\"\n | \"valid_to\"\n | \"recorded_from\"\n | \"recorded_to\";\n\ntype RecordedEdgeColumn =\n RecordedColumn | \"from_kind\" | \"from_id\" | \"to_kind\" | \"to_id\";\n\ntype SystemIndexColumnsFor<T extends SystemIndexTable> =\n T extends \"nodes\" ? LiveColumn\n : T extends \"edges\" ? LiveEdgeColumn\n : T extends \"recordedNodes\" ? RecordedColumn\n : RecordedEdgeColumn;\n\ntype SystemIndexDeclarationFor<T extends SystemIndexTable> = Readonly<{\n table: T;\n /** Physical index name is `${physicalTableName}_${suffix}`. */\n suffix: string;\n columns: readonly [SystemIndexColumnsFor<T>, ...SystemIndexColumnsFor<T>[]];\n}>;\n\nexport type SystemIndexDeclaration =\n | SystemIndexDeclarationFor<\"nodes\">\n | SystemIndexDeclarationFor<\"edges\">\n | SystemIndexDeclarationFor<\"recordedNodes\">\n | SystemIndexDeclarationFor<\"recordedEdges\">;\n\nexport const SYSTEM_INDEX_DECLARATIONS: readonly SystemIndexDeclaration[] = [\n // ---------------------------------------------------------- nodes\n { table: \"nodes\", suffix: \"kind_idx\", columns: [\"graph_id\", \"kind\"] },\n // Listing shape: kind partition ordered by creation with the\n // soft-delete column ahead of it so `deleted_at IS NULL` list queries\n // stay index-served.\n {\n table: \"nodes\",\n suffix: \"kind_created_idx\",\n columns: [\"graph_id\", \"kind\", \"deleted_at\", \"created_at\"],\n },\n {\n table: \"nodes\",\n suffix: \"deleted_idx\",\n columns: [\"graph_id\", \"deleted_at\"],\n },\n {\n table: \"nodes\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Bare-id lookup: the primary key leads with `kind` (graph_id, kind,\n // id), so a `WHERE graph_id = ? AND id = ?` probe that doesn't know the\n // kind can't seek it — SQLite falls back to a graph_id-only scan of\n // every node in the graph (~3M at LDBC SF1).\n // `store.algorithms.degree`'s node-kind subquery does exactly that\n // lookup (it resolves the seed's kind by id), so without this index\n // degree is a full nodes scan (~95ms at SF1). See typegraph#280.\n { table: \"nodes\", suffix: \"id_idx\", columns: [\"graph_id\", \"id\"] },\n\n // ---------------------------------------------------------- edges\n { table: \"edges\", suffix: \"kind_idx\", columns: [\"graph_id\", \"kind\"] },\n // Directional traversal index (outgoing): supports endpoint lookups\n // and extra filtering by edge kind / target kind. Includes every\n // system column the compiled query's soft-delete/temporal-validity\n // predicate touches (deleted_at, valid_from, valid_to), trailed by\n // to_id — the compiled traversal join reads `n.id = e.to_id` for an\n // outgoing traversal (standard-builders.ts), so without to_id here\n // the join still fetches the edge's heap row for that one column\n // even with the seek/predicate columns covered.\n {\n table: \"edges\",\n suffix: \"from_idx\",\n columns: [\n \"graph_id\",\n \"from_kind\",\n \"from_id\",\n \"kind\",\n \"to_kind\",\n \"deleted_at\",\n \"valid_from\",\n \"valid_to\",\n \"to_id\",\n ],\n },\n // Directional traversal index (incoming): mirrors from_idx for\n // reverse traversals, trailed by from_id for the same reason\n // (`n.id = e.from_id` for an incoming traversal).\n {\n table: \"edges\",\n suffix: \"to_idx\",\n columns: [\n \"graph_id\",\n \"to_kind\",\n \"to_id\",\n \"kind\",\n \"from_kind\",\n \"deleted_at\",\n \"valid_from\",\n \"valid_to\",\n \"from_id\",\n ],\n },\n {\n table: \"edges\",\n suffix: \"kind_created_idx\",\n columns: [\"graph_id\", \"kind\", \"deleted_at\", \"created_at\"],\n },\n {\n table: \"edges\",\n suffix: \"deleted_idx\",\n columns: [\"graph_id\", \"deleted_at\"],\n },\n {\n table: \"edges\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Cardinality enforcement: the one-per-endpoint check probes for a\n // currently-valid edge of a kind from a specific endpoint.\n {\n table: \"edges\",\n suffix: \"cardinality_idx\",\n columns: [\"graph_id\", \"kind\", \"from_kind\", \"from_id\", \"valid_to\"],\n },\n\n // ---------------------------------------------------------- recordedNodes\n {\n table: \"recordedNodes\",\n suffix: \"entity_idx\",\n columns: [\"graph_id\", \"kind\", \"id\", \"recorded_from\", \"recorded_to\"],\n },\n {\n table: \"recordedNodes\",\n suffix: \"open_idx\",\n columns: [\"graph_id\", \"recorded_to\"],\n },\n {\n table: \"recordedNodes\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Bare-id lookup parity with the live nodes table: recorded-pinned\n // reads swap this relation in as the node source, and `entity_idx`\n // leads with `kind`, so the same kind-by-bare-id probe (e.g.\n // `degree()` at a recorded coordinate) would otherwise scan every\n // historical version in the graph. See typegraph#280.\n { table: \"recordedNodes\", suffix: \"id_idx\", columns: [\"graph_id\", \"id\"] },\n\n // ---------------------------------------------------------- recordedEdges\n {\n table: \"recordedEdges\",\n suffix: \"entity_idx\",\n columns: [\"graph_id\", \"kind\", \"id\", \"recorded_from\", \"recorded_to\"],\n },\n {\n table: \"recordedEdges\",\n suffix: \"open_idx\",\n columns: [\"graph_id\", \"recorded_to\"],\n },\n {\n table: \"recordedEdges\",\n suffix: \"from_idx\",\n columns: [\n \"graph_id\",\n \"from_kind\",\n \"from_id\",\n \"kind\",\n \"to_kind\",\n \"recorded_from\",\n \"recorded_to\",\n ],\n },\n {\n table: \"recordedEdges\",\n suffix: \"to_idx\",\n columns: [\n \"graph_id\",\n \"to_kind\",\n \"to_id\",\n \"kind\",\n \"from_kind\",\n \"recorded_from\",\n \"recorded_to\",\n ],\n },\n {\n table: \"recordedEdges\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n];\n\n/** Default physical table names for the system-index relations. */\nconst DEFAULT_SYSTEM_INDEX_TABLE_NAMES: Readonly<\n Record<SystemIndexTable, string>\n> = {\n nodes: \"typegraph_nodes\",\n edges: \"typegraph_edges\",\n recordedNodes: \"typegraph_recorded_nodes\",\n recordedEdges: \"typegraph_recorded_edges\",\n};\n\n/**\n * Resolves the physical table name for a system-index relation, honoring\n * a backend's table-name overrides.\n */\nexport function resolveSystemIndexTableName(\n table: SystemIndexTable,\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): string {\n return overrides?.[table] ?? DEFAULT_SYSTEM_INDEX_TABLE_NAMES[table];\n}\n\n/**\n * PostgreSQL truncates identifiers to NAMEDATALEN-1 = 63 bytes SILENTLY —\n * two suffixes of one long custom table name would collide after\n * truncation, and the catalog probes (which compare by exact name) would\n * never match the stored name, re-attempting the build on every boot.\n * SQLite has no such limit but uses the same bound so the two dialects'\n * index sets stay in byte-for-byte parity. (Char-based like the vector\n * identifier bound — multibyte table names are out of scope.)\n */\nconst MAX_SQL_IDENTIFIER_LENGTH = 63;\n\n/**\n * Physical index name: `${physicalTableName}_${suffix}`, deterministically\n * truncated + hash-suffixed past the 63-char identifier bound so distinct\n * indexes stay distinct. Single choke point — the Drizzle builders, the\n * runtime DDL, the catalog probes, and the status keys all derive the\n * name here, so they can never disagree.\n */\nexport function systemIndexName(\n physicalTableName: string,\n suffix: string,\n): string {\n const full = `${physicalTableName}_${suffix}`;\n if (full.length <= MAX_SQL_IDENTIFIER_LENGTH) return full;\n const hash = shortHash(JSON.stringify([physicalTableName, suffix]));\n return `${full.slice(0, MAX_SQL_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;\n}\n\n/**\n * Every system index name for a deployment's (possibly overridden) table\n * names. Graph-declared index names must not collide with these: a\n * colliding `CREATE INDEX IF NOT EXISTS` would silently no-op against the\n * system index (wrong shape) while recording a false success — see the\n * guards in the schema factories and `materializeIndexes`.\n */\nexport function resolveSystemIndexNames(\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): ReadonlySet<string> {\n return new Set(\n SYSTEM_INDEX_DECLARATIONS.map((declaration) =>\n systemIndexName(\n resolveSystemIndexTableName(declaration.table, overrides),\n declaration.suffix,\n ),\n ),\n );\n}\n\n/**\n * Rejects graph-declared indexes whose names collide with this\n * deployment's system index names. Called by both dialect schema\n * factories so a colliding declaration fails at table-definition time\n * instead of silently no-opping against the (differently shaped) system\n * index at CREATE INDEX IF NOT EXISTS time. `materializeIndexes` applies\n * the same check per-declaration on its runtime path.\n */\nexport function assertNoSystemIndexNameCollision(\n indexes: readonly Readonly<{ name: string }>[],\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): void {\n if (indexes.length === 0) return;\n const reserved = resolveSystemIndexNames(overrides);\n for (const index of indexes) {\n if (reserved.has(index.name)) {\n throw new Error(\n `Index name \"${index.name}\" collides with a TypeGraph system ` +\n `index. Choose a different name — system index names are ` +\n `reserved, and a same-named CREATE INDEX IF NOT EXISTS would ` +\n `silently no-op against the system index instead of creating ` +\n `the declared one.`,\n );\n }\n }\n}\n\n/**\n * Runtime DDL for one system index — byte-compatible with the index the\n * bootstrap path creates from the Drizzle schema (same name, same\n * columns), plus `CONCURRENTLY` where the dialect supports building\n * without blocking writes.\n */\nexport function generateSystemIndexDDL(\n declaration: SystemIndexDeclaration,\n physicalTableName: string,\n options: Readonly<{ concurrent: boolean }>,\n): string {\n const name = quoteIdentifier(\n systemIndexName(physicalTableName, declaration.suffix),\n );\n const table = quoteIdentifier(physicalTableName);\n const columns = declaration.columns\n .map((column) => quoteIdentifier(column))\n .join(\", \");\n const concurrently = options.concurrent ? \"CONCURRENTLY \" : \"\";\n return `CREATE INDEX ${concurrently}IF NOT EXISTS ${name} ON ${table} (${columns});`;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkXDMPDUKL_cjs = require('./chunk-XDMPDUKL.cjs');
4
+
5
+ // src/graph-extension/define-graph-extension.ts
6
+ function defineGraphExtension(input) {
7
+ return chunkXDMPDUKL_cjs.unwrap(chunkXDMPDUKL_cjs.validateGraphExtension(input, { strict: true }));
8
+ }
9
+
10
+ exports.defineGraphExtension = defineGraphExtension;
11
+ //# sourceMappingURL=chunk-U3YRCZ5L.cjs.map
12
+ //# sourceMappingURL=chunk-U3YRCZ5L.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph-extension/define-graph-extension.ts"],"names":["unwrap","validateGraphExtension"],"mappings":";;;;;AAyDO,SAAS,qBAAqB,KAAA,EAAuC;AAC1E,EAAA,OAAOA,yBAAOC,wCAAA,CAAuB,KAAA,EAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA;AAC/D","file":"chunk-IMQKXL4E.cjs","sourcesContent":["/**\n * Public entry for declaring a graph extension.\n *\n * Pure value: validates the input, deeply freezes the result, and returns\n * a `GraphExtension`. Invalid documents throw\n * `GraphExtensionValidationError` carrying every issue with a\n * JSON-pointer `path` to the offending field.\n */\nimport { unwrap } from \"../utils/result\";\nimport { type GraphExtension } from \"./extension-types\";\nimport { validateGraphExtension } from \"./validation\";\n\n/**\n * Validates and freezes a graph-extension document.\n *\n * Authoring entry point — runs validation in **strict** mode: unknown\n * top-level keys (e.g. `node` instead of `nodes`) and unsupported\n * string formats (e.g. `\"date-time\"` with a hyphen instead of\n * `\"datetime\"`) fail loudly with `UNKNOWN_DOCUMENT_KEY` /\n * `UNSUPPORTED_STRING_FORMAT`. The persistence-load path leaves both\n * checks off so a document committed by a future v1.x writer with\n * additive fields still parses on an older v1 reader. Callers\n * accepting raw JSON from an untyped source (e.g. an LLM proposal)\n * should validate first via `validateGraphExtension` and surface\n * the structured issues, then pass the validated document here.\n *\n * @param input - Document describing additional node kinds, edge\n * kinds, and ontology relations. Must satisfy the v1 property-type\n * subset documented in `ExtensionPropertyType`.\n *\n * @returns The same document, deeply frozen and shape-checked.\n *\n * @throws {GraphExtensionValidationError} when the document violates\n * the v1 property-type subset, references undeclared kinds, contains\n * ontology cycles, etc. The thrown error's `details.issues` array\n * carries every failure with a JSON-pointer path.\n * @throws {GraphExtensionVersionUnsupportedError} when the document\n * declares a future major version this library cannot safely decode.\n *\n * @example\n * ```typescript\n * const extension = defineGraphExtension({\n * nodes: {\n * Paper: {\n * properties: {\n * doi: { type: \"string\" },\n * title: { type: \"string\", searchable: { language: \"english\" } },\n * },\n * unique: [{ name: \"paper_doi\", fields: [\"doi\"] }],\n * },\n * },\n * });\n *\n * const evolved = await store.evolve(extension);\n * const papers = evolved.getNodeCollectionOrThrow(\"Paper\");\n * ```\n */\nexport function defineGraphExtension(input: GraphExtension): GraphExtension {\n return unwrap(validateGraphExtension(input, { strict: true }));\n}\n"]}
1
+ {"version":3,"sources":["../src/graph-extension/define-graph-extension.ts"],"names":["unwrap","validateGraphExtension"],"mappings":";;;;;AAyDO,SAAS,qBAAqB,KAAA,EAAuC;AAC1E,EAAA,OAAOA,yBAAOC,wCAAA,CAAuB,KAAA,EAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA;AAC/D","file":"chunk-U3YRCZ5L.cjs","sourcesContent":["/**\n * Public entry for declaring a graph extension.\n *\n * Pure value: validates the input, deeply freezes the result, and returns\n * a `GraphExtension`. Invalid documents throw\n * `GraphExtensionValidationError` carrying every issue with a\n * JSON-pointer `path` to the offending field.\n */\nimport { unwrap } from \"../utils/result\";\nimport { type GraphExtension } from \"./extension-types\";\nimport { validateGraphExtension } from \"./validation\";\n\n/**\n * Validates and freezes a graph-extension document.\n *\n * Authoring entry point — runs validation in **strict** mode: unknown\n * top-level keys (e.g. `node` instead of `nodes`) and unsupported\n * string formats (e.g. `\"date-time\"` with a hyphen instead of\n * `\"datetime\"`) fail loudly with `UNKNOWN_DOCUMENT_KEY` /\n * `UNSUPPORTED_STRING_FORMAT`. The persistence-load path leaves both\n * checks off so a document committed by a future v1.x writer with\n * additive fields still parses on an older v1 reader. Callers\n * accepting raw JSON from an untyped source (e.g. an LLM proposal)\n * should validate first via `validateGraphExtension` and surface\n * the structured issues, then pass the validated document here.\n *\n * @param input - Document describing additional node kinds, edge\n * kinds, and ontology relations. Must satisfy the v1 property-type\n * subset documented in `ExtensionPropertyType`.\n *\n * @returns The same document, deeply frozen and shape-checked.\n *\n * @throws {GraphExtensionValidationError} when the document violates\n * the v1 property-type subset, references undeclared kinds, contains\n * ontology cycles, etc. The thrown error's `details.issues` array\n * carries every failure with a JSON-pointer path.\n * @throws {GraphExtensionVersionUnsupportedError} when the document\n * declares a future major version this library cannot safely decode.\n *\n * @example\n * ```typescript\n * const extension = defineGraphExtension({\n * nodes: {\n * Paper: {\n * properties: {\n * doi: { type: \"string\" },\n * title: { type: \"string\", searchable: { language: \"english\" } },\n * },\n * unique: [{ name: \"paper_doi\", fields: [\"doi\"] }],\n * },\n * },\n * });\n *\n * const evolved = await store.evolve(extension);\n * const papers = evolved.getNodeCollectionOrThrow(\"Paper\");\n * ```\n */\nexport function defineGraphExtension(input: GraphExtension): GraphExtension {\n return unwrap(validateGraphExtension(input, { strict: true }));\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { SYSTEM_INDEX_DECLARATIONS, systemIndexName } from './chunk-AQVDAKXH.js';
2
- import { compileNodeIndexKeys, compileIndexWhere, compileEdgeIndexKeys } from './chunk-Y5UC3IXF.js';
3
- import { isSqlFragment, renderSql, throwUnsupportedSqlChunk, bindSqlValue, sql as sql$1 } from './chunk-6N7QBIWN.js';
1
+ import { SYSTEM_INDEX_DECLARATIONS, systemIndexName } from './chunk-4XRP2N6B.js';
2
+ import { compileNodeIndexKeys, compileIndexWhere, compileEdgeIndexKeys } from './chunk-42XYPKZU.js';
3
+ import { isSqlFragment, renderSql, throwUnsupportedSqlChunk, bindSqlValue, sql as sql$1 } from './chunk-M4GYQF2H.js';
4
4
  import { uniqueIndex, index } from 'drizzle-orm/pg-core';
5
5
  import { uniqueIndex as uniqueIndex$1, index as index$1 } from 'drizzle-orm/sqlite-core';
6
6
  import { sql } from 'drizzle-orm';
@@ -379,5 +379,5 @@ function assertNonEmpty(values, label) {
379
379
  }
380
380
 
381
381
  export { buildPostgresEdgeIndexBuilders, buildPostgresNodeIndexBuilders, buildPostgresSystemIndexBuilders, buildSqliteEdgeIndexBuilders, buildSqliteNodeIndexBuilders, buildSqliteSystemIndexBuilders, compileQueryWithDialect, toDrizzleSql };
382
- //# sourceMappingURL=chunk-ZVME6OSV.js.map
383
- //# sourceMappingURL=chunk-ZVME6OSV.js.map
382
+ //# sourceMappingURL=chunk-UJRWOV5B.js.map
383
+ //# sourceMappingURL=chunk-UJRWOV5B.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/backend/drizzle/execution/types.ts","../src/indexes/drizzle.ts"],"names":["drizzleSql","index","sql","pgUniqueIndex","pgIndex","sqliteUniqueIndex","sqliteIndex"],"mappings":";;;;;;;AA2DA,IAAM,uBAAA,GAA0B;AAAA,EAC9B,UAAA,EAAY,UAAA;AAAA,EACZ,MAAA,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AEO,SAAS,8BAAA,CACd,QAAA,EACA,iBAAA,EACA,OAAA,EAC+B;AAC/B,EAAA,OAAO,wBAAA;AAAA,IACL,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,OAAA;AAAA,IACA,CAAC,IAAA,KAASA,OAAA,CAAY,IAAI;AAAA,GAC5B;AACF;AAEO,SAAS,gCAAA,CACd,QAAA,EACA,iBAAA,EACA,OAAA,EAC2B;AAC3B,EAAA,OAAO,wBAAA;AAAA,IACL,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,OAAA;AAAA,IACA,CAAC,IAAA,KAASF,KAAA,CAAQ,IAAI;AAAA,GACxB;AACF;AAqCA,SAAS,cAAA,CACP,QACA,KAAA,EACwC;AACxC,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG;AACvB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kCAAA,EAAqC,KAAK,CAAA,CAAA,CAAG,CAAA;AAAA,EAC/D;AACF","file":"chunk-ZVME6OSV.js","sourcesContent":["import { type SQL as DrizzleSql, sql as drizzleSql } from \"drizzle-orm\";\n\nimport { bindSqlValue } from \"../../../query/dialect/profile\";\nimport { type SqlDialect } from \"../../../query/dialect/types\";\nimport {\n isSqlFragment,\n renderSql,\n type SqlFragment,\n throwUnsupportedSqlChunk,\n} from \"../../../query/sql-fragment\";\n\nexport type ExecutableSql = DrizzleSql | SqlFragment;\n\nexport type CompiledSqlQuery = Readonly<{\n params: readonly unknown[];\n sql: string;\n}>;\n\nexport type PreparedSqlStatement = Readonly<{\n execute: <TRow>(params: readonly unknown[]) => Promise<readonly TRow[]>;\n}>;\n\nexport type SqlExecutionAdapter = Readonly<{\n compile: (query: ExecutableSql) => CompiledSqlQuery;\n execute: <TRow>(query: ExecutableSql) => Promise<readonly TRow[]>;\n executeCompiled?: <TRow>(\n compiledQuery: CompiledSqlQuery,\n ) => Promise<readonly TRow[]>;\n prepare?: (sqlText: string) => PreparedSqlStatement;\n /**\n * Runs `critical` with exclusive use of the connection: no statement from\n * anywhere else can interleave with the ones it issues.\n *\n * Statement-at-a-time serialization is not enough for a *sequence* that must\n * be atomic. `SET LOCAL` around a query is the motivating case — snapshot,\n * set, select, restore. Two searches whose statements merely take turns can\n * still interleave as `A snapshot → B snapshot → A set → B set → A select`,\n * and `A` then runs under `B`'s settings.\n *\n * `critical` is handed the unqueued adapter, so it must not attempt to\n * re-enter the queue. Present only on transaction-scoped (serialized)\n * adapters; a pooled adapter needs no exclusion because every statement gets\n * its own connection.\n */\n runExclusive?: <T>(\n critical: (connection: SqlExecutionAdapter) => Promise<T>,\n ) => Promise<T>;\n}>;\n\ntype SqlCompiler = Readonly<{\n sqlToQuery: (query: DrizzleSql) => CompiledSqlQuery;\n}>;\n\ntype DatabaseWithCompiler = Readonly<{\n dialect?: SqlCompiler;\n}>;\n\ntype BackendName = \"PostgreSQL\" | \"SQLite\";\n\nconst DIALECT_BY_BACKEND_NAME = {\n PostgreSQL: \"postgres\",\n SQLite: \"sqlite\",\n} as const satisfies Record<BackendName, SqlDialect>;\n\nexport function compileQueryWithDialect(\n db: unknown,\n query: ExecutableSql,\n backendName: BackendName,\n): CompiledSqlQuery {\n if (isSqlFragment(query)) {\n return renderSql(query, DIALECT_BY_BACKEND_NAME[backendName]);\n }\n const databaseWithCompiler = db as DatabaseWithCompiler;\n const compiler = databaseWithCompiler.dialect;\n if (compiler === undefined) {\n throw new Error(`${backendName} backend is missing a SQL compiler`);\n }\n return compiler.sqlToQuery(query);\n}\n\n/**\n * Translates TypeGraph's fragment IR into Drizzle's adapter-native SQL object.\n *\n * Most execution paths render directly to text and parameters. Async SQLite\n * drivers expose only Drizzle's execution method, so that adapter needs this\n * lossless bridge at its final boundary.\n */\nexport function toDrizzleSql(\n fragment: SqlFragment,\n dialect: SqlDialect,\n): DrizzleSql {\n const chunks = fragment.chunks.map((chunk) => {\n switch (chunk.kind) {\n case \"text\": {\n return drizzleSql.raw(chunk.value);\n }\n case \"identifier\": {\n // Drizzle's schema builders treat Name chunks as bare index-column\n // references and omit dialect quoting. Preserve the portable IR's\n // identifier semantics by handing the adapter an already-quoted,\n // trusted SQL token instead.\n return drizzleSql.raw(`\"${chunk.value.replaceAll('\"', '\"\"')}\"`);\n }\n case \"parameter\": {\n return drizzleSql.param(bindSqlValue(chunk.value, dialect));\n }\n case \"placeholder\": {\n return drizzleSql.placeholder(chunk.value.name);\n }\n default: {\n return throwUnsupportedSqlChunk(chunk);\n }\n }\n });\n return drizzleSql.join(chunks);\n}\n","import { type SQLWrapper } from \"drizzle-orm\";\nimport {\n index as pgIndex,\n type IndexBuilder as PgIndexBuilder,\n type PgColumn,\n uniqueIndex as pgUniqueIndex,\n} from \"drizzle-orm/pg-core\";\nimport {\n index as sqliteIndex,\n type IndexBuilder as SqliteIndexBuilder,\n type SQLiteColumn,\n uniqueIndex as sqliteUniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\n\nimport { toDrizzleSql } from \"../backend/drizzle/execution/types\";\nimport { sql as portableSql, type SqlFragment } from \"../query/sql-fragment\";\nimport {\n compileEdgeIndexKeys,\n compileIndexWhere,\n compileNodeIndexKeys,\n type IndexCompilationContext,\n} from \"./compiler\";\nimport {\n SYSTEM_INDEX_DECLARATIONS,\n type SystemIndexDeclaration,\n systemIndexName,\n type SystemIndexTable,\n} from \"./system\";\nimport {\n type EdgeIndexDeclaration,\n type IndexDeclaration,\n type NodeIndexDeclaration,\n type SystemColumnName,\n} from \"./types\";\n\n// ============================================================\n// PostgreSQL (Drizzle Schema)\n// ============================================================\n\nexport function buildPostgresNodeIndexBuilders(\n table: NodeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly PgIndexBuilder[] {\n // GIN-family declarations (method: \"gin\" / \"trigram\") are\n // materialize-only — like pgvector ANN indexes, they are a pure\n // materialization concern and never ride the Drizzle table extras.\n const nodeIndexes = indexes.filter(\n (index): index is NodeIndexDeclaration =>\n index.entity === \"node\" && index.method === undefined,\n );\n\n return nodeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getPostgresNodeSystemColumn(table, column).name);\n\n const { keys } = compileNodeIndexKeys(\n index,\n \"postgres\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `node index \"${index.name}\"`);\n\n const base = index.unique ? pgUniqueIndex(index.name) : pgIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"postgres\"));\n assertNonEmpty(drizzleKeys, `node index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"postgres\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"postgres\"),\n );\n }\n\n return builder;\n });\n}\n\nexport function buildPostgresEdgeIndexBuilders(\n table: EdgeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly PgIndexBuilder[] {\n const edgeIndexes = indexes.filter(\n (index): index is EdgeIndexDeclaration =>\n index.entity === \"edge\" && index.method === undefined,\n );\n\n return edgeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getPostgresEdgeSystemColumn(table, column).name);\n\n const { keys } = compileEdgeIndexKeys(\n index,\n \"postgres\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `edge index \"${index.name}\"`);\n\n const base = index.unique ? pgUniqueIndex(index.name) : pgIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"postgres\"));\n assertNonEmpty(drizzleKeys, `edge index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"postgres\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"postgres\"),\n );\n }\n\n return builder;\n });\n}\n\nfunction getPostgresNodeSystemColumn(\n table: NodeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\":\n case \"from_id\":\n case \"to_kind\":\n case \"to_id\": {\n throw new Error(`Unsupported node system column for indexes: ${column}`);\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n return table.version;\n }\n }\n}\n\nfunction getPostgresEdgeSystemColumn(\n table: EdgeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\": {\n return table.fromKind;\n }\n case \"from_id\": {\n return table.fromId;\n }\n case \"to_kind\": {\n return table.toKind;\n }\n case \"to_id\": {\n return table.toId;\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n throw new Error(`Unsupported edge system column for indexes: ${column}`);\n }\n }\n}\n\n// ============================================================\n// SQLite (Drizzle Schema)\n// ============================================================\n\nexport function buildSqliteNodeIndexBuilders(\n table: NodeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly SqliteIndexBuilder[] {\n // GIN-family declarations (method: \"gin\" / \"trigram\") are\n // materialize-only — like pgvector ANN indexes, they are a pure\n // materialization concern and never ride the Drizzle table extras.\n const nodeIndexes = indexes.filter(\n (index): index is NodeIndexDeclaration =>\n index.entity === \"node\" && index.method === undefined,\n );\n\n return nodeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getSqliteNodeSystemColumn(table, column).name);\n\n const { keys } = compileNodeIndexKeys(\n index,\n \"sqlite\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `node index \"${index.name}\"`);\n\n const base =\n index.unique ? sqliteUniqueIndex(index.name) : sqliteIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"sqlite\"));\n assertNonEmpty(drizzleKeys, `node index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"sqlite\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"sqlite\"),\n );\n }\n\n return builder;\n });\n}\n\nexport function buildSqliteEdgeIndexBuilders(\n table: EdgeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly SqliteIndexBuilder[] {\n const edgeIndexes = indexes.filter(\n (index): index is EdgeIndexDeclaration =>\n index.entity === \"edge\" && index.method === undefined,\n );\n\n return edgeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getSqliteEdgeSystemColumn(table, column).name);\n\n const { keys } = compileEdgeIndexKeys(\n index,\n \"sqlite\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `edge index \"${index.name}\"`);\n\n const base =\n index.unique ? sqliteUniqueIndex(index.name) : sqliteIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"sqlite\"));\n assertNonEmpty(drizzleKeys, `edge index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"sqlite\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"sqlite\"),\n );\n }\n\n return builder;\n });\n}\n\nfunction getSqliteNodeSystemColumn(\n table: NodeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\":\n case \"from_id\":\n case \"to_kind\":\n case \"to_id\": {\n throw new Error(`Unsupported node system column for indexes: ${column}`);\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n return table.version;\n }\n }\n}\n\nfunction getSqliteEdgeSystemColumn(\n table: EdgeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\": {\n return table.fromKind;\n }\n case \"from_id\": {\n return table.fromId;\n }\n case \"to_kind\": {\n return table.toKind;\n }\n case \"to_id\": {\n return table.toId;\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n throw new Error(`Unsupported edge system column for indexes: ${column}`);\n }\n }\n}\n\n// ============================================================\n// System indexes (both dialects)\n// ============================================================\n//\n// The schema factories derive their system-index Drizzle builders from\n// `SYSTEM_INDEX_DECLARATIONS` so both dialects emit the same index set by\n// construction. The builders receive the table's real column objects (not\n// SQL wrappers) so the DDL generator renders plain quoted column names —\n// byte-identical to the runtime DDL `materializeSystemIndexes` emits.\n\ntype SystemIndexColumns<C extends { name: string }> = Readonly<\n Record<string, C>\n>;\n\n/**\n * Resolves a declaration's physical column names against the table's own\n * column objects by each column's `.name` — the SQL name Drizzle carries on\n * the column itself — so no naming convention sits between the declaration\n * and the schema. A column the table doesn't define throws at\n * table-construction time (exercised by the system-index parity tests).\n */\nfunction resolveSystemIndexColumns<C extends { name: string }>(\n declaration: SystemIndexDeclaration,\n columns: SystemIndexColumns<C>,\n): readonly [C, ...C[]] {\n const byPhysicalName = new Map(\n Object.values(columns).map((column) => [column.name, column]),\n );\n const resolved = declaration.columns.map((column) => {\n const value = byPhysicalName.get(column);\n if (value === undefined) {\n throw new Error(\n `System index \"${declaration.table}_${declaration.suffix}\" references ` +\n `a column \"${column}\" the ${declaration.table} table does not define`,\n );\n }\n return value;\n });\n // `declaration.columns` is non-empty by type, so `resolved` is too.\n return resolved as [C, ...C[]];\n}\n\n/**\n * The two dialect variants do no dialect-specific work (no unique, no\n * where, no expression compilation — unlike the node/edge builder pairs\n * above), so they share one body parameterized by the dialect's index\n * factory.\n */\nfunction buildSystemIndexBuilders<C extends { name: string }, B>(\n tableKey: SystemIndexTable,\n physicalTableName: string,\n columns: SystemIndexColumns<C>,\n indexFactory: (name: string) => { on: (...cols: [C, ...C[]]) => B },\n): readonly B[] {\n return SYSTEM_INDEX_DECLARATIONS.filter(\n (declaration) => declaration.table === tableKey,\n ).map((declaration) =>\n indexFactory(systemIndexName(physicalTableName, declaration.suffix)).on(\n ...resolveSystemIndexColumns(declaration, columns),\n ),\n );\n}\n\nexport function buildSqliteSystemIndexBuilders(\n tableKey: SystemIndexTable,\n physicalTableName: string,\n columns: SystemIndexColumns<SQLiteColumn>,\n): readonly SqliteIndexBuilder[] {\n return buildSystemIndexBuilders(\n tableKey,\n physicalTableName,\n columns,\n (name) => sqliteIndex(name),\n );\n}\n\nexport function buildPostgresSystemIndexBuilders(\n tableKey: SystemIndexTable,\n physicalTableName: string,\n columns: SystemIndexColumns<PgColumn>,\n): readonly PgIndexBuilder[] {\n return buildSystemIndexBuilders(\n tableKey,\n physicalTableName,\n columns,\n (name) => pgIndex(name),\n );\n}\n\n// ============================================================\n// Minimal table shapes (shared between dialect schemas)\n// ============================================================\n\ntype NamedSqlWrapper = SQLWrapper & Readonly<{ name: string }>;\n\ntype NodeIndexTable = Readonly<{\n graphId: NamedSqlWrapper;\n kind: NamedSqlWrapper;\n id: NamedSqlWrapper;\n props: NamedSqlWrapper;\n version: NamedSqlWrapper;\n validFrom: NamedSqlWrapper;\n validTo: NamedSqlWrapper;\n createdAt: NamedSqlWrapper;\n updatedAt: NamedSqlWrapper;\n deletedAt: NamedSqlWrapper;\n}>;\n\ntype EdgeIndexTable = Readonly<{\n graphId: NamedSqlWrapper;\n id: NamedSqlWrapper;\n kind: NamedSqlWrapper;\n fromKind: NamedSqlWrapper;\n fromId: NamedSqlWrapper;\n toKind: NamedSqlWrapper;\n toId: NamedSqlWrapper;\n props: NamedSqlWrapper;\n validFrom: NamedSqlWrapper;\n validTo: NamedSqlWrapper;\n createdAt: NamedSqlWrapper;\n updatedAt: NamedSqlWrapper;\n deletedAt: NamedSqlWrapper;\n}>;\n\nfunction assertNonEmpty<T>(\n values: readonly T[],\n label: string,\n): asserts values is readonly [T, ...T[]] {\n if (values.length === 0) {\n throw new Error(`Index must have at least one key (${label})`);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/backend/drizzle/execution/types.ts","../src/indexes/drizzle.ts"],"names":["drizzleSql","index","sql","pgUniqueIndex","pgIndex","sqliteUniqueIndex","sqliteIndex"],"mappings":";;;;;;;AA2DA,IAAM,uBAAA,GAA0B;AAAA,EAC9B,UAAA,EAAY,UAAA;AAAA,EACZ,MAAA,EAAQ;AACV,CAAA;AAEO,SAAS,uBAAA,CACd,EAAA,EACA,KAAA,EACA,WAAA,EACkB;AAClB,EAAA,IAAI,aAAA,CAAc,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,SAAA,CAAU,KAAA,EAAO,uBAA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,CAAY,IAAI;AAAA,GAC5B;AACF;AAEO,SAAS,gCAAA,CACd,QAAA,EACA,iBAAA,EACA,OAAA,EAC2B;AAC3B,EAAA,OAAO,wBAAA;AAAA,IACL,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,OAAA;AAAA,IACA,CAAC,IAAA,KAASF,KAAA,CAAQ,IAAI;AAAA,GACxB;AACF;AAqCA,SAAS,cAAA,CACP,QACA,KAAA,EACwC;AACxC,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG;AACvB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kCAAA,EAAqC,KAAK,CAAA,CAAA,CAAG,CAAA;AAAA,EAC/D;AACF","file":"chunk-UJRWOV5B.js","sourcesContent":["import { type SQL as DrizzleSql, sql as drizzleSql } from \"drizzle-orm\";\n\nimport { bindSqlValue } from \"../../../query/dialect/profile\";\nimport { type SqlDialect } from \"../../../query/dialect/types\";\nimport {\n isSqlFragment,\n renderSql,\n type SqlFragment,\n throwUnsupportedSqlChunk,\n} from \"../../../query/sql-fragment\";\n\nexport type ExecutableSql = DrizzleSql | SqlFragment;\n\nexport type CompiledSqlQuery = Readonly<{\n params: readonly unknown[];\n sql: string;\n}>;\n\nexport type PreparedSqlStatement = Readonly<{\n execute: <TRow>(params: readonly unknown[]) => Promise<readonly TRow[]>;\n}>;\n\nexport type SqlExecutionAdapter = Readonly<{\n compile: (query: ExecutableSql) => CompiledSqlQuery;\n execute: <TRow>(query: ExecutableSql) => Promise<readonly TRow[]>;\n executeCompiled?: <TRow>(\n compiledQuery: CompiledSqlQuery,\n ) => Promise<readonly TRow[]>;\n prepare?: (sqlText: string) => PreparedSqlStatement;\n /**\n * Runs `critical` with exclusive use of the connection: no statement from\n * anywhere else can interleave with the ones it issues.\n *\n * Statement-at-a-time serialization is not enough for a *sequence* that must\n * be atomic. `SET LOCAL` around a query is the motivating case — snapshot,\n * set, select, restore. Two searches whose statements merely take turns can\n * still interleave as `A snapshot → B snapshot → A set → B set → A select`,\n * and `A` then runs under `B`'s settings.\n *\n * `critical` is handed the unqueued adapter, so it must not attempt to\n * re-enter the queue. Present only on transaction-scoped (serialized)\n * adapters; a pooled adapter needs no exclusion because every statement gets\n * its own connection.\n */\n runExclusive?: <T>(\n critical: (connection: SqlExecutionAdapter) => Promise<T>,\n ) => Promise<T>;\n}>;\n\ntype SqlCompiler = Readonly<{\n sqlToQuery: (query: DrizzleSql) => CompiledSqlQuery;\n}>;\n\ntype DatabaseWithCompiler = Readonly<{\n dialect?: SqlCompiler;\n}>;\n\ntype BackendName = \"PostgreSQL\" | \"SQLite\";\n\nconst DIALECT_BY_BACKEND_NAME = {\n PostgreSQL: \"postgres\",\n SQLite: \"sqlite\",\n} as const satisfies Record<BackendName, SqlDialect>;\n\nexport function compileQueryWithDialect(\n db: unknown,\n query: ExecutableSql,\n backendName: BackendName,\n): CompiledSqlQuery {\n if (isSqlFragment(query)) {\n return renderSql(query, DIALECT_BY_BACKEND_NAME[backendName]);\n }\n const databaseWithCompiler = db as DatabaseWithCompiler;\n const compiler = databaseWithCompiler.dialect;\n if (compiler === undefined) {\n throw new Error(`${backendName} backend is missing a SQL compiler`);\n }\n return compiler.sqlToQuery(query);\n}\n\n/**\n * Translates TypeGraph's fragment IR into Drizzle's adapter-native SQL object.\n *\n * Most execution paths render directly to text and parameters. Async SQLite\n * drivers expose only Drizzle's execution method, so that adapter needs this\n * lossless bridge at its final boundary.\n */\nexport function toDrizzleSql(\n fragment: SqlFragment,\n dialect: SqlDialect,\n): DrizzleSql {\n const chunks = fragment.chunks.map((chunk) => {\n switch (chunk.kind) {\n case \"text\": {\n return drizzleSql.raw(chunk.value);\n }\n case \"identifier\": {\n // Drizzle's schema builders treat Name chunks as bare index-column\n // references and omit dialect quoting. Preserve the portable IR's\n // identifier semantics by handing the adapter an already-quoted,\n // trusted SQL token instead.\n return drizzleSql.raw(`\"${chunk.value.replaceAll('\"', '\"\"')}\"`);\n }\n case \"parameter\": {\n return drizzleSql.param(bindSqlValue(chunk.value, dialect));\n }\n case \"placeholder\": {\n return drizzleSql.placeholder(chunk.value.name);\n }\n default: {\n return throwUnsupportedSqlChunk(chunk);\n }\n }\n });\n return drizzleSql.join(chunks);\n}\n","import { type SQLWrapper } from \"drizzle-orm\";\nimport {\n index as pgIndex,\n type IndexBuilder as PgIndexBuilder,\n type PgColumn,\n uniqueIndex as pgUniqueIndex,\n} from \"drizzle-orm/pg-core\";\nimport {\n index as sqliteIndex,\n type IndexBuilder as SqliteIndexBuilder,\n type SQLiteColumn,\n uniqueIndex as sqliteUniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\n\nimport { toDrizzleSql } from \"../backend/drizzle/execution/types\";\nimport { sql as portableSql, type SqlFragment } from \"../query/sql-fragment\";\nimport {\n compileEdgeIndexKeys,\n compileIndexWhere,\n compileNodeIndexKeys,\n type IndexCompilationContext,\n} from \"./compiler\";\nimport {\n SYSTEM_INDEX_DECLARATIONS,\n type SystemIndexDeclaration,\n systemIndexName,\n type SystemIndexTable,\n} from \"./system\";\nimport {\n type EdgeIndexDeclaration,\n type IndexDeclaration,\n type NodeIndexDeclaration,\n type SystemColumnName,\n} from \"./types\";\n\n// ============================================================\n// PostgreSQL (Drizzle Schema)\n// ============================================================\n\nexport function buildPostgresNodeIndexBuilders(\n table: NodeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly PgIndexBuilder[] {\n // GIN-family declarations (method: \"gin\" / \"trigram\") are\n // materialize-only — like pgvector ANN indexes, they are a pure\n // materialization concern and never ride the Drizzle table extras.\n const nodeIndexes = indexes.filter(\n (index): index is NodeIndexDeclaration =>\n index.entity === \"node\" && index.method === undefined,\n );\n\n return nodeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getPostgresNodeSystemColumn(table, column).name);\n\n const { keys } = compileNodeIndexKeys(\n index,\n \"postgres\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `node index \"${index.name}\"`);\n\n const base = index.unique ? pgUniqueIndex(index.name) : pgIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"postgres\"));\n assertNonEmpty(drizzleKeys, `node index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"postgres\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"postgres\"),\n );\n }\n\n return builder;\n });\n}\n\nexport function buildPostgresEdgeIndexBuilders(\n table: EdgeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly PgIndexBuilder[] {\n const edgeIndexes = indexes.filter(\n (index): index is EdgeIndexDeclaration =>\n index.entity === \"edge\" && index.method === undefined,\n );\n\n return edgeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getPostgresEdgeSystemColumn(table, column).name);\n\n const { keys } = compileEdgeIndexKeys(\n index,\n \"postgres\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `edge index \"${index.name}\"`);\n\n const base = index.unique ? pgUniqueIndex(index.name) : pgIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"postgres\"));\n assertNonEmpty(drizzleKeys, `edge index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"postgres\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"postgres\"),\n );\n }\n\n return builder;\n });\n}\n\nfunction getPostgresNodeSystemColumn(\n table: NodeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\":\n case \"from_id\":\n case \"to_kind\":\n case \"to_id\": {\n throw new Error(`Unsupported node system column for indexes: ${column}`);\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n return table.version;\n }\n }\n}\n\nfunction getPostgresEdgeSystemColumn(\n table: EdgeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\": {\n return table.fromKind;\n }\n case \"from_id\": {\n return table.fromId;\n }\n case \"to_kind\": {\n return table.toKind;\n }\n case \"to_id\": {\n return table.toId;\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n throw new Error(`Unsupported edge system column for indexes: ${column}`);\n }\n }\n}\n\n// ============================================================\n// SQLite (Drizzle Schema)\n// ============================================================\n\nexport function buildSqliteNodeIndexBuilders(\n table: NodeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly SqliteIndexBuilder[] {\n // GIN-family declarations (method: \"gin\" / \"trigram\") are\n // materialize-only — like pgvector ANN indexes, they are a pure\n // materialization concern and never ride the Drizzle table extras.\n const nodeIndexes = indexes.filter(\n (index): index is NodeIndexDeclaration =>\n index.entity === \"node\" && index.method === undefined,\n );\n\n return nodeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getSqliteNodeSystemColumn(table, column).name);\n\n const { keys } = compileNodeIndexKeys(\n index,\n \"sqlite\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `node index \"${index.name}\"`);\n\n const base =\n index.unique ? sqliteUniqueIndex(index.name) : sqliteIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"sqlite\"));\n assertNonEmpty(drizzleKeys, `node index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"sqlite\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"sqlite\"),\n );\n }\n\n return builder;\n });\n}\n\nexport function buildSqliteEdgeIndexBuilders(\n table: EdgeIndexTable,\n indexes: readonly IndexDeclaration[],\n): readonly SqliteIndexBuilder[] {\n const edgeIndexes = indexes.filter(\n (index): index is EdgeIndexDeclaration =>\n index.entity === \"edge\" && index.method === undefined,\n );\n\n return edgeIndexes.map((index) => {\n const propsColumn = portableSql.identifier(table.props.name);\n const systemColumn = (column: SystemColumnName): SqlFragment =>\n portableSql.identifier(getSqliteEdgeSystemColumn(table, column).name);\n\n const { keys } = compileEdgeIndexKeys(\n index,\n \"sqlite\",\n propsColumn,\n systemColumn,\n );\n assertNonEmpty(keys, `edge index \"${index.name}\"`);\n\n const base =\n index.unique ? sqliteUniqueIndex(index.name) : sqliteIndex(index.name);\n\n const drizzleKeys = keys.map((key) => toDrizzleSql(key, \"sqlite\"));\n assertNonEmpty(drizzleKeys, `edge index \"${index.name}\"`);\n const [firstKey, ...remainingKeys] = drizzleKeys;\n const builder = base.on(firstKey, ...remainingKeys);\n\n if (index.where) {\n const ctx: IndexCompilationContext = {\n dialect: \"sqlite\",\n propsColumn,\n systemColumn,\n };\n builder.where(\n toDrizzleSql(compileIndexWhere(ctx, index.where), \"sqlite\"),\n );\n }\n\n return builder;\n });\n}\n\nfunction getSqliteNodeSystemColumn(\n table: NodeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\":\n case \"from_id\":\n case \"to_kind\":\n case \"to_id\": {\n throw new Error(`Unsupported node system column for indexes: ${column}`);\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n return table.version;\n }\n }\n}\n\nfunction getSqliteEdgeSystemColumn(\n table: EdgeIndexTable,\n column: SystemColumnName,\n): NamedSqlWrapper {\n switch (column) {\n case \"graph_id\": {\n return table.graphId;\n }\n case \"kind\": {\n return table.kind;\n }\n case \"id\": {\n return table.id;\n }\n case \"from_kind\": {\n return table.fromKind;\n }\n case \"from_id\": {\n return table.fromId;\n }\n case \"to_kind\": {\n return table.toKind;\n }\n case \"to_id\": {\n return table.toId;\n }\n case \"deleted_at\": {\n return table.deletedAt;\n }\n case \"valid_from\": {\n return table.validFrom;\n }\n case \"valid_to\": {\n return table.validTo;\n }\n case \"created_at\": {\n return table.createdAt;\n }\n case \"updated_at\": {\n return table.updatedAt;\n }\n case \"version\": {\n throw new Error(`Unsupported edge system column for indexes: ${column}`);\n }\n }\n}\n\n// ============================================================\n// System indexes (both dialects)\n// ============================================================\n//\n// The schema factories derive their system-index Drizzle builders from\n// `SYSTEM_INDEX_DECLARATIONS` so both dialects emit the same index set by\n// construction. The builders receive the table's real column objects (not\n// SQL wrappers) so the DDL generator renders plain quoted column names —\n// byte-identical to the runtime DDL `materializeSystemIndexes` emits.\n\ntype SystemIndexColumns<C extends { name: string }> = Readonly<\n Record<string, C>\n>;\n\n/**\n * Resolves a declaration's physical column names against the table's own\n * column objects by each column's `.name` — the SQL name Drizzle carries on\n * the column itself — so no naming convention sits between the declaration\n * and the schema. A column the table doesn't define throws at\n * table-construction time (exercised by the system-index parity tests).\n */\nfunction resolveSystemIndexColumns<C extends { name: string }>(\n declaration: SystemIndexDeclaration,\n columns: SystemIndexColumns<C>,\n): readonly [C, ...C[]] {\n const byPhysicalName = new Map(\n Object.values(columns).map((column) => [column.name, column]),\n );\n const resolved = declaration.columns.map((column) => {\n const value = byPhysicalName.get(column);\n if (value === undefined) {\n throw new Error(\n `System index \"${declaration.table}_${declaration.suffix}\" references ` +\n `a column \"${column}\" the ${declaration.table} table does not define`,\n );\n }\n return value;\n });\n // `declaration.columns` is non-empty by type, so `resolved` is too.\n return resolved as [C, ...C[]];\n}\n\n/**\n * The two dialect variants do no dialect-specific work (no unique, no\n * where, no expression compilation — unlike the node/edge builder pairs\n * above), so they share one body parameterized by the dialect's index\n * factory.\n */\nfunction buildSystemIndexBuilders<C extends { name: string }, B>(\n tableKey: SystemIndexTable,\n physicalTableName: string,\n columns: SystemIndexColumns<C>,\n indexFactory: (name: string) => { on: (...cols: [C, ...C[]]) => B },\n): readonly B[] {\n return SYSTEM_INDEX_DECLARATIONS.filter(\n (declaration) => declaration.table === tableKey,\n ).map((declaration) =>\n indexFactory(systemIndexName(physicalTableName, declaration.suffix)).on(\n ...resolveSystemIndexColumns(declaration, columns),\n ),\n );\n}\n\nexport function buildSqliteSystemIndexBuilders(\n tableKey: SystemIndexTable,\n physicalTableName: string,\n columns: SystemIndexColumns<SQLiteColumn>,\n): readonly SqliteIndexBuilder[] {\n return buildSystemIndexBuilders(\n tableKey,\n physicalTableName,\n columns,\n (name) => sqliteIndex(name),\n );\n}\n\nexport function buildPostgresSystemIndexBuilders(\n tableKey: SystemIndexTable,\n physicalTableName: string,\n columns: SystemIndexColumns<PgColumn>,\n): readonly PgIndexBuilder[] {\n return buildSystemIndexBuilders(\n tableKey,\n physicalTableName,\n columns,\n (name) => pgIndex(name),\n );\n}\n\n// ============================================================\n// Minimal table shapes (shared between dialect schemas)\n// ============================================================\n\ntype NamedSqlWrapper = SQLWrapper & Readonly<{ name: string }>;\n\ntype NodeIndexTable = Readonly<{\n graphId: NamedSqlWrapper;\n kind: NamedSqlWrapper;\n id: NamedSqlWrapper;\n props: NamedSqlWrapper;\n version: NamedSqlWrapper;\n validFrom: NamedSqlWrapper;\n validTo: NamedSqlWrapper;\n createdAt: NamedSqlWrapper;\n updatedAt: NamedSqlWrapper;\n deletedAt: NamedSqlWrapper;\n}>;\n\ntype EdgeIndexTable = Readonly<{\n graphId: NamedSqlWrapper;\n id: NamedSqlWrapper;\n kind: NamedSqlWrapper;\n fromKind: NamedSqlWrapper;\n fromId: NamedSqlWrapper;\n toKind: NamedSqlWrapper;\n toId: NamedSqlWrapper;\n props: NamedSqlWrapper;\n validFrom: NamedSqlWrapper;\n validTo: NamedSqlWrapper;\n createdAt: NamedSqlWrapper;\n updatedAt: NamedSqlWrapper;\n deletedAt: NamedSqlWrapper;\n}>;\n\nfunction assertNonEmpty<T>(\n values: readonly T[],\n label: string,\n): asserts values is readonly [T, ...T[]] {\n if (values.length === 0) {\n throw new Error(`Index must have at least one key (${label})`);\n }\n}\n"]}