d1s 0.2.8 → 0.2.9

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 (310) hide show
  1. package/dist/.next/.next/BUILD_ID +1 -1
  2. package/dist/.next/.next/app-build-manifest.json +33 -26
  3. package/dist/.next/.next/app-path-routes-manifest.json +1 -1
  4. package/dist/.next/.next/build-manifest.json +2 -2
  5. package/dist/.next/.next/cache/.rscinfo +1 -1
  6. package/dist/.next/.next/cache/.tsbuildinfo +1 -1
  7. package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/dist/.next/.next/cache/webpack/client-production/1.pack +0 -0
  9. package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
  10. package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
  11. package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
  12. package/dist/.next/.next/cache/webpack/edge-server-production/index.pack +0 -0
  13. package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
  14. package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
  15. package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
  16. package/dist/.next/.next/next-server.js.nft.json +1 -1
  17. package/dist/.next/.next/prerender-manifest.json +1 -1
  18. package/dist/.next/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/dist/.next/.next/server/app/_not-found.html +1 -1
  20. package/dist/.next/.next/server/app/_not-found.rsc +4 -4
  21. package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
  22. package/dist/.next/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  23. package/dist/.next/.next/server/app/api/databases/route.js +1 -1
  24. package/dist/.next/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  25. package/dist/.next/.next/server/app/api/migrations/sync/route.js +28 -3
  26. package/dist/.next/.next/server/app/api/migrations/sync/route.js.nft.json +1 -1
  27. package/dist/.next/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  28. package/dist/.next/.next/server/app/api/migrations/sync-files/route.js +26 -1
  29. package/dist/.next/.next/server/app/api/migrations/sync-files/route.js.nft.json +1 -1
  30. package/dist/.next/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  31. package/dist/.next/.next/server/app/api/pull-data/confirm/route.js +1 -0
  32. package/dist/.next/.next/server/app/api/pull-data/confirm/route.js.nft.json +1 -0
  33. package/dist/.next/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -0
  34. package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +26 -1
  35. package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js.nft.json +1 -1
  36. package/dist/.next/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  37. package/dist/.next/.next/server/app/api/pull-remote/preview/route.js +26 -1
  38. package/dist/.next/.next/server/app/api/pull-remote/preview/route.js.nft.json +1 -1
  39. package/dist/.next/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  40. package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +28 -3
  41. package/dist/.next/.next/server/app/api/push-remote/confirm/route.js.nft.json +1 -1
  42. package/dist/.next/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  43. package/dist/.next/.next/server/app/api/push-remote/preview/route.js +28 -3
  44. package/dist/.next/.next/server/app/api/push-remote/preview/route.js.nft.json +1 -1
  45. package/dist/.next/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  46. package/dist/.next/.next/server/app/api/query/route.js +27 -2
  47. package/dist/.next/.next/server/app/api/query/route.js.nft.json +1 -1
  48. package/dist/.next/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  49. package/dist/.next/.next/server/app/api/tables/[name]/route.js +4 -4
  50. package/dist/.next/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  51. package/dist/.next/.next/server/app/api/tables/route.js +2 -2
  52. package/dist/.next/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  53. package/dist/.next/.next/server/app/api/update/route.js +2 -2
  54. package/dist/.next/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  55. package/dist/.next/.next/server/app/index.html +3 -3
  56. package/dist/.next/.next/server/app/index.rsc +5 -5
  57. package/dist/.next/.next/server/app/page.js +11 -11
  58. package/dist/.next/.next/server/app/page_client-reference-manifest.js +1 -1
  59. package/dist/.next/.next/server/app-paths-manifest.json +2 -1
  60. package/dist/.next/.next/server/chunks/226.js +30 -0
  61. package/dist/.next/.next/server/chunks/336.js +1 -1
  62. package/dist/.next/.next/server/pages/404.html +1 -1
  63. package/dist/.next/.next/server/pages/500.html +1 -1
  64. package/dist/.next/.next/server/pages-manifest.json +1 -1
  65. package/dist/.next/.next/server/server-reference-manifest.json +1 -1
  66. package/dist/.next/.next/static/7XBqETNmhSxMXhw8iUpEa/_buildManifest.js +1 -0
  67. package/dist/.next/.next/static/chunks/{958-98887928efebfdf7.js → 176-9146975ef8699719.js} +1 -1
  68. package/dist/.next/.next/static/chunks/{735-c9144179c6bd7d06.js → 735-b885dfec6353171d.js} +1 -1
  69. package/dist/.next/.next/static/chunks/app/api/cloudflare/route-b77846f372b01f38.js +1 -0
  70. package/dist/.next/.next/static/chunks/app/api/databases/route-407794f8145d9a0b.js +1 -0
  71. package/dist/.next/.next/static/chunks/app/api/migrations/sync/route-9f480f5590369a8f.js +1 -0
  72. package/dist/.next/.next/static/chunks/app/api/migrations/sync-files/route-92010db279b4dd8e.js +1 -0
  73. package/dist/.next/.next/static/chunks/app/api/pull-data/confirm/route-a02fe6d3cdd0a535.js +1 -0
  74. package/dist/.next/.next/static/chunks/app/api/pull-remote/confirm/route-f401a03507d1da50.js +1 -0
  75. package/dist/.next/.next/static/chunks/app/api/pull-remote/preview/route-3c53814b5cb8b6b0.js +1 -0
  76. package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-8f359249e907c63b.js +1 -0
  77. package/dist/.next/.next/static/chunks/app/api/push-remote/preview/route-b51bf94f39c17a9d.js +1 -0
  78. package/dist/.next/.next/static/chunks/app/api/query/route-87bae2d4aebaf859.js +1 -0
  79. package/dist/.next/.next/static/chunks/app/api/tables/[name]/route-d20ca163b9c03e7c.js +1 -0
  80. package/dist/.next/.next/static/chunks/app/api/tables/route-0f46f911562abcdf.js +1 -0
  81. package/dist/.next/.next/static/chunks/app/api/update/route-14edc1917760bce0.js +1 -0
  82. package/dist/.next/.next/static/chunks/app/page-5990cb23b8bd27c4.js +1 -0
  83. package/dist/.next/.next/static/css/674bee6608c638e4.css +3 -0
  84. package/dist/.next/.next/trace +3 -3
  85. package/dist/.next/.next/types/app/api/pull-data/confirm/route.ts +347 -0
  86. package/dist/.next/BUILD_ID +1 -1
  87. package/dist/.next/app-build-manifest.json +35 -21
  88. package/dist/.next/app-path-routes-manifest.json +1 -1
  89. package/dist/.next/build-manifest.json +2 -2
  90. package/dist/.next/cache/.rscinfo +1 -1
  91. package/dist/.next/cache/.tsbuildinfo +1 -1
  92. package/dist/.next/cache/webpack/client-production/0.pack +0 -0
  93. package/dist/.next/cache/webpack/client-production/index.pack +0 -0
  94. package/dist/.next/cache/webpack/edge-server-production/index.pack +0 -0
  95. package/dist/.next/cache/webpack/server-production/0.pack +0 -0
  96. package/dist/.next/cache/webpack/server-production/index.pack +0 -0
  97. package/dist/.next/next-minimal-server.js.nft.json +1 -1
  98. package/dist/.next/next-server.js.nft.json +1 -1
  99. package/dist/.next/prerender-manifest.json +1 -1
  100. package/dist/.next/server/app/_not-found/page.js +1 -1
  101. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  102. package/dist/.next/server/app/_not-found.html +1 -1
  103. package/dist/.next/server/app/_not-found.rsc +4 -4
  104. package/dist/.next/server/app/api/cloudflare/route.js +1 -1
  105. package/dist/.next/server/app/api/cloudflare/route.js.nft.json +1 -1
  106. package/dist/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  107. package/dist/.next/server/app/api/databases/route.js +1 -1
  108. package/dist/.next/server/app/api/databases/route.js.nft.json +1 -1
  109. package/dist/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  110. package/dist/.next/server/app/api/migrations/sync/route.js +28 -3
  111. package/dist/.next/server/app/api/migrations/sync/route.js.nft.json +1 -1
  112. package/dist/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  113. package/dist/.next/server/app/api/migrations/sync-files/route.js +26 -1
  114. package/dist/.next/server/app/api/migrations/sync-files/route.js.nft.json +1 -1
  115. package/dist/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  116. package/dist/.next/server/app/api/pull-data/confirm/route.js +1 -0
  117. package/dist/.next/server/app/api/pull-data/confirm/route.js.nft.json +1 -0
  118. package/dist/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -0
  119. package/dist/.next/server/app/api/pull-remote/confirm/route.js +26 -1
  120. package/dist/.next/server/app/api/pull-remote/confirm/route.js.nft.json +1 -1
  121. package/dist/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  122. package/dist/.next/server/app/api/pull-remote/preview/route.js +26 -1
  123. package/dist/.next/server/app/api/pull-remote/preview/route.js.nft.json +1 -1
  124. package/dist/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  125. package/dist/.next/server/app/api/push-remote/confirm/route.js +28 -3
  126. package/dist/.next/server/app/api/push-remote/confirm/route.js.nft.json +1 -1
  127. package/dist/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  128. package/dist/.next/server/app/api/push-remote/preview/route.js +28 -3
  129. package/dist/.next/server/app/api/push-remote/preview/route.js.nft.json +1 -1
  130. package/dist/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  131. package/dist/.next/server/app/api/query/route.js +27 -2
  132. package/dist/.next/server/app/api/query/route.js.nft.json +1 -1
  133. package/dist/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  134. package/dist/.next/server/app/api/tables/[name]/route.js +3 -3
  135. package/dist/.next/server/app/api/tables/[name]/route.js.nft.json +1 -1
  136. package/dist/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  137. package/dist/.next/server/app/api/tables/route.js +2 -2
  138. package/dist/.next/server/app/api/tables/route.js.nft.json +1 -1
  139. package/dist/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  140. package/dist/.next/server/app/api/update/route.js +5 -0
  141. package/dist/.next/server/app/api/update/route.js.nft.json +1 -0
  142. package/dist/.next/server/app/api/update/route_client-reference-manifest.js +1 -0
  143. package/dist/.next/server/app/index.html +3 -3
  144. package/dist/.next/server/app/index.rsc +5 -5
  145. package/dist/.next/server/app/page.js +13 -11
  146. package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
  147. package/dist/.next/server/app-paths-manifest.json +5 -3
  148. package/dist/.next/server/chunks/226.js +30 -0
  149. package/dist/.next/server/chunks/336.js +1 -1
  150. package/dist/.next/server/chunks/391.js +23 -0
  151. package/dist/.next/server/chunks/452.js +1 -0
  152. package/dist/.next/server/chunks/627.js +3 -3
  153. package/dist/.next/server/chunks/638.js +3 -3
  154. package/dist/.next/server/chunks/992.js +3 -3
  155. package/dist/.next/server/pages/404.html +1 -1
  156. package/dist/.next/server/pages/500.html +1 -1
  157. package/dist/.next/server/pages/_app.js +1 -1
  158. package/dist/.next/server/pages/_document.js +1 -1
  159. package/dist/.next/server/pages/_error.js +1 -1
  160. package/dist/.next/server/server-reference-manifest.json +1 -1
  161. package/dist/.next/static/MoZBULXFiTFzrY1JVK_Df/_buildManifest.js +1 -0
  162. package/dist/.next/static/chunks/176-9146975ef8699719.js +1 -0
  163. package/dist/.next/static/chunks/{735-c9144179c6bd7d06.js → 735-b885dfec6353171d.js} +1 -1
  164. package/dist/.next/static/chunks/app/api/cloudflare/route-b77846f372b01f38.js +1 -0
  165. package/dist/.next/static/chunks/app/api/databases/route-407794f8145d9a0b.js +1 -0
  166. package/dist/.next/static/chunks/app/api/migrations/sync/route-9f480f5590369a8f.js +1 -0
  167. package/dist/.next/static/chunks/app/api/migrations/sync-files/route-92010db279b4dd8e.js +1 -0
  168. package/dist/.next/static/chunks/app/api/pull-data/confirm/route-a02fe6d3cdd0a535.js +1 -0
  169. package/dist/.next/static/chunks/app/api/pull-remote/confirm/route-f401a03507d1da50.js +1 -0
  170. package/dist/.next/static/chunks/app/api/pull-remote/preview/route-3c53814b5cb8b6b0.js +1 -0
  171. package/dist/.next/static/chunks/app/api/push-remote/confirm/route-8f359249e907c63b.js +1 -0
  172. package/dist/.next/static/chunks/app/api/push-remote/preview/route-b51bf94f39c17a9d.js +1 -0
  173. package/dist/.next/static/chunks/app/api/query/route-87bae2d4aebaf859.js +1 -0
  174. package/dist/.next/static/chunks/app/api/tables/[name]/route-d20ca163b9c03e7c.js +1 -0
  175. package/dist/.next/static/chunks/app/api/tables/route-0f46f911562abcdf.js +1 -0
  176. package/dist/.next/static/chunks/app/api/update/route-14edc1917760bce0.js +1 -0
  177. package/dist/.next/static/chunks/app/page-5990cb23b8bd27c4.js +1 -0
  178. package/dist/.next/static/css/674bee6608c638e4.css +3 -0
  179. package/dist/.next/trace +17 -14
  180. package/dist/.next/types/app/api/pull-data/confirm/route.ts +347 -0
  181. package/dist/.next/types/app/api/update/route.ts +347 -0
  182. package/dist/app/api/pull-data/confirm/route.js +230 -0
  183. package/dist/app/api/update/route.js +36 -0
  184. package/dist/app/app/api/pull-data/confirm/route.js +230 -0
  185. package/dist/app/app/api/update/route.js +30 -5
  186. package/dist/app/app/page.jsx +21 -17
  187. package/dist/app/page.jsx +24 -14
  188. package/dist/d1-studio.js +8 -1
  189. package/dist/lib/logger.js +35 -5
  190. package/dist/lib/sql-operations.js +77 -0
  191. package/package.json +1 -1
  192. package/scripts/studio.js +8 -1
  193. package/src/app/api/pull-data/confirm/route.js +230 -0
  194. package/src/app/api/update/route.js +30 -5
  195. package/src/app/page.jsx +21 -17
  196. package/src/components/environment-handler.jsx +70 -16
  197. package/src/components/environment-select.jsx +6 -3
  198. package/src/components/pull-preview-toast.jsx +90 -63
  199. package/src/components/sidebar.jsx +25 -24
  200. package/src/components/update-banner.jsx +29 -31
  201. package/src/context/database-context.js +4 -4
  202. package/src/lib/logger.js +35 -5
  203. package/src/lib/sql-operations.js +77 -0
  204. package/dist/.next/.next/cache/webpack/client-development/0.pack.gz +0 -0
  205. package/dist/.next/.next/cache/webpack/client-development/1.pack.gz +0 -0
  206. package/dist/.next/.next/cache/webpack/client-development/2.pack.gz +0 -0
  207. package/dist/.next/.next/cache/webpack/client-development/3.pack.gz +0 -0
  208. package/dist/.next/.next/cache/webpack/client-development/4.pack.gz +0 -0
  209. package/dist/.next/.next/cache/webpack/client-development/index.pack.gz +0 -0
  210. package/dist/.next/.next/cache/webpack/client-development/index.pack.gz.old +0 -0
  211. package/dist/.next/.next/cache/webpack/client-production/10.pack +0 -0
  212. package/dist/.next/.next/cache/webpack/client-production/11.pack +0 -0
  213. package/dist/.next/.next/cache/webpack/client-production/12.pack +0 -0
  214. package/dist/.next/.next/cache/webpack/client-production/13.pack +0 -0
  215. package/dist/.next/.next/cache/webpack/client-production/14.pack +0 -0
  216. package/dist/.next/.next/cache/webpack/client-production/3.pack +0 -0
  217. package/dist/.next/.next/cache/webpack/client-production/4.pack +0 -0
  218. package/dist/.next/.next/cache/webpack/client-production/5.pack +0 -0
  219. package/dist/.next/.next/cache/webpack/client-production/6.pack +0 -0
  220. package/dist/.next/.next/cache/webpack/client-production/7.pack +0 -0
  221. package/dist/.next/.next/cache/webpack/client-production/8.pack +0 -0
  222. package/dist/.next/.next/cache/webpack/client-production/9.pack +0 -0
  223. package/dist/.next/.next/cache/webpack/server-development/0.pack.gz +0 -0
  224. package/dist/.next/.next/cache/webpack/server-development/1.pack.gz +0 -0
  225. package/dist/.next/.next/cache/webpack/server-development/2.pack.gz +0 -0
  226. package/dist/.next/.next/cache/webpack/server-development/3.pack.gz +0 -0
  227. package/dist/.next/.next/cache/webpack/server-development/4.pack.gz +0 -0
  228. package/dist/.next/.next/cache/webpack/server-development/index.pack.gz +0 -0
  229. package/dist/.next/.next/cache/webpack/server-development/index.pack.gz.old +0 -0
  230. package/dist/.next/.next/cache/webpack/server-production/1.pack +0 -0
  231. package/dist/.next/.next/cache/webpack/server-production/10.pack +0 -0
  232. package/dist/.next/.next/cache/webpack/server-production/11.pack +0 -0
  233. package/dist/.next/.next/cache/webpack/server-production/12.pack +0 -0
  234. package/dist/.next/.next/cache/webpack/server-production/13.pack +0 -0
  235. package/dist/.next/.next/cache/webpack/server-production/2.pack +0 -0
  236. package/dist/.next/.next/cache/webpack/server-production/3.pack +0 -0
  237. package/dist/.next/.next/cache/webpack/server-production/4.pack +0 -0
  238. package/dist/.next/.next/cache/webpack/server-production/5.pack +0 -0
  239. package/dist/.next/.next/cache/webpack/server-production/6.pack +0 -0
  240. package/dist/.next/.next/cache/webpack/server-production/7.pack +0 -0
  241. package/dist/.next/.next/cache/webpack/server-production/8.pack +0 -0
  242. package/dist/.next/.next/cache/webpack/server-production/9.pack +0 -0
  243. package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
  244. package/dist/.next/.next/server/chunks/686.js +0 -23
  245. package/dist/.next/.next/server/chunks/801.js +0 -55
  246. package/dist/.next/.next/static/IWRJZhjf8U8mjzz4h0VNE/_buildManifest.js +0 -1
  247. package/dist/.next/.next/static/JrwgdSDcipr0Zh7k19Cj_/_buildManifest.js +0 -1
  248. package/dist/.next/.next/static/chunks/422-6fa3c14fc64ad67b.js +0 -1
  249. package/dist/.next/.next/static/chunks/app/api/cloudflare/route-3458d78022185d7f.js +0 -1
  250. package/dist/.next/.next/static/chunks/app/api/cloudflare/route-5133155a604f2719.js +0 -1
  251. package/dist/.next/.next/static/chunks/app/api/databases/route-63a31080b565794e.js +0 -1
  252. package/dist/.next/.next/static/chunks/app/api/databases/route-64255424877a9f72.js +0 -1
  253. package/dist/.next/.next/static/chunks/app/api/migrations/sync/route-03766b3afcf043ba.js +0 -1
  254. package/dist/.next/.next/static/chunks/app/api/migrations/sync/route-d97667565b4a59b6.js +0 -1
  255. package/dist/.next/.next/static/chunks/app/api/migrations/sync-files/route-02fa291c8000dadf.js +0 -1
  256. package/dist/.next/.next/static/chunks/app/api/migrations/sync-files/route-7089bcbfeb6b5260.js +0 -1
  257. package/dist/.next/.next/static/chunks/app/api/pull-remote/confirm/route-7e05bb8920127abe.js +0 -1
  258. package/dist/.next/.next/static/chunks/app/api/pull-remote/confirm/route-9143e6e4c3f05162.js +0 -1
  259. package/dist/.next/.next/static/chunks/app/api/pull-remote/preview/route-0fa15f783e8a306c.js +0 -1
  260. package/dist/.next/.next/static/chunks/app/api/pull-remote/preview/route-c963d143a51aed66.js +0 -1
  261. package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-072132c0a6cb3df3.js +0 -1
  262. package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-96691f1880e4ed14.js +0 -1
  263. package/dist/.next/.next/static/chunks/app/api/push-remote/preview/route-a798679c67374552.js +0 -1
  264. package/dist/.next/.next/static/chunks/app/api/push-remote/preview/route-ca6bf35aa72661ee.js +0 -1
  265. package/dist/.next/.next/static/chunks/app/api/query/route-1466f6b7ffd8b6c0.js +0 -1
  266. package/dist/.next/.next/static/chunks/app/api/query/route-e90d0030a5083e20.js +0 -1
  267. package/dist/.next/.next/static/chunks/app/api/tables/[name]/route-1efe63e73b480e58.js +0 -1
  268. package/dist/.next/.next/static/chunks/app/api/tables/[name]/route-898d3f85fc8544c4.js +0 -1
  269. package/dist/.next/.next/static/chunks/app/api/tables/route-3772b4f480c4b4a4.js +0 -1
  270. package/dist/.next/.next/static/chunks/app/api/tables/route-91650359fc3735cb.js +0 -1
  271. package/dist/.next/.next/static/chunks/app/api/update/route-504d663df9124f97.js +0 -1
  272. package/dist/.next/.next/static/chunks/app/page-2c28a255a4ecd8d4.js +0 -1
  273. package/dist/.next/.next/static/chunks/app/page-3db7feef57019055.js +0 -1
  274. package/dist/.next/.next/static/chunks/app/page-79049bfa6cc07e11.js +0 -1
  275. package/dist/.next/.next/static/css/4957328384ed5c42.css +0 -3
  276. package/dist/.next/.next/static/css/cf41da7a0d47f779.css +0 -3
  277. package/dist/.next/.next/static/gc8l1G6KXOeLLOM7VJip6/_buildManifest.js +0 -1
  278. package/dist/.next/.next/static/gc8l1G6KXOeLLOM7VJip6/_ssgManifest.js +0 -1
  279. package/dist/.next/.next/static/kYsJoni86CJWDuTkc1xU6/_buildManifest.js +0 -1
  280. package/dist/.next/.next/static/kYsJoni86CJWDuTkc1xU6/_ssgManifest.js +0 -1
  281. package/dist/.next/.next/static/scC5qwQC9H7rR1groM0Q-/_buildManifest.js +0 -1
  282. package/dist/.next/.next/static/scC5qwQC9H7rR1groM0Q-/_ssgManifest.js +0 -1
  283. package/dist/.next/.next/static/tEHOI_-t-iqfJClNzuo9m/_buildManifest.js +0 -1
  284. package/dist/.next/.next/static/tEHOI_-t-iqfJClNzuo9m/_ssgManifest.js +0 -1
  285. package/dist/.next/.next/static/vin2VQs5pM_dH2e2_I7AN/_buildManifest.js +0 -1
  286. package/dist/.next/.next/static/vin2VQs5pM_dH2e2_I7AN/_ssgManifest.js +0 -1
  287. package/dist/.next/.next/static/wHKwQhaxin5_i06GFVDHb/_buildManifest.js +0 -1
  288. package/dist/.next/.next/static/wHKwQhaxin5_i06GFVDHb/_ssgManifest.js +0 -1
  289. package/dist/.next/.next/static/xW4MspD8XibrhXDi_q2IO/_buildManifest.js +0 -1
  290. package/dist/.next/.next/static/xW4MspD8XibrhXDi_q2IO/_ssgManifest.js +0 -1
  291. package/dist/.next/server/chunks/686.js +0 -23
  292. package/dist/.next/server/chunks/801.js +0 -55
  293. package/dist/.next/static/ZwNOdZJ0LOtE0AJMNWwzY/_buildManifest.js +0 -1
  294. package/dist/.next/static/ZwNOdZJ0LOtE0AJMNWwzY/_ssgManifest.js +0 -1
  295. package/dist/.next/static/chunks/422-6fa3c14fc64ad67b.js +0 -1
  296. package/dist/.next/static/chunks/app/api/cloudflare/route-3458d78022185d7f.js +0 -1
  297. package/dist/.next/static/chunks/app/api/databases/route-64255424877a9f72.js +0 -1
  298. package/dist/.next/static/chunks/app/api/migrations/sync/route-03766b3afcf043ba.js +0 -1
  299. package/dist/.next/static/chunks/app/api/migrations/sync-files/route-02fa291c8000dadf.js +0 -1
  300. package/dist/.next/static/chunks/app/api/pull-remote/confirm/route-7e05bb8920127abe.js +0 -1
  301. package/dist/.next/static/chunks/app/api/pull-remote/preview/route-0fa15f783e8a306c.js +0 -1
  302. package/dist/.next/static/chunks/app/api/push-remote/confirm/route-96691f1880e4ed14.js +0 -1
  303. package/dist/.next/static/chunks/app/api/push-remote/preview/route-a798679c67374552.js +0 -1
  304. package/dist/.next/static/chunks/app/api/query/route-e90d0030a5083e20.js +0 -1
  305. package/dist/.next/static/chunks/app/api/tables/[name]/route-1efe63e73b480e58.js +0 -1
  306. package/dist/.next/static/chunks/app/api/tables/route-3772b4f480c4b4a4.js +0 -1
  307. package/dist/.next/static/chunks/app/page-79049bfa6cc07e11.js +0 -1
  308. package/dist/.next/static/css/cf41da7a0d47f779.css +0 -3
  309. /package/dist/.next/.next/static/{IWRJZhjf8U8mjzz4h0VNE → 7XBqETNmhSxMXhw8iUpEa}/_ssgManifest.js +0 -0
  310. /package/dist/.next/{.next/static/JrwgdSDcipr0Zh7k19Cj_ → static/MoZBULXFiTFzrY1JVK_Df}/_ssgManifest.js +0 -0
