effect 3.12.11 → 3.13.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.
Files changed (204) hide show
  1. package/README.md +38 -49
  2. package/dist/cjs/Channel.js.map +1 -1
  3. package/dist/cjs/DateTime.js +17 -1
  4. package/dist/cjs/DateTime.js.map +1 -1
  5. package/dist/cjs/Differ.js.map +1 -1
  6. package/dist/cjs/Duration.js +128 -1
  7. package/dist/cjs/Duration.js.map +1 -1
  8. package/dist/cjs/Effect.js +175 -37
  9. package/dist/cjs/Effect.js.map +1 -1
  10. package/dist/cjs/Either.js +2 -1
  11. package/dist/cjs/Either.js.map +1 -1
  12. package/dist/cjs/FiberHandle.js +54 -21
  13. package/dist/cjs/FiberHandle.js.map +1 -1
  14. package/dist/cjs/FiberMap.js +51 -24
  15. package/dist/cjs/FiberMap.js.map +1 -1
  16. package/dist/cjs/FiberSet.js +50 -17
  17. package/dist/cjs/FiberSet.js.map +1 -1
  18. package/dist/cjs/HashMap.js +19 -1
  19. package/dist/cjs/HashMap.js.map +1 -1
  20. package/dist/cjs/HashSet.js +9 -1
  21. package/dist/cjs/HashSet.js.map +1 -1
  22. package/dist/cjs/Layer.js +21 -1
  23. package/dist/cjs/Layer.js.map +1 -1
  24. package/dist/cjs/Match.js +659 -38
  25. package/dist/cjs/Match.js.map +1 -1
  26. package/dist/cjs/RcMap.js +11 -1
  27. package/dist/cjs/RcMap.js.map +1 -1
  28. package/dist/cjs/Reloadable.js.map +1 -1
  29. package/dist/cjs/STM.js.map +1 -1
  30. package/dist/cjs/Schedule.js +1074 -309
  31. package/dist/cjs/Schedule.js.map +1 -1
  32. package/dist/cjs/Schema.js +73 -1
  33. package/dist/cjs/Schema.js.map +1 -1
  34. package/dist/cjs/Stream.js.map +1 -1
  35. package/dist/cjs/internal/channel.js.map +1 -1
  36. package/dist/cjs/internal/core-effect.js.map +1 -1
  37. package/dist/cjs/internal/core.js +27 -3
  38. package/dist/cjs/internal/core.js.map +1 -1
  39. package/dist/cjs/internal/dateTime.js +4 -1
  40. package/dist/cjs/internal/dateTime.js.map +1 -1
  41. package/dist/cjs/internal/differ.js +4 -0
  42. package/dist/cjs/internal/differ.js.map +1 -1
  43. package/dist/cjs/internal/effect/circular.js +3 -2
  44. package/dist/cjs/internal/effect/circular.js.map +1 -1
  45. package/dist/cjs/internal/fiberRuntime.js +21 -7
  46. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  47. package/dist/cjs/internal/hashMap.js +10 -1
  48. package/dist/cjs/internal/hashMap.js.map +1 -1
  49. package/dist/cjs/internal/keyedPool.js +1 -1
  50. package/dist/cjs/internal/keyedPool.js.map +1 -1
  51. package/dist/cjs/internal/layer.js.map +1 -1
  52. package/dist/cjs/internal/rcMap.js +86 -56
  53. package/dist/cjs/internal/rcMap.js.map +1 -1
  54. package/dist/cjs/internal/reloadable.js.map +1 -1
  55. package/dist/cjs/internal/schedule.js.map +1 -1
  56. package/dist/cjs/internal/sink.js.map +1 -1
  57. package/dist/cjs/internal/stm/stm.js.map +1 -1
  58. package/dist/cjs/internal/stream.js.map +1 -1
  59. package/dist/cjs/internal/version.js +1 -1
  60. package/dist/cjs/internal/version.js.map +1 -1
  61. package/dist/dts/Channel.d.ts +4 -4
  62. package/dist/dts/Channel.d.ts.map +1 -1
  63. package/dist/dts/DateTime.d.ts +16 -0
  64. package/dist/dts/DateTime.d.ts.map +1 -1
  65. package/dist/dts/Differ.d.ts +2 -1
  66. package/dist/dts/Differ.d.ts.map +1 -1
  67. package/dist/dts/Duration.d.ts +64 -0
  68. package/dist/dts/Duration.d.ts.map +1 -1
  69. package/dist/dts/Effect.d.ts +402 -30
  70. package/dist/dts/Effect.d.ts.map +1 -1
  71. package/dist/dts/Either.d.ts +7 -0
  72. package/dist/dts/Either.d.ts.map +1 -1
  73. package/dist/dts/FiberHandle.d.ts +26 -0
  74. package/dist/dts/FiberHandle.d.ts.map +1 -1
  75. package/dist/dts/FiberMap.d.ts +26 -0
  76. package/dist/dts/FiberMap.d.ts.map +1 -1
  77. package/dist/dts/FiberSet.d.ts +25 -0
  78. package/dist/dts/FiberSet.d.ts.map +1 -1
  79. package/dist/dts/HashMap.d.ts +38 -0
  80. package/dist/dts/HashMap.d.ts.map +1 -1
  81. package/dist/dts/HashSet.d.ts +7 -0
  82. package/dist/dts/HashSet.d.ts.map +1 -1
  83. package/dist/dts/Layer.d.ts +32 -13
  84. package/dist/dts/Layer.d.ts.map +1 -1
  85. package/dist/dts/Match.d.ts +731 -48
  86. package/dist/dts/Match.d.ts.map +1 -1
  87. package/dist/dts/RcMap.d.ts +32 -0
  88. package/dist/dts/RcMap.d.ts.map +1 -1
  89. package/dist/dts/Reloadable.d.ts +13 -13
  90. package/dist/dts/Reloadable.d.ts.map +1 -1
  91. package/dist/dts/STM.d.ts +4 -4
  92. package/dist/dts/STM.d.ts.map +1 -1
  93. package/dist/dts/Schedule.d.ts +2294 -633
  94. package/dist/dts/Schedule.d.ts.map +1 -1
  95. package/dist/dts/Schema.d.ts +40 -4
  96. package/dist/dts/Schema.d.ts.map +1 -1
  97. package/dist/dts/Stream.d.ts +8 -8
  98. package/dist/dts/Stream.d.ts.map +1 -1
  99. package/dist/dts/Trie.d.ts +7 -7
  100. package/dist/dts/Trie.d.ts.map +1 -1
  101. package/dist/dts/index.d.ts +25 -0
  102. package/dist/dts/index.d.ts.map +1 -1
  103. package/dist/dts/internal/stm/stm.d.ts +2 -2
  104. package/dist/dts/internal/stm/stm.d.ts.map +1 -1
  105. package/dist/esm/Channel.js.map +1 -1
  106. package/dist/esm/DateTime.js +16 -0
  107. package/dist/esm/DateTime.js.map +1 -1
  108. package/dist/esm/Differ.js.map +1 -1
  109. package/dist/esm/Duration.js +124 -0
  110. package/dist/esm/Duration.js.map +1 -1
  111. package/dist/esm/Effect.js +170 -32
  112. package/dist/esm/Effect.js.map +1 -1
  113. package/dist/esm/Either.js +7 -0
  114. package/dist/esm/Either.js.map +1 -1
  115. package/dist/esm/FiberHandle.js +48 -18
  116. package/dist/esm/FiberHandle.js.map +1 -1
  117. package/dist/esm/FiberMap.js +46 -22
  118. package/dist/esm/FiberMap.js.map +1 -1
  119. package/dist/esm/FiberSet.js +45 -15
  120. package/dist/esm/FiberSet.js.map +1 -1
  121. package/dist/esm/HashMap.js +17 -0
  122. package/dist/esm/HashMap.js.map +1 -1
  123. package/dist/esm/HashSet.js +7 -0
  124. package/dist/esm/HashSet.js.map +1 -1
  125. package/dist/esm/Layer.js +20 -0
  126. package/dist/esm/Layer.js.map +1 -1
  127. package/dist/esm/Match.js +665 -40
  128. package/dist/esm/Match.js.map +1 -1
  129. package/dist/esm/RcMap.js +10 -0
  130. package/dist/esm/RcMap.js.map +1 -1
  131. package/dist/esm/Reloadable.js.map +1 -1
  132. package/dist/esm/STM.js.map +1 -1
  133. package/dist/esm/Schedule.js +1074 -309
  134. package/dist/esm/Schedule.js.map +1 -1
  135. package/dist/esm/Schema.js +71 -0
  136. package/dist/esm/Schema.js.map +1 -1
  137. package/dist/esm/Stream.js.map +1 -1
  138. package/dist/esm/index.js +25 -0
  139. package/dist/esm/index.js.map +1 -1
  140. package/dist/esm/internal/channel.js.map +1 -1
  141. package/dist/esm/internal/core-effect.js.map +1 -1
  142. package/dist/esm/internal/core.js +23 -0
  143. package/dist/esm/internal/core.js.map +1 -1
  144. package/dist/esm/internal/dateTime.js +2 -0
  145. package/dist/esm/internal/dateTime.js.map +1 -1
  146. package/dist/esm/internal/differ.js +4 -0
  147. package/dist/esm/internal/differ.js.map +1 -1
  148. package/dist/esm/internal/effect/circular.js +3 -2
  149. package/dist/esm/internal/effect/circular.js.map +1 -1
  150. package/dist/esm/internal/fiberRuntime.js +18 -5
  151. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  152. package/dist/esm/internal/hashMap.js +9 -0
  153. package/dist/esm/internal/hashMap.js.map +1 -1
  154. package/dist/esm/internal/keyedPool.js +1 -1
  155. package/dist/esm/internal/keyedPool.js.map +1 -1
  156. package/dist/esm/internal/layer.js.map +1 -1
  157. package/dist/esm/internal/rcMap.js +85 -55
  158. package/dist/esm/internal/rcMap.js.map +1 -1
  159. package/dist/esm/internal/reloadable.js.map +1 -1
  160. package/dist/esm/internal/schedule.js.map +1 -1
  161. package/dist/esm/internal/sink.js.map +1 -1
  162. package/dist/esm/internal/stm/stm.js.map +1 -1
  163. package/dist/esm/internal/stream.js.map +1 -1
  164. package/dist/esm/internal/version.js +1 -1
  165. package/dist/esm/internal/version.js.map +1 -1
  166. package/package.json +2 -1
  167. package/src/Channel.ts +14 -17
  168. package/src/DateTime.ts +17 -8
  169. package/src/Differ.ts +2 -1
  170. package/src/Duration.ts +147 -0
  171. package/src/Effect.ts +528 -140
  172. package/src/Either.ts +9 -0
  173. package/src/FiberHandle.ts +95 -35
  174. package/src/FiberMap.ts +104 -39
  175. package/src/FiberSet.ts +93 -24
  176. package/src/HashMap.ts +40 -0
  177. package/src/HashSet.ts +8 -0
  178. package/src/Layer.ts +94 -40
  179. package/src/Match.ts +733 -49
  180. package/src/RcMap.ts +34 -0
  181. package/src/Reloadable.ts +17 -27
  182. package/src/STM.ts +10 -17
  183. package/src/Schedule.ts +2325 -653
  184. package/src/Schema.ts +81 -4
  185. package/src/Stream.ts +26 -33
  186. package/src/Trie.ts +7 -7
  187. package/src/index.ts +25 -0
  188. package/src/internal/channel.ts +37 -39
  189. package/src/internal/core-effect.ts +84 -84
  190. package/src/internal/core.ts +80 -0
  191. package/src/internal/dateTime.ts +3 -0
  192. package/src/internal/differ.ts +4 -0
  193. package/src/internal/effect/circular.ts +3 -2
  194. package/src/internal/fiberRuntime.ts +31 -6
  195. package/src/internal/hashMap.ts +16 -0
  196. package/src/internal/keyedPool.ts +1 -1
  197. package/src/internal/layer.ts +52 -52
  198. package/src/internal/rcMap.ts +131 -89
  199. package/src/internal/reloadable.ts +25 -28
  200. package/src/internal/schedule.ts +29 -23
  201. package/src/internal/sink.ts +16 -15
  202. package/src/internal/stm/stm.ts +54 -46
  203. package/src/internal/stream.ts +100 -100
  204. package/src/internal/version.ts +1 -1
