d1s 0.2.11 → 0.2.13

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 (318) hide show
  1. package/dist/.next/.next/BUILD_ID +1 -1
  2. package/dist/.next/.next/app-build-manifest.json +28 -28
  3. package/dist/.next/.next/app-path-routes-manifest.json +1 -1
  4. package/dist/.next/.next/build-manifest.json +3 -3
  5. package/dist/.next/.next/cache/.rscinfo +1 -1
  6. package/dist/.next/.next/cache/.tsbuildinfo +1 -1
  7. package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/dist/.next/.next/cache/webpack/client-production/1.pack +0 -0
  9. package/dist/.next/.next/cache/webpack/client-production/10.pack +0 -0
  10. package/dist/.next/.next/cache/webpack/client-production/11.pack +0 -0
  11. package/dist/.next/.next/cache/webpack/client-production/12.pack +0 -0
  12. package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
  13. package/dist/.next/.next/cache/webpack/client-production/3.pack +0 -0
  14. package/dist/.next/.next/cache/webpack/client-production/4.pack +0 -0
  15. package/dist/.next/.next/cache/webpack/client-production/5.pack +0 -0
  16. package/dist/.next/.next/cache/webpack/client-production/6.pack +0 -0
  17. package/dist/.next/.next/cache/webpack/client-production/7.pack +0 -0
  18. package/dist/.next/.next/cache/webpack/client-production/8.pack +0 -0
  19. package/dist/.next/.next/cache/webpack/client-production/9.pack +0 -0
  20. package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
  21. package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
  22. package/dist/.next/.next/cache/webpack/edge-server-production/index.pack +0 -0
  23. package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
  24. package/dist/.next/.next/cache/webpack/server-production/1.pack +0 -0
  25. package/dist/.next/.next/cache/webpack/server-production/2.pack +0 -0
  26. package/dist/.next/.next/cache/webpack/server-production/3.pack +0 -0
  27. package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
  28. package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
  29. package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
  30. package/dist/.next/.next/next-server.js.nft.json +1 -1
  31. package/dist/.next/.next/prerender-manifest.json +1 -1
  32. package/dist/.next/.next/required-server-files.json +1 -1
  33. package/dist/.next/.next/server/app/_not-found/page.js +1 -1
  34. package/dist/.next/.next/server/app/_not-found/page.js.nft.json +1 -1
  35. package/dist/.next/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  36. package/dist/.next/.next/server/app/_not-found.html +1 -1
  37. package/dist/.next/.next/server/app/_not-found.rsc +4 -4
  38. package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
  39. package/dist/.next/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  40. package/dist/.next/.next/server/app/api/databases/route.js +1 -1
  41. package/dist/.next/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  42. package/dist/.next/.next/server/app/api/migrations/sync/route.js +5 -5
  43. package/dist/.next/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  44. package/dist/.next/.next/server/app/api/migrations/sync-files/route.js +3 -3
  45. package/dist/.next/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  46. package/dist/.next/.next/server/app/api/pull-data/confirm/route.js +1 -1
  47. package/dist/.next/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -1
  48. package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +2 -2
  49. package/dist/.next/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  50. package/dist/.next/.next/server/app/api/pull-remote/preview/route.js +4 -4
  51. package/dist/.next/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  52. package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +5 -5
  53. package/dist/.next/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  54. package/dist/.next/.next/server/app/api/push-remote/preview/route.js +4 -4
  55. package/dist/.next/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  56. package/dist/.next/.next/server/app/api/query/route.js +3 -3
  57. package/dist/.next/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  58. package/dist/.next/.next/server/app/api/tables/[name]/route.js +5 -5
  59. package/dist/.next/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  60. package/dist/.next/.next/server/app/api/tables/route.js +2 -2
  61. package/dist/.next/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  62. package/dist/.next/.next/server/app/api/update/route.js +1 -1
  63. package/dist/.next/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  64. package/dist/.next/.next/server/app/index.html +2 -2
  65. package/dist/.next/.next/server/app/index.rsc +5 -5
  66. package/dist/.next/.next/server/app/page.js +7 -7
  67. package/dist/.next/.next/server/app/page.js.nft.json +1 -1
  68. package/dist/.next/.next/server/app/page_client-reference-manifest.js +1 -1
  69. package/dist/.next/.next/server/app-paths-manifest.json +1 -1
  70. package/dist/.next/.next/server/chunks/226.js +12 -12
  71. package/dist/.next/.next/server/chunks/391.js +1 -1
  72. package/dist/.next/.next/server/chunks/572.js +1 -0
  73. package/dist/.next/.next/server/chunks/992.js +3 -3
  74. package/dist/.next/.next/server/middleware-build-manifest.js +1 -1
  75. package/dist/.next/.next/server/next-font-manifest.js +1 -1
  76. package/dist/.next/.next/server/next-font-manifest.json +1 -1
  77. package/dist/.next/.next/server/pages/404.html +1 -1
  78. package/dist/.next/.next/server/pages/500.html +1 -1
  79. package/dist/.next/.next/server/server-reference-manifest.json +1 -1
  80. package/dist/.next/.next/static/chunks/{576-c4daf274bb6469a1.js → 576-18a2209e1ed26aad.js} +1 -1
  81. package/dist/.next/.next/static/chunks/{92-c4466e0f1ca8a3a8.js → 92-5f7522943fcb72a8.js} +1 -1
  82. package/dist/.next/.next/static/chunks/app/{layout-be6ee67cf0c92654.js → layout-40ec07d04681ba81.js} +1 -1
  83. package/dist/.next/.next/static/chunks/app/page-f05cd0fc436bf9bc.js +1 -0
  84. package/dist/.next/.next/static/chunks/app/page-f2bc307c0d8acdaa.js +1 -0
  85. package/dist/.next/.next/static/chunks/{main-app-fa35024de9bd9284.js → main-app-4506e88db72db4b7.js} +1 -1
  86. package/dist/.next/.next/static/css/{9f6c25c5400f83d3.css → 7c16f57d325d0d7d.css} +1 -1
  87. package/dist/.next/.next/static/ejYPqJ2kVicVp5EFWOZIC/_buildManifest.js +1 -0
  88. package/dist/.next/.next/static/ejYPqJ2kVicVp5EFWOZIC/_ssgManifest.js +1 -0
  89. package/dist/.next/.next/static/gABGrAoO8IPArDo_Ns_7g/_buildManifest.js +1 -0
  90. package/dist/.next/.next/static/gABGrAoO8IPArDo_Ns_7g/_ssgManifest.js +1 -0
  91. package/dist/.next/.next/static/gh-QfIUVo4FTTduYCVKT6/_buildManifest.js +1 -0
  92. package/dist/.next/.next/static/gh-QfIUVo4FTTduYCVKT6/_ssgManifest.js +1 -0
  93. package/dist/.next/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  94. package/dist/.next/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  95. package/dist/.next/.next/static/thaCy2qVeNqYYhdayr13C/_buildManifest.js +1 -0
  96. package/dist/.next/.next/static/thaCy2qVeNqYYhdayr13C/_ssgManifest.js +1 -0
  97. package/dist/.next/.next/static/ybCx6L6gHqtODbKmlhU-d/_buildManifest.js +1 -0
  98. package/dist/.next/.next/static/ybCx6L6gHqtODbKmlhU-d/_ssgManifest.js +1 -0
  99. package/dist/.next/.next/trace +3 -3
  100. package/dist/.next/.next/types/app/api/cloudflare/route.ts +1 -1
  101. package/dist/.next/.next/types/app/api/databases/route.ts +1 -1
  102. package/dist/.next/.next/types/app/api/migrations/sync/route.ts +1 -1
  103. package/dist/.next/.next/types/app/api/migrations/sync-files/route.ts +1 -1
  104. package/dist/.next/.next/types/app/api/pull-data/confirm/route.ts +1 -1
  105. package/dist/.next/.next/types/app/api/pull-remote/confirm/route.ts +1 -1
  106. package/dist/.next/.next/types/app/api/pull-remote/preview/route.ts +1 -1
  107. package/dist/.next/.next/types/app/api/push-remote/confirm/route.ts +1 -1
  108. package/dist/.next/.next/types/app/api/push-remote/preview/route.ts +1 -1
  109. package/dist/.next/.next/types/app/api/query/route.ts +1 -1
  110. package/dist/.next/.next/types/app/api/tables/[name]/route.ts +1 -1
  111. package/dist/.next/.next/types/app/api/tables/route.ts +1 -1
  112. package/dist/.next/.next/types/app/api/update/route.ts +1 -1
  113. package/dist/.next/.next/types/app/page.ts +1 -1
  114. package/dist/.next/BUILD_ID +1 -1
  115. package/dist/.next/app-build-manifest.json +28 -28
  116. package/dist/.next/app-path-routes-manifest.json +1 -1
  117. package/dist/.next/build-manifest.json +3 -3
  118. package/dist/.next/cache/.rscinfo +1 -1
  119. package/dist/.next/cache/.tsbuildinfo +1 -1
  120. package/dist/.next/cache/webpack/client-production/0.pack +0 -0
  121. package/dist/.next/cache/webpack/client-production/1.pack +0 -0
  122. package/dist/.next/cache/webpack/client-production/2.pack +0 -0
  123. package/dist/.next/cache/webpack/client-production/index.pack +0 -0
  124. package/dist/.next/cache/webpack/client-production/index.pack.old +0 -0
  125. package/dist/.next/cache/webpack/edge-server-production/index.pack +0 -0
  126. package/dist/.next/cache/webpack/server-production/0.pack +0 -0
  127. package/dist/.next/cache/webpack/server-production/index.pack +0 -0
  128. package/dist/.next/next-minimal-server.js.nft.json +1 -1
  129. package/dist/.next/next-server.js.nft.json +1 -1
  130. package/dist/.next/prerender-manifest.json +1 -1
  131. package/dist/.next/required-server-files.json +1 -1
  132. package/dist/.next/server/app/_not-found/page.js +1 -1
  133. package/dist/.next/server/app/_not-found/page.js.nft.json +1 -1
  134. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  135. package/dist/.next/server/app/_not-found.html +1 -1
  136. package/dist/.next/server/app/_not-found.rsc +4 -4
  137. package/dist/.next/server/app/api/cloudflare/route.js +1 -1
  138. package/dist/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
  139. package/dist/.next/server/app/api/databases/route.js +1 -1
  140. package/dist/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
  141. package/dist/.next/server/app/api/migrations/sync/route.js +5 -5
  142. package/dist/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
  143. package/dist/.next/server/app/api/migrations/sync-files/route.js +3 -3
  144. package/dist/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
  145. package/dist/.next/server/app/api/pull-data/confirm/route.js +1 -1
  146. package/dist/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -1
  147. package/dist/.next/server/app/api/pull-remote/confirm/route.js +2 -2
  148. package/dist/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
  149. package/dist/.next/server/app/api/pull-remote/preview/route.js +4 -4
  150. package/dist/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
  151. package/dist/.next/server/app/api/push-remote/confirm/route.js +5 -5
  152. package/dist/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
  153. package/dist/.next/server/app/api/push-remote/preview/route.js +4 -4
  154. package/dist/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
  155. package/dist/.next/server/app/api/query/route.js +3 -3
  156. package/dist/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
  157. package/dist/.next/server/app/api/tables/[name]/route.js +5 -5
  158. package/dist/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
  159. package/dist/.next/server/app/api/tables/route.js +2 -2
  160. package/dist/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
  161. package/dist/.next/server/app/api/update/route.js +1 -1
  162. package/dist/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  163. package/dist/.next/server/app/index.html +2 -2
  164. package/dist/.next/server/app/index.rsc +5 -5
  165. package/dist/.next/server/app/page.js +7 -7
  166. package/dist/.next/server/app/page.js.nft.json +1 -1
  167. package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
  168. package/dist/.next/server/app-paths-manifest.json +1 -1
  169. package/dist/.next/server/chunks/226.js +12 -12
  170. package/dist/.next/server/chunks/391.js +1 -1
  171. package/dist/.next/server/chunks/572.js +1 -0
  172. package/dist/.next/server/chunks/992.js +3 -3
  173. package/dist/.next/server/middleware-build-manifest.js +1 -1
  174. package/dist/.next/server/next-font-manifest.js +1 -1
  175. package/dist/.next/server/next-font-manifest.json +1 -1
  176. package/dist/.next/server/pages/404.html +1 -1
  177. package/dist/.next/server/pages/500.html +1 -1
  178. package/dist/.next/server/server-reference-manifest.json +1 -1
  179. package/dist/.next/static/IX-QLbm7scYnyqWeeimal/_buildManifest.js +1 -0
  180. package/dist/.next/static/IX-QLbm7scYnyqWeeimal/_ssgManifest.js +1 -0
  181. package/dist/.next/static/chunks/{576-c4daf274bb6469a1.js → 576-18a2209e1ed26aad.js} +1 -1
  182. package/dist/.next/static/chunks/{92-c4466e0f1ca8a3a8.js → 92-5f7522943fcb72a8.js} +1 -1
  183. package/dist/.next/static/chunks/app/{layout-be6ee67cf0c92654.js → layout-40ec07d04681ba81.js} +1 -1
  184. package/dist/.next/static/chunks/app/page-f05cd0fc436bf9bc.js +1 -0
  185. package/dist/.next/static/chunks/{main-app-fa35024de9bd9284.js → main-app-4506e88db72db4b7.js} +1 -1
  186. package/dist/.next/static/css/{9f6c25c5400f83d3.css → 7c16f57d325d0d7d.css} +1 -1
  187. package/dist/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  188. package/dist/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  189. package/dist/.next/trace +3 -14
  190. package/dist/.next/types/app/api/cloudflare/route.ts +1 -1
  191. package/dist/.next/types/app/api/databases/route.ts +1 -1
  192. package/dist/.next/types/app/api/migrations/sync/route.ts +1 -1
  193. package/dist/.next/types/app/api/migrations/sync-files/route.ts +1 -1
  194. package/dist/.next/types/app/api/pull-data/confirm/route.ts +1 -1
  195. package/dist/.next/types/app/api/pull-remote/confirm/route.ts +1 -1
  196. package/dist/.next/types/app/api/pull-remote/preview/route.ts +1 -1
  197. package/dist/.next/types/app/api/push-remote/confirm/route.ts +1 -1
  198. package/dist/.next/types/app/api/push-remote/preview/route.ts +1 -1
  199. package/dist/.next/types/app/api/query/route.ts +1 -1
  200. package/dist/.next/types/app/api/tables/[name]/route.ts +1 -1
  201. package/dist/.next/types/app/api/tables/route.ts +1 -1
  202. package/dist/.next/types/app/api/update/route.ts +1 -1
  203. package/dist/.next/types/app/page.ts +1 -1
  204. package/dist/app/api/tables/[name]/route.js +22 -10
  205. package/dist/app/globals.css +39 -0
  206. package/dist/d1-studio.js +2 -2
  207. package/dist/lib/data-type-handlers.js +426 -0
  208. package/dist/lib/sql-operations.js +32 -8
  209. package/dist/lib/sql-sanitizer.js +233 -0
  210. package/package.json +3 -9
  211. package/dist/.next/.next/server/chunks/90.js +0 -1
  212. package/dist/.next/.next/static/chunks/app/page-36ed30b2266617f3.js +0 -1
  213. package/dist/.next/server/chunks/90.js +0 -1
  214. package/dist/.next/static/chunks/app/page-36ed30b2266617f3.js +0 -1
  215. package/dist/app/app/api/cloudflare/route.js +0 -150
  216. package/dist/app/app/api/databases/route.js +0 -71
  217. package/dist/app/app/api/migrations/sync/route.js +0 -174
  218. package/dist/app/app/api/migrations/sync-files/route.js +0 -172
  219. package/dist/app/app/api/pull-data/confirm/route.js +0 -230
  220. package/dist/app/app/api/pull-remote/confirm/route.js +0 -278
  221. package/dist/app/app/api/pull-remote/preview/route.js +0 -144
  222. package/dist/app/app/api/push-remote/confirm/route.js +0 -196
  223. package/dist/app/app/api/push-remote/preview/route.js +0 -179
  224. package/dist/app/app/api/query/route.js +0 -168
  225. package/dist/app/app/api/tables/[name]/route.js +0 -174
  226. package/dist/app/app/api/tables/route.js +0 -178
  227. package/dist/app/app/api/update/route.js +0 -45
  228. package/dist/app/app/globals.css +0 -93
  229. package/dist/app/app/layout.jsx +0 -35
  230. package/dist/app/app/page.jsx +0 -34
  231. package/next.config.mjs +0 -18
  232. package/postcss.config.mjs +0 -8
  233. package/scripts/studio.js +0 -199
  234. package/scripts/test.js +0 -366
  235. package/src/app/api/cloudflare/route.js +0 -150
  236. package/src/app/api/databases/route.js +0 -71
  237. package/src/app/api/migrations/sync/route.js +0 -174
  238. package/src/app/api/migrations/sync-files/route.js +0 -172
  239. package/src/app/api/pull-data/confirm/route.js +0 -230
  240. package/src/app/api/pull-remote/confirm/route.js +0 -278
  241. package/src/app/api/pull-remote/preview/route.js +0 -144
  242. package/src/app/api/push-remote/confirm/route.js +0 -196
  243. package/src/app/api/push-remote/preview/route.js +0 -179
  244. package/src/app/api/query/route.js +0 -168
  245. package/src/app/api/tables/[name]/route.js +0 -174
  246. package/src/app/api/tables/route.js +0 -178
  247. package/src/app/api/update/route.js +0 -45
  248. package/src/app/globals.css +0 -93
  249. package/src/app/layout.jsx +0 -35
  250. package/src/app/page.jsx +0 -34
  251. package/src/components/cloudflare-credentials-modal.jsx +0 -94
  252. package/src/components/column-selector.jsx +0 -133
  253. package/src/components/column-sorting.jsx +0 -65
  254. package/src/components/delete-records-dialog.jsx +0 -64
  255. package/src/components/download-button.jsx +0 -205
  256. package/src/components/edit-error-alert.jsx +0 -30
  257. package/src/components/editable-cell.jsx +0 -163
  258. package/src/components/editable-row.jsx +0 -169
  259. package/src/components/environment-handler.jsx +0 -332
  260. package/src/components/environment-select.jsx +0 -62
  261. package/src/components/pull-preview-toast.jsx +0 -215
  262. package/src/components/push-error-alert.jsx +0 -72
  263. package/src/components/push-preview-toast.jsx +0 -183
  264. package/src/components/query-results.jsx +0 -112
  265. package/src/components/refresh-button.jsx +0 -61
  266. package/src/components/resize-columns.jsx +0 -101
  267. package/src/components/sidebar.jsx +0 -254
  268. package/src/components/sql-editor.jsx +0 -411
  269. package/src/components/sql-error-display.jsx +0 -167
  270. package/src/components/sync-migrations-button.jsx +0 -87
  271. package/src/components/table-error-dialog.jsx +0 -65
  272. package/src/components/table-toolbar.jsx +0 -285
  273. package/src/components/table-view.jsx +0 -843
  274. package/src/components/ui/alert.jsx +0 -47
  275. package/src/components/ui/button.jsx +0 -48
  276. package/src/components/ui/card.jsx +0 -50
  277. package/src/components/ui/checkbox.jsx +0 -24
  278. package/src/components/ui/collapsible.jsx +0 -11
  279. package/src/components/ui/dialog.jsx +0 -96
  280. package/src/components/ui/dropdown-menu.jsx +0 -158
  281. package/src/components/ui/input.jsx +0 -19
  282. package/src/components/ui/scroll-area.jsx +0 -40
  283. package/src/components/ui/select.jsx +0 -121
  284. package/src/components/ui/separator.jsx +0 -25
  285. package/src/components/ui/sheet.jsx +0 -109
  286. package/src/components/ui/sidebar.jsx +0 -620
  287. package/src/components/ui/skeleton.jsx +0 -14
  288. package/src/components/ui/table.jsx +0 -86
  289. package/src/components/ui/tabs.jsx +0 -43
  290. package/src/components/ui/toast.jsx +0 -86
  291. package/src/components/ui/toaster.jsx +0 -35
  292. package/src/components/ui/tooltip.jsx +0 -28
  293. package/src/components/update-banner.jsx +0 -93
  294. package/src/context/database-context.js +0 -510
  295. package/src/hooks/use-mobile.jsx +0 -19
  296. package/src/hooks/use-sql-error.ts +0 -23
  297. package/src/hooks/use-toast.js +0 -155
  298. package/src/lib/database-queue.js +0 -37
  299. package/src/lib/error.js +0 -20
  300. package/src/lib/find-wrangler-config.js +0 -74
  301. package/src/lib/license.js +0 -99
  302. package/src/lib/logger.js +0 -58
  303. package/src/lib/migrations.js +0 -415
  304. package/src/lib/parse-sql-error.js +0 -200
  305. package/src/lib/request-deduplication.js +0 -24
  306. package/src/lib/schema-operations.js +0 -106
  307. package/src/lib/sql-error-types.js +0 -14
  308. package/src/lib/sql-operations.js +0 -647
  309. package/src/lib/utils.js +0 -6
  310. package/src/lib/version-utils.js +0 -34
  311. /package/dist/.next/.next/static/{OUHnbB-64afrrZQL0Srn5 → FEsQ9jwPUQv5A3fwg6Opl}/_buildManifest.js +0 -0
  312. /package/dist/.next/.next/static/{OUHnbB-64afrrZQL0Srn5 → FEsQ9jwPUQv5A3fwg6Opl}/_ssgManifest.js +0 -0
  313. /package/dist/.next/.next/static/{ZBTCAyp1kO5FdEHMU-Dw2 → Y9mYu4WBghepP5oT_3OdR}/_buildManifest.js +0 -0
  314. /package/dist/.next/.next/static/{ZBTCAyp1kO5FdEHMU-Dw2 → Y9mYu4WBghepP5oT_3OdR}/_ssgManifest.js +0 -0
  315. /package/dist/.next/.next/static/{bHYW7fgIBDF8-Q33_WPoE → ae3gNmoSGm-R5LJC4UagI}/_buildManifest.js +0 -0
  316. /package/dist/.next/.next/static/{bHYW7fgIBDF8-Q33_WPoE → ae3gNmoSGm-R5LJC4UagI}/_ssgManifest.js +0 -0
  317. /package/dist/.next/{static/ZBTCAyp1kO5FdEHMU-Dw2 → .next/static/bKfUJeuvAQlBmR3TjrfkH}/_buildManifest.js +0 -0
  318. /package/dist/.next/{static/ZBTCAyp1kO5FdEHMU-Dw2 → .next/static/bKfUJeuvAQlBmR3TjrfkH}/_ssgManifest.js +0 -0
