@nicia-ai/typegraph 0.37.0 → 0.38.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 (372) hide show
  1. package/README.md +12 -10
  2. package/dist/backend/drizzle/indexes.cjs +32 -0
  3. package/dist/backend/drizzle/indexes.cjs.map +1 -0
  4. package/dist/backend/drizzle/indexes.d.cts +43 -0
  5. package/dist/backend/drizzle/indexes.d.ts +43 -0
  6. package/dist/backend/drizzle/indexes.js +11 -0
  7. package/dist/backend/drizzle/indexes.js.map +1 -0
  8. package/dist/backend/index.cjs +161 -0
  9. package/dist/backend/index.cjs.map +1 -0
  10. package/dist/backend/index.d.cts +3 -0
  11. package/dist/backend/index.d.ts +3 -0
  12. package/dist/backend/index.js +8 -0
  13. package/dist/backend/index.js.map +1 -0
  14. package/dist/backend/postgres/index.cjs +32 -28
  15. package/dist/backend/postgres/index.d.cts +13 -12
  16. package/dist/backend/postgres/index.d.ts +13 -12
  17. package/dist/backend/postgres/index.js +19 -15
  18. package/dist/backend/postgres/pglite-store.cjs +67 -0
  19. package/dist/backend/postgres/pglite-store.cjs.map +1 -0
  20. package/dist/backend/postgres/pglite-store.d.cts +38 -0
  21. package/dist/backend/postgres/pglite-store.d.ts +38 -0
  22. package/dist/backend/postgres/pglite-store.js +65 -0
  23. package/dist/backend/postgres/pglite-store.js.map +1 -0
  24. package/dist/backend/postgres/pglite.cjs +25 -50
  25. package/dist/backend/postgres/pglite.cjs.map +1 -1
  26. package/dist/backend/postgres/pglite.d.cts +10 -9
  27. package/dist/backend/postgres/pglite.d.ts +10 -9
  28. package/dist/backend/postgres/pglite.js +20 -52
  29. package/dist/backend/postgres/pglite.js.map +1 -1
  30. package/dist/backend/sqlite/index.cjs +29 -25
  31. package/dist/backend/sqlite/index.d.cts +11 -11
  32. package/dist/backend/sqlite/index.d.ts +11 -11
  33. package/dist/backend/sqlite/index.js +17 -13
  34. package/dist/backend/sqlite/libsql.cjs +23 -19
  35. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  36. package/dist/backend/sqlite/libsql.d.cts +9 -10
  37. package/dist/backend/sqlite/libsql.d.ts +9 -10
  38. package/dist/backend/sqlite/libsql.js +19 -15
  39. package/dist/backend/sqlite/libsql.js.map +1 -1
  40. package/dist/backend/sqlite/local-store.cjs +72 -0
  41. package/dist/backend/sqlite/local-store.cjs.map +1 -0
  42. package/dist/backend/sqlite/local-store.d.cts +42 -0
  43. package/dist/backend/sqlite/local-store.d.ts +42 -0
  44. package/dist/backend/sqlite/local-store.js +67 -0
  45. package/dist/backend/sqlite/local-store.js.map +1 -0
  46. package/dist/backend/sqlite/local.cjs +28 -183
  47. package/dist/backend/sqlite/local.cjs.map +1 -1
  48. package/dist/backend/sqlite/local.d.cts +8 -81
  49. package/dist/backend/sqlite/local.d.ts +8 -81
  50. package/dist/backend/sqlite/local.js +20 -180
  51. package/dist/backend/sqlite/local.js.map +1 -1
  52. package/dist/chunk-2EBMPJBO.js +16 -0
  53. package/dist/chunk-2EBMPJBO.js.map +1 -0
  54. package/dist/{chunk-NBP2WTJW.cjs → chunk-2SL7OGPR.cjs} +2900 -1597
  55. package/dist/chunk-2SL7OGPR.cjs.map +1 -0
  56. package/dist/chunk-35S6P5ZU.js +27 -0
  57. package/dist/chunk-35S6P5ZU.js.map +1 -0
  58. package/dist/chunk-3LKL3S6X.js +50 -0
  59. package/dist/chunk-3LKL3S6X.js.map +1 -0
  60. package/dist/chunk-6G5CQ6JX.js +47 -0
  61. package/dist/chunk-6G5CQ6JX.js.map +1 -0
  62. package/dist/chunk-6XDBRDZE.js +312 -0
  63. package/dist/chunk-6XDBRDZE.js.map +1 -0
  64. package/dist/chunk-764JHTLT.cjs +15 -0
  65. package/dist/chunk-764JHTLT.cjs.map +1 -0
  66. package/dist/chunk-76HE7DJP.js +68 -0
  67. package/dist/chunk-76HE7DJP.js.map +1 -0
  68. package/dist/{chunk-VGDDG3XJ.cjs → chunk-7M3NACL3.cjs} +12 -12
  69. package/dist/{chunk-VGDDG3XJ.cjs.map → chunk-7M3NACL3.cjs.map} +1 -1
  70. package/dist/{chunk-NXQFATMF.cjs → chunk-7VLCN3JB.cjs} +153 -123
  71. package/dist/chunk-7VLCN3JB.cjs.map +1 -0
  72. package/dist/{chunk-552KNYQJ.js → chunk-A2FGSWMQ.js} +1907 -607
  73. package/dist/chunk-A2FGSWMQ.js.map +1 -0
  74. package/dist/chunk-AOL64O4Z.js +165 -0
  75. package/dist/chunk-AOL64O4Z.js.map +1 -0
  76. package/dist/{chunk-27SSDCEP.cjs → chunk-B63IFHXR.cjs} +53 -74
  77. package/dist/chunk-B63IFHXR.cjs.map +1 -0
  78. package/dist/{chunk-3XXGYU62.cjs → chunk-BKAKAVRW.cjs} +56 -53
  79. package/dist/chunk-BKAKAVRW.cjs.map +1 -0
  80. package/dist/{chunk-YTSN73ND.js → chunk-BQITNFQJ.js} +3 -3
  81. package/dist/{chunk-YTSN73ND.js.map → chunk-BQITNFQJ.js.map} +1 -1
  82. package/dist/{chunk-NUIG3BCV.cjs → chunk-CQC6VBAF.cjs} +93 -155
  83. package/dist/chunk-CQC6VBAF.cjs.map +1 -0
  84. package/dist/{chunk-6EEO3OVU.cjs → chunk-CWX77JB4.cjs} +22 -59
  85. package/dist/chunk-CWX77JB4.cjs.map +1 -0
  86. package/dist/{chunk-UGZUAYAR.js → chunk-D7PG5D5K.js} +4 -3
  87. package/dist/chunk-D7PG5D5K.js.map +1 -0
  88. package/dist/chunk-DDCIXXOO.js +9 -0
  89. package/dist/chunk-DDCIXXOO.js.map +1 -0
  90. package/dist/chunk-DDCYVIVV.cjs +44 -0
  91. package/dist/chunk-DDCYVIVV.cjs.map +1 -0
  92. package/dist/{chunk-XPCZADMT.cjs → chunk-DOVMTPKE.cjs} +89 -27
  93. package/dist/chunk-DOVMTPKE.cjs.map +1 -0
  94. package/dist/{chunk-5PNMDJ7J.js → chunk-DPNA466P.js} +14 -9
  95. package/dist/chunk-DPNA466P.js.map +1 -0
  96. package/dist/{chunk-BYPOGQWK.js → chunk-DRACN6XG.js} +6 -4
  97. package/dist/chunk-DRACN6XG.js.map +1 -0
  98. package/dist/chunk-E6TXEISH.cjs +175 -0
  99. package/dist/chunk-E6TXEISH.cjs.map +1 -0
  100. package/dist/{chunk-TKT2XHED.js → chunk-E6YZRKMM.js} +13 -12
  101. package/dist/chunk-E6YZRKMM.js.map +1 -0
  102. package/dist/{chunk-3C2RYI6L.cjs → chunk-EOJFGECD.cjs} +11 -11
  103. package/dist/chunk-EOJFGECD.cjs.map +1 -0
  104. package/dist/{chunk-XWV4JT34.js → chunk-ERZ4QPQX.js} +27 -22
  105. package/dist/chunk-ERZ4QPQX.js.map +1 -0
  106. package/dist/{chunk-DFVLCOP6.js → chunk-EZH7FNUS.js} +3 -3
  107. package/dist/{chunk-DFVLCOP6.js.map → chunk-EZH7FNUS.js.map} +1 -1
  108. package/dist/{chunk-WWFHO375.cjs → chunk-FJMPR3OH.cjs} +4 -3
  109. package/dist/chunk-FJMPR3OH.cjs.map +1 -0
  110. package/dist/chunk-FMNUSGZ4.cjs +12 -0
  111. package/dist/chunk-FMNUSGZ4.cjs.map +1 -0
  112. package/dist/{chunk-K3Q3LJY3.js → chunk-G32AO634.js} +201 -100
  113. package/dist/chunk-G32AO634.js.map +1 -0
  114. package/dist/{chunk-EXU3RASM.js → chunk-G3CSQLLT.js} +20 -474
  115. package/dist/chunk-G3CSQLLT.js.map +1 -0
  116. package/dist/chunk-GNPGGLAE.cjs +212 -0
  117. package/dist/chunk-GNPGGLAE.cjs.map +1 -0
  118. package/dist/{chunk-QARBLBXT.cjs → chunk-GUUWKPTK.cjs} +7 -7
  119. package/dist/{chunk-QARBLBXT.cjs.map → chunk-GUUWKPTK.cjs.map} +1 -1
  120. package/dist/chunk-GYA4JRP5.js +31 -0
  121. package/dist/chunk-GYA4JRP5.js.map +1 -0
  122. package/dist/chunk-I6FX7AAG.js +39 -0
  123. package/dist/chunk-I6FX7AAG.js.map +1 -0
  124. package/dist/chunk-IMQKXL4E.cjs +12 -0
  125. package/dist/{chunk-QSXTWU4U.cjs.map → chunk-IMQKXL4E.cjs.map} +1 -1
  126. package/dist/chunk-J6IJARLG.js +94 -0
  127. package/dist/chunk-J6IJARLG.js.map +1 -0
  128. package/dist/{chunk-W63OVYY4.js → chunk-K34OPSJK.js} +3 -3
  129. package/dist/{chunk-W63OVYY4.js.map → chunk-K34OPSJK.js.map} +1 -1
  130. package/dist/{chunk-TGOMW4MB.cjs → chunk-KCLZHYPU.cjs} +110 -109
  131. package/dist/chunk-KCLZHYPU.cjs.map +1 -0
  132. package/dist/{chunk-XGPUQ56G.js → chunk-KFLXWVUJ.js} +4 -38
  133. package/dist/chunk-KFLXWVUJ.js.map +1 -0
  134. package/dist/{chunk-3DS7Z4T4.cjs → chunk-LZ3TVJY4.cjs} +44 -43
  135. package/dist/chunk-LZ3TVJY4.cjs.map +1 -0
  136. package/dist/{chunk-UXLSNRYL.js → chunk-MTNEGGM2.js} +4 -4
  137. package/dist/chunk-MTNEGGM2.js.map +1 -0
  138. package/dist/{chunk-IP3CGGPA.cjs → chunk-N2V3HJFV.cjs} +92 -185
  139. package/dist/chunk-N2V3HJFV.cjs.map +1 -0
  140. package/dist/chunk-NAUA4PW5.cjs +28 -0
  141. package/dist/chunk-NAUA4PW5.cjs.map +1 -0
  142. package/dist/chunk-NMQ6C6TS.cjs +61 -0
  143. package/dist/chunk-NMQ6C6TS.cjs.map +1 -0
  144. package/dist/{chunk-2N6EOBTH.cjs → chunk-NPWACFQJ.cjs} +58 -53
  145. package/dist/chunk-NPWACFQJ.cjs.map +1 -0
  146. package/dist/{chunk-5KEQ74YU.cjs → chunk-NT6ILURI.cjs} +9 -86
  147. package/dist/chunk-NT6ILURI.cjs.map +1 -0
  148. package/dist/chunk-NU23DUSJ.cjs +192 -0
  149. package/dist/chunk-NU23DUSJ.cjs.map +1 -0
  150. package/dist/{chunk-WOJMKB3N.cjs → chunk-NWYCOFEZ.cjs} +1677 -308
  151. package/dist/chunk-NWYCOFEZ.cjs.map +1 -0
  152. package/dist/{chunk-3GH67G4Z.cjs → chunk-O5H62ZWJ.cjs} +4 -42
  153. package/dist/chunk-O5H62ZWJ.cjs.map +1 -0
  154. package/dist/{chunk-3SLPDKHQ.js → chunk-PH4IJ3V5.js} +5 -77
  155. package/dist/chunk-PH4IJ3V5.js.map +1 -0
  156. package/dist/chunk-PWXGB77L.cjs +56 -0
  157. package/dist/chunk-PWXGB77L.cjs.map +1 -0
  158. package/dist/chunk-PZHC5GCD.js +193 -0
  159. package/dist/chunk-PZHC5GCD.js.map +1 -0
  160. package/dist/chunk-QMQLUA66.js +12 -0
  161. package/dist/chunk-QMQLUA66.js.map +1 -0
  162. package/dist/{chunk-5WWVZMVX.js → chunk-QZ7A6HBM.js} +2 -2
  163. package/dist/{chunk-5WWVZMVX.js.map → chunk-QZ7A6HBM.js.map} +1 -1
  164. package/dist/{chunk-VKGKDOKR.js → chunk-RQPRCEIO.js} +1539 -206
  165. package/dist/chunk-RQPRCEIO.js.map +1 -0
  166. package/dist/chunk-RW24SAHI.cjs +74 -0
  167. package/dist/chunk-RW24SAHI.cjs.map +1 -0
  168. package/dist/{chunk-BVRDGYXQ.cjs → chunk-SAFZ6JTI.cjs} +14 -9
  169. package/dist/chunk-SAFZ6JTI.cjs.map +1 -0
  170. package/dist/{chunk-L7HQ2OSI.js → chunk-SCTZRFW5.js} +87 -166
  171. package/dist/chunk-SCTZRFW5.js.map +1 -0
  172. package/dist/{chunk-5KPNWT6X.js → chunk-SDHV2MWU.js} +24 -45
  173. package/dist/chunk-SDHV2MWU.js.map +1 -0
  174. package/dist/chunk-SVJ5GEXW.cjs +45 -0
  175. package/dist/chunk-SVJ5GEXW.cjs.map +1 -0
  176. package/dist/chunk-SVUKGWSN.cjs +102 -0
  177. package/dist/chunk-SVUKGWSN.cjs.map +1 -0
  178. package/dist/chunk-TAUGGLNQ.js +59 -0
  179. package/dist/chunk-TAUGGLNQ.js.map +1 -0
  180. package/dist/{chunk-J4IUSYFF.js → chunk-TE5ZA4VX.js} +69 -27
  181. package/dist/chunk-TE5ZA4VX.js.map +1 -0
  182. package/dist/{chunk-A42GCBGX.cjs → chunk-TRF4EBJT.cjs} +6 -4
  183. package/dist/chunk-TRF4EBJT.cjs.map +1 -0
  184. package/dist/{chunk-KQJ54OG5.js → chunk-U4JDJKPD.js} +19 -56
  185. package/dist/chunk-U4JDJKPD.js.map +1 -0
  186. package/dist/chunk-UH2USOMG.cjs +627 -0
  187. package/dist/chunk-UH2USOMG.cjs.map +1 -0
  188. package/dist/{chunk-RCVLFTCT.js → chunk-UPXDVI3T.js} +13 -12
  189. package/dist/chunk-UPXDVI3T.js.map +1 -0
  190. package/dist/{chunk-5VQM6VWP.cjs → chunk-UWG5GX6E.cjs} +2 -2
  191. package/dist/{chunk-5VQM6VWP.cjs.map → chunk-UWG5GX6E.cjs.map} +1 -1
  192. package/dist/{chunk-3RWZPJKV.js → chunk-VBH7ZXSZ.js} +21 -78
  193. package/dist/chunk-VBH7ZXSZ.js.map +1 -0
  194. package/dist/{chunk-K5UBVGJN.js → chunk-VDYA2HMS.js} +6 -6
  195. package/dist/{chunk-K5UBVGJN.js.map → chunk-VDYA2HMS.js.map} +1 -1
  196. package/dist/chunk-X4PVHAZ6.cjs +83 -0
  197. package/dist/chunk-X4PVHAZ6.cjs.map +1 -0
  198. package/dist/{chunk-UYQMBBWJ.js → chunk-X6CNEA32.js} +23 -20
  199. package/dist/chunk-X6CNEA32.js.map +1 -0
  200. package/dist/chunk-X6RDQ5NB.cjs +335 -0
  201. package/dist/chunk-X6RDQ5NB.cjs.map +1 -0
  202. package/dist/chunk-XD6X7O5R.js +184 -0
  203. package/dist/chunk-XD6X7O5R.js.map +1 -0
  204. package/dist/{chunk-DIQ3AV5W.cjs → chunk-XFY73JWD.cjs} +324 -224
  205. package/dist/chunk-XFY73JWD.cjs.map +1 -0
  206. package/dist/{chunk-DEFQM7JU.cjs → chunk-XRU7V7FF.cjs} +7 -7
  207. package/dist/{chunk-DEFQM7JU.cjs.map → chunk-XRU7V7FF.cjs.map} +1 -1
  208. package/dist/{chunk-TPF25IG6.js → chunk-XZA3Y4YH.js} +3 -3
  209. package/dist/{chunk-TPF25IG6.js.map → chunk-XZA3Y4YH.js.map} +1 -1
  210. package/dist/chunk-Y7M44XEK.js +462 -0
  211. package/dist/chunk-Y7M44XEK.js.map +1 -0
  212. package/dist/{chunk-RRSNR3TP.js → chunk-YIRLBUNN.js} +3 -3
  213. package/dist/{chunk-RRSNR3TP.js.map → chunk-YIRLBUNN.js.map} +1 -1
  214. package/dist/{chunk-IXGYRP2P.js → chunk-YJDSPA5E.js} +79 -49
  215. package/dist/chunk-YJDSPA5E.js.map +1 -0
  216. package/dist/{chunk-JBNOGRKW.cjs → chunk-YLINFV7Z.cjs} +157 -115
  217. package/dist/chunk-YLINFV7Z.cjs.map +1 -0
  218. package/dist/{chunk-QERAIDRJ.js → chunk-Z2PPIVOO.js} +82 -22
  219. package/dist/chunk-Z2PPIVOO.js.map +1 -0
  220. package/dist/chunk-Z5QHVL5U.cjs +12 -0
  221. package/dist/chunk-Z5QHVL5U.cjs.map +1 -0
  222. package/dist/chunk-ZDH3DX3C.cjs +30 -0
  223. package/dist/chunk-ZDH3DX3C.cjs.map +1 -0
  224. package/dist/chunk-ZE6NVENI.js +77 -0
  225. package/dist/chunk-ZE6NVENI.js.map +1 -0
  226. package/dist/chunk-ZHX4KEM7.cjs +49 -0
  227. package/dist/chunk-ZHX4KEM7.cjs.map +1 -0
  228. package/dist/chunk-ZKZAIX42.cjs +479 -0
  229. package/dist/chunk-ZKZAIX42.cjs.map +1 -0
  230. package/dist/{chunk-TEDRJXOG.cjs → chunk-ZY4GXIVN.cjs} +5 -5
  231. package/dist/{chunk-TEDRJXOG.cjs.map → chunk-ZY4GXIVN.cjs.map} +1 -1
  232. package/dist/core/index.cjs +117 -0
  233. package/dist/core/index.cjs.map +1 -0
  234. package/dist/core/index.d.cts +225 -0
  235. package/dist/core/index.d.ts +225 -0
  236. package/dist/core/index.js +12 -0
  237. package/dist/core/index.js.map +1 -0
  238. package/dist/{ddl-CS0KUVwB.d.ts → ddl-Dx3Z0_WC.d.ts} +3 -3
  239. package/dist/{ddl-BD-ZfKeX.d.cts → ddl-J6sDyABg.d.cts} +3 -3
  240. package/dist/define-graph-CzEvA_8F.d.cts +174 -0
  241. package/dist/define-graph-DRo9xpYN.d.ts +174 -0
  242. package/dist/{extension-types-BM2ACfYO.d.cts → extension-types-BLEVH4SG.d.cts} +1 -1
  243. package/dist/{extension-types-BM2ACfYO.d.ts → extension-types-BLEVH4SG.d.ts} +1 -1
  244. package/dist/graph-extension/index.cjs +21 -19
  245. package/dist/graph-extension/index.d.cts +4 -4
  246. package/dist/graph-extension/index.d.ts +4 -4
  247. package/dist/graph-extension/index.js +6 -4
  248. package/dist/graph-merge/index.cjs +265 -214
  249. package/dist/graph-merge/index.cjs.map +1 -1
  250. package/dist/graph-merge/index.d.cts +8 -89
  251. package/dist/graph-merge/index.d.ts +8 -89
  252. package/dist/graph-merge/index.js +141 -90
  253. package/dist/graph-merge/index.js.map +1 -1
  254. package/dist/{index-BeacbPoe.d.ts → index-BD_3TCgh.d.ts} +6 -4
  255. package/dist/{index-BPM59vsg.d.cts → index-BihFPsPu.d.cts} +6 -4
  256. package/dist/{fulltext-strategy-C27vXaeB.d.cts → index-Bq7vSPHy.d.ts} +3195 -2646
  257. package/dist/{fulltext-strategy-DebsMrqg.d.ts → index-CrFL_ENI.d.cts} +3195 -2646
  258. package/dist/index.cjs +326 -315
  259. package/dist/index.cjs.map +1 -1
  260. package/dist/index.d.cts +59 -240
  261. package/dist/index.d.ts +59 -240
  262. package/dist/index.js +46 -79
  263. package/dist/index.js.map +1 -1
  264. package/dist/indexes/index.cjs +26 -38
  265. package/dist/indexes/index.d.cts +6 -41
  266. package/dist/indexes/index.d.ts +6 -41
  267. package/dist/indexes/index.js +14 -10
  268. package/dist/interchange/index.cjs +48 -39
  269. package/dist/interchange/index.cjs.map +1 -1
  270. package/dist/interchange/index.d.cts +7 -8
  271. package/dist/interchange/index.d.ts +7 -8
  272. package/dist/interchange/index.js +23 -14
  273. package/dist/interchange/index.js.map +1 -1
  274. package/dist/local-options-CZ1BnIoF.d.cts +29 -0
  275. package/dist/local-options-CZ1BnIoF.d.ts +29 -0
  276. package/dist/{manager-D00_NXvT.d.ts → manager-CASfhmzV.d.ts} +4 -173
  277. package/dist/{manager-nU1vTJLy.d.cts → manager-nCEJiYBb.d.cts} +4 -173
  278. package/dist/{materialize-indexes-zK2J_flP.d.ts → materialize-indexes-D4iei4Kp.d.ts} +1 -1
  279. package/dist/{materialize-indexes-CuR3gAZb.d.cts → materialize-indexes-ExQ6OrAh.d.cts} +1 -1
  280. package/dist/{postgres-IaBA4RgE.d.ts → postgres-Cl1ZAN1G.d.ts} +1 -1
  281. package/dist/{postgres-YrYmPlaU.d.cts → postgres-DMgIKQU-.d.cts} +1 -1
  282. package/dist/postgres-execution-fKW0qRiN.d.cts +14 -0
  283. package/dist/postgres-execution-fKW0qRiN.d.ts +14 -0
  284. package/dist/profiler/index.cjs +9 -8
  285. package/dist/profiler/index.cjs.map +1 -1
  286. package/dist/profiler/index.d.cts +9 -17
  287. package/dist/profiler/index.d.ts +9 -17
  288. package/dist/profiler/index.js +8 -7
  289. package/dist/profiler/index.js.map +1 -1
  290. package/dist/provenance/index.cjs +61 -55
  291. package/dist/provenance/index.cjs.map +1 -1
  292. package/dist/provenance/index.d.cts +7 -8
  293. package/dist/provenance/index.d.ts +7 -8
  294. package/dist/provenance/index.js +34 -28
  295. package/dist/provenance/index.js.map +1 -1
  296. package/dist/schema/index.cjs +46 -37
  297. package/dist/schema/index.cjs.map +1 -1
  298. package/dist/schema/index.d.cts +8 -10
  299. package/dist/schema/index.d.ts +8 -10
  300. package/dist/schema/index.js +22 -13
  301. package/dist/schema/index.js.map +1 -1
  302. package/dist/{sqlite-BUOHPx7p.d.ts → sqlite-BDkW39aa.d.cts} +1 -1
  303. package/dist/{sqlite-Pp8O19WE.d.cts → sqlite-CYfhvESj.d.ts} +1 -1
  304. package/dist/sqlite-execution-DwbE2a9y.d.cts +32 -0
  305. package/dist/sqlite-execution-DwbE2a9y.d.ts +32 -0
  306. package/dist/{store-view-X96Rd00T.d.cts → store-view-BoHqdHjB.d.cts} +394 -1393
  307. package/dist/{store-view-ANL6mTph.d.ts → store-view-Ctq-3OHy.d.ts} +394 -1393
  308. package/dist/temporal-BC_NQV5Y.d.cts +281 -0
  309. package/dist/temporal-DqtOEo_B.d.ts +281 -0
  310. package/dist/{types-r-Zyq2Hz.d.cts → types-COq3-vMC.d.cts} +2 -2
  311. package/dist/{types-wsvuBgPK.d.ts → types-CUevi_D1.d.ts} +2 -2
  312. package/dist/{where-CJOpJj3a.d.ts → where-BdE_cYtx.d.ts} +5 -5
  313. package/dist/{where-K3uBP33l.d.cts → where-C92TXCzT.d.cts} +5 -5
  314. package/package.json +37 -6
  315. package/dist/chunk-27SSDCEP.cjs.map +0 -1
  316. package/dist/chunk-2N6EOBTH.cjs.map +0 -1
  317. package/dist/chunk-3C2RYI6L.cjs.map +0 -1
  318. package/dist/chunk-3DS7Z4T4.cjs.map +0 -1
  319. package/dist/chunk-3GH67G4Z.cjs.map +0 -1
  320. package/dist/chunk-3RWZPJKV.js.map +0 -1
  321. package/dist/chunk-3SLPDKHQ.js.map +0 -1
  322. package/dist/chunk-3XXGYU62.cjs.map +0 -1
  323. package/dist/chunk-44TA22QT.js +0 -1478
  324. package/dist/chunk-44TA22QT.js.map +0 -1
  325. package/dist/chunk-552KNYQJ.js.map +0 -1
  326. package/dist/chunk-5KEQ74YU.cjs.map +0 -1
  327. package/dist/chunk-5KPNWT6X.js.map +0 -1
  328. package/dist/chunk-5PNMDJ7J.js.map +0 -1
  329. package/dist/chunk-6EEO3OVU.cjs.map +0 -1
  330. package/dist/chunk-7YSP4V4R.cjs +0 -69
  331. package/dist/chunk-7YSP4V4R.cjs.map +0 -1
  332. package/dist/chunk-A42GCBGX.cjs.map +0 -1
  333. package/dist/chunk-BVRDGYXQ.cjs.map +0 -1
  334. package/dist/chunk-BYPOGQWK.js.map +0 -1
  335. package/dist/chunk-CUHM5CWJ.cjs +0 -12
  336. package/dist/chunk-CUHM5CWJ.cjs.map +0 -1
  337. package/dist/chunk-DIQ3AV5W.cjs.map +0 -1
  338. package/dist/chunk-EXU3RASM.js.map +0 -1
  339. package/dist/chunk-IP3CGGPA.cjs.map +0 -1
  340. package/dist/chunk-IPSVVTWT.cjs +0 -1540
  341. package/dist/chunk-IPSVVTWT.cjs.map +0 -1
  342. package/dist/chunk-IXGYRP2P.js.map +0 -1
  343. package/dist/chunk-J4IUSYFF.js.map +0 -1
  344. package/dist/chunk-JBNOGRKW.cjs.map +0 -1
  345. package/dist/chunk-K3Q3LJY3.js.map +0 -1
  346. package/dist/chunk-KQJ54OG5.js.map +0 -1
  347. package/dist/chunk-L7HQ2OSI.js.map +0 -1
  348. package/dist/chunk-M6VES7V6.js +0 -239
  349. package/dist/chunk-M6VES7V6.js.map +0 -1
  350. package/dist/chunk-NBP2WTJW.cjs.map +0 -1
  351. package/dist/chunk-NUIG3BCV.cjs.map +0 -1
  352. package/dist/chunk-NXQFATMF.cjs.map +0 -1
  353. package/dist/chunk-OHMP6N2J.js +0 -47
  354. package/dist/chunk-OHMP6N2J.js.map +0 -1
  355. package/dist/chunk-QERAIDRJ.js.map +0 -1
  356. package/dist/chunk-QSXTWU4U.cjs +0 -12
  357. package/dist/chunk-RCVLFTCT.js.map +0 -1
  358. package/dist/chunk-TGOMW4MB.cjs.map +0 -1
  359. package/dist/chunk-TKT2XHED.js.map +0 -1
  360. package/dist/chunk-UGZUAYAR.js.map +0 -1
  361. package/dist/chunk-UXLSNRYL.js.map +0 -1
  362. package/dist/chunk-UYQMBBWJ.js.map +0 -1
  363. package/dist/chunk-VKGKDOKR.js.map +0 -1
  364. package/dist/chunk-VL2V6PEN.cjs +0 -261
  365. package/dist/chunk-VL2V6PEN.cjs.map +0 -1
  366. package/dist/chunk-WOJMKB3N.cjs.map +0 -1
  367. package/dist/chunk-WWFHO375.cjs.map +0 -1
  368. package/dist/chunk-XGPUQ56G.js.map +0 -1
  369. package/dist/chunk-XGU7DZDA.cjs +0 -1095
  370. package/dist/chunk-XGU7DZDA.cjs.map +0 -1
  371. package/dist/chunk-XPCZADMT.cjs.map +0 -1
  372. package/dist/chunk-XWV4JT34.js.map +0 -1
