"use strict";(()=>{vare={};e.id=1658,e.ids=[1658],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){returnfunctione(r,s){returnsinr?r[s]:"then"inr&&"function"==typeofr.then?r.then(r=>e(r,s)):"function"==typeofr&&"default"===s?r:void0}}})},43390:(e,r,s)=>{s.r(r),s.d(r,{config:()=>m,default:()=>D,routeModule:()=>y});vart={};s.r(t),s.d(t,{default:()=>g});varn=s(89947),a=s(2706),o=s(96762),i=s(64122),l=s.n(i),c=s(73677),u=s.n(c),d=s(39831),_=s.n(d),p=s(48225),S=s.n(p),E=s(6420),f=s.n(E);asyncfunctiong(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lets=awaitf()(e,r,!0);if(!s)returnr.json({success:!1,msg:"Unauthorized"});let{dbFullName:t,tableName:n,entryId:a,dbSlug:o,dbId:i,delegated:c}=e.body;try{letc=await_()({databaseSlug:o,request:e,user:s,query:e.query});if(!awaitu()({user:s,confirmedDelegetedUser:c,database:o,table:n,dbId:i,priviledgeRegex:/Delete Entries/i}))returnr.json({success:!1,msg:"Unauthorized"});awaitl()({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:t,tableName:n,identifierColumnName:"id",identifierValue:a}),r.json({success:!0})}catch(e){S()({component:"/api/deleteTableEntry/main-catch-error",message:e.message,user:s}),r.json({success:!1,msg:"Deletion Failed!"})}}letD=(0,o.M)(t,"default"),m=(0,o.M)(t,"config"),y=newn.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteTableEntry",pathname:"/api/deleteTableEntry",bundlePath:"",filename:""},userland:t})},73677:(e,r,s)=>{lett=s(51348),n=s(48225);e.exports=asyncfunction({user:e,confirmedDelegetedUser:r,database:s,table:a,priviledgeRegex:o,dbId:i}){letl,c;try{r?.delegated?(l=awaitt("SELECT priviledge FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=? AND `table`=?",[r.rootUserId,e.id,s,a]),c=l[0]?.priviledge?.match(o)):(l=awaitt("SELECT table_slug FROM user_database_tables WHERE user_id=? AND table_slug=? AND db_id=?",[e.id,a,i]),c=!0)}catch(r){n({component:"checkUserRights",message:r.message,user:e})}return!!l&&!!l[0]&&!!c}},39831:(e,r,s)=>{s(81630);lett=s(72835);e.exports=asyncfunction({request:e,databaseSlug:r,user:s,query:n}){try{leta=s.id,o=null;if(!n?.delegated)return{dbUserId:a};leti=n.dbUserId,l=`${process.env.DSQL_USER_DB_PREFIX}${i}_${r}`,c=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${l}`;try{if(!e.cookies?.[c])throwError("Cookie not present");lets=t({encryptedString:e.cookies[c]});if(!s)throwError("Invalid Token");if((o=JSON.parse(s)).databaseSlug===r)return{dbUserId:a=o.rootUserId,rootUserId:o.rootUserId,rootUserName:o.rootUserName,rootUserEmail:o.rootUserEmail,rootUserImage:o.rootUserImage,databaseFullName:o.databaseFullName,databaseSlug:o.databaseSlug,allowedTables:o.allowedTables,priviledges:o.priviledges,database:o.databaseSlug,delegated:!0}}catch(e){}return{dbUserId:a}}catch(e){returnnull}}},6420:(e,r,s)=>{s(81630);lett=s(51348),n=s(72835),a=s(29021),o=s(31341);asyncfunctioni(e,r,s,i){let{keyCookieName:l,csrfCookieName:c}=o();if(!e.cookies?.[l]?.match(/./))returnnull;letu=n({encryptedString:e.cookies[l]});if(!u)returnnull;letd=JSON.parse(u);if(!d.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))returnnull;let_=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(s&&!a.existsSync(`${_}/${d.csrf_k}`))returnnull;if(0==d.verification_status&&!s){lete=awaitt(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnd?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COO