@flux-control/effect-modbus-rs 0.3.0 → 0.4.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.
@@ -18,11 +18,11 @@ export type ModbusErrorTag = ModbusError['_tag'];
18
18
  */
19
19
  export interface RetryDelayOptions {
20
20
  /** Delay before the first retry. */
21
- readonly baseDelay?: Duration.DurationInput;
21
+ readonly baseDelay?: Duration.Input;
22
22
  /** Multiplier applied to the delay after each attempt. */
23
23
  readonly factor?: number;
24
24
  /** Upper bound on the delay, whatever the attempt count. */
25
- readonly maxDelay?: Duration.DurationInput;
25
+ readonly maxDelay?: Duration.Input;
26
26
  }
27
27
  /**
28
28
  * Per-error retry configuration.
@@ -50,7 +50,7 @@ export interface ModbusRetryPolicyOptions {
50
50
  /** Maximum number of retries (attempts = `maxRetries + 1`). Default `3`. */
51
51
  readonly maxRetries?: number;
52
52
  /** Wall-clock budget for the whole retry sequence. Unbounded by default. */
53
- readonly maxElapsed?: Duration.DurationInput;
53
+ readonly maxElapsed?: Duration.Input;
54
54
  /**
55
55
  * Randomness applied to each delay, as a multiplier range.
56
56
  *
@@ -58,18 +58,18 @@ export interface ModbusRetryPolicyOptions {
58
58
  * an object customises the range. Jitter keeps a fleet of pollers from
59
59
  * re-hitting a recovering device in lockstep.
60
60
  *
61
- * @see Schedule.jitteredWith — The underlying combinator.
61
+ * @see Schedule.jittered — The underlying combinator.
62
62
  */
63
63
  readonly jitter?: boolean | {
64
64
  readonly min?: number;
65
65
  readonly max?: number;
66
66
  };
67
67
  /** Policy-level delay before the first retry. Default `100 millis`. */
68
- readonly baseDelay?: Duration.DurationInput;
68
+ readonly baseDelay?: Duration.Input;
69
69
  /** Policy-level backoff multiplier. Default `2`. */
70
70
  readonly factor?: number;
71
71
  /** Policy-level delay ceiling. Default `5 seconds`. */
72
- readonly maxDelay?: Duration.DurationInput;
72
+ readonly maxDelay?: Duration.Input;
73
73
  /**
74
74
  * Which {@link ModbusError} variants are retryable, with optional
75
75
  * per-error backoff overrides.
@@ -101,9 +101,12 @@ export interface ModbusRetryPolicyOptions {
101
101
  export interface ModbusRetryPolicy {
102
102
  /**
103
103
  * Schedule driving the retries. Its input is the failing {@link ModbusError},
104
- * its output the `[retryIndex, error]` pair that produced the delay.
104
+ * its output the zero-based retry index.
105
+ *
106
+ * v4 exposes the failing input on the schedule metadata, so the output no
107
+ * longer needs to carry the `[retryIndex, error]` pair v3 produced.
105
108
  */
106
- readonly schedule: Schedule.Schedule<[number, ModbusError], ModbusError>;
109
+ readonly schedule: Schedule.Schedule<number, ModbusError>;
107
110
  /** Whether this policy retries the given error at all. */
108
111
  readonly isRetryable: (error: ModbusError) => boolean;
109
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flux-control/effect-modbus-rs",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Type-safe Modbus communication via Effect-TS, wrapping the modbus-rs npm bindings.",
5
5
  "license": "GPL-3.0",
6
6
  "repository": {
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@changesets/cli": "^2.31.1",
45
- "@effect/language-service": "^0.86.6",
46
- "@effect/platform-bun": "^0.90.0",
45
+ "@effect/language-service": "0.87.2",
46
+ "@effect/platform-bun": "^4.0.0-rc.109",
47
47
  "@types/bun": "latest",
48
- "effect": "^3.22.0",
48
+ "effect": "^4.0.0-rc.109",
49
49
  "fallow": "^2.104.0",
50
50
  "husky": "^9.1.7",
51
51
  "oxfmt": "^0.60.0",
@@ -53,6 +53,6 @@
53
53
  "typescript": "^7.0.2"
54
54
  },
55
55
  "peerDependencies": {
56
- "effect": "^3.22.0"
56
+ "effect": "^4.0.0-rc.109"
57
57
  }
58
58
  }