d1s 0.2.13 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/README.md +14 -1
  2. package/dist/.next/.next/BUILD_ID +1 -1
  3. package/dist/.next/.next/app-build-manifest.json +121 -79
  4. package/dist/.next/.next/app-path-routes-manifest.json +1 -1
  5. package/dist/.next/.next/build-manifest.json +7 -7
  6. package/dist/.next/.next/cache/.rscinfo +1 -1
  7. package/dist/.next/.next/cache/.tsbuildinfo +1 -1
  8. package/dist/.next/.next/cache/webpack/client-development/0.pack.gz +0 -0
  9. package/dist/.next/.next/cache/webpack/client-development/1.pack.gz +0 -0
  10. package/dist/.next/.next/cache/webpack/client-development/index.pack.gz +0 -0
  11. package/dist/.next/.next/cache/webpack/client-development/index.pack.gz.old +0 -0
  12. package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
  13. package/dist/.next/.next/cache/webpack/client-production/1.pack +0 -0
  14. package/dist/.next/.next/cache/webpack/client-production/10.pack +0 -0
  15. package/dist/.next/.next/cache/webpack/client-production/11.pack +0 -0
  16. package/dist/.next/.next/cache/webpack/client-production/12.pack +0 -0
  17. package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
  18. package/dist/.next/.next/cache/webpack/client-production/3.pack +0 -0
  19. package/dist/.next/.next/cache/webpack/client-production/4.pack +0 -0
  20. package/dist/.next/.next/cache/webpack/client-production/5.pack +0 -0
  21. package/dist/.next/.next/cache/webpack/client-production/6.pack +0 -0
  22. package/dist/.next/.next/cache/webpack/client-production/7.pack +0 -0
  23. package/dist/.next/.next/cache/webpack/client-production/8.pack +0 -0
  24. package/dist/.next/.next/cache/webpack/client-production/9.pack +0 -0
  25. package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
  26. package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
  27. package/dist/.next/.next/cache/webpack/edge-server-production/index.pack +0 -0
  28. package/dist/.next/.next/cache/webpack/server-development/0.pack.gz +0 -0
  29. package/dist/.next/.next/cache/webpack/server-development/1.pack.gz +0 -0
  30. package/dist/.next/.next/cache/webpack/server-development/index.pack.gz +0 -0
  31. package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
  32. package/dist/.next/.next/cache/webpack/server-production/1.pack +0 -0
  33. package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
  34. package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
  35. package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
  36. package/dist/.next/.next/next-server.js.nft.json +1 -1
  37. package/dist/.next/.next/prerender-manifest.json +1 -1
  38. package/dist/.next/.next/react-loadable-manifest.json +11 -1
  39. package/dist/.next/.next/required-server-files.json +1 -1
  40. package/dist/.next/.next/routes-manifest.json +1 -1
  41. package/dist/.next/.next/server/app/_not-found/page.js +1 -1
  42. package/dist/.next/.next/server/app/_not-found/page.js.nft.json +1 -1
  43. package/dist/.next/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  44. package/dist/.next/.next/server/app/_not-found.html +1 -1
  45. package/dist/.next/.next/server/app/_not-found.rsc +5 -5
  46. package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
  47. package/dist/.next/.next/server/app/api/cloudflare/route.js.nft.json +1 -1
  48. package/dist/.next/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  49. package/dist/.next/.next/server/app/api/databases/route.js +1 -1
  50. package/dist/.next/.next/server/app/api/databases/route.js.nft.json +1 -1
  51. package/dist/.next/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  52. package/dist/.next/.next/server/app/api/migrations/list/route.js +26 -0
  53. package/dist/.next/.next/server/app/api/migrations/list/route.js.nft.json +1 -0
  54. package/dist/.next/.next/server/app/api/migrations/list/route_client-reference-manifest.js +1 -0
  55. package/dist/.next/.next/server/app/api/migrations/sync/route.js +5 -5
  56. package/dist/.next/.next/server/app/api/migrations/sync/route.js.nft.json +1 -1
  57. package/dist/.next/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  58. package/dist/.next/.next/server/app/api/migrations/sync-files/route.js +4 -4
  59. package/dist/.next/.next/server/app/api/migrations/sync-files/route.js.nft.json +1 -1
  60. package/dist/.next/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  61. package/dist/.next/.next/server/app/api/pro/route.js +1 -0
  62. package/dist/.next/.next/server/app/api/pro/route.js.nft.json +1 -0
  63. package/dist/.next/.next/server/app/api/pro/route_client-reference-manifest.js +1 -0
  64. package/dist/.next/.next/server/app/api/pull-data/confirm/route.js +1 -1
  65. package/dist/.next/.next/server/app/api/pull-data/confirm/route.js.nft.json +1 -1
  66. package/dist/.next/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -1
  67. package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +4 -4
  68. package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js.nft.json +1 -1
  69. package/dist/.next/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  70. package/dist/.next/.next/server/app/api/pull-remote/preview/route.js +4 -4
  71. package/dist/.next/.next/server/app/api/pull-remote/preview/route.js.nft.json +1 -1
  72. package/dist/.next/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  73. package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +6 -6
  74. package/dist/.next/.next/server/app/api/push-remote/confirm/route.js.nft.json +1 -1
  75. package/dist/.next/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  76. package/dist/.next/.next/server/app/api/push-remote/preview/route.js +6 -6
  77. package/dist/.next/.next/server/app/api/push-remote/preview/route.js.nft.json +1 -1
  78. package/dist/.next/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  79. package/dist/.next/.next/server/app/api/query/route.js +9 -9
  80. package/dist/.next/.next/server/app/api/query/route.js.nft.json +1 -1
  81. package/dist/.next/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  82. package/dist/.next/.next/server/app/api/schema/route.js +1 -0
  83. package/dist/.next/.next/server/app/api/schema/route.js.nft.json +1 -0
  84. package/dist/.next/.next/server/app/api/schema/route_client-reference-manifest.js +1 -0
  85. package/dist/.next/.next/server/app/api/tables/[name]/import/route.js +1 -0
  86. package/dist/.next/.next/server/app/api/tables/[name]/import/route.js.nft.json +1 -0
  87. package/dist/.next/.next/server/app/api/tables/[name]/import/route_client-reference-manifest.js +1 -0
  88. package/dist/.next/.next/server/app/api/tables/[name]/route.js +5 -5
  89. package/dist/.next/.next/server/app/api/tables/[name]/route.js.nft.json +1 -1
  90. package/dist/.next/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  91. package/dist/.next/.next/server/app/api/tables/route.js +2 -2
  92. package/dist/.next/.next/server/app/api/tables/route.js.nft.json +1 -1
  93. package/dist/.next/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  94. package/dist/.next/.next/server/app/api/time-travel/preview/route.js +1 -0
  95. package/dist/.next/.next/server/app/api/time-travel/preview/route.js.nft.json +1 -0
  96. package/dist/.next/.next/server/app/api/time-travel/preview/route_client-reference-manifest.js +1 -0
  97. package/dist/.next/.next/server/app/api/time-travel/restore/route.js +1 -0
  98. package/dist/.next/.next/server/app/api/time-travel/restore/route.js.nft.json +1 -0
  99. package/dist/.next/.next/server/app/api/time-travel/restore/route_client-reference-manifest.js +1 -0
  100. package/dist/.next/.next/server/app/api/update/route.js +1 -1
  101. package/dist/.next/.next/server/app/api/update/route.js.nft.json +1 -1
  102. package/dist/.next/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  103. package/dist/.next/.next/server/app/index.html +5 -3
  104. package/dist/.next/.next/server/app/index.rsc +6 -6
  105. package/dist/.next/.next/server/app/page.js +15 -15
  106. package/dist/.next/.next/server/app/page.js.nft.json +1 -1
  107. package/dist/.next/.next/server/app/page_client-reference-manifest.js +1 -1
  108. package/dist/.next/.next/server/app-paths-manifest.json +10 -4
  109. package/dist/.next/.next/server/chunks/226.js +12 -12
  110. package/dist/.next/.next/server/chunks/391.js +1 -1
  111. package/dist/.next/.next/server/chunks/452.js +1 -1
  112. package/dist/.next/.next/server/chunks/487.js +1 -0
  113. package/dist/.next/.next/server/chunks/572.js +1 -1
  114. package/dist/.next/.next/server/chunks/992.js +3 -3
  115. package/dist/.next/{server/chunks/638.js → .next/server/chunks/994.js} +3 -3
  116. package/dist/.next/.next/server/middleware-build-manifest.js +1 -1
  117. package/dist/.next/.next/server/middleware-react-loadable-manifest.js +1 -1
  118. package/dist/.next/.next/server/next-font-manifest.js +1 -1
  119. package/dist/.next/.next/server/next-font-manifest.json +1 -1
  120. package/dist/.next/.next/server/pages/404.html +1 -1
  121. package/dist/.next/.next/server/pages/500.html +1 -1
  122. package/dist/.next/.next/server/pages-manifest.json +1 -1
  123. package/dist/.next/.next/server/server-reference-manifest.json +1 -1
  124. package/dist/.next/.next/static/-OO4tE7EKr8o62Bne-ODo/_buildManifest.js +1 -0
  125. package/dist/.next/.next/static/3kAeIJC56X7aw1Fk5_OXO/_buildManifest.js +1 -0
  126. package/dist/.next/.next/static/J8r9W6xxmYYvuKehItNuW/_buildManifest.js +1 -0
  127. package/dist/.next/.next/static/arc9h7hbaQzL1Dl0iuVrT/_buildManifest.js +1 -0
  128. package/dist/.next/.next/static/chunks/1a258343.3b3e7ba5ba0bd0d2.js +1 -0
  129. package/dist/.next/.next/static/chunks/345.8fc37569d5708622.js +1 -0
  130. package/dist/.next/.next/static/chunks/480-85b6c8ae3f51b156.js +1 -0
  131. package/dist/.next/.next/static/chunks/52.2cdc9bdb75e1fc2e.js +1 -0
  132. package/dist/.next/.next/static/chunks/803-a2fcfbd00e6b3b38.js +1 -0
  133. package/dist/.next/.next/static/chunks/{92-5f7522943fcb72a8.js → 92-a84bdac2be7c8d7a.js} +1 -1
  134. package/dist/.next/.next/static/chunks/app/api/cloudflare/route-d0c1dc2a9e7dce36.js +1 -0
  135. package/dist/.next/.next/static/chunks/app/api/databases/route-cd322321212797cf.js +1 -0
  136. package/dist/.next/.next/static/chunks/app/api/migrations/list/route-cd710ff75b6bcd02.js +1 -0
  137. package/dist/.next/.next/static/chunks/app/api/migrations/sync/route-ee522f232b9f0a9c.js +1 -0
  138. package/dist/.next/.next/static/chunks/app/api/migrations/sync-files/route-79ee2c26f87d3bc7.js +1 -0
  139. package/dist/.next/.next/static/chunks/app/api/pro/route-c90c1f901fc00d38.js +1 -0
  140. package/dist/.next/.next/static/chunks/app/api/pull-data/confirm/route-118764086af798f8.js +1 -0
  141. package/dist/.next/.next/static/chunks/app/api/pull-remote/confirm/route-2b0ade4ebfcea0bc.js +1 -0
  142. package/dist/.next/.next/static/chunks/app/api/pull-remote/preview/route-342db7ea13e6f447.js +1 -0
  143. package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-b778c053bd515abd.js +1 -0
  144. package/dist/.next/.next/static/chunks/app/api/push-remote/preview/route-ab090482f299f57f.js +1 -0
  145. package/dist/.next/.next/static/chunks/app/api/query/route-4d21a8b1d34491f1.js +1 -0
  146. package/dist/.next/.next/static/chunks/app/api/schema/route-cb17a387d6b557ad.js +1 -0
  147. package/dist/.next/.next/static/chunks/app/api/tables/[name]/import/route-510472de7a5c29bd.js +1 -0
  148. package/dist/.next/.next/static/chunks/app/api/tables/[name]/route-6a1fa95c303ce0de.js +1 -0
  149. package/dist/.next/.next/static/chunks/app/api/tables/route-daa975df4ea8e8f8.js +1 -0
  150. package/dist/.next/.next/static/chunks/app/api/time-travel/preview/route-5787d7e8f17bd539.js +1 -0
  151. package/dist/.next/.next/static/chunks/app/api/time-travel/restore/route-84b64a27e831e21c.js +1 -0
  152. package/dist/.next/.next/static/chunks/app/api/update/route-54ee900537982652.js +1 -0
  153. package/dist/.next/.next/static/chunks/app/{layout-40ec07d04681ba81.js → layout-f0ec4d636ee0f763.js} +1 -1
  154. package/dist/.next/.next/static/chunks/app/page-358bf2112802ff85.js +1 -0
  155. package/dist/.next/.next/static/chunks/webpack-024900a94af4f0a7.js +1 -0
  156. package/dist/.next/.next/static/css/2c165a0ede9b2442.css +3 -0
  157. package/dist/.next/.next/static/css/32df9a4d493f8b0f.css +31 -0
  158. package/dist/.next/.next/static/fiesjBWbrmSSyLf4biwrX/_buildManifest.js +1 -0
  159. package/dist/.next/.next/static/ft39e6W6vSgUL7peRo7pE/_buildManifest.js +1 -0
  160. package/dist/.next/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
  161. package/dist/.next/.next/static/u7ssdTycF4iQ-w-pQZhxg/_buildManifest.js +1 -0
  162. package/dist/.next/.next/trace +3 -3
  163. package/dist/.next/.next/types/app/api/migrations/list/route.ts +347 -0
  164. package/dist/.next/.next/types/app/api/pro/route.ts +347 -0
  165. package/dist/.next/.next/types/app/api/schema/route.ts +347 -0
  166. package/dist/.next/.next/types/app/api/tables/[name]/import/route.ts +347 -0
  167. package/dist/.next/.next/types/app/api/time-travel/preview/route.ts +347 -0
  168. package/dist/.next/.next/types/app/api/time-travel/restore/route.ts +347 -0
  169. package/dist/.next/BUILD_ID +1 -1
  170. package/dist/.next/app-build-manifest.json +122 -80
  171. package/dist/.next/app-path-routes-manifest.json +1 -1
  172. package/dist/.next/build-manifest.json +7 -7
  173. package/dist/.next/cache/.rscinfo +1 -1
  174. package/dist/.next/cache/.tsbuildinfo +1 -1
  175. package/dist/.next/cache/webpack/client-production/0.pack +0 -0
  176. package/dist/.next/cache/webpack/client-production/index.pack +0 -0
  177. package/dist/.next/cache/webpack/edge-server-production/index.pack +0 -0
  178. package/dist/.next/cache/webpack/server-production/0.pack +0 -0
  179. package/dist/.next/cache/webpack/server-production/index.pack +0 -0
  180. package/dist/.next/next-minimal-server.js.nft.json +1 -1
  181. package/dist/.next/next-server.js.nft.json +1 -1
  182. package/dist/.next/prerender-manifest.json +1 -1
  183. package/dist/.next/react-loadable-manifest.json +11 -1
  184. package/dist/.next/required-server-files.json +1 -1
  185. package/dist/.next/routes-manifest.json +1 -1
  186. package/dist/.next/server/app/_not-found/page.js +1 -1
  187. package/dist/.next/server/app/_not-found/page.js.nft.json +1 -1
  188. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  189. package/dist/.next/server/app/_not-found.html +1 -1
  190. package/dist/.next/server/app/_not-found.rsc +5 -5
  191. package/dist/.next/server/app/api/cloudflare/route.js +1 -1
  192. package/dist/.next/server/app/api/cloudflare/route.js.nft.json +1 -1
  193. package/dist/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  194. package/dist/.next/server/app/api/databases/route.js +1 -1
  195. package/dist/.next/server/app/api/databases/route.js.nft.json +1 -1
  196. package/dist/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  197. package/dist/.next/server/app/api/migrations/list/route.js +26 -0
  198. package/dist/.next/server/app/api/migrations/list/route.js.nft.json +1 -0
  199. package/dist/.next/server/app/api/migrations/list/route_client-reference-manifest.js +1 -0
  200. package/dist/.next/server/app/api/migrations/sync/route.js +5 -5
  201. package/dist/.next/server/app/api/migrations/sync/route.js.nft.json +1 -1
  202. package/dist/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  203. package/dist/.next/server/app/api/migrations/sync-files/route.js +4 -4
  204. package/dist/.next/server/app/api/migrations/sync-files/route.js.nft.json +1 -1
  205. package/dist/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  206. package/dist/.next/server/app/api/pro/route.js +1 -0
  207. package/dist/.next/server/app/api/pro/route.js.nft.json +1 -0
  208. package/dist/.next/server/app/api/pro/route_client-reference-manifest.js +1 -0
  209. package/dist/.next/server/app/api/pull-data/confirm/route.js +1 -1
  210. package/dist/.next/server/app/api/pull-data/confirm/route.js.nft.json +1 -1
  211. package/dist/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -1
  212. package/dist/.next/server/app/api/pull-remote/confirm/route.js +4 -4
  213. package/dist/.next/server/app/api/pull-remote/confirm/route.js.nft.json +1 -1
  214. package/dist/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  215. package/dist/.next/server/app/api/pull-remote/preview/route.js +4 -4
  216. package/dist/.next/server/app/api/pull-remote/preview/route.js.nft.json +1 -1
  217. package/dist/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  218. package/dist/.next/server/app/api/push-remote/confirm/route.js +6 -6
  219. package/dist/.next/server/app/api/push-remote/confirm/route.js.nft.json +1 -1
  220. package/dist/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  221. package/dist/.next/server/app/api/push-remote/preview/route.js +6 -6
  222. package/dist/.next/server/app/api/push-remote/preview/route.js.nft.json +1 -1
  223. package/dist/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  224. package/dist/.next/server/app/api/query/route.js +9 -9
  225. package/dist/.next/server/app/api/query/route.js.nft.json +1 -1
  226. package/dist/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  227. package/dist/.next/server/app/api/schema/route.js +1 -0
  228. package/dist/.next/server/app/api/schema/route.js.nft.json +1 -0
  229. package/dist/.next/server/app/api/schema/route_client-reference-manifest.js +1 -0
  230. package/dist/.next/server/app/api/tables/[name]/import/route.js +1 -0
  231. package/dist/.next/server/app/api/tables/[name]/import/route.js.nft.json +1 -0
  232. package/dist/.next/server/app/api/tables/[name]/import/route_client-reference-manifest.js +1 -0
  233. package/dist/.next/server/app/api/tables/[name]/route.js +5 -5
  234. package/dist/.next/server/app/api/tables/[name]/route.js.nft.json +1 -1
  235. package/dist/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  236. package/dist/.next/server/app/api/tables/route.js +2 -2
  237. package/dist/.next/server/app/api/tables/route.js.nft.json +1 -1
  238. package/dist/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  239. package/dist/.next/server/app/api/time-travel/preview/route.js +1 -0
  240. package/dist/.next/server/app/api/time-travel/preview/route.js.nft.json +1 -0
  241. package/dist/.next/server/app/api/time-travel/preview/route_client-reference-manifest.js +1 -0
  242. package/dist/.next/server/app/api/time-travel/restore/route.js +1 -0
  243. package/dist/.next/server/app/api/time-travel/restore/route.js.nft.json +1 -0
  244. package/dist/.next/server/app/api/time-travel/restore/route_client-reference-manifest.js +1 -0
  245. package/dist/.next/server/app/api/update/route.js +1 -1
  246. package/dist/.next/server/app/api/update/route.js.nft.json +1 -1
  247. package/dist/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  248. package/dist/.next/server/app/index.html +5 -3
  249. package/dist/.next/server/app/index.rsc +6 -6
  250. package/dist/.next/server/app/page.js +15 -15
  251. package/dist/.next/server/app/page.js.nft.json +1 -1
  252. package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
  253. package/dist/.next/server/app-paths-manifest.json +11 -5
  254. package/dist/.next/server/chunks/226.js +12 -12
  255. package/dist/.next/server/chunks/391.js +1 -1
  256. package/dist/.next/server/chunks/452.js +1 -1
  257. package/dist/.next/server/chunks/487.js +1 -0
  258. package/dist/.next/server/chunks/572.js +1 -1
  259. package/dist/.next/server/chunks/992.js +3 -3
  260. package/dist/.next/{.next/server/chunks/638.js → server/chunks/994.js} +3 -3
  261. package/dist/.next/server/middleware-build-manifest.js +1 -1
  262. package/dist/.next/server/middleware-react-loadable-manifest.js +1 -1
  263. package/dist/.next/server/next-font-manifest.js +1 -1
  264. package/dist/.next/server/next-font-manifest.json +1 -1
  265. package/dist/.next/server/pages/404.html +1 -1
  266. package/dist/.next/server/pages/500.html +1 -1
  267. package/dist/.next/server/pages-manifest.json +1 -1
  268. package/dist/.next/server/server-reference-manifest.json +1 -1
  269. package/dist/.next/static/chunks/1a258343.3b3e7ba5ba0bd0d2.js +1 -0
  270. package/dist/.next/static/chunks/345.8fc37569d5708622.js +1 -0
  271. package/dist/.next/static/chunks/480-85b6c8ae3f51b156.js +1 -0
  272. package/dist/.next/static/chunks/52.2cdc9bdb75e1fc2e.js +1 -0
  273. package/dist/.next/static/chunks/803-a2fcfbd00e6b3b38.js +1 -0
  274. package/dist/.next/static/chunks/{92-5f7522943fcb72a8.js → 92-a84bdac2be7c8d7a.js} +1 -1
  275. package/dist/.next/static/chunks/app/api/cloudflare/route-d0c1dc2a9e7dce36.js +1 -0
  276. package/dist/.next/static/chunks/app/api/databases/route-cd322321212797cf.js +1 -0
  277. package/dist/.next/static/chunks/app/api/migrations/list/route-cd710ff75b6bcd02.js +1 -0
  278. package/dist/.next/static/chunks/app/api/migrations/sync/route-ee522f232b9f0a9c.js +1 -0
  279. package/dist/.next/static/chunks/app/api/migrations/sync-files/route-79ee2c26f87d3bc7.js +1 -0
  280. package/dist/.next/static/chunks/app/api/pro/route-c90c1f901fc00d38.js +1 -0
  281. package/dist/.next/static/chunks/app/api/pull-data/confirm/route-118764086af798f8.js +1 -0
  282. package/dist/.next/static/chunks/app/api/pull-remote/confirm/route-2b0ade4ebfcea0bc.js +1 -0
  283. package/dist/.next/static/chunks/app/api/pull-remote/preview/route-342db7ea13e6f447.js +1 -0
  284. package/dist/.next/static/chunks/app/api/push-remote/confirm/route-b778c053bd515abd.js +1 -0
  285. package/dist/.next/static/chunks/app/api/push-remote/preview/route-ab090482f299f57f.js +1 -0
  286. package/dist/.next/static/chunks/app/api/query/route-4d21a8b1d34491f1.js +1 -0
  287. package/dist/.next/static/chunks/app/api/schema/route-cb17a387d6b557ad.js +1 -0
  288. package/dist/.next/static/chunks/app/api/tables/[name]/import/route-510472de7a5c29bd.js +1 -0
  289. package/dist/.next/static/chunks/app/api/tables/[name]/route-6a1fa95c303ce0de.js +1 -0
  290. package/dist/.next/static/chunks/app/api/tables/route-daa975df4ea8e8f8.js +1 -0
  291. package/dist/.next/static/chunks/app/api/time-travel/preview/route-5787d7e8f17bd539.js +1 -0
  292. package/dist/.next/static/chunks/app/api/time-travel/restore/route-84b64a27e831e21c.js +1 -0
  293. package/dist/.next/static/chunks/app/api/update/route-54ee900537982652.js +1 -0
  294. package/dist/.next/static/chunks/app/{layout-40ec07d04681ba81.js → layout-f0ec4d636ee0f763.js} +1 -1
  295. package/dist/.next/static/chunks/app/page-358bf2112802ff85.js +1 -0
  296. package/dist/.next/static/chunks/webpack-024900a94af4f0a7.js +1 -0
  297. package/dist/.next/static/css/2c165a0ede9b2442.css +3 -0
  298. package/dist/.next/static/css/32df9a4d493f8b0f.css +31 -0
  299. package/dist/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
  300. package/dist/.next/static/zh4Fz2tbm8GRka4woRrGp/_buildManifest.js +1 -0
  301. package/dist/.next/trace +18 -3
  302. package/dist/.next/types/app/api/migrations/list/route.ts +347 -0
  303. package/dist/.next/types/app/api/pro/route.ts +347 -0
  304. package/dist/.next/types/app/api/schema/route.ts +347 -0
  305. package/dist/.next/types/app/api/tables/[name]/import/route.ts +347 -0
  306. package/dist/.next/types/app/api/time-travel/preview/route.ts +347 -0
  307. package/dist/.next/types/app/api/time-travel/restore/route.ts +347 -0
  308. package/dist/app/api/databases/route.js +2 -1
  309. package/dist/app/api/migrations/list/route.js +137 -0
  310. package/dist/app/api/migrations/sync-files/route.js +2 -1
  311. package/dist/app/api/pro/route.js +7 -0
  312. package/dist/app/api/pull-remote/confirm/route.js +138 -146
  313. package/dist/app/api/pull-remote/preview/route.js +49 -84
  314. package/dist/app/api/push-remote/confirm/route.js +31 -12
  315. package/dist/app/api/push-remote/preview/route.js +27 -12
  316. package/dist/app/api/query/route.js +24 -13
  317. package/dist/app/api/schema/route.js +63 -0
  318. package/dist/app/api/tables/[name]/import/route.js +112 -0
  319. package/dist/app/api/tables/[name]/route.js +38 -29
  320. package/dist/app/api/tables/route.js +29 -16
  321. package/dist/app/api/time-travel/preview/route.js +122 -0
  322. package/dist/app/api/time-travel/restore/route.js +106 -0
  323. package/dist/app/page.jsx +26 -8
  324. package/dist/d1-studio.js +129 -23
  325. package/dist/lib/license.js +99 -71
  326. package/dist/lib/local-db.js +223 -0
  327. package/dist/lib/migrations.js +40 -2
  328. package/dist/lib/parse-sql-error.js +99 -160
  329. package/dist/lib/sql-operations.js +28 -10
  330. package/dist/lib/telemetry.js +39 -0
  331. package/package.json +6 -2
  332. package/dist/.next/.next/cache/webpack/server-production/2.pack +0 -0
  333. package/dist/.next/.next/cache/webpack/server-production/3.pack +0 -0
  334. package/dist/.next/.next/static/FEsQ9jwPUQv5A3fwg6Opl/_buildManifest.js +0 -1
  335. package/dist/.next/.next/static/Y9mYu4WBghepP5oT_3OdR/_buildManifest.js +0 -1
  336. package/dist/.next/.next/static/ae3gNmoSGm-R5LJC4UagI/_buildManifest.js +0 -1
  337. package/dist/.next/.next/static/bKfUJeuvAQlBmR3TjrfkH/_buildManifest.js +0 -1
  338. package/dist/.next/.next/static/chunks/576-18a2209e1ed26aad.js +0 -1
  339. package/dist/.next/.next/static/chunks/735-b885dfec6353171d.js +0 -1
  340. package/dist/.next/.next/static/chunks/app/api/cloudflare/route-b77846f372b01f38.js +0 -1
  341. package/dist/.next/.next/static/chunks/app/api/databases/route-407794f8145d9a0b.js +0 -1
  342. package/dist/.next/.next/static/chunks/app/api/migrations/sync/route-9f480f5590369a8f.js +0 -1
  343. package/dist/.next/.next/static/chunks/app/api/migrations/sync-files/route-92010db279b4dd8e.js +0 -1
  344. package/dist/.next/.next/static/chunks/app/api/pull-data/confirm/route-a02fe6d3cdd0a535.js +0 -1
  345. package/dist/.next/.next/static/chunks/app/api/pull-remote/confirm/route-f401a03507d1da50.js +0 -1
  346. package/dist/.next/.next/static/chunks/app/api/pull-remote/preview/route-3c53814b5cb8b6b0.js +0 -1
  347. package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-8f359249e907c63b.js +0 -1
  348. package/dist/.next/.next/static/chunks/app/api/push-remote/preview/route-b51bf94f39c17a9d.js +0 -1
  349. package/dist/.next/.next/static/chunks/app/api/query/route-87bae2d4aebaf859.js +0 -1
  350. package/dist/.next/.next/static/chunks/app/api/tables/[name]/route-d20ca163b9c03e7c.js +0 -1
  351. package/dist/.next/.next/static/chunks/app/api/tables/route-0f46f911562abcdf.js +0 -1
  352. package/dist/.next/.next/static/chunks/app/api/update/route-14edc1917760bce0.js +0 -1
  353. package/dist/.next/.next/static/chunks/app/page-f05cd0fc436bf9bc.js +0 -1
  354. package/dist/.next/.next/static/chunks/app/page-f2bc307c0d8acdaa.js +0 -1
  355. package/dist/.next/.next/static/chunks/webpack-c76ac1e586b2802a.js +0 -1
  356. package/dist/.next/.next/static/css/7c16f57d325d0d7d.css +0 -3
  357. package/dist/.next/.next/static/ejYPqJ2kVicVp5EFWOZIC/_buildManifest.js +0 -1
  358. package/dist/.next/.next/static/gABGrAoO8IPArDo_Ns_7g/_buildManifest.js +0 -1
  359. package/dist/.next/.next/static/gh-QfIUVo4FTTduYCVKT6/_buildManifest.js +0 -1
  360. package/dist/.next/.next/static/media/569ce4b8f30dc480-s.p.woff2 +0 -0
  361. package/dist/.next/.next/static/thaCy2qVeNqYYhdayr13C/_buildManifest.js +0 -1
  362. package/dist/.next/.next/static/ybCx6L6gHqtODbKmlhU-d/_buildManifest.js +0 -1
  363. package/dist/.next/.next/static/ybCx6L6gHqtODbKmlhU-d/_ssgManifest.js +0 -1
  364. package/dist/.next/cache/webpack/client-production/1.pack +0 -0
  365. package/dist/.next/cache/webpack/client-production/2.pack +0 -0
  366. package/dist/.next/cache/webpack/client-production/index.pack.old +0 -0
  367. package/dist/.next/static/IX-QLbm7scYnyqWeeimal/_buildManifest.js +0 -1
  368. package/dist/.next/static/IX-QLbm7scYnyqWeeimal/_ssgManifest.js +0 -1
  369. package/dist/.next/static/chunks/576-18a2209e1ed26aad.js +0 -1
  370. package/dist/.next/static/chunks/735-b885dfec6353171d.js +0 -1
  371. package/dist/.next/static/chunks/app/api/cloudflare/route-b77846f372b01f38.js +0 -1
  372. package/dist/.next/static/chunks/app/api/databases/route-407794f8145d9a0b.js +0 -1
  373. package/dist/.next/static/chunks/app/api/migrations/sync/route-9f480f5590369a8f.js +0 -1
  374. package/dist/.next/static/chunks/app/api/migrations/sync-files/route-92010db279b4dd8e.js +0 -1
  375. package/dist/.next/static/chunks/app/api/pull-data/confirm/route-a02fe6d3cdd0a535.js +0 -1
  376. package/dist/.next/static/chunks/app/api/pull-remote/confirm/route-f401a03507d1da50.js +0 -1
  377. package/dist/.next/static/chunks/app/api/pull-remote/preview/route-3c53814b5cb8b6b0.js +0 -1
  378. package/dist/.next/static/chunks/app/api/push-remote/confirm/route-8f359249e907c63b.js +0 -1
  379. package/dist/.next/static/chunks/app/api/push-remote/preview/route-b51bf94f39c17a9d.js +0 -1
  380. package/dist/.next/static/chunks/app/api/query/route-87bae2d4aebaf859.js +0 -1
  381. package/dist/.next/static/chunks/app/api/tables/[name]/route-d20ca163b9c03e7c.js +0 -1
  382. package/dist/.next/static/chunks/app/api/tables/route-0f46f911562abcdf.js +0 -1
  383. package/dist/.next/static/chunks/app/api/update/route-14edc1917760bce0.js +0 -1
  384. package/dist/.next/static/chunks/app/page-f05cd0fc436bf9bc.js +0 -1
  385. package/dist/.next/static/chunks/webpack-c76ac1e586b2802a.js +0 -1
  386. package/dist/.next/static/css/7c16f57d325d0d7d.css +0 -3
  387. package/dist/.next/static/media/569ce4b8f30dc480-s.p.woff2 +0 -0
  388. /package/dist/.next/.next/static/{FEsQ9jwPUQv5A3fwg6Opl → -OO4tE7EKr8o62Bne-ODo}/_ssgManifest.js +0 -0
  389. /package/dist/.next/.next/static/{Y9mYu4WBghepP5oT_3OdR → 3kAeIJC56X7aw1Fk5_OXO}/_ssgManifest.js +0 -0
  390. /package/dist/.next/.next/static/{ae3gNmoSGm-R5LJC4UagI → J8r9W6xxmYYvuKehItNuW}/_ssgManifest.js +0 -0
  391. /package/dist/.next/.next/static/{bKfUJeuvAQlBmR3TjrfkH → arc9h7hbaQzL1Dl0iuVrT}/_ssgManifest.js +0 -0
  392. /package/dist/.next/.next/static/chunks/{4bd1b696-8c908eb707f85a27.js → 4bd1b696-124ea104c06f6cea.js} +0 -0
  393. /package/dist/.next/.next/static/chunks/{517-3b698a5d3da06ff7.js → 517-c876ce2f00030cd0.js} +0 -0
  394. /package/dist/.next/.next/static/chunks/{692-ede418e1d28a1394.js → 692-9e59d546afd11ec3.js} +0 -0
  395. /package/dist/.next/.next/static/chunks/app/_not-found/{page-b786c3dd79ad15a5.js → page-3e24b81707d98126.js} +0 -0
  396. /package/dist/.next/.next/static/{ejYPqJ2kVicVp5EFWOZIC → fiesjBWbrmSSyLf4biwrX}/_ssgManifest.js +0 -0
  397. /package/dist/.next/.next/static/{gABGrAoO8IPArDo_Ns_7g → ft39e6W6vSgUL7peRo7pE}/_ssgManifest.js +0 -0
  398. /package/dist/.next/.next/static/{gh-QfIUVo4FTTduYCVKT6 → u7ssdTycF4iQ-w-pQZhxg}/_ssgManifest.js +0 -0
  399. /package/dist/.next/static/chunks/{4bd1b696-8c908eb707f85a27.js → 4bd1b696-124ea104c06f6cea.js} +0 -0
  400. /package/dist/.next/static/chunks/{517-3b698a5d3da06ff7.js → 517-c876ce2f00030cd0.js} +0 -0
  401. /package/dist/.next/static/chunks/{692-ede418e1d28a1394.js → 692-9e59d546afd11ec3.js} +0 -0
  402. /package/dist/.next/static/chunks/app/_not-found/{page-b786c3dd79ad15a5.js → page-3e24b81707d98126.js} +0 -0
  403. /package/dist/.next/{.next/static/thaCy2qVeNqYYhdayr13C → static/zh4Fz2tbm8GRka4woRrGp}/_ssgManifest.js +0 -0
