effect 4.0.0-beta.65 → 4.0.0-beta.67

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 (1657) hide show
  1. package/dist/Array.d.ts +113 -67
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +28 -18
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +404 -337
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +190 -146
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +167 -97
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +87 -47
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +62 -31
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +30 -15
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.d.ts +20 -1
  18. package/dist/Brand.d.ts.map +1 -1
  19. package/dist/Brand.js +16 -0
  20. package/dist/Brand.js.map +1 -1
  21. package/dist/Cache.d.ts +236 -132
  22. package/dist/Cache.d.ts.map +1 -1
  23. package/dist/Cache.js +133 -57
  24. package/dist/Cache.js.map +1 -1
  25. package/dist/Cause.d.ts +77 -65
  26. package/dist/Cause.d.ts.map +1 -1
  27. package/dist/Cause.js +43 -36
  28. package/dist/Cause.js.map +1 -1
  29. package/dist/Channel.d.ts +1518 -575
  30. package/dist/Channel.d.ts.map +1 -1
  31. package/dist/Channel.js +661 -287
  32. package/dist/Channel.js.map +1 -1
  33. package/dist/ChannelSchema.d.ts +119 -10
  34. package/dist/ChannelSchema.d.ts.map +1 -1
  35. package/dist/ChannelSchema.js +45 -6
  36. package/dist/ChannelSchema.js.map +1 -1
  37. package/dist/Chunk.d.ts +548 -379
  38. package/dist/Chunk.d.ts.map +1 -1
  39. package/dist/Chunk.js +238 -170
  40. package/dist/Chunk.js.map +1 -1
  41. package/dist/Clock.d.ts +15 -8
  42. package/dist/Clock.d.ts.map +1 -1
  43. package/dist/Clock.js +8 -4
  44. package/dist/Clock.js.map +1 -1
  45. package/dist/Combiner.d.ts +2 -4
  46. package/dist/Combiner.d.ts.map +1 -1
  47. package/dist/Combiner.js +2 -4
  48. package/dist/Combiner.js.map +1 -1
  49. package/dist/Config.d.ts +5 -4
  50. package/dist/Config.d.ts.map +1 -1
  51. package/dist/Config.js +9 -8
  52. package/dist/Config.js.map +1 -1
  53. package/dist/ConfigProvider.d.ts +1 -1
  54. package/dist/ConfigProvider.js +1 -1
  55. package/dist/Console.d.ts +76 -50
  56. package/dist/Console.d.ts.map +1 -1
  57. package/dist/Console.js +69 -46
  58. package/dist/Console.js.map +1 -1
  59. package/dist/Context.d.ts +386 -138
  60. package/dist/Context.d.ts.map +1 -1
  61. package/dist/Context.js +144 -62
  62. package/dist/Context.js.map +1 -1
  63. package/dist/Cron.d.ts +69 -48
  64. package/dist/Cron.d.ts.map +1 -1
  65. package/dist/Cron.js +96 -36
  66. package/dist/Cron.js.map +1 -1
  67. package/dist/Data.d.ts +3 -2
  68. package/dist/Data.d.ts.map +1 -1
  69. package/dist/Data.js.map +1 -1
  70. package/dist/DateTime.d.ts +875 -444
  71. package/dist/DateTime.d.ts.map +1 -1
  72. package/dist/DateTime.js +376 -217
  73. package/dist/DateTime.js.map +1 -1
  74. package/dist/Deferred.d.ts +367 -174
  75. package/dist/Deferred.d.ts.map +1 -1
  76. package/dist/Deferred.js +145 -71
  77. package/dist/Deferred.js.map +1 -1
  78. package/dist/Differ.d.ts +42 -0
  79. package/dist/Differ.d.ts.map +1 -1
  80. package/dist/Differ.js +36 -0
  81. package/dist/Duration.d.ts +329 -185
  82. package/dist/Duration.d.ts.map +1 -1
  83. package/dist/Duration.js +174 -106
  84. package/dist/Duration.js.map +1 -1
  85. package/dist/Effect.d.ts +2445 -2356
  86. package/dist/Effect.d.ts.map +1 -1
  87. package/dist/Effect.js +906 -758
  88. package/dist/Effect.js.map +1 -1
  89. package/dist/Effectable.d.ts +38 -3
  90. package/dist/Effectable.d.ts.map +1 -1
  91. package/dist/Effectable.js +3 -3
  92. package/dist/Effectable.js.map +1 -1
  93. package/dist/Encoding.d.ts +78 -28
  94. package/dist/Encoding.d.ts.map +1 -1
  95. package/dist/Encoding.js +75 -27
  96. package/dist/Encoding.js.map +1 -1
  97. package/dist/Equivalence.d.ts +14 -19
  98. package/dist/Equivalence.d.ts.map +1 -1
  99. package/dist/Equivalence.js +14 -19
  100. package/dist/Equivalence.js.map +1 -1
  101. package/dist/ErrorReporter.d.ts +66 -82
  102. package/dist/ErrorReporter.d.ts.map +1 -1
  103. package/dist/ErrorReporter.js +38 -29
  104. package/dist/ErrorReporter.js.map +1 -1
  105. package/dist/ExecutionPlan.d.ts +96 -12
  106. package/dist/ExecutionPlan.d.ts.map +1 -1
  107. package/dist/ExecutionPlan.js +21 -6
  108. package/dist/ExecutionPlan.js.map +1 -1
  109. package/dist/Exit.d.ts +7 -5
  110. package/dist/Exit.d.ts.map +1 -1
  111. package/dist/Exit.js.map +1 -1
  112. package/dist/Fiber.d.ts +72 -40
  113. package/dist/Fiber.d.ts.map +1 -1
  114. package/dist/Fiber.js +39 -21
  115. package/dist/Fiber.js.map +1 -1
  116. package/dist/FiberHandle.d.ts +119 -58
  117. package/dist/FiberHandle.d.ts.map +1 -1
  118. package/dist/FiberHandle.js +122 -40
  119. package/dist/FiberHandle.js.map +1 -1
  120. package/dist/FiberMap.d.ts +288 -160
  121. package/dist/FiberMap.d.ts.map +1 -1
  122. package/dist/FiberMap.js +176 -74
  123. package/dist/FiberMap.js.map +1 -1
  124. package/dist/FiberSet.d.ts +93 -52
  125. package/dist/FiberSet.d.ts.map +1 -1
  126. package/dist/FiberSet.js +97 -34
  127. package/dist/FiberSet.js.map +1 -1
  128. package/dist/FileSystem.d.ts +104 -73
  129. package/dist/FileSystem.d.ts.map +1 -1
  130. package/dist/FileSystem.js +53 -39
  131. package/dist/FileSystem.js.map +1 -1
  132. package/dist/Filter.d.ts +166 -88
  133. package/dist/Filter.d.ts.map +1 -1
  134. package/dist/Filter.js +68 -42
  135. package/dist/Filter.js.map +1 -1
  136. package/dist/Function.d.ts +154 -86
  137. package/dist/Function.d.ts.map +1 -1
  138. package/dist/Function.js +53 -37
  139. package/dist/Function.js.map +1 -1
  140. package/dist/Graph.d.ts +682 -365
  141. package/dist/Graph.d.ts.map +1 -1
  142. package/dist/Graph.js +308 -157
  143. package/dist/Graph.js.map +1 -1
  144. package/dist/HKT.d.ts +29 -13
  145. package/dist/HKT.d.ts.map +1 -1
  146. package/dist/Hash.d.ts +31 -18
  147. package/dist/Hash.d.ts.map +1 -1
  148. package/dist/Hash.js +25 -15
  149. package/dist/Hash.js.map +1 -1
  150. package/dist/HashMap.d.ts +444 -256
  151. package/dist/HashMap.d.ts.map +1 -1
  152. package/dist/HashMap.js +223 -105
  153. package/dist/HashMap.js.map +1 -1
  154. package/dist/HashRing.d.ts +36 -17
  155. package/dist/HashRing.d.ts.map +1 -1
  156. package/dist/HashRing.js +75 -8
  157. package/dist/HashRing.js.map +1 -1
  158. package/dist/HashSet.d.ts +194 -104
  159. package/dist/HashSet.d.ts.map +1 -1
  160. package/dist/HashSet.js +93 -38
  161. package/dist/HashSet.js.map +1 -1
  162. package/dist/Inspectable.d.ts +20 -9
  163. package/dist/Inspectable.d.ts.map +1 -1
  164. package/dist/Inspectable.js +16 -6
  165. package/dist/Inspectable.js.map +1 -1
  166. package/dist/Iterable.d.ts +309 -149
  167. package/dist/Iterable.d.ts.map +1 -1
  168. package/dist/Iterable.js +129 -65
  169. package/dist/Iterable.js.map +1 -1
  170. package/dist/JsonPatch.d.ts +4 -3
  171. package/dist/JsonPatch.d.ts.map +1 -1
  172. package/dist/JsonPatch.js +4 -3
  173. package/dist/JsonPatch.js.map +1 -1
  174. package/dist/Latch.d.ts +98 -15
  175. package/dist/Latch.d.ts.map +1 -1
  176. package/dist/Latch.js +41 -10
  177. package/dist/Latch.js.map +1 -1
  178. package/dist/Layer.d.ts +412 -309
  179. package/dist/Layer.d.ts.map +1 -1
  180. package/dist/Layer.js +262 -181
  181. package/dist/Layer.js.map +1 -1
  182. package/dist/LayerMap.d.ts +95 -21
  183. package/dist/LayerMap.d.ts.map +1 -1
  184. package/dist/LayerMap.js +58 -14
  185. package/dist/LayerMap.js.map +1 -1
  186. package/dist/LogLevel.d.ts +92 -131
  187. package/dist/LogLevel.d.ts.map +1 -1
  188. package/dist/LogLevel.js +25 -15
  189. package/dist/LogLevel.js.map +1 -1
  190. package/dist/Logger.d.ts +155 -99
  191. package/dist/Logger.d.ts.map +1 -1
  192. package/dist/Logger.js +211 -184
  193. package/dist/Logger.js.map +1 -1
  194. package/dist/ManagedRuntime.d.ts +75 -17
  195. package/dist/ManagedRuntime.d.ts.map +1 -1
  196. package/dist/ManagedRuntime.js +22 -16
  197. package/dist/ManagedRuntime.js.map +1 -1
  198. package/dist/Match.d.ts +133 -157
  199. package/dist/Match.d.ts.map +1 -1
  200. package/dist/Match.js +85 -76
  201. package/dist/Match.js.map +1 -1
  202. package/dist/Metric.d.ts +325 -284
  203. package/dist/Metric.d.ts.map +1 -1
  204. package/dist/Metric.js +217 -212
  205. package/dist/Metric.js.map +1 -1
  206. package/dist/MutableHashMap.d.ts +117 -58
  207. package/dist/MutableHashMap.d.ts.map +1 -1
  208. package/dist/MutableHashMap.js +52 -29
  209. package/dist/MutableHashMap.js.map +1 -1
  210. package/dist/MutableHashSet.d.ts +52 -30
  211. package/dist/MutableHashSet.d.ts.map +1 -1
  212. package/dist/MutableHashSet.js +94 -38
  213. package/dist/MutableHashSet.js.map +1 -1
  214. package/dist/MutableList.d.ts +92 -49
  215. package/dist/MutableList.d.ts.map +1 -1
  216. package/dist/MutableList.js +123 -71
  217. package/dist/MutableList.js.map +1 -1
  218. package/dist/MutableRef.d.ts +99 -62
  219. package/dist/MutableRef.d.ts.map +1 -1
  220. package/dist/MutableRef.js +79 -60
  221. package/dist/MutableRef.js.map +1 -1
  222. package/dist/Newtype.d.ts +3 -0
  223. package/dist/Newtype.d.ts.map +1 -1
  224. package/dist/Newtype.js.map +1 -1
  225. package/dist/NonEmptyIterable.d.ts +36 -39
  226. package/dist/NonEmptyIterable.d.ts.map +1 -1
  227. package/dist/NonEmptyIterable.js +34 -20
  228. package/dist/NonEmptyIterable.js.map +1 -1
  229. package/dist/Number.d.ts +116 -64
  230. package/dist/Number.d.ts.map +1 -1
  231. package/dist/Number.js +54 -30
  232. package/dist/Number.js.map +1 -1
  233. package/dist/Optic.d.ts +1 -2
  234. package/dist/Optic.d.ts.map +1 -1
  235. package/dist/Optic.js +0 -1
  236. package/dist/Optic.js.map +1 -1
  237. package/dist/Option.d.ts +38 -53
  238. package/dist/Option.d.ts.map +1 -1
  239. package/dist/Option.js +87 -11
  240. package/dist/Option.js.map +1 -1
  241. package/dist/Ordering.d.ts +43 -28
  242. package/dist/Ordering.d.ts.map +1 -1
  243. package/dist/Ordering.js +4 -2
  244. package/dist/Ordering.js.map +1 -1
  245. package/dist/PartitionedSemaphore.d.ts +225 -40
  246. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  247. package/dist/PartitionedSemaphore.js +113 -17
  248. package/dist/PartitionedSemaphore.js.map +1 -1
  249. package/dist/Path.d.ts +77 -13
  250. package/dist/Path.d.ts.map +1 -1
  251. package/dist/Path.js +48 -4
  252. package/dist/Path.js.map +1 -1
  253. package/dist/Pipeable.d.ts +71 -15
  254. package/dist/Pipeable.d.ts.map +1 -1
  255. package/dist/Pipeable.js +59 -12
  256. package/dist/Pipeable.js.map +1 -1
  257. package/dist/PlatformError.d.ts +74 -6
  258. package/dist/PlatformError.d.ts.map +1 -1
  259. package/dist/PlatformError.js +68 -5
  260. package/dist/PlatformError.js.map +1 -1
  261. package/dist/Pool.d.ts +66 -31
  262. package/dist/Pool.d.ts.map +1 -1
  263. package/dist/Pool.js +26 -24
  264. package/dist/Pool.js.map +1 -1
  265. package/dist/Predicate.d.ts +16 -21
  266. package/dist/Predicate.d.ts.map +1 -1
  267. package/dist/Predicate.js +9 -14
  268. package/dist/Predicate.js.map +1 -1
  269. package/dist/PrimaryKey.d.ts +9 -2
  270. package/dist/PrimaryKey.d.ts.map +1 -1
  271. package/dist/PrimaryKey.js +7 -1
  272. package/dist/PrimaryKey.js.map +1 -1
  273. package/dist/PubSub.d.ts +364 -262
  274. package/dist/PubSub.d.ts.map +1 -1
  275. package/dist/PubSub.js +245 -174
  276. package/dist/PubSub.js.map +1 -1
  277. package/dist/Pull.d.ts +94 -25
  278. package/dist/Pull.d.ts.map +1 -1
  279. package/dist/Pull.js +61 -13
  280. package/dist/Pull.js.map +1 -1
  281. package/dist/Queue.d.ts +284 -150
  282. package/dist/Queue.d.ts.map +1 -1
  283. package/dist/Queue.js +216 -113
  284. package/dist/Queue.js.map +1 -1
  285. package/dist/Random.d.ts +54 -35
  286. package/dist/Random.d.ts.map +1 -1
  287. package/dist/Random.js +36 -24
  288. package/dist/Random.js.map +1 -1
  289. package/dist/RcMap.d.ts +151 -141
  290. package/dist/RcMap.d.ts.map +1 -1
  291. package/dist/RcMap.js +66 -20
  292. package/dist/RcMap.js.map +1 -1
  293. package/dist/RcRef.d.ts +69 -32
  294. package/dist/RcRef.d.ts.map +1 -1
  295. package/dist/RcRef.js +33 -16
  296. package/dist/RcRef.js.map +1 -1
  297. package/dist/Record.d.ts +273 -129
  298. package/dist/Record.d.ts.map +1 -1
  299. package/dist/Record.js +117 -57
  300. package/dist/Record.js.map +1 -1
  301. package/dist/Redactable.d.ts +3 -3
  302. package/dist/Redactable.js +2 -2
  303. package/dist/Redacted.d.ts +63 -33
  304. package/dist/Redacted.d.ts.map +1 -1
  305. package/dist/Redacted.js +30 -14
  306. package/dist/Redacted.js.map +1 -1
  307. package/dist/Ref.d.ts +81 -52
  308. package/dist/Ref.d.ts.map +1 -1
  309. package/dist/Ref.js +54 -35
  310. package/dist/Ref.js.map +1 -1
  311. package/dist/References.d.ts +73 -31
  312. package/dist/References.d.ts.map +1 -1
  313. package/dist/References.js +66 -30
  314. package/dist/References.js.map +1 -1
  315. package/dist/RegExp.d.ts +11 -5
  316. package/dist/RegExp.d.ts.map +1 -1
  317. package/dist/RegExp.js +11 -5
  318. package/dist/RegExp.js.map +1 -1
  319. package/dist/Request.d.ts +158 -34
  320. package/dist/Request.d.ts.map +1 -1
  321. package/dist/Request.js +67 -12
  322. package/dist/Request.js.map +1 -1
  323. package/dist/RequestResolver.d.ts +261 -116
  324. package/dist/RequestResolver.d.ts.map +1 -1
  325. package/dist/RequestResolver.js +77 -41
  326. package/dist/RequestResolver.js.map +1 -1
  327. package/dist/Resource.d.ts +13 -7
  328. package/dist/Resource.d.ts.map +1 -1
  329. package/dist/Resource.js +44 -6
  330. package/dist/Resource.js.map +1 -1
  331. package/dist/Result.d.ts +26 -16
  332. package/dist/Result.d.ts.map +1 -1
  333. package/dist/Result.js +6 -6
  334. package/dist/Result.js.map +1 -1
  335. package/dist/Runtime.d.ts +43 -18
  336. package/dist/Runtime.d.ts.map +1 -1
  337. package/dist/Runtime.js +35 -16
  338. package/dist/Runtime.js.map +1 -1
  339. package/dist/Schedule.d.ts +545 -576
  340. package/dist/Schedule.d.ts.map +1 -1
  341. package/dist/Schedule.js +261 -247
  342. package/dist/Schedule.js.map +1 -1
  343. package/dist/Scheduler.d.ts +43 -6
  344. package/dist/Scheduler.d.ts.map +1 -1
  345. package/dist/Scheduler.js +33 -4
  346. package/dist/Scheduler.js.map +1 -1
  347. package/dist/Schema.d.ts +815 -294
  348. package/dist/Schema.d.ts.map +1 -1
  349. package/dist/Schema.js +287 -193
  350. package/dist/Schema.js.map +1 -1
  351. package/dist/SchemaAST.d.ts +24 -15
  352. package/dist/SchemaAST.d.ts.map +1 -1
  353. package/dist/SchemaAST.js +13 -9
  354. package/dist/SchemaAST.js.map +1 -1
  355. package/dist/SchemaGetter.d.ts +26 -13
  356. package/dist/SchemaGetter.d.ts.map +1 -1
  357. package/dist/SchemaGetter.js +24 -11
  358. package/dist/SchemaGetter.js.map +1 -1
  359. package/dist/SchemaIssue.d.ts +1 -8
  360. package/dist/SchemaIssue.d.ts.map +1 -1
  361. package/dist/SchemaIssue.js.map +1 -1
  362. package/dist/SchemaParser.d.ts +194 -25
  363. package/dist/SchemaParser.d.ts.map +1 -1
  364. package/dist/SchemaParser.js +220 -26
  365. package/dist/SchemaParser.js.map +1 -1
  366. package/dist/SchemaRepresentation.d.ts +2 -2
  367. package/dist/SchemaTransformation.d.ts +61 -41
  368. package/dist/SchemaTransformation.d.ts.map +1 -1
  369. package/dist/SchemaTransformation.js +56 -33
  370. package/dist/SchemaTransformation.js.map +1 -1
  371. package/dist/SchemaUtils.d.ts +7 -0
  372. package/dist/SchemaUtils.d.ts.map +1 -1
  373. package/dist/SchemaUtils.js +23 -0
  374. package/dist/SchemaUtils.js.map +1 -1
  375. package/dist/Scope.d.ts +102 -43
  376. package/dist/Scope.d.ts.map +1 -1
  377. package/dist/Scope.js +57 -23
  378. package/dist/Scope.js.map +1 -1
  379. package/dist/ScopedCache.d.ts +138 -46
  380. package/dist/ScopedCache.d.ts.map +1 -1
  381. package/dist/ScopedCache.js +80 -19
  382. package/dist/ScopedCache.js.map +1 -1
  383. package/dist/ScopedRef.d.ts +28 -8
  384. package/dist/ScopedRef.d.ts.map +1 -1
  385. package/dist/ScopedRef.js +25 -5
  386. package/dist/ScopedRef.js.map +1 -1
  387. package/dist/Semaphore.d.ts +64 -28
  388. package/dist/Semaphore.d.ts.map +1 -1
  389. package/dist/Semaphore.js +22 -13
  390. package/dist/Semaphore.js.map +1 -1
  391. package/dist/Sink.d.ts +458 -200
  392. package/dist/Sink.d.ts.map +1 -1
  393. package/dist/Sink.js +240 -89
  394. package/dist/Sink.js.map +1 -1
  395. package/dist/Stdio.d.ts +43 -6
  396. package/dist/Stdio.d.ts.map +1 -1
  397. package/dist/Stdio.js +33 -4
  398. package/dist/Stdio.js.map +1 -1
  399. package/dist/Stream.d.ts +1899 -1186
  400. package/dist/Stream.d.ts.map +1 -1
  401. package/dist/Stream.js +868 -525
  402. package/dist/Stream.js.map +1 -1
  403. package/dist/String.d.ts +171 -95
  404. package/dist/String.d.ts.map +1 -1
  405. package/dist/String.js +125 -67
  406. package/dist/String.js.map +1 -1
  407. package/dist/SubscriptionRef.d.ts +308 -203
  408. package/dist/SubscriptionRef.d.ts.map +1 -1
  409. package/dist/SubscriptionRef.js +125 -76
  410. package/dist/SubscriptionRef.js.map +1 -1
  411. package/dist/Symbol.d.ts +13 -5
  412. package/dist/Symbol.d.ts.map +1 -1
  413. package/dist/Symbol.js +13 -5
  414. package/dist/Symbol.js.map +1 -1
  415. package/dist/SynchronizedRef.d.ts +278 -62
  416. package/dist/SynchronizedRef.d.ts.map +1 -1
  417. package/dist/SynchronizedRef.js +116 -23
  418. package/dist/SynchronizedRef.js.map +1 -1
  419. package/dist/Take.d.ts +26 -2
  420. package/dist/Take.d.ts.map +1 -1
  421. package/dist/Take.js +4 -1
  422. package/dist/Take.js.map +1 -1
  423. package/dist/Terminal.d.ts +39 -7
  424. package/dist/Terminal.d.ts.map +1 -1
  425. package/dist/Terminal.js +10 -4
  426. package/dist/Terminal.js.map +1 -1
  427. package/dist/Tracer.d.ts +229 -55
  428. package/dist/Tracer.d.ts.map +1 -1
  429. package/dist/Tracer.js +94 -18
  430. package/dist/Tracer.js.map +1 -1
  431. package/dist/Trie.d.ts +213 -142
  432. package/dist/Trie.d.ts.map +1 -1
  433. package/dist/Trie.js +88 -60
  434. package/dist/Trie.js.map +1 -1
  435. package/dist/TxChunk.d.ts +182 -146
  436. package/dist/TxChunk.d.ts.map +1 -1
  437. package/dist/TxChunk.js +73 -56
  438. package/dist/TxChunk.js.map +1 -1
  439. package/dist/TxDeferred.d.ts +43 -29
  440. package/dist/TxDeferred.d.ts.map +1 -1
  441. package/dist/TxDeferred.js +22 -15
  442. package/dist/TxDeferred.js.map +1 -1
  443. package/dist/TxHashMap.d.ts +362 -222
  444. package/dist/TxHashMap.d.ts.map +1 -1
  445. package/dist/TxHashMap.js +171 -98
  446. package/dist/TxHashMap.js.map +1 -1
  447. package/dist/TxHashSet.d.ts +178 -104
  448. package/dist/TxHashSet.d.ts.map +1 -1
  449. package/dist/TxHashSet.js +84 -43
  450. package/dist/TxHashSet.js.map +1 -1
  451. package/dist/TxPriorityQueue.d.ts +93 -62
  452. package/dist/TxPriorityQueue.d.ts.map +1 -1
  453. package/dist/TxPriorityQueue.js +54 -36
  454. package/dist/TxPriorityQueue.js.map +1 -1
  455. package/dist/TxPubSub.d.ts +77 -49
  456. package/dist/TxPubSub.d.ts.map +1 -1
  457. package/dist/TxPubSub.js +60 -37
  458. package/dist/TxPubSub.js.map +1 -1
  459. package/dist/TxQueue.d.ts +279 -241
  460. package/dist/TxQueue.d.ts.map +1 -1
  461. package/dist/TxQueue.js +147 -101
  462. package/dist/TxQueue.js.map +1 -1
  463. package/dist/TxReentrantLock.d.ts +69 -46
  464. package/dist/TxReentrantLock.d.ts.map +1 -1
  465. package/dist/TxReentrantLock.js +48 -32
  466. package/dist/TxReentrantLock.js.map +1 -1
  467. package/dist/TxRef.d.ts +69 -40
  468. package/dist/TxRef.d.ts.map +1 -1
  469. package/dist/TxRef.js +35 -20
  470. package/dist/TxRef.js.map +1 -1
  471. package/dist/TxSemaphore.d.ts +101 -54
  472. package/dist/TxSemaphore.d.ts.map +1 -1
  473. package/dist/TxSemaphore.js +76 -34
  474. package/dist/TxSemaphore.js.map +1 -1
  475. package/dist/TxSubscriptionRef.d.ts +72 -48
  476. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  477. package/dist/TxSubscriptionRef.js +33 -22
  478. package/dist/TxSubscriptionRef.js.map +1 -1
  479. package/dist/Types.d.ts +34 -34
  480. package/dist/UndefinedOr.d.ts +48 -25
  481. package/dist/UndefinedOr.d.ts.map +1 -1
  482. package/dist/UndefinedOr.js +28 -25
  483. package/dist/UndefinedOr.js.map +1 -1
  484. package/dist/Unify.d.ts +71 -116
  485. package/dist/Unify.d.ts.map +1 -1
  486. package/dist/Unify.js +20 -6
  487. package/dist/Unify.js.map +1 -1
  488. package/dist/Utils.d.ts +4 -0
  489. package/dist/Utils.d.ts.map +1 -1
  490. package/dist/Utils.js +4 -0
  491. package/dist/Utils.js.map +1 -1
  492. package/dist/index.d.ts +81 -32
  493. package/dist/index.d.ts.map +1 -1
  494. package/dist/index.js +81 -32
  495. package/dist/index.js.map +1 -1
  496. package/dist/internal/concurrency.js +2 -2
  497. package/dist/internal/concurrency.js.map +1 -1
  498. package/dist/internal/core.js +8 -20
  499. package/dist/internal/core.js.map +1 -1
  500. package/dist/internal/effect.js +20 -19
  501. package/dist/internal/effect.js.map +1 -1
  502. package/dist/internal/executionPlan.js +2 -2
  503. package/dist/internal/executionPlan.js.map +1 -1
  504. package/dist/internal/option.js +5 -8
  505. package/dist/internal/option.js.map +1 -1
  506. package/dist/internal/result.js +5 -8
  507. package/dist/internal/result.js.map +1 -1
  508. package/dist/internal/schema/schema.js +1 -1
  509. package/dist/internal/schema/schema.js.map +1 -1
  510. package/dist/testing/FastCheck.d.ts +6 -3
  511. package/dist/testing/FastCheck.d.ts.map +1 -1
  512. package/dist/testing/FastCheck.js +6 -3
  513. package/dist/testing/FastCheck.js.map +1 -1
  514. package/dist/testing/TestClock.d.ts +39 -34
  515. package/dist/testing/TestClock.d.ts.map +1 -1
  516. package/dist/testing/TestClock.js +42 -12
  517. package/dist/testing/TestClock.js.map +1 -1
  518. package/dist/testing/TestConsole.d.ts +39 -30
  519. package/dist/testing/TestConsole.d.ts.map +1 -1
  520. package/dist/testing/TestConsole.js +25 -10
  521. package/dist/testing/TestConsole.js.map +1 -1
  522. package/dist/testing/TestSchema.js +7 -7
  523. package/dist/testing/TestSchema.js.map +1 -1
  524. package/dist/unstable/ai/AiError.d.ts +197 -130
  525. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  526. package/dist/unstable/ai/AiError.js +166 -102
  527. package/dist/unstable/ai/AiError.js.map +1 -1
  528. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  529. package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
  530. package/dist/unstable/ai/Chat.d.ts +65 -41
  531. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  532. package/dist/unstable/ai/Chat.js +51 -33
  533. package/dist/unstable/ai/Chat.js.map +1 -1
  534. package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
  535. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  536. package/dist/unstable/ai/EmbeddingModel.js +9 -8
  537. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  538. package/dist/unstable/ai/IdGenerator.d.ts +28 -18
  539. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  540. package/dist/unstable/ai/IdGenerator.js +18 -11
  541. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  542. package/dist/unstable/ai/LanguageModel.d.ts +36 -30
  543. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  544. package/dist/unstable/ai/LanguageModel.js +21 -15
  545. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  546. package/dist/unstable/ai/McpSchema.d.ts +339 -119
  547. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  548. package/dist/unstable/ai/McpSchema.js +264 -98
  549. package/dist/unstable/ai/McpSchema.js.map +1 -1
  550. package/dist/unstable/ai/McpServer.d.ts +53 -19
  551. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  552. package/dist/unstable/ai/McpServer.js +65 -17
  553. package/dist/unstable/ai/McpServer.js.map +1 -1
  554. package/dist/unstable/ai/Model.d.ts +13 -7
  555. package/dist/unstable/ai/Model.d.ts.map +1 -1
  556. package/dist/unstable/ai/Model.js +11 -9
  557. package/dist/unstable/ai/Model.js.map +1 -1
  558. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  559. package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
  560. package/dist/unstable/ai/Prompt.d.ts +194 -168
  561. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  562. package/dist/unstable/ai/Prompt.js +75 -66
  563. package/dist/unstable/ai/Prompt.js.map +1 -1
  564. package/dist/unstable/ai/Response.d.ts +153 -140
  565. package/dist/unstable/ai/Response.d.ts.map +1 -1
  566. package/dist/unstable/ai/Response.js +43 -48
  567. package/dist/unstable/ai/Response.js.map +1 -1
  568. package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
  569. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
  570. package/dist/unstable/ai/ResponseIdTracker.js +27 -2
  571. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  572. package/dist/unstable/ai/Telemetry.d.ts +42 -32
  573. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  574. package/dist/unstable/ai/Telemetry.js +14 -10
  575. package/dist/unstable/ai/Telemetry.js.map +1 -1
  576. package/dist/unstable/ai/Tokenizer.d.ts +13 -8
  577. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  578. package/dist/unstable/ai/Tokenizer.js +10 -6
  579. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  580. package/dist/unstable/ai/Tool.d.ts +153 -84
  581. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  582. package/dist/unstable/ai/Tool.js +97 -44
  583. package/dist/unstable/ai/Tool.js.map +1 -1
  584. package/dist/unstable/ai/Toolkit.d.ts +33 -42
  585. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  586. package/dist/unstable/ai/Toolkit.js +35 -36
  587. package/dist/unstable/ai/Toolkit.js.map +1 -1
  588. package/dist/unstable/ai/index.d.ts +42 -24
  589. package/dist/unstable/ai/index.d.ts.map +1 -1
  590. package/dist/unstable/ai/index.js +42 -24
  591. package/dist/unstable/ai/index.js.map +1 -1
  592. package/dist/unstable/cli/Argument.d.ts +226 -134
  593. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  594. package/dist/unstable/cli/Argument.js +101 -65
  595. package/dist/unstable/cli/Argument.js.map +1 -1
  596. package/dist/unstable/cli/CliError.d.ts +72 -26
  597. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  598. package/dist/unstable/cli/CliError.js +86 -23
  599. package/dist/unstable/cli/CliError.js.map +1 -1
  600. package/dist/unstable/cli/CliOutput.d.ts +43 -13
  601. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  602. package/dist/unstable/cli/CliOutput.js +30 -6
  603. package/dist/unstable/cli/CliOutput.js.map +1 -1
  604. package/dist/unstable/cli/Command.d.ts +218 -117
  605. package/dist/unstable/cli/Command.d.ts.map +1 -1
  606. package/dist/unstable/cli/Command.js +45 -31
  607. package/dist/unstable/cli/Command.js.map +1 -1
  608. package/dist/unstable/cli/Completions.d.ts +7 -7
  609. package/dist/unstable/cli/Completions.js +1 -1
  610. package/dist/unstable/cli/Flag.d.ts +235 -142
  611. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  612. package/dist/unstable/cli/Flag.js +111 -71
  613. package/dist/unstable/cli/Flag.js.map +1 -1
  614. package/dist/unstable/cli/GlobalFlag.d.ts +42 -14
  615. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  616. package/dist/unstable/cli/GlobalFlag.js +30 -7
  617. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  618. package/dist/unstable/cli/HelpDoc.d.ts +35 -10
  619. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  620. package/dist/unstable/cli/HelpDoc.js +21 -0
  621. package/dist/unstable/cli/Param.d.ts +79 -31
  622. package/dist/unstable/cli/Param.d.ts.map +1 -1
  623. package/dist/unstable/cli/Param.js +161 -99
  624. package/dist/unstable/cli/Param.js.map +1 -1
  625. package/dist/unstable/cli/Primitive.d.ts +79 -42
  626. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  627. package/dist/unstable/cli/Primitive.js +66 -35
  628. package/dist/unstable/cli/Primitive.js.map +1 -1
  629. package/dist/unstable/cli/Prompt.d.ts +178 -47
  630. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  631. package/dist/unstable/cli/Prompt.js +111 -31
  632. package/dist/unstable/cli/Prompt.js.map +1 -1
  633. package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
  634. package/dist/unstable/cli/internal/ansi.js +13 -0
  635. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  636. package/dist/unstable/cli/internal/command.d.ts +7 -7
  637. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  638. package/dist/unstable/cli/internal/command.js +12 -10
  639. package/dist/unstable/cli/internal/command.js.map +1 -1
  640. package/dist/unstable/cli/internal/config.d.ts +3 -0
  641. package/dist/unstable/cli/internal/config.d.ts.map +1 -1
  642. package/dist/unstable/cli/internal/config.js.map +1 -1
  643. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  644. package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
  645. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  646. package/dist/unstable/cluster/ClusterCron.js +35 -1
  647. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  648. package/dist/unstable/cluster/ClusterError.d.ts +56 -7
  649. package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
  650. package/dist/unstable/cluster/ClusterError.js +56 -7
  651. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  652. package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
  653. package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
  654. package/dist/unstable/cluster/ClusterMetrics.js +39 -5
  655. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  656. package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
  657. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  658. package/dist/unstable/cluster/ClusterSchema.js +61 -8
  659. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  660. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
  661. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  662. package/dist/unstable/cluster/ClusterWorkflowEngine.js +36 -3
  663. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  664. package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
  665. package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
  666. package/dist/unstable/cluster/DeliverAt.js +11 -3
  667. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  668. package/dist/unstable/cluster/Entity.d.ts +75 -16
  669. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  670. package/dist/unstable/cluster/Entity.js +78 -13
  671. package/dist/unstable/cluster/Entity.js.map +1 -1
  672. package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
  673. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  674. package/dist/unstable/cluster/EntityAddress.js +30 -2
  675. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  676. package/dist/unstable/cluster/EntityId.d.ts +18 -3
  677. package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
  678. package/dist/unstable/cluster/EntityId.js +15 -2
  679. package/dist/unstable/cluster/EntityId.js.map +1 -1
  680. package/dist/unstable/cluster/EntityProxy.d.ts +34 -2
  681. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  682. package/dist/unstable/cluster/EntityProxy.js +24 -2
  683. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  684. package/dist/unstable/cluster/EntityProxyServer.d.ts +17 -2
  685. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  686. package/dist/unstable/cluster/EntityProxyServer.js +40 -8
  687. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  688. package/dist/unstable/cluster/EntityResource.d.ts +43 -6
  689. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  690. package/dist/unstable/cluster/EntityResource.js +11 -4
  691. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  692. package/dist/unstable/cluster/EntityType.d.ts +27 -3
  693. package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
  694. package/dist/unstable/cluster/EntityType.js +24 -2
  695. package/dist/unstable/cluster/EntityType.js.map +1 -1
  696. package/dist/unstable/cluster/Envelope.d.ts +105 -23
  697. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  698. package/dist/unstable/cluster/Envelope.js +88 -14
  699. package/dist/unstable/cluster/Envelope.js.map +1 -1
  700. package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
  701. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  702. package/dist/unstable/cluster/HttpRunner.js +88 -13
  703. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  704. package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
  705. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  706. package/dist/unstable/cluster/K8sHttpClient.js +31 -6
  707. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  708. package/dist/unstable/cluster/MachineId.d.ts +24 -3
  709. package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
  710. package/dist/unstable/cluster/MachineId.js +21 -2
  711. package/dist/unstable/cluster/MachineId.js.map +1 -1
  712. package/dist/unstable/cluster/Message.d.ts +102 -13
  713. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  714. package/dist/unstable/cluster/Message.js +86 -10
  715. package/dist/unstable/cluster/Message.js.map +1 -1
  716. package/dist/unstable/cluster/MessageStorage.d.ts +127 -21
  717. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  718. package/dist/unstable/cluster/MessageStorage.js +71 -11
  719. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  720. package/dist/unstable/cluster/Reply.d.ts +101 -12
  721. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  722. package/dist/unstable/cluster/Reply.js +64 -8
  723. package/dist/unstable/cluster/Reply.js.map +1 -1
  724. package/dist/unstable/cluster/Runner.d.ts +47 -17
  725. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  726. package/dist/unstable/cluster/Runner.js +47 -17
  727. package/dist/unstable/cluster/Runner.js.map +1 -1
  728. package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
  729. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  730. package/dist/unstable/cluster/RunnerAddress.js +34 -2
  731. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  732. package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
  733. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  734. package/dist/unstable/cluster/RunnerHealth.js +40 -12
  735. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  736. package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
  737. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  738. package/dist/unstable/cluster/RunnerServer.js +31 -4
  739. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  740. package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
  741. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  742. package/dist/unstable/cluster/RunnerStorage.js +38 -4
  743. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  744. package/dist/unstable/cluster/Runners.d.ts +73 -10
  745. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  746. package/dist/unstable/cluster/Runners.js +70 -9
  747. package/dist/unstable/cluster/Runners.js.map +1 -1
  748. package/dist/unstable/cluster/ShardId.d.ts +51 -5
  749. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  750. package/dist/unstable/cluster/ShardId.js +47 -4
  751. package/dist/unstable/cluster/ShardId.js.map +1 -1
  752. package/dist/unstable/cluster/Sharding.d.ts +10 -2
  753. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  754. package/dist/unstable/cluster/Sharding.js +35 -4
  755. package/dist/unstable/cluster/Sharding.js.map +1 -1
  756. package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
  757. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  758. package/dist/unstable/cluster/ShardingConfig.js +67 -10
  759. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  760. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
  761. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
  762. package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
  763. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  764. package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
  765. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  766. package/dist/unstable/cluster/SingleRunner.js +23 -1
  767. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  768. package/dist/unstable/cluster/Singleton.d.ts +15 -1
  769. package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
  770. package/dist/unstable/cluster/Singleton.js +15 -1
  771. package/dist/unstable/cluster/Singleton.js.map +1 -1
  772. package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
  773. package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
  774. package/dist/unstable/cluster/SingletonAddress.js +21 -1
  775. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  776. package/dist/unstable/cluster/Snowflake.d.ts +89 -19
  777. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  778. package/dist/unstable/cluster/Snowflake.js +48 -13
  779. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  780. package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
  781. package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
  782. package/dist/unstable/cluster/SocketRunner.js +29 -2
  783. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  784. package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
  785. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  786. package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
  787. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  788. package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
  789. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  790. package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
  791. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  792. package/dist/unstable/cluster/TestRunner.d.ts +18 -1
  793. package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
  794. package/dist/unstable/cluster/TestRunner.js +18 -1
  795. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  796. package/dist/unstable/cluster/internal/hash.js +12 -0
  797. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  798. package/dist/unstable/devtools/DevTools.d.ts +26 -3
  799. package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
  800. package/dist/unstable/devtools/DevTools.js +26 -3
  801. package/dist/unstable/devtools/DevTools.js.map +1 -1
  802. package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
  803. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  804. package/dist/unstable/devtools/DevToolsClient.js +32 -5
  805. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  806. package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
  807. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  808. package/dist/unstable/devtools/DevToolsSchema.js +102 -20
  809. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  810. package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
  811. package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
  812. package/dist/unstable/devtools/DevToolsServer.js +21 -1
  813. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  814. package/dist/unstable/encoding/Msgpack.d.ts +81 -12
  815. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  816. package/dist/unstable/encoding/Msgpack.js +75 -9
  817. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  818. package/dist/unstable/encoding/Ndjson.d.ts +149 -21
  819. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  820. package/dist/unstable/encoding/Ndjson.js +97 -13
  821. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  822. package/dist/unstable/encoding/Sse.d.ts +109 -18
  823. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  824. package/dist/unstable/encoding/Sse.js +69 -13
  825. package/dist/unstable/encoding/Sse.js.map +1 -1
  826. package/dist/unstable/eventlog/Event.d.ts +115 -30
  827. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  828. package/dist/unstable/eventlog/Event.js +22 -2
  829. package/dist/unstable/eventlog/Event.js.map +1 -1
  830. package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
  831. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  832. package/dist/unstable/eventlog/EventGroup.js +24 -6
  833. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  834. package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
  835. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  836. package/dist/unstable/eventlog/EventJournal.js +108 -16
  837. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  838. package/dist/unstable/eventlog/EventLog.d.ts +151 -31
  839. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  840. package/dist/unstable/eventlog/EventLog.js +111 -20
  841. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  842. package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
  843. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  844. package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
  845. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  846. package/dist/unstable/eventlog/EventLogMessage.d.ts +96 -22
  847. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  848. package/dist/unstable/eventlog/EventLogMessage.js +72 -16
  849. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  850. package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
  851. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  852. package/dist/unstable/eventlog/EventLogRemote.js +54 -8
  853. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  854. package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
  855. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  856. package/dist/unstable/eventlog/EventLogServer.js +17 -3
  857. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  858. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
  859. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  860. package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
  861. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  862. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
  863. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  864. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
  865. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  866. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
  867. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
  868. package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
  869. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  870. package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
  871. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  872. package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
  873. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  874. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
  875. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  876. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
  877. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  878. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
  879. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  880. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
  881. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  882. package/dist/unstable/http/Cookies.d.ts +156 -77
  883. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  884. package/dist/unstable/http/Cookies.js +93 -39
  885. package/dist/unstable/http/Cookies.js.map +1 -1
  886. package/dist/unstable/http/Etag.d.ts +40 -7
  887. package/dist/unstable/http/Etag.d.ts.map +1 -1
  888. package/dist/unstable/http/Etag.js +27 -4
  889. package/dist/unstable/http/Etag.js.map +1 -1
  890. package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
  891. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  892. package/dist/unstable/http/FetchHttpClient.js +33 -4
  893. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  894. package/dist/unstable/http/FindMyWay.d.ts +1 -1
  895. package/dist/unstable/http/FindMyWay.js +1 -1
  896. package/dist/unstable/http/Headers.d.ts +182 -36
  897. package/dist/unstable/http/Headers.d.ts.map +1 -1
  898. package/dist/unstable/http/Headers.js +86 -16
  899. package/dist/unstable/http/Headers.js.map +1 -1
  900. package/dist/unstable/http/HttpBody.d.ts +114 -26
  901. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  902. package/dist/unstable/http/HttpBody.js +100 -22
  903. package/dist/unstable/http/HttpBody.js.map +1 -1
  904. package/dist/unstable/http/HttpClient.d.ts +205 -96
  905. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  906. package/dist/unstable/http/HttpClient.js +85 -39
  907. package/dist/unstable/http/HttpClient.js.map +1 -1
  908. package/dist/unstable/http/HttpClientError.d.ts +68 -12
  909. package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
  910. package/dist/unstable/http/HttpClientError.js +71 -9
  911. package/dist/unstable/http/HttpClientError.js.map +1 -1
  912. package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
  913. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  914. package/dist/unstable/http/HttpClientRequest.js +153 -47
  915. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  916. package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
  917. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  918. package/dist/unstable/http/HttpClientResponse.js +44 -11
  919. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  920. package/dist/unstable/http/HttpEffect.d.ts +42 -16
  921. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  922. package/dist/unstable/http/HttpEffect.js +33 -13
  923. package/dist/unstable/http/HttpEffect.js.map +1 -1
  924. package/dist/unstable/http/HttpIncomingMessage.d.ts +47 -7
  925. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  926. package/dist/unstable/http/HttpIncomingMessage.js +44 -6
  927. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  928. package/dist/unstable/http/HttpMethod.d.ts +35 -5
  929. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  930. package/dist/unstable/http/HttpMethod.js +23 -1
  931. package/dist/unstable/http/HttpMethod.js.map +1 -1
  932. package/dist/unstable/http/HttpMiddleware.d.ts +37 -11
  933. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  934. package/dist/unstable/http/HttpMiddleware.js +70 -31
  935. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  936. package/dist/unstable/http/HttpPlatform.d.ts +34 -3
  937. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  938. package/dist/unstable/http/HttpPlatform.js +35 -4
  939. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  940. package/dist/unstable/http/HttpRouter.d.ts +194 -45
  941. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  942. package/dist/unstable/http/HttpRouter.js +122 -28
  943. package/dist/unstable/http/HttpRouter.js.map +1 -1
  944. package/dist/unstable/http/HttpServer.d.ts +151 -22
  945. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  946. package/dist/unstable/http/HttpServer.js +77 -12
  947. package/dist/unstable/http/HttpServer.js.map +1 -1
  948. package/dist/unstable/http/HttpServerError.d.ts +90 -10
  949. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  950. package/dist/unstable/http/HttpServerError.js +82 -8
  951. package/dist/unstable/http/HttpServerError.js.map +1 -1
  952. package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
  953. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  954. package/dist/unstable/http/HttpServerRequest.js +112 -31
  955. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  956. package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
  957. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  958. package/dist/unstable/http/HttpServerRespondable.js +43 -5
  959. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  960. package/dist/unstable/http/HttpServerResponse.d.ts +390 -67
  961. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  962. package/dist/unstable/http/HttpServerResponse.js +209 -38
  963. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  964. package/dist/unstable/http/HttpStaticServer.d.ts +22 -4
  965. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  966. package/dist/unstable/http/HttpStaticServer.js +22 -4
  967. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  968. package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
  969. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  970. package/dist/unstable/http/HttpTraceContext.js +47 -5
  971. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  972. package/dist/unstable/http/Multipart.d.ts +178 -28
  973. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  974. package/dist/unstable/http/Multipart.js +130 -20
  975. package/dist/unstable/http/Multipart.js.map +1 -1
  976. package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
  977. package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
  978. package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
  979. package/dist/unstable/http/Multipasta/Node.js +1 -1
  980. package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
  981. package/dist/unstable/http/Multipasta/Search.js +1 -1
  982. package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
  983. package/dist/unstable/http/Multipasta/Web.js +1 -1
  984. package/dist/unstable/http/Multipasta.d.ts +1 -1
  985. package/dist/unstable/http/Multipasta.js +1 -1
  986. package/dist/unstable/http/Template.d.ts +53 -0
  987. package/dist/unstable/http/Template.d.ts.map +1 -1
  988. package/dist/unstable/http/Template.js +26 -0
  989. package/dist/unstable/http/Template.js.map +1 -1
  990. package/dist/unstable/http/Url.d.ts +56 -42
  991. package/dist/unstable/http/Url.d.ts.map +1 -1
  992. package/dist/unstable/http/Url.js +29 -15
  993. package/dist/unstable/http/Url.js.map +1 -1
  994. package/dist/unstable/http/UrlParams.d.ts +233 -49
  995. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  996. package/dist/unstable/http/UrlParams.js +116 -23
  997. package/dist/unstable/http/UrlParams.js.map +1 -1
  998. package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
  999. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  1000. package/dist/unstable/httpapi/HttpApi.js +14 -8
  1001. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  1002. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +55 -16
  1003. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  1004. package/dist/unstable/httpapi/HttpApiBuilder.js +47 -9
  1005. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  1006. package/dist/unstable/httpapi/HttpApiClient.d.ts +58 -15
  1007. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  1008. package/dist/unstable/httpapi/HttpApiClient.js +43 -7
  1009. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  1010. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
  1011. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  1012. package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
  1013. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  1014. package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
  1015. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  1016. package/dist/unstable/httpapi/HttpApiError.js +98 -1
  1017. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  1018. package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
  1019. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  1020. package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
  1021. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  1022. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
  1023. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  1024. package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -6
  1025. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  1026. package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
  1027. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  1028. package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
  1029. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  1030. package/dist/unstable/httpapi/HttpApiSchema.d.ts +67 -30
  1031. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  1032. package/dist/unstable/httpapi/HttpApiSchema.js +48 -27
  1033. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  1034. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +74 -17
  1035. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  1036. package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
  1037. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  1038. package/dist/unstable/httpapi/HttpApiSwagger.d.ts +5 -2
  1039. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  1040. package/dist/unstable/httpapi/HttpApiSwagger.js +24 -2
  1041. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  1042. package/dist/unstable/httpapi/HttpApiTest.d.ts +9 -2
  1043. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  1044. package/dist/unstable/httpapi/HttpApiTest.js +28 -3
  1045. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  1046. package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
  1047. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  1048. package/dist/unstable/httpapi/OpenApi.js +73 -15
  1049. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  1050. package/dist/unstable/observability/Otlp.d.ts +33 -3
  1051. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  1052. package/dist/unstable/observability/Otlp.js +14 -3
  1053. package/dist/unstable/observability/Otlp.js.map +1 -1
  1054. package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
  1055. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  1056. package/dist/unstable/observability/OtlpExporter.js +32 -1
  1057. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  1058. package/dist/unstable/observability/OtlpLogger.d.ts +14 -2
  1059. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  1060. package/dist/unstable/observability/OtlpLogger.js +29 -2
  1061. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  1062. package/dist/unstable/observability/OtlpMetrics.d.ts +15 -4
  1063. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  1064. package/dist/unstable/observability/OtlpMetrics.js +32 -2
  1065. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  1066. package/dist/unstable/observability/OtlpResource.d.ts +49 -12
  1067. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  1068. package/dist/unstable/observability/OtlpResource.js +47 -5
  1069. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  1070. package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
  1071. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  1072. package/dist/unstable/observability/OtlpSerialization.js +28 -3
  1073. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  1074. package/dist/unstable/observability/OtlpTracer.d.ts +16 -2
  1075. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  1076. package/dist/unstable/observability/OtlpTracer.js +32 -2
  1077. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  1078. package/dist/unstable/observability/PrometheusMetrics.d.ts +32 -12
  1079. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  1080. package/dist/unstable/observability/PrometheusMetrics.js +7 -5
  1081. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  1082. package/dist/unstable/observability/index.d.ts +2 -1
  1083. package/dist/unstable/observability/index.d.ts.map +1 -1
  1084. package/dist/unstable/observability/index.js +2 -1
  1085. package/dist/unstable/observability/index.js.map +1 -1
  1086. package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
  1087. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  1088. package/dist/unstable/persistence/KeyValueStore.js +81 -21
  1089. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1090. package/dist/unstable/persistence/Persistable.d.ts +76 -15
  1091. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  1092. package/dist/unstable/persistence/Persistable.js +22 -5
  1093. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1094. package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
  1095. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  1096. package/dist/unstable/persistence/PersistedCache.js +24 -1
  1097. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1098. package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
  1099. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  1100. package/dist/unstable/persistence/PersistedQueue.js +60 -13
  1101. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1102. package/dist/unstable/persistence/Persistence.d.ts +97 -16
  1103. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1104. package/dist/unstable/persistence/Persistence.js +90 -14
  1105. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1106. package/dist/unstable/persistence/RateLimiter.d.ts +97 -21
  1107. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1108. package/dist/unstable/persistence/RateLimiter.js +82 -17
  1109. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1110. package/dist/unstable/persistence/Redis.d.ts +26 -5
  1111. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  1112. package/dist/unstable/persistence/Redis.js +36 -4
  1113. package/dist/unstable/persistence/Redis.js.map +1 -1
  1114. package/dist/unstable/process/ChildProcess.d.ts +89 -109
  1115. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1116. package/dist/unstable/process/ChildProcess.js +74 -23
  1117. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1118. package/dist/unstable/process/ChildProcessSpawner.d.ts +22 -11
  1119. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1120. package/dist/unstable/process/ChildProcessSpawner.js +11 -6
  1121. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1122. package/dist/unstable/process/index.d.ts +2 -1
  1123. package/dist/unstable/process/index.d.ts.map +1 -1
  1124. package/dist/unstable/process/index.js +2 -1
  1125. package/dist/unstable/process/index.js.map +1 -1
  1126. package/dist/unstable/reactivity/AsyncResult.d.ts +196 -59
  1127. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1128. package/dist/unstable/reactivity/AsyncResult.js +121 -36
  1129. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1130. package/dist/unstable/reactivity/Atom.d.ts +539 -130
  1131. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1132. package/dist/unstable/reactivity/Atom.js +256 -62
  1133. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1134. package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
  1135. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1136. package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
  1137. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1138. package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
  1139. package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
  1140. package/dist/unstable/reactivity/AtomRef.js +29 -3
  1141. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1142. package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
  1143. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  1144. package/dist/unstable/reactivity/AtomRegistry.js +69 -10
  1145. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1146. package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
  1147. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1148. package/dist/unstable/reactivity/AtomRpc.js +29 -1
  1149. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1150. package/dist/unstable/reactivity/Hydration.d.ts +28 -5
  1151. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  1152. package/dist/unstable/reactivity/Hydration.js +35 -3
  1153. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1154. package/dist/unstable/reactivity/Reactivity.d.ts +95 -13
  1155. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  1156. package/dist/unstable/reactivity/Reactivity.js +61 -7
  1157. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1158. package/dist/unstable/rpc/Rpc.d.ts +255 -56
  1159. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1160. package/dist/unstable/rpc/Rpc.js +44 -11
  1161. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1162. package/dist/unstable/rpc/RpcClient.d.ts +81 -19
  1163. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1164. package/dist/unstable/rpc/RpcClient.js +53 -13
  1165. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1166. package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
  1167. package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
  1168. package/dist/unstable/rpc/RpcClientError.js +26 -2
  1169. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1170. package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
  1171. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  1172. package/dist/unstable/rpc/RpcGroup.js +3 -1
  1173. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1174. package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
  1175. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1176. package/dist/unstable/rpc/RpcMessage.js +23 -7
  1177. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1178. package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
  1179. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  1180. package/dist/unstable/rpc/RpcMiddleware.js +39 -3
  1181. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1182. package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
  1183. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  1184. package/dist/unstable/rpc/RpcSchema.js +34 -3
  1185. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1186. package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
  1187. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1188. package/dist/unstable/rpc/RpcSerialization.js +56 -12
  1189. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1190. package/dist/unstable/rpc/RpcServer.d.ts +73 -23
  1191. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  1192. package/dist/unstable/rpc/RpcServer.js +70 -23
  1193. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1194. package/dist/unstable/rpc/RpcTest.d.ts +20 -1
  1195. package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
  1196. package/dist/unstable/rpc/RpcTest.js +20 -1
  1197. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1198. package/dist/unstable/rpc/RpcWorker.d.ts +40 -6
  1199. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  1200. package/dist/unstable/rpc/RpcWorker.js +17 -5
  1201. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1202. package/dist/unstable/rpc/Utils.d.ts +8 -0
  1203. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  1204. package/dist/unstable/rpc/Utils.js +8 -0
  1205. package/dist/unstable/rpc/Utils.js.map +1 -1
  1206. package/dist/unstable/schema/Model.d.ts +130 -52
  1207. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1208. package/dist/unstable/schema/Model.js +79 -34
  1209. package/dist/unstable/schema/Model.js.map +1 -1
  1210. package/dist/unstable/schema/VariantSchema.d.ts +104 -24
  1211. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1212. package/dist/unstable/schema/VariantSchema.js +22 -6
  1213. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1214. package/dist/unstable/socket/Socket.d.ts +167 -34
  1215. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1216. package/dist/unstable/socket/Socket.js +124 -29
  1217. package/dist/unstable/socket/Socket.js.map +1 -1
  1218. package/dist/unstable/socket/SocketServer.d.ts +58 -10
  1219. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  1220. package/dist/unstable/socket/SocketServer.js +43 -5
  1221. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1222. package/dist/unstable/sql/Migrator.d.ts +35 -4
  1223. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  1224. package/dist/unstable/sql/Migrator.js +45 -5
  1225. package/dist/unstable/sql/Migrator.js.map +1 -1
  1226. package/dist/unstable/sql/SqlClient.d.ts +34 -2
  1227. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1228. package/dist/unstable/sql/SqlClient.js +38 -1
  1229. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1230. package/dist/unstable/sql/SqlConnection.d.ts +31 -0
  1231. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  1232. package/dist/unstable/sql/SqlConnection.js +22 -0
  1233. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1234. package/dist/unstable/sql/SqlError.d.ts +99 -0
  1235. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  1236. package/dist/unstable/sql/SqlError.js +114 -0
  1237. package/dist/unstable/sql/SqlError.js.map +1 -1
  1238. package/dist/unstable/sql/SqlModel.d.ts +26 -5
  1239. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  1240. package/dist/unstable/sql/SqlModel.js +8 -4
  1241. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1242. package/dist/unstable/sql/SqlResolver.d.ts +56 -13
  1243. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  1244. package/dist/unstable/sql/SqlResolver.js +44 -10
  1245. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1246. package/dist/unstable/sql/SqlSchema.d.ts +29 -8
  1247. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  1248. package/dist/unstable/sql/SqlSchema.js +29 -8
  1249. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1250. package/dist/unstable/sql/SqlStream.d.ts +3 -0
  1251. package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
  1252. package/dist/unstable/sql/SqlStream.js +23 -0
  1253. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1254. package/dist/unstable/sql/Statement.d.ts +124 -0
  1255. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1256. package/dist/unstable/sql/Statement.js +82 -0
  1257. package/dist/unstable/sql/Statement.js.map +1 -1
  1258. package/dist/unstable/sql/index.d.ts +1 -1
  1259. package/dist/unstable/sql/index.js +1 -1
  1260. package/dist/unstable/workers/Transferable.d.ts +65 -13
  1261. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  1262. package/dist/unstable/workers/Transferable.js +53 -10
  1263. package/dist/unstable/workers/Transferable.js.map +1 -1
  1264. package/dist/unstable/workers/Worker.d.ts +60 -8
  1265. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  1266. package/dist/unstable/workers/Worker.js +43 -4
  1267. package/dist/unstable/workers/Worker.js.map +1 -1
  1268. package/dist/unstable/workers/WorkerError.d.ts +31 -9
  1269. package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
  1270. package/dist/unstable/workers/WorkerError.js +44 -7
  1271. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1272. package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
  1273. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  1274. package/dist/unstable/workers/WorkerRunner.js +24 -1
  1275. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1276. package/dist/unstable/workers/index.d.ts +1 -1
  1277. package/dist/unstable/workers/index.js +1 -1
  1278. package/dist/unstable/workflow/Activity.d.ts +61 -10
  1279. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  1280. package/dist/unstable/workflow/Activity.js +21 -6
  1281. package/dist/unstable/workflow/Activity.js.map +1 -1
  1282. package/dist/unstable/workflow/DurableClock.d.ts +12 -3
  1283. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  1284. package/dist/unstable/workflow/DurableClock.js +22 -2
  1285. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1286. package/dist/unstable/workflow/DurableDeferred.d.ts +126 -31
  1287. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1288. package/dist/unstable/workflow/DurableDeferred.js +76 -13
  1289. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1290. package/dist/unstable/workflow/DurableQueue.d.ts +145 -0
  1291. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -0
  1292. package/dist/unstable/workflow/DurableQueue.js +200 -0
  1293. package/dist/unstable/workflow/DurableQueue.js.map +1 -0
  1294. package/dist/unstable/workflow/Workflow.d.ts +100 -31
  1295. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1296. package/dist/unstable/workflow/Workflow.js +76 -20
  1297. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1298. package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
  1299. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  1300. package/dist/unstable/workflow/WorkflowEngine.js +16 -4
  1301. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1302. package/dist/unstable/workflow/WorkflowProxy.d.ts +32 -2
  1303. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1304. package/dist/unstable/workflow/WorkflowProxy.js +2 -2
  1305. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1306. package/dist/unstable/workflow/WorkflowProxyServer.d.ts +36 -2
  1307. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  1308. package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
  1309. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1310. package/dist/unstable/workflow/index.d.ts +4 -0
  1311. package/dist/unstable/workflow/index.d.ts.map +1 -1
  1312. package/dist/unstable/workflow/index.js +4 -0
  1313. package/dist/unstable/workflow/index.js.map +1 -1
  1314. package/package.json +11 -11
  1315. package/src/Array.ts +113 -67
  1316. package/src/BigDecimal.ts +404 -337
  1317. package/src/BigInt.ts +167 -97
  1318. package/src/Boolean.ts +62 -31
  1319. package/src/Brand.ts +20 -1
  1320. package/src/Cache.ts +331 -164
  1321. package/src/Cause.ts +77 -65
  1322. package/src/Channel.ts +1585 -607
  1323. package/src/ChannelSchema.ts +137 -12
  1324. package/src/Chunk.ts +549 -380
  1325. package/src/Clock.ts +15 -8
  1326. package/src/Combiner.ts +2 -4
  1327. package/src/Config.ts +12 -10
  1328. package/src/ConfigProvider.ts +1 -1
  1329. package/src/Console.ts +88 -58
  1330. package/src/Context.ts +397 -149
  1331. package/src/Cron.ts +111 -48
  1332. package/src/Data.ts +3 -2
  1333. package/src/DateTime.ts +876 -445
  1334. package/src/Deferred.ts +367 -174
  1335. package/src/Differ.ts +42 -0
  1336. package/src/Duration.ts +329 -185
  1337. package/src/Effect.ts +2474 -2395
  1338. package/src/Effectable.ts +39 -4
  1339. package/src/Encoding.ts +78 -28
  1340. package/src/Equivalence.ts +14 -19
  1341. package/src/ErrorReporter.ts +66 -82
  1342. package/src/ExecutionPlan.ts +97 -13
  1343. package/src/Exit.ts +7 -5
  1344. package/src/Fiber.ts +72 -40
  1345. package/src/FiberHandle.ts +158 -58
  1346. package/src/FiberMap.ts +329 -164
  1347. package/src/FiberSet.ts +130 -52
  1348. package/src/FileSystem.ts +106 -74
  1349. package/src/Filter.ts +166 -88
  1350. package/src/Function.ts +154 -86
  1351. package/src/Graph.ts +682 -365
  1352. package/src/HKT.ts +29 -13
  1353. package/src/Hash.ts +31 -18
  1354. package/src/HashMap.ts +444 -256
  1355. package/src/HashRing.ts +94 -17
  1356. package/src/HashSet.ts +194 -104
  1357. package/src/Inspectable.ts +22 -10
  1358. package/src/Iterable.ts +309 -149
  1359. package/src/JsonPatch.ts +4 -3
  1360. package/src/Latch.ts +98 -15
  1361. package/src/Layer.ts +488 -345
  1362. package/src/LayerMap.ts +98 -25
  1363. package/src/LogLevel.ts +92 -131
  1364. package/src/Logger.ts +357 -288
  1365. package/src/ManagedRuntime.ts +75 -17
  1366. package/src/Match.ts +133 -157
  1367. package/src/Metric.ts +355 -304
  1368. package/src/MutableHashMap.ts +161 -84
  1369. package/src/MutableHashSet.ts +122 -52
  1370. package/src/MutableList.ts +141 -81
  1371. package/src/MutableRef.ts +130 -90
  1372. package/src/Newtype.ts +3 -0
  1373. package/src/NonEmptyIterable.ts +36 -39
  1374. package/src/Number.ts +116 -64
  1375. package/src/Optic.ts +1 -2
  1376. package/src/Option.ts +41 -53
  1377. package/src/Ordering.ts +43 -28
  1378. package/src/PartitionedSemaphore.ts +225 -40
  1379. package/src/Path.ts +77 -13
  1380. package/src/Pipeable.ts +76 -21
  1381. package/src/PlatformError.ts +74 -6
  1382. package/src/Pool.ts +94 -31
  1383. package/src/Predicate.ts +16 -21
  1384. package/src/PrimaryKey.ts +9 -2
  1385. package/src/PubSub.ts +364 -262
  1386. package/src/Pull.ts +94 -25
  1387. package/src/Queue.ts +284 -150
  1388. package/src/Random.ts +54 -35
  1389. package/src/RcMap.ts +151 -141
  1390. package/src/RcRef.ts +69 -32
  1391. package/src/Record.ts +273 -129
  1392. package/src/Redactable.ts +3 -3
  1393. package/src/Redacted.ts +63 -33
  1394. package/src/Ref.ts +161 -104
  1395. package/src/References.ts +73 -31
  1396. package/src/RegExp.ts +11 -5
  1397. package/src/Request.ts +158 -34
  1398. package/src/RequestResolver.ts +277 -119
  1399. package/src/Resource.ts +45 -7
  1400. package/src/Result.ts +31 -18
  1401. package/src/Runtime.ts +45 -19
  1402. package/src/Schedule.ts +575 -600
  1403. package/src/Scheduler.ts +43 -6
  1404. package/src/Schema.ts +845 -319
  1405. package/src/SchemaAST.ts +25 -16
  1406. package/src/SchemaGetter.ts +32 -17
  1407. package/src/SchemaIssue.ts +1 -8
  1408. package/src/SchemaParser.ts +262 -38
  1409. package/src/SchemaTransformation.ts +61 -41
  1410. package/src/SchemaUtils.ts +23 -0
  1411. package/src/Scope.ts +102 -43
  1412. package/src/ScopedCache.ts +192 -56
  1413. package/src/ScopedRef.ts +28 -8
  1414. package/src/Semaphore.ts +64 -28
  1415. package/src/Sink.ts +458 -200
  1416. package/src/Stdio.ts +43 -6
  1417. package/src/Stream.ts +2043 -1256
  1418. package/src/String.ts +171 -95
  1419. package/src/SubscriptionRef.ts +308 -203
  1420. package/src/Symbol.ts +13 -5
  1421. package/src/SynchronizedRef.ts +278 -62
  1422. package/src/Take.ts +26 -2
  1423. package/src/Terminal.ts +40 -7
  1424. package/src/Tracer.ts +229 -55
  1425. package/src/Trie.ts +213 -142
  1426. package/src/TxChunk.ts +182 -146
  1427. package/src/TxDeferred.ts +43 -29
  1428. package/src/TxHashMap.ts +370 -230
  1429. package/src/TxHashSet.ts +250 -152
  1430. package/src/TxPriorityQueue.ts +96 -64
  1431. package/src/TxPubSub.ts +77 -49
  1432. package/src/TxQueue.ts +279 -241
  1433. package/src/TxReentrantLock.ts +70 -47
  1434. package/src/TxRef.ts +70 -41
  1435. package/src/TxSemaphore.ts +101 -54
  1436. package/src/TxSubscriptionRef.ts +72 -48
  1437. package/src/Types.ts +34 -34
  1438. package/src/UndefinedOr.ts +48 -25
  1439. package/src/Unify.ts +71 -116
  1440. package/src/Utils.ts +4 -0
  1441. package/src/index.ts +81 -32
  1442. package/src/internal/concurrency.ts +2 -2
  1443. package/src/internal/core.ts +12 -23
  1444. package/src/internal/effect.ts +25 -29
  1445. package/src/internal/executionPlan.ts +2 -2
  1446. package/src/internal/option.ts +5 -8
  1447. package/src/internal/result.ts +5 -8
  1448. package/src/internal/schema/schema.ts +1 -1
  1449. package/src/testing/FastCheck.ts +6 -3
  1450. package/src/testing/TestClock.ts +63 -34
  1451. package/src/testing/TestConsole.ts +49 -30
  1452. package/src/testing/TestSchema.ts +8 -8
  1453. package/src/unstable/ai/AiError.ts +187 -120
  1454. package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
  1455. package/src/unstable/ai/Chat.ts +69 -43
  1456. package/src/unstable/ai/EmbeddingModel.ts +12 -11
  1457. package/src/unstable/ai/IdGenerator.ts +28 -18
  1458. package/src/unstable/ai/LanguageModel.ts +47 -46
  1459. package/src/unstable/ai/McpSchema.ts +339 -119
  1460. package/src/unstable/ai/McpServer.ts +78 -21
  1461. package/src/unstable/ai/Model.ts +23 -18
  1462. package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
  1463. package/src/unstable/ai/Prompt.ts +210 -184
  1464. package/src/unstable/ai/Response.ts +159 -147
  1465. package/src/unstable/ai/ResponseIdTracker.ts +43 -4
  1466. package/src/unstable/ai/Telemetry.ts +42 -32
  1467. package/src/unstable/ai/Tokenizer.ts +13 -8
  1468. package/src/unstable/ai/Tool.ts +154 -85
  1469. package/src/unstable/ai/Toolkit.ts +81 -84
  1470. package/src/unstable/ai/index.ts +42 -24
  1471. package/src/unstable/cli/Argument.ts +226 -134
  1472. package/src/unstable/cli/CliError.ts +96 -26
  1473. package/src/unstable/cli/CliOutput.ts +43 -13
  1474. package/src/unstable/cli/Command.ts +225 -125
  1475. package/src/unstable/cli/Completions.ts +7 -7
  1476. package/src/unstable/cli/Flag.ts +235 -142
  1477. package/src/unstable/cli/GlobalFlag.ts +42 -14
  1478. package/src/unstable/cli/HelpDoc.ts +35 -10
  1479. package/src/unstable/cli/Param.ts +328 -190
  1480. package/src/unstable/cli/Primitive.ts +79 -42
  1481. package/src/unstable/cli/Prompt.ts +210 -58
  1482. package/src/unstable/cli/internal/ansi.ts +13 -0
  1483. package/src/unstable/cli/internal/command.ts +17 -15
  1484. package/src/unstable/cli/internal/config.ts +3 -0
  1485. package/src/unstable/cli/internal/lexer.ts +11 -0
  1486. package/src/unstable/cluster/ClusterCron.ts +35 -1
  1487. package/src/unstable/cluster/ClusterError.ts +56 -7
  1488. package/src/unstable/cluster/ClusterMetrics.ts +39 -5
  1489. package/src/unstable/cluster/ClusterSchema.ts +61 -8
  1490. package/src/unstable/cluster/ClusterWorkflowEngine.ts +36 -3
  1491. package/src/unstable/cluster/DeliverAt.ts +39 -4
  1492. package/src/unstable/cluster/Entity.ts +110 -19
  1493. package/src/unstable/cluster/EntityAddress.ts +30 -2
  1494. package/src/unstable/cluster/EntityId.ts +18 -3
  1495. package/src/unstable/cluster/EntityProxy.ts +34 -2
  1496. package/src/unstable/cluster/EntityProxyServer.ts +44 -8
  1497. package/src/unstable/cluster/EntityResource.ts +43 -6
  1498. package/src/unstable/cluster/EntityType.ts +27 -3
  1499. package/src/unstable/cluster/Envelope.ts +128 -23
  1500. package/src/unstable/cluster/HttpRunner.ts +88 -13
  1501. package/src/unstable/cluster/K8sHttpClient.ts +49 -6
  1502. package/src/unstable/cluster/MachineId.ts +24 -3
  1503. package/src/unstable/cluster/Message.ts +102 -13
  1504. package/src/unstable/cluster/MessageStorage.ts +128 -22
  1505. package/src/unstable/cluster/Reply.ts +101 -12
  1506. package/src/unstable/cluster/Runner.ts +47 -17
  1507. package/src/unstable/cluster/RunnerAddress.ts +34 -2
  1508. package/src/unstable/cluster/RunnerHealth.ts +40 -12
  1509. package/src/unstable/cluster/RunnerServer.ts +31 -4
  1510. package/src/unstable/cluster/RunnerStorage.ts +42 -5
  1511. package/src/unstable/cluster/Runners.ts +73 -10
  1512. package/src/unstable/cluster/ShardId.ts +51 -5
  1513. package/src/unstable/cluster/Sharding.ts +35 -4
  1514. package/src/unstable/cluster/ShardingConfig.ts +76 -11
  1515. package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
  1516. package/src/unstable/cluster/SingleRunner.ts +23 -1
  1517. package/src/unstable/cluster/Singleton.ts +15 -1
  1518. package/src/unstable/cluster/SingletonAddress.ts +21 -1
  1519. package/src/unstable/cluster/Snowflake.ts +89 -19
  1520. package/src/unstable/cluster/SocketRunner.ts +29 -2
  1521. package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
  1522. package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
  1523. package/src/unstable/cluster/TestRunner.ts +18 -1
  1524. package/src/unstable/cluster/internal/hash.ts +12 -0
  1525. package/src/unstable/devtools/DevTools.ts +26 -3
  1526. package/src/unstable/devtools/DevToolsClient.ts +32 -5
  1527. package/src/unstable/devtools/DevToolsSchema.ts +201 -44
  1528. package/src/unstable/devtools/DevToolsServer.ts +27 -2
  1529. package/src/unstable/encoding/Msgpack.ts +97 -12
  1530. package/src/unstable/encoding/Ndjson.ts +149 -21
  1531. package/src/unstable/encoding/Sse.ts +109 -18
  1532. package/src/unstable/eventlog/Event.ts +131 -30
  1533. package/src/unstable/eventlog/EventGroup.ts +50 -17
  1534. package/src/unstable/eventlog/EventJournal.ts +120 -20
  1535. package/src/unstable/eventlog/EventLog.ts +151 -31
  1536. package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
  1537. package/src/unstable/eventlog/EventLogMessage.ts +92 -18
  1538. package/src/unstable/eventlog/EventLogRemote.ts +54 -8
  1539. package/src/unstable/eventlog/EventLogServer.ts +33 -3
  1540. package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
  1541. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
  1542. package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
  1543. package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
  1544. package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
  1545. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
  1546. package/src/unstable/http/Cookies.ts +156 -77
  1547. package/src/unstable/http/Etag.ts +40 -7
  1548. package/src/unstable/http/FetchHttpClient.ts +33 -4
  1549. package/src/unstable/http/FindMyWay.ts +1 -1
  1550. package/src/unstable/http/Headers.ts +252 -50
  1551. package/src/unstable/http/HttpBody.ts +130 -28
  1552. package/src/unstable/http/HttpClient.ts +206 -97
  1553. package/src/unstable/http/HttpClientError.ts +80 -12
  1554. package/src/unstable/http/HttpClientRequest.ts +320 -102
  1555. package/src/unstable/http/HttpClientResponse.ts +59 -16
  1556. package/src/unstable/http/HttpEffect.ts +66 -18
  1557. package/src/unstable/http/HttpIncomingMessage.ts +47 -7
  1558. package/src/unstable/http/HttpMethod.ts +35 -5
  1559. package/src/unstable/http/HttpMiddleware.ts +63 -16
  1560. package/src/unstable/http/HttpPlatform.ts +35 -4
  1561. package/src/unstable/http/HttpRouter.ts +221 -57
  1562. package/src/unstable/http/HttpServer.ts +152 -23
  1563. package/src/unstable/http/HttpServerError.ts +90 -10
  1564. package/src/unstable/http/HttpServerRequest.ts +136 -32
  1565. package/src/unstable/http/HttpServerRespondable.ts +49 -6
  1566. package/src/unstable/http/HttpServerResponse.ts +395 -72
  1567. package/src/unstable/http/HttpStaticServer.ts +22 -4
  1568. package/src/unstable/http/HttpTraceContext.ts +53 -6
  1569. package/src/unstable/http/Multipart.ts +179 -29
  1570. package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
  1571. package/src/unstable/http/Multipasta/Node.ts +1 -1
  1572. package/src/unstable/http/Multipasta/Search.ts +1 -1
  1573. package/src/unstable/http/Multipasta/Web.ts +1 -1
  1574. package/src/unstable/http/Multipasta.ts +1 -1
  1575. package/src/unstable/http/Template.ts +53 -0
  1576. package/src/unstable/http/Url.ts +56 -42
  1577. package/src/unstable/http/UrlParams.ts +233 -49
  1578. package/src/unstable/httpapi/HttpApi.ts +49 -14
  1579. package/src/unstable/httpapi/HttpApiBuilder.ts +86 -20
  1580. package/src/unstable/httpapi/HttpApiClient.ts +80 -16
  1581. package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
  1582. package/src/unstable/httpapi/HttpApiError.ts +100 -1
  1583. package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
  1584. package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -23
  1585. package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
  1586. package/src/unstable/httpapi/HttpApiSchema.ts +67 -30
  1587. package/src/unstable/httpapi/HttpApiSecurity.ts +74 -17
  1588. package/src/unstable/httpapi/HttpApiSwagger.ts +24 -2
  1589. package/src/unstable/httpapi/HttpApiTest.ts +31 -3
  1590. package/src/unstable/httpapi/OpenApi.ts +115 -15
  1591. package/src/unstable/observability/Otlp.ts +33 -3
  1592. package/src/unstable/observability/OtlpExporter.ts +32 -1
  1593. package/src/unstable/observability/OtlpLogger.ts +31 -2
  1594. package/src/unstable/observability/OtlpMetrics.ts +37 -4
  1595. package/src/unstable/observability/OtlpResource.ts +68 -12
  1596. package/src/unstable/observability/OtlpSerialization.ts +28 -3
  1597. package/src/unstable/observability/OtlpTracer.ts +38 -2
  1598. package/src/unstable/observability/PrometheusMetrics.ts +32 -12
  1599. package/src/unstable/observability/index.ts +2 -1
  1600. package/src/unstable/persistence/KeyValueStore.ts +108 -28
  1601. package/src/unstable/persistence/Persistable.ts +76 -15
  1602. package/src/unstable/persistence/PersistedCache.ts +27 -2
  1603. package/src/unstable/persistence/PersistedQueue.ts +98 -16
  1604. package/src/unstable/persistence/Persistence.ts +97 -16
  1605. package/src/unstable/persistence/RateLimiter.ts +98 -22
  1606. package/src/unstable/persistence/Redis.ts +42 -5
  1607. package/src/unstable/process/ChildProcess.ts +100 -79
  1608. package/src/unstable/process/ChildProcessSpawner.ts +22 -11
  1609. package/src/unstable/process/index.ts +2 -1
  1610. package/src/unstable/reactivity/AsyncResult.ts +202 -61
  1611. package/src/unstable/reactivity/Atom.ts +597 -143
  1612. package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
  1613. package/src/unstable/reactivity/AtomRef.ts +51 -7
  1614. package/src/unstable/reactivity/AtomRegistry.ts +141 -22
  1615. package/src/unstable/reactivity/AtomRpc.ts +36 -2
  1616. package/src/unstable/reactivity/Hydration.ts +45 -5
  1617. package/src/unstable/reactivity/Reactivity.ts +95 -13
  1618. package/src/unstable/rpc/Rpc.ts +255 -56
  1619. package/src/unstable/rpc/RpcClient.ts +108 -20
  1620. package/src/unstable/rpc/RpcClientError.ts +26 -2
  1621. package/src/unstable/rpc/RpcGroup.ts +51 -8
  1622. package/src/unstable/rpc/RpcMessage.ts +128 -32
  1623. package/src/unstable/rpc/RpcMiddleware.ts +100 -20
  1624. package/src/unstable/rpc/RpcSchema.ts +38 -4
  1625. package/src/unstable/rpc/RpcSerialization.ts +60 -13
  1626. package/src/unstable/rpc/RpcServer.ts +108 -25
  1627. package/src/unstable/rpc/RpcTest.ts +20 -1
  1628. package/src/unstable/rpc/RpcWorker.ts +42 -8
  1629. package/src/unstable/rpc/Utils.ts +31 -0
  1630. package/src/unstable/schema/Model.ts +148 -52
  1631. package/src/unstable/schema/VariantSchema.ts +104 -24
  1632. package/src/unstable/socket/Socket.ts +168 -35
  1633. package/src/unstable/socket/SocketServer.ts +58 -10
  1634. package/src/unstable/sql/Migrator.ts +57 -5
  1635. package/src/unstable/sql/SqlClient.ts +55 -2
  1636. package/src/unstable/sql/SqlConnection.ts +31 -0
  1637. package/src/unstable/sql/SqlError.ts +117 -0
  1638. package/src/unstable/sql/SqlModel.ts +26 -5
  1639. package/src/unstable/sql/SqlResolver.ts +56 -13
  1640. package/src/unstable/sql/SqlSchema.ts +29 -8
  1641. package/src/unstable/sql/SqlStream.ts +23 -0
  1642. package/src/unstable/sql/Statement.ts +141 -0
  1643. package/src/unstable/sql/index.ts +1 -1
  1644. package/src/unstable/workers/Transferable.ts +65 -13
  1645. package/src/unstable/workers/Worker.ts +60 -8
  1646. package/src/unstable/workers/WorkerError.ts +50 -9
  1647. package/src/unstable/workers/WorkerRunner.ts +32 -3
  1648. package/src/unstable/workers/index.ts +1 -1
  1649. package/src/unstable/workflow/Activity.ts +62 -11
  1650. package/src/unstable/workflow/DurableClock.ts +26 -3
  1651. package/src/unstable/workflow/DurableDeferred.ts +146 -31
  1652. package/src/unstable/workflow/DurableQueue.ts +366 -0
  1653. package/src/unstable/workflow/Workflow.ts +122 -32
  1654. package/src/unstable/workflow/WorkflowEngine.ts +40 -5
  1655. package/src/unstable/workflow/WorkflowProxy.ts +32 -2
  1656. package/src/unstable/workflow/WorkflowProxyServer.ts +40 -6
  1657. package/src/unstable/workflow/index.ts +5 -0
