"use strict";exports.id=8540,exports.ids=[8540],exports.modules={77619:(e,t,r)=>{leta=r(29021),l=r(72835);e.exports=({key:e,database:t,table:r,user_id:n})=>{if(!e||!n)returnnull;try{lets=process.env.DSQL_API_KEYS_PATH;if(!s)throwError("process.env.DSQL_API_KEYS_PATH variable not found");leti=l({encryptedString:e}),o=JSON.parse(i||""),u=a.existsSync(`${s}/${o.sign}`);if(String(o.user_id)!==String(n)||!u)returnnull;if(!o.target_database)returno;if(!t&&o.target_database)returnnull;letc=o.target_database?.split(",").includes(String(t));if(c&&!o.target_table)returno;if(c&&!r&&o.target_table)returnnull;if(o.target_table?.split(",").includes(String(r)))returno;returnnull}catch(e){returnconsole.log(`api-cred ERROR: ${e.message}`),null}}},64122:(e,t,r)=>{leta=r(51348),l=r(21339),n=r(44900);asyncfunctions({dbContext:e,paradigm:t,dbFullName:r,tableName:s,identifierColumnName:i,identifierValue:o,useLocal:u}){try{letc=!!u||!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),d=u?n:c?a:l,p=`DELETE FROM ${s} WHERE \`${i}\`=?`;returnc?awaitd(p,[o]):awaitd({paradigm:t,queryString:p,database:r,queryValues:[o]})}catch(e){returnnull}}e.exports=s},8238:(e,t,r)=>{r(29021),r(44900);leta=r(94709),l=r(96064),n=r(48225),s=r(47670),i=r(33364),o=r(64122);r(6061);letu=r(33872);asyncfunctionc({dbFullName:e,query:t,readOnly:r,dbSchema:c,queryValuesArray:d,tableName:p,local:m}){letg,f,y;if(c)try{lete=p||("string"==typeoft?null:t?t?.table:null);if(!e)throwError("No table name provided");y=c.tables.filter(t=>t?.tableName===e)[0]}catch(e){}try{if("string"==typeoft){letn=u(t);if(r&&n.match(/^alter|^delete|information_schema|^create/i))throwError("Wrong Input!");g=r?awaitl({queryString:n,queryValuesArray:d?.map(e=>String(e)),database:e,tableSchema:y,useLocal:m}):awaita({queryString:n,queryValuesArray:d?.map(e=>String(e)),database:e,tableSchema:y,local:m})}elseif("object"==typeoft){let{data:r,action:a,table:l,identifierColumnName:n,identifierValue:u,update:c,duplicateColumnName:d,duplicateColumnValue:p}=t;switch(a.toLowerCase()){case"insert":g=awaits({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,data:r,update:c,duplicateColumnName:d,duplicateColumnValue:p,tableSchema:y,useLocal:m}),g?.insertId||(f=Error("Couldn't insert data"));break;case"update":g=awaiti({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,data:r,identifierColumnName:n,identifierValue:u,tableSchema:y,useLocal:m});break;case"delete":g=awaito({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,identifierColumnName:n,identifierValue:u,tableSchema:y,useLocal:m});break;default:g=null}}}catch(e){n({component:"functions/backend/runQuery",message:e.message}),g=null,e=e.message}return{result:g,error:f}}e.exports=c},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},94709:(e,t,r)=>{leta=r(21339),l=r(44900),n=r(6061),s=r(48225);e.exports=asyncfunction({queryString:e,database:t,tableSchema:r,queryValuesArray:i,local:o}){letu;try{u=o?awaitl(e,i):awaita({paradigm:"Full Access",database:t,queryString:e,queryValues:i})}catch(e){returns({component:"fullAccessDbHandler",message:e.message}),e.message}if(u&&r){lete=u;returnawaitn({unparsedResults:e,tableSchema:r})}returnu||null}},6061:(e,t,r)=>{leta=r(72835),l=r(30003);e.exports=asyncfunction({unparsedResults:e,tableSchema:t}){letr=[];try{for(letn=0;n<e.length;n++){lets=e[n],i=Object.keys(s);for(lete=0;e<i.length;e++){letr=i[e],n=t?.fields[e];if(r?.match(l))continue;leto=s[r];("number"==typeofo||o)&&n?.encrypted&&o?.match(/./)&&(s[r]=a({encryptedString:o}))}r.push(s)}returnr}catch(t){returnconsole.log("ERROR in parseDbResults Function =>",t.message),e}}},48225:(e,t,r)=>{leta=r(29021),{IncomingMessage:l}=r(81630);e.exports=asyncfunction({user:e,message:t,component:r,noMail:l,req:n}){lets=newDate,i=(()=>{if(!n)returnnull;try{lete=n.headers["x-forwarded-for"],t=n.headers["x-real-ip"],r=n.headers[