@daiso-tech/core 0.27.0 → 0.28.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 (83) hide show
  1. package/README.md +10 -10
  2. package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +57 -19
  3. package/dist/async/utilities/lazy-promise/lazy-promise.js +93 -52
  4. package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
  5. package/dist/async/utilities/retry/retry-or-fail.d.ts +2 -0
  6. package/dist/async/utilities/retry/retry-or-fail.js.map +1 -1
  7. package/dist/cache/contracts/cache.contract.d.ts +98 -14
  8. package/dist/cache/implementations/adapters/_module-exports.d.ts +1 -0
  9. package/dist/cache/implementations/adapters/_module-exports.js +1 -0
  10. package/dist/cache/implementations/adapters/_module-exports.js.map +1 -1
  11. package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.d.ts +1 -0
  12. package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js +2 -0
  13. package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +1 -0
  14. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +23 -0
  15. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +41 -0
  16. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -0
  17. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +2 -3
  18. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
  19. package/dist/cache/implementations/derivables/cache/cache.d.ts +250 -45
  20. package/dist/cache/implementations/derivables/cache/cache.js +256 -28
  21. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  22. package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +20 -17
  23. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +33 -19
  24. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
  25. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +4 -20
  26. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +7 -4
  27. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  28. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +1 -1
  29. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +1 -1
  30. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +21 -36
  31. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +24 -17
  32. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  33. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +57 -14
  34. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +61 -13
  35. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
  36. package/dist/lock/contracts/lock-provider.contract.d.ts +19 -5
  37. package/dist/lock/contracts/lock.contract.d.ts +37 -8
  38. package/dist/lock/implementations/adapters/_module-exports.d.ts +1 -0
  39. package/dist/lock/implementations/adapters/_module-exports.js +1 -0
  40. package/dist/lock/implementations/adapters/_module-exports.js.map +1 -1
  41. package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.d.ts +1 -0
  42. package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js +2 -0
  43. package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js.map +1 -0
  44. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +17 -0
  45. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +24 -0
  46. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -0
  47. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +2 -3
  48. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -1
  49. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +130 -62
  50. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +134 -44
  51. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  52. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +238 -0
  53. package/dist/lock/implementations/derivables/lock-provider/lock.js +258 -0
  54. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  55. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +75 -9
  56. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +85 -7
  57. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
  58. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +162 -8
  59. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  60. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +1 -0
  61. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +1 -0
  62. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js.map +1 -1
  63. package/dist/utilities/_module-exports.d.ts +1 -1
  64. package/dist/utilities/_module-exports.js +1 -1
  65. package/dist/utilities/_module-exports.js.map +1 -1
  66. package/dist/utilities/classes/key-prefixer/key-prefixer.js +1 -1
  67. package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
  68. package/dist/utilities/{_constants.d.ts → constants.d.ts} +0 -3
  69. package/dist/utilities/constants.js +5 -0
  70. package/dist/utilities/constants.js.map +1 -0
  71. package/dist/utilities/contracts/_module.d.ts +2 -1
  72. package/dist/utilities/contracts/_module.js +2 -1
  73. package/dist/utilities/contracts/_module.js.map +1 -1
  74. package/dist/utilities/contracts/sqlite-database.contract.d.ts +26 -0
  75. package/dist/utilities/contracts/sqlite-database.contract.js +5 -0
  76. package/dist/utilities/contracts/sqlite-database.contract.js.map +1 -0
  77. package/dist/utilities/functions.d.ts +4 -0
  78. package/dist/utilities/functions.js +10 -4
  79. package/dist/utilities/functions.js.map +1 -1
  80. package/dist/utilities/types.d.ts +4 -4
  81. package/package.json +1 -1
  82. package/dist/utilities/_constants.js +0 -8
  83. package/dist/utilities/_constants.js.map +0 -1
@@ -5,7 +5,7 @@ import { TimeSpan, type Factoryable, type IKeyPrefixer, type Items } from "../..
5
5
  import { type Invokable, type OneOrMore } from "../../../../utilities/_module-exports.js";