@@ -1,283 +1,10 @@
1
- import { G as GraphDef, K as KindRegistry, w as EdgeKinds, t as NodeKinds, v as AllNodeTypes, c as SchemaManagerOptions, d as SchemaValidationResult } from './manager-nU1vTJLy.cjs';
2
- import { T as TemporalMode, N as NodeType, A as AnyEdgeType, g as EdgeType, E as EdgeRegistration, d as NodeId, K as KindEntity, b as NodeRegistration, e as EdgeId, s as UniquenessScope, n as Collation, f as KindAnnotations, m as Cardinality, q as EndpointExistence, G as GraphExtension } from './extension-types-BM2ACfYO.cjs';
1
+ import { G as GraphDef, E as EdgeKinds, N as NodeKinds, a as AllNodeTypes } from './define-graph-CzEvA_8F.cjs';
2
+ import { S as SearchableMetadata, R as RecordedInstant, c as EmbeddingValue, l as ReadCoordinate } from './temporal-BC_NQV5Y.cjs';
3
+ import { a as NodeType, A as AnyEdgeType, d as EdgeType, T as TemporalMode, E as EdgeRegistration, m as NodeId, K as KindEntity, g as EdgeId, N as NodeRegistration, l as KindAnnotations, o as UniquenessScope, f as Collation, e as Cardinality, j as EndpointExistence, G as GraphExtension } from './extension-types-BLEVH4SG.cjs';
4
+ import { K as KindRegistry, S as SchemaManagerOptions, d as SchemaValidationResult } from './manager-nCEJiYBb.cjs';
3
5
  import { z } from 'zod';
4
- import { a_ as VectorSlot, be as ValueType, bf as PredicateExpression, ag as FulltextQueryMode, bg as VectorMetricType, Q as QueryAst, J as JsonPointer, P as FieldRef, aA as ParameterRef, ar as JsonPointerInput, G as GraphBackend, aT as TransactionBackend, aU as TraversalExpansion, c as SqlDialect, aP as SqlSchema, bh as Traversal, bi as NodePredicate, bj as ProjectedField, az as OrderSpec, bk as AggregateOrderSpec, bl as GroupBySpec, an as HybridFusionOptions, bm as RecursiveCyclePolicy, W as TraversalDirection$1, bn as NodeRow, aa as ExternalRecordedReadSource, bo as EdgeRow, X as AdoptedTransaction, L as AggregateExpr, aN as SortDirection, a3 as CompiledSelectSql, F as FulltextStrategy, V as VectorStrategy, bp as VectorSlotMap, bq as RecordedReadBinding, br as SelectiveField, bs as ComposableQuery, bt as SetOperationType, bu as SetOperation, bv as VectorMetric, z as JsonSchema, bw as TransactionOptions } from './fulltext-strategy-C27vXaeB.cjs';
5
- import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult, c as MaterializeSystemIndexesOptions } from './materialize-indexes-CuR3gAZb.cjs';
6
-
7
- /**
8
- * Embedding type for vector search.
9
- *
10
- * Creates a Zod-compatible schema for vector embeddings with
11
- * dimension validation and metadata for query compilation.
12
- */
13
-
14
- /**
15
- * Symbol used to brand embedding values at the type level.
16
- * This allows TypeScript to distinguish embedding arrays from regular
17
- * number arrays in the query builder type system.
18
- */
19
- declare const EMBEDDING_BRAND: unique symbol;
20
- /**
21
- * Branded embedding type for type-level distinction.
22
- * At runtime this is just `readonly number[]`, but TypeScript can
23
- * distinguish it from regular arrays for query builder typing.
24
- */
25
- type EmbeddingValue = readonly number[] & {
26
- readonly [EMBEDDING_BRAND]: true;
27
- };
28
- /**
29
- * Symbol key for storing embedding dimensions on the schema.
30
- * This allows the schema introspector to detect embedding types
31
- * and extract dimension information.
32
- */
33
- declare const EMBEDDING_DIMENSIONS_KEY: "_embeddingDimensions";
34
- /**
35
- * Symbol key for storing the embedding's preferred index configuration
36
- * on the schema. The schema introspector reads this when auto-deriving
37
- * `VectorIndexDeclaration` entries at `defineGraph()` time.
38
- */
39
- declare const EMBEDDING_INDEX_KEY: "_embeddingIndex";
40
- /**
41
- * Distance metric used for vector similarity. Pinned at the embedding
42
- * brand because changing the metric usually means generating different
43
- * model output (e.g. cosine-normalized vs. raw inner-product), and the
44
- * stored index needs the same metric to score correctly.
45
- *
46
- * - `cosine`: cosine similarity. The default — works for most
47
- * sentence-transformer / OpenAI-style embeddings that are already
48
- * length-normalized.
49
- * - `l2`: Euclidean distance. Use when your model outputs vectors
50
- * trained for L2 (e.g. some image embedding models).
51
- * - `inner_product`: dot-product distance. Use when your model outputs
52
- * pre-normalized vectors AND you want to skip the cosine
53
- * normalization step at query time.
54
- */
55
- type EmbeddingMetric = "cosine" | "l2" | "inner_product";
56
- /**
57
- * Vector index implementation. `hnsw` is the default and what pgvector
58
- * recommends for most workloads. `ivfflat` is the alternative for
59
- * larger datasets where memory is the bottleneck. `none` disables
60
- * automatic index creation for this embedding (the operator can still
61
- * call `backend.createVectorIndex` manually).
62
- */
63
- type EmbeddingIndexType = "hnsw" | "ivfflat" | "none";
64
- /**
65
- * Per-embedding configuration for the auto-derived
66
- * `VectorIndexDeclaration`. All fields are optional with sensible
67
- * defaults (`cosine` / `hnsw` / pgvector defaults: `m=16`,
68
- * `ef_construction=64`). Override only when your model or dataset has
69
- * a known reason to.
70
- */
71
- type EmbeddingIndexOptions = Readonly<{
72
- /** Distance metric. Default `"cosine"`. */
73
- metric?: EmbeddingMetric;
74
- /** Vector index implementation. Default `"hnsw"`. */
75
- indexType?: EmbeddingIndexType;
76
- /** HNSW `m` parameter — max connections per layer. Default `16`. */
77
- m?: number;
78
- /** HNSW `ef_construction` parameter — build-time search depth. Default `64`. */
79
- efConstruction?: number;
80
- /** IVFFlat `lists` parameter — number of inverted-list partitions. */
81
- lists?: number;
82
- }>;
83
- /**
84
- * Resolved embedding index configuration with all defaults applied.
85
- * What gets attached to the brand and read by the auto-derivation pass.
86
- */
87
- type ResolvedEmbeddingIndex = Readonly<{
88
- metric: EmbeddingMetric;
89
- indexType: EmbeddingIndexType;
90
- m: number;
91
- efConstruction: number;
92
- lists: number | undefined;
93
- }>;
94
- /**
95
- * A Zod schema for vector embeddings with attached dimension metadata.
96
- * Uses the branded EmbeddingValue type for type-level distinction.
97
- */
98
- type EmbeddingSchema<D extends number = number> = z.ZodType<EmbeddingValue> & Readonly<{
99
- [EMBEDDING_DIMENSIONS_KEY]: D;
100
- [EMBEDDING_INDEX_KEY]: ResolvedEmbeddingIndex;
101
- }>;
102
- /**
103
- * Creates a Zod schema for vector embeddings.
104
- *
105
- * The dimension is validated at runtime and attached as metadata
106
- * for the schema introspector and query compiler.
107
- *
108
- * @param dimensions - The number of dimensions (e.g., 384, 512, 768, 1536, 3072)
109
- * @returns A Zod schema that validates embedding arrays
110
- *
111
- * @example
112
- * ```typescript
113
- * // OpenAI ada-002 embeddings
114
- * const Document = defineNode("Document", {
115
- * schema: z.object({
116
- * title: z.string(),
117
- * embedding: embedding(1536),
118
- * }),
119
- * });
120
- *
121
- * // Sentence transformers
122
- * const Sentence = defineNode("Sentence", {
123
- * schema: z.object({
124
- * text: z.string(),
125
- * embedding: embedding(384), // all-MiniLM-L6-v2
126
- * }),
127
- * });
128
- *
129
- * // Optional embeddings are supported
130
- * const Article = defineNode("Article", {
131
- * schema: z.object({
132
- * content: z.string(),
133
- * embedding: embedding(1536).optional(),
134
- * }),
135
- * });
136
- * ```
137
- */
138
- declare function embedding<D extends number>(dimensions: D, options?: EmbeddingIndexOptions): EmbeddingSchema<D>;
139
- /**
140
- * Checks if a value is an embedding schema.
141
- */
142
- declare function isEmbeddingSchema(value: unknown): value is EmbeddingSchema;
143
- /**
144
- * Gets the dimensions from an embedding schema.
145
- * Returns undefined if the schema is not an embedding schema.
146
- */
147
- declare function getEmbeddingDimensions(schema: z.ZodType): number | undefined;
148
- /**
149
- * Enumerates every embedding `(kind, field)` slot a graph declares, as a
150
- * fully-resolved {@link VectorSlot}. The single source of truth for "what
151
- * vector slots does this graph have?", shared by the privileged boot
152
- * materializer (`materializeVectorContributions`) and the verified-attach
153
- * gate (`assertVectorContributionsInitialized`) so the two can never
154
- * provision and assert different sets. Walks `graph.nodes` and reuses
155
- * {@link resolveEmbeddingFields} per node schema.
156
- */
157
- declare function resolveGraphVectorSlots(graph: GraphDef): readonly VectorSlot[];
158
-
159
- /**
160
- * Searchable string type for fulltext search.
161
- *
162
- * `searchable()` attaches `SearchableMetadata` to a plain Zod string so
163
- * the schema introspector and fulltext-sync layer can keep the fulltext
164
- * index in sync with node data.
165
- *
166
- * The metadata is preserved by Zod's `.meta()` across refinements
167
- * (`.min(1)`, `.trim()`, `.regex(...)`) and wrapper types (`.optional()`,
168
- * `.nullable()`, `.default(...)`, pipes) — `getSearchableMetadata()` walks
169
- * these variants so runtime indexing works whether or not a user chains
170
- * additional modifiers.
171
- *
172
- * `$fulltext` is exposed on every `NodeAccessor` at the type level; a
173
- * runtime guard throws a clear error if you call `.matches()` on an
174
- * alias whose node kind has no `searchable()` fields. This is simpler
175
- * and more predictable than a type-level brand that silently disappears
176
- * behind `.min(1)`.
177
- *
178
- * @example
179
- * ```typescript
180
- * const Document = defineNode("Document", {
181
- * schema: z.object({
182
- * title: searchable({ language: "english" }),
183
- * body: searchable().min(1),
184
- * authorId: z.string(),
185
- * }),
186
- * });
187
- * ```
188
- */
189
-
190
- declare const SEARCHABLE_FIELD_KEY: "_searchableField";
191
- declare const DEFAULT_SEARCHABLE_LANGUAGE: "english";
192
- /**
193
- * Searchable field metadata attached to a Zod schema.
194
- */
195
- type SearchableMetadata = Readonly<{
196
- /**
197
- * Language for stemming / tokenization.
198
- * Postgres: passed to `to_tsvector(regconfig, ...)`.
199
- * SQLite FTS5: tokenizer is fixed at table-create time, so the
200
- * language is recorded but not applied per-row.
201
- */
202
- language: string;
203
- }>;
204
- /**
205
- * Branded Zod string schema. The `SEARCHABLE_FIELD_KEY` marker is
206
- * attached both as a direct property (fast runtime check) and via Zod's
207
- * `.meta()` (so it survives `.min()`, `.trim()`, etc.).
208
- */
209
- type SearchableSchema = z.ZodString & Readonly<{
210
- [SEARCHABLE_FIELD_KEY]: SearchableMetadata;
211
- }>;
212
- type SearchableOptions = Readonly<{
213
- language?: string;
214
- }>;
215
- /**
216
- * Creates a Zod string schema tagged as fulltext-searchable.
217
- *
218
- * The returned schema passes runtime validation unchanged — the tag only
219
- * affects how TypeGraph treats the field for indexing and search. Pair
220
- * with `.optional()` / `.nullable()` / `.min()` / `.trim()` exactly like
221
- * any other Zod string; `getSearchableMetadata()` finds the metadata
222
- * through all of them.
223
- */
224
- declare function searchable(options?: SearchableOptions): SearchableSchema;
225
- declare function isSearchableSchema(value: unknown): value is SearchableSchema;
226
- declare function getSearchableMetadata(schema: z.ZodType): SearchableMetadata | undefined;
227
-
228
- declare const RECORDED_INSTANT_BRAND: unique symbol;
229
- /**
230
- * A canonical UTC ISO-8601 recorded-time instant (`YYYY-MM-DDTHH:mm:ss.sssZ`),
231
- * nominally branded so it can only originate from a recorded-time source —
232
- * {@link Store.recordedNow} or an explicit {@link asRecordedInstant} — never an
233
- * ad-hoc wall-clock string.
234
- *
235
- * The recorded commit clock is a logical, monotonic per-graph instant that can
236
- * run briefly ahead of wall time under bursty same-millisecond writes, so a raw
237
- * `new Date().toISOString()` may sort *before* the most recent commits and
238
- * silently omit them. The brand turns that footgun into a compile error:
239
- * `store.asOfRecorded` accepts only a `RecordedInstant`, so a bare wall-clock
240
- * string no longer type-checks — callers reach for `await store.recordedNow()`
241
- * (the monotonic high-water mark) or {@link asRecordedInstant} instead.
242
- */
243
- type RecordedInstant = string & {
244
- readonly [RECORDED_INSTANT_BRAND]: "RecordedInstant";
245
- };
246
- /**
247
- * Brands a canonical UTC ISO-8601 string as a {@link RecordedInstant}.
248
- *
249
- * The escape hatch for an instant that round-trips through untyped storage:
250
- * captured from {@link Store.recordedNow}, persisted as a plain string, read
251
- * back, and replayed into `asOfRecorded`. Validates the canonical form eagerly —
252
- * the same check `asOfRecorded` applies — so a malformed value fails here, at the
253
- * brand site, rather than deeper in a read. Does *not* assert the instant is a
254
- * real captured commit; it only guarantees the value is well-formed enough to
255
- * compare correctly against the recorded relations.
256
- *
257
- * @throws {ValidationError} when `value` is not a canonical UTC ISO-8601 string.
258
- */
259
- declare function asRecordedInstant(value: string): RecordedInstant;
260
- /**
261
- * The single opaque temporal coordinate every pinned read is resolved
262
- * against. It carries the valid-time axis plus an optional recorded/system-time
263
- * axis, so every surface can inject one coordinate object instead of threading
264
- * each temporal dimension separately.
265
- */
266
- type ReadCoordinate = Readonly<{
267
- /**
268
- * The valid-time axis: a resolved temporal mode and (only for `"asOf"`) the
269
- * instant it is pinned to.
270
- */
271
- valid: Readonly<{
272
- mode: TemporalMode;
273
- /** Defined only when `mode` is `"asOf"`. */
274
- asOf?: string;
275
- }>;
276
- /** The recorded/system-time axis. Defined only for recorded-pinned views. */
277
- recorded?: Readonly<{
278
- asOf: RecordedInstant;
279
- }>;
280
- }>;
6
+ import { bp as ValueType, bq as PredicateExpression, ad as FulltextQueryMode, br as VectorMetricType, Q as QueryAst, J as JsonPointer, K as FieldRef, ay as ParameterRef, b1 as TraversalExpansion, G as GraphBackend, S as SqlDialect, aU as SqlSchema, bs as Traversal, bt as NodePredicate, bu as ProjectedField, ax as OrderSpec, bv as AggregateOrderSpec, bw as GroupBySpec, ak as HybridFusionOptions, ao as JsonPointerInput, bx as RecursiveCyclePolicy, T as TraversalDirection$1, a_ as TransactionBackend, a7 as ExternalRecordedReadSource, by as NodeRow, bz as EdgeRow, b0 as TransactionReadBackend, H as AggregateExpr, aN as SortDirection, a0 as CompiledSelectSql, F as FulltextStrategy, V as VectorStrategy, bA as VectorSlotMap, bB as RecordedReadBinding, bC as SelectiveField, bD as ComposableQuery, bE as SetOperationType, bF as SetOperation, bG as VectorMetric, x as JsonSchema, B as BackendCapabilities, a$ as TransactionOptions, A as AdapterBackend } from './index-CrFL_ENI.cjs';
7
+ import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult, c as MaterializeSystemIndexesOptions } from './materialize-indexes-ExQ6OrAh.cjs';
281
8
 