@@ -9,792 +9,1557 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
9
9
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
10
  /**
11
11
  * @since 2.0.0
12
- * @category symbols
12
+ * @category Symbols
13
13
  */
14
14
  const ScheduleTypeId = exports.ScheduleTypeId = internal.ScheduleTypeId;
15
15
  /**
16
16
  * @since 2.0.0
17
- * @category symbols
17
+ * @category Symbols
18
18
  */
19
19
  const ScheduleDriverTypeId = exports.ScheduleDriverTypeId = internal.ScheduleDriverTypeId;
20
20
  /**
21
- * Constructs a new `Schedule` with the specified `initial` state and the
22
- * specified `step` function.
21
+ * Creates a new schedule with a custom state and step function.
22
+ *
23
+ * **Details**
24
+ *
25
+ * This function constructs a `Schedule` by defining its initial state and a
26
+ * step function, which determines how the schedule progresses over time. The
27
+ * step function is called on each iteration with the current time, an input
28
+ * value, and the schedule's current state. It returns the next state, an output
29
+ * value, and a decision on whether the schedule should continue or stop.
30
+ *
31
+ * This function is useful for creating custom scheduling logic that goes beyond
32
+ * predefined schedules like fixed intervals or exponential backoff. It allows
33
+ * full control over how the schedule behaves at each step.
23
34
  *
24
35
  * @since 2.0.0
25
- * @category constructors
36
+ * @category Constructors
26
37
  */
27
38
  const makeWithState = exports.makeWithState = internal.makeWithState;
28
39
  /**
29
- * Returns `true` if the specified value is a `Schedule`, `false` otherwise.
40
+ * Checks whether a given value is a `Schedule`.
30
41
  *
31
42
  * @since 2.0.0
32
- * @category guards
43
+ * @category Guards
33
44
  */
34
45
  const isSchedule = exports.isSchedule = internal.isSchedule;
35
46
  /**
36
- * Returns a new schedule with the given delay added to every interval defined
37
- * by this schedule.
47
+ * Adds a delay to every interval in a schedule.
48
+ *
49
+ * **Details**
50
+ *
51
+ * This function modifies a given schedule by applying an additional delay to
52
+ * every interval it defines. The delay is determined by the provided function,
53
+ * which takes the schedule's output and returns a delay duration.
54
+ *
55
+ * @see {@link addDelayEffect} If you need to compute the delay using an effectful function.
38
56
  *
39
57
  * @since 2.0.0
40
- * @category utils
58
+ * @category Timing & Delay
41
59
  */
42
60
  const addDelay = exports.addDelay = internal.addDelay;
43
61
  /**
44
- * Returns a new schedule with the given effectfully computed delay added to
45
- * every interval defined by this schedule.
62
+ * Adds an effectfully computed delay to every interval in a schedule.
63
+ *
64
+ * **Details**
65
+ *
66
+ * This function modifies a given schedule by applying an additional delay to
67
+ * each interval, where the delay is determined by an effectful function. The
68
+ * function takes the schedule’s output and returns an effect that produces a
69
+ * delay duration.
70
+ *
71
+ * @see {@link addDelay} If you need to compute the delay using a pure function.
46
72
  *
47
73
  * @since 2.0.0
48
- * @category utils
74
+ * @category Timing & Delay
49
75
  */
50
76
  const addDelayEffect = exports.addDelayEffect = internal.addDelayEffect;
51
77
  /**
52
- * The same as `andThenEither`, but merges the output.
78
+ * Runs two schedules sequentially, merging their outputs.
79
+ *
80
+ * **Details**
81
+ *
82
+ * This function executes two schedules one after the other. The first schedule
83
+ * runs to completion, and then the second schedule begins execution. Unlike
84
+ * {@link andThenEither}, this function merges the outputs instead of wrapping
85
+ * them in `Either`, allowing both schedules to contribute their results
86
+ * directly.
87
+ *
88
+ * This is useful when a workflow consists of two phases where the second phase
89
+ * should start only after the first one has fully completed.
90
+ *
91
+ * @see {@link andThenEither} If you need to keep track of which schedule
92
+ * produced each result.
53
93
  *
54
94
  * @since 2.0.0
55
- * @category sequencing
95
+ * @category Sequential Composition
56
96
  */
57
97
  const andThen = exports.andThen = internal.andThen;
58
98
  /**
59
- * Returns a new schedule that first executes this schedule to completion, and
60
- * then executes the specified schedule to completion.
99
+ * Runs two schedules sequentially, collecting results in an `Either`.
100
+ *
101
+ * **Details**
102
+ *
103
+ * This function combines two schedules in sequence. The first schedule runs to
104
+ * completion, and then the second schedule starts and runs to completion as
105
+ * well. The outputs of both schedules are collected into an `Either` structure:
106
+ * - `Either.Left` contains the output of the second schedule.
107
+ * - `Either.Right` contains the output of the first schedule.
108
+ *
109
+ * This is useful when you need to switch from one schedule to another after the
110
+ * first one finishes, while still keeping track of which schedule produced each
111
+ * result.
112
+ *
113
+ * @see {@link andThen} If you need to merge the outputs of both schedules.
61
114
  *
62
115
  * @since 2.0.0
63
- * @category sequencing
116
+ * @category Sequential Composition
64
117
  */
65
118
  const andThenEither = exports.andThenEither = internal.andThenEither;
66
119
  /**
67
- * Returns a new schedule that maps this schedule to a constant output.
120
+ * Transforms a schedule to always produce a constant output.
121
+ *
122
+ * **Details**
123
+ *
124
+ * This function modifies a given schedule so that instead of returning its
125
+ * computed outputs, it always returns a constant value.
126
+ *
127
+ * This is useful when you need a schedule for timing but don’t care about its
128
+ * actual output, or when you want to standardize results across different
129
+ * scheduling strategies.
68
130
  *
69
131
  * @since 2.0.0
70
- * @category mapping
132
+ * @category Mapping
71
133
  */
72
134
  const as = exports.as = internal.as;
73
135
  /**
74
- * Returns a new schedule that maps the output of this schedule to unit.
136
+ * Transforms a schedule to always return `void` instead of its output.
137
+ *
138
+ * **Details**
139
+ *
140
+ * This function modifies a given schedule so that it no longer returns
141
+ * meaningful output—each execution produces `void`. This is useful when the
142
+ * schedule is used only for timing purposes and the actual output of the
143
+ * schedule is irrelevant.
144
+ *
145
+ * The schedule still determines when executions should occur, but the results
146
+ * are discarded.
75
147
  *
76
148
  * @since 2.0.0
77
- * @category constructors
149
+ * @category Mapping
78
150
  */
79
151
  const asVoid = exports.asVoid = internal.asVoid;
152
+ // TODO(4.0): rename to `zip`?
80
153
  /**
81
- * Returns a new schedule that has both the inputs and outputs of this and the
82
- * specified schedule.
154
+ * Combines two schedules, preserving both their inputs and outputs.
155
+ *
156
+ * **Details**
157
+ *
158
+ * This function merges two schedules so that both their input types and output
159
+ * types are retained. When executed, the resulting schedule will take inputs
160
+ * from both original schedules and produce a tuple containing both outputs.
161
+ *
162
+ * It recurs if either schedule wants to continue, using the shorter delay.
163
+ *
164
+ * This is useful when you want to track multiple schedules simultaneously,
165
+ * ensuring that both receive the same inputs and produce combined results.
83
166
  *
84
167
  * @since 2.0.0
85
- * @category utils
168
+ * @category Zipping
86
169
  */
87
170
  const bothInOut = exports.bothInOut = internal.bothInOut;
88
171
  /**
89
- * Returns a new schedule that passes each input and output of this schedule
90
- * to the specified function, and then determines whether or not to continue
91
- * based on the return value of the function.
172
+ * Filters schedule executions based on a custom condition.
173
+ *
174
+ * **Details**
175
+ *
176
+ * This function modifies a schedule by applying a custom test function to each
177
+ * input-output pair. The test function determines whether the schedule should
178
+ * continue or stop. If the function returns `true`, the schedule proceeds as
179
+ * usual; if it returns `false`, the schedule terminates.
180
+ *
181
+ * This is useful for conditional retries, custom stop conditions, or
182
+ * dynamically controlling execution based on observed inputs and outputs.
183
+ *
184
+ * @see {@link checkEffect} If you need to use an effectful test function.
92
185
  *
93
186
  * @since 2.0.0
94
- * @category utils
187
+ * @category Recurrence Conditions
95
188
  */
96
189
  const check = exports.check = internal.check;
97
190
  /**
98
- * Returns a new schedule that passes each input and output of this schedule
99
- * to the specified function, and then determines whether or not to continue
100
- * based on the return value of the function.
191
+ * Conditionally filters schedule executions using an effectful function.
192
+ *
193
+ * **Details**
194
+ *
195
+ * This function modifies a schedule by applying a custom effectful test
196
+ * function to each input-output pair. The test function determines whether the
197
+ * schedule should continue (`true`) or stop (`false`).
198
+ *
199
+ * This is useful when the decision to continue depends on external factors such
200
+ * as database lookups, API calls, or other asynchronous computations.
201
+ *
202
+ * @see {@link check} If you need to use a pure test function.
101
203
  *
102
204
  * @since 2.0.0
103
- * @category utils
205
+ * @category Recurrence Conditions
104
206
  */
105
207
  const checkEffect = exports.checkEffect = internal.checkEffect;
106
208
  /**
107
- * A schedule that recurs anywhere, collecting all inputs into a `Chunk`.
209
+ * A schedule that collects all inputs into a `Chunk`.
210
+ *
211
+ * **Details**
212
+ *
213
+ * This function creates a schedule that never terminates and continuously
214
+ * collects every input it receives into a `Chunk`. Each time the schedule runs,
215
+ * it appends the new input to the collected list.
216
+ *
217
+ * This is useful when you need to track all received inputs over time, such as
218
+ * logging user actions, recording retry attempts, or accumulating data for
219
+ * later processing.
220
+ *
221
+ * @see {@link collectAllOutputs} If you need to collect outputs instead of
222
+ * inputs.
108
223
  *
109
224
  * @since 2.0.0
110
- * @category constructors
225
+ * @category Collecting
111
226
  */
112
227
  const collectAllInputs = exports.collectAllInputs = internal.collectAllInputs;