package/src/Schedule.ts CHANGED
@@ -6,7 +6,8 @@
6
6
  * along with a delay duration. Schedules can be combined, transformed, and used to implement
7
7
  * sophisticated retry and repetition logic.
8
8
  *
9
- * @example
9
+ * **Example** (Retrying and repeating effects)
10
+ *
10
11
  * ```ts
11
12
  * import { Effect, Schedule } from "effect"
12
13
  *
@@ -53,9 +54,14 @@ const randomNext: Effect<number> = random.Random.useSync((random) => random.next
53
54
  /**
54
55
  * A Schedule defines a strategy for repeating or retrying effects based on some policy.
55
56
  *
56
- * @example
57
+ * **Example** (Defining retry and repeat schedules)
58
+ *
57
59
  * ```ts
58
- * import { Console, Effect, Schedule } from "effect"
60
+ * import { Console, Data, Effect, Schedule } from "effect"
61
+ *
62
+ * class NetworkError extends Data.TaggedError("NetworkError")<{
63
+ * readonly attempt: number
64
+ * }> {}
59
65
  *
60
66
  * // Basic retry schedule - retry up to 3 times with exponential backoff
61
67
  * const retrySchedule = Schedule.exponential("100 millis").pipe(
@@ -66,25 +72,29 @@ const randomNext: Effect<number> = random.Random.useSync((random) => random.next
66
72
  * const repeatSchedule: Schedule.Schedule<number, unknown, never> = Schedule
67
73
  * .spaced("30 seconds")
68
74
  *
69
- * // Advanced schedule with custom logic
70
- * const smartRetry = Schedule.exponential("1 second")
71
- *
72
75
  * const program = Effect.gen(function*() {
73
- * // Using retry schedule
76
+ * let attempts = 0
77
+ *
74
78
  * const result1 = yield* Effect.retry(
75
- * Effect.suspend(() => Math.random() > 0.5 ? Effect.fail("temporary error") : Effect.succeed("Success")),
79
+ * Effect.gen(function*() {
80
+ * attempts++
81
+ * if (attempts < 3) {
82
+ * return yield* Effect.fail(new NetworkError({ attempt: attempts }))
83
+ * }
84
+ * return "Success"
85
+ * }),
76
86
  * retrySchedule
77
87
  * )
88
+ * console.log(result1) // "Success"
78
89
  *
79
- * // Using repeat schedule
80
90
  * yield* Console.log("heartbeat").pipe(
81
91
  * Effect.repeat(repeatSchedule.pipe(Schedule.take(5)))
82
92
  * )
83
93
  * })
84
94
  * ```
85
95
  *
86
- * @since 2.0.0
87
96
  * @category Models
97
+ * @since 2.0.0
88
98
  */
89
99
  export interface Schedule<out Output, in Input = unknown, out Error = never, out Env = never>
90
100
  extends Schedule.Variance<Output, Input, Error, Env>, Pipeable
@@ -93,7 +103,8 @@ export interface Schedule<out Output, in Input = unknown, out Error = never, out
93
103
  /**
94
104
  * Metadata provided to schedule functions containing timing and input information.
95
105
  *
96
- * @example
106
+ * **Example** (Reading schedule input metadata)
107
+ *
97
108
  * ```ts
98
109
  * import { Console, Effect, Schedule } from "effect"
99
110
  *
@@ -112,8 +123,8 @@ export interface Schedule<out Output, in Input = unknown, out Error = never, out
112
123
  * })
