@nicia-ai/typegraph 0.50.0 → 0.51.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/README.md +12 -0
  2. package/dist/backend/drizzle/indexes.cjs +10 -8
  3. package/dist/backend/drizzle/indexes.d.cts +1 -1
  4. package/dist/backend/drizzle/indexes.d.ts +1 -1
  5. package/dist/backend/drizzle/indexes.js +6 -4
  6. package/dist/backend/index.cjs +183 -50
  7. package/dist/backend/index.d.cts +90 -4
  8. package/dist/backend/index.d.ts +90 -4
  9. package/dist/backend/index.js +6 -9
  10. package/dist/backend/postgres/index.cjs +30 -28
  11. package/dist/backend/postgres/index.d.cts +7 -7
  12. package/dist/backend/postgres/index.d.ts +7 -7
  13. package/dist/backend/postgres/index.js +16 -14
  14. package/dist/backend/postgres/pglite-store.cjs +6 -62
  15. package/dist/backend/postgres/pglite-store.cjs.map +1 -1
  16. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  17. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  18. package/dist/backend/postgres/pglite-store.js +6 -62
  19. package/dist/backend/postgres/pglite-store.js.map +1 -1
  20. package/dist/backend/postgres/pglite.cjs +18 -16
  21. package/dist/backend/postgres/pglite.d.cts +3 -3
  22. package/dist/backend/postgres/pglite.d.ts +3 -3
  23. package/dist/backend/postgres/pglite.js +17 -15
  24. package/dist/backend/sqlite/index.cjs +27 -25
  25. package/dist/backend/sqlite/index.d.cts +7 -7
  26. package/dist/backend/sqlite/index.d.ts +7 -7
  27. package/dist/backend/sqlite/index.js +14 -12
  28. package/dist/backend/sqlite/libsql.cjs +21 -19
  29. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  30. package/dist/backend/sqlite/libsql.d.cts +3 -3
  31. package/dist/backend/sqlite/libsql.d.ts +3 -3
  32. package/dist/backend/sqlite/libsql.js +16 -14
  33. package/dist/backend/sqlite/libsql.js.map +1 -1
  34. package/dist/backend/sqlite/local-store.cjs +8 -64
  35. package/dist/backend/sqlite/local-store.cjs.map +1 -1
  36. package/dist/backend/sqlite/local-store.d.cts +8 -8
  37. package/dist/backend/sqlite/local-store.d.ts +8 -8
  38. package/dist/backend/sqlite/local-store.js +7 -64
  39. package/dist/backend/sqlite/local-store.js.map +1 -1
  40. package/dist/backend/sqlite/local.cjs +22 -19
  41. package/dist/backend/sqlite/local.d.cts +3 -3
  42. package/dist/backend/sqlite/local.d.ts +3 -3
  43. package/dist/backend/sqlite/local.js +18 -15
  44. package/dist/{chunk-TUVD4DFR.cjs → chunk-2CVDZCXH.cjs} +122 -51
  45. package/dist/chunk-2CVDZCXH.cjs.map +1 -0
  46. package/dist/{chunk-I5C6OTKR.js → chunk-2DWTBNSH.js} +3 -3
  47. package/dist/{chunk-I5C6OTKR.js.map → chunk-2DWTBNSH.js.map} +1 -1
  48. package/dist/{chunk-C76WFIVZ.cjs → chunk-2KCTP3U2.cjs} +180 -127
  49. package/dist/chunk-2KCTP3U2.cjs.map +1 -0
  50. package/dist/{chunk-BYBDM423.cjs → chunk-322TBTOQ.cjs} +48 -48
  51. package/dist/{chunk-BYBDM423.cjs.map → chunk-322TBTOQ.cjs.map} +1 -1
  52. package/dist/chunk-36SX6QXP.cjs +186 -0
  53. package/dist/chunk-36SX6QXP.cjs.map +1 -0
  54. package/dist/{chunk-H3XP6BAV.js → chunk-36VYWVQU.js} +3 -3
  55. package/dist/{chunk-H3XP6BAV.js.map → chunk-36VYWVQU.js.map} +1 -1
  56. package/dist/{chunk-VTJVMP4I.js → chunk-4DKY6RIU.js} +102 -31
  57. package/dist/chunk-4DKY6RIU.js.map +1 -0
  58. package/dist/chunk-4QKOZYMV.js +9 -0
  59. package/dist/chunk-4QKOZYMV.js.map +1 -0
  60. package/dist/{chunk-U3Z7XKAG.js → chunk-57JM6NW3.js} +8 -18
  61. package/dist/chunk-57JM6NW3.js.map +1 -0
  62. package/dist/{chunk-WCLMKNQE.cjs → chunk-5FVZSE3B.cjs} +1356 -1108
  63. package/dist/chunk-5FVZSE3B.cjs.map +1 -0
  64. package/dist/{chunk-XMY2SXOH.cjs → chunk-5WWEYV4H.cjs} +2208 -579
  65. package/dist/chunk-5WWEYV4H.cjs.map +1 -0
  66. package/dist/{chunk-WQBAQZHR.js → chunk-6NLYIMJO.js} +4 -4
  67. package/dist/{chunk-WQBAQZHR.js.map → chunk-6NLYIMJO.js.map} +1 -1
  68. package/dist/{chunk-G2TLHH6T.cjs → chunk-7B7I7YAW.cjs} +6 -6
  69. package/dist/{chunk-G2TLHH6T.cjs.map → chunk-7B7I7YAW.cjs.map} +1 -1
  70. package/dist/{chunk-EDLKIQRI.js → chunk-7G5IYROL.js} +6 -548
  71. package/dist/chunk-7G5IYROL.js.map +1 -0
  72. package/dist/{chunk-46UGOVRW.js → chunk-7QFRK6PU.js} +3 -7
  73. package/dist/chunk-7QFRK6PU.js.map +1 -0
  74. package/dist/chunk-A4C4NJ5U.cjs +12 -0
  75. package/dist/chunk-A4C4NJ5U.cjs.map +1 -0
  76. package/dist/{chunk-7CCMCMJO.cjs → chunk-AOGOC6JF.cjs} +77 -68
  77. package/dist/chunk-AOGOC6JF.cjs.map +1 -0
  78. package/dist/{chunk-TYGGUWMS.cjs → chunk-B3MN7EJR.cjs} +177 -137
  79. package/dist/chunk-B3MN7EJR.cjs.map +1 -0
  80. package/dist/{chunk-K6VKTBST.cjs → chunk-BZ5MVITP.cjs} +4 -4
  81. package/dist/{chunk-K6VKTBST.cjs.map → chunk-BZ5MVITP.cjs.map} +1 -1
  82. package/dist/{chunk-ZAQUKCUC.js → chunk-CBOD7TXH.js} +5 -5
  83. package/dist/{chunk-ZAQUKCUC.js.map → chunk-CBOD7TXH.js.map} +1 -1
  84. package/dist/{chunk-LLVOQOWE.cjs → chunk-CRZ56SZU.cjs} +6 -5
  85. package/dist/chunk-CRZ56SZU.cjs.map +1 -0
  86. package/dist/{chunk-ON47CBE4.cjs → chunk-D3GWARN7.cjs} +47 -47
  87. package/dist/{chunk-ON47CBE4.cjs.map → chunk-D3GWARN7.cjs.map} +1 -1
  88. package/dist/{chunk-W5SOCUBL.js → chunk-D3OUDFU7.js} +5 -5
  89. package/dist/{chunk-W5SOCUBL.js.map → chunk-D3OUDFU7.js.map} +1 -1
  90. package/dist/chunk-EKG2UXNX.cjs +23 -0
  91. package/dist/chunk-EKG2UXNX.cjs.map +1 -0
  92. package/dist/{chunk-2Q45FAIE.js → chunk-EVYW3532.js} +28 -19
  93. package/dist/chunk-EVYW3532.js.map +1 -0
  94. package/dist/{chunk-7PRMDZIA.cjs → chunk-FMMW3KX7.cjs} +21 -55
  95. package/dist/chunk-FMMW3KX7.cjs.map +1 -0
  96. package/dist/chunk-H2VWDQWC.cjs +571 -0
  97. package/dist/chunk-H2VWDQWC.cjs.map +1 -0
  98. package/dist/chunk-H4FY6OZK.js +13 -0
  99. package/dist/chunk-H4FY6OZK.js.map +1 -0
  100. package/dist/{chunk-OJHD3LXJ.cjs → chunk-H5IJSROF.cjs} +2 -8
  101. package/dist/chunk-H5IJSROF.cjs.map +1 -0
  102. package/dist/{chunk-U5EL6JUV.js → chunk-I5IOSA27.js} +101 -103
  103. package/dist/chunk-I5IOSA27.js.map +1 -0
  104. package/dist/{chunk-SHC7BCG5.cjs → chunk-I7YAY2VQ.cjs} +7 -7
  105. package/dist/{chunk-SHC7BCG5.cjs.map → chunk-I7YAY2VQ.cjs.map} +1 -1
  106. package/dist/chunk-IRCWIA3R.js +20 -0
  107. package/dist/chunk-IRCWIA3R.js.map +1 -0
  108. package/dist/chunk-IVQBLXBK.cjs +55 -0
  109. package/dist/chunk-IVQBLXBK.cjs.map +1 -0
  110. package/dist/{chunk-5PP4KRPV.js → chunk-IZD4HTCP.js} +5 -5
  111. package/dist/{chunk-5PP4KRPV.js.map → chunk-IZD4HTCP.js.map} +1 -1
  112. package/dist/{chunk-RDP6ZRSM.cjs → chunk-JQKMEKKW.cjs} +261 -204
  113. package/dist/chunk-JQKMEKKW.cjs.map +1 -0
  114. package/dist/chunk-JVA3KDEA.cjs +691 -0
  115. package/dist/chunk-JVA3KDEA.cjs.map +1 -0
  116. package/dist/{chunk-JG5XIJDY.js → chunk-K67P5DLL.js} +62 -22
  117. package/dist/chunk-K67P5DLL.js.map +1 -0
  118. package/dist/{chunk-MX7EKQPM.js → chunk-K6OZIHKI.js} +345 -97
  119. package/dist/chunk-K6OZIHKI.js.map +1 -0
  120. package/dist/{chunk-CS6JTQQ2.cjs → chunk-KACEYDYV.cjs} +94 -62
  121. package/dist/chunk-KACEYDYV.cjs.map +1 -0
  122. package/dist/{chunk-5OWHU7Z7.cjs → chunk-L6EVYIID.cjs} +248 -210
  123. package/dist/chunk-L6EVYIID.cjs.map +1 -0
  124. package/dist/{chunk-7OWE7WD6.js → chunk-LI4K2KEJ.js} +4 -4
  125. package/dist/{chunk-7OWE7WD6.js.map → chunk-LI4K2KEJ.js.map} +1 -1
  126. package/dist/chunk-LKZDQ2B4.js +1581 -0
  127. package/dist/chunk-LKZDQ2B4.js.map +1 -0
  128. package/dist/{chunk-45YZXI6X.cjs → chunk-LLFPQOBA.cjs} +27 -27
  129. package/dist/{chunk-45YZXI6X.cjs.map → chunk-LLFPQOBA.cjs.map} +1 -1
  130. package/dist/{chunk-ZRJTM7MT.js → chunk-LZMQ3SFK.js} +3 -3
  131. package/dist/{chunk-ZRJTM7MT.js.map → chunk-LZMQ3SFK.js.map} +1 -1
  132. package/dist/{chunk-DI6VC62F.js → chunk-M3VTS3F6.js} +3 -3
  133. package/dist/{chunk-DI6VC62F.js.map → chunk-M3VTS3F6.js.map} +1 -1
  134. package/dist/{chunk-MZ34E2GN.js → chunk-NBOS7BY3.js} +60 -21
  135. package/dist/chunk-NBOS7BY3.js.map +1 -0
  136. package/dist/{chunk-YA36ABIL.js → chunk-NGQDGL5X.js} +14 -48
  137. package/dist/chunk-NGQDGL5X.js.map +1 -0
  138. package/dist/{chunk-ZBFZGLZE.cjs → chunk-NLX5OWK7.cjs} +6 -2
  139. package/dist/chunk-NLX5OWK7.cjs.map +1 -0
  140. package/dist/chunk-NUQ2YFFH.cjs +1637 -0
  141. package/dist/chunk-NUQ2YFFH.cjs.map +1 -0
  142. package/dist/{chunk-TTCOPKUL.cjs → chunk-OGL4X4PH.cjs} +182 -184
  143. package/dist/chunk-OGL4X4PH.cjs.map +1 -0
  144. package/dist/{chunk-HY5BNOUN.cjs → chunk-OTNTGEXR.cjs} +4 -4
  145. package/dist/{chunk-HY5BNOUN.cjs.map → chunk-OTNTGEXR.cjs.map} +1 -1
  146. package/dist/chunk-OTWE63BW.js +53 -0
  147. package/dist/chunk-OTWE63BW.js.map +1 -0
  148. package/dist/chunk-PC5NGH5A.js +549 -0
  149. package/dist/chunk-PC5NGH5A.js.map +1 -0
  150. package/dist/{chunk-IPRP6TDL.cjs → chunk-PS3TUWJM.cjs} +7 -7
  151. package/dist/{chunk-IPRP6TDL.cjs.map → chunk-PS3TUWJM.cjs.map} +1 -1
  152. package/dist/{chunk-V76FGHY3.js → chunk-PVFFH7TL.js} +5 -5
  153. package/dist/{chunk-V76FGHY3.js.map → chunk-PVFFH7TL.js.map} +1 -1
  154. package/dist/chunk-QCD5JKU4.cjs +15 -0
  155. package/dist/chunk-QCD5JKU4.cjs.map +1 -0
  156. package/dist/{chunk-IRPYOHRC.js → chunk-QG5VEOKX.js} +6 -2
  157. package/dist/chunk-QG5VEOKX.js.map +1 -0
  158. package/dist/{chunk-2CYI5HRH.js → chunk-RI7RJH4G.js} +49 -17
  159. package/dist/chunk-RI7RJH4G.js.map +1 -0
  160. package/dist/{chunk-5LKOVCPP.js → chunk-RVUL2HXY.js} +6 -5
  161. package/dist/chunk-RVUL2HXY.js.map +1 -0
  162. package/dist/{chunk-WK23PGTP.cjs → chunk-S5GU4LUN.cjs} +11 -11
  163. package/dist/{chunk-WK23PGTP.cjs.map → chunk-S5GU4LUN.cjs.map} +1 -1
  164. package/dist/{chunk-S33YQEL7.js → chunk-SDPWO2Z5.js} +6 -6
  165. package/dist/{chunk-S33YQEL7.js.map → chunk-SDPWO2Z5.js.map} +1 -1
  166. package/dist/{chunk-6S3PTHL4.js → chunk-SLGGT2XD.js} +3 -3
  167. package/dist/{chunk-6S3PTHL4.js.map → chunk-SLGGT2XD.js.map} +1 -1
  168. package/dist/{chunk-HSEZ7X6Y.cjs → chunk-TIJUA4I6.cjs} +45 -45
  169. package/dist/{chunk-HSEZ7X6Y.cjs.map → chunk-TIJUA4I6.cjs.map} +1 -1
  170. package/dist/{chunk-CSNOYIB4.cjs → chunk-TM54OBHX.cjs} +13 -13
  171. package/dist/{chunk-CSNOYIB4.cjs.map → chunk-TM54OBHX.cjs.map} +1 -1
  172. package/dist/{chunk-MM3JHVKZ.cjs → chunk-TUWSVL6I.cjs} +4 -4
  173. package/dist/{chunk-MM3JHVKZ.cjs.map → chunk-TUWSVL6I.cjs.map} +1 -1
  174. package/dist/{chunk-2GIV5X4P.js → chunk-TYEYRCXL.js} +86 -33
  175. package/dist/chunk-TYEYRCXL.js.map +1 -0
  176. package/dist/{chunk-MJPZNEJZ.js → chunk-UKOVGCRN.js} +2095 -496
  177. package/dist/chunk-UKOVGCRN.js.map +1 -0
  178. package/dist/chunk-UYKDYE5D.cjs +12 -0
  179. package/dist/{chunk-KWNWG4RC.cjs.map → chunk-UYKDYE5D.cjs.map} +1 -1
  180. package/dist/{chunk-FX5ZW6PN.js → chunk-VAAC7L57.js} +95 -40
  181. package/dist/chunk-VAAC7L57.js.map +1 -0
  182. package/dist/{chunk-ISKCIQF2.cjs → chunk-VKHXYVN7.cjs} +14 -25
  183. package/dist/chunk-VKHXYVN7.cjs.map +1 -0
  184. package/dist/chunk-VUQZNUHU.js +171 -0
  185. package/dist/chunk-VUQZNUHU.js.map +1 -0
  186. package/dist/{chunk-K2XYLVVB.cjs → chunk-WDM5WQK4.cjs} +175 -136
  187. package/dist/chunk-WDM5WQK4.cjs.map +1 -0
  188. package/dist/{chunk-GVYVGGPJ.js → chunk-WFSYYU4W.js} +66 -28
  189. package/dist/chunk-WFSYYU4W.js.map +1 -0
  190. package/dist/{chunk-R7MRFE5P.js → chunk-WS5MT2UJ.js} +3 -3
  191. package/dist/{chunk-R7MRFE5P.js.map → chunk-WS5MT2UJ.js.map} +1 -1
  192. package/dist/chunk-XORONCV3.js +202 -0
  193. package/dist/chunk-XORONCV3.js.map +1 -0
  194. package/dist/chunk-ZGVTNKTX.cjs +217 -0
  195. package/dist/chunk-ZGVTNKTX.cjs.map +1 -0
  196. package/dist/core/index.cjs +20 -20
  197. package/dist/core/index.d.cts +4 -4
  198. package/dist/core/index.d.ts +4 -4
  199. package/dist/core/index.js +4 -4
  200. package/dist/{ddl-B49O7dB_.d.ts → ddl-BvcbgzHo.d.ts} +3 -3
  201. package/dist/{ddl-DcZG660s.d.cts → ddl-Ufebz5q5.d.cts} +3 -3
  202. package/dist/graph-extension/index.d.cts +2 -4
  203. package/dist/graph-extension/index.d.ts +2 -4
  204. package/dist/graph-merge/index.cjs +140 -125
  205. package/dist/graph-merge/index.cjs.map +1 -1
  206. package/dist/graph-merge/index.d.cts +8 -9
  207. package/dist/graph-merge/index.d.ts +8 -9
  208. package/dist/graph-merge/index.js +42 -27
  209. package/dist/graph-merge/index.js.map +1 -1
  210. package/dist/index.cjs +144 -143
  211. package/dist/index.cjs.map +1 -1
  212. package/dist/index.d.cts +11 -12
  213. package/dist/index.d.ts +11 -12
  214. package/dist/index.js +30 -29
  215. package/dist/index.js.map +1 -1
  216. package/dist/indexes/index.cjs +14 -12
  217. package/dist/indexes/index.d.cts +4 -4
  218. package/dist/indexes/index.d.ts +4 -4
  219. package/dist/indexes/index.js +7 -5
  220. package/dist/{ingestion-import-target-CI8OWIkM.d.ts → ingestion-import-target-CAs1OX-l.d.cts} +1 -1
  221. package/dist/{ingestion-import-target-DCpfM1PX.d.cts → ingestion-import-target-DCQSPfNx.d.ts} +1 -1
  222. package/dist/interchange/index.cjs +41 -39
  223. package/dist/interchange/index.cjs.map +1 -1
  224. package/dist/interchange/index.d.cts +8 -8
  225. package/dist/interchange/index.d.ts +8 -8
  226. package/dist/interchange/index.js +16 -14
  227. package/dist/interchange/index.js.map +1 -1
  228. package/dist/local-store-impl-JC7OBRAW.js +75 -0
  229. package/dist/local-store-impl-JC7OBRAW.js.map +1 -0
  230. package/dist/local-store-impl-UOS2LUIG.cjs +77 -0
  231. package/dist/local-store-impl-UOS2LUIG.cjs.map +1 -0
  232. package/dist/{manager-Cfg1ENj1.d.ts → manager-B68OrPR2.d.ts} +1 -2
  233. package/dist/{manager-D348fa6W.d.cts → manager-D_t7oK69.d.cts} +1 -2
  234. package/dist/pglite-store-impl-J5J5AA52.cjs +75 -0
  235. package/dist/pglite-store-impl-J5J5AA52.cjs.map +1 -0
  236. package/dist/pglite-store-impl-LDRH2DUH.js +73 -0
  237. package/dist/pglite-store-impl-LDRH2DUH.js.map +1 -0
  238. package/dist/{postgres-UStOycLI.d.ts → postgres-BPLSVyHM.d.ts} +1 -1
  239. package/dist/{postgres-CH1kkM5J.d.cts → postgres-CqvtFC2y.d.cts} +1 -1
  240. package/dist/profiler/index.d.cts +9 -9
  241. package/dist/profiler/index.d.ts +9 -9
  242. package/dist/provenance/index.cjs +33 -20
  243. package/dist/provenance/index.cjs.map +1 -1
  244. package/dist/provenance/index.d.cts +7 -7
  245. package/dist/provenance/index.d.ts +7 -7
  246. package/dist/provenance/index.js +24 -11
  247. package/dist/provenance/index.js.map +1 -1
  248. package/dist/{repair-validity-windows-aWX7VNvv.d.cts → repair-validity-windows-DEzCKAdy.d.cts} +7 -3
  249. package/dist/{repair-validity-windows-BtOEe2pS.d.ts → repair-validity-windows-GMdaS2AH.d.ts} +7 -3
  250. package/dist/resolve-D_H8MHtq.d.ts +1805 -0
  251. package/dist/resolve-WEW8gWws.d.cts +1805 -0
  252. package/dist/schema/index.cjs +42 -40
  253. package/dist/schema/index.d.cts +4 -6
  254. package/dist/schema/index.d.ts +4 -6
  255. package/dist/schema/index.js +15 -13
  256. package/dist/{searchable-z4BiFfHI.d.ts → searchable-C_UREI9K.d.ts} +1 -1
  257. package/dist/{searchable-C8-RrL3l.d.cts → searchable-ClgET_i7.d.cts} +1 -1
  258. package/dist/{sqlite-axLw5Lo5.d.ts → sqlite-D1mXO9Kp.d.cts} +2 -1
  259. package/dist/{sqlite-Cyx9j9o6.d.cts → sqlite-MZA3oZNB.d.ts} +2 -1
  260. package/dist/{store-CTfQ9taw.d.ts → store-CuFX7fCx.d.cts} +38 -41
  261. package/dist/{store-DR9J7JVB.d.cts → store-D-ZjXQpW.d.ts} +38 -41
  262. package/dist/{temporal-CBOrERz5.d.ts → temporal-CpyEiRY8.d.cts} +1 -1
  263. package/dist/{temporal-B4Ky4wzh.d.cts → temporal-y0Aep9Su.d.ts} +1 -1
  264. package/dist/{types-CWg4dTjj.d.ts → types-6yf0Vv-_.d.cts} +1672 -1
  265. package/dist/{types-CWg4dTjj.d.cts → types-6yf0Vv-_.d.ts} +1672 -1
  266. package/dist/{types-BScHXVM7.d.ts → types-DzJ4dlzk.d.cts} +1 -1
  267. package/dist/{types-BE921wRl.d.cts → types-_vVSB9k-.d.ts} +1 -1
  268. package/dist/{where-BWXUPV3C.d.ts → where-DuG2LCLe.d.ts} +1 -1
  269. package/dist/{where-CNtx1aLc.d.cts → where-Mhf_yyKX.d.cts} +1 -1
  270. package/package.json +5 -1
  271. package/dist/chunk-2CYI5HRH.js.map +0 -1
  272. package/dist/chunk-2GIV5X4P.js.map +0 -1
  273. package/dist/chunk-2Q45FAIE.js.map +0 -1
  274. package/dist/chunk-46UGOVRW.js.map +0 -1
  275. package/dist/chunk-5LKOVCPP.js.map +0 -1
  276. package/dist/chunk-5OWHU7Z7.cjs.map +0 -1
  277. package/dist/chunk-6LEOAIIB.js +0 -1160
  278. package/dist/chunk-6LEOAIIB.js.map +0 -1
  279. package/dist/chunk-7CCMCMJO.cjs.map +0 -1
  280. package/dist/chunk-7PRMDZIA.cjs.map +0 -1
  281. package/dist/chunk-C76WFIVZ.cjs.map +0 -1
  282. package/dist/chunk-CS6JTQQ2.cjs.map +0 -1
  283. package/dist/chunk-EDLKIQRI.js.map +0 -1
  284. package/dist/chunk-EH3JZJUM.cjs +0 -567
  285. package/dist/chunk-EH3JZJUM.cjs.map +0 -1
  286. package/dist/chunk-FX5ZW6PN.js.map +0 -1
  287. package/dist/chunk-GHZPZNFC.cjs +0 -132
  288. package/dist/chunk-GHZPZNFC.cjs.map +0 -1
  289. package/dist/chunk-GVYVGGPJ.js.map +0 -1
  290. package/dist/chunk-IHK5KA2Q.cjs +0 -262
  291. package/dist/chunk-IHK5KA2Q.cjs.map +0 -1
  292. package/dist/chunk-IRPYOHRC.js.map +0 -1
  293. package/dist/chunk-ISKCIQF2.cjs.map +0 -1
  294. package/dist/chunk-JG5XIJDY.js.map +0 -1
  295. package/dist/chunk-K2XYLVVB.cjs.map +0 -1
  296. package/dist/chunk-KWNWG4RC.cjs +0 -12
  297. package/dist/chunk-LLVOQOWE.cjs.map +0 -1
  298. package/dist/chunk-MJPZNEJZ.js.map +0 -1
  299. package/dist/chunk-MX7EKQPM.js.map +0 -1
  300. package/dist/chunk-MZ34E2GN.js.map +0 -1
  301. package/dist/chunk-OJHD3LXJ.cjs.map +0 -1
  302. package/dist/chunk-PALYTHGM.js +0 -114
  303. package/dist/chunk-PALYTHGM.js.map +0 -1
  304. package/dist/chunk-RDP6ZRSM.cjs.map +0 -1
  305. package/dist/chunk-S3SDEQMC.js +0 -532
  306. package/dist/chunk-S3SDEQMC.js.map +0 -1
  307. package/dist/chunk-TEC24ZDA.cjs +0 -1254
  308. package/dist/chunk-TEC24ZDA.cjs.map +0 -1
  309. package/dist/chunk-TP4NJTI3.cjs +0 -1192
  310. package/dist/chunk-TP4NJTI3.cjs.map +0 -1
  311. package/dist/chunk-TTCOPKUL.cjs.map +0 -1
  312. package/dist/chunk-TUVD4DFR.cjs.map +0 -1
  313. package/dist/chunk-TYGGUWMS.cjs.map +0 -1
  314. package/dist/chunk-U3Z7XKAG.js.map +0 -1
  315. package/dist/chunk-U5EL6JUV.js.map +0 -1
  316. package/dist/chunk-VTJVMP4I.js.map +0 -1
  317. package/dist/chunk-WCLMKNQE.cjs.map +0 -1
  318. package/dist/chunk-XMY2SXOH.cjs.map +0 -1
  319. package/dist/chunk-Y55DLLEG.js +0 -247
  320. package/dist/chunk-Y55DLLEG.js.map +0 -1
  321. package/dist/chunk-YA36ABIL.js.map +0 -1
  322. package/dist/chunk-ZBFZGLZE.cjs.map +0 -1
  323. package/dist/index-B0PrmE3K.d.cts +0 -1146
  324. package/dist/index-CwcXsL5R.d.ts +0 -1146
  325. package/dist/materialize-indexes-C9GG3O3C.d.ts +0 -266
  326. package/dist/materialize-indexes-CrSiW_lT.d.cts +0 -266
