d1s 0.2.3 → 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.
Files changed (54) hide show
  1. package/dist/.next/.next/BUILD_ID +1 -1
  2. package/dist/.next/.next/app-build-manifest.json +11 -11
  3. package/dist/.next/.next/app-path-routes-manifest.json +1 -1
  4. package/dist/.next/.next/build-manifest.json +2 -2
  5. package/dist/.next/.next/cache/.tsbuildinfo +1 -1
  6. package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/dist/.next/.next/cache/webpack/client-production/2.pack +0 -0
  8. package/dist/.next/.next/cache/webpack/client-production/5.pack +0 -0
  9. package/dist/.next/.next/cache/webpack/client-production/6.pack +0 -0
  10. package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
  11. package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
  12. package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
  13. package/dist/.next/.next/cache/webpack/server-production/4.pack +0 -0
  14. package/dist/.next/.next/cache/webpack/server-production/5.pack +0 -0
  15. package/dist/.next/.next/cache/webpack/server-production/6.pack +0 -0
  16. package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
  17. package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
  18. package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
  19. package/dist/.next/.next/next-server.js.nft.json +1 -1
  20. package/dist/.next/.next/prerender-manifest.json +1 -1
  21. package/dist/.next/.next/server/app/_not-found.html +1 -1
  22. package/dist/.next/.next/server/app/_not-found.rsc +1 -1
  23. package/dist/.next/.next/server/app/api/cloudflare/route.js +1 -1
  24. package/dist/.next/.next/server/app/api/databases/route.js +1 -1
  25. package/dist/.next/.next/server/app/api/pull-remote/confirm/route.js +1 -1
  26. package/dist/.next/.next/server/app/api/push-remote/confirm/route.js +1 -1
  27. package/dist/.next/.next/server/app/api/push-remote/preview/route.js +2 -2
  28. package/dist/.next/.next/server/app/api/query/route.js +2 -2
  29. package/dist/.next/.next/server/app/api/tables/[name]/route.js +2 -2
  30. package/dist/.next/.next/server/app/api/tables/route.js +2 -2
  31. package/dist/.next/.next/server/app/index.html +1 -1
  32. package/dist/.next/.next/server/app/index.rsc +1 -1
  33. package/dist/.next/.next/server/app-paths-manifest.json +3 -3
  34. package/dist/.next/.next/server/chunks/801.js +11 -11
  35. package/dist/.next/.next/server/pages/404.html +1 -1
  36. package/dist/.next/.next/server/pages/500.html +1 -1
  37. package/dist/.next/.next/static/fSVNB2iNhKcZdXXgESWZk/_buildManifest.js +1 -0
  38. package/dist/.next/.next/static/fSVNB2iNhKcZdXXgESWZk/_ssgManifest.js +1 -0
  39. package/dist/.next/.next/trace +3 -3
  40. package/dist/app/app/api/databases/route.js +1 -1
  41. package/dist/app/app/api/pull-remote/confirm/route.js +20 -20
  42. package/dist/app/app/api/push-remote/confirm/route.js +1 -1
  43. package/dist/app/app/api/push-remote/preview/route.js +1 -1
  44. package/dist/app/app/api/query/route.js +7 -7
  45. package/dist/d1-studio.js +1 -1
  46. package/dist/lib/find-wrangler-config.js +1 -1
  47. package/package.json +1 -1
  48. package/scripts/studio.js +1 -1
  49. package/src/app/api/databases/route.js +1 -1
  50. package/src/app/api/pull-remote/confirm/route.js +20 -20
  51. package/src/app/api/push-remote/confirm/route.js +1 -1
  52. package/src/app/api/push-remote/preview/route.js +1 -1
  53. package/src/app/api/query/route.js +7 -7
  54. 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")},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});console.log("Looking for Wrangler configuration in:",e);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");console.log(i.blue("Looking for wrangler configuration in:"),e);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