113
124
  * ```
114
125
  *
115
- * @since 4.0.0
116
126
  * @category Metadata
127
+ * @since 4.0.0
117
128
  */
118
129
  export interface InputMetadata<Input> {
119
130
  readonly input: Input
@@ -127,18 +138,19 @@ export interface InputMetadata<Input> {
127
138
  /**
128
139
  * Extended metadata that includes both input metadata and the output value from the schedule.
129
140
  *
130
- * @example
141
+ * **Example** (Logging schedule output metadata)
142
+ *
131
143
  * ```ts
132
144
  * import { Console, Duration, Effect, Schedule } from "effect"
133
145
  *
134
- * // Custom schedule that logs metadata including output
146
+ * // Custom schedule that logs metadata and output for each recurrence
135
147
  * const loggingSchedule = Schedule.unfold(0, (n) => Effect.succeed(n + 1)).pipe(
136
148
  * Schedule.addDelay(() => Effect.succeed(Duration.millis(100))),
137
- * Schedule.tapOutput((output) => {
138
- * return Console.log(
139
- * `Output: ${output}`
140
- * )
141
- * })
149
+ * Schedule.collectWhile((metadata) =>
150
+ * Console.log(
151
+ * `Output: ${metadata.output}, attempt: ${metadata.attempt}, elapsed: ${metadata.elapsed}ms`
152
+ * ).pipe(Effect.as(metadata.attempt <= 3))
153
+ * )
142
154
  * )
