@hotmeshio/hotmesh 0.3.20 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -23
- package/build/index.d.ts +3 -1
- package/build/index.js +5 -1
- package/build/modules/key.js +1 -1
- package/build/modules/utils.d.ts +1 -2
- package/build/modules/utils.js +1 -1
- package/build/package.json +1 -1
- package/build/services/activities/activity.js +1 -1
- package/build/services/activities/await.js +1 -1
- package/build/services/activities/cycle.js +1 -1
- package/build/services/activities/hook.js +1 -1
- package/build/services/activities/index.js +1 -1
- package/build/services/activities/interrupt.js +1 -1
- package/build/services/activities/signal.js +1 -1
- package/build/services/activities/trigger.js +1 -1
- package/build/services/activities/worker.js +1 -1
- package/build/services/collator/index.js +1 -1
- package/build/services/compiler/deployer.js +1 -1
- package/build/services/compiler/index.js +1 -1
- package/build/services/compiler/validator.js +1 -1
- package/build/services/connector/factory.js +21 -19
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.js +1 -1
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.js +3 -5
- package/build/services/meshdata/index.d.ts +3 -4
- package/build/services/meshdata/index.js +4 -9
- package/build/services/meshflow/client.js +1 -2
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/worker.js +5 -8
- package/build/services/meshos/index.d.ts +2 -2
- package/build/services/meshos/index.js +6 -9
- package/build/services/pipe/functions/array.js +1 -1
- package/build/services/pipe/functions/bitwise.js +1 -1
- package/build/services/pipe/functions/conditional.js +1 -1
- package/build/services/pipe/functions/cron.js +1 -1
- package/build/services/pipe/functions/date.js +1 -1
- package/build/services/pipe/functions/index.js +1 -1
- package/build/services/pipe/functions/json.js +1 -1
- package/build/services/pipe/functions/logical.js +1 -1
- package/build/services/pipe/functions/math.js +1 -1
- package/build/services/pipe/functions/number.js +1 -1
- package/build/services/pipe/functions/object.js +1 -1
- package/build/services/pipe/functions/string.js +1 -1
- package/build/services/pipe/functions/symbol.js +1 -1
- package/build/services/pipe/functions/unary.js +1 -1
- package/build/services/pipe/index.js +1 -1
- package/build/services/quorum/index.js +1 -1
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.js +1 -1
- package/build/services/search/providers/postgres/postgres.js +1 -1
- package/build/services/search/providers/redis/ioredis.js +1 -1
- package/build/services/search/providers/redis/redis.js +1 -1
- package/build/services/serializer/index.js +1 -1
- package/build/services/store/providers/postgres/kvsql.js +1 -1
- package/build/services/store/providers/postgres/kvtables.js +1 -1
- package/build/services/store/providers/postgres/kvtransaction.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/hash.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/string.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/zset.js +1 -1
- package/build/services/store/providers/postgres/postgres.js +1 -1
- package/build/services/store/providers/redis/_base.js +1 -1
- package/build/services/store/providers/redis/ioredis.js +1 -1
- package/build/services/store/providers/redis/redis.js +1 -1
- package/build/services/store/providers/store-initializable.js +1 -1
- package/build/services/stream/providers/nats/nats.js +1 -1
- package/build/services/stream/providers/postgres/postgres.js +1 -1
- package/build/services/stream/providers/redis/ioredis.js +1 -1
- package/build/services/stream/providers/redis/redis.js +1 -1
- package/build/services/stream/providers/stream-initializable.js +1 -1
- package/build/services/sub/providers/nats/nats.js +1 -1
- package/build/services/sub/providers/postgres/postgres.js +1 -1
- package/build/services/sub/providers/redis/ioredis.js +1 -1
- package/build/services/sub/providers/redis/redis.js +1 -1
- package/build/services/task/index.js +1 -1
- package/build/services/telemetry/index.js +1 -1
- package/build/services/worker/index.js +1 -1
- package/build/types/hotmesh.d.ts +3 -17
- package/build/types/manifest.d.ts +2 -10
- package/index.ts +4 -0
- package/package.json +1 -1
- package/types/hotmesh.ts +17 -17
- package/types/manifest.ts +2 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x4988dc,_0x571043){const _0x3e1079=_0x1397,_0x5cb3ea=_0x4988dc();while(!![]){try{const _0x5927f4=-parseInt(_0x3e1079(0x107))/0x1*(-parseInt(_0x3e1079(0x108))/0x2)+parseInt(_0x3e1079(0x101))/0x3*(parseInt(_0x3e1079(0x102))/0x4)+parseInt(_0x3e1079(0x104))/0x5*(parseInt(_0x3e1079(0x109))/0x6)+-parseInt(_0x3e1079(0x106))/0x7+parseInt(_0x3e1079(0x10a))/0x8*(parseInt(_0x3e1079(0x100))/0x9)+parseInt(_0x3e1079(0x105))/0xa+-parseInt(_0x3e1079(0x103))/0xb;if(_0x5927f4===_0x571043)break;else _0x5cb3ea['push'](_0x5cb3ea['shift']());}catch(_0x5f0517){_0x5cb3ea['push'](_0x5cb3ea['shift']());}}}(_0x2b61,0xcc4ac));function _0x2b61(){const _0x2c8858=['2DoqOvC','798890YZBZDf','6QKTYsp','296pZMJqg','339111QVsAZh','5883IlxjmI','24TZNEwp','32478864duKaZl','7301130lkJTJL','1570770fLYrXb','228746MDBmCW'];_0x2b61=function(){return _0x2c8858;};return _0x2b61();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Signal']=void 0x0;const errors_1=require('../../modules/errors'),collator_1=require('../collator'),mapper_1=require('../mapper'),pipe_1=require('../pipe'),telemetry_1=require('../telemetry'),activity_1=require('./activity');class Signal extends activity_1['Activity']{constructor(_0x44ec9e,_0x203931,_0x191c15,_0x3d16bf,_0xd05bdb,_0x5e2361){super(_0x44ec9e,_0x203931,_0x191c15,_0x3d16bf,_0xd05bdb,_0x5e2361);}async['process'](){this['logger']['debug']('signal-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x50976b;try{await this['verifyEntry'](),_0x50976b=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x50976b['startActivitySpan'](this['leg']);const _0x43a126=this['store']['transact']();this['adjacencyList']=await this['filterAdjacent'](),this['mapOutputData'](),this['mapJobData'](),await this['setState'](_0x43a126),await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0x43a126),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x43a126);const _0x22df37=await _0x43a126['exec']();this['config']['subtype']==='all'?await this['hookAll']():await this['hookOne']();const _0x2fbe64=this['resolveStatus'](_0x22df37),_0x2590aa={'app.job.jss':_0x2fbe64},_0x35bca0=await this['transition'](this['adjacencyList'],_0x2fbe64);return _0x35bca0['length']&&(_0x2590aa['app.activity.mids']=_0x35bca0['join'](',')),_0x50976b['mapActivityAttributes'](),_0x50976b['setActivityAttributes'](_0x2590aa),this['context']['metadata']['aid'];}catch(_0x3d90e1){if(_0x3d90e1 instanceof errors_1['InactiveJobError']){this['logger']['error']('signal-inactive-job-error',{..._0x3d90e1});return;}else{if(_0x3d90e1 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x3d90e1});return;}else{if(_0x3d90e1 instanceof errors_1['GetStateError']){this['logger']['error']('signal-get-state-error',{..._0x3d90e1});return;}else{if(_0x3d90e1 instanceof errors_1['CollationError']){if(_0x3d90e1['fault']==='duplicate'){this['logger']['info']('signal-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('signal-collation-error',{..._0x3d90e1});}else this['logger']['error']('signal-process-error',{..._0x3d90e1});}}}_0x50976b?.['setActivityError'](_0x3d90e1['message']);throw _0x3d90e1;}finally{_0x50976b?.['endActivitySpan'](),this['logger']['debug']('signal-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}['mapSignalData'](){if(this['config']['signal']?.['maps']){const _0xed4262=new mapper_1['MapperService'](this['config']['signal']['maps'],this['context']);return _0xed4262['mapRules']();}}['mapResolverData'](){if(this['config']['resolver']?.['maps']){const _0x394ff6=new mapper_1['MapperService'](this['config']['resolver']['maps'],this['context']);return _0x394ff6['mapRules']();}}async['hookOne'](){const _0xd40d92=pipe_1['Pipe']['resolve'](this['config']['topic'],this['context']),_0x75c92c=this['mapSignalData'](),_0x20f273=pipe_1['Pipe']['resolve'](this['config']['status'],this['context']),_0x5b4538=pipe_1['Pipe']['resolve'](this['config']['code'],this['context']);return await this['engine']['hook'](_0xd40d92,_0x75c92c,_0x20f273,_0x5b4538);}async['hookAll'](){const _0x32580d=this['mapSignalData'](),_0xea5e2a=this['mapResolverData']();this['config']['scrub']&&(_0xea5e2a['scrub']=!![]);const _0x32b1f1=pipe_1['Pipe']['resolve'](this['config']['key_name'],this['context']),_0x4a007e=pipe_1['Pipe']['resolve'](this['config']['key_value'],this['context']),_0x5a18b0=[_0x32b1f1+':'+_0x4a007e];return await this['engine']['hookAll'](this['config']['topic'],_0x32580d,_0xea5e2a,_0x5a18b0);}}function _0x1397(_0x2daa76,_0x44813d){const _0x2b61c4=_0x2b61();return _0x1397=function(_0x1397e6,_0x324d95){_0x1397e6=_0x1397e6-0x100;let _0x381535=_0x2b61c4[_0x1397e6];return _0x381535;},_0x1397(_0x2daa76,_0x44813d);}exports['Signal']=Signal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0x2a92(){const _0x22d754=['22LwtlKL','36oDbdCu','4015975VmQhET','335841aSLjos','28RSptny','5732490lLevVI','690403HKgKvH','44296GncYAF','7404430SyWXYw','35870CcmrRI','783MXaCHL'];_0x2a92=function(){return _0x22d754;};return _0x2a92();}(function(_0x326c6e,_0x4bd50b){const _0x42721b=_0xe2a7,_0x34b8da=_0x326c6e();while(!![]){try{const _0x3e65f5=parseInt(_0x42721b(0x132))/0x1*(parseInt(_0x42721b(0x129))/0x2)+-parseInt(_0x42721b(0x12c))/0x3*(parseInt(_0x42721b(0x12d))/0x4)+parseInt(_0x42721b(0x12b))/0x5+-parseInt(_0x42721b(0x12a))/0x6*(-parseInt(_0x42721b(0x12f))/0x7)+-parseInt(_0x42721b(0x130))/0x8*(parseInt(_0x42721b(0x133))/0x9)+parseInt(_0x42721b(0x12e))/0xa+-parseInt(_0x42721b(0x131))/0xb;if(_0x3e65f5===_0x4bd50b)break;else _0x34b8da['push'](_0x34b8da['shift']());}catch(_0x2b3f12){_0x34b8da['push'](_0x34b8da['shift']());}}}(_0x2a92,0x67976));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Trigger']=void 0x0;const errors_1=require('../../modules/errors'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),pipe_1=require('../pipe'),reporter_1=require('../reporter'),serializer_1=require('../serializer'),telemetry_1=require('../telemetry'),activity_1=require('./activity');class Trigger extends activity_1['Activity']{constructor(_0x233d45,_0x373a2a,_0x1e1cfd,_0x186a12,_0x1e2458,_0x5bb07e){super(_0x233d45,_0x373a2a,_0x1e1cfd,_0x186a12,_0x1e2458,_0x5bb07e);}async['process'](_0x50f1e5){this['logger']['debug']('trigger-process',{'subscribes':this['config']['subscribes']});let _0x55adee;try{this['setLeg'](0x2),await this['getState'](),_0x55adee=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x55adee['startJobSpan'](),_0x55adee['startActivitySpan'](this['leg']),this['mapJobData'](),this['adjacencyList']=await this['filterAdjacent']();const _0x3ed448=this['initStatus'](_0x50f1e5,this['adjacencyList']['length']);await this['setStateNX'](_0x3ed448),await this['setStatus'](_0x3ed448),this['bindSearchData'](_0x50f1e5),this['bindMarkerData'](_0x50f1e5);const _0x18062d=this['store']['transact']();await this['setState'](_0x18062d),await this['setStats'](_0x18062d);_0x50f1e5?.['pending']&&await this['setExpired'](_0x50f1e5?.['pending'],_0x18062d);await collator_1['CollatorService']['notarizeInception'](this,this['context']['metadata']['guid'],_0x18062d),await _0x18062d['exec'](),this['execAdjacentParent'](),_0x55adee['mapActivityAttributes']();const _0xcc4393=Number(this['context']['metadata']['js']);_0x55adee['setJobAttributes']({'app.job.jss':_0xcc4393});const _0x5bf17a={'app.job.jss':_0xcc4393};return await this['transitionAndLogAdjacent'](_0x50f1e5,_0xcc4393,_0x5bf17a),_0x55adee['setActivityAttributes'](_0x5bf17a),this['context']['metadata']['jid'];}catch(_0x4243c4){_0x55adee?.['setActivityError'](_0x4243c4['message']);if(_0x4243c4 instanceof errors_1['DuplicateJobError']){await(0x0,utils_1['sleepFor'])(0x3e8);const _0x4ea19d=await collator_1['CollatorService']['isInceptionOverage'](this,this['context']['metadata']['guid']);if(_0x4ea19d){this['logger']['info']('trigger-collation-overage',{'job_id':_0x4243c4['jobId'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('duplicate-job-error',{'job_id':_0x4243c4['jobId'],'guid':this['context']['metadata']['guid']});}else this['logger']['error']('trigger-process-error',{..._0x4243c4});throw _0x4243c4;}finally{_0x55adee?.['endJobSpan'](),_0x55adee?.['endActivitySpan'](),this['logger']['debug']('trigger-process-end',{'subscribes':this['config']['subscribes'],'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid']});}}async['transitionAndLogAdjacent'](_0x445d97={},_0x3f8b93,_0xd61cd7){if(isNaN(_0x445d97['pending'])){const _0x1f948d=await this['transition'](this['adjacencyList'],_0x3f8b93);_0x1f948d['length']&&(_0xd61cd7['app.activity.mids']=_0x1f948d['join'](','));}}['initStatus'](_0x2b9a7={},_0x2eee6f){if(_0x2b9a7['pending'])return-0x1;return _0x2eee6f;}async['setExpired'](_0x4ce2c2,_0x434405){await this['store']['expireJob'](this['context']['metadata']['jid'],_0x4ce2c2,_0x434405);}['safeKey'](_0xbf12b){return'_'+_0xbf12b;}['bindSearchData'](_0x527957){_0x527957?.['search']&&Object['keys'](_0x527957['search'])['forEach'](_0x584985=>{this['context']['data'][this['safeKey'](_0x584985)]=_0x527957['search'][_0x584985]['toString']();});}['bindMarkerData'](_0x2d02ff){_0x2d02ff?.['marker']&&Object['keys'](_0x2d02ff['marker'])['forEach'](_0xf395b3=>{_0xf395b3['startsWith']('-')&&(this['context']['data'][_0xf395b3]=_0x2d02ff['marker'][_0xf395b3]['toString']());});}async['setStatus'](_0x5f1e5e){this['context']['metadata']['js']=_0x5f1e5e;}async['execAdjacentParent'](){if(this['context']['metadata']['px']){const _0x3acdf5=(0x0,utils_1['formatISODate'])(new Date()),_0x41da02={'metadata':this['context']['metadata'],'data':{'job_id':this['context']['metadata']['jid'],'jc':_0x3acdf5,'ju':_0x3acdf5}};await this['engine']['execAdjacentParent'](this['context'],_0x41da02);}}['createInputContext'](){const _0x426028={[this['metadata']['aid']]:{'input':{'data':this['data']}},'$self':{'input':{'data':this['data']},'output':{'data':this['data']}}};return _0x426028;}async['getState'](){const _0x3ad596=this['createInputContext'](),_0x77fc12=this['resolveJobId'](_0x3ad596),_0x14dcd4=this['resolveJobKey'](_0x3ad596),_0x1afb06=(0x0,utils_1['formatISODate'])(new Date()),{id:_0xd0652e,version:_0x4cea27}=await this['engine']['getVID']();this['initDimensionalAddress'](collator_1['CollatorService']['getDimensionalSeed']());const _0x53ce09={...this['metadata'],'jid':_0x77fc12,'key':_0x14dcd4,'as':collator_1['CollatorService']['getTriggerSeed']()};this['context']={'metadata':{...this['metadata'],'gid':(0x0,utils_1['guid'])(),'ngn':this['context']['metadata']['ngn'],'pj':this['context']['metadata']['pj'],'pg':this['context']['metadata']['pg'],'pd':this['context']['metadata']['pd'],'pa':this['context']['metadata']['pa'],'px':this['context']['metadata']['px'],'app':_0xd0652e,'vrs':_0x4cea27,'tpc':this['config']['subscribes'],'trc':this['context']['metadata']['trc'],'spn':this['context']['metadata']['spn'],'guid':this['context']['metadata']['guid'],'jid':_0x77fc12,'dad':collator_1['CollatorService']['getDimensionalSeed'](),'key':_0x14dcd4,'jc':_0x1afb06,'ju':_0x1afb06,'ts':(0x0,utils_1['getTimeSeries'])(this['resolveGranularity']()),'js':0x0},'data':{},[this['metadata']['aid']]:{'input':{'data':this['data'],'metadata':_0x53ce09},'output':{'data':this['data'],'metadata':_0x53ce09},'settings':{'data':{}},'errors':{'data':{}}}},this['context']['$self']=this['context'][this['metadata']['aid']],this['context']['$job']=this['context'];}['bindJobMetadataPaths'](){return serializer_1['MDATA_SYMBOLS']['JOB']['KEYS']['map'](_0x14f04d=>'metadata/'+_0x14f04d);}['bindActivityMetadataPaths'](){return serializer_1['MDATA_SYMBOLS']['ACTIVITY']['KEYS']['map'](_0xc6ef26=>'output/metadata/'+_0xc6ef26);}['resolveGranularity'](){return this['config']['stats']?.['granularity']||reporter_1['ReporterService']['DEFAULT_GRANULARITY'];}['getJobStatus'](){return this['context']['metadata']['js'];}['resolveJobId'](_0x541afb){const _0x16908d=this['config']['stats']?.['id'];return _0x16908d?pipe_1['Pipe']['resolve'](_0x16908d,_0x541afb):(0x0,utils_1['guid'])();}['resolveJobKey'](_0x151f29){const _0x106217=this['config']['stats']?.['key'];return _0x106217?pipe_1['Pipe']['resolve'](_0x106217,_0x151f29):'';}async['setStateNX'](_0x10fa4c){const _0x7f7082=this['context']['metadata']['jid'];if(!await this['store']['setStateNX'](_0x7f7082,this['engine']['appId'],_0x10fa4c))throw new errors_1['DuplicateJobError'](_0x7f7082);}async['setStats'](_0x4c3738){const _0x2e5023=this['context']['metadata'];if(_0x2e5023['key']&&this['config']['stats']?.['measures']){const _0x47f437=await this['engine']['getVID'](),_0x53072e=new reporter_1['ReporterService'](_0x47f437,this['store'],this['logger']);await this['store']['setStats'](_0x2e5023['key'],_0x2e5023['jid'],_0x2e5023['ts'],_0x53072e['resolveTriggerStatistics'](this['config'],this['context']),_0x47f437,_0x4c3738);}}}function _0xe2a7(_0x64ec34,_0x3621b7){const _0x2a926f=_0x2a92();return _0xe2a7=function(_0xe2a7c4,_0x30685){_0xe2a7c4=_0xe2a7c4-0x129;let _0x3aff15=_0x2a926f[_0xe2a7c4];return _0x3aff15;},_0xe2a7(_0x64ec34,_0x3621b7);}exports['Trigger']=Trigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function _0x4122(){const _0x52b839=['90420Seyuvl','471866bECRIp','216179ThQINc','40ghYHfM','456400MzaeQB','210uwTBYv','182fSkqio','285462jgprPD','314952SVWIdz'];_0x4122=function(){return _0x52b839;};return _0x4122();}(function(_0x1cd437,_0x16cd8c){const _0x391883=_0x1bea,_0x3886fe=_0x1cd437();while(!![]){try{const _0x164ca4=-parseInt(_0x391883(0x1bf))/0x1+parseInt(_0x391883(0x1be))/0x2+parseInt(_0x391883(0x1c5))/0x3+-parseInt(_0x391883(0x1c6))/0x4+-parseInt(_0x391883(0x1c1))/0x5+parseInt(_0x391883(0x1c2))/0x6*(parseInt(_0x391883(0x1c3))/0x7)+parseInt(_0x391883(0x1c0))/0x8*(parseInt(_0x391883(0x1c4))/0x9);if(_0x164ca4===_0x16cd8c)break;else _0x3886fe['push'](_0x3886fe['shift']());}catch(_0x89dad6){_0x3886fe['push'](_0x3886fe['shift']());}}}(_0x4122,0x29971));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Worker']=void 0x0;const errors_1=require('../../modules/errors'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),pipe_1=require('../pipe'),telemetry_1=require('../telemetry'),activity_1=require('./activity');class Worker extends activity_1['Activity']{constructor(_0x563049,_0x7d9a4,_0x5ef7b7,_0x13c51d,_0x4c8892,_0x24f05c){super(_0x563049,_0x7d9a4,_0x5ef7b7,_0x13c51d,_0x4c8892,_0x24f05c);}async['process'](){this['logger']['debug']('worker-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x3303f2;try{await this['verifyEntry'](),_0x3303f2=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x3303f2['startActivitySpan'](this['leg']),this['mapInputData']();const _0x50a521=this['store']['transact'](),_0x4c804a=await this['execActivity'](_0x50a521);await collator_1['CollatorService']['authorizeReentry'](this,_0x50a521),await this['setState'](_0x50a521),await this['setStatus'](0x0,_0x50a521);const _0x3da954=await _0x50a521['exec']();_0x3303f2['mapActivityAttributes']();const _0x4ad494=this['resolveStatus'](_0x3da954);return _0x3303f2['setActivityAttributes']({'app.activity.mid':_0x4c804a,'app.job.jss':_0x4ad494}),this['context']['metadata']['aid'];}catch(_0x548893){if(_0x548893 instanceof errors_1['InactiveJobError']){this['logger']['error']('await-inactive-job-error',{..._0x548893});return;}else{if(_0x548893 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x548893});return;}else{if(_0x548893 instanceof errors_1['GetStateError']){this['logger']['error']('worker-get-state-error',{..._0x548893});return;}else{if(_0x548893 instanceof errors_1['CollationError']){if(_0x548893['fault']==='duplicate'){this['logger']['info']('worker-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('worker-collation-error',{..._0x548893});}else this['logger']['error']('worker-process-error',{..._0x548893});}}}_0x3303f2?.['setActivityError'](_0x548893['message']);throw _0x548893;}finally{_0x3303f2?.['endActivitySpan'](),this['logger']['debug']('worker-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}async['execActivity'](_0x47c04a){const _0x1d6b79=pipe_1['Pipe']['resolve'](this['config']['subtype'],this['context']),_0x3377aa={'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'dad':this['metadata']['dad'],'aid':this['metadata']['aid'],'topic':_0x1d6b79,'spn':this['context']['$self']['output']['metadata']['l1s'],'trc':this['context']['metadata']['trc']},'data':this['context']['data']};return this['config']['retry']&&(_0x3377aa['policies']={'retry':this['config']['retry']}),await this['engine']['router']?.['publishMessage'](_0x1d6b79,_0x3377aa,_0x47c04a);}}function _0x1bea(_0x14c129,_0x2b36c3){const _0x41224c=_0x4122();return _0x1bea=function(_0x1bea12,_0x3f9d2a){_0x1bea12=_0x1bea12-0x1be;let _0x563700=_0x41224c[_0x1bea12];return _0x563700;},_0x1bea(_0x14c129,_0x2b36c3);}exports['Worker']=Worker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x56ae2f,_0x1cf01d){const _0xff740a=_0x444c,_0x58617b=_0x56ae2f();while(!![]){try{const _0x2606ea=-parseInt(_0xff740a(0x6e))/0x1*(parseInt(_0xff740a(0x78))/0x2)+parseInt(_0xff740a(0x6d))/0x3+-parseInt(_0xff740a(0x73))/0x4*(parseInt(_0xff740a(0x71))/0x5)+parseInt(_0xff740a(0x75))/0x6*(-parseInt(_0xff740a(0x6f))/0x7)+parseInt(_0xff740a(0x70))/0x8*(parseInt(_0xff740a(0x77))/0x9)+parseInt(_0xff740a(0x76))/0xa+parseInt(_0xff740a(0x74))/0xb*(-parseInt(_0xff740a(0x72))/0xc);if(_0x2606ea===_0x1cf01d)break;else _0x58617b['push'](_0x58617b['shift']());}catch(_0x4f9b5f){_0x58617b['push'](_0x58617b['shift']());}}}(_0x4cb9,0xdb049));function _0x444c(_0x4a9c0f,_0x1ac86f){const _0x4cb9ef=_0x4cb9();return _0x444c=function(_0x444cc6,_0x2ff8a1){_0x444cc6=_0x444cc6-0x6d;let _0x3a698e=_0x4cb9ef[_0x444cc6];return _0x3a698e;},_0x444c(_0x4a9c0f,_0x1ac86f);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['CollatorService']=void 0x0;function _0x4cb9(){const _0x55b743=['6654445GpHxLM','9726280iepSLp','10CZDbyL','771564qqLJKy','1986408stnHTJ','77oCxfoA','6FiLIKB','11069820uZCnKp','9kffuWG','2VwyGPH','5026491MDmApT','707249nOPUlq'];_0x4cb9=function(){return _0x55b743;};return _0x4cb9();}const errors_1=require('../../modules/errors'),collator_1=require('../../types/collator');class CollatorService{static['assertJobActive'](_0x21530d,_0x1a7e8c,_0x2ad423,_0x3b6ec2=0x0){if(_0x21530d<=_0x3b6ec2)throw new errors_1['InactiveJobError'](_0x1a7e8c,_0x21530d,_0x2ad423);}static['getDimensionalAddress'](_0x12ace7,_0x323f5c=![]){let _0x4e4f83=_0x12ace7['context']['metadata']['dad']||_0x12ace7['metadata']['dad'];return _0x323f5c&&_0x4e4f83&&_0x12ace7['leg']===0x2&&(_0x4e4f83=_0x4e4f83['substring'](0x0,_0x4e4f83['lastIndexOf'](','))+',0'),CollatorService['getDimensionsById']([..._0x12ace7['config']['ancestors'],_0x12ace7['metadata']['aid']],_0x4e4f83);}static['resolveReentryDimension'](_0x3c7f2c){const _0x2d5f64=_0x3c7f2c['config']['ancestor'],_0x232586=_0x3c7f2c['config']['ancestors'],_0x3e2cf6=_0x232586['indexOf'](_0x2d5f64),_0x1f0a3c=_0x3c7f2c['metadata']['dad']['split'](',');return _0x1f0a3c['length']=_0x3e2cf6+0x1,_0x1f0a3c['push']('0'),_0x1f0a3c['join'](',');}static async['notarizeEntry'](_0x3d09a1,_0x1c0616){const _0x310eec=await _0x3d09a1['store']['collate'](_0x3d09a1['context']['metadata']['jid'],_0x3d09a1['metadata']['aid'],-0x5af3107a4000,this['getDimensionalAddress'](_0x3d09a1),_0x1c0616);return this['verifyInteger'](_0x310eec,0x1,'enter'),_0x310eec;}static async['authorizeReentry'](_0x52c015,_0x10e87c){const _0x36ccdb=await _0x52c015['store']['collate'](_0x52c015['context']['metadata']['jid'],_0x52c015['metadata']['aid'],-0x9184e72a000,this['getDimensionalAddress'](_0x52c015),_0x10e87c);return _0x36ccdb;}static async['notarizeEarlyExit'](_0x5d3405,_0x6e4352){return await _0x5d3405['store']['collate'](_0x5d3405['context']['metadata']['jid'],_0x5d3405['metadata']['aid'],-0xa012317b000,this['getDimensionalAddress'](_0x5d3405),_0x6e4352);}static async['notarizeEarlyCompletion'](_0x7f4aa7,_0x338e63){const _0x4c9d1a=_0x7f4aa7['config']['cycle']?0x9184e72a000:0xa012317b000;return await _0x7f4aa7['store']['collate'](_0x7f4aa7['context']['metadata']['jid'],_0x7f4aa7['metadata']['aid'],0xf4241-_0x4c9d1a,this['getDimensionalAddress'](_0x7f4aa7),_0x338e63);}static async['notarizeInception'](_0x683c3,_0xbb5304,_0x375674){_0xbb5304&&await _0x683c3['store']['collateSynthetic'](_0x683c3['context']['metadata']['jid'],_0xbb5304,0xf4240,_0x375674);}static async['isInceptionOverage'](_0x52089f,_0x256421){if(_0x256421){const _0x455c25=await _0x52089f['store']['collateSynthetic'](_0x52089f['context']['metadata']['jid'],_0x256421,0xf4240);return _0x455c25>0xf4240;}return![];}static async['notarizeReentry'](_0x5d1976,_0xd329c6,_0x52c901){const _0x5841bf=_0x5d1976['context']['metadata']['jid'],_0x4aa0eb=_0x52c901||_0x5d1976['store']['transact']();await _0x5d1976['store']['collate'](_0x5841bf,_0x5d1976['metadata']['aid'],0xf4240,this['getDimensionalAddress'](_0x5d1976,!![]),_0x4aa0eb),await _0x5d1976['store']['collateSynthetic'](_0x5841bf,_0xd329c6,0xf4240,_0x4aa0eb);const [_0x5af822,_0x3dd4a3]=await _0x4aa0eb['exec'](),_0x50a796=Array['isArray'](_0x5af822)?_0x5af822[0x1]:_0x5af822,_0x3817a9=Array['isArray'](_0x3dd4a3)?_0x3dd4a3[0x1]:_0x3dd4a3;return this['verifyInteger'](_0x50a796,0x2,'enter'),this['verifySyntheticInteger'](_0x3817a9),_0x50a796;}static async['notarizeContinuation'](_0x145b5d,_0x363be2){return await _0x145b5d['store']['collate'](_0x145b5d['context']['metadata']['jid'],_0x145b5d['metadata']['aid'],0x1,this['getDimensionalAddress'](_0x145b5d),_0x363be2);}static async['notarizeCompletion'](_0x50b256,_0x355880){const _0x3ed59b=_0x50b256['config']['cycle']?0x0:0xe8d4a51000;return await _0x50b256['store']['collate'](_0x50b256['context']['metadata']['jid'],_0x50b256['metadata']['aid'],0x1-_0x3ed59b,this['getDimensionalAddress'](_0x50b256),_0x355880);}static['getDigitAtIndex'](_0x5edf41,_0x272935){const _0x5884ef=_0x5edf41['toString']();if(_0x272935<0x0||_0x272935>=_0x5884ef['length'])return null;const _0x38c5b4=parseInt(_0x5884ef[_0x272935],0xa);return _0x38c5b4;}static['getDimensionalIndex'](_0x1dccf9){const _0x211949=_0x1dccf9['toString']();if(_0x211949['length']<0x9)return null;const _0x3b51e3=_0x211949['substring'](0x3,0x9),_0x8d9219=parseInt(_0x3b51e3,0xa);return _0x8d9219-0x1;}static['isDuplicate'](_0x434726,_0x48cac8){return this['getDigitAtIndex'](_0x434726,_0x48cac8)<0x8;}static['isInactive'](_0x1ba3f1){return this['getDigitAtIndex'](_0x1ba3f1,0x2)<0x9;}static['isPrimed'](_0xf9ad8e,_0x4d4eaa){return _0x4d4eaa==0x1?_0xf9ad8e!=-0x5af3107a4000:this['getDigitAtIndex'](_0xf9ad8e,0x0)<0x9&&this['getDigitAtIndex'](_0xf9ad8e,0x1)<0x9;}static['verifySyntheticInteger'](_0xf0c419){const _0x5d08cf=_0xf0c419['toString'](),_0xcfa065=parseInt(_0x5d08cf[_0x5d08cf['length']-0x1],0xa);if(_0xcfa065>0x0)throw new errors_1['CollationError'](_0xf0c419,0x2,'enter',collator_1['CollationFaultType']['INACTIVE']);else{if(_0xf0c419>=0x1e8480)throw new errors_1['CollationError'](_0xf0c419,0x2,'enter',collator_1['CollationFaultType']['DUPLICATE']);}}static['verifyInteger'](_0x2742d1,_0x2e9b95,_0x23eb38){let _0x6e0fbb;if(_0x2e9b95===0x1&&_0x23eb38==='enter'){if(!this['isPrimed'](_0x2742d1,0x1))_0x6e0fbb=collator_1['CollationFaultType']['MISSING'];else{if(this['isDuplicate'](_0x2742d1,0x0))_0x6e0fbb=collator_1['CollationFaultType']['DUPLICATE'];else _0x2742d1!=0x331a2bfa73000&&(_0x6e0fbb=collator_1['CollationFaultType']['INVALID']);}}else{if(_0x2e9b95===0x1&&_0x23eb38==='exit'){if(_0x2742d1===-0x9184e72a000)_0x6e0fbb=collator_1['CollationFaultType']['MISSING'];else this['isDuplicate'](_0x2742d1,0x1)&&(_0x6e0fbb=collator_1['CollationFaultType']['DUPLICATE']);}else{if(_0x2e9b95===0x2&&_0x23eb38==='enter'){if(!this['isPrimed'](_0x2742d1,0x2))_0x6e0fbb=collator_1['CollationFaultType']['FORBIDDEN'];else this['isInactive'](_0x2742d1)&&(_0x6e0fbb=collator_1['CollationFaultType']['INACTIVE']);}}}if(_0x6e0fbb)throw new errors_1['CollationError'](_0x2742d1,_0x2e9b95,_0x23eb38,_0x6e0fbb);}static['getDimensionsById'](_0x2faf73,_0x27eebc){const _0x1939ed={'$ADJACENT':_0x27eebc+',0'};let _0x15c66b=_0x27eebc;return _0x2faf73['reverse']()['forEach'](_0x26eb0f=>{_0x1939ed[_0x26eb0f]=_0x15c66b,_0x15c66b=_0x15c66b['substring'](0x0,_0x15c66b['lastIndexOf'](','));}),_0x1939ed;}static['getSeed'](){return'999000000000000';}static['getTriggerSeed'](){return'888000001000001';}static['compile'](_0x1bba1b){CollatorService['bindAncestorArray'](_0x1bba1b);}static['bindAncestorArray'](_0x3898b0){_0x3898b0['forEach'](_0x31e797=>{const _0x2eaa4e={},_0x379cf3=Object['keys'](_0x31e797['activities'])['find'](_0x28e4f4=>_0x31e797['activities'][_0x28e4f4]['type']==='trigger');if(!_0x379cf3)throw new Error('collator-trigger-activity-not-found');const _0x349ad3=(_0x9b6497,_0x50adca)=>{_0x2eaa4e[_0x9b6497]=_0x50adca,_0x31e797['activities'][_0x9b6497]['ancestors']=_0x50adca;const _0x36e8c5=_0x31e797['transitions']?.[_0x9b6497]||[];_0x36e8c5['forEach'](_0x2baad4=>{_0x349ad3(_0x2baad4['to'],[..._0x50adca,_0x9b6497]);});};_0x349ad3(_0x379cf3,[]);});}static['getDimensionalSeed'](_0x3e62f3=0x0){return','+_0x3e62f3;}}exports['CollatorService']=CollatorService,CollatorService['targetLength']=0xf;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x5ecb5c,_0x2bdd7c){const _0x34b0cf=_0x5b5b,_0x124fe1=_0x5ecb5c();while(!![]){try{const _0x43eda6=-parseInt(_0x34b0cf(0x1b6))/0x1+parseInt(_0x34b0cf(0x1bc))/0x2+-parseInt(_0x34b0cf(0x1bd))/0x3+-parseInt(_0x34b0cf(0x1b8))/0x4+parseInt(_0x34b0cf(0x1bb))/0x5*(parseInt(_0x34b0cf(0x1b7))/0x6)+-parseInt(_0x34b0cf(0x1ba))/0x7+parseInt(_0x34b0cf(0x1b9))/0x8;if(_0x43eda6===_0x2bdd7c)break;else _0x124fe1['push'](_0x124fe1['shift']());}catch(_0x4f57a7){_0x124fe1['push'](_0x124fe1['shift']());}}}(_0x445b,0xed9bc));function _0x445b(){const _0x50a13a=['5YfIBaK','222606AsIXxV','3755517ZQrZWo','1587412QhYMhw','11627718TgVVxE','2399884hIuOvA','22252880ALwCiz','2928800dwcpLZ'];_0x445b=function(){return _0x50a13a;};return _0x445b();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Deployer']=void 0x0;const key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),serializer_1=require('../serializer'),pipe_1=require('../pipe'),validator_1=require('./validator'),DEFAULT_METADATA_RANGE_SIZE=0x1a,DEFAULT_DATA_RANGE_SIZE=0x104,DEFAULT_RANGE_SIZE=DEFAULT_METADATA_RANGE_SIZE+DEFAULT_DATA_RANGE_SIZE;class Deployer{constructor(_0x415613){this['manifest']=null,this['manifest']=_0x415613;}async['deploy'](_0x39e7aa,_0x140594){this['store']=_0x39e7aa,this['stream']=_0x140594,collator_1['CollatorService']['compile'](this['manifest']['app']['graphs']),this['convertActivitiesToHooks'](),this['convertTopicsToTypes'](),this['copyJobSchemas'](),this['bindBackRefs'](),this['bindParents'](),this['bindCycleTarget'](),this['resolveMappingDependencies'](),this['resolveJobMapsPaths'](),await this['generateSymKeys'](),await this['generateSymVals'](),await this['deployHookPatterns'](),await this['deployActivitySchemas'](),await this['deploySubscriptions'](),await this['deployTransitions'](),await this['deployConsumerGroups']();}['getVID'](){return{'id':this['manifest']['app']['id'],'version':this['manifest']['app']['version']};}async['generateSymKeys'](){for(const _0x50f3b7 of this['manifest']['app']['graphs']){const [,_0x1458e3]=this['findTrigger'](_0x50f3b7),_0x3d465d=_0x1458e3['subscribes'],[_0x4dbae4,_0x171937,_0x1c0030]=await this['store']['reserveSymbolRange']('$'+_0x3d465d,DEFAULT_RANGE_SIZE,'JOB'),_0x289786='',_0x891080=this['bindSymbols'](_0x4dbae4,_0x171937,_0x1c0030,_0x289786,_0x1458e3['PRODUCES']);Object['keys'](_0x891080)['length']&&await this['store']['addSymbols']('$'+_0x3d465d,_0x891080);for(const [_0x4f41de,_0x10a2f3]of Object['entries'](_0x50f3b7['activities'])){const [_0x14fbe0,_0x52aa90,_0x627e9a]=await this['store']['reserveSymbolRange'](_0x4f41de,DEFAULT_RANGE_SIZE,'ACTIVITY'),_0x5ac360=_0x4f41de+'/';this['bindSelf'](_0x10a2f3['consumes'],_0x10a2f3['produces'],_0x4f41de);const _0x4f212a=this['bindSymbols'](_0x14fbe0,_0x52aa90,_0x627e9a,_0x5ac360,_0x10a2f3['produces']);Object['keys'](_0x4f212a)['length']&&await this['store']['addSymbols'](_0x4f41de,_0x4f212a);}}}['bindSelf'](_0xee7469,_0x27f0d0,_0x1c52c0){for(const _0x1f9033 of[_0x1c52c0,'$self']){const _0x229d5a=_0xee7469[_0x1f9033];if(_0x229d5a)for(const _0x2f3a83 of _0x229d5a){!_0x27f0d0['includes'](_0x2f3a83)&&_0x27f0d0['push'](_0x2f3a83);}}}['bindSymbols'](_0x521674,_0x3bb6dd,_0x517b17,_0x20c63e,_0x851138){const _0x45d648={},_0x301b16={..._0x517b17};for(const _0x1cfa8f of _0x851138){const _0x483d98=''+_0x20c63e+_0x1cfa8f;if(!_0x301b16[_0x483d98]){if(_0x521674>_0x3bb6dd)throw new Error('Symbol\x20index\x20out\x20of\x20bounds');const _0x166568=(0x0,utils_1['getSymKey'])(_0x521674);_0x521674++,_0x45d648[_0x483d98]=_0x166568,_0x301b16[_0x483d98]=_0x166568;}}return _0x45d648;}['copyJobSchemas'](){const _0x9cc71a=this['manifest']['app']['graphs'];for(const _0x53f45e of _0x9cc71a){const _0x440252=_0x53f45e['output']?.['schema'],_0xfaca63=_0x53f45e['input']?.['schema'];if(!_0x440252&&!_0xfaca63)continue;const _0x14dc1b=_0x53f45e['activities'];for(const _0x229fb3 in _0x14dc1b){if(_0x14dc1b[_0x229fb3]['type']==='trigger'){const _0x479413=_0x14dc1b[_0x229fb3];_0x440252&&(!_0x479413['job']&&(_0x479413['job']={}),_0x479413['job']['schema']=_0x440252),_0xfaca63&&(_0x479413['output']={'schema':_0xfaca63});}}}}['bindBackRefs'](){for(const _0x2d0a73 of this['manifest']['app']['graphs']){const _0x4bde1f=_0x2d0a73['activities'],_0x564a76=this['findTrigger'](_0x2d0a73)[0x0];for(const _0x373173 in _0x4bde1f){_0x4bde1f[_0x373173]['trigger']=_0x564a76,_0x4bde1f[_0x373173]['subscribes']=_0x2d0a73['subscribes'],_0x2d0a73['publishes']&&(_0x4bde1f[_0x373173]['publishes']=_0x2d0a73['publishes']),_0x4bde1f[_0x373173]['expire']=_0x2d0a73['expire']??undefined,_0x4bde1f[_0x373173]['persistent']=_0x2d0a73['persistent']??undefined;}}}['bindCycleTarget'](){for(const _0x43dbc1 of this['manifest']['app']['graphs']){const _0x18245e=_0x43dbc1['activities'];for(const _0x44a80c in _0x18245e){const _0x348765=_0x18245e[_0x44a80c];_0x348765['type']==='cycle'&&(_0x18245e[_0x348765['ancestor']]['cycle']=!![]);}}}['convertTopicsToTypes'](){for(const _0xc71e8 of this['manifest']['app']['graphs']){const _0x49a774=_0xc71e8['activities'];for(const _0x1ce498 in _0x49a774){const _0x48a6b0=_0x49a774[_0x1ce498];['worker','await']['includes'](_0x48a6b0['type'])&&_0x48a6b0['topic']&&!_0x48a6b0['subtype']&&(_0x48a6b0['subtype']=_0x48a6b0['topic']);}}}['convertActivitiesToHooks'](){for(const _0x4c2587 of this['manifest']['app']['graphs']){const _0x503dbe=_0x4c2587['activities'];for(const _0x553284 in _0x503dbe){const _0xe0f248=_0x503dbe[_0x553284];['activity']['includes'](_0xe0f248['type'])&&(_0xe0f248['type']='hook');}}}async['bindParents'](){const _0x4b1599=this['manifest']['app']['graphs'];for(const _0x5b1a70 of _0x4b1599){if(_0x5b1a70['transitions'])for(const _0x3d083f in _0x5b1a70['transitions']){const _0x1ae1f1=_0x5b1a70['transitions'][_0x3d083f];for(const _0x34e40f of _0x1ae1f1){const _0x3d1f51=_0x34e40f['to'];_0x5b1a70['activities'][_0x3d1f51]['parent']=_0x3d083f;}_0x5b1a70['activities'][_0x3d083f]['transitions']=_0x1ae1f1;}}}['collectValues'](_0x4c9a4b,_0x411f6d){for(const [_0x1914c7,_0x145517]of Object['entries'](_0x4c9a4b)){if(_0x1914c7==='enum'||_0x1914c7==='examples'||_0x1914c7==='default'){if(Array['isArray'](_0x145517))for(const _0x37778a of _0x145517){typeof _0x37778a==='string'&&_0x37778a['length']>0x5&&_0x411f6d['add'](_0x37778a);}else typeof _0x145517==='string'&&_0x145517['length']>0x5&&_0x411f6d['add'](_0x145517);}else typeof _0x145517==='object'&&this['collectValues'](_0x145517,_0x411f6d);}}['traverse'](_0x552855,_0x35e3a5){for(const _0x47fbe9 of Object['values'](_0x552855)){typeof _0x47fbe9==='object'&&('schema'in _0x47fbe9?this['collectValues'](_0x47fbe9['schema'],_0x35e3a5):this['traverse'](_0x47fbe9,_0x35e3a5));}}async['generateSymVals'](){const _0x5439eb=new Set();for(const _0x3ff91c of this['manifest']['app']['graphs']){this['traverse'](_0x3ff91c,_0x5439eb);}const _0xf948cf=await this['store']['getSymbolValues'](),_0x2cc417=Object['keys'](_0xf948cf)['length'],_0x23fa14=Math['pow'](0x34,0x2)-0x1,_0x3e32db=serializer_1['SerializerService']['filterSymVals'](_0x2cc417,_0x23fa14,_0xf948cf,_0x5439eb);await this['store']['addSymbolValues'](_0x3e32db);}['resolveJobMapsPaths'](){function _0x53cf3d(_0x490d40){const _0x252eae=[];function _0x4cd3a4(_0x5ddbaa,_0x3daa53=[]){for(const _0x17a6fd in _0x5ddbaa){if(typeof _0x5ddbaa[_0x17a6fd]==='object'&&_0x5ddbaa[_0x17a6fd]!==null&&!('@pipe'in _0x5ddbaa[_0x17a6fd])){const _0xde2eec=[..._0x3daa53,_0x17a6fd];_0x4cd3a4(_0x5ddbaa[_0x17a6fd],_0xde2eec);}else{const _0x38c39e=[..._0x3daa53,_0x17a6fd]['join']('/');if(!_0x38c39e['includes']('[')){const _0x17cd5d='data/'+_0x38c39e;!_0x252eae['includes'](_0x17cd5d)&&_0x252eae['push'](_0x17cd5d);}else{const [_0x2d63b2,_0xdc9a3b]=_0x38c39e['split']('['),[_0x156441,_0x403fe4]=_0xdc9a3b['split'](']');if(!isNaN(parseInt(_0x156441)))for(let _0x34de51=0x0;_0x34de51<parseInt(_0x156441);_0x34de51++){const _0x26c4d5='data/'+_0x2d63b2+'/'+_0x34de51;!_0x252eae['includes'](_0x26c4d5)&&_0x252eae['push'](_0x26c4d5);}}}}}return _0x490d40&&_0x4cd3a4(_0x490d40),_0x252eae;}for(const _0x22d723 of this['manifest']['app']['graphs']){let _0x1d3d47=[];const [,_0x1b4b19]=this['findTrigger'](_0x22d723);for(const _0x458c7c in _0x22d723['activities']){const _0xdcd0aa=_0x22d723['activities'][_0x458c7c];_0x1d3d47=_0x1d3d47['concat'](_0x53cf3d(_0xdcd0aa['job']?.['maps']));}_0x1b4b19['PRODUCES']=_0x1d3d47;}}['resolveMappingDependencies'](){const _0x1ee3db=[];function _0x30be9d(_0x1b0d5c,_0x1e9b77){for(const _0x560590 in _0x1b0d5c){if(typeof _0x1b0d5c[_0x560590]==='string'){const _0x125447=_0x1b0d5c[_0x560590],_0x6520b0=_0x125447['match'](/^\{[^@].*}$/);_0x6520b0&&!validator_1['Validator']['CONTEXT_VARS']['includes'](_0x125447)&&(_0x125447['split']('.')[0x1]!=='input'&&(_0x1ee3db['push'](_0x125447),_0x1e9b77['push'](_0x125447)));}else typeof _0x1b0d5c[_0x560590]==='object'&&_0x1b0d5c[_0x560590]!==null&&_0x30be9d(_0x1b0d5c[_0x560590],_0x1e9b77);}}const _0xe52bbb=this['manifest']['app']['graphs'];for(const _0xf2933f of _0xe52bbb){const _0x22829b=_0xf2933f['activities'];for(const _0xdc40fe in _0x22829b){const _0x21c234=_0x22829b[_0xdc40fe];_0x21c234['consumes']=[],_0x30be9d(_0x21c234,_0x21c234['consumes']),_0x21c234['consumes']=this['groupMappingRules'](_0x21c234['consumes']);}}const _0x16a6af=this['groupMappingRules'](_0x1ee3db);for(const _0x702ae2 of _0xe52bbb){const _0x1eaee8=_0x702ae2['activities'];for(const _0x3f3ff4 in _0x1eaee8){const _0x26b3de=_0x1eaee8[_0x3f3ff4];_0x26b3de['produces']=_0x16a6af[''+_0x3f3ff4]||[];}}}['groupMappingRules'](_0x104cb4){_0x104cb4=Array['from'](new Set(_0x104cb4))['sort']();const _0xe2494f={};for(const _0x104637 of _0x104cb4){const [_0x36ac31,_0x2a15e5]=this['resolveMappableValue'](_0x104637);!_0xe2494f[_0x36ac31]&&(_0xe2494f[_0x36ac31]=[]),_0xe2494f[_0x36ac31]['push'](_0x2a15e5);}return _0xe2494f;}['resolveMappableValue'](_0x56ab22){_0x56ab22=_0x56ab22['substring'](0x1,_0x56ab22['length']-0x1);const _0x335707=_0x56ab22['split']('.');if(_0x335707[0x0]==='$job'){const [_0x4dc206,..._0x9d6234]=_0x335707;return[_0x4dc206,_0x9d6234['join']('/')];}else{const [_0x40c585,_0x20047c,_0x2260c6,..._0x145ea3]=_0x335707,_0x2f2a25={'hook':'hook/data','input':'input/data','output':_0x2260c6==='data'?'output/data':'output/metadata'}[_0x20047c];return[_0x40c585,_0x2f2a25+'/'+_0x145ea3['join']('/')];}}async['deployActivitySchemas'](){const _0x3936f9=this['manifest']['app']['graphs'],_0x4ecfef={};for(const _0x2acde7 of _0x3936f9){const _0xea8f63=_0x2acde7['activities'];for(const _0x2048ff in _0xea8f63){const _0x29c346=_0xea8f63[_0x2048ff];delete _0x29c346['transitions'],_0x4ecfef[_0x2048ff]=_0x29c346;}}await this['store']['setSchemas'](_0x4ecfef,this['getVID']());}async['deploySubscriptions'](){const _0x4a9b9c=this['manifest']['app']['graphs'],_0x4e6b97={};for(const _0x275e4e of _0x4a9b9c){const _0xc36a61=_0x275e4e['activities'],_0x40b306=_0x275e4e['subscribes'];for(const _0x55f66a in _0xc36a61){if(_0xc36a61[_0x55f66a]['type']==='trigger'){_0x4e6b97[_0x40b306]=_0x55f66a;break;}}}await this['store']['setSubscriptions'](_0x4e6b97,this['getVID']());}['findTrigger'](_0x15a832){for(const _0x57d292 in _0x15a832['activities']){const _0x269d99=_0x15a832['activities'][_0x57d292];if(_0x269d99['type']==='trigger')return[_0x57d292,_0x269d99];}return null;}async['deployTransitions'](){const _0x2fe11b=this['manifest']['app']['graphs'],_0x34518a={};for(const _0x5aacf6 of _0x2fe11b){if(_0x5aacf6['subscribes']&&_0x5aacf6['subscribes']['startsWith']('.')){const [_0x49dd50]=this['findTrigger'](_0x5aacf6);_0x49dd50&&(_0x34518a[_0x5aacf6['subscribes']]={[_0x49dd50]:!![]});}if(_0x5aacf6['transitions'])for(const _0x89b9c5 in _0x5aacf6['transitions']){const _0x543a67=_0x5aacf6['transitions'][_0x89b9c5],_0x2bb293={};for(const _0x42402c of _0x543a67){const _0x51cd96=_0x42402c['to'];_0x42402c['conditions']?_0x2bb293[_0x51cd96]=_0x42402c['conditions']:_0x2bb293[_0x51cd96]=!![];}Object['keys'](_0x2bb293)['length']>0x0&&(_0x34518a['.'+_0x89b9c5]=_0x2bb293);}}await this['store']['setTransitions'](_0x34518a,this['getVID']());}async['deployHookPatterns'](){const _0x11ca6d=this['manifest']['app']['graphs'],_0x1ac376={};for(const _0x451e61 of _0x11ca6d){if(_0x451e61['hooks'])for(const _0x899861 in _0x451e61['hooks']){_0x1ac376[_0x899861]=_0x451e61['hooks'][_0x899861];const _0x2edf9d=_0x451e61['hooks'][_0x899861][0x0]['to'],_0x5152f6=_0x451e61['activities'][_0x2edf9d];_0x5152f6&&(!_0x5152f6['hook']&&(_0x5152f6['hook']={}),_0x5152f6['hook']['topic']=_0x899861);}}await this['store']['setHookRules'](_0x1ac376);}async['deployConsumerGroups'](){const _0x10550d={'appId':this['manifest']['app']['id']},_0x11ee4d=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x10550d);await this['deployConsumerGroup'](_0x11ee4d,'ENGINE');for(const _0x23b773 of this['manifest']['app']['graphs']){const _0x32710c=_0x23b773['activities'];for(const _0x28954d in _0x32710c){const _0x2b22f3=_0x32710c[_0x28954d];if(_0x2b22f3['type']==='worker'&&pipe_1['Pipe']['resolve'](_0x2b22f3['subtype'],{})===_0x2b22f3['subtype']){_0x10550d['topic']=_0x2b22f3['subtype'];const _0x4f44c6=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x10550d);await this['deployConsumerGroup'](_0x4f44c6,'WORKER');}}}}async['deployConsumerGroup'](_0x24a074,_0x213a32){try{await this['stream']['createConsumerGroup'](_0x24a074,_0x213a32);}catch(_0x3681f1){this['store']['logger']['info']('router-stream-group-exists',{'stream':_0x24a074,'group':_0x213a32});}}}function _0x5b5b(_0xb600f6,_0x21ce69){const _0x445bbd=_0x445b();return _0x5b5b=function(_0x5b5bd1,_0x45d748){_0x5b5bd1=_0x5b5bd1-0x1b6;let _0x10ea24=_0x445bbd[_0x5b5bd1];return _0x10ea24;},_0x5b5b(_0xb600f6,_0x21ce69);}exports['Deployer']=Deployer;
|
|
1
|
+
'use strict';(function(_0x3bcef8,_0x27dfc6){const _0x128caf=_0x17df,_0x338aed=_0x3bcef8();while(!![]){try{const _0x3810fb=-parseInt(_0x128caf(0x1e7))/0x1+-parseInt(_0x128caf(0x1e6))/0x2*(-parseInt(_0x128caf(0x1e1))/0x3)+-parseInt(_0x128caf(0x1df))/0x4+-parseInt(_0x128caf(0x1de))/0x5*(-parseInt(_0x128caf(0x1e5))/0x6)+parseInt(_0x128caf(0x1e3))/0x7+parseInt(_0x128caf(0x1e4))/0x8*(-parseInt(_0x128caf(0x1e0))/0x9)+parseInt(_0x128caf(0x1dd))/0xa*(-parseInt(_0x128caf(0x1e2))/0xb);if(_0x3810fb===_0x27dfc6)break;else _0x338aed['push'](_0x338aed['shift']());}catch(_0x5d64a3){_0x338aed['push'](_0x338aed['shift']());}}}(_0x1dcd,0x4a399));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Deployer']=void 0x0;function _0x17df(_0x59cf3c,_0x83a83){const _0x1dcd4c=_0x1dcd();return _0x17df=function(_0x17dffe,_0x29d185){_0x17dffe=_0x17dffe-0x1dd;let _0x3164b0=_0x1dcd4c[_0x17dffe];return _0x3164b0;},_0x17df(_0x59cf3c,_0x83a83);}const key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),serializer_1=require('../serializer'),pipe_1=require('../pipe'),validator_1=require('./validator'),DEFAULT_METADATA_RANGE_SIZE=0x1a,DEFAULT_DATA_RANGE_SIZE=0x104,DEFAULT_RANGE_SIZE=DEFAULT_METADATA_RANGE_SIZE+DEFAULT_DATA_RANGE_SIZE;class Deployer{constructor(_0x41f48a){this['manifest']=null,this['manifest']=_0x41f48a;}async['deploy'](_0x56bb1e,_0x96514c){this['store']=_0x56bb1e,this['stream']=_0x96514c,collator_1['CollatorService']['compile'](this['manifest']['app']['graphs']),this['convertActivitiesToHooks'](),this['convertTopicsToTypes'](),this['copyJobSchemas'](),this['bindBackRefs'](),this['bindParents'](),this['bindCycleTarget'](),this['resolveMappingDependencies'](),this['resolveJobMapsPaths'](),await this['generateSymKeys'](),await this['generateSymVals'](),await this['deployHookPatterns'](),await this['deployActivitySchemas'](),await this['deploySubscriptions'](),await this['deployTransitions'](),await this['deployConsumerGroups']();}['getVID'](){return{'id':this['manifest']['app']['id'],'version':this['manifest']['app']['version']};}async['generateSymKeys'](){for(const _0x33f4e3 of this['manifest']['app']['graphs']){const [,_0x190390]=this['findTrigger'](_0x33f4e3),_0x2bab11=_0x190390['subscribes'],[_0xd9a2aa,_0x16d9e7,_0x261517]=await this['store']['reserveSymbolRange']('$'+_0x2bab11,DEFAULT_RANGE_SIZE,'JOB'),_0x27fc40='',_0x1b9aba=this['bindSymbols'](_0xd9a2aa,_0x16d9e7,_0x261517,_0x27fc40,_0x190390['PRODUCES']);Object['keys'](_0x1b9aba)['length']&&await this['store']['addSymbols']('$'+_0x2bab11,_0x1b9aba);for(const [_0xbed745,_0x2e57d7]of Object['entries'](_0x33f4e3['activities'])){const [_0x471553,_0x4a795f,_0x11a09d]=await this['store']['reserveSymbolRange'](_0xbed745,DEFAULT_RANGE_SIZE,'ACTIVITY'),_0x153836=_0xbed745+'/';this['bindSelf'](_0x2e57d7['consumes'],_0x2e57d7['produces'],_0xbed745);const _0x1c83c=this['bindSymbols'](_0x471553,_0x4a795f,_0x11a09d,_0x153836,_0x2e57d7['produces']);Object['keys'](_0x1c83c)['length']&&await this['store']['addSymbols'](_0xbed745,_0x1c83c);}}}['bindSelf'](_0x310e80,_0x19be79,_0x5dec9a){for(const _0x1933d1 of[_0x5dec9a,'$self']){const _0x4fed16=_0x310e80[_0x1933d1];if(_0x4fed16)for(const _0x218146 of _0x4fed16){!_0x19be79['includes'](_0x218146)&&_0x19be79['push'](_0x218146);}}}['bindSymbols'](_0x2b94bc,_0x572b74,_0x5f424e,_0x2994ca,_0x17ec9a){const _0x102635={},_0x4fd349={..._0x5f424e};for(const _0xf783d7 of _0x17ec9a){const _0x11aee0=''+_0x2994ca+_0xf783d7;if(!_0x4fd349[_0x11aee0]){if(_0x2b94bc>_0x572b74)throw new Error('Symbol\x20index\x20out\x20of\x20bounds');const _0x5e7c8c=(0x0,utils_1['getSymKey'])(_0x2b94bc);_0x2b94bc++,_0x102635[_0x11aee0]=_0x5e7c8c,_0x4fd349[_0x11aee0]=_0x5e7c8c;}}return _0x102635;}['copyJobSchemas'](){const _0x3d5be8=this['manifest']['app']['graphs'];for(const _0x38323e of _0x3d5be8){const _0x18d0fd=_0x38323e['output']?.['schema'],_0x25f864=_0x38323e['input']?.['schema'];if(!_0x18d0fd&&!_0x25f864)continue;const _0x3429b=_0x38323e['activities'];for(const _0x12318c in _0x3429b){if(_0x3429b[_0x12318c]['type']==='trigger'){const _0x581c95=_0x3429b[_0x12318c];_0x18d0fd&&(!_0x581c95['job']&&(_0x581c95['job']={}),_0x581c95['job']['schema']=_0x18d0fd),_0x25f864&&(_0x581c95['output']={'schema':_0x25f864});}}}}['bindBackRefs'](){for(const _0x191e0a of this['manifest']['app']['graphs']){const _0x3b5f25=_0x191e0a['activities'],_0x54a9f2=this['findTrigger'](_0x191e0a)[0x0];for(const _0x3251fd in _0x3b5f25){_0x3b5f25[_0x3251fd]['trigger']=_0x54a9f2,_0x3b5f25[_0x3251fd]['subscribes']=_0x191e0a['subscribes'],_0x191e0a['publishes']&&(_0x3b5f25[_0x3251fd]['publishes']=_0x191e0a['publishes']),_0x3b5f25[_0x3251fd]['expire']=_0x191e0a['expire']??undefined,_0x3b5f25[_0x3251fd]['persistent']=_0x191e0a['persistent']??undefined;}}}['bindCycleTarget'](){for(const _0x4a77d4 of this['manifest']['app']['graphs']){const _0x29db18=_0x4a77d4['activities'];for(const _0x3b65b3 in _0x29db18){const _0x23183c=_0x29db18[_0x3b65b3];_0x23183c['type']==='cycle'&&(_0x29db18[_0x23183c['ancestor']]['cycle']=!![]);}}}['convertTopicsToTypes'](){for(const _0x1671cd of this['manifest']['app']['graphs']){const _0x39fb86=_0x1671cd['activities'];for(const _0x548c10 in _0x39fb86){const _0x27f46c=_0x39fb86[_0x548c10];['worker','await']['includes'](_0x27f46c['type'])&&_0x27f46c['topic']&&!_0x27f46c['subtype']&&(_0x27f46c['subtype']=_0x27f46c['topic']);}}}['convertActivitiesToHooks'](){for(const _0x57cfe9 of this['manifest']['app']['graphs']){const _0x5b04a7=_0x57cfe9['activities'];for(const _0x216923 in _0x5b04a7){const _0x42cef3=_0x5b04a7[_0x216923];['activity']['includes'](_0x42cef3['type'])&&(_0x42cef3['type']='hook');}}}async['bindParents'](){const _0x3f9523=this['manifest']['app']['graphs'];for(const _0x59a89e of _0x3f9523){if(_0x59a89e['transitions'])for(const _0x93394 in _0x59a89e['transitions']){const _0x4ed69a=_0x59a89e['transitions'][_0x93394];for(const _0x34cb20 of _0x4ed69a){const _0x5aed00=_0x34cb20['to'];_0x59a89e['activities'][_0x5aed00]['parent']=_0x93394;}_0x59a89e['activities'][_0x93394]['transitions']=_0x4ed69a;}}}['collectValues'](_0x570021,_0x4b1aff){for(const [_0x343529,_0x564205]of Object['entries'](_0x570021)){if(_0x343529==='enum'||_0x343529==='examples'||_0x343529==='default'){if(Array['isArray'](_0x564205))for(const _0x14f47b of _0x564205){typeof _0x14f47b==='string'&&_0x14f47b['length']>0x5&&_0x4b1aff['add'](_0x14f47b);}else typeof _0x564205==='string'&&_0x564205['length']>0x5&&_0x4b1aff['add'](_0x564205);}else typeof _0x564205==='object'&&this['collectValues'](_0x564205,_0x4b1aff);}}['traverse'](_0x518907,_0x3ffba6){for(const _0xc99ff5 of Object['values'](_0x518907)){typeof _0xc99ff5==='object'&&('schema'in _0xc99ff5?this['collectValues'](_0xc99ff5['schema'],_0x3ffba6):this['traverse'](_0xc99ff5,_0x3ffba6));}}async['generateSymVals'](){const _0xd86d60=new Set();for(const _0x4d191c of this['manifest']['app']['graphs']){this['traverse'](_0x4d191c,_0xd86d60);}const _0x471a9f=await this['store']['getSymbolValues'](),_0x1d5dc5=Object['keys'](_0x471a9f)['length'],_0x514614=Math['pow'](0x34,0x2)-0x1,_0xc7706b=serializer_1['SerializerService']['filterSymVals'](_0x1d5dc5,_0x514614,_0x471a9f,_0xd86d60);await this['store']['addSymbolValues'](_0xc7706b);}['resolveJobMapsPaths'](){function _0x597560(_0x5c6aa3){const _0x30dc61=[];function _0x3585dd(_0x1fa5f5,_0x2df029=[]){for(const _0x22a8bc in _0x1fa5f5){if(typeof _0x1fa5f5[_0x22a8bc]==='object'&&_0x1fa5f5[_0x22a8bc]!==null&&!('@pipe'in _0x1fa5f5[_0x22a8bc])){const _0x26fb6a=[..._0x2df029,_0x22a8bc];_0x3585dd(_0x1fa5f5[_0x22a8bc],_0x26fb6a);}else{const _0x2be692=[..._0x2df029,_0x22a8bc]['join']('/');if(!_0x2be692['includes']('[')){const _0x35f031='data/'+_0x2be692;!_0x30dc61['includes'](_0x35f031)&&_0x30dc61['push'](_0x35f031);}else{const [_0x134bde,_0xfc9ff9]=_0x2be692['split']('['),[_0x3b9052,_0x51c1d2]=_0xfc9ff9['split'](']');if(!isNaN(parseInt(_0x3b9052)))for(let _0x5c2f16=0x0;_0x5c2f16<parseInt(_0x3b9052);_0x5c2f16++){const _0x430ade='data/'+_0x134bde+'/'+_0x5c2f16;!_0x30dc61['includes'](_0x430ade)&&_0x30dc61['push'](_0x430ade);}}}}}return _0x5c6aa3&&_0x3585dd(_0x5c6aa3),_0x30dc61;}for(const _0xb877a8 of this['manifest']['app']['graphs']){let _0x1ddec9=[];const [,_0x534098]=this['findTrigger'](_0xb877a8);for(const _0x244f53 in _0xb877a8['activities']){const _0x437eee=_0xb877a8['activities'][_0x244f53];_0x1ddec9=_0x1ddec9['concat'](_0x597560(_0x437eee['job']?.['maps']));}_0x534098['PRODUCES']=_0x1ddec9;}}['resolveMappingDependencies'](){const _0x2d32cd=[];function _0x55fefa(_0x213e4d,_0x101c08){for(const _0x1c2106 in _0x213e4d){if(typeof _0x213e4d[_0x1c2106]==='string'){const _0x524e9b=_0x213e4d[_0x1c2106],_0x258aba=_0x524e9b['match'](/^\{[^@].*}$/);_0x258aba&&!validator_1['Validator']['CONTEXT_VARS']['includes'](_0x524e9b)&&(_0x524e9b['split']('.')[0x1]!=='input'&&(_0x2d32cd['push'](_0x524e9b),_0x101c08['push'](_0x524e9b)));}else typeof _0x213e4d[_0x1c2106]==='object'&&_0x213e4d[_0x1c2106]!==null&&_0x55fefa(_0x213e4d[_0x1c2106],_0x101c08);}}const _0x2ecd13=this['manifest']['app']['graphs'];for(const _0x44ff0e of _0x2ecd13){const _0x2c37d9=_0x44ff0e['activities'];for(const _0x543deb in _0x2c37d9){const _0x182e5a=_0x2c37d9[_0x543deb];_0x182e5a['consumes']=[],_0x55fefa(_0x182e5a,_0x182e5a['consumes']),_0x182e5a['consumes']=this['groupMappingRules'](_0x182e5a['consumes']);}}const _0x7a8811=this['groupMappingRules'](_0x2d32cd);for(const _0x4e6271 of _0x2ecd13){const _0x24fd96=_0x4e6271['activities'];for(const _0x7e8e12 in _0x24fd96){const _0x302616=_0x24fd96[_0x7e8e12];_0x302616['produces']=_0x7a8811[''+_0x7e8e12]||[];}}}['groupMappingRules'](_0x774c24){_0x774c24=Array['from'](new Set(_0x774c24))['sort']();const _0x3df04c={};for(const _0x54e1c6 of _0x774c24){const [_0x553808,_0x1338f9]=this['resolveMappableValue'](_0x54e1c6);!_0x3df04c[_0x553808]&&(_0x3df04c[_0x553808]=[]),_0x3df04c[_0x553808]['push'](_0x1338f9);}return _0x3df04c;}['resolveMappableValue'](_0x294d4a){_0x294d4a=_0x294d4a['substring'](0x1,_0x294d4a['length']-0x1);const _0x372fea=_0x294d4a['split']('.');if(_0x372fea[0x0]==='$job'){const [_0x47046b,..._0x1878e5]=_0x372fea;return[_0x47046b,_0x1878e5['join']('/')];}else{const [_0x4e2c51,_0xeffd94,_0x298858,..._0x228d7d]=_0x372fea,_0x51f955={'hook':'hook/data','input':'input/data','output':_0x298858==='data'?'output/data':'output/metadata'}[_0xeffd94];return[_0x4e2c51,_0x51f955+'/'+_0x228d7d['join']('/')];}}async['deployActivitySchemas'](){const _0x4ee3e0=this['manifest']['app']['graphs'],_0x191098={};for(const _0x4fec2b of _0x4ee3e0){const _0x4dd312=_0x4fec2b['activities'];for(const _0x12c57a in _0x4dd312){const _0x1cc900=_0x4dd312[_0x12c57a];delete _0x1cc900['transitions'],_0x191098[_0x12c57a]=_0x1cc900;}}await this['store']['setSchemas'](_0x191098,this['getVID']());}async['deploySubscriptions'](){const _0x59d394=this['manifest']['app']['graphs'],_0x4a2d27={};for(const _0x3f766c of _0x59d394){const _0xf4104b=_0x3f766c['activities'],_0x47fe37=_0x3f766c['subscribes'];for(const _0x4dc7f3 in _0xf4104b){if(_0xf4104b[_0x4dc7f3]['type']==='trigger'){_0x4a2d27[_0x47fe37]=_0x4dc7f3;break;}}}await this['store']['setSubscriptions'](_0x4a2d27,this['getVID']());}['findTrigger'](_0x3af626){for(const _0x5df7a1 in _0x3af626['activities']){const _0x148625=_0x3af626['activities'][_0x5df7a1];if(_0x148625['type']==='trigger')return[_0x5df7a1,_0x148625];}return null;}async['deployTransitions'](){const _0x15955c=this['manifest']['app']['graphs'],_0x4b2a29={};for(const _0x3dbdd7 of _0x15955c){if(_0x3dbdd7['subscribes']&&_0x3dbdd7['subscribes']['startsWith']('.')){const [_0x102093]=this['findTrigger'](_0x3dbdd7);_0x102093&&(_0x4b2a29[_0x3dbdd7['subscribes']]={[_0x102093]:!![]});}if(_0x3dbdd7['transitions'])for(const _0x29a1ac in _0x3dbdd7['transitions']){const _0x3df03c=_0x3dbdd7['transitions'][_0x29a1ac],_0x1f5da3={};for(const _0x39094f of _0x3df03c){const _0x15d25e=_0x39094f['to'];_0x39094f['conditions']?_0x1f5da3[_0x15d25e]=_0x39094f['conditions']:_0x1f5da3[_0x15d25e]=!![];}Object['keys'](_0x1f5da3)['length']>0x0&&(_0x4b2a29['.'+_0x29a1ac]=_0x1f5da3);}}await this['store']['setTransitions'](_0x4b2a29,this['getVID']());}async['deployHookPatterns'](){const _0x378563=this['manifest']['app']['graphs'],_0x318022={};for(const _0x42e3f1 of _0x378563){if(_0x42e3f1['hooks'])for(const _0x5cf51f in _0x42e3f1['hooks']){_0x318022[_0x5cf51f]=_0x42e3f1['hooks'][_0x5cf51f];const _0x249b88=_0x42e3f1['hooks'][_0x5cf51f][0x0]['to'],_0x4c7de6=_0x42e3f1['activities'][_0x249b88];_0x4c7de6&&(!_0x4c7de6['hook']&&(_0x4c7de6['hook']={}),_0x4c7de6['hook']['topic']=_0x5cf51f);}}await this['store']['setHookRules'](_0x318022);}async['deployConsumerGroups'](){const _0x3b1265={'appId':this['manifest']['app']['id']},_0x13e303=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x3b1265);await this['deployConsumerGroup'](_0x13e303,'ENGINE');for(const _0x1e044b of this['manifest']['app']['graphs']){const _0x3926cb=_0x1e044b['activities'];for(const _0x5b6571 in _0x3926cb){const _0x95b771=_0x3926cb[_0x5b6571];if(_0x95b771['type']==='worker'&&pipe_1['Pipe']['resolve'](_0x95b771['subtype'],{})===_0x95b771['subtype']){_0x3b1265['topic']=_0x95b771['subtype'];const _0x563fe3=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x3b1265);await this['deployConsumerGroup'](_0x563fe3,'WORKER');}}}}async['deployConsumerGroup'](_0x3beb09,_0x2e5c60){try{await this['stream']['createConsumerGroup'](_0x3beb09,_0x2e5c60);}catch(_0x8ea0ab){this['store']['logger']['info']('router-stream-group-exists',{'stream':_0x3beb09,'group':_0x2e5c60});}}}exports['Deployer']=Deployer;function _0x1dcd(){const _0x3d2439=['124750znAOgI','63985JaOtcV','1132464VCDPPg','17370zksELK','974067BcWyhm','22seeabV','1856638DrzDUb','176PJzKzf','246TMCDst','2cFUCLb','460049VAslTf'];_0x1dcd=function(){return _0x3d2439;};return _0x1dcd();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0x3e77(){const _0x5f3243=['8PKUlbK','165oqDNNn','2436707dLJQvK','1686830LeYPph','1900385jCuosB','34598lAVeEC','5lPKwrM','15216yvErWH','3145824vbfMEQ','277404ZHjuRk'];_0x3e77=function(){return _0x5f3243;};return _0x3e77();}(function(_0x7d0eaa,_0x597253){const _0x570c87=_0xa970,_0x3ec8d1=_0x7d0eaa();while(!![]){try{const _0x558259=parseInt(_0x570c87(0x73))/0x1*(-parseInt(_0x570c87(0x7c))/0x2)+parseInt(_0x570c87(0x78))/0x3*(-parseInt(_0x570c87(0x74))/0x4)+parseInt(_0x570c87(0x7b))/0x5+-parseInt(_0x570c87(0x76))/0x6+-parseInt(_0x570c87(0x79))/0x7*(-parseInt(_0x570c87(0x77))/0x8)+-parseInt(_0x570c87(0x75))/0x9+parseInt(_0x570c87(0x7a))/0xa;if(_0x558259===_0x597253)break;else _0x3ec8d1['push'](_0x3ec8d1['shift']());}catch(_0x308c5d){_0x3ec8d1['push'](_0x3ec8d1['shift']());}}}(_0x3e77,0x32240));function _0xa970(_0x25a6c6,_0x57a853){const _0x3e7712=_0x3e77();return _0xa970=function(_0xa9707f,_0x4a92f0){_0xa9707f=_0xa9707f-0x73;let _0x2adc00=_0x3e7712[_0xa9707f];return _0x2adc00;},_0xa970(_0x25a6c6,_0x57a853);}var __createBinding=this&&this['__createBinding']||(Object['create']?function(_0x357e67,_0x28c397,_0x188149,_0x5e7243){if(_0x5e7243===undefined)_0x5e7243=_0x188149;var _0xb8b761=Object['getOwnPropertyDescriptor'](_0x28c397,_0x188149);(!_0xb8b761||('get'in _0xb8b761?!_0x28c397['__esModule']:_0xb8b761['writable']||_0xb8b761['configurable']))&&(_0xb8b761={'enumerable':!![],'get':function(){return _0x28c397[_0x188149];}}),Object['defineProperty'](_0x357e67,_0x5e7243,_0xb8b761);}:function(_0x52adb1,_0x550d4d,_0x5550b2,_0x1d4aef){if(_0x1d4aef===undefined)_0x1d4aef=_0x5550b2;_0x52adb1[_0x1d4aef]=_0x550d4d[_0x5550b2];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(_0x1dbc18,_0x4316cd){Object['defineProperty'](_0x1dbc18,'default',{'enumerable':!![],'value':_0x4316cd});}:function(_0x492eb1,_0x31643e){_0x492eb1['default']=_0x31643e;}),__importStar=this&&this['__importStar']||function(_0x2b4bf3){if(_0x2b4bf3&&_0x2b4bf3['__esModule'])return _0x2b4bf3;var _0x5399ed={};if(_0x2b4bf3!=null){for(var _0x5281f6 in _0x2b4bf3)if(_0x5281f6!=='default'&&Object['prototype']['hasOwnProperty']['call'](_0x2b4bf3,_0x5281f6))__createBinding(_0x5399ed,_0x2b4bf3,_0x5281f6);}return __setModuleDefault(_0x5399ed,_0x2b4bf3),_0x5399ed;},__importDefault=this&&this['__importDefault']||function(_0x5591d5){return _0x5591d5&&_0x5591d5['__esModule']?_0x5591d5:{'default':_0x5591d5};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['CompilerService']=void 0x0;const fs=__importStar(require('fs/promises')),path=__importStar(require('path')),json_schema_ref_parser_1=__importDefault(require('@apidevtools/json-schema-ref-parser')),js_yaml_1=__importDefault(require('js-yaml')),deployer_1=require('./deployer'),validator_1=require('./validator');class CompilerService{constructor(_0x4ea21a,_0x44ff6b,_0x19a19d){this['store']=_0x4ea21a,this['stream']=_0x44ff6b,this['logger']=_0x19a19d;}async['plan'](_0x5825cc){try{let _0x2cc14d;this['isPath'](_0x5825cc)?_0x2cc14d=await json_schema_ref_parser_1['default']['dereference'](_0x5825cc):_0x2cc14d=js_yaml_1['default']['load'](_0x5825cc);const _0x145559=new validator_1['Validator'](_0x2cc14d);return _0x145559['validate'](this['store']),_0x2cc14d;}catch(_0x142bdc){this['logger']['error']('compiler-plan-error',_0x142bdc);}}['isPath'](_0x1f06ab){return!_0x1f06ab['trim']()['startsWith']('app:');}async['deploy'](_0x42d218){try{let _0x367d7d;this['isPath'](_0x42d218)?(_0x367d7d=await json_schema_ref_parser_1['default']['dereference'](_0x42d218),await this['saveAsJSON'](_0x42d218,_0x367d7d)):_0x367d7d=js_yaml_1['default']['load'](_0x42d218);const _0x226e45=new validator_1['Validator'](_0x367d7d);_0x226e45['validate'](this['store']);const _0x3028d5=new deployer_1['Deployer'](_0x367d7d);return await _0x3028d5['deploy'](this['store'],this['stream']),await this['store']['setApp'](_0x367d7d['app']['id'],_0x367d7d['app']['version']),_0x367d7d;}catch(_0x248e08){this['logger']['error']('compiler-deploy-error',_0x248e08);}}async['activate'](_0x319628,_0x3db3fe){return await this['store']['activateAppVersion'](_0x319628,_0x3db3fe);}async['saveAsJSON'](_0x53594e,_0xbf0ccf){const _0x4014c7=JSON['stringify'](_0xbf0ccf,null,0x2),_0x489e26=path['join'](path['dirname'](_0x53594e),'.hotmesh.'+_0xbf0ccf['app']['id']+'.'+_0xbf0ccf['app']['version']+'.json');await fs['writeFile'](_0x489e26,_0x4014c7,'utf8');}}exports['CompilerService']=CompilerService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x2bf82f,_0x1c0e03){const _0xbe42f5=_0x1c0c,_0x372d73=_0x2bf82f();while(!![]){try{const _0x3d79ad=parseInt(_0xbe42f5(0x151))/0x1*(-parseInt(_0xbe42f5(0x14e))/0x2)+parseInt(_0xbe42f5(0x14f))/0x3+-parseInt(_0xbe42f5(0x153))/0x4+parseInt(_0xbe42f5(0x154))/0x5+-parseInt(_0xbe42f5(0x150))/0x6+-parseInt(_0xbe42f5(0x14d))/0x7+-parseInt(_0xbe42f5(0x155))/0x8*(-parseInt(_0xbe42f5(0x152))/0x9);if(_0x3d79ad===_0x1c0e03)break;else _0x372d73['push'](_0x372d73['shift']());}catch(_0x4ac662){_0x372d73['push'](_0x372d73['shift']());}}}(_0x5a85,0x4c1cd));function _0x1c0c(_0xcc5cd3,_0x298cb1){const _0x5a8577=_0x5a85();return _0x1c0c=function(_0x1c0cbe,_0x20339a){_0x1c0cbe=_0x1c0cbe-0x14d;let _0x52bbae=_0x5a8577[_0x1c0cbe];return _0x52bbae;},_0x1c0c(_0xcc5cd3,_0x298cb1);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Validator']=void 0x0;const pipe_1=require('../pipe');class Validator{constructor(_0x43e290){this['manifest']=null,this['activityIds']=[],this['mappingStatements']={},this['store']=null,this['manifest']=_0x43e290;}async['validate'](_0x8c5320){this['store']=_0x8c5320,this['getMappingStatements'](),this['validateActivityIds'](),this['validateReferencedActivityIds'](),this['validateMappingStatements'](),this['validateTransitions'](),this['validateTransitionConditions'](),this['validateStats'](),this['validateSchemas'](),this['validateUniqueHandledTopics'](),this['validateGraphPublishSubscribe'](),this['validateHooks'](),this['validateConditionalStatements']();}['validateActivityIds'](){const _0x2d4d0b=new Set();this['manifest']['app']['graphs']['forEach'](_0x28cb50=>{const _0x2463ad=Object['keys'](_0x28cb50['activities']);_0x2463ad['forEach'](_0x25399d=>{if(_0x2d4d0b['has'](_0x25399d))throw new Error('Duplicate\x20activity\x20id\x20found:\x20'+_0x25399d);else _0x2d4d0b['add'](_0x25399d);});}),this['activityIds']=Array['from'](_0x2d4d0b);}['isMappingStatement'](_0x3fa145){return typeof _0x3fa145==='string'&&_0x3fa145['startsWith']('{')&&_0x3fa145['endsWith']('}');}['extractMappingStatements'](_0x4ecadf,_0x17e4b1,_0x15b4b8){for(const _0x342c45 in _0x4ecadf){if(typeof _0x4ecadf[_0x342c45]==='object'&&_0x4ecadf[_0x342c45]!==null)this['extractMappingStatements'](_0x4ecadf[_0x342c45],_0x17e4b1,_0x15b4b8);else this['isMappingStatement'](_0x4ecadf[_0x342c45])&&(!_0x17e4b1[_0x15b4b8]&&(_0x17e4b1[_0x15b4b8]=[]),_0x17e4b1[_0x15b4b8]['push'](_0x4ecadf[_0x342c45]));}}['getMappingStatements'](){const _0x2794b8={};this['manifest']['app']['graphs']['forEach'](_0x1a7881=>{const _0x1fc73b=_0x1a7881['activities'];for(const _0x1ae915 in _0x1fc73b){const _0x5e27a7=_0x1fc73b[_0x1ae915];this['extractMappingStatements'](_0x5e27a7,_0x2794b8,_0x1ae915);}}),this['mappingStatements']=_0x2794b8;}['validateReferencedActivityIds'](){const _0x3a83e1=this['mappingStatements'],_0x2dcb10=this['activityIds'];for(const _0x1a8eda in _0x3a83e1){const _0x42d88a=_0x3a83e1[_0x1a8eda];_0x42d88a['forEach'](_0x345477=>{if(_0x345477['startsWith']('{')&&_0x345477['endsWith']('}')){const _0x44eadf=_0x345477['slice'](0x1,-0x1)['split']('.'),_0x42aec7=_0x44eadf[0x0];if(!(Validator['SYS_VARS']['includes'](_0x42aec7)||_0x2dcb10['includes'](_0x42aec7)||this['isFunction'](_0x345477)||this['isContextVariable'](_0x345477)))throw new Error('Mapping\x20statement\x20references\x20non-existent\x20activity:\x20'+_0x345477);}});}}['isFunction'](_0x5cc70c){return _0x5cc70c['startsWith']('{@')&&pipe_1['Pipe']['resolveFunction'](_0x5cc70c);}['isContextVariable'](_0x1254ca){return['{$input}','{$output}','{$item}','{$key}','{$index}']['includes'](_0x1254ca);}['validateMappingStatements'](){}['validateTransitions'](){}['validateTransitionConditions'](){}['validateStats'](){}['validateSchemas'](){}['validateUniqueHandledTopics'](){}['validateGraphPublishSubscribe'](){}['validateHooks'](){}['validateConditionalStatements'](){}}exports['Validator']=Validator,Validator['SYS_VARS']=['$app','$self','$graph','$job'],Validator['CONTEXT_VARS']=['{$input}','{$output}','{$item}','{$key}','{$index}'];function _0x5a85(){const _0x4b6584=['2078356zQmXqr','594485vQqpvS','9686744oavBTH','1512504xJKXam','2VcsXDp','1368945mvRykt','1779750sMNWlk','442012DyLLiQ','9taFqgr'];_0x5a85=function(){return _0x4b6584;};return _0x5a85();}
|
|
@@ -20,29 +20,31 @@ class ConnectorService {
|
|
|
20
20
|
return target.client;
|
|
21
21
|
}
|
|
22
22
|
static async initClients(target) {
|
|
23
|
-
let
|
|
24
|
-
if (!
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
store: { ...
|
|
28
|
-
stream: { ...
|
|
29
|
-
sub: { ...
|
|
23
|
+
let connection = utils_1.polyfill.providerConfig(target);
|
|
24
|
+
if (!('store' in connection)) {
|
|
25
|
+
connection = target.connection = {
|
|
26
|
+
...connection,
|
|
27
|
+
store: { ...connection },
|
|
28
|
+
stream: { ...connection },
|
|
29
|
+
sub: { ...connection },
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
if (
|
|
33
|
-
await ConnectorService.initClient(
|
|
32
|
+
if (connection.store) {
|
|
33
|
+
await ConnectorService.initClient(connection.store, target, 'store');
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
36
|
-
await ConnectorService.initClient(
|
|
35
|
+
if (connection.stream) {
|
|
36
|
+
await ConnectorService.initClient(connection.stream, target, 'stream');
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
39
|
-
await ConnectorService.initClient(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
if (connection.sub) {
|
|
39
|
+
await ConnectorService.initClient(connection.sub, target, 'sub');
|
|
40
|
+
if (connection.sub.class !== connection.store.class) {
|
|
41
|
+
connection.pub = {
|
|
42
|
+
class: connection.sub.class,
|
|
43
|
+
options: { ...connection.sub.options },
|
|
44
|
+
provider: connection.sub.provider,
|
|
45
|
+
};
|
|
46
|
+
await ConnectorService.initClient(connection.pub, target, 'pub');
|
|
47
|
+
}
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
static async initClient(ProviderConfig, target, field) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x2cc5f6,_0x2d59b4){const _0x45f9f5=_0x35e8,_0x3146bf=_0x2cc5f6();while(!![]){try{const _0x2df7d7=parseInt(_0x45f9f5(0x182))/0x1+parseInt(_0x45f9f5(0x17f))/0x2+-parseInt(_0x45f9f5(0x181))/0x3+parseInt(_0x45f9f5(0x187))/0x4*(parseInt(_0x45f9f5(0x180))/0x5)+parseInt(_0x45f9f5(0x186))/0x6+parseInt(_0x45f9f5(0x183))/0x7+-parseInt(_0x45f9f5(0x184))/0x8*(parseInt(_0x45f9f5(0x185))/0x9);if(_0x2df7d7===_0x2d59b4)break;else _0x3146bf['push'](_0x3146bf['shift']());}catch(_0xef1ac0){_0x3146bf['push'](_0x3146bf['shift']());}}}(_0xa16c,0xee600));function _0x35e8(_0x457563,_0x3555b2){const _0xa16ccb=_0xa16c();return _0x35e8=function(_0x35e860,_0x51a2c6){_0x35e860=_0x35e860-0x17f;let _0x43ffa8=_0xa16ccb[_0x35e860];return _0x43ffa8;},_0x35e8(_0x457563,_0x3555b2);}var __importDefault=this&&this['__importDefault']||function(_0x317707){return _0x317707&&_0x317707['__esModule']?_0x317707:{'default':_0x317707};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['EngineService']=void 0x0;function _0xa16c(){const _0x3b16ce=['12566696yHCmHL','9sckKCT','2538186TBrBAa','44ZnQkMj','897340ZVabpa','156455ylPaws','133269JScCWD','923121kdYGKS','3168347DeQBzK'];_0xa16c=function(){return _0x3b16ce;};return _0xa16c();}const key_1=require('../../modules/key'),enums_1=require('../../modules/enums'),utils_1=require('../../modules/utils'),activities_1=__importDefault(require('../activities')),compiler_1=require('../compiler'),exporter_1=require('../exporter'),reporter_1=require('../reporter'),router_1=require('../router'),serializer_1=require('../serializer'),factory_1=require('../search/factory'),factory_2=require('../store/factory'),factory_3=require('../stream/factory'),factory_4=require('../sub/factory'),task_1=require('../task'),stream_1=require('../../types/stream');class EngineService{constructor(){this['cacheMode']='cache',this['untilVersion']=null,this['jobCallbacks']={},this['reporting']=![],this['jobId']=0x1;}static async['init'](_0x22a731,_0x228db3,_0x11d2aa,_0x51f76e,_0x281f6b){if(_0x51f76e['engine']){const _0x3cb561=new EngineService();_0x3cb561['verifyEngineFields'](_0x51f76e),_0x3cb561['namespace']=_0x22a731,_0x3cb561['appId']=_0x228db3,_0x3cb561['guid']=_0x11d2aa,_0x3cb561['logger']=_0x281f6b,await _0x3cb561['initSearchChannel'](_0x51f76e['engine']['store']),await _0x3cb561['initStoreChannel'](_0x51f76e['engine']['store']),await _0x3cb561['initSubChannel'](_0x51f76e['engine']['sub'],_0x51f76e['engine']['pub']),await _0x3cb561['initStreamChannel'](_0x51f76e['engine']['stream'],_0x51f76e['engine']['store']),_0x3cb561['router']=await _0x3cb561['initRouter'](_0x51f76e);const _0x2fe4e4=_0x3cb561['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x3cb561['appId']});return _0x3cb561['router']['consumeMessages'](_0x2fe4e4,'ENGINE',_0x3cb561['guid'],_0x3cb561['processStreamMessage']['bind'](_0x3cb561)),_0x3cb561['taskService']=new task_1['TaskService'](_0x3cb561['store'],_0x281f6b),_0x3cb561['exporter']=new exporter_1['ExporterService'](_0x3cb561['appId'],_0x3cb561['store'],_0x281f6b),_0x3cb561['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x3cb561;}}['verifyEngineFields'](_0x573ae3){if(!(0x0,utils_1['identifyProvider'])(_0x573ae3['engine']['store'])||!(0x0,utils_1['identifyProvider'])(_0x573ae3['engine']['stream'])||!(0x0,utils_1['identifyProvider'])(_0x573ae3['engine']['sub']))throw new Error('engine\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields.');}async['initSearchChannel'](_0x1017bf,_0x2f1ac1){this['search']=await factory_1['SearchServiceFactory']['init'](_0x1017bf,_0x2f1ac1,this['namespace'],this['appId'],this['logger']);}async['initStoreChannel'](_0x5054bc){this['store']=await factory_2['StoreServiceFactory']['init'](_0x5054bc,this['namespace'],this['appId'],this['logger']);}async['initSubChannel'](_0x4ee9c2,_0xa24173){this['subscribe']=await factory_4['SubServiceFactory']['init'](_0x4ee9c2,_0xa24173,this['namespace'],this['appId'],this['guid'],this['logger']);}async['initStreamChannel'](_0x56dc6f,_0x263c8a){this['stream']=await factory_3['StreamServiceFactory']['init'](_0x56dc6f,_0x263c8a,this['namespace'],this['appId'],this['logger']);}async['initRouter'](_0x3e2162){const _0x30e809=await this['store']['getThrottleRate'](':');return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['ENGINE'],'reclaimDelay':_0x3e2162['engine']['reclaimDelay'],'reclaimCount':_0x3e2162['engine']['reclaimCount'],'throttle':_0x30e809,'readonly':_0x3e2162['engine']['readonly']},this['stream'],this['logger']);}async['fetchAndVerifyVID'](_0x552520,_0x2265fd=0x0){if(isNaN(Number(_0x552520['version']))){const _0x1998de=await this['store']['getApp'](_0x552520['id'],!![]);if(!isNaN(Number(_0x1998de['version']))){if(!this['apps'])this['apps']={};return this['apps'][_0x552520['id']]=_0x1998de,{'id':_0x552520['id'],'version':_0x1998de['version']};}else{if(_0x2265fd<0xa)return await(0x0,utils_1['sleepFor'])(enums_1['HMSH_QUORUM_DELAY_MS']*0x2),await this['fetchAndVerifyVID'](_0x552520,_0x2265fd+0x1);else this['logger']['error']('engine-vid-resolution-error',{'id':_0x552520['id'],'guid':this['guid']});}}return _0x552520;}async['getVID'](_0x2af0f9){if(this['cacheMode']==='nocache'){const _0x93486c=await this['store']['getApp'](this['appId'],!![]);if(_0x93486c['version']['toString']()===this['untilVersion']['toString']()){if(!this['apps'])this['apps']={};this['apps'][this['appId']]=_0x93486c,this['setCacheMode']('cache',_0x93486c['version']['toString']());}return{'id':this['appId'],'version':_0x93486c['version']};}else return!this['apps']&&_0x2af0f9?(this['apps']={},this['apps'][this['appId']]=_0x2af0f9,_0x2af0f9):await this['fetchAndVerifyVID']({'id':this['appId'],'version':this['apps']?.[this['appId']]['version']});}['setCacheMode'](_0x3aa598,_0x2b9126){this['logger']['info']('engine-executable-cache',{'mode':_0x3aa598,[_0x3aa598==='cache'?'target':'until']:_0x2b9126}),this['cacheMode']=_0x3aa598,this['untilVersion']=_0x2b9126;}async['routeToSubscribers'](_0x1c9479,_0x4c930d){const _0x5f40ce=this['jobCallbacks'][_0x4c930d['metadata']['jid']];_0x5f40ce&&(this['delistJobCallback'](_0x4c930d['metadata']['jid']),_0x5f40ce(_0x1c9479,_0x4c930d));}async['processWebHooks'](){this['taskService']['processWebHooks'](this['hook']['bind'](this));}async['processTimeHooks'](){this['taskService']['processTimeHooks'](this['hookTime']['bind'](this));}async['throttle'](_0x914c03){try{this['router']?.['setThrottle'](_0x914c03);}catch(_0x172cee){this['logger']['error']('engine-throttle-error',{'error':_0x172cee});}}async['initActivity'](_0x5874e5,_0x2c4723={},_0x102ca9){const [_0x56fd44,_0x2ab516]=await this['getSchema'](_0x5874e5),_0x488d9f=activities_1['default'][utils_1['polyfill']['resolveActivityType'](_0x2ab516['type'])];if(_0x488d9f){const _0x17712d=(0x0,utils_1['formatISODate'])(new Date()),_0x56d7d6={'aid':_0x56fd44,'atp':_0x2ab516['type'],'stp':_0x2ab516['subtype'],'ac':_0x17712d,'au':_0x17712d},_0x10b08a=null;return new _0x488d9f(_0x2ab516,_0x2c4723,_0x56d7d6,_0x10b08a,this,_0x102ca9);}else throw new Error('activity\x20type\x20'+_0x2ab516['type']+'\x20not\x20found');}async['getSchema'](_0xa2e5cd){const _0x2d3aec=await this['store']['getApp'](this['appId']);if(!_0x2d3aec)throw new Error('no\x20app\x20found\x20for\x20id\x20'+this['appId']);if(this['isPrivate'](_0xa2e5cd)){const _0x3012b7=_0xa2e5cd['substring'](0x1),_0x1903b1=await this['store']['getSchema'](_0x3012b7,await this['getVID'](_0x2d3aec));return[_0x3012b7,_0x1903b1];}else{const _0x5c9c69=await this['store']['getSubscription'](_0xa2e5cd,await this['getVID'](_0x2d3aec));if(_0x5c9c69){const _0x3f61b1=await this['store']['getSchema'](_0x5c9c69,await this['getVID'](_0x2d3aec));return[_0x5c9c69,_0x3f61b1];}}throw new Error('no\x20subscription\x20found\x20for\x20topic\x20'+_0xa2e5cd+'\x20in\x20app\x20'+this['appId']+'\x20for\x20app\x20version\x20'+_0x2d3aec['version']);}async['getSettings'](){return await this['store']['getSettings']();}['isPrivate'](_0x395bdc){return _0x395bdc['startsWith']('.');}async['plan'](_0xe6bafa){const _0x4bdf6c=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x4bdf6c['plan'](_0xe6bafa);}async['deploy'](_0x2b809e){const _0x19d5db=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x19d5db['deploy'](_0x2b809e);}async['getStats'](_0x15a2c8,_0x2f1541){const {id:_0x56cdb7,version:_0x4b937d}=await this['getVID'](),_0x126826=new reporter_1['ReporterService']({'id':_0x56cdb7,'version':_0x4b937d},this['store'],this['logger']),_0x3225e1=await this['resolveQuery'](_0x15a2c8,_0x2f1541);return await _0x126826['getStats'](_0x3225e1);}async['getIds'](_0x391872,_0x2ddd08,_0x2f4388=[]){const {id:_0x55307d,version:_0x3a31a4}=await this['getVID'](),_0x47e235=new reporter_1['ReporterService']({'id':_0x55307d,'version':_0x3a31a4},this['store'],this['logger']),_0x158988=await this['resolveQuery'](_0x391872,_0x2ddd08);return await _0x47e235['getIds'](_0x158988,_0x2f4388);}async['resolveQuery'](_0x3394de,_0x21e781){const _0x31f81c=await this['initActivity'](_0x3394de,_0x21e781['data']);return await _0x31f81c['getState'](),{'end':_0x21e781['end'],'start':_0x21e781['start'],'range':_0x21e781['range'],'granularity':_0x31f81c['resolveGranularity'](),'key':_0x31f81c['resolveJobKey'](_0x31f81c['createInputContext']()),'sparse':_0x21e781['sparse']};}async['processStreamMessage'](_0x27fa79){this['logger']['debug']('engine-process',{'jid':_0x27fa79['metadata']['jid'],'gid':_0x27fa79['metadata']['gid'],'dad':_0x27fa79['metadata']['dad'],'aid':_0x27fa79['metadata']['aid'],'status':_0x27fa79['status']||stream_1['StreamStatus']['SUCCESS'],'code':_0x27fa79['code']||0xc8,'type':_0x27fa79['type']});const _0x2813e8={'metadata':{'guid':_0x27fa79['metadata']['guid'],'jid':_0x27fa79['metadata']['jid'],'gid':_0x27fa79['metadata']['gid'],'dad':_0x27fa79['metadata']['dad'],'aid':_0x27fa79['metadata']['aid']},'data':_0x27fa79['data']};if(_0x27fa79['type']===stream_1['StreamDataType']['TIMEHOOK']){const _0x401871=await this['initActivity']('.'+_0x27fa79['metadata']['aid'],_0x2813e8['data'],_0x2813e8);await _0x401871['processTimeHookEvent'](_0x27fa79['metadata']['jid']);}else{if(_0x27fa79['type']===stream_1['StreamDataType']['WEBHOOK']){const _0x3bb932=await this['initActivity']('.'+_0x27fa79['metadata']['aid'],_0x2813e8['data'],_0x2813e8);await _0x3bb932['processWebHookEvent'](_0x27fa79['status'],_0x27fa79['code']);}else{if(_0x27fa79['type']===stream_1['StreamDataType']['TRANSITION']){const _0x3e5c2b=await this['initActivity']('.'+_0x27fa79['metadata']['aid'],_0x2813e8['data'],_0x2813e8);await _0x3e5c2b['process']();}else{if(_0x27fa79['type']===stream_1['StreamDataType']['AWAIT']){_0x2813e8['metadata']={..._0x2813e8['metadata'],'pj':_0x27fa79['metadata']['jid'],'pg':_0x27fa79['metadata']['gid'],'pd':_0x27fa79['metadata']['dad'],'pa':_0x27fa79['metadata']['aid'],'px':_0x27fa79['metadata']['await']===![],'trc':_0x27fa79['metadata']['trc'],'spn':_0x27fa79['metadata']['spn']};const _0x43877f=await this['initActivity'](_0x27fa79['metadata']['topic'],_0x27fa79['data'],_0x2813e8);await _0x43877f['process']();}else{if(_0x27fa79['type']===stream_1['StreamDataType']['RESULT']){const _0x53fe90=await this['initActivity']('.'+_0x2813e8['metadata']['aid'],_0x27fa79['data'],_0x2813e8);await _0x53fe90['processEvent'](_0x27fa79['status'],_0x27fa79['code']);}else{const _0x46d26c=await this['initActivity']('.'+_0x27fa79['metadata']['aid'],_0x27fa79['data'],_0x2813e8);await _0x46d26c['processEvent'](_0x27fa79['status'],_0x27fa79['code'],'output');}}}}}this['logger']['debug']('engine-process-end',{'jid':_0x27fa79['metadata']['jid'],'gid':_0x27fa79['metadata']['gid'],'aid':_0x27fa79['metadata']['aid']});}async['execAdjacentParent'](_0x510ca7,_0x428415,_0x544911=![]){if(this['hasParentJob'](_0x510ca7)){const _0x206498=this['resolveError'](_0x428415['metadata']),_0x3e9dbe=_0x510ca7['$self']?.['output']?.['metadata']?.['l2s']||_0x510ca7['$self']?.['output']?.['metadata']?.['l1s'],_0x152448={'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0x510ca7['metadata']['pj'],'gid':_0x510ca7['metadata']['pg'],'dad':_0x510ca7['metadata']['pd'],'aid':_0x510ca7['metadata']['pa'],'trc':_0x510ca7['metadata']['trc'],'spn':_0x3e9dbe},'type':stream_1['StreamDataType']['RESULT'],'data':_0x428415['data']};if(_0x206498&&_0x206498['code'])_0x152448['status']=stream_1['StreamStatus']['ERROR'],_0x152448['data']=_0x206498,_0x152448['code']=_0x206498['code'],_0x152448['stack']=_0x206498['stack'];else _0x544911?(_0x152448['status']=stream_1['StreamStatus']['PENDING'],_0x152448['code']=enums_1['HMSH_CODE_PENDING']):(_0x152448['status']=stream_1['StreamStatus']['SUCCESS'],_0x152448['code']=enums_1['HMSH_CODE_SUCCESS']);return await this['router']?.['publishMessage'](null,_0x152448);}}['hasParentJob'](_0x9e3082,_0x2a3f51=![]){if(_0x2a3f51)return Boolean(_0x9e3082['metadata']['pj']&&_0x9e3082['metadata']['pa']&&!_0x9e3082['metadata']['px']);return Boolean(_0x9e3082['metadata']['pj']&&_0x9e3082['metadata']['pa']);}['resolveError'](_0x4fbca7){if(_0x4fbca7&&_0x4fbca7['err'])return JSON['parse'](_0x4fbca7['err']);}async['interrupt'](_0x2322d8,_0x537bc4,_0x5b7b06={}){await this['store']['interrupt'](_0x2322d8,_0x537bc4,_0x5b7b06);const _0x2e2ef8=await this['getState'](_0x2322d8,_0x537bc4),_0x4bd6a7={'interrupt':_0x5b7b06['descend'],'expire':_0x5b7b06['expire']};return await this['runJobCompletionTasks'](_0x2e2ef8,_0x4bd6a7);}async['scrub'](_0x2a2b4b){await this['store']['scrub'](_0x2a2b4b);}async['hook'](_0x2338f3,_0x4b63b9,_0x5b676b=stream_1['StreamStatus']['SUCCESS'],_0x43addc=0xc8){const _0x5f36a1=await this['taskService']['getHookRule'](_0x2338f3),[_0xbcc3d3]=await this['getSchema']('.'+_0x5f36a1['to']),_0x5d3bda={'type':stream_1['StreamDataType']['WEBHOOK'],'status':_0x5b676b,'code':_0x43addc,'metadata':{'guid':(0x0,utils_1['guid'])(),'aid':_0xbcc3d3,'topic':_0x2338f3},'data':_0x4b63b9};return await this['router']?.['publishMessage'](null,_0x5d3bda);}async['hookTime'](_0xa856dd,_0x5d343d,_0x2e95b0,_0x21296d){if(_0x21296d==='interrupt'||_0x21296d==='expire')return await this['interrupt'](_0x2e95b0,_0xa856dd,{'suppress':!![],'expire':0x1});const [_0x309a7e,..._0x16558b]=_0x2e95b0['split'](','),_0x30bb4a=','+_0x16558b['join'](','),_0x5d9958={'type':stream_1['StreamDataType']['TIMEHOOK'],'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0xa856dd,'gid':_0x5d343d,'dad':_0x30bb4a,'aid':_0x309a7e},'data':{'timestamp':Date['now']()}};await this['router']?.['publishMessage'](null,_0x5d9958);}async['hookAll'](_0x3895dd,_0x1142b2,_0xdb6807,_0x25b4fd=[]){const _0x1e3dca=await this['getVID'](),_0xe9a762=await this['taskService']['getHookRule'](_0x3895dd);if(_0xe9a762){const _0xe68af2=await(0x0,utils_1['getSubscriptionTopic'])(_0xe9a762['to'],this['store'],_0x1e3dca),_0x1c9b29=await this['resolveQuery'](_0xe68af2,_0xdb6807),_0x4256fd=new reporter_1['ReporterService'](_0x1e3dca,this['store'],this['logger']),_0x17e86f=await _0x4256fd['getWorkItems'](_0x1c9b29,_0x25b4fd);if(_0x17e86f['length']){const _0x5a61a9=new task_1['TaskService'](this['store'],this['logger']);await _0x5a61a9['enqueueWorkItems'](_0x17e86f['map'](_0x1ba53b=>[_0x3895dd,_0x1ba53b,_0xdb6807['scrub']||![],JSON['stringify'](_0x1142b2)]['join'](key_1['VALSEP']))),this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'work','originator':this['guid']},this['appId']);}return _0x17e86f;}else throw new Error('unable\x20to\x20find\x20hook\x20rule\x20for\x20topic\x20'+_0x3895dd);}async['pub'](_0x33764f,_0x19bc66,_0x2a5fbb,_0x1a67c3){const _0x1647aa=await this['initActivity'](_0x33764f,_0x19bc66,_0x2a5fbb);if(_0x1647aa)return await _0x1647aa['process'](_0x1a67c3);else throw new Error('unable\x20to\x20process\x20activity\x20for\x20topic\x20'+_0x33764f);}async['sub'](_0x4b2d69,_0x275be4){const _0x3a803f=async(_0x36ce3a,_0x5e8740)=>{_0x275be4(_0x5e8740['topic'],_0x5e8740['job']);};return await this['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x3a803f,this['appId'],_0x4b2d69);}async['unsub'](_0x197ddc){return await this['subscribe']['unsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0x197ddc);}async['psub'](_0x346f45,_0x1dcc19){const _0x286cff=async(_0x164945,_0x233487)=>{_0x1dcc19(_0x233487['topic'],_0x233487['job']);};return await this['subscribe']['psubscribe'](key_1['KeyType']['QUORUM'],_0x286cff,this['appId'],_0x346f45);}async['punsub'](_0x505d5e){return await this['subscribe']['punsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0x505d5e);}async['pubsub'](_0x359843,_0x3f5249,_0x19e46a,_0x2a8523=enums_1['HMSH_OTT_WAIT_TIME']){_0x19e46a={'metadata':{'ngn':this['guid'],'trc':_0x19e46a?.['metadata']?.['trc'],'spn':_0x19e46a?.['metadata']?.['spn']}};const _0x22b2a0=await this['pub'](_0x359843,_0x3f5249,_0x19e46a);return new Promise((_0x4f2dcf,_0x3d1571)=>{this['registerJobCallback'](_0x22b2a0,(_0x457459,_0x3a794a)=>{if(_0x3a794a['metadata']['err']){const _0x449af1=JSON['parse'](_0x3a794a['metadata']['err']);_0x3d1571({..._0x449af1,'job_id':_0x3a794a['metadata']['jid']});}else _0x4f2dcf(_0x3a794a);}),setTimeout(()=>{this['delistJobCallback'](_0x22b2a0),_0x3d1571({'code':enums_1['HMSH_CODE_TIMEOUT'],'message':'timeout','job_id':_0x22b2a0});},_0x2a8523);});}async['pubOneTimeSubs'](_0x13ce9b,_0x8663c,_0x4dd87c=![]){if(this['hasOneTimeSubscription'](_0x13ce9b)){const _0xe109ba={'type':'job','topic':_0x13ce9b['metadata']['jid'],'job':(0x0,utils_1['restoreHierarchy'])(_0x8663c)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0xe109ba,this['appId'],_0x13ce9b['metadata']['ngn']);}}async['getPublishesTopic'](_0x4956f5){const _0x336f04=await this['getVID'](),_0x346fc7=_0x4956f5['metadata']['aid']||_0x4956f5['$self']?.['output']?.['metadata']?.['aid'],_0xfb8285=await this['store']['getSchema'](_0x346fc7,_0x336f04);return _0xfb8285['publishes'];}async['pubPermSubs'](_0x55d1e3,_0x13f729,_0x1467d6=![]){const _0x56903b=await this['getPublishesTopic'](_0x55d1e3);if(_0x56903b){const _0x499dec={'type':'job','topic':_0x56903b,'job':(0x0,utils_1['restoreHierarchy'])(_0x13f729)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0x499dec,this['appId'],_0x56903b+'.'+_0x55d1e3['metadata']['jid']);}}async['add'](_0x17efc9){return await this['router']?.['publishMessage'](null,_0x17efc9);}['registerJobCallback'](_0x4db8ed,_0x24b7bc){this['jobCallbacks'][_0x4db8ed]=_0x24b7bc;}['delistJobCallback'](_0x2b366e){delete this['jobCallbacks'][_0x2b366e];}['hasOneTimeSubscription'](_0xd7369d){return Boolean(_0xd7369d['metadata']['ngn']);}async['runJobCompletionTasks'](_0x1af7b9,_0x326794={}){const _0x51d269=this['hasParentJob'](_0x1af7b9,!![]),_0x4e5922=this['hasOneTimeSubscription'](_0x1af7b9),_0x1cc038=await this['getPublishesTopic'](_0x1af7b9);let _0x532475;if(_0x51d269||_0x4e5922||_0x1cc038){const _0x4d690b=await this['getState'](_0x1af7b9['metadata']['tpc'],_0x1af7b9['metadata']['jid']);_0x532475=await this['execAdjacentParent'](_0x1af7b9,_0x4d690b,_0x326794['emit']),this['pubOneTimeSubs'](_0x1af7b9,_0x4d690b,_0x326794['emit']),this['pubPermSubs'](_0x1af7b9,_0x4d690b,_0x326794['emit']);}return!_0x326794['emit']&&this['taskService']['registerJobForCleanup'](_0x1af7b9['metadata']['jid'],this['resolveExpires'](_0x1af7b9,_0x326794),_0x326794),_0x532475;}['resolveExpires'](_0xe79e71,_0x44572e){return _0x44572e['expire']??_0xe79e71['metadata']['expire']??enums_1['HMSH_EXPIRE_JOB_SECONDS'];}async['export'](_0x3a2043){return await this['exporter']['export'](_0x3a2043);}async['getRaw'](_0x587e89){return await this['store']['getRaw'](_0x587e89);}async['getStatus'](_0x809de7){const {id:_0x2a56cd}=await this['getVID']();return await this['store']['getStatus'](_0x809de7,_0x2a56cd);}async['getState'](_0x4ee208,_0x3368f4){const _0x500af1=await this['store']['getSymbols']('$'+_0x4ee208),_0x156ef5={['$'+_0x4ee208]:Object['keys'](_0x500af1)},_0xd469b9={},_0x565eb7=await this['store']['getState'](_0x3368f4,_0x156ef5,_0xd469b9);if(!_0x565eb7)throw new Error('not\x20found\x20'+_0x3368f4);const [_0x29bf03,_0x5c7e6d]=_0x565eb7,_0x54e4c3=(0x0,utils_1['restoreHierarchy'])(_0x29bf03);return _0x5c7e6d&&_0x54e4c3['metadata']&&(_0x54e4c3['metadata']['js']=_0x5c7e6d),_0x54e4c3;}async['getQueryState'](_0x35a911,_0x4a25af){return await this['store']['getQueryState'](_0x35a911,_0x4a25af);}async['compress'](_0x50929f){const _0x506ef7=await this['store']['getSymbolValues'](),_0x2a6998=Object['keys'](_0x506ef7)['length'],_0x8f9d56=Math['pow'](0x34,0x2)-0x1,_0x539ef6=serializer_1['SerializerService']['filterSymVals'](_0x2a6998,_0x8f9d56,_0x506ef7,new Set(_0x50929f));return await this['store']['addSymbolValues'](_0x539ef6);}}exports['EngineService']=EngineService;
|
|
1
|
+
'use strict';(function(_0x3406b5,_0x28638f){const _0x327455=_0x51cb,_0x5b8402=_0x3406b5();while(!![]){try{const _0xdafef4=parseInt(_0x327455(0x1f4))/0x1*(parseInt(_0x327455(0x1f3))/0x2)+parseInt(_0x327455(0x1eb))/0x3*(-parseInt(_0x327455(0x1ed))/0x4)+parseInt(_0x327455(0x1f2))/0x5*(-parseInt(_0x327455(0x1ec))/0x6)+parseInt(_0x327455(0x1f1))/0x7*(parseInt(_0x327455(0x1ef))/0x8)+parseInt(_0x327455(0x1f0))/0x9+-parseInt(_0x327455(0x1ea))/0xa+parseInt(_0x327455(0x1ee))/0xb;if(_0xdafef4===_0x28638f)break;else _0x5b8402['push'](_0x5b8402['shift']());}catch(_0x5e70e0){_0x5b8402['push'](_0x5b8402['shift']());}}}(_0x557b,0xb5113));var __importDefault=this&&this['__importDefault']||function(_0xe7a65f){return _0xe7a65f&&_0xe7a65f['__esModule']?_0xe7a65f:{'default':_0xe7a65f};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['EngineService']=void 0x0;function _0x557b(){const _0x132028=['43488ToJRKG','1113579wLDbDZ','826oeuOTP','75kFcViy','1009474HQdGPA','1VajaSK','9505210BEWqaC','3LkfxCP','118044xdQCwg','2194256HJwuHf','13925230RrqYBh'];_0x557b=function(){return _0x132028;};return _0x557b();}function _0x51cb(_0x3bfa25,_0x35021c){const _0x557b0d=_0x557b();return _0x51cb=function(_0x51cb94,_0x586346){_0x51cb94=_0x51cb94-0x1ea;let _0x14f1ee=_0x557b0d[_0x51cb94];return _0x14f1ee;},_0x51cb(_0x3bfa25,_0x35021c);}const key_1=require('../../modules/key'),enums_1=require('../../modules/enums'),utils_1=require('../../modules/utils'),activities_1=__importDefault(require('../activities')),compiler_1=require('../compiler'),exporter_1=require('../exporter'),reporter_1=require('../reporter'),router_1=require('../router'),serializer_1=require('../serializer'),factory_1=require('../search/factory'),factory_2=require('../store/factory'),factory_3=require('../stream/factory'),factory_4=require('../sub/factory'),task_1=require('../task'),stream_1=require('../../types/stream');class EngineService{constructor(){this['cacheMode']='cache',this['untilVersion']=null,this['jobCallbacks']={},this['reporting']=![],this['jobId']=0x1;}static async['init'](_0x2cd643,_0x581e66,_0xc87431,_0x47041e,_0x5f15f4){if(_0x47041e['engine']){const _0x220524=new EngineService();_0x220524['verifyEngineFields'](_0x47041e),_0x220524['namespace']=_0x2cd643,_0x220524['appId']=_0x581e66,_0x220524['guid']=_0xc87431,_0x220524['logger']=_0x5f15f4,await _0x220524['initSearchChannel'](_0x47041e['engine']['store']),await _0x220524['initStoreChannel'](_0x47041e['engine']['store']),await _0x220524['initSubChannel'](_0x47041e['engine']['sub'],_0x47041e['engine']['pub']??_0x47041e['engine']['store']),await _0x220524['initStreamChannel'](_0x47041e['engine']['stream'],_0x47041e['engine']['store']),_0x220524['router']=await _0x220524['initRouter'](_0x47041e);const _0x50057b=_0x220524['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x220524['appId']});return _0x220524['router']['consumeMessages'](_0x50057b,'ENGINE',_0x220524['guid'],_0x220524['processStreamMessage']['bind'](_0x220524)),_0x220524['taskService']=new task_1['TaskService'](_0x220524['store'],_0x5f15f4),_0x220524['exporter']=new exporter_1['ExporterService'](_0x220524['appId'],_0x220524['store'],_0x5f15f4),_0x220524['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x220524;}}['verifyEngineFields'](_0x4f81a1){if(!(0x0,utils_1['identifyProvider'])(_0x4f81a1['engine']['store'])||!(0x0,utils_1['identifyProvider'])(_0x4f81a1['engine']['stream'])||!(0x0,utils_1['identifyProvider'])(_0x4f81a1['engine']['sub']))throw new Error('engine\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields.');}async['initSearchChannel'](_0x2dc93b,_0x40f577){this['search']=await factory_1['SearchServiceFactory']['init'](_0x2dc93b,_0x40f577,this['namespace'],this['appId'],this['logger']);}async['initStoreChannel'](_0x41b9b3){this['store']=await factory_2['StoreServiceFactory']['init'](_0x41b9b3,this['namespace'],this['appId'],this['logger']);}async['initSubChannel'](_0x271045,_0x3dabbe){this['subscribe']=await factory_4['SubServiceFactory']['init'](_0x271045,_0x3dabbe,this['namespace'],this['appId'],this['guid'],this['logger']);}async['initStreamChannel'](_0x157329,_0x45ccfb){this['stream']=await factory_3['StreamServiceFactory']['init'](_0x157329,_0x45ccfb,this['namespace'],this['appId'],this['logger']);}async['initRouter'](_0x1262fb){const _0x12ae2c=await this['store']['getThrottleRate'](':');return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['ENGINE'],'reclaimDelay':_0x1262fb['engine']['reclaimDelay'],'reclaimCount':_0x1262fb['engine']['reclaimCount'],'throttle':_0x12ae2c,'readonly':_0x1262fb['engine']['readonly']},this['stream'],this['logger']);}async['fetchAndVerifyVID'](_0x5dae87,_0x24c78b=0x0){if(isNaN(Number(_0x5dae87['version']))){const _0x471c48=await this['store']['getApp'](_0x5dae87['id'],!![]);if(!isNaN(Number(_0x471c48['version']))){if(!this['apps'])this['apps']={};return this['apps'][_0x5dae87['id']]=_0x471c48,{'id':_0x5dae87['id'],'version':_0x471c48['version']};}else{if(_0x24c78b<0xa)return await(0x0,utils_1['sleepFor'])(enums_1['HMSH_QUORUM_DELAY_MS']*0x2),await this['fetchAndVerifyVID'](_0x5dae87,_0x24c78b+0x1);else this['logger']['error']('engine-vid-resolution-error',{'id':_0x5dae87['id'],'guid':this['guid']});}}return _0x5dae87;}async['getVID'](_0x29a480){if(this['cacheMode']==='nocache'){const _0x11750e=await this['store']['getApp'](this['appId'],!![]);if(_0x11750e['version']['toString']()===this['untilVersion']['toString']()){if(!this['apps'])this['apps']={};this['apps'][this['appId']]=_0x11750e,this['setCacheMode']('cache',_0x11750e['version']['toString']());}return{'id':this['appId'],'version':_0x11750e['version']};}else return!this['apps']&&_0x29a480?(this['apps']={},this['apps'][this['appId']]=_0x29a480,_0x29a480):await this['fetchAndVerifyVID']({'id':this['appId'],'version':this['apps']?.[this['appId']]['version']});}['setCacheMode'](_0xdad5de,_0x48b74c){this['logger']['info']('engine-executable-cache',{'mode':_0xdad5de,[_0xdad5de==='cache'?'target':'until']:_0x48b74c}),this['cacheMode']=_0xdad5de,this['untilVersion']=_0x48b74c;}async['routeToSubscribers'](_0xf51414,_0x4c3f3f){const _0x31b85d=this['jobCallbacks'][_0x4c3f3f['metadata']['jid']];_0x31b85d&&(this['delistJobCallback'](_0x4c3f3f['metadata']['jid']),_0x31b85d(_0xf51414,_0x4c3f3f));}async['processWebHooks'](){this['taskService']['processWebHooks'](this['hook']['bind'](this));}async['processTimeHooks'](){this['taskService']['processTimeHooks'](this['hookTime']['bind'](this));}async['throttle'](_0x33b867){try{this['router']?.['setThrottle'](_0x33b867);}catch(_0x32fa3d){this['logger']['error']('engine-throttle-error',{'error':_0x32fa3d});}}async['initActivity'](_0x1161eb,_0xf405c9={},_0x7b9303){const [_0x7c5036,_0x1a28d7]=await this['getSchema'](_0x1161eb),_0x2983e7=activities_1['default'][utils_1['polyfill']['resolveActivityType'](_0x1a28d7['type'])];if(_0x2983e7){const _0x31cf88=(0x0,utils_1['formatISODate'])(new Date()),_0x62e85f={'aid':_0x7c5036,'atp':_0x1a28d7['type'],'stp':_0x1a28d7['subtype'],'ac':_0x31cf88,'au':_0x31cf88},_0x56bb97=null;return new _0x2983e7(_0x1a28d7,_0xf405c9,_0x62e85f,_0x56bb97,this,_0x7b9303);}else throw new Error('activity\x20type\x20'+_0x1a28d7['type']+'\x20not\x20found');}async['getSchema'](_0x1f1c82){const _0x295d4d=await this['store']['getApp'](this['appId']);if(!_0x295d4d)throw new Error('no\x20app\x20found\x20for\x20id\x20'+this['appId']);if(this['isPrivate'](_0x1f1c82)){const _0x2c8fa8=_0x1f1c82['substring'](0x1),_0x19e1eb=await this['store']['getSchema'](_0x2c8fa8,await this['getVID'](_0x295d4d));return[_0x2c8fa8,_0x19e1eb];}else{const _0x33d8ff=await this['store']['getSubscription'](_0x1f1c82,await this['getVID'](_0x295d4d));if(_0x33d8ff){const _0x3de028=await this['store']['getSchema'](_0x33d8ff,await this['getVID'](_0x295d4d));return[_0x33d8ff,_0x3de028];}}throw new Error('no\x20subscription\x20found\x20for\x20topic\x20'+_0x1f1c82+'\x20in\x20app\x20'+this['appId']+'\x20for\x20app\x20version\x20'+_0x295d4d['version']);}async['getSettings'](){return await this['store']['getSettings']();}['isPrivate'](_0x516a9f){return _0x516a9f['startsWith']('.');}async['plan'](_0x53f98a){const _0x2e0983=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x2e0983['plan'](_0x53f98a);}async['deploy'](_0x2212db){const _0x522f57=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x522f57['deploy'](_0x2212db);}async['getStats'](_0x5d3821,_0x56003f){const {id:_0x5c2a43,version:_0x608590}=await this['getVID'](),_0x4970c4=new reporter_1['ReporterService']({'id':_0x5c2a43,'version':_0x608590},this['store'],this['logger']),_0x93fa6b=await this['resolveQuery'](_0x5d3821,_0x56003f);return await _0x4970c4['getStats'](_0x93fa6b);}async['getIds'](_0x140181,_0x5670e1,_0x577295=[]){const {id:_0x13384a,version:_0x3a4798}=await this['getVID'](),_0xd27e4c=new reporter_1['ReporterService']({'id':_0x13384a,'version':_0x3a4798},this['store'],this['logger']),_0x1b4fd5=await this['resolveQuery'](_0x140181,_0x5670e1);return await _0xd27e4c['getIds'](_0x1b4fd5,_0x577295);}async['resolveQuery'](_0x32e693,_0x1baa2f){const _0x4f94a4=await this['initActivity'](_0x32e693,_0x1baa2f['data']);return await _0x4f94a4['getState'](),{'end':_0x1baa2f['end'],'start':_0x1baa2f['start'],'range':_0x1baa2f['range'],'granularity':_0x4f94a4['resolveGranularity'](),'key':_0x4f94a4['resolveJobKey'](_0x4f94a4['createInputContext']()),'sparse':_0x1baa2f['sparse']};}async['processStreamMessage'](_0xbb81b6){this['logger']['debug']('engine-process',{'jid':_0xbb81b6['metadata']['jid'],'gid':_0xbb81b6['metadata']['gid'],'dad':_0xbb81b6['metadata']['dad'],'aid':_0xbb81b6['metadata']['aid'],'status':_0xbb81b6['status']||stream_1['StreamStatus']['SUCCESS'],'code':_0xbb81b6['code']||0xc8,'type':_0xbb81b6['type']});const _0x248ec4={'metadata':{'guid':_0xbb81b6['metadata']['guid'],'jid':_0xbb81b6['metadata']['jid'],'gid':_0xbb81b6['metadata']['gid'],'dad':_0xbb81b6['metadata']['dad'],'aid':_0xbb81b6['metadata']['aid']},'data':_0xbb81b6['data']};if(_0xbb81b6['type']===stream_1['StreamDataType']['TIMEHOOK']){const _0x4a3bf9=await this['initActivity']('.'+_0xbb81b6['metadata']['aid'],_0x248ec4['data'],_0x248ec4);await _0x4a3bf9['processTimeHookEvent'](_0xbb81b6['metadata']['jid']);}else{if(_0xbb81b6['type']===stream_1['StreamDataType']['WEBHOOK']){const _0xf3fb9d=await this['initActivity']('.'+_0xbb81b6['metadata']['aid'],_0x248ec4['data'],_0x248ec4);await _0xf3fb9d['processWebHookEvent'](_0xbb81b6['status'],_0xbb81b6['code']);}else{if(_0xbb81b6['type']===stream_1['StreamDataType']['TRANSITION']){const _0xa0503e=await this['initActivity']('.'+_0xbb81b6['metadata']['aid'],_0x248ec4['data'],_0x248ec4);await _0xa0503e['process']();}else{if(_0xbb81b6['type']===stream_1['StreamDataType']['AWAIT']){_0x248ec4['metadata']={..._0x248ec4['metadata'],'pj':_0xbb81b6['metadata']['jid'],'pg':_0xbb81b6['metadata']['gid'],'pd':_0xbb81b6['metadata']['dad'],'pa':_0xbb81b6['metadata']['aid'],'px':_0xbb81b6['metadata']['await']===![],'trc':_0xbb81b6['metadata']['trc'],'spn':_0xbb81b6['metadata']['spn']};const _0x83787d=await this['initActivity'](_0xbb81b6['metadata']['topic'],_0xbb81b6['data'],_0x248ec4);await _0x83787d['process']();}else{if(_0xbb81b6['type']===stream_1['StreamDataType']['RESULT']){const _0x4f63e3=await this['initActivity']('.'+_0x248ec4['metadata']['aid'],_0xbb81b6['data'],_0x248ec4);await _0x4f63e3['processEvent'](_0xbb81b6['status'],_0xbb81b6['code']);}else{const _0x241fff=await this['initActivity']('.'+_0xbb81b6['metadata']['aid'],_0xbb81b6['data'],_0x248ec4);await _0x241fff['processEvent'](_0xbb81b6['status'],_0xbb81b6['code'],'output');}}}}}this['logger']['debug']('engine-process-end',{'jid':_0xbb81b6['metadata']['jid'],'gid':_0xbb81b6['metadata']['gid'],'aid':_0xbb81b6['metadata']['aid']});}async['execAdjacentParent'](_0x4493f7,_0x4b310d,_0x344305=![]){if(this['hasParentJob'](_0x4493f7)){const _0x45b669=this['resolveError'](_0x4b310d['metadata']),_0x2bc1c8=_0x4493f7['$self']?.['output']?.['metadata']?.['l2s']||_0x4493f7['$self']?.['output']?.['metadata']?.['l1s'],_0x3b2daf={'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0x4493f7['metadata']['pj'],'gid':_0x4493f7['metadata']['pg'],'dad':_0x4493f7['metadata']['pd'],'aid':_0x4493f7['metadata']['pa'],'trc':_0x4493f7['metadata']['trc'],'spn':_0x2bc1c8},'type':stream_1['StreamDataType']['RESULT'],'data':_0x4b310d['data']};if(_0x45b669&&_0x45b669['code'])_0x3b2daf['status']=stream_1['StreamStatus']['ERROR'],_0x3b2daf['data']=_0x45b669,_0x3b2daf['code']=_0x45b669['code'],_0x3b2daf['stack']=_0x45b669['stack'];else _0x344305?(_0x3b2daf['status']=stream_1['StreamStatus']['PENDING'],_0x3b2daf['code']=enums_1['HMSH_CODE_PENDING']):(_0x3b2daf['status']=stream_1['StreamStatus']['SUCCESS'],_0x3b2daf['code']=enums_1['HMSH_CODE_SUCCESS']);return await this['router']?.['publishMessage'](null,_0x3b2daf);}}['hasParentJob'](_0x196fe3,_0x4d716a=![]){if(_0x4d716a)return Boolean(_0x196fe3['metadata']['pj']&&_0x196fe3['metadata']['pa']&&!_0x196fe3['metadata']['px']);return Boolean(_0x196fe3['metadata']['pj']&&_0x196fe3['metadata']['pa']);}['resolveError'](_0x1bf8e7){if(_0x1bf8e7&&_0x1bf8e7['err'])return JSON['parse'](_0x1bf8e7['err']);}async['interrupt'](_0x4b7411,_0x443ea6,_0x2e652d={}){await this['store']['interrupt'](_0x4b7411,_0x443ea6,_0x2e652d);const _0x3ee5f2=await this['getState'](_0x4b7411,_0x443ea6),_0x402b38={'interrupt':_0x2e652d['descend'],'expire':_0x2e652d['expire']};return await this['runJobCompletionTasks'](_0x3ee5f2,_0x402b38);}async['scrub'](_0x59a226){await this['store']['scrub'](_0x59a226);}async['hook'](_0x1194d7,_0x5d985c,_0x5d07c4=stream_1['StreamStatus']['SUCCESS'],_0x49c5bb=0xc8){const _0x5d6710=await this['taskService']['getHookRule'](_0x1194d7),[_0x1eb9a5]=await this['getSchema']('.'+_0x5d6710['to']),_0x2a534c={'type':stream_1['StreamDataType']['WEBHOOK'],'status':_0x5d07c4,'code':_0x49c5bb,'metadata':{'guid':(0x0,utils_1['guid'])(),'aid':_0x1eb9a5,'topic':_0x1194d7},'data':_0x5d985c};return await this['router']?.['publishMessage'](null,_0x2a534c);}async['hookTime'](_0x579831,_0xe6281f,_0x3c502d,_0x28d4bf){if(_0x28d4bf==='interrupt'||_0x28d4bf==='expire')return await this['interrupt'](_0x3c502d,_0x579831,{'suppress':!![],'expire':0x1});const [_0x8dc2e2,..._0x573f93]=_0x3c502d['split'](','),_0x1b8025=','+_0x573f93['join'](','),_0x29dadc={'type':stream_1['StreamDataType']['TIMEHOOK'],'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0x579831,'gid':_0xe6281f,'dad':_0x1b8025,'aid':_0x8dc2e2},'data':{'timestamp':Date['now']()}};await this['router']?.['publishMessage'](null,_0x29dadc);}async['hookAll'](_0x4bc38f,_0x3bdafa,_0x119469,_0x82d352=[]){const _0x3c0424=await this['getVID'](),_0x5b72d6=await this['taskService']['getHookRule'](_0x4bc38f);if(_0x5b72d6){const _0x1411e8=await(0x0,utils_1['getSubscriptionTopic'])(_0x5b72d6['to'],this['store'],_0x3c0424),_0xafbc4=await this['resolveQuery'](_0x1411e8,_0x119469),_0x38a7e3=new reporter_1['ReporterService'](_0x3c0424,this['store'],this['logger']),_0x309daa=await _0x38a7e3['getWorkItems'](_0xafbc4,_0x82d352);if(_0x309daa['length']){const _0x17be5a=new task_1['TaskService'](this['store'],this['logger']);await _0x17be5a['enqueueWorkItems'](_0x309daa['map'](_0x4bd132=>[_0x4bc38f,_0x4bd132,_0x119469['scrub']||![],JSON['stringify'](_0x3bdafa)]['join'](key_1['VALSEP']))),this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'work','originator':this['guid']},this['appId']);}return _0x309daa;}else throw new Error('unable\x20to\x20find\x20hook\x20rule\x20for\x20topic\x20'+_0x4bc38f);}async['pub'](_0x19b2b1,_0x18bb46,_0x290da3,_0x200f04){const _0xbf9e1c=await this['initActivity'](_0x19b2b1,_0x18bb46,_0x290da3);if(_0xbf9e1c)return await _0xbf9e1c['process'](_0x200f04);else throw new Error('unable\x20to\x20process\x20activity\x20for\x20topic\x20'+_0x19b2b1);}async['sub'](_0x1662a9,_0x1bdcd1){const _0x36c4a9=async(_0x26a3f6,_0x2eb0b4)=>{_0x1bdcd1(_0x2eb0b4['topic'],_0x2eb0b4['job']);};return await this['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x36c4a9,this['appId'],_0x1662a9);}async['unsub'](_0x3cb75d){return await this['subscribe']['unsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0x3cb75d);}async['psub'](_0x9a3f20,_0x9232b1){const _0x3a08fe=async(_0x28b49a,_0x21b415)=>{_0x9232b1(_0x21b415['topic'],_0x21b415['job']);};return await this['subscribe']['psubscribe'](key_1['KeyType']['QUORUM'],_0x3a08fe,this['appId'],_0x9a3f20);}async['punsub'](_0x4f6e4d){return await this['subscribe']['punsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0x4f6e4d);}async['pubsub'](_0x4de6cd,_0xa0e77d,_0x69309c,_0x4965b6=enums_1['HMSH_OTT_WAIT_TIME']){_0x69309c={'metadata':{'ngn':this['guid'],'trc':_0x69309c?.['metadata']?.['trc'],'spn':_0x69309c?.['metadata']?.['spn']}};const _0x52dde3=await this['pub'](_0x4de6cd,_0xa0e77d,_0x69309c);return new Promise((_0x8b62be,_0x2a614b)=>{this['registerJobCallback'](_0x52dde3,(_0x534b39,_0x41d524)=>{if(_0x41d524['metadata']['err']){const _0x2b29d8=JSON['parse'](_0x41d524['metadata']['err']);_0x2a614b({..._0x2b29d8,'job_id':_0x41d524['metadata']['jid']});}else _0x8b62be(_0x41d524);}),setTimeout(()=>{this['delistJobCallback'](_0x52dde3),_0x2a614b({'code':enums_1['HMSH_CODE_TIMEOUT'],'message':'timeout','job_id':_0x52dde3});},_0x4965b6);});}async['pubOneTimeSubs'](_0x48560d,_0x12424c,_0x995c1a=![]){if(this['hasOneTimeSubscription'](_0x48560d)){const _0x409d9f={'type':'job','topic':_0x48560d['metadata']['jid'],'job':(0x0,utils_1['restoreHierarchy'])(_0x12424c)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0x409d9f,this['appId'],_0x48560d['metadata']['ngn']);}}async['getPublishesTopic'](_0x2bbd48){const _0x48ffba=await this['getVID'](),_0x288721=_0x2bbd48['metadata']['aid']||_0x2bbd48['$self']?.['output']?.['metadata']?.['aid'],_0xafaba2=await this['store']['getSchema'](_0x288721,_0x48ffba);return _0xafaba2['publishes'];}async['pubPermSubs'](_0x12499a,_0x4ab8b6,_0x36841b=![]){const _0x8b2162=await this['getPublishesTopic'](_0x12499a);if(_0x8b2162){const _0x5acaee={'type':'job','topic':_0x8b2162,'job':(0x0,utils_1['restoreHierarchy'])(_0x4ab8b6)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0x5acaee,this['appId'],_0x8b2162+'.'+_0x12499a['metadata']['jid']);}}async['add'](_0x2ffde2){return await this['router']?.['publishMessage'](null,_0x2ffde2);}['registerJobCallback'](_0x247570,_0x996be0){this['jobCallbacks'][_0x247570]=_0x996be0;}['delistJobCallback'](_0x27d9ed){delete this['jobCallbacks'][_0x27d9ed];}['hasOneTimeSubscription'](_0x1c724c){return Boolean(_0x1c724c['metadata']['ngn']);}async['runJobCompletionTasks'](_0x1aa0fb,_0x1da541={}){const _0x14a7f7=this['hasParentJob'](_0x1aa0fb,!![]),_0x58aa6b=this['hasOneTimeSubscription'](_0x1aa0fb),_0x46e387=await this['getPublishesTopic'](_0x1aa0fb);let _0x316783;if(_0x14a7f7||_0x58aa6b||_0x46e387){const _0x5ef65f=await this['getState'](_0x1aa0fb['metadata']['tpc'],_0x1aa0fb['metadata']['jid']);_0x316783=await this['execAdjacentParent'](_0x1aa0fb,_0x5ef65f,_0x1da541['emit']),this['pubOneTimeSubs'](_0x1aa0fb,_0x5ef65f,_0x1da541['emit']),this['pubPermSubs'](_0x1aa0fb,_0x5ef65f,_0x1da541['emit']);}return!_0x1da541['emit']&&this['taskService']['registerJobForCleanup'](_0x1aa0fb['metadata']['jid'],this['resolveExpires'](_0x1aa0fb,_0x1da541),_0x1da541),_0x316783;}['resolveExpires'](_0x330a4e,_0x2c9798){return _0x2c9798['expire']??_0x330a4e['metadata']['expire']??enums_1['HMSH_EXPIRE_JOB_SECONDS'];}async['export'](_0x18944c){return await this['exporter']['export'](_0x18944c);}async['getRaw'](_0xeb6b2d){return await this['store']['getRaw'](_0xeb6b2d);}async['getStatus'](_0x5d61b5){const {id:_0x22a606}=await this['getVID']();return await this['store']['getStatus'](_0x5d61b5,_0x22a606);}async['getState'](_0x3171df,_0x534677){const _0x29ee1f=await this['store']['getSymbols']('$'+_0x3171df),_0x58eaf4={['$'+_0x3171df]:Object['keys'](_0x29ee1f)},_0xe1a19={},_0x2f79ba=await this['store']['getState'](_0x534677,_0x58eaf4,_0xe1a19);if(!_0x2f79ba)throw new Error('not\x20found\x20'+_0x534677);const [_0xdcc42d,_0x2d8bf2]=_0x2f79ba,_0x386575=(0x0,utils_1['restoreHierarchy'])(_0xdcc42d);return _0x2d8bf2&&_0x386575['metadata']&&(_0x386575['metadata']['js']=_0x2d8bf2),_0x386575;}async['getQueryState'](_0x208f2a,_0x1dfe56){return await this['store']['getQueryState'](_0x208f2a,_0x1dfe56);}async['compress'](_0x424824){const _0x5a739b=await this['store']['getSymbolValues'](),_0x27b20c=Object['keys'](_0x5a739b)['length'],_0x5c17dc=Math['pow'](0x34,0x2)-0x1,_0x47bcc8=serializer_1['SerializerService']['filterSymVals'](_0x27b20c,_0x5c17dc,_0x5a739b,new Set(_0x424824));return await this['store']['addSymbolValues'](_0x47bcc8);}}exports['EngineService']=EngineService;
|