@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,12 +1,11 @@
1
- import { tables, createVectorSlotLatch, createPostgresOperationStrategy, createCachedTableExistence, createContributionMaterializer, gateFulltextMethods, EMBEDDING_UPSERT_PARAM_COUNT, createCommonOperationBackend, vectorSlotFromParams, hybridCandidatesRef, mapVectorWriteError, mapHybridSearchRow, generatePgCreateTableSQL, mapContributionMaterializationRow, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, buildContributionInsertValues, buildContributionOnConflictSet, assertAdoptedDialect, buildKindRemovalInsertValues, POSTGRES_KIND_REMOVAL_TIMESTAMPS, buildKindRemovalOnConflictSet, mapKindRemovalRow, buildMaterializationInsertValues, POSTGRES_INDEX_MAT_TIMESTAMPS, buildMaterializationOnConflictSet, mapMaterializationRow, generatePostgresDDL, vectorSlotFromDropIndexParams, vectorSlotFromCreateIndexParams, gateFulltext, compileQueryWithDialect, getOrCreateLru } from './chunk-4GX2JJXS.js';
2
- import { pgvectorStrategy, assertPgvectorEfSearch } from './chunk-Q5TEXCTB.js';
3
- import { createNodeRowMapper, POSTGRES_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper, quoteIdentifier, nowIso, coerceNumericScore } from './chunk-RAXU3RMB.js';
4
- import { tsvectorStrategy, assertVectorSearchLimit, buildFulltextCapabilities, buildVectorCapabilities } from './chunk-FPIZFYHE.js';
5
- import { shouldForceCustomPlan, annIndexScanTypes } from './chunk-UT3S4SEN.js';
6
- import { POSTGRES_MAX_BIND_PARAMETERS, POSTGRES_CAPABILITIES, chunk } from './chunk-IU46OHVW.js';
7
- import { isMissingTableError, isInsufficientResourcesError } from './chunk-JFUPDJXD.js';
8
- import { ConfigurationError, CompilerInvariantError, TransactionClosedError } from './chunk-WI7ISNQF.js';
9
- import { getTableName, sql, and, eq, isNull, inArray } from 'drizzle-orm';
1
+ import { tables, createPostgresOperationStrategy, createCachedTableExistence, createContributionMaterializer, gateFulltextMethods, lockPostgresTrustedImportTables, assertTrustedImportDatabaseEmpty, suspendPostgresSecondaryIndexes, createPostgresTrustedImportSession, restoreSecondaryIndexes, analyzeImportedTables, EMBEDDING_UPSERT_PARAM_COUNT, createCommonOperationBackend, vectorSlotFromParams, hybridCandidatesRef, mapVectorWriteError, mapHybridSearchRow, generatePgCreateTableSQL, mapContributionMaterializationRow, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, buildContributionInsertValues, buildContributionOnConflictSet, assertAdoptedDialect, buildKindRemovalInsertValues, POSTGRES_KIND_REMOVAL_TIMESTAMPS, buildKindRemovalOnConflictSet, mapKindRemovalRow, buildMaterializationInsertValues, POSTGRES_INDEX_MAT_TIMESTAMPS, buildMaterializationOnConflictSet, mapMaterializationRow, generatePostgresDDL, vectorSlotFromDropIndexParams, vectorSlotFromCreateIndexParams, gateFulltext, compileQueryWithDialect, getOrCreateLru } from './chunk-K3Q3LJY3.js';
2
+ import { pgvectorStrategy, assertPgvectorEfSearch } from './chunk-5KPNWT6X.js';
3
+ import { createNodeRowMapper, POSTGRES_ROW_MAPPER_CONFIG, createEdgeRowMapper, createUniqueRowMapper, createSchemaVersionRowMapper, quoteIdentifier, nowIso, coerceNumericScore } from './chunk-M6VES7V6.js';
4
+ import { tsvectorStrategy, assertVectorSearchLimit, buildFulltextCapabilities, buildVectorCapabilities } from './chunk-EXU3RASM.js';
5
+ import { normalizeGraphAnalyticsCapabilities, createBackendOverlay, POSTGRES_MAX_BIND_PARAMETERS, INTERNAL_TEMPORARY_WRITES, POSTGRES_CAPABILITIES, shouldForceCustomPlan, chunk, annIndexScanTypes } from './chunk-44TA22QT.js';
6
+ import { isMissingTableError, isInsufficientResourcesError } from './chunk-XGPUQ56G.js';
7
+ import { ConfigurationError, CompilerInvariantError, TransactionClosedError } from './chunk-5PNMDJ7J.js';
8
+ import { getTableName, sql, eq, and, isNull, inArray } from 'drizzle-orm';
10
9
  import { PgDatabase, PgTransaction } from 'drizzle-orm/pg-core';
