@daiso-tech/core 0.8.0 → 0.9.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/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js +19 -0
- package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js +19 -0
- package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/implementations/list-collection/list-collection.js +31 -2
- package/dist/cjs/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/cjs/event-bus/contracts/_shared.js +8 -1
- package/dist/cjs/event-bus/contracts/_shared.js.map +1 -1
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js +2 -2
- package/dist/cjs/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js +14 -7
- package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js.map +1 -1
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +2 -2
- package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +1 -1
- package/dist/cjs/storage/implementations/storage/storage-manager.js +17 -7
- package/dist/cjs/storage/implementations/storage/storage-manager.js.map +1 -1
- package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js +8 -7
- package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js +19 -0
- package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js +19 -0
- package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/esm/collection/implementations/list-collection/list-collection.js +31 -2
- package/dist/esm/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/esm/event-bus/contracts/_shared.js +6 -0
- package/dist/esm/event-bus/contracts/_shared.js.map +1 -1
- package/dist/esm/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js +1 -1
- package/dist/esm/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js +15 -8
- package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js.map +1 -1
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +1 -1
- package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +1 -1
- package/dist/esm/storage/implementations/storage/storage-manager.js +18 -8
- package/dist/esm/storage/implementations/storage/storage-manager.js.map +1 -1
- package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js +8 -7
- package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js.map +1 -1
- package/dist/types/collection/contracts/_shared.d.ts +0 -1
- package/dist/types/collection/contracts/async-collection.contract.d.ts +283 -37
- package/dist/types/collection/contracts/collection.contract.d.ts +277 -37
- package/dist/types/collection/implementations/async-iterable-collection/_shared/async-update-iterable.d.ts +3 -3
- package/dist/types/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +5 -2
- package/dist/types/collection/implementations/iterable-collection/_shared/update-iterable.d.ts +3 -3
- package/dist/types/collection/implementations/iterable-collection/iterable-collection.d.ts +5 -2
- package/dist/types/collection/implementations/list-collection/list-collection.d.ts +5 -2
- package/dist/types/event-bus/contracts/_shared.d.ts +6 -0
- package/dist/types/event-bus/contracts/event-bus-manager.contract.d.ts +107 -7
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +50 -22
- package/dist/types/event-bus/implementations/_shared/test-utilities/event-bus-adapter.test-suite.d.ts +17 -1
- package/dist/types/event-bus/implementations/event-bus/event-bus-manager.d.ts +9 -6
- package/dist/types/serializer/contracts/serializer.contract.d.ts +0 -3
- package/dist/types/storage/contracts/storage-adapter.contract.d.ts +1 -18
- package/dist/types/storage/contracts/storage-events.contract.d.ts +1 -0
- package/dist/types/storage/contracts/storage-manager.contract.d.ts +87 -6
- package/dist/types/storage/contracts/storage.contract.d.ts +41 -33
- package/dist/types/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.d.ts +18 -2
- package/dist/types/storage/implementations/storage/storage-manager.d.ts +12 -6
- package/dist/types/storage/implementations/storage/with-event-storage-adapter.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,127 +5,109 @@ import type { IListenable } from "../../event-bus/contracts/_module";
|
|
|
5
5
|
import { type AnyFunction, type AsyncLazyable, type GetOrAddValue } from "../../_shared/types";
|
|
6
6
|
import type { AllStorageEvents } from "../../storage/contracts/_module";
|
|
7
7
|
export type StorageValue<T> = Exclude<T, AnyFunction | undefined | null>;
|
|
8
|
+
/**
|
|
9
|
+
* The <i>IStorageListenable</i> contract defines a way for listening <i>{@link IStorage}</i> crud operations.
|
|
10
|
+
*/
|
|
11
|
+
export type IStorageListenable<TType = unknown> = IListenable<AllStorageEvents<TType>>;
|
|
8
12
|
/**
|
|
9
13
|
* The <i>IStorage</i> contract defines a way for storing data as key-value pairs independent of storage.
|
|
10
14
|
* It commes with more convient methods compared to <i>IStorageAdapter</i>.
|
|
11
|
-
* @throws {StorageError} {@link StorageError}
|
|
12
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
13
|
-
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
14
15
|
* @group Contracts
|
|
15
16
|
*/
|
|
16
|
-
export type IStorage<TType = unknown> =
|
|
17
|
+
export type IStorage<TType = unknown> = IStorageListenable & {
|
|
17
18
|
/**
|
|
18
19
|
* The <i>exists</i> method returns true when <i>key</i> is found otherwise false will be returned.
|
|
19
|
-
* @throws {StorageError} {@link StorageError}
|
|
20
20
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
21
21
|
*/
|
|
22
22
|
exists(key: string): PromiseLike<boolean>;
|
|
23
23
|
/**
|
|
24
24
|
* The <i>existsMany</i> method returns true for the <i>keys</i> that are found otherwise false will be returned.
|
|
25
|
-
* @throws {StorageError} {@link StorageError}
|
|
26
25
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
27
26
|
*/
|
|
28
27
|
existsMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, boolean>>;
|
|
29
28
|
/**
|
|
30
29
|
* The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
|
|
31
|
-
* @throws {StorageError} {@link StorageError}
|
|
32
30
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
33
31
|
*/
|
|
34
32
|
missing(key: string): PromiseLike<boolean>;
|
|
35
33
|
/**
|
|
36
34
|
* The <i>missingMany</i> method returns true for the <i>keys</i> that are not found otherwise false will be returned.
|
|
37
|
-
* @throws {StorageError} {@link StorageError}
|
|
38
35
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
39
36
|
*/
|
|
40
37
|
missingMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, boolean>>;
|
|
41
38
|
/**
|
|
42
39
|
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
43
|
-
* @throws {StorageError} {@link StorageError}
|
|
44
40
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
45
41
|
*/
|
|
46
42
|
get(key: string): PromiseLike<TType | null>;
|
|
47
43
|
/**
|
|
48
44
|
* The <i>getMany</i> returns the value for the <i>keys</i> that are found otherwise null will be returned.
|
|
49
|
-
* @throws {StorageError} {@link StorageError}
|
|
50
45
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
51
46
|
*/
|
|
52
47
|
getMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, TType | null>>;
|
|
53
48
|
/**
|
|
54
49
|
* The <i>getOr</i> method returns the value when <i>key</i> is found otherwise <i>defaultValue</i> will be returned.
|
|
55
|
-
* @throws {StorageError} {@link StorageError}
|
|
56
50
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
57
51
|
*/
|
|
58
52
|
getOr(key: string, defaultValue: AsyncLazyable<TType>): PromiseLike<TType>;
|
|
59
53
|
/**
|
|
60
54
|
* The <i>getOrMany</i> method returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
61
|
-
* @throws {StorageError} {@link StorageError}
|
|
62
55
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
63
56
|
*/
|
|
64
57
|
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): PromiseLike<Record<TKeys, TType>>;
|
|
65
58
|
/**
|
|
66
59
|
* The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
|
|
67
|
-
* @throws {StorageError} {@link StorageError}
|
|
68
60
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
69
61
|
* @throws {KeyNotFoundStorageError} {@link KeyNotFoundStorageError}
|
|
70
62
|
*/
|
|
71
63
|
getOrFail(key: string): PromiseLike<TType>;
|
|
72
64
|
/**
|
|
73
65
|
* The <i>add</i> method adds a <i>key</i> with given <i>value</i> when key doesn't exists. Returns true when key doesn't exists otherwise false will be returned.
|
|
74
|
-
* @throws {StorageError} {@link StorageError}
|
|
75
66
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
76
67
|
*/
|
|
77
68
|
add(key: string, value: StorageValue<TType>): PromiseLike<boolean>;
|
|
78
69
|
/**
|
|
79
70
|
* The <i>addMany</i> method adds the keys that doesn't exists. Returns true for the keys that doesn't exists otherwise false will be returned.
|
|
80
|
-
* @throws {StorageError} {@link StorageError}
|
|
81
71
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
82
72
|
*/
|
|
83
73
|
addMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>): PromiseLike<Record<TKeys, boolean>>;
|
|
84
74
|
/**
|
|
85
75
|
* The <i>update</i> method updates the given <i>key</i> with given <i>value</i>. Returns true when key otherwise false will be returned.
|
|
86
|
-
* @throws {StorageError} {@link StorageError}
|
|
87
76
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
88
77
|
*/
|
|
89
78
|
update(key: string, value: TType): PromiseLike<boolean>;
|
|
90
79
|
/**
|
|
91
80
|
* The <i>updateMany</i> method updates the given keys. Returns true for the keys that exists otherwise false will be returned.
|
|
92
|
-
* @throws {StorageError} {@link StorageError}
|
|
93
81
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
94
82
|
*/
|
|
95
83
|
updateMany<TKeys extends string>(values: Record<TKeys, TType>): PromiseLike<Record<TKeys, boolean>>;
|
|
96
84
|
/**
|
|
97
85
|
* The <i>put</i> method replaces the key with given <i>value</i> if found. If the <i>key</i> is not found it will just be added. True is returned if the key is found otherwise false will be returned.
|
|
98
|
-
* @throws {StorageError} {@link StorageError}
|
|
99
86
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
100
87
|
*/
|
|
101
88
|
put(key: string, value: StorageValue<TType>): PromiseLike<boolean>;
|
|
102
89
|
/**
|
|
103
90
|
* The <i>putMany</i> method replaces the keys that are found. Adds keys that are not found. Returns true for all the keys that are found otherwise false is returned.
|
|
104
|
-
* @throws {StorageError} {@link StorageError}
|
|
105
91
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
106
92
|
*/
|
|
107
93
|
putMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>): PromiseLike<Record<TKeys, boolean>>;
|
|
108
94
|
/**
|
|
109
95
|
* The <i>remove</i> method removes the given <i>key</i> when found. Returns true if the key is found otherwise false is returned.
|
|
110
|
-
* @throws {StorageError} {@link StorageError}
|
|
111
96
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
112
97
|
*/
|
|
113
98
|
remove(key: string): PromiseLike<boolean>;
|
|
114
99
|
/**
|
|
115
100
|
* The <i>removesMany</i> method removes the keys that are found. Returns true for the keys that are found otherwise false is returned.
|
|
116
|
-
* @throws {StorageError} {@link StorageError}
|
|
117
101
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
118
102
|
*/
|
|
119
103
|
removeMany<TKeys extends string>(keys: TKeys[]): PromiseLike<Record<TKeys, boolean>>;
|
|
120
104
|
/**
|
|
121
105
|
* The <i>getAndRemove</i> method removes the given <i>key</i> and returns it when found otherwise null will be returned.
|
|
122
|
-
* @throws {StorageError} {@link StorageError}
|
|
123
106
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
124
107
|
*/
|
|
125
108
|
getAndRemove(key: string): PromiseLike<TType | null>;
|
|
126
109
|
/**
|
|
127
110
|
* The <i>getOrAdd</i> method will retrieve the given <i>key</i> if found otherwise <i>valueToAdd</i> will be added and returned.
|
|
128
|
-
* @throws {StorageError} {@link StorageError}
|
|
129
111
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
130
112
|
*/
|
|
131
113
|
getOrAdd(key: string, valueToAdd: AsyncLazyable<StorageValue<GetOrAddValue<TType>>>): PromiseLike<TType>;
|
|
@@ -133,7 +115,6 @@ export type IStorage<TType = unknown> = IListenable<AllStorageEvents<TType>> & {
|
|
|
133
115
|
* The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
|
|
134
116
|
* Returns true if key exists otherwise false will be returned.
|
|
135
117
|
* An error will thrown if the key is not a number.
|
|
136
|
-
* @throws {StorageError} {@link StorageError}
|
|
137
118
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
138
119
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
139
120
|
*/
|
|
@@ -142,7 +123,6 @@ export type IStorage<TType = unknown> = IListenable<AllStorageEvents<TType>> & {
|
|
|
142
123
|
* The <i>decrement</i> method will decrement the given <i>key</i> if found otherwise nonthing will occur.
|
|
143
124
|
* Returns true if key exists otherwise false will be returned.
|
|
144
125
|
* An error will thrown if the key is not a number.
|
|
145
|
-
* @throws {StorageError} {@link StorageError}
|
|
146
126
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
147
127
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
148
128
|
* An error will thrown if the key is not a number.
|
|
@@ -150,27 +130,55 @@ export type IStorage<TType = unknown> = IListenable<AllStorageEvents<TType>> & {
|
|
|
150
130
|
decrement(key: string, value?: Extract<TType, number>): PromiseLike<boolean>;
|
|
151
131
|
/**
|
|
152
132
|
* The <i>clear</i> method removes all the keys in the storage.
|
|
153
|
-
* @throws {StorageError} {@link StorageError}
|
|
154
133
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
155
134
|
*/
|
|
156
135
|
clear(): PromiseLike<void>;
|
|
136
|
+
/**
|
|
137
|
+
* The <i>getNamespace</i> method return the complete namespace.
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* const storage = new Storage(new MemoryStorageAdapter(), {
|
|
141
|
+
* rootNamespace: "@root/"
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* // Will be "@root/"
|
|
145
|
+
* console.log(storage.getNamespace())
|
|
146
|
+
*
|
|
147
|
+
* const storageA = storage.withNamespace("a/");
|
|
148
|
+
*
|
|
149
|
+
* // Will be "@root/a/"
|
|
150
|
+
* console.log(storageA.getNamespace())
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
getNamespace(): string;
|
|
157
154
|
};
|
|
158
155
|
/**
|
|
159
156
|
* The <i>INamespacedStorage</i> contract defines a way for storing data as key-value pairs independent of storage.
|
|
160
157
|
* It commes with one extra method which is useful for multitennat applications compared to <i>IStorage</i>.
|
|
161
|
-
* @throws {StorageError} {@link StorageError}
|
|
162
|
-
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
163
|
-
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
164
158
|
* @group Contracts
|
|
165
159
|
*/
|
|
166
160
|
export type INamespacedStorage<TType = unknown> = IStorage<TType> & {
|
|
167
161
|
/**
|
|
168
162
|
* The <i>withNamespace</i> method returns new instance of <i>{@link IStorage}</i> where all the keys will be prefixed with a given <i>namespace</i>.
|
|
169
163
|
* This useful for multitennat applications.
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* import { Storage, MemoryStorageAdapter } from "@daiso-tech/core";
|
|
167
|
+
*
|
|
168
|
+
* (async () => {
|
|
169
|
+
* const storage = new Storage(new MemoryStorageAdapter());
|
|
170
|
+
*
|
|
171
|
+
* const storageA = storage.withNamespace("a");
|
|
172
|
+
* await storageA.add("a", 1);
|
|
173
|
+
*
|
|
174
|
+
* const storageB = storage.withNamespace("b");
|
|
175
|
+
* await storageB.add("b", 2);
|
|
176
|
+
*
|
|
177
|
+
* // Will print { a: 1, b: null }
|
|
178
|
+
* console.log(await storageA.getMany(["a", "b"]));
|
|
179
|
+
* })();
|
|
180
|
+
*
|
|
181
|
+
* ```
|
|
170
182
|
*/
|
|
171
183
|
withNamespace(namespace: string): IStorage<TType>;
|
|
172
|
-
/**
|
|
173
|
-
* The <i>getNamespace</i> method return the complete namespace.
|
|
174
|
-
*/
|
|
175
|
-
getNamespace(): string;
|
|
176
184
|
};
|
package/dist/types/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.d.ts
CHANGED
|
@@ -12,9 +12,25 @@ export type StorageAdapterTestSuiteSettings = {
|
|
|
12
12
|
test: TestAPI;
|
|
13
13
|
describe: SuiteAPI;
|
|
14
14
|
beforeEach: typeof beforeEach;
|
|
15
|
-
createAdapter: () => Promisable<IStorageAdapter
|
|
15
|
+
createAdapter: () => Promisable<IStorageAdapter>;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
+
* The <i>storageAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link IStorageAdapter}</i>.
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { storageAdapterTestSuite, MemoryStorageAdapter } from "@daiso-tech/core";
|
|
22
|
+
* import { expext, test, describe, beforeEach } from "vitest";
|
|
23
|
+
*
|
|
24
|
+
* describe("class: MemoryStorageAdapter", () => {
|
|
25
|
+
* storageAdapterTestSuite({
|
|
26
|
+
* createAdapter: () => new MemoryStorageAdapter(),
|
|
27
|
+
* test,
|
|
28
|
+
* beforeEach,
|
|
29
|
+
* expect,
|
|
30
|
+
* describe,
|
|
31
|
+
* });
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
18
34
|
* @group Utilities
|
|
19
35
|
*/
|
|
20
|
-
export declare function
|
|
36
|
+
export declare function storageAdapterTestSuite(settings: StorageAdapterTestSuiteSettings): void;
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Storage
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
4
|
+
import type { INamespacedEventBus } from "../../../event-bus/contracts/_module";
|
|
5
|
+
import type { IStorageFactory, INamespacedStorage, IStorageAdapter, IStorageManager } from "../../../storage/contracts/_module";
|
|
6
|
+
import type { Validator } from "../../../utilities/_module";
|
|
6
7
|
/**
|
|
7
8
|
* @group Derivables
|
|
8
9
|
*/
|
|
9
10
|
export type StorageManagerSettings<TAdapters extends string = string> = {
|
|
10
11
|
adapters: Record<TAdapters, IStorageAdapter<any>>;
|
|
11
12
|
defaultAdapter: NoInfer<TAdapters>;
|
|
12
|
-
|
|
13
|
+
rootNamespace: string;
|
|
14
|
+
eventBus?: INamespacedEventBus<any>;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* @group Derivables
|
|
16
18
|
*/
|
|
17
|
-
export declare class StorageManager<TAdapters extends string = string> implements IStorageManager<TAdapters> {
|
|
19
|
+
export declare class StorageManager<TAdapters extends string = string, TType = unknown> implements IStorageManager<TAdapters, TType> {
|
|
18
20
|
private readonly adapters;
|
|
19
21
|
private readonly defaultAdapter;
|
|
20
|
-
private readonly
|
|
22
|
+
private readonly rootNamespace;
|
|
23
|
+
private readonly eventBus?;
|
|
24
|
+
private validator;
|
|
21
25
|
constructor(settings: StorageManagerSettings<TAdapters>);
|
|
22
|
-
use
|
|
26
|
+
use(adapter?: TAdapters): INamespacedStorage<TType>;
|
|
27
|
+
withValidation<TOutput extends TType = TType>(validator: Validator<TOutput>): IStorageFactory<TAdapters, TOutput>;
|
|
28
|
+
withType<TOutput extends TType = TType>(): IStorageFactory<TAdapters, TOutput>;
|
|
23
29
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { StorageEvent } from "../../../storage/contracts/_module";
|
|
5
5
|
import { type IStorageAdapter, type AllStorageEvents } from "../../../storage/contracts/_module";
|
|
6
|
-
import type
|
|
6
|
+
import { type IEventBus } from "../../../event-bus/contracts/_module";
|
|
7
7
|
import type { WithNamespaceStorageAdapter } from "../../../storage/implementations/storage/with-namespace-storage-adapter";
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|