113
228
  /**
114
- * Returns a new schedule that collects the outputs of this one into a chunk.
229
+ * Collects all outputs of a schedule into a `Chunk`.
230
+ *
231
+ * **Details**
232
+ *
233
+ * This function modifies a given schedule so that instead of returning
234
+ * individual outputs, it accumulates them into a `Chunk`. The schedule
235
+ * continues to run, appending each output to the collected list.
236
+ *
237
+ * This is useful when you need to track all results over time, such as logging
238
+ * outputs, aggregating data, or keeping a history of previous values.
239
+ *
240
+ * @see {@link collectAllInputs} If you need to collect inputs instead of
241
+ * outputs.
115
242
  *
116
243
  * @since 2.0.0
117
- * @category utils
244
+ * @category Collecting
118
245
  */
119
246
  const collectAllOutputs = exports.collectAllOutputs = internal.collectAllOutputs;
120
247
  /**
121
- * A schedule that recurs until the condition f fails, collecting all inputs
122
- * into a list.
248
+ * Collects all inputs into a `Chunk` until a condition fails.
249
+ *
250
+ * **Details**
251
+ *
252
+ * This function creates a schedule that continuously collects inputs into a
253
+ * `Chunk` until the given predicate function `f` evaluates to `false`. Once the
254
+ * condition fails, the schedule stops.
123
255
  *
124
256
  * @since 2.0.0
125
- * @category utils
257
+ * @category Collecting
126
258
  */
127
259
  const collectUntil = exports.collectUntil = internal.collectUntil;
128
260
  /**
129
- * A schedule that recurs until the effectful condition f fails, collecting
130
- * all inputs into a list.
261
+ * Collects all inputs into a `Chunk` until an effectful condition fails.
262
+ *
263
+ * **Details**
264
+ *
265
+ * This function creates a schedule that continuously collects inputs into a
266
+ * `Chunk` until the given effectful predicate `f` returns `false`. The
267
+ * predicate runs as an effect, meaning it can involve asynchronous computations
268
+ * like API calls, database lookups, or randomness.
131
269
  *
132
270
  * @since 2.0.0
133
- * @category utils
271
+ * @category Collecting
134
272
  */
135
273
  const collectUntilEffect = exports.collectUntilEffect = internal.collectUntilEffect;
136
274
  /**
137
- * A schedule that recurs as long as the condition f holds, collecting all
138
- * inputs into a list.
275
+ * Collects all inputs into a `Chunk` while a condition holds.
276
+ *
277
+ * **Details**
278
+ *
279
+ * This function creates a schedule that continuously collects inputs into a
280
+ * `Chunk` while the given predicate function `f` evaluates to `true`. As soon
281
+ * as the condition fails, the schedule stops.
139
282
  *
140
283
  * @since 2.0.0
141
- * @category utils
284
+ * @category Collecting
142
285
  */
143
286
  const collectWhile = exports.collectWhile = internal.collectWhile;
144
287
  /**
145
- * A schedule that recurs as long as the effectful condition holds, collecting
146
- * all inputs into a list.
288
+ * Collects all inputs into a `Chunk` while an effectful condition holds.
289
+ *
290
+ * **Details**
291
+ *
292
+ * This function creates a schedule that continuously collects inputs into a
293
+ * `Chunk` while the given effectful predicate `f` returns `true`. The predicate
294
+ * returns an effect, meaning it can depend on external state, such as database
295
+ * queries, API responses, or real-time user conditions.
296
+ *
297
+ * As soon as the effectful condition returns `false`, the schedule stops. This
298
+ * is useful for dynamically controlled data collection, where stopping depends
299
+ * on an external or asynchronous factor.
147
300
  *
148
- * @category utils
149
301
  * @since 2.0.0
302
+ * @category Collecting
150
303
  */
151
304
  const collectWhileEffect = exports.collectWhileEffect = internal.collectWhileEffect;
152
305
  /**
153
- * Returns the composition of this schedule and the specified schedule, by
154
- * piping the output of this one into the input of the other. Effects
155
- * described by this schedule will always be executed before the effects
156
- * described by the second schedule.
306
+ * Chains two schedules, passing the output of the first as the input to the
307
+ * second, while selecting the shorter delay between them.
308
+ *
309
+ * **Details**
310
+ *
311
+ * This function composes two schedules so that the output of the first schedule
312
+ * becomes the input of the second schedule. The first schedule executes first,
313
+ * and once it produces a result, the second schedule receives that result and
314
+ * continues execution based on it.
315
+ *
316
+ * This is useful for building complex scheduling workflows where one schedule's
317
+ * behavior determines how the next schedule behaves.
157
318
  *
158
319
  * @since 2.0.0
159
- * @category utils
320
+ * @category Composition
160
321
  */
161
322
  const compose = exports.compose = internal.compose;
162
323
  /**
163
- * Returns a new schedule that deals with a narrower class of inputs than this
164
- * schedule.
324
+ * Transforms the input type of a schedule.
325
+ *
326
+ * **Details**
327
+ *
328
+ * This function modifies a given schedule by applying a transformation function
329
+ * to its inputs. Instead of directly receiving values of type `In`, the
330
+ * schedule will now accept values of type `In2`, which are converted to `In`
331
+ * using the provided mapping function `f`.
332
+ *
333
+ * This is useful when you have a schedule that expects a specific input type
334
+ * but you need to adapt it to work with a different type.
335
+ *
336
+ * @see {@link mapInputEffect} If you need to use an effectful transformation function.
165
337
  *
166
338
  * @since 2.0.0
167
- * @category mapping
339
+ * @category Mapping
168
340
  */
169
341
  const mapInput = exports.mapInput = internal.mapInput;
170
342
  /**
171
- * Transforms the context being provided to this schedule with the
172
- * specified function.
343
+ * Transforms the input type of a schedule using an effectful function.
344
+ *
345
+ * **Details**
346
+ *
347
+ * This function modifies a schedule by applying an effectful transformation to
348
+ * its inputs. Instead of directly receiving values of type `In`, the schedule
349
+ * will now accept values of type `In2`, which are converted to `In` via an
350
+ * effectful function `f`.
351
+ *
352
+ * This is useful when the input transformation involves external dependencies,
353
+ * such as API calls, database lookups, or other asynchronous computations.
354
+ *
355
+ * @see {@link mapInput} If you need to use a pure transformation function.
173
356
  *
174
357
  * @since 2.0.0
175
- * @category context
358
+ * @category Mapping
176
359
  */
177
- const mapInputContext = exports.mapInputContext = internal.mapInputContext;
360
+ const mapInputEffect = exports.mapInputEffect = internal.mapInputEffect;
178
361
  /**
179
- * Returns a new schedule that deals with a narrower class of inputs than this
180
- * schedule.
362
+ * Transforms the required context of a schedule.
363
+ *
364
+ * **Details**
365
+ *
366
+ * This function modifies a schedule by mapping its required context (`R`) into
367
+ * a new context (`R0`) using the provided function `f`.
368
+ *
369
+ * This is useful when you need to adapt a schedule to work with a different
370
+ * dependency environment without changing its core logic.
181
371
  *
182
372
  * @since 2.0.0
183
- * @category mapping
373
+ * @category Mapping
184
374
  */
185
- const mapInputEffect = exports.mapInputEffect = internal.mapInputEffect;
375
+ const mapInputContext = exports.mapInputContext = internal.mapInputContext;
186
376
  /**
187
- * A schedule that always recurs, which counts the number of recurrences.
377
+ * A schedule that recurs indefinitely, counting the number of recurrences.
378
+ *
379
+ * **Details**
380
+ *
381
+ * This schedule never stops and simply counts how many times it has executed.
382
+ * Each recurrence increases the count, starting from `0`.
383
+ *
384
+ * This is useful when tracking the number of attempts in retry policies,
385
+ * measuring execution loops, or implementing infinite polling scenarios.
188
386
  *
189
387
  * @since 2.0.0
190
- * @category constructors
388
+ * @category Constructors
191
389
  */
192
390
  const count = exports.count = internal.count;
193
391
  /**
194
- * Cron schedule that recurs every interval that matches the schedule.
392
+ * Creates a schedule that recurs based on a cron expression.
195
393
  *
196
- * It triggers at the beginning of each cron interval, producing the timestamps of the cron window.
394
+ * **Details**
197
395
  *
198
- * NOTE: `expression` parameter is validated lazily. Must be a valid cron expression.
396
+ * This schedule automatically executes at intervals defined by a cron
397
+ * expression. It triggers at the beginning of each matched interval and
398
+ * produces timestamps representing the start and end of the cron window.
399
+ *
400
+ * The cron `expression` is validated lazily, meaning errors may only be
401
+ * detected when the schedule is executed.
199
402
  *
200
403
  * @since 2.0.0
201
- * @category constructors
404
+ * @category Cron
202
405
  */
203
406
  const cron = exports.cron = internal.cron;
204
407
  /**
205
- * Cron-like schedule that recurs every specified `day` of month. Won't recur
206
- * on months containing less days than specified in `day` param.
408
+ * Cron-like schedule that recurs at a specific second of each minute.
409
+ *
410
+ * **Details**
411
+ *
412
+ * This schedule triggers at the specified `second` of each minute,
413
+ * starting at zero nanoseconds. It produces a count of executions
414
+ * (0, 1, 2, ...). The `second` parameter is validated lazily, meaning
415
+ * invalid values will only be caught at runtime.
416
+ *
417
+ * @since 2.0.0
418
+ * @category Cron
419
+ */
420
+ const secondOfMinute = exports.secondOfMinute = internal.secondOfMinute;
421
+ /**
422
+ * Creates a schedule that recurs every specified minute of each hour.
423
+ *
424
+ * **Details**
425
+ *
426
+ * This schedule triggers once per hour at the specified `minute`, starting
427
+ * exactly at `minute:00` (zero seconds). The schedule produces a count of
428
+ * executions (`0, 1, 2, ...`), representing how many times it has run.
429
+ *
430
+ * The `minute` parameter must be between `0` and `59`. It is validated lazily,
431
+ * meaning an invalid value will cause errors only when the schedule is
432
+ * executed.
433
+ *
434
+ * @since 2.0.0
435
+ * @category Cron
436
+ */
437
+ const minuteOfHour = exports.minuteOfHour = internal.minuteOfHour;
438
+ /**
439
+ * Creates a schedule that recurs at a specific hour of each day.
440
+ *
441
+ * **Details**
442
+ *
443
+ * This schedule triggers once per day at the specified `hour`, starting at zero
444
+ * minutes of that hour. The schedule produces a count of executions (`0, 1, 2,
445
+ * ...`), indicating how many times it has been triggered.
446
+ *
447
+ * The `hour` parameter must be between `0` (midnight) and `23` (11 PM). It is
448
+ * validated lazily, meaning an invalid value will cause errors only when the
449
+ * schedule is executed.
450
+ *
451
+ * This is useful for scheduling daily recurring tasks at a fixed time, such as
452
+ * running batch jobs or refreshing data.
453
+ *
454
+ * @since 2.0.0
455
+ * @category Cron
456
+ */
457
+ const hourOfDay = exports.hourOfDay = internal.hourOfDay;
458
+ /**
459
+ * Creates a schedule that recurs on a specific day of the month.
460
+ *
461
+ * **Details**
462
+ *
463
+ * This schedule triggers at midnight on the specified day of each month. It
464
+ * will not execute in months that have fewer days than the given day. For
465
+ * example, if the schedule is set to run on the 31st, it will not execute in
466
+ * months with only 30 days.
207
467
  *
208
- * It triggers at zero hour of the day. Producing a count of repeats: 0, 1, 2.
468
+ * The schedule produces a count of executions, starting at 0 and incrementing
469
+ * with each recurrence.
209
470
  *
210
- * NOTE: `day` parameter is validated lazily. Must be in range 1...31.
471
+ * The `day` parameter is validated lazily, meaning errors may only be detected
472
+ * when the schedule is executed.
211
473
  *
212
474
  * @since 2.0.0
213
- * @category constructors
475
+ * @category Cron
214
476
  */
