@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,17 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ILogger } from '../logger';
|
|
3
|
-
import { StoreService } from '../store';
|
|
4
3
|
import { StreamService } from '../stream';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
declare class Router {
|
|
8
|
-
static instances: Set<Router
|
|
4
|
+
import { RouterConfig, StreamData, StreamDataResponse, StreamRole } from '../../types/stream';
|
|
5
|
+
import { ProviderClient, ProviderTransaction } from '../../types/provider';
|
|
6
|
+
declare class Router<S extends StreamService<ProviderClient, ProviderTransaction>> {
|
|
7
|
+
static instances: Set<Router<any>>;
|
|
9
8
|
appId: string;
|
|
10
9
|
guid: string;
|
|
11
10
|
role: StreamRole;
|
|
12
11
|
topic: string | undefined;
|
|
13
|
-
|
|
14
|
-
stream: StreamService<RedisClient, RedisMulti>;
|
|
12
|
+
stream: S;
|
|
15
13
|
reclaimDelay: number;
|
|
16
14
|
reclaimCount: number;
|
|
17
15
|
logger: ILogger;
|
|
@@ -27,16 +25,16 @@ declare class Router {
|
|
|
27
25
|
isSleeping: boolean;
|
|
28
26
|
sleepTimout: NodeJS.Timeout | null;
|
|
29
27
|
readonly: boolean;
|
|
30
|
-
constructor(config:
|
|
28
|
+
constructor(config: RouterConfig, stream: S, logger: ILogger);
|
|
31
29
|
private resetThrottleState;
|
|
32
30
|
createGroup(stream: string, group: string): Promise<void>;
|
|
33
|
-
publishMessage(topic: string, streamData: StreamData | StreamDataResponse,
|
|
31
|
+
publishMessage(topic: string, streamData: StreamData | StreamDataResponse, transaction?: ProviderTransaction): Promise<string | ProviderTransaction>;
|
|
34
32
|
customSleep(): Promise<void>;
|
|
35
33
|
consumeMessages(stream: string, group: string, consumer: string, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<void>;
|
|
36
34
|
isStreamMessage(result: any): boolean;
|
|
37
35
|
isPaused(): boolean;
|
|
38
36
|
isStopped(group: string, consumer: string, stream: string): boolean;
|
|
39
|
-
consumeOne(stream: string, group: string, id: string,
|
|
37
|
+
consumeOne(stream: string, group: string, id: string, input: StreamData, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<void>;
|
|
40
38
|
execStreamLeg(input: StreamData, stream: string, id: string, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<StreamData>;
|
|
41
39
|
ackAndDelete(stream: string, group: string, id: string): Promise<void>;
|
|
42
40
|
publishResponse(input: StreamData, output: StreamDataResponse | void): Promise<string>;
|
|
@@ -48,8 +46,5 @@ declare class Router {
|
|
|
48
46
|
stopConsuming(): Promise<void>;
|
|
49
47
|
cancelThrottle(): void;
|
|
50
48
|
setThrottle(delayInMillis: number): void;
|
|
51
|
-
claimUnacknowledged(stream: string, group: string, consumer: string, idleTimeMs?: number, limit?: number): Promise<[string, [string, string]][]>;
|
|
52
|
-
expireUnacknowledged(reclaimedMessage: ReclaimedMessageType, stream: string, group: string, consumer: string, id: string, count: number): Promise<void>;
|
|
53
|
-
parseStreamData(str: string): [undefined, StreamData] | [Error];
|
|
54
49
|
}
|
|
55
50
|
export { Router };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x59722d,_0x229905){const _0xbf2560=_0x1497,_0x3810af=_0x59722d();while(!![]){try{const _0x3a8fc5=parseInt(_0xbf2560(0x133))/0x1+-parseInt(_0xbf2560(0x132))/0x2+parseInt(_0xbf2560(0x12b))/0x3+parseInt(_0xbf2560(0x12f))/0x4+-parseInt(_0xbf2560(0x12c))/0x5*(-parseInt(_0xbf2560(0x12a))/0x6)+parseInt(_0xbf2560(0x130))/0x7*(parseInt(_0xbf2560(0x131))/0x8)+parseInt(_0xbf2560(0x12e))/0x9*(-parseInt(_0xbf2560(0x12d))/0xa);if(_0x3a8fc5===_0x229905)break;else _0x3810af['push'](_0x3810af['shift']());}catch(_0x22f558){_0x3810af['push'](_0x3810af['shift']());}}}(_0x3857,0xec2cc));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Router']=void 0x0;function _0x1497(_0xebafa5,_0x2c96c4){const _0x385716=_0x3857();return _0x1497=function(_0x149737,_0x498101){_0x149737=_0x149737-0x12a;let _0x40313=_0x385716[_0x149737];return _0x40313;},_0x1497(_0xebafa5,_0x2c96c4);}function _0x3857(){const _0x297259=['1687509fiKasR','23325qtJbSd','1444070CscMws','261jIVtFI','3448588lRoyEb','14ZDVEEE','6651448syIWjE','399446KRSgqH','1012501uIygYT','1614RdjOSS'];_0x3857=function(){return _0x297259;};return _0x3857();}const enums_1=require('../../modules/enums'),key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),telemetry_1=require('../telemetry'),stream_1=require('../../types/stream');class Router{constructor(_0x1bbcdc,_0x211153,_0x43c661,_0x3b4dfe){this['throttle']=0x0,this['errorCount']=0x0,this['counts']={},this['currentTimerId']=null,this['sleepPromiseResolve']=null,this['innerPromiseResolve']=null,this['isSleeping']=![],this['sleepTimout']=null,this['appId']=_0x1bbcdc['appId'],this['guid']=_0x1bbcdc['guid'],this['role']=_0x1bbcdc['role'],this['topic']=_0x1bbcdc['topic'],this['stream']=_0x211153,this['store']=_0x43c661,this['throttle']=_0x1bbcdc['throttle'],this['reclaimDelay']=_0x1bbcdc['reclaimDelay']||enums_1['HMSH_XCLAIM_DELAY_MS'],this['reclaimCount']=_0x1bbcdc['reclaimCount']||enums_1['HMSH_XCLAIM_COUNT'],this['logger']=_0x3b4dfe,this['readonly']=_0x1bbcdc['readonly']||![],this['resetThrottleState']();}['resetThrottleState'](){this['sleepPromiseResolve']=null,this['innerPromiseResolve']=null,this['isSleeping']=![],this['sleepTimout']=null;}async['createGroup'](_0x20434c,_0x3ede67){try{await this['stream']['createConsumerGroup'](_0x20434c,_0x3ede67);}catch(_0x507f2b){this['logger']['debug']('router-stream-group-exists',{'stream':_0x20434c,'group':_0x3ede67});}}async['publishMessage'](_0x62eba2,_0xe3a98a,_0x174b4a){const _0x244ad3=_0xe3a98a?.['code']||'200';this['counts'][_0x244ad3]=(this['counts'][_0x244ad3]||0x0)+0x1;const _0x55768d=this['store']['mintKey'](key_1['KeyType']['STREAMS'],{'appId':this['store']['appId'],'topic':_0x62eba2});return await this['stream']['publishMessage'](_0x55768d,'*','message',JSON['stringify'](_0xe3a98a),_0x174b4a);}async['customSleep'](){if(this['throttle']===0x0)return;if(this['isSleeping'])return;this['isSleeping']=!![];const _0x57e443=Date['now']();await new Promise(async _0x305289=>{this['sleepPromiseResolve']=_0x305289;let _0x4a54ac=Date['now']()-_0x57e443;while(_0x4a54ac<this['throttle']){await new Promise(_0xe5409f=>{this['innerPromiseResolve']=_0xe5409f,this['sleepTimout']=setTimeout(_0xe5409f,this['throttle']-_0x4a54ac);}),_0x4a54ac=Date['now']()-_0x57e443;}this['resetThrottleState'](),_0x305289();});}async['consumeMessages'](_0x1ed84f,_0x456233,_0xbf91a2,_0xa09e7c){if(this['readonly']){this['logger']['info']('router-stream-readonly',{'group':_0x456233,'consumer':_0xbf91a2,'stream':_0x1ed84f});return;}this['logger']['info']('router-stream-starting',{'group':_0x456233,'consumer':_0xbf91a2,'stream':_0x1ed84f}),Router['instances']['add'](this),this['shouldConsume']=!![],await this['createGroup'](_0x1ed84f,_0x456233);let _0x1c00cf=Date['now']();async function _0x13d0e3(){await this['customSleep']();if(this['isStopped'](_0x456233,_0xbf91a2,_0x1ed84f))return;else{if(this['isPaused']()){setImmediate(_0x13d0e3['bind'](this));return;}}try{const _0x2b8451=enums_1['HMSH_BLOCK_TIME_MS']+Math['round'](enums_1['HMSH_BLOCK_TIME_MS']*Math['random']()),_0x104a66=await this['stream']['consumeMessages'](_0x456233,_0xbf91a2,_0x2b8451,_0x1ed84f);if(this['isStopped'](_0x456233,_0xbf91a2,_0x1ed84f))return;else{if(this['isPaused']()){setImmediate(_0x13d0e3['bind'](this));return;}}if(this['isStreamMessage'](_0x104a66)){const [[,_0x1f92d8]]=_0x104a66;for(const [_0x43a09a,_0x44d96b]of _0x1f92d8){await this['consumeOne'](_0x1ed84f,_0x456233,_0x43a09a,_0x44d96b,_0xa09e7c);}}const _0x57053a=Date['now']();if(_0x57053a-_0x1c00cf>this['reclaimDelay']){_0x1c00cf=_0x57053a;const _0x141bd4=await this['claimUnacknowledged'](_0x1ed84f,_0x456233,_0xbf91a2);for(const [_0x468617,_0x8abd3f]of _0x141bd4){await this['consumeOne'](_0x1ed84f,_0x456233,_0x468617,_0x8abd3f,_0xa09e7c);}}setImmediate(_0x13d0e3['bind'](this));}catch(_0x3ef181){if(this['shouldConsume']&&process['env']['NODE_ENV']!=='test'){this['logger']['error']('router-stream-error',{'err':_0x3ef181,'stream':_0x1ed84f,'group':_0x456233,'consumer':_0xbf91a2}),this['errorCount']++;const _0x340004=Math['min'](enums_1['HMSH_GRADUATED_INTERVAL_MS']*0x2**this['errorCount'],enums_1['HMSH_MAX_TIMEOUT_MS']);setTimeout(_0x13d0e3['bind'](this),_0x340004);}}}_0x13d0e3['call'](this);}['isStreamMessage'](_0x384b96){return Array['isArray'](_0x384b96)&&Array['isArray'](_0x384b96[0x0]);}['isPaused'](){return this['throttle']===enums_1['MAX_DELAY'];}['isStopped'](_0x582ccb,_0xdaa0c9,_0x53101e){return!this['shouldConsume']&&this['logger']['info']('router-stream-stopped',{'group':_0x582ccb,'consumer':_0xdaa0c9,'stream':_0x53101e}),!this['shouldConsume'];}async['consumeOne'](_0xc902a,_0x478bd2,_0x471dec,_0x11d08d,_0x5e99c5){this['logger']['debug']('stream-read-one',{'group':_0x478bd2,'stream':_0xc902a,'id':_0x471dec});const [_0x53602f,_0x1afdac]=this['parseStreamData'](_0x11d08d[0x1]);let _0x3dfef7,_0x44e791;try{_0x44e791=new telemetry_1['TelemetryService'](this['appId']),_0x44e791['startStreamSpan'](_0x1afdac,this['role']),_0x3dfef7=await this['execStreamLeg'](_0x1afdac,_0xc902a,_0x471dec,_0x5e99c5['bind'](this)),_0x3dfef7?.['status']===stream_1['StreamStatus']['ERROR']&&_0x44e791['setStreamError']('Function\x20Status\x20Code\x20'+(_0x3dfef7['code']||enums_1['HMSH_CODE_UNKNOWN'])),this['errorCount']=0x0;}catch(_0x3b89b2){this['logger']['error']('stream-read-one-error',{'group':_0x478bd2,'stream':_0xc902a,'id':_0x471dec,'err':_0x3b89b2}),_0x44e791['setStreamError'](_0x3b89b2['message']);}const _0x42122a=await this['publishResponse'](_0x1afdac,_0x3dfef7);_0x44e791['setStreamAttributes']({'app.worker.mid':_0x42122a}),await this['ackAndDelete'](_0xc902a,_0x478bd2,_0x471dec),_0x44e791['endStreamSpan'](),this['logger']['debug']('stream-read-one-end',{'group':_0x478bd2,'stream':_0xc902a,'id':_0x471dec});}async['execStreamLeg'](_0x1f5d34,_0x3fe92c,_0x5452da,_0x27d2fe){let _0x3141d;try{_0x3141d=await _0x27d2fe(_0x1f5d34);}catch(_0xf6bbf1){this['logger']['error']('stream-call-function-error',{..._0xf6bbf1,'input':_0x1f5d34,'stack':_0xf6bbf1['stack'],'message':_0xf6bbf1['message'],'name':_0xf6bbf1['name'],'stream':_0x3fe92c,'id':_0x5452da}),_0x3141d=this['structureUnhandledError'](_0x1f5d34,_0xf6bbf1);}return _0x3141d;}async['ackAndDelete'](_0xd1a166,_0x435f48,_0x2b71bb){await this['stream']['ackAndDelete'](_0xd1a166,_0x435f48,_0x2b71bb);}async['publishResponse'](_0xb25818,_0x1061ad){if(_0x1061ad&&typeof _0x1061ad==='object'){if(_0x1061ad['status']==='error'){const [_0x4de53f,_0x514ec4]=this['shouldRetry'](_0xb25818,_0x1061ad);if(_0x4de53f)return await(0x0,utils_1['sleepFor'])(_0x514ec4),await this['publishMessage'](_0xb25818['metadata']['topic'],{'data':_0xb25818['data'],'metadata':{..._0xb25818['metadata'],'try':(_0xb25818['metadata']['try']||0x0)+0x1},'policies':_0xb25818['policies']});else _0x1061ad=this['structureError'](_0xb25818,_0x1061ad);}else typeof _0x1061ad['metadata']!=='object'?_0x1061ad['metadata']={..._0xb25818['metadata'],'guid':(0x0,utils_1['guid'])()}:_0x1061ad['metadata']['guid']=(0x0,utils_1['guid'])();return _0x1061ad['type']=stream_1['StreamDataType']['RESPONSE'],await this['publishMessage'](null,_0x1061ad);}}['shouldRetry'](_0x15b065,_0x4630c6){const _0x320c86=_0x15b065['policies']?.['retry'],_0x38d047=_0x4630c6['code']['toString'](),_0x270835=_0x320c86?.[_0x38d047],_0x2d0671=_0x270835?.[0x0],_0x4a2e7f=Math['min'](_0x15b065['metadata']['try']||0x0,enums_1['HMSH_MAX_RETRIES']);if(_0x2d0671>_0x4a2e7f)return[!![],Math['pow'](0xa,_0x4a2e7f+0x1)];return[![],0x0];}['structureUnhandledError'](_0x1cc755,_0x227eeb){const _0x4a753c={};return typeof _0x227eeb['message']==='string'?_0x4a753c['message']=_0x227eeb['message']:_0x4a753c['message']=enums_1['HMSH_STATUS_UNKNOWN'],typeof _0x227eeb['stack']==='string'&&(_0x4a753c['stack']=_0x227eeb['stack']),typeof _0x227eeb['name']==='string'&&(_0x4a753c['name']=_0x227eeb['name']),{'status':'error','code':enums_1['HMSH_CODE_UNKNOWN'],'metadata':{..._0x1cc755['metadata'],'guid':(0x0,utils_1['guid'])()},'data':_0x4a753c};}['structureUnacknowledgedError'](_0x4124c3){const _0x46e0f4='stream\x20message\x20max\x20delivery\x20count\x20exceeded',_0x17bfdb=enums_1['HMSH_CODE_UNACKED'],_0x540ddd={'message':_0x46e0f4,'code':_0x17bfdb},_0xb11a5e={'metadata':{..._0x4124c3['metadata'],'guid':(0x0,utils_1['guid'])()},'status':stream_1['StreamStatus']['ERROR'],'code':_0x17bfdb,'data':_0x540ddd};return delete _0xb11a5e['metadata']['topic'],_0xb11a5e;}['structureError'](_0x22b3bc,_0x1d2480){const _0x512ccf=_0x1d2480['data']?.['message']?_0x1d2480['data']?.['message']['toString']():enums_1['HMSH_STATUS_UNKNOWN'],_0x4ea3e2=_0x1d2480['code']||_0x1d2480['data']?.['code'],_0x2c2b25=isNaN(_0x4ea3e2)?enums_1['HMSH_CODE_UNKNOWN']:parseInt(_0x4ea3e2['toString']()),_0x22cc05=_0x1d2480['data']?.['stack']?_0x1d2480['data']?.['stack']['toString']():undefined,_0x573ab4={'message':_0x512ccf,'code':_0x2c2b25,'stack':_0x22cc05};return typeof _0x1d2480['data']?.['error']==='object'&&(_0x573ab4['error']={..._0x1d2480['data']['error']}),{'status':stream_1['StreamStatus']['ERROR'],'code':_0x2c2b25,'stack':_0x22cc05,'metadata':{..._0x22b3bc['metadata'],'guid':(0x0,utils_1['guid'])()},'data':_0x573ab4};}static async['stopConsuming'](){for(const _0x3d9a28 of[...Router['instances']]){_0x3d9a28['stopConsuming']();}await(0x0,utils_1['sleepFor'])(enums_1['HMSH_BLOCK_TIME_MS']*0x2);}async['stopConsuming'](){this['shouldConsume']=![],this['logger']['info']('router-stream-stopping',this['topic']?{'topic':this['topic']}:undefined),this['cancelThrottle']();}['cancelThrottle'](){this['sleepTimout']&&clearTimeout(this['sleepTimout']),this['resetThrottleState']();}['setThrottle'](_0x3cb4f1){if(!Number['isInteger'](_0x3cb4f1)||_0x3cb4f1<0x0||_0x3cb4f1>enums_1['MAX_DELAY'])throw new Error('Throttle\x20must\x20be\x20a\x20non-negative\x20integer\x20and\x20not\x20exceed\x20'+enums_1['MAX_DELAY']+'\x20ms;\x20send\x20-1\x20to\x20throttle\x20indefinitely');const _0x4da5f8=_0x3cb4f1<this['throttle'];this['throttle']=_0x3cb4f1,_0x4da5f8&&(this['sleepTimout']&&clearTimeout(this['sleepTimout']),this['innerPromiseResolve']&&this['innerPromiseResolve']());}async['claimUnacknowledged'](_0x47d7da,_0x44fadb,_0x419390,_0xd34721=this['reclaimDelay'],_0x3e553d=enums_1['HMSH_XPENDING_COUNT']){let _0x2cd959=[];const _0x34e400=await this['stream']['getPendingMessages'](_0x47d7da,_0x44fadb,_0x3e553d);for(const _0x240e0f of _0x34e400){if(Array['isArray'](_0x240e0f)){const [_0x1f732a,,_0x39967a,_0x2ec6d3]=_0x240e0f;if(_0x39967a>_0xd34721){const _0x3f9973=await this['stream']['claimMessage'](_0x47d7da,_0x44fadb,_0x419390,_0xd34721,_0x1f732a);_0x3f9973['length']&&(_0x2ec6d3<=this['reclaimCount']?_0x2cd959=_0x2cd959['concat'](_0x3f9973):await this['expireUnacknowledged'](_0x3f9973,_0x47d7da,_0x44fadb,_0x419390,_0x1f732a,_0x2ec6d3));}}}return _0x2cd959;}async['expireUnacknowledged'](_0x33eb80,_0x3ff700,_0x3b82f1,_0x447e77,_0x17536a,_0x20f24f){this['logger']['error']('stream-message-max-delivery-count-exceeded',{'id':_0x17536a,'stream':_0x3ff700,'group':_0x3b82f1,'consumer':_0x447e77,'code':enums_1['HMSH_CODE_UNACKED'],'count':_0x20f24f});const _0x5c26d0=_0x33eb80[0x0]?.[0x1]?.[0x1],[_0x24d49f,_0x5f1ccd]=this['parseStreamData'](_0x5c26d0);if(_0x24d49f)return this['logger']['error']('expire-unacknowledged-parse-fatal-error',{'id':_0x17536a,'err':_0x24d49f});else{if(!_0x5f1ccd||!_0x5f1ccd['metadata'])return this['logger']['error']('expire-unacknowledged-parse-fatal-error',{'id':_0x17536a});}let _0x1ea3cd,_0x2d7626;try{_0x1ea3cd=new telemetry_1['TelemetryService'](this['appId']),_0x1ea3cd['startStreamSpan'](_0x5f1ccd,stream_1['StreamRole']['SYSTEM']),_0x1ea3cd['setStreamError']('Stream\x20Message\x20Max\x20Delivery\x20Count\x20Exceeded');const _0x36314c=this['structureUnacknowledgedError'](_0x5f1ccd);_0x2d7626=await this['publishResponse'](_0x5f1ccd,_0x36314c),_0x1ea3cd['setStreamAttributes']({'app.worker.mid':_0x2d7626}),await this['ackAndDelete'](_0x3ff700,_0x3b82f1,_0x17536a);}catch(_0x451ad5){_0x2d7626?(this['logger']['error']('expire-unacknowledged-pub-fatal-error',{'id':_0x17536a,'err':_0x451ad5,..._0x5f1ccd['metadata']}),_0x1ea3cd['setStreamAttributes']({'app.system.fatal':'expire-unacknowledged-pub-fatal-error'})):(this['logger']['error']('expire-unacknowledged-ack-fatal-error',{'id':_0x17536a,'err':_0x451ad5,..._0x5f1ccd['metadata']}),_0x1ea3cd['setStreamAttributes']({'app.system.fatal':'expire-unacknowledged-ack-fatal-error'}));}finally{_0x1ea3cd['endStreamSpan']();}}['parseStreamData'](_0x7d8d37){try{return[,JSON['parse'](_0x7d8d37)];}catch(_0x5eef93){return[_0x5eef93];}}}exports['Router']=Router,Router['instances']=new Set();
|
|
1
|
+
'use strict';function _0x1111(_0x101a33,_0x12ae84){const _0x5ed1c7=_0x5ed1();return _0x1111=function(_0x111166,_0x1e39dc){_0x111166=_0x111166-0x89;let _0x2b156a=_0x5ed1c7[_0x111166];return _0x2b156a;},_0x1111(_0x101a33,_0x12ae84);}(function(_0x194dec,_0x56c92e){const _0x1b4abd=_0x1111,_0x5756e2=_0x194dec();while(!![]){try{const _0x1e0db8=-parseInt(_0x1b4abd(0x8a))/0x1*(-parseInt(_0x1b4abd(0x93))/0x2)+parseInt(_0x1b4abd(0x91))/0x3*(-parseInt(_0x1b4abd(0x90))/0x4)+-parseInt(_0x1b4abd(0x8d))/0x5*(parseInt(_0x1b4abd(0x8f))/0x6)+parseInt(_0x1b4abd(0x92))/0x7+parseInt(_0x1b4abd(0x8b))/0x8+parseInt(_0x1b4abd(0x8e))/0x9*(parseInt(_0x1b4abd(0x8c))/0xa)+-parseInt(_0x1b4abd(0x89))/0xb;if(_0x1e0db8===_0x56c92e)break;else _0x5756e2['push'](_0x5756e2['shift']());}catch(_0x4a81c7){_0x5756e2['push'](_0x5756e2['shift']());}}}(_0x5ed1,0x3094a));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Router']=void 0x0;const enums_1=require('../../modules/enums'),key_1=require('../../modules/key'),utils_1=require('../../modules/utils'),telemetry_1=require('../telemetry'),stream_1=require('../../types/stream');function _0x5ed1(){const _0x130f74=['84RdIHVf','4yrwmQx','305379aKITYi','2259278mSyWNP','80534zESszf','8189896ZTLKnD','6jrSmKG','2484880oFlGZs','1370YDdXvY','58400qpTJIw','21933YIjGNq'];_0x5ed1=function(){return _0x130f74;};return _0x5ed1();}class Router{constructor(_0x583c87,_0x3ade64,_0x55d9a9){this['throttle']=0x0,this['errorCount']=0x0,this['counts']={},this['currentTimerId']=null,this['sleepPromiseResolve']=null,this['innerPromiseResolve']=null,this['isSleeping']=![],this['sleepTimout']=null,this['appId']=_0x583c87['appId'],this['guid']=_0x583c87['guid'],this['role']=_0x583c87['role'],this['topic']=_0x583c87['topic'],this['stream']=_0x3ade64,this['throttle']=_0x583c87['throttle'],this['reclaimDelay']=_0x583c87['reclaimDelay']||enums_1['HMSH_XCLAIM_DELAY_MS'],this['reclaimCount']=_0x583c87['reclaimCount']||enums_1['HMSH_XCLAIM_COUNT'],this['logger']=_0x55d9a9,this['readonly']=_0x583c87['readonly']||![],this['resetThrottleState']();}['resetThrottleState'](){this['sleepPromiseResolve']=null,this['innerPromiseResolve']=null,this['isSleeping']=![],this['sleepTimout']=null;}async['createGroup'](_0x15a2bc,_0x5c4ecc){try{await this['stream']['createConsumerGroup'](_0x15a2bc,_0x5c4ecc);}catch(_0x3969e4){this['logger']['debug']('router-stream-group-exists',{'stream':_0x15a2bc,'group':_0x5c4ecc});}}async['publishMessage'](_0x2fe163,_0xc657ce,_0x4fd587){const _0x288b0e=_0xc657ce?.['code']||'200';this['counts'][_0x288b0e]=(this['counts'][_0x288b0e]||0x0)+0x1;const _0x31c843=this['stream']['mintKey'](key_1['KeyType']['STREAMS'],{'topic':_0x2fe163}),_0x3f84e4=await this['stream']['publishMessages'](_0x31c843,[JSON['stringify'](_0xc657ce)],{'transaction':_0x4fd587});return _0x3f84e4[0x0];}async['customSleep'](){if(this['throttle']===0x0)return;if(this['isSleeping'])return;this['isSleeping']=!![];const _0x229b08=Date['now']();await new Promise(async _0x22db03=>{this['sleepPromiseResolve']=_0x22db03;let _0x1bce8f=Date['now']()-_0x229b08;while(_0x1bce8f<this['throttle']){await new Promise(_0x18f879=>{this['innerPromiseResolve']=_0x18f879,this['sleepTimout']=setTimeout(_0x18f879,this['throttle']-_0x1bce8f);}),_0x1bce8f=Date['now']()-_0x229b08;}this['resetThrottleState'](),_0x22db03();});}async['consumeMessages'](_0x4d4c53,_0x297bb0,_0x25ff68,_0x49e526){if(this['readonly']){this['logger']['info']('router-stream-readonly',{'group':_0x297bb0,'consumer':_0x25ff68,'stream':_0x4d4c53});return;}this['logger']['info']('router-stream-starting',{'group':_0x297bb0,'consumer':_0x25ff68,'stream':_0x4d4c53}),Router['instances']['add'](this),this['shouldConsume']=!![],await this['createGroup'](_0x4d4c53,_0x297bb0);let _0x18f88d=Date['now']();async function _0x5d0ee2(){await this['customSleep']();if(this['isStopped'](_0x297bb0,_0x25ff68,_0x4d4c53))return;else{if(this['isPaused']()){setImmediate(_0x5d0ee2['bind'](this));return;}}const _0xcb1bac=enums_1['HMSH_BLOCK_TIME_MS']+Math['round'](enums_1['HMSH_BLOCK_TIME_MS']*Math['random']());try{const _0x14648a=await this['stream']['consumeMessages'](_0x4d4c53,_0x297bb0,_0x25ff68,{'blockTimeout':_0xcb1bac});if(this['isStopped'](_0x297bb0,_0x25ff68,_0x4d4c53))return;else{if(this['isPaused']()){setImmediate(_0x5d0ee2['bind'](this));return;}}for(let _0x4493ce=0x0;_0x4493ce<_0x14648a['length'];_0x4493ce++){const _0x168485=_0x14648a[_0x4493ce];await this['consumeOne'](_0x4d4c53,_0x297bb0,_0x168485['id'],_0x168485['data'],_0x49e526);}const _0x138510=Date['now']();if(this['stream']['getProviderSpecificFeatures']()['supportsRetry']&&_0x138510-_0x18f88d>this['reclaimDelay']){_0x18f88d=_0x138510;const _0x1d4ae0=await this['stream']['retryMessages'](_0x4d4c53,_0x297bb0,{'consumerName':_0x25ff68,'minIdleTime':this['reclaimDelay'],'limit':enums_1['HMSH_XPENDING_COUNT']});for(let _0x8110f4=0x0;_0x8110f4<_0x1d4ae0['length'];_0x8110f4++){const _0x18316e=_0x1d4ae0[_0x8110f4];await this['consumeOne'](_0x4d4c53,_0x297bb0,_0x18316e['id'],_0x18316e['data'],_0x49e526);}}setImmediate(_0x5d0ee2['bind'](this));}catch(_0x302fa6){if(this['shouldConsume']&&process['env']['NODE_ENV']!=='test'){this['logger']['error']('router-stream-error',{'err':_0x302fa6,'stream':_0x4d4c53,'group':_0x297bb0,'consumer':_0x25ff68}),this['errorCount']++;const _0x161b6c=Math['min'](enums_1['HMSH_GRADUATED_INTERVAL_MS']*0x2**this['errorCount'],enums_1['HMSH_MAX_TIMEOUT_MS']);setTimeout(_0x5d0ee2['bind'](this),_0x161b6c);}}}_0x5d0ee2['call'](this);}['isStreamMessage'](_0x4467a5){return Array['isArray'](_0x4467a5)&&Array['isArray'](_0x4467a5[0x0]);}['isPaused'](){return this['throttle']===enums_1['MAX_DELAY'];}['isStopped'](_0x22e672,_0x3f15c0,_0x26e58e){return!this['shouldConsume']&&this['logger']['info']('router-stream-stopped',{'group':_0x22e672,'consumer':_0x3f15c0,'stream':_0x26e58e}),!this['shouldConsume'];}async['consumeOne'](_0x38e55b,_0x4b395b,_0x30a571,_0xb268f4,_0x41862e){this['logger']['debug']('stream-read-one',{'group':_0x4b395b,'stream':_0x38e55b,'id':_0x30a571});let _0x28df5a,_0x27e2cb;try{_0x27e2cb=new telemetry_1['TelemetryService'](this['appId']),_0x27e2cb['startStreamSpan'](_0xb268f4,this['role']),_0x28df5a=await this['execStreamLeg'](_0xb268f4,_0x38e55b,_0x30a571,_0x41862e['bind'](this)),_0x28df5a?.['status']===stream_1['StreamStatus']['ERROR']&&_0x27e2cb['setStreamError']('Function\x20Status\x20Code\x20'+(_0x28df5a['code']||enums_1['HMSH_CODE_UNKNOWN'])),this['errorCount']=0x0;}catch(_0x3da900){this['logger']['error']('stream-read-one-error',{'group':_0x4b395b,'stream':_0x38e55b,'id':_0x30a571,'err':_0x3da900}),_0x27e2cb['setStreamError'](_0x3da900['message']);}const _0x47da89=await this['publishResponse'](_0xb268f4,_0x28df5a);_0x27e2cb['setStreamAttributes']({'app.worker.mid':_0x47da89}),await this['ackAndDelete'](_0x38e55b,_0x4b395b,_0x30a571),_0x27e2cb['endStreamSpan'](),this['logger']['debug']('stream-read-one-end',{'group':_0x4b395b,'stream':_0x38e55b,'id':_0x30a571});}async['execStreamLeg'](_0x11342c,_0x284986,_0x1136ad,_0x279afa){let _0x2ae435;try{_0x2ae435=await _0x279afa(_0x11342c);}catch(_0x15e2f9){this['logger']['error']('stream-call-function-error',{..._0x15e2f9,'input':_0x11342c,'stack':_0x15e2f9['stack'],'message':_0x15e2f9['message'],'name':_0x15e2f9['name'],'stream':_0x284986,'id':_0x1136ad}),_0x2ae435=this['structureUnhandledError'](_0x11342c,_0x15e2f9);}return _0x2ae435;}async['ackAndDelete'](_0x14625a,_0x57b964,_0x4ef150){await this['stream']['ackAndDelete'](_0x14625a,_0x57b964,[_0x4ef150]);}async['publishResponse'](_0x4c5899,_0x31605e){if(_0x31605e&&typeof _0x31605e==='object'){if(_0x31605e['status']==='error'){const [_0x134f17,_0x38a5b2]=this['shouldRetry'](_0x4c5899,_0x31605e);if(_0x134f17)return await(0x0,utils_1['sleepFor'])(_0x38a5b2),await this['publishMessage'](_0x4c5899['metadata']['topic'],{'data':_0x4c5899['data'],'metadata':{..._0x4c5899['metadata'],'try':(_0x4c5899['metadata']['try']||0x0)+0x1},'policies':_0x4c5899['policies']});else _0x31605e=this['structureError'](_0x4c5899,_0x31605e);}else typeof _0x31605e['metadata']!=='object'?_0x31605e['metadata']={..._0x4c5899['metadata'],'guid':(0x0,utils_1['guid'])()}:_0x31605e['metadata']['guid']=(0x0,utils_1['guid'])();return _0x31605e['type']=stream_1['StreamDataType']['RESPONSE'],await this['publishMessage'](null,_0x31605e);}}['shouldRetry'](_0x566eae,_0x3ace72){const _0x44c711=_0x566eae['policies']?.['retry'],_0x42dce9=_0x3ace72['code']['toString'](),_0x144afa=_0x44c711?.[_0x42dce9],_0x4f6b01=_0x144afa?.[0x0],_0x1de1d7=Math['min'](_0x566eae['metadata']['try']||0x0,enums_1['HMSH_MAX_RETRIES']);if(_0x4f6b01>_0x1de1d7)return[!![],Math['pow'](0xa,_0x1de1d7+0x1)];return[![],0x0];}['structureUnhandledError'](_0x7734e,_0xed802c){const _0xe8e490={};return typeof _0xed802c['message']==='string'?_0xe8e490['message']=_0xed802c['message']:_0xe8e490['message']=enums_1['HMSH_STATUS_UNKNOWN'],typeof _0xed802c['stack']==='string'&&(_0xe8e490['stack']=_0xed802c['stack']),typeof _0xed802c['name']==='string'&&(_0xe8e490['name']=_0xed802c['name']),{'status':'error','code':enums_1['HMSH_CODE_UNKNOWN'],'metadata':{..._0x7734e['metadata'],'guid':(0x0,utils_1['guid'])()},'data':_0xe8e490};}['structureUnacknowledgedError'](_0x21fef6){const _0x532fff='stream\x20message\x20max\x20delivery\x20count\x20exceeded',_0x57db1d=enums_1['HMSH_CODE_UNACKED'],_0x532155={'message':_0x532fff,'code':_0x57db1d},_0x8e2483={'metadata':{..._0x21fef6['metadata'],'guid':(0x0,utils_1['guid'])()},'status':stream_1['StreamStatus']['ERROR'],'code':_0x57db1d,'data':_0x532155};return delete _0x8e2483['metadata']['topic'],_0x8e2483;}['structureError'](_0x3ddec8,_0x2a6644){const _0x32b828=_0x2a6644['data']?.['message']?_0x2a6644['data']?.['message']['toString']():enums_1['HMSH_STATUS_UNKNOWN'],_0x5f4754=_0x2a6644['code']||_0x2a6644['data']?.['code'],_0x515702=isNaN(_0x5f4754)?enums_1['HMSH_CODE_UNKNOWN']:parseInt(_0x5f4754['toString']()),_0x3c0e19=_0x2a6644['data']?.['stack']?_0x2a6644['data']?.['stack']['toString']():undefined,_0x558690={'message':_0x32b828,'code':_0x515702,'stack':_0x3c0e19};return typeof _0x2a6644['data']?.['error']==='object'&&(_0x558690['error']={..._0x2a6644['data']['error']}),{'status':stream_1['StreamStatus']['ERROR'],'code':_0x515702,'stack':_0x3c0e19,'metadata':{..._0x3ddec8['metadata'],'guid':(0x0,utils_1['guid'])()},'data':_0x558690};}static async['stopConsuming'](){for(const _0x3e6685 of[...Router['instances']]){_0x3e6685['stopConsuming']();}await(0x0,utils_1['sleepFor'])(enums_1['HMSH_BLOCK_TIME_MS']*0x2);}async['stopConsuming'](){this['shouldConsume']=![],this['logger']['info']('router-stream-stopping',this['topic']?{'topic':this['topic']}:undefined),this['cancelThrottle']();}['cancelThrottle'](){this['sleepTimout']&&clearTimeout(this['sleepTimout']),this['resetThrottleState']();}['setThrottle'](_0x5f1e42){if(!Number['isInteger'](_0x5f1e42)||_0x5f1e42<0x0||_0x5f1e42>enums_1['MAX_DELAY'])throw new Error('Throttle\x20must\x20be\x20a\x20non-negative\x20integer\x20and\x20not\x20exceed\x20'+enums_1['MAX_DELAY']+'\x20ms;\x20send\x20-1\x20to\x20throttle\x20indefinitely');const _0xd78eaf=_0x5f1e42<this['throttle'];this['throttle']=_0x5f1e42,_0xd78eaf&&(this['sleepTimout']&&clearTimeout(this['sleepTimout']),this['innerPromiseResolve']&&this['innerPromiseResolve']());}}exports['Router']=Router,Router['instances']=new Set();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RedisClient } from '../../types/redis';
|
|
2
1
|
import { ILogger } from '../logger';
|
|
2
|
+
import { ProviderClient } from '../../types/provider';
|
|
3
3
|
import { SearchService } from './index';
|
|
4
4
|
declare class SearchServiceFactory {
|
|
5
|
-
static init(redisClient:
|
|
5
|
+
static init(redisClient: ProviderClient, redisStoreClient: ProviderClient | undefined, namespace: string, appId: string, logger: ILogger): Promise<SearchService<ProviderClient>>;
|
|
6
6
|
}
|
|
7
7
|
export { SearchServiceFactory };
|
|
@@ -7,7 +7,7 @@ const redis_1 = require("./providers/redis/redis");
|
|
|
7
7
|
class SearchServiceFactory {
|
|
8
8
|
static async init(redisClient, redisStoreClient, namespace, appId, logger) {
|
|
9
9
|
let service;
|
|
10
|
-
if ((0, utils_1.
|
|
10
|
+
if ((0, utils_1.identifyProvider)(redisClient) === 'redis') {
|
|
11
11
|
service = new redis_1.RedisSearchService(redisClient, redisStoreClient);
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ILogger } from '../logger';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
protected
|
|
2
|
+
import { ProviderClient } from '../../types/provider';
|
|
3
|
+
declare abstract class SearchService<ClientProvider extends ProviderClient> {
|
|
4
|
+
protected searchClient: ClientProvider;
|
|
5
|
+
protected storeClient: ClientProvider;
|
|
5
6
|
protected namespace: string;
|
|
6
7
|
protected logger: ILogger;
|
|
7
8
|
protected appId: string;
|
|
8
|
-
constructor(searchClient:
|
|
9
|
+
constructor(searchClient: ClientProvider, storeClient?: ClientProvider);
|
|
9
10
|
abstract init(namespace: string, appId: string, logger: ILogger): Promise<void>;
|
|
10
11
|
abstract createSearchIndex(indexName: string, prefixes: string[], schema: string[]): Promise<void>;
|
|
11
12
|
abstract listSearchIndexes(): Promise<string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x3756a0,_0x37022e){const _0x2c9840=_0x2a38,_0x478220=_0x3756a0();while(!![]){try{const _0xe5cb7f=-parseInt(_0x2c9840(0x1e9))/0x1*(parseInt(_0x2c9840(0x1e8))/0x2)+parseInt(_0x2c9840(0x1ea))/0x3+-parseInt(_0x2c9840(0x1eb))/0x4+parseInt(_0x2c9840(0x1e7))/0x5+-parseInt(_0x2c9840(0x1ed))/0x6+-parseInt(_0x2c9840(0x1ef))/0x7+parseInt(_0x2c9840(0x1ec))/0x8*(parseInt(_0x2c9840(0x1ee))/0x9);if(_0xe5cb7f===_0x37022e)break;else _0x478220['push'](_0x478220['shift']());}catch(_0x295163){_0x478220['push'](_0x478220['shift']());}}}(_0x1ca0,0xd9ea2));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['IORedisSearchService']=void 0x0;const index_1=require('../../index');function _0x1ca0(){const _0x420c30=['5379412scChzK','8cCBCUY','2513586vHcEKU','20773629czRYIT','9054052ndrHDe','6511230lOCwTM','10JihAxT','133019VLJHtM','3013398vnRIJn'];_0x1ca0=function(){return _0x420c30;};return _0x1ca0();}class IORedisSearchService extends index_1['SearchService']{constructor(_0x219215,_0x1b174){super(_0x219215,_0x1b174);}async['init'](_0x5505e3,_0x1b8d26,_0x1354fe){this['namespace']=_0x5505e3,this['appId']=_0x1b8d26,this['logger']=_0x1354fe;}async['createSearchIndex'](_0x161b94,_0x1d4f50,_0xc174a9){try{await this['searchClient']['call']('FT.CREATE',_0x161b94,'ON','HASH','PREFIX',_0x1d4f50['length']['toString'](),..._0x1d4f50,'SCHEMA',..._0xc174a9);}catch(_0x254a7e){this['logger']['info']('Error\x20creating\x20search\x20index',{'error':_0x254a7e});throw _0x254a7e;}}async['listSearchIndexes'](){try{const _0x37d8cd=await this['searchClient']['call']('FT._LIST');return _0x37d8cd;}catch(_0x9a6933){this['logger']['info']('Error\x20listing\x20search\x20indexes',{'error':_0x9a6933});throw _0x9a6933;}}async['setFields'](_0x291cf4,_0x3cff52){try{const _0x36d4ef=await this['searchClient']['hset'](_0x291cf4,_0x3cff52);return Number(_0x36d4ef);}catch(_0x481f2f){this['logger']['error']('Error\x20setting\x20fields\x20for\x20key:\x20'+_0x291cf4,{'error':_0x481f2f});throw _0x481f2f;}}async['getField'](_0x172950,_0x21f798){try{return await this['searchClient']['hget'](_0x172950,_0x21f798);}catch(_0x24b2f2){this['logger']['error']('Error\x20getting\x20field\x20'+_0x21f798+'\x20for\x20key:\x20'+_0x172950,{'error':_0x24b2f2});throw _0x24b2f2;}}async['getFields'](_0x35255e,_0xfc7c0){try{return await this['searchClient']['hmget'](_0x35255e,[..._0xfc7c0]);}catch(_0x3cefea){this['logger']['error']('Error\x20getting\x20fields\x20for\x20key:\x20'+_0x35255e,{'error':_0x3cefea});throw _0x3cefea;}}async['getAllFields'](_0x4a5825){try{return await this['searchClient']['hgetall'](_0x4a5825);}catch(_0x23258c){this['logger']['error']('Error\x20getting\x20fields\x20for\x20key:\x20'+_0x4a5825,{'error':_0x23258c});throw _0x23258c;}}async['deleteFields'](_0x4948c0,_0x45b2bc){try{const _0x43e229=await this['searchClient']['hdel'](_0x4948c0,..._0x45b2bc);return Number(_0x43e229);}catch(_0x443857){this['logger']['error']('Error\x20deleting\x20fields\x20for\x20key:\x20'+_0x4948c0,{'error':_0x443857});throw _0x443857;}}async['incrementFieldByFloat'](_0x1e8629,_0x592c0b,_0x10f34a){try{const _0x30d4c3=await this['searchClient']['hincrbyfloat'](_0x1e8629,_0x592c0b,_0x10f34a);return Number(_0x30d4c3);}catch(_0x457176){this['logger']['error']('Error\x20incrementing\x20field\x20'+_0x592c0b+'\x20for\x20key:\x20'+_0x1e8629,{'error':_0x457176});throw _0x457176;}}async['sendQuery'](..._0x31c3cb){try{return await this['searchClient']['call'](..._0x31c3cb);}catch(_0xef8693){this['logger']['error']('Error\x20executing\x20query',{'error':_0xef8693});throw _0xef8693;}}async['sendIndexedQuery'](_0x3bb9a2,_0x2e620d){try{if(_0x2e620d[0x0]?.['startsWith']('FT.')){const [_0x2a78ff,..._0x27403f]=_0x2e620d;return await this['searchClient']['call'](_0x2a78ff,..._0x27403f);}return await this['searchClient']['call']('FT.SEARCH',_0x3bb9a2,..._0x2e620d);}catch(_0x362b3a){this['logger']['error']('Error\x20executing\x20query',{'error':_0x362b3a});throw _0x362b3a;}}}function _0x2a38(_0x3f491f,_0x8d1698){const _0x1ca057=_0x1ca0();return _0x2a38=function(_0x2a3827,_0x270e36){_0x2a3827=_0x2a3827-0x1e7;let _0xc81ca3=_0x1ca057[_0x2a3827];return _0xc81ca3;},_0x2a38(_0x3f491f,_0x8d1698);}exports['IORedisSearchService']=IORedisSearchService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x4f0134,_0x4c88d2){const _0x5d7a76=_0x2d80,_0x14d085=_0x4f0134();while(!![]){try{const _0x23f8c3=-parseInt(_0x5d7a76(0x1e0))/0x1*(parseInt(_0x5d7a76(0x1db))/0x2)+-parseInt(_0x5d7a76(0x1dc))/0x3*(parseInt(_0x5d7a76(0x1df))/0x4)+-parseInt(_0x5d7a76(0x1da))/0x5+-parseInt(_0x5d7a76(0x1e2))/0x6*(parseInt(_0x5d7a76(0x1e4))/0x7)+-parseInt(_0x5d7a76(0x1de))/0x8*(parseInt(_0x5d7a76(0x1dd))/0x9)+-parseInt(_0x5d7a76(0x1e1))/0xa+parseInt(_0x5d7a76(0x1e3))/0xb*(parseInt(_0x5d7a76(0x1d9))/0xc);if(_0x23f8c3===_0x4c88d2)break;else _0x14d085['push'](_0x14d085['shift']());}catch(_0x114e1e){_0x14d085['push'](_0x14d085['shift']());}}}(_0x7c35,0x30999));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['RedisSearchService']=void 0x0;const index_1=require('../../index');class RedisSearchService extends index_1['SearchService']{constructor(_0x45660f,_0x148c1c){super(_0x45660f,_0x148c1c);}async['init'](_0x44e024,_0x24c8b4,_0x552e3){this['namespace']=_0x44e024,this['appId']=_0x24c8b4,this['logger']=_0x552e3;}async['createSearchIndex'](_0x42e954,_0xead37,_0x517ae6){try{await this['searchClient']['sendCommand'](['FT.CREATE',_0x42e954,'ON','HASH','PREFIX',_0xead37['length']['toString'](),..._0xead37,'SCHEMA',..._0x517ae6]);}catch(_0x39bcff){this['logger']['info']('Error\x20creating\x20search\x20index',{'error':_0x39bcff});throw _0x39bcff;}}async['listSearchIndexes'](){try{const _0x48e73e=await this['searchClient']['sendCommand'](['FT._LIST']);return _0x48e73e;}catch(_0xde2a1){this['logger']['info']('Error\x20listing\x20search\x20indexes',{'error':_0xde2a1});throw _0xde2a1;}}async['setFields'](_0x5831cc,_0x2481f6){try{const _0x209be9=await this['searchClient']['HSET'](_0x5831cc,_0x2481f6);return Number(_0x209be9);}catch(_0x5bc765){this['logger']['error']('Error\x20setting\x20fields\x20for\x20key:\x20'+_0x5831cc,{'error':_0x5bc765});throw _0x5bc765;}}async['getField'](_0x2b23c7,_0x1f770d){try{return await this['searchClient']['HGET'](_0x2b23c7,_0x1f770d);}catch(_0x3b5f2a){this['logger']['error']('Error\x20getting\x20field\x20'+_0x1f770d+'\x20for\x20key:\x20'+_0x2b23c7,{'error':_0x3b5f2a});throw _0x3b5f2a;}}async['getFields'](_0x3222f7,_0x4454e6){try{return await this['searchClient']['HMGET'](_0x3222f7,[..._0x4454e6]);}catch(_0x33fadf){this['logger']['error']('Error\x20getting\x20fields\x20for\x20key:\x20'+_0x3222f7,{'error':_0x33fadf});throw _0x33fadf;}}async['getAllFields'](_0x5b87a4){try{return await this['searchClient']['HGETALL'](_0x5b87a4);}catch(_0x218503){this['logger']['error']('Error\x20getting\x20fields\x20for\x20key:\x20'+_0x5b87a4,{'error':_0x218503});throw _0x218503;}}async['deleteFields'](_0x2543b4,_0x3fc7b3){try{const _0x30f372=await this['searchClient']['HDEL'](_0x2543b4,_0x3fc7b3);return Number(_0x30f372);}catch(_0x4b3009){this['logger']['error']('Error\x20deleting\x20fields\x20for\x20key:\x20'+_0x2543b4,{'error':_0x4b3009});throw _0x4b3009;}}async['incrementFieldByFloat'](_0x8630d6,_0x41355f,_0x4ade61){try{const _0x4fa03f=await this['searchClient']['HINCRBYFLOAT'](_0x8630d6,_0x41355f,_0x4ade61);return Number(_0x4fa03f);}catch(_0x236aa6){this['logger']['error']('Error\x20incrementing\x20field\x20'+_0x41355f+'\x20for\x20key:\x20'+_0x8630d6,{'error':_0x236aa6});throw _0x236aa6;}}async['sendQuery'](..._0xf3e42c){try{return await this['searchClient']['sendCommand'](_0xf3e42c);}catch(_0x3776c5){this['logger']['error']('Error\x20executing\x20query',{'error':_0x3776c5});throw _0x3776c5;}}async['sendIndexedQuery'](_0x2f4889,_0x1ba1df){try{if(_0x1ba1df[0x0]?.['startsWith']('FT.'))return await this['searchClient']['sendCommand'](_0x1ba1df);return await this['searchClient']['sendCommand'](['FT.SEARCH',_0x2f4889,..._0x1ba1df]);}catch(_0x5e1f0d){this['logger']['error']('Error\x20executing\x20query',{'error':_0x5e1f0d});throw _0x5e1f0d;}}}function _0x7c35(){const _0x4c9894=['118500Ztprtl','42582KRcrGC','11gbwIJw','154ehVWnp','13026108jpzFOy','485755aLFgrw','1048KmyevB','5433RfVxlw','252hdNBQF','46536fjuehT','604PVfGiy','353lnDAiZ'];_0x7c35=function(){return _0x4c9894;};return _0x7c35();}function _0x2d80(_0x1dbc10,_0x3a73a6){const _0x7c357c=_0x7c35();return _0x2d80=function(_0x2d808d,_0x5f0761){_0x2d808d=_0x2d808d-0x1d9;let _0x483ef1=_0x7c357c[_0x2d808d];return _0x483ef1;},_0x2d80(_0x1dbc10,_0x3a73a6);}exports['RedisSearchService']=RedisSearchService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x53d94d,_0x389bb8){const _0x42feb3=_0x358b,_0x4cda24=_0x53d94d();while(!![]){try{const _0xf41f4e=-parseInt(_0x42feb3(0xd0))/0x1*(parseInt(_0x42feb3(0xc7))/0x2)+-parseInt(_0x42feb3(0xc6))/0x3+parseInt(_0x42feb3(0xcb))/0x4*(parseInt(_0x42feb3(0xca))/0x5)+parseInt(_0x42feb3(0xc9))/0x6*(-parseInt(_0x42feb3(0xcd))/0x7)+-parseInt(_0x42feb3(0xce))/0x8+-parseInt(_0x42feb3(0xcc))/0x9*(-parseInt(_0x42feb3(0xcf))/0xa)+parseInt(_0x42feb3(0xc8))/0xb;if(_0xf41f4e===_0x389bb8)break;else _0x4cda24['push'](_0x4cda24['shift']());}catch(_0x2705d6){_0x4cda24['push'](_0x4cda24['shift']());}}}(_0x664f,0x7680e));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['SerializerService']=exports['MDATA_SYMBOLS']=void 0x0;function _0x358b(_0xe71a5d,_0x4847df){const _0x664fa5=_0x664f();return _0x358b=function(_0x358b8a,_0x4a137c){_0x358b8a=_0x358b8a-0xc6;let _0x567800=_0x664fa5[_0x358b8a];return _0x567800;},_0x358b(_0xe71a5d,_0x4847df);}const utils_1=require('../../modules/utils'),dateReg=/^"\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z)?"$/;exports['MDATA_SYMBOLS']={'SLOTS':0x1a,'ACTIVITY':{'KEYS':['aid','dad','as','atp','stp','ac','au','err','l1s','l2s']},'ACTIVITY_UPDATE':{'KEYS':['au','err','l2s']},'JOB':{'KEYS':['ngn','tpc','pj','pg','pd','px','pa','key','app','vrs','jid','gid','aid','ts','jc','ju','js','err','trc']},'JOB_UPDATE':{'KEYS':['ju','err']}};class SerializerService{constructor(){this['resetSymbols']({},{},{});}['abbreviate'](_0x1155c6,_0x2e5305,_0x2c608d=[]){for(const _0x435708 of _0x2e5305){const _0xa60060=this['symKeys']['get'](_0x435708),_0x1071f9=_0x1155c6[_0x435708];for(const _0x3f0a4c of _0x1071f9){const _0x20924f=_0xa60060['get'](_0x3f0a4c);if(_0x20924f){const _0xbc58db=this['resolveDimensionalIndex'](_0x3f0a4c);_0x2c608d['push'](''+_0x20924f+_0xbc58db);}else _0x2c608d['push'](_0x3f0a4c);}}return _0x2c608d;}['resolveDimensionalIndex'](_0x3d4b7e){if(this['isJobPath'](_0x3d4b7e))return'';else{const [_0x160a7f]=_0x3d4b7e['split']('/');if(_0x160a7f in this['dIds'])return this['dIds'][_0x160a7f];else{if('$ADJACENT'in this['dIds'])return this['dIds']['$ADJACENT'];}return',0';}}['isJobPath'](_0x57b991){return _0x57b991['startsWith']('data/')||_0x57b991['startsWith']('metadata/');}['resetSymbols'](_0x209630,_0x20365f,_0x14c011){this['symKeys']=new Map(),this['symReverseKeys']=new Map();for(const _0x2c0197 in _0x209630){this['symKeys']['set'](_0x2c0197,new Map(Object['entries'](_0x209630[_0x2c0197])));}this['symValMaps']=new Map(Object['entries'](_0x20365f)),this['symValReverseMaps']=this['getReverseValueMap'](this['symValMaps']),this['dIds']=_0x14c011;}['getReverseKeyMap'](_0x1378cc,_0x54834e){let _0x433ba6=this['symReverseKeys']['get'](_0x54834e);if(!_0x433ba6){_0x433ba6=new Map();for(const [_0xdd326,_0x4e424f]of _0x1378cc['entries']()){_0x433ba6['set'](_0x4e424f,_0xdd326);}this['symReverseKeys']['set'](_0x54834e,_0x433ba6);}return _0x433ba6;}['getReverseValueMap'](_0x27569a){const _0x460b0a=new Map();for(const [_0x12ffb2,_0x587741]of _0x27569a['entries']()){_0x460b0a['set'](_0x587741,_0x12ffb2);}return _0x460b0a;}static['filterSymVals'](_0x2ea770,_0x197652,_0x404cd1,_0x469b22){const _0x224ee8={},_0x2d90ae={..._0x404cd1},_0x5b2083=new Set(Object['values'](_0x2d90ae));for(const _0x227cce of _0x469b22){if(!_0x5b2083['has'](_0x227cce)){if(_0x2ea770>_0x197652)return _0x224ee8;const _0x459bb3=(0x0,utils_1['getSymVal'])(_0x2ea770);_0x2ea770++,_0x224ee8[_0x459bb3]=_0x227cce,_0x5b2083['add'](_0x227cce);}}return _0x224ee8;}['compress'](_0x4ad81d,_0x3eed4b){if(this['symKeys']['size']===0x0)return _0x4ad81d;const _0x128465={..._0x4ad81d},_0x4917fe={},_0x32abbe=(_0x81960e,_0x766dfb)=>{for(const _0x5ee872 in _0x128465){if(_0x5ee872['startsWith'](_0x766dfb+'/')||_0x766dfb['startsWith']('$')&&['data','metadata']['includes'](_0x5ee872['split']('/')[0x0])){const _0x26abea=this['resolveDimensionalIndex'](_0x5ee872),_0x23f8d0=_0x81960e['get'](_0x5ee872)||_0x5ee872,_0x682ab8=''+_0x23f8d0+_0x26abea;_0x4917fe[_0x682ab8]=_0x128465[_0x5ee872];}else!(_0x5ee872 in _0x4917fe)&&this['isLiteralKeyType'](_0x5ee872)&&(_0x4917fe[_0x5ee872]=_0x128465[_0x5ee872]);}};for(const _0x2c8b79 of _0x3eed4b){const _0x212c10=this['symKeys']['get'](_0x2c8b79);_0x212c10&&_0x32abbe(_0x212c10,_0x2c8b79);}return _0x4917fe;}['isLiteralKeyType'](_0x2ae42e){return _0x2ae42e['startsWith']('-')||_0x2ae42e['startsWith']('_');}['decompress'](_0x6b693a,_0x270466){if(this['symKeys']['size']===0x0)return _0x6b693a;const _0x2c22a7={..._0x6b693a},_0x322482=(_0x5a1d60,_0x23ff1e)=>{const _0x3d87a1=this['getReverseKeyMap'](_0x5a1d60,_0x23ff1e);for(const _0x1c59e1 in _0x2c22a7){const _0x1d3019=_0x1c59e1['split'](',')[0x0],_0xa20b66=_0x3d87a1['get'](_0x1d3019);_0xa20b66&&(_0x2c22a7[_0xa20b66]=_0x2c22a7[_0x1c59e1],delete _0x2c22a7[_0x1c59e1]);}};for(const _0x3b6774 of _0x270466){const _0x1db807=this['symKeys']['get'](_0x3b6774);_0x1db807&&_0x322482(_0x1db807,_0x3b6774);}return _0x2c22a7;}['stringify'](_0x4c82a3){const _0x4e5e08={};for(const _0x312113 in _0x4c82a3){const _0x4687c8=SerializerService['toString'](_0x4c82a3[_0x312113]);_0x4687c8&&(_0x4e5e08[_0x312113]=_0x4687c8);}return _0x4e5e08;}['parse'](_0x3f0bcb){const _0x1bbc1b={};for(const [_0x1dfb49,_0x5ae21a]of Object['entries'](_0x3f0bcb)){if(_0x5ae21a===undefined||_0x5ae21a===null)continue;_0x1bbc1b[_0x1dfb49]=SerializerService['fromString'](_0x5ae21a);}return _0x1bbc1b;}static['toString'](_0x4241ae){switch(typeof _0x4241ae){case'string':break;case'boolean':_0x4241ae=_0x4241ae?'/t':'/f';break;case'number':_0x4241ae='/d'+_0x4241ae['toString']();break;case'undefined':return undefined;case'object':_0x4241ae===null?_0x4241ae='/n':_0x4241ae='/s'+JSON['stringify'](_0x4241ae);break;}return _0x4241ae;}static['fromString'](_0x4dec11){if(typeof _0x4dec11!=='string')return undefined;const _0x464468=_0x4dec11['slice'](0x0,0x2),_0xdfead6=_0x4dec11['slice'](0x2);switch(_0x464468){case'/t':return!![];case'/f':return![];case'/d':return Number(_0xdfead6);case'/n':return null;case'/s':if(dateReg['exec'](_0xdfead6))return new Date(JSON['parse'](_0xdfead6));return JSON['parse'](_0xdfead6);default:return _0x4dec11;}}['package'](_0x39033b,_0x4f4323){const _0x22d586=this['stringify'](_0x39033b);return this['compress'](_0x22d586,_0x4f4323);}['unpackage'](_0x3b5a74,_0x1ac44c){const _0x3f4666=this['decompress'](_0x3b5a74,_0x1ac44c);return this['parse'](_0x3f4666);}['export'](){const _0x51e9f5={};for(const [_0x53cf61,_0x59ce9a]of this['symKeys']['entries']()){_0x51e9f5[_0x53cf61]={};for(const [_0x55423d,_0x419fc6]of _0x59ce9a['entries']()){_0x51e9f5[_0x53cf61][_0x55423d]=_0x419fc6;}}return _0x51e9f5;}}exports['SerializerService']=SerializerService;function _0x664f(){const _0x51c6f8=['8992731eyPXXh','258ccIdjl','26585hMXBoE','156XumeeK','13005oyXwvD','7483LqgZFC','3140520lxOSjw','6460CVFULv','1598toSOfr','1770564BmANOx','556BlvQrC'];_0x664f=function(){return _0x51c6f8;};return _0x664f();}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RedisClient } from '../../types/redis';
|
|
2
1
|
import { ILogger } from '../logger';
|
|
3
|
-
import {
|
|
2
|
+
import { ProviderClient, ProviderTransaction } from '../../types/provider';
|
|
4
3
|
import { StoreInitializable } from './providers/store-initializable';
|
|
4
|
+
import { StoreService } from './index';
|
|
5
5
|
declare class StoreServiceFactory {
|
|
6
|
-
static init(redisClient:
|
|
6
|
+
static init(redisClient: ProviderClient, namespace: string, appId: string, logger: ILogger): Promise<StoreService<ProviderClient, ProviderTransaction> & StoreInitializable>;
|
|
7
7
|
}
|
|
8
8
|
export { StoreServiceFactory };
|
|
@@ -7,7 +7,7 @@ const redis_1 = require("./providers/redis/redis");
|
|
|
7
7
|
class StoreServiceFactory {
|
|
8
8
|
static async init(redisClient, namespace, appId, logger) {
|
|
9
9
|
let service;
|
|
10
|
-
if ((0, utils_1.
|
|
10
|
+
if ((0, utils_1.identifyProvider)(redisClient) === 'redis') {
|
|
11
11
|
service = new redis_1.RedisStoreService(redisClient);
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import { KeyStoreParams, KeyType } from '../../modules/key';
|
|
1
2
|
import { ILogger } from '../logger';
|
|
2
3
|
import { SerializerService as Serializer } from '../serializer';
|
|
3
|
-
import { HotMeshSettings } from '../../types/hotmesh';
|
|
4
|
-
import { Cache } from './cache';
|
|
5
|
-
import { KeyStoreParams, KeyType } from '../../modules/key';
|
|
6
4
|
import { Consumes } from '../../types/activity';
|
|
7
|
-
import { StringAnyType, Symbols, StringStringType, SymbolSets } from '../../types/serializer';
|
|
8
|
-
import { IdsData, JobStatsRange, StatsType } from '../../types/stats';
|
|
9
5
|
import { AppVID } from '../../types/app';
|
|
10
6
|
import { HookRule, HookSignal } from '../../types/hook';
|
|
7
|
+
import { HotMeshSettings } from '../../types/hotmesh';
|
|
8
|
+
import { ProviderClient, ProviderTransaction } from '../../types/provider';
|
|
11
9
|
import { ThrottleOptions } from '../../types/quorum';
|
|
10
|
+
import { StringAnyType, Symbols, StringStringType, SymbolSets } from '../../types/serializer';
|
|
11
|
+
import { IdsData, JobStatsRange, StatsType } from '../../types/stats';
|
|
12
12
|
import { WorkListTaskType } from '../../types/task';
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import { Cache } from './cache';
|
|
14
|
+
declare abstract class StoreService<Provider extends ProviderClient, TransactionProvider extends ProviderTransaction> {
|
|
15
|
+
storeClient: Provider;
|
|
15
16
|
namespace: string;
|
|
16
17
|
appId: string;
|
|
17
18
|
logger: ILogger;
|
|
18
19
|
cache: Cache;
|
|
19
20
|
serializer: Serializer;
|
|
20
|
-
constructor(client:
|
|
21
|
-
abstract
|
|
21
|
+
constructor(client: Provider);
|
|
22
|
+
abstract transact(): TransactionProvider;
|
|
22
23
|
abstract mintKey(type: KeyType, params: KeyStoreParams): string;
|
|
23
24
|
abstract getSettings(bCreate?: boolean): Promise<HotMeshSettings>;
|
|
24
25
|
abstract setSettings(manifest: HotMeshSettings): Promise<any>;
|
|
@@ -33,18 +34,18 @@ declare abstract class StoreService<Client, MultiClient> {
|
|
|
33
34
|
abstract getSymbolValues(): Promise<Symbols>;
|
|
34
35
|
abstract addSymbolValues(symvals: Symbols): Promise<boolean>;
|
|
35
36
|
abstract getSymbolKeys(symbolNames: string[]): Promise<SymbolSets>;
|
|
36
|
-
abstract setStats(jobKey: string, jobId: string, dateTime: string, stats: StatsType, appVersion: AppVID,
|
|
37
|
+
abstract setStats(jobKey: string, jobId: string, dateTime: string, stats: StatsType, appVersion: AppVID, transaction?: TransactionProvider): Promise<any>;
|
|
37
38
|
abstract getJobStats(jobKeys: string[]): Promise<JobStatsRange>;
|
|
38
39
|
abstract getJobIds(indexKeys: string[], idRange: [number, number]): Promise<IdsData>;
|
|
39
|
-
abstract setStatus(collationKeyStatus: number, jobId: string, appId: string,
|
|
40
|
+
abstract setStatus(collationKeyStatus: number, jobId: string, appId: string, transaction?: TransactionProvider): Promise<any>;
|
|
40
41
|
abstract getStatus(jobId: string, appId: string): Promise<number>;
|
|
41
42
|
abstract setStateNX(jobId: string, appId: string, status?: number): Promise<boolean>;
|
|
42
|
-
abstract setState(state: StringAnyType, status: number | null, jobId: string, symbolNames: string[], dIds: StringStringType,
|
|
43
|
+
abstract setState(state: StringAnyType, status: number | null, jobId: string, symbolNames: string[], dIds: StringStringType, transaction?: TransactionProvider): Promise<string>;
|
|
43
44
|
abstract getQueryState(jobId: string, fields: string[]): Promise<StringAnyType>;
|
|
44
45
|
abstract getState(jobId: string, consumes: Consumes, dIds: StringStringType): Promise<[StringAnyType, number] | undefined>;
|
|
45
46
|
abstract getRaw(jobId: string): Promise<StringStringType>;
|
|
46
|
-
abstract collate(jobId: string, activityId: string, amount: number, dIds: StringStringType,
|
|
47
|
-
abstract collateSynthetic(jobId: string, guid: string, amount: number,
|
|
47
|
+
abstract collate(jobId: string, activityId: string, amount: number, dIds: StringStringType, transaction?: TransactionProvider): Promise<number>;
|
|
48
|
+
abstract collateSynthetic(jobId: string, guid: string, amount: number, transaction?: TransactionProvider): Promise<number>;
|
|
48
49
|
abstract getSchema(activityId: string, appVersion: AppVID): Promise<any>;
|
|
49
50
|
abstract getSchemas(appVersion: AppVID): Promise<Record<string, any>>;
|
|
50
51
|
abstract setSchemas(schemas: Record<string, any>, appVersion: AppVID): Promise<any>;
|
|
@@ -56,17 +57,17 @@ declare abstract class StoreService<Client, MultiClient> {
|
|
|
56
57
|
abstract setHookRules(hookRules: Record<string, HookRule[]>): Promise<any>;
|
|
57
58
|
abstract getHookRules(): Promise<Record<string, HookRule[]>>;
|
|
58
59
|
abstract getAllSymbols(): Promise<Symbols>;
|
|
59
|
-
abstract setHookSignal(hook: HookSignal,
|
|
60
|
+
abstract setHookSignal(hook: HookSignal, transaction?: TransactionProvider): Promise<any>;
|
|
60
61
|
abstract getHookSignal(topic: string, resolved: string): Promise<string | undefined>;
|
|
61
62
|
abstract deleteHookSignal(topic: string, resolved: string): Promise<number | undefined>;
|
|
62
63
|
abstract addTaskQueues(keys: string[]): Promise<void>;
|
|
63
64
|
abstract getActiveTaskQueue(): Promise<string | null>;
|
|
64
65
|
abstract deleteProcessedTaskQueue(workItemKey: string, key: string, processedKey: string, scrub?: boolean): Promise<void>;
|
|
65
66
|
abstract processTaskQueue(sourceKey: string, destinationKey: string): Promise<any>;
|
|
66
|
-
abstract expireJob(jobId: string, inSeconds: number, redisMulti?:
|
|
67
|
+
abstract expireJob(jobId: string, inSeconds: number, redisMulti?: TransactionProvider): Promise<void>;
|
|
67
68
|
abstract getDependencies(jobId: string): Promise<string[]>;
|
|
68
69
|
abstract delistSignalKey(key: string, target: string): Promise<void>;
|
|
69
|
-
abstract registerTimeHook(jobId: string, gId: string, activityId: string, type: WorkListTaskType, deletionTime: number, dad: string,
|
|
70
|
+
abstract registerTimeHook(jobId: string, gId: string, activityId: string, type: WorkListTaskType, deletionTime: number, dad: string, transaction?: TransactionProvider): Promise<void>;
|
|
70
71
|
abstract getNextTask(listKey?: string): Promise<[
|
|
71
72
|
listKey: string,
|
|
72
73
|
jobId: string,
|
|
@@ -4,6 +4,7 @@ import { ActivityType, Consumes } from '../../../../types/activity';
|
|
|
4
4
|
import { AppVID } from '../../../../types/app';
|
|
5
5
|
import { HookRule, HookSignal } from '../../../../types/hook';
|
|
6
6
|
import { HotMeshApp, HotMeshApps, HotMeshSettings } from '../../../../types/hotmesh';
|
|
7
|
+
import { ProviderClient, ProviderTransaction } from '../../../../types/provider';
|
|
7
8
|
import { SymbolSets, StringStringType, StringAnyType, Symbols } from '../../../../types/serializer';
|
|
8
9
|
import { IdsData, JobStatsRange, StatsType } from '../../../../types/stats';
|
|
9
10
|
import { Transitions } from '../../../../types/transition';
|
|
@@ -11,19 +12,16 @@ import { JobInterruptOptions } from '../../../../types/job';
|
|
|
11
12
|
import { WorkListTaskType } from '../../../../types/task';
|
|
12
13
|
import { ThrottleOptions } from '../../../../types/quorum';
|
|
13
14
|
import { StoreService } from '../..';
|
|
14
|
-
|
|
15
|
-
exec(): Promise<any>;
|
|
16
|
-
}
|
|
17
|
-
declare abstract class RedisStoreBase<Client, MultiClient extends AbstractRedisClient> extends StoreService<Client, MultiClient> {
|
|
15
|
+
declare abstract class RedisStoreBase<ClientProvider extends ProviderClient, TransactionProvider extends ProviderTransaction> extends StoreService<ClientProvider, TransactionProvider> {
|
|
18
16
|
commands: Record<string, string>;
|
|
19
|
-
abstract
|
|
17
|
+
abstract transact(): TransactionProvider;
|
|
20
18
|
abstract exec(...args: any[]): Promise<any>;
|
|
21
19
|
abstract setnxex(key: string, value: string, expireSeconds: number): Promise<boolean>;
|
|
22
|
-
constructor(storeClient:
|
|
20
|
+
constructor(storeClient: ClientProvider);
|
|
23
21
|
init(namespace: string, appId: string, logger: ILogger): Promise<HotMeshApps>;
|
|
24
22
|
isSuccessful(result: any): boolean;
|
|
25
23
|
delistSignalKey(key: string, target: string): Promise<void>;
|
|
26
|
-
zAdd(key: string, score: number | string, value: string | number, redisMulti?:
|
|
24
|
+
zAdd(key: string, score: number | string, value: string | number, redisMulti?: TransactionProvider): Promise<any>;
|
|
27
25
|
zRangeByScoreWithScores(key: string, score: number | string, value: string | number): Promise<string | null>;
|
|
28
26
|
zRangeByScore(key: string, score: number | string, value: string | number): Promise<string | null>;
|
|
29
27
|
mintKey(type: KeyType, params: KeyStoreParams): string;
|
|
@@ -46,18 +44,18 @@ declare abstract class RedisStoreBase<Client, MultiClient extends AbstractRedisC
|
|
|
46
44
|
setApp(id: string, version: string): Promise<HotMeshApp>;
|
|
47
45
|
activateAppVersion(id: string, version: string): Promise<boolean>;
|
|
48
46
|
registerAppVersion(appId: string, version: string): Promise<any>;
|
|
49
|
-
setStats(jobKey: string, jobId: string, dateTime: string, stats: StatsType, appVersion: AppVID,
|
|
47
|
+
setStats(jobKey: string, jobId: string, dateTime: string, stats: StatsType, appVersion: AppVID, transaction?: TransactionProvider): Promise<any>;
|
|
50
48
|
hGetAllResult(result: any): any;
|
|
51
49
|
getJobStats(jobKeys: string[]): Promise<JobStatsRange>;
|
|
52
50
|
getJobIds(indexKeys: string[], idRange: [number, number]): Promise<IdsData>;
|
|
53
|
-
setStatus(collationKeyStatus: number, jobId: string, appId: string,
|
|
51
|
+
setStatus(collationKeyStatus: number, jobId: string, appId: string, transaction?: TransactionProvider): Promise<any>;
|
|
54
52
|
getStatus(jobId: string, appId: string): Promise<number>;
|
|
55
|
-
setState({ ...state }: StringAnyType, status: number | null, jobId: string, symbolNames: string[], dIds: StringStringType,
|
|
53
|
+
setState({ ...state }: StringAnyType, status: number | null, jobId: string, symbolNames: string[], dIds: StringStringType, transaction?: TransactionProvider): Promise<string>;
|
|
56
54
|
getQueryState(jobId: string, fields: string[]): Promise<StringAnyType>;
|
|
57
55
|
getState(jobId: string, consumes: Consumes, dIds: StringStringType): Promise<[StringAnyType, number] | undefined>;
|
|
58
56
|
getRaw(jobId: string): Promise<StringStringType>;
|
|
59
|
-
collate(jobId: string, activityId: string, amount: number, dIds: StringStringType,
|
|
60
|
-
collateSynthetic(jobId: string, guid: string, amount: number,
|
|
57
|
+
collate(jobId: string, activityId: string, amount: number, dIds: StringStringType, transaction?: TransactionProvider): Promise<number>;
|
|
58
|
+
collateSynthetic(jobId: string, guid: string, amount: number, transaction?: TransactionProvider): Promise<number>;
|
|
61
59
|
setStateNX(jobId: string, appId: string, status?: number): Promise<boolean>;
|
|
62
60
|
getSchema(activityId: string, appVersion: AppVID): Promise<ActivityType>;
|
|
63
61
|
getSchemas(appVersion: AppVID): Promise<Record<string, ActivityType>>;
|
|
@@ -69,16 +67,16 @@ declare abstract class RedisStoreBase<Client, MultiClient extends AbstractRedisC
|
|
|
69
67
|
getTransitions(appVersion: AppVID): Promise<Transitions>;
|
|
70
68
|
setHookRules(hookRules: Record<string, HookRule[]>): Promise<any>;
|
|
71
69
|
getHookRules(): Promise<Record<string, HookRule[]>>;
|
|
72
|
-
setHookSignal(hook: HookSignal,
|
|
70
|
+
setHookSignal(hook: HookSignal, transaction?: TransactionProvider): Promise<any>;
|
|
73
71
|
getHookSignal(topic: string, resolved: string): Promise<string | undefined>;
|
|
74
72
|
deleteHookSignal(topic: string, resolved: string): Promise<number | undefined>;
|
|
75
73
|
addTaskQueues(keys: string[]): Promise<void>;
|
|
76
74
|
getActiveTaskQueue(): Promise<string | null>;
|
|
77
75
|
deleteProcessedTaskQueue(workItemKey: string, key: string, processedKey: string, scrub?: boolean): Promise<void>;
|
|
78
76
|
processTaskQueue(sourceKey: string, destinationKey: string): Promise<any>;
|
|
79
|
-
expireJob(jobId: string, inSeconds: number, redisMulti?:
|
|
77
|
+
expireJob(jobId: string, inSeconds: number, redisMulti?: TransactionProvider): Promise<void>;
|
|
80
78
|
getDependencies(jobId: string): Promise<string[]>;
|
|
81
|
-
registerTimeHook(jobId: string, gId: string, activityId: string, type: WorkListTaskType, deletionTime: number, dad: string,
|
|
79
|
+
registerTimeHook(jobId: string, gId: string, activityId: string, type: WorkListTaskType, deletionTime: number, dad: string, transaction?: TransactionProvider): Promise<void>;
|
|
82
80
|
getNextTask(listKey?: string): Promise<[
|
|
83
81
|
listKey: string,
|
|
84
82
|
jobId: string,
|