@nicia-ai/typegraph 0.36.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/backend/postgres/index.cjs +24 -24
  2. package/dist/backend/postgres/index.d.cts +6 -6
  3. package/dist/backend/postgres/index.d.ts +6 -6
  4. package/dist/backend/postgres/index.js +11 -11
  5. package/dist/backend/postgres/pglite.cjs +16 -16
  6. package/dist/backend/postgres/pglite.d.cts +3 -3
  7. package/dist/backend/postgres/pglite.d.ts +3 -3
  8. package/dist/backend/postgres/pglite.js +11 -11
  9. package/dist/backend/sqlite/index.cjs +22 -21
  10. package/dist/backend/sqlite/index.d.cts +11 -9
  11. package/dist/backend/sqlite/index.d.ts +11 -9
  12. package/dist/backend/sqlite/index.js +10 -9
  13. package/dist/backend/sqlite/libsql.cjs +15 -14
  14. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  15. package/dist/backend/sqlite/libsql.d.cts +3 -3
  16. package/dist/backend/sqlite/libsql.d.ts +3 -3
  17. package/dist/backend/sqlite/libsql.js +11 -10
  18. package/dist/backend/sqlite/libsql.js.map +1 -1
  19. package/dist/backend/sqlite/local.cjs +30 -23
  20. package/dist/backend/sqlite/local.cjs.map +1 -1
  21. package/dist/backend/sqlite/local.d.cts +3 -3
  22. package/dist/backend/sqlite/local.d.ts +3 -3
  23. package/dist/backend/sqlite/local.js +18 -11
  24. package/dist/backend/sqlite/local.js.map +1 -1
  25. package/dist/{chunk-TCOCYN2P.cjs → chunk-27SSDCEP.cjs} +14 -14
  26. package/dist/{chunk-TCOCYN2P.cjs.map → chunk-27SSDCEP.cjs.map} +1 -1
  27. package/dist/{chunk-5AQIKK56.cjs → chunk-2N6EOBTH.cjs} +16 -16
  28. package/dist/{chunk-5AQIKK56.cjs.map → chunk-2N6EOBTH.cjs.map} +1 -1
  29. package/dist/{chunk-FN35DLCN.cjs → chunk-3C2RYI6L.cjs} +13 -107
  30. package/dist/chunk-3C2RYI6L.cjs.map +1 -0
  31. package/dist/{chunk-HW3LW7DH.cjs → chunk-3DS7Z4T4.cjs} +39 -39
  32. package/dist/{chunk-HW3LW7DH.cjs.map → chunk-3DS7Z4T4.cjs.map} +1 -1
  33. package/dist/{chunk-RSSQKPSZ.cjs → chunk-3GH67G4Z.cjs} +5 -5
  34. package/dist/{chunk-RSSQKPSZ.cjs.map → chunk-3GH67G4Z.cjs.map} +1 -1
  35. package/dist/{chunk-M75SUBFG.js → chunk-3RWZPJKV.js} +24 -9
  36. package/dist/chunk-3RWZPJKV.js.map +1 -0
  37. package/dist/{chunk-SKCOUWAX.js → chunk-3SLPDKHQ.js} +4 -4
  38. package/dist/chunk-3SLPDKHQ.js.map +1 -0
  39. package/dist/{chunk-5A6FNS6N.cjs → chunk-3XXGYU62.cjs} +11 -11
  40. package/dist/{chunk-5A6FNS6N.cjs.map → chunk-3XXGYU62.cjs.map} +1 -1
  41. package/dist/{chunk-IU46OHVW.js → chunk-44TA22QT.js} +58 -11
  42. package/dist/chunk-44TA22QT.js.map +1 -0
  43. package/dist/{chunk-7BQLPXK6.cjs → chunk-5AVRFNP4.cjs} +2955 -898
  44. package/dist/chunk-5AVRFNP4.cjs.map +1 -0
  45. package/dist/{chunk-2THZ3TQI.cjs → chunk-5KEQ74YU.cjs} +14 -14
  46. package/dist/chunk-5KEQ74YU.cjs.map +1 -0
  47. package/dist/{chunk-Q5TEXCTB.js → chunk-5KPNWT6X.js} +3 -3
  48. package/dist/{chunk-Q5TEXCTB.js.map → chunk-5KPNWT6X.js.map} +1 -1
  49. package/dist/{chunk-WI7ISNQF.js → chunk-5PNMDJ7J.js} +94 -5
  50. package/dist/chunk-5PNMDJ7J.js.map +1 -0
  51. package/dist/{chunk-AW4A3P5A.cjs → chunk-5VQM6VWP.cjs} +2 -2
  52. package/dist/{chunk-AW4A3P5A.cjs.map → chunk-5VQM6VWP.cjs.map} +1 -1
  53. package/dist/{chunk-A3W7QG7K.js → chunk-5WWVZMVX.js} +2 -2
  54. package/dist/{chunk-A3W7QG7K.js.map → chunk-5WWVZMVX.js.map} +1 -1
  55. package/dist/{chunk-FACJJWGF.cjs → chunk-6EEO3OVU.cjs} +7 -7
  56. package/dist/{chunk-FACJJWGF.cjs.map → chunk-6EEO3OVU.cjs.map} +1 -1
  57. package/dist/{chunk-DIK74MXX.cjs → chunk-BVRDGYXQ.cjs} +97 -4
  58. package/dist/chunk-BVRDGYXQ.cjs.map +1 -0
  59. package/dist/{chunk-4BCU6VFZ.cjs → chunk-DEFQM7JU.cjs} +7 -7
  60. package/dist/{chunk-4BCU6VFZ.cjs.map → chunk-DEFQM7JU.cjs.map} +1 -1
  61. package/dist/{chunk-456Z2U7Y.cjs → chunk-DIQ3AV5W.cjs} +574 -268
  62. package/dist/chunk-DIQ3AV5W.cjs.map +1 -0
  63. package/dist/{chunk-JFMEONLG.cjs → chunk-EJYMTO3K.cjs} +332 -188
  64. package/dist/chunk-EJYMTO3K.cjs.map +1 -0
  65. package/dist/{chunk-FPIZFYHE.js → chunk-EXU3RASM.js} +74 -15
  66. package/dist/chunk-EXU3RASM.js.map +1 -0
  67. package/dist/{chunk-5DIPR3L3.js → chunk-GA4TT3DH.js} +2338 -281
  68. package/dist/chunk-GA4TT3DH.js.map +1 -0
  69. package/dist/{chunk-H7YNSMA7.cjs → chunk-HAHNRASW.cjs} +20 -2
  70. package/dist/chunk-HAHNRASW.cjs.map +1 -0
  71. package/dist/{chunk-J3LEGNQB.cjs → chunk-IP3CGGPA.cjs} +8 -8
  72. package/dist/{chunk-J3LEGNQB.cjs.map → chunk-IP3CGGPA.cjs.map} +1 -1
  73. package/dist/{chunk-X4JBT642.cjs → chunk-IPSVVTWT.cjs} +94 -35
  74. package/dist/chunk-IPSVVTWT.cjs.map +1 -0
  75. package/dist/{chunk-VQEXF5D4.js → chunk-IXGYRP2P.js} +184 -92
  76. package/dist/chunk-IXGYRP2P.js.map +1 -0
  77. package/dist/{chunk-4GX2JJXS.js → chunk-K3Q3LJY3.js} +520 -221
  78. package/dist/chunk-K3Q3LJY3.js.map +1 -0
  79. package/dist/{chunk-OR5ZA5WP.js → chunk-K5UBVGJN.js} +4 -4
  80. package/dist/{chunk-OR5ZA5WP.js.map → chunk-K5UBVGJN.js.map} +1 -1
  81. package/dist/{chunk-UZV3AZKF.js → chunk-KQJ54OG5.js} +3 -3
  82. package/dist/{chunk-UZV3AZKF.js.map → chunk-KQJ54OG5.js.map} +1 -1
  83. package/dist/{chunk-SXGE7ITL.js → chunk-L7HQ2OSI.js} +4 -4
  84. package/dist/{chunk-SXGE7ITL.js.map → chunk-L7HQ2OSI.js.map} +1 -1
  85. package/dist/{chunk-RAXU3RMB.js → chunk-M6VES7V6.js} +4 -4
  86. package/dist/{chunk-RAXU3RMB.js.map → chunk-M6VES7V6.js.map} +1 -1
  87. package/dist/{chunk-PWGX5DF5.cjs → chunk-NUIG3BCV.cjs} +100 -85
  88. package/dist/chunk-NUIG3BCV.cjs.map +1 -0
  89. package/dist/{chunk-ZAMFOJ5P.cjs → chunk-NXQFATMF.cjs} +269 -177
  90. package/dist/chunk-NXQFATMF.cjs.map +1 -0
  91. package/dist/{chunk-KBGQIPRQ.js → chunk-PC2UBAUB.js} +20 -3
  92. package/dist/chunk-PC2UBAUB.js.map +1 -0
  93. package/dist/chunk-QARBLBXT.cjs +219 -0
  94. package/dist/chunk-QARBLBXT.cjs.map +1 -0
  95. package/dist/{chunk-6FR2MMS6.js → chunk-QERAIDRJ.js} +45 -4
  96. package/dist/chunk-QERAIDRJ.js.map +1 -0
  97. package/dist/chunk-QSXTWU4U.cjs +12 -0
  98. package/dist/{chunk-4BMPGT35.cjs.map → chunk-QSXTWU4U.cjs.map} +1 -1
  99. package/dist/{chunk-DN5VP4JC.js → chunk-RCVLFTCT.js} +9 -10
  100. package/dist/chunk-RCVLFTCT.js.map +1 -0
  101. package/dist/{chunk-ZIGXMKQQ.js → chunk-RRSNR3TP.js} +3 -3
  102. package/dist/{chunk-ZIGXMKQQ.js.map → chunk-RRSNR3TP.js.map} +1 -1
  103. package/dist/{chunk-4CAXEB2F.cjs → chunk-TGOMW4MB.cjs} +91 -92
  104. package/dist/chunk-TGOMW4MB.cjs.map +1 -0
  105. package/dist/{chunk-PZKNKG5M.js → chunk-TKT2XHED.js} +8 -8
  106. package/dist/{chunk-PZKNKG5M.js.map → chunk-TKT2XHED.js.map} +1 -1
  107. package/dist/{chunk-S5F7ZLP2.js → chunk-TPF25IG6.js} +3 -3
  108. package/dist/{chunk-S5F7ZLP2.js.map → chunk-TPF25IG6.js.map} +1 -1
  109. package/dist/{chunk-5SEGFTZX.js → chunk-UGZUAYAR.js} +3 -3
  110. package/dist/{chunk-5SEGFTZX.js.map → chunk-UGZUAYAR.js.map} +1 -1
  111. package/dist/{chunk-BJVEU3ZL.js → chunk-UV3WP5WZ.js} +265 -121
  112. package/dist/chunk-UV3WP5WZ.js.map +1 -0
  113. package/dist/{chunk-VHMPG6UL.js → chunk-UXLSNRYL.js} +11 -105
  114. package/dist/chunk-UXLSNRYL.js.map +1 -0
  115. package/dist/{chunk-FRV5Q5IO.js → chunk-UYQMBBWJ.js} +3 -3
  116. package/dist/{chunk-FRV5Q5IO.js.map → chunk-UYQMBBWJ.js.map} +1 -1
  117. package/dist/{chunk-UUT7UN2N.cjs → chunk-VGDDG3XJ.cjs} +7 -7
  118. package/dist/{chunk-UUT7UN2N.cjs.map → chunk-VGDDG3XJ.cjs.map} +1 -1
  119. package/dist/{chunk-5VTR2F2K.js → chunk-VKGKDOKR.js} +12 -10
  120. package/dist/chunk-VKGKDOKR.js.map +1 -0
  121. package/dist/{chunk-5W4L6DLF.cjs → chunk-VL2V6PEN.cjs} +11 -11
  122. package/dist/{chunk-5W4L6DLF.cjs.map → chunk-VL2V6PEN.cjs.map} +1 -1
  123. package/dist/{chunk-ZUNQ5BEP.cjs → chunk-WOJMKB3N.cjs} +82 -80
  124. package/dist/chunk-WOJMKB3N.cjs.map +1 -0
  125. package/dist/{chunk-UMDVATGY.cjs → chunk-WWFHO375.cjs} +6 -6
  126. package/dist/{chunk-UMDVATGY.cjs.map → chunk-WWFHO375.cjs.map} +1 -1
  127. package/dist/{chunk-JFUPDJXD.js → chunk-XGPUQ56G.js} +3 -3
  128. package/dist/{chunk-JFUPDJXD.js.map → chunk-XGPUQ56G.js.map} +1 -1
  129. package/dist/{chunk-D7ZEOS56.cjs → chunk-XGU7DZDA.cjs} +74 -14
  130. package/dist/chunk-XGU7DZDA.cjs.map +1 -0
  131. package/dist/{chunk-S55OV6PW.cjs → chunk-XPCZADMT.cjs} +54 -11
  132. package/dist/chunk-XPCZADMT.cjs.map +1 -0
  133. package/dist/{chunk-T2WUSPDA.js → chunk-XWV4JT34.js} +3 -3
  134. package/dist/{chunk-T2WUSPDA.js.map → chunk-XWV4JT34.js.map} +1 -1
  135. package/dist/chunk-YTSN73ND.js +212 -0
  136. package/dist/chunk-YTSN73ND.js.map +1 -0
  137. package/dist/{ddl-CZz7a0E8.d.cts → ddl-BD-ZfKeX.d.cts} +3 -3
  138. package/dist/{ddl-C2rZ-Aen.d.ts → ddl-CS0KUVwB.d.ts} +3 -3
  139. package/dist/{extension-types-ixRpJVUp.d.ts → extension-types-BM2ACfYO.d.cts} +6 -1
  140. package/dist/{extension-types-ixRpJVUp.d.cts → extension-types-BM2ACfYO.d.ts} +6 -1
  141. package/dist/{fulltext-strategy-CDkSSYhq.d.cts → fulltext-strategy-C27vXaeB.d.cts} +127 -8
  142. package/dist/{fulltext-strategy-B57yvC5Q.d.ts → fulltext-strategy-DebsMrqg.d.ts} +127 -8
  143. package/dist/graph-extension/index.cjs +19 -19
  144. package/dist/graph-extension/index.d.cts +4 -4
  145. package/dist/graph-extension/index.d.ts +4 -4
  146. package/dist/graph-extension/index.js +4 -4
  147. package/dist/graph-merge/index.cjs +88 -88
  148. package/dist/graph-merge/index.d.cts +6 -6
  149. package/dist/graph-merge/index.d.ts +6 -6
  150. package/dist/graph-merge/index.js +19 -19
  151. package/dist/{index-BLtQWKRj.d.cts → index-BPM59vsg.d.cts} +52 -7
  152. package/dist/{index-BFvdmBPV.d.ts → index-BeacbPoe.d.ts} +52 -7
  153. package/dist/index.cjs +224 -187
  154. package/dist/index.cjs.map +1 -1
  155. package/dist/index.d.cts +11 -11
  156. package/dist/index.d.ts +11 -11
  157. package/dist/index.js +53 -40
  158. package/dist/index.js.map +1 -1
  159. package/dist/indexes/index.cjs +30 -21
  160. package/dist/indexes/index.d.cts +5 -5
  161. package/dist/indexes/index.d.ts +5 -5
  162. package/dist/indexes/index.js +8 -7
  163. package/dist/interchange/index.cjs +207 -30
  164. package/dist/interchange/index.cjs.map +1 -1
  165. package/dist/interchange/index.d.cts +25 -8
  166. package/dist/interchange/index.d.ts +25 -8
  167. package/dist/interchange/index.js +190 -11
  168. package/dist/interchange/index.js.map +1 -1
  169. package/dist/{manager-DwQi8eV0.d.cts → manager-D00_NXvT.d.ts} +11 -2
  170. package/dist/{manager-ejUCB52T.d.ts → manager-nU1vTJLy.d.cts} +11 -2
  171. package/dist/{materialize-indexes-B4e9360H.d.cts → materialize-indexes-CuR3gAZb.d.cts} +8 -2
  172. package/dist/{materialize-indexes-te9TPMMJ.d.ts → materialize-indexes-zK2J_flP.d.ts} +8 -2
  173. package/dist/{postgres-CfEqsRMp.d.cts → postgres-IaBA4RgE.d.ts} +1 -1
  174. package/dist/{postgres-DQ5R6rzV.d.ts → postgres-YrYmPlaU.d.cts} +1 -1
  175. package/dist/profiler/index.cjs +3 -3
  176. package/dist/profiler/index.d.cts +7 -7
  177. package/dist/profiler/index.d.ts +7 -7
  178. package/dist/profiler/index.js +2 -2
  179. package/dist/provenance/index.cjs +32 -33
  180. package/dist/provenance/index.cjs.map +1 -1
  181. package/dist/provenance/index.d.cts +5 -5
  182. package/dist/provenance/index.d.ts +5 -5
  183. package/dist/provenance/index.js +5 -6
  184. package/dist/provenance/index.js.map +1 -1
  185. package/dist/schema/index.cjs +35 -35
  186. package/dist/schema/index.d.cts +7 -7
  187. package/dist/schema/index.d.ts +7 -7
  188. package/dist/schema/index.js +11 -11
  189. package/dist/{sqlite-DvQndLky.d.ts → sqlite-BUOHPx7p.d.ts} +1 -1
  190. package/dist/{sqlite-D7zBinNR.d.cts → sqlite-Pp8O19WE.d.cts} +1 -1
  191. package/dist/{store-view-DplHC3Nt.d.ts → store-view-ANL6mTph.d.ts} +213 -27
  192. package/dist/{store-view-9KDOpZzF.d.cts → store-view-X96Rd00T.d.cts} +213 -27
  193. package/dist/{types-Bv9DcS_E.d.cts → types-r-Zyq2Hz.d.cts} +2 -2
  194. package/dist/{types-CoxuV7EJ.d.ts → types-wsvuBgPK.d.ts} +2 -2
  195. package/dist/where-CJOpJj3a.d.ts +36 -0
  196. package/dist/where-K3uBP33l.d.cts +36 -0
  197. package/package.json +1 -1
  198. package/dist/chunk-2THZ3TQI.cjs.map +0 -1
  199. package/dist/chunk-456Z2U7Y.cjs.map +0 -1
  200. package/dist/chunk-4BMPGT35.cjs +0 -12
  201. package/dist/chunk-4CAXEB2F.cjs.map +0 -1
  202. package/dist/chunk-4GX2JJXS.js.map +0 -1
  203. package/dist/chunk-5DIPR3L3.js.map +0 -1
  204. package/dist/chunk-5VTR2F2K.js.map +0 -1
  205. package/dist/chunk-6FR2MMS6.js.map +0 -1
  206. package/dist/chunk-7BQLPXK6.cjs.map +0 -1
  207. package/dist/chunk-BJVEU3ZL.js.map +0 -1
  208. package/dist/chunk-D7ZEOS56.cjs.map +0 -1
  209. package/dist/chunk-DIK74MXX.cjs.map +0 -1
  210. package/dist/chunk-DN5VP4JC.js.map +0 -1
  211. package/dist/chunk-EOLERH7Y.cjs +0 -40
  212. package/dist/chunk-EOLERH7Y.cjs.map +0 -1
  213. package/dist/chunk-FN35DLCN.cjs.map +0 -1
  214. package/dist/chunk-FPIZFYHE.js.map +0 -1
  215. package/dist/chunk-H7YNSMA7.cjs.map +0 -1
  216. package/dist/chunk-IU46OHVW.js.map +0 -1
  217. package/dist/chunk-JFMEONLG.cjs.map +0 -1
  218. package/dist/chunk-KBGQIPRQ.js.map +0 -1
  219. package/dist/chunk-M75SUBFG.js.map +0 -1
  220. package/dist/chunk-PWGX5DF5.cjs.map +0 -1
  221. package/dist/chunk-S55OV6PW.cjs.map +0 -1
  222. package/dist/chunk-SKCOUWAX.js.map +0 -1
  223. package/dist/chunk-UT3S4SEN.js +0 -31
  224. package/dist/chunk-UT3S4SEN.js.map +0 -1
  225. package/dist/chunk-VHMPG6UL.js.map +0 -1
  226. package/dist/chunk-VQEXF5D4.js.map +0 -1
  227. package/dist/chunk-WI7ISNQF.js.map +0 -1
  228. package/dist/chunk-X4JBT642.cjs.map +0 -1
  229. package/dist/chunk-ZAMFOJ5P.cjs.map +0 -1
  230. package/dist/chunk-ZUNQ5BEP.cjs.map +0 -1
  231. package/dist/where-7RKFOsXt.d.ts +0 -11
  232. package/dist/where-DdMIXOtH.d.cts +0 -11
