@nlozgachev/pipelined 0.44.0 → 0.45.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 +7 -6
- package/dist/{InternalTypes-BL23H8Qr.d.mts → InternalTypes-CLE7qlOc.d.mts} +33 -28
- package/dist/{InternalTypes-7o9-yrHq.d.ts → InternalTypes-Mssktd7z.d.ts} +33 -28
- package/dist/{Validation-DM2eh6wj.d.ts → Validation-BMsvixWH.d.ts} +475 -443
- package/dist/{Validation-Dz70wtcG.d.mts → Validation-v38R0qH-.d.mts} +475 -443
- package/dist/{chunk-LKTOK5IT.mjs → chunk-2LKJF45J.mjs} +160 -68
- package/dist/{chunk-X6XQX3OZ.mjs → chunk-KOYYDQH4.mjs} +2 -2
- package/dist/{chunk-ND476266.mjs → chunk-VSU36S2K.mjs} +432 -309
- package/dist/{chunk-74JKKJ4R.mjs → chunk-XTVF5R6R.mjs} +8 -5
- package/dist/composition.d.mts +10 -10
- package/dist/composition.d.ts +10 -10
- package/dist/composition.js +9 -6
- package/dist/composition.mjs +2 -2
- package/dist/core.d.mts +453 -402
- package/dist/core.d.ts +453 -402
- package/dist/core.js +439 -313
- package/dist/core.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +599 -381
- package/dist/index.mjs +4 -4
- package/dist/types.d.mts +23 -21
- package/dist/types.d.ts +23 -21
- package/dist/types.js +8 -5
- package/dist/types.mjs +1 -1
- package/dist/utils.d.mts +466 -216
- package/dist/utils.d.ts +466 -216
- package/dist/utils.js +406 -238
- package/dist/utils.mjs +3 -3
- package/package.json +1 -1
|
@@ -14,11 +14,14 @@ var Duration;
|
|
|
14
14
|
Duration2.minutes = (m) => wrap(m * 60 * 1e3);
|
|
15
15
|
Duration2.hours = (h) => wrap(h * 60 * 60 * 1e3);
|
|
16
16
|
Duration2.days = (d) => wrap(d * 24 * 60 * 60 * 1e3);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
let to;
|
|
18
|
+
((to2) => {
|
|
19
|
+
to2.milliseconds = (d) => Brand.unwrap(d);
|
|
20
|
+
to2.seconds = (d) => Brand.unwrap(d) / 1e3;
|
|
21
|
+
to2.minutes = (d) => Brand.unwrap(d) / (60 * 1e3);
|
|
22
|
+
to2.hours = (d) => Brand.unwrap(d) / (60 * 60 * 1e3);
|
|
23
|
+
to2.days = (d) => Brand.unwrap(d) / (24 * 60 * 60 * 1e3);
|
|
24
|
+
})(to = Duration2.to || (Duration2.to = {}));
|
|
22
25
|
Duration2.add = (other) => (self) => wrap(Brand.unwrap(self) + Brand.unwrap(other));
|
|
23
26
|
Duration2.subtract = (other) => (self) => wrap(Brand.unwrap(self) - Brand.unwrap(other));
|
|
24
27
|
})(Duration || (Duration = {}));
|
package/dist/composition.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Awaitable, T as Thenable } from './InternalTypes-
|
|
1
|
+
import { A as Awaitable, T as Thenable } from './InternalTypes-CLE7qlOc.mjs';
|
|
2
2
|
import { Duration } from './types.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -110,13 +110,13 @@ declare const curry4: <A, B, C, D, E>(f: (a: A, b: B, c: C, d: D) => E) => (a: A
|
|
|
110
110
|
* ```ts
|
|
111
111
|
* // Original data-last (for pipe)
|
|
112
112
|
* pipe(
|
|
113
|
-
* Maybe.some(5),
|
|
113
|
+
* Maybe.make.some(5),
|
|
114
114
|
* Maybe.map(n => n * 2)
|
|
115
115
|
* ); // Some(10)
|
|
116
116
|
*
|
|
117
117
|
* // Flipped to data-first
|
|
118
118
|
* const mapFirst = flip(Maybe.map);
|
|
119
|
-
* mapFirst(Maybe.some(5))(n => n * 2); // Some(10)
|
|
119
|
+
* mapFirst(Maybe.make.some(5))(n => n * 2); // Some(10)
|
|
120
120
|
* ```
|
|
121
121
|
*
|
|
122
122
|
* @see {@link uncurry} for converting curried functions to multi-argument functions
|
|
@@ -265,7 +265,7 @@ interface flow {
|
|
|
265
265
|
* @example
|
|
266
266
|
* ```ts
|
|
267
267
|
* identity(42); // 42
|
|
268
|
-
* pipe(Maybe.some(5), Maybe.fold(() => 0, identity)); // 5
|
|
268
|
+
* pipe(Maybe.make.some(5), Maybe.fold(() => 0, identity)); // 5
|
|
269
269
|
* ```
|
|
270
270
|
*/
|
|
271
271
|
declare const identity: <A>(a: A) => A;
|
|
@@ -496,7 +496,7 @@ declare function async<A, B, C, D, E, F, G, H, I, J, K>(a: Awaitable<A>, ab: (a:
|
|
|
496
496
|
*
|
|
497
497
|
* // With library functions
|
|
498
498
|
* const greeting = pipe(
|
|
499
|
-
* Maybe.some("Alice"),
|
|
499
|
+
* Maybe.make.some("Alice"),
|
|
500
500
|
* Maybe.map(name => name.toUpperCase()),
|
|
501
501
|
* Maybe.map(name => `Hello, ${name}!`),
|
|
502
502
|
* Maybe.getOrElse(() => "Hello!")
|
|
@@ -599,7 +599,7 @@ interface pipe {
|
|
|
599
599
|
* ```ts
|
|
600
600
|
* // Debugging a pipeline
|
|
601
601
|
* pipe(
|
|
602
|
-
* Maybe.some(5),
|
|
602
|
+
* Maybe.make.some(5),
|
|
603
603
|
* tap(x => console.log("Before map:", x)),
|
|
604
604
|
* Maybe.map(n => n * 2),
|
|
605
605
|
* tap(x => console.log("After map:", x)),
|
|
@@ -739,7 +739,7 @@ declare namespace tap {
|
|
|
739
739
|
* pipe(
|
|
740
740
|
* data,
|
|
741
741
|
* tap.time(fetchData, {
|
|
742
|
-
* onFinish: (dur) => metrics.histogram("api.time", Duration.
|
|
742
|
+
* onFinish: (dur) => metrics.histogram("api.time", Duration.to.milliseconds(dur))
|
|
743
743
|
* })
|
|
744
744
|
* );
|
|
745
745
|
* ```
|
|
@@ -760,15 +760,15 @@ declare namespace tap {
|
|
|
760
760
|
* uncurry(nested)(); // 42
|
|
761
761
|
*
|
|
762
762
|
* // Original curried function
|
|
763
|
-
* Maybe.map(n => n * 2)(Maybe.some(5)); // Some(10)
|
|
763
|
+
* Maybe.map(n => n * 2)(Maybe.make.some(5)); // Some(10)
|
|
764
764
|
*
|
|
765
765
|
* // Uncurried - all arguments at once
|
|
766
766
|
* const mapUncurried = uncurry(Maybe.map);
|
|
767
|
-
* mapUncurried(n => n * 2, Maybe.some(5)); // Some(10)
|
|
767
|
+
* mapUncurried(n => n * 2, Maybe.make.some(5)); // Some(10)
|
|
768
768
|
*
|
|
769
769
|
* // Combined with flip for data-first uncurried
|
|
770
770
|
* const mapDataFirst = uncurry(flip(Maybe.map));
|
|
771
|
-
* mapDataFirst(Maybe.some(5), n => n * 2); // Some(10)
|
|
771
|
+
* mapDataFirst(Maybe.make.some(5), n => n * 2); // Some(10)
|
|
772
772
|
* ```
|
|
773
773
|
*
|
|
774
774
|
* @see {@link flip} for reversing curried argument order
|
package/dist/composition.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Awaitable, T as Thenable } from './InternalTypes-
|
|
1
|
+
import { A as Awaitable, T as Thenable } from './InternalTypes-Mssktd7z.js';
|
|
2
2
|
import { Duration } from './types.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -110,13 +110,13 @@ declare const curry4: <A, B, C, D, E>(f: (a: A, b: B, c: C, d: D) => E) => (a: A
|
|
|
110
110
|
* ```ts
|
|
111
111
|
* // Original data-last (for pipe)
|
|
112
112
|
* pipe(
|
|
113
|
-
* Maybe.some(5),
|
|
113
|
+
* Maybe.make.some(5),
|
|
114
114
|
* Maybe.map(n => n * 2)
|
|
115
115
|
* ); // Some(10)
|
|
116
116
|
*
|
|
117
117
|
* // Flipped to data-first
|
|
118
118
|
* const mapFirst = flip(Maybe.map);
|
|
119
|
-
* mapFirst(Maybe.some(5))(n => n * 2); // Some(10)
|
|
119
|
+
* mapFirst(Maybe.make.some(5))(n => n * 2); // Some(10)
|
|
120
120
|
* ```
|
|
121
121
|
*
|
|
122
122
|
* @see {@link uncurry} for converting curried functions to multi-argument functions
|
|
@@ -265,7 +265,7 @@ interface flow {
|
|
|
265
265
|
* @example
|
|
266
266
|
* ```ts
|
|
267
267
|
* identity(42); // 42
|
|
268
|
-
* pipe(Maybe.some(5), Maybe.fold(() => 0, identity)); // 5
|
|
268
|
+
* pipe(Maybe.make.some(5), Maybe.fold(() => 0, identity)); // 5
|
|
269
269
|
* ```
|
|
270
270
|
*/
|
|
271
271
|
declare const identity: <A>(a: A) => A;
|
|
@@ -496,7 +496,7 @@ declare function async<A, B, C, D, E, F, G, H, I, J, K>(a: Awaitable<A>, ab: (a:
|
|
|
496
496
|
*
|
|
497
497
|
* // With library functions
|
|
498
498
|
* const greeting = pipe(
|
|
499
|
-
* Maybe.some("Alice"),
|
|
499
|
+
* Maybe.make.some("Alice"),
|
|
500
500
|
* Maybe.map(name => name.toUpperCase()),
|
|
501
501
|
* Maybe.map(name => `Hello, ${name}!`),
|
|
502
502
|
* Maybe.getOrElse(() => "Hello!")
|
|
@@ -599,7 +599,7 @@ interface pipe {
|
|
|
599
599
|
* ```ts
|
|
600
600
|
* // Debugging a pipeline
|
|
601
601
|
* pipe(
|
|
602
|
-
* Maybe.some(5),
|
|
602
|
+
* Maybe.make.some(5),
|
|
603
603
|
* tap(x => console.log("Before map:", x)),
|
|
604
604
|
* Maybe.map(n => n * 2),
|
|
605
605
|
* tap(x => console.log("After map:", x)),
|
|
@@ -739,7 +739,7 @@ declare namespace tap {
|
|
|
739
739
|
* pipe(
|
|
740
740
|
* data,
|
|
741
741
|
* tap.time(fetchData, {
|
|
742
|
-
* onFinish: (dur) => metrics.histogram("api.time", Duration.
|
|
742
|
+
* onFinish: (dur) => metrics.histogram("api.time", Duration.to.milliseconds(dur))
|
|
743
743
|
* })
|
|
744
744
|
* );
|
|
745
745
|
* ```
|
|
@@ -760,15 +760,15 @@ declare namespace tap {
|
|
|
760
760
|
* uncurry(nested)(); // 42
|
|
761
761
|
*
|
|
762
762
|
* // Original curried function
|
|
763
|
-
* Maybe.map(n => n * 2)(Maybe.some(5)); // Some(10)
|
|
763
|
+
* Maybe.map(n => n * 2)(Maybe.make.some(5)); // Some(10)
|
|
764
764
|
*
|
|
765
765
|
* // Uncurried - all arguments at once
|
|
766
766
|
* const mapUncurried = uncurry(Maybe.map);
|
|
767
|
-
* mapUncurried(n => n * 2, Maybe.some(5)); // Some(10)
|
|
767
|
+
* mapUncurried(n => n * 2, Maybe.make.some(5)); // Some(10)
|
|
768
768
|
*
|
|
769
769
|
* // Combined with flip for data-first uncurried
|
|
770
770
|
* const mapDataFirst = uncurry(flip(Maybe.map));
|
|
771
|
-
* mapDataFirst(Maybe.some(5), n => n * 2); // Some(10)
|
|
771
|
+
* mapDataFirst(Maybe.make.some(5), n => n * 2); // Some(10)
|
|
772
772
|
* ```
|
|
773
773
|
*
|
|
774
774
|
* @see {@link flip} for reversing curried argument order
|
package/dist/composition.js
CHANGED
|
@@ -387,11 +387,14 @@ var Duration;
|
|
|
387
387
|
Duration2.minutes = (m) => wrap(m * 60 * 1e3);
|
|
388
388
|
Duration2.hours = (h) => wrap(h * 60 * 60 * 1e3);
|
|
389
389
|
Duration2.days = (d) => wrap(d * 24 * 60 * 60 * 1e3);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
390
|
+
let to;
|
|
391
|
+
((to2) => {
|
|
392
|
+
to2.milliseconds = (d) => Brand.unwrap(d);
|
|
393
|
+
to2.seconds = (d) => Brand.unwrap(d) / 1e3;
|
|
394
|
+
to2.minutes = (d) => Brand.unwrap(d) / (60 * 1e3);
|
|
395
|
+
to2.hours = (d) => Brand.unwrap(d) / (60 * 60 * 1e3);
|
|
396
|
+
to2.days = (d) => Brand.unwrap(d) / (24 * 60 * 60 * 1e3);
|
|
397
|
+
})(to = Duration2.to || (Duration2.to = {}));
|
|
395
398
|
Duration2.add = (other) => (self) => wrap(Brand.unwrap(self) + Brand.unwrap(other));
|
|
396
399
|
Duration2.subtract = (other) => (self) => wrap(Brand.unwrap(self) - Brand.unwrap(other));
|
|
397
400
|
})(Duration || (Duration = {}));
|
|
@@ -453,7 +456,7 @@ function tap(f) {
|
|
|
453
456
|
const start = performance.now();
|
|
454
457
|
const triggerFinish = (duration) => {
|
|
455
458
|
if (config.label !== void 0) {
|
|
456
|
-
console.log(`[${config.label}]: ${Duration.
|
|
459
|
+
console.log(`[${config.label}]: ${Duration.to.milliseconds(duration)}ms`);
|
|
457
460
|
} else {
|
|
458
461
|
config.onFinish(duration);
|
|
459
462
|
}
|