@@ -1,28 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkTP4NJTI3_cjs = require('./chunk-TP4NJTI3.cjs');
4
- var chunkIHK5KA2Q_cjs = require('./chunk-IHK5KA2Q.cjs');
5
- var chunkGHZPZNFC_cjs = require('./chunk-GHZPZNFC.cjs');
3
+ var chunkEKG2UXNX_cjs = require('./chunk-EKG2UXNX.cjs');
4
+ var chunkZGVTNKTX_cjs = require('./chunk-ZGVTNKTX.cjs');
5
+ var chunkNUQ2YFFH_cjs = require('./chunk-NUQ2YFFH.cjs');
6
6
  var chunkDWUDZ66O_cjs = require('./chunk-DWUDZ66O.cjs');
7
7
  var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
8
- var chunkTEC24ZDA_cjs = require('./chunk-TEC24ZDA.cjs');
9
- var chunkOJHD3LXJ_cjs = require('./chunk-OJHD3LXJ.cjs');
8
+ var chunkH2VWDQWC_cjs = require('./chunk-H2VWDQWC.cjs');
9
+ var chunkH5IJSROF_cjs = require('./chunk-H5IJSROF.cjs');
10
10
  var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
11
11
 
12
- // src/backend/table-names.ts
13
- function definedTableNameOverrides(override) {
14
- if (override === void 0) return {};
15
- return Object.fromEntries(
16
- Object.entries(override).filter(([, tableName]) => tableName !== void 0)
17
- );
18
- }
19
- function resolvedTableNames(backend, override) {
20
- return chunkIHK5KA2Q_cjs.createSqlSchema({
21
- ...backend.tableNames,
22
- ...definedTableNameOverrides(override)
23
- }).tables;
24
- }
25
-
26
12
  // src/backend/migrate-recorded-time.ts
