@hotmeshio/hotmesh 0.3.7 → 0.3.9

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 (157) hide show
  1. package/README.md +15 -18
  2. package/build/index.d.ts +4 -1
  3. package/build/index.js +7 -1
  4. package/build/modules/key.js +1 -1
  5. package/build/modules/utils.d.ts +12 -4
  6. package/build/modules/utils.js +1 -1
  7. package/build/package.json +14 -7
  8. package/build/services/activities/activity.d.ts +9 -9
  9. package/build/services/activities/activity.js +1 -1
  10. package/build/services/activities/await.d.ts +2 -2
  11. package/build/services/activities/await.js +1 -1
  12. package/build/services/activities/cycle.d.ts +2 -2
  13. package/build/services/activities/cycle.js +1 -1
  14. package/build/services/activities/hook.d.ts +2 -2
  15. package/build/services/activities/hook.js +1 -1
  16. package/build/services/activities/index.js +1 -1
  17. package/build/services/activities/interrupt.js +1 -1
  18. package/build/services/activities/signal.js +1 -1
  19. package/build/services/activities/trigger.d.ts +3 -3
  20. package/build/services/activities/trigger.js +1 -1
  21. package/build/services/activities/worker.d.ts +2 -2
  22. package/build/services/activities/worker.js +1 -1
  23. package/build/services/collator/index.d.ts +9 -9
  24. package/build/services/collator/index.js +1 -1
  25. package/build/services/compiler/deployer.d.ts +4 -4
  26. package/build/services/compiler/deployer.js +1 -1
  27. package/build/services/compiler/index.d.ts +4 -4
  28. package/build/services/compiler/index.js +1 -1
  29. package/build/services/compiler/validator.d.ts +3 -3
  30. package/build/services/compiler/validator.js +1 -1
  31. package/build/services/connector/factory.d.ts +6 -0
  32. package/build/services/connector/factory.js +56 -0
  33. package/build/services/connector/index.d.ts +13 -4
  34. package/build/services/connector/index.js +30 -23
  35. package/build/services/connector/providers/ioredis.d.ts +9 -0
  36. package/build/services/connector/providers/ioredis.js +26 -0
  37. package/build/services/connector/providers/nats.d.ts +9 -0
  38. package/build/services/connector/providers/nats.js +26 -0
  39. package/build/services/connector/providers/postgres.d.ts +9 -0
  40. package/build/services/connector/providers/postgres.js +39 -0
  41. package/build/services/connector/providers/redis.d.ts +9 -0
  42. package/build/services/connector/providers/redis.js +38 -0
  43. package/build/services/engine/index.d.ts +12 -12
  44. package/build/services/engine/index.js +1 -1
  45. package/build/services/exporter/index.d.ts +3 -3
  46. package/build/services/exporter/index.js +1 -1
  47. package/build/services/hotmesh/index.js +4 -4
  48. package/build/services/mapper/index.js +1 -1
  49. package/build/services/meshcall/index.d.ts +5 -4
  50. package/build/services/meshcall/index.js +31 -14
  51. package/build/services/meshdata/index.d.ts +6 -6
  52. package/build/services/meshdata/index.js +7 -15
  53. package/build/services/meshflow/connection.d.ts +3 -2
  54. package/build/services/meshflow/exporter.d.ts +3 -3
  55. package/build/services/meshflow/exporter.js +1 -1
  56. package/build/services/meshflow/index.d.ts +2 -0
  57. package/build/services/meshflow/index.js +2 -0
  58. package/build/services/meshflow/search.js +12 -4
  59. package/build/services/meshflow/worker.js +7 -7
  60. package/build/services/meshos/index.d.ts +1 -4
  61. package/build/services/meshos/index.js +11 -44
  62. package/build/services/pipe/functions/array.js +1 -1
  63. package/build/services/pipe/functions/bitwise.js +1 -1
  64. package/build/services/pipe/functions/conditional.js +1 -1
  65. package/build/services/pipe/functions/cron.d.ts +2 -0
  66. package/build/services/pipe/functions/cron.js +1 -1
  67. package/build/services/pipe/functions/date.js +1 -1
  68. package/build/services/pipe/functions/index.js +1 -1
  69. package/build/services/pipe/functions/json.js +1 -1
  70. package/build/services/pipe/functions/logical.js +1 -1
  71. package/build/services/pipe/functions/math.js +1 -1
  72. package/build/services/pipe/functions/number.js +1 -1
  73. package/build/services/pipe/functions/object.js +1 -1
  74. package/build/services/pipe/functions/string.js +1 -1
  75. package/build/services/pipe/functions/symbol.js +1 -1
  76. package/build/services/pipe/functions/unary.js +1 -1
  77. package/build/services/pipe/index.js +1 -1
  78. package/build/services/quorum/index.d.ts +5 -5
  79. package/build/services/quorum/index.js +1 -1
  80. package/build/services/reporter/index.d.ts +2 -2
  81. package/build/services/reporter/index.js +1 -1
  82. package/build/services/router/index.d.ts +8 -13
  83. package/build/services/router/index.js +1 -1
  84. package/build/services/search/factory.d.ts +2 -2
  85. package/build/services/search/factory.js +1 -1
  86. package/build/services/search/index.d.ts +5 -4
  87. package/build/services/search/providers/redis/ioredis.js +1 -1
  88. package/build/services/search/providers/redis/redis.js +1 -1
  89. package/build/services/serializer/index.js +1 -1
  90. package/build/services/store/factory.d.ts +3 -3
  91. package/build/services/store/factory.js +1 -1
  92. package/build/services/store/index.d.ts +18 -17
  93. package/build/services/store/providers/redis/_base.d.ts +13 -15
  94. package/build/services/store/providers/redis/_base.js +1 -1
  95. package/build/services/store/providers/redis/ioredis.d.ts +2 -2
  96. package/build/services/store/providers/redis/ioredis.js +1 -1
  97. package/build/services/store/providers/redis/redis.d.ts +2 -2
  98. package/build/services/store/providers/redis/redis.js +1 -1
  99. package/build/services/store/providers/store-initializable.js +1 -1
  100. package/build/services/stream/factory.d.ts +3 -3
  101. package/build/services/stream/factory.js +16 -4
  102. package/build/services/stream/index.d.ts +57 -18
  103. package/build/services/stream/index.js +2 -1
  104. package/build/services/stream/providers/nats/nats.d.ts +59 -0
  105. package/build/services/stream/providers/nats/nats.js +1 -0
  106. package/build/services/stream/providers/postgres/_deploy.d.ts +2 -1
  107. package/build/services/stream/providers/postgres/_deploy.js +1 -1
  108. package/build/services/stream/providers/postgres/postgres.d.ts +0 -0
  109. package/build/services/stream/providers/postgres/postgres.js +0 -0
  110. package/build/services/stream/providers/redis/ioredis.d.ts +53 -14
  111. package/build/services/stream/providers/redis/ioredis.js +1 -1
  112. package/build/services/stream/providers/redis/redis.d.ts +54 -15
  113. package/build/services/stream/providers/redis/redis.js +1 -1
  114. package/build/services/stream/providers/stream-initializable.d.ts +1 -2
  115. package/build/services/stream/providers/stream-initializable.js +1 -1
  116. package/build/services/sub/factory.d.ts +2 -2
  117. package/build/services/sub/factory.js +1 -1
  118. package/build/services/sub/index.d.ts +6 -5
  119. package/build/services/sub/providers/redis/ioredis.d.ts +1 -1
  120. package/build/services/sub/providers/redis/ioredis.js +1 -1
  121. package/build/services/sub/providers/redis/redis.d.ts +4 -4
  122. package/build/services/sub/providers/redis/redis.js +1 -1
  123. package/build/services/task/index.d.ts +5 -5
  124. package/build/services/task/index.js +1 -1
  125. package/build/services/telemetry/index.js +1 -1
  126. package/build/services/worker/index.d.ts +9 -9
  127. package/build/services/worker/index.js +1 -1
  128. package/build/types/hotmesh.d.ts +26 -14
  129. package/build/types/index.d.ts +6 -5
  130. package/build/types/manifest.d.ts +1 -9
  131. package/build/types/meshcall.d.ts +12 -7
  132. package/build/types/meshflow.d.ts +3 -7
  133. package/build/types/nats.d.ts +150 -0
  134. package/build/types/nats.js +2 -0
  135. package/build/types/postgres.d.ts +48 -0
  136. package/build/types/postgres.js +2 -0
  137. package/build/types/provider.d.ts +26 -0
  138. package/build/types/provider.js +2 -0
  139. package/build/types/redis.d.ts +33 -15
  140. package/build/types/stream.d.ts +65 -1
  141. package/index.ts +10 -4
  142. package/package.json +14 -7
  143. package/typedoc.json +2 -1
  144. package/types/hotmesh.ts +139 -22
  145. package/types/index.ts +26 -17
  146. package/types/manifest.ts +1 -10
  147. package/types/meshcall.ts +38 -13
  148. package/types/meshflow.ts +2 -7
  149. package/types/nats.ts +231 -0
  150. package/types/postgres.ts +54 -0
  151. package/types/provider.ts +71 -0
  152. package/types/redis.ts +63 -18
  153. package/types/stream.ts +85 -1
  154. package/build/services/connector/clients/ioredis.d.ts +0 -13
  155. package/build/services/connector/clients/ioredis.js +0 -48
  156. package/build/services/connector/clients/redis.d.ts +0 -13
  157. package/build/services/connector/clients/redis.js +0 -60