282
9
  type FieldTypeInfo = Readonly<{
283
10
  valueType: ValueType;
@@ -1365,6 +1092,14 @@ type LiveStoreOptions = BaseStoreOptions & Readonly<{
1365
1092
  history?: false | undefined;
1366
1093
  recordedRead?: ExternalRecordedReadSource | undefined;
1367
1094
  }>;
1095
+ /** Live-store options that do not bind a recorded-read relation. */
1096
+ type UnboundLiveStoreOptions = LiveStoreOptions & Readonly<{
1097
+ recordedRead?: undefined;
1098
+ }>;
1099
+ /** Live-store options with an explicitly bound recorded-read relation. */
1100
+ type RecordedReadStoreOptions = LiveStoreOptions & Readonly<{
1101
+ recordedRead: NonNullable<LiveStoreOptions["recordedRead"]>;
1102
+ }>;
1368
1103
  /**
1369
1104
  * Store options with TypeGraph-managed recorded-time capture. `history: true`
1370
1105
  * captures TypeGraph writes and binds TypeGraph's built-in recorded relation
@@ -1403,9 +1138,11 @@ type StoreOptions = LiveStoreOptions | HistoryStoreOptions;
1403
1138
  *
1404
1139
  * Generic over the held value (typically `Store<G>`) so the store
1405
1140
  * module can refer to it without importing the `Store` class into
1406
- * `types.ts`.
1141
+ * `types.ts`. The type parameter is deliberately invariant: evolution writes
1142
+ * a replacement into `current`, so a ref for an adapter-only or history-only
1143
+ * Store must never be accepted by a Store that cannot preserve that surface.
1407
1144
  */
1408
- interface StoreRef<T> {
1145
+ interface StoreRef<in out T> {
1409
1146
  current: T;
1410
1147
  }
1411
1148
  /**
@@ -2099,90 +1836,36 @@ type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
2099
1836
  /**
2100
1837
  * Whether — and why — `tx.sql` can be used on a transaction context. A single
2101
1838
  * required discriminant covering exactly the four states raw-SQL access can be
2102
- * in, so a portable caller branches on capability instead of truthiness-testing
2103
- * `tx.sql` (which is present-but-throwing under history / revision tracking).
2104
- * See {@link TransactionContext.sqlAvailability} for the per-value semantics.
1839
+ * in, so an adapter caller branches on capability instead of truthiness-testing
1840
+ * `tx.sql`. Under history / revision tracking the public type makes `tx.sql`
1841
+ * unusable (`sql?: never`), while the runtime object keeps a fail-loud getter
1842
+ * for JavaScript and type-suppressed callers. See
1843
+ * {@link AdapterTransactionContext} for the per-value semantics.
2105
1844
  */
2106
1845
  type SqlAvailability = "available" | "history" | "revisionTracking" | "unavailable";
1846
+ type AdapterTransactionSqlAccess<TNativeTransaction> = Readonly<{
1847
+ sql: TNativeTransaction;
1848
+ sqlAvailability: "available";
1849
+ }> | Readonly<{
1850
+ sql?: never;
1851
+ sqlAvailability: "history" | "revisionTracking";
1852
+ }> | Readonly<{
1853
+ sql?: undefined;
1854
+ sqlAvailability: "unavailable";
1855
+ }>;
1856
+ declare const TRANSACTION_RUNTIME: unique symbol;
1857
+ type TransactionRuntime = Readonly<{
1858
+ backend: TransactionBackend;
1859
+ runNodeOperationHooks: <T>(operation: "create" | "update" | "delete", kind: string, id: string, fn: () => Promise<T>) => Promise<T>;
1860
+ }>;
2107
1861
  /**
2108
- * A typed transaction context with collection API.
2109
- *
2110
- * Provides the same `tx.nodes.*` and `tx.edges.*` API as the Store,
2111
- * but operations are executed within the transaction scope.
2112
- *
2113
- * `tx.sql` is the raw Drizzle handle **bound to this same
2114
- * transaction** — use it to write the caller's own relational tables
2115
- * inside the graph-owned transaction so both layers commit or roll
2116
- * back together (the graph-owned counterpart of
2117
- * {@link Store.withTransaction}, where the caller owns the boundary):
2118
- *
2119
- * ```typescript
2120
- * await store.transaction(async (tx) => {
2121
- * await tx.nodes.Document.update(documentId, props);
2122
- * // `tx.sql` is the `AdoptedTransaction` union — cast to your
2123
- * // concrete Drizzle database type at the call site.
2124
- * const sqlTx = tx.sql as NodePgDatabase;
2125
- * await sqlTx.insert(documentVersions).values(versionRow);
2126
- * await sqlTx.insert(changeEvents).values(eventRow);
2127
- * });
2128
- * ```
2129
- *
2130
- * Per-backend semantics:
2131
- * - **Postgres / libsql** (async drivers): `tx.sql` is the Drizzle
2132
- * transaction handle. Using the outer `db` instead would write on a
2133
- * *different* connection and silently escape the transaction — so
2134
- * `tx.sql` is a correctness requirement there.
2135
- * - **better-sqlite3**: the single connection, framed by TypeGraph's
2136
- * `BEGIN`/`COMMIT`/`ROLLBACK`.
2137
- * - **Durable Objects (`do-sqlite`)**: the bound Drizzle handle; the
2138
- * storage transaction is ambient, so writing the outer `db` also
2139
- * enlists — `tx.sql` is the explicit, portable form.
2140
- *
2141
- * It is `undefined` only on the non-transactional fallback
2142
- * (`backend.capabilities.transactions === false` — e.g. Cloudflare
2143
- * D1, `drizzle-orm/neon-http`), where `store.transaction()` runs the
2144
- * callback with no atomicity and there is no transaction to enlist.
2145
- * Its type is the `AdoptedTransaction` union; cast to your concrete
2146
- * Drizzle database type at the call site.
2147
- *
2148
- * When the store was created with `{ history: true }` or
2149
- * `{ revisionTracking: true }`, `tx.sql` is **present but throwing**: every
2150
- * access raises {@link ConfigurationError} because raw SQL would bypass
2151
- * recorded-time capture or the revision anchor. The static type marks it
2152
- * `sql?: never` so a mistaken `tx.sql.run(...)` fails to typecheck; at runtime
2153
- * it is a fail-loud guard, not `undefined`. Use the typed `tx.nodes` /
2154
- * `tx.edges` collections inside `transaction()`, or
2155
- * `store.withRecordedTransaction(externalTx, fn)` when the relational layer
2156
- * owns the transaction boundary.
2157
- *
2158
- * **Feature detection — branch on {@link sqlAvailability}, not on `tx.sql`'s
2159
- * truthiness.** Because `tx.sql` is present-but-throwing under history or
2160
- * revision tracking, `if (tx.sql)` reads truthy and then throws. The honest
2161
- * discriminant is `tx.sqlAvailability`:
2162
- *
2163
- * ```typescript
2164
- * await store.transaction(async (tx) => {
2165
- * switch (tx.sqlAvailability) {
2166
- * case "available": {
2167
- * const sqlTx = tx.sql as NodePgDatabase; // usable raw handle
2168
- * await sqlTx.insert(rows).values(row);
2169
- * break;
2170
- * }
2171
- * case "unavailable":
2172
- * // non-transactional backend: tx.sql === undefined, no atomicity
2173
- * await fallbackWithoutAtomicity();
2174
- * break;
2175
- * case "history":
2176
- * case "revisionTracking":
2177
- * // raw SQL disabled here — write your own tables through the external
2178
- * // handle passed to store.withRecordedTransaction instead
2179
- * break;
2180
- * }
2181
- * });
2182
- * ```
2183
- *
2184
- * `tx.sql === undefined` still means exactly "non-transactional fallback"
2185
- * (`sqlAvailability === "unavailable"`).
1862
+ * The portable transaction context mirrors the Store's typed graph operations
1863
+ * while exposing only a read-only backend projection bound to the transaction.
1864
+ * Adapter-native handles are available only through
1865
+ * {@link AdapterTransactionContext}; arbitrary backend writes are absent from
1866
+ * every public transaction context. TypeGraph's non-enumerable symbol port is
1867
+ * an unsupported implementation detail, not a JavaScript security boundary:
1868
+ * reflective code can still discover symbol properties.
2186
1869
  *
2187
1870
  * @example
2188
1871
  * ```typescript
@@ -2193,53 +1876,33 @@ type SqlAvailability = "available" | "history" | "revisionTracking" | "unavailab
2193
1876
  * });
2194
1877
  * ```
2195
1878
  */
2196
- type TransactionContext<G extends GraphDef> = Readonly<{
1879
+ type TransactionCollections<G extends GraphDef> = Readonly<{
1880
+ [TRANSACTION_RUNTIME]: TransactionRuntime;
2197
1881
  nodes: GraphNodeCollections<G>;
2198
1882
  edges: GraphEdgeCollections<G>;
2199
- sql?: AdoptedTransaction;
2200
- /**
2201
- * Honest capability discriminant for `tx.sql` on this transaction. Prefer
2202
- * this over truthiness-testing `tx.sql`, which is present-but-throwing under
2203
- * history capture or revision tracking.
2204
- *
2205
- * - `"available"` — `tx.sql` is the usable raw handle bound to this
2206
- * transaction.
2207
- * - `"history"` — history capture is on; `tx.sql` is present but every access
2208
- * throws {@link ConfigurationError} (`details.code`
2209
- * `RECORDED_CAPTURE_RAW_SQL_DISABLED`). Use `tx.nodes` / `tx.edges`, or
2210
- * `store.withRecordedTransaction` with your own external handle for
2211
- * cross-store atomicity.
2212
- * - `"revisionTracking"` — same shape as `"history"` (`details.code`
2213
- * `REVISION_TRACKING_RAW_SQL_DISABLED`).
2214
- * - `"unavailable"` — non-transactional fallback
2215
- * (`backend.capabilities.transactions === false`, e.g. Cloudflare D1,
2216
- * `drizzle-orm/neon-http`); `tx.sql` is `undefined` and there is no
2217
- * atomicity.
2218
- */
2219
- sqlAvailability: SqlAvailability;
2220
- /**
2221
- * The transaction-scoped backend the collections are bound to, for advanced
2222
- * raw reads that must observe the transaction's snapshot (e.g. graph-merge's
2223
- * in-transaction base@V re-validation). On the non-transactional fallback it
2224
- * is the store's plain backend — reads work, but there is no snapshot.
2225
- */
2226
- backend: TransactionBackend;
1883
+ /** Read-only backend projection bound to the same graph transaction. */
1884
+ backend: TransactionReadBackend;
2227
1885
  /**
2228
1886
  * Runtime string-keyed node collection access, mirroring
2229
- * `Store.getNodeCollection` — for callers (e.g. provenance) that resolve a
2230
- * kind dynamically rather than through the static `nodes.<Kind>` property.
2231
- * Returns `undefined` when `kind` is not registered in this graph.
2232
- */
2233
- getNodeCollection(kind: string): DynamicNodeCollection | undefined;
2234
- /**
2235
- * @internal Runs a graph-owned node mutation through this transaction's
2236
- * operation-hook lifecycle when the mutation cannot use a public collection
2237
- * verb directly (provenance fact close/reopen). Routed through the
2238
- * transaction's hook runner, so a successful operation's `onOperationEnd`
2239
- * is deferred until the transaction commits.
1887
+ * `Store.getNodeCollection`. Returns `undefined` when `kind` is not
1888
+ * registered in this graph.
2240
1889
  */
2241
- runNodeOperationHooks<T>(operation: "create" | "update" | "delete", kind: string, id: string, fn: () => Promise<T>): Promise<T>;
1890
+ getNodeCollection: (kind: string) => DynamicNodeCollection | undefined;
2242
1891
  }>;
1892
+ /**
1893
+ * A portable transaction context containing only TypeGraph-owned graph
1894
+ * operations. Managed Stores use this surface so adapter-native handles never
1895
+ * enter their public contract.
1896
+ */
1897
+ type TransactionContext<G extends GraphDef> = TransactionCollections<G>;
1898
+ /**
1899
+ * A transaction context exposed by an {@link AdapterStore}. In addition to the
1900
+ * portable graph collections, it carries the adapter-native handle when that
1901
+ * capability is available. The TypeGraph backend remains the same runtime
1902
+ * read projection as the portable context; adapter-native writes intentionally
1903
+ * go through `sql`, making that escape hatch explicit.
1904
+ */
1905
+ type AdapterTransactionContext<G extends GraphDef, TNativeTransaction> = TransactionCollections<G> & AdapterTransactionSqlAccess<TNativeTransaction>;
2243
1906
  /**
2244
1907
  * Scoped write measurement, available only on the receipt-enabled transaction
2245
1908
  * contexts (`transactionWithReceipt`, `withRecordedTransaction`). Runs `fn`,
@@ -2274,6 +1937,10 @@ type ScopedMeasure<Context> = <T>(fn: (scoped: Context) => Promise<T>) => Promis
2274
1937
  type MeasurableTransactionContext<G extends GraphDef> = TransactionContext<G> & Readonly<{
2275
1938
  measure: ScopedMeasure<MeasurableTransactionContext<G>>;
2276
1939
  }>;
1940
+ /** Receipt-enabled transaction context for an {@link AdapterStore}. */
1941
+ type MeasurableAdapterTransactionContext<G extends GraphDef, TNativeTransaction> = AdapterTransactionContext<G, TNativeTransaction> & Readonly<{
1942
+ measure: ScopedMeasure<MeasurableAdapterTransactionContext<G, TNativeTransaction>>;
1943
+ }>;
2277
1944
  /**
2278
1945
  * Replace branded `NodeId` / `EdgeId` with plain `string` in each
2279
1946
  * method's parameter list. Return types are preserved unchanged.
@@ -2424,7 +2091,7 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
2424
2091
  params: readonly unknown[];
2425
2092
  }>;
2426
2093
  /**
2427
- * Compiles the query to a Drizzle SQL object.
2094
+ * Compiles the query to TypeGraph's database-independent SQL fragment.
2428
2095
  */
2429
2096
  compile(): CompiledSelectSql;
2430
2097
  /**
@@ -2736,10 +2403,10 @@ declare class ExecutableQuery<G extends GraphDef, Aliases extends AliasMap, Edge
2736
2403
  params: readonly unknown[];
2737
2404
  }>;
2738
2405
  /**
2739
- * Compiles the query to a Drizzle SQL object.
2406
+ * Compiles the query to TypeGraph's database-independent SQL fragment.
2740
2407
  *
2741
- * Returns a Drizzle SQL object that can be executed directly
2742
- * with db.all(), db.get(), etc.
2408
+ * Pass the result to a GraphBackend, or use toSQL() to render SQL text and
2409
+ * parameters for the configured dialect.
2743
2410
  */
2744
2411
  compile(): CompiledSelectSql;
2745
2412
  /**
@@ -3362,6 +3029,77 @@ type WeaklyConnectedComponentMembership = Readonly<{
3362
3029
  /** Number of visible nodes in this component. */
3363
3030
  size: number;
3364
3031
  }>;
3032
+ /**
3033
+ * Options for deterministic Community Detection using Label Propagation
3034
+ * (CDLP).
3035
+ *
3036
+ * Selected edges are treated as undirected. Every synchronous round assigns
3037
+ * each node the most frequent label among its visible neighbors from the
3038
+ * previous round; ties resolve to the minimum `(id, kind)` label under binary
3039
+ * ordering. Isolated nodes retain their own identity as a singleton label.
3040
+ */
3041
+ type LabelPropagationOptions<G extends GraphDef> = TemporalAlgorithmOptions & IterativeMemoryOptions & Readonly<{
3042
+ /** Edge kinds whose undirected projection supplies neighbor votes. */
3043
+ edges: readonly EdgeKinds<G>[];
3044
+ /** Optional node kinds defining the induced subgraph to analyze. */
3045
+ nodeKinds?: readonly NodeKinds<G>[];
3046
+ /** Maximum synchronous rounds. Defaults to `1000`. */
3047
+ maxIterations?: number;
3048
+ /**
3049
+ * Completion contract when `maxIterations` rounds elapse without
3050
+ * convergence. `"throw"` (default) raises
3051
+ * `GraphAlgorithmConvergenceError` — immediately once a periodic
3052
+ * oscillation is detected, since no budget can converge it. `"return"`
3053
+ * yields the exact labeling after `maxIterations` synchronous rounds,
3054
+ * matching fixed-round Graphalytics CDLP; synchronous rounds are
3055
+ * deterministic, so that labeling is identical on every backend.
3056
+ */
3057
+ onMaxIterations?: "throw" | "return";
3058
+ }>;
3059
+ type InternalLabelPropagationOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<LabelPropagationOptions<G>, keyof TemporalAlgorithmOptions>;
3060
+ /** One visible node's membership in a deterministic CDLP community. */
3061
+ type LabelPropagationMembership = Readonly<{
3062
+ id: string;
3063
+ kind: string;
3064
+ /** Final propagated label id. */
3065
+ labelId: string;
3066
+ /** Kind paired with `labelId`; node identity is `(kind, id)`. */
3067
+ labelKind: string;
3068
+ }>;
3069
+ /** Options shared by global and personalized PageRank. */
3070
+ type PageRankOptions<G extends GraphDef> = TemporalAlgorithmOptions & IterativeMemoryOptions & Readonly<{
3071
+ /** Edge kinds defining the transition graph. */
3072
+ edges: readonly EdgeKinds<G>[];
3073
+ /** Optional node kinds defining the induced subgraph to rank. */
3074
+ nodeKinds?: readonly NodeKinds<G>[];
3075
+ /** Transition direction. Defaults to `"out"`. */
3076
+ direction?: TraversalDirection;
3077
+ /** Probability of following an edge. Defaults to `0.85`. */
3078
+ dampingFactor?: number;
3079
+ /** Maximum accepted per-node score change. Defaults to `1e-8`. */
3080
+ tolerance?: number;
3081
+ /** Maximum power-iteration rounds before throwing. Defaults to `1000`. */
3082
+ maxIterations?: number;
3083
+ }>;
3084
+ type InternalPageRankOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<PageRankOptions<G>, keyof TemporalAlgorithmOptions>;
3085
+ /** One weighted teleport target for personalized PageRank. */
3086
+ type PersonalizedPageRankSeed<G extends GraphDef> = Readonly<{
3087
+ id: string;
3088
+ kind: NodeKinds<G>;
3089
+ /** Relative teleport weight. Defaults to `1`; must be finite and positive. */
3090
+ weight?: number;
3091
+ }>;
3092
+ /** Personalized PageRank options with one or more weighted teleport seeds. */
3093
+ type PersonalizedPageRankOptions<G extends GraphDef> = PageRankOptions<G> & Readonly<{
3094
+ seeds: readonly PersonalizedPageRankSeed<G>[];
3095
+ }>;
3096
+ type InternalPersonalizedPageRankOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<PersonalizedPageRankOptions<G>, keyof TemporalAlgorithmOptions>;
3097
+ /** One visible node's normalized PageRank score. */
3098
+ type PageRankScore = Readonly<{
3099
+ id: string;
3100
+ kind: string;
3101
+ score: number;
3102
+ }>;
3365
3103
 
3366
3104
  /**
3367
3105
  * Raw node id or any object with an `id: string` field. Covers `Node`,
@@ -3439,6 +3177,11 @@ type GraphAlgorithms<G extends GraphDef> = Readonly<{
3439
3177
  * With `direction: "both"` (default), self-loops contribute once.
3440
3178
  */
3441
3179
  degree: (node: NodeIdentifier, options?: DegreeOptions<G>) => Promise<number>;
3180
+ /**
3181
+ * Runs deterministic synchronous label propagation over an undirected
3182
+ * projection of the selected edge kinds.
3183
+ */
3184
+ labelPropagation: (options: LabelPropagationOptions<G>) => Promise<readonly LabelPropagationMembership[]>;
3442
3185
  /**
3443
3186
  * Computes exact weakly connected components over the selected edge kinds.
3444
3187
  *
@@ -3446,6 +3189,15 @@ type GraphAlgorithms<G extends GraphDef> = Readonly<{
3446
3189
  * `backend.capabilities.graphAnalytics.supported`.
3447
3190
  */
3448
3191
  weaklyConnectedComponents: (options: WeaklyConnectedComponentsOptions<G>) => Promise<readonly WeaklyConnectedComponentMembership[]>;
3192
+ /**
3193
+ * Computes global PageRank over the visible induced graph. Scores sum to
3194
+ * approximately one and are returned from highest to lowest.
3195
+ */
3196
+ pageRank: (options: PageRankOptions<G>) => Promise<readonly PageRankScore[]>;
3197
+ /**
3198
+ * Computes PageRank with teleport mass distributed across weighted seeds.
3199
+ */
3200
+ personalizedPageRank: (options: PersonalizedPageRankOptions<G>) => Promise<readonly PageRankScore[]>;
3449
3201
  }>;
3450
3202
  type InternalGraphAlgorithms<G extends GraphDef> = Readonly<{
3451
3203
  shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: InternalShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
@@ -3454,7 +3206,10 @@ type InternalGraphAlgorithms<G extends GraphDef> = Readonly<{
3454
3206
  canReach: (from: NodeIdentifier, to: NodeIdentifier, options: InternalBaseTraversalOptions<G>) => Promise<boolean>;
3455
3207
  neighbors: (node: NodeIdentifier, options: InternalNeighborsOptions<G>) => Promise<readonly ReachableNode[]>;
3456
3208
  degree: (node: NodeIdentifier, options?: InternalDegreeOptions<G>) => Promise<number>;
3209
+ labelPropagation: (options: InternalLabelPropagationOptions<G>) => Promise<readonly LabelPropagationMembership[]>;
3457
3210
  weaklyConnectedComponents: (options: InternalWeaklyConnectedComponentsOptions<G>) => Promise<readonly WeaklyConnectedComponentMembership[]>;
3211
+ pageRank: (options: InternalPageRankOptions<G>) => Promise<readonly PageRankScore[]>;
3212
+ personalizedPageRank: (options: InternalPersonalizedPageRankOptions<G>) => Promise<readonly PageRankScore[]>;
3458
3213
  }>;
3459
3214
 
3460
3215
  type RebuildFulltextOptions = Readonly<{
@@ -3492,6 +3247,16 @@ type RebuildFulltextResult = Readonly<{
3492
3247
  skippedTruncated: boolean;
3493
3248
  }>;
3494
3249
 
3250
+ /**
3251
+ * Store-level search helpers.
3252
+ *
3253
+ * `fulltextSearch` is a thin typed wrapper over `backend.fulltextSearch`.
3254
+ * `hybridSearch` runs a vector and a fulltext query in parallel and
3255
+ * fuses the two ranked lists with Reciprocal Rank Fusion. RRF is
3256
+ * rank-based, so it papers over score-scale differences between
3257
+ * pgvector/sqlite-vec (distance-derived) and tsvector/FTS5 (BM25-style).
3258
+ */
3259
+
3495
3260
  /**
3496
3261
  * A fulltext search hit. `N` defaults to the generic `Node`; the
3497
3262
  * `store.search.fulltext<K>(kind)` facade narrows it to the concrete
@@ -3771,6 +3536,20 @@ declare class StoreSearch<G extends GraphDef> {
3771
3536
  rebuildFulltext<K extends string>(nodeKind?: K, options?: RebuildFulltextOptions): Promise<RebuildFulltextResult>;
3772
3537
  }
3773
3538
 
3539
+ /**
3540
+ * Members that are safe to expose through a history-enabled adapter Store.
3541
+ *
3542
+ * Graph entity writes remain because the source is the capture-wrapped
3543
+ * backend. Direct raw SQL, native import, graph clearing, and nested backend
3544
+ * transactions stay internal because each can mutate live rows without a
3545
+ * corresponding capture flush.
3546
+ */
3547
+ declare const HISTORY_STORE_BACKEND_KEYS: readonly ["assertRuntimeContributionsInitialized", "assertVectorSlotInitialized", "assertVectorSlotsInitialized", "bootstrapTables", "capabilities", "checkUnique", "checkUniqueBatch", "claimIndexMaterialization", "close", "commitSchemaVersion", "compileSql", "countEdgesByKind", "countEdgesFrom", "countNodesByKind", "createVectorIndex", "deleteEdge", "deleteEdgesBatch", "deleteEmbedding", "deleteFulltext", "deleteFulltextBatch", "deleteNode", "deleteUnique", "deleteVectorSlotContribution", "dialect", "dropVectorIndex", "edgeExistsBetween", "ensureContributionMaterializationsTable", "ensureFulltextTable", "ensureIndexMaterializationsTable", "ensureKindRemovalsTable", "ensureReconciliationMarkersTable", "ensureRevisionOriginsTable", "ensureRuntimeContributions", "ensureVectorSlotContribution", "ensureVectorSlotContributions", "execute", "executeTemporaryStatement", "findEdgesByKind", "findEdgesConnectedTo", "findNodesByKind", "fulltextSearch", "fulltextStrategy", "getActiveSchema", "getAllKindRemovals", "getContributionMaterialization", "getEdge", "getEdges", "getIndexMaterialization", "getIndexMaterializations", "getNode", "getNodes", "getPendingKindRemovals", "getReconciliationMarker", "getSchemaVersion", "hardDeleteEdge", "hardDeleteEdgesBatch", "hardDeleteNode", "hybridSearch", "insertEdge", "insertEdgeNoReturn", "insertEdgesBatch", "insertEdgesBatchReturning", "insertNode", "insertNodeNoReturn", "insertNodesBatch", "insertNodesBatchReturning", "insertUnique", "insertUniqueBatch", "recordContributionMaterialization", "recordIndexMaterialization", "recordKindRemoval", "refreshStatistics", "releaseIndexMaterializationClaim", "setActiveVersion", "setReconciliationMarker", "tableNames", "updateEdge", "updateNode", "upsertEmbedding", "upsertEmbeddingBatch", "upsertFulltext", "upsertFulltextBatch", "vectorSearch", "vectorStrategy"];
3548
+ type HistoryStoreBackendMember = (typeof HISTORY_STORE_BACKEND_KEYS)[number];
3549
+ type UnsafeHistoryStoreBackendMember = "clearGraph" | "executeDdl" | "executeRaw" | "executeStatement" | "transaction" | "trustedImport";
3550
+ type UnclassifiedHistoryStoreBackendMember = Exclude<keyof GraphBackend, HistoryStoreBackendMember | UnsafeHistoryStoreBackendMember>;
3551
+ type HistoryStoreBackend = UnclassifiedHistoryStoreBackendMember extends never ? Readonly<Pick<GraphBackend, HistoryStoreBackendMember>> : never;
3552
+
3774
3553
  /**
3775
3554
  * `store.introspect()` — unified read of the merged schema.
3776
3555
  *
@@ -3846,6 +3625,17 @@ type UniqueIntrospection = Readonly<{
3846
3625
  collation: Collation;
3847
3626
  }>;
3848
3627
 
3628
+ /**
3629
+ * Data-cleanup phase for `store.removeKinds()`.
3630
+ *
3631
+ * The removeKinds verb commits the new schema atomically (millisecond
3632
+ * budget); the data deletion happens here, scoped per-deployment via
3633
+ * the `typegraph_kind_removals` status table. Splitting the verbs
3634
+ * mirrors how `materializeIndexes` complements `evolve`: schema
3635
+ * commits are atomic and fast, data work is bounded by row count and
3636
+ * deferrable / parallelizable.
3637
+ */
3638
+
3849
3639
  type MaterializeRemovalsOptions = Readonly<{
3850
3640
  /** Restrict to specific kind names. */
3851
3641
  kinds?: readonly string[];
@@ -3883,6 +3673,14 @@ type MaterializeRemovalsResult = Readonly<{
3883
3673
  reclaimedVectorFields: readonly ReclaimedVectorFieldEntry[];
3884
3674
  }>;
3885
3675
 
3676
+ /**
3677
+ * Subgraph Extraction
3678
+ *
3679
+ * Extracts a typed subgraph from a root node by traversing a set of edge kinds.
3680
+ * Uses a recursive CTE for BFS traversal with cycle detection, then hydrates
3681
+ * the reachable nodes and connecting edges in two parallel queries.
3682
+ */
3683
+
3886
3684
  /**
3887
3685
  * Discriminated union of all Node runtime types in a graph.
3888
3686
  *
@@ -4045,6 +3843,24 @@ type SubgraphResult<G extends GraphDef, NK extends NodeKinds<G> = NodeKinds<G>,
4045
3843
  reverseAdjacency: ReadonlyMap<string, ReadonlyMap<EK, readonly SubgraphEdgeResult<G, EK, P>[]>>;
4046
3844
  }>;
4047
3845
 
3846
+ declare const STORE_RUNTIME: unique symbol;
3847
+ /**
3848
+ * @internal Operations used by Store-owned views. The port is absent from the
3849
+ * public Store contract and non-enumerable at runtime. JavaScript reflection
3850
+ * can still discover symbol properties, so this is an unsupported internal
3851
+ * surface rather than a security boundary.
3852
+ */
3853
+ type StoreRuntime<G extends GraphDef> = Readonly<{
3854
+ backend: GraphBackend;
3855
+ sealedQuery: (coordinate: ReadCoordinate) => InitialQueryBuilder<G, "sealed">;
3856
+ recordedNodeGetById: <N extends NodeType>(kind: string, id: NodeId<N>, coordinate: ReadCoordinate) => Promise<Node<N> | undefined>;
3857
+ recordedNodeGetByIds: <N extends NodeType>(kind: string, ids: readonly NodeId<N>[], coordinate: ReadCoordinate) => Promise<readonly (Node<N> | undefined)[]>;
3858
+ recordedEdgeGetById: <E extends AnyEdgeType>(kind: string, id: EdgeId<E>, coordinate: ReadCoordinate) => Promise<Edge<E> | undefined>;
3859
+ recordedEdgeGetByIds: <E extends AnyEdgeType>(kind: string, ids: readonly EdgeId<E>[], coordinate: ReadCoordinate) => Promise<readonly (Edge<E> | undefined)[]>;
3860
+ subgraphAtCoordinate: <const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: InternalSubgraphOptions<G, EK, NK, P>) => Promise<SubgraphResult<G, NK, EK, P>>;
3861
+ algorithmsAtCoordinate: (coordinate: ReadCoordinate) => InternalGraphAlgorithms<G>;
3862
+ }>;
3863
+
4048
3864
  /**
4049
3865
  * Main Store implementation for TypeGraph.
4050
3866
  *
@@ -4056,10 +3872,6 @@ type SubgraphResult<G extends GraphDef, NK extends NodeKinds<G> = NodeKinds<G>,
4056
3872
  * - Transaction handling
4057
3873
  */
4058
3874
 
4059
- type StoreSchemaMetadata = Readonly<{
4060
- schemaVersion: number | undefined;
4061
- schemaHash: string | undefined;
4062
- }>;
4063
3875
  /**
4064
3876
  * The Store provides typed access to a TypeGraph database.
4065
3877
  *
@@ -4119,1003 +3931,126 @@ type ReembedVectorFieldResult = Readonly<{
4119
3931
  /** Number of nodes whose embedding was re-written (0 without `embed`). */
4120
3932
  reembedded: number;
4121
3933
  }>;
4122
- declare class Store<G extends GraphDef> {
4123
- #private;
4124
- constructor(graph: G, backend: GraphBackend, options?: StoreOptions, schemaMetadata?: StoreSchemaMetadata);
4125
- /** The graph definition */
4126
- get graph(): G;
4127
- /** The graph ID */
4128
- get graphId(): string;
4129
- /** The kind registry for ontology lookups */
4130
- get registry(): KindRegistry;
4131
- /** The database backend */
4132
- get backend(): GraphBackend;
4133
- /**
4134
- * Whether recorded-time capture is enabled for this store.
4135
- *
4136
- * @internal
4137
- */
4138
- get historyEnabled(): boolean;
4139
- /**
4140
- * Whether this Store advances a durable revision anchor for graph writes.
4141
- *
4142
- * @internal
4143
- */
4144
- get revisionTrackingEnabled(): boolean;
4145
- /**
4146
- * SQL schema that owns the durable revision clock relation.
4147
- *
4148
- * @internal
4149
- */
4150
- get revisionSchema(): SqlSchema;
4151
- /**
4152
- * Whether this store has a recorded read relation bound for reconstruction.
4153
- *
4154
- * @internal
4155
- */
4156
- get recordedReadBound(): boolean;
4157
- /**
4158
- * Node collections for ergonomic CRUD operations.
4159
- *
4160
- * @example
4161
- * ```typescript
4162
- * // Create a node
4163
- * const person = await store.nodes.Person.create({ name: "Alice" });
4164
- *
4165
- * // Get by ID
4166
- * const fetched = await store.nodes.Person.getById(person.id);
4167
- *
4168
- * // Find all
4169
- * const people = await store.nodes.Person.find({ limit: 10 });
4170
- * ```
4171
- */
4172
- get nodes(): GraphNodeCollections<G>;
4173
- /**
4174
- * Edge collections for ergonomic CRUD operations.
4175
- *
4176
- * @example
4177
- * ```typescript
4178
- * // Create an edge
4179
- * const edge = await store.edges.worksAt.create(
4180
- * { kind: "Person", id: person.id },
4181
- * { kind: "Company", id: company.id },
4182
- * { role: "Engineer" }
4183
- * );
4184
- *
4185
- * // Find edges from a node
4186
- * const edges = await store.edges.worksAt.findFrom({ kind: "Person", id: person.id });
4187
- * ```
4188
- */
4189
- get edges(): GraphEdgeCollections<G>;
4190
- /**
4191
- * Tier 1 graph algorithms: shortest path, reachability, neighborhoods, and
4192
- * degree centrality.
4193
- *
4194
- * Traversal calls use the iterative graph-operation substrate: a set-based
4195
- * breadth-first frontier backed by a temporary working table, or a chunked
4196
- * inline relation when the backend cannot pin a transactional connection.
4197
- * `degree` uses a single count query. The facade is built lazily on first
4198
- * access and cached for the lifetime of the store.
4199
- *
4200
- * @example
4201
- * ```typescript
4202
- * const path = await store.algorithms.shortestPath(alice, bob, {
4203
- * edges: ["knows"],
4204
- * });
4205
- *
4206
- * const friends = await store.algorithms.neighbors(alice, {
4207
- * edges: ["knows"],
4208
- * depth: 2,
4209
- * });
4210
- * ```
4211
- */
4212
- get algorithms(): GraphAlgorithms<G>;
4213
- /**
4214
- * Returns the node collection for the given kind, or undefined if the kind
4215
- * is not registered in this graph.
4216
- *
4217
- * Use this for runtime string-keyed access when the kind is not known at
4218
- * compile time (e.g., iterating all kinds, resolving from edge metadata,
4219
- * dynamic admin UIs). For the post-evolve "I just added this kind, give
4220
- * me the collection" pattern, prefer `getNodeCollectionOrThrow` — it
4221
- * throws `KindNotFoundError` instead of forcing a null-check.
4222
- */
4223
- getNodeCollection(kind: string): DynamicNodeCollection | undefined;
4224
- /**
4225
- * Returns the node collection for the given kind. Throws
4226
- * `KindNotFoundError` when the kind is not registered.
4227
- *
4228
- * The dominant graph-extension-kind access pattern: `await store.evolve(...)`
4229
- * returns a new store, the caller immediately operates on the new
4230
- * kind, and the null-check the optional variant requires is busywork.
4231
- */
4232
- getNodeCollectionOrThrow(kind: string): DynamicNodeCollection;
4233
- /**
4234
- * Returns the edge collection for the given kind, or undefined if the kind
4235
- * is not registered in this graph.
4236
- *
4237
- * Use this for runtime string-keyed access when the kind is not known at
4238
- * compile time. For post-evolve access, prefer `getEdgeCollectionOrThrow`.
4239
- */
4240
- getEdgeCollection(kind: string): DynamicEdgeCollection | undefined;
4241
- /**
4242
- * Returns the edge collection for the given kind. Throws
4243
- * `KindNotFoundError` when the kind is not registered.
4244
- */
4245
- getEdgeCollectionOrThrow(kind: string): DynamicEdgeCollection;
4246
- /**
4247
- * Returns the Zod props schema for the given node kind, or `undefined`
4248
- * if the kind is not registered. Identity-preserving: returns the
4249
- * exact instance used by `.create()` / `.update()`, so a `parse()`
4250
- * surfaces the same underlying Zod issues that `ValidationError`
4251
- * wraps (operation-level checks like uniqueness and endpoints stay
4252
- * in `collection.create`).
4253
- */
4254
- getNodePropsSchema(kind: string): z.ZodObject<z.ZodRawShape> | undefined;
4255
- /**
4256
- * Returns the Zod props schema for the given node kind. Throws
4257
- * `KindNotFoundError` when the kind is not registered.
4258
- */
4259
- getNodePropsSchemaOrThrow(kind: string): z.ZodObject<z.ZodRawShape>;
4260
- /**
4261
- * Returns the Zod props schema for the given edge kind, or `undefined`
4262
- * if the kind is not registered. Symmetric with `getNodePropsSchema`.
4263
- */
4264
- getEdgePropsSchema(kind: string): z.ZodObject<z.ZodRawShape> | undefined;
4265
- /**
4266
- * Returns the Zod props schema for the given edge kind. Throws
4267
- * `KindNotFoundError` when the kind is not registered.
4268
- */
4269
- getEdgePropsSchemaOrThrow(kind: string): z.ZodObject<z.ZodRawShape>;
4270
- /**
4271
- * Returns a unified read of the merged schema — every compile-time
4272
- * and graph-extension kind, every edge, every ontology relation,
4273
- * with explicit `origin: "compile-time" | "runtime"` markers — plus
4274
- * the persisted `extension` for round-tripping.
4275
- *
4276
- * Pure synchronous read built from the in-memory graph and the
4277
- * already-merged graph-extension document. `schemaVersion` and `schemaHash`
4278
- * are populated when the loader cached them at construction or after
4279
- * `evolve` returns; consumers needing a fresh read should call
4280
- * `backend.getActiveSchema(graphId)`.
4281
- *
4282
- * The return shape is the canonical schema-introspection surface:
4283
- * the prior standalone `store.deprecatedKinds` accessor is replaced
4284
- * by `introspect().deprecatedKinds`.
4285
- */
4286
- introspect(): SchemaIntrospection;
4287
- /**
4288
- * Creates a query builder for this store.
4289
- *
4290
- * @example
4291
- * ```typescript
4292
- * const results = await store.query()
4293
- * .from("Person", "p")
4294
- * .whereNode("p", (p) => p.name.eq("Alice"))
4295
- * .select((ctx) => ctx.p)
4296
- * .execute();
4297
- * ```
4298
- */
4299
- query(): InitialQueryBuilder<G, "open">;
4300
- /**
4301
- * Internal seam for {@link StoreView.query}: a query builder pinned to a
4302
- * view's {@link ReadCoordinate} with its temporal axis sealed
4303
- * (`.temporal()` throws). Not part of the stable public API — construct a
4304
- * view via {@link Store.view} / {@link Store.asOf} and call `.query()`.
4305
- */
4306
- sealedQuery(coordinate: ReadCoordinate): InitialQueryBuilder<G, "sealed">;
4307
- /**
4308
- * Internal seam for {@link RecordedStoreView}: reconstruct a node point read
4309
- * from the recorded-time relation while preserving live getById ordering and
4310
- * duplicate-input behavior.
4311
- *
4312
- * @internal
4313
- */
4314
- recordedNodeGetById<N extends NodeType>(kind: string, id: NodeId<N>, coordinate: ReadCoordinate): Promise<Node<N> | undefined>;
4315
- /**
4316
- * Internal seam for {@link RecordedStoreView}: reconstruct node point reads
4317
- * from the recorded-time relation while preserving input order.
4318
- *
4319
- * @internal
4320
- */
4321
- recordedNodeGetByIds<N extends NodeType>(kind: string, ids: readonly NodeId<N>[], coordinate: ReadCoordinate): Promise<readonly (Node<N> | undefined)[]>;
4322
- /**
4323
- * Internal seam for {@link RecordedStoreView}: reconstruct an edge point read
4324
- * from the recorded-time relation while preserving live getById behavior.
4325
- *
4326
- * @internal
4327
- */
4328
- recordedEdgeGetById<E extends AnyEdgeType>(kind: string, id: EdgeId<E>, coordinate: ReadCoordinate): Promise<Edge<E> | undefined>;
4329
- /**
4330
- * Internal seam for {@link RecordedStoreView}: reconstruct edge point reads
4331
- * from the recorded-time relation while preserving input order.
4332
- *
4333
- * @internal
4334
- */
4335
- recordedEdgeGetByIds<E extends AnyEdgeType>(kind: string, ids: readonly EdgeId<E>[], coordinate: ReadCoordinate): Promise<readonly (Edge<E> | undefined)[]>;
4336
- /**
4337
- * Returns a read-only {@link StoreView} pinned to a valid-time instant.
4338
- *
4339
- * The view routes every supported read — `nodes` / `edges` collections,
4340
- * `query()`, `subgraph()`, and the graph algorithms — through the
4341
- * `asOf` coordinate, so they observe the graph as it was valid at `T`.
4342
- * Writes stay on the live `Store`. Mirrors Datomic's `(d/as-of db t)`.
4343
- *
4344
- * @example
4345
- * ```typescript
4346
- * const past = store.asOf("2026-01-01T00:00:00.000Z");
4347
- * const alice = await past.nodes.Person.getById(aliceId);
4348
- * const names = await past
4349
- * .query()
4350
- * .from("Person", "p")
4351
- * .whereNode("p", (p) => p.name.eq("Alice"))
4352
- * .select((ctx) => ctx.p.name)
4353
- * .execute();
4354
- * ```
4355
- *
4356
- * @param asOf - ISO-8601 timestamp to pin the valid-time coordinate to.
4357
- */
4358
- asOf(asOf: string): StoreView<G>;
4359
- /**
4360
- * Returns a narrow read-only view pinned to a recorded/system-time instant.
4361
- *
4362
- * Direct `store.asOfRecorded(T)` is diagonal bitemporal sugar: it reads the
4363
- * recorded-time relation as of `T` and uses the same `T` for the valid-time
4364
- * axis. Use `store.asOf(validT).asOfRecorded(recordedT)` when the valid and
4365
- * recorded axes should differ.
4366
- *
4367
- * The returned view exposes only reconstructing-safe reads: query,
4368
- * subgraph, graph algorithms, and collection point reads.
4369
- *
4370
- * Prefer `await store.recordedNow()` as the anchor over a wall-clock
4371
- * timestamp: recorded instants are monotonic and can run briefly ahead of the
4372
- * wall clock under bursty writes, so a `new Date().toISOString()` passed here
4373
- * may sort before the most recent commits and silently omit them.
4374
- */
4375
- asOfRecorded(recordedAsOf: RecordedInstant): RecordedStoreView<G>;
4376
- /**
4377
- * Returns the latest recorded-time instant captured for this graph — the
4378
- * recorded high-water mark. After guarding the `undefined` case,
4379
- * `store.asOfRecorded(checkpoint)` reconstructs everything committed so far, a
4380
- * deterministic anchor that avoids guessing with the wall clock (recorded
4381
- * instants are monotonic and can run briefly ahead of wall-clock time under
4382
- * bursty writes). Capture each anchor right after the writes it should cover.
4383
- *
4384
- * Returns `undefined` until the first write has been captured, so on a
4385
- * brand-new graph guard the composition — `asOfRecorded(undefined)` rejects
4386
- * (an instant is required) rather than reconstructing an empty view. Read the
4387
- * value first and only pass it to `asOfRecorded` once it is defined.
4388
- *
4389
- * **Graph-global, not caller-scoped.** This is the single high-water mark for
4390
- * the whole graph, advanced by every committed capture from any writer — not
4391
- * a per-write or per-caller value. An advance between two reads means
4392
- * "something committed to this graph in between," *not* "the write this caller
4393
- * just made landed." Do not use a `recordedNow()` advance as a "did my write
4394
- * succeed?" signal: under any concurrent writer to the same graph it both
4395
- * misses dropped writes and misfires on no-op writes. Confirm a specific write
4396
- * by observing the write itself (its return value, or `store.transaction(...)`
4397
- * success), not the global clock.
4398
- */
4399
- recordedNow(): Promise<RecordedInstant | undefined>;
4400
- /**
4401
- * Returns the durable graph revision used by graph branching. It is undefined
4402
- * until the first successful tracked write, which is itself a stable initial
4403
- * anchor. Unlike {@link recordedNow}, this is also available on a live Store
4404
- * created with `{ revisionTracking: true }`.
4405
- *
4406
- * @internal
4407
- */
4408
- revisionNow(): Promise<string | undefined>;
4409
- /**
4410
- * Returns the durable random namespace for this graph's revision clock. A
4411
- * tracked base token combines it with {@link revisionNow}, preventing a
4412
- * branch from one independent store from matching a coincident timestamp in
4413
- * another store.
4414
- *
4415
- * @internal
4416
- */
4417
- revisionOriginNow(): Promise<string>;
4418
- /**
4419
- * Returns a read-only {@link StoreView} pinned to an arbitrary public
4420
- * temporal mode. Use {@link Store.asOf} for the common valid-time case;
4421
- * reach for `view` to pin `"current"`, `"includeEnded"`, or
4422
- * `"includeTombstones"`.
4423
- *
4424
- * @example
4425
- * ```typescript
4426
- * const withTombstones = store.view({ mode: "includeTombstones" });
4427
- * const everyEverVersion = await withTombstones.nodes.Person.find();
4428
- * ```
4429
- *
4430
- * @param coordinate - The `(mode, asOf)` coordinate to pin. `asOf` is
4431
- * required when `mode` is `"asOf"` and rejected for every other mode.
4432
- */
4433
- view(coordinate: StoreViewCoordinate): StoreView<G>;
4434
- /**
4435
- * Returns a read-only {@link StoreView} pinned to the current instant,
4436
- * captured once at construction — a stable point-in-time snapshot. Unlike
4437
- * `store.view({ mode: "current" })` (which tracks "now" live and can read
4438
- * different surfaces against slightly different clocks), a snapshot pins one
4439
- * `asOf` timestamp, so every surface observes the same instant. Sugar for
4440
- * `store.asOf(new Date().toISOString())`; mirrors Datomic's `(d/db conn)`.
4441
- *
4442
- * @example
4443
- * ```typescript
4444
- * const snap = store.snapshot();
4445
- * // Every read on `snap` sees the graph as of one fixed instant.
4446
- * const a = await snap.nodes.Person.find();
4447
- * const r = await snap.reachable(rootId, { edges: ["knows"] });
4448
- * ```
4449
- */
4450
- snapshot(): StoreView<G>;
4451
- /**
4452
- * Search-related operations (fulltext, hybrid, and rebuild).
4453
- *
4454
- * All search methods live under this facade to keep the top-level
4455
- * Store API focused on CRUD + graph traversal. The facade is
4456
- * lazy-initialized and cached for the lifetime of the store.
4457
- *
4458
- * @example
4459
- * ```typescript
4460
- * // Fulltext
4461
- * const hits = await store.search.fulltext("Document", {
4462
- * query: "climate warming",
4463
- * limit: 10,
4464
- * includeSnippets: true,
4465
- * });
4466
- *
4467
- * // Hybrid (vector + fulltext fused with RRF)
4468
- * const ranked = await store.search.hybrid("Document", {
4469
- * limit: 10,
4470
- * vector: { fieldPath: "embedding", queryEmbedding: vec },
4471
- * fulltext: { query: "climate warming" },
4472
- * });
4473
- *
4474
- * // Rebuild index after schema change
4475
- * const stats = await store.search.rebuildFulltext();
4476
- * ```
4477
- */
4478
- get search(): StoreSearch<G>;
4479
- /**
4480
- * Executes multiple queries and returns a typed tuple of results.
4481
- *
4482
- * Each query preserves its own result type, projection, filtering, sorting,
4483
- * and pagination.
4484
- *
4485
- * **Snapshot consistency is conditional.** When
4486
- * `backend.capabilities.transactions` is `true`, queries run sequentially
4487
- * on a single connection inside an implicit transaction and observe the
4488
- * same database snapshot. When transactions are unavailable
4489
- * (Cloudflare D1, `drizzle-orm/neon-http`), queries run sequentially over
4490
- * independent connections and may observe writes that landed between them.
4491
- * Branch on `backend.capabilities.transactions` if you need a guaranteed
4492
- * snapshot.
4493
- *
4494
- * Read-only — use `bulkCreate`, `bulkInsert`, etc. for write batching.
4495
- *
4496
- * @example
4497
- * ```typescript
4498
- * const [people, companies] = await store.batch(
4499
- * store.query()
4500
- * .from("Person", "p")
4501
- * .select((ctx) => ({ id: ctx.p.id, name: ctx.p.name })),
4502
- * store.query()
4503
- * .from("Company", "c")
4504
- * .select((ctx) => ({ id: ctx.c.id, name: ctx.c.name }))
4505
- * .orderBy("c", "name", "asc")
4506
- * .limit(5),
4507
- * );
4508
- * // people: readonly { id: string; name: string }[]
4509
- * // companies: readonly { id: string; name: string }[]
4510
- * ```
4511
- *
4512
- * @param queries - Two or more executable queries (from `.select()` or set operations)
4513
- * @returns A tuple with per-query typed results, preserving input order
4514
- */
4515
- batch<const Queries extends readonly [
3934
+ type StoreCore<G extends GraphDef> = Readonly<{
3935
+ [STORE_RUNTIME]: StoreRuntime<G>;
3936
+ graph: G;
3937
+ graphId: string;
3938
+ capabilities: BackendCapabilities;
3939
+ registry: KindRegistry;
3940
+ historyEnabled: boolean;
3941
+ revisionTrackingEnabled: boolean;
3942
+ revisionSchema: SqlSchema;
3943
+ recordedReadBound: boolean;
3944
+ nodes: GraphNodeCollections<G>;
3945
+ edges: GraphEdgeCollections<G>;
3946
+ algorithms: GraphAlgorithms<G>;
3947
+ search: StoreSearch<G>;
3948
+ getNodeCollection: (kind: string) => DynamicNodeCollection | undefined;
3949
+ getNodeCollectionOrThrow: (kind: string) => DynamicNodeCollection;
3950
+ getEdgeCollection: (kind: string) => DynamicEdgeCollection | undefined;
3951
+ getEdgeCollectionOrThrow: (kind: string) => DynamicEdgeCollection;
3952
+ getNodePropsSchema: (kind: string) => z.ZodObject<z.ZodRawShape> | undefined;
3953
+ getNodePropsSchemaOrThrow: (kind: string) => z.ZodObject<z.ZodRawShape>;
3954
+ getEdgePropsSchema: (kind: string) => z.ZodObject<z.ZodRawShape> | undefined;
3955
+ getEdgePropsSchemaOrThrow: (kind: string) => z.ZodObject<z.ZodRawShape>;
3956
+ introspect: () => SchemaIntrospection;
3957
+ query: () => InitialQueryBuilder<G, "open">;
3958
+ asOf: (asOf: string) => StoreView<G>;
3959
+ asOfRecorded: (recordedAsOf: RecordedInstant) => RecordedStoreView<G>;
3960
+ recordedNow: () => Promise<RecordedInstant | undefined>;
3961
+ revisionNow: () => Promise<string | undefined>;
3962
+ revisionOriginNow: () => Promise<string>;
3963
+ view: (coordinate: StoreViewCoordinate) => StoreView<G>;
3964
+ snapshot: () => StoreView<G>;
3965
+ batch: <const Queries extends readonly [
4516
3966
  BatchableQuery<unknown>,
4517
3967
  BatchableQuery<unknown>,
4518
3968
  ...BatchableQuery<unknown>[]
4519
- ]>(...queries: Queries): Promise<BatchResults<Queries>>;
4520
- /**
4521
- * Extracts a typed subgraph by traversing from a root node.
4522
- *
4523
- * Performs a BFS traversal from `rootId` following the specified edge kinds,
4524
- * returning an indexed result with adjacency maps for immediate traversal.
4525
- *
4526
- * @example
4527
- * ```typescript
4528
- * const sg = await store.subgraph(run.id, {
4529
- * edges: ["has_task", "runs_agent", "uses_skill"],
4530
- * maxDepth: 4,
4531
- * });
4532
- *
4533
- * // Root node (the traversal starting point)
4534
- * console.log(sg.root?.kind);
4535
- *
4536
- * // Lookup by ID
4537
- * const task = sg.nodes.get(taskId);
4538
- *
4539
- * // Forward adjacency: edges of a kind from a node
4540
- * const taskEdges = sg.adjacency.get(run.id)?.get("has_task") ?? [];
4541
- *
4542
- * // Reverse adjacency: edges of a kind pointing to a node
4543
- * const parentEdges = sg.reverseAdjacency.get(taskId)?.get("has_task") ?? [];
4544
- * ```
4545
- */
4546
- subgraph<const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: SubgraphOptions<G, EK, NK, P>): Promise<SubgraphResult<G, NK, EK, P>>;
4547
- /**
4548
- * Internal seam for {@link StoreView} / {@link RecordedStoreView}: runs a
4549
- * subgraph with a coordinate already flattened into the options (including a
4550
- * recorded/system-time pin). Trusted caller — the public {@link Store.subgraph}
4551
- * is the guarded entry point.
4552
- *
4553
- * @internal
4554
- */
4555
- subgraphAtCoordinate<const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: InternalSubgraphOptions<G, EK, NK, P>): Promise<SubgraphResult<G, NK, EK, P>>;
4556
- /**
4557
- * Internal seam for StoreView graph algorithms at a pinned coordinate.
4558
- *
4559
- * @internal
4560
- */
4561
- algorithmsAtCoordinate(coordinate: ReadCoordinate): InternalGraphAlgorithms<G>;
4562
- /**
4563
- * Executes a function within a transaction.
4564
- *
4565
- * The transaction context provides the same collection API as the Store:
4566
- * - `tx.nodes.Person.create(...)` - Create a node
4567
- * - `tx.edges.worksAt.create(...)` - Create an edge
4568
- * - `tx.sql` - the raw Drizzle handle **bound to this same
4569
- * transaction**, for writing the caller's own relational tables in
4570
- * the same atomic boundary (the graph-owned counterpart of
4571
- * {@link Store.withTransaction}). See {@link TransactionContext}
4572
- * for per-backend semantics. To decide at runtime whether `tx.sql` is
4573
- * usable, branch on `tx.sqlAvailability` rather than truthiness-testing
4574
- * `tx.sql` — under history capture or revision tracking `tx.sql` is
4575
- * present-but-throwing (`sqlAvailability` is `"history"` /
4576
- * `"revisionTracking"`), and it is `undefined` only on the non-transactional
4577
- * fallback (`sqlAvailability === "unavailable"`). When it reports
4578
- * `"history"` / `"revisionTracking"`, raw SQL is disabled because it would
4579
- * bypass recorded-time capture or the revision anchor; use the typed
4580
- * collections inside `transaction()` or
4581
- * {@link Store.withRecordedTransaction}.
4582
- *
4583
- * @example
4584
- * ```typescript
4585
- * await store.transaction(async (tx) => {
4586
- * const person = await tx.nodes.Person.create({ name: "Alice" });
4587
- * const company = await tx.nodes.Company.create({ name: "Acme" });
4588
- * await tx.edges.worksAt.create(
4589
- * { kind: "Person", id: person.id },
4590
- * { kind: "Company", id: company.id },
4591
- * { role: "Engineer" }
4592
- * );
4593
- * });
4594
- * ```
4595
- *
4596
- * @example Cross-store write via `tx.sql` (graph-owned boundary):
4597
- * ```typescript
4598
- * await store.transaction(async (tx) => {
4599
- * await tx.nodes.Document.update(documentId, props);
4600
- * // cast `tx.sql` to your concrete Drizzle database type
4601
- * const sqlTx = tx.sql as NodePgDatabase;
4602
- * await sqlTx.insert(documentVersions).values(versionRow);
4603
- * });
4604
- * ```
4605
- *
4606
- * **`tx.sql` shares the one pinned connection — await it, don't overlap it.**
4607
- * TypeGraph serializes the statements *its own* collections issue, so a
4608
- * `Promise.all` of graph writes is safe. A statement you issue through
4609
- * `tx.sql` bypasses that queue: run it concurrently with a graph write (or
4610
- * with another `tx.sql` statement) and two queries race on the one
4611
- * transaction connection — the exact overlap Postgres removes in `pg@9`.
4612
- * Await each `tx.sql` statement before starting the next write. TypeGraph
4613
- * cannot police this: it never sees the raw handle's traffic, so it also
4614
- * cannot drain a raw statement still in flight when the transaction commits.
4615
- *
4616
- * **Backends without transactions.** When `backend.capabilities.transactions`
4617
- * is `false` (Cloudflare D1, `drizzle-orm/neon-http`), this method runs the
4618
- * callback against the same backend used outside `transaction()` — writes
4619
- * are applied as they happen and a thrown error does **not** roll back
4620
- * earlier writes inside the callback. Branch on
4621
- * `backend.capabilities.transactions` if you require atomicity:
4622
- *
4623
- * ```typescript
4624
- * if (backend.capabilities.transactions) {
4625
- * await store.transaction(async (tx) => { ... });
4626
- * } else {
4627
- * // sequential, non-atomic — handle partial-failure recovery yourself
4628
- * }
4629
- * ```
4630
- *
4631
- * @param fn The callback run inside the transaction boundary.
4632
- * @param options Optional {@link TransactionOptions} forwarded to the
4633
- * backend (e.g. `isolationLevel: "serializable"` on Postgres). Backends
4634
- * without isolation-level support ignore it; the non-transactional
4635
- * fallback ignores it entirely. Stores created with `{ history: true }`
4636
- * require read-committed semantics for PostgreSQL recorded-clock capture and
4637
- * reject stronger snapshot isolation levels.
4638
- */
4639
- transaction<T>(this: HistoryStore<G>, fn: (tx: HistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
4640
- transaction<T>(fn: (tx: TransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
4641
- /**
4642
- * Runs a transaction exactly like {@link transaction} and additionally
4643
- * returns a {@link TransactionOutcome} whose receipt summarizes the
4644
- * completed write intents on the transaction-scoped collection surface.
4645
- *
4646
- * A dedicated method (rather than an option on `transaction()`) keeps the
4647
- * return type tied to static dispatch: forwarding options through wrappers
4648
- * can never change what a call returns. See {@link TransactionReceipt} for
4649
- * exact count semantics.
4650
- *
4651
- * The receipt does not count writes that bypass the `tx.nodes.*` /
4652
- * `tx.edges.*` collections, such as direct backend writes, raw SQL, or
4653
- * import helpers. The adopted-commit sibling
4654
- * {@link Store.withRecordedTransaction} also returns a
4655
- * {@link TransactionOutcome}; only `withTransaction` (whose commit belongs
4656
- * entirely to the caller with no flush point) produces no receipt. On
4657
- * non-transactional backends, the receipt is still returned, but it describes
4658
- * operations that individually committed rather than one atomic commit; if the
4659
- * callback rejects on such a backend, no receipt is returned even though
4660
- * earlier operations committed individually.
4661
- *
4662
- * For stores created with `{ history: true }`, `receipt.recorded` is the
4663
- * recorded commit instant this transaction allocated for the store's
4664
- * graph, or `undefined` when nothing was captured.
4665
- *
4666
- * The callback receives a {@link MeasurableTransactionContext}: call
4667
- * `tx.measure((scoped) => ...)` to scope a sub-receipt to the writes made
4668
- * through the `scoped` context (e.g. to attribute writes to user code the
4669
- * caller invokes, excluding its own bookkeeping written through `tx`). See
4670
- * {@link MeasurableTransactionContext} for semantics.
4671
- *
4672
- * @example
4673
- * ```typescript
4674
- * const outcome = await store.transactionWithReceipt(async (tx) => {
4675
- * const alice = await tx.nodes.Person.create({ name: "Alice" });
4676
- * return alice.id;
4677
- * });
4678
- * outcome.result; // Alice's id
4679
- * outcome.receipt.writes; // { nodes: { Person: 1 }, edges: {}, total: 1 }
4680
- * ```
4681
- */
4682
- transactionWithReceipt<T>(this: HistoryStore<G>, fn: (tx: MeasurableHistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
4683
- transactionWithReceipt<T>(fn: (tx: MeasurableTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
4684
- /**
4685
- * Adopts a caller-owned, already-open Drizzle transaction so the graph
4686
- * store and the caller's relational writes commit or roll back as one
4687
- * Postgres/SQLite transaction (#134).
4688
- *
4689
- * Use this when the **relational layer owns the transaction**: the
4690
- * caller has opened a transaction and needs TypeGraph writes enlisted
4691
- * on the *same* connection. Unlike {@link transaction}, this opens no
4692
- * transaction — the caller's transaction is the single commit/rollback
4693
- * boundary.
4694
- *
4695
- * `withTransaction` is driver-agnostic; how the caller opens the
4696
- * transaction is not. **Async drivers** (node-postgres,
4697
- * `neon-serverless` Pool, libsql) use `db.transaction(async …)`.
4698
- * **Synchronous `better-sqlite3`** cannot — its driver rejects an
4699
- * `async` transaction callback (`Transaction function cannot return a
4700
- * promise`) and the async continuation would run outside the
4701
- * rolled-back transaction — so the caller opens the transaction with
4702
- * explicit `BEGIN`/`COMMIT`/`ROLLBACK` on the single connection
4703
- * instead. See the "Cross-Store Transactions" recipe for both shapes.
4704
- *
4705
- * The returned context reuses this store's already-resolved
4706
- * schema/registry: it runs **no** schema bootstrap, `evolve`, or
4707
- * migration, and emits **no DDL** inside the caller's transaction.
4708
- * Fulltext operations assert the durable materialization marker (a
4709
- * cached SELECT) and throw {@link StoreNotInitializedError} on a
4710
- * missing/stale/failed marker rather than migrating mid-transaction —
4711
- * so boot the parent store via `createStoreWithSchema` once at
4712
- * startup.
4713
- *
4714
- * @example
4715
- * ```typescript
4716
- * // Async driver (Postgres / libsql):
4717
- * await db.transaction(async (sqlTx) => {
4718
- * const connector = await createConnectorRow(sqlTx, input); // Drizzle
4719
- * const txStore = store.withTransaction(sqlTx);
4720
- * await txStore.nodes.ArtifactSource.create({ // TypeGraph
4721
- * connectorId: connector.id,
4722
- * });
4723
- * }); // one COMMIT / ROLLBACK across both layers
4724
- * ```
4725
- *
4726
- * **The caller owns the connection — don't overlap writes on it.** The graph
4727
- * store and your Drizzle writes share the one connection the caller's
4728
- * transaction pinned. TypeGraph serializes the statements *its* collections
4729
- * issue, but your raw Drizzle statements (and any graph write run alongside
4730
- * them) are yours to sequence: a `Promise.all` mixing the two races two
4731
- * queries on that connection — the overlap Postgres removes in `pg@9`. Await
4732
- * each write before starting the next.
4733
- *
4734
- * Not available when the store was created with `{ history: true }`: a
4735
- * caller-owned transaction context would let writes happen after capture has
4736
- * lost its flush point. On a {@link HistoryStore} this is a **compile error**
4737
- * at the call site (the `externalTx` argument is rejected against a message
4738
- * type naming {@link Store.withRecordedTransaction}); the runtime guard still
4739
- * throws `ConfigurationError`
4740
- * (`RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION`) if the check is
4741
- * suppressed. Use {@link Store.withRecordedTransaction} on a history-enabled
4742
- * store, which adopts the same external transaction but flushes recorded-time
4743
- * capture before the caller commits.
4744
- *
4745
- * @throws {ConfigurationError} when the store has history capture enabled
4746
- * (use {@link Store.withRecordedTransaction} instead), or when the backend
4747
- * cannot adopt an external transaction — either it is not a Drizzle
4748
- * Postgres/SQLite backend, or `backend.capabilities.transactions` is `false`
4749
- * (`drizzle-orm/neon-http`, Cloudflare D1, SQLite
4750
- * `transactionMode: "none"`). A non-atomic fallback is deliberately
4751
- * not offered here: the caller's relational write *would* still
4752
- * commit, defeating the purpose of cross-store atomicity.
4753
- * @throws {StoreNotInitializedError} at point of use, when a fulltext
4754
- * operation on the returned context observes a missing/stale/failed
4755
- * durable materialization marker (parent store not booted via
4756
- * `createStoreWithSchema`). Rolls back the caller's transaction
4757
- * without emitting any DDL.
4758
- */
4759
- withTransaction<This extends Store<G>>(this: This, externalTx: This extends HistoryStore<G> ? HistoryWithTransactionUnavailable : AdoptedTransaction): This extends HistoryStore<G> ? never : TransactionContext<G>;
4760
- /**
4761
- * Adopts a caller-owned transaction while giving recorded-time capture a
4762
- * flush point before the caller commits. Required when `history: true` is
4763
- * enabled because returning a long-lived transaction context would let writes
4764
- * happen after TypeGraph has lost the chance to close/open recorded rows.
4765
- *
4766
- * Capture flushes once, when `fn` resolves. The flush seals the capture
4767
- * session, so a graph write made through the transaction context *after* `fn`
4768
- * returns (e.g. retaining `tx` and writing once more before the caller's
4769
- * COMMIT) throws rather than committing uncaptured — the post-flush write
4770
- * cannot silently diverge history from live state. This sealing behavior is
4771
- * unchanged by the receipt return.
4772
- *
4773
- * Returns a {@link TransactionOutcome} — the adopted path is the only way to
4774
- * get exactly-once cursors and graph writes atomically on a history store, so
4775
- * it surfaces the same receipt `transactionWithReceipt` does: `receipt.writes`
4776
- * for drop detection (a non-delete change that wrote nothing) and
4777
- * `receipt.recorded` as the per-transaction replay anchor. Destructure
4778
- * `{ result, receipt }`:
4779
- *
4780
- * ```typescript
4781
- * const { result, receipt } = await store.withRecordedTransaction(
4782
- * externalTx,
4783
- * async (tx) => tx.nodes.Document.update(documentId, props),
4784
- * );
4785
- * ```
4786
- *
4787
- * `receipt.recorded` is the recorded commit instant this transaction allocated
4788
- * for the store's graph at the flush point (when `fn` resolved), and is
4789
- * `undefined` when nothing was captured — a read-only `fn`, or a non-history
4790
- * store (where the receipt still counts write intents but there is no recorded
4791
- * time). To attribute writes when `fn` invokes user code that also
4792
- * bookkeeps, use `tx.measure((scoped) => ...)` and have that code write
4793
- * through the `scoped` context (see {@link MeasurableTransactionContext}).
4794
- *
4795
- * Write your own relational tables through the **external transaction handle
4796
- * you passed in** (`externalTx`) — it *is* the pinned connection. `tx.sql` is
4797
- * unavailable here (it is a fail-loud guard under history capture, since raw
4798
- * SQL bypasses recorded-time capture, and `HistoryTransactionContext` types it
4799
- * `sql?: never`). Writing through `externalTx` is the sanctioned way to get
4800
- * cross-store atomicity on a history-enabled store:
4801
- *
4802
- * ```typescript
4803
- * // Async driver (Postgres / libsql):
4804
- * await db.transaction(async (pgTx) => {
4805
- * const { receipt } = await store.withRecordedTransaction(pgTx, async (tx) => {
4806
- * await tx.nodes.Document.update(documentId, props); // graph write
4807
- * });
4808
- * await pgTx.insert(streamCursors).values(cursorRow); // your own table
4809
- * }); // one COMMIT / ROLLBACK across both layers
4810
- * ```
4811
- *
4812
- * The graph writes and your `externalTx` statements share the caller's one
4813
- * pinned connection. TypeGraph serializes the statements its collections
4814
- * issue; sequence your own raw statements (and don't `Promise.all` them with
4815
- * graph writes) so two queries never race on that connection.
4816
- */
4817
- withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx: MeasurableHistoryTransactionContext<G>) => Promise<T>): Promise<TransactionOutcome<T>>;
4818
- withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx: MeasurableTransactionContext<G>) => Promise<T>): Promise<TransactionOutcome<T>>;
4819
- /**
4820
- * Hard-deletes all data for this graph from the database.
4821
- *
4822
- * Removes all nodes, edges, uniqueness entries, embeddings, and schema versions
4823
- * for this graph's ID. No hooks, no per-row logic. Wrapped in a transaction
4824
- * when the backend supports it.
4825
- *
4826
- * The store is usable after clearing — new data can be created immediately.
4827
- */
4828
- clear(): Promise<void>;
4829
- /**
4830
- * Refreshes the backend's query-planner statistics.
4831
- *
4832
- * Call this once after a large initial import or bulk backfill. The
4833
- * planner uses table statistics to choose between TypeGraph's
4834
- * multi-column indexes; without fresh stats a forward traversal can
4835
- * pick a reverse index and run an order of magnitude slower than
4836
- * needed. Autovacuum / background statistics will catch up
4837
- * eventually, but calling this explicitly after a bulk load gives
4838
- * you correct latencies immediately.
4839
- *
4840
- * Implementations:
4841
- * - SQLite runs `ANALYZE`, populating `sqlite_stat1`
4842
- * - PostgreSQL runs `ANALYZE` on the TypeGraph-managed tables
4843
- *
4844
- * Costs a few tens of milliseconds at the sizes this library is
4845
- * designed for. Safe to call at any time.
4846
- *
4847
- * @example
4848
- * ```typescript
4849
- * // After a bulk import
4850
- * for (const batch of batches) {
4851
- * await store.nodes.Document.bulkCreate(batch);
4852
- * }
4853
- * await store.refreshStatistics();
4854
- * ```
4855
- */
4856
- refreshStatistics(): Promise<void>;
4857
- /**
4858
- * Evolves the graph at runtime by merging a graph extension into the
4859
- * current schema, atomically committing a new schema version, and
4860
- * returning a fresh `Store` constructed against the merged graph.
4861
- *
4862
- * The `Store` is immutable — its registry, collections, and operation
4863
- * contexts close over the graph at construction time — so callers
4864
- * must use the returned store (or pass a `ref` to be re-pointed) for
4865
- * any work involving the new kinds.
4866
- *
4867
- * **Cost for purely additive extensions is proportional to schema
4868
- * document size, not row count.** The commit is a single CAS write.
4869
- * Tightening changes against existing graph-extension-declared kinds run
4870
- * row-count probes for those affected kinds so populated kinds can
4871
- * be rejected without a backfill.
4872
- *
4873
- * **Concurrent evolve recovery.** On `StaleVersionError`, refetch the
4874
- * current active schema (or dereference your `StoreRef`),
4875
- * reconstruct your `Store`, and re-call `evolve(extension)` against
4876
- * the new store. Re-validation may now surface deterministic errors
4877
- * (e.g., another caller just added a kind that collides with yours,
4878
- * or redeclared one of yours with a different shape). Don't loop
4879
- * blindly — surface the error.
4880
- *
4881
- * @param extension - Graph extension produced by
4882
- * `defineGraphExtension(...)`.
4883
- * @param options.ref - Optional handle whose `current` is overwritten
4884
- * atomically with the schema commit. Long-lived consumers
4885
- * (request handlers, background workers) that dereference through
4886
- * the ref see the new kinds on the *next* call.
4887
- *
4888
- * @throws {GraphExtensionValidationError} when the extension is
4889
- * structurally invalid.
4890
- * @throws {KindCollisionError} when an extension kind shadows a
4891
- * compile-time kind (code `KIND_COLLISION`).
4892
- * @throws {IncompatibleChangeError} when a redeclared kind narrows
4893
- * in a way the existing rows can't satisfy
4894
- * (code `INCOMPATIBLE_CHANGE`).
4895
- * @throws {GraphExtensionUnresolvedEndpointError} when an edge
4896
- * endpoint references a kind that exists in neither the extension
4897
- * nor the host graph
4898
- * (code `GRAPH_EXTENSION_UNRESOLVED_ENDPOINT`).
4899
- * @throws {StaleVersionError} when another writer has advanced the
4900
- * schema since this store was constructed; recovery as above.
4901
- * @throws {SchemaContentConflictError} when a row already exists at
4902
- * the target version with a different content hash.
4903
- */
4904
- evolve(extension: GraphExtension, options?: Readonly<{
4905
- ref?: StoreRef<Store<G>>;
4906
- /**
4907
- * When set, automatically run `materializeIndexes()` on the new
4908
- * Store after the schema commit succeeds. Pass `{}` for default
4909
- * behavior (all declared indexes, best-effort) or a populated
4910
- * options object for finer control. Omit to defer materialization
4911
- * to a later `materializeIndexes()` call.
4912
- *
4913
- * The schema-version write is NOT rolled back if materialization
4914
- * produces failed entries — failure surfaces as
4915
- * `EagerMaterializationError` thrown AFTER the new Store is
4916
- * constructed and `ref.current` is updated, so the caller can
4917
- * recover via the ref handle.
4918
- */
3969
+ ]>(...queries: Queries) => Promise<BatchResults<Queries>>;
3970
+ subgraph: <const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: SubgraphOptions<G, EK, NK, P>) => Promise<SubgraphResult<G, NK, EK, P>>;
3971
+ clear: () => Promise<void>;
3972
+ refreshStatistics: () => Promise<void>;
3973
+ materializeIndexes: (options?: MaterializeIndexesOptions) => Promise<MaterializeIndexesResult>;
3974
+ materializeSystemIndexes: (options?: MaterializeSystemIndexesOptions) => Promise<MaterializeIndexesResult>;
3975
+ reembedVectorField: (kind: string, fieldPath: string, options?: ReembedVectorFieldOptions) => Promise<ReembedVectorFieldResult>;
3976
+ materializeRemovals: (options?: MaterializeRemovalsOptions) => Promise<MaterializeRemovalsResult>;
3977
+ close: () => Promise<void>;
3978
+ }>;
3979
+ type StoreTransactions<G extends GraphDef> = Readonly<{
3980
+ transaction: <T>(fn: (tx: TransactionContext<G>) => Promise<T>, options?: TransactionOptions) => Promise<T>;
3981
+ transactionWithReceipt: <T>(fn: (tx: MeasurableTransactionContext<G>) => Promise<T>, options?: TransactionOptions) => Promise<TransactionOutcome<T>>;
3982
+ }>;
3983
+ interface StoreEvolution<G extends GraphDef, TStore extends StoreCore<G>> {
3984
+ readonly evolve: <TRefStore extends StoreCore<G> = TStore>(extension: GraphExtension, options?: Readonly<{
3985
+ ref?: TStore extends TRefStore ? StoreRef<TRefStore> : never;
4919
3986
  eager?: MaterializeIndexesOptions;
4920
- }>): Promise<Store<G>>;
4921
- /**
4922
- * Marks the named node and edge kinds as soft-deprecated. Surfaces in
4923
- * `store.introspect().deprecatedKinds` for introspection (codegen,
4924
- * UI tooling, lints) but does not gate reads, writes, or queries —
4925
- * deprecation is a signal, not a removal.
4926
- *
4927
- * Atomically commits a new schema version through the same primitive
4928
- * `evolve()` uses, so concurrent deprecate/evolve calls produce
4929
- * `StaleVersionError | SchemaContentConflictError` race losers that
4930
- * the caller refetches and retries. Idempotent: re-deprecating a
4931
- * kind that's already marked is a no-op (no version bump).
4932
- *
4933
- * @param names - Node or edge kind names to mark as deprecated.
4934
- * @param options.ref - Optional handle to be re-pointed atomically
4935
- * with the schema commit, mirroring `evolve()`.
4936
- *
4937
- * @throws {ConfigurationError} on `DEPRECATE_BEFORE_INITIALIZE` (no
4938
- * schema yet) or `DEPRECATE_UNKNOWN_KIND` (name not on the graph).
4939
- * @throws {StaleVersionError} when another writer has advanced the
4940
- * schema since this store was constructed; refetch and retry per
4941
- * the same recipe `evolve()` documents.
4942
- * @throws {SchemaContentConflictError} when a row already exists at
4943
- * the target version with a different content hash.
4944
- */
4945
- deprecateKinds(names: readonly string[], options?: Readonly<{
4946
- ref?: StoreRef<Store<G>>;
4947
- }>): Promise<Store<G>>;
4948
- /**
4949
- * Reverses `deprecateKinds(...)` for the named kinds. Same race +
4950
- * idempotency semantics: removing a name that isn't currently
4951
- * deprecated is a no-op for that name (the call as a whole is a
4952
- * no-op only if every name was already absent).
4953
- *
4954
- * @param names - Node or edge kind names to remove from the
4955
- * deprecated set.
4956
- * @param options.ref - Optional handle to be re-pointed atomically
4957
- * with the schema commit.
4958
- *
4959
- * @throws {ConfigurationError} on `DEPRECATE_BEFORE_INITIALIZE`.
4960
- * @throws {StaleVersionError} on a CAS race with another writer.
4961
- * @throws {SchemaContentConflictError} on a same-version content
4962
- * conflict.
4963
- */
4964
- undeprecateKinds(names: readonly string[], options?: Readonly<{
4965
- ref?: StoreRef<Store<G>>;
4966
- }>): Promise<Store<G>>;
4967
- /**
4968
- * Runs `CREATE INDEX` DDL for the indexes declared on this graph and
4969
- * records per-deployment status in `typegraph_index_materializations`.
4970
- * The status table is per-database (two replicas of the same
4971
- * `schema_doc` are still two different databases for DDL purposes),
4972
- * so the same call against two replicas materializes independently.
4973
- *
4974
- * Idempotent. Re-running the verb against an already-materialized
4975
- * index is a no-op (`status: "alreadyMaterialized"`). Postgres uses
4976
- * `CREATE INDEX CONCURRENTLY` so live tables never take an
4977
- * `AccessExclusiveLock`. SQLite is single-writer regardless.
4978
- *
4979
- * Best-effort by default: a failed index records `status: "failed"`
4980
- * with the error and the loop continues. Pass `{ stopOnError: true }`
4981
- * to halt on the first failure.
4982
- *
4983
- * @param options.kinds - Restrict to indexes whose `kind` is in this
4984
- * set. Throws `ConfigurationError` (`code:
4985
- * "MATERIALIZE_UNKNOWN_KIND"`) if any name doesn't match a known
4986
- * compile-time or extension kind.
4987
- * @param options.stopOnError - Halt on first failure. Default false.
4988
- *
4989
- * @throws {ConfigurationError} `MATERIALIZE_BACKEND_UNSUPPORTED` if
4990
- * the backend lacks `executeDdl`, `getIndexMaterialization`, or
4991
- * `recordIndexMaterialization`; `MATERIALIZE_UNKNOWN_KIND` for an
4992
- * unknown kind name; `MATERIALIZE_BEFORE_INITIALIZE` if the store
4993
- * has no schema yet.
4994
- */
4995
- materializeIndexes(options?: MaterializeIndexesOptions): Promise<MaterializeIndexesResult>;
4996
- /**
4997
- * Materializes TypeGraph's own base-relation indexes
4998
- * (`SYSTEM_INDEX_DECLARATIONS`) against the live database.
4999
- *
5000
- * Bootstrap DDL runs only on first boot, so a system index shipped in a
5001
- * newer library version never reaches an already-initialized database on
5002
- * its own. `createStoreWithSchema` runs this automatically; deployments
5003
- * that boot with plain `createStore` / `createVerifiedStore` (zero-DDL by
5004
- * contract) adopt new system indexes by calling this once under a role
5005
- * that may run DDL. Same status-table, drift-signature, and Postgres
5006
- * `CREATE INDEX CONCURRENTLY` claim semantics as `materializeIndexes`.
5007
- */
5008
- materializeSystemIndexes(options?: MaterializeSystemIndexesOptions): Promise<MaterializeIndexesResult>;
5009
- /**
5010
- * Recreate a vector field's per-field storage at its current declared
5011
- * dimension, then optionally re-embed existing rows.
5012
- *
5013
- * Use this after changing a field's `embedding(N)` to `embedding(M)` (e.g. a
5014
- * new embedding model): the stored N-dim vectors are invalid under the new
5015
- * dimension and must be recomputed, not converted. This drops and recreates
5016
- * the per-`(graphId, kind, field)` table at the new dimension — a brief
5017
- * window where the field returns no vector hits — resets its materialization
5018
- * marker, then, when `options.embed` is supplied, pages the kind's nodes,
5019
- * calls `embed(batch)`, and upserts the returned vectors. Without `embed`,
5020
- * storage is recreated empty and the caller re-embeds via normal
5021
- * `update()` / `upsertEmbedding` writes.
5022
- *
5023
- * @throws {ConfigurationError} when the backend has no vector strategy or
5024
- * cannot execute DDL, or `(kind, fieldPath)` is not a declared embedding.
5025
- */
5026
- reembedVectorField(kind: string, fieldPath: string, options?: ReembedVectorFieldOptions): Promise<ReembedVectorFieldResult>;
5027
- /**
5028
- * Removes extension kinds from the schema with cascading edge and
5029
- * ontology cleanup. Two-phase by design:
5030
- *
5031
- * 1. **Schema commit (this method).** Validates the removal,
5032
- * rebuilds the persisted extension without the named kinds
5033
- * (and without extension edges that lose their last endpoint),
5034
- * CAS-commits the new schema version, and queues
5035
- * per-deployment data-cleanup status. Millisecond budget.
5036
- * 2. **Data cleanup (`materializeRemovals`).** Deletes the orphan
5037
- * rows from the nodes/edges tables. Bounded by row count.
5038
- *
5039
- * Pass `{ eager: {} }` to run the data-cleanup pass inline with
5040
- * default options, or `{ eager: { ... } }` to scope it; otherwise
5041
- * call `materializeRemovals()` later.
5042
- *
5043
- * Idempotent: removing a name that doesn't exist is a no-op (no
5044
- * version bump). Removing an extension kind referenced by a compile-
5045
- * time edge or ontology relation throws `KindHasReferentsError`.
5046
- * Removing a compile-time kind throws `RemoveCompileTimeKindError` —
5047
- * compile-time kinds are removed by recompiling and redeploying.
5048
- *
5049
- * @throws {RemoveCompileTimeKindError} when `names` includes a
5050
- * compile-time kind.
5051
- * @throws {KindHasReferentsError} when an extension kind being
5052
- * removed is referenced by a compile-time declaration.
5053
- * @throws {StaleVersionError} on a CAS race with another writer.
5054
- * @throws {SchemaContentConflictError} on a same-version content
5055
- * conflict.
5056
- */
5057
- removeKinds(names: readonly string[], options?: Readonly<{
5058
- ref?: StoreRef<Store<G>>;
3987
+ }>) => Promise<TStore>;
3988
+ readonly deprecateKinds: <TRefStore extends StoreCore<G> = TStore>(names: readonly string[], options?: Readonly<{
3989
+ ref?: TStore extends TRefStore ? StoreRef<TRefStore> : never;
3990
+ }>) => Promise<TStore>;
3991
+ readonly undeprecateKinds: <TRefStore extends StoreCore<G> = TStore>(names: readonly string[], options?: Readonly<{
3992
+ ref?: TStore extends TRefStore ? StoreRef<TRefStore> : never;
3993
+ }>) => Promise<TStore>;
3994
+ readonly removeKinds: <TRefStore extends StoreCore<G> = TStore>(names: readonly string[], options?: Readonly<{
3995
+ ref?: TStore extends TRefStore ? StoreRef<TRefStore> : never;
5059
3996
  eager?: MaterializeRemovalsOptions;
5060
- }>): Promise<Store<G>>;
5061
- /**
5062
- * Runs the data-cleanup phase for any kinds removed via
5063
- * `removeKinds()` whose data has not yet been deleted on this
5064
- * deployment. Safe to call repeatedly; idempotent.
5065
- */
5066
- materializeRemovals(options?: MaterializeRemovalsOptions): Promise<MaterializeRemovalsResult>;
5067
- /**
5068
- * Closes the store and releases underlying resources.
5069
- *
5070
- * Note: When using the Drizzle adapter, this method does not close the database
5071
- * connection itself, as Drizzle delegates connection management to the user.
5072
- * You should close the underlying database connection (e.g., better-sqlite3 or pg pool)
5073
- * using their respective APIs.
5074
- */
5075
- close(): Promise<void>;
3997
+ }>) => Promise<TStore>;
5076
3998
  }
5077
- type HistorySafeBackend = Omit<GraphBackend, "executeStatement" | "executeDdl"> & Readonly<{
5078
- executeStatement?: never;
5079
- executeDdl?: never;
3999
+ /**
4000
+ * The default TypeGraph Store contract. It contains the complete graph API and
4001
+ * graph-owned transactions while keeping adapter-native handles, backend
4002
+ * internals, and caller-owned transaction adoption out of the public surface.
4003
+ */
4004
+ type Store<G extends GraphDef> = StoreCore<G> & StoreTransactions<G> & StoreEvolution<G, Store<G>>;
4005
+ /**
4006
+ * A Store with explicit adapter interoperability. Adapter entrypoints return
4007
+ * this surface so native transaction handles remain precisely typed without
4008
+ * leaking into the default Store contract.
4009
+ */
4010
+ type AdapterStore<G extends GraphDef, TNativeTransaction> = StoreCore<G> & StoreEvolution<G, AdapterStore<G, TNativeTransaction>> & AdapterStoreTransactions<G, TNativeTransaction> & Readonly<{
4011
+ backend: GraphBackend;
5080
4012
  }>;
5081
- type HistorySafeTransactionBackend = Omit<TransactionBackend, "executeStatement" | "executeDdl"> & Readonly<{
5082
- executeStatement?: never;
5083
- executeDdl?: never;
4013
+ type AdapterStoreTransactions<G extends GraphDef, TNativeTransaction> = Readonly<{
4014
+ transaction: <T>(fn: (tx: AdapterTransactionContext<G, TNativeTransaction>) => Promise<T>, options?: TransactionOptions) => Promise<T>;
4015
+ transactionWithReceipt: <T>(fn: (tx: MeasurableAdapterTransactionContext<G, TNativeTransaction>) => Promise<T>, options?: TransactionOptions) => Promise<TransactionOutcome<T>>;
4016
+ withTransaction: (externalTransaction: TNativeTransaction) => AdapterTransactionContext<G, TNativeTransaction>;
4017
+ withRecordedTransaction: <T>(externalTransaction: TNativeTransaction, fn: (tx: MeasurableAdapterTransactionContext<G, TNativeTransaction>) => Promise<T>) => Promise<TransactionOutcome<T>>;
5084
4018
  }>;
5085
- type HistoryTransactionContext<G extends GraphDef> = Omit<TransactionContext<G>, "backend" | "sql"> & Readonly<{
5086
- backend: HistorySafeTransactionBackend;
4019
+ type AdapterHistoryTransactionContext<G extends GraphDef, TNativeTransaction> = Omit<AdapterTransactionContext<G, TNativeTransaction>, "sql" | "sqlAvailability"> & Readonly<{
5087
4020
  sql?: never;
4021
+ sqlAvailability: "history";
5088
4022
  }>;
5089
4023
  /**
5090
- * The {@link HistoryTransactionContext} handed to a `withRecordedTransaction`
4024
+ * The {@link AdapterHistoryTransactionContext} handed to a `withRecordedTransaction`
5091
4025
  * callback, extended with {@link ScopedMeasure}. Its `measure` scopes to a child
5092
- * {@link MeasurableHistoryTransactionContext} (so nested scopes keep the
4026
+ * {@link MeasurableAdapterHistoryTransactionContext} (so nested scopes keep the
5093
4027
  * history-safe `sql?: never` / backend typing). Assignable to
5094
4028
  * {@link MeasurableTransactionContext} (and hence to {@link TransactionContext}),
5095
4029
  * so a projector helper typed against either still accepts it.
5096
4030
  */
5097
- type MeasurableHistoryTransactionContext<G extends GraphDef> = HistoryTransactionContext<G> & Readonly<{
5098
- measure: ScopedMeasure<MeasurableHistoryTransactionContext<G>>;
4031
+ type MeasurableAdapterHistoryTransactionContext<G extends GraphDef, TNativeTransaction> = AdapterHistoryTransactionContext<G, TNativeTransaction> & Readonly<{
4032
+ measure: ScopedMeasure<MeasurableAdapterHistoryTransactionContext<G, TNativeTransaction>>;
4033
+ }>;
4034
+ type AdapterRecordedReadStore<G extends GraphDef, TNativeTransaction> = StoreCore<G> & StoreEvolution<G, AdapterRecordedReadStore<G, TNativeTransaction>> & AdapterStoreTransactions<G, TNativeTransaction> & Readonly<{
4035
+ backend: GraphBackend;
4036
+ recordedReadBound: true;
5099
4037
  }>;
5100
- type RecordedReadStore<G extends GraphDef> = Store<G> & Readonly<{
4038
+ type RecordedReadStore<G extends GraphDef> = StoreCore<G> & StoreTransactions<G> & StoreEvolution<G, RecordedReadStore<G>> & Readonly<{
5101
4039
  recordedReadBound: true;
5102
4040
  }>;
5103
- type HistoryStore<G extends GraphDef> = Store<G> & Readonly<{
5104
- backend: HistorySafeBackend;
4041
+ type HistoryStore<G extends GraphDef> = StoreCore<G> & StoreTransactions<G> & StoreEvolution<G, HistoryStore<G>> & Readonly<{
5105
4042
  historyEnabled: true;
5106
4043
  recordedReadBound: true;
5107
4044
  }>;
5108
- /**
5109
- * The `externalTx` parameter type {@link Store.withTransaction} resolves to when
5110
- * called on a {@link HistoryStore}. A real {@link AdoptedTransaction} is not
5111
- * assignable to this string literal, so the call is a compile error whose
5112
- * message names the working alternative. `HistoryStore` cannot be excluded from
5113
- * the general signature by a `this` constraint alone — it is a subtype of
5114
- * `Store<G>` — so the block is expressed on the argument instead.
5115
- */
5116
- type HistoryWithTransactionUnavailable = "withTransaction() is unavailable on a history-enabled store — use store.withRecordedTransaction() so recorded-time capture can flush before the caller commits";
5117
- type ExplicitRecordedReadLiveOptions = LiveStoreOptions & Readonly<{
5118
- recordedRead: NonNullable<LiveStoreOptions["recordedRead"]>;
4045
+ type AdapterHistoryStore<G extends GraphDef, TNativeTransaction> = StoreCore<G> & StoreEvolution<G, AdapterHistoryStore<G, TNativeTransaction>> & AdapterHistoryStoreTransactions<G, TNativeTransaction> & Readonly<{
4046
+ backend: HistoryStoreBackend;
4047
+ historyEnabled: true;
4048
+ recordedReadBound: true;
4049
+ }>;
4050
+ type AdapterHistoryStoreTransactions<G extends GraphDef, TNativeTransaction> = Readonly<{
4051
+ transaction: <T>(fn: (tx: AdapterHistoryTransactionContext<G, TNativeTransaction>) => Promise<T>, options?: TransactionOptions) => Promise<T>;
4052
+ transactionWithReceipt: <T>(fn: (tx: MeasurableAdapterHistoryTransactionContext<G, TNativeTransaction>) => Promise<T>, options?: TransactionOptions) => Promise<TransactionOutcome<T>>;
4053
+ withRecordedTransaction: <T>(externalTransaction: TNativeTransaction, fn: (tx: MeasurableAdapterHistoryTransactionContext<G, TNativeTransaction>) => Promise<T>) => Promise<TransactionOutcome<T>>;
5119
4054
  }>;
5120
4055
  /**
5121
4056
  * Creates a new Store instance.
@@ -5147,8 +4082,15 @@ type ExplicitRecordedReadLiveOptions = LiveStoreOptions & Readonly<{
5147
4082
  * ```
5148
4083
  */
5149
4084
  declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions): HistoryStore<G>;
5150
- declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions): RecordedReadStore<G>;
5151
- declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions): Store<G>;
4085
+ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: RecordedReadStoreOptions): RecordedReadStore<G>;
4086
+ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: UnboundLiveStoreOptions): Store<G>;
4087
+ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: LiveStoreOptions | undefined): Store<G> | RecordedReadStore<G>;
4088
+ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: StoreOptions | undefined): Store<G> | HistoryStore<G> | RecordedReadStore<G>;
4089
+ declare function createAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: HistoryStoreOptions): AdapterHistoryStore<G, TNativeTransaction>;
4090
+ declare function createAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: RecordedReadStoreOptions): AdapterRecordedReadStore<G, TNativeTransaction>;
4091
+ declare function createAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options?: UnboundLiveStoreOptions): AdapterStore<G, TNativeTransaction>;
4092
+ declare function createAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: LiveStoreOptions | undefined): AdapterStore<G, TNativeTransaction> | AdapterRecordedReadStore<G, TNativeTransaction>;
4093
+ declare function createAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: StoreOptions | undefined): AdapterStore<G, TNativeTransaction> | AdapterHistoryStore<G, TNativeTransaction> | AdapterRecordedReadStore<G, TNativeTransaction>;
5152
4094
 