27
13
  var LEGACY_RECORDED_MAX = "9999-12-31T23:59:59.999Z";
28
14
  var MIGRATION_SUFFIX = "legacy_recorded_anchors";
@@ -69,16 +55,16 @@ var RECORDED_EDGE_COLUMNS = [
69
55
  ];
70
56
  function shortenedIdentifier(value) {
71
57
  if (value.length <= 63) return value;
72
- return `${value.slice(0, 50)}_${chunkTEC24ZDA_cjs.shortHash(value)}`;
58
+ return `${value.slice(0, 50)}_${chunkH2VWDQWC_cjs.shortHash(value)}`;
73
59
  }
74
60
  function mappingTableName(tables, override) {
75
61
  const candidate = override ?? `${tables.recordedClock}_${MIGRATION_SUFFIX}`;
76
- return chunkIHK5KA2Q_cjs.createSqlSchema({
62
+ return chunkNUQ2YFFH_cjs.createSqlSchema({
77
63
  recordedClock: shortenedIdentifier(candidate)
78
64
  }).tables.recordedClock;
79
65
  }
80
66
  function temporaryTableName(tableName, role) {
81
- return shortenedIdentifier(`__tg_${role}_${chunkTEC24ZDA_cjs.shortHash(tableName)}`);
67
+ return shortenedIdentifier(`__tg_${role}_${chunkH2VWDQWC_cjs.shortHash(tableName)}`);
82
68
  }
83
69
  function requireStatements(target) {
84
70
  if (target.executeStatement === void 0) {
@@ -91,10 +77,10 @@ function requireStatements(target) {
91
77
  return target.executeStatement;
92
78
  }
93
79
  async function executeStatement(target, statement) {
94
- await requireStatements(target)(chunkOJHD3LXJ_cjs.asCompiledStatementSql(statement));
80
+ await requireStatements(target)(chunkH5IJSROF_cjs.asCompiledStatementSql(statement));
95
81
  }
96
82
  async function executeDdl(target, ddl) {
97
- await executeStatement(target, chunkOJHD3LXJ_cjs.sql.raw(ddl));
83
+ await executeStatement(target, chunkH5IJSROF_cjs.sql.raw(ddl));
98
84
  }
99
85
  function canonicalLegacyInstant(value) {
100
86
  const canonical = chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(value);
@@ -118,9 +104,9 @@ function safeRevision(value) {
118
104
  }
119
105
  async function columnNames(target, tableName) {
120
106
  const rows = target.dialect === "sqlite" ? await target.execute(
121
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`PRAGMA table_info(${chunkOJHD3LXJ_cjs.sql.identifier(tableName)})`)
107
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`PRAGMA table_info(${chunkH5IJSROF_cjs.sql.identifier(tableName)})`)
122
108
  ) : await target.execute(
123
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
109
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
124
110
  SELECT column_name AS name
125
111
  FROM information_schema.columns
126
112
  WHERE table_schema = current_schema()
@@ -133,23 +119,23 @@ async function columnNames(target, tableName) {
133
119
  }
134
120
  async function readLegacyInstants(target, tables) {
135
121
  const rows = await target.execute(
136
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
122
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
137
123
  SELECT graph_id, recorded_from AS recorded_at
138
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedNodes)}
124
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedNodes)}
139
125
  UNION
140
126
  SELECT graph_id, recorded_to AS recorded_at
141
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedNodes)}
127
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedNodes)}
142
128
  WHERE recorded_to <> ${LEGACY_RECORDED_MAX}