215
477
  const dayOfMonth = exports.dayOfMonth = internal.dayOfMonth;
216
478
  /**
217
- * Cron-like schedule that recurs every specified `day` of each week. It
218
- * triggers at zero hour of the week. Producing a count of repeats: 0, 1, 2.
479
+ * Creates a schedule that recurs on a specific day of the week.
480
+ *
481
+ * **Details**
482
+ *
483
+ * This schedule triggers at midnight on the specified day of the week. The
484
+ * `day` parameter follows the standard convention where `Monday = 1` and
485
+ * `Sunday = 7`. The schedule produces a count of executions, starting at 0 and
486
+ * incrementing with each recurrence.
219
487
  *
220
- * NOTE: `day` parameter is validated lazily. Must be in range 1 (Monday)...7
221
- * (Sunday).
488
+ * The `day` parameter is validated lazily, meaning errors may only be detected
489
+ * when the schedule is executed.
222
490
  *
223
491
  * @since 2.0.0
224
- * @category constructors
492
+ * @category Cron
225
493
  */
226
494
  const dayOfWeek = exports.dayOfWeek = internal.dayOfWeek;
227
495
  /**
228
- * Returns a new schedule with the specified effectfully computed delay added
229
- * before the start of each interval produced by this schedule.
496
+ * Modifies a schedule by adding a computed delay before each execution.
497
+ *
498
+ * **Details**
499
+ *
500
+ * This function adjusts an existing schedule by applying a transformation to
501
+ * its delays. Instead of using the default interval, each delay is modified
502
+ * using the provided function `f`, which takes the current delay and returns a
503
+ * new delay.
504
+ *
505
+ * This is useful for dynamically adjusting wait times between executions, such
506
+ * as introducing jitter, exponential backoff, or custom delay logic.
507
+ *
508
+ * @see {@link delayedEffect} If you need to compute the delay using an effectful function.
230
509
  *
231
510
  * @since 2.0.0
232
- * @category utils
511
+ * @category Timing & Delay
233
512
  */
234
513
  const delayed = exports.delayed = internal.delayed;
235
514
  /**
236
- * Returns a new schedule with the specified effectfully computed delay added
237
- * before the start of each interval produced by this schedule.
515
+ * Modifies a schedule by adding an effectfully computed delay before each
516
+ * execution.
517
+ *
518
+ * **Details**
519
+ *
520
+ * This function adjusts an existing schedule by introducing a delay that is
521
+ * computed via an effect. Instead of using a fixed delay, each interval is
522
+ * dynamically adjusted based on an effectful function `f`, which takes the
523
+ * current delay and returns a new delay wrapped in an `Effect`.
524
+ *
525
+ * This is useful for adaptive scheduling where delays depend on external
526
+ * factors, such as API calls, database queries, or dynamic system conditions.
527
+ *
528
+ * @see {@link delayed} If you need to compute the delay using a pure function.
238
529
  *
239
530
  * @since 2.0.0
240
- * @category constructors
531
+ * @category Timing & Delay
241
532
  */
242
533
  const delayedEffect = exports.delayedEffect = internal.delayedEffect;
243
534
  /**
244
- * Takes a schedule that produces a delay, and returns a new schedule that
245
- * uses this delay to further delay intervals in the resulting schedule.
535
+ * Uses the delays produced by a schedule to further delay its intervals.
536
+ *
537
+ * **Details**
538
+ *
539
+ * This function modifies a schedule by using its own output delays to control
540
+ * its execution timing. Instead of executing immediately at each interval, the
541
+ * schedule will be delayed by the duration it produces.
246
542
  *
247
543
  * @since 2.0.0
248
- * @category constructors
544
+ * @category Timing & Delay
249
545
  */
250
546
  const delayedSchedule = exports.delayedSchedule = internal.delayedSchedule;
251
547
  /**
252
- * Returns a new schedule that outputs the delay between each occurence.
548
+ * Transforms a schedule to output the delay between each occurrence.
549
+ *
550
+ * **Details**
551
+ *
552
+ * This function modifies an existing schedule so that instead of producing its
553
+ * original output, it now returns the delay between each scheduled execution.
253
554
  *
254
555
  * @since 2.0.0
255
- * @category constructors
556
+ * @category Monitoring
256
557
  */
257
558
  const delays = exports.delays = internal.delays;
258
559
  /**
259
- * Returns a new schedule that maps both the input and output.
560
+ * Transforms both the input and output of a schedule.
561
+ *
562
+ * **Details**
563
+ *
564
+ * This function modifies an existing schedule by applying a transformation to
565
+ * both its input values and its output values. The provided transformation
566
+ * functions `onInput` and `onOutput` allow you to map the schedule to work with
567
+ * a different input type while modifying its outputs as well.
568
+ *
569
+ * @see {@link mapBothEffect} If you need to use effectful transformation functions.
260
570
  *
261
571
  * @since 2.0.0
262
- * @category mapping
572
+ * @category Mapping
263
573
  */
264
574
  const mapBoth = exports.mapBoth = internal.mapBoth;
265
575
  /**
266
- * Returns a new schedule that maps both the input and output.
576
+ * Transforms both the input and output of a schedule using effectful
577
+ * computations.
578
+ *
579
+ * **Details**
580
+ *
581
+ * This function modifies an existing schedule by applying effectful
582
+ * transformations to both its input values and its output values. The provided
583
+ * effectful functions `onInput` and `onOutput` allow you to transform inputs
584
+ * and outputs using computations that may involve additional logic, resource
585
+ * access, or side effects.
586
+ *
587
+ * @see {@link mapBoth} If you need to use pure transformation functions.
267
588
  *
268
589
  * @since 2.0.0
269
- * @category mapping
590
+ * @category Mapping
270
591
  */
271
592
  const mapBothEffect = exports.mapBothEffect = internal.mapBothEffect;
272
593
  /**
273
- * Returns a driver that can be used to step the schedule, appropriately
274
- * handling sleeping.
594
+ * Creates a driver to manually control the execution of a schedule.
595
+ *
596
+ * **Details**
597
+ *
598
+ * This function returns a `ScheduleDriver`, which allows stepping through a
599
+ * schedule manually while handling delays and sleeping appropriately. A driver
600
+ * is useful when you need fine-grained control over how a schedule progresses,
601
+ * rather than relying on automatic execution.
602
+ *
603
+ * The returned driver exposes methods for retrieving the current state,
604
+ * executing the next step, and resetting the schedule when needed.
275
605
  *
276
606
  * @since 2.0.0
277
607
  * @category getter
278
608
  */
279
609
  const driver = exports.driver = internal.driver;
610
+ // TODO(4.0): remove?
280
611
  /**
281
- * A schedule that can recur one time, the specified amount of time into the
282
- * future.
612
+ * Alias of {@link fromDelay}.
283
613
  *
284
614
  * @since 2.0.0
285
- * @category constructors
615
+ * @category Constructors
286
616
  */
287
617
  const duration = exports.duration = internal.duration;
618
+ // TODO(4.0): remove?
288
619
  /**
289
- * Returns a new schedule that performs a geometric union on the intervals
290
- * defined by both schedules.
620
+ * Alias of {@link union}.
291
621
  *
292
622
  * @since 2.0.0
293
- * @category alternatives
623
+ * @category Alternatives
294
624
  */
295
625
  const either = exports.either = internal.either;
626
+ // TODO(4.0): remove?
296
627
  /**
297
- * The same as `either` followed by `map`.
628
+ * Alias of {@link unionWith}.
298
629
  *
299
630
  * @since 2.0.0
300
- * @category alternatives
631
+ * @category Alternatives
301
632
  */
302
633
  const eitherWith = exports.eitherWith = internal.eitherWith;
303
634
  /**
304
- * A schedule that occurs everywhere, which returns the total elapsed duration
305
- * since the first step.
635
+ * Creates a schedule that tracks the total elapsed duration since it started.
636
+ *
637
+ * **Details**
638
+ *
639
+ * This schedule executes continuously and returns the total time that has
640
+ * passed since the first execution. The duration keeps increasing with each
641
+ * step, providing a way to measure elapsed time.
642
+ *
643
+ * This is useful for tracking execution time, monitoring delays, or
644
+ * implementing logic based on how long a process has been running.
306
645
  *
307
646
  * @since 2.0.0
308
- * @category constructors
647
+ * @category Constructors
309
648
  */
310
649
  const elapsed = exports.elapsed = internal.elapsed;
311
650
  /**
312
- * Returns a new schedule that will run the specified finalizer as soon as the
313
- * schedule is complete. Note that unlike `Effect.ensuring`, this method does not
314
- * guarantee the finalizer will be run. The `Schedule` may not initialize or
315
- * the driver of the schedule may not run to completion. However, if the
316
- * `Schedule` ever decides not to continue, then the finalizer will be run.
651
+ * Attaches a finalizer to a schedule that runs when the schedule completes.
652
+ *
653
+ * **Details**
654
+ *
655
+ * This function returns a new schedule that executes a given finalizer when the
656
+ * schedule reaches completion. Unlike `Effect.ensuring`, this method does not
657
+ * guarantee the finalizer will run in all cases. If the schedule never
658
+ * initializes or is not driven to completion, the finalizer may not execute.
659
+ * However, if the schedule decides not to continue, the finalizer will be
660
+ * invoked.
661
+ *
662
+ * This is useful for cleaning up resources, logging, or executing other side
663
+ * effects when a schedule completes.
317
664
  *
318
665
  * @since 2.0.0
319
- * @category finalization
666
+ * @category Finalization
320
667
  */
321
668
  const ensuring = exports.ensuring = internal.ensuring;
322
669
  /**
323
- * A schedule that always recurs, but will wait a certain amount between
324
- * repetitions, given by `base * factor.pow(n)`, where `n` is the number of
325
- * repetitions so far. Returns the current duration between recurrences.
670
+ * Creates a schedule that recurs indefinitely with exponentially increasing
671
+ * delays.
672
+ *
673
+ * **Details**
674
+ *
675
+ * This schedule starts with an initial delay of `base` and increases the delay
676
+ * exponentially on each repetition using the formula `base * factor^n`, where
677
+ * `n` is the number of times the schedule has executed so far. If no `factor`
678
+ * is provided, it defaults to `2`, causing the delay to double after each
679
+ * execution.
326
680
  *
327
681
  * @since 2.0.0
328
- * @category constructors
682
+ * @category Constructors
329
683
  */
330
684
  const exponential = exports.exponential = internal.exponential;
