@nicia-ai/typegraph 0.33.0 → 0.35.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 (284) hide show
  1. package/README.md +20 -0
  2. package/dist/backend/postgres/index.cjs +30 -26
  3. package/dist/backend/postgres/index.d.cts +39 -7
  4. package/dist/backend/postgres/index.d.ts +39 -7
  5. package/dist/backend/postgres/index.js +17 -13
  6. package/dist/backend/postgres/pglite.cjs +22 -18
  7. package/dist/backend/postgres/pglite.cjs.map +1 -1
  8. package/dist/backend/postgres/pglite.d.cts +4 -4
  9. package/dist/backend/postgres/pglite.d.ts +4 -4
  10. package/dist/backend/postgres/pglite.js +17 -13
  11. package/dist/backend/postgres/pglite.js.map +1 -1
  12. package/dist/backend/sqlite/index.cjs +26 -23
  13. package/dist/backend/sqlite/index.d.cts +8 -8
  14. package/dist/backend/sqlite/index.d.ts +8 -8
  15. package/dist/backend/sqlite/index.js +14 -11
  16. package/dist/backend/sqlite/libsql.cjs +21 -17
  17. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  18. package/dist/backend/sqlite/libsql.d.cts +13 -6
  19. package/dist/backend/sqlite/libsql.d.ts +13 -6
  20. package/dist/backend/sqlite/libsql.js +17 -13
  21. package/dist/backend/sqlite/libsql.js.map +1 -1
  22. package/dist/backend/sqlite/local.cjs +102 -18
  23. package/dist/backend/sqlite/local.cjs.map +1 -1
  24. package/dist/backend/sqlite/local.d.cts +95 -5
  25. package/dist/backend/sqlite/local.d.ts +95 -5
  26. package/dist/backend/sqlite/local.js +96 -13
  27. package/dist/backend/sqlite/local.js.map +1 -1
  28. package/dist/{chunk-JHOBXD7O.js → chunk-3TWF3SH4.js} +332 -64
  29. package/dist/chunk-3TWF3SH4.js.map +1 -0
  30. package/dist/chunk-4JEZZJ6S.cjs +1271 -0
  31. package/dist/chunk-4JEZZJ6S.cjs.map +1 -0
  32. package/dist/{chunk-I4W7MKVG.cjs → chunk-4TOD4LBZ.cjs} +249 -294
  33. package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
  34. package/dist/chunk-55MZDDZV.js +239 -0
  35. package/dist/chunk-55MZDDZV.js.map +1 -0
  36. package/dist/{chunk-LM2IC4ZJ.cjs → chunk-5A6FNS6N.cjs} +75 -19
  37. package/dist/chunk-5A6FNS6N.cjs.map +1 -0
  38. package/dist/{chunk-FDN43KXV.cjs → chunk-5AQIKK56.cjs} +65 -24
  39. package/dist/chunk-5AQIKK56.cjs.map +1 -0
  40. package/dist/{chunk-IZ4PCL47.js → chunk-5SEGFTZX.js} +4 -66
  41. package/dist/chunk-5SEGFTZX.js.map +1 -0
  42. package/dist/{chunk-CWFPJ3RC.js → chunk-6FR2MMS6.js} +7 -7
  43. package/dist/chunk-6FR2MMS6.js.map +1 -0
  44. package/dist/chunk-7YSP4V4R.cjs +69 -0
  45. package/dist/chunk-7YSP4V4R.cjs.map +1 -0
  46. package/dist/chunk-A42GCBGX.cjs +28 -0
  47. package/dist/chunk-A42GCBGX.cjs.map +1 -0
  48. package/dist/chunk-ACSVZPK7.cjs +21 -0
  49. package/dist/chunk-ACSVZPK7.cjs.map +1 -0
  50. package/dist/{chunk-OIE2UPVG.cjs → chunk-BLZDPRXT.cjs} +52 -21
  51. package/dist/chunk-BLZDPRXT.cjs.map +1 -0
  52. package/dist/chunk-BYPOGQWK.js +25 -0
  53. package/dist/chunk-BYPOGQWK.js.map +1 -0
  54. package/dist/{chunk-NG5N7R45.cjs → chunk-CK5BVQOW.cjs} +325 -213
  55. package/dist/chunk-CK5BVQOW.cjs.map +1 -0
  56. package/dist/chunk-CTTSDJLY.cjs +261 -0
  57. package/dist/chunk-CTTSDJLY.cjs.map +1 -0
  58. package/dist/chunk-CUHM5CWJ.cjs +12 -0
  59. package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
  60. package/dist/chunk-CZQ3FO2Q.js +2320 -0
  61. package/dist/chunk-CZQ3FO2Q.js.map +1 -0
  62. package/dist/{chunk-CFNT3ITG.cjs → chunk-D7ZEOS56.cjs} +25 -52
  63. package/dist/chunk-D7ZEOS56.cjs.map +1 -0
  64. package/dist/chunk-DFVLCOP6.js +10 -0
  65. package/dist/chunk-DFVLCOP6.js.map +1 -0
  66. package/dist/chunk-DI74SMXS.cjs +29 -0
  67. package/dist/chunk-DI74SMXS.cjs.map +1 -0
  68. package/dist/{chunk-KY5SDVA7.cjs → chunk-EM3CWPND.cjs} +442 -113
  69. package/dist/chunk-EM3CWPND.cjs.map +1 -0
  70. package/dist/chunk-EMF62TZG.cjs +1176 -0
  71. package/dist/chunk-EMF62TZG.cjs.map +1 -0
  72. package/dist/chunk-EOLERH7Y.cjs +40 -0
  73. package/dist/chunk-EOLERH7Y.cjs.map +1 -0
  74. package/dist/{chunk-3QRBXYT5.cjs → chunk-FACJJWGF.cjs} +24 -6
  75. package/dist/chunk-FACJJWGF.cjs.map +1 -0
  76. package/dist/{chunk-KTIEB7VH.cjs → chunk-FL472AMI.cjs} +49 -165
  77. package/dist/chunk-FL472AMI.cjs.map +1 -0
  78. package/dist/{chunk-4RBAJVEC.cjs → chunk-FN35DLCN.cjs} +31 -9
  79. package/dist/chunk-FN35DLCN.cjs.map +1 -0
  80. package/dist/{chunk-C4C4Q7A6.js → chunk-FPIZFYHE.js} +12 -35
  81. package/dist/chunk-FPIZFYHE.js.map +1 -0
  82. package/dist/{chunk-XKNAK27R.js → chunk-FRV5Q5IO.js} +64 -8
  83. package/dist/chunk-FRV5Q5IO.js.map +1 -0
  84. package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
  85. package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
  86. package/dist/chunk-GSQ6NPH6.cjs +100 -0
  87. package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
  88. package/dist/chunk-GUR2FNB5.cjs +12 -0
  89. package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
  90. package/dist/{chunk-ZFWNO3GE.cjs → chunk-H7YNSMA7.cjs} +107 -2
  91. package/dist/chunk-H7YNSMA7.cjs.map +1 -0
  92. package/dist/{chunk-GYVBEZAO.js → chunk-I7ZUZKFD.js} +47 -19
  93. package/dist/chunk-I7ZUZKFD.js.map +1 -0
  94. package/dist/chunk-ITE4IXAK.js +25 -0
  95. package/dist/chunk-ITE4IXAK.js.map +1 -0
  96. package/dist/{chunk-D3EWZ67S.cjs → chunk-J7WFGBJR.cjs} +3372 -4970
  97. package/dist/chunk-J7WFGBJR.cjs.map +1 -0
  98. package/dist/{chunk-PYD3UCDU.js → chunk-JBTOYDMN.js} +202 -251
  99. package/dist/chunk-JBTOYDMN.js.map +1 -0
  100. package/dist/{chunk-XVUJY72M.js → chunk-K3PPLHY7.js} +234 -118
  101. package/dist/chunk-K3PPLHY7.js.map +1 -0
  102. package/dist/{chunk-454I6GDF.js → chunk-KBGQIPRQ.js} +102 -3
  103. package/dist/chunk-KBGQIPRQ.js.map +1 -0
  104. package/dist/chunk-KMI7LYAF.js +1252 -0
  105. package/dist/chunk-KMI7LYAF.js.map +1 -0
  106. package/dist/{chunk-JIEJCTDS.cjs → chunk-LGEALRC6.cjs} +21 -4
  107. package/dist/chunk-LGEALRC6.cjs.map +1 -0
  108. package/dist/{chunk-TQOYM4LN.js → chunk-MP2JQKSG.js} +21 -5
  109. package/dist/chunk-MP2JQKSG.js.map +1 -0
  110. package/dist/{chunk-3642VBVC.cjs → chunk-O7UN7OXA.cjs} +389 -121
  111. package/dist/chunk-O7UN7OXA.cjs.map +1 -0
  112. package/dist/chunk-OHMP6N2J.js +47 -0
  113. package/dist/chunk-OHMP6N2J.js.map +1 -0
  114. package/dist/{chunk-6NRFUHMS.js → chunk-OR5ZA5WP.js} +135 -24
  115. package/dist/chunk-OR5ZA5WP.js.map +1 -0
  116. package/dist/{chunk-PRMKPFN5.js → chunk-Q5TEXCTB.js} +61 -6
  117. package/dist/chunk-Q5TEXCTB.js.map +1 -0
  118. package/dist/chunk-QNKSQTKQ.js +1312 -0
  119. package/dist/chunk-QNKSQTKQ.js.map +1 -0
  120. package/dist/{chunk-YCV72E6L.js → chunk-QOTI55H7.js} +7 -116
  121. package/dist/chunk-QOTI55H7.js.map +1 -0
  122. package/dist/{chunk-QBYTJSAY.js → chunk-QWEUYILR.js} +99 -34
  123. package/dist/chunk-QWEUYILR.js.map +1 -0
  124. package/dist/{chunk-OS6KS3HV.js → chunk-RGP33ZJ5.js} +485 -82
  125. package/dist/chunk-RGP33ZJ5.js.map +1 -0
  126. package/dist/chunk-RGPG7EOJ.js +94 -0
  127. package/dist/chunk-RGPG7EOJ.js.map +1 -0
  128. package/dist/{chunk-WWVV44DY.cjs → chunk-S55OV6PW.cjs} +15 -15
  129. package/dist/chunk-S55OV6PW.cjs.map +1 -0
  130. package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
  131. package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
  132. package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
  133. package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
  134. package/dist/{chunk-CEF2QOTO.js → chunk-T2WUSPDA.js} +49 -8
  135. package/dist/chunk-T2WUSPDA.js.map +1 -0
  136. package/dist/{chunk-YW7GHMF4.cjs → chunk-TCOCYN2P.cjs} +75 -20
  137. package/dist/chunk-TCOCYN2P.cjs.map +1 -0
  138. package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
  139. package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
  140. package/dist/chunk-TEDRJXOG.cjs +32 -0
  141. package/dist/chunk-TEDRJXOG.cjs.map +1 -0
  142. package/dist/{chunk-WLP6TKFB.js → chunk-UES55P7G.js} +2809 -4398
  143. package/dist/chunk-UES55P7G.js.map +1 -0
  144. package/dist/{chunk-EF3Z645U.cjs → chunk-UMDVATGY.cjs} +6 -72
  145. package/dist/chunk-UMDVATGY.cjs.map +1 -0
  146. package/dist/chunk-UR7W5YQK.js +18 -0
  147. package/dist/chunk-UR7W5YQK.js.map +1 -0
  148. package/dist/chunk-UT3S4SEN.js +31 -0
  149. package/dist/chunk-UT3S4SEN.js.map +1 -0
  150. package/dist/{chunk-3IR2GEMJ.cjs → chunk-UUT7UN2N.cjs} +149 -38
  151. package/dist/chunk-UUT7UN2N.cjs.map +1 -0
  152. package/dist/{chunk-PIHXFF73.js → chunk-UZV3AZKF.js} +21 -3
  153. package/dist/chunk-UZV3AZKF.js.map +1 -0
  154. package/dist/{chunk-DJYRRDHA.js → chunk-VHMPG6UL.js} +29 -7
  155. package/dist/chunk-VHMPG6UL.js.map +1 -0
  156. package/dist/{chunk-MBLXCV2Y.cjs → chunk-VPYHY3LJ.cjs} +111 -43
  157. package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
  158. package/dist/{chunk-WYTUF3QO.js → chunk-VSPCZAXF.js} +3 -3
  159. package/dist/{chunk-WYTUF3QO.js.map → chunk-VSPCZAXF.js.map} +1 -1
  160. package/dist/chunk-W63OVYY4.js +29 -0
  161. package/dist/chunk-W63OVYY4.js.map +1 -0
  162. package/dist/{chunk-UPDMJEW6.js → chunk-WDBCBWC4.js} +356 -30
  163. package/dist/chunk-WDBCBWC4.js.map +1 -0
  164. package/dist/chunk-WJT7OU7E.cjs +1334 -0
  165. package/dist/chunk-WJT7OU7E.cjs.map +1 -0
  166. package/dist/chunk-XOX22WHL.cjs +2383 -0
  167. package/dist/chunk-XOX22WHL.cjs.map +1 -0
  168. package/dist/{ddl-CVnHJcar.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
  169. package/dist/{ddl-Dxt_fBHr.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
  170. package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
  171. package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
  172. package/dist/{types-DGylBhWo.d.ts → fulltext-strategy-B57yvC5Q.d.ts} +2558 -2125
  173. package/dist/{types-C_UnQOQp.d.cts → fulltext-strategy-CDkSSYhq.d.cts} +2558 -2125
  174. package/dist/graph-extension/index.cjs +21 -19
  175. package/dist/graph-extension/index.d.cts +4 -4
  176. package/dist/graph-extension/index.d.ts +4 -4
  177. package/dist/graph-extension/index.js +6 -4
  178. package/dist/graph-merge/index.cjs +408 -169
  179. package/dist/graph-merge/index.cjs.map +1 -1
  180. package/dist/graph-merge/index.d.cts +63 -33
  181. package/dist/graph-merge/index.d.ts +63 -33
  182. package/dist/graph-merge/index.js +286 -47
  183. package/dist/graph-merge/index.js.map +1 -1
  184. package/dist/{index-DGX6D9j1.d.ts → index-6CSUAq-x.d.ts} +234 -93
  185. package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
  186. package/dist/index.cjs +240 -211
  187. package/dist/index.cjs.map +1 -1
  188. package/dist/index.d.cts +11 -11
  189. package/dist/index.d.ts +11 -11
  190. package/dist/index.js +35 -27
  191. package/dist/index.js.map +1 -1
  192. package/dist/indexes/index.cjs +28 -27
  193. package/dist/indexes/index.d.cts +5 -5
  194. package/dist/indexes/index.d.ts +5 -5
  195. package/dist/indexes/index.js +10 -9
  196. package/dist/interchange/index.cjs +47 -17
  197. package/dist/interchange/index.d.cts +126 -12
  198. package/dist/interchange/index.d.ts +126 -12
  199. package/dist/interchange/index.js +14 -4
  200. package/dist/{manager-BYl_zyZR.d.cts → manager-DwQi8eV0.d.cts} +9 -2
  201. package/dist/{manager-C0_r0ALf.d.ts → manager-ejUCB52T.d.ts} +9 -2
  202. package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
  203. package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
  204. package/dist/{postgres-_9psmVGm.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
  205. package/dist/{postgres-MzBPkYzq.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
  206. package/dist/profiler/index.cjs +11 -11
  207. package/dist/profiler/index.d.cts +7 -7
  208. package/dist/profiler/index.d.ts +7 -7
  209. package/dist/profiler/index.js +4 -4
  210. package/dist/provenance/index.cjs +590 -0
  211. package/dist/provenance/index.cjs.map +1 -0
  212. package/dist/provenance/index.d.cts +73 -0
  213. package/dist/provenance/index.d.ts +73 -0
  214. package/dist/provenance/index.js +588 -0
  215. package/dist/provenance/index.js.map +1 -0
  216. package/dist/schema/index.cjs +55 -38
  217. package/dist/schema/index.cjs.map +1 -1
  218. package/dist/schema/index.d.cts +57 -57
  219. package/dist/schema/index.d.ts +57 -57
  220. package/dist/schema/index.js +30 -13
  221. package/dist/schema/index.js.map +1 -1
  222. package/dist/{sqlite-gm44dShb.d.ts → sqlite-D7zBinNR.d.cts} +92 -1
  223. package/dist/{sqlite-BfksSb45.d.cts → sqlite-DvQndLky.d.ts} +92 -1
  224. package/dist/{store-view-FfE5_7eo.d.ts → store-view-BSpqvAxK.d.cts} +445 -46
  225. package/dist/{store-view-9jQ2rPum.d.cts → store-view-CKbHFRnn.d.ts} +445 -46
  226. package/dist/{types-B6mhrcLv.d.cts → types-Bv9DcS_E.d.cts} +2 -2
  227. package/dist/{types-CdWxK-nD.d.ts → types-CoxuV7EJ.d.ts} +2 -2
  228. package/dist/{where-Bpp2ul_z.d.cts → where-7RKFOsXt.d.ts} +2 -2
  229. package/dist/{where-BsEXraKW.d.ts → where-DdMIXOtH.d.cts} +2 -2
  230. package/package.json +21 -14
  231. package/dist/chunk-2YMGNYXY.js +0 -40
  232. package/dist/chunk-2YMGNYXY.js.map +0 -1
  233. package/dist/chunk-3642VBVC.cjs.map +0 -1
  234. package/dist/chunk-3EUKJEQ3.js +0 -77
  235. package/dist/chunk-3EUKJEQ3.js.map +0 -1
  236. package/dist/chunk-3IR2GEMJ.cjs.map +0 -1
  237. package/dist/chunk-3QRBXYT5.cjs.map +0 -1
  238. package/dist/chunk-454I6GDF.js.map +0 -1
  239. package/dist/chunk-4RBAJVEC.cjs.map +0 -1
  240. package/dist/chunk-6NRFUHMS.js.map +0 -1
  241. package/dist/chunk-6ZR4QC3O.cjs +0 -12
  242. package/dist/chunk-73KASJGO.cjs +0 -52
  243. package/dist/chunk-73KASJGO.cjs.map +0 -1
  244. package/dist/chunk-BF3ZDEUE.cjs +0 -773
  245. package/dist/chunk-BF3ZDEUE.cjs.map +0 -1
  246. package/dist/chunk-C4C4Q7A6.js.map +0 -1
  247. package/dist/chunk-CEF2QOTO.js.map +0 -1
  248. package/dist/chunk-CFNT3ITG.cjs.map +0 -1
  249. package/dist/chunk-CWFPJ3RC.js.map +0 -1
  250. package/dist/chunk-D3EWZ67S.cjs.map +0 -1
  251. package/dist/chunk-DJYRRDHA.js.map +0 -1
  252. package/dist/chunk-EF3Z645U.cjs.map +0 -1
  253. package/dist/chunk-FDN43KXV.cjs.map +0 -1
  254. package/dist/chunk-GYVBEZAO.js.map +0 -1
  255. package/dist/chunk-HTGDWIDE.cjs +0 -89
  256. package/dist/chunk-HTGDWIDE.cjs.map +0 -1
  257. package/dist/chunk-I4W7MKVG.cjs.map +0 -1
  258. package/dist/chunk-IZ4PCL47.js.map +0 -1
  259. package/dist/chunk-JHOBXD7O.js.map +0 -1
  260. package/dist/chunk-JIEJCTDS.cjs.map +0 -1
  261. package/dist/chunk-KTIEB7VH.cjs.map +0 -1
  262. package/dist/chunk-KY5SDVA7.cjs.map +0 -1
  263. package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
  264. package/dist/chunk-MBLXCV2Y.cjs.map +0 -1
  265. package/dist/chunk-NG5N7R45.cjs.map +0 -1
  266. package/dist/chunk-OIE2UPVG.cjs.map +0 -1
  267. package/dist/chunk-OS6KS3HV.js.map +0 -1
  268. package/dist/chunk-PIHXFF73.js.map +0 -1
  269. package/dist/chunk-PRMKPFN5.js.map +0 -1
  270. package/dist/chunk-PYD3UCDU.js.map +0 -1
  271. package/dist/chunk-QBYTJSAY.js.map +0 -1
  272. package/dist/chunk-SPT5JMME.js +0 -610
  273. package/dist/chunk-SPT5JMME.js.map +0 -1
  274. package/dist/chunk-SST7XDY6.cjs +0 -624
  275. package/dist/chunk-SST7XDY6.cjs.map +0 -1
  276. package/dist/chunk-TQOYM4LN.js.map +0 -1
  277. package/dist/chunk-UPDMJEW6.js.map +0 -1
  278. package/dist/chunk-WLP6TKFB.js.map +0 -1
  279. package/dist/chunk-WWVV44DY.cjs.map +0 -1
  280. package/dist/chunk-XKNAK27R.js.map +0 -1
  281. package/dist/chunk-XVUJY72M.js.map +0 -1
  282. package/dist/chunk-YCV72E6L.js.map +0 -1
  283. package/dist/chunk-YW7GHMF4.cjs.map +0 -1
  284. package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkKY5SDVA7_cjs = require('./chunk-KY5SDVA7.cjs');
4
- var chunk4RBAJVEC_cjs = require('./chunk-4RBAJVEC.cjs');
5
- var chunkI4W7MKVG_cjs = require('./chunk-I4W7MKVG.cjs');
6
- var chunkOIE2UPVG_cjs = require('./chunk-OIE2UPVG.cjs');
7
- var chunkCFNT3ITG_cjs = require('./chunk-CFNT3ITG.cjs');
8
- var chunkJIEJCTDS_cjs = require('./chunk-JIEJCTDS.cjs');
3
+ var chunkEM3CWPND_cjs = require('./chunk-EM3CWPND.cjs');
4
+ var chunkFN35DLCN_cjs = require('./chunk-FN35DLCN.cjs');
5
+ var chunkCTTSDJLY_cjs = require('./chunk-CTTSDJLY.cjs');
6
+ var chunkD7ZEOS56_cjs = require('./chunk-D7ZEOS56.cjs');
7
+ var chunk4TOD4LBZ_cjs = require('./chunk-4TOD4LBZ.cjs');
8
+ var chunkBLZDPRXT_cjs = require('./chunk-BLZDPRXT.cjs');
9
+ var chunkLGEALRC6_cjs = require('./chunk-LGEALRC6.cjs');
9
10
  var drizzleOrm = require('drizzle-orm');
10
11
  var sqliteCore = require('drizzle-orm/sqlite-core');
11
12
 
@@ -63,6 +64,44 @@ function detectTransactionMode(db, profileHints, isSync) {
63
64
  if (isSync) return "sql";
64
65
  return "drizzle";
65
66
  }
67
+ var MAX_VARIABLE_NUMBER_COMPILE_OPTION = /^MAX_VARIABLE_NUMBER=(\d+)$/;
68
+ var FIRST_MODERN_BIND_LIMIT_MAJOR = 3;
69
+ var FIRST_MODERN_BIND_LIMIT_MINOR = 32;
70
+ function parseCompiledMaxVariableNumber(rows) {
71
+ for (const row of rows) {
72
+ if (typeof row !== "object" || row === null) continue;
73
+ const option = row.compile_options;
74
+ if (typeof option !== "string") continue;
75
+ const match = MAX_VARIABLE_NUMBER_COMPILE_OPTION.exec(option);
76
+ if (match !== null) return Number(match[1]);
77
+ }
78
+ return void 0;
79
+ }
80
+ function hasModernBindLimitByVersion(rows) {
81
+ const first = rows[0];
82
+ if (typeof first !== "object" || first === null) return false;
83
+ const version = first.version;
84
+ if (typeof version !== "string") return false;
85
+ const [major = 0, minor = 0] = version.split(".").map(Number);
86
+ if (!Number.isFinite(major) || !Number.isFinite(minor)) return false;
87
+ return major > FIRST_MODERN_BIND_LIMIT_MAJOR || major === FIRST_MODERN_BIND_LIMIT_MAJOR && minor >= FIRST_MODERN_BIND_LIMIT_MINOR;
88
+ }
89
+ function detectMaxBindParameters(db, sqliteClient) {
90
+ if (isD1DatabaseBySessionName(db)) return chunk4TOD4LBZ_cjs.D1_MAX_BIND_PARAMETERS;
91
+ if (sqliteClient === void 0) return chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS;
92
+ try {
93
+ const compiled = parseCompiledMaxVariableNumber(
94
+ sqliteClient.prepare("PRAGMA compile_options").all()
95
+ );
96
+ if (compiled !== void 0) return compiled;
97
+ const isModern = hasModernBindLimitByVersion(
98
+ sqliteClient.prepare("SELECT sqlite_version() AS version").all()
99
+ );
100
+ return isModern ? chunk4TOD4LBZ_cjs.MODERN_SQLITE_MAX_BIND_PARAMETERS : chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS;
101
+ } catch {
102
+ return chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS;
103
+ }
104
+ }
66
105
  function resolveSqliteClient(db) {
67
106
  const databaseWithClient = db;
68
107
  const sqliteClient = databaseWithClient.$client;
@@ -72,7 +111,7 @@ function resolveSqliteClient(db) {
72
111
  return sqliteClient;
73
112
  }
74
113
  function getOrCreatePreparedStatement(cache, sqliteClient, sqlText, cacheMax) {
75
- return chunkKY5SDVA7_cjs.getOrCreateLru(
114
+ return chunkEM3CWPND_cjs.getOrCreateLru(
76
115
  cache,
77
116
  sqlText,
78
117
  cacheMax,
@@ -105,10 +144,11 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
105
144
  const transactionMode = detectTransactionMode(db, profileHints, isSync);
106
145
  const profile = {
107
146
  isSync,
147
+ maxBindParameters: detectMaxBindParameters(db, sqliteClient),
108
148
  supportsCompiledExecution: sqliteClient !== void 0,
109
149
  transactionMode
110
150
  };
111
- const compile = (query) => chunkKY5SDVA7_cjs.compileQueryWithDialect(db, query, "SQLite");
151
+ const compile = (query) => chunkEM3CWPND_cjs.compileQueryWithDialect(db, query, "SQLite");
112
152
  if (sqliteClient !== void 0) {
113
153
  let executeCompiled2 = function(compiledQuery) {
114
154
  const preparedStatement = getOrCreatePreparedStatement(
@@ -119,6 +159,19 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
119
159
  );
120
160
  const rows = preparedStatement.all(...compiledQuery.params);
121
161
  return Promise.resolve(rows);
162
+ }, executeCompiledRun2 = function(compiledQuery) {
163
+ const preparedStatement = getOrCreatePreparedStatement(
164
+ statementCache,
165
+ client,
166
+ compiledQuery.sql,
167
+ statementCacheMax
168
+ );
169
+ if (preparedStatement.run === void 0 || preparedStatement.reader === true) {
170
+ preparedStatement.all(...compiledQuery.params);
171
+ } else {
172
+ preparedStatement.run(...compiledQuery.params);
173
+ }
174
+ return Promise.resolve();
122
175
  };
123
176
  const client = sqliteClient;
124
177
  const statementCache = /* @__PURE__ */ new Map();
@@ -132,6 +185,7 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
132
185
  return executeCompiled2(compiledQuery);
133
186
  },
134
187
  executeCompiled: executeCompiled2,
188
+ executeCompiledRun: executeCompiledRun2,
135
189
  prepare(sqlText) {
136
190
  return createPreparedStatementExecutor(
137
191
  client,
@@ -157,32 +211,58 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
157
211
  // src/backend/drizzle/sqlite.ts
158
212
  var NODE_INSERT_PARAM_COUNT = 9;
159
213
  var EDGE_INSERT_PARAM_COUNT = 12;
160
- var SQLITE_NODE_INSERT_BATCH_SIZE = Math.max(
161
- 1,
162
- Math.floor(chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS / NODE_INSERT_PARAM_COUNT)
163
- );
164
- var SQLITE_EDGE_INSERT_BATCH_SIZE = Math.max(
165
- 1,
166
- Math.floor(chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS / EDGE_INSERT_PARAM_COUNT)
167
- );
168
- var SQLITE_GET_NODES_ID_CHUNK_SIZE = Math.max(
169
- 1,
170
- chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS - 2
171
- );
172
- var SQLITE_GET_EDGES_ID_CHUNK_SIZE = Math.max(
173
- 1,
174
- chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS - 1
175
- );
214
+ var GET_NODES_FIXED_PARAM_COUNT = 2;
215
+ var GET_EDGES_FIXED_PARAM_COUNT = 1;
176
216
  var CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT = 3;
177
- var SQLITE_CHECK_UNIQUE_BATCH_CHUNK_SIZE = Math.max(
178
- 1,
179
- chunkI4W7MKVG_cjs.SQLITE_MAX_BIND_PARAMETERS - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
180
- );
181
- var toNodeRow = chunkI4W7MKVG_cjs.createNodeRowMapper(chunkI4W7MKVG_cjs.SQLITE_ROW_MAPPER_CONFIG);
182
- var toEdgeRow = chunkI4W7MKVG_cjs.createEdgeRowMapper(chunkI4W7MKVG_cjs.SQLITE_ROW_MAPPER_CONFIG);
183
- var toUniqueRow = chunkI4W7MKVG_cjs.createUniqueRowMapper(chunkI4W7MKVG_cjs.SQLITE_ROW_MAPPER_CONFIG);
184
- var toSchemaVersionRow = chunkI4W7MKVG_cjs.createSchemaVersionRowMapper(
185
- chunkI4W7MKVG_cjs.SQLITE_ROW_MAPPER_CONFIG
217
+ var FULLTEXT_UPSERT_PARAM_COUNT = 6;
218
+ var FULLTEXT_DELETE_FIXED_PARAM_COUNT = 2;
219
+ var UNIQUE_INSERT_PARAM_COUNT = 6;
220
+ var SQLITE_ANALYZE_ROW_LIMIT = 1e3;
221
+ function computeSqliteBatchChunkSizes(maxBindParameters) {
222
+ return {
223
+ checkUniqueBatchChunkSize: Math.max(
224
+ 1,
225
+ maxBindParameters - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
226
+ ),
227
+ embeddingUpsertBatchSize: Math.max(
228
+ 1,
229
+ Math.floor(maxBindParameters / chunkEM3CWPND_cjs.EMBEDDING_UPSERT_PARAM_COUNT)
230
+ ),
231
+ fulltextUpsertBatchSize: Math.max(
232
+ 1,
233
+ Math.floor(maxBindParameters / FULLTEXT_UPSERT_PARAM_COUNT)
234
+ ),
235
+ fulltextDeleteChunkSize: Math.max(
236
+ 1,
237
+ maxBindParameters - FULLTEXT_DELETE_FIXED_PARAM_COUNT
238
+ ),
239
+ edgeInsertBatchSize: Math.max(
240
+ 1,
241
+ Math.floor(maxBindParameters / EDGE_INSERT_PARAM_COUNT)
242
+ ),
243
+ getEdgesChunkSize: Math.max(
244
+ 1,
245
+ maxBindParameters - GET_EDGES_FIXED_PARAM_COUNT
246
+ ),
247
+ getNodesChunkSize: Math.max(
248
+ 1,
249
+ maxBindParameters - GET_NODES_FIXED_PARAM_COUNT
250
+ ),
251
+ nodeInsertBatchSize: Math.max(
252
+ 1,
253
+ Math.floor(maxBindParameters / NODE_INSERT_PARAM_COUNT)
254
+ ),
255
+ uniqueInsertBatchSize: Math.max(
256
+ 1,
257
+ Math.floor(maxBindParameters / UNIQUE_INSERT_PARAM_COUNT)
258
+ )
259
+ };
260
+ }
261
+ var toNodeRow = chunkCTTSDJLY_cjs.createNodeRowMapper(chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG);
262
+ var toEdgeRow = chunkCTTSDJLY_cjs.createEdgeRowMapper(chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG);
263
+ var toUniqueRow = chunkCTTSDJLY_cjs.createUniqueRowMapper(chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG);
264
+ var toSchemaVersionRow = chunkCTTSDJLY_cjs.createSchemaVersionRowMapper(
265
+ chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG
186
266
  );
187
267
  var PENDING_FOREVER = new Promise(noop);
188
268
  function pendingForever() {
@@ -190,9 +270,30 @@ function pendingForever() {
190
270
  }
191
271
  function noop() {
192
272
  }
273
+ var queueTaskContext;
274
+ async function loadQueueTaskContext() {
275
+ try {
276
+ const asyncHooks = await import('async_hooks');
277
+ queueTaskContext = new asyncHooks.AsyncLocalStorage();
278
+ } catch {
279
+ }
280
+ }
281
+ void loadQueueTaskContext();
282
+ function rejectReentrantQueueSubmission() {
283
+ return Promise.reject(
284
+ new chunkLGEALRC6_cjs.ConfigurationError(
285
+ "This operation was awaited from inside a transaction running on the same SQLite backend and would deadlock: the transaction holds the backend's serialized execution slot until it completes, so the operation could never run.",
286
+ { backend: "sqlite", capability: "concurrentRootAccess" },
287
+ {
288
+ suggestion: "Inside a store.transaction callback, use the transaction-scoped context (tx.nodes / tx.edges / tx.backend) instead of the root store or backend, or move the operation outside the transaction."
289
+ }
290
+ )
291
+ );
292
+ }
193
293
  function createSerializedExecutionQueue() {
194
294
  let tail = Promise.resolve();
195
295
  let disposed = false;
296
+ const taskMarker = {};
196
297
  function isDisposed() {
197
298
  return disposed;
198
299
  }
@@ -201,11 +302,15 @@ function createSerializedExecutionQueue() {
201
302
  disposed = true;
202
303
  },
203
304
  runExclusive(task) {
204
- if (isDisposed()) return Promise.reject(new chunkJIEJCTDS_cjs.BackendDisposedError());
305
+ if (isDisposed()) return Promise.reject(new chunkLGEALRC6_cjs.BackendDisposedError());
306
+ if (queueTaskContext?.getStore() === taskMarker) {
307
+ return rejectReentrantQueueSubmission();
308
+ }
205
309
  const runTask = async () => {
206
310
  if (isDisposed()) return pendingForever();
207
311
  try {
208
- return await task();
312
+ const context = queueTaskContext;
313
+ return context === void 0 ? await task() : await context.run(taskMarker, () => task());
209
314
  } catch (error) {
210
315
  if (isDisposed()) return pendingForever();
211
316
  throw error;
@@ -225,18 +330,19 @@ function runWithSerializedQueue(queue, task) {
225
330
  return queue.runExclusive(task);
226
331
  }
227
332
  function throwSqliteTransactionsDisabled(message) {
228
- throw new chunkJIEJCTDS_cjs.ConfigurationError(message, {
333
+ throw new chunkLGEALRC6_cjs.ConfigurationError(message, {
229
334
  backend: "sqlite",
230
335
  capability: "transactions",
231
336
  supportsTransactions: false
232
337
  });
233
338
  }
234
339
  function buildSqliteCapabilities(options) {
235
- const base = options.transactionMode === "none" ? { ...chunkI4W7MKVG_cjs.SQLITE_CAPABILITIES, transactions: false } : chunkI4W7MKVG_cjs.SQLITE_CAPABILITIES;
340
+ const base = options.transactionMode === "none" ? { ...chunk4TOD4LBZ_cjs.SQLITE_CAPABILITIES, transactions: false } : chunk4TOD4LBZ_cjs.SQLITE_CAPABILITIES;
236
341
  return {
237
342
  ...base,
238
- fulltext: chunkCFNT3ITG_cjs.buildFulltextCapabilities(options.fulltextStrategy),
239
- ...options.vectorStrategy === void 0 ? {} : { vector: chunkCFNT3ITG_cjs.buildVectorCapabilities(options.vectorStrategy) }
343
+ maxBindParameters: options.maxBindParameters,
344
+ fulltext: chunkD7ZEOS56_cjs.buildFulltextCapabilities(options.fulltextStrategy),
345
+ ...options.vectorStrategy === void 0 ? {} : { vector: chunkD7ZEOS56_cjs.buildVectorCapabilities(options.vectorStrategy) }
240
346
  };
241
347
  }
242
348
  function createSqliteOperationBackend(options) {
@@ -251,36 +357,46 @@ function createSqliteOperationBackend(options) {
251
357
  vectorStrategy,
252
358
  vectorSlotLatch
253
359
  } = options;
360
+ const compiledExecute = executionAdapter.executeCompiled;
361
+ const compiledRun = executionAdapter.executeCompiledRun;
254
362
  function execGet(query) {
255
363
  return runWithSerializedQueue(serializedQueue, async () => {
256
- const rows = await db.all(query);
364
+ if (compiledExecute === void 0) {
365
+ const rows2 = await db.all(query);
366
+ return rows2[0];
367
+ }
368
+ const rows = await compiledExecute(executionAdapter.compile(query));
257
369
  return rows[0];
258
370
  });
259
371
  }
260
372
  function execAll(query) {
261
373
  return runWithSerializedQueue(serializedQueue, async () => {
262
- return await db.all(query);
374
+ if (compiledExecute === void 0) {
375
+ return await db.all(query);
376
+ }
377
+ return [...await compiledExecute(executionAdapter.compile(query))];
263
378
  });
264
379
  }
265
380
  function execRun(query) {
266
381
  return runWithSerializedQueue(serializedQueue, async () => {
267
- await db.run(query);
382
+ if (compiledRun === void 0) {
383
+ await db.run(query);
384
+ return;
385
+ }
386
+ await compiledRun(executionAdapter.compile(query));
268
387
  });
269
388
  }
270
- const commonBackend = chunkKY5SDVA7_cjs.createCommonOperationBackend({
271
- batchConfig: {
272
- checkUniqueBatchChunkSize: SQLITE_CHECK_UNIQUE_BATCH_CHUNK_SIZE,
273
- edgeInsertBatchSize: SQLITE_EDGE_INSERT_BATCH_SIZE,
274
- getEdgesChunkSize: SQLITE_GET_EDGES_ID_CHUNK_SIZE,
275
- getNodesChunkSize: SQLITE_GET_NODES_ID_CHUNK_SIZE,
276
- nodeInsertBatchSize: SQLITE_NODE_INSERT_BATCH_SIZE
277
- },
389
+ const batchConfig = computeSqliteBatchChunkSizes(
390
+ capabilities.maxBindParameters ?? chunk4TOD4LBZ_cjs.SQLITE_MAX_BIND_PARAMETERS
391
+ );
392
+ const commonBackend = chunkEM3CWPND_cjs.createCommonOperationBackend({
393
+ batchConfig,
278
394
  execution: {
279
395
  execAll,
280
396
  execGet,
281
397
  execRun
282
398
  },
283
- nowIso: chunkI4W7MKVG_cjs.nowIso,
399
+ nowIso: chunkCTTSDJLY_cjs.nowIso,
284
400
  operationStrategy,
285
401
  rowMappers: {
286
402
  toEdgeRow,
@@ -306,19 +422,61 @@ function createSqliteOperationBackend(options) {
306
422
  }
307
423
  const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
308
424
  async upsertEmbedding(params) {
309
- const slot = chunkKY5SDVA7_cjs.vectorSlotFromParams(params);
425
+ const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
310
426
  await ensureVectorSlotStorage(slot);
311
- const statements = vectorStrategy.buildUpsert(slot, params, chunkI4W7MKVG_cjs.nowIso());
427
+ const statements = vectorStrategy.buildUpsert(slot, params, chunkCTTSDJLY_cjs.nowIso());
312
428
  try {
313
429
  for (const statement of statements) {
314
430
  await execRun(statement);
315
431
  }
316
432
  } catch (error) {
317
- throw chunkKY5SDVA7_cjs.mapVectorWriteError(error, params);
433
+ throw chunkEM3CWPND_cjs.mapVectorWriteError(error, params);
434
+ }
435
+ },
436
+ async upsertEmbeddingBatch(params) {
437
+ if (params.rows.length === 0) return;
438
+ const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
439
+ await ensureVectorSlotStorage(slot);
440
+ const rowsById = new Map(
441
+ params.rows.map((row) => [row.nodeId, row])
442
+ );
443
+ const rows = [...rowsById.values()];
444
+ const timestamp = chunkCTTSDJLY_cjs.nowIso();
445
+ try {
446
+ for (const chunk2 of chunk4TOD4LBZ_cjs.chunk(
447
+ rows,
448
+ batchConfig.embeddingUpsertBatchSize
449
+ )) {
450
+ const statements = vectorStrategy.buildUpsertBatch === void 0 ? chunk2.flatMap(
451
+ (row) => vectorStrategy.buildUpsert(
452
+ slot,
453
+ {
454
+ graphId: params.graphId,
455
+ nodeKind: params.nodeKind,
456
+ nodeId: row.nodeId,
457
+ fieldPath: params.fieldPath,
458
+ embedding: row.embedding,
459
+ dimensions: params.dimensions,
460
+ metric: params.metric,
461
+ indexType: params.indexType
462
+ },
463
+ timestamp
464
+ )
465
+ ) : vectorStrategy.buildUpsertBatch(
466
+ slot,
467
+ { ...params, rows: chunk2 },
468
+ timestamp
469
+ );
470
+ for (const statement of statements) {
471
+ await execRun(statement);
472
+ }
473
+ }
474
+ } catch (error) {
475
+ throw chunkEM3CWPND_cjs.mapVectorWriteError(error, params);
318
476
  }
319
477
  },
320
478
  async deleteEmbedding(params) {
321
- const slot = chunkKY5SDVA7_cjs.vectorSlotFromParams(params);
479
+ const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
322
480
  await ensureVectorSlotStorage(slot);
323
481
  const statements = vectorStrategy.buildDelete(slot, params);
324
482
  for (const statement of statements) {
@@ -326,21 +484,80 @@ function createSqliteOperationBackend(options) {
326
484
  }
327
485
  },
328
486
  async vectorSearch(params) {
329
- chunkCFNT3ITG_cjs.assertVectorSearchLimit(params.limit);
330
- const slot = chunkKY5SDVA7_cjs.vectorSlotFromParams(params);
487
+ chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.limit);
488
+ const slot = chunkEM3CWPND_cjs.vectorSlotFromParams(params);
331
489
  await ensureVectorSlotStorage(slot);
332
- const query = vectorStrategy.buildSearch(slot, params);
490
+ const query = vectorStrategy.buildSearch(
491
+ slot,
492
+ params,
493
+ // Store-compiled candidates (predicates + subclass + currency)
494
+ // take precedence; the live-node default covers direct backend use.
495
+ params.candidates ?? operationStrategy.buildLiveNodeIds(
496
+ params.graphId,
497
+ params.nodeKind
498
+ )
499
+ );
333
500
  let rows;
334
501
  try {
335
502
  rows = await execAll(query);
336
503
  } catch (error) {
337
- throw chunkKY5SDVA7_cjs.mapVectorWriteError(error, params);
504
+ throw chunkEM3CWPND_cjs.mapVectorWriteError(error, params);
338
505
  }
339
506
  return rows.map((row) => ({
340
507
  nodeId: row.node_id,
341
508
  score: row.score
342
509
  }));
343
- }
510
+ },
511
+ // Single-statement hybrid needs ROW_NUMBER(); a capability profile
512
+ // that disables window functions keeps the store's multi-statement
513
+ // fallback by simply not exposing the member.
514
+ ...capabilities.windowFunctions ? {
515
+ async hybridSearch(params) {
516
+ chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.limit);
517
+ chunkD7ZEOS56_cjs.assertVectorSearchLimit(params.vector.k);
518
+ const slot = chunkEM3CWPND_cjs.vectorSlotFromParams({
519
+ graphId: params.graphId,
520
+ nodeKind: params.nodeKind,
521
+ fieldPath: params.vector.fieldPath,
522
+ dimensions: params.vector.dimensions,
523
+ metric: params.vector.metric,
524
+ indexType: params.vector.indexType
525
+ });
526
+ await ensureVectorSlotStorage(slot);
527
+ const candidates = params.candidates ?? operationStrategy.buildLiveNodeIds(
528
+ params.graphId,
529
+ params.nodeKind
530
+ );
531
+ const vectorParams = {
532
+ graphId: params.graphId,
533
+ nodeKind: params.nodeKind,
534
+ fieldPath: params.vector.fieldPath,
535
+ queryEmbedding: params.vector.queryEmbedding,
536
+ metric: params.vector.metric,
537
+ dimensions: params.vector.dimensions,
538
+ indexType: params.vector.indexType,
539
+ limit: params.vector.k,
540
+ ...params.vector.minScore === void 0 ? {} : { minScore: params.vector.minScore }
541
+ };
542
+ const vectorSql = vectorStrategy.buildSearch(
543
+ slot,
544
+ vectorParams,
545
+ chunkEM3CWPND_cjs.hybridCandidatesRef()
546
+ );
547
+ const statement = operationStrategy.buildHybridSearch(
548
+ { ...params, candidates },
549
+ vectorSql,
550
+ params.vector.metric === "cosine"
551
+ );
552
+ let raw;
553
+ try {
554
+ raw = await execAll(statement);
555
+ } catch (error) {
556
+ throw chunkEM3CWPND_cjs.mapVectorWriteError(error, vectorParams);
557
+ }
558
+ return raw.map((row) => chunkEM3CWPND_cjs.mapHybridSearchRow(row, toNodeRow));
559
+ }
560
+ } : {}
344
561
  };
345
562
  const operationBackend = {
346
563
  ...commonBackend,
@@ -353,7 +570,7 @@ function createSqliteOperationBackend(options) {
353
570
  ...vectorStrategy === void 0 ? {} : { vectorStrategy },
354
571
  async createVectorIndex(params) {
355
572
  if (vectorStrategy === void 0) return;
356
- const slot = chunkKY5SDVA7_cjs.vectorSlotFromCreateIndexParams(params);
573
+ const slot = chunkEM3CWPND_cjs.vectorSlotFromCreateIndexParams(params);
357
574
  await ensureVectorSlotStorage(slot);
358
575
  const indexStatement = vectorStrategy.buildCreateIndex?.(slot);
359
576
  if (indexStatement !== void 0) {
@@ -362,18 +579,18 @@ function createSqliteOperationBackend(options) {
362
579
  },
363
580
  async dropVectorIndex(params) {
364
581
  if (vectorStrategy === void 0) return;
365
- const slot = chunkKY5SDVA7_cjs.vectorSlotFromDropIndexParams(params);
582
+ const slot = chunkEM3CWPND_cjs.vectorSlotFromDropIndexParams(params);
366
583
  const dropStatement = vectorStrategy.buildDropIndex?.(slot);
367
584
  if (dropStatement === void 0) return;
368
585
  try {
369
586
  await execRun(dropStatement);
370
587
  } catch (error) {
371
- if (!chunkOIE2UPVG_cjs.isMissingTableError(error)) throw error;
588
+ if (!chunkBLZDPRXT_cjs.isMissingTableError(error)) throw error;
372
589
  }
373
590
  },
374
591
  // === Fulltext Operations ===
375
592
  async upsertFulltext(params) {
376
- const timestamp = chunkI4W7MKVG_cjs.nowIso();
593
+ const timestamp = chunkCTTSDJLY_cjs.nowIso();
377
594
  const statements = operationStrategy.buildUpsertFulltext(
378
595
  params,
379
596
  timestamp
@@ -390,20 +607,33 @@ function createSqliteOperationBackend(options) {
390
607
  },
391
608
  async upsertFulltextBatch(params) {
392
609
  if (params.rows.length === 0) return;
393
- const timestamp = chunkI4W7MKVG_cjs.nowIso();
394
- const statements = operationStrategy.buildUpsertFulltextBatch(
395
- params,
396
- timestamp
397
- );
398
- for (const stmt of statements) {
399
- await execRun(stmt);
610
+ const timestamp = chunkCTTSDJLY_cjs.nowIso();
611
+ for (const rows of chunk4TOD4LBZ_cjs.chunk(
612
+ params.rows,
613
+ batchConfig.fulltextUpsertBatchSize
614
+ )) {
615
+ const statements = operationStrategy.buildUpsertFulltextBatch(
616
+ { ...params, rows },
617
+ timestamp
618
+ );
619
+ for (const stmt of statements) {
620
+ await execRun(stmt);
621
+ }
400
622
  }
401
623
  },
402
624
  async deleteFulltextBatch(params) {
403
625
  if (params.nodeIds.length === 0) return;
404
- const statements = operationStrategy.buildDeleteFulltextBatch(params);
405
- for (const stmt of statements) {
406
- await execRun(stmt);
626
+ for (const nodeIds of chunk4TOD4LBZ_cjs.chunk(
627
+ params.nodeIds,
628
+ batchConfig.fulltextDeleteChunkSize
629
+ )) {
630
+ const statements = operationStrategy.buildDeleteFulltextBatch({
631
+ ...params,
632
+ nodeIds
633
+ });
634
+ for (const stmt of statements) {
635
+ await execRun(stmt);
636
+ }
407
637
  }
408
638
  },
409
639
  async fulltextSearch(params) {
@@ -411,7 +641,7 @@ function createSqliteOperationBackend(options) {
411
641
  const rows = await execAll(query);
412
642
  return rows.map((row, index) => ({
413
643
  nodeId: row.node_id,
414
- score: chunkI4W7MKVG_cjs.coerceNumericScore(row.score),
644
+ score: chunkCTTSDJLY_cjs.coerceNumericScore(row.score),
415
645
  rank: index + 1,
416
646
  ...row.snippet === null ? {} : { snippet: row.snippet }
417
647
  }));
@@ -430,18 +660,19 @@ function createSqliteOperationBackend(options) {
430
660
  return operationBackend;
431
661
  }
432
662
  function createSqliteBackend(db, options = {}) {
433
- const tables2 = options.tables ?? chunk4RBAJVEC_cjs.tables;
434
- const fulltextStrategy = options.fulltext ?? chunkCFNT3ITG_cjs.fts5Strategy;
663
+ const tables2 = options.tables ?? chunkFN35DLCN_cjs.tables;
664
+ const fulltextStrategy = options.fulltext ?? chunkD7ZEOS56_cjs.fts5Strategy;
435
665
  const profileHints = options.executionProfile ?? {};
436
666
  const executionAdapter = createSqliteExecutionAdapter(db, { profileHints });
437
667
  const { isSync, transactionMode } = executionAdapter.profile;
438
668
  const vectorStrategy = options.vector;
439
- const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : chunkKY5SDVA7_cjs.createVectorSlotLatch();
669
+ const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : chunkEM3CWPND_cjs.createVectorSlotLatch();
440
670
  const capabilities = {
441
671
  ...buildSqliteCapabilities({
442
672
  fulltextStrategy,
443
673
  vectorStrategy,
444
- transactionMode
674
+ transactionMode,
675
+ maxBindParameters: executionAdapter.profile.maxBindParameters
445
676
  }),
446
677
  ...options.capabilities
447
678
  };
@@ -451,14 +682,26 @@ function createSqliteBackend(db, options = {}) {
451
682
  recordedNodes: drizzleOrm.getTableName(tables2.recordedNodes),
452
683
  recordedEdges: drizzleOrm.getTableName(tables2.recordedEdges),
453
684
  recordedClock: drizzleOrm.getTableName(tables2.recordedClock),
685
+ revisionOrigins: drizzleOrm.getTableName(tables2.revisionOrigins),
454
686
  fulltext: tables2.fulltextTableName,
455
687
  uniques: drizzleOrm.getTableName(tables2.uniques)
456
688
  };
457
- const operationStrategy = chunkKY5SDVA7_cjs.createSqliteOperationStrategy(
689
+ const coreAnalyzeTables = [
690
+ tableNames.nodes,
691
+ tableNames.edges,
692
+ tableNames.uniques,
693
+ tableNames.fulltext
694
+ ];
695
+ const recordedAnalyzeTables = [
696
+ tableNames.recordedNodes,
697
+ tableNames.recordedEdges,
698
+ tableNames.recordedClock
699
+ ];
700
+ const operationStrategy = chunkEM3CWPND_cjs.createSqliteOperationStrategy(
458
701
  tables2,
459
702
  fulltextStrategy
460
703
  );
461
- const serializedQueue = isSync ? createSerializedExecutionQueue() : void 0;
704
+ const serializedQueue = transactionMode === "none" ? void 0 : createSerializedExecutionQueue();
462
705
  const operations = createSqliteOperationBackend({
463
706
  capabilities,
464
707
  db,
@@ -483,6 +726,14 @@ function createSqliteBackend(db, options = {}) {
483
726
  async () => storageTransaction.call(storage, run)
484
727
  );
485
728
  }
729
+ async function runFrameStatement(query) {
730
+ const compiledRun = executionAdapter.executeCompiledRun;
731
+ if (compiledRun === void 0) {
732
+ await db.run(query);
733
+ return;
734
+ }
735
+ await compiledRun(executionAdapter.compile(query));
736
+ }
486
737
  function runSchemaWriteTransaction(fn) {
487
738
  if (transactionMode === "none") {
488
739
  throwSqliteTransactionsDisabled(
@@ -496,17 +747,17 @@ function createSqliteBackend(db, options = {}) {
496
747
  db,
497
748
  executionAdapter,
498
749
  operationStrategy,
499
- profileHints: { isSync: true },
750
+ profileHints: { isSync },
500
751
  tableNames,
501
752
  fulltextStrategy,
502
753
  vectorStrategy});
503
- db.run(drizzleOrm.sql`BEGIN IMMEDIATE`);
754
+ await runFrameStatement(drizzleOrm.sql`BEGIN IMMEDIATE`);
504
755
  try {
505
756
  const result = await fn(txBackend);
506
- db.run(drizzleOrm.sql`COMMIT`);
757
+ await runFrameStatement(drizzleOrm.sql`COMMIT`);
507
758
  return result;
508
759
  } catch (error) {
509
- db.run(drizzleOrm.sql`ROLLBACK`);
760
+ await runFrameStatement(drizzleOrm.sql`ROLLBACK`);
510
761
  throw error;
511
762
  }
512
763
  });
@@ -544,7 +795,7 @@ function createSqliteBackend(db, options = {}) {
544
795
  }
545
796
  const matTable = tables2.contributionMaterializations;
546
797
  async function ensureContributionMaterializationsTableImpl() {
547
- await db.run(drizzleOrm.sql.raw(chunkKY5SDVA7_cjs.generateSqliteCreateTableSQL(matTable)));
798
+ await db.run(drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(matTable)));
548
799
  }
549
800
  async function getContributionMaterializationRow(identity) {
550
801
  const rows = await db.select().from(matTable).where(
@@ -557,16 +808,16 @@ function createSqliteBackend(db, options = {}) {
557
808
  );
558
809
  const row = rows[0];
559
810
  if (row === void 0) return void 0;
560
- return chunkKY5SDVA7_cjs.mapContributionMaterializationRow(
811
+ return chunkEM3CWPND_cjs.mapContributionMaterializationRow(
561
812
  row,
562
- chunkKY5SDVA7_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.decode
813
+ chunkEM3CWPND_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.decode
563
814
  );
564
815
  }
565
816
  async function recordContributionMaterializationRow(params) {
566
817
  await db.insert(matTable).values(
567
- chunkKY5SDVA7_cjs.buildContributionInsertValues(
818
+ chunkEM3CWPND_cjs.buildContributionInsertValues(
568
819
  params,
569
- chunkKY5SDVA7_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.encode
820
+ chunkEM3CWPND_cjs.SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.encode
570
821
  )
571
822
  ).onConflictDoUpdate({
572
823
  target: [
@@ -575,13 +826,13 @@ function createSqliteBackend(db, options = {}) {
575
826
  matTable.owner,
576
827
  matTable.tableName
577
828
  ],
578
- set: chunkKY5SDVA7_cjs.buildContributionOnConflictSet(
829
+ set: chunkEM3CWPND_cjs.buildContributionOnConflictSet(
579
830
  matTable.materializedAt,
580
831
  params.materializedAt
581
832
  )
582
833
  });
583
834
  }
584
- const contributionMaterializer = chunkKY5SDVA7_cjs.createContributionMaterializer({
835
+ const contributionMaterializer = chunkEM3CWPND_cjs.createContributionMaterializer({
585
836
  dialect: "sqlite",
586
837
  fulltextStrategy,
587
838
  fulltextTableName: tables2.fulltextTableName,
@@ -601,22 +852,27 @@ function createSqliteBackend(db, options = {}) {
601
852
  tableNames,
602
853
  fulltextStrategy,
603
854
  vectorStrategy});
604
- return chunkKY5SDVA7_cjs.gateFulltext(txBackend, contributionMaterializer.assertInitialized);
855
+ return chunkEM3CWPND_cjs.gateFulltext(txBackend, contributionMaterializer.assertInitialized);
605
856
  }
606
857
  const backend = {
607
858
  ...operations,
608
859
  async bootstrapTables() {
609
- const statements = chunkKY5SDVA7_cjs.generateSqliteDDL(tables2, fulltextStrategy);
860
+ const statements = chunkEM3CWPND_cjs.generateSqliteDDL(tables2, fulltextStrategy);
610
861
  for (const statement of statements) {
611
862
  await db.run(drizzleOrm.sql.raw(statement));
612
863
  }
613
864
  },
865
+ async ensureRevisionOriginsTable() {
866
+ await db.run(
867
+ drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.revisionOrigins))
868
+ );
869
+ },
614
870
  // Every fulltext-touching method asserts the durable marker instead
615
871
  // of lazily emitting DDL. Steady state performs zero ensure; an
616
872
  // uninitialized database throws `StoreNotInitializedError` rather
617
873
  // than self-healing (#135). Shared verbatim with the tx-scoped gate
618
874
  // via `gateFulltextMethods`.
619
- ...chunkKY5SDVA7_cjs.gateFulltextMethods(
875
+ ...chunkEM3CWPND_cjs.gateFulltextMethods(
620
876
  operations,
621
877
  contributionMaterializer.assertInitialized
622
878
  ),
@@ -625,7 +881,7 @@ function createSqliteBackend(db, options = {}) {
625
881
  },
626
882
  async ensureIndexMaterializationsTable() {
627
883
  await db.run(
628
- drizzleOrm.sql.raw(chunkKY5SDVA7_cjs.generateSqliteCreateTableSQL(tables2.indexMaterializations))
884
+ drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.indexMaterializations))
629
885
  );
630
886
  },
631
887
  async getIndexMaterialization(indexName) {
@@ -633,26 +889,26 @@ function createSqliteBackend(db, options = {}) {
633
889
  const rows = await db.select().from(t).where(drizzleOrm.eq(t.indexName, indexName));
634
890
  const row = rows[0];
635
891
  if (row === void 0) return void 0;
636
- return chunkKY5SDVA7_cjs.mapMaterializationRow(row, chunkKY5SDVA7_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode);
892
+ return chunkEM3CWPND_cjs.mapMaterializationRow(row, chunkEM3CWPND_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode);
637
893
  },
638
894
  async getIndexMaterializations(statusKeys) {
639
895
  if (statusKeys.length === 0) return [];
640
896
  const t = tables2.indexMaterializations;
641
897
  const rows = await db.select().from(t).where(drizzleOrm.inArray(t.indexName, [...statusKeys]));
642
898
  return rows.map(
643
- (row) => chunkKY5SDVA7_cjs.mapMaterializationRow(row, chunkKY5SDVA7_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode)
899
+ (row) => chunkEM3CWPND_cjs.mapMaterializationRow(row, chunkEM3CWPND_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.decode)
644
900
  );
645
901
  },
646
902
  async recordIndexMaterialization(params) {
647
903
  const t = tables2.indexMaterializations;
648
904
  await db.insert(t).values(
649
- chunkKY5SDVA7_cjs.buildMaterializationInsertValues(
905
+ chunkEM3CWPND_cjs.buildMaterializationInsertValues(
650
906
  params,
651
- chunkKY5SDVA7_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.encode
907
+ chunkEM3CWPND_cjs.SQLITE_INDEX_MAT_TIMESTAMPS.encode
652
908
  )
653
909
  ).onConflictDoUpdate({
654
910
  target: t.indexName,
655
- set: chunkKY5SDVA7_cjs.buildMaterializationOnConflictSet(
911
+ set: chunkEM3CWPND_cjs.buildMaterializationOnConflictSet(
656
912
  t.materializedAt,
657
913
  params.materializedAt
658
914
  )
@@ -671,37 +927,37 @@ function createSqliteBackend(db, options = {}) {
671
927
  await contributionMaterializer.assertInitialized(graphId);
672
928
  },
673
929
  async ensureKindRemovalsTable() {
674
- await db.run(drizzleOrm.sql.raw(chunkKY5SDVA7_cjs.generateSqliteCreateTableSQL(tables2.kindRemovals)));
930
+ await db.run(drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.kindRemovals)));
675
931
  },
676
932
  async getPendingKindRemovals(graphId) {
677
933
  const t = tables2.kindRemovals;
678
934
  const rows = await db.select().from(t).where(drizzleOrm.and(drizzleOrm.eq(t.graphId, graphId), drizzleOrm.isNull(t.removedAt)));
679
935
  return rows.map(
680
- (row) => chunkKY5SDVA7_cjs.mapKindRemovalRow(row, chunkKY5SDVA7_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
936
+ (row) => chunkEM3CWPND_cjs.mapKindRemovalRow(row, chunkEM3CWPND_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
681
937
  );
682
938
  },
683
939
  async getAllKindRemovals(graphId) {
684
940
  const t = tables2.kindRemovals;
685
941
  const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
686
942
  return rows.map(
687
- (row) => chunkKY5SDVA7_cjs.mapKindRemovalRow(row, chunkKY5SDVA7_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
943
+ (row) => chunkEM3CWPND_cjs.mapKindRemovalRow(row, chunkEM3CWPND_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.decode)
688
944
  );
689
945
  },
690
946
  async recordKindRemoval(params) {
691
947
  const t = tables2.kindRemovals;
692
948
  await db.insert(t).values(
693
- chunkKY5SDVA7_cjs.buildKindRemovalInsertValues(
949
+ chunkEM3CWPND_cjs.buildKindRemovalInsertValues(
694
950
  params,
695
- chunkKY5SDVA7_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.encode
951
+ chunkEM3CWPND_cjs.SQLITE_KIND_REMOVAL_TIMESTAMPS.encode
696
952
  )
697
953
  ).onConflictDoUpdate({
698
954
  target: [t.graphId, t.kindName, t.entity, t.schemaVersion],
699
- set: chunkKY5SDVA7_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
955
+ set: chunkEM3CWPND_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
700
956
  });
701
957
  },
702
958
  async ensureReconciliationMarkersTable() {
703
959
  await db.run(
704
- drizzleOrm.sql.raw(chunkKY5SDVA7_cjs.generateSqliteCreateTableSQL(tables2.reconciliationMarkers))
960
+ drizzleOrm.sql.raw(chunkEM3CWPND_cjs.generateSqliteCreateTableSQL(tables2.reconciliationMarkers))
705
961
  );
706
962
  },
707
963
  async ensureRuntimeContributions(graphId) {
@@ -728,7 +984,19 @@ function createSqliteBackend(db, options = {}) {
728
984
  });
729
985
  },
730
986
  async refreshStatistics() {
731
- await db.run(drizzleOrm.sql`ANALYZE`);
987
+ await db.run(
988
+ drizzleOrm.sql`PRAGMA analysis_limit = ${drizzleOrm.sql.raw(String(SQLITE_ANALYZE_ROW_LIMIT))}`
989
+ );
990
+ for (const tableName of coreAnalyzeTables) {
991
+ await db.run(drizzleOrm.sql`ANALYZE ${chunkCTTSDJLY_cjs.quoteIdentifier(tableName)}`);
992
+ }
993
+ for (const tableName of recordedAnalyzeTables) {
994
+ try {
995
+ await db.run(drizzleOrm.sql`ANALYZE ${chunkCTTSDJLY_cjs.quoteIdentifier(tableName)}`);
996
+ } catch (error) {
997
+ if (!chunkBLZDPRXT_cjs.isMissingTableError(error)) throw error;
998
+ }
999
+ }
732
1000
  },
733
1001
  async commitSchemaVersion(params) {
734
1002
  return runSchemaWriteTransaction(
@@ -753,23 +1021,23 @@ function createSqliteBackend(db, options = {}) {
753
1021
  db,
754
1022
  executionAdapter,
755
1023
  operationStrategy,
756
- profileHints: { isSync: true },
1024
+ profileHints: { isSync },
757
1025
  tableNames,
758
1026
  fulltextStrategy,
759
1027
  vectorStrategy});
760
- db.run(drizzleOrm.sql`BEGIN`);
1028
+ await runFrameStatement(drizzleOrm.sql`BEGIN IMMEDIATE`);
761
1029
  try {
762
1030
  const result = await fn(
763
- chunkKY5SDVA7_cjs.gateFulltext(
1031
+ chunkEM3CWPND_cjs.gateFulltext(
764
1032
  txBackend,
765
1033
  contributionMaterializer.assertInitialized
766
1034
  ),
767
1035
  db
768
1036
  );
769
- db.run(drizzleOrm.sql`COMMIT`);
1037
+ await runFrameStatement(drizzleOrm.sql`COMMIT`);
770
1038
  return result;
771
1039
  } catch (error) {
772
- db.run(drizzleOrm.sql`ROLLBACK`);
1040
+ await runFrameStatement(drizzleOrm.sql`ROLLBACK`);
773
1041
  throw error;
774
1042
  }
775
1043
  });
@@ -781,9 +1049,9 @@ function createSqliteBackend(db, options = {}) {
781
1049
  }
782
1050
  return runWithSerializedQueue(
783
1051
  serializedQueue,
784
- async () => db.transaction(
785
- async (tx) => fn(bindTransactionBackend(tx), tx)
786
- )
1052
+ async () => db.transaction(async (tx) => fn(bindTransactionBackend(tx), tx), {
1053
+ behavior: "immediate"
1054
+ })
787
1055
  );
788
1056
  },
789
1057
  adoptTransaction(externalTx) {
@@ -792,7 +1060,7 @@ function createSqliteBackend(db, options = {}) {
792
1060
  "Cross-store atomicity is unavailable on this SQLite backend: transactions are disabled (transactionMode: 'none'). Adopting an external transaction here would let the caller's relational write commit with no way to roll back the graph write. Configure a driver that supports transactions (better-sqlite3, libsql, bun:sqlite)."
793
1061
  );
794
1062
  }
795
- chunkKY5SDVA7_cjs.assertAdoptedDialect(
1063
+ chunkEM3CWPND_cjs.assertAdoptedDialect(
796
1064
  externalTx,
797
1065
  sqliteCore.BaseSQLiteDatabase,
798
1066
  "sqlite"
@@ -818,10 +1086,10 @@ function createTransactionBackend(options) {
818
1086
  tableNames: options.tableNames,
819
1087
  fulltextStrategy: options.fulltextStrategy,
820
1088
  vectorStrategy: options.vectorStrategy,
821
- ...options.vectorStrategy === void 0 ? {} : { vectorSlotLatch: chunkKY5SDVA7_cjs.createVectorSlotLatch() }
1089
+ ...options.vectorStrategy === void 0 ? {} : { vectorSlotLatch: chunkEM3CWPND_cjs.createVectorSlotLatch() }
822
1090
  });
823
1091
  }
824
1092
 
825
1093
  exports.createSqliteBackend = createSqliteBackend;
826
- //# sourceMappingURL=chunk-3642VBVC.cjs.map
827
- //# sourceMappingURL=chunk-3642VBVC.cjs.map
1094
+ //# sourceMappingURL=chunk-O7UN7OXA.cjs.map
1095
+ //# sourceMappingURL=chunk-O7UN7OXA.cjs.map