143
129
  UNION
144
130
  SELECT graph_id, recorded_from AS recorded_at
145
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedEdges)}
131
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedEdges)}
146
132
  UNION
147
133
  SELECT graph_id, recorded_to AS recorded_at
148
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedEdges)}
134
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedEdges)}
149
135
  WHERE recorded_to <> ${LEGACY_RECORDED_MAX}
150
136
  UNION
151
137
  SELECT graph_id, recorded_at
152
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedClock)}
138
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedClock)}
153
139
  `)
154
140
  );
155
141
  const instants = rows.map((row) => {
@@ -205,84 +191,86 @@ function migrationMapDdl(dialect, table) {
205
191
  );`;
206
192
  }
207
193
  async function writeMappingRows(target, tableName, rows) {
208
- await executeStatement(target, chunkOJHD3LXJ_cjs.sql`DELETE FROM ${chunkOJHD3LXJ_cjs.sql.identifier(tableName)}`);
194
+ await executeStatement(target, chunkH5IJSROF_cjs.sql`DELETE FROM ${chunkH5IJSROF_cjs.sql.identifier(tableName)}`);
209
195
  const rowsPerStatement = Math.max(
210
196
  1,
211
197
  Math.floor((target.capabilities.maxBindParameters ?? 900) / 4)
212
198
  );
213
199
  for (let start = 0; start < rows.length; start += rowsPerStatement) {
214
200
  const values = rows.slice(start, start + rowsPerStatement).map(
215
- (row) => chunkOJHD3LXJ_cjs.sql`(${row.graphId}, ${row.legacyRecordedAt}, ${row.revision}, ${row.recordedAt})`
201
+ (row) => chunkH5IJSROF_cjs.sql`(${row.graphId}, ${row.legacyRecordedAt}, ${row.revision}, ${row.recordedAt})`
216
202
  );
217
203
  await executeStatement(
218
204
  target,
219
- chunkOJHD3LXJ_cjs.sql`
220
- INSERT INTO ${chunkOJHD3LXJ_cjs.sql.identifier(tableName)}
205
+ chunkH5IJSROF_cjs.sql`
206
+ INSERT INTO ${chunkH5IJSROF_cjs.sql.identifier(tableName)}
221
207
  (graph_id, legacy_recorded_at, revision, recorded_at)
222
- VALUES ${chunkOJHD3LXJ_cjs.sql.join(values, chunkOJHD3LXJ_cjs.sql`, `)}
208
+ VALUES ${chunkH5IJSROF_cjs.sql.join(values, chunkH5IJSROF_cjs.sql`, `)}
223
209
  `
224
210
  );
225
211
  }
226
212
  }
227
- function tableDdl(dialect, tables, temporary) {
228
- if (dialect === "sqlite") {
229
- const temporaryTables2 = chunkTP4NJTI3_cjs.createSqliteTables(temporary);
230
- const finalTables2 = chunkTP4NJTI3_cjs.createSqliteTables(tables);
231
- const temporaryContributions = chunkTP4NJTI3_cjs.sqliteContributions(temporaryTables2);
232
- const finalContributions = chunkTP4NJTI3_cjs.sqliteContributions(finalTables2);
233
- return ddlForRecordedTables(temporaryContributions, finalContributions);
213
+ function recordedMigrationDdl(recordedTableDdl, finalNames, temporaryNames) {
214
+ const temporaryDdl = recordedTableDdl(temporaryNames);
215
+ const finalDdl = recordedTableDdl(finalNames);
216
+ function composed(key) {
217
+ return {
218
+ createTable: temporaryDdl[key].createTable,
219
+ indexes: finalDdl[key].indexes
220
+ };
234
221
  }
235
- const temporaryTables = chunkTP4NJTI3_cjs.createPostgresTables(temporary);
236
- const finalTables = chunkTP4NJTI3_cjs.createPostgresTables(tables);
237
- return ddlForRecordedTables(
238
- chunkTP4NJTI3_cjs.postgresContributions(temporaryTables),
239
- chunkTP4NJTI3_cjs.postgresContributions(finalTables)
240
- );
241
- }
242
- function ddlForRecordedTables(temporary, final) {
243
- function statements(logicalName) {
244
- const temporaryDdl = temporary.find(
245
- (entry) => entry.logicalName === logicalName
246
- )?.createDdl;
247
- const finalDdl = final.find(
248
- (entry) => entry.logicalName === logicalName
249
- )?.createDdl;
250
- if (temporaryDdl === void 0 || finalDdl === void 0) {
251
- throw new chunkX4GDXBOP_cjs.ConfigurationError(
252
- `Could not generate migration DDL for ${logicalName}.`
253
- );
254
- }
255
- const createTable = temporaryDdl[0];
256
- if (createTable === void 0) {
222
+ function primaryKeyConstraintRename(key) {
223
+ const temporaryConstraintName = temporaryDdl[key].primaryKeyConstraintName;
224
+ const finalConstraintName = finalDdl[key].primaryKeyConstraintName;
225
+ if (temporaryConstraintName === void 0 && finalConstraintName === void 0)
226
+ return { status: "none" };
227
+ if (temporaryConstraintName === void 0 || finalConstraintName === void 0)
257
228
  throw new chunkX4GDXBOP_cjs.ConfigurationError(
258
- `Could not generate migration table DDL for ${logicalName}.`
229
+ "Recorded relation DDL must name both primary-key constraints or neither.",
230
+ {
231
+ code: "RECORDED_DDL_CONSTRAINT_NAME_MISMATCH",
232
+ relation: key,
233
+ finalTable: finalNames[key],
234
+ temporaryConstraintName,
235
+ finalConstraintName
236
+ }
259
237
  );
260
- }
261
- return [createTable, ...finalDdl.slice(1)];
238
+ return {
239
+ status: "rename",
240
+ from: temporaryConstraintName,
241
+ to: finalConstraintName
242
+ };
262
243
  }
263
244
  return {
264
- clock: statements("recordedClock"),
265
- edges: statements("recordedEdges"),
266
- nodes: statements("recordedNodes")
245
+ ddl: {
246
+ recordedClock: composed("recordedClock"),
247
+ recordedEdges: composed("recordedEdges"),
248
+ recordedNodes: composed("recordedNodes")
249
+ },
250
+ primaryKeyConstraintRenames: {
251
+ recordedClock: primaryKeyConstraintRename("recordedClock"),
252
+ recordedEdges: primaryKeyConstraintRename("recordedEdges"),
253
+ recordedNodes: primaryKeyConstraintRename("recordedNodes")
254
+ }
267
255
  };
268
256
  }
269
257
  function migratedColumn(column, legacyAlias) {
270
- if (column === "recorded_from") return chunkOJHD3LXJ_cjs.sql`from_map.revision`;
258
+ if (column === "recorded_from") return chunkH5IJSROF_cjs.sql`from_map.revision`;
271
259
  if (column === "recorded_to") {
272
- return chunkOJHD3LXJ_cjs.sql`
260
+ return chunkH5IJSROF_cjs.sql`
273
261
  CASE
274
- WHEN ${chunkOJHD3LXJ_cjs.sql.raw(legacyAlias)}.recorded_to = ${LEGACY_RECORDED_MAX}
262
+ WHEN ${chunkH5IJSROF_cjs.sql.raw(legacyAlias)}.recorded_to = ${LEGACY_RECORDED_MAX}
275
263
  THEN ${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}
276
264
  ELSE to_map.revision
277
265
  END
278
266
  `;
279
267
  }
280
- return chunkOJHD3LXJ_cjs.sql`${chunkOJHD3LXJ_cjs.sql.raw(legacyAlias)}.${chunkOJHD3LXJ_cjs.sql.identifier(column)}`;
268
+ return chunkH5IJSROF_cjs.sql`${chunkH5IJSROF_cjs.sql.raw(legacyAlias)}.${chunkH5IJSROF_cjs.sql.identifier(column)}`;
281
269
  }
282
270
  function mappingMatch(dialect, mappingAlias, legacyColumn) {
283
- const mapping = chunkOJHD3LXJ_cjs.sql.raw(mappingAlias);
284
- const legacy = chunkOJHD3LXJ_cjs.sql.raw(`legacy.${legacyColumn}`);
285
- return dialect === "postgres" ? chunkOJHD3LXJ_cjs.sql`${mapping}.recorded_at = ${legacy}` : chunkOJHD3LXJ_cjs.sql`${mapping}.legacy_recorded_at = ${legacy}`;
271
+ const mapping = chunkH5IJSROF_cjs.sql.raw(mappingAlias);
272
+ const legacy = chunkH5IJSROF_cjs.sql.raw(`legacy.${legacyColumn}`);
273
+ return dialect === "postgres" ? chunkH5IJSROF_cjs.sql`${mapping}.recorded_at = ${legacy}` : chunkH5IJSROF_cjs.sql`${mapping}.legacy_recorded_at = ${legacy}`;
286
274
  }
287
275
  function missingMappingCount(value, legacyTable) {
288
276
  const count = Number(value);
@@ -298,12 +286,12 @@ async function assertRecordedRelationMappings(target, options) {
298
286
  const fromMatch = mappingMatch(target.dialect, "from_map", "recorded_from");
299
287
  const toMatch = mappingMatch(target.dialect, "to_map", "recorded_to");
300
288
  const rows = await target.execute(
301
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
289
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
302
290
  SELECT COUNT(*) AS missing
303
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(options.legacyTable)} AS legacy
304
- LEFT JOIN ${chunkOJHD3LXJ_cjs.sql.identifier(options.mappingTable)} AS from_map
291
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
292
+ LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS from_map
305
293
  ON from_map.graph_id = legacy.graph_id AND ${fromMatch}
306
- LEFT JOIN ${chunkOJHD3LXJ_cjs.sql.identifier(options.mappingTable)} AS to_map
294
+ LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS to_map
307
295
  ON to_map.graph_id = legacy.graph_id AND ${toMatch}
308
296
  WHERE from_map.revision IS NULL
309
297
  OR (
@@ -325,10 +313,10 @@ async function assertRecordedRelationMappings(target, options) {
325
313
  async function assertRecordedClockMappings(target, options) {
326
314
  const match = mappingMatch(target.dialect, "anchor_map", "recorded_at");
327
315
  const rows = await target.execute(
328
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
316
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
329
317
  SELECT COUNT(*) AS missing
330
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(options.legacyTable)} AS legacy
331
- LEFT JOIN ${chunkOJHD3LXJ_cjs.sql.identifier(options.mappingTable)} AS anchor_map
318
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
319
+ LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS anchor_map
332
320
  ON anchor_map.graph_id = legacy.graph_id AND ${match}
333
321
  WHERE anchor_map.revision IS NULL
334
322
  `)
@@ -344,7 +332,7 @@ async function assertRecordedClockMappings(target, options) {
344
332
  );
345
333
  }
346
334
  async function copyRecordedRelation(target, options) {
347
- const columnList = options.columns.map((column) => chunkOJHD3LXJ_cjs.sql.identifier(column));
335
+ const columnList = options.columns.map((column) => chunkH5IJSROF_cjs.sql.identifier(column));
348
336
  const values = options.columns.map(
349
337
  (column) => migratedColumn(column, "legacy")
350
338
  );
@@ -353,16 +341,16 @@ async function copyRecordedRelation(target, options) {
353
341
  const toMatch = mappingMatch(target.dialect, "to_map", "recorded_to");
354
342
  await executeStatement(
355
343
  target,
356
- chunkOJHD3LXJ_cjs.sql`
357
- INSERT INTO ${chunkOJHD3LXJ_cjs.sql.identifier(options.temporaryTable)}
358
- (${chunkOJHD3LXJ_cjs.sql.join(columnList, chunkOJHD3LXJ_cjs.sql`, `)})
359
- SELECT ${chunkOJHD3LXJ_cjs.sql.join(values, chunkOJHD3LXJ_cjs.sql`, `)}
360
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(options.legacyTable)} AS legacy
344
+ chunkH5IJSROF_cjs.sql`
345
+ INSERT INTO ${chunkH5IJSROF_cjs.sql.identifier(options.temporaryTable)}
346
+ (${chunkH5IJSROF_cjs.sql.join(columnList, chunkH5IJSROF_cjs.sql`, `)})
347
+ SELECT ${chunkH5IJSROF_cjs.sql.join(values, chunkH5IJSROF_cjs.sql`, `)}
348
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
361
349
  -- LEFT JOIN is deliberate: a missing mapping reaches the NOT NULL
362
350
  -- revision columns and fails loud instead of silently dropping history.
363
- LEFT JOIN ${chunkOJHD3LXJ_cjs.sql.identifier(options.mappingTable)} AS from_map
351
+ LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS from_map
364
352
  ON from_map.graph_id = legacy.graph_id AND ${fromMatch}
365
- LEFT JOIN ${chunkOJHD3LXJ_cjs.sql.identifier(options.mappingTable)} AS to_map
353
+ LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS to_map
366
354
  ON to_map.graph_id = legacy.graph_id AND ${toMatch}
367
355
  `
368
356
  );
@@ -372,33 +360,42 @@ async function copyRecordedClock(target, options) {
372
360
  const match = mappingMatch(target.dialect, "anchor_map", "recorded_at");
373
361
  await executeStatement(
374
362
  target,
375
- chunkOJHD3LXJ_cjs.sql`
376
- INSERT INTO ${chunkOJHD3LXJ_cjs.sql.identifier(options.temporaryTable)}
363
+ chunkH5IJSROF_cjs.sql`
364
+ INSERT INTO ${chunkH5IJSROF_cjs.sql.identifier(options.temporaryTable)}
377
365
  (graph_id, revision, recorded_at)
378
366
  SELECT legacy.graph_id, anchor_map.revision, legacy.recorded_at
379
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(options.legacyTable)} AS legacy
367
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(options.legacyTable)} AS legacy
380
368
  -- Preserve fail-loud behavior if the preflight invariant changes later.
381
- LEFT JOIN ${chunkOJHD3LXJ_cjs.sql.identifier(options.mappingTable)} AS anchor_map
369
+ LEFT JOIN ${chunkH5IJSROF_cjs.sql.identifier(options.mappingTable)} AS anchor_map
382
370
  ON anchor_map.graph_id = legacy.graph_id AND ${match}
383
371
  `
384
372
  );
385
373
  }
386
- async function replaceLegacyTables(target, tables, mappingTable) {
374
+ async function replaceLegacyTables(target, tables, mappingTable, recordedTableDdl) {
387
375
  const temporary = {
388
376
  recordedNodes: temporaryTableName(tables.recordedNodes, "rn"),
389
377
  recordedEdges: temporaryTableName(tables.recordedEdges, "re"),
390
378
  recordedClock: temporaryTableName(tables.recordedClock, "rc")
391
379
  };
392
- const ddl = tableDdl(target.dialect, tables, temporary);
380
+ const finalNames = {
381
+ recordedNodes: tables.recordedNodes,
382
+ recordedEdges: tables.recordedEdges,
383
+ recordedClock: tables.recordedClock
384
+ };
385
+ const { ddl, primaryKeyConstraintRenames } = recordedMigrationDdl(
386
+ recordedTableDdl,
387
+ finalNames,
388
+ temporary
389
+ );
393
390
  for (const table of Object.values(temporary)) {
394
391
  await executeStatement(
395
392
  target,
396
- chunkOJHD3LXJ_cjs.sql`DROP TABLE IF EXISTS ${chunkOJHD3LXJ_cjs.sql.identifier(table)}`
393
+ chunkH5IJSROF_cjs.sql`DROP TABLE IF EXISTS ${chunkH5IJSROF_cjs.sql.identifier(table)}`
397
394
  );
398
395
  }
399
- await executeDdl(target, requireCreateTable(ddl.nodes));
400
- await executeDdl(target, requireCreateTable(ddl.edges));
401
- await executeDdl(target, requireCreateTable(ddl.clock));
396
+ await executeDdl(target, ddl.recordedNodes.createTable);
397
+ await executeDdl(target, ddl.recordedEdges.createTable);
398
+ await executeDdl(target, ddl.recordedClock.createTable);
402
399
  await copyRecordedRelation(target, {
403
400
  columns: RECORDED_NODE_COLUMNS,
404
401
  legacyTable: tables.recordedNodes,
@@ -418,65 +415,58 @@ async function replaceLegacyTables(target, tables, mappingTable) {
418
415
  });
419
416
  await executeStatement(
420
417
  target,
421
- chunkOJHD3LXJ_cjs.sql`DROP TABLE ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedNodes)}`
418
+ chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedNodes)}`
422
419
  );
423
420
  await executeStatement(
424
421
  target,
425
- chunkOJHD3LXJ_cjs.sql`DROP TABLE ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedEdges)}`
422
+ chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedEdges)}`
426
423
  );
427
424
  await executeStatement(
428
425
  target,
429
- chunkOJHD3LXJ_cjs.sql`DROP TABLE ${chunkOJHD3LXJ_cjs.sql.identifier(tables.recordedClock)}`
426
+ chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedClock)}`
430
427
  );