143
155
  *
144
156
  * const program = Effect.gen(function*() {
@@ -149,13 +161,13 @@ export interface InputMetadata<Input> {
149
161
  * })
150
162
  *
151
163
  * // Output logs will show:
152
- * // "Output: 0, Attempt: 1, Elapsed: 0ms, Since previous: 0ms"
153
- * // "Output: 1, Attempt: 2, Elapsed: 100ms, Since previous: 100ms"
154
- * // "Output: 2, Attempt: 3, Elapsed: 200ms, Since previous: 100ms"
164
+ * // Output: 0, attempt: 1, elapsed: 0ms
165
+ * // Output: 1, attempt: 2, elapsed: 100ms
166
+ * // Output: 2, attempt: 3, elapsed: 200ms
155
167
  * ```
156
168
  *
157
- * @since 4.0.0
158
169
  * @category Metadata
170
+ * @since 4.0.0
159
171
  */
160
172
  export interface Metadata<Output = unknown, Input = unknown> extends InputMetadata<Input> {
161
173
  readonly output: Output
@@ -163,8 +175,16 @@ export interface Metadata<Output = unknown, Input = unknown> extends InputMetada
163
175
  }
164
176
 
165
177
  /**
166
- * @since 4.0.0
178
+ * Context reference containing metadata for the currently running schedule step.
179
+ *
180
+ * **Details**
181
+ * Repeat, retry, stream, and channel scheduling operations provide this service
182
+ * to effects run between schedule steps. The default value contains undefined
183
+ * input and output values, zero duration, and zeroed timing fields before any
184
+ * schedule step has produced metadata.
185
+ *
167
186
  * @category Metadata
187
+ * @since 4.0.0
168
188
  */
169
189
  export const CurrentMetadata = Context.Reference<Metadata>("effect/Schedule/CurrentMetadata", {
170
190
  defaultValue: constant({
@@ -182,7 +202,8 @@ export const CurrentMetadata = Context.Reference<Metadata>("effect/Schedule/Curr
182
202
  /**
183
203
  * The Schedule namespace contains types and utilities for working with schedules.
184
204
  *
185
- * @example
205
+ * **Example** (Creating custom schedules with the namespace)
206
+ *
186
207
  * ```ts
187
208
  * import { Duration, Effect, Schedule } from "effect"
188
209
  *
@@ -209,14 +230,15 @@ export const CurrentMetadata = Context.Reference<Metadata>("effect/Schedule/Curr
209
230
  * })
210
231
  * ```
211
232
  *
212
- * @since 2.0.0
213
233
  * @category models
234
+ * @since 2.0.0
214
235
  */
215
236
  export declare namespace Schedule {
216
237
  /**
217
238
  * Variance interface that defines the type parameter relationships for Schedule.
218
239
  *
219
- * @example
240
+ * **Example** (Understanding schedule variance)
241
+ *
220
242
  * ```ts
221
243
  * import { Effect, Schedule } from "effect"
222
244
  *