331
685
  /**
332
- * A schedule that always recurs, increasing delays by summing the preceding
333
- * two delays (similar to the fibonacci sequence). Returns the current
334
- * duration between recurrences.
686
+ * Creates a schedule that recurs indefinitely with Fibonacci-based increasing
687
+ * delays.
688
+ *
689
+ * **Details**
690
+ *
691
+ * This schedule starts with an initial delay of `one` and increases subsequent
692
+ * delays by summing the two previous delays, following the Fibonacci sequence.
693
+ * The delay pattern follows: `one, one, one + one, (one + one) + one, ...`,
694
+ * resulting in `1s, 1s, 2s, 3s, 5s, 8s, 13s, ...` if `one = 1s`.
695
+ *
696
+ * This is useful for progressive backoff strategies, where delays grow
697
+ * naturally over time without increasing as aggressively as an exponential
698
+ * schedule.
335
699
  *
336
700
  * @since 2.0.0
337
- * @category constructors
701
+ * @category Constructors
338
702
  */
339
703
  const fibonacci = exports.fibonacci = internal.fibonacci;
340
704
  /**
341
- * A schedule that recurs on a fixed interval. Returns the number of
342
- * repetitions of the schedule so far.
705
+ * Creates a schedule that recurs at a fixed interval.
343
706
  *
344
- * If the action run between updates takes longer than the interval, then the
345
- * action will be run immediately, but re-runs will not "pile up".
707
+ * **Details**
708
+ *
709
+ * This schedule executes at regular, evenly spaced intervals, returning the
710
+ * number of times it has run so far. If the action being executed takes longer
711
+ * than the interval, the next execution will happen immediately to prevent
712
+ * "pile-ups," ensuring that the schedule remains consistent without overlapping
713
+ * executions.
346
714
  *
347
715
  * ```
348
716
  * |-----interval-----|-----interval-----|-----interval-----|
349
717
  * |---------action--------||action|-----|action|-----------|
350
718
  * ```
351
719
  *
720
+ * @see {@link spaced} If you need to run from the end of the last execution.
721
+ *
352
722
  * @since 2.0.0
353
- * @category constructors
723
+ * @category Constructors
354
724
  */
355
725
  const fixed = exports.fixed = internal.fixed;
356
726
  /**
357
- * A schedule that always recurs, producing a count of repeats: 0, 1, 2.
727
+ * Creates a schedule that recurs indefinitely, producing a count of
728
+ * repetitions.
729
+ *
730
+ * **Details**
731
+ *
732
+ * This schedule runs indefinitely, returning an increasing count of executions
733
+ * (`0, 1, 2, 3, ...`). Each step increments the count by one, allowing tracking
734
+ * of how many times it has executed.
358
735
  *
359
736
  * @since 2.0.0
360
- * @category constructors
737
+ * @category Constructors
361
738
  */
362
739
  const forever = exports.forever = internal.forever;
363
740
  /**
364
- * A schedule that recurs once with the specified delay.
741
+ * Creates a schedule that recurs once after a specified duration.
742
+ *
743
+ * **Details**
744
+ *
745
+ * This schedule executes a single time after waiting for the given duration.
746
+ * Once it has executed, it does not repeat.
747
+ *
748
+ * @see {@link fromDelays} If you need to create a schedule with multiple delays.
365
749
  *
366
750
  * @since 2.0.0
367
- * @category constructors
751
+ * @category Constructors
368
752
  */
369
753
  const fromDelay = exports.fromDelay = internal.fromDelay;
370
754
  /**
371
- * A schedule that recurs once for each of the specified durations, delaying
372
- * each time for the length of the specified duration. Returns the length of
373
- * the current duration between recurrences.
755
+ * Creates a schedule that recurs once for each specified duration, applying the
756
+ * given delays sequentially.
757
+ *
758
+ * **Details**
759
+ *
760
+ * This schedule executes multiple times, each time waiting for the
761
+ * corresponding duration from the provided list of delays. The first execution
762
+ * waits for `delay`, the next for the second value in `delays`, and so on. Once
763
+ * all delays have been used, the schedule stops executing.
764
+ *
765
+ * This is useful for defining a custom delay sequence that does not follow a
766
+ * fixed pattern like exponential or Fibonacci backoff.
374
767
  *
375
768
  * @since 2.0.0
376
- * @category constructors
769
+ * @category Constructors
377
770
  */
378
771
  const fromDelays = exports.fromDelays = internal.fromDelays;
379
772
  /**
380
- * A schedule that always recurs, mapping input values through the specified
381
- * function.
773
+ * Creates a schedule that always recurs, transforming input values using the
774
+ * specified function.
775
+ *
776
+ * **Details**
777
+ *
778
+ * This schedule continuously executes and applies the given function `f` to
779
+ * each input value, producing a transformed output. The schedule itself does
780
+ * not control delays or stopping conditions; it simply transforms the input
781
+ * values as they are processed.
782
+ *
783
+ * This is useful when defining schedules that map inputs to outputs, allowing
784
+ * dynamic transformations of incoming data.
382
785
  *
383
786
  * @since 2.0.0
384
- * @category constructors
787
+ * @category Constructors
385
788
  */
386
789
  const fromFunction = exports.fromFunction = internal.fromFunction;
387
790
  /**
388
- * Cron-like schedule that recurs every specified `hour` of each day. It
389
- * triggers at zero minute of the hour. Producing a count of repeats: 0, 1, 2.
791
+ * Creates a schedule that always recurs, passing inputs directly as outputs.
792
+ *
793
+ * **Details**
390
794
  *
391
- * NOTE: `hour` parameter is validated lazily. Must be in range 0...23.
795
+ * This schedule runs indefinitely, returning each input value as its output
796
+ * without modification. It effectively acts as a pass-through that simply
797
+ * echoes its input values at each step.
392
798
  *
393
799
  * @since 2.0.0
394
- * @category constructors
800
+ * @category Constructors
395
801
  */
396
- const hourOfDay = exports.hourOfDay = internal.hourOfDay;
802
+ const identity = exports.identity = internal.identity;
397
803
  /**
398
- * A schedule that always recurs, which returns inputs as outputs.
804
+ * Transforms a schedule to pass through its inputs as outputs.
805
+ *
806
+ * **Details**
807
+ *
808
+ * This function modifies an existing schedule so that it returns its input
809
+ * values instead of its original output values. The schedule's timing remains
810
+ * unchanged, but its outputs are replaced with whatever inputs it receives.
399
811
  *
400
812
  * @since 2.0.0
401
- * @category constructors
402
813
  */
403
- const identity = exports.identity = internal.identity;
814
+ const passthrough = exports.passthrough = internal.passthrough;
404
815
  /**
405
- * Returns a new schedule that performs a geometric intersection on the
406
- * intervals defined by both schedules.
816
+ * Combines two schedules, continuing only if both schedules want to continue,
817
+ * using the longer delay.
818
+ *
819
+ * **Details**
820
+ *
821
+ * This function takes two schedules and creates a new schedule that only
822
+ * continues execution if both schedules allow it. The interval between
823
+ * recurrences is determined by the longer delay between the two schedules.
824
+ *
825
+ * The output of the resulting schedule is a tuple containing the outputs of
826
+ * both schedules. The input type is the intersection of both schedules' input
827
+ * types.
828
+ *
829
+ * This is useful when coordinating multiple scheduling conditions where
830
+ * execution should proceed only when both schedules permit it.
831
+ *
832
+ * @see {@link intersectWith} If you need to use a custom merge function.
407
833
  *
408
834
  * @since 2.0.0
409
- * @category utils
835
+ * @category Composition
410
836
  */
411
837
  const intersect = exports.intersect = internal.intersect;
412
838
  /**
413
- * Returns a new schedule that combines this schedule with the specified
414
- * schedule, continuing as long as both schedules want to continue and merging
415
- * the next intervals according to the specified merge function.
839
+ * Combines two schedules, continuing only if both want to continue, merging
840
+ * intervals using a custom function.
841
+ *
842
+ * **Details**
843
+ *
844
+ * This function takes two schedules and creates a new schedule that only
845
+ * continues execution if both schedules allow it. Instead of automatically
846
+ * using the longer delay (like {@link intersect}), this function applies a
847
+ * user-provided merge function `f` to determine the next interval between
848
+ * executions.
849
+ *
850
+ * The output of the resulting schedule is a tuple containing the outputs of
851
+ * both schedules, and the input type is the intersection of both schedules'
852
+ * input types.
416
853
  *
417
854
  * @since 2.0.0
418
- * @category utils
855
+ * @category Composition
419
856
  */
420
857
  const intersectWith = exports.intersectWith = internal.intersectWith;
421
858
  /**
422
- * Returns a new schedule that randomly modifies the size of the intervals of
423
- * this schedule.
859
+ * Returns a new schedule that randomly adjusts the interval size within a
860
+ * range.
861
+ *
862
+ * **Details**
424
863
  *
425
- * Defaults `min` to `0.8` and `max` to `1.2`.
864
+ * This function modifies a schedule so that its delay between executions is
865
+ * randomly varied within a range. By default, the delay is adjusted between
866
+ * `80%` (`0.8 * interval`) and `120%` (`1.2 * interval`) of the original
867
+ * interval size.
426
868
  *
427
- * The new interval size is between `min * old interval size` and `max * old
428
- * interval size`.
869
+ * This is useful for adding randomness to repeated executions, reducing
870
+ * contention in distributed systems, and avoiding synchronized execution
871
+ * patterns that can cause bottlenecks.
872
+ *
873
+ * @see {@link jitteredWith} If you need to specify custom min/max values.
429
874
  *
430
875
  * @since 2.0.0
431
- * @category constructors
876
+ * @category Timing & Delay
432
877
  */
433
878
  const jittered = exports.jittered = internal.jittered;
434
879
  /**
435
- * Returns a new schedule that randomly modifies the size of the intervals of
436
- * this schedule.
880
+ * Returns a new schedule that randomly adjusts the interval size within a
881
+ * user-defined range.
882
+ *
883
+ * **Details**
437
884
  *
438
- * The new interval size is between `min * old interval size` and `max * old
439
- * interval size`.
885
+ * This function modifies a schedule so that its delay between executions is
886
+ * randomly varied within a specified range. Instead of using the default `0.8 -
887
+ * 1.2` range like {@link jittered}, this function allows customizing the `min`
888
+ * and `max` multipliers.
889
+ *
890
+ * The delay for each step will be adjusted within `min * original_interval` and
891
+ * `max * original_interval`. If `min` and `max` are not provided, the defaults
892
+ * are `0.8` and `1.2`, respectively.
893
+ *
894
+ * This is useful for introducing randomness into scheduling behavior while
895
+ * having precise control over the jitter range.
440
896
  *
441
897
  * @since 2.0.0
442
- * @category constructors
898
+ * @category Timing & Delay
443
899
  */
444
900
  const jitteredWith = exports.jitteredWith = internal.jitteredWith;
445
901
  /**
446
- * A schedule that always recurs, but will repeat on a linear time interval,
447
- * given by `base * n` where `n` is the number of repetitions so far. Returns
448
- * the current duration between recurrences.
902
+ * Creates a schedule that recurs indefinitely, increasing the delay linearly.
903
+ *
904
+ * **Details**
905
+ *
906
+ * This schedule starts with an initial delay of `base` and increases the delay
907
+ * on each recurrence in a linear fashion, following the formula:
908
+ *
909
+ * `delay = base * n`
910
+ *
911
+ * where `n` is the number of times the schedule has executed so far. This
912
+ * results in increasing intervals between executions.
913
+ *
914
+ * This is useful for implementing linear backoff strategies where the wait time
915
+ * between retries increases at a steady rate.
449
916
  *
450
917
  * @since 2.0.0
451
- * @category constructors
918
+ * @category Constructors
452
919
  */
