@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
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HotMesh = void 0;
4
4
  const key_1 = require("../../modules/key");
5
5
  const utils_1 = require("../../modules/utils");
6
- const redis_1 = require("../connector/clients/redis");
7
- const ioredis_1 = require("../connector/clients/ioredis");
8
- const connector_1 = require("../connector");
6
+ const redis_1 = require("../connector/providers/redis");
7
+ const ioredis_1 = require("../connector/providers/ioredis");
8
+ const factory_1 = require("../connector/factory");
9
9
  const engine_1 = require("../engine");
10
10
  const logger_1 = require("../logger");
11
11
  const quorum_1 = require("../quorum");
@@ -51,7 +51,7 @@ class HotMesh {
51
51
  }
52
52
  async initEngine(config, logger) {
53
53
  if (config.engine) {
54
- await connector_1.ConnectorService.initRedisClients(config.engine.redis?.class, config.engine.redis?.options, config.engine);
54
+ await factory_1.ConnectorService.initClients(config.engine);
55
55
  this.engine = await engine_1.EngineService.init(this.namespace, this.appId, this.guid, config, logger);
56
56
  }
57
57
  }
@@ -1 +1 @@
1
- 'use strict';function _0xa339(){const _0x3e492c=['9YjVcZL','184554XNZEIK','778492khrNAJ','32NMTwJb','4307280qxwasf','32859cxHdbD','848898WrtqIx','959455RxHEgB','1625064QXkteN'];_0xa339=function(){return _0x3e492c;};return _0xa339();}(function(_0x368632,_0x573daa){const _0x44800c=_0x19e5,_0x225755=_0x368632();while(!![]){try{const _0x3a4fc6=-parseInt(_0x44800c(0x7b))/0x1+-parseInt(_0x44800c(0x77))/0x2*(-parseInt(_0x44800c(0x76))/0x3)+-parseInt(_0x44800c(0x78))/0x4+-parseInt(_0x44800c(0x7d))/0x5+parseInt(_0x44800c(0x7a))/0x6+parseInt(_0x44800c(0x75))/0x7+-parseInt(_0x44800c(0x79))/0x8*(parseInt(_0x44800c(0x7c))/0x9);if(_0x3a4fc6===_0x573daa)break;else _0x225755['push'](_0x225755['shift']());}catch(_0x1c9785){_0x225755['push'](_0x225755['shift']());}}}(_0xa339,0x6907a));function _0x19e5(_0x151b91,_0x85e33f){const _0xa33904=_0xa339();return _0x19e5=function(_0x19e5fd,_0x470794){_0x19e5fd=_0x19e5fd-0x75;let _0x511ec0=_0xa33904[_0x19e5fd];return _0x511ec0;},_0x19e5(_0x151b91,_0x85e33f);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['MapperService']=void 0x0;const pipe_1=require('../pipe');class MapperService{constructor(_0x49de75,_0x7b6e09){this['rules']=_0x49de75,this['data']=_0x7b6e09;}['mapRules'](){return this['traverseRules'](this['rules']);}['traverseRules'](_0xa05658){if(typeof _0xa05658==='object'&&'@pipe'in _0xa05658)return this['pipe'](_0xa05658['@pipe']);if(typeof _0xa05658==='object'&&_0xa05658!==null){const _0x2535e3={};for(const _0x4f79a2 in _0xa05658){Object['prototype']['hasOwnProperty']['call'](_0xa05658,_0x4f79a2)&&(_0x2535e3[_0x4f79a2]=this['traverseRules'](_0xa05658[_0x4f79a2]));}return _0x2535e3;}else return this['resolve'](_0xa05658);}['pipe'](_0x41e02e){const _0x4e7b97=new pipe_1['Pipe'](_0x41e02e,this['data']);return _0x4e7b97['process']();}['resolve'](_0x2bf1c0){const _0x33809f=new pipe_1['Pipe']([[_0x2bf1c0]],this['data']);return _0x33809f['process']();}static['evaluate'](_0x4eabf8,_0x3f352a,_0x11db6a){if(typeof _0x4eabf8==='boolean')return _0x4eabf8;if(Array['isArray'](_0x4eabf8['code'])&&_0x4eabf8['code']['includes'](_0x11db6a||0xc8)||_0x11db6a['toString']()===(_0x4eabf8['code']||0xc8)['toString']()){if(!_0x4eabf8['match'])return!![];const _0x2d393d=_0x4eabf8['gate']==='or';let _0x123614=!![],_0x280235=![];return _0x4eabf8['match']['forEach'](({expected:_0x466d42,actual:_0x59ea92})=>{if(_0x2d393d&&!_0x280235||!_0x2d393d&&_0x123614){const _0x58f5b6=pipe_1['Pipe']['resolve'](_0x59ea92,_0x3f352a)===_0x466d42;if(_0x2d393d&&_0x58f5b6)_0x280235=!![];else!_0x2d393d&&!_0x58f5b6&&(_0x123614=![]);}}),_0x2d393d?_0x280235:_0x123614;}return![];}}exports['MapperService']=MapperService;
1
+ 'use strict';function _0x5283(_0x3530a8,_0x14697a){const _0x5f3849=_0x5f38();return _0x5283=function(_0x52838a,_0x2cb230){_0x52838a=_0x52838a-0x1b2;let _0x2504d0=_0x5f3849[_0x52838a];return _0x2504d0;},_0x5283(_0x3530a8,_0x14697a);}(function(_0x56158d,_0x342f6d){const _0x4275d9=_0x5283,_0x1ea07f=_0x56158d();while(!![]){try{const _0x41787e=-parseInt(_0x4275d9(0x1be))/0x1*(parseInt(_0x4275d9(0x1b3))/0x2)+-parseInt(_0x4275d9(0x1bd))/0x3*(-parseInt(_0x4275d9(0x1b5))/0x4)+-parseInt(_0x4275d9(0x1b8))/0x5+parseInt(_0x4275d9(0x1ba))/0x6*(-parseInt(_0x4275d9(0x1b9))/0x7)+parseInt(_0x4275d9(0x1b4))/0x8*(parseInt(_0x4275d9(0x1bc))/0x9)+parseInt(_0x4275d9(0x1b2))/0xa*(-parseInt(_0x4275d9(0x1bb))/0xb)+-parseInt(_0x4275d9(0x1b6))/0xc*(-parseInt(_0x4275d9(0x1b7))/0xd);if(_0x41787e===_0x342f6d)break;else _0x1ea07f['push'](_0x1ea07f['shift']());}catch(_0x43d258){_0x1ea07f['push'](_0x1ea07f['shift']());}}}(_0x5f38,0x63144));function _0x5f38(){const _0x3fe2e9=['315PbnApe','1584pVhNia','284kIZPeo','10rzBdFh','4156llzarK','30856uVYMpD','4600AwBmAv','29268ZeBjDj','6721LWZbzb','1854975cMesEZ','14KcgUTg','474018wZLStf','5259947UcWexB'];_0x5f38=function(){return _0x3fe2e9;};return _0x5f38();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['MapperService']=void 0x0;const pipe_1=require('../pipe');class MapperService{constructor(_0x3a12c5,_0x388f10){this['rules']=_0x3a12c5,this['data']=_0x388f10;}['mapRules'](){return this['traverseRules'](this['rules']);}['traverseRules'](_0x1bba9c){if(typeof _0x1bba9c==='object'&&'@pipe'in _0x1bba9c)return this['pipe'](_0x1bba9c['@pipe']);if(typeof _0x1bba9c==='object'&&_0x1bba9c!==null){const _0x46aa67={};for(const _0x9eed2 in _0x1bba9c){Object['prototype']['hasOwnProperty']['call'](_0x1bba9c,_0x9eed2)&&(_0x46aa67[_0x9eed2]=this['traverseRules'](_0x1bba9c[_0x9eed2]));}return _0x46aa67;}else return this['resolve'](_0x1bba9c);}['pipe'](_0x54fe87){const _0x5513b9=new pipe_1['Pipe'](_0x54fe87,this['data']);return _0x5513b9['process']();}['resolve'](_0x43acc8){const _0x53b672=new pipe_1['Pipe']([[_0x43acc8]],this['data']);return _0x53b672['process']();}static['evaluate'](_0x92d040,_0x302eae,_0x53d88c){if(typeof _0x92d040==='boolean')return _0x92d040;if(Array['isArray'](_0x92d040['code'])&&_0x92d040['code']['includes'](_0x53d88c||0xc8)||_0x53d88c['toString']()===(_0x92d040['code']||0xc8)['toString']()){if(!_0x92d040['match'])return!![];const _0x639f51=_0x92d040['gate']==='or';let _0x61d71c=!![],_0x2385cf=![];return _0x92d040['match']['forEach'](({expected:_0x556f3d,actual:_0x3e5d1f})=>{if(_0x639f51&&!_0x2385cf||!_0x639f51&&_0x61d71c){const _0x3ea0c1=pipe_1['Pipe']['resolve'](_0x3e5d1f,_0x302eae)===_0x556f3d;if(_0x639f51&&_0x3ea0c1)_0x2385cf=!![];else!_0x639f51&&!_0x3ea0c1&&(_0x61d71c=![]);}}),_0x639f51?_0x2385cf:_0x61d71c;}return![];}}exports['MapperService']=MapperService;
@@ -1,19 +1,20 @@
1
1
  import { HotMesh } from '../hotmesh';
2
2
  import { MeshCallConnectParams, MeshCallCronParams, MeshCallExecParams, MeshCallFlushParams, MeshCallInstanceOptions, MeshCallInterruptParams } from '../../types/meshcall';
3
- import { RedisConfig } from '../../types';
3
+ import { ProviderConfig } from '../../types/provider';
4
4
  declare class MeshCall {
5
5
  static workers: Map<string, HotMesh | Promise<HotMesh>>;
6
6
  static engines: Map<string, HotMesh | Promise<HotMesh>>;
7
7
  static connections: Map<string, any>;
8
8
  constructor();
9
- static findFirstMatching(targets: Map<string, HotMesh | Promise<HotMesh>>, namespace: string, config: RedisConfig, options?: MeshCallInstanceOptions): Promise<HotMesh | void>;
10
- static getHotMeshClient: (namespace: string, connection: RedisConfig, options?: MeshCallInstanceOptions) => Promise<HotMesh>;
9
+ static findFirstMatching(targets: Map<string, HotMesh | Promise<HotMesh>>, namespace: string, config: ProviderConfig, options?: MeshCallInstanceOptions): Promise<HotMesh | void>;
10
+ static getHotMeshClient: (namespace: string, connection: ProviderConfig, options?: MeshCallInstanceOptions) => Promise<HotMesh>;
11
11
  static verifyWorkflowActive(hotMesh: HotMesh, appId?: string, count?: number): Promise<boolean>;
12
12
  static activateWorkflow(hotMesh: HotMesh, appId?: string, version?: string): Promise<void>;
13
- static getInstance(namespace: string, redis: RedisConfig, options?: MeshCallInstanceOptions): Promise<HotMesh>;
13
+ static getInstance(namespace: string, providerConfig: ProviderConfig, options?: MeshCallInstanceOptions): Promise<HotMesh>;
14
14
  static connect(params: MeshCallConnectParams): Promise<HotMesh>;
15
15
  static exec<U>(params: MeshCallExecParams): Promise<U>;
16
16
  static flush(params: MeshCallFlushParams): Promise<void>;
17
+ static createStream: (hotMeshClient: HotMesh, workflowTopic: string, namespace?: string) => Promise<void>;
17
18
  static cron(params: MeshCallCronParams): Promise<boolean>;
18
19
  static interrupt(params: MeshCallInterruptParams): Promise<boolean>;
19
20
  static shutdown(): Promise<void>;
@@ -60,32 +60,32 @@ class MeshCall {
60
60
  }
61
61
  }
62
62
  }
63
- static async getInstance(namespace, redis, options = {}) {
63
+ static async getInstance(namespace, providerConfig, options = {}) {
64
64
  let hotMeshInstance;
65
65
  if (!options.readonly) {
66
- hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.workers, namespace, redis, options);
66
+ hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.workers, namespace, providerConfig, options);
67
67
  }
68
68
  if (!hotMeshInstance) {
69
- hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.engines, namespace, redis, options);
69
+ hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.engines, namespace, providerConfig, options);
70
70
  if (!hotMeshInstance) {
71
- hotMeshInstance = (await MeshCall.getHotMeshClient(namespace, redis, options));
71
+ hotMeshInstance = (await MeshCall.getHotMeshClient(namespace, providerConfig, options));
72
72
  }
