UNPKG

@hotmeshio/hotmesh

Version:

Serverless Workflow

1 lines 10.2 kB
'use strict';const z=b;(function(c,d){const y=b,e=c();while(!![]){try{const f=-parseInt(y(0x1c6))/0x1*(-parseInt(y(0x18e))/0x2)+-parseInt(y(0x170))/0x3+-parseInt(y(0x1c1))/0x4*(-parseInt(y(0x19a))/0x5)+parseInt(y(0x18b))/0x6+parseInt(y(0x188))/0x7*(-parseInt(y(0x184))/0x8)+-parseInt(y(0x1b5))/0x9+parseInt(y(0x1db))/0xa;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x8de53));Object[z(0x187)](exports,z(0x1eb),{'value':!0x0}),exports['Deployer']=void 0x0;const key_1=require(z(0x1da)),utils_1=require(z(0x1be)),collator_1=require(z(0x1ca)),serializer_1=require(z(0x1c3)),pipe_1=require(z(0x1a5)),validator_1=require(z(0x1ec)),DEFAULT_METADATA_RANGE_SIZE=0x1a,DEFAULT_DATA_RANGE_SIZE=0x104,DEFAULT_RANGE_SIZE=0x11e;function b(c,d){const e=a();return b=function(f,g){f=f-0x16f;let h=e[f];return h;},b(c,d);}function a(){const a2=['generateSymVals','getVID','output','9868383CkWzTC','string','activities','length','deployConsumerGroups','generateSymKeys','collectValues','publishes','WORKER','../../modules/utils','enum','copyJobSchemas','1856uSzoBW','pow','../serializer','concat','maps','2931WXTcuh','default','deployConsumerGroup','isArray','../collator','deployHookPatterns','traverse','type','add','keys','entries','setHookRules','Pipe','sort','JOB','examples','activity','topic','input','hook','../../modules/key','14682360RJOPxe','$self','@pipe','data/','await','deployActivitySchemas','cycle','CollatorService','produces','job','router-stream-group-exists','stream','manifest','object','version','schema','__esModule','./validator','transitions','trigger','ancestor','860028HIPWLd','findTrigger','input/data','push','SerializerService','app','PRODUCES','getSymbolValues','output/data','ENGINE','addSymbols','store','resolveJobMapsPaths','match','ACTIVITY','values','setTransitions','persistent','hook/data','reserveSymbolRange','8RYgdJf','bindParents','startsWith','defineProperty','1405033IGNROF','logger','data','3714540tGbQlW','convertActivitiesToHooks','graphs','10zzBJVs','compile','expire','info','subscribes','Validator','setSchemas','CONTEXT_VARS','deploy','parent','hooks','filterSymVals','680XnWZeL','convertTopicsToTypes','bindSelf','deployTransitions','subtype','resolveMappableValue','bindBackRefs','bindCycleTarget','addSymbolValues','includes','STREAMS','../pipe','conditions','$job','Symbol\x20index\x20out\x20of\x20bounds','join','KeyType','consumes','groupMappingRules','mintKey','bindSymbols','split','setSubscriptions','output/metadata'];a=function(){return a2;};return a();}class Deployer{constructor(c){const A=z;this['manifest']=null,this[A(0x1e7)]=c;}async[z(0x196)](c,d){const B=z;this[B(0x17b)]=c,this['stream']=d,collator_1[B(0x1e2)][B(0x18f)](this[B(0x1e7)][B(0x175)][B(0x18d)]),this[B(0x18c)](),this['convertTopicsToTypes'](),this[B(0x1c0)](),this[B(0x1a0)](),this[B(0x185)](),this[B(0x1a1)](),this['resolveMappingDependencies'](),this[B(0x17c)](),await this[B(0x1ba)](),await this[B(0x1b2)](),await this[B(0x1cb)](),await this[B(0x1e0)](),await this['deploySubscriptions'](),await this[B(0x19d)](),await this['deployConsumerGroups']();}[z(0x1b3)](){const C=z;return{'id':this[C(0x1e7)][C(0x175)]['id'],'version':this[C(0x1e7)][C(0x175)][C(0x1e9)]};}async[z(0x1ba)](){const D=z;for(const c of this[D(0x1e7)][D(0x175)][D(0x18d)]){const [,d]=this['findTrigger'](c),f=d[D(0x192)],[g,h,j]=await this['store'][D(0x183)]('$'+f,0x11e,D(0x1d4)),k='',l=this['bindSymbols'](g,h,j,k,d[D(0x176)]);Object['keys'](l)[D(0x1b8)]&&await this[D(0x17b)][D(0x17a)]('$'+f,l);for(const [m,p]of Object[D(0x1d0)](c[D(0x1b7)])){const [q,u,v]=await this['store'][D(0x183)](m,0x11e,D(0x17e)),w=m+'/';this[D(0x19c)](p[D(0x1ab)],p[D(0x1e3)],m);const x=this['bindSymbols'](q,u,v,w,p['produces']);Object[D(0x1cf)](x)[D(0x1b8)]&&await this[D(0x17b)][D(0x17a)](m,x);}}}[z(0x19c)](c,d,f){const E=z;for(const g of[f,E(0x1dc)]){const h=c[g];if(h){for(const i of h)d[E(0x1a3)](i)||d['push'](i);}}}[z(0x1ae)](c,d,f,g,h){const F=z,j={},k={...f};for(const l of h){const m=''+g+l;if(!k[m]){if(c>d)throw new Error(F(0x1a8));const p=(0x0,utils_1['getSymKey'])(c);c++,j[m]=p,k[m]=p;}}return j;}['copyJobSchemas'](){const G=z,c=this[G(0x1e7)]['app'][G(0x18d)];for(const d of c){const f=d[G(0x1b4)]?.[G(0x1ea)],g=d[G(0x1d8)]?.[G(0x1ea)];if(!f&&!g)continue;const h=d['activities'];for(const j in h)if(G(0x1ee)===h[j][G(0x1cd)]){const k=h[j];f&&(k[G(0x1e4)]||(k[G(0x1e4)]={}),k[G(0x1e4)]['schema']=f),g&&(k[G(0x1b4)]={'schema':g});}}}[z(0x1a0)](){const H=z;for(const c of this[H(0x1e7)][H(0x175)][H(0x18d)]){const d=c[H(0x1b7)],f=this[H(0x171)](c)[0x0];for(const g in d)d[g]['trigger']=f,d[g][H(0x192)]=c[H(0x192)],c[H(0x1bc)]&&(d[g][H(0x1bc)]=c[H(0x1bc)]),d[g][H(0x190)]=c['expire']??void 0x0,d[g][H(0x181)]=c[H(0x181)]??void 0x0;}}[z(0x1a1)](){const I=z;for(const c of this[I(0x1e7)]['app'][I(0x18d)]){const d=c['activities'];for(const e in d){const f=d[e];I(0x1e1)===f[I(0x1cd)]&&(d[f[I(0x16f)]]['cycle']=!0x0);}}}[z(0x19b)](){const J=z;for(const c of this[J(0x1e7)][J(0x175)][J(0x18d)]){const d=c[J(0x1b7)];for(const e in d){const f=d[e];['worker',J(0x1df)][J(0x1a3)](f[J(0x1cd)])&&f[J(0x1d7)]&&!f[J(0x19e)]&&(f[J(0x19e)]=f[J(0x1d7)]);}}}[z(0x18c)](){const K=z;for(const c of this[K(0x1e7)][K(0x175)][K(0x18d)]){const d=c[K(0x1b7)];for(const e in d){const f=d[e];[K(0x1d6)][K(0x1a3)](f[K(0x1cd)])&&(f[K(0x1cd)]='hook');}}}async[z(0x185)](){const L=z,c=this[L(0x1e7)][L(0x175)][L(0x18d)];for(const d of c)if(d[L(0x1ed)])for(const f in d[L(0x1ed)]){const g=d[L(0x1ed)][f];for(const h of g){const i=h['to'];d[L(0x1b7)][i][L(0x197)]=f;}d[L(0x1b7)][f][L(0x1ed)]=g;}}[z(0x1bb)](c,d){const M=z;for(const [f,g]of Object['entries'](c))if(M(0x1bf)===f||M(0x1d5)===f||M(0x1c7)===f){if(Array[M(0x1c9)](g)){for(const h of g)'string'==typeof h&&h['length']>0x5&&d[M(0x1ce)](h);}else M(0x1b6)==typeof g&&g['length']>0x5&&d[M(0x1ce)](g);}else M(0x1e8)==typeof g&&this[M(0x1bb)](g,d);}['traverse'](c,d){const N=z;for(const e of Object[N(0x17f)](c))N(0x1e8)==typeof e&&('schema'in e?this['collectValues'](e[N(0x1ea)],d):this[N(0x1cc)](e,d));}async[z(0x1b2)](){const O=z,c=new Set();for(const j of this[O(0x1e7)]['app'][O(0x18d)])this['traverse'](j,c);const d=await this[O(0x17b)][O(0x177)](),f=Object[O(0x1cf)](d)['length'],g=Math[O(0x1c2)](0x34,0x2)-0x1,h=serializer_1[O(0x174)][O(0x199)](f,g,d,c);await this[O(0x17b)][O(0x1a2)](h);}[z(0x17c)](){const Q=z;function c(d){const f=[];return d&&function g(h,j=[]){const P=b;for(const k in h)if(P(0x1e8)!=typeof h[k]||null===h[k]||P(0x1dd)in h[k]){const l=[...j,k][P(0x1a9)]('/');if(l[P(0x1a3)]('[')){const [m,p]=l[P(0x1af)]('['),[q,r]=p[P(0x1af)](']');if(!isNaN(parseInt(q)))for(let u=0x0;u<parseInt(q);u++){const v=P(0x1de)+m+'/'+u;f[P(0x1a3)](v)||f['push'](v);}}else{const w=P(0x1de)+l;f[P(0x1a3)](w)||f['push'](w);}}else{const x=[...j,k];g(h[k],x);}}(d),f;}for(const d of this[Q(0x1e7)]['app'][Q(0x18d)]){let f=[];const [,g]=this['findTrigger'](d);for(const h in d['activities']){const j=d[Q(0x1b7)][h];f=f[Q(0x1c4)](c(j[Q(0x1e4)]?.[Q(0x1c5)]));}g['PRODUCES']=f;}}['resolveMappingDependencies'](){const S=z,c=[];function d(h,j){const R=b;for(const k in h)if(R(0x1b6)==typeof h[k]){const l=h[k];l[R(0x17d)](/^\{[^@].*}$/)&&!validator_1[R(0x193)][R(0x195)][R(0x1a3)](l)&&R(0x1d8)!==l[R(0x1af)]('.')[0x1]&&(c[R(0x173)](l),j['push'](l));}else R(0x1e8)==typeof h[k]&&null!==h[k]&&d(h[k],j);}const f=this['manifest'][S(0x175)]['graphs'];for(const h of f){const i=h['activities'];for(const j in i){const k=i[j];k['consumes']=[],d(k,k[S(0x1ab)]),k[S(0x1ab)]=this[S(0x1ac)](k[S(0x1ab)]);}}const g=this[S(0x1ac)](c);for(const l of f){const m=l[S(0x1b7)];for(const n in m){m[n][S(0x1e3)]=g[''+n]||[];}}}[z(0x1ac)](c){const T=z;c=Array['from'](new Set(c))[T(0x1d3)]();const d={};for(const f of c){const [g,h]=this[T(0x19f)](f);d[g]||(d[g]=[]),d[g][T(0x173)](h);}return d;}[z(0x19f)](c){const U=z,d=(c=c['substring'](0x1,c['length']-0x1))['split']('.');if(U(0x1a7)===d[0x0]){const [f,...g]=d;return[f,g[U(0x1a9)]('/')];}{const [h,j,k,...l]=d;return[h,{'hook':U(0x182),'input':U(0x172),'output':U(0x18a)===k?U(0x178):U(0x1b1)}[j]+'/'+l[U(0x1a9)]('/')];}}async[z(0x1e0)](){const V=z,c=this[V(0x1e7)][V(0x175)][V(0x18d)],d={};for(const f of c){const g=f[V(0x1b7)];for(const h in g){const i=g[h];delete i[V(0x1ed)],d[h]=i;}}await this[V(0x17b)][V(0x194)](d,this['getVID']());}async['deploySubscriptions'](){const W=z,c=this[W(0x1e7)][W(0x175)][W(0x18d)],d={};for(const f of c){const g=f[W(0x1b7)],h=f[W(0x192)];for(const i in g)if('trigger'===g[i][W(0x1cd)]){d[h]=i;break;}}await this['store'][W(0x1b0)](d,this[W(0x1b3)]());}['findTrigger'](c){const X=z;for(const d in c['activities']){const e=c[X(0x1b7)][d];if(X(0x1ee)===e[X(0x1cd)])return[d,e];}return null;}async[z(0x19d)](){const Y=z,c=this[Y(0x1e7)][Y(0x175)]['graphs'],d={};for(const f of c){if(f[Y(0x192)]&&f[Y(0x192)][Y(0x186)]('.')){const [g]=this[Y(0x171)](f);g&&(d[f[Y(0x192)]]={[g]:!0x0});}if(f[Y(0x1ed)])for(const h in f[Y(0x1ed)]){const j=f[Y(0x1ed)][h],k={};for(const l of j){const m=l['to'];l[Y(0x1a6)]?k[m]=l[Y(0x1a6)]:k[m]=!0x0;}Object[Y(0x1cf)](k)[Y(0x1b8)]>0x0&&(d['.'+h]=k);}}await this[Y(0x17b)][Y(0x180)](d,this[Y(0x1b3)]());}async[z(0x1cb)](){const Z=z,c=this[Z(0x1e7)][Z(0x175)][Z(0x18d)],d={};for(const f of c)if(f['hooks'])for(const g in f[Z(0x198)]){d[g]=f['hooks'][g];const h=f[Z(0x198)][g][0x0]['to'],j=f[Z(0x1b7)][h];j&&(j[Z(0x1d9)]||(j[Z(0x1d9)]={}),j[Z(0x1d9)][Z(0x1d7)]=g);}await this['store'][Z(0x1d1)](d);}async[z(0x1b9)](){const a0=z,c={'appId':this[a0(0x1e7)][a0(0x175)]['id']},d=this[a0(0x17b)][a0(0x1ad)](key_1[a0(0x1aa)]['STREAMS'],c);await this['deployConsumerGroup'](d,a0(0x179));for(const f of this[a0(0x1e7)][a0(0x175)][a0(0x18d)]){const g=f[a0(0x1b7)];for(const h in g){const i=g[h];if('worker'===i[a0(0x1cd)]&&pipe_1[a0(0x1d2)]['resolve'](i[a0(0x19e)],{})===i['subtype']){c[a0(0x1d7)]=i[a0(0x19e)];const j=this[a0(0x17b)][a0(0x1ad)](key_1[a0(0x1aa)][a0(0x1a4)],c);await this['deployConsumerGroup'](j,a0(0x1bd));}}}}async[z(0x1c8)](c,d){const a1=z;try{await this[a1(0x1e6)]['createConsumerGroup'](c,d);}catch(e){this[a1(0x17b)][a1(0x189)][a1(0x191)](a1(0x1e5),{'stream':c,'group':d});}}}exports['Deployer']=Deployer;