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

1 line
7.9 KiB
JavaScript
Raw Normal View History

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