+ (()=>{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 +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")},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:()=>y,serverHooks:()=>R,workAsyncStorage:()=>h,workUnitAsyncStorage:()=>x});var o={};t.r(o),t.d(o,{OPTIONS:()=>w,POST:()=>f});var i=t(2706),s=t(8203),a=t(5994),n=t(9187),l=t(9748),c=t(3873),p=t(5949),g=t(9421),u=t(4218),m=t(961);async function d(e,r,t,o){let i={...process.env,CLOUDFLARE_API_TOKEN:t,CLOUDFLARE_ACCOUNT_ID:r};try{let r=c.join(e,"migrations"),t=c.join(e,"migrations-temp");await (0,l.mkdir)(r,{recursive:!0}),await (0,l.mkdir)(t,{recursive:!0});let s=await (0,l.readdir)(t).catch(()=>[]);await Promise.all(s.map(e=>(0,l.unlink)(c.join(t,e)))),console.log("Fetching remote migration metadata...");let a=await (0,m.GS)(e,o,i);console.log("Remote migration metadata:",a),console.log("Fetching migration file content from remote...");let n=new Map;for(let r of a)try{let s=r.name,a=await (0,g.sP)(e,o,s,i);n.set(s,a),console.log(`Staged migration file: ${s}`),await (0,l.writeFile)(c.join(t,s),a,"utf8")}catch(e){throw console.error(`Error fetching content for migration ${r.name}:`,e),Error(`Failed to fetch migration file content for ${r.name}`)}console.log("Fetching local schema for destructive update...");let p=await (0,u.ZX)(e,o,i,!1),d=p.filter(e=>"table"===e.type&&e.name&&"if"!==e.name.toLowerCase());console.log("Local table schema:",d);let f=d.length>0?(0,u.IC)(d.map(e=>({tableName:e.name,sql:e.sql,type:e.type}))):[];console.log("Computed drop order:",f),console.log("Beginning destructive update...");try{for(let r of(console.log("Disabling foreign keys..."),await (0,g.KK)(e,o,"PRAGMA foreign_keys=OFF;",i,!1),p.filter(e=>"trigger"===e.type)))console.log(`Dropping trigger: ${r.name}`),await (0,g.KK)(e,o,(0,g.z6)(`DROP TRIGGER IF EXISTS ${r.name}`),i,!1);for(let r of p.filter(e=>"index"===e.type))console.log(`Dropping index: ${r.name}`),await (0,g.KK)(e,o,(0,g.z6)(`DROP INDEX IF EXISTS ${r.name}`),i,!1);for(let r of f.reverse())console.log(`Dropping table: ${r}`),await (0,g.KK)(e,o,(0,g.z6)(`DROP TABLE IF EXISTS ${r}`),i,!1);console.log("Re-enabling foreign keys..."),await (0,g.KK)(e,o,"PRAGMA foreign_keys=ON;",i,!1)}catch(e){throw Error(`Error dropping existing objects: ${e.message}`)}try{console.log("Resetting local migrations table..."),await (0,m.k0)(e,o,"local",!0)}catch(e){throw Error(`Error resetting migrations table: ${e.message}`)}let w={preview:[]},y="";try{for(let[t,s]of n.entries()){y=t,console.log(`Applying migration: ${t}`),await (0,l.writeFile)(c.join(r,t),s,"utf8");let a=require("crypto").createHash("sha256").update(s).digest("hex");console.log(`Recording migration: ${t} with checksum ${a}`),await (0,m.CM)(e,o,{name:t,checksum:a},i,!1),await (0,g.KK)(e,o,s,i,!1),w.preview.push({migration:t,action:"applied"})}}catch(e){throw Error(`Error applying migration ${y}: ${e.message}`)}console.log("Replacing main migrations folder with staged files...");let h=await (0,l.readdir)(r).catch(()=>[]);if(h.length)for(let e of h)console.log(`Deleting local migration file: ${e}`),await (0,l.unlink)(c.join(r,e));for(let[e,t]of n.entries())console.log(`Copying staged file ${e} to main migrations folder`),await (0,l.writeFile)(c.join(r,e),t,"utf8");return console.log("Pull migration applied successfully."),{appliedMigrations:Array.from(n.keys()),details:w}}catch(e){throw console.error("Pull migration error:",e),e}}async function f(e){try{let{accountId:r,apiToken:t}=await e.json(),o=process.env.D1_PROJECT_DIR;if(!o)return n.NextResponse.json({success:!1,error:{type:g.wU.VALIDATION_ERROR,message:"Project directory not configured"}},{status:500});let i=await (0,p.S)(o);if(!i||!i.config)return n.NextResponse.json({success:!1,error:{type:g.wU.VALIDATION_ERROR,message:"Could not find Wrangler configuration"}},{status:400});let s=i.config;if(!s.d1_databases?.length)return n.NextResponse.json({success:!1,error:{type:g.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let a=s.d1_databases[0].database_name,l=await d(o,r,t,a);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||g.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 y=new i.AppRouteRouteModule({definition:{kind:s.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:o}),{workAsyncStorage:h,workUnitAsyncStorage:x,serverHooks:R}=y;function E(){return(0,a.patchFetch)({workAsyncStorage:h,workUnitAsyncStorage:x})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),o=r.X(0,[638,973,801],()=>t(9556));module.exports=o})();
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})();
@@ -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 console.log("Push Confirm Result (server):",E),{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})();
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")},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),o=s(8203),i=s(5994),n=s(9187),p=s(9748),u=s(3873),d=s(5949),l=s(9421),c=s(961);async function E(e,r,s,t,a=!0){let o={...process.env,CLOUDFLARE_ACCOUNT_ID:r,CLOUDFLARE_API_TOKEN:s};try{let r=`
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,l.KK)(e,t,r),await (0,l.KK)(e,t,s,o,!0);let a=await (0,l.KK)(e,t,"SELECT name FROM d1_migrations ORDER BY applied_at;",o,!0),i=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,c.JD)(r)).isValid){s.action="failed validation",s.reason="Migration validation failed",E.preview.push(s);continue}if(i.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 console.log("Push Preview Result (server):",E),{success:!0,preview:!0,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 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:l.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:l.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:l.wU.VALIDATION_ERROR,message:"No D1 databases configured"}},{status:400});let i=o.d1_databases[0].database_name,p=await E(t,r,s,i,!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||l.wU.EXECUTION_ERROR,message:e.message||"Failed to push to remote preview",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 m=new a.AppRouteRouteModule({definition:{kind:o.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,i.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})();
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")},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:()=>T,workAsyncStorage:()=>N,workUnitAsyncStorage:()=>O});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),c=t(9421),d=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(console.log("Received query:",s),!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;console.log("Using database:",a);let u=(0,c.mA)(s);if(console.log("Parsed statements:",u),!u.length)return i.NextResponse.json({success:!1,error:{message:"No valid SQL statements found"}},{status:400});u=u.map(c.Gq),console.log("Validated statements:",u);let R=`
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,c.KK)(t,a,R);let p=u.some(c.QQ);if(console.log("Has schema changes:",p),p){let e=await (0,d.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){console.log("Executing data modification:",r.sql);let s=await (0,c.KK)(t,a,r.sql);try{let r=JSON.parse(s),t=r[0]?.results||[];e.push(...t)}catch(e){console.log("Non-JSON output:",s);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===c.wU.VALIDATION_ERROR?400:t.type===c.wU.DEPENDENCY_ERROR?409:500;return i.NextResponse.json({success:!1,error:e},{status:r})}}async function 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:O,serverHooks:T}=E;function g(){return(0,a.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:O})}}};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})();
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")},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:()=>m,runtime:()=>f});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),f="nodejs",m="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});`,f=await w(g,u,d),m=`SELECT sql FROM sqlite_master WHERE type='table' AND name='${t}';`,h=await w(m,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=f.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=f.find(e=>1===e.pk)?.name||f[0]?.name,R=`
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
- `,b=await w(R,u,d);return i.NextResponse.json({success:!0,schema:q,data:b,meta:{tableName:t,total:j,page:o,limit:n,totalPages:Math.ceil(j/n),rowCount:b.length,columnCount:f.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");console.log(i.blue("Looking for wrangler configuration in:"),e);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})();
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")},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:()=>h,workAsyncStorage:()=>x,workUnitAsyncStorage:()=>w});var s={};t.r(s),t.d(s,{GET:()=>g,OPTIONS:()=>f});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 g(){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=`
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 f(){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:w,serverHooks:h}=m;function y(){return(0,a.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:w})}},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");console.log(i.blue("Looking for wrangler configuration in:"),e);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})();
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 [&amp;&gt;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 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_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 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_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\":\"YIuXI2CxMwg2fuuUEBsXL\",\"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\",\"EUjn4becVHHWD_2F3aAR4\",{\"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>
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 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_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":"YIuXI2CxMwg2fuuUEBsXL","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","EUjn4becVHHWD_2F3aAR4",{"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}
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"}]]
@@ -7,9 +7,9 @@
7
7
  "/api/pull-remote/confirm/route": "app/api/pull-remote/confirm/route.js",
8
8
  "/api/pull-remote/preview/route": "app/api/pull-remote/preview/route.js",
9
9
  "/api/push-remote/confirm/route": "app/api/push-remote/confirm/route.js",
10
- "/api/query/route": "app/api/query/route.js",
11
10
  "/api/push-remote/preview/route": "app/api/push-remote/preview/route.js",
11
+ "/api/query/route": "app/api/query/route.js",
12
12
  "/api/tables/route": "app/api/tables/route.js",
13
- "/api/tables/[name]/route": "app/api/tables/[name]/route.js",
14
- "/page": "app/page.js"
13
+ "/page": "app/page.js",
14
+ "/api/tables/[name]/route": "app/api/tables/[name]/route.js"
15
15
  }