11
10
 
12
11
  // src/backend/drizzle/execution/postgres-execution.ts
@@ -23,8 +22,14 @@ function isPgNativeClient(candidate) {
23
22
  function isPgliteClient(candidate) {
24
23
  return typeof candidate === "object" && hasFunctionProperty(candidate, "query") && hasFunctionProperty(candidate, "dumpDataDir");
25
24
  }
25
+ function transactionSession(carrier) {
26
+ return carrier.session ?? carrier._?.session;
27
+ }
28
+ function hasPgliteSession(carrier) {
29
+ return transactionSession(carrier)?.constructor?.name === "PgliteSession";
30
+ }
26
31
  function isPostgresJsClient(candidate) {
27
- return typeof candidate === "function" && hasFunctionProperty(candidate, "unsafe") && hasFunctionProperty(candidate, "begin");
32
+ return typeof candidate === "function" && hasFunctionProperty(candidate, "unsafe") && (hasFunctionProperty(candidate, "begin") || hasFunctionProperty(candidate, "savepoint"));
28
33
  }
29
34
  function isNeonHttpClient(db) {
30
35
  const candidate = db.$client;
@@ -103,12 +108,14 @@ function adaptPostgresJsClient(sql2) {
103
108
  }
104
109
  };
105
110
  }
