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