@@ -1,11 +1,11 @@
1
- import { createVectorSlotLatch, createSqliteOperationStrategy, createContributionMaterializer, gateFulltextMethods, generateSqliteCreateTableSQL, mapContributionMaterializationRow, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, buildContributionInsertValues, buildContributionOnConflictSet, assertAdoptedDialect, buildKindRemovalInsertValues, SQLITE_KIND_REMOVAL_TIMESTAMPS, buildKindRemovalOnConflictSet, mapKindRemovalRow, buildMaterializationInsertValues, SQLITE_INDEX_MAT_TIMESTAMPS, buildMaterializationOnConflictSet, mapMaterializationRow, generateSqliteDDL, createCommonOperationBackend, vectorSlotFromParams, hybridCandidatesRef, mapVectorWriteError, mapHybridSearchRow, gateFulltext, compileQueryWithDialect, EMBEDDING_UPSERT_PARAM_COUNT, vectorSlotFromDropIndexParams, vectorSlotFromCreateIndexParams, getOrCreateLru } from './chunk-4GX2JJXS.js';
2
- import { tables } from './chunk-VHMPG6UL.js';
3
- import { createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper, quoteIdentifier, nowIso, coerceNumericScore } from './chunk-RAXU3RMB.js';
4
- import { fts5Strategy, buildVectorCapabilities, buildFulltextCapabilities, assertVectorSearchLimit } from './chunk-FPIZFYHE.js';
5
- import { SQLITE_CAPABILITIES, SQLITE_MAX_BIND_PARAMETERS, D1_MAX_BIND_PARAMETERS, MODERN_SQLITE_MAX_BIND_PARAMETERS, chunk } from './chunk-IU46OHVW.js';
6
- import { isMissingTableError } from './chunk-JFUPDJXD.js';
7
- import { ConfigurationError, BackendDisposedError } from './chunk-WI7ISNQF.js';
8
- import { getTableName, sql, and, eq, isNull, inArray } from 'drizzle-orm';
1
+ import { createSqliteOperationStrategy, createContributionMaterializer, gateFulltextMethods, assertTrustedImportDatabaseEmpty, suspendSqliteSecondaryIndexes, createSqliteTrustedImportSession, restoreSecondaryIndexes, analyzeImportedTables, generateSqliteCreateTableSQL, mapContributionMaterializationRow, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, buildContributionInsertValues, buildContributionOnConflictSet, assertAdoptedDialect, buildKindRemovalInsertValues, SQLITE_KIND_REMOVAL_TIMESTAMPS, buildKindRemovalOnConflictSet, mapKindRemovalRow, buildMaterializationInsertValues, SQLITE_INDEX_MAT_TIMESTAMPS, buildMaterializationOnConflictSet, mapMaterializationRow, generateSqliteDDL, createCommonOperationBackend, vectorSlotFromParams, hybridCandidatesRef, mapVectorWriteError, mapHybridSearchRow, gateFulltext, compileQueryWithDialect, EMBEDDING_UPSERT_PARAM_COUNT, vectorSlotFromDropIndexParams, vectorSlotFromCreateIndexParams, getOrCreateLru } from './chunk-K3Q3LJY3.js';
2
+ import { tables } from './chunk-UXLSNRYL.js';
3
+ import { createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper, quoteIdentifier, nowIso, coerceNumericScore } from './chunk-M6VES7V6.js';
4
+ import { fts5Strategy, buildVectorCapabilities, buildFulltextCapabilities, assertVectorSearchLimit } from './chunk-EXU3RASM.js';
5
+ import { normalizeGraphAnalyticsCapabilities, INTERNAL_TEMPORARY_WRITES, SQLITE_CAPABILITIES, SQLITE_MAX_BIND_PARAMETERS, MODERN_SQLITE_MAX_BIND_PARAMETERS, chunk, DURABLE_OBJECT_MAX_BIND_PARAMETERS, D1_MAX_BIND_PARAMETERS } from './chunk-44TA22QT.js';
6
+ import { isMissingTableError } from './chunk-XGPUQ56G.js';
7
+ import { ConfigurationError, BackendDisposedError } from './chunk-5PNMDJ7J.js';
8
+ import { getTableName, sql, eq, and, isNull, inArray } from 'drizzle-orm';
9
9
  import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
