@nlozgachev/pipelined 0.65.0 → 0.67.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/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_types = require("./types.cjs");
3
3
  const require_composition = require("./composition.cjs");
4
- const require_Core = require("./Core-BDXRLmMa.cjs");
4
+ const require_Core = require("./Core-CfAL_21H.cjs");
5
5
  const require_data = require("./data.cjs");
6
6
  exports.Arr = require_data.Arr;
7
7
  exports.BigNum = require_data.BigNum;
@@ -12,6 +12,7 @@ exports.Deferred = require_Core.Deferred;
12
12
  exports.Dict = require_data.Dict;
13
13
  exports.Duration = require_types.Duration;
14
14
  exports.Equality = require_Core.Equality;
15
+ exports.EventBus = require_Core.EventBus;
15
16
  exports.Json = require_data.Json;
16
17
  exports.Lazy = require_Core.Lazy;
17
18
  exports.Lens = require_Core.Lens;
@@ -32,7 +33,6 @@ exports.Result = require_Core.Result;
32
33
  exports.RetryPolicy = require_types.RetryPolicy;
33
34
  exports.State = require_Core.State;
34
35
  exports.Str = require_data.Str;
35
- exports.Stream = require_Core.Stream;
36
36
  exports.Task = require_Core.Task;
37
37
  exports.These = require_Core.These;
38
38
  exports.Uniq = require_data.Uniq;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { n as Duration, r as Brand, t as RetryPolicy } from "./index-Bs8En5LJ.cjs";
