@hotmeshio/hotmesh 0.3.19 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +72 -36
  2. package/build/index.d.ts +7 -1
  3. package/build/index.js +13 -1
  4. package/build/modules/key.js +1 -1
  5. package/build/modules/utils.d.ts +1 -3
  6. package/build/modules/utils.js +1 -1
  7. package/build/package.json +5 -4
  8. package/build/services/activities/activity.js +1 -1
  9. package/build/services/activities/await.js +1 -1
  10. package/build/services/activities/cycle.js +1 -1
  11. package/build/services/activities/hook.js +1 -1
  12. package/build/services/activities/index.js +1 -1
  13. package/build/services/activities/interrupt.js +1 -1
  14. package/build/services/activities/signal.js +1 -1
  15. package/build/services/activities/trigger.js +1 -1
  16. package/build/services/activities/worker.js +1 -1
  17. package/build/services/collator/index.js +1 -1
  18. package/build/services/compiler/deployer.js +1 -1
  19. package/build/services/compiler/index.js +1 -1
  20. package/build/services/compiler/validator.js +1 -1
  21. package/build/services/connector/factory.d.ts +1 -0
  22. package/build/services/connector/factory.js +35 -32
  23. package/build/services/connector/index.d.ts +4 -2
  24. package/build/services/connector/index.js +10 -5
  25. package/build/services/connector/providers/postgres.d.ts +13 -2
  26. package/build/services/connector/providers/postgres.js +54 -9
  27. package/build/services/engine/index.js +1 -1
  28. package/build/services/exporter/index.js +1 -1
  29. package/build/services/hotmesh/index.js +1 -6
  30. package/build/services/mapper/index.js +1 -1
  31. package/build/services/meshcall/index.js +3 -5
  32. package/build/services/meshdata/index.d.ts +3 -4
  33. package/build/services/meshdata/index.js +4 -9
  34. package/build/services/meshflow/client.js +1 -2
  35. package/build/services/meshflow/connection.js +1 -0
  36. package/build/services/meshflow/exporter.js +1 -1
  37. package/build/services/meshflow/worker.js +5 -8
  38. package/build/services/meshos/index.d.ts +2 -2
  39. package/build/services/meshos/index.js +6 -9
  40. package/build/services/pipe/functions/array.js +1 -1
  41. package/build/services/pipe/functions/bitwise.js +1 -1
  42. package/build/services/pipe/functions/conditional.js +1 -1
  43. package/build/services/pipe/functions/cron.js +1 -1
  44. package/build/services/pipe/functions/date.js +1 -1
  45. package/build/services/pipe/functions/index.js +1 -1
  46. package/build/services/pipe/functions/json.js +1 -1
  47. package/build/services/pipe/functions/logical.js +1 -1
  48. package/build/services/pipe/functions/math.js +1 -1
  49. package/build/services/pipe/functions/number.js +1 -1
  50. package/build/services/pipe/functions/object.js +1 -1
  51. package/build/services/pipe/functions/string.js +1 -1
  52. package/build/services/pipe/functions/symbol.js +1 -1
  53. package/build/services/pipe/functions/unary.js +1 -1
  54. package/build/services/pipe/index.js +1 -1
  55. package/build/services/quorum/index.js +1 -1
  56. package/build/services/reporter/index.js +1 -1
  57. package/build/services/router/index.js +1 -1
  58. package/build/services/search/providers/postgres/postgres.js +1 -1
  59. package/build/services/search/providers/redis/ioredis.js +1 -1
  60. package/build/services/search/providers/redis/redis.js +1 -1
  61. package/build/services/serializer/index.js +1 -1
  62. package/build/services/store/providers/postgres/kvsql.js +1 -1
  63. package/build/services/store/providers/postgres/kvtables.d.ts +2 -2
  64. package/build/services/store/providers/postgres/kvtables.js +1 -1
  65. package/build/services/store/providers/postgres/kvtransaction.js +1 -1
  66. package/build/services/store/providers/postgres/kvtypes/hash.js +1 -1
  67. package/build/services/store/providers/postgres/kvtypes/list.js +1 -1
  68. package/build/services/store/providers/postgres/kvtypes/string.js +1 -1
  69. package/build/services/store/providers/postgres/kvtypes/zset.js +1 -1
  70. package/build/services/store/providers/postgres/postgres.js +1 -1
  71. package/build/services/store/providers/redis/_base.js +1 -1
  72. package/build/services/store/providers/redis/ioredis.js +1 -1
  73. package/build/services/store/providers/redis/redis.js +1 -1
  74. package/build/services/store/providers/store-initializable.js +1 -1
  75. package/build/services/stream/providers/nats/nats.js +1 -1
  76. package/build/services/stream/providers/postgres/postgres.js +1 -1
  77. package/build/services/stream/providers/redis/ioredis.js +1 -1
  78. package/build/services/stream/providers/redis/redis.js +1 -1
  79. package/build/services/stream/providers/stream-initializable.js +1 -1
  80. package/build/services/sub/factory.d.ts +2 -2
  81. package/build/services/sub/factory.js +13 -8
  82. package/build/services/sub/providers/nats/nats.d.ts +19 -0
  83. package/build/services/sub/providers/nats/nats.js +1 -0
  84. package/build/services/sub/providers/postgres/postgres.d.ts +1 -0
  85. package/build/services/sub/providers/postgres/postgres.js +1 -1
  86. package/build/services/sub/providers/redis/ioredis.js +1 -1
  87. package/build/services/sub/providers/redis/redis.js +1 -1
  88. package/build/services/task/index.js +1 -1
  89. package/build/services/telemetry/index.js +1 -1
  90. package/build/services/worker/index.js +1 -1
  91. package/build/types/hotmesh.d.ts +3 -17
  92. package/build/types/manifest.d.ts +2 -10
  93. package/build/types/nats.d.ts +8 -0
  94. package/build/types/postgres.d.ts +10 -1
  95. package/build/types/provider.d.ts +1 -0
  96. package/index.ts +24 -5
  97. package/package.json +5 -4
  98. package/types/hotmesh.ts +17 -17
  99. package/types/manifest.ts +2 -10
  100. package/types/nats.ts +34 -0
  101. package/types/postgres.ts +13 -2
  102. package/types/provider.ts +4 -0
@@ -1 +1 @@
1
- 'use strict';(function(_0x23a873,_0x36c333){const _0x2d1b66=_0x2bd6,_0x495793=_0x23a873();while(!![]){try{const _0x41e44a=parseInt(_0x2d1b66(0x1e9))/0x1+-parseInt(_0x2d1b66(0x1e7))/0x2+-parseInt(_0x2d1b66(0x1e2))/0x3+-parseInt(_0x2d1b66(0x1ec))/0x4*(parseInt(_0x2d1b66(0x1e8))/0x5)+-parseInt(_0x2d1b66(0x1e5))/0x6*(-parseInt(_0x2d1b66(0x1e6))/0x7)+-parseInt(_0x2d1b66(0x1e4))/0x8*(parseInt(_0x2d1b66(0x1e3))/0x9)+-parseInt(_0x2d1b66(0x1eb))/0xa*(-parseInt(_0x2d1b66(0x1ea))/0xb);if(_0x41e44a===_0x36c333)break;else _0x495793['push'](_0x495793['shift']());}catch(_0x5c7416){_0x495793['push'](_0x495793['shift']());}}}(_0x5738,0x473de));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['RedisStreamService']=void 0x0;function _0x2bd6(_0x1728b6,_0x1be935){const _0x573813=_0x5738();return _0x2bd6=function(_0x2bd6c0,_0x1d8356){_0x2bd6c0=_0x2bd6c0-0x1e2;let _0x5efa53=_0x573813[_0x2bd6c0];return _0x5efa53;},_0x2bd6(_0x1728b6,_0x1be935);}function _0x5738(){const _0x2cb1f2=['522315IvWwqf','33ZYWBjA','1617830ckJxVp','8KRuuCq','689238TzQOmZ','9567cwXOxo','4328uSqGSl','2111910aWbtbK','7kEJbhO','332396TLSzHE','242040DOeKvX'];_0x5738=function(){return _0x2cb1f2;};return _0x5738();}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(_0x228aab,_0xada3eb,_0x182568={}){super(_0x228aab,_0xada3eb,_0x182568);}async['init'](_0x186f86,_0x32e084,_0x3bcd79){this['namespace']=_0x186f86,this['logger']=_0x3bcd79,this['appId']=_0x32e084;}['mintKey'](_0x45fcae,_0x56cd88){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x45fcae,{..._0x56cd88,'appId':this['appId']});}['transact'](){return this['streamClient']['multi']();}async['createStream'](_0x472578){try{const _0x2db37d=await this['streamClient']['XADD'](_0x472578,'*',{'field':'value'});return await this['streamClient']['XDEL'](_0x472578,_0x2db37d),!![];}catch(_0x3d08d0){this['logger']['error']('Error\x20creating\x20stream\x20'+_0x472578,{'error':_0x3d08d0});throw _0x3d08d0;}}async['deleteStream'](_0x303ce2){try{const _0x1b9e39=await this['streamClient']['DEL'](_0x303ce2);return _0x1b9e39>0x0;}catch(_0x3f85c5){this['logger']['error']('Error\x20deleting\x20stream\x20'+_0x303ce2,{'error':_0x3f85c5});throw _0x3f85c5;}}async['createConsumerGroup'](_0x4caf37,_0x964284){try{const _0x16543d=await this['storeClient']['sendCommand'](['XGROUP','CREATE',_0x4caf37,_0x964284,'$','MKSTREAM']);return _0x16543d==='OK';}catch(_0x112e2f){const _0x4ad8ec='with\x20MKSTREAM';this['logger']['debug']('x-group-error\x20'+_0x4ad8ec+'\x20for\x20key:\x20'+_0x4caf37+'\x20and\x20group:\x20'+_0x964284,{..._0x112e2f});throw _0x112e2f;}}async['deleteConsumerGroup'](_0x4bf920,_0x28eb0f){try{const _0x29ce31=await this['streamClient']['xGroupDestroy'](_0x4bf920,_0x28eb0f);return _0x29ce31;}catch(_0x34364d){this['logger']['error']('Error\x20deleting\x20consumer\x20group\x20'+_0x28eb0f+'\x20for\x20stream\x20'+_0x4bf920,{'error':_0x34364d});throw _0x34364d;}}async['publishMessages'](_0x435518,_0x5b4e6e,_0xdda63e){try{const _0x35e70c=_0xdda63e?.['transaction']||_0x5b4e6e['length']>0x1&&this['storeClient']['multi']();let _0x2b4be9;for(const _0x255e86 of _0x5b4e6e){_0x2b4be9=await(_0x35e70c||this['storeClient'])['XADD'](_0x435518,'*',{'message':_0x255e86});}return _0x35e70c&&!_0xdda63e?.['transaction']?(await _0x35e70c['exec']())['map'](_0x3bb40f=>_0x3bb40f[0x1]):[_0x2b4be9];}catch(_0x1d9b81){this['logger']['error']('ioredis-xadd-error\x20key:\x20'+_0x435518,{..._0x1d9b81});throw _0x1d9b81;}}async['consumeMessages'](_0x4a033c,_0x580fe3,_0x438c85,_0x2acfaa){const _0x5ae8e7='GROUP',_0x2be1a1='BLOCK',_0x52ccfc='STREAMS',_0x1d17c7='>';try{const _0x166bad=await this['streamClient']['sendCommand'](['XREADGROUP',_0x5ae8e7,_0x580fe3,_0x438c85,_0x2be1a1,_0x2acfaa?.['blockTimeout']?.['toString']()??enums_1['HMSH_BLOCK_TIME_MS']['toString'](),_0x52ccfc,_0x4a033c,_0x1d17c7]),_0x2f66c1=[];if((0x0,utils_1['isStreamMessage'])(_0x166bad)){const [[,_0x142dcb]]=_0x166bad;for(const [_0x10836b,_0x578f21]of _0x142dcb){_0x2f66c1['push']({'id':_0x10836b,'data':(0x0,utils_1['parseStreamMessage'])(_0x578f21[0x1])});}}else return[];return _0x2f66c1;}catch(_0x520f55){this['logger']['error']('Error\x20consuming\x20messages\x20from\x20'+_0x4a033c,{'error':_0x520f55});throw _0x520f55;}}async['ackAndDelete'](_0x113565,_0x99fd38,_0x985434){const _0x4a5318=this['storeClient']['multi']();return await this['acknowledgeMessages'](_0x113565,_0x99fd38,_0x985434,{'multi':_0x4a5318}),await this['deleteMessages'](_0x113565,_0x99fd38,_0x985434,{'multi':_0x4a5318}),await _0x4a5318['exec'](),_0x985434['length'];}async['acknowledgeMessages'](_0x4b944d,_0x28d409,_0x53855c,_0x4251bf){try{return _0x4251bf?.['multi']?(_0x4251bf['multi']['XACK'](_0x4b944d,_0x28d409,_0x53855c),_0x4251bf['multi']):await this['streamClient']['XACK'](_0x4b944d,_0x28d409,..._0x53855c);}catch(_0x57423c){this['logger']['error']('Error\x20in\x20acknowledging\x20messages\x20in\x20group:\x20'+_0x28d409+'\x20for\x20key:\x20'+_0x4b944d,{'error':_0x57423c});throw _0x57423c;}}async['deleteMessages'](_0x1cd77f,_0x44ef7f,_0x539bbf,_0x43976a){try{return _0x43976a?.['multi']?(_0x43976a['multi']['xDel'](_0x1cd77f,_0x539bbf),_0x43976a['multi']):await this['streamClient']['XDEL'](_0x1cd77f,..._0x539bbf);}catch(_0x1f139e){this['logger']['error']('Error\x20in\x20deleting\x20messages\x20with\x20ids:\x20'+_0x539bbf['join'](',')+'\x20for\x20key:\x20'+_0x1cd77f,{'error':_0x1f139e});throw _0x1f139e;}}async['getPendingMessages'](_0x181036,_0x39f388,_0x492cb7,_0x26bace){try{const _0x4aa811='-',_0x5bfe06='+',_0x394bec=[_0x181036,_0x39f388];if(_0x4aa811)_0x394bec['push'](_0x4aa811);if(_0x5bfe06)_0x394bec['push'](_0x5bfe06);if(_0x492cb7!==undefined)_0x394bec['push'](_0x492cb7['toString']());if(_0x26bace)_0x394bec['push'](_0x26bace);try{return await this['streamClient']['sendCommand'](['XPENDING',..._0x394bec]);}catch(_0x5f1ba7){this['logger']['error']('error,\x20args',{..._0x5f1ba7},_0x394bec);}}catch(_0x998136){this['logger']['error']('Error\x20retrieving\x20pending\x20messages\x20for\x20group:\x20'+_0x39f388+'\x20in\x20key:\x20'+_0x181036,{..._0x998136});throw _0x998136;}}async['retryMessages'](_0x15b13c,_0x120d7d,_0x14aabe){let _0x5d1065=[];const _0x1ab1e8=await this['getPendingMessages'](_0x15b13c,_0x120d7d,_0x14aabe?.['limit']);for(const _0x1e40d5 of _0x1ab1e8){if(Array['isArray'](_0x1e40d5)){const [_0x2201ed,,_0x12dfe8,_0xdce425]=_0x1e40d5;if(_0x12dfe8>_0x14aabe?.['minIdleTime']){const _0x3140e4=await this['claimMessage'](_0x15b13c,_0x120d7d,_0x14aabe?.['consumerName'],_0x14aabe?.['minIdleTime'],_0x2201ed);_0x5d1065=_0x5d1065['concat'](_0x3140e4);}}}return _0x5d1065;}async['claimMessage'](_0xf6427f,_0x55e44b,_0x5cfe44,_0x53d674,_0x43ecfb,..._0x4595c9){try{const _0x8bd475=await this['streamClient']['sendCommand'](['XCLAIM',_0xf6427f,_0x55e44b,_0x5cfe44,_0x53d674['toString'](),_0x43ecfb,..._0x4595c9]);return{'id':_0x8bd475[0x0][0x0],'data':(0x0,utils_1['parseStreamMessage'])(_0x8bd475[0x0][0x1][0x1])};}catch(_0x58676c){this['logger']['error']('Error\x20in\x20claiming\x20message\x20with\x20id:\x20'+_0x43ecfb+'\x20in\x20group:\x20'+_0x55e44b+'\x20for\x20key:\x20'+_0xf6427f,{..._0x58676c});throw _0x58676c;}}async['getStreamStats'](_0x6f822f){return{'messageCount':await this['getStreamDepth'](_0x6f822f)};}async['getStreamDepth'](_0x1d768a,_0x372ae4){try{if(_0x372ae4?.['multi'])return _0x372ae4['multi']['XLEN'](_0x1d768a),0x0;const _0xc2a1af=await this['streamClient']['XLEN'](_0x1d768a);return _0xc2a1af;}catch(_0x6fc8e8){this['logger']['error']('Error\x20getting\x20depth\x20for\x20'+_0x1d768a,{'error':_0x6fc8e8});throw _0x6fc8e8;}}async['getStreamDepths'](_0x111e98){const _0x44a0e9=this['storeClient']['multi'](),_0x43f9bb=new Map();_0x111e98['forEach'](_0x58ca24=>{!_0x43f9bb['has'](_0x58ca24['stream'])&&(_0x43f9bb['set'](_0x58ca24['stream'],-0x1),this['getStreamDepth'](_0x58ca24['stream'],{'multi':_0x44a0e9}));});const _0xce1982=await _0x44a0e9['exec']();return Array['from'](_0x43f9bb['keys']())['forEach']((_0x26e0e9,_0x4a3183)=>{_0x43f9bb['set'](_0x26e0e9,_0xce1982[_0x4a3183]);}),_0x111e98['map'](_0x3d9450=>{return{'stream':_0x3d9450['stream'],'depth':_0x43f9bb['get'](_0x3d9450['stream'])||0x0};});}async['trimStream'](_0x32c714,_0xccdb19){return 0x0;}['getProviderSpecificFeatures'](){return{'supportsBatching':!![],'supportsDeadLetterQueue':![],'supportsOrdering':!![],'supportsTrimming':!![],'supportsRetry':!![],'maxMessageSize':0x200*0x400*0x400,'maxBatchSize':0x3e8};}}exports['RedisStreamService']=RedisStreamService;
1
+ 'use strict';(function(_0x3cffd6,_0x339d6b){const _0x5177e0=_0xe003,_0xd54a16=_0x3cffd6();while(!![]){try{const _0x485ab1=parseInt(_0x5177e0(0x1bf))/0x1+parseInt(_0x5177e0(0x1bc))/0x2*(parseInt(_0x5177e0(0x1c2))/0x3)+parseInt(_0x5177e0(0x1c0))/0x4*(-parseInt(_0x5177e0(0x1c3))/0x5)+parseInt(_0x5177e0(0x1c6))/0x6*(parseInt(_0x5177e0(0x1c4))/0x7)+parseInt(_0x5177e0(0x1be))/0x8+parseInt(_0x5177e0(0x1c1))/0x9*(-parseInt(_0x5177e0(0x1c5))/0xa)+-parseInt(_0x5177e0(0x1bd))/0xb;if(_0x485ab1===_0x339d6b)break;else _0xd54a16['push'](_0xd54a16['shift']());}catch(_0x202f69){_0xd54a16['push'](_0xd54a16['shift']());}}}(_0x68c1,0x5d678));function _0xe003(_0x61b8d9,_0x3e229e){const _0x68c13d=_0x68c1();return _0xe003=function(_0xe0030b,_0x398ebc){_0xe0030b=_0xe0030b-0x1bc;let _0x1a5ded=_0x68c13d[_0xe0030b];return _0x1a5ded;},_0xe003(_0x61b8d9,_0x3e229e);}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(_0x130eb9,_0x5f3bfd,_0x4b0dc0={}){super(_0x130eb9,_0x5f3bfd,_0x4b0dc0);}async['init'](_0x210265,_0x4fb577,_0x5585ba){this['namespace']=_0x210265,this['logger']=_0x5585ba,this['appId']=_0x4fb577;}['mintKey'](_0x547cf2,_0x593f0d){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x547cf2,{..._0x593f0d,'appId':this['appId']});}['transact'](){return this['streamClient']['multi']();}async['createStream'](_0x4effff){try{const _0x2a3fde=await this['streamClient']['XADD'](_0x4effff,'*',{'field':'value'});return await this['streamClient']['XDEL'](_0x4effff,_0x2a3fde),!![];}catch(_0x32cc89){this['logger']['error']('Error\x20creating\x20stream\x20'+_0x4effff,{'error':_0x32cc89});throw _0x32cc89;}}async['deleteStream'](_0x525424){try{const _0x3c8c35=await this['streamClient']['DEL'](_0x525424);return _0x3c8c35>0x0;}catch(_0x5be761){this['logger']['error']('Error\x20deleting\x20stream\x20'+_0x525424,{'error':_0x5be761});throw _0x5be761;}}async['createConsumerGroup'](_0x43f1a6,_0xa15e5b){try{const _0x10fda0=await this['storeClient']['sendCommand'](['XGROUP','CREATE',_0x43f1a6,_0xa15e5b,'$','MKSTREAM']);return _0x10fda0==='OK';}catch(_0x3be257){const _0x51d6e3='with\x20MKSTREAM';this['logger']['debug']('x-group-error\x20'+_0x51d6e3+'\x20for\x20key:\x20'+_0x43f1a6+'\x20and\x20group:\x20'+_0xa15e5b,{..._0x3be257});throw _0x3be257;}}async['deleteConsumerGroup'](_0x1e6a13,_0xd2d874){try{const _0x707ce4=await this['streamClient']['xGroupDestroy'](_0x1e6a13,_0xd2d874);return _0x707ce4;}catch(_0x23d8d2){this['logger']['error']('Error\x20deleting\x20consumer\x20group\x20'+_0xd2d874+'\x20for\x20stream\x20'+_0x1e6a13,{'error':_0x23d8d2});throw _0x23d8d2;}}async['publishMessages'](_0x20ee89,_0x56ef98,_0x41e841){try{const _0x2c486d=_0x41e841?.['transaction']||_0x56ef98['length']>0x1&&this['storeClient']['multi']();let _0x5c9788;for(const _0x2f9faa of _0x56ef98){_0x5c9788=await(_0x2c486d||this['storeClient'])['XADD'](_0x20ee89,'*',{'message':_0x2f9faa});}return _0x2c486d&&!_0x41e841?.['transaction']?(await _0x2c486d['exec']())['map'](_0x2a620c=>_0x2a620c[0x1]):[_0x5c9788];}catch(_0x934924){this['logger']['error']('ioredis-xadd-error\x20key:\x20'+_0x20ee89,{..._0x934924});throw _0x934924;}}async['consumeMessages'](_0x431619,_0x2c43ea,_0x5916b6,_0xf2d96d){const _0x42848a='GROUP',_0x2bf3d9='BLOCK',_0x2bfc75='STREAMS',_0x36bc5b='>';try{const _0x495027=await this['streamClient']['sendCommand'](['XREADGROUP',_0x42848a,_0x2c43ea,_0x5916b6,_0x2bf3d9,_0xf2d96d?.['blockTimeout']?.['toString']()??enums_1['HMSH_BLOCK_TIME_MS']['toString'](),_0x2bfc75,_0x431619,_0x36bc5b]),_0x5d6a17=[];if((0x0,utils_1['isStreamMessage'])(_0x495027)){const [[,_0x16cdbc]]=_0x495027;for(const [_0x21a33f,_0xcde93e]of _0x16cdbc){_0x5d6a17['push']({'id':_0x21a33f,'data':(0x0,utils_1['parseStreamMessage'])(_0xcde93e[0x1])});}}else return[];return _0x5d6a17;}catch(_0xd63415){this['logger']['error']('Error\x20consuming\x20messages\x20from\x20'+_0x431619,{'error':_0xd63415});throw _0xd63415;}}async['ackAndDelete'](_0x521ebf,_0x1dc1f6,_0x11a6a1){const _0x5eb551=this['storeClient']['multi']();return await this['acknowledgeMessages'](_0x521ebf,_0x1dc1f6,_0x11a6a1,{'multi':_0x5eb551}),await this['deleteMessages'](_0x521ebf,_0x1dc1f6,_0x11a6a1,{'multi':_0x5eb551}),await _0x5eb551['exec'](),_0x11a6a1['length'];}async['acknowledgeMessages'](_0x4754f3,_0xc06d56,_0x36f954,_0x386f09){try{return _0x386f09?.['multi']?(_0x386f09['multi']['XACK'](_0x4754f3,_0xc06d56,_0x36f954),_0x386f09['multi']):await this['streamClient']['XACK'](_0x4754f3,_0xc06d56,..._0x36f954);}catch(_0x35ee87){this['logger']['error']('Error\x20in\x20acknowledging\x20messages\x20in\x20group:\x20'+_0xc06d56+'\x20for\x20key:\x20'+_0x4754f3,{'error':_0x35ee87});throw _0x35ee87;}}async['deleteMessages'](_0x4086a1,_0x30aa5c,_0x1f3eb7,_0x13cfcd){try{return _0x13cfcd?.['multi']?(_0x13cfcd['multi']['xDel'](_0x4086a1,_0x1f3eb7),_0x13cfcd['multi']):await this['streamClient']['XDEL'](_0x4086a1,..._0x1f3eb7);}catch(_0x349be2){this['logger']['error']('Error\x20in\x20deleting\x20messages\x20with\x20ids:\x20'+_0x1f3eb7['join'](',')+'\x20for\x20key:\x20'+_0x4086a1,{'error':_0x349be2});throw _0x349be2;}}async['getPendingMessages'](_0x1dd67c,_0x2ec393,_0x366112,_0xd56717){try{const _0x4dc2e5='-',_0x18d3d4='+',_0xaa8a1c=[_0x1dd67c,_0x2ec393];if(_0x4dc2e5)_0xaa8a1c['push'](_0x4dc2e5);if(_0x18d3d4)_0xaa8a1c['push'](_0x18d3d4);if(_0x366112!==undefined)_0xaa8a1c['push'](_0x366112['toString']());if(_0xd56717)_0xaa8a1c['push'](_0xd56717);try{return await this['streamClient']['sendCommand'](['XPENDING',..._0xaa8a1c]);}catch(_0x360446){this['logger']['error']('error,\x20args',{..._0x360446},_0xaa8a1c);}}catch(_0x3816cd){this['logger']['error']('Error\x20retrieving\x20pending\x20messages\x20for\x20group:\x20'+_0x2ec393+'\x20in\x20key:\x20'+_0x1dd67c,{..._0x3816cd});throw _0x3816cd;}}async['retryMessages'](_0xb99f6c,_0x2609d1,_0x185c3a){let _0x188e1e=[];const _0x3b3b74=await this['getPendingMessages'](_0xb99f6c,_0x2609d1,_0x185c3a?.['limit']);for(const _0x5e1a51 of _0x3b3b74){if(Array['isArray'](_0x5e1a51)){const [_0x52ffc0,,_0x49bac0,_0x1445ac]=_0x5e1a51;if(_0x49bac0>_0x185c3a?.['minIdleTime']){const _0x31be60=await this['claimMessage'](_0xb99f6c,_0x2609d1,_0x185c3a?.['consumerName'],_0x185c3a?.['minIdleTime'],_0x52ffc0);_0x188e1e=_0x188e1e['concat'](_0x31be60);}}}return _0x188e1e;}async['claimMessage'](_0x4325c2,_0x570efa,_0x5ddac7,_0x1590c2,_0x25c643,..._0x5d79ca){try{const _0x5b889e=await this['streamClient']['sendCommand'](['XCLAIM',_0x4325c2,_0x570efa,_0x5ddac7,_0x1590c2['toString'](),_0x25c643,..._0x5d79ca]);return{'id':_0x5b889e[0x0][0x0],'data':(0x0,utils_1['parseStreamMessage'])(_0x5b889e[0x0][0x1][0x1])};}catch(_0x378c91){this['logger']['error']('Error\x20in\x20claiming\x20message\x20with\x20id:\x20'+_0x25c643+'\x20in\x20group:\x20'+_0x570efa+'\x20for\x20key:\x20'+_0x4325c2,{..._0x378c91});throw _0x378c91;}}async['getStreamStats'](_0x1c8afe){return{'messageCount':await this['getStreamDepth'](_0x1c8afe)};}async['getStreamDepth'](_0x545c5f,_0x4e143d){try{if(_0x4e143d?.['multi'])return _0x4e143d['multi']['XLEN'](_0x545c5f),0x0;const _0x2cf4d3=await this['streamClient']['XLEN'](_0x545c5f);return _0x2cf4d3;}catch(_0x48c3a3){this['logger']['error']('Error\x20getting\x20depth\x20for\x20'+_0x545c5f,{'error':_0x48c3a3});throw _0x48c3a3;}}async['getStreamDepths'](_0x432a45){const _0x5cd203=this['storeClient']['multi'](),_0x59589a=new Map();_0x432a45['forEach'](_0x1f1ba1=>{!_0x59589a['has'](_0x1f1ba1['stream'])&&(_0x59589a['set'](_0x1f1ba1['stream'],-0x1),this['getStreamDepth'](_0x1f1ba1['stream'],{'multi':_0x5cd203}));});const _0x55c0ee=await _0x5cd203['exec']();return Array['from'](_0x59589a['keys']())['forEach']((_0x26af04,_0x176d01)=>{_0x59589a['set'](_0x26af04,_0x55c0ee[_0x176d01]);}),_0x432a45['map'](_0x3e069f=>{return{'stream':_0x3e069f['stream'],'depth':_0x59589a['get'](_0x3e069f['stream'])||0x0};});}async['trimStream'](_0x56080a,_0xb11e9e){return 0x0;}['getProviderSpecificFeatures'](){return{'supportsBatching':!![],'supportsDeadLetterQueue':![],'supportsOrdering':!![],'supportsTrimming':!![],'supportsRetry':!![],'maxMessageSize':0x200*0x400*0x400,'maxBatchSize':0x3e8};}}function _0x68c1(){const _0x763aa4=['349780NSTPWK','126OvRZIK','278PjBOmH','4160585NUuheK','2537288BvblxR','313217BtjkAO','56xtVuOU','9RZvnmQ','14799lPOpVx','253865KVVJMc','63518llRDnA'];_0x68c1=function(){return _0x763aa4;};return _0x68c1();}exports['RedisStreamService']=RedisStreamService;
@@ -1 +1 @@
1
- 'use strict';function _0xf3ff(){var _0x2f6385=['2155uOyZWk','62286sBbrCD','52861wHjkqZ','765021RHBxtc','8PkiLsd','1362501XEqIGJ','7441820bsZBYi','884943MViiTf','4398Mmuyqi','4UyxzUw'];_0xf3ff=function(){return _0x2f6385;};return _0xf3ff();}function _0x239b(_0x56eb64,_0x18b739){var _0xf3ff0a=_0xf3ff();return _0x239b=function(_0x239bfd,_0x529083){_0x239bfd=_0x239bfd-0xd8;var _0x4c27d5=_0xf3ff0a[_0x239bfd];return _0x4c27d5;},_0x239b(_0x56eb64,_0x18b739);}(function(_0x7ab2f9,_0x93fd06){var _0xc79177=_0x239b,_0x12fb1e=_0x7ab2f9();while(!![]){try{var _0xb98dd4=parseInt(_0xc79177(0xd8))/0x1+parseInt(_0xc79177(0xe1))/0x2+-parseInt(_0xc79177(0xd9))/0x3*(-parseInt(_0xc79177(0xdf))/0x4)+-parseInt(_0xc79177(0xe0))/0x5*(-parseInt(_0xc79177(0xde))/0x6)+parseInt(_0xc79177(0xdb))/0x7+parseInt(_0xc79177(0xda))/0x8*(parseInt(_0xc79177(0xdd))/0x9)+-parseInt(_0xc79177(0xdc))/0xa;if(_0xb98dd4===_0x93fd06)break;else _0x12fb1e['push'](_0x12fb1e['shift']());}catch(_0x3cc7c1){_0x12fb1e['push'](_0x12fb1e['shift']());}}}(_0xf3ff,0x31bca));Object['defineProperty'](exports,'__esModule',{'value':!![]});
1
+ 'use strict';function _0x4201(_0x2b36a8,_0x1c558e){var _0x15d2a1=_0x15d2();return _0x4201=function(_0x420136,_0x3fbad5){_0x420136=_0x420136-0x1c7;var _0x2e93c1=_0x15d2a1[_0x420136];return _0x2e93c1;},_0x4201(_0x2b36a8,_0x1c558e);}(function(_0x590f4a,_0xe00c4b){var _0xc6fceb=_0x4201,_0x202da7=_0x590f4a();while(!![]){try{var _0x2007f1=-parseInt(_0xc6fceb(0x1cd))/0x1+parseInt(_0xc6fceb(0x1c7))/0x2+parseInt(_0xc6fceb(0x1cb))/0x3+parseInt(_0xc6fceb(0x1cf))/0x4*(-parseInt(_0xc6fceb(0x1c8))/0x5)+parseInt(_0xc6fceb(0x1d0))/0x6*(parseInt(_0xc6fceb(0x1ce))/0x7)+-parseInt(_0xc6fceb(0x1cc))/0x8*(-parseInt(_0xc6fceb(0x1ca))/0x9)+parseInt(_0xc6fceb(0x1d1))/0xa*(-parseInt(_0xc6fceb(0x1c9))/0xb);if(_0x2007f1===_0xe00c4b)break;else _0x202da7['push'](_0x202da7['shift']());}catch(_0x30ffe6){_0x202da7['push'](_0x202da7['shift']());}}}(_0x15d2,0x6fece));Object['defineProperty'](exports,'__esModule',{'value':!![]});function _0x15d2(){var _0x5f443d=['10zrKfSr','948686ZBGuus','10880OWMEio','17633726YQAKui','7216983cLgfTj','1127997RIyWuV','8RjSuRV','278497cStNsj','442988HrJxdv','248rDiufn','78PapHcw'];_0x15d2=function(){return _0x5f443d;};return _0x15d2();}
@@ -1,7 +1,7 @@
1
+ import { SubService } from './index';
1
2
  import { ILogger } from '../logger';
