@nlozgachev/pipelined 0.55.0 → 0.56.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
  /**
@@ -1634,6 +1644,16 @@ declare namespace TaskValidation {
1634
1644
  * ```
1635
1645
  */
1636
1646
  const struct: <E, R extends Record<string, any>>(fields: { [K in keyof R]: TaskValidation<E, R[K]>; }) => TaskValidation<E, R>;
1647
+ /**
1648
+ * Creates a memoized version of a Task.Validation. The task is executed at most once on first call,
1649
+ * and its resolved Validation is cached for all subsequent calls.
1650
+ *
1651
+ * @example
1652
+ * ```ts
1653
+ * const validate = Task.Validation.memoize(validateFormTask);
1654
+ * ```
1655
+ */
1656
+ const memoize: <E, A>(task: TaskValidation<E, A>) => TaskValidation<E, A>;
1637
1657
  }
1638
1658
 
1639
1659
  /**
@@ -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
  /**
@@ -1634,6 +1644,16 @@ declare namespace TaskValidation {
1634
1644
  * ```
1635
1645
  */
1636
1646
  const struct: <E, R extends Record<string, any>>(fields: { [K in keyof R]: TaskValidation<E, R[K]>; }) => TaskValidation<E, R>;
1647
+ /**
1648
+ * Creates a memoized version of a Task.Validation. The task is executed at most once on first call,
1649
+ * and its resolved Validation is cached for all subsequent calls.
1650
+ *
1651
+ * @example
1652
+ * ```ts
1653
+ * const validate = Task.Validation.memoize(validateFormTask);
1654
+ * ```
1655
+ */
1656
+ const memoize: <E, A>(task: TaskValidation<E, A>) => TaskValidation<E, A>;
1637
1657
  }
1638
1658
 
1639
1659
  /**
@@ -3,7 +3,7 @@ import {
3
3
  Maybe,
4
4
  Result,
5
5
  isNonEmptyArr
6
- } from "./chunk-MFJXL6J2.js";
6
+ } from "./chunk-K7HHEACE.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
@@ -2108,6 +2109,7 @@ var TaskValidation;
2108
2109
  return isNonEmptyArr(errors) ? Validation.make.failedAll(errors) : Validation.make.passed(record);
2109
2110
  });
2110
2111
  })());
2112
+ TaskValidation2.memoize = (task) => Task.memoize(task);
2111
2113
  })(TaskValidation || (TaskValidation = {}));
2112
2114
 
2113
2115
  // 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
@@ -2179,6 +2180,7 @@ var TaskValidation;
2179
2180
  return isNonEmptyArr(errors) ? Validation.make.failedAll(errors) : Validation.make.passed(record);
2180
2181
  });
2181
2182
  })());
2183
+ TaskValidation2.memoize = (task) => Task.memoize(task);
2182
2184
  })(TaskValidation || (TaskValidation = {}));
2183
2185
 
2184
2186
  // 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-DCqWoCC2.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-DCqWoCC2.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-t0k4ic-S.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-t0k4ic-S.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-K7HHEACE.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-DCqWoCC2.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-t0k4ic-S.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-EJX32LRO.js";
11
+ import "./chunk-K7HHEACE.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
@@ -2661,6 +2662,7 @@ var TaskValidation;
2661
2662
  return isNonEmptyArr(errors) ? Validation.make.failedAll(errors) : Validation.make.passed(record);
2662
2663
  });
2663
2664
  })());
2665
+ TaskValidation2.memoize = (task) => Task.memoize(task);
2664
2666
  })(TaskValidation || (TaskValidation = {}));
2665
2667
 
2666
2668
  // 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-DCqWoCC2.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-t0k4ic-S.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-EJX32LRO.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-K7HHEACE.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.56.0",
4
4
  "description": "Opinionated functional abstractions for TypeScript",
5
5
  "license": "BSD-3-Clause",
6
6
  "homepage": "https://pipelined.lozgachev.dev",