@@ -1 +1,26 @@
1
- "use strict";(()=>{var e={};e.id=223,e.ids=[223],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},99556:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>R,routeModule:()=>A,serverHooks:()=>b,workAsyncStorage:()=>h,workUnitAsyncStorage:()=>y});var i={};t.r(i),t.d(i,{OPTIONS:()=>x,POST:()=>w});var a=t(42706),o=t(28203),s=t(45994),n=t(39187),u=t(79748),l=t(33873),p=t(65949),d=t(19421),g=t(44218),c=t(30961),m=t(81804);async function f(e,r,t,i){let a={...process.env,CLOUDFLARE_API_TOKEN:t,CLOUDFLARE_ACCOUNT_ID:r};try{let r=l.join(e,"migrations"),t=l.join(e,"migrations-temp");await (0,u.mkdir)(r,{recursive:!0}),await (0,u.mkdir)(t,{recursive:!0});let o=await (0,u.readdir)(t).catch(()=>[]);await Promise.all(o.map(e=>(0,u.unlink)(l.join(t,e)))),m.A.debug("Fetching remote migration metadata...");let s=await (0,c.GS)(e,i,a);m.A.debug("Remote migration metadata:",s),m.A.debug("Fetching migration file content from remote...");let n=new Map;for(let r of s)try{let o=r.name,s=await (0,d.sP)(e,i,o,a);n.set(o,s),m.A.debug(`Staged migration file: ${o}`),await (0,u.writeFile)(l.join(t,o),s,"utf8")}catch(e){throw m.A.error(`Error fetching content for migration ${r.name}:`,e),Error(`Failed to fetch migration file content for ${r.name}`)}m.A.debug("Fetching local schema for destructive update...");let p=await (0,g.ZX)(e,i,a,!1),f=p.filter(e=>"table"===e.type&&e.name&&"if"!==e.name.toLowerCase());m.A.debug("Local table schema:",f);let w=f.length>0?(0,g.IC)(f.map(e=>({tableName:e.name,sql:e.sql,type:e.type}))):[];m.A.debug("Computed drop order:",w),m.A.debug("Beginning destructive update...");try{for(let r of(m.A.debug("Disabling foreign keys..."),await (0,d.KK)(e,i,"PRAGMA foreign_keys=OFF;",a,!1),p.filter(e=>"trigger"===e.type)))m.A.debug(`Dropping trigger: ${r.name}`),await (0,d.KK)(e,i,(0,d.z6)(`DROP TRIGGER IF EXISTS ${r.name}`),a,!1);for(let r of p.filter(e=>"index"===e.type))m.A.debug(`Dropping index: ${r.name}`),await (0,d.KK)(e,i,(0,d.z6)(`DROP INDEX IF EXISTS ${r.name}`),a,!1);for(let r of w.reverse())m.A.debug(`Dropping table: ${r}`),await (0,d.KK)(e,i,(0,d.z6)(`DROP TABLE IF EXISTS ${r}`),a,!1);m.A.debug("Re-enabling foreign keys..."),await (0,d.KK)(e,i,"PRAGMA foreign_keys=ON;",a,!1)}catch(e){throw Error(`Error dropping existing objects: ${e.message}`)}try{m.A.debug("Resetting local migrations table..."),await (0,c.k0)(e,i,"local",!0)}catch(e){throw Error(`Error resetting migrations table: ${e.message}`)}let x={preview:[]},A="";try{for(let[t,o]of n.entries()){A=t,m.A.debug(`Applying migration: ${t}`),await (0,u.writeFile)(l.join(r,t),o,"utf8");let s=require("crypto").createHash("sha256").update(o).digest("hex");m.A.debug(`Recording migration: ${t} with checksum ${s}`),await (0,c.CM)(e,i,{name:t,checksum:s},a,!1),await (0,d.KK)(e,i,o,a,!1),x.preview.push({migration:t,action:"applied"})}}catch(e){throw Error(`Error applying migration ${A}: ${e.message}`)}m.A.debug("Replacing main migrations folder with staged files...");let h=await (0,u.readdir)(r).catch(()=>[]);if(h.length)for(let e of h)m.A.debug(`Deleting local migration file: ${e}`),await (0,u.unlink)(l.join(r,e));for(let[e,t]of n.entries())m.A.debug(`Copying staged file ${e} to main migrations folder`),await (0,u.writeFile)(l.join(r,e),t,"utf8");return m.A.debug("Pull migration applied successfully."),{appliedMigrations:Array.from(n.keys()),details:x}}catch(e){throw m.A.error("Pull migration error:",e),e}}async function w(e){try{let{accountId:r,apiToken:t}=await e.json(),i=process.env.D1_PROJECT_DIR;if(!i)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let a=await (0,p.S)(i);if(!a||!a.config)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let o=a.config;if(!o.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let s=o.d1_databases[0].database_name,u=await f(i,r,t,s);return n.NextResponse.json({success:!0,message:"Pull migrations applied successfully",details:u})}catch(e){return m.A.error("Pull remote confirm error:",e),n.NextResponse.json({success:!1,error:{type:e.type||d.wU.EXECUTION_ERROR,message:e.message||"Failed to apply pull migrations",details:e.details||{suggestions:["Check your Cloudflare credentials","Verify database permissions","Ensure all migration files are accessible"]}}},{status:500})}}async function x(){return new n.NextResponse(null,{status:204})}let A=new a.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/pull-remote/confirm/route",pathname:"/api/pull-remote/confirm",filename:"route",bundlePath:"app/api/pull-remote/confirm/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/confirm/route.js",nextConfigOutput:"",userland:i}),{workAsyncStorage:h,workUnitAsyncStorage:y,serverHooks:b}=A;function R(){return(0,s.patchFetch)({workAsyncStorage:h,workUnitAsyncStorage:y})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),i=r.X(0,[638,452,391,801],()=>t(99556));module.exports=i})();
1
+ "use strict";(()=>{var e={};e.id=223,e.ids=[223],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},99556:(e,t,r)=>{r.r(t),r.d(t,{patchFetch:()=>A,routeModule:()=>h,serverHooks:()=>T,workAsyncStorage:()=>R,workUnitAsyncStorage:()=>y});var a={};r.r(a),r.d(a,{OPTIONS:()=>w,POST:()=>E});var i=r(42706),o=r(28203),s=r(45994),n=r(39187),l=r(79748),c=r(33873),p=r(65949),d=r(19421),u=r(44218),g=r(83159),m=r(81804);async function f(e,t,r,a){let i={...process.env,CLOUDFLARE_API_TOKEN:r,CLOUDFLARE_ACCOUNT_ID:t};try{let t=c.join(e,"migrations"),r=c.join(e,"migrations-temp");await (0,l.mkdir)(t,{recursive:!0}),await (0,l.mkdir)(r,{recursive:!0});let o=await (0,l.readdir)(r).catch(()=>[]);await Promise.all(o.map(e=>(0,l.unlink)(c.join(r,e)))),m.A.debug("Fetching remote migration metadata...");let s=await (0,g.GS)(e,a,i);m.A.debug("Remote migration metadata:",s),m.A.debug("Fetching migration file content from remote...");let n=new Map;for(let t of s)try{let o=t.name,s=await (0,d.sP)(e,a,o,i);n.set(o,s),m.A.debug(`Staged migration file: ${o}`),await (0,l.writeFile)(c.join(r,o),s,"utf8")}catch(e){throw m.A.error(`Error fetching content for migration ${t.name}:`,e),Error(`Failed to fetch migration file content for ${t.name}`)}m.A.debug("Fetching local schema for destructive update...");let p=await (0,u.ZX)(e,a,i,!1),f=p.filter(e=>"table"===e.type&&e.name&&"if"!==e.name.toLowerCase());m.A.debug("Local table schema:",f);let E=f.length>0?(0,u.IC)(f.map(e=>({tableName:e.name,sql:e.sql,type:e.type}))):[];m.A.debug("Computed drop order:",E),m.A.debug("Beginning destructive update...");try{for(let t of(m.A.debug("Disabling foreign keys..."),await (0,d.KK)(e,a,"PRAGMA foreign_keys=OFF;",i,!1),p.filter(e=>"trigger"===e.type)))m.A.debug(`Dropping trigger: ${t.name}`),await (0,d.KK)(e,a,(0,d.z6)(`DROP TRIGGER IF EXISTS ${t.name}`),i,!1);for(let t of p.filter(e=>"index"===e.type))m.A.debug(`Dropping index: ${t.name}`),await (0,d.KK)(e,a,(0,d.z6)(`DROP INDEX IF EXISTS ${t.name}`),i,!1);for(let t of E.reverse())m.A.debug(`Dropping table: ${t}`),await (0,d.KK)(e,a,(0,d.z6)(`DROP TABLE IF EXISTS ${t}`),i,!1);m.A.debug("Re-enabling foreign keys..."),await (0,d.KK)(e,a,"PRAGMA foreign_keys=ON;",i,!1)}catch(e){throw Error(`Error dropping existing objects: ${e.message}`)}try{m.A.debug("Resetting local migrations table..."),await (0,g.k0)(e,a,"local",!0)}catch(e){throw Error(`Error resetting migrations table: ${e.message}`)}let w={preview:[]},h="";try{for(let[r,o]of n.entries()){h=r,m.A.debug(`Applying migration: ${r}`),await (0,l.writeFile)(c.join(t,r),o,"utf8");let s=require("crypto").createHash("sha256").update(o).digest("hex");m.A.debug(`Recording migration: ${r} with checksum ${s}`),await (0,g.CM)(e,a,{name:r,checksum:s},i,!1),await (0,d.KK)(e,a,o,i,!1),w.preview.push({migration:r,action:"applied"})}}catch(e){throw Error(`Error applying migration ${h}: ${e.message}`)}m.A.debug("Replacing main migrations folder with staged files...");let R=await (0,l.readdir)(t).catch(()=>[]);if(R.length)for(let e of R)m.A.debug(`Deleting local migration file: ${e}`),await (0,l.unlink)(c.join(t,e));for(let[e,r]of n.entries())m.A.debug(`Copying staged file ${e} to main migrations folder`),await (0,l.writeFile)(c.join(t,e),r,"utf8");return m.A.debug("Pull migration applied successfully."),{appliedMigrations:Array.from(n.keys()),details:w}}catch(e){throw m.A.error("Pull migration error:",e),e}}async function E(e){try{let{accountId:t,apiToken:r}=await e.json(),a=process.env.D1_PROJECT_DIR;if(!a)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let i=await (0,p.S)(a);if(!i||!i.config)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let o=i.config;if(!o.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let s=o.d1_databases[0].database_name,l=await f(a,t,r,s);return n.NextResponse.json({success:!0,message:"Pull migrations applied successfully",details:l})}catch(e){return m.A.error("Pull remote confirm error:",e),n.NextResponse.json({success:!1,error:{type:e.type||d.wU.EXECUTION_ERROR,message:e.message||"Failed to apply pull migrations",details:e.details||{suggestions:["Check your Cloudflare credentials","Verify database permissions","Ensure all migration files are accessible"]}}},{status:500})}}async function w(){return new n.NextResponse(null,{status:204})}let h=new i.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/pull-remote/confirm/route",pathname:"/api/pull-remote/confirm",filename:"route",bundlePath:"app/api/pull-remote/confirm/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/confirm/route.js",nextConfigOutput:"",userland:a}),{workAsyncStorage:R,workUnitAsyncStorage:y,serverHooks:T}=h;function A(){return(0,s.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:y})}},83159:(e,t,r)=>{r.d(t,{hI:()=>h,Sl:()=>R,GS:()=>f,Gc:()=>y,k0:()=>u,CM:()=>w,ai:()=>E,JD:()=>m});var a=r(79748),i=r(28354),o=r(79646);let s=require("crypto");var n=r(33873),l=r(19421),c=r(44218),p=r(81804);let d=(0,i.promisify)(o.exec);async function u(e,t,r="local",a=!1){let i="remote"===r?"--remote":"--local",o="remote"===r?`
2
+ CREATE TABLE IF NOT EXISTS d1_migrations (
3
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
4
+ name TEXT NOT NULL UNIQUE,
5
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
6
+ );
7
+ `:`
8
+ CREATE TABLE IF NOT EXISTS d1_migrations (
9
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
10
+ name TEXT NOT NULL UNIQUE,
11
+ checksum TEXT NULL,
12
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
13
+ );
14
+ `;try{await d(`wrangler d1 execute ${t} ${i} --command="${o.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await d(`wrangler d1 execute ${t} ${i} --command="${"DELETE FROM d1_migrations;".replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw p.A.error(`Failed to initialize migrations table in ${r}:`,e),e}}function g(e){let t=new Date().toISOString().replace(/[^0-9]/g,"").slice(0,-3),r=e.type.toLowerCase().replace(/_/g,"-");if("CREATE_INDEX"===e.type){let r=e.description.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"");return`${t}_create-index_${r}.sql`}{let a=`${t}_${{"create-table":"create-table","alter-table":"alter-table","drop-table":"drop-table","drop-index":"drop-index","create-view":"create-view","drop-view":"drop-view","add-foreign-key":"add-foreign-key","drop-foreign-key":"drop-foreign-key","add-constraint":"add-constraint","drop-constraint":"drop-constraint"}[r]||r}_${e.tableName}`;return"ALTER_TABLE"===e.type&&e.description&&(a+=`_${e.description}`),(a=a.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,""))+".sql"}}async function m(e){let t=await (0,a.readFile)(e,"utf8");try{let e=(0,l.By)(t);return(0,l.Gq)(e),{isValid:!0,statement:e}}catch(e){return{isValid:!1,errors:e}}}async function f(e,t,r){try{let a=await (0,l.KK)(e,t,"SELECT name, applied_at FROM d1_migrations ORDER BY applied_at;",r,!0);if("string"==typeof a){let e=a.indexOf("[");if(-1!==e){let t=a.substring(e),r=JSON.parse(t);return r[0]?.results||[]}}return[]}catch(e){throw{type:l.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e.message,suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function E(e,t,{name:r,checksum:a},i="local"){let o="remote"===i?"--remote":"--local";if("local"===i&&a)try{await d(`wrangler d1 execute ${t} ${o} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await d(`wrangler d1 execute ${t} ${o} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let s="remote"!==i&&a?`
15
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
16
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
17
+ `:`
18
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
19
+ VALUES ('${r}', CURRENT_TIMESTAMP);
20
+ `;try{await d(`wrangler d1 execute ${t} ${o} --command="${s.replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw p.A.error("Failed to track migration:",e),e}}async function w(e,t,{name:r,checksum:a},i={},o=!1){let s=o||!a?`
21
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
22
+ VALUES ('${r}', CURRENT_TIMESTAMP);
23
+ `:`
24
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
25
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
26
+ `;try{await (0,l.KK)(e,t,s,i,o)}catch(e){throw{type:l.wU.EXECUTION_ERROR,message:`Failed to record migration ${r}`,details:{file:r,error:e.message,suggestions:["Check if migration is already recorded"]}}}}async function h(e,t){try{let r=await f(e,t,{}),a=new Map(r.map(e=>[e.name,e]));return{applied:Array.from(a.keys()),count:a.size}}catch(e){throw p.A.error("Failed to compare migrations:",e),e}}function R(e){return(0,s.createHash)("sha256").update(e).digest("hex")}async function y(e,t,r){try{let i=n.join(e,"migrations");await (0,a.mkdir)(i,{recursive:!0});let o=[],s=[],p=[];for(let e of r)e.type===l.Pg.DATA_MODIFICATION?p.push(e):s.push(e);let d=new Map,u="__no_table__";for(let e of s){let t=e.tableName?e.tableName.toLowerCase():u;d.has(t)||d.set(t,[]),d.get(t).push(e)}let m=[...d.keys()].filter(e=>e!==u),f=[];if(m.length>0){let e=m.map(e=>d.get(e)[0]);f=(0,c.IC)(e)}for(let r of f){for(let s of d.get(r)||[])try{if(s.type===l.Pg.DROP_TABLE&&!await (0,l.F9)(e,t,{},s.tableName,!1))throw Error(`no such table: ${s.tableName}`);let r=await (0,l.KK)(e,t,s.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let c=g(s),p=n.join(i,c),d=(0,l.tn)(s.sql);await (0,a.writeFile)(p,d,"utf8");let u=R(s.sql);await E(e,t,{name:c,checksum:u},"local"),o.push({type:s.type,table:s.tableName,migration:c,checksum:u})}catch(e){throw e}d.delete(r)}if(d.has(u))for(let r of d.get(u))try{await (0,l.KK)(e,t,r.sql);let s=g(r),c=n.join(i,s),p=(0,l.tn)(r.sql);await (0,a.writeFile)(c,p,"utf8");let d=R(r.sql);await E(e,t,{name:s,checksum:d},"local"),o.push({type:r.type,table:r.tableName||null,migration:s,checksum:d})}catch(e){throw e}for(let r of p)try{await (0,l.KK)(e,t,r.sql),o.push({type:r.type,table:r.tableName||null,executed:!0})}catch(e){throw e}return o}catch(e){throw e}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[638,452,391,226],()=>r(99556));module.exports=a})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../chunks/801.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/226.js","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/pull-remote/confirm/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"57174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"87190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"33875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"88903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"84178","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"56053","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"52652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"61365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"66959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/page.jsx":{"id":5612,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","958","static/chunks/958-98887928efebfdf7.js","735","static/chunks/735-c9144179c6bd7d06.js","974","static/chunks/app/page-2c28a255a4ecd8d4.js"],"async":false}},"entryCSSFiles":{"/Users/karenredona/Desktop/d1studio/src/":[],"/Users/karenredona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/4957328384ed5c42.css"}],"/Users/karenredona/Desktop/d1studio/src/app/page":[],"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/confirm/route":[]},"rscModuleMapping":{"33":{"*":{"id":"91831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"40802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"48530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"34863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"25155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"46487","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"13164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"88921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"13219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/pull-remote/confirm/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"57174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"87190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"33875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"88903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"84178","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"93158","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"52652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"61365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"66959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/page.jsx":{"id":5612,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","176","static/chunks/176-9146975ef8699719.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-5990cb23b8bd27c4.js"],"async":false}},"entryCSSFiles":{"/Users/karenredona/Desktop/d1studio/src/":[],"/Users/karenredona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/674bee6608c638e4.css"}],"/Users/karenredona/Desktop/d1studio/src/app/page":[],"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/confirm/route":[]},"rscModuleMapping":{"33":{"*":{"id":"91831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"40802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"48530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"34863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"25155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"46487","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"13164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"88921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"13219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -1 +1,26 @@
1
- "use strict";(()=>{var e={};e.id=399,e.ids=[399],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},66216:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>q,routeModule:()=>w,serverHooks:()=>f,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>R});var s={};t.r(s),t.d(s,{OPTIONS:()=>m,POST:()=>g});var o=t(42706),a=t(28203),n=t(45994),i=t(39187),p=t(65949),u=t(19421),l=t(44218),d=t(30961),c=t(81804);async function x(e,r,t,s){let o={...process.env,CLOUDFLARE_API_TOKEN:t,CLOUDFLARE_ACCOUNT_ID:r};try{let r=await (0,l.ZX)(e,s,o,!0),t=await (0,d.GS)(e,s,o),a=(0,l.IC)(r),n={preview:[],totalTables:r.length,totalMigrations:t.length};return a.forEach((e,t)=>{r.find(r=>r.name===e)&&n.preview.push({name:e,type:"table",action:"will be created",order:t+1})}),t.forEach(e=>{n.preview.push({name:e.name,type:"migration",action:"will be tracked"})}),n}catch(e){throw c.A.error("Pull preview generation error:",e),e}}async function g(e){try{let{accountId:r,apiToken:t}=await e.json(),s=process.env.D1_PROJECT_DIR;if(!s)return i.NextResponse.json({success:!1,error:{type:u.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let o=await (0,p.S)(s);if(!o||!o.config)return i.NextResponse.json({success:!1,error:{type:u.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let a=o.config;if(!a.d1_databases?.length)return i.NextResponse.json({success:!1,error:{type:u.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let n=a.d1_databases[0].database_name,l=await x(s,r,t,n);return i.NextResponse.json({success:!0,message:"Pull migration preview generated",details:l})}catch(e){return c.A.error("Pull remote preview error:",e),i.NextResponse.json({success:!1,error:{type:e.type||u.wU.EXECUTION_ERROR,message:e.message||"Failed to generate pull migration preview",details:e.details}},{status:500})}}async function m(){return new i.NextResponse(null,{status:204})}let w=new o.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/pull-remote/preview/route",pathname:"/api/pull-remote/preview",filename:"route",bundlePath:"app/api/pull-remote/preview/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/preview/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:v,workUnitAsyncStorage:R,serverHooks:f}=w;function q(){return(0,n.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:R})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,452,391,801],()=>t(66216));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=399,e.ids=[399],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},66216:(e,t,r)=>{r.r(t),r.d(t,{patchFetch:()=>h,routeModule:()=>w,serverHooks:()=>f,workAsyncStorage:()=>T,workUnitAsyncStorage:()=>R});var a={};r.r(a),r.d(a,{OPTIONS:()=>g,POST:()=>E});var o=r(42706),i=r(28203),s=r(45994),n=r(39187),l=r(65949),c=r(19421),p=r(44218),d=r(83159),u=r(81804);async function m(e,t,r,a){let o={...process.env,CLOUDFLARE_API_TOKEN:r,CLOUDFLARE_ACCOUNT_ID:t};try{let t=await (0,p.ZX)(e,a,o,!0),r=await (0,d.GS)(e,a,o),i=(0,p.IC)(t),s={preview:[],totalTables:t.length,totalMigrations:r.length};return i.forEach((e,r)=>{t.find(t=>t.name===e)&&s.preview.push({name:e,type:"table",action:"will be created",order:r+1})}),r.forEach(e=>{s.preview.push({name:e.name,type:"migration",action:"will be tracked"})}),s}catch(e){throw u.A.error("Pull preview generation error:",e),e}}async function E(e){try{let{accountId:t,apiToken:r}=await e.json(),a=process.env.D1_PROJECT_DIR;if(!a)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let o=await (0,l.S)(a);if(!o||!o.config)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let i=o.config;if(!i.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let s=i.d1_databases[0].database_name,p=await m(a,t,r,s);return n.NextResponse.json({success:!0,message:"Pull migration preview generated",details:p})}catch(e){return u.A.error("Pull remote preview error:",e),n.NextResponse.json({success:!1,error:{type:e.type||c.wU.EXECUTION_ERROR,message:e.message||"Failed to generate pull migration preview",details:e.details}},{status:500})}}async function g(){return new n.NextResponse(null,{status:204})}let w=new o.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/pull-remote/preview/route",pathname:"/api/pull-remote/preview",filename:"route",bundlePath:"app/api/pull-remote/preview/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/preview/route.js",nextConfigOutput:"",userland:a}),{workAsyncStorage:T,workUnitAsyncStorage:R,serverHooks:f}=w;function h(){return(0,s.patchFetch)({workAsyncStorage:T,workUnitAsyncStorage:R})}},83159:(e,t,r)=>{r.d(t,{hI:()=>R,Sl:()=>f,GS:()=>g,Gc:()=>h,k0:()=>u,CM:()=>T,ai:()=>w,JD:()=>E});var a=r(79748),o=r(28354),i=r(79646);let s=require("crypto");var n=r(33873),l=r(19421),c=r(44218),p=r(81804);let d=(0,o.promisify)(i.exec);async function u(e,t,r="local",a=!1){let o="remote"===r?"--remote":"--local",i="remote"===r?`
2
+ CREATE TABLE IF NOT EXISTS d1_migrations (
3
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
4
+ name TEXT NOT NULL UNIQUE,
5
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
6
+ );
7
+ `:`
8
+ CREATE TABLE IF NOT EXISTS d1_migrations (
9
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
10
+ name TEXT NOT NULL UNIQUE,
11
+ checksum TEXT NULL,
12
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
13
+ );
14
+ `;try{await d(`wrangler d1 execute ${t} ${o} --command="${i.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await d(`wrangler d1 execute ${t} ${o} --command="${"DELETE FROM d1_migrations;".replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw p.A.error(`Failed to initialize migrations table in ${r}:`,e),e}}function m(e){let t=new Date().toISOString().replace(/[^0-9]/g,"").slice(0,-3),r=e.type.toLowerCase().replace(/_/g,"-");if("CREATE_INDEX"===e.type){let r=e.description.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"");return`${t}_create-index_${r}.sql`}{let a=`${t}_${{"create-table":"create-table","alter-table":"alter-table","drop-table":"drop-table","drop-index":"drop-index","create-view":"create-view","drop-view":"drop-view","add-foreign-key":"add-foreign-key","drop-foreign-key":"drop-foreign-key","add-constraint":"add-constraint","drop-constraint":"drop-constraint"}[r]||r}_${e.tableName}`;return"ALTER_TABLE"===e.type&&e.description&&(a+=`_${e.description}`),(a=a.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,""))+".sql"}}async function E(e){let t=await (0,a.readFile)(e,"utf8");try{let e=(0,l.By)(t);return(0,l.Gq)(e),{isValid:!0,statement:e}}catch(e){return{isValid:!1,errors:e}}}async function g(e,t,r){try{let a=await (0,l.KK)(e,t,"SELECT name, applied_at FROM d1_migrations ORDER BY applied_at;",r,!0);if("string"==typeof a){let e=a.indexOf("[");if(-1!==e){let t=a.substring(e),r=JSON.parse(t);return r[0]?.results||[]}}return[]}catch(e){throw{type:l.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e.message,suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function w(e,t,{name:r,checksum:a},o="local"){let i="remote"===o?"--remote":"--local";if("local"===o&&a)try{await d(`wrangler d1 execute ${t} ${i} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await d(`wrangler d1 execute ${t} ${i} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let s="remote"!==o&&a?`
15
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
16
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
17
+ `:`
18
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
19
+ VALUES ('${r}', CURRENT_TIMESTAMP);
20
+ `;try{await d(`wrangler d1 execute ${t} ${i} --command="${s.replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw p.A.error("Failed to track migration:",e),e}}async function T(e,t,{name:r,checksum:a},o={},i=!1){let s=i||!a?`
21
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
22
+ VALUES ('${r}', CURRENT_TIMESTAMP);
23
+ `:`
24
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
25
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
26
+ `;try{await (0,l.KK)(e,t,s,o,i)}catch(e){throw{type:l.wU.EXECUTION_ERROR,message:`Failed to record migration ${r}`,details:{file:r,error:e.message,suggestions:["Check if migration is already recorded"]}}}}async function R(e,t){try{let r=await g(e,t,{}),a=new Map(r.map(e=>[e.name,e]));return{applied:Array.from(a.keys()),count:a.size}}catch(e){throw p.A.error("Failed to compare migrations:",e),e}}function f(e){return(0,s.createHash)("sha256").update(e).digest("hex")}async function h(e,t,r){try{let o=n.join(e,"migrations");await (0,a.mkdir)(o,{recursive:!0});let i=[],s=[],p=[];for(let e of r)e.type===l.Pg.DATA_MODIFICATION?p.push(e):s.push(e);let d=new Map,u="__no_table__";for(let e of s){let t=e.tableName?e.tableName.toLowerCase():u;d.has(t)||d.set(t,[]),d.get(t).push(e)}let E=[...d.keys()].filter(e=>e!==u),g=[];if(E.length>0){let e=E.map(e=>d.get(e)[0]);g=(0,c.IC)(e)}for(let r of g){for(let s of d.get(r)||[])try{if(s.type===l.Pg.DROP_TABLE&&!await (0,l.F9)(e,t,{},s.tableName,!1))throw Error(`no such table: ${s.tableName}`);let r=await (0,l.KK)(e,t,s.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let c=m(s),p=n.join(o,c),d=(0,l.tn)(s.sql);await (0,a.writeFile)(p,d,"utf8");let u=f(s.sql);await w(e,t,{name:c,checksum:u},"local"),i.push({type:s.type,table:s.tableName,migration:c,checksum:u})}catch(e){throw e}d.delete(r)}if(d.has(u))for(let r of d.get(u))try{await (0,l.KK)(e,t,r.sql);let s=m(r),c=n.join(o,s),p=(0,l.tn)(r.sql);await (0,a.writeFile)(c,p,"utf8");let d=f(r.sql);await w(e,t,{name:s,checksum:d},"local"),i.push({type:r.type,table:r.tableName||null,migration:s,checksum:d})}catch(e){throw e}for(let r of p)try{await (0,l.KK)(e,t,r.sql),i.push({type:r.type,table:r.tableName||null,executed:!0})}catch(e){throw e}return i}catch(e){throw e}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[638,452,391,226],()=>r(66216));module.exports=a})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../chunks/801.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/226.js","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/pull-remote/preview/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"57174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"87190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"33875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"88903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"84178","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"56053","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"52652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"61365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"66959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/page.jsx":{"id":5612,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","958","static/chunks/958-98887928efebfdf7.js","735","static/chunks/735-c9144179c6bd7d06.js","974","static/chunks/app/page-2c28a255a4ecd8d4.js"],"async":false}},"entryCSSFiles":{"/Users/karenredona/Desktop/d1studio/src/":[],"/Users/karenredona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/4957328384ed5c42.css"}],"/Users/karenredona/Desktop/d1studio/src/app/page":[],"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/preview/route":[]},"rscModuleMapping":{"33":{"*":{"id":"91831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"40802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"48530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"34863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"25155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"46487","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"13164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"88921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"13219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/pull-remote/preview/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"57174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"87190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"33875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"88903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"84178","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"93158","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"52652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"61365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"66959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/page.jsx":{"id":5612,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","176","static/chunks/176-9146975ef8699719.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-5990cb23b8bd27c4.js"],"async":false}},"entryCSSFiles":{"/Users/karenredona/Desktop/d1studio/src/":[],"/Users/karenredona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/674bee6608c638e4.css"}],"/Users/karenredona/Desktop/d1studio/src/app/page":[],"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/preview/route":[]},"rscModuleMapping":{"33":{"*":{"id":"91831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"40802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"48530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"34863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"25155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"46487","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"13164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"88921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"13219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -1,14 +1,39 @@
1
- "use strict";(()=>{var e={};e.id=680,e.ids=[680],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},47628:(e,r,s)=>{s.r(r),s.d(r,{patchFetch:()=>f,routeModule:()=>R,serverHooks:()=>g,workAsyncStorage:()=>x,workUnitAsyncStorage:()=>h});var t={};s.r(t),s.d(t,{OPTIONS:()=>T,POST:()=>E});var a=s(42706),i=s(28203),o=s(45994),n=s(39187),p=s(79748),u=s(33873),d=s(65949),l=s(19421),c=s(30961);async function m(e,r,s,t,a=!1){let i={...process.env,CLOUDFLARE_ACCOUNT_ID:r,CLOUDFLARE_API_TOKEN:s};try{let r=`
1
+ "use strict";(()=>{var e={};e.id=680,e.ids=[680],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},47628:(e,t,r)=>{r.r(t),r.d(t,{patchFetch:()=>f,routeModule:()=>R,serverHooks:()=>h,workAsyncStorage:()=>g,workUnitAsyncStorage:()=>w});var a={};r.r(a),r.d(a,{OPTIONS:()=>T,POST:()=>m});var s=r(42706),i=r(28203),o=r(45994),n=r(39187),p=r(79748),l=r(33873),d=r(65949),c=r(19421),u=r(83159);async function E(e,t,r,a,s=!1){let i={...process.env,CLOUDFLARE_ACCOUNT_ID:t,CLOUDFLARE_API_TOKEN:r};try{let t=`
2
2
  CREATE TABLE IF NOT EXISTS d1_migrations (
3
3
  id INTEGER PRIMARY KEY AUTOINCREMENT,
4
4
  name TEXT NOT NULL UNIQUE,
5
5
  checksum TEXT NOT NULL,
6
6
  applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
7
7
  );
8
- `,s=`
8
+ `,r=`
9
9
  CREATE TABLE IF NOT EXISTS d1_migrations (
10
10
  id INTEGER PRIMARY KEY AUTOINCREMENT,
11
11
  name TEXT NOT NULL UNIQUE,
12
12
  applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
13
13
  );
14
- `;await (0,l.KK)(e,t,r),await (0,l.KK)(e,t,s,i,!0);let o=await (0,l.KK)(e,t,"SELECT name FROM d1_migrations ORDER BY applied_at;",i,!0),n=new Map((e=>{try{let r=JSON.parse(e);return r[0]?.results||[]}catch{return[]}})(o).map(e=>[e.name,e])),d=u.join(e,"migrations"),m=(await (0,p.readdir)(d)).filter(e=>e.endsWith(".sql")).sort(),E={applied:[],skipped:[],preview:[]};for(let r of m){let s=u.join(d,r),o={name:r,action:"",reason:""};try{if(!(await (0,c.JD)(s)).isValid){o.action="failed validation",o.reason="Migration validation failed",E.preview.push(o);continue}if(n.has(r)){o.action="skipped",o.reason="Already applied",E.preview.push(o),E.skipped.push({name:r,reason:o.reason});continue}let u=await (0,p.readFile)(s,"utf8");u=(0,l.bp)(u);let d=(0,l.By)(u),m=d.tableName;if("CREATE_TABLE"===d.type&&m&&await (0,l.F9)(e,t,i,m,!0)){o.action="skipped",o.reason=`Table "${m}" already exists`,E.skipped.push({name:r,reason:o.reason}),E.preview.push(o);continue}o.action="will be applied",E.preview.push(o),a||(await (0,l.KK)(e,t,u,i,!0),await (0,l.KK)(e,t,`INSERT INTO d1_migrations (name) VALUES ('${r}');`,i,!0),o.action="applied",E.applied.push({name:r}))}catch(t){let e=t.message||"",s=t.details&&t.details.stderr||"";e.includes("already exists")||s.includes("already exists")?(o.action="skipped",o.reason="Already applied"):(o.action="failed",o.reason=e||"Failed to apply migration"),E.skipped.push({name:r,reason:o.reason}),E.preview.push(o)}}return{success:!0,preview:!1,applied:E.applied.length,skipped:E.skipped.length,details:E}}catch(e){throw{type:l.wU.EXECUTION_ERROR,message:e.message||"Failed to push migrations",details:e.details||{error:e.stderr||e.message}}}}async function E(e){try{let{accountId:r,apiToken:s}=await e.json(),t=process.env.D1_PROJECT_DIR;if(!t)return n.NextResponse.json({success:!1,error:{message:"Project directory not configured",type:l.wU.VALIDATION_ERROR}},{status:500});let a=await (0,d.S)(t);if(!a||!a.config)return n.NextResponse.json({success:!1,error:{message:"Could not find Wrangler configuration",type:l.wU.VALIDATION_ERROR}},{status:400});let i=a.config;if(!i.d1_databases?.length)return n.NextResponse.json({success:!1,error:{message:"No D1 databases configured",type:l.wU.VALIDATION_ERROR}},{status:400});let o=i.d1_databases[0].database_name,p=await m(t,r,s,o,!1);return n.NextResponse.json({success:!0,message:"Successfully pushed migrations to remote",details:p})}catch(e){return console.error("Push to remote confirm error:",e),n.NextResponse.json({success:!1,error:{type:e.type||l.wU.EXECUTION_ERROR,message:e.message||"Failed to push to remote",details:e.details||{error:e.stderr||e.message}}},{status:e.type===l.wU.VALIDATION_ERROR?400:500})}}async function T(){return new n.NextResponse(null,{status:204})}let R=new a.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/push-remote/confirm/route",pathname:"/api/push-remote/confirm",filename:"route",bundlePath:"app/api/push-remote/confirm/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/confirm/route.js",nextConfigOutput:"",userland:t}),{workAsyncStorage:x,workUnitAsyncStorage:h,serverHooks:g}=R;function f(){return(0,o.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:h})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[638,452,391,801],()=>s(47628));module.exports=t})();
14
+ `;await (0,c.KK)(e,a,t),await (0,c.KK)(e,a,r,i,!0);let o=await (0,c.KK)(e,a,"SELECT name FROM d1_migrations ORDER BY applied_at;",i,!0),n=new Map((e=>{try{let t=JSON.parse(e);return t[0]?.results||[]}catch{return[]}})(o).map(e=>[e.name,e])),d=l.join(e,"migrations"),E=(await (0,p.readdir)(d)).filter(e=>e.endsWith(".sql")).sort(),m={applied:[],skipped:[],preview:[]};for(let t of E){let r=l.join(d,t),o={name:t,action:"",reason:""};try{if(!(await (0,u.JD)(r)).isValid){o.action="failed validation",o.reason="Migration validation failed",m.preview.push(o);continue}if(n.has(t)){o.action="skipped",o.reason="Already applied",m.preview.push(o),m.skipped.push({name:t,reason:o.reason});continue}let l=await (0,p.readFile)(r,"utf8");l=(0,c.bp)(l);let d=(0,c.By)(l),E=d.tableName;if("CREATE_TABLE"===d.type&&E&&await (0,c.F9)(e,a,i,E,!0)){o.action="skipped",o.reason=`Table "${E}" already exists`,m.skipped.push({name:t,reason:o.reason}),m.preview.push(o);continue}o.action="will be applied",m.preview.push(o),s||(await (0,c.KK)(e,a,l,i,!0),await (0,c.KK)(e,a,`INSERT INTO d1_migrations (name) VALUES ('${t}');`,i,!0),o.action="applied",m.applied.push({name:t}))}catch(a){let e=a.message||"",r=a.details&&a.details.stderr||"";e.includes("already exists")||r.includes("already exists")?(o.action="skipped",o.reason="Already applied"):(o.action="failed",o.reason=e||"Failed to apply migration"),m.skipped.push({name:t,reason:o.reason}),m.preview.push(o)}}return{success:!0,preview:!1,applied:m.applied.length,skipped:m.skipped.length,details:m}}catch(e){throw{type:c.wU.EXECUTION_ERROR,message:e.message||"Failed to push migrations",details:e.details||{error:e.stderr||e.message}}}}async function m(e){try{let{accountId:t,apiToken:r}=await e.json(),a=process.env.D1_PROJECT_DIR;if(!a)return n.NextResponse.json({success:!1,error:{message:"Project directory not configured",type:c.wU.VALIDATION_ERROR}},{status:500});let s=await (0,d.S)(a);if(!s||!s.config)return n.NextResponse.json({success:!1,error:{message:"Could not find Wrangler configuration",type:c.wU.VALIDATION_ERROR}},{status:400});let i=s.config;if(!i.d1_databases?.length)return n.NextResponse.json({success:!1,error:{message:"No D1 databases configured",type:c.wU.VALIDATION_ERROR}},{status:400});let o=i.d1_databases[0].database_name,p=await E(a,t,r,o,!1);return n.NextResponse.json({success:!0,message:"Successfully pushed migrations to remote",details:p})}catch(e){return console.error("Push to remote confirm error:",e),n.NextResponse.json({success:!1,error:{type:e.type||c.wU.EXECUTION_ERROR,message:e.message||"Failed to push to remote",details:e.details||{error:e.stderr||e.message}}},{status:e.type===c.wU.VALIDATION_ERROR?400:500})}}async function T(){return new n.NextResponse(null,{status:204})}let R=new s.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/push-remote/confirm/route",pathname:"/api/push-remote/confirm",filename:"route",bundlePath:"app/api/push-remote/confirm/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/confirm/route.js",nextConfigOutput:"",userland:a}),{workAsyncStorage:g,workUnitAsyncStorage:w,serverHooks:h}=R;function f(){return(0,o.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:w})}},83159:(e,t,r)=>{r.d(t,{hI:()=>w,Sl:()=>h,GS:()=>T,Gc:()=>f,k0:()=>u,CM:()=>g,ai:()=>R,JD:()=>m});var a=r(79748),s=r(28354),i=r(79646);let o=require("crypto");var n=r(33873),p=r(19421),l=r(44218),d=r(81804);let c=(0,s.promisify)(i.exec);async function u(e,t,r="local",a=!1){let s="remote"===r?"--remote":"--local",i="remote"===r?`
15
+ CREATE TABLE IF NOT EXISTS d1_migrations (
16
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
17
+ name TEXT NOT NULL UNIQUE,
18
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
19
+ );
20
+ `:`
21
+ CREATE TABLE IF NOT EXISTS d1_migrations (
22
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
23
+ name TEXT NOT NULL UNIQUE,
24
+ checksum TEXT NULL,
25
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
26
+ );
27
+ `;try{await c(`wrangler d1 execute ${t} ${s} --command="${i.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await c(`wrangler d1 execute ${t} ${s} --command="${"DELETE FROM d1_migrations;".replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw d.A.error(`Failed to initialize migrations table in ${r}:`,e),e}}function E(e){let t=new Date().toISOString().replace(/[^0-9]/g,"").slice(0,-3),r=e.type.toLowerCase().replace(/_/g,"-");if("CREATE_INDEX"===e.type){let r=e.description.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"");return`${t}_create-index_${r}.sql`}{let a=`${t}_${{"create-table":"create-table","alter-table":"alter-table","drop-table":"drop-table","drop-index":"drop-index","create-view":"create-view","drop-view":"drop-view","add-foreign-key":"add-foreign-key","drop-foreign-key":"drop-foreign-key","add-constraint":"add-constraint","drop-constraint":"drop-constraint"}[r]||r}_${e.tableName}`;return"ALTER_TABLE"===e.type&&e.description&&(a+=`_${e.description}`),(a=a.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,""))+".sql"}}async function m(e){let t=await (0,a.readFile)(e,"utf8");try{let e=(0,p.By)(t);return(0,p.Gq)(e),{isValid:!0,statement:e}}catch(e){return{isValid:!1,errors:e}}}async function T(e,t,r){try{let a=await (0,p.KK)(e,t,"SELECT name, applied_at FROM d1_migrations ORDER BY applied_at;",r,!0);if("string"==typeof a){let e=a.indexOf("[");if(-1!==e){let t=a.substring(e),r=JSON.parse(t);return r[0]?.results||[]}}return[]}catch(e){throw{type:p.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e.message,suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function R(e,t,{name:r,checksum:a},s="local"){let i="remote"===s?"--remote":"--local";if("local"===s&&a)try{await c(`wrangler d1 execute ${t} ${i} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await c(`wrangler d1 execute ${t} ${i} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let o="remote"!==s&&a?`
28
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
29
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
30
+ `:`
31
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
32
+ VALUES ('${r}', CURRENT_TIMESTAMP);
33
+ `;try{await c(`wrangler d1 execute ${t} ${i} --command="${o.replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw d.A.error("Failed to track migration:",e),e}}async function g(e,t,{name:r,checksum:a},s={},i=!1){let o=i||!a?`
34
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
35
+ VALUES ('${r}', CURRENT_TIMESTAMP);
36
+ `:`
37
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
38
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
39
+ `;try{await (0,p.KK)(e,t,o,s,i)}catch(e){throw{type:p.wU.EXECUTION_ERROR,message:`Failed to record migration ${r}`,details:{file:r,error:e.message,suggestions:["Check if migration is already recorded"]}}}}async function w(e,t){try{let r=await T(e,t,{}),a=new Map(r.map(e=>[e.name,e]));return{applied:Array.from(a.keys()),count:a.size}}catch(e){throw d.A.error("Failed to compare migrations:",e),e}}function h(e){return(0,o.createHash)("sha256").update(e).digest("hex")}async function f(e,t,r){try{let s=n.join(e,"migrations");await (0,a.mkdir)(s,{recursive:!0});let i=[],o=[],d=[];for(let e of r)e.type===p.Pg.DATA_MODIFICATION?d.push(e):o.push(e);let c=new Map,u="__no_table__";for(let e of o){let t=e.tableName?e.tableName.toLowerCase():u;c.has(t)||c.set(t,[]),c.get(t).push(e)}let m=[...c.keys()].filter(e=>e!==u),T=[];if(m.length>0){let e=m.map(e=>c.get(e)[0]);T=(0,l.IC)(e)}for(let r of T){for(let o of c.get(r)||[])try{if(o.type===p.Pg.DROP_TABLE&&!await (0,p.F9)(e,t,{},o.tableName,!1))throw Error(`no such table: ${o.tableName}`);let r=await (0,p.KK)(e,t,o.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let l=E(o),d=n.join(s,l),c=(0,p.tn)(o.sql);await (0,a.writeFile)(d,c,"utf8");let u=h(o.sql);await R(e,t,{name:l,checksum:u},"local"),i.push({type:o.type,table:o.tableName,migration:l,checksum:u})}catch(e){throw e}c.delete(r)}if(c.has(u))for(let r of c.get(u))try{await (0,p.KK)(e,t,r.sql);let o=E(r),l=n.join(s,o),d=(0,p.tn)(r.sql);await (0,a.writeFile)(l,d,"utf8");let c=h(r.sql);await R(e,t,{name:o,checksum:c},"local"),i.push({type:r.type,table:r.tableName||null,migration:o,checksum:c})}catch(e){throw e}for(let r of d)try{await (0,p.KK)(e,t,r.sql),i.push({type:r.type,table:r.tableName||null,executed:!0})}catch(e){throw e}return i}catch(e){throw e}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[638,452,391,226],()=>r(47628));module.exports=a})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../chunks/801.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/226.js","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/push-remote/confirm/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"57174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"87190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"33875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"88903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"84178","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"56053","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"52652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"61365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"66959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-c9144179c6bd7d06.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/page.jsx":{"id":5612,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","958","static/chunks/958-98887928efebfdf7.js","735","static/chunks/735-c9144179c6bd7d06.js","974","static/chunks/app/page-2c28a255a4ecd8d4.js"],"async":false}},"entryCSSFiles":{"/Users/karenredona/Desktop/d1studio/src/":[],"/Users/karenredona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/4957328384ed5c42.css"}],"/Users/karenredona/Desktop/d1studio/src/app/page":[],"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/confirm/route":[]},"rscModuleMapping":{"33":{"*":{"id":"91831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"40802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"48530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"34863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"25155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"46487","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"13164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"88921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"13219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/push-remote/confirm/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"57174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"87190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"33875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"88903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"84178","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"93158","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"52652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"61365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"66959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/page.jsx":{"id":5612,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","176","static/chunks/176-9146975ef8699719.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-5990cb23b8bd27c4.js"],"async":false}},"entryCSSFiles":{"/Users/karenredona/Desktop/d1studio/src/":[],"/Users/karenredona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/674bee6608c638e4.css"}],"/Users/karenredona/Desktop/d1studio/src/app/page":[],"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/confirm/route":[]},"rscModuleMapping":{"33":{"*":{"id":"91831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"40802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"48530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"34863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"25155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"46487","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"13164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"88921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"13219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -1,14 +1,39 @@
1
- "use strict";(()=>{var e={};e.id=868,e.ids=[868],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},19330:(e,r,s)=>{s.r(r),s.d(r,{patchFetch:()=>N,routeModule:()=>x,serverHooks:()=>w,workAsyncStorage:()=>g,workUnitAsyncStorage:()=>h});var t={};s.r(t),s.d(t,{OPTIONS:()=>m,POST:()=>T});var a=s(42706),i=s(28203),o=s(45994),p=s(39187),n=s(79748),u=s(33873),d=s(65949),c=s(19421),l=s(30961),E=s(81804);async function R(e,r,s,t,a=!0){let i={...process.env,CLOUDFLARE_ACCOUNT_ID:r,CLOUDFLARE_API_TOKEN:s};try{let r=`
1
+ "use strict";(()=>{var e={};e.id=868,e.ids=[868],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},79748:e=>{e.exports=require("fs/promises")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},73024:e=>{e.exports=require("node:fs")},76760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},73136:e=>{e.exports=require("node:url")},19330:(e,t,r)=>{r.r(t),r.d(t,{patchFetch:()=>f,routeModule:()=>g,serverHooks:()=>N,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>h});var a={};r.r(a),r.d(a,{OPTIONS:()=>R,POST:()=>m});var s=r(42706),i=r(28203),o=r(45994),n=r(39187),p=r(79748),l=r(33873),c=r(65949),d=r(19421),u=r(83159),E=r(81804);async function T(e,t,r,a,s=!0){let i={...process.env,CLOUDFLARE_ACCOUNT_ID:t,CLOUDFLARE_API_TOKEN:r};try{let t=`
2
2
  CREATE TABLE IF NOT EXISTS d1_migrations (
3
3
  id INTEGER PRIMARY KEY AUTOINCREMENT,
4
4
  name TEXT NOT NULL UNIQUE,
5
5
  checksum TEXT NOT NULL,
6
6
  applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
7
7
  );
8
- `,s=`
8
+ `,r=`
9
9
  CREATE TABLE IF NOT EXISTS d1_migrations (
10
10
  id INTEGER PRIMARY KEY AUTOINCREMENT,
11
11
  name TEXT NOT NULL UNIQUE,
12
12
  applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
13
13
  );
14
- `;await (0,c.KK)(e,t,r),await (0,c.KK)(e,t,s,i,!0);let a=await (0,c.KK)(e,t,"SELECT name FROM d1_migrations ORDER BY applied_at;",i,!0),o=new Map((e=>{try{let r=JSON.parse(e);return r[0]?.results||[]}catch{return[]}})(a).map(e=>[e.name,e])),p=u.join(e,"migrations"),d=(await (0,n.readdir)(p)).filter(e=>e.endsWith(".sql")).sort(),R={applied:[],skipped:[],preview:[]};for(let e of d){let r=u.join(p,e),s={name:e,action:"",reason:""};try{if(!(await (0,l.JD)(r)).isValid){s.action="failed validation",s.reason="Migration validation failed",R.preview.push(s);continue}if(o.has(e)){s.action="skipped",s.reason="Already applied",R.preview.push(s),R.skipped.push({name:e,reason:s.reason});continue}s.action="will be applied",R.preview.push(s)}catch(r){s.action="failed",s.reason=r.message||"Failed to process migration",R.preview.push(s),R.skipped.push({name:e,reason:s.reason})}}return E.A.debug("Push Preview Result (server):",R),{success:!0,preview:!0,applied:R.applied.length,skipped:R.skipped.length,details:R}}catch(e){throw{type:c.wU.EXECUTION_ERROR,message:e.message||"Failed to push migrations",details:e.details||{error:e.stderr||e.message}}}}async function T(e){try{let{accountId:r,apiToken:s}=await e.json(),t=process.env.D1_PROJECT_DIR;if(!t)return p.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let a=await (0,d.S)(t);if(!a||!a.config)return p.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let i=a.config;if(!i.d1_databases?.length)return p.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let o=i.d1_databases[0].database_name,n=await R(t,r,s,o,!0);return p.NextResponse.json({success:!0,message:"Preview generated for migrations to be pushed to remote",details:n})}catch(e){return E.A.error("Push to remote preview error:",e),p.NextResponse.json({success:!1,error:{type:e.type||c.wU.EXECUTION_ERROR,message:e.message||"Failed to push to remote preview",details:e.details||{error:e.stderr||e.message}}},{status:e.type===c.wU.VALIDATION_ERROR?400:500})}}async function m(){return new p.NextResponse(null,{status:204})}let x=new a.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/push-remote/preview/route",pathname:"/api/push-remote/preview",filename:"route",bundlePath:"app/api/push-remote/preview/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/preview/route.js",nextConfigOutput:"",userland:t}),{workAsyncStorage:g,workUnitAsyncStorage:h,serverHooks:w}=x;function N(){return(0,o.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:h})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[638,452,391,801],()=>s(19330));module.exports=t})();
14
+ `;await (0,d.KK)(e,a,t),await (0,d.KK)(e,a,r,i,!0);let s=await (0,d.KK)(e,a,"SELECT name FROM d1_migrations ORDER BY applied_at;",i,!0),o=new Map((e=>{try{let t=JSON.parse(e);return t[0]?.results||[]}catch{return[]}})(s).map(e=>[e.name,e])),n=l.join(e,"migrations"),c=(await (0,p.readdir)(n)).filter(e=>e.endsWith(".sql")).sort(),T={applied:[],skipped:[],preview:[]};for(let e of c){let t=l.join(n,e),r={name:e,action:"",reason:""};try{if(!(await (0,u.JD)(t)).isValid){r.action="failed validation",r.reason="Migration validation failed",T.preview.push(r);continue}if(o.has(e)){r.action="skipped",r.reason="Already applied",T.preview.push(r),T.skipped.push({name:e,reason:r.reason});continue}r.action="will be applied",T.preview.push(r)}catch(t){r.action="failed",r.reason=t.message||"Failed to process migration",T.preview.push(r),T.skipped.push({name:e,reason:r.reason})}}return E.A.debug("Push Preview Result (server):",T),{success:!0,preview:!0,applied:T.applied.length,skipped:T.skipped.length,details:T}}catch(e){throw{type:d.wU.EXECUTION_ERROR,message:e.message||"Failed to push migrations",details:e.details||{error:e.stderr||e.message}}}}async function m(e){try{let{accountId:t,apiToken:r}=await e.json(),a=process.env.D1_PROJECT_DIR;if(!a)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let s=await (0,c.S)(a);if(!s||!s.config)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let i=s.config;if(!i.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let o=i.d1_databases[0].database_name,p=await T(a,t,r,o,!0);return n.NextResponse.json({success:!0,message:"Preview generated for migrations to be pushed to remote",details:p})}catch(e){return E.A.error("Push to remote preview error:",e),n.NextResponse.json({success:!1,error:{type:e.type||d.wU.EXECUTION_ERROR,message:e.message||"Failed to push to remote preview",details:e.details||{error:e.stderr||e.message}}},{status:e.type===d.wU.VALIDATION_ERROR?400:500})}}async function R(){return new n.NextResponse(null,{status:204})}let g=new s.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/push-remote/preview/route",pathname:"/api/push-remote/preview",filename:"route",bundlePath:"app/api/push-remote/preview/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/preview/route.js",nextConfigOutput:"",userland:a}),{workAsyncStorage:w,workUnitAsyncStorage:h,serverHooks:N}=g;function f(){return(0,o.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:h})}},83159:(e,t,r)=>{r.d(t,{hI:()=>w,Sl:()=>h,GS:()=>m,Gc:()=>N,k0:()=>u,CM:()=>g,ai:()=>R,JD:()=>T});var a=r(79748),s=r(28354),i=r(79646);let o=require("crypto");var n=r(33873),p=r(19421),l=r(44218),c=r(81804);let d=(0,s.promisify)(i.exec);async function u(e,t,r="local",a=!1){let s="remote"===r?"--remote":"--local",i="remote"===r?`
15
+ CREATE TABLE IF NOT EXISTS d1_migrations (
16
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
17
+ name TEXT NOT NULL UNIQUE,
18
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
19
+ );
20
+ `:`
21
+ CREATE TABLE IF NOT EXISTS d1_migrations (
22
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
23
+ name TEXT NOT NULL UNIQUE,
24
+ checksum TEXT NULL,
25
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
26
+ );
27
+ `;try{await d(`wrangler d1 execute ${t} ${s} --command="${i.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await d(`wrangler d1 execute ${t} ${s} --command="${"DELETE FROM d1_migrations;".replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw c.A.error(`Failed to initialize migrations table in ${r}:`,e),e}}function E(e){let t=new Date().toISOString().replace(/[^0-9]/g,"").slice(0,-3),r=e.type.toLowerCase().replace(/_/g,"-");if("CREATE_INDEX"===e.type){let r=e.description.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"");return`${t}_create-index_${r}.sql`}{let a=`${t}_${{"create-table":"create-table","alter-table":"alter-table","drop-table":"drop-table","drop-index":"drop-index","create-view":"create-view","drop-view":"drop-view","add-foreign-key":"add-foreign-key","drop-foreign-key":"drop-foreign-key","add-constraint":"add-constraint","drop-constraint":"drop-constraint"}[r]||r}_${e.tableName}`;return"ALTER_TABLE"===e.type&&e.description&&(a+=`_${e.description}`),(a=a.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,""))+".sql"}}async function T(e){let t=await (0,a.readFile)(e,"utf8");try{let e=(0,p.By)(t);return(0,p.Gq)(e),{isValid:!0,statement:e}}catch(e){return{isValid:!1,errors:e}}}async function m(e,t,r){try{let a=await (0,p.KK)(e,t,"SELECT name, applied_at FROM d1_migrations ORDER BY applied_at;",r,!0);if("string"==typeof a){let e=a.indexOf("[");if(-1!==e){let t=a.substring(e),r=JSON.parse(t);return r[0]?.results||[]}}return[]}catch(e){throw{type:p.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e.message,suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function R(e,t,{name:r,checksum:a},s="local"){let i="remote"===s?"--remote":"--local";if("local"===s&&a)try{await d(`wrangler d1 execute ${t} ${i} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await d(`wrangler d1 execute ${t} ${i} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let o="remote"!==s&&a?`
28
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
29
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
30
+ `:`
31
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
32
+ VALUES ('${r}', CURRENT_TIMESTAMP);
33
+ `;try{await d(`wrangler d1 execute ${t} ${i} --command="${o.replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw c.A.error("Failed to track migration:",e),e}}async function g(e,t,{name:r,checksum:a},s={},i=!1){let o=i||!a?`
34
+ INSERT OR REPLACE INTO d1_migrations (name, applied_at)
35
+ VALUES ('${r}', CURRENT_TIMESTAMP);
36
+ `:`
37
+ INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
38
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
39
+ `;try{await (0,p.KK)(e,t,o,s,i)}catch(e){throw{type:p.wU.EXECUTION_ERROR,message:`Failed to record migration ${r}`,details:{file:r,error:e.message,suggestions:["Check if migration is already recorded"]}}}}async function w(e,t){try{let r=await m(e,t,{}),a=new Map(r.map(e=>[e.name,e]));return{applied:Array.from(a.keys()),count:a.size}}catch(e){throw c.A.error("Failed to compare migrations:",e),e}}function h(e){return(0,o.createHash)("sha256").update(e).digest("hex")}async function N(e,t,r){try{let s=n.join(e,"migrations");await (0,a.mkdir)(s,{recursive:!0});let i=[],o=[],c=[];for(let e of r)e.type===p.Pg.DATA_MODIFICATION?c.push(e):o.push(e);let d=new Map,u="__no_table__";for(let e of o){let t=e.tableName?e.tableName.toLowerCase():u;d.has(t)||d.set(t,[]),d.get(t).push(e)}let T=[...d.keys()].filter(e=>e!==u),m=[];if(T.length>0){let e=T.map(e=>d.get(e)[0]);m=(0,l.IC)(e)}for(let r of m){for(let o of d.get(r)||[])try{if(o.type===p.Pg.DROP_TABLE&&!await (0,p.F9)(e,t,{},o.tableName,!1))throw Error(`no such table: ${o.tableName}`);let r=await (0,p.KK)(e,t,o.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let l=E(o),c=n.join(s,l),d=(0,p.tn)(o.sql);await (0,a.writeFile)(c,d,"utf8");let u=h(o.sql);await R(e,t,{name:l,checksum:u},"local"),i.push({type:o.type,table:o.tableName,migration:l,checksum:u})}catch(e){throw e}d.delete(r)}if(d.has(u))for(let r of d.get(u))try{await (0,p.KK)(e,t,r.sql);let o=E(r),l=n.join(s,o),c=(0,p.tn)(r.sql);await (0,a.writeFile)(l,c,"utf8");let d=h(r.sql);await R(e,t,{name:o,checksum:d},"local"),i.push({type:r.type,table:r.tableName||null,migration:o,checksum:d})}catch(e){throw e}for(let r of c)try{await (0,p.KK)(e,t,r.sql),i.push({type:r.type,table:r.tableName||null,executed:!0})}catch(e){throw e}return i}catch(e){throw e}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[638,452,391,226],()=>r(19330));module.exports=a})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../chunks/801.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot-instance.js","../../../../../../node_modules/next/dist/server/app-render/clean-async-snapshot.external.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/226.js","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}