@@ -1,4 +1,4 @@
1
- exports.id=801,exports.ids=[801],exports.modules={6487:()=>{},8335:()=>{},5949:(e,t,r)=>{"use strict";r.d(t,{S:()=>o});var a=r(9748),s=r(3149),i=r(2537),n=r(6789),l=r(872);async function o(e){try{let t;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");console.log(l.blue("Looking for wrangler configuration in:"),e);let r=null,o=null;for(let t of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(r=await (0,s.dJ)(t,{cwd:e})){o=t;break}if(!r)return console.log(l.yellow("No Wrangler configuration file found in:"),e),null;console.log(l.green(`Found ${o} at:`),r);let E=await (0,a.readFile)(r,"utf-8");return o.endsWith(".toml")?t=(0,i.parse)(E):(o.endsWith(".jsonc")&&(E=(0,n.A)(E)),t=JSON.parse(E)),{config:t,projectPath:e}}catch(e){throw console.error(l.red("Error reading Wrangler configuration:"),e.message),e}}},961:(e,t,r)=>{"use strict";r.d(t,{CM:()=>p,GS:()=>u,Gc:()=>A,JD:()=>d,Sl:()=>N,ai:()=>R,hI:()=>f,k0:()=>m});var a=r(9748),s=r(8354),i=r(9646),n=r(5511),l=r(3873),o=r(9421),E=r(4218);let c=(0,s.promisify)(i.exec);async function m(e,t,r="local",a=!1){let s="remote"===r?"--remote":"--local",i="remote"===r?`
1
+ exports.id=801,exports.ids=[801],exports.modules={6487:()=>{},8335:()=>{},5949:(e,t,r)=>{"use strict";r.d(t,{S:()=>E});var a=r(9748),s=r(3149),i=r(2537),n=r(6789),l=r(872);async function E(e){try{let t;if(!e||"string"!=typeof e)throw Error("Project path is required and must be a string");let r=null,E=null;for(let t of["wrangler.toml","wrangler.json","wrangler.jsonc"])if(r=await (0,s.dJ)(t,{cwd:e})){E=t;break}if(!r)return console.log(l.yellow("No Wrangler configuration file found in:"),e),null;console.log(l.green(`Found ${E} at:`),r);let o=await (0,a.readFile)(r,"utf-8");return E.endsWith(".toml")?t=(0,i.parse)(o):(E.endsWith(".jsonc")&&(o=(0,n.A)(o)),t=JSON.parse(o)),{config:t,projectPath:e}}catch(e){throw console.error(l.red("Error reading Wrangler configuration:"),e.message),e}}},961:(e,t,r)=>{"use strict";r.d(t,{CM:()=>p,GS:()=>u,Gc:()=>A,JD:()=>d,Sl:()=>N,ai:()=>R,hI:()=>f,k0:()=>m});var a=r(9748),s=r(8354),i=r(9646),n=r(5511),l=r(3873),E=r(9421),o=r(4218);let c=(0,s.promisify)(i.exec);async function m(e,t,r="local",a=!1){let s="remote"===r?"--remote":"--local",i="remote"===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,7 +11,7 @@ exports.id=801,exports.ids=[801],exports.modules={6487:()=>{},8335:()=>{},5949:(
11
11
  checksum TEXT NULL,
12
12
  applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
13
13
  );
14
- `;try{await c(`wrangler d1 execute ${t} ${s} --command="${i.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await c(`wrangler d1 execute ${t} ${s} --command="${"DELETE FROM d1_migrations;".replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw console.error(`Failed to initialize migrations table in ${r}:`,e),e}}function T(e){let t=new Date().toISOString().replace(/[^0-9]/g,"").slice(0,-3),r=e.type.toLowerCase().replace(/_/g,"-");if("CREATE_INDEX"===e.type){let r=e.description.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"");return`${t}_create-index_${r}.sql`}{let a=`${t}_${{"create-table":"create-table","alter-table":"alter-table","drop-table":"drop-table","drop-index":"drop-index","create-view":"create-view","drop-view":"drop-view","add-foreign-key":"add-foreign-key","drop-foreign-key":"drop-foreign-key","add-constraint":"add-constraint","drop-constraint":"drop-constraint"}[r]||r}_${e.tableName}`;return"ALTER_TABLE"===e.type&&e.description&&(a+=`_${e.description}`),(a=a.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,""))+".sql"}}async function d(e){let t=await (0,a.readFile)(e,"utf8");try{let e=(0,o.By)(t);return(0,o.Gq)(e),{isValid:!0,statement:e}}catch(e){return{isValid:!1,errors:e}}}async function u(e,t,r){try{let a=await (0,o.KK)(e,t,"SELECT name, applied_at FROM d1_migrations ORDER BY applied_at;",r,!0);if("string"==typeof a){let e=a.indexOf("[");if(-1!==e){let t=a.substring(e),r=JSON.parse(t);return r[0]?.results||[]}}return[]}catch(e){throw{type:o.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e.message,suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function R(e,t,{name:r,checksum:a},s="local"){let i="remote"===s?"--remote":"--local";if("local"===s&&a)try{await c(`wrangler d1 execute ${t} ${i} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await c(`wrangler d1 execute ${t} ${i} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let n="remote"!==s&&a?`
14
+ `;try{await c(`wrangler d1 execute ${t} ${s} --command="${i.replace(/"/g,'\\"')}"`,{cwd:e}),a&&await c(`wrangler d1 execute ${t} ${s} --command="${"DELETE FROM d1_migrations;".replace(/"/g,'\\"')}"`,{cwd:e})}catch(e){throw console.error(`Failed to initialize migrations table in ${r}:`,e),e}}function T(e){let t=new Date().toISOString().replace(/[^0-9]/g,"").slice(0,-3),r=e.type.toLowerCase().replace(/_/g,"-");if("CREATE_INDEX"===e.type){let r=e.description.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"");return`${t}_create-index_${r}.sql`}{let a=`${t}_${{"create-table":"create-table","alter-table":"alter-table","drop-table":"drop-table","drop-index":"drop-index","create-view":"create-view","drop-view":"drop-view","add-foreign-key":"add-foreign-key","drop-foreign-key":"drop-foreign-key","add-constraint":"add-constraint","drop-constraint":"drop-constraint"}[r]||r}_${e.tableName}`;return"ALTER_TABLE"===e.type&&e.description&&(a+=`_${e.description}`),(a=a.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,""))+".sql"}}async function d(e){let t=await (0,a.readFile)(e,"utf8");try{let e=(0,E.By)(t);return(0,E.Gq)(e),{isValid:!0,statement:e}}catch(e){return{isValid:!1,errors:e}}}async function u(e,t,r){try{let a=await (0,E.KK)(e,t,"SELECT name, applied_at FROM d1_migrations ORDER BY applied_at;",r,!0);if("string"==typeof a){let e=a.indexOf("[");if(-1!==e){let t=a.substring(e),r=JSON.parse(t);return r[0]?.results||[]}}return[]}catch(e){throw{type:E.wU.EXECUTION_ERROR,message:"Failed to get remote migrations",details:{error:e.message,suggestions:["Check remote database permissions","Verify credentials and connection"]}}}}async function R(e,t,{name:r,checksum:a},s="local"){let i="remote"===s?"--remote":"--local";if("local"===s&&a)try{await c(`wrangler d1 execute ${t} ${i} --command="SELECT checksum FROM d1_migrations LIMIT 1;"`,{cwd:e}).catch(()=>!1)||await c(`wrangler d1 execute ${t} ${i} --command="ALTER TABLE d1_migrations ADD COLUMN checksum TEXT;"`,{cwd:e})}catch(e){}let n="remote"!==s&&a?`
15
15
  INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
16
16
  VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
17
17
  `:`
@@ -23,13 +23,13 @@ exports.id=801,exports.ids=[801],exports.modules={6487:()=>{},8335:()=>{},5949:(
23
23
  `:`
24
24
  INSERT OR REPLACE INTO d1_migrations (name, checksum, applied_at)
25
25
  VALUES ('${r}', '${a}', CURRENT_TIMESTAMP);
26
- `;try{await (0,o.KK)(e,t,n,s,i)}catch(e){throw{type:o.wU.EXECUTION_ERROR,message:`Failed to record migration ${r}`,details:{file:r,error:e.message,suggestions:["Check if migration is already recorded"]}}}}async function f(e,t){try{let r=await u(e,t,{}),a=new Map(r.map(e=>[e.name,e]));return{applied:Array.from(a.keys()),count:a.size}}catch(e){throw console.error("Failed to compare migrations:",e),e}}function N(e){return(0,n.createHash)("sha256").update(e).digest("hex")}async function A(e,t,r){try{let s=l.join(e,"migrations");await (0,a.mkdir)(s,{recursive:!0});let i=[],n=[],c=[];for(let e of r)e.type===o.Pg.DATA_MODIFICATION?c.push(e):n.push(e);let m=new Map,d="__no_table__";for(let e of n){let t=e.tableName?e.tableName.toLowerCase():d;m.has(t)||m.set(t,[]),m.get(t).push(e)}let u=[...m.keys()].filter(e=>e!==d),p=[];if(u.length>0){let e=u.map(e=>m.get(e)[0]);p=(0,E.IC)(e)}for(let r of p){for(let n of m.get(r)||[])try{if(n.type===o.Pg.DROP_TABLE&&!await (0,o.F9)(e,t,{},n.tableName,!1))throw Error(`no such table: ${n.tableName}`);let r=await (0,o.KK)(e,t,n.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let E=T(n),c=l.join(s,E),m=(0,o.tn)(n.sql);await (0,a.writeFile)(c,m,"utf8");let d=N(n.sql);await R(e,t,{name:E,checksum:d},"local"),i.push({type:n.type,table:n.tableName,migration:E,checksum:d})}catch(e){throw e}m.delete(r)}if(m.has(d))for(let r of m.get(d))try{await (0,o.KK)(e,t,r.sql);let n=T(r),E=l.join(s,n),c=(0,o.tn)(r.sql);await (0,a.writeFile)(E,c,"utf8");let m=N(r.sql);await R(e,t,{name:n,checksum:m},"local"),i.push({type:r.type,table:r.tableName||null,migration:n,checksum:m})}catch(e){throw e}for(let r of c)try{await (0,o.KK)(e,t,r.sql),i.push({type:r.type,table:r.tableName||null,executed:!0})}catch(e){throw e}return i}catch(e){throw e}}},4218:(e,t,r)=>{"use strict";r.d(t,{IC:()=>i,ZX:()=>s});var a=r(9421);async function s(e,t,r={},i=!1){let n=`
26
+ `;try{await (0,E.KK)(e,t,n,s,i)}catch(e){throw{type:E.wU.EXECUTION_ERROR,message:`Failed to record migration ${r}`,details:{file:r,error:e.message,suggestions:["Check if migration is already recorded"]}}}}async function f(e,t){try{let r=await u(e,t,{}),a=new Map(r.map(e=>[e.name,e]));return{applied:Array.from(a.keys()),count:a.size}}catch(e){throw console.error("Failed to compare migrations:",e),e}}function N(e){return(0,n.createHash)("sha256").update(e).digest("hex")}async function A(e,t,r){try{let s=l.join(e,"migrations");await (0,a.mkdir)(s,{recursive:!0});let i=[],n=[],c=[];for(let e of r)e.type===E.Pg.DATA_MODIFICATION?c.push(e):n.push(e);let m=new Map,d="__no_table__";for(let e of n){let t=e.tableName?e.tableName.toLowerCase():d;m.has(t)||m.set(t,[]),m.get(t).push(e)}let u=[...m.keys()].filter(e=>e!==d),p=[];if(u.length>0){let e=u.map(e=>m.get(e)[0]);p=(0,o.IC)(e)}for(let r of p){for(let n of m.get(r)||[])try{if(n.type===E.Pg.DROP_TABLE&&!await (0,E.F9)(e,t,{},n.tableName,!1))throw Error(`no such table: ${n.tableName}`);let r=await (0,E.KK)(e,t,n.sql);if(r&&(r.toLowerCase().includes("syntax error")||r.toLowerCase().includes("sqlite_error")))throw Error(r);let o=T(n),c=l.join(s,o),m=(0,E.tn)(n.sql);await (0,a.writeFile)(c,m,"utf8");let d=N(n.sql);await R(e,t,{name:o,checksum:d},"local"),i.push({type:n.type,table:n.tableName,migration:o,checksum:d})}catch(e){throw e}m.delete(r)}if(m.has(d))for(let r of m.get(d))try{await (0,E.KK)(e,t,r.sql);let n=T(r),o=l.join(s,n),c=(0,E.tn)(r.sql);await (0,a.writeFile)(o,c,"utf8");let m=N(r.sql);await R(e,t,{name:n,checksum:m},"local"),i.push({type:r.type,table:r.tableName||null,migration:n,checksum:m})}catch(e){throw e}for(let r of c)try{await (0,E.KK)(e,t,r.sql),i.push({type:r.type,table:r.tableName||null,executed:!0})}catch(e){throw e}return i}catch(e){throw e}}},4218:(e,t,r)=>{"use strict";r.d(t,{IC:()=>i,ZX:()=>s});var a=r(9421);async function s(e,t,r={},i=!1){let n=`
27
27
  SELECT name, type, sql
28
28
  FROM sqlite_master
29
29
  WHERE type IN ('table', 'index', 'trigger')
30
30
  AND name NOT LIKE 'sqlite_%'
31
31
  AND name != 'd1_migrations';
32
- `;try{let s=await (0,a.KK)(e,t,n,r,i),l=JSON.parse(s);return l[0]?.results||[]}catch(e){throw{type:a.wU.EXECUTION_ERROR,message:"Failed to get current schema",details:{error:e.message,suggestions:["Check database permissions"]}}}}function i(e){let t=new Map;return e.filter(e=>"DATA_MODIFICATION"!==e.type).forEach(e=>{let r=(e.name||e.tableName).toLowerCase();if(t.has(r)||t.set(r,new Set),"CREATE_TABLE"===e.type){let a=e.sql.match(/FOREIGN\s+KEY\s*\([^)]+\)\s+REFERENCES\s+(\w+)/gi);a&&a.forEach(e=>{let a=e.match(/REFERENCES\s+(\w+)/i)[1].toLowerCase();t.get(r).add(a)})}}),function(e){let t=[],r=new Set,a=new Set;for(let s of e.keys())r.has(s)||function s(i){if(a.has(i))throw Error(`Circular dependency detected for table: ${i}`);if(!r.has(i)){for(let t of(a.add(i),e.get(i)||new Set)){if(!e.has(t))throw Error(`Missing table dependency: ${t}`);s(t)}a.delete(i),r.add(i),t.push(i)}}(s);return t}(t)}},9421:(e,t,r)=>{"use strict";r.d(t,{By:()=>E,F9:()=>R,Gq:()=>c,KK:()=>f,Pg:()=>n,QQ:()=>o,bp:()=>u,mA:()=>p,sP:()=>h,tn:()=>I,wU:()=>l,z6:()=>N});var a=r(8354),s=r(9646);let i=(0,a.promisify)(s.exec),n={CREATE_TABLE:"CREATE_TABLE",ALTER_TABLE:"ALTER_TABLE",DROP_TABLE:"DROP_TABLE",CREATE_INDEX:"CREATE_INDEX",DROP_INDEX:"DROP_INDEX",DATA_MODIFICATION:"DATA_MODIFICATION"},l={VALIDATION_ERROR:"VALIDATION_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",DEPENDENCY_ERROR:"DEPENDENCY_ERROR"};function o(e){return e.type!==n.DATA_MODIFICATION}function E(e){let t=e.trim().replace(/\s+/g," "),r=t.toUpperCase();if(r.startsWith("CREATE TABLE"))return{type:n.CREATE_TABLE,tableName:m(t,"CREATE TABLE"),sql:t,description:"create-table"};if(r.startsWith("ALTER TABLE")){let e=m(t,"ALTER TABLE"),a="";if(r.includes("RENAME")){let e=t.match(/RENAME\s+(?:COLUMN\s+)?([\w$]+)\s+TO\s+([\w$]+)/i);e&&(a=`rename-${e[1]}-to-${e[2]}`)}else if(r.includes("ADD COLUMN")){let e=t.match(/ADD\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(e){let t=e[1],r=e[2]?e[2].trim().replace(/\s+/g,"-"):"";a=r?`add-${t}-${r}`:`add-${t}`}}else if(r.includes("DROP COLUMN")){let e=t.match(/DROP\s+COLUMN\s+([\w$]+)/i);e&&(a=`drop-${e[1]}`)}else if(r.includes("MODIFY COLUMN")||r.includes("CHANGE COLUMN")){let e=t.match(/(?:MODIFY|CHANGE)\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(e){let t=e[1],r=e[2]?e[2].trim().replace(/\s+/g,"-"):"";a=r?`modify-${t}-to-${r}`:`modify-${t}`}}return{type:n.ALTER_TABLE,tableName:e,sql:t,description:a}}if(r.startsWith("DROP TABLE"))return{type:n.DROP_TABLE,tableName:m(t,"DROP TABLE"),sql:t,description:"drop-table"};if(r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")){let e=T(t),r=t.match(/INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?([\w$]+)/i),a=r?r[1]:"",s=t.match(/ON\s+[\w$]+\s*\(([^)]+)\)/i),i=(s?s[1].trim():"").replace(/\s+/g,"").replace(/,/g,"-").toLowerCase(),l=a;return i&&!l.toLowerCase().includes(i)&&(l+=`-${i}`),{type:n.CREATE_INDEX,tableName:e,sql:t,description:l}}if(r.startsWith("DROP INDEX")){let e=T(t),r=t.match(/DROP\s+INDEX\s+(?:IF\s+EXISTS\s+)?([\w$]+)/i),a=r?r[1]:"";return{type:n.DROP_INDEX,tableName:e,sql:t,description:a?`drop-index-${a}`:"drop-index"}}return{type:n.DATA_MODIFICATION,sql:t,description:"data-modification"}}function c(e){if(e.type!==n.DATA_MODIFICATION&&!e.tableName)throw{type:l.VALIDATION_ERROR,message:`Invalid SQL statement: unable to determine table name for "${e.type}".`,details:{sql:e.sql}};return e}function m(e,t){let r=e.match(RegExp(`${t}\\s+(?:IF\\s+(?:NOT\\s+)?EXISTS\\s+)?([\\w_]+)`,"i"));return r?r[1]:null}function T(e){let t=e.match(/ON\s+([\w_]+)/i);return t?t[1]:null}async function d(e){let t=e.match(/^\d+_create[-_]table[_-](.+)\.sql$/i);return t||(t=e.match(/^\d+_create[-](.+)-table\.sql$/i))||(t=e.match(/^\d+_alter[-_]table[_-](.+?)(?:[_-].+)?\.sql$/i))||(t=e.match(/^\d+_alter[-](.+?)-table(?:[_-].+)?\.sql$/i))||(t=e.match(/^\d+_create[-_]index[-_](.+)\.sql$/i))?t[1]:null}function u(e){return e.split("\n").filter(e=>!e.trim().startsWith("--")).join("\n").trim()}async function R(e,t,r,a,s=!1){let i=`SELECT name FROM sqlite_master WHERE type='table' AND name = '${a}' COLLATE NOCASE;`,n=await f(e,t,i,r,s);try{let e=n.indexOf("[");if(-1!==e){let t=n.substring(e),r=JSON.parse(t);return(r[0]?.results||[]).length>0}return!1}catch(e){return console.error("Error parsing tableExists result:",e),!1}}function p(e){return e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim().split(";").map(e=>e.trim()).filter(e=>e.length>0).map(e=>E(e+";"))}async function f(e,t,r,a={},s=!1){try{let n=r.trim().replace(/\s+/g," "),l=n.toUpperCase();(l.startsWith("CREATE INDEX")||l.startsWith("CREATE UNIQUE INDEX"))&&!l.includes("IF NOT EXISTS")&&(n=l.startsWith("CREATE UNIQUE INDEX")?n.replace(/CREATE\s+UNIQUE\s+INDEX/i,"CREATE UNIQUE INDEX IF NOT EXISTS"):n.replace(/CREATE\s+INDEX/i,"CREATE INDEX IF NOT EXISTS"));let o="win32"===process.platform,E=`${o?"npx.cmd":"npx"} wrangler d1 execute ${t} ${s?"--remote":"--local"} --command="${n.replace(/"/g,'\\"')}"`,c={cwd:e,env:{...process.env,...a},maxBuffer:0xa00000,shell:!0};console.log("Executing command:",E);let{stdout:m,stderr:T}=await i(E,c);if(T&&!T.includes("\uD83C\uDF00"))throw Error(T);try{let e=m.indexOf("[");if(-1!==e)return m.substring(e)}catch(e){console.warn("JSON parse warning:",e)}return m}catch(e){throw console.error("SQL Execution error:",e),{type:l.EXECUTION_ERROR,message:"Failed to execute SQL command",details:{command:e.cmd,stderr:e.stderr,stdout:e.stdout,originalError:e.message,suggestions:["Ensure Node.js and Wrangler are installed","Check npx in PATH","Verify the D1 database exists and is configured","Check wrangler.toml configuration"]}}}}function N(e){let t=e.trim(),r=t.toUpperCase();return r.startsWith("CREATE TABLE")?function(e){let t=e.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s*\(([\s\S]*)\)/i);if(!t)return e;let[,r,a]=t,s=A(a).map(e=>e.trim()).filter(Boolean);return`CREATE TABLE ${r} (
32
+ `;try{let s=await (0,a.KK)(e,t,n,r,i),l=JSON.parse(s);return l[0]?.results||[]}catch(e){throw{type:a.wU.EXECUTION_ERROR,message:"Failed to get current schema",details:{error:e.message,suggestions:["Check database permissions"]}}}}function i(e){let t=new Map;return e.filter(e=>"DATA_MODIFICATION"!==e.type).forEach(e=>{let r=(e.name||e.tableName).toLowerCase();if(t.has(r)||t.set(r,new Set),"CREATE_TABLE"===e.type){let a=e.sql.match(/FOREIGN\s+KEY\s*\([^)]+\)\s+REFERENCES\s+(\w+)/gi);a&&a.forEach(e=>{let a=e.match(/REFERENCES\s+(\w+)/i)[1].toLowerCase();t.get(r).add(a)})}}),function(e){let t=[],r=new Set,a=new Set;for(let s of e.keys())r.has(s)||function s(i){if(a.has(i))throw Error(`Circular dependency detected for table: ${i}`);if(!r.has(i)){for(let t of(a.add(i),e.get(i)||new Set)){if(!e.has(t))throw Error(`Missing table dependency: ${t}`);s(t)}a.delete(i),r.add(i),t.push(i)}}(s);return t}(t)}},9421:(e,t,r)=>{"use strict";r.d(t,{By:()=>o,F9:()=>R,Gq:()=>c,KK:()=>f,Pg:()=>n,QQ:()=>E,bp:()=>u,mA:()=>p,sP:()=>h,tn:()=>I,wU:()=>l,z6:()=>N});var a=r(8354),s=r(9646);let i=(0,a.promisify)(s.exec),n={CREATE_TABLE:"CREATE_TABLE",ALTER_TABLE:"ALTER_TABLE",DROP_TABLE:"DROP_TABLE",CREATE_INDEX:"CREATE_INDEX",DROP_INDEX:"DROP_INDEX",DATA_MODIFICATION:"DATA_MODIFICATION"},l={VALIDATION_ERROR:"VALIDATION_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",EXECUTION_ERROR:"EXECUTION_ERROR",DEPENDENCY_ERROR:"DEPENDENCY_ERROR"};function E(e){return e.type!==n.DATA_MODIFICATION}function o(e){let t=e.trim().replace(/\s+/g," "),r=t.toUpperCase();if(r.startsWith("CREATE TABLE"))return{type:n.CREATE_TABLE,tableName:m(t,"CREATE TABLE"),sql:t,description:"create-table"};if(r.startsWith("ALTER TABLE")){let e=m(t,"ALTER TABLE"),a="";if(r.includes("RENAME")){let e=t.match(/RENAME\s+(?:COLUMN\s+)?([\w$]+)\s+TO\s+([\w$]+)/i);e&&(a=`rename-${e[1]}-to-${e[2]}`)}else if(r.includes("ADD COLUMN")){let e=t.match(/ADD\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(e){let t=e[1],r=e[2]?e[2].trim().replace(/\s+/g,"-"):"";a=r?`add-${t}-${r}`:`add-${t}`}}else if(r.includes("DROP COLUMN")){let e=t.match(/DROP\s+COLUMN\s+([\w$]+)/i);e&&(a=`drop-${e[1]}`)}else if(r.includes("MODIFY COLUMN")||r.includes("CHANGE COLUMN")){let e=t.match(/(?:MODIFY|CHANGE)\s+COLUMN\s+([\w$]+)(\s+[\w()]+)?/i);if(e){let t=e[1],r=e[2]?e[2].trim().replace(/\s+/g,"-"):"";a=r?`modify-${t}-to-${r}`:`modify-${t}`}}return{type:n.ALTER_TABLE,tableName:e,sql:t,description:a}}if(r.startsWith("DROP TABLE"))return{type:n.DROP_TABLE,tableName:m(t,"DROP TABLE"),sql:t,description:"drop-table"};if(r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")){let e=T(t),r=t.match(/INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?([\w$]+)/i),a=r?r[1]:"",s=t.match(/ON\s+[\w$]+\s*\(([^)]+)\)/i),i=(s?s[1].trim():"").replace(/\s+/g,"").replace(/,/g,"-").toLowerCase(),l=a;return i&&!l.toLowerCase().includes(i)&&(l+=`-${i}`),{type:n.CREATE_INDEX,tableName:e,sql:t,description:l}}if(r.startsWith("DROP INDEX")){let e=T(t),r=t.match(/DROP\s+INDEX\s+(?:IF\s+EXISTS\s+)?([\w$]+)/i),a=r?r[1]:"";return{type:n.DROP_INDEX,tableName:e,sql:t,description:a?`drop-index-${a}`:"drop-index"}}return{type:n.DATA_MODIFICATION,sql:t,description:"data-modification"}}function c(e){if(e.type!==n.DATA_MODIFICATION&&!e.tableName)throw{type:l.VALIDATION_ERROR,message:`Invalid SQL statement: unable to determine table name for "${e.type}".`,details:{sql:e.sql}};return e}function m(e,t){let r=e.match(RegExp(`${t}\\s+(?:IF\\s+(?:NOT\\s+)?EXISTS\\s+)?([\\w_]+)`,"i"));return r?r[1]:null}function T(e){let t=e.match(/ON\s+([\w_]+)/i);return t?t[1]:null}async function d(e){let t=e.match(/^\d+_create[-_]table[_-](.+)\.sql$/i);return t||(t=e.match(/^\d+_create[-](.+)-table\.sql$/i))||(t=e.match(/^\d+_alter[-_]table[_-](.+?)(?:[_-].+)?\.sql$/i))||(t=e.match(/^\d+_alter[-](.+?)-table(?:[_-].+)?\.sql$/i))||(t=e.match(/^\d+_create[-_]index[-_](.+)\.sql$/i))?t[1]:null}function u(e){return e.split("\n").filter(e=>!e.trim().startsWith("--")).join("\n").trim()}async function R(e,t,r,a,s=!1){let i=`SELECT name FROM sqlite_master WHERE type='table' AND name = '${a}' COLLATE NOCASE;`,n=await f(e,t,i,r,s);try{let e=n.indexOf("[");if(-1!==e){let t=n.substring(e),r=JSON.parse(t);return(r[0]?.results||[]).length>0}return!1}catch(e){return console.error("Error parsing tableExists result:",e),!1}}function p(e){return e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim().split(";").map(e=>e.trim()).filter(e=>e.length>0).map(e=>o(e+";"))}async function f(e,t,r,a={},s=!1){try{let n=r.trim().replace(/\s+/g," "),l=n.toUpperCase();(l.startsWith("CREATE INDEX")||l.startsWith("CREATE UNIQUE INDEX"))&&!l.includes("IF NOT EXISTS")&&(n=l.startsWith("CREATE UNIQUE INDEX")?n.replace(/CREATE\s+UNIQUE\s+INDEX/i,"CREATE UNIQUE INDEX IF NOT EXISTS"):n.replace(/CREATE\s+INDEX/i,"CREATE INDEX IF NOT EXISTS"));let E="win32"===process.platform,o=`${E?"npx.cmd":"npx"} wrangler d1 execute ${t} ${s?"--remote":"--local"} --command="${n.replace(/"/g,'\\"')}"`,c={cwd:e,env:{...process.env,...a},maxBuffer:0xa00000,shell:!0};console.log("Executing command:",o);let{stdout:m,stderr:T}=await i(o,c);if(T&&!T.includes("\uD83C\uDF00"))throw Error(T);try{let e=m.indexOf("[");if(-1!==e)return m.substring(e)}catch(e){console.warn("JSON parse warning:",e)}return m}catch(e){throw console.error("SQL Execution error:",e),{type:l.EXECUTION_ERROR,message:"Failed to execute SQL command",details:{command:e.cmd,stderr:e.stderr,stdout:e.stdout,originalError:e.message,suggestions:["Ensure Node.js and Wrangler are installed","Check npx in PATH","Verify the D1 database exists and is configured","Check wrangler.toml configuration"]}}}}function N(e){let t=e.trim(),r=t.toUpperCase();return r.startsWith("CREATE TABLE")?function(e){let t=e.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s*\(([\s\S]*)\)/i);if(!t)return e;let[,r,a]=t,s=A(a).map(e=>e.trim()).filter(Boolean);return`CREATE TABLE ${r} (
33
33
  ${s.join(",\n ")}
34
34
  );`}(t):r.startsWith("CREATE INDEX")||r.startsWith("CREATE UNIQUE INDEX")?function(e){let t=e.match(/CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)\s+ON\s+(\w+)\s*\((.*)\)/i);if(!t)return e;let[,r,a,s,i]=t,n=i.split(",").map(e=>e.trim()).join(", ");return`CREATE ${r||""}INDEX ${a} ON ${s} (${n});`}(t):r.startsWith("ALTER TABLE")?function(e){let t=e.match(/ALTER\s+TABLE\s+(\w+)\s+(.*)/i);if(!t)return e;let[,r,a]=t,s=A(a);return 1===s.length?`ALTER TABLE ${r} ${s[0]};`:`ALTER TABLE ${r}
35
35
  ${s.map((e,t)=>` ${e}${t<s.length-1?",":";"}`).join("\n")}`}(t):r.startsWith("DROP TABLE")||r.startsWith("DROP INDEX")?function(e){let t=e.match(/DROP\s+(TABLE|INDEX)\s+(?:IF\s+EXISTS\s+)?(\w+)/i);if(!t)return e;let[,r,a]=t;return`DROP ${r} IF EXISTS ${a};`}(t):r.startsWith("INSERT INTO")?function(e){let t=e.match(/INSERT\s+INTO\s+(\w+)\s*(\([^)]+\))?\s*VALUES\s*(.+)/i);if(!t)return e;let[,r,a,s]=t,i=A(s);return`INSERT INTO ${r}${a?` ${a}`:""}
@@ -40,16 +40,16 @@ ${i.map(e=>` ${e.trim()}`).join(",\n")}`;return s&&(n+=`
40
40
  WHERE
41
41
  ${s.trim()}`),n+";"}(t):r.startsWith("DELETE FROM")?function(e){let t=e.match(/DELETE\s+FROM\s+(\w+)(?:\s+WHERE\s+(.+))?$/i);if(!t)return e;let[,r,a]=t,s=`DELETE FROM ${r}`;return a&&(s+=`
42
42
  WHERE
43
- ${a.trim()}`),s+";"}(t):r.startsWith("SELECT")?function(e){let t=e.match(/SELECT\s+(.+?)\s+FROM\s+(.+?)(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+HAVING\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+LIMIT\s+(.+?))?$/i);if(!t)return e;let[,r,a,s,i,n,l,o]=t,E=`SELECT
43
+ ${a.trim()}`),s+";"}(t):r.startsWith("SELECT")?function(e){let t=e.match(/SELECT\s+(.+?)\s+FROM\s+(.+?)(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+HAVING\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+LIMIT\s+(.+?))?$/i);if(!t)return e;let[,r,a,s,i,n,l,E]=t,o=`SELECT
44
44
  ${r.split(",").map(e=>e.trim()).join(",\n ")}
45
45
  FROM
46
- ${a.trim()}`;return s&&(E+=`
46
+ ${a.trim()}`;return s&&(o+=`
47
47
  WHERE
48
- ${s.trim()}`),i&&(E+=`
48
+ ${s.trim()}`),i&&(o+=`
49
49
  GROUP BY
50
- ${i.trim()}`),n&&(E+=`
50
+ ${i.trim()}`),n&&(o+=`
51
51
  HAVING
52
- ${n.trim()}`),l&&(E+=`
52
+ ${n.trim()}`),l&&(o+=`
53
53
  ORDER BY
54
- ${l.trim()}`),o&&(E+=`
55
- LIMIT ${o.trim()}`),E+";"}(t):t+";"}function A(e){let t=[],r="",a=0,s=!1,i="";for(let n of e)'"'===n&&"\\"!==i&&(s=!s),!s&&("("===n&&a++,")"===n&&a--),","!==n||0!==a||s?r+=n:(t.push(r.trim()),r=""),i=n;return r.trim()&&t.push(r.trim()),t}function I(e){return e.split(";").map(e=>e.trim()).filter(e=>e.length>0).map(e=>N(e)).join("\n\n")+"\n"}async function h(e,t,r,a){try{let s;let i=await d(r);if(i){let r=await f(e,t,`SELECT sql FROM sqlite_master WHERE type='table' AND name='${i}';`,a,!0);try{let e=JSON.parse(r);s=e[0]?.results?.[0]?.sql}catch(e){console.error("Error parsing sqlite_master result:",e)}}if(!s&&r.includes("create-index")){let i=r.match(/create-index[-_]([^_.]+)/);if(i){let r=await f(e,t,`SELECT sql FROM sqlite_master WHERE type='index' AND name='${i[1]}';`,a,!0),n=JSON.parse(r);s=n[0]?.results?.[0]?.sql}}if(!s&&i){let r=await f(e,t,`SELECT sql FROM sqlite_master WHERE name LIKE '%${i}%' LIMIT 1;`,a,!0);try{let e=JSON.parse(r);s=e[0]?.results?.[0]?.sql}catch(e){console.error("Error parsing fallback result:",e)}}if(!s)throw Error(`Could not retrieve SQL content for migration: ${r}`);return s+";"}catch(e){throw{type:l.EXECUTION_ERROR,message:`Failed to get migration file content: ${e.message}`,details:{file:r,error:e.message,suggestions:["Check if the table exists in the remote database","Verify the migration filename follows the expected pattern","Ensure you have permissions to access the remote database"]}}}}}};
54
+ ${l.trim()}`),E&&(o+=`
55
+ LIMIT ${E.trim()}`),o+";"}(t):t+";"}function A(e){let t=[],r="",a=0,s=!1,i="";for(let n of e)'"'===n&&"\\"!==i&&(s=!s),!s&&("("===n&&a++,")"===n&&a--),","!==n||0!==a||s?r+=n:(t.push(r.trim()),r=""),i=n;return r.trim()&&t.push(r.trim()),t}function I(e){return e.split(";").map(e=>e.trim()).filter(e=>e.length>0).map(e=>N(e)).join("\n\n")+"\n"}async function h(e,t,r,a){try{let s;let i=await d(r);if(i){let r=await f(e,t,`SELECT sql FROM sqlite_master WHERE type='table' AND name='${i}';`,a,!0);try{let e=JSON.parse(r);s=e[0]?.results?.[0]?.sql}catch(e){console.error("Error parsing sqlite_master result:",e)}}if(!s&&r.includes("create-index")){let i=r.match(/create-index[-_]([^_.]+)/);if(i){let r=await f(e,t,`SELECT sql FROM sqlite_master WHERE type='index' AND name='${i[1]}';`,a,!0),n=JSON.parse(r);s=n[0]?.results?.[0]?.sql}}if(!s&&i){let r=await f(e,t,`SELECT sql FROM sqlite_master WHERE name LIKE '%${i}%' LIMIT 1;`,a,!0);try{let e=JSON.parse(r);s=e[0]?.results?.[0]?.sql}catch(e){console.error("Error parsing fallback result:",e)}}if(!s)throw Error(`Could not retrieve SQL content for migration: ${r}`);return s+";"}catch(e){throw{type:l.EXECUTION_ERROR,message:`Failed to get migration file content: ${e.message}`,details:{file:r,error:e.message,suggestions:["Check if the table exists in the remote database","Verify the migration filename follows the expected pattern","Ensure you have permissions to access the remote database"]}}}}}};
@@ -1 +1 @@
1
- <!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><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><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 style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>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)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></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[6213,[],\"OutletBoundary\"]\n8:I[6213,[],\"MetadataBoundary\"]\na:I[6213,[],\"ViewportBoundary\"]\nc: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\":\"YIuXI2CxMwg2fuuUEBsXL\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"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\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:style\",\"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\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":\"$L7\"}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$1\",\"WrnID5oXjYFvJ1SpkxCkd\",{\"children\":[[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n9:[[\"$\",\"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,"7:null\n"])</script></body></html>
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><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><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 style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>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)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></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[6213,[],\"OutletBoundary\"]\n8:I[6213,[],\"MetadataBoundary\"]\na:I[6213,[],\"ViewportBoundary\"]\nc: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\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"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\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:style\",\"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\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:children:0:props:notFound:1:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":\"$L7\"}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$1\",\"GDsIC5P3JeLTro1VI_0Dp\",{\"children\":[[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n9:[[\"$\",\"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,"7:null\n"])</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c76ac1e586b2802a.js" defer=""></script><script src="/_next/static/chunks/framework-d29117d969504448.js" defer=""></script><script src="/_next/static/chunks/main-8d0ab17774ffa031.js" defer=""></script><script src="/_next/static/chunks/pages/_app-d23763e3e6c904ff.js" defer=""></script><script src="/_next/static/chunks/pages/_error-9b7125ad1a1e68fa.js" defer=""></script><script src="/_next/static/YIuXI2CxMwg2fuuUEBsXL/_buildManifest.js" defer=""></script><script src="/_next/static/YIuXI2CxMwg2fuuUEBsXL/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>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)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"YIuXI2CxMwg2fuuUEBsXL","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-c76ac1e586b2802a.js" defer=""></script><script src="/_next/static/chunks/framework-d29117d969504448.js" defer=""></script><script src="/_next/static/chunks/main-8d0ab17774ffa031.js" defer=""></script><script src="/_next/static/chunks/pages/_app-d23763e3e6c904ff.js" defer=""></script><script src="/_next/static/chunks/pages/_error-9b7125ad1a1e68fa.js" defer=""></script><script src="/_next/static/fSVNB2iNhKcZdXXgESWZk/_buildManifest.js" defer=""></script><script src="/_next/static/fSVNB2iNhKcZdXXgESWZk/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>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)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"fSVNB2iNhKcZdXXgESWZk","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -0,0 +1 @@
1
+ self.__BUILD_MANIFEST=function(e,r,t,_){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:12,errorRate:1e-4,numBits:231,numHashes:14,bitArray:[1,1,1,e,0,e,0,0,r,r,r,e,e,e,r,r,e,r,e,r,e,r,e,r,e,r,e,r,r,r,e,r,e,r,r,r,e,r,e,e,r,r,e,r,r,r,r,e,e,r,r,e,e,r,r,e,e,r,e,r,r,e,r,e,r,r,e,e,e,e,e,r,e,r,e,r,e,e,e,r,e,e,e,r,r,e,r,e,r,r,r,e,r,r,r,r,e,r,e,e,e,r,e,r,e,r,r,r,e,e,e,e,r,r,r,r,e,r,e,r,e,e,r,e,r,r,r,e,r,r,e,e,e,e,e,r,r,r,e,r,r,r,r,r,e,e,e,r,e,r,e,r,r,r,r,r,r,r,e,e,r,r,e,r,e,r,e,e,e,e,e,e,r,e,e,e,r,e,e,e,e,r,e,r,r,r,e,r,e,r,e,e,e,r,r,r,r,e,e,r,r,r,r,e,e,e,r,e,r,r,r,e,e,r,e,r,e,e,e,e,e,e,e,e,r,e,r,r,e,e,r]},__routerFilterDynamic:{numItems:e,errorRate:1e-4,numBits:20,numHashes:14,bitArray:[e,r,r,e,r,e,e,r,e,e,e,r,r,r,r,e,e,e,e,e]},"/_error":["static/chunks/pages/_error-9b7125ad1a1e68fa.js"],sortedPages:["/_app","/_error"]}}(1,0,0,0),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -0,0 +1 @@
1
+ self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()