"use strict";(()=>{var e={};e.id=2500,e.ids=[2500],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},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}}})},72387:(e,t,r)=>{r.r(t),r.d(t,{config:()=>d,default:()=>c,routeModule:()=>f});var n={};r.r(n),r.d(n,{default:()=>u});var a=r(89947),o=r(2706),i=r(96762),s=r(30802),l=r(69842);async function u(e,t){if("POST"!==e.method)return t.json({msg:"Failed!"});if(!await (0,l.A)(e,t,!0))return t.json({success:!1,msg:"Unauthorized"});let{user_type:r}=e.body,n=(()=>{let t=Object.keys(e.body),n={};return t.forEach(t=>{!(r?.match(/database/)&&t?.match(/user_type|priviledge|database_access|databases?|confirm/))&&(t?.match(/databases|confirm/)||(n[t]=e.body[t]))}),n})(),a=await (0,s.A)({dbFullName:"datasquirel",tableName:"user_users",identifierColumnName:"id",identifierValue:e.body.id,data:{...n}});t.json({success:!!a?.affectedRows,msg:a?.affectedRows?"User Updated":a})}let c=(0,i.M)(n,"default"),d=(0,i.M)(n,"config"),f=new a.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/updateUserUser",pathname:"/api/updateUserUser",bundlePath:"",filename:""},userland:n})},69842:(e,t,r)=>{async function n(e,t,r){return Object(function(){var e=Error("Cannot find module '@moduletrace/datasquirel/dist/users/user-auth'");throw e.code="MODULE_NOT_FOUND",e}())({req:e,level:r?"deep":void 0}).payload}r.d(t,{A:()=>n}),function(){var e=Error("Cannot find module '@moduletrace/datasquirel/dist/users/user-auth'");throw e.code="MODULE_NOT_FOUND",e}()},30802:(e,t,r)=>{r.d(t,{A:()=>u});var n=r(72583),a=r.n(n),o=r(92652),i=r(68829),s=r(52939),l=r(64292);async function u({dbContext:e,dbFullName:t,tableName:r,data:n,tableSchema:u,identifierColumnName:c,identifierValue:d,encryptionKey:f,encryptionSalt:p}){if(!n||!Object.keys(n).length)return null;let g=(0,s.A)({dbContext:e,dbFullName:t}),h=g?global.DSQL_DB_CONN:global.DSQL_FULL_ACCESS_DB_CONN||global.DSQL_DB_CONN;g?global.DSQL_DB_CONN:global.DSQL_READ_ONLY_DB_CONN||global.DSQL_DB_CONN;let y=Object.keys(n),_=[],m=[];for(let e=0;ee.fieldName===t):null,l=s&&s[0]?s[0]:null;if(null==r||void 0==r)continue;let c=/<[^>]+>/g;(l?.richText||String(r).match(c))&&(r=a()(r,o.A)),l?.encrypted&&(r=(0,i.A)({data:r,encryptionKey:f,encryptionSalt:p})),"object"==typeof r&&(r=JSON.stringify(r)),l?.pattern&&!new RegExp(l.pattern,l.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),"string"==typeof r&&r.match(/^null$/i)&&(r={toSqlString:function(){return"NULL"}}),"string"!=typeof r||r.match(/./i)||(r={toSqlString:function(){return"NULL"}}),_.push(`\`${t}\`=?`),"number"==typeof r?m.push(String(r)):m.push(r)}catch(e){console.log("DSQL: Error in parsing data keys in update function =>",e.message);continue}_.push(`date_updated='${Date()}'`),_.push(`date_updated_code='${Date.now()}'`);let N=`UPDATE ${g?"":`\`${t}\`.`}\`${r}\` SET ${_.join(",")} WHERE \`${c}\`=?`;return m.push(d),await (0,l.A)(h,N,m)}},92652:(e,t,r)=>{r.d(t,{A:()=>n});let n={allowedTags:["b","i","em","strong","a","p","span","ul","ol","li","h1","h2","h3","h4","h5","h6","img","div","button","pre","code","br"],allowedAttributes:{a:["href"],img:["src","alt","width","height","class","style"],"*":["style","class"]}}},68829:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(55511),a=r(79428),o=r(32443);function i({data:e,encryptionKey:t,encryptionSalt:r}){if(!e?.match(/./))return console.log("Encryption string is invalid"),e;let{key:i,salt:s,keyLen:l,algorithm:u,bufferAllocSize:c}=(0,o.A)({encryptionKey:t});if(!i?.match(/.{8,}/))return console.log("Encryption key is invalid"),e;if(!s?.match(/.{8,}/))return console.log("Encryption salt is invalid"),e;let d=(0,n.scryptSync)(i,s,l),f=a.Buffer.alloc(c,0),p=(0,n.createCipheriv)(u,d,f);try{let t=p.update(e,"utf8","hex");return t+=p.final("hex")}catch(t){return console.log("Error in encrypting =>",t.message),e}}},52939:(e,t,r)=>{r.d(t,{A:()=>n});function n({dbContext:e,dbFullName:t}){return!e?.match(/dsql.user/i)&&(!!global.DSQL_USE_LOCAL||!t||!!t.match(/^datasquirel$/))}},64292:(e,t,r)=>{async function n(e,t,r){try{if(!e)throw Error("No Connection Found!");if(!t)throw Error("Query String Required!");if("string"==typeof t){let n=await e.query(a(t),r);return JSON.parse(JSON.stringify(n))}if("object"!=typeof t)return null;{let r=[];for(let n=0;nn})},32443:(e,t,r)=>{r.d(t,{A:()=>n});function n(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?function(e,t){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},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=72387);module.exports=r})();