@nicia-ai/typegraph 0.49.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/README.md +12 -0
  2. package/dist/backend/drizzle/indexes.cjs +11 -9
  3. package/dist/backend/drizzle/indexes.d.cts +1 -1
  4. package/dist/backend/drizzle/indexes.d.ts +1 -1
  5. package/dist/backend/drizzle/indexes.js +7 -5
  6. package/dist/backend/index.cjs +190 -53
  7. package/dist/backend/index.d.cts +90 -4
  8. package/dist/backend/index.d.ts +90 -4
  9. package/dist/backend/index.js +9 -12
  10. package/dist/backend/postgres/index.cjs +36 -28
  11. package/dist/backend/postgres/index.d.cts +7 -7
  12. package/dist/backend/postgres/index.d.ts +7 -7
  13. package/dist/backend/postgres/index.js +19 -15
  14. package/dist/backend/postgres/pglite-store.cjs +7 -62
  15. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  16. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  17. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  18. package/dist/backend/postgres/pglite-store.js +7 -62
  19. package/dist/backend/postgres/pglite-store.js.map +1 -1
  20. package/dist/backend/postgres/pglite.cjs +21 -17
  21. package/dist/backend/postgres/pglite.d.cts +3 -3
  22. package/dist/backend/postgres/pglite.d.ts +3 -3
  23. package/dist/backend/postgres/pglite.js +20 -16
  24. package/dist/backend/sqlite/index.cjs +33 -25
  25. package/dist/backend/sqlite/index.d.cts +7 -7
  26. package/dist/backend/sqlite/index.d.ts +7 -7
  27. package/dist/backend/sqlite/index.js +17 -13
  28. package/dist/backend/sqlite/libsql.cjs +24 -20
  29. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  30. package/dist/backend/sqlite/libsql.d.cts +3 -3
  31. package/dist/backend/sqlite/libsql.d.ts +3 -3
  32. package/dist/backend/sqlite/libsql.js +19 -15
  33. package/dist/backend/sqlite/libsql.js.map +1 -1
  34. package/dist/backend/sqlite/local-store.cjs +9 -64
  35. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  36. package/dist/backend/sqlite/local-store.d.cts +8 -8
  37. package/dist/backend/sqlite/local-store.d.ts +8 -8
  38. package/dist/backend/sqlite/local-store.js +8 -64
  39. package/dist/backend/sqlite/local-store.js.map +1 -1
  40. package/dist/backend/sqlite/local.cjs +25 -20
  41. package/dist/backend/sqlite/local.d.cts +3 -3
  42. package/dist/backend/sqlite/local.d.ts +3 -3
  43. package/dist/backend/sqlite/local.js +21 -16
  44. package/dist/chunk-2CVDZCXH.cjs +1278 -0
  45. package/dist/chunk-2CVDZCXH.cjs.map +1 -0
  46. package/dist/{chunk-MYKHJI2J.js → chunk-2DWTBNSH.js} +3 -3
  47. package/dist/{chunk-MYKHJI2J.js.map → chunk-2DWTBNSH.js.map} +1 -1
  48. package/dist/{chunk-JB6T4GLL.cjs → chunk-2KCTP3U2.cjs} +870 -528
  49. package/dist/chunk-2KCTP3U2.cjs.map +1 -0
  50. package/dist/{chunk-OORXGFL5.cjs → chunk-322TBTOQ.cjs} +48 -48
  51. package/dist/{chunk-OORXGFL5.cjs.map → chunk-322TBTOQ.cjs.map} +1 -1
  52. package/dist/{chunk-FA2AFWLP.cjs → chunk-36SX6QXP.cjs} +31 -12
  53. package/dist/chunk-36SX6QXP.cjs.map +1 -0
  54. package/dist/{chunk-SDBBMD4N.js → chunk-36VYWVQU.js} +3 -3
  55. package/dist/{chunk-SDBBMD4N.js.map → chunk-36VYWVQU.js.map} +1 -1
  56. package/dist/chunk-4DKY6RIU.js +1253 -0
  57. package/dist/chunk-4DKY6RIU.js.map +1 -0
  58. package/dist/chunk-4QKOZYMV.js +9 -0
  59. package/dist/chunk-4QKOZYMV.js.map +1 -0
  60. package/dist/{chunk-WIC7DRXW.js → chunk-57JM6NW3.js} +9 -19
  61. package/dist/chunk-57JM6NW3.js.map +1 -0
  62. package/dist/chunk-5WWEYV4H.cjs +5113 -0
  63. package/dist/chunk-5WWEYV4H.cjs.map +1 -0
  64. package/dist/chunk-6KQEICJ6.cjs +12 -0
  65. package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
  66. package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
  67. package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
  68. package/dist/{chunk-KKBDXCLQ.js → chunk-6NLYIMJO.js} +4 -4
  69. package/dist/{chunk-KKBDXCLQ.js.map → chunk-6NLYIMJO.js.map} +1 -1
  70. package/dist/{chunk-BFUOME67.cjs → chunk-7B7I7YAW.cjs} +20 -11
  71. package/dist/chunk-7B7I7YAW.cjs.map +1 -0
  72. package/dist/{chunk-ZDKTPBGV.js → chunk-7G5IYROL.js} +6 -548
  73. package/dist/chunk-7G5IYROL.js.map +1 -0
  74. package/dist/{chunk-3DMMGT6S.js → chunk-7QFRK6PU.js} +4 -8
  75. package/dist/chunk-7QFRK6PU.js.map +1 -0
  76. package/dist/chunk-A4C4NJ5U.cjs +12 -0
  77. package/dist/chunk-A4C4NJ5U.cjs.map +1 -0
  78. package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
  79. package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
  80. package/dist/{chunk-UGHQV7MP.cjs → chunk-B3MN7EJR.cjs} +228 -162
  81. package/dist/chunk-B3MN7EJR.cjs.map +1 -0
  82. package/dist/{chunk-TZEGUG6D.cjs → chunk-BZ5MVITP.cjs} +4 -4
  83. package/dist/{chunk-TZEGUG6D.cjs.map → chunk-BZ5MVITP.cjs.map} +1 -1
  84. package/dist/{chunk-YVF2EM7B.js → chunk-CAI6SMP6.js} +3 -3
  85. package/dist/{chunk-YVF2EM7B.js.map → chunk-CAI6SMP6.js.map} +1 -1
  86. package/dist/{chunk-JONXFAPO.js → chunk-CBOD7TXH.js} +5 -5
  87. package/dist/{chunk-JONXFAPO.js.map → chunk-CBOD7TXH.js.map} +1 -1
  88. package/dist/{chunk-FQPEMEWX.cjs → chunk-CRZ56SZU.cjs} +81 -32
  89. package/dist/chunk-CRZ56SZU.cjs.map +1 -0
  90. package/dist/{chunk-DO7SAMEK.cjs → chunk-D3GWARN7.cjs} +47 -47
  91. package/dist/{chunk-DO7SAMEK.cjs.map → chunk-D3GWARN7.cjs.map} +1 -1
  92. package/dist/{chunk-QTD6HX4O.js → chunk-D3OUDFU7.js} +5 -5
  93. package/dist/{chunk-QTD6HX4O.js.map → chunk-D3OUDFU7.js.map} +1 -1
  94. package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
  95. package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
  96. package/dist/chunk-EKG2UXNX.cjs +23 -0
  97. package/dist/chunk-EKG2UXNX.cjs.map +1 -0
  98. package/dist/chunk-FMMW3KX7.cjs +148 -0
  99. package/dist/chunk-FMMW3KX7.cjs.map +1 -0
  100. package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
  101. package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
  102. package/dist/chunk-H2VWDQWC.cjs +571 -0
  103. package/dist/chunk-H2VWDQWC.cjs.map +1 -0
  104. package/dist/chunk-H4FY6OZK.js +13 -0
  105. package/dist/chunk-H4FY6OZK.js.map +1 -0
  106. package/dist/{chunk-EDN4Y4ZG.cjs → chunk-H5IJSROF.cjs} +9 -15
  107. package/dist/chunk-H5IJSROF.cjs.map +1 -0
  108. package/dist/chunk-HZUB5CON.js +27 -0
  109. package/dist/chunk-HZUB5CON.js.map +1 -0
  110. package/dist/{chunk-NACVVDWB.js → chunk-I5IOSA27.js} +103 -105
  111. package/dist/chunk-I5IOSA27.js.map +1 -0
  112. package/dist/{chunk-OI2GQ25X.cjs → chunk-I7YAY2VQ.cjs} +7 -7
  113. package/dist/{chunk-OI2GQ25X.cjs.map → chunk-I7YAY2VQ.cjs.map} +1 -1
  114. package/dist/chunk-IRCWIA3R.js +20 -0
  115. package/dist/chunk-IRCWIA3R.js.map +1 -0
  116. package/dist/chunk-IVQBLXBK.cjs +55 -0
  117. package/dist/chunk-IVQBLXBK.cjs.map +1 -0
  118. package/dist/{chunk-7SQSZN2J.js → chunk-IZD4HTCP.js} +5 -5
  119. package/dist/{chunk-7SQSZN2J.js.map → chunk-IZD4HTCP.js.map} +1 -1
  120. package/dist/{chunk-3FPR224C.cjs → chunk-JHRUZ73O.cjs} +116 -107
  121. package/dist/chunk-JHRUZ73O.cjs.map +1 -0
  122. package/dist/{chunk-EZEEWCFJ.cjs → chunk-JQKMEKKW.cjs} +525 -298
  123. package/dist/chunk-JQKMEKKW.cjs.map +1 -0
  124. package/dist/chunk-JVA3KDEA.cjs +691 -0
  125. package/dist/chunk-JVA3KDEA.cjs.map +1 -0
  126. package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
  127. package/dist/chunk-K46SDNQD.js.map +1 -0
  128. package/dist/{chunk-7LZJNLA5.js → chunk-K67P5DLL.js} +108 -42
  129. package/dist/chunk-K67P5DLL.js.map +1 -0
  130. package/dist/{chunk-3G5W2U2L.cjs → chunk-KACEYDYV.cjs} +335 -258
  131. package/dist/chunk-KACEYDYV.cjs.map +1 -0
  132. package/dist/{chunk-JFRT7S3B.cjs → chunk-L6EVYIID.cjs} +318 -478
  133. package/dist/chunk-L6EVYIID.cjs.map +1 -0
  134. package/dist/{chunk-SHFBB23Q.js → chunk-LI4K2KEJ.js} +6 -4
  135. package/dist/chunk-LI4K2KEJ.js.map +1 -0
  136. package/dist/chunk-LKZDQ2B4.js +1581 -0
  137. package/dist/chunk-LKZDQ2B4.js.map +1 -0
  138. package/dist/{chunk-WODMN3Q2.cjs → chunk-LLFPQOBA.cjs} +27 -27
  139. package/dist/{chunk-WODMN3Q2.cjs.map → chunk-LLFPQOBA.cjs.map} +1 -1
  140. package/dist/{chunk-P6YLZTRE.js → chunk-LZMQ3SFK.js} +3 -3
  141. package/dist/{chunk-P6YLZTRE.js.map → chunk-LZMQ3SFK.js.map} +1 -1
  142. package/dist/{chunk-HEV35TGT.js → chunk-M3VTS3F6.js} +13 -4
  143. package/dist/chunk-M3VTS3F6.js.map +1 -0
  144. package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
  145. package/dist/chunk-M5MSP3BI.cjs.map +1 -0
  146. package/dist/{chunk-D4QLTJSM.js → chunk-NBOS7BY3.js} +63 -23
  147. package/dist/chunk-NBOS7BY3.js.map +1 -0
  148. package/dist/chunk-NGQDGL5X.js +140 -0
  149. package/dist/chunk-NGQDGL5X.js.map +1 -0
  150. package/dist/{chunk-SIT26LAZ.cjs → chunk-NLX5OWK7.cjs} +33 -5
  151. package/dist/chunk-NLX5OWK7.cjs.map +1 -0
  152. package/dist/chunk-NUQ2YFFH.cjs +1637 -0
  153. package/dist/chunk-NUQ2YFFH.cjs.map +1 -0
  154. package/dist/{chunk-UMGZDVOA.cjs → chunk-OGL4X4PH.cjs} +206 -208
  155. package/dist/chunk-OGL4X4PH.cjs.map +1 -0
  156. package/dist/{chunk-LRQKXRXO.cjs → chunk-OTNTGEXR.cjs} +4 -4
  157. package/dist/{chunk-LRQKXRXO.cjs.map → chunk-OTNTGEXR.cjs.map} +1 -1
  158. package/dist/chunk-OTWE63BW.js +53 -0
  159. package/dist/chunk-OTWE63BW.js.map +1 -0
  160. package/dist/chunk-PC5NGH5A.js +549 -0
  161. package/dist/chunk-PC5NGH5A.js.map +1 -0
  162. package/dist/{chunk-26YKDNUD.cjs → chunk-PS3TUWJM.cjs} +12 -10
  163. package/dist/chunk-PS3TUWJM.cjs.map +1 -0
  164. package/dist/{chunk-OMZ37BM2.js → chunk-PVFFH7TL.js} +5 -5
  165. package/dist/{chunk-OMZ37BM2.js.map → chunk-PVFFH7TL.js.map} +1 -1
  166. package/dist/chunk-QCD5JKU4.cjs +15 -0
  167. package/dist/chunk-QCD5JKU4.cjs.map +1 -0
  168. package/dist/{chunk-UGHG7PGX.js → chunk-QG5VEOKX.js} +30 -4
  169. package/dist/chunk-QG5VEOKX.js.map +1 -0
  170. package/dist/{chunk-TUNPBZY3.cjs → chunk-QLLZM5I3.cjs} +4 -4
  171. package/dist/{chunk-TUNPBZY3.cjs.map → chunk-QLLZM5I3.cjs.map} +1 -1
  172. package/dist/{chunk-BRRP76WO.js → chunk-RCBG6YMT.js} +781 -375
  173. package/dist/chunk-RCBG6YMT.js.map +1 -0
  174. package/dist/{chunk-LTXQOEIC.js → chunk-RI7RJH4G.js} +281 -204
  175. package/dist/chunk-RI7RJH4G.js.map +1 -0
  176. package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
  177. package/dist/chunk-RJMHU2MG.cjs.map +1 -0
  178. package/dist/{chunk-GLHXM7C4.js → chunk-RVUL2HXY.js} +61 -23
  179. package/dist/chunk-RVUL2HXY.js.map +1 -0
  180. package/dist/chunk-RWUWTJQY.cjs +30 -0
  181. package/dist/chunk-RWUWTJQY.cjs.map +1 -0
  182. package/dist/{chunk-2O4PCIZ6.cjs → chunk-S5GU4LUN.cjs} +13 -13
  183. package/dist/{chunk-2O4PCIZ6.cjs.map → chunk-S5GU4LUN.cjs.map} +1 -1
  184. package/dist/{chunk-JPD2CTC3.js → chunk-SDPWO2Z5.js} +7 -7
  185. package/dist/{chunk-JPD2CTC3.js.map → chunk-SDPWO2Z5.js.map} +1 -1
  186. package/dist/{chunk-OVI7IXYX.js → chunk-SLGGT2XD.js} +3 -3
  187. package/dist/{chunk-OVI7IXYX.js.map → chunk-SLGGT2XD.js.map} +1 -1
  188. package/dist/{chunk-ROR5ZR6A.cjs → chunk-TIJUA4I6.cjs} +45 -45
  189. package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-TIJUA4I6.cjs.map} +1 -1
  190. package/dist/{chunk-AOSSQDVO.cjs → chunk-TM54OBHX.cjs} +13 -13
  191. package/dist/{chunk-AOSSQDVO.cjs.map → chunk-TM54OBHX.cjs.map} +1 -1
  192. package/dist/{chunk-KF6K7TGH.js → chunk-TYEYRCXL.js} +766 -433
  193. package/dist/chunk-TYEYRCXL.js.map +1 -0
  194. package/dist/{chunk-Z2JCLZFJ.js → chunk-UKOVGCRN.js} +2151 -570
  195. package/dist/chunk-UKOVGCRN.js.map +1 -0
  196. package/dist/chunk-UYKDYE5D.cjs +12 -0
  197. package/dist/{chunk-CICO5GXD.cjs.map → chunk-UYKDYE5D.cjs.map} +1 -1
  198. package/dist/{chunk-S5TERQVW.js → chunk-VAAC7L57.js} +284 -66
  199. package/dist/chunk-VAAC7L57.js.map +1 -0
  200. package/dist/{chunk-7UOLHNWC.cjs → chunk-VKHXYVN7.cjs} +22 -33
  201. package/dist/chunk-VKHXYVN7.cjs.map +1 -0
  202. package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
  203. package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
  204. package/dist/{chunk-YIURNGXI.js → chunk-VUQZNUHU.js} +22 -6
  205. package/dist/chunk-VUQZNUHU.js.map +1 -0
  206. package/dist/{chunk-YYUHLYM2.cjs → chunk-WDM5WQK4.cjs} +183 -143
  207. package/dist/chunk-WDM5WQK4.cjs.map +1 -0
  208. package/dist/{chunk-ZFMCDJGB.js → chunk-WFSYYU4W.js} +70 -220
  209. package/dist/chunk-WFSYYU4W.js.map +1 -0
  210. package/dist/{chunk-SR725PWF.cjs → chunk-WRBV2FNH.cjs} +2065 -1659
  211. package/dist/chunk-WRBV2FNH.cjs.map +1 -0
  212. package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
  213. package/dist/chunk-X4GDXBOP.cjs.map +1 -0
  214. package/dist/chunk-XORONCV3.js +202 -0
  215. package/dist/chunk-XORONCV3.js.map +1 -0
  216. package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
  217. package/dist/chunk-XZW2CTNO.js.map +1 -0
  218. package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
  219. package/dist/chunk-YDEJQWOL.js.map +1 -0
  220. package/dist/{chunk-2TYSSBU5.js → chunk-YT2IVFAI.js} +30 -21
  221. package/dist/chunk-YT2IVFAI.js.map +1 -0
  222. package/dist/chunk-ZGVTNKTX.cjs +217 -0
  223. package/dist/chunk-ZGVTNKTX.cjs.map +1 -0
  224. package/dist/core/index.cjs +29 -28
  225. package/dist/core/index.d.cts +4 -4
  226. package/dist/core/index.d.ts +4 -4
  227. package/dist/core/index.js +9 -8
  228. package/dist/{ddl-D_oW-EVO.d.ts → ddl-BvcbgzHo.d.ts} +3 -3
  229. package/dist/{ddl-BL1NZLMY.d.cts → ddl-Ufebz5q5.d.cts} +3 -3
  230. package/dist/graph-extension/index.cjs +21 -20
  231. package/dist/graph-extension/index.d.cts +2 -4
  232. package/dist/graph-extension/index.d.ts +2 -4
  233. package/dist/graph-extension/index.js +5 -4
  234. package/dist/graph-merge/index.cjs +324 -307
  235. package/dist/graph-merge/index.cjs.map +1 -1
  236. package/dist/graph-merge/index.d.cts +8 -9
  237. package/dist/graph-merge/index.d.ts +8 -9
  238. package/dist/graph-merge/index.js +51 -34
  239. package/dist/graph-merge/index.js.map +1 -1
  240. package/dist/index.cjs +224 -222
  241. package/dist/index.cjs.map +1 -1
  242. package/dist/index.d.cts +11 -12
  243. package/dist/index.d.ts +11 -12
  244. package/dist/index.js +38 -36
  245. package/dist/index.js.map +1 -1
  246. package/dist/indexes/index.cjs +15 -13
  247. package/dist/indexes/index.d.cts +4 -4
  248. package/dist/indexes/index.d.ts +4 -4
  249. package/dist/indexes/index.js +8 -6
  250. package/dist/{ingestion-import-target-dNeL7iAv.d.ts → ingestion-import-target-CAs1OX-l.d.cts} +1 -1
  251. package/dist/{ingestion-import-target-XPxZYw89.d.cts → ingestion-import-target-DCQSPfNx.d.ts} +1 -1
  252. package/dist/interchange/index.cjs +57 -54
  253. package/dist/interchange/index.cjs.map +1 -1
  254. package/dist/interchange/index.d.cts +19 -8
  255. package/dist/interchange/index.d.ts +19 -8
  256. package/dist/interchange/index.js +21 -18
  257. package/dist/interchange/index.js.map +1 -1
  258. package/dist/local-store-impl-6DDTFM32.cjs +77 -0
  259. package/dist/local-store-impl-6DDTFM32.cjs.map +1 -0
  260. package/dist/local-store-impl-OXTOVU2J.js +75 -0
  261. package/dist/local-store-impl-OXTOVU2J.js.map +1 -0
  262. package/dist/{manager-CYaff3n3.d.cts → manager-B68OrPR2.d.ts} +29 -2
  263. package/dist/{manager-D9eRT_ns.d.ts → manager-D_t7oK69.d.cts} +29 -2
  264. package/dist/pglite-store-impl-6EMZGL7K.js +73 -0
  265. package/dist/pglite-store-impl-6EMZGL7K.js.map +1 -0
  266. package/dist/pglite-store-impl-GJG3Y7RP.cjs +75 -0
  267. package/dist/pglite-store-impl-GJG3Y7RP.cjs.map +1 -0
  268. package/dist/{postgres-CcL4bAHS.d.ts → postgres-BPLSVyHM.d.ts} +279 -2
  269. package/dist/{postgres-DMj39MEu.d.cts → postgres-CqvtFC2y.d.cts} +279 -2
  270. package/dist/profiler/index.d.cts +9 -9
  271. package/dist/profiler/index.d.ts +9 -9
  272. package/dist/provenance/index.cjs +59 -44
  273. package/dist/provenance/index.cjs.map +1 -1
  274. package/dist/provenance/index.d.cts +7 -7
  275. package/dist/provenance/index.d.ts +7 -7
  276. package/dist/provenance/index.js +28 -13
  277. package/dist/provenance/index.js.map +1 -1
  278. package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-DEzCKAdy.d.cts} +7 -3
  279. package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-GMdaS2AH.d.ts} +7 -3
  280. package/dist/resolve-D_H8MHtq.d.ts +1805 -0
  281. package/dist/resolve-WEW8gWws.d.cts +1805 -0
  282. package/dist/schema/index.cjs +48 -46
  283. package/dist/schema/index.d.cts +4 -6
  284. package/dist/schema/index.d.ts +4 -6
  285. package/dist/schema/index.js +21 -19
  286. package/dist/{searchable-bpE1bBfc.d.ts → searchable-C_UREI9K.d.ts} +1 -1
  287. package/dist/{searchable-DHJMh_nj.d.cts → searchable-ClgET_i7.d.cts} +1 -1
  288. package/dist/{sqlite-YppHrNFb.d.cts → sqlite-D1mXO9Kp.d.cts} +310 -2
  289. package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-MZA3oZNB.d.ts} +310 -2
  290. package/dist/{store-bphCSo7z.d.cts → store-CuFX7fCx.d.cts} +117 -31
  291. package/dist/{store-DRrFCx5x.d.ts → store-D-ZjXQpW.d.ts} +117 -31
  292. package/dist/{temporal-CbnLzTmM.d.ts → temporal-CpyEiRY8.d.cts} +1 -1
  293. package/dist/{temporal-5GqpYCk2.d.cts → temporal-y0Aep9Su.d.ts} +1 -1
  294. package/dist/{types-BqFZTQmV.d.cts → types-6yf0Vv-_.d.cts} +2016 -94
  295. package/dist/{types-BqFZTQmV.d.ts → types-6yf0Vv-_.d.ts} +2016 -94
  296. package/dist/{types-Bx74kaTt.d.ts → types-DzJ4dlzk.d.cts} +1 -1
  297. package/dist/{types-CXAhpW-c.d.cts → types-_vVSB9k-.d.ts} +1 -1
  298. package/dist/{where-O-k2wgYm.d.ts → where-DuG2LCLe.d.ts} +1 -1
  299. package/dist/{where-DI_Fqz-X.d.cts → where-Mhf_yyKX.d.cts} +1 -1
  300. package/package.json +7 -2
  301. package/dist/chunk-26YKDNUD.cjs.map +0 -1
  302. package/dist/chunk-2TYSSBU5.js.map +0 -1
  303. package/dist/chunk-3DMMGT6S.js.map +0 -1
  304. package/dist/chunk-3FPR224C.cjs.map +0 -1
  305. package/dist/chunk-3G5W2U2L.cjs.map +0 -1
  306. package/dist/chunk-3KOY4FH3.cjs +0 -934
  307. package/dist/chunk-3KOY4FH3.cjs.map +0 -1
  308. package/dist/chunk-3QNZ5SAJ.cjs +0 -3502
  309. package/dist/chunk-3QNZ5SAJ.cjs.map +0 -1
  310. package/dist/chunk-3U5ABFDW.cjs +0 -259
  311. package/dist/chunk-3U5ABFDW.cjs.map +0 -1
  312. package/dist/chunk-5K2BKEBD.js.map +0 -1
  313. package/dist/chunk-5PRKMB24.cjs +0 -124
  314. package/dist/chunk-5PRKMB24.cjs.map +0 -1
  315. package/dist/chunk-6LN7FIVU.js +0 -107
  316. package/dist/chunk-6LN7FIVU.js.map +0 -1
  317. package/dist/chunk-6SWPJEYN.js +0 -1126
  318. package/dist/chunk-6SWPJEYN.js.map +0 -1
  319. package/dist/chunk-7LZJNLA5.js.map +0 -1
  320. package/dist/chunk-7UOLHNWC.cjs.map +0 -1
  321. package/dist/chunk-BFUOME67.cjs.map +0 -1
  322. package/dist/chunk-BRRP76WO.js.map +0 -1
  323. package/dist/chunk-CICO5GXD.cjs +0 -12
  324. package/dist/chunk-D4QLTJSM.js.map +0 -1
  325. package/dist/chunk-D5R42W5D.js.map +0 -1
  326. package/dist/chunk-EDN4Y4ZG.cjs.map +0 -1
  327. package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
  328. package/dist/chunk-FA2AFWLP.cjs.map +0 -1
  329. package/dist/chunk-FQPEMEWX.cjs.map +0 -1
  330. package/dist/chunk-GLHXM7C4.js.map +0 -1
  331. package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
  332. package/dist/chunk-HDL2ARHX.cjs +0 -1156
  333. package/dist/chunk-HDL2ARHX.cjs.map +0 -1
  334. package/dist/chunk-HEV35TGT.js.map +0 -1
  335. package/dist/chunk-I4GAZH5Z.js +0 -913
  336. package/dist/chunk-I4GAZH5Z.js.map +0 -1
  337. package/dist/chunk-JB6T4GLL.cjs.map +0 -1
  338. package/dist/chunk-JBQQ7THH.js +0 -20
  339. package/dist/chunk-JBQQ7THH.js.map +0 -1
  340. package/dist/chunk-JFRT7S3B.cjs.map +0 -1
  341. package/dist/chunk-KF6K7TGH.js.map +0 -1
  342. package/dist/chunk-L3LQNR34.cjs +0 -1254
  343. package/dist/chunk-L3LQNR34.cjs.map +0 -1
  344. package/dist/chunk-LTXQOEIC.js.map +0 -1
  345. package/dist/chunk-MKJ4KXL5.cjs +0 -12
  346. package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
  347. package/dist/chunk-NACVVDWB.js.map +0 -1
  348. package/dist/chunk-NVY5CJFP.js +0 -244
  349. package/dist/chunk-NVY5CJFP.js.map +0 -1
  350. package/dist/chunk-PWLJ77UV.cjs +0 -23
  351. package/dist/chunk-PWLJ77UV.cjs.map +0 -1
  352. package/dist/chunk-S5TERQVW.js.map +0 -1
  353. package/dist/chunk-SHFBB23Q.js.map +0 -1
  354. package/dist/chunk-SIT26LAZ.cjs.map +0 -1
  355. package/dist/chunk-SR725PWF.cjs.map +0 -1
  356. package/dist/chunk-TQHGE7UC.cjs.map +0 -1
  357. package/dist/chunk-UGHG7PGX.js.map +0 -1
  358. package/dist/chunk-UGHQV7MP.cjs.map +0 -1
  359. package/dist/chunk-UMGZDVOA.cjs.map +0 -1
  360. package/dist/chunk-WIC7DRXW.js.map +0 -1
  361. package/dist/chunk-YIURNGXI.js.map +0 -1
  362. package/dist/chunk-YYUHLYM2.cjs.map +0 -1
  363. package/dist/chunk-Z2JCLZFJ.js.map +0 -1
  364. package/dist/chunk-ZDKTPBGV.js.map +0 -1
  365. package/dist/chunk-ZFMCDJGB.js.map +0 -1
  366. package/dist/chunk-ZLONH2UD.js.map +0 -1
  367. package/dist/index-COs_z6nV.d.cts +0 -1132
  368. package/dist/index-D7d1u2gr.d.ts +0 -1132
  369. package/dist/materialize-indexes-DJ3ykH59.d.ts +0 -266
  370. package/dist/materialize-indexes-DTtAnvfY.d.cts +0 -266
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/backend/table-contribution.ts","../src/query/dialect/fulltext-strategy.ts","../src/query/dialect/vector-strategy.ts"],"names":["quoteIdentifier"],"mappings":";;;;;AA+CO,IAAM,0BAAA,GAA6B;AAGnC,IAAM,uBAAA,GAA0B;;;ACrBhC,IAAM,kBAAA,GAAmD;AAAA,EAC9D,WAAA;A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A,OAAO,CAAA,EAAG,QAAA,CAAS,KAAA,CAAM,CAAA,EAAG,4BAAA,GAA+B,IAAI,IAAA,CAAK,MAAM,CAAC,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AACrF;AAOO,SAASA,iBAAgB,IAAA,EAAsB;AACpD,EAAA,OAAO,CAAA,CAAA,EAAI,IAAA,CAAK,UAAA,CAAW,GAAA,EAAK,IAAI,CAAC,CAAA,CAAA,CAAA;AACvC","file":"chunk-PC5NGH5A.js","sourcesContent":["/**\n * Unified table-contribution contract (#129).\n *\n * Every table TypeGraph owns — whether modeled as a Drizzle table or\n * emitted as strategy-owned raw DDL — is described by a single\n * {@link TableContribution} shape. This is the one place that answers\n * \"what tables does this backend/strategy own?\", replacing the\n * previously split surfaces (Drizzle named exports, tables-factory\n * recursion, strategy raw DDL, per-table `ensureXTable` methods).\n *\n * Lives in the neutral `backend/` layer (sibling of `backend/types.ts`,\n * which `query/dialect` already depends on) and is deliberately\n * Drizzle-free, so declaring contributions does not pull the concrete\n * Drizzle backend runtime into the query/dialect layer.\n *\n * ## Identity vs. signature (prerequisite for #135)\n *\n * #135 (durable fulltext/contribution materialization) needs to make\n * \"not materialized\" vs. \"materialized but stale\" a decidable, durable\n * fact instead of an in-memory per-backend latch. That requires two\n * conceptually separate things, and #129's job is only to make both\n * *derivable* from the contract:\n *\n * - **Materialization identity** — `owner` + `logicalName` +\n * resolved physical `tableName`. Keying on `logicalName` alone is\n * insufficient: custom per-deployment table names must be\n * distinguishable, otherwise two deployments with different physical\n * names would collide on one durable marker. (#135 additionally\n * scopes this by `graphId` at persistence time.)\n * - **Drift signature** — a hash of the strategy identity/version,\n * the resolved table name(s), and the normalized `createDdl`. #129\n * guarantees `createDdl` is deterministic for a given resolved\n * configuration so the hash #135 computes is meaningful.\n *\n * The signature is intentionally **not** eagerly carried on the\n * contribution: hashing is async (Web Crypto, see `utils/hash`) and\n * #135 already owns signature persistence the same way\n * `materializeIndexes` does for declared indexes.\n */\n\n/**\n * `logicalName` of the strategy-owned fulltext slot. Used as a logic\n * discriminant (latch routing, runtime-ensure) across the strategies\n * and both backends — a shared constant so a strategy declaring a\n * different name fails loudly at the call site instead of silently\n * skipping the latched fulltext path.\n */\nexport const FULLTEXT_CONTRIBUTION_NAME = \"fulltext\";\n\n/** `owner` of core/base schema tables (not strategy-owned). */\nexport const BASE_CONTRIBUTION_OWNER = \"base\";\n\n/**\n * A single table TypeGraph owns.\n */\nexport type TableContribution = Readonly<{\n /**\n * Stable, graph- and deployment-independent identity for the logical\n * slot this contribution fills (e.g. `\"fulltext\"`). NOT the physical\n * table name. Stable across table-name overrides and across strategy\n * swaps of the *same* logical slot, so #135's durable marker can\n * survive both.\n */\n logicalName: string;\n /**\n * Identifies the producer of this contribution (e.g. a strategy id\n * like `\"tsvector\"` / `\"fts5\"`, or `\"base\"` for core schema tables).\n * Part of the #135 materialization identity and an input to the\n * drift signature — a strategy swap on the same `logicalName` is a\n * legitimate, detectable drift, not a silent reuse.\n */\n owner: string;\n /**\n * Resolved physical table name after any per-deployment name\n * override. Part of the #135 materialization identity (custom names\n * must be distinguishable) and used by diagnostics / the focused\n * bootstrap ensure.\n */\n tableName: string;\n /**\n * Idempotent (`CREATE ... IF NOT EXISTS`) statements that\n * materialize this contribution's table **and its supporting\n * indexes**. Running the full list is how the runtime ensure\n * self-heals partial states (table present, index missing) — it is\n * not a probe-and-skip. Deterministic for a given resolved\n * configuration: the canonical normalized input to #135's drift\n * signature.\n */\n createDdl: readonly string[];\n /**\n * Idempotent (`DROP ... IF EXISTS`) statements that tear this\n * contribution's storage down, ordered so that running the list\n * leaves nothing behind. Declaring it is what makes a contribution\n * *rebuildable*: the destructive\n * `store.rebuildContribution()` path drops through these statements\n * before re-running {@link createDdl}, which is the only repair for a\n * table provisioned at a shape the current `createDdl` no longer\n * produces.\n *\n * Optional because it is a capability, not an invariant. A\n * contribution whose content cannot be reconstructed from data\n * TypeGraph already stores has no business advertising a rebuild —\n * dropping it would destroy the only copy — and a third-party\n * strategy that predates this field keeps compiling and is reported\n * as not rebuildable rather than silently rebuilt through a\n * synthesized `DROP`. Backends surface the resulting gap as\n * `capabilities.contributions.rebuild`.\n *\n * The rebuild visits a strategy's `runtimeEnsure` contributions, the\n * same set the boot ensure provisions — so a companion table a strategy\n * declares outside that set is neither dropped nor recreated, and must\n * not be something the recreated storage depends on.\n */\n dropDdl?: readonly string[];\n /**\n * When `true`, the post-schema-load focused ensure\n * (`loadActiveSchemaWithBootstrap`) materializes this contribution\n * on every successful schema load.\n *\n * **Invariant: only strategy-declared contributions may set this.**\n * Core/base tables are always `false` — they are created by\n * drizzle-kit / `bootstrapTables`. This is what lets the boot path\n * derive runtime contributions straight from the strategy\n * (`fulltextStrategy.ownedTables`) without walking — and generating\n * DDL for — every base table.\n */\n runtimeEnsure: boolean;\n}>;\n\n/**\n * A table a {@link FulltextStrategy} declares it owns. An alias, not a\n * distinct shape: a strategy's declaration is already authoritative\n * (no resolution step). The name documents the producer role.\n */\nexport type StrategyTableContribution = TableContribution;\n","/**\n * Fulltext Strategy — pluggable DDL + SQL generation for a dialect's\n * fulltext stack. A strategy owns every SQL statement that touches its\n * backing table: DDL, upsert (single + batch), delete (single + batch),\n * MATCH condition, rank expression, and snippet expression.\n *\n * A dialect picks one as its default; `createPostgresBackend` /\n * `createSqliteBackend` accept an override for alternate Postgres stacks\n * (pg_trgm, ParadeDB/pg_search, pgroonga) to swap the entire fulltext\n * pipeline without forking TypeGraph.\n */\nimport {\n FULLTEXT_CONTRIBUTION_NAME,\n type StrategyTableContribution,\n} from \"../../backend/table-contribution\";\nimport {\n type DeleteFulltextBatchParams,\n type DeleteFulltextParams,\n type FulltextBatchRow,\n type FulltextCapabilities,\n type FulltextQueryMode,\n type UpsertFulltextBatchParams,\n type UpsertFulltextParams,\n} from \"../../backend/types\";\nimport { sql, type SqlFragment } from \"../sql-fragment\";\n\n/**\n * Every `FulltextQueryMode` both shipped strategies accept.\n */\nexport const ALL_FULLTEXT_MODES: readonly FulltextQueryMode[] = [\n \"websearch\",\n \"phrase\",\n \"plain\",\n \"raw\",\n] as const;\n\n/**\n * Derives the `FulltextCapabilities` backends advertise from the active\n * strategy, so the two never drift.\n */\nexport function buildFulltextCapabilities(\n strategy: FulltextStrategy,\n): FulltextCapabilities {\n return {\n supported: true,\n languages: strategy.languages,\n phraseQueries: strategy.supportedModes.includes(\"phrase\"),\n prefixQueries: strategy.supportsPrefix,\n highlighting: strategy.supportsSnippets,\n };\n}\n\n/**\n * A pluggable fulltext implementation. Each strategy is expected to be\n * self-contained: given a table name, a query string, and a parse mode,\n * it emits every SQL statement the compiler and backend need — DDL,\n * reads, and writes. No out-of-band conventions across layers.\n */\nexport type FulltextStrategy = Readonly<{\n /** Human-readable identifier used in error messages and telemetry. */\n name: string;\n\n /**\n * Parse modes this strategy can translate. Callers validate against\n * this list before emitting SQL; a mode outside the set means the\n * strategy rejects the query at compile time.\n */\n supportedModes: readonly FulltextQueryMode[];\n\n /**\n * Whether the strategy can emit a per-row highlighted snippet. When\n * false, `snippetExpression` returns a literal `NULL` so callers can\n * leave the `snippet` column in place without a branch.\n */\n supportsSnippets: boolean;\n\n /**\n * Whether the strategy supports prefix queries (`foo*`). Used to\n * populate `BackendCapabilities.fulltext.prefixQueries`. A strategy\n * may support prefix queries via dedicated syntax without advertising\n * \"raw\" mode (and vice-versa).\n */\n supportsPrefix: boolean;\n\n /**\n * Whether a per-query `language` override is honored. Postgres' tsvector\n * accepts any installed regconfig at query time; SQLite FTS5's tokenizer\n * is fixed at table-create time, so the override is silently ignored.\n * Callers may surface a warning when the user passes `language` to a\n * strategy that doesn't honor it.\n */\n supportsLanguageOverride: boolean;\n\n /**\n * Languages / tokenizer names understood by the strategy. Advisory — a\n * runtime backend like Postgres may accept other installed regconfigs.\n * Used to populate `BackendCapabilities.fulltext.languages`.\n */\n languages: readonly string[];\n\n /**\n * Emits the WHERE-side MATCH expression.\n *\n * @example\n * tsvector: `\"typegraph_node_fulltext\".\"tsv\" @@ websearch_to_tsquery('english', 'cats')`\n * fts5: `\"typegraph_node_fulltext\" MATCH '\"cats\"'`\n */\n matchCondition: (\n this: void,\n tableName: string,\n query: string,\n mode: FulltextQueryMode,\n language?: string,\n ) => SqlFragment;\n\n /**\n * Emits the relevance expression. Higher values = more relevant. The\n * compiler orders by this expression DESC, and both builder and\n * backend-direct paths use the same form so their top-k results agree.\n */\n rankExpression: (\n this: void,\n tableName: string,\n query: string,\n mode: FulltextQueryMode,\n language?: string,\n ) => SqlFragment;\n\n /**\n * Emits a per-row highlighted snippet expression, or `NULL` when\n * `supportsSnippets` is false. Snippet markup is `<mark>…</mark>` in\n * both shipped strategies so consumers can apply one stylesheet.\n */\n snippetExpression: (\n this: void,\n tableName: string,\n query: string,\n mode: FulltextQueryMode,\n language?: string,\n ) => SqlFragment;\n\n /**\n * The tables this strategy owns, as Drizzle-free, already\n * authoritative `TableContribution`s (`logicalName`, `owner`,\n * resolved `tableName`, idempotent `createDdl` for the table **and\n * its supporting indexes**, `runtimeEnsure`). A strategy never\n * constructs a Drizzle table itself; drizzle-kit visibility, when\n * applicable, is the schema barrel's responsibility (the default\n * Postgres strategy's `schema/postgres.ts` exports a matching\n * `tables.fulltext` — a non-default strategy must export its own).\n *\n * Replaces the former `generateDdl(tableName)`: DDL is now one field\n * of a contribution rather than the strategy's whole storage\n * surface. (Public API change — see #129.)\n *\n * Declare `dropDdl` on each contribution to opt the strategy into the\n * destructive `store.rebuildContribution(\"fulltext\")` path — the only\n * repair for storage provisioned at a shape `createDdl` no longer\n * produces. Fulltext content is reconstructed from the node rows, so a\n * rebuild loses nothing; a strategy that omits `dropDdl` is reported\n * as not rebuildable instead of being dropped through a synthesized\n * statement.\n */\n ownedTables: (\n this: void,\n primaryTableName: string,\n ) => readonly StrategyTableContribution[];\n\n /**\n * Emits the statements that upsert a single fulltext row. Returns one\n * or more statements — some backends (SQLite FTS5) cannot emulate\n * upsert in a single statement and need DELETE + INSERT.\n */\n buildUpsert: (\n this: void,\n tableName: string,\n params: UpsertFulltextParams,\n timestamp: string,\n ) => readonly SqlFragment[];\n\n /**\n * Emits the statements that upsert many fulltext rows at once. Input\n * rows are expected to be de-duplicated last-write-wins by the\n * strategy if the underlying SQL statement cannot tolerate duplicate\n * conflict keys. Returns `[]` when `params.rows` is empty.\n */\n buildBatchUpsert: (\n this: void,\n tableName: string,\n params: UpsertFulltextBatchParams,\n timestamp: string,\n ) => readonly SqlFragment[];\n\n /**\n * Emits the statements that delete a single fulltext row. Normally a\n * single PK-scoped DELETE, but strategies that maintain auxiliary\n * indexes (delete-triggered external stores, ParadeDB-style secondary\n * structures) may need more.\n */\n buildDelete: (\n this: void,\n tableName: string,\n params: DeleteFulltextParams,\n ) => readonly SqlFragment[];\n\n /**\n * Emits the statements that delete many fulltext rows at once. Returns\n * `[]` when `params.nodeIds` is empty.\n */\n buildBatchDelete: (\n this: void,\n tableName: string,\n params: DeleteFulltextBatchParams,\n ) => readonly SqlFragment[];\n}>;\n\n// ============================================================\n// Shared graph-scoped statements\n// ============================================================\n\n/**\n * Deletes every fulltext row one graph contributed.\n *\n * The fulltext table is DATABASE-global: one physical table whose rows are\n * keyed by `graph_id` and shared by every graph in the database. \"Remove this\n * graph's fulltext content\" therefore has more than one caller — `clearGraph`\n * and the destructive contribution rebuild — and it is one exported statement\n * both use rather than two spellings that would be free to drift.\n */\nexport function buildFulltextGraphDelete(\n tableName: string,\n graphId: string,\n): SqlFragment {\n return sql`\n DELETE FROM ${sql.identifier(tableName)}\n WHERE \"graph_id\" = ${graphId}\n `;\n}\n\n/**\n * The graph ids OTHER than `graphId` that currently have rows in the shared\n * fulltext table, capped at `limit` (the probe only needs to know whether the\n * set is empty, plus a few names for the operator-facing message).\n *\n * The predicate behind \"would tearing this table down destroy content this\n * process cannot put back?\". Fulltext content is derived from a graph's own\n * node rows through its own schema, so only the graph that owns those rows\n * can reconstruct them — another graph's rows are exactly the content a\n * `DROP TABLE` must never take with it.\n */\nexport function buildForeignFulltextGraphProbe(\n tableName: string,\n graphId: string,\n limit: number,\n): SqlFragment {\n return sql`\n SELECT DISTINCT \"graph_id\"\n FROM ${sql.identifier(tableName)}\n WHERE \"graph_id\" <> ${graphId}\n LIMIT ${limit}\n `;\n}\n\n// ============================================================\n// Internal helpers\n// ============================================================\n\nfunction quoteIdentifier(name: string): string {\n return `\"${name.replaceAll('\"', '\"\"')}\"`;\n}\n\nfunction tsvectorColumn(tableName: string): SqlFragment {\n return sql`${sql.identifier(tableName)}.\"tsv\"`;\n}\n\n/**\n * Dedupes batch rows last-write-wins by nodeId. Returns a plain array\n * in insertion order of the last occurrence of each id. Shared by both\n * shipped strategies.\n */\nfunction dedupeFulltextBatchRows(\n rows: readonly FulltextBatchRow[],\n): FulltextBatchRow[] {\n const seen = new Map<string, FulltextBatchRow>();\n for (const row of rows) seen.set(row.nodeId, row);\n return [...seen.values()];\n}\n\nfunction buildPkScopedDelete(\n tableName: string,\n params: DeleteFulltextParams,\n): SqlFragment {\n const table = sql.identifier(tableName);\n return sql`\n DELETE FROM ${table}\n WHERE \"graph_id\" = ${params.graphId}\n AND \"node_kind\" = ${params.nodeKind}\n AND \"node_id\" = ${params.nodeId}\n `;\n}\n\nfunction buildPkScopedBatchDelete(\n tableName: string,\n params: DeleteFulltextBatchParams,\n): SqlFragment | undefined {\n if (params.nodeIds.length === 0) return undefined;\n const unique = [...new Set(params.nodeIds)];\n const table = sql.identifier(tableName);\n return sql`\n DELETE FROM ${table}\n WHERE \"graph_id\" = ${params.graphId}\n AND \"node_kind\" = ${params.nodeKind}\n AND \"node_id\" IN (${sql.join(\n unique.map((id) => sql`${id}`),\n sql`, `,\n )})\n `;\n}\n\n// ============================================================\n// tsvector strategy (PostgreSQL built-in)\n// ============================================================\n\nfunction postgresTsquery(\n mode: FulltextQueryMode,\n query: string,\n language: string | undefined,\n): SqlFragment {\n // The `language` column is already `regconfig`, so the non-override\n // path references the column directly. The per-query override path\n // still arrives as a bound text parameter and needs the cast.\n const langExpr: SqlFragment =\n language === undefined ? sql`\"language\"` : sql`${language}::regconfig`;\n switch (mode) {\n case \"websearch\": {\n return sql`websearch_to_tsquery(${langExpr}, ${query})`;\n }\n case \"phrase\": {\n return sql`phraseto_tsquery(${langExpr}, ${query})`;\n }\n case \"plain\": {\n return sql`plainto_tsquery(${langExpr}, ${query})`;\n }\n case \"raw\": {\n return sql`to_tsquery(${langExpr}, ${query})`;\n }\n default: {\n const _exhaustive: never = mode;\n throw new Error(`Unsupported fulltext mode: ${String(_exhaustive)}`);\n }\n }\n}\n\nexport const tsvectorStrategy: FulltextStrategy = {\n name: \"tsvector\",\n supportedModes: ALL_FULLTEXT_MODES,\n supportsSnippets: true,\n // `raw` mode exposes `foo:*` prefix-match syntax to callers.\n supportsPrefix: true,\n supportsLanguageOverride: true,\n // Canonical Postgres stemmers; every stock install ships these plus a\n // few others. Runtime `to_tsvector` accepts any installed regconfig\n // name — this list is advisory for capability discovery.\n languages: [\n \"simple\",\n \"english\",\n \"french\",\n \"german\",\n \"italian\",\n \"portuguese\",\n \"russian\",\n \"spanish\",\n \"swedish\",\n ] as const,\n\n matchCondition(tableName, query, mode, language) {\n const q = postgresTsquery(mode, query, language);\n return sql`${tsvectorColumn(tableName)} @@ ${q}`;\n },\n\n rankExpression(tableName, query, mode, language) {\n const q = postgresTsquery(mode, query, language);\n return sql`ts_rank_cd(${tsvectorColumn(tableName)}, ${q})`;\n },\n\n snippetExpression(_tableName, query, mode, language) {\n const langExpr: SqlFragment =\n language === undefined ? sql`\"language\"` : sql`${language}::regconfig`;\n const q = postgresTsquery(mode, query, language);\n return sql`ts_headline(${langExpr}, \"content\", ${q}, 'StartSel=<mark>,StopSel=</mark>,MaxFragments=1,MinWords=5,MaxWords=30,ShortWord=3')`;\n },\n\n ownedTables(primaryTableName) {\n const name = quoteIdentifier(primaryTableName);\n const gin = quoteIdentifier(`${primaryTableName}_tsv_idx`);\n const kind = quoteIdentifier(`${primaryTableName}_kind_idx`);\n // `language` is `regconfig` so `to_tsvector(\"language\", \"content\")`\n // is an immutable expression — Postgres can then compute `tsv` as a\n // GENERATED STORED column and own the `content → tsv` invariant.\n // (The text→regconfig cast happens once at INSERT time against the\n // bound parameter, which is fine because it's not inside the\n // generated expression.)\n const createDdl = [\n `CREATE TABLE IF NOT EXISTS ${name} (\n \"graph_id\" TEXT NOT NULL,\n \"node_kind\" TEXT NOT NULL,\n \"node_id\" TEXT NOT NULL,\n \"content\" TEXT NOT NULL,\n \"language\" regconfig NOT NULL,\n \"tsv\" tsvector NOT NULL\n GENERATED ALWAYS AS (to_tsvector(\"language\", \"content\")) STORED,\n \"updated_at\" TIMESTAMPTZ NOT NULL,\n PRIMARY KEY (\"graph_id\", \"node_kind\", \"node_id\")\n);`,\n `CREATE INDEX IF NOT EXISTS ${gin} ON ${name} USING GIN (\"tsv\");`,\n `CREATE INDEX IF NOT EXISTS ${kind} ON ${name} (\"graph_id\", \"node_kind\");`,\n ];\n // drizzle-kit visibility for this default strategy comes from\n // `schema/postgres.ts` exporting the matching `tables.fulltext`\n // pgTable through the barrel — one object, not two. `runtimeEnsure`\n // because drizzle-kit-managed setups create every base table except\n // this strategy-owned one.\n return [\n {\n logicalName: FULLTEXT_CONTRIBUTION_NAME,\n owner: \"tsvector\",\n tableName: primaryTableName,\n createDdl,\n // Both indexes belong to the table, so Postgres drops them with\n // it; no separate DROP INDEX is needed or wanted (naming them\n // would break the moment a future createDdl renames one).\n dropDdl: [`DROP TABLE IF EXISTS ${name};`],\n runtimeEnsure: true,\n },\n ];\n },\n\n buildUpsert(tableName, params, timestamp) {\n const table = sql.identifier(tableName);\n // `tsv` is a GENERATED STORED column — Postgres computes it from\n // `content` + `language`, so it must not appear in the column list\n // or the ON CONFLICT update set.\n return [\n sql`\n INSERT INTO ${table} (\"graph_id\", \"node_kind\", \"node_id\", \"content\", \"language\", \"updated_at\")\n VALUES (\n ${params.graphId}, ${params.nodeKind}, ${params.nodeId},\n ${params.content}, ${params.language}::regconfig,\n ${timestamp}\n )\n ON CONFLICT (\"graph_id\", \"node_kind\", \"node_id\")\n DO UPDATE SET\n \"content\" = EXCLUDED.\"content\",\n \"language\" = EXCLUDED.\"language\",\n \"updated_at\" = EXCLUDED.\"updated_at\"\n `,\n ];\n },\n\n buildBatchUpsert(tableName, params, timestamp) {\n const rows = dedupeFulltextBatchRows(params.rows);\n if (rows.length === 0) return [];\n\n const table = sql.identifier(tableName);\n const valueTuples = rows.map(\n (row) => sql`\n (\n ${params.graphId}, ${params.nodeKind}, ${row.nodeId},\n ${row.content}, ${row.language}::regconfig,\n ${timestamp}\n )\n `,\n );\n\n return [\n sql`\n INSERT INTO ${table} (\"graph_id\", \"node_kind\", \"node_id\", \"content\", \"language\", \"updated_at\")\n VALUES ${sql.join(valueTuples, sql`, `)}\n ON CONFLICT (\"graph_id\", \"node_kind\", \"node_id\")\n DO UPDATE SET\n \"content\" = EXCLUDED.\"content\",\n \"language\" = EXCLUDED.\"language\",\n \"updated_at\" = EXCLUDED.\"updated_at\"\n `,\n ];\n },\n\n buildDelete(tableName, params) {\n return [buildPkScopedDelete(tableName, params)];\n },\n\n buildBatchDelete(tableName, params) {\n const stmt = buildPkScopedBatchDelete(tableName, params);\n return stmt === undefined ? [] : [stmt];\n },\n};\n\n// ============================================================\n// FTS5 strategy (SQLite)\n// ============================================================\n\nfunction translateToFts5Query(query: string, mode: FulltextQueryMode): string {\n switch (mode) {\n case \"phrase\": {\n return `\"${query.replaceAll('\"', '\"\"')}\"`;\n }\n case \"plain\": {\n return query\n .trim()\n .split(/\\s+/u)\n .filter((token) => token.length > 0)\n .map((token) => `\"${token.replaceAll('\"', '\"\"')}\"`)\n .join(\" \");\n }\n case \"websearch\": {\n return translateWebsearchToFts5(query);\n }\n case \"raw\": {\n return query;\n }\n default: {\n const _exhaustive: never = mode;\n throw new Error(`Unsupported fulltext mode: ${String(_exhaustive)}`);\n }\n }\n}\n\nfunction translateWebsearchToFts5(query: string): string {\n const tokens: string[] = [];\n let index = 0;\n\n function skipWhitespace(): void {\n while (index < query.length && /\\s/u.test(query[index] ?? \"\")) {\n index += 1;\n }\n }\n\n function readPhrase(): string {\n index += 1;\n let content = \"\";\n while (index < query.length && query[index] !== '\"') {\n content += query[index] ?? \"\";\n index += 1;\n }\n if (query[index] === '\"') index += 1;\n return `\"${content.replaceAll('\"', '\"\"')}\"`;\n }\n\n function readBareTerm(): string {\n let term = \"\";\n while (index < query.length && !/\\s/u.test(query[index] ?? \"\")) {\n term += query[index] ?? \"\";\n index += 1;\n }\n return term;\n }\n\n while (index < query.length) {\n skipWhitespace();\n if (index >= query.length) break;\n const ch = query[index];\n if (ch === '\"') {\n tokens.push(readPhrase());\n continue;\n }\n if (ch === \"-\") {\n index += 1;\n const term =\n query[index] === '\"' ?\n readPhrase()\n : `\"${readBareTerm().replaceAll('\"', '\"\"')}\"`;\n tokens.push(`NOT ${term}`);\n continue;\n }\n if (ch === \"+\") {\n index += 1;\n continue;\n }\n const bare = readBareTerm();\n if (bare.length === 0) continue;\n if (bare.toUpperCase() === \"OR\") {\n tokens.push(\"OR\");\n continue;\n }\n tokens.push(`\"${bare.replaceAll('\"', '\"\"')}\"`);\n }\n\n if (tokens.length > 0 && tokens[0]?.startsWith(\"NOT \")) {\n tokens.shift();\n }\n\n return tokens.join(\" \");\n}\n\nexport const fts5Strategy: FulltextStrategy = {\n name: \"fts5\",\n supportedModes: ALL_FULLTEXT_MODES,\n supportsSnippets: true,\n // FTS5 supports `foo*` prefix matching natively.\n supportsPrefix: true,\n // FTS5 tokenizer is fixed at table-create time; per-row / per-query\n // language metadata is stored but not consulted.\n supportsLanguageOverride: false,\n // The built-in tokenizer is `porter unicode61 remove_diacritics 2`; the\n // `language` field on searchable() is recorded for future use but not\n // applied at query time.\n languages: [\"porter\", \"unicode61\", \"trigram\"] as const,\n\n matchCondition(tableName, query, mode, _language) {\n const matchExpression = translateToFts5Query(query, mode);\n return sql`${sql.identifier(tableName)} MATCH ${matchExpression}`;\n },\n\n rankExpression(tableName, _query, _mode, _language) {\n // FTS5 bm25() returns a negative score where lower = more relevant.\n // Negate so callers see higher = better (uniform with tsvector).\n return sql`-bm25(${sql.identifier(tableName)})`;\n },\n\n snippetExpression(tableName, _query, _mode, _language) {\n return sql`snippet(${sql.identifier(tableName)}, -1, '<mark>', '</mark>', '…', 20)`;\n },\n\n ownedTables(primaryTableName) {\n const name = quoteIdentifier(primaryTableName);\n // FTS5 virtual tables cannot be modeled as a Drizzle table, so this\n // contribution is raw-ddl: emitted verbatim and invisible to\n // drizzle-kit. `runtimeEnsure` because no drizzle-kit-managed setup\n // can create it.\n return [\n {\n logicalName: FULLTEXT_CONTRIBUTION_NAME,\n owner: \"fts5\",\n tableName: primaryTableName,\n createDdl: [\n `CREATE VIRTUAL TABLE IF NOT EXISTS ${name} USING fts5(\n graph_id UNINDEXED,\n node_kind UNINDEXED,\n node_id UNINDEXED,\n language UNINDEXED,\n updated_at UNINDEXED,\n content,\n tokenize='porter unicode61 remove_diacritics 2'\n);`,\n ],\n // `DROP TABLE` on an FTS5 virtual table also removes the shadow\n // tables (`_data`, `_idx`, `_content`, …) the module created, so\n // one statement is the whole teardown.\n dropDdl: [`DROP TABLE IF EXISTS ${name};`],\n runtimeEnsure: true,\n },\n ];\n },\n\n buildUpsert(tableName, params, timestamp) {\n const table = sql.identifier(tableName);\n // FTS5 virtual tables don't support ON CONFLICT — emulate with\n // DELETE + INSERT, atomic under the caller's outer transaction.\n return [\n sql`\n DELETE FROM ${table}\n WHERE \"graph_id\" = ${params.graphId}\n AND \"node_kind\" = ${params.nodeKind}\n AND \"node_id\" = ${params.nodeId}\n `,\n sql`\n INSERT INTO ${table} (graph_id, node_kind, node_id, content, language, updated_at)\n VALUES (${params.graphId}, ${params.nodeKind}, ${params.nodeId}, ${params.content}, ${params.language}, ${timestamp})\n `,\n ];\n },\n\n buildBatchUpsert(tableName, params, timestamp) {\n const rows = dedupeFulltextBatchRows(params.rows);\n if (rows.length === 0) return [];\n\n const table = sql.identifier(tableName);\n const nodeIds = rows.map((row) => row.nodeId);\n\n const deleteStmt = sql`\n DELETE FROM ${table}\n WHERE \"graph_id\" = ${params.graphId}\n AND \"node_kind\" = ${params.nodeKind}\n AND \"node_id\" IN (${sql.join(\n nodeIds.map((id) => sql`${id}`),\n sql`, `,\n )})\n `;\n\n const valueTuples = rows.map(\n (row) => sql`\n (\n ${params.graphId}, ${params.nodeKind}, ${row.nodeId},\n ${row.content}, ${row.language}, ${timestamp}\n )\n `,\n );\n\n const insertStmt = sql`\n INSERT INTO ${table} (graph_id, node_kind, node_id, content, language, updated_at)\n VALUES ${sql.join(valueTuples, sql`, `)}\n `;\n\n return [deleteStmt, insertStmt];\n },\n\n buildDelete(tableName, params) {\n return [buildPkScopedDelete(tableName, params)];\n },\n\n buildBatchDelete(tableName, params) {\n const stmt = buildPkScopedBatchDelete(tableName, params);\n return stmt === undefined ? [] : [stmt];\n },\n};\n","/**\n * Vector Strategy — pluggable storage + SQL generation for a backend's\n * vector stack. The sibling of {@link FulltextStrategy}: a strategy owns\n * every statement that touches its embedding storage — the per-field DDL,\n * upsert, delete, similarity search, and (optional) ANN index lifecycle —\n * plus the capability advertisement and the distance/score expressions the\n * query compiler splices into its relevance CTE.\n *\n * ## Why a strategy, and why per-(kind, field) storage\n *\n * The spike behind #157 established that \"real\" ANN on every engine we\n * support converges on a\n * **typed, fixed-dimension structure per `(nodeKind, fieldPath)`**:\n *\n * - pgvector: a `vector(N)` column + HNSW/IVFFlat;\n * - libSQL native: an `F32_BLOB(N)` column + `libsql_vector_idx` +\n * `vector_top_k` (a plain `BLOB` or dimensionless `F32_BLOB` is rejected\n * by the index — the dimension must live in the column type);\n * - sqlite-vec: a `vec0(embedding float[N])` virtual table.\n *\n * The legacy single shared `typegraph_node_embeddings` table (one generic\n * column holding mixed-dimension vectors) can only ever be brute-forced;\n * pgvector was the sole engine that hid this, because its index supplies the\n * dimension via a `::vector(N)` cast expression. So storage is the\n * strategy's to own, slot by slot, rather than a fixed global table.\n *\n * Brute force remains a legitimate, capability-advertised mode (libSQL's\n * `vector_distance_cos` over a column with no index, sqlite-vec's\n * `vec_distance_cosine`): a strategy whose `capabilities.indexTypes` is\n * `[\"none\"]` simply never emits an ANN index and `buildSearch` always scans.\n */\nimport { type StrategyTableContribution } from \"../../backend/table-contribution\";\nimport {\n type DeleteEmbeddingParams,\n type UpsertEmbeddingBatchParams,\n type UpsertEmbeddingParams,\n type VectorCapabilities,\n type VectorIndexType,\n type VectorMetric,\n type VectorSearchFrontierTuning,\n type VectorSearchParams,\n} from \"../../backend/types\";\nimport {\n ConfigurationError,\n UnsupportedBackendCapabilityError,\n} from \"../../errors\";\nimport { requireDefined } from \"../../utils/presence\";\nimport { sql, type SqlFragment } from \"../sql-fragment\";\n\n/**\n * `logicalName` prefix of a strategy-owned vector slot. Each\n * `(nodeKind, fieldPath)` pair fills one logical vector slot; the full\n * logical name is `${VECTOR_CONTRIBUTION_PREFIX}:${nodeKind}.${fieldPath}`,\n * stable across table-name overrides and strategy swaps so #135's durable\n * materialization marker survives both.\n */\nexport const VECTOR_CONTRIBUTION_PREFIX = \"vector\";\n\n/**\n * The resolved identity of one embedding field's storage in a graph —\n * everything a strategy needs to DDL, address, and index it.\n *\n * Graph-scoped: each `(graphId, nodeKind, fieldPath)` gets its own physical\n * table. TypeGraph supports many graphs per physical database, and the same\n * `(kind, field)` can carry different embedding dimensions across graphs — a\n * shared per-`(kind, field)` table would collide on the fixed column type\n * (`vector(N)` / `F32_BLOB(N)`). Graph-scoping also makes libSQL's\n * table-global `vector_top_k` per-graph-exact (no cross-graph recall bleed).\n */\nexport type VectorSlot = Readonly<{\n /** Graph the embedding belongs to — scopes the physical table. */\n graphId: string;\n /** Node kind owning the embedding field (e.g. `\"Document\"`). */\n nodeKind: string;\n /** Dot-path of the embedding field within the node props (e.g. `\"embedding\"`). */\n fieldPath: string;\n /** Fixed vector dimension `N` for this field — carried into the column type. */\n dimensions: number;\n /** Distance metric the field's index is built for. */\n metric: VectorMetric;\n /**\n * Index type to materialize. `\"none\"` means brute-force only (no ANN\n * index emitted); the strategy still stores and searches the field.\n */\n indexType: VectorIndexType;\n /**\n * Optional ANN index tuning carried into the index DDL (pgvector\n * `m`/`ef_construction`/`lists`). Present on the create-index / re-embed\n * paths (resolved from the field's `embedding()` declaration); omitted on\n * the write/search ensure paths, where the strategy falls back to defaults.\n */\n indexParams?: Readonly<{\n m?: number;\n efConstruction?: number;\n lists?: number;\n }>;\n}>;\n\n/**\n * Derives the `VectorCapabilities` a backend advertises from its active\n * strategy, so the two never drift (mirrors `buildFulltextCapabilities`).\n * The strategy is the single source of truth; there are no per-call-site\n * `SQLITE_VECTOR_*` constants.\n */\nexport function buildVectorCapabilities(\n strategy: VectorStrategy,\n): VectorCapabilities {\n return strategy.capabilities;\n}\n\n/**\n * A pluggable vector implementation. Each strategy is self-contained:\n * given a {@link VectorSlot}, it emits every statement the backend and\n * compiler need — per-field storage DDL, writes, similarity search, ANN\n * index lifecycle — and advertises exactly the metrics and index types it\n * can honor. Adding the Nth backend is one of these objects; no core edits.\n */\nexport type VectorStrategy = Readonly<{\n /** Human-readable identifier used in error messages and telemetry. */\n name: string;\n\n /**\n * The metrics, index types, and dimension ceiling this strategy honors —\n * advertised verbatim as `backend.capabilities.vector`. Asymmetry across\n * engines is legitimate and explicit here (pgvector has `inner_product`;\n * libSQL/sqlite-vec do not), never a silent runtime failure.\n */\n capabilities: VectorCapabilities;\n\n /**\n * Deterministic physical table (or virtual-table) name backing a field in\n * a graph. The compiler references this to scan the right per-field storage,\n * and the backend uses it to route upserts/deletes. Must be a stable,\n * collision-safe SQL identifier derived from `(graphId, nodeKind, fieldPath)`.\n */\n tableName: (\n this: void,\n graphId: string,\n nodeKind: string,\n fieldPath: string,\n ) => string;\n\n /**\n * The per-field storage this strategy owns for `slot`, as Drizzle-free\n * `StrategyTableContribution`s (resolved `tableName`, deterministic\n * idempotent `createDdl` for the table **and** its ANN index when the\n * slot's `indexType` warrants one, `runtimeEnsure`). Rides the #129/#135\n * table-contribution + durable-materialization machinery exactly as the\n * FTS5 / tsvector virtual tables do — these are materialized per graph by\n * `materializeIndexes()`, not by global `bootstrapTables`.\n */\n ownedTables: (\n this: void,\n slot: VectorSlot,\n ) => readonly StrategyTableContribution[];\n\n /**\n * Emits the statement(s) that upsert a single embedding into the slot's\n * storage. Multiple statements are allowed for engines that cannot upsert\n * a vector in one statement (e.g. a `vec0` virtual table → DELETE+INSERT).\n */\n buildUpsert: (\n this: void,\n slot: VectorSlot,\n params: UpsertEmbeddingParams,\n timestamp: string,\n ) => readonly SqlFragment[];\n\n /**\n * Emits the statement(s) that upsert MANY embeddings into the slot's\n * storage in multi-row form. Optional — the backend falls back to one\n * {@link buildUpsert} per row when unset. The backend guarantees the\n * rows carry distinct `nodeId`s and fit the connection's bound-parameter\n * budget (it chunks before calling).\n */\n buildUpsertBatch?: (\n this: void,\n slot: VectorSlot,\n params: UpsertEmbeddingBatchParams,\n timestamp: string,\n ) => readonly SqlFragment[];\n\n /** Emits the statement(s) that delete a single embedding from the slot. */\n buildDelete: (\n this: void,\n slot: VectorSlot,\n params: DeleteEmbeddingParams,\n ) => readonly SqlFragment[];\n /** Emits one set-based delete for many node ids in a vector slot. */\n buildDeleteBatch: (\n this: void,\n slot: VectorSlot,\n params: Omit<DeleteEmbeddingParams, \"nodeId\"> &\n Readonly<{ nodeIds: readonly string[] }>,\n ) => readonly SqlFragment[];\n\n /**\n * Raw DDL statement(s) that drop the slot's entire physical storage\n * (table + ANN index, and any engine-managed shadow tables). Used by the\n * destructive `store.reembedVectorField()` path to recreate a field's\n * storage at a new dimension. Returned as raw strings (like\n * `ownedTables(...).createDdl`) for `backend.executeDdl`; must be idempotent\n * (`IF EXISTS`).\n */\n buildDropStorage: (this: void, slot: VectorSlot) => readonly string[];\n\n /**\n * Emits the similarity-search query for the `backend.vectorSearch` path,\n * returning rows shaped `{ node_id, score }` ordered best-first. The\n * strategy picks brute-force vs ANN based on whether `slot.indexType`\n * materialized an index — the caller never branches. `score` follows the\n * shared convention (cosine → similarity `1 - distance`; l2 /\n * inner_product → raw distance), so `coerceVectorScore` / fusion stay\n * dialect-neutral.\n *\n * `candidates`, when provided, is a subquery yielding the node ids\n * eligible to appear in results (the backend passes its live-node-ids\n * subquery so top-k is computed over live rows in SQL — see\n * `liveNodeIdsSubquery`). Strategies whose ANN form cannot take the\n * filter directly must over-fetch and post-filter, documenting the\n * recall bound. A custom strategy that ignores the argument keeps the\n * pre-pushdown behavior: tombstoned ids are dropped after top-k during\n * hydration, so results can shrink below `limit` under index drift.\n */\n buildSearch: (\n this: void,\n slot: VectorSlot,\n params: VectorSearchParams,\n candidates?: SqlFragment,\n ) => SqlFragment;\n\n /**\n * True when {@link buildSearch} returns EXACT rankings — a brute-force\n * engine form, not an approximate index (sqlite-vec's vec0 KNN scans\n * every row in C). The query compiler then routes the NON-approximate\n * `.similarTo()` branch through `buildSearch` too: same results as the\n * SQL distance scan, at engine speed (measured 489ms -> 113ms at 50k\n * on the SQLite lane). Leave false/absent when the engine form is or\n * can be approximate (pgvector planner rewrites, libSQL DiskANN):\n * exactness of the default path is a semantic guarantee.\n */\n searchIsExact?: boolean;\n\n /**\n * The distance expression over the slot's embedding column, used by the\n * **query compiler** to splice vector relevance into its CTE. This is the\n * one genuinely engine-specific fragment (`vec_distance_cosine` vs\n * `<=>` vs `vector_distance_cos`); the surrounding score / minScore /\n * ORDER BY math is shared (see {@link vectorScoreExpression} etc.).\n *\n * `embeddingColumn` is the already-qualified column SQL; `queryEmbedding`\n * is formatted by the strategy into its engine's literal form.\n */\n distanceExpression: (\n this: void,\n embeddingColumn: SqlFragment,\n queryEmbedding: readonly number[],\n metric: VectorMetric,\n ) => SqlFragment;\n\n /**\n * Emits the ANN index creation statement for a slot, or `undefined` when\n * indexing is inline (vec0) or unsupported (brute-force-only strategies).\n * Invoked through `backend.createVectorIndex` during `materializeIndexes`.\n */\n buildCreateIndex?: (\n this: void,\n slot: VectorSlot,\n options?: Readonly<{ concurrent?: boolean }>,\n ) => SqlFragment | undefined;\n\n /** Emits the ANN index drop statement, or `undefined` when not applicable. */\n buildDropIndex?: (this: void, slot: VectorSlot) => SqlFragment | undefined;\n}>;\n\n// ============================================================\n// Shared, dialect-neutral expression math\n// ============================================================\n//\n// These transforms are identical across pgvector / sqlite-vec / libSQL —\n// only `distanceExpression` differs — so they live once here and are reused\n// by both `buildSearch` implementations and the compiler CTE builder.\n\n/**\n * Converts a distance expression into a score expression (higher = better).\n * Cosine distance is mapped to similarity (`1 - d`); l2 and inner_product\n * are returned as-is (lower distance already ranks better, ordered ASC).\n */\nexport function vectorScoreExpression(\n distanceExpression: SqlFragment,\n metric: VectorMetric,\n): SqlFragment {\n switch (metric) {\n case \"cosine\": {\n return sql`(1 - (${distanceExpression}))`;\n }\n case \"l2\":\n case \"inner_product\": {\n return distanceExpression;\n }\n default: {\n const _exhaustive: never = metric;\n throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);\n }\n }\n}\n\n/**\n * Builds the `minScore` WHERE condition against a distance expression,\n * translating the score threshold back into the metric's distance space.\n */\nexport function vectorMinScoreCondition(\n distanceExpression: SqlFragment,\n metric: VectorMetric,\n minScore: number,\n): SqlFragment {\n // Validate against the RESOLVED metric — both the compiler's relevance CTE\n // and the backend search path funnel here, so an out-of-range floor (e.g. a\n // cosine minScore of 5 → `distance <= 1 - 5`, which matches nothing) is\n // rejected loudly instead of silently returning zero rows.\n assertVectorMinScore(minScore, metric);\n switch (metric) {\n case \"cosine\": {\n return sql`${distanceExpression} <= ${1 - minScore}`;\n }\n case \"l2\": {\n return sql`${distanceExpression} <= ${minScore}`;\n }\n case \"inner_product\": {\n return sql`${distanceExpression} <= ${-minScore}`;\n }\n default: {\n const _exhaustive: never = metric;\n throw new Error(`Unsupported vector metric: ${String(_exhaustive)}`);\n }\n }\n}\n\n/**\n * Validates that every value in an embedding is a finite number. Shared by\n * strategies so a NaN/Infinity is reported with the offending index before\n * it reaches engine-specific literal formatting (which would mask it).\n */\nexport function assertFiniteEmbedding(\n embedding: readonly number[],\n name: string,\n): void {\n for (const [index, value] of embedding.entries()) {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new TypeError(\n `${name}[${index}] must be a finite number, got: ${value}`,\n );\n }\n }\n}\n\n/**\n * Validates a vector-search `limit` is a positive integer. Enforced by the\n * backend's `vectorSearch` (defense in depth — the store boundary also\n * checks) so a direct backend call with `limit: 0` fails loudly instead of\n * silently scanning nothing.\n */\nexport function assertVectorSearchLimit(limit: number): void {\n if (!Number.isInteger(limit) || limit <= 0) {\n throw new RangeError(\n `vectorSearch limit must be a positive integer, got: ${limit}`,\n );\n }\n}\n\n/**\n * The frontier declaration of a backend's active vector strategy, or the\n * \"there is no vector engine here\" declaration when vector support is\n * disabled. Total, so a call site never has to invent a default: a backend\n * with no strategy has nothing to apply an override to and refuses on the\n * same arm as an engine that lacks the knob.\n */\nexport function vectorSearchFrontierTuning(\n strategy: VectorStrategy | undefined,\n): VectorSearchFrontierTuning {\n return (\n strategy?.capabilities.searchFrontierTuning ?? {\n tunable: false,\n reason: \"vector support is disabled on this backend\",\n }\n );\n}\n\n/** What one backend needs to decide whether it can apply an `efSearch`. */\nexport type EfSearchApplicability = Readonly<{\n /** The caller's override; `undefined` (no override) is always accepted. */\n efSearch: number | undefined;\n /** Index type of the slot being searched. */\n indexType: VectorIndexType;\n /** The active strategy's declaration. See {@link VectorSearchFrontierTuning}. */\n tuning: VectorSearchFrontierTuning;\n /** Whether the backend can open the frame a scoped override needs. */\n transactions: boolean;\n /**\n * Dialect name used in the refusal message (`\"PostgreSQL\"` / `\"SQLite\"`) —\n * the only dialect-specific token in the decision, so both backends read\n * the same predicate rather than re-spelling the arms.\n */\n dialect: string;\n /** Engine identity recorded in the refusal details (`strategy.name`). */\n engine: string;\n}>;\n\n/**\n * The single owner of \"may this backend apply a per-search `efSearch`?\" —\n * returning the engine parameter to set with it, or `undefined` when no\n * override was requested.\n *\n * An accepted option is applied or refused, never ignored: every arm below is\n * a state in which the option cannot reach the engine, and each throws naming\n * that state instead of dropping the value. Both backends call this before\n * building the search, so the SQLite and PostgreSQL behaviors are two readings\n * of one predicate — the sqlite-vec silent no-op existed precisely because the\n * decision lived only on the PostgreSQL side. Returning the parameter (rather\n * than only asserting) is what keeps it one owner: the caller that applies the\n * override never re-derives whether it may.\n *\n * Refusals:\n *\n * - engine has no per-search frontier knob at all (`tunable: false`) —\n * `UnsupportedBackendCapabilityError` on `vector.searchFrontierTuning`,\n * carrying the strategy's own `reason`.\n * - slot is not the tunable index type — `ConfigurationError` (the caller can\n * fix this by declaring the index, so it is configuration, not capability).\n * - the override needs a transaction to be scoped to and the backend has none\n * — `UnsupportedBackendCapabilityError` on `transactions`.\n *\n * Range validation (pgvector's 1..1000) stays with the engine that has the\n * range; this predicate answers only whether the knob exists here at all.\n */\nexport function resolveEfSearchOverride(\n applicability: EfSearchApplicability,\n): string | undefined {\n const { efSearch, indexType, tuning, transactions, dialect, engine } =\n applicability;\n if (efSearch === undefined) return undefined;\n if (!tuning.tunable) {\n throw new UnsupportedBackendCapabilityError(\n `${dialect} efSearch override`,\n \"vector.searchFrontierTuning\",\n { efSearch, engine, reason: tuning.reason },\n `Omit efSearch: ${engine} has no per-search ANN frontier parameter (${tuning.reason}). Tune recall with the search limit, or use an exact search.`,\n );\n }\n if (indexType !== tuning.indexType) {\n // \"an HNSW vector index\" — the article suits the one tunable index type\n // any bundled engine declares.\n throw new ConfigurationError(\n `${dialect} efSearch requires an ${tuning.indexType.toUpperCase()} vector index.`,\n { efSearch, indexType },\n {\n suggestion: `Configure the embedding with index: { type: \"${tuning.indexType}\" }, or omit efSearch.`,\n },\n );\n }\n if (tuning.requiresTransactionScope && !transactions) {\n throw new UnsupportedBackendCapabilityError(\n `${dialect} efSearch override`,\n \"transactions\",\n { efSearch, engine, parameter: tuning.parameter },\n `Use a transactional ${dialect} driver: ${tuning.parameter} is scoped to the search's own transaction, and a session-wide setting would leak into concurrent searches.`,\n );\n }\n return tuning.parameter;\n}\n\n/** What one call site needs to decide whether ANN retrieval can be honored. */\nexport type ApproximateRetrievalRequest = Readonly<{\n /** Whether the caller STATED `approximate: true`. */\n approximate: boolean | undefined;\n /**\n * The metric the caller explicitly overrode to, or `undefined` when they\n * passed none (in which case the slot's declared metric is used and no\n * mismatch is possible).\n */\n requestedMetric: VectorMetric | undefined;\n /** The metric the slot's storage and ANN structure were built for. */\n declaredMetric: VectorMetric;\n /** The slot's index type; `\"none\"` means there is no ANN structure at all. */\n indexType: VectorIndexType;\n /** Kind and field named in the refusal, so a union says WHICH slot refused. */\n nodeKind: string;\n fieldPath: string;\n}>;\n\n/**\n * The single owner of \"can this slot serve APPROXIMATE retrieval under the\n * metric the caller asked for?\".\n *\n * Every engine materializes metric-specific ANN structures — vec0 bakes\n * `distance_metric` into the virtual table, libSQL's DiskANN index is built\n * with `metric=…`, pgvector's index carries a per-metric operator class — so\n * an ANN structure can only retrieve under the metric it was built for.\n * Retrieving by the declared metric and re-scoring under an overridden one\n * returns the declared metric's neighbors wearing the override's scores: the\n * wrong rows, silently.\n *\n * Stating `approximate: true` alongside a mismatched `metric` therefore states\n * two things that cannot both hold. The option is refused naming both metrics\n * rather than downgraded to an exact scan behind the caller's back — the same\n * accepted-or-refused rule {@link resolveEfSearchOverride} applies to\n * `efSearch`.\n *\n * NOT refused, deliberately:\n *\n * - `indexType: \"none\"`. There is no ANN structure to be bound to a metric, so\n * `approximate` has nothing to opt into and compiles to the strategy's exact\n * scan under whichever metric was asked for. That degradation is stated on\n * the public `SimilarToOptions.approximate` option.\n * - A mismatched metric with NO `approximate`. An exact scan computes any\n * metric over the stored vectors correctly, and nothing was stated that the\n * engine cannot honor. (`store.search.vector` refuses that override too, on\n * its own broader rule — see `assertVectorQueryCompatible` in\n * `store/search.ts`. The query builder's exact path is deliberately the\n * wider surface; only the *silent* half is closed here.)\n */\nexport function assertApproximateMetricSupported(\n request: ApproximateRetrievalRequest,\n): void {\n const {\n approximate,\n requestedMetric,\n declaredMetric,\n indexType,\n nodeKind,\n fieldPath,\n } = request;\n if (approximate !== true) return;\n if (indexType === \"none\") return;\n if (requestedMetric === undefined || requestedMetric === declaredMetric) {\n return;\n }\n throw new ConfigurationError(\n `Approximate retrieval for \"${nodeKind}.${fieldPath}\" cannot use metric \"${requestedMetric}\": its ${indexType.toUpperCase()} index is built for \"${declaredMetric}\", and an ANN structure only retrieves under the metric it was built for.`,\n {\n nodeKind,\n fieldPath,\n requestedMetric,\n declaredMetric,\n indexType,\n },\n {\n suggestion: `Omit metric (or pass \"${declaredMetric}\") to keep approximate retrieval, or drop approximate to scan exactly under \"${requestedMetric}\".`,\n },\n );\n}\n\n/**\n * Validates a `minScore` floor against its (resolved) metric: it must be finite,\n * and for cosine it must lie in [-1, 1] (a cosine score is the `1 - distance`\n * similarity). Shared by the store facade, the compiler's relevance CTE\n * ({@link vectorMinScoreCondition}), and the backend search path so every entry\n * point rejects the same out-of-range floor instead of silently returning none.\n */\nexport function assertVectorMinScore(\n minScore: number,\n metric: VectorMetric,\n label = \"minScore\",\n): void {\n if (!Number.isFinite(minScore)) {\n throw new RangeError(`${label} must be a finite number, got: ${minScore}`);\n }\n if (metric === \"cosine\" && Math.abs(minScore) > 1) {\n throw new RangeError(\n `${label} for the cosine metric must be between -1 and 1, got: ${minScore}`,\n );\n }\n}\n\n// ============================================================\n// Shared physical naming\n// ============================================================\n\n/**\n * pgvector inherits Postgres' 63-byte identifier ceiling; SQLite/libSQL are\n * far more generous, so the smallest common cap keeps one naming scheme\n * across every strategy.\n */\nconst MAX_VECTOR_IDENTIFIER_LENGTH = 63;\n\nfunction sanitizeIdentifierPart(value: string): string {\n return value.toLowerCase().replaceAll(/[^a-z0-9_]/g, \"_\");\n}\n\n/**\n * Deterministic 8-char hash for collision-safe truncation of over-long\n * identifiers. Self-contained so the strategy layer has no backend-runtime\n * dependency.\n */\nexport function shortHash(input: string): string {\n let h1 = 0xde_ad_be_ef;\n let h2 = 0x41_c6_ce_57;\n for (let index = 0; index < input.length; index++) {\n const ch = requireDefined(input.codePointAt(index));\n h1 = Math.imul(h1 ^ ch, 0x9e_37_79_b1);\n h2 = Math.imul(h2 ^ ch, 0x5f_35_64_95);\n }\n h1 =\n Math.imul(h1 ^ (h1 >>> 16), 0x85_eb_ca_6b) ^\n Math.imul(h2 ^ (h2 >>> 13), 0xc2_b2_ae_35);\n h2 =\n Math.imul(h2 ^ (h2 >>> 16), 0x85_eb_ca_6b) ^\n Math.imul(h1 ^ (h1 >>> 13), 0xc2_b2_ae_35);\n const hi = (h2 >>> 0).toString(16).padStart(8, \"0\");\n const lo = (h1 >>> 0).toString(16).padStart(8, \"0\");\n return `${hi}${lo}`.slice(0, 8);\n}\n\n/**\n * Deterministic per-`(graphId, nodeKind, fieldPath)` physical name. Shared by\n * every strategy's `tableName`, by index naming, and by the compiler's\n * per-field table resolution so all three agree on which physical object backs\n * a field in a graph. Truncated with a hash suffix past the 63-char ceiling;\n * the hash covers all three parts, so truncation stays collision-safe even\n * when long graph ids dominate the prefix.\n *\n * @example `vectorPhysicalName(\"tg_vec\", \"g1\", \"Document\", \"embedding\")`\n * → `\"tg_vec_g1_document_embedding_<hash8>\"`\n */\nexport function vectorPhysicalName(\n prefix: string,\n graphId: string,\n nodeKind: string,\n fieldPath: string,\n): string {\n const readable = `${prefix}_${sanitizeIdentifierPart(graphId)}_${sanitizeIdentifierPart(nodeKind)}_${sanitizeIdentifierPart(fieldPath)}`;\n // Always suffix a hash of the EXACT (graphId, nodeKind, fieldPath) tuple.\n // Sanitization is lossy (case-folding, every non-`[a-z0-9_]` char → `_`) and\n // the `_` join is ambiguous, so distinct fields can share a readable part —\n // e.g. (\"a_b\",\"c\") vs (\"a\",\"b_c\"), or \"Doc-A\" vs \"Doc_A\" vs \"doc\". The hash\n // keeps their physical tables distinct so writes/searches never cross fields.\n const hash = shortHash(JSON.stringify([graphId, nodeKind, fieldPath]));\n const full = `${readable}_${hash}`;\n if (full.length <= MAX_VECTOR_IDENTIFIER_LENGTH) return full;\n // Over the ceiling: truncate the readable part, always keep the hash.\n return `${readable.slice(0, MAX_VECTOR_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;\n}\n\n/**\n * Double-quote a SQL identifier, escaping embedded quotes. Dialect-neutral\n * (both SQLite and Postgres use `\"...\"`), so the three vector strategies share\n * one implementation for quoting their per-field table / index names.\n */\nexport function quoteIdentifier(name: string): string {\n return `\"${name.replaceAll('\"', '\"\"')}\"`;\n}\n"]}
@@ -1,20 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunkBFUOME67_cjs = require('./chunk-BFUOME67.cjs');
4
- var chunk6NGW27EO_cjs = require('./chunk-6NGW27EO.cjs');
3
+ var chunk7B7I7YAW_cjs = require('./chunk-7B7I7YAW.cjs');
4
+ var chunkCRZ56SZU_cjs = require('./chunk-CRZ56SZU.cjs');
5
+ var chunkVLBTRXA2_cjs = require('./chunk-VLBTRXA2.cjs');
5
6
  var zod = require('zod');
