@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
|
@@ -160,8 +160,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
160
160
|
await delay(TTL);
|
|
161
161
|
return "a";
|
|
162
162
|
}, {
|
|
163
|
-
time: TimeSpan.fromMilliseconds(
|
|
164
|
-
interval: TimeSpan.fromMilliseconds(
|
|
163
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
164
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
165
165
|
});
|
|
166
166
|
expect(result).toBe("a");
|
|
167
167
|
expect(error).toBeNull();
|
|
@@ -177,8 +177,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
177
177
|
await delay(TTL);
|
|
178
178
|
return "a";
|
|
179
179
|
}, {
|
|
180
|
-
time: TimeSpan.fromMilliseconds(
|
|
181
|
-
interval: TimeSpan.fromMilliseconds(
|
|
180
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
181
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
182
182
|
});
|
|
183
183
|
expect(result).toBeNull();
|
|
184
184
|
expect(error).toBeInstanceOf(KeyAlreadyAcquiredLockError);
|
|
@@ -193,8 +193,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
193
193
|
await delay(TTL);
|
|
194
194
|
return "a";
|
|
195
195
|
}), {
|
|
196
|
-
time: TimeSpan.fromMilliseconds(
|
|
197
|
-
interval: TimeSpan.fromMilliseconds(
|
|
196
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
197
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
198
198
|
});
|
|
199
199
|
expect(result).toBe("a");
|
|
200
200
|
expect(error).toBeNull();
|
|
@@ -293,8 +293,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
293
293
|
ttl,
|
|
294
294
|
});
|
|
295
295
|
const result = await lock.acquireBlocking({
|
|
296
|
-
time: TimeSpan.fromMilliseconds(
|
|
297
|
-
interval: TimeSpan.fromMilliseconds(
|
|
296
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
297
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
298
298
|
});
|
|
299
299
|
expect(result).toBe(true);
|
|
300
300
|
});
|
|
@@ -825,8 +825,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
825
825
|
await lock.runBlocking(async () => {
|
|
826
826
|
await delay(TTL);
|
|
827
827
|
}, {
|
|
828
|
-
time: TimeSpan.fromMilliseconds(
|
|
829
|
-
interval: TimeSpan.fromMilliseconds(
|
|
828
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
829
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
830
830
|
});
|
|
831
831
|
await delay(TTL);
|
|
832
832
|
expect(event_?.fields.key).toBe("a");
|
|
@@ -848,8 +848,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
848
848
|
await lock.runBlocking(async () => {
|
|
849
849
|
await delay(TTL);
|
|
850
850
|
}, {
|
|
851
|
-
time: TimeSpan.fromMilliseconds(
|
|
852
|
-
interval: TimeSpan.fromMilliseconds(
|
|
851
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
852
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
853
853
|
});
|
|
854
854
|
await delay(TTL);
|
|
855
855
|
expect(event_?.fields.key).toBe(key);
|
|
@@ -870,8 +870,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
870
870
|
await lock.runBlocking(async () => {
|
|
871
871
|
await delay(TTL);
|
|
872
872
|
}, {
|
|
873
|
-
time: TimeSpan.fromMilliseconds(
|
|
874
|
-
interval: TimeSpan.fromMilliseconds(
|
|
873
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
874
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
875
875
|
});
|
|
876
876
|
await delay(TTL);
|
|
877
877
|
expect(event_?.fields.key).toBe("a");
|
|
@@ -994,8 +994,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
994
994
|
event_ = event;
|
|
995
995
|
});
|
|
996
996
|
await lock.acquireBlocking({
|
|
997
|
-
time: TimeSpan.fromMilliseconds(
|
|
998
|
-
interval: TimeSpan.fromMilliseconds(
|
|
997
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
998
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
999
999
|
});
|
|
1000
1000
|
await delay(TTL);
|
|
1001
1001
|
expect(event_?.fields.key).toBe("a");
|
|
@@ -1011,15 +1011,15 @@ export function lockProviderTestSuite(settings) {
|
|
|
1011
1011
|
});
|
|
1012
1012
|
let event_ = null;
|
|
1013
1013
|
await lock.acquireBlocking({
|
|
1014
|
-
time: TimeSpan.fromMilliseconds(
|
|
1015
|
-
interval: TimeSpan.fromMilliseconds(
|
|
1014
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
1015
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
1016
1016
|
});
|
|
1017
1017
|
const unsubscribe = await lock.subscribe(KeyAlreadyAcquiredLockEvent, (event) => {
|
|
1018
1018
|
event_ = event;
|
|
1019
1019
|
});
|
|
1020
1020
|
await lock.acquireBlocking({
|
|
1021
|
-
time: TimeSpan.fromMilliseconds(
|
|
1022
|
-
interval: TimeSpan.fromMilliseconds(
|
|
1021
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
1022
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
1023
1023
|
});
|
|
1024
1024
|
await delay(TTL);
|
|
1025
1025
|
expect(event_?.fields.key).toBe("a");
|
|
@@ -1352,8 +1352,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
1352
1352
|
await lock.runBlocking(async () => {
|
|
1353
1353
|
await delay(TTL);
|
|
1354
1354
|
}, {
|
|
1355
|
-
time: TimeSpan.fromMilliseconds(
|
|
1356
|
-
interval: TimeSpan.fromMilliseconds(
|
|
1355
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
1356
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
1357
1357
|
});
|
|
1358
1358
|
await delay(TTL);
|
|
1359
1359
|
expect(event_?.fields.key).toBe("a");
|
|
@@ -1375,8 +1375,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
1375
1375
|
await lock.runBlocking(async () => {
|
|
1376
1376
|
await delay(TTL);
|
|
1377
1377
|
}, {
|
|
1378
|
-
time: TimeSpan.fromMilliseconds(
|
|
1379
|
-
interval: TimeSpan.fromMilliseconds(
|
|
1378
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
1379
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
1380
1380
|
});
|
|
1381
1381
|
await delay(TTL);
|
|
1382
1382
|
expect(event_?.fields.key).toBe(key);
|
|
@@ -1397,8 +1397,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
1397
1397
|
await lock.runBlocking(async () => {
|
|
1398
1398
|
await delay(TTL);
|
|
1399
1399
|
}, {
|
|
1400
|
-
time: TimeSpan.fromMilliseconds(
|
|
1401
|
-
interval: TimeSpan.fromMilliseconds(
|
|
1400
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
1401
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
1402
1402
|
});
|
|
1403
1403
|
await delay(TTL);
|
|
1404
1404
|
expect(event_?.fields.key).toBe("a");
|
|
@@ -1841,8 +1841,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
1841
1841
|
await delay(TTL);
|
|
1842
1842
|
return "a";
|
|
1843
1843
|
}, {
|
|
1844
|
-
time: TimeSpan.fromMilliseconds(
|
|
1845
|
-
interval: TimeSpan.fromMilliseconds(
|
|
1844
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
1845
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
1846
1846
|
});
|
|
1847
1847
|
const [[resultA, errorA], [resultB, errorB]] = await Promise.all([
|
|
1848
1848
|
promiseA,
|
|
@@ -1897,8 +1897,8 @@ export function lockProviderTestSuite(settings) {
|
|
|
1897
1897
|
owner: ownerA,
|
|
1898
1898
|
});
|
|
1899
1899
|
const resultA = await lockA.acquireBlocking({
|
|
1900
|
-
time: TimeSpan.fromMilliseconds(
|
|
1901
|
-
interval: TimeSpan.fromMilliseconds(
|
|
1900
|
+
time: TimeSpan.fromMilliseconds(5),
|
|
1901
|
+
interval: TimeSpan.fromMilliseconds(5),
|
|
1902
1902
|
});
|
|
1903
1903
|
const ownerB = "c";
|
|
1904
1904
|
const lockB = lockProviderB.create(key, {
|
|
@@ -0,0 +1 @@
|
|
|
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,7 +1,7 @@
|
|
|
1
1
|
export * from "../utilities/contracts/_module.js";
|
|
2
2
|
export * from "../utilities/kysely/_module.js";
|
|
3
3
|
export * from "../utilities/time-span/_module.js";
|
|
4
|
-
export * from "../utilities/
|
|
4
|
+
export * from "../utilities/_constants.js";
|
|
5
5
|
export * from "../utilities/errors.js";
|
|
6
6
|
export * from "../utilities/types.js";
|
|
7
7
|
export * from "../utilities/functions.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "../utilities/contracts/_module.js";
|
|
2
2
|
export * from "../utilities/kysely/_module.js";
|
|
3
3
|
export * from "../utilities/time-span/_module.js";
|
|
4
|
-
export * from "../utilities/
|
|
4
|
+
export * from "../utilities/_constants.js";
|
|
5
5
|
export * from "../utilities/errors.js";
|
|
6
6
|
export * from "../utilities/types.js";
|
|
7
7
|
export * from "../utilities/functions.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../src/utilities/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
|
1
|
+
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../src/utilities/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../utilities/pipeline/pipeline.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../src/utilities/pipeline/_module.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Utilities
|
|
3
|
+
*/
|
|
4
|
+
import { LazyPromise } from "../../async/_module-exports.js";
|
|
5
|
+
import type { AsyncLazyable, IInvokableObject, Invokable } from "../../utilities/types.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 declare class Pipeline<TInitial, TPrev = TInitial, TCurrent = TPrev> implements IInvokableObject<AsyncLazyable<TInitial>, TCurrent> {
|
|
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<TValue>(): Pipeline<TValue>;
|
|
40
|
+
private static execute;
|
|
41
|
+
private readonly pipes;
|
|
42
|
+
private constructor();
|
|
43
|
+
pipe<TInput extends TCurrent, TOutput>(pipe: Invokable<TInput, TOutput>): Pipeline<TInitial, TCurrent, TOutput>;
|
|
44
|
+
invoke(value: AsyncLazyable<TInitial>): LazyPromise<TCurrent>;
|
|
45
|
+
}
|
|
@@ -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
|
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AAoB,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
|
+
{"version":3,"file":"time-span.js","sourceRoot":"","sources":["../../../src/utilities/time-span/time-span.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;GAKG;AACH,MAAM,OAAO,QAAQ;IAUoB;IAT7B,MAAM,CAAC,oBAAoB,GAAG,IAAI,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K,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"}
|
|
File without changes
|