453
920
  const linear = exports.linear = internal.linear;
454
921
  /**
455
- * Returns a new schedule that maps the output of this schedule through the
456
- * specified function.
922
+ * Returns a new schedule that transforms its output using the specified
923
+ * function.
924
+ *
925
+ * **Details**
926
+ *
927
+ * This function modifies an existing schedule so that its outputs are
928
+ * transformed by the provided function `f`. The timing and recurrence behavior
929
+ * of the schedule remain unchanged, but the values it produces are mapped to
930
+ * new values.
931
+ *
932
+ * This is useful when composing schedules where you need to adjust the output
933
+ * format or apply additional processing.
934
+ *
935
+ * @see {@link mapEffect} If you need to use an effectful transformation
936
+ * function.
457
937
  *
458
938
  * @since 2.0.0
459
- * @category mapping
939
+ * @category Mapping
460
940
  */
461
941
  const map = exports.map = internal.map;
462
942
  /**
463
- * Returns a new schedule that maps the output of this schedule through the
464
- * specified effectful function.
943
+ * Returns a new schedule that applies an effectful transformation to its
944
+ * output.
945
+ *
946
+ * **Details**
947
+ *
948
+ * This function modifies an existing schedule by applying an effectful function
949
+ * `f` to its output values. The timing and recurrence behavior of the schedule
950
+ * remain unchanged, but each output is mapped to a new value within an
951
+ * `Effect`.
952
+ *
953
+ * This is useful when you need to perform side effects or asynchronous
954
+ * transformations before passing the output forward.
955
+ *
956
+ * @see {@link map} If you need to use a pure transformation function.
465
957
  *
466
958
  * @since 2.0.0
467
- * @category mapping
959
+ * @category Mapping
468
960
  */
469
961
  const mapEffect = exports.mapEffect = internal.mapEffect;
470
962
  /**
471
- * Cron-like schedule that recurs every specified `minute` of each hour. It
472
- * triggers at zero second of the minute. Producing a count of repeats: 0, 1,
473
- * 2.
963
+ * Returns a new schedule that modifies the delay between executions using a
964
+ * custom function.
474
965
  *
475
- * NOTE: `minute` parameter is validated lazily. Must be in range 0...59.
966
+ * **Details**
476
967
  *
477
- * @since 2.0.0
478
- * @category constructors
479
- */
480
- const minuteOfHour = exports.minuteOfHour = internal.minuteOfHour;
481
- /**
482
- * Returns a new schedule that modifies the delay using the specified
483
- * function.
968
+ * This function transforms an existing schedule by applying `f` to modify the
969
+ * delay before each execution. The function receives both the schedule's output
970
+ * (`out`) and the originally computed delay (`duration`), and returns a new
971
+ * adjusted delay.
972
+ *
973
+ * @see {@link modifyDelayEffect} If you need to use an effectful function.
484
974
  *
485
975
  * @since 2.0.0
486
- * @category utils
976
+ * @category Timing & Delay
487
977
  */
488
978
  const modifyDelay = exports.modifyDelay = internal.modifyDelay;
489
979
  /**
490
- * Returns a new schedule that modifies the delay using the specified
491
- * effectual function.
980
+ * Returns a new schedule that modifies the delay before execution using an
981
+ * effectful function.
982
+ *
983
+ * **Details**
984
+ *
985
+ * This function takes an existing schedule and applies an effectful function
986
+ * `f` to dynamically adjust the delay before each execution. The function
987
+ * receives both the schedule's output (`out`) and the originally computed delay
988
+ * (`duration`), returning a new adjusted delay wrapped in an `Effect`.
989
+ *
990
+ * @see {@link modifyDelay} If you need to use a pure function.
492
991
  *
493
992
  * @since 2.0.0
494
- * @category utils
993
+ * @category Timing & Delay
495
994
  */
496
995
  const modifyDelayEffect = exports.modifyDelayEffect = internal.modifyDelayEffect;
497
996
  /**
498
- * Returns a new schedule that applies the current one but runs the specified
499
- * effect for every decision of this schedule. This can be used to create
500
- * schedules that log failures, decisions, or computed values.
997
+ * Returns a new schedule that executes an effect every time the schedule makes
998
+ * a decision.
999
+ *
1000
+ * **Details**
1001
+ *
1002
+ * This function enhances an existing schedule by running an effectful function
1003
+ * `f` whenever a scheduling decision is made. The function receives the current
1004
+ * schedule output (`out`) and the decision (`ScheduleDecision`), allowing
1005
+ * additional logic to be executed, such as logging, monitoring, or side
1006
+ * effects.
501
1007
  *
502
1008
  * @since 2.0.0
503
- * @category utils
504
1009
  */
505
1010
  const onDecision = exports.onDecision = internal.onDecision;
506
1011
  /**
507
- * A schedule that recurs one time.
1012
+ * A schedule that executes only once and then stops.
1013
+ *
1014
+ * **Details**
1015
+ *
1016
+ * This schedule triggers a single execution and then terminates. It does not
1017
+ * repeat or apply any additional logic.
508
1018
  *
509
1019
  * @since 2.0.0
510
- * @category constructors
1020
+ * @category Constructors
511
1021
  */
512
1022
  const once = exports.once = internal.once;
513
1023
  /**
514
- * Returns a new schedule that passes through the inputs of this schedule.
1024
+ * Returns a new schedule with a provided context, eliminating the need for
1025
+ * external dependencies.
515
1026
  *
516
- * @since 2.0.0
517
- * @category utils
518
- */
519
- const passthrough = exports.passthrough = internal.passthrough;
520
- /**
521
- * Returns a new schedule with its context provided to it, so the
522
- * resulting schedule does not require any context.
1027
+ * **Details**
1028
+ *
1029
+ * This function supplies a required `context` to a schedule, allowing it to run
1030
+ * without requiring external dependencies. After calling this function, the
1031
+ * schedule can be used freely without needing to pass a context at execution
1032
+ * time.
1033
+ *
1034
+ * This is useful when working with schedules that rely on contextual
1035
+ * information, such as logging services, database connections, or configuration
1036
+ * settings.
523
1037
  *
524
1038
  * @since 2.0.0
525
- * @category context
1039
+ * @category Context
526
1040
  */
527
1041
  const provideContext = exports.provideContext = internal.provideContext;
528
1042
  /**
529
- * Returns a new schedule with the single service it requires provided to it.
530
- * If the schedule requires multiple services use `provideContext`
531
- * instead.
1043
+ * Returns a new schedule with a single required service provided, eliminating
1044
+ * the need for external dependencies.
1045
+ *
1046
+ * **Details**
1047
+ *
1048
+ * This function supplies a single service dependency to a schedule, allowing it
1049
+ * to run without requiring that service externally. If a schedule depends on
1050
+ * multiple services, consider using `provideContext` instead.
1051
+ *
1052
+ * This is useful when working with schedules that require a specific service,
1053
+ * such as logging, metrics, or configuration retrieval.
532
1054
  *
533
1055
  * @since 2.0.0
534
- * @category context
1056
+ * @category Context
535
1057
  */
536
1058
  const provideService = exports.provideService = internal.provideService;
537
1059
  /**
538
- * A schedule that recurs for until the predicate evaluates to true.
1060
+ * A schedule that recurs until the given predicate evaluates to true.
1061
+ *
1062
+ * **Details**
1063
+ *
1064
+ * This schedule will continue executing as long as the provided predicate `f`
1065
+ * returns `false` for the input value. Once `f` evaluates to `true`, the
1066
+ * schedule stops recurring.
1067
+ *
1068
+ * This is useful for defining schedules that should stop when a certain
1069
+ * condition is met, such as detecting a success state, reaching a threshold, or
1070
+ * avoiding unnecessary retries.
1071
+ *
1072
+ * @see {@link recurUntilEffect} If you need to use an effectful predicate.
539
1073
  *
540
1074
  * @since 2.0.0
541
- * @category utils
1075
+ * @category Recurrence Conditions
542
1076
  */
543
1077
  const recurUntil = exports.recurUntil = internal.recurUntil;
544
1078
  /**
545
- * A schedule that recurs for until the predicate evaluates to true.
1079
+ * A schedule that recurs until the given effectful predicate evaluates to true.
1080
+ *
1081
+ * **Details**
1082
+ *
1083
+ * This schedule continues executing as long as the provided effectful predicate
1084
+ * `f` returns `false`. Once `f` evaluates to `true`, the schedule stops
1085
+ * recurring. Unlike {@link recurUntil}, this function allows the stopping
1086
+ * condition to be computed asynchronously or based on external dependencies.
1087
+ *
1088
+ * This is useful when the stopping condition depends on an effectful
1089
+ * computation, such as checking a database, making an API call, or retrieving
1090
+ * system state dynamically.
1091
+ *
1092
+ * @see {@link recurUntil} If you need to use a pure predicate.
546
1093
  *
547
1094
  * @since 2.0.0
548
- * @category utils
1095
+ * @category Recurrence Conditions
549
1096
  */
550
1097
  const recurUntilEffect = exports.recurUntilEffect = internal.recurUntilEffect;
551
1098
  /**
552
- * A schedule that recurs for until the input value becomes applicable to
553
- * partial function and then map that value with given function.
1099
+ * A schedule that recurs until the input value matches a partial function, then
1100
+ * maps the value.
1101
+ *
1102
+ * **Details**
1103
+ *
1104
+ * This schedule continues executing until the provided partial function `pf`
1105
+ * returns `Some(value)`. At that point, it stops and maps the resulting value
1106
+ * to an `Option<B>`. If `pf` returns `None`, the schedule continues.
1107
+ *
1108
+ * This is useful when defining schedules that should stop once a certain
1109
+ * condition is met and transform the final value before completion.
554
1110
  *
555
1111
  * @since 2.0.0
556
- * @category utils
1112
+ * @category Recurrence Conditions
557
1113
  */
558
1114
  const recurUntilOption = exports.recurUntilOption = internal.recurUntilOption;
559
1115
  /**
560
- * A schedule that recurs during the given duration.
1116
+ * A schedule that recurs until the specified duration has elapsed.
1117
+ *
1118
+ * **Details**
1119
+ *
1120
+ * This schedule continues executing for the given `duration`, after which it
1121
+ * stops. The schedule outputs the elapsed time on each recurrence.
1122
+ *
1123
+ * This is useful for limiting the duration of retries, enforcing time-based
1124
+ * constraints, or ensuring that an operation does not run indefinitely.
561
1125
  *
562
1126
  * @since 2.0.0
563
- * @category utils
1127
+ * @category Recurrence Conditions
564
1128
  */
565
1129
  const recurUpTo = exports.recurUpTo = internal.recurUpTo;
566
1130
  /**
567
- * A schedule that recurs for as long as the predicate evaluates to true.
1131
+ * A schedule that recurs as long as the given predicate evaluates to true.
1132
+ *
1133
+ * **Details*
1134
+ *
1135
+ * This schedule continues executing as long as the provided predicate `f`
1136
+ * returns `true` for the input value. Once `f` evaluates to `false`, the
1137
+ * schedule stops recurring.
1138
+ *
1139
+ * @see {@link recurWhileEffect} If you need to use an effectful predicate.
568
1140
  *
569
1141
  * @since 2.0.0
570
- * @category utils
1142
+ * @category Recurrence Conditions
571
1143
  */