5153
4095
  /**
5154
4096
  * Creates a store and ensures the schema is initialized/migrated.
@@ -5179,8 +4121,30 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
5179
4121
  * ```
5180
4122
  */
5181
4123
  declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions & SchemaManagerOptions): Promise<[HistoryStore<G>, SchemaValidationResult]>;
5182
- declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions & SchemaManagerOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
5183
- declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
4124
+ declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: RecordedReadStoreOptions & SchemaManagerOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
4125
+ declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: UnboundLiveStoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
4126
+ declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: (LiveStoreOptions & SchemaManagerOptions) | undefined): Promise<[Store<G> | RecordedReadStore<G>, SchemaValidationResult]>;
4127
+ declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: (StoreOptions & SchemaManagerOptions) | undefined): Promise<[
4128
+ Store<G> | HistoryStore<G> | RecordedReadStore<G>,
4129
+ SchemaValidationResult
4130
+ ]>;
4131
+ declare function createAdapterStoreWithSchema<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: HistoryStoreOptions & SchemaManagerOptions): Promise<[
4132
+ AdapterHistoryStore<G, TNativeTransaction>,
4133
+ SchemaValidationResult
4134
+ ]>;
4135
+ declare function createAdapterStoreWithSchema<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: RecordedReadStoreOptions & SchemaManagerOptions): Promise<[
4136
+ AdapterRecordedReadStore<G, TNativeTransaction>,
4137
+ SchemaValidationResult
4138
+ ]>;
4139
+ declare function createAdapterStoreWithSchema<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options?: UnboundLiveStoreOptions & SchemaManagerOptions): Promise<[AdapterStore<G, TNativeTransaction>, SchemaValidationResult]>;
4140
+ declare function createAdapterStoreWithSchema<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: (LiveStoreOptions & SchemaManagerOptions) | undefined): Promise<[
4141
+ (AdapterStore<G, TNativeTransaction> | AdapterRecordedReadStore<G, TNativeTransaction>),
4142
+ SchemaValidationResult
4143
+ ]>;
4144
+ declare function createAdapterStoreWithSchema<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: (StoreOptions & SchemaManagerOptions) | undefined): Promise<[
4145
+ (AdapterStore<G, TNativeTransaction> | AdapterHistoryStore<G, TNativeTransaction> | AdapterRecordedReadStore<G, TNativeTransaction>),
4146
+ SchemaValidationResult
4147
+ ]>;
5184
4148
  /**
5185
4149
  * Creates a Store after **verifying** that the database is at the same
5186
4150
  * schema version as the code graph — without running any DDL, bootstrap,
@@ -5223,8 +4187,30 @@ declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: Gr
5223
4187
  * missing/stale/failed for this graph on this connection.
5224
4188
  */
