@nicia-ai/typegraph 0.49.0 → 0.51.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 (370) hide show
  1. package/README.md +12 -0
  2. package/dist/backend/drizzle/indexes.cjs +11 -9
  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 +7 -5
  6. package/dist/backend/index.cjs +190 -53
  7. package/dist/backend/index.d.cts +90 -4
  8. package/dist/backend/index.d.ts +90 -4
  9. package/dist/backend/index.js +9 -12
  10. package/dist/backend/postgres/index.cjs +36 -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 +19 -15
  14. package/dist/backend/postgres/pglite-store.cjs +7 -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 +7 -62
  19. package/dist/backend/postgres/pglite-store.js.map +1 -1
  20. package/dist/backend/postgres/pglite.cjs +21 -17
  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 +20 -16
  24. package/dist/backend/sqlite/index.cjs +33 -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 +17 -13
  28. package/dist/backend/sqlite/libsql.cjs +24 -20
  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 +19 -15
  33. package/dist/backend/sqlite/libsql.js.map +1 -1
  34. package/dist/backend/sqlite/local-store.cjs +9 -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 +8 -64
  39. package/dist/backend/sqlite/local-store.js.map +1 -1
  40. package/dist/backend/sqlite/local.cjs +25 -20
  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 +21 -16
  44. package/dist/chunk-2CVDZCXH.cjs +1278 -0
  45. package/dist/chunk-2CVDZCXH.cjs.map +1 -0
  46. package/dist/{chunk-MYKHJI2J.js → chunk-2DWTBNSH.js} +3 -3
  47. package/dist/{chunk-MYKHJI2J.js.map → chunk-2DWTBNSH.js.map} +1 -1
  48. package/dist/{chunk-JB6T4GLL.cjs → chunk-2KCTP3U2.cjs} +870 -528
  49. package/dist/chunk-2KCTP3U2.cjs.map +1 -0
  50. package/dist/{chunk-OORXGFL5.cjs → chunk-322TBTOQ.cjs} +48 -48
  51. package/dist/{chunk-OORXGFL5.cjs.map → chunk-322TBTOQ.cjs.map} +1 -1
  52. package/dist/{chunk-FA2AFWLP.cjs → chunk-36SX6QXP.cjs} +31 -12
  53. package/dist/chunk-36SX6QXP.cjs.map +1 -0
  54. package/dist/{chunk-SDBBMD4N.js → chunk-36VYWVQU.js} +3 -3
  55. package/dist/{chunk-SDBBMD4N.js.map → chunk-36VYWVQU.js.map} +1 -1
  56. package/dist/chunk-4DKY6RIU.js +1253 -0
  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-WIC7DRXW.js → chunk-57JM6NW3.js} +9 -19
  61. package/dist/chunk-57JM6NW3.js.map +1 -0
  62. package/dist/chunk-5WWEYV4H.cjs +5113 -0
  63. package/dist/chunk-5WWEYV4H.cjs.map +1 -0
  64. package/dist/chunk-6KQEICJ6.cjs +12 -0
  65. package/dist/{chunk-MKJ4KXL5.cjs.map → chunk-6KQEICJ6.cjs.map} +1 -1
  66. package/dist/{chunk-DZAICA5J.js → chunk-6NKSE5AU.js} +4 -4
  67. package/dist/{chunk-DZAICA5J.js.map → chunk-6NKSE5AU.js.map} +1 -1
  68. package/dist/{chunk-KKBDXCLQ.js → chunk-6NLYIMJO.js} +4 -4
  69. package/dist/{chunk-KKBDXCLQ.js.map → chunk-6NLYIMJO.js.map} +1 -1
  70. package/dist/{chunk-BFUOME67.cjs → chunk-7B7I7YAW.cjs} +20 -11
  71. package/dist/chunk-7B7I7YAW.cjs.map +1 -0
  72. package/dist/{chunk-ZDKTPBGV.js → chunk-7G5IYROL.js} +6 -548
  73. package/dist/chunk-7G5IYROL.js.map +1 -0
  74. package/dist/{chunk-3DMMGT6S.js → chunk-7QFRK6PU.js} +4 -8
  75. package/dist/chunk-7QFRK6PU.js.map +1 -0
  76. package/dist/chunk-A4C4NJ5U.cjs +12 -0
  77. package/dist/chunk-A4C4NJ5U.cjs.map +1 -0
  78. package/dist/{chunk-CHAOFCHV.js → chunk-AH2A74OZ.js} +3 -3
  79. package/dist/{chunk-CHAOFCHV.js.map → chunk-AH2A74OZ.js.map} +1 -1
  80. package/dist/{chunk-UGHQV7MP.cjs → chunk-B3MN7EJR.cjs} +228 -162
  81. package/dist/chunk-B3MN7EJR.cjs.map +1 -0
  82. package/dist/{chunk-TZEGUG6D.cjs → chunk-BZ5MVITP.cjs} +4 -4
  83. package/dist/{chunk-TZEGUG6D.cjs.map → chunk-BZ5MVITP.cjs.map} +1 -1
  84. package/dist/{chunk-YVF2EM7B.js → chunk-CAI6SMP6.js} +3 -3
  85. package/dist/{chunk-YVF2EM7B.js.map → chunk-CAI6SMP6.js.map} +1 -1
  86. package/dist/{chunk-JONXFAPO.js → chunk-CBOD7TXH.js} +5 -5
  87. package/dist/{chunk-JONXFAPO.js.map → chunk-CBOD7TXH.js.map} +1 -1
  88. package/dist/{chunk-FQPEMEWX.cjs → chunk-CRZ56SZU.cjs} +81 -32
  89. package/dist/chunk-CRZ56SZU.cjs.map +1 -0
  90. package/dist/{chunk-DO7SAMEK.cjs → chunk-D3GWARN7.cjs} +47 -47
  91. package/dist/{chunk-DO7SAMEK.cjs.map → chunk-D3GWARN7.cjs.map} +1 -1
  92. package/dist/{chunk-QTD6HX4O.js → chunk-D3OUDFU7.js} +5 -5
  93. package/dist/{chunk-QTD6HX4O.js.map → chunk-D3OUDFU7.js.map} +1 -1
  94. package/dist/{chunk-2QGYQBS2.cjs → chunk-DWUDZ66O.cjs} +10 -10
  95. package/dist/{chunk-2QGYQBS2.cjs.map → chunk-DWUDZ66O.cjs.map} +1 -1
  96. package/dist/chunk-EKG2UXNX.cjs +23 -0
  97. package/dist/chunk-EKG2UXNX.cjs.map +1 -0
  98. package/dist/chunk-FMMW3KX7.cjs +148 -0
  99. package/dist/chunk-FMMW3KX7.cjs.map +1 -0
  100. package/dist/{chunk-XVWOYKIK.js → chunk-FZHF5UWR.js} +3 -3
  101. package/dist/{chunk-XVWOYKIK.js.map → chunk-FZHF5UWR.js.map} +1 -1
  102. package/dist/chunk-H2VWDQWC.cjs +571 -0
  103. package/dist/chunk-H2VWDQWC.cjs.map +1 -0
  104. package/dist/chunk-H4FY6OZK.js +13 -0
  105. package/dist/chunk-H4FY6OZK.js.map +1 -0
  106. package/dist/{chunk-EDN4Y4ZG.cjs → chunk-H5IJSROF.cjs} +9 -15
  107. package/dist/chunk-H5IJSROF.cjs.map +1 -0
  108. package/dist/chunk-HZUB5CON.js +27 -0
  109. package/dist/chunk-HZUB5CON.js.map +1 -0
  110. package/dist/{chunk-NACVVDWB.js → chunk-I5IOSA27.js} +103 -105
  111. package/dist/chunk-I5IOSA27.js.map +1 -0
  112. package/dist/{chunk-OI2GQ25X.cjs → chunk-I7YAY2VQ.cjs} +7 -7
  113. package/dist/{chunk-OI2GQ25X.cjs.map → chunk-I7YAY2VQ.cjs.map} +1 -1
  114. package/dist/chunk-IRCWIA3R.js +20 -0
  115. package/dist/chunk-IRCWIA3R.js.map +1 -0
  116. package/dist/chunk-IVQBLXBK.cjs +55 -0
  117. package/dist/chunk-IVQBLXBK.cjs.map +1 -0
  118. package/dist/{chunk-7SQSZN2J.js → chunk-IZD4HTCP.js} +5 -5
  119. package/dist/{chunk-7SQSZN2J.js.map → chunk-IZD4HTCP.js.map} +1 -1
  120. package/dist/{chunk-3FPR224C.cjs → chunk-JHRUZ73O.cjs} +116 -107
  121. package/dist/chunk-JHRUZ73O.cjs.map +1 -0
  122. package/dist/{chunk-EZEEWCFJ.cjs → chunk-JQKMEKKW.cjs} +525 -298
  123. package/dist/chunk-JQKMEKKW.cjs.map +1 -0
  124. package/dist/chunk-JVA3KDEA.cjs +691 -0
  125. package/dist/chunk-JVA3KDEA.cjs.map +1 -0
  126. package/dist/{chunk-5K2BKEBD.js → chunk-K46SDNQD.js} +10 -4
  127. package/dist/chunk-K46SDNQD.js.map +1 -0
  128. package/dist/{chunk-7LZJNLA5.js → chunk-K67P5DLL.js} +108 -42
  129. package/dist/chunk-K67P5DLL.js.map +1 -0
  130. package/dist/{chunk-3G5W2U2L.cjs → chunk-KACEYDYV.cjs} +335 -258
  131. package/dist/chunk-KACEYDYV.cjs.map +1 -0
  132. package/dist/{chunk-JFRT7S3B.cjs → chunk-L6EVYIID.cjs} +318 -478
  133. package/dist/chunk-L6EVYIID.cjs.map +1 -0
  134. package/dist/{chunk-SHFBB23Q.js → chunk-LI4K2KEJ.js} +6 -4
  135. package/dist/chunk-LI4K2KEJ.js.map +1 -0
  136. package/dist/chunk-LKZDQ2B4.js +1581 -0
  137. package/dist/chunk-LKZDQ2B4.js.map +1 -0
  138. package/dist/{chunk-WODMN3Q2.cjs → chunk-LLFPQOBA.cjs} +27 -27
  139. package/dist/{chunk-WODMN3Q2.cjs.map → chunk-LLFPQOBA.cjs.map} +1 -1
  140. package/dist/{chunk-P6YLZTRE.js → chunk-LZMQ3SFK.js} +3 -3
  141. package/dist/{chunk-P6YLZTRE.js.map → chunk-LZMQ3SFK.js.map} +1 -1
  142. package/dist/{chunk-HEV35TGT.js → chunk-M3VTS3F6.js} +13 -4
  143. package/dist/chunk-M3VTS3F6.js.map +1 -0
  144. package/dist/{chunk-TQHGE7UC.cjs → chunk-M5MSP3BI.cjs} +18 -10
  145. package/dist/chunk-M5MSP3BI.cjs.map +1 -0
  146. package/dist/{chunk-D4QLTJSM.js → chunk-NBOS7BY3.js} +63 -23
  147. package/dist/chunk-NBOS7BY3.js.map +1 -0
  148. package/dist/chunk-NGQDGL5X.js +140 -0
  149. package/dist/chunk-NGQDGL5X.js.map +1 -0
  150. package/dist/{chunk-SIT26LAZ.cjs → chunk-NLX5OWK7.cjs} +33 -5
  151. package/dist/chunk-NLX5OWK7.cjs.map +1 -0
  152. package/dist/chunk-NUQ2YFFH.cjs +1637 -0
  153. package/dist/chunk-NUQ2YFFH.cjs.map +1 -0
  154. package/dist/{chunk-UMGZDVOA.cjs → chunk-OGL4X4PH.cjs} +206 -208
  155. package/dist/chunk-OGL4X4PH.cjs.map +1 -0
  156. package/dist/{chunk-LRQKXRXO.cjs → chunk-OTNTGEXR.cjs} +4 -4
  157. package/dist/{chunk-LRQKXRXO.cjs.map → chunk-OTNTGEXR.cjs.map} +1 -1
  158. package/dist/chunk-OTWE63BW.js +53 -0
  159. package/dist/chunk-OTWE63BW.js.map +1 -0
  160. package/dist/chunk-PC5NGH5A.js +549 -0
  161. package/dist/chunk-PC5NGH5A.js.map +1 -0
  162. package/dist/{chunk-26YKDNUD.cjs → chunk-PS3TUWJM.cjs} +12 -10
  163. package/dist/chunk-PS3TUWJM.cjs.map +1 -0
  164. package/dist/{chunk-OMZ37BM2.js → chunk-PVFFH7TL.js} +5 -5
  165. package/dist/{chunk-OMZ37BM2.js.map → chunk-PVFFH7TL.js.map} +1 -1
  166. package/dist/chunk-QCD5JKU4.cjs +15 -0
  167. package/dist/chunk-QCD5JKU4.cjs.map +1 -0
  168. package/dist/{chunk-UGHG7PGX.js → chunk-QG5VEOKX.js} +30 -4
  169. package/dist/chunk-QG5VEOKX.js.map +1 -0
  170. package/dist/{chunk-TUNPBZY3.cjs → chunk-QLLZM5I3.cjs} +4 -4
  171. package/dist/{chunk-TUNPBZY3.cjs.map → chunk-QLLZM5I3.cjs.map} +1 -1
  172. package/dist/{chunk-BRRP76WO.js → chunk-RCBG6YMT.js} +781 -375
  173. package/dist/chunk-RCBG6YMT.js.map +1 -0
  174. package/dist/{chunk-LTXQOEIC.js → chunk-RI7RJH4G.js} +281 -204
  175. package/dist/chunk-RI7RJH4G.js.map +1 -0
  176. package/dist/{chunk-GYEG3ZLZ.cjs → chunk-RJMHU2MG.cjs} +121 -18
  177. package/dist/chunk-RJMHU2MG.cjs.map +1 -0
  178. package/dist/{chunk-GLHXM7C4.js → chunk-RVUL2HXY.js} +61 -23
  179. package/dist/chunk-RVUL2HXY.js.map +1 -0
  180. package/dist/chunk-RWUWTJQY.cjs +30 -0
  181. package/dist/chunk-RWUWTJQY.cjs.map +1 -0
  182. package/dist/{chunk-2O4PCIZ6.cjs → chunk-S5GU4LUN.cjs} +13 -13
  183. package/dist/{chunk-2O4PCIZ6.cjs.map → chunk-S5GU4LUN.cjs.map} +1 -1
  184. package/dist/{chunk-JPD2CTC3.js → chunk-SDPWO2Z5.js} +7 -7
  185. package/dist/{chunk-JPD2CTC3.js.map → chunk-SDPWO2Z5.js.map} +1 -1
  186. package/dist/{chunk-OVI7IXYX.js → chunk-SLGGT2XD.js} +3 -3
  187. package/dist/{chunk-OVI7IXYX.js.map → chunk-SLGGT2XD.js.map} +1 -1
  188. package/dist/{chunk-ROR5ZR6A.cjs → chunk-TIJUA4I6.cjs} +45 -45
  189. package/dist/{chunk-ROR5ZR6A.cjs.map → chunk-TIJUA4I6.cjs.map} +1 -1
  190. package/dist/{chunk-AOSSQDVO.cjs → chunk-TM54OBHX.cjs} +13 -13
  191. package/dist/{chunk-AOSSQDVO.cjs.map → chunk-TM54OBHX.cjs.map} +1 -1
  192. package/dist/{chunk-KF6K7TGH.js → chunk-TYEYRCXL.js} +766 -433
  193. package/dist/chunk-TYEYRCXL.js.map +1 -0
  194. package/dist/{chunk-Z2JCLZFJ.js → chunk-UKOVGCRN.js} +2151 -570
  195. package/dist/chunk-UKOVGCRN.js.map +1 -0
  196. package/dist/chunk-UYKDYE5D.cjs +12 -0
  197. package/dist/{chunk-CICO5GXD.cjs.map → chunk-UYKDYE5D.cjs.map} +1 -1
  198. package/dist/{chunk-S5TERQVW.js → chunk-VAAC7L57.js} +284 -66
  199. package/dist/chunk-VAAC7L57.js.map +1 -0
  200. package/dist/{chunk-7UOLHNWC.cjs → chunk-VKHXYVN7.cjs} +22 -33
  201. package/dist/chunk-VKHXYVN7.cjs.map +1 -0
  202. package/dist/{chunk-6NGW27EO.cjs → chunk-VLBTRXA2.cjs} +10 -10
  203. package/dist/{chunk-6NGW27EO.cjs.map → chunk-VLBTRXA2.cjs.map} +1 -1
  204. package/dist/{chunk-YIURNGXI.js → chunk-VUQZNUHU.js} +22 -6
  205. package/dist/chunk-VUQZNUHU.js.map +1 -0
  206. package/dist/{chunk-YYUHLYM2.cjs → chunk-WDM5WQK4.cjs} +183 -143
  207. package/dist/chunk-WDM5WQK4.cjs.map +1 -0
  208. package/dist/{chunk-ZFMCDJGB.js → chunk-WFSYYU4W.js} +70 -220
  209. package/dist/chunk-WFSYYU4W.js.map +1 -0
  210. package/dist/{chunk-SR725PWF.cjs → chunk-WRBV2FNH.cjs} +2065 -1659
  211. package/dist/chunk-WRBV2FNH.cjs.map +1 -0
  212. package/dist/{chunk-MRDBBHIZ.cjs → chunk-X4GDXBOP.cjs} +2 -2
  213. package/dist/chunk-X4GDXBOP.cjs.map +1 -0
  214. package/dist/chunk-XORONCV3.js +202 -0
  215. package/dist/chunk-XORONCV3.js.map +1 -0
  216. package/dist/{chunk-D5R42W5D.js → chunk-XZW2CTNO.js} +115 -12
  217. package/dist/chunk-XZW2CTNO.js.map +1 -0
  218. package/dist/{chunk-ZLONH2UD.js → chunk-YDEJQWOL.js} +2 -2
  219. package/dist/chunk-YDEJQWOL.js.map +1 -0
  220. package/dist/{chunk-2TYSSBU5.js → chunk-YT2IVFAI.js} +30 -21
  221. package/dist/chunk-YT2IVFAI.js.map +1 -0
  222. package/dist/chunk-ZGVTNKTX.cjs +217 -0
  223. package/dist/chunk-ZGVTNKTX.cjs.map +1 -0
  224. package/dist/core/index.cjs +29 -28
  225. package/dist/core/index.d.cts +4 -4
  226. package/dist/core/index.d.ts +4 -4
  227. package/dist/core/index.js +9 -8
  228. package/dist/{ddl-D_oW-EVO.d.ts → ddl-BvcbgzHo.d.ts} +3 -3
  229. package/dist/{ddl-BL1NZLMY.d.cts → ddl-Ufebz5q5.d.cts} +3 -3
  230. package/dist/graph-extension/index.cjs +21 -20
  231. package/dist/graph-extension/index.d.cts +2 -4
  232. package/dist/graph-extension/index.d.ts +2 -4
  233. package/dist/graph-extension/index.js +5 -4
  234. package/dist/graph-merge/index.cjs +324 -307
  235. package/dist/graph-merge/index.cjs.map +1 -1
  236. package/dist/graph-merge/index.d.cts +8 -9
  237. package/dist/graph-merge/index.d.ts +8 -9
  238. package/dist/graph-merge/index.js +51 -34
  239. package/dist/graph-merge/index.js.map +1 -1
  240. package/dist/index.cjs +224 -222
  241. package/dist/index.cjs.map +1 -1
  242. package/dist/index.d.cts +11 -12
  243. package/dist/index.d.ts +11 -12
  244. package/dist/index.js +38 -36
  245. package/dist/index.js.map +1 -1
  246. package/dist/indexes/index.cjs +15 -13
  247. package/dist/indexes/index.d.cts +4 -4
  248. package/dist/indexes/index.d.ts +4 -4
  249. package/dist/indexes/index.js +8 -6
  250. package/dist/{ingestion-import-target-dNeL7iAv.d.ts → ingestion-import-target-CAs1OX-l.d.cts} +1 -1
  251. package/dist/{ingestion-import-target-XPxZYw89.d.cts → ingestion-import-target-DCQSPfNx.d.ts} +1 -1
  252. package/dist/interchange/index.cjs +57 -54
  253. package/dist/interchange/index.cjs.map +1 -1
  254. package/dist/interchange/index.d.cts +19 -8
  255. package/dist/interchange/index.d.ts +19 -8
  256. package/dist/interchange/index.js +21 -18
  257. package/dist/interchange/index.js.map +1 -1
  258. package/dist/local-store-impl-6DDTFM32.cjs +77 -0
  259. package/dist/local-store-impl-6DDTFM32.cjs.map +1 -0
  260. package/dist/local-store-impl-OXTOVU2J.js +75 -0
  261. package/dist/local-store-impl-OXTOVU2J.js.map +1 -0
  262. package/dist/{manager-CYaff3n3.d.cts → manager-B68OrPR2.d.ts} +29 -2
  263. package/dist/{manager-D9eRT_ns.d.ts → manager-D_t7oK69.d.cts} +29 -2
  264. package/dist/pglite-store-impl-6EMZGL7K.js +73 -0
  265. package/dist/pglite-store-impl-6EMZGL7K.js.map +1 -0
  266. package/dist/pglite-store-impl-GJG3Y7RP.cjs +75 -0
  267. package/dist/pglite-store-impl-GJG3Y7RP.cjs.map +1 -0
  268. package/dist/{postgres-CcL4bAHS.d.ts → postgres-BPLSVyHM.d.ts} +279 -2
  269. package/dist/{postgres-DMj39MEu.d.cts → postgres-CqvtFC2y.d.cts} +279 -2
  270. package/dist/profiler/index.d.cts +9 -9
  271. package/dist/profiler/index.d.ts +9 -9
  272. package/dist/provenance/index.cjs +59 -44
  273. package/dist/provenance/index.cjs.map +1 -1
  274. package/dist/provenance/index.d.cts +7 -7
  275. package/dist/provenance/index.d.ts +7 -7
  276. package/dist/provenance/index.js +28 -13
  277. package/dist/provenance/index.js.map +1 -1
  278. package/dist/{repair-validity-windows-BFNZvd_H.d.cts → repair-validity-windows-DEzCKAdy.d.cts} +7 -3
  279. package/dist/{repair-validity-windows-DlUSqwCg.d.ts → repair-validity-windows-GMdaS2AH.d.ts} +7 -3
  280. package/dist/resolve-D_H8MHtq.d.ts +1805 -0
  281. package/dist/resolve-WEW8gWws.d.cts +1805 -0
  282. package/dist/schema/index.cjs +48 -46
  283. package/dist/schema/index.d.cts +4 -6
  284. package/dist/schema/index.d.ts +4 -6
  285. package/dist/schema/index.js +21 -19
  286. package/dist/{searchable-bpE1bBfc.d.ts → searchable-C_UREI9K.d.ts} +1 -1
  287. package/dist/{searchable-DHJMh_nj.d.cts → searchable-ClgET_i7.d.cts} +1 -1
  288. package/dist/{sqlite-YppHrNFb.d.cts → sqlite-D1mXO9Kp.d.cts} +310 -2
  289. package/dist/{sqlite-D7Oz0SQh.d.ts → sqlite-MZA3oZNB.d.ts} +310 -2
  290. package/dist/{store-bphCSo7z.d.cts → store-CuFX7fCx.d.cts} +117 -31
  291. package/dist/{store-DRrFCx5x.d.ts → store-D-ZjXQpW.d.ts} +117 -31
  292. package/dist/{temporal-CbnLzTmM.d.ts → temporal-CpyEiRY8.d.cts} +1 -1
  293. package/dist/{temporal-5GqpYCk2.d.cts → temporal-y0Aep9Su.d.ts} +1 -1
  294. package/dist/{types-BqFZTQmV.d.cts → types-6yf0Vv-_.d.cts} +2016 -94
  295. package/dist/{types-BqFZTQmV.d.ts → types-6yf0Vv-_.d.ts} +2016 -94
  296. package/dist/{types-Bx74kaTt.d.ts → types-DzJ4dlzk.d.cts} +1 -1
  297. package/dist/{types-CXAhpW-c.d.cts → types-_vVSB9k-.d.ts} +1 -1
  298. package/dist/{where-O-k2wgYm.d.ts → where-DuG2LCLe.d.ts} +1 -1
  299. package/dist/{where-DI_Fqz-X.d.cts → where-Mhf_yyKX.d.cts} +1 -1
  300. package/package.json +7 -2
  301. package/dist/chunk-26YKDNUD.cjs.map +0 -1
  302. package/dist/chunk-2TYSSBU5.js.map +0 -1
  303. package/dist/chunk-3DMMGT6S.js.map +0 -1
  304. package/dist/chunk-3FPR224C.cjs.map +0 -1
  305. package/dist/chunk-3G5W2U2L.cjs.map +0 -1
  306. package/dist/chunk-3KOY4FH3.cjs +0 -934
  307. package/dist/chunk-3KOY4FH3.cjs.map +0 -1
  308. package/dist/chunk-3QNZ5SAJ.cjs +0 -3502
  309. package/dist/chunk-3QNZ5SAJ.cjs.map +0 -1
  310. package/dist/chunk-3U5ABFDW.cjs +0 -259
  311. package/dist/chunk-3U5ABFDW.cjs.map +0 -1
  312. package/dist/chunk-5K2BKEBD.js.map +0 -1
  313. package/dist/chunk-5PRKMB24.cjs +0 -124
  314. package/dist/chunk-5PRKMB24.cjs.map +0 -1
  315. package/dist/chunk-6LN7FIVU.js +0 -107
  316. package/dist/chunk-6LN7FIVU.js.map +0 -1
  317. package/dist/chunk-6SWPJEYN.js +0 -1126
  318. package/dist/chunk-6SWPJEYN.js.map +0 -1
  319. package/dist/chunk-7LZJNLA5.js.map +0 -1
  320. package/dist/chunk-7UOLHNWC.cjs.map +0 -1
  321. package/dist/chunk-BFUOME67.cjs.map +0 -1
  322. package/dist/chunk-BRRP76WO.js.map +0 -1
  323. package/dist/chunk-CICO5GXD.cjs +0 -12
  324. package/dist/chunk-D4QLTJSM.js.map +0 -1
  325. package/dist/chunk-D5R42W5D.js.map +0 -1
  326. package/dist/chunk-EDN4Y4ZG.cjs.map +0 -1
  327. package/dist/chunk-EZEEWCFJ.cjs.map +0 -1
  328. package/dist/chunk-FA2AFWLP.cjs.map +0 -1
  329. package/dist/chunk-FQPEMEWX.cjs.map +0 -1
  330. package/dist/chunk-GLHXM7C4.js.map +0 -1
  331. package/dist/chunk-GYEG3ZLZ.cjs.map +0 -1
  332. package/dist/chunk-HDL2ARHX.cjs +0 -1156
  333. package/dist/chunk-HDL2ARHX.cjs.map +0 -1
  334. package/dist/chunk-HEV35TGT.js.map +0 -1
  335. package/dist/chunk-I4GAZH5Z.js +0 -913
  336. package/dist/chunk-I4GAZH5Z.js.map +0 -1
  337. package/dist/chunk-JB6T4GLL.cjs.map +0 -1
  338. package/dist/chunk-JBQQ7THH.js +0 -20
  339. package/dist/chunk-JBQQ7THH.js.map +0 -1
  340. package/dist/chunk-JFRT7S3B.cjs.map +0 -1
  341. package/dist/chunk-KF6K7TGH.js.map +0 -1
  342. package/dist/chunk-L3LQNR34.cjs +0 -1254
  343. package/dist/chunk-L3LQNR34.cjs.map +0 -1
  344. package/dist/chunk-LTXQOEIC.js.map +0 -1
  345. package/dist/chunk-MKJ4KXL5.cjs +0 -12
  346. package/dist/chunk-MRDBBHIZ.cjs.map +0 -1
  347. package/dist/chunk-NACVVDWB.js.map +0 -1
  348. package/dist/chunk-NVY5CJFP.js +0 -244
  349. package/dist/chunk-NVY5CJFP.js.map +0 -1
  350. package/dist/chunk-PWLJ77UV.cjs +0 -23
  351. package/dist/chunk-PWLJ77UV.cjs.map +0 -1
  352. package/dist/chunk-S5TERQVW.js.map +0 -1
  353. package/dist/chunk-SHFBB23Q.js.map +0 -1
  354. package/dist/chunk-SIT26LAZ.cjs.map +0 -1
  355. package/dist/chunk-SR725PWF.cjs.map +0 -1
  356. package/dist/chunk-TQHGE7UC.cjs.map +0 -1
  357. package/dist/chunk-UGHG7PGX.js.map +0 -1
  358. package/dist/chunk-UGHQV7MP.cjs.map +0 -1
  359. package/dist/chunk-UMGZDVOA.cjs.map +0 -1
  360. package/dist/chunk-WIC7DRXW.js.map +0 -1
  361. package/dist/chunk-YIURNGXI.js.map +0 -1
  362. package/dist/chunk-YYUHLYM2.cjs.map +0 -1
  363. package/dist/chunk-Z2JCLZFJ.js.map +0 -1
  364. package/dist/chunk-ZDKTPBGV.js.map +0 -1
  365. package/dist/chunk-ZFMCDJGB.js.map +0 -1
  366. package/dist/chunk-ZLONH2UD.js.map +0 -1
  367. package/dist/index-COs_z6nV.d.cts +0 -1132
  368. package/dist/index-D7d1u2gr.d.ts +0 -1132
  369. package/dist/materialize-indexes-DJ3ykH59.d.ts +0 -266
  370. package/dist/materialize-indexes-DTtAnvfY.d.cts +0 -266
