@daiso-tech/core 0.32.1 → 0.33.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.
Files changed (63) hide show
  1. package/dist/cache/contracts/cache-factory.contract.d.ts +3 -3
  2. package/dist/cache/contracts/cache.contract.d.ts +0 -22
  3. package/dist/cache/contracts/cache.errors.d.ts +1 -1
  4. package/dist/cache/contracts/cache.errors.js +1 -1
  5. package/dist/cache/contracts/cache.events.d.ts +2 -12
  6. package/dist/cache/contracts/cache.events.js +2 -1
  7. package/dist/cache/contracts/cache.events.js.map +1 -1
  8. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +0 -1
  9. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
  10. package/dist/cache/implementations/derivables/cache/cache.d.ts +9 -139
  11. package/dist/cache/implementations/derivables/cache/cache.js +28 -219
  12. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  13. package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +6 -6
  14. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
  15. package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +2 -2
  16. package/dist/cache/implementations/test-utilities/cache.test-suite.js +238 -432
  17. package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
  18. package/dist/event-bus/contracts/event-bus-factory.contract.d.ts +3 -3
  19. package/dist/event-bus/contracts/event-bus.contract.d.ts +2 -44
  20. package/dist/event-bus/contracts/event-bus.contract.js.map +1 -1
  21. package/dist/event-bus/contracts/event-bus.errors.d.ts +1 -1
  22. package/dist/event-bus/contracts/event-bus.errors.js +1 -1
  23. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +6 -77
  24. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +11 -131
  25. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  26. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +4 -4
  27. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
  28. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +2 -2
  29. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +690 -1431
  30. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
  31. package/dist/lock/contracts/lock-provider-factory.contract.d.ts +3 -3
  32. package/dist/lock/contracts/lock-provider.contract.d.ts +10 -20
  33. package/dist/lock/contracts/lock.contract.d.ts +1 -10
  34. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +12 -155
  35. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +31 -228
  36. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  37. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +5 -5
  38. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +7 -30
  39. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
  40. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +8 -58
  41. package/dist/lock/implementations/derivables/lock-provider/lock.js +33 -105
  42. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  43. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +9 -8
  44. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
  45. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +2 -2
  46. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +178 -659
  47. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  48. package/dist/utilities/classes/key-prefixer/_module.d.ts +0 -1
  49. package/dist/utilities/classes/key-prefixer/_module.js +0 -1
  50. package/dist/utilities/classes/key-prefixer/_module.js.map +1 -1
  51. package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +4 -31
  52. package/dist/utilities/classes/key-prefixer/key-prefixer.js +6 -66
  53. package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/async/utilities/lazy-promise/lazy-promise-event-bus.d.ts +0 -15
  56. package/dist/async/utilities/lazy-promise/lazy-promise-event-bus.js +0 -50
  57. package/dist/async/utilities/lazy-promise/lazy-promise-event-bus.js.map +0 -1
  58. package/dist/async/utilities/lazy-promise/lazy-promise-listener.contract.d.ts +0 -23
  59. package/dist/async/utilities/lazy-promise/lazy-promise-listener.contract.js +0 -44
  60. package/dist/async/utilities/lazy-promise/lazy-promise-listener.contract.js.map +0 -1
  61. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.d.ts +0 -28
  62. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js +0 -5
  63. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js.map +0 -1
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * @module Lock
3
3
  */
4
- import { resolveOneOrMore, TimeSpan, CORE, resolveAsyncFactoryable, resolveFactory, } from "../../../../utilities/_module-exports.js";
4
+ import { TimeSpan, CORE, resolveFactory, resolveOneOrMore, } from "../../../../utilities/_module-exports.js";
5
5
  import { KeyPrefixer } from "../../../../utilities/_module-exports.js";
6
6
  import {} from "../../../../lock/contracts/_module-exports.js";
7
7
  import { LazyPromise } from "../../../../async/_module-exports.js";
8
- import { isDatabaseLockAdapter } from "../../../../lock/implementations/derivables/lock-provider/is-database-lock-adapter.js";
9
- import { DatabaseLockAdapter } from "../../../../lock/implementations/derivables/lock-provider/database-lock-adapter.js";
10
8
  import { EventBus } from "../../../../event-bus/implementations/derivables/_module-exports.js";
