d1s 0.2.8 → 0.2.10
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/dist/.next/.next/BUILD_ID +1 -1
- package/dist/.next/.next/app-build-manifest.json +49 -42
- package/dist/.next/.next/app-path-routes-manifest.json +1 -1
- package/dist/.next/.next/build-manifest.json +3 -3
- 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/3.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/4.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/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 +0 -0
- package/dist/.next/.next/cache/webpack/server-production/index.pack.old +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/required-server-files.json +1 -1
- package/dist/.next/.next/server/app/_not-found/page.js +1 -1
- package/dist/.next/.next/server/app/_not-found/page.js.nft.json +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_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_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_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_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app/api/update/route.js +1 -5
- package/dist/.next/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- 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 +10 -10
- package/dist/.next/.next/server/app/page.js.nft.json +1 -1
- package/dist/.next/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/.next/.next/server/app-paths-manifest.json +5 -4
- package/dist/.next/.next/server/chunks/226.js +30 -0
- package/dist/.next/.next/server/chunks/90.js +1 -0
- package/dist/.next/.next/server/chunks/992.js +1 -1
- package/dist/.next/.next/server/middleware-build-manifest.js +1 -1
- package/dist/.next/.next/server/next-font-manifest.js +1 -1
- package/dist/.next/.next/server/next-font-manifest.json +1 -1
- 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-manifest.json +1 -1
- package/dist/.next/.next/server/server-reference-manifest.json +1 -1
- package/dist/.next/.next/static/5dBGGUmK5q7of4h5Rahrg/_buildManifest.js +1 -0
- package/dist/.next/.next/static/PflNFnmFsNegSqhzjI6lA/_buildManifest.js +1 -0
- package/dist/.next/.next/static/chunks/{958-98887928efebfdf7.js → 700-dc8f9f08b166c5e6.js} +1 -1
- 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/layout-be6ee67cf0c92654.js +1 -0
- package/dist/.next/.next/static/chunks/app/page-16ec561fc8bebb5d.js +1 -0
- package/dist/.next/.next/static/chunks/{main-app-d36cdfb402b40f13.js → main-app-fa35024de9bd9284.js} +1 -1
- package/dist/.next/.next/static/css/0c512cea5f3d317a.css +3 -0
- package/dist/.next/.next/static/p8875OZM4iDNsPzmoyLe7/_buildManifest.js +1 -0
- package/dist/.next/.next/trace +3 -3
- package/dist/.next/.next/types/app/api/cloudflare/route.ts +1 -1
- package/dist/.next/.next/types/app/api/databases/route.ts +1 -1
- package/dist/.next/.next/types/app/api/migrations/sync/route.ts +1 -1
- package/dist/.next/.next/types/app/api/migrations/sync-files/route.ts +1 -1
- package/dist/.next/.next/types/app/api/pull-data/confirm/route.ts +347 -0
- package/dist/.next/.next/types/app/api/pull-remote/confirm/route.ts +1 -1
- package/dist/.next/.next/types/app/api/pull-remote/preview/route.ts +1 -1
- package/dist/.next/.next/types/app/api/push-remote/confirm/route.ts +1 -1
- package/dist/.next/.next/types/app/api/push-remote/preview/route.ts +1 -1
- package/dist/.next/.next/types/app/api/query/route.ts +1 -1
- package/dist/.next/.next/types/app/api/tables/[name]/route.ts +1 -1
- package/dist/.next/.next/types/app/api/tables/route.ts +1 -1
- package/dist/.next/.next/types/app/api/update/route.ts +1 -1
- package/dist/.next/.next/types/app/page.ts +1 -1
- package/dist/.next/BUILD_ID +1 -1
- package/dist/.next/app-build-manifest.json +53 -39
- package/dist/.next/app-path-routes-manifest.json +1 -1
- package/dist/.next/build-manifest.json +3 -3
- 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/required-server-files.json +1 -1
- package/dist/.next/server/app/_not-found/page.js +1 -1
- package/dist/.next/server/app/_not-found/page.js.nft.json +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 +3 -3
- 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 +1 -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.js.nft.json +1 -1
- package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app-paths-manifest.json +6 -4
- package/dist/.next/server/chunks/226.js +30 -0
- 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/90.js +1 -0
- package/dist/.next/server/chunks/992.js +3 -3
- package/dist/.next/server/middleware-build-manifest.js +1 -1
- package/dist/.next/server/next-font-manifest.js +1 -1
- package/dist/.next/server/next-font-manifest.json +1 -1
- 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/chunks/700-dc8f9f08b166c5e6.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/layout-be6ee67cf0c92654.js +1 -0
- package/dist/.next/static/chunks/app/page-16ec561fc8bebb5d.js +1 -0
- package/dist/.next/static/chunks/{main-app-d36cdfb402b40f13.js → main-app-fa35024de9bd9284.js} +1 -1
- package/dist/.next/static/css/0c512cea5f3d317a.css +3 -0
- package/dist/.next/static 2/5dBGGUmK5q7of4h5Rahrg/_buildManifest.js +1 -0
- package/dist/.next/trace +16 -14
- package/dist/.next/types/app/api/cloudflare/route.ts +1 -1
- package/dist/.next/types/app/api/databases/route.ts +1 -1
- package/dist/.next/types/app/api/migrations/sync/route.ts +1 -1
- package/dist/.next/types/app/api/migrations/sync-files/route.ts +1 -1
- package/dist/.next/types/app/api/pull-data/confirm/route.ts +347 -0
- package/dist/.next/types/app/api/pull-remote/confirm/route.ts +1 -1
- package/dist/.next/types/app/api/pull-remote/preview/route.ts +1 -1
- package/dist/.next/types/app/api/push-remote/confirm/route.ts +1 -1
- package/dist/.next/types/app/api/push-remote/preview/route.ts +1 -1
- package/dist/.next/types/app/api/query/route.ts +1 -1
- package/dist/.next/types/app/api/tables/[name]/route.ts +1 -1
- package/dist/.next/types/app/api/tables/route.ts +1 -1
- package/dist/.next/types/app/api/update/route.ts +347 -0
- package/dist/.next/types/app/page.ts +1 -1
- package/dist/app/api/pull-data/confirm/route.js +230 -0
- package/dist/app/api/update/route.js +45 -0
- package/dist/app/app/api/pull-data/confirm/route.js +230 -0
- package/dist/app/app/api/update/route.js +40 -6
- package/dist/app/app/page.jsx +21 -17
- package/dist/app/page.jsx +24 -14
- package/dist/d1-studio.js +8 -195
- package/dist/lib/logger.js +35 -5
- package/dist/lib/sql-operations.js +107 -24
- package/dist/lib/version-utils.js +34 -0
- package/package.json +2 -2
- package/scripts/studio.js +8 -195
- package/src/app/api/pull-data/confirm/route.js +230 -0
- package/src/app/api/update/route.js +40 -6
- package/src/app/page.jsx +21 -17
- 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 +27 -25
- package/src/components/update-banner.jsx +70 -41
- package/src/context/database-context.js +4 -4
- package/src/lib/logger.js +35 -5
- package/src/lib/sql-operations.js +107 -24
- package/src/lib/version-utils.js +34 -0
- package/dist/.next/.next/cache/webpack/client-development/0.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/client-development/1.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/client-development/2.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/client-development/3.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/client-development/4.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/client-development/index.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/client-development/index.pack.gz.old +0 -0
- package/dist/.next/.next/cache/webpack/client-production/10.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/11.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/12.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/13.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/14.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/5.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/6.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/7.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/8.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/9.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-development/0.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/server-development/1.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/server-development/2.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/server-development/3.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/server-development/4.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/server-development/index.pack.gz +0 -0
- package/dist/.next/.next/cache/webpack/server-development/index.pack.gz.old +0 -0
- package/dist/.next/.next/cache/webpack/server-production/10.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/11.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/12.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/13.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/3.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/4.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/5.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/6.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/7.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/8.pack +0 -0
- package/dist/.next/.next/cache/webpack/server-production/9.pack +0 -0
- package/dist/.next/.next/server/chunks/336.js +0 -1
- package/dist/.next/.next/server/chunks/686.js +0 -23
- package/dist/.next/.next/server/chunks/801.js +0 -55
- package/dist/.next/.next/static/IWRJZhjf8U8mjzz4h0VNE/_buildManifest.js +0 -1
- package/dist/.next/.next/static/JrwgdSDcipr0Zh7k19Cj_/_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/cloudflare/route-5133155a604f2719.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/databases/route-63a31080b565794e.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/route-d97667565b4a59b6.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/migrations/sync-files/route-7089bcbfeb6b5260.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/confirm/route-9143e6e4c3f05162.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/pull-remote/preview/route-c963d143a51aed66.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/push-remote/confirm/route-072132c0a6cb3df3.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/push-remote/preview/route-ca6bf35aa72661ee.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/query/route-1466f6b7ffd8b6c0.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/[name]/route-898d3f85fc8544c4.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/tables/route-3772b4f480c4b4a4.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/tables/route-91650359fc3735cb.js +0 -1
- package/dist/.next/.next/static/chunks/app/api/update/route-504d663df9124f97.js +0 -1
- package/dist/.next/.next/static/chunks/app/layout-8360fab69b848283.js +0 -1
- package/dist/.next/.next/static/chunks/app/page-2c28a255a4ecd8d4.js +0 -1
- package/dist/.next/.next/static/chunks/app/page-3db7feef57019055.js +0 -1
- package/dist/.next/.next/static/chunks/app/page-79049bfa6cc07e11.js +0 -1
- package/dist/.next/.next/static/css/4957328384ed5c42.css +0 -3
- package/dist/.next/.next/static/css/cf41da7a0d47f779.css +0 -3
- package/dist/.next/.next/static/gc8l1G6KXOeLLOM7VJip6/_buildManifest.js +0 -1
- package/dist/.next/.next/static/kYsJoni86CJWDuTkc1xU6/_buildManifest.js +0 -1
- package/dist/.next/.next/static/scC5qwQC9H7rR1groM0Q-/_buildManifest.js +0 -1
- package/dist/.next/.next/static/scC5qwQC9H7rR1groM0Q-/_ssgManifest.js +0 -1
- package/dist/.next/.next/static/tEHOI_-t-iqfJClNzuo9m/_buildManifest.js +0 -1
- package/dist/.next/.next/static/tEHOI_-t-iqfJClNzuo9m/_ssgManifest.js +0 -1
- package/dist/.next/.next/static/vin2VQs5pM_dH2e2_I7AN/_buildManifest.js +0 -1
- package/dist/.next/.next/static/vin2VQs5pM_dH2e2_I7AN/_ssgManifest.js +0 -1
- package/dist/.next/.next/static/wHKwQhaxin5_i06GFVDHb/_buildManifest.js +0 -1
- package/dist/.next/.next/static/wHKwQhaxin5_i06GFVDHb/_ssgManifest.js +0 -1
- package/dist/.next/.next/static/xW4MspD8XibrhXDi_q2IO/_buildManifest.js +0 -1
- package/dist/.next/.next/static/xW4MspD8XibrhXDi_q2IO/_ssgManifest.js +0 -1
- package/dist/.next/server/chunks/336.js +0 -1
- package/dist/.next/server/chunks/686.js +0 -23
- package/dist/.next/server/chunks/801.js +0 -55
- package/dist/.next/static/ZwNOdZJ0LOtE0AJMNWwzY/_buildManifest.js +0 -1
- package/dist/.next/static/ZwNOdZJ0LOtE0AJMNWwzY/_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/layout-8360fab69b848283.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/{IWRJZhjf8U8mjzz4h0VNE → 5dBGGUmK5q7of4h5Rahrg}/_ssgManifest.js +0 -0
- /package/dist/.next/.next/static/{JrwgdSDcipr0Zh7k19Cj_ → PflNFnmFsNegSqhzjI6lA}/_ssgManifest.js +0 -0
- /package/dist/.next/.next/static/{gc8l1G6KXOeLLOM7VJip6 → p8875OZM4iDNsPzmoyLe7}/_ssgManifest.js +0 -0
- /package/dist/.next/{.next/static/kYsJoni86CJWDuTkc1xU6 → static 2/5dBGGUmK5q7of4h5Rahrg}/_ssgManifest.js +0 -0
|
@@ -1,64 +1,93 @@
|
|
|
1
1
|
// components/update-banner.jsx
|
|
2
|
-
|
|
3
2
|
'use client'
|
|
4
3
|
|
|
5
4
|
import { useEffect, useState } from 'react';
|
|
5
|
+
import { Info } from 'lucide-react';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
|
|
8
8
|
export default function UpdateBanner() {
|
|
9
9
|
const [updateInfo, setUpdateInfo] = useState(null);
|
|
10
|
-
const [visible, setVisible] = useState(
|
|
11
|
-
|
|
12
|
-
// On component mount, check if the banner was previously dismissed
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const isDismissed = localStorage.getItem('updateBannerDismissed');
|
|
15
|
-
if (isDismissed === 'true') {
|
|
16
|
-
setVisible(false);
|
|
17
|
-
}
|
|
18
|
-
}, []);
|
|
10
|
+
const [visible, setVisible] = useState(false);
|
|
11
|
+
const [loading, setLoading] = useState(true);
|
|
19
12
|
|
|
20
|
-
// Fetch update info from /api/update
|
|
21
13
|
useEffect(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const checkForUpdates = async () => {
|
|
15
|
+
try {
|
|
16
|
+
setLoading(true);
|
|
17
|
+
|
|
18
|
+
// Check if we've already dismissed this specific version update
|
|
19
|
+
const dismissedVersion = localStorage.getItem('dismissedVersion');
|
|
20
|
+
|
|
21
|
+
const { data } = await axios.get('/api/update');
|
|
22
|
+
|
|
26
23
|
if (data?.update) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
// Only show if the user hasn't dismissed this specific version
|
|
25
|
+
if (dismissedVersion !== data.update.latest) {
|
|
26
|
+
setUpdateInfo(data.update);
|
|
27
|
+
setVisible(true);
|
|
28
|
+
} else {
|
|
29
|
+
setVisible(false);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
setVisible(false);
|
|
31
33
|
}
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('Error checking for updates:', error);
|
|
36
|
+
setVisible(false);
|
|
37
|
+
} finally {
|
|
38
|
+
setLoading(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Check immediately and then daily
|
|
43
|
+
checkForUpdates();
|
|
44
|
+
const interval = setInterval(checkForUpdates, 24 * 60 * 60 * 1000); // Check daily
|
|
45
|
+
|
|
46
|
+
return () => clearInterval(interval);
|
|
34
47
|
}, []);
|
|
35
48
|
|
|
36
|
-
// If
|
|
37
|
-
if (!updateInfo || !visible)
|
|
49
|
+
// If banner is dismissed or no update info, don't render and reset CSS variable
|
|
50
|
+
if (!updateInfo || !visible || loading) {
|
|
51
|
+
// Reset the banner height when hidden
|
|
52
|
+
if (typeof document !== 'undefined') {
|
|
53
|
+
document.documentElement.style.setProperty('--banner-height', '0px');
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Set the banner height CSS variable when visible
|
|
59
|
+
if (typeof document !== 'undefined') {
|
|
60
|
+
document.documentElement.style.setProperty('--banner-height', '37px'); // Adjust based on actual banner height
|
|
61
|
+
}
|
|
38
62
|
|
|
39
|
-
// Close handler that writes to localStorage
|
|
40
63
|
const handleClose = () => {
|
|
41
|
-
|
|
64
|
+
// Store the dismissed version to avoid showing the same update again
|
|
65
|
+
if (updateInfo?.latest) {
|
|
66
|
+
localStorage.setItem('dismissedVersion', updateInfo.latest);
|
|
67
|
+
}
|
|
42
68
|
setVisible(false);
|
|
43
69
|
};
|
|
44
70
|
|
|
45
71
|
return (
|
|
46
|
-
<div className="bg-
|
|
47
|
-
<div className="
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
<div className="fixed top-0 left-0 right-0 z-50 bg-yellow-200 border-b border-yellow-500 px-3 py-2 font-sans">
|
|
73
|
+
<div className="flex items-center justify-center relative">
|
|
74
|
+
{/* Info icon and text centered */}
|
|
75
|
+
<div className="flex items-center gap-2 mx-auto">
|
|
76
|
+
<Info className="h-4 w-4 text-neutral-900" />
|
|
77
|
+
<span className="text-sm font-medium">
|
|
78
|
+
Version {updateInfo.latest} is available — npm install -g d1s@latest
|
|
79
|
+
</span>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
{/* Close button positioned absolutely on the right */}
|
|
83
|
+
<button
|
|
84
|
+
onClick={handleClose}
|
|
85
|
+
className="absolute right-0 text-neutral-500 hover:text-neutral-700"
|
|
86
|
+
aria-label="Close update banner"
|
|
87
|
+
>
|
|
88
|
+
×
|
|
89
|
+
</button>
|
|
54
90
|
</div>
|
|
55
|
-
<button
|
|
56
|
-
onClick={handleClose}
|
|
57
|
-
className="ml-4 text-gray-500 hover:text-gray-700"
|
|
58
|
-
aria-label="Close update banner"
|
|
59
|
-
>
|
|
60
|
-
×
|
|
61
|
-
</button>
|
|
62
91
|
</div>
|
|
63
92
|
);
|
|
64
|
-
}
|
|
93
|
+
}
|
|
@@ -395,10 +395,10 @@ export function DatabaseProvider({ children }) {
|
|
|
395
395
|
tableCache.clear();
|
|
396
396
|
await refreshTables();
|
|
397
397
|
|
|
398
|
-
toast({
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
});
|
|
398
|
+
// toast({
|
|
399
|
+
// title: "Success",
|
|
400
|
+
// description: `Remote state applied successfully. Migrations applied: ${data.details.appliedMigrations.join(', ')}`,
|
|
401
|
+
// });
|
|
402
402
|
|
|
403
403
|
return data;
|
|
404
404
|
} catch (error) {
|
package/src/lib/logger.js
CHANGED
|
@@ -4,14 +4,21 @@ const { combine, timestamp, printf, colorize } = winston.format;
|
|
|
4
4
|
|
|
5
5
|
const isDevelopment = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === undefined;
|
|
6
6
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
7
|
+
// Check for DEBUG env var which is set by --debug flag
|
|
7
8
|
const isDebug = process.env.DEBUG === 'true';
|
|
8
9
|
|
|
9
|
-
const logFormat = printf(({ level, message, timestamp }) => {
|
|
10
|
-
|
|
10
|
+
const logFormat = printf(({ level, message, timestamp, ...metadata }) => {
|
|
11
|
+
let msg = `${timestamp} ${level}: ${message}`;
|
|
12
|
+
// Add metadata if present
|
|
13
|
+
if (Object.keys(metadata).length > 0) {
|
|
14
|
+
msg += ` ${JSON.stringify(metadata)}`;
|
|
15
|
+
}
|
|
16
|
+
return msg;
|
|
11
17
|
});
|
|
12
18
|
|
|
13
19
|
const logger = winston.createLogger({
|
|
14
|
-
|
|
20
|
+
// Set log level based on environment and debug flag
|
|
21
|
+
level: isDebug ? 'debug' : (isProduction ? 'warn' : 'info'),
|
|
15
22
|
format: combine(
|
|
16
23
|
timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
|
|
17
24
|
colorize(),
|
|
@@ -19,10 +26,33 @@ const logger = winston.createLogger({
|
|
|
19
26
|
),
|
|
20
27
|
transports: [
|
|
21
28
|
new winston.transports.Console({
|
|
22
|
-
level:
|
|
29
|
+
level: isDebug ? 'debug' : (isProduction ? 'warn' : 'info'),
|
|
23
30
|
silent: process.env.NODE_ENV === 'test'
|
|
24
31
|
})
|
|
25
32
|
]
|
|
26
33
|
});
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
// Add helper methods
|
|
36
|
+
logger.logRequest = (method, path, params = {}) => {
|
|
37
|
+
logger.debug(`Request: ${method} ${path}`, params);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
logger.logError = (error, source = 'unknown') => {
|
|
41
|
+
logger.error(`Error in ${source}: ${error.message}`, {
|
|
42
|
+
error: error.stack || error.message,
|
|
43
|
+
source
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
logger.shouldLog = (level) => {
|
|
48
|
+
const currentLevel = logger.level;
|
|
49
|
+
const levels = {
|
|
50
|
+
error: 0,
|
|
51
|
+
warn: 1,
|
|
52
|
+
info: 2,
|
|
53
|
+
debug: 3
|
|
54
|
+
};
|
|
55
|
+
return levels[level] <= levels[currentLevel];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default logger;
|
|
@@ -112,26 +112,18 @@ export function parseStatement(sql) {
|
|
|
112
112
|
// Extract the index name.
|
|
113
113
|
const indexMatch = cleanSql.match(/INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?([\w$]+)/i);
|
|
114
114
|
const indexName = indexMatch ? indexMatch[1] : '';
|
|
115
|
-
// Extract the columns from the ON clause.
|
|
116
|
-
const onMatch = cleanSql.match(/ON\s+[\w$]+\s*\(([^)]+)\)/i);
|
|
117
|
-
const columns = onMatch ? onMatch[1].trim() : '';
|
|
118
|
-
// Remove spaces and replace commas with hyphens.
|
|
119
|
-
const formattedColumns = columns.replace(/\s+/g, '').replace(/,/g, '-').toLowerCase();
|
|
120
115
|
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
let description = indexName;
|
|
124
|
-
if (formattedColumns && !description.toLowerCase().includes(formattedColumns)) {
|
|
125
|
-
description += `-${formattedColumns}`;
|
|
126
|
-
}
|
|
116
|
+
// For index migrations, simply use the index name as the description.
|
|
117
|
+
const description = indexName;
|
|
127
118
|
|
|
128
119
|
return {
|
|
129
120
|
type: Operations.CREATE_INDEX,
|
|
130
121
|
tableName,
|
|
131
122
|
sql: cleanSql,
|
|
132
|
-
description // e.g. "
|
|
123
|
+
description // now simply the index name, e.g. "idx_technology_timestamp"
|
|
133
124
|
};
|
|
134
|
-
}
|
|
125
|
+
}
|
|
126
|
+
|
|
135
127
|
|
|
136
128
|
if (upperSql.startsWith('DROP INDEX')) {
|
|
137
129
|
const tableName = extractTableNameFromIndex(cleanSql);
|
|
@@ -342,6 +334,83 @@ export async function executeSQL(projectDir, databaseName, sql, env = {}, remote
|
|
|
342
334
|
}
|
|
343
335
|
}
|
|
344
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Fetches the latest `limit` records for a given table from the remote database.
|
|
339
|
+
*
|
|
340
|
+
* This implementation uses the executeSQL function with the remote flag enabled.
|
|
341
|
+
* It orders the results based on the provided ordering column. If no ordering column is provided,
|
|
342
|
+
* it falls back to the default "id" column.
|
|
343
|
+
*
|
|
344
|
+
* @param {string} projectDir - The project directory.
|
|
345
|
+
* @param {string} databaseName - The D1 database name.
|
|
346
|
+
* @param {string} tableName - The table to fetch records for.
|
|
347
|
+
* @param {object} env - Environment variables (including credentials).
|
|
348
|
+
* @param {number} limit - The number of records to fetch.
|
|
349
|
+
* @param {string} [orderingColumn="id"] - The column to order by.
|
|
350
|
+
* @returns {Promise<Array<object>>} Array of row objects.
|
|
351
|
+
*/
|
|
352
|
+
export async function fetchRemoteTableData(
|
|
353
|
+
projectDir,
|
|
354
|
+
databaseName,
|
|
355
|
+
tableName,
|
|
356
|
+
env,
|
|
357
|
+
limit,
|
|
358
|
+
orderingColumn = "id"
|
|
359
|
+
) {
|
|
360
|
+
// Use the provided ordering column; if not provided, default to "id".
|
|
361
|
+
const query = `SELECT * FROM "${tableName}" ORDER BY "${orderingColumn}" DESC LIMIT ${limit};`;
|
|
362
|
+
try {
|
|
363
|
+
// Execute the SQL command on the remote database.
|
|
364
|
+
const result = await executeSQL(projectDir, databaseName, query, env, true);
|
|
365
|
+
|
|
366
|
+
// ExecuteSQL returns stdout that should contain a JSON array starting from a '['.
|
|
367
|
+
const jsonStart = result.indexOf('[');
|
|
368
|
+
if (jsonStart === -1) {
|
|
369
|
+
throw new Error(`Unexpected result format: ${result}`);
|
|
370
|
+
}
|
|
371
|
+
const jsonStr = result.substring(jsonStart);
|
|
372
|
+
const parsed = JSON.parse(jsonStr);
|
|
373
|
+
// Assuming the structure: parsed[0].results contains the rows.
|
|
374
|
+
const rows = parsed[0]?.results || [];
|
|
375
|
+
return rows;
|
|
376
|
+
} catch (error) {
|
|
377
|
+
logger.error(`Error fetching remote data for table ${tableName}:`, error);
|
|
378
|
+
throw error;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Generates a bulk insert SQL statement for the specified table and rows.
|
|
384
|
+
*
|
|
385
|
+
* This function constructs a single INSERT statement that inserts multiple rows.
|
|
386
|
+
* It escapes single quotes in string values. You may need to extend this for
|
|
387
|
+
* additional data types (e.g., numbers, dates, booleans) or more complex structures.
|
|
388
|
+
*
|
|
389
|
+
* @param {string} tableName - The table to insert into.
|
|
390
|
+
* @param {Array<object>} rows - An array of objects, each representing a row.
|
|
391
|
+
* @returns {string} The bulk insert SQL statement.
|
|
392
|
+
*/
|
|
393
|
+
export function generateBulkInsertSQL(tableName, rows) {
|
|
394
|
+
if (!rows || rows.length === 0) return '';
|
|
395
|
+
|
|
396
|
+
// Get the list of columns from the first row object.
|
|
397
|
+
const columns = Object.keys(rows[0]);
|
|
398
|
+
const columnList = columns.map(col => `"${col}"`).join(', ');
|
|
399
|
+
|
|
400
|
+
// Build the values list for each row.
|
|
401
|
+
const valuesList = rows.map(row => {
|
|
402
|
+
const values = columns.map(col => {
|
|
403
|
+
const value = row[col];
|
|
404
|
+
if (value === null || value === undefined) return 'NULL';
|
|
405
|
+
// For simplicity, treat the value as a string.
|
|
406
|
+
return `'${String(value).replace(/'/g, "''")}'`;
|
|
407
|
+
}).join(', ');
|
|
408
|
+
return `(${values})`;
|
|
409
|
+
}).join(', ');
|
|
410
|
+
|
|
411
|
+
return `INSERT INTO "${tableName}" (${columnList}) VALUES ${valuesList};`;
|
|
412
|
+
}
|
|
413
|
+
|
|
345
414
|
// ---------------------------------------------------------------------
|
|
346
415
|
// SQL Formatting and Helper Functions
|
|
347
416
|
// ---------------------------------------------------------------------
|
|
@@ -482,14 +551,14 @@ export function formatMigrationContent(sql) {
|
|
|
482
551
|
* @returns {Promise<string>} The migration file content.
|
|
483
552
|
*/
|
|
484
553
|
|
|
485
|
-
|
|
554
|
+
export async function getMigrationFileContent(projectDir, databaseName, migrationFile, env) {
|
|
486
555
|
try {
|
|
487
556
|
// Extract table name using improved helper
|
|
488
557
|
const tableName = await extractTableNameFromMigration(migrationFile);
|
|
489
558
|
let sql;
|
|
490
559
|
|
|
491
|
-
|
|
492
|
-
|
|
560
|
+
// For non-index migrations, try getting SQL from sqlite_master for table
|
|
561
|
+
if (tableName && !migrationFile.includes('create-index')) {
|
|
493
562
|
const result = await executeSQL(
|
|
494
563
|
projectDir,
|
|
495
564
|
databaseName,
|
|
@@ -506,24 +575,38 @@ export function formatMigrationContent(sql) {
|
|
|
506
575
|
}
|
|
507
576
|
}
|
|
508
577
|
|
|
509
|
-
// If we couldn't get the SQL from table, try index
|
|
578
|
+
// If we couldn't get the SQL from table and it's an index migration, try fetching via index name.
|
|
510
579
|
if (!sql && migrationFile.includes('create-index')) {
|
|
511
|
-
const indexMatch = migrationFile.match(/create-index[-
|
|
580
|
+
const indexMatch = migrationFile.match(/create-index[_-](.+)\.sql$/i);
|
|
512
581
|
if (indexMatch) {
|
|
513
|
-
|
|
582
|
+
let indexName = indexMatch[1]; // e.g. "idx_technology_timestamp-technology-timestamp"
|
|
583
|
+
let result = await executeSQL(
|
|
514
584
|
projectDir,
|
|
515
585
|
databaseName,
|
|
516
|
-
`SELECT sql FROM sqlite_master WHERE type='index' AND name='${
|
|
586
|
+
`SELECT sql FROM sqlite_master WHERE type='index' AND name='${indexName}' COLLATE NOCASE;`,
|
|
517
587
|
env,
|
|
518
588
|
true
|
|
519
589
|
);
|
|
520
|
-
|
|
590
|
+
let parsed = JSON.parse(result);
|
|
521
591
|
sql = parsed[0]?.results?.[0]?.sql;
|
|
592
|
+
// Fallback: if no result, try using only the part before the first hyphen.
|
|
593
|
+
if (!sql) {
|
|
594
|
+
const fallbackIndexName = indexName.split('-')[0]; // "idx_technology_timestamp"
|
|
595
|
+
result = await executeSQL(
|
|
596
|
+
projectDir,
|
|
597
|
+
databaseName,
|
|
598
|
+
`SELECT sql FROM sqlite_master WHERE type='index' AND name='${fallbackIndexName}' COLLATE NOCASE;`,
|
|
599
|
+
env,
|
|
600
|
+
true
|
|
601
|
+
);
|
|
602
|
+
parsed = JSON.parse(result);
|
|
603
|
+
sql = parsed[0]?.results?.[0]?.sql;
|
|
604
|
+
}
|
|
522
605
|
}
|
|
523
|
-
}
|
|
606
|
+
}
|
|
524
607
|
|
|
525
|
-
// If still no SQL
|
|
526
|
-
if (!sql && tableName) {
|
|
608
|
+
// If still no SQL and it's not an index migration, try a fallback query
|
|
609
|
+
if (!sql && tableName && !migrationFile.includes('create-index')) {
|
|
527
610
|
const result = await executeSQL(
|
|
528
611
|
projectDir,
|
|
529
612
|
databaseName,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// lib/version-utils.js
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Compares semantic versions to determine if v2 is newer than v1
|
|
5
|
+
* @param {string} v1 - First version (e.g. "1.0.0")
|
|
6
|
+
* @param {string} v2 - Second version (e.g. "1.0.1")
|
|
7
|
+
* @returns {boolean} True if v2 is newer than v1
|
|
8
|
+
*/
|
|
9
|
+
export function isNewerVersion(v1, v2) {
|
|
10
|
+
if (!v1 || !v2) return false;
|
|
11
|
+
|
|
12
|
+
// Split versions by dots
|
|
13
|
+
const v1Parts = v1.split('.').map(Number);
|
|
14
|
+
const v2Parts = v2.split('.').map(Number);
|
|
15
|
+
|
|
16
|
+
// Compare major, minor, and patch versions
|
|
17
|
+
for (let i = 0; i < 3; i++) {
|
|
18
|
+
if (v2Parts[i] > v1Parts[i]) return true;
|
|
19
|
+
if (v2Parts[i] < v1Parts[i]) return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// If we reach here, versions are equal
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Formats version strings for display by removing leading 'v' if present
|
|
28
|
+
* @param {string} version - The version string (e.g. "v1.0.0" or "1.0.0")
|
|
29
|
+
* @returns {string} Formatted version (e.g. "1.0.0")
|
|
30
|
+
*/
|
|
31
|
+
export function formatVersion(version) {
|
|
32
|
+
if (!version) return '';
|
|
33
|
+
return version.startsWith('v') ? version.substring(1) : version;
|
|
34
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
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,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}},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")}};
|