@@ -1,27 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkHDL2ARHX_cjs = require('./chunk-HDL2ARHX.cjs');
4
- var chunk3U5ABFDW_cjs = require('./chunk-3U5ABFDW.cjs');
5
- var chunk5PRKMB24_cjs = require('./chunk-5PRKMB24.cjs');
6
- var chunk2QGYQBS2_cjs = require('./chunk-2QGYQBS2.cjs');
7
- var chunkTQHGE7UC_cjs = require('./chunk-TQHGE7UC.cjs');
8
- var chunkL3LQNR34_cjs = require('./chunk-L3LQNR34.cjs');
9
- var chunkEDN4Y4ZG_cjs = require('./chunk-EDN4Y4ZG.cjs');
10
- var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
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 chunk3U5ABFDW_cjs.createSqlSchema({
21
- ...backend.tableNames,
22
- ...definedTableNameOverrides(override)
23
- }).tables;
24
- }
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
+ var chunkDWUDZ66O_cjs = require('./chunk-DWUDZ66O.cjs');
7
+ var chunkM5MSP3BI_cjs = require('./chunk-M5MSP3BI.cjs');
8
+ var chunkH2VWDQWC_cjs = require('./chunk-H2VWDQWC.cjs');
9
+ var chunkH5IJSROF_cjs = require('./chunk-H5IJSROF.cjs');
10
+ var chunkX4GDXBOP_cjs = require('./chunk-X4GDXBOP.cjs');
25
11
 