6
6
  import type { IDatabaseLockAdapter, LockEvents } from "../../../../lock/contracts/_module-exports.js";
7
7
  import { type ILock, type IGroupableLockProvider, type LockProviderCreateSettings, type ILockProvider, type ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
8
- import { LazyPromise, type BackoffPolicy, type RetryPolicy } from "../../../../async/_module-exports.js";
8
+ import { LazyPromise, type LazyPromiseSettingsBase } from "../../../../async/_module-exports.js";
9
9
  import type { EventClass, EventInstance, IGroupableEventBus, Unsubscribe } from "../../../../event-bus/contracts/_module-exports.js";
10
10
  import type { IFlexibleSerde } from "../../../../serde/contracts/_module-exports.js";
11
11
  /**
@@ -13,7 +13,7 @@ import type { IFlexibleSerde } from "../../../../serde/contracts/_module-exports
13
13
  * IMPORT_PATH: ```"@daiso-tech/core/lock"```
14
14
  * @group Derivables
15
15
  */
16
- export type LockProviderSettingsBase = {
16
+ export type LockProviderSettingsBase = LazyPromiseSettingsBase & {
17
17
  keyPrefixer: IKeyPrefixer;
18
18
  serde: OneOrMore<IFlexibleSerde>;
19
19
  /**
@@ -65,26 +65,6 @@ export type LockProviderSettingsBase = {
65
65
  * ```
66
66
  */
67
67
  defaultRefreshTime?: TimeSpan;
68
- /**
69
- * The default retry attempt to use in the returned <i>LazyPromise</i>.
70
- * @default {null}
71
- */
72
- retryAttempts?: number | null;
73
- /**
74
- * The default backof policy to use in the returned <i>LazyPromise</i>.
75
- * @default {null}
76
- */
77
- backoffPolicy?: BackoffPolicy | null;
78
- /**
79
- * The default retry policy to use in the returned <i>LazyPromise</i>.
80
- * @default {null}
81
- */
82
- retryPolicy?: RetryPolicy | null;
83
- /**
84
- * The default timeout to use in the returned <i>LazyPromise</i>.
85
- * @default {null}
86
- */
87
- timeout?: TimeSpan | null;
88
68
  };
89
69
  /**
90
70
  *
@@ -121,7 +101,8 @@ export declare class LockProvider implements IGroupableLockProvider {
121
101
  private readonly retryAttempts;
122
102
  private readonly backoffPolicy;
123
103
  private readonly retryPolicy;
124
- private readonly timeout;
104
+ private readonly retryTimeout;
105
+ private readonly totalTimeout;
125
106
  private readonly keyPrefixer;
126
107
  private readonly createOwnerId;
127
108
  private readonly defaultTtl;
@@ -153,19 +134,26 @@ export declare class LockProvider implements IGroupableLockProvider {
153
134
  * @example
154
135
  * ```ts
155
136
  * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
137
+ * import type { ILockAdapter } from "@daiso-tech/core/lock/contracts";
156
138
  * import { LockProvider } from "@daiso-tech/core/lock";
157
- * import { KeyPrefixer } from "@daiso-tech/core/utilities";
139
+ * import { KeyPrefixer, type ISqliteDatabase, type FactoryFn } from "@daiso-tech/core/utilities";
158
140
  *
159
- * const database = new Sqlite("local.db");
160
- * const lockAdapter = new SqliteLockAdapter({
161
- * database,
162
- * });
163
- * // You need initialize the adapter once before using it.
164
- * await lockAdapter.init();
141
+ * async function lockAdapterFactory(database: ISqliteDatabase): FactoryFn<string, ILockAdapter> {
142
+ * return async (prefix) => {
143
+ * const lockAdapter = new SqliteLockAdapter({
144
+ * database,
145
+ * tableName: `lock_${prefix}`,
146
+ * });
147
+ * // You need initialize the adapter once before using it.
148
+ * await lockAdapter.init();
149
+ * return lockAdapter;
150
+ * }
151
+ * }
165
152
  *
153
+ * const database = new Sqlite("local.db");
166
154
  * const lockProvider = new LockProvider({
167
155
  * keyPrefixer: new KeyPrefixer("lock"),
168
- * adapter: lockAdapter,
156
+ * adapter: lockAdapterFactory(database),
169
157
  * });
170
158
  * ```
171
159
  *
@@ -175,39 +163,12 @@ export declare class LockProvider implements IGroupableLockProvider {
175
163
  * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
176
164
  * import type { ILockAdapter } from "@daiso-tech/core/lock/contracts";
177
165
  * import { LockProvider } from "@daiso-tech/core/lock";
178
- * import { KeyPrefixer, type Promiseable } from "@daiso-tech/core/utilities";
179
- *
180
- * async function lockAdapterFactory(prefix: string): Promiseable<ILockAdapter> {
181
- * const database = new Sqlite("local.db");
182
- * const database = new Sqlite("local.db");
183
- * const lockAdapter = new SqliteLockAdapter({
184
- * database,
185
- * tableName: `lock_${prefix}`,
186
- * });
187
- * // You need initialize the adapter once before using it.
188
- * await lockAdapter.init();
189
- * return lockAdapter;
190
- * }
191
- *
192
- *
193
- * const lockProvider = new LockProvider({
194
- * keyPrefixer: new KeyPrefixer("lock"),
195
- * adapter: lockAdapterFactory,
196
- * });
197
- * ```
166
+ * import { KeyPrefixer, type ISqliteDatabase, type IFactoryObject, type Promiseable } from "@daiso-tech/core/utilities";
198
167
  *
199
- * You can pass factory function that will create an adapter for every group.
200
- * @example
201
- * ```ts
202
- * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
203
- * import type { ILockAdapter } from "@daiso-tech/core/lock/contracts";
204
- * import { LockProvider } from "@daiso-tech/core/lock";
205
- * import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/core/utilities";
168
+ * class LockAdapterFactory implements IFactoryObject<string, ILockAdapter> {
169
+ * constructor(private readonly database: ISqliteDatabase) {}
206
170
  *
207
- * class LockAdapterFactory implementations IFactoryObject<string, ILockAdapter> {
208
171
  * async use(prefix: string): Promiseable<ILockAdapter> {
209
- * const database = new Sqlite("local.db");
210
- * const database = new Sqlite("local.db");
211
172
  * const lockAdapter = new SqliteLockAdapter({
212
173
  * database,
213
174
  * tableName: `lock_${prefix}`,
@@ -218,23 +179,130 @@ export declare class LockProvider implements IGroupableLockProvider {
218
179
  * }
219
180
  * }
220
181
  *
182
+ * const database = new Sqlite("local.db");
221
183
  * const lockProvider = new LockProvider({
222
184
  * keyPrefixer: new KeyPrefixer("lock"),
223
- * adapter: new LockAdapterFactory(),
185
+ * adapter: new LockAdapterFactory(database),
224
186
  * });
225
187
  * ```
226
188
  */
227
189
  constructor(settings: LockProviderSettings);
190
+ /**
191
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
192
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
193
+ */
228
194
  addListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
195
+ /**
196
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
197
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
198
+ */
229
199
  addListenerMany<TEventClassArr extends EventClass<LockEvents>[]>(events: [...TEventClassArr], listener: Invokable<EventInstance<Items<TEventClassArr>>>): LazyPromise<void>;
200
+ /**
201
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
202
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
203
+ */
230
204
  removeListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
205
+ /**
206
+ * 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
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
208
+ */
231
209
  removeListenerMany<TEventClassArr extends EventClass<LockEvents>[]>(events: [...TEventClassArr], listener: Invokable<EventInstance<Items<TEventClassArr>>>): LazyPromise<void>;
210
+ /**
211
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
212
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
213
+ */
232
214
  listenOnce<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<void>;
215
+ /**
216
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
217
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
218
+ */
233
219
  asPromise<TEventClass extends EventClass<LockEvents>>(event: TEventClass): LazyPromise<EventInstance<TEventClass>>;
220
+ /**
221
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
222
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
223
+ */
234
224
  subscribe<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: Invokable<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
225
+ /**
226
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
227
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
228
+ */
235
229
  subscribeMany<TEventClassArr extends EventClass<LockEvents>[]>(events: [...TEventClassArr], listener: Invokable<EventInstance<Items<TEventClassArr>>>): LazyPromise<Unsubscribe>;
236
230
  private createLazyPromise;
231
+ /**
232
+ * @example
233
+ * ```ts
234
+ * import { LockProvider } from "@daiso-tech/core/lock";
235
+ * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
236
+ * import { KeyPrefixer, TimeSpan } from "@daiso-tech/core/utilities";
237
+ * import { Serde } from "@daiso-tech/core/adapter";
238
+ * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/adapter/adapters";
239
+ *
240
+ * const lockProvider = new LockProvider({
241
+ * adapter: new MemoryLockAdapter(),
242
+ * keyPrefixer: new KeyPrefixer("lock"),
243
+ * serde: new Serde(new SuperJsonSerdeAdapter())
244
+ * });
245
+ *
246
+ * const lock = lockProvider.create("a");
247
+ * ```
248
+ */
237
249
  create(key: OneOrMore<string>, settings?: LockProviderCreateSettings): ILock;
250
+ /**
251
+ * @example
252
+ * ```ts
253
+ * import { LockProvider } from "@daiso-tech/core/lock";
254
+ * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
255
+ * import { KeyPrefixer } from "@daiso-tech/core/utilities";
256
+ * import { Serde } from "@daiso-tech/core/adapter";
257
+ * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/adapter/adapters";
258
+ *
259
+ * const lockProvider = new LockProvider({
260
+ * adapter: new MemoryLockAdapter(),
261
+ * keyPrefixer: new KeyPrefixer("lock"),
262
+ * serde: new Serde(new SuperJsonSerdeAdapter())
263
+ * });
264
+ *
265
+ * // Will log null because the lockProvider is not in a group
266
+ * console.log(lockProvider.getGroup());
267
+ *
268
+ * const groupedLockProvider = lockProvider.withGroup("group-a");
269
+ *
270
+ * // Will log "group-a" because the groupedLockProvider is in a group
271
+ * console.log(groupedLockProvider.getGroup());
272
+ * ```
273
+ */
238
274
  getGroup(): string | null;
275
+ /**
276
+ * @example
277
+ * ```ts
278
+ * import { LockProvider } from "@daiso-tech/core/lock";
279
+ * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
280
+ * import { KeyPrefixer } from "@daiso-tech/core/utilities";
281
+ * import { Serde } from "@daiso-tech/core/adapter";
282
+ * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/adapter/adapters";
283
+ *
284
+ * const lockProvider = new LockProvider({
285
+ * adapter: new MemoryLockAdapter(),
286
+ * keyPrefixer: new KeyPrefixer("lock"),
287
+ * serde: new Serde(new SuperJsonSerdeAdapter())
288
+ * });
289
+ *
290
+ * const groupedLockProvider = lockProvider.withGroup("group-a");
291
+ *
292
+ * // Will log true because they are in different groups.
293
+ * console.log(
294
+ * await lockProvider
295
+ * .create("a")
296
+ * .acquire()
297
+ * );
298
+ *
299
+ * // Will log true because the lockProviders are in different groups.
300
+ * console.log(
301
+ * await groupedLockProvider
302
+ * .create("a")
303
+ * .acquire()
304
+ * );
305
+ * ```
306
+ */
239
307
  withGroup(group: OneOrMore<string>): ILockProvider;
240
308
  }
@@ -57,7 +57,8 @@ export class LockProvider {
57
57
  retryAttempts;
58
58
  backoffPolicy;
59
59
  retryPolicy;
60
- timeout;
60
+ retryTimeout;
61
+ totalTimeout;
61
62
  keyPrefixer;
62
63
  createOwnerId;
63
64
  defaultTtl;
@@ -89,61 +90,41 @@ export class LockProvider {
89
90
  * @example
90
91
  * ```ts
91
92
  * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
92
- * import { LockProvider } from "@daiso-tech/core/lock";
93
- * import { KeyPrefixer } from "@daiso-tech/core/utilities";
94
- *
95
- * const database = new Sqlite("local.db");
96
- * const lockAdapter = new SqliteLockAdapter({
97
- * database,
98
- * });
99
- * // You need initialize the adapter once before using it.
100
- * await lockAdapter.init();
101
- *
102
- * const lockProvider = new LockProvider({
103
- * keyPrefixer: new KeyPrefixer("lock"),
104
- * adapter: lockAdapter,
105
- * });
106
- * ```
107
- *
108
- * You can also pass factory object that implements <i>{@link IFactoryObject}</i> contract. This useful for depedency injection libraries.
109
- * @example
110
- * ```ts
111
- * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
112
93
  * import type { ILockAdapter } from "@daiso-tech/core/lock/contracts";
113
94
  * import { LockProvider } from "@daiso-tech/core/lock";
114
- * import { KeyPrefixer, type Promiseable } from "@daiso-tech/core/utilities";
95
+ * import { KeyPrefixer, type ISqliteDatabase, type FactoryFn } from "@daiso-tech/core/utilities";
115
96
  *
116
- * async function lockAdapterFactory(prefix: string): Promiseable<ILockAdapter> {
117
- * const database = new Sqlite("local.db");
118
- * const database = new Sqlite("local.db");
119
- * const lockAdapter = new SqliteLockAdapter({
120
- * database,
121
- * tableName: `lock_${prefix}`,
122
- * });
123
- * // You need initialize the adapter once before using it.
124
- * await lockAdapter.init();
125
- * return lockAdapter;
97
+ * async function lockAdapterFactory(database: ISqliteDatabase): FactoryFn<string, ILockAdapter> {
98
+ * return async (prefix) => {
99
+ * const lockAdapter = new SqliteLockAdapter({
100
+ * database,
101
+ * tableName: `lock_${prefix}`,
102
+ * });
103
+ * // You need initialize the adapter once before using it.
104
+ * await lockAdapter.init();
105
+ * return lockAdapter;
106
+ * }
126
107
  * }
127
108
  *
128
- *
109
+ * const database = new Sqlite("local.db");
129
110
  * const lockProvider = new LockProvider({
130
111
  * keyPrefixer: new KeyPrefixer("lock"),
131
- * adapter: lockAdapterFactory,
112
+ * adapter: lockAdapterFactory(database),
132
113
  * });
133
114
  * ```
134
115
  *
135
- * You can pass factory function that will create an adapter for every group.
116
+ * You can also pass factory object that implements <i>{@link IFactoryObject}</i> contract. This useful for depedency injection libraries.
136
117
  * @example
137
118
  * ```ts
138
119
  * import { SqliteLockAdapter } from "@daiso-tech/core/lock/adapters";
139
120
  * import type { ILockAdapter } from "@daiso-tech/core/lock/contracts";
140
121
  * import { LockProvider } from "@daiso-tech/core/lock";
141
- * import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/core/utilities";
122
+ * import { KeyPrefixer, type ISqliteDatabase, type IFactoryObject, type Promiseable } from "@daiso-tech/core/utilities";
123
+ *
124
+ * class LockAdapterFactory implements IFactoryObject<string, ILockAdapter> {
125
+ * constructor(private readonly database: ISqliteDatabase) {}
142
126
  *
143
- * class LockAdapterFactory implementations IFactoryObject<string, ILockAdapter> {
144
127
  * async use(prefix: string): Promiseable<ILockAdapter> {
145
- * const database = new Sqlite("local.db");
146
- * const database = new Sqlite("local.db");
147
128
  * const lockAdapter = new SqliteLockAdapter({
148
129
  * database,
149
130
  * tableName: `lock_${prefix}`,
@@ -154,9 +135,10 @@ export class LockProvider {
154
135
  * }
155
136
  * }
156
137
  *
138
+ * const database = new Sqlite("local.db");
157
139
  * const lockProvider = new LockProvider({
158
140
  * keyPrefixer: new KeyPrefixer("lock"),
159
- * adapter: new LockAdapterFactory(),
141
+ * adapter: new LockAdapterFactory(database),
160
142
  * });
161
143
  * ```
162
144
  */
@@ -164,7 +146,7 @@ export class LockProvider {
164
146
  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({
165
147
  keyPrefixer: new KeyPrefixer("events"),
166
148
  adapter: new MemoryEventBusAdapter(),
167
- }), retryAttempts = null, backoffPolicy = null, retryPolicy = null, timeout = null, } = settings;
149
+ }), retryAttempts = null, backoffPolicy = null, retryPolicy = null, retryTimeout = null, totalTimeout = null, } = settings;
168
150
  this.serde = serde;