5225
4189
  declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions): Promise<[HistoryStore<G>, SchemaValidationResult]>;
5226
- declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
5227
- declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions): Promise<[Store<G>, SchemaValidationResult]>;
4190
+ declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: RecordedReadStoreOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
4191
+ declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: UnboundLiveStoreOptions): Promise<[Store<G>, SchemaValidationResult]>;
4192
+ declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: LiveStoreOptions | undefined): Promise<[Store<G> | RecordedReadStore<G>, SchemaValidationResult]>;
4193
+ declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: StoreOptions | undefined): Promise<[
4194
+ Store<G> | HistoryStore<G> | RecordedReadStore<G>,
4195
+ SchemaValidationResult
4196
+ ]>;
4197
+ declare function createVerifiedAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: HistoryStoreOptions): Promise<[
4198
+ AdapterHistoryStore<G, TNativeTransaction>,
4199
+ SchemaValidationResult
4200
+ ]>;
4201
+ declare function createVerifiedAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: RecordedReadStoreOptions): Promise<[
4202
+ AdapterRecordedReadStore<G, TNativeTransaction>,
4203
+ SchemaValidationResult
4204
+ ]>;
4205
+ declare function createVerifiedAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options?: UnboundLiveStoreOptions): Promise<[AdapterStore<G, TNativeTransaction>, SchemaValidationResult]>;
4206
+ declare function createVerifiedAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: LiveStoreOptions | undefined): Promise<[
4207
+ (AdapterStore<G, TNativeTransaction> | AdapterRecordedReadStore<G, TNativeTransaction>),
4208
+ SchemaValidationResult
4209
+ ]>;
4210
+ declare function createVerifiedAdapterStore<G extends GraphDef, TNativeTransaction>(graph: G, backend: AdapterBackend<TNativeTransaction>, options: StoreOptions | undefined): Promise<[
4211
+ (AdapterStore<G, TNativeTransaction> | AdapterHistoryStore<G, TNativeTransaction> | AdapterRecordedReadStore<G, TNativeTransaction>),
4212
+ SchemaValidationResult
4213
+ ]>;
5228
4214
 