26
12
  // src/backend/migrate-recorded-time.ts
27
13
  var LEGACY_RECORDED_MAX = "9999-12-31T23:59:59.999Z";
@@ -69,20 +55,20 @@ 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)}_${chunkL3LQNR34_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 chunk3U5ABFDW_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}_${chunkL3LQNR34_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) {
85
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
71
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
86
72
  "Recorded-time migration requires executeStatement support.",
87
73
  { dialect: target.dialect },
88
74
  { suggestion: "Use a built-in SQLite or PostgreSQL backend." }
@@ -91,15 +77,15 @@ function requireStatements(target) {
91
77
  return target.executeStatement;
92
78
  }
93
79
  async function executeStatement(target, statement) {
94
- await requireStatements(target)(chunkEDN4Y4ZG_cjs.asCompiledStatementSql(statement));
80
+ await requireStatements(target)(chunkH5IJSROF_cjs.asCompiledStatementSql(statement));
95
81
  }
96
82
  async function executeDdl(target, ddl) {
97
- await executeStatement(target, chunkEDN4Y4ZG_cjs.sql.raw(ddl));
83
+ await executeStatement(target, chunkH5IJSROF_cjs.sql.raw(ddl));
98
84
  }
99
85
  function canonicalLegacyInstant(value) {
100
- const canonical = chunkTQHGE7UC_cjs.canonicalizeDatabaseTimestamp(value);
86
+ const canonical = chunkM5MSP3BI_cjs.canonicalizeDatabaseTimestamp(value);
101
87
  if (canonical === void 0) {
102
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
88
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
103
89
  "Legacy recorded-time relation contained an invalid timestamp.",
104
90
  { value }
105
91
  );
@@ -108,8 +94,8 @@ function canonicalLegacyInstant(value) {
108
94
  }
109
95
  function safeRevision(value) {
110
96
  const revision = typeof value === "bigint" ? Number(value) : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
111
- if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < 1 || revision >= chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION) {
112
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
97
+ if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < 1 || revision >= chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION) {
98
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
113
99
  "Recorded anchor mapping contained an invalid revision.",
114
100
  { value }
115
101
  );
@@ -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
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`PRAGMA table_info(${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_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,28 +119,28 @@ async function columnNames(target, tableName) {
133
119
  }
134
120
  async function readLegacyInstants(target, tables) {
135
121
  const rows = await target.execute(
136
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
122
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
137
123
  SELECT graph_id, recorded_from AS recorded_at
138
- FROM ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_cjs.sql.identifier(tables.recordedClock)}
138
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(tables.recordedClock)}
153
139
  `)
154
140
  );