431
428
  await renameTable(target, temporary.recordedNodes, tables.recordedNodes);
432
429
  await renameTable(target, temporary.recordedEdges, tables.recordedEdges);
433
430
  await renameTable(target, temporary.recordedClock, tables.recordedClock);
434
431
  await renamePrimaryKeyConstraint(
435
432
  target,
436
- temporary.recordedNodes,
437
- tables.recordedNodes
433
+ tables.recordedNodes,
434
+ primaryKeyConstraintRenames.recordedNodes
438
435
  );
439
436
  await renamePrimaryKeyConstraint(
440
437
  target,
441
- temporary.recordedEdges,
442
- tables.recordedEdges
438
+ tables.recordedEdges,
439
+ primaryKeyConstraintRenames.recordedEdges
443
440
  );
444
441
  await renamePrimaryKeyConstraint(
445
442
  target,
446
- temporary.recordedClock,
447
- tables.recordedClock
443
+ tables.recordedClock,
444
+ primaryKeyConstraintRenames.recordedClock
448
445
  );
449
446
  for (const statement of [
450
- ...ddl.nodes.slice(1),
451
- ...ddl.edges.slice(1),
452
- ...ddl.clock.slice(1)
447
+ ...ddl.recordedNodes.indexes,
448
+ ...ddl.recordedEdges.indexes,
449
+ ...ddl.recordedClock.indexes
453
450
  ]) {
454
451
  await executeDdl(target, statement);
455
452
  }