169
151
  this.defaultBlockingInterval = defaultBlockingInterval;
170
152
  this.defaultBlockingTime = defaultBlockingTime;
@@ -177,7 +159,8 @@ export class LockProvider {
177
159
  this.retryAttempts = retryAttempts;
178
160
  this.backoffPolicy = backoffPolicy;
179
161
  this.retryPolicy = retryPolicy;
180
- this.timeout = timeout;
162
+ this.retryTimeout = retryTimeout;
163
+ this.totalTimeout = totalTimeout;
181
164
  this.eventBus = this.eventBus = this.groupableEventBus.withGroup(this.keyPrefixer.resolvedRootPrefix);
182
165
  if (this.keyPrefixer.resolvedGroup) {
183
166
  this.eventBus = this.groupableEventBus.withGroup([
@@ -196,27 +179,59 @@ export class LockProvider {
196
179
  groupableEventBus,
197
180
  }));
198
181
  }
182
+ /**
183
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
184
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
185
+ */
199
186
  addListener(event, listener) {
200
187
  return this.eventBus.addListener(event, listener);
201
188
  }
189
+ /**
190
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
191
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
192
+ */
202
193
  addListenerMany(events, listener) {
203
194
  return this.eventBus.addListenerMany(events, listener);
204
195
  }
196
+ /**
197
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
198
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
199
+ */
205
200
  removeListener(event, listener) {
206
201
  return this.eventBus.removeListener(event, listener);
207
202
  }
203
+ /**
204
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
205
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
206
+ */
208
207
  removeListenerMany(events, listener) {
209
208
  return this.eventBus.removeListenerMany(events, listener);
210
209
  }
210
+ /**
211
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
212
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
213
+ */
211
214
  listenOnce(event, listener) {
212
215
  return this.eventBus.listenOnce(event, listener);
213
216
  }
217
+ /**
218
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
219
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
220
+ */
214
221
  asPromise(event) {
215
222
  return this.eventBus.asPromise(event);
216
223
  }
224
+ /**
225
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
226
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
227
+ */
217
228
  subscribe(event, listener) {
218
229
  return this.eventBus.subscribe(event, listener);
219
230
  }
231
+ /**
232
+ * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
233
+ * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
234
+ */
220
235
  subscribeMany(events, listener) {
221
236
  return this.eventBus.subscribeMany(events, listener);
222
237
  }
@@ -225,9 +240,28 @@ export class LockProvider {
225
240
  retryAttempts: this.retryAttempts,
226
241
  backoffPolicy: this.backoffPolicy,
227
242
  retryPolicy: this.retryPolicy,
228
- timeout: this.timeout,
243
+ retryTimeout: this.retryTimeout,
244
+ totalTimeout: this.totalTimeout,
229
245
  });
