1 line
2.0 KiB
JavaScript
1 line
2.0 KiB
JavaScript
"use strict";(()=>{var e={};e.id=7317,e.ids=[7317],e.modules={39383:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/actions/users/user-auth")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},86254:(e,t,r)=>{r.r(t),r.d(t,{config:()=>P,default:()=>f,routeModule:()=>A});var n={};r.r(n),r.d(n,{default:()=>p});var a=r(89947),i=r(2706),o=r(96762),s=r(29021),u=r.n(s),d=r(33873),l=r.n(d),c=r(69842);async function p(e,t){if("GET"!==e.method)return t.json({msg:"Failed!"});let r=await (0,c.A)(e,t,!0);if(!r)return t.json({success:!1,msg:"Unauthorized"});let{dbName:n}=e.query;try{let e=l().resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${r.id}/main.json`);if(!u().existsSync(e))return t.end();let a=JSON.parse(u().readFileSync(e,"utf-8")).find(e=>e.dbFullName==n);if(!a)throw Error("Database not found!");let i=l().resolve(process.cwd(),"./.tmp/_tmp.json");u().writeFileSync(i,JSON.stringify(a),"utf-8");let o=u().createReadStream(i);o.pipe(t),o.on("close",()=>{u().unlinkSync(i)})}catch(e){return console.log(e),t.end()}}let f=(0,o.M)(n,"default"),P=(0,o.M)(n,"config"),A=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/downloadDatabaseSchema",pathname:"/api/downloadDatabaseSchema",bundlePath:"",filename:""},userland:n})},69842:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(39383),a=r.n(n);async function i(e,t,r){return a()({req:e,level:r?"deep":void 0}).payload}},2706:(e,t)=>{Object.defineProperty(t,"A",{enumerable:!0,get:function(){return r}});var r=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,t,r)=>{e.exports=r(75600)}};var t=require("../../webpack-api-runtime.js");t.C(e);var r=t(t.s=86254);module.exports=r})(); |