${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},20048:(e,t,r)=>{r(81630);let s=r(67216),a=r(83007),i=r(29021);async function n(e,t,r,n){if(!e.cookies?.datasquirelAuthKey?.match(/./))return null;let o=a(e.cookies.datasquirelAuthKey);if(!o)return null;let l=JSON.parse(o);if(!l.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${l.csrf_k}`)))return null;let u=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!u)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!i.existsSync(`${u}/${l.csrf_k}`))return null;if(0==l.verification_status&&!r){let e=await s(`SELECTverification_statusFROMusersWHEREid='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}return l?.date&&Date.now()-l.date>6048e5?null:l}e.exports=n},43290:(e,t,r)=>{let s=r(81339),a=r(72583),i=r(67942);r(19760);let n=r(19760);r(27825);let o=r(67216),l=r(1231);async function u({dbContext:e,paradigm:t,dbFullName:r,tableName:u,data:c,tableSchema:d,duplicateColumnName:p,duplicateColumnValue:m,update:_,encryptionKey:g,encryptionSalt:f}){let h=!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),x=h?o:l;if(c?.date_created_timestamp&&delete c.date_created_timestamp,c?.date_updated_timestamp&&delete c.date_updated_timestamp,c?.date_updated&&delete c.date_updated,c?.date_updated_code&&delete c.date_updated_code,c?.date_created&&delete c.date_created,c?.date_created_code&&delete c.date_created_code,p&&"string"==typeof p){let s=h?await x(`SELECT*FROM\`${u}\` WHERE \`${p}\`=?`,[m]):awaitx({paradigm:"Read Only",database:r,queryString:`SELECT * FROM \`${u}\` WHERE \`${p}\`=?`,queryValues:[m]});if(s?.[0]&&!_)returnnull;if(s&&s[0]&&_)returnawaitn({dbContext:e,paradigm:t,dbFullName:r,tableName:u,data:c,tableSchema:d,encryptionKey:g,encryptionSalt:f,identifierColumnName:p,identifierValue:m||""})}letS=Object.keys(c),y=[],E=[];for(lete=0;e<S.length;e++)try{lett=S[e],r=c?.[t],n=d?d?.fields?.filter(e=>e.fieldName==t):null,o=n&&n[0]?n[0]:null;if(null==r||void0==r||o?.dataType?.match(/int$/i)&&"string"==typeofr&&!r?.match(/./))continue;o?.encrypted&&(r=s(r,g,f),console.log("DSQL: Encrypted value =>",r)),o?.richText&&(r=a(r,i)),o?.pattern&&!newRegExp(o.pattern,o.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),y.push("`"+t+"`"),"object"==typeofr&&(r=JSON.stringify(r)),"number"==typeofr?E.push(String(r)):E.push(r)}catch(e){console.log("DSQL: Error in parsing data keys =>",e.message);continue}c?.date_created||(y.push("`date_created`"),E.push(Date())),c?.date_created_code||(y.push("`date_created_code`"),E.push(Date.now())),c?.date_updated||(y.push("`date_updated`"),E.push(Date())),c?.date_updated_code||(y.push("`date_updated_code`"),E.push(Date.now()));letv=`INSERT INTO \`${u}\` (${y.join(",")}) VALUES (${E.map(()=>"?").join(",")})`;returnh?awaitx(v,E):awaitx({paradigm:t,database:r,queryString:v,queryValues:E})}e.exports=u},19760:(e,t,r)=>{lets=r(81339),a=r(72583),i=r(67942),n=r(67216),o=r(1231);asyncfunctionl({dbContext:e,paradigm:t,dbFullName:r,tableName:l,data:u,tableSchema:c,identifierColumnName:d,identifierValue:p,encryptionKey:m,encryptionSalt:_}){if(!u||!Object.keys(u).length)returnnull;letg=!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),f=g?n:o,h=Object.keys(u),x=[],S=[];for(lete=0;e<h.length;e++)try{lett=h[e],r=u[t],n=c?c?.fields?.filter(e=>e.fieldName===t):null,o=n&&n[0]?n[0]:null;if(null==r||void0==r)continue;o?.richText&&(r=a(r,i)),o?.encrypted&&(r=s(r,m,_)),"object"==typeofr&&(r=JSON.stringify(r)),o?.pattern&&!newRegExp(o.pattern,o.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),"string"==typeofr&&r.match(/^null$/i)&&(r={toSqlString:function(){return"NULL"}}),"string"!=typeofr||r.match(/./i)||(r={toSqlString:function(){return"NULL"}}),x.push(`\`${t}\`=?`),"number"==typeofr?S.push(String(r)):S.push(r)}catch(e){console.log("DSQL: Error in parsing data keys in update function =>",e.message);continue}x.push(`date_updated='${Date()}'`),x.push(`date_updated