@nlozgachev/pipelined 0.55.0 → 0.57.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.
@@ -1117,6 +1117,16 @@ declare namespace TaskMaybe {
1117
1117
  * ```
1118
1118
  */
1119
1119
  const struct: <R extends Record<string, any>>(fields: { [K in keyof R]: TaskMaybe<R[K]>; }) => TaskMaybe<R>;
1120
+ /**
1121
+ * Creates a memoized version of a Task.Maybe. The task is executed at most once on first call,
1122
+ * and its resolved Maybe is cached for all subsequent calls.
1123
+ *
1124
+ * @example
1125
+ * ```ts
1126
+ * const loadUser = Task.Maybe.memoize(fetchUserMaybeTask);
1127
+ * ```
1128
+ */
1129
+ const memoize: <A>(task: TaskMaybe<A>) => TaskMaybe<A>;
1120
1130
  }
1121
1131
 
1122
1132
  /**
@@ -1256,6 +1266,22 @@ declare namespace TaskResult {
1256
1266
  * The fallback can produce a different success type, widening the result to `Task.Result<E, A | B>`.
1257
1267
  */
1258
1268
  const recover: <E, B>(fallback: (e: E) => TaskResult<E, B>) => <A>(data: TaskResult<E, A>) => TaskResult<E, A | B>;
1269
+ /**
1270
+ * Recovers from an error unless the predicate `isBlocked` returns true for that error.
1271
+ * The fallback can produce a different success type, widening the result to `Task.Result<E, A | B>`.
1272
+ *
1273
+ * @example
1274
+ * ```ts
1275
+ * pipe(
1276
+ * fetchTask,
1277
+ * Task.Result.recoverUnless(
1278
+ * (e) => e === "fatal",
1279
+ * () => Task.Result.ok("fallback")
1280
+ * )
1281
+ * );
1282
+ * ```
1283
+ */
1284
+ const recoverUnless: <E, B>(isBlocked: (e: E) => boolean, fallback: (e: E) => TaskResult<E, B>) => <A>(data: TaskResult<E, A>) => TaskResult<E, A | B>;
1259
1285
  /**
1260
1286
  * Returns the success value or a default value if the Task.Result is an error.
1261
1287
  * The default can be a different type, widening the result to `Task<A | B>`.
@@ -1491,6 +1517,28 @@ declare namespace TaskValidation {
1491
1517
  */
1492
1518
  const Result: <E, A>(result: Result<E, A>) => TaskValidation<E, A>;
1493
1519
  }
1520
+ namespace to {
1521
+ /**
1522
+ * Converts a `Task.Validation` to a `Task.Result`, combining accumulated errors using `combineErrors`.
1523
+ * `Passed(a)` becomes `Ok(a)`; `Failed(errors)` becomes `Err(combineErrors(errors))`.
1524
+ *
1525
+ * @example
1526
+ * ```ts
1527
+ * Task.Validation.to.Result((errors) => errors.join(", "))(validationTask);
1528
+ * ```
1529
+ */
1530
+ const Result: <E1, E2, A>(combineErrors: (errors: NonEmptyArr<E1>) => E2) => (data: TaskValidation<E1, A>) => TaskResult<E2, A>;
1531
+ /**
1532
+ * Converts a `Task.Validation` to a `Task.Maybe`.
1533
+ * `Passed(a)` becomes `Some(a)`; `Failed(errors)` becomes `None` (errors are discarded).
1534
+ *
1535
+ * @example
1536
+ * ```ts
1537
+ * Task.Validation.to.Maybe(validationTask);
1538
+ * ```
1539
+ */
1540
+ const Maybe: <E, A>(data: TaskValidation<E, A>) => TaskMaybe<A>;
1541
+ }
1494
1542
  /**
1495
1543
  * Creates a Task.Validation from a Promise-returning function.
1496
1544
  * Catches any errors and transforms them using the onError function.
@@ -1568,6 +1616,22 @@ declare namespace TaskValidation {
1568
1616
  * The fallback can produce a different success type, widening the result to `Task.Validation<E, A | B>`.
1569
1617
  */
1570
1618
  const recover: <E, B>(fallback: (errors: NonEmptyArr<E>) => TaskValidation<E, B>) => <A>(data: TaskValidation<E, A>) => TaskValidation<E, A | B>;
1619
+ /**
1620
+ * Recovers from a Failed state unless the predicate `isBlocked` returns true for the accumulated errors.
1621
+ * The fallback receives the accumulated errors and can produce a different success type, widening the result to `Task.Validation<E, A | B>`.
1622
+ *
1623
+ * @example
1624
+ * ```ts
1625
+ * pipe(
1626
+ * validationTask,
1627
+ * Task.Validation.recoverUnless(
1628
+ * (errors) => errors.includes("fatal"),
1629
+ * (errors) => Task.Validation.passed("fallback")
1630
+ * )
1631
+ * );
1632
+ * ```
1633
+ */
1634
+ const recoverUnless: <E, B>(isBlocked: (errors: NonEmptyArr<E>) => boolean, fallback: (errors: NonEmptyArr<E>) => TaskValidation<E, B>) => <A>(data: TaskValidation<E, A>) => TaskValidation<E, A | B>;
1571
1635
  /**
1572
1636
  * Runs two Task.Validations concurrently and combines their results into a tuple.
1573
1637
  * If both are Passed, returns Passed with both values. If either fails, accumulates
@@ -1634,6 +1698,16 @@ declare namespace TaskValidation {
1634
1698
  * ```
1635
1699
  */
1636
1700
  const struct: <E, R extends Record<string, any>>(fields: { [K in keyof R]: TaskValidation<E, R[K]>; }) => TaskValidation<E, R>;
1701
+ /**
1702
+ * Creates a memoized version of a Task.Validation. The task is executed at most once on first call,
1703
+ * and its resolved Validation is cached for all subsequent calls.
1704
+ *
1705
+ * @example
1706
+ * ```ts
1707
+ * const validate = Task.Validation.memoize(validateFormTask);
1708
+ * ```
1709
+ */
1710
+ const memoize: <E, A>(task: TaskValidation<E, A>) => TaskValidation<E, A>;
1637
1711
  }
