UNPKG

@hotmeshio/hotmesh

Version:

Serverless Workflow

1 lines 5.88 kB
'use strict';const r=b;function a(){const A=['setActivityError','topic','doesHook','appId','store','9064FRjNSL','process-event-generational-job-error','36439bGAAYI','../../modules/errors','Hook','config','aid','processWebHookEvent','../telemetry','defineProperty','taskService','mapActivityAttributes','process','doPassThrough','hook-get-state-error','getHookRule','207663dQrEwu','11225247eDEmDU','transact','TelemetryService','processEvent','endActivitySpan','GenerationalError','duplicate','1066475IIlEwW','36PfXEor','hook-collation-error','InactiveJobError','SUCCESS','../../types/stream','./activity','getHookRules','setState','34ZXTHCq','doHook','error','metadata','expire','resolve','app.activity.mids','sleep','length','hook-inactive-job-error','adjacencyList','mapJobData','hook-process-error','setStatus','10112720SbpUAx','CollatorService','data','hook-process-end','verifyEntry','mapOutputData','info','processTimeHookEvent','CollationError','../collator','exec','gid','registerHook','StreamStatus','hook-collation-overage','hook-process-web-hook-event','engine','debug','setActivityAttributes','hook','registerTimeHook','jid','dad','transition','Pipe','deleteWebHookSignal','registerWebHook','Activity','GetStateError','processWebHookSignal','HMSH_IS_CLUSTER','5382LHjACY','context','resolveDad','logger','7OErved','1160970VvLFyy'];a=function(){return A;};return a();}(function(c,d){const q=b,e=c();while(!![]){try{const f=-parseInt(q(0x103))/0x1*(parseInt(q(0xc9))/0x2)+parseInt(q(0xb8))/0x3*(-parseInt(q(0xc1))/0x4)+parseInt(q(0xc0))/0x5+-parseInt(q(0xfb))/0x6*(-parseInt(q(0xfa))/0x7)+-parseInt(q(0x101))/0x8*(parseInt(q(0xf6))/0x9)+parseInt(q(0xd7))/0xa+parseInt(q(0xb9))/0xb;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x7e999));Object[r(0xb1)](exports,'__esModule',{'value':!0x0}),exports[r(0x105)]=void 0x0;const enums_1=require('../../modules/enums'),errors_1=require(r(0x104)),collator_1=require(r(0xe0)),pipe_1=require('../pipe'),task_1=require('../task'),telemetry_1=require(r(0xb0)),stream_1=require(r(0xc5)),activity_1=require(r(0xc6));function b(c,d){const e=a();return b=function(f,g){f=f-0xaf;let h=e[f];return h;},b(c,d);}class Hook extends activity_1[r(0xf2)]{constructor(c,d,f,g,h,j){super(c,d,f,g,h,j);}async[r(0xb4)](){const s=r;let c;this[s(0xf9)][s(0xe8)]('hook-process',{'jid':this[s(0xf7)][s(0xcc)][s(0xec)],'gid':this[s(0xf7)]['metadata'][s(0xe2)],'aid':this[s(0xcc)][s(0x107)]});try{return await this[s(0xdb)](),c=new telemetry_1[(s(0xbb))](this[s(0xe7)][s(0xff)],this['config'],this['metadata'],this[s(0xf7)]),c['startActivitySpan'](this['leg']),this['doesHook']()?await this[s(0xca)](c):await this[s(0xb5)](c),this[s(0xf7)][s(0xcc)]['aid'];}catch(d){if(d instanceof errors_1[s(0xc3)])return void this[s(0xf9)][s(0xcb)](s(0xd2),{'error':d});if(d instanceof errors_1[s(0xbe)])return void this[s(0xf9)][s(0xdd)](s(0x102),{'error':d});if(d instanceof errors_1[s(0xf3)])return void this[s(0xf9)][s(0xcb)](s(0xb6),{'error':d});if(d instanceof errors_1[s(0xdf)]){if(s(0xbf)===d['fault'])return void this[s(0xf9)][s(0xdd)](s(0xe5),{'job_id':this[s(0xf7)]['metadata'][s(0xec)],'guid':this[s(0xf7)][s(0xcc)]['guid']});this[s(0xf9)][s(0xcb)](s(0xc2),{'error':d});}else this[s(0xf9)][s(0xcb)](s(0xd5),{'error':d});throw c?.[s(0xfc)](d['message']),d;}finally{c?.[s(0xbd)](),this['logger']['debug'](s(0xda),{'jid':this[s(0xf7)][s(0xcc)][s(0xec)],'gid':this['context'][s(0xcc)][s(0xe2)],'aid':this['metadata']['aid']});}}[r(0xfe)](){const t=r;if(this[t(0x106)]['sleep']){const c=pipe_1[t(0xef)][t(0xce)](this[t(0x106)]['sleep'],this[t(0xf7)]);return!isNaN(c)&&Number(c)>0x0;}return!!this['config'][t(0xea)]?.[t(0xfd)];}async[r(0xca)](c){const u=r,d=this['store'][u(0xba)]();await this['registerHook'](enums_1[u(0xf5)]?void 0x0:d),this[u(0xdc)](),this[u(0xd4)](),await this[u(0xc8)](d),await collator_1[u(0xd8)]['authorizeReentry'](this,d),await this[u(0xd6)](0x0,d),await d[u(0xe1)](),c['mapActivityAttributes']();}async[r(0xb5)](c){const v=r,d=this[v(0x100)][v(0xba)]();let f;this['adjacencyList']=await this['filterAdjacent'](),this[v(0xdc)](),this[v(0xd4)](),await this[v(0xc8)](d),await collator_1[v(0xd8)]['notarizeEarlyCompletion'](this,d),await this[v(0xd6)](this[v(0xd3)][v(0xd1)]-0x1,d),f=await d[v(0xe1)](),c[v(0xb3)]();const g=this['resolveStatus'](f),h={'app.job.jss':g},j=await this[v(0xee)](this[v(0xd3)],g);j['length']&&(h[v(0xcf)]=j['join'](',')),c[v(0xe9)](h);}async[r(0xb7)](c){const w=r,d=await this['store'][w(0xc7)]();return d?.[c]?.[0x0];}async[r(0xe3)](c){const x=r;if(this['config'][x(0xea)]?.[x(0xfd)])return await this['engine'][x(0xb2)][x(0xf1)](this[x(0x106)]['hook']['topic'],this['context'],this[x(0xf8)](),this[x(0xf7)][x(0xcc)][x(0xcd)],c);if(this[x(0x106)][x(0xd0)]){const d=pipe_1['Pipe'][x(0xce)](this['config'][x(0xd0)],this[x(0xf7)]);return await this[x(0xe7)][x(0xb2)][x(0xeb)](this[x(0xf7)]['metadata']['jid'],this['context'][x(0xcc)][x(0xe2)],''+this[x(0xcc)]['aid']+(this[x(0xcc)][x(0xed)]||''),x(0xd0),d,this[x(0xcc)][x(0xed)]||''),this[x(0xf7)]['metadata'][x(0xec)];}}async[r(0xaf)](d=stream_1[r(0xe4)][r(0xc4)],f=0xc8){const y=r;this['logger'][y(0xe8)](y(0xe6),{'topic':this['config'][y(0xea)]['topic'],'aid':this[y(0xcc)][y(0x107)],'status':d,'code':f});const g=new task_1['TaskService'](this[y(0x100)],this[y(0xf9)]),h={...this[y(0xd9)]},j=await g[y(0xf4)](this[y(0x106)][y(0xea)][y(0xfd)],h);if(j){const [k,l,m,p]=j;this[y(0xf7)][y(0xcc)]['jid']=k,this[y(0xf7)][y(0xcc)]['gid']=p,this[y(0xf7)]['metadata']['dad']=m,await this['processEvent'](d,f,y(0xea)),0xc8===f&&await g[y(0xf0)](this[y(0x106)][y(0xea)][y(0xfd)],h);}}async[r(0xde)](c){const z=r;this['logger'][z(0xe8)]('hook-process-time-hook-event',{'jid':c,'gid':this[z(0xf7)]['metadata']['gid'],'aid':this[z(0xcc)][z(0x107)]}),await this[z(0xbc)](stream_1[z(0xe4)][z(0xc4)],0xc8,z(0xea));}}exports[r(0x105)]=Hook;