woonplan-packages-redishelper 2.0.0 → 2.0.3
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/dist/tsc/classes/Broker.d.ts +42 -0
- package/dist/tsc/classes/Broker.js +185 -0
- package/dist/tsc/classes/Broker.js.map +1 -0
- package/dist/tsc/classes/BrokerClient.d.ts +17 -0
- package/dist/tsc/classes/BrokerClient.js +52 -0
- package/dist/tsc/classes/BrokerClient.js.map +1 -0
- package/dist/tsc/classes/ListListener.d.ts +8 -0
- package/dist/tsc/classes/ListListener.js +18 -0
- package/dist/tsc/classes/ListListener.js.map +1 -0
- package/dist/tsc/classes/ListRunner.d.ts +11 -0
- package/dist/tsc/classes/ListRunner.js +34 -0
- package/dist/tsc/classes/ListRunner.js.map +1 -0
- package/dist/tsc/classes/Listener.d.ts +7 -0
- package/dist/tsc/classes/Listener.js +14 -0
- package/dist/tsc/classes/Listener.js.map +1 -0
- package/dist/tsc/main.d.ts +2 -0
- package/dist/tsc/main.js +7 -0
- package/dist/tsc/main.js.map +1 -0
- package/dist/tsc/services/utils.d.ts +11 -0
- package/dist/tsc/services/utils.js +47 -0
- package/dist/tsc/services/utils.js.map +1 -0
- package/package.json +1 -1
- package/jest.config.js +0 -18
- package/src/__tests__/Broker.test.ts +0 -223
- package/src/__tests__/Listener.test.ts +0 -89
- package/src/classes/Broker.ts +0 -225
- package/src/classes/BrokerClient.ts +0 -64
- package/src/classes/ListListener.ts +0 -20
- package/src/classes/ListRunner.ts +0 -43
- package/src/classes/Listener.ts +0 -14
- package/src/classes/Requester.ts +0 -5
- package/src/services/utils.ts +0 -52
- package/src/types.ts +0 -49
package/src/services/utils.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { JsonStringifiedMap } from "../types";
|
|
2
|
-
|
|
3
|
-
const isJSON = ( str:any ) => {
|
|
4
|
-
if( typeof str == 'number' ) return false
|
|
5
|
-
try{
|
|
6
|
-
JSON.parse( str )
|
|
7
|
-
}catch( error ){
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface ObjectToOmitFrom{
|
|
14
|
-
[index: string]: any;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const omit = ( objectToOmitFrom:ObjectToOmitFrom, keys:(keyof ObjectToOmitFrom)[]) =>
|
|
19
|
-
Object.keys( objectToOmitFrom )
|
|
20
|
-
.filter( key => keys.indexOf( key ) == -1 )
|
|
21
|
-
.reduce( (struct:object,key) =>
|
|
22
|
-
Object.assign( struct, {[key]:objectToOmitFrom[key]} ) ,
|
|
23
|
-
{}
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const mapJsonReplacer = ( _key:any, value:Map<any,any> | any ) => {
|
|
29
|
-
if(value instanceof Map) {
|
|
30
|
-
return {
|
|
31
|
-
dataType: 'Map',
|
|
32
|
-
value: Array.from(value.entries()), // or with spread: value: [...value]
|
|
33
|
-
} as JsonStringifiedMap
|
|
34
|
-
} else {
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const mapJsonReviver = ( _key:any, value:JsonStringifiedMap | any ) => {
|
|
40
|
-
if(typeof value === 'object' && value !== null) {
|
|
41
|
-
if (value.dataType === 'Map') {
|
|
42
|
-
return new Map(value.value);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const stringifyMap = ( map:Map<any,any> ):string=> JSON.stringify( map, exports.mapJsonReplacer)
|
|
49
|
-
const parseMap = ( json:string ):Map<any,any> => JSON.parse( json, exports.mapJsonReviver)
|
|
50
|
-
const capitalizeFirstLetter = (string:string) => string.charAt(0).toUpperCase() + string.slice(1)
|
|
51
|
-
|
|
52
|
-
export { isJSON, omit, mapJsonReviver, stringifyMap, parseMap, mapJsonReplacer, capitalizeFirstLetter }
|
package/src/types.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export interface JsonStringifiedMap{
|
|
3
|
-
dataType : 'Map',
|
|
4
|
-
value : any[]
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface RedisMessage{
|
|
8
|
-
[index: string]: any;
|
|
9
|
-
}
|
|
10
|
-
export interface Struct{
|
|
11
|
-
[index: string]: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface RedisConfig{
|
|
15
|
-
REDISURL: string | number | undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface RedisStreamEntry{
|
|
19
|
-
id : string
|
|
20
|
-
message:RedisMessage
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type StreamMessage = [
|
|
24
|
-
string, StreamMessageParameters
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
export type StreamMessageParameters = string[]
|
|
28
|
-
export type StreamResponse = [
|
|
29
|
-
string, StreamMessage[]
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
export interface DecypheredParameters{
|
|
33
|
-
[index:string] : string
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface DecypheredMessage{
|
|
37
|
-
id : string
|
|
38
|
-
parameters : DecypheredParameters
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface DecypheredResponse{
|
|
42
|
-
stream : string,
|
|
43
|
-
messages : DecypheredMessage[]
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface RollbarConfig{
|
|
47
|
-
accessToken : string
|
|
48
|
-
environment : string
|
|
49
|
-
}
|