@@ -1,17 +1,17 @@
1
- "use strict";(()=>{var e={};e.id=868,e.ids=[868],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870: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")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{e.exports=require("buffer")},9646:e=>{e.exports=require("child_process")},4735:e=>{e.exports=require("events")},9021:e=>{e.exports=require("fs")},9748:e=>{e.exports=require("fs/promises")},1630:e=>{e.exports=require("http")},5591:e=>{e.exports=require("https")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},1204:e=>{e.exports=require("string_decoder")},8354:e=>{e.exports=require("util")},4075:e=>{e.exports=require("zlib")},643:e=>{e.exports=require("node:fs")},4379:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},1704:(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:()=>T});var s=r(2706),i=r(8203),o=r(5994),n=r(9187),p=r(9748),l=r(3873),c=r(5949),d=r(9421),u=r(3159),E=r(1804);async function m(e,t,r,a,s=!0){let i={...process.env,CLOUDFLARE_ACCOUNT_ID:t,CLOUDFLARE_API_TOKEN:r};try{let t=`
1
+ "use strict";(()=>{var e={};e.id=868,e.ids=[868],e.modules={7550:e=>{e.exports=require("better-sqlite3")},846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870: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")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{e.exports=require("buffer")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},4735:e=>{e.exports=require("events")},9021:e=>{e.exports=require("fs")},9748:e=>{e.exports=require("fs/promises")},1630:e=>{e.exports=require("http")},5591:e=>{e.exports=require("https")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},1204:e=>{e.exports=require("string_decoder")},8354:e=>{e.exports=require("util")},4075:e=>{e.exports=require("zlib")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},1704:(e,t,r)=>{r.r(t),r.d(t,{patchFetch:()=>N,routeModule:()=>R,serverHooks:()=>f,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>h});var a={};r.r(a),r.d(a,{OPTIONS:()=>g,POST:()=>T});var s=r(2706),i=r(8203),o=r(5994),n=r(9187),l=r(9748),p=r(3873),c=r(5949),d=r(9421),u=r(961),E=r(1804);async function m(e,t,r=!0,a){let s=process.env;try{let r=`
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
- `,r=`
8
+ `,i=`
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,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(),m={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",m.preview.push(r);continue}if(o.has(e)){r.action="skipped",r.reason="Already applied",m.preview.push(r),m.skipped.push({name:e,reason:r.reason});continue}r.action="will be applied",m.preview.push(r)}catch(t){r.action="failed",r.reason=t.message||"Failed to process migration",m.preview.push(r),m.skipped.push({name:e,reason:r.reason})}}return E.A.debug("Push Preview Result (server):",m),{success:!0,preview:!0,applied:m.applied.length,skipped:m.skipped.length,details:m}}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 T(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 m(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:"/Volumes/ProjectSpace/_wip/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})}},3159:(e,t,r)=>{r.d(t,{hI:()=>w,Sl:()=>h,GS:()=>T,Gc:()=>N,k0:()=>u,CM:()=>g,ai:()=>R,JD:()=>m});var a=r(9748),s=r(8354),i=r(9646);let o=require("crypto");var n=r(3873),p=r(9421),l=r(4218),c=r(1804);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?`
14
+ `;await (0,d.KK)(e,t,r),await (0,d.KK)(e,t,i,s,!0);let o=await (0,d.KK)(e,t,"SELECT name FROM d1_migrations ORDER BY applied_at;",s,!0),n=(e=>{try{let t=JSON.parse(e);return t[0]?.results||[]}catch{return[]}})(o);console.log(`[push-preview] remote d1_migrations raw response: ${o}`),console.log(`[push-preview] remote d1_migrations parsed rows (${n.length}): ${JSON.stringify(n)}`);let c=new Map(n.map(e=>[e.name,e])),m=a||p.join(e,"migrations"),T=(await (0,l.readdir)(m)).filter(e=>e.endsWith(".sql")&&!/seed/i.test(e)).sort(),g={applied:[],skipped:[],preview:[]};for(let e of T){let t=p.join(m,e),r={name:e,action:"",reason:""};try{if(!(await (0,u.JD)(t)).isValid){r.action="failed validation",r.reason="Migration validation failed",g.preview.push(r);continue}if(c.has(e)){r.action="skipped",r.reason="Already applied",g.preview.push(r),g.skipped.push({name:e,reason:r.reason});continue}r.action="will be applied",g.preview.push(r)}catch(t){r.action="failed",r.reason=t.message||"Failed to process migration",g.preview.push(r),g.skipped.push({name:e,reason:r.reason})}}return E.A.debug("Push Preview Result (server):",g),{success:!0,preview:!0,applied:g.applied.length,skipped:g.skipped.length,details:g}}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 T(e){if("true"!==process.env.D1_IS_PRO)return n.NextResponse.json({success:!1,error:{type:"PRO_REQUIRED",message:"Pro license required. Run: d1s --license YOUR-KEY"}},{status:402});try{let t=process.env.D1_PROJECT_DIR;if(!t)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let r=await (0,c.S)(t);if(!r||!r.config)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let a=r.config;if(!a.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let s=await e.json().catch(()=>({})),i=s?.db,o=i?a.d1_databases.find(e=>e.database_name===i):a.d1_databases[0];if(!o)return n.NextResponse.json({success:!1,error:{type:d.wU.VALIDATION_ERROR,message:`Database not found: ${i}`}},{status:400});let l=o.database_name,u=o.migrations_dir?p.join(t,o.migrations_dir):p.join(t,"migrations"),E=await m(t,l,!0,u);return n.NextResponse.json({success:!0,message:"Preview generated for migrations to be pushed to remote",details:E})}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 g(){return new n.NextResponse(null,{status:204})}let R=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:"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/push-remote/preview/route.js",nextConfigOutput:"",userland:a}),{workAsyncStorage:w,workUnitAsyncStorage:h,serverHooks:f}=R;function N(){return(0,o.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:h})}},961:(e,t,r)=>{r.d(t,{A8:()=>f,CM:()=>R,GS:()=>T,Gc:()=>N,JD:()=>m,Sl:()=>h,ai:()=>g,hI:()=>w,k0:()=>u});var a=r(9748),s=r(8354),i=r(9646),o=r(5511),n=r(3873),l=r(9421),p=r(4218),c=r(1804);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
15
  CREATE TABLE IF NOT EXISTS d1_migrations (
16
16
  id INTEGER PRIMARY KEY AUTOINCREMENT,
17
17
  name TEXT NOT NULL UNIQUE,
@@ -24,16 +24,16 @@
24
24
  checksum TEXT NULL,
25
25
  applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
26
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 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 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?`
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 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 T(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(t){let e=[t.message,t.details?.originalError,t.details?.stderr,t.details?.stdout].filter(Boolean).join(" ");if(e.includes("no such table")||e.includes("d1_migrations"))return[];throw{type:l.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e||"Failed to execute SQL command",suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function g(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
28
  INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
29
29
  VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
30
30
  `:`
31
31
  INSERT OR REPLACE INTO d1_migrations (name, applied_at)
32
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?`
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 R(e,t,{name:r,checksum:a},s={},i=!1){let o=i||!a?`
34
34
  INSERT OR REPLACE INTO d1_migrations (name, applied_at)
35
35
  VALUES ('${r}', CURRENT_TIMESTAMP);
36
36
  `:`
37
37
  INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
38
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 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 m=[...d.keys()].filter(e=>e!==u),T=[];if(m.length>0){let e=m.map(e=>d.get(e)[0]);T=(0,l.IC)(e)}for(let r of T){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(1704));module.exports=a})();
39
+ `;try{await (0,l.KK)(e,t,o,s,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 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 c.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){try{await d(`wrangler d1 execute ${t} --local --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e})}catch{try{await d(`wrangler d1 execute ${t} --local --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch{}}}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===l.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 m=[...d.keys()].filter(e=>e!==u),T=[];if(m.length>0){let e=m.map(e=>d.get(e)[0]);T=(0,p.IC)(e)}for(let r of T){for(let o of d.get(r)||[])try{if(o.type===l.Pg.DROP_TABLE&&!await (0,l.F9)(e,t,{},o.tableName,!1))throw Error(`no such table: ${o.tableName}`);let r=await (0,l.KK)(e,t,o.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let p=E(o),c=n.join(s,p),d=(0,l.tn)(o.sql);await (0,a.writeFile)(c,d,"utf8");let u=h(o.sql);await g(e,t,{name:p,checksum:u},"local"),i.push({type:o.type,table:o.tableName,migration:p,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 o=E(r),p=n.join(s,o),c=(0,l.tn)(r.sql);await (0,a.writeFile)(p,c,"utf8");let d=h(r.sql);await g(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,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,[994,452,391,226],()=>r(1704));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/226.js","../../../../chunks/391.js","../../../../chunks/452.js","../../../../chunks/638.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../../../node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../../node_modules/better-sqlite3/lib/database.js","../../../../../../node_modules/better-sqlite3/lib/index.js","../../../../../../node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../../node_modules/better-sqlite3/lib/methods/backup.js","../../../../../../node_modules/better-sqlite3/lib/methods/function.js","../../../../../../node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../../node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../../node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../../node_modules/better-sqlite3/lib/methods/table.js","../../../../../../node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../../node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../../node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../../node_modules/better-sqlite3/lib/util.js","../../../../../../node_modules/better-sqlite3/package.json","../../../../../../node_modules/bindings/bindings.js","../../../../../../node_modules/bindings/package.json","../../../../../../node_modules/file-uri-to-path/index.js","../../../../../../node_modules/file-uri-to-path/package.json","../../../../../../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/487.js","../../../../chunks/994.js","../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/push-remote/preview/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"4535","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/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-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/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-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx":{"id":2624,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","576","static/chunks/576-18a2209e1ed26aad.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-f2bc307c0d8acdaa.js"],"async":false}},"entryCSSFiles":{"/Volumes/ProjectSpace/_wip/d1studio/src/":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/7c16f57d325d0d7d.css"}],"/Volumes/ProjectSpace/_wip/d1studio/src/app/page":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/push-remote/preview/route":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/push-remote/preview/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"7098","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx":{"id":6311,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","803","static/chunks/803-a2fcfbd00e6b3b38.js","480","static/chunks/480-85b6c8ae3f51b156.js","974","static/chunks/app/page-358bf2112802ff85.js"],"async":false}},"entryCSSFiles":{"/Volumes/ProjectSpace/_wip/d1studio/src/":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/2c165a0ede9b2442.css"}],"/Volumes/ProjectSpace/_wip/d1studio/src/app/page":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/push-remote/preview/route":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -1,11 +1,11 @@
1
- "use strict";(()=>{var e={};e.id=58,e.ids=[58],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870: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")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{e.exports=require("buffer")},9646:e=>{e.exports=require("child_process")},4735:e=>{e.exports=require("events")},9021:e=>{e.exports=require("fs")},9748:e=>{e.exports=require("fs/promises")},1630:e=>{e.exports=require("http")},5591:e=>{e.exports=require("https")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},1204:e=>{e.exports=require("string_decoder")},8354:e=>{e.exports=require("util")},4075:e=>{e.exports=require("zlib")},643:e=>{e.exports=require("node:fs")},4379:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},271:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>f,routeModule:()=>T,serverHooks:()=>m,workAsyncStorage:()=>N,workUnitAsyncStorage:()=>g});var a={};t.r(a),t.d(a,{OPTIONS:()=>R,POST:()=>p});var s=t(2706),o=t(8203),n=t(5994),i=t(9187),l=t(5949),c=t(9421),d=t(3159);let u={SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",TABLE_NOT_FOUND:"TABLE_NOT_FOUND",TABLE_EXISTS:"TABLE_EXISTS",FOREIGN_KEY_ERROR:"FOREIGN_KEY_ERROR",UNIQUE_CONSTRAINT_ERROR:"UNIQUE_CONSTRAINT_ERROR",NOT_NULL_CONSTRAINT_ERROR:"NOT_NULL_CONSTRAINT_ERROR",CHECK_CONSTRAINT_ERROR:"CHECK_CONSTRAINT_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};var E=t(1804);async function p(e){E.A.logRequest("POST","/api/query");try{let r;let t=process.env.D1_PROJECT_DIR;if(!t)return E.A.error("Project directory not configured"),i.NextResponse.json({error:"Project directory not configured"},{status:500});let{query:a}=await e.json();if(E.A.shouldLog("debug")&&E.A.debug("Received query:",a),!a?.trim())return i.NextResponse.json({success:!1,error:{message:"Query cannot be empty"}},{status:400});let s=await (0,l.S)(t);if(!s||!s.config)return E.A.error("No Wrangler configuration file found"),i.NextResponse.json({success:!1,error:{message:"No Wrangler configuration file found"}},{status:404});let o=s.config;if(!o.d1_databases?.length)return i.NextResponse.json({success:!1,error:{message:"No D1 databases configured"}},{status:404});let n=o.d1_databases[0].database_name,u=(0,c.mA)(a);if(!u.length)return i.NextResponse.json({success:!1,error:{message:"No valid SQL statements found"}},{status:400});u=u.map(c.Gq);let p=`
1
+ "use strict";(()=>{var e={};e.id=58,e.ids=[58],e.modules={7550:e=>{e.exports=require("better-sqlite3")},846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870: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")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{e.exports=require("buffer")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},4735:e=>{e.exports=require("events")},9021:e=>{e.exports=require("fs")},9748:e=>{e.exports=require("fs/promises")},1630:e=>{e.exports=require("http")},5591:e=>{e.exports=require("https")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},1204:e=>{e.exports=require("string_decoder")},8354:e=>{e.exports=require("util")},4075:e=>{e.exports=require("zlib")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},8833:(e,t,r)=>{r.r(t),r.d(t,{patchFetch:()=>g,routeModule:()=>T,serverHooks:()=>f,workAsyncStorage:()=>N,workUnitAsyncStorage:()=>m});var a={};r.r(a),r.d(a,{OPTIONS:()=>R,POST:()=>p});var s=r(2706),i=r(8203),o=r(5994),n=r(9187),l=r(5949),c=r(9421),d=r(961),u=r(7074),E=r(1804);async function p(e){E.A.logRequest("POST","/api/query");try{let t;let r=process.env.D1_PROJECT_DIR;if(!r)return E.A.error("Project directory not configured"),n.NextResponse.json({error:"Project directory not configured"},{status:500});let{query:a,db:s}=await e.json();if(E.A.shouldLog("debug")&&E.A.debug("Received query:",a),!a?.trim())return n.NextResponse.json({success:!1,error:{message:"Query cannot be empty"}},{status:400});let i=await (0,l.S)(r);if(!i||!i.config)return E.A.error("No Wrangler configuration file found"),n.NextResponse.json({success:!1,error:{message:"No Wrangler configuration file found"}},{status:404});let o=i.config;if(!o.d1_databases?.length)return n.NextResponse.json({success:!1,error:{message:"No D1 databases configured"}},{status:404});let u=s?o.d1_databases.find(e=>e.database_name===s):o.d1_databases[0];if(!u)return n.NextResponse.json({success:!1,error:{message:`Database not found: ${s}`}},{status:404});let p=u.database_name,R=(0,c.mA)(a);if(!R.length)return n.NextResponse.json({success:!1,error:{message:"No valid SQL statements found"}},{status:400});R=R.map(c.Gq);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
- `;if(await (0,c.KK)(t,n,p),u.some(c.QQ)){let e=await (0,d.Gc)(t,n,u);r={success:!0,migrations:e,results:[{results:[]}]}}else{let e=[];for(let r of u){let a=await (0,c.KK)(t,n,r.sql);try{let r=JSON.parse(a),t=r[0]?.results||[];e.push(...t)}catch(e){continue}}r={success:!0,results:[{results:e}]}}return i.NextResponse.json(r)}catch(t){E.A.logError(t,"query-route");let e=function(e){if(console.debug("parseSQLError - Received error:",e),!e)return console.debug("parseSQLError - error is null or undefined."),{type:u.UNKNOWN_ERROR,message:"An unknown error occurred",details:{}};let r="",t=null,a=null,s=e.cmd||e.details&&e.details.command;if(s){let e=s.match(/--command="(.+?)"/s);e&&console.debug("parseSQLError - Extracted original query:",a=e[1].replace(/\\n/g,"\n"))}let o=e.stderr||e.details&&e.details.stderr;if(o){let n=o.replace(/\x1B\[[0-9;]*[a-zA-Z]/g,"");if(console.debug("parseSQLError - Cleaned stderr:",n),n.includes("env: node: No such file or directory"))return console.debug("parseSQLError - Detected 'env: node: No such file or directory' error."),{type:u.EXECUTION_ERROR,message:e.message||"Execution error: env: node: No such file or directory",details:{originalQuery:a,stderr:n}};let i=n.match(/near "([^"]+)": syntax error at offset (\d+)/);if(i){let[e,s,o]=i;return t=parseInt(o,10),r=`Syntax error near "${s}" at position ${t}`,console.debug("parseSQLError - Syntax error detected:",{near:s,offset:t}),{type:u.SYNTAX_ERROR,message:r,details:{originalQuery:a,errorLocation:{offset:t,near:s},stderr:n}}}if(n.includes("UNIQUE constraint failed")){let[e,r,t]=n.match(/UNIQUE constraint failed: (\w+)\.(\w+)/)||[];return console.debug("parseSQLError - UNIQUE constraint error detected:",{table:r,column:t}),{type:u.UNIQUE_CONSTRAINT_ERROR,message:`Unique constraint violation updating ${r}.${t}`,details:{originalQuery:a,stderr:n}}}if(n.includes("NOT NULL constraint failed")){let[e,r,t]=n.match(/NOT NULL constraint failed: (\w+)\.(\w+)/)||[];return console.debug("parseSQLError - NOT NULL constraint error detected:",{table:r,column:t}),{type:u.NOT_NULL_CONSTRAINT_ERROR,message:`NOT NULL constraint violation updating ${r}.${t}`,details:{originalQuery:a,stderr:n}}}if(n.includes("CHECK constraint failed")){let[e,r]=n.match(/CHECK constraint failed: (\w+)/)||[];return console.debug("parseSQLError - CHECK constraint error detected:",{constraintName:r}),{type:u.CHECK_CONSTRAINT_ERROR,message:`Check constraint violation updating ${r}`,details:{originalQuery:a,stderr:n}}}if(n.includes("FOREIGN KEY constraint failed")){console.debug("parseSQLError - FOREIGN KEY constraint error detected.");let e=/--command="([^"]+)"/.exec(s||""),r=e?e[1]:null,t={};if(r){let e=/UPDATE\s+(\w+)\s+SET\s+(\w+)\s*=/.exec(r);e&&(t={table:e[1],column:e[2]})}let a=t.table?`Foreign key constraint violation updating ${t.table}.${t.column}`:"Foreign key constraint violation";return{type:u.FOREIGN_KEY_ERROR,message:a,details:{...t,originalQuery:r,stderr:n}}}if(n.includes("no such table")){let[e,r]=n.match(/no such table: (\w+)/)||[];return console.debug("parseSQLError - Table not found error detected:",{table:r}),{type:u.TABLE_NOT_FOUND,message:`Table not found: ${r}`,details:{originalQuery:a,stderr:n}}}if(n.includes("already exists")){let[e,r]=n.match(/table (\w+) already exists/)||[];return console.debug("parseSQLError - Table exists error detected:",{table:r}),{type:u.TABLE_EXISTS,message:`Table already exists: ${r}`,details:{originalQuery:a,stderr:n}}}return console.debug("parseSQLError - No specific error match found. Using fallback for execution error."),{type:u.EXECUTION_ERROR,message:e.message||"Failed to execute SQL command",details:{originalQuery:a,stderr:n}}}return console.debug("parseSQLError - No stderr available; using default error handling."),{type:u.UNKNOWN_ERROR,message:e.message||"An unknown error occurred",details:{}}}(t),r=t.type===c.wU.VALIDATION_ERROR?400:t.type===c.wU.DEPENDENCY_ERROR?409:500;return i.NextResponse.json({success:!1,error:e},{status:r})}}async function R(){return new i.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let T=new s.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/query/route",pathname:"/api/query",filename:"route",bundlePath:"app/api/query/route"},resolvedPagePath:"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/query/route.js",nextConfigOutput:"",userland:a}),{workAsyncStorage:N,workUnitAsyncStorage:g,serverHooks:m}=T;function f(){return(0,n.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:g})}},3159:(e,r,t)=>{t.d(r,{hI:()=>m,Sl:()=>f,GS:()=>T,Gc:()=>O,k0:()=>E,CM:()=>g,ai:()=>N,JD:()=>R});var a=t(9748),s=t(8354),o=t(9646);let n=require("crypto");var i=t(3873),l=t(9421),c=t(4218),d=t(1804);let u=(0,s.promisify)(o.exec);async function E(e,r,t="local",a=!1){let s="remote"===t?"--remote":"--local",o="remote"===t?`
8
+ `;if(R.every(e=>{let t=e.sql.trim().toUpperCase();return t.startsWith("SELECT")||t.startsWith("PRAGMA")||t.startsWith("EXPLAIN")})||await (0,c.KK)(r,p,T,{},!1,u),R.some(c.QQ)){let e=await (0,d.Gc)(r,p,R);t={success:!0,migrations:e,results:[{results:[]}]}}else{let e=[];for(let t of R){let a=await (0,c.KK)(r,p,t.sql,{},!1,u);try{let t=JSON.parse(a),r=t[0]?.results||[];e.push(...r)}catch(e){continue}}t={success:!0,results:[{results:e}]}}return n.NextResponse.json(t)}catch(r){let e=(0,u.s)(r);E.A.error(`✗ ${e.message}`);let t=r.type===c.wU.VALIDATION_ERROR?400:r.type===c.wU.DEPENDENCY_ERROR?409:500;return n.NextResponse.json({success:!1,error:e},{status:t})}}async function R(){return new n.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let T=new s.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/query/route",pathname:"/api/query",filename:"route",bundlePath:"app/api/query/route"},resolvedPagePath:"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/query/route.js",nextConfigOutput:"",userland:a}),{workAsyncStorage:N,workUnitAsyncStorage:m,serverHooks:f}=T;function g(){return(0,o.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:m})}},961:(e,t,r)=>{r.d(t,{A8:()=>_,CM:()=>m,GS:()=>T,Gc:()=>O,JD:()=>R,Sl:()=>g,ai:()=>N,hI:()=>f,k0:()=>E});var a=r(9748),s=r(8354),i=r(9646),o=r(5511),n=r(3873),l=r(9421),c=r(4218),d=r(1804);let u=(0,s.promisify)(i.exec);async function E(e,t,r="local",a=!1){let s="remote"===r?"--remote":"--local",i="remote"===r?`
9
9
  CREATE TABLE IF NOT EXISTS d1_migrations (
10
10
  id INTEGER PRIMARY KEY AUTOINCREMENT,
11
11
  name TEXT NOT NULL UNIQUE,
@@ -18,16 +18,16 @@
18
18
  checksum TEXT NULL,
19
19
  applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
20
20
  );
21
- `;try{await u(`wrangler d1 execute ${r} ${s} --command="${o.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await u(`wrangler d1 execute ${r} ${s} --command="${"DELETE FROM d1_migrations;".replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw d.A.error(`Failed to initialize migrations table in ${t}:`,e),e}}function p(e){let r=new Date().toISOString().replace(/[^0-9]/g,"").slice(0,-3),t=e.type.toLowerCase().replace(/_/g,"-");if("CREATE_INDEX"===e.type){let t=e.description.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"");return`${r}_create-index_${t}.sql`}{let a=`${r}_${{"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"}[t]||t}_${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 R(e){let r=await (0,a.readFile)(e,"utf8");try{let e=(0,l.By)(r);return(0,l.Gq)(e),{isValid:!0,statement:e}}catch(e){return{isValid:!1,errors:e}}}async function T(e,r,t){try{let a=await (0,l.KK)(e,r,"SELECT name, applied_at FROM d1_migrations ORDER BY applied_at;",t,!0);if("string"==typeof a){let e=a.indexOf("[");if(-1!==e){let r=a.substring(e),t=JSON.parse(r);return t[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 N(e,r,{name:t,checksum:a},s="local"){let o="remote"===s?"--remote":"--local";if("local"===s&&a)try{await u(`wrangler d1 execute ${r} ${o} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await u(`wrangler d1 execute ${r} ${o} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let n="remote"!==s&&a?`
21
+ `;try{await u(`wrangler d1 execute ${t} ${s} --command="${i.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await u(`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 p(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 R(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 T(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(t){let e=[t.message,t.details?.originalError,t.details?.stderr,t.details?.stdout].filter(Boolean).join(" ");if(e.includes("no such table")||e.includes("d1_migrations"))return[];throw{type:l.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e||"Failed to execute SQL command",suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function N(e,t,{name:r,checksum:a},s="local"){let i="remote"===s?"--remote":"--local";if("local"===s&&a)try{await u(`wrangler d1 execute ${t} ${i} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await u(`wrangler d1 execute ${t} ${i} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let o="remote"!==s&&a?`
22
22
  INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
23
- VALUES ('${t}', '${a}', CURRENT_TIMESTAMP);
23
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
24
24
  `:`
25
25
  INSERT OR REPLACE INTO d1_migrations (name, applied_at)
26
- VALUES ('${t}', CURRENT_TIMESTAMP);
27
- `;try{await u(`wrangler d1 execute ${r} ${o} --command="${n.replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw d.A.error("Failed to track migration:",e),e}}async function g(e,r,{name:t,checksum:a},s={},o=!1){let n=o||!a?`
26
+ VALUES ('${r}', CURRENT_TIMESTAMP);
27
+ `;try{await u(`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 m(e,t,{name:r,checksum:a},s={},i=!1){let o=i||!a?`
28
28
  INSERT OR REPLACE INTO d1_migrations (name, applied_at)
29
- VALUES ('${t}', CURRENT_TIMESTAMP);
29
+ VALUES ('${r}', CURRENT_TIMESTAMP);
30
30
  `:`
31
31
  INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
32
- VALUES ('${t}', '${a}', CURRENT_TIMESTAMP);
33
- `;try{await (0,l.KK)(e,r,n,s,o)}catch(e){throw{type:l.wU.EXECUTION_ERROR,message:`Failed to record migration ${t}`,details:{file:t,error:e.message,suggestions:["Check if migration is already recorded"]}}}}async function m(e,r){try{let t=await T(e,r,{}),a=new Map(t.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 f(e){return(0,n.createHash)("sha256").update(e).digest("hex")}async function O(e,r,t){try{let s=i.join(e,"migrations");await (0,a.mkdir)(s,{recursive:!0});let o=[],n=[],d=[];for(let e of t)e.type===l.Pg.DATA_MODIFICATION?d.push(e):n.push(e);let u=new Map,E="__no_table__";for(let e of n){let r=e.tableName?e.tableName.toLowerCase():E;u.has(r)||u.set(r,[]),u.get(r).push(e)}let R=[...u.keys()].filter(e=>e!==E),T=[];if(R.length>0){let e=R.map(e=>u.get(e)[0]);T=(0,c.IC)(e)}for(let t of T){for(let n of u.get(t)||[])try{if(n.type===l.Pg.DROP_TABLE&&!await (0,l.F9)(e,r,{},n.tableName,!1))throw Error(`no such table: ${n.tableName}`);let t=await (0,l.KK)(e,r,n.sql);if(t&&(t.toLowerCase().includes("syntax error")||t.toLowerCase().includes("sqlite_error")))throw Error(t);let c=p(n),d=i.join(s,c),u=(0,l.tn)(n.sql);await (0,a.writeFile)(d,u,"utf8");let E=f(n.sql);await N(e,r,{name:c,checksum:E},"local"),o.push({type:n.type,table:n.tableName,migration:c,checksum:E})}catch(e){throw e}u.delete(t)}if(u.has(E))for(let t of u.get(E))try{await (0,l.KK)(e,r,t.sql);let n=p(t),c=i.join(s,n),d=(0,l.tn)(t.sql);await (0,a.writeFile)(c,d,"utf8");let u=f(t.sql);await N(e,r,{name:n,checksum:u},"local"),o.push({type:t.type,table:t.tableName||null,migration:n,checksum:u})}catch(e){throw e}for(let t of d)try{await (0,l.KK)(e,r,t.sql),o.push({type:t.type,table:t.tableName||null,executed:!0})}catch(e){throw e}return o}catch(e){throw e}}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[638,452,391,226],()=>t(271));module.exports=a})();
32
+ VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
33
+ `;try{await (0,l.KK)(e,t,o,s,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 f(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 g(e){return(0,o.createHash)("sha256").update(e).digest("hex")}async function _(e,t){try{await u(`wrangler d1 execute ${t} --local --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e})}catch{try{await u(`wrangler d1 execute ${t} --local --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch{}}}async function O(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===l.Pg.DATA_MODIFICATION?d.push(e):o.push(e);let u=new Map,E="__no_table__";for(let e of o){let t=e.tableName?e.tableName.toLowerCase():E;u.has(t)||u.set(t,[]),u.get(t).push(e)}let R=[...u.keys()].filter(e=>e!==E),T=[];if(R.length>0){let e=R.map(e=>u.get(e)[0]);T=(0,c.IC)(e)}for(let r of T){for(let o of u.get(r)||[])try{if(o.type===l.Pg.DROP_TABLE&&!await (0,l.F9)(e,t,{},o.tableName,!1))throw Error(`no such table: ${o.tableName}`);let r=await (0,l.KK)(e,t,o.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let c=p(o),d=n.join(s,c),u=(0,l.tn)(o.sql);await (0,a.writeFile)(d,u,"utf8");let E=g(o.sql);await N(e,t,{name:c,checksum:E},"local"),i.push({type:o.type,table:o.tableName,migration:c,checksum:E})}catch(e){throw e}u.delete(r)}if(u.has(E))for(let r of u.get(E))try{await (0,l.KK)(e,t,r.sql);let o=p(r),c=n.join(s,o),d=(0,l.tn)(r.sql);await (0,a.writeFile)(c,d,"utf8");let u=g(r.sql);await N(e,t,{name:o,checksum:u},"local"),i.push({type:r.type,table:r.tableName||null,migration:o,checksum:u})}catch(e){throw e}for(let r of d)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}}},7074:(e,t,r)=>{r.d(t,{s:()=>s});let a={SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",TABLE_NOT_FOUND:"TABLE_NOT_FOUND",TABLE_EXISTS:"TABLE_EXISTS",FOREIGN_KEY_ERROR:"FOREIGN_KEY_ERROR",UNIQUE_CONSTRAINT_ERROR:"UNIQUE_CONSTRAINT_ERROR",NOT_NULL_CONSTRAINT_ERROR:"NOT_NULL_CONSTRAINT_ERROR",CHECK_CONSTRAINT_ERROR:"CHECK_CONSTRAINT_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};function s(e){if(!e)return{type:a.UNKNOWN_ERROR,message:"An unknown error occurred",details:{}};let t=null,r=e.cmd||e.details&&e.details.command;if(r){let e=r.match(/--command="(.+?)"\s*--json/s);e&&(t=e[1].replace(/\\n/g,"\n").replace(/\\"/g,'"'))}let s=e.stdout||e.details&&e.details.stdout;if(s)try{let e=JSON.parse(s.trim()),a=e?.error?.text||"";if(a)return i(a,t,r)}catch{}let o=e.stderr||e.details&&e.details.stderr;if(o)return i(o.replace(/\x1B\[[0-9;]*[a-zA-Z]/g,""),t,r);let n=e.message||e.details&&e.details.originalError||"";return n?i(n,t,r):{type:a.UNKNOWN_ERROR,message:e.message||"An unknown error occurred",details:{}}}function i(e,t,r){if(e.includes("env: node: No such file or directory"))return{type:a.EXECUTION_ERROR,message:"Node.js not found — ensure Node.js is installed and in PATH",details:{originalQuery:t}};let s=e.match(/near "([^"]+)": syntax error(?:\s+at offset (\d+))?/);if(s){let[,e,r]=s;return{type:a.SYNTAX_ERROR,message:`Syntax error near "${e}"${r?` at position ${r}`:""}`,details:{originalQuery:t,errorLocation:{near:e,offset:r?parseInt(r):null}}}}if(e.includes("UNIQUE constraint failed")){let[,r]=e.match(/UNIQUE constraint failed: ([\w.]+)/)||[];return{type:a.UNIQUE_CONSTRAINT_ERROR,message:`UNIQUE constraint failed: ${r||"unknown column"}`,details:{originalQuery:t}}}if(e.includes("NOT NULL constraint failed")){let[,r]=e.match(/NOT NULL constraint failed: ([\w.]+)/)||[];return{type:a.NOT_NULL_CONSTRAINT_ERROR,message:`NOT NULL constraint failed: ${r||"unknown column"}`,details:{originalQuery:t}}}if(e.includes("CHECK constraint failed")){let[,r]=e.match(/CHECK constraint failed: (\S+)/)||[];return{type:a.CHECK_CONSTRAINT_ERROR,message:`CHECK constraint failed: ${r||"unknown constraint"}`,details:{originalQuery:t}}}if(e.includes("FOREIGN KEY constraint failed"))return{type:a.FOREIGN_KEY_ERROR,message:"FOREIGN KEY constraint failed",details:{originalQuery:t}};if(e.includes("no such table")){let[,r]=e.match(/no such table: (\S+)/)||[];return{type:a.TABLE_NOT_FOUND,message:`Table not found: ${r||"unknown"}`,details:{originalQuery:t}}}if(e.includes("already exists")){let[,r]=e.match(/table (\w+) already exists/)||[];return{type:a.TABLE_EXISTS,message:`Table already exists: ${r||"unknown"}`,details:{originalQuery:t}}}return{type:a.EXECUTION_ERROR,message:e.replace(/:\s*SQLITE_\w+$/,"").trim()||"Failed to execute SQL command",details:{originalQuery:t}}}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[994,452,391,226],()=>r(8833));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/226.js","../../../chunks/391.js","../../../chunks/452.js","../../../chunks/638.js","../../../webpack-runtime.js","route_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../../node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../node_modules/better-sqlite3/lib/database.js","../../../../../node_modules/better-sqlite3/lib/index.js","../../../../../node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../node_modules/better-sqlite3/lib/methods/backup.js","../../../../../node_modules/better-sqlite3/lib/methods/function.js","../../../../../node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../node_modules/better-sqlite3/lib/methods/table.js","../../../../../node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../node_modules/better-sqlite3/lib/util.js","../../../../../node_modules/better-sqlite3/package.json","../../../../../node_modules/bindings/bindings.js","../../../../../node_modules/bindings/package.json","../../../../../node_modules/file-uri-to-path/index.js","../../../../../node_modules/file-uri-to-path/package.json","../../../../../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/487.js","../../../chunks/994.js","../../../webpack-runtime.js","route_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/query/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"4535","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/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-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/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-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-5f7522943fcb72a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-40ec07d04681ba81.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx":{"id":2624,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","576","static/chunks/576-18a2209e1ed26aad.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-f2bc307c0d8acdaa.js"],"async":false}},"entryCSSFiles":{"/Volumes/ProjectSpace/_wip/d1studio/src/":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/7c16f57d325d0d7d.css"}],"/Volumes/ProjectSpace/_wip/d1studio/src/app/page":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/query/route":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"2624":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/query/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"7098","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx":{"id":6311,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","803","static/chunks/803-a2fcfbd00e6b3b38.js","480","static/chunks/480-85b6c8ae3f51b156.js","974","static/chunks/app/page-358bf2112802ff85.js"],"async":false}},"entryCSSFiles":{"/Volumes/ProjectSpace/_wip/d1studio/src/":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/2c165a0ede9b2442.css"}],"/Volumes/ProjectSpace/_wip/d1studio/src/app/page":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/query/route":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -0,0 +1 @@
1
+ (()=>{var e={};e.id=47,e.ids=[47],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{"use strict";e.exports=require("buffer")},9646:e=>{"use strict";e.exports=require("child_process")},4735:e=>{"use strict";e.exports=require("events")},9021:e=>{"use strict";e.exports=require("fs")},9748:e=>{"use strict";e.exports=require("fs/promises")},1630:e=>{"use strict";e.exports=require("http")},5591:e=>{"use strict";e.exports=require("https")},1820:e=>{"use strict";e.exports=require("os")},3873:e=>{"use strict";e.exports=require("path")},7910:e=>{"use strict";e.exports=require("stream")},1204:e=>{"use strict";e.exports=require("string_decoder")},8354:e=>{"use strict";e.exports=require("util")},4075:e=>{"use strict";e.exports=require("zlib")},3024:e=>{"use strict";e.exports=require("node:fs")},6760:e=>{"use strict";e.exports=require("node:path")},1708:e=>{"use strict";e.exports=require("node:process")},3136:e=>{"use strict";e.exports=require("node:url")},8472:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>q,routeModule:()=>m,serverHooks:()=>h,workAsyncStorage:()=>x,workUnitAsyncStorage:()=>w});var s={};t.r(s),t.d(s,{GET:()=>f,OPTIONS:()=>g});var o=t(2706),a=t(8203),n=t(5994),i=t(9187),u=t(9646),c=t(8354),l=t(5949);let p=(0,c.promisify)(u.exec);async function d(e,r,t){let{stdout:s}=await p(`wrangler d1 execute ${e} --local --command="${r.replace(/"/g,'\\"')}" --json`,{cwd:t}),o=JSON.parse(s);return o[0]?.results||[]}async function f(e){try{let{searchParams:r}=new URL(e.url),t=r.get("db"),s=process.env.D1_PROJECT_DIR;if(!s)throw Error("Project directory not configured");let o=await (0,l.S)(s);if(!o?.config)throw Error("No Wrangler configuration found");let a=o.config;if(!a.d1_databases?.length)throw Error("No D1 databases configured");let n=t?a.d1_databases.find(e=>e.database_name===t):a.d1_databases[0];if(!n)throw Error(`Database not found: ${t}`);let u=n.database_name,c=(await d(u,"SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '_cf_%' ORDER BY name;",s)).map(e=>e.name),p=[];for(let e of c){let r=await d(u,`PRAGMA table_info(${e});`,s),t=await d(u,`PRAGMA foreign_key_list(${e});`,s);p.push({name:e,columns:r,foreignKeys:t})}return i.NextResponse.json({success:!0,tables:p})}catch(e){return i.NextResponse.json({success:!1,error:e.message},{status:500})}}async function g(){return new i.NextResponse(null,{status:204})}let m=new o.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/schema/route",pathname:"/api/schema",filename:"route",bundlePath:"app/api/schema/route"},resolvedPagePath:"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/schema/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:x,workUnitAsyncStorage:w,serverHooks:h}=m;function q(){return(0,n.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:w})}},6487:()=>{},8335:()=>{},5949:(e,r,t)=>{"use strict";t.d(r,{S:()=>l});var s=t(9748),o=t(3149),a=t(2537),n=t(6789),i=t(1804);let u=null,c=null;async function l(e){try{let r;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");if(u&&c===e)return u;let t=null,l=null;for(let r of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(t=await (0,o.dJ)(r,{cwd:e})){l=r;break}if(!t)return i.A.warn(`No Wrangler configuration file found in: ${e}`),null;i.A.info(`Found ${l} at: ${t}`);let p=await (0,s.readFile)(t,"utf-8");return l.endsWith(".toml")?r=(0,a.parse)(p):(l.endsWith(".jsonc")&&(p=(0,n.A)(p)),r=JSON.parse(p)),u={config:r,projectPath:e},c=e,u}catch(e){throw i.A.error(`Error reading Wrangler configuration: ${e.message}`),e}}},1804:(e,r,t)=>{"use strict";t.d(r,{A:()=>p});var s=t(6399);let{combine:o,timestamp:a,printf:n,colorize:i}=s.format,u="true"===process.env.DEBUG,c=n(({level:e,message:r,timestamp:t,...s})=>{let o=`${t} ${e}: ${r}`;return Object.keys(s).length>0&&(o+=` ${JSON.stringify(s)}`),o}),l=s.createLogger({level:u?"debug":"warn",format:o(a({format:"YYYY-MM-DD HH:mm:ss"}),i(),c),transports:[new s.transports.Console({level:u?"debug":"warn",silent:!1})]});l.logRequest=(e,r,t={})=>{l.debug(`Request: ${e} ${r}`,t)},l.logError=(e,r="unknown")=>{l.error(`Error in ${r}: ${e.message}`,{error:e.stack||e.message,source:r})},l.shouldLog=e=>{let r=l.level,t={error:0,warn:1,info:2,debug:3};return t[e]<=t[r]};let p=l}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[994,452,391],()=>t(8472));module.exports=s})();
@@ -0,0 +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/994.js","../../../webpack-runtime.js","route_client-reference-manifest.js"]}
@@ -0,0 +1 @@
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/schema/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"7098","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx":{"id":6311,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","803","static/chunks/803-a2fcfbd00e6b3b38.js","480","static/chunks/480-85b6c8ae3f51b156.js","974","static/chunks/app/page-358bf2112802ff85.js"],"async":false}},"entryCSSFiles":{"/Volumes/ProjectSpace/_wip/d1studio/src/":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/2c165a0ede9b2442.css"}],"/Volumes/ProjectSpace/_wip/d1studio/src/app/page":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/schema/route":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -0,0 +1 @@
1
+ (()=>{var e={};e.id=861,e.ids=[487,861],e.modules={7550:e=>{"use strict";e.exports=require("better-sqlite3")},846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{"use strict";e.exports=require("buffer")},9646:e=>{"use strict";e.exports=require("child_process")},5511:e=>{"use strict";e.exports=require("crypto")},4735:e=>{"use strict";e.exports=require("events")},9021:e=>{"use strict";e.exports=require("fs")},9748:e=>{"use strict";e.exports=require("fs/promises")},1630:e=>{"use strict";e.exports=require("http")},5591:e=>{"use strict";e.exports=require("https")},1820:e=>{"use strict";e.exports=require("os")},3873:e=>{"use strict";e.exports=require("path")},7910:e=>{"use strict";e.exports=require("stream")},1204:e=>{"use strict";e.exports=require("string_decoder")},8354:e=>{"use strict";e.exports=require("util")},4075:e=>{"use strict";e.exports=require("zlib")},3024:e=>{"use strict";e.exports=require("node:fs")},6760:e=>{"use strict";e.exports=require("node:path")},1708:e=>{"use strict";e.exports=require("node:process")},3136:e=>{"use strict";e.exports=require("node:url")},4862:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>y,routeModule:()=>b,serverHooks:()=>A,workAsyncStorage:()=>x,workUnitAsyncStorage:()=>E});var s={};t.r(s),t.d(s,{OPTIONS:()=>w,POST:()=>h});var n=t(2706),a=t(8203),i=t(5994),o=t(9187),l=t(5949),u=t(3648),c=t(8354),d=t(9646),p=t(3868),f=t(1804);let g=(0,c.promisify)(d.exec);async function m(e,r,t){let s=(0,p.executeLocalSQL)(r,t,e);if(null!==s)return JSON.parse(s);let n=t.database_name,{stdout:a}=await g(`wrangler d1 execute ${n} --local --command="${e.replace(/"/g,'\\"')}" --json`,{cwd:r});return JSON.parse(a)}async function h(e,r){try{let{name:t}=await r.params,{rows:s,db:n}=await e.json();if(!Array.isArray(s)||0===s.length)return o.NextResponse.json({success:!1,error:"No rows provided"},{status:400});let a=process.env.D1_PROJECT_DIR;if(!a)throw Error("Project directory not configured");let i=await (0,l.S)(a);if(!i?.config)throw Error("No Wrangler configuration found");let c=i.config;if(!c.d1_databases?.length)throw Error("No D1 databases configured");let d=n?c.d1_databases.find(e=>e.database_name===n):c.d1_databases[0];if(!d)throw Error(`Database not found: ${n}`);d.database_name;let p=(0,u.nZ)(t),g=Object.keys(s[0]).map(u.r0),h=0,w=[];for(let e=0;e<s.length;e+=100){let r=s.slice(e,e+100),t=r.map(e=>{let r=g.map(r=>{let t=e[Object.keys(s[0])[g.indexOf(r)]];return null==t||""===t?"NULL":"number"==typeof t?t:`'${String(t).replace(/'/g,"''")}'`});return`(${r.join(", ")})`}),n=`INSERT INTO ${p} (${g.join(", ")}) VALUES ${t.join(", ")};`;try{await m(n,a,d),h+=r.length}catch(r){f.A.error(`Import batch ${e}-${e+100} failed:`,r),w.push({batch:e,error:r.message})}}return o.NextResponse.json({success:!0,imported:h,failed:s.length-h,errors:w})}catch(e){return f.A.error("Import error:",e),o.NextResponse.json({success:!1,error:e.message},{status:500})}}async function w(){return new o.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let b=new n.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/tables/[name]/import/route",pathname:"/api/tables/[name]/import",filename:"route",bundlePath:"app/api/tables/[name]/import/route"},resolvedPagePath:"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/tables/[name]/import/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:x,workUnitAsyncStorage:E,serverHooks:A}=b;function y(){return(0,i.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:E})}},6487:()=>{},8335:()=>{},5949:(e,r,t)=>{"use strict";t.d(r,{S:()=>c});var s=t(9748),n=t(3149),a=t(2537),i=t(6789),o=t(1804);let l=null,u=null;async function c(e){try{let r;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");if(l&&u===e)return l;let t=null,c=null;for(let r of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(t=await (0,n.dJ)(r,{cwd:e})){c=r;break}if(!t)return o.A.warn(`No Wrangler configuration file found in: ${e}`),null;o.A.info(`Found ${c} at: ${t}`);let d=await (0,s.readFile)(t,"utf-8");return c.endsWith(".toml")?r=(0,a.parse)(d):(c.endsWith(".jsonc")&&(d=(0,i.A)(d)),r=JSON.parse(d)),l={config:r,projectPath:e},u=e,l}catch(e){throw o.A.error(`Error reading Wrangler configuration: ${e.message}`),e}}},3868:(e,r,t)=>{"use strict";t.d(r,{executeLocalSQL:()=>f,k5:()=>d,n3:()=>g,w1:()=>p});var s=t(5511),n=t(3873),a=t(9021),i=t(7550),o=t(1804);let l=n.join(".wrangler","state","v3","d1","miniflare-D1DatabaseObject"),u=new Map;function c(e,r){let t=n.join(e,l);if(!a.existsSync(t))return null;let{database_id:i,database_name:u,binding:c}=r,d=[i,u,c].filter(Boolean),p=["","miniflare-D1DatabaseObject:","D1DatabaseObject:","d1:"],f=d.flatMap(e=>p.map(r=>{var t;return t=`${r}${e}`,s.createHash("sha256").update(t).digest("hex")})).map(e=>n.join(t,`${e}.sqlite`)).find(e=>a.existsSync(e));if(f)return f;let g=a.readdirSync(t).filter(e=>e.endsWith(".sqlite")).map(e=>({name:e,fullPath:n.join(t,e),mtime:a.statSync(n.join(t,e)).mtimeMs})).sort((e,r)=>r.mtime-e.mtime);return 1===g.length?g[0].fullPath:(g.length>1&&o.A.debug(`[local-db] Multiple SQLite files, no hash matched — falling back to wrangler CLI. dir=${t}, tried ids=${JSON.stringify(d)}`),o.A.debug(`[local-db] No SQLite files found. dir=${t}, tried ids=${JSON.stringify(d)}`),null)}function d(e,r){return null!==c(e,r)}function p(e,r){let t=`${e}:${r.database_name}`,s=c(e,r);if(u.has(t)){let e=u.get(t);if(e.path!==s){try{e.db.close()}catch{}u.delete(t)}else try{return e.db.prepare("SELECT 1").get(),e.db}catch{u.delete(t)}}if(!s)return null;try{let e=new i(s,{fileMustExist:!1});return e.pragma("journal_mode = WAL"),e.pragma("foreign_keys = ON"),u.set(t,{db:e,path:s}),e}catch{return null}}function f(e,r,t){let s=p(e,r);if(!s)return null;let n=t.trim(),a=n.toUpperCase().replace(/\s+/g," "),i=n.split(";").map(e=>e.trim()).filter(Boolean);if(i.length>1){let e=[],r=0,t=0;return s.transaction(()=>{for(let n of i){let a=n.toUpperCase().replace(/\s+/g," ");if(a.startsWith("SELECT")||a.startsWith("PRAGMA")||a.startsWith("EXPLAIN")){let r=s.prepare(n).all();e=e.concat(r)}else{let e=s.prepare(n).run();r+=e.changes,t=e.lastInsertRowid}}})(),JSON.stringify([{results:e,success:!0,meta:{changes:r,last_row_id:t,rows_read:e.length,rows_written:r}}])}if(a.startsWith("SELECT")||a.startsWith("PRAGMA")||a.startsWith("EXPLAIN")){let e=s.prepare(n).all();return JSON.stringify([{results:e,success:!0,meta:{rows_read:e.length,rows_written:0,changed_db:!1}}])}let o=s.prepare(n).run();return JSON.stringify([{results:[],success:!0,meta:{changes:o.changes,last_row_id:o.lastInsertRowid,rows_read:0,rows_written:o.changes,changed_db:o.changes>0}}])}function g(e,r){let t=`${e}:${r}`,s=u.get(t);if(s){try{s.db.close()}catch{}u.delete(t)}}},1804:(e,r,t)=>{"use strict";t.d(r,{A:()=>d});var s=t(6399);let{combine:n,timestamp:a,printf:i,colorize:o}=s.format,l="true"===process.env.DEBUG,u=i(({level:e,message:r,timestamp:t,...s})=>{let n=`${t} ${e}: ${r}`;return Object.keys(s).length>0&&(n+=` ${JSON.stringify(s)}`),n}),c=s.createLogger({level:l?"debug":"warn",format:n(a({format:"YYYY-MM-DD HH:mm:ss"}),o(),u),transports:[new s.transports.Console({level:l?"debug":"warn",silent:!1})]});c.logRequest=(e,r,t={})=>{c.debug(`Request: ${e} ${r}`,t)},c.logError=(e,r="unknown")=>{c.error(`Error in ${r}: ${e.message}`,{error:e.stack||e.message,source:r})},c.shouldLog=e=>{let r=c.level,t={error:0,warn:1,info:2,debug:3};return t[e]<=t[r]};let d=c},3648:(e,r,t)=>{"use strict";function s(e){if(!e||"string"!=typeof e)throw Error("Table name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid table name: ${e}. Must start with letter or underscore and contain only letters, digits, and underscores.`);if(["SELECT","FROM","WHERE","INSERT","UPDATE","DELETE","CREATE","DROP","ALTER","TABLE","INDEX","VIEW","TRIGGER","PRAGMA","VACUUM","REINDEX","EXPLAIN","QUERY","PLAN","TRANSACTION","BEGIN","COMMIT","ROLLBACK"].includes(e.toUpperCase()))throw Error(`Table name cannot be a reserved word: ${e}`);return`"${e}"`}function n(e){if(!e||"string"!=typeof e)throw Error("Column name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid column name: ${e}. Must start with letter or underscore and contain only letters, digits, and underscores.`);return`"${e}"`}t.d(r,{nZ:()=>s,r0:()=>n})}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[994,452,391],()=>t(4862));module.exports=s})();
@@ -0,0 +1 @@
1
+ {"version":1,"files":["../../../../../../../node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../../../node_modules/better-sqlite3/lib/database.js","../../../../../../../node_modules/better-sqlite3/lib/index.js","../../../../../../../node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../../../node_modules/better-sqlite3/lib/methods/backup.js","../../../../../../../node_modules/better-sqlite3/lib/methods/function.js","../../../../../../../node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../../../node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../../../node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../../../node_modules/better-sqlite3/lib/methods/table.js","../../../../../../../node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../../../node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../../../node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../../../node_modules/better-sqlite3/lib/util.js","../../../../../../../node_modules/better-sqlite3/package.json","../../../../../../../node_modules/bindings/bindings.js","../../../../../../../node_modules/bindings/package.json","../../../../../../../node_modules/file-uri-to-path/index.js","../../../../../../../node_modules/file-uri-to-path/package.json","../../../../../../../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/994.js","../../../../../webpack-runtime.js","route_client-reference-manifest.js"]}
@@ -0,0 +1 @@
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/api/tables/[name]/import/route"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"7174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"7190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"3875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"8903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"4178","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"2652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"1365","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"7098","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"6959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/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-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","92","static/chunks/92-a84bdac2be7c8d7a.js","480","static/chunks/480-85b6c8ae3f51b156.js","177","static/chunks/app/layout-f0ec4d636ee0f763.js"],"async":false},"/Volumes/ProjectSpace/_wip/d1studio/src/app/page.jsx":{"id":6311,"name":"*","chunks":["692","static/chunks/692-9e59d546afd11ec3.js","803","static/chunks/803-a2fcfbd00e6b3b38.js","480","static/chunks/480-85b6c8ae3f51b156.js","974","static/chunks/app/page-358bf2112802ff85.js"],"async":false}},"entryCSSFiles":{"/Volumes/ProjectSpace/_wip/d1studio/src/":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/2c165a0ede9b2442.css"}],"/Volumes/ProjectSpace/_wip/d1studio/src/app/page":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/tables/route":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/tables/[name]/route":[],"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/tables/[name]/import/route":[]},"rscModuleMapping":{"33":{"*":{"id":"1831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"8530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"4863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"5155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"3164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"8921","name":"*","chunks":[],"async":false}},"6311":{"*":{"id":"8868","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"3219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
@@ -1,5 +1,5 @@
1
- (()=>{var e={};e.id=175,e.ids=[175],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{"use strict";e.exports=require("buffer")},9646:e=>{"use strict";e.exports=require("child_process")},4735:e=>{"use strict";e.exports=require("events")},9021:e=>{"use strict";e.exports=require("fs")},9748:e=>{"use strict";e.exports=require("fs/promises")},1630:e=>{"use strict";e.exports=require("http")},5591:e=>{"use strict";e.exports=require("https")},1820:e=>{"use strict";e.exports=require("os")},3873:e=>{"use strict";e.exports=require("path")},7910:e=>{"use strict";e.exports=require("stream")},1204:e=>{"use strict";e.exports=require("string_decoder")},8354:e=>{"use strict";e.exports=require("util")},4075:e=>{"use strict";e.exports=require("zlib")},643:e=>{"use strict";e.exports=require("node:fs")},4379:e=>{"use strict";e.exports=require("node:path")},1708:e=>{"use strict";e.exports=require("node:process")},3136:e=>{"use strict";e.exports=require("node:url")},7322:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>T,routeModule:()=>y,serverHooks:()=>$,workAsyncStorage:()=>R,workUnitAsyncStorage:()=>b});var s={};t.r(s),t.d(s,{GET:()=>A,OPTIONS:()=>q,dynamic:()=>w,runtime:()=>h});var n=t(2706),o=t(8203),a=t(5994),i=t(9187),u=t(8354),l=t(9646),c=t(5949),p=t(1804);class d{constructor(){this.queue=[],this.isProcessing=!1}async add(e){return new Promise((r,t)=>{this.queue.push({operation:e,resolve:r,reject:t}),this.processNext()})}async processNext(){if(this.isProcessing||0===this.queue.length)return;this.isProcessing=!0;let{operation:e,resolve:r,reject:t}=this.queue.shift();try{let t=await e();r(t)}catch(e){p.A.error("Error processing database queue operation:",e),t(e)}finally{this.isProcessing=!1,this.processNext()}}}let g=new d;var m=t(3648);let f=(0,u.promisify)(l.exec),h="nodejs",w="force-dynamic",E=!1;async function x(e,r,t){try{for(;E;)await new Promise(e=>setTimeout(e,100));E=!0;let{stdout:s}=await f(`wrangler d1 execute ${t} --local --command="${e.replace(/"/g,'\\"')}" --json`,{cwd:r}),n=JSON.parse(s);return n[0]?.results||[]}catch(e){throw p.A.error("Query execution error:",e),e}finally{E=!1}}async function A(e,r){return g.add(async()=>{try{let{name:t}=await r.params,{searchParams:s}=new URL(e.url),n=parseInt(s.get("page"))||1,o=parseInt(s.get("limit"))||50,a=(n-1)*o,u=process.env.D1_PROJECT_DIR;if(!u)throw Error("Project directory not configured");let l=await (0,c.S)(u);if(!l||!l.config)throw Error("No Wrangler configuration file found");let p=l.config;if(!p.d1_databases?.length)throw Error("No D1 databases configured");let d=p.d1_databases[0].database_name,g=(0,m.nZ)(t),f=`PRAGMA table_info(${g});`,h=await x(f,u,d),w=`SELECT sql FROM sqlite_master WHERE type='table' AND name='${t.replace(/'/g,"''")}';`,E=await x(w,u,d),A=E[0]?.sql||"",q=function(e){let r;let t={},s=/CHECK\s*\(\s*(\w+)\s+IN\s*\((.*?)\)\s*\)/gi;for(;null!==(r=s.exec(e));){let e=r[1],s=r[2].split(",").map(e=>e.trim().replace(/^'|'$/g,""));t[e]=s}return t}(A),y=h.map(e=>({...e,check:q[e.name]||null})),R=`SELECT COUNT(*) as total FROM ${g};`,b=await x(R,u,d),$=b[0]?.total||0,T=h.find(e=>1===e.pk)?.name||h[0]?.name,N=T?(0,m.r0)(T):"*",C=Math.max(1,Math.min(parseInt(o)||50,1e3)),P=Math.max(0,parseInt(a)||0),v=`
2
- SELECT * FROM ${g}
3
- ORDER BY ${N} DESC
4
- LIMIT ${C} OFFSET ${P};
5
- `,O=await x(v,u,d);return i.NextResponse.json({success:!0,schema:y,data:O,meta:{tableName:t,total:$,page:n,limit:o,totalPages:Math.ceil($/o),rowCount:O.length,columnCount:h.length}})}catch(e){return p.A.error("Error handling request:",e),i.NextResponse.json({success:!1,error:{message:e.message,details:e.stack}},{status:e.message.includes("not configured")?500:e.message.includes("not found")?404:500})}})}async function q(){return new i.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let y=new n.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/tables/[name]/route",pathname:"/api/tables/[name]",filename:"route",bundlePath:"app/api/tables/[name]/route"},resolvedPagePath:"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/tables/[name]/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:R,workUnitAsyncStorage:b,serverHooks:$}=y;function T(){return(0,a.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:b})}},6487:()=>{},8335:()=>{},5949:(e,r,t)=>{"use strict";t.d(r,{S:()=>c});var s=t(9748),n=t(3149),o=t(2537),a=t(6789),i=t(1804);let u=null,l=null;async function c(e){try{let r;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");if(u&&l===e)return u;let t=null,c=null;for(let r of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(t=await (0,n.dJ)(r,{cwd:e})){c=r;break}if(!t)return i.A.warn(`No Wrangler configuration file found in: ${e}`),null;i.A.info(`Found ${c} at: ${t}`);let p=await (0,s.readFile)(t,"utf-8");return c.endsWith(".toml")?r=(0,o.parse)(p):(c.endsWith(".jsonc")&&(p=(0,a.A)(p)),r=JSON.parse(p)),u={config:r,projectPath:e},l=e,u}catch(e){throw i.A.error(`Error reading Wrangler configuration: ${e.message}`),e}}},1804:(e,r,t)=>{"use strict";t.d(r,{A:()=>p});var s=t(6399);let{combine:n,timestamp:o,printf:a,colorize:i}=s.format,u="true"===process.env.DEBUG,l=a(({level:e,message:r,timestamp:t,...s})=>{let n=`${t} ${e}: ${r}`;return Object.keys(s).length>0&&(n+=` ${JSON.stringify(s)}`),n}),c=s.createLogger({level:u?"debug":"warn",format:n(o({format:"YYYY-MM-DD HH:mm:ss"}),i(),l),transports:[new s.transports.Console({level:u?"debug":"warn",silent:!1})]});c.logRequest=(e,r,t={})=>{c.debug(`Request: ${e} ${r}`,t)},c.logError=(e,r="unknown")=>{c.error(`Error in ${r}: ${e.message}`,{error:e.stack||e.message,source:r})},c.shouldLog=e=>{let r=c.level,t={error:0,warn:1,info:2,debug:3};return t[e]<=t[r]};let p=c},3648:(e,r,t)=>{"use strict";function s(e){if(!e||"string"!=typeof e)throw Error("Table name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid table name: ${e}. Must start with letter or underscore and contain only letters, digits, and underscores.`);if(["SELECT","FROM","WHERE","INSERT","UPDATE","DELETE","CREATE","DROP","ALTER","TABLE","INDEX","VIEW","TRIGGER","PRAGMA","VACUUM","REINDEX","EXPLAIN","QUERY","PLAN","TRANSACTION","BEGIN","COMMIT","ROLLBACK"].includes(e.toUpperCase()))throw Error(`Table name cannot be a reserved word: ${e}`);return`"${e}"`}function n(e){if(!e||"string"!=typeof e)throw Error("Column name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid column name: ${e}. Must start with letter or underscore and contain only letters, digits, and underscores.`);return`"${e}"`}t.d(r,{nZ:()=>s,r0:()=>n})}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,452,391],()=>t(7322));module.exports=s})();
1
+ (()=>{var e={};e.id=175,e.ids=[175,487],e.modules={7550:e=>{"use strict";e.exports=require("better-sqlite3")},846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9428:e=>{"use strict";e.exports=require("buffer")},9646:e=>{"use strict";e.exports=require("child_process")},5511:e=>{"use strict";e.exports=require("crypto")},4735:e=>{"use strict";e.exports=require("events")},9021:e=>{"use strict";e.exports=require("fs")},9748:e=>{"use strict";e.exports=require("fs/promises")},1630:e=>{"use strict";e.exports=require("http")},5591:e=>{"use strict";e.exports=require("https")},1820:e=>{"use strict";e.exports=require("os")},3873:e=>{"use strict";e.exports=require("path")},7910:e=>{"use strict";e.exports=require("stream")},1204:e=>{"use strict";e.exports=require("string_decoder")},8354:e=>{"use strict";e.exports=require("util")},4075:e=>{"use strict";e.exports=require("zlib")},3024:e=>{"use strict";e.exports=require("node:fs")},6760:e=>{"use strict";e.exports=require("node:path")},1708:e=>{"use strict";e.exports=require("node:process")},3136:e=>{"use strict";e.exports=require("node:url")},7322:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>b,routeModule:()=>A,serverHooks:()=>S,workAsyncStorage:()=>y,workUnitAsyncStorage:()=>x});var s={};r.r(s),r.d(s,{GET:()=>_,OPTIONS:()=>T,dynamic:()=>N,runtime:()=>h});var a=r(2706),n=r(8203),i=r(5994),o=r(9187),l=r(8354),u=r(9646),c=r(5949),d=r(1804);class p{constructor(){this.queue=[],this.isProcessing=!1}async add(e){return new Promise((t,r)=>{this.queue.push({operation:e,resolve:t,reject:r}),this.processNext()})}async processNext(){if(this.isProcessing||0===this.queue.length)return;this.isProcessing=!0;let{operation:e,resolve:t,reject:r}=this.queue.shift();try{let r=await e();t(r)}catch(e){d.A.error("Error processing database queue operation:",e),r(e)}finally{this.isProcessing=!1,this.processNext()}}}let f=new p;var m=r(3868),E=r(7074),g=r(3648);let R=(0,l.promisify)(u.exec),h="nodejs",N="force-dynamic",O=!1;async function w(e,t,r){let s=(0,m.executeLocalSQL)(t,r,e);if(null!==s){let e=JSON.parse(s);return e[0]?.results||[]}let a=r.database_name;try{for(;O;)await new Promise(e=>setTimeout(e,100));O=!0;let{stdout:r}=await R(`wrangler d1 execute ${a} --local --command="${e.replace(/"/g,'\\"')}" --json`,{cwd:t}),s=JSON.parse(r);return s[0]?.results||[]}catch(e){throw e}finally{O=!1}}async function _(e,t){return f.add(async()=>{try{let{name:r}=await t.params,{searchParams:s}=new URL(e.url),a=parseInt(s.get("page"))||1,n=parseInt(s.get("limit"))||50,i=(a-1)*n,l="true"===s.get("export"),u=s.get("db"),d=process.env.D1_PROJECT_DIR;if(!d)throw Error("Project directory not configured");let p=await (0,c.S)(d);if(!p||!p.config)throw Error("No Wrangler configuration file found");let f=p.config;if(!f.d1_databases?.length)throw Error("No D1 databases configured");let m=u?f.d1_databases.find(e=>e.database_name===u):f.d1_databases[0];if(!m)throw Error(`Database not found: ${u}`);m.database_name;let E=(0,g.nZ)(r),R=`PRAGMA table_info(${E});`,h=await w(R,d,m),N=`SELECT sql FROM sqlite_master WHERE type='table' AND name='${r.replace(/'/g,"''")}';`,O=await w(N,d,m),_=O[0]?.sql||"",T=function(e){let t;let r={},s=/CHECK\s*\(\s*(\w+)\s+IN\s*\((.*?)\)\s*\)/gi;for(;null!==(t=s.exec(e));){let e=t[1],s=t[2].split(",").map(e=>e.trim().replace(/^'|'$/g,""));r[e]=s}return r}(_),A=h.map(e=>({...e,check:T[e.name]||null})),y=`SELECT COUNT(*) as total FROM ${E};`,x=await w(y,d,m),S=x[0]?.total||0,b=h.find(e=>1===e.pk)?.name||h[0]?.name,C=b?(0,g.r0)(b):"*",I=l?Math.max(1,parseInt(n)||99999):Math.max(1,Math.min(parseInt(n)||50,1e3)),$=Math.max(0,parseInt(i)||0),L=`
2
+ SELECT * FROM ${E}
3
+ ORDER BY ${C} DESC
4
+ LIMIT ${I} OFFSET ${$};
5
+ `,U=await w(L,d,m);return o.NextResponse.json({success:!0,schema:A,data:U,meta:{tableName:r,total:S,page:a,limit:n,totalPages:Math.ceil(S/n),rowCount:U.length,columnCount:h.length}})}catch(t){let e=(0,E.s)(t);return d.A.error(`✗ ${e.message}`),o.NextResponse.json({success:!1,error:{message:e.message}},{status:t.message.includes("not configured")?500:t.message.includes("not found")?404:500})}})}async function T(){return new o.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let A=new a.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/tables/[name]/route",pathname:"/api/tables/[name]",filename:"route",bundlePath:"app/api/tables/[name]/route"},resolvedPagePath:"/Volumes/ProjectSpace/_wip/d1studio/src/app/api/tables/[name]/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:y,workUnitAsyncStorage:x,serverHooks:S}=A;function b(){return(0,i.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:x})}},6487:()=>{},8335:()=>{},5949:(e,t,r)=>{"use strict";r.d(t,{S:()=>c});var s=r(9748),a=r(3149),n=r(2537),i=r(6789),o=r(1804);let l=null,u=null;async function c(e){try{let t;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");if(l&&u===e)return l;let r=null,c=null;for(let t of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(r=await (0,a.dJ)(t,{cwd:e})){c=t;break}if(!r)return o.A.warn(`No Wrangler configuration file found in: ${e}`),null;o.A.info(`Found ${c} at: ${r}`);let d=await (0,s.readFile)(r,"utf-8");return c.endsWith(".toml")?t=(0,n.parse)(d):(c.endsWith(".jsonc")&&(d=(0,i.A)(d)),t=JSON.parse(d)),l={config:t,projectPath:e},u=e,l}catch(e){throw o.A.error(`Error reading Wrangler configuration: ${e.message}`),e}}},3868:(e,t,r)=>{"use strict";r.d(t,{executeLocalSQL:()=>f,k5:()=>d,n3:()=>m,w1:()=>p});var s=r(5511),a=r(3873),n=r(9021),i=r(7550),o=r(1804);let l=a.join(".wrangler","state","v3","d1","miniflare-D1DatabaseObject"),u=new Map;function c(e,t){let r=a.join(e,l);if(!n.existsSync(r))return null;let{database_id:i,database_name:u,binding:c}=t,d=[i,u,c].filter(Boolean),p=["","miniflare-D1DatabaseObject:","D1DatabaseObject:","d1:"],f=d.flatMap(e=>p.map(t=>{var r;return r=`${t}${e}`,s.createHash("sha256").update(r).digest("hex")})).map(e=>a.join(r,`${e}.sqlite`)).find(e=>n.existsSync(e));if(f)return f;let m=n.readdirSync(r).filter(e=>e.endsWith(".sqlite")).map(e=>({name:e,fullPath:a.join(r,e),mtime:n.statSync(a.join(r,e)).mtimeMs})).sort((e,t)=>t.mtime-e.mtime);return 1===m.length?m[0].fullPath:(m.length>1&&o.A.debug(`[local-db] Multiple SQLite files, no hash matched — falling back to wrangler CLI. dir=${r}, tried ids=${JSON.stringify(d)}`),o.A.debug(`[local-db] No SQLite files found. dir=${r}, tried ids=${JSON.stringify(d)}`),null)}function d(e,t){return null!==c(e,t)}function p(e,t){let r=`${e}:${t.database_name}`,s=c(e,t);if(u.has(r)){let e=u.get(r);if(e.path!==s){try{e.db.close()}catch{}u.delete(r)}else try{return e.db.prepare("SELECT 1").get(),e.db}catch{u.delete(r)}}if(!s)return null;try{let e=new i(s,{fileMustExist:!1});return e.pragma("journal_mode = WAL"),e.pragma("foreign_keys = ON"),u.set(r,{db:e,path:s}),e}catch{return null}}function f(e,t,r){let s=p(e,t);if(!s)return null;let a=r.trim(),n=a.toUpperCase().replace(/\s+/g," "),i=a.split(";").map(e=>e.trim()).filter(Boolean);if(i.length>1){let e=[],t=0,r=0;return s.transaction(()=>{for(let a of i){let n=a.toUpperCase().replace(/\s+/g," ");if(n.startsWith("SELECT")||n.startsWith("PRAGMA")||n.startsWith("EXPLAIN")){let t=s.prepare(a).all();e=e.concat(t)}else{let e=s.prepare(a).run();t+=e.changes,r=e.lastInsertRowid}}})(),JSON.stringify([{results:e,success:!0,meta:{changes:t,last_row_id:r,rows_read:e.length,rows_written:t}}])}if(n.startsWith("SELECT")||n.startsWith("PRAGMA")||n.startsWith("EXPLAIN")){let e=s.prepare(a).all();return JSON.stringify([{results:e,success:!0,meta:{rows_read:e.length,rows_written:0,changed_db:!1}}])}let o=s.prepare(a).run();return JSON.stringify([{results:[],success:!0,meta:{changes:o.changes,last_row_id:o.lastInsertRowid,rows_read:0,rows_written:o.changes,changed_db:o.changes>0}}])}function m(e,t){let r=`${e}:${t}`,s=u.get(r);if(s){try{s.db.close()}catch{}u.delete(r)}}},1804:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var s=r(6399);let{combine:a,timestamp:n,printf:i,colorize:o}=s.format,l="true"===process.env.DEBUG,u=i(({level:e,message:t,timestamp:r,...s})=>{let a=`${r} ${e}: ${t}`;return Object.keys(s).length>0&&(a+=` ${JSON.stringify(s)}`),a}),c=s.createLogger({level:l?"debug":"warn",format:a(n({format:"YYYY-MM-DD HH:mm:ss"}),o(),u),transports:[new s.transports.Console({level:l?"debug":"warn",silent:!1})]});c.logRequest=(e,t,r={})=>{c.debug(`Request: ${e} ${t}`,r)},c.logError=(e,t="unknown")=>{c.error(`Error in ${t}: ${e.message}`,{error:e.stack||e.message,source:t})},c.shouldLog=e=>{let t=c.level,r={error:0,warn:1,info:2,debug:3};return r[e]<=r[t]};let d=c},7074:(e,t,r)=>{"use strict";r.d(t,{s:()=>a});let s={SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",TABLE_NOT_FOUND:"TABLE_NOT_FOUND",TABLE_EXISTS:"TABLE_EXISTS",FOREIGN_KEY_ERROR:"FOREIGN_KEY_ERROR",UNIQUE_CONSTRAINT_ERROR:"UNIQUE_CONSTRAINT_ERROR",NOT_NULL_CONSTRAINT_ERROR:"NOT_NULL_CONSTRAINT_ERROR",CHECK_CONSTRAINT_ERROR:"CHECK_CONSTRAINT_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};function a(e){if(!e)return{type:s.UNKNOWN_ERROR,message:"An unknown error occurred",details:{}};let t=null,r=e.cmd||e.details&&e.details.command;if(r){let e=r.match(/--command="(.+?)"\s*--json/s);e&&(t=e[1].replace(/\\n/g,"\n").replace(/\\"/g,'"'))}let a=e.stdout||e.details&&e.details.stdout;if(a)try{let e=JSON.parse(a.trim()),s=e?.error?.text||"";if(s)return n(s,t,r)}catch{}let i=e.stderr||e.details&&e.details.stderr;if(i)return n(i.replace(/\x1B\[[0-9;]*[a-zA-Z]/g,""),t,r);let o=e.message||e.details&&e.details.originalError||"";return o?n(o,t,r):{type:s.UNKNOWN_ERROR,message:e.message||"An unknown error occurred",details:{}}}function n(e,t,r){if(e.includes("env: node: No such file or directory"))return{type:s.EXECUTION_ERROR,message:"Node.js not found — ensure Node.js is installed and in PATH",details:{originalQuery:t}};let a=e.match(/near "([^"]+)": syntax error(?:\s+at offset (\d+))?/);if(a){let[,e,r]=a;return{type:s.SYNTAX_ERROR,message:`Syntax error near "${e}"${r?` at position ${r}`:""}`,details:{originalQuery:t,errorLocation:{near:e,offset:r?parseInt(r):null}}}}if(e.includes("UNIQUE constraint failed")){let[,r]=e.match(/UNIQUE constraint failed: ([\w.]+)/)||[];return{type:s.UNIQUE_CONSTRAINT_ERROR,message:`UNIQUE constraint failed: ${r||"unknown column"}`,details:{originalQuery:t}}}if(e.includes("NOT NULL constraint failed")){let[,r]=e.match(/NOT NULL constraint failed: ([\w.]+)/)||[];return{type:s.NOT_NULL_CONSTRAINT_ERROR,message:`NOT NULL constraint failed: ${r||"unknown column"}`,details:{originalQuery:t}}}if(e.includes("CHECK constraint failed")){let[,r]=e.match(/CHECK constraint failed: (\S+)/)||[];return{type:s.CHECK_CONSTRAINT_ERROR,message:`CHECK constraint failed: ${r||"unknown constraint"}`,details:{originalQuery:t}}}if(e.includes("FOREIGN KEY constraint failed"))return{type:s.FOREIGN_KEY_ERROR,message:"FOREIGN KEY constraint failed",details:{originalQuery:t}};if(e.includes("no such table")){let[,r]=e.match(/no such table: (\S+)/)||[];return{type:s.TABLE_NOT_FOUND,message:`Table not found: ${r||"unknown"}`,details:{originalQuery:t}}}if(e.includes("already exists")){let[,r]=e.match(/table (\w+) already exists/)||[];return{type:s.TABLE_EXISTS,message:`Table already exists: ${r||"unknown"}`,details:{originalQuery:t}}}return{type:s.EXECUTION_ERROR,message:e.replace(/:\s*SQLITE_\w+$/,"").trim()||"Failed to execute SQL command",details:{originalQuery:t}}}},3648:(e,t,r)=>{"use strict";function s(e){if(!e||"string"!=typeof e)throw Error("Table name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid table name: ${e}. Must start with letter or underscore and contain only letters, digits, and underscores.`);if(["SELECT","FROM","WHERE","INSERT","UPDATE","DELETE","CREATE","DROP","ALTER","TABLE","INDEX","VIEW","TRIGGER","PRAGMA","VACUUM","REINDEX","EXPLAIN","QUERY","PLAN","TRANSACTION","BEGIN","COMMIT","ROLLBACK"].includes(e.toUpperCase()))throw Error(`Table name cannot be a reserved word: ${e}`);return`"${e}"`}function a(e){if(!e||"string"!=typeof e)throw Error("Column name must be a non-empty string");if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid column name: ${e}. Must start with letter or underscore and contain only letters, digits, and underscores.`);return`"${e}"`}r.d(t,{nZ:()=>s,r0:()=>a})}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[994,452,391],()=>r(7322));module.exports=s})();