106
- function resolvePgClient(db, prepareStatements, cacheMax) {
111
+ function resolvePgClient(db, prepareStatements, cacheMax, useTransactionClient) {
107
112
  if (isNeonHttpClient(db)) {
108
113
  return void 0;
109
114
  }
110
- const client = db.$client;
111
- if (isPgliteClient(client)) {
115
+ const carrier = db;
116
+ const client = carrier.$client ?? (useTransactionClient ? transactionSession(carrier)?.client : void 0);
117
+ if (isPgliteClient(client) || useTransactionClient && hasPgliteSession(carrier)) {
118
+ if (!isPgNativeClient(client)) return void 0;
112
119
  return wrapNodePgClientUnnamed(client);
113
120
  }
114
121
  if (isPgNativeClient(client)) {
@@ -137,7 +144,12 @@ function createPgPreparedStatement(pgClient, sqlText) {
137
144
  function createPostgresExecutionAdapter(db, options = {}) {
138
145
  const prepareStatements = options.prepareStatements ?? true;
139
146
  const cacheMax = options.preparedStatementCacheMax ?? DEFAULT_POSTGRES_STATEMENT_CACHE_MAX;
140
- const pgClient = resolvePgClient(db, prepareStatements, cacheMax);
147
+ const pgClient = resolvePgClient(
148
+ db,
149
+ prepareStatements,
150
+ cacheMax,
151
+ options.useTransactionClient ?? false
152
+ );
141
153
  function compile(query) {
142
154
  return compileQueryWithDialect(db, query, "PostgreSQL");
143
155
  }
@@ -284,18 +296,23 @@ function createPostgresBackend(db, options = {}) {
284
296
  const tables2 = options.tables ?? tables;
285
297
  const fulltextStrategy = options.fulltext ?? tsvectorStrategy;
286
298
  const vectorStrategy = options.vector === false ? void 0 : options.vector ?? pgvectorStrategy;
287
- const vectorSlotLatch = vectorStrategy === void 0 ? void 0 : createVectorSlotLatch();
288
299
  const iterativeScanProbe = createIterativeScanProbe();
289
300
  const baseCapabilities = buildPostgresCapabilities(
290
301
  fulltextStrategy,
291
302
  vectorStrategy
292
303
  );
293
- const httpOnlyOverrides = isNeonHttpClient(db) ? { transactions: false } : {};
294
- const capabilities = {
304
+ const httpOnlyOverrides = isNeonHttpClient(db) ? {
305
+ transactions: false,
306
+ graphAnalytics: {
307
+ ...baseCapabilities.graphAnalytics ?? { mathFunctions: true },
308
+ supported: false
309
+ }
310
+ } : {};
311
+ const capabilities = normalizeGraphAnalyticsCapabilities({
295
312
  ...baseCapabilities,
296
313
  ...httpOnlyOverrides,
297
314
  ...options.capabilities
298
- };
315
+ });
299
316
  const adapterOptions = {
300
317
  ...options.prepareStatements === void 0 ? {} : { prepareStatements: options.prepareStatements },
301
318
  ...options.preparedStatementCacheMax === void 0 ? {} : { preparedStatementCacheMax: options.preparedStatementCacheMax }
@@ -326,18 +343,6 @@ function createPostgresBackend(db, options = {}) {
326
343
  tables2,
327
344
  fulltextStrategy
328
345
  );
329
- const operations = createPostgresOperationBackend({
330
- db,
331
- executionAdapter,
332
- adapterOptions,
333
- operationStrategy,
334
- tableNames,
335
- capabilities,
336
- fulltextStrategy,
337
- vectorStrategy,
338
- vectorSlotLatch,
339
- iterativeScanProbe
340
- });
341
346
  const recordedTableExists = createCachedTableExistence(
342
347
  async (tableName) => {
343
348
  const rows = await executionAdapter.execute(
@@ -347,36 +352,6 @@ function createPostgresBackend(db, options = {}) {
347
352
  },
348
353
  { cacheExisting: false }
349
354
  );
350
- function runSchemaWriteTransaction(graphId, fn) {
351
- if (!capabilities.transactions) {
352
- throw new ConfigurationError(
353
- "commitSchemaVersion and setActiveVersion require atomic transactions, but this Postgres backend does not provide them. The drizzle-orm/neon-http driver communicates over HTTP and cannot hold a session across statements; use drizzle-orm/neon-serverless (websocket) for transactional writes.",
354
- {
355
- backend: "postgres",
356
- capability: "transactions",
357
- supportsTransactions: false
358
- }
359
- );
360
- }
361
- return db.transaction(async (tx) => {
362
- await tx.execute(sql`SELECT pg_advisory_xact_lock(hashtext(${graphId}))`);
363
- const { backend: txBackend, drainAndClose } = createTransactionBackend({
364
- db: tx,
365
- adapterOptions,
366
- operationStrategy,
367
- tableNames,
368
- capabilities,
369
- fulltextStrategy,
370
- vectorStrategy,
371
- iterativeScanProbe
372
- });
373
- try {
374
- return await fn(txBackend);
375
- } finally {
376
- await drainAndClose();
377
- }
378
- });
379
- }
380
355
  const matTable = tables2.contributionMaterializations;
381
356
  async function ensureContributionMaterializationsTableImpl() {
382
357
  await db.execute(sql.raw(generatePgCreateTableSQL(matTable)));
@@ -397,6 +372,15 @@ function createPostgresBackend(db, options = {}) {
397
372
  POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
398
373
  );
399
374
  }
375
+ async function getContributionMaterializationRows(graphId) {
376
+ const rows = await db.select().from(matTable).where(eq(matTable.graphId, graphId));
377
+ return rows.map(
378
+ (row) => mapContributionMaterializationRow(
379
+ row,
380
+ POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS.decode
381
+ )
382
+ );
383
+ }
400
384
  async function recordContributionMaterializationRow(params) {
401
385
  await db.insert(matTable).values(
402
386
  buildContributionInsertValues(
@@ -416,17 +400,72 @@ function createPostgresBackend(db, options = {}) {
416
400
  )
417
401
  });
418
402
  }
403
+ async function deleteContributionMaterializationRow(identity) {
404
+ await db.delete(matTable).where(
405
+ and(
406
+ eq(matTable.graphId, identity.graphId),
407
+ eq(matTable.logicalName, identity.logicalName),
408
+ eq(matTable.owner, identity.owner),
409
+ eq(matTable.tableName, identity.tableName)
410
+ )
411
+ );
412
+ }
419
413
  const contributionMaterializer = createContributionMaterializer({
420
414
  dialect: "postgres",
421
415
  fulltextStrategy,
422
416
  fulltextTableName: tables2.fulltextTableName,
417
+ vectorStrategy,
423
418
  execDdl: async (statement) => {
424
419
  await db.execute(sql.raw(statement));
425
420
  },
426
421
  ensureMarkerTable: ensureContributionMaterializationsTableImpl,
427
- getMarker: getContributionMaterializationRow,
428
- recordMarker: recordContributionMaterializationRow
422
+ getMarkers: getContributionMaterializationRows,
423
+ recordMarker: recordContributionMaterializationRow,
424
+ deleteMarker: deleteContributionMaterializationRow
429
425
  });
426
+ const operations = createPostgresOperationBackend({
427
+ db,
428
+ executionAdapter,
429
+ adapterOptions,
430
+ operationStrategy,
431
+ tableNames,
432
+ capabilities,
433
+ fulltextStrategy,
434
+ vectorStrategy,
435
+ contributionMaterializer,
436
+ iterativeScanProbe
437
+ });
438
+ function runSchemaWriteTransaction(graphId, fn) {
439
+ if (!capabilities.transactions) {
440
+ throw new ConfigurationError(
441
+ "commitSchemaVersion and setActiveVersion require atomic transactions, but this Postgres backend does not provide them. The drizzle-orm/neon-http driver communicates over HTTP and cannot hold a session across statements; use drizzle-orm/neon-serverless (websocket) for transactional writes.",
442
+ {
443
+ backend: "postgres",
444
+ capability: "transactions",
445
+ supportsTransactions: false
446
+ }
447
+ );
448
+ }
449
+ return db.transaction(async (tx) => {
450
+ await tx.execute(sql`SELECT pg_advisory_xact_lock(hashtext(${graphId}))`);
451
+ const { backend: txBackend, drainAndClose } = createTransactionBackend({
452
+ db: tx,
453
+ adapterOptions,
454
+ operationStrategy,
455
+ tableNames,
456
+ capabilities,
457
+ fulltextStrategy,
458
+ vectorStrategy,
459
+ contributionMaterializer,
460
+ iterativeScanProbe
461
+ });
462
+ try {
463
+ return await fn(txBackend);
464
+ } finally {
465
+ await drainAndClose();
466
+ }
467
+ });
468
+ }
430
469
  function bindTransactionBackend(tx) {
431
470
  const { backend: backend2, drainAndClose } = createTransactionBackend({
432
471
  db: tx,
@@ -436,6 +475,7 @@ function createPostgresBackend(db, options = {}) {
436
475
  capabilities,
437
476
  fulltextStrategy,
438
477
  vectorStrategy,
478
+ contributionMaterializer,
439
479
  iterativeScanProbe
440
480
  });
441
481
  return {
@@ -448,6 +488,40 @@ function createPostgresBackend(db, options = {}) {
448
488
  }
449
489
  const backend = {
450
490
  ...operations,
491
+ ...capabilities.transactions && executionAdapter.executeCompiled !== void 0 ? {
492
+ async trustedImport(fn) {
493
+ return backend.transaction(async (tx, rawSql) => {
494
+ const trustedExecutionAdapter = createPostgresExecutionAdapter(
495
+ rawSql,
496
+ { ...adapterOptions, useTransactionClient: true }
497
+ );
498
+ const executeCompiled = trustedExecutionAdapter.executeCompiled;
499
+ if (executeCompiled === void 0) {
500
+ throw new ConfigurationError(
501
+ "Trusted import could not bind raw execution to the PostgreSQL transaction.",
502
+ { capability: "trustedImport", dialect: "postgres" }
503
+ );
504
+ }
505
+ const trustedTx = createBackendOverlay(tx, {
506
+ executeRaw(sqlText, params) {
507
+ return executeCompiled({ params, sql: sqlText });
508
+ }
509
+ });
510
+ await lockPostgresTrustedImportTables(trustedTx, tableNames);
511
+ await assertTrustedImportDatabaseEmpty(trustedTx, tableNames);
512
+ const indexDefinitions = await suspendPostgresSecondaryIndexes(
513
+ trustedTx,
514
+ tableNames
515
+ );
516
+ const result = await fn(
517
+ createPostgresTrustedImportSession(trustedTx, tableNames)
518
+ );
519
+ await restoreSecondaryIndexes(trustedTx, indexDefinitions);
520
+ await analyzeImportedTables(trustedTx, tableNames);
521
+ return result;
522
+ });
523
+ }
524
+ } : {},
451
525
  async bootstrapTables() {
452
526
  const statements = generatePostgresDDL(tables2, fulltextStrategy);
453
527
  for (const statement of statements) {
@@ -544,10 +618,7 @@ function createPostgresBackend(db, options = {}) {
544
618
  )
545
619
  ).onConflictDoUpdate({
546
620
  target: t.indexName,
547
- set: buildMaterializationOnConflictSet(
548
- t.materializedAt,
549
- params.materializedAt
550
- )
621
+ set: buildMaterializationOnConflictSet(params.materializedAt)
551
622
  });
552
623
  },
553
624
  async ensureContributionMaterializationsTable() {
@@ -607,6 +678,27 @@ function createPostgresBackend(db, options = {}) {
607
678
  async ensureFulltextTable(graphId) {
608
679
  await contributionMaterializer.ensureRuntimeContributions(graphId);
609
680
  },
681
+ // Vector counterparts of the runtime-contribution methods. Present
682
+ // only when a vector strategy is wired (omitted under `vector: false`,
683
+ // mirroring the embedding/search methods), so a no-vector backend
684
+ // doesn't advertise vector materialization it can't perform.
685
+ ...vectorStrategy === void 0 ? {} : {
686
+ async ensureVectorSlotContribution(slot, options_) {
687
+ await contributionMaterializer.ensureVectorSlot(slot, options_);
688
+ },
689
+ async ensureVectorSlotContributions(slots, options_) {
690
+ await contributionMaterializer.ensureVectorSlots(slots, options_);
691
+ },
692
+ async assertVectorSlotInitialized(slot) {
693
+ await contributionMaterializer.assertVectorSlot(slot);
694
+ },
695
+ async assertVectorSlotsInitialized(slots) {
696
+ await contributionMaterializer.assertVectorSlots(slots);
697
+ },
698
+ async deleteVectorSlotContribution(slot) {
699
+ await contributionMaterializer.dropVectorSlot(slot);
700
+ }
701
+ },
610
702
  async getReconciliationMarker(graphId) {
611
703
  const t = tables2.reconciliationMarkers;
612
704
  const rows = await db.select().from(t).where(eq(t.graphId, graphId));
@@ -649,8 +741,20 @@ function createPostgresBackend(db, options = {}) {
649
741
  );
650
742
  },
651
743
  async transaction(fn, options2) {
652
- const txConfig = options2?.isolationLevel ? {
653
- isolationLevel: options2.isolationLevel.replace("_", " ")
744
+ const temporaryWrites = options2?.temporaryWrites === INTERNAL_TEMPORARY_WRITES;
745
+ if (temporaryWrites && options2.accessMode !== "read_only") {
746
+ throw new ConfigurationError(
747
+ "Temporary-write transactions must be semantically read-only.",
748
+ { dialect: "postgres" }
749
+ );
750
+ }
751
+ const txConfig = options2?.isolationLevel !== void 0 || options2?.accessMode !== void 0 || temporaryWrites ? {
752
+ ...options2.isolationLevel === void 0 ? {} : {
753
+ isolationLevel: options2.isolationLevel.replace("_", " ")
754
+ },
755
+ ...options2.accessMode === void 0 && !temporaryWrites ? {} : {
756
+ accessMode: temporaryWrites ? "read write" : options2.accessMode.replace("_", " ")
757
+ }
654
758
  } : void 0;
655
759
  return db.transaction(async (tx) => {
656
760
  const { backend: txBackend, drainAndClose } = bindTransactionBackend(tx);
@@ -723,7 +827,7 @@ function createPostgresOperationBackend(options) {
723
827
  capabilities,
724
828
  fulltextStrategy,
725
829
  vectorStrategy,
726
- vectorSlotLatch,
830
+ contributionMaterializer,
727
831
  iterativeScanProbe
728
832
  } = options;
729
833
  async function execAll(query) {
@@ -819,12 +923,6 @@ function createPostgresOperationBackend(options) {
819
923
  return txAdapter.execute(query);
820
924
  });
821
925
  }
822
- async function ensureVectorSlotStorage(slot) {
823
- if (vectorStrategy === void 0 || vectorSlotLatch === void 0) return;
824
- await vectorSlotLatch.ensure(vectorStrategy, slot, async (statement) => {
825
- await execRun(sql.raw(statement));
826
- });
827
- }
828
926
  const batchConfig = {
829
927
  checkUniqueBatchChunkSize: POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE,
830
928
  edgeInsertBatchSize: POSTGRES_EDGE_INSERT_BATCH_SIZE,
@@ -868,7 +966,7 @@ function createPostgresOperationBackend(options) {
868
966
  const vectorEmbeddingMethods = vectorStrategy === void 0 ? {} : {
869
967
  async upsertEmbedding(params) {
870
968
  const slot = vectorSlotFromParams(params);
871
- await ensureVectorSlotStorage(slot);
969
+ await contributionMaterializer.assertVectorSlot(slot);
872
970
  const statements = vectorStrategy.buildUpsert(slot, params, nowIso());
873
971
  try {
874
972
  for (const statement of statements) {
@@ -881,7 +979,7 @@ function createPostgresOperationBackend(options) {
881
979
  async upsertEmbeddingBatch(params) {
882
980
  if (params.rows.length === 0) return;
883
981
  const slot = vectorSlotFromParams(params);
884
- await ensureVectorSlotStorage(slot);
982
+ await contributionMaterializer.assertVectorSlot(slot);
885
983
  const rowsById = new Map(
886
984
  params.rows.map((row) => [row.nodeId, row])
887
985
  );
@@ -922,7 +1020,7 @@ function createPostgresOperationBackend(options) {
922
1020
  },
923
1021
  async deleteEmbedding(params) {
924
1022
  const slot = vectorSlotFromParams(params);
925
- await ensureVectorSlotStorage(slot);
1023
+ await contributionMaterializer.assertVectorSlot(slot);
926
1024
  const statements = vectorStrategy.buildDelete(slot, params);
927
1025
  for (const statement of statements) {
928
1026
  await execRun(statement);
@@ -932,7 +1030,6 @@ function createPostgresOperationBackend(options) {
932
1030
  assertVectorSearchLimit(params.limit);
933
1031
  assertPgvectorEfSearch(params.efSearch);
934
1032
  const slot = vectorSlotFromParams(params);
935
- await ensureVectorSlotStorage(slot);
936
1033
  const query = vectorStrategy.buildSearch(
937
1034
  slot,
938
1035
  params,
@@ -971,7 +1068,6 @@ function createPostgresOperationBackend(options) {
971
1068
  metric: params.vector.metric,
972
1069
  indexType: params.vector.indexType
973
1070
  });
974
- await ensureVectorSlotStorage(slot);
975
1071
  const candidates = params.candidates ?? operationStrategy.buildLiveNodeIds(
976
1072
  params.graphId,
977
1073
  params.nodeKind
@@ -1027,7 +1123,7 @@ function createPostgresOperationBackend(options) {
1027
1123
  async createVectorIndex(params) {
1028
1124
  if (vectorStrategy === void 0) return;
1029
1125
  const slot = vectorSlotFromCreateIndexParams(params);
1030
- await ensureVectorSlotStorage(slot);
1126
+ await contributionMaterializer.ensureVectorSlot(slot);
1031
1127
  const indexStatement = vectorStrategy.buildCreateIndex?.(slot, {
1032
1128
  concurrent: params.concurrent === true
1033
1129
  });
@@ -1047,9 +1143,7 @@ function createPostgresOperationBackend(options) {
1047
1143
  slot.fieldPath
1048
1144
  )
1049
1145
  );
1050
- await execRun(
1051
- sql`ALTER TABLE ${table} SET (parallel_workers = 0)`
1052
- );
1146
+ await execRun(sql`ALTER TABLE ${table} SET (parallel_workers = 0)`);
1053
1147
  try {
1054
1148
  await execRun(indexStatement);
1055
1149
  } finally {
@@ -1134,9 +1228,7 @@ function createPostgresOperationBackend(options) {
1134
1228
  const overrides = [];
1135
1229
  for (const indexType of annTypes) {
1136
1230
  if (indexType !== "hnsw" && indexType !== "ivfflat") continue;
1137
- overrides.push(
1138
- ...await vectorSearchGucOverrides({ indexType })
1139
- );
1231
+ overrides.push(...await vectorSearchGucOverrides({ indexType }));
1140
1232
  }
1141
1233
  return runVectorSearch(overrides, query);
1142
1234
  }
@@ -1161,14 +1253,14 @@ function createTransactionBackend(options) {
1161
1253
  capabilities: options.capabilities,
1162
1254
  fulltextStrategy: options.fulltextStrategy,
1163
1255
  vectorStrategy: options.vectorStrategy,
1164
- vectorSlotLatch: options.vectorStrategy === void 0 ? void 0 : createVectorSlotLatch(),
1165
- // The probe is process-wide truth, so — unlike the slot latch — the outer
1166
- // instance's is reused rather than a fresh one per transaction.
1256
+ contributionMaterializer: options.contributionMaterializer,
1257
+ // The probe is process-wide truth, so the outer instance's is reused
1258
+ // rather than a fresh one per transaction.
1167
1259
  iterativeScanProbe: options.iterativeScanProbe
1168
1260
  });
1169
1261
  return { backend, drainAndClose: txExecutionAdapter.drainAndClose };
1170
1262
  }
1171
1263
 
1172
1264
  export { createPostgresBackend };
1173
- //# sourceMappingURL=chunk-VQEXF5D4.js.map
1174
- //# sourceMappingURL=chunk-VQEXF5D4.js.map
1265
+ //# sourceMappingURL=chunk-IXGYRP2P.js.map
1266
+ //# sourceMappingURL=chunk-IXGYRP2P.js.map