@@ -240,44 +262,23 @@ export declare namespace Schedule {
240
262
  * const serviceSchedule = Schedule.spaced("5 seconds")
241
263
  * ```
242
264
  *
243
- * @since 2.0.0
244
265
  * @category Models
266
+ * @since 2.0.0
245
267
  */
246
268
  export interface Variance<out Output, in Input, out Error, out Env> {
247
269
  readonly [TypeId]: VarianceStruct<Output, Input, Error, Env>
248
270
  }
249
271
 
250
272
  /**
251
- * Internal structure that holds the variance annotations for Schedule type parameters.
252
- *
253
- * @example
254
- * ```ts
255
- * import { Effect, Schedule } from "effect"
256
- *
257
- * // The variance struct defines how Schedule's type parameters behave
258
- * // This internal interface is used for type variance annotations
273
+ * Type-level marker used by `Schedule.Variance` to record the variance of
274
+ * `Schedule` type parameters.
259
275
  *
260
- * // Example showing variance relationships:
261
- * interface Animal {
262
- * name: string
263
- * }
264
- * interface Dog extends Animal {
265
- * breed: string
266
- * }
276
+ * **Notes**
277
+ * This interface exists for TypeScript inference and assignability. Users
278
+ * normally do not construct or inspect it directly.
267
279
  *
268
- * // Output is covariant - more specific types can be substituted
269
- * const stringSchedule = Schedule.spaced("1 second").pipe(
270
- * Schedule.map(() => Effect.succeed("output"))
271
- * )
272
- *
273
- * // Input is contravariant - more general types can be accepted
274
- * const numberSchedule = Schedule.exponential("100 millis")
275
- *
276
- * // This enables proper type relationships where schedules can be composed safely
277
- * ```
278
- *
279
- * @since 2.0.0
280
280
  * @category Models
281
+ * @since 2.0.0
281
282
  */
282
283
  export interface VarianceStruct<out Output, in Input, out Error, out Env> {
283
284
  readonly _Out: Covariant<Output>
@@ -301,7 +302,8 @@ const ScheduleProto = {
301
302
  /**
302
303
  * Type guard that checks if a value is a Schedule.
303
304
  *
304
- * @example
305
+ * **Example** (Checking for schedules)
306
+ *
305
307
  * ```ts
306
308
  * import { Schedule } from "effect"
307
309
  *
@@ -314,34 +316,33 @@ const ScheduleProto = {
314
316
  * console.log(Schedule.isSchedule(undefined)) // false
315
317
  * ```
316
318
  *
317
- * @since 2.0.0
318
319
  * @category guards
320
+ * @since 2.0.0
319
321
  */
320
322
  export const isSchedule = (u: unknown): u is Schedule<unknown, never, unknown, unknown> => hasProperty(u, TypeId)
321
323
 
322
324
  /**
323
325
  * Creates a Schedule from a step function that returns a Pull.
324
326
  *
325
- * @example
326
- * ```ts
327
- * import { Schedule } from "effect"
327
+ * **Example** (Creating a custom schedule from a step function)
328
328
  *
329
- * // fromStep is an advanced function for creating custom schedules
330
- * // It requires a step function that returns a Pull value
329
+ * ```ts
330
+ * import { Cause, Duration, Effect, Schedule } from "effect"
331
331
  *
332
- * // Most users should use simpler schedule constructors like:
333
- * const simpleSchedule = Schedule.exponential("100 millis")
334
- * const spacedSchedule = Schedule.spaced("1 second")
335
- * const recurringSchedule = Schedule.recurs(5)
332
+ * const schedule = Schedule.fromStep(Effect.sync(() => {
333
+ * let count = 0
336
334
  *
337
- * // These can be combined and transformed as needed
338
- * const complexSchedule = simpleSchedule.pipe(
339
- * Schedule.both(Schedule.recurs(3))
340
- * )
335
+ * return (_now: number, _input: string) => {
336
+ * if (count >= 3) {
337
+ * return Cause.done(count)
338
+ * }
339
+ * return Effect.succeed([count++, Duration.millis(100)] as [number, Duration.Duration])
340
+ * }
341
+ * }))
341
342
  * ```
342
343
  *
343
- * @since 4.0.0
344
344
  * @category constructors
345
+ * @since 4.0.0
345
346
  */
346
347
  export const fromStep = <Input, Output, EnvX, Error, ErrorX, Env>(
347
348
  step: Effect<
@@ -371,26 +372,25 @@ const metadataFn = () => {
371
372
  /**
372
373
  * Creates a Schedule from a step function that receives metadata about the schedule's execution.
373
374
  *
374
- * @example
375
- * ```ts
376
- * import { Effect, Schedule } from "effect"
375
+ * **Example** (Creating a metadata-aware schedule)
377
376
  *
378
- * // fromStepWithMetadata is an advanced function for creating schedules
379
- * // that need access to execution metadata like timing and recurrence count
377
+ * ```ts
378
+ * import { Cause, Duration, Effect, Schedule } from "effect"
380
379
  *
381
- * // Most users should use simpler metadata-aware functions like:
382
- * const metadataSchedule = Schedule.spaced("1 second").pipe(
383
- * Schedule.collectWhile((metadata) => Effect.succeed(metadata.attempt <= 5))
384
- * )
380
+ * const firstThreeInputs = Schedule.fromStepWithMetadata(Effect.succeed((metadata: Schedule.InputMetadata<string>) => {
381
+ * if (metadata.attempt > 3) {
382
+ * return Cause.done("finished")
383
+ * }
385
384
  *
386
- * // Or use existing schedules with metadata transformations:
387
- * const conditionalSchedule = Schedule.exponential("100 millis").pipe(
388
- * Schedule.tapOutput((output) => Effect.log(`Output: ${output}`))
389
- * )
385
+ * return Effect.succeed([
386
+ * `attempt ${metadata.attempt}: ${metadata.input}`,
387
+ * Duration.millis(250)
388
+ * ] as [string, Duration.Duration])
389
+ * }))
390
390
  * ```
391
391
  *
392
- * @since 4.0.0
393
392
  * @category constructors
393
+ * @since 4.0.0
394
394
  */
395
395
  export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
396
396
  step: Effect<
@@ -407,7 +407,8 @@ export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
407
407
  /**
408
408
  * Extracts the step function from a Schedule.
409
409
  *
410
- * @example
410
+ * **Example** (Extracting a schedule step function)
411
+ *
411
412
  * ```ts
412
413
  * import { Effect, Schedule } from "effect"
413
414
  *
@@ -417,16 +418,17 @@ export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
417
418
  * const program = Effect.gen(function*() {
418
419
  * const stepFn = yield* Schedule.toStep(schedule)
419
420
  *
420
- * // Use the step function directly for custom logic
421
- * const now = Date.now()
421
+ * // Use the step function directly for custom logic. The timestamp is
422
+ * // supplied by the caller, so tests can pass a deterministic value.
423
+ * const now = 0
422
424
  * const result = yield* stepFn(now, "input")
423
425
  *
424
426
  * console.log(`Step result: ${result}`)
425
427
  * })
426
428
  * ```
427
429
  *
428
- * @since 4.0.0
429
430
  * @category destructors
431
+ * @since 4.0.0
430
432
  */
431
433
  export const toStep = <Output, Input, Error, Env>(
432
434
  schedule: Schedule<Output, Input, Error, Env>
@@ -444,8 +446,8 @@ export const toStep = <Output, Input, Error, Env>(
444
446
  * Extracts a step function from a Schedule that provides metadata about each
445
447
  * execution. It will also handle sleeping for the computed delay.
446
448
  *
447
- * @since 4.0.0
448
449
  * @category destructors
450
+ * @since 4.0.0
449
451
  */
450
452
  export const toStepWithMetadata = <Output, Input, Error, Env>(
451
453
  schedule: Schedule<Output, Input, Error, Env>
@@ -479,7 +481,8 @@ export const toStepWithMetadata = <Output, Input, Error, Env>(
479
481
  /**
480
482
  * Extracts a step function from a Schedule that automatically handles sleep delays.
481
483
  *
482
- * @example
484
+ * **Example** (Extracting a sleeping step function)
485
+ *
483
486
  * ```ts
484
487
  * import { Effect, Schedule } from "effect"
485
488
  *
@@ -502,8 +505,8 @@ export const toStepWithMetadata = <Output, Input, Error, Env>(
502
505
  * })
503
506
  * ```
504
507
  *
505
- * @since 4.0.0
506
508
  * @category destructors
509
+ * @since 4.0.0
507
510
  */
508
511
  export const toStepWithSleep = <Output, Input, Error, Env>(
509
512
  schedule: Schedule<Output, Input, Error, Env>
@@ -521,29 +524,26 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
521
524
  * Returns a new `Schedule` that adds the delay computed by the specified
522
525
  * effectful function to the the next recurrence of the schedule.
523
526
  *
524
- * @example
527
+ * **Example** (Adding extra delay to a schedule)
528
+ *
525
529
  * ```ts
526
530
  * import { Console, Data, Duration, Effect, Schedule } from "effect"
527
531
  *
528
532
  * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
529
533
  *
530
- * // Add random jitter to schedule delays
531
- * const jitteredSchedule = Schedule.addDelay(
534
+ * // Add a deterministic extra delay based on the schedule output
535
+ * const delayedSchedule = Schedule.addDelay(
532
536
  * Schedule.exponential("100 millis").pipe(Schedule.take(5)),
533
537
  * (output) =>
534
- * // Add random jitter between 0-50ms
535
- * Effect.succeed(Duration.millis(Math.random() * 50))
538
+ * Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
536
539
  * )
537
540
  *
538
- * const jitterProgram = Effect.gen(function*() {
541
+ * const repeatProgram = Effect.gen(function*() {
539
542
  * yield* Effect.repeat(
540
- * Effect.gen(function*() {
541
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
542
- * return "jittered task"
543
- * }),
544
- * jitteredSchedule.pipe(
543
+ * Effect.succeed("delayed task"),
544
+ * delayedSchedule.pipe(
545
545
  * Schedule.tapOutput((delay) =>
546
- * Console.log(`Base delay with jitter applied`)
546
+ * Console.log(`Base delay: ${delay}`)
547
547
  * )
548
548
  * )
549
549
  * )
@@ -571,12 +571,15 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
571
571
  * )
572
572
  * })
573
573
  *
574
- * // Add effectful delay computation
574
+ * // Add effectful delay computation from deterministic service data
575
+ * const loadByExecution = [1, 3, 2, 4] as const
576
+ *
575
577
  * const dynamicSchedule = Schedule.addDelay(
576
578
  * Schedule.spaced("1 second").pipe(Schedule.take(4)),
577
- * (executionNumber) =>
578
- * // Simulate checking system load and return additional delay
579
- * Effect.succeed(Duration.millis(Math.random() > 0.7 ? 2000 : 500))
579
+ * (executionNumber) => {
580
+ * const load = loadByExecution[executionNumber] ?? 1
581
+ * return Effect.succeed(Duration.millis(load * 100))
582
+ * }
580
583
  * )
581
584
  *
582
585
  * const dynamicProgram = Effect.gen(function*() {
@@ -589,25 +592,6 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
589
592
  * )
590
593
  * })
591
594
  *
592
- * // Add delay based on previous execution results (30% extra)
593
- * const resultBasedSchedule = Schedule.addDelay(
594
- * Schedule.fibonacci("200 millis").pipe(Schedule.take(5)),
595
- * (fibonacciDelay) =>
596
- * Effect.succeed(Duration.millis(Duration.toMillis(fibonacciDelay) * 0.3))
597
- * )
598
- *
599
- * const resultProgram = Effect.gen(function*() {
600
- * yield* Effect.repeat(
601
- * Effect.gen(function*() {
602
- * yield* Console.log("Result-based delay task")
603
- * return Math.random()
604
- * }),
605
- * resultBasedSchedule.pipe(
606
- * Schedule.tapOutput((delay) => Console.log(`Fibonacci delay: ${delay}`))
607
- * )
608
- * )
609
- * })
610
- *
611
595
  * // Combine with retry for progressive backoff
612
596
  * const progressiveRetrySchedule = Schedule.addDelay(
613
597
  * Schedule.exponential("50 millis").pipe(Schedule.take(4)),
@@ -632,37 +616,34 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
632
616
  * })
633
617
  * ```
634
618
  *
635
- * @since 2.0.0
636
619
  * @category utils
620
+ * @since 2.0.0
637
621
  */
638
622
  export const addDelay: {
639
623
  /**
640
624
  * Returns a new `Schedule` that adds the delay computed by the specified
641
625
  * effectful function to the the next recurrence of the schedule.
642
626
  *
643
- * @example
627
+ * **Example** (Adding extra delay to a schedule)
628
+ *
644
629
  * ```ts
645
630
  * import { Console, Data, Duration, Effect, Schedule } from "effect"
646
631
  *
647
632
  * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
648
633
  *
649
- * // Add random jitter to schedule delays
650
- * const jitteredSchedule = Schedule.addDelay(
634
+ * // Add a deterministic extra delay based on the schedule output
635
+ * const delayedSchedule = Schedule.addDelay(
651
636
  * Schedule.exponential("100 millis").pipe(Schedule.take(5)),
652
637
  * (output) =>
653
- * // Add random jitter between 0-50ms
654
- * Effect.succeed(Duration.millis(Math.random() * 50))
638
+ * Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
655
639
  * )
656
640
  *
657
- * const jitterProgram = Effect.gen(function*() {
641
+ * const repeatProgram = Effect.gen(function*() {
658
642
  * yield* Effect.repeat(
659
- * Effect.gen(function*() {
660
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
661
- * return "jittered task"
662
- * }),
663
- * jitteredSchedule.pipe(
643
+ * Effect.succeed("delayed task"),
644
+ * delayedSchedule.pipe(
664
645
  * Schedule.tapOutput((delay) =>
665
- * Console.log(`Base delay with jitter applied`)
646
+ * Console.log(`Base delay: ${delay}`)
666
647
  * )
667
648
  * )
668
649
  * )
@@ -690,12 +671,15 @@ export const addDelay: {
690
671
  * )
691
672
  * })
692
673
  *
693
- * // Add effectful delay computation
674
+ * // Add effectful delay computation from deterministic service data
675
+ * const loadByExecution = [1, 3, 2, 4] as const
676
+ *
694
677
  * const dynamicSchedule = Schedule.addDelay(
695
678
  * Schedule.spaced("1 second").pipe(Schedule.take(4)),
696
- * (executionNumber) =>
697
- * // Simulate checking system load and return additional delay
698
- * Effect.succeed(Duration.millis(Math.random() > 0.7 ? 2000 : 500))
679
+ * (executionNumber) => {
680
+ * const load = loadByExecution[executionNumber] ?? 1
681
+ * return Effect.succeed(Duration.millis(load * 100))
682
+ * }
699
683
  * )
700
684
  *
701
685
  * const dynamicProgram = Effect.gen(function*() {
@@ -708,25 +692,6 @@ export const addDelay: {
708
692
  * )
709
693
  * })
710
694
  *
711
- * // Add delay based on previous execution results (30% extra)
712
- * const resultBasedSchedule = Schedule.addDelay(
713
- * Schedule.fibonacci("200 millis").pipe(Schedule.take(5)),
714
- * (fibonacciDelay) =>
715
- * Effect.succeed(Duration.millis(Duration.toMillis(fibonacciDelay) * 0.3))
716
- * )
717
- *
718
- * const resultProgram = Effect.gen(function*() {
719
- * yield* Effect.repeat(
720
- * Effect.gen(function*() {
721
- * yield* Console.log("Result-based delay task")
722
- * return Math.random()
723
- * }),
724
- * resultBasedSchedule.pipe(
725
- * Schedule.tapOutput((delay) => Console.log(`Fibonacci delay: ${delay}`))
726
- * )
727
- * )
728
- * })
729
- *
730
695
  * // Combine with retry for progressive backoff
731
696
  * const progressiveRetrySchedule = Schedule.addDelay(
732
697
  * Schedule.exponential("50 millis").pipe(Schedule.take(4)),
@@ -751,8 +716,8 @@ export const addDelay: {
751
716
  * })
752
717
  * ```
753
718
  *
754
- * @since 2.0.0
755
719
  * @category utils
720
+ * @since 2.0.0
756
721
  */
757
722
  <Output, Error2 = never, Env2 = never>(f: (output: Output) => Effect<Duration.Input, Error2, Env2>): <Input, Error, Env>(
758
723
  self: Schedule<Output, Input, Error, Env>
@@ -761,29 +726,26 @@ export const addDelay: {
761
726
  * Returns a new `Schedule` that adds the delay computed by the specified
762
727
  * effectful function to the the next recurrence of the schedule.
763
728
  *
764
- * @example
729
+ * **Example** (Adding extra delay to a schedule)
730
+ *
765
731
  * ```ts
766
732
  * import { Console, Data, Duration, Effect, Schedule } from "effect"
767
733
  *
768
734
  * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
769
735
  *
770
- * // Add random jitter to schedule delays
771
- * const jitteredSchedule = Schedule.addDelay(
736
+ * // Add a deterministic extra delay based on the schedule output
737
+ * const delayedSchedule = Schedule.addDelay(
772
738
  * Schedule.exponential("100 millis").pipe(Schedule.take(5)),
773
739
  * (output) =>
774
- * // Add random jitter between 0-50ms
775
- * Effect.succeed(Duration.millis(Math.random() * 50))
740
+ * Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
776
741
  * )
777
742
  *
778
- * const jitterProgram = Effect.gen(function*() {
743
+ * const repeatProgram = Effect.gen(function*() {
779
744
  * yield* Effect.repeat(
780
- * Effect.gen(function*() {
781
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
782
- * return "jittered task"
783
- * }),
784
- * jitteredSchedule.pipe(
745
+ * Effect.succeed("delayed task"),
746
+ * delayedSchedule.pipe(
785
747
  * Schedule.tapOutput((delay) =>
786
- * Console.log(`Base delay with jitter applied`)
748
+ * Console.log(`Base delay: ${delay}`)
787
749
  * )
788
750
  * )
789
751
  * )
@@ -811,12 +773,15 @@ export const addDelay: {
811
773
  * )
812
774
  * })
813
775
  *
814
- * // Add effectful delay computation
776
+ * // Add effectful delay computation from deterministic service data
777
+ * const loadByExecution = [1, 3, 2, 4] as const
778
+ *
815
779
  * const dynamicSchedule = Schedule.addDelay(
816
780
  * Schedule.spaced("1 second").pipe(Schedule.take(4)),
817
- * (executionNumber) =>
818
- * // Simulate checking system load and return additional delay
819
- * Effect.succeed(Duration.millis(Math.random() > 0.7 ? 2000 : 500))
781
+ * (executionNumber) => {
782
+ * const load = loadByExecution[executionNumber] ?? 1
783
+ * return Effect.succeed(Duration.millis(load * 100))
784
+ * }
820
785
  * )
821
786
  *
822
787
  * const dynamicProgram = Effect.gen(function*() {
@@ -829,25 +794,6 @@ export const addDelay: {
829
794
  * )
830
795
  * })
831
796
  *
832
- * // Add delay based on previous execution results (30% extra)
833
- * const resultBasedSchedule = Schedule.addDelay(
834
- * Schedule.fibonacci("200 millis").pipe(Schedule.take(5)),
835
- * (fibonacciDelay) =>
836
- * Effect.succeed(Duration.millis(Duration.toMillis(fibonacciDelay) * 0.3))
837
- * )
838
- *
839
- * const resultProgram = Effect.gen(function*() {
840
- * yield* Effect.repeat(
841
- * Effect.gen(function*() {
842
- * yield* Console.log("Result-based delay task")
843
- * return Math.random()
844
- * }),
845
- * resultBasedSchedule.pipe(
846
- * Schedule.tapOutput((delay) => Console.log(`Fibonacci delay: ${delay}`))
847
- * )
848
- * )
849
- * })
850
- *
851
797
  * // Combine with retry for progressive backoff
852
798
  * const progressiveRetrySchedule = Schedule.addDelay(
853
799
  * Schedule.exponential("50 millis").pipe(Schedule.take(4)),
@@ -872,8 +818,8 @@ export const addDelay: {
872
818
  * })
873
819
  * ```
874
820
  *
875
- * @since 2.0.0
876
821
  * @category utils
822
+ * @since 2.0.0
877
823
  */
878
824
  <Output, Input, Error, Env, Error2 = never, Env2 = never>(
879
825
  self: Schedule<Output, Input, Error, Env>,
@@ -894,7 +840,8 @@ export const addDelay: {
894
840
  * schedule to completion. Once the left schedule is complete, the right (i.e.
895
841
  * `other`) schedule will be executed to completion.
896
842
  *
897
- * @example
843
+ * **Example** (Sequencing quick and slow retries)
844
+ *
898
845
  * ```ts
899
846
  * import { Console, Data, Effect, Schedule } from "effect"
900
847
  *
@@ -926,8 +873,8 @@ export const addDelay: {
926
873
  * })
927
874
  * ```
928
875
  *
929
- * @since 2.0.0
930
876
  * @category sequencing
877
+ * @since 2.0.0
931
878
  */
932
879
  export const andThen: {
933
880
  /**
@@ -935,7 +882,8 @@ export const andThen: {
935
882
  * schedule to completion. Once the left schedule is complete, the right (i.e.
936
883
  * `other`) schedule will be executed to completion.
937
884
  *
938
- * @example
885
+ * **Example** (Sequencing quick and slow retries)
886
+ *
939
887
  * ```ts
940
888
  * import { Console, Data, Effect, Schedule } from "effect"
941
889
  *
@@ -967,8 +915,8 @@ export const andThen: {
967
915
  * })
968
916
  * ```
969
917
  *
970
- * @since 2.0.0
971
918
  * @category sequencing
919
+ * @since 2.0.0
972
920
  */
973
921
  <Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
974
922
  self: Schedule<Output, Input, Error, Env>
@@ -978,7 +926,8 @@ export const andThen: {
978
926
  * schedule to completion. Once the left schedule is complete, the right (i.e.
979
927
  * `other`) schedule will be executed to completion.
980
928
  *
981
- * @example
929
+ * **Example** (Sequencing quick and slow retries)
930
+ *
982
931
  * ```ts
983
932
  * import { Console, Data, Effect, Schedule } from "effect"
984
933
  *
@@ -1010,8 +959,8 @@ export const andThen: {
1010
959
  * })
1011
960
  * ```
1012
961
  *
1013
- * @since 2.0.0
1014
962
  * @category sequencing
963
+ * @since 2.0.0
1015
964
  */
1016
965
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
1017
966
  self: Schedule<Output, Input, Error, Env>,
@@ -1028,11 +977,12 @@ export const andThen: {
1028
977
  * schedule to completion. Once the left schedule is complete, the right (i.e.
1029
978
  * `other`) schedule will be executed to completion.
1030
979
  *
1031
- * The output of the resulting schedule is a `Result` where outputs of the
1032
- * left schedule are emitted as `Result.Err<Output>` and outputs of the right
1033
- * schedule are emitted as `Result.Ok<Output>`.
980
+ * The resulting schedule emits a `Result` to indicate which phase produced
981
+ * each output: outputs from `self` are emitted as `Failure`, and outputs from
982
+ * `other` are emitted as `Success`.
983
+ *
984
+ * **Example** (Tracking sequential schedule phases)
1034
985
  *
1035
- * @example
1036
986
  * ```ts
1037
987
  * import { Console, Effect, Result, Schedule } from "effect"
1038
988
  *
@@ -1060,8 +1010,8 @@ export const andThen: {
1060
1010
  * })
1061
1011
  * ```
1062
1012
  *
1063
- * @since 2.0.0
1064
1013
  * @category sequencing
1014
+ * @since 2.0.0
1065
1015
  */
1066
1016
  export const andThenResult: {
1067
1017
  /**
@@ -1069,11 +1019,12 @@ export const andThenResult: {
1069
1019
  * schedule to completion. Once the left schedule is complete, the right (i.e.
1070
1020
  * `other`) schedule will be executed to completion.
1071
1021
  *
1072
- * The output of the resulting schedule is a `Result` where outputs of the
1073
- * left schedule are emitted as `Result.Err<Output>` and outputs of the right
1074
- * schedule are emitted as `Result.Ok<Output>`.
1022
+ * The resulting schedule emits a `Result` to indicate which phase produced
1023
+ * each output: outputs from `self` are emitted as `Failure`, and outputs from
1024
+ * `other` are emitted as `Success`.
1025
+ *
1026
+ * **Example** (Tracking sequential schedule phases)
1075
1027
  *
1076
- * @example
1077
1028
  * ```ts
1078
1029
  * import { Console, Effect, Result, Schedule } from "effect"
1079
1030
  *
@@ -1101,8 +1052,8 @@ export const andThenResult: {
1101
1052
  * })
1102
1053
  * ```
1103
1054
  *
1104
- * @since 2.0.0
1105
1055
  * @category sequencing
1056
+ * @since 2.0.0
1106
1057
  */
1107
1058
  <Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
1108
1059
  self: Schedule<Output, Input, Error, Env>
@@ -1112,11 +1063,12 @@ export const andThenResult: {
1112
1063
  * schedule to completion. Once the left schedule is complete, the right (i.e.
1113
1064
  * `other`) schedule will be executed to completion.
1114
1065
  *
1115
- * The output of the resulting schedule is a `Result` where outputs of the
1116
- * left schedule are emitted as `Result.Err<Output>` and outputs of the right
1117
- * schedule are emitted as `Result.Ok<Output>`.
1066
+ * The resulting schedule emits a `Result` to indicate which phase produced
1067
+ * each output: outputs from `self` are emitted as `Failure`, and outputs from
1068
+ * `other` are emitted as `Success`.
1069
+ *
1070
+ * **Example** (Tracking sequential schedule phases)
1118
1071
  *
1119
- * @example
1120
1072
  * ```ts
1121
1073
  * import { Console, Effect, Result, Schedule } from "effect"
1122
1074
  *
@@ -1144,8 +1096,8 @@ export const andThenResult: {
1144
1096
  * })
1145
1097
  * ```
1146
1098
  *
1147
- * @since 2.0.0
1148
1099
  * @category sequencing
1100
+ * @since 2.0.0
1149
1101
  */
1150
1102
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
1151
1103
  self: Schedule<Output, Input, Error, Env>,
@@ -1183,11 +1135,12 @@ export const andThenResult: {
1183
1135
  * schedule to completion. Once the left schedule is complete, the right (i.e.
1184
1136
  * `other`) schedule will be executed to completion.
1185
1137
  *
1186
- * The output of the resulting schedule is a `Result` where outputs of the
1187
- * left schedule are emitted as `Result.Err<Output>` and outputs of the right
1188
- * schedule are emitted as `Result.Ok<Output>`.
1138
+ * The resulting schedule emits a `Result` to indicate which phase produced
1139
+ * each output: outputs from `self` are emitted as `Failure`, and outputs from
1140
+ * `other` are emitted as `Success`.
1141
+ *
1142
+ * **Example** (Tracking sequential schedule phases)
1189
1143
  *
1190
- * @example
1191
1144
  * ```ts
1192
1145
  * import { Console, Effect, Result, Schedule } from "effect"
1193
1146
  *
@@ -1215,8 +1168,8 @@ export const andThenResult: {
1215
1168
  * })
1216
1169
  * ```
1217
1170
  *
1218
- * @since 2.0.0
1219
1171
  * @category sequencing
1172
+ * @since 2.0.0
1220
1173
  */
1221
1174
  Result.Result<Output, Output2>,
1222
1175
  /**
@@ -1224,11 +1177,12 @@ export const andThenResult: {
1224
1177
  * schedule to completion. Once the left schedule is complete, the right (i.e.
1225
1178
  * `other`) schedule will be executed to completion.
1226
1179
  *
1227
- * The output of the resulting schedule is a `Result` where outputs of the
1228
- * left schedule are emitted as `Result.Err<Output>` and outputs of the right
1229
- * schedule are emitted as `Result.Ok<Output>`.
1180
+ * The resulting schedule emits a `Result` to indicate which phase produced
1181
+ * each output: outputs from `self` are emitted as `Failure`, and outputs from
1182
+ * `other` are emitted as `Success`.
1183
+ *
1184
+ * **Example** (Tracking sequential schedule phases)
1230
1185
  *
1231
- * @example
1232
1186
  * ```ts
1233
1187
  * import { Console, Effect, Result, Schedule } from "effect"
1234
1188
  *
@@ -1256,8 +1210,8 @@ export const andThenResult: {
1256
1210
  * })
1257
1211
  * ```
1258
1212
  *
1259
- * @since 2.0.0
1260
1213
  * @category sequencing
1214
+ * @since 2.0.0
1261
1215
  */
1262
1216
  Input & Input2,
1263
1217
  /**
@@ -1265,11 +1219,12 @@ export const andThenResult: {
1265
1219
  * schedule to completion. Once the left schedule is complete, the right (i.e.
1266
1220
  * `other`) schedule will be executed to completion.
1267
1221
  *
1268
- * The output of the resulting schedule is a `Result` where outputs of the
1269
- * left schedule are emitted as `Result.Err<Output>` and outputs of the right
1270
- * schedule are emitted as `Result.Ok<Output>`.
1222
+ * The resulting schedule emits a `Result` to indicate which phase produced
1223
+ * each output: outputs from `self` are emitted as `Failure`, and outputs from
1224
+ * `other` are emitted as `Success`.
1225
+ *
1226
+ * **Example** (Tracking sequential schedule phases)
1271
1227
  *
1272
- * @example
1273
1228
  * ```ts
1274
1229
  * import { Console, Effect, Result, Schedule } from "effect"
1275
1230
  *
@@ -1297,8 +1252,8 @@ export const andThenResult: {
1297
1252
  * })
1298
1253
  * ```
1299
1254
  *
1300
- * @since 2.0.0
1301
1255
  * @category sequencing
1256
+ * @since 2.0.0
1302
1257
  */
1303
1258
  Error | Error2,
1304
1259
  /**
@@ -1306,11 +1261,12 @@ export const andThenResult: {
1306
1261
  * schedule to completion. Once the left schedule is complete, the right (i.e.
1307
1262
  * `other`) schedule will be executed to completion.
1308
1263
  *
1309
- * The output of the resulting schedule is a `Result` where outputs of the
1310
- * left schedule are emitted as `Result.Err<Output>` and outputs of the right
1311
- * schedule are emitted as `Result.Ok<Output>`.
1264
+ * The resulting schedule emits a `Result` to indicate which phase produced
1265
+ * each output: outputs from `self` are emitted as `Failure`, and outputs from
1266
+ * `other` are emitted as `Success`.
1267
+ *
1268
+ * **Example** (Tracking sequential schedule phases)
1312
1269
  *
1313
- * @example
1314
1270
  * ```ts
1315
1271
  * import { Console, Effect, Result, Schedule } from "effect"
1316
1272
  *
@@ -1338,8 +1294,8 @@ export const andThenResult: {
1338
1294
  * })
1339
1295
  * ```
1340
1296
  *
1341
- * @since 2.0.0
1342
1297
  * @category sequencing
1298
+ * @since 2.0.0
1343
1299
  */
1344
1300
  Env | Env2
1345
1301
  >(currentSide === 0 ? left : right).pipe(
@@ -1365,7 +1321,8 @@ export const andThenResult: {
1365
1321
  * to recur, using the maximum of the two durations between recurrences and
1366
1322
  * outputting a tuple of the outputs of both schedules.
1367
1323
  *
1368
- * @example
1324
+ * **Example** (Combining time and attempt limits)
1325
+ *
1369
1326
  * ```ts
1370
1327
  * import { Console, Data, Effect, Schedule } from "effect"
1371
1328
  *
@@ -1382,7 +1339,7 @@ export const andThenResult: {
1382
1339
  * const program = Effect.gen(function*() {
1383
1340
  * const results = yield* Effect.repeat(
1384
1341
  * Effect.gen(function*() {
1385
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
1342
+ * yield* Console.log("Task executed")
1386
1343
  * return "task completed"
1387
1344
  * }),
1388
1345
  * bothSchedule.pipe(
@@ -1426,8 +1383,8 @@ export const andThenResult: {
1426
1383
  * // Compare with either which provides union semantics (OR logic)
1427
1384
  * ```
1428
1385
  *
1429
- * @since 2.0.0
1430
1386
  * @category utilities
1387
+ * @since 2.0.0
1431
1388
  */
1432
1389
  export const both: {
1433
1390
  /**
@@ -1435,7 +1392,8 @@ export const both: {
1435
1392
  * to recur, using the maximum of the two durations between recurrences and
1436
1393
  * outputting a tuple of the outputs of both schedules.
1437
1394
  *
1438
- * @example
1395
+ * **Example** (Combining time and attempt limits)
1396
+ *
1439
1397
  * ```ts
1440
1398
  * import { Console, Data, Effect, Schedule } from "effect"
1441
1399
  *
@@ -1452,7 +1410,7 @@ export const both: {
1452
1410
  * const program = Effect.gen(function*() {
1453
1411
  * const results = yield* Effect.repeat(
1454
1412
  * Effect.gen(function*() {
1455
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
1413
+ * yield* Console.log("Task executed")
1456
1414
  * return "task completed"
1457
1415
  * }),
1458
1416
  * bothSchedule.pipe(
@@ -1496,8 +1454,8 @@ export const both: {
1496
1454
  * // Compare with either which provides union semantics (OR logic)
1497
1455
  * ```
1498
1456
  *
1499
- * @since 2.0.0
1500
1457
  * @category utilities
1458
+ * @since 2.0.0
1501
1459
  */
1502
1460
  <Output2, Input2, Error2, Env2, Output>(other: Schedule<Output2, Input2, Error2, Env2>): <Input, Error, Env>(
1503
1461
  self: Schedule<Output, Input, Error, Env>
@@ -1507,7 +1465,8 @@ export const both: {
1507
1465
  * to recur, using the maximum of the two durations between recurrences and
1508
1466
  * outputting a tuple of the outputs of both schedules.
1509
1467
  *
1510
- * @example
1468
+ * **Example** (Combining time and attempt limits)
1469
+ *
1511
1470
  * ```ts
1512
1471
  * import { Console, Data, Effect, Schedule } from "effect"
1513
1472
  *
@@ -1524,7 +1483,7 @@ export const both: {
1524
1483
  * const program = Effect.gen(function*() {
1525
1484
  * const results = yield* Effect.repeat(
1526
1485
  * Effect.gen(function*() {
1527
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
1486
+ * yield* Console.log("Task executed")
1528
1487
  * return "task completed"
1529
1488
  * }),
1530
1489
  * bothSchedule.pipe(
@@ -1568,8 +1527,8 @@ export const both: {
1568
1527
  * // Compare with either which provides union semantics (OR logic)
1569
1528
  * ```
1570
1529
  *
1571
- * @since 2.0.0
1572
1530
  * @category utilities
1531
+ * @since 2.0.0
1573
1532
  */
1574
1533
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
1575
1534
  self: Schedule<Output, Input, Error, Env>,
@@ -1586,7 +1545,8 @@ export const both: {
1586
1545
  * to recur, using the maximum of the two durations between recurrences and
1587
1546
  * outputting the result of the left schedule (i.e. `self`).
1588
1547
  *
1589
- * @example
1548
+ * **Example** (Combining schedules and keeping the left output)
1549
+ *
1590
1550
  * ```ts
1591
1551
  * import { Console, Effect, Schedule } from "effect"
1592
1552
  *
@@ -1609,8 +1569,8 @@ export const both: {
1609
1569
  * })
1610
1570
  * ```
1611
1571
  *
1612
- * @since 2.0.0
1613
1572
  * @category utilities
1573
+ * @since 2.0.0
1614
1574
  */
1615
1575
  export const bothLeft: {
1616
1576
  /**
@@ -1618,7 +1578,8 @@ export const bothLeft: {
1618
1578
  * to recur, using the maximum of the two durations between recurrences and
1619
1579
  * outputting the result of the left schedule (i.e. `self`).
1620
1580
  *
1621
- * @example
1581
+ * **Example** (Combining schedules and keeping the left output)
1582
+ *
1622
1583
  * ```ts
1623
1584
  * import { Console, Effect, Schedule } from "effect"
1624
1585
  *
@@ -1641,8 +1602,8 @@ export const bothLeft: {
1641
1602
  * })
1642
1603
  * ```
1643
1604
  *
1644
- * @since 2.0.0
1645
1605
  * @category utilities
1606
+ * @since 2.0.0
1646
1607
  */
1647
1608
  <Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
1648
1609
  self: Schedule<Output, Input, Error, Env>
@@ -1652,7 +1613,8 @@ export const bothLeft: {
1652
1613
  * to recur, using the maximum of the two durations between recurrences and
1653
1614
  * outputting the result of the left schedule (i.e. `self`).
1654
1615
  *
1655
- * @example
1616
+ * **Example** (Combining schedules and keeping the left output)
1617
+ *
1656
1618
  * ```ts
1657
1619
  * import { Console, Effect, Schedule } from "effect"
1658
1620
  *
@@ -1675,8 +1637,8 @@ export const bothLeft: {
1675
1637
  * })
1676
1638
  * ```
1677
1639
  *
1678
- * @since 2.0.0
1679
1640
  * @category utilities
1641
+ * @since 2.0.0
1680
1642
  */
1681
1643
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
1682
1644
  self: Schedule<Output, Input, Error, Env>,
@@ -1692,7 +1654,8 @@ export const bothLeft: {
1692
1654
  * to recur, using the maximum of the two durations between recurrences and
1693
1655
  * outputting the result of the right schedule (i.e. `other`).
1694
1656
  *
1695
- * @example
1657
+ * **Example** (Combining schedules and keeping the right output)
1658
+ *
1696
1659
  * ```ts
1697
1660
  * import { Console, Effect, Schedule } from "effect"
1698
1661
  *
@@ -1717,8 +1680,8 @@ export const bothLeft: {
1717
1680
  * })
1718
1681
  * ```
1719
1682
  *
1720
- * @since 2.0.0
1721
1683
  * @category utilities
1684
+ * @since 2.0.0
1722
1685
  */
1723
1686
  export const bothRight: {
1724
1687
  /**
@@ -1726,7 +1689,8 @@ export const bothRight: {
1726
1689
  * to recur, using the maximum of the two durations between recurrences and
1727
1690
  * outputting the result of the right schedule (i.e. `other`).
1728
1691
  *
1729
- * @example
1692
+ * **Example** (Combining schedules and keeping the right output)
1693
+ *
1730
1694
  * ```ts
1731
1695
  * import { Console, Effect, Schedule } from "effect"
1732
1696
  *
@@ -1751,8 +1715,8 @@ export const bothRight: {
1751
1715
  * })
1752
1716
  * ```
1753
1717
  *
1754
- * @since 2.0.0
1755
1718
  * @category utilities
1719
+ * @since 2.0.0
1756
1720
  */
1757
1721
  <Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
1758
1722
  self: Schedule<Output, Input, Error, Env>
@@ -1762,7 +1726,8 @@ export const bothRight: {
1762
1726
  * to recur, using the maximum of the two durations between recurrences and
1763
1727
  * outputting the result of the right schedule (i.e. `other`).
1764
1728
  *
1765
- * @example
1729
+ * **Example** (Combining schedules and keeping the right output)
1730
+ *
1766
1731
  * ```ts
1767
1732
  * import { Console, Effect, Schedule } from "effect"
1768
1733
  *
@@ -1787,8 +1752,8 @@ export const bothRight: {
1787
1752
  * })
1788
1753
  * ```
1789
1754
  *
1790
- * @since 2.0.0
1791
1755
  * @category utilities
1756
+ * @since 2.0.0
1792
1757
  */
1793
1758
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
1794
1759
  self: Schedule<Output, Input, Error, Env>,
@@ -1805,7 +1770,8 @@ export const bothRight: {
1805
1770
  * outputting the result of the combination of both schedule outputs using the
1806
1771
  * specified `combine` function.
1807
1772
  *
1808
- * @example
1773
+ * **Example** (Combining schedule outputs)
1774
+ *
1809
1775
  * ```ts
1810
1776
  * import { Console, Effect, Schedule } from "effect"
1811
1777
  *
@@ -1834,8 +1800,8 @@ export const bothRight: {
1834
1800
  * })
1835
1801
  * ```
1836
1802
  *
1837
- * @since 2.0.0
1838
1803
  * @category utilities
1804
+ * @since 2.0.0
1839
1805
  */
1840
1806
  export const bothWith: {
1841
1807
  /**
@@ -1844,7 +1810,8 @@ export const bothWith: {
1844
1810
  * outputting the result of the combination of both schedule outputs using the
1845
1811
  * specified `combine` function.
1846
1812
  *
1847
- * @example
1813
+ * **Example** (Combining schedule outputs)
1814
+ *
1848
1815
  * ```ts
1849
1816
  * import { Console, Effect, Schedule } from "effect"
1850
1817
  *
@@ -1873,8 +1840,8 @@ export const bothWith: {
1873
1840
  * })
1874
1841
  * ```
1875
1842
  *
1876
- * @since 2.0.0
1877
1843
  * @category utilities
1844
+ * @since 2.0.0
1878
1845
  */
1879
1846
  <Output2, Input2, Error2, Env2, Output, Output3>(
1880
1847
  other: Schedule<Output2, Input2, Error2, Env2>,
@@ -1888,7 +1855,8 @@ export const bothWith: {
1888
1855
  * outputting the result of the combination of both schedule outputs using the
1889
1856
  * specified `combine` function.
1890
1857
  *
1891
- * @example
1858
+ * **Example** (Combining schedule outputs)
1859
+ *
1892
1860
  * ```ts
1893
1861
  * import { Console, Effect, Schedule } from "effect"
1894
1862
  *
@@ -1917,8 +1885,8 @@ export const bothWith: {
1917
1885
  * })
1918
1886
  * ```
1919
1887
  *
1920
- * @since 2.0.0
1921
1888
  * @category utilities
1889
+ * @since 2.0.0
1922
1890
  */
1923
1891
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2, Output3>(
1924
1892
  self: Schedule<Output, Input, Error, Env>,
@@ -1954,10 +1922,15 @@ export const bothWith: {
1954
1922
  )))
1955
1923
 
1956
1924
  /**
1957
- * Returns a new `Schedule` that always recurs, collecting all inputs of the
1958
- * schedule into an array.
1925
+ * Returns a new `Schedule` that follows `self` and outputs the inputs seen so
1926
+ * far as an array.
1927
+ *
1928
+ * **Details**
1929
+ * This does not make the schedule run forever. The collected schedule stops
1930
+ * when `self` stops and fails when `self` fails.
1931
+ *
1932
+ * **Example** (Collecting schedule inputs)
1959
1933
  *
1960
- * @example
1961
1934
  * ```ts
1962
1935
  * import { Console, Effect, Schedule } from "effect"
1963
1936
  *
@@ -1979,18 +1952,23 @@ export const bothWith: {
1979
1952
  * })
1980
1953
  * ```
1981
1954
  *
1982
- * @since 2.0.0
1983
1955
  * @category utilities
1956
+ * @since 2.0.0
1984
1957
  */
1985
1958
  export const collectInputs = <Output, Input, Error, Env>(
1986
1959
  self: Schedule<Output, Input, Error, Env>
1987
1960
  ): Schedule<Array<Input>, Input, Error, Env> => collectWhile(passthrough(self), () => effect.succeed(true))
1988
1961
 
1989
1962
  /**
1990
- * Returns a new `Schedule` that always recurs, collecting all outputs of the
1991
- * schedule into an array.
1963
+ * Returns a new `Schedule` that follows `self` and outputs the schedule outputs
1964
+ * seen so far as an array.
1965
+ *
1966
+ * **Details**
1967
+ * This does not make the schedule run forever. The collected schedule stops
1968
+ * when `self` stops and fails when `self` fails.
1969
+ *
1970
+ * **Example** (Collecting schedule outputs)
1992
1971
  *
1993
- * @example
1994
1972
  * ```ts
1995
1973
  * import { Console, Effect, Schedule } from "effect"
1996
1974
  *
@@ -2010,8 +1988,8 @@ export const collectInputs = <Output, Input, Error, Env>(
2010
1988
  * })
2011
1989
  * ```
2012
1990
  *
2013
- * @since 2.0.0
2014
1991
  * @category utilities
1992
+ * @since 2.0.0
2015
1993
  */
2016
1994
  export const collectOutputs = <Output, Input, Error, Env>(
2017
1995
  self: Schedule<Output, Input, Error, Env>
@@ -2021,31 +1999,11 @@ export const collectOutputs = <Output, Input, Error, Env>(
2021
1999
  * Returns a new `Schedule` that recurs as long as the specified `predicate`
2022
2000
  * returns `true`, collecting all outputs of the schedule into an array.
2023
2001
  *
2024
- * @example
2002
+ * **Example** (Collecting outputs while a condition holds)
2003
+ *
2025
2004
  * ```ts
2026
2005
  * import { Console, Effect, Schedule } from "effect"
2027
2006
  *
2028
- * // Collect outputs while under time limit
2029
- * const collectForTime = Schedule.collectWhile(
2030
- * Schedule.spaced("500 millis"),
2031
- * (metadata) => Effect.succeed(metadata.elapsed < 3000) // Stop after 3 seconds
2032
- * )
2033
- *
2034
- * const timeBasedProgram = Effect.gen(function*() {
2035
- * const results = yield* Effect.repeat(
2036
- * Effect.gen(function*() {
2037
- * const value = Math.floor(Math.random() * 100)
2038
- * yield* Console.log(`Generated value: ${value}`)
2039
- * return value
2040
- * }),
2041
- * collectForTime
2042
- * )
2043
- *
2044
- * yield* Console.log(
2045
- * `Collected ${results.length} values: [${results.join(", ")}]`
2046
- * )
2047
- * })
2048
- *
2049
2007
  * // Collect outputs while condition is met
2050
2008
  * const collectWhileSmall = Schedule.collectWhile(
2051
2009
  * Schedule.exponential("100 millis"),
@@ -2056,16 +2014,16 @@ export const collectOutputs = <Output, Input, Error, Env>(
2056
2014
  * const conditionalProgram = Effect.gen(function*() {
2057
2015
  * let attempt = 0
2058
2016
  *
2059
- * const delays = yield* Effect.repeat(
2017
+ * const attempts = yield* Effect.repeat(
2060
2018
  * Effect.gen(function*() {
2061
2019
  * attempt++
2062
2020
  * yield* Console.log(`Retry attempt ${attempt}`)
2063
- * return `${Date.now()}`
2021
+ * return `attempt-${attempt}`
2064
2022
  * }),
2065
2023
  * collectWhileSmall
2066
2024
  * )
2067
2025
  *
2068
- * yield* Console.log(`Collected attempts: [${delays.join(", ")}]`)
2026
+ * yield* Console.log(`Collected attempts: [${attempts.join(", ")}]`)
2069
2027
  * })
2070
2028
  *
2071
2029
  * // Collect with effectful predicate
@@ -2082,19 +2040,17 @@ export const collectOutputs = <Output, Input, Error, Env>(
2082
2040
  * )
2083
2041
  *
2084
2042
  * const effectfulProgram = Effect.gen(function*() {
2085
- * const timestamps = yield* Effect.repeat(
2086
- * Effect.gen(function*() {
2087
- * const now = new Date().toISOString()
2088
- * yield* Console.log(`Task at ${now}`)
2089
- * return now
2090
- * }),
2043
+ * const results = yield* Effect.repeat(
2044
+ * Effect.succeed("checked"),
2091
2045
  * collectWithCheck
2092
2046
  * )
2093
2047
  *
2094
- * yield* Console.log(`Final collection: ${timestamps.length} items`)
2048
+ * yield* Console.log(`Final collection: ${results.length} items`)
2095
2049
  * })
2096
2050
  *
2097
2051
  * // Collect samples with condition
2052
+ * const samples = [12, 18, 24, 30, 36]
2053
+ *
2098
2054
  * const collectSamples = Schedule.collectWhile(
2099
2055
  * Schedule.spaced("200 millis"),
2100
2056
  * (metadata) =>
@@ -2102,55 +2058,36 @@ export const collectOutputs = <Output, Input, Error, Env>(
2102
2058
  * )
2103
2059
  *
2104
2060
  * const samplingProgram = Effect.gen(function*() {
2105
- * const samples = yield* Effect.repeat(
2061
+ * let index = 0
2062
+ * const collected = yield* Effect.repeat(
2106
2063
  * Effect.gen(function*() {
2107
- * const sample = Math.random() * 100
2108
- * yield* Console.log(`Sample: ${sample.toFixed(1)}`)
2064
+ * const sample = samples[index++]
2065
+ * yield* Console.log(`Sample: ${sample}`)
2109
2066
  * return sample
2110
2067
  * }),
2111
2068
  * collectSamples
2112
2069
  * )
2113
2070
  *
2114
- * const average = samples.reduce((sum, s) => sum + s, 0) / samples.length
2071
+ * const average = collected.reduce((sum, s) => sum + s, 0) / collected.length
2115
2072
  * yield* Console.log(
2116
- * `Collected ${samples.length} samples, average: ${average.toFixed(1)}`
2073
+ * `Collected ${collected.length} samples, average: ${average.toFixed(1)}`
2117
2074
  * )
2118
2075
  * })
2119
2076
  * ```
2120
2077
  *
2121
- * @since 2.0.0
2122
2078
  * @category utilities
2079
+ * @since 2.0.0
2123
2080
  */
2124
2081
  export const collectWhile: {
2125
2082
  /**
2126
2083
  * Returns a new `Schedule` that recurs as long as the specified `predicate`
2127
2084
  * returns `true`, collecting all outputs of the schedule into an array.
2128
2085
  *
2129
- * @example
2086
+ * **Example** (Collecting outputs while a condition holds)
2087
+ *
2130
2088
  * ```ts
2131
2089
  * import { Console, Effect, Schedule } from "effect"
2132
2090
  *
2133
- * // Collect outputs while under time limit
2134
- * const collectForTime = Schedule.collectWhile(
2135
- * Schedule.spaced("500 millis"),
2136
- * (metadata) => Effect.succeed(metadata.elapsed < 3000) // Stop after 3 seconds
2137
- * )
2138
- *
2139
- * const timeBasedProgram = Effect.gen(function*() {
2140
- * const results = yield* Effect.repeat(
2141
- * Effect.gen(function*() {
2142
- * const value = Math.floor(Math.random() * 100)
2143
- * yield* Console.log(`Generated value: ${value}`)
2144
- * return value
2145
- * }),
2146
- * collectForTime
2147
- * )
2148
- *
2149
- * yield* Console.log(
2150
- * `Collected ${results.length} values: [${results.join(", ")}]`
2151
- * )
2152
- * })
2153
- *
2154
2091
  * // Collect outputs while condition is met
2155
2092
  * const collectWhileSmall = Schedule.collectWhile(
2156
2093
  * Schedule.exponential("100 millis"),
@@ -2161,16 +2098,16 @@ export const collectWhile: {
2161
2098
  * const conditionalProgram = Effect.gen(function*() {
2162
2099
  * let attempt = 0
2163
2100
  *
2164
- * const delays = yield* Effect.repeat(
2101
+ * const attempts = yield* Effect.repeat(
2165
2102
  * Effect.gen(function*() {
2166
2103
  * attempt++
2167
2104
  * yield* Console.log(`Retry attempt ${attempt}`)
2168
- * return `${Date.now()}`
2105
+ * return `attempt-${attempt}`
2169
2106
  * }),
2170
2107
  * collectWhileSmall
2171
2108
  * )
2172
2109
  *
2173
- * yield* Console.log(`Collected attempts: [${delays.join(", ")}]`)
2110
+ * yield* Console.log(`Collected attempts: [${attempts.join(", ")}]`)
2174
2111
  * })
2175
2112
  *
2176
2113
  * // Collect with effectful predicate
@@ -2187,19 +2124,17 @@ export const collectWhile: {
2187
2124
  * )
2188
2125
  *
2189
2126
  * const effectfulProgram = Effect.gen(function*() {
2190
- * const timestamps = yield* Effect.repeat(
2191
- * Effect.gen(function*() {
2192
- * const now = new Date().toISOString()
2193
- * yield* Console.log(`Task at ${now}`)
2194
- * return now
2195
- * }),
2127
+ * const results = yield* Effect.repeat(
2128
+ * Effect.succeed("checked"),
2196
2129
  * collectWithCheck
2197
2130
  * )
2198
2131
  *
2199
- * yield* Console.log(`Final collection: ${timestamps.length} items`)
2132
+ * yield* Console.log(`Final collection: ${results.length} items`)
2200
2133
  * })
2201
2134
  *
2202
2135
  * // Collect samples with condition
2136
+ * const samples = [12, 18, 24, 30, 36]
2137
+ *
2203
2138
  * const collectSamples = Schedule.collectWhile(
2204
2139
  * Schedule.spaced("200 millis"),
2205
2140
  * (metadata) =>
@@ -2207,24 +2142,25 @@ export const collectWhile: {
2207
2142
  * )
2208
2143
  *
2209
2144
  * const samplingProgram = Effect.gen(function*() {
2210
- * const samples = yield* Effect.repeat(
2145
+ * let index = 0
2146
+ * const collected = yield* Effect.repeat(
2211
2147
  * Effect.gen(function*() {
2212
- * const sample = Math.random() * 100
2213
- * yield* Console.log(`Sample: ${sample.toFixed(1)}`)
2148
+ * const sample = samples[index++]
2149
+ * yield* Console.log(`Sample: ${sample}`)
2214
2150
  * return sample
2215
2151
  * }),
2216
2152
  * collectSamples
2217
2153
  * )
2218
2154
  *
2219
- * const average = samples.reduce((sum, s) => sum + s, 0) / samples.length
2155
+ * const average = collected.reduce((sum, s) => sum + s, 0) / collected.length
2220
2156
  * yield* Console.log(
2221
- * `Collected ${samples.length} samples, average: ${average.toFixed(1)}`
2157
+ * `Collected ${collected.length} samples, average: ${average.toFixed(1)}`
2222
2158
  * )
2223
2159
  * })
2224
2160
  * ```
2225
2161
  *
2226
- * @since 2.0.0
2227
2162
  * @category utilities
2163
+ * @since 2.0.0
2228
2164
  */
2229
2165
  <Input, Output, Error2 = never, Env2 = never>(
2230
2166
  predicate: (
@@ -2237,31 +2173,11 @@ export const collectWhile: {
2237
2173
  * Returns a new `Schedule` that recurs as long as the specified `predicate`
2238
2174
  * returns `true`, collecting all outputs of the schedule into an array.
2239
2175
  *
2240
- * @example
2176
+ * **Example** (Collecting outputs while a condition holds)
2177
+ *
2241
2178
  * ```ts
2242
2179
  * import { Console, Effect, Schedule } from "effect"
2243
2180
  *
2244
- * // Collect outputs while under time limit
2245
- * const collectForTime = Schedule.collectWhile(
2246
- * Schedule.spaced("500 millis"),
2247
- * (metadata) => Effect.succeed(metadata.elapsed < 3000) // Stop after 3 seconds
2248
- * )
2249
- *
2250
- * const timeBasedProgram = Effect.gen(function*() {
2251
- * const results = yield* Effect.repeat(
2252
- * Effect.gen(function*() {
2253
- * const value = Math.floor(Math.random() * 100)
2254
- * yield* Console.log(`Generated value: ${value}`)
2255
- * return value
2256
- * }),
2257
- * collectForTime
2258
- * )
2259
- *
2260
- * yield* Console.log(
2261
- * `Collected ${results.length} values: [${results.join(", ")}]`
2262
- * )
2263
- * })
2264
- *
2265
2181
  * // Collect outputs while condition is met
2266
2182
  * const collectWhileSmall = Schedule.collectWhile(
2267
2183
  * Schedule.exponential("100 millis"),
@@ -2272,16 +2188,16 @@ export const collectWhile: {
2272
2188
  * const conditionalProgram = Effect.gen(function*() {
2273
2189
  * let attempt = 0
2274
2190
  *
2275
- * const delays = yield* Effect.repeat(
2191
+ * const attempts = yield* Effect.repeat(
2276
2192
  * Effect.gen(function*() {
2277
2193
  * attempt++
2278
2194
  * yield* Console.log(`Retry attempt ${attempt}`)
2279
- * return `${Date.now()}`
2195
+ * return `attempt-${attempt}`
2280
2196
  * }),
2281
2197
  * collectWhileSmall
2282
2198
  * )
2283
2199
  *
2284
- * yield* Console.log(`Collected attempts: [${delays.join(", ")}]`)
2200
+ * yield* Console.log(`Collected attempts: [${attempts.join(", ")}]`)
2285
2201
  * })
2286
2202
  *
2287
2203
  * // Collect with effectful predicate
@@ -2298,19 +2214,17 @@ export const collectWhile: {
2298
2214
  * )
2299
2215
  *
2300
2216
  * const effectfulProgram = Effect.gen(function*() {
2301
- * const timestamps = yield* Effect.repeat(
2302
- * Effect.gen(function*() {
2303
- * const now = new Date().toISOString()
2304
- * yield* Console.log(`Task at ${now}`)
2305
- * return now
2306
- * }),
2217
+ * const results = yield* Effect.repeat(
2218
+ * Effect.succeed("checked"),
2307
2219
  * collectWithCheck
2308
2220
  * )
2309
2221
  *
2310
- * yield* Console.log(`Final collection: ${timestamps.length} items`)
2222
+ * yield* Console.log(`Final collection: ${results.length} items`)
2311
2223
  * })
2312
2224
  *
2313
2225
  * // Collect samples with condition
2226
+ * const samples = [12, 18, 24, 30, 36]
2227
+ *
2314
2228
  * const collectSamples = Schedule.collectWhile(
2315
2229
  * Schedule.spaced("200 millis"),
2316
2230
  * (metadata) =>
@@ -2318,24 +2232,25 @@ export const collectWhile: {
2318
2232
  * )
2319
2233
  *
2320
2234
  * const samplingProgram = Effect.gen(function*() {
2321
- * const samples = yield* Effect.repeat(
2235
+ * let index = 0
2236
+ * const collected = yield* Effect.repeat(
2322
2237
  * Effect.gen(function*() {
2323
- * const sample = Math.random() * 100
2324
- * yield* Console.log(`Sample: ${sample.toFixed(1)}`)
2238
+ * const sample = samples[index++]
2239
+ * yield* Console.log(`Sample: ${sample}`)
2325
2240
  * return sample
2326
2241
  * }),
2327
2242
  * collectSamples
2328
2243
  * )
2329
2244
  *
2330
- * const average = samples.reduce((sum, s) => sum + s, 0) / samples.length
2245
+ * const average = collected.reduce((sum, s) => sum + s, 0) / collected.length
2331
2246
  * yield* Console.log(
2332
- * `Collected ${samples.length} samples, average: ${average.toFixed(1)}`
2247
+ * `Collected ${collected.length} samples, average: ${average.toFixed(1)}`
2333
2248
  * )
2334
2249
  * })
2335
2250
  * ```
2336
2251
  *
2337
- * @since 2.0.0
2338
2252
  * @category utilities
2253
+ * @since 2.0.0
2339
2254
  */
2340
2255
  <Output, Input, Error, Env, Error2 = never, Env2 = never>(
2341
2256
  self: Schedule<Output, Input, Error, Env>,
@@ -2358,7 +2273,8 @@ export const collectWhile: {
2358
2273
  * Returns a new `Schedule` that recurs on the specified `Cron` schedule and
2359
2274
  * outputs the duration between recurrences.
2360
2275
  *
2361
- * @example
2276
+ * **Example** (Scheduling work with cron expressions)
2277
+ *
2362
2278
  * ```ts
2363
2279
  * import { Console, Data, Effect, Schedule } from "effect"
2364
2280
  *
@@ -2370,7 +2286,7 @@ export const collectWhile: {
2370
2286
  * const minutelyProgram = Effect.gen(function*() {
2371
2287
  * yield* Effect.repeat(
2372
2288
  * Effect.gen(function*() {
2373
- * yield* Console.log(`Minutely task at ${new Date().toISOString()}`)
2289
+ * yield* Console.log("Running minutely task")
2374
2290
  * return "minute"
2375
2291
  * }),
2376
2292
  * everyMinute.pipe(
@@ -2408,8 +2324,8 @@ export const collectWhile: {
2408
2324
  * Effect.gen(function*() {
2409
2325
  * yield* Console.log("Generating weekly report...")
2410
2326
  * const report = {
2411
- * week: Math.floor(Date.now() / (7 * 24 * 60 * 60 * 1000)),
2412
- * timestamp: new Date().toISOString()
2327
+ * week: 42,
2328
+ * status: "ready" as const
2413
2329
  * }
2414
2330
  * yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
2415
2331
  * return report
@@ -2422,10 +2338,13 @@ export const collectWhile: {
2422
2338
  * const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
2423
2339
  *
2424
2340
  * const businessProgram = Effect.gen(function*() {
2341
+ * const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
2342
+ * let index = 0
2343
+ *
2425
2344
  * yield* Effect.repeat(
2426
2345
  * Effect.gen(function*() {
2427
2346
  * yield* Console.log("Business hours health check...")
2428
- * const status = Math.random() > 0.1 ? "healthy" : "degraded"
2347
+ * const status = statuses[index++]
2429
2348
  * yield* Console.log(`System status: ${status}`)
2430
2349
  * return status
2431
2350
  * }),
@@ -2442,9 +2361,9 @@ export const collectWhile: {
2442
2361
  * yield* Effect.repeat(
2443
2362
  * Effect.gen(function*() {
2444
2363
  * yield* Console.log("Processing monthly invoices...")
2445
- * const invoiceCount = Math.floor(Math.random() * 100) + 50
2364
+ * const invoiceCount = 72
2446
2365
  * yield* Console.log(`Processed ${invoiceCount} invoices`)
2447
- * return { count: invoiceCount, date: new Date().toISOString() }
2366
+ * return { count: invoiceCount, batch: "2024-01-a" }
2448
2367
  * }),
2449
2368
  * monthlyInvoice.pipe(Schedule.take(1))
2450
2369
  * )
@@ -2458,11 +2377,13 @@ export const collectWhile: {
2458
2377
  * )
2459
2378
  *
2460
2379
  * const robustProgram = Effect.gen(function*() {
2380
+ * let attempt = 0
2381
+ *
2461
2382
  * yield* Effect.repeat(
2462
2383
  * Effect.gen(function*() {
2384
+ * attempt++
2463
2385
  * yield* Console.log("Complex scheduled task...")
2464
- * // Simulate occasional failures
2465
- * if (Math.random() < 0.3) {
2386
+ * if (attempt === 1) {
2466
2387
  * return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
2467
2388
  * }
2468
2389
  * return "success"
@@ -2476,15 +2397,16 @@ export const collectWhile: {
2476
2397
  * })
2477
2398
  * ```
2478
2399
  *
2479
- * @since 4.0.0
2480
2400
  * @category constructors
2401
+ * @since 4.0.0
2481
2402
  */
2482
2403
  export const cron: {
2483
2404
  /**
2484
2405
  * Returns a new `Schedule` that recurs on the specified `Cron` schedule and
2485
2406
  * outputs the duration between recurrences.
2486
2407
  *
2487
- * @example
2408
+ * **Example** (Scheduling work with cron expressions)
2409
+ *
2488
2410
  * ```ts
2489
2411
  * import { Console, Data, Effect, Schedule } from "effect"
2490
2412
  *
@@ -2496,7 +2418,7 @@ export const cron: {
2496
2418
  * const minutelyProgram = Effect.gen(function*() {
2497
2419
  * yield* Effect.repeat(
2498
2420
  * Effect.gen(function*() {
2499
- * yield* Console.log(`Minutely task at ${new Date().toISOString()}`)
2421
+ * yield* Console.log("Running minutely task")
2500
2422
  * return "minute"
2501
2423
  * }),
2502
2424
  * everyMinute.pipe(
@@ -2534,8 +2456,8 @@ export const cron: {
2534
2456
  * Effect.gen(function*() {
2535
2457
  * yield* Console.log("Generating weekly report...")
2536
2458
  * const report = {
2537
- * week: Math.floor(Date.now() / (7 * 24 * 60 * 60 * 1000)),
2538
- * timestamp: new Date().toISOString()
2459
+ * week: 42,
2460
+ * status: "ready" as const
2539
2461
  * }
2540
2462
  * yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
2541
2463
  * return report
@@ -2548,10 +2470,13 @@ export const cron: {
2548
2470
  * const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
2549
2471
  *
2550
2472
  * const businessProgram = Effect.gen(function*() {
2473
+ * const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
2474
+ * let index = 0
2475
+ *
2551
2476
  * yield* Effect.repeat(
2552
2477
  * Effect.gen(function*() {
2553
2478
  * yield* Console.log("Business hours health check...")
2554
- * const status = Math.random() > 0.1 ? "healthy" : "degraded"
2479
+ * const status = statuses[index++]
2555
2480
  * yield* Console.log(`System status: ${status}`)
2556
2481
  * return status
2557
2482
  * }),
@@ -2568,9 +2493,9 @@ export const cron: {
2568
2493
  * yield* Effect.repeat(
2569
2494
  * Effect.gen(function*() {
2570
2495
  * yield* Console.log("Processing monthly invoices...")
2571
- * const invoiceCount = Math.floor(Math.random() * 100) + 50
2496
+ * const invoiceCount = 72
2572
2497
  * yield* Console.log(`Processed ${invoiceCount} invoices`)
2573
- * return { count: invoiceCount, date: new Date().toISOString() }
2498
+ * return { count: invoiceCount, batch: "2024-01-a" }
2574
2499
  * }),
2575
2500
  * monthlyInvoice.pipe(Schedule.take(1))
2576
2501
  * )
@@ -2584,11 +2509,13 @@ export const cron: {
2584
2509
  * )
2585
2510
  *
2586
2511
  * const robustProgram = Effect.gen(function*() {
2512
+ * let attempt = 0
2513
+ *
2587
2514
  * yield* Effect.repeat(
2588
2515
  * Effect.gen(function*() {
2516
+ * attempt++
2589
2517
  * yield* Console.log("Complex scheduled task...")
2590
- * // Simulate occasional failures
2591
- * if (Math.random() < 0.3) {
2518
+ * if (attempt === 1) {
2592
2519
  * return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
2593
2520
  * }
2594
2521
  * return "success"
@@ -2602,15 +2529,16 @@ export const cron: {
2602
2529
  * })
2603
2530
  * ```
2604
2531
  *
2605
- * @since 4.0.0
2606
2532
  * @category constructors
2533
+ * @since 4.0.0
2607
2534
  */
2608
2535
  (expression: Cron.Cron): Schedule<Duration.Duration, unknown, Cron.CronParseError>
2609
2536
  /**
2610
2537
  * Returns a new `Schedule` that recurs on the specified `Cron` schedule and
2611
2538
  * outputs the duration between recurrences.
2612
2539
  *
2613
- * @example
2540
+ * **Example** (Scheduling work with cron expressions)
2541
+ *
2614
2542
  * ```ts
2615
2543
  * import { Console, Data, Effect, Schedule } from "effect"
2616
2544
  *
@@ -2622,7 +2550,7 @@ export const cron: {
2622
2550
  * const minutelyProgram = Effect.gen(function*() {
2623
2551
  * yield* Effect.repeat(
2624
2552
  * Effect.gen(function*() {
2625
- * yield* Console.log(`Minutely task at ${new Date().toISOString()}`)
2553
+ * yield* Console.log("Running minutely task")
2626
2554
  * return "minute"
2627
2555
  * }),
2628
2556
  * everyMinute.pipe(
@@ -2660,8 +2588,8 @@ export const cron: {
2660
2588
  * Effect.gen(function*() {
2661
2589
  * yield* Console.log("Generating weekly report...")
2662
2590
  * const report = {
2663
- * week: Math.floor(Date.now() / (7 * 24 * 60 * 60 * 1000)),
2664
- * timestamp: new Date().toISOString()
2591
+ * week: 42,
2592
+ * status: "ready" as const
2665
2593
  * }
2666
2594
  * yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
2667
2595
  * return report
@@ -2674,10 +2602,13 @@ export const cron: {
2674
2602
  * const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
2675
2603
  *
2676
2604
  * const businessProgram = Effect.gen(function*() {
2605
+ * const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
2606
+ * let index = 0
2607
+ *
2677
2608
  * yield* Effect.repeat(
2678
2609
  * Effect.gen(function*() {
2679
2610
  * yield* Console.log("Business hours health check...")
2680
- * const status = Math.random() > 0.1 ? "healthy" : "degraded"
2611
+ * const status = statuses[index++]
2681
2612
  * yield* Console.log(`System status: ${status}`)
2682
2613
  * return status
2683
2614
  * }),
@@ -2694,9 +2625,9 @@ export const cron: {
2694
2625
  * yield* Effect.repeat(
2695
2626
  * Effect.gen(function*() {
2696
2627
  * yield* Console.log("Processing monthly invoices...")
2697
- * const invoiceCount = Math.floor(Math.random() * 100) + 50
2628
+ * const invoiceCount = 72
2698
2629
  * yield* Console.log(`Processed ${invoiceCount} invoices`)
2699
- * return { count: invoiceCount, date: new Date().toISOString() }
2630
+ * return { count: invoiceCount, batch: "2024-01-a" }
2700
2631
  * }),
2701
2632
  * monthlyInvoice.pipe(Schedule.take(1))
2702
2633
  * )
@@ -2710,11 +2641,13 @@ export const cron: {
2710
2641
  * )
2711
2642
  *
2712
2643
  * const robustProgram = Effect.gen(function*() {
2644
+ * let attempt = 0
2645
+ *
2713
2646
  * yield* Effect.repeat(
2714
2647
  * Effect.gen(function*() {
2648
+ * attempt++
2715
2649
  * yield* Console.log("Complex scheduled task...")
2716
- * // Simulate occasional failures
2717
- * if (Math.random() < 0.3) {
2650
+ * if (attempt === 1) {
2718
2651
  * return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
2719
2652
  * }
2720
2653
  * return "success"
@@ -2728,13 +2661,13 @@ export const cron: {
2728
2661
  * })
2729
2662
  * ```
2730
2663
  *
2731
- * @since 4.0.0
2732
2664
  * @category constructors
2665
+ * @since 4.0.0
2733
2666
  */
2734
2667
  (expression: string, tz?: string | DateTime.TimeZone): Schedule<Duration.Duration, unknown, Cron.CronParseError>
2735
2668
  } = (expression: string | Cron.Cron, tz?: string | DateTime.TimeZone) => {
2736
2669
  const parsed = Cron.isCron(expression) ? Result.succeed(expression) : Cron.parse(expression, tz)
2737
- return fromStep(effect.map(parsed.asEffect(), (cron) => (now, _) =>
2670
+ return fromStep(effect.map(effect.fromResult(parsed), (cron) => (now, _) =>
2738
2671
  effect.sync(() => {
2739
2672
  const next = Cron.next(cron, now).getTime()
2740
2673
  const duration = Duration.millis(next - now)
@@ -2745,7 +2678,8 @@ export const cron: {
2745
2678
  /**
2746
2679
  * Returns a new schedule that outputs the delay between each occurence.
2747
2680
  *
2748
- * @example
2681
+ * **Example** (Extracting schedule delays)
2682
+ *
2749
2683
  * ```ts
2750
2684
  * import { Console, Effect, Schedule } from "effect"
2751
2685
  *
@@ -2805,7 +2739,7 @@ export const cron: {
2805
2739
  * yield* Effect.repeat(
2806
2740
  * Effect.gen(function*() {
2807
2741
  * yield* Console.log("Adaptive task execution")
2808
- * return Date.now()
2742
+ * return "completed"
2809
2743
  * }),
2810
2744
  * adaptiveDelays.pipe(
2811
2745
  * Schedule.tapOutput((delay) => Console.log(`Adaptive delay: ${delay}`))
@@ -2822,8 +2756,8 @@ export const cron: {
2822
2756
  * )
2823
2757
  * ```
2824
2758
  *
2825
- * @since 2.0.0
2826
2759
  * @category constructors
2760
+ * @since 2.0.0
2827
2761
  */
2828
2762
  export const delays = <Out, In, E, R>(self: Schedule<Out, In, E, R>): Schedule<Duration.Duration, In, E, R> =>
2829
2763
  fromStep(
@@ -2843,8 +2777,8 @@ export const delays = <Out, In, E, R>(self: Schedule<Out, In, E, R>): Schedule<D
2843
2777
  * The schedule outputs the configured duration for its first recurrence and
2844
2778
  * then completes.
2845
2779
  *
2846
- * @since 2.0.0
2847
2780
  * @category constructors
2781
+ * @since 2.0.0
2848
2782
  */
2849
2783
  export const duration = (durationInput: Duration.Input): Schedule<Duration.Duration> => {
2850
2784
  const duration = Duration.fromInputUnsafe(durationInput)
@@ -2859,7 +2793,8 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
2859
2793
  * Returns a new `Schedule` that will always recur, but only during the
2860
2794
  * specified `duration` of time.
2861
2795
  *
2862
- * @example
2796
+ * **Example** (Repeating work during a duration)
2797
+ *
2863
2798
  * ```ts
2864
2799
  * import { Console, Data, Effect, Schedule } from "effect"
2865
2800
  *
@@ -2869,12 +2804,9 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
2869
2804
  * const fiveSecondSchedule = Schedule.during("5 seconds")
2870
2805
  *
2871
2806
  * const timedProgram = Effect.gen(function*() {
2872
- * const startTime = Date.now()
2873
- *
2874
2807
  * yield* Effect.repeat(
2875
2808
  * Effect.gen(function*() {
2876
- * const elapsed = Date.now() - startTime
2877
- * yield* Console.log(`Task executed after ${elapsed}ms`)
2809
+ * yield* Console.log("Task executed inside the time window")
2878
2810
  * yield* Effect.sleep("500 millis") // Each task takes 500ms
2879
2811
  * return "task done"
2880
2812
  * }),
@@ -2902,8 +2834,8 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
2902
2834
  *
2903
2835
  * yield* Effect.repeat(
2904
2836
  * Effect.gen(function*() {
2905
- * yield* Console.log(`Burst task at ${new Date().toISOString()}`)
2906
- * return Math.random()
2837
+ * yield* Console.log("Burst task")
2838
+ * return "burst"
2907
2839
  * }),
2908
2840
  * burstWindow
2909
2841
  * )
@@ -2924,7 +2856,7 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
2924
2856
  * attempt++
2925
2857
  * yield* Console.log(`Retry attempt ${attempt}`)
2926
2858
  *
2927
- * if (Math.random() < 0.8) { // 80% failure rate
2859
+ * if (attempt < 4) {
2928
2860
  * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
2929
2861
  * }
2930
2862
  *
@@ -2939,8 +2871,8 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
2939
2871
  * )
2940
2872
  * ```
2941
2873
  *
2942
- * @since 4.0.0
2943
2874
  * @category constructors
2875
+ * @since 4.0.0
2944
2876
  */
2945
2877
  export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
2946
2878
  while_(
@@ -2953,7 +2885,8 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
2953
2885
  * to recur, using the minimum of the two durations between recurrences and
2954
2886
  * outputting a tuple of the outputs of both schedules.
2955
2887
  *
2956
- * @example
2888
+ * **Example** (Combining schedules with either semantics)
2889
+ *
2957
2890
  * ```ts
2958
2891
  * import { Console, Data, Effect, Schedule } from "effect"
2959
2892
  *
@@ -2970,7 +2903,7 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
2970
2903
  * const program = Effect.gen(function*() {
2971
2904
  * const results = yield* Effect.repeat(
2972
2905
  * Effect.gen(function*() {
2973
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
2906
+ * yield* Console.log("Task executed")
2974
2907
  * return "task completed"
2975
2908
  * }),
2976
2909
  * eitherSchedule.pipe(
@@ -3016,8 +2949,8 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
3016
2949
  * // Compare with intersect which provides intersection semantics (AND logic)
3017
2950
  * ```
3018
2951
  *
3019
- * @since 2.0.0
3020
2952
  * @category utilities
2953
+ * @since 2.0.0
3021
2954
  */
3022
2955
  export const either: {
3023
2956
  /**
@@ -3025,7 +2958,8 @@ export const either: {
3025
2958
  * to recur, using the minimum of the two durations between recurrences and
3026
2959
  * outputting a tuple of the outputs of both schedules.
3027
2960
  *
3028
- * @example
2961
+ * **Example** (Combining schedules with either semantics)
2962
+ *
3029
2963
  * ```ts
3030
2964
  * import { Console, Data, Effect, Schedule } from "effect"
3031
2965
  *
@@ -3042,7 +2976,7 @@ export const either: {
3042
2976
  * const program = Effect.gen(function*() {
3043
2977
  * const results = yield* Effect.repeat(
3044
2978
  * Effect.gen(function*() {
3045
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
2979
+ * yield* Console.log("Task executed")
3046
2980
  * return "task completed"
3047
2981
  * }),
3048
2982
  * eitherSchedule.pipe(
@@ -3088,8 +3022,8 @@ export const either: {
3088
3022
  * // Compare with intersect which provides intersection semantics (AND logic)
3089
3023
  * ```
3090
3024
  *
3091
- * @since 2.0.0
3092
3025
  * @category utilities
3026
+ * @since 2.0.0
3093
3027
  */
3094
3028
  <Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
3095
3029
  self: Schedule<Output, Input, Error, Env>
@@ -3099,7 +3033,8 @@ export const either: {
3099
3033
  * to recur, using the minimum of the two durations between recurrences and
3100
3034
  * outputting a tuple of the outputs of both schedules.
3101
3035
  *
3102
- * @example
3036
+ * **Example** (Combining schedules with either semantics)
3037
+ *
3103
3038
  * ```ts
3104
3039
  * import { Console, Data, Effect, Schedule } from "effect"
3105
3040
  *
@@ -3116,7 +3051,7 @@ export const either: {
3116
3051
  * const program = Effect.gen(function*() {
3117
3052
  * const results = yield* Effect.repeat(
3118
3053
  * Effect.gen(function*() {
3119
- * yield* Console.log(`Task executed at ${new Date().toISOString()}`)
3054
+ * yield* Console.log("Task executed")
3120
3055
  * return "task completed"
3121
3056
  * }),
3122
3057
  * eitherSchedule.pipe(
@@ -3162,8 +3097,8 @@ export const either: {
3162
3097
  * // Compare with intersect which provides intersection semantics (AND logic)
3163
3098
  * ```
3164
3099
  *
3165
- * @since 2.0.0
3166
3100
  * @category utilities
3101
+ * @since 2.0.0
3167
3102
  */
3168
3103
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
3169
3104
  self: Schedule<Output, Input, Error, Env>,
@@ -3180,7 +3115,8 @@ export const either: {
3180
3115
  * to recur, using the minimum of the two durations between recurrences and
3181
3116
  * outputting the result of the left schedule (i.e. `self`).
3182
3117
  *
3183
- * @example
3118
+ * **Example** (Combining either schedules and keeping the left output)
3119
+ *
3184
3120
  * ```ts
3185
3121
  * import { Console, Effect, Schedule } from "effect"
3186
3122
  *
@@ -3206,8 +3142,8 @@ export const either: {
3206
3142
  * })
3207
3143
  * ```
3208
3144
  *
3209
- * @since 2.0.0
3210
3145
  * @category utilities
3146
+ * @since 2.0.0
3211
3147
  */
3212
3148
  export const eitherLeft: {
3213
3149
  /**
@@ -3215,7 +3151,8 @@ export const eitherLeft: {
3215
3151
  * to recur, using the minimum of the two durations between recurrences and
3216
3152
  * outputting the result of the left schedule (i.e. `self`).
3217
3153
  *
3218
- * @example
3154
+ * **Example** (Combining either schedules and keeping the left output)
3155
+ *
3219
3156
  * ```ts
3220
3157
  * import { Console, Effect, Schedule } from "effect"
3221
3158
  *
@@ -3241,8 +3178,8 @@ export const eitherLeft: {
3241
3178
  * })
3242
3179
  * ```
3243
3180
  *
3244
- * @since 2.0.0
3245
3181
  * @category utilities
3182
+ * @since 2.0.0
3246
3183
  */
3247
3184
  <Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
3248
3185
  self: Schedule<Output, Input, Error, Env>
@@ -3252,7 +3189,8 @@ export const eitherLeft: {
3252
3189
  * to recur, using the minimum of the two durations between recurrences and
3253
3190
  * outputting the result of the left schedule (i.e. `self`).
3254
3191
  *
3255
- * @example
3192
+ * **Example** (Combining either schedules and keeping the left output)
3193
+ *
3256
3194
  * ```ts
3257
3195
  * import { Console, Effect, Schedule } from "effect"
3258
3196
  *
@@ -3278,8 +3216,8 @@ export const eitherLeft: {
3278
3216
  * })
3279
3217
  * ```
3280
3218
  *
3281
- * @since 2.0.0
3282
3219
  * @category utilities
3220
+ * @since 2.0.0
3283
3221
  */
3284
3222
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
3285
3223
  self: Schedule<Output, Input, Error, Env>,
@@ -3295,7 +3233,8 @@ export const eitherLeft: {
3295
3233
  * to recur, using the minimum of the two durations between recurrences and
3296
3234
  * outputting the result of the right schedule (i.e. `other`).
3297
3235
  *
3298
- * @example
3236
+ * **Example** (Combining either schedules and keeping the right output)
3237
+ *
3299
3238
  * ```ts
3300
3239
  * import { Console, Effect, Schedule } from "effect"
3301
3240
  *
@@ -3321,8 +3260,8 @@ export const eitherLeft: {
3321
3260
  * })
3322
3261
  * ```
3323
3262
  *
3324
- * @since 2.0.0
3325
3263
  * @category utilities
3264
+ * @since 2.0.0
3326
3265
  */
3327
3266
  export const eitherRight: {
3328
3267
  /**
@@ -3330,7 +3269,8 @@ export const eitherRight: {
3330
3269
  * to recur, using the minimum of the two durations between recurrences and
3331
3270
  * outputting the result of the right schedule (i.e. `other`).
3332
3271
  *
3333
- * @example
3272
+ * **Example** (Combining either schedules and keeping the right output)
3273
+ *
3334
3274
  * ```ts
3335
3275
  * import { Console, Effect, Schedule } from "effect"
3336
3276
  *
@@ -3356,8 +3296,8 @@ export const eitherRight: {
3356
3296
  * })
3357
3297
  * ```
3358
3298
  *
3359
- * @since 2.0.0
3360
3299
  * @category utilities
3300
+ * @since 2.0.0
3361
3301
  */
3362
3302
  <Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
3363
3303
  self: Schedule<Output, Input, Error, Env>
@@ -3367,7 +3307,8 @@ export const eitherRight: {
3367
3307
  * to recur, using the minimum of the two durations between recurrences and
3368
3308
  * outputting the result of the right schedule (i.e. `other`).
3369
3309
  *
3370
- * @example
3310
+ * **Example** (Combining either schedules and keeping the right output)
3311
+ *
3371
3312
  * ```ts
3372
3313
  * import { Console, Effect, Schedule } from "effect"
3373
3314
  *
@@ -3393,8 +3334,8 @@ export const eitherRight: {
3393
3334
  * })
3394
3335
  * ```
3395
3336
  *
3396
- * @since 2.0.0
3397
3337
  * @category utilities
3338
+ * @since 2.0.0
3398
3339
  */
3399
3340
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
3400
3341
  self: Schedule<Output, Input, Error, Env>,
@@ -3411,7 +3352,8 @@ export const eitherRight: {
3411
3352
  * outputting the result of the combination of both schedule outputs using the
3412
3353
  * specified `combine` function.
3413
3354
  *
3414
- * @example
3355
+ * **Example** (Combining either schedule outputs)
3356
+ *
3415
3357
  * ```ts
3416
3358
  * import { Console, Effect, Schedule } from "effect"
3417
3359
  *
@@ -3441,8 +3383,8 @@ export const eitherRight: {
3441
3383
  * })
3442
3384
  * ```
3443
3385
  *
3444
- * @since 2.0.0
3445
3386
  * @category utilities
3387
+ * @since 2.0.0
3446
3388
  */
3447
3389
  export const eitherWith: {
3448
3390
  /**
@@ -3451,7 +3393,8 @@ export const eitherWith: {
3451
3393
  * outputting the result of the combination of both schedule outputs using the
3452
3394
  * specified `combine` function.
3453
3395
  *
3454
- * @example
3396
+ * **Example** (Combining either schedule outputs)
3397
+ *
3455
3398
  * ```ts
3456
3399
  * import { Console, Effect, Schedule } from "effect"
3457
3400
  *
@@ -3481,8 +3424,8 @@ export const eitherWith: {
3481
3424
  * })
3482
3425
  * ```
3483
3426
  *
3484
- * @since 2.0.0
3485
3427
  * @category utilities
3428
+ * @since 2.0.0
3486
3429
  */
3487
3430
  <Output2, Input2, Error2, Env2, Output, Output3>(
3488
3431
  other: Schedule<Output2, Input2, Error2, Env2>,
@@ -3496,7 +3439,8 @@ export const eitherWith: {
3496
3439
  * outputting the result of the combination of both schedule outputs using the
3497
3440
  * specified `combine` function.
3498
3441
  *
3499
- * @example
3442
+ * **Example** (Combining either schedule outputs)
3443
+ *
3500
3444
  * ```ts
3501
3445
  * import { Console, Effect, Schedule } from "effect"
3502
3446
  *
@@ -3526,8 +3470,8 @@ export const eitherWith: {
3526
3470
  * })
3527
3471
  * ```
3528
3472
  *
3529
- * @since 2.0.0
3530
3473
  * @category utilities
3474
+ * @since 2.0.0
3531
3475
  */
3532
3476
  <Output, Input, Error, Env, Output2, Input2, Error2, Env2, Output3>(
3533
3477
  self: Schedule<Output, Input, Error, Env>,
@@ -3558,7 +3502,8 @@ export const eitherWith: {
3558
3502
  * outputting the result of the combination of both schedule outputs using the
3559
3503
  * specified `combine` function.
3560
3504
  *
3561
- * @example
3505
+ * **Example** (Combining either schedule outputs)
3506
+ *
3562
3507
  * ```ts
3563
3508
  * import { Console, Effect, Schedule } from "effect"
3564
3509
  *
@@ -3588,8 +3533,8 @@ export const eitherWith: {
3588
3533
  * })
3589
3534
  * ```
3590
3535
  *
3591
- * @since 2.0.0
3592
3536
  * @category utilities
3537
+ * @since 2.0.0
3593
3538
  */
3594
3539
  [Output3, Duration.Duration]>([
3595
3540
  combine(leftResult[0], rightDone as Output2),
@@ -3619,7 +3564,8 @@ export const eitherWith: {
3619
3564
  *
3620
3565
  * @returns A schedule that outputs the elapsed duration and never stops
3621
3566
  *
3622
- * @example
3567
+ * **Example** (Measuring elapsed schedule time)
3568
+ *
3623
3569
  * ```ts
3624
3570
  * import { Console, Duration, Effect, Schedule } from "effect"
3625
3571
  *
@@ -3637,8 +3583,8 @@ export const eitherWith: {
3637
3583
  * })
3638
3584
  * ```
3639
3585
  *
3640
- * @since 2.0.0
3641
3586
  * @category constructors
3587
+ * @since 2.0.0
3642
3588
  */
3643
3589
  export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
3644
3590
  effect.succeed((meta) => effect.succeed([Duration.millis(meta.elapsed), Duration.zero] as const))
@@ -3649,7 +3595,8 @@ export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
3649
3595
  * repetitions, given by `base * factor.pow(n)`, where `n` is the number of
3650
3596
  * repetitions so far. Returns the current duration between recurrences.
3651
3597
  *
3652
- * @example
3598
+ * **Example** (Retrying with exponential backoff)
3599
+ *
3653
3600
  * ```ts
3654
3601
  * import { Console, Data, Effect, Schedule } from "effect"
3655
3602
  *
@@ -3689,8 +3636,8 @@ export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
3689
3636
  * // Will retry with delays: 50ms, 100ms, 200ms before success
3690
3637
  * ```
3691
3638
  *
3692
- * @since 2.0.0
3693
3639
  * @category constructors
3640
+ * @since 2.0.0
3694
3641
  */
3695
3642
  export const exponential = (
3696
3643
  base: Duration.Input,
@@ -3708,7 +3655,8 @@ export const exponential = (
3708
3655
  * two delays (similar to the fibonacci sequence). Returns the current
3709
3656
  * duration between recurrences.
3710
3657
  *
3711
- * @example
3658
+ * **Example** (Retrying with fibonacci backoff)
3659
+ *
3712
3660
  * ```ts
3713
3661
  * import { Console, Data, Effect, Schedule } from "effect"
3714
3662
  *
@@ -3744,7 +3692,7 @@ export const exponential = (
3744
3692
  *
3745
3693
  * // Heartbeat with fibonacci intervals (starts fast, gets slower)
3746
3694
  * const adaptiveHeartbeat = Effect.gen(function*() {
3747
- * yield* Console.log(`Heartbeat at ${new Date().toISOString()}`)
3695
+ * yield* Console.log("Heartbeat")
3748
3696
  * return "pulse"
3749
3697
  * }).pipe(
3750
3698
  * Effect.repeat(
@@ -3766,8 +3714,8 @@ export const exponential = (
3766
3714
  * })
3767
3715
  * ```
3768
3716
  *
3769
- * @since 2.0.0
3770
3717
  * @category constructors
3718
+ * @since 2.0.0
3771
3719
  */
3772
3720
  export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
3773
3721
  const oneMillis = Duration.toMillis(Duration.fromInputUnsafe(one))
@@ -3796,7 +3744,8 @@ export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
3796
3744
  * |---------action--------||action|-----|action|-----------|
3797
3745
  * ```
3798
3746
  *
3799
- * @example
3747
+ * **Example** (Repeating on fixed intervals)
3748
+ *
3800
3749
  * ```ts
3801
3750
  * import { Console, Effect, Schedule } from "effect"
3802
3751
  *
@@ -3805,7 +3754,7 @@ export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
3805
3754
  *
3806
3755
  * // Health check that runs at fixed intervals
3807
3756
  * const healthCheck = Effect.gen(function*() {
3808
- * yield* Console.log(`Health check at ${new Date().toISOString()}`)
3757
+ * yield* Console.log("Health check")
3809
3758
  * yield* Effect.sleep("200 millis") // simulate health check work
3810
3759
  * return "healthy"
3811
3760
  * }).pipe(
@@ -3843,8 +3792,8 @@ export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
3843
3792
  * })
3844
3793
  * ```
3845
3794
  *
3846
- * @since 2.0.0
3847
3795
  * @category constructors
3796
+ * @since 2.0.0
3848
3797
  */
3849
3798
  export const fixed = (interval: Duration.Input): Schedule<number> => {
3850
3799
  const window = Duration.toMillis(Duration.fromInputUnsafe(interval))
@@ -3874,7 +3823,8 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
3874
3823
  * Returns a new `Schedule` that maps the output of this schedule using the
3875
3824
  * specified function.
3876
3825
  *
3877
- * @example
3826
+ * **Example** (Mapping schedule outputs)
3827
+ *
3878
3828
  * ```ts
3879
3829
  * import { Console, Effect, Schedule } from "effect"
3880
3830
  *
@@ -3892,7 +3842,6 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
3892
3842
  * const structuredSchedule = Schedule.spaced("1 second").pipe(
3893
3843
  * Schedule.map((recurrence) => Effect.succeed({
3894
3844
  * iteration: recurrence + 1,
3895
- * timestamp: new Date().toISOString(),
3896
3845
  * phase: recurrence < 5 ? "warmup" as const : "steady" as const
3897
3846
  * }))
3898
3847
  * )
@@ -3904,7 +3853,7 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
3904
3853
  * Schedule.take(8),
3905
3854
  * Schedule.tapOutput((info) =>
3906
3855
  * Console.log(
3907
- * `${info.phase} phase - iteration ${info.iteration} at ${info.timestamp}`
3856
+ * `${info.phase} phase - iteration ${info.iteration}`
3908
3857
  * )
3909
3858
  * )
3910
3859
  * )
@@ -3929,15 +3878,16 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
3929
3878
  * )
3930
3879
  * ```
3931
3880
  *
3932
- * @since 2.0.0
3933
3881
  * @category mapping
3882
+ * @since 2.0.0
3934
3883
  */
3935
3884
  export const map: {
3936
3885
  /**
3937
3886
  * Returns a new `Schedule` that maps the output of this schedule using the
3938
3887
  * specified function.
3939
3888
  *
3940
- * @example
3889
+ * **Example** (Mapping schedule outputs)
3890
+ *
3941
3891
  * ```ts
3942
3892
  * import { Console, Effect, Schedule } from "effect"
3943
3893
  *
@@ -3955,7 +3905,6 @@ export const map: {
3955
3905
  * const structuredSchedule = Schedule.spaced("1 second").pipe(
3956
3906
  * Schedule.map((recurrence) => Effect.succeed({
3957
3907
  * iteration: recurrence + 1,
3958
- * timestamp: new Date().toISOString(),
3959
3908
  * phase: recurrence < 5 ? "warmup" as const : "steady" as const
3960
3909
  * }))
3961
3910
  * )
@@ -3967,7 +3916,7 @@ export const map: {
3967
3916
  * Schedule.take(8),
3968
3917
  * Schedule.tapOutput((info) =>
3969
3918
  * Console.log(
3970
- * `${info.phase} phase - iteration ${info.iteration} at ${info.timestamp}`
3919
+ * `${info.phase} phase - iteration ${info.iteration}`
3971
3920
  * )
3972
3921
  * )
3973
3922
  * )
@@ -3992,8 +3941,8 @@ export const map: {
3992
3941
  * )
3993
3942
  * ```
3994
3943
  *
3995
- * @since 2.0.0
3996
3944
  * @category mapping
3945
+ * @since 2.0.0
3997
3946
  */
3998
3947
  <Output, Output2, Error2 = never, Env2 = never>(f: (output: Output) => Output2 | Effect<Output2, Error2, Env2>): <Input, Error, Env>(
3999
3948
  self: Schedule<Output, Input, Error, Env>
@@ -4002,7 +3951,8 @@ export const map: {
4002
3951
  * Returns a new `Schedule` that maps the output of this schedule using the
4003
3952
  * specified function.
4004
3953
  *
4005
- * @example
3954
+ * **Example** (Mapping schedule outputs)
3955
+ *
4006
3956
  * ```ts
4007
3957
  * import { Console, Effect, Schedule } from "effect"
4008
3958
  *
@@ -4020,7 +3970,6 @@ export const map: {
4020
3970
  * const structuredSchedule = Schedule.spaced("1 second").pipe(
4021
3971
  * Schedule.map((recurrence) => Effect.succeed({
4022
3972
  * iteration: recurrence + 1,
4023
- * timestamp: new Date().toISOString(),
4024
3973
  * phase: recurrence < 5 ? "warmup" as const : "steady" as const
4025
3974
  * }))
4026
3975
  * )
@@ -4032,7 +3981,7 @@ export const map: {
4032
3981
  * Schedule.take(8),
4033
3982
  * Schedule.tapOutput((info) =>
4034
3983
  * Console.log(
4035
- * `${info.phase} phase - iteration ${info.iteration} at ${info.timestamp}`
3984
+ * `${info.phase} phase - iteration ${info.iteration}`
4036
3985
  * )
4037
3986
  * )
4038
3987
  * )
@@ -4057,8 +4006,8 @@ export const map: {
4057
4006
  * )
4058
4007
  * ```
4059
4008
  *
4060
- * @since 2.0.0
4061
4009
  * @category mapping
4010
+ * @since 2.0.0
4062
4011
  */
4063
4012
  <Output, Input, Error, Env, Output2, Error2 = never, Env2 = never>(
4064
4013
  self: Schedule<Output, Input, Error, Env>,
@@ -4088,7 +4037,8 @@ export const map: {
4088
4037
  * Returns a new `Schedule` that modifies the delay of the next recurrence
4089
4038
  * of the schedule using the specified effectual function.
4090
4039
  *
4091
- * @example
4040
+ * **Example** (Modifying delays from schedule output)
4041
+ *
4092
4042
  * ```ts
4093
4043
  * import { Console, Duration, Effect, Schedule } from "effect"
4094
4044
  *
@@ -4113,15 +4063,16 @@ export const map: {
4113
4063
  * })
4114
4064
  * ```
4115
4065
  *
4116
- * @since 2.0.0
4117
4066
  * @category utilities
4067
+ * @since 2.0.0
4118
4068
  */
4119
4069
  export const modifyDelay: {
4120
4070
  /**
4121
4071
  * Returns a new `Schedule` that modifies the delay of the next recurrence
4122
4072
  * of the schedule using the specified effectual function.
4123
4073
  *
4124
- * @example
4074
+ * **Example** (Modifying delays from schedule output)
4075
+ *
4125
4076
  * ```ts
4126
4077
  * import { Console, Duration, Effect, Schedule } from "effect"
4127
4078
  *
@@ -4146,8 +4097,8 @@ export const modifyDelay: {
4146
4097
  * })
4147
4098
  * ```
4148
4099
  *
4149
- * @since 2.0.0
4150
4100
  * @category utilities
4101
+ * @since 2.0.0
4151
4102
  */
4152
4103
  <Output, Error2 = never, Env2 = never>(
4153
4104
  f: (
@@ -4161,7 +4112,8 @@ export const modifyDelay: {
4161
4112
  * Returns a new `Schedule` that modifies the delay of the next recurrence
4162
4113
  * of the schedule using the specified effectual function.
4163
4114
  *
4164
- * @example
4115
+ * **Example** (Modifying delays from schedule output)
4116
+ *
4165
4117
  * ```ts
4166
4118
  * import { Console, Duration, Effect, Schedule } from "effect"
4167
4119
  *
@@ -4186,8 +4138,8 @@ export const modifyDelay: {
4186
4138
  * })
4187
4139
  * ```
4188
4140
  *
4189
- * @since 2.0.0
4190
4141
  * @category utilities
4142
+ * @since 2.0.0
4191
4143
  */
4192
4144
  <Output, Input, Error, Env, Error2 = never, Env2 = never>(
4193
4145
  self: Schedule<Output, Input, Error, Env>,
@@ -4214,8 +4166,8 @@ export const modifyDelay: {
4214
4166
  *
4215
4167
  * Delays are jittered between `80%` and `120%` of the original delay.
4216
4168
  *
4217
- * @since 2.0.0
4218
4169
  * @category utilities
4170
+ * @since 2.0.0
4219
4171
  */
4220
4172
  export const jittered = <Output, Input, Error, Env>(
4221
4173
  self: Schedule<Output, Input, Error, Env>
@@ -4229,7 +4181,8 @@ export const jittered = <Output, Input, Error, Env>(
4229
4181
  /**
4230
4182
  * Returns a new `Schedule` that outputs the inputs of the specified schedule.
4231
4183
  *
4232
- * @example
4184
+ * **Example** (Passing inputs through as outputs)
4185
+ *
4233
4186
  * ```ts
4234
4187
  * import { Console, Effect, Schedule } from "effect"
4235
4188
  *
@@ -4251,8 +4204,8 @@ export const jittered = <Output, Input, Error, Env>(
4251
4204
  * })
4252
4205
  * ```
4253
4206
  *
4254
- * @since 2.0.0
4255
4207
  * @category utilities
4208
+ * @since 2.0.0
4256
4209
  */
4257
4210
  export const passthrough = <Output, Input, Error, Env>(
4258
4211
  self: Schedule<Output, Input, Error, Env>
@@ -4268,7 +4221,8 @@ export const passthrough = <Output, Input, Error, Env>(
4268
4221
  * Returns a `Schedule` which can only be stepped the specified number of
4269
4222
  * `times` before it terminates.
4270
4223
  *
4271
- * @example
4224
+ * **Example** (Limiting recurrences)
4225
+ *
4272
4226
  * ```ts
4273
4227
  * import { Console, Data, Effect, Schedule } from "effect"
4274
4228
  *
@@ -4306,7 +4260,7 @@ export const passthrough = <Output, Input, Error, Env>(
4306
4260
  * // Repeat an effect exactly 10 times
4307
4261
  * const exactlyTenTimes = Effect.gen(function*() {
4308
4262
  * yield* Console.log("Executing task...")
4309
- * return Math.random()
4263
+ * return "completed"
4310
4264
  * }).pipe(
4311
4265
  * Effect.repeat(Schedule.recurs(10))
4312
4266
  * )
@@ -4328,7 +4282,8 @@ export const recurs = (times: number): Schedule<number> =>
4328
4282
  * using the specified effectful `combine` function and starting from the
4329
4283
  * specified `initial` state.
4330
4284
  *
4331
- * @example
4285
+ * **Example** (Reducing schedule outputs)
4286
+ *
4332
4287
  * ```ts
4333
4288
  * import { Console, Effect, Schedule } from "effect"
4334
4289
  *
@@ -4353,24 +4308,24 @@ export const recurs = (times: number): Schedule<number> =>
4353
4308
  * yield* Console.log(`Final sum: ${finalSum}`)
4354
4309
  * })
4355
4310
  *
4356
- * // Build a history of execution times
4311
+ * // Build a history of execution counts
4357
4312
  * const historySchedule = Schedule.reduce(
4358
4313
  * Schedule.spaced("1 second").pipe(Schedule.take(4)),
4359
4314
  * () => [] as Array<number>, // Initial empty array
4360
- * (history, executionNumber) => Effect.succeed([...history, Date.now()])
4315
+ * (history, executionNumber) => Effect.succeed([...history, executionNumber])
4361
4316
  * )
4362
4317
  *
4363
4318
  * const historyProgram = Effect.gen(function*() {
4364
4319
  * const timeline = yield* Effect.repeat(
4365
4320
  * Effect.gen(function*() {
4366
- * yield* Console.log("Recording timestamp...")
4321
+ * yield* Console.log("Recording execution...")
4367
4322
  * return "recorded"
4368
4323
  * }),
4369
4324
  * historySchedule
4370
4325
  * )
4371
4326
  *
4372
4327
  * yield* Console.log(
4373
- * `Execution timeline: ${timeline.length} timestamps recorded`
4328
+ * `Execution timeline: ${timeline.join(", ")}`
4374
4329
  * )
4375
4330
  * })
4376
4331
  *
@@ -4431,8 +4386,8 @@ export const recurs = (times: number): Schedule<number> =>
4431
4386
  * })
4432
4387
  * ```
4433
4388
  *
4434
- * @since 2.0.0
4435
4389
  * @category utilities
4390
+ * @since 2.0.0
4436
4391
  */
4437
4392
  export const reduce: {
4438
4393
  /**
@@ -4440,7 +4395,8 @@ export const reduce: {
4440
4395
  * using the specified effectful `combine` function and starting from the
4441
4396
  * specified `initial` state.
4442
4397
  *
4443
- * @example
4398
+ * **Example** (Reducing schedule outputs)
4399
+ *
4444
4400
  * ```ts
4445
4401
  * import { Console, Effect, Schedule } from "effect"
4446
4402
  *
@@ -4465,24 +4421,24 @@ export const reduce: {
4465
4421
  * yield* Console.log(`Final sum: ${finalSum}`)
4466
4422
  * })
4467
4423
  *
4468
- * // Build a history of execution times
4424
+ * // Build a history of execution counts
4469
4425
  * const historySchedule = Schedule.reduce(
4470
4426
  * Schedule.spaced("1 second").pipe(Schedule.take(4)),
4471
4427
  * () => [] as Array<number>, // Initial empty array
4472
- * (history, executionNumber) => Effect.succeed([...history, Date.now()])
4428
+ * (history, executionNumber) => Effect.succeed([...history, executionNumber])
4473
4429
  * )
4474
4430
  *
4475
4431
  * const historyProgram = Effect.gen(function*() {
4476
4432
  * const timeline = yield* Effect.repeat(
4477
4433
  * Effect.gen(function*() {
4478
- * yield* Console.log("Recording timestamp...")
4434
+ * yield* Console.log("Recording execution...")
4479
4435
  * return "recorded"
4480
4436
  * }),
4481
4437
  * historySchedule
4482
4438
  * )
4483
4439
  *
4484
4440
  * yield* Console.log(
4485
- * `Execution timeline: ${timeline.length} timestamps recorded`
4441
+ * `Execution timeline: ${timeline.join(", ")}`
4486
4442
  * )
4487
4443
  * })
4488
4444
  *
@@ -4543,8 +4499,8 @@ export const reduce: {
4543
4499
  * })
4544
4500
  * ```
4545
4501
  *
4546
- * @since 2.0.0
4547
4502
  * @category utilities
4503
+ * @since 2.0.0
4548
4504
  */
4549
4505
  <State, Output, Error2 = never, Env2 = never>(
4550
4506
  initial: LazyArg<State>,
@@ -4557,7 +4513,8 @@ export const reduce: {
4557
4513
  * using the specified effectful `combine` function and starting from the
4558
4514
  * specified `initial` state.
4559
4515
  *
4560
- * @example
4516
+ * **Example** (Reducing schedule outputs)
4517
+ *
4561
4518
  * ```ts
4562
4519
  * import { Console, Effect, Schedule } from "effect"
4563
4520
  *
@@ -4582,24 +4539,24 @@ export const reduce: {
4582
4539
  * yield* Console.log(`Final sum: ${finalSum}`)
4583
4540
  * })
4584
4541
  *
4585
- * // Build a history of execution times
4542
+ * // Build a history of execution counts
4586
4543
  * const historySchedule = Schedule.reduce(
4587
4544
  * Schedule.spaced("1 second").pipe(Schedule.take(4)),
4588
4545
  * () => [] as Array<number>, // Initial empty array
4589
- * (history, executionNumber) => Effect.succeed([...history, Date.now()])
4546
+ * (history, executionNumber) => Effect.succeed([...history, executionNumber])
4590
4547
  * )
4591
4548
  *
4592
4549
  * const historyProgram = Effect.gen(function*() {
4593
4550
  * const timeline = yield* Effect.repeat(
4594
4551
  * Effect.gen(function*() {
4595
- * yield* Console.log("Recording timestamp...")
4552
+ * yield* Console.log("Recording execution...")
4596
4553
  * return "recorded"
4597
4554
  * }),
4598
4555
  * historySchedule
4599
4556
  * )
4600
4557
  *
4601
4558
  * yield* Console.log(
4602
- * `Execution timeline: ${timeline.length} timestamps recorded`
4559
+ * `Execution timeline: ${timeline.join(", ")}`
4603
4560
  * )
4604
4561
  * })
4605
4562
  *
@@ -4660,8 +4617,8 @@ export const reduce: {
4660
4617
  * })
4661
4618
  * ```
4662
4619
  *
4663
- * @since 2.0.0
4664
4620
  * @category utilities
4621
+ * @since 2.0.0
4665
4622
  */
4666
4623
  <Output, Input, Error, Env, State, Error2 = never, Env2 = never>(
4667
4624
  self: Schedule<Output, Input, Error, Env>,
@@ -4700,7 +4657,8 @@ export const reduce: {
4700
4657
  * Returns a schedule that recurs continuously, each repetition spaced the
4701
4658
  * specified duration from the last run.
4702
4659
  *
4703
- * @example
4660
+ * **Example** (Repeating with fixed spacing)
4661
+ *
4704
4662
  * ```ts
4705
4663
  * import { Console, Effect, Schedule } from "effect"
4706
4664
  *
@@ -4709,7 +4667,7 @@ export const reduce: {
4709
4667
  *
4710
4668
  * // Heartbeat that runs indefinitely with fixed spacing
4711
4669
  * const heartbeat = Effect.gen(function*() {
4712
- * yield* Console.log(`Heartbeat at ${new Date().toISOString()}`)
4670
+ * yield* Console.log("Heartbeat")
4713
4671
  * }).pipe(
4714
4672
  * Effect.repeat(everyTwoSeconds)
4715
4673
  * )
@@ -4742,8 +4700,8 @@ export const reduce: {
4742
4700
  * })
4743
4701
  * ```
4744
4702
  *
4745
- * @since 2.0.0
4746
4703
  * @category constructors
4704
+ * @since 2.0.0
4747
4705
  */
4748
4706
  export const spaced = (duration: Duration.Input): Schedule<number> => {
4749
4707
  const decoded = Duration.fromInputUnsafe(duration)
@@ -4755,7 +4713,8 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
4755
4713
  * every input to the schedule, but does not alter the inputs and outputs of
4756
4714
  * the schedule.
4757
4715
  *
4758
- * @example
4716
+ * **Example** (Tapping retry inputs)
4717
+ *
4759
4718
  * ```ts
4760
4719
  * import { Console, Data, Effect, Schedule } from "effect"
4761
4720
  *
@@ -4791,7 +4750,6 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
4791
4750
  * Schedule.take(5),
4792
4751
  * Schedule.tapInput((input: unknown) =>
4793
4752
  * Effect.gen(function*() {
4794
- * yield* Console.log(`Processing input at ${new Date().toISOString()}`)
4795
4753
  * yield* Console.log(`Input type: ${typeof input}`)
4796
4754
  * // In real applications, might send metrics to monitoring system
4797
4755
  * })
@@ -4813,10 +4771,13 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
4813
4771
  * )
4814
4772
  *
4815
4773
  * const validationProgram = Effect.gen(function*() {
4774
+ * let count = 0
4775
+ *
4816
4776
  * yield* Effect.repeat(
4817
4777
  * Effect.gen(function*() {
4778
+ * count++
4818
4779
  * yield* Console.log("Task with validation")
4819
- * return { data: Math.random(), timestamp: Date.now() }
4780
+ * return { data: `sample-${count}` }
4820
4781
  * }),
4821
4782
  * validatingSchedule
4822
4783
  * )
@@ -4828,10 +4789,10 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
4828
4789
  * Schedule.tapInput((error: RetryError) =>
4829
4790
  * Effect.gen(function*() {
4830
4791
  * if (String(error).includes("critical")) {
4831
- * yield* Console.log(`🚨 CRITICAL ERROR: ${String(error)}`)
4792
+ * yield* Console.log(`Critical error: ${String(error)}`)
4832
4793
  * // In real applications, might trigger alerts or notifications
4833
4794
  * } else {
4834
- * yield* Console.log(`ℹ️ Regular error: ${String(error)}`)
4795
+ * yield* Console.log(`Regular error: ${String(error)}`)
4835
4796
  * }
4836
4797
  * })
4837
4798
  * )
@@ -4865,14 +4826,14 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
4865
4826
  * ),
4866
4827
  * Schedule.tapInput((error: RetryError) =>
4867
4828
  * String(error).length > 20
4868
- * ? Console.log("📝 Long error message detected")
4829
+ * ? Console.log("Long error message detected")
4869
4830
  * : Effect.void
4870
4831
  * )
4871
4832
  * )
4872
4833
  * ```
4873
4834
  *
4874
- * @since 2.0.0
4875
4835
  * @category sequencing
4836
+ * @since 2.0.0
4876
4837
  */
4877
4838
  export const tapInput: {
4878
4839
  /**
@@ -4880,7 +4841,8 @@ export const tapInput: {
4880
4841
  * every input to the schedule, but does not alter the inputs and outputs of
4881
4842
  * the schedule.
4882
4843
  *
4883
- * @example
4844
+ * **Example** (Tapping retry inputs)
4845
+ *
4884
4846
  * ```ts
4885
4847
  * import { Console, Data, Effect, Schedule } from "effect"
4886
4848
  *
@@ -4916,7 +4878,6 @@ export const tapInput: {
4916
4878
  * Schedule.take(5),
4917
4879
  * Schedule.tapInput((input: unknown) =>
4918
4880
  * Effect.gen(function*() {
4919
- * yield* Console.log(`Processing input at ${new Date().toISOString()}`)
4920
4881
  * yield* Console.log(`Input type: ${typeof input}`)
4921
4882
  * // In real applications, might send metrics to monitoring system
4922
4883
  * })
@@ -4938,10 +4899,13 @@ export const tapInput: {
4938
4899
  * )
4939
4900
  *
4940
4901
  * const validationProgram = Effect.gen(function*() {
4902
+ * let count = 0
4903
+ *
4941
4904
  * yield* Effect.repeat(
4942
4905
  * Effect.gen(function*() {
4906
+ * count++
4943
4907
  * yield* Console.log("Task with validation")
4944
- * return { data: Math.random(), timestamp: Date.now() }
4908
+ * return { data: `sample-${count}` }
4945
4909
  * }),
4946
4910
  * validatingSchedule
4947
4911
  * )
@@ -4953,10 +4917,10 @@ export const tapInput: {
4953
4917
  * Schedule.tapInput((error: RetryError) =>
4954
4918
  * Effect.gen(function*() {
4955
4919
  * if (String(error).includes("critical")) {
4956
- * yield* Console.log(`🚨 CRITICAL ERROR: ${String(error)}`)
4920
+ * yield* Console.log(`Critical error: ${String(error)}`)
4957
4921
  * // In real applications, might trigger alerts or notifications
4958
4922
  * } else {
4959
- * yield* Console.log(`ℹ️ Regular error: ${String(error)}`)
4923
+ * yield* Console.log(`Regular error: ${String(error)}`)
4960
4924
  * }
4961
4925
  * })
4962
4926
  * )
@@ -4990,14 +4954,14 @@ export const tapInput: {
4990
4954
  * ),
4991
4955
  * Schedule.tapInput((error: RetryError) =>
4992
4956
  * String(error).length > 20
4993
- * ? Console.log("📝 Long error message detected")
4957
+ * ? Console.log("Long error message detected")
4994
4958
  * : Effect.void
4995
4959
  * )
4996
4960
  * )
4997
4961
  * ```
4998
4962
  *
4999
- * @since 2.0.0
5000
4963
  * @category sequencing
4964
+ * @since 2.0.0
5001
4965
  */
5002
4966
  <Input, X, Error2, Env2>(f: (input: Input) => Effect<X, Error2, Env2>): <Output, Error, Env>(
5003
4967
  self: Schedule<Output, Input, Error, Env>
@@ -5007,7 +4971,8 @@ export const tapInput: {
5007
4971
  * every input to the schedule, but does not alter the inputs and outputs of
5008
4972
  * the schedule.
5009
4973
  *
5010
- * @example
4974
+ * **Example** (Tapping retry inputs)
4975
+ *
5011
4976
  * ```ts
5012
4977
  * import { Console, Data, Effect, Schedule } from "effect"
5013
4978
  *
@@ -5043,7 +5008,6 @@ export const tapInput: {
5043
5008
  * Schedule.take(5),
5044
5009
  * Schedule.tapInput((input: unknown) =>
5045
5010
  * Effect.gen(function*() {
5046
- * yield* Console.log(`Processing input at ${new Date().toISOString()}`)
5047
5011
  * yield* Console.log(`Input type: ${typeof input}`)
5048
5012
  * // In real applications, might send metrics to monitoring system
5049
5013
  * })
@@ -5065,10 +5029,13 @@ export const tapInput: {
5065
5029
  * )
5066
5030
  *
5067
5031
  * const validationProgram = Effect.gen(function*() {
5032
+ * let count = 0
5033
+ *
5068
5034
  * yield* Effect.repeat(
5069
5035
  * Effect.gen(function*() {
5036
+ * count++
5070
5037
  * yield* Console.log("Task with validation")
5071
- * return { data: Math.random(), timestamp: Date.now() }
5038
+ * return { data: `sample-${count}` }
5072
5039
  * }),
5073
5040
  * validatingSchedule
5074
5041
  * )
@@ -5080,10 +5047,10 @@ export const tapInput: {
5080
5047
  * Schedule.tapInput((error: RetryError) =>
5081
5048
  * Effect.gen(function*() {
5082
5049
  * if (String(error).includes("critical")) {
5083
- * yield* Console.log(`🚨 CRITICAL ERROR: ${String(error)}`)
5050
+ * yield* Console.log(`Critical error: ${String(error)}`)
5084
5051
  * // In real applications, might trigger alerts or notifications
5085
5052
  * } else {
5086
- * yield* Console.log(`ℹ️ Regular error: ${String(error)}`)
5053
+ * yield* Console.log(`Regular error: ${String(error)}`)
5087
5054
  * }
5088
5055
  * })
5089
5056
  * )
@@ -5117,14 +5084,14 @@ export const tapInput: {
5117
5084
  * ),
5118
5085
  * Schedule.tapInput((error: RetryError) =>
5119
5086
  * String(error).length > 20
5120
- * ? Console.log("📝 Long error message detected")
5087
+ * ? Console.log("Long error message detected")
5121
5088
  * : Effect.void
5122
5089
  * )
5123
5090
  * )
5124
5091
  * ```
5125
5092
  *
5126
- * @since 2.0.0
5127
5093
  * @category sequencing
5094
+ * @since 2.0.0
5128
5095
  */
5129
5096
  <Output, Input, Error, Env, X, Error2, Env2>(
5130
5097
  self: Schedule<Output, Input, Error, Env>,
@@ -5144,7 +5111,8 @@ export const tapInput: {
5144
5111
  * every output of the schedule, but does not alter the inputs and outputs of
5145
5112
  * the schedule.
5146
5113
  *
5147
- * @example
5114
+ * **Example** (Tapping schedule outputs)
5115
+ *
5148
5116
  * ```ts
5149
5117
  * import { Console, Data, Effect, Schedule } from "effect"
5150
5118
  *
@@ -5192,7 +5160,7 @@ export const tapInput: {
5192
5160
  * Effect.gen(function*() {
5193
5161
  * const delayMs = delay.toString()
5194
5162
  * if (delayMs.includes("1000")) { // Alert on delays >= 1 second
5195
- * yield* Console.log(`🚨 High delay detected: ${delay}`)
5163
+ * yield* Console.log(`High delay detected: ${delay}`)
5196
5164
  * }
5197
5165
  * })
5198
5166
  * )
@@ -5202,8 +5170,7 @@ export const tapInput: {
5202
5170
  * yield* Effect.repeat(
5203
5171
  * Effect.gen(function*() {
5204
5172
  * yield* Console.log("Performing health check...")
5205
- * // Simulate health check
5206
- * return Math.random() > 0.7 ? "healthy" : "degraded"
5173
+ * return "healthy"
5207
5174
  * }),
5208
5175
  * alertingSchedule
5209
5176
  * )
@@ -5215,14 +5182,14 @@ export const tapInput: {
5215
5182
  * Schedule.tapOutput((count) => Console.log(`Execution ${count + 1}`)),
5216
5183
  * Schedule.tapOutput((count) =>
5217
5184
  * count % 3 === 0
5218
- * ? Console.log("🎯 Checkpoint reached!")
5185
+ * ? Console.log("Checkpoint reached")
5219
5186
  * : Effect.void
5220
5187
  * )
5221
5188
  * )
5222
5189
  * ```
5223
5190
  *
5224
- * @since 2.0.0
5225
5191
  * @category sequencing
5192
+ * @since 2.0.0
5226
5193
  */
5227
5194
  export const tapOutput: {
5228
5195
  /**
@@ -5230,7 +5197,8 @@ export const tapOutput: {
5230
5197
  * every output of the schedule, but does not alter the inputs and outputs of
5231
5198
  * the schedule.
5232
5199
  *
5233
- * @example
5200
+ * **Example** (Tapping schedule outputs)
5201
+ *
5234
5202
  * ```ts
5235
5203
  * import { Console, Data, Effect, Schedule } from "effect"
5236
5204
  *
@@ -5278,7 +5246,7 @@ export const tapOutput: {
5278
5246
  * Effect.gen(function*() {
5279
5247
  * const delayMs = delay.toString()
5280
5248
  * if (delayMs.includes("1000")) { // Alert on delays >= 1 second
5281
- * yield* Console.log(`🚨 High delay detected: ${delay}`)
5249
+ * yield* Console.log(`High delay detected: ${delay}`)
5282
5250
  * }
5283
5251
  * })
5284
5252
  * )
@@ -5288,8 +5256,7 @@ export const tapOutput: {
5288
5256
  * yield* Effect.repeat(
5289
5257
  * Effect.gen(function*() {
5290
5258
  * yield* Console.log("Performing health check...")
5291
- * // Simulate health check
5292
- * return Math.random() > 0.7 ? "healthy" : "degraded"
5259
+ * return "healthy"
5293
5260
  * }),
5294
5261
  * alertingSchedule
5295
5262
  * )
@@ -5301,14 +5268,14 @@ export const tapOutput: {
5301
5268
  * Schedule.tapOutput((count) => Console.log(`Execution ${count + 1}`)),
5302
5269
  * Schedule.tapOutput((count) =>
5303
5270
  * count % 3 === 0
5304
- * ? Console.log("🎯 Checkpoint reached!")
5271
+ * ? Console.log("Checkpoint reached")
5305
5272
  * : Effect.void
5306
5273
  * )
5307
5274
  * )
5308
5275
  * ```
5309
5276
  *
5310
- * @since 2.0.0
5311
5277
  * @category sequencing
5278
+ * @since 2.0.0
5312
5279
  */
5313
5280
  <Output, X, Error2, Env2>(f: (output: Output) => Effect<X, Error2, Env2>): <Input, Error, Env>(
5314
5281
  self: Schedule<Output, Input, Error, Env>
@@ -5318,7 +5285,8 @@ export const tapOutput: {
5318
5285
  * every output of the schedule, but does not alter the inputs and outputs of
5319
5286
  * the schedule.
5320
5287
  *
5321
- * @example
5288
+ * **Example** (Tapping schedule outputs)
5289
+ *
5322
5290
  * ```ts
5323
5291
  * import { Console, Data, Effect, Schedule } from "effect"
5324
5292
  *
@@ -5366,7 +5334,7 @@ export const tapOutput: {
5366
5334
  * Effect.gen(function*() {
5367
5335
  * const delayMs = delay.toString()
5368
5336
  * if (delayMs.includes("1000")) { // Alert on delays >= 1 second
5369
- * yield* Console.log(`🚨 High delay detected: ${delay}`)
5337
+ * yield* Console.log(`High delay detected: ${delay}`)
5370
5338
  * }
5371
5339
  * })
5372
5340
  * )
@@ -5376,8 +5344,7 @@ export const tapOutput: {
5376
5344
  * yield* Effect.repeat(
5377
5345
  * Effect.gen(function*() {
5378
5346
  * yield* Console.log("Performing health check...")
5379
- * // Simulate health check
5380
- * return Math.random() > 0.7 ? "healthy" : "degraded"
5347
+ * return "healthy"
5381
5348
  * }),
5382
5349
  * alertingSchedule
5383
5350
  * )
@@ -5389,14 +5356,14 @@ export const tapOutput: {
5389
5356
  * Schedule.tapOutput((count) => Console.log(`Execution ${count + 1}`)),
5390
5357
  * Schedule.tapOutput((count) =>
5391
5358
  * count % 3 === 0
5392
- * ? Console.log("🎯 Checkpoint reached!")
5359
+ * ? Console.log("Checkpoint reached")
5393
5360
  * : Effect.void
5394
5361
  * )
5395
5362
  * )
5396
5363
  * ```
5397
5364
  *
5398
- * @since 2.0.0
5399
5365
  * @category sequencing
5366
+ * @since 2.0.0
5400
5367
  */
5401
5368
  <Output, Input, Error, Env, X, Error2, Env2>(
5402
5369
  self: Schedule<Output, Input, Error, Env>,
@@ -5416,7 +5383,8 @@ export const tapOutput: {
5416
5383
  * from the schedule. Once the specified number of outputs is reached, the
5417
5384
  * schedule will stop.
5418
5385
  *
5419
- * @example
5386
+ * **Example** (Taking a limited number of recurrences)
5387
+ *
5420
5388
  * ```ts
5421
5389
  * import { Console, Data, Effect, Schedule } from "effect"
5422
5390
  *
@@ -5430,7 +5398,7 @@ export const tapOutput: {
5430
5398
  * const heartbeatProgram = Effect.gen(function*() {
5431
5399
  * yield* Effect.repeat(
5432
5400
  * Effect.gen(function*() {
5433
- * yield* Console.log(`Heartbeat at ${new Date().toISOString()}`)
5401
+ * yield* Console.log("Heartbeat")
5434
5402
  * return "pulse"
5435
5403
  * }),
5436
5404
  * limitedHeartbeat
@@ -5477,8 +5445,8 @@ export const tapOutput: {
5477
5445
  * const samplingProgram = Effect.gen(function*() {
5478
5446
  * yield* Effect.repeat(
5479
5447
  * Effect.gen(function*() {
5480
- * const value = Math.random()
5481
- * yield* Console.log(`Sampled value: ${value.toFixed(3)}`)
5448
+ * const value = "sample"
5449
+ * yield* Console.log(`Sampled value: ${value}`)
5482
5450
  * return value
5483
5451
  * }),
5484
5452
  * samplingSchedule.pipe(
@@ -5488,8 +5456,8 @@ export const tapOutput: {
5488
5456
  * })
5489
5457
  * ```
5490
5458
  *
5491
- * @since 2.0.0
5492
5459
  * @category utilities
5460
+ * @since 2.0.0
5493
5461
  */
5494
5462
  export const take: {
5495
5463
  /**
@@ -5497,7 +5465,8 @@ export const take: {
5497
5465
  * from the schedule. Once the specified number of outputs is reached, the
5498
5466
  * schedule will stop.
5499
5467
  *
5500
- * @example
5468
+ * **Example** (Taking a limited number of recurrences)
5469
+ *
5501
5470
  * ```ts
5502
5471
  * import { Console, Data, Effect, Schedule } from "effect"
5503
5472
  *
@@ -5511,7 +5480,7 @@ export const take: {
5511
5480
  * const heartbeatProgram = Effect.gen(function*() {
5512
5481
  * yield* Effect.repeat(
5513
5482
  * Effect.gen(function*() {
5514
- * yield* Console.log(`Heartbeat at ${new Date().toISOString()}`)
5483
+ * yield* Console.log("Heartbeat")
5515
5484
  * return "pulse"
5516
5485
  * }),
5517
5486
  * limitedHeartbeat
@@ -5558,8 +5527,8 @@ export const take: {
5558
5527
  * const samplingProgram = Effect.gen(function*() {
5559
5528
  * yield* Effect.repeat(
5560
5529
  * Effect.gen(function*() {
5561
- * const value = Math.random()
5562
- * yield* Console.log(`Sampled value: ${value.toFixed(3)}`)
5530
+ * const value = "sample"
5531
+ * yield* Console.log(`Sampled value: ${value}`)
5563
5532
  * return value
5564
5533
  * }),
5565
5534
  * samplingSchedule.pipe(
@@ -5569,8 +5538,8 @@ export const take: {
5569
5538
  * })
5570
5539
  * ```
5571
5540
  *
5572
- * @since 2.0.0
5573
5541
  * @category utilities
5542
+ * @since 2.0.0
5574
5543
  */
5575
5544
  (n: number): <Output, Input, Error, Env>(
5576
5545
  self: Schedule<Output, Input, Error, Env>
@@ -5580,7 +5549,8 @@ export const take: {
5580
5549
  * from the schedule. Once the specified number of outputs is reached, the
5581
5550
  * schedule will stop.
5582
5551
  *
5583
- * @example
5552
+ * **Example** (Taking a limited number of recurrences)
5553
+ *
5584
5554
  * ```ts
5585
5555
  * import { Console, Data, Effect, Schedule } from "effect"
5586
5556
  *
@@ -5594,7 +5564,7 @@ export const take: {
5594
5564
  * const heartbeatProgram = Effect.gen(function*() {
5595
5565
  * yield* Effect.repeat(
5596
5566
  * Effect.gen(function*() {
5597
- * yield* Console.log(`Heartbeat at ${new Date().toISOString()}`)
5567
+ * yield* Console.log("Heartbeat")
5598
5568
  * return "pulse"
5599
5569
  * }),
5600
5570
  * limitedHeartbeat
@@ -5641,8 +5611,8 @@ export const take: {
5641
5611
  * const samplingProgram = Effect.gen(function*() {
5642
5612
  * yield* Effect.repeat(
5643
5613
  * Effect.gen(function*() {
5644
- * const value = Math.random()
5645
- * yield* Console.log(`Sampled value: ${value.toFixed(3)}`)
5614
+ * const value = "sample"
5615
+ * yield* Console.log(`Sampled value: ${value}`)
5646
5616
  * return value
5647
5617
  * }),
5648
5618
  * samplingSchedule.pipe(
@@ -5652,8 +5622,8 @@ export const take: {
5652
5622
  * })
5653
5623
  * ```
5654
5624
  *
5655
- * @since 2.0.0
5656
5625
  * @category utilities
5626
+ * @since 2.0.0
5657
5627
  */
5658
5628
  <Output, Input, Error, Env>(self: Schedule<Output, Input, Error, Env>, n: number): Schedule<Output, Input, Error, Env>
5659
5629
  } = dual(2, <Output, Input, Error, Env>(
@@ -5665,7 +5635,8 @@ export const take: {
5665
5635
  * Creates a schedule that unfolds a state by repeatedly applying a function,
5666
5636
  * outputting the current state and computing the next state.
5667
5637
  *
5668
- * @example
5638
+ * **Example** (Unfolding schedule state)
5639
+ *
5669
5640
  * ```ts
5670
5641
  * import { Console, Effect, Schedule } from "effect"
5671
5642
  *
@@ -5713,15 +5684,14 @@ export const take: {
5713
5684
  * })
5714
5685
  * )
5715
5686
  *
5716
- * // Random jitter schedule
5717
- * const jitteredSchedule = Schedule.unfold(
5718
- * 1000,
5719
- * (baseDelay) =>
5687
+ * // Deterministic delay adjustment schedule
5688
+ * const adjustedDelaySchedule = Schedule.unfold(
5689
+ * { delay: 1000, adjustment: 100 },
5690
+ * ({ delay, adjustment }) =>
5720
5691
  * Effect.gen(function*() {
5721
- * const jitter = Math.random() * 200 - 100 // ±100ms jitter
5722
- * const nextDelay = Math.max(100, baseDelay + jitter)
5723
- * yield* Console.log(`Jittered delay: ${nextDelay.toFixed(0)}ms`)
5724
- * return nextDelay
5692
+ * const nextDelay = Math.max(100, delay + adjustment)
5693
+ * yield* Console.log(`Adjusted delay: ${nextDelay}ms`)
5694
+ * return { delay: nextDelay, adjustment: adjustment * -1 }
5725
5695
  * })
5726
5696
  * )
5727
5697
  *
@@ -5754,8 +5724,8 @@ export const take: {
5754
5724
  * })
5755
5725
  * ```
5756
5726
  *
5757
- * @since 2.0.0
5758
5727
  * @category constructors
5728
+ * @since 2.0.0
5759
5729
  */
5760
5730
  export const unfold = <State, Error = never, Env = never>(
5761
5731
  initial: State,
@@ -5814,8 +5784,8 @@ export {
5814
5784
  * If the `predicate` returns `true`, the schedule will continue, otherwise
5815
5785
  * the schedule will stop.
5816
5786
  *
5817
- * @since 2.0.0
5818
5787
  * @category utilities
5788
+ * @since 2.0.0
5819
5789
  */
5820
5790
  while_ as while
5821
5791
  }
@@ -5833,7 +5803,8 @@ export {
5833
5803
  * |action------|sleep---|act|-sleep|action----|
5834
5804
  * ```
5835
5805
  *
5836
- * @example
5806
+ * **Example** (Repeating on aligned windows)
5807
+ *
5837
5808
  * ```ts
5838
5809
  * import { Console, Effect, Schedule } from "effect"
5839
5810
  *
@@ -5843,8 +5814,7 @@ export {
5843
5814
  * const program = Effect.gen(function*() {
5844
5815
  * yield* Effect.repeat(
5845
5816
  * Effect.gen(function*() {
5846
- * const now = new Date().toISOString()
5847
- * yield* Console.log(`Window task executed at: ${now}`)
5817
+ * yield* Console.log("Window task executed")
5848
5818
  * return "window-task"
5849
5819
  * }),
5850
5820
  * windowSchedule.pipe(Schedule.take(4))
@@ -5852,8 +5822,8 @@ export {
5852
5822
  * })
5853
5823
  * ```
5854
5824
  *
5855
- * @since 2.0.0
5856
5825
  * @category constructors
5826
+ * @since 2.0.0
5857
5827
  */
5858
5828
  export const windowed = (interval: Duration.Input): Schedule<number> => {
5859
5829
  const window = Duration.toMillis(Duration.fromInputUnsafe(interval))
@@ -5871,7 +5841,8 @@ export const windowed = (interval: Duration.Input): Schedule<number> => {
5871
5841
  * The output of the schedule is the current count of its repetitions thus far
5872
5842
  * (i.e. `0, 1, 2, ...`).
5873
5843
  *
5874
- * @example
5844
+ * **Example** (Repeating forever)
5845
+ *
5875
5846
  * ```ts
5876
5847
  * import { Console, Effect, Schedule } from "effect"
5877
5848
  *
@@ -5889,8 +5860,8 @@ export const windowed = (interval: Duration.Input): Schedule<number> => {
5889
5860
  * })
5890
5861
  * ```
5891
5862
  *
5892
- * @since 2.0.0
5893
5863
  * @category constructors
5864
+ * @since 2.0.0
5894
5865
  */
5895
5866
  export const forever: Schedule<number> = spaced(Duration.zero)
5896
5867
 
@@ -5910,8 +5881,8 @@ export {
5910
5881
  * without modification. It effectively acts as a pass-through that simply
5911
5882
  * echoes its input values at each step.
5912
5883
  *
5913
- * @since 2.0.0
5914
5884
  * @category Constructors
5885
+ * @since 2.0.0
5915
5886
  */
5916
5887
  identity_ as identity
5917
5888
  }
@@ -5919,7 +5890,8 @@ export {
5919
5890
  /**
5920
5891
  * Ensures that the provided schedule respects a specified input type.
5921
5892
  *
5922
- * @example
5893
+ * **Example** (Constraining schedule input types)
5894
+ *
5923
5895
  * ```ts
5924
5896
  * import { Schedule } from "effect"
5925
5897
  *
@@ -5938,8 +5910,8 @@ export {
5938
5910
  * // where CustomType doesn't match the schedule's input type
5939
5911
  * ```
5940
5912
  *
5941
- * @since 2.0.0
5942
5913
  * @category ensuring types
5914
+ * @since 2.0.0
5943
5915
  */
5944
5916
  export const satisfiesInputType = <T>() =>
5945
5917
  <Input extends T, Output = never, Error = never, Env = never>(
@@ -5950,8 +5922,8 @@ export const satisfiesInputType = <T>() =>
5950
5922
  * Sets the input type of the provided schedule to a specified type, without
5951
5923
  * altering the schedule's behavior.
5952
5924
  *
5953
- * @since 2.0.0
5954
5925
  * @category ensuring types
5926
+ * @since 2.0.0
5955
5927
  */
5956
5928
  export const setInputType =
5957
5929
  <T>() => <Output, Error, Env>(self: Schedule<Output, T, Error, Env>): Schedule<Output, T, Error, Env> => self
@@ -5959,7 +5931,8 @@ export const setInputType =
5959
5931
  /**
5960
5932
  * Ensures that the provided schedule respects a specified output type.
5961
5933
  *
5962
- * @example
5934
+ * **Example** (Constraining schedule output types)
5935
+ *
5963
5936
  * ```ts
5964
5937
  * import { Effect, Schedule } from "effect"
5965
5938
  *
@@ -5973,8 +5946,8 @@ export const setInputType =
5973
5946
  * )
5974
5947
  * ```
5975
5948
  *
5976
- * @since 2.0.0
5977
5949
  * @category ensuring types
5950
+ * @since 2.0.0
5978
5951
  */
5979
5952
  export const satisfiesOutputType = <T>() =>
5980
5953
  <Output extends T, Error = never, Input = unknown, Env = never>(
@@ -5984,7 +5957,8 @@ export const satisfiesOutputType = <T>() =>
5984
5957
  /**
5985
5958
  * Ensures that the provided schedule respects a specified error type.
5986
5959
  *
5987
- * @example
5960
+ * **Example** (Constraining schedule error types)
5961
+ *
5988
5962
  * ```ts
5989
5963
  * import { Data, Schedule } from "effect"
5990
5964
  *
@@ -6004,8 +5978,8 @@ export const satisfiesOutputType = <T>() =>
6004
5978
  * )
6005
5979
  * ```
6006
5980
  *
6007
- * @since 2.0.0
6008
5981
  * @category ensuring types
5982
+ * @since 2.0.0
6009
5983
  */
6010
5984
  export const satisfiesErrorType = <T>() =>
6011
5985
  <Error extends T, Output = never, Input = unknown, Env = never>(
@@ -6015,9 +5989,10 @@ export const satisfiesErrorType = <T>() =>
6015
5989
  /**
6016
5990
  * Ensures that the provided schedule respects a specified context type.
6017
5991
  *
6018
- * @example
5992
+ * **Example** (Constraining schedule service types)
5993
+ *
6019
5994
  * ```ts
6020
- * import { Schedule } from "effect"
5995
+ * import { Effect, Schedule } from "effect"
6021
5996
  *
6022
5997
  * // Define service interfaces (type-level only)
6023
5998
  * interface Logger {
@@ -6025,7 +6000,7 @@ export const satisfiesErrorType = <T>() =>
6025
6000
  * }
6026
6001
  *
6027
6002
  * interface Database {
6028
- * readonly query: (sql: string) => Promise<unknown>
6003
+ * readonly query: (sql: string) => Effect.Effect<ReadonlyArray<unknown>>
6029
6004
  * }
6030
6005
  *
6031
6006
  * // Ensure schedule requires Logger service
@@ -6039,8 +6014,8 @@ export const satisfiesErrorType = <T>() =>
6039
6014
  * )
6040
6015
  * ```
6041
6016
  *
6042
- * @since 2.0.0
6043
6017
  * @category ensuring types
6018
+ * @since 2.0.0
6044
6019
  */
6045
6020
  export const satisfiesServicesType = <T>() =>
6046
6021
  <Env extends T, Output = never, Input = unknown, Error = never>(