@daiso-tech/core 0.9.0 → 0.10.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/types/collection/contracts/async-collection.contract.d.ts +37 -37
- package/dist/types/event-bus/contracts/event-bus.contract.d.ts +9 -8
- package/dist/types/event-bus/implementations/event-bus/event-bus.d.ts +2 -2
- package/dist/types/serializer/contracts/serializer.contract.d.ts +2 -2
- package/dist/types/storage/contracts/storage.contract.d.ts +23 -22
- package/dist/types/storage/implementations/storage/storage.d.ts +6 -6
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { AsyncReduce, CrossJoinResult, AsyncPredicate, AsyncForEach, AsyncMap, AsyncModifier, AsyncTap, AsyncTransform, Comparator } from "../../collection/contracts/_shared";
|
|
5
5
|
import type { RecordItem, AsyncLazyable, AsyncIterableValue } from "../../_shared/types";
|
|
6
|
-
import type { TimeSpan } from "../../utilities/_module";
|
|
6
|
+
import type { LazyPromise, TimeSpan } from "../../utilities/_module";
|
|
7
7
|
export type AsyncCollapse<TValue> = TValue extends Array<infer TItem> | Iterable<infer TItem> | IAsyncCollection<infer TItem> ? TItem : TValue;
|
|
8
8
|
/**
|
|
9
9
|
* The <i>IAsyncCollection</i> contract offers a fluent and efficient approach to working with {@link AsyncIterable} objects.
|
|
@@ -93,9 +93,9 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
93
93
|
* // { 0: "a", 1: "b", 2: "c" }
|
|
94
94
|
* ```
|
|
95
95
|
*/
|
|
96
|
-
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>):
|
|
97
|
-
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput):
|
|
98
|
-
reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput):
|
|
96
|
+
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>): LazyPromise<TInput>;
|
|
97
|
+
reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput): LazyPromise<TInput>;
|
|
98
|
+
reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput): LazyPromise<TOutput>;
|
|
99
99
|
/**
|
|
100
100
|
* The <i>join</i> method joins the collection's items with <i> separator </i>. An error will be thrown when if a none string item is encounterd.
|
|
101
101
|
* @throws {TypeCollectionError}
|
|
@@ -116,7 +116,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
116
116
|
* // "1_2_3_4"
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
|
-
join(separator?: string):
|
|
119
|
+
join(separator?: string): LazyPromise<Extract<TInput, string>>;
|
|
120
120
|
/**
|
|
121
121
|
* The <i>collapse</i> method collapses a collection of iterables into a single, flat collection.
|
|
122
122
|
* @example
|
|
@@ -192,7 +192,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
192
192
|
* await collection.get(5);
|
|
193
193
|
* ```
|
|
194
194
|
*/
|
|
195
|
-
get(index: number):
|
|
195
|
+
get(index: number): LazyPromise<TInput | null>;
|
|
196
196
|
/**
|
|
197
197
|
* The <i>getOrFail</i> method returns the item by index. If the item is not found an error will be thrown.
|
|
198
198
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
@@ -209,7 +209,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
209
209
|
* await collection.getOrFail(5);
|
|
210
210
|
* ```
|
|
211
211
|
*/
|
|
212
|
-
getOrFail(index: number):
|
|
212
|
+
getOrFail(index: number): LazyPromise<TInput>;
|
|
213
213
|
/**
|
|
214
214
|
* The <i>page</i> method returns a new collection containing the items that would be present on <i> page </i> with custom <i> pageSize </i>.
|
|
215
215
|
* @example
|
|
@@ -237,7 +237,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
237
237
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
238
238
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
239
239
|
*/
|
|
240
|
-
sum():
|
|
240
|
+
sum(): LazyPromise<Extract<TInput, number>>;
|
|
241
241
|
/**
|
|
242
242
|
* The <i>average</i> method returns the average of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
243
243
|
* @example
|
|
@@ -252,7 +252,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
252
252
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
253
253
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
254
254
|
*/
|
|
255
|
-
average():
|
|
255
|
+
average(): LazyPromise<Extract<TInput, number>>;
|
|
256
256
|
/**
|
|
257
257
|
* The <i>median</i> method returns the median of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
258
258
|
* @example
|
|
@@ -267,7 +267,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
267
267
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
268
268
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
269
269
|
*/
|
|
270
|
-
median():
|
|
270
|
+
median(): LazyPromise<Extract<TInput, number>>;
|
|
271
271
|
/**
|
|
272
272
|
* The <i>min</i> method returns the min of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
273
273
|
* @example
|
|
@@ -282,7 +282,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
282
282
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
283
283
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
284
284
|
*/
|
|
285
|
-
min():
|
|
285
|
+
min(): LazyPromise<Extract<TInput, number>>;
|
|
286
286
|
/**
|
|
287
287
|
* The <i>max</i> method returns the max of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
288
288
|
* @example
|
|
@@ -297,7 +297,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
297
297
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
298
298
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
299
299
|
*/
|
|
300
|
-
max():
|
|
300
|
+
max(): LazyPromise<Extract<TInput, number>>;
|
|
301
301
|
/**
|
|
302
302
|
* The <i>percentage</i> method may be used to quickly determine the percentage of items in the collection that pass <i>predicateFn</i>.
|
|
303
303
|
* @example
|
|
@@ -311,7 +311,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
311
311
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
312
312
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
313
313
|
*/
|
|
314
|
-
percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
314
|
+
percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
315
315
|
/**
|
|
316
316
|
* The <i>some</i> method determines whether at least one item in the collection matches <i>predicateFn</i>.
|
|
317
317
|
* @example
|
|
@@ -324,7 +324,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
324
324
|
* ```
|
|
325
325
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
326
326
|
*/
|
|
327
|
-
some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
327
|
+
some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<boolean>;
|
|
328
328
|
/**
|
|
329
329
|
* The <i>every</i> method determines whether all items in the collection matches <i>predicateFn</i>.
|
|
330
330
|
* @example
|
|
@@ -337,7 +337,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
337
337
|
* ```
|
|
338
338
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
339
339
|
*/
|
|
340
|
-
every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
340
|
+
every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<boolean>;
|
|
341
341
|
/**
|
|
342
342
|
* The <i>take</i> method takes the first <i>limit</i> items.
|
|
343
343
|
* @example
|
|
@@ -517,7 +517,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
517
517
|
* // [ 1, 2, 1, 3 ]
|
|
518
518
|
* ```
|
|
519
519
|
*/
|
|
520
|
-
pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>):
|
|
520
|
+
pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
521
521
|
/**
|
|
522
522
|
* The <i>tap</i> method passes a copy of the original collection to <i>callback</i>, allowing you to do something with the items while not affecting the original collection.
|
|
523
523
|
* @example
|
|
@@ -1074,7 +1074,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1074
1074
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1075
1075
|
* // 3
|
|
1076
1076
|
*/
|
|
1077
|
-
first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1077
|
+
first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | null>;
|
|
1078
1078
|
/**
|
|
1079
1079
|
* The <i>firstOr</i> method returns the first item in the collection that passes <i> predicateFn </i>
|
|
1080
1080
|
* By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
|
|
@@ -1112,7 +1112,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1112
1112
|
* ```
|
|
1113
1113
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1114
1114
|
*/
|
|
1115
|
-
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1115
|
+
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | TExtended>;
|
|
1116
1116
|
/**
|
|
1117
1117
|
* The <i>firstOrFail</i> method returns the first item in the collection that passes <i> predicateFn </i>.
|
|
1118
1118
|
* By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
|
|
@@ -1143,7 +1143,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1143
1143
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1144
1144
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1145
1145
|
*/
|
|
1146
|
-
firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1146
|
+
firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
1147
1147
|
/**
|
|
1148
1148
|
* The <i>last</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
1149
1149
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than null i returned.
|
|
@@ -1174,7 +1174,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1174
1174
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1175
1175
|
* // 3
|
|
1176
1176
|
*/
|
|
1177
|
-
last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1177
|
+
last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | null>;
|
|
1178
1178
|
/**
|
|
1179
1179
|
* The <i>lastOr</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
1180
1180
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
|
|
@@ -1212,7 +1212,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1212
1212
|
* ```
|
|
1213
1213
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1214
1214
|
*/
|
|
1215
|
-
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1215
|
+
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | TExtended>;
|
|
1216
1216
|
/**
|
|
1217
1217
|
* The <i>lastOrFail</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
1218
1218
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
|
|
@@ -1243,7 +1243,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1243
1243
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1244
1244
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1245
1245
|
*/
|
|
1246
|
-
lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1246
|
+
lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
1247
1247
|
/**
|
|
1248
1248
|
* The <i>before</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1249
1249
|
* If the <i>predicateFn</i> does not match or matches the first item then null is returned.
|
|
@@ -1265,7 +1265,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1265
1265
|
* ```
|
|
1266
1266
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1267
1267
|
*/
|
|
1268
|
-
before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1268
|
+
before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | null>;
|
|
1269
1269
|
/**
|
|
1270
1270
|
* The <i>beforeOr</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1271
1271
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then <i>defaultValue</i> is returned.
|
|
@@ -1295,7 +1295,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1295
1295
|
* ```
|
|
1296
1296
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1297
1297
|
*/
|
|
1298
|
-
beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1298
|
+
beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | TExtended>;
|
|
1299
1299
|
/**
|
|
1300
1300
|
* The <i>beforeOrFail</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1301
1301
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then an error is thrown.
|
|
@@ -1318,7 +1318,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1318
1318
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1319
1319
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1320
1320
|
*/
|
|
1321
|
-
beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1321
|
+
beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput>;
|
|
1322
1322
|
/**
|
|
1323
1323
|
* The <i>after</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1324
1324
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then null is returned.
|
|
@@ -1340,7 +1340,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1340
1340
|
* ```
|
|
1341
1341
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1342
1342
|
*/
|
|
1343
|
-
after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1343
|
+
after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | null>;
|
|
1344
1344
|
/**
|
|
1345
1345
|
* The <i>afterOr</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1346
1346
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then <i>defaultValue</i> is returned.
|
|
@@ -1370,7 +1370,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1370
1370
|
* ```
|
|
1371
1371
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1372
1372
|
*/
|
|
1373
|
-
afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1373
|
+
afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | TExtended>;
|
|
1374
1374
|
/**
|
|
1375
1375
|
* The <i>afterOrFail</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1376
1376
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then an error is thrown.
|
|
@@ -1393,7 +1393,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1393
1393
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1394
1394
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1395
1395
|
*/
|
|
1396
|
-
afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1396
|
+
afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput>;
|
|
1397
1397
|
/**
|
|
1398
1398
|
* The <i>sole</i> method returns the first item in the collection that passes <i>predicateFn</i>, but only if <i>predicateFn</i> matches exactly one item.
|
|
1399
1399
|
* If no items matches or multiple items are found an error will be thrown.
|
|
@@ -1425,7 +1425,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1425
1425
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1426
1426
|
* @throws {MultipleItemsFoundCollectionError} {@link MultipleItemsFoundCollectionError}
|
|
1427
1427
|
*/
|
|
1428
|
-
sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>):
|
|
1428
|
+
sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
|
|
1429
1429
|
/**
|
|
1430
1430
|
* The <i>nth</i> method creates a new collection consisting of every n-th item.
|
|
1431
1431
|
* @example
|
|
@@ -1450,22 +1450,22 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1450
1450
|
* ```
|
|
1451
1451
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1452
1452
|
*/
|
|
1453
|
-
count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1453
|
+
count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
1454
1454
|
/**
|
|
1455
1455
|
* The <i>size</i> returns the size of the collection.
|
|
1456
1456
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1457
1457
|
*/
|
|
1458
|
-
size():
|
|
1458
|
+
size(): LazyPromise<number>;
|
|
1459
1459
|
/**
|
|
1460
1460
|
* The <i>isEmpty</i> returns true if the collection is empty.
|
|
1461
1461
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1462
1462
|
*/
|
|
1463
|
-
isEmpty():
|
|
1463
|
+
isEmpty(): LazyPromise<boolean>;
|
|
1464
1464
|
/**
|
|
1465
1465
|
* The <i>isNotEmpty</i> returns true if the collection is not empty.
|
|
1466
1466
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1467
1467
|
*/
|
|
1468
|
-
isNotEmpty():
|
|
1468
|
+
isNotEmpty(): LazyPromise<boolean>;
|
|
1469
1469
|
/**
|
|
1470
1470
|
* The <i>searchFirst</i> return the index of the first item that matches <i>predicateFn</i>.
|
|
1471
1471
|
* @example
|
|
@@ -1478,7 +1478,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1478
1478
|
* ```
|
|
1479
1479
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1480
1480
|
*/
|
|
1481
|
-
searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1481
|
+
searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
1482
1482
|
/**
|
|
1483
1483
|
* The <i>searchLast</i> return the index of the last item that matches <i>predicateFn</i>.
|
|
1484
1484
|
* @example
|
|
@@ -1491,17 +1491,17 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
|
|
|
1491
1491
|
* ```
|
|
1492
1492
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1493
1493
|
*/
|
|
1494
|
-
searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>):
|
|
1494
|
+
searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
|
|
1495
1495
|
/**
|
|
1496
1496
|
* The <i>forEach</i> method iterates through all items in the collection.
|
|
1497
1497
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1498
1498
|
*/
|
|
1499
|
-
forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>):
|
|
1499
|
+
forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>): LazyPromise<void>;
|
|
1500
1500
|
/**
|
|
1501
1501
|
* The <i>toArray</i> method converts the collection to a new array.
|
|
1502
1502
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
1503
1503
|
*/
|
|
1504
|
-
toArray():
|
|
1504
|
+
toArray(): LazyPromise<TInput[]>;
|
|
1505
1505
|
/**
|
|
1506
1506
|
* The <i>delay</i> method will add delay between each iteration.
|
|
1507
1507
|
* This method is especially useful for situations where you may be interacting with external APIs that rate limit incoming requests:
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module EventBus
|
|
3
3
|
*/
|
|
4
|
+
import type { LazyPromise } from "../../_module";
|
|
4
5
|
import type { OneOrMore } from "../../_shared/types";
|
|
5
6
|
import type { IBaseEvent, Listener } from "../../event-bus/contracts/_shared";
|
|
6
7
|
export type SelectEvent<TEvents extends IBaseEvent, TEventType extends TEvents["type"]> = Extract<TEvents, {
|
|
7
8
|
type: IBaseEvent extends TEvents ? string : TEventType;
|
|
8
9
|
}>;
|
|
9
|
-
export type Unsubscribe = () =>
|
|
10
|
+
export type Unsubscribe = () => LazyPromise<void>;
|
|
10
11
|
/**
|
|
11
12
|
* The <i>IListenable</i> contract defines a way listening to events independent of underlying technology
|
|
12
13
|
* @group Contracts
|
|
@@ -17,35 +18,35 @@ export type IListenable<TEvents extends IBaseEvent = IBaseEvent> = {
|
|
|
17
18
|
* A listener can only be added once for a specific event. Adding the same listener multiple times will have no effect and nothing will occur.
|
|
18
19
|
* @throws {AddListenerEventBusError} {@link AddListenerEventBusError}
|
|
19
20
|
*/
|
|
20
|
-
addListener<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
21
|
+
addListener<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
21
22
|
/**
|
|
22
23
|
* The <i>addListenerMany</i> method is used for adding multiple <i>{@link Listener | listeners}</i> for certain <i>events</i>.
|
|
23
24
|
* A listener can only be added once for a specific event. Adding the same listener multiple times will have no effect and nothing will occur.
|
|
24
25
|
* @throws {AddListenerEventBusError} {@link AddListenerEventBusError}
|
|
25
26
|
*/
|
|
26
|
-
addListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
27
|
+
addListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
27
28
|
/**
|
|
28
29
|
* The <i>removeListener</i> method is used for removing <i>{@link Listener | listener}</i> for certain <i>event</i>.
|
|
29
30
|
* Removing unadded listener will have no effect and nothing will occur.
|
|
30
31
|
* @throws {RemoveListenerEventBusError} {@link RemoveListenerEventBusError}
|
|
31
32
|
*/
|
|
32
|
-
removeListener<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
33
|
+
removeListener<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
33
34
|
/**
|
|
34
35
|
* The <i>removeListener</i> method is used for removing multiple <i>{@link Listener | listeners}</i> for certain <i>event</i>.
|
|
35
36
|
* Removing unadded listener will have no effect and nothing will occur.
|
|
36
37
|
* @throws {RemoveListenerEventBusError} {@link RemoveListenerEventBusError}
|
|
37
38
|
*/
|
|
38
|
-
removeListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
39
|
+
removeListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
39
40
|
/**
|
|
40
41
|
* The <i>subscribe</i> method is used for adding <i>{@link Listener | listener}</i> for certain <i>event</i>.
|
|
41
42
|
* A listener can only be added once for a specific event. Adding the same listener multiple times will have no effect and nothing will occur.
|
|
42
43
|
*/
|
|
43
|
-
subscribe<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
44
|
+
subscribe<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<Unsubscribe>;
|
|
44
45
|
/**
|
|
45
46
|
* The <i>subscribeMany</i> method is used for adding <i>{@link Listener | listener}</i> for multiple <i>events</i>.
|
|
46
47
|
* A listener can only be added once for a specific event. Adding the same listener multiple times will have no effect and nothing will occur.
|
|
47
48
|
*/
|
|
48
|
-
subscribeMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
49
|
+
subscribeMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<Unsubscribe>;
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
51
52
|
* The <i>IEventBus</i> contract defines a way for dispatching and listening to events independent of underlying technology.
|
|
@@ -58,7 +59,7 @@ export type IEventBus<TEvents extends IBaseEvent = IBaseEvent> = IListenable<TEv
|
|
|
58
59
|
|
|
59
60
|
* @throws {DispatchEventBusError} {@link DispatchEventBusError}
|
|
60
61
|
*/
|
|
61
|
-
dispatch(events: OneOrMore<TEvents>):
|
|
62
|
+
dispatch(events: OneOrMore<TEvents>): LazyPromise<void>;
|
|
62
63
|
/**
|
|
63
64
|
* The <i>getNamespace</i> method return the complete namespace.
|
|
64
65
|
* @example
|
|
@@ -96,7 +96,7 @@ export declare class EventBus<TEvents extends IBaseEvent = IBaseEvent> implement
|
|
|
96
96
|
addListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
97
97
|
removeListener<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
98
98
|
removeListenerMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<void>;
|
|
99
|
-
subscribe<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
100
|
-
subscribeMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>):
|
|
99
|
+
subscribe<TEventType extends TEvents["type"]>(event: TEventType, listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<Unsubscribe>;
|
|
100
|
+
subscribeMany<TEventType extends TEvents["type"]>(events: TEventType[], listener: Listener<SelectEvent<TEvents, TEventType>>): LazyPromise<Unsubscribe>;
|
|
101
101
|
dispatch(events: OneOrMore<TEvents>): LazyPromise<void>;
|
|
102
102
|
}
|
|
@@ -26,9 +26,9 @@ export type ISerializer<TSerialized = unknown> = {
|
|
|
26
26
|
/**
|
|
27
27
|
* @throws {SerializationError} {@link SerializationError}
|
|
28
28
|
*/
|
|
29
|
-
serialize<TValue>(value: TValue):
|
|
29
|
+
serialize<TValue>(value: TValue): PromiseLike<TSerialized>;
|
|
30
30
|
/**
|
|
31
31
|
* @throws {DeserializationError} {@link DeserializationError}
|
|
32
32
|
*/
|
|
33
|
-
deserialize<TValue>(value: TSerialized):
|
|
33
|
+
deserialize<TValue>(value: TSerialized): PromiseLike<TValue>;
|
|
34
34
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
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
|
+
import type { LazyPromise } from "../../_module";
|
|
7
8
|
export type StorageValue<T> = Exclude<T, AnyFunction | undefined | null>;
|
|
8
9
|
/**
|
|
9
10
|
* The <i>IStorageListenable</i> contract defines a way for listening <i>{@link IStorage}</i> crud operations.
|
|
@@ -19,98 +20,98 @@ export type IStorage<TType = unknown> = IStorageListenable & {
|
|
|
19
20
|
* The <i>exists</i> method returns true when <i>key</i> is found otherwise false will be returned.
|
|
20
21
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
21
22
|
*/
|
|
22
|
-
exists(key: string):
|
|
23
|
+
exists(key: string): LazyPromise<boolean>;
|
|
23
24
|
/**
|
|
24
25
|
* The <i>existsMany</i> method returns true for the <i>keys</i> that are found otherwise false will be returned.
|
|
25
26
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
26
27
|
*/
|
|
27
|
-
existsMany<TKeys extends string>(keys: TKeys[]):
|
|
28
|
+
existsMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
28
29
|
/**
|
|
29
30
|
* The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
|
|
30
31
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
31
32
|
*/
|
|
32
|
-
missing(key: string):
|
|
33
|
+
missing(key: string): LazyPromise<boolean>;
|
|
33
34
|
/**
|
|
34
35
|
* The <i>missingMany</i> method returns true for the <i>keys</i> that are not found otherwise false will be returned.
|
|
35
36
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
36
37
|
*/
|
|
37
|
-
missingMany<TKeys extends string>(keys: TKeys[]):
|
|
38
|
+
missingMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
38
39
|
/**
|
|
39
40
|
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
40
41
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
41
42
|
*/
|
|
42
|
-
get(key: string):
|
|
43
|
+
get(key: string): LazyPromise<TType | null>;
|
|
43
44
|
/**
|
|
44
45
|
* The <i>getMany</i> returns the value for the <i>keys</i> that are found otherwise null will be returned.
|
|
45
46
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
46
47
|
*/
|
|
47
|
-
getMany<TKeys extends string>(keys: TKeys[]):
|
|
48
|
+
getMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, TType | null>>;
|
|
48
49
|
/**
|
|
49
50
|
* The <i>getOr</i> method returns the value when <i>key</i> is found otherwise <i>defaultValue</i> will be returned.
|
|
50
51
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
51
52
|
*/
|
|
52
|
-
getOr(key: string, defaultValue: AsyncLazyable<TType>):
|
|
53
|
+
getOr(key: string, defaultValue: AsyncLazyable<TType>): LazyPromise<TType>;
|
|
53
54
|
/**
|
|
54
55
|
* The <i>getOrMany</i> method returns the value for the keys that are found otherwise defaultValue will be returned.
|
|
55
56
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
56
57
|
*/
|
|
57
|
-
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>):
|
|
58
|
+
getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): LazyPromise<Record<TKeys, TType>>;
|
|
58
59
|
/**
|
|
59
60
|
* The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
|
|
60
61
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
61
62
|
* @throws {KeyNotFoundStorageError} {@link KeyNotFoundStorageError}
|
|
62
63
|
*/
|
|
63
|
-
getOrFail(key: string):
|
|
64
|
+
getOrFail(key: string): LazyPromise<TType>;
|
|
64
65
|
/**
|
|
65
66
|
* 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.
|
|
66
67
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
67
68
|
*/
|
|
68
|
-
add(key: string, value: StorageValue<TType>):
|
|
69
|
+
add(key: string, value: StorageValue<TType>): LazyPromise<boolean>;
|
|
69
70
|
/**
|
|
70
71
|
* 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.
|
|
71
72
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
72
73
|
*/
|
|
73
|
-
addMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>):
|
|
74
|
+
addMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
|
|
74
75
|
/**
|
|
75
76
|
* 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.
|
|
76
77
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
77
78
|
*/
|
|
78
|
-
update(key: string, value: TType):
|
|
79
|
+
update(key: string, value: TType): LazyPromise<boolean>;
|
|
79
80
|
/**
|
|
80
81
|
* The <i>updateMany</i> method updates the given keys. Returns true for the keys that exists otherwise false will be returned.
|
|
81
82
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
82
83
|
*/
|
|
83
|
-
updateMany<TKeys extends string>(values: Record<TKeys, TType>):
|
|
84
|
+
updateMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
|
|
84
85
|
/**
|
|
85
86
|
* 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.
|
|
86
87
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
87
88
|
*/
|
|
88
|
-
put(key: string, value: StorageValue<TType>):
|
|
89
|
+
put(key: string, value: StorageValue<TType>): LazyPromise<boolean>;
|
|
89
90
|
/**
|
|
90
91
|
* 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.
|
|
91
92
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
92
93
|
*/
|
|
93
|
-
putMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>):
|
|
94
|
+
putMany<TKeys extends string>(values: Record<TKeys, StorageValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
|
|
94
95
|
/**
|
|
95
96
|
* The <i>remove</i> method removes the given <i>key</i> when found. Returns true if the key is found otherwise false is returned.
|
|
96
97
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
97
98
|
*/
|
|
98
|
-
remove(key: string):
|
|
99
|
+
remove(key: string): LazyPromise<boolean>;
|
|
99
100
|
/**
|
|
100
101
|
* The <i>removesMany</i> method removes the keys that are found. Returns true for the keys that are found otherwise false is returned.
|
|
101
102
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
102
103
|
*/
|
|
103
|
-
removeMany<TKeys extends string>(keys: TKeys[]):
|
|
104
|
+
removeMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
|
|
104
105
|
/**
|
|
105
106
|
* The <i>getAndRemove</i> method removes the given <i>key</i> and returns it when found otherwise null will be returned.
|
|
106
107
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
107
108
|
*/
|
|
108
|
-
getAndRemove(key: string):
|
|
109
|
+
getAndRemove(key: string): LazyPromise<TType | null>;
|
|
109
110
|
/**
|
|
110
111
|
* The <i>getOrAdd</i> method will retrieve the given <i>key</i> if found otherwise <i>valueToAdd</i> will be added and returned.
|
|
111
112
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
112
113
|
*/
|
|
113
|
-
getOrAdd(key: string, valueToAdd: AsyncLazyable<StorageValue<GetOrAddValue<TType>>>):
|
|
114
|
+
getOrAdd(key: string, valueToAdd: AsyncLazyable<StorageValue<GetOrAddValue<TType>>>): LazyPromise<TType>;
|
|
114
115
|
/**
|
|
115
116
|
* The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
|
|
116
117
|
* Returns true if key exists otherwise false will be returned.
|
|
@@ -118,7 +119,7 @@ export type IStorage<TType = unknown> = IStorageListenable & {
|
|
|
118
119
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
119
120
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
120
121
|
*/
|
|
121
|
-
increment(key: string, value?: Extract<TType, number>):
|
|
122
|
+
increment(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
122
123
|
/**
|
|
123
124
|
* The <i>decrement</i> method will decrement the given <i>key</i> if found otherwise nonthing will occur.
|
|
124
125
|
* Returns true if key exists otherwise false will be returned.
|
|
@@ -127,12 +128,12 @@ export type IStorage<TType = unknown> = IStorageListenable & {
|
|
|
127
128
|
* @throws {TypeStorageError} {@link TypeStorageError}
|
|
128
129
|
* An error will thrown if the key is not a number.
|
|
129
130
|
*/
|
|
130
|
-
decrement(key: string, value?: Extract<TType, number>):
|
|
131
|
+
decrement(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
131
132
|
/**
|
|
132
133
|
* The <i>clear</i> method removes all the keys in the storage.
|
|
133
134
|
* @throws {UnexpectedStorageError} {@link UnexpectedStorageError}
|
|
134
135
|
*/
|
|
135
|
-
clear():
|
|
136
|
+
clear(): LazyPromise<void>;
|
|
136
137
|
/**
|
|
137
138
|
* The <i>getNamespace</i> method return the complete namespace.
|
|
138
139
|
* @example
|
|
@@ -81,12 +81,12 @@ export declare class Storage<TType = unknown> implements INamespacedStorage<TTyp
|
|
|
81
81
|
private readonly validator;
|
|
82
82
|
private readonly eventBus;
|
|
83
83
|
constructor(storageAdapter: IStorageAdapter<any>, settings?: StorageSettings<TType>);
|
|
84
|
-
addListener<TEventType extends AllStorageEvents<TType>["type"]>(event: TEventType, listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>):
|
|
85
|
-
addListenerMany<TEventType extends AllStorageEvents<TType>["type"]>(events: TEventType[], listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>):
|
|
86
|
-
removeListener<TEventType extends AllStorageEvents<TType>["type"]>(event: TEventType, listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>):
|
|
87
|
-
removeListenerMany<TEventType extends AllStorageEvents<TType>["type"]>(events: TEventType[], listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>):
|
|
88
|
-
subscribe<TEventType extends AllStorageEvents<TType>["type"]>(event: TEventType, listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>):
|
|
89
|
-
subscribeMany<TEventType extends AllStorageEvents<TType>["type"]>(events: TEventType[], listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>):
|
|
84
|
+
addListener<TEventType extends AllStorageEvents<TType>["type"]>(event: TEventType, listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>): LazyPromise<void>;
|
|
85
|
+
addListenerMany<TEventType extends AllStorageEvents<TType>["type"]>(events: TEventType[], listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>): LazyPromise<void>;
|
|
86
|
+
removeListener<TEventType extends AllStorageEvents<TType>["type"]>(event: TEventType, listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>): LazyPromise<void>;
|
|
87
|
+
removeListenerMany<TEventType extends AllStorageEvents<TType>["type"]>(events: TEventType[], listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>): LazyPromise<void>;
|
|
88
|
+
subscribe<TEventType extends AllStorageEvents<TType>["type"]>(event: TEventType, listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>): LazyPromise<Unsubscribe>;
|
|
89
|
+
subscribeMany<TEventType extends AllStorageEvents<TType>["type"]>(events: TEventType[], listener: Listener<SelectEvent<AllStorageEvents<TType>, TEventType>>): LazyPromise<Unsubscribe>;
|
|
90
90
|
withNamespace(namespace: string): IStorage<TType>;
|
|
91
91
|
getNamespace(): string;
|
|
92
92
|
exists(key: string): LazyPromise<boolean>;
|