@hotmeshio/hotmesh 0.3.23 → 0.3.24
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 +3 -1
- package/build/modules/key.js +1 -1
- package/build/modules/utils.js +1 -1
- package/build/package.json +3 -3
- 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/providers/postgres.js +1 -0
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.js +1 -1
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.js +3 -1
- package/build/services/meshdata/index.d.ts +2 -3
- package/build/services/meshdata/index.js +4 -6
- package/build/services/meshflow/client.js +3 -1
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/workflow.d.ts +8 -0
- package/build/services/meshflow/workflow.js +41 -1
- package/build/services/pipe/functions/array.js +1 -1
- package/build/services/pipe/functions/bitwise.js +1 -1
- package/build/services/pipe/functions/conditional.js +1 -1
- package/build/services/pipe/functions/cron.js +1 -1
- package/build/services/pipe/functions/date.js +1 -1
- package/build/services/pipe/functions/index.js +1 -1
- package/build/services/pipe/functions/json.js +1 -1
- package/build/services/pipe/functions/logical.js +1 -1
- package/build/services/pipe/functions/math.js +1 -1
- package/build/services/pipe/functions/number.js +1 -1
- package/build/services/pipe/functions/object.js +1 -1
- package/build/services/pipe/functions/string.js +1 -1
- package/build/services/pipe/functions/symbol.js +1 -1
- package/build/services/pipe/functions/unary.js +1 -1
- package/build/services/pipe/index.js +1 -1
- package/build/services/quorum/index.js +1 -1
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.js +1 -1
- package/build/services/search/providers/postgres/postgres.js +1 -1
- package/build/services/search/providers/redis/ioredis.js +1 -1
- package/build/services/search/providers/redis/redis.js +1 -1
- package/build/services/serializer/index.js +1 -1
- package/build/services/store/providers/postgres/kvsql.js +1 -1
- package/build/services/store/providers/postgres/kvtables.d.ts +1 -1
- package/build/services/store/providers/postgres/kvtables.js +1 -1
- package/build/services/store/providers/postgres/kvtransaction.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/hash.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/string.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/zset.js +1 -1
- package/build/services/store/providers/postgres/postgres.js +1 -1
- package/build/services/store/providers/redis/_base.js +1 -1
- package/build/services/store/providers/redis/ioredis.js +1 -1
- package/build/services/store/providers/redis/redis.js +1 -1
- package/build/services/store/providers/store-initializable.js +1 -1
- package/build/services/stream/providers/nats/nats.js +1 -1
- package/build/services/stream/providers/postgres/postgres.js +1 -1
- package/build/services/stream/providers/redis/ioredis.js +1 -1
- package/build/services/stream/providers/redis/redis.js +1 -1
- package/build/services/stream/providers/stream-initializable.js +1 -1
- package/build/services/sub/index.d.ts +5 -5
- package/build/services/sub/providers/nats/nats.js +1 -1
- package/build/services/sub/providers/postgres/postgres.d.ts +3 -3
- package/build/services/sub/providers/postgres/postgres.js +1 -1
- package/build/services/sub/providers/redis/ioredis.js +1 -1
- package/build/services/sub/providers/redis/redis.js +1 -1
- package/build/services/task/index.js +1 -1
- package/build/services/telemetry/index.d.ts +1 -0
- package/build/services/telemetry/index.js +1 -1
- package/build/services/worker/index.js +1 -1
- package/build/types/quorum.d.ts +7 -1
- package/package.json +3 -3
- package/types/quorum.ts +9 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0x1ddd(_0x450bdd,_0x3b3a72){const _0x2a885d=_0x2a88();return _0x1ddd=function(_0x1ddd96,_0xab21f3){_0x1ddd96=_0x1ddd96-0x1e2;let _0x2477a5=_0x2a885d[_0x1ddd96];return _0x2477a5;},_0x1ddd(_0x450bdd,_0x3b3a72);}(function(_0x531b8e,_0xacf19b){const _0x51acf8=_0x1ddd,_0x5c5ded=_0x531b8e();while(!![]){try{const _0x3fed11=-parseInt(_0x51acf8(0x1e2))/0x1+-parseInt(_0x51acf8(0x1ea))/0x2+parseInt(_0x51acf8(0x1e7))/0x3*(-parseInt(_0x51acf8(0x1ec))/0x4)+parseInt(_0x51acf8(0x1e3))/0x5*(-parseInt(_0x51acf8(0x1e9))/0x6)+parseInt(_0x51acf8(0x1e6))/0x7*(parseInt(_0x51acf8(0x1e4))/0x8)+-parseInt(_0x51acf8(0x1e5))/0x9+parseInt(_0x51acf8(0x1eb))/0xa*(parseInt(_0x51acf8(0x1e8))/0xb);if(_0x3fed11===_0xacf19b)break;else _0x5c5ded['push'](_0x5c5ded['shift']());}catch(_0x338817){_0x5c5ded['push'](_0x5c5ded['shift']());}}}(_0x2a88,0xbb8a4));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['RedisStreamService']=void 0x0;const index_1=require('../../index'),utils_1=require('../../../../modules/utils'),key_1=require('../../../../modules/key'),enums_1=require('../../../../modules/enums');class RedisStreamService extends index_1['StreamService']{constructor(_0x2b62b3,_0x204316,_0x10e8f4={}){super(_0x2b62b3,_0x204316,_0x10e8f4);}async['init'](_0x1d1fb6,_0x222150,_0x7e8f06){this['namespace']=_0x1d1fb6,this['logger']=_0x7e8f06,this['appId']=_0x222150;}['mintKey'](_0x3772de,_0x39d768){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x3772de,{..._0x39d768,'appId':this['appId']});}['transact'](){return this['streamClient']['multi']();}async['createStream'](_0x57780e){try{const _0x581602=await this['streamClient']['XADD'](_0x57780e,'*',{'field':'value'});return await this['streamClient']['XDEL'](_0x57780e,_0x581602),!![];}catch(_0x5ef9d1){this['logger']['error']('Error\x20creating\x20stream\x20'+_0x57780e,{..._0x5ef9d1});throw _0x5ef9d1;}}async['deleteStream'](_0x85ceea){try{const _0x34b4f4=await this['streamClient']['DEL'](_0x85ceea);return _0x34b4f4>0x0;}catch(_0x125aed){this['logger']['error']('Error\x20deleting\x20stream\x20'+_0x85ceea,{..._0x125aed});throw _0x125aed;}}async['createConsumerGroup'](_0x5d647d,_0x104ccc){try{const _0x2ea16d=await this['storeClient']['sendCommand'](['XGROUP','CREATE',_0x5d647d,_0x104ccc,'$','MKSTREAM']);return _0x2ea16d==='OK';}catch(_0x131207){const _0xec47c5='with\x20MKSTREAM';this['logger']['debug']('x-group-error\x20'+_0xec47c5+'\x20for\x20key:\x20'+_0x5d647d+'\x20and\x20group:\x20'+_0x104ccc,{..._0x131207});throw _0x131207;}}async['deleteConsumerGroup'](_0x501d94,_0x43617c){try{const _0x5be607=await this['streamClient']['xGroupDestroy'](_0x501d94,_0x43617c);return _0x5be607;}catch(_0x182bfb){this['logger']['error']('Error\x20deleting\x20consumer\x20group\x20'+_0x43617c+'\x20for\x20stream\x20'+_0x501d94,{..._0x182bfb});throw _0x182bfb;}}async['publishMessages'](_0x1520df,_0x43f9f3,_0x4cf0e4){try{const _0x52c83a=_0x4cf0e4?.['transaction']||_0x43f9f3['length']>0x1&&this['storeClient']['multi']();let _0x17037e;for(const _0xbc355b of _0x43f9f3){_0x17037e=await(_0x52c83a||this['storeClient'])['XADD'](_0x1520df,'*',{'message':_0xbc355b});}return _0x52c83a&&!_0x4cf0e4?.['transaction']?(await _0x52c83a['exec']())['map'](_0x3d3494=>_0x3d3494[0x1]):[_0x17037e];}catch(_0x5cec86){this['logger']['error']('ioredis-xadd-error\x20key:\x20'+_0x1520df,{..._0x5cec86});throw _0x5cec86;}}async['consumeMessages'](_0x4e1f7a,_0x39d4fe,_0x497bd0,_0x317238){const _0x3f64b3='GROUP',_0x1c0e4f='BLOCK',_0x1c239f='STREAMS',_0x45c99b='>';try{const _0x11c1ec=await this['streamClient']['sendCommand'](['XREADGROUP',_0x3f64b3,_0x39d4fe,_0x497bd0,_0x1c0e4f,_0x317238?.['blockTimeout']?.['toString']()??enums_1['HMSH_BLOCK_TIME_MS']['toString'](),_0x1c239f,_0x4e1f7a,_0x45c99b]),_0x2090b8=[];if((0x0,utils_1['isStreamMessage'])(_0x11c1ec)){const [[,_0xa8e5c1]]=_0x11c1ec;for(const [_0x5bd928,_0x5b780c]of _0xa8e5c1){_0x2090b8['push']({'id':_0x5bd928,'data':(0x0,utils_1['parseStreamMessage'])(_0x5b780c[0x1])});}}else return[];return _0x2090b8;}catch(_0x1d4656){this['logger']['error']('Error\x20consuming\x20messages\x20from\x20'+_0x4e1f7a,{'error':_0x1d4656});throw _0x1d4656;}}async['ackAndDelete'](_0x41789a,_0x188f34,_0x5bc06e){const _0x3dac67=this['storeClient']['multi']();return await this['acknowledgeMessages'](_0x41789a,_0x188f34,_0x5bc06e,{'multi':_0x3dac67}),await this['deleteMessages'](_0x41789a,_0x188f34,_0x5bc06e,{'multi':_0x3dac67}),await _0x3dac67['exec'](),_0x5bc06e['length'];}async['acknowledgeMessages'](_0x49e350,_0x4088ff,_0x1b5637,_0x264ea6){try{return _0x264ea6?.['multi']?(_0x264ea6['multi']['XACK'](_0x49e350,_0x4088ff,_0x1b5637),_0x264ea6['multi']):await this['streamClient']['XACK'](_0x49e350,_0x4088ff,..._0x1b5637);}catch(_0x250e7d){this['logger']['error']('Error\x20in\x20acknowledging\x20messages\x20in\x20group:\x20'+_0x4088ff+'\x20for\x20key:\x20'+_0x49e350,{..._0x250e7d});throw _0x250e7d;}}async['deleteMessages'](_0x1a85d7,_0x1d8d0c,_0x4d5115,_0x5d3542){try{return _0x5d3542?.['multi']?(_0x5d3542['multi']['xDel'](_0x1a85d7,_0x4d5115),_0x5d3542['multi']):await this['streamClient']['XDEL'](_0x1a85d7,..._0x4d5115);}catch(_0x5db78d){this['logger']['error']('Error\x20in\x20deleting\x20messages\x20with\x20ids:\x20'+_0x4d5115['join'](',')+'\x20for\x20key:\x20'+_0x1a85d7,{..._0x5db78d});throw _0x5db78d;}}async['getPendingMessages'](_0x16f491,_0x5fbb0b,_0x562dc1,_0x519d59){try{const _0x43e979='-',_0x2a858f='+',_0x8ef030=[_0x16f491,_0x5fbb0b];if(_0x43e979)_0x8ef030['push'](_0x43e979);if(_0x2a858f)_0x8ef030['push'](_0x2a858f);if(_0x562dc1!==undefined)_0x8ef030['push'](_0x562dc1['toString']());if(_0x519d59)_0x8ef030['push'](_0x519d59);try{return await this['streamClient']['sendCommand'](['XPENDING',..._0x8ef030]);}catch(_0x237341){this['logger']['error']('error,\x20args',{..._0x237341},_0x8ef030);}}catch(_0xb3eafe){this['logger']['error']('Error\x20retrieving\x20pending\x20messages\x20for\x20group:\x20'+_0x5fbb0b+'\x20in\x20key:\x20'+_0x16f491,{..._0xb3eafe});throw _0xb3eafe;}}async['retryMessages'](_0x39e6b6,_0x5cd0a1,_0x494c90){let _0x5d26ec=[];const _0x5f3070=await this['getPendingMessages'](_0x39e6b6,_0x5cd0a1,_0x494c90?.['limit']);for(const _0x192fdd of _0x5f3070){if(Array['isArray'](_0x192fdd)){const [_0x21018a,,_0x27fc83,_0x2d8af0]=_0x192fdd;if(_0x27fc83>_0x494c90?.['minIdleTime']){const _0x491e4f=await this['claimMessage'](_0x39e6b6,_0x5cd0a1,_0x494c90?.['consumerName'],_0x494c90?.['minIdleTime'],_0x21018a);_0x5d26ec=_0x5d26ec['concat'](_0x491e4f);}}}return _0x5d26ec;}async['claimMessage'](_0x1509fa,_0x3ab4b8,_0x5ac8ec,_0x4229c5,_0x681f32,..._0x55b6ee){try{const _0x17a35c=await this['streamClient']['sendCommand'](['XCLAIM',_0x1509fa,_0x3ab4b8,_0x5ac8ec,_0x4229c5['toString'](),_0x681f32,..._0x55b6ee]);return{'id':_0x17a35c[0x0][0x0],'data':(0x0,utils_1['parseStreamMessage'])(_0x17a35c[0x0][0x1][0x1])};}catch(_0x4daeb4){this['logger']['error']('Error\x20in\x20claiming\x20message\x20with\x20id:\x20'+_0x681f32+'\x20in\x20group:\x20'+_0x3ab4b8+'\x20for\x20key:\x20'+_0x1509fa,{..._0x4daeb4});throw _0x4daeb4;}}async['getStreamStats'](_0x45ad90){return{'messageCount':await this['getStreamDepth'](_0x45ad90)};}async['getStreamDepth'](_0x3b671e,_0x206a2f){try{if(_0x206a2f?.['multi'])return _0x206a2f['multi']['XLEN'](_0x3b671e),0x0;const _0x24eeae=await this['streamClient']['XLEN'](_0x3b671e);return _0x24eeae;}catch(_0x22981b){this['logger']['error']('Error\x20getting\x20depth\x20for\x20'+_0x3b671e,{..._0x22981b});throw _0x22981b;}}async['getStreamDepths'](_0x81bcfa){const _0x41fd49=this['storeClient']['multi'](),_0x5da83a=new Map();_0x81bcfa['forEach'](_0x203efc=>{!_0x5da83a['has'](_0x203efc['stream'])&&(_0x5da83a['set'](_0x203efc['stream'],-0x1),this['getStreamDepth'](_0x203efc['stream'],{'multi':_0x41fd49}));});const _0x5b8a3d=await _0x41fd49['exec']();return Array['from'](_0x5da83a['keys']())['forEach']((_0x39da3c,_0x332d0f)=>{_0x5da83a['set'](_0x39da3c,_0x5b8a3d[_0x332d0f]);}),_0x81bcfa['map'](_0x4a9aab=>{return{'stream':_0x4a9aab['stream'],'depth':_0x5da83a['get'](_0x4a9aab['stream'])||0x0};});}async['trimStream'](_0x77efb,_0x19f538){return 0x0;}['getProviderSpecificFeatures'](){return{'supportsBatching':!![],'supportsDeadLetterQueue':![],'supportsOrdering':!![],'supportsTrimming':!![],'supportsRetry':!![],'maxMessageSize':0x200*0x400*0x400,'maxBatchSize':0x3e8};}}exports['RedisStreamService']=RedisStreamService;function _0x2a88(){const _0x58b4d1=['16xcSdOc','4637592XoSEOx','4281949YPFBrv','2637lVIvqx','831468yXARlu','12DhBxeW','2665172AwTTXG','610cEvmmx','6128WHYnky','1367170kgOFNA','1261115ooVKVQ'];_0x2a88=function(){return _0x58b4d1;};return _0x2a88();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x70108d,_0x410d61){var _0x2eac7b=_0xd33c,_0x421734=_0x70108d();while(!![]){try{var _0x68b34c=-parseInt(_0x2eac7b(0x75))/0x1*(parseInt(_0x2eac7b(0x7c))/0x2)+parseInt(_0x2eac7b(0x7e))/0x3*(parseInt(_0x2eac7b(0x77))/0x4)+parseInt(_0x2eac7b(0x80))/0x5+parseInt(_0x2eac7b(0x76))/0x6*(parseInt(_0x2eac7b(0x7d))/0x7)+parseInt(_0x2eac7b(0x79))/0x8*(parseInt(_0x2eac7b(0x7a))/0x9)+-parseInt(_0x2eac7b(0x81))/0xa*(parseInt(_0x2eac7b(0x7f))/0xb)+-parseInt(_0x2eac7b(0x7b))/0xc*(parseInt(_0x2eac7b(0x78))/0xd);if(_0x68b34c===_0x410d61)break;else _0x421734['push'](_0x421734['shift']());}catch(_0x1cece3){_0x421734['push'](_0x421734['shift']());}}}(_0x1b8e,0xaec39));function _0xd33c(_0x28dd46,_0x2336f8){var _0x1b8ed9=_0x1b8e();return _0xd33c=function(_0xd33cc6,_0x14d53d){_0xd33cc6=_0xd33cc6-0x75;var _0x9623cc=_0x1b8ed9[_0xd33cc6];return _0x9623cc;},_0xd33c(_0x28dd46,_0x2336f8);}function _0x1b8e(){var _0x197d89=['4119424HFIUzR','2444481JFJPQW','32456QdSJZj','1386MyarAW','84CPFPlx','4230uCzlIU','56035BKPRiD','3DjkjjA','3718jyYioa','1392370hnzEyB','370lYCMjB','269dlPVhZ','510AjEvTk'];_0x1b8e=function(){return _0x197d89;};return _0x1b8e();}Object['defineProperty'](exports,'__esModule',{'value':!![]});
|
|
@@ -13,10 +13,10 @@ declare abstract class SubService<ClientProvider extends ProviderClient> {
|
|
|
13
13
|
abstract init(namespace: string, appId: string, engineId: string, logger: ILogger): Promise<void>;
|
|
14
14
|
abstract transact(): ProviderTransaction;
|
|
15
15
|
abstract mintKey(type: KeyType, params: KeyStoreParams): string;
|
|
16
|
-
abstract subscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string,
|
|
17
|
-
abstract unsubscribe(keyType: KeyType.QUORUM, appId: string,
|
|
18
|
-
abstract psubscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string,
|
|
19
|
-
abstract punsubscribe(keyType: KeyType.QUORUM, appId: string,
|
|
20
|
-
abstract publish(keyType: KeyType, message: Record<string, any>, appId: string,
|
|
16
|
+
abstract subscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string, topic?: string): Promise<void>;
|
|
17
|
+
abstract unsubscribe(keyType: KeyType.QUORUM, appId: string, topic?: string): Promise<void>;
|
|
18
|
+
abstract psubscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string, topic?: string): Promise<void>;
|
|
19
|
+
abstract punsubscribe(keyType: KeyType.QUORUM, appId: string, topic?: string): Promise<void>;
|
|
20
|
+
abstract publish(keyType: KeyType, message: Record<string, any>, appId: string, topic?: string): Promise<boolean>;
|
|
21
21
|
}
|
|
22
22
|
export { SubService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x1ea868,_0x1909e2){const _0x406f0b=_0x3a0c,_0x18890c=_0x1ea868();while(!![]){try{const _0x1c13ae=parseInt(_0x406f0b(0x16f))/0x1*(-parseInt(_0x406f0b(0x16b))/0x2)+parseInt(_0x406f0b(0x16c))/0x3*(parseInt(_0x406f0b(0x171))/0x4)+-parseInt(_0x406f0b(0x170))/0x5*(parseInt(_0x406f0b(0x176))/0x6)+-parseInt(_0x406f0b(0x16e))/0x7+parseInt(_0x406f0b(0x175))/0x8+parseInt(_0x406f0b(0x16d))/0x9*(parseInt(_0x406f0b(0x172))/0xa)+-parseInt(_0x406f0b(0x174))/0xb*(-parseInt(_0x406f0b(0x173))/0xc);if(_0x1c13ae===_0x1909e2)break;else _0x18890c['push'](_0x18890c['shift']());}catch(_0x31fa99){_0x18890c['push'](_0x18890c['shift']());}}}(_0x5bf2,0x47795));function _0x3a0c(_0x1c6d29,_0x4e3590){const _0x5bf24e=_0x5bf2();return _0x3a0c=function(_0x3a0cef,_0x53c869){_0x3a0cef=_0x3a0cef-0x16b;let _0x119109=_0x5bf24e[_0x3a0cef];return _0x119109;},_0x3a0c(_0x1c6d29,_0x4e3590);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['NatsSubService']=void 0x0;const key_1=require('../../../../modules/key'),index_1=require('../../index');class NatsSubService extends index_1['SubService']{constructor(_0x3adc2c,_0x11efe4){super(_0x3adc2c,_0x11efe4),this['subscriptions']=new Map();}async['init'](_0x4dc9d3=key_1['HMNS'],_0xd3d791,_0x173038,_0x230ba9){this['namespace']=_0x4dc9d3,this['logger']=_0x230ba9,this['appId']=_0xd3d791,this['engineId']=_0x173038;}['transact'](){return{};}['mintKey'](_0x377234,_0x10cc26){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x377234,_0x10cc26)['replace'](/:/g,'.')['replace'](/\.$/g,'.X');}async['subscribe'](_0x197bd1,_0xf54a3c,_0x16a4d9,_0x2e84e8){const _0x6fb305=this['mintKey'](_0x197bd1,{'appId':_0x16a4d9,'engineId':_0x2e84e8}),_0x2dbe41=this['eventClient']['subscribe'](_0x6fb305);this['subscriptions']['set'](_0x6fb305,_0x2dbe41),this['logger']['debug']('nats-subscribe\x20'+_0x6fb305),(async()=>{for await(const _0x5cf146 of _0x2dbe41){try{const _0x3f594a=JSON['parse'](_0x5cf146['data']['toString']());_0xf54a3c(_0x6fb305,_0x3f594a);}catch(_0x14fc84){this['logger']['error']('nats-subscribe-message-parse-error:\x20'+_0x5cf146['data']['toString'](),_0x14fc84);}}})()['catch'](_0x5d8a71=>{this['logger']['error']('nats-subscribe-error\x20'+_0x6fb305,_0x5d8a71);});}async['unsubscribe'](_0x101d41,_0x11b73f,_0x12ce46){const _0x521f4f=this['mintKey'](_0x101d41,{'appId':_0x11b73f,'engineId':_0x12ce46}),_0x3d0347=this['subscriptions']['get'](_0x521f4f);_0x3d0347?(_0x3d0347['unsubscribe'](),this['subscriptions']['delete'](_0x521f4f),this['logger']['debug']('nats-unsubscribe\x20'+_0x521f4f)):this['logger']['warn']('nats-unsubscribe-error\x20'+_0x521f4f);}async['psubscribe'](_0x31fa12,_0x16a2c2,_0x351920,_0x3d1f2d){const _0x5c70a2=this['mintKey'](_0x31fa12,{'appId':_0x351920,'engineId':_0x3d1f2d}),_0x82b34e=this['eventClient']['subscribe'](_0x5c70a2);this['subscriptions']['set'](_0x5c70a2,_0x82b34e),this['logger']['debug']('nats-psubscribe\x20'+_0x5c70a2),(async()=>{for await(const _0x502907 of _0x82b34e){try{const _0x47a4bb=JSON['parse'](_0x502907['data']['toString']());_0x16a2c2(_0x502907['subject'],_0x47a4bb);}catch(_0x35b4f4){this['logger']['error']('nats-parse-psubscription-message-error\x20'+_0x502907['data']['toString'](),_0x35b4f4);}}})()['catch'](_0x79cbe1=>{this['logger']['error']('nats-pattern-psubscription-error\x20'+_0x5c70a2,_0x79cbe1);});}async['punsubscribe'](_0x507121,_0x40411e,_0x1a9886){const _0x589e2a=this['mintKey'](_0x507121,{'appId':_0x40411e,'engineId':_0x1a9886}),_0x4de841=this['subscriptions']['get'](_0x589e2a);_0x4de841?(_0x4de841['unsubscribe'](),this['subscriptions']['delete'](_0x589e2a),this['logger']['debug']('nats-punsubscribe\x20'+_0x589e2a)):this['logger']['warn']('nats-punsubscribe-error\x20'+_0x589e2a);}async['publish'](_0x53052c,_0x28f25b,_0x134c71,_0x1bb72c){const _0x5a1aae=this['mintKey'](_0x53052c,{'appId':_0x134c71,'engineId':_0x1bb72c});try{return this['storeClient']['publish'](_0x5a1aae,JSON['stringify'](_0x28f25b)),this['logger']['debug']('nats-publish\x20'+_0x5a1aae),!![];}catch(_0x48ba87){return this['logger']['error']('nats-publish-error\x20'+_0x5a1aae,_0x48ba87),![];}}}function _0x5bf2(){const _0x42602d=['3036QJRQrs','819207MmPJNb','1356530iJxQhB','1IwWDnu','5RVFPGH','168BOCimr','40mHHdqJ','119208XCAyzA','814geKKOW','2064880XhVlao','3079968nWFGxC','799894hfXbXK'];_0x5bf2=function(){return _0x42602d;};return _0x5bf2();}exports['NatsSubService']=NatsSubService;
|
|
@@ -10,9 +10,9 @@ declare class PostgresSubService extends SubService<PostgresClientType & Provide
|
|
|
10
10
|
transact(): ProviderTransaction;
|
|
11
11
|
mintKey(type: KeyType, params: KeyStoreParams): string;
|
|
12
12
|
mintSafeKey(type: KeyType, params: KeyStoreParams): [string, string];
|
|
13
|
-
subscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string,
|
|
14
|
-
unsubscribe(keyType: KeyType.QUORUM, appId: string,
|
|
15
|
-
publish(keyType: KeyType.QUORUM, message: Record<string, any>, appId: string,
|
|
13
|
+
subscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string, topic?: string): Promise<void>;
|
|
14
|
+
unsubscribe(keyType: KeyType.QUORUM, appId: string, topic?: string): Promise<void>;
|
|
15
|
+
publish(keyType: KeyType.QUORUM, message: Record<string, any>, appId: string, topic?: string): Promise<boolean>;
|
|
16
16
|
psubscribe(): Promise<void>;
|
|
17
17
|
punsubscribe(): Promise<void>;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';(function(_0x514c9b,_0x12369a){const _0x26a534=_0xac97,_0x22214f=_0x514c9b();while(!![]){try{const _0x406b1e=-parseInt(_0x26a534(0x6f))/0x1*(parseInt(_0x26a534(0x68))/0x2)+parseInt(_0x26a534(0x71))/0x3*(parseInt(_0x26a534(0x69))/0x4)+-parseInt(_0x26a534(0x70))/0x5+-parseInt(_0x26a534(0x6e))/0x6*(parseInt(_0x26a534(0x6b))/0x7)+parseInt(_0x26a534(0x6c))/0x8*(-parseInt(_0x26a534(0x6d))/0x9)+-parseInt(_0x26a534(0x72))/0xa+parseInt(_0x26a534(0x6a))/0xb;if(_0x406b1e===_0x12369a)break;else _0x22214f['push'](_0x22214f['shift']());}catch(_0x2471a9){_0x22214f['push'](_0x22214f['shift']());}}}(_0x4692,0x9da90));var __importDefault=this&&this['__importDefault']||function(_0x42e8a7){return _0x42e8a7&&_0x42e8a7['__esModule']?_0x42e8a7:{'default':_0x42e8a7};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['PostgresSubService']=void 0x0;function _0x4692(){const _0x436532=['2321991JNFtqX','319770iybxQS','1EvvUgK','228240xCxzFX','1386fzbVHk','7631820xLRHRk','1303436xGzKJN','5240ruXGsX','29902543BxCmDK','126EWbyNk','8wxpoqH'];_0x4692=function(){return _0x436532;};return _0x4692();}const crypto_1=__importDefault(require('crypto')),key_1=require('../../../../modules/key'),index_1=require('../../index');function _0xac97(_0x585492,_0x1d6f0d){const _0x46922a=_0x4692();return _0xac97=function(_0xac9754,_0xbe8372){_0xac9754=_0xac9754-0x68;let _0x5ece19=_0x46922a[_0xac9754];return _0x5ece19;},_0xac97(_0x585492,_0x1d6f0d);}class PostgresSubService extends index_1['SubService']{constructor(_0x52acf1,_0x43a2cb){super(_0x52acf1,_0x43a2cb);}async['init'](_0x289c28=key_1['HMNS'],_0x299e3e,_0x3c2ba3,_0x2e4529){this['namespace']=_0x289c28,this['logger']=_0x2e4529,this['appId']=_0x299e3e,this['engineId']=_0x3c2ba3;}['transact'](){throw new Error('Transactions\x20are\x20not\x20supported\x20in\x20lightweight\x20pub/sub');}['mintKey'](_0x4df6e8,_0x491769){if(!this['namespace'])throw new Error('Namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x4df6e8,_0x491769);}['mintSafeKey'](_0x21c378,_0x56d137){const _0x44c450=this['mintKey'](_0x21c378,_0x56d137);if(_0x44c450['length']<=0x3f)return[_0x44c450,_0x44c450];const {appId:appId='',engineId:engineId=''}=_0x56d137,_0x1dd2f6=this['namespace']+':'+appId+':'+_0x21c378,_0x3cbd24=0x3f-_0x1dd2f6['length']-0x1,_0x18945c=crypto_1['default']['createHash']('sha256')['update'](engineId)['digest']('hex')['substring'](0x0,_0x3cbd24),_0x5006ac=_0x1dd2f6+':'+_0x18945c;return[_0x44c450,_0x5006ac];}async['subscribe'](_0x5cbba9,_0x5b4ee0,_0x2c9cb3,_0x4ed257){const [_0x4d7486,_0x3827b6]=this['mintSafeKey'](_0x5cbba9,{'appId':_0x2c9cb3,'engineId':_0x4ed257});await this['eventClient']['query']('LISTEN\x20\x22'+_0x3827b6+'\x22'),this['logger']['debug']('postgres-subscribe',{'originalKey':_0x4d7486,'safeKey':_0x3827b6}),this['eventClient']['on']('notification',_0x115558=>{if(_0x115558['channel']===_0x3827b6)try{const _0x354eda=JSON['parse'](_0x115558['payload']||'{}');_0x5b4ee0(_0x3827b6,_0x354eda);}catch(_0x1fdbdf){this['logger']['error']('Error\x20parsing\x20message\x20for\x20topic\x20'+_0x3827b6+':',_0x1fdbdf);}});}async['unsubscribe'](_0x53d9c9,_0x31fbcf,_0x187e2d){const [_0x1d739f,_0x19ce49]=this['mintSafeKey'](_0x53d9c9,{'appId':_0x31fbcf,'engineId':_0x187e2d});await this['eventClient']['query']('UNLISTEN\x20\x22'+_0x19ce49+'\x22'),this['logger']['debug']('postgres-subscribe',{'originalKey':_0x1d739f,'safeKey':_0x19ce49});}async['publish'](_0x2e2b91,_0xb7db3e,_0x52fcce,_0x65708c){const [_0x152905,_0x3df44c]=this['mintSafeKey'](_0x2e2b91,{'appId':_0x52fcce,'engineId':_0x65708c}),_0x70a30a=JSON['stringify'](_0xb7db3e)['replace'](/'/g,'\x27\x27');return await this['storeClient']['query']('NOTIFY\x20\x22'+_0x3df44c+'\x22,\x20\x27'+_0x70a30a+'\x27'),this['logger']['debug']('postgres-publish',{'originalKey':_0x152905,'safeKey':_0x3df44c}),!![];}async['psubscribe'](){throw new Error('Pattern\x20subscriptions\x20are\x20not\x20supported\x20in\x20PostgreSQL');}async['punsubscribe'](){throw new Error('Pattern\x20subscriptions\x20are\x20not\x20supported\x20in\x20PostgreSQL');}}exports['PostgresSubService']=PostgresSubService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x270ef4,_0x2ad031){const _0x54a4f1=_0x51ec,_0x4f1e46=_0x270ef4();while(!![]){try{const _0x3ef3c5=parseInt(_0x54a4f1(0x1e5))/0x1+parseInt(_0x54a4f1(0x1f0))/0x2*(-parseInt(_0x54a4f1(0x1ee))/0x3)+-parseInt(_0x54a4f1(0x1e7))/0x4+-parseInt(_0x54a4f1(0x1ef))/0x5*(-parseInt(_0x54a4f1(0x1ea))/0x6)+parseInt(_0x54a4f1(0x1eb))/0x7*(-parseInt(_0x54a4f1(0x1e8))/0x8)+-parseInt(_0x54a4f1(0x1e6))/0x9*(parseInt(_0x54a4f1(0x1ed))/0xa)+-parseInt(_0x54a4f1(0x1ec))/0xb*(-parseInt(_0x54a4f1(0x1e9))/0xc);if(_0x3ef3c5===_0x2ad031)break;else _0x4f1e46['push'](_0x4f1e46['shift']());}catch(_0xb99113){_0x4f1e46['push'](_0x4f1e46['shift']());}}}(_0x5a12,0xd12fe));function _0x5a12(){const _0x208a15=['84FLQObR','440kCVGLL','1360XGshFs','8031pYhWds','418300BmytsL','1254WMhcUq','1174020PxPXcP','101205ZYoLUf','86140FLOISE','857984AwxTlV','1209540kFmGbY','12DPsOCV'];_0x5a12=function(){return _0x208a15;};return _0x5a12();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['IORedisSubService']=void 0x0;const key_1=require('../../../../modules/key'),index_1=require('../../index');class IORedisSubService extends index_1['SubService']{constructor(_0x3aa756,_0x34d952){super(_0x3aa756,_0x34d952);}async['init'](_0x1a3f91=key_1['HMNS'],_0x27690e,_0x43d7e4,_0x4c7e92){this['namespace']=_0x1a3f91,this['logger']=_0x4c7e92,this['appId']=_0x27690e,this['engineId']=_0x43d7e4;}['transact'](){return this['eventClient']['multi']();}['mintKey'](_0xdb2fc2,_0x1a9ab1){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0xdb2fc2,_0x1a9ab1);}async['subscribe'](_0x3e4c9d,_0x553d94,_0x3ad88f,_0x5d0285){const _0x43560a=this,_0x265a4b=this['mintKey'](_0x3e4c9d,{'appId':_0x3ad88f,'engineId':_0x5d0285});await this['eventClient']['subscribe'](_0x265a4b,_0x57bcd6=>{_0x57bcd6&&_0x43560a['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x265a4b,_0x57bcd6);}),this['eventClient']['on']('message',(_0x2120ac,_0x39e1d5)=>{if(_0x2120ac===_0x265a4b)try{const _0x1e8b64=JSON['parse'](_0x39e1d5);_0x553d94(_0x265a4b,_0x1e8b64);}catch(_0x5bb6d9){_0x43560a['logger']['error']('Error\x20parsing\x20message:\x20'+_0x39e1d5,_0x5bb6d9);}});}async['unsubscribe'](_0x414a9c,_0x4e929d,_0x206d3f){const _0x4bdda8=this['mintKey'](_0x414a9c,{'appId':_0x4e929d,'engineId':_0x206d3f});await this['eventClient']['unsubscribe'](_0x4bdda8);}async['psubscribe'](_0x10cb69,_0x41ade3,_0x492fa7,_0x48fb65){const _0x21dd45=this,_0x144386=this['mintKey'](_0x10cb69,{'appId':_0x492fa7,'engineId':_0x48fb65});await this['eventClient']['psubscribe'](_0x144386,_0x5220cd=>{_0x5220cd&&_0x21dd45['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x144386,_0x5220cd);}),this['eventClient']['on']('pmessage',(_0x12b4f0,_0x3ff8dd,_0x479d3c)=>{if(_0x12b4f0===_0x144386)try{const _0x111a2e=JSON['parse'](_0x479d3c);_0x41ade3(_0x3ff8dd,_0x111a2e);}catch(_0x34e3f6){_0x21dd45['logger']['error']('Error\x20parsing\x20message:\x20'+_0x479d3c,_0x34e3f6);}});}async['punsubscribe'](_0x226464,_0x33cc2f,_0xfa82e3){const _0x4c41c8=this['mintKey'](_0x226464,{'appId':_0x33cc2f,'engineId':_0xfa82e3});await this['eventClient']['punsubscribe'](_0x4c41c8);}async['publish'](_0x52fa6b,_0x3921e8,_0x27f979,_0x3b02a9){const _0x1d5b6d=this['mintKey'](_0x52fa6b,{'appId':_0x27f979,'engineId':_0x3b02a9}),_0x4366c5=await this['storeClient']['publish'](_0x1d5b6d,JSON['stringify'](_0x3921e8));return _0x4366c5===0x1;}}function _0x51ec(_0x38e3e8,_0x4318e1){const _0x5a12a4=_0x5a12();return _0x51ec=function(_0x51ec63,_0x270e73){_0x51ec63=_0x51ec63-0x1e5;let _0x1d944f=_0x5a12a4[_0x51ec63];return _0x1d944f;},_0x51ec(_0x38e3e8,_0x4318e1);}exports['IORedisSubService']=IORedisSubService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x568cd0,_0x3382b9){const _0x5612eb=_0x2fc4,_0x448a4f=_0x568cd0();while(!![]){try{const _0x400db3=-parseInt(_0x5612eb(0x126))/0x1*(-parseInt(_0x5612eb(0x120))/0x2)+-parseInt(_0x5612eb(0x122))/0x3*(-parseInt(_0x5612eb(0x12b))/0x4)+parseInt(_0x5612eb(0x124))/0x5*(parseInt(_0x5612eb(0x125))/0x6)+parseInt(_0x5612eb(0x12a))/0x7+-parseInt(_0x5612eb(0x129))/0x8*(parseInt(_0x5612eb(0x123))/0x9)+parseInt(_0x5612eb(0x121))/0xa*(-parseInt(_0x5612eb(0x128))/0xb)+parseInt(_0x5612eb(0x127))/0xc;if(_0x400db3===_0x3382b9)break;else _0x448a4f['push'](_0x448a4f['shift']());}catch(_0x388dd9){_0x448a4f['push'](_0x448a4f['shift']());}}}(_0x4577,0x4945f));function _0x4577(){const _0x3c98f8=['796JmMzom','4gOFsDX','30zXzXZM','1239lYvyMR','4745295pRZBQC','2473320eBeWdC','6siYYKs','277253dCShVw','475500ajICES','1940334utwgDp','8pZkicO','1299074HKtcbJ'];_0x4577=function(){return _0x3c98f8;};return _0x4577();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['RedisSubService']=void 0x0;function _0x2fc4(_0x5d5339,_0x1f8d28){const _0x45778f=_0x4577();return _0x2fc4=function(_0x2fc4bf,_0x4664be){_0x2fc4bf=_0x2fc4bf-0x120;let _0x2d72fd=_0x45778f[_0x2fc4bf];return _0x2d72fd;},_0x2fc4(_0x5d5339,_0x1f8d28);}const key_1=require('../../../../modules/key'),index_1=require('../../index');class RedisSubService extends index_1['SubService']{constructor(_0x51cab4,_0x1c7b0d){super(_0x51cab4,_0x1c7b0d);}async['init'](_0x2e4c17=key_1['HMNS'],_0x5e7776,_0x33e47c,_0x416056){this['namespace']=_0x2e4c17,this['logger']=_0x416056,this['appId']=_0x5e7776,this['engineId']=_0x33e47c;}['transact'](){const _0x462d6b=this['eventClient']['multi']();return _0x462d6b;}['mintKey'](_0x14629d,_0x361483){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x14629d,_0x361483);}async['subscribe'](_0x2de88d,_0x469676,_0x3b4736,_0x2a644a){if(this['eventClient']){const _0x5e9652=this,_0x5c1a25=this['mintKey'](_0x2de88d,{'appId':_0x3b4736,'engineId':_0x2a644a});await this['eventClient']['subscribe'](_0x5c1a25,_0x3188fe=>{try{const _0x2b578b=JSON['parse'](_0x3188fe);_0x469676(_0x5c1a25,_0x2b578b);}catch(_0x279d62){_0x5e9652['logger']['error']('Error\x20parsing\x20message:\x20'+_0x3188fe,_0x279d62);}});}}async['unsubscribe'](_0x452898,_0x27c05f,_0x29571d){const _0x2f0bc0=this['mintKey'](_0x452898,{'appId':_0x27c05f,'engineId':_0x29571d});await this['eventClient']['unsubscribe'](_0x2f0bc0);}async['psubscribe'](_0x332f3e,_0x3bc1c9,_0x3eb70a,_0x27a285){if(this['eventClient']){const _0x921f2d=this,_0x3b2b62=this['mintKey'](_0x332f3e,{'appId':_0x3eb70a,'engineId':_0x27a285});await this['eventClient']['pSubscribe'](_0x3b2b62,(_0xcec359,_0x4b96f4)=>{try{const _0x7cd3e=JSON['parse'](_0xcec359);_0x3bc1c9(_0x4b96f4,_0x7cd3e);}catch(_0x50ec66){_0x921f2d['logger']['error']('Error\x20parsing\x20message:\x20'+_0xcec359,_0x50ec66);}});}}async['punsubscribe'](_0x46bedd,_0x3aeb24,_0x20a2df){const _0xc8a73b=this['mintKey'](_0x46bedd,{'appId':_0x3aeb24,'engineId':_0x20a2df});await this['eventClient']['pUnsubscribe'](_0xc8a73b);}async['publish'](_0x113ffa,_0x22458c,_0x37d6b6,_0x132b7f){const _0x3deae8=this['mintKey'](_0x113ffa,{'appId':_0x37d6b6,'engineId':_0x132b7f}),_0x5eec8d=await this['storeClient']['publish'](_0x3deae8,JSON['stringify'](_0x22458c));return _0x5eec8d>0x0;}}exports['RedisSubService']=RedisSubService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0xb8ea(){const _0x351dd0=['3410648fitiXE','27612220CofIQJ','2cWsvMy','5309941enXznm','772479jGwjoz','165716mAYdOf','2489094ggDZNA','18TIVVKL','1236785IAoHUm','24iicvdk'];_0xb8ea=function(){return _0x351dd0;};return _0xb8ea();}function _0x52fa(_0x375ecd,_0x5c837b){const _0xb8ea14=_0xb8ea();return _0x52fa=function(_0x52fa95,_0x10faf5){_0x52fa95=_0x52fa95-0x188;let _0x413961=_0xb8ea14[_0x52fa95];return _0x413961;},_0x52fa(_0x375ecd,_0x5c837b);}(function(_0x4c8958,_0x4aa38e){const _0x5c6ac5=_0x52fa,_0x20e4ab=_0x4c8958();while(!![]){try{const _0x5a8970=-parseInt(_0x5c6ac5(0x18d))/0x1*(parseInt(_0x5c6ac5(0x18a))/0x2)+-parseInt(_0x5c6ac5(0x18e))/0x3+-parseInt(_0x5c6ac5(0x188))/0x4+parseInt(_0x5c6ac5(0x190))/0x5*(parseInt(_0x5c6ac5(0x18f))/0x6)+-parseInt(_0x5c6ac5(0x18b))/0x7+parseInt(_0x5c6ac5(0x191))/0x8*(-parseInt(_0x5c6ac5(0x18c))/0x9)+parseInt(_0x5c6ac5(0x189))/0xa;if(_0x5a8970===_0x4aa38e)break;else _0x20e4ab['push'](_0x20e4ab['shift']());}catch(_0xea367){_0x20e4ab['push'](_0x20e4ab['shift']());}}}(_0xb8ea,0x9c0b9));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['TaskService']=void 0x0;const enums_1=require('../../modules/enums'),utils_1=require('../../modules/utils'),pipe_1=require('../pipe'),hotmesh_1=require('../../types/hotmesh'),key_1=require('../../modules/key');class TaskService{constructor(_0x80a640,_0x1a7002){this['cleanupTimeout']=null,this['isScout']=![],this['errorCount']=0x0,this['logger']=_0x1a7002,this['store']=_0x80a640;}async['processWebHooks'](_0x3803ca){const _0x203dcb=await this['store']['getActiveTaskQueue']();if(_0x203dcb){const [_0x1056aa,_0x2f456e,_0x30d915,..._0x56757a]=_0x203dcb['split'](key_1['WEBSEP']),_0x298d60=JSON['parse'](_0x56757a['join'](key_1['WEBSEP'])),_0x4ee808=_0x2f456e+':processed',_0x5e748c=await this['store']['processTaskQueue'](_0x2f456e,_0x4ee808);_0x5e748c?await _0x3803ca(_0x1056aa,{..._0x298d60,'id':_0x5e748c}):await this['store']['deleteProcessedTaskQueue'](_0x203dcb,_0x2f456e,_0x4ee808,_0x30d915==='true'),setImmediate(()=>this['processWebHooks'](_0x3803ca));}}async['enqueueWorkItems'](_0x29b40b){await this['store']['addTaskQueues'](_0x29b40b);}async['registerJobForCleanup'](_0x4573dd,_0x4d79dd=enums_1['HMSH_EXPIRE_DURATION'],_0x33f236){_0x4d79dd>0x0&&await this['store']['expireJob'](_0x4573dd,_0x4d79dd);}async['registerTimeHook'](_0x2c9ec9,_0x5ae9cb,_0x306b5e,_0x47824d,_0x4b8b3b=enums_1['HMSH_FIDELITY_SECONDS'],_0x926996,_0x1cb46f){const _0x15b411=Date['now']()+_0x4b8b3b*0x3e8,_0x1e09d9=enums_1['HMSH_FIDELITY_SECONDS']*0x3e8,_0x479802=Math['floor'](_0x15b411/_0x1e09d9)*_0x1e09d9;await this['store']['registerTimeHook'](_0x2c9ec9,_0x5ae9cb,_0x306b5e,_0x47824d,_0x479802,_0x926996,_0x1cb46f);}async['shouldScout'](){const _0x269016=this['isScout'],_0x1a418c=_0x269016||(this['isScout']=await this['store']['reserveScoutRole']('time'));if(_0x1a418c)return!_0x269016&&setTimeout(()=>{this['isScout']=![];},enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8),!![];return![];}async['processTimeHooks'](_0x51f43c,_0x4aa251){if(await this['shouldScout']())try{const _0x43eacc=await this['store']['getNextTask'](_0x4aa251);if(Array['isArray'](_0x43eacc)){const [_0x5e645c,_0x4d11ef,_0x1f6eb1,_0x445295,_0x2f71dd]=_0x43eacc;if(_0x2f71dd==='child'){}else{if(_0x2f71dd==='delist'){const _0x204f21=this['store']['mintKey'](hotmesh_1['KeyType']['SIGNALS'],{'appId':this['store']['appId']});await this['store']['delistSignalKey'](_0x204f21,_0x4d11ef);}else await _0x51f43c(_0x4d11ef,_0x1f6eb1,_0x445295,_0x2f71dd);}await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x51f43c,_0x5e645c);}else{if(_0x43eacc)await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x51f43c);else{const _0x2eb99b=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_FIDELITY_SECONDS']*0x3e8);this['cleanupTimeout']=_0x2eb99b['timerId'],await _0x2eb99b['promise'],this['errorCount']=0x0,this['processTimeHooks'](_0x51f43c);}}}catch(_0xa9e110){this['logger']['warn']('task-process-timehooks-error',_0xa9e110),await(0x0,utils_1['sleepFor'])(0x3e8*this['errorCount']++),this['errorCount']<0x5&&this['processTimeHooks'](_0x51f43c);}else{const _0x50fad5=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8*0x2*Math['random']());this['cleanupTimeout']=_0x50fad5['timerId'],await _0x50fad5['promise'],this['processTimeHooks'](_0x51f43c);}}['cancelCleanup'](){this['cleanupTimeout']!==undefined&&(clearTimeout(this['cleanupTimeout']),this['cleanupTimeout']=undefined);}async['getHookRule'](_0x1ed51f){const _0x136989=await this['store']['getHookRules']();return _0x136989?.[_0x1ed51f]?.[0x0];}async['registerWebHook'](_0x39e89d,_0x197cea,_0x5c32b0,_0x5d6728,_0x13e71f){const _0x38ed04=await this['getHookRule'](_0x39e89d);if(_0x38ed04){const _0x4b6430=_0x38ed04['conditions']['match'][0x0]['expected'],_0x5c3f55=pipe_1['Pipe']['resolve'](_0x4b6430,_0x197cea),_0x2ae546=_0x197cea['metadata']['jid'],_0x539ea5=_0x197cea['metadata']['gid'],_0x2bbbdd=_0x38ed04['to'],_0x1e0e1b=[_0x2bbbdd,_0x5c32b0,_0x539ea5,_0x2ae546]['join'](key_1['WEBSEP']),_0x4e2634={'topic':_0x39e89d,'resolved':_0x5c3f55,'jobId':_0x1e0e1b,'expire':_0x5d6728};return await this['store']['setHookSignal'](_0x4e2634,_0x13e71f),_0x2ae546;}else throw new Error('signaler.registerWebHook:error:\x20hook\x20rule\x20not\x20found');}async['processWebHookSignal'](_0x250657,_0xc81947){const _0x325a8e=await this['getHookRule'](_0x250657);if(_0x325a8e){const _0x196827={'$self':{'hook':{'data':_0xc81947}},'$hook':{'data':_0xc81947}},_0xba6d0b=_0x325a8e['conditions']['match'][0x0]['actual'],_0x73a11e=pipe_1['Pipe']['resolve'](_0xba6d0b,_0x196827),_0x369394=await this['store']['getHookSignal'](_0x250657,_0x73a11e);if(!_0x369394)return undefined;const [_0x25f861,_0xfa3366,_0x431efc,..._0x29b53c]=_0x369394['split'](key_1['WEBSEP']);return[_0x29b53c['join'](key_1['WEBSEP']),_0x325a8e['to'],_0xfa3366,_0x431efc];}else throw new Error('signal-not-found');}async['deleteWebHookSignal'](_0x4be1bb,_0x5db8f0){const _0x47f237=await this['getHookRule'](_0x4be1bb);if(_0x47f237){const _0x4070da={'$self':{'hook':{'data':_0x5db8f0}},'$hook':{'data':_0x5db8f0}},_0x5c519c=_0x47f237['conditions']['match'][0x0]['actual'],_0x4e0510=pipe_1['Pipe']['resolve'](_0x5c519c,_0x4070da);return await this['store']['deleteHookSignal'](_0x4be1bb,_0x4e0510);}else throw new Error('signaler.process:error:\x20hook\x20rule\x20not\x20found');}}exports['TaskService']=TaskService;
|
|
@@ -18,6 +18,7 @@ declare class TelemetryService {
|
|
|
18
18
|
getActivityParentSpanId(leg: number): string | undefined;
|
|
19
19
|
getTraceId(): string | undefined;
|
|
20
20
|
startJobSpan(): TelemetryService;
|
|
21
|
+
static traceActivity(appId: string, attributes: StringScalarType, activityId: string, traceId: string, spanId: string, index?: number): Promise<boolean>;
|
|
21
22
|
startActivitySpan(leg?: number): TelemetryService;
|
|
22
23
|
startStreamSpan(data: StreamData, role: StreamRole): TelemetryService;
|
|
23
24
|
startSpan(traceId: string, spanId: string, spanName: string, attributes: StringScalarType): Span;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x3d95b6,_0x5ae464){const _0x38d8cc=_0x3677,_0x3b7263=_0x3d95b6();while(!![]){try{const _0x3c037c=-parseInt(_0x38d8cc(0x198))/0x1*(parseInt(_0x38d8cc(0x19b))/0x2)+-parseInt(_0x38d8cc(0x199))/0x3+-parseInt(_0x38d8cc(0x19a))/0x4*(parseInt(_0x38d8cc(0x19d))/0x5)+-parseInt(_0x38d8cc(0x19e))/0x6+parseInt(_0x38d8cc(0x196))/0x7*(-parseInt(_0x38d8cc(0x19c))/0x8)+-parseInt(_0x38d8cc(0x195))/0x9+parseInt(_0x38d8cc(0x197))/0xa;if(_0x3c037c===_0x5ae464)break;else _0x3b7263['push'](_0x3b7263['shift']());}catch(_0xde90cf){_0x3b7263['push'](_0x3b7263['shift']());}}}(_0x5039,0x3a1c3));var __importDefault=this&&this['__importDefault']||function(_0x545fc5){return _0x545fc5&&_0x545fc5['__esModule']?_0x545fc5:{'default':_0x545fc5};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['TelemetryService']=void 0x0;function _0x3677(_0x2fef0d,_0x4401a6){const _0x5039fa=_0x5039();return _0x3677=function(_0x367720,_0x4546df){_0x367720=_0x367720-0x195;let _0x5f378d=_0x5039fa[_0x367720];return _0x5f378d;},_0x3677(_0x2fef0d,_0x4401a6);}const package_json_1=__importDefault(require('../../package.json')),mapper_1=require('../mapper'),stream_1=require('../../types/stream'),telemetry_1=require('../../types/telemetry'),utils_1=require('../../modules/utils');class TelemetryService{constructor(_0x244823,_0x34c756,_0x5768aa,_0xcd3a1e){this['leg']=0x1,this['appId']=_0x244823,this['config']=_0x34c756,this['metadata']=_0x5768aa,this['context']=_0xcd3a1e;}['getJobParentSpanId'](){return this['context']['metadata']['spn'];}['getActivityParentSpanId'](_0x29135e){return _0x29135e===0x1?this['context'][this['config']['parent']]['output']?.['metadata']?.['l2s']:this['context']['$self']['output']?.['metadata']?.['l1s'];}['getTraceId'](){return this['context']['metadata']['trc'];}['startJobSpan'](){const _0x18fefb='JOB/'+this['appId']+'/'+this['config']['subscribes']+'/1',_0x41dff2=this['getTraceId'](),_0x52e519=this['getJobParentSpanId'](),_0x37b953=this['getSpanAttrs'](0x1),_0x2220ea=this['startSpan'](_0x41dff2,_0x52e519,_0x18fefb,_0x37b953);return this['jobSpan']=_0x2220ea,this['setTelemetryContext'](_0x2220ea,0x1),this;}static async['traceActivity'](_0x3f97d5,_0x3c58a5,_0xe86143,_0x303d9f,_0x5680cd,_0x34ce54=0x0){const _0x1f7006='TRACE/'+_0x3f97d5+'/'+_0xe86143+'/'+_0x34ce54,_0xb57964=telemetry_1['trace']['getTracer'](package_json_1['default']['name'],package_json_1['default']['version']),_0x35e8dd={'traceId':_0x303d9f,'spanId':_0x5680cd,'isRemote':!![],'traceFlags':0x1},_0x4a74ef=telemetry_1['trace']['setSpanContext'](telemetry_1['context']['active'](),_0x35e8dd),_0xce8656=_0xb57964['startSpan'](_0x1f7006,{'kind':telemetry_1['SpanKind']['CLIENT'],'attributes':_0x3c58a5,'root':!_0x4a74ef},_0x4a74ef);return _0xce8656['end'](),!![];}['startActivitySpan'](_0x243dd1=this['leg']){const _0x204194=this['config']['type']['toUpperCase']()+'/'+this['appId']+'/'+this['metadata']['aid']+'/'+_0x243dd1,_0x1ac4d4=this['getTraceId'](),_0x1214e3=this['getActivityParentSpanId'](_0x243dd1),_0x3bd049=this['getSpanAttrs'](_0x243dd1),_0x37f69e=this['startSpan'](_0x1ac4d4,_0x1214e3,_0x204194,_0x3bd049);return this['setTelemetryContext'](_0x37f69e,_0x243dd1),this['span']=_0x37f69e,this;}['startStreamSpan'](_0x111dfc,_0x5f5a87){let _0x3b84ba;if(_0x5f5a87===stream_1['StreamRole']['SYSTEM'])_0x3b84ba='SYSTEM';else{if(_0x5f5a87===stream_1['StreamRole']['WORKER'])_0x3b84ba='EXECUTE';else _0x111dfc['type']===stream_1['StreamDataType']['RESULT']||_0x111dfc['type']===stream_1['StreamDataType']['RESPONSE']?_0x3b84ba='FANIN':_0x3b84ba='FANOUT';}const _0x338dc5=_0x111dfc['metadata']['topic']?'/'+_0x111dfc['metadata']['topic']:'',_0x74720a=_0x3b84ba+'/'+this['appId']+'/'+_0x111dfc['metadata']['aid']+_0x338dc5,_0x43d69e=this['getStreamSpanAttrs'](_0x111dfc),_0x53dccd=this['startSpan'](_0x111dfc['metadata']['trc'],_0x111dfc['metadata']['spn'],_0x74720a,_0x43d69e);return this['span']=_0x53dccd,this;}['startSpan'](_0x41d1be,_0x18888f,_0x326e64,_0x5ab08e){this['traceId']=_0x41d1be,this['spanId']=_0x18888f;const _0xa64c36=telemetry_1['trace']['getTracer'](package_json_1['default']['name'],package_json_1['default']['version']),_0x11d08e=this['getParentSpanContext'](),_0x400d64=_0xa64c36['startSpan'](_0x326e64,{'kind':telemetry_1['SpanKind']['CLIENT'],'attributes':_0x5ab08e,'root':!_0x11d08e},_0x11d08e);return _0x400d64;}['mapActivityAttributes'](){if(this['config']['telemetry']){const _0x3ae10a=new mapper_1['MapperService'](this['config']['telemetry'],this['context'])['mapRules'](),_0xa8addc={...Object['keys'](_0x3ae10a)['reduce']((_0x563a61,_0x2d4084)=>{return['string','boolean','number']['includes'](typeof _0x3ae10a[_0x2d4084])&&(_0x563a61['app.activity.data.'+_0x2d4084]=_0x3ae10a[_0x2d4084]),_0x563a61;},{})};this['span']?.['setAttributes'](_0xa8addc);}}['setActivityAttributes'](_0x4645e0){this['span']?.['setAttributes'](_0x4645e0);}['setStreamAttributes'](_0x1f4ef8){this['span']?.['setAttributes'](_0x1f4ef8);}['setJobAttributes'](_0x311cfa){this['jobSpan']?.['setAttributes'](_0x311cfa);}['endJobSpan'](){this['endSpan'](this['jobSpan']);}['endActivitySpan'](){this['endSpan'](this['span']);}['endStreamSpan'](){this['endSpan'](this['span']);}['endSpan'](_0x2e8c9b){_0x2e8c9b&&_0x2e8c9b['end']();}['getParentSpanContext'](){if(this['traceId']&&this['spanId']){const _0x2e5c80={'traceId':this['traceId'],'spanId':this['spanId'],'isRemote':!![],'traceFlags':0x1},_0x5a3500=telemetry_1['trace']['setSpanContext'](telemetry_1['context']['active'](),_0x2e5c80);return _0x5a3500;}}['getSpanAttrs'](_0x59e815){return{...Object['keys'](this['context']['metadata'])['reduce']((_0x4e01da,_0x59e4a7)=>{return _0x59e4a7!=='trc'&&(_0x4e01da['app.job.'+_0x59e4a7]=this['context']['metadata'][_0x59e4a7]),_0x4e01da;},{}),...Object['keys'](this['metadata'])['reduce']((_0x19e882,_0x1cdb28)=>{return _0x19e882['app.activity.'+_0x1cdb28]=this['metadata'][_0x1cdb28],_0x19e882;},{}),'app.activity.leg':_0x59e815};}['getStreamSpanAttrs'](_0x3b3a0f){return{...Object['keys'](_0x3b3a0f['metadata'])['reduce']((_0x2b0c16,_0x213d04)=>{return _0x213d04!=='trc'&&_0x213d04!=='spn'&&(_0x2b0c16['app.stream.'+_0x213d04]=_0x3b3a0f['metadata'][_0x213d04]),_0x2b0c16;},{})};}['setTelemetryContext'](_0x5b1d11,_0x31c84e){!this['context']['metadata']['trc']&&(this['context']['metadata']['trc']=_0x5b1d11['spanContext']()['traceId']),_0x31c84e===0x1?(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l1s']=_0x5b1d11['spanContext']()['spanId']):(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l2s']=_0x5b1d11['spanContext']()['spanId']);}['setActivityError'](_0x485629){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0x485629});}['setStreamError'](_0x5dba02){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0x5dba02});}static['addTargetTelemetryPaths'](_0x2b6c68,_0x4bc588,_0x1475ff,_0x15389e){_0x15389e===0x1?(!(_0x4bc588['parent']in _0x2b6c68)&&(_0x2b6c68[_0x4bc588['parent']]=[]),_0x2b6c68[_0x4bc588['parent']]['push'](_0x4bc588['parent']+'/output/metadata/l2s')):(!(_0x1475ff['aid']in _0x2b6c68)&&(_0x2b6c68[_0x1475ff['aid']]=[]),_0x2b6c68[_0x1475ff['aid']]['push'](_0x1475ff['aid']+'/output/metadata/l1s'));}static['bindJobTelemetryToState'](_0x1ced57,_0x572eaa,_0x582817){_0x572eaa['type']==='trigger'&&(_0x1ced57['metadata/trc']=_0x582817['metadata']['trc']);}static['bindActivityTelemetryToState'](_0x38d8fa,_0x2b4d9d,_0xe86551,_0xb5ea67,_0x4344fb){if(_0x2b4d9d['type']==='trigger')_0x38d8fa[_0xe86551['aid']+'/output/metadata/l1s']=_0xb5ea67['$self']['output']['metadata']['l1s'],_0x38d8fa[_0xe86551['aid']+'/output/metadata/l2s']=_0xb5ea67['$self']['output']['metadata']['l2s'];else{if(utils_1['polyfill']['resolveActivityType'](_0x2b4d9d['type'])==='hook'&&_0x4344fb===0x1)_0x38d8fa[_0xe86551['aid']+'/output/metadata/l1s']=_0xb5ea67['$self']['output']['metadata']['l1s'],_0x38d8fa[_0xe86551['aid']+'/output/metadata/l2s']=_0xb5ea67['$self']['output']['metadata']['l1s'];else{if(_0x2b4d9d['type']==='signal'&&_0x4344fb===0x1)_0x38d8fa[_0xe86551['aid']+'/output/metadata/l1s']=_0xb5ea67['$self']['output']['metadata']['l1s'],_0x38d8fa[_0xe86551['aid']+'/output/metadata/l2s']=_0xb5ea67['$self']['output']['metadata']['l1s'];else{const _0xc4b5f5='l'+_0x4344fb+'s';_0x38d8fa[_0xe86551['aid']+'/output/metadata/'+_0xc4b5f5]=_0xb5ea67['$self']['output']['metadata'][_0xc4b5f5];}}}}}exports['TelemetryService']=TelemetryService;function _0x5039(){const _0x4edfc=['463674VqEBis','2401416MeRZGl','2853501PSxpWM','16061070jKcgYx','4567bXMdMJ','1360884LRoTUI','122864IaZfYs','4JjriXZ','8CkIKyX','25xNhorG'];_0x5039=function(){return _0x4edfc;};return _0x5039();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x235510,_0x43f54a){const _0x434d72=_0x3649,_0x1bc2f2=_0x235510();while(!![]){try{const _0x4ac603=parseInt(_0x434d72(0x114))/0x1+-parseInt(_0x434d72(0x118))/0x2+parseInt(_0x434d72(0x11a))/0x3*(-parseInt(_0x434d72(0x113))/0x4)+-parseInt(_0x434d72(0x116))/0x5+parseInt(_0x434d72(0x117))/0x6*(-parseInt(_0x434d72(0x119))/0x7)+-parseInt(_0x434d72(0x11b))/0x8+-parseInt(_0x434d72(0x11c))/0x9*(-parseInt(_0x434d72(0x115))/0xa);if(_0x4ac603===_0x43f54a)break;else _0x1bc2f2['push'](_0x1bc2f2['shift']());}catch(_0x244f32){_0x1bc2f2['push'](_0x1bc2f2['shift']());}}}(_0x5240,0x62f7c));function _0x5240(){const _0x42f3d9=['9WpMBcv','4cNzNex','506160ftbwPd','20026550ZYvuot','3441670NmGtfN','98322skYAlS','1385522luvClU','7atztRH','1053537PBfUuu','2838256yYhvNV'];_0x5240=function(){return _0x42f3d9;};return _0x5240();}function _0x3649(_0x5e7fd3,_0x292ad8){const _0x5240fd=_0x5240();return _0x3649=function(_0x36499e,_0x5e2998){_0x36499e=_0x36499e-0x113;let _0x2a9bb2=_0x5240fd[_0x36499e];return _0x2a9bb2;},_0x3649(_0x5e7fd3,_0x292ad8);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['WorkerService']=void 0x0;const key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),factory_1=require('../connector/factory'),router_1=require('../router'),stream_1=require('../../types/stream'),enums_1=require('../../modules/enums'),factory_2=require('../stream/factory'),factory_3=require('../sub/factory'),factory_4=require('../store/factory');class WorkerService{constructor(){this['reporting']=![];}static async['init'](_0x205587,_0x1f9fec,_0x5a319b,_0x263118,_0x3cbb21){const _0x20c3c8=[];if(Array['isArray'](_0x263118['workers']))for(const _0x15a6cf of _0x263118['workers']){await factory_1['ConnectorService']['initClients'](_0x15a6cf);const _0x3068b7=new WorkerService();_0x3068b7['verifyWorkerFields'](_0x15a6cf),_0x3068b7['namespace']=_0x205587,_0x3068b7['appId']=_0x1f9fec,_0x3068b7['guid']=_0x5a319b,_0x3068b7['callback']=_0x15a6cf['callback'],_0x3068b7['topic']=_0x15a6cf['topic'],_0x3068b7['config']=_0x263118,_0x3068b7['logger']=_0x3cbb21,await _0x3068b7['initStoreChannel'](_0x3068b7,_0x15a6cf['store']),await _0x3068b7['initSubChannel'](_0x3068b7,_0x15a6cf['sub'],_0x15a6cf['pub']??_0x15a6cf['store']),await _0x3068b7['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x3068b7['subscriptionHandler'](),_0x1f9fec),await _0x3068b7['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x3068b7['subscriptionHandler'](),_0x1f9fec,_0x3068b7['topic']),await _0x3068b7['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x3068b7['subscriptionHandler'](),_0x1f9fec,_0x3068b7['guid']),await _0x3068b7['initStreamChannel'](_0x3068b7,_0x15a6cf['stream'],_0x15a6cf['store']),_0x3068b7['router']=await _0x3068b7['initRouter'](_0x15a6cf,_0x3cbb21);const _0x3b6063=_0x3068b7['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x3068b7['appId'],'topic':_0x15a6cf['topic']});await _0x3068b7['router']['consumeMessages'](_0x3b6063,'WORKER',_0x3068b7['guid'],_0x15a6cf['callback']),_0x3068b7['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x20c3c8['push'](_0x3068b7);}return _0x20c3c8;}['verifyWorkerFields'](_0x2690e5){if(!(0x0,utils_1['identifyProvider'])(_0x2690e5['store'])||!(0x0,utils_1['identifyProvider'])(_0x2690e5['stream'])||!(0x0,utils_1['identifyProvider'])(_0x2690e5['sub'])||!(_0x2690e5['topic']&&_0x2690e5['callback']))throw new Error('worker\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields\x20along\x20with\x20a\x20callback\x20function\x20and\x20topic.');}async['initStoreChannel'](_0xe46c22,_0x47f186){_0xe46c22['store']=await factory_4['StoreServiceFactory']['init'](_0x47f186,_0xe46c22['namespace'],_0xe46c22['appId'],_0xe46c22['logger']);}async['initSubChannel'](_0x51a5e8,_0x44dd82,_0x4a48bc){_0x51a5e8['subscribe']=await factory_3['SubServiceFactory']['init'](_0x44dd82,_0x4a48bc,_0x51a5e8['namespace'],_0x51a5e8['appId'],_0x51a5e8['guid'],_0x51a5e8['logger']);}async['initStreamChannel'](_0x62106e,_0x54a8a8,_0x2b0b2d){_0x62106e['stream']=await factory_2['StreamServiceFactory']['init'](_0x54a8a8,_0x2b0b2d,_0x62106e['namespace'],_0x62106e['appId'],_0x62106e['logger']);}async['initRouter'](_0x5c19e1,_0x47e8ec){const _0x230c1f=await this['store']['getThrottleRate'](_0x5c19e1['topic']);return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['WORKER'],'topic':_0x5c19e1['topic'],'reclaimDelay':_0x5c19e1['reclaimDelay'],'reclaimCount':_0x5c19e1['reclaimCount'],'throttle':_0x230c1f},this['stream'],_0x47e8ec);}['subscriptionHandler'](){const _0x2765e4=this;return async(_0xaf659,_0x550066)=>{_0x2765e4['logger']['debug']('worker-event-received',{'topic':_0xaf659,'type':_0x550066['type']});if(_0x550066['type']==='throttle')_0x550066['topic']!==null&&_0x2765e4['throttle'](_0x550066['throttle']);else{if(_0x550066['type']==='ping')_0x2765e4['sayPong'](_0x2765e4['appId'],_0x2765e4['guid'],_0x550066['originator'],_0x550066['details']);else _0x550066['type']==='rollcall'&&(_0x550066['topic']!==null&&_0x2765e4['doRollCall'](_0x550066));}};}async['doRollCall'](_0x374ba7){let _0x4ff9f8=0x0;const _0x2de9a2=!isNaN(_0x374ba7['max'])?_0x374ba7['max']:enums_1['HMSH_QUORUM_ROLLCALL_CYCLES'];if(this['rollCallInterval'])clearTimeout(this['rollCallInterval']);const _0x3404b7=_0x374ba7['interval']/0x2,_0x46efc4=_0x3404b7+Math['ceil'](Math['random']()*_0x3404b7);do{await(0x0,utils_1['sleepFor'])(Math['ceil'](Math['random']()*0x3e8)),await this['sayPong'](this['appId'],this['guid'],null,!![],_0x374ba7['signature']);if(!_0x374ba7['interval'])return;const {promise:_0x1b3ca8,timerId:_0x20631b}=(0x0,utils_1['XSleepFor'])(_0x46efc4*0x3e8);this['rollCallInterval']=_0x20631b,await _0x1b3ca8;}while(this['rollCallInterval']&&_0x4ff9f8++<_0x2de9a2-0x1);}['cancelRollCall'](){this['rollCallInterval']&&(clearTimeout(this['rollCallInterval']),delete this['rollCallInterval']);}['stop'](){this['cancelRollCall']();}async['sayPong'](_0xb14379,_0x27056b,_0x3949e9,_0x2173e9=![],_0x6e9835=![]){let _0xcf649;if(_0x2173e9){const _0x4b7b80={'appId':this['appId'],'topic':this['topic']};_0xcf649={'engine_id':this['guid'],'namespace':this['namespace'],'app_id':this['appId'],'worker_topic':this['topic'],'stream':this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x4b7b80),'counts':this['router']?.['counts'],'timestamp':(0x0,utils_1['formatISODate'])(new Date()),'inited':this['inited'],'throttle':this['router']?.['throttle'],'reclaimDelay':this['router']?.['reclaimDelay'],'reclaimCount':this['router']?.['reclaimCount'],'system':await(0x0,utils_1['getSystemHealth'])(),'signature':_0x6e9835?this['callback']['toString']():undefined};}this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'pong','guid':_0x27056b,'originator':_0x3949e9,'profile':_0xcf649},_0xb14379);}async['throttle'](_0x5ad086){this['router']?.['setThrottle'](_0x5ad086);}}exports['WorkerService']=WorkerService;
|
package/build/types/quorum.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JobOutput } from './job';
|
|
2
|
+
import { StringAnyType } from './serializer';
|
|
2
3
|
interface CPULoad {
|
|
3
4
|
[cpu: string]: string;
|
|
4
5
|
}
|
|
@@ -77,6 +78,11 @@ export interface ActivateMessage extends QuorumMessageBase {
|
|
|
77
78
|
cache_mode: 'nocache' | 'cache';
|
|
78
79
|
until_version: string;
|
|
79
80
|
}
|
|
81
|
+
export interface UserMessage extends QuorumMessageBase {
|
|
82
|
+
type: 'user';
|
|
83
|
+
topic: string;
|
|
84
|
+
message: StringAnyType;
|
|
85
|
+
}
|
|
80
86
|
export interface JobMessage extends QuorumMessageBase {
|
|
81
87
|
type: 'job';
|
|
82
88
|
entity?: string;
|
|
@@ -115,5 +121,5 @@ export type RollCallOptions = {
|
|
|
115
121
|
export type SubscriptionOptions = {
|
|
116
122
|
namespace?: string;
|
|
117
123
|
};
|
|
118
|
-
export type QuorumMessage = PingMessage | PongMessage | ActivateMessage | WorkMessage | JobMessage | ThrottleMessage | RollCallMessage | CronMessage;
|
|
124
|
+
export type QuorumMessage = PingMessage | PongMessage | ActivateMessage | WorkMessage | JobMessage | ThrottleMessage | RollCallMessage | CronMessage | UserMessage;
|
|
119
125
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.24",
|
|
4
4
|
"description": "Serverless Workflow",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test:meshflow:hello": "HMSH_LOGLEVEL=debug HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/meshflow/helloworld/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
35
35
|
"test:meshflow:hook": "NODE_ENV=test jest ./tests/meshflow/hook/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
36
36
|
"test:meshflow:interrupt": "NODE_ENV=test jest ./tests/meshflow/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
37
|
-
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity
|
|
37
|
+
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
38
38
|
"test:meshflow:nested": "NODE_ENV=test jest ./tests/meshflow/nested/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
39
39
|
"test:meshflow:retry": "NODE_ENV=test jest ./tests/meshflow/retry/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
40
40
|
"test:meshflow:sleep": "NODE_ENV=test jest ./tests/meshflow/sleep/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"test:sub:nats": "NODE_ENV=test jest ./tests/functional/sub/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
|
|
72
72
|
"test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
|
|
73
73
|
"test:meshdata": "NODE_ENV=test jest ./tests/meshdata/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
74
|
-
"test:meshos": "NODE_ENV=test HMSH_IS_CLUSTER=true jest ./tests/meshos/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
74
|
+
"test:meshos": "HMSH_LOGLEVEL=debug NODE_ENV=test HMSH_IS_CLUSTER=true jest ./tests/meshos/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
75
75
|
"test:meshcall": "NODE_ENV=test jest ./tests/meshcall/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
76
76
|
"test:unit": "NODE_ENV=test jest ./tests/unit/*/*/index.test.ts --detectOpenHandles --forceExit --verbose"
|
|
77
77
|
},
|
package/types/quorum.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JobOutput } from './job';
|
|
2
|
+
import { StringAnyType } from './serializer';
|
|
2
3
|
|
|
3
4
|
interface CPULoad {
|
|
4
5
|
[cpu: string]: string;
|
|
@@ -96,6 +97,12 @@ export interface ActivateMessage extends QuorumMessageBase {
|
|
|
96
97
|
until_version: string;
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
export interface UserMessage extends QuorumMessageBase {
|
|
101
|
+
type: 'user';
|
|
102
|
+
topic: string;
|
|
103
|
+
message: StringAnyType;
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
export interface JobMessage extends QuorumMessageBase {
|
|
100
107
|
type: 'job';
|
|
101
108
|
entity?: string;
|
|
@@ -156,4 +163,5 @@ export type QuorumMessage =
|
|
|
156
163
|
| JobMessage
|
|
157
164
|
| ThrottleMessage
|
|
158
165
|
| RollCallMessage
|
|
159
|
-
| CronMessage
|
|
166
|
+
| CronMessage
|
|
167
|
+
| UserMessage;
|