155
141
  const instants = rows.map((row) => {
156
142
  if (typeof row.graph_id !== "string") {
157
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
143
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
158
144
  "Legacy recorded-time relation contained an invalid graph id.",
159
145
  { graphId: row.graph_id }
160
146
  );
@@ -205,89 +191,91 @@ function migrationMapDdl(dialect, table) {
205
191
  );`;
206
192
  }
207
193
  async function writeMappingRows(target, tableName, rows) {
208
- await executeStatement(target, chunkEDN4Y4ZG_cjs.sql`DELETE FROM ${chunkEDN4Y4ZG_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) => chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`
220
- INSERT INTO ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_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 = chunkHDL2ARHX_cjs.createSqliteTables(temporary);
230
- const finalTables2 = chunkHDL2ARHX_cjs.createSqliteTables(tables);
231
- const temporaryContributions = chunkHDL2ARHX_cjs.sqliteContributions(temporaryTables2);
232
- const finalContributions = chunkHDL2ARHX_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 = chunkHDL2ARHX_cjs.createPostgresTables(temporary);
236
- const finalTables = chunkHDL2ARHX_cjs.createPostgresTables(tables);
237
- return ddlForRecordedTables(
238
- chunkHDL2ARHX_cjs.postgresContributions(temporaryTables),
239
- chunkHDL2ARHX_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 chunkMRDBBHIZ_cjs.ConfigurationError(
252
- `Could not generate migration DDL for ${logicalName}.`
253
- );
254
- }
255
- const createTable = temporaryDdl[0];
256
- if (createTable === void 0) {
257
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
258
- `Could not generate migration table DDL for ${logicalName}.`
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)
228
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
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 chunkEDN4Y4ZG_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 chunkEDN4Y4ZG_cjs.sql`
260
+ return chunkH5IJSROF_cjs.sql`
273
261
  CASE
274
- WHEN ${chunkEDN4Y4ZG_cjs.sql.raw(legacyAlias)}.recorded_to = ${LEGACY_RECORDED_MAX}
275
- THEN ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}
262
+ WHEN ${chunkH5IJSROF_cjs.sql.raw(legacyAlias)}.recorded_to = ${LEGACY_RECORDED_MAX}
263
+ THEN ${chunkDWUDZ66O_cjs.RECORDED_MAX_REVISION}
276
264
  ELSE to_map.revision
277
265
  END
278
266
  `;
279
267
  }
280
- return chunkEDN4Y4ZG_cjs.sql`${chunkEDN4Y4ZG_cjs.sql.raw(legacyAlias)}.${chunkEDN4Y4ZG_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 = chunkEDN4Y4ZG_cjs.sql.raw(mappingAlias);
284
- const legacy = chunkEDN4Y4ZG_cjs.sql.raw(`legacy.${legacyColumn}`);
285
- return dialect === "postgres" ? chunkEDN4Y4ZG_cjs.sql`${mapping}.recorded_at = ${legacy}` : chunkEDN4Y4ZG_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);
289
277
  if (!Number.isSafeInteger(count) || count < 0) {
290
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
278
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
291
279
  "Recorded-time migration returned an invalid integrity-check count.",
292
280
  { legacyTable, value }
293
281
  );
@@ -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
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
289
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
302
290
  SELECT COUNT(*) AS missing
303
- FROM ${chunkEDN4Y4ZG_cjs.sql.identifier(options.legacyTable)} AS legacy
304
- LEFT JOIN ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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 (
@@ -314,7 +302,7 @@ async function assertRecordedRelationMappings(target, options) {
314
302
  );
315
303
  const missing = missingMappingCount(rows[0]?.missing, options.legacyTable);
316
304
  if (missing === 0) return;
317
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
305
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
318
306
  "Legacy recorded-time boundaries could not be mapped exactly.",
319
307
  { legacyTable: options.legacyTable, missingRows: missing },
320
308
  {
@@ -325,17 +313,17 @@ 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
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
316
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
329
317
  SELECT COUNT(*) AS missing
330
- FROM ${chunkEDN4Y4ZG_cjs.sql.identifier(options.legacyTable)} AS legacy
331
- LEFT JOIN ${chunkEDN4Y4ZG_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
  `)