456
453
  }
457
- async function renamePrimaryKeyConstraint(target, temporaryTable, finalTable) {
458
- if (target.dialect !== "postgres") return;
454
+ async function renamePrimaryKeyConstraint(target, finalTable, rename) {
455
+ if (rename.status === "none") return;
459
456
  await executeStatement(
460
457
  target,
461
- chunkOJHD3LXJ_cjs.sql`
462
- ALTER TABLE ${chunkOJHD3LXJ_cjs.sql.identifier(finalTable)}
463
- RENAME CONSTRAINT ${chunkOJHD3LXJ_cjs.sql.identifier(`${temporaryTable}_pkey`)}
464
- TO ${chunkOJHD3LXJ_cjs.sql.identifier(shortenedIdentifier(`${finalTable}_pkey`))}
458
+ chunkH5IJSROF_cjs.sql`
459
+ ALTER TABLE ${chunkH5IJSROF_cjs.sql.identifier(finalTable)}
460
+ RENAME CONSTRAINT ${chunkH5IJSROF_cjs.sql.identifier(rename.from)}
461
+ TO ${chunkH5IJSROF_cjs.sql.identifier(shortenedIdentifier(rename.to))}
465
462
  `
466
463
  );
467
464
  }
468
- function requireCreateTable(statements) {
469
- const statement = statements[0];
470
- if (statement === void 0) {
471
- throw new chunkX4GDXBOP_cjs.ConfigurationError("Recorded migration table DDL was empty.");
472
- }
473
- return statement;
474
- }
475
465
  async function renameTable(target, from, to) {
476
466
  try {
477
467
  await executeStatement(
478
468
  target,
479
- chunkOJHD3LXJ_cjs.sql`ALTER TABLE ${chunkOJHD3LXJ_cjs.sql.identifier(from)} RENAME TO ${chunkOJHD3LXJ_cjs.sql.identifier(to)}`
469
+ chunkH5IJSROF_cjs.sql`ALTER TABLE ${chunkH5IJSROF_cjs.sql.identifier(from)} RENAME TO ${chunkH5IJSROF_cjs.sql.identifier(to)}`
480
470
  );
481
471
  } catch (error) {
482
472
  throw new chunkX4GDXBOP_cjs.ConfigurationError(
@@ -487,8 +477,9 @@ async function renameTable(target, from, to) {
487
477
  }
488
478
  }
489
479
  async function migrateLegacyRecordedTime(options) {
490
- const tables = resolvedTableNames(options.backend, options.tableNames);
480
+ const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
491
481
  const mapTable = mappingTableName(tables, options.mappingTableName);
482
+ const recordedTableDdl = options.backend.recordedTableDdl;
492
483
  return options.backend.transaction(async (target) => {
493
484
  const clockColumns = await columnNames(target, tables.recordedClock);
494
485
  if (clockColumns.size === 0) {
@@ -510,9 +501,9 @@ async function migrateLegacyRecordedTime(options) {
510
501
  };
511
502
  }
512
503
  const rows = await target.execute(
513
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
504
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
514
505
  SELECT COUNT(*) AS anchors, COUNT(DISTINCT graph_id) AS graphs
515
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(mapTable)}
506
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
516
507
  `)
517
508
  );
518
509
  const anchors = Number(rows[0]?.anchors ?? 0);
@@ -532,10 +523,18 @@ async function migrateLegacyRecordedTime(options) {
532
523
  { tables }
533
524
  );
534
525
  }
