@hotmeshio/hotmesh 0.3.9 → 0.3.11
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 +19 -10
- package/build/index.d.ts +2 -1
- package/build/index.js +3 -1
- 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 +21 -17
- 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.d.ts +2 -1
- package/build/services/connector/factory.js +39 -18
- 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.d.ts +1 -1
- package/build/services/connector/providers/postgres.js +18 -9
- 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/meshflow/client.js +1 -1
- package/build/services/meshflow/exporter.js +1 -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.d.ts +3 -0
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.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/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 +155 -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 +72 -0
- package/build/services/stream/providers/postgres/postgres.js +1 -0
- 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/index.d.ts +3 -1
- package/build/types/postgres.d.ts +31 -9
- package/build/types/provider.d.ts +44 -1
- package/index.ts +2 -0
- package/package.json +21 -17
- package/typedoc.json +6 -0
- package/types/hotmesh.ts +15 -0
- package/types/index.ts +54 -0
- package/types/nats.ts +12 -7
- package/types/postgres.ts +41 -10
- package/types/provider.ts +74 -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
- package/build/services/stream/providers/postgres/_deploy.d.ts +0 -5
- package/build/services/stream/providers/postgres/_deploy.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function _0x365b(){const _0x29ccbd=['36kFLSXx','10927037ILxegf','1833952XCRHPW','4006544xIEvOJ','4579365RCaZTu','4364559Vhedwb','20JdeEpK','3PKYCcy','26202JFegqp','3834018XFVdhW','9mSZkLH','10vGxiMD'];_0x365b=function(){return _0x29ccbd;};return _0x365b();}(function(_0x18b518,_0x6b941f){const _0x272466=_0x4771,_0x2e2ff5=_0x18b518();while(!![]){try{const _0x72c2ac=-parseInt(_0x272466(0x100))/0x1*(parseInt(_0x272466(0xfe))/0x2)+parseInt(_0x272466(0xfd))/0x3*(-parseInt(_0x272466(0x104))/0x4)+parseInt(_0x272466(0x101))/0x5*(-parseInt(_0x272466(0xff))/0x6)+-parseInt(_0x272466(0x106))/0x7+-parseInt(_0x272466(0x105))/0x8+parseInt(_0x272466(0x107))/0x9*(parseInt(_0x272466(0x108))/0xa)+-parseInt(_0x272466(0x103))/0xb*(-parseInt(_0x272466(0x102))/0xc);if(_0x72c2ac===_0x6b941f)break;else _0x2e2ff5['push'](_0x2e2ff5['shift']());}catch(_0xc8b588){_0x2e2ff5['push'](_0x2e2ff5['shift']());}}}(_0x365b,0xe5a2b));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');function _0x4771(_0x28b0a4,_0x198dee){const _0x365bb3=_0x365b();return _0x4771=function(_0x477128,_0x482f88){_0x477128=_0x477128-0xfd;let _0x14859a=_0x365bb3[_0x477128];return _0x14859a;},_0x4771(_0x28b0a4,_0x198dee);}class RedisStreamService extends index_1['StreamService']{constructor(_0x18caf0,_0x40cae8,_0x5ede48={}){super(_0x18caf0,_0x40cae8,_0x5ede48);}async['init'](_0x54c34d,_0x3f7a2e,_0x2b4f33){this['namespace']=_0x54c34d,this['logger']=_0x2b4f33,this['appId']=_0x3f7a2e;}['mintKey'](_0x55e1f7,_0x534ca9){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x55e1f7,{..._0x534ca9,'appId':this['appId']});}['transact'](){return this['streamClient']['multi']();}async['createStream'](_0x152581){try{const _0x322872=await this['streamClient']['XADD'](_0x152581,'*',{'field':'value'});return await this['streamClient']['XDEL'](_0x152581,_0x322872),!![];}catch(_0x24b8e6){this['logger']['error']('Error\x20creating\x20stream\x20'+_0x152581,{'error':_0x24b8e6});throw _0x24b8e6;}}async['deleteStream'](_0xd753c8){try{const _0xbd4f2d=await this['streamClient']['DEL'](_0xd753c8);return _0xbd4f2d>0x0;}catch(_0x52e1af){this['logger']['error']('Error\x20deleting\x20stream\x20'+_0xd753c8,{'error':_0x52e1af});throw _0x52e1af;}}async['createConsumerGroup'](_0x52d833,_0x278aeb){try{const _0x82b21f=await this['storeClient']['sendCommand'](['XGROUP','CREATE',_0x52d833,_0x278aeb,'$','MKSTREAM']);return _0x82b21f==='OK';}catch(_0x3e7ef5){const _0x35769d='with\x20MKSTREAM';this['logger']['debug']('x-group-error\x20'+_0x35769d+'\x20for\x20key:\x20'+_0x52d833+'\x20and\x20group:\x20'+_0x278aeb,{..._0x3e7ef5});throw _0x3e7ef5;}}async['deleteConsumerGroup'](_0x3d9efc,_0x175dfc){try{const _0x5f200c=await this['streamClient']['xGroupDestroy'](_0x3d9efc,_0x175dfc);return _0x5f200c;}catch(_0x65163a){this['logger']['error']('Error\x20deleting\x20consumer\x20group\x20'+_0x175dfc+'\x20for\x20stream\x20'+_0x3d9efc,{'error':_0x65163a});throw _0x65163a;}}async['publishMessages'](_0x81df4,_0x3d0269,_0x122140){try{const _0x581151=_0x122140?.['transaction']||_0x3d0269['length']>0x1&&this['storeClient']['multi']();let _0x459ccb;for(const _0x39cd26 of _0x3d0269){_0x459ccb=await(_0x581151||this['storeClient'])['XADD'](_0x81df4,'*',{'message':_0x39cd26});}return _0x581151&&!_0x122140?.['transaction']?(await _0x581151['exec']())['map'](_0x46b67e=>_0x46b67e[0x1]):[_0x459ccb];}catch(_0x241374){this['logger']['error']('ioredis-xadd-error\x20key:\x20'+_0x81df4,{..._0x241374});throw _0x241374;}}async['consumeMessages'](_0x1823f5,_0x3b49c2,_0x451837,_0x2a219f){const _0x2209ee='GROUP',_0x17c240='BLOCK',_0x189a91='STREAMS',_0xadf773='>';try{const _0x4e7139=await this['streamClient']['sendCommand'](['XREADGROUP',_0x2209ee,_0x3b49c2,_0x451837,_0x17c240,_0x2a219f?.['blockTimeout']?.['toString']()??enums_1['HMSH_BLOCK_TIME_MS']['toString'](),_0x189a91,_0x1823f5,_0xadf773]),_0x5d8001=[];if((0x0,utils_1['isStreamMessage'])(_0x4e7139)){const [[,_0xd1209f]]=_0x4e7139;for(const [_0x544c7c,_0xc8b899]of _0xd1209f){_0x5d8001['push']({'id':_0x544c7c,'data':(0x0,utils_1['parseStreamMessage'])(_0xc8b899[0x1])});}}else return[];return _0x5d8001;}catch(_0x48d5ed){this['logger']['error']('Error\x20consuming\x20messages\x20from\x20'+_0x1823f5,{'error':_0x48d5ed});throw _0x48d5ed;}}async['ackAndDelete'](_0x39396b,_0x2017f3,_0x18a42e){const _0x3c58c6=this['storeClient']['multi']();return await this['acknowledgeMessages'](_0x39396b,_0x2017f3,_0x18a42e,{'multi':_0x3c58c6}),await this['deleteMessages'](_0x39396b,_0x2017f3,_0x18a42e,{'multi':_0x3c58c6}),await _0x3c58c6['exec'](),_0x18a42e['length'];}async['acknowledgeMessages'](_0x11216a,_0x2672f0,_0x245d5c,_0x48480c){try{return _0x48480c?.['multi']?(_0x48480c['multi']['XACK'](_0x11216a,_0x2672f0,_0x245d5c),_0x48480c['multi']):await this['streamClient']['XACK'](_0x11216a,_0x2672f0,..._0x245d5c);}catch(_0x1c46a3){this['logger']['error']('Error\x20in\x20acknowledging\x20messages\x20in\x20group:\x20'+_0x2672f0+'\x20for\x20key:\x20'+_0x11216a,{'error':_0x1c46a3});throw _0x1c46a3;}}async['deleteMessages'](_0x2aeddf,_0x23df23,_0x4bb447,_0x14364d){try{return _0x14364d?.['multi']?(_0x14364d['multi']['xDel'](_0x2aeddf,_0x4bb447),_0x14364d['multi']):await this['streamClient']['XDEL'](_0x2aeddf,..._0x4bb447);}catch(_0x5eddb5){this['logger']['error']('Error\x20in\x20deleting\x20messages\x20with\x20ids:\x20'+_0x4bb447['join'](',')+'\x20for\x20key:\x20'+_0x2aeddf,{'error':_0x5eddb5});throw _0x5eddb5;}}async['getPendingMessages'](_0x44a6b5,_0x316252,_0x342506,_0x1adccb){try{const _0x268edb='-',_0x4a0acd='+',_0x2d04fe=[_0x44a6b5,_0x316252];if(_0x268edb)_0x2d04fe['push'](_0x268edb);if(_0x4a0acd)_0x2d04fe['push'](_0x4a0acd);if(_0x342506!==undefined)_0x2d04fe['push'](_0x342506['toString']());if(_0x1adccb)_0x2d04fe['push'](_0x1adccb);try{return await this['streamClient']['sendCommand'](['XPENDING',..._0x2d04fe]);}catch(_0x2dde68){this['logger']['error']('error,\x20args',{..._0x2dde68},_0x2d04fe);}}catch(_0x3642f2){this['logger']['error']('Error\x20retrieving\x20pending\x20messages\x20for\x20group:\x20'+_0x316252+'\x20in\x20key:\x20'+_0x44a6b5,{..._0x3642f2});throw _0x3642f2;}}async['retryMessages'](_0x528077,_0x1a29b9,_0x4db77d){let _0xa3e049=[];const _0x2ea28b=await this['getPendingMessages'](_0x528077,_0x1a29b9,_0x4db77d?.['limit']);for(const _0x58b2ce of _0x2ea28b){if(Array['isArray'](_0x58b2ce)){const [_0x44339b,,_0x146f1f,_0x308632]=_0x58b2ce;if(_0x146f1f>_0x4db77d?.['minIdleTime']){const _0x1348c6=await this['claimMessage'](_0x528077,_0x1a29b9,_0x4db77d?.['consumerName'],_0x4db77d?.['minIdleTime'],_0x44339b);_0xa3e049=_0xa3e049['concat'](_0x1348c6);}}}return _0xa3e049;}async['claimMessage'](_0x519e45,_0x492cff,_0x39d6e6,_0xd175d9,_0x341220,..._0x5dea8f){try{const _0x43bbc5=await this['streamClient']['sendCommand'](['XCLAIM',_0x519e45,_0x492cff,_0x39d6e6,_0xd175d9['toString'](),_0x341220,..._0x5dea8f]);return{'id':_0x43bbc5[0x0][0x0],'data':(0x0,utils_1['parseStreamMessage'])(_0x43bbc5[0x0][0x1][0x1])};}catch(_0x520350){this['logger']['error']('Error\x20in\x20claiming\x20message\x20with\x20id:\x20'+_0x341220+'\x20in\x20group:\x20'+_0x492cff+'\x20for\x20key:\x20'+_0x519e45,{..._0x520350});throw _0x520350;}}async['getStreamStats'](_0xd09534){return{'messageCount':await this['getStreamDepth'](_0xd09534)};}async['getStreamDepth'](_0x1f6515,_0x4d199e){try{if(_0x4d199e?.['multi'])return _0x4d199e['multi']['XLEN'](_0x1f6515),0x0;const _0x2da3af=await this['streamClient']['XLEN'](_0x1f6515);return _0x2da3af;}catch(_0x57f17b){this['logger']['error']('Error\x20getting\x20depth\x20for\x20'+_0x1f6515,{'error':_0x57f17b});throw _0x57f17b;}}async['getStreamDepths'](_0x536109){const _0x3d9b96=this['storeClient']['multi'](),_0x873e5a=new Map();_0x536109['forEach'](_0x2481cf=>{!_0x873e5a['has'](_0x2481cf['stream'])&&(_0x873e5a['set'](_0x2481cf['stream'],-0x1),this['getStreamDepth'](_0x2481cf['stream'],{'multi':_0x3d9b96}));});const _0x13d34d=await _0x3d9b96['exec']();return Array['from'](_0x873e5a['keys']())['forEach']((_0x2b5b29,_0x2b2679)=>{_0x873e5a['set'](_0x2b5b29,_0x13d34d[_0x2b2679]);}),_0x536109['map'](_0x3940ae=>{return{'stream':_0x3940ae['stream'],'depth':_0x873e5a['get'](_0x3940ae['stream'])||0x0};});}async['trimStream'](_0x3f5cdf,_0x5f07c6){return 0x0;}['getProviderSpecificFeatures'](){return{'supportsBatching':!![],'supportsDeadLetterQueue':![],'supportsOrdering':!![],'supportsTrimming':!![],'supportsRetry':!![],'maxMessageSize':0x200*0x400*0x400,'maxBatchSize':0x3e8};}}exports['RedisStreamService']=RedisStreamService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';(function(_0xbe136e,_0x5ae29a){var _0x32fe61=_0x10d9,_0x6a0aa=_0xbe136e();while(!![]){try{var _0x16a12e=-parseInt(_0x32fe61(0x1a1))/0x1+-parseInt(_0x32fe61(0x19d))/0x2*(parseInt(_0x32fe61(0x199))/0x3)+parseInt(_0x32fe61(0x19e))/0x4*(parseInt(_0x32fe61(0x19f))/0x5)+parseInt(_0x32fe61(0x1a2))/0x6+parseInt(_0x32fe61(0x19c))/0x7*(-parseInt(_0x32fe61(0x1a0))/0x8)+-parseInt(_0x32fe61(0x19a))/0x9+parseInt(_0x32fe61(0x19b))/0xa;if(_0x16a12e===_0x5ae29a)break;else _0x6a0aa['push'](_0x6a0aa['shift']());}catch(_0x5e8f4d){_0x6a0aa['push'](_0x6a0aa['shift']());}}}(_0x43c8,0x3f540));function _0x43c8(){var _0x2be62a=['15648440ErxSDv','63yJFCtN','4NdbBTN','4Uajbee','540805gRtTQo','394136CXgLkm','113930GQYZUm','229452gSmIfM','652011auASeL','4138632tdVXkT'];_0x43c8=function(){return _0x2be62a;};return _0x43c8();}function _0x10d9(_0x333b03,_0x29449d){var _0x43c8e2=_0x43c8();return _0x10d9=function(_0x10d92f,_0x595047){_0x10d92f=_0x10d92f-0x199;var _0x198e25=_0x43c8e2[_0x10d92f];return _0x198e25;},_0x10d9(_0x333b03,_0x29449d);}Object['defineProperty'](exports,'__esModule',{'value':!![]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x413d6f,_0x15bd55){const _0x1a6b8e=_0x2b27,_0x299215=_0x413d6f();while(!![]){try{const _0x483f1a=parseInt(_0x1a6b8e(0x86))/0x1+parseInt(_0x1a6b8e(0x89))/0x2*(parseInt(_0x1a6b8e(0x87))/0x3)+-parseInt(_0x1a6b8e(0x88))/0x4*(-parseInt(_0x1a6b8e(0x8d))/0x5)+parseInt(_0x1a6b8e(0x85))/0x6*(parseInt(_0x1a6b8e(0x8b))/0x7)+-parseInt(_0x1a6b8e(0x84))/0x8*(parseInt(_0x1a6b8e(0x8a))/0x9)+parseInt(_0x1a6b8e(0x83))/0xa+-parseInt(_0x1a6b8e(0x8c))/0xb;if(_0x483f1a===_0x15bd55)break;else _0x299215['push'](_0x299215['shift']());}catch(_0x5b236e){_0x299215['push'](_0x299215['shift']());}}}(_0x2a35,0xedb81));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['IORedisSubService']=void 0x0;function _0x2a35(){const _0x3ff419=['12983140jIvEuR','2344XbWVhG','1446fImOCK','541753Rbrteh','15kXXmDG','62888Ihpjkv','695406YQpVVm','3636AsscfD','35469EhUWmq','53581968UuWDOb','370qAEKal'];_0x2a35=function(){return _0x3ff419;};return _0x2a35();}function _0x2b27(_0x99c21,_0x5a42e6){const _0x2a359e=_0x2a35();return _0x2b27=function(_0x2b2788,_0x94aa5f){_0x2b2788=_0x2b2788-0x83;let _0xed133f=_0x2a359e[_0x2b2788];return _0xed133f;},_0x2b27(_0x99c21,_0x5a42e6);}const key_1=require('../../../../modules/key'),index_1=require('../../index');class IORedisSubService extends index_1['SubService']{constructor(_0x5cf1eb,_0x84d129){super(_0x5cf1eb,_0x84d129);}async['init'](_0x59e952=key_1['HMNS'],_0x3e8ead,_0x5d2592,_0x2dde43){this['namespace']=_0x59e952,this['logger']=_0x2dde43,this['appId']=_0x3e8ead;}['transact'](){return this['eventClient']['multi']();}['mintKey'](_0x574c15,_0xeb0a00){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x574c15,_0xeb0a00);}async['subscribe'](_0x38fa19,_0xc13db1,_0x418b0d,_0x397ff4){const _0x1a2a29=this,_0x5305db=this['mintKey'](_0x38fa19,{'appId':_0x418b0d,'engineId':_0x397ff4});await this['eventClient']['subscribe'](_0x5305db,_0x483f3f=>{_0x483f3f&&_0x1a2a29['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x5305db,_0x483f3f);}),this['eventClient']['on']('message',(_0x1b427b,_0x2fe131)=>{if(_0x1b427b===_0x5305db)try{const _0x508711=JSON['parse'](_0x2fe131);_0xc13db1(_0x5305db,_0x508711);}catch(_0x22db01){_0x1a2a29['logger']['error']('Error\x20parsing\x20message:\x20'+_0x2fe131,_0x22db01);}});}async['unsubscribe'](_0x201ac3,_0x5b1d65,_0x1e1e0c){const _0x1d527e=this['mintKey'](_0x201ac3,{'appId':_0x5b1d65,'engineId':_0x1e1e0c});await this['eventClient']['unsubscribe'](_0x1d527e);}async['psubscribe'](_0x578e75,_0x188b88,_0x137edd,_0x36d24a){const _0x1e74a0=this,_0x31866d=this['mintKey'](_0x578e75,{'appId':_0x137edd,'engineId':_0x36d24a});await this['eventClient']['psubscribe'](_0x31866d,_0x5db761=>{_0x5db761&&_0x1e74a0['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x31866d,_0x5db761);}),this['eventClient']['on']('pmessage',(_0x2feed4,_0x27b2d9,_0x56844f)=>{if(_0x2feed4===_0x31866d)try{const _0x17ffa0=JSON['parse'](_0x56844f);_0x188b88(_0x27b2d9,_0x17ffa0);}catch(_0x3c5081){_0x1e74a0['logger']['error']('Error\x20parsing\x20message:\x20'+_0x56844f,_0x3c5081);}});}async['punsubscribe'](_0x768221,_0x4edbbd,_0x5a676a){const _0x594fca=this['mintKey'](_0x768221,{'appId':_0x4edbbd,'engineId':_0x5a676a});await this['eventClient']['punsubscribe'](_0x594fca);}async['publish'](_0x199314,_0x4cd4c8,_0x25d25c,_0x35f08f){const _0x42025b=this['mintKey'](_0x199314,{'appId':_0x25d25c,'engineId':_0x35f08f}),_0x1ec3d6=await this['storeClient']['publish'](_0x42025b,JSON['stringify'](_0x4cd4c8));return _0x1ec3d6===0x1;}}exports['IORedisSubService']=IORedisSubService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x2af473,_0x22088f){const _0x1cc636=_0x218e,_0xee265b=_0x2af473();while(!![]){try{const _0x25fa69=-parseInt(_0x1cc636(0x99))/0x1+parseInt(_0x1cc636(0xa0))/0x2+-parseInt(_0x1cc636(0x9f))/0x3+-parseInt(_0x1cc636(0x9e))/0x4+-parseInt(_0x1cc636(0x9d))/0x5*(-parseInt(_0x1cc636(0x9b))/0x6)+-parseInt(_0x1cc636(0x9c))/0x7+parseInt(_0x1cc636(0x9a))/0x8;if(_0x25fa69===_0x22088f)break;else _0xee265b['push'](_0xee265b['shift']());}catch(_0x465791){_0xee265b['push'](_0xee265b['shift']());}}}(_0x3bcc,0x40d72));function _0x218e(_0x31aeae,_0x474680){const _0x3bcc67=_0x3bcc();return _0x218e=function(_0x218e05,_0xbfd892){_0x218e05=_0x218e05-0x99;let _0x4e7a0b=_0x3bcc67[_0x218e05];return _0x4e7a0b;},_0x218e(_0x31aeae,_0x474680);}function _0x3bcc(){const _0x7b4e3f=['12630sWkwwj','3301830RyBYev','535ClFNfw','1417560ArXsYH','990141KnTuUR','637658jjPsjv','319519onfKbB','9577344MlgmBX'];_0x3bcc=function(){return _0x7b4e3f;};return _0x3bcc();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['RedisSubService']=void 0x0;const key_1=require('../../../../modules/key'),index_1=require('../../index');class RedisSubService extends index_1['SubService']{constructor(_0x59ffba,_0x5860e3){super(_0x59ffba,_0x5860e3);}async['init'](_0x40318a=key_1['HMNS'],_0x4a9c50,_0x593b51,_0x1b9508){this['namespace']=_0x40318a,this['logger']=_0x1b9508,this['appId']=_0x4a9c50;}['transact'](){const _0x13e33b=this['eventClient']['multi']();return _0x13e33b;}['mintKey'](_0x1be99b,_0x5bfe2d){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x1be99b,_0x5bfe2d);}async['subscribe'](_0x5f3ca6,_0x596372,_0x584153,_0xa5aece){if(this['eventClient']){const _0xd6ecac=this,_0x23c888=this['mintKey'](_0x5f3ca6,{'appId':_0x584153,'engineId':_0xa5aece});await this['eventClient']['subscribe'](_0x23c888,_0x36606a=>{try{const _0x42ed49=JSON['parse'](_0x36606a);_0x596372(_0x23c888,_0x42ed49);}catch(_0x5821ae){_0xd6ecac['logger']['error']('Error\x20parsing\x20message:\x20'+_0x36606a,_0x5821ae);}});}}async['unsubscribe'](_0x1d937c,_0xaf2d8b,_0x162677){const _0x530b2d=this['mintKey'](_0x1d937c,{'appId':_0xaf2d8b,'engineId':_0x162677});await this['eventClient']['unsubscribe'](_0x530b2d);}async['psubscribe'](_0x3b3d58,_0x3fb13d,_0x1b2d8f,_0xa8453d){if(this['eventClient']){const _0x35e635=this,_0x37db69=this['mintKey'](_0x3b3d58,{'appId':_0x1b2d8f,'engineId':_0xa8453d});await this['eventClient']['pSubscribe'](_0x37db69,(_0x2121f7,_0x393376)=>{try{const _0x24f56e=JSON['parse'](_0x2121f7);_0x3fb13d(_0x393376,_0x24f56e);}catch(_0x1886c7){_0x35e635['logger']['error']('Error\x20parsing\x20message:\x20'+_0x2121f7,_0x1886c7);}});}}async['punsubscribe'](_0x52ce7e,_0x5e4c6a,_0x4858a0){const _0x437b93=this['mintKey'](_0x52ce7e,{'appId':_0x5e4c6a,'engineId':_0x4858a0});await this['eventClient']['pUnsubscribe'](_0x437b93);}async['publish'](_0x31085c,_0x482c82,_0x7c85bb,_0x10ab10){const _0x1f1b2b=this['mintKey'](_0x31085c,{'appId':_0x7c85bb,'engineId':_0x10ab10}),_0x321292=await this['storeClient']['publish'](_0x1f1b2b,JSON['stringify'](_0x482c82));return _0x321292>0x0;}}exports['RedisSubService']=RedisSubService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x326b12,_0x42d709){const _0x56f883=_0x29ec,_0x5b1002=_0x326b12();while(!![]){try{const _0x5c206f=-parseInt(_0x56f883(0x1bd))/0x1+-parseInt(_0x56f883(0x1ba))/0x2*(-parseInt(_0x56f883(0x1bc))/0x3)+-parseInt(_0x56f883(0x1c0))/0x4+-parseInt(_0x56f883(0x1bb))/0x5+parseInt(_0x56f883(0x1c1))/0x6+parseInt(_0x56f883(0x1c2))/0x7*(parseInt(_0x56f883(0x1bf))/0x8)+-parseInt(_0x56f883(0x1be))/0x9;if(_0x5c206f===_0x42d709)break;else _0x5b1002['push'](_0x5b1002['shift']());}catch(_0x34871c){_0x5b1002['push'](_0x5b1002['shift']());}}}(_0x10d3,0xc33b1));function _0x29ec(_0x485b11,_0x1bca05){const _0x10d373=_0x10d3();return _0x29ec=function(_0x29ecf3,_0x3b426e){_0x29ecf3=_0x29ecf3-0x1ba;let _0x1091ff=_0x10d373[_0x29ecf3];return _0x1091ff;},_0x29ec(_0x485b11,_0x1bca05);}function _0x10d3(){const _0xdb83e7=['234231mSgKFH','18301923YdeblV','40QhNXaJ','1425444EWmxkv','9015534laAaBw','1560419OctaSE','2326ycNFnv','3264675QjUnBt','3765HAmTMP'];_0x10d3=function(){return _0xdb83e7;};return _0x10d3();}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(_0x1c8fe1,_0x4f5b6a){this['cleanupTimeout']=null,this['isScout']=![],this['errorCount']=0x0,this['logger']=_0x4f5b6a,this['store']=_0x1c8fe1;}async['processWebHooks'](_0x5dd6ac){const _0xa75f5=await this['store']['getActiveTaskQueue']();if(_0xa75f5){const [_0x13be1a,_0x4e35a5,_0x312f8f,..._0x4a0951]=_0xa75f5['split'](key_1['WEBSEP']),_0x4ac447=JSON['parse'](_0x4a0951['join'](key_1['WEBSEP'])),_0xab1854=_0x4e35a5+':processed',_0xfe3ae3=await this['store']['processTaskQueue'](_0x4e35a5,_0xab1854);_0xfe3ae3?await _0x5dd6ac(_0x13be1a,{..._0x4ac447,'id':_0xfe3ae3}):await this['store']['deleteProcessedTaskQueue'](_0xa75f5,_0x4e35a5,_0xab1854,_0x312f8f==='true'),setImmediate(()=>this['processWebHooks'](_0x5dd6ac));}}async['enqueueWorkItems'](_0x2e3d83){await this['store']['addTaskQueues'](_0x2e3d83);}async['registerJobForCleanup'](_0xecbf5a,_0x63051e=enums_1['HMSH_EXPIRE_DURATION'],_0x3b0bf8){_0x63051e>0x0&&await this['store']['expireJob'](_0xecbf5a,_0x63051e);}async['registerTimeHook'](_0x3456d9,_0x245d54,_0x2a6d30,_0xf545eb,_0x313f53=enums_1['HMSH_FIDELITY_SECONDS'],_0x42d72d,_0xae004b){const _0x49f671=Date['now']()+_0x313f53*0x3e8,_0x4047e2=enums_1['HMSH_FIDELITY_SECONDS']*0x3e8,_0x5b7fcc=Math['floor'](_0x49f671/_0x4047e2)*_0x4047e2;await this['store']['registerTimeHook'](_0x3456d9,_0x245d54,_0x2a6d30,_0xf545eb,_0x5b7fcc,_0x42d72d,_0xae004b);}async['shouldScout'](){const _0x346f72=this['isScout'],_0x2a38fa=_0x346f72||(this['isScout']=await this['store']['reserveScoutRole']('time'));if(_0x2a38fa)return!_0x346f72&&setTimeout(()=>{this['isScout']=![];},enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8),!![];return![];}async['processTimeHooks'](_0x4fa6b3,_0x58be49){if(await this['shouldScout']())try{const _0x2c9554=await this['store']['getNextTask'](_0x58be49);if(Array['isArray'](_0x2c9554)){const [_0x34d52f,_0x59ed05,_0xf94779,_0x267e92,_0x56143e]=_0x2c9554;if(_0x56143e==='child'){}else{if(_0x56143e==='delist'){const _0x2d5ecd=this['store']['mintKey'](hotmesh_1['KeyType']['SIGNALS'],{'appId':this['store']['appId']});await this['store']['delistSignalKey'](_0x2d5ecd,_0x59ed05);}else await _0x4fa6b3(_0x59ed05,_0xf94779,_0x267e92,_0x56143e);}await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x4fa6b3,_0x34d52f);}else{if(_0x2c9554)await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x4fa6b3);else{const _0x1646fc=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_FIDELITY_SECONDS']*0x3e8);this['cleanupTimeout']=_0x1646fc['timerId'],await _0x1646fc['promise'],this['errorCount']=0x0,this['processTimeHooks'](_0x4fa6b3);}}}catch(_0x3611fe){this['logger']['warn']('task-process-timehooks-error',_0x3611fe),await(0x0,utils_1['sleepFor'])(0x3e8*this['errorCount']++),this['errorCount']<0x5&&this['processTimeHooks'](_0x4fa6b3);}else{const _0x48008f=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8*0x2*Math['random']());this['cleanupTimeout']=_0x48008f['timerId'],await _0x48008f['promise'],this['processTimeHooks'](_0x4fa6b3);}}['cancelCleanup'](){this['cleanupTimeout']!==undefined&&(clearTimeout(this['cleanupTimeout']),this['cleanupTimeout']=undefined);}async['getHookRule'](_0x7d3b0b){const _0x5dbc58=await this['store']['getHookRules']();return _0x5dbc58?.[_0x7d3b0b]?.[0x0];}async['registerWebHook'](_0xb1f8a5,_0x31c777,_0x2fd451,_0x1191d9,_0x1954e7){const _0x4cd9ef=await this['getHookRule'](_0xb1f8a5);if(_0x4cd9ef){const _0x280abf=_0x4cd9ef['conditions']['match'][0x0]['expected'],_0x41e3a4=pipe_1['Pipe']['resolve'](_0x280abf,_0x31c777),_0x2b0cdc=_0x31c777['metadata']['jid'],_0x363008=_0x31c777['metadata']['gid'],_0x36e533=_0x4cd9ef['to'],_0x3cdcde=[_0x36e533,_0x2fd451,_0x363008,_0x2b0cdc]['join'](key_1['WEBSEP']),_0x54fb2e={'topic':_0xb1f8a5,'resolved':_0x41e3a4,'jobId':_0x3cdcde,'expire':_0x1191d9};return await this['store']['setHookSignal'](_0x54fb2e,_0x1954e7),_0x2b0cdc;}else throw new Error('signaler.registerWebHook:error:\x20hook\x20rule\x20not\x20found');}async['processWebHookSignal'](_0x428aa9,_0x1a22d9){const _0x247ca2=await this['getHookRule'](_0x428aa9);if(_0x247ca2){const _0x55185e={'$self':{'hook':{'data':_0x1a22d9}},'$hook':{'data':_0x1a22d9}},_0x576dd5=_0x247ca2['conditions']['match'][0x0]['actual'],_0x580ba9=pipe_1['Pipe']['resolve'](_0x576dd5,_0x55185e),_0x41f959=await this['store']['getHookSignal'](_0x428aa9,_0x580ba9);if(!_0x41f959)return undefined;const [_0x108900,_0x2c7ce8,_0x1dd7d7,..._0x3d225e]=_0x41f959['split'](key_1['WEBSEP']);return[_0x3d225e['join'](key_1['WEBSEP']),_0x247ca2['to'],_0x2c7ce8,_0x1dd7d7];}else throw new Error('signal-not-found');}async['deleteWebHookSignal'](_0x209707,_0x5bb413){const _0x433296=await this['getHookRule'](_0x209707);if(_0x433296){const _0x14a2c8={'$self':{'hook':{'data':_0x5bb413}},'$hook':{'data':_0x5bb413}},_0x340da9=_0x433296['conditions']['match'][0x0]['actual'],_0x4cd415=pipe_1['Pipe']['resolve'](_0x340da9,_0x14a2c8);return await this['store']['deleteHookSignal'](_0x209707,_0x4cd415);}else throw new Error('signaler.process:error:\x20hook\x20rule\x20not\x20found');}}exports['TaskService']=TaskService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0x51cc(_0x2bacfe,_0x74d876){const _0x25ec6d=_0x25ec();return _0x51cc=function(_0x51cc17,_0x5bdd01){_0x51cc17=_0x51cc17-0x14e;let _0x3c560e=_0x25ec6d[_0x51cc17];return _0x3c560e;},_0x51cc(_0x2bacfe,_0x74d876);}(function(_0x3c2f37,_0x28f26a){const _0x54df94=_0x51cc,_0x2c34a0=_0x3c2f37();while(!![]){try{const _0x93cfb=-parseInt(_0x54df94(0x151))/0x1+-parseInt(_0x54df94(0x154))/0x2+parseInt(_0x54df94(0x153))/0x3*(parseInt(_0x54df94(0x156))/0x4)+-parseInt(_0x54df94(0x14e))/0x5+parseInt(_0x54df94(0x155))/0x6*(parseInt(_0x54df94(0x14f))/0x7)+parseInt(_0x54df94(0x150))/0x8+parseInt(_0x54df94(0x152))/0x9;if(_0x93cfb===_0x28f26a)break;else _0x2c34a0['push'](_0x2c34a0['shift']());}catch(_0x37ac11){_0x2c34a0['push'](_0x2c34a0['shift']());}}}(_0x25ec,0x568a6));var __importDefault=this&&this['__importDefault']||function(_0x2b7b0e){return _0x2b7b0e&&_0x2b7b0e['__esModule']?_0x2b7b0e:{'default':_0x2b7b0e};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['TelemetryService']=void 0x0;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(_0x98ef66,_0x4567e3,_0x1731d6,_0x3b9dd6){this['leg']=0x1,this['appId']=_0x98ef66,this['config']=_0x4567e3,this['metadata']=_0x1731d6,this['context']=_0x3b9dd6;}['getJobParentSpanId'](){return this['context']['metadata']['spn'];}['getActivityParentSpanId'](_0x708d40){return _0x708d40===0x1?this['context'][this['config']['parent']]['output']?.['metadata']?.['l2s']:this['context']['$self']['output']?.['metadata']?.['l1s'];}['getTraceId'](){return this['context']['metadata']['trc'];}['startJobSpan'](){const _0x5d9dd9='JOB/'+this['appId']+'/'+this['config']['subscribes']+'/1',_0x2035b5=this['getTraceId'](),_0x5afba2=this['getJobParentSpanId'](),_0x5bc292=this['getSpanAttrs'](0x1),_0xa72703=this['startSpan'](_0x2035b5,_0x5afba2,_0x5d9dd9,_0x5bc292);return this['jobSpan']=_0xa72703,this['setTelemetryContext'](_0xa72703,0x1),this;}['startActivitySpan'](_0x4d83fe=this['leg']){const _0x2281c1=this['config']['type']['toUpperCase']()+'/'+this['appId']+'/'+this['metadata']['aid']+'/'+_0x4d83fe,_0x48d711=this['getTraceId'](),_0x5166ce=this['getActivityParentSpanId'](_0x4d83fe),_0x40f39f=this['getSpanAttrs'](_0x4d83fe),_0x331126=this['startSpan'](_0x48d711,_0x5166ce,_0x2281c1,_0x40f39f);return this['setTelemetryContext'](_0x331126,_0x4d83fe),this['span']=_0x331126,this;}['startStreamSpan'](_0x2766d8,_0x96cfab){let _0x298162;if(_0x96cfab===stream_1['StreamRole']['SYSTEM'])_0x298162='SYSTEM';else{if(_0x96cfab===stream_1['StreamRole']['WORKER'])_0x298162='EXECUTE';else _0x2766d8['type']===stream_1['StreamDataType']['RESULT']||_0x2766d8['type']===stream_1['StreamDataType']['RESPONSE']?_0x298162='FANIN':_0x298162='FANOUT';}const _0x11279f=_0x2766d8['metadata']['topic']?'/'+_0x2766d8['metadata']['topic']:'',_0x199dee=_0x298162+'/'+this['appId']+'/'+_0x2766d8['metadata']['aid']+_0x11279f,_0x1d4a28=this['getStreamSpanAttrs'](_0x2766d8),_0x247655=this['startSpan'](_0x2766d8['metadata']['trc'],_0x2766d8['metadata']['spn'],_0x199dee,_0x1d4a28);return this['span']=_0x247655,this;}['startSpan'](_0x5e1a74,_0x2fbffb,_0x3faaf1,_0x5672a6){this['traceId']=_0x5e1a74,this['spanId']=_0x2fbffb;const _0x387ebc=telemetry_1['trace']['getTracer'](package_json_1['default']['name'],package_json_1['default']['version']),_0x4da936=this['getParentSpanContext'](),_0x55cb2b=_0x387ebc['startSpan'](_0x3faaf1,{'kind':telemetry_1['SpanKind']['CLIENT'],'attributes':_0x5672a6,'root':!_0x4da936},_0x4da936);return _0x55cb2b;}['mapActivityAttributes'](){if(this['config']['telemetry']){const _0x2d1d7b=new mapper_1['MapperService'](this['config']['telemetry'],this['context'])['mapRules'](),_0xba1181={...Object['keys'](_0x2d1d7b)['reduce']((_0x317187,_0x2de9ad)=>{return['string','boolean','number']['includes'](typeof _0x2d1d7b[_0x2de9ad])&&(_0x317187['app.activity.data.'+_0x2de9ad]=_0x2d1d7b[_0x2de9ad]),_0x317187;},{})};this['span']?.['setAttributes'](_0xba1181);}}['setActivityAttributes'](_0x27ac44){this['span']?.['setAttributes'](_0x27ac44);}['setStreamAttributes'](_0x4f8819){this['span']?.['setAttributes'](_0x4f8819);}['setJobAttributes'](_0x55e774){this['jobSpan']?.['setAttributes'](_0x55e774);}['endJobSpan'](){this['endSpan'](this['jobSpan']);}['endActivitySpan'](){this['endSpan'](this['span']);}['endStreamSpan'](){this['endSpan'](this['span']);}['endSpan'](_0x9a653d){_0x9a653d&&_0x9a653d['end']();}['getParentSpanContext'](){if(this['traceId']&&this['spanId']){const _0x191191={'traceId':this['traceId'],'spanId':this['spanId'],'isRemote':!![],'traceFlags':0x1},_0x2acfe8=telemetry_1['trace']['setSpanContext'](telemetry_1['context']['active'](),_0x191191);return _0x2acfe8;}}['getSpanAttrs'](_0x3c633d){return{...Object['keys'](this['context']['metadata'])['reduce']((_0x2113f6,_0x2ed8c9)=>{return _0x2ed8c9!=='trc'&&(_0x2113f6['app.job.'+_0x2ed8c9]=this['context']['metadata'][_0x2ed8c9]),_0x2113f6;},{}),...Object['keys'](this['metadata'])['reduce']((_0x12a493,_0x34952b)=>{return _0x12a493['app.activity.'+_0x34952b]=this['metadata'][_0x34952b],_0x12a493;},{}),'app.activity.leg':_0x3c633d};}['getStreamSpanAttrs'](_0x20ef68){return{...Object['keys'](_0x20ef68['metadata'])['reduce']((_0x2d151e,_0x2fe9bb)=>{return _0x2fe9bb!=='trc'&&_0x2fe9bb!=='spn'&&(_0x2d151e['app.stream.'+_0x2fe9bb]=_0x20ef68['metadata'][_0x2fe9bb]),_0x2d151e;},{})};}['setTelemetryContext'](_0x296b3c,_0x2792e5){!this['context']['metadata']['trc']&&(this['context']['metadata']['trc']=_0x296b3c['spanContext']()['traceId']),_0x2792e5===0x1?(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l1s']=_0x296b3c['spanContext']()['spanId']):(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l2s']=_0x296b3c['spanContext']()['spanId']);}['setActivityError'](_0x7721c4){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0x7721c4});}['setStreamError'](_0x50f6a7){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0x50f6a7});}static['addTargetTelemetryPaths'](_0x4fadc6,_0x2fd962,_0x289009,_0x2208c4){_0x2208c4===0x1?(!(_0x2fd962['parent']in _0x4fadc6)&&(_0x4fadc6[_0x2fd962['parent']]=[]),_0x4fadc6[_0x2fd962['parent']]['push'](_0x2fd962['parent']+'/output/metadata/l2s')):(!(_0x289009['aid']in _0x4fadc6)&&(_0x4fadc6[_0x289009['aid']]=[]),_0x4fadc6[_0x289009['aid']]['push'](_0x289009['aid']+'/output/metadata/l1s'));}static['bindJobTelemetryToState'](_0x5c1e20,_0x312ab8,_0x5befae){_0x312ab8['type']==='trigger'&&(_0x5c1e20['metadata/trc']=_0x5befae['metadata']['trc']);}static['bindActivityTelemetryToState'](_0x1a34a4,_0x2fce36,_0x513f32,_0x151af2,_0x35f749){if(_0x2fce36['type']==='trigger')_0x1a34a4[_0x513f32['aid']+'/output/metadata/l1s']=_0x151af2['$self']['output']['metadata']['l1s'],_0x1a34a4[_0x513f32['aid']+'/output/metadata/l2s']=_0x151af2['$self']['output']['metadata']['l2s'];else{if(utils_1['polyfill']['resolveActivityType'](_0x2fce36['type'])==='hook'&&_0x35f749===0x1)_0x1a34a4[_0x513f32['aid']+'/output/metadata/l1s']=_0x151af2['$self']['output']['metadata']['l1s'],_0x1a34a4[_0x513f32['aid']+'/output/metadata/l2s']=_0x151af2['$self']['output']['metadata']['l1s'];else{if(_0x2fce36['type']==='signal'&&_0x35f749===0x1)_0x1a34a4[_0x513f32['aid']+'/output/metadata/l1s']=_0x151af2['$self']['output']['metadata']['l1s'],_0x1a34a4[_0x513f32['aid']+'/output/metadata/l2s']=_0x151af2['$self']['output']['metadata']['l1s'];else{const _0x279d45='l'+_0x35f749+'s';_0x1a34a4[_0x513f32['aid']+'/output/metadata/'+_0x279d45]=_0x151af2['$self']['output']['metadata'][_0x279d45];}}}}}function _0x25ec(){const _0xd6ac88=['2836395eYLEiI','497KUYuvA','1446336wdjIan','564408TtMzVZ','5584725EZFFlK','21mYEJmh','18712lRgOPR','55854AzmELV','19004cxyDqb'];_0x25ec=function(){return _0xd6ac88;};return _0x25ec();}exports['TelemetryService']=TelemetryService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x43336b,_0x132806){const _0x37eafb=_0x36ac,_0x33a14e=_0x43336b();while(!![]){try{const _0x1dbee8=parseInt(_0x37eafb(0xb4))/0x1*(parseInt(_0x37eafb(0xbb))/0x2)+-parseInt(_0x37eafb(0xbd))/0x3+parseInt(_0x37eafb(0xb6))/0x4+parseInt(_0x37eafb(0xb7))/0x5*(parseInt(_0x37eafb(0xb9))/0x6)+parseInt(_0x37eafb(0xbc))/0x7+parseInt(_0x37eafb(0xba))/0x8*(parseInt(_0x37eafb(0xb8))/0x9)+-parseInt(_0x37eafb(0xb5))/0xa;if(_0x1dbee8===_0x132806)break;else _0x33a14e['push'](_0x33a14e['shift']());}catch(_0x443a60){_0x33a14e['push'](_0x33a14e['shift']());}}}(_0x5781,0xc8087));function _0x5781(){const _0x148fa2=['10790uSUDeJ','4513986zBdnXR','3252RvuUTq','16SdwHNo','2iVaNfy','368795fKROnv','3445548izuFLd','1349921ipcIye','23655690EmmgFA','3032280eunbir'];_0x5781=function(){return _0x148fa2;};return _0x5781();}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'](_0x1927d7,_0x1a3ce3,_0x449d99,_0x466ea0,_0x2fae7a){const _0xe82bd=[];if(Array['isArray'](_0x466ea0['workers']))for(const _0xf6ab73 of _0x466ea0['workers']){await factory_1['ConnectorService']['initClients'](_0xf6ab73);const _0x2f8bbe=new WorkerService();_0x2f8bbe['verifyWorkerFields'](_0xf6ab73),_0x2f8bbe['namespace']=_0x1927d7,_0x2f8bbe['appId']=_0x1a3ce3,_0x2f8bbe['guid']=_0x449d99,_0x2f8bbe['callback']=_0xf6ab73['callback'],_0x2f8bbe['topic']=_0xf6ab73['topic'],_0x2f8bbe['config']=_0x466ea0,_0x2f8bbe['logger']=_0x2fae7a,await _0x2f8bbe['initStoreChannel'](_0x2f8bbe,_0xf6ab73['store']),await _0x2f8bbe['initSubChannel'](_0x2f8bbe,_0xf6ab73['sub'],_0xf6ab73['pub']),await _0x2f8bbe['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x2f8bbe['subscriptionHandler'](),_0x1a3ce3),await _0x2f8bbe['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x2f8bbe['subscriptionHandler'](),_0x1a3ce3,_0x2f8bbe['topic']),await _0x2f8bbe['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x2f8bbe['subscriptionHandler'](),_0x1a3ce3,_0x2f8bbe['guid']),await _0x2f8bbe['initStreamChannel'](_0x2f8bbe,_0xf6ab73['stream'],_0xf6ab73['store']),_0x2f8bbe['router']=await _0x2f8bbe['initRouter'](_0xf6ab73,_0x2fae7a);const _0x5cb8b3=_0x2f8bbe['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x2f8bbe['appId'],'topic':_0xf6ab73['topic']});await _0x2f8bbe['router']['consumeMessages'](_0x5cb8b3,'WORKER',_0x2f8bbe['guid'],_0xf6ab73['callback']),_0x2f8bbe['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0xe82bd['push'](_0x2f8bbe);}return _0xe82bd;}['verifyWorkerFields'](_0x4966a9){if(!(0x0,utils_1['identifyProvider'])(_0x4966a9['store'])||!(0x0,utils_1['identifyProvider'])(_0x4966a9['stream'])||!(0x0,utils_1['identifyProvider'])(_0x4966a9['sub'])||!(_0x4966a9['topic']&&_0x4966a9['callback']))throw new Error('worker\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields\x20along\x20with\x20a\x20callback\x20function\x20and\x20topic.');}async['initStoreChannel'](_0x3b637d,_0xd71773){_0x3b637d['store']=await factory_4['StoreServiceFactory']['init'](_0xd71773,_0x3b637d['namespace'],_0x3b637d['appId'],_0x3b637d['logger']);}async['initSubChannel'](_0x348687,_0xbdeeb7,_0x570af1){_0x348687['subscribe']=await factory_3['SubServiceFactory']['init'](_0xbdeeb7,_0x570af1,_0x348687['namespace'],_0x348687['appId'],_0x348687['guid'],_0x348687['logger']);}async['initStreamChannel'](_0x5ca64a,_0x12d990,_0x14997e){_0x5ca64a['stream']=await factory_2['StreamServiceFactory']['init'](_0x12d990,_0x14997e,_0x5ca64a['namespace'],_0x5ca64a['appId'],_0x5ca64a['logger']);}async['initRouter'](_0x45fbbc,_0x582c35){const _0x3ed054=await this['store']['getThrottleRate'](_0x45fbbc['topic']);return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['WORKER'],'topic':_0x45fbbc['topic'],'reclaimDelay':_0x45fbbc['reclaimDelay'],'reclaimCount':_0x45fbbc['reclaimCount'],'throttle':_0x3ed054},this['stream'],_0x582c35);}['subscriptionHandler'](){const _0xd36ad4=this;return async(_0x447121,_0x7d6dec)=>{_0xd36ad4['logger']['debug']('worker-event-received',{'topic':_0x447121,'type':_0x7d6dec['type']});if(_0x7d6dec['type']==='throttle')_0x7d6dec['topic']!==null&&_0xd36ad4['throttle'](_0x7d6dec['throttle']);else{if(_0x7d6dec['type']==='ping')_0xd36ad4['sayPong'](_0xd36ad4['appId'],_0xd36ad4['guid'],_0x7d6dec['originator'],_0x7d6dec['details']);else _0x7d6dec['type']==='rollcall'&&(_0x7d6dec['topic']!==null&&_0xd36ad4['doRollCall'](_0x7d6dec));}};}async['doRollCall'](_0x36c31e){let _0x1a9f25=0x0;const _0x26843c=!isNaN(_0x36c31e['max'])?_0x36c31e['max']:enums_1['HMSH_QUORUM_ROLLCALL_CYCLES'];if(this['rollCallInterval'])clearTimeout(this['rollCallInterval']);const _0x539689=_0x36c31e['interval']/0x2,_0x2b9474=_0x539689+Math['ceil'](Math['random']()*_0x539689);do{await(0x0,utils_1['sleepFor'])(Math['ceil'](Math['random']()*0x3e8)),await this['sayPong'](this['appId'],this['guid'],null,!![],_0x36c31e['signature']);if(!_0x36c31e['interval'])return;const {promise:_0x706c3f,timerId:_0x28e2d2}=(0x0,utils_1['XSleepFor'])(_0x2b9474*0x3e8);this['rollCallInterval']=_0x28e2d2,await _0x706c3f;}while(this['rollCallInterval']&&_0x1a9f25++<_0x26843c-0x1);}['cancelRollCall'](){this['rollCallInterval']&&(clearTimeout(this['rollCallInterval']),delete this['rollCallInterval']);}['stop'](){this['cancelRollCall']();}async['sayPong'](_0x5cc15b,_0x1e2b92,_0x14e145,_0x295f31=![],_0x2fd84e=![]){let _0x27ef5b;if(_0x295f31){const _0x184a8d={'appId':this['appId'],'topic':this['topic']};_0x27ef5b={'engine_id':this['guid'],'namespace':this['namespace'],'app_id':this['appId'],'worker_topic':this['topic'],'stream':this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x184a8d),'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':_0x2fd84e?this['callback']['toString']():undefined};}this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'pong','guid':_0x1e2b92,'originator':_0x14e145,'profile':_0x27ef5b},_0x5cc15b);}async['throttle'](_0x3768b1){this['router']?.['setThrottle'](_0x3768b1);}}function _0x36ac(_0x11d731,_0x16970c){const _0x578146=_0x5781();return _0x36ac=function(_0x36ac3c,_0x58fc7b){_0x36ac3c=_0x36ac3c-0xb4;let _0xcabbee=_0x578146[_0x36ac3c];return _0xcabbee;},_0x36ac(_0x11d731,_0x16970c);}exports['WorkerService']=WorkerService;
|
package/build/types/hotmesh.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ type HotMeshEngine = {
|
|
|
43
43
|
store?: ProviderClient;
|
|
44
44
|
stream?: ProviderClient;
|
|
45
45
|
sub?: ProviderClient;
|
|
46
|
+
pub?: ProviderClient;
|
|
46
47
|
search?: ProviderClient;
|
|
47
48
|
redis?: ProviderConfig;
|
|
48
49
|
connection?: ProviderConfig;
|
|
@@ -50,6 +51,7 @@ type HotMeshEngine = {
|
|
|
50
51
|
store: ProviderConfig;
|
|
51
52
|
stream: ProviderConfig;
|
|
52
53
|
sub: ProviderConfig;
|
|
54
|
+
pub?: ProviderConfig;
|
|
53
55
|
search?: ProviderConfig;
|
|
54
56
|
};
|
|
55
57
|
reclaimDelay?: number;
|
|
@@ -58,6 +60,7 @@ type HotMeshEngine = {
|
|
|
58
60
|
};
|
|
59
61
|
type HotMeshWorker = {
|
|
60
62
|
topic: string;
|
|
63
|
+
pub?: ProviderClient;
|
|
61
64
|
store?: ProviderClient;
|
|
62
65
|
stream?: ProviderClient;
|
|
63
66
|
sub?: ProviderClient;
|
|
@@ -68,6 +71,7 @@ type HotMeshWorker = {
|
|
|
68
71
|
store: ProviderConfig;
|
|
69
72
|
stream: ProviderConfig;
|
|
70
73
|
sub: ProviderConfig;
|
|
74
|
+
pub?: ProviderConfig;
|
|
71
75
|
search?: ProviderConfig;
|
|
72
76
|
};
|
|
73
77
|
reclaimDelay?: number;
|
package/build/types/index.d.ts
CHANGED
|
@@ -13,10 +13,12 @@ export { ExtensionType, JobCompletionOptions, JobData, JobsData, JobInterruptOpt
|
|
|
13
13
|
export { DB, Profile, Namespaces, Entity, EntityInstanceTypes, SubClassInstance, AllSubclassInstances, SubclassType, Namespace, Instance, Instances, Profiles, } from './manifest';
|
|
14
14
|
export { MappingStatements } from './map';
|
|
15
15
|
export { Pipe, PipeContext, PipeItem, PipeItems, PipeObject, ReduceObject, } from './pipe';
|
|
16
|
-
export { ProviderClass, ProviderClient, ProviderConfig, ProviderTransaction, Providers, TransactionResultList, } from './provider';
|
|
16
|
+
export { ProviderClass, ProviderClient, ProviderConfig, ProviderTransaction, Providers, TransactionResultList, ProviderNativeClient, ProviderOptions, } from './provider';
|
|
17
17
|
export { MeshCallConnectParams, MeshCallExecParams, MeshCallCronParams, MeshCallExecOptions, MeshCallCronOptions, MeshCallInterruptOptions, MeshCallInterruptParams, MeshCallFlushParams, } from './meshcall';
|
|
18
18
|
export { CallOptions, MeshDataWorkflowOptions, ConnectOptions, ConnectionInput, ExecInput, } from './meshdata';
|
|
19
|
+
export { PostgresClassType, PostgresClientOptions, PostgresClientType, PostgresConsumerGroup, PostgresPendingMessage, PostgresPoolClientType, PostgresQueryConfigType, PostgresQueryResultType, PostgresStreamMessage, PostgresStreamOptions, PostgresTransaction, } from './postgres';
|
|
19
20
|
export { ActivateMessage, CronMessage, JobMessage, JobMessageCallback, PingMessage, PongMessage, QuorumMessage, QuorumMessageCallback, QuorumProfile, RollCallMessage, RollCallOptions, SubscriptionCallback, SubscriptionOptions, SystemHealth, ThrottleMessage, ThrottleOptions, WorkMessage, } from './quorum';
|
|
21
|
+
export { NatsAckPolicy, NatsAckPolicyExplicitType, NatsClassType, NatsClientType, NatsClientOptions, NatsConsumerConfigType, NatsJetStreamManager, NatsConnection, NatsJetStreamType, NatsConnectionOptions, NatsConsumerConfig, NatsConsumerInfo, NatsConsumerManager, NatsDeliveryInfo, NatsJetStreamOptions, NatsError, NatsErrorType, NatsJetStreamClient, NatsJsMsg, NatsMessageType, NatsMsgExpect, NatsPubAck, NatsPubAckType, NatsPublishOptions, NatsRetentionPolicy, NatsRetentionPolicyWorkqueueType, NatsSequenceInfo, NatsStorageMemoryType, NatsStorageType, NatsStreamConfig, NatsStreamInfo, NatsStreamManager, NatsStreamConfigType, NatsStreamInfoType, NatsStreamOptions, NatsStreamState, NatsTransaction, } from './nats';
|
|
20
22
|
export { RedisClass, RedisRedisClientType, RedisRedisClientOptions, RedisRedisClassType, IORedisClientType, RedisClient, RedisMulti, RedisRedisMultiType, IORedisClientOptions, IORedisClassType, IORedisMultiType, RedisOptions, isRedisClient, isIORedisClient, } from './redis';
|
|
21
23
|
export { JSONSchema, StringAnyType, StringScalarType, StringStringType, SymbolMap, SymbolMaps, SymbolRanges, Symbols, SymbolSets, } from './serializer';
|
|
22
24
|
export { AggregatedData, CountByFacet, GetStatsOptions, IdsData, Measure, MeasureIds, MetricTypes, StatType, StatsType, IdsResponse, JobStats, JobStatsInput, JobStatsRange, StatsResponse, Segment, TimeSegment, } from './stats';
|
|
@@ -1,17 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export interface PostgresClientOptions {
|
|
2
|
+
host?: string;
|
|
3
|
+
port?: number;
|
|
4
|
+
user?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
database?: string;
|
|
7
|
+
max?: number;
|
|
8
|
+
idleTimeoutMillis?: number;
|
|
9
|
+
}
|
|
10
|
+
export type PostgresClassType = {
|
|
11
|
+
new (options: PostgresClientOptions): PostgresClientType;
|
|
12
|
+
connect: (options: PostgresClientOptions) => Promise<PostgresClientType>;
|
|
13
|
+
};
|
|
14
|
+
export interface PostgresClientType {
|
|
15
|
+
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
16
|
+
end: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export interface PostgresPoolClientType {
|
|
19
|
+
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
20
|
+
release: () => void;
|
|
21
|
+
}
|
|
22
|
+
export interface PostgresQueryResultType {
|
|
23
|
+
rows: any[];
|
|
24
|
+
rowCount: number;
|
|
25
|
+
}
|
|
26
|
+
export interface PostgresQueryConfigType {
|
|
27
|
+
text: string;
|
|
28
|
+
values?: any[];
|
|
29
|
+
}
|
|
30
|
+
export interface PostgresStreamOptions extends PostgresClientOptions {
|
|
3
31
|
schema?: string;
|
|
4
32
|
maxRetries?: number;
|
|
5
33
|
retryDelay?: number;
|
|
6
34
|
streamTablePrefix?: string;
|
|
7
35
|
consumerTablePrefix?: string;
|
|
8
36
|
}
|
|
9
|
-
export type PostgresClientOptions = PoolConfig;
|
|
10
|
-
export type PostgresClientType = Pool;
|
|
11
|
-
export type PostgresClassType = typeof Pool;
|
|
12
|
-
export type PostgresPoolClientType = PoolClient;
|
|
13
|
-
export type PostgresQueryResultType = QueryResult;
|
|
14
|
-
export type PostgresQueryConfigType = QueryConfig;
|
|
15
37
|
export interface PostgresStreamMessage {
|
|
16
38
|
id: string;
|
|
17
39
|
stream: string;
|
|
@@ -35,7 +57,7 @@ export interface PostgresPendingMessage {
|
|
|
35
57
|
delivery_count: number;
|
|
36
58
|
}
|
|
37
59
|
export interface PostgresTransaction {
|
|
38
|
-
client:
|
|
60
|
+
client: PostgresPoolClientType;
|
|
39
61
|
queryBuffer: {
|
|
40
62
|
text: string;
|
|
41
63
|
values: any[];
|
|
@@ -9,7 +9,7 @@ export interface ProviderOptions {
|
|
|
9
9
|
export type Providers = 'redis' | 'nats' | 'postgres' | 'ioredis';
|
|
10
10
|
export interface ProviderTransaction {
|
|
11
11
|
exec(): Promise<any>;
|
|
12
|
-
[key: string]: any;
|
|
12
|
+
[key: string]: ((...args: any[]) => Promise<any>) | undefined | any;
|
|
13
13
|
}
|
|
14
14
|
export interface ProviderNativeClient {
|
|
15
15
|
[key: string]: any;
|
|
@@ -24,3 +24,46 @@ export type ProviderConfig = {
|
|
|
24
24
|
class: any;
|
|
25
25
|
options: StringAnyType;
|
|
26
26
|
};
|
|
27
|
+
export interface SetOptions {
|
|
28
|
+
nx?: boolean;
|
|
29
|
+
ex?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface HSetOptions {
|
|
32
|
+
nx?: boolean;
|
|
33
|
+
ex?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface ZAddOptions {
|
|
36
|
+
nx?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface HScanResult {
|
|
39
|
+
cursor: string;
|
|
40
|
+
items: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
export interface KVSQLProviderTransaction extends ProviderTransaction {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
exec(): Promise<any[]>;
|
|
45
|
+
set(key: string, value: string, options?: SetOptions): ProviderTransaction;
|
|
46
|
+
get(key: string): ProviderTransaction;
|
|
47
|
+
del(key: string): ProviderTransaction;
|
|
48
|
+
expire(key: string, seconds: number): ProviderTransaction;
|
|
49
|
+
hset(key: string, fields: Record<string, string>, options?: HSetOptions): ProviderTransaction;
|
|
50
|
+
hget(key: string, field: string): ProviderTransaction;
|
|
51
|
+
hdel(key: string, fields: string[]): ProviderTransaction;
|
|
52
|
+
hmget(key: string, fields: string[]): ProviderTransaction;
|
|
53
|
+
hgetall(key: string): ProviderTransaction;
|
|
54
|
+
hincrbyfloat(key: string, field: string, value: number): ProviderTransaction;
|
|
55
|
+
hscan(key: string, cursor: string, count?: number): ProviderTransaction;
|
|
56
|
+
lrange(key: string, start: number, end: number): ProviderTransaction;
|
|
57
|
+
rpush(key: string, value: string): ProviderTransaction;
|
|
58
|
+
lpush(key: string, value: string): ProviderTransaction;
|
|
59
|
+
lpop(key: string): ProviderTransaction;
|
|
60
|
+
lmove(source: string, destination: string, srcPosition: 'LEFT' | 'RIGHT', destPosition: 'LEFT' | 'RIGHT'): ProviderTransaction;
|
|
61
|
+
zadd(key: string, score: number, member: string, options?: ZAddOptions): ProviderTransaction;
|
|
62
|
+
zrange(key: string, start: number, stop: number): ProviderTransaction;
|
|
63
|
+
zrangebyscore(key: string, min: number, max: number): ProviderTransaction;
|
|
64
|
+
zrangebyscore_withscores(key: string, min: number, max: number): ProviderTransaction;
|
|
65
|
+
zrem(key: string, member: string): ProviderTransaction;
|
|
66
|
+
zrank(key: string, member: string): ProviderTransaction;
|
|
67
|
+
scan(cursor: number, count?: number): ProviderTransaction;
|
|
68
|
+
rename(oldKey: string, newKey: string): ProviderTransaction;
|
|
69
|
+
}
|
package/index.ts
CHANGED
|
@@ -7,12 +7,14 @@ import { MeshData } from './services/meshdata';
|
|
|
7
7
|
import { MeshOS } from './services/meshos';
|
|
8
8
|
import * as Errors from './modules/errors';
|
|
9
9
|
import * as Utils from './modules/utils';
|
|
10
|
+
import { ConnectorService as Connector } from './services/connector/factory';
|
|
10
11
|
|
|
11
12
|
const { Client, Connection, Search, Worker, workflow } = MeshFlow;
|
|
12
13
|
|
|
13
14
|
export {
|
|
14
15
|
Client,
|
|
15
16
|
Connection,
|
|
17
|
+
Connector,
|
|
16
18
|
Errors,
|
|
17
19
|
HotMesh,
|
|
18
20
|
HotMeshConfig,
|