@daiso-tech/core 0.25.0 → 0.26.1
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/async/utilities/lazy-promise/lazy-promise.d.ts +12 -3
- package/dist/async/utilities/lazy-promise/lazy-promise.js +36 -3
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +24 -24
- package/dist/cache/implementations/derivables/cache/cache.js +15 -15
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/event-bus/contracts/_shared.d.ts +0 -7
- package/dist/event-bus/contracts/_shared.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +6 -5
- package/dist/event-bus/contracts/event-bus.contract.d.ts +8 -23
- package/dist/event-bus/contracts/event-bus.contract.js +0 -1
- package/dist/event-bus/contracts/event-bus.contract.js.map +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +4 -3
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +4 -3
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +4 -3
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +1 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +13 -13
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +5 -5
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +30 -30
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.d.ts +9 -0
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +21 -0
- package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -0
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +23 -24
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +16 -36
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +32 -32
- package/dist/lock/implementations/derivables/lock-provider/lock.js +23 -23
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +30 -30
- package/dist/utilities/{constants.js → _constants.js} +1 -1
- package/dist/utilities/_constants.js.map +1 -0
- package/dist/utilities/_module-exports.d.ts +1 -1
- package/dist/utilities/_module-exports.js +1 -1
- package/dist/utilities/_module-exports.js.map +1 -1
- package/dist/utilities/pipeline/_module.d.ts +1 -0
- package/dist/utilities/pipeline/_module.js +2 -0
- package/dist/utilities/pipeline/_module.js.map +1 -0
- package/dist/utilities/pipeline/pipeline.d.ts +45 -0
- package/dist/utilities/pipeline/pipeline.js +75 -0
- package/dist/utilities/pipeline/pipeline.js.map +1 -0
- package/dist/utilities/time-span/time-span.d.ts +3 -12
- package/dist/utilities/time-span/time-span.js +3 -6
- package/dist/utilities/time-span/time-span.js.map +1 -1
- package/dist/utilities/types.d.ts +19 -2
- package/package.json +1 -1
- package/dist/utilities/constants.js.map +0 -1
- /package/dist/utilities/{constants.d.ts → _constants.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Lock
|
|
3
3
|
*/
|
|
4
|
-
import { TimeSpan, type OneOrMore } from "../../../../utilities/_module-exports.js";
|
|
4
|
+
import { TimeSpan, type Invokable, type OneOrMore } from "../../../../utilities/_module-exports.js";
|
|
5
5
|
import type { IDatabaseLockAdapter, LockEvents } from "../../../../lock/contracts/_module-exports.js";
|
|
6
6
|
import { type ILock, type IGroupableLockProvider, type LockProviderCreateSettings, type ILockProvider, type ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
|
|
7
7
|
import type { BackoffPolicy, LazyPromise, RetryPolicy } from "../../../../async/_module-exports.js";
|
|
8
|
-
import type { EventClass, EventInstance, IGroupableEventBus,
|
|
8
|
+
import type { EventClass, EventInstance, IGroupableEventBus, Unsubscribe } from "../../../../event-bus/contracts/_module-exports.js";
|
|
9
9
|
import type { IFlexibleSerde } from "../../../../serde/contracts/_module-exports.js";
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
@@ -95,7 +95,6 @@ export type LockProviderSettings = {
|
|
|
95
95
|
export declare class LockProvider implements IGroupableLockProvider {
|
|
96
96
|
private static DEFAULT_TTL;
|
|
97
97
|
private static DEFAULT_REFRESH_TIME;
|
|
98
|
-
private static isDatabaseAdapter;
|
|
99
98
|
private readonly serde;
|
|
100
99
|
private readonly createOwnerId;
|
|
101
100
|
private readonly adapter;
|
|
@@ -146,7 +145,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
146
145
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
147
146
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
148
147
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
149
|
-
* import type {
|
|
148
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
150
149
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
151
150
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
152
151
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -164,7 +163,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
164
163
|
* eventBus,
|
|
165
164
|
* });
|
|
166
165
|
*
|
|
167
|
-
* const listener:
|
|
166
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
168
167
|
* console.log(event);
|
|
169
168
|
* }
|
|
170
169
|
* await lockProvider.addListener(KeyAcquiredLockEvent, listener);
|
|
@@ -172,7 +171,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
172
171
|
* await lockProvider.create("a").acquire();
|
|
173
172
|
* ```
|
|
174
173
|
*/
|
|
175
|
-
addListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener:
|
|
174
|
+
addListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
|
|
176
175
|
/**
|
|
177
176
|
* You can listen to different events of all locks created by <i>LockProvider</i> class instance.
|
|
178
177
|
*
|
|
@@ -183,7 +182,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
183
182
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
184
183
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
185
184
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
186
|
-
* import type {
|
|
185
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
187
186
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
188
187
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
189
188
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -201,7 +200,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
201
200
|
* eventBus,
|
|
202
201
|
* });
|
|
203
202
|
*
|
|
204
|
-
* const listener:
|
|
203
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
205
204
|
* console.log(event);
|
|
206
205
|
* }
|
|
207
206
|
* await lockProvider.addListenerMany([KeyAcquiredLockEvent], listener);
|
|
@@ -209,7 +208,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
209
208
|
* await lockProvider.create("a").acquire();
|
|
210
209
|
* ```
|
|
211
210
|
*/
|
|
212
|
-
addListenerMany<TEventClass extends EventClass<LockEvents>>(events: TEventClass[], listener:
|
|
211
|
+
addListenerMany<TEventClass extends EventClass<LockEvents>>(events: TEventClass[], listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
|
|
213
212
|
/**
|
|
214
213
|
* You can listen to different events of all locks created by <i>LockProvider</i> class instance.
|
|
215
214
|
*
|
|
@@ -220,7 +219,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
220
219
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
221
220
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
222
221
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
223
|
-
* import type {
|
|
222
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
224
223
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
225
224
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
226
225
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -238,7 +237,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
238
237
|
* eventBus,
|
|
239
238
|
* });
|
|
240
239
|
*
|
|
241
|
-
* const listener:
|
|
240
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
242
241
|
* console.log(event);
|
|
243
242
|
* }
|
|
244
243
|
* await lockProvider.addListener(KeyAcquiredLockEvent, listener);
|
|
@@ -246,7 +245,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
246
245
|
* await lockProvider.create("a").acquire();
|
|
247
246
|
* ```
|
|
248
247
|
*/
|
|
249
|
-
removeListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener:
|
|
248
|
+
removeListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
|
|
250
249
|
/**
|
|
251
250
|
* You can listen to different events of all locks created by <i>LockProvider</i> class instance.
|
|
252
251
|
*
|
|
@@ -257,7 +256,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
257
256
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
258
257
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
259
258
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
260
|
-
* import type {
|
|
259
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
261
260
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
262
261
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
263
262
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -275,7 +274,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
275
274
|
* eventBus,
|
|
276
275
|
* });
|
|
277
276
|
*
|
|
278
|
-
* const listener:
|
|
277
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
279
278
|
* console.log(event);
|
|
280
279
|
* }
|
|
281
280
|
* await lockProvider.addListenerMany(KeyAcquiredLockEvent, listener);
|
|
@@ -283,7 +282,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
283
282
|
* await lockProvider.create("a").acquire();
|
|
284
283
|
* ```
|
|
285
284
|
*/
|
|
286
|
-
removeListenerMany<TEventClass extends EventClass<LockEvents>>(events: TEventClass[], listener:
|
|
285
|
+
removeListenerMany<TEventClass extends EventClass<LockEvents>>(events: TEventClass[], listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
|
|
287
286
|
/**
|
|
288
287
|
* You can listen to different events of all locks created by <i>LockProvider</i> class instance.
|
|
289
288
|
*
|
|
@@ -294,7 +293,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
294
293
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
295
294
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
296
295
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
297
|
-
* import type {
|
|
296
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
298
297
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
299
298
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
300
299
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -312,14 +311,14 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
312
311
|
* eventBus,
|
|
313
312
|
* });
|
|
314
313
|
*
|
|
315
|
-
* const listener:
|
|
314
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
316
315
|
* console.log(event);
|
|
317
316
|
* }
|
|
318
317
|
* await lockProvider.listenOnce(KeyAcquiredLockEvent, listener);
|
|
319
318
|
* await lockProvider.create("a").acquire();
|
|
320
319
|
* ```
|
|
321
320
|
*/
|
|
322
|
-
listenOnce<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener:
|
|
321
|
+
listenOnce<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
|
|
323
322
|
asPromise<TEventClass extends EventClass<LockEvents>>(event: TEventClass): LazyPromise<EventInstance<TEventClass>>;
|
|
324
323
|
/**
|
|
325
324
|
* You can listen to different events of all locks created by <i>LockProvider</i> class instance.
|
|
@@ -331,7 +330,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
331
330
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
332
331
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
333
332
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
334
|
-
* import type {
|
|
333
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
335
334
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
336
335
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
337
336
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -349,7 +348,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
349
348
|
* eventBus,
|
|
350
349
|
* });
|
|
351
350
|
*
|
|
352
|
-
* const listener:
|
|
351
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
353
352
|
* console.log(event);
|
|
354
353
|
* }
|
|
355
354
|
* const unsubscribe = await lockProvider.subscribe(KeyAcquiredLockEvent, listener);
|
|
@@ -357,7 +356,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
357
356
|
* await unsubscribe();
|
|
358
357
|
* ```
|
|
359
358
|
*/
|
|
360
|
-
subscribe<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener:
|
|
359
|
+
subscribe<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
|
|
361
360
|
/**
|
|
362
361
|
* You can listen to different events of all locks created by <i>LockProvider</i> class instance.
|
|
363
362
|
*
|
|
@@ -368,7 +367,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
368
367
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
369
368
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
370
369
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
371
|
-
* import type {
|
|
370
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
372
371
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
373
372
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
374
373
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -386,7 +385,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
386
385
|
* eventBus,
|
|
387
386
|
* });
|
|
388
387
|
*
|
|
389
|
-
* const listener:
|
|
388
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
390
389
|
* console.log(event);
|
|
391
390
|
* }
|
|
392
391
|
* const unsubscribe = await lockProvider.subscribeMany([KeyAcquiredLockEvent], listener);
|
|
@@ -394,7 +393,7 @@ export declare class LockProvider implements IGroupableLockProvider {
|
|
|
394
393
|
* await unsubscribe();
|
|
395
394
|
* ```
|
|
396
395
|
*/
|
|
397
|
-
subscribeMany<TEventClass extends EventClass<LockEvents>>(events: TEventClass[], listener:
|
|
396
|
+
subscribeMany<TEventClass extends EventClass<LockEvents>>(events: TEventClass[], listener: Invokable<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
|
|
398
397
|
/**
|
|
399
398
|
* ```ts
|
|
400
399
|
* import type { IGroupableLockProvider } from "@daiso-tech/core/lock/contracts";
|
|
@@ -9,6 +9,7 @@ import { MemoryEventBusAdapter } from "../../../../event-bus/implementations/ada
|
|
|
9
9
|
import { v4 } from "uuid";
|
|
10
10
|
import { DatabaseLockAdapter } from "../../../../lock/implementations/derivables/lock-provider/database-lock-adapter.js";
|
|
11
11
|
import { LockSerdeTransformer } from "../../../../lock/implementations/derivables/lock-provider/lock-serde-transformer.js";
|
|
12
|
+
import { isDatabaseLockAdapter } from "../../../../lock/implementations/derivables/lock-provider/is-database-lock-adapter.js";
|
|
12
13
|
/**
|
|
13
14
|
* <i>LockProvider</i> class can be derived from any <i>{@link ILockAdapter}</i> or <i>{@link IDatabaseLockAdapter}</i>.
|
|
14
15
|
*
|
|
@@ -22,27 +23,6 @@ import { LockSerdeTransformer } from "../../../../lock/implementations/derivable
|
|
|
22
23
|
export class LockProvider {
|
|
23
24
|
static DEFAULT_TTL = TimeSpan.fromMinutes(5);
|
|
24
25
|
static DEFAULT_REFRESH_TIME = TimeSpan.fromMinutes(5);
|
|
25
|
-
static isDatabaseAdapter(adapter) {
|
|
26
|
-
const adapter_ = adapter;
|
|
27
|
-
return (typeof adapter_["init"] === "function" &&
|
|
28
|
-
adapter_["init"].length === 0 &&
|
|
29
|
-
typeof adapter_["deInit"] === "function" &&
|
|
30
|
-
adapter_["deInit"].length === 0 &&
|
|
31
|
-
typeof adapter_["insert"] === "function" &&
|
|
32
|
-
adapter_["insert"].length === 3 &&
|
|
33
|
-
typeof adapter_["update"] === "function" &&
|
|
34
|
-
adapter_["update"].length === 3 &&
|
|
35
|
-
typeof adapter_["remove"] === "function" &&
|
|
36
|
-
adapter_["remove"].length === 2 &&
|
|
37
|
-
typeof adapter_["refresh"] === "function" &&
|
|
38
|
-
adapter_["refresh"].length === 3 &&
|
|
39
|
-
typeof adapter_["find"] === "function" &&
|
|
40
|
-
adapter_["find"].length === 1 &&
|
|
41
|
-
typeof adapter_["getGroup"] === "function" &&
|
|
42
|
-
adapter_["getGroup"].length === 0 &&
|
|
43
|
-
typeof adapter_["withGroup"] === "function" &&
|
|
44
|
-
adapter_["withGroup"].length === 1);
|
|
45
|
-
}
|
|
46
26
|
serde;
|
|
47
27
|
createOwnerId;
|
|
48
28
|
adapter;
|
|
@@ -88,7 +68,7 @@ export class LockProvider {
|
|
|
88
68
|
}),
|
|
89
69
|
}), serde, } = settings;
|
|
90
70
|
this.createOwnerId = createOwnerId;
|
|
91
|
-
if (
|
|
71
|
+
if (isDatabaseLockAdapter(adapter)) {
|
|
92
72
|
this.adapter = new DatabaseLockAdapter(adapter);
|
|
93
73
|
}
|
|
94
74
|
else {
|
|
@@ -137,7 +117,7 @@ export class LockProvider {
|
|
|
137
117
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
138
118
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
139
119
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
140
|
-
* import type {
|
|
120
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
141
121
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
142
122
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
143
123
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -155,7 +135,7 @@ export class LockProvider {
|
|
|
155
135
|
* eventBus,
|
|
156
136
|
* });
|
|
157
137
|
*
|
|
158
|
-
* const listener:
|
|
138
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
159
139
|
* console.log(event);
|
|
160
140
|
* }
|
|
161
141
|
* await lockProvider.addListener(KeyAcquiredLockEvent, listener);
|
|
@@ -176,7 +156,7 @@ export class LockProvider {
|
|
|
176
156
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
177
157
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
178
158
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
179
|
-
* import type {
|
|
159
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
180
160
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
181
161
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
182
162
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -194,7 +174,7 @@ export class LockProvider {
|
|
|
194
174
|
* eventBus,
|
|
195
175
|
* });
|
|
196
176
|
*
|
|
197
|
-
* const listener:
|
|
177
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
198
178
|
* console.log(event);
|
|
199
179
|
* }
|
|
200
180
|
* await lockProvider.addListenerMany([KeyAcquiredLockEvent], listener);
|
|
@@ -215,7 +195,7 @@ export class LockProvider {
|
|
|
215
195
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
216
196
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
217
197
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
218
|
-
* import type {
|
|
198
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
219
199
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
220
200
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
221
201
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -233,7 +213,7 @@ export class LockProvider {
|
|
|
233
213
|
* eventBus,
|
|
234
214
|
* });
|
|
235
215
|
*
|
|
236
|
-
* const listener:
|
|
216
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
237
217
|
* console.log(event);
|
|
238
218
|
* }
|
|
239
219
|
* await lockProvider.addListener(KeyAcquiredLockEvent, listener);
|
|
@@ -254,7 +234,7 @@ export class LockProvider {
|
|
|
254
234
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
255
235
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
256
236
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
257
|
-
* import type {
|
|
237
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
258
238
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
259
239
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
260
240
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -272,7 +252,7 @@ export class LockProvider {
|
|
|
272
252
|
* eventBus,
|
|
273
253
|
* });
|
|
274
254
|
*
|
|
275
|
-
* const listener:
|
|
255
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
276
256
|
* console.log(event);
|
|
277
257
|
* }
|
|
278
258
|
* await lockProvider.addListenerMany(KeyAcquiredLockEvent, listener);
|
|
@@ -293,7 +273,7 @@ export class LockProvider {
|
|
|
293
273
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
294
274
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
295
275
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
296
|
-
* import type {
|
|
276
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
297
277
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
298
278
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
299
279
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -311,7 +291,7 @@ export class LockProvider {
|
|
|
311
291
|
* eventBus,
|
|
312
292
|
* });
|
|
313
293
|
*
|
|
314
|
-
* const listener:
|
|
294
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
315
295
|
* console.log(event);
|
|
316
296
|
* }
|
|
317
297
|
* await lockProvider.listenOnce(KeyAcquiredLockEvent, listener);
|
|
@@ -334,7 +314,7 @@ export class LockProvider {
|
|
|
334
314
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
335
315
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
336
316
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
337
|
-
* import type {
|
|
317
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
338
318
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
339
319
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
340
320
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -352,7 +332,7 @@ export class LockProvider {
|
|
|
352
332
|
* eventBus,
|
|
353
333
|
* });
|
|
354
334
|
*
|
|
355
|
-
* const listener:
|
|
335
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
356
336
|
* console.log(event);
|
|
357
337
|
* }
|
|
358
338
|
* const unsubscribe = await lockProvider.subscribe(KeyAcquiredLockEvent, listener);
|
|
@@ -373,7 +353,7 @@ export class LockProvider {
|
|
|
373
353
|
* import { type IGroupableLockProvider, type LockEvents, KeyAcquiredLockEvent } from "@daiso-tech/core/lock/contracts";
|
|
374
354
|
* import { LockProvider } from "@daiso-tech/core/lock/implementations/derivables";
|
|
375
355
|
* import { MemoryLockAdapter } from "@daiso-tech/core/lock/implementations/adapters";
|
|
376
|
-
* import type {
|
|
356
|
+
* import type { Invokable} from "@daiso-tech/core/event-bus/contracts";
|
|
377
357
|
* import { EventBus } from "@daiso-tech/core/event-bus/implementations/derivables";
|
|
378
358
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/implementations/adapters";
|
|
379
359
|
* import { Serde } from "@daiso-tech/core/serde/implementations/derivables";
|
|
@@ -391,7 +371,7 @@ export class LockProvider {
|
|
|
391
371
|
* eventBus,
|
|
392
372
|
* });
|
|
393
373
|
*
|
|
394
|
-
* const listener:
|
|
374
|
+
* const listener: Invokable<LockEvents> = event => {
|
|
395
375
|
* console.log(event);
|
|
396
376
|
* }
|
|
397
377
|
* const unsubscribe = await lockProvider.subscribeMany([KeyAcquiredLockEvent], listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock-provider.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/lock-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,IAAI,EACJ,mBAAmB,EACnB,QAAQ,
|
|
1
|
+
{"version":3,"file":"lock-provider.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/lock-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,IAAI,EACJ,mBAAmB,EACnB,QAAQ,GAGX,MAAM,gCAAgC,CAAC;AAKxC,OAAO,EAMN,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAU/E,OAAO,EAAE,QAAQ,EAAE,MAAM,2DAA2D,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0EAA0E,CAAC;AAE/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,2EAA2E,CAAC;AACjH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6EAA6E,CAAC;AAyFpH;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACb,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,oBAAoB,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAE7C,KAAK,CAA4B;IACjC,aAAa,CAAe;IAC5B,OAAO,CAAe;IACtB,UAAU,CAAW;IACrB,uBAAuB,CAAW;IAClC,mBAAmB,CAAW;IAC9B,kBAAkB,CAAW;IAC7B,aAAa,CAAgB;IAC7B,aAAa,CAAuB;IACpC,WAAW,CAAqB;IAChC,OAAO,CAAkB;IACzB,QAAQ,CAAiC;IACzC,oBAAoB,CAAwB;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