6
7
 
7
8
  // src/core/node.ts
8
9
  function validateSchemaKeys(schema, name) {
9
- chunk6NGW27EO_cjs.assertSchemaKeysAreFree("Node", name, schema, chunk6NGW27EO_cjs.RESERVED_NODE_KEYS);
10
+ chunkVLBTRXA2_cjs.assertSchemaKeysAreFree("Node", name, schema, chunkVLBTRXA2_cjs.RESERVED_NODE_KEYS);
10
11
  }
11
12
  function defineNode(name, options) {
13
+ chunkCRZ56SZU_cjs.assertClaimAxisSafe(name, "Node kind");
12
14
  validateSchemaKeys(options.schema, name);
13
15
  if (options.annotations !== void 0) {
14
- chunk6NGW27EO_cjs.assertJsonValue(options.annotations, "annotations", `Node "${name}"`);
16
+ chunkVLBTRXA2_cjs.assertJsonValue(options.annotations, "annotations", `Node "${name}"`);
15
17
  }
16
18
  return Object.freeze({
17
- [chunkBFUOME67_cjs.NODE_TYPE_BRAND]: true,
19
+ [chunk7B7I7YAW_cjs.NODE_TYPE_BRAND]: true,
18
20
  kind: name,
19
21
  schema: options.schema,
20
22
  description: options.description,
@@ -23,16 +25,16 @@ function defineNode(name, options) {
23
25
  }
24
26
  var EMPTY_SCHEMA = zod.z.object({});
25
27
  function validateSchemaKeys2(schema, name) {
26
- chunk6NGW27EO_cjs.assertSchemaKeysAreFree("Edge", name, schema, chunk6NGW27EO_cjs.RESERVED_EDGE_KEYS);
28
+ chunkVLBTRXA2_cjs.assertSchemaKeysAreFree("Edge", name, schema, chunkVLBTRXA2_cjs.RESERVED_EDGE_KEYS);
27
29
  }
28
30
  function defineEdge(name, options) {
29
31
  const schema = options?.schema ?? EMPTY_SCHEMA;
30
32
  validateSchemaKeys2(schema, name);
31
33
  if (options?.annotations !== void 0) {
32
- chunk6NGW27EO_cjs.assertJsonValue(options.annotations, "annotations", `Edge "${name}"`);
34
+ chunkVLBTRXA2_cjs.assertJsonValue(options.annotations, "annotations", `Edge "${name}"`);
33
35
  }
34
36
  return Object.freeze({
35
- [chunkBFUOME67_cjs.EDGE_TYPE_BRAND]: true,
37
+ [chunk7B7I7YAW_cjs.EDGE_TYPE_BRAND]: true,
36
38
  kind: name,
37
39
  schema,
38
40
  description: options?.description,
@@ -59,5 +61,5 @@ exports.defineEdge = defineEdge;
59
61
  exports.defineNode = defineNode;
60
62
  exports.getTypeName = getTypeName;
61
63
  exports.isMetaEdge = isMetaEdge;
62
- //# sourceMappingURL=chunk-26YKDNUD.cjs.map
63
- //# sourceMappingURL=chunk-26YKDNUD.cjs.map
64
+ //# sourceMappingURL=chunk-PS3TUWJM.cjs.map
65
+ //# sourceMappingURL=chunk-PS3TUWJM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/node.ts","../src/core/edge.ts","../src/ontology/types.ts"],"names":["assertSchemaKeysAreFree","RESERVED_NODE_KEYS","assertClaimAxisSafe","assertJsonValue","NODE_TYPE_BRAND","z","validateSchemaKeys","RESERVED_EDGE_KEYS","EDGE_TYPE_BRAND"],"mappings":";;;;;;;;AAoCA,SAAS,kBAAA,CACP,QACA,IAAA,EACM;AACN,EAAAA,yCAAA,CAAwB,MAAA,EAAQ,IAAA,EAA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,IACA,aAAa,OAAA,EAAS,WAAA;AAAA,IACtB,aAAa,OAAA,EAAS,WAAA;AAAA,IACtB,MAAM,OAAA,EAAS,IAAA;AAAA,IACf,IAAI,OAAA,EAAS;AAAA,GACd,CAAA;AACH;;;AC7HO,IAAM,eAAA,GAAkB;AA+ExB,SAAS,WAAW,KAAA,EAAmC;AAC5D,EAAA,OACE,OAAO,UAAU,QAAA,IACjB,KAAA,KAAU,QACV,eAAA,IAAmB,KAAA,IAClB,KAAA,CAAkC,eAAe,CAAA,KAAM,IAAA;AAE5D;AAKO,SAAS,YAAY,SAAA,EAAiD;AAC3E,EAAA,IAAI,OAAO,cAAc,QAAA,EAAU;AACjC,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,OAAO,SAAA,CAAU,IAAA;AACnB","file":"chunk-PS3TUWJM.cjs","sourcesContent":["import { type z } from \"zod\";\n\nimport { assertClaimAxisSafe } from \"../store/claims/axis\";\nimport {\n assertSchemaKeysAreFree,\n RESERVED_NODE_KEYS,\n} from \"../store/reserved-keys\";\nimport { assertJsonValue } from \"./json-value\";\nimport { type KindAnnotations, NODE_TYPE_BRAND, type NodeType } from \"./types\";\n\n// ============================================================\n// Node Factory Options\n// ============================================================\n\n/**\n * Options for defining a node type.\n */\nexport type DefineNodeOptions<S extends z.ZodObject<z.ZodRawShape>> = Readonly<{\n /** Zod schema for node properties */\n schema: S;\n /** Optional description for documentation */\n description?: string;\n /**\n * Consumer-owned structured annotations for the kind.\n *\n * Stored in the canonical schema and **participates in schema hashing** —\n * any change bumps the schema version and shows up as a `safe`-severity\n * diff in `getSchemaChanges`. See `KindAnnotations` for the contract.\n */\n annotations?: KindAnnotations;\n}>;\n\n// ============================================================\n// Node Factory\n// ============================================================\n\nfunction validateSchemaKeys(\n schema: z.ZodObject<z.ZodRawShape>,\n name: string,\n): void {\n assertSchemaKeysAreFree(\"Node\", name, schema, RESERVED_NODE_KEYS);\n}\n\n/**\n * Creates a node type definition.\n *\n * @example\n * ```typescript\n * const Person = defineNode(\"Person\", {\n * schema: z.object({\n * fullName: z.string().min(1),\n * email: z.string().email().optional(),\n * }),\n * description: \"A person in the system\",\n * });\n * ```\n */\nexport function defineNode<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n>(name: K, options: DefineNodeOptions<S>): NodeType<K, S> {\n // A kind name is a claim axis, so it may not contain the code point reserved\n // for building the axes that are not kinds.\n assertClaimAxisSafe(name, \"Node kind\");\n validateSchemaKeys(options.schema, name);\n if (options.annotations !== undefined) {\n assertJsonValue(options.annotations, \"annotations\", `Node \"${name}\"`);\n }\n\n return Object.freeze({\n [NODE_TYPE_BRAND]: true as const,\n kind: name,\n schema: options.schema,\n description: options.description,\n annotations: options.annotations,\n });\n}\n","import { z } from \"zod\";\n\nimport {\n assertSchemaKeysAreFree,\n RESERVED_EDGE_KEYS,\n} from \"../store/reserved-keys\";\nimport { assertJsonValue } from \"./json-value\";\nimport {\n EDGE_TYPE_BRAND,\n type EdgeType,\n type KindAnnotations,\n type NodeType,\n} from \"./types\";\n\n// ============================================================\n// Edge Factory Options\n// ============================================================\n\n/**\n * Options for defining an edge type.\n */\nexport type DefineEdgeOptions<\n S extends z.ZodObject<z.ZodRawShape>,\n From extends readonly NodeType[] | undefined = undefined,\n To extends readonly NodeType[] | undefined = undefined,\n> = Readonly<{\n /** Zod schema for edge properties (defaults to empty object) */\n schema?: S;\n /** Optional description for documentation */\n description?: string;\n /**\n * Consumer-owned structured annotations for the kind.\n *\n * Stored in the canonical schema and **participates in schema hashing** —\n * any change bumps the schema version and shows up as a `safe`-severity\n * diff in `getSchemaChanges`. See `KindAnnotations` for the contract.\n */\n annotations?: KindAnnotations;\n /** Node types that can be the source of this edge (domain constraint) */\n from?: From;\n /** Node types that can be the target of this edge (range constraint) */\n to?: To;\n}>;\n\n// ============================================================\n// Empty Schema\n// ============================================================\n\nconst EMPTY_SCHEMA = z.object({});\ntype EmptySchema = typeof EMPTY_SCHEMA;\n\n// ============================================================\n// Edge Factory\n// ============================================================\n\nfunction validateSchemaKeys(\n schema: z.ZodObject<z.ZodRawShape>,\n name: string,\n): void {\n assertSchemaKeysAreFree(\"Edge\", name, schema, RESERVED_EDGE_KEYS);\n}\n\n/**\n * Creates an edge type definition.\n *\n * @example\n * ```typescript\n * // Edge with no properties\n * const hasEpisode = defineEdge(\"hasEpisode\");\n *\n * // Edge with properties\n * const employedAt = defineEdge(\"employedAt\", {\n * schema: z.object({\n * isPrimary: z.boolean().default(true),\n * startedAt: z.date(),\n * }),\n * description: \"Employment relationship\",\n * });\n *\n * // Edge with domain/range constraints (can be used directly in defineGraph)\n * const worksAt = defineEdge(\"worksAt\", {\n * schema: z.object({ role: z.string() }),\n * from: [Person],\n * to: [Company],\n * });\n * ```\n */\n// Overload: no options - returns edge without domain/range\nexport function defineEdge<K extends string>(name: K): EdgeType<K, EmptySchema>;\n\n// Overload: options with both from and to - returns edge with domain/range\nexport function defineEdge<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n From extends readonly NodeType[],\n To extends readonly NodeType[],\n>(\n name: K,\n options: DefineEdgeOptions<S, From, To> & { from: From; to: To },\n): EdgeType<K, S, From, To>;\n\n// Overload: options without from/to - returns edge without domain/range\nexport function defineEdge<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n>(name: K, options: DefineEdgeOptions<S>): EdgeType<K, S>;\n\n// Implementation\nexport function defineEdge<\n K extends string,\n S extends z.ZodObject<z.ZodRawShape>,\n From extends readonly NodeType[] | undefined,\n To extends readonly NodeType[] | undefined,\n>(\n name: K,\n options?: DefineEdgeOptions<S, From, To>,\n): EdgeType<K, S, From, To> | EdgeType<K, EmptySchema> {\n const schema = options?.schema ?? EMPTY_SCHEMA;\n validateSchemaKeys(schema, name);\n if (options?.annotations !== undefined) {\n assertJsonValue(options.annotations, \"annotations\", `Edge \"${name}\"`);\n }\n\n return Object.freeze({\n [EDGE_TYPE_BRAND]: true as const,\n kind: name,\n schema,\n description: options?.description,\n annotations: options?.annotations,\n from: options?.from,\n to: options?.to,\n }) as EdgeType<K, S, From, To> | EdgeType<K, EmptySchema>;\n}\n","import { type EdgeType, type NodeType } from \"../core/types\";\n\n// ============================================================\n// Brand Key\n// ============================================================\n\n/** Brand key for MetaEdge */\nexport const META_EDGE_BRAND = \"__metaEdge\" as const;\n\n// ============================================================\n// Inference Types\n// ============================================================\n\n/**\n * How a meta-edge affects queries and validation.\n */\nexport type InferenceType =\n | \"subsumption\" // Query for X includes instances of subclasses\n | \"hierarchy\" // Enables broader/narrower traversal\n | \"substitution\" // Can substitute equivalent types\n | \"constraint\" // Validation rules\n | \"composition\" // Part-whole navigation\n | \"association\" // Discovery/recommendation\n | \"none\"; // No automatic inference\n\n// ============================================================\n// Meta-Edge Properties\n// ============================================================\n\n/**\n * Properties of a meta-edge.\n */\nexport type MetaEdgeProperties = Readonly<{\n transitive: boolean; // A→B, B→C implies A→C\n symmetric: boolean; // A→B implies B→A\n reflexive: boolean; // A→A is always true\n inverse: string | undefined; // Name of inverse meta-edge\n inference: InferenceType; // How this affects queries\n description: string | undefined;\n}>;\n\n// ============================================================\n// Meta-Edge Type\n// ============================================================\n\n/**\n * A meta-edge definition.\n *\n * Meta-edges represent type-level relationships (between kinds),\n * not instance-level relationships (between nodes).\n */\nexport type MetaEdge<K extends string = string> = Readonly<{\n [META_EDGE_BRAND]: true;\n name: K;\n properties: MetaEdgeProperties;\n}>;\n\n// ============================================================\n// Ontology Relation\n// ============================================================\n\n/**\n * A relation in the ontology (instance of meta-edge between types).\n *\n * @example\n * ```typescript\n * // Podcast subClassOf Media\n * subClassOf(Podcast, Media)\n *\n * // Person equivalentTo schema:Person\n * equivalentTo(Person, \"https://schema.org/Person\")\n * ```\n */\nexport type OntologyRelation = Readonly<{\n metaEdge: MetaEdge;\n from: NodeType | EdgeType | string; // string for external IRIs\n to: NodeType | EdgeType | string;\n}>;\n\n// ============================================================\n// Type Guards\n// ============================================================\n\n/**\n * Checks if a value is a MetaEdge.\n */\nexport function isMetaEdge(value: unknown): value is MetaEdge {\n return (\n typeof value === \"object\" &&\n value !== null &&\n META_EDGE_BRAND in value &&\n (value as Record<string, unknown>)[META_EDGE_BRAND] === true\n );\n}\n\n/**\n * Gets the type name from a NodeType, EdgeType, or IRI string.\n */\nexport function getTypeName(typeOrIri: NodeType | EdgeType | string): string {\n if (typeof typeOrIri === \"string\") {\n return typeOrIri;\n }\n return typeOrIri.kind;\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { SYSTEM_INDEX_DECLARATIONS, systemIndexName } from './chunk-SDBBMD4N.js';
2
- import { compileNodeIndexKeys, compileIndexWhere, compileEdgeIndexKeys } from './chunk-ZDKTPBGV.js';
3
- import { isSqlFragment, renderSql, throwUnsupportedSqlChunk, bindSqlValue, sql as sql$1 } from './chunk-3DMMGT6S.js';
1
+ import { SYSTEM_INDEX_DECLARATIONS, systemIndexName } from './chunk-36VYWVQU.js';
2
+ import { compileNodeIndexKeys, compileIndexWhere, compileEdgeIndexKeys } from './chunk-7G5IYROL.js';
3
+ import { isSqlFragment, renderSql, throwUnsupportedSqlChunk, bindSqlValue, sql as sql$1 } from './chunk-7QFRK6PU.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-OMZ37BM2.js.map
383
- //# sourceMappingURL=chunk-OMZ37BM2.js.map
382
+ //# sourceMappingURL=chunk-PVFFH7TL.js.map
383
+ //# sourceMappingURL=chunk-PVFFH7TL.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,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,uBAAA,CAAwB,WAAW,CAAC,CAAA;AAAA,EAC9D;AACA,EAAA,MAAM,oBAAA,GAAuB,EAAA;AAC7B,EAAA,MAAM,WAAW,oBAAA,CAAqB,OAAA;AACtC,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,WAAW,CAAA,kCAAA,CAAoC,CAAA;AAAA,EACpE;AACA,EAAA,OAAO,QAAA,CAAS,WAAW,KAAK,CAAA;AAClC;AASO,SAAS,YAAA,CACd,UACA,OAAA,EACY;AACZ,EAAA,MAAM,MAAA,GAAS,QAAA,CAAS,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,KAAU;AAC5C,IAAA,QAAQ,MAAM,IAAA;AAAM,MAClB,KAAK,MAAA,EAAQ;AACX,QAAA,OAAOA,GAAA,CAAW,GAAA,CAAI,KAAA,CAAM,KAAK,CAAA;AAAA,MACnC;AAAA,MACA,KAAK,YAAA,EAAc;AAKjB,QAAA,OAAOA,GAAA,CAAW,IAAI,CAAA,CAAA,EAAI,KAAA,CAAM,MAAM,UAAA,CAAW,GAAA,EAAK,IAAI,CAAC,CAAA,CAAA,CAAG,CAAA;AAAA,MAChE;AAAA,MACA,KAAK,WAAA,EAAa;AAChB,QAAA,OAAOA,IAAW,KAAA,CAAM,YAAA,CAAa,KAAA,CAAM,KAAA,EAAO,OAAO,CAAC,CAA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AAAA,GACzC,CAAE,GAAA;AAAA,IAAI,CAAC,gBACL,YAAA,CAAa,eAAA,CAAgB,mBAAmB,WAAA,CAAY,MAAM,CAAC,CAAA,CAAE,EAAA;AAAA,MACnE,GAAG,yBAAA,CAA0B,WAAA,EAAa,OAAO;AAAA;AACnD,GACF;AACF;AAEO,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-OMZ37BM2.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,EAA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AO;AAAA;AACnD,GACF;AACF;AAEO,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-PVFFH7TL.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"]}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ // src/backend/sqlite/local-options.ts
4
+ var DEFAULT_LOCAL_SQLITE_PRAGMAS = {
5
+ journalMode: "wal",
6
+ synchronous: "normal",
7
+ busyTimeoutMs: 5e3,
8
+ cacheSizeKib: void 0,
9
+ mmapSizeBytes: void 0,
10
+ walAutocheckpointPages: void 0
11
+ };
12
+
13
+ exports.DEFAULT_LOCAL_SQLITE_PRAGMAS = DEFAULT_LOCAL_SQLITE_PRAGMAS;
14
+ //# sourceMappingURL=chunk-QCD5JKU4.cjs.map
15
+ //# sourceMappingURL=chunk-QCD5JKU4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/backend/sqlite/local-options.ts"],"names":[],"mappings":";;;AA8BO,IAAM,4BAAA,GACX;AAAA,EACE,WAAA,EAAa,KAAA;AAAA,EACb,WAAA,EAAa,QAAA;AAAA,EACb,aAAA,EAAe,GAAA;AAAA,EACf,YAAA,EAAc,MAAA;AAAA,EACd,aAAA,EAAe,MAAA;AAAA,EACf,sBAAA,EAAwB;AAC1B","file":"chunk-QCD5JKU4.cjs","sourcesContent":["/** Journal modes accepted by local SQLite connections. */\nexport type LocalSqliteJournalMode =\n \"wal\" | \"delete\" | \"truncate\" | \"persist\" | \"memory\" | \"off\";\n\n/** Synchronous levels accepted by local SQLite connections. */\nexport type LocalSqliteSynchronousMode = \"off\" | \"normal\" | \"full\" | \"extra\";\n\n/** Connection pragmas applied when TypeGraph opens a local SQLite database. */\nexport type LocalSqlitePragmaOptions = Readonly<{\n /** `PRAGMA journal_mode`. Default: `\"wal\"` (no-op on `\":memory:\"`). */\n journalMode?: LocalSqliteJournalMode;\n /** `PRAGMA synchronous`. Default: `\"normal\"`. */\n synchronous?: LocalSqliteSynchronousMode;\n /** `PRAGMA busy_timeout`, in milliseconds. Default: `5000`. */\n busyTimeoutMs?: number;\n /**\n * `PRAGMA cache_size`, expressed as a negative KiB value. Positive values\n * mean pages in SQLite and are rejected to prevent accidental oversizing.\n */\n cacheSizeKib?: number | undefined;\n /** `PRAGMA mmap_size`, in non-negative bytes. */\n mmapSizeBytes?: number | undefined;\n /**\n * `PRAGMA wal_autocheckpoint`, in WAL pages. Use `0` to disable automatic\n * checkpoints and run them explicitly after controlled bulk loads.\n */\n walAutocheckpointPages?: number | undefined;\n}>;\n\n/** Defaults for TypeGraph-owned local SQLite connections. */\nexport const DEFAULT_LOCAL_SQLITE_PRAGMAS: Required<LocalSqlitePragmaOptions> =\n {\n journalMode: \"wal\",\n synchronous: \"normal\",\n busyTimeoutMs: 5000,\n cacheSizeKib: undefined,\n mmapSizeBytes: undefined,\n walAutocheckpointPages: undefined,\n };\n"]}
@@ -1,4 +1,6 @@
1
- import { ConfigurationError } from './chunk-ZLONH2UD.js';
1
+ import { carryFirstPartyFactoryMark } from './chunk-LKZDQ2B4.js';
2
+ import { ConfigurationError } from './chunk-YDEJQWOL.js';
3
+ import { createDataKeyedBag } from './chunk-DYATYRY4.js';
2
4
 
3
5
  // src/backend/graph-backend-keys.ts
4
6
  var GRAPH_BACKEND_PROJECTION_KEYS = [
@@ -41,8 +43,13 @@ var GRAPH_BACKEND_PROJECTION_KEYS = [
41
43
  "insertUniqueBatch",
42
44
  "deleteUnique",
43
45
  "hardDeleteUniquesByNodeIds",
46
+ "hardDeleteUniquesByConcreteKind",
44
47
  "checkUnique",
45
48
  "checkUniqueBatch",
49
+ "claimEdgeCardinality",
50
+ "claimEdgeCardinalityBatch",
51
+ "purgeEdgeClaims",
52
+ "readConstraintFenceViolations",
46
53
  "getActiveSchema",
47
54
  "getSchemaVersion",
48
55
  "commitSchemaVersion",
@@ -94,6 +101,7 @@ var GRAPH_BACKEND_PROJECTION_KEYS = [
94
101
  "ensureFulltextTable",
95
102
  "ensureIdentityTables",
96
103
  "identityTableDdl",
104
+ "recordedTableDdl",
97
105
  "getReconciliationMarker",
98
106
  "setReconciliationMarker",
99
107
  "clearGraph",
@@ -106,6 +114,7 @@ var GRAPH_BACKEND_PROJECTION_KEYS = [
106
114
  "executeRaw",
107
115
  "compileSql",
108
116
  "executeDdl",
117
+ "ensureExtension",
109
118
  "transaction",
110
119
  "close"
111
120
  ];
@@ -279,6 +288,7 @@ function deriveBackend(base, overrides) {
279
288
  }
280
289
  });
281
290
  carryBackendResourceAudit(decoratedBackend, base);
291
+ carryFirstPartyFactoryMark(decoratedBackend, base);
282
292
  return decoratedBackend;
283
293
  }
284
294
  function projectBackend(base, keys) {
@@ -288,6 +298,7 @@ function projectBackend(base, keys) {
288
298
  });
289
299
  const projection = Object.fromEntries(entries);
290
300
  carryBackendResourceAudit(projection, base);
301
+ carryFirstPartyFactoryMark(projection, base);
291
302
  return projection;
292
303
  }
293
304
  function projectGraphBackend(base) {
@@ -563,6 +574,21 @@ function parseDimensionMismatch(error) {
563
574
  return void 0;
564
575
  }
565
576
 
577
+ // src/schema/canonical.ts
578
+ function sortedReplacer(_key, value) {
579
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
580
+ const sorted = createDataKeyedBag();
581
+ for (const key of Object.keys(value).toSorted()) {
582
+ sorted[key] = value[key];
583
+ }
584
+ return sorted;
585
+ }
586
+ return value;
587
+ }
588
+ function canonicalEqual(a, b) {
589
+ return JSON.stringify(a, sortedReplacer) === JSON.stringify(b, sortedReplacer);
590
+ }
591
+
566
592
  // src/utils/array.ts
567
593
  function chunk(items, size) {
568
594
  if (!Number.isSafeInteger(size) || size < 1) {
@@ -587,6 +613,6 @@ function groupBy(items, keyFor) {
587
613
  return groups;
588
614
  }
589
615
 
590
- export { acquireSerializedStreamLease, auditBackendResource, chunk, deriveBackend, errorChain, groupBy, isDuplicatePrimaryKeyError, isInsufficientResourcesError, isMissingTableError, isPostgresConcurrentDdlRaceError, isSqliteNotAuthorizedError, isSqliteStaleSnapshotError, parseDimensionMismatch, postgresReadWriteRefusedSqlState, postgresTemporaryTableUnavailableSqlState, projectBackend, projectGraphBackend, resolveDeclaredBackendResource, snapshotExportContention, withRecordedRelationsPrecondition, wrapWithManagedClose };
591
- //# sourceMappingURL=chunk-UGHG7PGX.js.map
592
- //# sourceMappingURL=chunk-UGHG7PGX.js.map
616
+ export { acquireSerializedStreamLease, auditBackendResource, canonicalEqual, chunk, deriveBackend, errorChain, groupBy, isDuplicatePrimaryKeyError, isInsufficientResourcesError, isMissingTableError, isPostgresConcurrentDdlRaceError, isSqliteNotAuthorizedError, isSqliteStaleSnapshotError, parseDimensionMismatch, postgresReadWriteRefusedSqlState, postgresTemporaryTableUnavailableSqlState, projectBackend, projectGraphBackend, resolveDeclaredBackendResource, snapshotExportContention, sortedReplacer, withRecordedRelationsPrecondition, wrapWithManagedClose };
617
+ //# sourceMappingURL=chunk-QG5VEOKX.js.map
618
+ //# sourceMappingURL=chunk-QG5VEOKX.js.map