526
+ if (recordedTableDdl === void 0) {
527
+ throw new chunkX4GDXBOP_cjs.UnsupportedBackendCapabilityError(
528
+ "migrateLegacyRecordedTime",
529
+ "recordedTableDdl",
530
+ { dialect: target.dialect, tables },
531
+ "Migrating the timestamp-only preview recorded schema needs the backend to author its own recorded-relation DDL. Only the bundled SQLite and PostgreSQL backends created that schema."
532
+ );
533
+ }
535
534
  await executeDdl(target, migrationMapDdl(target.dialect, mapTable));
536
535
  const mapping = await readLegacyInstants(target, tables);
537
536
  await writeMappingRows(target, mapTable, mapping);
538
- await replaceLegacyTables(target, tables, mapTable);
537
+ await replaceLegacyTables(target, tables, mapTable, recordedTableDdl);
539
538
  return {
540
539
  migrated: true,
541
540
  graphs: new Set(mapping.map((row) => row.graphId)).size,
@@ -551,12 +550,12 @@ async function migrateRecordedAnchor(options) {
551
550
  if (!(error instanceof chunkX4GDXBOP_cjs.ValidationError)) throw error;
552
551
  }
553
552
  const legacyRecordedAt = canonicalLegacyInstant(options.anchor);
554
- const tables = resolvedTableNames(options.backend, options.tableNames);
553
+ const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
555
554
  const mapTable = mappingTableName(tables, options.mappingTableName);
556
555
  const rows = await options.backend.execute(
557
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
556
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
558
557
  SELECT revision, recorded_at
559
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(mapTable)}
558
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
560
559
  WHERE graph_id = ${options.graphId}
561
560
  AND legacy_recorded_at = ${legacyRecordedAt}
562
561
  `)
@@ -577,34 +576,29 @@ async function migrateRecordedAnchor(options) {
577
576
  );
578
577
  }
579
578
  async function deleteLegacyRecordedAnchorMap(options) {
580
- if (options.backend.executeStatement === void 0) {
581
- throw new chunkX4GDXBOP_cjs.ConfigurationError(
582
- "Deleting a recorded anchor migration map requires executeStatement support.",
583
- { dialect: options.backend.dialect }
584
- );
585
- }
586
- const tables = resolvedTableNames(options.backend, options.tableNames);
579
+ requireStatements(options.backend);
580
+ const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
587
581
  const mapTable = mappingTableName(tables, options.mappingTableName);
588
582
  await options.backend.transaction(async (target) => {
589
583
  await executeStatement(
590
584
  target,
591
- chunkOJHD3LXJ_cjs.sql`
592
- DELETE FROM ${chunkOJHD3LXJ_cjs.sql.identifier(mapTable)}
585
+ chunkH5IJSROF_cjs.sql`
586
+ DELETE FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
593
587
  WHERE graph_id = ${options.graphId}
594
588
  `
595
589
  );
596
590
  if (options.dropWhenEmpty !== true) return;
597
591
  const rows = await target.execute(
598
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
592
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
599
593
  SELECT COUNT(*) AS anchors, COUNT(DISTINCT graph_id) AS graphs
600
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(mapTable)}
594
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
601
595
  `)
602
596
  );
603
597
  const remaining = missingMappingCount(rows[0]?.anchors, mapTable);
604
598
  if (remaining === 0) {
605
599
  await executeStatement(
606
600
  target,
607
- chunkOJHD3LXJ_cjs.sql`DROP TABLE ${chunkOJHD3LXJ_cjs.sql.identifier(mapTable)}`
601
+ chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}`
608
602
  );
609
603
  }
610
604
  });
