@daiso-tech/core 0.20.0 → 0.21.0
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/cjs/cache/contracts/cache.errors.js +13 -0
- package/dist/cjs/cache/contracts/cache.errors.js.map +1 -1
- package/dist/cjs/cache/contracts/cache.events.js +17 -0
- package/dist/cjs/cache/contracts/cache.events.js.map +1 -1
- package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache/cache-settings.js +0 -18
- package/dist/cjs/cache/implementations/derivables/cache/cache-settings.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache/cache.js +1 -67
- package/dist/cjs/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory/cache-factory.js +17 -13
- package/dist/cjs/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cjs/event-bus/contracts/event-bus.errors.js +14 -0
- package/dist/cjs/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus-settings.js +0 -12
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus-settings.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus.js +1 -29
- package/dist/cjs/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +17 -15
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/esm/cache/contracts/cache.errors.js +12 -0
- package/dist/esm/cache/contracts/cache.errors.js.map +1 -1
- package/dist/esm/cache/contracts/cache.events.js +16 -0
- package/dist/esm/cache/contracts/cache.events.js.map +1 -1
- package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache/cache-settings.js +0 -18
- package/dist/esm/cache/implementations/derivables/cache/cache-settings.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache/cache.js +2 -68
- package/dist/esm/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory/cache-factory.js +17 -13
- package/dist/esm/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/esm/event-bus/contracts/event-bus.errors.js +13 -0
- package/dist/esm/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus-settings.js +0 -12
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus-settings.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus.js +2 -30
- package/dist/esm/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +14 -12
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/types/cache/contracts/cache.errors.d.ts +7 -2
- package/dist/types/cache/contracts/cache.events.d.ts +7 -1
- package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +4 -8
- package/dist/types/cache/implementations/derivables/cache/cache-settings.d.ts +2 -29
- package/dist/types/cache/implementations/derivables/cache/cache.d.ts +5 -33
- package/dist/types/cache/implementations/derivables/cache-factory/cache-factory-settings.d.ts +1 -1
- package/dist/types/cache/implementations/derivables/cache-factory/cache-factory.d.ts +4 -5
- package/dist/types/event-bus/contracts/event-bus.errors.d.ts +7 -2
- package/dist/types/event-bus/implementations/derivables/event-bus/event-bus-settings.d.ts +1 -19
- package/dist/types/event-bus/implementations/derivables/event-bus/event-bus.d.ts +16 -14
- package/dist/types/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +30 -5
- package/package.json +1 -1
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import type { CacheEvents, WithTtlValue } from "../../../../cache/contracts/_module";
|
|
5
|
-
import {
|
|
6
|
-
import { CacheError, KeyNotFoundCacheError, TypeCacheError, UnexpectedCacheError } from "../../../../cache/contracts/_module";
|
|
5
|
+
import { type ICache } from "../../../../cache/contracts/_module";
|
|
7
6
|
import { type IGroupableCache } from "../../../../cache/contracts/_module";
|
|
8
7
|
import type { AsyncLazyable, GetOrAddValue, OneOrMore } from "../../../../utilities/_module";
|
|
9
8
|
import type { TimeSpan } from "../../../../utilities/_module";
|
|
@@ -16,22 +15,6 @@ import { CacheSettingsBuilder } from "../../../../cache/implementations/derivabl
|
|
|
16
15
|
* @group Derivables
|
|
17
16
|
*/
|
|
18
17
|
export declare class Cache<TType = unknown> implements IGroupableCache<TType> {
|
|
19
|
-
static readonly errors: {
|
|
20
|
-
readonly Error: typeof CacheError;
|
|
21
|
-
readonly Unexpected: typeof UnexpectedCacheError;
|
|
22
|
-
readonly Type: typeof TypeCacheError;
|
|
23
|
-
readonly KeyNotFound: typeof KeyNotFoundCacheError;
|
|
24
|
-
};
|
|
25
|
-
static readonly events: {
|
|
26
|
-
readonly KeyFound: typeof KeyFoundCacheEvent;
|
|
27
|
-
readonly KeyNotFound: typeof KeyNotFoundCacheEvent;
|
|
28
|
-
readonly KeyAdded: typeof KeyAddedCacheEvent;
|
|
29
|
-
readonly KeyUpdated: typeof KeyUpdatedCacheEvent;
|
|
30
|
-
readonly KeyRemoved: typeof KeyRemovedCacheEvent;
|
|
31
|
-
readonly KeyIncremented: typeof KeyIncrementedCacheEvent;
|
|
32
|
-
readonly KeyDecremented: typeof KeyDecrementedCacheEvent;
|
|
33
|
-
readonly KeysCleared: typeof KeysClearedCacheEvent;
|
|
34
|
-
};
|
|
35
18
|
/**
|
|
36
19
|
* @example
|
|
37
20
|
* ```ts
|
|
@@ -40,10 +23,8 @@ export declare class Cache<TType = unknown> implements IGroupableCache<TType> {
|
|
|
40
23
|
* const cache = new Cache(
|
|
41
24
|
* Cache
|
|
42
25
|
* .settings()
|
|
43
|
-
* .setSerde(new SuperJsonSerde())
|
|
44
26
|
* .setAdapter(new MemoryCacheAdapter({ rootGroup: "@global" }))
|
|
45
27
|
* .setEventBus(new EventBus(new MemoryEventBusAdapter({ rootGroup: "@global" })))
|
|
46
|
-
* .setDefaultTtl(TimeSpan.fromMinutes(2))
|
|
47
28
|
* .build()
|
|
48
29
|
* );
|
|
49
30
|
* ```
|
|
@@ -58,35 +39,26 @@ export declare class Cache<TType = unknown> implements IGroupableCache<TType> {
|
|
|
58
39
|
private readonly backoffPolicy;
|
|
59
40
|
private readonly retryPolicy;
|
|
60
41
|
private readonly timeout;
|
|
61
|
-
private readonly serde;
|
|
62
|
-
private readonly shouldRegisterErrors;
|
|
63
|
-
private readonly shouldRegisterEvents;
|
|
64
42
|
/**
|
|
65
43
|
*@example
|
|
66
44
|
* ```ts
|
|
67
|
-
* import { Cache, MemoryCacheAdapter, EventBus, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
45
|
+
* import { Cache, MemoryCacheAdapter, EventBus, MemoryEventBusAdapter, registerCacheEvents, reigsterCacheErrors, SuperJsonSerde } from "@daiso-tech/core";
|
|
68
46
|
*
|
|
69
47
|
* const eventBus = new EventBus({
|
|
70
48
|
* adapter: new MemoryEventBusAdapter({ rootGroup: "@global" })
|
|
71
49
|
* });
|
|
72
50
|
* const cache = new Cache({
|
|
73
|
-
* serde: new SuperJsonSerde();
|
|
74
51
|
* adapter: new MemoryCacheAdapter({
|
|
75
52
|
* rootGroup: "@global"
|
|
76
53
|
* }),
|
|
77
54
|
* eventBus,
|
|
78
55
|
* });
|
|
56
|
+
* const serde = new SuperJsonSerde();
|
|
57
|
+
* registerCacheEvents(serde);
|
|
58
|
+
* reigsterCacheErrors(serde);
|
|
79
59
|
* ```
|
|
80
60
|
*/
|
|
81
61
|
constructor(settings: CacheSettings);
|
|
82
|
-
/**
|
|
83
|
-
* Registers all cache-related events within the given <i>IFlexibleSerde</i> contract.
|
|
84
|
-
*/
|
|
85
|
-
private registerEvents;
|
|
86
|
-
/**
|
|
87
|
-
* Registers all cache-related error within the given <i>IFlexibleSerde</i> contract.
|
|
88
|
-
*/
|
|
89
|
-
private registerErrors;
|
|
90
62
|
private createLayPromise;
|
|
91
63
|
private createKeyFoundEvent;
|
|
92
64
|
private createKeyNotFoundEvent;
|
package/dist/types/cache/implementations/derivables/cache-factory/cache-factory-settings.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type CacheFactorySettings<TAdapters extends string = string> = {
|
|
|
40
40
|
/**
|
|
41
41
|
* In order to listen to events of <i>{@link Cache}</i> class you must pass in <i>{@link IGroupableEventBus}</i>.
|
|
42
42
|
*/
|
|
43
|
-
eventBus
|
|
43
|
+
eventBus: IGroupableEventBus<any>;
|
|
44
44
|
/**
|
|
45
45
|
* The default retry attempt to use in the returned <i>LazyPromise</i>.
|
|
46
46
|
* @default {null}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
4
|
+
import { type ICacheFactory, type IGroupableCache } from "../../../../cache/contracts/_module";
|
|
5
5
|
import type { CacheFactorySettings } from "../../../../cache/implementations/derivables/cache-factory/cache-factory-settings";
|
|
6
6
|
import { CacheFactorySettingsBuilder } from "../../../../cache/implementations/derivables/cache-factory/cache-factory-settings";
|
|
7
7
|
/**
|
|
@@ -33,10 +33,9 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
static settings<TAdapters extends string, TSettings extends CacheFactorySettings<TAdapters>>(): CacheFactorySettingsBuilder<TSettings>;
|
|
36
|
-
private readonly
|
|
37
|
-
private readonly adapters;
|
|
36
|
+
private readonly cacheRecord;
|
|
38
37
|
private readonly defaultAdapter?;
|
|
39
|
-
private readonly eventBus
|
|
38
|
+
private readonly eventBus;
|
|
40
39
|
private readonly defaultTtl;
|
|
41
40
|
private readonly retryAttempts?;
|
|
42
41
|
private readonly backoffPolicy?;
|
|
@@ -73,6 +72,6 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
73
72
|
* ```
|
|
74
73
|
*/
|
|
75
74
|
constructor(settings: CacheFactorySettings<TAdapters>);
|
|
76
|
-
private
|
|
75
|
+
private init;
|
|
77
76
|
use<TType = unknown>(adapterName?: TAdapters | undefined): IGroupableCache<TType>;
|
|
78
77
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
-
import type { ISerializable } from "../../serde/contracts/_module";
|
|
5
|
-
import type { ISerializedError } from "../../utilities/_module";
|
|
4
|
+
import type { IFlexibleSerde, ISerializable } from "../../serde/contracts/_module";
|
|
5
|
+
import type { ISerializedError, OneOrMore } from "../../utilities/_module";
|
|
6
6
|
/**
|
|
7
7
|
* @group Errors
|
|
8
8
|
*/
|
|
@@ -38,3 +38,8 @@ export declare class UnableToAddListenerEventBusError extends UnexpectedEventBus
|
|
|
38
38
|
export declare class UnableToDispatchEventBusError extends UnexpectedEventBusError {
|
|
39
39
|
constructor(message: string, cause?: unknown);
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* The <i>registerEventBusErrors</i> function registers all <i>{@link IGroupableEventBus}</i> related errors with <i>IFlexibleSerde</i>, ensuring they will properly be serialized and deserialized.
|
|
43
|
+
* @group Errors
|
|
44
|
+
*/
|
|
45
|
+
export declare function registerEventBusErrors(serde: OneOrMore<IFlexibleSerde>): void;
|
|
@@ -3,23 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { BackoffPolicy, RetryPolicy } from "../../../../async/_module";
|
|
5
5
|
import { type IGroupableEventBus, type IEventBusAdapter } from "../../../../event-bus/contracts/_module";
|
|
6
|
-
import type {
|
|
7
|
-
import type { IBuildable, OneOrMore, TimeSpan } from "../../../../utilities/_module";
|
|
6
|
+
import type { IBuildable, TimeSpan } from "../../../../utilities/_module";
|
|
8
7
|
/**
|
|
9
8
|
* @group Derivables
|
|
10
9
|
*/
|
|
11
10
|
export type EventBusSettings = {
|
|
12
|
-
/**
|
|
13
|
-
* You can pass one or more <i>{@link IFlexibleSerde}</i> that will be used to register all <i>{@link IGroupableEventBus}</i> related errors.
|
|
14
|
-
* @default {true}
|
|
15
|
-
*/
|
|
16
|
-
serde: OneOrMore<IFlexibleSerde>;
|
|
17
|
-
/**
|
|
18
|
-
* If set to true, all <i>{@link IGroupableEventBus}</i> related errors will be registered with the specified <i>IFlexibleSerde</i> during constructor initialization.
|
|
19
|
-
* This ensures that all <i>{@link IGroupableEventBus}</i> related errors will be serialized correctly.
|
|
20
|
-
* @default {true}
|
|
21
|
-
*/
|
|
22
|
-
shouldRegisterErrors?: boolean;
|
|
23
11
|
adapter: IEventBusAdapter;
|
|
24
12
|
/**
|
|
25
13
|
* The default retry attempt to use in the returned <i>LazyPromise</i>.
|
|
@@ -49,12 +37,6 @@ export type EventBusSettings = {
|
|
|
49
37
|
export declare class EventBusSettingsBuilder<TSettings extends Partial<EventBusSettings>> implements IBuildable<EventBusSettings> {
|
|
50
38
|
private readonly settings;
|
|
51
39
|
constructor(settings?: TSettings);
|
|
52
|
-
setShouldRegisterErrors(shouldRegisterErrors: boolean): EventBusSettingsBuilder<TSettings & {
|
|
53
|
-
shouldRegisterErrors: boolean;
|
|
54
|
-
}>;
|
|
55
|
-
setSerde(serde: OneOrMore<IFlexibleSerde>): EventBusSettingsBuilder<TSettings & {
|
|
56
|
-
serde: OneOrMore<IFlexibleSerde>;
|
|
57
|
-
}>;
|
|
58
40
|
setAdapter(adapter: IEventBusAdapter): EventBusSettingsBuilder<TSettings & {
|
|
59
41
|
adapter: IEventBusAdapter;
|
|
60
42
|
}>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { LazyPromise } from "../../../../async/_module";
|
|
5
5
|
import type { EventClass, EventInstance, Unsubscribe } from "../../../../event-bus/contracts/_module";
|
|
6
|
-
import { type IEventBus, type IGroupableEventBus, type Listener, type BaseEvent
|
|
6
|
+
import { type IEventBus, type IGroupableEventBus, type Listener, type BaseEvent } from "../../../../event-bus/contracts/_module";
|
|
7
7
|
import type { OneOrMore } from "../../../../utilities/_module";
|
|
8
8
|
import type { EventBusSettings } from "../../../../event-bus/implementations/derivables/event-bus/event-bus-settings";
|
|
9
9
|
import { EventBusSettingsBuilder } from "../../../../event-bus/implementations/derivables/event-bus/event-bus-settings";
|
|
@@ -12,38 +12,40 @@ import { EventBusSettingsBuilder } from "../../../../event-bus/implementations/d
|
|
|
12
12
|
* @group Derivables
|
|
13
13
|
*/
|
|
14
14
|
export declare class EventBus<TEvents extends BaseEvent = BaseEvent> implements IGroupableEventBus<TEvents> {
|
|
15
|
-
static readonly errors: {
|
|
16
|
-
readonly Error: typeof EventBusError;
|
|
17
|
-
readonly Unexpected: typeof UnexpectedEventBusError;
|
|
18
|
-
readonly RemoveListener: typeof UnableToRemoveListenerEventBusError;
|
|
19
|
-
readonly AddListener: typeof UnableToAddListenerEventBusError;
|
|
20
|
-
};
|
|
21
15
|
/**
|
|
22
16
|
* @example
|
|
23
17
|
* ```ts
|
|
24
|
-
* import { EventBus, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
18
|
+
* import { EventBus, MemoryEventBusAdapter, registerEventErrors, SuperJsonSerde } from "@daiso-tech/core";
|
|
25
19
|
*
|
|
26
|
-
* const
|
|
20
|
+
* const eventBus = new EventBus(
|
|
27
21
|
* EventBus
|
|
28
22
|
* .settings()
|
|
29
23
|
* .setAdapter(new MemoryEventBusAdapter({ rootGroup: "@global" }))
|
|
30
24
|
* .build()
|
|
31
25
|
* );
|
|
26
|
+
* const serde = new SuperJsonSerde();
|
|
27
|
+
* registerEventErrors(serde)
|
|
32
28
|
* ```
|
|
33
29
|
*/
|
|
34
30
|
static settings<TSettings extends Partial<EventBusSettings>>(): EventBusSettingsBuilder<TSettings>;
|
|
35
|
-
private readonly serde;
|
|
36
31
|
private readonly adapter;
|
|
37
32
|
private readonly retryAttempts;
|
|
38
33
|
private readonly backoffPolicy;
|
|
39
34
|
private readonly retryPolicy;
|
|
40
35
|
private readonly timeout;
|
|
41
|
-
private readonly shouldRegisterErrors;
|
|
42
|
-
constructor(settings: EventBusSettings);
|
|
43
36
|
/**
|
|
44
|
-
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { EventBus, MemoryEventBusAdapter, registerEventErrors, SuperJsonSerde } from "@daiso-tech/core";
|
|
40
|
+
*
|
|
41
|
+
* const eventBus = new EventBus({
|
|
42
|
+
* adapter: new MemoryEventBusAdapter({ rootGroup: "@global" })
|
|
43
|
+
* });
|
|
44
|
+
* const serde = new SuperJsonSerde();
|
|
45
|
+
* registerEventErrors(serde)
|
|
46
|
+
* ```
|
|
45
47
|
*/
|
|
46
|
-
|
|
48
|
+
constructor(settings: EventBusSettings);
|
|
47
49
|
private createLayPromise;
|
|
48
50
|
withGroup(group: OneOrMore<string>): IEventBus<TEvents>;
|
|
49
51
|
getGroup(): string;
|
package/dist/types/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
4
|
+
import { type IGroupableEventBus, type IEventBusFactory, type BaseEvent } from "../../../../event-bus/contracts/_module";
|
|
5
5
|
import { type EventBusFactorySettings, EventBusFactorySettingsBuilder } from "../../../../event-bus/implementations/derivables/event-bus-factory/event-bus-factory-settings";
|
|
6
6
|
/**
|
|
7
7
|
* @group Derivables
|
|
@@ -21,6 +21,7 @@ import { type EventBusFactorySettings, EventBusFactorySettingsBuilder } from "..
|
|
|
21
21
|
* }),
|
|
22
22
|
* },
|
|
23
23
|
* defaultAdapter: "memory",
|
|
24
|
+
* serde: new SuperJsonSerde()
|
|
24
25
|
* });
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
@@ -31,16 +32,18 @@ export declare class EventBusFactory<TAdapters extends string = string> implemen
|
|
|
31
32
|
* import { EventBusFactory, SuperJsonSerde. MemoryEventBusAdapter, RedisPubSubEventBusAdapter, EventBus, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
32
33
|
* import Redis from "ioredis";
|
|
33
34
|
*
|
|
35
|
+
* const serde = new SuperJsonSerde();
|
|
34
36
|
* const cacheFactory = new EventBusFactory(
|
|
35
37
|
* EventBusFactory
|
|
36
38
|
* .settings()
|
|
39
|
+
* .setSerde(serde)
|
|
37
40
|
* .setAdapter("memory", new MemoryEventBusAdapter({
|
|
38
41
|
* rootGroup: "@global"
|
|
39
42
|
* }))
|
|
40
43
|
* .setAdapter("redis", new RedisPubSubEventBusAdapter({
|
|
41
44
|
* dispatcherClient: new Redis("YOUR_REDIS_CONNECTION"),
|
|
42
45
|
* listenerClient: new Redis("YOUR_REDIS_CONNECTION")
|
|
43
|
-
* serde
|
|
46
|
+
* serde,
|
|
44
47
|
* rootGroup: "@global"
|
|
45
48
|
* }))
|
|
46
49
|
* .setDefaultAdapter("memory")
|
|
@@ -49,16 +52,38 @@ export declare class EventBusFactory<TAdapters extends string = string> implemen
|
|
|
49
52
|
* ```
|
|
50
53
|
*/
|
|
51
54
|
static settings<TAdapters extends string, TSettings extends EventBusFactorySettings<TAdapters>>(): EventBusFactorySettingsBuilder<TSettings>;
|
|
52
|
-
private readonly
|
|
55
|
+
private readonly eventBusRecord;
|
|
53
56
|
private readonly serde;
|
|
54
|
-
private readonly adapters;
|
|
55
57
|
private readonly defaultAdapter?;
|
|
56
58
|
private readonly retryAttempts?;
|
|
57
59
|
private readonly backoffPolicy?;
|
|
58
60
|
private readonly retryPolicy?;
|
|
59
61
|
private readonly timeout?;
|
|
60
62
|
private readonly shouldRegisterErrors?;
|
|
63
|
+
/**
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { EventBusFactory, SuperJsonSerde. MemoryEventBusAdapter, RedisPubSubEventBusAdapter, EventBus, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
67
|
+
* import Redis from "ioredis";
|
|
68
|
+
* const serde = new SuperJsonSerde();
|
|
69
|
+
* const cacheFactory = new EventBusFactory({
|
|
70
|
+
* serde,
|
|
71
|
+
* adapters: {
|
|
72
|
+
* memory:new MemoryEventBusAdapter({
|
|
73
|
+
* rootGroup: "@global"
|
|
74
|
+
* }),
|
|
75
|
+
* redis: new RedisPubSubEventBusAdapter({
|
|
76
|
+
* dispatcherClient: new Redis("YOUR_REDIS_CONNECTION"),
|
|
77
|
+
* listenerClient: new Redis("YOUR_REDIS_CONNECTION")
|
|
78
|
+
* serde,
|
|
79
|
+
* rootGroup: "@global"
|
|
80
|
+
* }),
|
|
81
|
+
* defaultAdapter: "memory"
|
|
82
|
+
* }
|
|
83
|
+
* })
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
61
86
|
constructor(settings: EventBusFactorySettings<TAdapters>);
|
|
62
|
-
private
|
|
87
|
+
private init;
|
|
63
88
|
use<TEvents extends BaseEvent = BaseEvent>(adapterName?: TAdapters | undefined): IGroupableEventBus<TEvents>;
|
|
64
89
|
}
|