1638
1712
 
1639
1713
  /**
@@ -1117,6 +1117,16 @@ declare namespace TaskMaybe {
1117
1117
  * ```
1118
1118
  */
1119
1119
  const struct: <R extends Record<string, any>>(fields: { [K in keyof R]: TaskMaybe<R[K]>; }) => TaskMaybe<R>;
1120
+ /**
1121
+ * Creates a memoized version of a Task.Maybe. The task is executed at most once on first call,
1122
+ * and its resolved Maybe is cached for all subsequent calls.
1123
+ *
1124
+ * @example
1125
+ * ```ts
1126
+ * const loadUser = Task.Maybe.memoize(fetchUserMaybeTask);
1127
+ * ```
1128
+ */
1129
+ const memoize: <A>(task: TaskMaybe<A>) => TaskMaybe<A>;
1120
1130
  }
1121
1131
 
1122
1132
  /**
@@ -1256,6 +1266,22 @@ declare namespace TaskResult {
1256
1266
  * The fallback can produce a different success type, widening the result to `Task.Result<E, A | B>`.
1257
1267
  */
1258
1268
  const recover: <E, B>(fallback: (e: E) => TaskResult<E, B>) => <A>(data: TaskResult<E, A>) => TaskResult<E, A | B>;
1269
+ /**
1270
+ * Recovers from an error unless the predicate `isBlocked` returns true for that error.
1271
+ * The fallback can produce a different success type, widening the result to `Task.Result<E, A | B>`.
1272
+ *
1273
+ * @example
1274
+ * ```ts
1275
+ * pipe(
1276
+ * fetchTask,
1277
+ * Task.Result.recoverUnless(
1278
+ * (e) => e === "fatal",
1279
+ * () => Task.Result.ok("fallback")
1280
+ * )
1281
+ * );
1282
+ * ```
1283
+ */
1284
+ const recoverUnless: <E, B>(isBlocked: (e: E) => boolean, fallback: (e: E) => TaskResult<E, B>) => <A>(data: TaskResult<E, A>) => TaskResult<E, A | B>;
1259
1285
  /**
1260
1286
  * Returns the success value or a default value if the Task.Result is an error.
1261
1287
  * The default can be a different type, widening the result to `Task<A | B>`.
@@ -1491,6 +1517,28 @@ declare namespace TaskValidation {
1491
1517
  */
1492
1518
  const Result: <E, A>(result: Result<E, A>) => TaskValidation<E, A>;