2
- import { x as Deferred } from "./InternalTypes-B1Lh9uw_.cjs";
3
- import { A as Logged, C as Pair, D as Maybe, E as Op, M as Lazy, N as Equality, O as None, P as Combinable, S as Predicate, T as Optional, _ as NotAsked, a as Task, b as Refinement, c as Validation, d as Err, f as Ok, g as Loading, h as Failure, i as TheseSecond, j as Lens, k as Some, l as Stream, m as Resource, n as TheseBoth, o as Failed, p as Result, r as TheseFirst, s as Passed, t as These, u as State, v as RemoteData, w as Ordering, x as Reader, y as Success } from "./index-DCK_VPog.cjs";
1
+ import { n as Duration, r as Brand, t as RetryPolicy } from "./index-CTe9CCHY.cjs";
2
+ import { x as Deferred } from "./InternalTypes-DxSlzrpu.cjs";
3
+ import { A as Lens, C as Ordering, D as None, E as Maybe, M as EventBus, N as Equality, O as Some, P as Combinable, S as Pair, T as Op, _ as RemoteData, a as Task, b as Reader, c as Validation, d as Ok, f as Result, g as NotAsked, h as Loading, i as TheseSecond, j as Lazy, k as Logged, l as State, m as Failure, n as TheseBoth, o as Failed, p as Resource, r as TheseFirst, s as Passed, t as These, u as Err, v as Success, w as Optional, x as Predicate, y as Refinement } from "./index-NYjtX7XS.cjs";
4
4
  import { 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";
5
5
  import { Arr, BigNum, Bool, BoolMatchCases, Dict, Json, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, Num, Rec, Str, Uniq } from "./data.cjs";
6
- export { Arr, BigNum, Bool, BoolMatchCases, Brand, Combinable, Deferred, Dict, Duration, Equality, Err, Failed, Failure, Json, Lazy, Lens, Loading, Logged, Maybe, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, None, NotAsked, Num, Ok, Op, Optional, Ordering, Pair, Passed, Predicate, Reader, Rec, Refinement, RemoteData, Resource, Result, RetryPolicy, Some, State, Str, Stream, Success, Task, These, TheseBoth, TheseFirst, TheseSecond, Uniq, Validation, 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 };
6
+ export { Arr, BigNum, Bool, BoolMatchCases, Brand, Combinable, Deferred, Dict, Duration, Equality, Err, EventBus, Failed, Failure, Json, Lazy, Lens, Loading, Logged, Maybe, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, None, NotAsked, Num, Ok, Op, Optional, Ordering, Pair, Passed, Predicate, Reader, Rec, Refinement, RemoteData, Resource, Result, RetryPolicy, Some, State, Str, Success, Task, These, TheseBoth, TheseFirst, TheseSecond, Uniq, Validation, 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 };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { n as Duration, r as Brand, t as RetryPolicy } from "./index-Bs8En5LJ.js";
2
- import { x as Deferred } from "./InternalTypes-DzDey5Do.js";
3
- import { A as Logged, C as Pair, D as Maybe, E as Op, M as Lazy, N as Equality, O as None, P as Combinable, S as Predicate, T as Optional, _ as NotAsked, a as Task, b as Refinement, c as Validation, d as Err, f as Ok, g as Loading, h as Failure, i as TheseSecond, j as Lens, k as Some, l as Stream, m as Resource, n as TheseBoth, o as Failed, p as Result, r as TheseFirst, s as Passed, t as These, u as State, v as RemoteData, w as Ordering, x as Reader, y as Success } from "./index-B07Wr815.js";
1
+ import { n as Duration, r as Brand, t as RetryPolicy } from "./index-CTe9CCHY.js";
2
+ import { x as Deferred } from "./InternalTypes-C0F5jyVQ.js";
3
+ import { A as Lens, C as Ordering, D as None, E as Maybe, M as EventBus, N as Equality, O as Some, P as Combinable, S as Pair, T as Op, _ as RemoteData, a as Task, b as Reader, c as Validation, d as Ok, f as Result, g as NotAsked, h as Loading, i as TheseSecond, j as Lazy, k as Logged, l as State, m as Failure, n as TheseBoth, o as Failed, p as Resource, r as TheseFirst, s as Passed, t as These, u as Err, v as Success, w as Optional, x as Predicate, y as Refinement } from "./index-CdzHrj62.js";
4
4
  import { 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";
5
5
  import { Arr, BigNum, Bool, BoolMatchCases, Dict, Json, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, Num, Rec, Str, Uniq } from "./data.js";
6
- export { Arr, BigNum, Bool, BoolMatchCases, Brand, Combinable, Deferred, Dict, Duration, Equality, Err, Failed, Failure, Json, Lazy, Lens, Loading, Logged, Maybe, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, None, NotAsked, Num, Ok, Op, Optional, Ordering, Pair, Passed, Predicate, Reader, Rec, Refinement, RemoteData, Resource, Result, RetryPolicy, Some, State, Str, Stream, Success, Task, These, TheseBoth, TheseFirst, TheseSecond, Uniq, Validation, 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 };
6
+ export { Arr, BigNum, Bool, BoolMatchCases, Brand, Combinable, Deferred, Dict, Duration, Equality, Err, EventBus, Failed, Failure, Json, Lazy, Lens, Loading, Logged, Maybe, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, None, NotAsked, Num, Ok, Op, Optional, Ordering, Pair, Passed, Predicate, Reader, Rec, Refinement, RemoteData, Resource, Result, RetryPolicy, Some, State, Str, Success, Task, These, TheseBoth, TheseFirst, TheseSecond, Uniq, Validation, 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 };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Brand, Duration, RetryPolicy } from "./types.mjs";
2
2
  import { 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.mjs";
3
- import { C as Combinable, S as Deferred, _ as Maybe, a as Stream, b as Lazy, c as Resource, d as Reader, f as Predicate, g as Op, h as Optional, l as RemoteData, m as Ordering, n as Task, o as State, p as Pair, r as Validation, s as Result, t as These, u as Refinement, v as Logged, x as Equality, y as Lens } from "./Core-BHN87zoB.mjs";
3
+ import { C as Combinable, S as Deferred, _ as Logged, a as State, b as EventBus, c as RemoteData, d as Predicate, f as Pair, g as Maybe, h as Op, l as Refinement, m as Optional, n as Task, o as Result, p as Ordering, r as Validation, s as Resource, t as These, u as Reader, v as Lens, x as Equality, y as Lazy } from "./Core-BCN6WRzp.mjs";
4
4
  import { Arr, BigNum, Bool, Dict, Json, Num, Rec, Str, Uniq } from "./data.mjs";
5
- export { Arr, BigNum, Bool, Brand, Combinable, Deferred, Dict, Duration, Equality, Json, Lazy, Lens, Logged, Maybe, Num, Op, Optional, Ordering, Pair, Predicate, Reader, Rec, Refinement, RemoteData, Resource, Result, RetryPolicy, State, Str, Stream, Task, These, Uniq, Validation, 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 };
5
+ export { Arr, BigNum, Bool, Brand, Combinable, Deferred, Dict, Duration, Equality, EventBus, Json, Lazy, Lens, Logged, Maybe, Num, Op, Optional, Ordering, Pair, Predicate, Reader, Rec, Refinement, RemoteData, Resource, Result, RetryPolicy, State, Str, Task, These, Uniq, Validation, 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 };
package/dist/types.cjs CHANGED
@@ -51,6 +51,7 @@ const RetryPolicy = {
51
51
  * Creates a RetryPolicy with exponential backoff delays between attempts.
52
52
  * An optional `factor` (default 2) controls the growth rate.
53
53
  * An optional `jitter` (default false) adds randomized variance to prevent thundering herd problems.
54
+ * An optional `maxDelay` caps the maximum duration between retry attempts.
54
55
  *
55
56
  * @example
56
57
  * ```ts
@@ -59,6 +60,7 @@ const RetryPolicy = {
59
60
  * initial: Duration.milliseconds(100),
60
61
  * factor: 2,
61
62
  * jitter: true,
63
+ * maxDelay: Duration.seconds(5),
62
64
  * });
63
65
  * ```
64
66
  */
@@ -67,11 +69,13 @@ const RetryPolicy = {
67
69
  const initialMs = Duration.to.milliseconds(options.initial);
68
70
  const factor = options.factor ?? 2;
69
71
  const jitter = options.jitter ?? false;
72
+ const maxMs = options.maxDelay ? Duration.to.milliseconds(options.maxDelay) : void 0;
70
73
  return {
71
74
  attempts,
72
75
  getDelay: (attempt) => {
73
76
  const rawMs = initialMs * factor ** Math.max(0, attempt - 1);
74
- const finalMs = jitter ? Math.random() * rawMs : rawMs;
77
+ const cappedMs = maxMs !== void 0 ? Math.min(rawMs, maxMs) : rawMs;
78
+ const finalMs = jitter ? Math.random() * cappedMs : cappedMs;
75
79
  return Duration.milliseconds(finalMs);
76
80
  }
77
81
  };
package/dist/types.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as Duration, r as Brand, t as RetryPolicy } from "./index-Bs8En5LJ.cjs";
1
+ import { n as Duration, r as Brand, t as RetryPolicy } from "./index-CTe9CCHY.cjs";
2
2
  export { Brand, Duration, RetryPolicy };
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as Duration, r as Brand, t as RetryPolicy } from "./index-Bs8En5LJ.js";
1
+ import { n as Duration, r as Brand, t as RetryPolicy } from "./index-CTe9CCHY.js";
2
2
  export { Brand, Duration, RetryPolicy };
package/dist/types.mjs CHANGED
@@ -50,6 +50,7 @@ const RetryPolicy = {
50
50
  * Creates a RetryPolicy with exponential backoff delays between attempts.
51
51
  * An optional `factor` (default 2) controls the growth rate.
52
52
  * An optional `jitter` (default false) adds randomized variance to prevent thundering herd problems.
53
+ * An optional `maxDelay` caps the maximum duration between retry attempts.
53
54
  *
54
55
  * @example
55
56
  * ```ts
@@ -58,6 +59,7 @@ const RetryPolicy = {
58
59
  * initial: Duration.milliseconds(100),
59
60
  * factor: 2,
60
61
  * jitter: true,
62
+ * maxDelay: Duration.seconds(5),
61
63
  * });
62
64
  * ```
63
65
  */
@@ -66,11 +68,13 @@ const RetryPolicy = {
66
68
  const initialMs = Duration.to.milliseconds(options.initial);
67
69
  const factor = options.factor ?? 2;
68
70
  const jitter = options.jitter ?? false;
71
+ const maxMs = options.maxDelay ? Duration.to.milliseconds(options.maxDelay) : void 0;
69
72
  return {
70
73
  attempts,
71
74
  getDelay: (attempt) => {
72
75
  const rawMs = initialMs * factor ** Math.max(0, attempt - 1);
73
- const finalMs = jitter ? Math.random() * rawMs : rawMs;
76
+ const cappedMs = maxMs !== void 0 ? Math.min(rawMs, maxMs) : rawMs;
77
+ const finalMs = jitter ? Math.random() * cappedMs : cappedMs;
74
78
  return Duration.milliseconds(finalMs);
75
79
  }
76
80
  };
package/package.json CHANGED
@@ -1,29 +1,26 @@
1
1
  {
2
2
  "name": "@nlozgachev/pipelined",
3
- "version": "0.65.0",
3
+ "version": "0.67.0",
4
4
  "description": "Opinionated functional abstractions for TypeScript",
5
- "license": "BSD-3-Clause",
5
+ "keywords": [
6
+ "composition",
7
+ "fp",
8
+ "functional",
9
+ "pipe",
10
+ "typescript"
11
+ ],
6
12
  "homepage": "https://pipelined.lozgachev.dev",
13
+ "license": "BSD-3-Clause",
7
14
  "repository": {
8
15
  "type": "git",
9
16
  "url": "git+https://github.com/nlozgachev/pipelined.git"
10
17
  },
11
- "keywords": [
12
- "functional",
13
- "fp",
14
- "typescript",
15
- "composition",
16
- "pipe"
17
- ],
18
- "types": "./dist/index.d.ts",
19
- "type": "module",
20
- "sideEffects": false,
21
- "engines": {
22
- "node": ">=18.0.0"
23
- },
24
18
  "files": [
25
19
  "dist"
26
20
  ],
21
+ "type": "module",
22
+ "sideEffects": false,
23
+ "types": "./dist/index.d.ts",
27
24
  "imports": {
28
25
  "#core": "./src/Core/index.ts",
29
26
  "#data": "./src/Data/index.ts",
@@ -80,6 +77,8 @@
80
77
  "bench": "vitest bench",
81
78
  "size": "size-limit",
82
79
  "typecheck": "tsc --noEmit",
80
+ "typecheck:dev": "tsc --noEmit --watch",
81
+ "typecheck:min": "pnpm dlx --package typescript@5.5 tsc --noEmit --skipLibCheck",
83
82
  "publish:npm": "pnpm build && npm publish --access public",
84
83
  "lint": "oxlint src/",
85
84
  "format": "dprint fmt && dprint fmt --config dprint.md.json \"docs/**/*.md\" \"docs/**/*.mdx\" \"README.md\"",
@@ -98,7 +97,7 @@
98
97
  "esbuild": "0.28.2",
99
98
  "fast-check": "4.10.2",
100
99
  "oxlint": "1.87.0",
101
- "publint": "0.3.24",
100
+ "publint": "0.3.25",
102
101
  "size-limit": "14.1.0",
103
102
  "tsdown": "0.23.0",
104
103
  "typescript": "6.0.3",
@@ -127,7 +126,7 @@
127
126
  "name": "Data (import * as Data)",
128
127
  "import": "*",
129
128
  "path": "dist/data.mjs",
130
- "limit": "7 KB",
129
+ "limit": "10 KB",
131
130
  "gzip": true
132
131
  },
133
132
  {
@@ -145,9 +144,11 @@
145
144
  "name": "Types (import * as Types)",
146
145
  "import": "*",
147
146
  "path": "dist/types.mjs",
148
- "limit": "400 B",
147
+ "limit": "450 B",
149
148
  "gzip": true
150
149
  }
151
150
  ],
152
- "packageManager": "pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621"
151
+ "engines": {
152
+ "node": ">=18.0.0"
153
+ }
153
154
  }