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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1657) hide show
  1. package/dist/Array.d.ts +113 -67
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +28 -18
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +404 -337
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +190 -146
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +167 -97
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +87 -47
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +62 -31
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +30 -15
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.d.ts +20 -1
  18. package/dist/Brand.d.ts.map +1 -1
  19. package/dist/Brand.js +16 -0
  20. package/dist/Brand.js.map +1 -1
  21. package/dist/Cache.d.ts +236 -132
  22. package/dist/Cache.d.ts.map +1 -1
  23. package/dist/Cache.js +133 -57
  24. package/dist/Cache.js.map +1 -1
  25. package/dist/Cause.d.ts +77 -65
  26. package/dist/Cause.d.ts.map +1 -1
  27. package/dist/Cause.js +43 -36
  28. package/dist/Cause.js.map +1 -1
  29. package/dist/Channel.d.ts +1518 -575
  30. package/dist/Channel.d.ts.map +1 -1
  31. package/dist/Channel.js +661 -287
  32. package/dist/Channel.js.map +1 -1
  33. package/dist/ChannelSchema.d.ts +119 -10
  34. package/dist/ChannelSchema.d.ts.map +1 -1
  35. package/dist/ChannelSchema.js +45 -6
  36. package/dist/ChannelSchema.js.map +1 -1
  37. package/dist/Chunk.d.ts +548 -379
  38. package/dist/Chunk.d.ts.map +1 -1
  39. package/dist/Chunk.js +238 -170
  40. package/dist/Chunk.js.map +1 -1
  41. package/dist/Clock.d.ts +15 -8
  42. package/dist/Clock.d.ts.map +1 -1
  43. package/dist/Clock.js +8 -4
  44. package/dist/Clock.js.map +1 -1
  45. package/dist/Combiner.d.ts +2 -4
  46. package/dist/Combiner.d.ts.map +1 -1
  47. package/dist/Combiner.js +2 -4
  48. package/dist/Combiner.js.map +1 -1
  49. package/dist/Config.d.ts +5 -4
  50. package/dist/Config.d.ts.map +1 -1
  51. package/dist/Config.js +9 -8
  52. package/dist/Config.js.map +1 -1
  53. package/dist/ConfigProvider.d.ts +1 -1
  54. package/dist/ConfigProvider.js +1 -1
  55. package/dist/Console.d.ts +76 -50
  56. package/dist/Console.d.ts.map +1 -1
  57. package/dist/Console.js +69 -46
  58. package/dist/Console.js.map +1 -1
  59. package/dist/Context.d.ts +386 -138
  60. package/dist/Context.d.ts.map +1 -1
  61. package/dist/Context.js +144 -62
  62. package/dist/Context.js.map +1 -1
  63. package/dist/Cron.d.ts +69 -48
  64. package/dist/Cron.d.ts.map +1 -1
  65. package/dist/Cron.js +96 -36
  66. package/dist/Cron.js.map +1 -1
  67. package/dist/Data.d.ts +3 -2
  68. package/dist/Data.d.ts.map +1 -1
  69. package/dist/Data.js.map +1 -1
  70. package/dist/DateTime.d.ts +875 -444
  71. package/dist/DateTime.d.ts.map +1 -1
  72. package/dist/DateTime.js +376 -217
  73. package/dist/DateTime.js.map +1 -1
  74. package/dist/Deferred.d.ts +367 -174
  75. package/dist/Deferred.d.ts.map +1 -1
  76. package/dist/Deferred.js +145 -71
  77. package/dist/Deferred.js.map +1 -1
  78. package/dist/Differ.d.ts +42 -0
  79. package/dist/Differ.d.ts.map +1 -1
  80. package/dist/Differ.js +36 -0
  81. package/dist/Duration.d.ts +329 -185
  82. package/dist/Duration.d.ts.map +1 -1
  83. package/dist/Duration.js +174 -106
  84. package/dist/Duration.js.map +1 -1
  85. package/dist/Effect.d.ts +2445 -2356
  86. package/dist/Effect.d.ts.map +1 -1
  87. package/dist/Effect.js +906 -758
  88. package/dist/Effect.js.map +1 -1
  89. package/dist/Effectable.d.ts +38 -3
  90. package/dist/Effectable.d.ts.map +1 -1
  91. package/dist/Effectable.js +3 -3
  92. package/dist/Effectable.js.map +1 -1
  93. package/dist/Encoding.d.ts +78 -28
  94. package/dist/Encoding.d.ts.map +1 -1
  95. package/dist/Encoding.js +75 -27
  96. package/dist/Encoding.js.map +1 -1
  97. package/dist/Equivalence.d.ts +14 -19
  98. package/dist/Equivalence.d.ts.map +1 -1
  99. package/dist/Equivalence.js +14 -19
  100. package/dist/Equivalence.js.map +1 -1
  101. package/dist/ErrorReporter.d.ts +66 -82
  102. package/dist/ErrorReporter.d.ts.map +1 -1
  103. package/dist/ErrorReporter.js +38 -29
  104. package/dist/ErrorReporter.js.map +1 -1
  105. package/dist/ExecutionPlan.d.ts +96 -12
  106. package/dist/ExecutionPlan.d.ts.map +1 -1
  107. package/dist/ExecutionPlan.js +21 -6
  108. package/dist/ExecutionPlan.js.map +1 -1
  109. package/dist/Exit.d.ts +7 -5
  110. package/dist/Exit.d.ts.map +1 -1
  111. package/dist/Exit.js.map +1 -1
  112. package/dist/Fiber.d.ts +72 -40
  113. package/dist/Fiber.d.ts.map +1 -1
  114. package/dist/Fiber.js +39 -21
  115. package/dist/Fiber.js.map +1 -1
  116. package/dist/FiberHandle.d.ts +119 -58
  117. package/dist/FiberHandle.d.ts.map +1 -1
  118. package/dist/FiberHandle.js +122 -40
  119. package/dist/FiberHandle.js.map +1 -1
  120. package/dist/FiberMap.d.ts +288 -160
  121. package/dist/FiberMap.d.ts.map +1 -1
  122. package/dist/FiberMap.js +176 -74
  123. package/dist/FiberMap.js.map +1 -1
  124. package/dist/FiberSet.d.ts +93 -52
  125. package/dist/FiberSet.d.ts.map +1 -1
  126. package/dist/FiberSet.js +97 -34
  127. package/dist/FiberSet.js.map +1 -1
  128. package/dist/FileSystem.d.ts +104 -73
  129. package/dist/FileSystem.d.ts.map +1 -1
  130. package/dist/FileSystem.js +53 -39
  131. package/dist/FileSystem.js.map +1 -1
  132. package/dist/Filter.d.ts +166 -88
  133. package/dist/Filter.d.ts.map +1 -1
  134. package/dist/Filter.js +68 -42
  135. package/dist/Filter.js.map +1 -1
  136. package/dist/Function.d.ts +154 -86
  137. package/dist/Function.d.ts.map +1 -1
  138. package/dist/Function.js +53 -37
  139. package/dist/Function.js.map +1 -1
  140. package/dist/Graph.d.ts +682 -365
  141. package/dist/Graph.d.ts.map +1 -1
  142. package/dist/Graph.js +308 -157
  143. package/dist/Graph.js.map +1 -1
  144. package/dist/HKT.d.ts +29 -13
  145. package/dist/HKT.d.ts.map +1 -1
  146. package/dist/Hash.d.ts +31 -18
  147. package/dist/Hash.d.ts.map +1 -1
  148. package/dist/Hash.js +25 -15
  149. package/dist/Hash.js.map +1 -1
  150. package/dist/HashMap.d.ts +444 -256
  151. package/dist/HashMap.d.ts.map +1 -1
  152. package/dist/HashMap.js +223 -105
  153. package/dist/HashMap.js.map +1 -1
  154. package/dist/HashRing.d.ts +36 -17
  155. package/dist/HashRing.d.ts.map +1 -1
  156. package/dist/HashRing.js +75 -8
  157. package/dist/HashRing.js.map +1 -1
  158. package/dist/HashSet.d.ts +194 -104
  159. package/dist/HashSet.d.ts.map +1 -1
  160. package/dist/HashSet.js +93 -38
  161. package/dist/HashSet.js.map +1 -1
  162. package/dist/Inspectable.d.ts +20 -9
  163. package/dist/Inspectable.d.ts.map +1 -1
  164. package/dist/Inspectable.js +16 -6
  165. package/dist/Inspectable.js.map +1 -1
  166. package/dist/Iterable.d.ts +309 -149
  167. package/dist/Iterable.d.ts.map +1 -1
  168. package/dist/Iterable.js +129 -65
  169. package/dist/Iterable.js.map +1 -1
  170. package/dist/JsonPatch.d.ts +4 -3
  171. package/dist/JsonPatch.d.ts.map +1 -1
  172. package/dist/JsonPatch.js +4 -3
  173. package/dist/JsonPatch.js.map +1 -1
  174. package/dist/Latch.d.ts +98 -15
  175. package/dist/Latch.d.ts.map +1 -1
  176. package/dist/Latch.js +41 -10
  177. package/dist/Latch.js.map +1 -1
  178. package/dist/Layer.d.ts +412 -309
  179. package/dist/Layer.d.ts.map +1 -1
  180. package/dist/Layer.js +262 -181
  181. package/dist/Layer.js.map +1 -1
  182. package/dist/LayerMap.d.ts +95 -21
  183. package/dist/LayerMap.d.ts.map +1 -1
  184. package/dist/LayerMap.js +58 -14
  185. package/dist/LayerMap.js.map +1 -1
  186. package/dist/LogLevel.d.ts +92 -131
  187. package/dist/LogLevel.d.ts.map +1 -1
  188. package/dist/LogLevel.js +25 -15
  189. package/dist/LogLevel.js.map +1 -1
  190. package/dist/Logger.d.ts +155 -99
  191. package/dist/Logger.d.ts.map +1 -1
  192. package/dist/Logger.js +211 -184
  193. package/dist/Logger.js.map +1 -1
  194. package/dist/ManagedRuntime.d.ts +75 -17
  195. package/dist/ManagedRuntime.d.ts.map +1 -1
  196. package/dist/ManagedRuntime.js +22 -16
  197. package/dist/ManagedRuntime.js.map +1 -1
  198. package/dist/Match.d.ts +133 -157
  199. package/dist/Match.d.ts.map +1 -1
  200. package/dist/Match.js +85 -76
  201. package/dist/Match.js.map +1 -1
  202. package/dist/Metric.d.ts +325 -284
  203. package/dist/Metric.d.ts.map +1 -1
  204. package/dist/Metric.js +217 -212
  205. package/dist/Metric.js.map +1 -1
  206. package/dist/MutableHashMap.d.ts +117 -58
  207. package/dist/MutableHashMap.d.ts.map +1 -1
  208. package/dist/MutableHashMap.js +52 -29
  209. package/dist/MutableHashMap.js.map +1 -1
  210. package/dist/MutableHashSet.d.ts +52 -30
  211. package/dist/MutableHashSet.d.ts.map +1 -1
  212. package/dist/MutableHashSet.js +94 -38
  213. package/dist/MutableHashSet.js.map +1 -1
  214. package/dist/MutableList.d.ts +92 -49
  215. package/dist/MutableList.d.ts.map +1 -1
  216. package/dist/MutableList.js +123 -71
  217. package/dist/MutableList.js.map +1 -1
  218. package/dist/MutableRef.d.ts +99 -62
  219. package/dist/MutableRef.d.ts.map +1 -1
  220. package/dist/MutableRef.js +79 -60
  221. package/dist/MutableRef.js.map +1 -1
  222. package/dist/Newtype.d.ts +3 -0
  223. package/dist/Newtype.d.ts.map +1 -1
  224. package/dist/Newtype.js.map +1 -1
  225. package/dist/NonEmptyIterable.d.ts +36 -39
  226. package/dist/NonEmptyIterable.d.ts.map +1 -1
  227. package/dist/NonEmptyIterable.js +34 -20
  228. package/dist/NonEmptyIterable.js.map +1 -1
  229. package/dist/Number.d.ts +116 -64
  230. package/dist/Number.d.ts.map +1 -1
  231. package/dist/Number.js +54 -30
  232. package/dist/Number.js.map +1 -1
  233. package/dist/Optic.d.ts +1 -2
  234. package/dist/Optic.d.ts.map +1 -1
  235. package/dist/Optic.js +0 -1
  236. package/dist/Optic.js.map +1 -1
  237. package/dist/Option.d.ts +38 -53
  238. package/dist/Option.d.ts.map +1 -1
  239. package/dist/Option.js +87 -11
  240. package/dist/Option.js.map +1 -1
  241. package/dist/Ordering.d.ts +43 -28
  242. package/dist/Ordering.d.ts.map +1 -1
  243. package/dist/Ordering.js +4 -2
  244. package/dist/Ordering.js.map +1 -1
  245. package/dist/PartitionedSemaphore.d.ts +225 -40
  246. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  247. package/dist/PartitionedSemaphore.js +113 -17
  248. package/dist/PartitionedSemaphore.js.map +1 -1
  249. package/dist/Path.d.ts +77 -13
  250. package/dist/Path.d.ts.map +1 -1
  251. package/dist/Path.js +48 -4
  252. package/dist/Path.js.map +1 -1
  253. package/dist/Pipeable.d.ts +71 -15
  254. package/dist/Pipeable.d.ts.map +1 -1
  255. package/dist/Pipeable.js +59 -12
  256. package/dist/Pipeable.js.map +1 -1
  257. package/dist/PlatformError.d.ts +74 -6
  258. package/dist/PlatformError.d.ts.map +1 -1
  259. package/dist/PlatformError.js +68 -5
  260. package/dist/PlatformError.js.map +1 -1
  261. package/dist/Pool.d.ts +66 -31
  262. package/dist/Pool.d.ts.map +1 -1
  263. package/dist/Pool.js +26 -24
  264. package/dist/Pool.js.map +1 -1
  265. package/dist/Predicate.d.ts +16 -21
  266. package/dist/Predicate.d.ts.map +1 -1
  267. package/dist/Predicate.js +9 -14
  268. package/dist/Predicate.js.map +1 -1
  269. package/dist/PrimaryKey.d.ts +9 -2
  270. package/dist/PrimaryKey.d.ts.map +1 -1
  271. package/dist/PrimaryKey.js +7 -1
  272. package/dist/PrimaryKey.js.map +1 -1
  273. package/dist/PubSub.d.ts +364 -262
  274. package/dist/PubSub.d.ts.map +1 -1
  275. package/dist/PubSub.js +245 -174
  276. package/dist/PubSub.js.map +1 -1
  277. package/dist/Pull.d.ts +94 -25
  278. package/dist/Pull.d.ts.map +1 -1
  279. package/dist/Pull.js +61 -13
  280. package/dist/Pull.js.map +1 -1
  281. package/dist/Queue.d.ts +284 -150
  282. package/dist/Queue.d.ts.map +1 -1
  283. package/dist/Queue.js +216 -113
  284. package/dist/Queue.js.map +1 -1
  285. package/dist/Random.d.ts +54 -35
  286. package/dist/Random.d.ts.map +1 -1
  287. package/dist/Random.js +36 -24
  288. package/dist/Random.js.map +1 -1
  289. package/dist/RcMap.d.ts +151 -141
  290. package/dist/RcMap.d.ts.map +1 -1
  291. package/dist/RcMap.js +66 -20
  292. package/dist/RcMap.js.map +1 -1
  293. package/dist/RcRef.d.ts +69 -32
  294. package/dist/RcRef.d.ts.map +1 -1
  295. package/dist/RcRef.js +33 -16
  296. package/dist/RcRef.js.map +1 -1
  297. package/dist/Record.d.ts +273 -129
  298. package/dist/Record.d.ts.map +1 -1
  299. package/dist/Record.js +117 -57
  300. package/dist/Record.js.map +1 -1
  301. package/dist/Redactable.d.ts +3 -3
  302. package/dist/Redactable.js +2 -2
  303. package/dist/Redacted.d.ts +63 -33
  304. package/dist/Redacted.d.ts.map +1 -1
  305. package/dist/Redacted.js +30 -14
  306. package/dist/Redacted.js.map +1 -1
  307. package/dist/Ref.d.ts +81 -52
  308. package/dist/Ref.d.ts.map +1 -1
  309. package/dist/Ref.js +54 -35
  310. package/dist/Ref.js.map +1 -1
  311. package/dist/References.d.ts +73 -31
  312. package/dist/References.d.ts.map +1 -1
  313. package/dist/References.js +66 -30
  314. package/dist/References.js.map +1 -1
  315. package/dist/RegExp.d.ts +11 -5
  316. package/dist/RegExp.d.ts.map +1 -1
  317. package/dist/RegExp.js +11 -5
  318. package/dist/RegExp.js.map +1 -1
  319. package/dist/Request.d.ts +158 -34
  320. package/dist/Request.d.ts.map +1 -1
  321. package/dist/Request.js +67 -12
  322. package/dist/Request.js.map +1 -1
  323. package/dist/RequestResolver.d.ts +261 -116
  324. package/dist/RequestResolver.d.ts.map +1 -1
  325. package/dist/RequestResolver.js +77 -41
  326. package/dist/RequestResolver.js.map +1 -1
  327. package/dist/Resource.d.ts +13 -7
  328. package/dist/Resource.d.ts.map +1 -1
  329. package/dist/Resource.js +44 -6
  330. package/dist/Resource.js.map +1 -1
  331. package/dist/Result.d.ts +26 -16
  332. package/dist/Result.d.ts.map +1 -1
  333. package/dist/Result.js +6 -6
  334. package/dist/Result.js.map +1 -1
  335. package/dist/Runtime.d.ts +43 -18
  336. package/dist/Runtime.d.ts.map +1 -1
  337. package/dist/Runtime.js +35 -16
  338. package/dist/Runtime.js.map +1 -1
  339. package/dist/Schedule.d.ts +545 -576
  340. package/dist/Schedule.d.ts.map +1 -1
  341. package/dist/Schedule.js +261 -247
  342. package/dist/Schedule.js.map +1 -1
  343. package/dist/Scheduler.d.ts +43 -6
  344. package/dist/Scheduler.d.ts.map +1 -1
  345. package/dist/Scheduler.js +33 -4
  346. package/dist/Scheduler.js.map +1 -1
  347. package/dist/Schema.d.ts +815 -294
  348. package/dist/Schema.d.ts.map +1 -1
  349. package/dist/Schema.js +287 -193
  350. package/dist/Schema.js.map +1 -1
  351. package/dist/SchemaAST.d.ts +24 -15
  352. package/dist/SchemaAST.d.ts.map +1 -1
  353. package/dist/SchemaAST.js +13 -9
  354. package/dist/SchemaAST.js.map +1 -1
  355. package/dist/SchemaGetter.d.ts +26 -13
  356. package/dist/SchemaGetter.d.ts.map +1 -1
  357. package/dist/SchemaGetter.js +24 -11
  358. package/dist/SchemaGetter.js.map +1 -1
  359. package/dist/SchemaIssue.d.ts +1 -8
  360. package/dist/SchemaIssue.d.ts.map +1 -1
  361. package/dist/SchemaIssue.js.map +1 -1
  362. package/dist/SchemaParser.d.ts +194 -25
  363. package/dist/SchemaParser.d.ts.map +1 -1
  364. package/dist/SchemaParser.js +220 -26
  365. package/dist/SchemaParser.js.map +1 -1
  366. package/dist/SchemaRepresentation.d.ts +2 -2
  367. package/dist/SchemaTransformation.d.ts +61 -41
  368. package/dist/SchemaTransformation.d.ts.map +1 -1
  369. package/dist/SchemaTransformation.js +56 -33
  370. package/dist/SchemaTransformation.js.map +1 -1
  371. package/dist/SchemaUtils.d.ts +7 -0
  372. package/dist/SchemaUtils.d.ts.map +1 -1
  373. package/dist/SchemaUtils.js +23 -0
  374. package/dist/SchemaUtils.js.map +1 -1
  375. package/dist/Scope.d.ts +102 -43
  376. package/dist/Scope.d.ts.map +1 -1
  377. package/dist/Scope.js +57 -23
  378. package/dist/Scope.js.map +1 -1
  379. package/dist/ScopedCache.d.ts +138 -46
  380. package/dist/ScopedCache.d.ts.map +1 -1
  381. package/dist/ScopedCache.js +80 -19
  382. package/dist/ScopedCache.js.map +1 -1
  383. package/dist/ScopedRef.d.ts +28 -8
  384. package/dist/ScopedRef.d.ts.map +1 -1
  385. package/dist/ScopedRef.js +25 -5
  386. package/dist/ScopedRef.js.map +1 -1
  387. package/dist/Semaphore.d.ts +64 -28
  388. package/dist/Semaphore.d.ts.map +1 -1
  389. package/dist/Semaphore.js +22 -13
  390. package/dist/Semaphore.js.map +1 -1
  391. package/dist/Sink.d.ts +458 -200
  392. package/dist/Sink.d.ts.map +1 -1
  393. package/dist/Sink.js +240 -89
  394. package/dist/Sink.js.map +1 -1
  395. package/dist/Stdio.d.ts +43 -6
  396. package/dist/Stdio.d.ts.map +1 -1
  397. package/dist/Stdio.js +33 -4
  398. package/dist/Stdio.js.map +1 -1
  399. package/dist/Stream.d.ts +1899 -1186
  400. package/dist/Stream.d.ts.map +1 -1
  401. package/dist/Stream.js +868 -525
  402. package/dist/Stream.js.map +1 -1
  403. package/dist/String.d.ts +171 -95
  404. package/dist/String.d.ts.map +1 -1
  405. package/dist/String.js +125 -67
  406. package/dist/String.js.map +1 -1
  407. package/dist/SubscriptionRef.d.ts +308 -203
  408. package/dist/SubscriptionRef.d.ts.map +1 -1
  409. package/dist/SubscriptionRef.js +125 -76
  410. package/dist/SubscriptionRef.js.map +1 -1
  411. package/dist/Symbol.d.ts +13 -5
  412. package/dist/Symbol.d.ts.map +1 -1
  413. package/dist/Symbol.js +13 -5
  414. package/dist/Symbol.js.map +1 -1
  415. package/dist/SynchronizedRef.d.ts +278 -62
  416. package/dist/SynchronizedRef.d.ts.map +1 -1
  417. package/dist/SynchronizedRef.js +116 -23
  418. package/dist/SynchronizedRef.js.map +1 -1
  419. package/dist/Take.d.ts +26 -2
  420. package/dist/Take.d.ts.map +1 -1
  421. package/dist/Take.js +4 -1
  422. package/dist/Take.js.map +1 -1
  423. package/dist/Terminal.d.ts +39 -7
  424. package/dist/Terminal.d.ts.map +1 -1
  425. package/dist/Terminal.js +10 -4
  426. package/dist/Terminal.js.map +1 -1
  427. package/dist/Tracer.d.ts +229 -55
  428. package/dist/Tracer.d.ts.map +1 -1
  429. package/dist/Tracer.js +94 -18
  430. package/dist/Tracer.js.map +1 -1
  431. package/dist/Trie.d.ts +213 -142
  432. package/dist/Trie.d.ts.map +1 -1
  433. package/dist/Trie.js +88 -60
  434. package/dist/Trie.js.map +1 -1
  435. package/dist/TxChunk.d.ts +182 -146
  436. package/dist/TxChunk.d.ts.map +1 -1
  437. package/dist/TxChunk.js +73 -56
  438. package/dist/TxChunk.js.map +1 -1
  439. package/dist/TxDeferred.d.ts +43 -29
  440. package/dist/TxDeferred.d.ts.map +1 -1
  441. package/dist/TxDeferred.js +22 -15
  442. package/dist/TxDeferred.js.map +1 -1
  443. package/dist/TxHashMap.d.ts +362 -222
  444. package/dist/TxHashMap.d.ts.map +1 -1
  445. package/dist/TxHashMap.js +171 -98
  446. package/dist/TxHashMap.js.map +1 -1
  447. package/dist/TxHashSet.d.ts +178 -104
  448. package/dist/TxHashSet.d.ts.map +1 -1
  449. package/dist/TxHashSet.js +84 -43
  450. package/dist/TxHashSet.js.map +1 -1
  451. package/dist/TxPriorityQueue.d.ts +93 -62
  452. package/dist/TxPriorityQueue.d.ts.map +1 -1
  453. package/dist/TxPriorityQueue.js +54 -36
  454. package/dist/TxPriorityQueue.js.map +1 -1
  455. package/dist/TxPubSub.d.ts +77 -49
  456. package/dist/TxPubSub.d.ts.map +1 -1
  457. package/dist/TxPubSub.js +60 -37
  458. package/dist/TxPubSub.js.map +1 -1
  459. package/dist/TxQueue.d.ts +279 -241
  460. package/dist/TxQueue.d.ts.map +1 -1
  461. package/dist/TxQueue.js +147 -101
  462. package/dist/TxQueue.js.map +1 -1
  463. package/dist/TxReentrantLock.d.ts +69 -46
  464. package/dist/TxReentrantLock.d.ts.map +1 -1
  465. package/dist/TxReentrantLock.js +48 -32
  466. package/dist/TxReentrantLock.js.map +1 -1
  467. package/dist/TxRef.d.ts +69 -40
  468. package/dist/TxRef.d.ts.map +1 -1
  469. package/dist/TxRef.js +35 -20
  470. package/dist/TxRef.js.map +1 -1
  471. package/dist/TxSemaphore.d.ts +101 -54
  472. package/dist/TxSemaphore.d.ts.map +1 -1
  473. package/dist/TxSemaphore.js +76 -34
  474. package/dist/TxSemaphore.js.map +1 -1
  475. package/dist/TxSubscriptionRef.d.ts +72 -48
  476. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  477. package/dist/TxSubscriptionRef.js +33 -22
  478. package/dist/TxSubscriptionRef.js.map +1 -1
  479. package/dist/Types.d.ts +34 -34
  480. package/dist/UndefinedOr.d.ts +48 -25
  481. package/dist/UndefinedOr.d.ts.map +1 -1
  482. package/dist/UndefinedOr.js +28 -25
  483. package/dist/UndefinedOr.js.map +1 -1
  484. package/dist/Unify.d.ts +71 -116
  485. package/dist/Unify.d.ts.map +1 -1
  486. package/dist/Unify.js +20 -6
  487. package/dist/Unify.js.map +1 -1
  488. package/dist/Utils.d.ts +4 -0
  489. package/dist/Utils.d.ts.map +1 -1
  490. package/dist/Utils.js +4 -0
  491. package/dist/Utils.js.map +1 -1
  492. package/dist/index.d.ts +81 -32
  493. package/dist/index.d.ts.map +1 -1
  494. package/dist/index.js +81 -32
  495. package/dist/index.js.map +1 -1
  496. package/dist/internal/concurrency.js +2 -2
  497. package/dist/internal/concurrency.js.map +1 -1
  498. package/dist/internal/core.js +8 -20
  499. package/dist/internal/core.js.map +1 -1
  500. package/dist/internal/effect.js +20 -19
  501. package/dist/internal/effect.js.map +1 -1
  502. package/dist/internal/executionPlan.js +2 -2
  503. package/dist/internal/executionPlan.js.map +1 -1
  504. package/dist/internal/option.js +5 -8
  505. package/dist/internal/option.js.map +1 -1
  506. package/dist/internal/result.js +5 -8
  507. package/dist/internal/result.js.map +1 -1
  508. package/dist/internal/schema/schema.js +1 -1
  509. package/dist/internal/schema/schema.js.map +1 -1
  510. package/dist/testing/FastCheck.d.ts +6 -3
  511. package/dist/testing/FastCheck.d.ts.map +1 -1
  512. package/dist/testing/FastCheck.js +6 -3
  513. package/dist/testing/FastCheck.js.map +1 -1
  514. package/dist/testing/TestClock.d.ts +39 -34
  515. package/dist/testing/TestClock.d.ts.map +1 -1
  516. package/dist/testing/TestClock.js +42 -12
  517. package/dist/testing/TestClock.js.map +1 -1
  518. package/dist/testing/TestConsole.d.ts +39 -30
  519. package/dist/testing/TestConsole.d.ts.map +1 -1
  520. package/dist/testing/TestConsole.js +25 -10
  521. package/dist/testing/TestConsole.js.map +1 -1
  522. package/dist/testing/TestSchema.js +7 -7
  523. package/dist/testing/TestSchema.js.map +1 -1
  524. package/dist/unstable/ai/AiError.d.ts +197 -130
  525. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  526. package/dist/unstable/ai/AiError.js +166 -102
  527. package/dist/unstable/ai/AiError.js.map +1 -1
  528. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  529. package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
  530. package/dist/unstable/ai/Chat.d.ts +65 -41
  531. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  532. package/dist/unstable/ai/Chat.js +51 -33
  533. package/dist/unstable/ai/Chat.js.map +1 -1
  534. package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
  535. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  536. package/dist/unstable/ai/EmbeddingModel.js +9 -8
  537. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  538. package/dist/unstable/ai/IdGenerator.d.ts +28 -18
  539. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  540. package/dist/unstable/ai/IdGenerator.js +18 -11
  541. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  542. package/dist/unstable/ai/LanguageModel.d.ts +36 -30
  543. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  544. package/dist/unstable/ai/LanguageModel.js +21 -15
  545. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  546. package/dist/unstable/ai/McpSchema.d.ts +339 -119
  547. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  548. package/dist/unstable/ai/McpSchema.js +264 -98
  549. package/dist/unstable/ai/McpSchema.js.map +1 -1
  550. package/dist/unstable/ai/McpServer.d.ts +53 -19
  551. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  552. package/dist/unstable/ai/McpServer.js +65 -17
  553. package/dist/unstable/ai/McpServer.js.map +1 -1
  554. package/dist/unstable/ai/Model.d.ts +13 -7
  555. package/dist/unstable/ai/Model.d.ts.map +1 -1
  556. package/dist/unstable/ai/Model.js +11 -9
  557. package/dist/unstable/ai/Model.js.map +1 -1
  558. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  559. package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
  560. package/dist/unstable/ai/Prompt.d.ts +194 -168
  561. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  562. package/dist/unstable/ai/Prompt.js +75 -66
  563. package/dist/unstable/ai/Prompt.js.map +1 -1
  564. package/dist/unstable/ai/Response.d.ts +153 -140
  565. package/dist/unstable/ai/Response.d.ts.map +1 -1
  566. package/dist/unstable/ai/Response.js +43 -48
  567. package/dist/unstable/ai/Response.js.map +1 -1
  568. package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
  569. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
  570. package/dist/unstable/ai/ResponseIdTracker.js +27 -2
  571. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  572. package/dist/unstable/ai/Telemetry.d.ts +42 -32
  573. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  574. package/dist/unstable/ai/Telemetry.js +14 -10
  575. package/dist/unstable/ai/Telemetry.js.map +1 -1
  576. package/dist/unstable/ai/Tokenizer.d.ts +13 -8
  577. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  578. package/dist/unstable/ai/Tokenizer.js +10 -6
  579. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  580. package/dist/unstable/ai/Tool.d.ts +153 -84
  581. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  582. package/dist/unstable/ai/Tool.js +97 -44
  583. package/dist/unstable/ai/Tool.js.map +1 -1
  584. package/dist/unstable/ai/Toolkit.d.ts +33 -42
  585. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  586. package/dist/unstable/ai/Toolkit.js +35 -36
  587. package/dist/unstable/ai/Toolkit.js.map +1 -1
  588. package/dist/unstable/ai/index.d.ts +42 -24
  589. package/dist/unstable/ai/index.d.ts.map +1 -1
  590. package/dist/unstable/ai/index.js +42 -24
  591. package/dist/unstable/ai/index.js.map +1 -1
  592. package/dist/unstable/cli/Argument.d.ts +226 -134
  593. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  594. package/dist/unstable/cli/Argument.js +101 -65
  595. package/dist/unstable/cli/Argument.js.map +1 -1
  596. package/dist/unstable/cli/CliError.d.ts +72 -26
  597. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  598. package/dist/unstable/cli/CliError.js +86 -23
  599. package/dist/unstable/cli/CliError.js.map +1 -1
  600. package/dist/unstable/cli/CliOutput.d.ts +43 -13
  601. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  602. package/dist/unstable/cli/CliOutput.js +30 -6
  603. package/dist/unstable/cli/CliOutput.js.map +1 -1
  604. package/dist/unstable/cli/Command.d.ts +218 -117
  605. package/dist/unstable/cli/Command.d.ts.map +1 -1
  606. package/dist/unstable/cli/Command.js +45 -31
  607. package/dist/unstable/cli/Command.js.map +1 -1
  608. package/dist/unstable/cli/Completions.d.ts +7 -7
  609. package/dist/unstable/cli/Completions.js +1 -1
  610. package/dist/unstable/cli/Flag.d.ts +235 -142
  611. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  612. package/dist/unstable/cli/Flag.js +111 -71
  613. package/dist/unstable/cli/Flag.js.map +1 -1
  614. package/dist/unstable/cli/GlobalFlag.d.ts +42 -14
  615. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  616. package/dist/unstable/cli/GlobalFlag.js +30 -7
  617. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  618. package/dist/unstable/cli/HelpDoc.d.ts +35 -10
  619. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  620. package/dist/unstable/cli/HelpDoc.js +21 -0
  621. package/dist/unstable/cli/Param.d.ts +79 -31
  622. package/dist/unstable/cli/Param.d.ts.map +1 -1
  623. package/dist/unstable/cli/Param.js +161 -99
  624. package/dist/unstable/cli/Param.js.map +1 -1
  625. package/dist/unstable/cli/Primitive.d.ts +79 -42
  626. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  627. package/dist/unstable/cli/Primitive.js +66 -35
  628. package/dist/unstable/cli/Primitive.js.map +1 -1
  629. package/dist/unstable/cli/Prompt.d.ts +178 -47
  630. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  631. package/dist/unstable/cli/Prompt.js +111 -31
  632. package/dist/unstable/cli/Prompt.js.map +1 -1
  633. package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
  634. package/dist/unstable/cli/internal/ansi.js +13 -0
  635. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  636. package/dist/unstable/cli/internal/command.d.ts +7 -7
  637. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  638. package/dist/unstable/cli/internal/command.js +12 -10
  639. package/dist/unstable/cli/internal/command.js.map +1 -1
  640. package/dist/unstable/cli/internal/config.d.ts +3 -0
  641. package/dist/unstable/cli/internal/config.d.ts.map +1 -1
  642. package/dist/unstable/cli/internal/config.js.map +1 -1
  643. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  644. package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
  645. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  646. package/dist/unstable/cluster/ClusterCron.js +35 -1
  647. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  648. package/dist/unstable/cluster/ClusterError.d.ts +56 -7
  649. package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
  650. package/dist/unstable/cluster/ClusterError.js +56 -7
  651. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  652. package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
  653. package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
  654. package/dist/unstable/cluster/ClusterMetrics.js +39 -5
  655. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  656. package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
  657. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  658. package/dist/unstable/cluster/ClusterSchema.js +61 -8
  659. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  660. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
  661. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  662. package/dist/unstable/cluster/ClusterWorkflowEngine.js +36 -3
  663. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  664. package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
  665. package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
  666. package/dist/unstable/cluster/DeliverAt.js +11 -3
  667. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  668. package/dist/unstable/cluster/Entity.d.ts +75 -16
  669. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  670. package/dist/unstable/cluster/Entity.js +78 -13
  671. package/dist/unstable/cluster/Entity.js.map +1 -1
  672. package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
  673. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  674. package/dist/unstable/cluster/EntityAddress.js +30 -2
  675. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  676. package/dist/unstable/cluster/EntityId.d.ts +18 -3
  677. package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
  678. package/dist/unstable/cluster/EntityId.js +15 -2
  679. package/dist/unstable/cluster/EntityId.js.map +1 -1
  680. package/dist/unstable/cluster/EntityProxy.d.ts +34 -2
  681. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  682. package/dist/unstable/cluster/EntityProxy.js +24 -2
  683. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  684. package/dist/unstable/cluster/EntityProxyServer.d.ts +17 -2
  685. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  686. package/dist/unstable/cluster/EntityProxyServer.js +40 -8
  687. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  688. package/dist/unstable/cluster/EntityResource.d.ts +43 -6
  689. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  690. package/dist/unstable/cluster/EntityResource.js +11 -4
  691. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  692. package/dist/unstable/cluster/EntityType.d.ts +27 -3
  693. package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
  694. package/dist/unstable/cluster/EntityType.js +24 -2
  695. package/dist/unstable/cluster/EntityType.js.map +1 -1
  696. package/dist/unstable/cluster/Envelope.d.ts +105 -23
  697. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  698. package/dist/unstable/cluster/Envelope.js +88 -14
  699. package/dist/unstable/cluster/Envelope.js.map +1 -1
  700. package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
  701. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  702. package/dist/unstable/cluster/HttpRunner.js +88 -13
  703. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  704. package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
  705. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  706. package/dist/unstable/cluster/K8sHttpClient.js +31 -6
  707. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  708. package/dist/unstable/cluster/MachineId.d.ts +24 -3
  709. package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
  710. package/dist/unstable/cluster/MachineId.js +21 -2
  711. package/dist/unstable/cluster/MachineId.js.map +1 -1
  712. package/dist/unstable/cluster/Message.d.ts +102 -13
  713. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  714. package/dist/unstable/cluster/Message.js +86 -10
  715. package/dist/unstable/cluster/Message.js.map +1 -1
  716. package/dist/unstable/cluster/MessageStorage.d.ts +127 -21
  717. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  718. package/dist/unstable/cluster/MessageStorage.js +71 -11
  719. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  720. package/dist/unstable/cluster/Reply.d.ts +101 -12
  721. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  722. package/dist/unstable/cluster/Reply.js +64 -8
  723. package/dist/unstable/cluster/Reply.js.map +1 -1
  724. package/dist/unstable/cluster/Runner.d.ts +47 -17
  725. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  726. package/dist/unstable/cluster/Runner.js +47 -17
  727. package/dist/unstable/cluster/Runner.js.map +1 -1
  728. package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
  729. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  730. package/dist/unstable/cluster/RunnerAddress.js +34 -2
  731. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  732. package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
  733. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  734. package/dist/unstable/cluster/RunnerHealth.js +40 -12
  735. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  736. package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
  737. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  738. package/dist/unstable/cluster/RunnerServer.js +31 -4
  739. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  740. package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
  741. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  742. package/dist/unstable/cluster/RunnerStorage.js +38 -4
  743. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  744. package/dist/unstable/cluster/Runners.d.ts +73 -10
  745. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  746. package/dist/unstable/cluster/Runners.js +70 -9
  747. package/dist/unstable/cluster/Runners.js.map +1 -1
  748. package/dist/unstable/cluster/ShardId.d.ts +51 -5
  749. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  750. package/dist/unstable/cluster/ShardId.js +47 -4
  751. package/dist/unstable/cluster/ShardId.js.map +1 -1
  752. package/dist/unstable/cluster/Sharding.d.ts +10 -2
  753. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  754. package/dist/unstable/cluster/Sharding.js +35 -4
  755. package/dist/unstable/cluster/Sharding.js.map +1 -1
  756. package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
  757. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  758. package/dist/unstable/cluster/ShardingConfig.js +67 -10
  759. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  760. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
  761. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
  762. package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
  763. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  764. package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
  765. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  766. package/dist/unstable/cluster/SingleRunner.js +23 -1
  767. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  768. package/dist/unstable/cluster/Singleton.d.ts +15 -1
  769. package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
  770. package/dist/unstable/cluster/Singleton.js +15 -1
  771. package/dist/unstable/cluster/Singleton.js.map +1 -1
  772. package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
  773. package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
  774. package/dist/unstable/cluster/SingletonAddress.js +21 -1
  775. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  776. package/dist/unstable/cluster/Snowflake.d.ts +89 -19
  777. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  778. package/dist/unstable/cluster/Snowflake.js +48 -13
  779. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  780. package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
  781. package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
  782. package/dist/unstable/cluster/SocketRunner.js +29 -2
  783. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  784. package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
  785. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  786. package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
  787. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  788. package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
  789. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  790. package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
  791. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  792. package/dist/unstable/cluster/TestRunner.d.ts +18 -1
  793. package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
  794. package/dist/unstable/cluster/TestRunner.js +18 -1
  795. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  796. package/dist/unstable/cluster/internal/hash.js +12 -0
  797. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  798. package/dist/unstable/devtools/DevTools.d.ts +26 -3
  799. package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
  800. package/dist/unstable/devtools/DevTools.js +26 -3
  801. package/dist/unstable/devtools/DevTools.js.map +1 -1
  802. package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
  803. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  804. package/dist/unstable/devtools/DevToolsClient.js +32 -5
  805. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  806. package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
  807. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  808. package/dist/unstable/devtools/DevToolsSchema.js +102 -20
  809. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  810. package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
  811. package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
  812. package/dist/unstable/devtools/DevToolsServer.js +21 -1
  813. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  814. package/dist/unstable/encoding/Msgpack.d.ts +81 -12
  815. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  816. package/dist/unstable/encoding/Msgpack.js +75 -9
  817. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  818. package/dist/unstable/encoding/Ndjson.d.ts +149 -21
  819. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  820. package/dist/unstable/encoding/Ndjson.js +97 -13
  821. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  822. package/dist/unstable/encoding/Sse.d.ts +109 -18
  823. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  824. package/dist/unstable/encoding/Sse.js +69 -13
  825. package/dist/unstable/encoding/Sse.js.map +1 -1
  826. package/dist/unstable/eventlog/Event.d.ts +115 -30
  827. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  828. package/dist/unstable/eventlog/Event.js +22 -2
  829. package/dist/unstable/eventlog/Event.js.map +1 -1
  830. package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
  831. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  832. package/dist/unstable/eventlog/EventGroup.js +24 -6
  833. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  834. package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
  835. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  836. package/dist/unstable/eventlog/EventJournal.js +108 -16
  837. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  838. package/dist/unstable/eventlog/EventLog.d.ts +151 -31
  839. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  840. package/dist/unstable/eventlog/EventLog.js +111 -20
  841. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  842. package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
  843. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  844. package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
  845. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  846. package/dist/unstable/eventlog/EventLogMessage.d.ts +96 -22
  847. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  848. package/dist/unstable/eventlog/EventLogMessage.js +72 -16
  849. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  850. package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
  851. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  852. package/dist/unstable/eventlog/EventLogRemote.js +54 -8
  853. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  854. package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
  855. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  856. package/dist/unstable/eventlog/EventLogServer.js +17 -3
  857. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  858. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
  859. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  860. package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
  861. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  862. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
  863. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  864. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
  865. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  866. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
  867. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
  868. package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
  869. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  870. package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
  871. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  872. package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
  873. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  874. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
  875. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  876. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
  877. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  878. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
  879. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  880. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
  881. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  882. package/dist/unstable/http/Cookies.d.ts +156 -77
  883. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  884. package/dist/unstable/http/Cookies.js +93 -39
  885. package/dist/unstable/http/Cookies.js.map +1 -1
  886. package/dist/unstable/http/Etag.d.ts +40 -7
  887. package/dist/unstable/http/Etag.d.ts.map +1 -1
  888. package/dist/unstable/http/Etag.js +27 -4
  889. package/dist/unstable/http/Etag.js.map +1 -1
  890. package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
  891. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  892. package/dist/unstable/http/FetchHttpClient.js +33 -4
  893. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  894. package/dist/unstable/http/FindMyWay.d.ts +1 -1
  895. package/dist/unstable/http/FindMyWay.js +1 -1
  896. package/dist/unstable/http/Headers.d.ts +182 -36
  897. package/dist/unstable/http/Headers.d.ts.map +1 -1
  898. package/dist/unstable/http/Headers.js +86 -16
  899. package/dist/unstable/http/Headers.js.map +1 -1
  900. package/dist/unstable/http/HttpBody.d.ts +114 -26
  901. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  902. package/dist/unstable/http/HttpBody.js +100 -22
  903. package/dist/unstable/http/HttpBody.js.map +1 -1
  904. package/dist/unstable/http/HttpClient.d.ts +205 -96
  905. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  906. package/dist/unstable/http/HttpClient.js +85 -39
  907. package/dist/unstable/http/HttpClient.js.map +1 -1
  908. package/dist/unstable/http/HttpClientError.d.ts +68 -12
  909. package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
  910. package/dist/unstable/http/HttpClientError.js +71 -9
  911. package/dist/unstable/http/HttpClientError.js.map +1 -1
  912. package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
  913. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  914. package/dist/unstable/http/HttpClientRequest.js +153 -47
  915. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  916. package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
  917. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  918. package/dist/unstable/http/HttpClientResponse.js +44 -11
  919. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  920. package/dist/unstable/http/HttpEffect.d.ts +42 -16
  921. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  922. package/dist/unstable/http/HttpEffect.js +33 -13
  923. package/dist/unstable/http/HttpEffect.js.map +1 -1
  924. package/dist/unstable/http/HttpIncomingMessage.d.ts +47 -7
  925. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  926. package/dist/unstable/http/HttpIncomingMessage.js +44 -6
  927. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  928. package/dist/unstable/http/HttpMethod.d.ts +35 -5
  929. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  930. package/dist/unstable/http/HttpMethod.js +23 -1
  931. package/dist/unstable/http/HttpMethod.js.map +1 -1
  932. package/dist/unstable/http/HttpMiddleware.d.ts +37 -11
  933. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  934. package/dist/unstable/http/HttpMiddleware.js +70 -31
  935. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  936. package/dist/unstable/http/HttpPlatform.d.ts +34 -3
  937. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  938. package/dist/unstable/http/HttpPlatform.js +35 -4
  939. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  940. package/dist/unstable/http/HttpRouter.d.ts +194 -45
  941. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  942. package/dist/unstable/http/HttpRouter.js +122 -28
  943. package/dist/unstable/http/HttpRouter.js.map +1 -1
  944. package/dist/unstable/http/HttpServer.d.ts +151 -22
  945. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  946. package/dist/unstable/http/HttpServer.js +77 -12
  947. package/dist/unstable/http/HttpServer.js.map +1 -1
  948. package/dist/unstable/http/HttpServerError.d.ts +90 -10
  949. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  950. package/dist/unstable/http/HttpServerError.js +82 -8
  951. package/dist/unstable/http/HttpServerError.js.map +1 -1
  952. package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
  953. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  954. package/dist/unstable/http/HttpServerRequest.js +112 -31
  955. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  956. package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
  957. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  958. package/dist/unstable/http/HttpServerRespondable.js +43 -5
  959. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  960. package/dist/unstable/http/HttpServerResponse.d.ts +390 -67
  961. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  962. package/dist/unstable/http/HttpServerResponse.js +209 -38
  963. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  964. package/dist/unstable/http/HttpStaticServer.d.ts +22 -4
  965. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  966. package/dist/unstable/http/HttpStaticServer.js +22 -4
  967. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  968. package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
  969. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  970. package/dist/unstable/http/HttpTraceContext.js +47 -5
  971. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  972. package/dist/unstable/http/Multipart.d.ts +178 -28
  973. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  974. package/dist/unstable/http/Multipart.js +130 -20
  975. package/dist/unstable/http/Multipart.js.map +1 -1
  976. package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
  977. package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
  978. package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
  979. package/dist/unstable/http/Multipasta/Node.js +1 -1
  980. package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
  981. package/dist/unstable/http/Multipasta/Search.js +1 -1
  982. package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
  983. package/dist/unstable/http/Multipasta/Web.js +1 -1
  984. package/dist/unstable/http/Multipasta.d.ts +1 -1
  985. package/dist/unstable/http/Multipasta.js +1 -1
  986. package/dist/unstable/http/Template.d.ts +53 -0
  987. package/dist/unstable/http/Template.d.ts.map +1 -1
  988. package/dist/unstable/http/Template.js +26 -0
  989. package/dist/unstable/http/Template.js.map +1 -1
  990. package/dist/unstable/http/Url.d.ts +56 -42
  991. package/dist/unstable/http/Url.d.ts.map +1 -1
  992. package/dist/unstable/http/Url.js +29 -15
  993. package/dist/unstable/http/Url.js.map +1 -1
  994. package/dist/unstable/http/UrlParams.d.ts +233 -49
  995. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  996. package/dist/unstable/http/UrlParams.js +116 -23
  997. package/dist/unstable/http/UrlParams.js.map +1 -1
  998. package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
  999. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  1000. package/dist/unstable/httpapi/HttpApi.js +14 -8
  1001. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  1002. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +55 -16
  1003. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  1004. package/dist/unstable/httpapi/HttpApiBuilder.js +47 -9
  1005. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  1006. package/dist/unstable/httpapi/HttpApiClient.d.ts +58 -15
  1007. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  1008. package/dist/unstable/httpapi/HttpApiClient.js +43 -7
  1009. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  1010. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
  1011. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  1012. package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
  1013. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  1014. package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
  1015. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  1016. package/dist/unstable/httpapi/HttpApiError.js +98 -1
  1017. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  1018. package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
  1019. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  1020. package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
  1021. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  1022. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
  1023. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  1024. package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -6
  1025. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  1026. package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
  1027. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  1028. package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
  1029. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  1030. package/dist/unstable/httpapi/HttpApiSchema.d.ts +67 -30
  1031. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  1032. package/dist/unstable/httpapi/HttpApiSchema.js +48 -27
  1033. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  1034. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +74 -17
  1035. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  1036. package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
  1037. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  1038. package/dist/unstable/httpapi/HttpApiSwagger.d.ts +5 -2
  1039. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  1040. package/dist/unstable/httpapi/HttpApiSwagger.js +24 -2
  1041. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  1042. package/dist/unstable/httpapi/HttpApiTest.d.ts +9 -2
  1043. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  1044. package/dist/unstable/httpapi/HttpApiTest.js +28 -3
  1045. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  1046. package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
  1047. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  1048. package/dist/unstable/httpapi/OpenApi.js +73 -15
  1049. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  1050. package/dist/unstable/observability/Otlp.d.ts +33 -3
  1051. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  1052. package/dist/unstable/observability/Otlp.js +14 -3
  1053. package/dist/unstable/observability/Otlp.js.map +1 -1
  1054. package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
  1055. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  1056. package/dist/unstable/observability/OtlpExporter.js +32 -1
  1057. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  1058. package/dist/unstable/observability/OtlpLogger.d.ts +14 -2
  1059. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  1060. package/dist/unstable/observability/OtlpLogger.js +29 -2
  1061. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  1062. package/dist/unstable/observability/OtlpMetrics.d.ts +15 -4
  1063. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  1064. package/dist/unstable/observability/OtlpMetrics.js +32 -2
  1065. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  1066. package/dist/unstable/observability/OtlpResource.d.ts +49 -12
  1067. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  1068. package/dist/unstable/observability/OtlpResource.js +47 -5
  1069. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  1070. package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
  1071. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  1072. package/dist/unstable/observability/OtlpSerialization.js +28 -3
  1073. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  1074. package/dist/unstable/observability/OtlpTracer.d.ts +16 -2
  1075. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  1076. package/dist/unstable/observability/OtlpTracer.js +32 -2
  1077. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  1078. package/dist/unstable/observability/PrometheusMetrics.d.ts +32 -12
  1079. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  1080. package/dist/unstable/observability/PrometheusMetrics.js +7 -5
  1081. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  1082. package/dist/unstable/observability/index.d.ts +2 -1
  1083. package/dist/unstable/observability/index.d.ts.map +1 -1
  1084. package/dist/unstable/observability/index.js +2 -1
  1085. package/dist/unstable/observability/index.js.map +1 -1
  1086. package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
  1087. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  1088. package/dist/unstable/persistence/KeyValueStore.js +81 -21
  1089. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1090. package/dist/unstable/persistence/Persistable.d.ts +76 -15
  1091. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  1092. package/dist/unstable/persistence/Persistable.js +22 -5
  1093. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1094. package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
  1095. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  1096. package/dist/unstable/persistence/PersistedCache.js +24 -1
  1097. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1098. package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
  1099. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  1100. package/dist/unstable/persistence/PersistedQueue.js +60 -13
  1101. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1102. package/dist/unstable/persistence/Persistence.d.ts +97 -16
  1103. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1104. package/dist/unstable/persistence/Persistence.js +90 -14
  1105. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1106. package/dist/unstable/persistence/RateLimiter.d.ts +97 -21
  1107. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1108. package/dist/unstable/persistence/RateLimiter.js +82 -17
  1109. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1110. package/dist/unstable/persistence/Redis.d.ts +26 -5
  1111. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  1112. package/dist/unstable/persistence/Redis.js +36 -4
  1113. package/dist/unstable/persistence/Redis.js.map +1 -1
  1114. package/dist/unstable/process/ChildProcess.d.ts +89 -109
  1115. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1116. package/dist/unstable/process/ChildProcess.js +74 -23
  1117. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1118. package/dist/unstable/process/ChildProcessSpawner.d.ts +22 -11
  1119. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1120. package/dist/unstable/process/ChildProcessSpawner.js +11 -6
  1121. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1122. package/dist/unstable/process/index.d.ts +2 -1
  1123. package/dist/unstable/process/index.d.ts.map +1 -1
  1124. package/dist/unstable/process/index.js +2 -1
  1125. package/dist/unstable/process/index.js.map +1 -1
  1126. package/dist/unstable/reactivity/AsyncResult.d.ts +196 -59
  1127. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1128. package/dist/unstable/reactivity/AsyncResult.js +121 -36
  1129. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1130. package/dist/unstable/reactivity/Atom.d.ts +539 -130
  1131. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1132. package/dist/unstable/reactivity/Atom.js +256 -62
  1133. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1134. package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
  1135. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1136. package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
  1137. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1138. package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
  1139. package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
  1140. package/dist/unstable/reactivity/AtomRef.js +29 -3
  1141. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1142. package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
  1143. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  1144. package/dist/unstable/reactivity/AtomRegistry.js +69 -10
  1145. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1146. package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
  1147. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1148. package/dist/unstable/reactivity/AtomRpc.js +29 -1
  1149. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1150. package/dist/unstable/reactivity/Hydration.d.ts +28 -5
  1151. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  1152. package/dist/unstable/reactivity/Hydration.js +35 -3
  1153. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1154. package/dist/unstable/reactivity/Reactivity.d.ts +95 -13
  1155. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  1156. package/dist/unstable/reactivity/Reactivity.js +61 -7
  1157. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1158. package/dist/unstable/rpc/Rpc.d.ts +255 -56
  1159. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1160. package/dist/unstable/rpc/Rpc.js +44 -11
  1161. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1162. package/dist/unstable/rpc/RpcClient.d.ts +81 -19
  1163. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1164. package/dist/unstable/rpc/RpcClient.js +53 -13
  1165. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1166. package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
  1167. package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
  1168. package/dist/unstable/rpc/RpcClientError.js +26 -2
  1169. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1170. package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
  1171. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  1172. package/dist/unstable/rpc/RpcGroup.js +3 -1
  1173. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1174. package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
  1175. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1176. package/dist/unstable/rpc/RpcMessage.js +23 -7
  1177. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1178. package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
  1179. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  1180. package/dist/unstable/rpc/RpcMiddleware.js +39 -3
  1181. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1182. package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
  1183. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  1184. package/dist/unstable/rpc/RpcSchema.js +34 -3
  1185. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1186. package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
  1187. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1188. package/dist/unstable/rpc/RpcSerialization.js +56 -12
  1189. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1190. package/dist/unstable/rpc/RpcServer.d.ts +73 -23
  1191. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  1192. package/dist/unstable/rpc/RpcServer.js +70 -23
  1193. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1194. package/dist/unstable/rpc/RpcTest.d.ts +20 -1
  1195. package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
  1196. package/dist/unstable/rpc/RpcTest.js +20 -1
  1197. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1198. package/dist/unstable/rpc/RpcWorker.d.ts +40 -6
  1199. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  1200. package/dist/unstable/rpc/RpcWorker.js +17 -5
  1201. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1202. package/dist/unstable/rpc/Utils.d.ts +8 -0
  1203. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  1204. package/dist/unstable/rpc/Utils.js +8 -0
  1205. package/dist/unstable/rpc/Utils.js.map +1 -1
  1206. package/dist/unstable/schema/Model.d.ts +130 -52
  1207. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1208. package/dist/unstable/schema/Model.js +79 -34
  1209. package/dist/unstable/schema/Model.js.map +1 -1
  1210. package/dist/unstable/schema/VariantSchema.d.ts +104 -24
  1211. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1212. package/dist/unstable/schema/VariantSchema.js +22 -6
  1213. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1214. package/dist/unstable/socket/Socket.d.ts +167 -34
  1215. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1216. package/dist/unstable/socket/Socket.js +124 -29
  1217. package/dist/unstable/socket/Socket.js.map +1 -1
  1218. package/dist/unstable/socket/SocketServer.d.ts +58 -10
  1219. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  1220. package/dist/unstable/socket/SocketServer.js +43 -5
  1221. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1222. package/dist/unstable/sql/Migrator.d.ts +35 -4
  1223. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  1224. package/dist/unstable/sql/Migrator.js +45 -5
  1225. package/dist/unstable/sql/Migrator.js.map +1 -1
  1226. package/dist/unstable/sql/SqlClient.d.ts +34 -2
  1227. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1228. package/dist/unstable/sql/SqlClient.js +38 -1
  1229. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1230. package/dist/unstable/sql/SqlConnection.d.ts +31 -0
  1231. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  1232. package/dist/unstable/sql/SqlConnection.js +22 -0
  1233. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1234. package/dist/unstable/sql/SqlError.d.ts +99 -0
  1235. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  1236. package/dist/unstable/sql/SqlError.js +114 -0
  1237. package/dist/unstable/sql/SqlError.js.map +1 -1
  1238. package/dist/unstable/sql/SqlModel.d.ts +26 -5
  1239. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  1240. package/dist/unstable/sql/SqlModel.js +8 -4
  1241. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1242. package/dist/unstable/sql/SqlResolver.d.ts +56 -13
  1243. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  1244. package/dist/unstable/sql/SqlResolver.js +44 -10
  1245. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1246. package/dist/unstable/sql/SqlSchema.d.ts +29 -8
  1247. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  1248. package/dist/unstable/sql/SqlSchema.js +29 -8
  1249. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1250. package/dist/unstable/sql/SqlStream.d.ts +3 -0
  1251. package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
  1252. package/dist/unstable/sql/SqlStream.js +23 -0
  1253. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1254. package/dist/unstable/sql/Statement.d.ts +124 -0
  1255. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1256. package/dist/unstable/sql/Statement.js +82 -0
  1257. package/dist/unstable/sql/Statement.js.map +1 -1
  1258. package/dist/unstable/sql/index.d.ts +1 -1
  1259. package/dist/unstable/sql/index.js +1 -1
  1260. package/dist/unstable/workers/Transferable.d.ts +65 -13
  1261. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  1262. package/dist/unstable/workers/Transferable.js +53 -10
  1263. package/dist/unstable/workers/Transferable.js.map +1 -1
  1264. package/dist/unstable/workers/Worker.d.ts +60 -8
  1265. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  1266. package/dist/unstable/workers/Worker.js +43 -4
  1267. package/dist/unstable/workers/Worker.js.map +1 -1
  1268. package/dist/unstable/workers/WorkerError.d.ts +31 -9
  1269. package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
  1270. package/dist/unstable/workers/WorkerError.js +44 -7
  1271. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1272. package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
  1273. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  1274. package/dist/unstable/workers/WorkerRunner.js +24 -1
  1275. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1276. package/dist/unstable/workers/index.d.ts +1 -1
  1277. package/dist/unstable/workers/index.js +1 -1
  1278. package/dist/unstable/workflow/Activity.d.ts +61 -10
  1279. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  1280. package/dist/unstable/workflow/Activity.js +21 -6
  1281. package/dist/unstable/workflow/Activity.js.map +1 -1
  1282. package/dist/unstable/workflow/DurableClock.d.ts +12 -3
  1283. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  1284. package/dist/unstable/workflow/DurableClock.js +22 -2
  1285. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1286. package/dist/unstable/workflow/DurableDeferred.d.ts +126 -31
  1287. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1288. package/dist/unstable/workflow/DurableDeferred.js +76 -13
  1289. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1290. package/dist/unstable/workflow/DurableQueue.d.ts +145 -0
  1291. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -0
  1292. package/dist/unstable/workflow/DurableQueue.js +200 -0
  1293. package/dist/unstable/workflow/DurableQueue.js.map +1 -0
  1294. package/dist/unstable/workflow/Workflow.d.ts +100 -31
  1295. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1296. package/dist/unstable/workflow/Workflow.js +76 -20
  1297. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1298. package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
  1299. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  1300. package/dist/unstable/workflow/WorkflowEngine.js +16 -4
  1301. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1302. package/dist/unstable/workflow/WorkflowProxy.d.ts +32 -2
  1303. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1304. package/dist/unstable/workflow/WorkflowProxy.js +2 -2
  1305. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1306. package/dist/unstable/workflow/WorkflowProxyServer.d.ts +36 -2
  1307. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  1308. package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
  1309. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1310. package/dist/unstable/workflow/index.d.ts +4 -0
  1311. package/dist/unstable/workflow/index.d.ts.map +1 -1
  1312. package/dist/unstable/workflow/index.js +4 -0
  1313. package/dist/unstable/workflow/index.js.map +1 -1
  1314. package/package.json +11 -11
  1315. package/src/Array.ts +113 -67
  1316. package/src/BigDecimal.ts +404 -337
  1317. package/src/BigInt.ts +167 -97
  1318. package/src/Boolean.ts +62 -31
  1319. package/src/Brand.ts +20 -1
  1320. package/src/Cache.ts +331 -164
  1321. package/src/Cause.ts +77 -65
  1322. package/src/Channel.ts +1585 -607
  1323. package/src/ChannelSchema.ts +137 -12
  1324. package/src/Chunk.ts +549 -380
  1325. package/src/Clock.ts +15 -8
  1326. package/src/Combiner.ts +2 -4
  1327. package/src/Config.ts +12 -10
  1328. package/src/ConfigProvider.ts +1 -1
  1329. package/src/Console.ts +88 -58
  1330. package/src/Context.ts +397 -149
  1331. package/src/Cron.ts +111 -48
  1332. package/src/Data.ts +3 -2
  1333. package/src/DateTime.ts +876 -445
  1334. package/src/Deferred.ts +367 -174
  1335. package/src/Differ.ts +42 -0
  1336. package/src/Duration.ts +329 -185
  1337. package/src/Effect.ts +2474 -2395
  1338. package/src/Effectable.ts +39 -4
  1339. package/src/Encoding.ts +78 -28
  1340. package/src/Equivalence.ts +14 -19
  1341. package/src/ErrorReporter.ts +66 -82
  1342. package/src/ExecutionPlan.ts +97 -13
  1343. package/src/Exit.ts +7 -5
  1344. package/src/Fiber.ts +72 -40
  1345. package/src/FiberHandle.ts +158 -58
  1346. package/src/FiberMap.ts +329 -164
  1347. package/src/FiberSet.ts +130 -52
  1348. package/src/FileSystem.ts +106 -74
  1349. package/src/Filter.ts +166 -88
  1350. package/src/Function.ts +154 -86
  1351. package/src/Graph.ts +682 -365
  1352. package/src/HKT.ts +29 -13
  1353. package/src/Hash.ts +31 -18
  1354. package/src/HashMap.ts +444 -256
  1355. package/src/HashRing.ts +94 -17
  1356. package/src/HashSet.ts +194 -104
  1357. package/src/Inspectable.ts +22 -10
  1358. package/src/Iterable.ts +309 -149
  1359. package/src/JsonPatch.ts +4 -3
  1360. package/src/Latch.ts +98 -15
  1361. package/src/Layer.ts +488 -345
  1362. package/src/LayerMap.ts +98 -25
  1363. package/src/LogLevel.ts +92 -131
  1364. package/src/Logger.ts +357 -288
  1365. package/src/ManagedRuntime.ts +75 -17
  1366. package/src/Match.ts +133 -157
  1367. package/src/Metric.ts +355 -304
  1368. package/src/MutableHashMap.ts +161 -84
  1369. package/src/MutableHashSet.ts +122 -52
  1370. package/src/MutableList.ts +141 -81
  1371. package/src/MutableRef.ts +130 -90
  1372. package/src/Newtype.ts +3 -0
  1373. package/src/NonEmptyIterable.ts +36 -39
  1374. package/src/Number.ts +116 -64
  1375. package/src/Optic.ts +1 -2
  1376. package/src/Option.ts +41 -53
  1377. package/src/Ordering.ts +43 -28
  1378. package/src/PartitionedSemaphore.ts +225 -40
  1379. package/src/Path.ts +77 -13
  1380. package/src/Pipeable.ts +76 -21
  1381. package/src/PlatformError.ts +74 -6
  1382. package/src/Pool.ts +94 -31
  1383. package/src/Predicate.ts +16 -21
  1384. package/src/PrimaryKey.ts +9 -2
  1385. package/src/PubSub.ts +364 -262
  1386. package/src/Pull.ts +94 -25
  1387. package/src/Queue.ts +284 -150
  1388. package/src/Random.ts +54 -35
  1389. package/src/RcMap.ts +151 -141
  1390. package/src/RcRef.ts +69 -32
  1391. package/src/Record.ts +273 -129
  1392. package/src/Redactable.ts +3 -3
  1393. package/src/Redacted.ts +63 -33
  1394. package/src/Ref.ts +161 -104
  1395. package/src/References.ts +73 -31
  1396. package/src/RegExp.ts +11 -5
  1397. package/src/Request.ts +158 -34
  1398. package/src/RequestResolver.ts +277 -119
  1399. package/src/Resource.ts +45 -7
  1400. package/src/Result.ts +31 -18
  1401. package/src/Runtime.ts +45 -19
  1402. package/src/Schedule.ts +575 -600
  1403. package/src/Scheduler.ts +43 -6
  1404. package/src/Schema.ts +845 -319
  1405. package/src/SchemaAST.ts +25 -16
  1406. package/src/SchemaGetter.ts +32 -17
  1407. package/src/SchemaIssue.ts +1 -8
  1408. package/src/SchemaParser.ts +262 -38
  1409. package/src/SchemaTransformation.ts +61 -41
  1410. package/src/SchemaUtils.ts +23 -0
  1411. package/src/Scope.ts +102 -43
  1412. package/src/ScopedCache.ts +192 -56
  1413. package/src/ScopedRef.ts +28 -8
  1414. package/src/Semaphore.ts +64 -28
  1415. package/src/Sink.ts +458 -200
  1416. package/src/Stdio.ts +43 -6
  1417. package/src/Stream.ts +2043 -1256
  1418. package/src/String.ts +171 -95
  1419. package/src/SubscriptionRef.ts +308 -203
  1420. package/src/Symbol.ts +13 -5
  1421. package/src/SynchronizedRef.ts +278 -62
  1422. package/src/Take.ts +26 -2
  1423. package/src/Terminal.ts +40 -7
  1424. package/src/Tracer.ts +229 -55
  1425. package/src/Trie.ts +213 -142
  1426. package/src/TxChunk.ts +182 -146
  1427. package/src/TxDeferred.ts +43 -29
  1428. package/src/TxHashMap.ts +370 -230
  1429. package/src/TxHashSet.ts +250 -152
  1430. package/src/TxPriorityQueue.ts +96 -64
  1431. package/src/TxPubSub.ts +77 -49
  1432. package/src/TxQueue.ts +279 -241
  1433. package/src/TxReentrantLock.ts +70 -47
  1434. package/src/TxRef.ts +70 -41
  1435. package/src/TxSemaphore.ts +101 -54
  1436. package/src/TxSubscriptionRef.ts +72 -48
  1437. package/src/Types.ts +34 -34
  1438. package/src/UndefinedOr.ts +48 -25
  1439. package/src/Unify.ts +71 -116
  1440. package/src/Utils.ts +4 -0
  1441. package/src/index.ts +81 -32
  1442. package/src/internal/concurrency.ts +2 -2
  1443. package/src/internal/core.ts +12 -23
  1444. package/src/internal/effect.ts +25 -29
  1445. package/src/internal/executionPlan.ts +2 -2
  1446. package/src/internal/option.ts +5 -8
  1447. package/src/internal/result.ts +5 -8
  1448. package/src/internal/schema/schema.ts +1 -1
  1449. package/src/testing/FastCheck.ts +6 -3
  1450. package/src/testing/TestClock.ts +63 -34
  1451. package/src/testing/TestConsole.ts +49 -30
  1452. package/src/testing/TestSchema.ts +8 -8
  1453. package/src/unstable/ai/AiError.ts +187 -120
  1454. package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
  1455. package/src/unstable/ai/Chat.ts +69 -43
  1456. package/src/unstable/ai/EmbeddingModel.ts +12 -11
  1457. package/src/unstable/ai/IdGenerator.ts +28 -18
  1458. package/src/unstable/ai/LanguageModel.ts +47 -46
  1459. package/src/unstable/ai/McpSchema.ts +339 -119
  1460. package/src/unstable/ai/McpServer.ts +78 -21
  1461. package/src/unstable/ai/Model.ts +23 -18
  1462. package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
  1463. package/src/unstable/ai/Prompt.ts +210 -184
  1464. package/src/unstable/ai/Response.ts +159 -147
  1465. package/src/unstable/ai/ResponseIdTracker.ts +43 -4
  1466. package/src/unstable/ai/Telemetry.ts +42 -32
  1467. package/src/unstable/ai/Tokenizer.ts +13 -8
  1468. package/src/unstable/ai/Tool.ts +154 -85
  1469. package/src/unstable/ai/Toolkit.ts +81 -84
  1470. package/src/unstable/ai/index.ts +42 -24
  1471. package/src/unstable/cli/Argument.ts +226 -134
  1472. package/src/unstable/cli/CliError.ts +96 -26
  1473. package/src/unstable/cli/CliOutput.ts +43 -13
  1474. package/src/unstable/cli/Command.ts +225 -125
  1475. package/src/unstable/cli/Completions.ts +7 -7
  1476. package/src/unstable/cli/Flag.ts +235 -142
  1477. package/src/unstable/cli/GlobalFlag.ts +42 -14
  1478. package/src/unstable/cli/HelpDoc.ts +35 -10
  1479. package/src/unstable/cli/Param.ts +328 -190
  1480. package/src/unstable/cli/Primitive.ts +79 -42
  1481. package/src/unstable/cli/Prompt.ts +210 -58
  1482. package/src/unstable/cli/internal/ansi.ts +13 -0
  1483. package/src/unstable/cli/internal/command.ts +17 -15
  1484. package/src/unstable/cli/internal/config.ts +3 -0
  1485. package/src/unstable/cli/internal/lexer.ts +11 -0
  1486. package/src/unstable/cluster/ClusterCron.ts +35 -1
  1487. package/src/unstable/cluster/ClusterError.ts +56 -7
  1488. package/src/unstable/cluster/ClusterMetrics.ts +39 -5
  1489. package/src/unstable/cluster/ClusterSchema.ts +61 -8
  1490. package/src/unstable/cluster/ClusterWorkflowEngine.ts +36 -3
  1491. package/src/unstable/cluster/DeliverAt.ts +39 -4
  1492. package/src/unstable/cluster/Entity.ts +110 -19
  1493. package/src/unstable/cluster/EntityAddress.ts +30 -2
  1494. package/src/unstable/cluster/EntityId.ts +18 -3
  1495. package/src/unstable/cluster/EntityProxy.ts +34 -2
  1496. package/src/unstable/cluster/EntityProxyServer.ts +44 -8
  1497. package/src/unstable/cluster/EntityResource.ts +43 -6
  1498. package/src/unstable/cluster/EntityType.ts +27 -3
  1499. package/src/unstable/cluster/Envelope.ts +128 -23
  1500. package/src/unstable/cluster/HttpRunner.ts +88 -13
  1501. package/src/unstable/cluster/K8sHttpClient.ts +49 -6
  1502. package/src/unstable/cluster/MachineId.ts +24 -3
  1503. package/src/unstable/cluster/Message.ts +102 -13
  1504. package/src/unstable/cluster/MessageStorage.ts +128 -22
  1505. package/src/unstable/cluster/Reply.ts +101 -12
  1506. package/src/unstable/cluster/Runner.ts +47 -17
  1507. package/src/unstable/cluster/RunnerAddress.ts +34 -2
  1508. package/src/unstable/cluster/RunnerHealth.ts +40 -12
  1509. package/src/unstable/cluster/RunnerServer.ts +31 -4
  1510. package/src/unstable/cluster/RunnerStorage.ts +42 -5
  1511. package/src/unstable/cluster/Runners.ts +73 -10
  1512. package/src/unstable/cluster/ShardId.ts +51 -5
  1513. package/src/unstable/cluster/Sharding.ts +35 -4
  1514. package/src/unstable/cluster/ShardingConfig.ts +76 -11
  1515. package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
  1516. package/src/unstable/cluster/SingleRunner.ts +23 -1
  1517. package/src/unstable/cluster/Singleton.ts +15 -1
  1518. package/src/unstable/cluster/SingletonAddress.ts +21 -1
  1519. package/src/unstable/cluster/Snowflake.ts +89 -19
  1520. package/src/unstable/cluster/SocketRunner.ts +29 -2
  1521. package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
  1522. package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
  1523. package/src/unstable/cluster/TestRunner.ts +18 -1
  1524. package/src/unstable/cluster/internal/hash.ts +12 -0
  1525. package/src/unstable/devtools/DevTools.ts +26 -3
  1526. package/src/unstable/devtools/DevToolsClient.ts +32 -5
  1527. package/src/unstable/devtools/DevToolsSchema.ts +201 -44
  1528. package/src/unstable/devtools/DevToolsServer.ts +27 -2
  1529. package/src/unstable/encoding/Msgpack.ts +97 -12
  1530. package/src/unstable/encoding/Ndjson.ts +149 -21
  1531. package/src/unstable/encoding/Sse.ts +109 -18
  1532. package/src/unstable/eventlog/Event.ts +131 -30
  1533. package/src/unstable/eventlog/EventGroup.ts +50 -17
  1534. package/src/unstable/eventlog/EventJournal.ts +120 -20
  1535. package/src/unstable/eventlog/EventLog.ts +151 -31
  1536. package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
  1537. package/src/unstable/eventlog/EventLogMessage.ts +92 -18
  1538. package/src/unstable/eventlog/EventLogRemote.ts +54 -8
  1539. package/src/unstable/eventlog/EventLogServer.ts +33 -3
  1540. package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
  1541. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
  1542. package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
  1543. package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
  1544. package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
  1545. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
  1546. package/src/unstable/http/Cookies.ts +156 -77
  1547. package/src/unstable/http/Etag.ts +40 -7
  1548. package/src/unstable/http/FetchHttpClient.ts +33 -4
  1549. package/src/unstable/http/FindMyWay.ts +1 -1
  1550. package/src/unstable/http/Headers.ts +252 -50
  1551. package/src/unstable/http/HttpBody.ts +130 -28
  1552. package/src/unstable/http/HttpClient.ts +206 -97
  1553. package/src/unstable/http/HttpClientError.ts +80 -12
  1554. package/src/unstable/http/HttpClientRequest.ts +320 -102
  1555. package/src/unstable/http/HttpClientResponse.ts +59 -16
  1556. package/src/unstable/http/HttpEffect.ts +66 -18
  1557. package/src/unstable/http/HttpIncomingMessage.ts +47 -7
  1558. package/src/unstable/http/HttpMethod.ts +35 -5
  1559. package/src/unstable/http/HttpMiddleware.ts +63 -16
  1560. package/src/unstable/http/HttpPlatform.ts +35 -4
  1561. package/src/unstable/http/HttpRouter.ts +221 -57
  1562. package/src/unstable/http/HttpServer.ts +152 -23
  1563. package/src/unstable/http/HttpServerError.ts +90 -10
  1564. package/src/unstable/http/HttpServerRequest.ts +136 -32
  1565. package/src/unstable/http/HttpServerRespondable.ts +49 -6
  1566. package/src/unstable/http/HttpServerResponse.ts +395 -72
  1567. package/src/unstable/http/HttpStaticServer.ts +22 -4
  1568. package/src/unstable/http/HttpTraceContext.ts +53 -6
  1569. package/src/unstable/http/Multipart.ts +179 -29
  1570. package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
  1571. package/src/unstable/http/Multipasta/Node.ts +1 -1
  1572. package/src/unstable/http/Multipasta/Search.ts +1 -1
  1573. package/src/unstable/http/Multipasta/Web.ts +1 -1
  1574. package/src/unstable/http/Multipasta.ts +1 -1
  1575. package/src/unstable/http/Template.ts +53 -0
  1576. package/src/unstable/http/Url.ts +56 -42
  1577. package/src/unstable/http/UrlParams.ts +233 -49
  1578. package/src/unstable/httpapi/HttpApi.ts +49 -14
  1579. package/src/unstable/httpapi/HttpApiBuilder.ts +86 -20
  1580. package/src/unstable/httpapi/HttpApiClient.ts +80 -16
  1581. package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
  1582. package/src/unstable/httpapi/HttpApiError.ts +100 -1
  1583. package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
  1584. package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -23
  1585. package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
  1586. package/src/unstable/httpapi/HttpApiSchema.ts +67 -30
  1587. package/src/unstable/httpapi/HttpApiSecurity.ts +74 -17
  1588. package/src/unstable/httpapi/HttpApiSwagger.ts +24 -2
  1589. package/src/unstable/httpapi/HttpApiTest.ts +31 -3
  1590. package/src/unstable/httpapi/OpenApi.ts +115 -15
  1591. package/src/unstable/observability/Otlp.ts +33 -3
  1592. package/src/unstable/observability/OtlpExporter.ts +32 -1
  1593. package/src/unstable/observability/OtlpLogger.ts +31 -2
  1594. package/src/unstable/observability/OtlpMetrics.ts +37 -4
  1595. package/src/unstable/observability/OtlpResource.ts +68 -12
  1596. package/src/unstable/observability/OtlpSerialization.ts +28 -3
  1597. package/src/unstable/observability/OtlpTracer.ts +38 -2
  1598. package/src/unstable/observability/PrometheusMetrics.ts +32 -12
  1599. package/src/unstable/observability/index.ts +2 -1
  1600. package/src/unstable/persistence/KeyValueStore.ts +108 -28
  1601. package/src/unstable/persistence/Persistable.ts +76 -15
  1602. package/src/unstable/persistence/PersistedCache.ts +27 -2
  1603. package/src/unstable/persistence/PersistedQueue.ts +98 -16
  1604. package/src/unstable/persistence/Persistence.ts +97 -16
  1605. package/src/unstable/persistence/RateLimiter.ts +98 -22
  1606. package/src/unstable/persistence/Redis.ts +42 -5
  1607. package/src/unstable/process/ChildProcess.ts +100 -79
  1608. package/src/unstable/process/ChildProcessSpawner.ts +22 -11
  1609. package/src/unstable/process/index.ts +2 -1
  1610. package/src/unstable/reactivity/AsyncResult.ts +202 -61
  1611. package/src/unstable/reactivity/Atom.ts +597 -143
  1612. package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
  1613. package/src/unstable/reactivity/AtomRef.ts +51 -7
  1614. package/src/unstable/reactivity/AtomRegistry.ts +141 -22
  1615. package/src/unstable/reactivity/AtomRpc.ts +36 -2
  1616. package/src/unstable/reactivity/Hydration.ts +45 -5
  1617. package/src/unstable/reactivity/Reactivity.ts +95 -13
  1618. package/src/unstable/rpc/Rpc.ts +255 -56
  1619. package/src/unstable/rpc/RpcClient.ts +108 -20
  1620. package/src/unstable/rpc/RpcClientError.ts +26 -2
  1621. package/src/unstable/rpc/RpcGroup.ts +51 -8
  1622. package/src/unstable/rpc/RpcMessage.ts +128 -32
  1623. package/src/unstable/rpc/RpcMiddleware.ts +100 -20
  1624. package/src/unstable/rpc/RpcSchema.ts +38 -4
  1625. package/src/unstable/rpc/RpcSerialization.ts +60 -13
  1626. package/src/unstable/rpc/RpcServer.ts +108 -25
  1627. package/src/unstable/rpc/RpcTest.ts +20 -1
  1628. package/src/unstable/rpc/RpcWorker.ts +42 -8
  1629. package/src/unstable/rpc/Utils.ts +31 -0
  1630. package/src/unstable/schema/Model.ts +148 -52
  1631. package/src/unstable/schema/VariantSchema.ts +104 -24
  1632. package/src/unstable/socket/Socket.ts +168 -35
  1633. package/src/unstable/socket/SocketServer.ts +58 -10
  1634. package/src/unstable/sql/Migrator.ts +57 -5
  1635. package/src/unstable/sql/SqlClient.ts +55 -2
  1636. package/src/unstable/sql/SqlConnection.ts +31 -0
  1637. package/src/unstable/sql/SqlError.ts +117 -0
  1638. package/src/unstable/sql/SqlModel.ts +26 -5
  1639. package/src/unstable/sql/SqlResolver.ts +56 -13
  1640. package/src/unstable/sql/SqlSchema.ts +29 -8
  1641. package/src/unstable/sql/SqlStream.ts +23 -0
  1642. package/src/unstable/sql/Statement.ts +141 -0
  1643. package/src/unstable/sql/index.ts +1 -1
  1644. package/src/unstable/workers/Transferable.ts +65 -13
  1645. package/src/unstable/workers/Worker.ts +60 -8
  1646. package/src/unstable/workers/WorkerError.ts +50 -9
  1647. package/src/unstable/workers/WorkerRunner.ts +32 -3
  1648. package/src/unstable/workers/index.ts +1 -1
  1649. package/src/unstable/workflow/Activity.ts +62 -11
  1650. package/src/unstable/workflow/DurableClock.ts +26 -3
  1651. package/src/unstable/workflow/DurableDeferred.ts +146 -31
  1652. package/src/unstable/workflow/DurableQueue.ts +366 -0
  1653. package/src/unstable/workflow/Workflow.ts +122 -32
  1654. package/src/unstable/workflow/WorkflowEngine.ts +40 -5
  1655. package/src/unstable/workflow/WorkflowProxy.ts +32 -2
  1656. package/src/unstable/workflow/WorkflowProxyServer.ts +40 -6
  1657. package/src/unstable/workflow/index.ts +5 -0
package/dist/Effect.js CHANGED
@@ -10,21 +10,19 @@ import * as internalRequest from "./internal/request.js";
10
10
  import * as internalSchedule from "./internal/schedule.js";
11
11
  import * as Metric from "./Metric.js";
12
12
  import { CurrentLogAnnotations, CurrentLogSpans } from "./References.js";
13
- import { internalCall, SingleShotGen } from "./Utils.js";
14
- const TypeId = core.EffectTypeId;
13
+ import { internalCall } from "./Utils.js";
15
14
  /**
16
- * @since 4.0.0
17
- * @category Yieldable
15
+ * Runtime identifier used to recognize `Effect` values.
16
+ *
17
+ * @category Type identifiers
18
+ * @since 2.0.0
18
19
  */
19
- export class YieldableClass {
20
- [Symbol.iterator]() {
21
- return new SingleShotGen(this);
22
- }
23
- }
20
+ export const TypeId = core.EffectTypeId;
24
21
  /**
25
22
  * Tests if a value is an `Effect`.
26
23
  *
27
- * @example
24
+ * **Example** (Usage)
25
+ *
28
26
  * ```ts
29
27
  * import { Effect } from "effect"
30
28
  *
@@ -32,54 +30,30 @@ export class YieldableClass {
32
30
  * console.log(Effect.isEffect("hello")) // false
33
31
  * ```
34
32
  *
35
- * @since 2.0.0
36
33
  * @category Guards
34
+ * @since 2.0.0
37
35
  */
38
36
  export const isEffect = core.isEffect;
39
37
  /**
40
- * Combines multiple effects into one, returning results based on the input
41
- * structure.
38
+ * Combines an iterable or record of effects into one effect whose success shape
39
+ * follows the input.
42
40
  *
43
41
  * **Details**
44
42
  *
45
- * Use this function when you need to run multiple effects and combine their
46
- * results into a single output. It supports tuples, iterables, structs, and
47
- * records, making it flexible for different input types.
48
- *
49
- * For instance, if the input is a tuple:
50
- *
51
- * ```ts skip-type-checking
52
- * // ┌─── a tuple of effects
53
- * // ▼
54
- * Effect.all([effect1, effect2, ...])
55
- * ```
56
- *
57
- * the effects are executed sequentially, and the result is a new effect
58
- * containing the results as a tuple. The results in the tuple match the order
59
- * of the effects passed to `Effect.all`.
60
- *
61
- * **Concurrency**
62
- *
63
- * You can control the execution order (e.g., sequential vs. concurrent) using
64
- * the `concurrency` option.
43
+ * Tuple and iterable inputs collect results in order. Record inputs collect
44
+ * results under the same keys. By default, the combined effect fails on the
45
+ * first failure; with concurrent execution, effects that have already started
46
+ * may be interrupted, while effects not yet started are skipped.
65
47
  *
66
- * **Short-Circuiting Behavior**
48
+ * **Options**
67
49
  *
68
- * This function stops execution on the first error it encounters, this is
69
- * called "short-circuiting". If any effect in the collection fails, the
70
- * remaining effects will not run, and the error will be propagated. To change
71
- * this behavior, you can use the `mode` option, which allows all effects to run
72
- * and collect every success / failure as `Result` values.
50
+ * Use `concurrency` to control sequential or concurrent execution. Use
51
+ * `mode: "result"` to run every effect and collect each success or failure as a
52
+ * `Result` in the same output shape. Use `discard: true` to ignore successful
53
+ * values and return `void`.
73
54
  *
74
- * **The `mode` option**
55
+ * **Example** (Combining Effects in Tuples)
75
56
  *
76
- * The `{ mode: "result" }` option changes the behavior of `Effect.all` to
77
- * ensure all effects run, even if some fail. Instead of stopping on the first
78
- * failure, this mode collects both successes and failures, returning an array
79
- * of `Result` instances where each result is either an `Ok` (success) or a
80
- * `Err` (failure).
81
- *
82
- * @example Combining Effects in Tuples
83
57
  * ```ts
84
58
  * import { Console, Effect } from "effect"
85
59
  *
@@ -99,7 +73,8 @@ export const isEffect = core.isEffect;
99
73
  * // [ 42, 'Hello' ]
100
74
  * ```
101
75
  *
102
- * @example Combining Effects in Iterables
76
+ * **Example** (Combining Effects in Iterables)
77
+ *
103
78
  * ```ts
104
79
  * import { Console, Effect } from "effect"
105
80
  *
@@ -119,7 +94,8 @@ export const isEffect = core.isEffect;
119
94
  * // [ 1, 2, 3 ]
120
95
  * ```
121
96
  *
122
- * @example Combining Effects in Structs
97
+ * **Example** (Combining Effects in Structs)
98
+ *
123
99
  * ```ts
124
100
  * import { Console, Effect } from "effect"
125
101
  *
@@ -139,7 +115,8 @@ export const isEffect = core.isEffect;
139
115
  * // { a: 42, b: 'Hello' }
140
116
  * ```
141
117
  *
142
- * @example Combining Effects in Records
118
+ * **Example** (Combining Effects in Records)
119
+ *
143
120
  * ```ts
144
121
  * import { Console, Effect } from "effect"
145
122
  *
@@ -159,7 +136,8 @@ export const isEffect = core.isEffect;
159
136
  * // { key1: 1, key2: 2 }
160
137
  * ```
161
138
  *
162
- * @example Short-Circuiting Behavior
139
+ * **Example** (Short-Circuiting Behavior)
140
+ *
163
141
  * ```ts
164
142
  * import { Console, Effect } from "effect"
165
143
  *
@@ -182,8 +160,8 @@ export const isEffect = core.isEffect;
182
160
  *
183
161
  * @see {@link forEach} for iterating over elements and applying an effect.
184
162
  *
185
- * @since 2.0.0
186
163
  * @category Collecting
164
+ * @since 2.0.0
187
165
  */
188
166
  export const all = internal.all;
189
167
  /**
@@ -198,7 +176,8 @@ export const all = internal.all;
198
176
  * This function runs every effect and never fails. Use `concurrency` to control
199
177
  * parallelism.
200
178
  *
201
- * @example
179
+ * **Example** (Usage)
180
+ *
202
181
  * ```ts
203
182
  * import { Effect } from "effect"
204
183
  *
@@ -210,8 +189,8 @@ export const all = internal.all;
210
189
  * // [ ["0 is even", "2 is even"], [1, 3] ]
211
190
  * ```
212
191
  *
213
- * @since 3.0.0
214
192
  * @category Collecting
193
+ * @since 3.0.0
215
194
  */
216
195
  export const partition = internal.partition;
217
196
  /**
@@ -224,7 +203,8 @@ export const partition = internal.partition;
224
203
  * Use `discard: true` to ignore successful values while still validating all
225
204
  * elements.
226
205
  *
227
- * @example
206
+ * **Example** (Usage)
207
+ *
228
208
  * ```ts
229
209
  * import { Effect } from "effect"
230
210
  *
@@ -246,8 +226,8 @@ export const partition = internal.partition;
246
226
  * // }
247
227
  * ```
248
228
  *
249
- * @since 4.0.0
250
229
  * @category Error Accumulation
230
+ * @since 4.0.0
251
231
  */
252
232
  export const validate = internal.validate;
253
233
  /**
@@ -256,7 +236,8 @@ export const validate = internal.validate;
256
236
  * The predicate receives the element and its index. Evaluation short-circuits
257
237
  * as soon as an element matches.
258
238
  *
259
- * @example
239
+ * **Example** (Usage)
240
+ *
260
241
  * ```ts
261
242
  * import { Effect } from "effect"
262
243
  *
@@ -266,8 +247,8 @@ export const validate = internal.validate;
266
247
  * // { _id: 'Option', _tag: 'Some', value: 3 }
267
248
  * ```
268
249
  *
269
- * @since 2.0.0
270
250
  * @category Collecting
251
+ * @since 2.0.0
271
252
  */
272
253
  export const findFirst = internal.findFirst;
273
254
  /**
@@ -276,8 +257,8 @@ export const findFirst = internal.findFirst;
276
257
  * The filter receives the element and index. Evaluation short-circuits on the
277
258
  * first `Result.succeed` and returns the transformed value in `Option.some`.
278
259
  *
279
- * @since 4.0.0
280
260
  * @category Collecting
261
+ * @since 4.0.0
281
262
  */
282
263
  export const findFirstFilter = internal.findFirstFilter;
283
264
  /**
@@ -303,9 +284,9 @@ export const findFirstFilter = internal.findFirstFilter;
303
284
  *
304
285
  * @see {@link all} for combining multiple effects into one.
305
286
  *
306
- * @example
287
+ * **Example** (Applying Effects to Iterable Elements)
288
+ *
307
289
  * ```ts
308
- * // Title: Applying Effects to Iterable Elements
309
290
  * import { Effect } from "effect"
310
291
  * import { Console } from "effect"
311
292
  *
@@ -325,8 +306,9 @@ export const findFirstFilter = internal.findFirstFilter;
325
306
  * // [ 2, 4, 6, 8, 10 ]
326
307
  * ```
327
308
  *
328
- * @example
329
- * // Title: Using discard to Ignore Results
309
+ * **Example** (Using discard to Ignore Results)
310
+ *
311
+ * ```ts
330
312
  * import { Effect } from "effect"
331
313
  * import { Console } from "effect"
332
314
  *
@@ -346,15 +328,17 @@ export const findFirstFilter = internal.findFirstFilter;
346
328
  * // Currently at index 3
347
329
  * // Currently at index 4
348
330
  * // undefined
331
+ * ```
349
332
  *
350
- * @since 2.0.0
351
333
  * @category Collecting
334
+ * @since 2.0.0
352
335
  */
353
336
  export const forEach = internal.forEach;
354
337
  /**
355
338
  * Executes a body effect repeatedly while a condition holds true.
356
339
  *
357
- * @example
340
+ * **Example** (Usage)
341
+ *
358
342
  * ```ts
359
343
  * import { Effect } from "effect"
360
344
  *
@@ -375,8 +359,8 @@ export const forEach = internal.forEach;
375
359
  * // Current count: 5
376
360
  * ```
377
361
  *
378
- * @since 2.0.0
379
362
  * @category Collecting
363
+ * @since 2.0.0
380
364
  */
381
365
  export const whileLoop = internal.whileLoop;
382
366
  // -----------------------------------------------------------------------------
@@ -407,9 +391,9 @@ export const whileLoop = internal.whileLoop;
407
391
  *
408
392
  * @see {@link tryPromise} for a version that can handle failures.
409
393
  *
410
- * @example
394
+ * **Example** (Delayed Message)
395
+ *
411
396
  * ```ts
412
- * // Title: Delayed Message
413
397
  * import { Effect } from "effect"
414
398
  *
415
399
  * const delay = (message: string) =>
@@ -427,8 +411,8 @@ export const whileLoop = internal.whileLoop;
427
411
  * const program = delay("Async operation completed successfully!")
428
412
  * ```
429
413
  *
430
- * @since 2.0.0
431
414
  * @category Creating Effects
415
+ * @since 2.0.0
432
416
  */
433
417
  export const promise = internal.promise;
434
418
  /**
@@ -457,7 +441,8 @@ export const promise = internal.promise;
457
441
  * An optional `AbortSignal` can be provided to allow for interruption of the
458
442
  * wrapped `Promise` API.
459
443
  *
460
- * @example Fetching a TODO Item
444
+ * **Example** (Fetching a TODO Item)
445
+ *
461
446
  * ```ts
462
447
  * import { Effect } from "effect"
463
448
  *
@@ -472,7 +457,8 @@ export const promise = internal.promise;
472
457
  * const program = getTodo(1)
473
458
  * ```
474
459
  *
475
- * @example Custom Error Handling
460
+ * **Example** (Custom Error Handling)
461
+ *
476
462
  * ```ts
477
463
  * import { Data, Effect } from "effect"
478
464
  *
@@ -492,8 +478,8 @@ export const promise = internal.promise;
492
478
  *
493
479
  * @see {@link promise} if the effectful computation is asynchronous and does not throw errors.
494
480
  *
495
- * @since 2.0.0
496
481
  * @category Creating Effects
482
+ * @since 2.0.0
497
483
  */
498
484
  export const tryPromise = internal.tryPromise;
499
485
  /**
@@ -506,9 +492,9 @@ export const tryPromise = internal.tryPromise;
506
492
  *
507
493
  * @see {@link fail} to create an effect that represents a failure.
508
494
  *
509
- * @example
495
+ * **Example** (Creating a Successful Effect)
496
+ *
510
497
  * ```ts
511
- * // Title: Creating a Successful Effect
512
498
  * import { Effect } from "effect"
513
499
  *
514
500
  * // Creating an effect that represents a successful scenario
@@ -518,14 +504,15 @@ export const tryPromise = internal.tryPromise;
518
504
  * const success = Effect.succeed(42)
519
505
  * ```
520
506
  *
521
- * @since 2.0.0
522
507
  * @category Creating Effects
508
+ * @since 2.0.0
523
509
  */
524
510
  export const succeed = internal.succeed;
525
511
  /**
526
512
  * Returns an effect which succeeds with `None`.
527
513
  *
528
- * @example
514
+ * **Example** (Usage)
515
+ *
529
516
  * ```ts
530
517
  * import { Effect } from "effect"
531
518
  *
@@ -535,14 +522,15 @@ export const succeed = internal.succeed;
535
522
  * // Output: { _id: 'Option', _tag: 'None' }
536
523
  * ```
537
524
  *
538
- * @since 2.0.0
539
525
  * @category Creating Effects
526
+ * @since 2.0.0
540
527
  */
541
528
  export const succeedNone = internal.succeedNone;
542
529
  /**
543
530
  * Returns an effect which succeeds with the value wrapped in a `Some`.
544
531
  *
545
- * @example
532
+ * **Example** (Usage)
533
+ *
546
534
  * ```ts
547
535
  * import { Effect } from "effect"
548
536
  *
@@ -552,8 +540,8 @@ export const succeedNone = internal.succeedNone;
552
540
  * // Output: { _id: 'Option', _tag: 'Some', value: 42 }
553
541
  * ```
554
542
  *
555
- * @since 2.0.0
556
543
  * @category Creating Effects
544
+ * @since 2.0.0
557
545
  */
558
546
  export const succeedSome = internal.succeedSome;
559
547
  /**
@@ -570,9 +558,9 @@ export const succeedSome = internal.succeedSome;
570
558
  * - **Handling Circular Dependencies**: Useful in managing circular dependencies, such as recursive functions that need to avoid eager evaluation to prevent stack overflow.
571
559
  * - **Unifying Return Types**: Can help TypeScript unify return types in situations where multiple branches of logic return different effects, simplifying type inference.
572
560
  *
573
- * @example
561
+ * **Example** (Lazy Evaluation with Side Effects)
562
+ *
574
563
  * ```ts
575
- * // Title: Lazy Evaluation with Side Effects
576
564
  * import { Effect } from "effect"
577
565
  *
578
566
  * let i = 0
@@ -588,8 +576,9 @@ export const succeedSome = internal.succeedSome;
588
576
  * console.log(Effect.runSync(good)) // Output: 2
589
577
  * ```
590
578
  *
591
- * @example
592
- * // Title: Recursive Fibonacci
579
+ * **Example** (Recursive Fibonacci)
580
+ *
581
+ * ```ts
593
582
  * import { Effect } from "effect"
594
583
  *
595
584
  * const blowsUp = (n: number): Effect.Effect<number> =>
@@ -611,9 +600,11 @@ export const succeedSome = internal.succeedSome;
611
600
  *
612
601
  * console.log(Effect.runSync(allGood(32)))
613
602
  * // Output: 3524578
603
+ * ```
614
604
  *
615
- * @example
616
- * // Title: Using Effect.suspend to Help TypeScript Infer Types
605
+ * **Example** (Using Effect.suspend to Help TypeScript Infer Types)
606
+ *
607
+ * ```ts
617
608
  * import { Effect } from "effect"
618
609
  *
619
610
  * // Without suspend, TypeScript may struggle with type inference.
@@ -634,9 +625,10 @@ export const succeedSome = internal.succeedSome;
634
625
  * ? Effect.fail(new Error("Cannot divide by zero"))
635
626
  * : Effect.succeed(a / b)
636
627
  * )
628
+ * ```
637
629
  *
638
- * @since 2.0.0
639
630
  * @category Creating Effects
631
+ * @since 2.0.0
640
632
  */
641
633
  export const suspend = internal.suspend;
642
634
  /**
@@ -658,9 +650,9 @@ export const suspend = internal.suspend;
658
650
  *
659
651
  * @see {@link try_ | try} for a version that can handle failures.
660
652
  *
661
- * @example
653
+ * **Example** (Logging a Message)
654
+ *
662
655
  * ```ts
663
- * // Title: Logging a Message
664
656
  * import { Effect } from "effect"
665
657
  *
666
658
  * const log = (message: string) =>
@@ -673,54 +665,47 @@ export const suspend = internal.suspend;
673
665
  * const program = log("Hello, World!")
674
666
  * ```
675
667
  *
676
- * @since 2.0.0
677
668
  * @category Creating Effects
669
+ * @since 2.0.0
678
670
  */
679
671
  export const sync = internal.sync;
680
672
  const void_ = internal.void;
681
673
  export {
682
674
  /**
683
- * @since 2.0.0
684
675
  * @category Creating Effects
676
+ * @since 2.0.0
685
677
  */
686
678
  void_ as void };
687
679
  const undefined_ = internal.undefined;
688
680
  export {
689
681
  /**
690
- * @since 4.0.0
691
682
  * @category Creating Effects
683
+ * @since 4.0.0
692
684
  */
693
685
  undefined_ as undefined };
694
686
  /**
695
- * Creates an `Effect` from a callback-based asynchronous function.
687
+ * Creates an `Effect` from a callback-based asynchronous API.
696
688
  *
697
689
  * **Details**
698
690
  *
699
- * The `resume` function:
700
- * - Must be called exactly once. Any additional calls will be ignored.
701
- * - Can return an optional `Effect` that will be run if the `Fiber` executing
702
- * this `Effect` is interrupted. This can be useful in scenarios where you
703
- * need to handle resource cleanup if the operation is interrupted.
704
- * - Can receive an `AbortSignal` to handle interruption if needed.
705
- *
706
- * The `FiberId` of the fiber that may complete the async callback may also be
707
- * specified using the `blockingOn` argument. This is called the "blocking
708
- * fiber" because it suspends the fiber executing the `async` effect (i.e.
709
- * semantically blocks the fiber from making progress). Specifying this fiber id
710
- * in cases where it is known will improve diagnostics, but not affect the
711
- * behavior of the returned effect.
691
+ * The registration function receives a `resume` callback and, when requested,
692
+ * an `AbortSignal`. Call `resume` at most once with the effect that should
693
+ * complete the fiber; later calls are ignored. Return an optional cleanup
694
+ * effect from the registration function to run if the fiber is interrupted.
712
695
  *
713
696
  * **When to Use**
714
697
  *
715
- * Use `Effect.callback` when dealing with APIs that use callback-style instead of
716
- * `async/await` or `Promise`.
717
- * * **Previously Known As**
698
+ * Use `Effect.callback` when integrating APIs that complete through callbacks
699
+ * instead of returning a `Promise`.
700
+ *
701
+ * **Previously Known As**
718
702
  *
719
703
  * This API replaces the following from Effect 3.x:
720
704
  *
721
705
  * - `Effect.async`
722
706
  *
723
- * @example
707
+ * **Example** (Usage)
708
+ *
724
709
  * ```ts
725
710
  * import { Effect } from "effect"
726
711
  *
@@ -736,15 +721,16 @@ undefined_ as undefined };
736
721
  * const program = delay(1000)
737
722
  * ```
738
723
  *
739
- * @since 2.0.0
740
724
  * @category Creating Effects
725
+ * @since 2.0.0
741
726
  */
742
727
  export const callback = internal.callback;
743
728
  /**
744
729
  * Returns an effect that will never produce anything. The moral equivalent of
745
730
  * `while(true) {}`, only without the wasted CPU cycles.
746
731
  *
747
- * @example
732
+ * **Example** (Usage)
733
+ *
748
734
  * ```ts
749
735
  * import { Effect } from "effect"
750
736
  *
@@ -758,15 +744,16 @@ export const callback = internal.callback;
758
744
  * const timedProgram = Effect.timeout(program, "1 second")
759
745
  * ```
760
746
  *
761
- * @since 2.0.0
762
747
  * @category Creating Effects
748
+ * @since 2.0.0
763
749
  */
764
750
  export const never = internal.never;
765
751
  /**
766
752
  * An `Effect` containing an empty record `{}`, used as the starting point for
767
753
  * do notation chains.
768
754
  *
769
- * @example
755
+ * **Example** (Usage)
756
+ *
770
757
  * ```ts
771
758
  * import { Effect } from "effect"
772
759
  * import { pipe } from "effect/Function"
@@ -779,16 +766,16 @@ export const never = internal.never;
779
766
  * )
780
767
  * ```
781
768
  *
782
- * @since 4.0.0
783
769
  * @category Do notation
770
+ * @since 4.0.0
784
771
  */
785
772
  export const Do = internal.Do;
786
773
  /**
787
774
  * Gives a name to the success value of an `Effect`, creating a single-key
788
775
  * record used in do notation pipelines.
789
776
  *
790
- * @since 4.0.0
791
777
  * @category Do notation
778
+ * @since 4.0.0
792
779
  */
793
780
  export const bindTo = internal.bindTo;
794
781
  const let_ = internal.let;
@@ -796,15 +783,15 @@ export {
796
783
  /**
797
784
  * Adds a computed plain value to the do notation record.
798
785
  *
799
- * @since 4.0.0
800
786
  * @category Do notation
787
+ * @since 4.0.0
801
788
  */
802
789
  let_ as let };
803
790
  /**
804
791
  * Adds an `Effect` value to the do notation record under a given name.
805
792
  *
806
- * @since 4.0.0
807
793
  * @category Do notation
794
+ * @since 4.0.0
808
795
  */
809
796
  export const bind = internal.bind;
810
797
  /**
@@ -822,7 +809,8 @@ export const bind = internal.bind;
822
809
  * explicit control over the execution of effects. You can `yield*` values from
823
810
  * effects and return the final result at the end.
824
811
  *
825
- * @example
812
+ * **Example** (Usage)
813
+ *
826
814
  * ```ts
827
815
  * import { Data, Effect } from "effect"
828
816
  *
@@ -854,8 +842,8 @@ export const bind = internal.bind;
854
842
  * })
855
843
  * ```
856
844
  *
857
- * @since 2.0.0
858
845
  * @category Creating Effects
846
+ * @since 2.0.0
859
847
  */
860
848
  export const gen = internal.gen;
861
849
  /**
@@ -869,9 +857,9 @@ export const gen = internal.gen;
869
857
  *
870
858
  * @see {@link succeed} to create an effect that represents a successful value.
871
859
  *
872
- * @example
860
+ * **Example** (Creating a Failed Effect)
861
+ *
873
862
  * ```ts
874
- * // Title: Creating a Failed Effect
875
863
  * import { Data, Effect } from "effect"
876
864
  *
877
865
  * class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
@@ -883,8 +871,8 @@ export const gen = internal.gen;
883
871
  * )
884
872
  * ```
885
873
  *
886
- * @since 2.0.0
887
874
  * @category Creating Effects
875
+ * @since 2.0.0
888
876
  */
889
877
  export const fail = internal.fail;
890
878
  /**
@@ -893,7 +881,8 @@ export const fail = internal.fail;
893
881
  * This function is useful when you need to create an error effect but want to
894
882
  * defer the computation of the error value until the effect is actually run.
895
883
  *
896
- * @example
884
+ * **Example** (Usage)
885
+ *
897
886
  * ```ts
898
887
  * import { Data, Effect } from "effect"
899
888
  *
@@ -905,8 +894,8 @@ export const fail = internal.fail;
905
894
  * // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
906
895
  * ```
907
896
  *
908
- * @since 2.0.0
909
897
  * @category Creating Effects
898
+ * @since 2.0.0
910
899
  */
911
900
  export const failSync = internal.failSync;
912
901
  /**
@@ -915,7 +904,8 @@ export const failSync = internal.failSync;
915
904
  * This function allows you to create effects that fail with complex error
916
905
  * structures, including multiple errors, defects, interruptions, and more.
917
906
  *
918
- * @example
907
+ * **Example** (Usage)
908
+ *
919
909
  * ```ts
920
910
  * import { Cause, Effect } from "effect"
921
911
  *
@@ -927,8 +917,8 @@ export const failSync = internal.failSync;
927
917
  * // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
928
918
  * ```
929
919
  *
930
- * @since 2.0.0
931
920
  * @category Creating Effects
921
+ * @since 2.0.0
932
922
  */
933
923
  export const failCause = internal.failCause;
934
924
  /**
@@ -937,7 +927,8 @@ export const failCause = internal.failCause;
937
927
  * This function is useful when you need to create a failure effect with a
938
928
  * complex cause but want to defer the computation until the effect is run.
939
929
  *
940
- * @example
930
+ * **Example** (Usage)
931
+ *
941
932
  * ```ts
942
933
  * import { Cause, Effect } from "effect"
943
934
  *
@@ -949,8 +940,8 @@ export const failCause = internal.failCause;
949
940
  * // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
950
941
  * ```
951
942
  *
952
- * @since 2.0.0
953
943
  * @category Creating Effects
944
+ * @since 2.0.0
954
945
  */
955
946
  export const failCauseSync = internal.failCauseSync;
956
947
  /**
@@ -973,9 +964,9 @@ export const failCauseSync = internal.failCauseSync;
973
964
  * @see {@link dieSync} for a variant that throws a specified error, evaluated lazily.
974
965
  * @see {@link dieMessage} for a variant that throws a `RuntimeException` with a message.
975
966
  *
976
- * @example
967
+ * **Example** (Terminating on Division by Zero with a Specified Error)
968
+ *
977
969
  * ```ts
978
- * // Title: Terminating on Division by Zero with a Specified Error
979
970
  * import { Effect } from "effect"
980
971
  *
981
972
  * const divide = (a: number, b: number) =>
@@ -993,8 +984,8 @@ export const failCauseSync = internal.failCauseSync;
993
984
  * // ...stack trace...
994
985
  * ```
995
986
  *
996
- * @since 2.0.0
997
987
  * @category Creating Effects
988
+ * @since 2.0.0
998
989
  */
999
990
  export const die = internal.die;
1000
991
  const try_ = internal.try;
@@ -1022,7 +1013,8 @@ export {
1022
1013
  * @see {@link sync} if the effectful computation is synchronous and does not
1023
1014
  * throw errors.
1024
1015
  *
1025
- * @example Basic Usage with Default Error Handling
1016
+ * **Example** (Basic Usage with Default Error Handling)
1017
+ *
1026
1018
  * ```ts
1027
1019
  * import { Effect } from "effect"
1028
1020
  *
@@ -1041,7 +1033,8 @@ export {
1041
1033
  * // Output: Exit.failure with Error
1042
1034
  * ```
1043
1035
  *
1044
- * @example Custom Error Handling
1036
+ * **Example** (Custom Error Handling)
1037
+ *
1045
1038
  * ```ts
1046
1039
  * import { Data, Effect } from "effect"
1047
1040
  *
@@ -1057,14 +1050,15 @@ export {
1057
1050
  * // Output: Exit.failure with custom Error message
1058
1051
  * ```
1059
1052
  *
1060
- * @since 2.0.0
1061
1053
  * @category Creating Effects
1054
+ * @since 2.0.0
1062
1055
  */
1063
1056
  try_ as try };
1064
1057
  /**
1065
1058
  * Yields control back to the Effect runtime, allowing other fibers to execute.
1066
1059
  *
1067
- * @example
1060
+ * **Example** (Usage)
1061
+ *
1068
1062
  * ```ts
1069
1063
  * import { Effect } from "effect"
1070
1064
  *
@@ -1077,14 +1071,15 @@ try_ as try };
1077
1071
  * Effect.runPromise(program)
1078
1072
  * ```
1079
1073
  *
1080
- * @since 2.0.0
1081
1074
  * @category Creating Effects
1075
+ * @since 2.0.0
1082
1076
  */
1083
1077
  export const yieldNow = internal.yieldNow;
1084
1078
  /**
1085
1079
  * Yields control back to the Effect runtime with a specified priority, allowing other fibers to execute.
1086
1080
  *
1087
- * @example
1081
+ * **Example** (Usage)
1082
+ *
1088
1083
  * ```ts
1089
1084
  * import { Effect } from "effect"
1090
1085
  *
@@ -1097,14 +1092,15 @@ export const yieldNow = internal.yieldNow;
1097
1092
  * Effect.runPromise(program)
1098
1093
  * ```
1099
1094
  *
1100
- * @since 2.0.0
1101
1095
  * @category Creating Effects
1096
+ * @since 2.0.0
1102
1097
  */
1103
1098
  export const yieldNowWith = internal.yieldNowWith;
1104
1099
  /**
1105
1100
  * Provides access to the current fiber within an effect computation.
1106
1101
  *
1107
- * @example
1102
+ * **Example** (Usage)
1103
+ *
1108
1104
  * ```ts
1109
1105
  * import { Effect } from "effect"
1110
1106
  *
@@ -1116,8 +1112,8 @@ export const yieldNowWith = internal.yieldNowWith;
1116
1112
  * // Output: Fiber ID: 1
1117
1113
  * ```
1118
1114
  *
1119
- * @since 2.0.0
1120
1115
  * @category Creating Effects
1116
+ * @since 2.0.0
1121
1117
  */
1122
1118
  export const withFiber = core.withFiber;
1123
1119
  // -----------------------------------------------------------------------------
@@ -1126,7 +1122,8 @@ export const withFiber = core.withFiber;
1126
1122
  /**
1127
1123
  * Converts a `Result` to an `Effect`.
1128
1124
  *
1129
- * @example
1125
+ * **Example** (Usage)
1126
+ *
1130
1127
  * ```ts
1131
1128
  * import { Effect, Result } from "effect"
1132
1129
  *
@@ -1141,14 +1138,18 @@ export const withFiber = core.withFiber;
1141
1138
  * // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Something went wrong' } }
1142
1139
  * ```
1143
1140
  *
1144
- * @since 4.0.0
1145
1141
  * @category Conversions
1142
+ * @since 4.0.0
1146
1143
  */
1147
1144
  export const fromResult = internal.fromResult;
1148
1145
  /**
1149
- * Converts an `Option` to an `Effect`.
1146
+ * Converts an `Option` into an `Effect`.
1147
+ *
1148
+ * `Option.some` becomes a successful effect with the contained value, while
1149
+ * `Option.none` becomes a failed effect with `NoSuchElementError`.
1150
+ *
1151
+ * **Example** (Usage)
1150
1152
  *
1151
- * @example
1152
1153
  * ```ts
1153
1154
  * import { Effect, Option } from "effect"
1154
1155
  *
@@ -1163,15 +1164,16 @@ export const fromResult = internal.fromResult;
1163
1164
  * // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: { _id: 'NoSuchElementError' } } }
1164
1165
  * ```
1165
1166
  *
1166
- * @since 4.0.0
1167
1167
  * @category Conversions
1168
+ * @since 4.0.0
1168
1169
  */
1169
1170
  export const fromOption = internal.fromOption;
1170
1171
  /**
1171
1172
  * Converts a nullable value to an `Effect`, failing with a `NoSuchElementError`
1172
1173
  * when the value is `null` or `undefined`.
1173
1174
  *
1174
- * @example
1175
+ * **Example** (Usage)
1176
+ *
1175
1177
  * ```ts
1176
1178
  * import { Console, Effect } from "effect"
1177
1179
  *
@@ -1188,32 +1190,10 @@ export const fromOption = internal.fromOption;
1188
1190
  * // Output: hello
1189
1191
  * ```
1190
1192
  *
1191
- * @since 4.0.0
1192
1193
  * @category Conversions
1193
- */
1194
- export const fromNullishOr = internal.fromNullishOr;
1195
- /**
1196
- * Converts a yieldable value to an Effect.
1197
- *
1198
- * @example
1199
- * ```ts
1200
- * import { Effect } from "effect"
1201
- * import * as Option from "effect/Option"
1202
- *
1203
- * // Option is yieldable in Effect
1204
- * const program = Effect.gen(function*() {
1205
- * const value = yield* Effect.fromYieldable(Option.some(42))
1206
- * return value * 2
1207
- * })
1208
- *
1209
- * Effect.runPromise(program).then(console.log)
1210
- * // Output: 84
1211
- * ```
1212
- *
1213
1194
  * @since 4.0.0
1214
- * @category Conversions
1215
1195
  */
1216
- export const fromYieldable = internal.fromYieldable;
1196
+ export const fromNullishOr = internal.fromNullishOr;
1217
1197
  // -----------------------------------------------------------------------------
1218
1198
  // Mapping
1219
1199
  // -----------------------------------------------------------------------------
@@ -1247,7 +1227,8 @@ export const fromYieldable = internal.fromYieldable;
1247
1227
  * step produces a new `Effect` while flattening any nested effects that may
1248
1228
  * occur.
1249
1229
  *
1250
- * @example
1230
+ * **Example** (Usage)
1231
+ *
1251
1232
  * ```ts
1252
1233
  * import { Data, Effect, pipe } from "effect"
1253
1234
  *
@@ -1277,14 +1258,15 @@ export const fromYieldable = internal.fromYieldable;
1277
1258
  *
1278
1259
  * @see {@link tap} for a version that ignores the result of the effect.
1279
1260
  *
1280
- * @since 2.0.0
1281
1261
  * @category Sequencing
1262
+ * @since 2.0.0
1282
1263
  */
1283
1264
  export const flatMap = internal.flatMap;
1284
1265
  /**
1285
1266
  * Flattens an `Effect` that produces another `Effect` into a single effect.
1286
1267
  *
1287
- * @example
1268
+ * **Example** (Usage)
1269
+ *
1288
1270
  * ```ts
1289
1271
  * import { Console, Effect } from "effect"
1290
1272
  *
@@ -1297,13 +1279,13 @@ export const flatMap = internal.flatMap;
1297
1279
  * })
1298
1280
  * ```
1299
1281
  *
1300
- * @since 2.0.0
1301
1282
  * @category Sequencing
1283
+ * @since 2.0.0
1302
1284
  */
1303
1285
  export const flatten = internal.flatten;
1304
1286
  /**
1305
- * Chains two actions, where the second action can depend on the result of the
1306
- * first.
1287
+ * Runs this effect and then runs another effect, optionally using the first
1288
+ * effect's success value to choose the next effect.
1307
1289
  *
1308
1290
  * **Syntax**
1309
1291
  *
@@ -1317,23 +1299,18 @@ export const flatten = internal.flatten;
1317
1299
  *
1318
1300
  * **When to Use**
1319
1301
  *
1320
- * Use `andThen` when you need to run multiple actions in sequence, with the
1321
- * second action depending on the result of the first. This is useful for
1322
- * combining effects or handling computations that must happen in order.
1302
+ * Use `andThen` when one effect must run after another and the second effect
1303
+ * may depend on the first effect's success value.
1323
1304
  *
1324
1305
  * **Details**
1325
1306
  *
1326
- * The second action can be:
1327
- *
1328
- * - A constant value (similar to {@link as})
1329
- * - A function returning a value (similar to {@link map})
1330
- * - A `Promise`
1331
- * - A function returning a `Promise`
1332
- * - An `Effect`
1333
- * - A function returning an `Effect` (similar to {@link flatMap})
1307
+ * When the second argument is an `Effect`, the first success value is discarded
1308
+ * and the returned effect produces the second effect's value. When the second
1309
+ * argument is a function, it receives the first success value and must return
1310
+ * the next `Effect`.
1334
1311
  *
1335
- * **Note:** `andThen` works well with both `Option` and `Result` types,
1336
- * treating them as effects.
1312
+ * Failures or requirements from either effect are preserved in the returned
1313
+ * effect.
1337
1314
  *
1338
1315
  * **Previously Known As**
1339
1316
  *
@@ -1341,7 +1318,8 @@ export const flatten = internal.flatten;
1341
1318
  *
1342
1319
  * - `Effect.zipRight`
1343
1320
  *
1344
- * @example Applying a Discount Based on Fetched Amount
1321
+ * **Example** (Applying a Discount Based on Fetched Amount)
1322
+ *
1345
1323
  * ```ts
1346
1324
  * import { Data, Effect, pipe } from "effect"
1347
1325
  *
@@ -1380,8 +1358,8 @@ export const flatten = internal.flatten;
1380
1358
  * // Output: 190
1381
1359
  * ```
1382
1360
  *
1383
- * @since 2.0.0
1384
1361
  * @category Sequencing
1362
+ * @since 2.0.0
1385
1363
  */
1386
1364
  export const andThen = internal.andThen;
1387
1365
  /**
@@ -1407,9 +1385,9 @@ export const andThen = internal.andThen;
1407
1385
  *
1408
1386
  * - `Effect.zipLeft`
1409
1387
  *
1410
- * @example
1388
+ * **Example** (Logging a step in a pipeline)
1389
+ *
1411
1390
  * ```ts
1412
- * // Title: Logging a step in a pipeline
1413
1391
  * import { Data, Effect, pipe } from "effect"
1414
1392
  * import { Console } from "effect"
1415
1393
  *
@@ -1441,8 +1419,8 @@ export const andThen = internal.andThen;
1441
1419
  * // 95
1442
1420
  * ```
1443
1421
  *
1444
- * @since 2.0.0
1445
1422
  * @category Sequencing
1423
+ * @since 2.0.0
1446
1424
  */
1447
1425
  export const tap = internal.tap;
1448
1426
  /**
@@ -1474,7 +1452,8 @@ export const tap = internal.tap;
1474
1452
  *
1475
1453
  * - `Effect.either`
1476
1454
  *
1477
- * @example
1455
+ * **Example** (Usage)
1456
+ *
1478
1457
  * ```ts
1479
1458
  * import { Effect } from "effect"
1480
1459
  *
@@ -1494,8 +1473,8 @@ export const tap = internal.tap;
1494
1473
  * @see {@link option} for a version that uses `Option` instead.
1495
1474
  * @see {@link exit} for a version that encapsulates both recoverable errors and defects in an `Exit`.
1496
1475
  *
1497
- * @since 4.0.0
1498
1476
  * @category Outcome Encapsulation
1477
+ * @since 4.0.0
1499
1478
  */
1500
1479
  export const result = internal.result;
1501
1480
  /**
@@ -1506,7 +1485,8 @@ export const result = internal.result;
1506
1485
  * Success values become `Option.some`, recoverable failures become
1507
1486
  * `Option.none`, and defects still fail the effect.
1508
1487
  *
1509
- * @example
1488
+ * **Example** (Usage)
1489
+ *
1510
1490
  * ```ts
1511
1491
  * import { Console, Effect, Option } from "effect"
1512
1492
  *
@@ -1526,8 +1506,8 @@ export const result = internal.result;
1526
1506
  * @see {@link result} for a version that uses `Result` instead.
1527
1507
  * @see {@link exit} for a version that encapsulates both recoverable errors and defects in an `Exit`.
1528
1508
  *
1529
- * @since 2.0.0
1530
1509
  * @category Output Encapsulation
1510
+ * @since 2.0.0
1531
1511
  */
1532
1512
  export const option = internal.option;
1533
1513
  /**
@@ -1543,7 +1523,8 @@ export const option = internal.option;
1543
1523
  * the `Exit.Failure` type. The error type is set to `never`, indicating that
1544
1524
  * the effect is structured to never fail directly.
1545
1525
  *
1546
- * @example
1526
+ * **Example** (Usage)
1527
+ *
1547
1528
  * ```ts
1548
1529
  * import { Effect } from "effect"
1549
1530
  *
@@ -1563,8 +1544,8 @@ export const option = internal.option;
1563
1544
  * @see {@link option} for a version that uses `Option` instead.
1564
1545
  * @see {@link result} for a version that uses `Result` instead.
1565
1546
  *
1566
- * @since 2.0.0
1567
1547
  * @category Outcome Encapsulation
1548
+ * @since 2.0.0
1568
1549
  */
1569
1550
  export const exit = internal.exit;
1570
1551
  /**
@@ -1589,7 +1570,8 @@ export const exit = internal.exit;
1589
1570
  * effect is not modified. Instead, a new effect is returned with the updated
1590
1571
  * value.
1591
1572
  *
1592
- * @example Adding a Service Charge
1573
+ * **Example** (Adding a Service Charge)
1574
+ *
1593
1575
  * ```ts
1594
1576
  * import { Effect, pipe } from "effect"
1595
1577
  *
@@ -1610,8 +1592,8 @@ export const exit = internal.exit;
1610
1592
  * @see {@link mapBoth} for a version that operates on both channels.
1611
1593
  * @see {@link flatMap} or {@link andThen} for a version that can return a new effect.
1612
1594
  *
1613
- * @since 2.0.0
1614
1595
  * @category Mapping
1596
+ * @since 2.0.0
1615
1597
  */
1616
1598
  export const map = internal.map;
1617
1599
  /**
@@ -1620,9 +1602,9 @@ export const map = internal.map;
1620
1602
  * `as` allows you to ignore the original value inside an effect and
1621
1603
  * replace it with a new constant value.
1622
1604
  *
1623
- * @example
1605
+ * **Example** (Replacing a Value)
1606
+ *
1624
1607
  * ```ts
1625
- * // Title: Replacing a Value
1626
1608
  * import { Effect, pipe } from "effect"
1627
1609
  *
1628
1610
  * // Replaces the value 5 with the constant "new value"
@@ -1632,8 +1614,8 @@ export const map = internal.map;
1632
1614
  * // Output: "new value"
1633
1615
  * ```
1634
1616
  *
1635
- * @since 2.0.0
1636
1617
  * @category Mapping
1618
+ * @since 2.0.0
1637
1619
  */
1638
1620
  export const as = internal.as;
1639
1621
  /**
@@ -1641,7 +1623,8 @@ export const as = internal.as;
1641
1623
  * in an `Option` value. If the original `Effect` value fails, the returned
1642
1624
  * `Effect` value will also fail.
1643
1625
  *
1644
- * @example
1626
+ * **Example** (Usage)
1627
+ *
1645
1628
  * ```ts
1646
1629
  * import { Effect } from "effect"
1647
1630
  *
@@ -1661,7 +1644,8 @@ export const asSome = internal.asSome;
1661
1644
  * succeed. If the original `Effect` value fails, the returned `Effect` value
1662
1645
  * will fail with the same error.
1663
1646
  *
1664
- * @example
1647
+ * **Example** (Usage)
1648
+ *
1665
1649
  * ```ts
1666
1650
  * import { Effect } from "effect"
1667
1651
  *
@@ -1671,8 +1655,8 @@ export const asSome = internal.asSome;
1671
1655
  * // undefined (void)
1672
1656
  * ```
1673
1657
  *
1674
- * @since 2.0.0
1675
1658
  * @category Mapping
1659
+ * @since 2.0.0
1676
1660
  */
1677
1661
  export const asVoid = internal.asVoid;
1678
1662
  /**
@@ -1684,7 +1668,8 @@ export const asVoid = internal.asVoid;
1684
1668
  * be helpful in scenarios where you want to handle a success as a failure or
1685
1669
  * treat an error as a valid result.
1686
1670
  *
1687
- * @example
1671
+ * **Example** (Usage)
1672
+ *
1688
1673
  * ```ts
1689
1674
  * import { Effect } from "effect"
1690
1675
  *
@@ -1697,8 +1682,8 @@ export const asVoid = internal.asVoid;
1697
1682
  * const flipped = Effect.flip(program)
1698
1683
  * ```
1699
1684
  *
1700
- * @since 2.0.0
1701
1685
  * @category Mapping
1686
+ * @since 2.0.0
1702
1687
  */
1703
1688
  export const flip = internal.flip;
1704
1689
  // -----------------------------------------------------------------------------
@@ -1718,9 +1703,9 @@ export const flip = internal.flip;
1718
1703
  * @see {@link zipWith} for a version that combines the results with a custom function.
1719
1704
  * @see {@link validate} for a version that accumulates errors.
1720
1705
  *
1721
- * @example
1706
+ * **Example** (Combining Two Effects Sequentially)
1707
+ *
1722
1708
  * ```ts
1723
- * // Title: Combining Two Effects Sequentially
1724
1709
  * import { Effect } from "effect"
1725
1710
  *
1726
1711
  * const task1 = Effect.succeed(1).pipe(
@@ -1745,8 +1730,9 @@ export const flip = internal.flip;
1745
1730
  * // [ 1, 'hello' ]
1746
1731
  * ```
1747
1732
  *
1748
- * @example
1749
- * // Title: Combining Two Effects Concurrently
1733
+ * **Example** (Combining Two Effects Concurrently)
1734
+ *
1735
+ * ```ts
1750
1736
  * import { Effect } from "effect"
1751
1737
  *
1752
1738
  * const task1 = Effect.succeed(1).pipe(
@@ -1766,9 +1752,10 @@ export const flip = internal.flip;
1766
1752
  * // timestamp=... level=INFO fiber=#0 message="task2 done"
1767
1753
  * // timestamp=... level=INFO fiber=#0 message="task1 done"
1768
1754
  * // [ 1, 'hello' ]
1755
+ * ```
1769
1756
  *
1770
- * @since 2.0.0
1771
1757
  * @category Zipping
1758
+ * @since 2.0.0
1772
1759
  */
1773
1760
  export const zip = internal.zip;
1774
1761
  /**
@@ -1786,9 +1773,9 @@ export const zip = internal.zip;
1786
1773
  * By default, the effects are run sequentially. To execute them concurrently,
1787
1774
  * use the `{ concurrent: true }` option.
1788
1775
  *
1789
- * @example
1776
+ * **Example** (Combining Effects with a Custom Function)
1777
+ *
1790
1778
  * ```ts
1791
- * // Title: Combining Effects with a Custom Function
1792
1779
  * import { Effect } from "effect"
1793
1780
  *
1794
1781
  * const task1 = Effect.succeed(1).pipe(
@@ -1814,8 +1801,8 @@ export const zip = internal.zip;
1814
1801
  * // 6
1815
1802
  * ```
1816
1803
  *
1817
- * @since 2.0.0
1818
1804
  * @category Zipping
1805
+ * @since 2.0.0
1819
1806
  */
1820
1807
  export const zipWith = internal.zipWith;
1821
1808
  // -----------------------------------------------------------------------------
@@ -1844,8 +1831,8 @@ export {
1844
1831
  *
1845
1832
  * - `Effect.catchAll`
1846
1833
  *
1847
- * @since 4.0.0
1848
1834
  * @category Error Handling
1835
+ * @since 4.0.0
1849
1836
  */
1850
1837
  catch_ as catch };
1851
1838
  /**
@@ -1862,7 +1849,8 @@ catch_ as catch };
1862
1849
  * The error type must have a readonly `_tag` field to use `catchTag`. This
1863
1850
  * field is used to identify and match errors.
1864
1851
  *
1865
- * @example
1852
+ * **Example** (Usage)
1853
+ *
1866
1854
  * ```ts
1867
1855
  * import { Effect } from "effect"
1868
1856
  *
@@ -1885,8 +1873,8 @@ catch_ as catch };
1885
1873
  * )
1886
1874
  * ```
1887
1875
  *
1888
- * @since 2.0.0
1889
1876
  * @category Error Handling
1877
+ * @since 2.0.0
1890
1878
  */
1891
1879
  export const catchTag = internal.catchTag;
1892
1880
  /**
@@ -1904,7 +1892,8 @@ export const catchTag = internal.catchTag;
1904
1892
  * The error type must have a readonly `_tag` field to use `catchTag`. This
1905
1893
  * field is used to identify and match errors.
1906
1894
  *
1907
- * @example
1895
+ * **Example** (Usage)
1896
+ *
1908
1897
  * ```ts
1909
1898
  * import { Data, Effect } from "effect"
1910
1899
  *
@@ -1928,8 +1917,8 @@ export const catchTag = internal.catchTag;
1928
1917
  * })
1929
1918
  * ```
1930
1919
  *
1931
- * @since 2.0.0
1932
1920
  * @category Error Handling
1921
+ * @since 2.0.0
1933
1922
  */
1934
1923
  export const catchTags = internal.catchTags;
1935
1924
  /**
@@ -1938,7 +1927,8 @@ export const catchTags = internal.catchTags;
1938
1927
  * Use this to handle nested error causes without removing the parent error
1939
1928
  * from the error channel. The handler receives the unwrapped reason.
1940
1929
  *
1941
- * @example
1930
+ * **Example** (Usage)
1931
+ *
1942
1932
  * ```ts
1943
1933
  * import { Data, Effect } from "effect"
1944
1934
  *
@@ -1964,14 +1954,15 @@ export const catchTags = internal.catchTags;
1964
1954
  * )
1965
1955
  * ```
1966
1956
  *
1967
- * @since 4.0.0
1968
1957
  * @category Error Handling
1958
+ * @since 4.0.0
1969
1959
  */
1970
1960
  export const catchReason = internal.catchReason;
1971
1961
  /**
1972
1962
  * Catches multiple reasons within a tagged error using an object of handlers.
1973
1963
  *
1974
- * @example
1964
+ * **Example** (Usage)
1965
+ *
1975
1966
  * ```ts
1976
1967
  * import { Data, Effect } from "effect"
1977
1968
  *
@@ -1999,15 +1990,16 @@ export const catchReason = internal.catchReason;
1999
1990
  * )
2000
1991
  * ```
2001
1992
  *
2002
- * @since 4.0.0
2003
1993
  * @category Error Handling
1994
+ * @since 4.0.0
2004
1995
  */
2005
1996
  export const catchReasons = internal.catchReasons;
2006
1997
  /**
2007
1998
  * Promotes nested reason errors into the Effect error channel, replacing
2008
1999
  * the parent error.
2009
2000
  *
2010
- * @example
2001
+ * **Example** (Usage)
2002
+ *
2011
2003
  * ```ts
2012
2004
  * import { Data, Effect } from "effect"
2013
2005
  *
@@ -2030,8 +2022,8 @@ export const catchReasons = internal.catchReasons;
2030
2022
  * const unwrapped = program.pipe(Effect.unwrapReason("AiError"))
2031
2023
  * ```
2032
2024
  *
2033
- * @since 4.0.0
2034
2025
  * @category Error Handling
2026
+ * @since 4.0.0
2035
2027
  */
2036
2028
  export const unwrapReason = internal.unwrapReason;
2037
2029
  /**
@@ -2057,7 +2049,8 @@ export const unwrapReason = internal.unwrapReason;
2057
2049
  *
2058
2050
  * - `Effect.catchAllCause`
2059
2051
  *
2060
- * @example
2052
+ * **Example** (Usage)
2053
+ *
2061
2054
  * ```ts
2062
2055
  * import { Cause, Console, Effect } from "effect"
2063
2056
  *
@@ -2075,32 +2068,28 @@ export const unwrapReason = internal.unwrapReason;
2075
2068
  * })
2076
2069
  * ```
2077
2070
  *
2078
- * @since 4.0.0
2079
2071
  * @category Error Handling
2072
+ * @since 4.0.0
2080
2073
  */
2081
2074
  export const catchCause = internal.catchCause;
2082
2075
  /**
2083
- * Recovers from all defects using a provided recovery function.
2076
+ * Recovers from defects using a provided recovery function.
2084
2077
  *
2085
2078
  * **When to Use**
2086
2079
  *
2087
- * There is no sensible way to recover from defects. This method should be used
2088
- * only at the boundary between Effect and an external system, to transmit
2089
- * information on a defect for diagnostic or explanatory purposes.
2080
+ * Use this sparingly, usually at integration boundaries where defects must be
2081
+ * reported or translated for an external system.
2090
2082
  *
2091
2083
  * **Details**
2092
2084
  *
2093
- * `catchAllDefect` allows you to handle defects, which are unexpected errors
2094
- * that usually cause the program to terminate. This function lets you recover
2095
- * from these defects by providing a function that handles the error. However,
2096
- * it does not handle expected errors (like those from {@link fail}) or
2097
- * execution interruptions (like those from {@link interrupt}).
2085
+ * `catchDefect` handles unexpected defects, such as thrown exceptions or
2086
+ * values passed to `die`, without catching typed failures or interruptions.
2098
2087
  *
2099
2088
  * **When to Recover from Defects**
2100
2089
  *
2101
- * Defects are unexpected errors that typically shouldn't be recovered from, as
2102
- * they often indicate serious issues. However, in some cases, such as
2103
- * dynamically loaded plugins, controlled recovery might be needed.
2090
+ * Defects are unexpected errors that typically should not be recovered from, as
2091
+ * they often indicate serious issues. In some cases, such as dynamically loaded
2092
+ * plugins, controlled recovery may be needed.
2104
2093
  *
2105
2094
  * **Previously Known As**
2106
2095
  *
@@ -2108,7 +2097,8 @@ export const catchCause = internal.catchCause;
2108
2097
  *
2109
2098
  * - `Effect.catchAllDefect`
2110
2099
  *
2111
- * @example
2100
+ * **Example** (Usage)
2101
+ *
2112
2102
  * ```ts
2113
2103
  * import { Console, Effect } from "effect"
2114
2104
  *
@@ -2125,8 +2115,8 @@ export const catchCause = internal.catchCause;
2125
2115
  * })
2126
2116
  * ```
2127
2117
  *
2128
- * @since 4.0.0
2129
2118
  * @category Error Handling
2119
+ * @since 4.0.0
2130
2120
  */
2131
2121
  export const catchDefect = internal.catchDefect;
2132
2122
  /**
@@ -2146,7 +2136,8 @@ export const catchDefect = internal.catchDefect;
2146
2136
  * - `Effect.catchSome` (Effect 3.x)
2147
2137
  * - `Effect.catchIf`
2148
2138
  *
2149
- * @example
2139
+ * **Example** (Usage)
2140
+ *
2150
2141
  * ```ts
2151
2142
  * import { Data, Effect, Filter } from "effect"
2152
2143
  *
@@ -2171,15 +2162,15 @@ export const catchDefect = internal.catchDefect;
2171
2162
  * )
2172
2163
  * ```
2173
2164
  *
2174
- * @since 2.0.0
2175
2165
  * @category Error Handling
2166
+ * @since 2.0.0
2176
2167
  */
2177
2168
  export const catchIf = internal.catchIf;
2178
2169
  /**
2179
2170
  * Recovers from specific errors using a `Filter`.
2180
2171
  *
2181
- * @since 4.0.0
2182
2172
  * @category Error Handling
2173
+ * @since 4.0.0
2183
2174
  */
2184
2175
  export const catchFilter = internal.catchFilter;
2185
2176
  /**
@@ -2188,7 +2179,8 @@ export const catchFilter = internal.catchFilter;
2188
2179
  * Success values become `Option.some`, `NoSuchElementError` becomes
2189
2180
  * `Option.none`, and all other errors are preserved.
2190
2181
  *
2191
- * @example
2182
+ * **Example** (Usage)
2183
+ *
2192
2184
  * ```ts
2193
2185
  * import { Effect, Option } from "effect"
2194
2186
  *
@@ -2205,8 +2197,8 @@ export const catchFilter = internal.catchFilter;
2205
2197
  *
2206
2198
  * - `Effect.optionFromOptional`
2207
2199
  *
2208
- * @since 2.0.0
2209
2200
  * @category Error Handling
2201
+ * @since 2.0.0
2210
2202
  */
2211
2203
  export const catchNoSuchElement = internal.catchNoSuchElement;
2212
2204
  /**
@@ -2222,7 +2214,8 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
2222
2214
  *
2223
2215
  * - `Effect.catchSomeCause`
2224
2216
  *
2225
- * @example
2217
+ * **Example** (Usage)
2218
+ *
2226
2219
  * ```ts
2227
2220
  * import { Cause, Console, Effect } from "effect"
2228
2221
  *
@@ -2244,15 +2237,15 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
2244
2237
  * // Then: "Fallback response"
2245
2238
  * ```
2246
2239
  *
2247
- * @since 4.0.0
2248
2240
  * @category Error Handling
2241
+ * @since 4.0.0
2249
2242
  */
2250
2243
  export const catchCauseIf = internal.catchCauseIf;
2251
2244
  /**
2252
2245
  * Recovers from specific failures based on a `Filter`.
2253
2246
  *
2254
- * @since 4.0.0
2255
2247
  * @category Error Handling
2248
+ * @since 4.0.0
2256
2249
  */
2257
2250
  export const catchCauseFilter = internal.catchCauseFilter;
2258
2251
  /**
@@ -2268,7 +2261,8 @@ export const catchCauseFilter = internal.catchCauseFilter;
2268
2261
  * @see {@link mapBoth} for a version that operates on both channels.
2269
2262
  * @see {@link orElseFail} if you want to replace the error with a new one.
2270
2263
  *
2271
- * @example
2264
+ * **Example** (Usage)
2265
+ *
2272
2266
  * ```ts
2273
2267
  * import { Data, Effect } from "effect"
2274
2268
  *
@@ -2286,8 +2280,8 @@ export const catchCauseFilter = internal.catchCauseFilter;
2286
2280
  * )
2287
2281
  * ```
2288
2282
  *
2289
- * @since 2.0.0
2290
2283
  * @category Error Handling
2284
+ * @since 2.0.0
2291
2285
  */
2292
2286
  export const mapError = internal.mapError;
2293
2287
  /**
@@ -2300,7 +2294,8 @@ export const mapError = internal.mapError;
2300
2294
  * the error and the success values without altering the overall success or
2301
2295
  * failure status of the effect.
2302
2296
  *
2303
- * @example
2297
+ * **Example** (Usage)
2298
+ *
2304
2299
  * ```ts
2305
2300
  * import { Data, Effect } from "effect"
2306
2301
  *
@@ -2321,28 +2316,24 @@ export const mapError = internal.mapError;
2321
2316
  * @see {@link map} for a version that operates on the success channel.
2322
2317
  * @see {@link mapError} for a version that operates on the error channel.
2323
2318
  *
2324
- * @since 2.0.0
2325
2319
  * @category Mapping
2320
+ * @since 2.0.0
2326
2321
  */
2327
2322
  export const mapBoth = internal.mapBoth;
2328
2323
  /**
2329
- * Converts an effect's failure into a fiber termination, removing the error from the effect's type.
2330
- *
2331
- * **When to Use*
2332
- *
2333
- * Use `orDie` when failures should be treated as unrecoverable defects and no error handling is required.
2324
+ * Converts typed failures from the error channel into defects, removing the
2325
+ * error type from the returned effect.
2334
2326
  *
2335
- * **Details**
2327
+ * **When to Use**
2336
2328
  *
2337
- * The `orDie` function is used when you encounter errors that you do not want to handle or recover from.
2338
- * It removes the error type from the effect and ensures that any failure will terminate the fiber.
2339
- * This is useful for propagating failures as defects, signaling that they should not be handled within the effect.
2329
+ * Use `orDie` when a typed failure represents an unrecoverable bug or invalid
2330
+ * state and should not be handled as a recoverable error.
2340
2331
  *
2341
2332
  * @see {@link orDieWith} if you need to customize the error.
2342
2333
  *
2343
- * @example
2334
+ * **Example** (Propagating an Error as a Defect)
2335
+ *
2344
2336
  * ```ts
2345
- * // Title: Propagating an Error as a Defect
2346
2337
  * import { Data, Effect } from "effect"
2347
2338
  *
2348
2339
  * class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
@@ -2362,20 +2353,22 @@ export const mapBoth = internal.mapBoth;
2362
2353
  * // ...stack trace...
2363
2354
  * ```
2364
2355
  *
2365
- * @since 2.0.0
2366
2356
  * @category Converting Failures to Defects
2357
+ * @since 2.0.0
2367
2358
  */
2368
2359
  export const orDie = internal.orDie;
2369
2360
  /**
2370
- * The `tapError` function executes an effectful operation to inspect the
2371
- * failure of an effect without modifying it.
2361
+ * Runs an effectful operation when the source effect fails, while preserving
2362
+ * the original failure when the operation succeeds.
2363
+ *
2364
+ * **Details**
2365
+ *
2366
+ * Use this for logging, metrics, or other failure-side observations. If the
2367
+ * operation passed to `tapError` fails, that error is also represented in the
2368
+ * returned effect's error channel.
2372
2369
  *
2373
- * This function is useful when you want to perform some side effect (like
2374
- * logging or tracking) on the failure of an effect, but without changing the
2375
- * result of the effect itself. The error remains in the effect's error channel,
2376
- * while the operation you provide can inspect or act on it.
2370
+ * **Example** (Usage)
2377
2371
  *
2378
- * @example
2379
2372
  * ```ts
2380
2373
  * import { Console, Effect } from "effect"
2381
2374
  *
@@ -2393,17 +2386,19 @@ export const orDie = internal.orDie;
2393
2386
  * // expected error: NetworkError
2394
2387
  * ```
2395
2388
  *
2396
- * @since 2.0.0
2397
2389
  * @category Sequencing
2390
+ * @since 2.0.0
2398
2391
  */
2399
2392
  export const tapError = internal.tapError;
2400
2393
  /**
2401
2394
  * Runs an effectful handler when a failure's `_tag` matches.
2402
2395
  *
2403
- * Use this with tagged-union errors to perform side effects for a tag (or tag
2404
- * list) while preserving the original failure.
2396
+ * Use this with tagged-union errors to perform side effects for one tag or a
2397
+ * list of tags. When the handler succeeds, the original failure is preserved;
2398
+ * if the handler fails, its error is also included in the returned effect.
2399
+ *
2400
+ * **Example** (Usage)
2405
2401
  *
2406
- * @example
2407
2402
  * ```ts
2408
2403
  * import { Console, Data, Effect } from "effect"
2409
2404
  *
@@ -2427,18 +2422,19 @@ export const tapError = internal.tapError;
2427
2422
  * // expected error: 504
2428
2423
  * ```
2429
2424
  *
2430
- * @since 2.0.0
2431
2425
  * @category Sequencing
2426
+ * @since 2.0.0
2432
2427
  */
2433
2428
  export const tapErrorTag = internal.tapErrorTag;
2434
2429
  /**
2435
- * The `tapCause` function allows you to inspect the complete cause
2436
- * of an error, including failures and defects.
2430
+ * Runs an effectful operation with the full `Cause` when the source effect
2431
+ * fails.
2432
+ *
2433
+ * **Details**
2437
2434
  *
2438
- * This function is helpful when you need to log, monitor, or handle specific
2439
- * error causes in your effects. It gives you access to the full error cause,
2440
- * whether it's a failure, defect, or other exceptional conditions, without
2441
- * altering the error or the overall result of the effect.
2435
+ * Use this to log or inspect typed failures, defects, and interruptions. When
2436
+ * the operation succeeds, the original cause is preserved. If the operation
2437
+ * fails, its error is also represented in the returned effect.
2442
2438
  *
2443
2439
  * **Previously Known As**
2444
2440
  *
@@ -2446,7 +2442,8 @@ export const tapErrorTag = internal.tapErrorTag;
2446
2442
  *
2447
2443
  * - `Effect.tapErrorCause`
2448
2444
  *
2449
- * @example
2445
+ * **Example** (Usage)
2446
+ *
2450
2447
  * ```ts
2451
2448
  * import { Cause, Console, Effect } from "effect"
2452
2449
  *
@@ -2462,8 +2459,8 @@ export const tapErrorTag = internal.tapErrorTag;
2462
2459
  * // Then: { _id: 'Exit', _tag: 'Failure', cause: ... }
2463
2460
  * ```
2464
2461
  *
2465
- * @since 2.0.0
2466
2462
  * @category Sequencing
2463
+ * @since 2.0.0
2467
2464
  */
2468
2465
  export const tapCause = internal.tapCause;
2469
2466
  /**
@@ -2473,7 +2470,8 @@ export const tapCause = internal.tapCause;
2473
2470
  * the cause matches a specific predicate. This is useful for conditional logging,
2474
2471
  * monitoring, or other side effects based on the type of failure.
2475
2472
  *
2476
- * @example
2473
+ * **Example** (Usage)
2474
+ *
2477
2475
  * ```ts
2478
2476
  * import { Cause, Console, Effect } from "effect"
2479
2477
  *
@@ -2491,34 +2489,29 @@ export const tapCause = internal.tapCause;
2491
2489
  * // Then: { _id: 'Exit', _tag: 'Failure', cause: ... }
2492
2490
  * ```
2493
2491
  *
2494
- * @since 4.0.0
2495
2492
  * @category Sequencing
2493
+ * @since 4.0.0
2496
2494
  */
2497
2495
  export const tapCauseIf = internal.tapCauseIf;
2498
2496
  /**
2499
2497
  * Conditionally executes a side effect based on the cause of a failed effect.
2500
2498
  *
2501
- * @since 4.0.0
2502
2499
  * @category Sequencing
2500
+ * @since 4.0.0
2503
2501
  */
2504
2502
  export const tapCauseFilter = internal.tapCauseFilter;
2505
2503
  /**
2506
- * Inspect severe errors or defects (non-recoverable failures) in an effect.
2504
+ * Runs an effectful operation when the source effect dies with a defect.
2507
2505
  *
2508
2506
  * **Details**
2509
2507
  *
2510
- * This function is specifically designed to handle and inspect defects, which
2511
- * are critical failures in your program, such as unexpected runtime exceptions
2512
- * or system-level errors. Unlike normal recoverable errors, defects typically
2513
- * indicate serious issues that cannot be addressed through standard error
2514
- * handling.
2508
+ * Use this for diagnostics such as logging unexpected thrown exceptions or
2509
+ * values passed to `die`. Recoverable failures are not handled. When the
2510
+ * operation succeeds, the original defect is preserved; if the operation fails,
2511
+ * its error is also represented in the returned effect.
2515
2512
  *
2516
- * When a defect occurs in an effect, the function you provide to this function
2517
- * will be executed, allowing you to log, monitor, or handle the defect in some
2518
- * way. Importantly, this does not alter the main result of the effect. If no
2519
- * defect occurs, the effect behaves as if this function was not used.
2513
+ * **Example** (Usage)
2520
2514
  *
2521
- * @example
2522
2515
  * ```ts
2523
2516
  * import { Console, Effect } from "effect"
2524
2517
  *
@@ -2551,8 +2544,8 @@ export const tapCauseFilter = internal.tapCauseFilter;
2551
2544
  * // ... stack trace ...
2552
2545
  * ```
2553
2546
  *
2554
- * @since 2.0.0
2555
2547
  * @category Sequencing
2548
+ * @since 2.0.0
2556
2549
  */
2557
2550
  export const tapDefect = internal.tapDefect;
2558
2551
  /**
@@ -2560,7 +2553,8 @@ export const tapDefect = internal.tapDefect;
2560
2553
  *
2561
2554
  * Yields between attempts so other fibers can run.
2562
2555
  *
2563
- * @example
2556
+ * **Example** (Usage)
2557
+ *
2564
2558
  * ```ts
2565
2559
  * import { Console, Effect } from "effect"
2566
2560
  *
@@ -2585,32 +2579,29 @@ export const tapDefect = internal.tapDefect;
2585
2579
  * // Ready
2586
2580
  * ```
2587
2581
  *
2588
- * @since 2.0.0
2589
2582
  * @category Repetition / Recursion
2583
+ * @since 2.0.0
2590
2584
  */
2591
2585
  export const eventually = internal.eventually;
2592
2586
  /**
2593
- * Retries a failing effect based on a defined retry policy.
2587
+ * Retries typed failures from an effect according to a retry policy.
2594
2588
  *
2595
2589
  * **Details**
2596
2590
  *
2597
- * The `Effect.retry` function takes an effect and a {@link Schedule} policy,
2598
- * and will automatically retry the effect if it fails, following the rules of
2599
- * the policy.
2600
- *
2601
- * If the effect ultimately succeeds, the result will be returned.
2591
+ * The policy can be a `Schedule`, a schedule builder, or a `Retry.Options`
2592
+ * object using `schedule`, `times`, `while`, or `until`. If a retry eventually
2593
+ * succeeds, the returned effect succeeds with that value. If the policy stops
2594
+ * while the effect is still failing, the last failure is propagated.
2602
2595
  *
2603
- * If the maximum retries are exhausted and the effect still fails, the failure
2604
- * is propagated.
2596
+ * Defects and interruptions are not retried as typed failures.
2605
2597
  *
2606
2598
  * **When to Use**
2607
2599
  *
2608
- * This can be useful when dealing with intermittent failures, such as network
2609
- * issues or temporary resource unavailability. By defining a retry policy, you
2610
- * can control the number of retries, the delay between them, and when to stop
2611
- * retrying.
2600
+ * Use `retry` when typed failures may be transient, such as network issues or
2601
+ * temporary resource unavailability.
2602
+ *
2603
+ * **Example** (Usage)
2612
2604
  *
2613
- * @example
2614
2605
  * ```ts
2615
2606
  * import { Data, Effect, Schedule } from "effect"
2616
2607
  *
@@ -2636,8 +2627,8 @@ export const eventually = internal.eventually;
2636
2627
  * @see {@link retryOrElse} for a version that allows you to run a fallback.
2637
2628
  * @see {@link repeat} if your retry condition is based on successful outcomes rather than errors.
2638
2629
  *
2639
- * @since 2.0.0
2640
2630
  * @category Error Handling
2631
+ * @since 2.0.0
2641
2632
  */
2642
2633
  export const retry = internalSchedule.retry;
2643
2634
  /**
@@ -2658,7 +2649,8 @@ export const retry = internalSchedule.retry;
2658
2649
  *
2659
2650
  * @see {@link retry} for a version that does not run a fallback effect.
2660
2651
  *
2661
- * @example
2652
+ * **Example** (Usage)
2653
+ *
2662
2654
  * ```ts
2663
2655
  * import { Console, Data, Effect, Schedule } from "effect"
2664
2656
  *
@@ -2693,24 +2685,21 @@ export const retry = internalSchedule.retry;
2693
2685
  * // Network data
2694
2686
  * ```
2695
2687
  *
2696
- * @since 2.0.0
2697
2688
  * @category Error Handling
2689
+ * @since 2.0.0
2698
2690
  */
2699
2691
  export const retryOrElse = internalSchedule.retryOrElse;
2700
2692
  /**
2701
- * The `sandbox` function transforms an effect by exposing the full cause
2702
- * of any error, defect, or fiber interruption that might occur during its
2703
- * execution. It changes the error channel of the effect to include detailed
2704
- * information about the cause, which is wrapped in a `Cause<E>` type.
2693
+ * Exposes an effect's full failure cause in the error channel as `Cause<E>`.
2705
2694
  *
2706
- * This function is useful when you need access to the complete underlying cause
2707
- * of failures, defects, or interruptions, enabling more detailed error
2708
- * handling. Once you apply `sandbox`, you can use operators like
2709
- * {@link catchAll} and {@link catchTags} to handle specific error conditions.
2710
- * If necessary, you can revert the sandboxing operation with {@link unsandbox}
2711
- * to return to the original error handling behavior.
2695
+ * **Details**
2696
+ *
2697
+ * Use `sandbox` when downstream error handling needs to distinguish typed
2698
+ * failures, defects, and interruptions. Use `unsandbox` to restore the original
2699
+ * typed error channel after cause-level handling.
2700
+ *
2701
+ * **Example** (Usage)
2712
2702
  *
2713
- * @example
2714
2703
  * ```ts
2715
2704
  * import { Cause, Effect } from "effect"
2716
2705
  *
@@ -2728,8 +2717,8 @@ export const retryOrElse = internalSchedule.retryOrElse;
2728
2717
  *
2729
2718
  * @see {@link unsandbox} to restore the original error handling.
2730
2719
  *
2731
- * @since 2.0.0
2732
2720
  * @category Error Handling
2721
+ * @since 2.0.0
2733
2722
  */
2734
2723
  export const sandbox = internal.sandbox;
2735
2724
  /**
@@ -2744,9 +2733,9 @@ export const sandbox = internal.sandbox;
2744
2733
  * Use the `log` option to emit the full {@link Cause} when the effect fails,
2745
2734
  * and `message` to prepend a custom log message.
2746
2735
  *
2747
- * @example
2736
+ * **Example** (Using Effect.ignore to Discard Values)
2737
+ *
2748
2738
  * ```ts
2749
- * // Title: Using Effect.ignore to Discard Values
2750
2739
  * import { Effect } from "effect"
2751
2740
  *
2752
2741
  * // ┌─── Effect<number, string, never>
@@ -2758,9 +2747,9 @@ export const sandbox = internal.sandbox;
2758
2747
  * const program = task.pipe(Effect.ignore)
2759
2748
  * ```
2760
2749
  *
2761
- * @example
2750
+ * **Example** (Logging failures while ignoring results)
2751
+ *
2762
2752
  * ```ts
2763
- * // Title: Logging failures while ignoring results
2764
2753
  * import { Effect } from "effect"
2765
2754
  *
2766
2755
  * const task = Effect.fail("Uh oh!")
@@ -2775,8 +2764,8 @@ export const sandbox = internal.sandbox;
2775
2764
  *
2776
2765
  * - `Effect.ignoreLogged`
2777
2766
  *
2778
- * @since 2.0.0
2779
2767
  * @category Error Handling
2768
+ * @since 2.0.0
2780
2769
  */
2781
2770
  export const ignore = internal.ignore;
2782
2771
  /**
@@ -2785,7 +2774,8 @@ export const ignore = internal.ignore;
2785
2774
  * Use the `log` option to emit the full {@link Cause} when the effect fails,
2786
2775
  * and `message` to prepend a custom log message.
2787
2776
  *
2788
- * @example
2777
+ * **Example** (Usage)
2778
+ *
2789
2779
  * ```ts
2790
2780
  * import { Effect } from "effect"
2791
2781
  *
@@ -2795,8 +2785,8 @@ export const ignore = internal.ignore;
2795
2785
  * const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
2796
2786
  * ```
2797
2787
  *
2798
- * @since 4.0.0
2799
2788
  * @category Error Handling
2789
+ * @since 4.0.0
2800
2790
  */
2801
2791
  export const ignoreCause = internal.ignoreCause;
2802
2792
  /**
@@ -2807,7 +2797,8 @@ export const ignoreCause = internal.ignoreCause;
2807
2797
  * and retry timing is derived per step (the first attempt uses the remaining
2808
2798
  * attempts schedule; later retries apply the step schedule at least once).
2809
2799
  *
2810
- * @example
2800
+ * **Example** (Usage)
2801
+ *
2811
2802
  * ```ts
2812
2803
  * import { Effect, ExecutionPlan, Layer, Context } from "effect"
2813
2804
  *
@@ -2829,8 +2820,8 @@ export const ignoreCause = internal.ignoreCause;
2829
2820
  * const program = Effect.withExecutionPlan(fetchUrl, plan)
2830
2821
  * ```
2831
2822
  *
2832
- * @since 3.16.0
2833
2823
  * @category Fallback
2824
+ * @since 3.16.0
2834
2825
  */
2835
2826
  export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
2836
2827
  /**
@@ -2839,31 +2830,26 @@ export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
2839
2830
  * If the `defectsOnly` option is set to `true`, only defects (unrecoverable
2840
2831
  * errors) will be reported, while regular failures will be ignored.
2841
2832
  *
2842
- * @since 4.0.0
2843
2833
  * @category Error Handling
2834
+ * @since 4.0.0
2844
2835
  */
2845
2836
  export const withErrorReporting = internal.withErrorReporting;
2846
2837
  // -----------------------------------------------------------------------------
2847
2838
  // Fallback
2848
2839
  // -----------------------------------------------------------------------------
2849
2840
  /**
2850
- * Replaces the original failure with a success value, ensuring the effect
2851
- * cannot fail.
2841
+ * Recovers from a typed failure by producing a fallback success value.
2842
+ *
2843
+ * **Details**
2852
2844
  *
2853
- * `orElseSucceed` allows you to replace the failure of an effect with a
2854
- * success value. If the effect fails, it will instead succeed with the provided
2855
- * value, ensuring the effect always completes successfully. This is useful when
2856
- * you want to guarantee a successful result regardless of whether the original
2857
- * effect failed.
2845
+ * If the source effect succeeds, its value is preserved. If it fails in the
2846
+ * error channel, `orElseSucceed` evaluates the fallback and succeeds with that
2847
+ * value, removing the typed error from the returned effect.
2858
2848
  *
2859
- * The function ensures that any failure is effectively "swallowed" and replaced
2860
- * by a successful value, which can be helpful for providing default values in
2861
- * case of failure.
2849
+ * Defects and interruptions are not recovered by this operator.
2862
2850
  *
2863
- * **Important**: This function only applies to failed effects. If the effect
2864
- * already succeeds, it will remain unchanged.
2851
+ * **Example** (Usage)
2865
2852
  *
2866
- * @example
2867
2853
  * ```ts
2868
2854
  * import { Effect } from "effect"
2869
2855
  *
@@ -2884,8 +2870,8 @@ export const withErrorReporting = internal.withErrorReporting;
2884
2870
  * // { _id: 'Exit', _tag: 'Success', value: 18 }
2885
2871
  * ```
2886
2872
  *
2887
- * @since 2.0.0
2888
2873
  * @category Fallback
2874
+ * @since 2.0.0
2889
2875
  */
2890
2876
  export const orElseSucceed = internal.orElseSucceed;
2891
2877
  /**
@@ -2908,7 +2894,8 @@ export const orElseSucceed = internal.orElseSucceed;
2908
2894
  * attempting multiple APIs, reading configuration from several sources, or
2909
2895
  * trying alternative resource locations in order.
2910
2896
  *
2911
- * @example
2897
+ * **Example** (Usage)
2898
+ *
2912
2899
  * ```ts
2913
2900
  * import { Effect } from "effect"
2914
2901
  *
@@ -2928,8 +2915,8 @@ export const orElseSucceed = internal.orElseSucceed;
2928
2915
  * // Output: "secondary result"
2929
2916
  * ```
2930
2917
  *
2931
- * @since 2.0.0
2932
2918
  * @category Fallback
2919
+ * @since 2.0.0
2933
2920
  */
2934
2921
  export const firstSuccessOf = internal.firstSuccessOf;
2935
2922
  // -----------------------------------------------------------------------------
@@ -2949,7 +2936,8 @@ export const firstSuccessOf = internal.firstSuccessOf;
2949
2936
  * @see {@link timeoutFailCause} for a version that raises a custom defect.
2950
2937
  * @see {@link timeoutTo} for a version that allows specifying both success and timeout handlers.
2951
2938
  *
2952
- * @example
2939
+ * **Example** (Usage)
2940
+ *
2953
2941
  * ```ts
2954
2942
  * import { Effect } from "effect"
2955
2943
  *
@@ -2978,30 +2966,28 @@ export const firstSuccessOf = internal.firstSuccessOf;
2978
2966
  * // }
2979
2967
  * ```
2980
2968
  *
2981
- * @since 2.0.0
2982
2969
  * @category Delays & Timeouts
2970
+ * @since 2.0.0
2983
2971
  */
2984
2972
  export const timeout = internal.timeout;
2985
2973
  /**
2986
- * Handles timeouts by returning an `Option` that represents either the result
2987
- * or a timeout.
2974
+ * Runs an effect with a time limit and represents only the timeout case as
2975
+ * `Option.none`.
2988
2976
  *
2989
- * The `timeoutOption` function provides a way to gracefully handle
2990
- * timeouts by wrapping the outcome of an effect in an `Option` type. If the
2991
- * effect completes within the specified time, it returns a `Some` containing
2992
- * the result. If the effect times out, it returns a `None`, allowing you to
2993
- * treat the timeout as a regular result instead of throwing an error.
2977
+ * **Details**
2994
2978
  *
2995
- * This is useful when you want to handle timeouts without causing the program
2996
- * to fail, making it easier to manage situations where you expect tasks might
2997
- * take too long but want to continue executing other tasks.
2979
+ * If the source effect succeeds before the timeout, the returned effect
2980
+ * succeeds with `Option.some(value)`. If the timeout wins, the source effect is
2981
+ * interrupted and the returned effect succeeds with `Option.none`. If the
2982
+ * source effect fails before the timeout, that failure is preserved.
2998
2983
  *
2999
2984
  * @see {@link timeout} for a version that raises a `TimeoutException`.
3000
2985
  * @see {@link timeoutFail} for a version that raises a custom error.
3001
2986
  * @see {@link timeoutFailCause} for a version that raises a custom defect.
3002
2987
  * @see {@link timeoutTo} for a version that allows specifying both success and timeout handlers.
3003
2988
  *
3004
- * @example
2989
+ * **Example** (Usage)
2990
+ *
3005
2991
  * ```ts
3006
2992
  * import { Effect } from "effect"
3007
2993
  *
@@ -3028,8 +3014,8 @@ export const timeout = internal.timeout;
3028
3014
  * // ]
3029
3015
  * ```
3030
3016
  *
3031
- * @since 3.1.0
3032
3017
  * @category Delays & Timeouts
3018
+ * @since 3.1.0
3033
3019
  */
3034
3020
  export const timeoutOption = internal.timeoutOption;
3035
3021
  /**
@@ -3038,7 +3024,8 @@ export const timeoutOption = internal.timeoutOption;
3038
3024
  * This function is useful when you want to set a maximum duration for an operation
3039
3025
  * and provide an alternative action if the timeout is exceeded.
3040
3026
  *
3041
- * @example
3027
+ * **Example** (Usage)
3028
+ *
3042
3029
  * ```ts
3043
3030
  * import { Console, Effect } from "effect"
3044
3031
  *
@@ -3065,15 +3052,16 @@ export const timeoutOption = internal.timeoutOption;
3065
3052
  * // Cached result
3066
3053
  * ```
3067
3054
  *
3068
- * @since 3.1.0
3069
3055
  * @category Delays & Timeouts
3056
+ * @since 3.1.0
3070
3057
  */
3071
3058
  export const timeoutOrElse = internal.timeoutOrElse;
3072
3059
  /**
3073
3060
  * Returns an effect that is delayed from this effect by the specified
3074
3061
  * `Duration`.
3075
3062
  *
3076
- * @example
3063
+ * **Example** (Usage)
3064
+ *
3077
3065
  * ```ts
3078
3066
  * import { Console, Effect } from "effect"
3079
3067
  *
@@ -3086,15 +3074,16 @@ export const timeoutOrElse = internal.timeoutOrElse;
3086
3074
  * // Waits 1 second, then prints: "Delayed message"
3087
3075
  * ```
3088
3076
  *
3089
- * @since 2.0.0
3090
3077
  * @category Delays & Timeouts
3078
+ * @since 2.0.0
3091
3079
  */
3092
3080
  export const delay = internal.delay;
3093
3081
  /**
3094
- * Returns an effect that suspends for the specified duration. This method is
3095
- * asynchronous, and does not actually block the fiber executing the effect.
3082
+ * Returns an effect that suspends the current fiber for the specified duration
3083
+ * without blocking a JavaScript thread.
3084
+ *
3085
+ * **Example** (Usage)
3096
3086
  *
3097
- * @example
3098
3087
  * ```ts
3099
3088
  * import { Console, Effect } from "effect"
3100
3089
  *
@@ -3109,8 +3098,8 @@ export const delay = internal.delay;
3109
3098
  * // Output: "End" (after 2 seconds)
3110
3099
  * ```
3111
3100
  *
3112
- * @since 2.0.0
3113
3101
  * @category Delays & Timeouts
3102
+ * @since 2.0.0
3114
3103
  */
3115
3104
  export const sleep = internal.sleep;
3116
3105
  /**
@@ -3119,7 +3108,8 @@ export const sleep = internal.sleep;
3119
3108
  * The original success, failure, or interruption is preserved; only the success
3120
3109
  * value is paired with the duration.
3121
3110
  *
3122
- * @example
3111
+ * **Example** (Usage)
3112
+ *
3123
3113
  * ```ts
3124
3114
  * import { Console, Duration, Effect } from "effect"
3125
3115
  *
@@ -3129,35 +3119,32 @@ export const sleep = internal.sleep;
3129
3119
  * })
3130
3120
  * ```
3131
3121
  *
3132
- * @since 2.0.0
3133
3122
  * @category Delays & Timeouts
3123
+ * @since 2.0.0
3134
3124
  */
3135
3125
  export const timed = internal.timed;
3136
3126
  // -----------------------------------------------------------------------------
3137
3127
  // Racing
3138
3128
  // -----------------------------------------------------------------------------
3139
3129
  /**
3140
- * Races multiple effects and returns the first successful result.
3130
+ * Runs multiple effects concurrently and returns the first successful result.
3141
3131
  *
3142
3132
  * **Details**
3143
3133
  *
3144
- * This function runs multiple effects concurrently and returns the result of
3145
- * the first one to succeed. If one effect succeeds, the others will be
3146
- * interrupted.
3147
- *
3148
- * If none of the effects succeed, the function will fail with the last error
3149
- * encountered.
3134
+ * Early failures do not finish the race; `raceAll` keeps waiting until one
3135
+ * effect succeeds or every effect has failed. When one effect succeeds, the
3136
+ * remaining effects are interrupted. If every effect fails, the returned effect
3137
+ * fails with a cause containing the collected failure reasons.
3150
3138
  *
3151
3139
  * **When to Use**
3152
3140
  *
3153
- * This is useful when you want to race multiple effects, but only care about
3154
- * the first one to succeed. It is commonly used in cases like timeouts,
3155
- * retries, or when you want to optimize for the faster response without
3156
- * worrying about the other effects.
3141
+ * Use `raceAll` when early failures should be ignored until a success occurs
3142
+ * or all effects fail.
3157
3143
  *
3158
3144
  * @see {@link race} for a version that handles only two effects.
3159
3145
  *
3160
- * @example
3146
+ * **Example** (Usage)
3147
+ *
3161
3148
  * ```ts
3162
3149
  * import { Duration, Effect } from "effect"
3163
3150
  *
@@ -3172,20 +3159,22 @@ export const timed = internal.timed;
3172
3159
  * // Result: "Fast" (after ~100ms)
3173
3160
  * ```
3174
3161
  *
3175
- * @since 2.0.0
3176
3162
  * @category Racing
3163
+ * @since 2.0.0
3177
3164
  */
3178
3165
  export const raceAll = internal.raceAll;
3179
3166
  /**
3180
- * Races multiple effects and returns the first successful result.
3167
+ * Runs multiple effects concurrently and completes with the first effect to
3168
+ * finish, whether it succeeds or fails.
3181
3169
  *
3182
3170
  * **Details**
3183
3171
  *
3184
- * Similar to `raceAll`, this function runs multiple effects concurrently
3185
- * and returns the result of the first one to succeed. If one effect succeeds,
3186
- * the others will be interrupted.
3172
+ * After the first effect completes, all remaining effects are interrupted. Use
3173
+ * `raceAll` when early failures should be ignored until a success occurs or
3174
+ * all effects fail.
3175
+ *
3176
+ * **Example** (Usage)
3187
3177
  *
3188
- * @example
3189
3178
  * ```ts
3190
3179
  * import { Duration, Effect } from "effect"
3191
3180
  *
@@ -3200,8 +3189,8 @@ export const raceAll = internal.raceAll;
3200
3189
  * // Result: "First" (after ~200ms, even though effect2 completes first but fails)
3201
3190
  * ```
3202
3191
  *
3203
- * @since 4.0.0
3204
3192
  * @category Racing
3193
+ * @since 4.0.0
3205
3194
  */
3206
3195
  export const raceAllFirst = internal.raceAllFirst;
3207
3196
  /**
@@ -3210,7 +3199,8 @@ export const raceAllFirst = internal.raceAllFirst;
3210
3199
  * If one effect succeeds, the other is interrupted and `onWinner` can observe the
3211
3200
  * winning fiber. If both fail, the race fails.
3212
3201
  *
3213
- * @example
3202
+ * **Example** (Usage)
3203
+ *
3214
3204
  * ```ts
3215
3205
  * import { Console, Duration, Effect } from "effect"
3216
3206
  *
@@ -3226,8 +3216,8 @@ export const raceAllFirst = internal.raceAllFirst;
3226
3216
  * // Output: winner: slow-success
3227
3217
  * ```
3228
3218
  *
3229
- * @since 2.0.0
3230
3219
  * @category Racing
3220
+ * @since 2.0.0
3231
3221
  */
3232
3222
  export const race = internal.race;
3233
3223
  /**
@@ -3236,7 +3226,8 @@ export const race = internal.race;
3236
3226
  *
3237
3227
  * The losing effect is interrupted, and `onWinner` can observe the winning fiber.
3238
3228
  *
3239
- * @example
3229
+ * **Example** (Usage)
3230
+ *
3240
3231
  * ```ts
3241
3232
  * import { Console, Duration, Effect } from "effect"
3242
3233
  *
@@ -3255,8 +3246,8 @@ export const race = internal.race;
3255
3246
  * // Output: failed: fast-fail
3256
3247
  * ```
3257
3248
  *
3258
- * @since 2.0.0
3259
3249
  * @category Racing
3250
+ * @since 2.0.0
3260
3251
  */
3261
3252
  export const raceFirst = internal.raceFirst;
3262
3253
  // -----------------------------------------------------------------------------
@@ -3266,7 +3257,8 @@ export const raceFirst = internal.raceFirst;
3266
3257
  * Filters elements of an iterable using a predicate, refinement, or effectful
3267
3258
  * predicate.
3268
3259
  *
3269
- * @example
3260
+ * **Example** (Usage)
3261
+ *
3270
3262
  * ```ts
3271
3263
  * import { Effect } from "effect"
3272
3264
  *
@@ -3279,22 +3271,22 @@ export const raceFirst = internal.raceFirst;
3279
3271
  * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
3280
3272
  * ```
3281
3273
  *
3282
- * @since 2.0.0
3283
3274
  * @category Filtering
3275
+ * @since 2.0.0
3284
3276
  */
3285
3277
  export const filter = internal.filter;
3286
3278
  /**
3287
3279
  * Filters and maps elements of an iterable with a `Filter`.
3288
3280
  *
3289
- * @since 4.0.0
3290
3281
  * @category Filtering
3282
+ * @since 4.0.0
3291
3283
  */
3292
3284
  export const filterMap = internal.filterMap;
3293
3285
  /**
3294
3286
  * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
3295
3287
  *
3296
- * @since 4.0.0
3297
3288
  * @category Filtering
3289
+ * @since 4.0.0
3298
3290
  */
3299
3291
  export const filterMapEffect = internal.filterMapEffect;
3300
3292
  /**
@@ -3307,7 +3299,8 @@ export const filterMapEffect = internal.filterMapEffect;
3307
3299
  * `orElse` effect can produce an alternative value or perform additional
3308
3300
  * computations.
3309
3301
  *
3310
- * @example
3302
+ * **Example** (Usage)
3303
+ *
3311
3304
  * ```ts
3312
3305
  * import { Effect } from "effect"
3313
3306
  *
@@ -3324,15 +3317,15 @@ export const filterMapEffect = internal.filterMapEffect;
3324
3317
  * // Result: "Number 5 is odd" (since 5 is not even)
3325
3318
  * ```
3326
3319
  *
3327
- * @since 2.0.0
3328
3320
  * @category Filtering
3321
+ * @since 2.0.0
3329
3322
  */
3330
3323
  export const filterOrElse = internal.filterOrElse;
3331
3324
  /**
3332
3325
  * Filters an effect with a `Filter`, providing an alternative effect on failure.
3333
3326
  *
3334
- * @since 4.0.0
3335
3327
  * @category Filtering
3328
+ * @since 4.0.0
3336
3329
  */
3337
3330
  export const filterMapOrElse = internal.filterMapOrElse;
3338
3331
  /**
@@ -3344,7 +3337,8 @@ export const filterMapOrElse = internal.filterMapOrElse;
3344
3337
  * predicate evaluates to `false`, the effect fails with either a custom
3345
3338
  * error (if `orFailWith` is provided) or a `NoSuchElementError`.
3346
3339
  *
3347
- * @example
3340
+ * **Example** (Usage)
3341
+ *
3348
3342
  * ```ts
3349
3343
  * import { Effect } from "effect"
3350
3344
  *
@@ -3361,37 +3355,38 @@ export const filterMapOrElse = internal.filterMapOrElse;
3361
3355
  * // Result: Effect.fail("Expected even number, got 5")
3362
3356
  * ```
3363
3357
  *
3364
- * @since 2.0.0
3365
3358
  * @category Filtering
3359
+ * @since 2.0.0
3366
3360
  */
3367
3361
  export const filterOrFail = internal.filterOrFail;
3368
3362
  /**
3369
3363
  * Filters an effect with a `Filter`, failing when the filter fails.
3370
3364
  *
3371
- * @since 4.0.0
3372
3365
  * @category Filtering
3366
+ * @since 4.0.0
3373
3367
  */
3374
3368
  export const filterMapOrFail = internal.filterMapOrFail;
3375
3369
  // -----------------------------------------------------------------------------
3376
3370
  // Conditional Operators
3377
3371
  // -----------------------------------------------------------------------------
3378
3372
  /**
3379
- * Conditionally executes an effect based on a boolean condition.
3373
+ * Conditionally runs an effect based on the result of an effectful boolean
3374
+ * condition.
3380
3375
  *
3381
3376
  * **Details**
3382
3377
  *
3383
- * This function allows you to run an effect only if a given condition evaluates
3384
- * to `true`. If the condition is `true`, the effect is executed, and its result
3385
- * is wrapped in an `Option.some`. If the condition is `false`, the effect is
3386
- * skipped, and the result is `Option.none`.
3378
+ * The condition effect is evaluated first. If it succeeds with `true`, the
3379
+ * source effect is run and its success value is wrapped in `Option.some`. If it
3380
+ * succeeds with `false`, the source effect is skipped and the result is
3381
+ * `Option.none`. If the condition effect fails, that failure is preserved.
3387
3382
  *
3388
3383
  * **When to Use**
3389
3384
  *
3390
- * This function is useful for scenarios where you need to dynamically decide
3391
- * whether to execute an effect based on runtime logic, while also representing
3392
- * the skipped case explicitly.
3385
+ * Use this when an effectful check decides whether to run another effect while
3386
+ * representing the skipped case explicitly.
3387
+ *
3388
+ * **Example** (Usage)
3393
3389
  *
3394
- * @example
3395
3390
  * ```ts
3396
3391
  * import { Console, Effect } from "effect"
3397
3392
  *
@@ -3410,8 +3405,8 @@ export const filterMapOrFail = internal.filterMapOrFail;
3410
3405
  * @see {@link whenEffect} for a version that allows the condition to be an effect.
3411
3406
  * @see {@link unless} for a version that executes the effect when the condition is `false`.
3412
3407
  *
3413
- * @since 2.0.0
3414
3408
  * @category Conditional Operators
3409
+ * @since 2.0.0
3415
3410
  */
3416
3411
  export const when = internal.when;
3417
3412
  // -----------------------------------------------------------------------------
@@ -3435,9 +3430,9 @@ export const when = internal.when;
3435
3430
  *
3436
3431
  * @see {@link matchEffect} if you need to perform side effects in the handlers.
3437
3432
  *
3438
- * @example
3433
+ * **Example** (Handling Both Success and Failure Cases)
3434
+ *
3439
3435
  * ```ts
3440
- * // Title: Handling Both Success and Failure Cases
3441
3436
  * import { Data, Effect } from "effect"
3442
3437
  *
3443
3438
  * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
@@ -3467,8 +3462,8 @@ export const when = internal.when;
3467
3462
  * // Output: "failure: Uh oh!"
3468
3463
  * ```
3469
3464
  *
3470
- * @since 2.0.0
3471
3465
  * @category Pattern Matching
3466
+ * @since 2.0.0
3472
3467
  */
3473
3468
  export const match = internal.match;
3474
3469
  /**
@@ -3488,7 +3483,8 @@ export const match = internal.match;
3488
3483
  * optimal performance for resolved effects. This is particularly useful in
3489
3484
  * scenarios where you frequently work with already computed values.
3490
3485
  *
3491
- * @example
3486
+ * **Example** (Usage)
3487
+ *
3492
3488
  * ```ts
3493
3489
  * import { Effect } from "effect"
3494
3490
  *
@@ -3504,8 +3500,8 @@ export const match = internal.match;
3504
3500
  * @see {@link match} for the non-eager version.
3505
3501
  * @see {@link matchEffect} if you need to perform side effects in the handlers.
3506
3502
  *
3507
- * @since 2.0.0
3508
3503
  * @category Pattern Matching
3504
+ * @since 2.0.0
3509
3505
  */
3510
3506
  export const matchEager = internal.matchEager;
3511
3507
  /**
@@ -3522,7 +3518,8 @@ export const matchEager = internal.matchEager;
3522
3518
  * regular failures, defects, or interruptions. You can provide specific
3523
3519
  * handling logic for each failure type based on the cause.
3524
3520
  *
3525
- * @example
3521
+ * **Example** (Usage)
3522
+ *
3526
3523
  * ```ts
3527
3524
  * import { Cause, Effect } from "effect"
3528
3525
  *
@@ -3541,8 +3538,8 @@ export const matchEager = internal.matchEager;
3541
3538
  * handlers.
3542
3539
  * @see {@link match} if you don't need to handle the cause of the failure.
3543
3540
  *
3544
- * @since 2.0.0
3545
3541
  * @category Pattern Matching
3542
+ * @since 2.0.0
3546
3543
  */
3547
3544
  export const matchCause = internal.matchCause;
3548
3545
  /**
@@ -3560,7 +3557,8 @@ export const matchCause = internal.matchCause;
3560
3557
  * and you want to avoid the overhead of the effect pipeline. For pending effects,
3561
3558
  * it automatically falls back to the regular `matchCause` behavior.
3562
3559
  *
3563
- * @example
3560
+ * **Example** (Usage)
3561
+ *
3564
3562
  * ```ts
3565
3563
  * import { Effect } from "effect"
3566
3564
  *
@@ -3570,8 +3568,8 @@ export const matchCause = internal.matchCause;
3570
3568
  * })
3571
3569
  * ```
3572
3570
  *
3573
- * @since 3.8.0
3574
3571
  * @category Pattern Matching
3572
+ * @since 3.8.0
3575
3573
  */
3576
3574
  export const matchCauseEager = internal.matchCauseEager;
3577
3575
  /**
@@ -3580,8 +3578,8 @@ export const matchCauseEager = internal.matchCauseEager;
3580
3578
  * If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
3581
3579
  * {@link matchCauseEffect}.
3582
3580
  *
3583
- * @since 4.0.0
3584
3581
  * @category Pattern Matching
3582
+ * @since 4.0.0
3585
3583
  */
3586
3584
  export const matchCauseEffectEager = internal.matchCauseEffectEager;
3587
3585
  /**
@@ -3596,7 +3594,8 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
3596
3594
  * you to respond accordingly while performing side effects (like logging or
3597
3595
  * other operations).
3598
3596
  *
3599
- * @example
3597
+ * **Example** (Usage)
3598
+ *
3600
3599
  * ```ts
3601
3600
  * import { Cause, Console, Data, Effect, Result } from "effect"
3602
3601
  *
@@ -3634,30 +3633,29 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
3634
3633
  * @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
3635
3634
  * @see {@link matchEffect} if you don't need to handle the cause of the failure.
3636
3635
  *
3637
- * @since 2.0.0
3638
3636
  * @category Pattern Matching
3637
+ * @since 2.0.0
3639
3638
  */
3640
3639
  export const matchCauseEffect = internal.matchCauseEffect;
3641
3640
  /**
3642
- * Handles both success and failure cases of an effect, allowing for additional
3643
- * side effects.
3641
+ * Handles both success and failure by running effectful handlers.
3644
3642
  *
3645
3643
  * **Details**
3646
3644
  *
3647
- * The `matchEffect` function is similar to {@link match}, but it enables you to
3648
- * perform side effects in the handlers for both success and failure outcomes.
3645
+ * Use `matchEffect` when either branch needs to return an `Effect`, such as
3646
+ * performing logging, recovery, notification, or other effectful work. The
3647
+ * returned effect succeeds or fails according to the handler that is run.
3649
3648
  *
3650
3649
  * **When to Use**
3651
3650
  *
3652
- * This is useful when you need to execute additional actions, like logging or
3653
- * notifying users, based on whether an effect succeeds or fails.
3651
+ * Use this when the failure or success branch must run additional effects.
3654
3652
  *
3655
3653
  * @see {@link match} if you don't need side effects and only want to handle the
3656
3654
  * result or failure.
3657
3655
  *
3658
- * @example
3656
+ * **Example** (Handling Both Success and Failure Cases with Side Effects)
3657
+ *
3659
3658
  * ```ts
3660
- * // Title: Handling Both Success and Failure Cases with Side Effects
3661
3659
  * import { Data, Effect } from "effect"
3662
3660
  *
3663
3661
  * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
@@ -3696,8 +3694,8 @@ export const matchCauseEffect = internal.matchCauseEffect;
3696
3694
  * // failure: Uh oh!
3697
3695
  * ```
3698
3696
  *
3699
- * @since 2.0.0
3700
3697
  * @category Pattern Matching
3698
+ * @since 2.0.0
3701
3699
  */
3702
3700
  export const matchEffect = internal.matchEffect;
3703
3701
  // -----------------------------------------------------------------------------
@@ -3708,7 +3706,7 @@ export const matchEffect = internal.matchEffect;
3708
3706
  *
3709
3707
  * Defects are not converted; if the effect dies, the resulting effect dies too.
3710
3708
  *
3711
- * **Example**
3709
+ * **Example** (Checking whether an effect fails)
3712
3710
  *
3713
3711
  * ```ts
3714
3712
  * import { Console, Effect } from "effect"
@@ -3722,8 +3720,8 @@ export const matchEffect = internal.matchEffect;
3722
3720
  * // Output: true
3723
3721
  * ```
3724
3722
  *
3725
- * @since 2.0.0
3726
3723
  * @category Condition Checking
3724
+ * @since 2.0.0
3727
3725
  */
3728
3726
  export const isFailure = internal.isFailure;
3729
3727
  /**
@@ -3732,7 +3730,7 @@ export const isFailure = internal.isFailure;
3732
3730
  * Returns `false` for failures in the error channel, but defects still fail the
3733
3731
  * effect.
3734
3732
  *
3735
- * **Example**
3733
+ * **Example** (Checking whether an effect succeeds)
3736
3734
  *
3737
3735
  * ```ts
3738
3736
  * import { Console, Effect } from "effect"
@@ -3750,8 +3748,8 @@ export const isFailure = internal.isFailure;
3750
3748
  * // failed: false
3751
3749
  * ```
3752
3750
  *
3753
- * @since 2.0.0
3754
3751
  * @category Condition Checking
3752
+ * @since 2.0.0
3755
3753
  */
3756
3754
  export const isSuccess = internal.isSuccess;
3757
3755
  // -----------------------------------------------------------------------------
@@ -3764,7 +3762,8 @@ export const isSuccess = internal.isSuccess;
3764
3762
  * in the effect's environment. This can be useful for debugging, introspection,
3765
3763
  * or when you need to pass the entire context to another function.
3766
3764
  *
3767
- * @example
3765
+ * **Example** (Usage)
3766
+ *
3768
3767
  * ```ts
3769
3768
  * import { Console, Effect, Option, Context } from "effect"
3770
3769
  *
@@ -3792,8 +3791,8 @@ export const isSuccess = internal.isSuccess;
3792
3791
  * const provided = Effect.provideContext(program, context)
3793
3792
  * ```
3794
3793
  *
3795
- * @since 2.0.0
3796
3794
  * @category Environment
3795
+ * @since 2.0.0
3797
3796
  */
3798
3797
  export const context = internal.context;
3799
3798
  /**
@@ -3803,7 +3802,8 @@ export const context = internal.context;
3803
3802
  * computations based on all available services. This is useful when you need
3804
3803
  * to conditionally execute logic based on what services are available.
3805
3804
  *
3806
- * @example
3805
+ * **Example** (Usage)
3806
+ *
3807
3807
  * ```ts
3808
3808
  * import { Console, Effect, Option, Context } from "effect"
3809
3809
  *
@@ -3837,8 +3837,8 @@ export const context = internal.context;
3837
3837
  * })
3838
3838
  * ```
3839
3839
  *
3840
- * @since 2.0.0
3841
3840
  * @category Environment
3841
+ * @since 2.0.0
3842
3842
  */
3843
3843
  export const contextWith = internal.contextWith;
3844
3844
  /**
@@ -3846,7 +3846,8 @@ export const contextWith = internal.contextWith;
3846
3846
  * to build the layer every time; by default, layers are shared between provide
3847
3847
  * calls.
3848
3848
  *
3849
- * @example
3849
+ * **Example** (Usage)
3850
+ *
3850
3851
  * ```ts
3851
3852
  * import { Effect, Layer, Context } from "effect"
3852
3853
  *
@@ -3871,8 +3872,8 @@ export const contextWith = internal.contextWith;
3871
3872
  * // Output: "Result for: SELECT * FROM users"
3872
3873
  * ```
3873
3874
  *
3874
- * @since 2.0.0
3875
3875
  * @category Environment
3876
+ * @since 2.0.0
3876
3877
  */
3877
3878
  export const provide = internalLayer.provide;
3878
3879
  /**
@@ -3884,7 +3885,8 @@ export const provide = internalLayer.provide;
3884
3885
  * that contains all the required services. It removes the provided services
3885
3886
  * from the effect's requirements, making them available to the effect.
3886
3887
  *
3887
- * @example
3888
+ * **Example** (Usage)
3889
+ *
3888
3890
  * ```ts
3889
3891
  * import { Effect, Context } from "effect"
3890
3892
  *
@@ -3911,14 +3913,15 @@ export const provide = internalLayer.provide;
3911
3913
  * const provided = Effect.provideContext(program, context)
3912
3914
  * ```
3913
3915
  *
3914
- * @since 2.0.0
3915
3916
  * @category Environment
3917
+ * @since 2.0.0
3916
3918
  */
3917
3919
  export const provideContext = internal.provideContext;
3918
3920
  /**
3919
3921
  * Accesses a service from the context.
3920
3922
  *
3921
- * @example
3923
+ * **Example** (Usage)
3924
+ *
3922
3925
  * ```ts
3923
3926
  * import { Effect, Context } from "effect"
3924
3927
  *
@@ -3934,8 +3937,8 @@ export const provideContext = internal.provideContext;
3934
3937
  * })
3935
3938
  * ```
3936
3939
  *
3937
- * @since 4.0.0
3938
3940
  * @category Context
3941
+ * @since 4.0.0
3939
3942
  */
3940
3943
  export const service = internal.service;
3941
3944
  /**
@@ -3948,7 +3951,8 @@ export const service = internal.service;
3948
3951
  * available, it returns `None`. Unlike `service`, this function does not
3949
3952
  * require the service to be present in the environment.
3950
3953
  *
3951
- * @example
3954
+ * **Example** (Usage)
3955
+ *
3952
3956
  * ```ts
3953
3957
  * import { Effect, Option, Context } from "effect"
3954
3958
  *
@@ -3969,8 +3973,8 @@ export const service = internal.service;
3969
3973
  * })
3970
3974
  * ```
3971
3975
  *
3972
- * @since 2.0.0
3973
3976
  * @category Context
3977
+ * @since 2.0.0
3974
3978
  */
3975
3979
  export const serviceOption = internal.serviceOption;
3976
3980
  /**
@@ -3981,7 +3985,8 @@ export const serviceOption = internal.serviceOption;
3981
3985
  * This function allows you to transform the context required by an effect,
3982
3986
  * providing part of the context and leaving the rest to be fulfilled later.
3983
3987
  *
3984
- * @example
3988
+ * **Example** (Usage)
3989
+ *
3985
3990
  * ```ts
3986
3991
  * import { Effect, Context } from "effect"
3987
3992
  *
@@ -4010,14 +4015,19 @@ export const serviceOption = internal.serviceOption;
4010
4015
  * })
4011
4016
  * ```
4012
4017
  *
4013
- * @since 4.0.0
4014
4018
  * @category Context
4019
+ * @since 4.0.0
4015
4020
  */
4016
4021
  export const updateContext = internal.updateContext;
4017
4022
  /**
4018
- * Updates the service with the required service entry.
4023
+ * Runs an effect with a service implementation transformed by the provided
4024
+ * function.
4025
+ *
4026
+ * The service must be available in the effect's context; `updateService`
4027
+ * replaces it for the wrapped effect with the value returned by the updater.
4028
+ *
4029
+ * **Example** (Usage)
4019
4030
  *
4020
- * @example
4021
4031
  * ```ts
4022
4032
  * import { Console, Effect, Context } from "effect"
4023
4033
  *
@@ -4039,8 +4049,8 @@ export const updateContext = internal.updateContext;
4039
4049
  * // 1
4040
4050
  * ```
4041
4051
  *
4042
- * @since 2.0.0
4043
4052
  * @category Context
4053
+ * @since 2.0.0
4044
4054
  */
4045
4055
  export const updateService = internal.updateService;
4046
4056
  /**
@@ -4055,7 +4065,8 @@ export const updateService = internal.updateService;
4055
4065
  *
4056
4066
  * @see {@link provide} for providing multiple layers to an effect.
4057
4067
  *
4058
- * @example
4068
+ * **Example** (Usage)
4069
+ *
4059
4070
  * ```ts
4060
4071
  * import { Console, Effect, Context } from "effect"
4061
4072
  *
@@ -4085,21 +4096,22 @@ export const updateService = internal.updateService;
4085
4096
  * // data
4086
4097
  * ```
4087
4098
  *
4088
- * @since 2.0.0
4089
4099
  * @category Context
4100
+ * @since 2.0.0
4090
4101
  */
4091
4102
  export const provideService = internal.provideService;
4092
4103
  /**
4093
- * Provides the effect with the single service it requires. If the effect
4094
- * requires more than one service use `provide` instead.
4104
+ * Provides one service to an effect using an effectful acquisition.
4105
+ *
4106
+ * **Details**
4107
+ *
4108
+ * `provideServiceEffect` runs the acquisition effect to produce the service
4109
+ * implementation, removes that service from the wrapped effect's requirements,
4110
+ * and leaves any other requirements to be provided later. Acquisition failures
4111
+ * are included in the returned effect's error channel.
4095
4112
  *
4096
- * This function is similar to `provideService`, but instead of providing a
4097
- * static service implementation, it allows you to provide an effect that
4098
- * will produce the service. This is useful when the service needs to be
4099
- * acquired through an effectful computation (e.g., reading from a database,
4100
- * making an HTTP request, or allocating resources).
4113
+ * **Example** (Usage)
4101
4114
  *
4102
- * @example
4103
4115
  * ```ts
4104
4116
  * import { Console, Effect, Context } from "effect"
4105
4117
  *
@@ -4138,8 +4150,8 @@ export const provideService = internal.provideService;
4138
4150
  * // Result for: SELECT * FROM users
4139
4151
  * ```
4140
4152
  *
4141
- * @since 2.0.0
4142
4153
  * @category Context
4154
+ * @since 2.0.0
4143
4155
  */
4144
4156
  export const provideServiceEffect = internal.provideServiceEffect;
4145
4157
  // -----------------------------------------------------------------------------
@@ -4148,7 +4160,8 @@ export const provideServiceEffect = internal.provideServiceEffect;
4148
4160
  /**
4149
4161
  * Sets the concurrency level for parallel operations within an effect.
4150
4162
  *
4151
- * @example
4163
+ * **Example** (Usage)
4164
+ *
4152
4165
  * ```ts
4153
4166
  * import { Console, Effect } from "effect"
4154
4167
  *
@@ -4173,8 +4186,8 @@ export const provideServiceEffect = internal.provideServiceEffect;
4173
4186
  * // [1, 2, 3, 4, 5]
4174
4187
  * ```
4175
4188
  *
4176
- * @since 2.0.0
4177
4189
  * @category References
4190
+ * @since 2.0.0
4178
4191
  */
4179
4192
  export const withConcurrency = internal.withConcurrency;
4180
4193
  // -----------------------------------------------------------------------------
@@ -4183,7 +4196,8 @@ export const withConcurrency = internal.withConcurrency;
4183
4196
  /**
4184
4197
  * Returns the current scope for resource management.
4185
4198
  *
4186
- * @example
4199
+ * **Example** (Usage)
4200
+ *
4187
4201
  * ```ts
4188
4202
  * import { Console, Effect } from "effect"
4189
4203
  *
@@ -4208,8 +4222,8 @@ export const withConcurrency = internal.withConcurrency;
4208
4222
  * // Releasing resource
4209
4223
  * ```
4210
4224
  *
4211
- * @since 2.0.0
4212
4225
  * @category Resource Management & Finalization
4226
+ * @since 2.0.0
4213
4227
  */
4214
4228
  export const scope = internal.scope;
4215
4229
  /**
@@ -4217,7 +4231,8 @@ export const scope = internal.scope;
4217
4231
  * ensuring that their finalizers are run as soon as this workflow completes
4218
4232
  * execution, whether by success, failure, or interruption.
4219
4233
  *
4220
- * @example
4234
+ * **Example** (Usage)
4235
+ *
4221
4236
  * ```ts
4222
4237
  * import { Console, Effect } from "effect"
4223
4238
  *
@@ -4240,14 +4255,15 @@ export const scope = internal.scope;
4240
4255
  * // Output: "Releasing resource"
4241
4256
  * ```
4242
4257
  *
4243
- * @since 2.0.0
4244
4258
  * @category Resource Management & Finalization
4259
+ * @since 2.0.0
4245
4260
  */
4246
4261
  export const scoped = internal.scoped;
4247
4262
  /**
4248
4263
  * Creates a scoped effect by providing access to the scope.
4249
4264
  *
4250
- * @example
4265
+ * **Example** (Usage)
4266
+ *
4251
4267
  * ```ts
4252
4268
  * import { Console, Effect, Scope } from "effect"
4253
4269
  *
@@ -4279,24 +4295,25 @@ export const scoped = internal.scoped;
4279
4295
  * // Manual finalizer
4280
4296
  * ```
4281
4297
  *
4282
- * @since 2.0.0
4283
4298
  * @category Resource Management & Finalization
4299
+ * @since 2.0.0
4284
4300
  */
4285
4301
  export const scopedWith = internal.scopedWith;
4286
4302
  /**
4287
- * This function constructs a scoped resource from an `acquire` and `release`
4288
- * `Effect` value.
4303
+ * Constructs a scoped resource from an acquisition effect and a release
4304
+ * finalizer.
4289
4305
  *
4290
- * If the `acquire` `Effect` value successfully completes execution, then the
4291
- * `release` `Effect` value will be added to the finalizers associated with the
4292
- * scope of this `Effect` value, and it is guaranteed to be run when the scope
4293
- * is closed.
4306
+ * **Details**
4307
+ *
4308
+ * If acquisition succeeds, the release finalizer is added to the current scope
4309
+ * and is guaranteed to run when that scope closes. The finalizer receives the
4310
+ * `Exit` value used to close the scope.
4294
4311
  *
4295
- * The `acquire` and `release` `Effect` values will be run uninterruptibly.
4296
- * Additionally, the `release` `Effect` value may depend on the `Exit` value
4297
- * specified when the scope is closed.
4312
+ * By default, acquisition is protected by an uninterruptible region. Pass
4313
+ * `{ interruptible: true }` to allow the acquisition effect to be interrupted.
4314
+ *
4315
+ * **Example** (Usage)
4298
4316
  *
4299
- * @example
4300
4317
  * ```ts
4301
4318
  * import { Console, Effect, Exit } from "effect"
4302
4319
  *
@@ -4333,8 +4350,8 @@ export const scopedWith = internal.scopedWith;
4333
4350
  * )
4334
4351
  * ```
4335
4352
  *
4336
- * @since 2.0.0
4337
4353
  * @category Resource Management & Finalization
4354
+ * @since 2.0.0
4338
4355
  */
4339
4356
  export const acquireRelease = internal.acquireRelease;
4340
4357
  /**
@@ -4352,7 +4369,8 @@ export const acquireRelease = internal.acquireRelease;
4352
4369
  *
4353
4370
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using}
4354
4371
  *
4355
- * @example
4372
+ * **Example** (Usage)
4373
+ *
4356
4374
  * ```ts
4357
4375
  * import sqlite from "node:sqlite";
4358
4376
  * import { Effect } from "effect";
@@ -4371,8 +4389,8 @@ export const acquireRelease = internal.acquireRelease;
4371
4389
  * )
4372
4390
  * ```
4373
4391
  *
4374
- * @since 4.0.0
4375
4392
  * @category Resource Management & Finalization
4393
+ * @since 4.0.0
4376
4394
  */
4377
4395
  export const acquireDisposable = internal.acquireDisposable;
4378
4396
  /**
@@ -4398,7 +4416,8 @@ export const acquireDisposable = internal.acquireDisposable;
4398
4416
  * is not desired, errors produced by the `release` `Effect` value can be caught
4399
4417
  * and ignored.
4400
4418
  *
4401
- * @example
4419
+ * **Example** (Usage)
4420
+ *
4402
4421
  * ```ts
4403
4422
  * import { Console, Effect, Exit } from "effect"
4404
4423
  *
@@ -4443,8 +4462,8 @@ export const acquireDisposable = internal.acquireDisposable;
4443
4462
  * // Closing connection to db://localhost:5432 (success)
4444
4463
  * ```
4445
4464
  *
4446
- * @since 2.0.0
4447
4465
  * @category Resource Management & Finalization
4466
+ * @since 2.0.0
4448
4467
  */
4449
4468
  export const acquireUseRelease = internal.acquireUseRelease;
4450
4469
  /**
@@ -4456,7 +4475,8 @@ export const acquireUseRelease = internal.acquireUseRelease;
4456
4475
  * whether the effect succeeds or fails. They're commonly used for resource
4457
4476
  * cleanup, logging, or other side effects that should always occur.
4458
4477
  *
4459
- * @example
4478
+ * **Example** (Usage)
4479
+ *
4460
4480
  * ```ts
4461
4481
  * import { Console, Effect, Exit } from "effect"
4462
4482
  *
@@ -4485,8 +4505,8 @@ export const acquireUseRelease = internal.acquireUseRelease;
4485
4505
  * // operation result
4486
4506
  * ```
4487
4507
  *
4488
- * @since 2.0.0
4489
4508
  * @category Resource Management & Finalization
4509
+ * @since 2.0.0
4490
4510
  */
4491
4511
  export const addFinalizer = internal.addFinalizer;
4492
4512
  /**
@@ -4500,7 +4520,8 @@ export const addFinalizer = internal.addFinalizer;
4500
4520
  * should generally not be used for releasing resources. For higher-level
4501
4521
  * logic built on `ensuring`, see the `acquireRelease` family of methods.
4502
4522
  *
4503
- * @example
4523
+ * **Example** (Usage)
4524
+ *
4504
4525
  * ```ts
4505
4526
  * import { Console, Effect } from "effect"
4506
4527
  *
@@ -4525,15 +4546,16 @@ export const addFinalizer = internal.addFinalizer;
4525
4546
  * // 42
4526
4547
  * ```
4527
4548
  *
4528
- * @since 2.0.0
4529
4549
  * @category Resource Management & Finalization
4550
+ * @since 2.0.0
4530
4551
  */
4531
4552
  export const ensuring = internal.ensuring;
4532
4553
  /**
4533
4554
  * Runs the specified effect if this effect fails, providing the error to the
4534
4555
  * effect if it exists. The provided effect will not be interrupted.
4535
4556
  *
4536
- * @example
4557
+ * **Example** (Usage)
4558
+ *
4537
4559
  * ```ts
4538
4560
  * import { Cause, Data, Console, Effect } from "effect"
4539
4561
  *
@@ -4552,15 +4574,16 @@ export const ensuring = internal.ensuring;
4552
4574
  * // TaskError: Something went wrong
4553
4575
  * ```
4554
4576
  *
4555
- * @since 2.0.0
4556
4577
  * @category Resource Management & Finalization
4578
+ * @since 2.0.0
4557
4579
  */
4558
4580
  export const onError = internal.onError;
4559
4581
  /**
4560
4582
  * Runs the finalizer only when this effect fails and the `Cause` matches the
4561
4583
  * provided predicate.
4562
4584
  *
4563
- * @example
4585
+ * **Example** (Usage)
4586
+ *
4564
4587
  * ```ts
4565
4588
  * import { Cause, Console, Effect } from "effect"
4566
4589
  *
@@ -4576,31 +4599,36 @@ export const onError = internal.onError;
4576
4599
  * )
4577
4600
  * ```
4578
4601
  *
4579
- * @since 4.0.0
4580
4602
  * @category Resource Management & Finalization
4603
+ * @since 4.0.0
4581
4604
  */
4582
4605
  export const onErrorIf = internal.onErrorIf;
4583
4606
  /**
4584
4607
  * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
4585
4608
  *
4586
- * @since 4.0.0
4587
4609
  * @category Resource Management & Finalization
4610
+ * @since 4.0.0
4588
4611
  */
4589
4612
  export const onErrorFilter = internal.onErrorFilter;
4590
4613
  /**
4591
- * The low level primitive that powers `onExit`.
4592
- * function is used to run a finalizer when the effect exits, regardless of the
4593
- * exit status.
4614
+ * Runs an optional finalizer with the effect's `Exit` value when the effect
4615
+ * completes.
4616
+ *
4617
+ * **Details**
4618
+ *
4619
+ * This low-level operator preserves the source effect's result unless the
4620
+ * finalizer fails. Prefer `onExit` for normal cleanup logic.
4594
4621
  *
4595
- * @since 2.0.0
4596
4622
  * @category Resource Management & Finalization
4623
+ * @since 2.0.0
4597
4624
  */
4598
4625
  export const onExitPrimitive = internal.onExitPrimitive;
4599
4626
  /**
4600
4627
  * Ensures that a cleanup functions runs, whether this effect succeeds, fails,
4601
4628
  * or is interrupted.
4602
4629
  *
4603
- * @example
4630
+ * **Example** (Usage)
4631
+ *
4604
4632
  * ```ts
4605
4633
  * import { Console, Effect, Exit } from "effect"
4606
4634
  *
@@ -4619,15 +4647,16 @@ export const onExitPrimitive = internal.onExitPrimitive;
4619
4647
  * // 42
4620
4648
  * ```
4621
4649
  *
4622
- * @since 2.0.0
4623
4650
  * @category Resource Management & Finalization
4651
+ * @since 2.0.0
4624
4652
  */
4625
4653
  export const onExit = internal.onExit;
4626
4654
  /**
4627
4655
  * Runs the cleanup effect only when the `Exit` satisfies the provided
4628
4656
  * predicate.
4629
4657
  *
4630
- * @example
4658
+ * **Example** (Usage)
4659
+ *
4631
4660
  * ```ts
4632
4661
  * import { Console, Effect, Exit } from "effect"
4633
4662
  *
@@ -4641,15 +4670,15 @@ export const onExit = internal.onExit;
4641
4670
  * )
4642
4671
  * ```
4643
4672
  *
4644
- * @since 4.0.0
4645
4673
  * @category Resource Management & Finalization
4674
+ * @since 4.0.0
4646
4675
  */
4647
4676
  export const onExitIf = internal.onExitIf;
4648
4677
  /**
4649
4678
  * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
4650
4679
  *
4651
- * @since 4.0.0
4652
4680
  * @category Resource Management & Finalization
4681
+ * @since 4.0.0
4653
4682
  */
4654
4683
  export const onExitFilter = internal.onExitFilter;
4655
4684
  // -----------------------------------------------------------------------------
@@ -4678,7 +4707,8 @@ export const onExitFilter = internal.onExitFilter;
4678
4707
  * @see {@link cachedInvalidateWithTTL} for a similar function that includes an
4679
4708
  * additional effect for manually invalidating the cached value.
4680
4709
  *
4681
- * @example
4710
+ * **Example** (Usage)
4711
+ *
4682
4712
  * ```ts
4683
4713
  * import { Console, Effect } from "effect"
4684
4714
  *
@@ -4715,8 +4745,8 @@ export const onExitFilter = internal.onExitFilter;
4715
4745
  * // result 3
4716
4746
  * ```
4717
4747
  *
4718
- * @since 2.0.0
4719
4748
  * @category Caching
4749
+ * @since 2.0.0
4720
4750
  */
4721
4751
  export const cached = internal.cached;
4722
4752
  /**
@@ -4751,7 +4781,8 @@ export const cached = internal.cached;
4751
4781
  * @see {@link cachedInvalidateWithTTL} for a similar function that includes an
4752
4782
  * additional effect for manually invalidating the cached value.
4753
4783
  *
4754
- * @example
4784
+ * **Example** (Usage)
4785
+ *
4755
4786
  * ```ts
4756
4787
  * import { Console, Effect } from "effect"
4757
4788
  *
@@ -4782,8 +4813,8 @@ export const cached = internal.cached;
4782
4813
  * // result 2
4783
4814
  * ```
4784
4815
  *
4785
- * @since 2.0.0
4786
4816
  * @category Caching
4817
+ * @since 2.0.0
4787
4818
  */
4788
4819
  export const cachedWithTTL = internal.cachedWithTTL;
4789
4820
  /**
@@ -4818,7 +4849,8 @@ export const cachedWithTTL = internal.cachedWithTTL;
4818
4849
  * @see {@link cachedWithTTL} for a similar function that caches the result for
4819
4850
  * a specified duration but does not include an effect for manual invalidation.
4820
4851
  *
4821
- * @example
4852
+ * **Example** (Usage)
4853
+ *
4822
4854
  * ```ts
4823
4855
  * import { Console, Effect } from "effect"
4824
4856
  *
@@ -4852,8 +4884,8 @@ export const cachedWithTTL = internal.cachedWithTTL;
4852
4884
  * // result 2
4853
4885
  * ```
4854
4886
  *
4855
- * @since 2.0.0
4856
4887
  * @category Caching
4888
+ * @since 2.0.0
4857
4889
  */
4858
4890
  export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
4859
4891
  // -----------------------------------------------------------------------------
@@ -4862,7 +4894,8 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
4862
4894
  /**
4863
4895
  * Returns an effect that is immediately interrupted.
4864
4896
  *
4865
- * @example
4897
+ * **Example** (Usage)
4898
+ *
4866
4899
  * ```ts
4867
4900
  * import { Effect } from "effect"
4868
4901
  *
@@ -4875,14 +4908,15 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
4875
4908
  * // Throws: InterruptedException
4876
4909
  * ```
4877
4910
  *
4878
- * @since 2.0.0
4879
4911
  * @category Interruption
4912
+ * @since 2.0.0
4880
4913
  */
4881
4914
  export const interrupt = internal.interrupt;
4882
4915
  /**
4883
4916
  * Returns a new effect that allows the effect to be interruptible.
4884
4917
  *
4885
- * @example
4918
+ * **Example** (Usage)
4919
+ *
4886
4920
  * ```ts
4887
4921
  * import { Effect } from "effect"
4888
4922
  *
@@ -4895,14 +4929,15 @@ export const interrupt = internal.interrupt;
4895
4929
  * // Later: fiber.interrupt()
4896
4930
  * ```
4897
4931
  *
4898
- * @since 2.0.0
4899
4932
  * @category Interruption
4933
+ * @since 2.0.0
4900
4934
  */
4901
4935
  export const interruptible = internal.interruptible;
4902
4936
  /**
4903
4937
  * Runs the specified finalizer effect if this effect is interrupted.
4904
4938
  *
4905
- * @example
4939
+ * **Example** (Usage)
4940
+ *
4906
4941
  * ```ts
4907
4942
  * import { Console, Effect, Fiber } from "effect"
4908
4943
  *
@@ -4919,14 +4954,15 @@ export const interruptible = internal.interruptible;
4919
4954
  * // Output: Task was interrupted, cleaning up...
4920
4955
  * ```
4921
4956
  *
4922
- * @since 2.0.0
4923
4957
  * @category Interruption
4958
+ * @since 2.0.0
4924
4959
  */
4925
4960
  export const onInterrupt = internal.onInterrupt;
4926
4961
  /**
4927
4962
  * Returns a new effect that disables interruption for the given effect.
4928
4963
  *
4929
- * @example
4964
+ * **Example** (Usage)
4965
+ *
4930
4966
  * ```ts
4931
4967
  * import { Console, Effect, Fiber } from "effect"
4932
4968
  *
@@ -4943,15 +4979,16 @@ export const onInterrupt = internal.onInterrupt;
4943
4979
  * Effect.runPromise(Fiber.interrupt(fiber))
4944
4980
  * ```
4945
4981
  *
4946
- * @since 2.0.0
4947
4982
  * @category Interruption
4983
+ * @since 2.0.0
4948
4984
  */
4949
4985
  export const uninterruptible = internal.uninterruptible;
4950
4986
  /**
4951
4987
  * Disables interruption and provides a restore function to restore the
4952
4988
  * interruptible state within the effect.
4953
4989
  *
4954
- * @example
4990
+ * **Example** (Usage)
4991
+ *
4955
4992
  * ```ts
4956
4993
  * import { Console, Effect } from "effect"
4957
4994
  *
@@ -4973,8 +5010,8 @@ export const uninterruptible = internal.uninterruptible;
4973
5010
  * )
4974
5011
  * ```
4975
5012
  *
4976
- * @since 2.0.0
4977
5013
  * @category Interruption
5014
+ * @since 2.0.0
4978
5015
  */
4979
5016
  export const uninterruptibleMask = internal.uninterruptibleMask;
4980
5017
  /**
@@ -4982,7 +5019,8 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
4982
5019
  * `restore` function. This function can be used to restore the interruptibility
4983
5020
  * of any specific region of code.
4984
5021
  *
4985
- * @example
5022
+ * **Example** (Usage)
5023
+ *
4986
5024
  * ```ts
4987
5025
  * import { Console, Effect } from "effect"
4988
5026
  *
@@ -5004,21 +5042,22 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
5004
5042
  * )
5005
5043
  * ```
5006
5044
  *
5007
- * @since 2.0.0
5008
5045
  * @category Interruption
5046
+ * @since 2.0.0
5009
5047
  */
5010
5048
  export const interruptibleMask = internal.interruptibleMask;
5011
5049
  /**
5012
5050
  * Creates an AbortSignal that is managed by the provided scope.
5013
5051
  *
5014
- * @since 4.0.0
5015
5052
  * @category Interruption
5053
+ * @since 4.0.0
5016
5054
  */
5017
5055
  export const abortSignal = internal.abortSignal;
5018
5056
  /**
5019
5057
  * Repeats this effect forever (until the first error).
5020
5058
  *
5021
- * @example
5059
+ * **Example** (Usage)
5060
+ *
5022
5061
  * ```ts
5023
5062
  * import { Console, Effect, Fiber } from "effect"
5024
5063
  *
@@ -5041,8 +5080,8 @@ export const abortSignal = internal.abortSignal;
5041
5080
  * })
5042
5081
  * ```
5043
5082
  *
5044
- * @since 2.0.0
5045
5083
  * @category Repetition / Recursion
5084
+ * @since 2.0.0
5046
5085
  */
5047
5086
  export const forever = internal.forever;
5048
5087
  /**
@@ -5067,7 +5106,8 @@ export const forever = internal.forever;
5067
5106
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
5068
5107
  * each execution.
5069
5108
  *
5070
- * @example
5109
+ * **Example** (Usage)
5110
+ *
5071
5111
  * ```ts
5072
5112
  * // Success Example
5073
5113
  * import { Effect } from "effect"
@@ -5081,7 +5121,9 @@ export const forever = internal.forever;
5081
5121
  * // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
5082
5122
  * ```
5083
5123
  *
5084
- * @example
5124
+ * **Example** (Usage)
5125
+ *
5126
+ * ```ts
5085
5127
  * // Failure Example
5086
5128
  * import { Effect } from "effect"
5087
5129
  * import { Schedule } from "effect"
@@ -5104,30 +5146,25 @@ export const forever = internal.forever;
5104
5146
  * const program = Effect.repeat(action, policy)
5105
5147
  *
5106
5148
  * // Effect.runPromiseExit(program).then(console.log)
5149
+ * ```
5107
5150
  *
5108
- * @since 2.0.0
5109
5151
  * @category Repetition / Recursion
5152
+ * @since 2.0.0
5110
5153
  */
5111
5154
  export const repeat = internalSchedule.repeat;
5112
5155
  /**
5113
- * Repeats an effect with a schedule, handling failures using a custom handler.
5156
+ * Repeats an effect according to a schedule and runs a fallback effect if
5157
+ * repetition fails before the schedule completes.
5114
5158
  *
5115
5159
  * **Details**
5116
5160
  *
5117
- * This function allows you to execute an effect repeatedly based on a specified
5118
- * schedule. If the effect fails at any point, a custom failure handler is
5119
- * invoked. The handler is provided with both the failure value and the output
5120
- * of the schedule at the time of failure. If the effect fails immediately, the
5121
- * schedule will never be executed and the output provided to the handler will
5122
- * be `None`. This enables advanced error recovery or alternative fallback logic
5123
- * while maintaining flexibility in how repetitions are handled.
5161
+ * If the repeated effect or schedule step fails, `orElse` receives the failure
5162
+ * and the latest schedule metadata when at least one schedule step has run;
5163
+ * otherwise it receives `None`. If the schedule completes normally, the
5164
+ * returned effect succeeds with the schedule's output.
5124
5165
  *
5125
- * For example, using a schedule with `recurs(2)` will allow for two additional
5126
- * repetitions after the initial execution, provided the effect succeeds. If a
5127
- * failure occurs during any iteration, the failure handler is invoked to handle
5128
- * the situation.
5166
+ * **Example** (Usage)
5129
5167
  *
5130
- * @example
5131
5168
  * ```ts
5132
5169
  * import { Console, Effect, Schedule } from "effect"
5133
5170
  * import * as Option from "effect/Option"
@@ -5155,8 +5192,8 @@ export const repeat = internalSchedule.repeat;
5155
5192
  * )
5156
5193
  * ```
5157
5194
  *
5158
- * @since 2.0.0
5159
5195
  * @category Repetition / Recursion
5196
+ * @since 2.0.0
5160
5197
  */
5161
5198
  export const repeatOrElse = internalSchedule.repeatOrElse;
5162
5199
  /**
@@ -5164,8 +5201,8 @@ export const repeatOrElse = internalSchedule.repeatOrElse;
5164
5201
  *
5165
5202
  * Use with `Effect.all` to run the replicated effects and collect results.
5166
5203
  *
5167
- * @since 2.0.0
5168
5204
  * @category Collecting
5205
+ * @since 2.0.0
5169
5206
  */
5170
5207
  export const replicate = internal.replicate;
5171
5208
  /**
@@ -5173,7 +5210,8 @@ export const replicate = internal.replicate;
5173
5210
  *
5174
5211
  * Use `concurrency` to control parallelism and `discard: true` to ignore results.
5175
5212
  *
5176
- * @example
5213
+ * **Example** (Usage)
5214
+ *
5177
5215
  * ```ts
5178
5216
  * import { Console, Effect } from "effect"
5179
5217
  *
@@ -5183,27 +5221,24 @@ export const replicate = internal.replicate;
5183
5221
  * })
5184
5222
  * ```
5185
5223
  *
5186
- * @since 2.0.0
5187
5224
  * @category Collecting
5225
+ * @since 2.0.0
5188
5226
  */
5189
5227
  export const replicateEffect = internal.replicateEffect;
5190
5228
  /**
5191
- * Repeats an effect based on a specified schedule.
5229
+ * Runs an effect repeatedly according to a schedule and returns the schedule's
5230
+ * final output.
5192
5231
  *
5193
5232
  * **Details**
5194
5233
  *
5195
- * This function allows you to execute an effect repeatedly according to a given
5196
- * schedule. The schedule determines the timing and number of repetitions. Each
5197
- * repetition can also depend on the decision of the schedule, providing
5198
- * flexibility for complex workflows. This function does not modify the effect's
5199
- * success or failure; it only controls its repetition.
5234
+ * The schedule is first stepped with `undefined`. After each successful
5235
+ * execution, the effect's success value is fed to the schedule to decide
5236
+ * whether to run again. The returned effect fails if the effect or schedule
5237
+ * fails, and otherwise succeeds with the schedule output when the schedule
5238
+ * completes.
5200
5239
  *
5201
- * For example, you can use a schedule that recurs a specific number of times,
5202
- * adds delays between repetitions, or customizes repetition behavior based on
5203
- * external inputs. The effect runs initially and is repeated according to the
5204
- * schedule.
5240
+ * **Example** (Usage)
5205
5241
  *
5206
- * @example
5207
5242
  * ```ts
5208
5243
  * import { Console, Effect, Schedule } from "effect"
5209
5244
  *
@@ -5229,26 +5264,24 @@ export const replicateEffect = internal.replicateEffect;
5229
5264
  * @see {@link scheduleFrom} for a variant that allows the schedule's decision
5230
5265
  * to depend on the result of this effect.
5231
5266
  *
5232
- * @since 2.0.0
5233
5267
  * @category Repetition / Recursion
5268
+ * @since 2.0.0
5234
5269
  */
5235
5270
  export const schedule = /*#__PURE__*/dual(2, (self, schedule) => scheduleFrom(self, undefined, schedule));
5236
5271
  /**
5237
- * Runs an effect repeatedly according to a schedule, starting from a specified
5238
- * initial input value.
5272
+ * Runs an effect repeatedly according to a schedule that is initialized with a
5273
+ * specific schedule input.
5239
5274
  *
5240
5275
  * **Details**
5241
5276
  *
5242
- * This function allows you to repeatedly execute an effect based on a schedule.
5243
- * The schedule starts with the given `initial` input value, which is passed to
5244
- * the first execution. Subsequent executions of the effect are controlled by
5245
- * the schedule's rules, using the output of the previous iteration as the input
5246
- * for the next one.
5277
+ * `initial` is passed to the schedule before the first execution, not to the
5278
+ * effect itself. After each successful execution, the effect's success value is
5279
+ * fed back into the schedule to decide whether to continue. The returned effect
5280
+ * succeeds with the schedule output when the schedule completes and fails if
5281
+ * the effect or schedule fails.
5247
5282
  *
5248
- * The returned effect will complete when the schedule ends or the effect fails,
5249
- * propagating the error.
5283
+ * **Example** (Usage)
5250
5284
  *
5251
- * @example
5252
5285
  * ```ts
5253
5286
  * import { Console, Effect, Schedule } from "effect"
5254
5287
  *
@@ -5269,8 +5302,8 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => scheduleFrom(se
5269
5302
  * // Returns the schedule count
5270
5303
  * ```
5271
5304
  *
5272
- * @since 2.0.0
5273
5305
  * @category Repetition / Recursion
5306
+ * @since 2.0.0
5274
5307
  */
5275
5308
  export const scheduleFrom = internalSchedule.scheduleFrom;
5276
5309
  // -----------------------------------------------------------------------------
@@ -5279,7 +5312,8 @@ export const scheduleFrom = internalSchedule.scheduleFrom;
5279
5312
  /**
5280
5313
  * Returns the current tracer from the context.
5281
5314
  *
5282
- * @example
5315
+ * **Example** (Usage)
5316
+ *
5283
5317
  * ```ts
5284
5318
  * import { Effect } from "effect"
5285
5319
  *
@@ -5290,14 +5324,15 @@ export const scheduleFrom = internalSchedule.scheduleFrom;
5290
5324
  * })
5291
5325
  * ```
5292
5326
  *
5293
- * @since 2.0.0
5294
5327
  * @category Tracing
5328
+ * @since 2.0.0
5295
5329
  */
5296
5330
  export const tracer = internal.tracer;
5297
5331
  /**
5298
5332
  * Provides a tracer to an effect.
5299
5333
  *
5300
- * @example
5334
+ * **Example** (Usage)
5335
+ *
5301
5336
  * ```ts
5302
5337
  * import { Effect } from "effect"
5303
5338
  *
@@ -5310,14 +5345,20 @@ export const tracer = internal.tracer;
5310
5345
  * // const traced = Effect.withTracer(program, customTracer)
5311
5346
  * ```
5312
5347
  *
5313
- * @since 2.0.0
5314
5348
  * @category Tracing
5349
+ * @since 2.0.0
5315
5350
  */
5316
5351
  export const withTracer = internal.withTracer;
5317
5352
  /**
5318
- * Disable the tracer for the given Effect.
5353
+ * Enables or disables tracing for spans created by the given effect.
5354
+ *
5355
+ * **Details**
5356
+ *
5357
+ * When `enabled` is `false`, spans created inside the effect are not registered
5358
+ * with the current tracer and do not propagate as normal trace parents.
5359
+ *
5360
+ * **Example** (Usage)
5319
5361
  *
5320
- * @example
5321
5362
  * ```ts
5322
5363
  * import { Effect } from "effect"
5323
5364
  *
@@ -5328,14 +5369,15 @@ export const withTracer = internal.withTracer;
5328
5369
  * )
5329
5370
  * ```
5330
5371
  *
5331
- * @since 2.0.0
5332
5372
  * @category Tracing
5373
+ * @since 2.0.0
5333
5374
  */
5334
5375
  export const withTracerEnabled = internal.withTracerEnabled;
5335
5376
  /**
5336
5377
  * Enables or disables tracer timing for the given Effect.
5337
5378
  *
5338
- * @example
5379
+ * **Example** (Usage)
5380
+ *
5339
5381
  * ```ts
5340
5382
  * import { Effect } from "effect"
5341
5383
  *
@@ -5346,14 +5388,15 @@ export const withTracerEnabled = internal.withTracerEnabled;
5346
5388
  * )
5347
5389
  * ```
5348
5390
  *
5349
- * @since 2.0.0
5350
5391
  * @category Tracing
5392
+ * @since 2.0.0
5351
5393
  */
5352
5394
  export const withTracerTiming = internal.withTracerTiming;
5353
5395
  /**
5354
5396
  * Adds an annotation to each span in this effect.
5355
5397
  *
5356
- * @example
5398
+ * **Example** (Usage)
5399
+ *
5357
5400
  * ```ts
5358
5401
  * import { Effect } from "effect"
5359
5402
  *
@@ -5373,14 +5416,15 @@ export const withTracerTiming = internal.withTracerTiming;
5373
5416
  * })
5374
5417
  * ```
5375
5418
  *
5376
- * @since 2.0.0
5377
5419
  * @category Tracing
5420
+ * @since 2.0.0
5378
5421
  */
5379
5422
  export const annotateSpans = internal.annotateSpans;
5380
5423
  /**
5381
5424
  * Adds an annotation to the current span if available.
5382
5425
  *
5383
- * @example
5426
+ * **Example** (Usage)
5427
+ *
5384
5428
  * ```ts
5385
5429
  * import { Effect } from "effect"
5386
5430
  *
@@ -5397,14 +5441,20 @@ export const annotateSpans = internal.annotateSpans;
5397
5441
  * const traced = Effect.withSpan(program, "user-operation")
5398
5442
  * ```
5399
5443
  *
5400
- * @since 2.0.0
5401
5444
  * @category Tracing
5445
+ * @since 2.0.0
5402
5446
  */
5403
5447
  export const annotateCurrentSpan = internal.annotateCurrentSpan;
5404
5448
  /**
5405
- * Returns the current span from the context.
5449
+ * Returns the currently active local tracing span.
5450
+ *
5451
+ * **Details**
5452
+ *
5453
+ * The effect fails with `NoSuchElementError` when there is no active local
5454
+ * `Span`.
5455
+ *
5456
+ * **Example** (Usage)
5406
5457
  *
5407
- * @example
5408
5458
  * ```ts
5409
5459
  * import { Effect } from "effect"
5410
5460
  *
@@ -5417,14 +5467,21 @@ export const annotateCurrentSpan = internal.annotateCurrentSpan;
5417
5467
  * const traced = Effect.withSpan(program, "my-span")
5418
5468
  * ```
5419
5469
  *
5420
- * @since 2.0.0
5421
5470
  * @category Tracing
5471
+ * @since 2.0.0
5422
5472
  */
5423
5473
  export const currentSpan = internal.currentSpan;
5424
5474
  /**
5425
- * Returns the current parent span from the context.
5475
+ * Returns the current parent span from the effect context.
5476
+ *
5477
+ * **Details**
5478
+ *
5479
+ * The effect succeeds with either a local span or external span when one is
5480
+ * present, and fails with `NoSuchElementError` when no parent span is
5481
+ * available.
5482
+ *
5483
+ * **Example** (Usage)
5426
5484
  *
5427
- * @example
5428
5485
  * ```ts
5429
5486
  * import { Effect } from "effect"
5430
5487
  *
@@ -5442,14 +5499,20 @@ export const currentSpan = internal.currentSpan;
5442
5499
  * const traced = Effect.withSpan(program, "parent-span")
5443
5500
  * ```
5444
5501
  *
5445
- * @since 2.0.0
5446
5502
  * @category Tracing
5503
+ * @since 2.0.0
5447
5504
  */
5448
5505
  export const currentParentSpan = internal.currentParentSpan;
5449
5506
  /**
5450
- * Returns the annotations of the current span.
5507
+ * Returns the tracing span annotations currently carried in the effect context.
5508
+ *
5509
+ * **Details**
5510
+ *
5511
+ * These annotations are applied to spans created inside the context, such as
5512
+ * spans created by `withSpan`, `useSpan`, or `makeSpan`.
5513
+ *
5514
+ * **Example** (Usage)
5451
5515
  *
5452
- * @example
5453
5516
  * ```ts
5454
5517
  * import { Effect } from "effect"
5455
5518
  *
@@ -5469,18 +5532,20 @@ export const currentParentSpan = internal.currentParentSpan;
5469
5532
  * // Output: Current span annotations: { userId: "123", operation: "data-processing" }
5470
5533
  * ```
5471
5534
  *
5472
- * @since 2.0.0
5473
5535
  * @category Tracing
5536
+ * @since 2.0.0
5474
5537
  */
5475
5538
  export const spanAnnotations = internal.spanAnnotations;
5476
5539
  /**
5477
- * Retrieves the span links associated with the current span.
5540
+ * Returns the tracing span links currently carried in the effect context.
5541
+ *
5542
+ * **Details**
5543
+ *
5544
+ * These links are attached to spans created inside the context. Span links
5545
+ * connect related spans without making one span the parent of another.
5478
5546
  *
5479
- * Span links are connections between spans that are related but not in a
5480
- * parent-child relationship. They are useful for linking spans across different
5481
- * traces or connecting spans from parallel operations.
5547
+ * **Example** (Usage)
5482
5548
  *
5483
- * @example
5484
5549
  * ```ts
5485
5550
  * import { Effect } from "effect"
5486
5551
  *
@@ -5492,8 +5557,8 @@ export const spanAnnotations = internal.spanAnnotations;
5492
5557
  * })
5493
5558
  * ```
5494
5559
  *
5495
- * @since 2.0.0
5496
5560
  * @category Tracing
5561
+ * @since 2.0.0
5497
5562
  */
5498
5563
  export const spanLinks = internal.spanLinks;
5499
5564
  /**
@@ -5503,7 +5568,8 @@ export const spanLinks = internal.spanLinks;
5503
5568
  * parent-child relationship. For example, you might want to link spans from
5504
5569
  * parallel operations or connect spans across different traces.
5505
5570
  *
5506
- * @example
5571
+ * **Example** (Usage)
5572
+ *
5507
5573
  * ```ts
5508
5574
  * import { Effect } from "effect"
5509
5575
  *
@@ -5525,7 +5591,8 @@ export const spanLinks = internal.spanLinks;
5525
5591
  * })
5526
5592
  * ```
5527
5593
  *
5528
- * @example
5594
+ * **Example** (Usage)
5595
+ *
5529
5596
  * ```ts
5530
5597
  * import { Effect } from "effect"
5531
5598
  *
@@ -5543,14 +5610,21 @@ export const spanLinks = internal.spanLinks;
5543
5610
  * })
5544
5611
  * ```
5545
5612
  *
5546
- * @since 2.0.0
5547
5613
  * @category Tracing
5614
+ * @since 2.0.0
5548
5615
  */
5549
5616
  export const linkSpans = internal.linkSpans;
5550
5617
  /**
5551
- * Create a new span for tracing.
5618
+ * Creates a new tracing span and returns it without managing its lifetime.
5619
+ *
5620
+ * **Details**
5621
+ *
5622
+ * The span is not added to the current span stack and is not ended
5623
+ * automatically. Use `withSpan`, `useSpan`, or `makeSpanScoped` when the span
5624
+ * should be installed as context or closed automatically.
5625
+ *
5626
+ * **Example** (Usage)
5552
5627
  *
5553
- * @example
5554
5628
  * ```ts
5555
5629
  * import { Effect } from "effect"
5556
5630
  *
@@ -5561,8 +5635,8 @@ export const linkSpans = internal.linkSpans;
5561
5635
  * })
5562
5636
  * ```
5563
5637
  *
5564
- * @since 2.0.0
5565
5638
  * @category Tracing
5639
+ * @since 2.0.0
5566
5640
  */
5567
5641
  export const makeSpan = internal.makeSpan;
5568
5642
  /**
@@ -5572,7 +5646,8 @@ export const makeSpan = internal.makeSpan;
5572
5646
  * The span is not added to the current span stack, so no child spans will be
5573
5647
  * created for it.
5574
5648
  *
5575
- * @example
5649
+ * **Example** (Usage)
5650
+ *
5576
5651
  * ```ts
5577
5652
  * import { Effect } from "effect"
5578
5653
  *
@@ -5586,8 +5661,8 @@ export const makeSpan = internal.makeSpan;
5586
5661
  * )
5587
5662
  * ```
5588
5663
  *
5589
- * @since 2.0.0
5590
5664
  * @category Tracing
5665
+ * @since 2.0.0
5591
5666
  */
5592
5667
  export const makeSpanScoped = internal.makeSpanScoped;
5593
5668
  /**
@@ -5597,7 +5672,8 @@ export const makeSpanScoped = internal.makeSpanScoped;
5597
5672
  * The span is not added to the current span stack, so no child spans will be
5598
5673
  * created for it.
5599
5674
  *
5600
- * @example
5675
+ * **Example** (Usage)
5676
+ *
5601
5677
  * ```ts
5602
5678
  * import { Effect } from "effect"
5603
5679
  *
@@ -5611,14 +5687,15 @@ export const makeSpanScoped = internal.makeSpanScoped;
5611
5687
  * )
5612
5688
  * ```
5613
5689
  *
5614
- * @since 2.0.0
5615
5690
  * @category Tracing
5691
+ * @since 2.0.0
5616
5692
  */
5617
5693
  export const useSpan = internal.useSpan;
5618
5694
  /**
5619
5695
  * Wraps the effect with a new span for tracing.
5620
5696
  *
5621
- * @example
5697
+ * **Example** (Usage)
5698
+ *
5622
5699
  * ```ts
5623
5700
  * import { Effect } from "effect"
5624
5701
  *
@@ -5632,8 +5709,8 @@ export const useSpan = internal.useSpan;
5632
5709
  * })
5633
5710
  * ```
5634
5711
  *
5635
- * @since 2.0.0
5636
5712
  * @category Tracing
5713
+ * @since 2.0.0
5637
5714
  */
5638
5715
  export const withSpan = internal.withSpan;
5639
5716
  /**
@@ -5641,7 +5718,8 @@ export const withSpan = internal.withSpan;
5641
5718
  *
5642
5719
  * The span is ended when the Scope is finalized.
5643
5720
  *
5644
- * @example
5721
+ * **Example** (Usage)
5722
+ *
5645
5723
  * ```ts
5646
5724
  * import { Effect } from "effect"
5647
5725
  *
@@ -5654,14 +5732,15 @@ export const withSpan = internal.withSpan;
5654
5732
  * )
5655
5733
  * ```
5656
5734
  *
5657
- * @since 2.0.0
5658
5735
  * @category Tracing
5736
+ * @since 2.0.0
5659
5737
  */
5660
5738
  export const withSpanScoped = internal.withSpanScoped;
5661
5739
  /**
5662
5740
  * Adds the provided span to the current span stack.
5663
5741
  *
5664
- * @example
5742
+ * **Example** (Usage)
5743
+ *
5665
5744
  * ```ts
5666
5745
  * import { Effect } from "effect"
5667
5746
  *
@@ -5673,8 +5752,8 @@ export const withSpanScoped = internal.withSpanScoped;
5673
5752
  * })
5674
5753
  * ```
5675
5754
  *
5676
- * @since 2.0.0
5677
5755
  * @category Tracing
5756
+ * @since 2.0.0
5678
5757
  */
5679
5758
  export const withParentSpan = internal.withParentSpan;
5680
5759
  // -----------------------------------------------------------------------------
@@ -5683,10 +5762,11 @@ export const withParentSpan = internal.withParentSpan;
5683
5762
  /**
5684
5763
  * Executes a request using the provided resolver.
5685
5764
  *
5686
- * @since 2.0.0
5687
5765
  * @category Requests & Batching
5766
+ * @since 2.0.0
5767
+ *
5768
+ * **Example** (Usage)
5688
5769
  *
5689
- * @example
5690
5770
  * ```ts
5691
5771
  * import { Console, Effect, Exit, Request, RequestResolver } from "effect"
5692
5772
  *
@@ -5717,8 +5797,8 @@ export const request = internalRequest.request;
5717
5797
  *
5718
5798
  * It returns a canceler that removes the pending request entry.
5719
5799
  *
5720
- * @since 4.0.0
5721
5800
  * @category Requests & Batching
5801
+ * @since 4.0.0
5722
5802
  */
5723
5803
  export const requestUnsafe = internalRequest.requestUnsafe;
5724
5804
  // -----------------------------------------------------------------------------
@@ -5745,7 +5825,8 @@ export const requestUnsafe = internalRequest.requestUnsafe;
5745
5825
  * fibers leak. This behavior is called "auto supervision", and if this
5746
5826
  * behavior is not desired, you may use the `forkDetach` or `forkIn` methods.
5747
5827
  *
5748
- * @example
5828
+ * **Example** (Usage)
5829
+ *
5749
5830
  * ```ts
5750
5831
  * import { Effect, Fiber } from "effect"
5751
5832
  *
@@ -5767,15 +5848,16 @@ export const requestUnsafe = internalRequest.requestUnsafe;
5767
5848
  * })
5768
5849
  * ```
5769
5850
  *
5770
- * @since 4.0.0
5771
5851
  * @category Supervision & Fibers
5852
+ * @since 4.0.0
5772
5853
  */
5773
5854
  export const forkChild = internal.forkChild;
5774
5855
  /**
5775
5856
  * Forks the effect in the specified scope. The fiber will be interrupted
5776
5857
  * when the scope is closed.
5777
5858
  *
5778
- * @example
5859
+ * **Example** (Usage)
5860
+ *
5779
5861
  * ```ts
5780
5862
  * import { Effect } from "effect"
5781
5863
  *
@@ -5795,14 +5877,15 @@ export const forkChild = internal.forkChild;
5795
5877
  * )
5796
5878
  * ```
5797
5879
  *
5798
- * @since 2.0.0
5799
5880
  * @category Supervision & Fibers
5881
+ * @since 2.0.0
5800
5882
  */
5801
5883
  export const forkIn = internal.forkIn;
5802
5884
  /**
5803
5885
  * Forks the fiber in a `Scope`, interrupting it when the scope is closed.
5804
5886
  *
5805
- * @example
5887
+ * **Example** (Usage)
5888
+ *
5806
5889
  * ```ts
5807
5890
  * import { Effect } from "effect"
5808
5891
  *
@@ -5828,8 +5911,8 @@ export const forkIn = internal.forkIn;
5828
5911
  * )
5829
5912
  * ```
5830
5913
  *
5831
- * @since 2.0.0
5832
5914
  * @category Supervision & Fibers
5915
+ * @since 2.0.0
5833
5916
  */
5834
5917
  export const forkScoped = internal.forkScoped;
5835
5918
  /**
@@ -5837,7 +5920,8 @@ export const forkScoped = internal.forkScoped;
5837
5920
  * new fiber is attached to the global scope, when the fiber executing the
5838
5921
  * returned effect terminates, the forked fiber will continue running.
5839
5922
  *
5840
- * @example
5923
+ * **Example** (Usage)
5924
+ *
5841
5925
  * ```ts
5842
5926
  * import { Effect } from "effect"
5843
5927
  *
@@ -5861,22 +5945,23 @@ export const forkScoped = internal.forkScoped;
5861
5945
  * })
5862
5946
  * ```
5863
5947
  *
5864
- * @since 2.0.0
5865
5948
  * @category Supervision & Fibers
5949
+ * @since 2.0.0
5866
5950
  */
5867
5951
  export const forkDetach = internal.forkDetach;
5868
5952
  /**
5869
5953
  * Waits for all child fibers forked by this effect to complete before this
5870
5954
  * effect completes.
5871
5955
  *
5872
- * @since 2.0.0
5873
5956
  * @category Supervision & Fibers
5957
+ * @since 2.0.0
5874
5958
  */
5875
5959
  export const awaitAllChildren = internal.awaitAllChildren;
5876
5960
  /**
5877
5961
  * Access the fiber currently executing the effect.
5878
5962
  *
5879
- * @example
5963
+ * **Example** (Usage)
5964
+ *
5880
5965
  * ```ts
5881
5966
  * import { Console, Effect } from "effect"
5882
5967
  *
@@ -5886,14 +5971,15 @@ export const awaitAllChildren = internal.awaitAllChildren;
5886
5971
  * })
5887
5972
  * ```
5888
5973
  *
5889
- * @since 4.0.0
5890
5974
  * @category Supervision & Fibers
5975
+ * @since 4.0.0
5891
5976
  */
5892
5977
  export const fiber = internal.fiber;
5893
5978
  /**
5894
5979
  * Access the current fiber id executing the effect.
5895
5980
  *
5896
- * @example
5981
+ * **Example** (Usage)
5982
+ *
5897
5983
  * ```ts
5898
5984
  * import { Effect } from "effect"
5899
5985
  *
@@ -5908,8 +5994,8 @@ export const fiber = internal.fiber;
5908
5994
  * )
5909
5995
  * ```
5910
5996
  *
5911
- * @since 4.0.0
5912
5997
  * @category Supervision & Fibers
5998
+ * @since 4.0.0
5913
5999
  */
5914
6000
  export const fiberId = internal.fiberId;
5915
6001
  /**
@@ -5925,9 +6011,9 @@ export const fiberId = internal.fiberId;
5925
6011
  * Unless you specifically need a `Promise` or synchronous operation,
5926
6012
  * `runFork` is a good default choice.
5927
6013
  *
5928
- * @example
6014
+ * **Example** (Running an Effect in the Background)
6015
+ *
5929
6016
  * ```ts
5930
- * // Title: Running an Effect in the Background
5931
6017
  * import { Effect } from "effect"
5932
6018
  * import { Schedule } from "effect"
5933
6019
  * import { Fiber } from "effect"
@@ -5949,14 +6035,15 @@ export const fiberId = internal.fiberId;
5949
6035
  * }, 500)
5950
6036
  * ```
5951
6037
  *
5952
- * @since 2.0.0
5953
6038
  * @category Running Effects
6039
+ * @since 2.0.0
5954
6040
  */
5955
6041
  export const runFork = internal.runFork;
5956
6042
  /**
5957
6043
  * Runs an effect in the background with the provided services.
5958
6044
  *
5959
- * @example
6045
+ * **Example** (Usage)
6046
+ *
5960
6047
  * ```ts
5961
6048
  * import { Effect, Context } from "effect"
5962
6049
  *
@@ -5979,8 +6066,8 @@ export const runFork = internal.runFork;
5979
6066
  * const fiber = Effect.runForkWith(services)(program)
5980
6067
  * ```
5981
6068
  *
5982
- * @since 4.0.0
5983
6069
  * @category Running Effects
6070
+ * @since 4.0.0
5984
6071
  */
5985
6072
  export const runForkWith = internal.runForkWith;
5986
6073
  /**
@@ -5988,7 +6075,8 @@ export const runForkWith = internal.runForkWith;
5988
6075
  *
5989
6076
  * The returned interruptor calls `fiber.interruptUnsafe`, optionally with an interruptor id.
5990
6077
  *
5991
- * @example
6078
+ * **Example** (Usage)
6079
+ *
5992
6080
  * ```ts
5993
6081
  * import { Console, Effect, Exit, Context } from "effect"
5994
6082
  *
@@ -6020,8 +6108,8 @@ export const runForkWith = internal.runForkWith;
6020
6108
  * interrupt()
6021
6109
  * ```
6022
6110
  *
6023
- * @since 4.0.0
6024
6111
  * @category Running Effects
6112
+ * @since 4.0.0
6025
6113
  */
6026
6114
  export const runCallbackWith = internal.runCallbackWith;
6027
6115
  /**
@@ -6031,7 +6119,8 @@ export const runCallbackWith = internal.runCallbackWith;
6031
6119
  * The interruptor calls `fiber.interruptUnsafe` with the optional interruptor
6032
6120
  * id.
6033
6121
  *
6034
- * @example
6122
+ * **Example** (Usage)
6123
+ *
6035
6124
  * ```ts
6036
6125
  * import { Console, Effect, Exit } from "effect"
6037
6126
  *
@@ -6058,8 +6147,8 @@ export const runCallbackWith = internal.runCallbackWith;
6058
6147
  * // interrupt() to cancel the fiber if needed
6059
6148
  * ```
6060
6149
  *
6061
- * @since 4.0.0
6062
6150
  * @category Running Effects
6151
+ * @since 4.0.0
6063
6152
  */
6064
6153
  export const runCallback = internal.runCallback;
6065
6154
  /**
@@ -6076,31 +6165,35 @@ export const runCallback = internal.runCallback;
6076
6165
  *
6077
6166
  * @see {@link runPromiseExit} for a version that returns an `Exit` type instead of rejecting.
6078
6167
  *
6079
- * @example
6168
+ * **Example** (Running a Successful Effect as a Promise)
6169
+ *
6080
6170
  * ```ts
6081
- * // Title: Running a Successful Effect as a Promise
6082
6171
  * import { Effect } from "effect"
6083
6172
  *
6084
6173
  * Effect.runPromise(Effect.succeed(1)).then(console.log)
6085
6174
  * // Output: 1
6086
6175
  * ```
6087
6176
  *
6088
- * @example
6177
+ * **Example** (Usage)
6178
+ *
6179
+ * ```ts
6089
6180
  * //Example: Handling a Failing Effect as a Rejected Promise
6090
6181
  * import { Effect } from "effect"
6091
6182
  *
6092
6183
  * Effect.runPromise(Effect.fail("my error")).catch(console.error)
6093
6184
  * // Output:
6094
6185
  * // (FiberFailure) Error: my error
6186
+ * ```
6095
6187
  *
6096
- * @since 2.0.0
6097
6188
  * @category Running Effects
6189
+ * @since 2.0.0
6098
6190
  */
6099
6191
  export const runPromise = internal.runPromise;
6100
6192
  /**
6101
6193
  * Executes an effect as a Promise with the provided services.
6102
6194
  *
6103
- * @example
6195
+ * **Example** (Usage)
6196
+ *
6104
6197
  * ```ts
6105
6198
  * import { Effect, Context } from "effect"
6106
6199
  *
@@ -6122,8 +6215,8 @@ export const runPromise = internal.runPromise;
6122
6215
  * Effect.runPromiseWith(context)(program).then(console.log)
6123
6216
  * ```
6124
6217
  *
6125
- * @since 4.0.0
6126
6218
  * @category Running Effects
6219
+ * @since 4.0.0
6127
6220
  */
6128
6221
  export const runPromiseWith = internal.runPromiseWith;
6129
6222
  /**
@@ -6142,9 +6235,9 @@ export const runPromiseWith = internal.runPromiseWith;
6142
6235
  * - If it fails, the failure information is provided as a `Failure` containing
6143
6236
  * a `Cause` type.
6144
6237
  *
6145
- * @example
6238
+ * **Example** (Handling Results as Exit)
6239
+ *
6146
6240
  * ```ts
6147
- * // Title: Handling Results as Exit
6148
6241
  * import { Effect } from "effect"
6149
6242
  *
6150
6243
  * // Execute a successful effect and get the Exit result as a Promise
@@ -6170,14 +6263,15 @@ export const runPromiseWith = internal.runPromiseWith;
6170
6263
  * // }
6171
6264
  * ```
6172
6265
  *
6173
- * @since 2.0.0
6174
6266
  * @category Running Effects
6267
+ * @since 2.0.0
6175
6268
  */
6176
6269
  export const runPromiseExit = internal.runPromiseExit;
6177
6270
  /**
6178
6271
  * Runs an effect and returns a Promise of Exit with provided services.
6179
6272
  *
6180
- * @example
6273
+ * **Example** (Usage)
6274
+ *
6181
6275
  * ```ts
6182
6276
  * import { Effect, Exit, Context } from "effect"
6183
6277
  *
@@ -6203,28 +6297,29 @@ export const runPromiseExit = internal.runPromiseExit;
6203
6297
  * })
6204
6298
  * ```
6205
6299
  *
6206
- * @since 4.0.0
6207
6300
  * @category Running Effects
6301
+ * @since 4.0.0
6208
6302
  */
6209
6303
  export const runPromiseExitWith = internal.runPromiseExitWith;
6210
6304
  /**
6211
- * Executes an effect synchronously, running it immediately and returning the
6212
- * result.
6305
+ * Executes an effect synchronously and returns its success value.
6213
6306
  *
6214
6307
  * **When to Use**
6215
6308
  *
6216
- * Use `runSync` to run an effect that does not fail and does not include
6217
- * any asynchronous operations.
6309
+ * Use `runSync` only for effects that can complete synchronously.
6310
+ *
6311
+ * **Details**
6218
6312
  *
6219
- * If the effect fails or involves asynchronous work, it will throw an error,
6220
- * and execution will stop where the failure or async operation occurs.
6313
+ * If the effect fails, dies, is interrupted, or performs asynchronous work,
6314
+ * `runSync` throws a `FiberFailure` instead of returning a value. Use
6315
+ * `runSyncExit` when you want the failure captured as an `Exit`.
6221
6316
  *
6222
6317
  * @see {@link runSyncExit} for a version that returns an `Exit` type instead of
6223
6318
  * throwing an error.
6224
6319
  *
6225
- * @example
6320
+ * **Example** (Synchronous Logging)
6321
+ *
6226
6322
  * ```ts
6227
- * // Title: Synchronous Logging
6228
6323
  * import { Effect } from "effect"
6229
6324
  *
6230
6325
  * const program = Effect.sync(() => {
@@ -6239,8 +6334,9 @@ export const runPromiseExitWith = internal.runPromiseExitWith;
6239
6334
  * // Output: 1
6240
6335
  * ```
6241
6336
  *
6242
- * @example
6243
- * // Title: Incorrect Usage with Failing or Async Effects
6337
+ * **Example** (Incorrect Usage with Failing or Async Effects)
6338
+ *
6339
+ * ```ts
6244
6340
  * import { Effect } from "effect"
6245
6341
  *
6246
6342
  * try {
@@ -6260,15 +6356,17 @@ export const runPromiseExitWith = internal.runPromiseExitWith;
6260
6356
  * }
6261
6357
  * // Output:
6262
6358
  * // (FiberFailure) AsyncFiberException: Fiber #0 cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work
6359
+ * ```
6263
6360
  *
6264
- * @since 2.0.0
6265
6361
  * @category Running Effects
6362
+ * @since 2.0.0
6266
6363
  */
6267
6364
  export const runSync = internal.runSync;
6268
6365
  /**
6269
6366
  * Executes an effect synchronously with provided services.
6270
6367
  *
6271
- * @example
6368
+ * **Example** (Usage)
6369
+ *
6272
6370
  * ```ts
6273
6371
  * import { Effect, Context } from "effect"
6274
6372
  *
@@ -6291,8 +6389,8 @@ export const runSync = internal.runSync;
6291
6389
  * console.log(result) // 5
6292
6390
  * ```
6293
6391
  *
6294
- * @since 4.0.0
6295
6392
  * @category Running Effects
6393
+ * @since 4.0.0
6296
6394
  */
6297
6395
  export const runSyncWith = internal.runSyncWith;
6298
6396
  /**
@@ -6315,9 +6413,9 @@ export const runSyncWith = internal.runSyncWith;
6315
6413
  * return an `Failure` with a `Die` cause, indicating that the effect cannot be
6316
6414
  * resolved synchronously.
6317
6415
  *
6318
- * @example
6416
+ * **Example** (Handling Results as Exit)
6417
+ *
6319
6418
  * ```ts
6320
- * // Title: Handling Results as Exit
6321
6419
  * import { Effect } from "effect"
6322
6420
  *
6323
6421
  * console.log(Effect.runSyncExit(Effect.succeed(1)))
@@ -6341,8 +6439,9 @@ export const runSyncWith = internal.runSyncWith;
6341
6439
  * // }
6342
6440
  * ```
6343
6441
  *
6344
- * @example
6345
- * // Title: Asynchronous Operation Resulting in Die
6442
+ * **Example** (Asynchronous Operation Resulting in Die)
6443
+ *
6444
+ * ```ts
6346
6445
  * import { Effect } from "effect"
6347
6446
  *
6348
6447
  * console.log(Effect.runSyncExit(Effect.promise(() => Promise.resolve(1))))
@@ -6360,15 +6459,17 @@ export const runSyncWith = internal.runSyncWith;
6360
6459
  * // }
6361
6460
  * // }
6362
6461
  * // }
6462
+ * ```
6363
6463
  *
6364
- * @since 2.0.0
6365
6464
  * @category Running Effects
6465
+ * @since 2.0.0
6366
6466
  */
6367
6467
  export const runSyncExit = internal.runSyncExit;
6368
6468
  /**
6369
6469
  * Runs an effect synchronously with provided services, returning an Exit result.
6370
6470
  *
6371
- * @example
6471
+ * **Example** (Usage)
6472
+ *
6372
6473
  * ```ts
6373
6474
  * import { Effect, Exit, Context } from "effect"
6374
6475
  *
@@ -6400,8 +6501,8 @@ export const runSyncExit = internal.runSyncExit;
6400
6501
  * // Success: 42
6401
6502
  * ```
6402
6503
  *
6403
- * @since 4.0.0
6404
6504
  * @category Running Effects
6505
+ * @since 4.0.0
6405
6506
  */
6406
6507
  export const runSyncExitWith = internal.runSyncExitWith;
6407
6508
  /**
@@ -6409,7 +6510,8 @@ export const runSyncExitWith = internal.runSyncExitWith;
6409
6510
  *
6410
6511
  * `Effect.fnUntraced` also acts as a `pipe` function, so you can append transforms after the body.
6411
6512
  *
6412
- * @example
6513
+ * **Example** (Usage)
6514
+ *
6413
6515
  * ```ts
6414
6516
  * import { Console, Effect } from "effect"
6415
6517
  *
@@ -6421,8 +6523,8 @@ export const runSyncExitWith = internal.runSyncExitWith;
6421
6523
  * Effect.runFork(greet("Ada"))
6422
6524
  * ```
6423
6525
  *
6424
- * @since 3.12.0
6425
6526
  * @category Function
6527
+ * @since 3.12.0
6426
6528
  */
6427
6529
  export const fnUntraced = internal.fnUntraced;
6428
6530
  /**
@@ -6430,7 +6532,8 @@ export const fnUntraced = internal.fnUntraced;
6430
6532
  *
6431
6533
  * Pipeable functions run after the body and can transform the resulting Effect.
6432
6534
  *
6433
- * @example
6535
+ * **Example** (Usage)
6536
+ *
6434
6537
  * ```ts
6435
6538
  * import { Console, Effect } from "effect"
6436
6539
  *
@@ -6449,8 +6552,8 @@ export const fnUntraced = internal.fnUntraced;
6449
6552
  * })
6450
6553
  * ```
6451
6554
  *
6452
- * @since 3.12.0
6453
6555
  * @category Function
6556
+ * @since 3.12.0
6454
6557
  */
6455
6558
  export const fn = internal.fn;
6456
6559
  // ========================================================================
@@ -6460,7 +6563,8 @@ export const fn = internal.fn;
6460
6563
  * Retrieves the `Clock` service from the context and provides it to the
6461
6564
  * specified effectful function.
6462
6565
  *
6463
- * @example
6566
+ * **Example** (Usage)
6567
+ *
6464
6568
  * ```ts
6465
6569
  * import { Console, Effect } from "effect"
6466
6570
  *
@@ -6476,8 +6580,8 @@ export const fn = internal.fn;
6476
6580
  * // Current time is: 1735484929744
6477
6581
  * ```
6478
6582
  *
6479
- * @since 2.0.0
6480
6583
  * @category Clock
6584
+ * @since 2.0.0
6481
6585
  */
6482
6586
  export const clockWith = internal.clockWith;
6483
6587
  // ========================================================================
@@ -6489,7 +6593,8 @@ export const clockWith = internal.clockWith;
6489
6593
  * If no level is provided, the logger uses the fiber's current log level and
6490
6594
  * extracts any `Cause` values from the message list.
6491
6595
  *
6492
- * @example
6596
+ * **Example** (Usage)
6597
+ *
6493
6598
  * ```ts
6494
6599
  * import { Effect } from "effect"
6495
6600
  *
@@ -6500,14 +6605,15 @@ export const clockWith = internal.clockWith;
6500
6605
  * })
6501
6606
  * ```
6502
6607
  *
6503
- * @since 2.0.0
6504
6608
  * @category Logging
6609
+ * @since 2.0.0
6505
6610
  */
6506
6611
  export const logWithLevel = internal.logWithLevel;
6507
6612
  /**
6508
6613
  * Logs one or more messages using the default log level.
6509
6614
  *
6510
- * @example
6615
+ * **Example** (Usage)
6616
+ *
6511
6617
  * ```ts
6512
6618
  * import { Effect } from "effect"
6513
6619
  *
@@ -6527,14 +6633,15 @@ export const logWithLevel = internal.logWithLevel;
6527
6633
  * // 4
6528
6634
  * ```
6529
6635
  *
6530
- * @since 2.0.0
6531
6636
  * @category Logging
6637
+ * @since 2.0.0
6532
6638
  */
6533
6639
  export const log = /*#__PURE__*/internal.logWithLevel();
6534
6640
  /**
6535
6641
  * Logs one or more messages at the FATAL level.
6536
6642
  *
6537
- * @example
6643
+ * **Example** (Usage)
6644
+ *
6538
6645
  * ```ts
6539
6646
  * import { Effect } from "effect"
6540
6647
  *
@@ -6555,14 +6662,15 @@ export const log = /*#__PURE__*/internal.logWithLevel();
6555
6662
  * // timestamp=2023-... level=FATAL message="System shutting down"
6556
6663
  * ```
6557
6664
  *
6558
- * @since 2.0.0
6559
6665
  * @category Logging
6666
+ * @since 2.0.0
6560
6667
  */
6561
6668
  export const logFatal = /*#__PURE__*/internal.logWithLevel("Fatal");
6562
6669
  /**
6563
6670
  * Logs one or more messages at the WARNING level.
6564
6671
  *
6565
- * @example
6672
+ * **Example** (Usage)
6673
+ *
6566
6674
  * ```ts
6567
6675
  * import { Effect } from "effect"
6568
6676
  *
@@ -6584,14 +6692,15 @@ export const logFatal = /*#__PURE__*/internal.logWithLevel("Fatal");
6584
6692
  * // timestamp=2023-... level=WARN message="Using deprecated API endpoint"
6585
6693
  * ```
6586
6694
  *
6587
- * @since 2.0.0
6588
6695
  * @category Logging
6696
+ * @since 2.0.0
6589
6697
  */
6590
6698
  export const logWarning = /*#__PURE__*/internal.logWithLevel("Warn");
6591
6699
  /**
6592
6700
  * Logs one or more messages at the ERROR level.
6593
6701
  *
6594
- * @example
6702
+ * **Example** (Usage)
6703
+ *
6595
6704
  * ```ts
6596
6705
  * import { Effect } from "effect"
6597
6706
  *
@@ -6616,14 +6725,15 @@ export const logWarning = /*#__PURE__*/internal.logWithLevel("Warn");
6616
6725
  * // timestamp=2023-... level=ERROR message="Caught error: Something went wrong"
6617
6726
  * ```
6618
6727
  *
6619
- * @since 2.0.0
6620
6728
  * @category Logging
6729
+ * @since 2.0.0
6621
6730
  */
6622
6731
  export const logError = /*#__PURE__*/internal.logWithLevel("Error");
6623
6732
  /**
6624
6733
  * Logs one or more messages at the INFO level.
6625
6734
  *
6626
- * @example
6735
+ * **Example** (Usage)
6736
+ *
6627
6737
  * ```ts
6628
6738
  * import { Effect } from "effect"
6629
6739
  *
@@ -6643,14 +6753,15 @@ export const logError = /*#__PURE__*/internal.logWithLevel("Error");
6643
6753
  * // timestamp=2023-... level=INFO message="Application version: 1.2.3"
6644
6754
  * ```
6645
6755
  *
6646
- * @since 2.0.0
6647
6756
  * @category Logging
6757
+ * @since 2.0.0
6648
6758
  */
6649
6759
  export const logInfo = /*#__PURE__*/internal.logWithLevel("Info");
6650
6760
  /**
6651
6761
  * Logs one or more messages at the DEBUG level.
6652
6762
  *
6653
- * @example
6763
+ * **Example** (Usage)
6764
+ *
6654
6765
  * ```ts
6655
6766
  * import { Effect } from "effect"
6656
6767
  *
@@ -6671,14 +6782,15 @@ export const logInfo = /*#__PURE__*/internal.logWithLevel("Info");
6671
6782
  * // timestamp=2023-... level=DEBUG message="Variable state: x=10 y=20 z=30"
6672
6783
  * ```
6673
6784
  *
6674
- * @since 2.0.0
6675
6785
  * @category Logging
6786
+ * @since 2.0.0
6676
6787
  */
6677
6788
  export const logDebug = /*#__PURE__*/internal.logWithLevel("Debug");
6678
6789
  /**
6679
6790
  * Logs one or more messages at the TRACE level.
6680
6791
  *
6681
- * @example
6792
+ * **Example** (Usage)
6793
+ *
6682
6794
  * ```ts
6683
6795
  * import { Effect } from "effect"
6684
6796
  *
@@ -6702,14 +6814,15 @@ export const logDebug = /*#__PURE__*/internal.logWithLevel("Debug");
6702
6814
  * // timestamp=2023-... level=TRACE message="Exiting function processData"
6703
6815
  * ```
6704
6816
  *
6705
- * @since 2.0.0
6706
6817
  * @category Logging
6818
+ * @since 2.0.0
6707
6819
  */
6708
6820
  export const logTrace = /*#__PURE__*/internal.logWithLevel("Trace");
6709
6821
  /**
6710
6822
  * Adds a logger to the set of loggers which will output logs for this effect.
6711
6823
  *
6712
- * @example
6824
+ * **Example** (Usage)
6825
+ *
6713
6826
  * ```ts
6714
6827
  * import { Effect, Logger } from "effect"
6715
6828
  *
@@ -6730,14 +6843,15 @@ export const logTrace = /*#__PURE__*/internal.logWithLevel("Trace");
6730
6843
  * // Output includes both default and custom log outputs
6731
6844
  * ```
6732
6845
  *
6733
- * @since 2.0.0
6734
6846
  * @category Logging
6847
+ * @since 2.0.0
6735
6848
  */
6736
6849
  export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.updateService(effect, internal.CurrentLoggers, loggers => new Set([...loggers, logger])));
6737
6850
  /**
6738
6851
  * Adds an annotation to each log line in this effect.
6739
6852
  *
6740
- * @example
6853
+ * **Example** (Usage)
6854
+ *
6741
6855
  * ```ts
6742
6856
  * import { Effect } from "effect"
6743
6857
  *
@@ -6760,8 +6874,8 @@ export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.upda
6760
6874
  * // All log messages will include the userId and operation annotations
6761
6875
  * ```
6762
6876
  *
6763
- * @since 2.0.0
6764
6877
  * @category Logging
6878
+ * @since 2.0.0
6765
6879
  */
6766
6880
  export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
6767
6881
  const newAnnotations = {
@@ -6781,7 +6895,8 @@ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect
6781
6895
  * `annotateLogsScoped` updates annotations for the entire current `Scope` and
6782
6896
  * restores the previous annotations when the scope closes.
6783
6897
  *
6784
- * @example
6898
+ * **Example** (Usage)
6899
+ *
6785
6900
  * ```ts
6786
6901
  * import { Effect } from "effect"
6787
6902
  *
@@ -6796,14 +6911,15 @@ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect
6796
6911
  * Effect.runPromise(program)
6797
6912
  * ```
6798
6913
  *
6799
- * @since 4.0.0
6800
6914
  * @category Logging
6915
+ * @since 4.0.0
6801
6916
  */
6802
6917
  export const annotateLogsScoped = internal.annotateLogsScoped;
6803
6918
  /**
6804
6919
  * Adds a span to each log line in this effect.
6805
6920
  *
6806
- * @example
6921
+ * **Example** (Usage)
6922
+ *
6807
6923
  * ```ts
6808
6924
  * import { Effect } from "effect"
6809
6925
  *
@@ -6827,8 +6943,8 @@ export const annotateLogsScoped = internal.annotateLogsScoped;
6827
6943
  * // All log messages will include span information showing the nested operation context
6828
6944
  * ```
6829
6945
  *
6830
- * @since 2.0.0
6831
6946
  * @category Logging
6947
+ * @since 2.0.0
6832
6948
  */
6833
6949
  export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flatMap(internal.currentTimeMillis, now => internal.updateService(effect, CurrentLogSpans, spans => {
6834
6950
  const span = [label, now];
@@ -6843,7 +6959,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
6843
6959
  * Also accepts an optional function which can be used to map the `Exit` value
6844
6960
  * of the `Effect` into a valid `Input` for the `Metric`.
6845
6961
  *
6846
- * @example
6962
+ * **Example** (Usage)
6963
+ *
6847
6964
  * ```ts
6848
6965
  * import { Effect, Metric } from "effect"
6849
6966
  *
@@ -6862,7 +6979,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
6862
6979
  * )
6863
6980
  * ```
6864
6981
  *
6865
- * @example
6982
+ * **Example** (Usage)
6983
+ *
6866
6984
  * ```ts
6867
6985
  * import { Effect, Exit, Metric } from "effect"
6868
6986
  *
@@ -6882,8 +7000,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
6882
7000
  * )
6883
7001
  * ```
6884
7002
  *
6885
- * @since 4.0.0
6886
7003
  * @category Tracking
7004
+ * @since 4.0.0
6887
7005
  */
6888
7006
  export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => onExit(self, exit => {
6889
7007
  const input = f === undefined ? exit : internalCall(() => f(exit));
@@ -6896,7 +7014,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
6896
7014
  * Also accepts an optional function which can be used to map the success value
6897
7015
  * of the `Effect` into a valid `Input` for the `Metric`.
6898
7016
  *
6899
- * @example
7017
+ * **Example** (Usage)
7018
+ *
6900
7019
  * ```ts
6901
7020
  * import { Effect, Metric } from "effect"
6902
7021
  *
@@ -6914,7 +7033,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
6914
7033
  * )
6915
7034
  * ```
6916
7035
  *
6917
- * @example
7036
+ * **Example** (Usage)
7037
+ *
6918
7038
  * ```ts
6919
7039
  * import { Effect, Metric } from "effect"
6920
7040
  *
@@ -6931,8 +7051,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
6931
7051
  * )
6932
7052
  * ```
6933
7053
  *
6934
- * @since 4.0.0
6935
7054
  * @category Tracking
7055
+ * @since 4.0.0
6936
7056
  */
6937
7057
  export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tap(self, value => {
6938
7058
  const input = f === undefined ? value : f(value);
@@ -6945,7 +7065,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
6945
7065
  * Also accepts an optional function which can be used to map the error value
6946
7066
  * of the `Effect` into a valid `Input` for the `Metric`.
6947
7067
  *
6948
- * @example
7068
+ * **Example** (Usage)
7069
+ *
6949
7070
  * ```ts
6950
7071
  * import { Effect, Metric } from "effect"
6951
7072
  *
@@ -6963,7 +7084,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
6963
7084
  * )
6964
7085
  * ```
6965
7086
  *
6966
- * @example
7087
+ * **Example** (Usage)
7088
+ *
6967
7089
  * ```ts
6968
7090
  * import { Data, Effect, Metric } from "effect"
6969
7091
  *
@@ -6982,8 +7104,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
6982
7104
  * )
6983
7105
  * ```
6984
7106
  *
6985
- * @since 4.0.0
6986
7107
  * @category Tracking
7108
+ * @since 4.0.0
6987
7109
  */
6988
7110
  export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tapError(self, error => {
6989
7111
  const input = f === undefined ? error : internalCall(() => f(error));
@@ -6996,7 +7118,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
6996
7118
  * Also accepts an optional function which can be used to map the defect value
6997
7119
  * of the `Effect` into a valid `Input` for the `Metric`.
6998
7120
  *
6999
- * @example
7121
+ * **Example** (Usage)
7122
+ *
7000
7123
  * ```ts
7001
7124
  * import { Effect, Metric } from "effect"
7002
7125
  *
@@ -7014,7 +7137,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
7014
7137
  * )
7015
7138
  * ```
7016
7139
  *
7017
- * @example
7140
+ * **Example** (Usage)
7141
+ *
7018
7142
  * ```ts
7019
7143
  * import { Effect, Metric } from "effect"
7020
7144
  *
@@ -7034,8 +7158,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
7034
7158
  * )
7035
7159
  * ```
7036
7160
  *
7037
- * @since 4.0.0
7038
7161
  * @category Tracking
7162
+ * @since 4.0.0
7039
7163
  */
7040
7164
  export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tapDefect(self, defect => {
7041
7165
  const input = f === undefined ? defect : internalCall(() => f(defect));
@@ -7049,7 +7173,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
7049
7173
  * that the wrapped `Effect` took to complete into a valid `Input` for the
7050
7174
  * `Metric`.
7051
7175
  *
7052
- * @example
7176
+ * **Example** (Usage)
7177
+ *
7053
7178
  * ```ts
7054
7179
  * import { Effect, Metric } from "effect"
7055
7180
  *
@@ -7065,7 +7190,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
7065
7190
  * )
7066
7191
  * ```
7067
7192
  *
7068
- * @example
7193
+ * **Example** (Usage)
7194
+ *
7069
7195
  * ```ts
7070
7196
  * import { Duration, Effect, Metric } from "effect"
7071
7197
  *
@@ -7082,8 +7208,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
7082
7208
  * )
7083
7209
  * ```
7084
7210
  *
7085
- * @since 4.0.0
7086
7211
  * @category Tracking
7212
+ * @since 4.0.0
7087
7213
  */
7088
7214
  export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => clockWith(clock => {
7089
7215
  const startTime = clock.currentTimeNanosUnsafe();
@@ -7103,7 +7229,8 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
7103
7229
  * - a journal that stores any non committed change to TxRef values
7104
7230
  * - a retry flag to know if the transaction should be retried
7105
7231
  *
7106
- * @example
7232
+ * **Example** (Usage)
7233
+ *
7107
7234
  * ```ts
7108
7235
  * import { Effect } from "effect"
7109
7236
  *
@@ -7115,8 +7242,8 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
7115
7242
  * })
7116
7243
  * ```
7117
7244
  *
7118
- * @since 4.0.0
7119
7245
  * @category Transactions
7246
+ * @since 4.0.0
7120
7247
  */
7121
7248
  export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/Transaction") {}
7122
7249
  /**
@@ -7137,7 +7264,8 @@ export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/T
7137
7264
  * The outermost `tx` call creates the transaction boundary and commits or rolls back the full
7138
7265
  * composed transaction.
7139
7266
  *
7140
- * @example
7267
+ * **Example** (Usage)
7268
+ *
7141
7269
  * ```ts
7142
7270
  * import { Effect, TxRef } from "effect"
7143
7271
  *
@@ -7158,8 +7286,8 @@ export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/T
7158
7286
  * })
7159
7287
  * ```
7160
7288
  *
7161
- * @since 4.0.0
7162
7289
  * @category Transactions
7290
+ * @since 4.0.0
7163
7291
  */
7164
7292
  export const tx = effect => withFiber(fiber => {
7165
7293
  if (fiber.context.mapUnsafe.has(Transaction.key)) {
@@ -7242,10 +7370,10 @@ function clearTransaction(state) {
7242
7370
  *
7243
7371
  * NOTE: the transaction retries on any change to transactional values (i.e. TxRef) accessed in its body.
7244
7372
  *
7245
- * @since 4.0.0
7246
7373
  * @category Transactions
7374
+ * @since 4.0.0
7247
7375
  *
7248
- * @example
7376
+ * **Example** (Usage)
7249
7377
  *
7250
7378
  * ```ts
7251
7379
  * import { Effect, TxRef } from "effect"
@@ -7274,14 +7402,24 @@ function clearTransaction(state) {
7274
7402
  * Effect.runPromise(program).catch(console.error)
7275
7403
  * ```
7276
7404
  */
7277
- export const txRetry = /*#__PURE__*/flatMap(/*#__PURE__*/Transaction.asEffect(), state => {
7405
+ export const txRetry = /*#__PURE__*/flatMap(Transaction, state => {
7278
7406
  state.retry = true;
7279
7407
  return interrupt;
7280
7408
  });
7281
7409
  /**
7282
- * Converts a callback-based function to a function that returns an `Effect`.
7410
+ * Converts an error-first callback API into a function that returns an
7411
+ * `Effect`.
7412
+ *
7413
+ * **Details**
7414
+ *
7415
+ * The original function is called with the supplied arguments plus a final
7416
+ * callback. A non-null callback error fails the returned effect, while a
7417
+ * successful callback value becomes the effect success. Use `onError` to map
7418
+ * callback errors and `onSyncError` to turn synchronous throws into typed
7419
+ * failures; otherwise synchronous throws become defects.
7420
+ *
7421
+ * **Example** (Basic Usage)
7283
7422
  *
7284
- * @example Basic Usage
7285
7423
  * ```ts
7286
7424
  * import { Effect } from "effect"
7287
7425
  * import * as fs from "fs"
@@ -7296,7 +7434,8 @@ export const txRetry = /*#__PURE__*/flatMap(/*#__PURE__*/Transaction.asEffect(),
7296
7434
  * // Output: contents of package.json
7297
7435
  * ```
7298
7436
  *
7299
- * @example Custom Error Handling
7437
+ * **Example** (Custom Error Handling)
7438
+ *
7300
7439
  * ```ts
7301
7440
  * import { Effect } from "effect"
7302
7441
  * import * as fs from "fs"
@@ -7312,8 +7451,8 @@ export const txRetry = /*#__PURE__*/flatMap(/*#__PURE__*/Transaction.asEffect(),
7312
7451
  * // Output: Exit.failure with custom error message
7313
7452
  * ```
7314
7453
  *
7315
- * @since 4.0.0
7316
7454
  * @category Effectify
7455
+ * @since 4.0.0
7317
7456
  */
7318
7457
  export const effectify = (fn, onError, onSyncError) => (...args) => callback(resume => {
7319
7458
  try {
@@ -7337,7 +7476,8 @@ export const effectify = (fn, onError, onSyncError) => (...args) => callback(res
7337
7476
  * This function provides compile-time type checking to ensure that the success
7338
7477
  * value of an effect conforms to a specific type constraint.
7339
7478
  *
7340
- * @example
7479
+ * **Example** (Usage)
7480
+ *
7341
7481
  * ```ts
7342
7482
  * import { Effect } from "effect"
7343
7483
  *
@@ -7353,8 +7493,8 @@ export const effectify = (fn, onError, onSyncError) => (...args) => callback(res
7353
7493
  * // Type 'string' is not assignable to type 'number'
7354
7494
  * ```
7355
7495
  *
7356
- * @since 4.0.0
7357
7496
  * @category Type Constraints
7497
+ * @since 4.0.0
7358
7498
  */
7359
7499
  export const satisfiesSuccessType = () => effect => effect;
7360
7500
  /**
@@ -7363,7 +7503,8 @@ export const satisfiesSuccessType = () => effect => effect;
7363
7503
  * This function provides compile-time type checking to ensure that the error
7364
7504
  * type of an effect conforms to a specific type constraint.
7365
7505
  *
7366
- * @example
7506
+ * **Example** (Usage)
7507
+ *
7367
7508
  * ```ts
7368
7509
  * import { Data, Effect } from "effect"
7369
7510
  *
@@ -7381,8 +7522,8 @@ export const satisfiesSuccessType = () => effect => effect;
7381
7522
  * // Type 'string' is not assignable to type 'ValidationError'
7382
7523
  * ```
7383
7524
  *
7384
- * @since 4.0.0
7385
7525
  * @category Type Constraints
7526
+ * @since 4.0.0
7386
7527
  */
7387
7528
  export const satisfiesErrorType = () => effect => effect;
7388
7529
  /**
@@ -7391,7 +7532,8 @@ export const satisfiesErrorType = () => effect => effect;
7391
7532
  * This function provides compile-time type checking to ensure that the
7392
7533
  * requirements (context) type of an effect conforms to a specific type constraint.
7393
7534
  *
7394
- * @example
7535
+ * **Example** (Usage)
7536
+ *
7395
7537
  * ```ts
7396
7538
  * import { Effect } from "effect"
7397
7539
  *
@@ -7407,8 +7549,8 @@ export const satisfiesErrorType = () => effect => effect;
7407
7549
  * // const constrainedInvalid = satisfiesStringServices(invalidEffect)
7408
7550
  * ```
7409
7551
  *
7410
- * @since 4.0.0
7411
7552
  * @category Type Constraints
7553
+ * @since 4.0.0
7412
7554
  */
7413
7555
  export const satisfiesServicesType = () => effect => effect;
7414
7556
  /**
@@ -7427,7 +7569,8 @@ export const satisfiesServicesType = () => effect => effect;
7427
7569
  * - For **Failure effects**: Returns the failure as-is without applying the mapping
7428
7570
  * - For **Pending effects**: Falls back to the regular `map` behavior
7429
7571
  *
7430
- * @example
7572
+ * **Example** (Usage)
7573
+ *
7431
7574
  * ```ts
7432
7575
  * import { Effect } from "effect"
7433
7576
  *
@@ -7440,8 +7583,8 @@ export const satisfiesServicesType = () => effect => effect;
7440
7583
  * const mappedPending = Effect.mapEager(pending, (n) => n * 2) // Uses regular map
7441
7584
  * ```
7442
7585
  *
7443
- * @since 4.0.0
7444
7586
  * @category Eager
7587
+ * @since 4.0.0
7445
7588
  */
7446
7589
  export const mapEager = internal.mapEager;
7447
7590
  /**
@@ -7460,7 +7603,8 @@ export const mapEager = internal.mapEager;
7460
7603
  * - For **Failure effects**: Applies the mapping function immediately to the error
7461
7604
  * - For **Pending effects**: Falls back to the regular `mapError` behavior
7462
7605
  *
7463
- * @example
7606
+ * **Example** (Usage)
7607
+ *
7464
7608
  * ```ts
7465
7609
  * import { Effect } from "effect"
7466
7610
  *
@@ -7476,8 +7620,8 @@ export const mapEager = internal.mapEager;
7476
7620
  * ) // Uses regular mapError
7477
7621
  * ```
7478
7622
  *
7479
- * @since 4.0.0
7480
7623
  * @category Eager
7624
+ * @since 4.0.0
7481
7625
  */
7482
7626
  export const mapErrorEager = internal.mapErrorEager;
7483
7627
  /**
@@ -7496,7 +7640,8 @@ export const mapErrorEager = internal.mapErrorEager;
7496
7640
  * - For **Failure effects**: Applies the `onFailure` function immediately to the error
7497
7641
  * - For **Pending effects**: Falls back to the regular `mapBoth` behavior
7498
7642
  *
7499
- * @example
7643
+ * **Example** (Usage)
7644
+ *
7500
7645
  * ```ts
7501
7646
  * import { Effect } from "effect"
7502
7647
  *
@@ -7514,8 +7659,8 @@ export const mapErrorEager = internal.mapErrorEager;
7514
7659
  * }) // onFailure applied eagerly
7515
7660
  * ```
7516
7661
  *
7517
- * @since 4.0.0
7518
7662
  * @category Eager
7663
+ * @since 4.0.0
7519
7664
  */
7520
7665
  export const mapBothEager = internal.mapBothEager;
7521
7666
  /**
@@ -7534,7 +7679,8 @@ export const mapBothEager = internal.mapBothEager;
7534
7679
  * - For **Failure effects**: Returns the failure as-is without applying the flatMap
7535
7680
  * - For **Pending effects**: Falls back to the regular `flatMap` behavior
7536
7681
  *
7537
- * @example
7682
+ * **Example** (Usage)
7683
+ *
7538
7684
  * ```ts
7539
7685
  * import { Effect } from "effect"
7540
7686
  *
@@ -7550,8 +7696,8 @@ export const mapBothEager = internal.mapBothEager;
7550
7696
  * ) // Uses regular flatMap
7551
7697
  * ```
7552
7698
  *
7553
- * @since 4.0.0
7554
7699
  * @category Eager
7700
+ * @since 4.0.0
7555
7701
  */
7556
7702
  export const flatMapEager = internal.flatMapEager;
7557
7703
  /**
@@ -7570,7 +7716,8 @@ export const flatMapEager = internal.flatMapEager;
7570
7716
  * - For **Failure effects**: Applies the catch function immediately to the error
7571
7717
  * - For **Pending effects**: Falls back to the regular `catch` behavior
7572
7718
  *
7573
- * @example
7719
+ * **Example** (Usage)
7720
+ *
7574
7721
  * ```ts
7575
7722
  * import { Effect } from "effect"
7576
7723
  *
@@ -7596,8 +7743,8 @@ export const flatMapEager = internal.flatMapEager;
7596
7743
  * ) // Uses regular catch
7597
7744
  * ```
7598
7745
  *
7599
- * @since 4.0.0
7600
7746
  * @category Eager
7747
+ * @since 4.0.0
7601
7748
  */
7602
7749
  export const catchEager = internal.catchEager;
7603
7750
  /**
@@ -7606,7 +7753,8 @@ export const catchEager = internal.catchEager;
7606
7753
  * Executes generator functions eagerly when all yielded effects are synchronous,
7607
7754
  * stopping at the first async effect and deferring to normal execution.
7608
7755
  *
7609
- * @example
7756
+ * **Example** (Usage)
7757
+ *
7610
7758
  * ```ts
7611
7759
  * import { Effect } from "effect"
7612
7760
  *
@@ -7619,8 +7767,8 @@ export const catchEager = internal.catchEager;
7619
7767
  * const effect = computation() // Executed immediately if all effects are sync
7620
7768
  * ```
7621
7769
  *
7622
- * @since 4.0.0
7623
7770
  * @category Eager
7771
+ * @since 4.0.0
7624
7772
  */
7625
7773
  export const fnUntracedEager = internal.fnUntracedEager;
7626
7774
  //# sourceMappingURL=Effect.js.map