@hotmeshio/hotmesh 0.3.11 → 0.3.12
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 +6 -8
- package/build/modules/key.js +1 -1
- package/build/modules/utils.js +1 -1
- package/build/package.json +4 -4
- 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/engine/index.js +1 -1
- package/build/services/exporter/index.js +1 -1
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshdata/index.d.ts +4 -3
- package/build/services/meshdata/index.js +3 -2
- package/build/services/meshflow/client.d.ts +1 -0
- package/build/services/meshflow/client.js +18 -6
- package/build/services/meshflow/connection.d.ts +2 -2
- package/build/services/meshflow/connection.js +1 -1
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/worker.d.ts +2 -1
- package/build/services/meshflow/worker.js +27 -16
- package/build/services/meshos/index.d.ts +2 -1
- package/build/services/meshos/index.js +7 -4
- 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/factory.d.ts +2 -2
- package/build/services/search/factory.js +8 -4
- package/build/services/search/providers/postgres/postgres.d.ts +21 -0
- package/build/services/search/providers/postgres/postgres.js +1 -0
- 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.d.ts +2 -1
- package/build/services/store/providers/postgres/kvsql.js +1 -1
- package/build/services/store/providers/postgres/postgres.d.ts +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/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/manifest.d.ts +12 -3
- package/build/types/meshflow.d.ts +2 -2
- package/build/types/postgres.d.ts +1 -0
- package/build/types/provider.d.ts +7 -0
- package/package.json +4 -4
- package/types/manifest.ts +12 -3
- package/types/meshflow.ts +2 -2
- package/types/postgres.ts +2 -0
- package/types/provider.ts +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x186fc8,_0x573cba){const _0x2b20be=_0x3488,_0x2c31fd=_0x186fc8();while(!![]){try{const _0x16bcb6=-parseInt(_0x2b20be(0x1c6))/0x1+-parseInt(_0x2b20be(0x1c0))/0x2*(-parseInt(_0x2b20be(0x1ca))/0x3)+-parseInt(_0x2b20be(0x1c2))/0x4*(parseInt(_0x2b20be(0x1c8))/0x5)+parseInt(_0x2b20be(0x1c3))/0x6*(parseInt(_0x2b20be(0x1c9))/0x7)+parseInt(_0x2b20be(0x1c7))/0x8*(parseInt(_0x2b20be(0x1c4))/0x9)+-parseInt(_0x2b20be(0x1c5))/0xa*(-parseInt(_0x2b20be(0x1c1))/0xb)+-parseInt(_0x2b20be(0x1cb))/0xc;if(_0x16bcb6===_0x573cba)break;else _0x2c31fd['push'](_0x2c31fd['shift']());}catch(_0x4259d8){_0x2c31fd['push'](_0x2c31fd['shift']());}}}(_0x1ffd,0x822b9));function _0x1ffd(){const _0x299cc2=['298653aYCrTx','12054360SEzPQu','2XsJXTW','1429879XEQIAW','424780vxRxBd','2459346IOiKhd','12879kAzzpG','60ZhUbnC','552728dPzPbz','5072TZwvTl','5WAYaGA','7FEllHW'];_0x1ffd=function(){return _0x299cc2;};return _0x1ffd();}function _0x3488(_0x3c8dad,_0x29a51c){const _0x1ffd53=_0x1ffd();return _0x3488=function(_0x3488c0,_0x495296){_0x3488c0=_0x3488c0-0x1c0;let _0x348323=_0x1ffd53[_0x3488c0];return _0x348323;},_0x3488(_0x3c8dad,_0x29a51c);}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(_0x2d6f4f,_0x4dfdb4,_0x55770c,_0x4eeafa,_0x224a41,_0x25d3e4){super(_0x2d6f4f,_0x4dfdb4,_0x55770c,_0x4eeafa,_0x224a41,_0x25d3e4);}async['process'](){this['logger']['debug']('worker-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x284aeb;try{await this['verifyEntry'](),_0x284aeb=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x284aeb['startActivitySpan'](this['leg']),this['mapInputData']();const _0x4c7345=this['store']['transact'](),_0x44cff7=await this['execActivity'](_0x4c7345);await collator_1['CollatorService']['authorizeReentry'](this,_0x4c7345),await this['setState'](_0x4c7345),await this['setStatus'](0x0,_0x4c7345);const _0x536448=await _0x4c7345['exec']();_0x284aeb['mapActivityAttributes']();const _0x26e52d=this['resolveStatus'](_0x536448);return _0x284aeb['setActivityAttributes']({'app.activity.mid':_0x44cff7,'app.job.jss':_0x26e52d}),this['context']['metadata']['aid'];}catch(_0x47a7eb){if(_0x47a7eb instanceof errors_1['InactiveJobError']){this['logger']['error']('await-inactive-job-error',{..._0x47a7eb});return;}else{if(_0x47a7eb instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x47a7eb});return;}else{if(_0x47a7eb instanceof errors_1['GetStateError']){this['logger']['error']('worker-get-state-error',{..._0x47a7eb});return;}else{if(_0x47a7eb instanceof errors_1['CollationError']){if(_0x47a7eb['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',{..._0x47a7eb});}else this['logger']['error']('worker-process-error',{..._0x47a7eb});}}}_0x284aeb?.['setActivityError'](_0x47a7eb['message']);throw _0x47a7eb;}finally{_0x284aeb?.['endActivitySpan'](),this['logger']['debug']('worker-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}async['execActivity'](_0x3c0896){const _0x831a81=pipe_1['Pipe']['resolve'](this['config']['subtype'],this['context']),_0x11bfcd={'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':_0x831a81,'spn':this['context']['$self']['output']['metadata']['l1s'],'trc':this['context']['metadata']['trc']},'data':this['context']['data']};return this['config']['retry']&&(_0x11bfcd['policies']={'retry':this['config']['retry']}),await this['engine']['router']?.['publishMessage'](_0x831a81,_0x11bfcd,_0x3c0896);}}exports['Worker']=Worker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x18774e,_0x3a28c1){const _0x3a8441=_0x1dfd,_0x59ef30=_0x18774e();while(!![]){try{const _0x1da708=-parseInt(_0x3a8441(0x1ef))/0x1*(-parseInt(_0x3a8441(0x1ed))/0x2)+parseInt(_0x3a8441(0x1f1))/0x3+parseInt(_0x3a8441(0x1f2))/0x4+parseInt(_0x3a8441(0x1f3))/0x5+parseInt(_0x3a8441(0x1ee))/0x6+-parseInt(_0x3a8441(0x1f4))/0x7+-parseInt(_0x3a8441(0x1f0))/0x8;if(_0x1da708===_0x3a28c1)break;else _0x59ef30['push'](_0x59ef30['shift']());}catch(_0xb5007f){_0x59ef30['push'](_0x59ef30['shift']());}}}(_0x20e1,0x4f928));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['CollatorService']=void 0x0;const errors_1=require('../../modules/errors'),collator_1=require('../../types/collator');class CollatorService{static['assertJobActive'](_0x5a661c,_0x5c9050,_0x21dc1b,_0x1e78b6=0x0){if(_0x5a661c<=_0x1e78b6)throw new errors_1['InactiveJobError'](_0x5c9050,_0x5a661c,_0x21dc1b);}static['getDimensionalAddress'](_0xe958be,_0x33417e=![]){let _0x46cf97=_0xe958be['context']['metadata']['dad']||_0xe958be['metadata']['dad'];return _0x33417e&&_0x46cf97&&_0xe958be['leg']===0x2&&(_0x46cf97=_0x46cf97['substring'](0x0,_0x46cf97['lastIndexOf'](','))+',0'),CollatorService['getDimensionsById']([..._0xe958be['config']['ancestors'],_0xe958be['metadata']['aid']],_0x46cf97);}static['resolveReentryDimension'](_0x3987fc){const _0x424f3b=_0x3987fc['config']['ancestor'],_0x4e12d8=_0x3987fc['config']['ancestors'],_0x43bbd5=_0x4e12d8['indexOf'](_0x424f3b),_0x980566=_0x3987fc['metadata']['dad']['split'](',');return _0x980566['length']=_0x43bbd5+0x1,_0x980566['push']('0'),_0x980566['join'](',');}static async['notarizeEntry'](_0x153f7c,_0x10987b){const _0x4e4053=await _0x153f7c['store']['collate'](_0x153f7c['context']['metadata']['jid'],_0x153f7c['metadata']['aid'],-0x5af3107a4000,this['getDimensionalAddress'](_0x153f7c),_0x10987b);return this['verifyInteger'](_0x4e4053,0x1,'enter'),_0x4e4053;}static async['authorizeReentry'](_0x2f5e59,_0xa69159){const _0x5126f8=await _0x2f5e59['store']['collate'](_0x2f5e59['context']['metadata']['jid'],_0x2f5e59['metadata']['aid'],-0x9184e72a000,this['getDimensionalAddress'](_0x2f5e59),_0xa69159);return _0x5126f8;}static async['notarizeEarlyExit'](_0xae4ccf,_0xbf08b7){return await _0xae4ccf['store']['collate'](_0xae4ccf['context']['metadata']['jid'],_0xae4ccf['metadata']['aid'],-0xa012317b000,this['getDimensionalAddress'](_0xae4ccf),_0xbf08b7);}static async['notarizeEarlyCompletion'](_0x3c76a7,_0x3d6fea){const _0x554c50=_0x3c76a7['config']['cycle']?0x9184e72a000:0xa012317b000;return await _0x3c76a7['store']['collate'](_0x3c76a7['context']['metadata']['jid'],_0x3c76a7['metadata']['aid'],0xf4241-_0x554c50,this['getDimensionalAddress'](_0x3c76a7),_0x3d6fea);}static async['notarizeInception'](_0x3ea79a,_0x59afae,_0x8875b){_0x59afae&&await _0x3ea79a['store']['collateSynthetic'](_0x3ea79a['context']['metadata']['jid'],_0x59afae,0xf4240,_0x8875b);}static async['isInceptionOverage'](_0x2696c9,_0xc1ac10){if(_0xc1ac10){const _0x42eda7=await _0x2696c9['store']['collateSynthetic'](_0x2696c9['context']['metadata']['jid'],_0xc1ac10,0xf4240);return _0x42eda7>0xf4240;}return![];}static async['notarizeReentry'](_0x3c8ce8,_0x456351,_0x549856){const _0x38d410=_0x3c8ce8['context']['metadata']['jid'],_0x141b60=_0x549856||_0x3c8ce8['store']['transact']();await _0x3c8ce8['store']['collate'](_0x38d410,_0x3c8ce8['metadata']['aid'],0xf4240,this['getDimensionalAddress'](_0x3c8ce8,!![]),_0x141b60),await _0x3c8ce8['store']['collateSynthetic'](_0x38d410,_0x456351,0xf4240,_0x141b60);const [_0x1a7720,_0x192c41]=await _0x141b60['exec'](),_0x19c220=Array['isArray'](_0x1a7720)?_0x1a7720[0x1]:_0x1a7720,_0x584097=Array['isArray'](_0x192c41)?_0x192c41[0x1]:_0x192c41;return this['verifyInteger'](_0x19c220,0x2,'enter'),this['verifySyntheticInteger'](_0x584097),_0x19c220;}static async['notarizeContinuation'](_0x5c4d22,_0x3c78e6){return await _0x5c4d22['store']['collate'](_0x5c4d22['context']['metadata']['jid'],_0x5c4d22['metadata']['aid'],0x1,this['getDimensionalAddress'](_0x5c4d22),_0x3c78e6);}static async['notarizeCompletion'](_0x26d677,_0x3f0426){const _0xde2dde=_0x26d677['config']['cycle']?0x0:0xe8d4a51000;return await _0x26d677['store']['collate'](_0x26d677['context']['metadata']['jid'],_0x26d677['metadata']['aid'],0x1-_0xde2dde,this['getDimensionalAddress'](_0x26d677),_0x3f0426);}static['getDigitAtIndex'](_0x3a31b7,_0x4e9fee){const _0x12c824=_0x3a31b7['toString']();if(_0x4e9fee<0x0||_0x4e9fee>=_0x12c824['length'])return null;const _0x5a24e1=parseInt(_0x12c824[_0x4e9fee],0xa);return _0x5a24e1;}static['getDimensionalIndex'](_0x159c9a){const _0x11af83=_0x159c9a['toString']();if(_0x11af83['length']<0x9)return null;const _0x391b00=_0x11af83['substring'](0x3,0x9),_0x11c453=parseInt(_0x391b00,0xa);return _0x11c453-0x1;}static['isDuplicate'](_0x51381b,_0x3fe8fa){return this['getDigitAtIndex'](_0x51381b,_0x3fe8fa)<0x8;}static['isInactive'](_0x4e06c1){return this['getDigitAtIndex'](_0x4e06c1,0x2)<0x9;}static['isPrimed'](_0x269dfa,_0x438cfb){return _0x438cfb==0x1?_0x269dfa!=-0x5af3107a4000:this['getDigitAtIndex'](_0x269dfa,0x0)<0x9&&this['getDigitAtIndex'](_0x269dfa,0x1)<0x9;}static['verifySyntheticInteger'](_0x5c8d05){const _0x60abf5=_0x5c8d05['toString'](),_0x38705a=parseInt(_0x60abf5[_0x60abf5['length']-0x1],0xa);if(_0x38705a>0x0)throw new errors_1['CollationError'](_0x5c8d05,0x2,'enter',collator_1['CollationFaultType']['INACTIVE']);else{if(_0x5c8d05>=0x1e8480)throw new errors_1['CollationError'](_0x5c8d05,0x2,'enter',collator_1['CollationFaultType']['DUPLICATE']);}}static['verifyInteger'](_0x556ec2,_0xff818f,_0x32d112){let _0x2d53a4;if(_0xff818f===0x1&&_0x32d112==='enter'){if(!this['isPrimed'](_0x556ec2,0x1))_0x2d53a4=collator_1['CollationFaultType']['MISSING'];else{if(this['isDuplicate'](_0x556ec2,0x0))_0x2d53a4=collator_1['CollationFaultType']['DUPLICATE'];else _0x556ec2!=0x331a2bfa73000&&(_0x2d53a4=collator_1['CollationFaultType']['INVALID']);}}else{if(_0xff818f===0x1&&_0x32d112==='exit'){if(_0x556ec2===-0x9184e72a000)_0x2d53a4=collator_1['CollationFaultType']['MISSING'];else this['isDuplicate'](_0x556ec2,0x1)&&(_0x2d53a4=collator_1['CollationFaultType']['DUPLICATE']);}else{if(_0xff818f===0x2&&_0x32d112==='enter'){if(!this['isPrimed'](_0x556ec2,0x2))_0x2d53a4=collator_1['CollationFaultType']['FORBIDDEN'];else this['isInactive'](_0x556ec2)&&(_0x2d53a4=collator_1['CollationFaultType']['INACTIVE']);}}}if(_0x2d53a4)throw new errors_1['CollationError'](_0x556ec2,_0xff818f,_0x32d112,_0x2d53a4);}static['getDimensionsById'](_0x45a2e3,_0x10613c){const _0x589231={'$ADJACENT':_0x10613c+',0'};let _0xc4ed80=_0x10613c;return _0x45a2e3['reverse']()['forEach'](_0x4d6d3d=>{_0x589231[_0x4d6d3d]=_0xc4ed80,_0xc4ed80=_0xc4ed80['substring'](0x0,_0xc4ed80['lastIndexOf'](','));}),_0x589231;}static['getSeed'](){return'999000000000000';}static['getTriggerSeed'](){return'888000001000001';}static['compile'](_0x396ee6){CollatorService['bindAncestorArray'](_0x396ee6);}static['bindAncestorArray'](_0x220955){_0x220955['forEach'](_0x3e283d=>{const _0x3fa43e={},_0x524160=Object['keys'](_0x3e283d['activities'])['find'](_0x14c74e=>_0x3e283d['activities'][_0x14c74e]['type']==='trigger');if(!_0x524160)throw new Error('collator-trigger-activity-not-found');const _0x4f6ad3=(_0x4839f1,_0x2e5f8f)=>{_0x3fa43e[_0x4839f1]=_0x2e5f8f,_0x3e283d['activities'][_0x4839f1]['ancestors']=_0x2e5f8f;const _0xd46d95=_0x3e283d['transitions']?.[_0x4839f1]||[];_0xd46d95['forEach'](_0x3f80db=>{_0x4f6ad3(_0x3f80db['to'],[..._0x2e5f8f,_0x4839f1]);});};_0x4f6ad3(_0x524160,[]);});}static['getDimensionalSeed'](_0x2ca993=0x0){return','+_0x2ca993;}}function _0x1dfd(_0x2fd605,_0x4fb4e8){const _0x20e168=_0x20e1();return _0x1dfd=function(_0x1dfd51,_0x29ac16){_0x1dfd51=_0x1dfd51-0x1ed;let _0x3b40e0=_0x20e168[_0x1dfd51];return _0x3b40e0;},_0x1dfd(_0x2fd605,_0x4fb4e8);}exports['CollatorService']=CollatorService,CollatorService['targetLength']=0xf;function _0x20e1(){const _0x5e33b1=['402saGuut','12015272ZYjjuG','648906YiObEo','2595704mpgaSN','1937625Kflwtn','1139341LHzBng','1268IAROnE','2897874vsCafC'];_0x20e1=function(){return _0x5e33b1;};return _0x20e1();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x350443,_0x5f1500){const _0x36cfab=_0x3f3a,_0x4d4d69=_0x350443();while(!![]){try{const _0x142dbd=-parseInt(_0x36cfab(0x72))/0x1*(parseInt(_0x36cfab(0x6b))/0x2)+-parseInt(_0x36cfab(0x70))/0x3*(parseInt(_0x36cfab(0x6e))/0x4)+parseInt(_0x36cfab(0x6a))/0x5*(parseInt(_0x36cfab(0x6c))/0x6)+parseInt(_0x36cfab(0x69))/0x7*(parseInt(_0x36cfab(0x71))/0x8)+-parseInt(_0x36cfab(0x6f))/0x9+parseInt(_0x36cfab(0x6d))/0xa+parseInt(_0x36cfab(0x68))/0xb;if(_0x142dbd===_0x5f1500)break;else _0x4d4d69['push'](_0x4d4d69['shift']());}catch(_0x159542){_0x4d4d69['push'](_0x4d4d69['shift']());}}}(_0x3e06,0xdbf28));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Deployer']=void 0x0;function _0x3f3a(_0x237a4d,_0x501045){const _0x3e068d=_0x3e06();return _0x3f3a=function(_0x3f3a73,_0x2ed25d){_0x3f3a73=_0x3f3a73-0x68;let _0x23e37d=_0x3e068d[_0x3f3a73];return _0x23e37d;},_0x3f3a(_0x237a4d,_0x501045);}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(_0x571511){this['manifest']=null,this['manifest']=_0x571511;}async['deploy'](_0x5ada92,_0x42257c){this['store']=_0x5ada92,this['stream']=_0x42257c,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 _0x335cda of this['manifest']['app']['graphs']){const [,_0x2665c1]=this['findTrigger'](_0x335cda),_0x6343b9=_0x2665c1['subscribes'],[_0xc847d0,_0x5da40d,_0x332191]=await this['store']['reserveSymbolRange']('$'+_0x6343b9,DEFAULT_RANGE_SIZE,'JOB'),_0x2d1a8c='',_0x90ab0d=this['bindSymbols'](_0xc847d0,_0x5da40d,_0x332191,_0x2d1a8c,_0x2665c1['PRODUCES']);Object['keys'](_0x90ab0d)['length']&&await this['store']['addSymbols']('$'+_0x6343b9,_0x90ab0d);for(const [_0x15312a,_0x5b7730]of Object['entries'](_0x335cda['activities'])){const [_0x3705e8,_0x24d395,_0x1c2236]=await this['store']['reserveSymbolRange'](_0x15312a,DEFAULT_RANGE_SIZE,'ACTIVITY'),_0x432f9b=_0x15312a+'/';this['bindSelf'](_0x5b7730['consumes'],_0x5b7730['produces'],_0x15312a);const _0x49e353=this['bindSymbols'](_0x3705e8,_0x24d395,_0x1c2236,_0x432f9b,_0x5b7730['produces']);Object['keys'](_0x49e353)['length']&&await this['store']['addSymbols'](_0x15312a,_0x49e353);}}}['bindSelf'](_0x40a046,_0x1ff796,_0x3fe04b){for(const _0x1fb0fe of[_0x3fe04b,'$self']){const _0x5a537b=_0x40a046[_0x1fb0fe];if(_0x5a537b)for(const _0x173b91 of _0x5a537b){!_0x1ff796['includes'](_0x173b91)&&_0x1ff796['push'](_0x173b91);}}}['bindSymbols'](_0x271314,_0xa9bcb6,_0x1fc755,_0x446df3,_0x4e88af){const _0x57966d={},_0x1af68f={..._0x1fc755};for(const _0x596f99 of _0x4e88af){const _0x3ed331=''+_0x446df3+_0x596f99;if(!_0x1af68f[_0x3ed331]){if(_0x271314>_0xa9bcb6)throw new Error('Symbol\x20index\x20out\x20of\x20bounds');const _0x5dacb2=(0x0,utils_1['getSymKey'])(_0x271314);_0x271314++,_0x57966d[_0x3ed331]=_0x5dacb2,_0x1af68f[_0x3ed331]=_0x5dacb2;}}return _0x57966d;}['copyJobSchemas'](){const _0x4591c7=this['manifest']['app']['graphs'];for(const _0x516e11 of _0x4591c7){const _0xe9dc14=_0x516e11['output']?.['schema'],_0x4b2926=_0x516e11['input']?.['schema'];if(!_0xe9dc14&&!_0x4b2926)continue;const _0x3a762e=_0x516e11['activities'];for(const _0x4d9bf4 in _0x3a762e){if(_0x3a762e[_0x4d9bf4]['type']==='trigger'){const _0x2dbe44=_0x3a762e[_0x4d9bf4];_0xe9dc14&&(!_0x2dbe44['job']&&(_0x2dbe44['job']={}),_0x2dbe44['job']['schema']=_0xe9dc14),_0x4b2926&&(_0x2dbe44['output']={'schema':_0x4b2926});}}}}['bindBackRefs'](){for(const _0x3166b9 of this['manifest']['app']['graphs']){const _0xa7c45c=_0x3166b9['activities'],_0x3f987c=this['findTrigger'](_0x3166b9)[0x0];for(const _0x523d6a in _0xa7c45c){_0xa7c45c[_0x523d6a]['trigger']=_0x3f987c,_0xa7c45c[_0x523d6a]['subscribes']=_0x3166b9['subscribes'],_0x3166b9['publishes']&&(_0xa7c45c[_0x523d6a]['publishes']=_0x3166b9['publishes']),_0xa7c45c[_0x523d6a]['expire']=_0x3166b9['expire']??undefined,_0xa7c45c[_0x523d6a]['persistent']=_0x3166b9['persistent']??undefined;}}}['bindCycleTarget'](){for(const _0x464027 of this['manifest']['app']['graphs']){const _0x7f7bb1=_0x464027['activities'];for(const _0x4fcf7d in _0x7f7bb1){const _0x4da095=_0x7f7bb1[_0x4fcf7d];_0x4da095['type']==='cycle'&&(_0x7f7bb1[_0x4da095['ancestor']]['cycle']=!![]);}}}['convertTopicsToTypes'](){for(const _0x4d29e7 of this['manifest']['app']['graphs']){const _0x14ac0e=_0x4d29e7['activities'];for(const _0x58d2e2 in _0x14ac0e){const _0x38da44=_0x14ac0e[_0x58d2e2];['worker','await']['includes'](_0x38da44['type'])&&_0x38da44['topic']&&!_0x38da44['subtype']&&(_0x38da44['subtype']=_0x38da44['topic']);}}}['convertActivitiesToHooks'](){for(const _0x1a9aa6 of this['manifest']['app']['graphs']){const _0x45da41=_0x1a9aa6['activities'];for(const _0x1b6a06 in _0x45da41){const _0x7e7416=_0x45da41[_0x1b6a06];['activity']['includes'](_0x7e7416['type'])&&(_0x7e7416['type']='hook');}}}async['bindParents'](){const _0x255232=this['manifest']['app']['graphs'];for(const _0x56b21d of _0x255232){if(_0x56b21d['transitions'])for(const _0x3c3d7f in _0x56b21d['transitions']){const _0x24db06=_0x56b21d['transitions'][_0x3c3d7f];for(const _0x1f74cc of _0x24db06){const _0x45fde7=_0x1f74cc['to'];_0x56b21d['activities'][_0x45fde7]['parent']=_0x3c3d7f;}_0x56b21d['activities'][_0x3c3d7f]['transitions']=_0x24db06;}}}['collectValues'](_0x38c801,_0x497291){for(const [_0x619ad6,_0x559f24]of Object['entries'](_0x38c801)){if(_0x619ad6==='enum'||_0x619ad6==='examples'||_0x619ad6==='default'){if(Array['isArray'](_0x559f24))for(const _0x4f297f of _0x559f24){typeof _0x4f297f==='string'&&_0x4f297f['length']>0x5&&_0x497291['add'](_0x4f297f);}else typeof _0x559f24==='string'&&_0x559f24['length']>0x5&&_0x497291['add'](_0x559f24);}else typeof _0x559f24==='object'&&this['collectValues'](_0x559f24,_0x497291);}}['traverse'](_0xc979e0,_0x118fbb){for(const _0x62704b of Object['values'](_0xc979e0)){typeof _0x62704b==='object'&&('schema'in _0x62704b?this['collectValues'](_0x62704b['schema'],_0x118fbb):this['traverse'](_0x62704b,_0x118fbb));}}async['generateSymVals'](){const _0x20abe1=new Set();for(const _0xa0b715 of this['manifest']['app']['graphs']){this['traverse'](_0xa0b715,_0x20abe1);}const _0x597287=await this['store']['getSymbolValues'](),_0x559a93=Object['keys'](_0x597287)['length'],_0x4c185b=Math['pow'](0x34,0x2)-0x1,_0x1a98c6=serializer_1['SerializerService']['filterSymVals'](_0x559a93,_0x4c185b,_0x597287,_0x20abe1);await this['store']['addSymbolValues'](_0x1a98c6);}['resolveJobMapsPaths'](){function _0x404b94(_0x44614f){const _0x10c747=[];function _0x52a730(_0x4de549,_0x46ce11=[]){for(const _0x365eff in _0x4de549){if(typeof _0x4de549[_0x365eff]==='object'&&_0x4de549[_0x365eff]!==null&&!('@pipe'in _0x4de549[_0x365eff])){const _0x405988=[..._0x46ce11,_0x365eff];_0x52a730(_0x4de549[_0x365eff],_0x405988);}else{const _0x4285cf=[..._0x46ce11,_0x365eff]['join']('/');if(!_0x4285cf['includes']('[')){const _0x1b71a8='data/'+_0x4285cf;!_0x10c747['includes'](_0x1b71a8)&&_0x10c747['push'](_0x1b71a8);}else{const [_0xf52b76,_0x16c913]=_0x4285cf['split']('['),[_0x3c2139,_0x5220ee]=_0x16c913['split'](']');if(!isNaN(parseInt(_0x3c2139)))for(let _0x603a60=0x0;_0x603a60<parseInt(_0x3c2139);_0x603a60++){const _0x4f28b2='data/'+_0xf52b76+'/'+_0x603a60;!_0x10c747['includes'](_0x4f28b2)&&_0x10c747['push'](_0x4f28b2);}}}}}return _0x44614f&&_0x52a730(_0x44614f),_0x10c747;}for(const _0xe6b78f of this['manifest']['app']['graphs']){let _0x5f13ae=[];const [,_0x33f088]=this['findTrigger'](_0xe6b78f);for(const _0x4f21fd in _0xe6b78f['activities']){const _0x2e3e0a=_0xe6b78f['activities'][_0x4f21fd];_0x5f13ae=_0x5f13ae['concat'](_0x404b94(_0x2e3e0a['job']?.['maps']));}_0x33f088['PRODUCES']=_0x5f13ae;}}['resolveMappingDependencies'](){const _0x124f93=[];function _0x5ce800(_0x9db5c1,_0x56f39f){for(const _0x3b5078 in _0x9db5c1){if(typeof _0x9db5c1[_0x3b5078]==='string'){const _0x46ffdc=_0x9db5c1[_0x3b5078],_0x6cc8c=_0x46ffdc['match'](/^\{[^@].*}$/);_0x6cc8c&&!validator_1['Validator']['CONTEXT_VARS']['includes'](_0x46ffdc)&&(_0x46ffdc['split']('.')[0x1]!=='input'&&(_0x124f93['push'](_0x46ffdc),_0x56f39f['push'](_0x46ffdc)));}else typeof _0x9db5c1[_0x3b5078]==='object'&&_0x9db5c1[_0x3b5078]!==null&&_0x5ce800(_0x9db5c1[_0x3b5078],_0x56f39f);}}const _0x3c23d7=this['manifest']['app']['graphs'];for(const _0x160796 of _0x3c23d7){const _0x58ae98=_0x160796['activities'];for(const _0x479bda in _0x58ae98){const _0x360e87=_0x58ae98[_0x479bda];_0x360e87['consumes']=[],_0x5ce800(_0x360e87,_0x360e87['consumes']),_0x360e87['consumes']=this['groupMappingRules'](_0x360e87['consumes']);}}const _0x4cdc94=this['groupMappingRules'](_0x124f93);for(const _0x3cb652 of _0x3c23d7){const _0x2fcd5d=_0x3cb652['activities'];for(const _0x91bde0 in _0x2fcd5d){const _0x48f270=_0x2fcd5d[_0x91bde0];_0x48f270['produces']=_0x4cdc94[''+_0x91bde0]||[];}}}['groupMappingRules'](_0x16c79d){_0x16c79d=Array['from'](new Set(_0x16c79d))['sort']();const _0x24b323={};for(const _0x3deb5f of _0x16c79d){const [_0x40b42d,_0x3a9b41]=this['resolveMappableValue'](_0x3deb5f);!_0x24b323[_0x40b42d]&&(_0x24b323[_0x40b42d]=[]),_0x24b323[_0x40b42d]['push'](_0x3a9b41);}return _0x24b323;}['resolveMappableValue'](_0x354492){_0x354492=_0x354492['substring'](0x1,_0x354492['length']-0x1);const _0x16f933=_0x354492['split']('.');if(_0x16f933[0x0]==='$job'){const [_0x3a556d,..._0xa73c82]=_0x16f933;return[_0x3a556d,_0xa73c82['join']('/')];}else{const [_0x42fbd7,_0x1e1364,_0x12fb7f,..._0x222bc1]=_0x16f933,_0x4b85de={'hook':'hook/data','input':'input/data','output':_0x12fb7f==='data'?'output/data':'output/metadata'}[_0x1e1364];return[_0x42fbd7,_0x4b85de+'/'+_0x222bc1['join']('/')];}}async['deployActivitySchemas'](){const _0x41995d=this['manifest']['app']['graphs'],_0x29c4d1={};for(const _0x16ff55 of _0x41995d){const _0x57060b=_0x16ff55['activities'];for(const _0x5bdb2b in _0x57060b){const _0x1fea6f=_0x57060b[_0x5bdb2b];delete _0x1fea6f['transitions'],_0x29c4d1[_0x5bdb2b]=_0x1fea6f;}}await this['store']['setSchemas'](_0x29c4d1,this['getVID']());}async['deploySubscriptions'](){const _0x3cd405=this['manifest']['app']['graphs'],_0x34bb3f={};for(const _0x4bd11c of _0x3cd405){const _0xfb3ba9=_0x4bd11c['activities'],_0x70473a=_0x4bd11c['subscribes'];for(const _0x3d01ec in _0xfb3ba9){if(_0xfb3ba9[_0x3d01ec]['type']==='trigger'){_0x34bb3f[_0x70473a]=_0x3d01ec;break;}}}await this['store']['setSubscriptions'](_0x34bb3f,this['getVID']());}['findTrigger'](_0x1332b0){for(const _0x5e94b3 in _0x1332b0['activities']){const _0x149f04=_0x1332b0['activities'][_0x5e94b3];if(_0x149f04['type']==='trigger')return[_0x5e94b3,_0x149f04];}return null;}async['deployTransitions'](){const _0x470802=this['manifest']['app']['graphs'],_0x14f4c5={};for(const _0x3d9120 of _0x470802){if(_0x3d9120['subscribes']&&_0x3d9120['subscribes']['startsWith']('.')){const [_0x1fdecb]=this['findTrigger'](_0x3d9120);_0x1fdecb&&(_0x14f4c5[_0x3d9120['subscribes']]={[_0x1fdecb]:!![]});}if(_0x3d9120['transitions'])for(const _0x4cf442 in _0x3d9120['transitions']){const _0x3a5755=_0x3d9120['transitions'][_0x4cf442],_0x20b38c={};for(const _0x686979 of _0x3a5755){const _0x19b880=_0x686979['to'];_0x686979['conditions']?_0x20b38c[_0x19b880]=_0x686979['conditions']:_0x20b38c[_0x19b880]=!![];}Object['keys'](_0x20b38c)['length']>0x0&&(_0x14f4c5['.'+_0x4cf442]=_0x20b38c);}}await this['store']['setTransitions'](_0x14f4c5,this['getVID']());}async['deployHookPatterns'](){const _0x2f0939=this['manifest']['app']['graphs'],_0x3a112f={};for(const _0x3c58ba of _0x2f0939){if(_0x3c58ba['hooks'])for(const _0x4fb968 in _0x3c58ba['hooks']){_0x3a112f[_0x4fb968]=_0x3c58ba['hooks'][_0x4fb968];const _0x5139cb=_0x3c58ba['hooks'][_0x4fb968][0x0]['to'],_0x4b2f65=_0x3c58ba['activities'][_0x5139cb];_0x4b2f65&&(!_0x4b2f65['hook']&&(_0x4b2f65['hook']={}),_0x4b2f65['hook']['topic']=_0x4fb968);}}await this['store']['setHookRules'](_0x3a112f);}async['deployConsumerGroups'](){const _0x107665={'appId':this['manifest']['app']['id']},_0xcedad7=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x107665);await this['deployConsumerGroup'](_0xcedad7,'ENGINE');for(const _0x47276f of this['manifest']['app']['graphs']){const _0x5726ba=_0x47276f['activities'];for(const _0xd84af2 in _0x5726ba){const _0x539cb9=_0x5726ba[_0xd84af2];if(_0x539cb9['type']==='worker'&&pipe_1['Pipe']['resolve'](_0x539cb9['subtype'],{})===_0x539cb9['subtype']){_0x107665['topic']=_0x539cb9['subtype'];const _0x3384e6=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x107665);await this['deployConsumerGroup'](_0x3384e6,'WORKER');}}}}async['deployConsumerGroup'](_0x4dd096,_0x39a25f){try{await this['stream']['createConsumerGroup'](_0x4dd096,_0x39a25f);}catch(_0x1db3c7){this['store']['logger']['info']('router-stream-group-exists',{'stream':_0x4dd096,'group':_0x39a25f});}}}function _0x3e06(){const _0x4e5bd1=['368CvaWxn','1PtUmMa','22579018vZzsmZ','42063zewriY','80MOLthu','1338428vbJmIe','59292iBXgph','4360630dEcwLU','4COGncL','9146268ePJObF','1010571sytkSf'];_0x3e06=function(){return _0x4e5bd1;};return _0x3e06();}exports['Deployer']=Deployer;
|
|
1
|
+
'use strict';function _0x42db(_0x2b3b01,_0x13863b){const _0x46f305=_0x46f3();return _0x42db=function(_0x42dbf4,_0x1da59d){_0x42dbf4=_0x42dbf4-0x176;let _0x16c1a1=_0x46f305[_0x42dbf4];return _0x16c1a1;},_0x42db(_0x2b3b01,_0x13863b);}(function(_0x14d24a,_0x146ade){const _0x21c918=_0x42db,_0x18ddc9=_0x14d24a();while(!![]){try{const _0x3e6da4=-parseInt(_0x21c918(0x17e))/0x1+-parseInt(_0x21c918(0x182))/0x2*(parseInt(_0x21c918(0x180))/0x3)+parseInt(_0x21c918(0x176))/0x4*(parseInt(_0x21c918(0x181))/0x5)+parseInt(_0x21c918(0x17b))/0x6*(parseInt(_0x21c918(0x177))/0x7)+parseInt(_0x21c918(0x17d))/0x8*(parseInt(_0x21c918(0x17a))/0x9)+parseInt(_0x21c918(0x179))/0xa*(parseInt(_0x21c918(0x17f))/0xb)+parseInt(_0x21c918(0x17c))/0xc*(-parseInt(_0x21c918(0x178))/0xd);if(_0x3e6da4===_0x146ade)break;else _0x18ddc9['push'](_0x18ddc9['shift']());}catch(_0xb346b0){_0x18ddc9['push'](_0x18ddc9['shift']());}}}(_0x46f3,0xe239f));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;function _0x46f3(){const _0x30f196=['48amncCP','3557995uOXTbT','115212gvkpxo','8ImVGac','7tHorvy','10145902QsjVxj','19560OOqIqd','425781wzHxGO','3165858UftCOJ','36bWqrej','296QjgEuf','119909iDIjQh','3421Vykvkf'];_0x46f3=function(){return _0x30f196;};return _0x46f3();}class Deployer{constructor(_0x3217f3){this['manifest']=null,this['manifest']=_0x3217f3;}async['deploy'](_0x3adc88,_0x66f501){this['store']=_0x3adc88,this['stream']=_0x66f501,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 _0x1ddde8 of this['manifest']['app']['graphs']){const [,_0x273a24]=this['findTrigger'](_0x1ddde8),_0x1c9f4b=_0x273a24['subscribes'],[_0x2f4d1f,_0xc304e6,_0xa54247]=await this['store']['reserveSymbolRange']('$'+_0x1c9f4b,DEFAULT_RANGE_SIZE,'JOB'),_0x217582='',_0x547847=this['bindSymbols'](_0x2f4d1f,_0xc304e6,_0xa54247,_0x217582,_0x273a24['PRODUCES']);Object['keys'](_0x547847)['length']&&await this['store']['addSymbols']('$'+_0x1c9f4b,_0x547847);for(const [_0x2c331f,_0x36177a]of Object['entries'](_0x1ddde8['activities'])){const [_0x54be4a,_0x1940c3,_0x52300c]=await this['store']['reserveSymbolRange'](_0x2c331f,DEFAULT_RANGE_SIZE,'ACTIVITY'),_0x16e5bc=_0x2c331f+'/';this['bindSelf'](_0x36177a['consumes'],_0x36177a['produces'],_0x2c331f);const _0x2712d8=this['bindSymbols'](_0x54be4a,_0x1940c3,_0x52300c,_0x16e5bc,_0x36177a['produces']);Object['keys'](_0x2712d8)['length']&&await this['store']['addSymbols'](_0x2c331f,_0x2712d8);}}}['bindSelf'](_0x4d378f,_0xa2b8bd,_0x63d6d7){for(const _0x57146a of[_0x63d6d7,'$self']){const _0x578fdf=_0x4d378f[_0x57146a];if(_0x578fdf)for(const _0x49e2a2 of _0x578fdf){!_0xa2b8bd['includes'](_0x49e2a2)&&_0xa2b8bd['push'](_0x49e2a2);}}}['bindSymbols'](_0x38f07,_0xb0d627,_0x43c1ad,_0x1260ef,_0x44bf41){const _0x172d2c={},_0x18b86d={..._0x43c1ad};for(const _0x4b7282 of _0x44bf41){const _0x58473e=''+_0x1260ef+_0x4b7282;if(!_0x18b86d[_0x58473e]){if(_0x38f07>_0xb0d627)throw new Error('Symbol\x20index\x20out\x20of\x20bounds');const _0x458f65=(0x0,utils_1['getSymKey'])(_0x38f07);_0x38f07++,_0x172d2c[_0x58473e]=_0x458f65,_0x18b86d[_0x58473e]=_0x458f65;}}return _0x172d2c;}['copyJobSchemas'](){const _0x5098a7=this['manifest']['app']['graphs'];for(const _0x39ed7d of _0x5098a7){const _0x32e882=_0x39ed7d['output']?.['schema'],_0x3bc5de=_0x39ed7d['input']?.['schema'];if(!_0x32e882&&!_0x3bc5de)continue;const _0x1fabb5=_0x39ed7d['activities'];for(const _0x3c7780 in _0x1fabb5){if(_0x1fabb5[_0x3c7780]['type']==='trigger'){const _0x16fd1d=_0x1fabb5[_0x3c7780];_0x32e882&&(!_0x16fd1d['job']&&(_0x16fd1d['job']={}),_0x16fd1d['job']['schema']=_0x32e882),_0x3bc5de&&(_0x16fd1d['output']={'schema':_0x3bc5de});}}}}['bindBackRefs'](){for(const _0x1c7916 of this['manifest']['app']['graphs']){const _0x361e36=_0x1c7916['activities'],_0xfc01a3=this['findTrigger'](_0x1c7916)[0x0];for(const _0x1804b0 in _0x361e36){_0x361e36[_0x1804b0]['trigger']=_0xfc01a3,_0x361e36[_0x1804b0]['subscribes']=_0x1c7916['subscribes'],_0x1c7916['publishes']&&(_0x361e36[_0x1804b0]['publishes']=_0x1c7916['publishes']),_0x361e36[_0x1804b0]['expire']=_0x1c7916['expire']??undefined,_0x361e36[_0x1804b0]['persistent']=_0x1c7916['persistent']??undefined;}}}['bindCycleTarget'](){for(const _0x4cf263 of this['manifest']['app']['graphs']){const _0x49ee87=_0x4cf263['activities'];for(const _0x303160 in _0x49ee87){const _0x19c352=_0x49ee87[_0x303160];_0x19c352['type']==='cycle'&&(_0x49ee87[_0x19c352['ancestor']]['cycle']=!![]);}}}['convertTopicsToTypes'](){for(const _0x17fce7 of this['manifest']['app']['graphs']){const _0x156d8d=_0x17fce7['activities'];for(const _0x5410b5 in _0x156d8d){const _0x13021c=_0x156d8d[_0x5410b5];['worker','await']['includes'](_0x13021c['type'])&&_0x13021c['topic']&&!_0x13021c['subtype']&&(_0x13021c['subtype']=_0x13021c['topic']);}}}['convertActivitiesToHooks'](){for(const _0x3e7a39 of this['manifest']['app']['graphs']){const _0x4f5b5b=_0x3e7a39['activities'];for(const _0x380428 in _0x4f5b5b){const _0x5389d9=_0x4f5b5b[_0x380428];['activity']['includes'](_0x5389d9['type'])&&(_0x5389d9['type']='hook');}}}async['bindParents'](){const _0x11d41f=this['manifest']['app']['graphs'];for(const _0xc01a7b of _0x11d41f){if(_0xc01a7b['transitions'])for(const _0x746d57 in _0xc01a7b['transitions']){const _0x4c3e57=_0xc01a7b['transitions'][_0x746d57];for(const _0x415e60 of _0x4c3e57){const _0x21730c=_0x415e60['to'];_0xc01a7b['activities'][_0x21730c]['parent']=_0x746d57;}_0xc01a7b['activities'][_0x746d57]['transitions']=_0x4c3e57;}}}['collectValues'](_0x4384ad,_0x17b451){for(const [_0x346d81,_0x5d276c]of Object['entries'](_0x4384ad)){if(_0x346d81==='enum'||_0x346d81==='examples'||_0x346d81==='default'){if(Array['isArray'](_0x5d276c))for(const _0x5c4ee6 of _0x5d276c){typeof _0x5c4ee6==='string'&&_0x5c4ee6['length']>0x5&&_0x17b451['add'](_0x5c4ee6);}else typeof _0x5d276c==='string'&&_0x5d276c['length']>0x5&&_0x17b451['add'](_0x5d276c);}else typeof _0x5d276c==='object'&&this['collectValues'](_0x5d276c,_0x17b451);}}['traverse'](_0x7acb7d,_0x2b2ffd){for(const _0xec8af9 of Object['values'](_0x7acb7d)){typeof _0xec8af9==='object'&&('schema'in _0xec8af9?this['collectValues'](_0xec8af9['schema'],_0x2b2ffd):this['traverse'](_0xec8af9,_0x2b2ffd));}}async['generateSymVals'](){const _0x38e485=new Set();for(const _0x589c88 of this['manifest']['app']['graphs']){this['traverse'](_0x589c88,_0x38e485);}const _0x26c74a=await this['store']['getSymbolValues'](),_0x44cf83=Object['keys'](_0x26c74a)['length'],_0x578dd1=Math['pow'](0x34,0x2)-0x1,_0x2c3cbe=serializer_1['SerializerService']['filterSymVals'](_0x44cf83,_0x578dd1,_0x26c74a,_0x38e485);await this['store']['addSymbolValues'](_0x2c3cbe);}['resolveJobMapsPaths'](){function _0x3f9d26(_0x490ab3){const _0x416c8a=[];function _0x2a9861(_0x260b27,_0x5b3824=[]){for(const _0x22958d in _0x260b27){if(typeof _0x260b27[_0x22958d]==='object'&&_0x260b27[_0x22958d]!==null&&!('@pipe'in _0x260b27[_0x22958d])){const _0x231036=[..._0x5b3824,_0x22958d];_0x2a9861(_0x260b27[_0x22958d],_0x231036);}else{const _0xb1b5c7=[..._0x5b3824,_0x22958d]['join']('/');if(!_0xb1b5c7['includes']('[')){const _0x52b7f6='data/'+_0xb1b5c7;!_0x416c8a['includes'](_0x52b7f6)&&_0x416c8a['push'](_0x52b7f6);}else{const [_0x46ed03,_0x3c7160]=_0xb1b5c7['split']('['),[_0x5b4749,_0xa00c9a]=_0x3c7160['split'](']');if(!isNaN(parseInt(_0x5b4749)))for(let _0x592581=0x0;_0x592581<parseInt(_0x5b4749);_0x592581++){const _0x58d7e9='data/'+_0x46ed03+'/'+_0x592581;!_0x416c8a['includes'](_0x58d7e9)&&_0x416c8a['push'](_0x58d7e9);}}}}}return _0x490ab3&&_0x2a9861(_0x490ab3),_0x416c8a;}for(const _0x3afced of this['manifest']['app']['graphs']){let _0x3592c3=[];const [,_0x4259c0]=this['findTrigger'](_0x3afced);for(const _0xde4536 in _0x3afced['activities']){const _0x515aaf=_0x3afced['activities'][_0xde4536];_0x3592c3=_0x3592c3['concat'](_0x3f9d26(_0x515aaf['job']?.['maps']));}_0x4259c0['PRODUCES']=_0x3592c3;}}['resolveMappingDependencies'](){const _0x311885=[];function _0x51f124(_0x502278,_0x2a37f7){for(const _0x27e1ab in _0x502278){if(typeof _0x502278[_0x27e1ab]==='string'){const _0x130cf5=_0x502278[_0x27e1ab],_0x4e8fdd=_0x130cf5['match'](/^\{[^@].*}$/);_0x4e8fdd&&!validator_1['Validator']['CONTEXT_VARS']['includes'](_0x130cf5)&&(_0x130cf5['split']('.')[0x1]!=='input'&&(_0x311885['push'](_0x130cf5),_0x2a37f7['push'](_0x130cf5)));}else typeof _0x502278[_0x27e1ab]==='object'&&_0x502278[_0x27e1ab]!==null&&_0x51f124(_0x502278[_0x27e1ab],_0x2a37f7);}}const _0xd45e53=this['manifest']['app']['graphs'];for(const _0x1b2e3e of _0xd45e53){const _0x38d9c2=_0x1b2e3e['activities'];for(const _0x1c7fbc in _0x38d9c2){const _0xe74b58=_0x38d9c2[_0x1c7fbc];_0xe74b58['consumes']=[],_0x51f124(_0xe74b58,_0xe74b58['consumes']),_0xe74b58['consumes']=this['groupMappingRules'](_0xe74b58['consumes']);}}const _0x51a2d6=this['groupMappingRules'](_0x311885);for(const _0x16d351 of _0xd45e53){const _0x5eb3d9=_0x16d351['activities'];for(const _0x2b9ffd in _0x5eb3d9){const _0x2bc67c=_0x5eb3d9[_0x2b9ffd];_0x2bc67c['produces']=_0x51a2d6[''+_0x2b9ffd]||[];}}}['groupMappingRules'](_0x5c148f){_0x5c148f=Array['from'](new Set(_0x5c148f))['sort']();const _0x3ddc79={};for(const _0xc74544 of _0x5c148f){const [_0x3fbc23,_0x3322fa]=this['resolveMappableValue'](_0xc74544);!_0x3ddc79[_0x3fbc23]&&(_0x3ddc79[_0x3fbc23]=[]),_0x3ddc79[_0x3fbc23]['push'](_0x3322fa);}return _0x3ddc79;}['resolveMappableValue'](_0x9bc1a1){_0x9bc1a1=_0x9bc1a1['substring'](0x1,_0x9bc1a1['length']-0x1);const _0x4d9858=_0x9bc1a1['split']('.');if(_0x4d9858[0x0]==='$job'){const [_0x145ef1,..._0x29b205]=_0x4d9858;return[_0x145ef1,_0x29b205['join']('/')];}else{const [_0x5163a7,_0x59a7df,_0x329274,..._0x118f82]=_0x4d9858,_0x147585={'hook':'hook/data','input':'input/data','output':_0x329274==='data'?'output/data':'output/metadata'}[_0x59a7df];return[_0x5163a7,_0x147585+'/'+_0x118f82['join']('/')];}}async['deployActivitySchemas'](){const _0x34b46d=this['manifest']['app']['graphs'],_0x379b6c={};for(const _0x17829e of _0x34b46d){const _0x40de7f=_0x17829e['activities'];for(const _0x36c7f4 in _0x40de7f){const _0x7279ac=_0x40de7f[_0x36c7f4];delete _0x7279ac['transitions'],_0x379b6c[_0x36c7f4]=_0x7279ac;}}await this['store']['setSchemas'](_0x379b6c,this['getVID']());}async['deploySubscriptions'](){const _0x2d8868=this['manifest']['app']['graphs'],_0xa72a5f={};for(const _0x45e55c of _0x2d8868){const _0x208499=_0x45e55c['activities'],_0x5815e5=_0x45e55c['subscribes'];for(const _0x5b4439 in _0x208499){if(_0x208499[_0x5b4439]['type']==='trigger'){_0xa72a5f[_0x5815e5]=_0x5b4439;break;}}}await this['store']['setSubscriptions'](_0xa72a5f,this['getVID']());}['findTrigger'](_0x4aacd4){for(const _0x2ad1ec in _0x4aacd4['activities']){const _0x46efcf=_0x4aacd4['activities'][_0x2ad1ec];if(_0x46efcf['type']==='trigger')return[_0x2ad1ec,_0x46efcf];}return null;}async['deployTransitions'](){const _0x4f1b83=this['manifest']['app']['graphs'],_0x22aba7={};for(const _0x18624c of _0x4f1b83){if(_0x18624c['subscribes']&&_0x18624c['subscribes']['startsWith']('.')){const [_0x5852f4]=this['findTrigger'](_0x18624c);_0x5852f4&&(_0x22aba7[_0x18624c['subscribes']]={[_0x5852f4]:!![]});}if(_0x18624c['transitions'])for(const _0x1ed970 in _0x18624c['transitions']){const _0x1f8f1c=_0x18624c['transitions'][_0x1ed970],_0x10726a={};for(const _0x2c0b82 of _0x1f8f1c){const _0x21af04=_0x2c0b82['to'];_0x2c0b82['conditions']?_0x10726a[_0x21af04]=_0x2c0b82['conditions']:_0x10726a[_0x21af04]=!![];}Object['keys'](_0x10726a)['length']>0x0&&(_0x22aba7['.'+_0x1ed970]=_0x10726a);}}await this['store']['setTransitions'](_0x22aba7,this['getVID']());}async['deployHookPatterns'](){const _0x2871ee=this['manifest']['app']['graphs'],_0x5bbc9f={};for(const _0x57c7c5 of _0x2871ee){if(_0x57c7c5['hooks'])for(const _0x4d5bf4 in _0x57c7c5['hooks']){_0x5bbc9f[_0x4d5bf4]=_0x57c7c5['hooks'][_0x4d5bf4];const _0x51d8b7=_0x57c7c5['hooks'][_0x4d5bf4][0x0]['to'],_0xc8a185=_0x57c7c5['activities'][_0x51d8b7];_0xc8a185&&(!_0xc8a185['hook']&&(_0xc8a185['hook']={}),_0xc8a185['hook']['topic']=_0x4d5bf4);}}await this['store']['setHookRules'](_0x5bbc9f);}async['deployConsumerGroups'](){const _0x2696a={'appId':this['manifest']['app']['id']},_0x473884=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x2696a);await this['deployConsumerGroup'](_0x473884,'ENGINE');for(const _0x5f2aaf of this['manifest']['app']['graphs']){const _0x53a935=_0x5f2aaf['activities'];for(const _0xd15c75 in _0x53a935){const _0x3a4f06=_0x53a935[_0xd15c75];if(_0x3a4f06['type']==='worker'&&pipe_1['Pipe']['resolve'](_0x3a4f06['subtype'],{})===_0x3a4f06['subtype']){_0x2696a['topic']=_0x3a4f06['subtype'];const _0x734831=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x2696a);await this['deployConsumerGroup'](_0x734831,'WORKER');}}}}async['deployConsumerGroup'](_0x26b907,_0x52799d){try{await this['stream']['createConsumerGroup'](_0x26b907,_0x52799d);}catch(_0x3ef1ee){this['store']['logger']['info']('router-stream-group-exists',{'stream':_0x26b907,'group':_0x52799d});}}}exports['Deployer']=Deployer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function _0x1a03(_0x23b42c,_0x5370e9){const _0x26e4c1=_0x26e4();return _0x1a03=function(_0x1a03f0,_0x4d2412){_0x1a03f0=_0x1a03f0-0x167;let _0x195e51=_0x26e4c1[_0x1a03f0];return _0x195e51;},_0x1a03(_0x23b42c,_0x5370e9);}(function(_0xa82d27,_0x2d5c94){const _0x4365b2=_0x1a03,_0x381aa9=_0xa82d27();while(!![]){try{const _0xfb2ad8=parseInt(_0x4365b2(0x16e))/0x1+parseInt(_0x4365b2(0x16f))/0x2+parseInt(_0x4365b2(0x16a))/0x3*(-parseInt(_0x4365b2(0x168))/0x4)+parseInt(_0x4365b2(0x16d))/0x5*(parseInt(_0x4365b2(0x170))/0x6)+-parseInt(_0x4365b2(0x16c))/0x7*(-parseInt(_0x4365b2(0x167))/0x8)+-parseInt(_0x4365b2(0x16b))/0x9+-parseInt(_0x4365b2(0x169))/0xa;if(_0xfb2ad8===_0x2d5c94)break;else _0x381aa9['push'](_0x381aa9['shift']());}catch(_0x41d808){_0x381aa9['push'](_0x381aa9['shift']());}}}(_0x26e4,0x3db53));var __createBinding=this&&this['__createBinding']||(Object['create']?function(_0x28437f,_0x2752ad,_0x4435f9,_0x4eac05){if(_0x4eac05===undefined)_0x4eac05=_0x4435f9;var _0x3f6c3a=Object['getOwnPropertyDescriptor'](_0x2752ad,_0x4435f9);(!_0x3f6c3a||('get'in _0x3f6c3a?!_0x2752ad['__esModule']:_0x3f6c3a['writable']||_0x3f6c3a['configurable']))&&(_0x3f6c3a={'enumerable':!![],'get':function(){return _0x2752ad[_0x4435f9];}}),Object['defineProperty'](_0x28437f,_0x4eac05,_0x3f6c3a);}:function(_0x4a4766,_0x38ed32,_0x2e166e,_0x1d4250){if(_0x1d4250===undefined)_0x1d4250=_0x2e166e;_0x4a4766[_0x1d4250]=_0x38ed32[_0x2e166e];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(_0x2bbfc2,_0x2a44f1){Object['defineProperty'](_0x2bbfc2,'default',{'enumerable':!![],'value':_0x2a44f1});}:function(_0x5292ca,_0x22627f){_0x5292ca['default']=_0x22627f;}),__importStar=this&&this['__importStar']||function(_0x4da04c){if(_0x4da04c&&_0x4da04c['__esModule'])return _0x4da04c;var _0x4d5b00={};if(_0x4da04c!=null){for(var _0xac48d0 in _0x4da04c)if(_0xac48d0!=='default'&&Object['prototype']['hasOwnProperty']['call'](_0x4da04c,_0xac48d0))__createBinding(_0x4d5b00,_0x4da04c,_0xac48d0);}return __setModuleDefault(_0x4d5b00,_0x4da04c),_0x4d5b00;},__importDefault=this&&this['__importDefault']||function(_0x3ce534){return _0x3ce534&&_0x3ce534['__esModule']?_0x3ce534:{'default':_0x3ce534};};function _0x26e4(){const _0x193d60=['40302ZRLUyT','2413755YEUXKP','2889712rCjwIP','20SuUPyn','478385HXvEMx','943464sTrbOI','356226NrgXpX','8DlyHZO','36gkKVro','9585610lafiGa'];_0x26e4=function(){return _0x193d60;};return _0x26e4();}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(_0x5f7db8,_0x1ca29e,_0x4e04d1){this['store']=_0x5f7db8,this['stream']=_0x1ca29e,this['logger']=_0x4e04d1;}async['plan'](_0x378ac7){try{let _0x4521c1;this['isPath'](_0x378ac7)?_0x4521c1=await json_schema_ref_parser_1['default']['dereference'](_0x378ac7):_0x4521c1=js_yaml_1['default']['load'](_0x378ac7);const _0x299e71=new validator_1['Validator'](_0x4521c1);return _0x299e71['validate'](this['store']),_0x4521c1;}catch(_0x4b53bd){this['logger']['error']('compiler-plan-error',_0x4b53bd);}}['isPath'](_0xc06ff4){return!_0xc06ff4['trim']()['startsWith']('app:');}async['deploy'](_0x333a48){try{let _0x273512;this['isPath'](_0x333a48)?(_0x273512=await json_schema_ref_parser_1['default']['dereference'](_0x333a48),await this['saveAsJSON'](_0x333a48,_0x273512)):_0x273512=js_yaml_1['default']['load'](_0x333a48);const _0x4d5d36=new validator_1['Validator'](_0x273512);_0x4d5d36['validate'](this['store']);const _0x4c14a0=new deployer_1['Deployer'](_0x273512);return await _0x4c14a0['deploy'](this['store'],this['stream']),await this['store']['setApp'](_0x273512['app']['id'],_0x273512['app']['version']),_0x273512;}catch(_0x4dd82e){this['logger']['error']('compiler-deploy-error',_0x4dd82e);}}async['activate'](_0x4b6efd,_0x15ddbb){return await this['store']['activateAppVersion'](_0x4b6efd,_0x15ddbb);}async['saveAsJSON'](_0x2d904e,_0x42d87b){const _0x11d3ef=JSON['stringify'](_0x42d87b,null,0x2),_0xf977da=path['join'](path['dirname'](_0x2d904e),'.hotmesh.'+_0x42d87b['app']['id']+'.'+_0x42d87b['app']['version']+'.json');await fs['writeFile'](_0xf977da,_0x11d3ef,'utf8');}}exports['CompilerService']=CompilerService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function _0x3ac1(_0x17363a,_0x38bf55){const _0x5a6303=_0x5a63();return _0x3ac1=function(_0x3ac14c,_0x152657){_0x3ac14c=_0x3ac14c-0x13c;let _0x1e8c58=_0x5a6303[_0x3ac14c];return _0x1e8c58;},_0x3ac1(_0x17363a,_0x38bf55);}(function(_0x58e01c,_0x3b995b){const _0x480f75=_0x3ac1,_0x2b4f83=_0x58e01c();while(!![]){try{const _0xd54b33=parseInt(_0x480f75(0x13e))/0x1+-parseInt(_0x480f75(0x13f))/0x2+parseInt(_0x480f75(0x13d))/0x3*(-parseInt(_0x480f75(0x144))/0x4)+-parseInt(_0x480f75(0x140))/0x5+parseInt(_0x480f75(0x143))/0x6*(-parseInt(_0x480f75(0x141))/0x7)+-parseInt(_0x480f75(0x13c))/0x8+parseInt(_0x480f75(0x142))/0x9;if(_0xd54b33===_0x3b995b)break;else _0x2b4f83['push'](_0x2b4f83['shift']());}catch(_0x4d952d){_0x2b4f83['push'](_0x2b4f83['shift']());}}}(_0x5a63,0x3a60f));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Validator']=void 0x0;const pipe_1=require('../pipe');class Validator{constructor(_0x5d6dc4){this['manifest']=null,this['activityIds']=[],this['mappingStatements']={},this['store']=null,this['manifest']=_0x5d6dc4;}async['validate'](_0x1fbd29){this['store']=_0x1fbd29,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 _0x483024=new Set();this['manifest']['app']['graphs']['forEach'](_0x4b3109=>{const _0x54d888=Object['keys'](_0x4b3109['activities']);_0x54d888['forEach'](_0x191326=>{if(_0x483024['has'](_0x191326))throw new Error('Duplicate\x20activity\x20id\x20found:\x20'+_0x191326);else _0x483024['add'](_0x191326);});}),this['activityIds']=Array['from'](_0x483024);}['isMappingStatement'](_0x389ec7){return typeof _0x389ec7==='string'&&_0x389ec7['startsWith']('{')&&_0x389ec7['endsWith']('}');}['extractMappingStatements'](_0x3563a7,_0x13ed88,_0x13b027){for(const _0x508846 in _0x3563a7){if(typeof _0x3563a7[_0x508846]==='object'&&_0x3563a7[_0x508846]!==null)this['extractMappingStatements'](_0x3563a7[_0x508846],_0x13ed88,_0x13b027);else this['isMappingStatement'](_0x3563a7[_0x508846])&&(!_0x13ed88[_0x13b027]&&(_0x13ed88[_0x13b027]=[]),_0x13ed88[_0x13b027]['push'](_0x3563a7[_0x508846]));}}['getMappingStatements'](){const _0x5e53d6={};this['manifest']['app']['graphs']['forEach'](_0x2bc05d=>{const _0x23f44d=_0x2bc05d['activities'];for(const _0x23dca6 in _0x23f44d){const _0x29053e=_0x23f44d[_0x23dca6];this['extractMappingStatements'](_0x29053e,_0x5e53d6,_0x23dca6);}}),this['mappingStatements']=_0x5e53d6;}['validateReferencedActivityIds'](){const _0x2cd4cf=this['mappingStatements'],_0x3a843c=this['activityIds'];for(const _0x3d4430 in _0x2cd4cf){const _0x46d44f=_0x2cd4cf[_0x3d4430];_0x46d44f['forEach'](_0x9cd55e=>{if(_0x9cd55e['startsWith']('{')&&_0x9cd55e['endsWith']('}')){const _0x27103d=_0x9cd55e['slice'](0x1,-0x1)['split']('.'),_0x5c8e7e=_0x27103d[0x0];if(!(Validator['SYS_VARS']['includes'](_0x5c8e7e)||_0x3a843c['includes'](_0x5c8e7e)||this['isFunction'](_0x9cd55e)||this['isContextVariable'](_0x9cd55e)))throw new Error('Mapping\x20statement\x20references\x20non-existent\x20activity:\x20'+_0x9cd55e);}});}}['isFunction'](_0x384779){return _0x384779['startsWith']('{@')&&pipe_1['Pipe']['resolveFunction'](_0x384779);}['isContextVariable'](_0x46f325){return['{$input}','{$output}','{$item}','{$key}','{$index}']['includes'](_0x46f325);}['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 _0x5a63(){const _0x1da5e8=['3536624vPKBlW','3xuArhQ','172965uMWFqI','153090UZULLK','1860770EDQrgr','14ZBNGoI','12785778pNxgMV','1368834KJSBRJ','29732oWkedP'];_0x5a63=function(){return _0x1da5e8;};return _0x5a63();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function _0x7f39(){const _0x4cfaf9=['1022793WkJhSr','56458FuLMVv','329744zhevgc','15kbykFB','10irgfba','4EspkVi','876085ywmjFu','2029752XifTaF','5608460qehdPC','18qpmtLn','1023759UOdjnK'];_0x7f39=function(){return _0x4cfaf9;};return _0x7f39();}function _0x153f(_0x26702f,_0x2008df){const _0x7f39a2=_0x7f39();return _0x153f=function(_0x153f5d,_0x1ec4bc){_0x153f5d=_0x153f5d-0x1eb;let _0x44ffe8=_0x7f39a2[_0x153f5d];return _0x44ffe8;},_0x153f(_0x26702f,_0x2008df);}(function(_0x2eb0cd,_0x540f68){const _0x280f11=_0x153f,_0x22f8f5=_0x2eb0cd();while(!![]){try{const _0x564a42=-parseInt(_0x280f11(0x1f3))/0x1*(-parseInt(_0x280f11(0x1ef))/0x2)+parseInt(_0x280f11(0x1ee))/0x3+-parseInt(_0x280f11(0x1f0))/0x4*(-parseInt(_0x280f11(0x1f1))/0x5)+-parseInt(_0x280f11(0x1ec))/0x6*(-parseInt(_0x280f11(0x1f4))/0x7)+-parseInt(_0x280f11(0x1f5))/0x8+parseInt(_0x280f11(0x1ed))/0x9*(-parseInt(_0x280f11(0x1f2))/0xa)+-parseInt(_0x280f11(0x1eb))/0xb;if(_0x564a42===_0x540f68)break;else _0x22f8f5['push'](_0x22f8f5['shift']());}catch(_0xa6f8db){_0x22f8f5['push'](_0x22f8f5['shift']());}}}(_0x7f39,0x30a7a));var __importDefault=this&&this['__importDefault']||function(_0x2bb800){return _0x2bb800&&_0x2bb800['__esModule']?_0x2bb800:{'default':_0x2bb800};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['EngineService']=void 0x0;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'](_0x3928e4,_0x1f7508,_0xb1ba79,_0x30e4d3,_0x13fff7){if(_0x30e4d3['engine']){const _0x2a77be=new EngineService();_0x2a77be['verifyEngineFields'](_0x30e4d3),_0x2a77be['namespace']=_0x3928e4,_0x2a77be['appId']=_0x1f7508,_0x2a77be['guid']=_0xb1ba79,_0x2a77be['logger']=_0x13fff7,await _0x2a77be['initSearchChannel'](_0x30e4d3['engine']['store']),await _0x2a77be['initStoreChannel'](_0x30e4d3['engine']['store']),await _0x2a77be['initSubChannel'](_0x30e4d3['engine']['sub'],_0x30e4d3['engine']['pub']),await _0x2a77be['initStreamChannel'](_0x30e4d3['engine']['stream'],_0x30e4d3['engine']['store']),_0x2a77be['router']=await _0x2a77be['initRouter'](_0x30e4d3);const _0x9ef92a=_0x2a77be['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x2a77be['appId']});return _0x2a77be['router']['consumeMessages'](_0x9ef92a,'ENGINE',_0x2a77be['guid'],_0x2a77be['processStreamMessage']['bind'](_0x2a77be)),_0x2a77be['taskService']=new task_1['TaskService'](_0x2a77be['store'],_0x13fff7),_0x2a77be['exporter']=new exporter_1['ExporterService'](_0x2a77be['appId'],_0x2a77be['store'],_0x13fff7),_0x2a77be['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x2a77be;}}['verifyEngineFields'](_0x45b3f9){if(!(0x0,utils_1['identifyProvider'])(_0x45b3f9['engine']['store'])||!(0x0,utils_1['identifyProvider'])(_0x45b3f9['engine']['stream'])||!(0x0,utils_1['identifyProvider'])(_0x45b3f9['engine']['sub']))throw new Error('engine\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields.');}async['initSearchChannel'](_0x5bdde4,_0x29eb72){this['search']=await factory_1['SearchServiceFactory']['init'](_0x5bdde4,_0x29eb72,this['namespace'],this['appId'],this['logger']);}async['initStoreChannel'](_0xb33beb){this['store']=await factory_2['StoreServiceFactory']['init'](_0xb33beb,this['namespace'],this['appId'],this['logger']);}async['initSubChannel'](_0x2f797f,_0x3ae7c5){this['subscribe']=await factory_4['SubServiceFactory']['init'](_0x2f797f,_0x3ae7c5,this['namespace'],this['appId'],this['guid'],this['logger']);}async['initStreamChannel'](_0x276ad1,_0x4c38c2){this['stream']=await factory_3['StreamServiceFactory']['init'](_0x276ad1,_0x4c38c2,this['namespace'],this['appId'],this['logger']);}async['initRouter'](_0x28969f){const _0x745b3f=await this['store']['getThrottleRate'](':');return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['ENGINE'],'reclaimDelay':_0x28969f['engine']['reclaimDelay'],'reclaimCount':_0x28969f['engine']['reclaimCount'],'throttle':_0x745b3f,'readonly':_0x28969f['engine']['readonly']},this['stream'],this['logger']);}async['fetchAndVerifyVID'](_0xb163d1,_0x328f64=0x0){if(isNaN(Number(_0xb163d1['version']))){const _0x29b2fb=await this['store']['getApp'](_0xb163d1['id'],!![]);if(!isNaN(Number(_0x29b2fb['version']))){if(!this['apps'])this['apps']={};return this['apps'][_0xb163d1['id']]=_0x29b2fb,{'id':_0xb163d1['id'],'version':_0x29b2fb['version']};}else{if(_0x328f64<0xa)return await(0x0,utils_1['sleepFor'])(enums_1['HMSH_QUORUM_DELAY_MS']*0x2),await this['fetchAndVerifyVID'](_0xb163d1,_0x328f64+0x1);else this['logger']['error']('engine-vid-resolution-error',{'id':_0xb163d1['id'],'guid':this['guid']});}}return _0xb163d1;}async['getVID'](_0x2e29a1){if(this['cacheMode']==='nocache'){const _0x3cc7fb=await this['store']['getApp'](this['appId'],!![]);if(_0x3cc7fb['version']['toString']()===this['untilVersion']['toString']()){if(!this['apps'])this['apps']={};this['apps'][this['appId']]=_0x3cc7fb,this['setCacheMode']('cache',_0x3cc7fb['version']['toString']());}return{'id':this['appId'],'version':_0x3cc7fb['version']};}else return!this['apps']&&_0x2e29a1?(this['apps']={},this['apps'][this['appId']]=_0x2e29a1,_0x2e29a1):await this['fetchAndVerifyVID']({'id':this['appId'],'version':this['apps']?.[this['appId']]['version']});}['setCacheMode'](_0x3718a5,_0x14d7c4){this['logger']['info']('engine-executable-cache',{'mode':_0x3718a5,[_0x3718a5==='cache'?'target':'until']:_0x14d7c4}),this['cacheMode']=_0x3718a5,this['untilVersion']=_0x14d7c4;}async['routeToSubscribers'](_0x4e2201,_0x4b4e37){const _0x29565c=this['jobCallbacks'][_0x4b4e37['metadata']['jid']];_0x29565c&&(this['delistJobCallback'](_0x4b4e37['metadata']['jid']),_0x29565c(_0x4e2201,_0x4b4e37));}async['processWebHooks'](){this['taskService']['processWebHooks'](this['hook']['bind'](this));}async['processTimeHooks'](){this['taskService']['processTimeHooks'](this['hookTime']['bind'](this));}async['throttle'](_0x33215a){try{this['router']?.['setThrottle'](_0x33215a);}catch(_0x350b02){this['logger']['error']('engine-throttle-error',{'error':_0x350b02});}}async['initActivity'](_0x3ec246,_0x33f083={},_0x55d97c){const [_0x4ea2b8,_0x39b298]=await this['getSchema'](_0x3ec246),_0x30dfcb=activities_1['default'][utils_1['polyfill']['resolveActivityType'](_0x39b298['type'])];if(_0x30dfcb){const _0x56f9e4=(0x0,utils_1['formatISODate'])(new Date()),_0xaa84d0={'aid':_0x4ea2b8,'atp':_0x39b298['type'],'stp':_0x39b298['subtype'],'ac':_0x56f9e4,'au':_0x56f9e4},_0x89500f=null;return new _0x30dfcb(_0x39b298,_0x33f083,_0xaa84d0,_0x89500f,this,_0x55d97c);}else throw new Error('activity\x20type\x20'+_0x39b298['type']+'\x20not\x20found');}async['getSchema'](_0x3406c6){const _0x51096d=await this['store']['getApp'](this['appId']);if(!_0x51096d)throw new Error('no\x20app\x20found\x20for\x20id\x20'+this['appId']);if(this['isPrivate'](_0x3406c6)){const _0x43a77d=_0x3406c6['substring'](0x1),_0x48265a=await this['store']['getSchema'](_0x43a77d,await this['getVID'](_0x51096d));return[_0x43a77d,_0x48265a];}else{const _0x1859c8=await this['store']['getSubscription'](_0x3406c6,await this['getVID'](_0x51096d));if(_0x1859c8){const _0x5d6942=await this['store']['getSchema'](_0x1859c8,await this['getVID'](_0x51096d));return[_0x1859c8,_0x5d6942];}}throw new Error('no\x20subscription\x20found\x20for\x20topic\x20'+_0x3406c6+'\x20in\x20app\x20'+this['appId']+'\x20for\x20app\x20version\x20'+_0x51096d['version']);}async['getSettings'](){return await this['store']['getSettings']();}['isPrivate'](_0x2f7b96){return _0x2f7b96['startsWith']('.');}async['plan'](_0x26b8d3){const _0x3b08a2=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x3b08a2['plan'](_0x26b8d3);}async['deploy'](_0x2cdeae){const _0x17a6e7=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x17a6e7['deploy'](_0x2cdeae);}async['getStats'](_0x1ba8c3,_0x343c52){const {id:_0x53d75d,version:_0x2acf77}=await this['getVID'](),_0x55c344=new reporter_1['ReporterService']({'id':_0x53d75d,'version':_0x2acf77},this['store'],this['logger']),_0x2e8bad=await this['resolveQuery'](_0x1ba8c3,_0x343c52);return await _0x55c344['getStats'](_0x2e8bad);}async['getIds'](_0x472ef4,_0x32cc9d,_0x159d07=[]){const {id:_0x4cd555,version:_0x3bc4fa}=await this['getVID'](),_0x3bd98e=new reporter_1['ReporterService']({'id':_0x4cd555,'version':_0x3bc4fa},this['store'],this['logger']),_0x1e219c=await this['resolveQuery'](_0x472ef4,_0x32cc9d);return await _0x3bd98e['getIds'](_0x1e219c,_0x159d07);}async['resolveQuery'](_0x7ab61c,_0x1a9e6b){const _0x4c58b0=await this['initActivity'](_0x7ab61c,_0x1a9e6b['data']);return await _0x4c58b0['getState'](),{'end':_0x1a9e6b['end'],'start':_0x1a9e6b['start'],'range':_0x1a9e6b['range'],'granularity':_0x4c58b0['resolveGranularity'](),'key':_0x4c58b0['resolveJobKey'](_0x4c58b0['createInputContext']()),'sparse':_0x1a9e6b['sparse']};}async['processStreamMessage'](_0x1cbab4){this['logger']['debug']('engine-process',{'jid':_0x1cbab4['metadata']['jid'],'gid':_0x1cbab4['metadata']['gid'],'dad':_0x1cbab4['metadata']['dad'],'aid':_0x1cbab4['metadata']['aid'],'status':_0x1cbab4['status']||stream_1['StreamStatus']['SUCCESS'],'code':_0x1cbab4['code']||0xc8,'type':_0x1cbab4['type']});const _0x3fe616={'metadata':{'guid':_0x1cbab4['metadata']['guid'],'jid':_0x1cbab4['metadata']['jid'],'gid':_0x1cbab4['metadata']['gid'],'dad':_0x1cbab4['metadata']['dad'],'aid':_0x1cbab4['metadata']['aid']},'data':_0x1cbab4['data']};if(_0x1cbab4['type']===stream_1['StreamDataType']['TIMEHOOK']){const _0xbf4b49=await this['initActivity']('.'+_0x1cbab4['metadata']['aid'],_0x3fe616['data'],_0x3fe616);await _0xbf4b49['processTimeHookEvent'](_0x1cbab4['metadata']['jid']);}else{if(_0x1cbab4['type']===stream_1['StreamDataType']['WEBHOOK']){const _0x489c5a=await this['initActivity']('.'+_0x1cbab4['metadata']['aid'],_0x3fe616['data'],_0x3fe616);await _0x489c5a['processWebHookEvent'](_0x1cbab4['status'],_0x1cbab4['code']);}else{if(_0x1cbab4['type']===stream_1['StreamDataType']['TRANSITION']){const _0xebd2c5=await this['initActivity']('.'+_0x1cbab4['metadata']['aid'],_0x3fe616['data'],_0x3fe616);await _0xebd2c5['process']();}else{if(_0x1cbab4['type']===stream_1['StreamDataType']['AWAIT']){_0x3fe616['metadata']={..._0x3fe616['metadata'],'pj':_0x1cbab4['metadata']['jid'],'pg':_0x1cbab4['metadata']['gid'],'pd':_0x1cbab4['metadata']['dad'],'pa':_0x1cbab4['metadata']['aid'],'px':_0x1cbab4['metadata']['await']===![],'trc':_0x1cbab4['metadata']['trc'],'spn':_0x1cbab4['metadata']['spn']};const _0x427fb5=await this['initActivity'](_0x1cbab4['metadata']['topic'],_0x1cbab4['data'],_0x3fe616);await _0x427fb5['process']();}else{if(_0x1cbab4['type']===stream_1['StreamDataType']['RESULT']){const _0x12c75e=await this['initActivity']('.'+_0x3fe616['metadata']['aid'],_0x1cbab4['data'],_0x3fe616);await _0x12c75e['processEvent'](_0x1cbab4['status'],_0x1cbab4['code']);}else{const _0x3ef4d2=await this['initActivity']('.'+_0x1cbab4['metadata']['aid'],_0x1cbab4['data'],_0x3fe616);await _0x3ef4d2['processEvent'](_0x1cbab4['status'],_0x1cbab4['code'],'output');}}}}}this['logger']['debug']('engine-process-end',{'jid':_0x1cbab4['metadata']['jid'],'gid':_0x1cbab4['metadata']['gid'],'aid':_0x1cbab4['metadata']['aid']});}async['execAdjacentParent'](_0xf0cdfb,_0x2e03ce,_0x281143=![]){if(this['hasParentJob'](_0xf0cdfb)){const _0x511518=this['resolveError'](_0x2e03ce['metadata']),_0x1ac203=_0xf0cdfb['$self']?.['output']?.['metadata']?.['l2s']||_0xf0cdfb['$self']?.['output']?.['metadata']?.['l1s'],_0x42e4ae={'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0xf0cdfb['metadata']['pj'],'gid':_0xf0cdfb['metadata']['pg'],'dad':_0xf0cdfb['metadata']['pd'],'aid':_0xf0cdfb['metadata']['pa'],'trc':_0xf0cdfb['metadata']['trc'],'spn':_0x1ac203},'type':stream_1['StreamDataType']['RESULT'],'data':_0x2e03ce['data']};if(_0x511518&&_0x511518['code'])_0x42e4ae['status']=stream_1['StreamStatus']['ERROR'],_0x42e4ae['data']=_0x511518,_0x42e4ae['code']=_0x511518['code'],_0x42e4ae['stack']=_0x511518['stack'];else _0x281143?(_0x42e4ae['status']=stream_1['StreamStatus']['PENDING'],_0x42e4ae['code']=enums_1['HMSH_CODE_PENDING']):(_0x42e4ae['status']=stream_1['StreamStatus']['SUCCESS'],_0x42e4ae['code']=enums_1['HMSH_CODE_SUCCESS']);return await this['router']?.['publishMessage'](null,_0x42e4ae);}}['hasParentJob'](_0x7c5177,_0x227d25=![]){if(_0x227d25)return Boolean(_0x7c5177['metadata']['pj']&&_0x7c5177['metadata']['pa']&&!_0x7c5177['metadata']['px']);return Boolean(_0x7c5177['metadata']['pj']&&_0x7c5177['metadata']['pa']);}['resolveError'](_0x2cafdb){if(_0x2cafdb&&_0x2cafdb['err'])return JSON['parse'](_0x2cafdb['err']);}async['interrupt'](_0x49f444,_0x45f729,_0x35745b={}){await this['store']['interrupt'](_0x49f444,_0x45f729,_0x35745b);const _0x20b180=await this['getState'](_0x49f444,_0x45f729),_0x568bff={'interrupt':_0x35745b['descend'],'expire':_0x35745b['expire']};return await this['runJobCompletionTasks'](_0x20b180,_0x568bff);}async['scrub'](_0x44a6db){await this['store']['scrub'](_0x44a6db);}async['hook'](_0x48d1c0,_0xc9165b,_0x1d667f=stream_1['StreamStatus']['SUCCESS'],_0x560b55=0xc8){const _0x3ed654=await this['taskService']['getHookRule'](_0x48d1c0),[_0x423e5c]=await this['getSchema']('.'+_0x3ed654['to']),_0x579465={'type':stream_1['StreamDataType']['WEBHOOK'],'status':_0x1d667f,'code':_0x560b55,'metadata':{'guid':(0x0,utils_1['guid'])(),'aid':_0x423e5c,'topic':_0x48d1c0},'data':_0xc9165b};return await this['router']?.['publishMessage'](null,_0x579465);}async['hookTime'](_0x482fea,_0x1e4148,_0x5d1a0e,_0x526b67){if(_0x526b67==='interrupt'||_0x526b67==='expire')return await this['interrupt'](_0x5d1a0e,_0x482fea,{'suppress':!![],'expire':0x1});const [_0x287731,..._0x18c5ab]=_0x5d1a0e['split'](','),_0x22f2af=','+_0x18c5ab['join'](','),_0x419193={'type':stream_1['StreamDataType']['TIMEHOOK'],'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0x482fea,'gid':_0x1e4148,'dad':_0x22f2af,'aid':_0x287731},'data':{'timestamp':Date['now']()}};await this['router']?.['publishMessage'](null,_0x419193);}async['hookAll'](_0x929299,_0x3b2490,_0x117e33,_0xccff17=[]){const _0x1948fc=await this['getVID'](),_0x5baecc=await this['taskService']['getHookRule'](_0x929299);if(_0x5baecc){const _0x5baa82=await(0x0,utils_1['getSubscriptionTopic'])(_0x5baecc['to'],this['store'],_0x1948fc),_0x555429=await this['resolveQuery'](_0x5baa82,_0x117e33),_0x3e915f=new reporter_1['ReporterService'](_0x1948fc,this['store'],this['logger']),_0x253cfe=await _0x3e915f['getWorkItems'](_0x555429,_0xccff17);if(_0x253cfe['length']){const _0x253945=new task_1['TaskService'](this['store'],this['logger']);await _0x253945['enqueueWorkItems'](_0x253cfe['map'](_0x16db6a=>[_0x929299,_0x16db6a,_0x117e33['scrub']||![],JSON['stringify'](_0x3b2490)]['join'](key_1['VALSEP']))),this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'work','originator':this['guid']},this['appId']);}return _0x253cfe;}else throw new Error('unable\x20to\x20find\x20hook\x20rule\x20for\x20topic\x20'+_0x929299);}async['pub'](_0x5934ba,_0x4c76d4,_0x105474,_0x5a8d29){const _0x2fbbdd=await this['initActivity'](_0x5934ba,_0x4c76d4,_0x105474);if(_0x2fbbdd)return await _0x2fbbdd['process'](_0x5a8d29);else throw new Error('unable\x20to\x20process\x20activity\x20for\x20topic\x20'+_0x5934ba);}async['sub'](_0x3ab276,_0x51c63c){const _0x316934=async(_0xa7fe6c,_0x3d53d1)=>{_0x51c63c(_0x3d53d1['topic'],_0x3d53d1['job']);};return await this['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x316934,this['appId'],_0x3ab276);}async['unsub'](_0x247d7b){return await this['subscribe']['unsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0x247d7b);}async['psub'](_0x1f528c,_0x3295fa){const _0x202983=async(_0x322956,_0x4c52bf)=>{_0x3295fa(_0x4c52bf['topic'],_0x4c52bf['job']);};return await this['subscribe']['psubscribe'](key_1['KeyType']['QUORUM'],_0x202983,this['appId'],_0x1f528c);}async['punsub'](_0x29d966){return await this['subscribe']['punsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0x29d966);}async['pubsub'](_0x513630,_0x1dd453,_0x2f4655,_0x25c802=enums_1['HMSH_OTT_WAIT_TIME']){_0x2f4655={'metadata':{'ngn':this['guid'],'trc':_0x2f4655?.['metadata']?.['trc'],'spn':_0x2f4655?.['metadata']?.['spn']}};const _0x1cbd71=await this['pub'](_0x513630,_0x1dd453,_0x2f4655);return new Promise((_0x4c205e,_0x16e6ae)=>{this['registerJobCallback'](_0x1cbd71,(_0x39cb52,_0x5695e4)=>{if(_0x5695e4['metadata']['err']){const _0x1d5058=JSON['parse'](_0x5695e4['metadata']['err']);_0x16e6ae({..._0x1d5058,'job_id':_0x5695e4['metadata']['jid']});}else _0x4c205e(_0x5695e4);}),setTimeout(()=>{this['delistJobCallback'](_0x1cbd71),_0x16e6ae({'code':enums_1['HMSH_CODE_TIMEOUT'],'message':'timeout','job_id':_0x1cbd71});},_0x25c802);});}async['pubOneTimeSubs'](_0x7979cf,_0x29d117,_0x512d2c=![]){if(this['hasOneTimeSubscription'](_0x7979cf)){const _0x5a678b={'type':'job','topic':_0x7979cf['metadata']['jid'],'job':(0x0,utils_1['restoreHierarchy'])(_0x29d117)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0x5a678b,this['appId'],_0x7979cf['metadata']['ngn']);}}async['getPublishesTopic'](_0x31083b){const _0x416d07=await this['getVID'](),_0x9ba3ba=_0x31083b['metadata']['aid']||_0x31083b['$self']?.['output']?.['metadata']?.['aid'],_0x49d1e9=await this['store']['getSchema'](_0x9ba3ba,_0x416d07);return _0x49d1e9['publishes'];}async['pubPermSubs'](_0x119ade,_0x4de7a4,_0x4fdbdc=![]){const _0x148229=await this['getPublishesTopic'](_0x119ade);if(_0x148229){const _0x2e795f={'type':'job','topic':_0x148229,'job':(0x0,utils_1['restoreHierarchy'])(_0x4de7a4)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0x2e795f,this['appId'],_0x148229+'.'+_0x119ade['metadata']['jid']);}}async['add'](_0x2c3ee0){return await this['router']?.['publishMessage'](null,_0x2c3ee0);}['registerJobCallback'](_0x5ba90c,_0x2070bc){this['jobCallbacks'][_0x5ba90c]=_0x2070bc;}['delistJobCallback'](_0x13dbd2){delete this['jobCallbacks'][_0x13dbd2];}['hasOneTimeSubscription'](_0x4713a5){return Boolean(_0x4713a5['metadata']['ngn']);}async['runJobCompletionTasks'](_0x3033cd,_0x51ce7c={}){const _0x58c299=this['hasParentJob'](_0x3033cd,!![]),_0x38cf14=this['hasOneTimeSubscription'](_0x3033cd),_0x235279=await this['getPublishesTopic'](_0x3033cd);let _0x3ba096;if(_0x58c299||_0x38cf14||_0x235279){const _0xbaa113=await this['getState'](_0x3033cd['metadata']['tpc'],_0x3033cd['metadata']['jid']);_0x3ba096=await this['execAdjacentParent'](_0x3033cd,_0xbaa113,_0x51ce7c['emit']),this['pubOneTimeSubs'](_0x3033cd,_0xbaa113,_0x51ce7c['emit']),this['pubPermSubs'](_0x3033cd,_0xbaa113,_0x51ce7c['emit']);}return!_0x51ce7c['emit']&&this['taskService']['registerJobForCleanup'](_0x3033cd['metadata']['jid'],this['resolveExpires'](_0x3033cd,_0x51ce7c),_0x51ce7c),_0x3ba096;}['resolveExpires'](_0x164bfc,_0x3b5cba){return _0x3b5cba['expire']??_0x164bfc['metadata']['expire']??enums_1['HMSH_EXPIRE_JOB_SECONDS'];}async['export'](_0x5b3d4b){return await this['exporter']['export'](_0x5b3d4b);}async['getRaw'](_0x2c9ee9){return await this['store']['getRaw'](_0x2c9ee9);}async['getStatus'](_0x54376c){const {id:_0x561e34}=await this['getVID']();return await this['store']['getStatus'](_0x54376c,_0x561e34);}async['getState'](_0x54d8b1,_0x132012){const _0x4977de=await this['store']['getSymbols']('$'+_0x54d8b1),_0x2eac5c={['$'+_0x54d8b1]:Object['keys'](_0x4977de)},_0x262525={},_0xde41b=await this['store']['getState'](_0x132012,_0x2eac5c,_0x262525);if(!_0xde41b)throw new Error('not\x20found\x20'+_0x132012);const [_0x49831c,_0x5c04fc]=_0xde41b,_0x1ad954=(0x0,utils_1['restoreHierarchy'])(_0x49831c);return _0x5c04fc&&_0x1ad954['metadata']&&(_0x1ad954['metadata']['js']=_0x5c04fc),_0x1ad954;}async['getQueryState'](_0x5162a6,_0x16fa3f){return await this['store']['getQueryState'](_0x5162a6,_0x16fa3f);}async['compress'](_0x48268c){const _0x1e6a77=await this['store']['getSymbolValues'](),_0x2d4689=Object['keys'](_0x1e6a77)['length'],_0x500f8e=Math['pow'](0x34,0x2)-0x1,_0x2f79b4=serializer_1['SerializerService']['filterSymVals'](_0x2d4689,_0x500f8e,_0x1e6a77,new Set(_0x48268c));return await this['store']['addSymbolValues'](_0x2f79b4);}}exports['EngineService']=EngineService;
|
|
1
|
+
'use strict';(function(_0xc306b2,_0xc01fed){const _0x3b7bf8=_0x26e6,_0x427002=_0xc306b2();while(!![]){try{const _0x4db61e=parseInt(_0x3b7bf8(0x1a4))/0x1+-parseInt(_0x3b7bf8(0x1ac))/0x2+-parseInt(_0x3b7bf8(0x1a5))/0x3*(-parseInt(_0x3b7bf8(0x1ae))/0x4)+-parseInt(_0x3b7bf8(0x1ad))/0x5+-parseInt(_0x3b7bf8(0x1ab))/0x6*(-parseInt(_0x3b7bf8(0x1a6))/0x7)+parseInt(_0x3b7bf8(0x1aa))/0x8*(-parseInt(_0x3b7bf8(0x1a9))/0x9)+parseInt(_0x3b7bf8(0x1a8))/0xa*(parseInt(_0x3b7bf8(0x1a7))/0xb);if(_0x4db61e===_0xc01fed)break;else _0x427002['push'](_0x427002['shift']());}catch(_0x4b5319){_0x427002['push'](_0x427002['shift']());}}}(_0x39bf,0x338fa));var __importDefault=this&&this['__importDefault']||function(_0x35fd62){return _0x35fd62&&_0x35fd62['__esModule']?_0x35fd62:{'default':_0x35fd62};};function _0x39bf(){const _0x8f1e9e=['6mEbbtr','33936Hagiah','418660uTPqEQ','156rArDiJ','103883BfTtin','1488YhddvA','2898931kcmDWS','44143tceIbw','460JPnqsv','922644NETtgQ','32hsrLdj'];_0x39bf=function(){return _0x8f1e9e;};return _0x39bf();}function _0x26e6(_0x2ae416,_0x2bebe9){const _0x39bfdb=_0x39bf();return _0x26e6=function(_0x26e603,_0x2ce163){_0x26e603=_0x26e603-0x1a4;let _0x4e68ec=_0x39bfdb[_0x26e603];return _0x4e68ec;},_0x26e6(_0x2ae416,_0x2bebe9);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['EngineService']=void 0x0;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'](_0x4ffcc7,_0x46401c,_0x1b1612,_0x906b9b,_0x10468f){if(_0x906b9b['engine']){const _0x53984e=new EngineService();_0x53984e['verifyEngineFields'](_0x906b9b),_0x53984e['namespace']=_0x4ffcc7,_0x53984e['appId']=_0x46401c,_0x53984e['guid']=_0x1b1612,_0x53984e['logger']=_0x10468f,await _0x53984e['initSearchChannel'](_0x906b9b['engine']['store']),await _0x53984e['initStoreChannel'](_0x906b9b['engine']['store']),await _0x53984e['initSubChannel'](_0x906b9b['engine']['sub'],_0x906b9b['engine']['pub']),await _0x53984e['initStreamChannel'](_0x906b9b['engine']['stream'],_0x906b9b['engine']['store']),_0x53984e['router']=await _0x53984e['initRouter'](_0x906b9b);const _0x33b766=_0x53984e['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x53984e['appId']});return _0x53984e['router']['consumeMessages'](_0x33b766,'ENGINE',_0x53984e['guid'],_0x53984e['processStreamMessage']['bind'](_0x53984e)),_0x53984e['taskService']=new task_1['TaskService'](_0x53984e['store'],_0x10468f),_0x53984e['exporter']=new exporter_1['ExporterService'](_0x53984e['appId'],_0x53984e['store'],_0x10468f),_0x53984e['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x53984e;}}['verifyEngineFields'](_0x392216){if(!(0x0,utils_1['identifyProvider'])(_0x392216['engine']['store'])||!(0x0,utils_1['identifyProvider'])(_0x392216['engine']['stream'])||!(0x0,utils_1['identifyProvider'])(_0x392216['engine']['sub']))throw new Error('engine\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields.');}async['initSearchChannel'](_0x49fef0,_0x4e54ce){this['search']=await factory_1['SearchServiceFactory']['init'](_0x49fef0,_0x4e54ce,this['namespace'],this['appId'],this['logger']);}async['initStoreChannel'](_0x566fb7){this['store']=await factory_2['StoreServiceFactory']['init'](_0x566fb7,this['namespace'],this['appId'],this['logger']);}async['initSubChannel'](_0x44697e,_0xad1780){this['subscribe']=await factory_4['SubServiceFactory']['init'](_0x44697e,_0xad1780,this['namespace'],this['appId'],this['guid'],this['logger']);}async['initStreamChannel'](_0x1ab167,_0x28598e){this['stream']=await factory_3['StreamServiceFactory']['init'](_0x1ab167,_0x28598e,this['namespace'],this['appId'],this['logger']);}async['initRouter'](_0x48d37f){const _0x111524=await this['store']['getThrottleRate'](':');return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['ENGINE'],'reclaimDelay':_0x48d37f['engine']['reclaimDelay'],'reclaimCount':_0x48d37f['engine']['reclaimCount'],'throttle':_0x111524,'readonly':_0x48d37f['engine']['readonly']},this['stream'],this['logger']);}async['fetchAndVerifyVID'](_0x43378f,_0x17a595=0x0){if(isNaN(Number(_0x43378f['version']))){const _0x19a91b=await this['store']['getApp'](_0x43378f['id'],!![]);if(!isNaN(Number(_0x19a91b['version']))){if(!this['apps'])this['apps']={};return this['apps'][_0x43378f['id']]=_0x19a91b,{'id':_0x43378f['id'],'version':_0x19a91b['version']};}else{if(_0x17a595<0xa)return await(0x0,utils_1['sleepFor'])(enums_1['HMSH_QUORUM_DELAY_MS']*0x2),await this['fetchAndVerifyVID'](_0x43378f,_0x17a595+0x1);else this['logger']['error']('engine-vid-resolution-error',{'id':_0x43378f['id'],'guid':this['guid']});}}return _0x43378f;}async['getVID'](_0x2f5039){if(this['cacheMode']==='nocache'){const _0xafe9de=await this['store']['getApp'](this['appId'],!![]);if(_0xafe9de['version']['toString']()===this['untilVersion']['toString']()){if(!this['apps'])this['apps']={};this['apps'][this['appId']]=_0xafe9de,this['setCacheMode']('cache',_0xafe9de['version']['toString']());}return{'id':this['appId'],'version':_0xafe9de['version']};}else return!this['apps']&&_0x2f5039?(this['apps']={},this['apps'][this['appId']]=_0x2f5039,_0x2f5039):await this['fetchAndVerifyVID']({'id':this['appId'],'version':this['apps']?.[this['appId']]['version']});}['setCacheMode'](_0x12523a,_0x116f28){this['logger']['info']('engine-executable-cache',{'mode':_0x12523a,[_0x12523a==='cache'?'target':'until']:_0x116f28}),this['cacheMode']=_0x12523a,this['untilVersion']=_0x116f28;}async['routeToSubscribers'](_0x57e4b7,_0x5250a8){const _0x56b3b2=this['jobCallbacks'][_0x5250a8['metadata']['jid']];_0x56b3b2&&(this['delistJobCallback'](_0x5250a8['metadata']['jid']),_0x56b3b2(_0x57e4b7,_0x5250a8));}async['processWebHooks'](){this['taskService']['processWebHooks'](this['hook']['bind'](this));}async['processTimeHooks'](){this['taskService']['processTimeHooks'](this['hookTime']['bind'](this));}async['throttle'](_0x6e3936){try{this['router']?.['setThrottle'](_0x6e3936);}catch(_0x297726){this['logger']['error']('engine-throttle-error',{'error':_0x297726});}}async['initActivity'](_0x3a26af,_0x585389={},_0x1153a1){const [_0x2aa374,_0x166887]=await this['getSchema'](_0x3a26af),_0x54247d=activities_1['default'][utils_1['polyfill']['resolveActivityType'](_0x166887['type'])];if(_0x54247d){const _0x2602bf=(0x0,utils_1['formatISODate'])(new Date()),_0xaeee44={'aid':_0x2aa374,'atp':_0x166887['type'],'stp':_0x166887['subtype'],'ac':_0x2602bf,'au':_0x2602bf},_0x9f2e1e=null;return new _0x54247d(_0x166887,_0x585389,_0xaeee44,_0x9f2e1e,this,_0x1153a1);}else throw new Error('activity\x20type\x20'+_0x166887['type']+'\x20not\x20found');}async['getSchema'](_0x19f038){const _0x279ef3=await this['store']['getApp'](this['appId']);if(!_0x279ef3)throw new Error('no\x20app\x20found\x20for\x20id\x20'+this['appId']);if(this['isPrivate'](_0x19f038)){const _0x1ced92=_0x19f038['substring'](0x1),_0x3e9ecc=await this['store']['getSchema'](_0x1ced92,await this['getVID'](_0x279ef3));return[_0x1ced92,_0x3e9ecc];}else{const _0x30921e=await this['store']['getSubscription'](_0x19f038,await this['getVID'](_0x279ef3));if(_0x30921e){const _0x5a3488=await this['store']['getSchema'](_0x30921e,await this['getVID'](_0x279ef3));return[_0x30921e,_0x5a3488];}}throw new Error('no\x20subscription\x20found\x20for\x20topic\x20'+_0x19f038+'\x20in\x20app\x20'+this['appId']+'\x20for\x20app\x20version\x20'+_0x279ef3['version']);}async['getSettings'](){return await this['store']['getSettings']();}['isPrivate'](_0x4da3a2){return _0x4da3a2['startsWith']('.');}async['plan'](_0x598003){const _0x28582a=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x28582a['plan'](_0x598003);}async['deploy'](_0x28cf3d){const _0x2f5140=new compiler_1['CompilerService'](this['store'],this['stream'],this['logger']);return await _0x2f5140['deploy'](_0x28cf3d);}async['getStats'](_0x25aa4a,_0x3ca3f9){const {id:_0x1aa88d,version:_0xe4dc38}=await this['getVID'](),_0x19ed3a=new reporter_1['ReporterService']({'id':_0x1aa88d,'version':_0xe4dc38},this['store'],this['logger']),_0x4662a7=await this['resolveQuery'](_0x25aa4a,_0x3ca3f9);return await _0x19ed3a['getStats'](_0x4662a7);}async['getIds'](_0x13e212,_0x5af70c,_0x26c9d8=[]){const {id:_0x24410c,version:_0x5814f6}=await this['getVID'](),_0x364cdd=new reporter_1['ReporterService']({'id':_0x24410c,'version':_0x5814f6},this['store'],this['logger']),_0x276324=await this['resolveQuery'](_0x13e212,_0x5af70c);return await _0x364cdd['getIds'](_0x276324,_0x26c9d8);}async['resolveQuery'](_0x12d703,_0x33e0f1){const _0x4cd421=await this['initActivity'](_0x12d703,_0x33e0f1['data']);return await _0x4cd421['getState'](),{'end':_0x33e0f1['end'],'start':_0x33e0f1['start'],'range':_0x33e0f1['range'],'granularity':_0x4cd421['resolveGranularity'](),'key':_0x4cd421['resolveJobKey'](_0x4cd421['createInputContext']()),'sparse':_0x33e0f1['sparse']};}async['processStreamMessage'](_0x371b15){this['logger']['debug']('engine-process',{'jid':_0x371b15['metadata']['jid'],'gid':_0x371b15['metadata']['gid'],'dad':_0x371b15['metadata']['dad'],'aid':_0x371b15['metadata']['aid'],'status':_0x371b15['status']||stream_1['StreamStatus']['SUCCESS'],'code':_0x371b15['code']||0xc8,'type':_0x371b15['type']});const _0x25281a={'metadata':{'guid':_0x371b15['metadata']['guid'],'jid':_0x371b15['metadata']['jid'],'gid':_0x371b15['metadata']['gid'],'dad':_0x371b15['metadata']['dad'],'aid':_0x371b15['metadata']['aid']},'data':_0x371b15['data']};if(_0x371b15['type']===stream_1['StreamDataType']['TIMEHOOK']){const _0x35ad53=await this['initActivity']('.'+_0x371b15['metadata']['aid'],_0x25281a['data'],_0x25281a);await _0x35ad53['processTimeHookEvent'](_0x371b15['metadata']['jid']);}else{if(_0x371b15['type']===stream_1['StreamDataType']['WEBHOOK']){const _0x420d18=await this['initActivity']('.'+_0x371b15['metadata']['aid'],_0x25281a['data'],_0x25281a);await _0x420d18['processWebHookEvent'](_0x371b15['status'],_0x371b15['code']);}else{if(_0x371b15['type']===stream_1['StreamDataType']['TRANSITION']){const _0x5d6430=await this['initActivity']('.'+_0x371b15['metadata']['aid'],_0x25281a['data'],_0x25281a);await _0x5d6430['process']();}else{if(_0x371b15['type']===stream_1['StreamDataType']['AWAIT']){_0x25281a['metadata']={..._0x25281a['metadata'],'pj':_0x371b15['metadata']['jid'],'pg':_0x371b15['metadata']['gid'],'pd':_0x371b15['metadata']['dad'],'pa':_0x371b15['metadata']['aid'],'px':_0x371b15['metadata']['await']===![],'trc':_0x371b15['metadata']['trc'],'spn':_0x371b15['metadata']['spn']};const _0x244f1c=await this['initActivity'](_0x371b15['metadata']['topic'],_0x371b15['data'],_0x25281a);await _0x244f1c['process']();}else{if(_0x371b15['type']===stream_1['StreamDataType']['RESULT']){const _0x4a43bc=await this['initActivity']('.'+_0x25281a['metadata']['aid'],_0x371b15['data'],_0x25281a);await _0x4a43bc['processEvent'](_0x371b15['status'],_0x371b15['code']);}else{const _0x2dee7b=await this['initActivity']('.'+_0x371b15['metadata']['aid'],_0x371b15['data'],_0x25281a);await _0x2dee7b['processEvent'](_0x371b15['status'],_0x371b15['code'],'output');}}}}}this['logger']['debug']('engine-process-end',{'jid':_0x371b15['metadata']['jid'],'gid':_0x371b15['metadata']['gid'],'aid':_0x371b15['metadata']['aid']});}async['execAdjacentParent'](_0x5bcd75,_0x352ff6,_0x18ca27=![]){if(this['hasParentJob'](_0x5bcd75)){const _0x469186=this['resolveError'](_0x352ff6['metadata']),_0x1eb7d9=_0x5bcd75['$self']?.['output']?.['metadata']?.['l2s']||_0x5bcd75['$self']?.['output']?.['metadata']?.['l1s'],_0x50ad18={'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0x5bcd75['metadata']['pj'],'gid':_0x5bcd75['metadata']['pg'],'dad':_0x5bcd75['metadata']['pd'],'aid':_0x5bcd75['metadata']['pa'],'trc':_0x5bcd75['metadata']['trc'],'spn':_0x1eb7d9},'type':stream_1['StreamDataType']['RESULT'],'data':_0x352ff6['data']};if(_0x469186&&_0x469186['code'])_0x50ad18['status']=stream_1['StreamStatus']['ERROR'],_0x50ad18['data']=_0x469186,_0x50ad18['code']=_0x469186['code'],_0x50ad18['stack']=_0x469186['stack'];else _0x18ca27?(_0x50ad18['status']=stream_1['StreamStatus']['PENDING'],_0x50ad18['code']=enums_1['HMSH_CODE_PENDING']):(_0x50ad18['status']=stream_1['StreamStatus']['SUCCESS'],_0x50ad18['code']=enums_1['HMSH_CODE_SUCCESS']);return await this['router']?.['publishMessage'](null,_0x50ad18);}}['hasParentJob'](_0x2e110e,_0x509fda=![]){if(_0x509fda)return Boolean(_0x2e110e['metadata']['pj']&&_0x2e110e['metadata']['pa']&&!_0x2e110e['metadata']['px']);return Boolean(_0x2e110e['metadata']['pj']&&_0x2e110e['metadata']['pa']);}['resolveError'](_0x212288){if(_0x212288&&_0x212288['err'])return JSON['parse'](_0x212288['err']);}async['interrupt'](_0x398f3b,_0x28fec1,_0x1ce185={}){await this['store']['interrupt'](_0x398f3b,_0x28fec1,_0x1ce185);const _0x254b8d=await this['getState'](_0x398f3b,_0x28fec1),_0x1a7cde={'interrupt':_0x1ce185['descend'],'expire':_0x1ce185['expire']};return await this['runJobCompletionTasks'](_0x254b8d,_0x1a7cde);}async['scrub'](_0xd48d85){await this['store']['scrub'](_0xd48d85);}async['hook'](_0x1a6a8a,_0x333497,_0x5ccc20=stream_1['StreamStatus']['SUCCESS'],_0x3e3a65=0xc8){const _0x176c22=await this['taskService']['getHookRule'](_0x1a6a8a),[_0x2dede2]=await this['getSchema']('.'+_0x176c22['to']),_0x968e66={'type':stream_1['StreamDataType']['WEBHOOK'],'status':_0x5ccc20,'code':_0x3e3a65,'metadata':{'guid':(0x0,utils_1['guid'])(),'aid':_0x2dede2,'topic':_0x1a6a8a},'data':_0x333497};return await this['router']?.['publishMessage'](null,_0x968e66);}async['hookTime'](_0x352e10,_0x26e872,_0x203276,_0x215a6e){if(_0x215a6e==='interrupt'||_0x215a6e==='expire')return await this['interrupt'](_0x203276,_0x352e10,{'suppress':!![],'expire':0x1});const [_0x2fb840,..._0x644c32]=_0x203276['split'](','),_0x4d6f6e=','+_0x644c32['join'](','),_0xe14dc6={'type':stream_1['StreamDataType']['TIMEHOOK'],'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':_0x352e10,'gid':_0x26e872,'dad':_0x4d6f6e,'aid':_0x2fb840},'data':{'timestamp':Date['now']()}};await this['router']?.['publishMessage'](null,_0xe14dc6);}async['hookAll'](_0x78136c,_0x380231,_0x4422ce,_0x2a937b=[]){const _0x91b25c=await this['getVID'](),_0x4bea2f=await this['taskService']['getHookRule'](_0x78136c);if(_0x4bea2f){const _0x543769=await(0x0,utils_1['getSubscriptionTopic'])(_0x4bea2f['to'],this['store'],_0x91b25c),_0x5a65c1=await this['resolveQuery'](_0x543769,_0x4422ce),_0x3ac9cf=new reporter_1['ReporterService'](_0x91b25c,this['store'],this['logger']),_0x19bfcf=await _0x3ac9cf['getWorkItems'](_0x5a65c1,_0x2a937b);if(_0x19bfcf['length']){const _0x5e43a3=new task_1['TaskService'](this['store'],this['logger']);await _0x5e43a3['enqueueWorkItems'](_0x19bfcf['map'](_0x9a513=>[_0x78136c,_0x9a513,_0x4422ce['scrub']||![],JSON['stringify'](_0x380231)]['join'](key_1['VALSEP']))),this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'work','originator':this['guid']},this['appId']);}return _0x19bfcf;}else throw new Error('unable\x20to\x20find\x20hook\x20rule\x20for\x20topic\x20'+_0x78136c);}async['pub'](_0x1fdd40,_0xbb5ee6,_0xd1f1c0,_0x424fc6){const _0x26e929=await this['initActivity'](_0x1fdd40,_0xbb5ee6,_0xd1f1c0);if(_0x26e929)return await _0x26e929['process'](_0x424fc6);else throw new Error('unable\x20to\x20process\x20activity\x20for\x20topic\x20'+_0x1fdd40);}async['sub'](_0x3616f2,_0x1ea009){const _0x8bb984=async(_0x21d1b7,_0x1865f5)=>{_0x1ea009(_0x1865f5['topic'],_0x1865f5['job']);};return await this['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x8bb984,this['appId'],_0x3616f2);}async['unsub'](_0xe0dee6){return await this['subscribe']['unsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0xe0dee6);}async['psub'](_0x49a451,_0x2801c7){const _0x40e0e5=async(_0x39ecbf,_0x35249f)=>{_0x2801c7(_0x35249f['topic'],_0x35249f['job']);};return await this['subscribe']['psubscribe'](key_1['KeyType']['QUORUM'],_0x40e0e5,this['appId'],_0x49a451);}async['punsub'](_0x2d291f){return await this['subscribe']['punsubscribe'](key_1['KeyType']['QUORUM'],this['appId'],_0x2d291f);}async['pubsub'](_0x19f0da,_0x3c03e5,_0xe2327e,_0x2ef3be=enums_1['HMSH_OTT_WAIT_TIME']){_0xe2327e={'metadata':{'ngn':this['guid'],'trc':_0xe2327e?.['metadata']?.['trc'],'spn':_0xe2327e?.['metadata']?.['spn']}};const _0x35362c=await this['pub'](_0x19f0da,_0x3c03e5,_0xe2327e);return new Promise((_0x4879d3,_0x4dec13)=>{this['registerJobCallback'](_0x35362c,(_0x489b22,_0x5431a4)=>{if(_0x5431a4['metadata']['err']){const _0x271171=JSON['parse'](_0x5431a4['metadata']['err']);_0x4dec13({..._0x271171,'job_id':_0x5431a4['metadata']['jid']});}else _0x4879d3(_0x5431a4);}),setTimeout(()=>{this['delistJobCallback'](_0x35362c),_0x4dec13({'code':enums_1['HMSH_CODE_TIMEOUT'],'message':'timeout','job_id':_0x35362c});},_0x2ef3be);});}async['pubOneTimeSubs'](_0xafa197,_0x581d56,_0xcfbd06=![]){if(this['hasOneTimeSubscription'](_0xafa197)){const _0x37b4d8={'type':'job','topic':_0xafa197['metadata']['jid'],'job':(0x0,utils_1['restoreHierarchy'])(_0x581d56)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0x37b4d8,this['appId'],_0xafa197['metadata']['ngn']);}}async['getPublishesTopic'](_0x1e68d3){const _0x2036e8=await this['getVID'](),_0x165f06=_0x1e68d3['metadata']['aid']||_0x1e68d3['$self']?.['output']?.['metadata']?.['aid'],_0xbd4e8d=await this['store']['getSchema'](_0x165f06,_0x2036e8);return _0xbd4e8d['publishes'];}async['pubPermSubs'](_0x4b71f9,_0x38fc8f,_0x169ad5=![]){const _0x17208e=await this['getPublishesTopic'](_0x4b71f9);if(_0x17208e){const _0x11bed7={'type':'job','topic':_0x17208e,'job':(0x0,utils_1['restoreHierarchy'])(_0x38fc8f)};this['subscribe']['publish'](key_1['KeyType']['QUORUM'],_0x11bed7,this['appId'],_0x17208e+'.'+_0x4b71f9['metadata']['jid']);}}async['add'](_0x3ddaa5){return await this['router']?.['publishMessage'](null,_0x3ddaa5);}['registerJobCallback'](_0x5dc6d1,_0xf07d50){this['jobCallbacks'][_0x5dc6d1]=_0xf07d50;}['delistJobCallback'](_0x3969b3){delete this['jobCallbacks'][_0x3969b3];}['hasOneTimeSubscription'](_0x5b0c5e){return Boolean(_0x5b0c5e['metadata']['ngn']);}async['runJobCompletionTasks'](_0x574ee4,_0x9fc0d7={}){const _0x584215=this['hasParentJob'](_0x574ee4,!![]),_0x2fe48e=this['hasOneTimeSubscription'](_0x574ee4),_0x141c1f=await this['getPublishesTopic'](_0x574ee4);let _0x1997b0;if(_0x584215||_0x2fe48e||_0x141c1f){const _0x2942b8=await this['getState'](_0x574ee4['metadata']['tpc'],_0x574ee4['metadata']['jid']);_0x1997b0=await this['execAdjacentParent'](_0x574ee4,_0x2942b8,_0x9fc0d7['emit']),this['pubOneTimeSubs'](_0x574ee4,_0x2942b8,_0x9fc0d7['emit']),this['pubPermSubs'](_0x574ee4,_0x2942b8,_0x9fc0d7['emit']);}return!_0x9fc0d7['emit']&&this['taskService']['registerJobForCleanup'](_0x574ee4['metadata']['jid'],this['resolveExpires'](_0x574ee4,_0x9fc0d7),_0x9fc0d7),_0x1997b0;}['resolveExpires'](_0x27f594,_0x1365b7){return _0x1365b7['expire']??_0x27f594['metadata']['expire']??enums_1['HMSH_EXPIRE_JOB_SECONDS'];}async['export'](_0x5169fc){return await this['exporter']['export'](_0x5169fc);}async['getRaw'](_0x56a8ad){return await this['store']['getRaw'](_0x56a8ad);}async['getStatus'](_0x3b873c){const {id:_0xc232c}=await this['getVID']();return await this['store']['getStatus'](_0x3b873c,_0xc232c);}async['getState'](_0x26a63e,_0x4cb928){const _0x3dc893=await this['store']['getSymbols']('$'+_0x26a63e),_0x3e08e0={['$'+_0x26a63e]:Object['keys'](_0x3dc893)},_0x1becdd={},_0x3a9002=await this['store']['getState'](_0x4cb928,_0x3e08e0,_0x1becdd);if(!_0x3a9002)throw new Error('not\x20found\x20'+_0x4cb928);const [_0x1c54e9,_0x1a4eaf]=_0x3a9002,_0xc32f71=(0x0,utils_1['restoreHierarchy'])(_0x1c54e9);return _0x1a4eaf&&_0xc32f71['metadata']&&(_0xc32f71['metadata']['js']=_0x1a4eaf),_0xc32f71;}async['getQueryState'](_0x2bfbbb,_0x198cee){return await this['store']['getQueryState'](_0x2bfbbb,_0x198cee);}async['compress'](_0x12f379){const _0x736c36=await this['store']['getSymbolValues'](),_0xc7747d=Object['keys'](_0x736c36)['length'],_0x261abb=Math['pow'](0x34,0x2)-0x1,_0x3a5984=serializer_1['SerializerService']['filterSymVals'](_0xc7747d,_0x261abb,_0x736c36,new Set(_0x12f379));return await this['store']['addSymbolValues'](_0x3a5984);}}exports['EngineService']=EngineService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';(function(_0x188735,_0x25d9bc){const _0x375173=_0x29a4,_0x7f7c00=_0x188735();while(!![]){try{const _0x52b865=-parseInt(_0x375173(0x1d1))/0x1+-parseInt(_0x375173(0x1cf))/0x2+-parseInt(_0x375173(0x1c8))/0x3*(-parseInt(_0x375173(0x1ce))/0x4)+parseInt(_0x375173(0x1d0))/0x5*(parseInt(_0x375173(0x1cc))/0x6)+parseInt(_0x375173(0x1ca))/0x7*(-parseInt(_0x375173(0x1d2))/0x8)+-parseInt(_0x375173(0x1c9))/0x9*(-parseInt(_0x375173(0x1cd))/0xa)+parseInt(_0x375173(0x1cb))/0xb;if(_0x52b865===_0x25d9bc)break;else _0x7f7c00['push'](_0x7f7c00['shift']());}catch(_0x52e0dd){_0x7f7c00['push'](_0x7f7c00['shift']());}}}(_0x3894,0x9b6ad));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ExporterService']=void 0x0;function _0x29a4(_0x504475,_0x405f92){const _0x3894f1=_0x3894();return _0x29a4=function(_0x29a48e,_0x106faf){_0x29a48e=_0x29a48e-0x1c8;let _0x58a244=_0x3894f1[_0x29a48e];return _0x58a244;},_0x29a4(_0x504475,_0x405f92);}const key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),serializer_1=require('../serializer');class ExporterService{constructor(_0x3fdf3f,_0x255efd,_0x5d9c51){this['appId']=_0x3fdf3f,this['logger']=_0x5d9c51,this['store']=_0x255efd;}async['export'](_0x2d3ea5,_0xb7f6d5={}){!this['symbols']&&(this['symbols']=this['store']['getAllSymbols'](),this['symbols']=await this['symbols']);const _0x51da1b=[],_0x4351b5=await this['store']['getRaw'](_0x2d3ea5),_0x341626=this['inflate'](_0x4351b5,_0x51da1b);return _0x341626;}['inflateKey'](_0x47f27b){return _0x47f27b in this['symbols']?this['symbols'][_0x47f27b]:_0x47f27b;}['inflate'](_0x285437,_0x4e6a15){const _0x37a490={'hooks':{},'main':{'cursor':-0x1,'items':[]}},_0x27dc17={},_0x5c330d=this['inflateDependencyData'](_0x4e6a15,_0x37a490),_0x46e7ad=/^([a-zA-Z]{3}),(\d+(?:,\d+)*)/;return Object['entries'](_0x285437)['forEach'](([_0x3386a4,_0x194a53])=>{const _0x2afc72=_0x3386a4['match'](_0x46e7ad);if(_0x2afc72){const [_0x38339b,_0x3a0840,_0x425c7d]=_0x2afc72,_0x24a00f=this['inflateKey'](_0x3a0840),_0x224d07=''+_0x425c7d['replace'](/,/g,'/'),_0x5b223c=serializer_1['SerializerService']['fromString'](_0x194a53);_0x27dc17[_0x224d07+'/'+_0x24a00f]=_0x5b223c;}else _0x3386a4['length']===0x3&&(_0x27dc17[this['inflateKey'](_0x3386a4)]=serializer_1['SerializerService']['fromString'](_0x194a53));}),{'dependencies':_0x5c330d,'process':(0x0,utils_1['restoreHierarchy'])(_0x27dc17),'status':_0x285437[':']};}['inflateDependencyData'](_0x17ca6c,_0x4eff1a){const _0x519eb4=/([0-9,]+)-(\d+)$/,_0x2e8666=/-(\d+)$/;return _0x17ca6c['map']((_0x19070a,_0x2c6905)=>{const [_0x3c84bf,_0x547443,_0x52a983,_0x29e834,..._0x516984]=_0x19070a['split'](key_1['VALSEP']),_0x33b5ac=_0x516984['join'](key_1['VALSEP']),_0xca6563=_0x33b5ac['match'](_0x519eb4);let _0x2197ae,_0x127504,_0x507525='';if(_0xca6563){const [_0x3c2ecf,_0x6ab025,_0x4f835b]=_0xca6563;_0x507525=_0x6ab025['split'](',')['join']('/'),_0x2197ae=_0x507525+'['+_0x4f835b+']',_0x127504='hook';}else{const _0x2405a5=_0x33b5ac['match'](_0x2e8666);if(_0x2405a5){const [_0x2aa894,_0x430788]=_0x2405a5;_0x2197ae='['+_0x430788+']',_0x127504='flow';}else _0x2197ae='/',_0x127504='other';}return{'type':_0x3c84bf,'topic':_0x547443,'gid':_0x52a983,'jid':_0x33b5ac};});}}exports['ExporterService']=ExporterService;function _0x3894(){const _0x5cb809=['24262502YnCjIu','6733224rSEFca','20necHlV','16ZjOlBL','2424566whvcAF','5aCguZM','723479FzIOce','18856mxmrQm','98748CioAsO','621432CmArUT','3045kzlYBY'];_0x3894=function(){return _0x5cb809;};return _0x3894();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0x373f(_0x58b525,_0x57d52a){const _0x4d0352=_0x4d03();return _0x373f=function(_0x373f4a,_0x30579d){_0x373f4a=_0x373f4a-0xa2;let _0x2d65c1=_0x4d0352[_0x373f4a];return _0x2d65c1;},_0x373f(_0x58b525,_0x57d52a);}(function(_0x4fb3a8,_0x16ef41){const _0x306c2b=_0x373f,_0x3db360=_0x4fb3a8();while(!![]){try{const _0x519c01=-parseInt(_0x306c2b(0xab))/0x1+-parseInt(_0x306c2b(0xac))/0x2+-parseInt(_0x306c2b(0xa9))/0x3+-parseInt(_0x306c2b(0xa2))/0x4*(-parseInt(_0x306c2b(0xa6))/0x5)+parseInt(_0x306c2b(0xa5))/0x6*(parseInt(_0x306c2b(0xa7))/0x7)+-parseInt(_0x306c2b(0xa4))/0x8*(parseInt(_0x306c2b(0xa8))/0x9)+-parseInt(_0x306c2b(0xaa))/0xa*(-parseInt(_0x306c2b(0xa3))/0xb);if(_0x519c01===_0x16ef41)break;else _0x3db360['push'](_0x3db360['shift']());}catch(_0x5c5594){_0x3db360['push'](_0x3db360['shift']());}}}(_0x4d03,0x582f4));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['MapperService']=void 0x0;const pipe_1=require('../pipe');function _0x4d03(){const _0x552a6f=['29424AYIjNO','1503392ICMrDj','2849480WtwhNB','108BZbxUD','55aLIwsf','125566OWOMvK','9SFjBoi','1920471AEnqpt','140zMIJON','324560JBkQtM','1270204VnqJjH'];_0x4d03=function(){return _0x552a6f;};return _0x4d03();}class MapperService{constructor(_0x1fdc42,_0x36ff1b){this['rules']=_0x1fdc42,this['data']=_0x36ff1b;}['mapRules'](){return this['traverseRules'](this['rules']);}['traverseRules'](_0x133f95){if(typeof _0x133f95==='object'&&'@pipe'in _0x133f95)return this['pipe'](_0x133f95['@pipe']);if(typeof _0x133f95==='object'&&_0x133f95!==null){const _0x3186a0={};for(const _0x22f7df in _0x133f95){Object['prototype']['hasOwnProperty']['call'](_0x133f95,_0x22f7df)&&(_0x3186a0[_0x22f7df]=this['traverseRules'](_0x133f95[_0x22f7df]));}return _0x3186a0;}else return this['resolve'](_0x133f95);}['pipe'](_0x2fac6d){const _0x3b2d7f=new pipe_1['Pipe'](_0x2fac6d,this['data']);return _0x3b2d7f['process']();}['resolve'](_0x2ac529){const _0x338f47=new pipe_1['Pipe']([[_0x2ac529]],this['data']);return _0x338f47['process']();}static['evaluate'](_0x4e2f40,_0x5d797d,_0x4ebe18){if(typeof _0x4e2f40==='boolean')return _0x4e2f40;if(Array['isArray'](_0x4e2f40['code'])&&_0x4e2f40['code']['includes'](_0x4ebe18||0xc8)||_0x4ebe18['toString']()===(_0x4e2f40['code']||0xc8)['toString']()){if(!_0x4e2f40['match'])return!![];const _0x4bc149=_0x4e2f40['gate']==='or';let _0x28af9f=!![],_0x158e9e=![];return _0x4e2f40['match']['forEach'](({expected:_0xd06450,actual:_0x71c6a0})=>{if(_0x4bc149&&!_0x158e9e||!_0x4bc149&&_0x28af9f){const _0x1a63ad=pipe_1['Pipe']['resolve'](_0x71c6a0,_0x5d797d)===_0xd06450;if(_0x4bc149&&_0x1a63ad)_0x158e9e=!![];else!_0x4bc149&&!_0x1a63ad&&(_0x28af9f=![]);}}),_0x4bc149?_0x158e9e:_0x28af9f;}return![];}}exports['MapperService']=MapperService;
|
|
@@ -6,12 +6,13 @@ import { JobInterruptOptions, JobOutput } from '../../types/job';
|
|
|
6
6
|
import { QuorumMessage, QuorumMessageCallback, QuorumProfile, RollCallOptions, SubscriptionOptions, ThrottleOptions } from '../../types/quorum';
|
|
7
7
|
import { MeshFlowJobExport, ExportOptions } from '../../types/exporter';
|
|
8
8
|
import { ProviderConfig } from '../../types';
|
|
9
|
-
import { ProviderClass } from '../../types/provider';
|
|
9
|
+
import { ProviderClass, ProvidersConfig } from '../../types/provider';
|
|
10
10
|
declare class MeshData {
|
|
11
11
|
connectionSignatures: StringStringType;
|
|
12
12
|
connection: Partial<ProviderConfig>;
|
|
13
13
|
instances: Map<string, Promise<HotMesh> | HotMesh>;
|
|
14
14
|
search: WorkflowSearchOptions;
|
|
15
|
+
connections: ProvidersConfig;
|
|
15
16
|
static workflow: {
|
|
16
17
|
sleep: typeof import("../meshflow/workflow").WorkflowService.sleepFor;
|
|
17
18
|
sleepFor: typeof import("../meshflow/workflow").WorkflowService.sleepFor;
|
|
@@ -28,9 +29,9 @@ declare class MeshData {
|
|
|
28
29
|
executeChild: <T_1>(options?: Partial<WorkflowOptions>) => Promise<T_1>;
|
|
29
30
|
startChild: (options?: Partial<WorkflowOptions>) => Promise<string>;
|
|
30
31
|
};
|
|
31
|
-
constructor(providerClass: ProviderClass, providerOptions: StringAnyType, search?: WorkflowSearchOptions);
|
|
32
|
+
constructor(providerClass: ProviderClass, providerOptions: StringAnyType, search?: WorkflowSearchOptions, connections?: ProvidersConfig);
|
|
32
33
|
validate(entity: string): void;
|
|
33
|
-
getConnection(): Promise<
|
|
34
|
+
getConnection(): Promise<import("../../types/meshflow").Connection>;
|
|
34
35
|
getClient(): import("../meshflow/client").ClientService;
|
|
35
36
|
safeKey(key: string): string;
|
|
36
37
|
arrayToHash(input: [number, ...Array<string | string[]>]): StringStringType[];
|
|
@@ -8,7 +8,7 @@ const hotmesh_1 = require("../hotmesh");
|
|
|
8
8
|
const hotmesh_2 = require("../../types/hotmesh");
|
|
9
9
|
const enums_1 = require("../../modules/enums");
|
|
10
10
|
class MeshData {
|
|
11
|
-
constructor(providerClass, providerOptions, search) {
|
|
11
|
+
constructor(providerClass, providerOptions, search, connections) {
|
|
12
12
|
this.connectionSignatures = {};
|
|
13
13
|
this.connection = {};
|
|
14
14
|
this.instances = new Map();
|
|
@@ -46,6 +46,7 @@ class MeshData {
|
|
|
46
46
|
await hotMesh.quorum?.unsub(callback);
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
+
this.connections = connections;
|
|
49
50
|
this.connection.class = providerClass;
|
|
50
51
|
this.connection.options = providerOptions;
|
|
51
52
|
if (search) {
|
|
@@ -58,7 +59,7 @@ class MeshData {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
async getConnection() {
|
|
61
|
-
return await meshflow_1.MeshFlow.Connection.connect(utils_1.polyfill.meshDataConfig(this));
|
|
62
|
+
return this.connections ?? await meshflow_1.MeshFlow.Connection.connect(utils_1.polyfill.meshDataConfig(this));
|
|
62
63
|
}
|
|
63
64
|
getClient() {
|
|
64
65
|
return new meshflow_1.MeshFlow.Client({
|
|
@@ -8,6 +8,7 @@ export declare class ClientService {
|
|
|
8
8
|
constructor(config: ClientConfig);
|
|
9
9
|
getHotMeshClient: (workflowTopic: string | null, namespace?: string) => Promise<HotMesh>;
|
|
10
10
|
static createStream: (hotMeshClient: HotMesh, workflowTopic: string, namespace?: string) => Promise<void>;
|
|
11
|
+
hashOptions(): string;
|
|
11
12
|
verifyStream: (hotMeshClient: HotMesh, workflowTopic: string, namespace?: string) => Promise<void>;
|
|
12
13
|
search: (hotMeshClient: HotMesh, index: string, query: string[]) => Promise<string[]>;
|
|
13
14
|
workflow: ClientWorkflow;
|
|
@@ -13,7 +13,7 @@ const factory_1 = require("./schemas/factory");
|
|
|
13
13
|
class ClientService {
|
|
14
14
|
constructor(config) {
|
|
15
15
|
this.getHotMeshClient = async (workflowTopic, namespace) => {
|
|
16
|
-
const optionsHash =
|
|
16
|
+
const optionsHash = this.hashOptions();
|
|
17
17
|
const targetNS = namespace ?? factory_1.APP_ID;
|
|
18
18
|
const connectionNS = `${optionsHash}.${targetNS}`;
|
|
19
19
|
if (ClientService.instances.has(connectionNS)) {
|
|
@@ -21,14 +21,12 @@ class ClientService {
|
|
|
21
21
|
await this.verifyWorkflowActive(hotMeshClient, targetNS);
|
|
22
22
|
return hotMeshClient;
|
|
23
23
|
}
|
|
24
|
+
const connectionType = 'options' in this.connection ? 'connection' : 'connections';
|
|
24
25
|
const hotMeshClient = hotmesh_1.HotMesh.init({
|
|
25
26
|
appId: targetNS,
|
|
26
27
|
logLevel: enums_1.HMSH_LOGLEVEL,
|
|
27
28
|
engine: {
|
|
28
|
-
|
|
29
|
-
class: this.connection.class,
|
|
30
|
-
options: this.connection.options,
|
|
31
|
-
},
|
|
29
|
+
[connectionType]: this.connection,
|
|
32
30
|
},
|
|
33
31
|
});
|
|
34
32
|
ClientService.instances.set(connectionNS, hotMeshClient);
|
|
@@ -36,7 +34,7 @@ class ClientService {
|
|
|
36
34
|
return hotMeshClient;
|
|
37
35
|
};
|
|
38
36
|
this.verifyStream = async (hotMeshClient, workflowTopic, namespace) => {
|
|
39
|
-
const optionsHash =
|
|
37
|
+
const optionsHash = this.hashOptions();
|
|
40
38
|
const targetNS = namespace ?? factory_1.APP_ID;
|
|
41
39
|
const targetTopic = `${optionsHash}.${targetNS}.${workflowTopic}`;
|
|
42
40
|
if (!ClientService.topics.includes(targetTopic)) {
|
|
@@ -123,6 +121,20 @@ class ClientService {
|
|
|
123
121
|
};
|
|
124
122
|
this.connection = config.connection;
|
|
125
123
|
}
|
|
124
|
+
hashOptions() {
|
|
125
|
+
if ('options' in this.connection) {
|
|
126
|
+
return (0, utils_1.hashOptions)(this.connection.options);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const response = [];
|
|
130
|
+
for (let p in this.connection) {
|
|
131
|
+
if (!response.includes(this.connection[p])) {
|
|
132
|
+
response.push((0, utils_1.hashOptions)(this.connection[p]));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return response.join('');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
126
138
|
async deployAndActivate(namespace = factory_1.APP_ID, version = factory_1.APP_VERSION) {
|
|
127
139
|
if (isNaN(Number(version))) {
|
|
128
140
|
throw new Error('Invalid version number');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection } from '../../types/meshflow';
|
|
2
|
-
import { ProviderConfig } from '../../types/provider';
|
|
2
|
+
import { ProviderConfig, ProvidersConfig } from '../../types/provider';
|
|
3
3
|
export declare class ConnectionService {
|
|
4
4
|
constructor();
|
|
5
|
-
static connect(config: ProviderConfig): Promise<Connection>;
|
|
5
|
+
static connect(config: ProviderConfig | ProvidersConfig): Promise<Connection>;
|
|
6
6
|
}
|