10
10
 
11
11
  var DEFAULT_PREPARED_STATEMENT_CACHE_MAX = 256;
@@ -24,11 +24,30 @@ function isDurableObjectBySessionName(db) {
24
24
  const sessionName = getSessionName(db);
25
25
  return sessionName === "SQLiteDOSession" || sessionName === "SQLiteDurableObjectSession";
26
26
  }
27
+ function isDurableObjectStorageClient(value) {
28
+ if (typeof value !== "object" || value === null) return false;
29
+ const candidate = value;
30
+ const sqlApi = candidate.sql;
31
+ return typeof candidate.transaction === "function" && typeof candidate.transactionSync === "function" && typeof sqlApi === "object" && sqlApi !== null && typeof sqlApi.exec === "function";
32
+ }
33
+ function getDurableObjectStorageClient(db) {
34
+ const client = db.$client;
35
+ return isDurableObjectStorageClient(client) ? client : void 0;
36
+ }
37
+ function detectHostedPlatform(db) {
38
+ if (getDurableObjectStorageClient(db) !== void 0 || isDurableObjectBySessionName(db)) {
39
+ return "durable-object";
40
+ }
41
+ if (isD1DatabaseBySessionName(db)) return "d1";
42
+ return void 0;
43
+ }
27
44
  function isSyncDatabaseBySessionName(db) {
28
45
  const sessionName = getSessionName(db);
29
46
  return sessionName === "BetterSQLiteSession" || sessionName === "BunSQLiteSession";
30
47
  }
