@hotmeshio/hotmesh 0.3.10 → 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 +12 -14
- package/build/modules/key.d.ts +4 -0
- package/build/modules/key.js +1 -1
- package/build/modules/utils.js +1 -1
- package/build/package.json +22 -18
- package/build/services/activities/activity.js +1 -1
- package/build/services/activities/await.js +1 -1
- package/build/services/activities/cycle.js +1 -1
- package/build/services/activities/hook.js +1 -1
- package/build/services/activities/index.js +1 -1
- package/build/services/activities/interrupt.js +1 -1
- package/build/services/activities/signal.js +1 -1
- package/build/services/activities/trigger.js +1 -1
- package/build/services/activities/worker.js +1 -1
- package/build/services/collator/index.js +1 -1
- package/build/services/compiler/deployer.js +1 -1
- package/build/services/compiler/index.js +1 -1
- package/build/services/compiler/validator.js +1 -1
- package/build/services/connector/factory.js +29 -17
- package/build/services/connector/index.d.ts +2 -0
- package/build/services/connector/index.js +2 -0
- package/build/services/connector/providers/nats.js +8 -2
- package/build/services/connector/providers/postgres.js +7 -3
- 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.d.ts +3 -0
- 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/factory.d.ts +1 -1
- package/build/services/store/factory.js +9 -5
- package/build/services/store/index.d.ts +2 -1
- package/build/services/store/providers/postgres/kvsql.d.ts +156 -0
- package/build/services/store/providers/postgres/kvsql.js +1 -0
- package/build/services/store/providers/postgres/postgres.d.ts +107 -0
- package/build/services/store/providers/postgres/postgres.js +1 -0
- package/build/services/store/providers/redis/_base.d.ts +0 -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.d.ts +0 -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/factory.js +5 -1
- package/build/services/stream/providers/nats/nats.js +1 -1
- package/build/services/stream/providers/postgres/postgres.d.ts +4 -0
- 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/hotmesh.d.ts +4 -0
- 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 +51 -1
- package/package.json +22 -18
- package/types/hotmesh.ts +15 -0
- package/types/manifest.ts +12 -3
- package/types/meshflow.ts +2 -2
- package/types/postgres.ts +2 -0
- package/types/provider.ts +81 -3
- package/build/services/store/providers/postgres/types/hash.d.ts +0 -0
- package/build/services/store/providers/postgres/types/hash.js +0 -0
- package/build/services/store/providers/postgres/types/list.d.ts +0 -0
- package/build/services/store/providers/postgres/types/list.js +0 -0
- package/build/services/store/providers/postgres/types/string.d.ts +0 -0
- package/build/services/store/providers/postgres/types/string.js +0 -0
- package/build/services/store/providers/postgres/types/zset.d.ts +0 -0
- package/build/services/store/providers/postgres/types/zset.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x73cc0a,_0x1ce37d){const _0x53e5f1=_0x8d54,_0x16e12e=_0x73cc0a();while(!![]){try{const _0x4abd44=parseInt(_0x53e5f1(0x1b8))/0x1+-parseInt(_0x53e5f1(0x1ba))/0x2*(-parseInt(_0x53e5f1(0x1bc))/0x3)+parseInt(_0x53e5f1(0x1bb))/0x4+-parseInt(_0x53e5f1(0x1bf))/0x5*(-parseInt(_0x53e5f1(0x1b9))/0x6)+parseInt(_0x53e5f1(0x1bd))/0x7+parseInt(_0x53e5f1(0x1b7))/0x8+-parseInt(_0x53e5f1(0x1be))/0x9;if(_0x4abd44===_0x1ce37d)break;else _0x16e12e['push'](_0x16e12e['shift']());}catch(_0x779e81){_0x16e12e['push'](_0x16e12e['shift']());}}}(_0xdffb,0xd630c));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Interrupt']=void 0x0;const errors_1=require('../../modules/errors'),collator_1=require('../collator'),pipe_1=require('../pipe'),telemetry_1=require('../telemetry'),activity_1=require('./activity');function _0x8d54(_0x5e5bfa,_0x4da227){const _0xdffb2a=_0xdffb();return _0x8d54=function(_0x8d546,_0x2bb90a){_0x8d546=_0x8d546-0x1b7;let _0x45149e=_0xdffb2a[_0x8d546];return _0x45149e;},_0x8d54(_0x5e5bfa,_0x4da227);}class Interrupt extends activity_1['Activity']{constructor(_0x8004bd,_0x1c6411,_0x431f84,_0x3e3bf9,_0x5bdb31,_0x411caf){super(_0x8004bd,_0x1c6411,_0x431f84,_0x3e3bf9,_0x5bdb31,_0x411caf);}async['process'](){this['logger']['debug']('interrupt-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x4957bf;try{await this['verifyEntry'](),_0x4957bf=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x4957bf['startActivitySpan'](this['leg']),this['isInterruptingSelf']()?await this['interruptSelf'](_0x4957bf):await this['interruptAnother'](_0x4957bf);}catch(_0x265d13){if(_0x265d13 instanceof errors_1['InactiveJobError']){this['logger']['error']('interrupt-inactive-job-error',{..._0x265d13});return;}else{if(_0x265d13 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x265d13});return;}else{if(_0x265d13 instanceof errors_1['GetStateError']){this['logger']['error']('interrupt-get-state-error',{..._0x265d13});return;}else{if(_0x265d13 instanceof errors_1['CollationError']){if(_0x265d13['fault']==='duplicate'){this['logger']['info']('interrupt-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('interrupt-collation-error',{..._0x265d13});}else this['logger']['error']('interrupt-process-error',{..._0x265d13});}}}_0x4957bf?.['setActivityError'](_0x265d13['message']);throw _0x265d13;}finally{_0x4957bf?.['endActivitySpan'](),this['logger']['debug']('interrupt-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}async['interruptSelf'](_0x3b1111){this['config']['job']?.['maps']&&(this['mapJobData'](),await this['setState']());const _0x286f0d=await this['interrupt']();_0x3b1111['mapActivityAttributes']();const _0x21f54a=this['store']['transact']();await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0x21f54a),await this['setStatus'](-0x1,_0x21f54a);const _0x19f103=await _0x21f54a['exec'](),_0x209854=this['resolveStatus'](_0x19f103);return _0x3b1111['setActivityAttributes']({'app.activity.mid':_0x286f0d,'app.job.jss':_0x209854}),this['context']['metadata']['aid'];}async['interruptAnother'](_0x2d78de){const _0x22e0e7=await this['interrupt'](),_0x1240a8={'app.activity.mid':_0x22e0e7};_0x2d78de['mapActivityAttributes'](),this['adjacencyList']=await this['filterAdjacent']();if(this['config']['job']?.['maps']||this['config']['output']?.['maps']){this['mapOutputData'](),this['mapJobData']();const _0x58f9ce=this['store']['transact']();await this['setState'](_0x58f9ce);}const _0x3c8407=this['store']['transact']();await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0x3c8407),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x3c8407);const _0x422823=await _0x3c8407['exec'](),_0x2e27db=this['resolveStatus'](_0x422823);_0x1240a8['app.job.jss']=_0x2e27db;const _0x464139=await this['transition'](this['adjacencyList'],_0x2e27db);return _0x464139['length']&&(_0x1240a8['app.activity.mids']=_0x464139['join'](',')),_0x2d78de['setActivityAttributes'](_0x1240a8),this['context']['metadata']['aid'];}['isInterruptingSelf'](){if(!this['config']['target'])return!![];const _0x524399=pipe_1['Pipe']['resolve'](this['config']['target'],this['context']);return _0x524399==this['context']['metadata']['jid'];}['resolveInterruptOptions'](){return{'reason':this['config']['reason']!==undefined?pipe_1['Pipe']['resolve'](this['config']['reason'],this['context']):undefined,'throw':this['config']['throw']!==undefined?pipe_1['Pipe']['resolve'](this['config']['throw'],this['context']):undefined,'descend':this['config']['descend']!==undefined?pipe_1['Pipe']['resolve'](this['config']['descend'],this['context']):undefined,'code':this['config']['code']!==undefined?pipe_1['Pipe']['resolve'](this['config']['code'],this['context']):undefined,'expire':this['config']['expire']!==undefined?pipe_1['Pipe']['resolve'](this['config']['expire'],this['context']):undefined,'stack':this['config']['stack']!==undefined?pipe_1['Pipe']['resolve'](this['config']['stack'],this['context']):undefined};}async['interrupt'](){const _0x5edfa4=this['resolveInterruptOptions']();return await this['engine']['interrupt'](this['config']['topic']!==undefined?pipe_1['Pipe']['resolve'](this['config']['topic'],this['context']):this['context']['metadata']['tpc'],this['config']['target']!==undefined?pipe_1['Pipe']['resolve'](this['config']['target'],this['context']):this['context']['metadata']['jid'],_0x5edfa4);}}function _0xdffb(){const _0x1ca770=['39558906SxCbIp','3315liyPHo','3766144xpVXHx','506074jymuZZ','2478szLdJc','78zISODG','5404992CGNQZi','106026riuZZT','9047577wYYovz'];_0xdffb=function(){return _0x1ca770;};return _0xdffb();}exports['Interrupt']=Interrupt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0xe698(_0x1f87cd,_0x16019d){const _0x49415b=_0x4941();return _0xe698=function(_0xe698be,_0x40c2fa){_0xe698be=_0xe698be-0x161;let _0x4dc752=_0x49415b[_0xe698be];return _0x4dc752;},_0xe698(_0x1f87cd,_0x16019d);}(function(_0x55587f,_0x10e2af){const _0x58b3ad=_0xe698,_0x3198f1=_0x55587f();while(!![]){try{const _0x38dc2a=parseInt(_0x58b3ad(0x16a))/0x1*(parseInt(_0x58b3ad(0x162))/0x2)+-parseInt(_0x58b3ad(0x169))/0x3+parseInt(_0x58b3ad(0x167))/0x4+parseInt(_0x58b3ad(0x163))/0x5*(-parseInt(_0x58b3ad(0x166))/0x6)+-parseInt(_0x58b3ad(0x16b))/0x7+-parseInt(_0x58b3ad(0x168))/0x8*(parseInt(_0x58b3ad(0x161))/0x9)+-parseInt(_0x58b3ad(0x165))/0xa*(parseInt(_0x58b3ad(0x164))/0xb);if(_0x38dc2a===_0x10e2af)break;else _0x3198f1['push'](_0x3198f1['shift']());}catch(_0xeaa8ef){_0x3198f1['push'](_0x3198f1['shift']());}}}(_0x4941,0x29bc7));function _0x4941(){const _0x361aa8=['48354iJeURb','113TiYXWq','928361PUDuEU','852372meehLj','5108UMEHDr','5YFIFvV','150634kyoPwp','50lZjCvY','162786aqmOea','1264428xrlvqZ','16VtvpvG'];_0x4941=function(){return _0x361aa8;};return _0x4941();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Signal']=void 0x0;const errors_1=require('../../modules/errors'),collator_1=require('../collator'),mapper_1=require('../mapper'),pipe_1=require('../pipe'),telemetry_1=require('../telemetry'),activity_1=require('./activity');class Signal extends activity_1['Activity']{constructor(_0x4b6967,_0x5ac007,_0x1f596d,_0x1e8be3,_0x257c44,_0x3cb58e){super(_0x4b6967,_0x5ac007,_0x1f596d,_0x1e8be3,_0x257c44,_0x3cb58e);}async['process'](){this['logger']['debug']('signal-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x18d30e;try{await this['verifyEntry'](),_0x18d30e=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x18d30e['startActivitySpan'](this['leg']);const _0xcf24a1=this['store']['transact']();this['adjacencyList']=await this['filterAdjacent'](),this['mapOutputData'](),this['mapJobData'](),await this['setState'](_0xcf24a1),await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0xcf24a1),await this['setStatus'](this['adjacencyList']['length']-0x1,_0xcf24a1);const _0x14bd4f=await _0xcf24a1['exec']();this['config']['subtype']==='all'?await this['hookAll']():await this['hookOne']();const _0x18daa5=this['resolveStatus'](_0x14bd4f),_0x4b4aad={'app.job.jss':_0x18daa5},_0x38c6e2=await this['transition'](this['adjacencyList'],_0x18daa5);return _0x38c6e2['length']&&(_0x4b4aad['app.activity.mids']=_0x38c6e2['join'](',')),_0x18d30e['mapActivityAttributes'](),_0x18d30e['setActivityAttributes'](_0x4b4aad),this['context']['metadata']['aid'];}catch(_0x2ecc18){if(_0x2ecc18 instanceof errors_1['InactiveJobError']){this['logger']['error']('signal-inactive-job-error',{..._0x2ecc18});return;}else{if(_0x2ecc18 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x2ecc18});return;}else{if(_0x2ecc18 instanceof errors_1['GetStateError']){this['logger']['error']('signal-get-state-error',{..._0x2ecc18});return;}else{if(_0x2ecc18 instanceof errors_1['CollationError']){if(_0x2ecc18['fault']==='duplicate'){this['logger']['info']('signal-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('signal-collation-error',{..._0x2ecc18});}else this['logger']['error']('signal-process-error',{..._0x2ecc18});}}}_0x18d30e?.['setActivityError'](_0x2ecc18['message']);throw _0x2ecc18;}finally{_0x18d30e?.['endActivitySpan'](),this['logger']['debug']('signal-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}['mapSignalData'](){if(this['config']['signal']?.['maps']){const _0x3715bc=new mapper_1['MapperService'](this['config']['signal']['maps'],this['context']);return _0x3715bc['mapRules']();}}['mapResolverData'](){if(this['config']['resolver']?.['maps']){const _0x19a518=new mapper_1['MapperService'](this['config']['resolver']['maps'],this['context']);return _0x19a518['mapRules']();}}async['hookOne'](){const _0x32a717=pipe_1['Pipe']['resolve'](this['config']['topic'],this['context']),_0x417d57=this['mapSignalData'](),_0x2e321d=pipe_1['Pipe']['resolve'](this['config']['status'],this['context']),_0x29ce5d=pipe_1['Pipe']['resolve'](this['config']['code'],this['context']);return await this['engine']['hook'](_0x32a717,_0x417d57,_0x2e321d,_0x29ce5d);}async['hookAll'](){const _0x1c0bfa=this['mapSignalData'](),_0x1bde8a=this['mapResolverData']();this['config']['scrub']&&(_0x1bde8a['scrub']=!![]);const _0x173771=pipe_1['Pipe']['resolve'](this['config']['key_name'],this['context']),_0x3ae777=pipe_1['Pipe']['resolve'](this['config']['key_value'],this['context']),_0x162526=[_0x173771+':'+_0x3ae777];return await this['engine']['hookAll'](this['config']['topic'],_0x1c0bfa,_0x1bde8a,_0x162526);}}exports['Signal']=Signal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0x43b8(_0x1d16c7,_0x5058bd){const _0x2c833f=_0x2c83();return _0x43b8=function(_0x43b8fc,_0x5242ae){_0x43b8fc=_0x43b8fc-0x1ad;let _0x3a9061=_0x2c833f[_0x43b8fc];return _0x3a9061;},_0x43b8(_0x1d16c7,_0x5058bd);}function _0x2c83(){const _0x467a9a=['482036tHCXsm','8090664Uogyqm','342108bVZgdi','15aNITtE','3178143XWHXSh','6dFkihn','11616087ROhLBW','278289YGQZCa','1590eyqnVH','657468pssCSI'];_0x2c83=function(){return _0x467a9a;};return _0x2c83();}(function(_0x175543,_0x40f95f){const _0x78674a=_0x43b8,_0x14893d=_0x175543();while(!![]){try{const _0x1fcc67=parseInt(_0x78674a(0x1b2))/0x1+-parseInt(_0x78674a(0x1af))/0x2+-parseInt(_0x78674a(0x1b4))/0x3+-parseInt(_0x78674a(0x1b0))/0x4*(parseInt(_0x78674a(0x1b3))/0x5)+parseInt(_0x78674a(0x1b5))/0x6*(-parseInt(_0x78674a(0x1b6))/0x7)+-parseInt(_0x78674a(0x1b1))/0x8+-parseInt(_0x78674a(0x1ad))/0x9*(-parseInt(_0x78674a(0x1ae))/0xa);if(_0x1fcc67===_0x40f95f)break;else _0x14893d['push'](_0x14893d['shift']());}catch(_0x50ba55){_0x14893d['push'](_0x14893d['shift']());}}}(_0x2c83,0xcc9f3));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Trigger']=void 0x0;const errors_1=require('../../modules/errors'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),pipe_1=require('../pipe'),reporter_1=require('../reporter'),serializer_1=require('../serializer'),telemetry_1=require('../telemetry'),activity_1=require('./activity');class Trigger extends activity_1['Activity']{constructor(_0x5b7a9f,_0x10f5f2,_0xe21cbd,_0x3de72d,_0x1391c0,_0x2cf1aa){super(_0x5b7a9f,_0x10f5f2,_0xe21cbd,_0x3de72d,_0x1391c0,_0x2cf1aa);}async['process'](_0xde7ba3){this['logger']['debug']('trigger-process',{'subscribes':this['config']['subscribes']});let _0x1a7009;try{this['setLeg'](0x2),await this['getState'](),_0x1a7009=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x1a7009['startJobSpan'](),_0x1a7009['startActivitySpan'](this['leg']),this['mapJobData'](),this['adjacencyList']=await this['filterAdjacent']();const _0x57a5a7=this['initStatus'](_0xde7ba3,this['adjacencyList']['length']);await this['setStateNX'](_0x57a5a7),await this['setStatus'](_0x57a5a7),this['bindSearchData'](_0xde7ba3),this['bindMarkerData'](_0xde7ba3);const _0x2300a3=this['store']['transact']();await this['setState'](_0x2300a3),await this['setStats'](_0x2300a3);_0xde7ba3?.['pending']&&await this['setExpired'](_0xde7ba3?.['pending'],_0x2300a3);await collator_1['CollatorService']['notarizeInception'](this,this['context']['metadata']['guid'],_0x2300a3),await _0x2300a3['exec'](),this['execAdjacentParent'](),_0x1a7009['mapActivityAttributes']();const _0xab4ba3=Number(this['context']['metadata']['js']);_0x1a7009['setJobAttributes']({'app.job.jss':_0xab4ba3});const _0x1bb54e={'app.job.jss':_0xab4ba3};return await this['transitionAndLogAdjacent'](_0xde7ba3,_0xab4ba3,_0x1bb54e),_0x1a7009['setActivityAttributes'](_0x1bb54e),this['context']['metadata']['jid'];}catch(_0x26e60e){_0x1a7009?.['setActivityError'](_0x26e60e['message']);if(_0x26e60e instanceof errors_1['DuplicateJobError']){await(0x0,utils_1['sleepFor'])(0x3e8);const _0x54687e=await collator_1['CollatorService']['isInceptionOverage'](this,this['context']['metadata']['guid']);if(_0x54687e){this['logger']['info']('trigger-collation-overage',{'job_id':_0x26e60e['jobId'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('duplicate-job-error',{'job_id':_0x26e60e['jobId'],'guid':this['context']['metadata']['guid']});}else this['logger']['error']('trigger-process-error',{..._0x26e60e});throw _0x26e60e;}finally{_0x1a7009?.['endJobSpan'](),_0x1a7009?.['endActivitySpan'](),this['logger']['debug']('trigger-process-end',{'subscribes':this['config']['subscribes'],'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid']});}}async['transitionAndLogAdjacent'](_0x25fba1={},_0x484361,_0x1a6194){if(isNaN(_0x25fba1['pending'])){const _0x5aed56=await this['transition'](this['adjacencyList'],_0x484361);_0x5aed56['length']&&(_0x1a6194['app.activity.mids']=_0x5aed56['join'](','));}}['initStatus'](_0x208810={},_0x47b59a){if(_0x208810['pending'])return-0x1;return _0x47b59a;}async['setExpired'](_0x2b6d50,_0x30be38){await this['store']['expireJob'](this['context']['metadata']['jid'],_0x2b6d50,_0x30be38);}['safeKey'](_0x5c357a){return'_'+_0x5c357a;}['bindSearchData'](_0x3c2481){_0x3c2481?.['search']&&Object['keys'](_0x3c2481['search'])['forEach'](_0x4c167e=>{this['context']['data'][this['safeKey'](_0x4c167e)]=_0x3c2481['search'][_0x4c167e]['toString']();});}['bindMarkerData'](_0x13a53b){_0x13a53b?.['marker']&&Object['keys'](_0x13a53b['marker'])['forEach'](_0x9a97ba=>{_0x9a97ba['startsWith']('-')&&(this['context']['data'][_0x9a97ba]=_0x13a53b['marker'][_0x9a97ba]['toString']());});}async['setStatus'](_0x35c384){this['context']['metadata']['js']=_0x35c384;}async['execAdjacentParent'](){if(this['context']['metadata']['px']){const _0xe92982=(0x0,utils_1['formatISODate'])(new Date()),_0x11f193={'metadata':this['context']['metadata'],'data':{'job_id':this['context']['metadata']['jid'],'jc':_0xe92982,'ju':_0xe92982}};await this['engine']['execAdjacentParent'](this['context'],_0x11f193);}}['createInputContext'](){const _0x2068db={[this['metadata']['aid']]:{'input':{'data':this['data']}},'$self':{'input':{'data':this['data']},'output':{'data':this['data']}}};return _0x2068db;}async['getState'](){const _0x3baa2e=this['createInputContext'](),_0x12f5d2=this['resolveJobId'](_0x3baa2e),_0x389820=this['resolveJobKey'](_0x3baa2e),_0x176cc6=(0x0,utils_1['formatISODate'])(new Date()),{id:_0x1c372f,version:_0x534c83}=await this['engine']['getVID']();this['initDimensionalAddress'](collator_1['CollatorService']['getDimensionalSeed']());const _0x511745={...this['metadata'],'jid':_0x12f5d2,'key':_0x389820,'as':collator_1['CollatorService']['getTriggerSeed']()};this['context']={'metadata':{...this['metadata'],'gid':(0x0,utils_1['guid'])(),'ngn':this['context']['metadata']['ngn'],'pj':this['context']['metadata']['pj'],'pg':this['context']['metadata']['pg'],'pd':this['context']['metadata']['pd'],'pa':this['context']['metadata']['pa'],'px':this['context']['metadata']['px'],'app':_0x1c372f,'vrs':_0x534c83,'tpc':this['config']['subscribes'],'trc':this['context']['metadata']['trc'],'spn':this['context']['metadata']['spn'],'guid':this['context']['metadata']['guid'],'jid':_0x12f5d2,'dad':collator_1['CollatorService']['getDimensionalSeed'](),'key':_0x389820,'jc':_0x176cc6,'ju':_0x176cc6,'ts':(0x0,utils_1['getTimeSeries'])(this['resolveGranularity']()),'js':0x0},'data':{},[this['metadata']['aid']]:{'input':{'data':this['data'],'metadata':_0x511745},'output':{'data':this['data'],'metadata':_0x511745},'settings':{'data':{}},'errors':{'data':{}}}},this['context']['$self']=this['context'][this['metadata']['aid']],this['context']['$job']=this['context'];}['bindJobMetadataPaths'](){return serializer_1['MDATA_SYMBOLS']['JOB']['KEYS']['map'](_0x1b3557=>'metadata/'+_0x1b3557);}['bindActivityMetadataPaths'](){return serializer_1['MDATA_SYMBOLS']['ACTIVITY']['KEYS']['map'](_0x328f39=>'output/metadata/'+_0x328f39);}['resolveGranularity'](){return this['config']['stats']?.['granularity']||reporter_1['ReporterService']['DEFAULT_GRANULARITY'];}['getJobStatus'](){return this['context']['metadata']['js'];}['resolveJobId'](_0x3b40f5){const _0x311076=this['config']['stats']?.['id'];return _0x311076?pipe_1['Pipe']['resolve'](_0x311076,_0x3b40f5):(0x0,utils_1['guid'])();}['resolveJobKey'](_0x397f7b){const _0x1f4b49=this['config']['stats']?.['key'];return _0x1f4b49?pipe_1['Pipe']['resolve'](_0x1f4b49,_0x397f7b):'';}async['setStateNX'](_0x4a8ecf){const _0x4dd26e=this['context']['metadata']['jid'];if(!await this['store']['setStateNX'](_0x4dd26e,this['engine']['appId'],_0x4a8ecf))throw new errors_1['DuplicateJobError'](_0x4dd26e);}async['setStats'](_0x399e2b){const _0x1e2675=this['context']['metadata'];if(_0x1e2675['key']&&this['config']['stats']?.['measures']){const _0x534edf=await this['engine']['getVID'](),_0x3ce7f1=new reporter_1['ReporterService'](_0x534edf,this['store'],this['logger']);await this['store']['setStats'](_0x1e2675['key'],_0x1e2675['jid'],_0x1e2675['ts'],_0x3ce7f1['resolveTriggerStatistics'](this['config'],this['context']),_0x534edf,_0x399e2b);}}}exports['Trigger']=Trigger;
|
|
@@ -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(_0x215f2f,_0x14624b){const _0x4b939c=_0x29e1,_0x29c237=_0x215f2f();while(!![]){try{const _0x58d688=-parseInt(_0x4b939c(0x1f8))/0x1+-parseInt(_0x4b939c(0x1f5))/0x2+-parseInt(_0x4b939c(0x1fa))/0x3*(parseInt(_0x4b939c(0x1f9))/0x4)+parseInt(_0x4b939c(0x1fb))/0x5+-parseInt(_0x4b939c(0x1f7))/0x6+-parseInt(_0x4b939c(0x1f4))/0x7*(parseInt(_0x4b939c(0x1f6))/0x8)+parseInt(_0x4b939c(0x1f3))/0x9;if(_0x58d688===_0x14624b)break;else _0x29c237['push'](_0x29c237['shift']());}catch(_0x5d214a){_0x29c237['push'](_0x29c237['shift']());}}}(_0x3654,0xeeb3f));function _0x3654(){const _0x5d7516=['339486DROfka','5392KqVris','7914240YLnYhg','78417jxamGJ','4944652JYViqh','3UTukBZ','8399025CSbuIE','33803595LtypGW','17185OWKFOh'];_0x3654=function(){return _0x5d7516;};return _0x3654();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Deployer']=void 0x0;function _0x29e1(_0x30c467,_0x34c51d){const _0x36542f=_0x3654();return _0x29e1=function(_0x29e1bc,_0x2b8ad9){_0x29e1bc=_0x29e1bc-0x1f3;let _0x4e405d=_0x36542f[_0x29e1bc];return _0x4e405d;},_0x29e1(_0x30c467,_0x34c51d);}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(_0x38c240){this['manifest']=null,this['manifest']=_0x38c240;}async['deploy'](_0x18aa34,_0x4a8e23){this['store']=_0x18aa34,this['stream']=_0x4a8e23,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 _0x8f386d of this['manifest']['app']['graphs']){const [,_0x30e0f7]=this['findTrigger'](_0x8f386d),_0x5b2534=_0x30e0f7['subscribes'],[_0x19930c,_0x443d3a,_0x1da8c1]=await this['store']['reserveSymbolRange']('$'+_0x5b2534,DEFAULT_RANGE_SIZE,'JOB'),_0x5823a4='',_0x595be2=this['bindSymbols'](_0x19930c,_0x443d3a,_0x1da8c1,_0x5823a4,_0x30e0f7['PRODUCES']);Object['keys'](_0x595be2)['length']&&await this['store']['addSymbols']('$'+_0x5b2534,_0x595be2);for(const [_0x49d5bb,_0x4bf82e]of Object['entries'](_0x8f386d['activities'])){const [_0xcc711,_0x4fe393,_0x543553]=await this['store']['reserveSymbolRange'](_0x49d5bb,DEFAULT_RANGE_SIZE,'ACTIVITY'),_0x62e24a=_0x49d5bb+'/';this['bindSelf'](_0x4bf82e['consumes'],_0x4bf82e['produces'],_0x49d5bb);const _0x24a4a5=this['bindSymbols'](_0xcc711,_0x4fe393,_0x543553,_0x62e24a,_0x4bf82e['produces']);Object['keys'](_0x24a4a5)['length']&&await this['store']['addSymbols'](_0x49d5bb,_0x24a4a5);}}}['bindSelf'](_0x4ae299,_0x2a1d55,_0x770209){for(const _0x3b3a4c of[_0x770209,'$self']){const _0x26a4bb=_0x4ae299[_0x3b3a4c];if(_0x26a4bb)for(const _0x2d5c56 of _0x26a4bb){!_0x2a1d55['includes'](_0x2d5c56)&&_0x2a1d55['push'](_0x2d5c56);}}}['bindSymbols'](_0x4649ba,_0x181405,_0x36c375,_0x1b6ada,_0x5d77bd){const _0x577cf9={},_0xac9163={..._0x36c375};for(const _0x313ad9 of _0x5d77bd){const _0x23cf0d=''+_0x1b6ada+_0x313ad9;if(!_0xac9163[_0x23cf0d]){if(_0x4649ba>_0x181405)throw new Error('Symbol\x20index\x20out\x20of\x20bounds');const _0x2603b9=(0x0,utils_1['getSymKey'])(_0x4649ba);_0x4649ba++,_0x577cf9[_0x23cf0d]=_0x2603b9,_0xac9163[_0x23cf0d]=_0x2603b9;}}return _0x577cf9;}['copyJobSchemas'](){const _0x13683b=this['manifest']['app']['graphs'];for(const _0xd8c3ad of _0x13683b){const _0x2a9eed=_0xd8c3ad['output']?.['schema'],_0x2020a1=_0xd8c3ad['input']?.['schema'];if(!_0x2a9eed&&!_0x2020a1)continue;const _0x11717c=_0xd8c3ad['activities'];for(const _0x27432b in _0x11717c){if(_0x11717c[_0x27432b]['type']==='trigger'){const _0x435b56=_0x11717c[_0x27432b];_0x2a9eed&&(!_0x435b56['job']&&(_0x435b56['job']={}),_0x435b56['job']['schema']=_0x2a9eed),_0x2020a1&&(_0x435b56['output']={'schema':_0x2020a1});}}}}['bindBackRefs'](){for(const _0xa7e029 of this['manifest']['app']['graphs']){const _0x56ec27=_0xa7e029['activities'],_0xabf391=this['findTrigger'](_0xa7e029)[0x0];for(const _0x5e4afb in _0x56ec27){_0x56ec27[_0x5e4afb]['trigger']=_0xabf391,_0x56ec27[_0x5e4afb]['subscribes']=_0xa7e029['subscribes'],_0xa7e029['publishes']&&(_0x56ec27[_0x5e4afb]['publishes']=_0xa7e029['publishes']),_0x56ec27[_0x5e4afb]['expire']=_0xa7e029['expire']??undefined,_0x56ec27[_0x5e4afb]['persistent']=_0xa7e029['persistent']??undefined;}}}['bindCycleTarget'](){for(const _0x58944b of this['manifest']['app']['graphs']){const _0xdea6b4=_0x58944b['activities'];for(const _0x1dac96 in _0xdea6b4){const _0x1c47e7=_0xdea6b4[_0x1dac96];_0x1c47e7['type']==='cycle'&&(_0xdea6b4[_0x1c47e7['ancestor']]['cycle']=!![]);}}}['convertTopicsToTypes'](){for(const _0x4f4b59 of this['manifest']['app']['graphs']){const _0x1a8fac=_0x4f4b59['activities'];for(const _0x358605 in _0x1a8fac){const _0x4f62e0=_0x1a8fac[_0x358605];['worker','await']['includes'](_0x4f62e0['type'])&&_0x4f62e0['topic']&&!_0x4f62e0['subtype']&&(_0x4f62e0['subtype']=_0x4f62e0['topic']);}}}['convertActivitiesToHooks'](){for(const _0x200716 of this['manifest']['app']['graphs']){const _0x482938=_0x200716['activities'];for(const _0x328347 in _0x482938){const _0x3e6fb0=_0x482938[_0x328347];['activity']['includes'](_0x3e6fb0['type'])&&(_0x3e6fb0['type']='hook');}}}async['bindParents'](){const _0x1bc862=this['manifest']['app']['graphs'];for(const _0x36ed94 of _0x1bc862){if(_0x36ed94['transitions'])for(const _0x4d27d8 in _0x36ed94['transitions']){const _0xb5c11c=_0x36ed94['transitions'][_0x4d27d8];for(const _0x2816da of _0xb5c11c){const _0x47e95a=_0x2816da['to'];_0x36ed94['activities'][_0x47e95a]['parent']=_0x4d27d8;}_0x36ed94['activities'][_0x4d27d8]['transitions']=_0xb5c11c;}}}['collectValues'](_0x4c1f02,_0x11ccc8){for(const [_0x1dc47b,_0x2df8f6]of Object['entries'](_0x4c1f02)){if(_0x1dc47b==='enum'||_0x1dc47b==='examples'||_0x1dc47b==='default'){if(Array['isArray'](_0x2df8f6))for(const _0x14d503 of _0x2df8f6){typeof _0x14d503==='string'&&_0x14d503['length']>0x5&&_0x11ccc8['add'](_0x14d503);}else typeof _0x2df8f6==='string'&&_0x2df8f6['length']>0x5&&_0x11ccc8['add'](_0x2df8f6);}else typeof _0x2df8f6==='object'&&this['collectValues'](_0x2df8f6,_0x11ccc8);}}['traverse'](_0x450ce2,_0x155840){for(const _0xb864cd of Object['values'](_0x450ce2)){typeof _0xb864cd==='object'&&('schema'in _0xb864cd?this['collectValues'](_0xb864cd['schema'],_0x155840):this['traverse'](_0xb864cd,_0x155840));}}async['generateSymVals'](){const _0x4b650f=new Set();for(const _0x19f749 of this['manifest']['app']['graphs']){this['traverse'](_0x19f749,_0x4b650f);}const _0x193bec=await this['store']['getSymbolValues'](),_0x3be028=Object['keys'](_0x193bec)['length'],_0x14589d=Math['pow'](0x34,0x2)-0x1,_0x54a340=serializer_1['SerializerService']['filterSymVals'](_0x3be028,_0x14589d,_0x193bec,_0x4b650f);await this['store']['addSymbolValues'](_0x54a340);}['resolveJobMapsPaths'](){function _0x48e192(_0x3c09b4){const _0x7cb865=[];function _0x3c372f(_0x2dc65e,_0x226eb6=[]){for(const _0x3725eb in _0x2dc65e){if(typeof _0x2dc65e[_0x3725eb]==='object'&&_0x2dc65e[_0x3725eb]!==null&&!('@pipe'in _0x2dc65e[_0x3725eb])){const _0x20d313=[..._0x226eb6,_0x3725eb];_0x3c372f(_0x2dc65e[_0x3725eb],_0x20d313);}else{const _0x78a48=[..._0x226eb6,_0x3725eb]['join']('/');if(!_0x78a48['includes']('[')){const _0x43304d='data/'+_0x78a48;!_0x7cb865['includes'](_0x43304d)&&_0x7cb865['push'](_0x43304d);}else{const [_0x195bb4,_0x31d62f]=_0x78a48['split']('['),[_0x4dcacd,_0x548553]=_0x31d62f['split'](']');if(!isNaN(parseInt(_0x4dcacd)))for(let _0x54e67f=0x0;_0x54e67f<parseInt(_0x4dcacd);_0x54e67f++){const _0x356617='data/'+_0x195bb4+'/'+_0x54e67f;!_0x7cb865['includes'](_0x356617)&&_0x7cb865['push'](_0x356617);}}}}}return _0x3c09b4&&_0x3c372f(_0x3c09b4),_0x7cb865;}for(const _0x5c33c3 of this['manifest']['app']['graphs']){let _0x327b34=[];const [,_0x53f910]=this['findTrigger'](_0x5c33c3);for(const _0x529b4e in _0x5c33c3['activities']){const _0x4609b3=_0x5c33c3['activities'][_0x529b4e];_0x327b34=_0x327b34['concat'](_0x48e192(_0x4609b3['job']?.['maps']));}_0x53f910['PRODUCES']=_0x327b34;}}['resolveMappingDependencies'](){const _0x4cab3c=[];function _0x5c4665(_0x36e7dc,_0x871ad2){for(const _0x5b2052 in _0x36e7dc){if(typeof _0x36e7dc[_0x5b2052]==='string'){const _0x4c5c38=_0x36e7dc[_0x5b2052],_0x1bf8ae=_0x4c5c38['match'](/^\{[^@].*}$/);_0x1bf8ae&&!validator_1['Validator']['CONTEXT_VARS']['includes'](_0x4c5c38)&&(_0x4c5c38['split']('.')[0x1]!=='input'&&(_0x4cab3c['push'](_0x4c5c38),_0x871ad2['push'](_0x4c5c38)));}else typeof _0x36e7dc[_0x5b2052]==='object'&&_0x36e7dc[_0x5b2052]!==null&&_0x5c4665(_0x36e7dc[_0x5b2052],_0x871ad2);}}const _0xd5d527=this['manifest']['app']['graphs'];for(const _0x13e09b of _0xd5d527){const _0x1e6062=_0x13e09b['activities'];for(const _0x14c65e in _0x1e6062){const _0x5b30b8=_0x1e6062[_0x14c65e];_0x5b30b8['consumes']=[],_0x5c4665(_0x5b30b8,_0x5b30b8['consumes']),_0x5b30b8['consumes']=this['groupMappingRules'](_0x5b30b8['consumes']);}}const _0x3f42a0=this['groupMappingRules'](_0x4cab3c);for(const _0x5aae04 of _0xd5d527){const _0x3d10ee=_0x5aae04['activities'];for(const _0x42d357 in _0x3d10ee){const _0x1887e3=_0x3d10ee[_0x42d357];_0x1887e3['produces']=_0x3f42a0[''+_0x42d357]||[];}}}['groupMappingRules'](_0xb39849){_0xb39849=Array['from'](new Set(_0xb39849))['sort']();const _0x1ccecc={};for(const _0xffaeeb of _0xb39849){const [_0x3c37e3,_0x494e16]=this['resolveMappableValue'](_0xffaeeb);!_0x1ccecc[_0x3c37e3]&&(_0x1ccecc[_0x3c37e3]=[]),_0x1ccecc[_0x3c37e3]['push'](_0x494e16);}return _0x1ccecc;}['resolveMappableValue'](_0x2e5dcb){_0x2e5dcb=_0x2e5dcb['substring'](0x1,_0x2e5dcb['length']-0x1);const _0x378d61=_0x2e5dcb['split']('.');if(_0x378d61[0x0]==='$job'){const [_0x3e39ee,..._0x2e35be]=_0x378d61;return[_0x3e39ee,_0x2e35be['join']('/')];}else{const [_0x477e37,_0x1e61b2,_0x5005e1,..._0x34d07b]=_0x378d61,_0x5cb566={'hook':'hook/data','input':'input/data','output':_0x5005e1==='data'?'output/data':'output/metadata'}[_0x1e61b2];return[_0x477e37,_0x5cb566+'/'+_0x34d07b['join']('/')];}}async['deployActivitySchemas'](){const _0x12d141=this['manifest']['app']['graphs'],_0x264eb1={};for(const _0x732171 of _0x12d141){const _0x47c134=_0x732171['activities'];for(const _0x340d51 in _0x47c134){const _0x4b072f=_0x47c134[_0x340d51];delete _0x4b072f['transitions'],_0x264eb1[_0x340d51]=_0x4b072f;}}await this['store']['setSchemas'](_0x264eb1,this['getVID']());}async['deploySubscriptions'](){const _0x238a65=this['manifest']['app']['graphs'],_0x313215={};for(const _0x52b4d9 of _0x238a65){const _0x1c7ec9=_0x52b4d9['activities'],_0x593074=_0x52b4d9['subscribes'];for(const _0xd8412 in _0x1c7ec9){if(_0x1c7ec9[_0xd8412]['type']==='trigger'){_0x313215[_0x593074]=_0xd8412;break;}}}await this['store']['setSubscriptions'](_0x313215,this['getVID']());}['findTrigger'](_0x44adf0){for(const _0xcb31d3 in _0x44adf0['activities']){const _0x80dd12=_0x44adf0['activities'][_0xcb31d3];if(_0x80dd12['type']==='trigger')return[_0xcb31d3,_0x80dd12];}return null;}async['deployTransitions'](){const _0x4ed3fd=this['manifest']['app']['graphs'],_0x4272e0={};for(const _0x334f4c of _0x4ed3fd){if(_0x334f4c['subscribes']&&_0x334f4c['subscribes']['startsWith']('.')){const [_0x373da9]=this['findTrigger'](_0x334f4c);_0x373da9&&(_0x4272e0[_0x334f4c['subscribes']]={[_0x373da9]:!![]});}if(_0x334f4c['transitions'])for(const _0x87871b in _0x334f4c['transitions']){const _0x57b9cb=_0x334f4c['transitions'][_0x87871b],_0x5961f6={};for(const _0x16b5fa of _0x57b9cb){const _0x31fd53=_0x16b5fa['to'];_0x16b5fa['conditions']?_0x5961f6[_0x31fd53]=_0x16b5fa['conditions']:_0x5961f6[_0x31fd53]=!![];}Object['keys'](_0x5961f6)['length']>0x0&&(_0x4272e0['.'+_0x87871b]=_0x5961f6);}}await this['store']['setTransitions'](_0x4272e0,this['getVID']());}async['deployHookPatterns'](){const _0x4b2413=this['manifest']['app']['graphs'],_0x5b99d0={};for(const _0x459246 of _0x4b2413){if(_0x459246['hooks'])for(const _0x468baa in _0x459246['hooks']){_0x5b99d0[_0x468baa]=_0x459246['hooks'][_0x468baa];const _0x3aeb72=_0x459246['hooks'][_0x468baa][0x0]['to'],_0xe3b2e2=_0x459246['activities'][_0x3aeb72];_0xe3b2e2&&(!_0xe3b2e2['hook']&&(_0xe3b2e2['hook']={}),_0xe3b2e2['hook']['topic']=_0x468baa);}}await this['store']['setHookRules'](_0x5b99d0);}async['deployConsumerGroups'](){const _0xfa4c70={'appId':this['manifest']['app']['id']},_0x20ec67=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0xfa4c70);await this['deployConsumerGroup'](_0x20ec67,'ENGINE');for(const _0x39f203 of this['manifest']['app']['graphs']){const _0x390177=_0x39f203['activities'];for(const _0x439529 in _0x390177){const _0x2f4ce0=_0x390177[_0x439529];if(_0x2f4ce0['type']==='worker'&&pipe_1['Pipe']['resolve'](_0x2f4ce0['subtype'],{})===_0x2f4ce0['subtype']){_0xfa4c70['topic']=_0x2f4ce0['subtype'];const _0x311719=this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0xfa4c70);await this['deployConsumerGroup'](_0x311719,'WORKER');}}}}async['deployConsumerGroup'](_0x5da179,_0x110e4a){try{await this['stream']['createConsumerGroup'](_0x5da179,_0x110e4a);}catch(_0x4f03cd){this['store']['logger']['info']('router-stream-group-exists',{'stream':_0x5da179,'group':_0x110e4a});}}}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();}
|
|
@@ -13,24 +13,36 @@ class ConnectorService {
|
|
|
13
13
|
return target.client;
|
|
14
14
|
}
|
|
15
15
|
static async initClients(target) {
|
|
16
|
-
|
|
17
|
-
if (connections) {
|
|
18
|
-
if (connections.store) {
|
|
19
|
-
await ConnectorService.initClient(connections.store, target, 'store');
|
|
20
|
-
}
|
|
21
|
-
if (connections.stream) {
|
|
22
|
-
await ConnectorService.initClient(connections.stream, target, 'stream');
|
|
23
|
-
}
|
|
24
|
-
if (connections.sub) {
|
|
25
|
-
await ConnectorService.initClient(connections.sub, target, 'sub');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
16
|
+
let connections = target.connections;
|
|
17
|
+
if (!connections) {
|
|
29
18
|
const ProviderConfig = utils_1.polyfill.providerConfig(target);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
connections = target.connections = {
|
|
20
|
+
store: { ...ProviderConfig },
|
|
21
|
+
stream: { ...ProviderConfig },
|
|
22
|
+
sub: { ...ProviderConfig },
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (connections.store) {
|
|
26
|
+
await ConnectorService.initClient(connections.store, target, 'store');
|
|
27
|
+
}
|
|
28
|
+
if (connections.stream) {
|
|
29
|
+
await ConnectorService.initClient(connections.stream, target, 'stream');
|
|
30
|
+
}
|
|
31
|
+
if (connections.sub) {
|
|
32
|
+
await ConnectorService.initClient(connections.sub, target, 'sub');
|
|
33
|
+
if (connections.sub.class === connections.store.class) {
|
|
34
|
+
connections.pub = {
|
|
35
|
+
class: connections.store.class,
|
|
36
|
+
options: { ...connections.store.options }
|
|
37
|
+
};
|
|
38
|
+
target.pub = target.store;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
connections.pub = {
|
|
42
|
+
class: connections.sub.class,
|
|
43
|
+
options: { ...connections.sub.options }
|
|
44
|
+
};
|
|
45
|
+
await ConnectorService.initClient(connections.pub, target, 'pub');
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ProviderClass, ProviderNativeClient, ProviderOptions } from '../../types/provider';
|
|
2
|
+
import { ILogger } from '../logger';
|
|
2
3
|
declare abstract class AbstractConnection<PClass, POptions> {
|
|
4
|
+
static logger: ILogger;
|
|
3
5
|
protected connection: any | null;
|
|
4
6
|
protected static instances: Map<string, AbstractConnection<ProviderClass, ProviderOptions>>;
|
|
5
7
|
protected id: string | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractConnection = void 0;
|
|
4
|
+
const logger_1 = require("../logger");
|
|
4
5
|
class AbstractConnection {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.connection = null;
|
|
@@ -32,4 +33,5 @@ class AbstractConnection {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
exports.AbstractConnection = AbstractConnection;
|
|
36
|
+
AbstractConnection.logger = new logger_1.LoggerService('hotmesh', 'meshos');
|
|
35
37
|
AbstractConnection.instances = new Map();
|
|
@@ -11,11 +11,17 @@ class NatsConnection extends __1.AbstractConnection {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
async createConnection(Connect, options) {
|
|
14
|
-
|
|
14
|
+
try {
|
|
15
|
+
return (await Connect(options));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
NatsConnection.logger.error(`nats-provider-connection-failed`, { ...error });
|
|
19
|
+
throw new Error(`nats-provider-connection-failed: ${error.message}`);
|
|
20
|
+
}
|
|
15
21
|
}
|
|
16
22
|
getClient() {
|
|
17
23
|
if (!this.connection) {
|
|
18
|
-
throw new Error('
|
|
24
|
+
throw new Error('nats-provider-connection-failed');
|
|
19
25
|
}
|
|
20
26
|
return this.connection;
|
|
21
27
|
}
|
|
@@ -23,8 +23,12 @@ class PostgresConnection extends __1.AbstractConnection {
|
|
|
23
23
|
return connection;
|
|
24
24
|
}
|
|
25
25
|
catch (error) {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
PostgresConnection.logger.error(`postgres-provider-connection-failed`, {
|
|
27
|
+
host: options.host ?? 'unknown',
|
|
28
|
+
database: options.database ?? 'unknown',
|
|
29
|
+
port: options.port ?? 'unknown',
|
|
30
|
+
});
|
|
31
|
+
throw new Error(`postgres-provider-connection-failed: ${error.message}`);
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
getClient() {
|
|
@@ -35,7 +39,7 @@ class PostgresConnection extends __1.AbstractConnection {
|
|
|
35
39
|
}
|
|
36
40
|
async closeConnection(connection) {
|
|
37
41
|
if (!connection) {
|
|
38
|
-
|
|
42
|
+
PostgresConnection.logger.warn(`postgres-not-connected-cannot-close`);
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
41
45
|
await connection.end();
|