@nicia-ai/typegraph 0.38.0 → 0.40.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 (254) hide show
  1. package/dist/backend/drizzle/indexes.cjs +8 -10
  2. package/dist/backend/drizzle/indexes.d.cts +2 -2
  3. package/dist/backend/drizzle/indexes.d.ts +2 -2
  4. package/dist/backend/drizzle/indexes.js +4 -6
  5. package/dist/backend/index.cjs +60 -39
  6. package/dist/backend/index.d.cts +60 -1
  7. package/dist/backend/index.d.ts +60 -1
  8. package/dist/backend/index.js +12 -3
  9. package/dist/backend/postgres/index.cjs +25 -27
  10. package/dist/backend/postgres/index.d.cts +6 -6
  11. package/dist/backend/postgres/index.d.ts +6 -6
  12. package/dist/backend/postgres/index.js +12 -14
  13. package/dist/backend/postgres/pglite-store.cjs +26 -27
  14. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  15. package/dist/backend/postgres/pglite-store.d.cts +6 -5
  16. package/dist/backend/postgres/pglite-store.d.ts +6 -5
  17. package/dist/backend/postgres/pglite-store.js +22 -23
  18. package/dist/backend/postgres/pglite-store.js.map +1 -1
  19. package/dist/backend/postgres/pglite.cjs +14 -16
  20. package/dist/backend/postgres/pglite.d.cts +3 -3
  21. package/dist/backend/postgres/pglite.d.ts +3 -3
  22. package/dist/backend/postgres/pglite.js +13 -15
  23. package/dist/backend/sqlite/index.cjs +26 -28
  24. package/dist/backend/sqlite/index.d.cts +6 -6
  25. package/dist/backend/sqlite/index.d.ts +6 -6
  26. package/dist/backend/sqlite/index.js +10 -12
  27. package/dist/backend/sqlite/libsql.cjs +16 -18
  28. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  29. package/dist/backend/sqlite/libsql.d.cts +3 -3
  30. package/dist/backend/sqlite/libsql.d.ts +3 -3
  31. package/dist/backend/sqlite/libsql.js +15 -17
  32. package/dist/backend/sqlite/libsql.js.map +1 -1
  33. package/dist/backend/sqlite/local-store.cjs +27 -28
  34. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  35. package/dist/backend/sqlite/local-store.d.cts +6 -5
  36. package/dist/backend/sqlite/local-store.d.ts +6 -5
  37. package/dist/backend/sqlite/local-store.js +23 -24
  38. package/dist/backend/sqlite/local-store.js.map +1 -1
  39. package/dist/backend/sqlite/local.cjs +15 -17
  40. package/dist/backend/sqlite/local.d.cts +3 -3
  41. package/dist/backend/sqlite/local.d.ts +3 -3
  42. package/dist/backend/sqlite/local.js +13 -15
  43. package/dist/{chunk-U4JDJKPD.js → chunk-2I3DNNBU.js} +4 -4
  44. package/dist/{chunk-U4JDJKPD.js.map → chunk-2I3DNNBU.js.map} +1 -1
  45. package/dist/{chunk-NPWACFQJ.cjs → chunk-2J5NMMVR.cjs} +43 -43
  46. package/dist/{chunk-NPWACFQJ.cjs.map → chunk-2J5NMMVR.cjs.map} +1 -1
  47. package/dist/{chunk-NU23DUSJ.cjs → chunk-2X73QTIC.cjs} +12 -13
  48. package/dist/chunk-2X73QTIC.cjs.map +1 -0
  49. package/dist/{chunk-A2FGSWMQ.js → chunk-3BL3JFHL.js} +202 -52
  50. package/dist/chunk-3BL3JFHL.js.map +1 -0
  51. package/dist/chunk-3SHAUJRB.js +79 -0
  52. package/dist/chunk-3SHAUJRB.js.map +1 -0
  53. package/dist/{chunk-UPXDVI3T.js → chunk-53BSOG3O.js} +8 -7
  54. package/dist/chunk-53BSOG3O.js.map +1 -0
  55. package/dist/chunk-5J4VNCUD.js +856 -0
  56. package/dist/chunk-5J4VNCUD.js.map +1 -0
  57. package/dist/chunk-5YBDB7UG.cjs +12 -0
  58. package/dist/{chunk-FMNUSGZ4.cjs.map → chunk-5YBDB7UG.cjs.map} +1 -1
  59. package/dist/{chunk-6XDBRDZE.js → chunk-6N7QBIWN.js} +7 -3
  60. package/dist/chunk-6N7QBIWN.js.map +1 -0
  61. package/dist/{chunk-EZH7FNUS.js → chunk-6QP4QXBR.js} +3 -3
  62. package/dist/{chunk-EZH7FNUS.js.map → chunk-6QP4QXBR.js.map} +1 -1
  63. package/dist/{chunk-E6TXEISH.cjs → chunk-7UTUKH4E.cjs} +4 -4
  64. package/dist/{chunk-E6TXEISH.cjs.map → chunk-7UTUKH4E.cjs.map} +1 -1
  65. package/dist/chunk-7WLEQIHA.cjs +605 -0
  66. package/dist/chunk-7WLEQIHA.cjs.map +1 -0
  67. package/dist/{chunk-BQITNFQJ.js → chunk-AQVDAKXH.js} +3 -3
  68. package/dist/{chunk-BQITNFQJ.js.map → chunk-AQVDAKXH.js.map} +1 -1
  69. package/dist/{chunk-X6CNEA32.js → chunk-BUZWMDNL.js} +5 -5
  70. package/dist/{chunk-X6CNEA32.js.map → chunk-BUZWMDNL.js.map} +1 -1
  71. package/dist/{chunk-7M3NACL3.cjs → chunk-CKFBZ4LV.cjs} +4 -4
  72. package/dist/{chunk-7M3NACL3.cjs.map → chunk-CKFBZ4LV.cjs.map} +1 -1
  73. package/dist/{chunk-VBH7ZXSZ.js → chunk-CU3LPYNB.js} +5 -5
  74. package/dist/{chunk-VBH7ZXSZ.js.map → chunk-CU3LPYNB.js.map} +1 -1
  75. package/dist/{chunk-YJDSPA5E.js → chunk-EFZ4S22A.js} +11 -10
  76. package/dist/chunk-EFZ4S22A.js.map +1 -0
  77. package/dist/chunk-ELA3V6UN.js +601 -0
  78. package/dist/chunk-ELA3V6UN.js.map +1 -0
  79. package/dist/{chunk-2SL7OGPR.cjs → chunk-H6I36MGT.cjs} +1037 -887
  80. package/dist/chunk-H6I36MGT.cjs.map +1 -0
  81. package/dist/chunk-HAQVISUF.cjs +1098 -0
  82. package/dist/chunk-HAQVISUF.cjs.map +1 -0
  83. package/dist/{chunk-O5H62ZWJ.cjs → chunk-HP6LWBLB.cjs} +14 -2
  84. package/dist/chunk-HP6LWBLB.cjs.map +1 -0
  85. package/dist/{chunk-BKAKAVRW.cjs → chunk-HQRZEYYB.cjs} +44 -44
  86. package/dist/{chunk-BKAKAVRW.cjs.map → chunk-HQRZEYYB.cjs.map} +1 -1
  87. package/dist/{chunk-XD6X7O5R.js → chunk-I5CRUPKO.js} +9 -10
  88. package/dist/{chunk-XD6X7O5R.js.map → chunk-I5CRUPKO.js.map} +1 -1
  89. package/dist/{chunk-RQPRCEIO.js → chunk-JHK6NPFV.js} +218 -306
  90. package/dist/chunk-JHK6NPFV.js.map +1 -0
  91. package/dist/chunk-JZYMOHHM.cjs +226 -0
  92. package/dist/chunk-JZYMOHHM.cjs.map +1 -0
  93. package/dist/{chunk-CQC6VBAF.cjs → chunk-K4FB2RMO.cjs} +10 -10
  94. package/dist/{chunk-CQC6VBAF.cjs.map → chunk-K4FB2RMO.cjs.map} +1 -1
  95. package/dist/{chunk-ERZ4QPQX.js → chunk-K6CD6W5J.js} +5 -5
  96. package/dist/{chunk-ERZ4QPQX.js.map → chunk-K6CD6W5J.js.map} +1 -1
  97. package/dist/{chunk-LZ3TVJY4.cjs → chunk-KHNKYSGP.cjs} +34 -34
  98. package/dist/{chunk-LZ3TVJY4.cjs.map → chunk-KHNKYSGP.cjs.map} +1 -1
  99. package/dist/{chunk-CWX77JB4.cjs → chunk-KLR77R5A.cjs} +13 -13
  100. package/dist/{chunk-CWX77JB4.cjs.map → chunk-KLR77R5A.cjs.map} +1 -1
  101. package/dist/{chunk-AOL64O4Z.js → chunk-L3DDZUZP.js} +3 -3
  102. package/dist/{chunk-AOL64O4Z.js.map → chunk-L3DDZUZP.js.map} +1 -1
  103. package/dist/{chunk-PZHC5GCD.js → chunk-L5ET7FYQ.js} +3 -3
  104. package/dist/{chunk-PZHC5GCD.js.map → chunk-L5ET7FYQ.js.map} +1 -1
  105. package/dist/{chunk-B63IFHXR.cjs → chunk-LFFVD5ZR.cjs} +41 -41
  106. package/dist/{chunk-B63IFHXR.cjs.map → chunk-LFFVD5ZR.cjs.map} +1 -1
  107. package/dist/chunk-LL5D5T5W.cjs +157 -0
  108. package/dist/chunk-LL5D5T5W.cjs.map +1 -0
  109. package/dist/{chunk-GUUWKPTK.cjs → chunk-LLE25NRD.cjs} +7 -7
  110. package/dist/{chunk-GUUWKPTK.cjs.map → chunk-LLE25NRD.cjs.map} +1 -1
  111. package/dist/chunk-LLHMAHG4.cjs +886 -0
  112. package/dist/chunk-LLHMAHG4.cjs.map +1 -0
  113. package/dist/{chunk-ZHX4KEM7.cjs → chunk-M2RPZS7J.cjs} +10 -10
  114. package/dist/{chunk-ZHX4KEM7.cjs.map → chunk-M2RPZS7J.cjs.map} +1 -1
  115. package/dist/chunk-MNURF4RF.cjs +85 -0
  116. package/dist/chunk-MNURF4RF.cjs.map +1 -0
  117. package/dist/chunk-QOHTVDHU.js +144 -0
  118. package/dist/chunk-QOHTVDHU.js.map +1 -0
  119. package/dist/{chunk-7VLCN3JB.cjs → chunk-QXKVUJLI.cjs} +113 -112
  120. package/dist/chunk-QXKVUJLI.cjs.map +1 -0
  121. package/dist/{chunk-GNPGGLAE.cjs → chunk-QYDUCWD2.cjs} +4 -4
  122. package/dist/{chunk-GNPGGLAE.cjs.map → chunk-QYDUCWD2.cjs.map} +1 -1
  123. package/dist/{chunk-TE5ZA4VX.js → chunk-QZYGZVUI.js} +45 -41
  124. package/dist/chunk-QZYGZVUI.js.map +1 -0
  125. package/dist/{chunk-YLINFV7Z.cjs → chunk-SAMJLDGG.cjs} +114 -110
  126. package/dist/chunk-SAMJLDGG.cjs.map +1 -0
  127. package/dist/{chunk-DOVMTPKE.cjs → chunk-SE422RES.cjs} +27 -27
  128. package/dist/{chunk-DOVMTPKE.cjs.map → chunk-SE422RES.cjs.map} +1 -1
  129. package/dist/{chunk-NWYCOFEZ.cjs → chunk-UCHW2MGP.cjs} +332 -433
  130. package/dist/chunk-UCHW2MGP.cjs.map +1 -0
  131. package/dist/{chunk-XFY73JWD.cjs → chunk-UDS5DZNY.cjs} +498 -1098
  132. package/dist/chunk-UDS5DZNY.cjs.map +1 -0
  133. package/dist/{chunk-KFLXWVUJ.js → chunk-UUIBACKJ.js} +14 -3
  134. package/dist/chunk-UUIBACKJ.js.map +1 -0
  135. package/dist/{chunk-VDYA2HMS.js → chunk-VWEFXG73.js} +3 -3
  136. package/dist/{chunk-VDYA2HMS.js.map → chunk-VWEFXG73.js.map} +1 -1
  137. package/dist/{chunk-G32AO634.js → chunk-W66YCXWT.js} +464 -1048
  138. package/dist/chunk-W66YCXWT.js.map +1 -0
  139. package/dist/{chunk-E6YZRKMM.js → chunk-XMEYZYGE.js} +6 -6
  140. package/dist/{chunk-E6YZRKMM.js.map → chunk-XMEYZYGE.js.map} +1 -1
  141. package/dist/{chunk-G3CSQLLT.js → chunk-Y5UC3IXF.js} +461 -6
  142. package/dist/chunk-Y5UC3IXF.js.map +1 -0
  143. package/dist/{chunk-SDHV2MWU.js → chunk-YGX4PMG6.js} +5 -5
  144. package/dist/{chunk-SDHV2MWU.js.map → chunk-YGX4PMG6.js.map} +1 -1
  145. package/dist/{chunk-KCLZHYPU.cjs → chunk-YIX3BEBR.cjs} +86 -85
  146. package/dist/chunk-YIX3BEBR.cjs.map +1 -0
  147. package/dist/{chunk-X6RDQ5NB.cjs → chunk-YX3H63VV.cjs} +8 -2
  148. package/dist/chunk-YX3H63VV.cjs.map +1 -0
  149. package/dist/chunk-YYLMXERH.js +211 -0
  150. package/dist/chunk-YYLMXERH.js.map +1 -0
  151. package/dist/{chunk-6G5CQ6JX.js → chunk-ZE7E46IZ.js} +5 -5
  152. package/dist/{chunk-6G5CQ6JX.js.map → chunk-ZE7E46IZ.js.map} +1 -1
  153. package/dist/{chunk-Z2PPIVOO.js → chunk-ZVME6OSV.js} +5 -5
  154. package/dist/{chunk-Z2PPIVOO.js.map → chunk-ZVME6OSV.js.map} +1 -1
  155. package/dist/core/index.cjs +15 -3
  156. package/dist/core/index.d.cts +4 -3
  157. package/dist/core/index.d.ts +4 -3
  158. package/dist/core/index.js +2 -2
  159. package/dist/{ddl-Dx3Z0_WC.d.ts → ddl-BLEzHw6j.d.ts} +3 -3
  160. package/dist/{ddl-J6sDyABg.d.cts → ddl-KnCdF_le.d.cts} +3 -3
  161. package/dist/{define-graph-CzEvA_8F.d.cts → define-graph-Cv3CFwKm.d.cts} +1 -1
  162. package/dist/{define-graph-DRo9xpYN.d.ts → define-graph-DQnj3fNH.d.ts} +1 -1
  163. package/dist/graph-merge/index.cjs +40 -43
  164. package/dist/graph-merge/index.cjs.map +1 -1
  165. package/dist/graph-merge/index.d.cts +15 -9
  166. package/dist/graph-merge/index.d.ts +15 -9
  167. package/dist/graph-merge/index.js +19 -22
  168. package/dist/graph-merge/index.js.map +1 -1
  169. package/dist/index.cjs +143 -119
  170. package/dist/index.d.cts +12 -10
  171. package/dist/index.d.ts +12 -10
  172. package/dist/index.js +23 -23
  173. package/dist/indexes/index.cjs +12 -14
  174. package/dist/indexes/index.d.cts +5 -5
  175. package/dist/indexes/index.d.ts +5 -5
  176. package/dist/indexes/index.js +5 -7
  177. package/dist/interchange/index.cjs +29 -30
  178. package/dist/interchange/index.cjs.map +1 -1
  179. package/dist/interchange/index.d.cts +6 -5
  180. package/dist/interchange/index.d.ts +6 -5
  181. package/dist/interchange/index.js +10 -11
  182. package/dist/interchange/index.js.map +1 -1
  183. package/dist/{manager-CASfhmzV.d.ts → manager-DjE6Mhag.d.ts} +2 -2
  184. package/dist/{manager-nCEJiYBb.d.cts → manager-mqee5MVB.d.cts} +2 -2
  185. package/dist/{postgres-DMgIKQU-.d.cts → postgres-Bm4DyFQU.d.cts} +100 -49
  186. package/dist/{postgres-Cl1ZAN1G.d.ts → postgres-DtaVALOZ.d.ts} +100 -49
  187. package/dist/profiler/index.d.cts +8 -7
  188. package/dist/profiler/index.d.ts +8 -7
  189. package/dist/provenance/index.cjs +20 -20
  190. package/dist/provenance/index.d.cts +6 -5
  191. package/dist/provenance/index.d.ts +6 -5
  192. package/dist/provenance/index.js +7 -7
  193. package/dist/schema/index.cjs +26 -28
  194. package/dist/schema/index.cjs.map +1 -1
  195. package/dist/schema/index.d.cts +5 -5
  196. package/dist/schema/index.d.ts +5 -5
  197. package/dist/schema/index.js +7 -9
  198. package/dist/schema/index.js.map +1 -1
  199. package/dist/{temporal-DqtOEo_B.d.ts → searchable-BxlJQVFw.d.cts} +3 -58
  200. package/dist/{temporal-BC_NQV5Y.d.cts → searchable-ChJ29MCd.d.ts} +3 -58
  201. package/dist/{sqlite-BDkW39aa.d.cts → sqlite-DT6tTHOG.d.cts} +124 -97
  202. package/dist/{sqlite-CYfhvESj.d.ts → sqlite-m9Izphk_.d.ts} +124 -97
  203. package/dist/{store-view-BoHqdHjB.d.cts → store-view-C-buB8Q8.d.cts} +46 -31
  204. package/dist/{store-view-Ctq-3OHy.d.ts → store-view-CagdeyNn.d.ts} +46 -31
  205. package/dist/temporal-CyFsSPe8.d.ts +73 -0
  206. package/dist/temporal-Dn_JADWY.d.cts +73 -0
  207. package/dist/{types-CUevi_D1.d.ts → types-CYdXzZef.d.ts} +1 -1
  208. package/dist/{types-COq3-vMC.d.cts → types-CqSfMRW3.d.cts} +1 -1
  209. package/dist/{where-C92TXCzT.d.cts → where-C3-HRgUq.d.cts} +1 -1
  210. package/dist/{where-BdE_cYtx.d.ts → where-sQL4u5h-.d.ts} +1 -1
  211. package/package.json +1 -1
  212. package/dist/chunk-2SL7OGPR.cjs.map +0 -1
  213. package/dist/chunk-6XDBRDZE.js.map +0 -1
  214. package/dist/chunk-7VLCN3JB.cjs.map +0 -1
  215. package/dist/chunk-A2FGSWMQ.js.map +0 -1
  216. package/dist/chunk-DDCIXXOO.js +0 -9
  217. package/dist/chunk-DDCIXXOO.js.map +0 -1
  218. package/dist/chunk-DDCYVIVV.cjs +0 -44
  219. package/dist/chunk-DDCYVIVV.cjs.map +0 -1
  220. package/dist/chunk-EOJFGECD.cjs +0 -284
  221. package/dist/chunk-EOJFGECD.cjs.map +0 -1
  222. package/dist/chunk-FMNUSGZ4.cjs +0 -12
  223. package/dist/chunk-G32AO634.js.map +0 -1
  224. package/dist/chunk-G3CSQLLT.js.map +0 -1
  225. package/dist/chunk-I6FX7AAG.js +0 -39
  226. package/dist/chunk-I6FX7AAG.js.map +0 -1
  227. package/dist/chunk-J6IJARLG.js +0 -94
  228. package/dist/chunk-J6IJARLG.js.map +0 -1
  229. package/dist/chunk-KCLZHYPU.cjs.map +0 -1
  230. package/dist/chunk-KFLXWVUJ.js.map +0 -1
  231. package/dist/chunk-MTNEGGM2.js +0 -273
  232. package/dist/chunk-MTNEGGM2.js.map +0 -1
  233. package/dist/chunk-NU23DUSJ.cjs.map +0 -1
  234. package/dist/chunk-NWYCOFEZ.cjs.map +0 -1
  235. package/dist/chunk-O5H62ZWJ.cjs.map +0 -1
  236. package/dist/chunk-RQPRCEIO.js.map +0 -1
  237. package/dist/chunk-SVUKGWSN.cjs +0 -102
  238. package/dist/chunk-SVUKGWSN.cjs.map +0 -1
  239. package/dist/chunk-TE5ZA4VX.js.map +0 -1
  240. package/dist/chunk-UH2USOMG.cjs +0 -627
  241. package/dist/chunk-UH2USOMG.cjs.map +0 -1
  242. package/dist/chunk-UPXDVI3T.js.map +0 -1
  243. package/dist/chunk-X6RDQ5NB.cjs.map +0 -1
  244. package/dist/chunk-XFY73JWD.cjs.map +0 -1
  245. package/dist/chunk-Y7M44XEK.js +0 -462
  246. package/dist/chunk-Y7M44XEK.js.map +0 -1
  247. package/dist/chunk-YJDSPA5E.js.map +0 -1
  248. package/dist/chunk-YLINFV7Z.cjs.map +0 -1
  249. package/dist/chunk-Z5QHVL5U.cjs +0 -12
  250. package/dist/chunk-Z5QHVL5U.cjs.map +0 -1
  251. package/dist/chunk-ZKZAIX42.cjs +0 -479
  252. package/dist/chunk-ZKZAIX42.cjs.map +0 -1
  253. package/dist/{index-CrFL_ENI.d.cts → types-C5pZeKTl.d.cts} +1 -1
  254. package/dist/{index-Bq7vSPHy.d.ts → types-D8szWDUo.d.ts} +1 -1