572
1144
  const recurWhile = exports.recurWhile = internal.recurWhile;
573
1145
  /**
574
- * A schedule that recurs for as long as the effectful predicate evaluates to
1146
+ * A schedule that recurs as long as the given effectful predicate evaluates to
575
1147
  * true.
576
1148
  *
1149
+ * **Details**
1150
+ *
1151
+ * This schedule continues executing as long as the provided effectful predicate
1152
+ * `f` returns `true`. Once `f` evaluates to `false`, the schedule stops
1153
+ * recurring. Unlike {@link recurWhile}, this function allows the condition to
1154
+ * be computed dynamically using an effectful computation.
1155
+ *
1156
+ * @see {@link recurWhile} If you need to use a pure predicate.
1157
+ *
577
1158
  * @since 2.0.0
578
- * @category utils
1159
+ * @category Recurrence Conditions
579
1160
  */
580
1161
  const recurWhileEffect = exports.recurWhileEffect = internal.recurWhileEffect;
581
1162
  /**
582
- * A schedule spanning all time, which can be stepped only the specified
583
- * number of times before it terminates.
1163
+ * A schedule that recurs a fixed number of times before terminating.
1164
+ *
1165
+ * **Details**
1166
+ *
1167
+ * This schedule will continue executing until it has been stepped `n` times,
1168
+ * after which it will stop. The output of the schedule is the current count of
1169
+ * recurrences.
584
1170
  *
585
- * @category constructors
1171
+ * @category Constructors
586
1172
  * @since 2.0.0
587
1173
  */
588
1174
  const recurs = exports.recurs = internal.recurs;
589
1175
  /**
590
1176
  * Returns a new schedule that folds over the outputs of this one.
591
1177
  *
1178
+ * **Details**
1179
+ *
1180
+ * This schedule transforms the output by accumulating values over time using a
1181
+ * reducer function `f`. It starts with an initial value `zero` and updates it
1182
+ * each time the schedule produces an output.
1183
+ *
1184
+ * This is useful for tracking statistics, aggregating results, or summarizing
1185
+ * data across multiple executions.
1186
+ *
1187
+ * @see {@link reduceEffect} If you need to use an effectful reducer function.
1188
+ *
592
1189
  * @since 2.0.0
593
- * @category folding
1190
+ * @category Reducing
594
1191
  */
595
1192
  const reduce = exports.reduce = internal.reduce;
596
1193
  /**
597
1194
  * Returns a new schedule that effectfully folds over the outputs of this one.
598
1195
  *
1196
+ * **Details**
1197
+ *
1198
+ * This schedule accumulates outputs over time using an effectful reducer
1199
+ * function `f`. It starts with an initial value `zero` and updates it
1200
+ * asynchronously or based on external dependencies.
1201
+ *
1202
+ * This is useful for asynchronous state tracking, logging, external metrics
1203
+ * aggregation, or any scenario where accumulation needs to involve an effectful
1204
+ * computation.
1205
+ *
1206
+ * @see {@link reduce} If you need to use a pure reducer function.
1207
+ *
599
1208
  * @since 2.0.0
600
- * @category folding
1209
+ * @category Reducing
601
1210
  */
602
1211
  const reduceEffect = exports.reduceEffect = internal.reduceEffect;
1212
+ // TODO(4.0): remove?
603
1213
  /**
604
- * Returns a new schedule that loops this one continuously, resetting the
605
- * state when this schedule is done.
1214
+ * Alias of {@link forever}.
606
1215
  *
607
1216
  * @since 2.0.0
608
- * @category constructors
1217
+ * @category Constructors
609
1218
  */
610
1219
  const repeatForever = exports.repeatForever = internal.forever;
611
1220
  /**
612
1221
  * Returns a new schedule that outputs the number of repetitions of this one.
613
1222
  *
1223
+ * **Details**
1224
+ *
1225
+ * This schedule tracks how many times the given schedule has executed and
1226
+ * outputs the count instead of the original values. The first execution starts
1227
+ * at `0`, and the count increases with each recurrence.
1228
+ *
614
1229
  * @since 2.0.0
615
- * @category utils
1230
+ * @category Monitoring
616
1231
  */
617
1232
  const repetitions = exports.repetitions = internal.repetitions;
618
1233
  /**
619
- * Return a new schedule that automatically resets the schedule to its initial
620
- * state after some time of inactivity defined by `duration`.
1234
+ * Returns a new schedule that automatically resets to its initial state after a
1235
+ * period of inactivity defined by `duration`.
1236
+ *
1237
+ * **Details**
1238
+ *
1239
+ * This function modifies a schedule so that if no inputs are received for the
1240
+ * specified `duration`, the schedule resets as if it were new.
1241
+ *
1242
+ * @see {@link resetWhen} If you need to reset based on output values.
621
1243
  *
622
1244
  * @since 2.0.0
623
- * @category utils
1245
+ * @category State Management
624
1246
  */
625
1247
  const resetAfter = exports.resetAfter = internal.resetAfter;
626
1248
  /**
627
1249
  * Resets the schedule when the specified predicate on the schedule output
628
- * evaluates to true.
1250
+ * evaluates to `true`.
1251
+ *
1252
+ * **Details**
1253
+ *
1254
+ * This function modifies a schedule so that it resets to its initial state
1255
+ * whenever the provided predicate `f` returns `true` for an output value.
1256
+ *
1257
+ * @see {@link resetAfter} If you need to reset based on inactivity.
629
1258
  *
630
1259
  * @since 2.0.0
631
- * @category utils
1260
+ * @category State Management
632
1261
  */
633
1262
  const resetWhen = exports.resetWhen = internal.resetWhen;
634
1263
  /**
635
- * Runs a schedule using the provided inputs, and collects all outputs.
1264
+ * Runs a schedule using the provided inputs and collects all outputs.
1265
+ *
1266
+ * **Details**
1267
+ *
1268
+ * This function executes a given schedule with a sequence of input values and
1269
+ * accumulates all outputs into a `Chunk`. The schedule starts execution at the
1270
+ * specified `now` timestamp and proceeds according to its defined behavior.
1271
+ *
1272
+ * This is useful for batch processing, simulating execution, or testing
1273
+ * schedules with predefined input sequences.
636
1274
  *
637
1275
  * @since 2.0.0
638
- * @category destructors
1276
+ * @category Execution
639
1277
  */
640
1278
  const run = exports.run = internal.run;
641
1279
  /**
642
- * Cron-like schedule that recurs every specified `second` of each minute. It
643
- * triggers at zero nanosecond of the second. Producing a count of repeats: 0,
644
- * 1, 2.
1280
+ * Returns a schedule that recurs continuously, with each repetition
1281
+ * spaced by the specified `duration` from the last run.
645
1282
  *
646
- * NOTE: `second` parameter is validated lazily. Must be in range 0...59.
1283
+ * **Details**
647
1284
  *
648
- * @since 2.0.0
649
- * @category constructors
650
- */
651
- const secondOfMinute = exports.secondOfMinute = internal.secondOfMinute;
652
- /**
653
- * Returns a schedule that recurs continuously, each repetition spaced the
654
- * specified duration from the last run.
1285
+ * This schedule ensures that executions occur at a fixed interval,
1286
+ * maintaining a consistent delay between repetitions. The delay starts
1287
+ * from the end of the last execution, not from the schedule start time.
1288
+ *
1289
+ * @see {@link fixed} If you need to run at a fixed interval from the start.
655
1290
  *
656
1291
  * @since 2.0.0
657
- * @category constructors
1292
+ * @category Constructors
658
1293
  */
659
1294
  const spaced = exports.spaced = internal.spaced;
660
1295
  /**
661
- * A schedule that does not recur, it just stops.
1296
+ * A schedule that does not recur and stops immediately.
662
1297
  *
663
1298
  * @since 2.0.0
664
- * @category constructors
1299
+ * @category Constructors
665
1300
  */
666
1301
  const stop = exports.stop = internal.stop;
667
1302
  /**
668
- * Returns a schedule that repeats one time, producing the specified constant
669
- * value.
1303
+ * Returns a schedule that recurs indefinitely, always producing the specified
1304
+ * constant value.
670
1305
  *
671
1306
  * @since 2.0.0
672
- * @category constructors
1307
+ * @category Constructors
673
1308
  */
674
1309
  const succeed = exports.succeed = internal.succeed;
675
1310
  /**
676
- * Returns a schedule that repeats one time, producing the specified constant
677
- * value.
1311
+ * Returns a schedule that recurs indefinitely, evaluating the given function to
1312
+ * produce a constant value.
678
1313
  *
679
- * @category constructors
1314
+ * @category Constructors
680
1315
  * @since 2.0.0
681
1316
  */
682
1317
  const sync = exports.sync = internal.sync;
683
1318
  /**
684
- * Returns a new schedule that effectfully processes every input to this
685
- * schedule.
1319
+ * Returns a new schedule that runs the given effectful function for each input
1320
+ * before continuing execution.
1321
+ *
1322
+ * **Details**
1323
+ *
1324
+ * This function allows side effects to be performed on each input processed by
1325
+ * the schedule. It does not modify the schedule’s behavior but ensures that the
1326
+ * provided function `f` runs before each step.
686
1327
  *
687
1328
  * @since 2.0.0
688
- * @category sequencing
1329
+ * @category Tapping
689
1330
  */
690
1331
  const tapInput = exports.tapInput = internal.tapInput;
691
1332
  /**
692
- * Returns a new schedule that effectfully processes every output from this
693
- * schedule.
1333
+ * Returns a new schedule that runs the given effectful function for each output
1334
+ * before continuing execution.
1335
+ *
1336
+ * **Details**
1337
+ *
1338
+ * This function allows side effects to be performed on each output produced by
1339
+ * the schedule. It does not modify the schedule’s behavior but ensures that the
1340
+ * provided function `f` runs after each step.
694
1341
  *
695
1342
  * @since 2.0.0
696
- * @category sequencing
1343
+ * @category Tapping
697
1344
  */
698
1345
  const tapOutput = exports.tapOutput = internal.tapOutput;
699
1346
  /**
700
- * Unfolds a schedule that repeats one time from the specified state and
701
- * iterator.
1347
+ * Creates a schedule that repeatedly applies a function to transform a state
1348
+ * value, producing a sequence of values.
1349
+ *
1350
+ * **Details**
1351
+ *
1352
+ * This function starts with an `initial` value and applies `f` recursively to
1353
+ * generate the next state at each step. The schedule continues indefinitely,
1354
+ * producing a stream of values by unfolding the state over time.
702
1355
  *
703
1356
  * @since 2.0.0
704
- * @category constructors
1357
+ * @category Constructors
705
1358
  */
706
1359
  const unfold = exports.unfold = internal.unfold;
707
1360
  /**
708
- * Returns a new schedule that performs a geometric union on the intervals
709
- * defined by both schedules.
1361
+ * Combines two schedules, continuing execution as long as at least one of them
1362
+ * allows it, using the shorter delay.
1363
+ *
1364
+ * **Details**
1365
+ *
1366
+ * This function combines two schedules into a single schedule that executes in
1367
+ * parallel. If either schedule allows continuation, the merged schedule
1368
+ * continues. When both schedules produce delays, the schedule selects the
1369
+ * shorter delay to determine the next step.
1370
+ *
1371
+ * The output of the new schedule is a tuple containing the outputs of both
1372
+ * schedules. The input type is the intersection of both schedules' input types.
1373
+ *
1374
+ * This is useful for scenarios where multiple scheduling conditions should be
1375
+ * considered, ensuring execution proceeds if at least one schedule permits it.
1376
+ *
1377
+ * @see {@link unionWith} If you need to use a custom merge function.
710
1378
  *
711
1379
  * @since 2.0.0
712
- * @category utils
1380
+ * @category Composition
713
1381
  */