73
73
  }
74
74
  return hotMeshInstance;
75
75
  }
76
76
  static async connect(params) {
77
77
  const targetNamespace = params.namespace ?? key_1.HMNS;
78
- const optionsHash = (0, utils_1.hashOptions)(params.redis?.options);
78
+ const optionsHash = (0, utils_1.hashOptions)(utils_1.polyfill.providerConfig(params)?.options);
79
79
  const targetTopic = `${optionsHash}.${targetNamespace}.${params.topic}`;
80
80
  const hotMeshWorker = await hotmesh_1.HotMesh.init({
81
81
  guid: params.guid,
82
82
  logLevel: params.logLevel ?? enums_1.HMSH_LOGLEVEL,
83
83
  appId: params.namespace ?? key_1.HMNS,
84
- engine: { redis: params.redis },
84
+ engine: { connection: utils_1.polyfill.providerConfig(params) },
85
85
  workers: [
86
86
  {
87
87
  topic: params.topic,
88
- redis: params.redis,
88
+ connection: utils_1.polyfill.providerConfig(params),
89
89
  callback: async function (input) {
90
90
  const response = await params.callback.apply(this, input.data.args);
91
91
  return {
@@ -102,7 +102,7 @@ class MeshCall {
102
102
  }
103
103
  static async exec(params) {
104
104
  const TOPIC = `${params.namespace ?? key_1.HMNS}.call`;
105
- const hotMeshInstance = await MeshCall.getInstance(params.namespace, params.redis);
105
+ const hotMeshInstance = await MeshCall.getInstance(params.namespace, utils_1.polyfill.providerConfig(params));
106
106
  let id = params.options?.id;
107
107
  if (id) {
108
108
  if (params.options?.flush) {
@@ -130,19 +130,24 @@ class MeshCall {
130
130
  return jobOutput?.data?.response;
131
131
  }
132
132
  static async flush(params) {
133
- const hotMeshInstance = await MeshCall.getInstance(params.namespace, params.redis);
133
+ const hotMeshInstance = await MeshCall.getInstance(params.namespace, utils_1.polyfill.providerConfig(params));
134
134
  await hotMeshInstance.scrub(params.id ?? params?.options?.id);
135
135
  }
136
136
  static async cron(params) {
137
+ let hotMeshInstance;
138
+ let readonly = true;
137
139
  if (params.callback) {
138
- await MeshCall.connect({
140
+ hotMeshInstance = await MeshCall.connect({
139
141
  logLevel: params.logLevel,
140
142
  guid: params.guid,
141
143
  topic: params.topic,
142
- redis: params.redis,
144
+ connection: utils_1.polyfill.providerConfig(params),
143
145
  callback: params.callback,
144
146
  namespace: params.namespace,
145
147
  });
148
+ readonly = false;
149
+ }
150
+ else {
146
151
  }
147
152
  const TOPIC = `${params.namespace ?? key_1.HMNS}.cron`;
148
153
  const maxCycles = params.options.maxCycles ?? 100000;
@@ -160,7 +165,10 @@ class MeshCall {
160
165
  delay = params.options.delay ? (0, utils_1.s)(params.options.delay) : undefined;
161
166
  }
162
167
  try {
163
- const hotMeshInstance = await MeshCall.getInstance(params.namespace, params.redis, { readonly: params.callback ? false : true, guid: params.guid });
168
+ if (!hotMeshInstance) {
169
+ hotMeshInstance = await MeshCall.getInstance(params.namespace, utils_1.polyfill.providerConfig(params), { readonly, guid: params.guid });
170
+ await MeshCall.createStream(hotMeshInstance, params.topic, params.namespace);
171
+ }
164
172
  await hotMeshInstance.pub(TOPIC, {
165
173
  id: params.options.id,
166
174
  topic: params.topic,
@@ -180,7 +188,7 @@ class MeshCall {
180
188
  }
181
189
  }
182
190
  static async interrupt(params) {
183
- const hotMeshInstance = await MeshCall.getInstance(params.namespace, params.redis);
191
+ const hotMeshInstance = await MeshCall.getInstance(params.namespace, utils_1.polyfill.providerConfig(params));
184
192
  try {
185
193
  await hotMeshInstance.interrupt(`${params.namespace ?? key_1.HMNS}.cron`, params.options.id, { throw: false, expire: 1 });
186
194
  }
@@ -218,7 +226,7 @@ MeshCall.getHotMeshClient = async (namespace, connection, options = {}) => {
218
226
  appId: targetNS,
219
227
  logLevel: enums_1.HMSH_LOGLEVEL,
220
228
  engine: {
221
- redis: {
229
+ connection: {
222
230
  class: connection.class,
223
231
  options: connection.options,
224
232
  },
@@ -229,3 +237,12 @@ MeshCall.getHotMeshClient = async (namespace, connection, options = {}) => {
229
237
  await _a.activateWorkflow(await hotMeshClient, targetNS);
230
238
  return hotMeshClient;
231
239
  };
240
+ MeshCall.createStream = async (hotMeshClient, workflowTopic, namespace) => {
241
+ const params = { appId: namespace ?? key_1.HMNS, topic: workflowTopic };
242
+ const streamKey = hotMeshClient.engine.store.mintKey(key_1.KeyType.STREAMS, params);
243
+ try {
244
+ await hotMeshClient.engine.stream.createConsumerGroup(streamKey, 'WORKER');
245
+ }
246
+ catch (err) {
247
+ }
248
+ };
@@ -1,15 +1,15 @@
1
1
  import { HotMesh } from '../hotmesh';
2
2
  import { WorkflowOptions, WorkflowSearchOptions, FindJobsOptions, FindOptions, FindWhereOptions, SearchResults, FindWhereQuery } from '../../types/meshflow';
3
3
  import { CallOptions, ConnectionInput, ExecInput, HookInput } from '../../types/meshdata';
4
- import { RedisClass, RedisOptions } from '../../types/redis';
5
4
  import { StringAnyType, StringStringType } from '../../types/serializer';
6
5
  import { JobInterruptOptions, JobOutput } from '../../types/job';
7
6
  import { QuorumMessage, QuorumMessageCallback, QuorumProfile, RollCallOptions, SubscriptionOptions, ThrottleOptions } from '../../types/quorum';
8
7
  import { MeshFlowJobExport, ExportOptions } from '../../types/exporter';
8
+ import { ProviderConfig } from '../../types';
9
+ import { ProviderClass } from '../../types/provider';
9
10
  declare class MeshData {
10
11
  connectionSignatures: StringStringType;
11
- redisOptions: RedisOptions;
12
- redisClass: RedisClass;
12
+ connection: Partial<ProviderConfig>;
13
13
  instances: Map<string, Promise<HotMesh> | HotMesh>;
14
14
  search: WorkflowSearchOptions;
15
15
  static workflow: {
@@ -28,13 +28,13 @@ declare class MeshData {
28
28
  executeChild: <T_1>(options?: Partial<WorkflowOptions>) => Promise<T_1>;
29
29
  startChild: (options?: Partial<WorkflowOptions>) => Promise<string>;
30
30
  };
31
- constructor(redisClass: Partial<RedisClass>, redisOptions: Partial<RedisOptions>, search?: WorkflowSearchOptions);
31
+ constructor(providerClass: ProviderClass, providerOptions: StringAnyType, search?: WorkflowSearchOptions);
32
32
  validate(entity: string): void;
33
- getConnection(): Promise<import("../../types/meshflow").ConnectionConfig>;
33
+ getConnection(): Promise<ProviderConfig>;
34
34
  getClient(): import("../meshflow/client").ClientService;
35
35
  safeKey(key: string): string;
36
36
  arrayToHash(input: [number, ...Array<string | string[]>]): StringStringType[];
37
- toString(value: any): string | undefined;
37
+ toString(value: unknown): string | undefined;
38
38
  static mintGuid(entity: string, id?: string): string;
39
39
  getHotMesh(namespace?: string): Promise<HotMesh>;
40
40
  mintKey(entity: string, workflowId: string, namespace?: string): Promise<string>;
@@ -8,8 +8,9 @@ const hotmesh_1 = require("../hotmesh");
8
8
  const hotmesh_2 = require("../../types/hotmesh");
9
9
  const enums_1 = require("../../modules/enums");
10
10
  class MeshData {
11
- constructor(redisClass, redisOptions, search) {
11
+ constructor(providerClass, providerOptions, search) {
12
12
  this.connectionSignatures = {};
13
+ this.connection = {};
13
14
  this.instances = new Map();
14
15
  this.mesh = {
15
16
  sub: async (callback, options = {}) => {
@@ -45,8 +46,8 @@ class MeshData {
45
46
  await hotMesh.quorum?.unsub(callback);
46
47
  },
47
48
  };
48
- this.redisClass = redisClass;
49
- this.redisOptions = redisOptions;
49
+ this.connection.class = providerClass;
50
+ this.connection.options = providerOptions;
50
51
  if (search) {
51
52
  this.search = search;
52
53
  }
@@ -57,17 +58,11 @@ class MeshData {
57
58
  }
58
59
  }
59
60
  async getConnection() {
60
- return await meshflow_1.MeshFlow.Connection.connect({
61
- class: this.redisClass,
62
- options: this.redisOptions,
63
- });
61
+ return await meshflow_1.MeshFlow.Connection.connect(utils_1.polyfill.meshDataConfig(this));
64
62
  }
65
63
  getClient() {
66
64
  return new meshflow_1.MeshFlow.Client({
67
- connection: {
68
- class: this.redisClass,
69
- options: this.redisOptions,
70
- },
65
+ connection: utils_1.polyfill.meshDataConfig(this),
71
66
  });
72
67
  }
73
68
  safeKey(key) {
@@ -138,10 +133,7 @@ class MeshData {
138
133
  hotMesh = hotmesh_1.HotMesh.init({
139
134
  appId: namespace,
140
135
  engine: {
141
- redis: {
142
- class: this.redisClass,
143
- options: this.redisOptions,
144
- },
136
+ connection: utils_1.polyfill.meshDataConfig(this),
145
137
  },
146
138
  });
147
139
  this.instances.set(namespace, hotMesh);
@@ -1,5 +1,6 @@
1
- import { Connection, ConnectionConfig } from '../../types/meshflow';
1
+ import { Connection } from '../../types/meshflow';
2
+ import { ProviderConfig } from '../../types/provider';
2
3
  export declare class ConnectionService {
3
4
  constructor();
4
- static connect(config: ConnectionConfig): Promise<Connection>;
5
+ static connect(config: ProviderConfig): Promise<Connection>;
5
6
  }
@@ -1,15 +1,15 @@
1
1
  import { ILogger } from '../logger';
2
2
  import { StoreService } from '../store';
3
3
  import { ExportOptions, MeshFlowJobExport, TimelineType, TransitionType, ExportFields } from '../../types/exporter';
4
- import { RedisClient, RedisMulti } from '../../types/redis';
4
+ import { ProviderClient, ProviderTransaction } from '../../types/provider';
5
5
  import { StringStringType, Symbols } from '../../types/serializer';
6
6
  declare class ExporterService {
7
7
  appId: string;
8
8
  logger: ILogger;
9
- store: StoreService<RedisClient, RedisMulti>;
9
+ store: StoreService<ProviderClient, ProviderTransaction>;
10
10
  symbols: Promise<Symbols> | Symbols;
11
11
  private static symbols;
12
- constructor(appId: string, store: StoreService<RedisClient, RedisMulti>, logger: ILogger);
12
+ constructor(appId: string, store: StoreService<ProviderClient, ProviderTransaction>, logger: ILogger);
13
13
  export(jobId: string, options?: ExportOptions): Promise<MeshFlowJobExport>;
14
14
  inflate(jobHash: StringStringType, options: ExportOptions): MeshFlowJobExport;
15
15
  resolveValue(raw: string, withValues: boolean): Record<string, any> | string | number | null;
@@ -1 +1 @@
1
- 'use strict';(function(_0x354874,_0x4ec742){const _0x369e7d=_0x2f7e,_0x35b1ee=_0x354874();while(!![]){try{const _0x94e592=-parseInt(_0x369e7d(0x1ab))/0x1+parseInt(_0x369e7d(0x1aa))/0x2+parseInt(_0x369e7d(0x1ae))/0x3*(parseInt(_0x369e7d(0x1a9))/0x4)+parseInt(_0x369e7d(0x1b0))/0x5+parseInt(_0x369e7d(0x1ad))/0x6+parseInt(_0x369e7d(0x1ac))/0x7+-parseInt(_0x369e7d(0x1af))/0x8;if(_0x94e592===_0x4ec742)break;else _0x35b1ee['push'](_0x35b1ee['shift']());}catch(_0x5df607){_0x35b1ee['push'](_0x35b1ee['shift']());}}}(_0xeb53,0xf1da5));function _0xeb53(){const _0x579aa8=['4330860kFFhru','6476TrRbQM','794264yoKIwr','1641195phKXod','1361269XxAQwP','9858468wXdSzG','1218WqKmQP','9010712HsiwhO'];_0xeb53=function(){return _0x579aa8;};return _0xeb53();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ExporterService']=void 0x0;const utils_1=require('../../modules/utils'),serializer_1=require('../serializer');function _0x2f7e(_0x53020d,_0x192d98){const _0xeb535a=_0xeb53();return _0x2f7e=function(_0x2f7eff,_0x4e1180){_0x2f7eff=_0x2f7eff-0x1a9;let _0x5171d1=_0xeb535a[_0x2f7eff];return _0x5171d1;},_0x2f7e(_0x53020d,_0x192d98);}class ExporterService{constructor(_0x29dc91,_0x34614e,_0x138654){this['appId']=_0x29dc91,this['logger']=_0x138654,this['store']=_0x34614e;}async['export'](_0x3ccae0,_0x7349ed={}){if(!ExporterService['symbols']['has'](this['appId'])){const _0x4413d7=this['store']['getAllSymbols']();ExporterService['symbols']['set'](this['appId'],await _0x4413d7);}const _0x48efce=await this['store']['getRaw'](_0x3ccae0),_0x2e0036=this['inflate'](_0x48efce,_0x7349ed);return _0x2e0036;}['inflate'](_0x4339a7,_0x58e51e){const _0x3109be=[],_0x4118b0={},_0x2d74c4={},_0x46f459={},_0x508f41=/^([a-zA-Z]{3}),(\d+(?:,\d+)*)/;return Object['entries'](_0x4339a7)['forEach'](([_0x5355ca,_0x4345f2])=>{const _0x5359c0=_0x5355ca['match'](_0x508f41);if(_0x5359c0)this['inflateTransition'](_0x5359c0,_0x4345f2,_0x46f459);else{if(_0x5355ca['startsWith']('_'))_0x2d74c4[_0x5355ca['substring'](0x1)]=_0x4345f2;else{if(_0x5355ca['startsWith']('-')){const _0x5bd6ff=this['keyToObject'](_0x5355ca);_0x3109be['push']({..._0x5bd6ff,'key':_0x5355ca,'value':this['resolveValue'](_0x4345f2,_0x58e51e['values'])});}else _0x5355ca['length']===0x3&&(_0x4118b0[this['inflateKey'](_0x5355ca)]=serializer_1['SerializerService']['fromString'](_0x4345f2));}}}),this['filterFields']({'data':(0x0,utils_1['restoreHierarchy'])(_0x2d74c4),'state':Object['entries']((0x0,utils_1['restoreHierarchy'])(_0x4118b0))[0x0][0x1],'status':parseInt(_0x4339a7[':'],0xa),'timeline':this['sortParts'](_0x3109be),'transitions':this['sortEntriesByCreated'](_0x46f459)},_0x58e51e['block'],_0x58e51e['allow']);}['resolveValue'](_0x39f4a7,_0x4806af){const _0x2a201c=serializer_1['SerializerService']['fromString'](_0x39f4a7);if(_0x4806af!==![])return _0x2a201c;return _0x2a201c&&typeof _0x2a201c==='object'&&('data'in _0x2a201c&&(_0x2a201c['data']={}),'$error'in _0x2a201c&&(_0x2a201c['$error']={})),_0x2a201c;}['inflateKey'](_0x1391a8){const _0x432734=ExporterService['symbols']['get'](this['appId']);if(_0x1391a8 in _0x432734){const _0x4460b3=_0x432734[_0x1391a8],_0x4b5625=_0x4460b3['split']('/');return _0x4b5625['join']('/');}return _0x1391a8;}['filterFields'](_0x407c28,_0x5c5490=[],_0x2aace2=[]){let _0x57abbf={};return _0x2aace2&&_0x2aace2['length']>0x0?_0x2aace2['forEach'](_0x5e585a=>{_0x5e585a in _0x407c28&&(_0x57abbf[_0x5e585a]=_0x407c28[_0x5e585a]);}):_0x57abbf={..._0x407c28},_0x5c5490&&_0x5c5490['length']>0x0&&_0x5c5490['forEach'](_0x19a31e=>{_0x19a31e in _0x57abbf&&delete _0x57abbf[_0x19a31e];}),_0x57abbf;}['inflateTransition'](_0x237278,_0x11d560,_0xf7aa5d){const [_0x203c86,_0x14668f,_0x2916b9]=_0x237278,_0x2ed7b4=this['inflateKey'](_0x14668f),_0x4c4dee=_0x2ed7b4['split']('/'),_0x3dd3ec=_0x4c4dee[0x0],_0x29a371=_0x2ed7b4['endsWith']('/output/metadata/ac'),_0x1d68e2=_0x2ed7b4['endsWith']('/output/metadata/au');if(_0x29a371||_0x1d68e2){const _0x2b42cd=_0x3dd3ec+','+_0x2916b9,_0x290634=_0xf7aa5d[_0x2b42cd];!_0x290634?_0xf7aa5d[_0x2b42cd]={'activity':_0x3dd3ec,'dimensions':_0x2916b9,'created':_0x29a371?_0x11d560:null,'updated':_0x1d68e2?_0x11d560:null}:_0x290634[_0x29a371?'created':'updated']=_0x11d560;}}['sortEntriesByCreated'](_0x4e6bf6){const _0x39a9e7=Object['values'](_0x4e6bf6);return _0x39a9e7['sort']((_0x4ddad2,_0x3912d0)=>{return(_0x4ddad2['created']||_0x4ddad2['updated'])['localeCompare'](_0x3912d0['created']||_0x3912d0['updated']);}),_0x39a9e7;}['keyToObject'](_0x5dbb85){function _0x5865b2(_0x4d13b8){const _0x2b8546=_0x4d13b8['split'](',');if(_0x2b8546['length']>0x1)return _0x2b8546['shift'](),_0x2b8546['join'](',');}const _0x466260=_0x5dbb85['split']('-');return _0x466260['length']===0x4?{'index':parseInt(_0x466260[0x2],0xa),'dimension':_0x5865b2(_0x466260[0x1])}:{'index':parseInt(_0x466260[0x2],0xa),'secondary':parseInt(_0x466260[0x3],0xa),'dimension':_0x5865b2(_0x466260[0x1])};}['sortParts'](_0x3ff78a){return _0x3ff78a['sort']((_0x5b3c16,_0x2e6798)=>{const {dimension:_0x3f0305,index:_0x4279d5,secondary:_0x408d02}=_0x5b3c16,{dimension:_0x54f467,index:_0x1c5636,secondary:_0x1312fa}=_0x2e6798;if(_0x3f0305===undefined&&_0x54f467!==undefined)return-0x1;if(_0x3f0305!==undefined&&_0x54f467===undefined)return 0x1;if(_0x3f0305!==undefined&&_0x54f467!==undefined){if(_0x3f0305<_0x54f467)return-0x1;if(_0x3f0305>_0x54f467)return 0x1;}if(_0x4279d5<_0x1c5636)return-0x1;if(_0x4279d5>_0x1c5636)return 0x1;if(_0x408d02===undefined&&_0x1312fa!==undefined)return-0x1;if(_0x408d02!==undefined&&_0x1312fa===undefined)return 0x1;if(_0x408d02!==undefined&&_0x1312fa!==undefined){if(_0x408d02<_0x1312fa)return-0x1;if(_0x408d02>_0x1312fa)return 0x1;}return 0x0;});}}exports['ExporterService']=ExporterService,ExporterService['symbols']=new Map();
1
+ 'use strict';function _0x2b59(_0x14a297,_0x1cffde){const _0x4f44b6=_0x4f44();return _0x2b59=function(_0x2b5984,_0x33bc5b){_0x2b5984=_0x2b5984-0x1e4;let _0x41e4ac=_0x4f44b6[_0x2b5984];return _0x41e4ac;},_0x2b59(_0x14a297,_0x1cffde);}(function(_0x3db0d3,_0x36db1e){const _0xaeec59=_0x2b59,_0x569884=_0x3db0d3();while(!![]){try{const _0x1829d6=-parseInt(_0xaeec59(0x1e8))/0x1+-parseInt(_0xaeec59(0x1eb))/0x2+parseInt(_0xaeec59(0x1e5))/0x3+parseInt(_0xaeec59(0x1e6))/0x4*(parseInt(_0xaeec59(0x1e7))/0x5)+parseInt(_0xaeec59(0x1e4))/0x6+-parseInt(_0xaeec59(0x1ea))/0x7*(parseInt(_0xaeec59(0x1ec))/0x8)+parseInt(_0xaeec59(0x1e9))/0x9;if(_0x1829d6===_0x36db1e)break;else _0x569884['push'](_0x569884['shift']());}catch(_0x5e0abf){_0x569884['push'](_0x569884['shift']());}}}(_0x4f44,0x3b515));function _0x4f44(){const _0x2e070c=['5sBNmOJ','222007ijWFUI','3812796lIakrK','455707EkSrLQ','642576ObXqOJ','8VhgpQy','257922xMUJax','1075959AyrBBv','104308vSoWmL'];_0x4f44=function(){return _0x2e070c;};return _0x4f44();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ExporterService']=void 0x0;const utils_1=require('../../modules/utils'),serializer_1=require('../serializer');class ExporterService{constructor(_0x285c91,_0x833267,_0x363c77){this['appId']=_0x285c91,this['logger']=_0x363c77,this['store']=_0x833267;}async['export'](_0x24cb4a,_0x32cd55={}){if(!ExporterService['symbols']['has'](this['appId'])){const _0x374a23=this['store']['getAllSymbols']();ExporterService['symbols']['set'](this['appId'],await _0x374a23);}const _0xcf66a5=await this['store']['getRaw'](_0x24cb4a),_0x25b8c3=this['inflate'](_0xcf66a5,_0x32cd55);return _0x25b8c3;}['inflate'](_0x4af001,_0x43b373){const _0x1f4acb=[],_0x514b1b={},_0x454ad8={},_0x4e4a09={},_0x1f1793=/^([a-zA-Z]{3}),(\d+(?:,\d+)*)/;return Object['entries'](_0x4af001)['forEach'](([_0x55f53a,_0x428737])=>{const _0x4cf1c8=_0x55f53a['match'](_0x1f1793);if(_0x4cf1c8)this['inflateTransition'](_0x4cf1c8,_0x428737,_0x4e4a09);else{if(_0x55f53a['startsWith']('_'))_0x454ad8[_0x55f53a['substring'](0x1)]=_0x428737;else{if(_0x55f53a['startsWith']('-')){const _0x156954=this['keyToObject'](_0x55f53a);_0x1f4acb['push']({..._0x156954,'key':_0x55f53a,'value':this['resolveValue'](_0x428737,_0x43b373['values'])});}else _0x55f53a['length']===0x3&&(_0x514b1b[this['inflateKey'](_0x55f53a)]=serializer_1['SerializerService']['fromString'](_0x428737));}}}),this['filterFields']({'data':(0x0,utils_1['restoreHierarchy'])(_0x454ad8),'state':Object['entries']((0x0,utils_1['restoreHierarchy'])(_0x514b1b))[0x0][0x1],'status':parseInt(_0x4af001[':'],0xa),'timeline':this['sortParts'](_0x1f4acb),'transitions':this['sortEntriesByCreated'](_0x4e4a09)},_0x43b373['block'],_0x43b373['allow']);}['resolveValue'](_0x5cce7d,_0x5c68dc){const _0x913b83=serializer_1['SerializerService']['fromString'](_0x5cce7d);if(_0x5c68dc!==![])return _0x913b83;return _0x913b83&&typeof _0x913b83==='object'&&('data'in _0x913b83&&(_0x913b83['data']={}),'$error'in _0x913b83&&(_0x913b83['$error']={})),_0x913b83;}['inflateKey'](_0xf8bcb4){const _0x4f70e2=ExporterService['symbols']['get'](this['appId']);if(_0xf8bcb4 in _0x4f70e2){const _0x55725d=_0x4f70e2[_0xf8bcb4],_0x391c13=_0x55725d['split']('/');return _0x391c13['join']('/');}return _0xf8bcb4;}['filterFields'](_0x14e1ce,_0x2bd82f=[],_0x4a88bf=[]){let _0x4ed163={};return _0x4a88bf&&_0x4a88bf['length']>0x0?_0x4a88bf['forEach'](_0x429d55=>{_0x429d55 in _0x14e1ce&&(_0x4ed163[_0x429d55]=_0x14e1ce[_0x429d55]);}):_0x4ed163={..._0x14e1ce},_0x2bd82f&&_0x2bd82f['length']>0x0&&_0x2bd82f['forEach'](_0x207e14=>{_0x207e14 in _0x4ed163&&delete _0x4ed163[_0x207e14];}),_0x4ed163;}['inflateTransition'](_0x28f1db,_0x1b75e4,_0x5b5f43){const [_0x2258ce,_0x1ae549,_0x39e726]=_0x28f1db,_0x42db3c=this['inflateKey'](_0x1ae549),_0x2664b7=_0x42db3c['split']('/'),_0x2e3ac6=_0x2664b7[0x0],_0x462111=_0x42db3c['endsWith']('/output/metadata/ac'),_0x5928ab=_0x42db3c['endsWith']('/output/metadata/au');if(_0x462111||_0x5928ab){const _0x17c474=_0x2e3ac6+','+_0x39e726,_0xbda534=_0x5b5f43[_0x17c474];!_0xbda534?_0x5b5f43[_0x17c474]={'activity':_0x2e3ac6,'dimensions':_0x39e726,'created':_0x462111?_0x1b75e4:null,'updated':_0x5928ab?_0x1b75e4:null}:_0xbda534[_0x462111?'created':'updated']=_0x1b75e4;}}['sortEntriesByCreated'](_0x556df6){const _0x2c7085=Object['values'](_0x556df6);return _0x2c7085['sort']((_0xf1ae58,_0x49607e)=>{return(_0xf1ae58['created']||_0xf1ae58['updated'])['localeCompare'](_0x49607e['created']||_0x49607e['updated']);}),_0x2c7085;}['keyToObject'](_0x482440){function _0x17af06(_0x538458){const _0x54e12d=_0x538458['split'](',');if(_0x54e12d['length']>0x1)return _0x54e12d['shift'](),_0x54e12d['join'](',');}const _0x3560c9=_0x482440['split']('-');return _0x3560c9['length']===0x4?{'index':parseInt(_0x3560c9[0x2],0xa),'dimension':_0x17af06(_0x3560c9[0x1])}:{'index':parseInt(_0x3560c9[0x2],0xa),'secondary':parseInt(_0x3560c9[0x3],0xa),'dimension':_0x17af06(_0x3560c9[0x1])};}['sortParts'](_0x57017f){return _0x57017f['sort']((_0x50a507,_0x1f10b3)=>{const {dimension:_0x4f1b45,index:_0x440545,secondary:_0x505dc1}=_0x50a507,{dimension:_0x11088b,index:_0x876068,secondary:_0x19ed31}=_0x1f10b3;if(_0x4f1b45===undefined&&_0x11088b!==undefined)return-0x1;if(_0x4f1b45!==undefined&&_0x11088b===undefined)return 0x1;if(_0x4f1b45!==undefined&&_0x11088b!==undefined){if(_0x4f1b45<_0x11088b)return-0x1;if(_0x4f1b45>_0x11088b)return 0x1;}if(_0x440545<_0x876068)return-0x1;if(_0x440545>_0x876068)return 0x1;if(_0x505dc1===undefined&&_0x19ed31!==undefined)return-0x1;if(_0x505dc1!==undefined&&_0x19ed31===undefined)return 0x1;if(_0x505dc1!==undefined&&_0x19ed31!==undefined){if(_0x505dc1<_0x19ed31)return-0x1;if(_0x505dc1>_0x19ed31)return 0x1;}return 0x0;});}}exports['ExporterService']=ExporterService,ExporterService['symbols']=new Map();
@@ -4,11 +4,13 @@ import { ConnectionService } from './connection';
4
4
  import { Search } from './search';
5
5
  import { WorkerService } from './worker';
6
6
  import { WorkflowService } from './workflow';
7
+ import { WorkflowHandleService } from './handle';
7
8
  declare class MeshFlowClass {
8
9
  constructor();
9
10
  static Client: typeof ClientService;
10
11
  static Connection: typeof ConnectionService;
11
12
  static Search: typeof Search;
13
+ static Handle: typeof WorkflowHandleService;
12
14
  static Worker: typeof WorkerService;
13
15
  static workflow: typeof WorkflowService;
14
16
  static shutdown(): Promise<void>;
@@ -7,6 +7,7 @@ const connection_1 = require("./connection");
7
7
  const search_1 = require("./search");
8
8
  const worker_1 = require("./worker");
9
9
  const workflow_1 = require("./workflow");
10
+ const handle_1 = require("./handle");
10
11
  class MeshFlowClass {
11
12
  constructor() { }
12
13
  static async shutdown() {
@@ -19,5 +20,6 @@ exports.MeshFlow = MeshFlowClass;
19
20
  MeshFlowClass.Client = client_1.ClientService;
20
21
  MeshFlowClass.Connection = connection_1.ConnectionService;
21
22
  MeshFlowClass.Search = search_1.Search;
23
+ MeshFlowClass.Handle = handle_1.WorkflowHandleService;
22
24
  MeshFlowClass.Worker = worker_1.WorkerService;
23
25
  MeshFlowClass.workflow = workflow_1.WorkflowService;
@@ -98,7 +98,9 @@ class Search {
98
98
  }
99
99
  }
100
100
  const fieldCount = await this.search.setFields(this.jobId, fields);
101
- await this.search.setFields(this.jobId, { [ssGuid]: fieldCount.toString() });
101
+ await this.search.setFields(this.jobId, {
102
+ [ssGuid]: fieldCount.toString(),
103
+ });
102
104
  return fieldCount;
103
105
  }
104
106
  async get(id) {
@@ -163,8 +165,12 @@ class Search {
163
165
  return Number(replay[ssGuid]);
164
166
  }
165
167
  const response = await this.search.deleteFields(this.jobId, safeArgs);
166
- const formattedResponse = isNaN(response) ? 0 : Number(response);
167
- await this.search.setFields(this.jobId, { [ssGuid]: formattedResponse.toString() });
168
+ const formattedResponse = isNaN(response)
169
+ ? 0
170
+ : Number(response);
171
+ await this.search.setFields(this.jobId, {
172
+ [ssGuid]: formattedResponse.toString(),
173
+ });
168
174
  return formattedResponse;
169
175
  }
170
176
  async incr(key, val) {
@@ -191,7 +197,9 @@ class Search {
191
197
  if (ssGuidValue === 1) {
192
198
  const log = Math.log(val);
193
199
  const logTotal = await this.search.incrementFieldByFloat(this.jobId, this.safeKey(key), log);
194
- await this.search.setFields(this.jobId, { [ssGuid]: logTotal.toString() });
200
+ await this.search.setFields(this.jobId, {
201
+ [ssGuid]: logTotal.toString(),
202
+ });
195
203
  return Math.exp(logTotal);
196
204
  }
197
205
  else {
@@ -84,7 +84,7 @@ class WorkerService {
84
84
  this.workflowRunner.engine.logger.info('meshflow-worker-running');
85
85
  }
86
86
  async initActivityWorker(config, activityTopic) {
87
- const redisConfig = {
87
+ const providerConfig = {
88
88
  class: config.connection.class,
89
89
  options: config.connection.options,
90
90
  };
@@ -95,11 +95,11 @@ class WorkerService {
95
95
  guid: config.guid ? `${config.guid}XA` : undefined,
96
96
  logLevel: config.options?.logLevel ?? enums_1.HMSH_LOGLEVEL,
97
97
  appId: targetNamespace,
98
- engine: { redis: redisConfig },
98
+ engine: { connection: providerConfig },
99
99
  workers: [
100
100
  {
101
101
  topic: activityTopic,
102
- redis: redisConfig,
102
+ connection: providerConfig,
103
103
  callback: this.wrapActivityFunctions().bind(this),
104
104
  },
105
105
  ],
@@ -160,7 +160,7 @@ class WorkerService {
160
160
  };
161
161
  }
162
162
  async initWorkflowWorker(config, workflowTopic, workflowFunction) {
163
- const redisConfig = {
163
+ const providerConfig = {
164
164
  class: config.connection.class,
165
165
  options: config.connection.options,
166
166
  };
@@ -171,11 +171,11 @@ class WorkerService {
171
171
  guid: config.guid,
172
172
  logLevel: config.options?.logLevel ?? enums_1.HMSH_LOGLEVEL,
173
173
  appId: config.namespace ?? factory_1.APP_ID,
174
- engine: { redis: redisConfig },
174
+ engine: { connection: providerConfig },
175
175
  workers: [
176
176
  {
177
177
  topic: workflowTopic,
178
- redis: redisConfig,
178
+ connection: providerConfig,
179
179
  callback: this.wrapWorkflowFunction(workflowFunction, workflowTopic, config).bind(this),
180
180
  },
181
181
  ],
@@ -374,7 +374,7 @@ WorkerService.getHotMesh = async (workflowTopic, config, options) => {
374
374
  logLevel: options?.logLevel ?? enums_1.HMSH_LOGLEVEL,
375
375
  appId: targetNamespace,
376
376
  engine: {
377
- redis: { ...config?.connection },
377
+ connection: { ...config?.connection },
378
378
  },
379
379
  });
380
380
  WorkerService.instances.set(targetTopic, hotMeshClient);
@@ -12,16 +12,13 @@ declare abstract class MeshOS {
12
12
  static profiles: Types.Profiles;
13
13
  static classes: Record<string, typeof MeshOS>;
14
14
  static logger: Types.ILogger;
15
- constructor(namespace: string, namespaceType: string, config: Types.DBConfig);
15
+ constructor(providerClass: Types.ProviderClass, namespace: string, namespaceType: string, config: Types.ProviderConfig);
16
16
  protected abstract getEntity(): string;
17
17
  abstract getSearchOptions(): Types.WorkflowSearchOptions;
18
18
  protected abstract getTaskQueue(): string;
19
19
  private initializeMeshData;
20
20
  protected defaultTargetFn(): Promise<string>;
21
21
  getNamespace(): string;
22
- getRedisUrl: (config: Types.DBConfig) => {
23
- url: string;
24
- };
25
22
  connect(): Promise<void>;
26
23
  index(): Promise<void>;
27
24
  static shutdown(): Promise<void>;
@@ -1,48 +1,19 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.MeshOS = void 0;
27
- const Redis = __importStar(require("redis"));
28
4
  const index_1 = require("../meshdata/index");
29
5
  const utils_1 = require("../../modules/utils");
30
6
  const logger_1 = require("../logger");
31
7
  class MeshOS {
32
- constructor(namespace, namespaceType, config) {
8
+ constructor(providerClass, namespace, namespaceType, config) {
33
9
  this.connected = false;
34
- this.getRedisUrl = (config) => {
35
- return {
36
- url: `redis${config.REDIS_USE_TLS ? 's' : ''}://${config.REDIS_USERNAME ?? ''}:${config.REDIS_PASSWORD}@${config.REDIS_HOST}:${config.REDIS_PORT}`,
37
- };
38
- };
39
10
  this.workflow = {};
40
11
  this.namespace = namespace;
41
12
  this.namespaceType = namespaceType;
42
- this.meshData = this.initializeMeshData(config);
13
+ this.meshData = this.initializeMeshData(providerClass, config);
43
14
  }
44
- initializeMeshData(dbConfig) {
45
- return new index_1.MeshData(Redis, this.getRedisUrl(dbConfig), this.getSearchOptions());
15
+ initializeMeshData(providerClass, providerConfig) {
16
+ return new index_1.MeshData(providerClass, providerConfig, this.getSearchOptions());
46
17
  }
47
18
  async defaultTargetFn() {
48
19
  return 'OK';
@@ -221,7 +192,7 @@ class MeshOS {
221
192
  static async init(p = MeshOS.profiles) {
222
193
  for (const key in p) {
223
194
  const profile = p[key];
224
- if (profile.db.config.REDIS_HOST) {
195
+ if (profile.db?.connection?.options) {
225
196
  this.logger.info(`meshos-initializing`, {
226
197
  db: profile.db.name,
227
198
  key,
@@ -243,7 +214,7 @@ class MeshOS {
243
214
  entity: entity.name,
244
215
  label: entity.label,
245
216
  });
246
- const instance = pinstances[entity.name] = new entity.class(ns, namespace.type, profile.db.config);
217
+ const instance = pinstances[entity.name] = new entity.class(profile.db.connection.class, ns, namespace.type, profile.db.connection.options);
247
218
  await instance.init(profile.db.search);
248
219
  }
249
220
  }
@@ -251,10 +222,8 @@ class MeshOS {
251
222
  }
252
223
  }
253
224
  static findEntity(database, namespace, entity) {
254
- if (!database ||
255
- !MeshOS.profiles[database] ||
256
- !MeshOS.profiles[database]?.db?.config?.REDIS_HOST) {
257
- const activeProfiles = Object.keys(MeshOS.profiles).filter((key) => MeshOS.profiles[key]?.db?.config?.REDIS_HOST);
225
+ if (!database || !MeshOS.profiles[database]) {
226
+ const activeProfiles = Object.keys(MeshOS.profiles).filter((key) => MeshOS.profiles[key]?.db?.connection);
258
227
  throw new Error(`The database query parameter [${database}] was not found. Use one of: ${activeProfiles.join(', ')}`);
259
228
  }
260
229
  if (!namespace || !MeshOS.profiles[database]?.instances?.[namespace]) {
@@ -281,10 +250,8 @@ class MeshOS {
281
250
  return target;
282
251
  }
283
252
  static findSchemas(database, ns) {
284
- if (!database ||
285
- !MeshOS.profiles[database] ||
286
- !MeshOS.profiles[database]?.db?.config?.REDIS_HOST) {
287
- const activeProfiles = Object.keys(MeshOS.profiles).filter((key) => MeshOS.profiles[key]?.db?.config?.REDIS_HOST);
253
+ if (!database || !MeshOS.profiles[database]) {
254
+ const activeProfiles = Object.keys(MeshOS.profiles).filter((key) => MeshOS.profiles[key]?.db?.connection);
288
255
  throw new Error(`The database query parameter [${database}] was not found. Use one of: ${activeProfiles.join(', ')}`);
289
256
  }
290
257
  const profile = MeshOS.profiles[database];
@@ -301,7 +268,7 @@ class MeshOS {
301
268
  const result = {};
302
269
  for (const key in p) {
303
270
  const profile = p[key];
304
- if (!profile.db.config.REDIS_HOST) {
271
+ if (!profile.db.connection) {
305
272
  continue;
306
273
  }
307
274
  else {
@@ -1 +1 @@
1
- 'use strict';(function(_0x17a384,_0x3b1091){var _0x597734=_0x2b02,_0x5a5191=_0x17a384();while(!![]){try{var _0x451548=-parseInt(_0x597734(0x79))/0x1*(-parseInt(_0x597734(0x70))/0x2)+parseInt(_0x597734(0x74))/0x3+parseInt(_0x597734(0x76))/0x4*(-parseInt(_0x597734(0x73))/0x5)+-parseInt(_0x597734(0x71))/0x6*(-parseInt(_0x597734(0x78))/0x7)+parseInt(_0x597734(0x75))/0x8+-parseInt(_0x597734(0x72))/0x9+-parseInt(_0x597734(0x77))/0xa;if(_0x451548===_0x3b1091)break;else _0x5a5191['push'](_0x5a5191['shift']());}catch(_0x51ad17){_0x5a5191['push'](_0x5a5191['shift']());}}}(_0x540a,0x5a44d));function _0x540a(){var _0x551157=['11523510zkFhxW','3234AvBNao','1SbPzbX','1432022BvlhxG','6372aBwLYZ','2010663swGMln','2657485hyyFkc','1904154VAeEGX','3484984ZdvBIR','4OrXbmI'];_0x540a=function(){return _0x551157;};return _0x540a();}function _0x2b02(_0x801366,_0x4b9932){var _0x540a41=_0x540a();return _0x2b02=function(_0x2b0287,_0xe1990d){_0x2b0287=_0x2b0287-0x70;var _0x20ec0c=_0x540a41[_0x2b0287];return _0x20ec0c;},_0x2b02(_0x801366,_0x4b9932);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ArrayHandler']=void 0x0;class ArrayHandler{['get'](_0x278dcf,_0x42c078){return _0x278dcf?.[_0x42c078||0x0];}['length'](_0x5a9c43){return _0x5a9c43?.['length'];}['concat'](_0x15d350,_0x528f87){return _0x15d350['concat'](_0x528f87);}['indexOf'](_0x225458,_0x356253,_0x8f050c){return _0x225458['indexOf'](_0x356253,_0x8f050c);}['join'](_0x145756,_0x521206){return _0x145756['join'](_0x521206);}['lastIndexOf'](_0x3a6303,_0x152b37,_0x45cb42){return _0x3a6303['lastIndexOf'](_0x152b37,_0x45cb42);}['pop'](_0x358c5e){return _0x358c5e['pop']();}['push'](_0x2554b3,..._0x2461d7){return _0x2554b3['push'](..._0x2461d7),_0x2554b3;}['reverse'](_0x5f2001){return _0x5f2001['reverse']();}['shift'](_0x26555d){return _0x26555d['shift']();}['slice'](_0x574307,_0x1080b4,_0x5a7849){return _0x574307['slice'](_0x1080b4,_0x5a7849);}['sort'](_0x8a69c2,_0x59917c='ASCENDING'){return _0x8a69c2['sort']((_0x2478c0,_0xd3adf)=>{if(_0x59917c==='ASCENDING'){if(_0x2478c0===_0xd3adf)return 0x0;if(_0x2478c0===null||_0x2478c0===undefined)return-0x1;if(_0xd3adf===null||_0xd3adf===undefined)return 0x1;if(typeof _0x2478c0==='string'&&typeof _0xd3adf==='string')return _0x2478c0['localeCompare'](_0xd3adf);return _0x2478c0<_0xd3adf?-0x1:0x1;}else{if(_0x2478c0===_0xd3adf)return 0x0;if(_0x2478c0===null||_0x2478c0===undefined)return 0x1;if(_0xd3adf===null||_0xd3adf===undefined)return-0x1;if(typeof _0x2478c0==='string'&&typeof _0xd3adf==='string')return _0xd3adf['localeCompare'](_0x2478c0);return _0x2478c0>_0xd3adf?-0x1:0x1;}});}['splice'](_0x29ada1,_0x1c903f,_0x2436fa,..._0x35addb){return _0x29ada1['splice'](_0x1c903f,_0x2436fa,..._0x35addb);}['unshift'](_0x46c625,..._0x420f1b){return _0x46c625['unshift'](..._0x420f1b);}}exports['ArrayHandler']=ArrayHandler;
1
+ 'use strict';function _0x43ba(_0x5996d2,_0x1abdc0){var _0x4c547d=_0x4c54();return _0x43ba=function(_0x43babc,_0x1fda55){_0x43babc=_0x43babc-0x101;var _0x20ae2a=_0x4c547d[_0x43babc];return _0x20ae2a;},_0x43ba(_0x5996d2,_0x1abdc0);}(function(_0x48f91f,_0x26e418){var _0x3754a=_0x43ba,_0x27ef11=_0x48f91f();while(!![]){try{var _0x291368=-parseInt(_0x3754a(0x106))/0x1*(parseInt(_0x3754a(0x109))/0x2)+parseInt(_0x3754a(0x105))/0x3*(-parseInt(_0x3754a(0x104))/0x4)+-parseInt(_0x3754a(0x108))/0x5*(parseInt(_0x3754a(0x10a))/0x6)+-parseInt(_0x3754a(0x103))/0x7+parseInt(_0x3754a(0x101))/0x8+-parseInt(_0x3754a(0x107))/0x9+parseInt(_0x3754a(0x102))/0xa;if(_0x291368===_0x26e418)break;else _0x27ef11['push'](_0x27ef11['shift']());}catch(_0x57f6bc){_0x27ef11['push'](_0x27ef11['shift']());}}}(_0x4c54,0xc4a6a));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ArrayHandler']=void 0x0;class ArrayHandler{['get'](_0x40b5ef,_0x21aaa4){return _0x40b5ef?.[_0x21aaa4||0x0];}['length'](_0x4cf0ea){return _0x4cf0ea?.['length'];}['concat'](_0x195b62,_0xd94456){return _0x195b62['concat'](_0xd94456);}['indexOf'](_0x2f63ee,_0x23a911,_0x481e33){return _0x2f63ee['indexOf'](_0x23a911,_0x481e33);}['join'](_0x5d5c52,_0x1d451e){return _0x5d5c52['join'](_0x1d451e);}['lastIndexOf'](_0x399a54,_0x53f1f4,_0x2f1575){return _0x399a54['lastIndexOf'](_0x53f1f4,_0x2f1575);}['pop'](_0x17b7e8){return _0x17b7e8['pop']();}['push'](_0x239da3,..._0x2a9d15){return _0x239da3['push'](..._0x2a9d15),_0x239da3;}['reverse'](_0x455d10){return _0x455d10['reverse']();}['shift'](_0x556bc2){return _0x556bc2['shift']();}['slice'](_0x56107e,_0x5f0499,_0x28641f){return _0x56107e['slice'](_0x5f0499,_0x28641f);}['sort'](_0x236ae1,_0x184682='ASCENDING'){return _0x236ae1['sort']((_0x37dc3f,_0x5703c7)=>{if(_0x184682==='ASCENDING'){if(_0x37dc3f===_0x5703c7)return 0x0;if(_0x37dc3f===null||_0x37dc3f===undefined)return-0x1;if(_0x5703c7===null||_0x5703c7===undefined)return 0x1;if(typeof _0x37dc3f==='string'&&typeof _0x5703c7==='string')return _0x37dc3f['localeCompare'](_0x5703c7);return _0x37dc3f<_0x5703c7?-0x1:0x1;}else{if(_0x37dc3f===_0x5703c7)return 0x0;if(_0x37dc3f===null||_0x37dc3f===undefined)return 0x1;if(_0x5703c7===null||_0x5703c7===undefined)return-0x1;if(typeof _0x37dc3f==='string'&&typeof _0x5703c7==='string')return _0x5703c7['localeCompare'](_0x37dc3f);return _0x37dc3f>_0x5703c7?-0x1:0x1;}});}['splice'](_0x40cf0f,_0x58fd81,_0x1ffe0b,..._0x143a09){return _0x40cf0f['splice'](_0x58fd81,_0x1ffe0b,..._0x143a09);}['unshift'](_0x5e1f9a,..._0xf38c7d){return _0x5e1f9a['unshift'](..._0xf38c7d);}}function _0x4c54(){var _0x1ad652=['2150GdOuVC','6551919XsmXYS','7601830ElCLUQ','522vBoJEE','6RCuRQW','2732232zewQPS','55560620yTgRts','6235145OSrtoh','129476MuEdHy','129VqwgYW'];_0x4c54=function(){return _0x1ad652;};return _0x4c54();}exports['ArrayHandler']=ArrayHandler;