@@ -5,8 +5,8 @@ import { StoreService } from '../store';
5
5
  import { StreamService } from '../stream';
6
6
  import { SubService } from '../sub';
7
7
  import { HotMeshConfig, HotMeshWorker } from '../../types/hotmesh';
8
+ import { ProviderClient, ProviderTransaction } from '../../types/provider';
8
9
  import { RollCallMessage, SubscriptionCallback } from '../../types/quorum';
9
- import { RedisClient, RedisMulti } from '../../types/redis';
10
10
  import { StreamData, StreamDataResponse } from '../../types/stream';
11
11
  declare class WorkerService {
12
12
  namespace: string;
@@ -15,10 +15,10 @@ declare class WorkerService {
15
15
  topic: string;
16
16
  config: HotMeshConfig;
17
17
  callback: (streamData: StreamData) => Promise<StreamDataResponse | void>;
18
- store: StoreService<RedisClient, RedisMulti> | null;
19
- stream: StreamService<RedisClient, RedisMulti> | null;
20
- subscribe: SubService<RedisClient, RedisMulti> | null;
21
- router: Router | null;
18
+ store: StoreService<ProviderClient, ProviderTransaction> | null;
19
+ stream: StreamService<ProviderClient, ProviderTransaction> | null;
20
+ subscribe: SubService<ProviderClient, ProviderTransaction> | null;
21
+ router: Router<typeof this.stream> | null;
22
22
  logger: ILogger;
23
23
  reporting: boolean;
24
24
  inited: string;
@@ -26,10 +26,10 @@ declare class WorkerService {
26
26
  constructor();
27
27
  static init(namespace: string, appId: string, guid: string, config: HotMeshConfig, logger: ILogger): Promise<WorkerService[]>;
28
28
  verifyWorkerFields(worker: HotMeshWorker): void;
29
- initStoreChannel(service: WorkerService, store: RedisClient): Promise<void>;
30
- initSubChannel(service: WorkerService, sub: RedisClient, store: RedisClient): Promise<void>;
31
- initStreamChannel(service: WorkerService, stream: RedisClient, store: RedisClient): Promise<void>;
32
- initRouter(worker: HotMeshWorker, logger: ILogger): Promise<Router>;
29
+ initStoreChannel(service: WorkerService, store: ProviderClient): Promise<void>;
30
+ initSubChannel(service: WorkerService, sub: ProviderClient, store: ProviderClient): Promise<void>;
31
+ initStreamChannel(service: WorkerService, stream: ProviderClient, store: ProviderClient): Promise<void>;
32
+ initRouter(worker: HotMeshWorker, logger: ILogger): Promise<Router<StreamService<ProviderClient, ProviderTransaction>>>;
33
33
  subscriptionHandler(): SubscriptionCallback;
34
34
  doRollCall(message: RollCallMessage): Promise<void>;
35
35
  cancelRollCall(): void;
@@ -1 +1 @@
1
- 'use strict';function _0x497c(_0x38dc5f,_0x462aee){const _0x25abf1=_0x25ab();return _0x497c=function(_0x497cd5,_0x22ecb7){_0x497cd5=_0x497cd5-0x84;let _0x86423=_0x25abf1[_0x497cd5];return _0x86423;},_0x497c(_0x38dc5f,_0x462aee);}(function(_0x1274a7,_0x1fe865){const _0x2e7ce1=_0x497c,_0x4d508a=_0x1274a7();while(!![]){try{const _0x57250b=-parseInt(_0x2e7ce1(0x89))/0x1+parseInt(_0x2e7ce1(0x8c))/0x2+parseInt(_0x2e7ce1(0x88))/0x3*(parseInt(_0x2e7ce1(0x86))/0x4)+-parseInt(_0x2e7ce1(0x84))/0x5*(-parseInt(_0x2e7ce1(0x8b))/0x6)+-parseInt(_0x2e7ce1(0x8a))/0x7+-parseInt(_0x2e7ce1(0x8d))/0x8+-parseInt(_0x2e7ce1(0x87))/0x9*(-parseInt(_0x2e7ce1(0x85))/0xa);if(_0x57250b===_0x1fe865)break;else _0x4d508a['push'](_0x4d508a['shift']());}catch(_0x2a083c){_0x4d508a['push'](_0x4d508a['shift']());}}}(_0x25ab,0x673a4));function _0x25ab(){const _0x150e97=['984954DLiNBV','5436104YqaBpX','5wBQIEU','543070QtxOpk','103088sLWsde','63dTsUKK','72FfkDdv','437999mtVKFR','4981067xBLTrV','4564554xZBENy'];_0x25ab=function(){return _0x150e97;};return _0x25ab();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['WorkerService']=void 0x0;const key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),connector_1=require('../connector'),router_1=require('../router'),stream_1=require('../../types/stream'),enums_1=require('../../modules/enums'),factory_1=require('../stream/factory'),factory_2=require('../sub/factory'),factory_3=require('../store/factory');class WorkerService{constructor(){this['reporting']=![];}static async['init'](_0x3bfd1e,_0x47f5b0,_0x3ad826,_0x23c0b1,_0x20aacf){const _0x2b66a5=[];if(Array['isArray'](_0x23c0b1['workers']))for(const _0x3047fd of _0x23c0b1['workers']){await connector_1['ConnectorService']['initRedisClients'](_0x3047fd['redis']?.['class'],_0x3047fd['redis']?.['options'],_0x3047fd);const _0x5820fd=new WorkerService();_0x5820fd['verifyWorkerFields'](_0x3047fd),_0x5820fd['namespace']=_0x3bfd1e,_0x5820fd['appId']=_0x47f5b0,_0x5820fd['guid']=_0x3ad826,_0x5820fd['callback']=_0x3047fd['callback'],_0x5820fd['topic']=_0x3047fd['topic'],_0x5820fd['config']=_0x23c0b1,_0x5820fd['logger']=_0x20aacf,await _0x5820fd['initStoreChannel'](_0x5820fd,_0x3047fd['store']),await _0x5820fd['initSubChannel'](_0x5820fd,_0x3047fd['sub'],_0x3047fd['store']),await _0x5820fd['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x5820fd['subscriptionHandler'](),_0x47f5b0),await _0x5820fd['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x5820fd['subscriptionHandler'](),_0x47f5b0,_0x5820fd['topic']),await _0x5820fd['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x5820fd['subscriptionHandler'](),_0x47f5b0,_0x5820fd['guid']),await _0x5820fd['initStreamChannel'](_0x5820fd,_0x3047fd['stream'],_0x3047fd['store']),_0x5820fd['router']=await _0x5820fd['initRouter'](_0x3047fd,_0x20aacf);const _0x29a4c1=_0x5820fd['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x5820fd['appId'],'topic':_0x3047fd['topic']});await _0x5820fd['router']['consumeMessages'](_0x29a4c1,'WORKER',_0x5820fd['guid'],_0x3047fd['callback']),_0x5820fd['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x2b66a5['push'](_0x5820fd);}return _0x2b66a5;}['verifyWorkerFields'](_0x5640c6){if(!(0x0,utils_1['identifyRedisType'])(_0x5640c6['store'])||!(0x0,utils_1['identifyRedisType'])(_0x5640c6['stream'])||!(0x0,utils_1['identifyRedisType'])(_0x5640c6['sub'])||!(_0x5640c6['topic']&&_0x5640c6['callback']))throw new Error('worker\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields\x20along\x20with\x20a\x20callback\x20function\x20and\x20topic.');}async['initStoreChannel'](_0x396a24,_0x116528){_0x396a24['store']=await factory_3['StoreServiceFactory']['init'](_0x116528,_0x396a24['namespace'],_0x396a24['appId'],_0x396a24['logger']);}async['initSubChannel'](_0x4b1730,_0x359445,_0x13abeb){_0x4b1730['subscribe']=await factory_2['SubServiceFactory']['init'](_0x359445,_0x13abeb,_0x4b1730['namespace'],_0x4b1730['appId'],_0x4b1730['guid'],_0x4b1730['logger']);}async['initStreamChannel'](_0x49ac67,_0x21cdbd,_0x33524a){_0x49ac67['stream']=await factory_1['StreamServiceFactory']['init'](_0x21cdbd,_0x33524a,_0x49ac67['namespace'],_0x49ac67['appId'],_0x49ac67['logger']);}async['initRouter'](_0x59b70a,_0x3c7f56){const _0x52c934=await this['store']['getThrottleRate'](_0x59b70a['topic']);return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['WORKER'],'topic':_0x59b70a['topic'],'reclaimDelay':_0x59b70a['reclaimDelay'],'reclaimCount':_0x59b70a['reclaimCount'],'throttle':_0x52c934},this['stream'],this['store'],_0x3c7f56);}['subscriptionHandler'](){const _0x28c6df=this;return async(_0x53f0b2,_0x40885f)=>{_0x28c6df['logger']['debug']('worker-event-received',{'topic':_0x53f0b2,'type':_0x40885f['type']});if(_0x40885f['type']==='throttle')_0x40885f['topic']!==null&&_0x28c6df['throttle'](_0x40885f['throttle']);else{if(_0x40885f['type']==='ping')_0x28c6df['sayPong'](_0x28c6df['appId'],_0x28c6df['guid'],_0x40885f['originator'],_0x40885f['details']);else _0x40885f['type']==='rollcall'&&(_0x40885f['topic']!==null&&_0x28c6df['doRollCall'](_0x40885f));}};}async['doRollCall'](_0x49073f){let _0x133a93=0x0;const _0x45d300=!isNaN(_0x49073f['max'])?_0x49073f['max']:enums_1['HMSH_QUORUM_ROLLCALL_CYCLES'];if(this['rollCallInterval'])clearTimeout(this['rollCallInterval']);const _0x332c8e=_0x49073f['interval']/0x2,_0x364b69=_0x332c8e+Math['ceil'](Math['random']()*_0x332c8e);do{await(0x0,utils_1['sleepFor'])(Math['ceil'](Math['random']()*0x3e8)),await this['sayPong'](this['appId'],this['guid'],null,!![],_0x49073f['signature']);if(!_0x49073f['interval'])return;const {promise:_0x4fba86,timerId:_0xa19f6}=(0x0,utils_1['XSleepFor'])(_0x364b69*0x3e8);this['rollCallInterval']=_0xa19f6,await _0x4fba86;}while(this['rollCallInterval']&&_0x133a93++<_0x45d300-0x1);}['cancelRollCall'](){this['rollCallInterval']&&(clearTimeout(this['rollCallInterval']),delete this['rollCallInterval']);}['stop'](){this['cancelRollCall']();}async['sayPong'](_0x11a836,_0x4b2c72,_0x186aa5,_0x2238a7=![],_0x5bb69c=![]){let _0x31e7d8;if(_0x2238a7){const _0x534459={'appId':this['appId'],'topic':this['topic']};_0x31e7d8={'engine_id':this['guid'],'namespace':this['namespace'],'app_id':this['appId'],'worker_topic':this['topic'],'stream':this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x534459),'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':_0x5bb69c?this['callback']['toString']():undefined};}this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'pong','guid':_0x4b2c72,'originator':_0x186aa5,'profile':_0x31e7d8},_0x11a836);}async['throttle'](_0x4e7086){this['router']['setThrottle'](_0x4e7086);}}exports['WorkerService']=WorkerService;
1
+ 'use strict';(function(_0x2fb8d6,_0x5d80b2){const _0x2b89f4=_0x4940,_0x5adb19=_0x2fb8d6();while(!![]){try{const _0x59dbc8=parseInt(_0x2b89f4(0xc9))/0x1*(parseInt(_0x2b89f4(0xcd))/0x2)+parseInt(_0x2b89f4(0xc7))/0x3*(-parseInt(_0x2b89f4(0xc5))/0x4)+-parseInt(_0x2b89f4(0xcc))/0x5+-parseInt(_0x2b89f4(0xc6))/0x6+parseInt(_0x2b89f4(0xcb))/0x7+parseInt(_0x2b89f4(0xc8))/0x8+parseInt(_0x2b89f4(0xca))/0x9;if(_0x59dbc8===_0x5d80b2)break;else _0x5adb19['push'](_0x5adb19['shift']());}catch(_0x13827c){_0x5adb19['push'](_0x5adb19['shift']());}}}(_0x153b,0x190b2));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'](_0x391e41,_0x1b8e54,_0x1c75e5,_0x4637bc,_0x207d23){const _0x488cdf=[];if(Array['isArray'](_0x4637bc['workers']))for(const _0x32fc77 of _0x4637bc['workers']){await factory_1['ConnectorService']['initClients'](_0x32fc77);const _0x34537a=new WorkerService();_0x34537a['verifyWorkerFields'](_0x32fc77),_0x34537a['namespace']=_0x391e41,_0x34537a['appId']=_0x1b8e54,_0x34537a['guid']=_0x1c75e5,_0x34537a['callback']=_0x32fc77['callback'],_0x34537a['topic']=_0x32fc77['topic'],_0x34537a['config']=_0x4637bc,_0x34537a['logger']=_0x207d23,await _0x34537a['initStoreChannel'](_0x34537a,_0x32fc77['store']),await _0x34537a['initSubChannel'](_0x34537a,_0x32fc77['sub'],_0x32fc77['store']),await _0x34537a['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x34537a['subscriptionHandler'](),_0x1b8e54),await _0x34537a['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x34537a['subscriptionHandler'](),_0x1b8e54,_0x34537a['topic']),await _0x34537a['subscribe']['subscribe'](key_1['KeyType']['QUORUM'],_0x34537a['subscriptionHandler'](),_0x1b8e54,_0x34537a['guid']),await _0x34537a['initStreamChannel'](_0x34537a,_0x32fc77['stream'],_0x32fc77['store']),_0x34537a['router']=await _0x34537a['initRouter'](_0x32fc77,_0x207d23);const _0x22ece7=_0x34537a['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':_0x34537a['appId'],'topic':_0x32fc77['topic']});await _0x34537a['router']['consumeMessages'](_0x22ece7,'WORKER',_0x34537a['guid'],_0x32fc77['callback']),_0x34537a['inited']=(0x0,utils_1['formatISODate'])(new Date()),_0x488cdf['push'](_0x34537a);}return _0x488cdf;}['verifyWorkerFields'](_0x104a5e){if(!(0x0,utils_1['identifyProvider'])(_0x104a5e['store'])||!(0x0,utils_1['identifyProvider'])(_0x104a5e['stream'])||!(0x0,utils_1['identifyProvider'])(_0x104a5e['sub'])||!(_0x104a5e['topic']&&_0x104a5e['callback']))throw new Error('worker\x20must\x20include\x20`store`,\x20`stream`,\x20and\x20`sub`\x20fields\x20along\x20with\x20a\x20callback\x20function\x20and\x20topic.');}async['initStoreChannel'](_0x1dac8f,_0x2f36ea){_0x1dac8f['store']=await factory_4['StoreServiceFactory']['init'](_0x2f36ea,_0x1dac8f['namespace'],_0x1dac8f['appId'],_0x1dac8f['logger']);}async['initSubChannel'](_0x40dd3c,_0x228f0c,_0x5ed449){_0x40dd3c['subscribe']=await factory_3['SubServiceFactory']['init'](_0x228f0c,_0x5ed449,_0x40dd3c['namespace'],_0x40dd3c['appId'],_0x40dd3c['guid'],_0x40dd3c['logger']);}async['initStreamChannel'](_0x48738e,_0xae5300,_0x3082a4){_0x48738e['stream']=await factory_2['StreamServiceFactory']['init'](_0xae5300,_0x3082a4,_0x48738e['namespace'],_0x48738e['appId'],_0x48738e['logger']);}async['initRouter'](_0x40615b,_0x173144){const _0x4ba696=await this['store']['getThrottleRate'](_0x40615b['topic']);return new router_1['Router']({'namespace':this['namespace'],'appId':this['appId'],'guid':this['guid'],'role':stream_1['StreamRole']['WORKER'],'topic':_0x40615b['topic'],'reclaimDelay':_0x40615b['reclaimDelay'],'reclaimCount':_0x40615b['reclaimCount'],'throttle':_0x4ba696},this['stream'],_0x173144);}['subscriptionHandler'](){const _0xbcc537=this;return async(_0x1861d1,_0x1ff11)=>{_0xbcc537['logger']['debug']('worker-event-received',{'topic':_0x1861d1,'type':_0x1ff11['type']});if(_0x1ff11['type']==='throttle')_0x1ff11['topic']!==null&&_0xbcc537['throttle'](_0x1ff11['throttle']);else{if(_0x1ff11['type']==='ping')_0xbcc537['sayPong'](_0xbcc537['appId'],_0xbcc537['guid'],_0x1ff11['originator'],_0x1ff11['details']);else _0x1ff11['type']==='rollcall'&&(_0x1ff11['topic']!==null&&_0xbcc537['doRollCall'](_0x1ff11));}};}async['doRollCall'](_0x18d1fd){let _0x848d74=0x0;const _0x3ff02e=!isNaN(_0x18d1fd['max'])?_0x18d1fd['max']:enums_1['HMSH_QUORUM_ROLLCALL_CYCLES'];if(this['rollCallInterval'])clearTimeout(this['rollCallInterval']);const _0x44f0b3=_0x18d1fd['interval']/0x2,_0x3fbe5c=_0x44f0b3+Math['ceil'](Math['random']()*_0x44f0b3);do{await(0x0,utils_1['sleepFor'])(Math['ceil'](Math['random']()*0x3e8)),await this['sayPong'](this['appId'],this['guid'],null,!![],_0x18d1fd['signature']);if(!_0x18d1fd['interval'])return;const {promise:_0x18d413,timerId:_0x309abf}=(0x0,utils_1['XSleepFor'])(_0x3fbe5c*0x3e8);this['rollCallInterval']=_0x309abf,await _0x18d413;}while(this['rollCallInterval']&&_0x848d74++<_0x3ff02e-0x1);}['cancelRollCall'](){this['rollCallInterval']&&(clearTimeout(this['rollCallInterval']),delete this['rollCallInterval']);}['stop'](){this['cancelRollCall']();}async['sayPong'](_0x53ab3f,_0x3b8670,_0x38e688,_0x48648b=![],_0x3aaaaf=![]){let _0x41c700;if(_0x48648b){const _0x376401={'appId':this['appId'],'topic':this['topic']};_0x41c700={'engine_id':this['guid'],'namespace':this['namespace'],'app_id':this['appId'],'worker_topic':this['topic'],'stream':this['store']['mintKey'](key_1['KeyType']['STREAMS'],_0x376401),'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':_0x3aaaaf?this['callback']['toString']():undefined};}this['subscribe']['publish'](key_1['KeyType']['QUORUM'],{'type':'pong','guid':_0x3b8670,'originator':_0x38e688,'profile':_0x41c700},_0x53ab3f);}async['throttle'](_0x20c135){this['router']?.['setThrottle'](_0x20c135);}}exports['WorkerService']=WorkerService;function _0x4940(_0x2aa6f9,_0x569c15){const _0x153bcd=_0x153b();return _0x4940=function(_0x494092,_0xc3a124){_0x494092=_0x494092-0xc5;let _0x7bfe74=_0x153bcd[_0x494092];return _0x7bfe74;},_0x4940(_0x2aa6f9,_0x569c15);}function _0x153b(){const _0x50cead=['98391KqHEIV','1142544cXDiVO','13977VmYyWC','263493QaJxKp','499695mqczmm','256655XPMjeC','18XxTGQu','4dIzSLd','1095402uALorV'];_0x153b=function(){return _0x50cead;};return _0x153b();}
@@ -1,9 +1,9 @@
1
1
  import { ILogger } from '../services/logger';
2
2
  import { HotMesh as HotMeshService } from '../services/hotmesh';
3
3
  import { HookRules } from './hook';
4
- import { RedisClass, RedisClient, RedisOptions } from './redis';
5
4
  import { StreamData, StreamDataResponse } from './stream';
6
5
  import { LogLevel } from './logger';
6
+ import { ProviderClient, ProviderConfig } from './provider';
7
7
  declare enum KeyType {
8
8
  APP = "APP",
9
9
  THROTTLE_RATE = "THROTTLE_RATE",
@@ -39,25 +39,37 @@ type KeyStoreParams = {
39
39
  scoutType?: 'signal' | 'time' | 'activate';
40
40
  };
41
41
  type HotMesh = typeof HotMeshService;
42
- type RedisConfig = {
43
- class: Partial<RedisClass>;
44
- options: Partial<RedisOptions>;
45
- };
46
42
  type HotMeshEngine = {
47
- store?: RedisClient;
48
- stream?: RedisClient;
49
- sub?: RedisClient;
50
- redis?: RedisConfig;
43
+ store?: ProviderClient;
44
+ stream?: ProviderClient;
45
+ sub?: ProviderClient;
46
+ search?: ProviderClient;
47
+ redis?: ProviderConfig;
48
+ connection?: ProviderConfig;
49
+ connections?: {
50
+ store: ProviderConfig;
51
+ stream: ProviderConfig;
52
+ sub: ProviderConfig;
53
+ search?: ProviderConfig;
54
+ };
51
55
  reclaimDelay?: number;
52
56
  reclaimCount?: number;
53
57
  readonly?: boolean;
54
58
  };
55
59
  type HotMeshWorker = {
56
60
  topic: string;
57
- store?: RedisClient;
58
- stream?: RedisClient;
59
- sub?: RedisClient;
60
- redis?: RedisConfig;
61
+ store?: ProviderClient;
62
+ stream?: ProviderClient;
63
+ sub?: ProviderClient;
64
+ search?: ProviderClient;
65
+ redis?: ProviderConfig;
66
+ connection?: ProviderConfig;
67
+ connections?: {
68
+ store: ProviderConfig;
69
+ stream: ProviderConfig;
70
+ sub: ProviderConfig;
71
+ search?: ProviderConfig;
72
+ };
61
73
  reclaimDelay?: number;
62
74
  reclaimCount?: number;
63
75
  callback: (payload: StreamData) => Promise<StreamDataResponse>;
@@ -111,4 +123,4 @@ type HotMeshApp = VersionedFields & {
111
123
  type HotMeshApps = {
112
124
  [appId: string]: HotMeshApp;
113
125
  };
114
- export { HotMesh, HotMeshEngine, RedisConfig, HotMeshWorker, HotMeshSettings, HotMeshApp, HotMeshApps, HotMeshConfig, HotMeshManifest, HotMeshGraph, KeyType, KeyStoreParams, };
126
+ export { HotMesh, HotMeshEngine, HotMeshWorker, HotMeshSettings, HotMeshApp, HotMeshApps, HotMeshConfig, HotMeshManifest, HotMeshGraph, KeyType, KeyStoreParams, };
@@ -3,23 +3,24 @@ export { App, AppVID, AppTransitions, AppSubscriptions } from './app';
3
3
  export { AsyncSignal } from './async';
4
4
  export { CacheMode } from './cache';
5
5
  export { CollationFaultType, CollationStage } from './collator';
6
- export { ActivityConfig, ActivityWorkflowDataType, ChildResponseType, ClientConfig, ClientWorkflow, ContextType, ConnectionConfig, Connection, ProxyResponseType, ProxyType, Registry, SignalOptions, FindJobsOptions, FindOptions, FindWhereOptions, FindWhereQuery, HookOptions, SearchResults, WorkflowConfig, WorkerConfig, WorkerOptions, WorkflowContext, WorkflowSearchOptions, WorkflowSearchSchema, WorkflowDataType, WorkflowOptions, } from './meshflow';
6
+ export { ActivityConfig, ActivityWorkflowDataType, ChildResponseType, ClientConfig, ClientWorkflow, ContextType, Connection, ProxyResponseType, ProxyType, Registry, SignalOptions, FindJobsOptions, FindOptions, FindWhereOptions, FindWhereQuery, HookOptions, SearchResults, WorkflowConfig, WorkerConfig, WorkerOptions, WorkflowContext, WorkflowSearchOptions, WorkflowSearchSchema, WorkflowDataType, WorkflowOptions, } from './meshflow';
7
7
  export { MeshFlowChildErrorType, MeshFlowProxyErrorType, MeshFlowSleepErrorType, MeshFlowWaitForAllErrorType, MeshFlowWaitForErrorType, } from './error';
8
8
  export { ActivityAction, DependencyExport, MeshFlowJobExport, ExportCycles, ExportItem, ExportOptions, ExportTransitions, JobAction, JobExport, JobActionExport, JobTimeline, } from './exporter';
9
9
  export { HookCondition, HookConditions, HookGate, HookInterface, HookRule, HookRules, HookSignal, } from './hook';
10
+ export { HotMesh, HotMeshEngine, HotMeshWorker, HotMeshSettings, HotMeshApp, HotMeshApps, HotMeshConfig, HotMeshManifest, HotMeshGraph, KeyType, KeyStoreParams, } from './hotmesh';
10
11
  export { ILogger, LogLevel } from './logger';
11
12
  export { ExtensionType, JobCompletionOptions, JobData, JobsData, JobInterruptOptions, JobMetadata, JobOutput, JobState, JobStatus, PartialJobState, } from './job';
12
- export { DB, DBConfig, Profile, Namespaces, Entity, EntityInstanceTypes, SubClassInstance, AllSubclassInstances, SubclassType, Namespace, Instance, Instances, Profiles, } from './manifest';
13
+ export { DB, Profile, Namespaces, Entity, EntityInstanceTypes, SubClassInstance, AllSubclassInstances, SubclassType, Namespace, Instance, Instances, Profiles, } from './manifest';
13
14
  export { MappingStatements } from './map';
14
15
  export { Pipe, PipeContext, PipeItem, PipeItems, PipeObject, ReduceObject, } from './pipe';
15
- export { HotMesh, HotMeshApp, HotMeshApps, HotMeshConfig, HotMeshEngine, RedisConfig, HotMeshGraph, HotMeshManifest, HotMeshSettings, HotMeshWorker, KeyStoreParams, KeyType, } from './hotmesh';
16
+ export { ProviderClass, ProviderClient, ProviderConfig, ProviderTransaction, Providers, TransactionResultList, } from './provider';
16
17
  export { MeshCallConnectParams, MeshCallExecParams, MeshCallCronParams, MeshCallExecOptions, MeshCallCronOptions, MeshCallInterruptOptions, MeshCallInterruptParams, MeshCallFlushParams, } from './meshcall';
17
18
  export { CallOptions, MeshDataWorkflowOptions, ConnectOptions, ConnectionInput, ExecInput, } from './meshdata';
18
19
  export { ActivateMessage, CronMessage, JobMessage, JobMessageCallback, PingMessage, PongMessage, QuorumMessage, QuorumMessageCallback, QuorumProfile, RollCallMessage, RollCallOptions, SubscriptionCallback, SubscriptionOptions, SystemHealth, ThrottleMessage, ThrottleOptions, WorkMessage, } from './quorum';
19
- export { RedisClass, RedisRedisClientType, RedisRedisClientOptions, RedisRedisClassType, IORedisClientType, RedisClient, RedisMulti, RedisRedisMultiType, IORedisClientOptions, IORedisClassType, IORedisMultiType, RedisOptions, MultiResponseFlags, isRedisClient, isIORedisClient, } from './redis';
20
+ export { RedisClass, RedisRedisClientType, RedisRedisClientOptions, RedisRedisClassType, IORedisClientType, RedisClient, RedisMulti, RedisRedisMultiType, IORedisClientOptions, IORedisClassType, IORedisMultiType, RedisOptions, isRedisClient, isIORedisClient, } from './redis';
20
21
  export { JSONSchema, StringAnyType, StringScalarType, StringStringType, SymbolMap, SymbolMaps, SymbolRanges, Symbols, SymbolSets, } from './serializer';
21
22
  export { AggregatedData, CountByFacet, GetStatsOptions, IdsData, Measure, MeasureIds, MetricTypes, StatType, StatsType, IdsResponse, JobStats, JobStatsInput, JobStatsRange, StatsResponse, Segment, TimeSegment, } from './stats';
22
- export { ReclaimedMessageType, StreamCode, StreamConfig, StreamData, StreamDataType, StreamError, StreamDataResponse, StreamRetryPolicy, StreamRole, StreamStatus, } from './stream';
23
+ export { ReclaimedMessageType, RouterConfig, StreamCode, StreamConfig, StreamData, StreamDataType, StreamError, StreamDataResponse, StreamMessage, StreamMessageMetadata, StreamProviderType, StreamRetryPolicy, StreamRole, StreamStats, StreamStatus, } from './stream';
23
24
  export { context, Context, Counter, Meter, metrics, propagation, SpanContext, Span, SpanStatus, SpanStatusCode, SpanKind, trace, Tracer, ValueType, } from './telemetry';
24
25
  export { WorkListTaskType } from './task';
25
26
  export { TransitionMatch, TransitionRule, Transitions } from './transition';
@@ -1,18 +1,10 @@
1
1
  import { MeshOS } from '../services/meshos';
2
2
  import * as Types from './index';
3
- export type DBConfig = {
4
- REDIS_DATABASE: number;
5
- REDIS_HOST: string | undefined;
6
- REDIS_PORT: number;
7
- REDIS_USERNAME: string;
8
- REDIS_PASSWORD: string;
9
- REDIS_USE_TLS: boolean;
10
- };
11
3
  export type DB = {
12
4
  name: string;
13
5
  label: string;
14
6
  search: boolean;
15
- config: DBConfig;
7
+ connection: Types.ProviderConfig;
16
8
  };
17
9
  export type SubClassInstance<T extends typeof MeshOS> = T extends abstract new (...args: any) => infer R ? R : never;
18
10
  export type AllSubclassInstances = SubClassInstance<(typeof MeshOS)['classes'][keyof (typeof MeshOS)['classes']]>;
@@ -1,4 +1,4 @@
1
- import { RedisConfig } from './hotmesh';
1
+ import { ProviderConfig } from './provider';
2
2
  import { LogLevel } from './logger';
3
3
  interface MeshCallExecOptions {
4
4
  id: string;
@@ -10,14 +10,16 @@ interface MeshCallConnectParams {
10
10
  guid?: string;
11
11
  namespace?: string;
12
12
  topic: string;
13
- redis: RedisConfig;
14
- callback: (...args: any[]) => any;
13
+ redis?: ProviderConfig;
14
+ connection?: ProviderConfig;
15
+ callback?: (...args: any[]) => any;
15
16
  }
16
17
  interface MeshCallExecParams {
17
18
  namespace?: string;
18
19
  topic: string;
19
20
  args: any[];
20
- redis: RedisConfig;
21
+ redis?: ProviderConfig;
22
+ connection?: ProviderConfig;
21
23
  options?: MeshCallExecOptions;
22
24
  }
23
25
  interface MeshCallFlushOptions {
@@ -27,7 +29,8 @@ interface MeshCallFlushParams {
27
29
  namespace?: string;
28
30
  id?: string;
29
31
  topic: string;
30
- redis: RedisConfig;
32
+ redis?: ProviderConfig;
33
+ connection?: ProviderConfig;
31
34
  options?: MeshCallFlushOptions;
32
35
  }
33
36
  interface MeshCallCronOptions {
@@ -44,7 +47,8 @@ interface MeshCallCronParams {
44
47
  guid?: string;
45
48
  namespace?: string;
46
49
  topic: string;
47
- redis: RedisConfig;
50
+ redis?: ProviderConfig;
51
+ connection?: ProviderConfig;
48
52
  args: any[];
49
53
  callback?: (...args: any[]) => any;
50
54
  options: MeshCallCronOptions;
@@ -56,7 +60,8 @@ interface MeshCallInstanceOptions {
56
60
  interface MeshCallInterruptParams {
57
61
  namespace?: string;
58
62
  topic: string;
59
- redis: RedisConfig;
63
+ redis?: ProviderConfig;
64
+ connection?: ProviderConfig;
60
65
  options: MeshCallInterruptOptions;
61
66
  }
62
67
  export { MeshCallConnectParams, MeshCallExecParams, MeshCallCronParams, MeshCallExecOptions, MeshCallCronOptions, MeshCallInterruptOptions, MeshCallInterruptParams, MeshCallFlushOptions, MeshCallFlushParams, MeshCallInstanceOptions, };
@@ -1,6 +1,6 @@
1
1
  import { WorkflowHandleService } from '../services/meshflow/handle';
2
2
  import { LogLevel } from './logger';
3
- import { RedisClass, RedisOptions } from './redis';
3
+ import { ProviderConfig } from './provider';
4
4
  import { StringAnyType, StringStringType } from './serializer';
5
5
  import { StreamData, StreamError } from './stream';
6
6
  type WorkflowConfig = {
@@ -106,11 +106,7 @@ type WorkflowDataType = {
106
106
  canRetry?: boolean;
107
107
  expire?: number;
108
108
  };
109
- type ConnectionConfig = {
110
- class: Partial<RedisClass>;
111
- options: Partial<RedisOptions>;
112
- };
113
- type Connection = ConnectionConfig;
109
+ type Connection = ProviderConfig;
114
110
  type ClientConfig = {
115
111
  connection: Connection;
116
112
  };
@@ -202,4 +198,4 @@ interface ClientWorkflow {
202
198
  getHandle(taskQueue: string, workflowName: string, workflowId: string, namespace?: string): Promise<WorkflowHandleService>;
203
199
  search(taskQueue: string, workflowName: string, namespace: string | null, index: string, ...query: string[]): Promise<string[]>;
204
200
  }
205
- export { ActivityConfig, ActivityWorkflowDataType, ChildResponseType, ClientConfig, ClientWorkflow, ContextType, ConnectionConfig, Connection, ProxyResponseType, ProxyType, Registry, SignalOptions, FindJobsOptions, FindOptions, FindWhereOptions, FindWhereQuery, HookOptions, SearchResults, WorkerConfig, WorkflowConfig, WorkerOptions, WorkflowSearchOptions, WorkflowDataType, WorkflowOptions, WorkflowContext, };
201
+ export { ActivityConfig, ActivityWorkflowDataType, ChildResponseType, ClientConfig, ClientWorkflow, ContextType, Connection, ProxyResponseType, ProxyType, Registry, SignalOptions, FindJobsOptions, FindOptions, FindWhereOptions, FindWhereQuery, HookOptions, SearchResults, WorkerConfig, WorkflowConfig, WorkerOptions, WorkflowSearchOptions, WorkflowDataType, WorkflowOptions, WorkflowContext, };
@@ -0,0 +1,150 @@
1
+ import { ProviderClient, ProviderTransaction } from './provider';
2
+ export interface NatsConnectionOptions {
3
+ servers?: string | string[];
4
+ timeout?: number;
5
+ name?: string;
6
+ user?: string;
7
+ pass?: string;
8
+ token?: string;
9
+ }
10
+ export interface NatsJetStreamOptions {
11
+ domain?: string;
12
+ prefix?: string;
13
+ timeout?: number;
14
+ }
15
+ export interface NatsStreamOptions extends NatsConnectionOptions {
16
+ jetstream?: NatsJetStreamOptions;
17
+ }
18
+ export type NatsClientOptions = NatsStreamOptions;
19
+ export interface NatsConnection extends ProviderClient {
20
+ jetstream(options?: NatsJetStreamOptions): NatsJetStreamClient;
21
+ jetstreamManager(options?: NatsJetStreamOptions): Promise<NatsJetStreamManager>;
22
+ close(): Promise<void>;
23
+ }
24
+ export type NatsClientType = NatsConnection;
25
+ export type NatsClassType = (options: NatsClientOptions) => Promise<NatsConnection>;
26
+ export interface NatsJetStreamClient {
27
+ publish(subject: string, data: Uint8Array, options?: NatsPublishOptions): Promise<NatsPubAck>;
28
+ consumers: any;
29
+ jetstreamManager(): Promise<NatsJetStreamManager>;
30
+ }
31
+ export type NatsJetStreamType = NatsJetStreamClient;
32
+ export interface NatsJetStreamManager {
33
+ streams: NatsStreamManager;
34
+ consumers: NatsConsumerManager;
35
+ }
36
+ export interface NatsStreamManager {
37
+ add(config: Partial<NatsStreamConfig>): Promise<void>;
38
+ delete(stream: string): Promise<boolean>;
39
+ info(stream: string): Promise<NatsStreamInfo>;
40
+ list(): AsyncIterable<NatsStreamInfo>;
41
+ deleteMessage(stream: string, seq: number): Promise<boolean>;
42
+ update(stream: string, config: NatsStreamConfig): Promise<void>;
43
+ }
44
+ export interface NatsConsumerManager {
45
+ add(stream: string, config: NatsConsumerConfig): Promise<void>;
46
+ delete(stream: string, consumer: string): Promise<boolean>;
47
+ info(stream: string, consumer: string): Promise<NatsConsumerInfo>;
48
+ list(stream: string): AsyncIterable<NatsConsumerInfo>;
49
+ }
50
+ export interface NatsStreamConfig {
51
+ name: string;
52
+ subjects?: string[];
53
+ retention?: NatsRetentionPolicy;
54
+ storage?: NatsStorageType;
55
+ num_replicas?: number;
56
+ max_msgs?: number;
57
+ max_age?: number;
58
+ }
59
+ export interface NatsConsumerConfig {
60
+ durable_name?: string;
61
+ deliver_subject?: string;
62
+ deliver_group?: string;
63
+ ack_policy?: NatsAckPolicy;
64
+ ack_wait?: number;
65
+ max_deliver?: number;
66
+ }
67
+ export interface NatsJsMsg {
68
+ seq: number;
69
+ ack(): void;
70
+ nak(): void;
71
+ term(): void;
72
+ inProgress(): void;
73
+ working(): void;
74
+ data: Uint8Array;
75
+ subject: string;
76
+ headers?: {
77
+ [key: string]: string;
78
+ };
79
+ info: NatsDeliveryInfo;
80
+ }
81
+ export interface NatsDeliveryInfo {
82
+ stream: string;
83
+ consumer: string;
84
+ redeliveryCount: number;
85
+ timestampNanos: number;
86
+ pending: number;
87
+ }
88
+ export interface NatsPubAck extends ProviderTransaction {
89
+ stream: string;
90
+ seq: number;
91
+ duplicate: boolean;
92
+ }
93
+ export interface NatsStreamInfo {
94
+ config: NatsStreamConfig;
95
+ state: NatsStreamState;
96
+ }
97
+ export interface NatsStreamState {
98
+ messages: number;
99
+ bytes: number;
100
+ first_seq: number;
101
+ last_seq: number;
102
+ }
103
+ export interface NatsConsumerInfo {
104
+ name: string;
105
+ stream_name: string;
106
+ config: NatsConsumerConfig;
107
+ delivered: NatsSequenceInfo;
108
+ ack_floor: NatsSequenceInfo;
109
+ num_ack_pending: number;
110
+ num_redelivered: number;
111
+ num_waiting: number;
112
+ num_pending: number;
113
+ }
114
+ export interface NatsSequenceInfo {
115
+ consumer_seq: number;
116
+ stream_seq: number;
117
+ }
118
+ export interface NatsPublishOptions {
119
+ msgID?: string;
120
+ expect?: NatsMsgExpect;
121
+ headers?: {
122
+ [key: string]: string;
123
+ };
124
+ }
125
+ export interface NatsMsgExpect {
126
+ lastMsgID?: string;
127
+ streamName?: string;
128
+ lastSequence?: number;
129
+ }
130
+ export interface NatsError extends Error {
131
+ code?: string;
132
+ }
133
+ export type NatsRetentionPolicy = 'limits' | 'interest' | 'workqueue';
134
+ export type NatsStorageType = 'file' | 'memory';
135
+ export type NatsAckPolicy = 'none' | 'all' | 'explicit';
136
+ export type NatsRetentionPolicyWorkqueueType = 'workqueue';
137
+ export type NatsStorageMemoryType = 'memory';
138
+ export type NatsAckPolicyExplicitType = 'explicit';
139
+ export type NatsMessageType = NatsJsMsg;
140
+ export interface NatsTransaction {
141
+ msgs: NatsMessageType[];
142
+ pubAcks: NatsPubAck[];
143
+ execute(): Promise<void>;
144
+ rollback(): Promise<void>;
145
+ }
146
+ export type NatsErrorType = NatsError;
147
+ export type NatsStreamInfoType = NatsStreamInfo;
148
+ export type NatsStreamConfigType = Partial<NatsStreamConfig>;
149
+ export type NatsConsumerConfigType = Partial<NatsConsumerConfig>;
150
+ export type NatsPubAckType = NatsPubAck;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,48 @@
1
+ import { Pool, PoolConfig, PoolClient, QueryResult, QueryConfig } from 'pg';
2
+ export interface PostgresStreamOptions extends PoolConfig {
3
+ schema?: string;
4
+ maxRetries?: number;
5
+ retryDelay?: number;
6
+ streamTablePrefix?: string;
7
+ consumerTablePrefix?: string;
8
+ }
9
+ export type PostgresClientOptions = PoolConfig;
10
+ export type PostgresClientType = Pool;
11
+ export type PostgresClassType = typeof Pool;
12
+ export type PostgresPoolClientType = PoolClient;
13
+ export type PostgresQueryResultType = QueryResult;
14
+ export type PostgresQueryConfigType = QueryConfig;
15
+ export interface PostgresStreamMessage {
16
+ id: string;
17
+ stream: string;
18
+ message: any;
19
+ created_at: Date;
20
+ sequence?: number;
21
+ }
22
+ export interface PostgresConsumerGroup {
23
+ stream: string;
24
+ group_name: string;
25
+ last_message_id: string;
26
+ created_at: Date;
27
+ updated_at: Date;
28
+ }
29
+ export interface PostgresPendingMessage {
30
+ stream: string;
31
+ group_name: string;
32
+ consumer_name: string;
33
+ message_id: string;
34
+ delivered_at: Date;
35
+ delivery_count: number;
36
+ }
37
+ export interface PostgresTransaction {
38
+ client: PoolClient;
39
+ queryBuffer: {
40
+ text: string;
41
+ values: any[];
42
+ }[];
43
+ begin(): Promise<void>;
44
+ query(text: string, values?: any[]): Promise<PostgresQueryResultType>;
45
+ commit(): Promise<void>;
46
+ rollback(): Promise<void>;
47
+ release(): void;
48
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ import { KeyStoreParams } from '../modules/key';
2
+ import { StringAnyType } from './serializer';
3
+ export interface ProviderClass {
4
+ [key: string]: any;
5
+ }
6
+ export interface ProviderOptions {
7
+ [key: string]: any;
8
+ }
9
+ export type Providers = 'redis' | 'nats' | 'postgres' | 'ioredis';
10
+ export interface ProviderTransaction {
11
+ exec(): Promise<any>;
12
+ [key: string]: any;
13
+ }
14
+ export interface ProviderNativeClient {
15
+ [key: string]: any;
16
+ }
17
+ export interface ProviderClient {
18
+ transact(): ProviderTransaction;
19
+ mintKey(type: KeyType, params: KeyStoreParams): string;
20
+ [key: string]: any;
21
+ }
22
+ export type TransactionResultList = (string | number)[];
23
+ export type ProviderConfig = {
24
+ class: any;
25
+ options: StringAnyType;
26
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });