effect 4.0.0-beta.102 → 4.0.0-beta.103

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 (1451) hide show
  1. package/dist/Array.d.ts +971 -1037
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +381 -407
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +433 -756
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +200 -325
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +207 -267
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +107 -135
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +146 -188
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +64 -84
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.js.map +1 -1
  18. package/dist/Cache.d.ts +405 -254
  19. package/dist/Cache.d.ts.map +1 -1
  20. package/dist/Cache.js +166 -101
  21. package/dist/Cache.js.map +1 -1
  22. package/dist/Cause.d.ts +167 -277
  23. package/dist/Cause.d.ts.map +1 -1
  24. package/dist/Cause.js +122 -176
  25. package/dist/Cause.js.map +1 -1
  26. package/dist/Channel.d.ts +729 -768
  27. package/dist/Channel.d.ts.map +1 -1
  28. package/dist/Channel.js +514 -440
  29. package/dist/Channel.js.map +1 -1
  30. package/dist/ChannelSchema.d.ts +1 -1
  31. package/dist/ChannelSchema.d.ts.map +1 -1
  32. package/dist/ChannelSchema.js.map +1 -1
  33. package/dist/Chunk.d.ts +834 -1173
  34. package/dist/Chunk.d.ts.map +1 -1
  35. package/dist/Chunk.js +326 -439
  36. package/dist/Chunk.js.map +1 -1
  37. package/dist/Clock.d.ts +180 -49
  38. package/dist/Clock.d.ts.map +1 -1
  39. package/dist/Clock.js +96 -31
  40. package/dist/Clock.js.map +1 -1
  41. package/dist/Combiner.d.ts +20 -33
  42. package/dist/Combiner.d.ts.map +1 -1
  43. package/dist/Combiner.js +18 -30
  44. package/dist/Combiner.js.map +1 -1
  45. package/dist/Config.d.ts +225 -173
  46. package/dist/Config.d.ts.map +1 -1
  47. package/dist/Config.js +336 -265
  48. package/dist/Config.js.map +1 -1
  49. package/dist/ConfigProvider.d.ts +194 -68
  50. package/dist/ConfigProvider.d.ts.map +1 -1
  51. package/dist/ConfigProvider.js +115 -80
  52. package/dist/ConfigProvider.js.map +1 -1
  53. package/dist/Console.d.ts +233 -33
  54. package/dist/Console.d.ts.map +1 -1
  55. package/dist/Console.js +232 -32
  56. package/dist/Console.js.map +1 -1
  57. package/dist/Context.d.ts +151 -274
  58. package/dist/Context.d.ts.map +1 -1
  59. package/dist/Context.js +171 -214
  60. package/dist/Context.js.map +1 -1
  61. package/dist/Cron.d.ts +68 -77
  62. package/dist/Cron.d.ts.map +1 -1
  63. package/dist/Cron.js +57 -66
  64. package/dist/Cron.js.map +1 -1
  65. package/dist/Crypto.d.ts +13 -15
  66. package/dist/Crypto.d.ts.map +1 -1
  67. package/dist/Crypto.js +9 -10
  68. package/dist/Crypto.js.map +1 -1
  69. package/dist/Data.d.ts +60 -80
  70. package/dist/Data.d.ts.map +1 -1
  71. package/dist/Data.js +16 -23
  72. package/dist/Data.js.map +1 -1
  73. package/dist/DateTime.d.ts +562 -660
  74. package/dist/DateTime.d.ts.map +1 -1
  75. package/dist/DateTime.js +307 -362
  76. package/dist/DateTime.js.map +1 -1
  77. package/dist/Deferred.d.ts +253 -256
  78. package/dist/Deferred.d.ts.map +1 -1
  79. package/dist/Deferred.js +104 -96
  80. package/dist/Deferred.js.map +1 -1
  81. package/dist/Duration.d.ts +216 -308
  82. package/dist/Duration.d.ts.map +1 -1
  83. package/dist/Duration.js +132 -186
  84. package/dist/Duration.js.map +1 -1
  85. package/dist/Effect.d.ts +2841 -3247
  86. package/dist/Effect.d.ts.map +1 -1
  87. package/dist/Effect.js +1322 -1546
  88. package/dist/Effect.js.map +1 -1
  89. package/dist/Effectable.js.map +1 -1
  90. package/dist/Encoding.d.ts +22 -40
  91. package/dist/Encoding.d.ts.map +1 -1
  92. package/dist/Encoding.js +22 -40
  93. package/dist/Encoding.js.map +1 -1
  94. package/dist/Equal.d.ts +33 -37
  95. package/dist/Equal.d.ts.map +1 -1
  96. package/dist/Equal.js +29 -21
  97. package/dist/Equal.js.map +1 -1
  98. package/dist/Equivalence.d.ts +103 -105
  99. package/dist/Equivalence.d.ts.map +1 -1
  100. package/dist/Equivalence.js +77 -79
  101. package/dist/Equivalence.js.map +1 -1
  102. package/dist/ErrorReporter.d.ts +51 -27
  103. package/dist/ErrorReporter.d.ts.map +1 -1
  104. package/dist/ErrorReporter.js +50 -26
  105. package/dist/ErrorReporter.js.map +1 -1
  106. package/dist/ExecutionPlan.d.ts +13 -55
  107. package/dist/ExecutionPlan.d.ts.map +1 -1
  108. package/dist/ExecutionPlan.js +7 -28
  109. package/dist/ExecutionPlan.js.map +1 -1
  110. package/dist/Exit.d.ts +116 -192
  111. package/dist/Exit.d.ts.map +1 -1
  112. package/dist/Exit.js +82 -130
  113. package/dist/Exit.js.map +1 -1
  114. package/dist/Fiber.d.ts +82 -146
  115. package/dist/Fiber.d.ts.map +1 -1
  116. package/dist/Fiber.js +48 -87
  117. package/dist/Fiber.js.map +1 -1
  118. package/dist/FiberHandle.d.ts +152 -105
  119. package/dist/FiberHandle.d.ts.map +1 -1
  120. package/dist/FiberHandle.js +106 -73
  121. package/dist/FiberHandle.js.map +1 -1
  122. package/dist/FiberMap.d.ts +213 -168
  123. package/dist/FiberMap.d.ts.map +1 -1
  124. package/dist/FiberMap.js +114 -89
  125. package/dist/FiberMap.js.map +1 -1
  126. package/dist/FiberSet.d.ts +123 -81
  127. package/dist/FiberSet.d.ts.map +1 -1
  128. package/dist/FiberSet.js +85 -59
  129. package/dist/FiberSet.js.map +1 -1
  130. package/dist/FileSystem.d.ts +153 -264
  131. package/dist/FileSystem.d.ts.map +1 -1
  132. package/dist/FileSystem.js +42 -147
  133. package/dist/FileSystem.js.map +1 -1
  134. package/dist/Filter.d.ts +61 -33
  135. package/dist/Filter.d.ts.map +1 -1
  136. package/dist/Filter.js +26 -15
  137. package/dist/Filter.js.map +1 -1
  138. package/dist/Formatter.d.ts +25 -33
  139. package/dist/Formatter.d.ts.map +1 -1
  140. package/dist/Formatter.js +48 -49
  141. package/dist/Formatter.js.map +1 -1
  142. package/dist/Function.d.ts +76 -145
  143. package/dist/Function.d.ts.map +1 -1
  144. package/dist/Function.js +40 -57
  145. package/dist/Function.js.map +1 -1
  146. package/dist/Graph.d.ts +360 -714
  147. package/dist/Graph.d.ts.map +1 -1
  148. package/dist/Graph.js +168 -297
  149. package/dist/Graph.js.map +1 -1
  150. package/dist/HKT.d.ts +12 -6
  151. package/dist/HKT.d.ts.map +1 -1
  152. package/dist/Hash.d.ts +47 -83
  153. package/dist/Hash.d.ts.map +1 -1
  154. package/dist/Hash.js +46 -68
  155. package/dist/Hash.js.map +1 -1
  156. package/dist/HashMap.d.ts +319 -411
  157. package/dist/HashMap.d.ts.map +1 -1
  158. package/dist/HashMap.js +122 -166
  159. package/dist/HashMap.js.map +1 -1
  160. package/dist/HashRing.d.ts.map +1 -1
  161. package/dist/HashRing.js +1 -0
  162. package/dist/HashRing.js.map +1 -1
  163. package/dist/HashSet.d.ts +177 -284
  164. package/dist/HashSet.d.ts.map +1 -1
  165. package/dist/HashSet.js +68 -109
  166. package/dist/HashSet.js.map +1 -1
  167. package/dist/Inspectable.d.ts +12 -12
  168. package/dist/Inspectable.js +8 -8
  169. package/dist/Inspectable.js.map +1 -1
  170. package/dist/Iterable.d.ts +620 -786
  171. package/dist/Iterable.d.ts.map +1 -1
  172. package/dist/Iterable.js +228 -306
  173. package/dist/Iterable.js.map +1 -1
  174. package/dist/JsonPatch.d.ts +11 -13
  175. package/dist/JsonPatch.d.ts.map +1 -1
  176. package/dist/JsonPatch.js +44 -102
  177. package/dist/JsonPatch.js.map +1 -1
  178. package/dist/JsonPointer.d.ts +8 -8
  179. package/dist/JsonPointer.js +8 -8
  180. package/dist/JsonPointer.js.map +1 -1
  181. package/dist/JsonSchema.d.ts +98 -44
  182. package/dist/JsonSchema.d.ts.map +1 -1
  183. package/dist/JsonSchema.js +297 -234
  184. package/dist/JsonSchema.js.map +1 -1
  185. package/dist/Latch.d.ts +23 -35
  186. package/dist/Latch.d.ts.map +1 -1
  187. package/dist/Latch.js +16 -28
  188. package/dist/Latch.js.map +1 -1
  189. package/dist/Layer.d.ts +359 -260
  190. package/dist/Layer.d.ts.map +1 -1
  191. package/dist/Layer.js +195 -175
  192. package/dist/Layer.js.map +1 -1
  193. package/dist/LayerMap.d.ts +42 -29
  194. package/dist/LayerMap.d.ts.map +1 -1
  195. package/dist/LayerMap.js +31 -21
  196. package/dist/LayerMap.js.map +1 -1
  197. package/dist/LayerRef.d.ts +6 -2
  198. package/dist/LayerRef.d.ts.map +1 -1
  199. package/dist/LayerRef.js +6 -2
  200. package/dist/LayerRef.js.map +1 -1
  201. package/dist/LogLevel.d.ts +114 -214
  202. package/dist/LogLevel.d.ts.map +1 -1
  203. package/dist/LogLevel.js +41 -76
  204. package/dist/LogLevel.js.map +1 -1
  205. package/dist/Logger.d.ts +218 -467
  206. package/dist/Logger.d.ts.map +1 -1
  207. package/dist/Logger.js +204 -450
  208. package/dist/Logger.js.map +1 -1
  209. package/dist/ManagedRuntime.d.ts +7 -5
  210. package/dist/ManagedRuntime.d.ts.map +1 -1
  211. package/dist/ManagedRuntime.js +7 -5
  212. package/dist/ManagedRuntime.js.map +1 -1
  213. package/dist/Match.d.ts +217 -252
  214. package/dist/Match.d.ts.map +1 -1
  215. package/dist/Match.js +150 -183
  216. package/dist/Match.js.map +1 -1
  217. package/dist/Metric.d.ts +442 -993
  218. package/dist/Metric.d.ts.map +1 -1
  219. package/dist/Metric.js +198 -642
  220. package/dist/Metric.js.map +1 -1
  221. package/dist/MutableHashMap.d.ts +144 -173
  222. package/dist/MutableHashMap.d.ts.map +1 -1
  223. package/dist/MutableHashMap.js +68 -79
  224. package/dist/MutableHashMap.js.map +1 -1
  225. package/dist/MutableHashSet.d.ts +84 -89
  226. package/dist/MutableHashSet.d.ts.map +1 -1
  227. package/dist/MutableHashSet.js +44 -47
  228. package/dist/MutableHashSet.js.map +1 -1
  229. package/dist/MutableList.d.ts +71 -370
  230. package/dist/MutableList.d.ts.map +1 -1
  231. package/dist/MutableList.js +59 -284
  232. package/dist/MutableList.js.map +1 -1
  233. package/dist/MutableRef.d.ts +420 -243
  234. package/dist/MutableRef.d.ts.map +1 -1
  235. package/dist/MutableRef.js +209 -120
  236. package/dist/MutableRef.js.map +1 -1
  237. package/dist/Newtype.d.ts +21 -14
  238. package/dist/Newtype.d.ts.map +1 -1
  239. package/dist/Newtype.js +15 -13
  240. package/dist/Newtype.js.map +1 -1
  241. package/dist/NonEmptyIterable.d.ts +7 -137
  242. package/dist/NonEmptyIterable.d.ts.map +1 -1
  243. package/dist/NonEmptyIterable.js +5 -93
  244. package/dist/NonEmptyIterable.js.map +1 -1
  245. package/dist/Number.d.ts +196 -233
  246. package/dist/Number.d.ts.map +1 -1
  247. package/dist/Number.js +90 -109
  248. package/dist/Number.js.map +1 -1
  249. package/dist/Optic.d.ts +97 -189
  250. package/dist/Optic.d.ts.map +1 -1
  251. package/dist/Optic.js +187 -290
  252. package/dist/Optic.js.map +1 -1
  253. package/dist/Option.d.ts +447 -812
  254. package/dist/Option.d.ts.map +1 -1
  255. package/dist/Option.js +211 -392
  256. package/dist/Option.js.map +1 -1
  257. package/dist/Order.d.ts +109 -109
  258. package/dist/Order.js +91 -91
  259. package/dist/Order.js.map +1 -1
  260. package/dist/Ordering.d.ts +20 -23
  261. package/dist/Ordering.d.ts.map +1 -1
  262. package/dist/Ordering.js +8 -9
  263. package/dist/Ordering.js.map +1 -1
  264. package/dist/PartitionedSemaphore.js.map +1 -1
  265. package/dist/Path.d.ts +38 -41
  266. package/dist/Path.d.ts.map +1 -1
  267. package/dist/Path.js +3 -4
  268. package/dist/Path.js.map +1 -1
  269. package/dist/Pipeable.d.ts +6 -5
  270. package/dist/Pipeable.d.ts.map +1 -1
  271. package/dist/Pipeable.js +2 -2
  272. package/dist/Pipeable.js.map +1 -1
  273. package/dist/PlatformError.d.ts +4 -4
  274. package/dist/PlatformError.js +3 -3
  275. package/dist/PlatformError.js.map +1 -1
  276. package/dist/Pool.d.ts +4 -2
  277. package/dist/Pool.d.ts.map +1 -1
  278. package/dist/Pool.js +4 -2
  279. package/dist/Pool.js.map +1 -1
  280. package/dist/Predicate.d.ts +200 -181
  281. package/dist/Predicate.d.ts.map +1 -1
  282. package/dist/Predicate.js +100 -108
  283. package/dist/Predicate.js.map +1 -1
  284. package/dist/PrimaryKey.d.ts +7 -7
  285. package/dist/PrimaryKey.js +5 -5
  286. package/dist/PrimaryKey.js.map +1 -1
  287. package/dist/PubSub.d.ts +425 -494
  288. package/dist/PubSub.d.ts.map +1 -1
  289. package/dist/PubSub.js +373 -362
  290. package/dist/PubSub.js.map +1 -1
  291. package/dist/Pull.d.ts +24 -18
  292. package/dist/Pull.d.ts.map +1 -1
  293. package/dist/Pull.js +11 -9
  294. package/dist/Pull.js.map +1 -1
  295. package/dist/Queue.d.ts +200 -159
  296. package/dist/Queue.d.ts.map +1 -1
  297. package/dist/Queue.js +162 -132
  298. package/dist/Queue.js.map +1 -1
  299. package/dist/Random.d.ts +49 -74
  300. package/dist/Random.d.ts.map +1 -1
  301. package/dist/Random.js +35 -54
  302. package/dist/Random.js.map +1 -1
  303. package/dist/RcMap.d.ts +121 -63
  304. package/dist/RcMap.d.ts.map +1 -1
  305. package/dist/RcMap.js +42 -21
  306. package/dist/RcMap.js.map +1 -1
  307. package/dist/RcRef.d.ts +24 -13
  308. package/dist/RcRef.d.ts.map +1 -1
  309. package/dist/RcRef.js +15 -9
  310. package/dist/RcRef.js.map +1 -1
  311. package/dist/Record.d.ts +291 -488
  312. package/dist/Record.d.ts.map +1 -1
  313. package/dist/Record.js +111 -202
  314. package/dist/Record.js.map +1 -1
  315. package/dist/Redactable.d.ts +6 -2
  316. package/dist/Redactable.d.ts.map +1 -1
  317. package/dist/Redactable.js +7 -2
  318. package/dist/Redactable.js.map +1 -1
  319. package/dist/Redacted.d.ts +25 -25
  320. package/dist/Redacted.d.ts.map +1 -1
  321. package/dist/Redacted.js +19 -20
  322. package/dist/Redacted.js.map +1 -1
  323. package/dist/Reducer.d.ts +8 -15
  324. package/dist/Reducer.d.ts.map +1 -1
  325. package/dist/Reducer.js +6 -12
  326. package/dist/Reducer.js.map +1 -1
  327. package/dist/Ref.d.ts +95 -165
  328. package/dist/Ref.d.ts.map +1 -1
  329. package/dist/Ref.js +75 -122
  330. package/dist/Ref.js.map +1 -1
  331. package/dist/References.d.ts +102 -168
  332. package/dist/References.d.ts.map +1 -1
  333. package/dist/References.js +102 -168
  334. package/dist/References.js.map +1 -1
  335. package/dist/RegExp.d.ts +10 -14
  336. package/dist/RegExp.d.ts.map +1 -1
  337. package/dist/RegExp.js +10 -14
  338. package/dist/RegExp.js.map +1 -1
  339. package/dist/Request.d.ts +31 -21
  340. package/dist/Request.d.ts.map +1 -1
  341. package/dist/Request.js +16 -13
  342. package/dist/Request.js.map +1 -1
  343. package/dist/RequestResolver.d.ts +201 -90
  344. package/dist/RequestResolver.d.ts.map +1 -1
  345. package/dist/RequestResolver.js +87 -41
  346. package/dist/RequestResolver.js.map +1 -1
  347. package/dist/Resource.js.map +1 -1
  348. package/dist/Result.d.ts +302 -470
  349. package/dist/Result.d.ts.map +1 -1
  350. package/dist/Result.js +133 -217
  351. package/dist/Result.js.map +1 -1
  352. package/dist/Runtime.d.ts +50 -75
  353. package/dist/Runtime.d.ts.map +1 -1
  354. package/dist/Runtime.js +39 -60
  355. package/dist/Runtime.js.map +1 -1
  356. package/dist/Schedule.d.ts +290 -1636
  357. package/dist/Schedule.d.ts.map +1 -1
  358. package/dist/Schedule.js +162 -803
  359. package/dist/Schedule.js.map +1 -1
  360. package/dist/Scheduler.d.ts +5 -5
  361. package/dist/Scheduler.d.ts.map +1 -1
  362. package/dist/Scheduler.js +18 -6
  363. package/dist/Scheduler.js.map +1 -1
  364. package/dist/Schema.d.ts +644 -642
  365. package/dist/Schema.d.ts.map +1 -1
  366. package/dist/Schema.js +491 -527
  367. package/dist/Schema.js.map +1 -1
  368. package/dist/SchemaAST.d.ts +27 -50
  369. package/dist/SchemaAST.d.ts.map +1 -1
  370. package/dist/SchemaAST.js +366 -279
  371. package/dist/SchemaAST.js.map +1 -1
  372. package/dist/SchemaError.d.ts +7 -6
  373. package/dist/SchemaError.d.ts.map +1 -1
  374. package/dist/SchemaError.js +7 -6
  375. package/dist/SchemaError.js.map +1 -1
  376. package/dist/SchemaGetter.d.ts +217 -174
  377. package/dist/SchemaGetter.d.ts.map +1 -1
  378. package/dist/SchemaGetter.js +218 -185
  379. package/dist/SchemaGetter.js.map +1 -1
  380. package/dist/SchemaIssue.d.ts +62 -190
  381. package/dist/SchemaIssue.d.ts.map +1 -1
  382. package/dist/SchemaIssue.js +73 -265
  383. package/dist/SchemaIssue.js.map +1 -1
  384. package/dist/SchemaParser.d.ts +2 -2
  385. package/dist/SchemaParser.d.ts.map +1 -1
  386. package/dist/SchemaParser.js +123 -75
  387. package/dist/SchemaParser.js.map +1 -1
  388. package/dist/SchemaRepresentation.d.ts +22 -36
  389. package/dist/SchemaRepresentation.d.ts.map +1 -1
  390. package/dist/SchemaRepresentation.js +20 -26
  391. package/dist/SchemaRepresentation.js.map +1 -1
  392. package/dist/SchemaTransformation.d.ts +114 -74
  393. package/dist/SchemaTransformation.d.ts.map +1 -1
  394. package/dist/SchemaTransformation.js +120 -85
  395. package/dist/SchemaTransformation.js.map +1 -1
  396. package/dist/Scope.d.ts +123 -151
  397. package/dist/Scope.d.ts.map +1 -1
  398. package/dist/Scope.js +72 -92
  399. package/dist/Scope.js.map +1 -1
  400. package/dist/ScopedCache.js.map +1 -1
  401. package/dist/ScopedRef.d.ts +3 -3
  402. package/dist/ScopedRef.js +2 -2
  403. package/dist/ScopedRef.js.map +1 -1
  404. package/dist/Semaphore.d.ts +96 -10
  405. package/dist/Semaphore.d.ts.map +1 -1
  406. package/dist/Semaphore.js +78 -39
  407. package/dist/Semaphore.js.map +1 -1
  408. package/dist/Sink.d.ts +117 -107
  409. package/dist/Sink.d.ts.map +1 -1
  410. package/dist/Sink.js +107 -100
  411. package/dist/Sink.js.map +1 -1
  412. package/dist/Stdio.d.ts +1 -1
  413. package/dist/Stdio.js.map +1 -1
  414. package/dist/Stream.d.ts +2415 -2949
  415. package/dist/Stream.d.ts.map +1 -1
  416. package/dist/Stream.js +1078 -1381
  417. package/dist/Stream.js.map +1 -1
  418. package/dist/String.d.ts +262 -308
  419. package/dist/String.d.ts.map +1 -1
  420. package/dist/String.js +184 -215
  421. package/dist/String.js.map +1 -1
  422. package/dist/Struct.d.ts +109 -114
  423. package/dist/Struct.d.ts.map +1 -1
  424. package/dist/Struct.js +41 -50
  425. package/dist/Struct.js.map +1 -1
  426. package/dist/SubscriptionRef.d.ts +282 -250
  427. package/dist/SubscriptionRef.d.ts.map +1 -1
  428. package/dist/SubscriptionRef.js +104 -92
  429. package/dist/SubscriptionRef.js.map +1 -1
  430. package/dist/Symbol.d.ts +3 -3
  431. package/dist/Symbol.js +3 -3
  432. package/dist/Symbol.js.map +1 -1
  433. package/dist/SynchronizedRef.js.map +1 -1
  434. package/dist/Take.js.map +1 -1
  435. package/dist/Terminal.d.ts +2 -2
  436. package/dist/Terminal.js +1 -1
  437. package/dist/Terminal.js.map +1 -1
  438. package/dist/Tracer.d.ts +100 -54
  439. package/dist/Tracer.d.ts.map +1 -1
  440. package/dist/Tracer.js +41 -24
  441. package/dist/Tracer.js.map +1 -1
  442. package/dist/Trie.d.ts +287 -679
  443. package/dist/Trie.d.ts.map +1 -1
  444. package/dist/Trie.js +109 -251
  445. package/dist/Trie.js.map +1 -1
  446. package/dist/Tuple.d.ts +92 -127
  447. package/dist/Tuple.d.ts.map +1 -1
  448. package/dist/Tuple.js +42 -57
  449. package/dist/Tuple.js.map +1 -1
  450. package/dist/TxChunk.d.ts +201 -121
  451. package/dist/TxChunk.d.ts.map +1 -1
  452. package/dist/TxChunk.js +85 -56
  453. package/dist/TxChunk.js.map +1 -1
  454. package/dist/TxDeferred.d.ts +62 -46
  455. package/dist/TxDeferred.d.ts.map +1 -1
  456. package/dist/TxDeferred.js +30 -22
  457. package/dist/TxDeferred.js.map +1 -1
  458. package/dist/TxHashMap.d.ts +631 -779
  459. package/dist/TxHashMap.d.ts.map +1 -1
  460. package/dist/TxHashMap.js +268 -330
  461. package/dist/TxHashMap.js.map +1 -1
  462. package/dist/TxHashSet.d.ts +297 -236
  463. package/dist/TxHashSet.d.ts.map +1 -1
  464. package/dist/TxHashSet.js +130 -100
  465. package/dist/TxHashSet.js.map +1 -1
  466. package/dist/TxPriorityQueue.d.ts +126 -95
  467. package/dist/TxPriorityQueue.d.ts.map +1 -1
  468. package/dist/TxPriorityQueue.js +74 -56
  469. package/dist/TxPriorityQueue.js.map +1 -1
  470. package/dist/TxPubSub.d.ts +101 -88
  471. package/dist/TxPubSub.d.ts.map +1 -1
  472. package/dist/TxPubSub.js +87 -66
  473. package/dist/TxPubSub.js.map +1 -1
  474. package/dist/TxQueue.d.ts +200 -180
  475. package/dist/TxQueue.d.ts.map +1 -1
  476. package/dist/TxQueue.js +160 -136
  477. package/dist/TxQueue.js.map +1 -1
  478. package/dist/TxReentrantLock.d.ts +97 -66
  479. package/dist/TxReentrantLock.d.ts.map +1 -1
  480. package/dist/TxReentrantLock.js +67 -45
  481. package/dist/TxReentrantLock.js.map +1 -1
  482. package/dist/TxRef.d.ts +51 -32
  483. package/dist/TxRef.d.ts.map +1 -1
  484. package/dist/TxRef.js +23 -15
  485. package/dist/TxRef.js.map +1 -1
  486. package/dist/TxSemaphore.d.ts +129 -95
  487. package/dist/TxSemaphore.d.ts.map +1 -1
  488. package/dist/TxSemaphore.js +85 -70
  489. package/dist/TxSemaphore.js.map +1 -1
  490. package/dist/TxSubscriptionRef.d.ts +97 -70
  491. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  492. package/dist/TxSubscriptionRef.js +44 -34
  493. package/dist/TxSubscriptionRef.js.map +1 -1
  494. package/dist/Types.d.ts +126 -67
  495. package/dist/Types.d.ts.map +1 -1
  496. package/dist/UndefinedOr.js.map +1 -1
  497. package/dist/Unify.d.ts +45 -65
  498. package/dist/Unify.d.ts.map +1 -1
  499. package/dist/Unify.js +6 -9
  500. package/dist/Unify.js.map +1 -1
  501. package/dist/Utils.d.ts +23 -16
  502. package/dist/Utils.d.ts.map +1 -1
  503. package/dist/Utils.js +3 -7
  504. package/dist/Utils.js.map +1 -1
  505. package/dist/index.js.map +1 -1
  506. package/dist/internal/array.js.map +1 -1
  507. package/dist/internal/core.js +1 -1
  508. package/dist/internal/core.js.map +1 -1
  509. package/dist/internal/dateTime.js +4 -0
  510. package/dist/internal/dateTime.js.map +1 -1
  511. package/dist/internal/doNotation.js.map +1 -1
  512. package/dist/internal/effect.js +77 -40
  513. package/dist/internal/effect.js.map +1 -1
  514. package/dist/internal/equal.js.map +1 -1
  515. package/dist/internal/errors.js.map +1 -1
  516. package/dist/internal/executionPlan.js.map +1 -1
  517. package/dist/internal/hashMap.js.map +1 -1
  518. package/dist/internal/hashSet.js.map +1 -1
  519. package/dist/internal/layer.js.map +1 -1
  520. package/dist/internal/matcher.js.map +1 -1
  521. package/dist/internal/metric.js.map +1 -1
  522. package/dist/internal/option.js.map +1 -1
  523. package/dist/internal/persistence.d.ts +2 -0
  524. package/dist/internal/persistence.d.ts.map +1 -0
  525. package/dist/internal/persistence.js +3 -0
  526. package/dist/internal/persistence.js.map +1 -0
  527. package/dist/internal/random.js.map +1 -1
  528. package/dist/internal/rcRef.js.map +1 -1
  529. package/dist/internal/record.js.map +1 -1
  530. package/dist/internal/redacted.js.map +1 -1
  531. package/dist/internal/references.js +3 -0
  532. package/dist/internal/references.js.map +1 -1
  533. package/dist/internal/request.js.map +1 -1
  534. package/dist/internal/result.js.map +1 -1
  535. package/dist/internal/schedule.js.map +1 -1
  536. package/dist/internal/schema/annotations.js.map +1 -1
  537. package/dist/internal/schema/cause.js.map +1 -1
  538. package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
  539. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  540. package/dist/internal/schema/fromRepresentation.js +8 -15
  541. package/dist/internal/schema/fromRepresentation.js.map +1 -1
  542. package/dist/internal/schema/parser.d.ts +14 -0
  543. package/dist/internal/schema/parser.d.ts.map +1 -0
  544. package/dist/internal/schema/parser.js +13 -0
  545. package/dist/internal/schema/parser.js.map +1 -0
  546. package/dist/internal/schema/schema.js.map +1 -1
  547. package/dist/internal/schema/toArbitrary.js.map +1 -1
  548. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  549. package/dist/internal/schema/toEquivalence.js.map +1 -1
  550. package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
  551. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  552. package/dist/internal/schema/toRepresentation.js +87 -107
  553. package/dist/internal/schema/toRepresentation.js.map +1 -1
  554. package/dist/internal/stackTraceLimit.js.map +1 -1
  555. package/dist/internal/stream.js.map +1 -1
  556. package/dist/internal/tracer.js.map +1 -1
  557. package/dist/internal/trie.js +13 -9
  558. package/dist/internal/trie.js.map +1 -1
  559. package/dist/testing/FastCheck.d.ts +8 -7
  560. package/dist/testing/FastCheck.d.ts.map +1 -1
  561. package/dist/testing/FastCheck.js +8 -7
  562. package/dist/testing/FastCheck.js.map +1 -1
  563. package/dist/testing/TestClock.d.ts +57 -28
  564. package/dist/testing/TestClock.d.ts.map +1 -1
  565. package/dist/testing/TestClock.js +50 -18
  566. package/dist/testing/TestClock.js.map +1 -1
  567. package/dist/testing/TestConsole.d.ts +32 -31
  568. package/dist/testing/TestConsole.d.ts.map +1 -1
  569. package/dist/testing/TestConsole.js +24 -22
  570. package/dist/testing/TestConsole.js.map +1 -1
  571. package/dist/testing/TestSchema.d.ts +29 -29
  572. package/dist/testing/TestSchema.js +25 -25
  573. package/dist/testing/TestSchema.js.map +1 -1
  574. package/dist/testing/index.js.map +1 -1
  575. package/dist/unstable/ai/AiError.d.ts +95 -118
  576. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  577. package/dist/unstable/ai/AiError.js +94 -117
  578. package/dist/unstable/ai/AiError.js.map +1 -1
  579. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  580. package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
  581. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  582. package/dist/unstable/ai/Chat.d.ts +132 -97
  583. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  584. package/dist/unstable/ai/Chat.js +55 -51
  585. package/dist/unstable/ai/Chat.js.map +1 -1
  586. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  587. package/dist/unstable/ai/IdGenerator.d.ts +32 -28
  588. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  589. package/dist/unstable/ai/IdGenerator.js +26 -21
  590. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  591. package/dist/unstable/ai/LanguageModel.d.ts +107 -67
  592. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  593. package/dist/unstable/ai/LanguageModel.js +104 -64
  594. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  595. package/dist/unstable/ai/McpProtocol.d.ts +30 -0
  596. package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
  597. package/dist/unstable/ai/McpProtocol.js +20 -0
  598. package/dist/unstable/ai/McpProtocol.js.map +1 -0
  599. package/dist/unstable/ai/McpSchema.d.ts +141 -75
  600. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  601. package/dist/unstable/ai/McpSchema.js +58 -50
  602. package/dist/unstable/ai/McpSchema.js.map +1 -1
  603. package/dist/unstable/ai/McpServer.d.ts +68 -59
  604. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  605. package/dist/unstable/ai/McpServer.js +694 -241
  606. package/dist/unstable/ai/McpServer.js.map +1 -1
  607. package/dist/unstable/ai/Model.d.ts +8 -19
  608. package/dist/unstable/ai/Model.d.ts.map +1 -1
  609. package/dist/unstable/ai/Model.js +9 -20
  610. package/dist/unstable/ai/Model.js.map +1 -1
  611. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  612. package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
  613. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  614. package/dist/unstable/ai/Prompt.d.ts +112 -38
  615. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  616. package/dist/unstable/ai/Prompt.js +53 -17
  617. package/dist/unstable/ai/Prompt.js.map +1 -1
  618. package/dist/unstable/ai/Response.d.ts +28 -14
  619. package/dist/unstable/ai/Response.d.ts.map +1 -1
  620. package/dist/unstable/ai/Response.js +9 -4
  621. package/dist/unstable/ai/Response.js.map +1 -1
  622. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  623. package/dist/unstable/ai/Telemetry.d.ts +46 -13
  624. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  625. package/dist/unstable/ai/Telemetry.js +18 -7
  626. package/dist/unstable/ai/Telemetry.js.map +1 -1
  627. package/dist/unstable/ai/Tokenizer.d.ts +14 -3
  628. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  629. package/dist/unstable/ai/Tokenizer.js +10 -2
  630. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  631. package/dist/unstable/ai/Tool.d.ts +59 -44
  632. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  633. package/dist/unstable/ai/Tool.js +48 -39
  634. package/dist/unstable/ai/Tool.js.map +1 -1
  635. package/dist/unstable/ai/Toolkit.d.ts +26 -8
  636. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  637. package/dist/unstable/ai/Toolkit.js +18 -4
  638. package/dist/unstable/ai/Toolkit.js.map +1 -1
  639. package/dist/unstable/ai/index.d.ts +4 -0
  640. package/dist/unstable/ai/index.d.ts.map +1 -1
  641. package/dist/unstable/ai/index.js +4 -0
  642. package/dist/unstable/ai/index.js.map +1 -1
  643. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  644. package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
  645. package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
  646. package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
  647. package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
  648. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
  649. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
  650. package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
  651. package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
  652. package/dist/unstable/ai/internal/structured-output.js +14 -15
  653. package/dist/unstable/ai/internal/structured-output.js.map +1 -1
  654. package/dist/unstable/cli/Argument.d.ts +273 -69
  655. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  656. package/dist/unstable/cli/Argument.js +111 -33
  657. package/dist/unstable/cli/Argument.js.map +1 -1
  658. package/dist/unstable/cli/CliConfig.js.map +1 -1
  659. package/dist/unstable/cli/CliError.d.ts +69 -76
  660. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  661. package/dist/unstable/cli/CliError.js +57 -61
  662. package/dist/unstable/cli/CliError.js.map +1 -1
  663. package/dist/unstable/cli/CliOutput.d.ts +35 -54
  664. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  665. package/dist/unstable/cli/CliOutput.js +26 -42
  666. package/dist/unstable/cli/CliOutput.js.map +1 -1
  667. package/dist/unstable/cli/Command.d.ts +705 -107
  668. package/dist/unstable/cli/Command.d.ts.map +1 -1
  669. package/dist/unstable/cli/Command.js +238 -42
  670. package/dist/unstable/cli/Command.js.map +1 -1
  671. package/dist/unstable/cli/Completions.js.map +1 -1
  672. package/dist/unstable/cli/Flag.d.ts +418 -138
  673. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  674. package/dist/unstable/cli/Flag.js +197 -71
  675. package/dist/unstable/cli/Flag.js.map +1 -1
  676. package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
  677. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  678. package/dist/unstable/cli/HelpDoc.d.ts +12 -4
  679. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  680. package/dist/unstable/cli/Param.d.ts +292 -78
  681. package/dist/unstable/cli/Param.d.ts.map +1 -1
  682. package/dist/unstable/cli/Param.js +128 -46
  683. package/dist/unstable/cli/Param.js.map +1 -1
  684. package/dist/unstable/cli/Primitive.d.ts +370 -149
  685. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  686. package/dist/unstable/cli/Primitive.js +344 -136
  687. package/dist/unstable/cli/Primitive.js.map +1 -1
  688. package/dist/unstable/cli/Prompt.d.ts +23 -14
  689. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  690. package/dist/unstable/cli/Prompt.js +23 -14
  691. package/dist/unstable/cli/Prompt.js.map +1 -1
  692. package/dist/unstable/cli/index.js.map +1 -1
  693. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  694. package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
  695. package/dist/unstable/cli/internal/command.js.map +1 -1
  696. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  697. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  698. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  699. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  700. package/dist/unstable/cli/internal/config.js.map +1 -1
  701. package/dist/unstable/cli/internal/help.js.map +1 -1
  702. package/dist/unstable/cli/internal/lexer.js +17 -7
  703. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  704. package/dist/unstable/cli/internal/parser.js +2 -2
  705. package/dist/unstable/cli/internal/parser.js.map +1 -1
  706. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  707. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  708. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  709. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  710. package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
  711. package/dist/unstable/cluster/ClusterSchema.js +8 -8
  712. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  713. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  714. package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
  715. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  716. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  717. package/dist/unstable/cluster/Entity.d.ts +10 -10
  718. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  719. package/dist/unstable/cluster/Entity.js +8 -8
  720. package/dist/unstable/cluster/Entity.js.map +1 -1
  721. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  722. package/dist/unstable/cluster/EntityId.js.map +1 -1
  723. package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
  724. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  725. package/dist/unstable/cluster/EntityProxy.js +4 -2
  726. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  727. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  728. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  729. package/dist/unstable/cluster/EntityResource.js +2 -2
  730. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  731. package/dist/unstable/cluster/EntityType.js.map +1 -1
  732. package/dist/unstable/cluster/Envelope.d.ts +3 -3
  733. package/dist/unstable/cluster/Envelope.js +3 -3
  734. package/dist/unstable/cluster/Envelope.js.map +1 -1
  735. package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
  736. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  737. package/dist/unstable/cluster/HttpRunner.js +6 -4
  738. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  739. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  740. package/dist/unstable/cluster/MachineId.js.map +1 -1
  741. package/dist/unstable/cluster/Message.d.ts +9 -9
  742. package/dist/unstable/cluster/Message.js +6 -6
  743. package/dist/unstable/cluster/Message.js.map +1 -1
  744. package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
  745. package/dist/unstable/cluster/MessageStorage.js +5 -5
  746. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  747. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  748. package/dist/unstable/cluster/Reply.js +4 -4
  749. package/dist/unstable/cluster/Reply.js.map +1 -1
  750. package/dist/unstable/cluster/Runner.js.map +1 -1
  751. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  752. package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
  753. package/dist/unstable/cluster/RunnerHealth.js +1 -1
  754. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  755. package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
  756. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  757. package/dist/unstable/cluster/RunnerServer.js +16 -16
  758. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  759. package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
  760. package/dist/unstable/cluster/RunnerStorage.js +1 -1
  761. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  762. package/dist/unstable/cluster/Runners.d.ts +6 -6
  763. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  764. package/dist/unstable/cluster/Runners.js +19 -10
  765. package/dist/unstable/cluster/Runners.js.map +1 -1
  766. package/dist/unstable/cluster/ShardId.js.map +1 -1
  767. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  768. package/dist/unstable/cluster/Sharding.js +3 -2
  769. package/dist/unstable/cluster/Sharding.js.map +1 -1
  770. package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
  771. package/dist/unstable/cluster/ShardingConfig.js +3 -3
  772. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  773. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  774. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  775. package/dist/unstable/cluster/Singleton.js.map +1 -1
  776. package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
  777. package/dist/unstable/cluster/SingletonAddress.js +1 -1
  778. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  779. package/dist/unstable/cluster/Snowflake.d.ts +8 -8
  780. package/dist/unstable/cluster/Snowflake.js +8 -8
  781. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  782. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  783. package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
  784. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  785. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  786. package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
  787. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  788. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  789. package/dist/unstable/cluster/index.js.map +1 -1
  790. package/dist/unstable/cluster/internal/entityManager.js +5 -5
  791. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  792. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  793. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  794. package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
  795. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  796. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  797. package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
  798. package/dist/unstable/devtools/DevTools.js.map +1 -1
  799. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  800. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  801. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  802. package/dist/unstable/devtools/index.js.map +1 -1
  803. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  804. package/dist/unstable/encoding/Msgpack.js +6 -8
  805. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  806. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  807. package/dist/unstable/encoding/Sse.d.ts +72 -8
  808. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  809. package/dist/unstable/encoding/Sse.js +58 -8
  810. package/dist/unstable/encoding/Sse.js.map +1 -1
  811. package/dist/unstable/encoding/index.js.map +1 -1
  812. package/dist/unstable/eventlog/Event.d.ts +20 -20
  813. package/dist/unstable/eventlog/Event.js.map +1 -1
  814. package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
  815. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  816. package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
  817. package/dist/unstable/eventlog/EventJournal.js +13 -13
  818. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  819. package/dist/unstable/eventlog/EventLog.d.ts +3 -3
  820. package/dist/unstable/eventlog/EventLog.js +3 -3
  821. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  822. package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
  823. package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
  824. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  825. package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
  826. package/dist/unstable/eventlog/EventLogMessage.js +1 -1
  827. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  828. package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
  829. package/dist/unstable/eventlog/EventLogRemote.js +1 -1
  830. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  831. package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
  832. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  833. package/dist/unstable/eventlog/EventLogServer.js +45 -21
  834. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  835. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
  836. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  837. package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
  838. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  839. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
  840. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  841. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
  842. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  843. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
  844. package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
  845. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  846. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  847. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  848. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  849. package/dist/unstable/eventlog/index.js.map +1 -1
  850. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
  851. package/dist/unstable/http/Cookies.d.ts +2 -2
  852. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  853. package/dist/unstable/http/Cookies.js +30 -18
  854. package/dist/unstable/http/Cookies.js.map +1 -1
  855. package/dist/unstable/http/Etag.d.ts +1 -1
  856. package/dist/unstable/http/Etag.js +1 -1
  857. package/dist/unstable/http/Etag.js.map +1 -1
  858. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  859. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  860. package/dist/unstable/http/Headers.d.ts +2 -2
  861. package/dist/unstable/http/Headers.js +2 -2
  862. package/dist/unstable/http/Headers.js.map +1 -1
  863. package/dist/unstable/http/HttpBody.d.ts +5 -3
  864. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  865. package/dist/unstable/http/HttpBody.js +11 -5
  866. package/dist/unstable/http/HttpBody.js.map +1 -1
  867. package/dist/unstable/http/HttpClient.d.ts +51 -44
  868. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  869. package/dist/unstable/http/HttpClient.js +46 -17
  870. package/dist/unstable/http/HttpClient.js.map +1 -1
  871. package/dist/unstable/http/HttpClientError.js.map +1 -1
  872. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  873. package/dist/unstable/http/HttpClientRequest.js +2 -0
  874. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  875. package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
  876. package/dist/unstable/http/HttpClientResponse.js +2 -2
  877. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  878. package/dist/unstable/http/HttpEffect.d.ts +6 -6
  879. package/dist/unstable/http/HttpEffect.js +3 -3
  880. package/dist/unstable/http/HttpEffect.js.map +1 -1
  881. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  882. package/dist/unstable/http/HttpMethod.d.ts +6 -9
  883. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  884. package/dist/unstable/http/HttpMethod.js +6 -9
  885. package/dist/unstable/http/HttpMethod.js.map +1 -1
  886. package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
  887. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  888. package/dist/unstable/http/HttpMiddleware.js +164 -39
  889. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  890. package/dist/unstable/http/HttpPlatform.d.ts +76 -0
  891. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  892. package/dist/unstable/http/HttpPlatform.js +32 -0
  893. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  894. package/dist/unstable/http/HttpRouter.d.ts +88 -89
  895. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  896. package/dist/unstable/http/HttpRouter.js +78 -79
  897. package/dist/unstable/http/HttpRouter.js.map +1 -1
  898. package/dist/unstable/http/HttpServer.d.ts +13 -13
  899. package/dist/unstable/http/HttpServer.js +6 -6
  900. package/dist/unstable/http/HttpServer.js.map +1 -1
  901. package/dist/unstable/http/HttpServerError.d.ts +2 -2
  902. package/dist/unstable/http/HttpServerError.js +2 -2
  903. package/dist/unstable/http/HttpServerError.js.map +1 -1
  904. package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
  905. package/dist/unstable/http/HttpServerRequest.js +4 -4
  906. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  907. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  908. package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
  909. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  910. package/dist/unstable/http/HttpServerResponse.js +10 -0
  911. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  912. package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
  913. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  914. package/dist/unstable/http/HttpStaticServer.js +35 -7
  915. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  916. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  917. package/dist/unstable/http/Multipart.d.ts +6 -6
  918. package/dist/unstable/http/Multipart.js +5 -5
  919. package/dist/unstable/http/Multipart.js.map +1 -1
  920. package/dist/unstable/http/Template.js.map +1 -1
  921. package/dist/unstable/http/Url.d.ts +33 -63
  922. package/dist/unstable/http/Url.d.ts.map +1 -1
  923. package/dist/unstable/http/Url.js +14 -28
  924. package/dist/unstable/http/Url.js.map +1 -1
  925. package/dist/unstable/http/UrlParams.d.ts +10 -18
  926. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  927. package/dist/unstable/http/UrlParams.js +9 -17
  928. package/dist/unstable/http/UrlParams.js.map +1 -1
  929. package/dist/unstable/http/index.js.map +1 -1
  930. package/dist/unstable/http/internal/compression.d.ts +2 -0
  931. package/dist/unstable/http/internal/compression.d.ts.map +1 -0
  932. package/dist/unstable/http/internal/compression.js +155 -0
  933. package/dist/unstable/http/internal/compression.js.map +1 -0
  934. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
  935. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  936. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
  937. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  938. package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
  939. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  940. package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
  941. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  942. package/dist/unstable/httpapi/HttpApiClient.js +11 -13
  943. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  944. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
  945. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  946. package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
  947. package/dist/unstable/httpapi/HttpApiError.js +13 -13
  948. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  949. package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
  950. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  951. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
  952. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  953. package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
  954. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  955. package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
  956. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  957. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  958. package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
  959. package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
  960. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  961. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  962. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  963. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  964. package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
  965. package/dist/unstable/httpapi/OpenApi.js +13 -13
  966. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  967. package/dist/unstable/httpapi/index.js.map +1 -1
  968. package/dist/unstable/httpapi/internal/html.js.map +1 -1
  969. package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
  970. package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
  971. package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
  972. package/dist/unstable/observability/Otlp.js.map +1 -1
  973. package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
  974. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  975. package/dist/unstable/observability/OtlpExporter.js +17 -4
  976. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  977. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  978. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
  979. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  980. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  981. package/dist/unstable/observability/OtlpResource.d.ts +16 -7
  982. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  983. package/dist/unstable/observability/OtlpResource.js +21 -12
  984. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  985. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  986. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  987. package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
  988. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  989. package/dist/unstable/observability/PrometheusMetrics.js +10 -3
  990. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  991. package/dist/unstable/observability/index.js.map +1 -1
  992. package/dist/unstable/observability/internal/otlpEnv.js +1 -1
  993. package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
  994. package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
  995. package/dist/unstable/observability/internal/protobuf.js +3 -0
  996. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  997. package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
  998. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  999. package/dist/unstable/persistence/KeyValueStore.js +22 -13
  1000. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1001. package/dist/unstable/persistence/Persistable.d.ts +8 -8
  1002. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1003. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1004. package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
  1005. package/dist/unstable/persistence/PersistedQueue.js +6 -6
  1006. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1007. package/dist/unstable/persistence/Persistence.d.ts +3 -3
  1008. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1009. package/dist/unstable/persistence/Persistence.js +91 -15
  1010. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1011. package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
  1012. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1013. package/dist/unstable/persistence/RateLimiter.js +24 -13
  1014. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1015. package/dist/unstable/persistence/Redis.d.ts +2 -2
  1016. package/dist/unstable/persistence/Redis.js +1 -1
  1017. package/dist/unstable/persistence/Redis.js.map +1 -1
  1018. package/dist/unstable/persistence/index.js.map +1 -1
  1019. package/dist/unstable/process/ChildProcess.d.ts +64 -21
  1020. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1021. package/dist/unstable/process/ChildProcess.js +14 -5
  1022. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1023. package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
  1024. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1025. package/dist/unstable/process/ChildProcessSpawner.js +1 -1
  1026. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1027. package/dist/unstable/process/index.js.map +1 -1
  1028. package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
  1029. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1030. package/dist/unstable/reactivity/AsyncResult.js +10 -10
  1031. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1032. package/dist/unstable/reactivity/Atom.d.ts +25 -22
  1033. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1034. package/dist/unstable/reactivity/Atom.js +14 -13
  1035. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1036. package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
  1037. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1038. package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
  1039. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1040. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1041. package/dist/unstable/reactivity/AtomRegistry.js +24 -3
  1042. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1043. package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
  1044. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1045. package/dist/unstable/reactivity/AtomRpc.js +4 -1
  1046. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1047. package/dist/unstable/reactivity/Hydration.d.ts +1 -1
  1048. package/dist/unstable/reactivity/Hydration.js +1 -1
  1049. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1050. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1051. package/dist/unstable/reactivity/index.js.map +1 -1
  1052. package/dist/unstable/rpc/Rpc.d.ts +35 -33
  1053. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1054. package/dist/unstable/rpc/Rpc.js +4 -2
  1055. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1056. package/dist/unstable/rpc/RpcClient.d.ts +12 -12
  1057. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1058. package/dist/unstable/rpc/RpcClient.js +12 -11
  1059. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1060. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1061. package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
  1062. package/dist/unstable/rpc/RpcGroup.js +1 -1
  1063. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1064. package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
  1065. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1066. package/dist/unstable/rpc/RpcMessage.js +6 -6
  1067. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1068. package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
  1069. package/dist/unstable/rpc/RpcMiddleware.js +1 -1
  1070. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1071. package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
  1072. package/dist/unstable/rpc/RpcSchema.js +3 -3
  1073. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1074. package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
  1075. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1076. package/dist/unstable/rpc/RpcSerialization.js +175 -96
  1077. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1078. package/dist/unstable/rpc/RpcServer.d.ts +13 -13
  1079. package/dist/unstable/rpc/RpcServer.js +17 -13
  1080. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1081. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1082. package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
  1083. package/dist/unstable/rpc/RpcWorker.js +4 -4
  1084. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1085. package/dist/unstable/rpc/Utils.js.map +1 -1
  1086. package/dist/unstable/rpc/index.js.map +1 -1
  1087. package/dist/unstable/schema/Model.d.ts +52 -50
  1088. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1089. package/dist/unstable/schema/Model.js +35 -33
  1090. package/dist/unstable/schema/Model.js.map +1 -1
  1091. package/dist/unstable/schema/VariantSchema.d.ts +5 -5
  1092. package/dist/unstable/schema/VariantSchema.js +2 -2
  1093. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1094. package/dist/unstable/schema/index.js.map +1 -1
  1095. package/dist/unstable/socket/Socket.d.ts +11 -3
  1096. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1097. package/dist/unstable/socket/Socket.js +9 -4
  1098. package/dist/unstable/socket/Socket.js.map +1 -1
  1099. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1100. package/dist/unstable/socket/index.js.map +1 -1
  1101. package/dist/unstable/sql/Migrator.js.map +1 -1
  1102. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  1103. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1104. package/dist/unstable/sql/SqlClient.js +2 -2
  1105. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1106. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1107. package/dist/unstable/sql/SqlError.js.map +1 -1
  1108. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  1109. package/dist/unstable/sql/SqlModel.js +2 -2
  1110. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1111. package/dist/unstable/sql/SqlResolver.d.ts +5 -5
  1112. package/dist/unstable/sql/SqlResolver.js +2 -2
  1113. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1114. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1115. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1116. package/dist/unstable/sql/Statement.d.ts +6 -6
  1117. package/dist/unstable/sql/Statement.js +15 -15
  1118. package/dist/unstable/sql/Statement.js.map +1 -1
  1119. package/dist/unstable/sql/index.js.map +1 -1
  1120. package/dist/unstable/workers/Transferable.d.ts +1 -1
  1121. package/dist/unstable/workers/Transferable.js +1 -1
  1122. package/dist/unstable/workers/Transferable.js.map +1 -1
  1123. package/dist/unstable/workers/Worker.d.ts +2 -2
  1124. package/dist/unstable/workers/Worker.js +2 -2
  1125. package/dist/unstable/workers/Worker.js.map +1 -1
  1126. package/dist/unstable/workers/WorkerError.d.ts +7 -7
  1127. package/dist/unstable/workers/WorkerError.js +6 -6
  1128. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1129. package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
  1130. package/dist/unstable/workers/WorkerRunner.js +1 -1
  1131. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1132. package/dist/unstable/workers/index.js.map +1 -1
  1133. package/dist/unstable/workflow/Activity.d.ts +2 -2
  1134. package/dist/unstable/workflow/Activity.js +2 -2
  1135. package/dist/unstable/workflow/Activity.js.map +1 -1
  1136. package/dist/unstable/workflow/DurableClock.d.ts +1 -1
  1137. package/dist/unstable/workflow/DurableClock.js +1 -1
  1138. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1139. package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
  1140. package/dist/unstable/workflow/DurableDeferred.js +5 -5
  1141. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1142. package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
  1143. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  1144. package/dist/unstable/workflow/DurableQueue.js +22 -20
  1145. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  1146. package/dist/unstable/workflow/Workflow.d.ts +21 -21
  1147. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1148. package/dist/unstable/workflow/Workflow.js +13 -14
  1149. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1150. package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
  1151. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1152. package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
  1153. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1154. package/dist/unstable/workflow/WorkflowProxy.js +4 -2
  1155. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1156. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1157. package/dist/unstable/workflow/index.js.map +1 -1
  1158. package/dist/unstable/workflow/internal/crypto.js.map +1 -1
  1159. package/package.json +5 -6
  1160. package/src/Array.ts +982 -1045
  1161. package/src/BigDecimal.ts +433 -756
  1162. package/src/BigInt.ts +213 -269
  1163. package/src/Boolean.ts +146 -188
  1164. package/src/Cache.ts +409 -255
  1165. package/src/Cause.ts +167 -277
  1166. package/src/Channel.ts +891 -816
  1167. package/src/ChannelSchema.ts +1 -1
  1168. package/src/Chunk.ts +841 -1181
  1169. package/src/Clock.ts +181 -49
  1170. package/src/Combiner.ts +20 -33
  1171. package/src/Config.ts +615 -332
  1172. package/src/ConfigProvider.ts +214 -120
  1173. package/src/Console.ts +289 -39
  1174. package/src/Context.ts +319 -378
  1175. package/src/Cron.ts +68 -77
  1176. package/src/Crypto.ts +13 -15
  1177. package/src/Data.ts +60 -80
  1178. package/src/DateTime.ts +564 -660
  1179. package/src/Deferred.ts +253 -256
  1180. package/src/Duration.ts +216 -308
  1181. package/src/Effect.ts +2893 -3279
  1182. package/src/Encoding.ts +22 -40
  1183. package/src/Equal.ts +49 -39
  1184. package/src/Equivalence.ts +103 -105
  1185. package/src/ErrorReporter.ts +51 -27
  1186. package/src/ExecutionPlan.ts +13 -55
  1187. package/src/Exit.ts +116 -192
  1188. package/src/Fiber.ts +81 -148
  1189. package/src/FiberHandle.ts +152 -105
  1190. package/src/FiberMap.ts +225 -174
  1191. package/src/FiberSet.ts +124 -82
  1192. package/src/FileSystem.ts +155 -263
  1193. package/src/Filter.ts +61 -33
  1194. package/src/Formatter.ts +54 -56
  1195. package/src/Function.ts +76 -145
  1196. package/src/Graph.ts +416 -770
  1197. package/src/HKT.ts +12 -6
  1198. package/src/Hash.ts +52 -83
  1199. package/src/HashMap.ts +319 -411
  1200. package/src/HashRing.ts +1 -0
  1201. package/src/HashSet.ts +177 -284
  1202. package/src/Inspectable.ts +12 -12
  1203. package/src/Iterable.ts +620 -786
  1204. package/src/JsonPatch.ts +58 -112
  1205. package/src/JsonPointer.ts +8 -8
  1206. package/src/JsonSchema.ts +402 -244
  1207. package/src/Latch.ts +23 -35
  1208. package/src/Layer.ts +359 -260
  1209. package/src/LayerMap.ts +49 -29
  1210. package/src/LayerRef.ts +6 -2
  1211. package/src/LogLevel.ts +114 -214
  1212. package/src/Logger.ts +344 -697
  1213. package/src/ManagedRuntime.ts +7 -5
  1214. package/src/Match.ts +217 -252
  1215. package/src/Metric.ts +516 -1089
  1216. package/src/MutableHashMap.ts +218 -255
  1217. package/src/MutableHashSet.ts +84 -89
  1218. package/src/MutableList.ts +73 -370
  1219. package/src/MutableRef.ts +420 -243
  1220. package/src/Newtype.ts +21 -14
  1221. package/src/NonEmptyIterable.ts +7 -137
  1222. package/src/Number.ts +196 -233
  1223. package/src/Optic.ts +243 -383
  1224. package/src/Option.ts +447 -812
  1225. package/src/Order.ts +109 -109
  1226. package/src/Ordering.ts +20 -23
  1227. package/src/Path.ts +38 -41
  1228. package/src/Pipeable.ts +6 -5
  1229. package/src/PlatformError.ts +4 -4
  1230. package/src/Pool.ts +4 -2
  1231. package/src/Predicate.ts +200 -181
  1232. package/src/PrimaryKey.ts +7 -7
  1233. package/src/PubSub.ts +526 -552
  1234. package/src/Pull.ts +24 -18
  1235. package/src/Queue.ts +200 -159
  1236. package/src/Random.ts +49 -74
  1237. package/src/RcMap.ts +121 -63
  1238. package/src/RcRef.ts +24 -13
  1239. package/src/Record.ts +291 -488
  1240. package/src/Redactable.ts +10 -3
  1241. package/src/Redacted.ts +25 -25
  1242. package/src/Reducer.ts +8 -15
  1243. package/src/Ref.ts +221 -361
  1244. package/src/References.ts +102 -168
  1245. package/src/RegExp.ts +10 -14
  1246. package/src/Request.ts +31 -21
  1247. package/src/RequestResolver.ts +202 -91
  1248. package/src/Result.ts +312 -484
  1249. package/src/Runtime.ts +50 -75
  1250. package/src/Schedule.ts +308 -1734
  1251. package/src/Scheduler.ts +20 -7
  1252. package/src/Schema.ts +716 -745
  1253. package/src/SchemaAST.ts +466 -358
  1254. package/src/SchemaError.ts +7 -6
  1255. package/src/SchemaGetter.ts +242 -190
  1256. package/src/SchemaIssue.ts +89 -275
  1257. package/src/SchemaParser.ts +180 -93
  1258. package/src/SchemaRepresentation.ts +22 -40
  1259. package/src/SchemaTransformation.ts +129 -88
  1260. package/src/Scope.ts +123 -151
  1261. package/src/ScopedRef.ts +4 -4
  1262. package/src/Semaphore.ts +152 -51
  1263. package/src/Sink.ts +128 -113
  1264. package/src/Stdio.ts +1 -1
  1265. package/src/Stream.ts +2602 -3123
  1266. package/src/String.ts +275 -312
  1267. package/src/Struct.ts +109 -114
  1268. package/src/SubscriptionRef.ts +284 -252
  1269. package/src/Symbol.ts +3 -3
  1270. package/src/Terminal.ts +2 -2
  1271. package/src/Tracer.ts +102 -55
  1272. package/src/Trie.ts +287 -679
  1273. package/src/Tuple.ts +92 -127
  1274. package/src/TxChunk.ts +201 -121
  1275. package/src/TxDeferred.ts +62 -46
  1276. package/src/TxHashMap.ts +645 -799
  1277. package/src/TxHashSet.ts +443 -356
  1278. package/src/TxPriorityQueue.ts +130 -98
  1279. package/src/TxPubSub.ts +107 -80
  1280. package/src/TxQueue.ts +214 -183
  1281. package/src/TxReentrantLock.ts +97 -66
  1282. package/src/TxRef.ts +51 -32
  1283. package/src/TxSemaphore.ts +129 -95
  1284. package/src/TxSubscriptionRef.ts +97 -70
  1285. package/src/Types.ts +126 -67
  1286. package/src/Unify.ts +45 -65
  1287. package/src/Utils.ts +23 -16
  1288. package/src/internal/core.ts +2 -2
  1289. package/src/internal/dateTime.ts +6 -0
  1290. package/src/internal/effect.ts +93 -48
  1291. package/src/internal/persistence.ts +2 -0
  1292. package/src/internal/references.ts +3 -2
  1293. package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
  1294. package/src/internal/schema/fromRepresentation.ts +10 -16
  1295. package/src/internal/schema/parser.ts +22 -0
  1296. package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
  1297. package/src/internal/schema/toRepresentation.ts +104 -119
  1298. package/src/internal/trie.ts +10 -11
  1299. package/src/testing/FastCheck.ts +8 -7
  1300. package/src/testing/TestClock.ts +72 -30
  1301. package/src/testing/TestConsole.ts +32 -31
  1302. package/src/testing/TestSchema.ts +29 -29
  1303. package/src/unstable/ai/AiError.ts +95 -118
  1304. package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
  1305. package/src/unstable/ai/Chat.ts +132 -97
  1306. package/src/unstable/ai/IdGenerator.ts +32 -28
  1307. package/src/unstable/ai/LanguageModel.ts +107 -67
  1308. package/src/unstable/ai/McpProtocol.ts +48 -0
  1309. package/src/unstable/ai/McpSchema.ts +60 -50
  1310. package/src/unstable/ai/McpServer.ts +930 -304
  1311. package/src/unstable/ai/Model.ts +9 -20
  1312. package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
  1313. package/src/unstable/ai/Prompt.ts +145 -43
  1314. package/src/unstable/ai/Response.ts +28 -14
  1315. package/src/unstable/ai/Telemetry.ts +46 -13
  1316. package/src/unstable/ai/Tokenizer.ts +14 -3
  1317. package/src/unstable/ai/Tool.ts +59 -44
  1318. package/src/unstable/ai/Toolkit.ts +26 -8
  1319. package/src/unstable/ai/index.ts +5 -0
  1320. package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
  1321. package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
  1322. package/src/unstable/ai/internal/structured-output.ts +13 -18
  1323. package/src/unstable/cli/Argument.ts +273 -69
  1324. package/src/unstable/cli/CliError.ts +69 -76
  1325. package/src/unstable/cli/CliOutput.ts +44 -58
  1326. package/src/unstable/cli/Command.ts +705 -107
  1327. package/src/unstable/cli/Flag.ts +418 -138
  1328. package/src/unstable/cli/GlobalFlag.ts +1 -1
  1329. package/src/unstable/cli/HelpDoc.ts +12 -4
  1330. package/src/unstable/cli/Param.ts +292 -78
  1331. package/src/unstable/cli/Primitive.ts +370 -149
  1332. package/src/unstable/cli/Prompt.ts +28 -14
  1333. package/src/unstable/cli/internal/lexer.ts +8 -2
  1334. package/src/unstable/cli/internal/parser.ts +2 -2
  1335. package/src/unstable/cluster/ClusterSchema.ts +8 -8
  1336. package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
  1337. package/src/unstable/cluster/Entity.ts +15 -16
  1338. package/src/unstable/cluster/EntityProxy.ts +4 -2
  1339. package/src/unstable/cluster/EntityResource.ts +2 -2
  1340. package/src/unstable/cluster/Envelope.ts +3 -3
  1341. package/src/unstable/cluster/HttpRunner.ts +6 -4
  1342. package/src/unstable/cluster/Message.ts +9 -9
  1343. package/src/unstable/cluster/MessageStorage.ts +15 -15
  1344. package/src/unstable/cluster/Reply.ts +4 -6
  1345. package/src/unstable/cluster/RunnerHealth.ts +1 -1
  1346. package/src/unstable/cluster/RunnerServer.ts +41 -8
  1347. package/src/unstable/cluster/RunnerStorage.ts +2 -2
  1348. package/src/unstable/cluster/Runners.ts +23 -12
  1349. package/src/unstable/cluster/Sharding.ts +7 -8
  1350. package/src/unstable/cluster/ShardingConfig.ts +3 -3
  1351. package/src/unstable/cluster/SingletonAddress.ts +1 -1
  1352. package/src/unstable/cluster/Snowflake.ts +8 -8
  1353. package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
  1354. package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
  1355. package/src/unstable/cluster/internal/entityManager.ts +11 -15
  1356. package/src/unstable/encoding/Msgpack.ts +6 -8
  1357. package/src/unstable/encoding/Sse.ts +98 -16
  1358. package/src/unstable/eventlog/Event.ts +20 -20
  1359. package/src/unstable/eventlog/EventGroup.ts +4 -4
  1360. package/src/unstable/eventlog/EventJournal.ts +15 -15
  1361. package/src/unstable/eventlog/EventLog.ts +3 -3
  1362. package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
  1363. package/src/unstable/eventlog/EventLogMessage.ts +2 -2
  1364. package/src/unstable/eventlog/EventLogRemote.ts +1 -1
  1365. package/src/unstable/eventlog/EventLogServer.ts +41 -7
  1366. package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
  1367. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
  1368. package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
  1369. package/src/unstable/http/Cookies.ts +35 -21
  1370. package/src/unstable/http/Etag.ts +1 -1
  1371. package/src/unstable/http/FetchHttpClient.ts +3 -1
  1372. package/src/unstable/http/Headers.ts +2 -2
  1373. package/src/unstable/http/HttpBody.ts +20 -5
  1374. package/src/unstable/http/HttpClient.ts +83 -55
  1375. package/src/unstable/http/HttpClientRequest.ts +2 -0
  1376. package/src/unstable/http/HttpClientResponse.ts +4 -4
  1377. package/src/unstable/http/HttpEffect.ts +8 -8
  1378. package/src/unstable/http/HttpMethod.ts +6 -9
  1379. package/src/unstable/http/HttpMiddleware.ts +202 -39
  1380. package/src/unstable/http/HttpPlatform.ts +95 -0
  1381. package/src/unstable/http/HttpRouter.ts +102 -98
  1382. package/src/unstable/http/HttpServer.ts +13 -13
  1383. package/src/unstable/http/HttpServerError.ts +2 -2
  1384. package/src/unstable/http/HttpServerRequest.ts +4 -4
  1385. package/src/unstable/http/HttpServerResponse.ts +30 -0
  1386. package/src/unstable/http/HttpStaticServer.ts +35 -7
  1387. package/src/unstable/http/Multipart.ts +6 -6
  1388. package/src/unstable/http/Url.ts +33 -63
  1389. package/src/unstable/http/UrlParams.ts +10 -18
  1390. package/src/unstable/http/internal/compression.ts +196 -0
  1391. package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
  1392. package/src/unstable/httpapi/HttpApiClient.ts +14 -14
  1393. package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
  1394. package/src/unstable/httpapi/HttpApiError.ts +13 -13
  1395. package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
  1396. package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
  1397. package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
  1398. package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
  1399. package/src/unstable/httpapi/OpenApi.ts +13 -13
  1400. package/src/unstable/observability/OtlpExporter.ts +31 -19
  1401. package/src/unstable/observability/OtlpMetrics.ts +4 -1
  1402. package/src/unstable/observability/OtlpResource.ts +26 -17
  1403. package/src/unstable/observability/PrometheusMetrics.ts +13 -4
  1404. package/src/unstable/observability/internal/otlpEnv.ts +1 -1
  1405. package/src/unstable/observability/internal/protobuf.ts +3 -0
  1406. package/src/unstable/persistence/KeyValueStore.ts +72 -49
  1407. package/src/unstable/persistence/Persistable.ts +8 -8
  1408. package/src/unstable/persistence/PersistedQueue.ts +6 -6
  1409. package/src/unstable/persistence/Persistence.ts +126 -19
  1410. package/src/unstable/persistence/RateLimiter.ts +26 -15
  1411. package/src/unstable/persistence/Redis.ts +2 -2
  1412. package/src/unstable/process/ChildProcess.ts +64 -21
  1413. package/src/unstable/process/ChildProcessSpawner.ts +21 -10
  1414. package/src/unstable/reactivity/AsyncResult.ts +12 -13
  1415. package/src/unstable/reactivity/Atom.ts +28 -25
  1416. package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
  1417. package/src/unstable/reactivity/AtomRegistry.ts +24 -3
  1418. package/src/unstable/reactivity/AtomRpc.ts +5 -4
  1419. package/src/unstable/reactivity/Hydration.ts +1 -1
  1420. package/src/unstable/rpc/Rpc.ts +35 -33
  1421. package/src/unstable/rpc/RpcClient.ts +16 -15
  1422. package/src/unstable/rpc/RpcGroup.ts +8 -8
  1423. package/src/unstable/rpc/RpcMessage.ts +31 -30
  1424. package/src/unstable/rpc/RpcMiddleware.ts +10 -10
  1425. package/src/unstable/rpc/RpcSchema.ts +4 -4
  1426. package/src/unstable/rpc/RpcSerialization.ts +167 -68
  1427. package/src/unstable/rpc/RpcServer.ts +18 -15
  1428. package/src/unstable/rpc/RpcWorker.ts +5 -5
  1429. package/src/unstable/schema/Model.ts +52 -50
  1430. package/src/unstable/schema/VariantSchema.ts +5 -5
  1431. package/src/unstable/socket/Socket.ts +17 -4
  1432. package/src/unstable/sql/SqlClient.ts +5 -6
  1433. package/src/unstable/sql/SqlModel.ts +2 -2
  1434. package/src/unstable/sql/SqlResolver.ts +5 -5
  1435. package/src/unstable/sql/Statement.ts +24 -23
  1436. package/src/unstable/workers/Transferable.ts +1 -1
  1437. package/src/unstable/workers/Worker.ts +2 -2
  1438. package/src/unstable/workers/WorkerError.ts +7 -7
  1439. package/src/unstable/workers/WorkerRunner.ts +1 -1
  1440. package/src/unstable/workflow/Activity.ts +2 -2
  1441. package/src/unstable/workflow/DurableClock.ts +1 -1
  1442. package/src/unstable/workflow/DurableDeferred.ts +10 -10
  1443. package/src/unstable/workflow/DurableQueue.ts +22 -20
  1444. package/src/unstable/workflow/Workflow.ts +23 -23
  1445. package/src/unstable/workflow/WorkflowEngine.ts +1 -1
  1446. package/src/unstable/workflow/WorkflowProxy.ts +4 -2
  1447. package/dist/internal/version.d.ts +0 -3
  1448. package/dist/internal/version.d.ts.map +0 -1
  1449. package/dist/internal/version.js +0 -2
  1450. package/dist/internal/version.js.map +0 -1
  1451. package/src/internal/version.ts +0 -2
package/src/Schedule.ts CHANGED
@@ -34,42 +34,17 @@ const randomNext: Effect<number> = random.Random.useSync((random) => random.next
34
34
  *
35
35
  * **Example** (Defining retry and repeat schedules)
36
36
  *
37
- * ```ts
38
- * import { Console, Data, Effect, Schedule } from "effect"
39
- *
40
- * class NetworkError extends Data.TaggedError("NetworkError")<{
41
- * readonly attempt: number
42
- * }> {}
43
- *
44
- * // Basic retry schedule - retry up to 3 times with exponential backoff
45
- * const retrySchedule = Schedule.max([
46
- * Schedule.exponential("100 millis"),
47
- * Schedule.recurs(3)
48
- * ])
37
+ * ```ts import.meta.vitest
38
+ * import { Effect, Schedule } from "effect"
39
+ * import { TestClock } from "effect/testing"
49
40
  *
50
- * // Basic repeat schedule - repeat every 30 seconds forever
51
- * const repeatSchedule: Schedule.Schedule<number, unknown, never> = Schedule
52
- * .spaced("30 seconds")
41
+ * const executions: Array<number> = []
42
+ * const program = Effect.sync(() => executions.push(executions.length + 1)).pipe(
43
+ * Effect.repeat(Schedule.recurs(2)),
44
+ * Effect.as(executions)
45
+ * )
53
46
  *
54
- * const program = Effect.gen(function*() {
55
- * let attempts = 0
56
- *
57
- * const result1 = yield* Effect.retry(
58
- * Effect.gen(function*() {
59
- * attempts++
60
- * if (attempts < 3) {
61
- * return yield* Effect.fail(new NetworkError({ attempt: attempts }))
62
- * }
63
- * return "Success"
64
- * }),
65
- * retrySchedule
66
- * )
67
- * console.log(result1) // "Success"
68
- *
69
- * yield* Console.log("heartbeat").pipe(
70
- * Effect.repeat(repeatSchedule.pipe(Schedule.upTo({ times: 5 })))
71
- * )
72
- * })
47
+ * await Effect.runPromise(Effect.provide(program, TestClock.layer())) // => [1, 2, 3]
73
48
  * ```
74
49
  *
75
50
  * @category models
@@ -115,7 +90,7 @@ export interface Metadata<Output = unknown, Input = unknown> extends InputMetada
115
90
  * input and output values, zero duration, and zeroed timing fields before any
116
91
  * schedule step has produced metadata.
117
92
  *
118
- * @category metadata
93
+ * @category services
119
94
  * @since 4.0.0
120
95
  */
121
96
  export const CurrentMetadata = Context.Reference<Metadata>("effect/Schedule/CurrentMetadata", {
@@ -142,27 +117,11 @@ export declare namespace Schedule {
142
117
  *
143
118
  * **Example** (Understanding schedule variance)
144
119
  *
145
- * ```ts
146
- * import { Effect, Schedule } from "effect"
147
- *
148
- * // Understanding Schedule variance:
149
- * // - Output: covariant (can be a subtype)
150
- * // - Input: contravariant (can accept supertypes)
151
- * // - Error: covariant (can be a subtype)
152
- * // - Env: covariant (can be a subtype)
153
- *
154
- * // Schedule that produces strings, accepts any input
155
- * const stringSchedule = Schedule.spaced("1 second").pipe(
156
- * Schedule.map(() => Effect.succeed("tick"))
157
- * )
120
+ * ```ts import.meta.vitest
121
+ * import { Schedule } from "effect"
158
122
  *
159
- * // Schedule that only accepts Error inputs
160
- * const errorSchedule = Schedule.exponential("100 millis").pipe(
161
- * Schedule.upTo({ times: 5 })
162
- * )
163
- *
164
- * // Schedule requiring a service environment
165
- * const serviceSchedule = Schedule.spaced("5 seconds")
123
+ * const schedule: Schedule.Schedule<number, unknown, never, never> = Schedule.recurs(2)
124
+ * Schedule.isSchedule(schedule) // => true
166
125
  * ```
167
126
  *
168
127
  * @category models
@@ -195,7 +154,7 @@ export declare namespace Schedule {
195
154
  /**
196
155
  * Extracts the output type from a `Schedule`.
197
156
  *
198
- * @category type extractors
157
+ * @category utility types
199
158
  * @since 4.0.0
200
159
  */
201
160
  export type Output<S> = S extends Schedule<infer Output, any, any, any> ? Output : never
@@ -203,7 +162,7 @@ export type Output<S> = S extends Schedule<infer Output, any, any, any> ? Output
203
162
  /**
204
163
  * Extracts the input type from a `Schedule`.
205
164
  *
206
- * @category type extractors
165
+ * @category utility types
207
166
  * @since 4.0.0
208
167
  */
209
168
  export type Input<S> = S extends Schedule<any, infer Input, any, any> ? Input : never
@@ -211,7 +170,7 @@ export type Input<S> = S extends Schedule<any, infer Input, any, any> ? Input :
211
170
  /**
212
171
  * Extracts the error type from a `Schedule`.
213
172
  *
214
- * @category type extractors
173
+ * @category utility types
215
174
  * @since 4.0.0
216
175
  */
217
176
  export type Error<S> = S extends Schedule<any, any, infer Error, any> ? Error : never
@@ -219,7 +178,7 @@ export type Error<S> = S extends Schedule<any, any, infer Error, any> ? Error :
219
178
  /**
220
179
  * Extracts the service requirements from a `Schedule`.
221
180
  *
222
- * @category type extractors
181
+ * @category utility types
223
182
  * @since 4.0.0
224
183
  */
225
184
  export type Env<S> = S extends Schedule<any, any, any, infer Env> ? Env : never
@@ -240,16 +199,16 @@ const ScheduleProto = {
240
199
  *
241
200
  * **Example** (Checking for schedules)
242
201
  *
243
- * ```ts
202
+ * ```ts import.meta.vitest
244
203
  * import { Schedule } from "effect"
245
204
  *
246
205
  * const schedule = Schedule.exponential("100 millis")
247
206
  * const notSchedule = { foo: "bar" }
248
207
  *
249
- * console.log(Schedule.isSchedule(schedule)) // true
250
- * console.log(Schedule.isSchedule(notSchedule)) // false
251
- * console.log(Schedule.isSchedule(null)) // false
252
- * console.log(Schedule.isSchedule(undefined)) // false
208
+ * Schedule.isSchedule(schedule) // => true
209
+ * Schedule.isSchedule(notSchedule) // => false
210
+ * Schedule.isSchedule(null) // => false
211
+ * Schedule.isSchedule(undefined) // => false
253
212
  * ```
254
213
  *
255
214
  * @category guards
@@ -262,7 +221,7 @@ export const isSchedule = (u: unknown): u is Schedule<unknown, never, unknown, u
262
221
  *
263
222
  * **Example** (Creating a custom schedule from a step function)
264
223
  *
265
- * ```ts
224
+ * ```ts import.meta.vitest
266
225
  * import { Cause, Duration, Effect, Schedule } from "effect"
267
226
  *
268
227
  * const schedule = Schedule.fromStep(Effect.sync(() => {
@@ -275,6 +234,14 @@ export const isSchedule = (u: unknown): u is Schedule<unknown, never, unknown, u
275
234
  * return Effect.succeed([count++, Duration.millis(100)] as [number, Duration.Duration])
276
235
  * }
277
236
  * }))
237
+ *
238
+ * const program = Effect.gen(function*() {
239
+ * const step = yield* Schedule.toStep(schedule)
240
+ * const [output] = yield* step(0, "input")
241
+ * return output
242
+ * })
243
+ *
244
+ * await Effect.runPromise(program) // => 0
278
245
  * ```
279
246
  *
280
247
  * @category constructors
@@ -310,7 +277,7 @@ const metadataFn = () => {
310
277
  *
311
278
  * **Example** (Creating a metadata-aware schedule)
312
279
  *
313
- * ```ts
280
+ * ```ts import.meta.vitest
314
281
  * import { Cause, Duration, Effect, Schedule } from "effect"
315
282
  *
316
283
  * const firstThreeInputs = Schedule.fromStepWithMetadata(Effect.succeed((metadata: Schedule.InputMetadata<string>) => {
@@ -323,6 +290,14 @@ const metadataFn = () => {
323
290
  * Duration.millis(250)
324
291
  * ] as [string, Duration.Duration])
325
292
  * }))
293
+ *
294
+ * const program = Effect.gen(function*() {
295
+ * const step = yield* Schedule.toStep(firstThreeInputs)
296
+ * const [output] = yield* step(0, "input")
297
+ * return output
298
+ * })
299
+ *
300
+ * await Effect.runPromise(program) // => "attempt 1: input"
326
301
  * ```
327
302
  *
328
303
  * @category constructors
@@ -345,8 +320,8 @@ export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
345
320
  *
346
321
  * **Example** (Extracting a schedule step function)
347
322
  *
348
- * ```ts
349
- * import { Effect, Schedule } from "effect"
323
+ * ```ts import.meta.vitest
324
+ * import { Duration, Effect, Schedule } from "effect"
350
325
  *
351
326
  * // Extract step function from an existing schedule
352
327
  * const schedule = Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 3 }))
@@ -357,10 +332,10 @@ export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
357
332
  * // Use the step function directly for custom logic. The timestamp is
358
333
  * // supplied by the caller, so tests can pass a deterministic value.
359
334
  * const now = 0
360
- * const result = yield* stepFn(now, "input")
361
- *
362
- * console.log(`Step result: ${result}`)
335
+ * return yield* stepFn(now, "input")
363
336
  * })
337
+ *
338
+ * await Effect.runPromise(program) // => [Duration.millis(100), Duration.millis(100)]
364
339
  * ```
365
340
  *
366
341
  * @category destructors
@@ -433,26 +408,19 @@ export const toStepWithMetadata = <Output, Input, Error, Env>(
433
408
  *
434
409
  * **Example** (Extracting a sleeping step function)
435
410
  *
436
- * ```ts
411
+ * ```ts import.meta.vitest
437
412
  * import { Effect, Schedule } from "effect"
413
+ * import { TestClock } from "effect/testing"
438
414
  *
439
- * // Convert schedule to step function with automatic sleeping
440
- * const schedule = Schedule.spaced("1 second").pipe(Schedule.upTo({ times: 3 }))
415
+ * const schedule = Schedule.recurs(3)
441
416
  *
442
417
  * const program = Effect.gen(function*() {
443
418
  * const stepWithSleep = yield* Schedule.toStepWithSleep(schedule)
444
419
  *
445
- * // Each call will automatically sleep for the scheduled delay
446
- * console.log("Starting...")
447
- * const result1 = yield* stepWithSleep("first")
448
- * console.log(`First result: ${result1}`)
449
- *
450
- * const result2 = yield* stepWithSleep("second")
451
- * console.log(`Second result: ${result2}`)
452
- *
453
- * const result3 = yield* stepWithSleep("third")
454
- * console.log(`Third result: ${result3}`)
420
+ * return [yield* stepWithSleep("first"), yield* stepWithSleep("second")]
455
421
  * })
422
+ *
423
+ * await Effect.runPromise(Effect.provide(program, TestClock.layer())) // => [0, 1]
456
424
  * ```
457
425
  *
458
426
  * @category destructors
@@ -476,94 +444,19 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
476
444
  *
477
445
  * **Example** (Adding extra delay to a schedule)
478
446
  *
479
- * ```ts
480
- * import { Console, Data, Duration, Effect, Schedule } from "effect"
481
- *
482
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
447
+ * ```ts import.meta.vitest
448
+ * import { Duration, Effect, Schedule } from "effect"
483
449
  *
484
- * // Add a deterministic extra delay based on the schedule metadata
485
- * const delayedSchedule = Schedule.addDelay(
486
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 5 })),
487
- * ({ output }) =>
488
- * Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
489
- * )
490
- *
491
- * const repeatProgram = Effect.gen(function*() {
492
- * yield* Effect.repeat(
493
- * Effect.succeed("delayed task"),
494
- * delayedSchedule.pipe(
495
- * Schedule.tap(({ output: delay }) =>
496
- * Console.log(`Base delay: ${delay}`)
497
- * )
498
- * )
499
- * )
500
- * })
501
- *
502
- * // Add adaptive delay based on execution count
503
- * const adaptiveSchedule = Schedule.addDelay(
504
- * Schedule.recurs(6),
505
- * ({ output: executionCount }) =>
506
- * // Increase delay as execution count grows
507
- * Effect.succeed(Duration.millis(executionCount * 200))
508
- * )
509
- *
510
- * const adaptiveProgram = Effect.gen(function*() {
511
- * yield* Effect.repeat(
512
- * Effect.gen(function*() {
513
- * yield* Console.log("Adaptive delay task")
514
- * return "adaptive"
515
- * }),
516
- * adaptiveSchedule.pipe(
517
- * Schedule.tap(({ output: count }) =>
518
- * Console.log(`Execution ${count + 1} with adaptive delay`)
519
- * )
520
- * )
521
- * )
522
- * })
523
- *
524
- * // Add effectful delay computation from deterministic service data
525
- * const loadByExecution = [1, 3, 2, 4] as const
526
- *
527
- * const dynamicSchedule = Schedule.addDelay(
528
- * Schedule.spaced("1 second").pipe(Schedule.upTo({ times: 4 })),
529
- * ({ output: executionNumber }) => {
530
- * const load = loadByExecution[executionNumber] ?? 1
531
- * return Effect.succeed(Duration.millis(load * 100))
532
- * }
450
+ * const schedule = Schedule.recurs(1).pipe(
451
+ * Schedule.addDelay(() => Effect.succeed("25 millis"))
533
452
  * )
534
- *
535
- * const dynamicProgram = Effect.gen(function*() {
536
- * yield* Effect.repeat(
537
- * Effect.gen(function*() {
538
- * yield* Console.log("Dynamic delay task")
539
- * return "dynamic"
540
- * }),
541
- * dynamicSchedule
542
- * )
453
+ * const program = Effect.gen(function*() {
454
+ * const step = yield* Schedule.toStep(schedule)
455
+ * const [, delay] = yield* step(0, undefined)
456
+ * return delay
543
457
  * })
544
458
  *
545
- * // Combine with retry for progressive backoff
546
- * const progressiveRetrySchedule = Schedule.addDelay(
547
- * Schedule.exponential("50 millis").pipe(Schedule.upTo({ times: 4 })),
548
- * () => Effect.succeed(Duration.millis(100)) // Fixed additional delay
549
- * )
550
- *
551
- * const retryProgram = Effect.gen(function*() {
552
- * let attempt = 0
553
- *
554
- * const result = yield* Effect.retry(
555
- * Effect.gen(function*() {
556
- * attempt++
557
- * if (attempt < 5) {
558
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
559
- * }
560
- * return `Success on attempt ${attempt}`
561
- * }),
562
- * progressiveRetrySchedule
563
- * )
564
- *
565
- * yield* Console.log(`Final result: ${result}`)
566
- * })
459
+ * await Effect.runPromise(program) // => Duration.millis(25)
567
460
  * ```
568
461
  *
569
462
  * @category delays & timeouts
@@ -576,94 +469,19 @@ export const addDelay: {
576
469
  *
577
470
  * **Example** (Adding extra delay to a schedule)
578
471
  *
579
- * ```ts
580
- * import { Console, Data, Duration, Effect, Schedule } from "effect"
581
- *
582
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
472
+ * ```ts import.meta.vitest
473
+ * import { Duration, Effect, Schedule } from "effect"
583
474
  *
584
- * // Add a deterministic extra delay based on the schedule metadata
585
- * const delayedSchedule = Schedule.addDelay(
586
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 5 })),
587
- * ({ output }) =>
588
- * Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
475
+ * const schedule = Schedule.recurs(1).pipe(
476
+ * Schedule.addDelay(() => Effect.succeed("25 millis"))
589
477
  * )
590
- *
591
- * const repeatProgram = Effect.gen(function*() {
592
- * yield* Effect.repeat(
593
- * Effect.succeed("delayed task"),
594
- * delayedSchedule.pipe(
595
- * Schedule.tap(({ output: delay }) =>
596
- * Console.log(`Base delay: ${delay}`)
597
- * )
598
- * )
599
- * )
600
- * })
601
- *
602
- * // Add adaptive delay based on execution count
603
- * const adaptiveSchedule = Schedule.addDelay(
604
- * Schedule.recurs(6),
605
- * ({ output: executionCount }) =>
606
- * // Increase delay as execution count grows
607
- * Effect.succeed(Duration.millis(executionCount * 200))
608
- * )
609
- *
610
- * const adaptiveProgram = Effect.gen(function*() {
611
- * yield* Effect.repeat(
612
- * Effect.gen(function*() {
613
- * yield* Console.log("Adaptive delay task")
614
- * return "adaptive"
615
- * }),
616
- * adaptiveSchedule.pipe(
617
- * Schedule.tap(({ output: count }) =>
618
- * Console.log(`Execution ${count + 1} with adaptive delay`)
619
- * )
620
- * )
621
- * )
622
- * })
623
- *
624
- * // Add effectful delay computation from deterministic service data
625
- * const loadByExecution = [1, 3, 2, 4] as const
626
- *
627
- * const dynamicSchedule = Schedule.addDelay(
628
- * Schedule.spaced("1 second").pipe(Schedule.upTo({ times: 4 })),
629
- * ({ output: executionNumber }) => {
630
- * const load = loadByExecution[executionNumber] ?? 1
631
- * return Effect.succeed(Duration.millis(load * 100))
632
- * }
633
- * )
634
- *
635
- * const dynamicProgram = Effect.gen(function*() {
636
- * yield* Effect.repeat(
637
- * Effect.gen(function*() {
638
- * yield* Console.log("Dynamic delay task")
639
- * return "dynamic"
640
- * }),
641
- * dynamicSchedule
642
- * )
478
+ * const program = Effect.gen(function*() {
479
+ * const step = yield* Schedule.toStep(schedule)
480
+ * const [, delay] = yield* step(0, undefined)
481
+ * return delay
643
482
  * })
644
483
  *
645
- * // Combine with retry for progressive backoff
646
- * const progressiveRetrySchedule = Schedule.addDelay(
647
- * Schedule.exponential("50 millis").pipe(Schedule.upTo({ times: 4 })),
648
- * () => Effect.succeed(Duration.millis(100)) // Fixed additional delay
649
- * )
650
- *
651
- * const retryProgram = Effect.gen(function*() {
652
- * let attempt = 0
653
- *
654
- * const result = yield* Effect.retry(
655
- * Effect.gen(function*() {
656
- * attempt++
657
- * if (attempt < 5) {
658
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
659
- * }
660
- * return `Success on attempt ${attempt}`
661
- * }),
662
- * progressiveRetrySchedule
663
- * )
664
- *
665
- * yield* Console.log(`Final result: ${result}`)
666
- * })
484
+ * await Effect.runPromise(program) // => Duration.millis(25)
667
485
  * ```
668
486
  *
669
487
  * @category delays & timeouts
@@ -680,94 +498,19 @@ export const addDelay: {
680
498
  *
681
499
  * **Example** (Adding extra delay to a schedule)
682
500
  *
683
- * ```ts
684
- * import { Console, Data, Duration, Effect, Schedule } from "effect"
685
- *
686
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
501
+ * ```ts import.meta.vitest
502
+ * import { Duration, Effect, Schedule } from "effect"
687
503
  *
688
- * // Add a deterministic extra delay based on the schedule metadata
689
- * const delayedSchedule = Schedule.addDelay(
690
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 5 })),
691
- * ({ output }) =>
692
- * Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
504
+ * const schedule = Schedule.recurs(1).pipe(
505
+ * Schedule.addDelay(() => Effect.succeed("25 millis"))
693
506
  * )
694
- *
695
- * const repeatProgram = Effect.gen(function*() {
696
- * yield* Effect.repeat(
697
- * Effect.succeed("delayed task"),
698
- * delayedSchedule.pipe(
699
- * Schedule.tap(({ output: delay }) =>
700
- * Console.log(`Base delay: ${delay}`)
701
- * )
702
- * )
703
- * )
704
- * })
705
- *
706
- * // Add adaptive delay based on execution count
707
- * const adaptiveSchedule = Schedule.addDelay(
708
- * Schedule.recurs(6),
709
- * ({ output: executionCount }) =>
710
- * // Increase delay as execution count grows
711
- * Effect.succeed(Duration.millis(executionCount * 200))
712
- * )
713
- *
714
- * const adaptiveProgram = Effect.gen(function*() {
715
- * yield* Effect.repeat(
716
- * Effect.gen(function*() {
717
- * yield* Console.log("Adaptive delay task")
718
- * return "adaptive"
719
- * }),
720
- * adaptiveSchedule.pipe(
721
- * Schedule.tap(({ output: count }) =>
722
- * Console.log(`Execution ${count + 1} with adaptive delay`)
723
- * )
724
- * )
725
- * )
726
- * })
727
- *
728
- * // Add effectful delay computation from deterministic service data
729
- * const loadByExecution = [1, 3, 2, 4] as const
730
- *
731
- * const dynamicSchedule = Schedule.addDelay(
732
- * Schedule.spaced("1 second").pipe(Schedule.upTo({ times: 4 })),
733
- * ({ output: executionNumber }) => {
734
- * const load = loadByExecution[executionNumber] ?? 1
735
- * return Effect.succeed(Duration.millis(load * 100))
736
- * }
737
- * )
738
- *
739
- * const dynamicProgram = Effect.gen(function*() {
740
- * yield* Effect.repeat(
741
- * Effect.gen(function*() {
742
- * yield* Console.log("Dynamic delay task")
743
- * return "dynamic"
744
- * }),
745
- * dynamicSchedule
746
- * )
507
+ * const program = Effect.gen(function*() {
508
+ * const step = yield* Schedule.toStep(schedule)
509
+ * const [, delay] = yield* step(0, undefined)
510
+ * return delay
747
511
  * })
748
512
  *
749
- * // Combine with retry for progressive backoff
750
- * const progressiveRetrySchedule = Schedule.addDelay(
751
- * Schedule.exponential("50 millis").pipe(Schedule.upTo({ times: 4 })),
752
- * () => Effect.succeed(Duration.millis(100)) // Fixed additional delay
753
- * )
754
- *
755
- * const retryProgram = Effect.gen(function*() {
756
- * let attempt = 0
757
- *
758
- * const result = yield* Effect.retry(
759
- * Effect.gen(function*() {
760
- * attempt++
761
- * if (attempt < 5) {
762
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
763
- * }
764
- * return `Success on attempt ${attempt}`
765
- * }),
766
- * progressiveRetrySchedule
767
- * )
768
- *
769
- * yield* Console.log(`Final result: ${result}`)
770
- * })
513
+ * await Effect.runPromise(program) // => Duration.millis(25)
771
514
  * ```
772
515
  *
773
516
  * @category delays & timeouts
@@ -792,35 +535,11 @@ export const addDelay: {
792
535
  *
793
536
  * **Example** (Sequencing quick and slow retries)
794
537
  *
795
- * ```ts
796
- * import { Console, Data, Effect, Schedule } from "effect"
797
- *
798
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
799
- *
800
- * // First retry 3 times quickly, then switch to slower retries
801
- * const quickRetries = Schedule.exponential("100 millis").pipe(
802
- * Schedule.upTo({ times: 3 })
803
- * )
804
- * const slowRetries = Schedule.exponential("1 second").pipe(
805
- * Schedule.upTo({ times: 2 })
806
- * )
807
- *
808
- * const combinedRetries = Schedule.andThen(quickRetries, slowRetries)
538
+ * ```ts import.meta.vitest
539
+ * import { Schedule } from "effect"
809
540
  *
810
- * const program = Effect.gen(function*() {
811
- * let attempt = 0
812
- * yield* Effect.retry(
813
- * Effect.gen(function*() {
814
- * attempt++
815
- * yield* Console.log(`Attempt ${attempt}`)
816
- * if (attempt < 6) {
817
- * return yield* Effect.fail(new RetryAttemptError({ message: `Failure ${attempt}` }))
818
- * }
819
- * return `Success on attempt ${attempt}`
820
- * }),
821
- * combinedRetries
822
- * )
823
- * })
541
+ * const schedule = Schedule.andThen(Schedule.recurs(1), Schedule.recurs(2))
542
+ * Schedule.isSchedule(schedule) // => true
824
543
  * ```
825
544
  *
826
545
  * @category sequencing
@@ -833,35 +552,11 @@ export const andThen: {
833
552
  *
834
553
  * **Example** (Sequencing quick and slow retries)
835
554
  *
836
- * ```ts
837
- * import { Console, Data, Effect, Schedule } from "effect"
838
- *
839
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
840
- *
841
- * // First retry 3 times quickly, then switch to slower retries
842
- * const quickRetries = Schedule.exponential("100 millis").pipe(
843
- * Schedule.upTo({ times: 3 })
844
- * )
845
- * const slowRetries = Schedule.exponential("1 second").pipe(
846
- * Schedule.upTo({ times: 2 })
847
- * )
848
- *
849
- * const combinedRetries = Schedule.andThen(quickRetries, slowRetries)
555
+ * ```ts import.meta.vitest
556
+ * import { Schedule } from "effect"
850
557
  *
851
- * const program = Effect.gen(function*() {
852
- * let attempt = 0
853
- * yield* Effect.retry(
854
- * Effect.gen(function*() {
855
- * attempt++
856
- * yield* Console.log(`Attempt ${attempt}`)
857
- * if (attempt < 6) {
858
- * return yield* Effect.fail(new RetryAttemptError({ message: `Failure ${attempt}` }))
859
- * }
860
- * return `Success on attempt ${attempt}`
861
- * }),
862
- * combinedRetries
863
- * )
864
- * })
558
+ * const schedule = Schedule.andThen(Schedule.recurs(1), Schedule.recurs(2))
559
+ * Schedule.isSchedule(schedule) // => true
865
560
  * ```
866
561
  *
867
562
  * @category sequencing
@@ -876,35 +571,11 @@ export const andThen: {
876
571
  *
877
572
  * **Example** (Sequencing quick and slow retries)
878
573
  *
879
- * ```ts
880
- * import { Console, Data, Effect, Schedule } from "effect"
881
- *
882
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
574
+ * ```ts import.meta.vitest
575
+ * import { Schedule } from "effect"
883
576
  *
884
- * // First retry 3 times quickly, then switch to slower retries
885
- * const quickRetries = Schedule.exponential("100 millis").pipe(
886
- * Schedule.upTo({ times: 3 })
887
- * )
888
- * const slowRetries = Schedule.exponential("1 second").pipe(
889
- * Schedule.upTo({ times: 2 })
890
- * )
891
- *
892
- * const combinedRetries = Schedule.andThen(quickRetries, slowRetries)
893
- *
894
- * const program = Effect.gen(function*() {
895
- * let attempt = 0
896
- * yield* Effect.retry(
897
- * Effect.gen(function*() {
898
- * attempt++
899
- * yield* Console.log(`Attempt ${attempt}`)
900
- * if (attempt < 6) {
901
- * return yield* Effect.fail(new RetryAttemptError({ message: `Failure ${attempt}` }))
902
- * }
903
- * return `Success on attempt ${attempt}`
904
- * }),
905
- * combinedRetries
906
- * )
907
- * })
577
+ * const schedule = Schedule.andThen(Schedule.recurs(1), Schedule.recurs(2))
578
+ * Schedule.isSchedule(schedule) // => true
908
579
  * ```
909
580
  *
910
581
  * @category sequencing
@@ -932,31 +603,11 @@ export const andThen: {
932
603
  *
933
604
  * **Example** (Tracking sequential schedule phases)
934
605
  *
935
- * ```ts
936
- * import { Console, Effect, Result, Schedule } from "effect"
937
- *
938
- * // Track which phase of the schedule we're in
939
- * const phaseTracker = Schedule.andThenResult(
940
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 2 })),
941
- * Schedule.spaced("500 millis").pipe(Schedule.upTo({ times: 2 }))
942
- * )
606
+ * ```ts import.meta.vitest
607
+ * import { Schedule } from "effect"
943
608
  *
944
- * const program = Effect.gen(function*() {
945
- * yield* Effect.repeat(
946
- * Effect.gen(function*() {
947
- * yield* Console.log("Task executed")
948
- * return "task-result"
949
- * }),
950
- * phaseTracker.pipe(
951
- * Schedule.tap(({ output: result }) =>
952
- * Result.match(result, {
953
- * onFailure: (phase1Output) => Console.log(`Phase 1: ${phase1Output}`),
954
- * onSuccess: (phase2Output) => Console.log(`Phase 2: ${phase2Output}`)
955
- * })
956
- * )
957
- * )
958
- * )
959
- * })
609
+ * const schedule = Schedule.andThenResult(Schedule.recurs(1), Schedule.recurs(2))
610
+ * Schedule.isSchedule(schedule) // => true
960
611
  * ```
961
612
  *
962
613
  * @category sequencing
@@ -975,31 +626,11 @@ export const andThenResult: {
975
626
  *
976
627
  * **Example** (Tracking sequential schedule phases)
977
628
  *
978
- * ```ts
979
- * import { Console, Effect, Result, Schedule } from "effect"
980
- *
981
- * // Track which phase of the schedule we're in
982
- * const phaseTracker = Schedule.andThenResult(
983
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 2 })),
984
- * Schedule.spaced("500 millis").pipe(Schedule.upTo({ times: 2 }))
985
- * )
629
+ * ```ts import.meta.vitest
630
+ * import { Schedule } from "effect"
986
631
  *
987
- * const program = Effect.gen(function*() {
988
- * yield* Effect.repeat(
989
- * Effect.gen(function*() {
990
- * yield* Console.log("Task executed")
991
- * return "task-result"
992
- * }),
993
- * phaseTracker.pipe(
994
- * Schedule.tap(({ output: result }) =>
995
- * Result.match(result, {
996
- * onFailure: (phase1Output) => Console.log(`Phase 1: ${phase1Output}`),
997
- * onSuccess: (phase2Output) => Console.log(`Phase 2: ${phase2Output}`)
998
- * })
999
- * )
1000
- * )
1001
- * )
1002
- * })
632
+ * const schedule = Schedule.andThenResult(Schedule.recurs(1), Schedule.recurs(2))
633
+ * Schedule.isSchedule(schedule) // => true
1003
634
  * ```
1004
635
  *
1005
636
  * @category sequencing
@@ -1020,31 +651,11 @@ export const andThenResult: {
1020
651
  *
1021
652
  * **Example** (Tracking sequential schedule phases)
1022
653
  *
1023
- * ```ts
1024
- * import { Console, Effect, Result, Schedule } from "effect"
654
+ * ```ts import.meta.vitest
655
+ * import { Schedule } from "effect"
1025
656
  *
1026
- * // Track which phase of the schedule we're in
1027
- * const phaseTracker = Schedule.andThenResult(
1028
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 2 })),
1029
- * Schedule.spaced("500 millis").pipe(Schedule.upTo({ times: 2 }))
1030
- * )
1031
- *
1032
- * const program = Effect.gen(function*() {
1033
- * yield* Effect.repeat(
1034
- * Effect.gen(function*() {
1035
- * yield* Console.log("Task executed")
1036
- * return "task-result"
1037
- * }),
1038
- * phaseTracker.pipe(
1039
- * Schedule.tap(({ output: result }) =>
1040
- * Result.match(result, {
1041
- * onFailure: (phase1Output) => Console.log(`Phase 1: ${phase1Output}`),
1042
- * onSuccess: (phase2Output) => Console.log(`Phase 2: ${phase2Output}`)
1043
- * })
1044
- * )
1045
- * )
1046
- * )
1047
- * })
657
+ * const schedule = Schedule.andThenResult(Schedule.recurs(1), Schedule.recurs(2))
658
+ * Schedule.isSchedule(schedule) // => true
1048
659
  * ```
1049
660
  *
1050
661
  * @category sequencing
@@ -1093,31 +704,11 @@ export const andThenResult: {
1093
704
  *
1094
705
  * **Example** (Tracking sequential schedule phases)
1095
706
  *
1096
- * ```ts
1097
- * import { Console, Effect, Result, Schedule } from "effect"
1098
- *
1099
- * // Track which phase of the schedule we're in
1100
- * const phaseTracker = Schedule.andThenResult(
1101
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 2 })),
1102
- * Schedule.spaced("500 millis").pipe(Schedule.upTo({ times: 2 }))
1103
- * )
707
+ * ```ts import.meta.vitest
708
+ * import { Schedule } from "effect"
1104
709
  *
1105
- * const program = Effect.gen(function*() {
1106
- * yield* Effect.repeat(
1107
- * Effect.gen(function*() {
1108
- * yield* Console.log("Task executed")
1109
- * return "task-result"
1110
- * }),
1111
- * phaseTracker.pipe(
1112
- * Schedule.tap(({ output: result }) =>
1113
- * Result.match(result, {
1114
- * onFailure: (phase1Output) => Console.log(`Phase 1: ${phase1Output}`),
1115
- * onSuccess: (phase2Output) => Console.log(`Phase 2: ${phase2Output}`)
1116
- * })
1117
- * )
1118
- * )
1119
- * )
1120
- * })
710
+ * const schedule = Schedule.andThenResult(Schedule.recurs(1), Schedule.recurs(2))
711
+ * Schedule.isSchedule(schedule) // => true
1121
712
  * ```
1122
713
  *
1123
714
  * @category sequencing
@@ -1136,31 +727,11 @@ export const andThenResult: {
1136
727
  *
1137
728
  * **Example** (Tracking sequential schedule phases)
1138
729
  *
1139
- * ```ts
1140
- * import { Console, Effect, Result, Schedule } from "effect"
1141
- *
1142
- * // Track which phase of the schedule we're in
1143
- * const phaseTracker = Schedule.andThenResult(
1144
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 2 })),
1145
- * Schedule.spaced("500 millis").pipe(Schedule.upTo({ times: 2 }))
1146
- * )
730
+ * ```ts import.meta.vitest
731
+ * import { Schedule } from "effect"
1147
732
  *
1148
- * const program = Effect.gen(function*() {
1149
- * yield* Effect.repeat(
1150
- * Effect.gen(function*() {
1151
- * yield* Console.log("Task executed")
1152
- * return "task-result"
1153
- * }),
1154
- * phaseTracker.pipe(
1155
- * Schedule.tap(({ output: result }) =>
1156
- * Result.match(result, {
1157
- * onFailure: (phase1Output) => Console.log(`Phase 1: ${phase1Output}`),
1158
- * onSuccess: (phase2Output) => Console.log(`Phase 2: ${phase2Output}`)
1159
- * })
1160
- * )
1161
- * )
1162
- * )
1163
- * })
733
+ * const schedule = Schedule.andThenResult(Schedule.recurs(1), Schedule.recurs(2))
734
+ * Schedule.isSchedule(schedule) // => true
1164
735
  * ```
1165
736
  *
1166
737
  * @category sequencing
@@ -1179,31 +750,11 @@ export const andThenResult: {
1179
750
  *
1180
751
  * **Example** (Tracking sequential schedule phases)
1181
752
  *
1182
- * ```ts
1183
- * import { Console, Effect, Result, Schedule } from "effect"
753
+ * ```ts import.meta.vitest
754
+ * import { Schedule } from "effect"
1184
755
  *
1185
- * // Track which phase of the schedule we're in
1186
- * const phaseTracker = Schedule.andThenResult(
1187
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 2 })),
1188
- * Schedule.spaced("500 millis").pipe(Schedule.upTo({ times: 2 }))
1189
- * )
1190
- *
1191
- * const program = Effect.gen(function*() {
1192
- * yield* Effect.repeat(
1193
- * Effect.gen(function*() {
1194
- * yield* Console.log("Task executed")
1195
- * return "task-result"
1196
- * }),
1197
- * phaseTracker.pipe(
1198
- * Schedule.tap(({ output: result }) =>
1199
- * Result.match(result, {
1200
- * onFailure: (phase1Output) => Console.log(`Phase 1: ${phase1Output}`),
1201
- * onSuccess: (phase2Output) => Console.log(`Phase 2: ${phase2Output}`)
1202
- * })
1203
- * )
1204
- * )
1205
- * )
1206
- * })
756
+ * const schedule = Schedule.andThenResult(Schedule.recurs(1), Schedule.recurs(2))
757
+ * Schedule.isSchedule(schedule) // => true
1207
758
  * ```
1208
759
  *
1209
760
  * @category sequencing
@@ -1222,31 +773,11 @@ export const andThenResult: {
1222
773
  *
1223
774
  * **Example** (Tracking sequential schedule phases)
1224
775
  *
1225
- * ```ts
1226
- * import { Console, Effect, Result, Schedule } from "effect"
1227
- *
1228
- * // Track which phase of the schedule we're in
1229
- * const phaseTracker = Schedule.andThenResult(
1230
- * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 2 })),
1231
- * Schedule.spaced("500 millis").pipe(Schedule.upTo({ times: 2 }))
1232
- * )
776
+ * ```ts import.meta.vitest
777
+ * import { Schedule } from "effect"
1233
778
  *
1234
- * const program = Effect.gen(function*() {
1235
- * yield* Effect.repeat(
1236
- * Effect.gen(function*() {
1237
- * yield* Console.log("Task executed")
1238
- * return "task-result"
1239
- * }),
1240
- * phaseTracker.pipe(
1241
- * Schedule.tap(({ output: result }) =>
1242
- * Result.match(result, {
1243
- * onFailure: (phase1Output) => Console.log(`Phase 1: ${phase1Output}`),
1244
- * onSuccess: (phase2Output) => Console.log(`Phase 2: ${phase2Output}`)
1245
- * })
1246
- * )
1247
- * )
1248
- * )
1249
- * })
779
+ * const schedule = Schedule.andThenResult(Schedule.recurs(1), Schedule.recurs(2))
780
+ * Schedule.isSchedule(schedule) // => true
1250
781
  * ```
1251
782
  *
1252
783
  * @category sequencing
@@ -1282,36 +813,11 @@ export const andThenResult: {
1282
813
  *
1283
814
  * **Example** (Combining retry schedules by their maximum delay)
1284
815
  *
1285
- * ```ts
1286
- * import { Console, Data, Effect, Schedule } from "effect"
1287
- *
1288
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
1289
- *
1290
- * const retrySchedule = Schedule.max([
1291
- * Schedule.fixed("5 seconds"),
1292
- * Schedule.exponential("5 seconds"),
1293
- * Schedule.spaced("10 seconds")
1294
- * ])
816
+ * ```ts import.meta.vitest
817
+ * import { Schedule } from "effect"
1295
818
  *
1296
- * const program = Effect.gen(function*() {
1297
- * let attempt = 0
1298
- *
1299
- * yield* Effect.retry(
1300
- * Effect.gen(function*() {
1301
- * attempt++
1302
- * yield* Console.log(`Retry attempt ${attempt}`)
1303
- * if (attempt < 3) {
1304
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
1305
- * }
1306
- * return "success"
1307
- * }),
1308
- * retrySchedule.pipe(
1309
- * Schedule.tap(({ output: duration }) =>
1310
- * Console.log(`Waiting for the slowest schedule: ${duration}`)
1311
- * )
1312
- * )
1313
- * )
1314
- * })
819
+ * const schedule = Schedule.max([Schedule.fixed("5 seconds"), Schedule.spaced("10 seconds")])
820
+ * Schedule.isSchedule(schedule) // => true
1315
821
  * ```
1316
822
  *
1317
823
  * @category combining
@@ -1367,126 +873,11 @@ const maxDuration = (results: ReadonlyArray<Duration.Duration | undefined>): Dur
1367
873
  *
1368
874
  * **Example** (Scheduling work with cron expressions)
1369
875
  *
1370
- * ```ts
1371
- * import { Console, Data, Effect, Schedule } from "effect"
1372
- *
1373
- * class ScheduledTaskError extends Data.TaggedError("ScheduledTaskError")<{ readonly message: string }> {}
876
+ * ```ts import.meta.vitest
877
+ * import { Schedule } from "effect"
1374
878
  *
1375
- * // Run every minute
1376
879
  * const everyMinute = Schedule.cron("* * * * *")
1377
- *
1378
- * const minutelyProgram = Effect.gen(function*() {
1379
- * yield* Effect.repeat(
1380
- * Effect.gen(function*() {
1381
- * yield* Console.log("Running minutely task")
1382
- * return "minute"
1383
- * }),
1384
- * everyMinute.pipe(
1385
- * Schedule.upTo({ times: 3 }), // Run only 3 times for demo
1386
- * Schedule.tap(({ output: duration }) =>
1387
- * Console.log(`Next execution in: ${duration}`)
1388
- * )
1389
- * )
1390
- * )
1391
- * })
1392
- *
1393
- * // Run every day at 2:30 AM
1394
- * const dailyBackup = Schedule.cron("30 2 * * *")
1395
- *
1396
- * const backupProgram = Effect.gen(function*() {
1397
- * yield* Effect.repeat(
1398
- * Effect.gen(function*() {
1399
- * yield* Console.log("Running daily backup...")
1400
- * // Simulate backup process
1401
- * yield* Effect.sleep("2 seconds")
1402
- * yield* Console.log("Backup completed")
1403
- * return "backup-done"
1404
- * }),
1405
- * dailyBackup.pipe(
1406
- * Schedule.upTo({ times: 2 }) // Run 2 times for demo
1407
- * )
1408
- * )
1409
- * })
1410
- *
1411
- * // Run every Monday at 9:00 AM with timezone
1412
- * const weeklyReport = Schedule.cron("0 9 * * 1", "America/New_York")
1413
- *
1414
- * const reportProgram = Effect.gen(function*() {
1415
- * yield* Effect.repeat(
1416
- * Effect.gen(function*() {
1417
- * yield* Console.log("Generating weekly report...")
1418
- * const report = {
1419
- * week: 42,
1420
- * status: "ready" as const
1421
- * }
1422
- * yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
1423
- * return report
1424
- * }),
1425
- * weeklyReport.pipe(Schedule.upTo({ times: 1 }))
1426
- * )
1427
- * })
1428
- *
1429
- * // Run every 15 minutes during business hours (9 AM - 5 PM)
1430
- * const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
1431
- *
1432
- * const businessProgram = Effect.gen(function*() {
1433
- * const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
1434
- * let index = 0
1435
- *
1436
- * yield* Effect.repeat(
1437
- * Effect.gen(function*() {
1438
- * yield* Console.log("Business hours health check...")
1439
- * const status = statuses[index++]
1440
- * yield* Console.log(`System status: ${status}`)
1441
- * return status
1442
- * }),
1443
- * businessHoursCheck.pipe(
1444
- * Schedule.upTo({ times: 4 }) // Demo with 4 checks
1445
- * )
1446
- * )
1447
- * })
1448
- *
1449
- * // Run on specific days of the month
1450
- * const monthlyInvoice = Schedule.cron("0 10 1,15 * *") // 1st and 15th at 10 AM
1451
- *
1452
- * const invoiceProgram = Effect.gen(function*() {
1453
- * yield* Effect.repeat(
1454
- * Effect.gen(function*() {
1455
- * yield* Console.log("Processing monthly invoices...")
1456
- * const invoiceCount = 72
1457
- * yield* Console.log(`Processed ${invoiceCount} invoices`)
1458
- * return { count: invoiceCount, batch: "2024-01-a" }
1459
- * }),
1460
- * monthlyInvoice.pipe(Schedule.upTo({ times: 1 }))
1461
- * )
1462
- * })
1463
- *
1464
- * // Complex cron with error handling
1465
- * const complexCron = Schedule.cron("0 2,4,6 * * *").pipe(
1466
- * Schedule.tap(({ output: duration }) =>
1467
- * Console.log(`Scheduled to run again in ${duration}`)
1468
- * )
1469
- * )
1470
- *
1471
- * const robustProgram = Effect.gen(function*() {
1472
- * let attempt = 0
1473
- *
1474
- * yield* Effect.repeat(
1475
- * Effect.gen(function*() {
1476
- * attempt++
1477
- * yield* Console.log("Complex scheduled task...")
1478
- * if (attempt === 1) {
1479
- * return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
1480
- * }
1481
- * return "success"
1482
- * }),
1483
- * complexCron.pipe(Schedule.upTo({ times: 3 }))
1484
- * ).pipe(
1485
- * Effect.catch((error: unknown) =>
1486
- * Console.log(`Cron task error: ${String(error)}`)
1487
- * )
1488
- * )
1489
- * })
880
+ * Schedule.isSchedule(everyMinute) // => true
1490
881
  * ```
1491
882
  *
1492
883
  * @category constructors
@@ -1499,126 +890,11 @@ export const cron: {
1499
890
  *
1500
891
  * **Example** (Scheduling work with cron expressions)
1501
892
  *
1502
- * ```ts
1503
- * import { Console, Data, Effect, Schedule } from "effect"
893
+ * ```ts import.meta.vitest
894
+ * import { Schedule } from "effect"
1504
895
  *
1505
- * class ScheduledTaskError extends Data.TaggedError("ScheduledTaskError")<{ readonly message: string }> {}
1506
- *
1507
- * // Run every minute
1508
896
  * const everyMinute = Schedule.cron("* * * * *")
1509
- *
1510
- * const minutelyProgram = Effect.gen(function*() {
1511
- * yield* Effect.repeat(
1512
- * Effect.gen(function*() {
1513
- * yield* Console.log("Running minutely task")
1514
- * return "minute"
1515
- * }),
1516
- * everyMinute.pipe(
1517
- * Schedule.upTo({ times: 3 }), // Run only 3 times for demo
1518
- * Schedule.tap(({ output: duration }) =>
1519
- * Console.log(`Next execution in: ${duration}`)
1520
- * )
1521
- * )
1522
- * )
1523
- * })
1524
- *
1525
- * // Run every day at 2:30 AM
1526
- * const dailyBackup = Schedule.cron("30 2 * * *")
1527
- *
1528
- * const backupProgram = Effect.gen(function*() {
1529
- * yield* Effect.repeat(
1530
- * Effect.gen(function*() {
1531
- * yield* Console.log("Running daily backup...")
1532
- * // Simulate backup process
1533
- * yield* Effect.sleep("2 seconds")
1534
- * yield* Console.log("Backup completed")
1535
- * return "backup-done"
1536
- * }),
1537
- * dailyBackup.pipe(
1538
- * Schedule.upTo({ times: 2 }) // Run 2 times for demo
1539
- * )
1540
- * )
1541
- * })
1542
- *
1543
- * // Run every Monday at 9:00 AM with timezone
1544
- * const weeklyReport = Schedule.cron("0 9 * * 1", "America/New_York")
1545
- *
1546
- * const reportProgram = Effect.gen(function*() {
1547
- * yield* Effect.repeat(
1548
- * Effect.gen(function*() {
1549
- * yield* Console.log("Generating weekly report...")
1550
- * const report = {
1551
- * week: 42,
1552
- * status: "ready" as const
1553
- * }
1554
- * yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
1555
- * return report
1556
- * }),
1557
- * weeklyReport.pipe(Schedule.upTo({ times: 1 }))
1558
- * )
1559
- * })
1560
- *
1561
- * // Run every 15 minutes during business hours (9 AM - 5 PM)
1562
- * const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
1563
- *
1564
- * const businessProgram = Effect.gen(function*() {
1565
- * const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
1566
- * let index = 0
1567
- *
1568
- * yield* Effect.repeat(
1569
- * Effect.gen(function*() {
1570
- * yield* Console.log("Business hours health check...")
1571
- * const status = statuses[index++]
1572
- * yield* Console.log(`System status: ${status}`)
1573
- * return status
1574
- * }),
1575
- * businessHoursCheck.pipe(
1576
- * Schedule.upTo({ times: 4 }) // Demo with 4 checks
1577
- * )
1578
- * )
1579
- * })
1580
- *
1581
- * // Run on specific days of the month
1582
- * const monthlyInvoice = Schedule.cron("0 10 1,15 * *") // 1st and 15th at 10 AM
1583
- *
1584
- * const invoiceProgram = Effect.gen(function*() {
1585
- * yield* Effect.repeat(
1586
- * Effect.gen(function*() {
1587
- * yield* Console.log("Processing monthly invoices...")
1588
- * const invoiceCount = 72
1589
- * yield* Console.log(`Processed ${invoiceCount} invoices`)
1590
- * return { count: invoiceCount, batch: "2024-01-a" }
1591
- * }),
1592
- * monthlyInvoice.pipe(Schedule.upTo({ times: 1 }))
1593
- * )
1594
- * })
1595
- *
1596
- * // Complex cron with error handling
1597
- * const complexCron = Schedule.cron("0 2,4,6 * * *").pipe(
1598
- * Schedule.tap(({ output: duration }) =>
1599
- * Console.log(`Scheduled to run again in ${duration}`)
1600
- * )
1601
- * )
1602
- *
1603
- * const robustProgram = Effect.gen(function*() {
1604
- * let attempt = 0
1605
- *
1606
- * yield* Effect.repeat(
1607
- * Effect.gen(function*() {
1608
- * attempt++
1609
- * yield* Console.log("Complex scheduled task...")
1610
- * if (attempt === 1) {
1611
- * return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
1612
- * }
1613
- * return "success"
1614
- * }),
1615
- * complexCron.pipe(Schedule.upTo({ times: 3 }))
1616
- * ).pipe(
1617
- * Effect.catch((error: unknown) =>
1618
- * Console.log(`Cron task error: ${String(error)}`)
1619
- * )
1620
- * )
1621
- * })
897
+ * Schedule.isSchedule(everyMinute) // => true
1622
898
  * ```
1623
899
  *
1624
900
  * @category constructors
@@ -1631,126 +907,11 @@ export const cron: {
1631
907
  *
1632
908
  * **Example** (Scheduling work with cron expressions)
1633
909
  *
1634
- * ```ts
1635
- * import { Console, Data, Effect, Schedule } from "effect"
1636
- *
1637
- * class ScheduledTaskError extends Data.TaggedError("ScheduledTaskError")<{ readonly message: string }> {}
910
+ * ```ts import.meta.vitest
911
+ * import { Schedule } from "effect"
1638
912
  *
1639
- * // Run every minute
1640
913
  * const everyMinute = Schedule.cron("* * * * *")
1641
- *
1642
- * const minutelyProgram = Effect.gen(function*() {
1643
- * yield* Effect.repeat(
1644
- * Effect.gen(function*() {
1645
- * yield* Console.log("Running minutely task")
1646
- * return "minute"
1647
- * }),
1648
- * everyMinute.pipe(
1649
- * Schedule.upTo({ times: 3 }), // Run only 3 times for demo
1650
- * Schedule.tap(({ output: duration }) =>
1651
- * Console.log(`Next execution in: ${duration}`)
1652
- * )
1653
- * )
1654
- * )
1655
- * })
1656
- *
1657
- * // Run every day at 2:30 AM
1658
- * const dailyBackup = Schedule.cron("30 2 * * *")
1659
- *
1660
- * const backupProgram = Effect.gen(function*() {
1661
- * yield* Effect.repeat(
1662
- * Effect.gen(function*() {
1663
- * yield* Console.log("Running daily backup...")
1664
- * // Simulate backup process
1665
- * yield* Effect.sleep("2 seconds")
1666
- * yield* Console.log("Backup completed")
1667
- * return "backup-done"
1668
- * }),
1669
- * dailyBackup.pipe(
1670
- * Schedule.upTo({ times: 2 }) // Run 2 times for demo
1671
- * )
1672
- * )
1673
- * })
1674
- *
1675
- * // Run every Monday at 9:00 AM with timezone
1676
- * const weeklyReport = Schedule.cron("0 9 * * 1", "America/New_York")
1677
- *
1678
- * const reportProgram = Effect.gen(function*() {
1679
- * yield* Effect.repeat(
1680
- * Effect.gen(function*() {
1681
- * yield* Console.log("Generating weekly report...")
1682
- * const report = {
1683
- * week: 42,
1684
- * status: "ready" as const
1685
- * }
1686
- * yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
1687
- * return report
1688
- * }),
1689
- * weeklyReport.pipe(Schedule.upTo({ times: 1 }))
1690
- * )
1691
- * })
1692
- *
1693
- * // Run every 15 minutes during business hours (9 AM - 5 PM)
1694
- * const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
1695
- *
1696
- * const businessProgram = Effect.gen(function*() {
1697
- * const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
1698
- * let index = 0
1699
- *
1700
- * yield* Effect.repeat(
1701
- * Effect.gen(function*() {
1702
- * yield* Console.log("Business hours health check...")
1703
- * const status = statuses[index++]
1704
- * yield* Console.log(`System status: ${status}`)
1705
- * return status
1706
- * }),
1707
- * businessHoursCheck.pipe(
1708
- * Schedule.upTo({ times: 4 }) // Demo with 4 checks
1709
- * )
1710
- * )
1711
- * })
1712
- *
1713
- * // Run on specific days of the month
1714
- * const monthlyInvoice = Schedule.cron("0 10 1,15 * *") // 1st and 15th at 10 AM
1715
- *
1716
- * const invoiceProgram = Effect.gen(function*() {
1717
- * yield* Effect.repeat(
1718
- * Effect.gen(function*() {
1719
- * yield* Console.log("Processing monthly invoices...")
1720
- * const invoiceCount = 72
1721
- * yield* Console.log(`Processed ${invoiceCount} invoices`)
1722
- * return { count: invoiceCount, batch: "2024-01-a" }
1723
- * }),
1724
- * monthlyInvoice.pipe(Schedule.upTo({ times: 1 }))
1725
- * )
1726
- * })
1727
- *
1728
- * // Complex cron with error handling
1729
- * const complexCron = Schedule.cron("0 2,4,6 * * *").pipe(
1730
- * Schedule.tap(({ output: duration }) =>
1731
- * Console.log(`Scheduled to run again in ${duration}`)
1732
- * )
1733
- * )
1734
- *
1735
- * const robustProgram = Effect.gen(function*() {
1736
- * let attempt = 0
1737
- *
1738
- * yield* Effect.repeat(
1739
- * Effect.gen(function*() {
1740
- * attempt++
1741
- * yield* Console.log("Complex scheduled task...")
1742
- * if (attempt === 1) {
1743
- * return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
1744
- * }
1745
- * return "success"
1746
- * }),
1747
- * complexCron.pipe(Schedule.upTo({ times: 3 }))
1748
- * ).pipe(
1749
- * Effect.catch((error: unknown) =>
1750
- * Console.log(`Cron task error: ${String(error)}`)
1751
- * )
1752
- * )
1753
- * })
914
+ * Schedule.isSchedule(everyMinute) // => true
1754
915
  * ```
1755
916
  *
1756
917
  * @category constructors
@@ -1785,13 +946,10 @@ export const cron: {
1785
946
  *
1786
947
  * **Example** (Recurring once after a duration)
1787
948
  *
1788
- * ```ts
1789
- * import { Console, Effect, Schedule } from "effect"
949
+ * ```ts import.meta.vitest
950
+ * import { Schedule } from "effect"
1790
951
  *
1791
- * const program = Effect.repeat(
1792
- * Console.log("runs again after one second"),
1793
- * Schedule.duration("1 second")
1794
- * )
952
+ * Schedule.isSchedule(Schedule.duration("1 second")) // => true
1795
953
  * ```
1796
954
  *
1797
955
  * @see {@link during} for recurring until a duration has elapsed
@@ -1818,82 +976,10 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
1818
976
  *
1819
977
  * **Example** (Repeating work during a duration)
1820
978
  *
1821
- * ```ts
1822
- * import { Console, Data, Effect, Schedule } from "effect"
1823
- *
1824
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
1825
- *
1826
- * // Run a task for exactly 5 seconds, regardless of how many iterations
1827
- * const fiveSecondSchedule = Schedule.during("5 seconds")
1828
- *
1829
- * const timedProgram = Effect.gen(function*() {
1830
- * yield* Effect.repeat(
1831
- * Effect.gen(function*() {
1832
- * yield* Console.log("Task executed inside the time window")
1833
- * yield* Effect.sleep("500 millis") // Each task takes 500ms
1834
- * return "task done"
1835
- * }),
1836
- * fiveSecondSchedule.pipe(
1837
- * Schedule.tap(({ output: elapsedDuration }) =>
1838
- * Console.log(`Total elapsed: ${elapsedDuration}`)
1839
- * )
1840
- * )
1841
- * )
1842
- *
1843
- * yield* Console.log("Time limit reached!")
1844
- * })
1845
- *
1846
- * // Combine with other schedules for time-bounded execution
1847
- * const timeAndCountLimited = Schedule.max([
1848
- * Schedule.spaced("1 second"),
1849
- * Schedule.during("10 seconds"), // Stop after 10 seconds OR
1850
- * Schedule.recurs(15) // 15 attempts, whichever comes first
1851
- * ])
1852
- *
1853
- * // Burst execution within time window
1854
- * const burstWindow = Schedule.during("3 seconds")
1855
- *
1856
- * const burstProgram = Effect.gen(function*() {
1857
- * yield* Console.log("Starting burst execution...")
1858
- *
1859
- * yield* Effect.repeat(
1860
- * Effect.gen(function*() {
1861
- * yield* Console.log("Burst task")
1862
- * return "burst"
1863
- * }),
1864
- * burstWindow
1865
- * )
1866
- *
1867
- * yield* Console.log("Burst window completed")
1868
- * })
1869
- *
1870
- * // Timed retry window - retry for up to 30 seconds
1871
- * const timedRetry = Schedule.max([
1872
- * Schedule.exponential("200 millis"),
1873
- * Schedule.during("30 seconds")
1874
- * ])
1875
- *
1876
- * const retryProgram = Effect.gen(function*() {
1877
- * let attempt = 0
1878
- *
1879
- * const result = yield* Effect.retry(
1880
- * Effect.gen(function*() {
1881
- * attempt++
1882
- * yield* Console.log(`Retry attempt ${attempt}`)
1883
- *
1884
- * if (attempt < 4) {
1885
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
1886
- * }
1887
- *
1888
- * return `Success on attempt ${attempt}`
1889
- * }),
1890
- * timedRetry
1891
- * )
979
+ * ```ts import.meta.vitest
980
+ * import { Schedule } from "effect"
1892
981
  *
1893
- * yield* Console.log(`Result: ${result}`)
1894
- * }).pipe(
1895
- * Effect.catch((error: unknown) => Console.log(`Timed out: ${String(error)}`))
1896
- * )
982
+ * Schedule.isSchedule(Schedule.during("5 seconds")) // => true
1897
983
  * ```
1898
984
  *
1899
985
  * @see {@link duration} for one delayed recurrence
@@ -1907,8 +993,8 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
1907
993
  effect.succeed((meta) => {
1908
994
  const elapsed = Duration.millis(meta.elapsed)
1909
995
  return meta.elapsed > durationMillis
1910
- ? effect.succeed([elapsed, Duration.zero])
1911
- : Cause.done(elapsed)
996
+ ? Cause.done(elapsed)
997
+ : effect.succeed([elapsed, Duration.zero])
1912
998
  })
1913
999
  )
1914
1000
  }
@@ -1924,36 +1010,11 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
1924
1010
  *
1925
1011
  * **Example** (Combining retry schedules by their minimum delay)
1926
1012
  *
1927
- * ```ts
1928
- * import { Console, Data, Effect, Schedule } from "effect"
1929
- *
1930
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
1931
- *
1932
- * const retrySchedule = Schedule.min([
1933
- * Schedule.fixed("5 seconds"),
1934
- * Schedule.exponential("5 seconds"),
1935
- * Schedule.spaced("10 seconds")
1936
- * ])
1013
+ * ```ts import.meta.vitest
1014
+ * import { Schedule } from "effect"
1937
1015
  *
1938
- * const program = Effect.gen(function*() {
1939
- * let attempt = 0
1940
- *
1941
- * yield* Effect.retry(
1942
- * Effect.gen(function*() {
1943
- * attempt++
1944
- * yield* Console.log(`Retry attempt ${attempt}`)
1945
- * if (attempt < 3) {
1946
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
1947
- * }
1948
- * return "success"
1949
- * }),
1950
- * retrySchedule.pipe(
1951
- * Schedule.tap(({ output: duration }) =>
1952
- * Console.log(`Waiting for the fastest schedule: ${duration}`)
1953
- * )
1954
- * )
1955
- * )
1956
- * })
1016
+ * const schedule = Schedule.min([Schedule.fixed("5 seconds"), Schedule.spaced("10 seconds")])
1017
+ * Schedule.isSchedule(schedule) // => true
1957
1018
  * ```
1958
1019
  *
1959
1020
  * @category combining
@@ -2012,44 +1073,15 @@ const minDuration = (results: ReadonlyArray<Duration.Duration | undefined>): Dur
2012
1073
  *
2013
1074
  * **Example** (Retrying with exponential backoff)
2014
1075
  *
2015
- * ```ts
2016
- * import { Console, Data, Effect, Schedule } from "effect"
2017
- *
2018
- * class RetryFailure extends Data.TaggedError("RetryFailure")<{ readonly message: string }> {}
2019
- *
2020
- * // Basic exponential backoff with default factor of 2
2021
- * const basicExponential = Schedule.exponential("100 millis")
2022
- * // Delays: 100ms, 200ms, 400ms, 800ms, 1600ms, ...
2023
- *
2024
- * // Custom exponential backoff with factor 1.5
2025
- * const gentleExponential = Schedule.exponential("200 millis", 1.5)
2026
- * // Delays: 200ms, 300ms, 450ms, 675ms, 1012ms, ...
2027
- *
2028
- * // Retry with exponential backoff (limited to 5 attempts)
2029
- * const retryPolicy = Schedule.max([
2030
- * Schedule.exponential("50 millis"),
2031
- * Schedule.recurs(5)
2032
- * ])
1076
+ * ```ts import.meta.vitest
1077
+ * import { Duration, Effect, Schedule } from "effect"
2033
1078
  *
2034
1079
  * const program = Effect.gen(function*() {
2035
- * let attempt = 0
2036
- *
2037
- * const result = yield* Effect.retry(
2038
- * Effect.gen(function*() {
2039
- * attempt++
2040
- * if (attempt < 4) {
2041
- * yield* Console.log(`Attempt ${attempt} failed, retrying...`)
2042
- * return yield* Effect.fail(new RetryFailure({ message: `Failure ${attempt}` }))
2043
- * }
2044
- * return `Success on attempt ${attempt}`
2045
- * }),
2046
- * retryPolicy
2047
- * )
2048
- *
2049
- * yield* Console.log(`Final result: ${result}`)
1080
+ * const step = yield* Schedule.toStep(Schedule.exponential("100 millis"))
1081
+ * return yield* step(0, undefined)
2050
1082
  * })
2051
1083
  *
2052
- * // Will retry with delays: 50ms, 100ms, 200ms before success
1084
+ * await Effect.runPromise(program) // => [Duration.millis(100), Duration.millis(100)]
2053
1085
  * ```
2054
1086
  *
2055
1087
  * @category constructors
@@ -2073,63 +1105,15 @@ export const exponential = (
2073
1105
  *
2074
1106
  * **Example** (Retrying with Fibonacci backoff)
2075
1107
  *
2076
- * ```ts
2077
- * import { Console, Data, Effect, Schedule } from "effect"
2078
- *
2079
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
2080
- *
2081
- * // Basic Fibonacci schedule starting with 100ms
2082
- * const fibSchedule = Schedule.fibonacci("100 millis")
2083
- * // Delays: 100ms, 100ms, 200ms, 300ms, 500ms, 800ms, 1300ms, ...
2084
- *
2085
- * // Retry with Fibonacci backoff for gradual increase
2086
- * const retryWithFib = Effect.gen(function*() {
2087
- * let attempt = 0
1108
+ * ```ts import.meta.vitest
1109
+ * import { Duration, Effect, Schedule } from "effect"
2088
1110
  *
2089
- * const result = yield* Effect.retry(
2090
- * Effect.gen(function*() {
2091
- * attempt++
2092
- * yield* Console.log(`Attempt ${attempt}`)
2093
- *
2094
- * if (attempt < 5) {
2095
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
2096
- * }
2097
- *
2098
- * return `Success on attempt ${attempt}`
2099
- * }),
2100
- * Schedule.max([
2101
- * Schedule.fibonacci("50 millis"),
2102
- * Schedule.recurs(6) // Maximum 6 retries
2103
- * ]).pipe(
2104
- * Schedule.tap(({ output: delay }) => Console.log(`Next retry in ${delay}`))
2105
- * )
2106
- * )
2107
- *
2108
- * yield* Console.log(`Final result: ${result}`)
1111
+ * const program = Effect.gen(function*() {
1112
+ * const step = yield* Schedule.toStep(Schedule.fibonacci("100 millis"))
1113
+ * return yield* step(0, undefined)
2109
1114
  * })
2110
1115
  *
2111
- * // Heartbeat with Fibonacci intervals (starts fast, gets slower)
2112
- * const adaptiveHeartbeat = Effect.gen(function*() {
2113
- * yield* Console.log("Heartbeat")
2114
- * return "pulse"
2115
- * }).pipe(
2116
- * Effect.repeat(
2117
- * Schedule.fibonacci("200 millis").pipe(
2118
- * Schedule.upTo({ times: 8 }) // First 8 heartbeats
2119
- * )
2120
- * )
2121
- * )
2122
- *
2123
- * // Fibonacci vs exponential comparison
2124
- * const compareSchedules = Effect.gen(function*() {
2125
- * yield* Console.log("=== Fibonacci Delays ===")
2126
- * // 100ms, 100ms, 200ms, 300ms, 500ms, 800ms
2127
- *
2128
- * yield* Console.log("=== Exponential Delays ===")
2129
- * // 100ms, 200ms, 400ms, 800ms, 1600ms, 3200ms
2130
- *
2131
- * // Fibonacci grows more slowly than exponential
2132
- * })
1116
+ * await Effect.runPromise(program) // => [Duration.millis(100), Duration.millis(100)]
2133
1117
  * ```
2134
1118
  *
2135
1119
  * @category constructors
@@ -2170,50 +1154,15 @@ export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
2170
1154
  *
2171
1155
  * **Example** (Repeating on fixed intervals)
2172
1156
  *
2173
- * ```ts
2174
- * import { Console, Effect, Schedule } from "effect"
2175
- *
2176
- * // Fixed interval schedule - recurs on a one-second cadence
2177
- * const everySecond = Schedule.fixed("1 second")
2178
- *
2179
- * // Health check that runs at fixed intervals
2180
- * const healthCheck = Effect.gen(function*() {
2181
- * yield* Console.log("Health check")
2182
- * yield* Effect.sleep("200 millis") // simulate health check work
2183
- * return "healthy"
2184
- * }).pipe(
2185
- * Effect.repeat(Schedule.fixed("2 seconds").pipe(Schedule.upTo({ times: 5 })))
2186
- * )
2187
- *
2188
- * // Difference between fixed and spaced:
2189
- * // - fixed: maintains constant rate regardless of action duration
2190
- * // - spaced: waits for the duration AFTER each action completes
2191
- *
2192
- * const longRunningTask = Effect.gen(function*() {
2193
- * yield* Console.log("Task started")
2194
- * yield* Effect.sleep("1.5 seconds") // Longer than interval
2195
- * yield* Console.log("Task completed")
2196
- * return "done"
2197
- * })
2198
- *
2199
- * // Fixed schedule: if task takes 1.5s but interval is 1s,
2200
- * // next execution happens immediately (no pile-up)
2201
- * const fixedSchedule = longRunningTask.pipe(
2202
- * Effect.repeat(Schedule.fixed("1 second").pipe(Schedule.upTo({ times: 3 })))
2203
- * )
2204
- *
2205
- * // Comparing with spaced (waits 1s AFTER each task)
2206
- * const spacedSchedule = longRunningTask.pipe(
2207
- * Effect.repeat(Schedule.spaced("1 second").pipe(Schedule.upTo({ times: 3 })))
2208
- * )
1157
+ * ```ts import.meta.vitest
1158
+ * import { Duration, Effect, Schedule } from "effect"
2209
1159
  *
2210
1160
  * const program = Effect.gen(function*() {
2211
- * yield* Console.log("=== Fixed Schedule Demo ===")
2212
- * yield* fixedSchedule
2213
- *
2214
- * yield* Console.log("=== Spaced Schedule Demo ===")
2215
- * yield* spacedSchedule
1161
+ * const step = yield* Schedule.toStep(Schedule.fixed("1 second"))
1162
+ * return yield* step(0, undefined)
2216
1163
  * })
1164
+ *
1165
+ * await Effect.runPromise(program) // => [0, Duration.seconds(1)]
2217
1166
  * ```
2218
1167
  *
2219
1168
  * @see {@link spaced} for delaying after each action completes
@@ -2257,59 +1206,19 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
2257
1206
  *
2258
1207
  * **Example** (Mapping schedule outputs)
2259
1208
  *
2260
- * ```ts
2261
- * import { Console, Effect, Schedule } from "effect"
1209
+ * ```ts import.meta.vitest
1210
+ * import { Effect, Schedule } from "effect"
2262
1211
  *
2263
- * // Transform schedule output from number to string
2264
1212
  * const countSchedule = Schedule.recurs(5).pipe(
2265
1213
  * Schedule.map(({ output: count }) => Effect.succeed(`Execution #${count + 1}`))
2266
1214
  * )
2267
- *
2268
- * // Map schedule delays to human-readable format
2269
- * const readableDelays = Schedule.exponential("100 millis").pipe(
2270
- * Schedule.map(({ output: delay }) => Effect.succeed(`Next retry in ${delay}`))
2271
- * )
2272
- *
2273
- * // Transform numeric output to structured data
2274
- * const structuredSchedule = Schedule.spaced("1 second").pipe(
2275
- * Schedule.map(({ output: recurrence }) => Effect.succeed({
2276
- * iteration: recurrence + 1,
2277
- * phase: recurrence < 5 ? "warmup" as const : "steady" as const
2278
- * }))
2279
- * )
2280
- *
2281
1215
  * const program = Effect.gen(function*() {
2282
- * const results = yield* Effect.repeat(
2283
- * Effect.succeed("task completed"),
2284
- * structuredSchedule.pipe(
2285
- * Schedule.upTo({ times: 8 }),
2286
- * Schedule.tap(({ output: info }) =>
2287
- * Console.log(
2288
- * `${info.phase} phase - iteration ${info.iteration}`
2289
- * )
2290
- * )
2291
- * )
2292
- * )
2293
- *
2294
- * yield* Console.log(`Completed iterations`)
1216
+ * const step = yield* Schedule.toStep(countSchedule)
1217
+ * const [output] = yield* step(0, undefined)
1218
+ * return output
2295
1219
  * })
2296
1220
  *
2297
- * // Map with effectful transformation
2298
- * const effectfulMap = Schedule.fixed("2 seconds").pipe(
2299
- * Schedule.map(({ output: count }) =>
2300
- * Effect.gen(function*() {
2301
- * yield* Console.log(`Processing count: ${count}`)
2302
- * return count * 10
2303
- * })
2304
- * )
2305
- * )
2306
- *
2307
- * // Use timing metadata in the mapped output
2308
- * const complexSchedule = Schedule.fibonacci("100 millis").pipe(
2309
- * Schedule.map(({ output: delay, attempt }) =>
2310
- * Effect.succeed(`Attempt ${attempt} delay: ${delay}`)
2311
- * )
2312
- * )
1221
+ * await Effect.runPromise(program) // => "Execution #1"
2313
1222
  * ```
2314
1223
  *
2315
1224
  * @category mapping
@@ -2328,59 +1237,19 @@ export const map: {
2328
1237
  *
2329
1238
  * **Example** (Mapping schedule outputs)
2330
1239
  *
2331
- * ```ts
2332
- * import { Console, Effect, Schedule } from "effect"
1240
+ * ```ts import.meta.vitest
1241
+ * import { Effect, Schedule } from "effect"
2333
1242
  *
2334
- * // Transform schedule output from number to string
2335
1243
  * const countSchedule = Schedule.recurs(5).pipe(
2336
1244
  * Schedule.map(({ output: count }) => Effect.succeed(`Execution #${count + 1}`))
2337
1245
  * )
2338
- *
2339
- * // Map schedule delays to human-readable format
2340
- * const readableDelays = Schedule.exponential("100 millis").pipe(
2341
- * Schedule.map(({ output: delay }) => Effect.succeed(`Next retry in ${delay}`))
2342
- * )
2343
- *
2344
- * // Transform numeric output to structured data
2345
- * const structuredSchedule = Schedule.spaced("1 second").pipe(
2346
- * Schedule.map(({ output: recurrence }) => Effect.succeed({
2347
- * iteration: recurrence + 1,
2348
- * phase: recurrence < 5 ? "warmup" as const : "steady" as const
2349
- * }))
2350
- * )
2351
- *
2352
1246
  * const program = Effect.gen(function*() {
2353
- * const results = yield* Effect.repeat(
2354
- * Effect.succeed("task completed"),
2355
- * structuredSchedule.pipe(
2356
- * Schedule.upTo({ times: 8 }),
2357
- * Schedule.tap(({ output: info }) =>
2358
- * Console.log(
2359
- * `${info.phase} phase - iteration ${info.iteration}`
2360
- * )
2361
- * )
2362
- * )
2363
- * )
2364
- *
2365
- * yield* Console.log(`Completed iterations`)
1247
+ * const step = yield* Schedule.toStep(countSchedule)
1248
+ * const [output] = yield* step(0, undefined)
1249
+ * return output
2366
1250
  * })
2367
1251
  *
2368
- * // Map with effectful transformation
2369
- * const effectfulMap = Schedule.fixed("2 seconds").pipe(
2370
- * Schedule.map(({ output: count }) =>
2371
- * Effect.gen(function*() {
2372
- * yield* Console.log(`Processing count: ${count}`)
2373
- * return count * 10
2374
- * })
2375
- * )
2376
- * )
2377
- *
2378
- * // Use timing metadata in the mapped output
2379
- * const complexSchedule = Schedule.fibonacci("100 millis").pipe(
2380
- * Schedule.map(({ output: delay, attempt }) =>
2381
- * Effect.succeed(`Attempt ${attempt} delay: ${delay}`)
2382
- * )
2383
- * )
1252
+ * await Effect.runPromise(program) // => "Execution #1"
2384
1253
  * ```
2385
1254
  *
2386
1255
  * @category mapping
@@ -2403,59 +1272,19 @@ export const map: {
2403
1272
  *
2404
1273
  * **Example** (Mapping schedule outputs)
2405
1274
  *
2406
- * ```ts
2407
- * import { Console, Effect, Schedule } from "effect"
1275
+ * ```ts import.meta.vitest
1276
+ * import { Effect, Schedule } from "effect"
2408
1277
  *
2409
- * // Transform schedule output from number to string
2410
1278
  * const countSchedule = Schedule.recurs(5).pipe(
2411
1279
  * Schedule.map(({ output: count }) => Effect.succeed(`Execution #${count + 1}`))
2412
1280
  * )
2413
- *
2414
- * // Map schedule delays to human-readable format
2415
- * const readableDelays = Schedule.exponential("100 millis").pipe(
2416
- * Schedule.map(({ output: delay }) => Effect.succeed(`Next retry in ${delay}`))
2417
- * )
2418
- *
2419
- * // Transform numeric output to structured data
2420
- * const structuredSchedule = Schedule.spaced("1 second").pipe(
2421
- * Schedule.map(({ output: recurrence }) => Effect.succeed({
2422
- * iteration: recurrence + 1,
2423
- * phase: recurrence < 5 ? "warmup" as const : "steady" as const
2424
- * }))
2425
- * )
2426
- *
2427
1281
  * const program = Effect.gen(function*() {
2428
- * const results = yield* Effect.repeat(
2429
- * Effect.succeed("task completed"),
2430
- * structuredSchedule.pipe(
2431
- * Schedule.upTo({ times: 8 }),
2432
- * Schedule.tap(({ output: info }) =>
2433
- * Console.log(
2434
- * `${info.phase} phase - iteration ${info.iteration}`
2435
- * )
2436
- * )
2437
- * )
2438
- * )
2439
- *
2440
- * yield* Console.log(`Completed iterations`)
1282
+ * const step = yield* Schedule.toStep(countSchedule)
1283
+ * const [output] = yield* step(0, undefined)
1284
+ * return output
2441
1285
  * })
2442
1286
  *
2443
- * // Map with effectful transformation
2444
- * const effectfulMap = Schedule.fixed("2 seconds").pipe(
2445
- * Schedule.map(({ output: count }) =>
2446
- * Effect.gen(function*() {
2447
- * yield* Console.log(`Processing count: ${count}`)
2448
- * return count * 10
2449
- * })
2450
- * )
2451
- * )
2452
- *
2453
- * // Use timing metadata in the mapped output
2454
- * const complexSchedule = Schedule.fibonacci("100 millis").pipe(
2455
- * Schedule.map(({ output: delay, attempt }) =>
2456
- * Effect.succeed(`Attempt ${attempt} delay: ${delay}`)
2457
- * )
2458
- * )
1287
+ * await Effect.runPromise(program) // => "Execution #1"
2459
1288
  * ```
2460
1289
  *
2461
1290
  * @category mapping
@@ -2493,28 +1322,19 @@ export const map: {
2493
1322
  *
2494
1323
  * **Example** (Modifying delays from schedule metadata)
2495
1324
  *
2496
- * ```ts
2497
- * import { Console, Duration, Effect, Schedule } from "effect"
1325
+ * ```ts import.meta.vitest
1326
+ * import { Duration, Effect, Schedule } from "effect"
2498
1327
  *
2499
- * // Modify delays based on output - increase delay on high iteration counts
2500
- * const adaptiveDelay = Schedule.recurs(10).pipe(
2501
- * Schedule.modifyDelay(({ output, duration }) => {
2502
- * // Double the delay if we're seeing high iteration counts
2503
- * return Effect.succeed(output > 5 ? Duration.times(duration, 2) : duration)
2504
- * })
1328
+ * const schedule = Schedule.spaced("10 millis").pipe(
1329
+ * Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.times(duration, 2)))
2505
1330
  * )
2506
- *
2507
1331
  * const program = Effect.gen(function*() {
2508
- * let counter = 0
2509
- * yield* Effect.repeat(
2510
- * Effect.gen(function*() {
2511
- * counter++
2512
- * yield* Console.log(`Attempt ${counter}`)
2513
- * return counter
2514
- * }),
2515
- * adaptiveDelay.pipe(Schedule.upTo({ times: 8 }))
2516
- * )
1332
+ * const step = yield* Schedule.toStep(schedule)
1333
+ * const [, delay] = yield* step(0, undefined)
1334
+ * return delay
2517
1335
  * })
1336
+ *
1337
+ * await Effect.runPromise(program) // => Duration.millis(20)
2518
1338
  * ```
2519
1339
  *
2520
1340
  * @category delays & timeouts
@@ -2527,28 +1347,19 @@ export const modifyDelay: {
2527
1347
  *
2528
1348
  * **Example** (Modifying delays from schedule metadata)
2529
1349
  *
2530
- * ```ts
2531
- * import { Console, Duration, Effect, Schedule } from "effect"
1350
+ * ```ts import.meta.vitest
1351
+ * import { Duration, Effect, Schedule } from "effect"
2532
1352
  *
2533
- * // Modify delays based on output - increase delay on high iteration counts
2534
- * const adaptiveDelay = Schedule.recurs(10).pipe(
2535
- * Schedule.modifyDelay(({ output, duration }) => {
2536
- * // Double the delay if we're seeing high iteration counts
2537
- * return Effect.succeed(output > 5 ? Duration.times(duration, 2) : duration)
2538
- * })
1353
+ * const schedule = Schedule.spaced("10 millis").pipe(
1354
+ * Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.times(duration, 2)))
2539
1355
  * )
2540
- *
2541
1356
  * const program = Effect.gen(function*() {
2542
- * let counter = 0
2543
- * yield* Effect.repeat(
2544
- * Effect.gen(function*() {
2545
- * counter++
2546
- * yield* Console.log(`Attempt ${counter}`)
2547
- * return counter
2548
- * }),
2549
- * adaptiveDelay.pipe(Schedule.upTo({ times: 8 }))
2550
- * )
1357
+ * const step = yield* Schedule.toStep(schedule)
1358
+ * const [, delay] = yield* step(0, undefined)
1359
+ * return delay
2551
1360
  * })
1361
+ *
1362
+ * await Effect.runPromise(program) // => Duration.millis(20)
2552
1363
  * ```
2553
1364
  *
2554
1365
  * @category delays & timeouts
@@ -2567,28 +1378,19 @@ export const modifyDelay: {
2567
1378
  *
2568
1379
  * **Example** (Modifying delays from schedule metadata)
2569
1380
  *
2570
- * ```ts
2571
- * import { Console, Duration, Effect, Schedule } from "effect"
1381
+ * ```ts import.meta.vitest
1382
+ * import { Duration, Effect, Schedule } from "effect"
2572
1383
  *
2573
- * // Modify delays based on output - increase delay on high iteration counts
2574
- * const adaptiveDelay = Schedule.recurs(10).pipe(
2575
- * Schedule.modifyDelay(({ output, duration }) => {
2576
- * // Double the delay if we're seeing high iteration counts
2577
- * return Effect.succeed(output > 5 ? Duration.times(duration, 2) : duration)
2578
- * })
1384
+ * const schedule = Schedule.spaced("10 millis").pipe(
1385
+ * Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.times(duration, 2)))
2579
1386
  * )
2580
- *
2581
1387
  * const program = Effect.gen(function*() {
2582
- * let counter = 0
2583
- * yield* Effect.repeat(
2584
- * Effect.gen(function*() {
2585
- * counter++
2586
- * yield* Console.log(`Attempt ${counter}`)
2587
- * return counter
2588
- * }),
2589
- * adaptiveDelay.pipe(Schedule.upTo({ times: 8 }))
2590
- * )
1388
+ * const step = yield* Schedule.toStep(schedule)
1389
+ * const [, delay] = yield* step(0, undefined)
1390
+ * return delay
2591
1391
  * })
1392
+ *
1393
+ * await Effect.runPromise(program) // => Duration.millis(20)
2592
1394
  * ```
2593
1395
  *
2594
1396
  * @category delays & timeouts
@@ -2650,25 +1452,19 @@ export const jittered = <Output, Input, Error, Env>(
2650
1452
  *
2651
1453
  * **Example** (Passing inputs through as outputs)
2652
1454
  *
2653
- * ```ts
2654
- * import { Console, Effect, Schedule } from "effect"
1455
+ * ```ts import.meta.vitest
1456
+ * import { Effect, Schedule } from "effect"
2655
1457
  *
2656
- * // Create a schedule that outputs the inputs instead of original outputs
2657
1458
  * const inputSchedule = Schedule.passthrough(
2658
1459
  * Schedule.exponential("100 millis").pipe(Schedule.upTo({ times: 3 }))
2659
1460
  * )
2660
- *
2661
1461
  * const program = Effect.gen(function*() {
2662
- * let counter = 0
2663
- * yield* Effect.repeat(
2664
- * Effect.gen(function*() {
2665
- * counter++
2666
- * yield* Console.log(`Task ${counter} executed`)
2667
- * return `result-${counter}`
2668
- * }),
2669
- * inputSchedule
2670
- * )
1462
+ * const step = yield* Schedule.toStep(inputSchedule)
1463
+ * const [output] = yield* step(0, "input")
1464
+ * return output
2671
1465
  * })
1466
+ *
1467
+ * await Effect.runPromise(program) // => "input"
2672
1468
  * ```
2673
1469
  *
2674
1470
  * @category mapping
@@ -2700,53 +1496,17 @@ export const passthrough = <Output, Input, Error, Env>(
2700
1496
  *
2701
1497
  * **Example** (Limiting recurrences)
2702
1498
  *
2703
- * ```ts
2704
- * import { Console, Data, Effect, Schedule } from "effect"
2705
- *
2706
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
2707
- *
2708
- * // Basic recurs - retry at most 3 times
2709
- * const maxThreeAttempts = Schedule.recurs(3)
2710
- *
2711
- * // Retry a failing operation at most 5 times
2712
- * const program = Effect.gen(function*() {
2713
- * let attempt = 0
2714
- *
2715
- * const result = yield* Effect.retry(
2716
- * Effect.gen(function*() {
2717
- * attempt++
2718
- * yield* Console.log(`Attempt ${attempt}`)
2719
- *
2720
- * if (attempt < 4) {
2721
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
2722
- * }
2723
- *
2724
- * return `Success on attempt ${attempt}`
2725
- * }),
2726
- * Schedule.recurs(5) // Will retry up to 5 times
2727
- * )
2728
- *
2729
- * yield* Console.log(`Final result: ${result}`)
2730
- * })
1499
+ * ```ts import.meta.vitest
1500
+ * import { Effect, Schedule } from "effect"
1501
+ * import { TestClock } from "effect/testing"
2731
1502
  *
2732
- * // Combining recurs with other schedules for sophisticated retry logic
2733
- * const complexRetry = Schedule.max([
2734
- * Schedule.exponential("100 millis"),
2735
- * Schedule.recurs(3) // At most 3 retries
2736
- * ])
2737
- *
2738
- * // Allow ten recurrences after the initial run
2739
- * const tenRecurrences = Effect.gen(function*() {
2740
- * yield* Console.log("Executing task...")
2741
- * return "completed"
2742
- * }).pipe(
2743
- * Effect.repeat(Schedule.recurs(10))
1503
+ * const executions: Array<number> = []
1504
+ * const program = Effect.sync(() => executions.push(executions.length + 1)).pipe(
1505
+ * Effect.repeat(Schedule.recurs(3)),
1506
+ * Effect.as(executions)
2744
1507
  * )
2745
1508
  *
2746
- * // The schedule outputs the current recurrence count (0-based)
2747
- * const countingSchedule = Schedule.recurs(3).pipe(
2748
- * Schedule.tap(({ output: count }) => Console.log(`Execution #${count + 1}`))
2749
- * )
1509
+ * await Effect.runPromise(Effect.provide(program, TestClock.layer())) // => [1, 2, 3, 4]
2750
1510
  * ```
2751
1511
  *
2752
1512
  * @see {@link upTo} for limiting an existing schedule
@@ -2767,46 +1527,15 @@ export const recurs = (times: number): Schedule<number> =>
2767
1527
  *
2768
1528
  * **Example** (Repeating with fixed spacing)
2769
1529
  *
2770
- * ```ts
2771
- * import { Console, Effect, Schedule } from "effect"
2772
- *
2773
- * // Basic spaced schedule - runs every 2 seconds
2774
- * const everyTwoSeconds = Schedule.spaced("2 seconds")
2775
- *
2776
- * // Heartbeat that runs indefinitely with fixed spacing
2777
- * const heartbeat = Effect.gen(function*() {
2778
- * yield* Console.log("Heartbeat")
2779
- * }).pipe(
2780
- * Effect.repeat(everyTwoSeconds)
2781
- * )
2782
- *
2783
- * // Limited repeat - run only 5 times with 1-second spacing
2784
- * const limitedTask = Effect.gen(function*() {
2785
- * yield* Console.log("Executing scheduled task...")
2786
- * yield* Effect.sleep("500 millis") // simulate work
2787
- * return "Task completed"
2788
- * }).pipe(
2789
- * Effect.repeat(
2790
- * Schedule.spaced("1 second").pipe(Schedule.upTo({ times: 5 }))
2791
- * )
2792
- * )
2793
- *
2794
- * // Simple spaced schedule with limited repetitions
2795
- * const limitedSpaced = Schedule.max([
2796
- * Schedule.spaced("100 millis"),
2797
- * Schedule.recurs(5) // at most 5 times
2798
- * ])
1530
+ * ```ts import.meta.vitest
1531
+ * import { Duration, Effect, Schedule } from "effect"
2799
1532
  *
2800
1533
  * const program = Effect.gen(function*() {
2801
- * yield* Console.log("Starting spaced execution...")
2802
- *
2803
- * yield* Effect.repeat(
2804
- * Effect.succeed("work item"),
2805
- * limitedSpaced
2806
- * )
2807
- *
2808
- * yield* Console.log("Completed executions")
1534
+ * const step = yield* Schedule.toStep(Schedule.spaced("2 seconds"))
1535
+ * return yield* step(0, undefined)
2809
1536
  * })
1537
+ *
1538
+ * await Effect.runPromise(program) // => [0, Duration.seconds(2)]
2810
1539
  * ```
2811
1540
  *
2812
1541
  * @see {@link fixed} for recurrence aligned to a regular cadence
@@ -2831,23 +1560,20 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
2831
1560
  *
2832
1561
  * **Example** (Tapping schedule metadata)
2833
1562
  *
2834
- * ```ts
2835
- * import { Console, Effect, Schedule } from "effect"
2836
- *
2837
- * const monitoredSchedule = Schedule.exponential("100 millis").pipe(
2838
- * Schedule.upTo({ times: 5 }),
2839
- * Schedule.tap((metadata) =>
2840
- * Console.log(
2841
- * `Attempt ${metadata.attempt} produced ${metadata.output} ` +
2842
- * `after ${metadata.elapsed}ms; next delay is ${metadata.duration}`
2843
- * )
2844
- * )
2845
- * )
1563
+ * ```ts import.meta.vitest
1564
+ * import { Effect, Schedule } from "effect"
2846
1565
  *
2847
- * const program = Effect.retry(
2848
- * Effect.fail("transient error"),
2849
- * monitoredSchedule
1566
+ * const attempts: Array<number> = []
1567
+ * const monitoredSchedule = Schedule.recurs(2).pipe(
1568
+ * Schedule.tap((metadata) => Effect.sync(() => attempts.push(metadata.attempt)))
2850
1569
  * )
1570
+ * const program = Effect.gen(function*() {
1571
+ * const step = yield* Schedule.toStep(monitoredSchedule)
1572
+ * const [output] = yield* step(0, undefined)
1573
+ * return { attempts, output }
1574
+ * })
1575
+ *
1576
+ * await Effect.runPromise(program) // => { attempts: [1], output: 0 }
2851
1577
  * ```
2852
1578
  *
2853
1579
  * @category sequencing
@@ -2866,23 +1592,20 @@ export const tap: {
2866
1592
  *
2867
1593
  * **Example** (Tapping schedule metadata)
2868
1594
  *
2869
- * ```ts
2870
- * import { Console, Effect, Schedule } from "effect"
2871
- *
2872
- * const monitoredSchedule = Schedule.exponential("100 millis").pipe(
2873
- * Schedule.upTo({ times: 5 }),
2874
- * Schedule.tap((metadata) =>
2875
- * Console.log(
2876
- * `Attempt ${metadata.attempt} produced ${metadata.output} ` +
2877
- * `after ${metadata.elapsed}ms; next delay is ${metadata.duration}`
2878
- * )
2879
- * )
2880
- * )
1595
+ * ```ts import.meta.vitest
1596
+ * import { Effect, Schedule } from "effect"
2881
1597
  *
2882
- * const program = Effect.retry(
2883
- * Effect.fail("transient error"),
2884
- * monitoredSchedule
1598
+ * const attempts: Array<number> = []
1599
+ * const monitoredSchedule = Schedule.recurs(2).pipe(
1600
+ * Schedule.tap((metadata) => Effect.sync(() => attempts.push(metadata.attempt)))
2885
1601
  * )
1602
+ * const program = Effect.gen(function*() {
1603
+ * const step = yield* Schedule.toStep(monitoredSchedule)
1604
+ * const [output] = yield* step(0, undefined)
1605
+ * return { attempts, output }
1606
+ * })
1607
+ *
1608
+ * await Effect.runPromise(program) // => { attempts: [1], output: 0 }
2886
1609
  * ```
2887
1610
  *
2888
1611
  * @category sequencing
@@ -2903,23 +1626,20 @@ export const tap: {
2903
1626
  *
2904
1627
  * **Example** (Tapping schedule metadata)
2905
1628
  *
2906
- * ```ts
2907
- * import { Console, Effect, Schedule } from "effect"
2908
- *
2909
- * const monitoredSchedule = Schedule.exponential("100 millis").pipe(
2910
- * Schedule.upTo({ times: 5 }),
2911
- * Schedule.tap((metadata) =>
2912
- * Console.log(
2913
- * `Attempt ${metadata.attempt} produced ${metadata.output} ` +
2914
- * `after ${metadata.elapsed}ms; next delay is ${metadata.duration}`
2915
- * )
2916
- * )
2917
- * )
1629
+ * ```ts import.meta.vitest
1630
+ * import { Effect, Schedule } from "effect"
2918
1631
  *
2919
- * const program = Effect.retry(
2920
- * Effect.fail("transient error"),
2921
- * monitoredSchedule
1632
+ * const attempts: Array<number> = []
1633
+ * const monitoredSchedule = Schedule.recurs(2).pipe(
1634
+ * Schedule.tap((metadata) => Effect.sync(() => attempts.push(metadata.attempt)))
2922
1635
  * )
1636
+ * const program = Effect.gen(function*() {
1637
+ * const step = yield* Schedule.toStep(monitoredSchedule)
1638
+ * const [output] = yield* step(0, undefined)
1639
+ * return { attempts, output }
1640
+ * })
1641
+ *
1642
+ * await Effect.runPromise(program) // => { attempts: [1], output: 0 }
2923
1643
  * ```
2924
1644
  *
2925
1645
  * @category sequencing
@@ -2962,64 +1682,18 @@ export const tap: {
2962
1682
  *
2963
1683
  * **Example** (Limiting by duration and recurrence count)
2964
1684
  *
2965
- * ```ts
2966
- * import { Console, Data, Effect, Schedule } from "effect"
2967
- *
2968
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
2969
- *
2970
- * // Limit an infinite schedule to five recurrences
2971
- * const limitedHeartbeat = Schedule.spaced("1 second").pipe(
2972
- * Schedule.upTo({ times: 5 })
2973
- * )
2974
- *
2975
- * const heartbeatProgram = Effect.gen(function*() {
2976
- * yield* Effect.repeat(
2977
- * Effect.gen(function*() {
2978
- * yield* Console.log("Heartbeat")
2979
- * return "pulse"
2980
- * }),
2981
- * limitedHeartbeat
2982
- * )
2983
- *
2984
- * yield* Console.log("Heartbeat sequence completed")
2985
- * })
2986
- *
2987
- * // Limit retry attempts by both count and elapsed time
2988
- * const limitedRetry = Schedule.exponential("100 millis").pipe(
2989
- * Schedule.upTo({
2990
- * duration: "5 seconds",
2991
- * times: 3
2992
- * })
2993
- * )
2994
- *
2995
- * const retryProgram = Effect.gen(function*() {
2996
- * let attempt = 0
2997
- *
2998
- * const result = yield* Effect.retry(
2999
- * Effect.gen(function*() {
3000
- * attempt++
3001
- * yield* Console.log(`Attempt ${attempt}`)
3002
- *
3003
- * if (attempt < 5) { // Will fail more than 3 times
3004
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
3005
- * }
3006
- *
3007
- * return `Success on attempt ${attempt}`
3008
- * }),
3009
- * limitedRetry
3010
- * )
1685
+ * ```ts import.meta.vitest
1686
+ * import { Effect, Schedule } from "effect"
1687
+ * import { TestClock } from "effect/testing"
3011
1688
  *
3012
- * yield* Console.log(`Result: ${result}`)
3013
- * }).pipe(
3014
- * Effect.catch((error: unknown) =>
3015
- * Console.log(`Failed after limited retries: ${String(error)}`)
3016
- * )
1689
+ * const executions: Array<number> = []
1690
+ * const schedule = Schedule.forever.pipe(Schedule.upTo({ times: 2 }))
1691
+ * const program = Effect.sync(() => executions.push(executions.length + 1)).pipe(
1692
+ * Effect.repeat(schedule),
1693
+ * Effect.as(executions)
3017
1694
  * )
3018
1695
  *
3019
- * // Empty options leave the schedule unchanged
3020
- * const unchanged = Schedule.fixed("500 millis").pipe(
3021
- * Schedule.upTo({})
3022
- * )
1696
+ * await Effect.runPromise(Effect.provide(program, TestClock.layer())) // => [1, 2, 3]
3023
1697
  * ```
3024
1698
  *
3025
1699
  * @category filtering
@@ -3049,64 +1723,18 @@ export const upTo: {
3049
1723
  *
3050
1724
  * **Example** (Limiting by duration and recurrence count)
3051
1725
  *
3052
- * ```ts
3053
- * import { Console, Data, Effect, Schedule } from "effect"
3054
- *
3055
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
3056
- *
3057
- * // Limit an infinite schedule to five recurrences
3058
- * const limitedHeartbeat = Schedule.spaced("1 second").pipe(
3059
- * Schedule.upTo({ times: 5 })
3060
- * )
3061
- *
3062
- * const heartbeatProgram = Effect.gen(function*() {
3063
- * yield* Effect.repeat(
3064
- * Effect.gen(function*() {
3065
- * yield* Console.log("Heartbeat")
3066
- * return "pulse"
3067
- * }),
3068
- * limitedHeartbeat
3069
- * )
3070
- *
3071
- * yield* Console.log("Heartbeat sequence completed")
3072
- * })
3073
- *
3074
- * // Limit retry attempts by both count and elapsed time
3075
- * const limitedRetry = Schedule.exponential("100 millis").pipe(
3076
- * Schedule.upTo({
3077
- * duration: "5 seconds",
3078
- * times: 3
3079
- * })
3080
- * )
3081
- *
3082
- * const retryProgram = Effect.gen(function*() {
3083
- * let attempt = 0
3084
- *
3085
- * const result = yield* Effect.retry(
3086
- * Effect.gen(function*() {
3087
- * attempt++
3088
- * yield* Console.log(`Attempt ${attempt}`)
3089
- *
3090
- * if (attempt < 5) { // Will fail more than 3 times
3091
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
3092
- * }
3093
- *
3094
- * return `Success on attempt ${attempt}`
3095
- * }),
3096
- * limitedRetry
3097
- * )
1726
+ * ```ts import.meta.vitest
1727
+ * import { Effect, Schedule } from "effect"
1728
+ * import { TestClock } from "effect/testing"
3098
1729
  *
3099
- * yield* Console.log(`Result: ${result}`)
3100
- * }).pipe(
3101
- * Effect.catch((error: unknown) =>
3102
- * Console.log(`Failed after limited retries: ${String(error)}`)
3103
- * )
1730
+ * const executions: Array<number> = []
1731
+ * const schedule = Schedule.forever.pipe(Schedule.upTo({ times: 2 }))
1732
+ * const program = Effect.sync(() => executions.push(executions.length + 1)).pipe(
1733
+ * Effect.repeat(schedule),
1734
+ * Effect.as(executions)
3104
1735
  * )
3105
1736
  *
3106
- * // Empty options leave the schedule unchanged
3107
- * const unchanged = Schedule.fixed("500 millis").pipe(
3108
- * Schedule.upTo({})
3109
- * )
1737
+ * await Effect.runPromise(Effect.provide(program, TestClock.layer())) // => [1, 2, 3]
3110
1738
  * ```
3111
1739
  *
3112
1740
  * @category filtering
@@ -3143,64 +1771,18 @@ export const upTo: {
3143
1771
  *
3144
1772
  * **Example** (Limiting by duration and recurrence count)
3145
1773
  *
3146
- * ```ts
3147
- * import { Console, Data, Effect, Schedule } from "effect"
3148
- *
3149
- * class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
3150
- *
3151
- * // Limit an infinite schedule to five recurrences
3152
- * const limitedHeartbeat = Schedule.spaced("1 second").pipe(
3153
- * Schedule.upTo({ times: 5 })
3154
- * )
3155
- *
3156
- * const heartbeatProgram = Effect.gen(function*() {
3157
- * yield* Effect.repeat(
3158
- * Effect.gen(function*() {
3159
- * yield* Console.log("Heartbeat")
3160
- * return "pulse"
3161
- * }),
3162
- * limitedHeartbeat
3163
- * )
3164
- *
3165
- * yield* Console.log("Heartbeat sequence completed")
3166
- * })
3167
- *
3168
- * // Limit retry attempts by both count and elapsed time
3169
- * const limitedRetry = Schedule.exponential("100 millis").pipe(
3170
- * Schedule.upTo({
3171
- * duration: "5 seconds",
3172
- * times: 3
3173
- * })
3174
- * )
3175
- *
3176
- * const retryProgram = Effect.gen(function*() {
3177
- * let attempt = 0
3178
- *
3179
- * const result = yield* Effect.retry(
3180
- * Effect.gen(function*() {
3181
- * attempt++
3182
- * yield* Console.log(`Attempt ${attempt}`)
3183
- *
3184
- * if (attempt < 5) { // Will fail more than 3 times
3185
- * return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
3186
- * }
3187
- *
3188
- * return `Success on attempt ${attempt}`
3189
- * }),
3190
- * limitedRetry
3191
- * )
1774
+ * ```ts import.meta.vitest
1775
+ * import { Effect, Schedule } from "effect"
1776
+ * import { TestClock } from "effect/testing"
3192
1777
  *
3193
- * yield* Console.log(`Result: ${result}`)
3194
- * }).pipe(
3195
- * Effect.catch((error: unknown) =>
3196
- * Console.log(`Failed after limited retries: ${String(error)}`)
3197
- * )
1778
+ * const executions: Array<number> = []
1779
+ * const schedule = Schedule.forever.pipe(Schedule.upTo({ times: 2 }))
1780
+ * const program = Effect.sync(() => executions.push(executions.length + 1)).pipe(
1781
+ * Effect.repeat(schedule),
1782
+ * Effect.as(executions)
3198
1783
  * )
3199
1784
  *
3200
- * // Empty options leave the schedule unchanged
3201
- * const unchanged = Schedule.fixed("500 millis").pipe(
3202
- * Schedule.upTo({})
3203
- * )
1785
+ * await Effect.runPromise(Effect.provide(program, TestClock.layer())) // => [1, 2, 3]
3204
1786
  * ```
3205
1787
  *
3206
1788
  * @category filtering
@@ -3301,21 +1883,15 @@ export {
3301
1883
  *
3302
1884
  * **Example** (Repeating on aligned windows)
3303
1885
  *
3304
- * ```ts
3305
- * import { Console, Effect, Schedule } from "effect"
3306
- *
3307
- * // Execute tasks at regular intervals aligned to window boundaries
3308
- * const windowSchedule = Schedule.windowed("5 seconds")
1886
+ * ```ts import.meta.vitest
1887
+ * import { Duration, Effect, Schedule } from "effect"
3309
1888
  *
3310
1889
  * const program = Effect.gen(function*() {
3311
- * yield* Effect.repeat(
3312
- * Effect.gen(function*() {
3313
- * yield* Console.log("Window task executed")
3314
- * return "window-task"
3315
- * }),
3316
- * windowSchedule.pipe(Schedule.upTo({ times: 4 }))
3317
- * )
1890
+ * const step = yield* Schedule.toStep(Schedule.windowed("5 seconds"))
1891
+ * return yield* step(0, undefined)
3318
1892
  * })
1893
+ *
1894
+ * await Effect.runPromise(program) // => [0, Duration.seconds(5)]
3319
1895
  * ```
3320
1896
  *
3321
1897
  * @category constructors
@@ -3341,21 +1917,18 @@ export const windowed = (interval: Duration.Input): Schedule<number> => {
3341
1917
  *
3342
1918
  * **Example** (Repeating forever)
3343
1919
  *
3344
- * ```ts
3345
- * import { Console, Effect, Schedule } from "effect"
1920
+ * ```ts import.meta.vitest
1921
+ * import { Effect, Schedule } from "effect"
1922
+ * import { TestClock } from "effect/testing"
3346
1923
  *
3347
- * // A schedule that runs forever with no delay
3348
- * const infiniteSchedule = Schedule.forever
1924
+ * const executions: Array<number> = []
1925
+ * const schedule = Schedule.forever.pipe(Schedule.upTo({ times: 2 }))
1926
+ * const program = Effect.sync(() => executions.push(executions.length + 1)).pipe(
1927
+ * Effect.repeat(schedule),
1928
+ * Effect.as(executions)
1929
+ * )
3349
1930
  *
3350
- * const program = Effect.gen(function*() {
3351
- * yield* Effect.repeat(
3352
- * Effect.gen(function*() {
3353
- * yield* Console.log("Running forever...")
3354
- * return "continuous-task"
3355
- * }),
3356
- * infiniteSchedule.pipe(Schedule.upTo({ times: 5 })) // Limit for demo
3357
- * )
3358
- * })
1931
+ * await Effect.runPromise(Effect.provide(program, TestClock.layer())) // => [1, 2, 3]
3359
1932
  * ```
3360
1933
  *
3361
1934
  * @category constructors
@@ -3405,12 +1978,13 @@ export {
3405
1978
  *
3406
1979
  * **Example** (Setting a schedule input type)
3407
1980
  *
3408
- * ```ts
1981
+ * ```ts import.meta.vitest
3409
1982
  * import { Schedule } from "effect"
3410
1983
  *
3411
1984
  * const schedule = Schedule.recurs(3).pipe(
3412
1985
  * Schedule.setInputType<string>()
3413
1986
  * )
1987
+ * Schedule.isSchedule(schedule) // => true
3414
1988
  * ```
3415
1989
  *
3416
1990
  * @category utility types