@@ -1,169 +0,0 @@
1
- // components/editable-row.jsx
2
- 'use client';
3
-
4
- import React, { useState } from 'react';
5
- import { TableRow, TableCell } from '@/components/ui/table';
6
- import { Input } from '@/components/ui/input';
7
- import { Checkbox } from '@/components/ui/checkbox';
8
- import { Trash2 } from 'lucide-react';
9
- import { Button } from '@/components/ui/button';
10
- import {
11
- Select,
12
- SelectContent,
13
- SelectItem,
14
- SelectTrigger,
15
- SelectValue,
16
- } from "@/components/ui/select";
17
-
18
- function cleanValue(value) {
19
- return typeof value === 'string' ? value.replace(/^'|'$/g, '') : value;
20
- }
21
-
22
- export function EditableRow({
23
- schema,
24
- onRemove,
25
- onChange,
26
- showCheckbox = false,
27
- initialData = {}
28
- }) {
29
- const [rowData, setRowData] = useState(() => {
30
- return schema.reduce((acc, col) => {
31
- let defaultValue = initialData[col.name] ?? null;
32
- defaultValue = cleanValue(defaultValue);
33
-
34
- if (defaultValue === null) {
35
- if (col.dflt_value) {
36
- defaultValue = cleanValue(col.dflt_value);
37
- } else if (col.type.toUpperCase() === 'INTEGER') {
38
- defaultValue = '';
39
- } else if (col.type.toUpperCase() === 'TEXT') {
40
- defaultValue = '';
41
- }
42
- }
43
-
44
- acc[col.name] = defaultValue;
45
- return acc;
46
- }, {});
47
- });
48
-
49
- const handleChange = (column, value) => {
50
- const newData = { ...rowData, [column]: value };
51
- setRowData(newData);
52
- onChange?.(newData);
53
- };
54
-
55
- const isBoolean = (col) => {
56
- const type = col.type?.toLowerCase() || '';
57
- return type === 'boolean' ||
58
- type === 'bool' ||
59
- (type === 'integer' && col.name.toLowerCase().startsWith('is_'));
60
- };
61
-
62
- return (
63
- <TableRow className="bg-orange-50/50">
64
- <TableCell className="w-10 p-0">
65
- <div className="pl-1 flex items-center">
66
- {showCheckbox ? (
67
- <Checkbox disabled />
68
- ) : (
69
- <Button
70
- variant="ghost"
71
- size="icon"
72
- className="h-8 w-8 text-orange-700 hover:text-orange-800"
73
- onClick={onRemove}
74
- >
75
- <Trash2 className="h-4 w-4" />
76
- </Button>
77
- )}
78
- </div>
79
- </TableCell>
80
- {schema.map((col) => {
81
- const isPrimaryKey = col.pk === 1;
82
- const allowedValues = col.check || null;
83
-
84
- // Handle boolean fields
85
- if (isBoolean(col)) {
86
- // Parse default value from schema
87
- let defaultBoolValue = 'false';
88
- if (col.dflt_value !== null && col.dflt_value !== undefined) {
89
- // Handle different formats of default values
90
- const dfltVal = col.dflt_value.toString().toLowerCase();
91
- defaultBoolValue = (
92
- dfltVal === '1' ||
93
- dfltVal === 'true' ||
94
- dfltVal === "'true'" ||
95
- dfltVal === '"true"'
96
- ) ? 'true' : 'false';
97
- }
98
-
99
- // Use rowData if it exists, otherwise use default
100
- const currentValue = rowData[col.name] !== null && rowData[col.name] !== undefined
101
- ? (rowData[col.name] === 1 || rowData[col.name] === true || rowData[col.name] === 'true' ? 'true' : 'false')
102
- : defaultBoolValue;
103
-
104
- return (
105
- <TableCell key={col.name} className="border-x border-neutral-200 p-0">
106
- <div className="w-full">
107
- <Select
108
- value={currentValue}
109
- onValueChange={(value) => handleChange(col.name, value === 'true' ? 1 : 0)}
110
- // Removed disabled={isPrimaryKey} to allow editing
111
- >
112
- <SelectTrigger
113
- className="w-full h-9 min-w-0 rounded-none border-0 bg-orange-50 text-orange-900"
114
- title={`Default: ${defaultBoolValue}`}
115
- >
116
- <SelectValue placeholder={`Select ${col.name}`} />
117
- </SelectTrigger>
118
- <SelectContent className="min-w-[8rem]">
119
- <SelectItem value="true">true</SelectItem>
120
- <SelectItem value="false">false</SelectItem>
121
- </SelectContent>
122
- </Select>
123
- </div>
124
- </TableCell>
125
- );
126
- }
127
-
128
- // Handle fields with check constraints
129
- if (allowedValues?.length > 0) {
130
- return (
131
- <TableCell key={col.name} className="border-x border-neutral-200 p-0">
132
- <div className="w-full">
133
- <Select
134
- value={rowData[col.name] ?? allowedValues[0]}
135
- onValueChange={(value) => handleChange(col.name, value)}
136
- // Removed disabled={isPrimaryKey} to allow editing
137
- >
138
- <SelectTrigger className="w-full h-9 min-w-0 rounded-none border-0 bg-orange-50 text-orange-900">
139
- <SelectValue placeholder={`Select ${col.name}`} />
140
- </SelectTrigger>
141
- <SelectContent className="min-w-[8rem]">
142
- {allowedValues.map(value => (
143
- <SelectItem key={value} value={value}>
144
- {value}
145
- </SelectItem>
146
- ))}
147
- </SelectContent>
148
- </Select>
149
- </div>
150
- </TableCell>
151
- );
152
- }
153
-
154
- // Default input for other fields (primary key input is now editable)
155
- return (
156
- <TableCell key={col.name} className="border-x border-neutral-200 p-0">
157
- <Input
158
- value={rowData[col.name] ?? ''}
159
- onChange={(e) => handleChange(col.name, e.target.value)}
160
- className="w-full min-w-0 rounded-none border-0 px-2 bg-orange-50 text-orange-900"
161
- placeholder={isPrimaryKey ? 'Auto-generated' : `Enter ${col.name}`}
162
- // Removed disabled={isPrimaryKey} so primary key can be edited
163
- />
164
- </TableCell>
165
- );
166
- })}
167
- </TableRow>
168
- );
169
- }
@@ -1,332 +0,0 @@
1
- // components/environemtn-handler.jsx
2
- "use client";
3
-
4
- import { useState } from "react";
5
- import { useToast } from "@/hooks/use-toast";
6
- import { useDatabase } from "@/context/database-context";
7
- import PushPreviewToast from "./push-preview-toast";
8
- import PullPreviewToast from "./pull-preview-toast";
9
-
10
- const ErrorTypes = {
11
- FOREIGN_KEY_ERROR: "FOREIGN_KEY_ERROR",
12
- TABLE_EXISTS: "TABLE_EXISTS",
13
- CONNECTION_ERROR: "CONNECTION_ERROR",
14
- CONFIG_ERROR: "CONFIG_ERROR",
15
- PULL_ERROR: "PULL_ERROR"
16
- };
17
-
18
- export function useEnvironmentController() {
19
- const [isConnecting, setIsConnecting] = useState(false);
20
- const [isPushing, setIsPushing] = useState(false);
21
- // New state for data pull status
22
- const [isDataPulling, setIsDataPulling] = useState(false);
23
- const [showPreview, setShowPreview] = useState(false);
24
- const [previewData, setPreviewData] = useState(null);
25
- const [previewError, setPreviewError] = useState(null);
26
- const [previewType, setPreviewType] = useState(null);
27
- const [previewSuccess, setPreviewSuccess] = useState(null);
28
- const [environment, setEnvironment] = useState('local');
29
- const { toast } = useToast();
30
- const { refreshTables } = useDatabase();
31
-
32
- const clearPreviewState = () => {
33
- setShowPreview(false);
34
- setPreviewData(null);
35
- setPreviewError(null);
36
- setPreviewType(null);
37
- setPreviewSuccess(null);
38
- };
39
-
40
- // Validate stored credentials
41
- const validateStoredCredentials = async () => {
42
- const storedCreds = localStorage.getItem("cf_credentials");
43
- if (!storedCreds) return null;
44
- try {
45
- const credentials = JSON.parse(storedCreds);
46
- const response = await fetch("/api/cloudflare", {
47
- method: "POST",
48
- headers: { "Content-Type": "application/json" },
49
- body: JSON.stringify(credentials)
50
- });
51
- if (!response.ok) throw new Error("Invalid stored credentials");
52
- const data = await response.json();
53
- return { ...credentials, databaseId: data.database.id };
54
- } catch (error) {
55
- console.error("Failed to validate stored credentials:", error);
56
- localStorage.removeItem("cf_credentials");
57
- return null;
58
- }
59
- };
60
-
61
- // Push to remote preview
62
- const pushToRemote = async () => {
63
- try {
64
- setPreviewType("push");
65
- setShowPreview(true);
66
- setIsPushing(true);
67
- setPreviewError(null);
68
- setPreviewSuccess(null);
69
- setPreviewData({ preview: [] }); // show loading state
70
-
71
- const credentials = await validateStoredCredentials();
72
- if (!credentials) throw new Error('No valid credentials found');
73
-
74
- const response = await fetch('/api/push-remote/preview', {
75
- method: 'POST',
76
- headers: { 'Content-Type': 'application/json' },
77
- body: JSON.stringify(credentials)
78
- });
79
-
80
- const data = await response.json();
81
- if (!data.success) {
82
- throw new Error(data.error?.message || 'Failed to generate preview');
83
- }
84
-
85
- setPreviewData(data.details.details);
86
- } catch (error) {
87
- console.error('Push to remote preview failed:', error);
88
- setPreviewError(error);
89
- toast({
90
- title: "Preview Failed",
91
- description: error.message || 'Failed to generate preview',
92
- variant: "destructive",
93
- });
94
- } finally {
95
- setIsPushing(false);
96
- }
97
- };
98
-
99
- // Update the confirmPush function:
100
- const confirmPush = async () => {
101
- try {
102
- setIsPushing(true);
103
- setPreviewError(null);
104
- setPreviewSuccess(null);
105
-
106
- const credentials = await validateStoredCredentials();
107
- if (!credentials) throw new Error("No valid credentials found");
108
-
109
- const response = await fetch("/api/push-remote/confirm", {
110
- method: "POST",
111
- headers: { "Content-Type": "application/json" },
112
- body: JSON.stringify(credentials)
113
- });
114
-
115
- const data = await response.json();
116
- if (!data.success) {
117
- throw new Error(data.error?.message || 'Failed to confirm push');
118
- }
119
-
120
- // Update the preview data to show applied status
121
- setPreviewData(prev => ({
122
- ...prev,
123
- preview: prev.preview.map(item => ({
124
- ...item,
125
- action: item.action === 'will be applied' ? 'applied' : item.action
126
- }))
127
- }));
128
-
129
- setPreviewSuccess(`Applied ${data.details.applied} migration(s), skipped ${data.details.skipped}.`);
130
-
131
- // Reset environment after success
132
- setEnvironment('local');
133
- } catch (error) {
134
- console.error("Push to remote confirm failed:", error);
135
- setPreviewError(error);
136
- // Reset environment after error
137
- setEnvironment('local');
138
- } finally {
139
- setIsPushing(false);
140
- }
141
- };
142
-
143
- // Pull to remote preview
144
- const pullToRemotePreview = async () => {
145
- try {
146
- setPreviewType("pull");
147
- setShowPreview(true);
148
- setIsPushing(true);
149
- setPreviewError(null);
150
- setPreviewSuccess(null);
151
- setPreviewData({ preview: [] }); // show loading state
152
-
153
- const credentials = await validateStoredCredentials();
154
- if (!credentials) throw new Error("No valid credentials found");
155
-
156
- const response = await fetch('/api/pull-remote/preview', {
157
- method: 'POST',
158
- headers: { 'Content-Type': 'application/json' },
159
- body: JSON.stringify(credentials)
160
- });
161
- const data = await response.json();
162
- if (!data.success) {
163
- throw new Error(data.error?.message || 'Failed to generate pull preview');
164
- }
165
- setPreviewData(data.details);
166
- } catch (error) {
167
- console.error('Pull to remote preview failed:', error);
168
- setPreviewError(error);
169
- toast({
170
- title: "Preview Failed",
171
- description: error.message || 'Failed to generate pull preview',
172
- variant: "destructive",
173
- });
174
- } finally {
175
- setIsPushing(false);
176
- }
177
- };
178
-
179
- // In confirmPull function, add environment reset:
180
- const confirmPull = async () => {
181
- try {
182
- setIsPushing(true);
183
- setEnvironment('pull'); // Ensure correct state during pull
184
- setPreviewError(null);
185
- setPreviewSuccess(null);
186
-
187
- const credentials = await validateStoredCredentials();
188
- if (!credentials) throw new Error("No valid credentials found");
189
-
190
- const response = await fetch("/api/pull-remote/confirm", {
191
- method: "POST",
192
- headers: { "Content-Type": "application/json" },
193
- body: JSON.stringify(credentials)
194
- });
195
-
196
- const data = await response.json();
197
- if (!data.success) {
198
- throw new Error(data.error?.message || 'Failed to confirm pull');
199
- }
200
-
201
- setPreviewSuccess(`Pull migrations applied successfully.`);
202
-
203
- setPreviewData(prev => ({
204
- ...prev,
205
- preview: prev.preview.map(item => ({
206
- ...item,
207
- action: item.action === 'will be applied' ? 'applied' : item.action
208
- }))
209
- }));
210
-
211
- await refreshTables();
212
-
213
- } catch (error) {
214
- console.error("Pull to remote confirm failed:", error);
215
- setPreviewError(error);
216
- } finally {
217
- setIsPushing(false);
218
- setEnvironment('local'); // Reset to local regardless of success/failure
219
- }
220
- };
221
-
222
- // In confirmDataPull function, add syncing state:
223
- const confirmDataPull = async () => {
224
- try {
225
- setIsDataPulling(true);
226
- setEnvironment('syncing'); // Set environment to syncing during data pull
227
- setPreviewError(null);
228
- setPreviewSuccess(null);
229
-
230
- const credentials = await validateStoredCredentials();
231
- if (!credentials) throw new Error("No valid credentials found");
232
-
233
- const response = await fetch("/api/pull-data/confirm", {
234
- method: "POST",
235
- headers: { "Content-Type": "application/json" },
236
- body: JSON.stringify(credentials)
237
- });
238
-
239
- const data = await response.json();
240
- if (!data.success) {
241
- throw new Error(data.error?.message || 'Failed to confirm data pull');
242
- }
243
-
244
- setPreviewSuccess("Remote data synced successfully.");
245
- await refreshTables();
246
-
247
- } catch (error) {
248
- console.error("Data pull confirm failed:", error);
249
- setPreviewError(error);
250
- } finally {
251
- setIsDataPulling(false);
252
- setEnvironment('local'); // Reset to local regardless of success/failure
253
- }
254
- };
255
-
256
- // Connect to Cloudflare
257
- async function connectToCloudflare(credentials) {
258
- try {
259
- setIsConnecting(true);
260
- const response = await fetch("/api/cloudflare", {
261
- method: "POST",
262
- headers: { "Content-Type": "application/json" },
263
- body: JSON.stringify(credentials)
264
- });
265
- const data = await response.json();
266
- if (!response.ok) throw new Error(data.error || "Failed to connect to Cloudflare");
267
- localStorage.setItem("cf_credentials", JSON.stringify({
268
- ...credentials,
269
- databaseId: data.database.id
270
- }));
271
- toast({
272
- title: "Connected to Cloudflare",
273
- description: `Connected to database: ${data.database.name}`,
274
- variant: "default"
275
- });
276
- } catch (error) {
277
- toast({
278
- title: "Connection Failed",
279
- description: error.message || "Failed to connect to Cloudflare",
280
- variant: "destructive"
281
- });
282
- throw error;
283
- } finally {
284
- setIsConnecting(false);
285
- }
286
- }
287
-
288
- // Update PreviewUI to pass onDataPull and isDataPulling for pull previews.
289
- const PreviewUI = showPreview && (
290
- previewType === "pull" ? (
291
- <PullPreviewToast
292
- preview={previewData?.preview || []}
293
- onConfirm={confirmPull}
294
- onDataPull={confirmDataPull} // pass the new data pull handler
295
- onCancel={clearPreviewState}
296
- isConfirming={isPushing}
297
- isDataPulling={isDataPulling}
298
- error={previewError}
299
- success={previewSuccess}
300
- isLoading={isPushing && !previewData?.preview?.length}
301
- />
302
- ) : (
303
- <PushPreviewToast
304
- preview={previewData?.preview || []}
305
- onConfirm={confirmPush}
306
- onCancel={clearPreviewState}
307
- isConfirming={isPushing}
308
- error={previewError}
309
- success={previewSuccess}
310
- isLoading={isPushing && !previewData?.preview?.length}
311
- />
312
- )
313
- );
314
-
315
- return {
316
- isConnecting,
317
- isPushing,
318
- isDataPulling,
319
- showPreview,
320
- previewError,
321
- environment, // Add this
322
- setEnvironment, // Add this if needed
323
- pushToRemote,
324
- pullToRemotePreview,
325
- confirmPull,
326
- confirmDataPull, // export the new function
327
- connectToCloudflare,
328
- validateStoredCredentials,
329
- PreviewUI
330
- };
331
- }
332
-
@@ -1,62 +0,0 @@
1
- import {
2
- Select,
3
- SelectContent,
4
- SelectItem,
5
- SelectTrigger,
6
- SelectValue
7
- } from '@/components/ui/select';
8
- import { HardDrive, Download, Upload, Loader2 } from 'lucide-react';
9
-
10
- export function EnvironmentSelect({
11
- value,
12
- onValueChange,
13
- isLoading,
14
- disabled,
15
- showPreview
16
- }) {
17
- return (
18
- <Select
19
- value={value}
20
- onValueChange={onValueChange}
21
- disabled={disabled || isLoading || showPreview}
22
- >
23
- <SelectTrigger className="w-full bg-white border-neutral-200 font-medium">
24
- <div className="flex items-center gap-1 text-sm">
25
- {isLoading || showPreview ? (
26
- <>
27
- <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
28
- <span className="text-muted-foreground font-medium">
29
- {value === "pull" ? "Pulling..." :
30
- value === "syncing" ? "Syncing..." :
31
- value === "production" ? "Pushing..." :
32
- "Loading..."}
33
- </span>
34
- </>
35
- ) : (
36
- <SelectValue placeholder="Environment" className="w-full" />
37
- )}
38
- </div>
39
- </SelectTrigger>
40
- <SelectContent>
41
- <SelectItem value="local">
42
- <div className="flex items-center gap-2">
43
- <HardDrive className="h-4 w-4" />
44
- <span>Local</span>
45
- </div>
46
- </SelectItem>
47
- <SelectItem value="pull">
48
- <div className="flex items-center gap-2">
49
- <Download className="h-4 w-4" />
50
- <span>Pull remote</span>
51
- </div>
52
- </SelectItem>
53
- <SelectItem value="production">
54
- <div className="flex items-center gap-2">
55
- <Upload className="h-4 w-4" />
56
- <span>Push remote</span>
57
- </div>
58
- </SelectItem>
59
- </SelectContent>
60
- </Select>
61
- );
62
- }