dsql-admin/dsql-app/.local_dist/server/chunks/4050.js

1 line
7.4 KiB
JavaScript
Raw Normal View History

2024-12-09 12:27:08 +00:00
"use strict";exports.id=4050,exports.ids=[4050],exports.modules={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}}})},47670:(e,t,r)=>{let s=r(72583),n=r(16570);r(33364);let a=r(33364);r(27825);let o=r(51348),c=r(21339),i=r(20503),l=r(44900);async function u({dbContext:e,paradigm:t,dbFullName:r,tableName:u,data:d,tableSchema:p,duplicateColumnName:_,duplicateColumnValue:S,update:D,encryptionKey:f,encryptionSalt:g,useLocal:h}){let E=!!h||!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),y=h?l:E?o:c;if(d?.date_created_timestamp&&delete d.date_created_timestamp,d?.date_updated_timestamp&&delete d.date_updated_timestamp,d?.date_updated&&delete d.date_updated,d?.date_updated_code&&delete d.date_updated_code,d?.date_created&&delete d.date_created,d?.date_created_code&&delete d.date_created_code,_&&"string"==typeof _){let s=E?await y(`SELECT * FROM \`${u}\` WHERE \`${_}\`=?`,[S]):await y({paradigm:"Read Only",database:r,queryString:`SELECT * FROM \`${u}\` WHERE \`${_}\`=?`,queryValues:[S]});if(s?.[0]&&!D)return null;if(s&&s[0]&&D)return await a({dbContext:e,paradigm:t,dbFullName:r,tableName:u,data:d,tableSchema:p,encryptionKey:f,encryptionSalt:g,identifierColumnName:_,identifierValue:S||""})}let m=Object.keys(d),L=[],O=[];for(let e=0;e<m.length;e++)try{let t=m[e],r=d?.[t],a=p?p?.fields?.filter(e=>e.fieldName==t):null,o=a&&a[0]?a[0]:null;if(null==r||void 0==r||o?.dataType?.match(/int$/i)&&"string"==typeof r&&!r?.match(/./))continue;o?.encrypted&&(r=i({data:r,encryptionKey:f,encryptionSalt:g}),console.log("DSQL: Encrypted value =>",r)),o?.richText&&(r=s(r,n)),o?.pattern&&!new RegExp(o.pattern,o.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),L.push("`"+t+"`"),"object"==typeof r&&(r=JSON.stringify(r)),"number"==typeof r?O.push(String(r)):O.push(r)}catch(e){console.log("DSQL: Error in parsing data keys =>",e.message);continue}d?.date_created||(L.push("`date_created`"),O.push(Date())),d?.date_created_code||(L.push("`date_created_code`"),O.push(Date.now())),d?.date_updated||(L.push("`date_updated`"),O.push(Date())),d?.date_updated_code||(L.push("`date_updated_code`"),O.push(Date.now()));let A=`INSERT INTO \`${u}\` (${L.join(",")}) VALUES (${O.map(()=>"?").join(",")})`;return E?await y(A,O):await y({paradigm:t,database:r,queryString:A,queryValues:O})}e.exports=u},33364:(e,t,r)=>{let s=r(72583),n=r(16570),a=r(51348),o=r(21339),c=r(20503),i=r(44900);async function l({dbContext:e,paradigm:t,dbFullName:r,tableName:l,data:u,tableSchema:d,identifierColumnName:p,identifierValue:_,encryptionKey:S,encryptionSalt:D,useLocal:f}){if(!u||!Object.keys(u).length)return null;let g=!!f||!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),h=f?i:g?a:o,E=Object.keys(u),y=[],m=[];for(let e=0;e<E.length;e++)try{let t=E[e],r=u[t],a=d?d?.fields?.filter(e=>e.fieldName===t):null,o=a&&a[0]?a[0]:null;if(null==r||void 0==r)continue;o?.richText&&(r=s(r,n)),o?.encrypted&&(r=c({data:r,encryptionKey:S,encryptionSalt:D})),"object"==typeof r&&(r=JSON.stringify(r)),o?.pattern&&!new RegExp(o.pattern,o.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"}}),y.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}y.push(`date_updated='${Date()}'`),y.push(`date_updated_code='${Date.now()}'`);let L=`UPDATE ${l} SET ${y.join(",")} WHERE \`${p}\`=?`;return m.push(_),g?await h(L,m):await h({paradigm:t,database:r,queryString:L,queryValues:m})}e.exports=l},16570:e=>{e.exports={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","s