5229
4215
  /**
5230
4216
  * StoreView — a read-only `(mode, asOf)` lens over a {@link Store}.
@@ -5284,6 +4270,12 @@ type StoreViewNeighborsOptions<G extends GraphDef> = Omit<NeighborsOptions<G>, k
5284
4270
  type StoreViewDegreeOptions<G extends GraphDef> = Omit<DegreeOptions<G>, keyof TemporalAlgorithmOptions>;
5285
4271
  /** WCC options with the temporal axis removed (the view's pin supplies it). */
5286
4272
  type StoreViewWeaklyConnectedComponentsOptions<G extends GraphDef> = Omit<WeaklyConnectedComponentsOptions<G>, keyof TemporalAlgorithmOptions>;
4273
+ /** Label-propagation options pinned to the view's temporal coordinate. */
4274
+ type StoreViewLabelPropagationOptions<G extends GraphDef> = Omit<LabelPropagationOptions<G>, keyof TemporalAlgorithmOptions>;
4275
+ /** PageRank options with the temporal axis removed (the view supplies it). */
4276
+ type StoreViewPageRankOptions<G extends GraphDef> = Omit<PageRankOptions<G>, keyof TemporalAlgorithmOptions>;
4277
+ /** Personalized PageRank options pinned to the view's temporal coordinate. */
4278
+ type StoreViewPersonalizedPageRankOptions<G extends GraphDef> = Omit<PersonalizedPageRankOptions<G>, keyof TemporalAlgorithmOptions>;
5287
4279
  /** Graph-algorithm facade sealed to a {@link StoreView}'s coordinate. */
