d1s 0.2.6 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/.next/.next/BUILD_ID +1 -1
- package/dist/.next/.next/app-build-manifest.json +38 -24
- package/dist/.next/.next/app-path-routes-manifest.json +1 -1
- package/dist/.next/.next/build-manifest.json +2 -2
- package/dist/.next/.next/cache/.rscinfo +1 -1
- package/dist/.next/.next/cache/.tsbuildinfo +1 -1
- package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/1.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/dist/.next/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
- package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/.next/.next/next-server.js.nft.json +1 -1
- package/dist/.next/.next/prerender-manifest.json +1 -1
- package/dist/.next/.next/server/app/_not-found/page.js +1 -1
- package/dist/.next/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/_not-found.html +1 -1
- package/dist/.next/.next/server/app/_not-found.rsc +4 -4
- package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
- package/dist/.next/.next/server/app/api/cloudflare/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/databases/route.js +1 -1
- package/dist/.next/.next/server/app/api/databases/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync/route.js +28 -3
- package/dist/.next/.next/server/app/api/migrations/sync/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync-files/route.js +26 -1
- package/dist/.next/.next/server/app/api/migrations/sync-files/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/pull-data/confirm/route.js +1 -0
- package/dist/.next/.next/server/app/api/pull-data/confirm/route.js.nft.json +1 -0
- package/dist/.next/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -0
- package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +26 -1
- package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/preview/route.js +26 -1
- package/dist/.next/.next/server/app/api/pull-remote/preview/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +28 -3
- package/dist/.next/.next/server/app/api/push-remote/confirm/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/push-remote/preview/route.js +28 -3
- package/dist/.next/.next/server/app/api/push-remote/preview/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/query/route.js +27 -2
- package/dist/.next/.next/server/app/api/query/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/tables/[name]/route.js +4 -4
- package/dist/.next/.next/server/app/api/tables/[name]/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/tables/route.js +2 -2
- package/dist/.next/.next/server/app/api/tables/route.js.nft.json +1 -1
- package/dist/.next/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/update/route.js +5 -0
- package/dist/.next/.next/server/app/api/update/route.js.nft.json +1 -0
- package/dist/.next/.next/server/app/api/update/route_client-reference-manifest.js +1 -0
- package/dist/.next/.next/server/app/index.html +3 -3
- package/dist/.next/.next/server/app/index.rsc +5 -5
- package/dist/.next/.next/server/app/page.js +13 -11
- package/dist/.next/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app-paths-manifest.json +5 -3
- package/dist/.next/.next/server/chunks/226.js +30 -0
- package/dist/.next/.next/server/chunks/336.js +1 -1
- package/dist/.next/.next/server/chunks/391.js +23 -0
- package/dist/.next/.next/server/chunks/452.js +1 -0
- package/dist/.next/.next/server/chunks/627.js +3 -3
- package/dist/.next/.next/server/chunks/638.js +3 -3
- package/dist/.next/.next/server/chunks/992.js +3 -3
- package/dist/.next/.next/server/pages/404.html +1 -1
- package/dist/.next/.next/server/pages/500.html +1 -1
- package/dist/.next/.next/server/pages/_app.js +1 -1
- package/dist/.next/.next/server/pages/_document.js +1 -1
- package/dist/.next/.next/server/pages/_error.js +1 -1
- package/dist/.next/.next/server/server-reference-manifest.json +1 -1
- package/dist/.next/.next/static/7XBqETNmhSxMXhw8iUpEa/_buildManifest.js +1 -0
- package/dist/.next/.next/static/chunks/176-9146975ef8699719.js +1 -0
- package/dist/.next/.next/static/chunks/{735-c9144179c6bd7d06.js → 735-b885dfec6353171d.js} +1 -1
- package/dist/.next/.next/static/chunks/app/api/cloudflare/route-b77846f372b01f38.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/databases/route-407794f8145d9a0b.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/migrations/sync/route-9f480f5590369a8f.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/migrations/sync-files/route-92010db279b4dd8e.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/pull-data/confirm/route-a02fe6d3cdd0a535.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/pull-remote/confirm/route-f401a03507d1da50.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/pull-remote/preview/route-3c53814b5cb8b6b0.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-8f359249e907c63b.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/push-remote/preview/route-b51bf94f39c17a9d.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/query/route-87bae2d4aebaf859.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/tables/[name]/route-d20ca163b9c03e7c.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/tables/route-0f46f911562abcdf.js +1 -0
- package/dist/.next/.next/static/chunks/app/api/update/route-14edc1917760bce0.js +1 -0
- package/dist/.next/.next/static/chunks/app/page-5990cb23b8bd27c4.js +1 -0
- package/dist/.next/.next/static/css/674bee6608c638e4.css +3 -0
- package/dist/.next/.next/trace +3 -3
- package/dist/.next/.next/types/app/api/pull-data/confirm/route.ts +347 -0
- package/dist/.next/.next/types/app/api/update/route.ts +347 -0
- package/dist/.next/BUILD_ID +1 -1
- package/dist/.next/app-build-manifest.json +36 -22
- package/dist/.next/app-path-routes-manifest.json +1 -1
- package/dist/.next/build-manifest.json +2 -2
- package/dist/.next/cache/.rscinfo +1 -1
- package/dist/.next/cache/.tsbuildinfo +1 -1
- package/dist/.next/cache/webpack/client-production/0.pack +0 -0
- package/dist/.next/cache/webpack/client-production/index.pack +0 -0
- package/dist/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/dist/.next/cache/webpack/server-production/0.pack +0 -0
- package/dist/.next/cache/webpack/server-production/index.pack +0 -0
- package/dist/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/.next/next-server.js.nft.json +1 -1
- package/dist/.next/prerender-manifest.json +1 -1
- package/dist/.next/server/app/_not-found/page.js +1 -1
- package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/_not-found.html +1 -1
- package/dist/.next/server/app/_not-found.rsc +4 -4
- package/dist/.next/server/app/api/cloudflare/route.js +1 -1
- package/dist/.next/server/app/api/cloudflare/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/cloudflare/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/databases/route.js +1 -1
- package/dist/.next/server/app/api/databases/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/databases/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/migrations/sync/route.js +28 -3
- package/dist/.next/server/app/api/migrations/sync/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/migrations/sync/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/migrations/sync-files/route.js +26 -1
- package/dist/.next/server/app/api/migrations/sync-files/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/migrations/sync-files/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/pull-data/confirm/route.js +1 -0
- package/dist/.next/server/app/api/pull-data/confirm/route.js.nft.json +1 -0
- package/dist/.next/server/app/api/pull-data/confirm/route_client-reference-manifest.js +1 -0
- package/dist/.next/server/app/api/pull-remote/confirm/route.js +26 -1
- package/dist/.next/server/app/api/pull-remote/confirm/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/pull-remote/confirm/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/pull-remote/preview/route.js +26 -1
- package/dist/.next/server/app/api/pull-remote/preview/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/pull-remote/preview/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/push-remote/confirm/route.js +28 -3
- package/dist/.next/server/app/api/push-remote/confirm/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/push-remote/confirm/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/push-remote/preview/route.js +28 -3
- package/dist/.next/server/app/api/push-remote/preview/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/push-remote/preview/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/query/route.js +27 -2
- package/dist/.next/server/app/api/query/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/query/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/tables/[name]/route.js +4 -4
- package/dist/.next/server/app/api/tables/[name]/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/tables/[name]/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/tables/route.js +2 -2
- package/dist/.next/server/app/api/tables/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/tables/route_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/api/update/route.js +5 -0
- package/dist/.next/server/app/api/update/route.js.nft.json +1 -0
- package/dist/.next/server/app/api/update/route_client-reference-manifest.js +1 -0
- package/dist/.next/server/app/index.html +3 -3
- package/dist/.next/server/app/index.rsc +5 -5
- package/dist/.next/server/app/page.js +13 -11
- package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app-paths-manifest.json +8 -6
- package/dist/.next/server/chunks/226.js +30 -0
- package/dist/.next/server/chunks/336.js +1 -1
- package/dist/.next/server/chunks/391.js +23 -0
- package/dist/.next/server/chunks/452.js +1 -0
- package/dist/.next/server/chunks/627.js +3 -3
- package/dist/.next/server/chunks/638.js +3 -3
- package/dist/.next/server/chunks/992.js +3 -3
- package/dist/.next/server/pages/404.html +1 -1
- package/dist/.next/server/pages/500.html +1 -1
- package/dist/.next/server/pages/_app.js +1 -1
- package/dist/.next/server/pages/_document.js +1 -1
- package/dist/.next/server/pages/_error.js +1 -1
- package/dist/.next/server/server-reference-manifest.json +1 -1
- package/dist/.next/static/MoZBULXFiTFzrY1JVK_Df/_buildManifest.js +1 -0
- package/dist/.next/static/chunks/176-9146975ef8699719.js +1 -0
- package/dist/.next/static/chunks/{735-c9144179c6bd7d06.js → 735-b885dfec6353171d.js} +1 -1
- package/dist/.next/static/chunks/app/api/cloudflare/route-b77846f372b01f38.js +1 -0
- package/dist/.next/static/chunks/app/api/databases/route-407794f8145d9a0b.js +1 -0
- package/dist/.next/static/chunks/app/api/migrations/sync/route-9f480f5590369a8f.js +1 -0
- package/dist/.next/static/chunks/app/api/migrations/sync-files/route-92010db279b4dd8e.js +1 -0
- package/dist/.next/static/chunks/app/api/pull-data/confirm/route-a02fe6d3cdd0a535.js +1 -0
- package/dist/.next/static/chunks/app/api/pull-remote/confirm/route-f401a03507d1da50.js +1 -0
- package/dist/.next/static/chunks/app/api/pull-remote/preview/route-3c53814b5cb8b6b0.js +1 -0
- package/dist/.next/static/chunks/app/api/push-remote/confirm/route-8f359249e907c63b.js +1 -0
- package/dist/.next/static/chunks/app/api/push-remote/preview/route-b51bf94f39c17a9d.js +1 -0
- package/dist/.next/static/chunks/app/api/query/route-87bae2d4aebaf859.js +1 -0
- package/dist/.next/static/chunks/app/api/tables/[name]/route-d20ca163b9c03e7c.js +1 -0
- package/dist/.next/static/chunks/app/api/tables/route-0f46f911562abcdf.js +1 -0
- package/dist/.next/static/chunks/app/api/update/route-14edc1917760bce0.js +1 -0
- package/dist/.next/static/chunks/app/page-5990cb23b8bd27c4.js +1 -0
- package/dist/.next/static/css/674bee6608c638e4.css +3 -0
- package/dist/.next/trace +17 -14
- package/dist/.next/types/app/api/pull-data/confirm/route.ts +347 -0
- package/dist/.next/types/app/api/update/route.ts +347 -0
- package/dist/app/api/cloudflare/route.js +5 -1
- package/dist/app/api/databases/route.js +3 -4
- package/dist/app/api/migrations/sync/route.js +5 -3
- package/dist/app/api/pull-data/confirm/route.js +230 -0
- package/dist/app/api/pull-remote/confirm/route.js +24 -23
- package/dist/app/api/pull-remote/preview/route.js +4 -3
- package/dist/app/api/push-remote/preview/route.js +3 -2
- package/dist/app/api/query/route.js +11 -3
- package/dist/app/api/tables/[name]/route.js +3 -2
- package/dist/app/api/tables/route.js +6 -2
- package/dist/app/api/update/route.js +36 -0
- package/dist/app/app/api/cloudflare/route.js +5 -1
- package/dist/app/app/api/databases/route.js +3 -4
- package/dist/app/app/api/migrations/sync/route.js +5 -3
- package/dist/app/app/api/pull-data/confirm/route.js +230 -0
- package/dist/app/app/api/pull-remote/confirm/route.js +24 -23
- package/dist/app/app/api/pull-remote/preview/route.js +4 -3
- package/dist/app/app/api/push-remote/preview/route.js +3 -2
- package/dist/app/app/api/query/route.js +11 -3
- package/dist/app/app/api/tables/[name]/route.js +3 -2
- package/dist/app/app/api/tables/route.js +6 -2
- package/dist/app/app/api/update/route.js +36 -0
- package/dist/app/app/page.jsx +24 -14
- package/dist/app/page.jsx +24 -14
- package/dist/d1-studio.js +101 -58
- package/dist/lib/database-queue.js +34 -30
- package/dist/lib/find-wrangler-config.js +14 -8
- package/dist/lib/logger.js +44 -5
- package/dist/lib/migrations.js +4 -4
- package/dist/lib/schema-operations.js +4 -1
- package/dist/lib/sql-operations.js +85 -1
- package/package.json +3 -1
- package/scripts/studio.js +101 -58
- package/scripts/test.js +280 -82
- package/src/app/api/cloudflare/route.js +5 -1
- package/src/app/api/databases/route.js +3 -4
- package/src/app/api/migrations/sync/route.js +5 -3
- package/src/app/api/pull-data/confirm/route.js +230 -0
- package/src/app/api/pull-remote/confirm/route.js +24 -23
- package/src/app/api/pull-remote/preview/route.js +4 -3
- package/src/app/api/push-remote/preview/route.js +3 -2
- package/src/app/api/query/route.js +11 -3
- package/src/app/api/tables/[name]/route.js +3 -2
- package/src/app/api/tables/route.js +6 -2
- package/src/app/api/update/route.js +36 -0
- package/src/app/page.jsx +24 -14
- package/src/components/environment-handler.jsx +70 -16
- package/src/components/environment-select.jsx +6 -3
- package/src/components/pull-preview-toast.jsx +90 -63
- package/src/components/sidebar.jsx +25 -24
- package/src/components/update-banner.jsx +62 -0
- package/src/context/database-context.js +4 -4
- package/src/lib/database-queue.js +34 -30
- package/src/lib/find-wrangler-config.js +14 -8
- package/src/lib/logger.js +44 -5
- package/src/lib/migrations.js +4 -4
- package/src/lib/schema-operations.js +4 -1
- package/src/lib/sql-operations.js +85 -1
- package/dist/.next/.next/cache/webpack/client-production/3.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/1.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/2.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/dist/.next/.next/server/chunks/603.js +0 -55
- package/dist/.next/.next/server/chunks/686.js +0 -23
- package/dist/.next/.next/static/HsZ8OanS5v86DqC9rErO-/_buildManifest.js +0 -1
- package/dist/.next/.next/static/chunks/422-6fa3c14fc64ad67b.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/cloudflare/route-3458d78022185d7f.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/databases/route-64255424877a9f72.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/migrations/sync/route-03766b3afcf043ba.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/migrations/sync-files/route-02fa291c8000dadf.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/pull-remote/confirm/route-7e05bb8920127abe.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/pull-remote/preview/route-0fa15f783e8a306c.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-96691f1880e4ed14.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/push-remote/preview/route-a798679c67374552.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/query/route-e90d0030a5083e20.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/tables/[name]/route-1efe63e73b480e58.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/tables/route-3772b4f480c4b4a4.js +0 -1
- package/dist/.next/.next/static/chunks/app/page-79049bfa6cc07e11.js +0 -1
- package/dist/.next/.next/static/css/cf41da7a0d47f779.css +0 -3
- package/dist/.next/.next/static/q6WmQmyONe88bMN0_jrC2/_buildManifest.js +0 -1
- package/dist/.next/server/chunks/603.js +0 -55
- package/dist/.next/server/chunks/686.js +0 -23
- package/dist/.next/static/Tk1fnz_CXLavm23ZEeChG/_buildManifest.js +0 -1
- package/dist/.next/static/Tk1fnz_CXLavm23ZEeChG/_ssgManifest.js +0 -1
- package/dist/.next/static/chunks/422-6fa3c14fc64ad67b.js +0 -1
- package/dist/.next/static/chunks/app/api/cloudflare/route-3458d78022185d7f.js +0 -1
- package/dist/.next/static/chunks/app/api/databases/route-64255424877a9f72.js +0 -1
- package/dist/.next/static/chunks/app/api/migrations/sync/route-03766b3afcf043ba.js +0 -1
- package/dist/.next/static/chunks/app/api/migrations/sync-files/route-02fa291c8000dadf.js +0 -1
- package/dist/.next/static/chunks/app/api/pull-remote/confirm/route-7e05bb8920127abe.js +0 -1
- package/dist/.next/static/chunks/app/api/pull-remote/preview/route-0fa15f783e8a306c.js +0 -1
- package/dist/.next/static/chunks/app/api/push-remote/confirm/route-96691f1880e4ed14.js +0 -1
- package/dist/.next/static/chunks/app/api/push-remote/preview/route-a798679c67374552.js +0 -1
- package/dist/.next/static/chunks/app/api/query/route-e90d0030a5083e20.js +0 -1
- package/dist/.next/static/chunks/app/api/tables/[name]/route-1efe63e73b480e58.js +0 -1
- package/dist/.next/static/chunks/app/api/tables/route-3772b4f480c4b4a4.js +0 -1
- package/dist/.next/static/chunks/app/page-79049bfa6cc07e11.js +0 -1
- package/dist/.next/static/css/cf41da7a0d47f779.css +0 -3
- /package/dist/.next/.next/static/{HsZ8OanS5v86DqC9rErO- → 7XBqETNmhSxMXhw8iUpEa}/_ssgManifest.js +0 -0
- /package/dist/.next/{.next/static/q6WmQmyONe88bMN0_jrC2 → static/MoZBULXFiTFzrY1JVK_Df}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"
|
|
1
|
+
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"33":{"*":{"id":"2899","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"57174","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"87190","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"33875","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"88903","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"84178","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"93158","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"52652","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"61365","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"66959","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":7033,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":4547,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":4835,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":2328,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":5244,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":3866,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/dist/esm/lib/metadata/metadata-boundary.js":{"id":6213,"name":"*","chunks":[],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":5613,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.jsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":7207,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/globals.css":{"id":347,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx":{"id":6124,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js":{"id":33,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","92","static/chunks/92-c4466e0f1ca8a3a8.js","735","static/chunks/735-b885dfec6353171d.js","177","static/chunks/app/layout-8360fab69b848283.js"],"async":false},"/Users/karenredona/Desktop/d1studio/src/app/page.jsx":{"id":5612,"name":"*","chunks":["692","static/chunks/692-ede418e1d28a1394.js","176","static/chunks/176-9146975ef8699719.js","735","static/chunks/735-b885dfec6353171d.js","974","static/chunks/app/page-5990cb23b8bd27c4.js"],"async":false}},"entryCSSFiles":{"/Users/karenredona/Desktop/d1studio/src/":[],"/Users/karenredona/Desktop/d1studio/src/app/layout":[{"inlined":false,"path":"static/css/674bee6608c638e4.css"}],"/Users/karenredona/Desktop/d1studio/src/app/page":[]},"rscModuleMapping":{"33":{"*":{"id":"91831","name":"*","chunks":[],"async":false}},"347":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"2328":{"*":{"id":"40802","name":"*","chunks":[],"async":false}},"3866":{"*":{"id":"48530","name":"*","chunks":[],"async":false}},"4547":{"*":{"id":"34863","name":"*","chunks":[],"async":false}},"4835":{"*":{"id":"25155","name":"*","chunks":[],"async":false}},"5244":{"*":{"id":"9350","name":"*","chunks":[],"async":false}},"5612":{"*":{"id":"46487","name":"*","chunks":[],"async":false}},"6124":{"*":{"id":"13164","name":"*","chunks":[],"async":false}},"6213":{"*":{"id":"88921","name":"*","chunks":[],"async":false}},"7033":{"*":{"id":"13219","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"/api/
|
|
2
|
+
"/api/databases/route": "app/api/databases/route.js",
|
|
3
3
|
"/api/cloudflare/route": "app/api/cloudflare/route.js",
|
|
4
4
|
"/_not-found/page": "app/_not-found/page.js",
|
|
5
5
|
"/api/migrations/sync-files/route": "app/api/migrations/sync-files/route.js",
|
|
6
|
-
"/api/
|
|
6
|
+
"/api/migrations/sync/route": "app/api/migrations/sync/route.js",
|
|
7
|
+
"/api/pull-data/confirm/route": "app/api/pull-data/confirm/route.js",
|
|
7
8
|
"/api/pull-remote/confirm/route": "app/api/pull-remote/confirm/route.js",
|
|
9
|
+
"/api/pull-remote/preview/route": "app/api/pull-remote/preview/route.js",
|
|
8
10
|
"/api/query/route": "app/api/query/route.js",
|
|
9
|
-
"/api/push-remote/preview/route": "app/api/push-remote/preview/route.js",
|
|
10
11
|
"/api/push-remote/confirm/route": "app/api/push-remote/confirm/route.js",
|
|
11
|
-
"/api/
|
|
12
|
+
"/api/push-remote/preview/route": "app/api/push-remote/preview/route.js",
|
|
12
13
|
"/api/tables/route": "app/api/tables/route.js",
|
|
13
|
-
"/api/
|
|
14
|
-
"/page": "app/page.js"
|
|
14
|
+
"/api/update/route": "app/api/update/route.js",
|
|
15
|
+
"/page": "app/page.js",
|
|
16
|
+
"/api/tables/[name]/route": "app/api/tables/[name]/route.js"
|
|
15
17
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
exports.id=226,exports.ids=[226],exports.modules={96487:()=>{},78335:()=>{},65949:(t,e,r)=>{"use strict";r.d(e,{S:()=>c});var s=r(79748),n=r(43149),i=r(72537),a=r(26789),E=r(81804);let l=null,o=null;async function c(t){try{let e;if(!t||"string"!=typeof t)throw Error("Project path is required and must be a string");if(l&&o===t)return l;let r=null,c=null;for(let e of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(r=await (0,n.dJ)(e,{cwd:t})){c=e;break}if(!r)return E.A.warn(`No Wrangler configuration file found in: ${t}`),null;E.A.info(`Found ${c} at: ${r}`);let u=await (0,s.readFile)(r,"utf-8");return c.endsWith(".toml")?e=(0,i.parse)(u):(c.endsWith(".jsonc")&&(u=(0,a.A)(u)),e=JSON.parse(u)),l={config:e,projectPath:t},o=t,l}catch(t){throw E.A.error(`Error reading Wrangler configuration: ${t.message}`),t}}},81804:(t,e,r)=>{"use strict";r.d(e,{A:()=>u});var s=r(26399);let{combine:n,timestamp:i,printf:a,colorize:E}=s.format,l="true"===process.env.DEBUG,o=a(({level:t,message:e,timestamp:r,...s})=>{let n=`${r} ${t}: ${e}`;return Object.keys(s).length>0&&(n+=` ${JSON.stringify(s)}`),n}),c=s.createLogger({level:l?"debug":"warn",format:n(i({format:"YYYY-MM-DD HH:mm:ss"}),E(),o),transports:[new s.transports.Console({level:l?"debug":"warn",silent:!1})]});c.logRequest=(t,e,r={})=>{c.debug(`Request: ${t} ${e}`,r)},c.logError=(t,e="unknown")=>{c.error(`Error in ${e}: ${t.message}`,{error:t.stack||t.message,source:e})},c.shouldLog=t=>{let e=c.level,r={error:0,warn:1,info:2,debug:3};return r[t]<=r[e]};let u=c},44218:(t,e,r)=>{"use strict";r.d(e,{IC:()=>a,ZX:()=>i});var s=r(19421),n=r(81804);async function i(t,e,r={},a=!1){let E=`
|
|
2
|
+
SELECT name, type, sql
|
|
3
|
+
FROM sqlite_master
|
|
4
|
+
WHERE type IN ('table', 'index', 'trigger')
|
|
5
|
+
AND name NOT LIKE 'sqlite_%'
|
|
6
|
+
AND name != 'd1_migrations';
|
|
7
|
+
`;try{let n=await (0,s.KK)(t,e,E,r,a),i=JSON.parse(n);return i[0]?.results||[]}catch(t){throw n.A.error("Failed to get current schema:",t),{type:s.wU.EXECUTION_ERROR,message:"Failed to get current schema",details:{error:t.message,suggestions:["Check database permissions"]}}}}function a(t){let e=new Map;return t.filter(t=>"DATA_MODIFICATION"!==t.type).forEach(t=>{let r=(t.name||t.tableName).toLowerCase();if(e.has(r)||e.set(r,new Set),"CREATE_TABLE"===t.type){let s=t.sql.match(/FOREIGN\s+KEY\s*\([^)]+\)\s+REFERENCES\s+(\w+)/gi);s&&s.forEach(t=>{let s=t.match(/REFERENCES\s+(\w+)/i)[1].toLowerCase();e.get(r).add(s)})}}),function(t){let e=[],r=new Set,s=new Set;for(let n of t.keys())r.has(n)||function n(i){if(s.has(i))throw Error(`Circular dependency detected for table: ${i}`);if(!r.has(i)){for(let e of(s.add(i),t.get(i)||new Set)){if(!t.has(e))throw Error(`Missing table dependency: ${e}`);n(e)}s.delete(i),r.add(i),e.push(i)}}(n);return e}(e)}},19421:(t,e,r)=>{"use strict";r.d(e,{By:()=>c,F9:()=>A,Gq:()=>u,KK:()=>N,Pg:()=>E,QQ:()=>o,bp:()=>f,h3:()=>O,mA:()=>d,sP:()=>g,tn:()=>$,wU:()=>l,xk:()=>h,z6:()=>I});var s=r(28354),n=r(79646),i=r(81804);let a=(0,s.promisify)(n.exec),E={CREATE_TABLE:"CREATE_TABLE",ALTER_TABLE:"ALTER_TABLE",DROP_TABLE:"DROP_TABLE",CREATE_INDEX:"CREATE_INDEX",DROP_INDEX:"DROP_INDEX",DATA_MODIFICATION:"DATA_MODIFICATION"},l={VALIDATION_ERROR:"VALIDATION_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",DEPENDENCY_ERROR:"DEPENDENCY_ERROR"};function o(t){return t.type!==E.DATA_MODIFICATION}function c(t){let e=t.trim().replace(/\s+/g," "),r=e.toUpperCase();if(r.startsWith("CREATE TABLE"))return{type:E.CREATE_TABLE,tableName:m(e,"CREATE TABLE"),sql:e,description:"create-table"};if(r.startsWith("ALTER TABLE")){let t=m(e,"ALTER TABLE"),s="";if(r.includes("RENAME")){let t=e.match(/RENAME\s+(?:COLUMN\s+)?([\w$]+)\s+TO\s+([\w$]+)/i);t&&(s=`rename-${t[1]}-to-${t[2]}`)}else if(r.includes("ADD COLUMN")){let t=e.match(/ADD\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(t){let e=t[1],r=t[2]?t[2].trim().replace(/\s+/g,"-"):"";s=r?`add-${e}-${r}`:`add-${e}`}}else if(r.includes("DROP COLUMN")){let t=e.match(/DROP\s+COLUMN\s+([\w$]+)/i);t&&(s=`drop-${t[1]}`)}else if(r.includes("MODIFY COLUMN")||r.includes("CHANGE COLUMN")){let t=e.match(/(?:MODIFY|CHANGE)\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(t){let e=t[1],r=t[2]?t[2].trim().replace(/\s+/g,"-"):"";s=r?`modify-${e}-to-${r}`:`modify-${e}`}}return{type:E.ALTER_TABLE,tableName:t,sql:e,description:s}}if(r.startsWith("DROP TABLE"))return{type:E.DROP_TABLE,tableName:m(e,"DROP TABLE"),sql:e,description:"drop-table"};if(r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")){let t=T(e),r=e.match(/INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?([\w$]+)/i),s=r?r[1]:"",n=e.match(/ON\s+[\w$]+\s*\(([^)]+)\)/i),i=(n?n[1].trim():"").replace(/\s+/g,"").replace(/,/g,"-").toLowerCase(),a=s;return i&&!a.toLowerCase().includes(i)&&(a+=`-${i}`),{type:E.CREATE_INDEX,tableName:t,sql:e,description:a}}if(r.startsWith("DROP INDEX")){let t=T(e),r=e.match(/DROP\s+INDEX\s+(?:IF\s+EXISTS\s+)?([\w$]+)/i),s=r?r[1]:"";return{type:E.DROP_INDEX,tableName:t,sql:e,description:s?`drop-index-${s}`:"drop-index"}}return{type:E.DATA_MODIFICATION,sql:e,description:"data-modification"}}function u(t){if(t.type!==E.DATA_MODIFICATION&&!t.tableName)throw{type:l.VALIDATION_ERROR,message:`Invalid SQL statement: unable to determine table name for "${t.type}".`,details:{sql:t.sql}};return t}function m(t,e){let r=t.match(RegExp(`${e}\\s+(?:IF\\s+(?:NOT\\s+)?EXISTS\\s+)?([\\w_]+)`,"i"));return r?r[1]:null}function T(t){let e=t.match(/ON\s+([\w_]+)/i);return e?e[1]:null}async function R(t){let e=t.match(/^\d+_create[-_]table[_-](.+)\.sql$/i);return e||(e=t.match(/^\d+_create[-](.+)-table\.sql$/i))||(e=t.match(/^\d+_alter[-_]table[_-](.+?)(?:[_-].+)?\.sql$/i))||(e=t.match(/^\d+_alter[-](.+?)-table(?:[_-].+)?\.sql$/i))||(e=t.match(/^\d+_create[-_]index[-_](.+)\.sql$/i))?e[1]:null}function f(t){return t.split("\n").filter(t=>!t.trim().startsWith("--")).join("\n").trim()}async function A(t,e,r,s,n=!1){let i=`SELECT name FROM sqlite_master WHERE type='table' AND name = '${s}' COLLATE NOCASE;`,a=await N(t,e,i,r,n);try{let t=a.indexOf("[");if(-1!==t){let e=a.substring(t),r=JSON.parse(e);return(r[0]?.results||[]).length>0}return!1}catch(t){return console.error("Error parsing tableExists result:",t),!1}}function d(t){return t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim().split(";").map(t=>t.trim()).filter(t=>t.length>0).map(t=>c(t+";"))}async function N(t,e,r,s={},n=!1){try{let E=r.trim().replace(/\s+/g," "),l=E.toUpperCase();(l.startsWith("CREATE INDEX")||l.startsWith("CREATE UNIQUE INDEX"))&&!l.includes("IF NOT EXISTS")&&(E=l.startsWith("CREATE UNIQUE INDEX")?E.replace(/CREATE\s+UNIQUE\s+INDEX/i,"CREATE UNIQUE INDEX IF NOT EXISTS"):E.replace(/CREATE\s+INDEX/i,"CREATE INDEX IF NOT EXISTS"));let o="win32"===process.platform,c=`${o?"npx.cmd":"npx"} wrangler d1 execute ${e} ${n?"--remote":"--local"} --command="${E.replace(/"/g,'\\"')}"`;i.A.shouldLog("debug")&&i.A.debug("Executing command:",c);let u={cwd:t,env:{...process.env,...s},maxBuffer:0xa00000,shell:!0},{stdout:m,stderr:T}=await a(c,u);if(T&&!T.includes("\uD83C\uDF00"))throw Error(T);try{let t=m.indexOf("[");if(-1!==t)return m.substring(t)}catch(t){console.warn("JSON parse warning:",t)}return m}catch(t){throw console.error("SQL Execution error:",t),{type:l.EXECUTION_ERROR,message:"Failed to execute SQL command",details:{command:t.cmd,stderr:t.stderr,stdout:t.stdout,originalError:t.message,suggestions:["Ensure Node.js and Wrangler are installed","Check npx in PATH","Verify the D1 database exists and is configured","Check wrangler.toml configuration"]}}}}async function O(t,e,r,s,n,a="id"){let E=`SELECT * FROM "${r}" ORDER BY "${a}" DESC LIMIT ${n};`;try{let r=await N(t,e,E,s,!0),n=r.indexOf("[");if(-1===n)throw Error(`Unexpected result format: ${r}`);let i=r.substring(n),a=JSON.parse(i);return a[0]?.results||[]}catch(t){throw i.A.error(`Error fetching remote data for table ${r}:`,t),t}}function h(t,e){if(!e||0===e.length)return"";let r=Object.keys(e[0]),s=r.map(t=>`"${t}"`).join(", "),n=e.map(t=>{let e=r.map(e=>{let r=t[e];return null==r?"NULL":`'${String(r).replace(/'/g,"''")}'`}).join(", ");return`(${e})`}).join(", ");return`INSERT INTO "${t}" (${s}) VALUES ${n};`}function I(t){let e=t.trim(),r=e.toUpperCase();return r.startsWith("CREATE TABLE")?function(t){let e=t.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s*\(([\s\S]*)\)/i);if(!e)return t;let[,r,s]=e,n=p(s).map(t=>t.trim()).filter(Boolean);return`CREATE TABLE ${r} (
|
|
8
|
+
${n.join(",\n ")}
|
|
9
|
+
);`}(e):r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")?function(t){let e=t.match(/CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s+ON\s+(\w+)\s*\((.*)\)/i);if(!e)return t;let[,r,s,n,i]=e,a=i.split(",").map(t=>t.trim()).join(", ");return`CREATE ${r||""}INDEX ${s} ON ${n} (${a});`}(e):r.startsWith("ALTER TABLE")?function(t){let e=t.match(/ALTER\s+TABLE\s+(\w+)\s+(.*)/i);if(!e)return t;let[,r,s]=e,n=p(s);return 1===n.length?`ALTER TABLE ${r} ${n[0]};`:`ALTER TABLE ${r}
|
|
10
|
+
${n.map((t,e)=>` ${t}${e<n.length-1?",":";"}`).join("\n")}`}(e):r.startsWith("DROP TABLE")||r.startsWith("DROP INDEX")?function(t){let e=t.match(/DROP\s+(TABLE|INDEX)\s+(?:IF\s+EXISTS\s+)?(\w+)/i);if(!e)return t;let[,r,s]=e;return`DROP ${r} IF EXISTS ${s};`}(e):r.startsWith("INSERT INTO")?function(t){let e=t.match(/INSERT\s+INTO\s+(\w+)\s*(\([^)]+\))?\s*VALUES\s*(.+)/i);if(!e)return t;let[,r,s,n]=e,i=p(n);return`INSERT INTO ${r}${s?` ${s}`:""}
|
|
11
|
+
VALUES
|
|
12
|
+
`+i.map((t,e)=>` ${t}${e<i.length-1?",":";"}`).join("\n")}(e):r.startsWith("UPDATE")?function(t){let e=t.match(/UPDATE\s+(\w+)\s+SET\s+(.+?)(?:\s+WHERE\s+(.+))?$/i);if(!e)return t;let[,r,s,n]=e,i=p(s),a=`UPDATE ${r}
|
|
13
|
+
SET
|
|
14
|
+
${i.map(t=>` ${t.trim()}`).join(",\n")}`;return n&&(a+=`
|
|
15
|
+
WHERE
|
|
16
|
+
${n.trim()}`),a+";"}(e):r.startsWith("DELETE FROM")?function(t){let e=t.match(/DELETE\s+FROM\s+(\w+)(?:\s+WHERE\s+(.+))?$/i);if(!e)return t;let[,r,s]=e,n=`DELETE FROM ${r}`;return s&&(n+=`
|
|
17
|
+
WHERE
|
|
18
|
+
${s.trim()}`),n+";"}(e):r.startsWith("SELECT")?function(t){let e=t.match(/SELECT\s+(.+?)\s+FROM\s+(.+?)(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+HAVING\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+LIMIT\s+(.+?))?$/i);if(!e)return t;let[,r,s,n,i,a,E,l]=e,o=`SELECT
|
|
19
|
+
${r.split(",").map(t=>t.trim()).join(",\n ")}
|
|
20
|
+
FROM
|
|
21
|
+
${s.trim()}`;return n&&(o+=`
|
|
22
|
+
WHERE
|
|
23
|
+
${n.trim()}`),i&&(o+=`
|
|
24
|
+
GROUP BY
|
|
25
|
+
${i.trim()}`),a&&(o+=`
|
|
26
|
+
HAVING
|
|
27
|
+
${a.trim()}`),E&&(o+=`
|
|
28
|
+
ORDER BY
|
|
29
|
+
${E.trim()}`),l&&(o+=`
|
|
30
|
+
LIMIT ${l.trim()}`),o+";"}(e):e+";"}function p(t){let e=[],r="",s=0,n=!1,i="";for(let a of t)'"'===a&&"\\"!==i&&(n=!n),!n&&("("===a&&s++,")"===a&&s--),","!==a||0!==s||n?r+=a:(e.push(r.trim()),r=""),i=a;return r.trim()&&e.push(r.trim()),e}function $(t){return t.split(";").map(t=>t.trim()).filter(t=>t.length>0).map(t=>I(t)).join("\n\n")+"\n"}async function g(t,e,r,s){try{let n;let i=await R(r);if(i){let r=await N(t,e,`SELECT sql FROM sqlite_master WHERE type='table' AND name='${i}';`,s,!0);try{let t=JSON.parse(r);n=t[0]?.results?.[0]?.sql}catch(t){console.error("Error parsing sqlite_master result:",t)}}if(!n&&r.includes("create-index")){let i=r.match(/create-index[-_]([^_.]+)/);if(i){let r=await N(t,e,`SELECT sql FROM sqlite_master WHERE type='index' AND name='${i[1]}';`,s,!0),a=JSON.parse(r);n=a[0]?.results?.[0]?.sql}}if(!n&&i){let r=await N(t,e,`SELECT sql FROM sqlite_master WHERE name LIKE '%${i}%' LIMIT 1;`,s,!0);try{let t=JSON.parse(r);n=t[0]?.results?.[0]?.sql}catch(t){console.error("Error parsing fallback result:",t)}}if(!n)throw Error(`Could not retrieve SQL content for migration: ${r}`);return n+";"}catch(t){throw{type:l.EXECUTION_ERROR,message:`Failed to get migration file content: ${t.message}`,details:{file:r,error:t.message,suggestions:["Check if the table exists in the remote database","Verify the migration filename follows the expected pattern","Ensure you have permissions to access the remote database"]}}}}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
exports.id=336,exports.ids=[336],exports.modules={7928:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,3219,23)),Promise.resolve().then(r.t.bind(r,4863,23)),Promise.resolve().then(r.t.bind(r,5155,23)),Promise.resolve().then(r.t.bind(r,802,23)),Promise.resolve().then(r.t.bind(r,9350,23)),Promise.resolve().then(r.t.bind(r,8530,23)),Promise.resolve().then(r.t.bind(r,8921,23))},1480:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,6959,23)),Promise.resolve().then(r.t.bind(r,3875,23)),Promise.resolve().then(r.t.bind(r,8903,23)),Promise.resolve().then(r.t.bind(r,7174,23)),Promise.resolve().then(r.t.bind(r,4178,23)),Promise.resolve().then(r.t.bind(r,7190,23)),Promise.resolve().then(r.t.bind(r,1365,23))},9233:(e,t,r)=>{Promise.resolve().then(r.bind(r,3164)),Promise.resolve().then(r.bind(r,1831))},2385:(e,t,r)=>{Promise.resolve().then(r.bind(r,2652)),Promise.resolve().then(r.bind(r,2899))},2652:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>v});var a=r(5512),s=r(6888),o=r(8009),i=r(8952),n=r(1643),c=r(1255),l=r(3603);let d=i.Kq,u=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.LM,{ref:r,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));u.displayName=i.LM.displayName;let h=(0,n.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),p=o.forwardRef(({className:e,variant:t,...r},s)=>(0,a.jsx)(i.bL,{ref:s,className:(0,l.cn)(h({variant:t}),e),...r}));p.displayName=i.bL.displayName,o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.rc,{ref:r,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t})).displayName=i.rc.displayName;let m=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.bm,{ref:r,className:(0,l.cn)("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:(0,a.jsx)(c.A,{className:"h-4 w-4"})}));m.displayName=i.bm.displayName;let f=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.hE,{ref:r,className:(0,l.cn)("text-sm font-semibold [&+div]:text-xs",e),...t}));f.displayName=i.hE.displayName;let b=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.VY,{ref:r,className:(0,l.cn)("text-sm opacity-90",e),...t}));function v(){let{toasts:e}=(0,s.dj)();return(0,a.jsxs)(d,{children:[e.map(function({id:e,title:t,description:r,action:s,...o}){return(0,a.jsxs)(p,{...o,children:[(0,a.jsxs)("div",{className:"grid gap-1",children:[t&&(0,a.jsx)(f,{children:t}),r&&(0,a.jsx)(b,{children:r})]}),s,(0,a.jsx)(m,{})]},e)}),(0,a.jsx)(u,{})]})}b.displayName=i.VY.displayName},8180:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u,metadata:()=>d});var a=r(2740),s=r(7944),o=r.n(s),i=r(5510),n=r.n(i);r(1135);var c=r(1831),l=r(3164);let d={title:"d1-studio",description:"Native D1 database studio."};function u({children:e}){return(0,a.jsx)("html",{lang:"en",children:(0,a.jsx)("body",{className:`${o().variable} ${n().variable} antialiased`,children:(0,a.jsxs)(c.DatabaseProvider,{children:[e,(0,a.jsx)(l.Toaster,{})," "]})})})}},3164:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>a});let a=(0,r(4379).registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx","Toaster")},1135:()=>{},2899:(e,t,r)=>{"use strict";r.d(t,{DatabaseProvider:()=>u,t:()=>h});var a=r(5512),s=r(8009),o=r(6888);let i=new Map;function n(e,t,r=2e3){let a=i.get(e);if(a&&Date.now()-a.timestamp<r)return a.promise;let s=t();return i.set(e,{promise:s,timestamp:Date.now()}),s.finally(()=>{setTimeout(()=>{i.delete(e)},r)}),s}let c=(0,s.createContext)(void 0);class l{constructor(){this.cache=new Map}get(e){return this.cache.get(e)||null}set(e,t,r,a){this.cache.set(e,{data:t,schema:r,meta:a,timestamp:Date.now()})}update(e,t,r,a){let s=this.cache.get(e);s&&this.cache.set(e,{data:t||s.data,schema:r||s.schema,meta:a||s.meta,timestamp:Date.now()})}invalidate(e){this.cache.delete(e)}clear(){this.cache.clear()}}class d{constructor(){this.queue=[],this.processing=!1}async add(e){return new Promise((t,r)=>{this.queue.push({operation:e,resolve:t,reject:r}),this.process()})}async process(){if(this.processing||0===this.queue.length)return;this.processing=!0;let{operation:e,resolve:t,reject:r}=this.queue.shift();try{let r=await e();t(r)}catch(e){r(e)}finally{this.processing=!1,this.process()}}}function u({children:e}){let{toast:t}=(0,o.dj)(),[r,i]=(0,s.useState)([]),[u,h]=(0,s.useState)(!0),[p,m]=(0,s.useState)(null),[f,b]=(0,s.useState)(null);(0,s.useRef)(new d);let[v,g]=(0,s.useState)(null),y=(0,s.useRef)(new l).current,w=(0,s.useCallback)((e,t=1,r=50)=>{let a=`table-${e}-${t}-${r}`;return y.get(a)},[]),x=(0,s.useCallback)(e=>{y.cache.forEach((t,r)=>{r.startsWith(`table-${e}-`)&&y.invalidate(r)})},[]),T=(0,s.useCallback)((e,t,r,a,s=1,o=50)=>{let i=`table-${e}-${s}-${o}`;y.update(i,t,r,a)},[]),S=(0,s.useCallback)(async e=>n(`query-${e}`,async()=>{try{let t=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e})});if(!t.ok){let e="Failed to execute query";try{let r=await t.json();e=r?.error?.message||e}catch(e){}throw Error(e)}let r=await t.json();if(!r.success)throw Error(r.error||"Query execution failed");return r}catch(e){throw e||Error("An unknown error occurred")}},1e3),[]),j=(0,s.useCallback)(async e=>{try{let t=await fetch(`/api/tables/${e}`),r=await t.json();if(!t.ok||!r.success)throw Error(r.error||"Failed to fetch table schema");return r.schema||[]}catch(e){throw console.error("Schema fetch error:",e),t({variant:"destructive",title:"Schema Fetch Failed",description:e.message}),e}},[t]),E=(0,s.useCallback)(async(e,r={})=>{let{forceFetch:a=!1,page:s=1,limit:o=50}=r,i=`table-${e}-${s}-${o}`;if(!a){let e=y.get(i);if(e)return e}return n(`table-${e}-${s}-${o}`,async()=>{try{let t=await fetch(`/api/tables/${e}?page=${s}&limit=${o}`,{headers:{"Cache-Control":"no-cache",Pragma:"no-cache"}});if(!t.ok)throw Error("Failed to fetch table data");let r=await t.json();if(!r.success)throw Error(r.error||"Failed to fetch table data");return y.set(i,r.data,r.schema,r.meta),r}catch(e){throw console.error("Error fetching table data:",e),t({variant:"destructive",title:"Data Fetch Failed",description:e.message}),e}},1e3)},[t]),C=(0,s.useCallback)(async e=>{try{return y.invalidate(e),await E(e,{forceFetch:!0})}catch(e){throw console.error("Error updating table data:",e),t({variant:"destructive",title:"Update Failed",description:e.message}),e}},[E,t]),P=(0,s.useCallback)(async(e,t={})=>(g(e),await E(e,t)),[E]),k=(0,s.useCallback)(async()=>n("refresh-tables",async()=>{h(!0),m(null);try{let e=await fetch("/api/tables");if(!e.ok)throw Error("Failed to fetch tables");let t=await e.json();if(t.error)throw Error(t.error);return i(t.tables||[]),t.tables||[]}catch(e){throw m(e.message),t({variant:"destructive",title:"Refresh Failed",description:e.message}),e}finally{h(!1)}},2e3),[t]),D=(0,s.useCallback)(async e=>{try{await S(e),y.clear(),await k(),t({title:"Success",description:"Table created successfully"})}catch(e){throw t({variant:"destructive",title:"Create Table Failed",description:e.message}),Error(`Failed to create table: ${e.message}`)}},[S,k,t]),N=(0,s.useCallback)(async e=>{try{await S(`DROP TABLE ${e};`),y.invalidate(e),await k(),t({title:"Success",description:"Table dropped successfully"})}catch(e){throw t({variant:"destructive",title:"Drop Table Failed",description:e.message}),Error(`Failed to drop table: ${e.message}`)}},[S,k,t]),$=(0,s.useCallback)(async e=>{try{let r=await fetch("/api/migrations/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let e=await r.json();throw Error(e.error?.message||"Failed to sync migrations")}let a=await r.json();return t({title:"Success",description:"Migrations synced successfully"}),a}catch(e){throw console.error("Error syncing migrations:",e),t({variant:"destructive",title:"Sync Failed",description:e.message}),e}},[t]),F=(0,s.useCallback)(async()=>{try{let e=localStorage.getItem("cf_credentials");if(!e)throw Error("No Cloudflare credentials found. Please connect to Cloudflare first.");let r=JSON.parse(e);if(!r.accountId||!r.apiToken)throw Error("Invalid credentials stored. Please reconnect to Cloudflare.");let a=await fetch("/api/pull-remote/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:r.accountId,apiToken:r.apiToken})}),s=await a.json();if(!a.ok||!s.success)throw Error(s.error?.message||"Failed to pull from remote");return y.clear(),await k(),t({title:"Success",description:`Remote state applied successfully. Migrations applied: ${s.details.appliedMigrations.join(", ")}`}),s}catch(e){throw console.error("Error pulling from remote:",e),t({variant:"destructive",title:"Pull Failed",description:e.message}),e}},[k,t]),O=(0,s.useCallback)(async e=>{try{let t=await fetch("/api/push-remote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw Error(r.error?.message||"Failed to push to remote");return r}catch(e){throw console.error("Error pushing to remote:",e),e}},[t]),A=(0,s.useMemo)(()=>({tables:r,currentDatabase:f,isLoading:u,error:p,activeTable:v,refreshTables:k,executeQuery:S,fetchTableSchema:j,fetchTableData:E,updateTableData:C,createTable:D,dropTable:N,syncMigrations:$,pullFromRemote:F,pushToRemote:O,getCachedTable:w,updateTableCache:T,invalidateTable:x,switchTable:P}),[r,f,u,p,v,k,S,j,E,C,D,N,$,F,O,w,T,x,P]);return(0,a.jsx)(c.Provider,{value:A,children:e})}function h(){let e=(0,s.useContext)(c);if(!e)throw Error("useDatabase must be used within a DatabaseProvider");return e}},6888:(e,t,r)=>{"use strict";r.d(t,{dj:()=>h});var a=r(8009);let s=0,o=new Map,i=e=>{if(o.has(e))return;let t=setTimeout(()=>{o.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);o.set(e,t)},n=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?i(r):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},c=[],l={toasts:[]};function d(e){l=n(l,e),c.forEach(e=>{e(l)})}function u({...e}){let t=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),r=()=>d({type:"DISMISS_TOAST",toastId:t});return d({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function h(){let[e,t]=a.useState(l);return a.useEffect(()=>(c.push(t),()=>{let e=c.indexOf(t);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},3603:(e,t,r)=>{"use strict";r.d(t,{cn:()=>o});var a=r(2281),s=r(4805);function o(...e){return(0,s.QP)((0,a.$)(e))}},1831:(e,t,r)=>{"use strict";r.d(t,{DatabaseProvider:()=>s});var a=r(4379);let s=(0,a.registerClientReference)(function(){throw Error("Attempted to call DatabaseProvider() from the server but DatabaseProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js","DatabaseProvider");(0,a.registerClientReference)(function(){throw Error("Attempted to call useDatabase() from the server but useDatabase is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js","useDatabase")}};
|
|
1
|
+
exports.id=336,exports.ids=[336],exports.modules={97928:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,13219,23)),Promise.resolve().then(r.t.bind(r,34863,23)),Promise.resolve().then(r.t.bind(r,25155,23)),Promise.resolve().then(r.t.bind(r,40802,23)),Promise.resolve().then(r.t.bind(r,9350,23)),Promise.resolve().then(r.t.bind(r,48530,23)),Promise.resolve().then(r.t.bind(r,88921,23))},61480:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,66959,23)),Promise.resolve().then(r.t.bind(r,33875,23)),Promise.resolve().then(r.t.bind(r,88903,23)),Promise.resolve().then(r.t.bind(r,57174,23)),Promise.resolve().then(r.t.bind(r,84178,23)),Promise.resolve().then(r.t.bind(r,87190,23)),Promise.resolve().then(r.t.bind(r,61365,23))},99233:(e,t,r)=>{Promise.resolve().then(r.bind(r,13164)),Promise.resolve().then(r.bind(r,91831))},12385:(e,t,r)=>{Promise.resolve().then(r.bind(r,52652)),Promise.resolve().then(r.bind(r,2899))},52652:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>v});var a=r(45512),s=r(46888),o=r(58009),i=r(68952),n=r(21643),c=r(51255),l=r(3603);let d=i.Kq,u=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.LM,{ref:r,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));u.displayName=i.LM.displayName;let h=(0,n.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),p=o.forwardRef(({className:e,variant:t,...r},s)=>(0,a.jsx)(i.bL,{ref:s,className:(0,l.cn)(h({variant:t}),e),...r}));p.displayName=i.bL.displayName,o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.rc,{ref:r,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t})).displayName=i.rc.displayName;let m=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.bm,{ref:r,className:(0,l.cn)("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:(0,a.jsx)(c.A,{className:"h-4 w-4"})}));m.displayName=i.bm.displayName;let f=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.hE,{ref:r,className:(0,l.cn)("text-sm font-semibold [&+div]:text-xs",e),...t}));f.displayName=i.hE.displayName;let b=o.forwardRef(({className:e,...t},r)=>(0,a.jsx)(i.VY,{ref:r,className:(0,l.cn)("text-sm opacity-90",e),...t}));function v(){let{toasts:e}=(0,s.dj)();return(0,a.jsxs)(d,{children:[e.map(function({id:e,title:t,description:r,action:s,...o}){return(0,a.jsxs)(p,{...o,children:[(0,a.jsxs)("div",{className:"grid gap-1",children:[t&&(0,a.jsx)(f,{children:t}),r&&(0,a.jsx)(b,{children:r})]}),s,(0,a.jsx)(m,{})]},e)}),(0,a.jsx)(u,{})]})}b.displayName=i.VY.displayName},98180:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u,metadata:()=>d});var a=r(62740),s=r(27944),o=r.n(s),i=r(95510),n=r.n(i);r(61135);var c=r(91831),l=r(13164);let d={title:"d1-studio",description:"Native D1 database studio."};function u({children:e}){return(0,a.jsx)("html",{lang:"en",children:(0,a.jsx)("body",{className:`${o().variable} ${n().variable} antialiased`,children:(0,a.jsxs)(c.DatabaseProvider,{children:[e,(0,a.jsx)(l.Toaster,{})," "]})})})}},13164:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>a});let a=(0,r(46760).registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/karenredona/Desktop/d1studio/src/components/ui/toaster.jsx","Toaster")},61135:()=>{},2899:(e,t,r)=>{"use strict";r.d(t,{DatabaseProvider:()=>u,t:()=>h});var a=r(45512),s=r(58009),o=r(46888);let i=new Map;function n(e,t,r=2e3){let a=i.get(e);if(a&&Date.now()-a.timestamp<r)return a.promise;let s=t();return i.set(e,{promise:s,timestamp:Date.now()}),s.finally(()=>{setTimeout(()=>{i.delete(e)},r)}),s}let c=(0,s.createContext)(void 0);class l{constructor(){this.cache=new Map}get(e){return this.cache.get(e)||null}set(e,t,r,a){this.cache.set(e,{data:t,schema:r,meta:a,timestamp:Date.now()})}update(e,t,r,a){let s=this.cache.get(e);s&&this.cache.set(e,{data:t||s.data,schema:r||s.schema,meta:a||s.meta,timestamp:Date.now()})}invalidate(e){this.cache.delete(e)}clear(){this.cache.clear()}}class d{constructor(){this.queue=[],this.processing=!1}async add(e){return new Promise((t,r)=>{this.queue.push({operation:e,resolve:t,reject:r}),this.process()})}async process(){if(this.processing||0===this.queue.length)return;this.processing=!0;let{operation:e,resolve:t,reject:r}=this.queue.shift();try{let r=await e();t(r)}catch(e){r(e)}finally{this.processing=!1,this.process()}}}function u({children:e}){let{toast:t}=(0,o.dj)(),[r,i]=(0,s.useState)([]),[u,h]=(0,s.useState)(!0),[p,m]=(0,s.useState)(null),[f,b]=(0,s.useState)(null);(0,s.useRef)(new d);let[v,y]=(0,s.useState)(null),g=(0,s.useRef)(new l).current,w=(0,s.useCallback)((e,t=1,r=50)=>{let a=`table-${e}-${t}-${r}`;return g.get(a)},[]),x=(0,s.useCallback)(e=>{g.cache.forEach((t,r)=>{r.startsWith(`table-${e}-`)&&g.invalidate(r)})},[]),T=(0,s.useCallback)((e,t,r,a,s=1,o=50)=>{let i=`table-${e}-${s}-${o}`;g.update(i,t,r,a)},[]),S=(0,s.useCallback)(async e=>n(`query-${e}`,async()=>{try{let t=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e})});if(!t.ok){let e="Failed to execute query";try{let r=await t.json();e=r?.error?.message||e}catch(e){}throw Error(e)}let r=await t.json();if(!r.success)throw Error(r.error||"Query execution failed");return r}catch(e){throw e||Error("An unknown error occurred")}},1e3),[]),j=(0,s.useCallback)(async e=>{try{let t=await fetch(`/api/tables/${e}`),r=await t.json();if(!t.ok||!r.success)throw Error(r.error||"Failed to fetch table schema");return r.schema||[]}catch(e){throw console.error("Schema fetch error:",e),t({variant:"destructive",title:"Schema Fetch Failed",description:e.message}),e}},[t]),E=(0,s.useCallback)(async(e,r={})=>{let{forceFetch:a=!1,page:s=1,limit:o=50}=r,i=`table-${e}-${s}-${o}`;if(!a){let e=g.get(i);if(e)return e}return n(`table-${e}-${s}-${o}`,async()=>{try{let t=await fetch(`/api/tables/${e}?page=${s}&limit=${o}`,{headers:{"Cache-Control":"no-cache",Pragma:"no-cache"}});if(!t.ok)throw Error("Failed to fetch table data");let r=await t.json();if(!r.success)throw Error(r.error||"Failed to fetch table data");return g.set(i,r.data,r.schema,r.meta),r}catch(e){throw console.error("Error fetching table data:",e),t({variant:"destructive",title:"Data Fetch Failed",description:e.message}),e}},1e3)},[t]),C=(0,s.useCallback)(async e=>{try{return g.invalidate(e),await E(e,{forceFetch:!0})}catch(e){throw console.error("Error updating table data:",e),t({variant:"destructive",title:"Update Failed",description:e.message}),e}},[E,t]),P=(0,s.useCallback)(async(e,t={})=>(y(e),await E(e,t)),[E]),k=(0,s.useCallback)(async()=>n("refresh-tables",async()=>{h(!0),m(null);try{let e=await fetch("/api/tables");if(!e.ok)throw Error("Failed to fetch tables");let t=await e.json();if(t.error)throw Error(t.error);return i(t.tables||[]),t.tables||[]}catch(e){throw m(e.message),t({variant:"destructive",title:"Refresh Failed",description:e.message}),e}finally{h(!1)}},2e3),[t]),D=(0,s.useCallback)(async e=>{try{await S(e),g.clear(),await k(),t({title:"Success",description:"Table created successfully"})}catch(e){throw t({variant:"destructive",title:"Create Table Failed",description:e.message}),Error(`Failed to create table: ${e.message}`)}},[S,k,t]),N=(0,s.useCallback)(async e=>{try{await S(`DROP TABLE ${e};`),g.invalidate(e),await k(),t({title:"Success",description:"Table dropped successfully"})}catch(e){throw t({variant:"destructive",title:"Drop Table Failed",description:e.message}),Error(`Failed to drop table: ${e.message}`)}},[S,k,t]),$=(0,s.useCallback)(async e=>{try{let r=await fetch("/api/migrations/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let e=await r.json();throw Error(e.error?.message||"Failed to sync migrations")}let a=await r.json();return t({title:"Success",description:"Migrations synced successfully"}),a}catch(e){throw console.error("Error syncing migrations:",e),t({variant:"destructive",title:"Sync Failed",description:e.message}),e}},[t]),F=(0,s.useCallback)(async()=>{try{let e=localStorage.getItem("cf_credentials");if(!e)throw Error("No Cloudflare credentials found. Please connect to Cloudflare first.");let t=JSON.parse(e);if(!t.accountId||!t.apiToken)throw Error("Invalid credentials stored. Please reconnect to Cloudflare.");let r=await fetch("/api/pull-remote/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:t.accountId,apiToken:t.apiToken})}),a=await r.json();if(!r.ok||!a.success)throw Error(a.error?.message||"Failed to pull from remote");return g.clear(),await k(),a}catch(e){throw console.error("Error pulling from remote:",e),t({variant:"destructive",title:"Pull Failed",description:e.message}),e}},[k,t]),O=(0,s.useCallback)(async e=>{try{let t=await fetch("/api/push-remote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw Error(r.error?.message||"Failed to push to remote");return r}catch(e){throw console.error("Error pushing to remote:",e),e}},[t]),A=(0,s.useMemo)(()=>({tables:r,currentDatabase:f,isLoading:u,error:p,activeTable:v,refreshTables:k,executeQuery:S,fetchTableSchema:j,fetchTableData:E,updateTableData:C,createTable:D,dropTable:N,syncMigrations:$,pullFromRemote:F,pushToRemote:O,getCachedTable:w,updateTableCache:T,invalidateTable:x,switchTable:P}),[r,f,u,p,v,k,S,j,E,C,D,N,$,F,O,w,T,x,P]);return(0,a.jsx)(c.Provider,{value:A,children:e})}function h(){let e=(0,s.useContext)(c);if(!e)throw Error("useDatabase must be used within a DatabaseProvider");return e}},46888:(e,t,r)=>{"use strict";r.d(t,{dj:()=>h});var a=r(58009);let s=0,o=new Map,i=e=>{if(o.has(e))return;let t=setTimeout(()=>{o.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);o.set(e,t)},n=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?i(r):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},c=[],l={toasts:[]};function d(e){l=n(l,e),c.forEach(e=>{e(l)})}function u({...e}){let t=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),r=()=>d({type:"DISMISS_TOAST",toastId:t});return d({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function h(){let[e,t]=a.useState(l);return a.useEffect(()=>(c.push(t),()=>{let e=c.indexOf(t);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},3603:(e,t,r)=>{"use strict";r.d(t,{cn:()=>o});var a=r(82281),s=r(94805);function o(...e){return(0,s.QP)((0,a.$)(e))}},91831:(e,t,r)=>{"use strict";r.d(t,{DatabaseProvider:()=>s});var a=r(46760);let s=(0,a.registerClientReference)(function(){throw Error("Attempted to call DatabaseProvider() from the server but DatabaseProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js","DatabaseProvider");(0,a.registerClientReference)(function(){throw Error("Attempted to call useDatabase() from the server but useDatabase is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/karenredona/Desktop/d1studio/src/context/database-context.js","useDatabase")}};
|