714
1382
  const union = exports.union = internal.union;
715
1383
  /**
716
- * Returns a new schedule that combines this schedule with the specified
717
- * schedule, continuing as long as either schedule wants to continue and
718
- * merging the next intervals according to the specified merge function.
1384
+ * Combines two schedules, continuing execution as long as at least one of them
1385
+ * wants to continue, merging their intervals using a custom merge function.
1386
+ *
1387
+ * **Details**
1388
+ *
1389
+ * This function allows you to combine two schedules while defining how their
1390
+ * intervals should be merged. Unlike {@link union}, which simply selects the
1391
+ * shorter delay, this function lets you specify a custom merging strategy for
1392
+ * the schedules’ intervals.
1393
+ *
1394
+ * The merged schedule continues execution as long as at least one of the input
1395
+ * schedules allows it. The next interval is determined by applying the provided
1396
+ * merge function to the intervals of both schedules.
1397
+ *
1398
+ * The output of the resulting schedule is a tuple containing the outputs of
1399
+ * both schedules. The input type is the intersection of both schedules' input
1400
+ * types.
1401
+ *
1402
+ * @see {@link union} If you need to use the shorter delay.
719
1403
  *
720
1404
  * @since 2.0.0
721
- * @category utils
1405
+ * @category Composition
722
1406
  */
723
1407
  const unionWith = exports.unionWith = internal.unionWith;
724
1408
  /**
725
- * Returns a new schedule that continues until the specified predicate on the
726
- * input evaluates to true.
1409
+ * Returns a new schedule that stops execution when the given predicate on the
1410
+ * input evaluates to `true`.
1411
+ *
1412
+ * **Details**
1413
+ *
1414
+ * This function modifies an existing schedule so that it continues executing
1415
+ * only while the provided predicate returns `false` for incoming inputs. Once
1416
+ * an input satisfies the condition, the schedule terminates immediately.
1417
+ *
1418
+ * @see {@link untilInputEffect} If you need to use an effectful predicate.
727
1419
  *
728
1420
  * @since 2.0.0
729
- * @category utils
1421
+ * @category Recurrence Conditions
730
1422
  */
731
1423
  const untilInput = exports.untilInput = internal.untilInput;
732
1424
  /**
733
- * Returns a new schedule that continues until the specified effectful
734
- * predicate on the input evaluates to true.
1425
+ * Returns a new schedule that stops execution when the given effectful
1426
+ * predicate on the input evaluates to `true`.
1427
+ *
1428
+ * **Details**
1429
+ *
1430
+ * This function modifies an existing schedule so that it continues executing
1431
+ * only while the provided effectful predicate returns `false` for incoming
1432
+ * inputs. The predicate is an `Effect`, meaning it can involve asynchronous
1433
+ * computations or dependency-based logic.
1434
+ *
1435
+ * @see {@link untilInput} If you need to use a pure predicate.
735
1436
  *
736
1437
  * @since 2.0.0
737
- * @category utils
1438
+ * @category Recurrence Conditions
738
1439
  */
739
1440
  const untilInputEffect = exports.untilInputEffect = internal.untilInputEffect;
740
1441
  /**
741
- * Returns a new schedule that continues until the specified predicate on the
742
- * output evaluates to true.
1442
+ * Returns a new schedule that stops execution when the given predicate on the
1443
+ * output evaluates to `true`.
1444
+ *
1445
+ * **Details**
1446
+ *
1447
+ * This function modifies an existing schedule so that it only continues
1448
+ * executing while the given predicate returns false for its output values. Once
1449
+ * the predicate evaluates to `true`, execution stops.
1450
+ *
1451
+ * The output of the resulting schedule remains the same, but its duration is
1452
+ * now constrained by a stopping condition based on its own output.
1453
+ *
1454
+ * @see {@link untilOutputEffect} If you need to use an effectful predicate.
743
1455
  *
744
1456
  * @since 2.0.0
745
- * @category utils
1457
+ * @category Recurrence Conditions
746
1458
  */
747
1459
  const untilOutput = exports.untilOutput = internal.untilOutput;
748
1460
  /**
749
- * Returns a new schedule that continues until the specified effectful
750
- * predicate on the output evaluates to true.
1461
+ * Returns a new schedule that stops execution when the given effectful
1462
+ * predicate on the output evaluates to `true`.
1463
+ *
1464
+ * **Details**
1465
+ *
1466
+ * This function modifies an existing schedule so that it only continues
1467
+ * executing while the provided effectful predicate returns `false` for its
1468
+ * output values. Once the predicate returns `true`, execution stops.
1469
+ *
1470
+ * @see {@link untilOutput} If you need to use a pure predicate.
751
1471
  *
752
1472
  * @since 2.0.0
753
- * @category utils
1473
+ * @category Recurrence Conditions
754
1474
  */
755
1475
  const untilOutputEffect = exports.untilOutputEffect = internal.untilOutputEffect;
756
1476
  /**
757
- * A schedule that recurs during the given duration.
1477
+ * Returns a new schedule that limits execution to a fixed duration.
1478
+ *
1479
+ * **Details**
1480
+ *
1481
+ * This function modifies an existing schedule to stop execution after a
1482
+ * specified duration has passed. The schedule continues as normal until the
1483
+ * duration is reached, at which point it stops automatically.
758
1484
  *
759
1485
  * @since 2.0.0
760
- * @category utils
1486
+ * @category Recurrence Conditions
761
1487
  */
762
1488
  const upTo = exports.upTo = internal.upTo;
763
1489
  /**
764
- * Returns a new schedule that continues for as long as the specified predicate
765
- * on the input evaluates to true.
1490
+ * Returns a new schedule that continues execution as long as the given
1491
+ * predicate on the input is true.
1492
+ *
1493
+ * **Details**
1494
+ *
1495
+ * This function modifies an existing schedule so that it only continues
1496
+ * execution while a specified predicate holds true for its input. If the
1497
+ * predicate evaluates to `false` at any step, the schedule stops.
1498
+ *
1499
+ * @see {@link whileInputEffect} If you need to use an effectful predicate.
766
1500
  *
767
1501
  * @since 2.0.0
768
- * @category utils
1502
+ * @category Recurrence Conditions
769
1503
  */
770
1504
  const whileInput = exports.whileInput = internal.whileInput;
771
1505
  /**
772
- * Returns a new schedule that continues for as long as the specified effectful
773
- * predicate on the input evaluates to true.
1506
+ * Returns a new schedule that continues execution for as long as the given
1507
+ * effectful predicate on the input evaluates to `true`.
1508
+ *
1509
+ * **Details**
1510
+ *
1511
+ * This function modifies an existing schedule so that it only continues
1512
+ * execution while an effectful predicate holds true for its input. If the
1513
+ * predicate evaluates to `false` at any step, the schedule stops.
1514
+ *
1515
+ * @see {@link whileInput} If you need to use a pure predicate.
774
1516
  *
775
1517
  * @since 2.0.0
776
- * @category utils
1518
+ * @category Recurrence Conditions
777
1519
  */
778
1520
  const whileInputEffect = exports.whileInputEffect = internal.whileInputEffect;
779
1521
  /**
780
- * Returns a new schedule that continues for as long the specified predicate
781
- * on the output evaluates to true.
1522
+ * Returns a new schedule that continues execution for as long as the given
1523
+ * predicate on the output evaluates to `true`.
1524
+ *
1525
+ * **Details**
1526
+ *
1527
+ * This function modifies an existing schedule so that it only continues
1528
+ * execution while a provided condition holds true for its output. If the
1529
+ * predicate returns `false`, the schedule stops.
1530
+ *
1531
+ * @see {@link whileOutputEffect} If you need to use an effectful predicate.
782
1532
  *
783
1533
  * @since 2.0.0
784
- * @category utils
1534
+ * @category Recurrence Conditions
785
1535
  */
786
1536
  const whileOutput = exports.whileOutput = internal.whileOutput;
787
1537
  /**
788
- * Returns a new schedule that continues for as long the specified effectful
789
- * predicate on the output evaluates to true.
1538
+ * Returns a new schedule that continues execution for as long as the given
1539
+ * effectful predicate on the output evaluates to `true`.
1540
+ *
1541
+ * **Details**
1542
+ *
1543
+ * This function modifies an existing schedule so that it only continues
1544
+ * execution while an effectful condition holds true for its output. If the
1545
+ * effectful predicate returns `false`, the schedule stops.
1546
+ *
1547
+ * @see {@link whileOutput} If you need to use a pure predicate.
790
1548
  *
791
1549
  * @since 2.0.0
792
- * @category utils
1550
+ * @category Recurrence Conditions
793
1551
  */
794
1552
  const whileOutputEffect = exports.whileOutputEffect = internal.whileOutputEffect;
795
1553
  /**
796
- * A schedule that divides the timeline to `interval`-long windows, and sleeps
797
- * until the nearest window boundary every time it recurs.
1554
+ * Creates a schedule that divides time into fixed `interval`-long windows,
1555
+ * triggering execution at the start of each new window.
1556
+ *
1557
+ * **Details**
1558
+ *
1559
+ * This function produces a schedule that waits until the next time window
1560
+ * boundary before executing. Each window spans a fixed duration specified by
1561
+ * `interval`. If an action completes midway through a window, the schedule
1562
+ * waits until the next full window starts before proceeding.
798
1563
  *
799
1564
  * For example, `windowed(Duration.seconds(10))` would produce a schedule as
800
1565
  * follows:
@@ -806,28 +1571,28 @@ const whileOutputEffect = exports.whileOutputEffect = internal.whileOutputEffect
806
1571
  * ```
807
1572
  *
808
1573
  * @since 2.0.0
809
- * @category constructors
1574
+ * @category Constructors
810
1575
  */
811
1576
  const windowed = exports.windowed = internal.windowed;
812
1577
  /**
813
- * The same as `intersect` but ignores the right output.
1578
+ * The same as {@link intersect} but ignores the right output.
814
1579
  *
815
1580
  * @since 2.0.0
816
- * @category zipping
1581
+ * @category Composition
817
1582
  */
818
1583
  const zipLeft = exports.zipLeft = internal.zipLeft;
819
1584
  /**
820
- * The same as `intersect` but ignores the left output.
1585
+ * The same as {@link intersect} but ignores the left output.
821
1586
  *
822
1587
  * @since 2.0.0
823
- * @category zipping
1588
+ * @category Composition
824
1589
  */
825
1590
  const zipRight = exports.zipRight = internal.zipRight;
826
1591
  /**
827
- * Equivalent to `intersect` followed by `map`.
1592
+ * Equivalent to {@link intersect} followed by {@link map}.
828
1593
  *
829
1594
  * @since 2.0.0
830
- * @category zipping
1595
+ * @category Composition
831
1596
  */
832
1597
  const zipWith = exports.zipWith = internal.zipWith;
833
1598
  //# sourceMappingURL=Schedule.js.map