5288
4280
  type StoreViewGraphAlgorithms<G extends GraphDef> = Readonly<{
5289
4281
  shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: StoreViewShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
@@ -5292,7 +4284,10 @@ type StoreViewGraphAlgorithms<G extends GraphDef> = Readonly<{
5292
4284
  canReach: (from: NodeIdentifier, to: NodeIdentifier, options: StoreViewCanReachOptions<G>) => Promise<boolean>;
5293
4285
  neighbors: (node: NodeIdentifier, options: StoreViewNeighborsOptions<G>) => Promise<readonly ReachableNode[]>;
5294
4286
  degree: (node: NodeIdentifier, options?: StoreViewDegreeOptions<G>) => Promise<number>;
4287
+ labelPropagation: (options: StoreViewLabelPropagationOptions<G>) => Promise<readonly LabelPropagationMembership[]>;
5295
4288
  weaklyConnectedComponents: (options: StoreViewWeaklyConnectedComponentsOptions<G>) => Promise<readonly WeaklyConnectedComponentMembership[]>;
4289
+ pageRank: (options: StoreViewPageRankOptions<G>) => Promise<readonly PageRankScore[]>;
4290
+ personalizedPageRank: (options: StoreViewPersonalizedPageRankOptions<G>) => Promise<readonly PageRankScore[]>;
5296
4291
  }>;
5297
4292
  /**
5298
4293
  * Shared base for the read-only views. Holds the pinned {@link ReadCoordinate}
@@ -5334,8 +4329,14 @@ declare abstract class CoordinatePinnedView<G extends GraphDef> {
5334
4329
  neighbors(node: NodeIdentifier, options: StoreViewNeighborsOptions<G>): Promise<readonly ReachableNode[]>;
5335
4330
  /** Counts active edges incident to `node` at this view's pinned coordinate. */
5336
4331
  degree(node: NodeIdentifier, options?: StoreViewDegreeOptions<G>): Promise<number>;
4332
+ /** Deterministic label-propagation memberships at this view's coordinate. */
4333
+ labelPropagation(options: StoreViewLabelPropagationOptions<G>): Promise<readonly LabelPropagationMembership[]>;
5337
4334
  /** Exact WCC memberships at this view's pinned coordinate. */
5338
4335
  weaklyConnectedComponents(options: StoreViewWeaklyConnectedComponentsOptions<G>): Promise<readonly WeaklyConnectedComponentMembership[]>;
4336
+ /** Global PageRank scores at this view's pinned coordinate. */
4337
+ pageRank(options: StoreViewPageRankOptions<G>): Promise<readonly PageRankScore[]>;
4338
+ /** Personalized PageRank scores at this view's pinned coordinate. */
4339
+ personalizedPageRank(options: StoreViewPersonalizedPageRankOptions<G>): Promise<readonly PageRankScore[]>;
5339
4340
  }