230
246
  }
247
+ /**
248
+ * @example
249
+ * ```ts
250
+ * import { LockProvider } from "@daiso-tech/core/lock";
251
+ * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
252
+ * import { KeyPrefixer, TimeSpan } from "@daiso-tech/core/utilities";
253
+ * import { Serde } from "@daiso-tech/core/adapter";
254
+ * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/adapter/adapters";
255
+ *
256
+ * const lockProvider = new LockProvider({
257
+ * adapter: new MemoryLockAdapter(),
258
+ * keyPrefixer: new KeyPrefixer("lock"),
259
+ * serde: new Serde(new SuperJsonSerdeAdapter())
260
+ * });
261
+ *
262
+ * const lock = lockProvider.create("a");
263
+ * ```
264
+ */
231
265
  create(key, settings = {}) {
232
266
  const { ttl = this.defaultTtl, owner = this.createOwnerId() } = settings;
233
267
  const keyObj = this.keyPrefixer.create(key);
@@ -258,9 +292,65 @@ export class LockProvider {
258
292
  defaultRefreshTime: this.defaultRefreshTime,
259
293
  });
260
294
  }
295
+ /**
296
+ * @example
297
+ * ```ts
298
+ * import { LockProvider } from "@daiso-tech/core/lock";
299
+ * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
300
+ * import { KeyPrefixer } from "@daiso-tech/core/utilities";
301
+ * import { Serde } from "@daiso-tech/core/adapter";
302
+ * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/adapter/adapters";
303
+ *
304
+ * const lockProvider = new LockProvider({
305
+ * adapter: new MemoryLockAdapter(),
306
+ * keyPrefixer: new KeyPrefixer("lock"),
307
+ * serde: new Serde(new SuperJsonSerdeAdapter())
308
+ * });
309
+ *
310
+ * // Will log null because the lockProvider is not in a group
311
+ * console.log(lockProvider.getGroup());
312
+ *
313
+ * const groupedLockProvider = lockProvider.withGroup("group-a");
314
+ *
315
+ * // Will log "group-a" because the groupedLockProvider is in a group
316
+ * console.log(groupedLockProvider.getGroup());
317
+ * ```
318
+ */
261
319
  getGroup() {
262
320
  return this.keyPrefixer.resolvedGroup;
263
321
  }
