@daiso-tech/core 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +12 -3
- package/dist/async/utilities/lazy-promise/lazy-promise.js +37 -4
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/cache/contracts/cache.contract.d.ts +4 -4
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +4 -4
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +5 -5
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +70 -184
- package/dist/cache/implementations/derivables/cache/cache.js +68 -185
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +11 -15
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +0 -11
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +5 -5
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +5 -5
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.js +5 -5
- package/dist/collection/implementations/list-collection/list-collection.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 +21 -16
- 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 +3 -3
- 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 +3 -3
- 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 +64 -33
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +92 -33
- 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 +957 -201
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/contracts/lock-provider.contract.d.ts +2 -2
- package/dist/lock/contracts/lock.contract.d.ts +24 -6
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +2 -2
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +2 -2
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +90 -48
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +67 -43
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +4 -23
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +8 -2
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +744 -11
- package/dist/lock/implementations/derivables/lock-provider/lock.js +770 -3
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +36 -5
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +10 -4
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +1 -0
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +417 -0
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/implementations/derivables/serde.js +4 -4
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- 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/contracts/_module.d.ts +0 -1
- package/dist/utilities/contracts/_module.js +0 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/functions.d.ts +3 -7
- package/dist/utilities/functions.js +3 -10
- package/dist/utilities/functions.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/contracts/buildable.contract.d.ts +0 -11
- package/dist/utilities/contracts/buildable.contract.js +0 -5
- package/dist/utilities/contracts/buildable.contract.js.map +0 -1
- /package/dist/utilities/{constants.d.ts → _constants.d.ts} +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Utilities
|
|
3
|
+
*/
|
|
4
|
+
import { LazyPromise } from "../../async/_module-exports.js";
|
|
5
|
+
import { resolveAsyncLazyable } from "../../utilities/functions.js";
|
|
6
|
+
/**
|
|
7
|
+
* The <i>Pipeline</i> class provides a convenient way to pipe multiple functions and <i>{@link IInvokableObject}</i>,
|
|
8
|
+
* giving each functions and <i>{@link IInvokableObject}</i> the opportunity to inspect or modify the input.
|
|
9
|
+
* Pipeline class is immutable meaning you can extend it without causing problems.
|
|
10
|
+
*
|
|
11
|
+
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
12
|
+
*/
|
|
13
|
+
export class Pipeline {
|
|
14
|
+
/**
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { Pipeline, type IInvokableObject } from "@daiso-tech/core/utilities";
|
|
18
|
+
*
|
|
19
|
+
* const isEmpty = Pipeline
|
|
20
|
+
* // You must define the initial argument type
|
|
21
|
+
* .start<string>()
|
|
22
|
+
* // You can extract the function if you want.
|
|
23
|
+
* // You can also pass in an object that implements IInvokableObject contract
|
|
24
|
+
* .pipe(value => value.length)
|
|
25
|
+
* .pipe(value => value === 0);
|
|
26
|
+
*
|
|
27
|
+
* // You can extend the previous pipeline
|
|
28
|
+
* const isNotEmpty = isEmpty.pipe(isEmpty => !isEmpty);
|
|
29
|
+
*
|
|
30
|
+
* const result1 = await isEmpty.invoke("");
|
|
31
|
+
* // true
|
|
32
|
+
* console.log(result1);
|
|
33
|
+
*
|
|
34
|
+
* const result2 = await isNotEmpty.invoke("asdasd");
|
|
35
|
+
* // true
|
|
36
|
+
* console.log(result2);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
static start() {
|
|
40
|
+
return new Pipeline();
|
|
41
|
+
}
|
|
42
|
+
static async execute(value, pipe) {
|
|
43
|
+
if (typeof pipe === "function") {
|
|
44
|
+
return await pipe(value);
|
|
45
|
+
}
|
|
46
|
+
return pipe.invoke(value);
|
|
47
|
+
}
|
|
48
|
+
pipes = [];
|
|
49
|
+
constructor(pipe) {
|
|
50
|
+
if (pipe !== undefined) {
|
|
51
|
+
this.pipes = [...this.pipes, pipe];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
pipe(pipe) {
|
|
55
|
+
return new Pipeline(pipe);
|
|
56
|
+
}
|
|
57
|
+
invoke(value) {
|
|
58
|
+
return new LazyPromise(async () => {
|
|
59
|
+
const [pipe, ...pipes] = this.pipes;
|
|
60
|
+
const resolvedValue = await resolveAsyncLazyable(value);
|
|
61
|
+
if (pipe === undefined) {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
63
|
+
return resolvedValue;
|
|
64
|
+
}
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
66
|
+
let value_ = await Pipeline.execute(resolvedValue, pipe);
|
|
67
|
+
for (const pipe of pipes) {
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
69
|
+
value_ = await Pipeline.execute(value, pipe);
|
|
70
|
+
}
|
|
71
|
+
return value_;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/utilities/pipeline/pipeline.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAMzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,OAAO,QAAQ;IAGjB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,KAAK;QACR,OAAO,IAAI,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,OAAO,CACxB,KAAa,EACb,IAAgC;QAEhC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAEgB,KAAK,GAA0B,EAAE,CAAC;IAEnD,YAAoB,IAA0B;QAC1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IAED,IAAI,CACA,IAAgC;QAEhC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,KAA8B;QACjC,OAAO,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE;YAC9B,MAAM,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YACpC,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,KAAK,CAAC,CAAC;YACxD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrB,+DAA+D;gBAC/D,OAAO,aAAoB,CAAC;YAChC,CAAC;YACD,mEAAmE;YACnE,IAAI,MAAM,GAAa,MAAM,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YACnE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,mEAAmE;gBACnE,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -2,30 +2,21 @@
|
|
|
2
2
|
* @module Utilities
|
|
3
3
|
*/
|
|
4
4
|
import type { ISerializable } from "../../serde/contracts/_module-exports.js";
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
8
|
-
* @group Time utilities
|
|
9
|
-
*/
|
|
10
|
-
export type ISerializedTimeSpan = {
|
|
11
|
-
timeInMs: number;
|
|
12
|
-
};
|
|
13
5
|
/**
|
|
14
6
|
* The <i>TimeSpan</i> class is used for representing time interval that is the difference between two times measured in a number of days, hours, minutes, and seconds.
|
|
15
7
|
* <i>TimeSpan</i> cannot be negative.
|
|
16
8
|
*
|
|
17
9
|
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
18
|
-
* @group Time utilities
|
|
19
10
|
*/
|
|
20
|
-
export declare class TimeSpan implements ISerializable<
|
|
11
|
+
export declare class TimeSpan implements ISerializable<number> {
|
|
21
12
|
private readonly milliseconds;
|
|
22
13
|
private static secondInMilliseconds;
|
|
23
14
|
private static minuteInMilliseconds;
|
|
24
15
|
private static hourInMilliseconds;
|
|
25
16
|
private static dayInMilliseconds;
|
|
26
|
-
static deserialize(
|
|
17
|
+
static deserialize(timeInMs: number): TimeSpan;
|
|
27
18
|
private constructor();
|
|
28
|
-
serialize():
|
|
19
|
+
serialize(): number;
|
|
29
20
|
static fromMilliseconds(milliseconds: number): TimeSpan;
|
|
30
21
|
static fromSeconds(seconds: number): TimeSpan;
|
|
31
22
|
static fromMinutes(minutes: number): TimeSpan;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* <i>TimeSpan</i> cannot be negative.
|
|
7
7
|
*
|
|
8
8
|
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
9
|
-
* @group Time utilities
|
|
10
9
|
*/
|
|
11
10
|
export class TimeSpan {
|
|
12
11
|
milliseconds;
|
|
@@ -14,17 +13,15 @@ export class TimeSpan {
|
|
|
14
13
|
static minuteInMilliseconds = 60 * TimeSpan.secondInMilliseconds;
|
|
15
14
|
static hourInMilliseconds = 60 * TimeSpan.minuteInMilliseconds;
|
|
16
15
|
static dayInMilliseconds = 24 * TimeSpan.hourInMilliseconds;
|
|
17
|
-
static deserialize(
|
|
18
|
-
return new TimeSpan(
|
|
16
|
+
static deserialize(timeInMs) {
|
|
17
|
+
return new TimeSpan(timeInMs);
|
|
19
18
|
}
|
|
20
19
|
constructor(milliseconds = 0) {
|
|
21
20
|
this.milliseconds = milliseconds;
|
|
22
21
|
this.milliseconds = Math.max(0, this.milliseconds);
|
|
23
22
|
}
|
|
24
23
|
serialize() {
|
|
25
|
-
return
|
|
26
|
-
timeInMs: this.toMilliseconds(),
|
|
27
|
-
};
|
|
24
|
+
return this.toMilliseconds();
|
|
28
25
|
}
|
|
29
26
|
static fromMilliseconds(milliseconds) {
|
|
30
27
|
return new TimeSpan().addMilliseconds(milliseconds);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-span.js","sourceRoot":"","sources":["../../../src/utilities/time-span/time-span.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
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CAAC,CAAC;IACvE,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACtE,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE;QAC5B,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE;QAC5B,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/D,CAAC"}
|
|
@@ -21,7 +21,12 @@ export type Promisable<TValue> = TValue | PromiseLike<TValue>;
|
|
|
21
21
|
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
22
22
|
* @group Contracts
|
|
23
23
|
*/
|
|
24
|
-
export type
|
|
24
|
+
export type LazyPromiseable<TValue> = LazyPromise<TValue> | (() => Promisable<TValue>);
|
|
25
|
+
/**
|
|
26
|
+
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
27
|
+
* @group Contracts
|
|
28
|
+
*/
|
|
29
|
+
export type AsyncLazyable<TValue> = TValue | LazyPromiseable<TValue>;
|
|
25
30
|
/**
|
|
26
31
|
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
27
32
|
* @group Contracts
|
|
@@ -51,4 +56,16 @@ export type GetOrAddValue<TValue> = Awaited<TValue extends AnyFunction ? ReturnT
|
|
|
51
56
|
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
52
57
|
* @group Contracts
|
|
53
58
|
*/
|
|
54
|
-
export type
|
|
59
|
+
export type InvokableFn<TInput = unknown, TOutput = unknown> = (value: TInput) => Promisable<TOutput>;
|
|
60
|
+
/**
|
|
61
|
+
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
62
|
+
* @group Contracts
|
|
63
|
+
*/
|
|
64
|
+
export type IInvokableObject<TInput = unknown, TOutput = unknown> = {
|
|
65
|
+
invoke(value: TInput): Promisable<TOutput>;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* IMPORT_PATH: ```"@daiso-tech/core/utilities"```
|
|
69
|
+
* @group Contracts
|
|
70
|
+
*/
|
|
71
|
+
export type Invokable<TInput = unknown, TOutput = unknown> = InvokableFn<TInput, TOutput> | IInvokableObject<TInput, TOutput>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utilities/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildable.contract.js","sourceRoot":"","sources":["../../../src/utilities/contracts/buildable.contract.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
File without changes
|