@hotmeshio/hotmesh 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -13
- package/build/index.d.ts +5 -2
- package/build/index.js +8 -3
- package/build/modules/key.js +1 -1
- package/build/modules/utils.d.ts +12 -4
- package/build/modules/utils.js +1 -1
- package/build/package.json +15 -8
- package/build/services/activities/activity.d.ts +9 -9
- package/build/services/activities/activity.js +1 -1
- package/build/services/activities/await.d.ts +2 -2
- package/build/services/activities/await.js +1 -1
- package/build/services/activities/cycle.d.ts +2 -2
- package/build/services/activities/cycle.js +1 -1
- package/build/services/activities/hook.d.ts +2 -2
- package/build/services/activities/hook.js +1 -1
- package/build/services/activities/index.js +1 -1
- package/build/services/activities/interrupt.js +1 -1
- package/build/services/activities/signal.js +1 -1
- package/build/services/activities/trigger.d.ts +3 -3
- package/build/services/activities/trigger.js +1 -1
- package/build/services/activities/worker.d.ts +2 -2
- package/build/services/activities/worker.js +1 -1
- package/build/services/collator/index.d.ts +9 -9
- package/build/services/collator/index.js +1 -1
- package/build/services/compiler/deployer.d.ts +4 -4
- package/build/services/compiler/deployer.js +1 -1
- package/build/services/compiler/index.d.ts +4 -4
- package/build/services/compiler/index.js +1 -1
- package/build/services/compiler/validator.d.ts +3 -3
- package/build/services/compiler/validator.js +1 -1
- package/build/services/connector/factory.d.ts +7 -0
- package/build/services/connector/factory.js +65 -0
- package/build/services/connector/index.d.ts +13 -4
- package/build/services/connector/index.js +30 -23
- package/build/services/connector/providers/ioredis.d.ts +9 -0
- package/build/services/connector/providers/ioredis.js +26 -0
- package/build/services/connector/providers/nats.d.ts +9 -0
- package/build/services/connector/providers/nats.js +26 -0
- package/build/services/connector/providers/postgres.d.ts +9 -0
- package/build/services/connector/providers/postgres.js +44 -0
- package/build/services/connector/providers/redis.d.ts +9 -0
- package/build/services/connector/providers/redis.js +38 -0
- package/build/services/engine/index.d.ts +12 -12
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.d.ts +3 -3
- package/build/services/exporter/index.js +1 -1
- package/build/services/hotmesh/index.js +4 -4
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.d.ts +5 -4
- package/build/services/meshcall/index.js +31 -14
- package/build/services/meshdata/index.d.ts +6 -6
- package/build/services/meshdata/index.js +7 -15
- package/build/services/meshflow/connection.d.ts +3 -2
- package/build/services/meshflow/exporter.d.ts +3 -3
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/search.js +12 -4
- package/build/services/meshflow/worker.js +7 -7
- package/build/services/meshos/index.d.ts +1 -4
- package/build/services/meshos/index.js +11 -44
- package/build/services/pipe/functions/array.js +1 -1
- package/build/services/pipe/functions/bitwise.js +1 -1
- package/build/services/pipe/functions/conditional.js +1 -1
- package/build/services/pipe/functions/cron.d.ts +2 -0
- package/build/services/pipe/functions/cron.js +1 -1
- package/build/services/pipe/functions/date.js +1 -1
- package/build/services/pipe/functions/index.js +1 -1
- package/build/services/pipe/functions/json.js +1 -1
- package/build/services/pipe/functions/logical.js +1 -1
- package/build/services/pipe/functions/math.js +1 -1
- package/build/services/pipe/functions/number.js +1 -1
- package/build/services/pipe/functions/object.js +1 -1
- package/build/services/pipe/functions/string.js +1 -1
- package/build/services/pipe/functions/symbol.js +1 -1
- package/build/services/pipe/functions/unary.js +1 -1
- package/build/services/pipe/index.js +1 -1
- package/build/services/quorum/index.d.ts +5 -5
- package/build/services/quorum/index.js +1 -1
- package/build/services/reporter/index.d.ts +2 -2
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.d.ts +8 -13
- package/build/services/router/index.js +1 -1
- package/build/services/search/factory.d.ts +2 -2
- package/build/services/search/factory.js +1 -1
- package/build/services/search/index.d.ts +5 -4
- package/build/services/search/providers/redis/ioredis.js +1 -1
- package/build/services/search/providers/redis/redis.js +1 -1
- package/build/services/serializer/index.js +1 -1
- package/build/services/store/factory.d.ts +3 -3
- package/build/services/store/factory.js +1 -1
- package/build/services/store/index.d.ts +18 -17
- package/build/services/store/providers/redis/_base.d.ts +13 -15
- package/build/services/store/providers/redis/_base.js +1 -1
- package/build/services/store/providers/redis/ioredis.d.ts +2 -2
- package/build/services/store/providers/redis/ioredis.js +1 -1
- package/build/services/store/providers/redis/redis.d.ts +2 -2
- package/build/services/store/providers/redis/redis.js +1 -1
- package/build/services/store/providers/store-initializable.js +1 -1
- package/build/services/stream/factory.d.ts +3 -3
- package/build/services/stream/factory.js +16 -4
- package/build/services/stream/index.d.ts +57 -18
- package/build/services/stream/index.js +2 -1
- package/build/services/stream/providers/nats/nats.d.ts +59 -0
- package/build/services/stream/providers/nats/nats.js +1 -0
- package/build/services/stream/providers/postgres/postgres.d.ts +68 -0
- package/build/services/stream/providers/postgres/postgres.js +1 -0
- package/build/services/stream/providers/redis/ioredis.d.ts +53 -14
- package/build/services/stream/providers/redis/ioredis.js +1 -1
- package/build/services/stream/providers/redis/redis.d.ts +54 -15
- package/build/services/stream/providers/redis/redis.js +1 -1
- package/build/services/stream/providers/stream-initializable.d.ts +1 -2
- package/build/services/stream/providers/stream-initializable.js +1 -1
- package/build/services/sub/factory.d.ts +2 -2
- package/build/services/sub/factory.js +1 -1
- package/build/services/sub/index.d.ts +6 -5
- package/build/services/sub/providers/redis/ioredis.d.ts +1 -1
- package/build/services/sub/providers/redis/ioredis.js +1 -1
- package/build/services/sub/providers/redis/redis.d.ts +4 -4
- package/build/services/sub/providers/redis/redis.js +1 -1
- package/build/services/task/index.d.ts +5 -5
- package/build/services/task/index.js +1 -1
- package/build/services/telemetry/index.js +1 -1
- package/build/services/worker/index.d.ts +9 -9
- package/build/services/worker/index.js +1 -1
- package/build/types/hotmesh.d.ts +26 -14
- package/build/types/index.d.ts +8 -5
- package/build/types/manifest.d.ts +1 -9
- package/build/types/meshcall.d.ts +12 -7
- package/build/types/meshflow.d.ts +3 -7
- package/build/types/nats.d.ts +150 -0
- package/build/types/nats.js +2 -0
- package/build/types/postgres.d.ts +70 -0
- package/build/types/postgres.js +2 -0
- package/build/types/provider.d.ts +26 -0
- package/build/types/provider.js +2 -0
- package/build/types/redis.d.ts +33 -15
- package/build/types/stream.d.ts +65 -1
- package/index.ts +10 -5
- package/package.json +15 -8
- package/typedoc.json +6 -0
- package/types/hotmesh.ts +139 -22
- package/types/index.ts +80 -17
- package/types/manifest.ts +1 -10
- package/types/meshcall.ts +38 -13
- package/types/meshflow.ts +2 -7
- package/types/nats.ts +236 -0
- package/types/postgres.ts +85 -0
- package/types/provider.ts +71 -0
- package/types/redis.ts +63 -18
- package/types/stream.ts +85 -1
- package/build/services/connector/clients/ioredis.d.ts +0 -13
- package/build/services/connector/clients/ioredis.js +0 -48
- package/build/services/connector/clients/redis.d.ts +0 -13
- package/build/services/connector/clients/redis.js +0 -60
- package/build/services/stream/providers/postgres/_deploy.d.ts +0 -4
- package/build/services/stream/providers/postgres/_deploy.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x48a167,_0x15df92){const _0x1e6bb8=_0x2cbf,_0x59c915=_0x48a167();while(!![]){try{const _0x3989ae=parseInt(_0x1e6bb8(0x13d))/0x1+parseInt(_0x1e6bb8(0x143))/0x2+-parseInt(_0x1e6bb8(0x141))/0x3+parseInt(_0x1e6bb8(0x13c))/0x4+parseInt(_0x1e6bb8(0x142))/0x5*(parseInt(_0x1e6bb8(0x140))/0x6)+-parseInt(_0x1e6bb8(0x13f))/0x7*(parseInt(_0x1e6bb8(0x13e))/0x8)+-parseInt(_0x1e6bb8(0x13b))/0x9;if(_0x3989ae===_0x15df92)break;else _0x59c915['push'](_0x59c915['shift']());}catch(_0xf5c1e6){_0x59c915['push'](_0x59c915['shift']());}}}(_0x2022,0xe1325));function _0x2cbf(_0x1edfde,_0x46b430){const _0x2022af=_0x2022();return _0x2cbf=function(_0x2cbfb1,_0x2fa37e){_0x2cbfb1=_0x2cbfb1-0x13b;let _0x4b7e7f=_0x2022af[_0x2cbfb1];return _0x4b7e7f;},_0x2cbf(_0x1edfde,_0x46b430);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ExporterService']=void 0x0;const key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),serializer_1=require('../serializer');class ExporterService{constructor(_0x423151,_0x2265db,_0x3bb5a5){this['appId']=_0x423151,this['logger']=_0x3bb5a5,this['store']=_0x2265db;}async['export'](_0x207411,_0x228d2b={}){!this['symbols']&&(this['symbols']=this['store']['getAllSymbols'](),this['symbols']=await this['symbols']);const _0x5a541f=[],_0x55a07f=await this['store']['getRaw'](_0x207411),_0x313809=this['inflate'](_0x55a07f,_0x5a541f);return _0x313809;}['inflateKey'](_0xc85fdf){return _0xc85fdf in this['symbols']?this['symbols'][_0xc85fdf]:_0xc85fdf;}['inflate'](_0x4dda86,_0x3c3b98){const _0x43b3e0={'hooks':{},'main':{'cursor':-0x1,'items':[]}},_0x1a9bc0={},_0x15e981=this['inflateDependencyData'](_0x3c3b98,_0x43b3e0),_0x308687=/^([a-zA-Z]{3}),(\d+(?:,\d+)*)/;return Object['entries'](_0x4dda86)['forEach'](([_0x4ab80c,_0x5279e5])=>{const _0xc8bed7=_0x4ab80c['match'](_0x308687);if(_0xc8bed7){const [_0x4b1035,_0x53d32a,_0x3f79d3]=_0xc8bed7,_0x4f8cc8=this['inflateKey'](_0x53d32a),_0x32665d=''+_0x3f79d3['replace'](/,/g,'/'),_0xc77ef0=serializer_1['SerializerService']['fromString'](_0x5279e5);_0x1a9bc0[_0x32665d+'/'+_0x4f8cc8]=_0xc77ef0;}else _0x4ab80c['length']===0x3&&(_0x1a9bc0[this['inflateKey'](_0x4ab80c)]=serializer_1['SerializerService']['fromString'](_0x5279e5));}),{'dependencies':_0x15e981,'process':(0x0,utils_1['restoreHierarchy'])(_0x1a9bc0),'status':_0x4dda86[':']};}['inflateDependencyData'](_0x1fdba3,_0x3ff879){const _0xc9c370=/([0-9,]+)-(\d+)$/,_0x4f7eac=/-(\d+)$/;return _0x1fdba3['map']((_0x1b355f,_0x12b77e)=>{const [_0x50d670,_0x473613,_0x45360e,_0x40acaa,..._0xbdc369]=_0x1b355f['split'](key_1['VALSEP']),_0x3237eb=_0xbdc369['join'](key_1['VALSEP']),_0x4a0de9=_0x3237eb['match'](_0xc9c370);let _0x33729f,_0x515107,_0x320f0d='';if(_0x4a0de9){const [_0x23f0d6,_0x47faea,_0x364611]=_0x4a0de9;_0x320f0d=_0x47faea['split'](',')['join']('/'),_0x33729f=_0x320f0d+'['+_0x364611+']',_0x515107='hook';}else{const _0xaaf8ae=_0x3237eb['match'](_0x4f7eac);if(_0xaaf8ae){const [_0x477497,_0x16cedd]=_0xaaf8ae;_0x33729f='['+_0x16cedd+']',_0x515107='flow';}else _0x33729f='/',_0x515107='other';}return{'type':_0x50d670,'topic':_0x473613,'gid':_0x45360e,'jid':_0x3237eb};});}}exports['ExporterService']=ExporterService;function _0x2022(){const _0x440cc6=['426027bRvtRy','2247970rufMYc','197466JPvwdN','23564727DfPDMg','1977224mvzUyP','1787522plmtkW','19632ZtTndl','133HKOnLQ','18auwIUA'];_0x2022=function(){return _0x440cc6;};return _0x2022();}
|
|
@@ -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/
|
|
7
|
-
const ioredis_1 = require("../connector/
|
|
8
|
-
const
|
|
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
|
|
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(
|
|
1
|
+
'use strict';function _0x28e8(){const _0x57c18b=['8289018ZhmpuJ','2041550PEDqLc','12399198trohpk','1957392VPchNa','2945002NbqNKq','6072804KbLVVa','54TMpEgc','1GEaqKg','111848aMufLm'];_0x28e8=function(){return _0x57c18b;};return _0x28e8();}(function(_0x5dc669,_0x4698ac){const _0x10629c=_0x3ae1,_0x4f3e04=_0x5dc669();while(!![]){try{const _0x3ae27d=-parseInt(_0x10629c(0x166))/0x1*(-parseInt(_0x10629c(0x163))/0x2)+parseInt(_0x10629c(0x162))/0x3+parseInt(_0x10629c(0x164))/0x4+parseInt(_0x10629c(0x160))/0x5+-parseInt(_0x10629c(0x168))/0x6+-parseInt(_0x10629c(0x161))/0x7+-parseInt(_0x10629c(0x167))/0x8*(-parseInt(_0x10629c(0x165))/0x9);if(_0x3ae27d===_0x4698ac)break;else _0x4f3e04['push'](_0x4f3e04['shift']());}catch(_0x488226){_0x4f3e04['push'](_0x4f3e04['shift']());}}}(_0x28e8,0xefe11));function _0x3ae1(_0x8a9142,_0x7cf008){const _0x28e84c=_0x28e8();return _0x3ae1=function(_0x3ae177,_0x470e6b){_0x3ae177=_0x3ae177-0x160;let _0x24eb31=_0x28e84c[_0x3ae177];return _0x24eb31;},_0x3ae1(_0x8a9142,_0x7cf008);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['MapperService']=void 0x0;const pipe_1=require('../pipe');class MapperService{constructor(_0x239df4,_0x4776b4){this['rules']=_0x239df4,this['data']=_0x4776b4;}['mapRules'](){return this['traverseRules'](this['rules']);}['traverseRules'](_0x31e811){if(typeof _0x31e811==='object'&&'@pipe'in _0x31e811)return this['pipe'](_0x31e811['@pipe']);if(typeof _0x31e811==='object'&&_0x31e811!==null){const _0x6dc390={};for(const _0x416c9e in _0x31e811){Object['prototype']['hasOwnProperty']['call'](_0x31e811,_0x416c9e)&&(_0x6dc390[_0x416c9e]=this['traverseRules'](_0x31e811[_0x416c9e]));}return _0x6dc390;}else return this['resolve'](_0x31e811);}['pipe'](_0x39e5b2){const _0x4a5af6=new pipe_1['Pipe'](_0x39e5b2,this['data']);return _0x4a5af6['process']();}['resolve'](_0x6dbeec){const _0x5da9e5=new pipe_1['Pipe']([[_0x6dbeec]],this['data']);return _0x5da9e5['process']();}static['evaluate'](_0x2b9217,_0x445a0d,_0x3aa3b1){if(typeof _0x2b9217==='boolean')return _0x2b9217;if(Array['isArray'](_0x2b9217['code'])&&_0x2b9217['code']['includes'](_0x3aa3b1||0xc8)||_0x3aa3b1['toString']()===(_0x2b9217['code']||0xc8)['toString']()){if(!_0x2b9217['match'])return!![];const _0x5349df=_0x2b9217['gate']==='or';let _0x2fbdb8=!![],_0x231dd3=![];return _0x2b9217['match']['forEach'](({expected:_0x13372a,actual:_0x1ffb17})=>{if(_0x5349df&&!_0x231dd3||!_0x5349df&&_0x2fbdb8){const _0x2f9523=pipe_1['Pipe']['resolve'](_0x1ffb17,_0x445a0d)===_0x13372a;if(_0x5349df&&_0x2f9523)_0x231dd3=!![];else!_0x5349df&&!_0x2f9523&&(_0x2fbdb8=![]);}}),_0x5349df?_0x231dd3:_0x2fbdb8;}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 {
|
|
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:
|
|
10
|
-
static getHotMeshClient: (namespace: string, connection:
|
|
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,
|
|
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,
|
|
63
|
+
static async getInstance(namespace, providerConfig, options = {}) {
|
|
64
64
|
let hotMeshInstance;
|
|
65
65
|
if (!options.readonly) {
|
|
66
|
-
hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.workers, namespace,
|
|
66
|
+
hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.workers, namespace, providerConfig, options);
|
|
67
67
|
}
|
|
68
68
|
if (!hotMeshInstance) {
|
|
69
|
-
hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.engines, namespace,
|
|
69
|
+
hotMeshInstance = await MeshCall.findFirstMatching(MeshCall.engines, namespace, providerConfig, options);
|
|
70
70
|
if (!hotMeshInstance) {
|
|
71
|
-
hotMeshInstance = (await MeshCall.getHotMeshClient(namespace,
|
|
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
|
|
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: {
|
|
84
|
+
engine: { connection: utils_1.polyfill.providerConfig(params) },
|
|
85
85
|
workers: [
|
|
86
86
|
{
|
|
87
87
|
topic: params.topic,
|
|
88
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
31
|
+
constructor(providerClass: ProviderClass, providerOptions: StringAnyType, search?: WorkflowSearchOptions);
|
|
32
32
|
validate(entity: string): void;
|
|
33
|
-
getConnection(): Promise<
|
|
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:
|
|
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(
|
|
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.
|
|
49
|
-
this.
|
|
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
|
-
|
|
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
|
|
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:
|
|
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 {
|
|
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<
|
|
9
|
+
store: StoreService<ProviderClient, ProviderTransaction>;
|
|
10
10
|
symbols: Promise<Symbols> | Symbols;
|
|
11
11
|
private static symbols;
|
|
12
|
-
constructor(appId: string, store: StoreService<
|
|
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';
|
|
1
|
+
'use strict';(function(_0x22c5ab,_0x10863e){const _0x49e82b=_0x416f,_0x1d5c8a=_0x22c5ab();while(!![]){try{const _0x426b1b=parseInt(_0x49e82b(0x122))/0x1*(parseInt(_0x49e82b(0x11f))/0x2)+-parseInt(_0x49e82b(0x125))/0x3+-parseInt(_0x49e82b(0x121))/0x4+parseInt(_0x49e82b(0x11c))/0x5+parseInt(_0x49e82b(0x120))/0x6*(-parseInt(_0x49e82b(0x126))/0x7)+-parseInt(_0x49e82b(0x124))/0x8*(parseInt(_0x49e82b(0x11e))/0x9)+parseInt(_0x49e82b(0x123))/0xa*(parseInt(_0x49e82b(0x11d))/0xb);if(_0x426b1b===_0x10863e)break;else _0x1d5c8a['push'](_0x1d5c8a['shift']());}catch(_0x183c4f){_0x1d5c8a['push'](_0x1d5c8a['shift']());}}}(_0x4b56,0x73c5a));function _0x4b56(){const _0x46e2e8=['3794870DXaEoE','11814AHqWiC','1864377JKJcwI','240326VZJKvw','33042AYVZoh','3654632HMmLkr','7cSYsyN','19410TTwMFF','32MYJNFU','1860597BGeZgZ','1078CEwVhW'];_0x4b56=function(){return _0x46e2e8;};return _0x4b56();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ExporterService']=void 0x0;function _0x416f(_0x13c97e,_0x3ca176){const _0x4b5683=_0x4b56();return _0x416f=function(_0x416f4b,_0x401826){_0x416f4b=_0x416f4b-0x11c;let _0x5ef9e1=_0x4b5683[_0x416f4b];return _0x5ef9e1;},_0x416f(_0x13c97e,_0x3ca176);}const utils_1=require('../../modules/utils'),serializer_1=require('../serializer');class ExporterService{constructor(_0x3bbb1f,_0x2a5a56,_0x426118){this['appId']=_0x3bbb1f,this['logger']=_0x426118,this['store']=_0x2a5a56;}async['export'](_0x81adbd,_0x33dc86={}){if(!ExporterService['symbols']['has'](this['appId'])){const _0x2c85a4=this['store']['getAllSymbols']();ExporterService['symbols']['set'](this['appId'],await _0x2c85a4);}const _0x36f78a=await this['store']['getRaw'](_0x81adbd),_0x527ca4=this['inflate'](_0x36f78a,_0x33dc86);return _0x527ca4;}['inflate'](_0x4a0ee6,_0x9222b9){const _0x5dea5d=[],_0x38b01f={},_0x2b462d={},_0x4b50a4={},_0x1747d2=/^([a-zA-Z]{3}),(\d+(?:,\d+)*)/;return Object['entries'](_0x4a0ee6)['forEach'](([_0x1ec224,_0x3297d7])=>{const _0x1138fa=_0x1ec224['match'](_0x1747d2);if(_0x1138fa)this['inflateTransition'](_0x1138fa,_0x3297d7,_0x4b50a4);else{if(_0x1ec224['startsWith']('_'))_0x2b462d[_0x1ec224['substring'](0x1)]=_0x3297d7;else{if(_0x1ec224['startsWith']('-')){const _0x97a03e=this['keyToObject'](_0x1ec224);_0x5dea5d['push']({..._0x97a03e,'key':_0x1ec224,'value':this['resolveValue'](_0x3297d7,_0x9222b9['values'])});}else _0x1ec224['length']===0x3&&(_0x38b01f[this['inflateKey'](_0x1ec224)]=serializer_1['SerializerService']['fromString'](_0x3297d7));}}}),this['filterFields']({'data':(0x0,utils_1['restoreHierarchy'])(_0x2b462d),'state':Object['entries']((0x0,utils_1['restoreHierarchy'])(_0x38b01f))[0x0][0x1],'status':parseInt(_0x4a0ee6[':'],0xa),'timeline':this['sortParts'](_0x5dea5d),'transitions':this['sortEntriesByCreated'](_0x4b50a4)},_0x9222b9['block'],_0x9222b9['allow']);}['resolveValue'](_0x2abfbf,_0xb73cb9){const _0x3c89d7=serializer_1['SerializerService']['fromString'](_0x2abfbf);if(_0xb73cb9!==![])return _0x3c89d7;return _0x3c89d7&&typeof _0x3c89d7==='object'&&('data'in _0x3c89d7&&(_0x3c89d7['data']={}),'$error'in _0x3c89d7&&(_0x3c89d7['$error']={})),_0x3c89d7;}['inflateKey'](_0x24d3c5){const _0x4efdec=ExporterService['symbols']['get'](this['appId']);if(_0x24d3c5 in _0x4efdec){const _0x4fc79a=_0x4efdec[_0x24d3c5],_0x29b221=_0x4fc79a['split']('/');return _0x29b221['join']('/');}return _0x24d3c5;}['filterFields'](_0x2a1ed7,_0x10ea15=[],_0x444c47=[]){let _0x40e4d0={};return _0x444c47&&_0x444c47['length']>0x0?_0x444c47['forEach'](_0x126974=>{_0x126974 in _0x2a1ed7&&(_0x40e4d0[_0x126974]=_0x2a1ed7[_0x126974]);}):_0x40e4d0={..._0x2a1ed7},_0x10ea15&&_0x10ea15['length']>0x0&&_0x10ea15['forEach'](_0x51b21=>{_0x51b21 in _0x40e4d0&&delete _0x40e4d0[_0x51b21];}),_0x40e4d0;}['inflateTransition'](_0x22e448,_0x5e5b58,_0x312a3a){const [_0x2fa8c0,_0x320a02,_0x4b5fec]=_0x22e448,_0x27d704=this['inflateKey'](_0x320a02),_0x323709=_0x27d704['split']('/'),_0x6bb39c=_0x323709[0x0],_0x4f71af=_0x27d704['endsWith']('/output/metadata/ac'),_0x4eb7f2=_0x27d704['endsWith']('/output/metadata/au');if(_0x4f71af||_0x4eb7f2){const _0x3ff70b=_0x6bb39c+','+_0x4b5fec,_0x338f9c=_0x312a3a[_0x3ff70b];!_0x338f9c?_0x312a3a[_0x3ff70b]={'activity':_0x6bb39c,'dimensions':_0x4b5fec,'created':_0x4f71af?_0x5e5b58:null,'updated':_0x4eb7f2?_0x5e5b58:null}:_0x338f9c[_0x4f71af?'created':'updated']=_0x5e5b58;}}['sortEntriesByCreated'](_0x2397e9){const _0x24931f=Object['values'](_0x2397e9);return _0x24931f['sort']((_0x303ead,_0x2d8cde)=>{return(_0x303ead['created']||_0x303ead['updated'])['localeCompare'](_0x2d8cde['created']||_0x2d8cde['updated']);}),_0x24931f;}['keyToObject'](_0x25b547){function _0x4eac08(_0x47d7c0){const _0x2fced7=_0x47d7c0['split'](',');if(_0x2fced7['length']>0x1)return _0x2fced7['shift'](),_0x2fced7['join'](',');}const _0x790f82=_0x25b547['split']('-');return _0x790f82['length']===0x4?{'index':parseInt(_0x790f82[0x2],0xa),'dimension':_0x4eac08(_0x790f82[0x1])}:{'index':parseInt(_0x790f82[0x2],0xa),'secondary':parseInt(_0x790f82[0x3],0xa),'dimension':_0x4eac08(_0x790f82[0x1])};}['sortParts'](_0x1e7931){return _0x1e7931['sort']((_0x3c92ab,_0x1e0c49)=>{const {dimension:_0x2f3572,index:_0x43cfe8,secondary:_0x52472b}=_0x3c92ab,{dimension:_0x24a5fb,index:_0x51c36b,secondary:_0x3de85f}=_0x1e0c49;if(_0x2f3572===undefined&&_0x24a5fb!==undefined)return-0x1;if(_0x2f3572!==undefined&&_0x24a5fb===undefined)return 0x1;if(_0x2f3572!==undefined&&_0x24a5fb!==undefined){if(_0x2f3572<_0x24a5fb)return-0x1;if(_0x2f3572>_0x24a5fb)return 0x1;}if(_0x43cfe8<_0x51c36b)return-0x1;if(_0x43cfe8>_0x51c36b)return 0x1;if(_0x52472b===undefined&&_0x3de85f!==undefined)return-0x1;if(_0x52472b!==undefined&&_0x3de85f===undefined)return 0x1;if(_0x52472b!==undefined&&_0x3de85f!==undefined){if(_0x52472b<_0x3de85f)return-0x1;if(_0x52472b>_0x3de85f)return 0x1;}return 0x0;});}}exports['ExporterService']=ExporterService,ExporterService['symbols']=new Map();
|
|
@@ -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, {
|
|
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)
|
|
167
|
-
|
|
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, {
|
|
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
|
|
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: {
|
|
98
|
+
engine: { connection: providerConfig },
|
|
99
99
|
workers: [
|
|
100
100
|
{
|
|
101
101
|
topic: activityTopic,
|
|
102
|
-
|
|
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
|
|
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: {
|
|
174
|
+
engine: { connection: providerConfig },
|
|
175
175
|
workers: [
|
|
176
176
|
{
|
|
177
177
|
topic: workflowTopic,
|
|
178
|
-
|
|
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
|
-
|
|
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.
|
|
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(
|
|
45
|
-
return new index_1.MeshData(
|
|
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
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
271
|
+
if (!profile.db.connection) {
|
|
305
272
|
continue;
|
|
306
273
|
}
|
|
307
274
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';(function(_0x44bcb8,_0x16b321){var _0x1d383d=_0x3245,_0x55fb5b=_0x44bcb8();while(!![]){try{var _0x2544af=-parseInt(_0x1d383d(0x1ba))/0x1*(parseInt(_0x1d383d(0x1c1))/0x2)+parseInt(_0x1d383d(0x1c0))/0x3+parseInt(_0x1d383d(0x1bc))/0x4+parseInt(_0x1d383d(0x1be))/0x5+-parseInt(_0x1d383d(0x1bb))/0x6+parseInt(_0x1d383d(0x1c2))/0x7*(-parseInt(_0x1d383d(0x1bf))/0x8)+parseInt(_0x1d383d(0x1bd))/0x9;if(_0x2544af===_0x16b321)break;else _0x55fb5b['push'](_0x55fb5b['shift']());}catch(_0x216fbc){_0x55fb5b['push'](_0x55fb5b['shift']());}}}(_0x8a9b,0xba80e));function _0x3245(_0x5730c2,_0x45dbe8){var _0x8a9bbb=_0x8a9b();return _0x3245=function(_0x3245f2,_0x41f7fa){_0x3245f2=_0x3245f2-0x1ba;var _0x4e8586=_0x8a9bbb[_0x3245f2];return _0x4e8586;},_0x3245(_0x5730c2,_0x45dbe8);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['ArrayHandler']=void 0x0;class ArrayHandler{['get'](_0x1bb77e,_0x4f78ed){return _0x1bb77e?.[_0x4f78ed||0x0];}['length'](_0x228533){return _0x228533?.['length'];}['concat'](_0x501c89,_0x1fce2d){return _0x501c89['concat'](_0x1fce2d);}['indexOf'](_0x3ac355,_0x386def,_0x4a22d8){return _0x3ac355['indexOf'](_0x386def,_0x4a22d8);}['join'](_0x327a4e,_0x3f4a3e){return _0x327a4e['join'](_0x3f4a3e);}['lastIndexOf'](_0x8f0d6a,_0x6803c4,_0x35aa8f){return _0x8f0d6a['lastIndexOf'](_0x6803c4,_0x35aa8f);}['pop'](_0x34e99d){return _0x34e99d['pop']();}['push'](_0x12e822,..._0x27d0a1){return _0x12e822['push'](..._0x27d0a1),_0x12e822;}['reverse'](_0xc8a209){return _0xc8a209['reverse']();}['shift'](_0x23e373){return _0x23e373['shift']();}['slice'](_0x748b03,_0x39054b,_0x39353c){return _0x748b03['slice'](_0x39054b,_0x39353c);}['sort'](_0x363e10,_0x213ed3='ASCENDING'){return _0x363e10['sort']((_0x57701e,_0x295d8c)=>{if(_0x213ed3==='ASCENDING'){if(_0x57701e===_0x295d8c)return 0x0;if(_0x57701e===null||_0x57701e===undefined)return-0x1;if(_0x295d8c===null||_0x295d8c===undefined)return 0x1;if(typeof _0x57701e==='string'&&typeof _0x295d8c==='string')return _0x57701e['localeCompare'](_0x295d8c);return _0x57701e<_0x295d8c?-0x1:0x1;}else{if(_0x57701e===_0x295d8c)return 0x0;if(_0x57701e===null||_0x57701e===undefined)return 0x1;if(_0x295d8c===null||_0x295d8c===undefined)return-0x1;if(typeof _0x57701e==='string'&&typeof _0x295d8c==='string')return _0x295d8c['localeCompare'](_0x57701e);return _0x57701e>_0x295d8c?-0x1:0x1;}});}['splice'](_0x3ecebd,_0x499520,_0x236d46,..._0x32037d){return _0x3ecebd['splice'](_0x499520,_0x236d46,..._0x32037d);}['unshift'](_0x1ea640,..._0x431d35){return _0x1ea640['unshift'](..._0x431d35);}}exports['ArrayHandler']=ArrayHandler;function _0x8a9b(){var _0x192720=['440lakZsI','3156198vPwDpY','2fLrlgs','29407lIdPeM','1477990cuksGG','1565472bfLeca','1016796nqSGEO','9742104UrRXDZ','1725770FKDcVo'];_0x8a9b=function(){return _0x192720;};return _0x8a9b();}
|