database-studio 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs
CHANGED
|
@@ -28,4 +28,4 @@ jQIDAQAB
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
`}),await u.goto(`http://localhost:${t}?view=schema&export=true`,{waitUntil:"networkidle0"});let j=await u.pdf({format:"A4",printBackground:!0,margin:{top:"10mm",bottom:"10mm",left:"10mm",right:"10mm"},preferCSSPageSize:!0});o.contentType("application/pdf"),o.send(j)}catch(u){console.error("PDF generation error:",u),o.status(500).json({error:"Failed to generate PDF"})}finally{m&&await m.close()}});let l=b.default.resolve(__dirname,"spa");return console.log("Serving SPA from:",l),n.use(y.default.static(l)),n.get(/.*/,(i,o)=>{o.sendFile(b.default.join(l,"index.html"))}),new Promise(i=>{let o=n.listen(t,()=>{console.log(`\u{1F680} Database Studio running at http://localhost:${t}`),i(o)}),s=async()=>{console.log(`
|
|
31
|
-
\u{1F6D1} Shutting down...`),o.close(async()=>{try{r&&(await r.close(),console.log("\u{1F50C} Database connection closed"))}catch(m){console.error("Error closing database connection:",m)}finally{process.exit(0)}})};process.once("SIGINT",s),process.once("SIGTERM",s)})}function se(){let e=E.default.networkInterfaces(),t=Object.values(e).flat().find(a=>a&&!a.internal&&a.mac!=="00:00:00:00:00:00")?.mac;return V.default.createHash("sha256").update(t||E.default.hostname()).digest("hex")}function O(e){try{if(e==="FREE123")return{plan:"free"};let t=G.default.verify(e,W,{algorithms:["RS256"],issuer:"database-studio-license",audience:"database-studio-app"}),a=se();return t.machineId!==a?!1:t}catch{return!1}}});var T=h(require("dotenv"),1),D=h(require("path"),1);T.default.config({path:D.default.join(process.cwd(),".env")});async function ie(){try{let e=await Promise.resolve().then(()=>h(M(),1));e.startServer||(console.error("\u274C startServer export not found"),process.exit(1));let t=process.env.
|
|
31
|
+
\u{1F6D1} Shutting down...`),o.close(async()=>{try{r&&(await r.close(),console.log("\u{1F50C} Database connection closed"))}catch(m){console.error("Error closing database connection:",m)}finally{process.exit(0)}})};process.once("SIGINT",s),process.once("SIGTERM",s)})}function se(){let e=E.default.networkInterfaces(),t=Object.values(e).flat().find(a=>a&&!a.internal&&a.mac!=="00:00:00:00:00:00")?.mac;return V.default.createHash("sha256").update(t||E.default.hostname()).digest("hex")}function O(e){try{if(e==="FREE123")return{plan:"free"};let t=G.default.verify(e,W,{algorithms:["RS256"],issuer:"database-studio-license",audience:"database-studio-app"}),a=se();return t.machineId!==a?!1:t}catch{return!1}}});var T=h(require("dotenv"),1),D=h(require("path"),1);T.default.config({path:D.default.join(process.cwd(),".env")});async function ie(){try{let e=await Promise.resolve().then(()=>h(M(),1));e.startServer||(console.error("\u274C startServer export not found"),process.exit(1));let t=process.env.STUDIO_PORT||"5555";await e.startServer({port:t});let a=`http://localhost:${t}`,n=(await import("open")).default;await n(a)}catch(e){console.error("\u274C Failed to start Database Studio"),console.error(e),process.exit(1)}}ie();
|
|
@@ -58,4 +58,4 @@ Error generating stack: `+g.message+`
|
|
|
58
58
|
|
|
59
59
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
60
60
|
|
|
61
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},YO="DialogDescriptionWarning",GO=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zb(YO).contentName}}.`;return w.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},XO=Rb,qO=Nb,ZO=jb,Ub=Mb,$b=Db,Wb=Lb,Hb=Ib,JO=Vb;const eL=XO,tL=qO,nL=ZO,Kb=w.forwardRef(({className:e,...t},r)=>x.jsx(Ub,{ref:r,className:xe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Kb.displayName=Ub.displayName;const Qb=w.forwardRef(({className:e,children:t,...r},s)=>x.jsxs(nL,{children:[x.jsx(Kb,{}),x.jsxs($b,{ref:s,className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,x.jsxs(JO,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[x.jsx(lf,{className:"h-4 w-4"}),x.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Qb.displayName=$b.displayName;const Yb=({className:e,...t})=>x.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Yb.displayName="DialogHeader";const Gb=w.forwardRef(({className:e,...t},r)=>x.jsx(Wb,{ref:r,className:xe("text-lg font-semibold leading-none tracking-tight",e),...t}));Gb.displayName=Wb.displayName;const Xb=w.forwardRef(({className:e,...t},r)=>x.jsx(Hb,{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));Xb.displayName=Hb.displayName;var rL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oL=rL.reduce((e,t)=>{const r=pb(`Primitive.${t}`),s=w.forwardRef((a,l)=>{const{asChild:c,...d}=a,h=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),sL="Separator",gv="horizontal",iL=["horizontal","vertical"],qb=w.forwardRef((e,t)=>{const{decorative:r,orientation:s=gv,...a}=e,l=aL(s)?s:gv,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return x.jsx(oL.div,{"data-orientation":l,...d,...a,ref:t})});qb.displayName=sL;function aL(e){return iL.includes(e)}var Zb=qb;const lh=w.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},a)=>x.jsx(Zb,{ref:a,decorative:r,orientation:t,className:xe("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));lh.displayName=Zb.displayName;function lL(){return x.jsxs(eL,{children:[x.jsx(tL,{asChild:!0,children:x.jsxs(oh,{variant:"outline",className:"gap-2",children:[x.jsx(fd,{className:"w-4 h-4"}),"Documentation"]})}),x.jsxs(Qb,{className:"max-w-2xl h-[80vh] flex flex-col p-0",children:[x.jsxs(Yb,{className:"p-6 pb-2 border-b border-border",children:[x.jsxs(Gb,{className:"text-2xl flex items-center gap-2",children:[x.jsx(fd,{className:"w-6 h-6 text-primary"}),"Database Studio Guide"]}),x.jsx(Xb,{children:"Learn how to set up and use Database Studio for your development environment."})]}),x.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6",children:x.jsxs("div",{className:"space-y-8 pb-4",children:[x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Xv,{className:"w-5 h-5 text-emerald-500"}),"Prerequisites"]}),x.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed",children:["Database Studio supports ",x.jsx("strong",{children:"MySQL"})," and ",x.jsx("strong",{children:"MongoDB"}),". Ensure your database server is running and you have the connection credentials."]})]}),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(qv,{className:"w-5 h-5 text-blue-500"}),"Environment Setup"]}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs("p",{className:"text-sm text-muted-foreground",children:["Create a ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:".env"})," file in your project root with ",x.jsx("strong",{children:"one"})," of the following:"]}),x.jsxs("div",{className:"bg-slate-950 p-4 rounded-lg font-mono text-xs text-slate-300 space-y-2 border border-slate-800 shadow-inner",children:[x.jsxs("div",{children:[x.jsx("span",{className:"text-purple-400",children:"# For MySQL"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MYSQL_URL"}),"=mysql://user:password@localhost:3306/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# For MongoDB"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MONGODB_URL"}),"=mongodb://user:password@localhost:27017/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# Optional: Server port (defaults to 5555)"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"PORT"}),"=5555"]})]})]})]}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(af,{className:"w-5 h-5 text-indigo-500"}),"Features"]}),x.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Data Explorer"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Browse and paginate through your database tables or collections."})]}),x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Canvas View"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Visualize your schema as interactive, draggable table cards."})]}),x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Schema Viewer"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect table structures, column types, and inferred MongoDB schemas."})]}),x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Export to PDF"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate professional documentation of your schema."})]})]})]}),x.jsx(lh,{}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Yv,{className:"w-5 h-5 text-muted-foreground"}),"Troubleshooting"]}),x.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"If you encounter connection errors, verify that your database server is running and the connection URL is correctly formatted. Ensure no firewall is blocking the specified port."})]})]})})]})]})}const uL=new lk,cL=()=>{const[e,t]=w.useState(!1),[r,s]=w.useState(""),[a,l]=w.useState(!1),[c,d]=w.useState(!0),[h,p]=w.useState(null),[m,y]=w.useState(!0);w.useEffect(()=>{Promise.all([fetch("/api/status").then(v=>v.json()),fetch("/api/database",{credentials:"include"})]).then(([v,P])=>{d(v.configured),P.status===401?l(!1):l(!0)}).finally(()=>y(!1))},[]);const b=async()=>{const v=r.trim();if(!v){p("Please enter a license key");return}t(!0),p(null);try{const S=await(await fetch("/api/validate-license",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseKey:v})})).json();S.success?(l(!0),window.location.reload()):p(S.message||"Invalid License Key. Please check and try again.")}catch(P){console.error("Validation error:",P),p("Failed to validate license.")}finally{t(!1)}};return c?a?x.jsx(uN,{children:x.jsxs(iN,{children:[x.jsx(Rd,{path:"/",element:x.jsx(_D,{})}),x.jsx(Rd,{path:"*",element:x.jsx(ID,{})})]})}):x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:x.jsxs("div",{className:"w-full max-w-md space-y-6 text-center",children:[x.jsx("div",{className:"inline-flex p-4 rounded-full bg-primary/10 text-primary mb-2",children:x.jsx(Gv,{className:"w-8 h-8"})}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"API Key Required"}),x.jsx("p",{className:"text-muted-foreground text-sm",children:"Please enter your license key to access the Database Studio. Use FREE123"})]}),x.jsxs("div",{className:"space-y-4",children:[x.jsxs("div",{className:"flex gap-2",children:[x.jsx(fb,{type:"password",placeholder:"Enter License Key",value:r,onChange:v=>{s(v.target.value),p(null)},onKeyDown:v=>v.key==="Enter"&&!e&&b(),disabled:e}),x.jsx(oh,{onClick:b,disabled:e,children:e?"Validating...":"Connect"})]}),x.jsx("div",{className:"flex justify-center pt-2",children:x.jsx(lL,{})}),h&&x.jsx("p",{className:"text-destructive text-sm font-medium animate-in fade-in slide-in-from-top-1",children:h})]})]})}):x.jsx("div",{className:"min-h-screen bg-background",children:x.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-16 space-y-10",children:[x.jsxs("div",{className:"text-center space-y-3",children:[x.jsx("div",{className:"inline-flex p-4 rounded-full bg-orange-500/10 text-orange-500 mb-2",children:x.jsx(af,{className:"w-8 h-8"})}),x.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Database Not Configured"}),x.jsxs("p",{className:"text-muted-foreground max-w-md mx-auto",children:["No database connection URL found in your ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono text-sm",children:".env"})," file. Add either ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono text-sm",children:"MYSQL_URL"})," or ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono text-sm",children:"MONGODB_URL"})," to get started."]})]}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Xv,{className:"w-5 h-5 text-emerald-500"}),"Prerequisites"]}),x.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed",children:["Database Studio supports ",x.jsx("strong",{children:"MySQL"})," and ",x.jsx("strong",{children:"MongoDB"}),". Ensure your database server is running and you have the connection credentials."]})]}),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(qv,{className:"w-5 h-5 text-blue-500"}),"Environment Setup"]}),x.jsxs("p",{className:"text-sm text-muted-foreground",children:["Create a ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:".env"})," file in the root of your project with ",x.jsx("strong",{children:"one"})," of the following:"]}),x.jsxs("div",{className:"bg-slate-950 p-4 rounded-lg font-mono text-xs text-slate-300 space-y-2 border border-slate-800 shadow-inner",children:[x.jsxs("div",{children:[x.jsx("span",{className:"text-purple-400",children:"# For MySQL"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MYSQL_URL"}),"=mysql://user:password@localhost:3306/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# For MongoDB"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MONGODB_URL"}),"=mongodb://user:password@localhost:27017/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# Optional: Server port (defaults to 5555)"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"PORT"}),"=5555"]})]})]}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(fd,{className:"w-5 h-5 text-indigo-500"}),"Next Steps"]}),x.jsxs("ol",{className:"text-sm text-muted-foreground leading-relaxed list-decimal list-inside space-y-2",children:[x.jsxs("li",{children:["Add ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:"MYSQL_URL"})," or ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:"MONGODB_URL"})," to your ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:".env"})," file"]}),x.jsx("li",{children:"Restart Database Studio"}),x.jsx("li",{children:"Enter your license key to connect"})]})]}),x.jsx(lh,{}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Yv,{className:"w-5 h-5 text-muted-foreground"}),"Troubleshooting"]}),x.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"If you encounter connection errors, verify that your database server is running and the connection URL is correctly formatted. Ensure no firewall is blocking the specified port."})]})]})})},dL=()=>x.jsx(ck,{client:uL,children:x.jsxs(IR,{children:[x.jsx(CP,{}),x.jsx(rT,{}),x.jsx(cL,{})]})});PP.createRoot(document.getElementById("root")).render(x.jsx(dL,{}));
|
|
61
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},YO="DialogDescriptionWarning",GO=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zb(YO).contentName}}.`;return w.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},XO=Rb,qO=Nb,ZO=jb,Ub=Mb,$b=Db,Wb=Lb,Hb=Ib,JO=Vb;const eL=XO,tL=qO,nL=ZO,Kb=w.forwardRef(({className:e,...t},r)=>x.jsx(Ub,{ref:r,className:xe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Kb.displayName=Ub.displayName;const Qb=w.forwardRef(({className:e,children:t,...r},s)=>x.jsxs(nL,{children:[x.jsx(Kb,{}),x.jsxs($b,{ref:s,className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,x.jsxs(JO,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[x.jsx(lf,{className:"h-4 w-4"}),x.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Qb.displayName=$b.displayName;const Yb=({className:e,...t})=>x.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Yb.displayName="DialogHeader";const Gb=w.forwardRef(({className:e,...t},r)=>x.jsx(Wb,{ref:r,className:xe("text-lg font-semibold leading-none tracking-tight",e),...t}));Gb.displayName=Wb.displayName;const Xb=w.forwardRef(({className:e,...t},r)=>x.jsx(Hb,{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));Xb.displayName=Hb.displayName;var rL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oL=rL.reduce((e,t)=>{const r=pb(`Primitive.${t}`),s=w.forwardRef((a,l)=>{const{asChild:c,...d}=a,h=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),sL="Separator",gv="horizontal",iL=["horizontal","vertical"],qb=w.forwardRef((e,t)=>{const{decorative:r,orientation:s=gv,...a}=e,l=aL(s)?s:gv,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return x.jsx(oL.div,{"data-orientation":l,...d,...a,ref:t})});qb.displayName=sL;function aL(e){return iL.includes(e)}var Zb=qb;const lh=w.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},a)=>x.jsx(Zb,{ref:a,decorative:r,orientation:t,className:xe("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));lh.displayName=Zb.displayName;function lL(){return x.jsxs(eL,{children:[x.jsx(tL,{asChild:!0,children:x.jsxs(oh,{variant:"outline",className:"gap-2",children:[x.jsx(fd,{className:"w-4 h-4"}),"Documentation"]})}),x.jsxs(Qb,{className:"max-w-2xl h-[80vh] flex flex-col p-0",children:[x.jsxs(Yb,{className:"p-6 pb-2 border-b border-border",children:[x.jsxs(Gb,{className:"text-2xl flex items-center gap-2",children:[x.jsx(fd,{className:"w-6 h-6 text-primary"}),"Database Studio Guide"]}),x.jsx(Xb,{children:"Learn how to set up and use Database Studio for your development environment."})]}),x.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6",children:x.jsxs("div",{className:"space-y-8 pb-4",children:[x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Xv,{className:"w-5 h-5 text-emerald-500"}),"Prerequisites"]}),x.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed",children:["Database Studio supports ",x.jsx("strong",{children:"MySQL"})," and"," ",x.jsx("strong",{children:"MongoDB"}),". Ensure your database server is running and you have the connection credentials."]})]}),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(qv,{className:"w-5 h-5 text-blue-500"}),"Environment Setup"]}),x.jsxs("div",{className:"space-y-2",children:[x.jsxs("p",{className:"text-sm text-muted-foreground",children:["Create a"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:".env"})," ","file in your project root with ",x.jsx("strong",{children:"one"})," of the following:"]}),x.jsxs("div",{className:"bg-slate-950 p-4 rounded-lg font-mono text-xs text-slate-300 space-y-2 border border-slate-800 shadow-inner",children:[x.jsxs("div",{children:[x.jsx("span",{className:"text-purple-400",children:"# For MySQL"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MYSQL_URL"}),"=mysql://user:password@localhost:3306/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# For MongoDB"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MONGODB_URL"}),"=mongodb://user:password@localhost:27017/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# Optional: Server port (defaults to 5555)"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"STUDIO_PORT"}),"=5555"]})]})]})]}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(af,{className:"w-5 h-5 text-indigo-500"}),"Features"]}),x.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Data Explorer"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Browse and paginate through your database tables or collections."})]}),x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Canvas View"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Visualize your schema as interactive, draggable table cards."})]}),x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Schema Viewer"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect table structures, column types, and inferred MongoDB schemas."})]}),x.jsxs("div",{className:"p-3 border border-border rounded-lg bg-secondary/10",children:[x.jsx("h4",{className:"font-medium text-sm mb-1",children:"Export to PDF"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate professional documentation of your schema."})]})]})]}),x.jsx(lh,{}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Yv,{className:"w-5 h-5 text-muted-foreground"}),"Troubleshooting"]}),x.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"If you encounter connection errors, verify that your database server is running and the connection URL is correctly formatted. Ensure no firewall is blocking the specified port."})]})]})})]})]})}const uL=new lk,cL=()=>{const[e,t]=w.useState(!1),[r,s]=w.useState(""),[a,l]=w.useState(!1),[c,d]=w.useState(!0),[h,p]=w.useState(null),[m,y]=w.useState(!0);w.useEffect(()=>{Promise.all([fetch("/api/status").then(v=>v.json()),fetch("/api/database",{credentials:"include"})]).then(([v,P])=>{d(v.configured),P.status===401?l(!1):l(!0)}).finally(()=>y(!1))},[]);const b=async()=>{const v=r.trim();if(!v){p("Please enter a license key");return}t(!0),p(null);try{const S=await(await fetch("/api/validate-license",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({licenseKey:v})})).json();S.success?(l(!0),window.location.reload()):p(S.message||"Invalid License Key. Please check and try again.")}catch(P){console.error("Validation error:",P),p("Failed to validate license.")}finally{t(!1)}};return c?a?x.jsx(uN,{children:x.jsxs(iN,{children:[x.jsx(Rd,{path:"/",element:x.jsx(_D,{})}),x.jsx(Rd,{path:"*",element:x.jsx(ID,{})})]})}):x.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:x.jsxs("div",{className:"w-full max-w-md space-y-6 text-center",children:[x.jsx("div",{className:"inline-flex p-4 rounded-full bg-primary/10 text-primary mb-2",children:x.jsx(Gv,{className:"w-8 h-8"})}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"API Key Required"}),x.jsx("p",{className:"text-muted-foreground text-sm",children:"Please enter your license key to access the Database Studio. Use FREE123"})]}),x.jsxs("div",{className:"space-y-4",children:[x.jsxs("div",{className:"flex gap-2",children:[x.jsx(fb,{type:"password",placeholder:"Enter License Key",value:r,onChange:v=>{s(v.target.value),p(null)},onKeyDown:v=>v.key==="Enter"&&!e&&b(),disabled:e}),x.jsx(oh,{onClick:b,disabled:e,children:e?"Validating...":"Connect"})]}),x.jsx("div",{className:"flex justify-center pt-2",children:x.jsx(lL,{})}),h&&x.jsx("p",{className:"text-destructive text-sm font-medium animate-in fade-in slide-in-from-top-1",children:h})]})]})}):x.jsx("div",{className:"min-h-screen bg-background",children:x.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-16 space-y-10",children:[x.jsxs("div",{className:"text-center space-y-3",children:[x.jsx("div",{className:"inline-flex p-4 rounded-full bg-orange-500/10 text-orange-500 mb-2",children:x.jsx(af,{className:"w-8 h-8"})}),x.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Database Not Configured"}),x.jsxs("p",{className:"text-muted-foreground max-w-md mx-auto",children:["No database connection URL found in your"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono text-sm",children:".env"})," ","file. Add either"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono text-sm",children:"MYSQL_URL"})," ","or"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono text-sm",children:"MONGODB_URL"})," ","to get started."]})]}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Xv,{className:"w-5 h-5 text-emerald-500"}),"Prerequisites"]}),x.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed",children:["Database Studio supports ",x.jsx("strong",{children:"MySQL"})," and"," ",x.jsx("strong",{children:"MongoDB"}),". Ensure your database server is running and you have the connection credentials."]})]}),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(qv,{className:"w-5 h-5 text-blue-500"}),"Environment Setup"]}),x.jsxs("p",{className:"text-sm text-muted-foreground",children:["Create a"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:".env"})," ","file in the root of your project with ",x.jsx("strong",{children:"one"})," of the following:"]}),x.jsxs("div",{className:"bg-slate-950 p-4 rounded-lg font-mono text-xs text-slate-300 space-y-2 border border-slate-800 shadow-inner",children:[x.jsxs("div",{children:[x.jsx("span",{className:"text-purple-400",children:"# For MySQL"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MYSQL_URL"}),"=mysql://user:password@localhost:3306/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# For MongoDB"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"MONGODB_URL"}),"=mongodb://user:password@localhost:27017/database_name"]}),x.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[x.jsx("span",{className:"text-purple-400",children:"# Optional: Server port (defaults to 5555)"}),x.jsx("br",{}),x.jsx("span",{className:"text-emerald-400",children:"STUDIO_PORT"}),"=5555"]})]})]}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(fd,{className:"w-5 h-5 text-indigo-500"}),"Next Steps"]}),x.jsxs("ol",{className:"text-sm text-muted-foreground leading-relaxed list-decimal list-inside space-y-2",children:[x.jsxs("li",{children:["Add"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:"MYSQL_URL"})," ","or"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:"MONGODB_URL"})," ","to your"," ",x.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-foreground font-mono",children:".env"})," ","file"]}),x.jsx("li",{children:"Restart Database Studio"}),x.jsx("li",{children:"Enter your license key to connect"})]})]}),x.jsx(lh,{}),x.jsxs("section",{className:"space-y-3",children:[x.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[x.jsx(Yv,{className:"w-5 h-5 text-muted-foreground"}),"Troubleshooting"]}),x.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"If you encounter connection errors, verify that your database server is running and the connection URL is correctly formatted. Ensure no firewall is blocking the specified port."})]})]})})},dL=()=>x.jsx(ck,{client:uL,children:x.jsxs(IR,{children:[x.jsx(CP,{}),x.jsx(rT,{}),x.jsx(cL,{})]})});PP.createRoot(document.getElementById("root")).render(x.jsx(dL,{}));
|
package/dist/spa/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Database Studio - Modern MySQL Viewer & Schema Explorer</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-2kcBcrF0.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-DnM_HvVq.css">
|
|
9
9
|
</head>
|
|
10
10
|
|