woonplan-packages-redishelper 2.1.5 → 2.1.52
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/.vscode/settings.json +2 -2
- package/build/types.d.ts +53 -53
- package/dist/tsc/classes/Broker.d.ts +63 -63
- package/dist/tsc/classes/Broker.js +346 -342
- package/dist/tsc/classes/Broker.js.map +1 -1
- package/dist/tsc/classes/BrokerClient.d.ts +20 -20
- package/dist/tsc/classes/BrokerClient.js +67 -67
- package/dist/tsc/classes/ListListener.d.ts +10 -10
- package/dist/tsc/classes/ListListener.js +21 -21
- package/dist/tsc/classes/ListRunner.d.ts +19 -19
- package/dist/tsc/classes/ListRunner.js +89 -89
- package/dist/tsc/classes/Listener.d.ts +8 -8
- package/dist/tsc/classes/Listener.js +25 -13
- package/dist/tsc/classes/Listener.js.map +1 -1
- package/dist/tsc/classes/SetWatcher.d.ts +29 -29
- package/dist/tsc/classes/SetWatcher.js +137 -137
- package/dist/tsc/main.d.ts +2 -2
- package/dist/tsc/main.js +6 -6
- package/dist/tsc/services/lock.d.ts +5 -5
- package/dist/tsc/services/lock.js +35 -35
- package/dist/tsc/services/utils.d.ts +15 -15
- package/dist/tsc/services/utils.js +62 -62
- package/dist/tsc/types.d.ts +53 -53
- package/jest.config.ts +14 -14
- package/package.json +45 -45
- package/tsconfig.json +38 -38
- package/tsconfig.production.json +38 -38
- package/dist/tsc/__tests__/Broker.test.d.ts +0 -1
- package/dist/tsc/__tests__/Broker.test.js +0 -172
- package/dist/tsc/__tests__/Broker.test.js.map +0 -1
- package/dist/tsc/__tests__/Listener.test.d.ts +0 -1
- package/dist/tsc/__tests__/Listener.test.js +0 -58
- package/dist/tsc/__tests__/Listener.test.js.map +0 -1
package/.vscode/settings.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"svn.ignoreMissingSvnWarning": true
|
|
1
|
+
{
|
|
2
|
+
"svn.ignoreMissingSvnWarning": true
|
|
3
3
|
}
|
package/build/types.d.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
import { Broker } from "./main";
|
|
3
|
-
interface JsonStringifiedMap{
|
|
4
|
-
dataType : 'Map',
|
|
5
|
-
value : any[]
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface RedisMessage{
|
|
9
|
-
[index: string]: any;
|
|
10
|
-
}
|
|
11
|
-
interface Struct{
|
|
12
|
-
[index: string]: any;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface RedisConfig{
|
|
16
|
-
REDISURL: string | number | undefined
|
|
17
|
-
REDISPW: string | undefined
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface RedisStreamEntry{
|
|
21
|
-
id : string
|
|
22
|
-
message:RedisMessage
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type StreamMessage = [
|
|
26
|
-
string, StreamMessageParameters
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
type StreamMessageParameters = string[]
|
|
30
|
-
type StreamResponse = [
|
|
31
|
-
string, StreamMessage[]
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
interface DecypheredParameters{
|
|
35
|
-
[index:string] : string | number
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface DecypheredMessage{
|
|
39
|
-
id : string
|
|
40
|
-
parameters : DecypheredParameters
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface DecypheredResponse{
|
|
44
|
-
stream : string,
|
|
45
|
-
messages : DecypheredMessage[]
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface RollbarConfig{
|
|
49
|
-
accessToken : string
|
|
50
|
-
environment : string
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
|
|
2
|
+
import { Broker } from "./main";
|
|
3
|
+
interface JsonStringifiedMap{
|
|
4
|
+
dataType : 'Map',
|
|
5
|
+
value : any[]
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface RedisMessage{
|
|
9
|
+
[index: string]: any;
|
|
10
|
+
}
|
|
11
|
+
interface Struct{
|
|
12
|
+
[index: string]: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface RedisConfig{
|
|
16
|
+
REDISURL: string | number | undefined
|
|
17
|
+
REDISPW: string | undefined
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface RedisStreamEntry{
|
|
21
|
+
id : string
|
|
22
|
+
message:RedisMessage
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type StreamMessage = [
|
|
26
|
+
string, StreamMessageParameters
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
type StreamMessageParameters = string[]
|
|
30
|
+
type StreamResponse = [
|
|
31
|
+
string, StreamMessage[]
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
interface DecypheredParameters{
|
|
35
|
+
[index:string] : string | number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface DecypheredMessage{
|
|
39
|
+
id : string
|
|
40
|
+
parameters : DecypheredParameters
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface DecypheredResponse{
|
|
44
|
+
stream : string,
|
|
45
|
+
messages : DecypheredMessage[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface RollbarConfig{
|
|
49
|
+
accessToken : string
|
|
50
|
+
environment : string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
54
|
export { RollbarConfig,DecypheredResponse,DecypheredMessage, DecypheredParameters, StreamMessage, StreamResponse, Struct, JsonStringifiedMap, RedisConfig, Broker }
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import IORedis, { Redis } from "ioredis";
|
|
3
|
-
import Rollbar from "rollbar";
|
|
4
|
-
import Listener from "./Listener";
|
|
5
|
-
import { DecypheredMessage, DecypheredParameters, DecypheredResponse, RedisConfig, RollbarConfig, StreamMessage, StreamResponse, Struct } from "../types";
|
|
6
|
-
type Rejector = (reason?: any) => void;
|
|
7
|
-
type Resolver = (value?: any) => void;
|
|
8
|
-
export default class Broker {
|
|
9
|
-
redisConfig: RedisConfig;
|
|
10
|
-
rollbar?: Rollbar;
|
|
11
|
-
consumername: string;
|
|
12
|
-
listeners: Map<string, Listener>;
|
|
13
|
-
writer: Redis;
|
|
14
|
-
reader: Redis;
|
|
15
|
-
listprefix: string;
|
|
16
|
-
service: string;
|
|
17
|
-
subscriptions: string[];
|
|
18
|
-
rejectors: Map<string, Rejector>;
|
|
19
|
-
resolvers: Map<string, Resolver>;
|
|
20
|
-
timeouts: Map<string, NodeJS.Timeout>;
|
|
21
|
-
requestendpoint?: Function;
|
|
22
|
-
constructor(redisConfig: RedisConfig, rollbarConfig: RollbarConfig, service: string, consumer: string);
|
|
23
|
-
get requeststream(): string;
|
|
24
|
-
getRequestStream(service: string): string;
|
|
25
|
-
createClient(): IORedis;
|
|
26
|
-
createSetWatcher(setname: string, callback: Function, finishedCallback?: Function, itemsPerCall?: number): void;
|
|
27
|
-
setRequestEndpoint(callback: Function): this;
|
|
28
|
-
getRequestCallback(callback: Function): (id: string, parameters: DecypheredParameters) => Promise<number | null>;
|
|
29
|
-
publish(channel: string, result: string): Promise<number>;
|
|
30
|
-
createGroup(stream: string, group: string): Promise<void>;
|
|
31
|
-
addListener(stream: string, callback: Function, group?: string, deleteOnCompletion?: boolean): this;
|
|
32
|
-
createListener(client: Redis, stream: string, callback: Function, group?: string, deleteOnCompletion?: boolean): Promise<void>;
|
|
33
|
-
addListListener(event: string, callback: Function, finishedevent?: string, itemsPerCall?: number): this;
|
|
34
|
-
getList(listname: string, start?: number, stop?: number): Promise<string[]>;
|
|
35
|
-
getSet(listname: string): Promise<string[]>;
|
|
36
|
-
throwError(error: Error): void;
|
|
37
|
-
sendMessage(stream: string, data: Struct): Promise<string | null>;
|
|
38
|
-
sendMessageAndSubscribeForResponse(channel: string, target: string, messagedata: Struct, n?: number): Promise<unknown>;
|
|
39
|
-
getRequest(targetservice: string, key: string, data: Struct, timeout?: number): Promise<unknown>;
|
|
40
|
-
getApiRequest(endpoint: string, method: "GET" | "POST" | "PUT" | "DELETE", data: {}, jwt?: string, timeout?: number): Promise<unknown>;
|
|
41
|
-
requestMessageResponse(channel: string, resolver: Resolver, rejector: Rejector, timeout: NodeJS.Timeout): void;
|
|
42
|
-
cleanupMessageReponse(channel: string): void;
|
|
43
|
-
onMessage(channel: string, message: any): void;
|
|
44
|
-
unsubscribe(channel: string): void;
|
|
45
|
-
setupTimeout(resolve: (value?: any) => void, channel: string, n?: number): NodeJS.Timeout;
|
|
46
|
-
subscribe(channel: string): Promise<unknown>;
|
|
47
|
-
getRequestSubscriptionName(messageid: string): string;
|
|
48
|
-
setKey(key: string, value: any): Promise<"OK" | undefined>;
|
|
49
|
-
readKey(key: string): Promise<string | null>;
|
|
50
|
-
deleteKey(key: string): Promise<number | undefined>;
|
|
51
|
-
sendListEvent(event: string, listitems: any[], data?: Struct, listname?: string): Promise<string | null | undefined>;
|
|
52
|
-
addToSet(listitems: any[], listname?: string): Promise<string>;
|
|
53
|
-
addToList(listitems: any[], listname?: string): Promise<string>;
|
|
54
|
-
getListChannel(event: string): string;
|
|
55
|
-
getStreamMessages(stream: string): Promise<DecypheredMessage[]>;
|
|
56
|
-
getStreamInfo(stream: string, count?: number): Promise<any[] | null>;
|
|
57
|
-
filterStream(stream: string, key: string, value: any): Promise<DecypheredMessage[]>;
|
|
58
|
-
decypherResponse(...responses: StreamResponse[]): DecypheredResponse[];
|
|
59
|
-
decyperMessages(messages: StreamMessage[]): DecypheredMessage[];
|
|
60
|
-
decypherParameters(parameters: string[]): DecypheredParameters;
|
|
61
|
-
isSetPickedUp(setname: string): Promise<boolean>;
|
|
62
|
-
}
|
|
63
|
-
export {};
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import IORedis, { Redis } from "ioredis";
|
|
3
|
+
import Rollbar from "rollbar";
|
|
4
|
+
import Listener from "./Listener";
|
|
5
|
+
import { DecypheredMessage, DecypheredParameters, DecypheredResponse, RedisConfig, RollbarConfig, StreamMessage, StreamResponse, Struct } from "../types";
|
|
6
|
+
declare type Rejector = (reason?: any) => void;
|
|
7
|
+
declare type Resolver = (value?: any) => void;
|
|
8
|
+
export default class Broker {
|
|
9
|
+
redisConfig: RedisConfig;
|
|
10
|
+
rollbar?: Rollbar;
|
|
11
|
+
consumername: string;
|
|
12
|
+
listeners: Map<string, Listener>;
|
|
13
|
+
writer: Redis;
|
|
14
|
+
reader: Redis;
|
|
15
|
+
listprefix: string;
|
|
16
|
+
service: string;
|
|
17
|
+
subscriptions: string[];
|
|
18
|
+
rejectors: Map<string, Rejector>;
|
|
19
|
+
resolvers: Map<string, Resolver>;
|
|
20
|
+
timeouts: Map<string, NodeJS.Timeout>;
|
|
21
|
+
requestendpoint?: Function;
|
|
22
|
+
constructor(redisConfig: RedisConfig, rollbarConfig: RollbarConfig, service: string, consumer: string);
|
|
23
|
+
get requeststream(): string;
|
|
24
|
+
getRequestStream(service: string): string;
|
|
25
|
+
createClient(): IORedis;
|
|
26
|
+
createSetWatcher(setname: string, callback: Function, finishedCallback?: Function, itemsPerCall?: number): void;
|
|
27
|
+
setRequestEndpoint(callback: Function): this;
|
|
28
|
+
getRequestCallback(callback: Function): (id: string, parameters: DecypheredParameters) => Promise<number | null>;
|
|
29
|
+
publish(channel: string, result: string): Promise<number>;
|
|
30
|
+
createGroup(stream: string, group: string): Promise<void>;
|
|
31
|
+
addListener(stream: string, callback: Function, group?: string, deleteOnCompletion?: boolean): this;
|
|
32
|
+
createListener(client: Redis, stream: string, callback: Function, group?: string, deleteOnCompletion?: boolean): Promise<void>;
|
|
33
|
+
addListListener(event: string, callback: Function, finishedevent?: string, itemsPerCall?: number): this;
|
|
34
|
+
getList(listname: string, start?: number, stop?: number): Promise<string[]>;
|
|
35
|
+
getSet(listname: string): Promise<string[]>;
|
|
36
|
+
throwError(error: Error): void;
|
|
37
|
+
sendMessage(stream: string, data: Struct, updatecontactid?: string): Promise<string | null>;
|
|
38
|
+
sendMessageAndSubscribeForResponse(channel: string, target: string, messagedata: Struct, n?: number): Promise<unknown>;
|
|
39
|
+
getRequest(targetservice: string, key: string, data: Struct, timeout?: number): Promise<unknown>;
|
|
40
|
+
getApiRequest(endpoint: string, method: "GET" | "POST" | "PUT" | "DELETE", data: {}, jwt?: string, timeout?: number): Promise<unknown>;
|
|
41
|
+
requestMessageResponse(channel: string, resolver: Resolver, rejector: Rejector, timeout: NodeJS.Timeout): void;
|
|
42
|
+
cleanupMessageReponse(channel: string): void;
|
|
43
|
+
onMessage(channel: string, message: any): void;
|
|
44
|
+
unsubscribe(channel: string): void;
|
|
45
|
+
setupTimeout(resolve: (value?: any) => void, channel: string, n?: number): NodeJS.Timeout;
|
|
46
|
+
subscribe(channel: string): Promise<unknown>;
|
|
47
|
+
getRequestSubscriptionName(messageid: string): string;
|
|
48
|
+
setKey(key: string, value: any): Promise<"OK" | undefined>;
|
|
49
|
+
readKey(key: string): Promise<string | null>;
|
|
50
|
+
deleteKey(key: string): Promise<number | undefined>;
|
|
51
|
+
sendListEvent(event: string, listitems: any[], data?: Struct, listname?: string): Promise<string | null | undefined>;
|
|
52
|
+
addToSet(listitems: any[], listname?: string): Promise<string>;
|
|
53
|
+
addToList(listitems: any[], listname?: string): Promise<string>;
|
|
54
|
+
getListChannel(event: string): string;
|
|
55
|
+
getStreamMessages(stream: string): Promise<DecypheredMessage[]>;
|
|
56
|
+
getStreamInfo(stream: string, count?: number): Promise<any[] | null>;
|
|
57
|
+
filterStream(stream: string, key: string, value: any): Promise<DecypheredMessage[]>;
|
|
58
|
+
decypherResponse(...responses: StreamResponse[]): DecypheredResponse[];
|
|
59
|
+
decyperMessages(messages: StreamMessage[]): DecypheredMessage[];
|
|
60
|
+
decypherParameters(parameters: string[]): DecypheredParameters;
|
|
61
|
+
isSetPickedUp(setname: string): Promise<boolean>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|