1493
1519
  }
1520
+ namespace to {
1521
+ /**
1522
+ * Converts a `Task.Validation` to a `Task.Result`, combining accumulated errors using `combineErrors`.
1523
+ * `Passed(a)` becomes `Ok(a)`; `Failed(errors)` becomes `Err(combineErrors(errors))`.
1524
+ *
1525
+ * @example
1526
+ * ```ts
1527
+ * Task.Validation.to.Result((errors) => errors.join(", "))(validationTask);
1528
+ * ```
1529
+ */
1530
+ const Result: <E1, E2, A>(combineErrors: (errors: NonEmptyArr<E1>) => E2) => (data: TaskValidation<E1, A>) => TaskResult<E2, A>;
1531
+ /**
1532
+ * Converts a `Task.Validation` to a `Task.Maybe`.
1533
+ * `Passed(a)` becomes `Some(a)`; `Failed(errors)` becomes `None` (errors are discarded).
1534
+ *
1535
+ * @example
1536
+ * ```ts
1537
+ * Task.Validation.to.Maybe(validationTask);
1538
+ * ```
1539
+ */
1540
+ const Maybe: <E, A>(data: TaskValidation<E, A>) => TaskMaybe<A>;
1541
+ }
1494
1542
  /**
1495
1543
  * Creates a Task.Validation from a Promise-returning function.
1496
1544
  * Catches any errors and transforms them using the onError function.
@@ -1568,6 +1616,22 @@ declare namespace TaskValidation {
1568
1616
  * The fallback can produce a different success type, widening the result to `Task.Validation<E, A | B>`.
1569
1617
  */
1570
1618
  const recover: <E, B>(fallback: (errors: NonEmptyArr<E>) => TaskValidation<E, B>) => <A>(data: TaskValidation<E, A>) => TaskValidation<E, A | B>;
1619
+ /**
1620
+ * Recovers from a Failed state unless the predicate `isBlocked` returns true for the accumulated errors.
1621
+ * The fallback receives the accumulated errors and can produce a different success type, widening the result to `Task.Validation<E, A | B>`.
1622
+ *
1623
+ * @example
1624
+ * ```ts
1625
+ * pipe(
1626
+ * validationTask,
1627
+ * Task.Validation.recoverUnless(
1628
+ * (errors) => errors.includes("fatal"),
1629
+ * (errors) => Task.Validation.passed("fallback")
1630
+ * )
1631
+ * );
1632
+ * ```
1633
+ */
1634
+ const recoverUnless: <E, B>(isBlocked: (errors: NonEmptyArr<E>) => boolean, fallback: (errors: NonEmptyArr<E>) => TaskValidation<E, B>) => <A>(data: TaskValidation<E, A>) => TaskValidation<E, A | B>;
1571
1635
  /**
1572
1636
  * Runs two Task.Validations concurrently and combines their results into a tuple.
1573
1637
  * If both are Passed, returns Passed with both values. If either fails, accumulates
@@ -1634,6 +1698,16 @@ declare namespace TaskValidation {
1634
1698
  * ```
1635
1699
  */
1636
1700
  const struct: <E, R extends Record<string, any>>(fields: { [K in keyof R]: TaskValidation<E, R[K]>; }) => TaskValidation<E, R>;
1701
+ /**
1702
+ * Creates a memoized version of a Task.Validation. The task is executed at most once on first call,
1703
+ * and its resolved Validation is cached for all subsequent calls.
1704
+ *
1705
+ * @example
1706
+ * ```ts
1707
+ * const validate = Task.Validation.memoize(validateFormTask);
1708
+ * ```
1709
+ */
1710
+ const memoize: <E, A>(task: TaskValidation<E, A>) => TaskValidation<E, A>;
1637
1711
  }
1638
1712
 