@@ -1,606 +1,22 @@
1
- import { tables } from './chunk-MTNEGGM2.js';
2
- import { formatPostgresTimestamp, coerceNumericScore, nowIso } from './chunk-AOL64O4Z.js';
3
- import { buildPostgresSystemIndexBuilders, buildPostgresNodeIndexBuilders, buildPostgresEdgeIndexBuilders, toDrizzleSql } from './chunk-Z2PPIVOO.js';
1
+ import { formatPostgresTimestamp, coerceNumericScore, nowIso } from './chunk-L3DDZUZP.js';
2
+ import { runtimeStrategyContributions } from './chunk-5J4VNCUD.js';
3
+ import { toDrizzleSql } from './chunk-ZVME6OSV.js';
4
4
  import { chunk } from './chunk-35S6P5ZU.js';
5
- import { createBackendOverlay } from './chunk-PZHC5GCD.js';
5
+ import { createBackendOverlay } from './chunk-L5ET7FYQ.js';
6
6
  import { sortedReplacer } from './chunk-UR7W5YQK.js';
7
- import { parseDimensionMismatch, isMissingTableError } from './chunk-KFLXWVUJ.js';
8
- import { assertNoSystemIndexNameCollision } from './chunk-BQITNFQJ.js';
7
+ import { parseDimensionMismatch, isMissingTableError } from './chunk-UUIBACKJ.js';
9
8
  import { sha256Hex } from './chunk-K34OPSJK.js';
10
- import { tsvectorStrategy, fts5Strategy, BASE_CONTRIBUTION_OWNER } from './chunk-Y7M44XEK.js';
11
- import { sql as sql$1, asCompiledStatementSql, isSqlFragment } from './chunk-6XDBRDZE.js';
9
+ import { sql as sql$1, asCompiledStatementSql, isSqlFragment } from './chunk-6N7QBIWN.js';
12
10
  import { isPresent } from './chunk-QMQLUA66.js';
13
11
  import { EmbeddingDimensionChangedError, ConfigurationError, MigrationError, SchemaContentConflictError, DatabaseOperationError, UniquenessError, TrustedImportError, StaleVersionError, StoreNotInitializedError } from './chunk-DPNA466P.js';
14
12
  import { sql, is, getTableName } from 'drizzle-orm';
15
- import { customType, pgTable, timestamp, integer, jsonb, text, primaryKey, index, boolean, uniqueIndex, getTableConfig as getTableConfig$1, PgTable } from 'drizzle-orm/pg-core';
16
- import { getTableConfig, SQLiteTable } from 'drizzle-orm/sqlite-core';
17
-
18
- var regconfig = customType({
19
- dataType: () => "regconfig"
20
- });
21
- var tsvector = customType({
22
- dataType: () => "tsvector"
23
- });
24
-
25
- // src/backend/drizzle/schema/postgres.ts
26
- var DEFAULT_TABLE_NAMES = {
27
- nodes: "typegraph_nodes",
28
- edges: "typegraph_edges",
29
- recordedNodes: "typegraph_recorded_nodes",
30
- recordedEdges: "typegraph_recorded_edges",
31
- recordedClock: "typegraph_recorded_clock",
32
- revisionOrigins: "typegraph_revision_origins",
33
- uniques: "typegraph_node_uniques",
34
- schemaVersions: "typegraph_schema_versions",
35
- fulltext: "typegraph_node_fulltext",
36
- indexMaterializations: "typegraph_index_materializations",
37
- contributionMaterializations: "typegraph_contribution_materializations",
38
- kindRemovals: "typegraph_kind_removals",
39
- reconciliationMarkers: "typegraph_reconciliation_markers"
40
- };
41
- function createPostgresTables(names = {}, options = {}) {
42
- const n = { ...DEFAULT_TABLE_NAMES, ...names };
43
- const indexes = options.indexes ?? [];
44
- assertNoSystemIndexNameCollision(indexes, n);
45
- const nodes2 = pgTable(
46
- n.nodes,
47
- {
48
- graphId: text("graph_id").notNull(),
49
- kind: text("kind").notNull(),
50
- id: text("id").notNull(),
51
- props: jsonb("props").notNull(),
52
- version: integer("version").notNull().default(1),
53
- validFrom: timestamp("valid_from", { withTimezone: true }),
54
- validTo: timestamp("valid_to", { withTimezone: true }),
55
- createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
56
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
57
- deletedAt: timestamp("deleted_at", { withTimezone: true })
58
- },
59
- (t) => [
60
- primaryKey({ columns: [t.graphId, t.kind, t.id] }),
61
- // System indexes come from SYSTEM_INDEX_DECLARATIONS (single source
62
- // for both dialects + the runtime materializer).
63
- ...buildPostgresSystemIndexBuilders("nodes", n.nodes, t),
64
- ...buildPostgresNodeIndexBuilders(t, indexes)
65
- ]
66
- );
67
- const edges2 = pgTable(
68
- n.edges,
69
- {
70
- graphId: text("graph_id").notNull(),
71
- id: text("id").notNull(),
72
- kind: text("kind").notNull(),
73
- fromKind: text("from_kind").notNull(),
74
- fromId: text("from_id").notNull(),
75
- toKind: text("to_kind").notNull(),
76
- toId: text("to_id").notNull(),
77
- props: jsonb("props").notNull(),
78
- validFrom: timestamp("valid_from", { withTimezone: true }),
79
- validTo: timestamp("valid_to", { withTimezone: true }),
80
- createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
81
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
82
- deletedAt: timestamp("deleted_at", { withTimezone: true })
83
- },
84
- (t) => [
85
- primaryKey({ columns: [t.graphId, t.id] }),
86
- ...buildPostgresSystemIndexBuilders("edges", n.edges, t),
87
- ...buildPostgresEdgeIndexBuilders(t, indexes)
88
- ]
89
- );
90
- const recordedNodes2 = pgTable(
91
- n.recordedNodes,
92
- {
93
- historyId: text("history_id").notNull(),
94
- graphId: text("graph_id").notNull(),
95
- kind: text("kind").notNull(),
96
- id: text("id").notNull(),
97
- props: jsonb("props").notNull(),
98
- version: integer("version").notNull(),
99
- validFrom: timestamp("valid_from", { withTimezone: true }),
100
- validTo: timestamp("valid_to", { withTimezone: true }),
101
- createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
102
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
103
- deletedAt: timestamp("deleted_at", { withTimezone: true }),
104
- recordedFrom: timestamp("recorded_from", {
105
- withTimezone: true
106
- }).notNull(),
107
- recordedTo: timestamp("recorded_to", { withTimezone: true }).notNull(),
108
- op: text("op").notNull(),
109
- schemaVersion: integer("schema_version"),
110
- txId: text("tx_id"),
111
- meta: jsonb("meta")
112
- },
113
- (t) => [
114
- primaryKey({ columns: [t.historyId] }),
115
- ...buildPostgresSystemIndexBuilders("recordedNodes", n.recordedNodes, t)
116
- ]
117
- );
118
- const recordedEdges2 = pgTable(
119
- n.recordedEdges,
120
- {
121
- historyId: text("history_id").notNull(),
122
- graphId: text("graph_id").notNull(),
123
- id: text("id").notNull(),
124
- kind: text("kind").notNull(),
125
- fromKind: text("from_kind").notNull(),
126
- fromId: text("from_id").notNull(),
127
- toKind: text("to_kind").notNull(),
128
- toId: text("to_id").notNull(),
129
- props: jsonb("props").notNull(),
130
- validFrom: timestamp("valid_from", { withTimezone: true }),
131
- validTo: timestamp("valid_to", { withTimezone: true }),
132
- createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
133
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
134
- deletedAt: timestamp("deleted_at", { withTimezone: true }),
135
- recordedFrom: timestamp("recorded_from", {
136
- withTimezone: true
137
- }).notNull(),
138
- recordedTo: timestamp("recorded_to", { withTimezone: true }).notNull(),
139
- op: text("op").notNull(),
140
- schemaVersion: integer("schema_version"),
141
- txId: text("tx_id"),
142
- meta: jsonb("meta")
143
- },
144
- (t) => [
145
- primaryKey({ columns: [t.historyId] }),
146
- ...buildPostgresSystemIndexBuilders("recordedEdges", n.recordedEdges, t)
147
- ]
148
- );
149
- const recordedClock2 = pgTable(
150
- n.recordedClock,
151
- {
152
- graphId: text("graph_id").notNull(),
153
- recordedAt: timestamp("recorded_at", { withTimezone: true }).notNull()
154
- },
155
- (t) => [primaryKey({ columns: [t.graphId] })]
156
- );
157
- const revisionOrigins = pgTable(
158
- n.revisionOrigins,
159
- {
160
- graphId: text("graph_id").notNull(),
161
- origin: text("origin").notNull()
162
- },
163
- (t) => [primaryKey({ columns: [t.graphId] })]
164
- );
165
- const uniques2 = pgTable(
166
- n.uniques,
167
- {
168
- graphId: text("graph_id").notNull(),
169
- nodeKind: text("node_kind").notNull(),
170
- constraintName: text("constraint_name").notNull(),
171
- key: text("key").notNull(),
172
- nodeId: text("node_id").notNull(),
173
- concreteKind: text("concrete_kind").notNull(),
174
- deletedAt: timestamp("deleted_at", { withTimezone: true })
175
- },
176
- (t) => [
177
- primaryKey({
178
- columns: [t.graphId, t.nodeKind, t.constraintName, t.key]
179
- }),
180
- index(`${n.uniques}_node_idx`).on(t.graphId, t.concreteKind, t.nodeId)
181
- ]
182
- );
183
- const schemaVersions2 = pgTable(
184
- n.schemaVersions,
185
- {
186
- graphId: text("graph_id").notNull(),
187
- version: integer("version").notNull(),
188
- schemaHash: text("schema_hash").notNull(),
189
- schemaDoc: jsonb("schema_doc").notNull(),
190
- createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
191
- isActive: boolean("is_active").notNull().default(false)
192
- },
193
- (t) => [
194
- primaryKey({ columns: [t.graphId, t.version] }),
195
- index(`${n.schemaVersions}_active_idx`).on(t.graphId, t.isActive),
196
- // Partial unique index enforcing the "at most one active version
197
- // per graph" invariant at the storage layer. Defense in depth
198
- // against buggy backend implementations or out-of-band writes.
199
- // Forces the deactivate-then-activate ordering used by
200
- // `commitSchemaVersion` and `setActiveVersion`.
201
- uniqueIndex(`${n.schemaVersions}_one_active_per_graph_idx`).on(t.graphId).where(sql`${t.isActive} = TRUE`)
202
- ]
203
- );
204
- const indexMaterializations = pgTable(
205
- n.indexMaterializations,
206
- {
207
- indexName: text("index_name").notNull(),
208
- graphId: text("graph_id").notNull(),
209
- entity: text("entity").notNull(),
210
- kind: text("kind").notNull(),
211
- signature: text("signature").notNull(),
212
- schemaVersion: integer("schema_version").notNull(),
213
- materializedAt: timestamp("materialized_at", { withTimezone: true }),
214
- lastAttemptedAt: timestamp("last_attempted_at", {
215
- withTimezone: true
216
- }).notNull(),
217
- lastError: text("last_error"),
218
- // Cross-caller build claim: while `building_since` is fresh (within
219
- // the lease), exactly one materializer owns this index's CREATE
220
- // INDEX CONCURRENTLY. Serializes same-index CIC across processes —
221
- // two concurrent expression-index CICs deadlock each other (no
222
- // safe-snapshot exemption). NULL when no build is in flight.
223
- buildingSince: timestamp("building_since", { withTimezone: true }),
224
- claimToken: text("claim_token")
225
- },
226
- (t) => [primaryKey({ columns: [t.indexName] })]
227
- );
228
- const kindRemovals = pgTable(
229
- n.kindRemovals,
230
- {
231
- graphId: text("graph_id").notNull(),
232
- kindName: text("kind_name").notNull(),
233
- entity: text("entity").notNull(),
234
- schemaVersion: integer("schema_version").notNull(),
235
- removedAt: timestamp("removed_at", { withTimezone: true }),
236
- lastAttemptedAt: timestamp("last_attempted_at", {
237
- withTimezone: true
238
- }).notNull(),
239
- lastError: text("last_error")
240
- },
241
- (t) => [
242
- primaryKey({
243
- columns: [t.graphId, t.kindName, t.entity, t.schemaVersion]
244
- })
245
- ]
246
- );
247
- const reconciliationMarkers = pgTable(
248
- n.reconciliationMarkers,
249
- {
250
- graphId: text("graph_id").notNull(),
251
- reconciledToVersion: integer("reconciled_to_version").notNull()
252
- },
253
- (t) => [primaryKey({ columns: [t.graphId] })]
254
- );
255
- const contributionMaterializations = pgTable(
256
- n.contributionMaterializations,
257
- {
258
- graphId: text("graph_id").notNull(),
259
- logicalName: text("logical_name").notNull(),
260
- owner: text("owner").notNull(),
261
- tableName: text("table_name").notNull(),
262
- signature: text("signature").notNull(),
263
- materializedAt: timestamp("materialized_at", { withTimezone: true }),
264
- lastAttemptedAt: timestamp("last_attempted_at", {
265
- withTimezone: true
266
- }).notNull(),
267
- lastError: text("last_error")
268
- },
269
- (t) => [
270
- primaryKey({
271
- columns: [t.graphId, t.logicalName, t.owner, t.tableName]
272
- })
273
- ]
274
- );
275
- const fulltext2 = pgTable(
276
- n.fulltext,
277
- {
278
- graphId: text("graph_id").notNull(),
279
- nodeKind: text("node_kind").notNull(),
280
- nodeId: text("node_id").notNull(),
281
- content: text("content").notNull(),
282
- language: regconfig("language").notNull(),
283
- tsv: tsvector("tsv").generatedAlwaysAs(sql`to_tsvector("language", "content")`).notNull(),
284
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
285
- },
286
- (t) => [
287
- primaryKey({ columns: [t.graphId, t.nodeKind, t.nodeId] }),
288
- index(`${n.fulltext}_tsv_idx`).using("gin", t.tsv),
289
- index(`${n.fulltext}_kind_idx`).on(t.graphId, t.nodeKind)
290
- ]
291
- );
292
- return {
293
- nodes: nodes2,
294
- edges: edges2,
295
- recordedNodes: recordedNodes2,
296
- recordedEdges: recordedEdges2,
297
- recordedClock: recordedClock2,
298
- revisionOrigins,
299
- uniques: uniques2,
300
- schemaVersions: schemaVersions2,
301
- indexMaterializations,
302
- contributionMaterializations,
303
- kindRemovals,
304
- reconciliationMarkers,
305
- fulltext: fulltext2,
306
- fulltextTableName: n.fulltext
307
- };
308
- }
309
- var tables2 = createPostgresTables();
310
- var {
311
- nodes,
312
- edges,
313
- recordedNodes,
314
- recordedEdges,
315
- recordedClock,
316
- uniques,
317
- schemaVersions,
318
- fulltext
319
- } = tables2;
320
- function getSqliteColumnType(column) {
321
- switch (column.columnType) {
322
- case "SQLiteText": {
323
- return "TEXT";
324
- }
325
- case "SQLiteInteger": {
326
- return "INTEGER";
327
- }
328
- case "SQLiteReal": {
329
- return "REAL";
330
- }
331
- case "SQLiteBlob": {
332
- return "BLOB";
333
- }
334
- default: {
335
- return "TEXT";
336
- }
337
- }
338
- }
339
- function formatDefaultValue(value) {
340
- if (value === null) return "NULL";
341
- if (typeof value === "string") return `'${value}'`;
342
- if (typeof value === "number") return String(value);
343
- if (typeof value === "boolean") return value ? "1" : "0";
344
- return JSON.stringify(value);
345
- }
346
- function generateSqliteCreateTableSQL(table) {
347
- const config = getTableConfig(table);
348
- const columnDefs = [];
349
- for (const column of config.columns) {
350
- const parts = [
351
- `"${column.name}"`,
352
- getSqliteColumnType(column)
353
- ];
354
- if (column.notNull) {
355
- parts.push("NOT NULL");
356
- }
357
- if (column.hasDefault && column.default !== void 0) {
358
- parts.push(`DEFAULT ${formatDefaultValue(column.default)}`);
359
- }
360
- columnDefs.push(parts.join(" "));
361
- }
362
- const pk = config.primaryKeys[0];
363
- if (pk) {
364
- const pkColumns = pk.columns.map((c) => `"${c.name}"`).join(", ");
365
- columnDefs.push(`PRIMARY KEY (${pkColumns})`);
366
- }
367
- return `CREATE TABLE IF NOT EXISTS "${config.name}" (
368
- ${columnDefs.join(",\n ")}
369
- );`;
370
- }
371
- function renderIndexColumn(col) {
372
- if (col && typeof col === "object" && "name" in col) {
373
- return `"${col.name}"`;
374
- }
375
- const sql16 = tryInlineSql(col);
376
- if (sql16 !== void 0) {
377
- return sql16;
378
- }
379
- return "unknown";
380
- }
381
- function tryInlineSql(value) {
382
- if (value && typeof value === "object" && "getSQL" in value) {
383
- const maybe = value;
384
- if (typeof maybe.getSQL === "function") {
385
- return inlineSql(maybe.getSQL());
386
- }
387
- }
388
- return inlineSql(value);
389
- }
390
- function flattenSqlChunk(chunk2) {
391
- if (typeof chunk2 === "string") {
392
- return chunk2;
393
- }
394
- if (typeof chunk2 === "object" && chunk2 !== null) {
395
- if ("name" in chunk2 && typeof chunk2.name === "string") {
396
- return `"${chunk2.name}"`;
397
- }
398
- if ("value" in chunk2) {
399
- const value = chunk2.value;
400
- if (typeof value === "string") {
401
- return value;
402
- }
403
- if (Array.isArray(value)) {
404
- return value.map((part) => flattenSqlChunk(part)).join("");
405
- }
406
- }
407
- if ("queryChunks" in chunk2 && Array.isArray(chunk2.queryChunks)) {
408
- return chunk2.queryChunks.map((part) => flattenSqlChunk(part)).join("");
409
- }
410
- if ("getSQL" in chunk2) {
411
- const maybe = chunk2;
412
- if (typeof maybe.getSQL === "function") {
413
- return flattenSqlChunk(maybe.getSQL());
414
- }
415
- }
416
- }
417
- throw new Error(`Unable to inline SQL chunk: ${String(chunk2)}`);
418
- }
419
- function inlineSql(value) {
420
- try {
421
- return flattenSqlChunk(value);
422
- } catch {
423
- return void 0;
424
- }
425
- }
426
- function inlineSqlOrThrow(value, context) {
427
- const inlined = inlineSql(value);
428
- if (inlined === void 0) {
429
- throw new Error(`Unable to inline SQL for ${context}`);
430
- }
431
- return inlined;
432
- }
433
- function generateSqliteCreateIndexSQL(table) {
434
- const config = getTableConfig(table);
435
- const statements = [];
436
- for (const index2 of config.indexes) {
437
- const indexConfig = index2.config;
438
- const columns = indexConfig.columns.map((c) => renderIndexColumn(c)).join(", ");
439
- const unique = indexConfig.unique ? "UNIQUE " : "";
440
- const where = indexConfig.where ? ` WHERE ${inlineSqlOrThrow(indexConfig.where, `SQLite index "${indexConfig.name}" WHERE clause`)}` : "";
441
- statements.push(
442
- `CREATE ${unique}INDEX IF NOT EXISTS "${indexConfig.name}" ON "${config.name}" (${columns})${where};`
443
- );
444
- }
445
- return statements;
446
- }
447
- function isSqliteTable(value) {
448
- return is(value, SQLiteTable);
449
- }
450
- function runtimeStrategyContributions(fulltextStrategy, fulltextTableName) {
451
- return fulltextStrategy.ownedTables(fulltextTableName).filter((contribution) => contribution.runtimeEnsure);
452
- }
453
- function sqliteContributions(tables3 = tables, fulltextStrategy = fts5Strategy) {
454
- const contributions = [];
455
- for (const [key, table] of Object.entries(tables3)) {
456
- if (!isSqliteTable(table)) continue;
457
- contributions.push({
458
- logicalName: key,
459
- owner: BASE_CONTRIBUTION_OWNER,
460
- tableName: getTableConfig(table).name,
461
- createDdl: [
462
- generateSqliteCreateTableSQL(table),
463
- ...generateSqliteCreateIndexSQL(table)
464
- ],
465
- runtimeEnsure: false
466
- });
467
- }
468
- for (const declared of fulltextStrategy.ownedTables(
469
- tables3.fulltextTableName
470
- )) {
471
- contributions.push(declared);
472
- }
473
- return contributions;
474
- }
475
- function generateSqliteDDL(tables3 = tables, fulltextStrategy = fts5Strategy) {
476
- return sqliteContributions(tables3, fulltextStrategy).flatMap(
477
- (contribution) => [...contribution.createDdl]
478
- );
479
- }
480
- function generateSqliteMigrationSQL(tables3 = tables, fulltextStrategy = fts5Strategy) {
481
- return generateSqliteDDL(tables3, fulltextStrategy).join("\n\n");
482
- }
483
- function getPgColumnType(column) {
484
- switch (column.columnType) {
485
- case "PgText": {
486
- return "TEXT";
487
- }
488
- case "PgInteger": {
489
- return "INTEGER";
490
- }
491
- case "PgBoolean": {
492
- return "BOOLEAN";
493
- }
494
- case "PgJsonb": {
495
- return "JSONB";
496
- }
497
- case "PgTimestamp": {
498
- return column.config?.withTimezone ? "TIMESTAMPTZ" : "TIMESTAMP";
499
- }
500
- case "PgReal": {
501
- return "REAL";
502
- }
503
- case "PgDoublePrecision": {
504
- return "DOUBLE PRECISION";
505
- }
506
- case "PgCustomColumn": {
507
- const dataType = column.getSQLType?.();
508
- return dataType ?? "TEXT";
509
- }
510
- default: {
511
- return "TEXT";
512
- }
513
- }
514
- }
515
- function formatPgDefaultValue(value) {
516
- if (value === null) return "NULL";
517
- if (typeof value === "string") return `'${value}'`;
518
- if (typeof value === "number") return String(value);
519
- if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
520
- return JSON.stringify(value);
521
- }
522
- function generatePgCreateTableSQL(table) {
523
- const config = getTableConfig$1(table);
524
- const columnDefs = [];
525
- for (const column of config.columns) {
526
- const parts = [`"${column.name}"`, getPgColumnType(column)];
527
- if (column.notNull) {
528
- parts.push("NOT NULL");
529
- }
530
- if (column.hasDefault && column.default !== void 0) {
531
- parts.push(`DEFAULT ${formatPgDefaultValue(column.default)}`);
532
- }
533
- columnDefs.push(parts.join(" "));
534
- }
535
- const pk = config.primaryKeys[0];
536
- if (pk) {
537
- const pkColumns = pk.columns.map((c) => `"${c.name}"`).join(", ");
538
- columnDefs.push(`PRIMARY KEY (${pkColumns})`);
539
- }
540
- return `CREATE TABLE IF NOT EXISTS "${config.name}" (
541
- ${columnDefs.join(",\n ")}
542
- );`;
543
- }
544
- function generatePgCreateIndexSQL(table) {
545
- const config = getTableConfig$1(table);
546
- const statements = [];
547
- for (const index2 of config.indexes) {
548
- const indexConfig = index2.config;
549
- const columns = indexConfig.columns.map((c) => renderIndexColumn(c)).join(", ");
550
- const unique = indexConfig.unique ? "UNIQUE " : "";
551
- const method = indexConfig.method && indexConfig.method !== "btree" ? ` USING ${indexConfig.method}` : "";
552
- const where = indexConfig.where ? ` WHERE ${inlineSqlOrThrow(indexConfig.where, `PostgreSQL index "${indexConfig.name}" WHERE clause`)}` : "";
553
- statements.push(
554
- `CREATE ${unique}INDEX IF NOT EXISTS "${indexConfig.name}" ON "${config.name}"${method} (${columns})${where};`
555
- );
556
- }
557
- return statements;
558
- }
559
- function isPgTable(value) {
560
- return is(value, PgTable);
561
- }
562
- function postgresContributions(tables3 = tables2, fulltextStrategy = tsvectorStrategy) {
563
- const contributions = [];
564
- for (const [key, table] of Object.entries(tables3)) {
565
- if (!isPgTable(table)) continue;
566
- if (table === tables3.fulltext) continue;
567
- contributions.push({
568
- logicalName: key,
569
- owner: BASE_CONTRIBUTION_OWNER,
570
- tableName: getTableConfig$1(table).name,
571
- createDdl: [
572
- generatePgCreateTableSQL(table),
573
- ...generatePgCreateIndexSQL(table)
574
- ],
575
- runtimeEnsure: false
576
- });
577
- }
578
- for (const declared of fulltextStrategy.ownedTables(
579
- tables3.fulltextTableName
580
- )) {
581
- contributions.push(declared);
582
- }
583
- return contributions;
584
- }
585
- function generatePostgresDDL(tables3 = tables2, fulltextStrategy = tsvectorStrategy) {
586
- return postgresContributions(tables3, fulltextStrategy).flatMap(
587
- (contribution) => [...contribution.createDdl]
588
- );
589
- }
590
- function generatePostgresMigrationSQL(tables3 = tables2, fulltextStrategy = tsvectorStrategy) {
591
- const extensionSql = "-- Enable pgvector extension for vector similarity search\nCREATE EXTENSION IF NOT EXISTS vector;";
592
- const ddlSql = generatePostgresDDL(tables3, fulltextStrategy).join("\n\n");
593
- return `${extensionSql}
594
-
595
- ${ddlSql}`;
596
- }
597
13
 