2
3
  import { ProviderClient } from '../../types/provider';
3
- import { SubService } from './index';
4
4
  declare class SubServiceFactory {
5
- static init(providerClient: ProviderClient, providerStoreClient: ProviderClient, namespace: string, appId: string, engineId: string, logger: ILogger): Promise<SubService<ProviderClient>>;
5
+ static init(providerSubClient: ProviderClient, providerPubClient: ProviderClient, namespace: string, appId: string, engineId: string, logger: ILogger): Promise<SubService<ProviderClient>>;
6
6
  }
7
7
  export { SubServiceFactory };
@@ -1,21 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SubServiceFactory = void 0;
4
- const utils_1 = require("../../modules/utils");
5
4
  const ioredis_1 = require("./providers/redis/ioredis");
6
- const redis_1 = require("./providers/redis/redis");
5
+ const nats_1 = require("./providers/nats/nats");
7
6
  const postgres_1 = require("./providers/postgres/postgres");
7
+ const redis_1 = require("./providers/redis/redis");
8
+ const utils_1 = require("../../modules/utils");
8
9
  class SubServiceFactory {
9
- static async init(providerClient, providerStoreClient, namespace, appId, engineId, logger) {
10
+ static async init(providerSubClient, providerPubClient, namespace, appId, engineId, logger) {
10
11
  let service;
11
- if ((0, utils_1.identifyProvider)(providerClient) === 'redis') {
12
- service = new redis_1.RedisSubService(providerClient, providerStoreClient);
12
+ const providerType = (0, utils_1.identifyProvider)(providerSubClient);
13
+ if (providerType === 'nats') {
14
+ service = new nats_1.NatsSubService(providerSubClient, providerPubClient);
15
+ }
16
+ else if (providerType === 'redis') {
17
+ service = new redis_1.RedisSubService(providerSubClient, providerPubClient);
13
18
  }
14
- else if ((0, utils_1.identifyProvider)(providerClient) === 'postgres') {
15
- service = new postgres_1.PostgresSubService(providerClient, providerStoreClient);
19
+ else if (providerType === 'postgres') {
20
+ service = new postgres_1.PostgresSubService(providerSubClient, providerPubClient);
16
21
  }
17
22
  else {
18
- service = new ioredis_1.IORedisSubService(providerClient, providerStoreClient);
23
+ service = new ioredis_1.IORedisSubService(providerSubClient, providerPubClient);
19
24
  }
20
25
  await service.init(namespace, appId, engineId, logger);
21
26
  return service;
@@ -0,0 +1,19 @@
1
+ import { KeyStoreParams, KeyType } from '../../../../modules/key';
2
+ import { ILogger } from '../../../logger';
3
+ import { SubService } from '../../index';
4
+ import { SubscriptionCallback } from '../../../../types/quorum';
5
+ import { NatsClientType } from '../../../../types/nats';
6
+ import { ProviderClient, ProviderTransaction } from '../../../../types/provider';
7
+ declare class NatsSubService extends SubService<NatsClientType & ProviderClient> {
8
+ private subscriptions;
9
+ constructor(eventClient: NatsClientType, storeClient: NatsClientType);
10
+ init(namespace: string, appId: string, engineId: string, logger: ILogger): Promise<void>;
11
+ transact(): ProviderTransaction;
12
+ mintKey(type: KeyType, params: KeyStoreParams): string;
13
+ subscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string, topic?: string): Promise<void>;
14
+ unsubscribe(keyType: KeyType.QUORUM, appId: string, engineId?: string): Promise<void>;
15
+ psubscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string, topic?: string): Promise<void>;
16
+ punsubscribe(keyType: KeyType.QUORUM, appId: string, topic?: string): Promise<void>;
17
+ publish(keyType: KeyType.QUORUM, message: Record<string, any>, appId: string, topic?: string): Promise<boolean>;
18
+ }
19
+ export { NatsSubService };
@@ -0,0 +1 @@
1
+ 'use strict';(function(_0x3be30d,_0x4131d2){const _0x3ccdb9=_0x22c8,_0x374c3b=_0x3be30d();while(!![]){try{const _0x34e236=parseInt(_0x3ccdb9(0x109))/0x1*(parseInt(_0x3ccdb9(0x10c))/0x2)+parseInt(_0x3ccdb9(0x10e))/0x3*(-parseInt(_0x3ccdb9(0x108))/0x4)+-parseInt(_0x3ccdb9(0x107))/0x5+-parseInt(_0x3ccdb9(0x110))/0x6*(-parseInt(_0x3ccdb9(0x10b))/0x7)+-parseInt(_0x3ccdb9(0x106))/0x8+parseInt(_0x3ccdb9(0x10f))/0x9+-parseInt(_0x3ccdb9(0x10d))/0xa*(parseInt(_0x3ccdb9(0x10a))/0xb);if(_0x34e236===_0x4131d2)break;else _0x374c3b['push'](_0x374c3b['shift']());}catch(_0x1edaf5){_0x374c3b['push'](_0x374c3b['shift']());}}}(_0xd69f,0x5fc42));function _0xd69f(){const _0x5137ad=['1grsgms','341WNcRsY','7jynulf','1017158yrAgih','35540JTcJSO','1361733lJlwIb','6205860PaxcXB','3688998GDJnUp','4962728FbsVXm','1181340YSLGlc','4XEMPQt'];_0xd69f=function(){return _0x5137ad;};return _0xd69f();}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(_0x39e640,_0x56b902){super(_0x39e640,_0x56b902),this['subscriptions']=new Map();}async['init'](_0x20e966=key_1['HMNS'],_0x5a11b8,_0x403b7c,_0x1e0f30){this['namespace']=_0x20e966,this['logger']=_0x1e0f30,this['appId']=_0x5a11b8,this['engineId']=_0x403b7c;}['transact'](){return{};}['mintKey'](_0x149aea,_0x18f92b){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x149aea,_0x18f92b)['replace'](/:/g,'.')['replace'](/\.$/g,'.X');}async['subscribe'](_0x1a59bf,_0x179912,_0x41253e,_0x598512){const _0x812eb0=this['mintKey'](_0x1a59bf,{'appId':_0x41253e,'engineId':_0x598512}),_0x4bb72f=this['eventClient']['subscribe'](_0x812eb0);this['subscriptions']['set'](_0x812eb0,_0x4bb72f),this['logger']['debug']('nats-subscribe\x20'+_0x812eb0),(async()=>{for await(const _0x89096d of _0x4bb72f){try{const _0x4296f2=JSON['parse'](_0x89096d['data']['toString']());_0x179912(_0x812eb0,_0x4296f2);}catch(_0x17cacf){this['logger']['error']('nats-subscribe-message-parse-error:\x20'+_0x89096d['data']['toString'](),_0x17cacf);}}})()['catch'](_0x129635=>{this['logger']['error']('nats-subscribe-error\x20'+_0x812eb0,_0x129635);});}async['unsubscribe'](_0x2ded44,_0x1fe17f,_0x1c938f){const _0x2b1ac3=this['mintKey'](_0x2ded44,{'appId':_0x1fe17f,'engineId':_0x1c938f}),_0x586bfa=this['subscriptions']['get'](_0x2b1ac3);_0x586bfa?(_0x586bfa['unsubscribe'](),this['subscriptions']['delete'](_0x2b1ac3),this['logger']['debug']('nats-unsubscribe\x20'+_0x2b1ac3)):this['logger']['warn']('nats-unsubscribe-error\x20'+_0x2b1ac3);}async['psubscribe'](_0x2ed2f6,_0x5134d2,_0x563ad7,_0x41736){const _0x42dd85=this['mintKey'](_0x2ed2f6,{'appId':_0x563ad7,'engineId':_0x41736}),_0x4c16c6=this['eventClient']['subscribe'](_0x42dd85);this['subscriptions']['set'](_0x42dd85,_0x4c16c6),this['logger']['debug']('nats-psubscribe\x20'+_0x42dd85),(async()=>{for await(const _0x759688 of _0x4c16c6){try{const _0x626100=JSON['parse'](_0x759688['data']['toString']());_0x5134d2(_0x759688['subject'],_0x626100);}catch(_0x1b5c8f){this['logger']['error']('nats-parse-psubscription-message-error\x20'+_0x759688['data']['toString'](),_0x1b5c8f);}}})()['catch'](_0xe317b=>{this['logger']['error']('nats-pattern-psubscription-error\x20'+_0x42dd85,_0xe317b);});}async['punsubscribe'](_0x147faf,_0x3975e1,_0xc031dc){const _0x1e248e=this['mintKey'](_0x147faf,{'appId':_0x3975e1,'engineId':_0xc031dc}),_0x49e837=this['subscriptions']['get'](_0x1e248e);_0x49e837?(_0x49e837['unsubscribe'](),this['subscriptions']['delete'](_0x1e248e),this['logger']['debug']('nats-punsubscribe\x20'+_0x1e248e)):this['logger']['warn']('nats-punsubscribe-error\x20'+_0x1e248e);}async['publish'](_0x107dfe,_0x310efb,_0x4f068c,_0x305ed1){const _0x498962=this['mintKey'](_0x107dfe,{'appId':_0x4f068c,'engineId':_0x305ed1});try{return this['storeClient']['publish'](_0x498962,JSON['stringify'](_0x310efb)),this['logger']['debug']('nats-publish\x20'+_0x498962),!![];}catch(_0x343990){return this['logger']['error']('nats-publish-error\x20'+_0x498962,_0x343990),![];}}}function _0x22c8(_0x2f546f,_0x320b3d){const _0xd69fa0=_0xd69f();return _0x22c8=function(_0x22c84c,_0x14837b){_0x22c84c=_0x22c84c-0x106;let _0x431904=_0xd69fa0[_0x22c84c];return _0x431904;},_0x22c8(_0x2f546f,_0x320b3d);}exports['NatsSubService']=NatsSubService;
@@ -9,6 +9,7 @@ declare class PostgresSubService extends SubService<PostgresClientType & Provide
9
9
  init(namespace: string, appId: string, engineId: string, logger: ILogger): Promise<void>;
10
10
  transact(): ProviderTransaction;
11
11
  mintKey(type: KeyType, params: KeyStoreParams): string;
12
+ mintSafeKey(type: KeyType, params: KeyStoreParams): [string, string];
12
13
  subscribe(keyType: KeyType.QUORUM, callback: SubscriptionCallback, appId: string, engineId?: string): Promise<void>;
13
14
  unsubscribe(keyType: KeyType.QUORUM, appId: string, engineId?: string): Promise<void>;
14
15
  publish(keyType: KeyType.QUORUM, message: Record<string, any>, appId: string, engineId?: string): Promise<boolean>;
@@ -1 +1 @@
1
- 'use strict';(function(_0x5a0d3b,_0x42230f){const _0x5b2297=_0x42ab,_0x220c2b=_0x5a0d3b();while(!![]){try{const _0x290617=parseInt(_0x5b2297(0x1c3))/0x1+parseInt(_0x5b2297(0x1c7))/0x2+-parseInt(_0x5b2297(0x1c6))/0x3+parseInt(_0x5b2297(0x1ca))/0x4+parseInt(_0x5b2297(0x1c9))/0x5*(-parseInt(_0x5b2297(0x1c2))/0x6)+-parseInt(_0x5b2297(0x1c5))/0x7+-parseInt(_0x5b2297(0x1c8))/0x8*(parseInt(_0x5b2297(0x1c4))/0x9);if(_0x290617===_0x42230f)break;else _0x220c2b['push'](_0x220c2b['shift']());}catch(_0x5acb2d){_0x220c2b['push'](_0x220c2b['shift']());}}}(_0x1517,0x54325));function _0x1517(){const _0x684ab0=['653316kWoQvB','352539VQRNOc','819266igwSOw','648900HNLNsN','985650isLRHy','56rQnacZ','10rAHtIh','607204EeZwuI','1036614eOfnLn'];_0x1517=function(){return _0x684ab0;};return _0x1517();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['PostgresSubService']=void 0x0;const key_1=require('../../../../modules/key'),index_1=require('../../index');class PostgresSubService extends index_1['SubService']{constructor(_0x22d537,_0x4063b5){super(_0x22d537,_0x4063b5);}async['init'](_0x204f64=key_1['HMNS'],_0x153f07,_0xf0e871,_0x2cb2fb){this['namespace']=_0x204f64,this['logger']=_0x2cb2fb,this['appId']=_0x153f07,this['engineId']=_0xf0e871;}['transact'](){throw new Error('Transactions\x20are\x20not\x20supported\x20in\x20lightweight\x20pub/sub');}['mintKey'](_0x1c3b93,_0x337a99){if(!this['namespace'])throw new Error('Namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x1c3b93,_0x337a99);}async['subscribe'](_0x49d712,_0x24bcac,_0x2b4d8f,_0x4a3575){const _0x56874d=this['mintKey'](_0x49d712,{'appId':_0x2b4d8f,'engineId':_0x4a3575});await this['eventClient']['query']('LISTEN\x20\x22'+_0x56874d+'\x22'),this['logger']['info']('postgres-subscribe\x20'+_0x56874d),this['eventClient']['on']('notification',_0x20fef9=>{if(_0x20fef9['channel']===_0x56874d)try{const _0xa7e3b2=JSON['parse'](_0x20fef9['payload']||'{}');_0x24bcac(_0x56874d,_0xa7e3b2);}catch(_0x1ad66c){this['logger']['error']('Error\x20parsing\x20message\x20for\x20topic\x20'+_0x56874d+':',_0x1ad66c);}});}async['unsubscribe'](_0x597bfd,_0x1f4c79,_0x191d0f){const _0x16ebef=this['mintKey'](_0x597bfd,{'appId':_0x1f4c79,'engineId':_0x191d0f});await this['eventClient']['query']('UNLISTEN\x20\x22'+_0x16ebef+'\x22'),this['logger']['info']('postgres-unsubscribe\x20'+_0x16ebef);}async['publish'](_0x1de006,_0x4ab135,_0x4a910b,_0x3073d6){const _0xb08a92=this['mintKey'](_0x1de006,{'appId':_0x4a910b,'engineId':_0x3073d6}),_0x54bef0=JSON['stringify'](_0x4ab135)['replace'](/'/g,'\x27\x27');return await this['storeClient']['query']('NOTIFY\x20\x22'+_0xb08a92+'\x22,\x20\x27'+_0x54bef0+'\x27'),this['logger']['info']('postgres-publish\x20'+_0xb08a92),!![];}async['psubscribe'](){throw new Error('Pattern\x20subscriptions\x20are\x20not\x20supported\x20in\x20PostgreSQL');}async['punsubscribe'](){throw new Error('Pattern\x20subscriptions\x20are\x20not\x20supported\x20in\x20PostgreSQL');}}function _0x42ab(_0x3d8977,_0x1f3fe7){const _0x15176f=_0x1517();return _0x42ab=function(_0x42ab26,_0x3b4ce3){_0x42ab26=_0x42ab26-0x1c2;let _0x2b4a2f=_0x15176f[_0x42ab26];return _0x2b4a2f;},_0x42ab(_0x3d8977,_0x1f3fe7);}exports['PostgresSubService']=PostgresSubService;
1
+ 'use strict';(function(_0x2fa425,_0x1f5247){const _0x4b4def=_0x518a,_0x46cae5=_0x2fa425();while(!![]){try{const _0x5472c6=parseInt(_0x4b4def(0x1d7))/0x1*(-parseInt(_0x4b4def(0x1db))/0x2)+parseInt(_0x4b4def(0x1d9))/0x3*(parseInt(_0x4b4def(0x1d5))/0x4)+-parseInt(_0x4b4def(0x1dd))/0x5*(-parseInt(_0x4b4def(0x1da))/0x6)+-parseInt(_0x4b4def(0x1de))/0x7*(-parseInt(_0x4b4def(0x1d8))/0x8)+parseInt(_0x4b4def(0x1d4))/0x9*(-parseInt(_0x4b4def(0x1dc))/0xa)+-parseInt(_0x4b4def(0x1d6))/0xb+-parseInt(_0x4b4def(0x1df))/0xc;if(_0x5472c6===_0x1f5247)break;else _0x46cae5['push'](_0x46cae5['shift']());}catch(_0x4ff785){_0x46cae5['push'](_0x46cae5['shift']());}}}(_0x5005,0x89416));var __importDefault=this&&this['__importDefault']||function(_0x4aee3d){return _0x4aee3d&&_0x4aee3d['__esModule']?_0x4aee3d:{'default':_0x4aee3d};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['PostgresSubService']=void 0x0;function _0x5005(){const _0x420c24=['50740RZelRh','5199467trXhNI','4061136endUdR','9AWrLVD','2107484NAQOUL','3689554DvYiHw','663074UJrTWX','8oJLtim','6sJolQt','264zuJisP','2OjOzZI','3439210DWcBZS'];_0x5005=function(){return _0x420c24;};return _0x5005();}const crypto_1=__importDefault(require('crypto')),key_1=require('../../../../modules/key'),index_1=require('../../index');function _0x518a(_0x3a5e8d,_0x29cc51){const _0x5005cd=_0x5005();return _0x518a=function(_0x518ad6,_0x27370c){_0x518ad6=_0x518ad6-0x1d4;let _0xdc7a7b=_0x5005cd[_0x518ad6];return _0xdc7a7b;},_0x518a(_0x3a5e8d,_0x29cc51);}class PostgresSubService extends index_1['SubService']{constructor(_0x2b3e22,_0x2a1fef){super(_0x2b3e22,_0x2a1fef);}async['init'](_0x568c5b=key_1['HMNS'],_0x3d57a8,_0x2e7165,_0x206578){this['namespace']=_0x568c5b,this['logger']=_0x206578,this['appId']=_0x3d57a8,this['engineId']=_0x2e7165;}['transact'](){throw new Error('Transactions\x20are\x20not\x20supported\x20in\x20lightweight\x20pub/sub');}['mintKey'](_0xe4142a,_0x2702e9){if(!this['namespace'])throw new Error('Namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0xe4142a,_0x2702e9);}['mintSafeKey'](_0x90de91,_0xb4786f){const _0x1133b3=this['mintKey'](_0x90de91,_0xb4786f);if(_0x1133b3['length']<=0x3f)return[_0x1133b3,_0x1133b3];const {appId:appId='',engineId:engineId=''}=_0xb4786f,_0x419e5d=this['namespace']+':'+appId+':'+_0x90de91,_0x3e8b35=0x3f-_0x419e5d['length']-0x1,_0x41c80b=crypto_1['default']['createHash']('sha256')['update'](engineId)['digest']('hex')['substring'](0x0,_0x3e8b35),_0x5c720a=_0x419e5d+':'+_0x41c80b;return[_0x1133b3,_0x5c720a];}async['subscribe'](_0x41f708,_0x30f8cf,_0x2101c7,_0x5b8d19){const [_0x143a55,_0x2981a8]=this['mintSafeKey'](_0x41f708,{'appId':_0x2101c7,'engineId':_0x5b8d19});await this['eventClient']['query']('LISTEN\x20\x22'+_0x2981a8+'\x22'),this['logger']['debug']('postgres-subscribe',{'originalKey':_0x143a55,'safeKey':_0x2981a8}),this['eventClient']['on']('notification',_0xf2c4c6=>{if(_0xf2c4c6['channel']===_0x2981a8)try{const _0x4e3ff5=JSON['parse'](_0xf2c4c6['payload']||'{}');_0x30f8cf(_0x2981a8,_0x4e3ff5);}catch(_0x47d12d){this['logger']['error']('Error\x20parsing\x20message\x20for\x20topic\x20'+_0x2981a8+':',_0x47d12d);}});}async['unsubscribe'](_0x175f82,_0x2b8acb,_0x557591){const [_0x2ec0c1,_0xc53c15]=this['mintSafeKey'](_0x175f82,{'appId':_0x2b8acb,'engineId':_0x557591});await this['eventClient']['query']('UNLISTEN\x20\x22'+_0xc53c15+'\x22'),this['logger']['debug']('postgres-subscribe',{'originalKey':_0x2ec0c1,'safeKey':_0xc53c15});}async['publish'](_0x5f9d4c,_0x1f6bea,_0x5482b8,_0x203f1c){const [_0x3954fa,_0x45e68f]=this['mintSafeKey'](_0x5f9d4c,{'appId':_0x5482b8,'engineId':_0x203f1c}),_0x394b1c=JSON['stringify'](_0x1f6bea)['replace'](/'/g,'\x27\x27');return await this['storeClient']['query']('NOTIFY\x20\x22'+_0x45e68f+'\x22,\x20\x27'+_0x394b1c+'\x27'),this['logger']['debug']('postgres-publish',{'originalKey':_0x3954fa,'safeKey':_0x45e68f}),!![];}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(_0x13e63e,_0x4ab37f){const _0xa63ef8=_0x3a56,_0x180c94=_0x13e63e();while(!![]){try{const _0x517aeb=-parseInt(_0xa63ef8(0x9e))/0x1+parseInt(_0xa63ef8(0xa1))/0x2*(parseInt(_0xa63ef8(0xa5))/0x3)+parseInt(_0xa63ef8(0x9d))/0x4+parseInt(_0xa63ef8(0xa3))/0x5*(parseInt(_0xa63ef8(0x9f))/0x6)+parseInt(_0xa63ef8(0xa0))/0x7*(parseInt(_0xa63ef8(0xa2))/0x8)+parseInt(_0xa63ef8(0xa4))/0x9+-parseInt(_0xa63ef8(0xa6))/0xa;if(_0x517aeb===_0x4ab37f)break;else _0x180c94['push'](_0x180c94['shift']());}catch(_0x31243a){_0x180c94['push'](_0x180c94['shift']());}}}(_0x1657,0xc47ae));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['IORedisSubService']=void 0x0;const key_1=require('../../../../modules/key'),index_1=require('../../index');function _0x3a56(_0x5175cb,_0x513976){const _0x1657c1=_0x1657();return _0x3a56=function(_0x3a56fa,_0x4b1adf){_0x3a56fa=_0x3a56fa-0x9d;let _0x428a34=_0x1657c1[_0x3a56fa];return _0x428a34;},_0x3a56(_0x5175cb,_0x513976);}function _0x1657(){const _0x2c8238=['1853028qgSELs','1133578mLmLkR','2368362neAXgP','7NMereE','208IpFrbo','5713304hjsoAu','5tRokrv','4633371IjnRUt','25122sCCgLF','10195020ywWfSo'];_0x1657=function(){return _0x2c8238;};return _0x1657();}class IORedisSubService extends index_1['SubService']{constructor(_0x560e72,_0x4406ac){super(_0x560e72,_0x4406ac);}async['init'](_0x5ced5c=key_1['HMNS'],_0x5df240,_0xb6276,_0x8d0434){this['namespace']=_0x5ced5c,this['logger']=_0x8d0434,this['appId']=_0x5df240,this['engineId']=_0xb6276;}['transact'](){return this['eventClient']['multi']();}['mintKey'](_0xbcc69a,_0x841a3a){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0xbcc69a,_0x841a3a);}async['subscribe'](_0x45d87b,_0x2c0639,_0x3c9218,_0x3bf50a){const _0x10e9fc=this,_0x59e58f=this['mintKey'](_0x45d87b,{'appId':_0x3c9218,'engineId':_0x3bf50a});await this['eventClient']['subscribe'](_0x59e58f,_0x5e9e9c=>{_0x5e9e9c&&_0x10e9fc['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x59e58f,_0x5e9e9c);}),this['eventClient']['on']('message',(_0x5808b8,_0x1f96ea)=>{if(_0x5808b8===_0x59e58f)try{const _0x4fc131=JSON['parse'](_0x1f96ea);_0x2c0639(_0x59e58f,_0x4fc131);}catch(_0x1efac6){_0x10e9fc['logger']['error']('Error\x20parsing\x20message:\x20'+_0x1f96ea,_0x1efac6);}});}async['unsubscribe'](_0x1e887f,_0x5f3b57,_0x31020b){const _0xc5e41d=this['mintKey'](_0x1e887f,{'appId':_0x5f3b57,'engineId':_0x31020b});await this['eventClient']['unsubscribe'](_0xc5e41d);}async['psubscribe'](_0x573a4b,_0x5a5f2d,_0x2b3ea5,_0x1e696c){const _0x5d45cd=this,_0x1eec75=this['mintKey'](_0x573a4b,{'appId':_0x2b3ea5,'engineId':_0x1e696c});await this['eventClient']['psubscribe'](_0x1eec75,_0x6e7e6b=>{_0x6e7e6b&&_0x5d45cd['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x1eec75,_0x6e7e6b);}),this['eventClient']['on']('pmessage',(_0x501437,_0x218cb0,_0x4738ea)=>{if(_0x501437===_0x1eec75)try{const _0xbcc12a=JSON['parse'](_0x4738ea);_0x5a5f2d(_0x218cb0,_0xbcc12a);}catch(_0xfde1e4){_0x5d45cd['logger']['error']('Error\x20parsing\x20message:\x20'+_0x4738ea,_0xfde1e4);}});}async['punsubscribe'](_0x8c4d89,_0x14d9c6,_0x2cd5e2){const _0x38b4ce=this['mintKey'](_0x8c4d89,{'appId':_0x14d9c6,'engineId':_0x2cd5e2});await this['eventClient']['punsubscribe'](_0x38b4ce);}async['publish'](_0xd2f10a,_0x21b7e2,_0x5af1f9,_0x2e923b){const _0x11ccdd=this['mintKey'](_0xd2f10a,{'appId':_0x5af1f9,'engineId':_0x2e923b}),_0x3eac8f=await this['storeClient']['publish'](_0x11ccdd,JSON['stringify'](_0x21b7e2));return _0x3eac8f===0x1;}}exports['IORedisSubService']=IORedisSubService;
1
+ 'use strict';(function(_0xad6e96,_0x22b5ec){const _0x44d47b=_0x37f0,_0x2df614=_0xad6e96();while(!![]){try{const _0x425cdf=parseInt(_0x44d47b(0x1e4))/0x1+parseInt(_0x44d47b(0x1e2))/0x2+parseInt(_0x44d47b(0x1e1))/0x3*(-parseInt(_0x44d47b(0x1e5))/0x4)+parseInt(_0x44d47b(0x1e3))/0x5+parseInt(_0x44d47b(0x1e7))/0x6+-parseInt(_0x44d47b(0x1e6))/0x7+-parseInt(_0x44d47b(0x1e8))/0x8*(parseInt(_0x44d47b(0x1e9))/0x9);if(_0x425cdf===_0x22b5ec)break;else _0x2df614['push'](_0x2df614['shift']());}catch(_0x3d73aa){_0x2df614['push'](_0x2df614['shift']());}}}(_0x3366,0xbe8c9));function _0x37f0(_0x2ebbee,_0x5ed9b4){const _0x336655=_0x3366();return _0x37f0=function(_0x37f066,_0x5d73a7){_0x37f066=_0x37f066-0x1e1;let _0xc8f358=_0x336655[_0x37f066];return _0xc8f358;},_0x37f0(_0x2ebbee,_0x5ed9b4);}function _0x3366(){const _0x22a12f=['1194228pGsezS','6256650ylPnKO','483582IztPrw','603068SnZkZM','1708973aQSBUp','2132118nIkaKw','989976hexOhO','99kecLqf','6otghkI'];_0x3366=function(){return _0x22a12f;};return _0x3366();}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(_0x5ddae9,_0x4b462d){super(_0x5ddae9,_0x4b462d);}async['init'](_0x41cebb=key_1['HMNS'],_0x32d9aa,_0x3f7db3,_0x4eb42e){this['namespace']=_0x41cebb,this['logger']=_0x4eb42e,this['appId']=_0x32d9aa,this['engineId']=_0x3f7db3;}['transact'](){return this['eventClient']['multi']();}['mintKey'](_0x2fec0e,_0x2fe469){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x2fec0e,_0x2fe469);}async['subscribe'](_0x512ac2,_0x10eca0,_0x1fee22,_0x168c36){const _0x133880=this,_0x413a32=this['mintKey'](_0x512ac2,{'appId':_0x1fee22,'engineId':_0x168c36});await this['eventClient']['subscribe'](_0x413a32,_0x475bea=>{_0x475bea&&_0x133880['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x413a32,_0x475bea);}),this['eventClient']['on']('message',(_0x1ff4ec,_0xf4ed30)=>{if(_0x1ff4ec===_0x413a32)try{const _0x1eb408=JSON['parse'](_0xf4ed30);_0x10eca0(_0x413a32,_0x1eb408);}catch(_0x1743fe){_0x133880['logger']['error']('Error\x20parsing\x20message:\x20'+_0xf4ed30,_0x1743fe);}});}async['unsubscribe'](_0x229da1,_0x32f533,_0x5908ec){const _0x164910=this['mintKey'](_0x229da1,{'appId':_0x32f533,'engineId':_0x5908ec});await this['eventClient']['unsubscribe'](_0x164910);}async['psubscribe'](_0x725276,_0x5ad7e8,_0x31857b,_0x2595f8){const _0x2023e0=this,_0x3483b8=this['mintKey'](_0x725276,{'appId':_0x31857b,'engineId':_0x2595f8});await this['eventClient']['psubscribe'](_0x3483b8,_0x3e5130=>{_0x3e5130&&_0x2023e0['logger']['error']('Error\x20subscribing\x20to:\x20'+_0x3483b8,_0x3e5130);}),this['eventClient']['on']('pmessage',(_0x56e344,_0x522af9,_0x347510)=>{if(_0x56e344===_0x3483b8)try{const _0x4e243b=JSON['parse'](_0x347510);_0x5ad7e8(_0x522af9,_0x4e243b);}catch(_0x4c63db){_0x2023e0['logger']['error']('Error\x20parsing\x20message:\x20'+_0x347510,_0x4c63db);}});}async['punsubscribe'](_0x6b9df5,_0x292d38,_0x5cdc19){const _0x1ee9cf=this['mintKey'](_0x6b9df5,{'appId':_0x292d38,'engineId':_0x5cdc19});await this['eventClient']['punsubscribe'](_0x1ee9cf);}async['publish'](_0x26ea6e,_0xfe0869,_0x206b7b,_0x43bee2){const _0x10223f=this['mintKey'](_0x26ea6e,{'appId':_0x206b7b,'engineId':_0x43bee2}),_0x3dac95=await this['storeClient']['publish'](_0x10223f,JSON['stringify'](_0xfe0869));return _0x3dac95===0x1;}}exports['IORedisSubService']=IORedisSubService;
@@ -1 +1 @@
1
- 'use strict';(function(_0x37d9a4,_0x2a0344){const _0x172174=_0x5431,_0x2a8a69=_0x37d9a4();while(!![]){try{const _0x2688fb=parseInt(_0x172174(0x192))/0x1*(parseInt(_0x172174(0x194))/0x2)+parseInt(_0x172174(0x18f))/0x3+parseInt(_0x172174(0x196))/0x4*(parseInt(_0x172174(0x195))/0x5)+-parseInt(_0x172174(0x18e))/0x6+parseInt(_0x172174(0x190))/0x7+-parseInt(_0x172174(0x193))/0x8*(-parseInt(_0x172174(0x191))/0x9)+parseInt(_0x172174(0x18d))/0xa*(-parseInt(_0x172174(0x18c))/0xb);if(_0x2688fb===_0x2a0344)break;else _0x2a8a69['push'](_0x2a8a69['shift']());}catch(_0x3655e3){_0x2a8a69['push'](_0x2a8a69['shift']());}}}(_0x47ac,0x47eca));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['RedisSubService']=void 0x0;const key_1=require('../../../../modules/key'),index_1=require('../../index');function _0x47ac(){const _0x2fe194=['4004kdcyAP','186153VPVLIn','310WWeKeQ','3519546REWxwz','1129440AeuHcF','2906393RtxZYj','4053411JjXaaq','1pzsPeX','8qONJmr','55224YRONvT','680MZKwhk'];_0x47ac=function(){return _0x2fe194;};return _0x47ac();}function _0x5431(_0x39b740,_0x4fb90b){const _0x47ace3=_0x47ac();return _0x5431=function(_0x54311a,_0x464d52){_0x54311a=_0x54311a-0x18c;let _0x40d66d=_0x47ace3[_0x54311a];return _0x40d66d;},_0x5431(_0x39b740,_0x4fb90b);}class RedisSubService extends index_1['SubService']{constructor(_0x38a9c1,_0x35c314){super(_0x38a9c1,_0x35c314);}async['init'](_0x3d82da=key_1['HMNS'],_0x2eb02f,_0x1c07f0,_0x48f632){this['namespace']=_0x3d82da,this['logger']=_0x48f632,this['appId']=_0x2eb02f,this['engineId']=_0x1c07f0;}['transact'](){const _0x45f99e=this['eventClient']['multi']();return _0x45f99e;}['mintKey'](_0x34b882,_0x1b62c8){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x34b882,_0x1b62c8);}async['subscribe'](_0x398e10,_0x282d6e,_0x105816,_0x109a1f){if(this['eventClient']){const _0xa48eb=this,_0x1b8e50=this['mintKey'](_0x398e10,{'appId':_0x105816,'engineId':_0x109a1f});await this['eventClient']['subscribe'](_0x1b8e50,_0x30c8a2=>{try{const _0x3130df=JSON['parse'](_0x30c8a2);_0x282d6e(_0x1b8e50,_0x3130df);}catch(_0x551efe){_0xa48eb['logger']['error']('Error\x20parsing\x20message:\x20'+_0x30c8a2,_0x551efe);}});}}async['unsubscribe'](_0x3ce745,_0x24e835,_0xf340e2){const _0xd31a8e=this['mintKey'](_0x3ce745,{'appId':_0x24e835,'engineId':_0xf340e2});await this['eventClient']['unsubscribe'](_0xd31a8e);}async['psubscribe'](_0x997663,_0x488706,_0x435ad7,_0x1b3951){if(this['eventClient']){const _0x44f081=this,_0x430110=this['mintKey'](_0x997663,{'appId':_0x435ad7,'engineId':_0x1b3951});await this['eventClient']['pSubscribe'](_0x430110,(_0x3f9669,_0xeb8810)=>{try{const _0x159756=JSON['parse'](_0x3f9669);_0x488706(_0xeb8810,_0x159756);}catch(_0x2ffce8){_0x44f081['logger']['error']('Error\x20parsing\x20message:\x20'+_0x3f9669,_0x2ffce8);}});}}async['punsubscribe'](_0x5305c1,_0x5510fc,_0x5f35f9){const _0x3cb965=this['mintKey'](_0x5305c1,{'appId':_0x5510fc,'engineId':_0x5f35f9});await this['eventClient']['pUnsubscribe'](_0x3cb965);}async['publish'](_0x328029,_0x48c0ce,_0x567e78,_0x4d4b75){const _0x4a6ad5=this['mintKey'](_0x328029,{'appId':_0x567e78,'engineId':_0x4d4b75}),_0x1b8f22=await this['storeClient']['publish'](_0x4a6ad5,JSON['stringify'](_0x48c0ce));return _0x1b8f22>0x0;}}exports['RedisSubService']=RedisSubService;
1
+ 'use strict';(function(_0x542ff7,_0x20d953){const _0x430bb5=_0x51a9,_0x308127=_0x542ff7();while(!![]){try{const _0x59d28f=-parseInt(_0x430bb5(0xd3))/0x1*(parseInt(_0x430bb5(0xd2))/0x2)+parseInt(_0x430bb5(0xcf))/0x3*(parseInt(_0x430bb5(0xd0))/0x4)+-parseInt(_0x430bb5(0xd1))/0x5+parseInt(_0x430bb5(0xd5))/0x6+parseInt(_0x430bb5(0xd4))/0x7+-parseInt(_0x430bb5(0xd6))/0x8+parseInt(_0x430bb5(0xd8))/0x9*(parseInt(_0x430bb5(0xd7))/0xa);if(_0x59d28f===_0x20d953)break;else _0x308127['push'](_0x308127['shift']());}catch(_0x229a4d){_0x308127['push'](_0x308127['shift']());}}}(_0x35f9,0x86eb8));function _0x35f9(){const _0x320224=['2624520kiOkRV','5879424rbNUNE','6522430ZZtvPw','9porFHx','3NAMGJT','1883188vOHTdL','1134315FntyHR','794nWGSaI','1709wPQYoK','4427052MNmopi'];_0x35f9=function(){return _0x320224;};return _0x35f9();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['RedisSubService']=void 0x0;const key_1=require('../../../../modules/key'),index_1=require('../../index');function _0x51a9(_0x4029de,_0x3491c4){const _0x35f998=_0x35f9();return _0x51a9=function(_0x51a9c5,_0x138e8e){_0x51a9c5=_0x51a9c5-0xcf;let _0x454cc2=_0x35f998[_0x51a9c5];return _0x454cc2;},_0x51a9(_0x4029de,_0x3491c4);}class RedisSubService extends index_1['SubService']{constructor(_0x2bd542,_0x30c933){super(_0x2bd542,_0x30c933);}async['init'](_0x41ad8b=key_1['HMNS'],_0x19cd75,_0x3c8e3a,_0x356d38){this['namespace']=_0x41ad8b,this['logger']=_0x356d38,this['appId']=_0x19cd75,this['engineId']=_0x3c8e3a;}['transact'](){const _0x291f44=this['eventClient']['multi']();return _0x291f44;}['mintKey'](_0x3b82bd,_0x30cf3f){if(!this['namespace'])throw new Error('namespace\x20not\x20set');return key_1['KeyService']['mintKey'](this['namespace'],_0x3b82bd,_0x30cf3f);}async['subscribe'](_0x342742,_0xec1845,_0x45d1cd,_0x873b63){if(this['eventClient']){const _0x11d069=this,_0xe26417=this['mintKey'](_0x342742,{'appId':_0x45d1cd,'engineId':_0x873b63});await this['eventClient']['subscribe'](_0xe26417,_0x539eb9=>{try{const _0x4fd5f0=JSON['parse'](_0x539eb9);_0xec1845(_0xe26417,_0x4fd5f0);}catch(_0x4e6b8e){_0x11d069['logger']['error']('Error\x20parsing\x20message:\x20'+_0x539eb9,_0x4e6b8e);}});}}async['unsubscribe'](_0x3f47a1,_0x5c83ec,_0x343420){const _0x3e80f8=this['mintKey'](_0x3f47a1,{'appId':_0x5c83ec,'engineId':_0x343420});await this['eventClient']['unsubscribe'](_0x3e80f8);}async['psubscribe'](_0x2851fe,_0x173f32,_0x2112a4,_0x266928){if(this['eventClient']){const _0x3a7559=this,_0x2a9d35=this['mintKey'](_0x2851fe,{'appId':_0x2112a4,'engineId':_0x266928});await this['eventClient']['pSubscribe'](_0x2a9d35,(_0x9dd6ea,_0x57c281)=>{try{const _0x4a60bd=JSON['parse'](_0x9dd6ea);_0x173f32(_0x57c281,_0x4a60bd);}catch(_0x12be94){_0x3a7559['logger']['error']('Error\x20parsing\x20message:\x20'+_0x9dd6ea,_0x12be94);}});}}async['punsubscribe'](_0x39de67,_0x42f223,_0x58ebdc){const _0x172283=this['mintKey'](_0x39de67,{'appId':_0x42f223,'engineId':_0x58ebdc});await this['eventClient']['pUnsubscribe'](_0x172283);}async['publish'](_0x19cd9f,_0x24a428,_0x1b6ed1,_0x1151c6){const _0x3a309c=this['mintKey'](_0x19cd9f,{'appId':_0x1b6ed1,'engineId':_0x1151c6}),_0x43475a=await this['storeClient']['publish'](_0x3a309c,JSON['stringify'](_0x24a428));return _0x43475a>0x0;}}exports['RedisSubService']=RedisSubService;
@@ -1 +1 @@
1
- 'use strict';function _0x2739(){const _0x42d0ab=['136352wCBRei','5PNoCaw','13510ErWsiJ','1758RgGleX','4vNnlcw','3301410hpeUaj','1681735GeJMLk','4395776MpNMch','62894zDzOKd','414lNgwem','1798017fKAaoI'];_0x2739=function(){return _0x42d0ab;};return _0x2739();}(function(_0xdbad8a,_0x2d3595){const _0x4c9ef3=_0x5c64,_0x464fa7=_0xdbad8a();while(!![]){try{const _0x2933de=parseInt(_0x4c9ef3(0xf5))/0x1*(parseInt(_0x4c9ef3(0xfc))/0x2)+-parseInt(_0x4c9ef3(0xfe))/0x3*(parseInt(_0x4c9ef3(0xf8))/0x4)+-parseInt(_0x4c9ef3(0xfa))/0x5+-parseInt(_0x4c9ef3(0xf7))/0x6*(-parseInt(_0x4c9ef3(0xf6))/0x7)+parseInt(_0x4c9ef3(0xf4))/0x8*(parseInt(_0x4c9ef3(0xfd))/0x9)+parseInt(_0x4c9ef3(0xf9))/0xa+-parseInt(_0x4c9ef3(0xfb))/0xb;if(_0x2933de===_0x2d3595)break;else _0x464fa7['push'](_0x464fa7['shift']());}catch(_0x1e55f6){_0x464fa7['push'](_0x464fa7['shift']());}}}(_0x2739,0x7a754));function _0x5c64(_0x399bd2,_0x389eed){const _0x2739b2=_0x2739();return _0x5c64=function(_0x5c64d6,_0x360f24){_0x5c64d6=_0x5c64d6-0xf4;let _0x509733=_0x2739b2[_0x5c64d6];return _0x509733;},_0x5c64(_0x399bd2,_0x389eed);}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(_0x306993,_0x1854d4){this['cleanupTimeout']=null,this['isScout']=![],this['errorCount']=0x0,this['logger']=_0x1854d4,this['store']=_0x306993;}async['processWebHooks'](_0xf16b8d){const _0x432006=await this['store']['getActiveTaskQueue']();if(_0x432006){const [_0x458d3f,_0x394043,_0x56a2e8,..._0x33c1c8]=_0x432006['split'](key_1['WEBSEP']),_0x32159a=JSON['parse'](_0x33c1c8['join'](key_1['WEBSEP'])),_0x17c212=_0x394043+':processed',_0x574aec=await this['store']['processTaskQueue'](_0x394043,_0x17c212);_0x574aec?await _0xf16b8d(_0x458d3f,{..._0x32159a,'id':_0x574aec}):await this['store']['deleteProcessedTaskQueue'](_0x432006,_0x394043,_0x17c212,_0x56a2e8==='true'),setImmediate(()=>this['processWebHooks'](_0xf16b8d));}}async['enqueueWorkItems'](_0x8e16d0){await this['store']['addTaskQueues'](_0x8e16d0);}async['registerJobForCleanup'](_0x19e654,_0x4bfa=enums_1['HMSH_EXPIRE_DURATION'],_0xf74a6d){_0x4bfa>0x0&&await this['store']['expireJob'](_0x19e654,_0x4bfa);}async['registerTimeHook'](_0x2dffb4,_0xbdb465,_0x36b66e,_0x4102b1,_0x116aad=enums_1['HMSH_FIDELITY_SECONDS'],_0x4e894c,_0x45daa6){const _0x27d8ef=Date['now']()+_0x116aad*0x3e8,_0x5f53d8=enums_1['HMSH_FIDELITY_SECONDS']*0x3e8,_0x49d9da=Math['floor'](_0x27d8ef/_0x5f53d8)*_0x5f53d8;await this['store']['registerTimeHook'](_0x2dffb4,_0xbdb465,_0x36b66e,_0x4102b1,_0x49d9da,_0x4e894c,_0x45daa6);}async['shouldScout'](){const _0x3a0008=this['isScout'],_0x3fe8dd=_0x3a0008||(this['isScout']=await this['store']['reserveScoutRole']('time'));if(_0x3fe8dd)return!_0x3a0008&&setTimeout(()=>{this['isScout']=![];},enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8),!![];return![];}async['processTimeHooks'](_0x210e3b,_0x54ec43){if(await this['shouldScout']())try{const _0x233298=await this['store']['getNextTask'](_0x54ec43);if(Array['isArray'](_0x233298)){const [_0x4bb6ec,_0xb96e7a,_0x43bc47,_0x48bf1f,_0x50c9ac]=_0x233298;if(_0x50c9ac==='child'){}else{if(_0x50c9ac==='delist'){const _0x24e0a3=this['store']['mintKey'](hotmesh_1['KeyType']['SIGNALS'],{'appId':this['store']['appId']});await this['store']['delistSignalKey'](_0x24e0a3,_0xb96e7a);}else await _0x210e3b(_0xb96e7a,_0x43bc47,_0x48bf1f,_0x50c9ac);}await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x210e3b,_0x4bb6ec);}else{if(_0x233298)await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x210e3b);else{const _0x487439=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_FIDELITY_SECONDS']*0x3e8);this['cleanupTimeout']=_0x487439['timerId'],await _0x487439['promise'],this['errorCount']=0x0,this['processTimeHooks'](_0x210e3b);}}}catch(_0x12c136){this['logger']['warn']('task-process-timehooks-error',_0x12c136),await(0x0,utils_1['sleepFor'])(0x3e8*this['errorCount']++),this['errorCount']<0x5&&this['processTimeHooks'](_0x210e3b);}else{const _0x14ec06=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8*0x2*Math['random']());this['cleanupTimeout']=_0x14ec06['timerId'],await _0x14ec06['promise'],this['processTimeHooks'](_0x210e3b);}}['cancelCleanup'](){this['cleanupTimeout']!==undefined&&(clearTimeout(this['cleanupTimeout']),this['cleanupTimeout']=undefined);}async['getHookRule'](_0x32da14){const _0x2acdc4=await this['store']['getHookRules']();return _0x2acdc4?.[_0x32da14]?.[0x0];}async['registerWebHook'](_0x344ca5,_0x269a35,_0x5b75ce,_0x2e799a,_0x1de96f){const _0x2a2415=await this['getHookRule'](_0x344ca5);if(_0x2a2415){const _0x30f413=_0x2a2415['conditions']['match'][0x0]['expected'],_0x26d0a0=pipe_1['Pipe']['resolve'](_0x30f413,_0x269a35),_0x11f966=_0x269a35['metadata']['jid'],_0x33b493=_0x269a35['metadata']['gid'],_0x159082=_0x2a2415['to'],_0x4a5170=[_0x159082,_0x5b75ce,_0x33b493,_0x11f966]['join'](key_1['WEBSEP']),_0x5c70d3={'topic':_0x344ca5,'resolved':_0x26d0a0,'jobId':_0x4a5170,'expire':_0x2e799a};return await this['store']['setHookSignal'](_0x5c70d3,_0x1de96f),_0x11f966;}else throw new Error('signaler.registerWebHook:error:\x20hook\x20rule\x20not\x20found');}async['processWebHookSignal'](_0x599f71,_0x2ce9ad){const _0x44cccb=await this['getHookRule'](_0x599f71);if(_0x44cccb){const _0x550af9={'$self':{'hook':{'data':_0x2ce9ad}},'$hook':{'data':_0x2ce9ad}},_0x5546b9=_0x44cccb['conditions']['match'][0x0]['actual'],_0x5762eb=pipe_1['Pipe']['resolve'](_0x5546b9,_0x550af9),_0x447b47=await this['store']['getHookSignal'](_0x599f71,_0x5762eb);if(!_0x447b47)return undefined;const [_0x17d660,_0x4c0d1f,_0x3d2ef8,..._0x5ad48e]=_0x447b47['split'](key_1['WEBSEP']);return[_0x5ad48e['join'](key_1['WEBSEP']),_0x44cccb['to'],_0x4c0d1f,_0x3d2ef8];}else throw new Error('signal-not-found');}async['deleteWebHookSignal'](_0x25c173,_0x16899c){const _0x2cb450=await this['getHookRule'](_0x25c173);if(_0x2cb450){const _0x20964e={'$self':{'hook':{'data':_0x16899c}},'$hook':{'data':_0x16899c}},_0x530c2a=_0x2cb450['conditions']['match'][0x0]['actual'],_0xe1f79d=pipe_1['Pipe']['resolve'](_0x530c2a,_0x20964e);return await this['store']['deleteHookSignal'](_0x25c173,_0xe1f79d);}else throw new Error('signaler.process:error:\x20hook\x20rule\x20not\x20found');}}exports['TaskService']=TaskService;
1
+ 'use strict';(function(_0x3c7663,_0x182217){const _0x46290e=_0x3522,_0x49e3a1=_0x3c7663();while(!![]){try{const _0x431b7c=-parseInt(_0x46290e(0x19d))/0x1+parseInt(_0x46290e(0x19c))/0x2+-parseInt(_0x46290e(0x1a3))/0x3*(-parseInt(_0x46290e(0x1a1))/0x4)+-parseInt(_0x46290e(0x1a2))/0x5*(parseInt(_0x46290e(0x19e))/0x6)+parseInt(_0x46290e(0x19b))/0x7+-parseInt(_0x46290e(0x1a0))/0x8+parseInt(_0x46290e(0x19f))/0x9;if(_0x431b7c===_0x182217)break;else _0x49e3a1['push'](_0x49e3a1['shift']());}catch(_0x31cb62){_0x49e3a1['push'](_0x49e3a1['shift']());}}}(_0x3834,0xee221));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['TaskService']=void 0x0;function _0x3834(){const _0x427f2f=['6445120GiqZzD','421572SxoQNE','4199210ClqNcD','6xiwWel','3788701xcAyxT','1947148hamGYM','256301TTfmBj','6BgdBeJ','10364157JztIwe'];_0x3834=function(){return _0x427f2f;};return _0x3834();}function _0x3522(_0x15b4aa,_0x4d5a35){const _0x383400=_0x3834();return _0x3522=function(_0x35224a,_0x3559c8){_0x35224a=_0x35224a-0x19b;let _0x320e29=_0x383400[_0x35224a];return _0x320e29;},_0x3522(_0x15b4aa,_0x4d5a35);}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(_0x1481fa,_0x592970){this['cleanupTimeout']=null,this['isScout']=![],this['errorCount']=0x0,this['logger']=_0x592970,this['store']=_0x1481fa;}async['processWebHooks'](_0xb33f59){const _0x35794e=await this['store']['getActiveTaskQueue']();if(_0x35794e){const [_0x137b2c,_0x4b5f93,_0x18a1f9,..._0x4d889b]=_0x35794e['split'](key_1['WEBSEP']),_0x1d52ea=JSON['parse'](_0x4d889b['join'](key_1['WEBSEP'])),_0x3dd9b0=_0x4b5f93+':processed',_0x21a9c8=await this['store']['processTaskQueue'](_0x4b5f93,_0x3dd9b0);_0x21a9c8?await _0xb33f59(_0x137b2c,{..._0x1d52ea,'id':_0x21a9c8}):await this['store']['deleteProcessedTaskQueue'](_0x35794e,_0x4b5f93,_0x3dd9b0,_0x18a1f9==='true'),setImmediate(()=>this['processWebHooks'](_0xb33f59));}}async['enqueueWorkItems'](_0x3f8c98){await this['store']['addTaskQueues'](_0x3f8c98);}async['registerJobForCleanup'](_0x592d65,_0x32fd98=enums_1['HMSH_EXPIRE_DURATION'],_0x26e471){_0x32fd98>0x0&&await this['store']['expireJob'](_0x592d65,_0x32fd98);}async['registerTimeHook'](_0x3570f4,_0x4c7587,_0x17103e,_0x214af6,_0x80c086=enums_1['HMSH_FIDELITY_SECONDS'],_0x237593,_0x20ecae){const _0x2e5c48=Date['now']()+_0x80c086*0x3e8,_0x230c4f=enums_1['HMSH_FIDELITY_SECONDS']*0x3e8,_0x3a6934=Math['floor'](_0x2e5c48/_0x230c4f)*_0x230c4f;await this['store']['registerTimeHook'](_0x3570f4,_0x4c7587,_0x17103e,_0x214af6,_0x3a6934,_0x237593,_0x20ecae);}async['shouldScout'](){const _0x661a60=this['isScout'],_0x1ca77b=_0x661a60||(this['isScout']=await this['store']['reserveScoutRole']('time'));if(_0x1ca77b)return!_0x661a60&&setTimeout(()=>{this['isScout']=![];},enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8),!![];return![];}async['processTimeHooks'](_0x3bcc36,_0x15cd42){if(await this['shouldScout']())try{const _0x308510=await this['store']['getNextTask'](_0x15cd42);if(Array['isArray'](_0x308510)){const [_0x2a1708,_0x3f00b4,_0x12689c,_0xd28596,_0x5cedf3]=_0x308510;if(_0x5cedf3==='child'){}else{if(_0x5cedf3==='delist'){const _0x30bab3=this['store']['mintKey'](hotmesh_1['KeyType']['SIGNALS'],{'appId':this['store']['appId']});await this['store']['delistSignalKey'](_0x30bab3,_0x3f00b4);}else await _0x3bcc36(_0x3f00b4,_0x12689c,_0xd28596,_0x5cedf3);}await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x3bcc36,_0x2a1708);}else{if(_0x308510)await(0x0,utils_1['sleepFor'])(0x0),this['errorCount']=0x0,this['processTimeHooks'](_0x3bcc36);else{const _0x5a0c79=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_FIDELITY_SECONDS']*0x3e8);this['cleanupTimeout']=_0x5a0c79['timerId'],await _0x5a0c79['promise'],this['errorCount']=0x0,this['processTimeHooks'](_0x3bcc36);}}}catch(_0x2d06e7){this['logger']['warn']('task-process-timehooks-error',_0x2d06e7),await(0x0,utils_1['sleepFor'])(0x3e8*this['errorCount']++),this['errorCount']<0x5&&this['processTimeHooks'](_0x3bcc36);}else{const _0x4edc23=(0x0,utils_1['XSleepFor'])(enums_1['HMSH_SCOUT_INTERVAL_SECONDS']*0x3e8*0x2*Math['random']());this['cleanupTimeout']=_0x4edc23['timerId'],await _0x4edc23['promise'],this['processTimeHooks'](_0x3bcc36);}}['cancelCleanup'](){this['cleanupTimeout']!==undefined&&(clearTimeout(this['cleanupTimeout']),this['cleanupTimeout']=undefined);}async['getHookRule'](_0x4f9d8a){const _0x5d280f=await this['store']['getHookRules']();return _0x5d280f?.[_0x4f9d8a]?.[0x0];}async['registerWebHook'](_0x48e5f5,_0x26d26f,_0x167542,_0x5e32c1,_0x321430){const _0x472acc=await this['getHookRule'](_0x48e5f5);if(_0x472acc){const _0x162b60=_0x472acc['conditions']['match'][0x0]['expected'],_0x230771=pipe_1['Pipe']['resolve'](_0x162b60,_0x26d26f),_0x3c2988=_0x26d26f['metadata']['jid'],_0x368dbf=_0x26d26f['metadata']['gid'],_0x3d8e84=_0x472acc['to'],_0x43c148=[_0x3d8e84,_0x167542,_0x368dbf,_0x3c2988]['join'](key_1['WEBSEP']),_0x4a3179={'topic':_0x48e5f5,'resolved':_0x230771,'jobId':_0x43c148,'expire':_0x5e32c1};return await this['store']['setHookSignal'](_0x4a3179,_0x321430),_0x3c2988;}else throw new Error('signaler.registerWebHook:error:\x20hook\x20rule\x20not\x20found');}async['processWebHookSignal'](_0x399746,_0x4df58){const _0x10ff67=await this['getHookRule'](_0x399746);if(_0x10ff67){const _0x1c7e68={'$self':{'hook':{'data':_0x4df58}},'$hook':{'data':_0x4df58}},_0x2a3f55=_0x10ff67['conditions']['match'][0x0]['actual'],_0x16c474=pipe_1['Pipe']['resolve'](_0x2a3f55,_0x1c7e68),_0x3c3f48=await this['store']['getHookSignal'](_0x399746,_0x16c474);if(!_0x3c3f48)return undefined;const [_0x1654e6,_0x2ccd72,_0x39dac2,..._0x4dc0ce]=_0x3c3f48['split'](key_1['WEBSEP']);return[_0x4dc0ce['join'](key_1['WEBSEP']),_0x10ff67['to'],_0x2ccd72,_0x39dac2];}else throw new Error('signal-not-found');}async['deleteWebHookSignal'](_0xd631e6,_0x4e5570){const _0x23879a=await this['getHookRule'](_0xd631e6);if(_0x23879a){const _0xe9d6a6={'$self':{'hook':{'data':_0x4e5570}},'$hook':{'data':_0x4e5570}},_0x9b9d49=_0x23879a['conditions']['match'][0x0]['actual'],_0x1e543f=pipe_1['Pipe']['resolve'](_0x9b9d49,_0xe9d6a6);return await this['store']['deleteHookSignal'](_0xd631e6,_0x1e543f);}else throw new Error('signaler.process:error:\x20hook\x20rule\x20not\x20found');}}exports['TaskService']=TaskService;
@@ -1 +1 @@
1
- 'use strict';(function(_0x15f5f2,_0x23e015){const _0x1c4a37=_0x588a,_0x4f25ed=_0x15f5f2();while(!![]){try{const _0x3693f0=-parseInt(_0x1c4a37(0x1b1))/0x1+-parseInt(_0x1c4a37(0x1b4))/0x2*(-parseInt(_0x1c4a37(0x1b3))/0x3)+-parseInt(_0x1c4a37(0x1b6))/0x4*(parseInt(_0x1c4a37(0x1af))/0x5)+-parseInt(_0x1c4a37(0x1b0))/0x6+parseInt(_0x1c4a37(0x1b2))/0x7*(-parseInt(_0x1c4a37(0x1b5))/0x8)+-parseInt(_0x1c4a37(0x1b7))/0x9*(parseInt(_0x1c4a37(0x1b8))/0xa)+parseInt(_0x1c4a37(0x1ba))/0xb*(parseInt(_0x1c4a37(0x1b9))/0xc);if(_0x3693f0===_0x23e015)break;else _0x4f25ed['push'](_0x4f25ed['shift']());}catch(_0x3da5d9){_0x4f25ed['push'](_0x4f25ed['shift']());}}}(_0x3218,0xb93b9));function _0x588a(_0x4993f3,_0x21ee56){const _0x3218db=_0x3218();return _0x588a=function(_0x588ab7,_0x161ea6){_0x588ab7=_0x588ab7-0x1af;let _0x14591c=_0x3218db[_0x588ab7];return _0x14591c;},_0x588a(_0x4993f3,_0x21ee56);}var __importDefault=this&&this['__importDefault']||function(_0x21c505){return _0x21c505&&_0x21c505['__esModule']?_0x21c505:{'default':_0x21c505};};function _0x3218(){const _0xaf2874=['187SVlfuq','305mIvezb','8030616punlYS','720441HfFteF','194719kZnZGe','2886795TmLiCG','2YBCrep','152vwpfxV','12332UQTBhe','97839cMushB','640Ftmrwm','2306580eTGnlY'];_0x3218=function(){return _0xaf2874;};return _0x3218();}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(_0x47082d,_0x2c1802,_0x1df85f,_0x201302){this['leg']=0x1,this['appId']=_0x47082d,this['config']=_0x2c1802,this['metadata']=_0x1df85f,this['context']=_0x201302;}['getJobParentSpanId'](){return this['context']['metadata']['spn'];}['getActivityParentSpanId'](_0x4601af){return _0x4601af===0x1?this['context'][this['config']['parent']]['output']?.['metadata']?.['l2s']:this['context']['$self']['output']?.['metadata']?.['l1s'];}['getTraceId'](){return this['context']['metadata']['trc'];}['startJobSpan'](){const _0x139092='JOB/'+this['appId']+'/'+this['config']['subscribes']+'/1',_0x48ca77=this['getTraceId'](),_0x2a8e0f=this['getJobParentSpanId'](),_0x2244a1=this['getSpanAttrs'](0x1),_0x1170e8=this['startSpan'](_0x48ca77,_0x2a8e0f,_0x139092,_0x2244a1);return this['jobSpan']=_0x1170e8,this['setTelemetryContext'](_0x1170e8,0x1),this;}['startActivitySpan'](_0x1c8c96=this['leg']){const _0x12c550=this['config']['type']['toUpperCase']()+'/'+this['appId']+'/'+this['metadata']['aid']+'/'+_0x1c8c96,_0x25fb5a=this['getTraceId'](),_0x1c940e=this['getActivityParentSpanId'](_0x1c8c96),_0x18113b=this['getSpanAttrs'](_0x1c8c96),_0x102001=this['startSpan'](_0x25fb5a,_0x1c940e,_0x12c550,_0x18113b);return this['setTelemetryContext'](_0x102001,_0x1c8c96),this['span']=_0x102001,this;}['startStreamSpan'](_0x203eb2,_0x2716c0){let _0xc462a6;if(_0x2716c0===stream_1['StreamRole']['SYSTEM'])_0xc462a6='SYSTEM';else{if(_0x2716c0===stream_1['StreamRole']['WORKER'])_0xc462a6='EXECUTE';else _0x203eb2['type']===stream_1['StreamDataType']['RESULT']||_0x203eb2['type']===stream_1['StreamDataType']['RESPONSE']?_0xc462a6='FANIN':_0xc462a6='FANOUT';}const _0x5c9053=_0x203eb2['metadata']['topic']?'/'+_0x203eb2['metadata']['topic']:'',_0x105ce8=_0xc462a6+'/'+this['appId']+'/'+_0x203eb2['metadata']['aid']+_0x5c9053,_0x11358b=this['getStreamSpanAttrs'](_0x203eb2),_0x5fe49f=this['startSpan'](_0x203eb2['metadata']['trc'],_0x203eb2['metadata']['spn'],_0x105ce8,_0x11358b);return this['span']=_0x5fe49f,this;}['startSpan'](_0x27d34f,_0x1d9de8,_0x3e2d52,_0x54ed71){this['traceId']=_0x27d34f,this['spanId']=_0x1d9de8;const _0x8cfdd7=telemetry_1['trace']['getTracer'](package_json_1['default']['name'],package_json_1['default']['version']),_0x3cd7a3=this['getParentSpanContext'](),_0x242a6e=_0x8cfdd7['startSpan'](_0x3e2d52,{'kind':telemetry_1['SpanKind']['CLIENT'],'attributes':_0x54ed71,'root':!_0x3cd7a3},_0x3cd7a3);return _0x242a6e;}['mapActivityAttributes'](){if(this['config']['telemetry']){const _0x18ff5c=new mapper_1['MapperService'](this['config']['telemetry'],this['context'])['mapRules'](),_0x3b62a2={...Object['keys'](_0x18ff5c)['reduce']((_0x2dcebc,_0x392ce3)=>{return['string','boolean','number']['includes'](typeof _0x18ff5c[_0x392ce3])&&(_0x2dcebc['app.activity.data.'+_0x392ce3]=_0x18ff5c[_0x392ce3]),_0x2dcebc;},{})};this['span']?.['setAttributes'](_0x3b62a2);}}['setActivityAttributes'](_0x10e0ec){this['span']?.['setAttributes'](_0x10e0ec);}['setStreamAttributes'](_0xe79c2b){this['span']?.['setAttributes'](_0xe79c2b);}['setJobAttributes'](_0x3131bf){this['jobSpan']?.['setAttributes'](_0x3131bf);}['endJobSpan'](){this['endSpan'](this['jobSpan']);}['endActivitySpan'](){this['endSpan'](this['span']);}['endStreamSpan'](){this['endSpan'](this['span']);}['endSpan'](_0x119675){_0x119675&&_0x119675['end']();}['getParentSpanContext'](){if(this['traceId']&&this['spanId']){const _0x2c2ea5={'traceId':this['traceId'],'spanId':this['spanId'],'isRemote':!![],'traceFlags':0x1},_0x5cc24a=telemetry_1['trace']['setSpanContext'](telemetry_1['context']['active'](),_0x2c2ea5);return _0x5cc24a;}}['getSpanAttrs'](_0x23fe25){return{...Object['keys'](this['context']['metadata'])['reduce']((_0x5479bd,_0x14922a)=>{return _0x14922a!=='trc'&&(_0x5479bd['app.job.'+_0x14922a]=this['context']['metadata'][_0x14922a]),_0x5479bd;},{}),...Object['keys'](this['metadata'])['reduce']((_0x5718ba,_0x47abd4)=>{return _0x5718ba['app.activity.'+_0x47abd4]=this['metadata'][_0x47abd4],_0x5718ba;},{}),'app.activity.leg':_0x23fe25};}['getStreamSpanAttrs'](_0x39547b){return{...Object['keys'](_0x39547b['metadata'])['reduce']((_0x5c510c,_0x2615a5)=>{return _0x2615a5!=='trc'&&_0x2615a5!=='spn'&&(_0x5c510c['app.stream.'+_0x2615a5]=_0x39547b['metadata'][_0x2615a5]),_0x5c510c;},{})};}['setTelemetryContext'](_0x3d1fc9,_0x6c24da){!this['context']['metadata']['trc']&&(this['context']['metadata']['trc']=_0x3d1fc9['spanContext']()['traceId']),_0x6c24da===0x1?(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l1s']=_0x3d1fc9['spanContext']()['spanId']):(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l2s']=_0x3d1fc9['spanContext']()['spanId']);}['setActivityError'](_0x349be3){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0x349be3});}['setStreamError'](_0x559939){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0x559939});}static['addTargetTelemetryPaths'](_0x49a236,_0x4c86ab,_0x5b0ee3,_0x39bbb3){_0x39bbb3===0x1?(!(_0x4c86ab['parent']in _0x49a236)&&(_0x49a236[_0x4c86ab['parent']]=[]),_0x49a236[_0x4c86ab['parent']]['push'](_0x4c86ab['parent']+'/output/metadata/l2s')):(!(_0x5b0ee3['aid']in _0x49a236)&&(_0x49a236[_0x5b0ee3['aid']]=[]),_0x49a236[_0x5b0ee3['aid']]['push'](_0x5b0ee3['aid']+'/output/metadata/l1s'));}static['bindJobTelemetryToState'](_0x1b862c,_0x56294e,_0x6b0409){_0x56294e['type']==='trigger'&&(_0x1b862c['metadata/trc']=_0x6b0409['metadata']['trc']);}static['bindActivityTelemetryToState'](_0x166c8,_0x346ffb,_0x2beaa0,_0x487862,_0x534a67){if(_0x346ffb['type']==='trigger')_0x166c8[_0x2beaa0['aid']+'/output/metadata/l1s']=_0x487862['$self']['output']['metadata']['l1s'],_0x166c8[_0x2beaa0['aid']+'/output/metadata/l2s']=_0x487862['$self']['output']['metadata']['l2s'];else{if(utils_1['polyfill']['resolveActivityType'](_0x346ffb['type'])==='hook'&&_0x534a67===0x1)_0x166c8[_0x2beaa0['aid']+'/output/metadata/l1s']=_0x487862['$self']['output']['metadata']['l1s'],_0x166c8[_0x2beaa0['aid']+'/output/metadata/l2s']=_0x487862['$self']['output']['metadata']['l1s'];else{if(_0x346ffb['type']==='signal'&&_0x534a67===0x1)_0x166c8[_0x2beaa0['aid']+'/output/metadata/l1s']=_0x487862['$self']['output']['metadata']['l1s'],_0x166c8[_0x2beaa0['aid']+'/output/metadata/l2s']=_0x487862['$self']['output']['metadata']['l1s'];else{const _0x2c857b='l'+_0x534a67+'s';_0x166c8[_0x2beaa0['aid']+'/output/metadata/'+_0x2c857b]=_0x487862['$self']['output']['metadata'][_0x2c857b];}}}}}exports['TelemetryService']=TelemetryService;
1
+ 'use strict';(function(_0x1fcfc6,_0x490116){const _0x3dd3e6=_0x1221,_0x39933c=_0x1fcfc6();while(!![]){try{const _0x59c3b0=parseInt(_0x3dd3e6(0x7a))/0x1*(parseInt(_0x3dd3e6(0x79))/0x2)+-parseInt(_0x3dd3e6(0x72))/0x3+-parseInt(_0x3dd3e6(0x74))/0x4*(-parseInt(_0x3dd3e6(0x73))/0x5)+parseInt(_0x3dd3e6(0x76))/0x6*(parseInt(_0x3dd3e6(0x78))/0x7)+-parseInt(_0x3dd3e6(0x7c))/0x8+-parseInt(_0x3dd3e6(0x75))/0x9+parseInt(_0x3dd3e6(0x77))/0xa*(-parseInt(_0x3dd3e6(0x7b))/0xb);if(_0x59c3b0===_0x490116)break;else _0x39933c['push'](_0x39933c['shift']());}catch(_0x36a39a){_0x39933c['push'](_0x39933c['shift']());}}}(_0x34bd,0xb31a4));function _0x1221(_0x4e52bb,_0x298fd6){const _0x34bdc6=_0x34bd();return _0x1221=function(_0x122131,_0x3c56b4){_0x122131=_0x122131-0x72;let _0x27c2b0=_0x34bdc6[_0x122131];return _0x27c2b0;},_0x1221(_0x4e52bb,_0x298fd6);}function _0x34bd(){const _0xd68f7e=['21EODGDQ','2azZdnB','260213yLEABm','135421IiLbky','1596480SFqTSu','1562826NpeXXm','125xGIoXi','156924cQXJnV','2901141gokysV','1440264aLnNBp','150FoOBkq'];_0x34bd=function(){return _0xd68f7e;};return _0x34bd();}var __importDefault=this&&this['__importDefault']||function(_0x33f008){return _0x33f008&&_0x33f008['__esModule']?_0x33f008:{'default':_0x33f008};};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(_0x168e21,_0x19dbab,_0x310361,_0x9b418e){this['leg']=0x1,this['appId']=_0x168e21,this['config']=_0x19dbab,this['metadata']=_0x310361,this['context']=_0x9b418e;}['getJobParentSpanId'](){return this['context']['metadata']['spn'];}['getActivityParentSpanId'](_0x10f635){return _0x10f635===0x1?this['context'][this['config']['parent']]['output']?.['metadata']?.['l2s']:this['context']['$self']['output']?.['metadata']?.['l1s'];}['getTraceId'](){return this['context']['metadata']['trc'];}['startJobSpan'](){const _0x2fbb22='JOB/'+this['appId']+'/'+this['config']['subscribes']+'/1',_0x4df786=this['getTraceId'](),_0x4b9c13=this['getJobParentSpanId'](),_0x502601=this['getSpanAttrs'](0x1),_0x3978d5=this['startSpan'](_0x4df786,_0x4b9c13,_0x2fbb22,_0x502601);return this['jobSpan']=_0x3978d5,this['setTelemetryContext'](_0x3978d5,0x1),this;}['startActivitySpan'](_0x5dd44d=this['leg']){const _0x5c510a=this['config']['type']['toUpperCase']()+'/'+this['appId']+'/'+this['metadata']['aid']+'/'+_0x5dd44d,_0x2c0fe9=this['getTraceId'](),_0x2c5451=this['getActivityParentSpanId'](_0x5dd44d),_0x132efb=this['getSpanAttrs'](_0x5dd44d),_0x262682=this['startSpan'](_0x2c0fe9,_0x2c5451,_0x5c510a,_0x132efb);return this['setTelemetryContext'](_0x262682,_0x5dd44d),this['span']=_0x262682,this;}['startStreamSpan'](_0x27d4bb,_0x1c256f){let _0xe1c51e;if(_0x1c256f===stream_1['StreamRole']['SYSTEM'])_0xe1c51e='SYSTEM';else{if(_0x1c256f===stream_1['StreamRole']['WORKER'])_0xe1c51e='EXECUTE';else _0x27d4bb['type']===stream_1['StreamDataType']['RESULT']||_0x27d4bb['type']===stream_1['StreamDataType']['RESPONSE']?_0xe1c51e='FANIN':_0xe1c51e='FANOUT';}const _0x4c4fd0=_0x27d4bb['metadata']['topic']?'/'+_0x27d4bb['metadata']['topic']:'',_0x1207eb=_0xe1c51e+'/'+this['appId']+'/'+_0x27d4bb['metadata']['aid']+_0x4c4fd0,_0x7f6e36=this['getStreamSpanAttrs'](_0x27d4bb),_0x31996d=this['startSpan'](_0x27d4bb['metadata']['trc'],_0x27d4bb['metadata']['spn'],_0x1207eb,_0x7f6e36);return this['span']=_0x31996d,this;}['startSpan'](_0x1c9e7b,_0x305e4e,_0x3b5c70,_0x1bfcf4){this['traceId']=_0x1c9e7b,this['spanId']=_0x305e4e;const _0x39258f=telemetry_1['trace']['getTracer'](package_json_1['default']['name'],package_json_1['default']['version']),_0x4426c7=this['getParentSpanContext'](),_0x397af4=_0x39258f['startSpan'](_0x3b5c70,{'kind':telemetry_1['SpanKind']['CLIENT'],'attributes':_0x1bfcf4,'root':!_0x4426c7},_0x4426c7);return _0x397af4;}['mapActivityAttributes'](){if(this['config']['telemetry']){const _0x2dc49b=new mapper_1['MapperService'](this['config']['telemetry'],this['context'])['mapRules'](),_0x55ce36={...Object['keys'](_0x2dc49b)['reduce']((_0x33b7dc,_0x57482f)=>{return['string','boolean','number']['includes'](typeof _0x2dc49b[_0x57482f])&&(_0x33b7dc['app.activity.data.'+_0x57482f]=_0x2dc49b[_0x57482f]),_0x33b7dc;},{})};this['span']?.['setAttributes'](_0x55ce36);}}['setActivityAttributes'](_0x10ef09){this['span']?.['setAttributes'](_0x10ef09);}['setStreamAttributes'](_0x2e982f){this['span']?.['setAttributes'](_0x2e982f);}['setJobAttributes'](_0x595dac){this['jobSpan']?.['setAttributes'](_0x595dac);}['endJobSpan'](){this['endSpan'](this['jobSpan']);}['endActivitySpan'](){this['endSpan'](this['span']);}['endStreamSpan'](){this['endSpan'](this['span']);}['endSpan'](_0x3a458c){_0x3a458c&&_0x3a458c['end']();}['getParentSpanContext'](){if(this['traceId']&&this['spanId']){const _0x1dfafe={'traceId':this['traceId'],'spanId':this['spanId'],'isRemote':!![],'traceFlags':0x1},_0x54dd7b=telemetry_1['trace']['setSpanContext'](telemetry_1['context']['active'](),_0x1dfafe);return _0x54dd7b;}}['getSpanAttrs'](_0x27cb69){return{...Object['keys'](this['context']['metadata'])['reduce']((_0x2bd9cf,_0x3f52f0)=>{return _0x3f52f0!=='trc'&&(_0x2bd9cf['app.job.'+_0x3f52f0]=this['context']['metadata'][_0x3f52f0]),_0x2bd9cf;},{}),...Object['keys'](this['metadata'])['reduce']((_0x40cb85,_0xe55ae9)=>{return _0x40cb85['app.activity.'+_0xe55ae9]=this['metadata'][_0xe55ae9],_0x40cb85;},{}),'app.activity.leg':_0x27cb69};}['getStreamSpanAttrs'](_0xf3ec57){return{...Object['keys'](_0xf3ec57['metadata'])['reduce']((_0x25f803,_0x1574ef)=>{return _0x1574ef!=='trc'&&_0x1574ef!=='spn'&&(_0x25f803['app.stream.'+_0x1574ef]=_0xf3ec57['metadata'][_0x1574ef]),_0x25f803;},{})};}['setTelemetryContext'](_0x44e56c,_0x5838a6){!this['context']['metadata']['trc']&&(this['context']['metadata']['trc']=_0x44e56c['spanContext']()['traceId']),_0x5838a6===0x1?(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l1s']=_0x44e56c['spanContext']()['spanId']):(!this['context']['$self']['output']['metadata']&&(this['context']['$self']['output']['metadata']={}),this['context']['$self']['output']['metadata']['l2s']=_0x44e56c['spanContext']()['spanId']);}['setActivityError'](_0xca79ed){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0xca79ed});}['setStreamError'](_0x1659ff){this['span']?.['setStatus']({'code':telemetry_1['SpanStatusCode']['ERROR'],'message':_0x1659ff});}static['addTargetTelemetryPaths'](_0xc497bc,_0x51fb42,_0x33ffd6,_0x4eaa2b){_0x4eaa2b===0x1?(!(_0x51fb42['parent']in _0xc497bc)&&(_0xc497bc[_0x51fb42['parent']]=[]),_0xc497bc[_0x51fb42['parent']]['push'](_0x51fb42['parent']+'/output/metadata/l2s')):(!(_0x33ffd6['aid']in _0xc497bc)&&(_0xc497bc[_0x33ffd6['aid']]=[]),_0xc497bc[_0x33ffd6['aid']]['push'](_0x33ffd6['aid']+'/output/metadata/l1s'));}static['bindJobTelemetryToState'](_0xf04904,_0x72cfd5,_0x386a84){_0x72cfd5['type']==='trigger'&&(_0xf04904['metadata/trc']=_0x386a84['metadata']['trc']);}static['bindActivityTelemetryToState'](_0x3e5c6c,_0x310511,_0x97cada,_0x290f87,_0x3c44c6){if(_0x310511['type']==='trigger')_0x3e5c6c[_0x97cada['aid']+'/output/metadata/l1s']=_0x290f87['$self']['output']['metadata']['l1s'],_0x3e5c6c[_0x97cada['aid']+'/output/metadata/l2s']=_0x290f87['$self']['output']['metadata']['l2s'];else{if(utils_1['polyfill']['resolveActivityType'](_0x310511['type'])==='hook'&&_0x3c44c6===0x1)_0x3e5c6c[_0x97cada['aid']+'/output/metadata/l1s']=_0x290f87['$self']['output']['metadata']['l1s'],_0x3e5c6c[_0x97cada['aid']+'/output/metadata/l2s']=_0x290f87['$self']['output']['metadata']['l1s'];else{if(_0x310511['type']==='signal'&&_0x3c44c6===0x1)_0x3e5c6c[_0x97cada['aid']+'/output/metadata/l1s']=_0x290f87['$self']['output']['metadata']['l1s'],_0x3e5c6c[_0x97cada['aid']+'/output/metadata/l2s']=_0x290f87['$self']['output']['metadata']['l1s'];else{const _0x447ad4='l'+_0x3c44c6+'s';_0x3e5c6c[_0x97cada['aid']+'/output/metadata/'+_0x447ad4]=_0x290f87['$self']['output']['metadata'][_0x447ad4];}}}}}exports['TelemetryService']=TelemetryService;
@@ -1 +1 @@
1
- 'use strict';(function(_0x3df943,_0x2dd111){const _0x21bcb0=_0x2207,_0x1d5043=_0x3df943();while(!![]){try{const _0x2b4bb7=parseInt(_0x21bcb0(0x186))/0x1*(-parseInt(_0x21bcb0(0x183))/0x2)+parseInt(_0x21bcb0(0x189))/0x3*(parseInt(_0x21bcb0(0x180))/0x4)+parseInt(_0x21bcb0(0x185))/0x5*(parseInt(_0x21bcb0(0x18a))/0x6)+parseInt(_0x21bcb0(0x188))/0x7*(-parseInt(_0x21bcb0(0x18b))/0x8)+parseInt(_0x21bcb0(0x187))/0x9+-parseInt(_0x21bcb0(0x182))/0xa+parseInt(_0x21bcb0(0x184))/0xb*(parseInt(_0x21bcb0(0x181))/0xc);if(_0x2b4bb7===_0x2dd111)break;else _0x1d5043['push'](_0x1d5043['shift']());}catch(_0x35590a){_0x1d5043['push'](_0x1d5043['shift']());}}}(_0x2057,0x4633e));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'](_0x345fdf,_0x32bd74,_0x3fe81c,_0x533a53,_0x3ef399){const _0x8f6977=[];if(Array['isArray'](_0x533a53['workers']))for(const _0x54239d of _0x533a53['workers']){await factory_1['ConnectorService']['initClients'](_0x54239d);const _0x259cb6=new WorkerService();_0x259cb6['verifyWorkerFields'](_0x54239d),_0x259cb6['namespace']=_0x345fdf,_0x259cb6['appId']=_0x32bd74,_0x259cb6['guid']=_0x3fe81c,_0x259cb6['callback']=_0x54239d['callback'],_0x259cb6['topic']=_0x54239d['topic'],_0x259cb6['config']=_0x533a53,_0x259cb6['logger']=_0x3ef399,await _0x259cb6['initStoreChannel'](_0x259cb6,_0x54239d['store']),await _0x259cb6['initSubChannel'](_0x259cb6,_0x54239d['sub'],_0x54239d['pub']),await _0x259cb6['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x259cb6['subscriptionHandler'](),_0x32bd74),await _0x259cb6['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x259cb6['subscriptionHandler'](),_0x32bd74,_0x259cb6['topic']),await _0x259cb6['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x259cb6['subscriptionHandler'](),_0x32bd74,_0x259cb6['guid']),await _0x259cb6['initStreamChannel'](_0x259cb6,_0x54239d['stream'],_0x54239d['store']),_0x259cb6['router']=await _0x259cb6['initRouter'](_0x54239d,_0x3ef399);const _0x3501d7=_0x259cb6['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x259cb6['appId'],'topic':_0x54239d['topic']});await _0x259cb6['router']['consumeMessages'](_0x3501d7,'WORKER',_0x259cb6['guid'],_0x54239d['callback']),_0x259cb6['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x8f6977['push'](_0x259cb6);}return _0x8f6977;}['verifyWorkerFields'](_0x4c78b4){if(!(0x0,utils_1['identifyProvider'])(_0x4c78b4['store'])||!(0x0,utils_1['identifyProvider'])(_0x4c78b4['stream'])||!(0x0,utils_1['identifyProvider'])(_0x4c78b4['sub'])||!(_0x4c78b4['topic']&&_0x4c78b4['callback']))throw new Error('worker\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields\x20along\x20with\x20a\x20callback\x20function\x20and\x20topic.');}async['initStoreChannel'](_0x56051f,_0x46b189){_0x56051f['store']=await factory_4['StoreServiceFactory']['init'](_0x46b189,_0x56051f['namespace'],_0x56051f['appId'],_0x56051f['logger']);}async['initSubChannel'](_0x229302,_0x35505e,_0x18f105){_0x229302['subscribe']=await factory_3['SubServiceFactory']['init'](_0x35505e,_0x18f105,_0x229302['namespace'],_0x229302['appId'],_0x229302['guid'],_0x229302['logger']);}async['initStreamChannel'](_0x56b31d,_0x4608fe,_0x13096b){_0x56b31d['stream']=await factory_2['StreamServiceFactory']['init'](_0x4608fe,_0x13096b,_0x56b31d['namespace'],_0x56b31d['appId'],_0x56b31d['logger']);}async['initRouter'](_0x4892f9,_0x55b423){const _0x1d6b9b=await this['store']['getThrottleRate'](_0x4892f9['topic']);return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['WORKER'],'topic':_0x4892f9['topic'],'reclaimDelay':_0x4892f9['reclaimDelay'],'reclaimCount':_0x4892f9['reclaimCount'],'throttle':_0x1d6b9b},this['stream'],_0x55b423);}['subscriptionHandler'](){const _0x3176fb=this;return async(_0x45a6c4,_0x4a02a7)=>{_0x3176fb['logger']['debug']('worker-event-received',{'topic':_0x45a6c4,'type':_0x4a02a7['type']});if(_0x4a02a7['type']==='throttle')_0x4a02a7['topic']!==null&&_0x3176fb['throttle'](_0x4a02a7['throttle']);else{if(_0x4a02a7['type']==='ping')_0x3176fb['sayPong'](_0x3176fb['appId'],_0x3176fb['guid'],_0x4a02a7['originator'],_0x4a02a7['details']);else _0x4a02a7['type']==='rollcall'&&(_0x4a02a7['topic']!==null&&_0x3176fb['doRollCall'](_0x4a02a7));}};}async['doRollCall'](_0x2b331b){let _0x1baf49=0x0;const _0xa69b76=!isNaN(_0x2b331b['max'])?_0x2b331b['max']:enums_1['HMSH_QUORUM_ROLLCALL_CYCLES'];if(this['rollCallInterval'])clearTimeout(this['rollCallInterval']);const _0x541a38=_0x2b331b['interval']/0x2,_0x404f2f=_0x541a38+Math['ceil'](Math['random']()*_0x541a38);do{await(0x0,utils_1['sleepFor'])(Math['ceil'](Math['random']()*0x3e8)),await this['sayPong'](this['appId'],this['guid'],null,!![],_0x2b331b['signature']);if(!_0x2b331b['interval'])return;const {promise:_0x59a546,timerId:_0x2f6241}=(0x0,utils_1['XSleepFor'])(_0x404f2f*0x3e8);this['rollCallInterval']=_0x2f6241,await _0x59a546;}while(this['rollCallInterval']&&_0x1baf49++<_0xa69b76-0x1);}['cancelRollCall'](){this['rollCallInterval']&&(clearTimeout(this['rollCallInterval']),delete this['rollCallInterval']);}['stop'](){this['cancelRollCall']();}async['sayPong'](_0x583c69,_0x3b01d3,_0x5a6433,_0xd4f6a0=![],_0x19e39a=![]){let _0xb2df0;if(_0xd4f6a0){const _0x5b6dd6={'appId':this['appId'],'topic':this['topic']};_0xb2df0={'engine_id':this['guid'],'namespace':this['namespace'],'app_id':this['appId'],'worker_topic':this['topic'],'stream':this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x5b6dd6),'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':_0x19e39a?this['callback']['toString']():undefined};}this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'pong','guid':_0x3b01d3,'originator':_0x5a6433,'profile':_0xb2df0},_0x583c69);}async['throttle'](_0x562e44){this['router']?.['setThrottle'](_0x562e44);}}function _0x2207(_0x4da059,_0x56c7a4){const _0x205753=_0x2057();return _0x2207=function(_0x2207a2,_0x49dd29){_0x2207a2=_0x2207a2-0x180;let _0x485e0b=_0x205753[_0x2207a2];return _0x485e0b;},_0x2207(_0x4da059,_0x56c7a4);}function _0x2057(){const _0x5bacc5=['4638456hEYXgu','120253MpPXII','1187148uhoMKo','2159898DGOOZb','40ojCcRH','4ODlYAu','132CbaRWo','5655480slbqFm','22dQORXO','197263oCtZWH','5nMjtIe','48123xbbBqz'];_0x2057=function(){return _0x5bacc5;};return _0x2057();}exports['WorkerService']=WorkerService;
1
+ 'use strict';(function(_0x35759a,_0x35b906){const _0x4d678a=_0x42cc,_0x18c1db=_0x35759a();while(!![]){try{const _0x4f8036=parseInt(_0x4d678a(0x18d))/0x1+-parseInt(_0x4d678a(0x192))/0x2*(parseInt(_0x4d678a(0x193))/0x3)+-parseInt(_0x4d678a(0x18c))/0x4+-parseInt(_0x4d678a(0x195))/0x5+-parseInt(_0x4d678a(0x191))/0x6*(-parseInt(_0x4d678a(0x190))/0x7)+parseInt(_0x4d678a(0x194))/0x8*(parseInt(_0x4d678a(0x18e))/0x9)+parseInt(_0x4d678a(0x18f))/0xa;if(_0x4f8036===_0x35b906)break;else _0x18c1db['push'](_0x18c1db['shift']());}catch(_0x50080a){_0x18c1db['push'](_0x18c1db['shift']());}}}(_0x1672,0xda838));function _0x42cc(_0x329fa5,_0x5cb34b){const _0x167285=_0x1672();return _0x42cc=function(_0x42cc99,_0x56063b){_0x42cc99=_0x42cc99-0x18c;let _0x4d9bc2=_0x167285[_0x42cc99];return _0x4d9bc2;},_0x42cc(_0x329fa5,_0x5cb34b);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['WorkerService']=void 0x0;function _0x1672(){const _0x5e74bc=['11327589lFvhsy','10844130Izmbby','7lbxQRi','6516546YAOtgv','124476QwqafJ','30XUxjRp','8Xxspep','7615090BJvhfX','2608048xRiifc','263317OBljJC'];_0x1672=function(){return _0x5e74bc;};return _0x1672();}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'](_0x207e12,_0x11f358,_0x1abdb6,_0x47ae9a,_0x1ad3e7){const _0x20c773=[];if(Array['isArray'](_0x47ae9a['workers']))for(const _0x4bf65e of _0x47ae9a['workers']){await factory_1['ConnectorService']['initClients'](_0x4bf65e);const _0x18b6c8=new WorkerService();_0x18b6c8['verifyWorkerFields'](_0x4bf65e),_0x18b6c8['namespace']=_0x207e12,_0x18b6c8['appId']=_0x11f358,_0x18b6c8['guid']=_0x1abdb6,_0x18b6c8['callback']=_0x4bf65e['callback'],_0x18b6c8['topic']=_0x4bf65e['topic'],_0x18b6c8['config']=_0x47ae9a,_0x18b6c8['logger']=_0x1ad3e7,await _0x18b6c8['initStoreChannel'](_0x18b6c8,_0x4bf65e['store']),await _0x18b6c8['initSubChannel'](_0x18b6c8,_0x4bf65e['sub'],_0x4bf65e['pub']??_0x4bf65e['store']),await _0x18b6c8['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x18b6c8['subscriptionHandler'](),_0x11f358),await _0x18b6c8['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x18b6c8['subscriptionHandler'](),_0x11f358,_0x18b6c8['topic']),await _0x18b6c8['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x18b6c8['subscriptionHandler'](),_0x11f358,_0x18b6c8['guid']),await _0x18b6c8['initStreamChannel'](_0x18b6c8,_0x4bf65e['stream'],_0x4bf65e['store']),_0x18b6c8['router']=await _0x18b6c8['initRouter'](_0x4bf65e,_0x1ad3e7);const _0x2782ee=_0x18b6c8['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x18b6c8['appId'],'topic':_0x4bf65e['topic']});await _0x18b6c8['router']['consumeMessages'](_0x2782ee,'WORKER',_0x18b6c8['guid'],_0x4bf65e['callback']),_0x18b6c8['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x20c773['push'](_0x18b6c8);}return _0x20c773;}['verifyWorkerFields'](_0x2667dc){if(!(0x0,utils_1['identifyProvider'])(_0x2667dc['store'])||!(0x0,utils_1['identifyProvider'])(_0x2667dc['stream'])||!(0x0,utils_1['identifyProvider'])(_0x2667dc['sub'])||!(_0x2667dc['topic']&&_0x2667dc['callback']))throw new Error('worker\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields\x20along\x20with\x20a\x20callback\x20function\x20and\x20topic.');}async['initStoreChannel'](_0x1cb472,_0x379565){_0x1cb472['store']=await factory_4['StoreServiceFactory']['init'](_0x379565,_0x1cb472['namespace'],_0x1cb472['appId'],_0x1cb472['logger']);}async['initSubChannel'](_0x308a0c,_0x3133a3,_0x44474e){_0x308a0c['subscribe']=await factory_3['SubServiceFactory']['init'](_0x3133a3,_0x44474e,_0x308a0c['namespace'],_0x308a0c['appId'],_0x308a0c['guid'],_0x308a0c['logger']);}async['initStreamChannel'](_0x3cda58,_0x445cd6,_0x4ede8f){_0x3cda58['stream']=await factory_2['StreamServiceFactory']['init'](_0x445cd6,_0x4ede8f,_0x3cda58['namespace'],_0x3cda58['appId'],_0x3cda58['logger']);}async['initRouter'](_0x1b6c7a,_0x320555){const _0x3c0cba=await this['store']['getThrottleRate'](_0x1b6c7a['topic']);return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['WORKER'],'topic':_0x1b6c7a['topic'],'reclaimDelay':_0x1b6c7a['reclaimDelay'],'reclaimCount':_0x1b6c7a['reclaimCount'],'throttle':_0x3c0cba},this['stream'],_0x320555);}['subscriptionHandler'](){const _0x8cc430=this;return async(_0x104302,_0x25167c)=>{_0x8cc430['logger']['debug']('worker-event-received',{'topic':_0x104302,'type':_0x25167c['type']});if(_0x25167c['type']==='throttle')_0x25167c['topic']!==null&&_0x8cc430['throttle'](_0x25167c['throttle']);else{if(_0x25167c['type']==='ping')_0x8cc430['sayPong'](_0x8cc430['appId'],_0x8cc430['guid'],_0x25167c['originator'],_0x25167c['details']);else _0x25167c['type']==='rollcall'&&(_0x25167c['topic']!==null&&_0x8cc430['doRollCall'](_0x25167c));}};}async['doRollCall'](_0x64e8b){let _0x450803=0x0;const _0x6ca4a7=!isNaN(_0x64e8b['max'])?_0x64e8b['max']:enums_1['HMSH_QUORUM_ROLLCALL_CYCLES'];if(this['rollCallInterval'])clearTimeout(this['rollCallInterval']);const _0x8d43d9=_0x64e8b['interval']/0x2,_0x475f50=_0x8d43d9+Math['ceil'](Math['random']()*_0x8d43d9);do{await(0x0,utils_1['sleepFor'])(Math['ceil'](Math['random']()*0x3e8)),await this['sayPong'](this['appId'],this['guid'],null,!![],_0x64e8b['signature']);if(!_0x64e8b['interval'])return;const {promise:_0x478f43,timerId:_0x5f5d6c}=(0x0,utils_1['XSleepFor'])(_0x475f50*0x3e8);this['rollCallInterval']=_0x5f5d6c,await _0x478f43;}while(this['rollCallInterval']&&_0x450803++<_0x6ca4a7-0x1);}['cancelRollCall'](){this['rollCallInterval']&&(clearTimeout(this['rollCallInterval']),delete this['rollCallInterval']);}['stop'](){this['cancelRollCall']();}async['sayPong'](_0x67f339,_0x4b2b7a,_0xfde1a1,_0x4a2d54=![],_0x369c75=![]){let _0x23d184;if(_0x4a2d54){const _0x925f4={'appId':this['appId'],'topic':this['topic']};_0x23d184={'engine_id':this['guid'],'namespace':this['namespace'],'app_id':this['appId'],'worker_topic':this['topic'],'stream':this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x925f4),'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':_0x369c75?this['callback']['toString']():undefined};}this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'pong','guid':_0x4b2b7a,'originator':_0xfde1a1,'profile':_0x23d184},_0x67f339);}async['throttle'](_0x2d7411){this['router']?.['setThrottle'](_0x2d7411);}}exports['WorkerService']=WorkerService;
@@ -3,7 +3,7 @@ import { HotMesh as HotMeshService } from '../services/hotmesh';
3
3
  import { HookRules } from './hook';