11
9
  import { MemoryEventBusAdapter } from "../../../../event-bus/implementations/adapters/_module-exports.js";
12
10
  import { v4 } from "uuid";
13
11
  import { Lock } from "../../../../lock/implementations/derivables/lock-provider/lock.js";
14
12
  import { LockState, } from "../../../../lock/implementations/derivables/lock-provider/lock-state.js";
13
+ import { isDatabaseLockAdapter } from "../../../../lock/implementations/derivables/lock-provider/is-database-lock-adapter.js";
14
+ import { DatabaseLockAdapter } from "../../../../lock/implementations/derivables/lock-provider/database-lock-adapter.js";
15
15
  import { LockSerdeTransformer } from "../../../../lock/implementations/derivables/lock-provider/lock-serde-transformer.js";
16
16
  /**
17
17
  * <i>LockProvider</i> class can be derived from any <i>{@link ILockAdapter}</i> or <i>{@link IDatabaseLockAdapter}</i>.
@@ -24,37 +24,9 @@ import { LockSerdeTransformer } from "../../../../lock/implementations/derivable
24
24
  * @group Derivables
25
25
  */
26
26
  export class LockProvider {
27
- static resolveLockAdapter(adapter) {
28
- if (isDatabaseLockAdapter(adapter)) {
29
- return new DatabaseLockAdapter(adapter);
30
- }
31
- return adapter;
32
- }
33
- static async resolveLockAdapterFactoryable(factoryable, settings) {
34
- const { serdeTransformerName, serde, lockStore, keyPrefixer, createLazyPromise, defaultBlockingInterval, defaultBlockingTime, defaultRefreshTime, groupableEventBus, } = settings;
35
- const adapter = await resolveAsyncFactoryable(factoryable, keyPrefixer.keyPrefix);
36
- const resolvedAdapter = LockProvider.resolveLockAdapter(adapter);
37
- const transformer = new LockSerdeTransformer({
38
- keyPrefixer,
39
- adapter: resolvedAdapter,
40
- createLazyPromise,
41
- lockStore,
42
- defaultBlockingInterval,
43
- defaultBlockingTime,
44
- defaultRefreshTime,
45
- groupableEventBus,
46
- serdeTransformerName,
47
- });
48
- for (const serde_ of resolveOneOrMore(serde)) {
49
- serde_.registerCustom(transformer, CORE);
50
- }
51
- return resolvedAdapter;
52
- }
53
27
  lockStore = {};
54
- groupableEventBus;
55
28
  eventBus;
56
- adapterFactoryable;
57
- adapterPromise;
29
+ adapter;
58
30
  keyPrefixer;
59
31
  createOwnerId;
60
32
  defaultTtl;
@@ -63,6 +35,7 @@ export class LockProvider {
63
35
  defaultRefreshTime;
64
36
  serde;
65
37
  lazyPromiseFactory;
38
+ serdeTransformerName;
66
39
  /**
67
40
  * @example
68
41
  * ```ts
@@ -87,75 +60,9 @@ export class LockProvider {
87
60
  * adapter: lockAdapter,
88
61
  * });
89
62
  * ```
90
- *
91
- * You can pass factory function that will create an adapter for every group.
92
- * @example
93
- * ```ts
94
- * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
95
- * import type { IDatabaseLockAdapter } from "@daiso-tech/core/lock/contracts";
96
- * import { LockProvider } from "@daiso-tech/core/lock";
97
- * import { KeyPrefixer, type ISqliteDatabase, type AsyncFactoryFn } from "@daiso-tech/core/utilities";
98
- * import { Serde } from "@daiso-tech/core/serde";
99
- * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
100
- * import Sqlite from "better-sqlite3";
101
- *
102
- * function lockAdapterFactory(database: ISqliteDatabase): AsyncFactoryFn<string, IDatabaseLockAdapter> {
103
- * return async (prefix) => {
104
- * const lockAdapter = new SqliteLockAdapter({
105
- * database,
106
- * tableName: `lock_${prefix}`,
107
- * });
108
- * // You need initialize the adapter once before using it.
109
- * await lockAdapter.init();
110
- * return lockAdapter;
111
- * }
112
- * }
113
- *
114
- * const database = new Sqlite("local.db");
115
- * const serde = new Serde(new SuperJsonSerdeAdapter());
116
- * const lockProvider = new LockProvider({
117
- * keyPrefixer: new KeyPrefixer("lock"),
118
- * serde,
119
- * adapter: lockAdapterFactory(database),
120
- * });
121
- * ```
122
- *
123
- * You can also pass factory object that implements <i>{@link IFactoryObject}</i> contract. This useful for depedency injection libraries.
124
- * @example
125
- * ```ts
126
- * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
127
- * import type { IDatabaseLockAdapter } from "@daiso-tech/core/lock/contracts";
128
- * import { LockProvider } from "@daiso-tech/core/lock";
129
- * import { KeyPrefixer, type ISqliteDatabase, type IAsyncFactoryObject, type Promisable } from "@daiso-tech/core/utilities";
130
- * import { Serde } from "@daiso-tech/core/serde";
131
- * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
132
- * import Sqlite from "better-sqlite3";
133
- *
134
- * class LockAdapterFactory implements IAsyncFactoryObject<string, IDatabaseLockAdapter> {
135
- * constructor(private readonly database: ISqliteDatabase) {}
136
- *
137
- * async use(prefix: string): Promise<IDatabaseLockAdapter> {
138
- * const lockAdapter = new SqliteLockAdapter({
139
- * database,
140
- * tableName: `lock_${prefix}`,
141
- * });
142
- * // You need initialize the adapter once before using it.
143
- * await lockAdapter.init();
144
- * return lockAdapter;
145
- * }
146
- * }
147
- *
148
- * const database = new Sqlite("local.db");
149
- * const serde = new Serde(new SuperJsonSerdeAdapter())
150
- * const lockProvider = new LockProvider({
151
- * keyPrefixer: new KeyPrefixer("lock"),
152
- * serde,
153
- * adapter: new LockAdapterFactory(database),
154
- * });
155
- * ```
156
63
  */
157
64
  constructor(settings) {
158
- const { defaultTtl = TimeSpan.fromMinutes(5), defaultBlockingInterval = TimeSpan.fromSeconds(1), defaultBlockingTime = TimeSpan.fromMinutes(1), defaultRefreshTime = TimeSpan.fromMinutes(5), createOwnerId = () => v4(), serde, keyPrefixer, adapter, eventBus: groupableEventBus = new EventBus({
65
+ const { defaultTtl = TimeSpan.fromMinutes(5), defaultBlockingInterval = TimeSpan.fromSeconds(1), defaultBlockingTime = TimeSpan.fromMinutes(1), defaultRefreshTime = TimeSpan.fromMinutes(5), createOwnerId = () => v4(), serde, keyPrefixer, adapter, eventBus = new EventBus({
159
66
  keyPrefixer: new KeyPrefixer("events"),
160
67
  adapter: new MemoryEventBusAdapter(),
161
68
  }), serdeTransformerName = "", lazyPromiseFactory = (invokable) => new LazyPromise(invokable), } = settings;
@@ -165,28 +72,33 @@ export class LockProvider {
165
72
  this.defaultRefreshTime = defaultRefreshTime;
166
73
  this.createOwnerId = createOwnerId;
167
74
  this.keyPrefixer = keyPrefixer;
168
- this.groupableEventBus = groupableEventBus;
169
- this.adapterFactoryable = adapter;
170
75
  this.defaultTtl = defaultTtl;
171
- this.eventBus = this.eventBus = this.groupableEventBus.withGroup(this.keyPrefixer.resolvedRootPrefix);
76
+ this.eventBus = eventBus;
172
77
  this.lazyPromiseFactory = resolveFactory(lazyPromiseFactory);
173
- if (this.keyPrefixer.resolvedGroup) {
174
- this.eventBus = this.groupableEventBus.withGroup([
175
- this.keyPrefixer.resolvedRootPrefix,
176
- this.keyPrefixer.resolvedGroup,
177
- ]);
78
+ this.serdeTransformerName = serdeTransformerName;
79
+ if (isDatabaseLockAdapter(adapter)) {
80
+ this.adapter = new DatabaseLockAdapter(adapter);
178
81
  }
179
- this.adapterPromise = new LazyPromise(async () => LockProvider.resolveLockAdapterFactoryable(this.adapterFactoryable, {
180
- serde,
181
- lockStore: this.lockStore,
182
- keyPrefixer,
82
+ else {
83
+ this.adapter = adapter;
84
+ }
85
+ this.registerToSerde();
86
+ }
87
+ registerToSerde() {
88
+ const transformer = new LockSerdeTransformer({
89
+ adapter: this.adapter,
183
90
  createLazyPromise: this.createLazyPromise.bind(this),
184
- defaultBlockingInterval,
185
- defaultBlockingTime,
186
- defaultRefreshTime,
187
- groupableEventBus,
188
- serdeTransformerName,
189
- }));
91
+ defaultBlockingInterval: this.defaultBlockingInterval,
92
+ defaultBlockingTime: this.defaultBlockingTime,
93
+ defaultRefreshTime: this.defaultRefreshTime,
94
+ eventBus: this.eventBus,
95
+ keyPrefixer: this.keyPrefixer,
96
+ lockStore: this.lockStore,
97
+ serdeTransformerName: this.serdeTransformerName,
98
+ });
99
+ for (const serde of resolveOneOrMore(this.serde)) {
100
+ serde.registerCustom(transformer, CORE);
101
+ }
190
102
  }
191
103
  /**
192
104
  * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
@@ -195,13 +107,6 @@ export class LockProvider {
195
107
  addListener(event, listener) {
196
108
  return this.eventBus.addListener(event, listener);
197
109
  }
198
- /**
199
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
200
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
201
- */
202
- addListenerMany(events, listener) {
203
- return this.eventBus.addListenerMany(events, listener);
204
- }
205
110
  /**
206
111
  * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
207
112
  * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
@@ -209,13 +114,6 @@ export class LockProvider {
209
114
  removeListener(event, listener) {
210
115
  return this.eventBus.removeListener(event, listener);
211
116
  }
212
- /**
213
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
214
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
215
- */
216
- removeListenerMany(events, listener) {
217
- return this.eventBus.removeListenerMany(events, listener);
218
- }
219
117
  /**
220
118
  * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
221
119
  * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
@@ -244,13 +142,6 @@ export class LockProvider {
244
142
  subscribe(event, listener) {
245
143
  return this.eventBus.subscribe(event, listener);
246
144
  }
247
- /**
248
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
249
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
250
- */
251
- subscribeMany(events, listener) {
252
- return this.eventBus.subscribeMany(events, listener);
253
- }
254
145
  createLazyPromise(asyncFn) {
255
146
  return new LazyPromise(asyncFn);
256
147
  }
@@ -275,24 +166,11 @@ export class LockProvider {
275
166
  create(key, settings = {}) {
276
167
  const { ttl = this.defaultTtl, owner = this.createOwnerId() } = settings;
277
168
  const keyObj = this.keyPrefixer.create(key);
278
- let lockEventBus = this.groupableEventBus.withGroup([
279
- this.keyPrefixer.resolvedRootPrefix,
280
- keyObj.resolved,
281
- ]);
282
- if (this.keyPrefixer.resolvedGroup) {
283
- lockEventBus = this.groupableEventBus.withGroup([
284
- this.keyPrefixer.resolvedRootPrefix,
285
- this.keyPrefixer.resolvedGroup,
286
- keyObj.resolved,
287
- ]);
288
- }
289
169
  return new Lock({
290
- adapterPromise: this.adapterPromise,
291
- group: this.keyPrefixer.resolvedGroup,
170
+ adapter: this.adapter,
292
171
  createLazyPromise: this.createLazyPromise.bind(this),
293
172
  lockState: new LockState(this.lockStore, keyObj.prefixed),
294
- lockEventBus: lockEventBus,
295
- lockProviderEventDispatcher: this.eventBus,
173
+ eventDispatcher: this.eventBus,
296
174
  key: keyObj,
297
175
  owner,
298
176
  ttl,
@@ -302,80 +180,5 @@ export class LockProvider {
302
180
  defaultRefreshTime: this.defaultRefreshTime,
303
181
  });
304
182
  }
305
- /**
306
- * @example
307
- * ```ts
308
- * import { LockProvider } from "@daiso-tech/core/lock";
309
- * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
310
- * import { KeyPrefixer } from "@daiso-tech/core/utilities";
311
- * import { Serde } from "@daiso-tech/core/serde";
312
- * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
313
- *
314
- * const serde = new Serde(new SuperJsonSerdeAdapter());
315
- * const lockProvider = new LockProvider({
316
- * adapter: new MemoryLockAdapter(),
317
- * keyPrefixer: new KeyPrefixer("lock"),
318
- * serde,
319
- * });
320
- *
321
- * // Will log null because the lockProvider is not in a group
322
- * console.log(lockProvider.getGroup());
323
- *
324
- * const groupedLockProvider = lockProvider.withGroup("group-a");
325
- *
326
- * // Will log "group-a" because the groupedLockProvider is in a group
327
- * console.log(groupedLockProvider.getGroup());
328
- * ```
329
- */
330
- getGroup() {
331
- return this.keyPrefixer.resolvedGroup;
332
- }
333
- /**
334
- * @example
335
- * ```ts
336
- * import { LockProvider } from "@daiso-tech/core/lock";
337
- * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
338
- * import { KeyPrefixer } from "@daiso-tech/core/utilities";
339
- * import { Serde } from "@daiso-tech/core/serde";
340
- * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
341
- *
342
- * const serde = new Serde(new SuperJsonSerdeAdapter());
343
- * const lockProvider = new LockProvider({
344
- * adapter: new MemoryLockAdapter(),
345
- * keyPrefixer: new KeyPrefixer("lock"),
346
- * serde,
347
- * });
348
- *
349
- * const groupedLockProvider = lockProvider.withGroup("group-a");
350
- *
351
- * // Will log true because they are in different groups.
352
- * console.log(
353
- * await lockProvider
354
- * .create("a")
355
- * .acquire()
356
- * );
357
- *
358
- * // Will log true because the lockProviders are in different groups.
359
- * console.log(
360
- * await groupedLockProvider
361
- * .create("a")
362
- * .acquire()
363
- * );
364
- * ```
365
- */
366
- withGroup(group) {
367
- return new LockProvider({
368
- adapter: this.adapterFactoryable,
369
- keyPrefixer: this.keyPrefixer.withGroup(group),
370
- serde: this.serde,
371
- createOwnerId: this.createOwnerId,
372
- eventBus: this.groupableEventBus,
373
- defaultTtl: this.defaultTtl,
374
- defaultBlockingInterval: this.defaultBlockingInterval,
375
- defaultBlockingTime: this.defaultBlockingTime,
376
- defaultRefreshTime: this.defaultRefreshTime,
377
- lazyPromiseFactory: this.lazyPromiseFactory,
378
- });
379
- }
380
183
  }
381
184
  //# sourceMappingURL=lock-provider.js.map
@@ -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,gBAAgB,EAChB,QAAQ,EAMR,IAAI,EACJ,uBAAuB,EAIvB,cAAc,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAkB,MAAM,gCAAgC,CAAC;AAK7E,OAAO,EAMN,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAazD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6EAA6E,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0EAA0E,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,2DAA2D,CAAC;AACrF,OAAO,EAAE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;;;;;;;;;;;;;;;;;;OAgCG;IACH,SAAS,CAAC,KAAwB;QAC9B,OAAO,IAAI,YAAY,CAAC;YACpB,OAAO,EAAE,IAAI,CAAC,kBAAkB;YAChC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC;YAC9C,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,QAAQ,EAAE,IAAI,CAAC,iBAAiB;YAChC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;CACJ"}
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,QAAQ,EACR,IAAI,EAIJ,cAAc,EACd,gBAAgB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAkB,MAAM,gCAAgC,CAAC;AAK7E,OAAO,EAKN,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAYzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2DAA2D,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EACH,SAAS,GAEZ,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6EAA6E,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAAE,MAAM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AAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;YACzD,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,GAAG,EAAE,MAAM;YACX,KAAK;YACL,GAAG;YACH,cAAc,EAAE,IAAI;YACpB,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -6,21 +6,21 @@ import { Lock, type ISerializedLock } from "../../../../lock/implementations/der
6
6
  import type { OneOrMore } from "../../../../utilities/_module-exports.js";
7
7
  import type { ILockAdapter, LockEvents } from "../../../../lock/contracts/_module-exports.js";
8
8
  import { type ILockStore } from "../../../../lock/implementations/derivables/lock-provider/lock-state.js";
9
- import { TimeSpan, type IKeyPrefixer } from "../../../../utilities/_module-exports.js";
9
+ import { TimeSpan, type KeyPrefixer } from "../../../../utilities/_module-exports.js";
10
10
  import type { LazyPromise } from "../../../../async/_module-exports.js";
11
- import type { IGroupableEventBus } from "../../../../event-bus/contracts/_module-exports.js";
11
+ import type { IEventBus } from "../../../../event-bus/contracts/_module-exports.js";
12
12
  /**
13
13
  * @internal
14
14
  */
15
15
  export type LockSerdeTransformerSettings = {
16
16
  adapter: ILockAdapter;
17
17
  lockStore: ILockStore;
18
- keyPrefixer: IKeyPrefixer;
18
+ keyPrefixer: KeyPrefixer;
19
19
  createLazyPromise: <TValue = void>(asyncFn: () => PromiseLike<TValue>) => LazyPromise<TValue>;
20
20
  defaultBlockingInterval: TimeSpan;
21
21
  defaultBlockingTime: TimeSpan;
22
22
  defaultRefreshTime: TimeSpan;
23
- groupableEventBus: IGroupableEventBus<LockEvents>;
23
+ eventBus: IEventBus<LockEvents>;
24
24
  serdeTransformerName: string;
25
25
  };
26
26
  /**
@@ -34,7 +34,7 @@ export declare class LockSerdeTransformer implements ISerdeTransformer<Lock, ISe
34
34
  private readonly defaultBlockingInterval;
35
35
  private readonly defaultBlockingTime;
36
36
  private readonly defaultRefreshTime;
37
- private readonly groupableEventBus;
37
+ private readonly eventBus;
38
38
  private readonly serdeTransformerName;
39
39
  constructor(settings: LockSerdeTransformerSettings);
40
40
  get name(): OneOrMore<string>;
@@ -15,10 +15,10 @@ export class LockSerdeTransformer {
15
15
  defaultBlockingInterval;
16
16
  defaultBlockingTime;
17
17
  defaultRefreshTime;
18
- groupableEventBus;
18
+ eventBus;
19
19
  serdeTransformerName;
20
20
  constructor(settings) {
21
- const { adapter, lockStore, keyPrefixer, createLazyPromise, defaultBlockingInterval, defaultBlockingTime, defaultRefreshTime, groupableEventBus, serdeTransformerName, } = settings;
21
+ const { adapter, lockStore, keyPrefixer, createLazyPromise, defaultBlockingInterval, defaultBlockingTime, defaultRefreshTime, eventBus, serdeTransformerName, } = settings;
22
22
  this.serdeTransformerName = serdeTransformerName;
23
23
  this.adapter = adapter;
24
24
  this.lockStore = lockStore;
@@ -27,7 +27,7 @@ export class LockSerdeTransformer {
27
27
  this.defaultBlockingInterval = defaultBlockingInterval;
28
28
  this.defaultBlockingTime = defaultBlockingTime;
29
29
  this.defaultRefreshTime = defaultRefreshTime;
30
- this.groupableEventBus = groupableEventBus;
30
+ this.eventBus = eventBus;
31
31
  }
32
32
  get name() {
33
33
  return [
@@ -40,36 +40,13 @@ export class LockSerdeTransformer {
40
40
  return value instanceof Lock && getConstructorName(value) === Lock.name;
41
41
  }
42
42
  deserialize(serializedValue) {
43
- const { group, key, owner, ttlInMs, expirationInMs } = serializedValue;
44
- const isRoot = group === null;
45
- let keyPrefixer = this.keyPrefixer;
46
- if (!isRoot) {
47
- keyPrefixer = this.keyPrefixer.withGroup(group);
48
- }
49
- const keyObj = keyPrefixer.create(key);
50
- let lockEventBus = this.groupableEventBus.withGroup(keyPrefixer.resolvedRootPrefix);
51
- let lockProviderEventDispatcher = this.groupableEventBus.withGroup([
52
- keyPrefixer.resolvedRootPrefix,
53
- keyObj.resolved,
54
- ]);
55
- if (keyPrefixer.resolvedGroup) {
56
- lockEventBus = this.groupableEventBus.withGroup([
57
- keyPrefixer.resolvedRootPrefix,
58
- keyPrefixer.resolvedGroup,
59
- ]);
60
- lockProviderEventDispatcher = this.groupableEventBus.withGroup([
61
- keyPrefixer.resolvedRootPrefix,
62
- keyPrefixer.resolvedGroup,
63
- keyObj.resolved,
64
- ]);
65
- }
43
+ const { key, owner, ttlInMs, expirationInMs } = serializedValue;
44
+ const keyObj = this.keyPrefixer.create(key);
66
45
  return new Lock({
67
- group,
68
46
  createLazyPromise: this.createLazyPromise,
69
- adapterPromise: Promise.resolve(this.adapter),
47
+ adapter: this.adapter,
70
48
  lockState: new LockState(this.lockStore, keyObj.prefixed),
71
- lockEventBus,
72
- lockProviderEventDispatcher,
49
+ eventDispatcher: this.eventBus,
73
50
  key: keyObj,
74
51
  owner,
75
52
  ttl: ttlInMs ? TimeSpan.fromMilliseconds(ttlInMs) : null,
@@ -1 +1 @@
1
- {"version":3,"file":"lock-serde-transformer.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/lock-serde-transformer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACH,IAAI,GAEP,MAAM,yDAAyD,CAAC;AAMjE,OAAO,EACH,SAAS,GAEZ,MAAM,+DAA+D,CAAC;AACvE,OAAO,EACH,kBAAkB,EAClB,QAAQ,GAEX,MAAM,gCAAgC,CAAC;AAqBxC;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAGZ,OAAO,CAAe;IACtB,SAAS,CAAa;IACtB,WAAW,CAAe;IAC1B,iBAAiB,CAET;IACR,uBAAuB,CAAW;IAClC,mBAAmB,CAAW;IAC9B,kBAAkB,CAAW;IAC7B,iBAAiB,CAAiC;IAClD,oBAAoB,CAAS;IAE9C,YAAY,QAAsC;QAC9C,MAAM,EACF,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,uBAAu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AAY,IAAI,IAAI,kBAAkB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC;IAC5E,CAAC;IAED,WAAW,CAAC,eAAgC;QACxC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,eAAe,CAAC;QAChE,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAE5C,OAAO,IAAI,IAAI,CAAC;YACZ,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;YACzD,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,GAAG,EAAE,MAAM;YACX,KAAK;YACL,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;YACxD,cAAc;YACd,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;IAED,SAAS,CAAC,iBAAuB;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC7C,CAAC;CACJ"}
@@ -1,18 +1,17 @@
1
1
  /**
2
2
  * @module Lock
3
3
  */
4
- import type { Items, TimeSpan } from "../../../../utilities/_module-exports.js";
5
- import { type IKey, type AsyncLazy, type OneOrMore, type Result } from "../../../../utilities/_module-exports.js";
4
+ import type { TimeSpan } from "../../../../utilities/_module-exports.js";
5
+ import { type Key, type AsyncLazy, type OneOrMore, type Result } from "../../../../utilities/_module-exports.js";
6
6
  import { KeyAlreadyAcquiredLockError, type AquireBlockingSettings, type LockEvents } from "../../../../lock/contracts/_module-exports.js";
7
7
  import { type ILock, type ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
8
8
  import { LazyPromise } from "../../../../async/_module-exports.js";
9
- import type { EventClass, EventInstance, IEventBus, IEventDispatcher, Unsubscribe, EventListener } from "../../../../event-bus/contracts/_module-exports.js";
9
+ import type { IEventDispatcher } from "../../../../event-bus/contracts/_module-exports.js";
10
10
  import type { LockState } from "../../../../lock/implementations/derivables/lock-provider/lock-state.js";
11
11
  /**
12
12
  * @internal
13
13
  */
14
14
  export type ISerializedLock = {
15
- group: OneOrMore<string> | null;
16
15
  key: OneOrMore<string>;
17
16
  owner: string;
18
17
  ttlInMs: number | null;
@@ -22,13 +21,11 @@ export type ISerializedLock = {
22
21
  * @internal
23
22
  */
24
23
  export type LockSettings = {
25
- group: OneOrMore<string> | null;
26
24
  createLazyPromise: <TValue = void>(asyncFn: () => PromiseLike<TValue>) => LazyPromise<TValue>;
27
- adapterPromise: PromiseLike<ILockAdapter>;
25
+ adapter: ILockAdapter;
28
26
  lockState: LockState;
29
- lockEventBus: IEventBus<LockEvents>;
30
- lockProviderEventDispatcher: IEventDispatcher<LockEvents>;
31
- key: IKey;
27
+ eventDispatcher: IEventDispatcher<LockEvents>;
28
+ key: Key;
32
29
  owner: OneOrMore<string>;
33
30
  ttl: TimeSpan | null;
34
31
  expirationInMs: number | null;
@@ -46,66 +43,19 @@ export declare class Lock implements ILock {
46
43
  */
47
44
  static serialize(deserializedValue: Lock): ISerializedLock;
48
45
  private readonly createLazyPromise;
49
- private readonly adapterPromise;
46
+ private readonly adapter;
50
47
  private readonly lockState;
51
- private readonly lockEventBus;
52
- private readonly lockProviderEventDispatcher;
48
+ private readonly eventDispatcher;
53
49
  private readonly key;
54
50
  private readonly owner;
55
51
  private readonly ttl;
56
52
  private readonly defaultBlockingInterval;
57
53
  private readonly defaultBlockingTime;
58
54
  private readonly defaultRefreshTime;
59
- private readonly group;
60
55
  /**
61
56
  * @internal
62
57
  */
63
58
  constructor(settings: LockSettings);
64
- /**
65
- * You can listen to the following <i>{@link LockEvents}</i> of the <i>{@link Lock}</i> instance.
66
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
67
- */
68
- addListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
69
- /**
70
- * You can listen to the following <i>{@link LockEvents}</i> of the <i>{@link Lock}</i> instance.
71
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
72
- */
73
- addListenerMany<TEventClassArr extends EventClass<LockEvents>[]>(events: [...TEventClassArr], listener: EventListener<EventInstance<Items<TEventClassArr>>>): LazyPromise<void>;
74
- /**
75
- * You can listen to the following <i>{@link LockEvents}</i> of the <i>{@link Lock}</i> instance.
76
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
77
- */
78
- removeListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
79
- /**
80
- * You can listen to the following <i>{@link LockEvents}</i> of the <i>{@link Lock}</i> instance.
81
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
82
- */
83
- removeListenerMany<TEventClassArr extends EventClass<LockEvents>[]>(events: [...TEventClassArr], listener: EventListener<EventInstance<Items<TEventClassArr>>>): LazyPromise<void>;
84
- /**
85
- * You can listen to the following <i>{@link LockEvents}</i> of lock instance.
86
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
87
- */
88
- listenOnce<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
89
- /**
90
- * You can listen to the following <i>{@link LockEvents}</i> of lock instance.
91
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
92
- */
93
- asPromise<TEventClass extends EventClass<LockEvents>>(event: TEventClass): LazyPromise<EventInstance<TEventClass>>;
94
- /**
95
- * You can listen to the following <i>{@link LockEvents}</i> of lock instance.
96
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
97
- */
98
- subscribeOnce<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
99
- /**
100
- * You can listen to the following <i>{@link LockEvents}</i> of lock instance.
101
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
102
- */
103
- subscribe<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
104
- /**
105
- * You can listen to the following <i>{@link LockEvents}</i> of lock instance.
106
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
107
- */
108
- subscribeMany<TEventClassArr extends EventClass<LockEvents>[]>(events: [...TEventClassArr], listener: EventListener<EventInstance<Items<TEventClassArr>>>): LazyPromise<Unsubscribe>;
109
59
  run<TValue = void>(asyncFn: AsyncLazy<TValue>): LazyPromise<Result<TValue, KeyAlreadyAcquiredLockError>>;
110
60
  runOrFail<TValue = void>(asyncFn: AsyncLazy<TValue>): LazyPromise<TValue>;
111
61
  runBlocking<TValue = void>(asyncFn: AsyncLazy<TValue>, settings?: AquireBlockingSettings): LazyPromise<Result<TValue, KeyAlreadyAcquiredLockError>>;