1639
1713
  /**
@@ -3,7 +3,7 @@ import {
3
3
  Maybe,
4
4
  Result,
5
5
  isNonEmptyArr
6
- } from "./chunk-MFJXL6J2.js";
6
+ } from "./chunk-YMHKIN4I.js";
7
7
 
8
8
  // src/Data/Arr.ts
9
9
  var ArrMaybe;
@@ -1913,6 +1913,7 @@ var TaskMaybe;
1913
1913
  return Maybe.make.some(record);
1914
1914
  });
1915
1915
  })());
1916
+ TaskMaybe2.memoize = (task) => Task.memoize(task);
1916
1917
  })(TaskMaybe || (TaskMaybe = {}));
1917
1918
 
1918
1919
  // src/Core/TaskResult.ts
@@ -1950,6 +1951,9 @@ var TaskResult;
1950
1951
  TaskResult2.recover = (fallback) => (data) => Task.chain(
1951
1952
  (result) => Result.is.err(result) ? fallback(result.error) : Task.resolve(result)
1952
1953
  )(data);
1954
+ TaskResult2.recoverUnless = (isBlocked, fallback) => (data) => Task.chain(
1955
+ (result) => Result.is.err(result) && !isBlocked(result.error) ? fallback(result.error) : Task.resolve(result)
1956
+ )(data);
1953
1957
  TaskResult2.getOrElse = (defaultValue) => (data) => Task.map(Result.getOrElse(defaultValue))(data);
1954
1958
  TaskResult2.tap = (f) => (data) => Task.map(Result.tap(f))(data);
1955
1959
  TaskResult2.tapError = (f) => (data) => Task.map(Result.tapError(f))(data);
@@ -2060,6 +2064,11 @@ var TaskValidation;
2060
2064
  );
2061
2065
  from2.Result = (result) => Task.resolve(Validation.from.Result(result));
2062
2066
  })(from = TaskValidation2.from || (TaskValidation2.from = {}));
2067
+ let to;
2068
+ ((to2) => {
2069
+ to2.Result = (combineErrors) => (data) => Task.map(Validation.to.Result(combineErrors))(data);
2070
+ to2.Maybe = (data) => Task.map(Validation.to.Maybe)(data);
2071
+ })(to = TaskValidation2.to || (TaskValidation2.to = {}));
2063
2072
  TaskValidation2.tryCatch = (f, options) => (signal) => Deferred.from.Promise(
2064
2073
  globalThis.Promise.resolve().then(async () => f(signal)).then(Validation.make.passed).catch(
2065
2074
  (error) => Validation.make.failed(options.onError(error))
@@ -2078,6 +2087,9 @@ var TaskValidation;
2078
2087
  TaskValidation2.recover = (fallback) => (data) => Task.chain(
2079
2088
  (validation) => Validation.is.passed(validation) ? Task.resolve(validation) : fallback(validation.errors)
2080
2089
  )(data);
2090
+ TaskValidation2.recoverUnless = (isBlocked, fallback) => (data) => Task.chain(
2091
+ (validation) => Validation.is.passed(validation) ? Task.resolve(validation) : isBlocked(validation.errors) ? Task.resolve(validation) : fallback(validation.errors)
2092
+ )(data);
2081
2093
  TaskValidation2.product = (first, second) => (signal) => Deferred.from.Promise(
2082
2094
  Promise.all([Deferred.to.Promise(first(signal)), Deferred.to.Promise(second(signal))]).then(
2083
2095
  ([va, vb]) => Validation.product(va, vb)
@@ -2108,6 +2120,7 @@ var TaskValidation;
2108
2120
  return isNonEmptyArr(errors) ? Validation.make.failedAll(errors) : Validation.make.passed(record);
2109
2121
  });
2110
2122
  })());
2123
+ TaskValidation2.memoize = (task) => Task.memoize(task);
2111
2124
  })(TaskValidation || (TaskValidation = {}));
2112
2125
 
2113
2126
  // src/Core/Task.ts
package/dist/core.cjs CHANGED
@@ -1984,6 +1984,7 @@ var TaskMaybe;
1984
1984
  return Maybe.make.some(record);
1985
1985
  });
1986
1986
  })());
1987
+ TaskMaybe2.memoize = (task) => Task.memoize(task);
1987
1988
  })(TaskMaybe || (TaskMaybe = {}));
1988
1989
 
1989
1990
  // src/Core/TaskResult.ts
@@ -2021,6 +2022,9 @@ var TaskResult;
2021
2022
  TaskResult2.recover = (fallback) => (data) => Task.chain(
2022
2023
  (result) => Result.is.err(result) ? fallback(result.error) : Task.resolve(result)
2023
2024
  )(data);
2025
+ TaskResult2.recoverUnless = (isBlocked, fallback) => (data) => Task.chain(
2026
+ (result) => Result.is.err(result) && !isBlocked(result.error) ? fallback(result.error) : Task.resolve(result)
2027
+ )(data);
2024
2028
  TaskResult2.getOrElse = (defaultValue) => (data) => Task.map(Result.getOrElse(defaultValue))(data);
2025
2029
  TaskResult2.tap = (f) => (data) => Task.map(Result.tap(f))(data);
2026
2030
  TaskResult2.tapError = (f) => (data) => Task.map(Result.tapError(f))(data);
@@ -2131,6 +2135,11 @@ var TaskValidation;
2131
2135
  );
2132
2136
  from2.Result = (result) => Task.resolve(Validation.from.Result(result));
2133
2137
  })(from = TaskValidation2.from || (TaskValidation2.from = {}));
2138
+ let to;
2139
+ ((to2) => {
2140
+ to2.Result = (combineErrors) => (data) => Task.map(Validation.to.Result(combineErrors))(data);
2141
+ to2.Maybe = (data) => Task.map(Validation.to.Maybe)(data);
2142
+ })(to = TaskValidation2.to || (TaskValidation2.to = {}));
2134
2143
  TaskValidation2.tryCatch = (f, options) => (signal) => Deferred.from.Promise(
2135
2144
  globalThis.Promise.resolve().then(async () => f(signal)).then(Validation.make.passed).catch(
2136
2145
  (error) => Validation.make.failed(options.onError(error))
@@ -2149,6 +2158,9 @@ var TaskValidation;
2149
2158
  TaskValidation2.recover = (fallback) => (data) => Task.chain(
2150
2159
  (validation) => Validation.is.passed(validation) ? Task.resolve(validation) : fallback(validation.errors)
2151
2160
  )(data);
2161
+ TaskValidation2.recoverUnless = (isBlocked, fallback) => (data) => Task.chain(
2162
+ (validation) => Validation.is.passed(validation) ? Task.resolve(validation) : isBlocked(validation.errors) ? Task.resolve(validation) : fallback(validation.errors)
2163
+ )(data);
2152
2164
  TaskValidation2.product = (first, second) => (signal) => Deferred.from.Promise(
2153
2165
  Promise.all([Deferred.to.Promise(first(signal)), Deferred.to.Promise(second(signal))]).then(
2154
2166
  ([va, vb]) => Validation.product(va, vb)
@@ -2179,6 +2191,7 @@ var TaskValidation;
2179
2191
  return isNonEmptyArr(errors) ? Validation.make.failedAll(errors) : Validation.make.passed(record);
2180
2192
  });
2181
2193
  })());
2194
+ TaskValidation2.memoize = (task) => Task.memoize(task);
2182
2195
  })(TaskValidation || (TaskValidation = {}));
2183
2196
 
2184
2197
  // src/Core/Task.ts
package/dist/core.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Maybe, R as Result, T as Task } from './Validation-CbU7Z-kj.cjs';
2
- export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, V as Validation } from './Validation-CbU7Z-kj.cjs';
1
+ import { M as Maybe, R as Result, T as Task } from './Validation-DC3uUizM.cjs';
2
+ export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, V as Validation } from './Validation-DC3uUizM.cjs';
3
3
  import { o as WithValue, i as WithLog, D as Deferred, h as WithKind, e as WithError, R as RetryOptions, b as TimeoutOptions, n as WithTimeout, j as WithMinInterval, c as WithCooldown, W as WithConcurrency, m as WithSize, d as WithDuration, k as WithN, g as WithFirst, l as WithSecond } from './InternalTypes-DuK_XpTi.cjs';
4
4
  import { D as Duration } from './Duration-B8joKzro.cjs';
5
5
  import './types.cjs';
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Maybe, R as Result, T as Task } from './Validation-CmxZ3V4r.js';
2
- export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, V as Validation } from './Validation-CmxZ3V4r.js';
1
+ import { M as Maybe, R as Result, T as Task } from './Validation-DZLizBZ0.js';
2
+ export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, V as Validation } from './Validation-DZLizBZ0.js';
3
3
  import { o as WithValue, i as WithLog, D as Deferred, h as WithKind, e as WithError, R as RetryOptions, b as TimeoutOptions, n as WithTimeout, j as WithMinInterval, c as WithCooldown, W as WithConcurrency, m as WithSize, d as WithDuration, k as WithN, g as WithFirst, l as WithSecond } from './InternalTypes-LdhLQx3N.js';
4
4
  import { D as Duration } from './Duration-B8joKzro.js';
5
5
  import './types.js';
package/dist/core.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  These,
22
22
  Tuple,
23
23
  Validation
24
- } from "./chunk-MFJXL6J2.js";
24
+ } from "./chunk-YMHKIN4I.js";
25
25
  import "./chunk-OIIOGDHK.js";
26
26
  export {
27
27
  Combinable,
package/dist/data.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as NonEmptyArr, N as NonEmpty } from './InternalTypes-DuK_XpTi.cjs';
2
- import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Validation-CbU7Z-kj.cjs';
2
+ import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Validation-DC3uUizM.cjs';
3
3
  import { B as Brand } from './Duration-B8joKzro.cjs';
4
4
  import './types.cjs';
5
5
 
package/dist/data.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as NonEmptyArr, N as NonEmpty } from './InternalTypes-LdhLQx3N.js';
2
- import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Validation-CmxZ3V4r.js';
2
+ import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Validation-DZLizBZ0.js';
3
3
  import { B as Brand } from './Duration-B8joKzro.js';
4
4
  import './types.js';
5
5
 
package/dist/data.js CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  Rec,
8
8
  Str,
9
9
  Uniq
10
- } from "./chunk-NIE7VVZU.js";
11
- import "./chunk-MFJXL6J2.js";
10
+ } from "./chunk-M4JSQLML.js";
11
+ import "./chunk-YMHKIN4I.js";
12
12
  import "./chunk-OIIOGDHK.js";
13
13
  export {
14
14
  Arr,
package/dist/index.cjs CHANGED
@@ -2466,6 +2466,7 @@ var TaskMaybe;
2466
2466
  return Maybe.make.some(record);
2467
2467
  });
2468
2468
  })());
2469
+ TaskMaybe2.memoize = (task) => Task.memoize(task);
2469
2470
  })(TaskMaybe || (TaskMaybe = {}));
2470
2471
 
2471
2472
  // src/Core/TaskResult.ts
@@ -2503,6 +2504,9 @@ var TaskResult;
2503
2504
  TaskResult2.recover = (fallback) => (data) => Task.chain(
2504
2505
  (result) => Result.is.err(result) ? fallback(result.error) : Task.resolve(result)
2505
2506
  )(data);
2507
+ TaskResult2.recoverUnless = (isBlocked, fallback) => (data) => Task.chain(
2508
+ (result) => Result.is.err(result) && !isBlocked(result.error) ? fallback(result.error) : Task.resolve(result)
2509
+ )(data);
2506
2510
  TaskResult2.getOrElse = (defaultValue) => (data) => Task.map(Result.getOrElse(defaultValue))(data);
2507
2511
  TaskResult2.tap = (f) => (data) => Task.map(Result.tap(f))(data);
2508
2512
  TaskResult2.tapError = (f) => (data) => Task.map(Result.tapError(f))(data);
@@ -2613,6 +2617,11 @@ var TaskValidation;
2613
2617
  );
2614
2618
  from2.Result = (result) => Task.resolve(Validation.from.Result(result));
2615
2619
  })(from = TaskValidation2.from || (TaskValidation2.from = {}));
2620
+ let to;
2621
+ ((to2) => {
2622
+ to2.Result = (combineErrors) => (data) => Task.map(Validation.to.Result(combineErrors))(data);
2623
+ to2.Maybe = (data) => Task.map(Validation.to.Maybe)(data);
2624
+ })(to = TaskValidation2.to || (TaskValidation2.to = {}));
2616
2625
  TaskValidation2.tryCatch = (f, options) => (signal) => Deferred.from.Promise(
2617
2626
  globalThis.Promise.resolve().then(async () => f(signal)).then(Validation.make.passed).catch(
2618
2627
  (error) => Validation.make.failed(options.onError(error))
@@ -2631,6 +2640,9 @@ var TaskValidation;
2631
2640
  TaskValidation2.recover = (fallback) => (data) => Task.chain(
2632
2641
  (validation) => Validation.is.passed(validation) ? Task.resolve(validation) : fallback(validation.errors)
2633
2642
  )(data);
2643
+ TaskValidation2.recoverUnless = (isBlocked, fallback) => (data) => Task.chain(
2644
+ (validation) => Validation.is.passed(validation) ? Task.resolve(validation) : isBlocked(validation.errors) ? Task.resolve(validation) : fallback(validation.errors)
2645
+ )(data);
2634
2646
  TaskValidation2.product = (first, second) => (signal) => Deferred.from.Promise(
2635
2647
  Promise.all([Deferred.to.Promise(first(signal)), Deferred.to.Promise(second(signal))]).then(
2636
2648
  ([va, vb]) => Validation.product(va, vb)
@@ -2661,6 +2673,7 @@ var TaskValidation;
2661
2673
  return isNonEmptyArr(errors) ? Validation.make.failedAll(errors) : Validation.make.passed(record);
2662
2674
  });
2663
2675
  })());
2676
+ TaskValidation2.memoize = (task) => Task.memoize(task);
2664
2677
  })(TaskValidation || (TaskValidation = {}));
2665
2678
 
2666
2679
  // src/Core/Task.ts
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { and, compose, constFalse, constNull, constTrue, constUndefined, constVoid, constant, converge, curry, curry3, curry4, defaultTo, flip, flow, identity, juxt, memoize, memoizeWeak, not, on, once, or, pipe, tap, tuple, uncurry, uncurry3, uncurry4, untuple } from './composition.cjs';
2
2
  export { Combinable, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, State, Stream, Success, These, TheseBoth, TheseFirst, TheseSecond, Tuple } from './core.cjs';
3
3
  export { D as Deferred } from './InternalTypes-DuK_XpTi.cjs';
4
- export { E as Equality, a as Err, F as Failed, M as Maybe, N as None, O as Ok, b as Ordering, P as Passed, R as Result, S as Some, T as Task, V as Validation } from './Validation-CbU7Z-kj.cjs';
4
+ export { E as Equality, a as Err, F as Failed, M as Maybe, N as None, O as Ok, b as Ordering, P as Passed, R as Result, S as Some, T as Task, V as Validation } from './Validation-DC3uUizM.cjs';
5
5
  export { Arr, BigNum, Dict, Json, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, Num, Rec, Str, Uniq } from './data.cjs';
6
6
  export { B as Brand, D as Duration } from './Duration-B8joKzro.cjs';
7
7
  export { RetryPolicy } from './types.cjs';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { and, compose, constFalse, constNull, constTrue, constUndefined, constVoid, constant, converge, curry, curry3, curry4, defaultTo, flip, flow, identity, juxt, memoize, memoizeWeak, not, on, once, or, pipe, tap, tuple, uncurry, uncurry3, uncurry4, untuple } from './composition.js';
2
2
  export { Combinable, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, State, Stream, Success, These, TheseBoth, TheseFirst, TheseSecond, Tuple } from './core.js';
3
3
  export { D as Deferred } from './InternalTypes-LdhLQx3N.js';
4
- export { E as Equality, a as Err, F as Failed, M as Maybe, N as None, O as Ok, b as Ordering, P as Passed, R as Result, S as Some, T as Task, V as Validation } from './Validation-CmxZ3V4r.js';
4
+ export { E as Equality, a as Err, F as Failed, M as Maybe, N as None, O as Ok, b as Ordering, P as Passed, R as Result, S as Some, T as Task, V as Validation } from './Validation-DZLizBZ0.js';
5
5
  export { Arr, BigNum, Dict, Json, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, Num, Rec, Str, Uniq } from './data.js';
6
6
  export { B as Brand, D as Duration } from './Duration-B8joKzro.js';
7
7
  export { RetryPolicy } from './types.js';
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  Rec,
40
40
  Str,
41
41
  Uniq
42
- } from "./chunk-NIE7VVZU.js";
42
+ } from "./chunk-M4JSQLML.js";
43
43
  import {
44
44
  Combinable,
45
45
  Deferred,
@@ -63,7 +63,7 @@ import {
63
63
  These,
64
64
  Tuple,
65
65
  Validation
66
- } from "./chunk-MFJXL6J2.js";
66
+ } from "./chunk-YMHKIN4I.js";
67
67
  import {
68
68
  Brand,
69
69
  Duration,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlozgachev/pipelined",
3
- "version": "0.55.0",
3
+ "version": "0.57.0",
4
4
  "description": "Opinionated functional abstractions for TypeScript",
5
5
  "license": "BSD-3-Clause",
6
6
  "homepage": "https://pipelined.lozgachev.dev",