4
4
  import { StreamData, StreamDataResponse } from './stream';
5
5
  import { LogLevel } from './logger';
6
- import { ProviderClient, ProviderConfig } from './provider';
6
+ import { ProviderClient, ProviderConfig, ProvidersConfig } from './provider';
7
7
  declare enum KeyType {
8
8
  APP = "APP",
9
9
  THROTTLE_RATE = "THROTTLE_RATE",
@@ -46,14 +46,7 @@ type HotMeshEngine = {
46
46
  pub?: ProviderClient;
47
47
  search?: ProviderClient;
48
48
  redis?: ProviderConfig;
49
- connection?: ProviderConfig;
50
- connections?: {
51
- store: ProviderConfig;
52
- stream: ProviderConfig;
53
- sub: ProviderConfig;
54
- pub?: ProviderConfig;
55
- search?: ProviderConfig;
56
- };
49
+ connection?: ProviderConfig | ProvidersConfig;
57
50
  reclaimDelay?: number;
58
51
  reclaimCount?: number;
59
52
  readonly?: boolean;
@@ -66,14 +59,7 @@ type HotMeshWorker = {
66
59
  sub?: ProviderClient;
67
60
  search?: ProviderClient;
68
61
  redis?: ProviderConfig;
69
- connection?: ProviderConfig;
70
- connections?: {
71
- store: ProviderConfig;
72
- stream: ProviderConfig;
73
- sub: ProviderConfig;
74
- pub?: ProviderConfig;
75
- search?: ProviderConfig;
76
- };
62
+ connection?: ProviderConfig | ProvidersConfig;
77
63
  reclaimDelay?: number;
78
64
  reclaimCount?: number;
79
65
  callback: (payload: StreamData) => Promise<StreamDataResponse>;
@@ -1,19 +1,11 @@
1
1
  import { MeshOS } from '../services/meshos';
2
2
  import { WorkflowSearchSchema } from './meshflow';
3
- import * as Types from './provider';
4
- import { ProviderConfig } from './provider';
3
+ import { ProviderConfig, ProvidersConfig } from './provider';
5
4
  export type DB = {
6
5
  name: string;
7
6
  label: string;
8
7
  search: boolean;
9
- connection?: Types.ProviderConfig;
10
- connections?: {
11
- store: ProviderConfig;
12
- stream: ProviderConfig;
13
- sub: ProviderConfig;
14
- pub?: ProviderConfig;
15
- search?: ProviderConfig;
16
- };
8
+ connection: ProviderConfig | ProvidersConfig;
17
9
  };
18
10
  export type SubClassInstance<T extends typeof MeshOS> = T extends abstract new (...args: any) => infer R ? R : never;
19
11
  export type AllSubclassInstances = SubClassInstance<(typeof MeshOS)['classes'][keyof (typeof MeshOS)['classes']]>;
@@ -21,6 +21,14 @@ export interface NatsConnection extends ProviderClient {
21
21
  jetstreamManager(options?: NatsJetStreamOptions): Promise<NatsJetStreamManager>;
22
22
  close(): Promise<void>;
23
23
  }
24
+ export interface NatsSubscriptionType {
25
+ unsubscribe(): void;
26
+ drain(): Promise<void>;
27
+ subject: string;
28
+ queue?: string;
29
+ isClosed: boolean;
30
+ [Symbol.asyncIterator](): AsyncIterableIterator<NatsMessageType>;
31
+ }
24
32
  export type NatsClientType = NatsConnection;
25
33
  export type NatsClassType = (options: NatsClientOptions) => Promise<NatsConnection>;
26
34
  export interface NatsJetStreamClient {
@@ -10,15 +10,24 @@ export interface PostgresClientOptions {
10
10
  export type PostgresJobEnumType = 'status' | 'jdata' | 'adata' | 'udata' | 'jmark' | 'hmark' | 'other';
11
11
  export type PostgresClassType = {
12
12
  new (options: PostgresClientOptions): PostgresClientType;
13
+ };
14
+ export type PostgresPoolType = {
15
+ new (options: PostgresClientOptions): PostgresPoolClientType;
13
16
  connect: (options: PostgresClientOptions) => Promise<PostgresClientType>;
17
+ query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
14
18
  };
15
19
  export interface PostgresClientType {
20
+ connect: () => Promise<PostgresClientType>;
16
21
  query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
17
22
  end: () => Promise<void>;
18
23
  }
19
24
  export interface PostgresPoolClientType {
20
- query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
25
+ connect: () => Promise<PostgresClientType>;
21
26
  release: () => void;
27
+ end: () => Promise<void>;
28
+ query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
29
+ idleCount: number;
30
+ totalCount: number;
22
31
  }
23
32
  export interface PostgresQueryResultType {
24
33
  rows: any[];
@@ -23,6 +23,7 @@ export type TransactionResultList = (string | number)[];
23
23
  export type ProviderConfig = {
24
24
  class: any;
25
25
  options: StringAnyType;
26
+ provider?: string;
26
27
  };
27
28
  export type ProvidersConfig = {
28
29
  sub: ProviderConfig;