322
+ /**
323
+ * @example
324
+ * ```ts
325
+ * import { LockProvider } from "@daiso-tech/core/lock";
326
+ * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
327
+ * import { KeyPrefixer } from "@daiso-tech/core/utilities";
328
+ * import { Serde } from "@daiso-tech/core/adapter";
329
+ * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/adapter/adapters";
330
+ *
331
+ * const lockProvider = new LockProvider({
332
+ * adapter: new MemoryLockAdapter(),
333
+ * keyPrefixer: new KeyPrefixer("lock"),
334
+ * serde: new Serde(new SuperJsonSerdeAdapter())
335
+ * });
336
+ *
337
+ * const groupedLockProvider = lockProvider.withGroup("group-a");
338
+ *
339
+ * // Will log true because they are in different groups.
340
+ * console.log(
341
+ * await lockProvider
342
+ * .create("a")
343
+ * .acquire()
344
+ * );
345
+ *
346
+ * // Will log true because the lockProviders are in different groups.
347
+ * console.log(
348
+ * await groupedLockProvider
349
+ * .create("a")
350
+ * .acquire()
351
+ * );
352
+ * ```
353
+ */
264
354
  withGroup(group) {
265
355
  return new LockProvider({
266
356
  adapter: this.adapterFactoryable,
@@ -275,7 +365,7 @@ export class LockProvider {
275
365
  retryAttempts: this.retryAttempts,
276
366
  backoffPolicy: this.backoffPolicy,
277
367
  retryPolicy: this.retryPolicy,
278
- timeout: this.timeout,
368
+ retryTimeout: this.retryTimeout,
279
369
  });
280
370
  }
281
371
  }
@@ -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,GAMX,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,WAAW,EACX,kBAAkB,GAGrB,MAAM,gCAAg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AuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;IAC1C,CAAC;IAED,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,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;SACxB,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,gBAAgB,EAChB,QAAQ,GAMX,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,WAAW,EACX,kBAAkB,GAGrB,MAAM,gCAAgC,CAAC;AAKxC,OAAO,EAMN,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,WAAW,GAId,MAAM,4BAA4B,CAAC;AAYpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6EAA6E,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0E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