335
323
  );
336
324
  const missing = missingMappingCount(rows[0]?.missing, options.legacyTable);
337
325
  if (missing === 0) return;
338
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
326
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
339
327
  "Legacy recorded clock values could not be mapped exactly.",
340
328
  { legacyTable: options.legacyTable, missingRows: missing },
341
329
  {
@@ -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) => chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`
357
- INSERT INTO ${chunkEDN4Y4ZG_cjs.sql.identifier(options.temporaryTable)}
358
- (${chunkEDN4Y4ZG_cjs.sql.join(columnList, chunkEDN4Y4ZG_cjs.sql`, `)})
359
- SELECT ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_cjs.sql`, `)}
360
- FROM ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`
376
- INSERT INTO ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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 ${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`DROP TABLE IF EXISTS ${chunkEDN4Y4ZG_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,68 +415,61 @@ async function replaceLegacyTables(target, tables, mappingTable) {
418
415
  });
419
416
  await executeStatement(
420
417
  target,
421
- chunkEDN4Y4ZG_cjs.sql`DROP TABLE ${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`DROP TABLE ${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`DROP TABLE ${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`
462
- ALTER TABLE ${chunkEDN4Y4ZG_cjs.sql.identifier(finalTable)}
463
- RENAME CONSTRAINT ${chunkEDN4Y4ZG_cjs.sql.identifier(`${temporaryTable}_pkey`)}
464
- TO ${chunkEDN4Y4ZG_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 chunkMRDBBHIZ_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
- chunkEDN4Y4ZG_cjs.sql`ALTER TABLE ${chunkEDN4Y4ZG_cjs.sql.identifier(from)} RENAME TO ${chunkEDN4Y4ZG_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
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
472
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
483
473
  "Could not rename a migrated recorded-time table.",
484
474
  { from, to },
485
475
  { cause: error }
@@ -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
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
504
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
514
505
  SELECT COUNT(*) AS anchors, COUNT(DISTINCT graph_id) AS graphs
515
- FROM ${chunkEDN4Y4ZG_cjs.sql.identifier(mapTable)}
506
+ FROM ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}
516
507
  `)
517
508
  );
518
509
  const anchors = Number(rows[0]?.anchors ?? 0);
@@ -527,15 +518,23 @@ async function migrateLegacyRecordedTime(options) {
527
518
  const nodeColumns = await columnNames(target, tables.recordedNodes);
528
519
  const edgeColumns = await columnNames(target, tables.recordedEdges);
529
520
  if (!nodeColumns.has("recorded_from") || !edgeColumns.has("recorded_from")) {
530
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
521
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
531
522
  "Legacy recorded-time schema is incomplete.",
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,
@@ -546,24 +545,24 @@ async function migrateLegacyRecordedTime(options) {
546
545
  }
547
546
  async function migrateRecordedAnchor(options) {
548
547
  try {
549
- return chunk2QGYQBS2_cjs.asRecordedInstant(options.anchor);
548
+ return chunkDWUDZ66O_cjs.asRecordedInstant(options.anchor);
550
549
  } catch (error) {
551
- if (!(error instanceof chunkMRDBBHIZ_cjs.ValidationError)) throw error;
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
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
556
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
558
557
  SELECT revision, recorded_at
559
- FROM ${chunkEDN4Y4ZG_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
  `)
563
562
  );
564
563
  const row = rows[0];
565
564
  if (row === void 0) {
566
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
565
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
567
566
  "No migrated recorded anchor matches this graph and legacy timestamp.",
568
567
  { anchor: options.anchor, graphId: options.graphId },
569
568
  {
@@ -571,40 +570,35 @@ async function migrateRecordedAnchor(options) {
571
570
  }
572
571
  );
573
572
  }
574
- return chunk2QGYQBS2_cjs.createRecordedInstant(
573
+ return chunkDWUDZ66O_cjs.createRecordedInstant(
575
574
  safeRevision(row.revision),
576
575
  canonicalLegacyInstant(row.recorded_at)
577
576
  );
578
577
  }
579
578
  async function deleteLegacyRecordedAnchorMap(options) {
580
- if (options.backend.executeStatement === void 0) {
581
- throw new chunkMRDBBHIZ_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
- chunkEDN4Y4ZG_cjs.sql`
592
- DELETE FROM ${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
592
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
599
593
  SELECT COUNT(*) AS anchors, COUNT(DISTINCT graph_id) AS graphs
600
- FROM ${chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`DROP TABLE ${chunkEDN4Y4ZG_cjs.sql.identifier(mapTable)}`
601
+ chunkH5IJSROF_cjs.sql`DROP TABLE ${chunkH5IJSROF_cjs.sql.identifier(mapTable)}`
608
602
  );
609
603
  }
610
604
  });
@@ -640,42 +634,42 @@ function relationTable(tables, relation) {
640
634
  }
641
635
  }
642
636
  function graphScopeClauses(graphId) {
643
- return graphId === void 0 ? [] : [chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`valid_from GLOB ${CANONICAL_INSTANT_GLOB}`,
649
- chunkEDN4Y4ZG_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 chunkEDN4Y4ZG_cjs.sql.join(
647
+ return chunkH5IJSROF_cjs.sql.join(
654
648
  [
655
- chunkEDN4Y4ZG_cjs.sql`valid_from IS NOT NULL`,
656
- chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql`valid_from > valid_to`,
652
+ chunkH5IJSROF_cjs.sql`valid_from > valid_to`,
659
653
  ...graphScopeClauses(options.graphId)
660
654
  ],
661
- chunkEDN4Y4ZG_cjs.sql` AND `
655
+ chunkH5IJSROF_cjs.sql` AND `
662
656
  );
663
657
  }
664
658
  function nonCanonicalWindowPredicate(graphId) {
665
- return chunkEDN4Y4ZG_cjs.sql.join(
659
+ return chunkH5IJSROF_cjs.sql.join(
666
660
  [
667
- chunkEDN4Y4ZG_cjs.sql`valid_from IS NOT NULL`,
668
- chunkEDN4Y4ZG_cjs.sql`valid_to IS NOT NULL`,
669
- chunkEDN4Y4ZG_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
- chunkEDN4Y4ZG_cjs.sql` AND `
666
+ chunkH5IJSROF_cjs.sql` AND `
673
667
  );
674
668
  }
675
669
  function safeCount(value, table) {
676
670
  const count = Number(value);
677
671
  if (!Number.isSafeInteger(count) || count < 0) {
678
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
672
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
679
673
  "Validity-window repair returned an invalid row count.",
680
674
  { table, value }
681
675
  );
@@ -684,31 +678,28 @@ function safeCount(value, table) {
684
678
  }
685
679
  async function countMatching(target, table, predicate) {
686
680
  const rows = await target.execute(
687
- chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
681
+ chunkH5IJSROF_cjs.asCompiledRowsSql(chunkH5IJSROF_cjs.sql`
688
682
  SELECT COUNT(*) AS matches
689
- FROM ${chunkEDN4Y4ZG_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 chunkMRDBBHIZ_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
- if (!(error instanceof chunkMRDBBHIZ_cjs.ConfigurationError) || error.details["code"] !== "RECORDED_CAPTURE_RAW_SQL_DISABLED") {
699
+ if (!(error instanceof chunkX4GDXBOP_cjs.ConfigurationError) || error.details["code"] !== "RECORDED_CAPTURE_RAW_SQL_DISABLED") {
709
700
  return error;
710
701
  }
711
- return new chunkMRDBBHIZ_cjs.ConfigurationError(
702
+ return new chunkX4GDXBOP_cjs.ConfigurationError(
712
703
  "Repairing inverted validity windows cannot run against a history-capturing backend.",
713
704
  { code: "RECORDED_CAPTURE_RAW_SQL_DISABLED", mode: "apply" },
714
705
  {
@@ -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
- chunkEDN4Y4ZG_cjs.asCompiledStatementSql(chunkEDN4Y4ZG_cjs.sql`
724
- UPDATE ${chunkEDN4Y4ZG_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
  `)
@@ -733,7 +727,7 @@ async function repairRelation(target, table, predicate) {
733
727
  function assertClassifiableBounds(nonCanonical) {
734
728
  const unclassified = [...nonCanonical].filter(([, count]) => count > 0);
735
729
  if (unclassified.length === 0) return;
736
- throw new chunkMRDBBHIZ_cjs.ConfigurationError(
730
+ throw new chunkX4GDXBOP_cjs.ConfigurationError(
737
731
  "Refusing to repair validity windows: some scanned rows store non-canonical bounds.",
738
732
  { nonCanonical: Object.fromEntries(unclassified) },
739
733
  {
@@ -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 chunk5PRKMB24_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-UMGZDVOA.cjs.map
806
- //# sourceMappingURL=chunk-UMGZDVOA.cjs.map
803
+ //# sourceMappingURL=chunk-OGL4X4PH.cjs.map
804
+ //# sourceMappingURL=chunk-OGL4X4PH.cjs.map