5340
4341
  /**
5341
4342
  * A read-only `(mode, asOf)` lens over a {@link Store}. Construct one via
@@ -5387,4 +4388,4 @@ declare class RecordedStoreView<G extends GraphDef> extends CoordinatePinnedView
5387
4388
  get edges(): RecordedStoreViewEdgeCollections<G>;
5388
4389
  }
5389
4390
 
5390
- export { type GetOrCreateAction as $, type AliasMap as A, type BaseTraversalOptions as B, type ConstraintNames as C, DEFAULT_SEARCHABLE_LANGUAGE as D, type EmbeddingMetric as E, type EdgeFindByEndpointsOptions as F, type EdgeGetOrCreateByEndpointsOptions as G, type HistoryStore as H, type EdgeGetOrCreateByEndpointsResult as I, type EdgeIntrospection as J, type EdgeTemporalReads as K, type EdgeWrites as L, type EmbeddingSchema as M, type Node as N, type EmbeddingValue as O, type EmptyAliasMap as P, type QueryCoordinateState as Q, type RecursiveAliasMap as R, Store as S, TraversalBuilder as T, type UniqueIntrospection as U, type EmptyEdgeAliasMap as V, ExecutableAggregateQuery as W, ExecutableQuery as X, type FieldAccessor as Y, type FulltextSearchHit as Z, type FulltextSearchOptions as _, type EmbeddingIndexType as a, type SearchScopeOptions as a$, type GraphAlgorithms as a0, type GraphEdgeCollections as a1, type GraphNodeCollections as a2, type HistorySafeBackend as a3, type HistorySafeTransactionBackend as a4, type HistoryStoreOptions as a5, type HistoryTransactionContext as a6, type HistoryWithTransactionUnavailable as a7, type HookContext as a8, type HybridFulltextOptions as a9, type OperationHookContext as aA, type PaginateOptions as aB, type PaginatedResult as aC, type PathNode as aD, type Predicate as aE, PreparedQuery as aF, type PropsAccessor as aG, type QueryHookContext as aH, type QueryOptions as aI, type ReachableNode as aJ, type ReachableOptions as aK, type RebuildFulltextOptions as aL, type RebuildFulltextResult as aM, type ReclaimedVectorFieldEntry as aN, type RecordedInstant as aO, type RecordedReadStore as aP, RecordedStoreView as aQ, type RecordedStoreViewEdgeCollection as aR, type RecordedStoreViewEdgeCollections as aS, type RecordedStoreViewNodeCollection as aT, type RecordedStoreViewNodeCollections as aU, type RecursiveTraversalOptions as aV, type ReembedFunction as aW, type ReembedVectorFieldOptions as aX, type ReembedVectorFieldResult as aY, type SchemaIntrospection as aZ, type ScopedMeasure as a_, type HybridSearchHit as aa, type HybridSearchOptions as ab, type HybridVectorOptions as ac, type IfExistsMode as ad, type InitialQueryBuilder as ae, type KindIntrospection as af, type LiveStoreOptions as ag, type MaterializeRemovalsEntry as ah, type MaterializeRemovalsOptions as ai, type MaterializeRemovalsResult as aj, type MeasurableHistoryTransactionContext as ak, type MeasurableTransactionContext as al, type NeighborsOptions as am, type NoRecordedCoordinate as an, type NodeAccessor as ao, type NodeAlias as ap, type NodeBulkFindByIndexOptions as aq, type NodeCollection as ar, type NodeCurrentReads as as, type NodeGetOrCreateByConstraintOptions as at, type NodeGetOrCreateByConstraintResult as au, type NodeIdentifier as av, type NodeRef as aw, type NodeTemporalReads as ax, type NodeWrites as ay, type OntologyIntrospection as az, type EdgeAliasMap as b, getSearchableMetadata as b$, type SearchableMetadata as b0, type SearchableOptions as b1, type SearchableSchema as b2, type SelectContext as b3, type SelectableEdge as b4, type SelectableNode as b5, type ShortestPathOptions as b6, type ShortestPathResult as b7, type SqlAvailability as b8, type StoreHooks as b9, type TemporalAlgorithmOptions as bA, type TransactionContext as bB, type TransactionOutcome as bC, type TransactionReceipt as bD, type TraversalDirection as bE, type TypedEdgeCollection as bF, type TypedRecordedStoreViewEdgeCollection as bG, type TypedStoreViewEdgeCollection as bH, UnionableQuery as bI, type UpdateEdgeInput as bJ, type UpdateNodeInput as bK, type VectorSearchHit as bL, type VectorSearchOptions as bM, type WeaklyConnectedComponentMembership as bN, type WeaklyConnectedComponentsOptions as bO, type WeightedShortestPathOptions as bP, type WeightedShortestPathResult as bQ, asRecordedInstant as bR, createQueryBuilder as bS, createStore as bT, createStoreWithSchema as bU, createVerifiedStore as bV, defineSubgraphProject as bW, embedding as bX, exists as bY, fieldRef as bZ, getEmbeddingDimensions as b_, type StoreOptions as ba, type StoreProjection as bb, type StoreRef as bc, StoreSearch as bd, StoreView as be, type StoreViewCanReachOptions as bf, type StoreViewCoordinate as bg, type StoreViewDegreeOptions as bh, type StoreViewEdgeCollection as bi, type StoreViewEdgeCollections as bj, type StoreViewGraphAlgorithms as bk, type StoreViewNeighborsOptions as bl, type StoreViewNodeCollection as bm, type StoreViewNodeCollections as bn, type StoreViewReachableOptions as bo, type StoreViewShortestPathOptions as bp, type StoreViewSubgraphOptions as bq, type StoreViewWeaklyConnectedComponentsOptions as br, type StoreViewWeightedShortestPathOptions as bs, type StreamOptions as bt, type SubgraphEdgeResult as bu, type SubgraphNodeResult as bv, type SubgraphOptions as bw, type SubgraphResult as bx, type SubsetEdge as by, type SubsetNode as bz, QueryBuilder as c, inSubquery as c0, isEmbeddingSchema as c1, isParameterRef as c2, isSearchableSchema as c3, notExists as c4, notInSubquery as c5, param as c6, resolveGraphVectorSlots as c7, searchable as c8, type EmptyRecursiveAliasMap as d, type AggregateResult as e, type AlgorithmCyclePolicy as f, type AnyEdge as g, type AnyNode as h, type BatchResults as i, type BatchableQuery as j, type CreateEdgeInput as k, type CreateNodeInput as l, type DegreeOptions as m, type DynamicEdgeAccessor as n, type DynamicEdgeCollection as o, type DynamicEdgeType as p, type DynamicFieldBuilder as q, type DynamicNodeAccessor as r, type DynamicNodeCollection as s, type DynamicNodeType as t, type DynamicSelectableEdge as u, type DynamicSelectableNode as v, type Edge as w, type EdgeAccessor as x, type EdgeBatchReads as y, type EdgeCollection as z };
4391
+ export { ExecutableAggregateQuery as $, type AliasMap as A, type BaseStoreOptions as B, type ConstraintNames as C, type DegreeOptions as D, type EdgeAliasMap as E, type DynamicNodeType as F, type DynamicSelectableEdge as G, type HistoryStoreOptions as H, type DynamicSelectableNode as I, type Edge as J, type EdgeAccessor as K, type LiveStoreOptions as L, type EdgeBatchReads as M, type EdgeCollection as N, type EdgeFindByEndpointsOptions as O, type EdgeGetOrCreateByEndpointsOptions as P, type QueryCoordinateState as Q, type RecordedReadStoreOptions as R, type StoreOptions as S, TraversalBuilder as T, type UnboundLiveStoreOptions as U, type EdgeGetOrCreateByEndpointsResult as V, type EdgeIntrospection as W, type EdgeTemporalReads as X, type EdgeWrites as Y, type EmptyAliasMap as Z, type EmptyEdgeAliasMap as _, type Store as a, type RecursiveTraversalOptions as a$, ExecutableQuery as a0, type FieldAccessor as a1, type FulltextSearchHit as a2, type FulltextSearchOptions as a3, type GetOrCreateAction as a4, type GraphAlgorithms as a5, type GraphEdgeCollections as a6, type GraphNodeCollections as a7, type HistoryStoreBackend as a8, type HookContext as a9, type NodeRef as aA, type NodeTemporalReads as aB, type NodeWrites as aC, type OntologyIntrospection as aD, type OperationHookContext as aE, type PageRankOptions as aF, type PageRankScore as aG, type PaginateOptions as aH, type PaginatedResult as aI, type PathNode as aJ, type PersonalizedPageRankOptions as aK, type PersonalizedPageRankSeed as aL, type Predicate as aM, PreparedQuery as aN, type PropsAccessor as aO, type QueryHookContext as aP, type QueryOptions as aQ, type ReachableNode as aR, type ReachableOptions as aS, type RebuildFulltextOptions as aT, type RebuildFulltextResult as aU, type ReclaimedVectorFieldEntry as aV, RecordedStoreView as aW, type RecordedStoreViewEdgeCollection as aX, type RecordedStoreViewEdgeCollections as aY, type RecordedStoreViewNodeCollection as aZ, type RecordedStoreViewNodeCollections as a_, type HybridFulltextOptions as aa, type HybridSearchHit as ab, type HybridSearchOptions as ac, type HybridVectorOptions as ad, type IfExistsMode as ae, type InitialQueryBuilder as af, type KindIntrospection as ag, type LabelPropagationMembership as ah, type LabelPropagationOptions as ai, type MaterializeRemovalsEntry as aj, type MaterializeRemovalsOptions as ak, type MaterializeRemovalsResult as al, type MeasurableAdapterHistoryTransactionContext as am, type MeasurableAdapterTransactionContext as an, type MeasurableTransactionContext as ao, type NeighborsOptions as ap, type NoRecordedCoordinate as aq, type Node as ar, type NodeAccessor as as, type NodeAlias as at, type NodeBulkFindByIndexOptions as au, type NodeCollection as av, type NodeCurrentReads as aw, type NodeGetOrCreateByConstraintOptions as ax, type NodeGetOrCreateByConstraintResult as ay, type NodeIdentifier as az, type HistoryStore as b, createStoreWithSchema as b$, type ReembedFunction as b0, type ReembedVectorFieldOptions as b1, type ReembedVectorFieldResult as b2, type SchemaIntrospection as b3, type ScopedMeasure as b4, type SearchScopeOptions as b5, type SelectContext as b6, type SelectableEdge as b7, type SelectableNode as b8, type ShortestPathOptions as b9, type SubgraphNodeResult as bA, type SubgraphOptions as bB, type SubgraphResult as bC, type SubsetEdge as bD, type SubsetNode as bE, type TemporalAlgorithmOptions as bF, type TransactionContext as bG, type TransactionOutcome as bH, type TransactionReceipt as bI, type TraversalDirection as bJ, type TypedEdgeCollection as bK, type TypedRecordedStoreViewEdgeCollection as bL, type TypedStoreViewEdgeCollection as bM, UnionableQuery as bN, type UniqueIntrospection as bO, type UpdateEdgeInput as bP, type UpdateNodeInput as bQ, type VectorSearchHit as bR, type VectorSearchOptions as bS, type WeaklyConnectedComponentMembership as bT, type WeaklyConnectedComponentsOptions as bU, type WeightedShortestPathOptions as bV, type WeightedShortestPathResult as bW, createAdapterStore as bX, createAdapterStoreWithSchema as bY, createQueryBuilder as bZ, createStore as b_, type ShortestPathResult as ba, type SqlAvailability as bb, type StoreHooks as bc, type StoreProjection as bd, type StoreRef as be, StoreSearch as bf, StoreView as bg, type StoreViewCanReachOptions as bh, type StoreViewCoordinate as bi, type StoreViewDegreeOptions as bj, type StoreViewEdgeCollection as bk, type StoreViewEdgeCollections as bl, type StoreViewGraphAlgorithms as bm, type StoreViewLabelPropagationOptions as bn, type StoreViewNeighborsOptions as bo, type StoreViewNodeCollection as bp, type StoreViewNodeCollections as bq, type StoreViewPageRankOptions as br, type StoreViewPersonalizedPageRankOptions as bs, type StoreViewReachableOptions as bt, type StoreViewShortestPathOptions as bu, type StoreViewSubgraphOptions as bv, type StoreViewWeaklyConnectedComponentsOptions as bw, type StoreViewWeightedShortestPathOptions as bx, type StreamOptions as by, type SubgraphEdgeResult as bz, type RecordedReadStore as c, createVerifiedAdapterStore as c0, createVerifiedStore as c1, defineSubgraphProject as c2, exists as c3, fieldRef as c4, inSubquery as c5, isParameterRef as c6, notExists as c7, notInSubquery as c8, param as c9, type RecursiveAliasMap as d, QueryBuilder as e, type EmptyRecursiveAliasMap as f, type AdapterHistoryStore as g, type AdapterHistoryTransactionContext as h, type AdapterRecordedReadStore as i, type AdapterStore as j, type AdapterTransactionContext as k, type AggregateResult as l, type AlgorithmCyclePolicy as m, type AnyEdge as n, type AnyNode as o, type BaseTraversalOptions as p, type BatchResults as q, type BatchableQuery as r, type CreateEdgeInput as s, type CreateNodeInput as t, type DynamicEdgeAccessor as u, type DynamicEdgeCollection as v, type DynamicEdgeType as w, type DynamicFieldBuilder as x, type DynamicNodeAccessor as y, type DynamicNodeCollection as z };