UNPKG

lambdaorm

Version:
1 lines 8.74 kB
'use strict';const a132o=a132y;(function(s,y){const i=a132y,g=s();while(!![]){try{const x=-parseInt(i(0x1ea))/0x1+parseInt(i(0x1ab))/0x2*(-parseInt(i(0x1e0))/0x3)+parseInt(i(0x1f0))/0x4*(parseInt(i(0x1d0))/0x5)+-parseInt(i(0x1e8))/0x6*(-parseInt(i(0x1e5))/0x7)+parseInt(i(0x1aa))/0x8+parseInt(i(0x1e1))/0x9*(parseInt(i(0x1cd))/0xa)+parseInt(i(0x1c7))/0xb*(-parseInt(i(0x1f6))/0xc);if(x===y)break;else g['push'](g['shift']());}catch(m){g['push'](g['shift']());}}}(a132s,0x235f9));function a132s(){const s8=['required','languages','throw','name','solveUniqueKeys','ddlBuilder','foreignKeys','getInstance','builder','StageFetch','174053fudUac','propertyName','tableName','table','solveIndexes','uniqueKeys','10Xlrsoc','primaryKey','primaryKeys','220710xsbMyI','type','refTableName','includes','map','uniqueKey','indexName','then','options','filter','lambdaorm-base','oneToMany','solveSequences','completeEntities','executor','splice','342834vPHHKY','1113030xVnqqI','autoIncrement','source','find','57911SNFGPT','defineProperty','sequences','84mBbLOE','dialect','59240ruPhJk','schemaState','mapping','push','solvePrimaryKeys','sourceObjects','24tQVfmK','view','equalName','getDialect','indexOf','solveRelations','180zqbyXW','__awaiter','constraintName','execute','sources','sequenceName','next','value','1325488urkhcW','4WXDWid','stage','indexes','tables','support','relations','objects','entityName','views','replace','__esModule','columnName','properties','helper','RelationType','done','entities','length'];a132s=function(){return s8;};return a132s();}var __awaiter=this&&this[a132o(0x1f7)]||function(s,y,P,g){function x(m){return m instanceof P?m:new P(function(w){w(m);});}return new(P||(P=Promise))(function(m,w){const j=a132y;function t(c){const p=a132y;try{a(g[p(0x1fc)](c));}catch(k){w(k);}}function v(c){const f=a132y;try{a(g[f(0x1bf)](c));}catch(k){w(k);}}function a(c){const q=a132y;c[q(0x1ba)]?m(c[q(0x1a9)]):x(c[q(0x1a9)])[q(0x1d7)](t,v);}a((g=g['apply'](s,y||[]))[j(0x1fc)]());});};Object[a132o(0x1e6)](exports,a132o(0x1b5),{'value':!![]}),exports[a132o(0x1c6)]=void 0x0;function a132y(s,y){const O=a132s();return a132y=function(D,g){D=D-0x1a9;let M=O[D];return M;},a132y(s,y);}const lambdaorm_base_1=require(a132o(0x1da));class StageFetch{constructor(s,y,g,x,m){const b=a132o;this[b(0x1de)]=s,this[b(0x1eb)]=y,this['languages']=g,this['helper']=x,this[b(0x1d8)]=m;}[a132o(0x1f9)](){return __awaiter(this,void 0x0,void 0x0,function*(){const l=a132y,s=this[l(0x1d8)][l(0x1ac)],y=this['schemaState']['stage']['get'](s),g=[];for(const x of y[l(0x1fa)]){const m=this[l(0x1eb)][l(0x1e3)]['get'](x['name']);let w=g[l(0x1e4)](t=>this['helper']['equalName'](t[l(0x1c0)],m[l(0x1ec)]));w===undefined&&(w={'name':m['mapping'],'entities':[]},g['push'](w));if(w[l(0x1bb)]===undefined)w[l(0x1bb)]=[];yield this['source'](m,w['entities']);}return g;});}[a132o(0x1e3)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const u=a132y,g=yield this[u(0x1ef)](s),x=g['filter'](w=>w[u(0x1d1)]===u(0x1ca))[u(0x1d4)](w=>w[u(0x1c0)]),m=g[u(0x1d9)](w=>w['type']===u(0x1f1))[u(0x1d4)](w=>w[u(0x1c0)]);x[u(0x1bc)]>0x0&&(yield this[u(0x1bb)](s,x,y)),m['length']>0x0&&(yield this['views'](s,m,y));});}[a132o(0x1ef)](s){return __awaiter(this,void 0x0,void 0x0,function*(){const e=a132y,y=this[e(0x1c5)](s)[e(0x1b1)]();return yield this['executor'][e(0x1f9)](y,{},this[e(0x1d8)]);});}['entities'](s,y,g){return __awaiter(this,void 0x0,void 0x0,function*(){const n=a132y,x=this[n(0x1be)][n(0x1f3)](s[n(0x1e9)]),m=this[n(0x1c5)](s)[n(0x1ae)](y),w=yield this[n(0x1de)][n(0x1f9)](m,{},this[n(0x1d8)]);this['completeEntities'](s,w,g);const t=g[n(0x1d9)](v=>!v[n(0x1f1)]&&v['mapping']!==undefined&&!y[n(0x1d3)](v[n(0x1ec)]));for(const v of t){const a=g[n(0x1f4)](v);g[n(0x1df)](a,0x1);}yield this[n(0x1ee)](s,y,g),yield this[n(0x1c1)](s,y,g),yield this[n(0x1cb)](s,y,g),yield this[n(0x1f5)](s,y,g),x[n(0x1af)](n(0x1e7))&&(yield this[n(0x1dc)](x,s,g));});}[a132o(0x1b3)](s,y,g){return __awaiter(this,void 0x0,void 0x0,function*(){const h=a132y,x=this[h(0x1c5)](s)[h(0x1b3)](y),m=yield this['executor']['execute'](x,{},this[h(0x1d8)]);this['completeEntities'](s,m,g);const w=g[h(0x1d9)](t=>t['view']&&t[h(0x1ec)]!==undefined&&!y[h(0x1d3)](t[h(0x1ec)]));for(const t of w){const v=g[h(0x1f4)](t);g['splice'](v,0x1);}});}[a132o(0x1dd)](s,y,g){const s0=a132o;var x,m;const w=this[s0(0x1be)][s0(0x1f3)](s[s0(0x1e9)]),t={};for(const v of y){t[v[s0(0x1c9)]]===undefined&&(t[v[s0(0x1c9)]]=[]);t[v[s0(0x1c9)]][s0(0x1ed)](v['columnName']);let a=g[s0(0x1e4)](z=>this[s0(0x1b8)][s0(0x1f2)](z['mapping'],v[s0(0x1c9)]));a===undefined&&(a={'name':this[s0(0x1b8)][s0(0x1b2)](v[s0(0x1c9)]),'mapping':v[s0(0x1c9)],'properties':[]},g[s0(0x1ed)](a));let c=(x=a['properties'])===null||x===void 0x0?void 0x0:x[s0(0x1e4)](z=>this[s0(0x1b8)]['equalName'](z[s0(0x1ec)],v['columnName']));const k=w['type'](v['dbType']),r=v[s0(0x1bc)]&&v['length']!==0x50?v[s0(0x1bc)]:undefined;c===undefined?(c={'name':this[s0(0x1b8)][s0(0x1c8)](v[s0(0x1b6)]),'mapping':v[s0(0x1b6)],'type':k,'required':v['required']?!![]:undefined,'autoIncrement':v[s0(0x1e2)]?!![]:undefined,'length':r},(m=a[s0(0x1b7)])===null||m===void 0x0?void 0x0:m[s0(0x1ed)](c)):(c[s0(0x1bd)]=v[s0(0x1bd)]?!![]:undefined,c[s0(0x1e2)]=v[s0(0x1e2)]?!![]:undefined,c['length']=r,c['type']=k);}}[a132o(0x1ee)](s,y,g){return __awaiter(this,void 0x0,void 0x0,function*(){const s1=a132y;var x;const m=this[s1(0x1c5)](s)[s1(0x1cf)](y),w=yield this[s1(0x1de)][s1(0x1f9)](m,{},this[s1(0x1d8)]);for(const t of w){const v=g['find'](a=>this[s1(0x1b8)][s1(0x1f2)](a[s1(0x1ec)],t[s1(0x1c9)]));if(v){const a=(x=v['properties'])===null||x===void 0x0?void 0x0:x[s1(0x1e4)](c=>this['helper']['equalName'](c[s1(0x1ec)],t['columnName']));if(a){if(v['primaryKey']===undefined)v[s1(0x1ce)]=[];v[s1(0x1ce)]['push'](this[s1(0x1b8)]['propertyName'](t[s1(0x1b6)])),a[s1(0x1ce)]=!![];}}}});}[a132o(0x1c1)](s,y,g){return __awaiter(this,void 0x0,void 0x0,function*(){const s2=a132y;var x;const m=this['builder'](s)[s2(0x1cc)](y),w=yield this['executor'][s2(0x1f9)](m,{},this[s2(0x1d8)]);for(const t of w){const v=g['find'](a=>this[s2(0x1b8)][s2(0x1f2)](a[s2(0x1ec)],t[s2(0x1c9)]));if(v){const a=(x=v['properties'])===null||x===void 0x0?void 0x0:x[s2(0x1e4)](c=>this['helper'][s2(0x1f2)](c[s2(0x1ec)],t[s2(0x1b6)]));if(a){if(v[s2(0x1d5)]===undefined)v[s2(0x1d5)]=[];v[s2(0x1d5)][s2(0x1ed)](this[s2(0x1b8)][s2(0x1c8)](t[s2(0x1b6)]));}}}});}[a132o(0x1cb)](s,y,g){return __awaiter(this,void 0x0,void 0x0,function*(){const s3=a132y;var x;const m=this[s3(0x1c5)](s)[s3(0x1ad)](y),w=yield this[s3(0x1de)][s3(0x1f9)](m,{},this[s3(0x1d8)]);for(const t of w){const v=g[s3(0x1e4)](a=>this['helper'][s3(0x1f2)](a[s3(0x1ec)],t[s3(0x1c9)]));if(v){const a=(x=v[s3(0x1b7)])===null||x===void 0x0?void 0x0:x[s3(0x1e4)](c=>this['helper'][s3(0x1f2)](c[s3(0x1ec)],t['columnName']));if(a){if(v[s3(0x1ad)]===undefined)v[s3(0x1ad)]=[];const c=v['indexes']['find'](k=>this[s3(0x1b8)]['equalName'](k[s3(0x1c0)],t[s3(0x1d6)]));c?c['fields'][s3(0x1ed)](this['helper'][s3(0x1c8)](t['columnName'])):v['indexes'][s3(0x1ed)]({'name':this['helper'][s3(0x1d6)](t[s3(0x1d6)]),'fields':[this[s3(0x1b8)][s3(0x1c8)](t[s3(0x1b6)])]});}}}});}[a132o(0x1dc)](s,y,g){return __awaiter(this,void 0x0,void 0x0,function*(){const s4=a132y,x=this[s4(0x1c5)](y)[s4(0x1e7)](),m=yield this['executor'][s4(0x1f9)](x,{},this[s4(0x1d8)]);for(const w of m){const t=g[s4(0x1e4)](v=>{const s5=s4;var a;return v[s5(0x1ec)]&&this[s5(0x1b8)]['equalName']((a=s['other']('sequenceName'))===null||a===void 0x0?void 0x0:a[s5(0x1b4)]('{name}',v[s5(0x1ec)]),w['sequenceName']);});t&&(t['sequence']=w[s4(0x1fb)]);}});}['solveRelations'](s,y,g){return __awaiter(this,void 0x0,void 0x0,function*(){const s6=a132y;var x,m;const w=this['builder'](s)[s6(0x1c3)](y),t=yield this[s6(0x1de)][s6(0x1f9)](w,{},this['options']);for(const v of t){const a=g[s6(0x1e4)](k=>k[s6(0x1ec)]===v[s6(0x1c9)]),c=g['find'](k=>this[s6(0x1b8)][s6(0x1f2)](k[s6(0x1ec)],v[s6(0x1d2)]));if(a&&c){const k=(x=a[s6(0x1b7)])===null||x===void 0x0?void 0x0:x[s6(0x1e4)](z=>this[s6(0x1b8)][s6(0x1f2)](z['mapping'],v[s6(0x1b6)])),r=(m=c===null||c===void 0x0?void 0x0:c['properties'])===null||m===void 0x0?void 0x0:m[s6(0x1e4)](z=>this[s6(0x1b8)][s6(0x1f2)](z[s6(0x1ec)],v['refColumnName']));if(k&&r){if(a['relations']===undefined)a[s6(0x1b0)]=[];const z=this[s6(0x1b8)]['relationName'](v[s6(0x1f8)]['split']('_')[0x1]),d={'name':z,'from':k[s6(0x1c0)],'entity':c[s6(0x1c0)],'to':r[s6(0x1c0)],'type':lambdaorm_base_1[s6(0x1b9)][s6(0x1db)]};a[s6(0x1b0)][s6(0x1ed)](d);}}}});}[a132o(0x1c5)](s){const s7=a132o,y=this[s7(0x1be)]['getByDialect'](s['dialect']),g=this['schemaState'][s7(0x1ec)][s7(0x1c4)](s['mapping']);return y[s7(0x1c2)](s,g);}}exports['StageFetch']=StageFetch;