@hotmeshio/hotmesh 0.3.8 → 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.
- package/README.md +2 -17
- package/build/index.d.ts +4 -2
- package/build/index.js +6 -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 +14 -7
- 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 +6 -0
- package/build/services/connector/factory.js +56 -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 +39 -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/_deploy.d.ts +2 -1
- package/build/services/stream/providers/postgres/_deploy.js +1 -1
- package/build/services/stream/providers/postgres/postgres.d.ts +0 -0
- package/build/services/stream/providers/postgres/postgres.js +0 -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 +6 -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 +48 -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 +8 -5
- package/package.json +14 -7
- package/types/hotmesh.ts +139 -22
- package/types/index.ts +26 -17
- package/types/manifest.ts +1 -10
- package/types/meshcall.ts +38 -13
- package/types/meshflow.ts +2 -7
- package/types/nats.ts +231 -0
- package/types/postgres.ts +54 -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
|
@@ -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 _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 {
|
|
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';function
|
|
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();
|
|
@@ -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';function
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x38e97e,_0x38766c){var _0x847ef2=_0x268d,_0x294640=_0x38e97e();while(!![]){try{var _0x4ceae2=-parseInt(_0x847ef2(0xa2))/0x1*(-parseInt(_0x847ef2(0xa5))/0x2)+-parseInt(_0x847ef2(0xab))/0x3+-parseInt(_0x847ef2(0xa3))/0x4*(-parseInt(_0x847ef2(0xaa))/0x5)+-parseInt(_0x847ef2(0xa8))/0x6+-parseInt(_0x847ef2(0xa6))/0x7+parseInt(_0x847ef2(0xa7))/0x8*(parseInt(_0x847ef2(0xac))/0x9)+parseInt(_0x847ef2(0xa4))/0xa*(parseInt(_0x847ef2(0xa9))/0xb);if(_0x4ceae2===_0x38766c)break;else _0x294640['push'](_0x294640['shift']());}catch(_0x1c93a5){_0x294640['push'](_0x294640['shift']());}}}(_0x52d0,0x9ffc4));function _0x268d(_0x27795d,_0x4cf75b){var _0x52d0ab=_0x52d0();return _0x268d=function(_0x268d2a,_0x12b4a2){_0x268d2a=_0x268d2a-0xa2;var _0x2b0423=_0x52d0ab[_0x268d2a];return _0x2b0423;},_0x268d(_0x27795d,_0x4cf75b);}function _0x52d0(){var _0x4dbbc8=['9kyedLF','2XjZLGk','371956dImJkC','340UnRxAD','773382hGQIZR','8772925NWBTkl','1946664abNKkz','1086480ESKPQj','376079GpZshd','65LzfRFd','3895029zJdmkS'];_0x52d0=function(){return _0x4dbbc8;};return _0x52d0();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['BitwiseHandler']=void 0x0;class BitwiseHandler{['and'](_0x2cd269,_0x28469e){return _0x2cd269&_0x28469e;}['or'](_0x520413,_0x2b0696){return _0x520413|_0x2b0696;}['xor'](_0x4c6803,_0x385b28){return _0x4c6803^_0x385b28;}['leftShift'](_0x2cf3b7,_0x3ca81d){return _0x2cf3b7<<_0x3ca81d;}['rightShift'](_0x649102,_0xa8fd01){return _0x649102>>_0xa8fd01;}['unsignedRightShift'](_0xe039c7,_0x2dfb6e){return _0xe039c7>>>_0x2dfb6e;}}exports['BitwiseHandler']=BitwiseHandler;
|