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.
@@ -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 {};