598
14
  // src/backend/live-node-candidates.ts
599
15
  function buildLiveNodeCandidates(nodesTableName, graphId, nodeKind, now) {
600
- const nodes2 = sql$1.identifier(nodesTableName);
16
+ const nodes = sql$1.identifier(nodesTableName);
601
17
  return sql$1`
602
18
  SELECT "id" AS node_id
603
- FROM ${nodes2}
19
+ FROM ${nodes}
604
20
  WHERE "graph_id" = ${graphId}
605
21
  AND "kind" = ${nodeKind}
606
22
  AND "deleted_at" IS NULL
@@ -795,7 +211,7 @@ function createContributionMaterializer(deps) {
795
211
  const cachedCreateDdl = cached?.createDdl;
796
212
  const cachedSignature = cached?.signature;
797
213
  if (cachedCreateDdl?.length === contribution.createDdl.length && cachedSignature !== void 0 && contribution.createDdl.every(
798
- (statement, index2) => cachedCreateDdl[index2] === statement
214
+ (statement, index) => cachedCreateDdl[index] === statement
799
215
  )) {
800
216
  return cachedSignature;
801
217
  }
@@ -1130,9 +546,9 @@ function buildKindRemovalOnConflictSet(removedAtColumn, paramsRemovedAt) {
1130
546
  function sqlNull(value) {
1131
547
  return value ?? sql.raw("NULL");
1132
548
  }
1133
- function resolveValidFrom(validFrom, timestamp2) {
549
+ function resolveValidFrom(validFrom, timestamp) {
1134
550
  if (validFrom === null) return void 0;
1135
- return validFrom ?? timestamp2;
551
+ return validFrom ?? timestamp;
1136
552
  }
1137
553
  function quotedColumn(column) {
1138
554
  return sql.raw(`"${column.name.replaceAll('"', '""')}"`);
@@ -1147,17 +563,17 @@ var CODE_POINT_ORDER_BUILDERS = {
1147
563
  function codePointOrderKey(column, dialect) {
1148
564
  return CODE_POINT_ORDER_BUILDERS[dialect](column);
1149
565
  }
1150
- function liveNodeIdsSubquery(nodes2, graphId, nodeKind, nowIso2) {
1151
- return sql`SELECT ${nodes2.id} AS node_id FROM ${nodes2} WHERE ${nodes2.graphId} = ${graphId} AND ${nodes2.kind} = ${nodeKind} AND ${nodes2.deletedAt} IS NULL AND (${nodes2.validFrom} IS NULL OR ${nodes2.validFrom} <= ${nowIso2}) AND (${nodes2.validTo} IS NULL OR ${nodes2.validTo} > ${nowIso2})`;
566
+ function liveNodeIdsSubquery(nodes, graphId, nodeKind, nowIso2) {
567
+ return sql`SELECT ${nodes.id} AS node_id FROM ${nodes} WHERE ${nodes.graphId} = ${graphId} AND ${nodes.kind} = ${nodeKind} AND ${nodes.deletedAt} IS NULL AND (${nodes.validFrom} IS NULL OR ${nodes.validFrom} <= ${nowIso2}) AND (${nodes.validTo} IS NULL OR ${nodes.validTo} > ${nowIso2})`;
1152
568
  }
1153
- function nodeColumnList(nodes2) {
569
+ function nodeColumnList(nodes) {
1154
570
  return sql.raw(
1155
- `"${nodes2.graphId.name}", "${nodes2.kind.name}", "${nodes2.id.name}", "${nodes2.props.name}", "${nodes2.version.name}", "${nodes2.validFrom.name}", "${nodes2.validTo.name}", "${nodes2.createdAt.name}", "${nodes2.updatedAt.name}"`
571
+ `"${nodes.graphId.name}", "${nodes.kind.name}", "${nodes.id.name}", "${nodes.props.name}", "${nodes.version.name}", "${nodes.validFrom.name}", "${nodes.validTo.name}", "${nodes.createdAt.name}", "${nodes.updatedAt.name}"`
1156
572
  );
1157
573
  }
1158
- function edgeColumnList(edges2) {
574
+ function edgeColumnList(edges) {
1159
575
  return sql.raw(
1160
- `"${edges2.graphId.name}", "${edges2.id.name}", "${edges2.kind.name}", "${edges2.fromKind.name}", "${edges2.fromId.name}", "${edges2.toKind.name}", "${edges2.toId.name}", "${edges2.props.name}", "${edges2.validFrom.name}", "${edges2.validTo.name}", "${edges2.createdAt.name}", "${edges2.updatedAt.name}"`
576
+ `"${edges.graphId.name}", "${edges.id.name}", "${edges.kind.name}", "${edges.fromKind.name}", "${edges.fromId.name}", "${edges.toKind.name}", "${edges.toId.name}", "${edges.props.name}", "${edges.validFrom.name}", "${edges.validTo.name}", "${edges.createdAt.name}", "${edges.updatedAt.name}"`
1161
577
  );
1162
578
  }
1163
579
 
@@ -1169,20 +585,20 @@ function hybridCandidatesRef() {
1169
585
  return sql`SELECT node_id FROM tg_hybrid_cand`;
1170
586
  }
1171
587
  function buildHybridSearchStatement(input) {
1172
- const { nodes: nodes2 } = input;
588
+ const { nodes } = input;
1173
589
  const nodeIdOrder = nodeIdOrderKey(input.dialect);
1174
590
  const vectorOrder = input.vectorScoreDescending ? sql`score DESC, ${nodeIdOrder} ASC` : sql`score ASC, ${nodeIdOrder} ASC`;
1175
591
  const columnPairs = [
1176
- [nodes2.graphId, "graph_id"],
1177
- [nodes2.kind, "kind"],
1178
- [nodes2.id, "id"],
1179
- [nodes2.props, "props"],
1180
- [nodes2.version, "version"],
1181
- [nodes2.validFrom, "valid_from"],
1182
- [nodes2.validTo, "valid_to"],
1183
- [nodes2.createdAt, "created_at"],
1184
- [nodes2.updatedAt, "updated_at"],
1185
- [nodes2.deletedAt, "deleted_at"]
592
+ [nodes.graphId, "graph_id"],
593
+ [nodes.kind, "kind"],
594
+ [nodes.id, "id"],
595
+ [nodes.props, "props"],
596
+ [nodes.version, "version"],
597
+ [nodes.validFrom, "valid_from"],
598
+ [nodes.validTo, "valid_to"],
599
+ [nodes.createdAt, "created_at"],
600
+ [nodes.updatedAt, "updated_at"],
601
+ [nodes.deletedAt, "deleted_at"]
1186
602
  ];
1187
603
  const nodeColumns = sql.raw(
1188
604
  columnPairs.map(
@@ -1235,17 +651,17 @@ function buildHybridSearchStatement(input) {
1235
651
  tg_hybrid_fused.snippet AS snippet,
1236
652
  ${nodeColumns}
1237
653
  FROM tg_hybrid_fused
1238
- JOIN ${nodes2} AS tg_hybrid_node
1239
- ON ${qualified(nodes2, "graphId")} = ${input.graphId}
1240
- AND ${qualified(nodes2, "kind")} = ${input.nodeKind}
1241
- AND ${qualified(nodes2, "id")} = tg_hybrid_fused.node_id
1242
- AND ${qualified(nodes2, "deletedAt")} IS NULL
654
+ JOIN ${nodes} AS tg_hybrid_node
655
+ ON ${qualified(nodes, "graphId")} = ${input.graphId}
656
+ AND ${qualified(nodes, "kind")} = ${input.nodeKind}
657
+ AND ${qualified(nodes, "id")} = tg_hybrid_fused.node_id
658
+ AND ${qualified(nodes, "deletedAt")} IS NULL
1243
659
  ORDER BY fused_score DESC, ${nodeIdOrder} ASC
1244
660
  LIMIT ${input.limit} OFFSET ${input.offset}
1245
661
  `;
1246
662
  }
1247
- function qualified(nodes2, member) {
1248
- return sql`tg_hybrid_node.${quotedColumn(nodes2[member])}`;
663
+ function qualified(nodes, member) {
664
+ return sql`tg_hybrid_node.${quotedColumn(nodes[member])}`;
1249
665
  }
1250
666
  function present(value) {
1251
667
  return value !== null && value !== void 0;
@@ -1265,45 +681,45 @@ function mapHybridSearchRow(row, toNodeRow) {
1265
681
  ...present(row["snippet"]) ? { snippet: String(row["snippet"]) } : {}
1266
682
  };
1267
683
  }
1268
- function buildClearGraph(tables3, graphId) {
1269
- const fulltext2 = quotedTableName(tables3.fulltextTableName);
684
+ function buildClearGraph(tables, graphId) {
685
+ const fulltext = quotedTableName(tables.fulltextTableName);
1270
686
  return [
1271
- { query: sql`DELETE FROM ${fulltext2} WHERE "graph_id" = ${graphId}` },
687
+ { query: sql`DELETE FROM ${fulltext} WHERE "graph_id" = ${graphId}` },
1272
688
  {
1273
- query: sql`DELETE FROM ${tables3.recordedEdges} WHERE ${tables3.recordedEdges.graphId} = ${graphId}`,
689
+ query: sql`DELETE FROM ${tables.recordedEdges} WHERE ${tables.recordedEdges.graphId} = ${graphId}`,
1274
690
  ignoreMissingTable: true,
1275
- requiredTableName: getTableName(tables3.recordedEdges)
691
+ requiredTableName: getTableName(tables.recordedEdges)
1276
692
  },
1277
693
  {
1278
- query: sql`DELETE FROM ${tables3.recordedNodes} WHERE ${tables3.recordedNodes.graphId} = ${graphId}`,
694
+ query: sql`DELETE FROM ${tables.recordedNodes} WHERE ${tables.recordedNodes.graphId} = ${graphId}`,
1279
695
  ignoreMissingTable: true,
1280
- requiredTableName: getTableName(tables3.recordedNodes)
696
+ requiredTableName: getTableName(tables.recordedNodes)
1281
697
  },
1282
698
  {
1283
- query: sql`DELETE FROM ${tables3.recordedClock} WHERE ${tables3.recordedClock.graphId} = ${graphId}`,
699
+ query: sql`DELETE FROM ${tables.recordedClock} WHERE ${tables.recordedClock.graphId} = ${graphId}`,
1284
700
  ignoreMissingTable: true,
1285
- requiredTableName: getTableName(tables3.recordedClock)
701
+ requiredTableName: getTableName(tables.recordedClock)
1286
702
  },
1287
703
  {
1288
- query: sql`DELETE FROM ${tables3.uniques} WHERE ${tables3.uniques.graphId} = ${graphId}`
704
+ query: sql`DELETE FROM ${tables.uniques} WHERE ${tables.uniques.graphId} = ${graphId}`
1289
705
  },
1290
706
  {
1291
- query: sql`DELETE FROM ${tables3.edges} WHERE ${tables3.edges.graphId} = ${graphId}`
707
+ query: sql`DELETE FROM ${tables.edges} WHERE ${tables.edges.graphId} = ${graphId}`
1292
708
  },
1293
709
  {
1294
- query: sql`DELETE FROM ${tables3.nodes} WHERE ${tables3.nodes.graphId} = ${graphId}`
710
+ query: sql`DELETE FROM ${tables.nodes} WHERE ${tables.nodes.graphId} = ${graphId}`
1295
711
  },
1296
712
  {
1297
- query: sql`DELETE FROM ${tables3.indexMaterializations} WHERE ${tables3.indexMaterializations.graphId} = ${graphId}`
713
+ query: sql`DELETE FROM ${tables.indexMaterializations} WHERE ${tables.indexMaterializations.graphId} = ${graphId}`
1298
714
  },
1299
715
  {
1300
- query: sql`DELETE FROM ${tables3.kindRemovals} WHERE ${tables3.kindRemovals.graphId} = ${graphId}`
716
+ query: sql`DELETE FROM ${tables.kindRemovals} WHERE ${tables.kindRemovals.graphId} = ${graphId}`
1301
717
  },
1302
718
  {
1303
- query: sql`DELETE FROM ${tables3.reconciliationMarkers} WHERE ${tables3.reconciliationMarkers.graphId} = ${graphId}`
719
+ query: sql`DELETE FROM ${tables.reconciliationMarkers} WHERE ${tables.reconciliationMarkers.graphId} = ${graphId}`
1304
720
  },
1305
721
  {
1306
- query: sql`DELETE FROM ${tables3.schemaVersions} WHERE ${tables3.schemaVersions.graphId} = ${graphId}`
722
+ query: sql`DELETE FROM ${tables.schemaVersions} WHERE ${tables.schemaVersions.graphId} = ${graphId}`
1307
723
  }
1308
724
  ];
1309
725
  }
@@ -1325,21 +741,21 @@ function buildTemporalConditions(table, params) {
1325
741
  }
1326
742
  return conditions;
1327
743
  }
1328
- function buildFindNodesByKind(tables3, params) {
1329
- const { nodes: nodes2 } = tables3;
744
+ function buildFindNodesByKind(tables, params) {
745
+ const { nodes } = tables;
1330
746
  const conditions = [
1331
- sql`${nodes2.graphId} = ${params.graphId}`,
1332
- sql`${nodes2.kind} = ${params.kind}`,
1333
- ...buildTemporalConditions(nodes2, params)
747
+ sql`${nodes.graphId} = ${params.graphId}`,
748
+ sql`${nodes.kind} = ${params.kind}`,
749
+ ...buildTemporalConditions(nodes, params)
1334
750
  ];
1335
751
  if (params.orderBy === "id" && params.after !== void 0) {
1336
- conditions.push(sql`${nodes2.id} > ${params.after}`);
752
+ conditions.push(sql`${nodes.id} > ${params.after}`);
1337
753
  }
1338
754
  const whereClause = sql.join(conditions, sql` AND `);
1339
- const orderByClause = params.orderBy === "id" ? sql`${nodes2.id} ASC` : sql`${nodes2.createdAt} DESC, ${nodes2.id} DESC`;
755
+ const orderByClause = params.orderBy === "id" ? sql`${nodes.id} ASC` : sql`${nodes.createdAt} DESC, ${nodes.id} DESC`;
1340
756
  if (params.limit !== void 0 && params.offset !== void 0) {
1341
757
  return sql`
1342
- SELECT * FROM ${nodes2}
758
+ SELECT * FROM ${nodes}
1343
759
  WHERE ${whereClause}
1344
760
  ORDER BY ${orderByClause}
1345
761
  LIMIT ${params.limit} OFFSET ${params.offset}
@@ -1347,58 +763,58 @@ function buildFindNodesByKind(tables3, params) {
1347
763
  }
1348
764
  if (params.limit !== void 0) {
1349
765
  return sql`
1350
- SELECT * FROM ${nodes2}
766
+ SELECT * FROM ${nodes}
1351
767
  WHERE ${whereClause}
1352
768
  ORDER BY ${orderByClause}
1353
769
  LIMIT ${params.limit}
1354
770
  `;
1355
771
  }
1356
772
  return sql`
1357
- SELECT * FROM ${nodes2}
773
+ SELECT * FROM ${nodes}
1358
774
  WHERE ${whereClause}
1359
775
  ORDER BY ${orderByClause}
1360
776
  `;
1361
777
  }
1362
- function buildCountNodesByKind(tables3, params) {
1363
- const { nodes: nodes2 } = tables3;
778
+ function buildCountNodesByKind(tables, params) {
779
+ const { nodes } = tables;
1364
780
  const conditions = [
1365
- sql`${nodes2.graphId} = ${params.graphId}`,
1366
- sql`${nodes2.kind} = ${params.kind}`,
1367
- ...buildTemporalConditions(nodes2, params)
781
+ sql`${nodes.graphId} = ${params.graphId}`,
782
+ sql`${nodes.kind} = ${params.kind}`,
783
+ ...buildTemporalConditions(nodes, params)
1368
784
  ];
1369
785
  const whereClause = sql.join(conditions, sql` AND `);
1370
786
  return sql`
1371
- SELECT COUNT(*) as count FROM ${nodes2}
787
+ SELECT COUNT(*) as count FROM ${nodes}
1372
788
  WHERE ${whereClause}
1373
789
  `;
1374
790
  }
1375
- function buildFindEdgesByKind(tables3, params) {
1376
- const { edges: edges2 } = tables3;
791
+ function buildFindEdgesByKind(tables, params) {
792
+ const { edges } = tables;
1377
793
  const conditions = [
1378
- sql`${edges2.graphId} = ${params.graphId}`,
1379
- sql`${edges2.kind} = ${params.kind}`,
1380
- ...buildTemporalConditions(edges2, params)
794
+ sql`${edges.graphId} = ${params.graphId}`,
795
+ sql`${edges.kind} = ${params.kind}`,
796
+ ...buildTemporalConditions(edges, params)
1381
797
  ];
1382
798
  if (params.fromKind !== void 0) {
1383
- conditions.push(sql`${edges2.fromKind} = ${params.fromKind}`);
799
+ conditions.push(sql`${edges.fromKind} = ${params.fromKind}`);
1384
800
  }
1385
801
  if (params.fromId !== void 0) {
1386
- conditions.push(sql`${edges2.fromId} = ${params.fromId}`);
802
+ conditions.push(sql`${edges.fromId} = ${params.fromId}`);
1387
803
  }
1388
804
  if (params.toKind !== void 0) {
1389
- conditions.push(sql`${edges2.toKind} = ${params.toKind}`);
805
+ conditions.push(sql`${edges.toKind} = ${params.toKind}`);
1390
806
  }
1391
807
  if (params.toId !== void 0) {
1392
- conditions.push(sql`${edges2.toId} = ${params.toId}`);
808
+ conditions.push(sql`${edges.toId} = ${params.toId}`);
1393
809
  }
1394
810
  if (params.orderBy === "id" && params.after !== void 0) {
1395
- conditions.push(sql`${edges2.id} > ${params.after}`);
811
+ conditions.push(sql`${edges.id} > ${params.after}`);
1396
812
  }
1397
813
  const whereClause = sql.join(conditions, sql` AND `);
1398
- const orderByClause = params.orderBy === "id" ? sql`${edges2.id} ASC` : sql`${edges2.createdAt} DESC, ${edges2.id} DESC`;
814
+ const orderByClause = params.orderBy === "id" ? sql`${edges.id} ASC` : sql`${edges.createdAt} DESC, ${edges.id} DESC`;
1399
815
  if (params.limit !== void 0 && params.offset !== void 0) {
1400
816
  return sql`
1401
- SELECT * FROM ${edges2}
817
+ SELECT * FROM ${edges}
1402
818
  WHERE ${whereClause}
1403
819
  ORDER BY ${orderByClause}
1404
820
  LIMIT ${params.limit} OFFSET ${params.offset}
@@ -1406,254 +822,254 @@ function buildFindEdgesByKind(tables3, params) {
1406
822
  }
1407
823
  if (params.limit !== void 0) {
1408
824
  return sql`
1409
- SELECT * FROM ${edges2}
825
+ SELECT * FROM ${edges}
1410
826
  WHERE ${whereClause}
1411
827
  ORDER BY ${orderByClause}
1412
828
  LIMIT ${params.limit}
1413
829
  `;
1414
830
  }
1415
831
  return sql`
1416
- SELECT * FROM ${edges2}
832
+ SELECT * FROM ${edges}
1417
833
  WHERE ${whereClause}
1418
834
  ORDER BY ${orderByClause}
1419
835
  `;
1420
836
  }
1421
- function buildCountEdgesByKind(tables3, params) {
1422
- const { edges: edges2 } = tables3;
837
+ function buildCountEdgesByKind(tables, params) {
838
+ const { edges } = tables;
1423
839
  const conditions = [
1424
- sql`${edges2.graphId} = ${params.graphId}`,
1425
- sql`${edges2.kind} = ${params.kind}`,
1426
- ...buildTemporalConditions(edges2, params)
840
+ sql`${edges.graphId} = ${params.graphId}`,
841
+ sql`${edges.kind} = ${params.kind}`,
842
+ ...buildTemporalConditions(edges, params)
1427
843
  ];
1428
844
  if (params.fromKind !== void 0) {
1429
- conditions.push(sql`${edges2.fromKind} = ${params.fromKind}`);
845
+ conditions.push(sql`${edges.fromKind} = ${params.fromKind}`);
1430
846
  }
1431
847
  if (params.fromId !== void 0) {
1432
- conditions.push(sql`${edges2.fromId} = ${params.fromId}`);
848
+ conditions.push(sql`${edges.fromId} = ${params.fromId}`);
1433
849
  }
1434
850
  if (params.toKind !== void 0) {
1435
- conditions.push(sql`${edges2.toKind} = ${params.toKind}`);
851
+ conditions.push(sql`${edges.toKind} = ${params.toKind}`);
1436
852
  }
1437
853
  if (params.toId !== void 0) {
1438
- conditions.push(sql`${edges2.toId} = ${params.toId}`);
854
+ conditions.push(sql`${edges.toId} = ${params.toId}`);
1439
855
  }
1440
856
  const whereClause = sql.join(conditions, sql` AND `);
1441
857
  return sql`
1442
- SELECT COUNT(*) as count FROM ${edges2}
858
+ SELECT COUNT(*) as count FROM ${edges}
1443
859
  WHERE ${whereClause}
1444
860
  `;
1445
861
  }
1446
- function buildInsertEdge(tables3, params, timestamp2) {
1447
- const { edges: edges2 } = tables3;
862
+ function buildInsertEdge(tables, params, timestamp) {
863
+ const { edges } = tables;
1448
864
  const propsJson = JSON.stringify(params.props);
1449
- const columns = edgeColumnList(edges2);
865
+ const columns = edgeColumnList(edges);
1450
866
  return sql`
1451
- INSERT INTO ${edges2} (${columns})
867
+ INSERT INTO ${edges} (${columns})
1452
868
  VALUES (
1453
869
  ${params.graphId}, ${params.id}, ${params.kind},
1454
870
  ${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
1455
- ${propsJson}, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
1456
- ${timestamp2}, ${timestamp2}
871
+ ${propsJson}, ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}, ${sqlNull(params.validTo)},
872
+ ${timestamp}, ${timestamp}
1457
873
  )
1458
874
  RETURNING *
1459
875
  `;
1460
876
  }
1461
- function buildInsertEdgeNoReturn(tables3, params, timestamp2) {
1462
- const { edges: edges2 } = tables3;
877
+ function buildInsertEdgeNoReturn(tables, params, timestamp) {
878
+ const { edges } = tables;
1463
879
  const propsJson = JSON.stringify(params.props);
1464
- const columns = edgeColumnList(edges2);
880
+ const columns = edgeColumnList(edges);
1465
881
  return sql`
1466
- INSERT INTO ${edges2} (${columns})
882
+ INSERT INTO ${edges} (${columns})
1467
883
  VALUES (
1468
884
  ${params.graphId}, ${params.id}, ${params.kind},
1469
885
  ${params.fromKind}, ${params.fromId}, ${params.toKind}, ${params.toId},
1470
- ${propsJson}, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
1471
- ${timestamp2}, ${timestamp2}
886
+ ${propsJson}, ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}, ${sqlNull(params.validTo)},
887
+ ${timestamp}, ${timestamp}
1472
888
  )
1473
889
  `;
1474
890
  }
1475
- function buildInsertEdgesBatch(tables3, params, timestamp2) {
1476
- const { edges: edges2 } = tables3;
1477
- const columns = edgeColumnList(edges2);
891
+ function buildInsertEdgesBatch(tables, params, timestamp) {
892
+ const { edges } = tables;
893
+ const columns = edgeColumnList(edges);
1478
894
  const values = params.map((edgeParams) => {
1479
895
  const propsJson = JSON.stringify(edgeParams.props);
1480
- return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(resolveValidFrom(edgeParams.validFrom, timestamp2))}, ${sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
896
+ return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(resolveValidFrom(edgeParams.validFrom, timestamp))}, ${sqlNull(edgeParams.validTo)}, ${timestamp}, ${timestamp})`;
1481
897
  });
1482
898
  return sql`
1483
- INSERT INTO ${edges2} (${columns})
899
+ INSERT INTO ${edges} (${columns})
1484
900
  VALUES ${sql.join(values, sql`, `)}
1485
901
  `;
1486
902
  }
1487
- function buildInsertEdgesBatchReturning(tables3, params, timestamp2) {
1488
- const { edges: edges2 } = tables3;
1489
- const columns = edgeColumnList(edges2);
903
+ function buildInsertEdgesBatchReturning(tables, params, timestamp) {
904
+ const { edges } = tables;
905
+ const columns = edgeColumnList(edges);
1490
906
  const values = params.map((edgeParams) => {
1491
907
  const propsJson = JSON.stringify(edgeParams.props);
1492
- return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(resolveValidFrom(edgeParams.validFrom, timestamp2))}, ${sqlNull(edgeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
908
+ return sql`(${edgeParams.graphId}, ${edgeParams.id}, ${edgeParams.kind}, ${edgeParams.fromKind}, ${edgeParams.fromId}, ${edgeParams.toKind}, ${edgeParams.toId}, ${propsJson}, ${sqlNull(resolveValidFrom(edgeParams.validFrom, timestamp))}, ${sqlNull(edgeParams.validTo)}, ${timestamp}, ${timestamp})`;
1493
909
  });
1494
910
  return sql`
1495
- INSERT INTO ${edges2} (${columns})
911
+ INSERT INTO ${edges} (${columns})
1496
912
  VALUES ${sql.join(values, sql`, `)}
1497
913
  RETURNING *
1498
914
  `;
1499
915
  }
1500
- function buildGetEdge(tables3, graphId, id) {
1501
- const { edges: edges2 } = tables3;
916
+ function buildGetEdge(tables, graphId, id) {
917
+ const { edges } = tables;
1502
918
  return sql`
1503
- SELECT * FROM ${edges2}
1504
- WHERE ${edges2.graphId} = ${graphId}
1505
- AND ${edges2.id} = ${id}
919
+ SELECT * FROM ${edges}
920
+ WHERE ${edges.graphId} = ${graphId}
921
+ AND ${edges.id} = ${id}
1506
922
  `;
1507
923
  }
1508
- function buildGetEdges(tables3, graphId, ids) {
1509
- const { edges: edges2 } = tables3;
924
+ function buildGetEdges(tables, graphId, ids) {
925
+ const { edges } = tables;
1510
926
  return sql`
1511
- SELECT * FROM ${edges2}
1512
- WHERE ${edges2.graphId} = ${graphId}
1513
- AND ${edges2.id} IN (${sql.join(
927
+ SELECT * FROM ${edges}
928
+ WHERE ${edges.graphId} = ${graphId}
929
+ AND ${edges.id} IN (${sql.join(
1514
930
  ids.map((id) => sql`${id}`),
1515
931
  sql`, `
1516
932
  )})
1517
933
  `;
1518
934
  }
1519
- function buildUpdateEdge(tables3, params, timestamp2) {
1520
- const { edges: edges2 } = tables3;
935
+ function buildUpdateEdge(tables, params, timestamp) {
936
+ const { edges } = tables;
1521
937
  const propsJson = JSON.stringify(params.props);
1522
938
  const setParts = [
1523
- sql`${quotedColumn(edges2.props)} = ${propsJson}`,
1524
- sql`${quotedColumn(edges2.updatedAt)} = ${timestamp2}`
939
+ sql`${quotedColumn(edges.props)} = ${propsJson}`,
940
+ sql`${quotedColumn(edges.updatedAt)} = ${timestamp}`
1525
941
  ];
1526
942
  if (params.validTo !== void 0) {
1527
- setParts.push(sql`${quotedColumn(edges2.validTo)} = ${params.validTo}`);
943
+ setParts.push(sql`${quotedColumn(edges.validTo)} = ${params.validTo}`);
1528
944
  }
1529
945
  if (params.clearDeleted) {
1530
- setParts.push(sql`${quotedColumn(edges2.deletedAt)} = NULL`);
946
+ setParts.push(sql`${quotedColumn(edges.deletedAt)} = NULL`);
1531
947
  }
1532
948
  const setClause = sql.join(setParts, sql`, `);
1533
949
  if (params.clearDeleted) {
1534
950
  return sql`
1535
- UPDATE ${edges2}
951
+ UPDATE ${edges}
1536
952
  SET ${setClause}
1537
- WHERE ${edges2.graphId} = ${params.graphId}
1538
- AND ${edges2.id} = ${params.id}
953
+ WHERE ${edges.graphId} = ${params.graphId}
954
+ AND ${edges.id} = ${params.id}
1539
955
  RETURNING *
1540
956
  `;
1541
957
  }
1542
958
  return sql`
1543
- UPDATE ${edges2}
959
+ UPDATE ${edges}
1544
960
  SET ${setClause}
1545
- WHERE ${edges2.graphId} = ${params.graphId}
1546
- AND ${edges2.id} = ${params.id}
1547
- AND ${edges2.deletedAt} IS NULL
961
+ WHERE ${edges.graphId} = ${params.graphId}
962
+ AND ${edges.id} = ${params.id}
963
+ AND ${edges.deletedAt} IS NULL
1548
964
  RETURNING *
1549
965
  `;
1550
966
  }
1551
- function buildDeleteEdge(tables3, params, timestamp2) {
1552
- const { edges: edges2 } = tables3;
967
+ function buildDeleteEdge(tables, params, timestamp) {
968
+ const { edges } = tables;
1553
969
  return sql`
1554
- UPDATE ${edges2}
1555
- SET ${quotedColumn(edges2.deletedAt)} = ${timestamp2}
1556
- WHERE ${edges2.graphId} = ${params.graphId}
1557
- AND ${edges2.id} = ${params.id}
1558
- AND ${edges2.deletedAt} IS NULL
970
+ UPDATE ${edges}
971
+ SET ${quotedColumn(edges.deletedAt)} = ${timestamp}
972
+ WHERE ${edges.graphId} = ${params.graphId}
973
+ AND ${edges.id} = ${params.id}
974
+ AND ${edges.deletedAt} IS NULL
1559
975
  `;
1560
976
  }
1561
- function buildDeleteEdgesBatch(tables3, params, timestamp2) {
1562
- const { edges: edges2 } = tables3;
977
+ function buildDeleteEdgesBatch(tables, params, timestamp) {
978
+ const { edges } = tables;
1563
979
  return sql`
1564
- UPDATE ${edges2}
1565
- SET ${quotedColumn(edges2.deletedAt)} = ${timestamp2}
1566
- WHERE ${edges2.graphId} = ${params.graphId}
1567
- AND ${edges2.id} IN (${sql.join(
980
+ UPDATE ${edges}
981
+ SET ${quotedColumn(edges.deletedAt)} = ${timestamp}
982
+ WHERE ${edges.graphId} = ${params.graphId}
983
+ AND ${edges.id} IN (${sql.join(
1568
984
  params.ids.map((id) => sql`${id}`),
1569
985
  sql`, `
1570
986
  )})
1571
- AND ${edges2.deletedAt} IS NULL
987
+ AND ${edges.deletedAt} IS NULL
1572
988
  `;
1573
989
  }
1574
- function buildHardDeleteEdgesBatch(tables3, params) {
1575
- const { edges: edges2 } = tables3;
990
+ function buildHardDeleteEdgesBatch(tables, params) {
991
+ const { edges } = tables;
1576
992
  return sql`
1577
- DELETE FROM ${edges2}
1578
- WHERE ${edges2.graphId} = ${params.graphId}
1579
- AND ${edges2.id} IN (${sql.join(
993
+ DELETE FROM ${edges}
994
+ WHERE ${edges.graphId} = ${params.graphId}
995
+ AND ${edges.id} IN (${sql.join(
1580
996
  params.ids.map((id) => sql`${id}`),
1581
997
  sql`, `
1582
998
  )})
1583
999
  `;
1584
1000
  }
1585
- function buildHardDeleteEdge(tables3, params) {
1586
- const { edges: edges2 } = tables3;
1001
+ function buildHardDeleteEdge(tables, params) {
1002
+ const { edges } = tables;
1587
1003
  return sql`
1588
- DELETE FROM ${edges2}
1589
- WHERE ${edges2.graphId} = ${params.graphId}
1590
- AND ${edges2.id} = ${params.id}
1004
+ DELETE FROM ${edges}
1005
+ WHERE ${edges.graphId} = ${params.graphId}
1006
+ AND ${edges.id} = ${params.id}
1591
1007
  `;
1592
1008
  }
1593
- function buildHardDeleteEdgesByNode(tables3, graphId, nodeKind, nodeId) {
1594
- const { edges: edges2 } = tables3;
1009
+ function buildHardDeleteEdgesByNode(tables, graphId, nodeKind, nodeId) {
1010
+ const { edges } = tables;
1595
1011
  return sql`
1596
- DELETE FROM ${edges2}
1597
- WHERE ${edges2.graphId} = ${graphId}
1012
+ DELETE FROM ${edges}
1013
+ WHERE ${edges.graphId} = ${graphId}
1598
1014
  AND (
1599
- (${edges2.fromKind} = ${nodeKind} AND ${edges2.fromId} = ${nodeId})
1600
- OR (${edges2.toKind} = ${nodeKind} AND ${edges2.toId} = ${nodeId})
1015
+ (${edges.fromKind} = ${nodeKind} AND ${edges.fromId} = ${nodeId})
1016
+ OR (${edges.toKind} = ${nodeKind} AND ${edges.toId} = ${nodeId})
1601
1017
  )
1602
1018
  `;
1603
1019
  }
1604
- function buildCountEdgesFrom(tables3, params) {
1605
- const { edges: edges2 } = tables3;
1020
+ function buildCountEdgesFrom(tables, params) {
1021
+ const { edges } = tables;
1606
1022
  if (params.activeOnly) {
1607
1023
  return sql`
1608
- SELECT COUNT(*) as count FROM ${edges2}
1609
- WHERE ${edges2.graphId} = ${params.graphId}
1610
- AND ${edges2.kind} = ${params.edgeKind}
1611
- AND ${edges2.fromKind} = ${params.fromKind}
1612
- AND ${edges2.fromId} = ${params.fromId}
1613
- AND ${edges2.deletedAt} IS NULL
1614
- AND ${edges2.validTo} IS NULL
1024
+ SELECT COUNT(*) as count FROM ${edges}
1025
+ WHERE ${edges.graphId} = ${params.graphId}
1026
+ AND ${edges.kind} = ${params.edgeKind}
1027
+ AND ${edges.fromKind} = ${params.fromKind}
1028
+ AND ${edges.fromId} = ${params.fromId}
1029
+ AND ${edges.deletedAt} IS NULL
1030
+ AND ${edges.validTo} IS NULL
1615
1031
  `;
1616
1032
  }
1617
1033
  return sql`
1618
- SELECT COUNT(*) as count FROM ${edges2}
1619
- WHERE ${edges2.graphId} = ${params.graphId}
1620
- AND ${edges2.kind} = ${params.edgeKind}
1621
- AND ${edges2.fromKind} = ${params.fromKind}
1622
- AND ${edges2.fromId} = ${params.fromId}
1623
- AND ${edges2.deletedAt} IS NULL
1034
+ SELECT COUNT(*) as count FROM ${edges}
1035
+ WHERE ${edges.graphId} = ${params.graphId}
1036
+ AND ${edges.kind} = ${params.edgeKind}
1037
+ AND ${edges.fromKind} = ${params.fromKind}
1038
+ AND ${edges.fromId} = ${params.fromId}
1039
+ AND ${edges.deletedAt} IS NULL
1624
1040
  `;
1625
1041
  }
1626
- function buildEdgeExistsBetween(tables3, params) {
1627
- const { edges: edges2 } = tables3;
1042
+ function buildEdgeExistsBetween(tables, params) {
1043
+ const { edges } = tables;
1628
1044
  return sql`
1629
- SELECT 1 FROM ${edges2}
1630
- WHERE ${edges2.graphId} = ${params.graphId}
1631
- AND ${edges2.kind} = ${params.edgeKind}
1632
- AND ${edges2.fromKind} = ${params.fromKind}
1633
- AND ${edges2.fromId} = ${params.fromId}
1634
- AND ${edges2.toKind} = ${params.toKind}
1635
- AND ${edges2.toId} = ${params.toId}
1636
- AND ${edges2.deletedAt} IS NULL
1045
+ SELECT 1 FROM ${edges}
1046
+ WHERE ${edges.graphId} = ${params.graphId}
1047
+ AND ${edges.kind} = ${params.edgeKind}
1048
+ AND ${edges.fromKind} = ${params.fromKind}
1049
+ AND ${edges.fromId} = ${params.fromId}
1050
+ AND ${edges.toKind} = ${params.toKind}
1051
+ AND ${edges.toId} = ${params.toId}
1052
+ AND ${edges.deletedAt} IS NULL
1637
1053
  LIMIT 1
1638
1054
  `;
1639
1055
  }
1640
- function buildFindEdgesConnectedTo(tables3, params) {
1641
- const { edges: edges2 } = tables3;
1056
+ function buildFindEdgesConnectedTo(tables, params) {
1057
+ const { edges } = tables;
1642
1058
  return sql`
1643
- SELECT * FROM ${edges2}
1644
- WHERE ${edges2.graphId} = ${params.graphId}
1645
- AND ${edges2.deletedAt} IS NULL
1646
- AND ${edges2.fromKind} = ${params.nodeKind}
1647
- AND ${edges2.fromId} = ${params.nodeId}
1059
+ SELECT * FROM ${edges}
1060
+ WHERE ${edges.graphId} = ${params.graphId}
1061
+ AND ${edges.deletedAt} IS NULL
1062
+ AND ${edges.fromKind} = ${params.nodeKind}
1063
+ AND ${edges.fromId} = ${params.nodeId}
1648
1064
  UNION ALL
1649
- SELECT * FROM ${edges2}
1650
- WHERE ${edges2.graphId} = ${params.graphId}
1651
- AND ${edges2.deletedAt} IS NULL
1652
- AND ${edges2.toKind} = ${params.nodeKind}
1653
- AND ${edges2.toId} = ${params.nodeId}
1065
+ SELECT * FROM ${edges}
1066
+ WHERE ${edges.graphId} = ${params.graphId}
1067
+ AND ${edges.deletedAt} IS NULL
1068
+ AND ${edges.toKind} = ${params.nodeKind}
1069
+ AND ${edges.toId} = ${params.nodeId}
1654
1070
  AND NOT (
1655
- ${edges2.fromKind} = ${params.nodeKind}
1656
- AND ${edges2.fromId} = ${params.nodeId}
1071
+ ${edges.fromKind} = ${params.nodeKind}
1072
+ AND ${edges.fromId} = ${params.nodeId}
1657
1073
  )
1658
1074
  `;
1659
1075
  }
@@ -1715,136 +1131,136 @@ function assertValidSearchParams(params) {
1715
1131
  );
1716
1132
  }
1717
1133
  }
1718
- function buildInsertNode(tables3, params, timestamp2) {
1719
- const { nodes: nodes2 } = tables3;
1134
+ function buildInsertNode(tables, params, timestamp) {
1135
+ const { nodes } = tables;
1720
1136
  const propsJson = JSON.stringify(params.props);
1721
- const columns = nodeColumnList(nodes2);
1137
+ const columns = nodeColumnList(nodes);
1722
1138
  return sql`
1723
- INSERT INTO ${nodes2} (${columns})
1139
+ INSERT INTO ${nodes} (${columns})
1724
1140
  VALUES (
1725
1141
  ${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
1726
- 1, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
1727
- ${timestamp2}, ${timestamp2}
1142
+ 1, ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}, ${sqlNull(params.validTo)},
1143
+ ${timestamp}, ${timestamp}
1728
1144
  )
1729
1145
  RETURNING *
1730
1146
  `;
1731
1147
  }
1732
- function buildInsertNodeNoReturn(tables3, params, timestamp2) {
1733
- const { nodes: nodes2 } = tables3;
1148
+ function buildInsertNodeNoReturn(tables, params, timestamp) {
1149
+ const { nodes } = tables;
1734
1150
  const propsJson = JSON.stringify(params.props);
1735
- const columns = nodeColumnList(nodes2);
1151
+ const columns = nodeColumnList(nodes);
1736
1152
  return sql`
1737
- INSERT INTO ${nodes2} (${columns})
1153
+ INSERT INTO ${nodes} (${columns})
1738
1154
  VALUES (
1739
1155
  ${params.graphId}, ${params.kind}, ${params.id}, ${propsJson},
1740
- 1, ${sqlNull(resolveValidFrom(params.validFrom, timestamp2))}, ${sqlNull(params.validTo)},
1741
- ${timestamp2}, ${timestamp2}
1156
+ 1, ${sqlNull(resolveValidFrom(params.validFrom, timestamp))}, ${sqlNull(params.validTo)},
1157
+ ${timestamp}, ${timestamp}
1742
1158
  )
1743
1159
  `;
1744
1160
  }
1745
- function buildInsertNodesBatch(tables3, params, timestamp2) {
1746
- const { nodes: nodes2 } = tables3;
1747
- const columns = nodeColumnList(nodes2);
1161
+ function buildInsertNodesBatch(tables, params, timestamp) {
1162
+ const { nodes } = tables;
1163
+ const columns = nodeColumnList(nodes);
1748
1164
  const values = params.map((nodeParams) => {
1749
1165
  const propsJson = JSON.stringify(nodeParams.props);
1750
- return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(resolveValidFrom(nodeParams.validFrom, timestamp2))}, ${sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
1166
+ return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(resolveValidFrom(nodeParams.validFrom, timestamp))}, ${sqlNull(nodeParams.validTo)}, ${timestamp}, ${timestamp})`;
1751
1167
  });
1752
1168
  return sql`
1753
- INSERT INTO ${nodes2} (${columns})
1169
+ INSERT INTO ${nodes} (${columns})
1754
1170
  VALUES ${sql.join(values, sql`, `)}
1755
1171
  `;
1756
1172
  }
1757
- function buildInsertNodesBatchReturning(tables3, params, timestamp2) {
1758
- const { nodes: nodes2 } = tables3;
1759
- const columns = nodeColumnList(nodes2);
1173
+ function buildInsertNodesBatchReturning(tables, params, timestamp) {
1174
+ const { nodes } = tables;
1175
+ const columns = nodeColumnList(nodes);
1760
1176
  const values = params.map((nodeParams) => {
1761
1177
  const propsJson = JSON.stringify(nodeParams.props);
1762
- return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(resolveValidFrom(nodeParams.validFrom, timestamp2))}, ${sqlNull(nodeParams.validTo)}, ${timestamp2}, ${timestamp2})`;
1178
+ return sql`(${nodeParams.graphId}, ${nodeParams.kind}, ${nodeParams.id}, ${propsJson}, 1, ${sqlNull(resolveValidFrom(nodeParams.validFrom, timestamp))}, ${sqlNull(nodeParams.validTo)}, ${timestamp}, ${timestamp})`;
1763
1179
  });
1764
1180
  return sql`
1765
- INSERT INTO ${nodes2} (${columns})
1181
+ INSERT INTO ${nodes} (${columns})
1766
1182
  VALUES ${sql.join(values, sql`, `)}
1767
1183
  RETURNING *
1768
1184
  `;
1769
1185
  }
1770
- function buildGetNode(tables3, graphId, kind, id) {
1771
- const { nodes: nodes2 } = tables3;
1186
+ function buildGetNode(tables, graphId, kind, id) {
1187
+ const { nodes } = tables;
1772
1188
  return sql`
1773
- SELECT * FROM ${nodes2}
1774
- WHERE ${nodes2.graphId} = ${graphId}
1775
- AND ${nodes2.kind} = ${kind}
1776
- AND ${nodes2.id} = ${id}
1189
+ SELECT * FROM ${nodes}
1190
+ WHERE ${nodes.graphId} = ${graphId}
1191
+ AND ${nodes.kind} = ${kind}
1192
+ AND ${nodes.id} = ${id}
1777
1193
  `;
1778
1194
  }
1779
- function buildGetNodes(tables3, graphId, kind, ids) {
1780
- const { nodes: nodes2 } = tables3;
1195
+ function buildGetNodes(tables, graphId, kind, ids) {
1196
+ const { nodes } = tables;
1781
1197
  return sql`
1782
- SELECT * FROM ${nodes2}
1783
- WHERE ${nodes2.graphId} = ${graphId}
1784
- AND ${nodes2.kind} = ${kind}
1785
- AND ${nodes2.id} IN (${sql.join(
1198
+ SELECT * FROM ${nodes}
1199
+ WHERE ${nodes.graphId} = ${graphId}
1200
+ AND ${nodes.kind} = ${kind}
1201
+ AND ${nodes.id} IN (${sql.join(
1786
1202
  ids.map((id) => sql`${id}`),
1787
1203
  sql`, `
1788
1204
  )})
1789
1205
  `;
1790
1206
  }
1791
- function buildUpdateNode(tables3, params, timestamp2) {
1792
- const { nodes: nodes2 } = tables3;
1207
+ function buildUpdateNode(tables, params, timestamp) {
1208
+ const { nodes } = tables;
1793
1209
  const propsJson = JSON.stringify(params.props);
1794
1210
  const setParts = [
1795
- sql`${quotedColumn(nodes2.props)} = ${propsJson}`,
1796
- sql`${quotedColumn(nodes2.updatedAt)} = ${timestamp2}`
1211
+ sql`${quotedColumn(nodes.props)} = ${propsJson}`,
1212
+ sql`${quotedColumn(nodes.updatedAt)} = ${timestamp}`
1797
1213
  ];
1798
1214
  if (params.incrementVersion) {
1799
1215
  setParts.push(
1800
- sql`${quotedColumn(nodes2.version)} = ${quotedColumn(nodes2.version)} + 1`
1216
+ sql`${quotedColumn(nodes.version)} = ${quotedColumn(nodes.version)} + 1`
1801
1217
  );
1802
1218
  }
1803
1219
  if (params.validTo !== void 0) {
1804
- setParts.push(sql`${quotedColumn(nodes2.validTo)} = ${params.validTo}`);
1220
+ setParts.push(sql`${quotedColumn(nodes.validTo)} = ${params.validTo}`);
1805
1221
  }
1806
1222
  if (params.clearDeleted) {
1807
- setParts.push(sql`${quotedColumn(nodes2.deletedAt)} = NULL`);
1223
+ setParts.push(sql`${quotedColumn(nodes.deletedAt)} = NULL`);
1808
1224
  }
1809
1225
  const setClause = sql.join(setParts, sql`, `);
1810
1226
  if (params.clearDeleted) {
1811
1227
  return sql`
1812
- UPDATE ${nodes2}
1228
+ UPDATE ${nodes}
1813
1229
  SET ${setClause}
1814
- WHERE ${nodes2.graphId} = ${params.graphId}
1815
- AND ${nodes2.kind} = ${params.kind}
1816
- AND ${nodes2.id} = ${params.id}
1230
+ WHERE ${nodes.graphId} = ${params.graphId}
1231
+ AND ${nodes.kind} = ${params.kind}
1232
+ AND ${nodes.id} = ${params.id}
1817
1233
  RETURNING *
1818
1234
  `;
1819
1235
  }
1820
1236
  return sql`
1821
- UPDATE ${nodes2}
1237
+ UPDATE ${nodes}
1822
1238
  SET ${setClause}
1823
- WHERE ${nodes2.graphId} = ${params.graphId}
1824
- AND ${nodes2.kind} = ${params.kind}
1825
- AND ${nodes2.id} = ${params.id}
1826
- AND ${nodes2.deletedAt} IS NULL
1239
+ WHERE ${nodes.graphId} = ${params.graphId}
1240
+ AND ${nodes.kind} = ${params.kind}
1241
+ AND ${nodes.id} = ${params.id}
1242
+ AND ${nodes.deletedAt} IS NULL
1827
1243
  RETURNING *
1828
1244
  `;
1829
1245
  }
1830
- function buildDeleteNode(tables3, params, timestamp2) {
1831
- const { nodes: nodes2 } = tables3;
1246
+ function buildDeleteNode(tables, params, timestamp) {
1247
+ const { nodes } = tables;
1832
1248
  return sql`
1833
- UPDATE ${nodes2}
1834
- SET ${quotedColumn(nodes2.deletedAt)} = ${timestamp2}
1835
- WHERE ${nodes2.graphId} = ${params.graphId}
1836
- AND ${nodes2.kind} = ${params.kind}
1837
- AND ${nodes2.id} = ${params.id}
1838
- AND ${nodes2.deletedAt} IS NULL
1249
+ UPDATE ${nodes}
1250
+ SET ${quotedColumn(nodes.deletedAt)} = ${timestamp}
1251
+ WHERE ${nodes.graphId} = ${params.graphId}
1252
+ AND ${nodes.kind} = ${params.kind}
1253
+ AND ${nodes.id} = ${params.id}
1254
+ AND ${nodes.deletedAt} IS NULL
1839
1255
  `;
1840
1256
  }
1841
- function buildHardDeleteNode(tables3, params) {
1842
- const { nodes: nodes2 } = tables3;
1257
+ function buildHardDeleteNode(tables, params) {
1258
+ const { nodes } = tables;
1843
1259
  return sql`
1844
- DELETE FROM ${nodes2}
1845
- WHERE ${nodes2.graphId} = ${params.graphId}
1846
- AND ${nodes2.kind} = ${params.kind}
1847
- AND ${nodes2.id} = ${params.id}
1260
+ DELETE FROM ${nodes}
1261
+ WHERE ${nodes.graphId} = ${params.graphId}
1262
+ AND ${nodes.kind} = ${params.kind}
1263
+ AND ${nodes.id} = ${params.id}
1848
1264
  `;
1849
1265
  }
1850
1266
  function createSchemaDialectStrategy(dialect) {
@@ -1865,144 +1281,144 @@ var SCHEMA_DIALECT_STRATEGIES = {
1865
1281
  postgres: createSchemaDialectStrategy("postgres"),
1866
1282
  sqlite: createSchemaDialectStrategy("sqlite")
1867
1283
  };
1868
- function buildInsertSchema(tables3, params, timestamp2, dialect = "sqlite") {
1869
- const { schemaVersions: schemaVersions2 } = tables3;
1284
+ function buildInsertSchema(tables, params, timestamp, dialect = "sqlite") {
1285
+ const { schemaVersions } = tables;
1870
1286
  const strategy = SCHEMA_DIALECT_STRATEGIES[dialect];
1871
1287
  const schemaDocumentJson = JSON.stringify(params.schemaDoc);
1872
1288
  const isActiveValue = strategy.booleanLiteral(params.isActive);
1873
1289
  const columns = sql.raw(
1874
- `"${schemaVersions2.graphId.name}", "${schemaVersions2.version.name}", "${schemaVersions2.schemaHash.name}", "${schemaVersions2.schemaDoc.name}", "${schemaVersions2.createdAt.name}", "${schemaVersions2.isActive.name}"`
1290
+ `"${schemaVersions.graphId.name}", "${schemaVersions.version.name}", "${schemaVersions.schemaHash.name}", "${schemaVersions.schemaDoc.name}", "${schemaVersions.createdAt.name}", "${schemaVersions.isActive.name}"`
1875
1291
  );
1876
1292
  return sql`
1877
- INSERT INTO ${schemaVersions2} (${columns})
1293
+ INSERT INTO ${schemaVersions} (${columns})
1878
1294
  VALUES (
1879
1295
  ${params.graphId}, ${params.version},
1880
1296
  ${params.schemaHash}, ${schemaDocumentJson},
1881
- ${timestamp2}, ${isActiveValue}
1297
+ ${timestamp}, ${isActiveValue}
1882
1298
  )
1883
1299
  RETURNING *
1884
1300
  `;
1885
1301
  }
1886
- function buildGetActiveSchema(tables3, graphId, dialect = "sqlite") {
1887
- const { schemaVersions: schemaVersions2 } = tables3;
1302
+ function buildGetActiveSchema(tables, graphId, dialect = "sqlite") {
1303
+ const { schemaVersions } = tables;
1888
1304
  const strategy = SCHEMA_DIALECT_STRATEGIES[dialect];
1889
1305
  return sql`
1890
- SELECT * FROM ${schemaVersions2}
1891
- WHERE ${schemaVersions2.graphId} = ${graphId}
1892
- AND ${schemaVersions2.isActive} = ${strategy.booleanLiteral(true)}
1306
+ SELECT * FROM ${schemaVersions}
1307
+ WHERE ${schemaVersions.graphId} = ${graphId}
1308
+ AND ${schemaVersions.isActive} = ${strategy.booleanLiteral(true)}
1893
1309
  `;
1894
1310
  }
1895
- function buildGetSchemaVersion(tables3, graphId, version) {
1896
- const { schemaVersions: schemaVersions2 } = tables3;
1311
+ function buildGetSchemaVersion(tables, graphId, version) {
1312
+ const { schemaVersions } = tables;
1897
1313
  return sql`
1898
- SELECT * FROM ${schemaVersions2}
1899
- WHERE ${schemaVersions2.graphId} = ${graphId}
1900
- AND ${schemaVersions2.version} = ${version}
1314
+ SELECT * FROM ${schemaVersions}
1315
+ WHERE ${schemaVersions.graphId} = ${graphId}
1316
+ AND ${schemaVersions.version} = ${version}
1901
1317
  `;
1902
1318
  }
1903
- function buildSetActiveSchema(tables3, graphId, version, dialect = "sqlite") {
1904
- const { schemaVersions: schemaVersions2 } = tables3;
1319
+ function buildSetActiveSchema(tables, graphId, version, dialect = "sqlite") {
1320
+ const { schemaVersions } = tables;
1905
1321
  const strategy = SCHEMA_DIALECT_STRATEGIES[dialect];
1906
1322
  const deactivateAll = sql`
1907
- UPDATE ${schemaVersions2}
1908
- SET ${quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(false)}
1909
- WHERE ${schemaVersions2.graphId} = ${graphId}
1323
+ UPDATE ${schemaVersions}
1324
+ SET ${quotedColumn(schemaVersions.isActive)} = ${strategy.booleanLiteral(false)}
1325
+ WHERE ${schemaVersions.graphId} = ${graphId}
1910
1326
  `;
1911
1327
  const activateVersion = sql`
1912
- UPDATE ${schemaVersions2}
1913
- SET ${quotedColumn(schemaVersions2.isActive)} = ${strategy.booleanLiteral(true)}
1914
- WHERE ${schemaVersions2.graphId} = ${graphId}
1915
- AND ${schemaVersions2.version} = ${version}
1328
+ UPDATE ${schemaVersions}
1329
+ SET ${quotedColumn(schemaVersions.isActive)} = ${strategy.booleanLiteral(true)}
1330
+ WHERE ${schemaVersions.graphId} = ${graphId}
1331
+ AND ${schemaVersions.version} = ${version}
1916
1332
  `;
1917
1333
  return { deactivateAll, activateVersion };
1918
1334
  }
1919
- function buildInsertUniqueSqlite(tables3, params) {
1920
- const { uniques: uniques2 } = tables3;
1335
+ function buildInsertUniqueSqlite(tables, params) {
1336
+ const { uniques } = tables;
1921
1337
  const columns = sql.raw(
1922
- `"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}", "${uniques2.nodeId.name}", "${uniques2.concreteKind.name}", "${uniques2.deletedAt.name}"`
1338
+ `"${uniques.graphId.name}", "${uniques.nodeKind.name}", "${uniques.constraintName.name}", "${uniques.key.name}", "${uniques.nodeId.name}", "${uniques.concreteKind.name}", "${uniques.deletedAt.name}"`
1923
1339
  );
1924
1340
  const conflictColumns = sql.raw(
1925
- `"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}"`
1341
+ `"${uniques.graphId.name}", "${uniques.nodeKind.name}", "${uniques.constraintName.name}", "${uniques.key.name}"`
1926
1342
  );
1927
1343
  return sql`
1928
- INSERT INTO ${uniques2} (${columns})
1344
+ INSERT INTO ${uniques} (${columns})
1929
1345
  VALUES (
1930
1346
  ${params.graphId}, ${params.nodeKind}, ${params.constraintName},
1931
1347
  ${params.key}, ${params.nodeId}, ${params.concreteKind}, ${sql.raw("NULL")}
1932
1348
  )
1933
1349
  ON CONFLICT (${conflictColumns})
1934
1350
  DO UPDATE SET
1935
- ${quotedColumn(uniques2.nodeId)} = CASE
1936
- WHEN ${quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
1937
- WHEN ${quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.nodeId}
1938
- ELSE ${quotedColumn(uniques2.nodeId)}
1351
+ ${quotedColumn(uniques.nodeId)} = CASE
1352
+ WHEN ${quotedColumn(uniques.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
1353
+ WHEN ${quotedColumn(uniques.deletedAt)} IS NOT NULL THEN ${params.nodeId}
1354
+ ELSE ${quotedColumn(uniques.nodeId)}
1939
1355
  END,
1940
- ${quotedColumn(uniques2.concreteKind)} = CASE
1941
- WHEN ${quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
1942
- WHEN ${quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
1943
- ELSE ${quotedColumn(uniques2.concreteKind)}
1356
+ ${quotedColumn(uniques.concreteKind)} = CASE
1357
+ WHEN ${quotedColumn(uniques.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
1358
+ WHEN ${quotedColumn(uniques.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
1359
+ ELSE ${quotedColumn(uniques.concreteKind)}
1944
1360
  END,
1945
- ${quotedColumn(uniques2.deletedAt)} = CASE
1946
- WHEN ${quotedColumn(uniques2.nodeId)} = ${params.nodeId} THEN NULL
1947
- WHEN ${quotedColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
1948
- ELSE ${quotedColumn(uniques2.deletedAt)}
1361
+ ${quotedColumn(uniques.deletedAt)} = CASE
1362
+ WHEN ${quotedColumn(uniques.nodeId)} = ${params.nodeId} THEN NULL
1363
+ WHEN ${quotedColumn(uniques.deletedAt)} IS NOT NULL THEN NULL
1364
+ ELSE ${quotedColumn(uniques.deletedAt)}
1949
1365
  END
1950
- RETURNING ${quotedColumn(uniques2.nodeId)} as node_id
1366
+ RETURNING ${quotedColumn(uniques.nodeId)} as node_id
1951
1367
  `;
1952
1368
  }
1953
- function buildInsertUniquePostgres(tables3, params) {
1954
- const { uniques: uniques2 } = tables3;
1369
+ function buildInsertUniquePostgres(tables, params) {
1370
+ const { uniques } = tables;
1955
1371
  const columns = sql.raw(
1956
- `"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}", "${uniques2.nodeId.name}", "${uniques2.concreteKind.name}", "${uniques2.deletedAt.name}"`
1372
+ `"${uniques.graphId.name}", "${uniques.nodeKind.name}", "${uniques.constraintName.name}", "${uniques.key.name}", "${uniques.nodeId.name}", "${uniques.concreteKind.name}", "${uniques.deletedAt.name}"`
1957
1373
  );
1958
1374
  const conflictColumns = sql.raw(
1959
- `"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}"`
1375
+ `"${uniques.graphId.name}", "${uniques.nodeKind.name}", "${uniques.constraintName.name}", "${uniques.key.name}"`
1960
1376
  );
1961
- const tableName = getTableName(uniques2);
1377
+ const tableName = getTableName(uniques);
1962
1378
  const existingColumn = (column) => sql.raw(`"${tableName}"."${column.name}"`);
1963
1379
  return sql`
1964
- INSERT INTO ${uniques2} (${columns})
1380
+ INSERT INTO ${uniques} (${columns})
1965
1381
  VALUES (
1966
1382
  ${params.graphId}, ${params.nodeKind}, ${params.constraintName},
1967
1383
  ${params.key}, ${params.nodeId}, ${params.concreteKind}, ${sql.raw("NULL")}
1968
1384
  )
1969
1385
  ON CONFLICT (${conflictColumns})
1970
1386
  DO UPDATE SET
1971
- ${quotedColumn(uniques2.nodeId)} = CASE
1972
- WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
1973
- WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.nodeId}
1974
- ELSE ${existingColumn(uniques2.nodeId)}
1387
+ ${quotedColumn(uniques.nodeId)} = CASE
1388
+ WHEN ${existingColumn(uniques.nodeId)} = ${params.nodeId} THEN ${params.nodeId}
1389
+ WHEN ${existingColumn(uniques.deletedAt)} IS NOT NULL THEN ${params.nodeId}
1390
+ ELSE ${existingColumn(uniques.nodeId)}
1975
1391
  END,
1976
- ${quotedColumn(uniques2.concreteKind)} = CASE
1977
- WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
1978
- WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
1979
- ELSE ${existingColumn(uniques2.concreteKind)}
1392
+ ${quotedColumn(uniques.concreteKind)} = CASE
1393
+ WHEN ${existingColumn(uniques.nodeId)} = ${params.nodeId} THEN ${params.concreteKind}
1394
+ WHEN ${existingColumn(uniques.deletedAt)} IS NOT NULL THEN ${params.concreteKind}
1395
+ ELSE ${existingColumn(uniques.concreteKind)}
1980
1396
  END,
1981
- ${quotedColumn(uniques2.deletedAt)} = CASE
1982
- WHEN ${existingColumn(uniques2.nodeId)} = ${params.nodeId} THEN NULL
1983
- WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
1984
- ELSE ${existingColumn(uniques2.deletedAt)}
1397
+ ${quotedColumn(uniques.deletedAt)} = CASE
1398
+ WHEN ${existingColumn(uniques.nodeId)} = ${params.nodeId} THEN NULL
1399
+ WHEN ${existingColumn(uniques.deletedAt)} IS NOT NULL THEN NULL
1400
+ ELSE ${existingColumn(uniques.deletedAt)}
1985
1401
  END
1986
- RETURNING ${quotedColumn(uniques2.nodeId)} as node_id
1402
+ RETURNING ${quotedColumn(uniques.nodeId)} as node_id
1987
1403
  `;
1988
1404
  }
1989
1405
  var UNIQUE_INSERT_BUILDERS = {
1990
1406
  postgres: buildInsertUniquePostgres,
1991
1407
  sqlite: buildInsertUniqueSqlite
1992
1408
  };
1993
- function buildInsertUnique(tables3, dialect, params) {
1409
+ function buildInsertUnique(tables, dialect, params) {
1994
1410
  const builder = UNIQUE_INSERT_BUILDERS[dialect];
1995
- return builder(tables3, params);
1411
+ return builder(tables, params);
1996
1412
  }
1997
- function buildInsertUniqueBatch(tables3, dialect, entries) {
1998
- const { uniques: uniques2 } = tables3;
1413
+ function buildInsertUniqueBatch(tables, dialect, entries) {
1414
+ const { uniques } = tables;
1999
1415
  const columns = sql.raw(
2000
- `"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}", "${uniques2.nodeId.name}", "${uniques2.concreteKind.name}", "${uniques2.deletedAt.name}"`
1416
+ `"${uniques.graphId.name}", "${uniques.nodeKind.name}", "${uniques.constraintName.name}", "${uniques.key.name}", "${uniques.nodeId.name}", "${uniques.concreteKind.name}", "${uniques.deletedAt.name}"`
2001
1417
  );
2002
1418
  const conflictColumns = sql.raw(
2003
- `"${uniques2.graphId.name}", "${uniques2.nodeKind.name}", "${uniques2.constraintName.name}", "${uniques2.key.name}"`
1419
+ `"${uniques.graphId.name}", "${uniques.nodeKind.name}", "${uniques.constraintName.name}", "${uniques.key.name}"`
2004
1420
  );
2005
- const tableName = getTableName(uniques2);
1421
+ const tableName = getTableName(uniques);
2006
1422
  const existingColumn = (column) => {
2007
1423
  switch (dialect) {
2008
1424
  case "postgres": {
@@ -2024,102 +1440,102 @@ function buildInsertUniqueBatch(tables3, dialect, entries) {
2024
1440
  sql`, `
2025
1441
  );
2026
1442
  return sql`
2027
- INSERT INTO ${uniques2} (${columns})
1443
+ INSERT INTO ${uniques} (${columns})
2028
1444
  VALUES ${valueRows}
2029
1445
  ON CONFLICT (${conflictColumns})
2030
1446
  DO UPDATE SET
2031
- ${quotedColumn(uniques2.nodeId)} = CASE
2032
- WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN ${excludedColumn(uniques2.nodeId)}
2033
- WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques2.nodeId)}
2034
- ELSE ${existingColumn(uniques2.nodeId)}
1447
+ ${quotedColumn(uniques.nodeId)} = CASE
1448
+ WHEN ${existingColumn(uniques.nodeId)} = ${excludedColumn(uniques.nodeId)} THEN ${excludedColumn(uniques.nodeId)}
1449
+ WHEN ${existingColumn(uniques.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques.nodeId)}
1450
+ ELSE ${existingColumn(uniques.nodeId)}
2035
1451
  END,
2036
- ${quotedColumn(uniques2.concreteKind)} = CASE
2037
- WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN ${excludedColumn(uniques2.concreteKind)}
2038
- WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques2.concreteKind)}
2039
- ELSE ${existingColumn(uniques2.concreteKind)}
1452
+ ${quotedColumn(uniques.concreteKind)} = CASE
1453
+ WHEN ${existingColumn(uniques.nodeId)} = ${excludedColumn(uniques.nodeId)} THEN ${excludedColumn(uniques.concreteKind)}
1454
+ WHEN ${existingColumn(uniques.deletedAt)} IS NOT NULL THEN ${excludedColumn(uniques.concreteKind)}
1455
+ ELSE ${existingColumn(uniques.concreteKind)}
2040
1456
  END,
2041
- ${quotedColumn(uniques2.deletedAt)} = CASE
2042
- WHEN ${existingColumn(uniques2.nodeId)} = ${excludedColumn(uniques2.nodeId)} THEN NULL
2043
- WHEN ${existingColumn(uniques2.deletedAt)} IS NOT NULL THEN NULL
2044
- ELSE ${existingColumn(uniques2.deletedAt)}
1457
+ ${quotedColumn(uniques.deletedAt)} = CASE
1458
+ WHEN ${existingColumn(uniques.nodeId)} = ${excludedColumn(uniques.nodeId)} THEN NULL
1459
+ WHEN ${existingColumn(uniques.deletedAt)} IS NOT NULL THEN NULL
1460
+ ELSE ${existingColumn(uniques.deletedAt)}
2045
1461
  END
2046
1462
  RETURNING
2047
- ${quotedColumn(uniques2.nodeKind)} as node_kind,
2048
- ${quotedColumn(uniques2.constraintName)} as constraint_name,
2049
- ${quotedColumn(uniques2.key)} as key,
2050
- ${quotedColumn(uniques2.nodeId)} as node_id
1463
+ ${quotedColumn(uniques.nodeKind)} as node_kind,
1464
+ ${quotedColumn(uniques.constraintName)} as constraint_name,
1465
+ ${quotedColumn(uniques.key)} as key,
1466
+ ${quotedColumn(uniques.nodeId)} as node_id
2051
1467
  `;
2052
1468
  }
2053
- function buildDeleteUnique(tables3, params, timestamp2) {
2054
- const { uniques: uniques2 } = tables3;
1469
+ function buildDeleteUnique(tables, params, timestamp) {
1470
+ const { uniques } = tables;
2055
1471
  return sql`
2056
- UPDATE ${uniques2}
2057
- SET ${quotedColumn(uniques2.deletedAt)} = ${timestamp2}
2058
- WHERE ${uniques2.graphId} = ${params.graphId}
2059
- AND ${uniques2.nodeKind} = ${params.nodeKind}
2060
- AND ${uniques2.constraintName} = ${params.constraintName}
2061
- AND ${uniques2.key} = ${params.key}
2062
- AND ${uniques2.deletedAt} IS NULL
1472
+ UPDATE ${uniques}
1473
+ SET ${quotedColumn(uniques.deletedAt)} = ${timestamp}
1474
+ WHERE ${uniques.graphId} = ${params.graphId}
1475
+ AND ${uniques.nodeKind} = ${params.nodeKind}
1476
+ AND ${uniques.constraintName} = ${params.constraintName}
1477
+ AND ${uniques.key} = ${params.key}
1478
+ AND ${uniques.deletedAt} IS NULL
2063
1479
  `;
2064
1480
  }
2065
- function buildHardDeleteUniquesByNode(tables3, graphId, nodeId) {
2066
- const { uniques: uniques2 } = tables3;
1481
+ function buildHardDeleteUniquesByNode(tables, graphId, nodeId) {
1482
+ const { uniques } = tables;
2067
1483
  return sql`
2068
- DELETE FROM ${uniques2}
2069
- WHERE ${uniques2.graphId} = ${graphId}
2070
- AND ${uniques2.nodeId} = ${nodeId}
1484
+ DELETE FROM ${uniques}
1485
+ WHERE ${uniques.graphId} = ${graphId}
1486
+ AND ${uniques.nodeId} = ${nodeId}
2071
1487
  `;
2072
1488
  }
2073
- function buildCheckUnique(tables3, params) {
2074
- const { uniques: uniques2 } = tables3;
1489
+ function buildCheckUnique(tables, params) {
1490
+ const { uniques } = tables;
2075
1491
  if (params.includeDeleted) {
2076
1492
  return sql`
2077
- SELECT * FROM ${uniques2}
2078
- WHERE ${uniques2.graphId} = ${params.graphId}
2079
- AND ${uniques2.nodeKind} = ${params.nodeKind}
2080
- AND ${uniques2.constraintName} = ${params.constraintName}
2081
- AND ${uniques2.key} = ${params.key}
1493
+ SELECT * FROM ${uniques}
1494
+ WHERE ${uniques.graphId} = ${params.graphId}
1495
+ AND ${uniques.nodeKind} = ${params.nodeKind}
1496
+ AND ${uniques.constraintName} = ${params.constraintName}
1497
+ AND ${uniques.key} = ${params.key}
2082
1498
  `;
2083
1499
  }
2084
1500
  return sql`
2085
- SELECT * FROM ${uniques2}
2086
- WHERE ${uniques2.graphId} = ${params.graphId}
2087
- AND ${uniques2.nodeKind} = ${params.nodeKind}
2088
- AND ${uniques2.constraintName} = ${params.constraintName}
2089
- AND ${uniques2.key} = ${params.key}
2090
- AND ${uniques2.deletedAt} IS NULL
1501
+ SELECT * FROM ${uniques}
1502
+ WHERE ${uniques.graphId} = ${params.graphId}
1503
+ AND ${uniques.nodeKind} = ${params.nodeKind}
1504
+ AND ${uniques.constraintName} = ${params.constraintName}
1505
+ AND ${uniques.key} = ${params.key}
1506
+ AND ${uniques.deletedAt} IS NULL
2091
1507
  `;
2092
1508
  }
2093
- function buildCheckUniqueBatch(tables3, params) {
2094
- const { uniques: uniques2 } = tables3;
1509
+ function buildCheckUniqueBatch(tables, params) {
1510
+ const { uniques } = tables;
2095
1511
  const keyPlaceholders = sql.join(
2096
1512
  params.keys.map((key) => sql`${key}`),
2097
1513
  sql`, `
2098
1514
  );
2099
1515
  if (params.includeDeleted) {
2100
1516
  return sql`
2101
- SELECT * FROM ${uniques2}
2102
- WHERE ${uniques2.graphId} = ${params.graphId}
2103
- AND ${uniques2.nodeKind} = ${params.nodeKind}
2104
- AND ${uniques2.constraintName} = ${params.constraintName}
2105
- AND ${uniques2.key} IN (${keyPlaceholders})
1517
+ SELECT * FROM ${uniques}
1518
+ WHERE ${uniques.graphId} = ${params.graphId}
1519
+ AND ${uniques.nodeKind} = ${params.nodeKind}
1520
+ AND ${uniques.constraintName} = ${params.constraintName}
1521
+ AND ${uniques.key} IN (${keyPlaceholders})
2106
1522
  `;
2107
1523
  }
2108
1524
  return sql`
2109
- SELECT * FROM ${uniques2}
2110
- WHERE ${uniques2.graphId} = ${params.graphId}
2111
- AND ${uniques2.nodeKind} = ${params.nodeKind}
2112
- AND ${uniques2.constraintName} = ${params.constraintName}
2113
- AND ${uniques2.key} IN (${keyPlaceholders})
2114
- AND ${uniques2.deletedAt} IS NULL
1525
+ SELECT * FROM ${uniques}
1526
+ WHERE ${uniques.graphId} = ${params.graphId}
1527
+ AND ${uniques.nodeKind} = ${params.nodeKind}
1528
+ AND ${uniques.constraintName} = ${params.constraintName}
1529
+ AND ${uniques.key} IN (${keyPlaceholders})
1530
+ AND ${uniques.deletedAt} IS NULL
2115
1531
  `;
2116
1532
  }
2117
1533
 
2118
1534
  // src/backend/drizzle/operations/strategy.ts
2119
- function bindTableOperationBuilders(tables3, builders) {
1535
+ function bindTableOperationBuilders(tables, builders) {
2120
1536
  const boundEntries = Object.entries(builders).map(([name, builder]) => {
2121
1537
  function boundBuilder(...args) {
2122
- return builder(tables3, ...args);
1538
+ return builder(tables, ...args);
2123
1539
  }
2124
1540
  return [name, boundBuilder];
2125
1541
  });
@@ -2162,21 +1578,21 @@ var COMMON_TABLE_OPERATION_BUILDERS = {
2162
1578
  buildCheckUniqueBatch,
2163
1579
  buildGetSchemaVersion
2164
1580
  };
2165
- function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
1581
+ function createCommonOperationStrategy(tables, dialect, fulltextStrategy) {
2166
1582
  const tableOperations = bindTableOperationBuilders(
2167
- tables3,
1583
+ tables,
2168
1584
  COMMON_TABLE_OPERATION_BUILDERS
2169
1585
  );
2170
- const fulltextTable = tables3.fulltextTableName;
1586
+ const fulltextTable = tables.fulltextTableName;
2171
1587
  const fulltextBuilders = {
2172
- buildUpsertFulltext: (params, timestamp2) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp2).map((statement) => toDrizzleSql(statement, dialect)),
1588
+ buildUpsertFulltext: (params, timestamp) => fulltextStrategy.buildUpsert(fulltextTable, params, timestamp).map((statement) => toDrizzleSql(statement, dialect)),
2173
1589
  buildDeleteFulltext: (params) => fulltextStrategy.buildDelete(fulltextTable, params).map((statement) => toDrizzleSql(statement, dialect)),
2174
1590
  buildDeleteFulltextByNode: (graphId, nodeKind, nodeId) => fulltextStrategy.buildDelete(fulltextTable, {
2175
1591
  graphId,
2176
1592
  nodeKind,
2177
1593
  nodeId
2178
1594
  }).map((statement) => toDrizzleSql(statement, dialect)),
2179
- buildUpsertFulltextBatch: (params, timestamp2) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp2).map((statement) => toDrizzleSql(statement, dialect)),
1595
+ buildUpsertFulltextBatch: (params, timestamp) => fulltextStrategy.buildBatchUpsert(fulltextTable, params, timestamp).map((statement) => toDrizzleSql(statement, dialect)),
2180
1596
  buildDeleteFulltextBatch: (params) => fulltextStrategy.buildBatchDelete(fulltextTable, params).map((statement) => toDrizzleSql(statement, dialect)),
2181
1597
  buildFulltextSearch: (params) => buildFulltextSearch(
2182
1598
  fulltextTable,
@@ -2186,7 +1602,7 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
2186
1602
  // Store-compiled candidates (predicates + subclass + currency)
2187
1603
  // take precedence; the live-node default covers direct backend use.
2188
1604
  params.candidates ?? liveNodeIdsSubquery(
2189
- tables3.nodes,
1605
+ tables.nodes,
2190
1606
  params.graphId,
2191
1607
  params.nodeKind,
2192
1608
  nowIso()
@@ -2194,7 +1610,7 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
2194
1610
  ),
2195
1611
  buildHybridSearch: (params, vectorSql, vectorScoreDescending) => {
2196
1612
  const candidates = params.candidates ?? liveNodeIdsSubquery(
2197
- tables3.nodes,
1613
+ tables.nodes,
2198
1614
  params.graphId,
2199
1615
  params.nodeKind,
2200
1616
  nowIso()
@@ -2222,7 +1638,7 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
2222
1638
  vectorSql,
2223
1639
  vectorScoreDescending,
2224
1640
  fulltextSql,
2225
- nodes: tables3.nodes,
1641
+ nodes: tables.nodes,
2226
1642
  dialect,
2227
1643
  graphId: params.graphId,
2228
1644
  nodeKind: params.nodeKind,
@@ -2238,19 +1654,19 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
2238
1654
  ...tableOperations,
2239
1655
  ...fulltextBuilders,
2240
1656
  buildInsertUnique(params) {
2241
- return buildInsertUnique(tables3, dialect, params);
1657
+ return buildInsertUnique(tables, dialect, params);
2242
1658
  },
2243
1659
  buildInsertUniqueBatch(entries) {
2244
- return buildInsertUniqueBatch(tables3, dialect, entries);
1660
+ return buildInsertUniqueBatch(tables, dialect, entries);
2245
1661
  },
2246
1662
  buildGetActiveSchema(graphId) {
2247
- return buildGetActiveSchema(tables3, graphId, dialect);
1663
+ return buildGetActiveSchema(tables, graphId, dialect);
2248
1664
  },
2249
- buildInsertSchema(params, timestamp2) {
2250
- return buildInsertSchema(tables3, params, timestamp2, dialect);
1665
+ buildInsertSchema(params, timestamp) {
1666
+ return buildInsertSchema(tables, params, timestamp, dialect);
2251
1667
  },
2252
1668
  buildSetActiveSchema(graphId, version) {
2253
- return buildSetActiveSchema(tables3, graphId, version, dialect);
1669
+ return buildSetActiveSchema(tables, graphId, version, dialect);
2254
1670
  },
2255
1671
  buildTableExists(tableName) {
2256
1672
  switch (dialect) {
@@ -2273,7 +1689,7 @@ function createCommonOperationStrategy(tables3, dialect, fulltextStrategy) {
2273
1689
  }
2274
1690
  },
2275
1691
  buildClearGraph(graphId) {
2276
- return buildClearGraph(tables3, graphId);
1692
+ return buildClearGraph(tables, graphId);
2277
1693
  }
2278
1694
  };
2279
1695
  }
@@ -2299,11 +1715,11 @@ function createCachedTableExistence(probe, options) {
2299
1715
  return exists;
2300
1716
  };
2301
1717
  }
2302
- function createSqliteOperationStrategy(tables3, fulltextStrategy) {
2303
- return createCommonOperationStrategy(tables3, "sqlite", fulltextStrategy);
1718
+ function createSqliteOperationStrategy(tables, fulltextStrategy) {
1719
+ return createCommonOperationStrategy(tables, "sqlite", fulltextStrategy);
2304
1720
  }
2305
- function createPostgresOperationStrategy(tables3, fulltextStrategy) {
2306
- return createCommonOperationStrategy(tables3, "postgres", fulltextStrategy);
1721
+ function createPostgresOperationStrategy(tables, fulltextStrategy) {
1722
+ return createCommonOperationStrategy(tables, "postgres", fulltextStrategy);
2307
1723
  }
2308
1724
  var DRIZZLE_DIALECT_LABELS = {
2309
1725
  postgres: "Postgres",
@@ -2356,8 +1772,8 @@ function createCommonOperationBackend(options) {
2356
1772
  await execution.execRun(query);
2357
1773
  },
2358
1774
  async insertNode(params) {
2359
- const timestamp2 = nowIso2();
2360
- const query = operationStrategy.buildInsertNode(params, timestamp2);
1775
+ const timestamp = nowIso2();
1776
+ const query = operationStrategy.buildInsertNode(params, timestamp);
2361
1777
  const row = await execution.execGet(query);
2362
1778
  if (!row)
2363
1779
  throw new DatabaseOperationError(
@@ -2367,10 +1783,10 @@ function createCommonOperationBackend(options) {
2367
1783
  return rowMappers.toNodeRow(row);
2368
1784
  },
2369
1785
  async insertNodeNoReturn(params) {
2370
- const timestamp2 = nowIso2();
1786
+ const timestamp = nowIso2();
2371
1787
  const query = operationStrategy.buildInsertNodeNoReturn(
2372
1788
  params,
2373
- timestamp2
1789
+ timestamp
2374
1790
  );
2375
1791
  await execution.execRun(query);
2376
1792
  },
@@ -2378,9 +1794,9 @@ function createCommonOperationBackend(options) {
2378
1794
  if (params.length === 0) {
2379
1795
  return;
2380
1796
  }
2381
- const timestamp2 = nowIso2();
1797
+ const timestamp = nowIso2();
2382
1798
  for (const chunk2 of chunk(params, batchConfig.nodeInsertBatchSize)) {
2383
- const query = operationStrategy.buildInsertNodesBatch(chunk2, timestamp2);
1799
+ const query = operationStrategy.buildInsertNodesBatch(chunk2, timestamp);
2384
1800
  await execution.execRun(query);
2385
1801
  }
2386
1802
  },
@@ -2388,12 +1804,12 @@ function createCommonOperationBackend(options) {
2388
1804
  if (params.length === 0) {
2389
1805
  return [];
2390
1806
  }
2391
- const timestamp2 = nowIso2();
1807
+ const timestamp = nowIso2();
2392
1808
  const allRows = [];
2393
1809
  for (const chunk2 of chunk(params, batchConfig.nodeInsertBatchSize)) {
2394
1810
  const query = operationStrategy.buildInsertNodesBatchReturning(
2395
1811
  chunk2,
2396
- timestamp2
1812
+ timestamp
2397
1813
  );
2398
1814
  const rows = await execution.execAll(query);
2399
1815
  allRows.push(...rows.map((row) => rowMappers.toNodeRow(row)));
@@ -2416,8 +1832,8 @@ function createCommonOperationBackend(options) {
2416
1832
  return allRows;
2417
1833
  },
2418
1834
  async updateNode(params) {
2419
- const timestamp2 = nowIso2();
2420
- const query = operationStrategy.buildUpdateNode(params, timestamp2);
1835
+ const timestamp = nowIso2();
1836
+ const query = operationStrategy.buildUpdateNode(params, timestamp);
2421
1837
  const row = await execution.execGet(query);
2422
1838
  if (!row)
2423
1839
  throw new DatabaseOperationError(
@@ -2427,8 +1843,8 @@ function createCommonOperationBackend(options) {
2427
1843
  return rowMappers.toNodeRow(row);
2428
1844
  },
2429
1845
  async deleteNode(params) {
2430
- const timestamp2 = nowIso2();
2431
- const query = operationStrategy.buildDeleteNode(params, timestamp2);
1846
+ const timestamp = nowIso2();
1847
+ const query = operationStrategy.buildDeleteNode(params, timestamp);
2432
1848
  await execution.execRun(query);
2433
1849
  },
2434
1850
  // IMPORTANT: This cascade is not atomic. Callers must ensure this runs
@@ -2464,8 +1880,8 @@ function createCommonOperationBackend(options) {
2464
1880
  await execution.execRun(query);
2465
1881
  },
2466
1882
  async insertEdge(params) {
2467
- const timestamp2 = nowIso2();
2468
- const query = operationStrategy.buildInsertEdge(params, timestamp2);
1883
+ const timestamp = nowIso2();
1884
+ const query = operationStrategy.buildInsertEdge(params, timestamp);
2469
1885
  const row = await execution.execGet(query);
2470
1886
  if (!row)
2471
1887
  throw new DatabaseOperationError(
@@ -2475,10 +1891,10 @@ function createCommonOperationBackend(options) {
2475
1891
  return rowMappers.toEdgeRow(row);
2476
1892
  },
2477
1893
  async insertEdgeNoReturn(params) {
2478
- const timestamp2 = nowIso2();
1894
+ const timestamp = nowIso2();
2479
1895
  const query = operationStrategy.buildInsertEdgeNoReturn(
2480
1896
  params,
2481
- timestamp2
1897
+ timestamp
2482
1898
  );
2483
1899
  await execution.execRun(query);
2484
1900
  },
@@ -2486,9 +1902,9 @@ function createCommonOperationBackend(options) {
2486
1902
  if (params.length === 0) {
2487
1903
  return;
2488
1904
  }
2489
- const timestamp2 = nowIso2();
1905
+ const timestamp = nowIso2();
2490
1906
  for (const chunk2 of chunk(params, batchConfig.edgeInsertBatchSize)) {
2491
- const query = operationStrategy.buildInsertEdgesBatch(chunk2, timestamp2);
1907
+ const query = operationStrategy.buildInsertEdgesBatch(chunk2, timestamp);
2492
1908
  await execution.execRun(query);
2493
1909
  }
2494
1910
  },
@@ -2496,12 +1912,12 @@ function createCommonOperationBackend(options) {
2496
1912
  if (params.length === 0) {
2497
1913
  return [];
2498
1914
  }
2499
- const timestamp2 = nowIso2();
1915
+ const timestamp = nowIso2();
2500
1916
  const allRows = [];
2501
1917
  for (const chunk2 of chunk(params, batchConfig.edgeInsertBatchSize)) {
2502
1918
  const query = operationStrategy.buildInsertEdgesBatchReturning(
2503
1919
  chunk2,
2504
- timestamp2
1920
+ timestamp
2505
1921
  );
2506
1922
  const rows = await execution.execAll(query);
2507
1923
  allRows.push(...rows.map((row) => rowMappers.toEdgeRow(row)));
@@ -2524,8 +1940,8 @@ function createCommonOperationBackend(options) {
2524
1940
  return allRows;
2525
1941
  },
2526
1942
  async updateEdge(params) {
2527
- const timestamp2 = nowIso2();
2528
- const query = operationStrategy.buildUpdateEdge(params, timestamp2);
1943
+ const timestamp = nowIso2();
1944
+ const query = operationStrategy.buildUpdateEdge(params, timestamp);
2529
1945
  const row = await execution.execGet(query);
2530
1946
  if (!row)
2531
1947
  throw new DatabaseOperationError(
@@ -2535,8 +1951,8 @@ function createCommonOperationBackend(options) {
2535
1951
  return rowMappers.toEdgeRow(row);
2536
1952
  },
2537
1953
  async deleteEdge(params) {
2538
- const timestamp2 = nowIso2();
2539
- const query = operationStrategy.buildDeleteEdge(params, timestamp2);
1954
+ const timestamp = nowIso2();
1955
+ const query = operationStrategy.buildDeleteEdge(params, timestamp);
2540
1956
  await execution.execRun(query);
2541
1957
  },
2542
1958
  async hardDeleteEdge(params) {
@@ -2545,7 +1961,7 @@ function createCommonOperationBackend(options) {
2545
1961
  },
2546
1962
  async deleteEdgesBatch(params) {
2547
1963
  if (params.ids.length === 0) return;
2548
- const timestamp2 = nowIso2();
1964
+ const timestamp = nowIso2();
2549
1965
  const softDeleteChunkSize = Math.max(
2550
1966
  1,
2551
1967
  batchConfig.getEdgesChunkSize - 1
@@ -2553,7 +1969,7 @@ function createCommonOperationBackend(options) {
2553
1969
  for (const chunk2 of chunk(params.ids, softDeleteChunkSize)) {
2554
1970
  const query = operationStrategy.buildDeleteEdgesBatch(
2555
1971
  { graphId: params.graphId, ids: chunk2 },
2556
- timestamp2
1972
+ timestamp
2557
1973
  );
2558
1974
  await execution.execRun(query);
2559
1975
  }
@@ -2667,8 +2083,8 @@ function createCommonOperationBackend(options) {
2667
2083
  }
2668
2084
  },
2669
2085
  async deleteUnique(params) {
2670
- const timestamp2 = nowIso2();
2671
- const query = operationStrategy.buildDeleteUnique(params, timestamp2);
2086
+ const timestamp = nowIso2();
2087
+ const query = operationStrategy.buildDeleteUnique(params, timestamp);
2672
2088
  await execution.execRun(query);
2673
2089
  },
2674
2090
  async checkUnique(params) {
@@ -2745,7 +2161,7 @@ function createCommonOperationBackend(options) {
2745
2161
  );
2746
2162
  await execution.execRun(flip.deactivateAll);
2747
2163
  }
2748
- const timestamp2 = nowIso2();
2164
+ const timestamp = nowIso2();
2749
2165
  const insertQuery = operationStrategy.buildInsertSchema(
2750
2166
  {
2751
2167
  graphId: params.graphId,
@@ -2754,7 +2170,7 @@ function createCommonOperationBackend(options) {
2754
2170
  schemaDoc: params.schemaDoc,
2755
2171
  isActive: true
2756
2172
  },
2757
- timestamp2
2173
+ timestamp
2758
2174
  );
2759
2175
  const insertedRaw = await execution.execGet(insertQuery);
2760
2176
  if (!insertedRaw) {
@@ -2931,8 +2347,8 @@ async function analyzeImportedTables(backend, tableNames) {
2931
2347
  )
2932
2348
  );
2933
2349
  }
2934
- function resolvedValidFrom(validFrom, timestamp2) {
2935
- return validFrom === void 0 ? timestamp2 : validFrom;
2350
+ function resolvedValidFrom(validFrom, timestamp) {
2351
+ return validFrom === void 0 ? timestamp : validFrom;
2936
2352
  }
2937
2353
  function postgresArray(values) {
2938
2354
  return `{${values.map(
@@ -2956,7 +2372,7 @@ function createSqliteTrustedImportSession(executionAdapter, tableNames) {
2956
2372
  return {
2957
2373
  async insertNodes(params) {
2958
2374
  if (params.length === 0) return;
2959
- const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
2375
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
2960
2376
  await executePreparedRunBatch(
2961
2377
  nodeSql,
2962
2378
  params.map((item) => [
@@ -2964,16 +2380,16 @@ function createSqliteTrustedImportSession(executionAdapter, tableNames) {
2964
2380
  item.kind,
2965
2381
  item.id,
2966
2382
  JSON.stringify(item.props),
2967
- resolvedValidFrom(item.validFrom, timestamp2),
2383
+ resolvedValidFrom(item.validFrom, timestamp),
2968
2384
  item.validTo ?? DATABASE_NULL,
2969
- timestamp2,
2970
- timestamp2
2385
+ timestamp,
2386
+ timestamp
2971
2387
  ])
2972
2388
  );
2973
2389
  },
2974
2390
  async insertEdges(params) {
2975
2391
  if (params.length === 0) return;
2976
- const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
2392
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
2977
2393
  await executePreparedRunBatch(
2978
2394
  edgeSql,
2979
2395
  params.map((item) => [
@@ -2985,10 +2401,10 @@ function createSqliteTrustedImportSession(executionAdapter, tableNames) {
2985
2401
  item.toKind,
2986
2402
  item.toId,
2987
2403
  JSON.stringify(item.props),
2988
- resolvedValidFrom(item.validFrom, timestamp2),
2404
+ resolvedValidFrom(item.validFrom, timestamp),
2989
2405
  item.validTo ?? DATABASE_NULL,
2990
- timestamp2,
2991
- timestamp2
2406
+ timestamp,
2407
+ timestamp
2992
2408
  ])
2993
2409
  );
2994
2410
  }
@@ -3018,22 +2434,22 @@ function createPostgresTrustedImportSession(backend, tableNames) {
3018
2434
  return {
3019
2435
  async insertNodes(params) {
3020
2436
  if (params.length === 0) return;
3021
- const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
2437
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
3022
2438
  await executeRaw(nodeSql, [
3023
2439
  postgresArray(params.map((item) => item.graphId)),
3024
2440
  postgresArray(params.map((item) => item.kind)),
3025
2441
  postgresArray(params.map((item) => item.id)),
3026
2442
  postgresArray(params.map((item) => JSON.stringify(item.props))),
3027
2443
  postgresArray(
3028
- params.map((item) => resolvedValidFrom(item.validFrom, timestamp2))
2444
+ params.map((item) => resolvedValidFrom(item.validFrom, timestamp))
3029
2445
  ),
3030
2446
  postgresArray(params.map((item) => item.validTo ?? DATABASE_NULL)),
3031
- postgresArray(params.map(() => timestamp2))
2447
+ postgresArray(params.map(() => timestamp))
3032
2448
  ]);
3033
2449
  },
3034
2450
  async insertEdges(params) {
3035
2451
  if (params.length === 0) return;
3036
- const timestamp2 = (/* @__PURE__ */ new Date()).toISOString();
2452
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
3037
2453
  await executeRaw(edgeSql, [
3038
2454
  postgresArray(params.map((item) => item.graphId)),
3039
2455
  postgresArray(params.map((item) => item.id)),
@@ -3044,10 +2460,10 @@ function createPostgresTrustedImportSession(backend, tableNames) {
3044
2460
  postgresArray(params.map((item) => item.toId)),
3045
2461
  postgresArray(params.map((item) => JSON.stringify(item.props))),
3046
2462
  postgresArray(
3047
- params.map((item) => resolvedValidFrom(item.validFrom, timestamp2))
2463
+ params.map((item) => resolvedValidFrom(item.validFrom, timestamp))
3048
2464
  ),
3049
2465
  postgresArray(params.map((item) => item.validTo ?? DATABASE_NULL)),
3050
- postgresArray(params.map(() => timestamp2))
2466
+ postgresArray(params.map(() => timestamp))
3051
2467
  ]);
3052
2468
  }
3053
2469
  };
@@ -3070,6 +2486,6 @@ function getOrCreateLru(cache, key, cacheMax, create) {
3070
2486
  return value;
3071
2487
  }
3072
2488
 
3073
- export { EMBEDDING_UPSERT_PARAM_COUNT, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, analyzeImportedTables, assertAdoptedDialect, assertTrustedImportDatabaseEmpty, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildLiveNodeCandidates, buildMaterializationInsertValues, buildMaterializationOnConflictSet, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTables, createPostgresTrustedImportSession, createSqliteOperationStrategy, createSqliteTrustedImportSession, edges, fulltext, gateFulltext, gateFulltextMethods, generatePgCreateTableSQL, generatePostgresDDL, generatePostgresMigrationSQL, generateSqliteCreateTableSQL, generateSqliteDDL, generateSqliteMigrationSQL, getOrCreateLru, lockPostgresTrustedImportTables, mapContributionMaterializationRow, mapHybridSearchRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, nodes, recordedClock, recordedEdges, recordedNodes, restoreSecondaryIndexes, schemaVersions, suspendPostgresSecondaryIndexes, suspendSqliteSecondaryIndexes, tables2 as tables, uniques, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
3074
- //# sourceMappingURL=chunk-G32AO634.js.map
3075
- //# sourceMappingURL=chunk-G32AO634.js.map
2489
+ export { EMBEDDING_UPSERT_PARAM_COUNT, POSTGRES_CONTRIBUTION_MAT_TIMESTAMPS, POSTGRES_INDEX_MAT_TIMESTAMPS, POSTGRES_KIND_REMOVAL_TIMESTAMPS, SQLITE_CONTRIBUTION_MAT_TIMESTAMPS, SQLITE_INDEX_MAT_TIMESTAMPS, SQLITE_KIND_REMOVAL_TIMESTAMPS, analyzeImportedTables, assertAdoptedDialect, assertTrustedImportDatabaseEmpty, buildContributionInsertValues, buildContributionOnConflictSet, buildKindRemovalInsertValues, buildKindRemovalOnConflictSet, buildLiveNodeCandidates, buildMaterializationInsertValues, buildMaterializationOnConflictSet, createCachedTableExistence, createCommonOperationBackend, createContributionMaterializer, createPostgresOperationStrategy, createPostgresTrustedImportSession, createSqliteOperationStrategy, createSqliteTrustedImportSession, gateFulltext, gateFulltextMethods, getOrCreateLru, lockPostgresTrustedImportTables, mapContributionMaterializationRow, mapHybridSearchRow, mapKindRemovalRow, mapMaterializationRow, mapVectorWriteError, restoreSecondaryIndexes, suspendPostgresSecondaryIndexes, suspendSqliteSecondaryIndexes, vectorSlotFromCreateIndexParams, vectorSlotFromDropIndexParams, vectorSlotFromParams };
2490
+ //# sourceMappingURL=chunk-W66YCXWT.js.map
2491
+ //# sourceMappingURL=chunk-W66YCXWT.js.map