@nlozgachev/pipelined 0.41.0 → 0.43.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/dist/InternalTypes-DsCqxWZm.d.mts +118 -0
- package/dist/InternalTypes-DuzMFAfJ.d.ts +118 -0
- package/dist/{Task-BprUabHP.d.mts → Validation-BOPLiDqa.d.ts} +875 -111
- package/dist/{Task-Dt3ZMen6.d.ts → Validation-Do6uWLLZ.d.mts} +875 -111
- package/dist/{chunk-GBB6LVLI.mjs → chunk-74JKKJ4R.mjs} +0 -4
- package/dist/{chunk-COGQKPIP.mjs → chunk-CHRXZIJU.mjs} +204 -180
- package/dist/{chunk-V37OUM35.mjs → chunk-W6RWKBDX.mjs} +157 -69
- package/dist/{chunk-TCE2UETM.mjs → chunk-X6XQX3OZ.mjs} +4 -4
- package/dist/composition.d.mts +45 -44
- package/dist/composition.d.ts +45 -44
- package/dist/composition.js +3 -3
- package/dist/composition.mjs +2 -2
- package/dist/core.d.mts +10 -812
- package/dist/core.d.ts +10 -812
- package/dist/core.js +202 -182
- package/dist/core.mjs +2 -8
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +359 -254
- package/dist/index.mjs +5 -13
- package/dist/types.d.mts +112 -17
- package/dist/types.d.ts +112 -17
- package/dist/types.js +2 -7
- package/dist/types.mjs +3 -5
- package/dist/utils.d.mts +345 -89
- package/dist/utils.d.ts +345 -89
- package/dist/utils.js +456 -152
- package/dist/utils.mjs +3 -3
- package/package.json +2 -2
- package/dist/Duration-BTeT9D-q.d.mts +0 -127
- package/dist/Duration-BTeT9D-q.d.ts +0 -127
package/dist/index.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
uncurry,
|
|
28
28
|
uncurry3,
|
|
29
29
|
uncurry4
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-X6XQX3OZ.mjs";
|
|
31
31
|
import {
|
|
32
32
|
Arr,
|
|
33
33
|
Dict,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
Rec,
|
|
36
36
|
Str,
|
|
37
37
|
Uniq
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-W6RWKBDX.mjs";
|
|
39
39
|
import {
|
|
40
40
|
Combinable,
|
|
41
41
|
Deferred,
|
|
@@ -55,18 +55,14 @@ import {
|
|
|
55
55
|
Result,
|
|
56
56
|
State,
|
|
57
57
|
Task,
|
|
58
|
-
TaskMaybe,
|
|
59
|
-
TaskResult,
|
|
60
|
-
TaskValidation,
|
|
61
58
|
These,
|
|
62
59
|
Tuple,
|
|
63
60
|
Validation
|
|
64
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-CHRXZIJU.mjs";
|
|
65
62
|
import {
|
|
66
63
|
Brand,
|
|
67
|
-
Duration
|
|
68
|
-
|
|
69
|
-
} from "./chunk-GBB6LVLI.mjs";
|
|
64
|
+
Duration
|
|
65
|
+
} from "./chunk-74JKKJ4R.mjs";
|
|
70
66
|
export {
|
|
71
67
|
Arr,
|
|
72
68
|
Brand,
|
|
@@ -93,9 +89,6 @@ export {
|
|
|
93
89
|
State,
|
|
94
90
|
Str,
|
|
95
91
|
Task,
|
|
96
|
-
TaskMaybe,
|
|
97
|
-
TaskResult,
|
|
98
|
-
TaskValidation,
|
|
99
92
|
These,
|
|
100
93
|
Tuple,
|
|
101
94
|
Uniq,
|
|
@@ -116,7 +109,6 @@ export {
|
|
|
116
109
|
flip,
|
|
117
110
|
flow,
|
|
118
111
|
identity,
|
|
119
|
-
isNonEmptyList,
|
|
120
112
|
juxt,
|
|
121
113
|
memoize,
|
|
122
114
|
memoizeWeak,
|
package/dist/types.d.mts
CHANGED
|
@@ -1,32 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const _brand: unique symbol;
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* accumulating errors in Validation.
|
|
3
|
+
* Brand<K, T> creates a nominal type by tagging T with a phantom brand K.
|
|
4
|
+
* Prevents accidentally mixing up values that share the same underlying type.
|
|
7
5
|
*
|
|
8
6
|
* @example
|
|
9
7
|
* ```ts
|
|
10
|
-
*
|
|
8
|
+
* type UserId = Brand<"UserId", string>;
|
|
9
|
+
* type ProductId = Brand<"ProductId", string>;
|
|
10
|
+
*
|
|
11
|
+
* const toUserId = Brand.wrap<"UserId", string>();
|
|
12
|
+
* const toProductId = Brand.wrap<"ProductId", string>();
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
* const
|
|
14
|
+
* const userId: UserId = toUserId("user-123");
|
|
15
|
+
* const productId: ProductId = toProductId("prod-456");
|
|
16
|
+
*
|
|
17
|
+
* // Type error: ProductId is not assignable to UserId
|
|
18
|
+
* // const wrong: UserId = productId;
|
|
14
19
|
* ```
|
|
15
20
|
*/
|
|
16
|
-
type
|
|
21
|
+
type Brand<K extends string, T> = T & {
|
|
22
|
+
readonly [_brand]: K;
|
|
23
|
+
};
|
|
24
|
+
declare namespace Brand {
|
|
25
|
+
/**
|
|
26
|
+
* Returns a constructor that wraps a value of type T in brand K.
|
|
27
|
+
* The resulting function performs an unchecked cast — only use when the raw
|
|
28
|
+
* value is known to satisfy the brand's invariants.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* type PositiveNumber = Brand<"PositiveNumber", number>;
|
|
33
|
+
* const toPositiveNumber = Brand.wrap<"PositiveNumber", number>();
|
|
34
|
+
*
|
|
35
|
+
* const n: PositiveNumber = toPositiveNumber(42);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const wrap: <K extends string, T>() => (value: T) => Brand<K, T>;
|
|
39
|
+
/**
|
|
40
|
+
* Strips the brand and returns the underlying value.
|
|
41
|
+
* Since Brand<K, T> extends T this is rarely needed, but can improve readability.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const userId: UserId = toUserId("user-123");
|
|
46
|
+
* const raw: string = Brand.unwrap(userId); // "user-123"
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
const unwrap: <K extends string, T>(branded: Brand<K, T>) => T;
|
|
50
|
+
}
|
|
51
|
+
|
|
17
52
|
/**
|
|
18
|
-
*
|
|
53
|
+
* A branded nominal type representing a duration of time in milliseconds.
|
|
54
|
+
* Use Duration to ensure safe time-based operators and clear unit conversions.
|
|
19
55
|
*
|
|
20
56
|
* @example
|
|
21
57
|
* ```ts
|
|
22
|
-
* const
|
|
58
|
+
* const halfSecond = Duration.milliseconds(500);
|
|
59
|
+
* const twoSeconds = Duration.seconds(2);
|
|
60
|
+
* const total = pipe(halfSecond, Duration.add(twoSeconds));
|
|
23
61
|
*
|
|
24
|
-
*
|
|
25
|
-
* // TypeScript knows items has at least one element
|
|
26
|
-
* const first = items[0]; // string, not string | undefined
|
|
27
|
-
* }
|
|
62
|
+
* Duration.toSeconds(total); // 2.5
|
|
28
63
|
* ```
|
|
29
64
|
*/
|
|
30
|
-
|
|
65
|
+
type Duration = Brand<"Duration", number>;
|
|
66
|
+
declare namespace Duration {
|
|
67
|
+
/**
|
|
68
|
+
* Creates a Duration from milliseconds.
|
|
69
|
+
*/
|
|
70
|
+
const milliseconds: (ms: number) => Duration;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a Duration from seconds.
|
|
73
|
+
*/
|
|
74
|
+
const seconds: (s: number) => Duration;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a Duration from minutes.
|
|
77
|
+
*/
|
|
78
|
+
const minutes: (m: number) => Duration;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a Duration from hours.
|
|
81
|
+
*/
|
|
82
|
+
const hours: (h: number) => Duration;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a Duration from days.
|
|
85
|
+
*/
|
|
86
|
+
const days: (d: number) => Duration;
|
|
87
|
+
/**
|
|
88
|
+
* Converts a Duration back to raw milliseconds.
|
|
89
|
+
*/
|
|
90
|
+
const toMilliseconds: (d: Duration) => number;
|
|
91
|
+
/**
|
|
92
|
+
* Converts a Duration to seconds.
|
|
93
|
+
*/
|
|
94
|
+
const toSeconds: (d: Duration) => number;
|
|
95
|
+
/**
|
|
96
|
+
* Converts a Duration to minutes.
|
|
97
|
+
*/
|
|
98
|
+
const toMinutes: (d: Duration) => number;
|
|
99
|
+
/**
|
|
100
|
+
* Converts a Duration to hours.
|
|
101
|
+
*/
|
|
102
|
+
const toHours: (d: Duration) => number;
|
|
103
|
+
/**
|
|
104
|
+
* Converts a Duration to days.
|
|
105
|
+
*/
|
|
106
|
+
const toDays: (d: Duration) => number;
|
|
107
|
+
/**
|
|
108
|
+
* Adds two Durations together.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* pipe(Duration.seconds(1), Duration.add(Duration.milliseconds(500))); // 1500ms
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
const add: (other: Duration) => (self: Duration) => Duration;
|
|
116
|
+
/**
|
|
117
|
+
* Subtracts the other Duration from this one.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* pipe(Duration.seconds(1), Duration.subtract(Duration.milliseconds(500))); // 500ms
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
const subtract: (other: Duration) => (self: Duration) => Duration;
|
|
125
|
+
}
|
|
31
126
|
|
|
32
|
-
export {
|
|
127
|
+
export { Brand, Duration };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,32 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const _brand: unique symbol;
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* accumulating errors in Validation.
|
|
3
|
+
* Brand<K, T> creates a nominal type by tagging T with a phantom brand K.
|
|
4
|
+
* Prevents accidentally mixing up values that share the same underlying type.
|
|
7
5
|
*
|
|
8
6
|
* @example
|
|
9
7
|
* ```ts
|
|
10
|
-
*
|
|
8
|
+
* type UserId = Brand<"UserId", string>;
|
|
9
|
+
* type ProductId = Brand<"ProductId", string>;
|
|
10
|
+
*
|
|
11
|
+
* const toUserId = Brand.wrap<"UserId", string>();
|
|
12
|
+
* const toProductId = Brand.wrap<"ProductId", string>();
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
* const
|
|
14
|
+
* const userId: UserId = toUserId("user-123");
|
|
15
|
+
* const productId: ProductId = toProductId("prod-456");
|
|
16
|
+
*
|
|
17
|
+
* // Type error: ProductId is not assignable to UserId
|
|
18
|
+
* // const wrong: UserId = productId;
|
|
14
19
|
* ```
|
|
15
20
|
*/
|
|
16
|
-
type
|
|
21
|
+
type Brand<K extends string, T> = T & {
|
|
22
|
+
readonly [_brand]: K;
|
|
23
|
+
};
|
|
24
|
+
declare namespace Brand {
|
|
25
|
+
/**
|
|
26
|
+
* Returns a constructor that wraps a value of type T in brand K.
|
|
27
|
+
* The resulting function performs an unchecked cast — only use when the raw
|
|
28
|
+
* value is known to satisfy the brand's invariants.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* type PositiveNumber = Brand<"PositiveNumber", number>;
|
|
33
|
+
* const toPositiveNumber = Brand.wrap<"PositiveNumber", number>();
|
|
34
|
+
*
|
|
35
|
+
* const n: PositiveNumber = toPositiveNumber(42);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const wrap: <K extends string, T>() => (value: T) => Brand<K, T>;
|
|
39
|
+
/**
|
|
40
|
+
* Strips the brand and returns the underlying value.
|
|
41
|
+
* Since Brand<K, T> extends T this is rarely needed, but can improve readability.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const userId: UserId = toUserId("user-123");
|
|
46
|
+
* const raw: string = Brand.unwrap(userId); // "user-123"
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
const unwrap: <K extends string, T>(branded: Brand<K, T>) => T;
|
|
50
|
+
}
|
|
51
|
+
|
|
17
52
|
/**
|
|
18
|
-
*
|
|
53
|
+
* A branded nominal type representing a duration of time in milliseconds.
|
|
54
|
+
* Use Duration to ensure safe time-based operators and clear unit conversions.
|
|
19
55
|
*
|
|
20
56
|
* @example
|
|
21
57
|
* ```ts
|
|
22
|
-
* const
|
|
58
|
+
* const halfSecond = Duration.milliseconds(500);
|
|
59
|
+
* const twoSeconds = Duration.seconds(2);
|
|
60
|
+
* const total = pipe(halfSecond, Duration.add(twoSeconds));
|
|
23
61
|
*
|
|
24
|
-
*
|
|
25
|
-
* // TypeScript knows items has at least one element
|
|
26
|
-
* const first = items[0]; // string, not string | undefined
|
|
27
|
-
* }
|
|
62
|
+
* Duration.toSeconds(total); // 2.5
|
|
28
63
|
* ```
|
|
29
64
|
*/
|
|
30
|
-
|
|
65
|
+
type Duration = Brand<"Duration", number>;
|
|
66
|
+
declare namespace Duration {
|
|
67
|
+
/**
|
|
68
|
+
* Creates a Duration from milliseconds.
|
|
69
|
+
*/
|
|
70
|
+
const milliseconds: (ms: number) => Duration;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a Duration from seconds.
|
|
73
|
+
*/
|
|
74
|
+
const seconds: (s: number) => Duration;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a Duration from minutes.
|
|
77
|
+
*/
|
|
78
|
+
const minutes: (m: number) => Duration;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a Duration from hours.
|
|
81
|
+
*/
|
|
82
|
+
const hours: (h: number) => Duration;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a Duration from days.
|
|
85
|
+
*/
|
|
86
|
+
const days: (d: number) => Duration;
|
|
87
|
+
/**
|
|
88
|
+
* Converts a Duration back to raw milliseconds.
|
|
89
|
+
*/
|
|
90
|
+
const toMilliseconds: (d: Duration) => number;
|
|
91
|
+
/**
|
|
92
|
+
* Converts a Duration to seconds.
|
|
93
|
+
*/
|
|
94
|
+
const toSeconds: (d: Duration) => number;
|
|
95
|
+
/**
|
|
96
|
+
* Converts a Duration to minutes.
|
|
97
|
+
*/
|
|
98
|
+
const toMinutes: (d: Duration) => number;
|
|
99
|
+
/**
|
|
100
|
+
* Converts a Duration to hours.
|
|
101
|
+
*/
|
|
102
|
+
const toHours: (d: Duration) => number;
|
|
103
|
+
/**
|
|
104
|
+
* Converts a Duration to days.
|
|
105
|
+
*/
|
|
106
|
+
const toDays: (d: Duration) => number;
|
|
107
|
+
/**
|
|
108
|
+
* Adds two Durations together.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* pipe(Duration.seconds(1), Duration.add(Duration.milliseconds(500))); // 1500ms
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
const add: (other: Duration) => (self: Duration) => Duration;
|
|
116
|
+
/**
|
|
117
|
+
* Subtracts the other Duration from this one.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* pipe(Duration.seconds(1), Duration.subtract(Duration.milliseconds(500))); // 500ms
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
const subtract: (other: Duration) => (self: Duration) => Duration;
|
|
125
|
+
}
|
|
31
126
|
|
|
32
|
-
export {
|
|
127
|
+
export { Brand, Duration };
|
package/dist/types.js
CHANGED
|
@@ -21,8 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var Types_exports = {};
|
|
22
22
|
__export(Types_exports, {
|
|
23
23
|
Brand: () => Brand,
|
|
24
|
-
Duration: () => Duration
|
|
25
|
-
isNonEmptyList: () => isNonEmptyList
|
|
24
|
+
Duration: () => Duration
|
|
26
25
|
});
|
|
27
26
|
module.exports = __toCommonJS(Types_exports);
|
|
28
27
|
|
|
@@ -50,12 +49,8 @@ var Duration;
|
|
|
50
49
|
Duration2.add = (other) => (self) => wrap(Brand.unwrap(self) + Brand.unwrap(other));
|
|
51
50
|
Duration2.subtract = (other) => (self) => wrap(Brand.unwrap(self) - Brand.unwrap(other));
|
|
52
51
|
})(Duration || (Duration = {}));
|
|
53
|
-
|
|
54
|
-
// src/Types/NonEmptyList.ts
|
|
55
|
-
var isNonEmptyList = (list) => list.length > 0;
|
|
56
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
57
53
|
0 && (module.exports = {
|
|
58
54
|
Brand,
|
|
59
|
-
Duration
|
|
60
|
-
isNonEmptyList
|
|
55
|
+
Duration
|
|
61
56
|
});
|