31
- function detectSyncProfile(db, profileHints) {
48
+ function detectSyncProfile(db, profileHints, hostedPlatform) {
49
+ if (hostedPlatform === "durable-object") return true;
50
+ if (hostedPlatform === "d1") return false;
32
51
  if (profileHints.isSync !== void 0) {
33
52
  return profileHints.isSync;
34
53
  }
@@ -36,12 +55,6 @@ function detectSyncProfile(db, profileHints) {
36
55
  if (sessionName === "BetterSQLiteSession" || sessionName === "BunSQLiteSession") {
37
56
  return true;
38
57
  }
39
- if (isDurableObjectBySessionName(db)) {
40
- return true;
41
- }
42
- if (sessionName === "SQLiteD1Session") {
43
- return false;
44
- }
45
58
  try {
46
59
  const probeResult = db.get(sql`SELECT 1 AS __typegraph_sync_probe__`);
47
60
  return !(probeResult instanceof Promise);
@@ -49,16 +62,12 @@ function detectSyncProfile(db, profileHints) {
49
62
  return isSyncDatabaseBySessionName(db);
50
63
  }
51
64
  }
52
- function detectTransactionMode(db, profileHints, isSync) {
65
+ function detectTransactionMode(profileHints, isSync, hostedPlatform) {
66
+ if (hostedPlatform === "durable-object") return "do-sqlite";
67
+ if (hostedPlatform === "d1") return "none";
53
68
  if (profileHints.transactionMode !== void 0) {
54
69
  return profileHints.transactionMode;
55
70
  }
56
- if (isDurableObjectBySessionName(db)) {
57
- return "do-sqlite";
58
- }
59
- if (isD1DatabaseBySessionName(db)) {
60
- return "none";
61
- }
62
71
  if (isSync) return "sql";
63
72
  return "drizzle";
64
73
  }
@@ -84,8 +93,15 @@ function hasModernBindLimitByVersion(rows) {
84
93
  if (!Number.isFinite(major) || !Number.isFinite(minor)) return false;
85
94
  return major > FIRST_MODERN_BIND_LIMIT_MAJOR || major === FIRST_MODERN_BIND_LIMIT_MAJOR && minor >= FIRST_MODERN_BIND_LIMIT_MINOR;
86
95
  }
87
- function detectMaxBindParameters(db, sqliteClient) {
88
- if (isD1DatabaseBySessionName(db)) return D1_MAX_BIND_PARAMETERS;
96
+ function detectHardMaxBindParameters(transactionMode, hostedPlatform) {
97
+ if (hostedPlatform === "durable-object" || transactionMode === "do-sqlite") {
98
+ return DURABLE_OBJECT_MAX_BIND_PARAMETERS;
99
+ }
100
+ if (hostedPlatform === "d1") return D1_MAX_BIND_PARAMETERS;
101
+ return void 0;
102
+ }
103
+ function detectMaxBindParameters(sqliteClient, hardMaxBindParameters) {
104
+ if (hardMaxBindParameters !== void 0) return hardMaxBindParameters;
89
105
  if (sqliteClient === void 0) return SQLITE_MAX_BIND_PARAMETERS;
90
106
  try {
91
107
  const compiled = parseCompiledMaxVariableNumber(
@@ -101,11 +117,10 @@ function detectMaxBindParameters(db, sqliteClient) {
101
117
  }
102
118
  }
103
119
  function resolveSqliteClient(db) {
104
- const databaseWithClient = db;
105
- const sqliteClient = databaseWithClient.$client;
106
- if (sqliteClient?.prepare === void 0) {
107
- return void 0;
108
- }
120
+ const sqliteClient = db.$client;
121
+ if (typeof sqliteClient !== "object" || sqliteClient === null) return;
122
+ const candidate = sqliteClient;
123
+ if (typeof candidate.prepare !== "function") return;
109
124
  return sqliteClient;
110
125
  }
111
126
  function getOrCreatePreparedStatement(cache, sqliteClient, sqlText, cacheMax) {
@@ -137,12 +152,27 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
137
152
  const options = typeof statementCacheMaxOrOptions === "number" ? { statementCacheMax: statementCacheMaxOrOptions } : statementCacheMaxOrOptions;
138
153
  const statementCacheMax = options.statementCacheMax ?? DEFAULT_PREPARED_STATEMENT_CACHE_MAX;
139
154
  const profileHints = options.profileHints ?? {};
140
- const isSync = detectSyncProfile(db, profileHints);
155
+ const hostedPlatform = detectHostedPlatform(db);
156
+ const isSync = detectSyncProfile(db, profileHints, hostedPlatform);
141
157
  const sqliteClient = isSync ? resolveSqliteClient(db) : void 0;
142
- const transactionMode = detectTransactionMode(db, profileHints, isSync);
158
+ const transactionMode = detectTransactionMode(
159
+ profileHints,
160
+ isSync,
161
+ hostedPlatform
162
+ );
163
+ const hardMaxBindParameters = detectHardMaxBindParameters(
164
+ transactionMode,
165
+ hostedPlatform
166
+ );
167
+ const maxBindParameters = detectMaxBindParameters(
168
+ sqliteClient,
169
+ hardMaxBindParameters
170
+ );
143
171
  const profile = {
172
+ ...hostedPlatform === void 0 ? {} : { hostedPlatform },
173
+ ...hardMaxBindParameters === void 0 ? {} : { hardMaxBindParameters },
144
174
  isSync,
145
- maxBindParameters: detectMaxBindParameters(db, sqliteClient),
175
+ maxBindParameters,
146
176
  supportsCompiledExecution: sqliteClient !== void 0,
147
177
  transactionMode
148
178
  };
@@ -170,6 +200,22 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
170
200
  preparedStatement.run(...compiledQuery.params);
171
201
  }
172
202
  return Promise.resolve();
203
+ }, executePreparedRunBatch2 = function(sqlText, parameterRows) {
204
+ const preparedStatement = getOrCreatePreparedStatement(
205
+ statementCache,
206
+ client,
207
+ sqlText,
208
+ statementCacheMax
209
+ );
210
+ if (preparedStatement.run === void 0) {
211
+ throw new Error(
212
+ "Trusted SQLite import requires a prepared statement run() method."
213
+ );
214
+ }
215
+ for (const params of parameterRows) {
216
+ preparedStatement.run(...params);
217
+ }
218
+ return Promise.resolve();
173
219
  };
174
220
  const client = sqliteClient;
175
221
  const statementCache = /* @__PURE__ */ new Map();
@@ -184,6 +230,7 @@ function createSqliteExecutionAdapter(db, statementCacheMaxOrOptions = {}) {
184
230
  },
185
231
  executeCompiled: executeCompiled2,
186
232
  executeCompiledRun: executeCompiledRun2,
233
+ executePreparedRunBatch: executePreparedRunBatch2,
187
234
  prepare(sqlText) {
188
235
  return createPreparedStatementExecutor(
189
236
  client,
@@ -335,7 +382,16 @@ function throwSqliteTransactionsDisabled(message) {
335
382
  });
336
383
  }
337
384
  function buildSqliteCapabilities(options) {
338
- const base = options.transactionMode === "none" ? { ...SQLITE_CAPABILITIES, transactions: false } : SQLITE_CAPABILITIES;
385
+ const base = options.transactionMode === "none" ? {
386
+ ...SQLITE_CAPABILITIES,
387
+ transactions: false,
388
+ graphAnalytics: {
389
+ ...SQLITE_CAPABILITIES.graphAnalytics ?? {
390
+ mathFunctions: false
391
+ },
392
+ supported: false
393
+ }
394
+ } : SQLITE_CAPABILITIES;
339
395
  return {
340
396
  ...base,
341
397
  maxBindParameters: options.maxBindParameters,
@@ -343,6 +399,20 @@ function buildSqliteCapabilities(options) {
343
399
  ...options.vectorStrategy === void 0 ? {} : { vector: buildVectorCapabilities(options.vectorStrategy) }
344
400
  };
345
401
  }
402
+ function resolveMaxBindParametersCapability(profile, override) {
403
+ const requested = override ?? profile.maxBindParameters;
404
+ return profile.hardMaxBindParameters === void 0 ? requested : Math.min(requested, profile.hardMaxBindParameters);
405
+ }
406
+ function resolveSqliteGraphAnalyticsCapabilities(profile, override) {
407
+ const requested = override ?? SQLITE_CAPABILITIES.graphAnalytics ?? {
408
+ supported: false,
409
+ mathFunctions: false
410
+ };
411
+ if (profile.transactionMode !== "do-sqlite" && profile.transactionMode !== "none") {
412
+ return requested;
413
+ }
414
+ return { ...requested, supported: false };
415
+ }
346
416
  function createSqliteOperationBackend(options) {
347
417
  const {
348
418
  capabilities,
@@ -353,7 +423,7 @@ function createSqliteOperationBackend(options) {
353
423
  tableNames,
354
424
  fulltextStrategy,
355
425
  vectorStrategy,
356
- vectorSlotLatch
426
+ contributionMaterializer
357
427
  } = options;
358
428
  const compiledExecute = executionAdapter.executeCompiled;
359
429
  const compiledRun = executionAdapter.executeCompiledRun;
@@ -412,16 +482,10 @@ function createSqliteOperationBackend(options) {
412
482
  );
413
483
  }
414
484
  };
415
- async function ensureVectorSlotStorage(slot) {
416
- if (vectorStrategy === void 0 || vectorSlotLatch === void 0) return;
417
- await vectorSlotLatch.ensure(vectorStrategy, slot, async (statement) => {
418
- await execRun(sql.raw(statement));
419
- });
420
- }
421
485
  const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
422
486
  async upsertEmbedding(params) {
423
487
  const slot = vectorSlotFromParams(params);
424
- await ensureVectorSlotStorage(slot);
488
+ await contributionMaterializer.assertVectorSlot(slot);
425
489
  const statements = vectorStrategy.buildUpsert(slot, params, nowIso());
426
490
  try {
427
491
  for (const statement of statements) {
@@ -434,7 +498,7 @@ function createSqliteOperationBackend(options) {
434
498
  async upsertEmbeddingBatch(params) {
435
499
  if (params.rows.length === 0) return;
436
500
  const slot = vectorSlotFromParams(params);
437
- await ensureVectorSlotStorage(slot);
501
+ await contributionMaterializer.assertVectorSlot(slot);
438
502
  const rowsById = new Map(
439
503
  params.rows.map((row) => [row.nodeId, row])
440
504
  );
@@ -475,7 +539,7 @@ function createSqliteOperationBackend(options) {
475
539
  },
476
540
  async deleteEmbedding(params) {
477
541
  const slot = vectorSlotFromParams(params);
478
- await ensureVectorSlotStorage(slot);
542
+ await contributionMaterializer.assertVectorSlot(slot);
479
543
  const statements = vectorStrategy.buildDelete(slot, params);
480
544
  for (const statement of statements) {
481
545
  await execRun(statement);
@@ -484,7 +548,6 @@ function createSqliteOperationBackend(options) {
484
548
  async vectorSearch(params) {
485
549
  assertVectorSearchLimit(params.limit);
486
550
  const slot = vectorSlotFromParams(params);
487
- await ensureVectorSlotStorage(slot);
488
551
  const query = vectorStrategy.buildSearch(
489
552
  slot,
490
553
  params,
@@ -521,7 +584,6 @@ function createSqliteOperationBackend(options) {
521
584
  metric: params.vector.metric,
522
585
  indexType: params.vector.indexType
523
586
  });
524
- await ensureVectorSlotStorage(slot);
525
587
  const candidates = params.candidates ?? operationStrategy.buildLiveNodeIds(
526
588
  params.graphId,
527
589
  params.nodeKind
@@ -569,7 +631,7 @@ function createSqliteOperationBackend(options) {
569
631
  async createVectorIndex(params) {
570
632
  if (vectorStrategy === void 0) return;
571
633
  const slot = vectorSlotFromCreateIndexParams(params);
572
- await ensureVectorSlotStorage(slot);
634
+ await contributionMaterializer.ensureVectorSlot(slot);
573
635
  const indexStatement = vectorStrategy.buildCreateIndex?.(slot);
574
636
  if (indexStatement !== void 0) {
575
637
  await execRun(indexStatement);
@@ -664,16 +726,24 @@ function createSqliteBackend(db, options = {}) {
664
726
  const executionAdapter = createSqliteExecutionAdapter(db, { profileHints });
665
727
  const { isSync, transactionMode } = executionAdapter.profile;
666
728
  const vectorStrategy = options.vector;
667
- const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : createVectorSlotLatch();
668
- const capabilities = {
729
+ const capabilityOverrides = options.capabilities ?? {};
730
+ const capabilities = normalizeGraphAnalyticsCapabilities({
669
731
  ...buildSqliteCapabilities({
670
732
  fulltextStrategy,
671
733
  vectorStrategy,
672
734
  transactionMode,
673
735
  maxBindParameters: executionAdapter.profile.maxBindParameters
674
736
  }),
675
- ...options.capabilities
676
- };
737
+ ...capabilityOverrides,
738
+ maxBindParameters: resolveMaxBindParametersCapability(
739
+ executionAdapter.profile,
740
+ capabilityOverrides.maxBindParameters
741
+ ),
742
+ graphAnalytics: resolveSqliteGraphAnalyticsCapabilities(
743
+ executionAdapter.profile,
744
+ capabilityOverrides.graphAnalytics
745
+ )
746
+ });
677
747
  const tableNames = {
678
748
  nodes: getTableName(tables2.nodes),
679
749
  edges: getTableName(tables2.edges),
@@ -700,6 +770,77 @@ function createSqliteBackend(db, options = {}) {
700
770
  fulltextStrategy
701
771
  );
702
772
  const serializedQueue = transactionMode === "none" ? void 0 : createSerializedExecutionQueue();
773
+ const matTable = tables2.contributionMaterializations;
774
+ async function ensureContributionMaterializationsTableImpl() {
775
+ await db.run(sql.raw(generateSqliteCreateTableSQL(matTable)));
776
+ }
777
+ async function getContributionMaterializationRow(identity) {
778
+ const rows = await db.select().from(matTable).where(
779
+ and(
780
+ eq(matTable.graphId, identity.graphId),
781
+ eq(matTable.logicalName, identity.logicalName),
782
+ eq(matTable.owner, identity.owner),
783
+ eq(matTable.tableName, identity.tableName)
784
+ )
785
+ );
786
+ const row = rows[0];
787
+ if (row === void 0) return void 0;
788
+ return mapContributionMaterializationRow(
789
+ row,
790
+ SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.decode
791
+ );
792
+ }
793
+ async function getContributionMaterializationRows(graphId) {
794
+ const rows = await db.select().from(matTable).where(eq(matTable.graphId, graphId));
795
+ return rows.map(
796
+ (row) => mapContributionMaterializationRow(
797
+ row,
798
+ SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.decode
799
+ )
800
+ );
801
+ }
802
+ async function recordContributionMaterializationRow(params) {
803
+ await db.insert(matTable).values(
804
+ buildContributionInsertValues(
805
+ params,
806
+ SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.encode
807
+ )
808
+ ).onConflictDoUpdate({
809
+ target: [
810
+ matTable.graphId,
811
+ matTable.logicalName,
812
+ matTable.owner,
813
+ matTable.tableName
814
+ ],
815
+ set: buildContributionOnConflictSet(
816
+ matTable.materializedAt,
817
+ params.materializedAt
818
+ )
819
+ });
820
+ }
821
+ async function deleteContributionMaterializationRow(identity) {
822
+ await db.delete(matTable).where(
823
+ and(
824
+ eq(matTable.graphId, identity.graphId),
825
+ eq(matTable.logicalName, identity.logicalName),
826
+ eq(matTable.owner, identity.owner),
827
+ eq(matTable.tableName, identity.tableName)
828
+ )
829
+ );
830
+ }
831
+ const contributionMaterializer = createContributionMaterializer({
832
+ dialect: "sqlite",
833
+ fulltextStrategy,
834
+ fulltextTableName: tables2.fulltextTableName,
835
+ vectorStrategy,
836
+ execDdl: async (statement) => {
837
+ await db.run(sql.raw(statement));
838
+ },
839
+ ensureMarkerTable: ensureContributionMaterializationsTableImpl,
840
+ getMarkers: getContributionMaterializationRows,
841
+ recordMarker: recordContributionMaterializationRow,
842
+ deleteMarker: deleteContributionMaterializationRow
843
+ });
703
844
  const operations = createSqliteOperationBackend({
704
845
  capabilities,
705
846
  db,
@@ -708,20 +849,19 @@ function createSqliteBackend(db, options = {}) {
708
849
  tableNames,
709
850
  fulltextStrategy,
710
851
  vectorStrategy,
711
- vectorSlotLatch,
852
+ contributionMaterializer,
712
853
  ...serializedQueue === void 0 ? {} : { serializedQueue }
713
854
  });
714
855
  function runDoSqliteStorageTransaction(run) {
715
- const storage = db.$client;
716
- const storageTransaction = storage?.transaction;
717
- if (typeof storageTransaction !== "function") {
856
+ const storage = getDurableObjectStorageClient(db);
857
+ if (storage === void 0) {
718
858
  throwSqliteTransactionsDisabled(
719
- "transactionMode 'do-sqlite' requires a Drizzle Durable Objects database (drizzle(ctx.storage)) whose `$client` exposes the async storage `transaction(async () => ...)` runner."
859
+ "transactionMode 'do-sqlite' requires a Drizzle Durable Objects database (drizzle(ctx.storage)) whose `$client` exposes the SQL, transactionSync, and async transaction runners."
720
860
  );
721
861
  }
722
862
  return runWithSerializedQueue(
723
863
  serializedQueue,
724
- async () => storageTransaction.call(storage, run)
864
+ () => storage.transaction(run)
725
865
  );
726
866
  }
727
867
  async function runFrameStatement(query) {
@@ -748,7 +888,9 @@ function createSqliteBackend(db, options = {}) {
748
888
  profileHints: { isSync },
749
889
  tableNames,
750
890
  fulltextStrategy,
751
- vectorStrategy});
891
+ vectorStrategy,
892
+ contributionMaterializer
893
+ });
752
894
  await runFrameStatement(sql`BEGIN IMMEDIATE`);
753
895
  try {
754
896
  const result = await fn(txBackend);
@@ -769,7 +911,9 @@ function createSqliteBackend(db, options = {}) {
769
911
  profileHints: { isSync },
770
912
  tableNames,
771
913
  fulltextStrategy,
772
- vectorStrategy});
914
+ vectorStrategy,
915
+ contributionMaterializer
916
+ });
773
917
  return fn(txBackend);
774
918
  });
775
919
  }
@@ -784,63 +928,15 @@ function createSqliteBackend(db, options = {}) {
784
928
  profileHints: { isSync },
785
929
  tableNames,
786
930
  fulltextStrategy,
787
- vectorStrategy});
931
+ vectorStrategy,
932
+ contributionMaterializer
933
+ });
788
934
  return fn(txBackend);
789
935
  },
790
936
  { behavior: "immediate" }
791
937
  )
792
938
  );
793
939
  }
794
- const matTable = tables2.contributionMaterializations;
795
- async function ensureContributionMaterializationsTableImpl() {
796
- await db.run(sql.raw(generateSqliteCreateTableSQL(matTable)));
797
- }
798
- async function getContributionMaterializationRow(identity) {
799
- const rows = await db.select().from(matTable).where(
800
- and(
801
- eq(matTable.graphId, identity.graphId),
802
- eq(matTable.logicalName, identity.logicalName),
803
- eq(matTable.owner, identity.owner),
804
- eq(matTable.tableName, identity.tableName)
805
- )
806
- );
807
- const row = rows[0];
808
- if (row === void 0) return void 0;
809
- return mapContributionMaterializationRow(
810
- row,
811
- SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.decode
812
- );
813
- }
814
- async function recordContributionMaterializationRow(params) {
815
- await db.insert(matTable).values(
816
- buildContributionInsertValues(
817
- params,
818
- SQLITE_CONTRIBUTION_MAT_TIMESTAMPS.encode
819
- )
820
- ).onConflictDoUpdate({
821
- target: [
822
- matTable.graphId,
823
- matTable.logicalName,
824
- matTable.owner,
825
- matTable.tableName
826
- ],
827
- set: buildContributionOnConflictSet(
828
- matTable.materializedAt,
829
- params.materializedAt
830
- )
831
- });
832
- }
833
- const contributionMaterializer = createContributionMaterializer({
834
- dialect: "sqlite",
835
- fulltextStrategy,
836
- fulltextTableName: tables2.fulltextTableName,
837
- execDdl: async (statement) => {
838
- await db.run(sql.raw(statement));
839
- },
840
- ensureMarkerTable: ensureContributionMaterializationsTableImpl,
841
- getMarker: getContributionMaterializationRow,
842
- recordMarker: recordContributionMaterializationRow
843
- });
844
940
  function bindTransactionBackend(tx) {
845
941
  const txBackend = createTransactionBackend({
846
942
  capabilities,
@@ -849,11 +945,30 @@ function createSqliteBackend(db, options = {}) {
849
945
  profileHints: { isSync },
850
946
  tableNames,
851
947
  fulltextStrategy,
852
- vectorStrategy});
948
+ vectorStrategy,
949
+ contributionMaterializer
950
+ });
853
951
  return gateFulltext(txBackend, contributionMaterializer.assertInitialized);
854
952
  }
855
953
  const backend = {
856
954
  ...operations,
955
+ ...isSync && transactionMode === "sql" && executionAdapter.executePreparedRunBatch !== void 0 ? {
956
+ async trustedImport(fn) {
957
+ return backend.transaction(async (tx) => {
958
+ await assertTrustedImportDatabaseEmpty(tx, tableNames);
959
+ const indexDefinitions = await suspendSqliteSecondaryIndexes(
960
+ tx,
961
+ tableNames
962
+ );
963
+ const result = await fn(
964
+ createSqliteTrustedImportSession(executionAdapter, tableNames)
965
+ );
966
+ await restoreSecondaryIndexes(tx, indexDefinitions);
967
+ await analyzeImportedTables(tx, tableNames);
968
+ return result;
969
+ });
970
+ }
971
+ } : {},
857
972
  async bootstrapTables() {
858
973
  const statements = generateSqliteDDL(tables2, fulltextStrategy);
859
974
  for (const statement of statements) {
@@ -906,10 +1021,7 @@ function createSqliteBackend(db, options = {}) {
906
1021
  )
907
1022
  ).onConflictDoUpdate({
908
1023
  target: t.indexName,
909
- set: buildMaterializationOnConflictSet(
910
- t.materializedAt,
911
- params.materializedAt
912
- )
1024
+ set: buildMaterializationOnConflictSet(params.materializedAt)
913
1025
  });
914
1026
  },
915
1027
  async ensureContributionMaterializationsTable() {
@@ -969,6 +1081,27 @@ function createSqliteBackend(db, options = {}) {
969
1081
  async ensureFulltextTable(graphId) {
970
1082
  await contributionMaterializer.ensureRuntimeContributions(graphId);
971
1083
  },
1084
+ // Vector counterparts of the runtime-contribution methods. Present
1085
+ // only when a vector strategy is wired (omitted on a plain SQLite
1086
+ // connection with no vector extension), mirroring the embedding/
1087
+ // search methods.
1088
+ ...vectorStrategy === void 0 ? {} : {
1089
+ async ensureVectorSlotContribution(slot, options_) {
1090
+ await contributionMaterializer.ensureVectorSlot(slot, options_);
1091
+ },
1092
+ async ensureVectorSlotContributions(slots, options_) {
1093
+ await contributionMaterializer.ensureVectorSlots(slots, options_);
1094
+ },
1095
+ async assertVectorSlotInitialized(slot) {
1096
+ await contributionMaterializer.assertVectorSlot(slot);
1097
+ },
1098
+ async assertVectorSlotsInitialized(slots) {
1099
+ await contributionMaterializer.assertVectorSlots(slots);
1100
+ },
1101
+ async deleteVectorSlotContribution(slot) {
1102
+ await contributionMaterializer.dropVectorSlot(slot);
1103
+ }
1104
+ },
972
1105
  async getReconciliationMarker(graphId) {
973
1106
  const t = tables2.reconciliationMarkers;
974
1107
  const rows = await db.select().from(t).where(eq(t.graphId, graphId));
@@ -1006,7 +1139,14 @@ function createSqliteBackend(db, options = {}) {
1006
1139
  (target) => target.setActiveVersion(params)
1007
1140
  );
1008
1141
  },
1009
- async transaction(fn, _options) {
1142
+ async transaction(fn, options2) {
1143
+ const temporaryWrites = options2?.temporaryWrites === INTERNAL_TEMPORARY_WRITES;
1144
+ if (temporaryWrites && options2.accessMode !== "read_only") {
1145
+ throw new ConfigurationError(
1146
+ "Temporary-write transactions must be semantically read-only.",
1147
+ { dialect: "sqlite" }
1148
+ );
1149
+ }
1010
1150
  if (transactionMode === "none") {
1011
1151
  throwSqliteTransactionsDisabled(
1012
1152
  "This SQLite backend does not support atomic transactions. Operations within a transaction are not rolled back on failure. Use backend.capabilities.transactions to check for transaction support, or use individual operations with manual error handling."
@@ -1022,8 +1162,12 @@ function createSqliteBackend(db, options = {}) {
1022
1162
  profileHints: { isSync },
1023
1163
  tableNames,
1024
1164
  fulltextStrategy,
1025
- vectorStrategy});
1026
- await runFrameStatement(sql`BEGIN IMMEDIATE`);
1165
+ vectorStrategy,
1166
+ contributionMaterializer
1167
+ });
1168
+ await runFrameStatement(
1169
+ options2?.accessMode === "read_only" || temporaryWrites ? sql`BEGIN` : sql`BEGIN IMMEDIATE`
1170
+ );
1027
1171
  try {
1028
1172
  const result = await fn(
1029
1173
  gateFulltext(
@@ -1048,7 +1192,7 @@ function createSqliteBackend(db, options = {}) {
1048
1192
  return runWithSerializedQueue(
1049
1193
  serializedQueue,
1050
1194
  async () => db.transaction(async (tx) => fn(bindTransactionBackend(tx), tx), {
1051
- behavior: "immediate"
1195
+ behavior: options2?.accessMode === "read_only" || temporaryWrites ? "deferred" : "immediate"
1052
1196
  })
1053
1197
  );
1054
1198
  },
@@ -1084,10 +1228,10 @@ function createTransactionBackend(options) {
1084
1228
  tableNames: options.tableNames,
1085
1229
  fulltextStrategy: options.fulltextStrategy,
1086
1230
  vectorStrategy: options.vectorStrategy,
1087
- ...options.vectorStrategy === void 0 ? {} : { vectorSlotLatch: createVectorSlotLatch() }
1231
+ contributionMaterializer: options.contributionMaterializer
1088
1232
  });
1089
1233
  }
1090
1234
 
1091
1235
  export { createSqliteBackend };
1092
- //# sourceMappingURL=chunk-BJVEU3ZL.js.map
1093
- //# sourceMappingURL=chunk-BJVEU3ZL.js.map
1236
+ //# sourceMappingURL=chunk-UV3WP5WZ.js.map
1237
+ //# sourceMappingURL=chunk-UV3WP5WZ.js.map