d1s 0.2.2 → 0.2.4
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 +19 -19
- 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/.tsbuildinfo +1 -1
- package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/4.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/index.pack +0 -0
- package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/dist/.next/.next/cache/webpack/server-production/0.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/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/server/app/_not-found.html +1 -1
- package/dist/.next/.next/server/app/_not-found.rsc +1 -1
- package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
- package/dist/.next/.next/server/app/api/databases/route.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync/route.js +1 -1
- package/dist/.next/.next/server/app/api/migrations/sync-files/route.js +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +1 -1
- package/dist/.next/.next/server/app/api/pull-remote/preview/route.js +1 -1
- package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +2 -2
- package/dist/.next/.next/server/app/api/push-remote/preview/route.js +2 -2
- package/dist/.next/.next/server/app/api/query/route.js +2 -2
- package/dist/.next/.next/server/app/api/tables/[name]/route.js +2 -2
- package/dist/.next/.next/server/app/api/tables/route.js +2 -2
- package/dist/.next/.next/server/app/index.html +1 -1
- package/dist/.next/.next/server/app/index.rsc +1 -1
- package/dist/.next/.next/server/app/page.js +6 -6
- package/dist/.next/.next/server/app-paths-manifest.json +4 -4
- package/dist/.next/.next/server/chunks/336.js +1 -1
- package/dist/.next/.next/server/chunks/801.js +11 -11
- package/dist/.next/.next/server/chunks/973.js +1 -1
- package/dist/.next/.next/server/chunks/992.js +2 -2
- package/dist/.next/.next/server/pages/404.html +1 -1
- package/dist/.next/.next/server/pages/500.html +1 -1
- package/dist/.next/.next/static/YIuXI2CxMwg2fuuUEBsXL/_buildManifest.js +1 -0
- package/dist/.next/.next/static/YIuXI2CxMwg2fuuUEBsXL/_ssgManifest.js +1 -0
- package/dist/.next/.next/static/fSVNB2iNhKcZdXXgESWZk/_buildManifest.js +1 -0
- package/dist/.next/.next/static/fSVNB2iNhKcZdXXgESWZk/_ssgManifest.js +1 -0
- package/dist/.next/.next/trace +3 -3
- package/dist/app/app/api/databases/route.js +1 -1
- package/dist/app/app/api/pull-remote/confirm/route.js +20 -20
- package/dist/app/app/api/push-remote/confirm/route.js +1 -1
- package/dist/app/app/api/push-remote/preview/route.js +1 -1
- package/dist/app/app/api/query/route.js +7 -7
- package/dist/d1-studio.js +25 -1
- package/dist/lib/find-wrangler-config.js +1 -1
- package/package.json +1 -1
- package/scripts/studio.js +25 -1
- package/src/app/api/databases/route.js +1 -1
- package/src/app/api/pull-remote/confirm/route.js +20 -20
- package/src/app/api/push-remote/confirm/route.js +1 -1
- package/src/app/api/push-remote/preview/route.js +1 -1
- package/src/app/api/query/route.js +7 -7
- package/src/lib/find-wrangler-config.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={};e.id=952,e.ids=[952],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9748:e=>{"use strict";e.exports=require("fs/promises")},1820:e=>{"use strict";e.exports=require("os")},7910:e=>{"use strict";e.exports=require("stream")},3997:e=>{"use strict";e.exports=require("tty")},
|
|
1
|
+
(()=>{var e={};e.id=952,e.ids=[952],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9748:e=>{"use strict";e.exports=require("fs/promises")},1820:e=>{"use strict";e.exports=require("os")},7910:e=>{"use strict";e.exports=require("stream")},3997:e=>{"use strict";e.exports=require("tty")},3024:e=>{"use strict";e.exports=require("node:fs")},6760:e=>{"use strict";e.exports=require("node:path")},1708:e=>{"use strict";e.exports=require("node:process")},3136:e=>{"use strict";e.exports=require("node:url")},6731:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>x,routeModule:()=>l,serverHooks:()=>f,workAsyncStorage:()=>p,workUnitAsyncStorage:()=>g});var s={};t.r(s),t.d(s,{GET:()=>c,OPTIONS:()=>d});var o=t(2706),n=t(8203),a=t(5994),i=t(9187),u=t(5949);async function c(){try{let e=process.env.D1_PROJECT_DIR;if(!e)return console.error("D1_PROJECT_DIR environment variable is not set"),i.NextResponse.json({error:"Project directory not configured"},{status:500});let r=await (0,u.S)(e);if(!r||!r.config)return i.NextResponse.json({error:"No Wrangler configuration file found in project directory"},{status:404});let t=r.config;if(!t.d1_databases?.length)return i.NextResponse.json({error:"No D1 databases configured in Wrangler configuration"},{status:404});return i.NextResponse.json({databases:t.d1_databases,debug:{projectDir:e,configPath:r.configPath||"N/A",databaseCount:t.d1_databases.length}})}catch(e){return console.error("Error reading database configuration:",e),i.NextResponse.json({error:"Failed to read database configuration",details:e.message,debug:{errorCode:e.code,errorStack:e.stack}},{status:500})}}async function d(){return new i.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let l=new o.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/databases/route",pathname:"/api/databases",filename:"route",bundlePath:"app/api/databases/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/databases/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:p,workUnitAsyncStorage:g,serverHooks:f}=l;function x(){return(0,a.patchFetch)({workAsyncStorage:p,workUnitAsyncStorage:g})}},6487:()=>{},8335:()=>{},5949:(e,r,t)=>{"use strict";t.d(r,{S:()=>u});var s=t(9748),o=t(3149),n=t(2537),a=t(6789),i=t(872);async function u(e){try{let r;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");let t=null,u=null;for(let r of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(t=await (0,o.dJ)(r,{cwd:e})){u=r;break}if(!t)return console.log(i.yellow("No Wrangler configuration file found in:"),e),null;console.log(i.green(`Found ${u} at:`),t);let c=await (0,s.readFile)(t,"utf-8");return u.endsWith(".toml")?r=(0,n.parse)(c):(u.endsWith(".jsonc")&&(c=(0,a.A)(c)),r=JSON.parse(c)),{config:r,projectPath:e}}catch(e){throw console.error(i.red("Error reading Wrangler configuration:"),e.message),e}}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,973],()=>t(6731));module.exports=s})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var e={};e.id=105,e.ids=[105],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},
|
|
1
|
+
"use strict";(()=>{var e={};e.id=105,e.ids=[105],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},6675:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>A,routeModule:()=>g,serverHooks:()=>f,workAsyncStorage:()=>N,workUnitAsyncStorage:()=>R});var s={};t.r(s),t.d(s,{OPTIONS:()=>x,POST:()=>E});var a=t(2706),n=t(8203),o=t(5994),i=t(9187),p=t(5949),u=t(9748),c=t(3873),d=t(961),m=t(8354),l=t(9646);let T=(0,m.promisify)(l.exec);async function E(e){try{let{accountId:r,apiToken:t}=await e.json(),s=process.env.D1_PROJECT_DIR;if(!s)return i.NextResponse.json({error:"Project directory not configured"},{status:500});let a=await (0,p.S)(s);if(!a||!a.config)return i.NextResponse.json({error:"No Wrangler configuration file found in project directory"},{status:404});let n=a.config;if(!n.d1_databases?.length)return i.NextResponse.json({error:"No D1 databases configured"},{status:404});let o=n.d1_databases[0].database_name;await T(`wrangler d1 execute ${o} --remote --command="
|
|
2
2
|
CREATE TABLE IF NOT EXISTS d1_migrations (
|
|
3
3
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
4
|
name TEXT NOT NULL UNIQUE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var e={};e.id=51,e.ids=[51],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},
|
|
1
|
+
"use strict";(()=>{var e={};e.id=51,e.ids=[51],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},7147:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>j,routeModule:()=>q,serverHooks:()=>R,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>E});var s={};t.r(s),t.d(s,{OPTIONS:()=>w,POST:()=>y});var a=t(2706),o=t(8203),n=t(5994),i=t(9187),u=t(5949),d=t(9748),c=t(3873),p=t(8354),l=t(9646),m=t(961);let g=(0,p.promisify)(l.exec);async function x(e,r){try{let{stdout:t}=await g(`wrangler d1 execute ${r} --local --command="SELECT name, checksum FROM d1_migrations;" --json`,{cwd:e}),s=JSON.parse(t);return s.results?.[0]?.results||[]}catch(e){throw console.error("Error getting database migrations:",e),Error("Failed to get database migrations")}}async function f(e){try{let r=c.join(e,"migrations"),t=await (0,d.readdir)(r);return(await Promise.all(t.filter(e=>e.endsWith(".sql")).map(async e=>{let t=c.join(r,e),s=await (0,d.readFile)(t,"utf8");return{name:e,path:t,content:s,checksum:(0,m.Sl)(s)}}))).sort((e,r)=>e.name.localeCompare(r.name))}catch(e){if("ENOENT"===e.code)return[];throw Error("Failed to read migration files")}}async function h(e,r,t){try{return await g(`wrangler d1 execute ${r} --local --command="${t.replace(/"/g,'\\"')}"`,{cwd:e}),!0}catch(e){throw console.error("Query execution error:",e),Error("Failed to execute database query")}}async function y(e){try{let e=process.env.D1_PROJECT_DIR;if(!e)return i.NextResponse.json({error:"Project directory not configured"},{status:500});let r=await (0,u.S)(e);if(!r||!r.config)return i.NextResponse.json({error:"Could not find Wrangler configuration"},{status:404});let t=r.config;if(!t.d1_databases?.length)return i.NextResponse.json({error:"No D1 databases configured"},{status:404});let s=t.d1_databases[0].database_name,[a,o]=await Promise.all([x(e,s),f(e)]),n=new Map(a.map(e=>[e.name,e])),d=new Map(o.map(e=>[e.name,e])),c={added:[],removed:[],unchanged:[]};for(let[e]of n)d.has(e)||c.removed.push(e);if(c.removed.length>0){let r=c.removed.map(e=>`'${e}'`).join(",");await h(e,s,`DELETE FROM d1_migrations WHERE name IN (${r});`)}for(let[r,t]of d)n.get(r)?c.unchanged.push(r):(c.added.push(r),await h(e,s,`INSERT OR REPLACE INTO d1_migrations (name, checksum) VALUES ('${r}', '${t.checksum}');`));return i.NextResponse.json({success:!0,details:{added:c.added,removed:c.removed,unchanged:c.unchanged}})}catch(e){return console.error("Migration file sync error:",e),i.NextResponse.json({error:e.message||"Failed to sync migrations"},{status:500})}}async function w(){return new i.NextResponse(null,{status:204})}let q=new a.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/migrations/sync-files/route",pathname:"/api/migrations/sync-files",filename:"route",bundlePath:"app/api/migrations/sync-files/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/migrations/sync-files/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:v,workUnitAsyncStorage:E,serverHooks:R}=q;function j(){return(0,n.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:E})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,973,801],()=>t(7147));module.exports=s})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var e={};e.id=223,e.ids=[223],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},
|
|
1
|
+
"use strict";(()=>{var e={};e.id=223,e.ids=[223],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},9556:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>E,routeModule:()=>x,serverHooks:()=>R,workAsyncStorage:()=>y,workUnitAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{OPTIONS:()=>w,POST:()=>g});var a=t(2706),o=t(8203),i=t(5994),n=t(9187),l=t(9748),p=t(3873),u=t(5949),c=t(9421),d=t(4218),m=t(961);async function f(e,r,t,s){let a={...process.env,CLOUDFLARE_API_TOKEN:t,CLOUDFLARE_ACCOUNT_ID:r};try{let r=p.join(e,"migrations"),t=p.join(e,"migrations-temp");await (0,l.mkdir)(r,{recursive:!0}),await (0,l.mkdir)(t,{recursive:!0});let o=await (0,l.readdir)(t).catch(()=>[]);await Promise.all(o.map(e=>(0,l.unlink)(p.join(t,e))));let i=await (0,m.GS)(e,s,a),n=new Map;for(let r of i)try{let o=r.name,i=await (0,c.sP)(e,s,o,a);n.set(o,i),await (0,l.writeFile)(p.join(t,o),i,"utf8")}catch(e){throw console.error(`Error fetching content for migration ${r.name}:`,e),Error(`Failed to fetch migration file content for ${r.name}`)}let u=await (0,d.ZX)(e,s,a,!1),f=u.filter(e=>"table"===e.type&&e.name&&"if"!==e.name.toLowerCase()),g=f.length>0?(0,d.IC)(f.map(e=>({tableName:e.name,sql:e.sql,type:e.type}))):[];try{for(let r of(await (0,c.KK)(e,s,"PRAGMA foreign_keys=OFF;",a,!1),u.filter(e=>"trigger"===e.type)))await (0,c.KK)(e,s,(0,c.z6)(`DROP TRIGGER IF EXISTS ${r.name}`),a,!1);for(let r of u.filter(e=>"index"===e.type))await (0,c.KK)(e,s,(0,c.z6)(`DROP INDEX IF EXISTS ${r.name}`),a,!1);for(let r of g.reverse())await (0,c.KK)(e,s,(0,c.z6)(`DROP TABLE IF EXISTS ${r}`),a,!1);await (0,c.KK)(e,s,"PRAGMA foreign_keys=ON;",a,!1)}catch(e){throw Error(`Error dropping existing objects: ${e.message}`)}try{await (0,m.k0)(e,s,"local",!0)}catch(e){throw Error(`Error resetting migrations table: ${e.message}`)}let w={preview:[]},x="";try{for(let[t,o]of n.entries()){x=t,await (0,l.writeFile)(p.join(r,t),o,"utf8");let i=require("crypto").createHash("sha256").update(o).digest("hex");await (0,m.CM)(e,s,{name:t,checksum:i},a,!1),await (0,c.KK)(e,s,o,a,!1),w.preview.push({migration:t,action:"applied"})}}catch(e){throw Error(`Error applying migration ${x}: ${e.message}`)}let y=await (0,l.readdir)(r).catch(()=>[]);if(y.length)for(let e of y)await (0,l.unlink)(p.join(r,e));for(let[e,t]of n.entries())await (0,l.writeFile)(p.join(r,e),t,"utf8");return{appliedMigrations:Array.from(n.keys()),details:w}}catch(e){throw console.error("Pull migration error:",e),e}}async function g(e){try{let{accountId:r,apiToken:t}=await e.json(),s=process.env.D1_PROJECT_DIR;if(!s)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let a=await (0,u.S)(s);if(!a||!a.config)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let o=a.config;if(!o.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let i=o.d1_databases[0].database_name,l=await f(s,r,t,i);return n.NextResponse.json({success:!0,message:"Pull migrations applied successfully",details:l})}catch(e){return console.error("Pull remote confirm error:",e),n.NextResponse.json({success:!1,error:{type:e.type||c.wU.EXECUTION_ERROR,message:e.message||"Failed to apply pull migrations",details:e.details||{suggestions:["Check your Cloudflare credentials","Verify database permissions","Ensure all migration files are accessible"]}}},{status:500})}}async function w(){return new n.NextResponse(null,{status:204})}let x=new a.AppRouteRouteModule({definition:{kind:o.RouteKind.APP_ROUTE,page:"/api/pull-remote/confirm/route",pathname:"/api/pull-remote/confirm",filename:"route",bundlePath:"app/api/pull-remote/confirm/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/confirm/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:y,workUnitAsyncStorage:h,serverHooks:R}=x;function E(){return(0,i.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:h})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,973,801],()=>t(9556));module.exports=s})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var e={};e.id=399,e.ids=[399],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},
|
|
1
|
+
"use strict";(()=>{var e={};e.id=399,e.ids=[399],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},6216:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>f,routeModule:()=>m,serverHooks:()=>v,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>R});var s={};t.r(s),t.d(s,{OPTIONS:()=>g,POST:()=>x});var o=t(2706),a=t(8203),n=t(5994),i=t(9187),p=t(5949),u=t(9421),l=t(4218),c=t(961);async function d(e,r,t,s){let o={...process.env,CLOUDFLARE_API_TOKEN:t,CLOUDFLARE_ACCOUNT_ID:r};try{let r=await (0,l.ZX)(e,s,o,!0),t=await (0,c.GS)(e,s,o),a=(0,l.IC)(r),n={preview:[],totalTables:r.length,totalMigrations:t.length};return a.forEach((e,t)=>{r.find(r=>r.name===e)&&n.preview.push({name:e,type:"table",action:"will be created",order:t+1})}),t.forEach(e=>{n.preview.push({name:e.name,type:"migration",action:"will be tracked"})}),n}catch(e){throw console.error("Pull preview generation error:",e),e}}async function x(e){try{let{accountId:r,apiToken:t}=await e.json(),s=process.env.D1_PROJECT_DIR;if(!s)return i.NextResponse.json({success:!1,error:{type:u.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let o=await (0,p.S)(s);if(!o||!o.config)return i.NextResponse.json({success:!1,error:{type:u.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let a=o.config;if(!a.d1_databases?.length)return i.NextResponse.json({success:!1,error:{type:u.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let n=a.d1_databases[0].database_name,l=await d(s,r,t,n);return i.NextResponse.json({success:!0,message:"Pull migration preview generated",details:l})}catch(e){return console.error("Pull remote preview error:",e),i.NextResponse.json({success:!1,error:{type:e.type||u.wU.EXECUTION_ERROR,message:e.message||"Failed to generate pull migration preview",details:e.details}},{status:500})}}async function g(){return new i.NextResponse(null,{status:204})}let m=new o.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/pull-remote/preview/route",pathname:"/api/pull-remote/preview",filename:"route",bundlePath:"app/api/pull-remote/preview/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/pull-remote/preview/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:w,workUnitAsyncStorage:R,serverHooks:v}=m;function f(){return(0,n.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:R})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,973,801],()=>t(6216));module.exports=s})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var e={};e.id=680,e.ids=[680],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},
|
|
1
|
+
"use strict";(()=>{var e={};e.id=680,e.ids=[680],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},7628:(e,r,s)=>{s.r(r),s.d(r,{patchFetch:()=>N,routeModule:()=>R,serverHooks:()=>x,workAsyncStorage:()=>g,workUnitAsyncStorage:()=>h});var t={};s.r(t),s.d(t,{OPTIONS:()=>T,POST:()=>E});var a=s(2706),i=s(8203),o=s(5994),n=s(9187),p=s(9748),d=s(3873),u=s(5949),l=s(9421),c=s(961);async function m(e,r,s,t,a=!1){let i={...process.env,CLOUDFLARE_ACCOUNT_ID:r,CLOUDFLARE_API_TOKEN:s};try{let r=`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS d1_migrations (
|
|
3
3
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
4
|
name TEXT NOT NULL UNIQUE,
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
name TEXT NOT NULL UNIQUE,
|
|
12
12
|
applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
13
13
|
);
|
|
14
|
-
`;await (0,l.KK)(e,t,r),await (0,l.KK)(e,t,s,i,!0);let o=await (0,l.KK)(e,t,"SELECT name FROM d1_migrations ORDER BY applied_at;",i,!0),n=new Map((e=>{try{let r=JSON.parse(e);return r[0]?.results||[]}catch{return[]}})(o).map(e=>[e.name,e])),u=d.join(e,"migrations"),m=(await (0,p.readdir)(u)).filter(e=>e.endsWith(".sql")).sort(),E={applied:[],skipped:[],preview:[]};for(let r of m){let s=d.join(u,r),o={name:r,action:"",reason:""};try{if(!(await (0,c.JD)(s)).isValid){o.action="failed validation",o.reason="Migration validation failed",E.preview.push(o);continue}if(n.has(r)){o.action="skipped",o.reason="Already applied",E.preview.push(o),E.skipped.push({name:r,reason:o.reason});continue}let d=await (0,p.readFile)(s,"utf8");d=(0,l.bp)(d);let u=(0,l.By)(d),m=u.tableName;if("CREATE_TABLE"===u.type&&m&&await (0,l.F9)(e,t,i,m,!0)){o.action="skipped",o.reason=`Table "${m}" already exists`,E.skipped.push({name:r,reason:o.reason}),E.preview.push(o);continue}o.action="will be applied",E.preview.push(o),a||(await (0,l.KK)(e,t,d,i,!0),await (0,l.KK)(e,t,`INSERT INTO d1_migrations (name) VALUES ('${r}');`,i,!0),o.action="applied",E.applied.push({name:r}))}catch(t){let e=t.message||"",s=t.details&&t.details.stderr||"";e.includes("already exists")||s.includes("already exists")?(o.action="skipped",o.reason="Already applied"):(o.action="failed",o.reason=e||"Failed to apply migration"),E.skipped.push({name:r,reason:o.reason}),E.preview.push(o)}}return
|
|
14
|
+
`;await (0,l.KK)(e,t,r),await (0,l.KK)(e,t,s,i,!0);let o=await (0,l.KK)(e,t,"SELECT name FROM d1_migrations ORDER BY applied_at;",i,!0),n=new Map((e=>{try{let r=JSON.parse(e);return r[0]?.results||[]}catch{return[]}})(o).map(e=>[e.name,e])),u=d.join(e,"migrations"),m=(await (0,p.readdir)(u)).filter(e=>e.endsWith(".sql")).sort(),E={applied:[],skipped:[],preview:[]};for(let r of m){let s=d.join(u,r),o={name:r,action:"",reason:""};try{if(!(await (0,c.JD)(s)).isValid){o.action="failed validation",o.reason="Migration validation failed",E.preview.push(o);continue}if(n.has(r)){o.action="skipped",o.reason="Already applied",E.preview.push(o),E.skipped.push({name:r,reason:o.reason});continue}let d=await (0,p.readFile)(s,"utf8");d=(0,l.bp)(d);let u=(0,l.By)(d),m=u.tableName;if("CREATE_TABLE"===u.type&&m&&await (0,l.F9)(e,t,i,m,!0)){o.action="skipped",o.reason=`Table "${m}" already exists`,E.skipped.push({name:r,reason:o.reason}),E.preview.push(o);continue}o.action="will be applied",E.preview.push(o),a||(await (0,l.KK)(e,t,d,i,!0),await (0,l.KK)(e,t,`INSERT INTO d1_migrations (name) VALUES ('${r}');`,i,!0),o.action="applied",E.applied.push({name:r}))}catch(t){let e=t.message||"",s=t.details&&t.details.stderr||"";e.includes("already exists")||s.includes("already exists")?(o.action="skipped",o.reason="Already applied"):(o.action="failed",o.reason=e||"Failed to apply migration"),E.skipped.push({name:r,reason:o.reason}),E.preview.push(o)}}return{success:!0,preview:!1,applied:E.applied.length,skipped:E.skipped.length,details:E}}catch(e){throw{type:l.wU.EXECUTION_ERROR,message:e.message||"Failed to push migrations",details:e.details||{error:e.stderr||e.message}}}}async function E(e){try{let{accountId:r,apiToken:s}=await e.json(),t=process.env.D1_PROJECT_DIR;if(!t)return n.NextResponse.json({success:!1,error:{message:"Project directory not configured",type:l.wU.VALIDATION_ERROR}},{status:500});let a=await (0,u.S)(t);if(!a||!a.config)return n.NextResponse.json({success:!1,error:{message:"Could not find Wrangler configuration",type:l.wU.VALIDATION_ERROR}},{status:400});let i=a.config;if(!i.d1_databases?.length)return n.NextResponse.json({success:!1,error:{message:"No D1 databases configured",type:l.wU.VALIDATION_ERROR}},{status:400});let o=i.d1_databases[0].database_name,p=await m(t,r,s,o,!1);return n.NextResponse.json({success:!0,message:"Successfully pushed migrations to remote",details:p})}catch(e){return console.error("Push to remote confirm error:",e),n.NextResponse.json({success:!1,error:{type:e.type||l.wU.EXECUTION_ERROR,message:e.message||"Failed to push to remote",details:e.details||{error:e.stderr||e.message}}},{status:e.type===l.wU.VALIDATION_ERROR?400:500})}}async function T(){return new n.NextResponse(null,{status:204})}let R=new a.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/push-remote/confirm/route",pathname:"/api/push-remote/confirm",filename:"route",bundlePath:"app/api/push-remote/confirm/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/confirm/route.js",nextConfigOutput:"",userland:t}),{workAsyncStorage:g,workUnitAsyncStorage:h,serverHooks:x}=R;function N(){return(0,o.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:h})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[638,973,801],()=>s(7628));module.exports=t})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var e={};e.id=868,e.ids=[868],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},
|
|
1
|
+
"use strict";(()=>{var e={};e.id=868,e.ids=[868],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},9330:(e,r,s)=>{s.r(r),s.d(r,{patchFetch:()=>x,routeModule:()=>m,serverHooks:()=>h,workAsyncStorage:()=>g,workUnitAsyncStorage:()=>w});var t={};s.r(t),s.d(t,{OPTIONS:()=>T,POST:()=>R});var a=s(2706),i=s(8203),o=s(5994),n=s(9187),p=s(9748),u=s(3873),d=s(5949),c=s(9421),l=s(961);async function E(e,r,s,t,a=!0){let i={...process.env,CLOUDFLARE_ACCOUNT_ID:r,CLOUDFLARE_API_TOKEN:s};try{let r=`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS d1_migrations (
|
|
3
3
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
4
|
name TEXT NOT NULL UNIQUE,
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
name TEXT NOT NULL UNIQUE,
|
|
12
12
|
applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
13
13
|
);
|
|
14
|
-
`;await (0,
|
|
14
|
+
`;await (0,c.KK)(e,t,r),await (0,c.KK)(e,t,s,i,!0);let a=await (0,c.KK)(e,t,"SELECT name FROM d1_migrations ORDER BY applied_at;",i,!0),o=new Map((e=>{try{let r=JSON.parse(e);return r[0]?.results||[]}catch{return[]}})(a).map(e=>[e.name,e])),n=u.join(e,"migrations"),d=(await (0,p.readdir)(n)).filter(e=>e.endsWith(".sql")).sort(),E={applied:[],skipped:[],preview:[]};for(let e of d){let r=u.join(n,e),s={name:e,action:"",reason:""};try{if(!(await (0,l.JD)(r)).isValid){s.action="failed validation",s.reason="Migration validation failed",E.preview.push(s);continue}if(o.has(e)){s.action="skipped",s.reason="Already applied",E.preview.push(s),E.skipped.push({name:e,reason:s.reason});continue}s.action="will be applied",E.preview.push(s)}catch(r){s.action="failed",s.reason=r.message||"Failed to process migration",E.preview.push(s),E.skipped.push({name:e,reason:s.reason})}}return{success:!0,preview:!0,applied:E.applied.length,skipped:E.skipped.length,details:E}}catch(e){throw{type:c.wU.EXECUTION_ERROR,message:e.message||"Failed to push migrations",details:e.details||{error:e.stderr||e.message}}}}async function R(e){try{let{accountId:r,apiToken:s}=await e.json(),t=process.env.D1_PROJECT_DIR;if(!t)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let a=await (0,d.S)(t);if(!a||!a.config)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let i=a.config;if(!i.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:c.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let o=i.d1_databases[0].database_name,p=await E(t,r,s,o,!0);return n.NextResponse.json({success:!0,message:"Preview generated for migrations to be pushed to remote",details:p})}catch(e){return console.error("Push to remote preview error:",e),n.NextResponse.json({success:!1,error:{type:e.type||c.wU.EXECUTION_ERROR,message:e.message||"Failed to push to remote preview",details:e.details||{error:e.stderr||e.message}}},{status:e.type===c.wU.VALIDATION_ERROR?400:500})}}async function T(){return new n.NextResponse(null,{status:204})}let m=new a.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/push-remote/preview/route",pathname:"/api/push-remote/preview",filename:"route",bundlePath:"app/api/push-remote/preview/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/push-remote/preview/route.js",nextConfigOutput:"",userland:t}),{workAsyncStorage:g,workUnitAsyncStorage:w,serverHooks:h}=m;function x(){return(0,o.patchFetch)({workAsyncStorage:g,workUnitAsyncStorage:w})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[638,973,801],()=>s(9330));module.exports=t})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";(()=>{var e={};e.id=58,e.ids=[58],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},
|
|
1
|
+
"use strict";(()=>{var e={};e.id=58,e.ids=[58],e.modules={846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{e.exports=require("child_process")},5511:e=>{e.exports=require("crypto")},9748:e=>{e.exports=require("fs/promises")},1820:e=>{e.exports=require("os")},3873:e=>{e.exports=require("path")},7910:e=>{e.exports=require("stream")},3997:e=>{e.exports=require("tty")},8354:e=>{e.exports=require("util")},3024:e=>{e.exports=require("node:fs")},6760:e=>{e.exports=require("node:path")},1708:e=>{e.exports=require("node:process")},3136:e=>{e.exports=require("node:url")},5999:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>g,routeModule:()=>E,serverHooks:()=>O,workAsyncStorage:()=>N,workUnitAsyncStorage:()=>T});var s={};t.r(s),t.d(s,{OPTIONS:()=>p,POST:()=>R});var o=t(2706),n=t(8203),a=t(5994),i=t(9187),l=t(5949),d=t(9421),c=t(961);let u={SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",TABLE_NOT_FOUND:"TABLE_NOT_FOUND",TABLE_EXISTS:"TABLE_EXISTS",FOREIGN_KEY_ERROR:"FOREIGN_KEY_ERROR",UNIQUE_CONSTRAINT_ERROR:"UNIQUE_CONSTRAINT_ERROR",NOT_NULL_CONSTRAINT_ERROR:"NOT_NULL_CONSTRAINT_ERROR",CHECK_CONSTRAINT_ERROR:"CHECK_CONSTRAINT_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};async function R(e){try{let r;let t=process.env.D1_PROJECT_DIR;if(!t)return i.NextResponse.json({error:"Project directory not configured"},{status:500});let{query:s}=await e.json();if(!s?.trim())return i.NextResponse.json({success:!1,error:{message:"Query cannot be empty"}},{status:400});let o=await (0,l.S)(t);if(!o||!o.config)return i.NextResponse.json({success:!1,error:{message:"No Wrangler configuration file found"}},{status:404});let n=o.config;if(!n.d1_databases?.length)return i.NextResponse.json({success:!1,error:{message:"No D1 databases configured"}},{status:404});let a=n.d1_databases[0].database_name,u=(0,d.mA)(s);if(!u.length)return i.NextResponse.json({success:!1,error:{message:"No valid SQL statements found"}},{status:400});u=u.map(d.Gq);let R=`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS d1_migrations (
|
|
3
3
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
4
|
name TEXT NOT NULL UNIQUE,
|
|
5
5
|
checksum TEXT NOT NULL,
|
|
6
6
|
applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
7
7
|
);
|
|
8
|
-
`;await (0,
|
|
8
|
+
`;if(await (0,d.KK)(t,a,R),u.some(d.QQ)){let e=await (0,c.Gc)(t,a,u);console.log("Schema changes processed:",e),r={success:!0,migrations:e,results:[{results:[]}]}}else{let e=[];for(let r of u){let s=await (0,d.KK)(t,a,r.sql);try{let r=JSON.parse(s),t=r[0]?.results||[];e.push(...t)}catch(e){continue}}r={success:!0,results:[{results:e}]}}return i.NextResponse.json(r)}catch(t){console.error("Query execution error:",t);let e=function(e){if(console.debug("parseSQLError - Received error:",e),!e)return console.debug("parseSQLError - error is null or undefined."),{type:u.UNKNOWN_ERROR,message:"An unknown error occurred",details:{}};let r="",t=null,s=null,o=e.cmd||e.details&&e.details.command;if(o){let e=o.match(/--command="(.+?)"/s);e&&console.debug("parseSQLError - Extracted original query:",s=e[1].replace(/\\n/g,"\n"))}let n=e.stderr||e.details&&e.details.stderr;if(n){let a=n.replace(/\x1B\[[0-9;]*[a-zA-Z]/g,"");if(console.debug("parseSQLError - Cleaned stderr:",a),a.includes("env: node: No such file or directory"))return console.debug("parseSQLError - Detected 'env: node: No such file or directory' error."),{type:u.EXECUTION_ERROR,message:e.message||"Execution error: env: node: No such file or directory",details:{originalQuery:s,stderr:a}};let i=a.match(/near "([^"]+)": syntax error at offset (\d+)/);if(i){let[e,o,n]=i;return t=parseInt(n,10),r=`Syntax error near "${o}" at position ${t}`,console.debug("parseSQLError - Syntax error detected:",{near:o,offset:t}),{type:u.SYNTAX_ERROR,message:r,details:{originalQuery:s,errorLocation:{offset:t,near:o},stderr:a}}}if(a.includes("UNIQUE constraint failed")){let[e,r,t]=a.match(/UNIQUE constraint failed: (\w+)\.(\w+)/)||[];return console.debug("parseSQLError - UNIQUE constraint error detected:",{table:r,column:t}),{type:u.UNIQUE_CONSTRAINT_ERROR,message:`Unique constraint violation updating ${r}.${t}`,details:{originalQuery:s,stderr:a}}}if(a.includes("NOT NULL constraint failed")){let[e,r,t]=a.match(/NOT NULL constraint failed: (\w+)\.(\w+)/)||[];return console.debug("parseSQLError - NOT NULL constraint error detected:",{table:r,column:t}),{type:u.NOT_NULL_CONSTRAINT_ERROR,message:`NOT NULL constraint violation updating ${r}.${t}`,details:{originalQuery:s,stderr:a}}}if(a.includes("CHECK constraint failed")){let[e,r]=a.match(/CHECK constraint failed: (\w+)/)||[];return console.debug("parseSQLError - CHECK constraint error detected:",{constraintName:r}),{type:u.CHECK_CONSTRAINT_ERROR,message:`Check constraint violation updating ${r}`,details:{originalQuery:s,stderr:a}}}if(a.includes("FOREIGN KEY constraint failed")){console.debug("parseSQLError - FOREIGN KEY constraint error detected.");let e=/--command="([^"]+)"/.exec(o||""),r=e?e[1]:null,t={};if(r){let e=/UPDATE\s+(\w+)\s+SET\s+(\w+)\s*=/.exec(r);e&&(t={table:e[1],column:e[2]})}let s=t.table?`Foreign key constraint violation updating ${t.table}.${t.column}`:"Foreign key constraint violation";return{type:u.FOREIGN_KEY_ERROR,message:s,details:{...t,originalQuery:r,stderr:a}}}if(a.includes("no such table")){let[e,r]=a.match(/no such table: (\w+)/)||[];return console.debug("parseSQLError - Table not found error detected:",{table:r}),{type:u.TABLE_NOT_FOUND,message:`Table not found: ${r}`,details:{originalQuery:s,stderr:a}}}if(a.includes("already exists")){let[e,r]=a.match(/table (\w+) already exists/)||[];return console.debug("parseSQLError - Table exists error detected:",{table:r}),{type:u.TABLE_EXISTS,message:`Table already exists: ${r}`,details:{originalQuery:s,stderr:a}}}return console.debug("parseSQLError - No specific error match found. Using fallback for execution error."),{type:u.EXECUTION_ERROR,message:e.message||"Failed to execute SQL command",details:{originalQuery:s,stderr:a}}}return console.debug("parseSQLError - No stderr available; using default error handling."),{type:u.UNKNOWN_ERROR,message:e.message||"An unknown error occurred",details:{}}}(t),r=t.type===d.wU.VALIDATION_ERROR?400:t.type===d.wU.DEPENDENCY_ERROR?409:500;return i.NextResponse.json({success:!1,error:e},{status:r})}}async function p(){return new i.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let E=new o.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/query/route",pathname:"/api/query",filename:"route",bundlePath:"app/api/query/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/query/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:N,workUnitAsyncStorage:T,serverHooks:O}=E;function g(){return(0,a.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:T})}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,973,801],()=>t(5999));module.exports=s})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(()=>{var e={};e.id=175,e.ids=[175],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{"use strict";e.exports=require("child_process")},9748:e=>{"use strict";e.exports=require("fs/promises")},1820:e=>{"use strict";e.exports=require("os")},7910:e=>{"use strict";e.exports=require("stream")},3997:e=>{"use strict";e.exports=require("tty")},8354:e=>{"use strict";e.exports=require("util")},
|
|
1
|
+
(()=>{var e={};e.id=175,e.ids=[175],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{"use strict";e.exports=require("child_process")},9748:e=>{"use strict";e.exports=require("fs/promises")},1820:e=>{"use strict";e.exports=require("os")},7910:e=>{"use strict";e.exports=require("stream")},3997:e=>{"use strict";e.exports=require("tty")},8354:e=>{"use strict";e.exports=require("util")},3024:e=>{"use strict";e.exports=require("node:fs")},6760:e=>{"use strict";e.exports=require("node:path")},1708:e=>{"use strict";e.exports=require("node:process")},3136:e=>{"use strict";e.exports=require("node:url")},2616:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>N,routeModule:()=>q,serverHooks:()=>j,workAsyncStorage:()=>E,workUnitAsyncStorage:()=>P});var s={};t.r(s),t.d(s,{GET:()=>x,OPTIONS:()=>y,dynamic:()=>f,runtime:()=>m});var o=t(2706),n=t(8203),a=t(5994),i=t(9187),u=t(8354),c=t(9646),l=t(5949);class p{constructor(){this.queue=[],this.isProcessing=!1}async add(e){return new Promise((r,t)=>{this.queue.push({operation:e,resolve:r,reject:t}),this.processNext()})}async processNext(){if(this.isProcessing||0===this.queue.length)return;this.isProcessing=!0;let{operation:e,resolve:r,reject:t}=this.queue.shift();try{let t=await e();r(t)}catch(e){t(e)}finally{this.isProcessing=!1,this.processNext()}}}let d=new p,g=(0,u.promisify)(c.exec),m="nodejs",f="force-dynamic",h=!1;async function w(e,r,t){try{for(;h;)await new Promise(e=>setTimeout(e,100));h=!0;let{stdout:s}=await g(`wrangler d1 execute ${t} --local --command="${e.replace(/"/g,'\\"')}" --json`,{cwd:r}),o=JSON.parse(s);return o[0]?.results||[]}catch(e){throw console.error("Query execution error:",e),e}finally{h=!1}}async function x(e,r){return d.add(async()=>{try{let{name:t}=await r.params,{searchParams:s}=new URL(e.url),o=parseInt(s.get("page"))||1,n=parseInt(s.get("limit"))||50,a=(o-1)*n,u=process.env.D1_PROJECT_DIR;if(!u)throw Error("Project directory not configured");let c=await (0,l.S)(u);if(!c||!c.config)throw Error("No Wrangler configuration file found");let p=c.config;if(!p.d1_databases?.length)throw Error("No D1 databases configured");let d=p.d1_databases[0].database_name,g=`PRAGMA table_info(${t});`,m=await w(g,u,d),f=`SELECT sql FROM sqlite_master WHERE type='table' AND name='${t}';`,h=await w(f,u,d),x=h[0]?.sql||"",y=function(e){let r;let t={},s=/CHECK\s*\(\s*(\w+)\s+IN\s*\((.*?)\)\s*\)/gi;for(;null!==(r=s.exec(e));){let e=r[1],s=r[2].split(",").map(e=>e.trim().replace(/^'|'$/g,""));t[e]=s}return t}(x),q=m.map(e=>({...e,check:y[e.name]||null})),E=`SELECT COUNT(*) as total FROM ${t};`,P=await w(E,u,d),j=P[0]?.total||0,N=m.find(e=>1===e.pk)?.name||m[0]?.name,R=`
|
|
2
2
|
SELECT * FROM ${t}
|
|
3
3
|
ORDER BY ${N} DESC
|
|
4
4
|
LIMIT ${n} OFFSET ${a};
|
|
5
|
-
`,
|
|
5
|
+
`,C=await w(R,u,d);return i.NextResponse.json({success:!0,schema:q,data:C,meta:{tableName:t,total:j,page:o,limit:n,totalPages:Math.ceil(j/n),rowCount:C.length,columnCount:m.length}})}catch(e){return console.error("Error handling request:",e),i.NextResponse.json({success:!1,error:{message:e.message,details:e.stack}},{status:e.message.includes("not configured")?500:e.message.includes("not found")?404:500})}})}async function y(){return new i.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let q=new o.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/tables/[name]/route",pathname:"/api/tables/[name]",filename:"route",bundlePath:"app/api/tables/[name]/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/tables/[name]/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:E,workUnitAsyncStorage:P,serverHooks:j}=q;function N(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:P})}},6487:()=>{},8335:()=>{},5949:(e,r,t)=>{"use strict";t.d(r,{S:()=>u});var s=t(9748),o=t(3149),n=t(2537),a=t(6789),i=t(872);async function u(e){try{let r;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");let t=null,u=null;for(let r of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(t=await (0,o.dJ)(r,{cwd:e})){u=r;break}if(!t)return console.log(i.yellow("No Wrangler configuration file found in:"),e),null;console.log(i.green(`Found ${u} at:`),t);let c=await (0,s.readFile)(t,"utf-8");return u.endsWith(".toml")?r=(0,n.parse)(c):(u.endsWith(".jsonc")&&(c=(0,a.A)(c)),r=JSON.parse(c)),{config:r,projectPath:e}}catch(e){throw console.error(i.red("Error reading Wrangler configuration:"),e.message),e}}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,973],()=>t(2616));module.exports=s})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(()=>{var e={};e.id=761,e.ids=[761],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{"use strict";e.exports=require("child_process")},9748:e=>{"use strict";e.exports=require("fs/promises")},1820:e=>{"use strict";e.exports=require("os")},7910:e=>{"use strict";e.exports=require("stream")},3997:e=>{"use strict";e.exports=require("tty")},8354:e=>{"use strict";e.exports=require("util")},
|
|
1
|
+
(()=>{var e={};e.id=761,e.ids=[761],e.modules={846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},4870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},3033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},9646:e=>{"use strict";e.exports=require("child_process")},9748:e=>{"use strict";e.exports=require("fs/promises")},1820:e=>{"use strict";e.exports=require("os")},7910:e=>{"use strict";e.exports=require("stream")},3997:e=>{"use strict";e.exports=require("tty")},8354:e=>{"use strict";e.exports=require("util")},3024:e=>{"use strict";e.exports=require("node:fs")},6760:e=>{"use strict";e.exports=require("node:path")},1708:e=>{"use strict";e.exports=require("node:process")},3136:e=>{"use strict";e.exports=require("node:url")},8343:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>y,routeModule:()=>m,serverHooks:()=>w,workAsyncStorage:()=>x,workUnitAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{GET:()=>f,OPTIONS:()=>g});var o=t(2706),n=t(8203),a=t(5994),i=t(9187),u=t(8354),l=t(9646),c=t(5949);let d=(0,u.promisify)(l.exec);async function p(e,r=3,t=1e3){for(let s=0;s<r;s++)try{return await e()}catch(e){if(s===r-1)throw e;if(e.message.includes("database is locked")){console.log(`Database locked, retrying in ${t}ms... (attempt ${s+1}/${r})`),await new Promise(e=>setTimeout(e,t));continue}throw e}}async function f(){try{var e;let r=process.env.D1_PROJECT_DIR;if(!r)return console.error("D1_PROJECT_DIR environment variable is not set"),i.NextResponse.json({error:"Project directory not configured"},{status:500});let t=await (0,c.S)(r);if(!t||!t.config)return i.NextResponse.json({error:"No Wrangler configuration file found in project directory"},{status:404});let s=t.config;if(!s.d1_databases?.length)return i.NextResponse.json({error:"No D1 databases configured in Wrangler configuration"},{status:404});let o=s.d1_databases[0].database_name,n=`
|
|
2
2
|
SELECT name FROM sqlite_master
|
|
3
3
|
WHERE type='table'
|
|
4
4
|
AND name NOT LIKE 'sqlite_%'
|
|
5
5
|
AND name NOT LIKE '_cf_%'
|
|
6
6
|
ORDER BY name;
|
|
7
|
-
`,{stdout:a}=await p(async()=>d(`wrangler d1 execute ${o} --local --command="${n}"`,{cwd:r,timeout:5e3})),u=(e=function(e){try{return JSON.parse(e)}catch(t){let r=-1!==e.indexOf("[")?e.indexOf("["):e.indexOf("{");if(-1===r)return null;try{let t=e.substring(r);return JSON.parse(t)}catch(e){return console.error("Error parsing JSON portion:",e),null}}}(a))?Array.isArray(e)&&e[0]?.results?e[0].results.map(e=>e.name):e.results?.[0]?.results?e.results[0].results.map(e=>e.name):[]:[];return i.NextResponse.json({success:!0,tables:u,debug:{projectDir:r,tableCount:u.length}})}catch(r){console.error("Error fetching tables:",r);let e={error:"Failed to fetch tables",details:r.message,debug:{errorCode:r.code,errorStack:r.stack}};return r.message.includes("database is locked")&&(e.error="Database is temporarily locked",e.retryAfter=1e3),i.NextResponse.json(e,{status:r.message.includes("database is locked")?503:500})}}async function
|
|
7
|
+
`,{stdout:a}=await p(async()=>d(`wrangler d1 execute ${o} --local --command="${n}"`,{cwd:r,timeout:5e3})),u=(e=function(e){try{return JSON.parse(e)}catch(t){let r=-1!==e.indexOf("[")?e.indexOf("["):e.indexOf("{");if(-1===r)return null;try{let t=e.substring(r);return JSON.parse(t)}catch(e){return console.error("Error parsing JSON portion:",e),null}}}(a))?Array.isArray(e)&&e[0]?.results?e[0].results.map(e=>e.name):e.results?.[0]?.results?e.results[0].results.map(e=>e.name):[]:[];return i.NextResponse.json({success:!0,tables:u,debug:{projectDir:r,tableCount:u.length}})}catch(r){console.error("Error fetching tables:",r);let e={error:"Failed to fetch tables",details:r.message,debug:{errorCode:r.code,errorStack:r.stack}};return r.message.includes("database is locked")&&(e.error="Database is temporarily locked",e.retryAfter=1e3),i.NextResponse.json(e,{status:r.message.includes("database is locked")?503:500})}}async function g(){return new i.NextResponse(null,{status:204,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let m=new o.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/tables/route",pathname:"/api/tables",filename:"route",bundlePath:"app/api/tables/route"},resolvedPagePath:"/Users/karenredona/Desktop/d1studio/src/app/api/tables/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:x,workUnitAsyncStorage:h,serverHooks:w}=m;function y(){return(0,a.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:h})}},6487:()=>{},8335:()=>{},5949:(e,r,t)=>{"use strict";t.d(r,{S:()=>u});var s=t(9748),o=t(3149),n=t(2537),a=t(6789),i=t(872);async function u(e){try{let r;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");let t=null,u=null;for(let r of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(t=await (0,o.dJ)(r,{cwd:e})){u=r;break}if(!t)return console.log(i.yellow("No Wrangler configuration file found in:"),e),null;console.log(i.green(`Found ${u} at:`),t);let l=await (0,s.readFile)(t,"utf-8");return u.endsWith(".toml")?r=(0,n.parse)(l):(u.endsWith(".jsonc")&&(l=(0,a.A)(l)),r=JSON.parse(l)),{config:r,projectPath:e}}catch(e){throw console.error(i.red("Error reading Wrangler configuration:"),e.message),e}}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[638,973],()=>t(8343));module.exports=s})();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/569ce4b8f30dc480-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/93f479601ee12b01-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/c51a7ef325e30c16.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-c76ac1e586b2802a.js"/><script src="/_next/static/chunks/4bd1b696-8c908eb707f85a27.js" async=""></script><script src="/_next/static/chunks/517-3b698a5d3da06ff7.js" async=""></script><script src="/_next/static/chunks/main-app-d36cdfb402b40f13.js" async=""></script><script src="/_next/static/chunks/692-ede418e1d28a1394.js" async=""></script><script src="/_next/static/chunks/92-c4466e0f1ca8a3a8.js" async=""></script><script src="/_next/static/chunks/735-c9144179c6bd7d06.js" async=""></script><script src="/_next/static/chunks/app/layout-8360fab69b848283.js" async=""></script><script src="/_next/static/chunks/422-6fa3c14fc64ad67b.js" async=""></script><script src="/_next/static/chunks/app/page-75081ac7a88cb706.js" async=""></script><meta name="next-size-adjust" content=""/><title>d1-studio</title><meta name="description" content="Native D1 database studio."/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="__variable_4d318d __variable_ea5f4b antialiased"><div class="flex h-screen bg-background"><aside class="w-64 border-r flex-shrink-0 bg-neutral-50 p-4"><div class="font-sans"><div class="flex items-center gap-2 mb-6"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table2 h-5 w-5"><path d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"></path></svg><span class="font-mono font-bold text-sm">d1-studio</span></div><div class="flex items-center justify-between mb-6"><div><div class="text-xs text-muted-foreground mb-1">Database name</div><div class="font-semibold text-sm">No database found</div></div><button type="button" role="combobox" aria-controls="radix-:R9lbrb:" aria-expanded="false" aria-autocomplete="none" dir="ltr" data-state="closed" class="flex h-9 items-center justify-between whitespace-nowrap rounded-md border px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 w-[104px] bg-white border-neutral-200 font-medium"><div class="flex items-center gap-1 text-sm"><span style="pointer-events:none"></span></div><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down h-4 w-4 opacity-50" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg></button><select aria-hidden="true" tabindex="-1" style="position:absolute;border:0;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;word-wrap:normal"></select></div><div class="mb-6"><button class="w-full flex items-center gap-x-1 border rounded-md text-sm font-medium transition-colors px-2 py-2
|
|
2
2
|
bg-neutral-900 text-white"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-terminal h-[16px] w-[16px]"><path d="m7 11 2-2-2-2"></path><path d="M11 13h4"></path><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect></svg>SQL editor</button></div><div class="relative mb-6 bg-white"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-search absolute left-2 top-2.5 h-4 w-4 text-neutral-500"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path></svg><input class="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm pl-7" placeholder="Search tables" value=""/></div><div><div class="flex items-center justify-between mb-1"><h3 class="text-sm font-medium text-muted-foreground">Tables </h3><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader-circle h-4 w-4 animate-spin text-muted-foreground"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg></div><div class="space-y-1 font-sans"></div></div></div></aside><main class="flex-1 overflow-hidden"><div class="h-full flex flex-col bg-white text-neutral-900 font-sans"><div class="px-4 py-2 bg-neutral-100 border-b flex items-center gap-4"><button class="inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground h-8 rounded-md px-3 text-xs" type="button" id="radix-:R5jrb:" aria-haspopup="menu" aria-expanded="false" data-state="closed">Query Templates<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down ml-2 h-4 w-4"><path d="m6 9 6 6 6-6"></path></svg></button></div><div class="relative pt-2 overflow-hidden" style="height:300px;min-height:100px"><section style="display:flex;position:relative;text-align:initial;width:100%;height:100%"><div style="display:flex;height:100%;width:100%;justify-content:center;align-items:center">Loading...</div><div style="width:100%;display:none"></div></section></div><div class="relative h-0.5 cursor-row-resize bg-neutral-200 group hover:bg-neutral-300"><div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-neutral-900 rounded-sm px-0.5
|
|
3
|
-
invisible group-hover:visible"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-grip-horizontal h-3 w-3 text-white"><circle cx="12" cy="9" r="1"></circle><circle cx="19" cy="9" r="1"></circle><circle cx="5" cy="9" r="1"></circle><circle cx="12" cy="15" r="1"></circle><circle cx="19" cy="15" r="1"></circle><circle cx="5" cy="15" r="1"></circle></svg></div></div><div class="px-4 py-3 bg-neutral-100 border-b font-sans"><div class="flex justify-between items-center"><h3 class="text-sm font-medium">Results</h3><button class="justify-center whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 bg-primary text-primary-foreground shadow hover:bg-primary/90 h-8 rounded-md px-3 flex items-center gap-1 text-sm font-medium">Run<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-command h-4 w-4"><path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-corner-down-left h-4 w-4"><polyline points="9 10 4 15 9 20"></polyline><path d="M20 4v7a4 4 0 0 1-4 4H4"></path></svg></button></div></div><div class="flex-1 overflow-auto p-4 bg-white"><div class="text-sm text-neutral-500 font-sans">Run the query to see the results.</div></div></div></main></div><div role="region" aria-label="Notifications (F8)" tabindex="-1" style="pointer-events:none"><ol tabindex="-1" class="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]"></ol></div> <script src="/_next/static/chunks/webpack-c76ac1e586b2802a.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[33,[\"692\",\"static/chunks/692-ede418e1d28a1394.js\",\"92\",\"static/chunks/92-c4466e0f1ca8a3a8.js\",\"735\",\"static/chunks/735-c9144179c6bd7d06.js\",\"177\",\"static/chunks/app/layout-8360fab69b848283.js\"],\"DatabaseProvider\"]\n3:I[5244,[],\"\"]\n4:I[3866,[],\"\"]\n5:I[6124,[\"692\",\"static/chunks/692-ede418e1d28a1394.js\",\"92\",\"static/chunks/92-c4466e0f1ca8a3a8.js\",\"735\",\"static/chunks/735-c9144179c6bd7d06.js\",\"177\",\"static/chunks/app/layout-8360fab69b848283.js\"],\"Toaster\"]\n6:I[7033,[],\"ClientPageRoot\"]\n7:I[2624,[\"692\",\"static/chunks/692-ede418e1d28a1394.js\",\"422\",\"static/chunks/422-6fa3c14fc64ad67b.js\",\"735\",\"static/chunks/735-c9144179c6bd7d06.js\",\"974\",\"static/chunks/app/page-75081ac7a88cb706.js\"],\"default\"]\na:I[6213,[],\"OutletBoundary\"]\nc:I[6213,[],\"MetadataBoundary\"]\ne:I[6213,[],\"ViewportBoundary\"]\n10:I[4835,[],\"\"]\n:HL[\"/_next/static/media/569ce4b8f30dc480-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/93f479601ee12b01-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/c51a7ef325e30c16.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"
|
|
3
|
+
invisible group-hover:visible"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-grip-horizontal h-3 w-3 text-white"><circle cx="12" cy="9" r="1"></circle><circle cx="19" cy="9" r="1"></circle><circle cx="5" cy="9" r="1"></circle><circle cx="12" cy="15" r="1"></circle><circle cx="19" cy="15" r="1"></circle><circle cx="5" cy="15" r="1"></circle></svg></div></div><div class="px-4 py-3 bg-neutral-100 border-b font-sans"><div class="flex justify-between items-center"><h3 class="text-sm font-medium">Results</h3><button class="justify-center whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 bg-primary text-primary-foreground shadow hover:bg-primary/90 h-8 rounded-md px-3 flex items-center gap-1 text-sm font-medium">Run<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-command h-4 w-4"><path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-corner-down-left h-4 w-4"><polyline points="9 10 4 15 9 20"></polyline><path d="M20 4v7a4 4 0 0 1-4 4H4"></path></svg></button></div></div><div class="flex-1 overflow-auto p-4 bg-white"><div class="text-sm text-neutral-500 font-sans">Run the query to see the results.</div></div></div></main></div><div role="region" aria-label="Notifications (F8)" tabindex="-1" style="pointer-events:none"><ol tabindex="-1" class="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]"></ol></div> <script src="/_next/static/chunks/webpack-c76ac1e586b2802a.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[33,[\"692\",\"static/chunks/692-ede418e1d28a1394.js\",\"92\",\"static/chunks/92-c4466e0f1ca8a3a8.js\",\"735\",\"static/chunks/735-c9144179c6bd7d06.js\",\"177\",\"static/chunks/app/layout-8360fab69b848283.js\"],\"DatabaseProvider\"]\n3:I[5244,[],\"\"]\n4:I[3866,[],\"\"]\n5:I[6124,[\"692\",\"static/chunks/692-ede418e1d28a1394.js\",\"92\",\"static/chunks/92-c4466e0f1ca8a3a8.js\",\"735\",\"static/chunks/735-c9144179c6bd7d06.js\",\"177\",\"static/chunks/app/layout-8360fab69b848283.js\"],\"Toaster\"]\n6:I[7033,[],\"ClientPageRoot\"]\n7:I[2624,[\"692\",\"static/chunks/692-ede418e1d28a1394.js\",\"422\",\"static/chunks/422-6fa3c14fc64ad67b.js\",\"735\",\"static/chunks/735-c9144179c6bd7d06.js\",\"974\",\"static/chunks/app/page-75081ac7a88cb706.js\"],\"default\"]\na:I[6213,[],\"OutletBoundary\"]\nc:I[6213,[],\"MetadataBoundary\"]\ne:I[6213,[],\"ViewportBoundary\"]\n10:I[4835,[],\"\"]\n:HL[\"/_next/static/media/569ce4b8f30dc480-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/93f479601ee12b01-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/c51a7ef325e30c16.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"fSVNB2iNhKcZdXXgESWZk\",\"p\":\"\",\"c\":[\"\",\"\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/c51a7ef325e30c16.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__variable_4d318d __variable_ea5f4b antialiased\",\"children\":[\"$\",\"$L2\",null,{\"children\":[[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[],[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"$L5\",null,{}],\" \"]}]}]}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"$L6\",null,{\"Component\":\"$7\",\"searchParams\":{},\"params\":{},\"promises\":[\"$@8\",\"$@9\"]}],null,[\"$\",\"$La\",null,{\"children\":\"$Lb\"}]]}],{},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$1\",\"lC5yxkyUgJ-NWkuldTcep\",{\"children\":[[\"$\",\"$Lc\",null,{\"children\":\"$Ld\"}],[\"$\",\"$Le\",null,{\"children\":\"$Lf\"}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$10\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:{}\n9:{}\n"])</script><script>self.__next_f.push([1,"f:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nd:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"1\",{\"children\":\"d1-studio\"}],[\"$\",\"meta\",\"2\",{\"name\":\"description\",\"content\":\"Native D1 database studio.\"}]]\n"])</script><script>self.__next_f.push([1,"b:null\n"])</script></body></html>
|
|
@@ -12,7 +12,7 @@ e:I[6213,[],"ViewportBoundary"]
|
|
|
12
12
|
:HL["/_next/static/media/569ce4b8f30dc480-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
13
13
|
:HL["/_next/static/media/93f479601ee12b01-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
|
|
14
14
|
:HL["/_next/static/css/c51a7ef325e30c16.css","style"]
|
|
15
|
-
0:{"P":null,"b":"
|
|
15
|
+
0:{"P":null,"b":"fSVNB2iNhKcZdXXgESWZk","p":"","c":["",""],"i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/c51a7ef325e30c16.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__variable_4d318d __variable_ea5f4b antialiased","children":["$","$L2",null,{"children":[["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[],[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]]],"forbidden":"$undefined","unauthorized":"$undefined"}],["$","$L5",null,{}]," "]}]}]}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L6",null,{"Component":"$7","searchParams":{},"params":{},"promises":["$@8","$@9"]}],null,["$","$La",null,{"children":"$Lb"}]]}],{},null,false]},null,false],["$","$1","h",{"children":[null,["$","$1","lC5yxkyUgJ-NWkuldTcep",{"children":[["$","$Lc",null,{"children":"$Ld"}],["$","$Le",null,{"children":"$Lf"}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}]]}],false]],"m":"$undefined","G":["$10","$undefined"],"s":false,"S":true}
|
|
16
16
|
8:{}
|
|
17
17
|
9:{}
|
|
18
18
|
f:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
|