@@ -640,36 +634,36 @@ function relationTable(tables, relation) {
640
634
  }
641
635
  }
642
636
  function graphScopeClauses(graphId) {
643
- return graphId === void 0 ? [] : [chunkOJHD3LXJ_cjs.sql`graph_id = ${graphId}`];
637
+ return graphId === void 0 ? [] : [chunkH5IJSROF_cjs.sql`graph_id = ${graphId}`];
644
638
  }
645
639
  function canonicalBoundsClauses(dialect) {
646
640
  if (dialect !== "sqlite") return [];
647
641
  return [
648
- chunkOJHD3LXJ_cjs.sql`valid_from GLOB ${CANONICAL_INSTANT_GLOB}`,
649
- chunkOJHD3LXJ_cjs.sql`valid_to GLOB ${CANONICAL_INSTANT_GLOB}`
642
+ chunkH5IJSROF_cjs.sql`valid_from GLOB ${CANONICAL_INSTANT_GLOB}`,
643
+ chunkH5IJSROF_cjs.sql`valid_to GLOB ${CANONICAL_INSTANT_GLOB}`
650
644
  ];
651
645
  }
652
646
  function invertedValidityWindowPredicate(options) {
653
- return chunkOJHD3LXJ_cjs.sql.join(
647
+ return chunkH5IJSROF_cjs.sql.join(
654
648
  [
655
- chunkOJHD3LXJ_cjs.sql`valid_from IS NOT NULL`,
656
- chunkOJHD3LXJ_cjs.sql`valid_to IS NOT NULL`,
649
+ chunkH5IJSROF_cjs.sql`valid_from IS NOT NULL`,
650
+ chunkH5IJSROF_cjs.sql`valid_to IS NOT NULL`,
657
651
  ...canonicalBoundsClauses(options.dialect),
658
- chunkOJHD3LXJ_cjs.sql`valid_from > valid_to`,
652
+ chunkH5IJSROF_cjs.sql`valid_from > valid_to`,
659
653
  ...graphScopeClauses(options.graphId)
660
654
  ],
661
- chunkOJHD3LXJ_cjs.sql` AND `
655
+ chunkH5IJSROF_cjs.sql` AND `
662
656
  );
663
657
  }
664
658
  function nonCanonicalWindowPredicate(graphId) {
665
- return chunkOJHD3LXJ_cjs.sql.join(
659
+ return chunkH5IJSROF_cjs.sql.join(
666
660
  [
667
- chunkOJHD3LXJ_cjs.sql`valid_from IS NOT NULL`,
668
- chunkOJHD3LXJ_cjs.sql`valid_to IS NOT NULL`,
669
- chunkOJHD3LXJ_cjs.sql`(valid_from NOT GLOB ${CANONICAL_INSTANT_GLOB} OR valid_to NOT GLOB ${CANONICAL_INSTANT_GLOB})`,
661
+ chunkH5IJSROF_cjs.sql`valid_from IS NOT NULL`,
662
+ chunkH5IJSROF_cjs.sql`valid_to IS NOT NULL`,
663
+ chunkH5IJSROF_cjs.sql`(valid_from NOT GLOB ${CANONICAL_INSTANT_GLOB} OR valid_to NOT GLOB ${CANONICAL_INSTANT_GLOB})`,
670
664
  ...graphScopeClauses(graphId)
671
665
  ],
672
- chunkOJHD3LXJ_cjs.sql` AND `
666
+ chunkH5IJSROF_cjs.sql` AND `
673
667
  );
674
668
  }
675
669
  function safeCount(value, table) {
@@ -684,25 +678,22 @@ function safeCount(value, table) {
684
678
  }
685
679
  async function countMatching(target, table, predicate) {
686
680
  const rows = await target.execute(
687
- chunkOJHD3LXJ_cjs.asCompiledRowsSql(chunkOJHD3LXJ_cjs.sql`
681
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
688
682
  SELECT COUNT(*) AS matches
689
- FROM ${chunkOJHD3LXJ_cjs.sql.identifier(table)}
683
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(table)}
690
684
  WHERE ${predicate}
691
685
  `)
692
686
  );
693
687
  return safeCount(rows[0]?.matches, table);
694
688
  }
695
- function requireStatements2(target) {
696
- if (target.executeStatement === void 0) {
697
- throw new chunkX4GDXBOP_cjs.ConfigurationError(
698
- "Repairing inverted validity windows requires executeStatement support.",
699
- { dialect: target.dialect, mode: "apply" },
700
- {
701
- suggestion: 'Use a built-in SQLite or PostgreSQL backend to apply the repair. Detection needs no such support: call this with mode: "report" to count the affected rows on any backend.'
702
- }
703
- );
704
- }
705
- return target.executeStatement;
689
+ function statementExecutionRequiredError(dialect) {
690
+ return new chunkX4GDXBOP_cjs.ConfigurationError(
691
+ "Repairing inverted validity windows requires executeStatement support.",
692
+ { dialect, mode: "apply" },
693
+ {
694
+ suggestion: 'Use a built-in SQLite or PostgreSQL backend to apply the repair. Detection needs no such support: call this with mode: "report" to count the affected rows on any backend.'
695
+ }
696
+ );
706
697
  }
707
698
  function translatedCaptureRefusal(error) {
708
699
  if (!(error instanceof chunkX4GDXBOP_cjs.ConfigurationError) || error.details["code"] !== "RECORDED_CAPTURE_RAW_SQL_DISABLED") {
@@ -717,11 +708,14 @@ function translatedCaptureRefusal(error) {
717
708
  }
718
709
  );
719
710
  }
720
- async function repairRelation(target, table, predicate) {
711
+ async function repairRelation(target, verdict, table, predicate) {
712
+ if (!verdict.supported) {
713
+ throw statementExecutionRequiredError(target.dialect);
714
+ }
721
715
  try {
722
- await requireStatements2(target)(
723
- chunkOJHD3LXJ_cjs.asCompiledStatementSql(chunkOJHD3LXJ_cjs.sql`
724
- UPDATE ${chunkOJHD3LXJ_cjs.sql.identifier(table)}
716
+ await chunkNUQ2YFFH_cjs.statementExecutionMembers(target, verdict).executeStatement(
717
+ chunkH5IJSROF_cjs.asCompiledStatementSql(chunkH5IJSROF_cjs.sql`
718
+ UPDATE ${chunkH5IJSROF_cjs.sql.identifier(table)}
725
719
  SET valid_from = NULL
726
720
  WHERE ${predicate}
727
721
  `)
@@ -753,10 +747,13 @@ function relationRecord(counts) {
753
747
  };
754
748
  }
755
749
  async function repairInvertedValidityWindows(options) {
756
- const tables = resolvedTableNames(options.backend, options.tableNames);
750
+ const tables = chunkEKG2UXNX_cjs.resolvedTableNames(options.backend, options.tableNames);
757
751
  const relations = scopedRelations(options.relations);
758
- if (options.mode === "apply") requireStatements2(options.backend);
759
- return chunkGHZPZNFC_cjs.runOptionallyInTransaction(
752
+ const verdict = chunkZGVTNKTX_cjs.statementExecutionVerdict(options.backend);
753
+ if (options.mode === "apply" && !verdict.supported) {
754
+ throw statementExecutionRequiredError(options.backend.dialect);
755
+ }
756
+ return chunkNUQ2YFFH_cjs.runOptionallyInTransaction(
760
757
  options.backend,
761
758
  async (target, execution) => {
762
759
  const predicate = invertedValidityWindowPredicate({
@@ -782,6 +779,7 @@ async function repairInvertedValidityWindows(options) {
782
779
  for (const relation of relations) {
783
780
  await repairRelation(
784
781
  target,
782
+ verdict,
785
783
  relationTable(tables, relation),
786
784
  predicate
787
785
  );
@@ -802,5 +800,5 @@ exports.deleteLegacyRecordedAnchorMap = deleteLegacyRecordedAnchorMap;
802
800
  exports.migrateLegacyRecordedTime = migrateLegacyRecordedTime;
803
801
  exports.migrateRecordedAnchor = migrateRecordedAnchor;
804
802
  exports.repairInvertedValidityWindows = repairInvertedValidityWindows;
805
- //# sourceMappingURL=chunk-TTCOPKUL.cjs.map
806
- //# sourceMappingURL=chunk-TTCOPKUL.cjs.map
803
+ //# sourceMappingURL=chunk-OGL4X4PH.cjs.map
804
+ //# sourceMappingURL=chunk-OGL4X4PH.cjs.map