UNPKG

lambdaorm

Version:
1 lines 20.6 kB
'use strict';function a13y(s,y){const O=a13s();return a13y=function(D,g){D=D-0x172;let M=O[D];return M;},a13y(s,y);}const a13N=a13y;(function(s,y){const f=a13y,g=s();while(!![]){try{const x=parseInt(f(0x212))/0x1+-parseInt(f(0x17c))/0x2+parseInt(f(0x1a1))/0x3*(parseInt(f(0x183))/0x4)+parseInt(f(0x1a4))/0x5*(-parseInt(f(0x1c9))/0x6)+-parseInt(f(0x1cb))/0x7+-parseInt(f(0x20e))/0x8+-parseInt(f(0x173))/0x9;if(x===y)break;else g['push'](g['shift']());}catch(m){g['push'](g['shift']());}}}(a13s,0xd78ca));var __awaiter=this&&this[a13N(0x1e7)]||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 b=a13y;function t(c){try{a(g['next'](c));}catch(k){w(k);}}function v(c){const q=a13y;try{a(g[q(0x1dd)](c));}catch(k){w(k);}}function a(c){const j=a13y;c[j(0x179)]?m(c['value']):x(c[j(0x1b4)])[j(0x191)](t,v);}a((g=g[b(0x17e)](s,y||[]))[b(0x1fe)]());});};Object[a13N(0x1c5)](exports,a13N(0x1f5),{'value':!![]}),exports[a13N(0x18a)]=exports['MongoDBConnectionPoolAdapter']=void 0x0;const connectionPool_1=require(a13N(0x215)),connection_1=require(a13N(0x1ce)),lambdaorm_base_1=require('lambdaorm-base'),typ3s_1=require(a13N(0x1e4));function a13s(){const sq=['dateTime','addPk','schema','isBoolean','insertedId','session','dropEntity','rollback','toArray','873504wsTJQC','sequence_value','uniqueKeys','collectionNames','1556297ERrCBl','update','sequences','./base/connectionPool','join','end','isNumber','EntityMapping\x20not\x20found\x20for\x20entity\x20','executeDDL','aggregate','delete_many','toString','deleteMany','__distinct','primaryKey','inTransaction','isDateTime','2600163SaeOrk','getNextSequenceValue','majority','__sequences','endSession','init','done','entity','_id','1937940inUwss','MethodNotImplemented','apply','indexes','time','entityMapping','find','2541704TRljAV','bulkUpdate','insertedIds','true','MongoDBConnectionPoolAdapter','cnx','createEntity','MongodbConnectionAdapter','bulkInsert','connect','parseTemplate','createIndex','transformParameter','insertMany','then','map','_id_','log','helper','getValue','name','views','updateMany','upsert','split','lib','ConnectionAdapter','key','uniqueKey','relations','6BmvOcv','connection','isList','55Urkjzl','getEntity','isTime','findOneAndUpdate','obj','drop','MongoClient','getInsertList','parameters','RelationType','primaryKeys','some','val','Method\x20not\x20implemented.','mapping','getInsertListInclude','value','null','includes','url','query','listIndexes','partitions','isObject','execute','mongodb','delete','type','MongodbConnection','writeDateTime','filter','objects','deleteOne','defineProperty','truncateEntity','properties','manyToOne','178482VPqUqY','sentence','1749839eyDfWa','getObject','any','./base/connection','getEntities','unique','push','required','getProperty','arrayToList','createCollection','EntityMapping\x20','close','replace','data','config','startSession','sequence','throw','false','bulkMerge','dropPk','equalName','local','client','typ3s','writeDate','string','__awaiter','relation','executeSentence','keys','str','SchemaError','addUk','DEFAULT_LENGTH','collection','\x20initialized','length','modifiedCount','primary','\x20not\x20found','__esModule','dataToParameters','writeTime','delimiter','insertOne','parse','getAnyValue','select','Type','next','object','getInsertListIncludes','composite','dropIndex','Primitive','connection\x20MongoDB:\x20'];a13s=function(){return sq;};return a13s();}class MongoDBConnectionPoolAdapter extends connectionPool_1['ConnectionPoolAdapter']{constructor(s,y){const l=a13N;super(s,y),!MongoDBConnectionPoolAdapter[l(0x19c)]&&(MongoDBConnectionPoolAdapter[l(0x19c)]=require(l(0x1bd)));}[a13N(0x178)](){return __awaiter(this,void 0x0,void 0x0,function*(){const u=a13y;yield this[u(0x195)]['logger'][u(0x194)](u(0x204)+this[u(0x1da)]['name']+u(0x1f0));});}['create'](s){return __awaiter(this,void 0x0,void 0x0,function*(){const e=a13y,y=yield MongoDBConnectionPoolAdapter[e(0x19c)][e(0x1aa)][e(0x18c)](this[e(0x1da)][e(0x1a2)][e(0x1b7)]),g=y['db'](this['config'][e(0x1a2)]['database']),x={'client':y,'db':g};return new MongodbConnectionAdapter(s,x,this,this[e(0x195)]);});}}exports[a13N(0x187)]=MongoDBConnectionPoolAdapter;class MongodbConnectionAdapter extends connection_1[a13N(0x19d)]{[a13N(0x217)](){return __awaiter(this,void 0x0,void 0x0,function*(){const n=a13y;this[n(0x188)][n(0x1e3)][n(0x1d7)]();});}['insertConditional'](s,y,g,x){const h=a13N;throw new Error(h(0x1b1));}[a13N(0x19a)](s,y,g,x){const s0=a13N;throw new Error(s0(0x1b1));}['merge'](s,y,g,x){const s1=a13N;throw new Error(s1(0x1b1));}[a13N(0x1df)](s,y,g,x){const s2=a13N;throw new Error(s2(0x1b1));}[a13N(0x1fc)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const s3=a13y,m=g[s3(0x17a)][s3(0x1b6)]('.')?g['entity'][s3(0x19b)]('.')[0x0]:g[s3(0x17a)],w=s[s3(0x181)](m),t=this[s3(0x1f6)](s,y,g,x),v=this[s3(0x18d)](s,y,g[s3(0x1ca)],t),a=yield this[s3(0x188)]['db'][s3(0x1ef)](w)[s3(0x21b)](v||[])[s3(0x20d)]();return a&&a[s3(0x1f1)]>0x0&&a[0x0]['__distinct']?a[s3(0x192)](c=>c[s3(0x21f)]):a;});}['insert'](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const s4=a13y;var m;const w=s[s4(0x1a5)](g[s4(0x17a)]);if(w===undefined)throw new lambdaorm_base_1[(s4(0x1ec))](s4(0x219)+g[s4(0x17a)]);const t=yield this[s4(0x1ab)](s,y,g,w,[x[s4(0x1d9)]]),v=t[0x0];if(w[s4(0x1dc)]&&w[s4(0x220)]&&w[s4(0x220)]['length']===0x1){const c=w[s4(0x220)][0x0],k=(m=w[s4(0x1c7)])===null||m===void 0x0?void 0x0:m[s4(0x182)](r=>r[s4(0x197)]===c);k&&(v[k[s4(0x1b2)]]=yield this[s4(0x174)](w['sequence']));}const a=this[s4(0x20a)]?yield this[s4(0x188)]['db'][s4(0x1ef)](w['mapping'])['insertOne'](v,this[s4(0x20a)]):yield this[s4(0x188)]['db'][s4(0x1ef)](w['mapping'])[s4(0x1f9)](v);return typeof a[s4(0x209)]===s4(0x1ff)?a[s4(0x209)][s4(0x21d)]():a['insertedId'];});}[a13N(0x18b)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const s5=a13y,m=s[s5(0x1a5)](g[s5(0x17a)]);if(m===undefined)throw new lambdaorm_base_1[(s5(0x1ec))](s5(0x1d6)+g[s5(0x17a)]+s5(0x1f4));const w=yield this[s5(0x1ab)](s,y,g,m,x),t=this[s5(0x20a)]?yield this[s5(0x188)]['db'][s5(0x1ef)](m['mapping'])[s5(0x190)](w,this[s5(0x20a)]):yield this[s5(0x188)]['db'][s5(0x1ef)](m['mapping'])[s5(0x190)](w),v=[];for(const a in t[s5(0x185)]){const c=t[s5(0x185)][a];v[s5(0x1d1)](typeof c===s5(0x1ff)?c[s5(0x21d)]():c);}return v;});}[a13N(0x1ab)](s,y,g,x,m){return __awaiter(this,void 0x0,void 0x0,function*(){const s6=a13y;var w;const t=this[s6(0x1d4)](s,y,g,g[s6(0x1ca)],m);if(x[s6(0x1dc)]&&x['primaryKey']&&x[s6(0x220)][s6(0x1f1)]===0x1){const v=x[s6(0x220)][0x0],a=(w=x[s6(0x1c7)])===null||w===void 0x0?void 0x0:w[s6(0x182)](c=>c['name']===v);if(a){const c=yield this['getNextSequenceValue'](x['sequence'],t[s6(0x1f1)]);for(let k=0x0;k<t[s6(0x1f1)];k++){t[k][a[s6(0x1b2)]]=c+k;}}}return yield this[s6(0x200)](s,y,g,m,t),t;});}[a13N(0x200)](s,y,g,x,m){return __awaiter(this,void 0x0,void 0x0,function*(){const s7=a13y;for(const w of g[s7(0x1b6)]){if(w['relation'][s7(0x201)]){const t=s[s7(0x1a5)](w[s7(0x1e8)][s7(0x17a)]);if(t===undefined)throw new lambdaorm_base_1[(s7(0x1ec))](s7(0x1d6)+w[s7(0x1e8)][s7(0x17a)]+s7(0x1f4));yield this['getInsertListInclude'](s,y,g,w,t,x,m);}}});}[a13N(0x1b3)](s,y,g,x,m,w,t){return __awaiter(this,void 0x0,void 0x0,function*(){const s8=a13y;if(m[s8(0x1b2)]===undefined)throw new lambdaorm_base_1['SchemaError'](s8(0x1d6)+x['relation'][s8(0x17a)]+s8(0x1f4));const v=y[s8(0x1f8)](m[s8(0x1b2)]);for(let a=0x0;a<w[s8(0x1f1)];a++){const c=w[a],k=t[a],r=c[x[s8(0x1e8)]['name']],z=s[s8(0x1d3)](g['entity'],x[s8(0x1e8)]['from']);if(x[s8(0x1e8)][s8(0x1bf)]===lambdaorm_base_1[s8(0x1ad)][s8(0x1c8)]||x[s8(0x1e8)][s8(0x1bf)]===lambdaorm_base_1[s8(0x1ad)]['oneToOne']&&!z[s8(0x1d2)])for(const d of r){const o=s[s8(0x1d3)](x[s8(0x1e8)][s8(0x17a)],x[s8(0x1e8)]['to']);d[o['name']]=k[z[s8(0x1b2)]];}if(x[s8(0x1e8)][s8(0x1bf)]===lambdaorm_base_1['RelationType'][s8(0x1c8)])k[v]=yield this['getInsertList'](s,y,x[s8(0x1b8)],m,r);else{const p=yield this['getInsertList'](s,y,x['query'],m,[r]);p&&p[s8(0x1f1)]>0x0&&(k[v]=p[0x0]);}}});}[a13N(0x213)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const s9=a13y,m=s[s9(0x181)](g[s9(0x17a)]),w=JSON[s9(0x1fa)](g[s9(0x1ca)]),t=this[s9(0x1f6)](s,y,g,x),v=this[s9(0x1cc)](s,y,g,x),a=this['parseTemplate'](s,y,w[s9(0x1c2)],t),c=this[s9(0x20a)]?yield this['cnx']['db']['collection'](m)['updateMany'](a,{'$set':v},this[s9(0x20a)]):yield this[s9(0x188)]['db'][s9(0x1ef)](m)[s9(0x199)](a,{'$set':v});return c['modifiedCount'];});}[a13N(0x184)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const ss=a13y;throw new lambdaorm_base_1['MethodNotImplemented'](ss(0x1c0),ss(0x184));});}[a13N(0x1cc)](s,y,g,x){const sy=a13N,m=JSON[sy(0x1fa)](g['sentence']),w=this[sy(0x1f6)](s,y,g,x),t=this[sy(0x18d)](s,y,m['set'],w);for(const v of g[sy(0x1b6)]){const a=x['get'](v[sy(0x1e8)][sy(0x197)]);if(!a||!v[sy(0x1e8)]['composite'])continue;const c=s[sy(0x1a5)](v[sy(0x1e8)]['entity']);if(c===undefined)throw new lambdaorm_base_1['SchemaError']('EntityMapping\x20'+v['relation'][sy(0x17a)]+sy(0x1f4));if(c[sy(0x1b2)]===undefined)throw new lambdaorm_base_1['SchemaError']('EntityMapping\x20'+v[sy(0x1e8)]['entity']+'\x20not\x20found');const k=y[sy(0x1f8)](c[sy(0x1b2)]);if(v['relation'][sy(0x1bf)]===lambdaorm_base_1[sy(0x1ad)][sy(0x1c8)]){const r=[];for(const z of a){const d=new lambdaorm_base_1['Data'](z,x),i=this[sy(0x1cc)](s,y,v[sy(0x1b8)],d);r[sy(0x1d1)](i);}t[k]=r;}else{const o=new lambdaorm_base_1['Data'](a,x),p=this[sy(0x1cc)](s,y,v['query'],o);t[k]=p;}}return t;}[a13N(0x1be)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const sO=a13y,m=s[sO(0x181)](g[sO(0x17a)]),w=JSON[sO(0x1fa)](g[sO(0x1ca)]),t=this[sO(0x1f6)](s,y,g,x),v=this[sO(0x18d)](s,y,w[sO(0x1c2)],t),a=this[sO(0x20a)]?yield this['cnx']['db'][sO(0x1ef)](m)[sO(0x21e)](v,this['session']):yield this[sO(0x188)]['db'][sO(0x1ef)](m)['deleteMany'](v);return a[sO(0x1f2)];});}[a13N(0x1bc)](s){return __awaiter(this,void 0x0,void 0x0,function*(){const sD=a13y;throw new lambdaorm_base_1[(sD(0x17d))](sD(0x1c0),sD(0x1bc));});}['executeSentence'](s){return __awaiter(this,void 0x0,void 0x0,function*(){const sg=a13y;throw new lambdaorm_base_1['MethodNotImplemented'](sg(0x1c0),sg(0x1e9));});}[a13N(0x21a)](s){return __awaiter(this,void 0x0,void 0x0,function*(){const sM=a13y;throw new lambdaorm_base_1[(sM(0x17d))]('MongodbConnection','executeDDL');});}['beginTransaction'](){return __awaiter(this,void 0x0,void 0x0,function*(){const sE=a13y;this[sE(0x20a)]=this[sE(0x188)]['client'][sE(0x1db)]();const s={'readPreference':sE(0x1f3),'readConcern':{'level':sE(0x1e2)},'writeConcern':{'w':sE(0x175)}};yield this[sE(0x20a)]['startTransaction'](s),this[sE(0x221)]=!![];});}['commit'](){return __awaiter(this,void 0x0,void 0x0,function*(){const sx=a13y;yield this['session'][sx(0x177)](),this[sx(0x221)]=![],this['session']=null;});}[a13N(0x20c)](){return __awaiter(this,void 0x0,void 0x0,function*(){const sm=a13y;yield this['session']['abortTransaction'](),this[sm(0x221)]=![],this['session']=null;});}['arrayToList'](s,y,g,x,m){const sH=a13N,w=[];for(const t of m){let v;if(g[sH(0x1ac)]&&g['parameters'][sH(0x1f1)]>0x0)for(const c of g[sH(0x1ac)]){const k=this['helper']['query']['transformParameter'](c['name']),r=this[sH(0x195)][sH(0x1a8)][sH(0x196)](t,c[sH(0x197)]),z=this[sH(0x196)](s,y,r,c['type']?c[sH(0x1bf)]:typ3s_1[sH(0x203)][sH(0x1cd)]);v=this['helper'][sH(0x1eb)]['replace'](v||x,'\x22$'+k+'$\x22',z);}else v=x;const a=v?JSON['parse'](v):{};w[sH(0x1d1)](a);}return w;}[a13N(0x18d)](s,y,g,x){const sw=a13N;let m;const w={};if(x[sw(0x1f1)]&&x[sw(0x1f1)]>0x0)for(const t of x){const v=this[sw(0x195)][sw(0x1b8)][sw(0x18f)](t[sw(0x197)]),a=this[sw(0x196)](s,y,t[sw(0x1b4)],t['type']?t['type']:typ3s_1[sw(0x203)][sw(0x1cd)]);m=this[sw(0x195)][sw(0x1eb)][sw(0x1d8)](m||g,'\x22$'+v+'$\x22',a);}else m=g;return m&&typeof m===sw(0x1e6)?JSON[sw(0x1fa)](m):undefined;}[a13N(0x196)](s,y,g,x){const sI=a13N;let m;if(g===undefined||g===null)return sI(0x1b5);if(x===typ3s_1[sI(0x203)][sI(0x1cd)])return this[sI(0x1fb)](s,y,g);else{if(typ3s_1['Type'][sI(0x1a3)](x)){if(g[sI(0x1f1)]===0x0)return'';return typeof g[0x0]===sI(0x1e6)?g[sI(0x192)](w=>'\x22'+w+'\x22')[sI(0x216)](','):g[sI(0x216)](',');}else switch(x){case typ3s_1[sI(0x203)]['boolean']:return g?sI(0x186):sI(0x1de);case typ3s_1['Primitive']['string']:m=typeof g===sI(0x1e6)?g:g['toString'](),m=this[sI(0x195)][sI(0x1eb)][sI(0x1d8)](m,'\x0a','\x5cn'),m=this['helper'][sI(0x1eb)][sI(0x1d8)](m,'\x22','\x5c\x22');return'\x22'+m+'\x22';case typ3s_1[sI(0x203)][sI(0x205)]:return'\x22'+this[sI(0x1c1)](g,s,y)+'\x22';case typ3s_1['Primitive']['date']:return'\x22'+this[sI(0x1e5)](g,s,y)+'\x22';case typ3s_1[sI(0x203)][sI(0x180)]:return'\x22'+this['writeTime'](g,s,y)+'\x22';default:return typeof g===sI(0x1e6)?(m=this['helper'][sI(0x1eb)][sI(0x1d8)](g,'\x0a','\x5cn'),m=this['helper'][sI(0x1eb)][sI(0x1d8)](m,'\x22','\x5c\x22'),'\x22'+m+'\x22'):g;}}}[a13N(0x1fb)](s,y,g){const sF=a13N;if(g===undefined||g===null)return null;if(this['helper'][sF(0x1b0)]['isString'](g)){let x=this['helper'][sF(0x1eb)]['replace'](g,'\x0a','\x5cn');return x=this['helper'][sF(0x1eb)]['replace'](x,'\x22','\x5c\x22'),'\x22'+x+'\x22';}if(this[sF(0x195)][sF(0x1b0)][sF(0x218)](g))return g;if(this[sF(0x195)]['val'][sF(0x208)](g))return g?'true':sF(0x1de);if(this[sF(0x195)]['val'][sF(0x172)](g))return'\x22'+this[sF(0x1c1)](g,s,y)+'\x22';if(this[sF(0x195)][sF(0x1b0)]['isDate'](g))return'\x22'+this[sF(0x1e5)](g,s,y)+'\x22';if(this[sF(0x195)]['val'][sF(0x1a6)](g))return'\x22'+this[sF(0x1f7)](g,s,y)+'\x22';if(this[sF(0x195)][sF(0x1b0)][sF(0x1bb)](g))return g;if(this[sF(0x195)][sF(0x1b0)]['isArray'](g)){const m=[];for(const w of g){m[sF(0x1d1)](this['getAnyValue'](s,y,w));}return m;}return g;}[a13N(0x174)](s){return __awaiter(this,arguments,void 0x0,function*(y,g=0x1){const st=a13y,x=yield this[st(0x188)]['db'][st(0x1ef)]('__sequences')[st(0x1a7)]({'_id':y},{'$inc':{'sequence_value':g}},{'returnNewDocument':!![]});return x[st(0x20f)];});}[a13N(0x1c6)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sv=a13y,g=s[sv(0x181)](y[sv(0x17a)]);yield this[sv(0x188)]['db'][sv(0x1ef)](g)[sv(0x21c)]({});});}[a13N(0x189)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sR=a13y,g=s['entityMapping'](y['entity']);yield this['cnx']['db'][sR(0x1d5)](g);});}['createSequence'](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sY=a13y;yield this[sY(0x188)]['db'][sY(0x1ef)](sY(0x176))['insertOne'](JSON['parse'](y['sentence']));});}['createIndex'](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sa=a13y,g=s[sa(0x181)](y[sa(0x17a)]),x=JSON[sa(0x1fa)](y['sentence']);yield this[sa(0x188)]['db'][sa(0x1ef)](g)[sa(0x18e)](x[sa(0x1c7)],x['options']);});}[a13N(0x206)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sc=a13y;yield this[sc(0x18e)](s,y);});}[a13N(0x1ed)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){yield this['createIndex'](s,y);});}['dropSequence'](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sk=a13y,g=JSON[sk(0x1fa)](y[sk(0x1ca)]);yield this[sk(0x188)]['db']['collection'](sk(0x176))[sk(0x1c4)](g);});}[a13N(0x20b)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sC=a13y,g=s[sC(0x181)](y['entity']);yield this[sC(0x188)]['db'][sC(0x1ef)](g)[sC(0x1a9)]();});}[a13N(0x1e0)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sJ=a13y,g=s['entityMapping'](y[sJ(0x17a)]);yield this[sJ(0x188)]['db'][sJ(0x1ef)](g)[sJ(0x202)](y[sJ(0x1ca)]);});}['dropUk'](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sr=a13y,g=s[sr(0x181)](y['entity']);yield this[sr(0x188)]['db'][sr(0x1ef)](g)[sr(0x202)](y[sr(0x1ca)]);});}[a13N(0x202)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sz=a13y,g=s[sz(0x181)](y['entity']);yield this[sz(0x188)]['db'][sz(0x1ef)](g)[sz(0x202)](y[sz(0x1ca)]);});}[a13N(0x1c3)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const sA=a13y,m=[],w=yield this[sA(0x211)](),t=yield this[sA(0x1cf)](s,w);for(const v of t){m[sA(0x1d1)]({'type':'table','name':v[sA(0x197)],'tablespace':null});}return m;});}['tables'](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const sS=a13y,m=[],w=JSON['parse'](g[sS(0x1ca)]),t=yield this[sS(0x1cf)](s,w);for(const v of t){if(!v['properties'])continue;for(const a of v[sS(0x1c7)]){const c=a[sS(0x1bf)]||this[sS(0x195)][sS(0x207)]['DEFAULT_TYPE'],k=c==='string'&&!a[sS(0x1f1)]?this[sS(0x195)][sS(0x207)][sS(0x1ee)]:a[sS(0x1f1)];m[sS(0x1d1)]({'tableName':v[sS(0x197)],'tablespace':null,'columnName':a[sS(0x197)],'dbType':c,'required':a['required'],'autoIncrement':null,'length':k,'precision':null,'scale':null,'time':null});}}return m;});}[a13N(0x198)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){return[];});}[a13N(0x1ba)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const sT=a13y;throw new lambdaorm_base_1[(sT(0x17d))](sT(0x1c0),sT(0x1ba));});}[a13N(0x214)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const sd=a13y,m=[],w=yield this[sd(0x188)]['db'][sd(0x1ef)](sd(0x176))[sd(0x182)]()[sd(0x20d)]();for(const t of w){m[sd(0x1d1)]({'sequenceName':t[sd(0x17b)],'startValue':0x1,'increment':0x1});}return m;});}['foreignKeys'](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const sL=a13y,m=[],w=JSON['parse'](g[sL(0x1ca)]),t=yield this[sL(0x1cf)](s,w);for(const v of w){const a=t[sL(0x182)](c=>this[sL(0x195)][sL(0x207)][sL(0x1e1)](c['name'],v));if(!a||!a[sL(0x1a0)])continue;for(const c of a[sL(0x1a0)]){m['push']({'tableName':a[sL(0x197)],'columnName':c['from'],'constraintName':''+c[sL(0x17a)]+(c['to']['startsWith']('_')?c['to']:'_'+c['to']),'refTableName':c[sL(0x17a)],'refColumnName':c['to'],'composite':c[sL(0x201)],'type':c[sL(0x1bf)]});}}return m;});}[a13N(0x1ae)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const si=a13y,m=[],w=yield this[si(0x211)](),t=JSON[si(0x1fa)](g[si(0x1ca)]),v=yield this[si(0x1cf)](s,t);for(const a of t){if(!w['includes'](a))continue;const c=yield this['cnx']['db'][si(0x1ef)](a)[si(0x1b9)]()[si(0x20d)](),k=v[si(0x182)](r=>this[si(0x195)][si(0x207)]['equalName'](r['name'],a));if(!k||!k['primaryKey'])continue;for(const r of k['primaryKey']){c[si(0x1af)](z=>Object[si(0x1ea)](z[si(0x19e)])[si(0x1b6)](r))&&m[si(0x1d1)]({'tableName':k[si(0x197)],'columnName':r,'constraintName':null});}}return m;});}[a13N(0x210)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const so=a13y,m=[],w=yield this[so(0x211)](),t=JSON['parse'](g[so(0x1ca)]),v=yield this[so(0x1cf)](s,t);for(const a of t){if(!w[so(0x1b6)](a))continue;const c=yield this[so(0x188)]['db'][so(0x1ef)](a)['listIndexes']()[so(0x20d)](),k=v[so(0x182)](r=>this[so(0x195)][so(0x207)][so(0x1e1)](r[so(0x197)],a));if(!k||!k['uniqueKey'])continue;for(const r of k[so(0x19f)]){c['some'](z=>z[so(0x1d0)]&&Object[so(0x1ea)](z[so(0x19e)])[so(0x1b6)](r))&&m['push']({'tableName':k[so(0x197)],'columnName':r,'constraintName':null});}}return m;});}[a13N(0x17f)](s,y,g,x){return __awaiter(this,void 0x0,void 0x0,function*(){const sp=a13y;var m,w;const t=[],v=yield this['collectionNames'](),a=JSON[sp(0x1fa)](g[sp(0x1ca)]),c=yield this[sp(0x1cf)](s,a);for(const k of a){if(!v['includes'](k))continue;const r=yield this[sp(0x188)]['db'][sp(0x1ef)](k)['listIndexes']()['toArray'](),z=c[sp(0x182)](d=>this[sp(0x195)][sp(0x207)][sp(0x1e1)](d[sp(0x197)],k));for(const d of r){const i=Object['keys'](d[sp(0x19e)]);for(const o of i){if(!z||(((m=z[sp(0x220)])===null||m===void 0x0?void 0x0:m[sp(0x1b6)](o))||((w=z['uniqueKey'])===null||w===void 0x0?void 0x0:w[sp(0x1b6)](o))))continue;t[sp(0x1d1)]({'tableName':z[sp(0x197)],'indexName':d[sp(0x197)],'columnName':o,'isUnique':d[sp(0x1d0)]||d[sp(0x197)]===sp(0x193),'isPrimary':d[sp(0x197)]===sp(0x193)});}}}return t;});}[a13N(0x211)](){return __awaiter(this,void 0x0,void 0x0,function*(){const sf=a13y,s=yield this['cnx']['db']['listCollections']()[sf(0x20d)]();return s['filter'](y=>y['name']!==sf(0x176))[sf(0x192)](y=>y[sf(0x197)]);});}[a13N(0x1cf)](s,y){return __awaiter(this,void 0x0,void 0x0,function*(){const sN=a13y,g=new lambdaorm_base_1['CreateEntitiesService'](this[sN(0x195)]['schema']),x=[];for(const m of y){const w=s['entityMapping'](m);if(!w)continue;const t=yield this['cnx']['db'][sN(0x1ef)](w)[sN(0x182)]()[sN(0x20d)](),v=typ3s_1[sN(0x1fd)][sN(0x1bf)](t,{'info':!![],'describe':!![]}),a=g[sN(0x1cf)](m,v);x[sN(0x1d1)](...a);}return x;});}}exports[a13N(0x18a)]=MongodbConnectionAdapter;