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

1 line
7.1 KiB
JavaScript
Raw Normal View History

2025-01-14 06:42:13 +00:00
"use strict";exports.id=1251,exports.ids=[1251],exports.modules={96762:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,n){return n in t?t[n]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,n)):"function"==typeof t&&"default"===n?t:void 0}}})},98e3:(e,t,n)=>{n.d(t,{A:()=>d});var r=n(72583),a=n.n(r),o=n(92652),s=n(30802),c=n(48786),i=n(37275),l=n(68829),u=n(7971);async function d({dbContext:e,paradigm:t,dbFullName:n,tableName:r,data:d,tableSchema:p,duplicateColumnName:_,duplicateColumnValue:f,update:g,encryptionKey:h,encryptionSalt:y,useLocal:S}){let E=!!S||!e?.match(/dsql.user/i)&&(!n||!!n.match(/^datasquirel$/)),m=S?u.A:E?c.A:i.A;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 a=E?await m(`SELECT * FROM \`${r}\` WHERE \`${_}\`=?`,[f]):await m({paradigm:"Read Only",queryString:`SELECT * FROM \`${n}\`.\`${r}\` WHERE \`${_}\`=?`,queryValues:[f]});if(a?.[0]&&!g)return null;if(a&&a[0]&&g)return await (0,s.A)({dbContext:e,paradigm:t,dbFullName:n,tableName:r,data:d,tableSchema:p,encryptionKey:h,encryptionSalt:y,identifierColumnName:_,identifierValue:f||""})}let A=Object.keys(d),D=[],N=[];for(let e=0;e<A.length;e++)try{let t=A[e],n=d?.[t],r=p?p?.fields?.filter(e=>e.fieldName==t):null,s=r&&r[0]?r[0]:null;if(null==n||void 0==n||s?.dataType?.match(/int$/i)&&"string"==typeof n&&!n?.match(/./))continue;s?.encrypted&&(n=(0,l.A)({data:n,encryptionKey:h,encryptionSalt:y}),console.log("DSQL: Encrypted value =>",n));let c=/<[^>]+>/g;(s?.richText||String(n).match(c))&&(n=a()(n,o.A)),s?.pattern&&!new RegExp(s.pattern,s.patternFlags||"").test(n)&&(console.log("DSQL: Pattern not matched =>",n),n=""),D.push("`"+t+"`"),"object"==typeof n&&(n=JSON.stringify(n)),"number"==typeof n?N.push(String(n)):N.push(n)}catch(e){console.log("DSQL: Error in parsing data keys =>",e.message);continue}d?.date_created||(D.push("`date_created`"),N.push(Date())),d?.date_created_code||(D.push("`date_created_code`"),N.push(Date.now())),d?.date_updated||(D.push("`date_updated`"),N.push(Date())),d?.date_updated_code||(D.push("`date_updated_code`"),N.push(Date.now()));let L=`INSERT INTO \`${n}\`.\`${r}\` (${D.join(",")}) VALUES (${N.map(()=>"?").join(",")})`;return E?await m(L,N):await m({paradigm:t,queryString:L,queryValues:N})}},30802:(e,t,n)=>{n.d(t,{A:()=>u});var r=n(72583),a=n.n(r),o=n(92652),s=n(48786),c=n(37275),i=n(68829),l=n(7971);async function u({dbContext:e,paradigm:t,dbFullName:n,tableName:r,data:u,tableSchema:d,identifierColumnName:p,identifierValue:_,encryptionKey:f,encryptionSalt:g,useLocal:h}){if(!u||!Object.keys(u).length)return null;let y=!!h||!e?.match(/dsql.user/i)&&(!n||!!n.match(/^datasquirel$/)),S=h?l.A:y?s.A:c.A,E=Object.keys(u),m=[],A=[];for(let e=0;e<E.length;e++)try{let t=E[e],n=u[t],r=d?d?.fields?.filter(e=>e.fieldName===t):null,s=r&&r[0]?r[0]:null;if(null==n||void 0==n)continue;let c=/<[^>]+>/g;(s?.richText||String(n).match(c))&&(n=a()(n,o.A)),s?.encrypted&&(n=(0,i.A)({data:n,encryptionKey:f,encryptionSalt:g})),"object"==typeof n&&(n=JSON.stringify(n)),s?.pattern&&!new RegExp(s.pattern,s.patternFlags||"").test(n)&&(console.log("DSQL: Pattern not matched =>",n),n=""),"string"==typeof n&&n.match(/^null$/i)&&(n={toSqlString:function(){return"NULL"}}),"string"!=typeof n||n.match(/./i)||(n={toSqlString:function(){return"NULL"}}),m.push(`\`${t}\`=?`),"number"==typeof n?A.push(String(n)):A.push(n)}catch(e){console.log("DSQL: Error in parsing data keys in update function =>",e.message);continue}m.push(`date_updated='${Date()}'`),m.push(`date_updated_code='${Date.now()}'`);let D=`UPDATE \`${n}\`.\`${r}\` SET ${m.join(",")} WHERE \`${p}\`=?`;return A.push(_),y?await S(D,A):await S({paradigm:t,queryString:D,queryValues:A})}},92652:(e,t,n)=>{n.d(t,{A:()=>r});let r={allowedTags:["b","i","em","strong","a","p","span","ul","ol","li","h1","h2",