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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1451) hide show
  1. package/dist/Array.d.ts +971 -1037
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +381 -407
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +433 -756
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +200 -325
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +207 -267
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +107 -135
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +146 -188
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +64 -84
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.js.map +1 -1
  18. package/dist/Cache.d.ts +405 -254
  19. package/dist/Cache.d.ts.map +1 -1
  20. package/dist/Cache.js +166 -101
  21. package/dist/Cache.js.map +1 -1
  22. package/dist/Cause.d.ts +167 -277
  23. package/dist/Cause.d.ts.map +1 -1
  24. package/dist/Cause.js +122 -176
  25. package/dist/Cause.js.map +1 -1
  26. package/dist/Channel.d.ts +729 -768
  27. package/dist/Channel.d.ts.map +1 -1
  28. package/dist/Channel.js +514 -440
  29. package/dist/Channel.js.map +1 -1
  30. package/dist/ChannelSchema.d.ts +1 -1
  31. package/dist/ChannelSchema.d.ts.map +1 -1
  32. package/dist/ChannelSchema.js.map +1 -1
  33. package/dist/Chunk.d.ts +834 -1173
  34. package/dist/Chunk.d.ts.map +1 -1
  35. package/dist/Chunk.js +326 -439
  36. package/dist/Chunk.js.map +1 -1
  37. package/dist/Clock.d.ts +180 -49
  38. package/dist/Clock.d.ts.map +1 -1
  39. package/dist/Clock.js +96 -31
  40. package/dist/Clock.js.map +1 -1
  41. package/dist/Combiner.d.ts +20 -33
  42. package/dist/Combiner.d.ts.map +1 -1
  43. package/dist/Combiner.js +18 -30
  44. package/dist/Combiner.js.map +1 -1
  45. package/dist/Config.d.ts +225 -173
  46. package/dist/Config.d.ts.map +1 -1
  47. package/dist/Config.js +336 -265
  48. package/dist/Config.js.map +1 -1
  49. package/dist/ConfigProvider.d.ts +194 -68
  50. package/dist/ConfigProvider.d.ts.map +1 -1
  51. package/dist/ConfigProvider.js +115 -80
  52. package/dist/ConfigProvider.js.map +1 -1
  53. package/dist/Console.d.ts +233 -33
  54. package/dist/Console.d.ts.map +1 -1
  55. package/dist/Console.js +232 -32
  56. package/dist/Console.js.map +1 -1
  57. package/dist/Context.d.ts +151 -274
  58. package/dist/Context.d.ts.map +1 -1
  59. package/dist/Context.js +171 -214
  60. package/dist/Context.js.map +1 -1
  61. package/dist/Cron.d.ts +68 -77
  62. package/dist/Cron.d.ts.map +1 -1
  63. package/dist/Cron.js +57 -66
  64. package/dist/Cron.js.map +1 -1
  65. package/dist/Crypto.d.ts +13 -15
  66. package/dist/Crypto.d.ts.map +1 -1
  67. package/dist/Crypto.js +9 -10
  68. package/dist/Crypto.js.map +1 -1
  69. package/dist/Data.d.ts +60 -80
  70. package/dist/Data.d.ts.map +1 -1
  71. package/dist/Data.js +16 -23
  72. package/dist/Data.js.map +1 -1
  73. package/dist/DateTime.d.ts +562 -660
  74. package/dist/DateTime.d.ts.map +1 -1
  75. package/dist/DateTime.js +307 -362
  76. package/dist/DateTime.js.map +1 -1
  77. package/dist/Deferred.d.ts +253 -256
  78. package/dist/Deferred.d.ts.map +1 -1
  79. package/dist/Deferred.js +104 -96
  80. package/dist/Deferred.js.map +1 -1
  81. package/dist/Duration.d.ts +216 -308
  82. package/dist/Duration.d.ts.map +1 -1
  83. package/dist/Duration.js +132 -186
  84. package/dist/Duration.js.map +1 -1
  85. package/dist/Effect.d.ts +2841 -3247
  86. package/dist/Effect.d.ts.map +1 -1
  87. package/dist/Effect.js +1322 -1546
  88. package/dist/Effect.js.map +1 -1
  89. package/dist/Effectable.js.map +1 -1
  90. package/dist/Encoding.d.ts +22 -40
  91. package/dist/Encoding.d.ts.map +1 -1
  92. package/dist/Encoding.js +22 -40
  93. package/dist/Encoding.js.map +1 -1
  94. package/dist/Equal.d.ts +33 -37
  95. package/dist/Equal.d.ts.map +1 -1
  96. package/dist/Equal.js +29 -21
  97. package/dist/Equal.js.map +1 -1
  98. package/dist/Equivalence.d.ts +103 -105
  99. package/dist/Equivalence.d.ts.map +1 -1
  100. package/dist/Equivalence.js +77 -79
  101. package/dist/Equivalence.js.map +1 -1
  102. package/dist/ErrorReporter.d.ts +51 -27
  103. package/dist/ErrorReporter.d.ts.map +1 -1
  104. package/dist/ErrorReporter.js +50 -26
  105. package/dist/ErrorReporter.js.map +1 -1
  106. package/dist/ExecutionPlan.d.ts +13 -55
  107. package/dist/ExecutionPlan.d.ts.map +1 -1
  108. package/dist/ExecutionPlan.js +7 -28
  109. package/dist/ExecutionPlan.js.map +1 -1
  110. package/dist/Exit.d.ts +116 -192
  111. package/dist/Exit.d.ts.map +1 -1
  112. package/dist/Exit.js +82 -130
  113. package/dist/Exit.js.map +1 -1
  114. package/dist/Fiber.d.ts +82 -146
  115. package/dist/Fiber.d.ts.map +1 -1
  116. package/dist/Fiber.js +48 -87
  117. package/dist/Fiber.js.map +1 -1
  118. package/dist/FiberHandle.d.ts +152 -105
  119. package/dist/FiberHandle.d.ts.map +1 -1
  120. package/dist/FiberHandle.js +106 -73
  121. package/dist/FiberHandle.js.map +1 -1
  122. package/dist/FiberMap.d.ts +213 -168
  123. package/dist/FiberMap.d.ts.map +1 -1
  124. package/dist/FiberMap.js +114 -89
  125. package/dist/FiberMap.js.map +1 -1
  126. package/dist/FiberSet.d.ts +123 -81
  127. package/dist/FiberSet.d.ts.map +1 -1
  128. package/dist/FiberSet.js +85 -59
  129. package/dist/FiberSet.js.map +1 -1
  130. package/dist/FileSystem.d.ts +153 -264
  131. package/dist/FileSystem.d.ts.map +1 -1
  132. package/dist/FileSystem.js +42 -147
  133. package/dist/FileSystem.js.map +1 -1
  134. package/dist/Filter.d.ts +61 -33
  135. package/dist/Filter.d.ts.map +1 -1
  136. package/dist/Filter.js +26 -15
  137. package/dist/Filter.js.map +1 -1
  138. package/dist/Formatter.d.ts +25 -33
  139. package/dist/Formatter.d.ts.map +1 -1
  140. package/dist/Formatter.js +48 -49
  141. package/dist/Formatter.js.map +1 -1
  142. package/dist/Function.d.ts +76 -145
  143. package/dist/Function.d.ts.map +1 -1
  144. package/dist/Function.js +40 -57
  145. package/dist/Function.js.map +1 -1
  146. package/dist/Graph.d.ts +360 -714
  147. package/dist/Graph.d.ts.map +1 -1
  148. package/dist/Graph.js +168 -297
  149. package/dist/Graph.js.map +1 -1
  150. package/dist/HKT.d.ts +12 -6
  151. package/dist/HKT.d.ts.map +1 -1
  152. package/dist/Hash.d.ts +47 -83
  153. package/dist/Hash.d.ts.map +1 -1
  154. package/dist/Hash.js +46 -68
  155. package/dist/Hash.js.map +1 -1
  156. package/dist/HashMap.d.ts +319 -411
  157. package/dist/HashMap.d.ts.map +1 -1
  158. package/dist/HashMap.js +122 -166
  159. package/dist/HashMap.js.map +1 -1
  160. package/dist/HashRing.d.ts.map +1 -1
  161. package/dist/HashRing.js +1 -0
  162. package/dist/HashRing.js.map +1 -1
  163. package/dist/HashSet.d.ts +177 -284
  164. package/dist/HashSet.d.ts.map +1 -1
  165. package/dist/HashSet.js +68 -109
  166. package/dist/HashSet.js.map +1 -1
  167. package/dist/Inspectable.d.ts +12 -12
  168. package/dist/Inspectable.js +8 -8
  169. package/dist/Inspectable.js.map +1 -1
  170. package/dist/Iterable.d.ts +620 -786
  171. package/dist/Iterable.d.ts.map +1 -1
  172. package/dist/Iterable.js +228 -306
  173. package/dist/Iterable.js.map +1 -1
  174. package/dist/JsonPatch.d.ts +11 -13
  175. package/dist/JsonPatch.d.ts.map +1 -1
  176. package/dist/JsonPatch.js +44 -102
  177. package/dist/JsonPatch.js.map +1 -1
  178. package/dist/JsonPointer.d.ts +8 -8
  179. package/dist/JsonPointer.js +8 -8
  180. package/dist/JsonPointer.js.map +1 -1
  181. package/dist/JsonSchema.d.ts +98 -44
  182. package/dist/JsonSchema.d.ts.map +1 -1
  183. package/dist/JsonSchema.js +297 -234
  184. package/dist/JsonSchema.js.map +1 -1
  185. package/dist/Latch.d.ts +23 -35
  186. package/dist/Latch.d.ts.map +1 -1
  187. package/dist/Latch.js +16 -28
  188. package/dist/Latch.js.map +1 -1
  189. package/dist/Layer.d.ts +359 -260
  190. package/dist/Layer.d.ts.map +1 -1
  191. package/dist/Layer.js +195 -175
  192. package/dist/Layer.js.map +1 -1
  193. package/dist/LayerMap.d.ts +42 -29
  194. package/dist/LayerMap.d.ts.map +1 -1
  195. package/dist/LayerMap.js +31 -21
  196. package/dist/LayerMap.js.map +1 -1
  197. package/dist/LayerRef.d.ts +6 -2
  198. package/dist/LayerRef.d.ts.map +1 -1
  199. package/dist/LayerRef.js +6 -2
  200. package/dist/LayerRef.js.map +1 -1
  201. package/dist/LogLevel.d.ts +114 -214
  202. package/dist/LogLevel.d.ts.map +1 -1
  203. package/dist/LogLevel.js +41 -76
  204. package/dist/LogLevel.js.map +1 -1
  205. package/dist/Logger.d.ts +218 -467
  206. package/dist/Logger.d.ts.map +1 -1
  207. package/dist/Logger.js +204 -450
  208. package/dist/Logger.js.map +1 -1
  209. package/dist/ManagedRuntime.d.ts +7 -5
  210. package/dist/ManagedRuntime.d.ts.map +1 -1
  211. package/dist/ManagedRuntime.js +7 -5
  212. package/dist/ManagedRuntime.js.map +1 -1
  213. package/dist/Match.d.ts +217 -252
  214. package/dist/Match.d.ts.map +1 -1
  215. package/dist/Match.js +150 -183
  216. package/dist/Match.js.map +1 -1
  217. package/dist/Metric.d.ts +442 -993
  218. package/dist/Metric.d.ts.map +1 -1
  219. package/dist/Metric.js +198 -642
  220. package/dist/Metric.js.map +1 -1
  221. package/dist/MutableHashMap.d.ts +144 -173
  222. package/dist/MutableHashMap.d.ts.map +1 -1
  223. package/dist/MutableHashMap.js +68 -79
  224. package/dist/MutableHashMap.js.map +1 -1
  225. package/dist/MutableHashSet.d.ts +84 -89
  226. package/dist/MutableHashSet.d.ts.map +1 -1
  227. package/dist/MutableHashSet.js +44 -47
  228. package/dist/MutableHashSet.js.map +1 -1
  229. package/dist/MutableList.d.ts +71 -370
  230. package/dist/MutableList.d.ts.map +1 -1
  231. package/dist/MutableList.js +59 -284
  232. package/dist/MutableList.js.map +1 -1
  233. package/dist/MutableRef.d.ts +420 -243
  234. package/dist/MutableRef.d.ts.map +1 -1
  235. package/dist/MutableRef.js +209 -120
  236. package/dist/MutableRef.js.map +1 -1
  237. package/dist/Newtype.d.ts +21 -14
  238. package/dist/Newtype.d.ts.map +1 -1
  239. package/dist/Newtype.js +15 -13
  240. package/dist/Newtype.js.map +1 -1
  241. package/dist/NonEmptyIterable.d.ts +7 -137
  242. package/dist/NonEmptyIterable.d.ts.map +1 -1
  243. package/dist/NonEmptyIterable.js +5 -93
  244. package/dist/NonEmptyIterable.js.map +1 -1
  245. package/dist/Number.d.ts +196 -233
  246. package/dist/Number.d.ts.map +1 -1
  247. package/dist/Number.js +90 -109
  248. package/dist/Number.js.map +1 -1
  249. package/dist/Optic.d.ts +97 -189
  250. package/dist/Optic.d.ts.map +1 -1
  251. package/dist/Optic.js +187 -290
  252. package/dist/Optic.js.map +1 -1
  253. package/dist/Option.d.ts +447 -812
  254. package/dist/Option.d.ts.map +1 -1
  255. package/dist/Option.js +211 -392
  256. package/dist/Option.js.map +1 -1
  257. package/dist/Order.d.ts +109 -109
  258. package/dist/Order.js +91 -91
  259. package/dist/Order.js.map +1 -1
  260. package/dist/Ordering.d.ts +20 -23
  261. package/dist/Ordering.d.ts.map +1 -1
  262. package/dist/Ordering.js +8 -9
  263. package/dist/Ordering.js.map +1 -1
  264. package/dist/PartitionedSemaphore.js.map +1 -1
  265. package/dist/Path.d.ts +38 -41
  266. package/dist/Path.d.ts.map +1 -1
  267. package/dist/Path.js +3 -4
  268. package/dist/Path.js.map +1 -1
  269. package/dist/Pipeable.d.ts +6 -5
  270. package/dist/Pipeable.d.ts.map +1 -1
  271. package/dist/Pipeable.js +2 -2
  272. package/dist/Pipeable.js.map +1 -1
  273. package/dist/PlatformError.d.ts +4 -4
  274. package/dist/PlatformError.js +3 -3
  275. package/dist/PlatformError.js.map +1 -1
  276. package/dist/Pool.d.ts +4 -2
  277. package/dist/Pool.d.ts.map +1 -1
  278. package/dist/Pool.js +4 -2
  279. package/dist/Pool.js.map +1 -1
  280. package/dist/Predicate.d.ts +200 -181
  281. package/dist/Predicate.d.ts.map +1 -1
  282. package/dist/Predicate.js +100 -108
  283. package/dist/Predicate.js.map +1 -1
  284. package/dist/PrimaryKey.d.ts +7 -7
  285. package/dist/PrimaryKey.js +5 -5
  286. package/dist/PrimaryKey.js.map +1 -1
  287. package/dist/PubSub.d.ts +425 -494
  288. package/dist/PubSub.d.ts.map +1 -1
  289. package/dist/PubSub.js +373 -362
  290. package/dist/PubSub.js.map +1 -1
  291. package/dist/Pull.d.ts +24 -18
  292. package/dist/Pull.d.ts.map +1 -1
  293. package/dist/Pull.js +11 -9
  294. package/dist/Pull.js.map +1 -1
  295. package/dist/Queue.d.ts +200 -159
  296. package/dist/Queue.d.ts.map +1 -1
  297. package/dist/Queue.js +162 -132
  298. package/dist/Queue.js.map +1 -1
  299. package/dist/Random.d.ts +49 -74
  300. package/dist/Random.d.ts.map +1 -1
  301. package/dist/Random.js +35 -54
  302. package/dist/Random.js.map +1 -1
  303. package/dist/RcMap.d.ts +121 -63
  304. package/dist/RcMap.d.ts.map +1 -1
  305. package/dist/RcMap.js +42 -21
  306. package/dist/RcMap.js.map +1 -1
  307. package/dist/RcRef.d.ts +24 -13
  308. package/dist/RcRef.d.ts.map +1 -1
  309. package/dist/RcRef.js +15 -9
  310. package/dist/RcRef.js.map +1 -1
  311. package/dist/Record.d.ts +291 -488
  312. package/dist/Record.d.ts.map +1 -1
  313. package/dist/Record.js +111 -202
  314. package/dist/Record.js.map +1 -1
  315. package/dist/Redactable.d.ts +6 -2
  316. package/dist/Redactable.d.ts.map +1 -1
  317. package/dist/Redactable.js +7 -2
  318. package/dist/Redactable.js.map +1 -1
  319. package/dist/Redacted.d.ts +25 -25
  320. package/dist/Redacted.d.ts.map +1 -1
  321. package/dist/Redacted.js +19 -20
  322. package/dist/Redacted.js.map +1 -1
  323. package/dist/Reducer.d.ts +8 -15
  324. package/dist/Reducer.d.ts.map +1 -1
  325. package/dist/Reducer.js +6 -12
  326. package/dist/Reducer.js.map +1 -1
  327. package/dist/Ref.d.ts +95 -165
  328. package/dist/Ref.d.ts.map +1 -1
  329. package/dist/Ref.js +75 -122
  330. package/dist/Ref.js.map +1 -1
  331. package/dist/References.d.ts +102 -168
  332. package/dist/References.d.ts.map +1 -1
  333. package/dist/References.js +102 -168
  334. package/dist/References.js.map +1 -1
  335. package/dist/RegExp.d.ts +10 -14
  336. package/dist/RegExp.d.ts.map +1 -1
  337. package/dist/RegExp.js +10 -14
  338. package/dist/RegExp.js.map +1 -1
  339. package/dist/Request.d.ts +31 -21
  340. package/dist/Request.d.ts.map +1 -1
  341. package/dist/Request.js +16 -13
  342. package/dist/Request.js.map +1 -1
  343. package/dist/RequestResolver.d.ts +201 -90
  344. package/dist/RequestResolver.d.ts.map +1 -1
  345. package/dist/RequestResolver.js +87 -41
  346. package/dist/RequestResolver.js.map +1 -1
  347. package/dist/Resource.js.map +1 -1
  348. package/dist/Result.d.ts +302 -470
  349. package/dist/Result.d.ts.map +1 -1
  350. package/dist/Result.js +133 -217
  351. package/dist/Result.js.map +1 -1
  352. package/dist/Runtime.d.ts +50 -75
  353. package/dist/Runtime.d.ts.map +1 -1
  354. package/dist/Runtime.js +39 -60
  355. package/dist/Runtime.js.map +1 -1
  356. package/dist/Schedule.d.ts +290 -1636
  357. package/dist/Schedule.d.ts.map +1 -1
  358. package/dist/Schedule.js +162 -803
  359. package/dist/Schedule.js.map +1 -1
  360. package/dist/Scheduler.d.ts +5 -5
  361. package/dist/Scheduler.d.ts.map +1 -1
  362. package/dist/Scheduler.js +18 -6
  363. package/dist/Scheduler.js.map +1 -1
  364. package/dist/Schema.d.ts +644 -642
  365. package/dist/Schema.d.ts.map +1 -1
  366. package/dist/Schema.js +491 -527
  367. package/dist/Schema.js.map +1 -1
  368. package/dist/SchemaAST.d.ts +27 -50
  369. package/dist/SchemaAST.d.ts.map +1 -1
  370. package/dist/SchemaAST.js +366 -279
  371. package/dist/SchemaAST.js.map +1 -1
  372. package/dist/SchemaError.d.ts +7 -6
  373. package/dist/SchemaError.d.ts.map +1 -1
  374. package/dist/SchemaError.js +7 -6
  375. package/dist/SchemaError.js.map +1 -1
  376. package/dist/SchemaGetter.d.ts +217 -174
  377. package/dist/SchemaGetter.d.ts.map +1 -1
  378. package/dist/SchemaGetter.js +218 -185
  379. package/dist/SchemaGetter.js.map +1 -1
  380. package/dist/SchemaIssue.d.ts +62 -190
  381. package/dist/SchemaIssue.d.ts.map +1 -1
  382. package/dist/SchemaIssue.js +73 -265
  383. package/dist/SchemaIssue.js.map +1 -1
  384. package/dist/SchemaParser.d.ts +2 -2
  385. package/dist/SchemaParser.d.ts.map +1 -1
  386. package/dist/SchemaParser.js +123 -75
  387. package/dist/SchemaParser.js.map +1 -1
  388. package/dist/SchemaRepresentation.d.ts +22 -36
  389. package/dist/SchemaRepresentation.d.ts.map +1 -1
  390. package/dist/SchemaRepresentation.js +20 -26
  391. package/dist/SchemaRepresentation.js.map +1 -1
  392. package/dist/SchemaTransformation.d.ts +114 -74
  393. package/dist/SchemaTransformation.d.ts.map +1 -1
  394. package/dist/SchemaTransformation.js +120 -85
  395. package/dist/SchemaTransformation.js.map +1 -1
  396. package/dist/Scope.d.ts +123 -151
  397. package/dist/Scope.d.ts.map +1 -1
  398. package/dist/Scope.js +72 -92
  399. package/dist/Scope.js.map +1 -1
  400. package/dist/ScopedCache.js.map +1 -1
  401. package/dist/ScopedRef.d.ts +3 -3
  402. package/dist/ScopedRef.js +2 -2
  403. package/dist/ScopedRef.js.map +1 -1
  404. package/dist/Semaphore.d.ts +96 -10
  405. package/dist/Semaphore.d.ts.map +1 -1
  406. package/dist/Semaphore.js +78 -39
  407. package/dist/Semaphore.js.map +1 -1
  408. package/dist/Sink.d.ts +117 -107
  409. package/dist/Sink.d.ts.map +1 -1
  410. package/dist/Sink.js +107 -100
  411. package/dist/Sink.js.map +1 -1
  412. package/dist/Stdio.d.ts +1 -1
  413. package/dist/Stdio.js.map +1 -1
  414. package/dist/Stream.d.ts +2415 -2949
  415. package/dist/Stream.d.ts.map +1 -1
  416. package/dist/Stream.js +1078 -1381
  417. package/dist/Stream.js.map +1 -1
  418. package/dist/String.d.ts +262 -308
  419. package/dist/String.d.ts.map +1 -1
  420. package/dist/String.js +184 -215
  421. package/dist/String.js.map +1 -1
  422. package/dist/Struct.d.ts +109 -114
  423. package/dist/Struct.d.ts.map +1 -1
  424. package/dist/Struct.js +41 -50
  425. package/dist/Struct.js.map +1 -1
  426. package/dist/SubscriptionRef.d.ts +282 -250
  427. package/dist/SubscriptionRef.d.ts.map +1 -1
  428. package/dist/SubscriptionRef.js +104 -92
  429. package/dist/SubscriptionRef.js.map +1 -1
  430. package/dist/Symbol.d.ts +3 -3
  431. package/dist/Symbol.js +3 -3
  432. package/dist/Symbol.js.map +1 -1
  433. package/dist/SynchronizedRef.js.map +1 -1
  434. package/dist/Take.js.map +1 -1
  435. package/dist/Terminal.d.ts +2 -2
  436. package/dist/Terminal.js +1 -1
  437. package/dist/Terminal.js.map +1 -1
  438. package/dist/Tracer.d.ts +100 -54
  439. package/dist/Tracer.d.ts.map +1 -1
  440. package/dist/Tracer.js +41 -24
  441. package/dist/Tracer.js.map +1 -1
  442. package/dist/Trie.d.ts +287 -679
  443. package/dist/Trie.d.ts.map +1 -1
  444. package/dist/Trie.js +109 -251
  445. package/dist/Trie.js.map +1 -1
  446. package/dist/Tuple.d.ts +92 -127
  447. package/dist/Tuple.d.ts.map +1 -1
  448. package/dist/Tuple.js +42 -57
  449. package/dist/Tuple.js.map +1 -1
  450. package/dist/TxChunk.d.ts +201 -121
  451. package/dist/TxChunk.d.ts.map +1 -1
  452. package/dist/TxChunk.js +85 -56
  453. package/dist/TxChunk.js.map +1 -1
  454. package/dist/TxDeferred.d.ts +62 -46
  455. package/dist/TxDeferred.d.ts.map +1 -1
  456. package/dist/TxDeferred.js +30 -22
  457. package/dist/TxDeferred.js.map +1 -1
  458. package/dist/TxHashMap.d.ts +631 -779
  459. package/dist/TxHashMap.d.ts.map +1 -1
  460. package/dist/TxHashMap.js +268 -330
  461. package/dist/TxHashMap.js.map +1 -1
  462. package/dist/TxHashSet.d.ts +297 -236
  463. package/dist/TxHashSet.d.ts.map +1 -1
  464. package/dist/TxHashSet.js +130 -100
  465. package/dist/TxHashSet.js.map +1 -1
  466. package/dist/TxPriorityQueue.d.ts +126 -95
  467. package/dist/TxPriorityQueue.d.ts.map +1 -1
  468. package/dist/TxPriorityQueue.js +74 -56
  469. package/dist/TxPriorityQueue.js.map +1 -1
  470. package/dist/TxPubSub.d.ts +101 -88
  471. package/dist/TxPubSub.d.ts.map +1 -1
  472. package/dist/TxPubSub.js +87 -66
  473. package/dist/TxPubSub.js.map +1 -1
  474. package/dist/TxQueue.d.ts +200 -180
  475. package/dist/TxQueue.d.ts.map +1 -1
  476. package/dist/TxQueue.js +160 -136
  477. package/dist/TxQueue.js.map +1 -1
  478. package/dist/TxReentrantLock.d.ts +97 -66
  479. package/dist/TxReentrantLock.d.ts.map +1 -1
  480. package/dist/TxReentrantLock.js +67 -45
  481. package/dist/TxReentrantLock.js.map +1 -1
  482. package/dist/TxRef.d.ts +51 -32
  483. package/dist/TxRef.d.ts.map +1 -1
  484. package/dist/TxRef.js +23 -15
  485. package/dist/TxRef.js.map +1 -1
  486. package/dist/TxSemaphore.d.ts +129 -95
  487. package/dist/TxSemaphore.d.ts.map +1 -1
  488. package/dist/TxSemaphore.js +85 -70
  489. package/dist/TxSemaphore.js.map +1 -1
  490. package/dist/TxSubscriptionRef.d.ts +97 -70
  491. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  492. package/dist/TxSubscriptionRef.js +44 -34
  493. package/dist/TxSubscriptionRef.js.map +1 -1
  494. package/dist/Types.d.ts +126 -67
  495. package/dist/Types.d.ts.map +1 -1
  496. package/dist/UndefinedOr.js.map +1 -1
  497. package/dist/Unify.d.ts +45 -65
  498. package/dist/Unify.d.ts.map +1 -1
  499. package/dist/Unify.js +6 -9
  500. package/dist/Unify.js.map +1 -1
  501. package/dist/Utils.d.ts +23 -16
  502. package/dist/Utils.d.ts.map +1 -1
  503. package/dist/Utils.js +3 -7
  504. package/dist/Utils.js.map +1 -1
  505. package/dist/index.js.map +1 -1
  506. package/dist/internal/array.js.map +1 -1
  507. package/dist/internal/core.js +1 -1
  508. package/dist/internal/core.js.map +1 -1
  509. package/dist/internal/dateTime.js +4 -0
  510. package/dist/internal/dateTime.js.map +1 -1
  511. package/dist/internal/doNotation.js.map +1 -1
  512. package/dist/internal/effect.js +77 -40
  513. package/dist/internal/effect.js.map +1 -1
  514. package/dist/internal/equal.js.map +1 -1
  515. package/dist/internal/errors.js.map +1 -1
  516. package/dist/internal/executionPlan.js.map +1 -1
  517. package/dist/internal/hashMap.js.map +1 -1
  518. package/dist/internal/hashSet.js.map +1 -1
  519. package/dist/internal/layer.js.map +1 -1
  520. package/dist/internal/matcher.js.map +1 -1
  521. package/dist/internal/metric.js.map +1 -1
  522. package/dist/internal/option.js.map +1 -1
  523. package/dist/internal/persistence.d.ts +2 -0
  524. package/dist/internal/persistence.d.ts.map +1 -0
  525. package/dist/internal/persistence.js +3 -0
  526. package/dist/internal/persistence.js.map +1 -0
  527. package/dist/internal/random.js.map +1 -1
  528. package/dist/internal/rcRef.js.map +1 -1
  529. package/dist/internal/record.js.map +1 -1
  530. package/dist/internal/redacted.js.map +1 -1
  531. package/dist/internal/references.js +3 -0
  532. package/dist/internal/references.js.map +1 -1
  533. package/dist/internal/request.js.map +1 -1
  534. package/dist/internal/result.js.map +1 -1
  535. package/dist/internal/schedule.js.map +1 -1
  536. package/dist/internal/schema/annotations.js.map +1 -1
  537. package/dist/internal/schema/cause.js.map +1 -1
  538. package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
  539. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  540. package/dist/internal/schema/fromRepresentation.js +8 -15
  541. package/dist/internal/schema/fromRepresentation.js.map +1 -1
  542. package/dist/internal/schema/parser.d.ts +14 -0
  543. package/dist/internal/schema/parser.d.ts.map +1 -0
  544. package/dist/internal/schema/parser.js +13 -0
  545. package/dist/internal/schema/parser.js.map +1 -0
  546. package/dist/internal/schema/schema.js.map +1 -1
  547. package/dist/internal/schema/toArbitrary.js.map +1 -1
  548. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  549. package/dist/internal/schema/toEquivalence.js.map +1 -1
  550. package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
  551. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  552. package/dist/internal/schema/toRepresentation.js +87 -107
  553. package/dist/internal/schema/toRepresentation.js.map +1 -1
  554. package/dist/internal/stackTraceLimit.js.map +1 -1
  555. package/dist/internal/stream.js.map +1 -1
  556. package/dist/internal/tracer.js.map +1 -1
  557. package/dist/internal/trie.js +13 -9
  558. package/dist/internal/trie.js.map +1 -1
  559. package/dist/testing/FastCheck.d.ts +8 -7
  560. package/dist/testing/FastCheck.d.ts.map +1 -1
  561. package/dist/testing/FastCheck.js +8 -7
  562. package/dist/testing/FastCheck.js.map +1 -1
  563. package/dist/testing/TestClock.d.ts +57 -28
  564. package/dist/testing/TestClock.d.ts.map +1 -1
  565. package/dist/testing/TestClock.js +50 -18
  566. package/dist/testing/TestClock.js.map +1 -1
  567. package/dist/testing/TestConsole.d.ts +32 -31
  568. package/dist/testing/TestConsole.d.ts.map +1 -1
  569. package/dist/testing/TestConsole.js +24 -22
  570. package/dist/testing/TestConsole.js.map +1 -1
  571. package/dist/testing/TestSchema.d.ts +29 -29
  572. package/dist/testing/TestSchema.js +25 -25
  573. package/dist/testing/TestSchema.js.map +1 -1
  574. package/dist/testing/index.js.map +1 -1
  575. package/dist/unstable/ai/AiError.d.ts +95 -118
  576. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  577. package/dist/unstable/ai/AiError.js +94 -117
  578. package/dist/unstable/ai/AiError.js.map +1 -1
  579. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  580. package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
  581. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  582. package/dist/unstable/ai/Chat.d.ts +132 -97
  583. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  584. package/dist/unstable/ai/Chat.js +55 -51
  585. package/dist/unstable/ai/Chat.js.map +1 -1
  586. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  587. package/dist/unstable/ai/IdGenerator.d.ts +32 -28
  588. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  589. package/dist/unstable/ai/IdGenerator.js +26 -21
  590. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  591. package/dist/unstable/ai/LanguageModel.d.ts +107 -67
  592. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  593. package/dist/unstable/ai/LanguageModel.js +104 -64
  594. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  595. package/dist/unstable/ai/McpProtocol.d.ts +30 -0
  596. package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
  597. package/dist/unstable/ai/McpProtocol.js +20 -0
  598. package/dist/unstable/ai/McpProtocol.js.map +1 -0
  599. package/dist/unstable/ai/McpSchema.d.ts +141 -75
  600. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  601. package/dist/unstable/ai/McpSchema.js +58 -50
  602. package/dist/unstable/ai/McpSchema.js.map +1 -1
  603. package/dist/unstable/ai/McpServer.d.ts +68 -59
  604. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  605. package/dist/unstable/ai/McpServer.js +694 -241
  606. package/dist/unstable/ai/McpServer.js.map +1 -1
  607. package/dist/unstable/ai/Model.d.ts +8 -19
  608. package/dist/unstable/ai/Model.d.ts.map +1 -1
  609. package/dist/unstable/ai/Model.js +9 -20
  610. package/dist/unstable/ai/Model.js.map +1 -1
  611. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  612. package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
  613. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  614. package/dist/unstable/ai/Prompt.d.ts +112 -38
  615. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  616. package/dist/unstable/ai/Prompt.js +53 -17
  617. package/dist/unstable/ai/Prompt.js.map +1 -1
  618. package/dist/unstable/ai/Response.d.ts +28 -14
  619. package/dist/unstable/ai/Response.d.ts.map +1 -1
  620. package/dist/unstable/ai/Response.js +9 -4
  621. package/dist/unstable/ai/Response.js.map +1 -1
  622. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  623. package/dist/unstable/ai/Telemetry.d.ts +46 -13
  624. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  625. package/dist/unstable/ai/Telemetry.js +18 -7
  626. package/dist/unstable/ai/Telemetry.js.map +1 -1
  627. package/dist/unstable/ai/Tokenizer.d.ts +14 -3
  628. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  629. package/dist/unstable/ai/Tokenizer.js +10 -2
  630. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  631. package/dist/unstable/ai/Tool.d.ts +59 -44
  632. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  633. package/dist/unstable/ai/Tool.js +48 -39
  634. package/dist/unstable/ai/Tool.js.map +1 -1
  635. package/dist/unstable/ai/Toolkit.d.ts +26 -8
  636. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  637. package/dist/unstable/ai/Toolkit.js +18 -4
  638. package/dist/unstable/ai/Toolkit.js.map +1 -1
  639. package/dist/unstable/ai/index.d.ts +4 -0
  640. package/dist/unstable/ai/index.d.ts.map +1 -1
  641. package/dist/unstable/ai/index.js +4 -0
  642. package/dist/unstable/ai/index.js.map +1 -1
  643. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  644. package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
  645. package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
  646. package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
  647. package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
  648. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
  649. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
  650. package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
  651. package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
  652. package/dist/unstable/ai/internal/structured-output.js +14 -15
  653. package/dist/unstable/ai/internal/structured-output.js.map +1 -1
  654. package/dist/unstable/cli/Argument.d.ts +273 -69
  655. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  656. package/dist/unstable/cli/Argument.js +111 -33
  657. package/dist/unstable/cli/Argument.js.map +1 -1
  658. package/dist/unstable/cli/CliConfig.js.map +1 -1
  659. package/dist/unstable/cli/CliError.d.ts +69 -76
  660. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  661. package/dist/unstable/cli/CliError.js +57 -61
  662. package/dist/unstable/cli/CliError.js.map +1 -1
  663. package/dist/unstable/cli/CliOutput.d.ts +35 -54
  664. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  665. package/dist/unstable/cli/CliOutput.js +26 -42
  666. package/dist/unstable/cli/CliOutput.js.map +1 -1
  667. package/dist/unstable/cli/Command.d.ts +705 -107
  668. package/dist/unstable/cli/Command.d.ts.map +1 -1
  669. package/dist/unstable/cli/Command.js +238 -42
  670. package/dist/unstable/cli/Command.js.map +1 -1
  671. package/dist/unstable/cli/Completions.js.map +1 -1
  672. package/dist/unstable/cli/Flag.d.ts +418 -138
  673. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  674. package/dist/unstable/cli/Flag.js +197 -71
  675. package/dist/unstable/cli/Flag.js.map +1 -1
  676. package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
  677. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  678. package/dist/unstable/cli/HelpDoc.d.ts +12 -4
  679. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  680. package/dist/unstable/cli/Param.d.ts +292 -78
  681. package/dist/unstable/cli/Param.d.ts.map +1 -1
  682. package/dist/unstable/cli/Param.js +128 -46
  683. package/dist/unstable/cli/Param.js.map +1 -1
  684. package/dist/unstable/cli/Primitive.d.ts +370 -149
  685. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  686. package/dist/unstable/cli/Primitive.js +344 -136
  687. package/dist/unstable/cli/Primitive.js.map +1 -1
  688. package/dist/unstable/cli/Prompt.d.ts +23 -14
  689. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  690. package/dist/unstable/cli/Prompt.js +23 -14
  691. package/dist/unstable/cli/Prompt.js.map +1 -1
  692. package/dist/unstable/cli/index.js.map +1 -1
  693. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  694. package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
  695. package/dist/unstable/cli/internal/command.js.map +1 -1
  696. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  697. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  698. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  699. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  700. package/dist/unstable/cli/internal/config.js.map +1 -1
  701. package/dist/unstable/cli/internal/help.js.map +1 -1
  702. package/dist/unstable/cli/internal/lexer.js +17 -7
  703. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  704. package/dist/unstable/cli/internal/parser.js +2 -2
  705. package/dist/unstable/cli/internal/parser.js.map +1 -1
  706. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  707. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  708. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  709. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  710. package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
  711. package/dist/unstable/cluster/ClusterSchema.js +8 -8
  712. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  713. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  714. package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
  715. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  716. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  717. package/dist/unstable/cluster/Entity.d.ts +10 -10
  718. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  719. package/dist/unstable/cluster/Entity.js +8 -8
  720. package/dist/unstable/cluster/Entity.js.map +1 -1
  721. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  722. package/dist/unstable/cluster/EntityId.js.map +1 -1
  723. package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
  724. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  725. package/dist/unstable/cluster/EntityProxy.js +4 -2
  726. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  727. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  728. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  729. package/dist/unstable/cluster/EntityResource.js +2 -2
  730. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  731. package/dist/unstable/cluster/EntityType.js.map +1 -1
  732. package/dist/unstable/cluster/Envelope.d.ts +3 -3
  733. package/dist/unstable/cluster/Envelope.js +3 -3
  734. package/dist/unstable/cluster/Envelope.js.map +1 -1
  735. package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
  736. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  737. package/dist/unstable/cluster/HttpRunner.js +6 -4
  738. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  739. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  740. package/dist/unstable/cluster/MachineId.js.map +1 -1
  741. package/dist/unstable/cluster/Message.d.ts +9 -9
  742. package/dist/unstable/cluster/Message.js +6 -6
  743. package/dist/unstable/cluster/Message.js.map +1 -1
  744. package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
  745. package/dist/unstable/cluster/MessageStorage.js +5 -5
  746. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  747. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  748. package/dist/unstable/cluster/Reply.js +4 -4
  749. package/dist/unstable/cluster/Reply.js.map +1 -1
  750. package/dist/unstable/cluster/Runner.js.map +1 -1
  751. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  752. package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
  753. package/dist/unstable/cluster/RunnerHealth.js +1 -1
  754. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  755. package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
  756. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  757. package/dist/unstable/cluster/RunnerServer.js +16 -16
  758. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  759. package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
  760. package/dist/unstable/cluster/RunnerStorage.js +1 -1
  761. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  762. package/dist/unstable/cluster/Runners.d.ts +6 -6
  763. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  764. package/dist/unstable/cluster/Runners.js +19 -10
  765. package/dist/unstable/cluster/Runners.js.map +1 -1
  766. package/dist/unstable/cluster/ShardId.js.map +1 -1
  767. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  768. package/dist/unstable/cluster/Sharding.js +3 -2
  769. package/dist/unstable/cluster/Sharding.js.map +1 -1
  770. package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
  771. package/dist/unstable/cluster/ShardingConfig.js +3 -3
  772. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  773. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  774. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  775. package/dist/unstable/cluster/Singleton.js.map +1 -1
  776. package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
  777. package/dist/unstable/cluster/SingletonAddress.js +1 -1
  778. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  779. package/dist/unstable/cluster/Snowflake.d.ts +8 -8
  780. package/dist/unstable/cluster/Snowflake.js +8 -8
  781. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  782. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  783. package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
  784. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  785. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  786. package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
  787. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  788. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  789. package/dist/unstable/cluster/index.js.map +1 -1
  790. package/dist/unstable/cluster/internal/entityManager.js +5 -5
  791. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  792. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  793. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  794. package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
  795. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  796. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  797. package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
  798. package/dist/unstable/devtools/DevTools.js.map +1 -1
  799. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  800. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  801. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  802. package/dist/unstable/devtools/index.js.map +1 -1
  803. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  804. package/dist/unstable/encoding/Msgpack.js +6 -8
  805. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  806. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  807. package/dist/unstable/encoding/Sse.d.ts +72 -8
  808. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  809. package/dist/unstable/encoding/Sse.js +58 -8
  810. package/dist/unstable/encoding/Sse.js.map +1 -1
  811. package/dist/unstable/encoding/index.js.map +1 -1
  812. package/dist/unstable/eventlog/Event.d.ts +20 -20
  813. package/dist/unstable/eventlog/Event.js.map +1 -1
  814. package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
  815. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  816. package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
  817. package/dist/unstable/eventlog/EventJournal.js +13 -13
  818. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  819. package/dist/unstable/eventlog/EventLog.d.ts +3 -3
  820. package/dist/unstable/eventlog/EventLog.js +3 -3
  821. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  822. package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
  823. package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
  824. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  825. package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
  826. package/dist/unstable/eventlog/EventLogMessage.js +1 -1
  827. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  828. package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
  829. package/dist/unstable/eventlog/EventLogRemote.js +1 -1
  830. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  831. package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
  832. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  833. package/dist/unstable/eventlog/EventLogServer.js +45 -21
  834. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  835. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
  836. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  837. package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
  838. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  839. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
  840. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  841. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
  842. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  843. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
  844. package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
  845. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  846. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  847. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  848. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  849. package/dist/unstable/eventlog/index.js.map +1 -1
  850. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
  851. package/dist/unstable/http/Cookies.d.ts +2 -2
  852. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  853. package/dist/unstable/http/Cookies.js +30 -18
  854. package/dist/unstable/http/Cookies.js.map +1 -1
  855. package/dist/unstable/http/Etag.d.ts +1 -1
  856. package/dist/unstable/http/Etag.js +1 -1
  857. package/dist/unstable/http/Etag.js.map +1 -1
  858. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  859. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  860. package/dist/unstable/http/Headers.d.ts +2 -2
  861. package/dist/unstable/http/Headers.js +2 -2
  862. package/dist/unstable/http/Headers.js.map +1 -1
  863. package/dist/unstable/http/HttpBody.d.ts +5 -3
  864. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  865. package/dist/unstable/http/HttpBody.js +11 -5
  866. package/dist/unstable/http/HttpBody.js.map +1 -1
  867. package/dist/unstable/http/HttpClient.d.ts +51 -44
  868. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  869. package/dist/unstable/http/HttpClient.js +46 -17
  870. package/dist/unstable/http/HttpClient.js.map +1 -1
  871. package/dist/unstable/http/HttpClientError.js.map +1 -1
  872. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  873. package/dist/unstable/http/HttpClientRequest.js +2 -0
  874. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  875. package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
  876. package/dist/unstable/http/HttpClientResponse.js +2 -2
  877. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  878. package/dist/unstable/http/HttpEffect.d.ts +6 -6
  879. package/dist/unstable/http/HttpEffect.js +3 -3
  880. package/dist/unstable/http/HttpEffect.js.map +1 -1
  881. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  882. package/dist/unstable/http/HttpMethod.d.ts +6 -9
  883. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  884. package/dist/unstable/http/HttpMethod.js +6 -9
  885. package/dist/unstable/http/HttpMethod.js.map +1 -1
  886. package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
  887. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  888. package/dist/unstable/http/HttpMiddleware.js +164 -39
  889. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  890. package/dist/unstable/http/HttpPlatform.d.ts +76 -0
  891. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  892. package/dist/unstable/http/HttpPlatform.js +32 -0
  893. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  894. package/dist/unstable/http/HttpRouter.d.ts +88 -89
  895. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  896. package/dist/unstable/http/HttpRouter.js +78 -79
  897. package/dist/unstable/http/HttpRouter.js.map +1 -1
  898. package/dist/unstable/http/HttpServer.d.ts +13 -13
  899. package/dist/unstable/http/HttpServer.js +6 -6
  900. package/dist/unstable/http/HttpServer.js.map +1 -1
  901. package/dist/unstable/http/HttpServerError.d.ts +2 -2
  902. package/dist/unstable/http/HttpServerError.js +2 -2
  903. package/dist/unstable/http/HttpServerError.js.map +1 -1
  904. package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
  905. package/dist/unstable/http/HttpServerRequest.js +4 -4
  906. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  907. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  908. package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
  909. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  910. package/dist/unstable/http/HttpServerResponse.js +10 -0
  911. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  912. package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
  913. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  914. package/dist/unstable/http/HttpStaticServer.js +35 -7
  915. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  916. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  917. package/dist/unstable/http/Multipart.d.ts +6 -6
  918. package/dist/unstable/http/Multipart.js +5 -5
  919. package/dist/unstable/http/Multipart.js.map +1 -1
  920. package/dist/unstable/http/Template.js.map +1 -1
  921. package/dist/unstable/http/Url.d.ts +33 -63
  922. package/dist/unstable/http/Url.d.ts.map +1 -1
  923. package/dist/unstable/http/Url.js +14 -28
  924. package/dist/unstable/http/Url.js.map +1 -1
  925. package/dist/unstable/http/UrlParams.d.ts +10 -18
  926. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  927. package/dist/unstable/http/UrlParams.js +9 -17
  928. package/dist/unstable/http/UrlParams.js.map +1 -1
  929. package/dist/unstable/http/index.js.map +1 -1
  930. package/dist/unstable/http/internal/compression.d.ts +2 -0
  931. package/dist/unstable/http/internal/compression.d.ts.map +1 -0
  932. package/dist/unstable/http/internal/compression.js +155 -0
  933. package/dist/unstable/http/internal/compression.js.map +1 -0
  934. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
  935. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  936. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
  937. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  938. package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
  939. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  940. package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
  941. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  942. package/dist/unstable/httpapi/HttpApiClient.js +11 -13
  943. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  944. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
  945. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  946. package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
  947. package/dist/unstable/httpapi/HttpApiError.js +13 -13
  948. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  949. package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
  950. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  951. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
  952. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  953. package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
  954. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  955. package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
  956. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  957. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  958. package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
  959. package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
  960. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  961. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  962. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  963. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  964. package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
  965. package/dist/unstable/httpapi/OpenApi.js +13 -13
  966. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  967. package/dist/unstable/httpapi/index.js.map +1 -1
  968. package/dist/unstable/httpapi/internal/html.js.map +1 -1
  969. package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
  970. package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
  971. package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
  972. package/dist/unstable/observability/Otlp.js.map +1 -1
  973. package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
  974. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  975. package/dist/unstable/observability/OtlpExporter.js +17 -4
  976. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  977. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  978. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
  979. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  980. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  981. package/dist/unstable/observability/OtlpResource.d.ts +16 -7
  982. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  983. package/dist/unstable/observability/OtlpResource.js +21 -12
  984. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  985. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  986. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  987. package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
  988. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  989. package/dist/unstable/observability/PrometheusMetrics.js +10 -3
  990. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  991. package/dist/unstable/observability/index.js.map +1 -1
  992. package/dist/unstable/observability/internal/otlpEnv.js +1 -1
  993. package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
  994. package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
  995. package/dist/unstable/observability/internal/protobuf.js +3 -0
  996. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  997. package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
  998. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  999. package/dist/unstable/persistence/KeyValueStore.js +22 -13
  1000. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1001. package/dist/unstable/persistence/Persistable.d.ts +8 -8
  1002. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1003. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1004. package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
  1005. package/dist/unstable/persistence/PersistedQueue.js +6 -6
  1006. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1007. package/dist/unstable/persistence/Persistence.d.ts +3 -3
  1008. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1009. package/dist/unstable/persistence/Persistence.js +91 -15
  1010. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1011. package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
  1012. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1013. package/dist/unstable/persistence/RateLimiter.js +24 -13
  1014. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1015. package/dist/unstable/persistence/Redis.d.ts +2 -2
  1016. package/dist/unstable/persistence/Redis.js +1 -1
  1017. package/dist/unstable/persistence/Redis.js.map +1 -1
  1018. package/dist/unstable/persistence/index.js.map +1 -1
  1019. package/dist/unstable/process/ChildProcess.d.ts +64 -21
  1020. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1021. package/dist/unstable/process/ChildProcess.js +14 -5
  1022. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1023. package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
  1024. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1025. package/dist/unstable/process/ChildProcessSpawner.js +1 -1
  1026. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1027. package/dist/unstable/process/index.js.map +1 -1
  1028. package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
  1029. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1030. package/dist/unstable/reactivity/AsyncResult.js +10 -10
  1031. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1032. package/dist/unstable/reactivity/Atom.d.ts +25 -22
  1033. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1034. package/dist/unstable/reactivity/Atom.js +14 -13
  1035. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1036. package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
  1037. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1038. package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
  1039. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1040. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1041. package/dist/unstable/reactivity/AtomRegistry.js +24 -3
  1042. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1043. package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
  1044. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1045. package/dist/unstable/reactivity/AtomRpc.js +4 -1
  1046. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1047. package/dist/unstable/reactivity/Hydration.d.ts +1 -1
  1048. package/dist/unstable/reactivity/Hydration.js +1 -1
  1049. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1050. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1051. package/dist/unstable/reactivity/index.js.map +1 -1
  1052. package/dist/unstable/rpc/Rpc.d.ts +35 -33
  1053. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1054. package/dist/unstable/rpc/Rpc.js +4 -2
  1055. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1056. package/dist/unstable/rpc/RpcClient.d.ts +12 -12
  1057. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1058. package/dist/unstable/rpc/RpcClient.js +12 -11
  1059. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1060. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1061. package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
  1062. package/dist/unstable/rpc/RpcGroup.js +1 -1
  1063. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1064. package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
  1065. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1066. package/dist/unstable/rpc/RpcMessage.js +6 -6
  1067. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1068. package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
  1069. package/dist/unstable/rpc/RpcMiddleware.js +1 -1
  1070. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1071. package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
  1072. package/dist/unstable/rpc/RpcSchema.js +3 -3
  1073. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1074. package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
  1075. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1076. package/dist/unstable/rpc/RpcSerialization.js +175 -96
  1077. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1078. package/dist/unstable/rpc/RpcServer.d.ts +13 -13
  1079. package/dist/unstable/rpc/RpcServer.js +17 -13
  1080. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1081. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1082. package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
  1083. package/dist/unstable/rpc/RpcWorker.js +4 -4
  1084. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1085. package/dist/unstable/rpc/Utils.js.map +1 -1
  1086. package/dist/unstable/rpc/index.js.map +1 -1
  1087. package/dist/unstable/schema/Model.d.ts +52 -50
  1088. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1089. package/dist/unstable/schema/Model.js +35 -33
  1090. package/dist/unstable/schema/Model.js.map +1 -1
  1091. package/dist/unstable/schema/VariantSchema.d.ts +5 -5
  1092. package/dist/unstable/schema/VariantSchema.js +2 -2
  1093. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1094. package/dist/unstable/schema/index.js.map +1 -1
  1095. package/dist/unstable/socket/Socket.d.ts +11 -3
  1096. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1097. package/dist/unstable/socket/Socket.js +9 -4
  1098. package/dist/unstable/socket/Socket.js.map +1 -1
  1099. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1100. package/dist/unstable/socket/index.js.map +1 -1
  1101. package/dist/unstable/sql/Migrator.js.map +1 -1
  1102. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  1103. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1104. package/dist/unstable/sql/SqlClient.js +2 -2
  1105. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1106. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1107. package/dist/unstable/sql/SqlError.js.map +1 -1
  1108. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  1109. package/dist/unstable/sql/SqlModel.js +2 -2
  1110. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1111. package/dist/unstable/sql/SqlResolver.d.ts +5 -5
  1112. package/dist/unstable/sql/SqlResolver.js +2 -2
  1113. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1114. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1115. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1116. package/dist/unstable/sql/Statement.d.ts +6 -6
  1117. package/dist/unstable/sql/Statement.js +15 -15
  1118. package/dist/unstable/sql/Statement.js.map +1 -1
  1119. package/dist/unstable/sql/index.js.map +1 -1
  1120. package/dist/unstable/workers/Transferable.d.ts +1 -1
  1121. package/dist/unstable/workers/Transferable.js +1 -1
  1122. package/dist/unstable/workers/Transferable.js.map +1 -1
  1123. package/dist/unstable/workers/Worker.d.ts +2 -2
  1124. package/dist/unstable/workers/Worker.js +2 -2
  1125. package/dist/unstable/workers/Worker.js.map +1 -1
  1126. package/dist/unstable/workers/WorkerError.d.ts +7 -7
  1127. package/dist/unstable/workers/WorkerError.js +6 -6
  1128. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1129. package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
  1130. package/dist/unstable/workers/WorkerRunner.js +1 -1
  1131. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1132. package/dist/unstable/workers/index.js.map +1 -1
  1133. package/dist/unstable/workflow/Activity.d.ts +2 -2
  1134. package/dist/unstable/workflow/Activity.js +2 -2
  1135. package/dist/unstable/workflow/Activity.js.map +1 -1
  1136. package/dist/unstable/workflow/DurableClock.d.ts +1 -1
  1137. package/dist/unstable/workflow/DurableClock.js +1 -1
  1138. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1139. package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
  1140. package/dist/unstable/workflow/DurableDeferred.js +5 -5
  1141. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1142. package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
  1143. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  1144. package/dist/unstable/workflow/DurableQueue.js +22 -20
  1145. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  1146. package/dist/unstable/workflow/Workflow.d.ts +21 -21
  1147. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1148. package/dist/unstable/workflow/Workflow.js +13 -14
  1149. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1150. package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
  1151. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1152. package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
  1153. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1154. package/dist/unstable/workflow/WorkflowProxy.js +4 -2
  1155. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1156. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1157. package/dist/unstable/workflow/index.js.map +1 -1
  1158. package/dist/unstable/workflow/internal/crypto.js.map +1 -1
  1159. package/package.json +5 -6
  1160. package/src/Array.ts +982 -1045
  1161. package/src/BigDecimal.ts +433 -756
  1162. package/src/BigInt.ts +213 -269
  1163. package/src/Boolean.ts +146 -188
  1164. package/src/Cache.ts +409 -255
  1165. package/src/Cause.ts +167 -277
  1166. package/src/Channel.ts +891 -816
  1167. package/src/ChannelSchema.ts +1 -1
  1168. package/src/Chunk.ts +841 -1181
  1169. package/src/Clock.ts +181 -49
  1170. package/src/Combiner.ts +20 -33
  1171. package/src/Config.ts +615 -332
  1172. package/src/ConfigProvider.ts +214 -120
  1173. package/src/Console.ts +289 -39
  1174. package/src/Context.ts +319 -378
  1175. package/src/Cron.ts +68 -77
  1176. package/src/Crypto.ts +13 -15
  1177. package/src/Data.ts +60 -80
  1178. package/src/DateTime.ts +564 -660
  1179. package/src/Deferred.ts +253 -256
  1180. package/src/Duration.ts +216 -308
  1181. package/src/Effect.ts +2893 -3279
  1182. package/src/Encoding.ts +22 -40
  1183. package/src/Equal.ts +49 -39
  1184. package/src/Equivalence.ts +103 -105
  1185. package/src/ErrorReporter.ts +51 -27
  1186. package/src/ExecutionPlan.ts +13 -55
  1187. package/src/Exit.ts +116 -192
  1188. package/src/Fiber.ts +81 -148
  1189. package/src/FiberHandle.ts +152 -105
  1190. package/src/FiberMap.ts +225 -174
  1191. package/src/FiberSet.ts +124 -82
  1192. package/src/FileSystem.ts +155 -263
  1193. package/src/Filter.ts +61 -33
  1194. package/src/Formatter.ts +54 -56
  1195. package/src/Function.ts +76 -145
  1196. package/src/Graph.ts +416 -770
  1197. package/src/HKT.ts +12 -6
  1198. package/src/Hash.ts +52 -83
  1199. package/src/HashMap.ts +319 -411
  1200. package/src/HashRing.ts +1 -0
  1201. package/src/HashSet.ts +177 -284
  1202. package/src/Inspectable.ts +12 -12
  1203. package/src/Iterable.ts +620 -786
  1204. package/src/JsonPatch.ts +58 -112
  1205. package/src/JsonPointer.ts +8 -8
  1206. package/src/JsonSchema.ts +402 -244
  1207. package/src/Latch.ts +23 -35
  1208. package/src/Layer.ts +359 -260
  1209. package/src/LayerMap.ts +49 -29
  1210. package/src/LayerRef.ts +6 -2
  1211. package/src/LogLevel.ts +114 -214
  1212. package/src/Logger.ts +344 -697
  1213. package/src/ManagedRuntime.ts +7 -5
  1214. package/src/Match.ts +217 -252
  1215. package/src/Metric.ts +516 -1089
  1216. package/src/MutableHashMap.ts +218 -255
  1217. package/src/MutableHashSet.ts +84 -89
  1218. package/src/MutableList.ts +73 -370
  1219. package/src/MutableRef.ts +420 -243
  1220. package/src/Newtype.ts +21 -14
  1221. package/src/NonEmptyIterable.ts +7 -137
  1222. package/src/Number.ts +196 -233
  1223. package/src/Optic.ts +243 -383
  1224. package/src/Option.ts +447 -812
  1225. package/src/Order.ts +109 -109
  1226. package/src/Ordering.ts +20 -23
  1227. package/src/Path.ts +38 -41
  1228. package/src/Pipeable.ts +6 -5
  1229. package/src/PlatformError.ts +4 -4
  1230. package/src/Pool.ts +4 -2
  1231. package/src/Predicate.ts +200 -181
  1232. package/src/PrimaryKey.ts +7 -7
  1233. package/src/PubSub.ts +526 -552
  1234. package/src/Pull.ts +24 -18
  1235. package/src/Queue.ts +200 -159
  1236. package/src/Random.ts +49 -74
  1237. package/src/RcMap.ts +121 -63
  1238. package/src/RcRef.ts +24 -13
  1239. package/src/Record.ts +291 -488
  1240. package/src/Redactable.ts +10 -3
  1241. package/src/Redacted.ts +25 -25
  1242. package/src/Reducer.ts +8 -15
  1243. package/src/Ref.ts +221 -361
  1244. package/src/References.ts +102 -168
  1245. package/src/RegExp.ts +10 -14
  1246. package/src/Request.ts +31 -21
  1247. package/src/RequestResolver.ts +202 -91
  1248. package/src/Result.ts +312 -484
  1249. package/src/Runtime.ts +50 -75
  1250. package/src/Schedule.ts +308 -1734
  1251. package/src/Scheduler.ts +20 -7
  1252. package/src/Schema.ts +716 -745
  1253. package/src/SchemaAST.ts +466 -358
  1254. package/src/SchemaError.ts +7 -6
  1255. package/src/SchemaGetter.ts +242 -190
  1256. package/src/SchemaIssue.ts +89 -275
  1257. package/src/SchemaParser.ts +180 -93
  1258. package/src/SchemaRepresentation.ts +22 -40
  1259. package/src/SchemaTransformation.ts +129 -88
  1260. package/src/Scope.ts +123 -151
  1261. package/src/ScopedRef.ts +4 -4
  1262. package/src/Semaphore.ts +152 -51
  1263. package/src/Sink.ts +128 -113
  1264. package/src/Stdio.ts +1 -1
  1265. package/src/Stream.ts +2602 -3123
  1266. package/src/String.ts +275 -312
  1267. package/src/Struct.ts +109 -114
  1268. package/src/SubscriptionRef.ts +284 -252
  1269. package/src/Symbol.ts +3 -3
  1270. package/src/Terminal.ts +2 -2
  1271. package/src/Tracer.ts +102 -55
  1272. package/src/Trie.ts +287 -679
  1273. package/src/Tuple.ts +92 -127
  1274. package/src/TxChunk.ts +201 -121
  1275. package/src/TxDeferred.ts +62 -46
  1276. package/src/TxHashMap.ts +645 -799
  1277. package/src/TxHashSet.ts +443 -356
  1278. package/src/TxPriorityQueue.ts +130 -98
  1279. package/src/TxPubSub.ts +107 -80
  1280. package/src/TxQueue.ts +214 -183
  1281. package/src/TxReentrantLock.ts +97 -66
  1282. package/src/TxRef.ts +51 -32
  1283. package/src/TxSemaphore.ts +129 -95
  1284. package/src/TxSubscriptionRef.ts +97 -70
  1285. package/src/Types.ts +126 -67
  1286. package/src/Unify.ts +45 -65
  1287. package/src/Utils.ts +23 -16
  1288. package/src/internal/core.ts +2 -2
  1289. package/src/internal/dateTime.ts +6 -0
  1290. package/src/internal/effect.ts +93 -48
  1291. package/src/internal/persistence.ts +2 -0
  1292. package/src/internal/references.ts +3 -2
  1293. package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
  1294. package/src/internal/schema/fromRepresentation.ts +10 -16
  1295. package/src/internal/schema/parser.ts +22 -0
  1296. package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
  1297. package/src/internal/schema/toRepresentation.ts +104 -119
  1298. package/src/internal/trie.ts +10 -11
  1299. package/src/testing/FastCheck.ts +8 -7
  1300. package/src/testing/TestClock.ts +72 -30
  1301. package/src/testing/TestConsole.ts +32 -31
  1302. package/src/testing/TestSchema.ts +29 -29
  1303. package/src/unstable/ai/AiError.ts +95 -118
  1304. package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
  1305. package/src/unstable/ai/Chat.ts +132 -97
  1306. package/src/unstable/ai/IdGenerator.ts +32 -28
  1307. package/src/unstable/ai/LanguageModel.ts +107 -67
  1308. package/src/unstable/ai/McpProtocol.ts +48 -0
  1309. package/src/unstable/ai/McpSchema.ts +60 -50
  1310. package/src/unstable/ai/McpServer.ts +930 -304
  1311. package/src/unstable/ai/Model.ts +9 -20
  1312. package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
  1313. package/src/unstable/ai/Prompt.ts +145 -43
  1314. package/src/unstable/ai/Response.ts +28 -14
  1315. package/src/unstable/ai/Telemetry.ts +46 -13
  1316. package/src/unstable/ai/Tokenizer.ts +14 -3
  1317. package/src/unstable/ai/Tool.ts +59 -44
  1318. package/src/unstable/ai/Toolkit.ts +26 -8
  1319. package/src/unstable/ai/index.ts +5 -0
  1320. package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
  1321. package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
  1322. package/src/unstable/ai/internal/structured-output.ts +13 -18
  1323. package/src/unstable/cli/Argument.ts +273 -69
  1324. package/src/unstable/cli/CliError.ts +69 -76
  1325. package/src/unstable/cli/CliOutput.ts +44 -58
  1326. package/src/unstable/cli/Command.ts +705 -107
  1327. package/src/unstable/cli/Flag.ts +418 -138
  1328. package/src/unstable/cli/GlobalFlag.ts +1 -1
  1329. package/src/unstable/cli/HelpDoc.ts +12 -4
  1330. package/src/unstable/cli/Param.ts +292 -78
  1331. package/src/unstable/cli/Primitive.ts +370 -149
  1332. package/src/unstable/cli/Prompt.ts +28 -14
  1333. package/src/unstable/cli/internal/lexer.ts +8 -2
  1334. package/src/unstable/cli/internal/parser.ts +2 -2
  1335. package/src/unstable/cluster/ClusterSchema.ts +8 -8
  1336. package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
  1337. package/src/unstable/cluster/Entity.ts +15 -16
  1338. package/src/unstable/cluster/EntityProxy.ts +4 -2
  1339. package/src/unstable/cluster/EntityResource.ts +2 -2
  1340. package/src/unstable/cluster/Envelope.ts +3 -3
  1341. package/src/unstable/cluster/HttpRunner.ts +6 -4
  1342. package/src/unstable/cluster/Message.ts +9 -9
  1343. package/src/unstable/cluster/MessageStorage.ts +15 -15
  1344. package/src/unstable/cluster/Reply.ts +4 -6
  1345. package/src/unstable/cluster/RunnerHealth.ts +1 -1
  1346. package/src/unstable/cluster/RunnerServer.ts +41 -8
  1347. package/src/unstable/cluster/RunnerStorage.ts +2 -2
  1348. package/src/unstable/cluster/Runners.ts +23 -12
  1349. package/src/unstable/cluster/Sharding.ts +7 -8
  1350. package/src/unstable/cluster/ShardingConfig.ts +3 -3
  1351. package/src/unstable/cluster/SingletonAddress.ts +1 -1
  1352. package/src/unstable/cluster/Snowflake.ts +8 -8
  1353. package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
  1354. package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
  1355. package/src/unstable/cluster/internal/entityManager.ts +11 -15
  1356. package/src/unstable/encoding/Msgpack.ts +6 -8
  1357. package/src/unstable/encoding/Sse.ts +98 -16
  1358. package/src/unstable/eventlog/Event.ts +20 -20
  1359. package/src/unstable/eventlog/EventGroup.ts +4 -4
  1360. package/src/unstable/eventlog/EventJournal.ts +15 -15
  1361. package/src/unstable/eventlog/EventLog.ts +3 -3
  1362. package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
  1363. package/src/unstable/eventlog/EventLogMessage.ts +2 -2
  1364. package/src/unstable/eventlog/EventLogRemote.ts +1 -1
  1365. package/src/unstable/eventlog/EventLogServer.ts +41 -7
  1366. package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
  1367. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
  1368. package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
  1369. package/src/unstable/http/Cookies.ts +35 -21
  1370. package/src/unstable/http/Etag.ts +1 -1
  1371. package/src/unstable/http/FetchHttpClient.ts +3 -1
  1372. package/src/unstable/http/Headers.ts +2 -2
  1373. package/src/unstable/http/HttpBody.ts +20 -5
  1374. package/src/unstable/http/HttpClient.ts +83 -55
  1375. package/src/unstable/http/HttpClientRequest.ts +2 -0
  1376. package/src/unstable/http/HttpClientResponse.ts +4 -4
  1377. package/src/unstable/http/HttpEffect.ts +8 -8
  1378. package/src/unstable/http/HttpMethod.ts +6 -9
  1379. package/src/unstable/http/HttpMiddleware.ts +202 -39
  1380. package/src/unstable/http/HttpPlatform.ts +95 -0
  1381. package/src/unstable/http/HttpRouter.ts +102 -98
  1382. package/src/unstable/http/HttpServer.ts +13 -13
  1383. package/src/unstable/http/HttpServerError.ts +2 -2
  1384. package/src/unstable/http/HttpServerRequest.ts +4 -4
  1385. package/src/unstable/http/HttpServerResponse.ts +30 -0
  1386. package/src/unstable/http/HttpStaticServer.ts +35 -7
  1387. package/src/unstable/http/Multipart.ts +6 -6
  1388. package/src/unstable/http/Url.ts +33 -63
  1389. package/src/unstable/http/UrlParams.ts +10 -18
  1390. package/src/unstable/http/internal/compression.ts +196 -0
  1391. package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
  1392. package/src/unstable/httpapi/HttpApiClient.ts +14 -14
  1393. package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
  1394. package/src/unstable/httpapi/HttpApiError.ts +13 -13
  1395. package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
  1396. package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
  1397. package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
  1398. package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
  1399. package/src/unstable/httpapi/OpenApi.ts +13 -13
  1400. package/src/unstable/observability/OtlpExporter.ts +31 -19
  1401. package/src/unstable/observability/OtlpMetrics.ts +4 -1
  1402. package/src/unstable/observability/OtlpResource.ts +26 -17
  1403. package/src/unstable/observability/PrometheusMetrics.ts +13 -4
  1404. package/src/unstable/observability/internal/otlpEnv.ts +1 -1
  1405. package/src/unstable/observability/internal/protobuf.ts +3 -0
  1406. package/src/unstable/persistence/KeyValueStore.ts +72 -49
  1407. package/src/unstable/persistence/Persistable.ts +8 -8
  1408. package/src/unstable/persistence/PersistedQueue.ts +6 -6
  1409. package/src/unstable/persistence/Persistence.ts +126 -19
  1410. package/src/unstable/persistence/RateLimiter.ts +26 -15
  1411. package/src/unstable/persistence/Redis.ts +2 -2
  1412. package/src/unstable/process/ChildProcess.ts +64 -21
  1413. package/src/unstable/process/ChildProcessSpawner.ts +21 -10
  1414. package/src/unstable/reactivity/AsyncResult.ts +12 -13
  1415. package/src/unstable/reactivity/Atom.ts +28 -25
  1416. package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
  1417. package/src/unstable/reactivity/AtomRegistry.ts +24 -3
  1418. package/src/unstable/reactivity/AtomRpc.ts +5 -4
  1419. package/src/unstable/reactivity/Hydration.ts +1 -1
  1420. package/src/unstable/rpc/Rpc.ts +35 -33
  1421. package/src/unstable/rpc/RpcClient.ts +16 -15
  1422. package/src/unstable/rpc/RpcGroup.ts +8 -8
  1423. package/src/unstable/rpc/RpcMessage.ts +31 -30
  1424. package/src/unstable/rpc/RpcMiddleware.ts +10 -10
  1425. package/src/unstable/rpc/RpcSchema.ts +4 -4
  1426. package/src/unstable/rpc/RpcSerialization.ts +167 -68
  1427. package/src/unstable/rpc/RpcServer.ts +18 -15
  1428. package/src/unstable/rpc/RpcWorker.ts +5 -5
  1429. package/src/unstable/schema/Model.ts +52 -50
  1430. package/src/unstable/schema/VariantSchema.ts +5 -5
  1431. package/src/unstable/socket/Socket.ts +17 -4
  1432. package/src/unstable/sql/SqlClient.ts +5 -6
  1433. package/src/unstable/sql/SqlModel.ts +2 -2
  1434. package/src/unstable/sql/SqlResolver.ts +5 -5
  1435. package/src/unstable/sql/Statement.ts +24 -23
  1436. package/src/unstable/workers/Transferable.ts +1 -1
  1437. package/src/unstable/workers/Worker.ts +2 -2
  1438. package/src/unstable/workers/WorkerError.ts +7 -7
  1439. package/src/unstable/workers/WorkerRunner.ts +1 -1
  1440. package/src/unstable/workflow/Activity.ts +2 -2
  1441. package/src/unstable/workflow/DurableClock.ts +1 -1
  1442. package/src/unstable/workflow/DurableDeferred.ts +10 -10
  1443. package/src/unstable/workflow/DurableQueue.ts +22 -20
  1444. package/src/unstable/workflow/Workflow.ts +23 -23
  1445. package/src/unstable/workflow/WorkflowEngine.ts +1 -1
  1446. package/src/unstable/workflow/WorkflowProxy.ts +4 -2
  1447. package/dist/internal/version.d.ts +0 -3
  1448. package/dist/internal/version.d.ts.map +0 -1
  1449. package/dist/internal/version.js +0 -2
  1450. package/dist/internal/version.js.map +0 -1
  1451. package/src/internal/version.ts +0 -2
package/src/Channel.ts CHANGED
@@ -26,6 +26,7 @@ import * as Iterable from "./Iterable.ts"
26
26
  import * as Latch from "./Latch.ts"
27
27
  import * as Layer from "./Layer.ts"
28
28
  import type { Severity } from "./LogLevel.ts"
29
+ import * as MutableRef from "./MutableRef.ts"
29
30
  import * as Option from "./Option.ts"
30
31
  import type { Pipeable } from "./Pipeable.ts"
31
32
  import { pipeArguments } from "./Pipeable.ts"
@@ -67,12 +68,12 @@ export const TypeId: TypeId = "~effect/Channel"
67
68
  *
68
69
  * **Example** (Checking for channels)
69
70
  *
70
- * ```ts
71
+ * ```ts import.meta.vitest
71
72
  * import { Channel } from "effect"
72
73
  *
73
74
  * const channel = Channel.succeed(42)
74
- * console.log(Channel.isChannel(channel)) // true
75
- * console.log(Channel.isChannel("not a channel")) // false
75
+ * Channel.isChannel(channel) // => true
76
+ * Channel.isChannel("not a channel") // => false
76
77
  * ```
77
78
  *
78
79
  * @category guards
@@ -109,8 +110,8 @@ export const isChannel = (
109
110
  *
110
111
  * **Example** (Typing channels)
111
112
  *
112
- * ```ts
113
- * import type { Channel } from "effect"
113
+ * ```ts import.meta.vitest
114
+ * import { Channel, Effect } from "effect"
114
115
  *
115
116
  * // A channel that outputs numbers and requires no environment
116
117
  * type NumberChannel = Channel.Channel<number>
@@ -128,6 +129,9 @@ export const isChannel = (
128
129
  * boolean, // InDone - input completion
129
130
  * { db: string } // Env - required environment
130
131
  * >
132
+ *
133
+ * const channel: NumberChannel = Channel.succeed(1)
134
+ * Effect.runSync(Channel.runCollect(channel)) // => [1]
131
135
  * ```
132
136
  *
133
137
  * @category models
@@ -264,12 +268,13 @@ const ChannelProto = {
264
268
  *
265
269
  * **Example** (Creating channels from transforms)
266
270
  *
267
- * ```ts
271
+ * ```ts import.meta.vitest
268
272
  * import { Channel, Effect } from "effect"
269
273
  *
270
274
  * const channel = Channel.fromTransform((upstream, scope) =>
271
275
  * Effect.succeed(upstream)
272
276
  * )
277
+ * await Effect.runPromise(Channel.runCollect(channel)) // => []
273
278
  * ```
274
279
  *
275
280
  * @category constructors
@@ -300,7 +305,7 @@ export const fromTransform = <OutElem, OutErr, OutDone, InElem, InErr, InDone, E
300
305
  *
301
306
  * **Example** (Transforming pull behavior)
302
307
  *
303
- * ```ts
308
+ * ```ts import.meta.vitest
304
309
  * import { Channel, Effect } from "effect"
305
310
  *
306
311
  * // Transform a channel by modifying its pull behavior
@@ -313,7 +318,7 @@ export const fromTransform = <OutElem, OutErr, OutDone, InElem, InErr, InDone, E
313
318
  * Effect.map(pull, (value) => value * 2)
314
319
  * )
315
320
  * )
316
- * // Outputs: 2, 4, 6
321
+ * await Effect.runPromise(Channel.runCollect(transformedChannel)) // => [2, 4, 6]
317
322
  * ```
318
323
  *
319
324
  * @category constructors
@@ -354,12 +359,18 @@ export const transformPull = <
354
359
  *
355
360
  * **Example** (Creating channels from pulls)
356
361
  *
357
- * ```ts
358
- * import { Channel, Effect } from "effect"
362
+ * ```ts import.meta.vitest
363
+ * import { Cause, Channel, Effect } from "effect"
359
364
  *
360
- * const channel = Channel.fromPull(
361
- * Effect.succeed(Effect.succeed(42))
362
- * )
365
+ * const channel = Channel.fromPull(Effect.sync(() => {
366
+ * let emitted = false
367
+ * return Effect.suspend(() => {
368
+ * if (emitted) return Cause.done()
369
+ * emitted = true
370
+ * return Effect.succeed(42)
371
+ * })
372
+ * }))
373
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [42]
363
374
  * ```
364
375
  *
365
376
  * @category constructors
@@ -410,12 +421,13 @@ export const fromTransformBracket = <OutElem, OutErr, OutDone, InElem, InErr, In
410
421
  *
411
422
  * **Example** (Extracting channel transforms)
412
423
  *
413
- * ```ts
414
- * import { Channel } from "effect"
424
+ * ```ts import.meta.vitest
425
+ * import { Channel, Effect } from "effect"
415
426
  *
416
427
  * const channel = Channel.succeed(42)
417
428
  * const transform = Channel.toTransform(channel)
418
- * // transform can now be used directly
429
+ * typeof transform // => "function"
430
+ * Effect.runSync(Channel.runCollect(channel)) // => [42]
419
431
  * ```
420
432
  *
421
433
  * @category destructors
@@ -433,10 +445,10 @@ export const toTransform = <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env
433
445
  *
434
446
  * **Example** (Reading the default chunk size)
435
447
  *
436
- * ```ts
448
+ * ```ts import.meta.vitest
437
449
  * import { Channel } from "effect"
438
450
  *
439
- * console.log(Channel.DefaultChunkSize) // 4096
451
+ * Channel.DefaultChunkSize // => 4096
440
452
  * ```
441
453
  *
442
454
  * @category constants
@@ -465,7 +477,7 @@ const asyncQueue = <A, E = never, R = never>(
465
477
  *
466
478
  * **Example** (Creating channels from callbacks)
467
479
  *
468
- * ```ts
480
+ * ```ts import.meta.vitest
469
481
  * import { Channel, Effect, Queue } from "effect"
470
482
  *
471
483
  * const channel = Channel.callback<number>((queue) =>
@@ -473,8 +485,10 @@ const asyncQueue = <A, E = never, R = never>(
473
485
  * yield* Queue.offer(queue, 1)
474
486
  * yield* Queue.offer(queue, 2)
475
487
  * yield* Queue.offer(queue, 3)
488
+ * yield* Queue.end(queue)
476
489
  * })
477
490
  * )
491
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [1, 2, 3]
478
492
  * ```
479
493
  *
480
494
  * @category constructors
@@ -494,14 +508,15 @@ export const callback = <A, E = never, R = never>(
494
508
  *
495
509
  * **Example** (Creating array channels from callbacks)
496
510
  *
497
- * ```ts
511
+ * ```ts import.meta.vitest
498
512
  * import { Channel, Effect, Queue } from "effect"
499
513
  *
500
514
  * const channel = Channel.callbackArray<number>(Effect.fn(function*(queue) {
501
515
  * yield* Queue.offer(queue, 1)
502
516
  * yield* Queue.offer(queue, 2)
517
+ * yield* Queue.end(queue)
503
518
  * }))
504
- * // Emits arrays of numbers instead of individual numbers
519
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [[1, 2]]
505
520
  * ```
506
521
  *
507
522
  * @category constructors
@@ -521,11 +536,11 @@ export const callbackArray = <A, E = never, R = never>(
521
536
  *
522
537
  * **Example** (Suspending channel creation)
523
538
  *
524
- * ```ts
525
- * import { Channel } from "effect"
539
+ * ```ts import.meta.vitest
540
+ * import { Channel, Effect } from "effect"
526
541
  *
527
542
  * const channel = Channel.suspend(() => Channel.succeed(42))
528
- * // The inner channel is not created until the suspended channel is run
543
+ * Effect.runSync(Channel.runCollect(channel)) // => [42]
529
544
  * ```
530
545
  *
531
546
  * @category constructors
@@ -548,14 +563,16 @@ export const suspend = <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
548
563
  *
549
564
  * **Example** (Managing resources with acquire-use-release)
550
565
  *
551
- * ```ts
566
+ * ```ts import.meta.vitest
552
567
  * import { Channel, Effect } from "effect"
553
568
  *
569
+ * const released: Array<string> = []
554
570
  * const channel = Channel.acquireUseRelease(
555
571
  * Effect.succeed("resource"),
556
572
  * (resource) => Channel.succeed(resource.toUpperCase()),
557
- * (resource, exit) => Effect.log(`Released: ${resource}`)
573
+ * (resource, exit) => Effect.sync(() => released.push(resource))
558
574
  * )
575
+ * const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["RESOURCE"], ["resource"]]
559
576
  * ```
560
577
  *
561
578
  * @category constructors
@@ -591,13 +608,15 @@ export const acquireUseRelease = <A, E, R, OutElem, OutErr, OutDone, InElem, InE
591
608
  *
592
609
  * **Example** (Managing resources with acquire-release)
593
610
  *
594
- * ```ts
611
+ * ```ts import.meta.vitest
595
612
  * import { Channel, Effect } from "effect"
596
613
  *
614
+ * const released: Array<string> = []
597
615
  * const channel = Channel.acquireRelease(
598
616
  * Effect.succeed("resource"),
599
- * (resource, exit) => Effect.log(`Released: ${resource}`)
617
+ * (resource, exit) => Effect.sync(() => released.push(resource))
600
618
  * )
619
+ * const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["resource"], ["resource"]]
601
620
  * ```
602
621
  *
603
622
  * @category constructors
@@ -616,13 +635,15 @@ export const acquireRelease: {
616
635
  *
617
636
  * **Example** (Managing resources with acquire-release)
618
637
  *
619
- * ```ts
638
+ * ```ts import.meta.vitest
620
639
  * import { Channel, Effect } from "effect"
621
640
  *
641
+ * const released: Array<string> = []
622
642
  * const channel = Channel.acquireRelease(
623
643
  * Effect.succeed("resource"),
624
- * (resource, exit) => Effect.log(`Released: ${resource}`)
644
+ * (resource, exit) => Effect.sync(() => released.push(resource))
625
645
  * )
646
+ * const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["resource"], ["resource"]]
626
647
  * ```
627
648
  *
628
649
  * @category constructors
@@ -641,13 +662,15 @@ export const acquireRelease: {
641
662
  *
642
663
  * **Example** (Managing resources with acquire-release)
643
664
  *
644
- * ```ts
665
+ * ```ts import.meta.vitest
645
666
  * import { Channel, Effect } from "effect"
646
667
  *
668
+ * const released: Array<string> = []
647
669
  * const channel = Channel.acquireRelease(
648
670
  * Effect.succeed("resource"),
649
- * (resource, exit) => Effect.log(`Released: ${resource}`)
671
+ * (resource, exit) => Effect.sync(() => released.push(resource))
650
672
  * )
673
+ * const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["resource"], ["resource"]]
651
674
  * ```
652
675
  *
653
676
  * @category constructors
@@ -671,12 +694,12 @@ export const acquireRelease: {
671
694
  *
672
695
  * **Example** (Creating channels from iterators)
673
696
  *
674
- * ```ts
675
- * import { Channel } from "effect"
697
+ * ```ts import.meta.vitest
698
+ * import { Channel, Effect } from "effect"
676
699
  *
677
700
  * const numbers = [1, 2, 3, 4, 5]
678
701
  * const channel = Channel.fromIterator(() => numbers[Symbol.iterator]())
679
- * // Emits: 1, 2, 3, 4, 5
702
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3, 4, 5]
680
703
  * ```
681
704
  *
682
705
  * @category constructors
@@ -698,11 +721,11 @@ export const fromIterator = <A, L>(iterator: LazyArg<Iterator<A, L>>): Channel<A
698
721
  *
699
722
  * **Example** (Creating channels from arrays)
700
723
  *
701
- * ```ts
702
- * import { Channel } from "effect"
724
+ * ```ts import.meta.vitest
725
+ * import { Channel, Effect } from "effect"
703
726
  *
704
727
  * const channel = Channel.fromArray([1, 2, 3, 4, 5])
705
- * // Emits: 1, 2, 3, 4, 5
728
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3, 4, 5]
706
729
  * ```
707
730
  *
708
731
  * @category constructors
@@ -719,12 +742,12 @@ export const fromArray = <A>(array: ReadonlyArray<A>): Channel<A> =>
719
742
  *
720
743
  * **Example** (Creating channels from chunks)
721
744
  *
722
- * ```ts
723
- * import { Channel, Chunk } from "effect"
745
+ * ```ts import.meta.vitest
746
+ * import { Channel, Chunk, Effect } from "effect"
724
747
  *
725
748
  * const chunk = Chunk.make(1, 2, 3)
726
749
  * const channel = Channel.fromChunk(chunk)
727
- * // Emits: 1, 2, 3
750
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3]
728
751
  * ```
729
752
  *
730
753
  * @category constructors
@@ -737,8 +760,8 @@ export const fromChunk = <A>(chunk: Chunk.Chunk<A>): Channel<A> => fromArray(Chu
737
760
  *
738
761
  * **Example** (Batching iterator output)
739
762
  *
740
- * ```ts
741
- * import { Channel } from "effect"
763
+ * ```ts import.meta.vitest
764
+ * import { Channel, Effect } from "effect"
742
765
  *
743
766
  * // Create a channel from a simple iterator
744
767
  * const numberIterator = (): Iterator<number, string> => {
@@ -754,13 +777,13 @@ export const fromChunk = <A>(chunk: Chunk.Chunk<A>): Channel<A> => fromArray(Chu
754
777
  * }
755
778
  *
756
779
  * const channel = Channel.fromIteratorArray(() => numberIterator(), 2)
757
- * // This will emit arrays: [0, 1], [2], then complete with "finished"
780
+ * Effect.runSync(Channel.runCollect(channel)) // => [[0, 1], [2]]
758
781
  * ```
759
782
  *
760
783
  * **Example** (Batching generator output)
761
784
  *
762
- * ```ts
763
- * import { Channel } from "effect"
785
+ * ```ts import.meta.vitest
786
+ * import { Channel, Effect } from "effect"
764
787
  *
765
788
  * // Create channel from a generator function
766
789
  * function* fibonacci(): Generator<number, void, unknown> {
@@ -772,7 +795,7 @@ export const fromChunk = <A>(chunk: Chunk.Chunk<A>): Channel<A> => fromArray(Chu
772
795
  * }
773
796
  *
774
797
  * const fibChannel = Channel.fromIteratorArray(() => fibonacci(), 3)
775
- * // Emits: [0, 1, 1], [2, 3], then completes
798
+ * Effect.runSync(Channel.runCollect(fibChannel)) // => [[0, 1, 1], [2, 3]]
776
799
  * ```
777
800
  *
778
801
  * @category constructors
@@ -810,12 +833,12 @@ export const fromIteratorArray = <A, L>(
810
833
  *
811
834
  * **Example** (Creating channels from iterables)
812
835
  *
813
- * ```ts
814
- * import { Channel } from "effect"
836
+ * ```ts import.meta.vitest
837
+ * import { Channel, Effect } from "effect"
815
838
  *
816
839
  * const set = new Set([1, 2, 3])
817
840
  * const channel = Channel.fromIterable(set)
818
- * // Emits: 1, 2, 3
841
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3]
819
842
  * ```
820
843
  *
821
844
  * @category constructors
@@ -829,12 +852,12 @@ export const fromIterable = <A, L>(iterable: Iterable<A, L>): Channel<A, never,
829
852
  *
830
853
  * **Example** (Batching iterable output)
831
854
  *
832
- * ```ts
833
- * import { Channel } from "effect"
855
+ * ```ts import.meta.vitest
856
+ * import { Channel, Effect } from "effect"
834
857
  *
835
858
  * const numbers = [1, 2, 3, 4, 5]
836
- * const channel = Channel.fromIterableArray(numbers)
837
- * // Emits arrays like: [1, 2, 3, 4], [5] (based on chunk size)
859
+ * const channel = Channel.fromIterableArray(numbers, 4)
860
+ * Effect.runSync(Channel.runCollect(channel)) // => [[1, 2, 3, 4], [5]]
838
861
  * ```
839
862
  *
840
863
  * @category constructors
@@ -850,11 +873,11 @@ export const fromIterableArray = <A, L>(
850
873
  *
851
874
  * **Example** (Creating channels that succeed)
852
875
  *
853
- * ```ts
854
- * import { Channel } from "effect"
876
+ * ```ts import.meta.vitest
877
+ * import { Channel, Effect } from "effect"
855
878
  *
856
879
  * const channel = Channel.succeed(42)
857
- * // Emits: 42
880
+ * Effect.runSync(Channel.runCollect(channel)) // => [42]
858
881
  * ```
859
882
  *
860
883
  * @category constructors
@@ -867,11 +890,11 @@ export const succeed = <A>(value: A): Channel<A> => fromEffect(Effect.succeed(va
867
890
  *
868
891
  * **Example** (Ending with a value)
869
892
  *
870
- * ```ts
871
- * import { Channel } from "effect"
893
+ * ```ts import.meta.vitest
894
+ * import { Channel, Effect } from "effect"
872
895
  *
873
896
  * const channel = Channel.end("done")
874
- * // Ends immediately with "done", emits nothing
897
+ * Effect.runSync(Channel.runCollect(channel)) // => []
875
898
  * ```
876
899
  *
877
900
  * @category constructors
@@ -893,8 +916,8 @@ export const endSync = <A>(evaluate: LazyArg<A>): Channel<never, never, A> =>
893
916
  *
894
917
  * **Example** (Computing values lazily)
895
918
  *
896
- * ```ts
897
- * import { Channel } from "effect"
919
+ * ```ts import.meta.vitest
920
+ * import { Channel, Effect } from "effect"
898
921
  *
899
922
  * let requests = 0
900
923
  *
@@ -902,7 +925,7 @@ export const endSync = <A>(evaluate: LazyArg<A>): Channel<never, never, A> =>
902
925
  * requests += 1
903
926
  * return `request-${requests}`
904
927
  * })
905
- * // Emits "request-1" when the channel runs for the first time
928
+ * Effect.runSync(Channel.runCollect(channel)) // => ["request-1"]
906
929
  * ```
907
930
  *
908
931
  * @category constructors
@@ -915,8 +938,8 @@ export const sync = <A>(evaluate: LazyArg<A>): Channel<A> => fromEffect(Effect.s
915
938
  *
916
939
  * **Example** (Creating empty channels)
917
940
  *
918
- * ```ts
919
- * import { Channel } from "effect"
941
+ * ```ts import.meta.vitest
942
+ * import { Channel, Effect } from "effect"
920
943
  *
921
944
  * // Create an empty channel
922
945
  * const emptyChannel = Channel.empty
@@ -928,6 +951,8 @@ export const sync = <A>(evaluate: LazyArg<A>): Channel<A> => fromEffect(Effect.s
928
951
  * // Empty channel can be used as a no-op in conditional logic
929
952
  * const conditionalChannel = (shouldEmit: boolean) =>
930
953
  * shouldEmit ? Channel.succeed("data") : Channel.empty
954
+ *
955
+ * Effect.runSync(Channel.runCollect(conditionalChannel(true))) // => ["data"]
931
956
  * ```
932
957
  *
933
958
  * @category constructors
@@ -940,7 +965,7 @@ export const empty: Channel<never> = fromPull(Effect.succeed(Cause.done()))
940
965
  *
941
966
  * **Example** (Creating non-terminating channels)
942
967
  *
943
- * ```ts
968
+ * ```ts import.meta.vitest
944
969
  * import { Channel } from "effect"
945
970
  *
946
971
  * // Create a channel that never completes
@@ -955,6 +980,8 @@ export const empty: Channel<never> = fromPull(Effect.succeed(Cause.done()))
955
980
  * // Never channel is useful for testing or as a placeholder
956
981
  * const conditionalChannel = (shouldComplete: boolean) =>
957
982
  * shouldComplete ? Channel.succeed("done") : Channel.never
983
+ *
984
+ * Channel.isChannel(conditionalChannel(false)) // => true
958
985
  * ```
959
986
  *
960
987
  * @category constructors
@@ -967,26 +994,11 @@ export const never: Channel<never, never, never> = fromPull(Effect.succeed(Effec
967
994
  *
968
995
  * **Example** (Failing with an error)
969
996
  *
970
- * ```ts
971
- * import { Channel } from "effect"
997
+ * ```ts import.meta.vitest
998
+ * import { Channel, Effect, Exit } from "effect"
972
999
  *
973
- * // Create a channel that fails with a string error
974
1000
  * const failedChannel = Channel.fail("Something went wrong")
975
- *
976
- * // Create a channel that fails with a custom error
977
- * class CustomError extends Error {
978
- * constructor(message: string) {
979
- * super(message)
980
- * this.name = "CustomError"
981
- * }
982
- * }
983
- * const customErrorChannel = Channel.fail(new CustomError("Custom error"))
984
- *
985
- * // Use in error handling by piping to another channel
986
- * const channelWithFallback = Channel.concatWith(
987
- * failedChannel,
988
- * () => Channel.succeed("fallback value")
989
- * )
1001
+ * Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))) // => Exit.fail("Something went wrong")
990
1002
  * ```
991
1003
  *
992
1004
  * @category constructors
@@ -1005,27 +1017,18 @@ export const fail = <E>(error: E): Channel<never, E, never> => fromPull(Effect.s
1005
1017
  *
1006
1018
  * **Example** (Failing with a lazy error)
1007
1019
  *
1008
- * ```ts
1009
- * import { Channel } from "effect"
1010
- *
1011
- * // Create a channel that fails with a lazily computed error
1012
- * const failedChannel = Channel.failSync(() => {
1013
- * console.log("Computing error...")
1014
- * return new Error("Computed at runtime")
1015
- * })
1020
+ * ```ts import.meta.vitest
1021
+ * import { Channel, Effect, Exit } from "effect"
1016
1022
  *
1017
- * // The error computation is deferred until the channel runs
1018
1023
  * let attempts = 0
1019
1024
  * const conditionalError = Channel.failSync(() => {
1020
1025
  * attempts += 1
1021
1026
  * return `Error after attempt ${attempts}`
1022
1027
  * })
1023
- *
1024
- * // Use with expensive error construction
1025
- * const expensiveError = Channel.failSync(() => {
1026
- * const requestId = "request-123"
1027
- * return new Error(`Failed while processing ${requestId}`)
1028
- * })
1028
+ * const observed = [
1029
+ * Effect.runSync(Effect.exit(Channel.runCollect(conditionalError))),
1030
+ * attempts
1031
+ * ] // => [Exit.fail("Error after attempt 1"), 1]
1029
1032
  * ```
1030
1033
  *
1031
1034
  * @category constructors
@@ -1043,20 +1046,12 @@ export const failSync = <E>(evaluate: LazyArg<E>): Channel<never, E, never> => f
1043
1046
  *
1044
1047
  * **Example** (Failing with causes)
1045
1048
  *
1046
- * ```ts
1047
- * import { Cause, Channel } from "effect"
1049
+ * ```ts import.meta.vitest
1050
+ * import { Cause, Channel, Effect, Exit } from "effect"
1048
1051
  *
1049
- * // Create a channel that fails with a simple cause
1050
1052
  * const simpleCause = Cause.fail("Simple error")
1051
1053
  * const failedChannel = Channel.failCause(simpleCause)
1052
- *
1053
- * // Create a channel with a die cause
1054
- * const dieCause = Cause.die(new Error("System error"))
1055
- * const dieFailure = Channel.failCause(dieCause)
1056
- *
1057
- * // Create a channel with a simple fail cause
1058
- * const failCause = Cause.fail("Simple error")
1059
- * const simpleFail = Channel.failCause(failCause)
1054
+ * Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))) // => Exit.failCause(simpleCause)
1060
1055
  * ```
1061
1056
  *
1062
1057
  * @category constructors
@@ -1070,8 +1065,8 @@ export const failCause = <E>(cause: Cause.Cause<E>): Channel<never, E, never> =>
1070
1065
  *
1071
1066
  * **Example** (Failing with lazy causes)
1072
1067
  *
1073
- * ```ts
1074
- * import { Cause, Channel } from "effect"
1068
+ * ```ts import.meta.vitest
1069
+ * import { Cause, Channel, Effect, Exit } from "effect"
1075
1070
  *
1076
1071
  * // Create a channel that fails with a lazily computed cause
1077
1072
  * let attempts = 0
@@ -1080,11 +1075,10 @@ export const failCause = <E>(cause: Cause.Cause<E>): Channel<never, E, never> =>
1080
1075
  * return Cause.fail(`Runtime error after attempt ${attempts}`)
1081
1076
  * })
1082
1077
  *
1083
- * // Create a channel with die cause computation
1084
- * const dieCauseChannel = Channel.failCauseSync(() => {
1085
- * const operation = "load-profile"
1086
- * return Cause.die(`Unexpected defect during ${operation}`)
1087
- * })
1078
+ * const observed = [
1079
+ * Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))),
1080
+ * attempts
1081
+ * ] // => [Exit.fail("Runtime error after attempt 1"), 1]
1088
1082
  * ```
1089
1083
  *
1090
1084
  * @category constructors
@@ -1099,20 +1093,12 @@ export const failCauseSync = <E>(
1099
1093
  *
1100
1094
  * **Example** (Dying with defects)
1101
1095
  *
1102
- * ```ts
1103
- * import { Channel } from "effect"
1104
- *
1105
- * // Create a channel that dies with a string defect
1106
- * const diedChannel = Channel.die("Unrecoverable error")
1096
+ * ```ts import.meta.vitest
1097
+ * import { Cause, Channel, Effect, Exit } from "effect"
1107
1098
  *
1108
- * // Create a channel that dies with an Error object
1109
- * const errorDefect = Channel.die(new Error("System failure"))
1110
- *
1111
- * // Die with any value as a defect
1112
- * const objectDefect = Channel.die({
1113
- * code: "SYSTEM_FAILURE",
1114
- * details: "Critical system component failed"
1115
- * })
1099
+ * const defect = "Unrecoverable error"
1100
+ * const diedChannel = Channel.die(defect)
1101
+ * Effect.runSync(Effect.exit(Channel.runCollect(diedChannel))) // => Exit.failCause(Cause.die(defect))
1116
1102
  * ```
1117
1103
  *
1118
1104
  * @category constructors
@@ -1125,33 +1111,13 @@ export const die = (defect: unknown): Channel<never, never, never> => failCause(
1125
1111
  *
1126
1112
  * **Example** (Creating channels from effects)
1127
1113
  *
1128
- * ```ts
1129
- * import { Channel, Data, Effect } from "effect"
1130
- *
1131
- * class DatabaseError extends Data.TaggedError("DatabaseError")<{
1132
- * readonly message: string
1133
- * }> {}
1114
+ * ```ts import.meta.vitest
1115
+ * import { Channel, Effect } from "effect"
1134
1116
  *
1135
- * // Create a channel from a successful effect
1136
1117
  * const successChannel = Channel.fromEffect(
1137
1118
  * Effect.succeed("Hello from effect!")
1138
1119
  * )
1139
- *
1140
- * // Create a channel from an effect that might fail
1141
- * const fetchUserChannel = Channel.fromEffect(
1142
- * Effect.tryPromise({
1143
- * try: () => fetch("/api/user").then((res) => res.json()),
1144
- * catch: (error) => new DatabaseError({ message: String(error) })
1145
- * })
1146
- * )
1147
- *
1148
- * // Channel from effect with async computation
1149
- * const asyncChannel = Channel.fromEffect(
1150
- * Effect.gen(function*() {
1151
- * yield* Effect.sleep("100 millis")
1152
- * return "Async result"
1153
- * })
1154
- * )
1120
+ * Effect.runSync(Channel.runCollect(successChannel)) // => ["Hello from effect!"]
1155
1121
  * ```
1156
1122
  *
1157
1123
  * @category constructors
@@ -1219,35 +1185,17 @@ export const fromEffectTake = <A, E, Done, E2, R>(
1219
1185
  *
1220
1186
  * **Example** (Creating channels from queues)
1221
1187
  *
1222
- * ```ts
1223
- * import { Channel, Data, Effect, Queue } from "effect"
1224
- *
1225
- * class QueueError extends Data.TaggedError("QueueError")<{
1226
- * readonly reason: string
1227
- * }> {}
1188
+ * ```ts import.meta.vitest
1189
+ * import { Cause, Channel, Effect, Queue } from "effect"
1228
1190
  *
1229
1191
  * const program = Effect.gen(function*() {
1230
- * // Create a bounded queue
1231
- * const queue = yield* Queue.bounded<string, QueueError>(10)
1232
- *
1233
- * // Add some items to the queue
1234
- * yield* Queue.offer(queue, "item1")
1235
- * yield* Queue.offer(queue, "item2")
1236
- * yield* Queue.offer(queue, "item3")
1237
- *
1238
- * // Create a channel from the queue
1192
+ * const queue = yield* Queue.bounded<string, Cause.Done>(3)
1193
+ * yield* Queue.offerAll(queue, ["item1", "item2", "item3"])
1194
+ * yield* Queue.end(queue)
1239
1195
  * const channel = Channel.fromQueue(queue)
1240
- *
1241
- * // The channel will read items from the queue one by one
1242
- * return channel
1243
- * })
1244
- *
1245
- * // Sliding queue example
1246
- * const slidingProgram = Effect.gen(function*() {
1247
- * const slidingQueue = yield* Queue.sliding<number, QueueError>(5)
1248
- * yield* Queue.offerAll(slidingQueue, [1, 2, 3, 4, 5, 6])
1249
- * return Channel.fromQueue(slidingQueue)
1196
+ * return yield* Channel.runCollect(channel)
1250
1197
  * })
1198
+ * await Effect.runPromise(program) // => ["item1", "item2", "item3"]
1251
1199
  * ```
1252
1200
  *
1253
1201
  * @category constructors
@@ -1262,39 +1210,17 @@ export const fromQueue = <A, E>(
1262
1210
  *
1263
1211
  * **Example** (Creating batched channels from queues)
1264
1212
  *
1265
- * ```ts
1266
- * import { Channel, Data, Effect, Queue } from "effect"
1267
- *
1268
- * class ProcessingError extends Data.TaggedError("ProcessingError")<{
1269
- * readonly stage: string
1270
- * }> {}
1213
+ * ```ts import.meta.vitest
1214
+ * import { Cause, Channel, Effect, Queue } from "effect"
1271
1215
  *
1272
1216
  * const program = Effect.gen(function*() {
1273
- * // Create a queue for batch processing
1274
- * const queue = yield* Queue.bounded<number, ProcessingError>(100)
1275
- *
1276
- * // Fill queue with data
1277
- * yield* Queue.offerAll(queue, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
1278
- *
1279
- * // Create a channel that reads arrays from the queue
1217
+ * const queue = yield* Queue.bounded<number, Cause.Done>(4)
1218
+ * yield* Queue.offerAll(queue, [1, 2, 3, 4])
1219
+ * yield* Queue.end(queue)
1280
1220
  * const arrayChannel = Channel.fromQueueArray(queue)
1281
- *
1282
- * // This will emit non-empty arrays of elements instead of individual items
1283
- * // Useful for batch processing scenarios
1284
- * return arrayChannel
1285
- * })
1286
- *
1287
- * // High-throughput processing example
1288
- * const batchProcessor = Effect.gen(function*() {
1289
- * const dataQueue = yield* Queue.dropping<string, ProcessingError>(1000)
1290
- * const batchChannel = Channel.fromQueueArray(dataQueue)
1291
- *
1292
- * // Process data in batches for better performance
1293
- * return Channel.map(
1294
- * batchChannel,
1295
- * (batch) => batch.map((item) => item.toUpperCase())
1296
- * )
1221
+ * return yield* Channel.runCollect(arrayChannel)
1297
1222
  * })
1223
+ * await Effect.runPromise(program) // => [[1, 2, 3, 4]]
1298
1224
  * ```
1299
1225
  *
1300
1226
  * @category constructors
@@ -1319,8 +1245,8 @@ export const identity = <Elem, Err, Done>(): Channel<Elem, Err, Done, Elem, Err,
1319
1245
  *
1320
1246
  * **Example** (Creating channels from subscriptions)
1321
1247
  *
1322
- * ```ts
1323
- * import { Channel, Data, Effect, PubSub } from "effect"
1248
+ * ```ts import.meta.vitest
1249
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
1324
1250
  *
1325
1251
  * class SubscriptionError extends Data.TaggedError("SubscriptionError")<{
1326
1252
  * readonly reason: string
@@ -1345,6 +1271,8 @@ export const identity = <Elem, Err, Done>(): Channel<Elem, Err, Done, Elem, Err,
1345
1271
  * // The channel will receive all published messages
1346
1272
  * return channel
1347
1273
  * })
1274
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
1275
+ * await Effect.runPromise(result) // => Option.some("Hello")
1348
1276
  *
1349
1277
  * // Real-time notifications example
1350
1278
  * const notificationChannel = Effect.gen(function*() {
@@ -1373,8 +1301,8 @@ export const fromSubscription = <A>(
1373
1301
  *
1374
1302
  * **Example** (Batching subscription values)
1375
1303
  *
1376
- * ```ts
1377
- * import { Channel, Data, Effect, PubSub } from "effect"
1304
+ * ```ts import.meta.vitest
1305
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
1378
1306
  *
1379
1307
  * class StreamError extends Data.TaggedError("StreamError")<{
1380
1308
  * readonly message: string
@@ -1396,12 +1324,14 @@ export const fromSubscription = <A>(
1396
1324
  * // The channel will output arrays like [1, 2, 3] and [4]
1397
1325
  * return channel
1398
1326
  * })
1327
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
1328
+ * await Effect.runPromise(result) // => Option.some([1, 2, 3, 4])
1399
1329
  * ```
1400
1330
  *
1401
1331
  * **Example** (Processing subscription values in batches)
1402
1332
  *
1403
- * ```ts
1404
- * import { Channel, Data, Effect, PubSub } from "effect"
1333
+ * ```ts import.meta.vitest
1334
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
1405
1335
  *
1406
1336
  * class BatchProcessingError extends Data.TaggedError("BatchProcessingError")<{
1407
1337
  * readonly reason: string
@@ -1415,19 +1345,21 @@ export const fromSubscription = <A>(
1415
1345
  * const batchChannel = Channel.fromSubscriptionArray(subscription)
1416
1346
  *
1417
1347
  * // Transform to process each batch
1418
- * const processedChannel = Channel.map(batchChannel, (batch) => {
1419
- * console.log(`Processing batch of ${batch.length} items:`, batch)
1420
- * return batch.map((item) => item.toUpperCase())
1421
- * })
1348
+ * const processedChannel = Channel.map(batchChannel, (batch) =>
1349
+ * batch.map((item) => item.toUpperCase())
1350
+ * )
1422
1351
  *
1352
+ * yield* PubSub.publishAll(pubsub, ["one", "two"])
1423
1353
  * return processedChannel
1424
1354
  * })
1355
+ * const batch = Effect.scoped(Effect.flatMap(batchProcessor, Channel.runHead))
1356
+ * await Effect.runPromise(batch) // => Option.some(["ONE", "TWO"])
1425
1357
  * ```
1426
1358
  *
1427
1359
  * **Example** (Aggregating subscription metrics)
1428
1360
  *
1429
- * ```ts
1430
- * import { Channel, Effect, PubSub } from "effect"
1361
+ * ```ts import.meta.vitest
1362
+ * import { Channel, Effect, Option, PubSub } from "effect"
1431
1363
  *
1432
1364
  * const metricsAggregator = Effect.gen(function*() {
1433
1365
  * const metricsPubSub = yield* PubSub.bounded<
@@ -1457,8 +1389,12 @@ export const fromSubscription = <A>(
1457
1389
  * }
1458
1390
  * })
1459
1391
  *
1392
+ * yield* PubSub.publish(metricsPubSub, { timestamp: 1, value: 10 })
1460
1393
  * return aggregatedChannel
1461
1394
  * })
1395
+ * const metric = Effect.scoped(Effect.flatMap(metricsAggregator, Channel.runHead))
1396
+ * const result = await Effect.runPromise(metric)
1397
+ * Option.map(result, ({ count, sum, average, min, max }) => ({ count, sum, average, min, max })) // => Option.some({ count: 1, sum: 10, average: 10, min: 10, max: 10 })
1462
1398
  * ```
1463
1399
  *
1464
1400
  * @category constructors
@@ -1480,15 +1416,15 @@ export const fromSubscriptionArray = <A>(
1480
1416
  *
1481
1417
  * **Example** (Creating channels from PubSubs)
1482
1418
  *
1483
- * ```ts
1484
- * import { Channel, Data, Effect, PubSub } from "effect"
1419
+ * ```ts import.meta.vitest
1420
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
1485
1421
  *
1486
1422
  * class StreamError extends Data.TaggedError("StreamError")<{
1487
1423
  * readonly message: string
1488
1424
  * }> {}
1489
1425
  *
1490
1426
  * const program = Effect.gen(function*() {
1491
- * const pubsub = yield* PubSub.bounded<number>(16)
1427
+ * const pubsub = yield* PubSub.unbounded<number>({ replay: 3 })
1492
1428
  *
1493
1429
  * // Create a channel that reads individual values
1494
1430
  * const channel = Channel.fromPubSub(pubsub)
@@ -1501,15 +1437,17 @@ export const fromSubscriptionArray = <A>(
1501
1437
  * // The channel will output: 1, 2, 3 (individual values)
1502
1438
  * return channel
1503
1439
  * })
1440
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
1441
+ * await Effect.runPromise(result) // => Option.some(1)
1504
1442
  * ```
1505
1443
  *
1506
1444
  * **Example** (Streaming PubSub notifications)
1507
1445
  *
1508
- * ```ts
1509
- * import { Channel, Effect, PubSub } from "effect"
1446
+ * ```ts import.meta.vitest
1447
+ * import { Channel, Effect, Option, PubSub } from "effect"
1510
1448
  *
1511
1449
  * const notificationService = Effect.gen(function*() {
1512
- * const notificationPubSub = yield* PubSub.bounded<string>(50)
1450
+ * const notificationPubSub = yield* PubSub.unbounded<string>({ replay: 1 })
1513
1451
  *
1514
1452
  * // Create a channel for real-time notifications
1515
1453
  * const notificationChannel = Channel.fromPubSub(notificationPubSub)
@@ -1522,14 +1460,17 @@ export const fromSubscriptionArray = <A>(
1522
1460
  * id: `notification:${message}`
1523
1461
  * }))
1524
1462
  *
1463
+ * yield* PubSub.publish(notificationPubSub, "ready")
1525
1464
  * return timestampedChannel
1526
1465
  * })
1466
+ * const notification = Effect.scoped(Effect.flatMap(notificationService, Channel.runHead))
1467
+ * await Effect.runPromise(notification) // => Option.some({ message: "ready", receivedAt: "2024-01-01T00:00:00.000Z", id: "notification:ready" })
1527
1468
  * ```
1528
1469
  *
1529
1470
  * **Example** (Processing PubSub events)
1530
1471
  *
1531
- * ```ts
1532
- * import { Channel, Effect, PubSub } from "effect"
1472
+ * ```ts import.meta.vitest
1473
+ * import { Channel, Effect, Option, PubSub } from "effect"
1533
1474
  *
1534
1475
  * interface DomainEvent {
1535
1476
  * readonly type: string
@@ -1538,7 +1479,7 @@ export const fromSubscriptionArray = <A>(
1538
1479
  * }
1539
1480
  *
1540
1481
  * const eventProcessor = Effect.gen(function*() {
1541
- * const eventPubSub = yield* PubSub.bounded<DomainEvent>(100)
1482
+ * const eventPubSub = yield* PubSub.unbounded<DomainEvent>({ replay: 1 })
1542
1483
  *
1543
1484
  * // Create a channel for processing domain events
1544
1485
  * const eventChannel = Channel.fromPubSub(eventPubSub)
@@ -1555,8 +1496,11 @@ export const fromSubscriptionArray = <A>(
1555
1496
  * return event
1556
1497
  * })
1557
1498
  *
1499
+ * yield* PubSub.publish(eventPubSub, { type: "user.created", payload: {}, timestamp: 1 })
1558
1500
  * return processedChannel
1559
1501
  * })
1502
+ * const event = Effect.scoped(Effect.flatMap(eventProcessor, Channel.runHead))
1503
+ * const result = await Effect.runPromise(event) // => Option.some({ type: "user.created", payload: {}, timestamp: 1, processed: true, processedAt: 2 })
1560
1504
  * ```
1561
1505
  *
1562
1506
  * @category constructors
@@ -1577,15 +1521,15 @@ export const fromPubSub = <A>(
1577
1521
  *
1578
1522
  * **Example** (Batching PubSub values)
1579
1523
  *
1580
- * ```ts
1581
- * import { Channel, Data, Effect, PubSub } from "effect"
1524
+ * ```ts import.meta.vitest
1525
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
1582
1526
  *
1583
1527
  * class BatchError extends Data.TaggedError("BatchError")<{
1584
1528
  * readonly message: string
1585
1529
  * }> {}
1586
1530
  *
1587
1531
  * const program = Effect.gen(function*() {
1588
- * const pubsub = yield* PubSub.bounded<number>(16)
1532
+ * const pubsub = yield* PubSub.unbounded<number>({ replay: 4 })
1589
1533
  *
1590
1534
  * // Create a channel that reads arrays of values
1591
1535
  * const channel = Channel.fromPubSubArray(pubsub)
@@ -1599,12 +1543,14 @@ export const fromPubSub = <A>(
1599
1543
  * // The channel will output arrays like [1, 2, 3] and [4]
1600
1544
  * return channel
1601
1545
  * })
1546
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
1547
+ * await Effect.runPromise(result) // => Option.some([1, 2, 3, 4])
1602
1548
  * ```
1603
1549
  *
1604
1550
  * **Example** (Processing PubSub orders in batches)
1605
1551
  *
1606
- * ```ts
1607
- * import { Channel, Effect, PubSub } from "effect"
1552
+ * ```ts import.meta.vitest
1553
+ * import { Channel, Effect, Option, PubSub } from "effect"
1608
1554
  *
1609
1555
  * interface Order {
1610
1556
  * readonly id: string
@@ -1615,7 +1561,7 @@ export const fromPubSub = <A>(
1615
1561
  * }
1616
1562
  *
1617
1563
  * const orderBatchProcessor = Effect.gen(function*() {
1618
- * const orderPubSub = yield* PubSub.bounded<Order>(100)
1564
+ * const orderPubSub = yield* PubSub.unbounded<Order>({ replay: 1 })
1619
1565
  *
1620
1566
  * // Create a channel that processes orders in batches
1621
1567
  * const orderChannel = Channel.fromPubSubArray(orderPubSub)
@@ -1636,14 +1582,20 @@ export const fromPubSub = <A>(
1636
1582
  * }
1637
1583
  * })
1638
1584
  *
1585
+ * yield* PubSub.publish(orderPubSub, {
1586
+ * id: "1", customerId: "a", items: ["book"], total: 10, submittedAt: 1
1587
+ * })
1639
1588
  * return processedChannel
1640
1589
  * })
1590
+ * const order = Effect.scoped(Effect.flatMap(orderBatchProcessor, Channel.runHead))
1591
+ * const result = await Effect.runPromise(order)
1592
+ * Option.map(result, (batch) => [batch.batchSize, batch.totalRevenue, batch.uniqueCustomers]) // => Option.some([1, 10, 1])
1641
1593
  * ```
1642
1594
  *
1643
1595
  * **Example** (Processing PubSub logs in batches)
1644
1596
  *
1645
- * ```ts
1646
- * import { Channel, Effect, PubSub } from "effect"
1597
+ * ```ts import.meta.vitest
1598
+ * import { Channel, Effect, Option, PubSub } from "effect"
1647
1599
  *
1648
1600
  * interface LogEntry {
1649
1601
  * readonly timestamp: number
@@ -1653,7 +1605,7 @@ export const fromPubSub = <A>(
1653
1605
  * }
1654
1606
  *
1655
1607
  * const logAggregator = Effect.gen(function*() {
1656
- * const logPubSub = yield* PubSub.bounded<LogEntry>(500)
1608
+ * const logPubSub = yield* PubSub.unbounded<LogEntry>({ replay: 1 })
1657
1609
  *
1658
1610
  * // Create a channel that collects logs in batches
1659
1611
  * const logChannel = Channel.fromPubSubArray(logPubSub)
@@ -1680,8 +1632,17 @@ export const fromPubSub = <A>(
1680
1632
  * }
1681
1633
  * })
1682
1634
  *
1635
+ * yield* PubSub.publish(logPubSub, {
1636
+ * timestamp: 1,
1637
+ * level: "info",
1638
+ * message: "ready",
1639
+ * source: "app"
1640
+ * } satisfies LogEntry)
1683
1641
  * return analysisChannel
1684
1642
  * })
1643
+ * const log = Effect.scoped(Effect.flatMap(logAggregator, Channel.runHead))
1644
+ * const result = await Effect.runPromise(log)
1645
+ * Option.map(result, (batch) => [batch.batchId, batch.totalEntries, batch.infoCount]) // => Option.some(["1-1", 1, 1])
1685
1646
  * ```
1686
1647
  *
1687
1648
  * @category constructors
@@ -1717,6 +1678,229 @@ export const fromSchedule = <O, E, R>(
1717
1678
  ): Channel<O, E, O, unknown, unknown, unknown, R> =>
1718
1679
  fromPull(Effect.map(Schedule.toStepWithSleep(schedule), (step) => step(void 0)))
1719
1680
 
1681
+ /**
1682
+ * Creates a channel from a lazily supplied Web `ReadableStream`.
1683
+ *
1684
+ * **Example** (Reading from a Web stream)
1685
+ *
1686
+ * ```ts import.meta.vitest
1687
+ * import { Channel, Effect } from "effect"
1688
+ *
1689
+ * const channel = Channel.fromReadableStream({
1690
+ * evaluate: () => new ReadableStream({
1691
+ * start(controller) {
1692
+ * controller.enqueue(1)
1693
+ * controller.close()
1694
+ * }
1695
+ * }),
1696
+ * onError: (cause) => new Error(String(cause))
1697
+ * })
1698
+ *
1699
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [[1]]
1700
+ * ```
1701
+ *
1702
+ * @category constructors
1703
+ * @since 4.0.0
1704
+ */
1705
+ export const fromReadableStream = <A, E>(options: {
1706
+ readonly evaluate: LazyArg<ReadableStream<A>>
1707
+ readonly onError: (error: unknown) => E
1708
+ readonly releaseLockOnEnd?: boolean | undefined
1709
+ }): Channel<Arr.NonEmptyReadonlyArray<A>, E> =>
1710
+ fromTransform((_, scope) =>
1711
+ readableStreamToPullUnsafe({
1712
+ scope,
1713
+ readable: options.evaluate(),
1714
+ onError: options.onError,
1715
+ releaseLockOnEnd: options.releaseLockOnEnd
1716
+ })
1717
+ )
1718
+
1719
+ /** @internal */
1720
+ export const pullIntoWritableStream = <A, IE, E>(options: {
1721
+ readonly pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, IE, unknown>
1722
+ readonly writable: WritableStream<A>
1723
+ readonly onError: (error: unknown) => E
1724
+ readonly closeOnDone?: boolean | undefined
1725
+ }): Pull.Pull<never, IE | E, unknown> =>
1726
+ Effect.acquireUseRelease(
1727
+ Effect.sync(() => options.writable.getWriter()),
1728
+ (writer) => {
1729
+ const loop = options.pull.pipe(
1730
+ Effect.flatMap((chunk) =>
1731
+ Effect.forEach(
1732
+ chunk,
1733
+ (value) =>
1734
+ Effect.tryPromise({
1735
+ try: () => writer.ready.then(() => writer.write(value)),
1736
+ catch: options.onError
1737
+ }),
1738
+ { discard: true }
1739
+ )
1740
+ ),
1741
+ Effect.forever({ disableYield: true })
1742
+ )
1743
+ const withClose = options.closeOnDone !== false
1744
+ ? Pull.catchDone(loop, (done) =>
1745
+ Effect.andThen(
1746
+ Effect.tryPromise({
1747
+ try: () => writer.close(),
1748
+ catch: options.onError
1749
+ }),
1750
+ Cause.done(done)
1751
+ ))
1752
+ : loop
1753
+ return Effect.onError(
1754
+ withClose,
1755
+ (cause) =>
1756
+ Pull.isDoneCause(cause)
1757
+ ? Effect.void
1758
+ : Effect.promise(() => writer.abort(cause).catch(constVoid))
1759
+ )
1760
+ },
1761
+ (writer) => Effect.sync(() => writer.releaseLock())
1762
+ )
1763
+
1764
+ /**
1765
+ * Creates a channel that writes upstream values to a lazily supplied Web
1766
+ * `WritableStream`.
1767
+ *
1768
+ * **Example** (Writing channel input)
1769
+ *
1770
+ * ```ts import.meta.vitest
1771
+ * import { Channel, Effect } from "effect"
1772
+ *
1773
+ * const written: Array<number> = []
1774
+ * const sink = Channel.fromWritableStream<never, Error, number>({
1775
+ * evaluate: () => new WritableStream({
1776
+ * write(value) {
1777
+ * written.push(value)
1778
+ * }
1779
+ * }),
1780
+ * onError: (cause) => new Error(String(cause))
1781
+ * })
1782
+ *
1783
+ * const program = Channel.fromArray([[1, 2] as [number, number]]).pipe(
1784
+ * Channel.pipeTo(sink),
1785
+ * Channel.runDrain
1786
+ * )
1787
+ *
1788
+ * await Effect.runPromise(program)
1789
+ * written // => [1, 2]
1790
+ * ```
1791
+ *
1792
+ * @category constructors
1793
+ * @since 4.0.0
1794
+ */
1795
+ export const fromWritableStream = <IE, E, A>(options: {
1796
+ readonly evaluate: LazyArg<WritableStream<A>>
1797
+ readonly onError: (error: unknown) => E
1798
+ readonly closeOnDone?: boolean | undefined
1799
+ }): Channel<never, IE | E, void, Arr.NonEmptyReadonlyArray<A>, IE> =>
1800
+ fromTransform((pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, IE, unknown>) => {
1801
+ const writable = options.evaluate()
1802
+ return Effect.succeed(pullIntoWritableStream({ ...options, writable, pull }))
1803
+ })
1804
+
1805
+ /**
1806
+ * Creates a channel backed by a Web `TransformStream`, writing upstream values
1807
+ * while emitting transformed values from its readable side.
1808
+ *
1809
+ * **Example** (Transforming channel input)
1810
+ *
1811
+ * ```ts import.meta.vitest
1812
+ * import { Channel, Effect } from "effect"
1813
+ *
1814
+ * const transform = Channel.fromTransformStream<never, number, number, Error>({
1815
+ * evaluate: () => new TransformStream({
1816
+ * transform(value, controller) {
1817
+ * controller.enqueue(value * 2)
1818
+ * }
1819
+ * }),
1820
+ * onError: (cause) => new Error(String(cause))
1821
+ * })
1822
+ *
1823
+ * const program = Channel.fromArray([[1, 2] as [number, number]]).pipe(
1824
+ * Channel.pipeTo(transform),
1825
+ * Channel.runCollect
1826
+ * )
1827
+ *
1828
+ * await Effect.runPromise(program) // => [[2], [4]]
1829
+ * ```
1830
+ *
1831
+ * @category constructors
1832
+ * @since 4.0.0
1833
+ */
1834
+ export const fromTransformStream = <IE, I, O, E>(options: {
1835
+ readonly evaluate: LazyArg<TransformStream<I, O>>
1836
+ readonly onError: (error: unknown) => E
1837
+ readonly closeOnDone?: boolean | undefined
1838
+ readonly releaseLockOnEnd?: boolean | undefined
1839
+ }): Channel<Arr.NonEmptyReadonlyArray<O>, IE | E, void, Arr.NonEmptyReadonlyArray<I>, IE> =>
1840
+ fromTransform((upstream, scope) => {
1841
+ const transform = options.evaluate()
1842
+ const exit = MutableRef.make<Exit.Exit<never, IE | E | Cause.Done> | undefined>(undefined)
1843
+ return pullIntoWritableStream({
1844
+ pull: upstream,
1845
+ writable: transform.writable,
1846
+ onError: options.onError,
1847
+ closeOnDone: options.closeOnDone
1848
+ }).pipe(
1849
+ Effect.catchCause((cause) => {
1850
+ if (!Pull.isDoneCause(cause)) {
1851
+ exit.current = Exit.failCause(cause as Cause.Cause<IE | E | Cause.Done>)
1852
+ }
1853
+ return Effect.void
1854
+ }),
1855
+ Effect.forkIn(scope),
1856
+ Effect.flatMap(() =>
1857
+ readableStreamToPullUnsafe({
1858
+ scope,
1859
+ exit,
1860
+ readable: transform.readable,
1861
+ onError: options.onError,
1862
+ releaseLockOnEnd: options.releaseLockOnEnd
1863
+ })
1864
+ )
1865
+ )
1866
+ })
1867
+
1868
+ const readableStreamToPullUnsafe = <A, E, E2 = never>(options: {
1869
+ readonly scope: Scope.Scope
1870
+ readonly exit?: MutableRef.MutableRef<Exit.Exit<never, E | E2 | Cause.Done> | undefined> | undefined
1871
+ readonly readable: ReadableStream<A>
1872
+ readonly onError: (error: unknown) => E
1873
+ readonly releaseLockOnEnd?: boolean | undefined
1874
+ }): Effect.Effect<Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E | E2>, never> => {
1875
+ const reader = options.readable.getReader()
1876
+ const exit = options.exit ?? MutableRef.make(undefined)
1877
+ const pull = Effect.suspend(() => {
1878
+ if (exit.current) return exit.current
1879
+ return Effect.matchCauseEffect(
1880
+ Effect.tryPromise({
1881
+ try: () => reader.read(),
1882
+ catch: options.onError
1883
+ }),
1884
+ {
1885
+ onFailure: (cause) => exit.current ?? Effect.failCause(cause),
1886
+ onSuccess: ({ done, value }) => {
1887
+ if (exit.current) return exit.current
1888
+ return done ? Cause.done() : Effect.succeed(Arr.of(value))
1889
+ }
1890
+ }
1891
+ )
1892
+ })
1893
+ return Effect.as(
1894
+ Scope.addFinalizer(
1895
+ options.scope,
1896
+ options.releaseLockOnEnd
1897
+ ? Effect.sync(() => reader.releaseLock())
1898
+ : Effect.promise(() => reader.cancel().catch(constVoid))
1899
+ ),
1900
+ pull
1901
+ )
1902
+ }
1903
+
1720
1904
  /**
1721
1905
  * Creates a channel that pulls values from an `AsyncIterable`.
1722
1906
  *
@@ -1771,8 +1955,8 @@ export const fromAsyncIterableArray = <A, D, E>(
1771
1955
  *
1772
1956
  * **Example** (Mapping channel output)
1773
1957
  *
1774
- * ```ts
1775
- * import { Channel, Data } from "effect"
1958
+ * ```ts import.meta.vitest
1959
+ * import { Channel, Data, Effect } from "effect"
1776
1960
  *
1777
1961
  * class TransformError extends Data.TaggedError("TransformError")<{
1778
1962
  * readonly reason: string
@@ -1781,12 +1965,12 @@ export const fromAsyncIterableArray = <A, D, E>(
1781
1965
  * // Basic mapping of channel values
1782
1966
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
1783
1967
  * const doubledChannel = Channel.map(numbersChannel, (n) => n * 2)
1784
- * // Outputs: 2, 4, 6, 8, 10
1968
+ * Effect.runSync(Channel.runCollect(doubledChannel)) // => [2, 4, 6, 8, 10]
1785
1969
  *
1786
1970
  * // Transform string data
1787
1971
  * const wordsChannel = Channel.fromIterable(["hello", "world", "effect"])
1788
1972
  * const upperCaseChannel = Channel.map(wordsChannel, (word) => word.toUpperCase())
1789
- * // Outputs: "HELLO", "WORLD", "EFFECT"
1973
+ * Effect.runSync(Channel.runCollect(upperCaseChannel)) // => ["HELLO", "WORLD", "EFFECT"]
1790
1974
  *
1791
1975
  * // Complex object transformation
1792
1976
  * type User = { id: number; name: string }
@@ -1800,6 +1984,7 @@ export const fromAsyncIterableArray = <A, D, E>(
1800
1984
  * displayName: `User: ${user.name}`,
1801
1985
  * isActive: true
1802
1986
  * }))
1987
+ * Effect.runSync(Channel.runCollect(displayChannel)) // => [{ displayName: "User: Alice", isActive: true }, { displayName: "User: Bob", isActive: true }]
1803
1988
  * ```
1804
1989
  *
1805
1990
  * @category sequencing
@@ -1811,8 +1996,8 @@ export const map: {
1811
1996
  *
1812
1997
  * **Example** (Mapping channel output)
1813
1998
  *
1814
- * ```ts
1815
- * import { Channel, Data } from "effect"
1999
+ * ```ts import.meta.vitest
2000
+ * import { Channel, Data, Effect } from "effect"
1816
2001
  *
1817
2002
  * class TransformError extends Data.TaggedError("TransformError")<{
1818
2003
  * readonly reason: string
@@ -1821,12 +2006,12 @@ export const map: {
1821
2006
  * // Basic mapping of channel values
1822
2007
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
1823
2008
  * const doubledChannel = Channel.map(numbersChannel, (n) => n * 2)
1824
- * // Outputs: 2, 4, 6, 8, 10
2009
+ * Effect.runSync(Channel.runCollect(doubledChannel)) // => [2, 4, 6, 8, 10]
1825
2010
  *
1826
2011
  * // Transform string data
1827
2012
  * const wordsChannel = Channel.fromIterable(["hello", "world", "effect"])
1828
2013
  * const upperCaseChannel = Channel.map(wordsChannel, (word) => word.toUpperCase())
1829
- * // Outputs: "HELLO", "WORLD", "EFFECT"
2014
+ * Effect.runSync(Channel.runCollect(upperCaseChannel)) // => ["HELLO", "WORLD", "EFFECT"]
1830
2015
  *
1831
2016
  * // Complex object transformation
1832
2017
  * type User = { id: number; name: string }
@@ -1840,6 +2025,7 @@ export const map: {
1840
2025
  * displayName: `User: ${user.name}`,
1841
2026
  * isActive: true
1842
2027
  * }))
2028
+ * Effect.runSync(Channel.runCollect(displayChannel)) // => [{ displayName: "User: Alice", isActive: true }, { displayName: "User: Bob", isActive: true }]
1843
2029
  * ```
1844
2030
  *
1845
2031
  * @category sequencing
@@ -1853,8 +2039,8 @@ export const map: {
1853
2039
  *
1854
2040
  * **Example** (Mapping channel output)
1855
2041
  *
1856
- * ```ts
1857
- * import { Channel, Data } from "effect"
2042
+ * ```ts import.meta.vitest
2043
+ * import { Channel, Data, Effect } from "effect"
1858
2044
  *
1859
2045
  * class TransformError extends Data.TaggedError("TransformError")<{
1860
2046
  * readonly reason: string
@@ -1863,12 +2049,12 @@ export const map: {
1863
2049
  * // Basic mapping of channel values
1864
2050
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
1865
2051
  * const doubledChannel = Channel.map(numbersChannel, (n) => n * 2)
1866
- * // Outputs: 2, 4, 6, 8, 10
2052
+ * Effect.runSync(Channel.runCollect(doubledChannel)) // => [2, 4, 6, 8, 10]
1867
2053
  *
1868
2054
  * // Transform string data
1869
2055
  * const wordsChannel = Channel.fromIterable(["hello", "world", "effect"])
1870
2056
  * const upperCaseChannel = Channel.map(wordsChannel, (word) => word.toUpperCase())
1871
- * // Outputs: "HELLO", "WORLD", "EFFECT"
2057
+ * Effect.runSync(Channel.runCollect(upperCaseChannel)) // => ["HELLO", "WORLD", "EFFECT"]
1872
2058
  *
1873
2059
  * // Complex object transformation
1874
2060
  * type User = { id: number; name: string }
@@ -1882,6 +2068,7 @@ export const map: {
1882
2068
  * displayName: `User: ${user.name}`,
1883
2069
  * isActive: true
1884
2070
  * }))
2071
+ * Effect.runSync(Channel.runCollect(displayChannel)) // => [{ displayName: "User: Alice", isActive: true }, { displayName: "User: Bob", isActive: true }]
1885
2072
  * ```
1886
2073
  *
1887
2074
  * @category sequencing
@@ -2014,40 +2201,15 @@ const concurrencyIsSequential = (
2014
2201
  *
2015
2202
  * **Example** (Mapping channel output with effects)
2016
2203
  *
2017
- * ```ts
2018
- * import { Channel, Data, Effect } from "effect"
2019
- *
2020
- * class NetworkError extends Data.TaggedError("NetworkError")<{
2021
- * readonly url: string
2022
- * }> {}
2023
- *
2024
- * // Transform values using effectful operations
2025
- * const urlsChannel = Channel.fromIterable([
2026
- * "/api/users/1",
2027
- * "/api/users/2",
2028
- * "/api/users/3"
2029
- * ])
2030
- *
2031
- * const fetchDataChannel = Channel.mapEffect(
2032
- * urlsChannel,
2033
- * (url) =>
2034
- * Effect.tryPromise({
2035
- * try: () => fetch(url).then((res) => res.json()),
2036
- * catch: () => new NetworkError({ url })
2037
- * })
2038
- * )
2204
+ * ```ts import.meta.vitest
2205
+ * import { Channel, Effect } from "effect"
2039
2206
  *
2040
- * // Concurrent processing with options
2041
2207
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
2042
2208
  * const processedChannel = Channel.mapEffect(
2043
2209
  * numbersChannel,
2044
- * (n) =>
2045
- * Effect.gen(function*() {
2046
- * yield* Effect.sleep("100 millis") // Simulate async work
2047
- * return n * n
2048
- * }),
2049
- * { concurrency: 3, unordered: true }
2210
+ * (n) => Effect.succeed(n * n)
2050
2211
  * )
2212
+ * await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
2051
2213
  * ```
2052
2214
  *
2053
2215
  * @category sequencing
@@ -2072,40 +2234,15 @@ export const mapEffect: {
2072
2234
  *
2073
2235
  * **Example** (Mapping channel output with effects)
2074
2236
  *
2075
- * ```ts
2076
- * import { Channel, Data, Effect } from "effect"
2077
- *
2078
- * class NetworkError extends Data.TaggedError("NetworkError")<{
2079
- * readonly url: string
2080
- * }> {}
2081
- *
2082
- * // Transform values using effectful operations
2083
- * const urlsChannel = Channel.fromIterable([
2084
- * "/api/users/1",
2085
- * "/api/users/2",
2086
- * "/api/users/3"
2087
- * ])
2088
- *
2089
- * const fetchDataChannel = Channel.mapEffect(
2090
- * urlsChannel,
2091
- * (url) =>
2092
- * Effect.tryPromise({
2093
- * try: () => fetch(url).then((res) => res.json()),
2094
- * catch: () => new NetworkError({ url })
2095
- * })
2096
- * )
2237
+ * ```ts import.meta.vitest
2238
+ * import { Channel, Effect } from "effect"
2097
2239
  *
2098
- * // Concurrent processing with options
2099
2240
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
2100
2241
  * const processedChannel = Channel.mapEffect(
2101
2242
  * numbersChannel,
2102
- * (n) =>
2103
- * Effect.gen(function*() {
2104
- * yield* Effect.sleep("100 millis") // Simulate async work
2105
- * return n * n
2106
- * }),
2107
- * { concurrency: 3, unordered: true }
2243
+ * (n) => Effect.succeed(n * n)
2108
2244
  * )
2245
+ * await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
2109
2246
  * ```
2110
2247
  *
2111
2248
  * @category sequencing
@@ -2138,40 +2275,15 @@ export const mapEffect: {
2138
2275
  *
2139
2276
  * **Example** (Mapping channel output with effects)
2140
2277
  *
2141
- * ```ts
2142
- * import { Channel, Data, Effect } from "effect"
2143
- *
2144
- * class NetworkError extends Data.TaggedError("NetworkError")<{
2145
- * readonly url: string
2146
- * }> {}
2147
- *
2148
- * // Transform values using effectful operations
2149
- * const urlsChannel = Channel.fromIterable([
2150
- * "/api/users/1",
2151
- * "/api/users/2",
2152
- * "/api/users/3"
2153
- * ])
2154
- *
2155
- * const fetchDataChannel = Channel.mapEffect(
2156
- * urlsChannel,
2157
- * (url) =>
2158
- * Effect.tryPromise({
2159
- * try: () => fetch(url).then((res) => res.json()),
2160
- * catch: () => new NetworkError({ url })
2161
- * })
2162
- * )
2278
+ * ```ts import.meta.vitest
2279
+ * import { Channel, Effect } from "effect"
2163
2280
  *
2164
- * // Concurrent processing with options
2165
2281
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
2166
2282
  * const processedChannel = Channel.mapEffect(
2167
2283
  * numbersChannel,
2168
- * (n) =>
2169
- * Effect.gen(function*() {
2170
- * yield* Effect.sleep("100 millis") // Simulate async work
2171
- * return n * n
2172
- * }),
2173
- * { concurrency: 3, unordered: true }
2284
+ * (n) => Effect.succeed(n * n)
2174
2285
  * )
2286
+ * await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
2175
2287
  * ```
2176
2288
  *
2177
2289
  * @category sequencing
@@ -2414,8 +2526,8 @@ export const mapInputError: {
2414
2526
  *
2415
2527
  * **Example** (Tapping channel output)
2416
2528
  *
2417
- * ```ts
2418
- * import { Channel, Console, Data } from "effect"
2529
+ * ```ts import.meta.vitest
2530
+ * import { Channel, Data, Effect } from "effect"
2419
2531
  *
2420
2532
  * class LogError extends Data.TaggedError("LogError")<{
2421
2533
  * readonly message: string
@@ -2425,13 +2537,13 @@ export const mapInputError: {
2425
2537
  * const numberChannel = Channel.fromIterable([1, 2, 3])
2426
2538
  *
2427
2539
  * // Tap into each output element to perform side effects
2540
+ * const processed: Array<number> = []
2428
2541
  * const tappedChannel = Channel.tap(
2429
2542
  * numberChannel,
2430
- * (n) => Console.log(`Processing number: ${n}`)
2543
+ * (n) => Effect.sync(() => processed.push(n))
2431
2544
  * )
2432
2545
  *
2433
- * // The channel still outputs the same elements but logs each one
2434
- * // Outputs: 1, 2, 3 (while logging each)
2546
+ * const observed = [await Effect.runPromise(Channel.runCollect(tappedChannel)), processed] // => [[1, 2, 3], [1, 2, 3]]
2435
2547
  * ```
2436
2548
  *
2437
2549
  * @category sequencing
@@ -2450,8 +2562,8 @@ export const tap: {
2450
2562
  *
2451
2563
  * **Example** (Tapping channel output)
2452
2564
  *
2453
- * ```ts
2454
- * import { Channel, Console, Data } from "effect"
2565
+ * ```ts import.meta.vitest
2566
+ * import { Channel, Data, Effect } from "effect"
2455
2567
  *
2456
2568
  * class LogError extends Data.TaggedError("LogError")<{
2457
2569
  * readonly message: string
@@ -2461,13 +2573,13 @@ export const tap: {
2461
2573
  * const numberChannel = Channel.fromIterable([1, 2, 3])
2462
2574
  *
2463
2575
  * // Tap into each output element to perform side effects
2576
+ * const processed: Array<number> = []
2464
2577
  * const tappedChannel = Channel.tap(
2465
2578
  * numberChannel,
2466
- * (n) => Console.log(`Processing number: ${n}`)
2579
+ * (n) => Effect.sync(() => processed.push(n))
2467
2580
  * )
2468
2581
  *
2469
- * // The channel still outputs the same elements but logs each one
2470
- * // Outputs: 1, 2, 3 (while logging each)
2582
+ * const observed = [await Effect.runPromise(Channel.runCollect(tappedChannel)), processed] // => [[1, 2, 3], [1, 2, 3]]
2471
2583
  * ```
2472
2584
  *
2473
2585
  * @category sequencing
@@ -2493,8 +2605,8 @@ export const tap: {
2493
2605
  *
2494
2606
  * **Example** (Tapping channel output)
2495
2607
  *
2496
- * ```ts
2497
- * import { Channel, Console, Data } from "effect"
2608
+ * ```ts import.meta.vitest
2609
+ * import { Channel, Data, Effect } from "effect"
2498
2610
  *
2499
2611
  * class LogError extends Data.TaggedError("LogError")<{
2500
2612
  * readonly message: string
@@ -2504,13 +2616,13 @@ export const tap: {
2504
2616
  * const numberChannel = Channel.fromIterable([1, 2, 3])
2505
2617
  *
2506
2618
  * // Tap into each output element to perform side effects
2619
+ * const processed: Array<number> = []
2507
2620
  * const tappedChannel = Channel.tap(
2508
2621
  * numberChannel,
2509
- * (n) => Console.log(`Processing number: ${n}`)
2622
+ * (n) => Effect.sync(() => processed.push(n))
2510
2623
  * )
2511
2624
  *
2512
- * // The channel still outputs the same elements but logs each one
2513
- * // Outputs: 1, 2, 3 (while logging each)
2625
+ * const observed = [await Effect.runPromise(Channel.runCollect(tappedChannel)), processed] // => [[1, 2, 3], [1, 2, 3]]
2514
2626
  * ```
2515
2627
  *
2516
2628
  * @category sequencing
@@ -2548,8 +2660,8 @@ export const tap: {
2548
2660
  *
2549
2661
  * **Example** (Flat mapping channel output)
2550
2662
  *
2551
- * ```ts
2552
- * import { Channel, Data } from "effect"
2663
+ * ```ts import.meta.vitest
2664
+ * import { Channel, Data, Effect } from "effect"
2553
2665
  *
2554
2666
  * class ProcessError extends Data.TaggedError("ProcessError")<{
2555
2667
  * readonly cause: string
@@ -2565,8 +2677,7 @@ export const tap: {
2565
2677
  * Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
2566
2678
  * )
2567
2679
  *
2568
- * // Flattens nested channels into a single stream
2569
- * // Outputs: "item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"
2680
+ * Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
2570
2681
  * ```
2571
2682
  *
2572
2683
  * @category sequencing
@@ -2586,8 +2697,8 @@ export const flatMap: {
2586
2697
  *
2587
2698
  * **Example** (Flat mapping channel output)
2588
2699
  *
2589
- * ```ts
2590
- * import { Channel, Data } from "effect"
2700
+ * ```ts import.meta.vitest
2701
+ * import { Channel, Data, Effect } from "effect"
2591
2702
  *
2592
2703
  * class ProcessError extends Data.TaggedError("ProcessError")<{
2593
2704
  * readonly cause: string
@@ -2603,8 +2714,7 @@ export const flatMap: {
2603
2714
  * Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
2604
2715
  * )
2605
2716
  *
2606
- * // Flattens nested channels into a single stream
2607
- * // Outputs: "item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"
2717
+ * Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
2608
2718
  * ```
2609
2719
  *
2610
2720
  * @category sequencing
@@ -2640,8 +2750,8 @@ export const flatMap: {
2640
2750
  *
2641
2751
  * **Example** (Flat mapping channel output)
2642
2752
  *
2643
- * ```ts
2644
- * import { Channel, Data } from "effect"
2753
+ * ```ts import.meta.vitest
2754
+ * import { Channel, Data, Effect } from "effect"
2645
2755
  *
2646
2756
  * class ProcessError extends Data.TaggedError("ProcessError")<{
2647
2757
  * readonly cause: string
@@ -2657,8 +2767,7 @@ export const flatMap: {
2657
2767
  * Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
2658
2768
  * )
2659
2769
  *
2660
- * // Flattens nested channels into a single stream
2661
- * // Outputs: "item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"
2770
+ * Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
2662
2771
  * ```
2663
2772
  *
2664
2773
  * @category sequencing
@@ -2828,8 +2937,8 @@ const flatMapConcurrent = <
2828
2937
  *
2829
2938
  * **Example** (Concatenating with completion values)
2830
2939
  *
2831
- * ```ts
2832
- * import { Channel, Data } from "effect"
2940
+ * ```ts import.meta.vitest
2941
+ * import { Channel, Data, Effect } from "effect"
2833
2942
  *
2834
2943
  * class ConcatError extends Data.TaggedError("ConcatError")<{
2835
2944
  * readonly reason: string
@@ -2840,8 +2949,7 @@ const flatMapConcurrent = <
2840
2949
  * Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
2841
2950
  * )
2842
2951
  *
2843
- * // Concatenates additional channel based on completion value
2844
- * // Outputs: 1, 2, 3, then "Completed processing"
2952
+ * Effect.runSync(Channel.runCollect(numberChannel)) // => [1, 2, 3, "Completed processing"]
2845
2953
  * ```
2846
2954
  *
2847
2955
  * @category sequencing
@@ -2854,8 +2962,8 @@ export const concatWith: {
2854
2962
  *
2855
2963
  * **Example** (Concatenating with completion values)
2856
2964
  *
2857
- * ```ts
2858
- * import { Channel, Data } from "effect"
2965
+ * ```ts import.meta.vitest
2966
+ * import { Channel, Data, Effect } from "effect"
2859
2967
  *
2860
2968
  * class ConcatError extends Data.TaggedError("ConcatError")<{
2861
2969
  * readonly reason: string
@@ -2866,8 +2974,7 @@ export const concatWith: {
2866
2974
  * Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
2867
2975
  * )
2868
2976
  *
2869
- * // Concatenates additional channel based on completion value
2870
- * // Outputs: 1, 2, 3, then "Completed processing"
2977
+ * Effect.runSync(Channel.runCollect(numberChannel)) // => [1, 2, 3, "Completed processing"]
2871
2978
  * ```
2872
2979
  *
2873
2980
  * @category sequencing
@@ -2892,8 +2999,8 @@ export const concatWith: {
2892
2999
  *
2893
3000
  * **Example** (Concatenating with completion values)
2894
3001
  *
2895
- * ```ts
2896
- * import { Channel, Data } from "effect"
3002
+ * ```ts import.meta.vitest
3003
+ * import { Channel, Data, Effect } from "effect"
2897
3004
  *
2898
3005
  * class ConcatError extends Data.TaggedError("ConcatError")<{
2899
3006
  * readonly reason: string
@@ -2904,8 +3011,7 @@ export const concatWith: {
2904
3011
  * Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
2905
3012
  * )
2906
3013
  *
2907
- * // Concatenates additional channel based on completion value
2908
- * // Outputs: 1, 2, 3, then "Completed processing"
3014
+ * Effect.runSync(Channel.runCollect(numberChannel)) // => [1, 2, 3, "Completed processing"]
2909
3015
  * ```
2910
3016
  *
2911
3017
  * @category sequencing
@@ -2991,8 +3097,8 @@ export const concatWith: {
2991
3097
  *
2992
3098
  * **Example** (Concatenating channels)
2993
3099
  *
2994
- * ```ts
2995
- * import { Channel, Data } from "effect"
3100
+ * ```ts import.meta.vitest
3101
+ * import { Channel, Data, Effect } from "effect"
2996
3102
  *
2997
3103
  * class ConcatError extends Data.TaggedError("ConcatError")<{
2998
3104
  * readonly reason: string
@@ -3005,7 +3111,7 @@ export const concatWith: {
3005
3111
  * // Concatenate them
3006
3112
  * const concatenatedChannel = Channel.concat(firstChannel, secondChannel)
3007
3113
  *
3008
- * // Outputs: 1, 2, 3, "a", "b", "c"
3114
+ * Effect.runSync(Channel.runCollect(concatenatedChannel)) // => [1, 2, 3, "a", "b", "c"]
3009
3115
  * ```
3010
3116
  *
3011
3117
  * @category sequencing
@@ -3018,8 +3124,8 @@ export const concat: {
3018
3124
  *
3019
3125
  * **Example** (Concatenating channels)
3020
3126
  *
3021
- * ```ts
3022
- * import { Channel, Data } from "effect"
3127
+ * ```ts import.meta.vitest
3128
+ * import { Channel, Data, Effect } from "effect"
3023
3129
  *
3024
3130
  * class ConcatError extends Data.TaggedError("ConcatError")<{
3025
3131
  * readonly reason: string
@@ -3032,7 +3138,7 @@ export const concat: {
3032
3138
  * // Concatenate them
3033
3139
  * const concatenatedChannel = Channel.concat(firstChannel, secondChannel)
3034
3140
  *
3035
- * // Outputs: 1, 2, 3, "a", "b", "c"
3141
+ * Effect.runSync(Channel.runCollect(concatenatedChannel)) // => [1, 2, 3, "a", "b", "c"]
3036
3142
  * ```
3037
3143
  *
3038
3144
  * @category sequencing
@@ -3055,8 +3161,8 @@ export const concat: {
3055
3161
  *
3056
3162
  * **Example** (Concatenating channels)
3057
3163
  *
3058
- * ```ts
3059
- * import { Channel, Data } from "effect"
3164
+ * ```ts import.meta.vitest
3165
+ * import { Channel, Data, Effect } from "effect"
3060
3166
  *
3061
3167
  * class ConcatError extends Data.TaggedError("ConcatError")<{
3062
3168
  * readonly reason: string
@@ -3069,7 +3175,7 @@ export const concat: {
3069
3175
  * // Concatenate them
3070
3176
  * const concatenatedChannel = Channel.concat(firstChannel, secondChannel)
3071
3177
  *
3072
- * // Outputs: 1, 2, 3, "a", "b", "c"
3178
+ * Effect.runSync(Channel.runCollect(concatenatedChannel)) // => [1, 2, 3, "a", "b", "c"]
3073
3179
  * ```
3074
3180
  *
3075
3181
  * @category sequencing
@@ -3425,8 +3531,8 @@ export const orElseIfEmpty: {
3425
3531
  *
3426
3532
  * **Example** (Flattening nested channels)
3427
3533
  *
3428
- * ```ts
3429
- * import { Channel, Data } from "effect"
3534
+ * ```ts import.meta.vitest
3535
+ * import { Channel, Data, Effect } from "effect"
3430
3536
  *
3431
3537
  * class FlattenError extends Data.TaggedError("FlattenError")<{
3432
3538
  * readonly cause: string
@@ -3442,7 +3548,7 @@ export const orElseIfEmpty: {
3442
3548
  * // Flatten the nested channels
3443
3549
  * const flattenedChannel = Channel.flatten(nestedChannels)
3444
3550
  *
3445
- * // Outputs: 1, 2, 3, 4, 5, 6
3551
+ * Effect.runSync(Channel.runCollect(flattenedChannel)) // => [1, 2, 3, 4, 5, 6]
3446
3552
  * ```
3447
3553
  *
3448
3554
  * @category constructors
@@ -3480,8 +3586,8 @@ export const flatten = <
3480
3586
  *
3481
3587
  * **Example** (Flattening arrays of channel output)
3482
3588
  *
3483
- * ```ts
3484
- * import { Channel, Data } from "effect"
3589
+ * ```ts import.meta.vitest
3590
+ * import { Channel, Data, Effect } from "effect"
3485
3591
  *
3486
3592
  * class FlattenError extends Data.TaggedError("FlattenError")<{
3487
3593
  * readonly message: string
@@ -3497,7 +3603,7 @@ export const flatten = <
3497
3603
  * // Flatten the arrays into individual elements
3498
3604
  * const flattenedChannel = Channel.flattenArray(arrayChannel)
3499
3605
  *
3500
- * // Outputs: 1, 2, 3, 4, 5, 6, 7, 8, 9
3606
+ * Effect.runSync(Channel.runCollect(flattenedChannel)) // => [1, 2, 3, 4, 5, 6, 7, 8, 9]
3501
3607
  * ```
3502
3608
  *
3503
3609
  * @category transforming
@@ -3575,8 +3681,8 @@ export const flattenTake = <
3575
3681
  *
3576
3682
  * **Example** (Draining channel output)
3577
3683
  *
3578
- * ```ts
3579
- * import { Channel } from "effect"
3684
+ * ```ts import.meta.vitest
3685
+ * import { Channel, Effect } from "effect"
3580
3686
  *
3581
3687
  * // Create a channel that outputs values
3582
3688
  * const sourceChannel = Channel.fromIterable([1, 2, 3, 4, 5])
@@ -3584,8 +3690,7 @@ export const flattenTake = <
3584
3690
  * // Drain all output, keeping only the completion
3585
3691
  * const drainedChannel = Channel.drain(sourceChannel)
3586
3692
  *
3587
- * // The channel completes but emits no values
3588
- * // Useful for consuming side effects without collecting output
3693
+ * Effect.runSync(Channel.runCollect(drainedChannel)) // => []
3589
3694
  * ```
3590
3695
  *
3591
3696
  * @category constructors
@@ -3771,15 +3876,15 @@ export const schedule: {
3771
3876
  *
3772
3877
  * **Example** (Filtering channel output)
3773
3878
  *
3774
- * ```ts
3775
- * import { Channel } from "effect"
3879
+ * ```ts import.meta.vitest
3880
+ * import { Channel, Effect } from "effect"
3776
3881
  *
3777
3882
  * // Create a channel with mixed numbers
3778
3883
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
3779
3884
  *
3780
3885
  * // Filter to keep only even numbers
3781
3886
  * const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
3782
- * // Outputs: 2, 4, 6, 8
3887
+ * Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
3783
3888
  *
3784
3889
  * // Filter with type refinement
3785
3890
  * const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
@@ -3787,7 +3892,7 @@ export const schedule: {
3787
3892
  * mixedChannel,
3788
3893
  * (value): value is number => typeof value === "number"
3789
3894
  * )
3790
- * // Outputs: 1, 2, 3 (all typed as numbers)
3895
+ * Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
3791
3896
  * ```
3792
3897
  *
3793
3898
  * @category filtering
@@ -3800,15 +3905,15 @@ export const filter: {
3800
3905
  *
3801
3906
  * **Example** (Filtering channel output)
3802
3907
  *
3803
- * ```ts
3804
- * import { Channel } from "effect"
3908
+ * ```ts import.meta.vitest
3909
+ * import { Channel, Effect } from "effect"
3805
3910
  *
3806
3911
  * // Create a channel with mixed numbers
3807
3912
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
3808
3913
  *
3809
3914
  * // Filter to keep only even numbers
3810
3915
  * const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
3811
- * // Outputs: 2, 4, 6, 8
3916
+ * Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
3812
3917
  *
3813
3918
  * // Filter with type refinement
3814
3919
  * const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
@@ -3816,7 +3921,7 @@ export const filter: {
3816
3921
  * mixedChannel,
3817
3922
  * (value): value is number => typeof value === "number"
3818
3923
  * )
3819
- * // Outputs: 1, 2, 3 (all typed as numbers)
3924
+ * Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
3820
3925
  * ```
3821
3926
  *
3822
3927
  * @category filtering
@@ -3831,15 +3936,15 @@ export const filter: {
3831
3936
  *
3832
3937
  * **Example** (Filtering channel output)
3833
3938
  *
3834
- * ```ts
3835
- * import { Channel } from "effect"
3939
+ * ```ts import.meta.vitest
3940
+ * import { Channel, Effect } from "effect"
3836
3941
  *
3837
3942
  * // Create a channel with mixed numbers
3838
3943
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
3839
3944
  *
3840
3945
  * // Filter to keep only even numbers
3841
3946
  * const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
3842
- * // Outputs: 2, 4, 6, 8
3947
+ * Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
3843
3948
  *
3844
3949
  * // Filter with type refinement
3845
3950
  * const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
@@ -3847,7 +3952,7 @@ export const filter: {
3847
3952
  * mixedChannel,
3848
3953
  * (value): value is number => typeof value === "number"
3849
3954
  * )
3850
- * // Outputs: 1, 2, 3 (all typed as numbers)
3955
+ * Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
3851
3956
  * ```
3852
3957
  *
3853
3958
  * @category filtering
@@ -3862,15 +3967,15 @@ export const filter: {
3862
3967
  *
3863
3968
  * **Example** (Filtering channel output)
3864
3969
  *
3865
- * ```ts
3866
- * import { Channel } from "effect"
3970
+ * ```ts import.meta.vitest
3971
+ * import { Channel, Effect } from "effect"
3867
3972
  *
3868
3973
  * // Create a channel with mixed numbers
3869
3974
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
3870
3975
  *
3871
3976
  * // Filter to keep only even numbers
3872
3977
  * const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
3873
- * // Outputs: 2, 4, 6, 8
3978
+ * Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
3874
3979
  *
3875
3980
  * // Filter with type refinement
3876
3981
  * const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
@@ -3878,7 +3983,7 @@ export const filter: {
3878
3983
  * mixedChannel,
3879
3984
  * (value): value is number => typeof value === "number"
3880
3985
  * )
3881
- * // Outputs: 1, 2, 3 (all typed as numbers)
3986
+ * Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
3882
3987
  * ```
3883
3988
  *
3884
3989
  * @category filtering
@@ -3894,15 +3999,15 @@ export const filter: {
3894
3999
  *
3895
4000
  * **Example** (Filtering channel output)
3896
4001
  *
3897
- * ```ts
3898
- * import { Channel } from "effect"
4002
+ * ```ts import.meta.vitest
4003
+ * import { Channel, Effect } from "effect"
3899
4004
  *
3900
4005
  * // Create a channel with mixed numbers
3901
4006
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
3902
4007
  *
3903
4008
  * // Filter to keep only even numbers
3904
4009
  * const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
3905
- * // Outputs: 2, 4, 6, 8
4010
+ * Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
3906
4011
  *
3907
4012
  * // Filter with type refinement
3908
4013
  * const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
@@ -3910,7 +4015,7 @@ export const filter: {
3910
4015
  * mixedChannel,
3911
4016
  * (value): value is number => typeof value === "number"
3912
4017
  * )
3913
- * // Outputs: 1, 2, 3 (all typed as numbers)
4018
+ * Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
3914
4019
  * ```
3915
4020
  *
3916
4021
  * @category filtering
@@ -4203,8 +4308,8 @@ export const filterMapEffect: {
4203
4308
  *
4204
4309
  * **Example** (Filtering array output)
4205
4310
  *
4206
- * ```ts
4207
- * import { Array, Channel } from "effect"
4311
+ * ```ts import.meta.vitest
4312
+ * import { Array, Channel, Effect } from "effect"
4208
4313
  *
4209
4314
  * const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
4210
4315
  *
@@ -4217,7 +4322,7 @@ export const filterMapEffect: {
4217
4322
  *
4218
4323
  * // Filter arrays to keep only even numbers
4219
4324
  * const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
4220
- * // Outputs: [2, 4], [6, 8, 10], [12, 14]
4325
+ * Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
4221
4326
  * // Note: Only non-empty filtered arrays are emitted
4222
4327
  *
4223
4328
  * // Arrays that would become empty after filtering are discarded entirely
@@ -4227,7 +4332,7 @@ export const filterMapEffect: {
4227
4332
  * Array.make(7, 9)
4228
4333
  * ]).pipe(Channel.filter(nonEmptyArrayPredicate))
4229
4334
  * const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
4230
- * // Outputs: [2, 4] (the arrays [1,3,5] and [7,9] are discarded)
4335
+ * Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
4231
4336
  * ```
4232
4337
  *
4233
4338
  * @category filtering
@@ -4240,8 +4345,8 @@ export const filterArray: {
4240
4345
  *
4241
4346
  * **Example** (Filtering array output)
4242
4347
  *
4243
- * ```ts
4244
- * import { Array, Channel } from "effect"
4348
+ * ```ts import.meta.vitest
4349
+ * import { Array, Channel, Effect } from "effect"
4245
4350
  *
4246
4351
  * const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
4247
4352
  *
@@ -4254,7 +4359,7 @@ export const filterArray: {
4254
4359
  *
4255
4360
  * // Filter arrays to keep only even numbers
4256
4361
  * const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
4257
- * // Outputs: [2, 4], [6, 8, 10], [12, 14]
4362
+ * Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
4258
4363
  * // Note: Only non-empty filtered arrays are emitted
4259
4364
  *
4260
4365
  * // Arrays that would become empty after filtering are discarded entirely
@@ -4264,7 +4369,7 @@ export const filterArray: {
4264
4369
  * Array.make(7, 9)
4265
4370
  * ]).pipe(Channel.filter(nonEmptyArrayPredicate))
4266
4371
  * const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
4267
- * // Outputs: [2, 4] (the arrays [1,3,5] and [7,9] are discarded)
4372
+ * Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
4268
4373
  * ```
4269
4374
  *
4270
4375
  * @category filtering
@@ -4279,8 +4384,8 @@ export const filterArray: {
4279
4384
  *
4280
4385
  * **Example** (Filtering array output)
4281
4386
  *
4282
- * ```ts
4283
- * import { Array, Channel } from "effect"
4387
+ * ```ts import.meta.vitest
4388
+ * import { Array, Channel, Effect } from "effect"
4284
4389
  *
4285
4390
  * const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
4286
4391
  *
@@ -4293,7 +4398,7 @@ export const filterArray: {
4293
4398
  *
4294
4399
  * // Filter arrays to keep only even numbers
4295
4400
  * const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
4296
- * // Outputs: [2, 4], [6, 8, 10], [12, 14]
4401
+ * Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
4297
4402
  * // Note: Only non-empty filtered arrays are emitted
4298
4403
  *
4299
4404
  * // Arrays that would become empty after filtering are discarded entirely
@@ -4303,7 +4408,7 @@ export const filterArray: {
4303
4408
  * Array.make(7, 9)
4304
4409
  * ]).pipe(Channel.filter(nonEmptyArrayPredicate))
4305
4410
  * const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
4306
- * // Outputs: [2, 4] (the arrays [1,3,5] and [7,9] are discarded)
4411
+ * Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
4307
4412
  * ```
4308
4413
  *
4309
4414
  * @category filtering
@@ -4318,8 +4423,8 @@ export const filterArray: {
4318
4423
  *
4319
4424
  * **Example** (Filtering array output)
4320
4425
  *
4321
- * ```ts
4322
- * import { Array, Channel } from "effect"
4426
+ * ```ts import.meta.vitest
4427
+ * import { Array, Channel, Effect } from "effect"
4323
4428
  *
4324
4429
  * const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
4325
4430
  *
@@ -4332,7 +4437,7 @@ export const filterArray: {
4332
4437
  *
4333
4438
  * // Filter arrays to keep only even numbers
4334
4439
  * const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
4335
- * // Outputs: [2, 4], [6, 8, 10], [12, 14]
4440
+ * Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
4336
4441
  * // Note: Only non-empty filtered arrays are emitted
4337
4442
  *
4338
4443
  * // Arrays that would become empty after filtering are discarded entirely
@@ -4342,7 +4447,7 @@ export const filterArray: {
4342
4447
  * Array.make(7, 9)
4343
4448
  * ]).pipe(Channel.filter(nonEmptyArrayPredicate))
4344
4449
  * const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
4345
- * // Outputs: [2, 4] (the arrays [1,3,5] and [7,9] are discarded)
4450
+ * Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
4346
4451
  * ```
4347
4452
  *
4348
4453
  * @category filtering
@@ -4358,8 +4463,8 @@ export const filterArray: {
4358
4463
  *
4359
4464
  * **Example** (Filtering array output)
4360
4465
  *
4361
- * ```ts
4362
- * import { Array, Channel } from "effect"
4466
+ * ```ts import.meta.vitest
4467
+ * import { Array, Channel, Effect } from "effect"
4363
4468
  *
4364
4469
  * const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
4365
4470
  *
@@ -4372,7 +4477,7 @@ export const filterArray: {
4372
4477
  *
4373
4478
  * // Filter arrays to keep only even numbers
4374
4479
  * const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
4375
- * // Outputs: [2, 4], [6, 8, 10], [12, 14]
4480
+ * Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
4376
4481
  * // Note: Only non-empty filtered arrays are emitted
4377
4482
  *
4378
4483
  * // Arrays that would become empty after filtering are discarded entirely
@@ -4382,7 +4487,7 @@ export const filterArray: {
4382
4487
  * Array.make(7, 9)
4383
4488
  * ]).pipe(Channel.filter(nonEmptyArrayPredicate))
4384
4489
  * const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
4385
- * // Outputs: [2, 4] (the arrays [1,3,5] and [7,9] are discarded)
4490
+ * Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
4386
4491
  * ```
4387
4492
  *
4388
4493
  * @category filtering
@@ -4640,7 +4745,7 @@ export const filterMapArrayEffect: {
4640
4745
  *
4641
4746
  * **Example** (Mapping with accumulated state)
4642
4747
  *
4643
- * ```ts
4748
+ * ```ts import.meta.vitest
4644
4749
  * import { Channel, Effect } from "effect"
4645
4750
  *
4646
4751
  * // Create a channel with numbers
@@ -4656,8 +4761,6 @@ export const filterMapArrayEffect: {
4656
4761
  * return [newSum, [current, newSum]] as const
4657
4762
  * }
4658
4763
  * )
4659
- * // Outputs: 1, 1, 2, 3, 3, 6, 4, 10
4660
- *
4661
4764
  * // Using with Effect for async processing
4662
4765
  * const asyncMapAccum = Channel.mapAccum(
4663
4766
  * numbersChannel,
@@ -4668,6 +4771,8 @@ export const filterMapArrayEffect: {
4668
4771
  * return [newAcc, [`${value}-processed`, newAcc]] as const
4669
4772
  * })
4670
4773
  * )
4774
+ * Effect.runSync(Channel.runCollect(runningSum)) // => [1, 1, 2, 3, 3, 6, 4, 10]
4775
+ * Effect.runSync(Channel.runCollect(asyncMapAccum)) // => ["1-processed", "1", "2-processed", "12", "3-processed", "123", "4-processed", "1234"]
4671
4776
  * ```
4672
4777
  *
4673
4778
  * @category sequencing
@@ -4679,7 +4784,7 @@ export const mapAccum: {
4679
4784
  *
4680
4785
  * **Example** (Mapping with accumulated state)
4681
4786
  *
4682
- * ```ts
4787
+ * ```ts import.meta.vitest
4683
4788
  * import { Channel, Effect } from "effect"
4684
4789
  *
4685
4790
  * // Create a channel with numbers
@@ -4695,8 +4800,6 @@ export const mapAccum: {
4695
4800
  * return [newSum, [current, newSum]] as const
4696
4801
  * }
4697
4802
  * )
4698
- * // Outputs: 1, 1, 2, 3, 3, 6, 4, 10
4699
- *
4700
4803
  * // Using with Effect for async processing
4701
4804
  * const asyncMapAccum = Channel.mapAccum(
4702
4805
  * numbersChannel,
@@ -4707,6 +4810,8 @@ export const mapAccum: {
4707
4810
  * return [newAcc, [`${value}-processed`, newAcc]] as const
4708
4811
  * })
4709
4812
  * )
4813
+ * Effect.runSync(Channel.runCollect(runningSum)) // => [1, 1, 2, 3, 3, 6, 4, 10]
4814
+ * Effect.runSync(Channel.runCollect(asyncMapAccum)) // => ["1-processed", "1", "2-processed", "12", "3-processed", "123", "4-processed", "1234"]
4710
4815
  * ```
4711
4816
  *
4712
4817
  * @category sequencing
@@ -4744,7 +4849,7 @@ export const mapAccum: {
4744
4849
  *
4745
4850
  * **Example** (Mapping with accumulated state)
4746
4851
  *
4747
- * ```ts
4852
+ * ```ts import.meta.vitest
4748
4853
  * import { Channel, Effect } from "effect"
4749
4854
  *
4750
4855
  * // Create a channel with numbers
@@ -4760,8 +4865,6 @@ export const mapAccum: {
4760
4865
  * return [newSum, [current, newSum]] as const
4761
4866
  * }
4762
4867
  * )
4763
- * // Outputs: 1, 1, 2, 3, 3, 6, 4, 10
4764
- *
4765
4868
  * // Using with Effect for async processing
4766
4869
  * const asyncMapAccum = Channel.mapAccum(
4767
4870
  * numbersChannel,
@@ -4772,6 +4875,8 @@ export const mapAccum: {
4772
4875
  * return [newAcc, [`${value}-processed`, newAcc]] as const
4773
4876
  * })
4774
4877
  * )
4878
+ * Effect.runSync(Channel.runCollect(runningSum)) // => [1, 1, 2, 3, 3, 6, 4, 10]
4879
+ * Effect.runSync(Channel.runCollect(asyncMapAccum)) // => ["1-processed", "1", "2-processed", "12", "3-processed", "123", "4-processed", "1234"]
4775
4880
  * ```
4776
4881
  *
4777
4882
  * @category sequencing
@@ -4858,15 +4963,15 @@ export const mapAccum: {
4858
4963
  *
4859
4964
  * **Example** (Scanning channel output)
4860
4965
  *
4861
- * ```ts
4862
- * import { Channel } from "effect"
4966
+ * ```ts import.meta.vitest
4967
+ * import { Channel, Effect } from "effect"
4863
4968
  *
4864
4969
  * // Create a channel with numbers
4865
4970
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
4866
4971
  *
4867
4972
  * // Scan to create running sum
4868
4973
  * const runningSumChannel = Channel.scan(numbersChannel, 0, (sum, n) => sum + n)
4869
- * // Outputs: 0, 1, 3, 6, 10, 15
4974
+ * Effect.runSync(Channel.runCollect(runningSumChannel)) // => [0, 1, 3, 6, 10, 15]
4870
4975
  * // Note: emits the initial value and each intermediate result
4871
4976
  *
4872
4977
  * // Scan with string concatenation
@@ -4876,7 +4981,7 @@ export const mapAccum: {
4876
4981
  * "",
4877
4982
  * (sentence, word) => sentence === "" ? word : `${sentence} ${word}`
4878
4983
  * )
4879
- * // Outputs: "", "hello", "hello world", "hello world from", "hello world from effect"
4984
+ * Effect.runSync(Channel.runCollect(sentenceChannel)) // => ["", "hello", "hello world", "hello world from", "hello world from effect"]
4880
4985
  * ```
4881
4986
  *
4882
4987
  * @category sequencing
@@ -4889,15 +4994,15 @@ export const scan: {
4889
4994
  *
4890
4995
  * **Example** (Scanning channel output)
4891
4996
  *
4892
- * ```ts
4893
- * import { Channel } from "effect"
4997
+ * ```ts import.meta.vitest
4998
+ * import { Channel, Effect } from "effect"
4894
4999
  *
4895
5000
  * // Create a channel with numbers
4896
5001
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
4897
5002
  *
4898
5003
  * // Scan to create running sum
4899
5004
  * const runningSumChannel = Channel.scan(numbersChannel, 0, (sum, n) => sum + n)
4900
- * // Outputs: 0, 1, 3, 6, 10, 15
5005
+ * Effect.runSync(Channel.runCollect(runningSumChannel)) // => [0, 1, 3, 6, 10, 15]
4901
5006
  * // Note: emits the initial value and each intermediate result
4902
5007
  *
4903
5008
  * // Scan with string concatenation
@@ -4907,7 +5012,7 @@ export const scan: {
4907
5012
  * "",
4908
5013
  * (sentence, word) => sentence === "" ? word : `${sentence} ${word}`
4909
5014
  * )
4910
- * // Outputs: "", "hello", "hello world", "hello world from", "hello world from effect"
5015
+ * Effect.runSync(Channel.runCollect(sentenceChannel)) // => ["", "hello", "hello world", "hello world from", "hello world from effect"]
4911
5016
  * ```
4912
5017
  *
4913
5018
  * @category sequencing
@@ -4935,15 +5040,15 @@ export const scan: {
4935
5040
  *
4936
5041
  * **Example** (Scanning channel output)
4937
5042
  *
4938
- * ```ts
4939
- * import { Channel } from "effect"
5043
+ * ```ts import.meta.vitest
5044
+ * import { Channel, Effect } from "effect"
4940
5045
  *
4941
5046
  * // Create a channel with numbers
4942
5047
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
4943
5048
  *
4944
5049
  * // Scan to create running sum
4945
5050
  * const runningSumChannel = Channel.scan(numbersChannel, 0, (sum, n) => sum + n)
4946
- * // Outputs: 0, 1, 3, 6, 10, 15
5051
+ * Effect.runSync(Channel.runCollect(runningSumChannel)) // => [0, 1, 3, 6, 10, 15]
4947
5052
  * // Note: emits the initial value and each intermediate result
4948
5053
  *
4949
5054
  * // Scan with string concatenation
@@ -4953,7 +5058,7 @@ export const scan: {
4953
5058
  * "",
4954
5059
  * (sentence, word) => sentence === "" ? word : `${sentence} ${word}`
4955
5060
  * )
4956
- * // Outputs: "", "hello", "hello world", "hello world from", "hello world from effect"
5061
+ * Effect.runSync(Channel.runCollect(sentenceChannel)) // => ["", "hello", "hello world", "hello world from", "hello world from effect"]
4957
5062
  * ```
4958
5063
  *
4959
5064
  * @category sequencing
@@ -4982,7 +5087,7 @@ export const scan: {
4982
5087
  *
4983
5088
  * **Example** (Scanning channel output with effects)
4984
5089
  *
4985
- * ```ts
5090
+ * ```ts import.meta.vitest
4986
5091
  * import { Channel, Data, Effect } from "effect"
4987
5092
  *
4988
5093
  * class ScanError extends Data.TaggedError("ScanError")<{
@@ -4998,12 +5103,10 @@ export const scan: {
4998
5103
  * "",
4999
5104
  * (acc, value) =>
5000
5105
  * Effect.gen(function*() {
5001
- * // Simulate async work
5002
- * yield* Effect.sleep("10 millis")
5003
5106
  * return acc + value.toString()
5004
5107
  * })
5005
5108
  * )
5006
- * // Outputs: "", "1", "12", "123", "1234"
5109
+ * await Effect.runPromise(Channel.runCollect(asyncScanChannel)) // => ["", "1", "12", "123", "1234"]
5007
5110
  *
5008
5111
  * // Scan with error handling
5009
5112
  * const errorHandlingScan = Channel.scanEffect(
@@ -5016,6 +5119,7 @@ export const scan: {
5016
5119
  * return Effect.succeed(sum + n)
5017
5120
  * }
5018
5121
  * )
5122
+ * await Effect.runPromise(Channel.runCollect(errorHandlingScan)) // => [0, 1, 3, 6, 10]
5019
5123
  * ```
5020
5124
  *
5021
5125
  * @category sequencing
@@ -5033,7 +5137,7 @@ export const scanEffect: {
5033
5137
  *
5034
5138
  * **Example** (Scanning channel output with effects)
5035
5139
  *
5036
- * ```ts
5140
+ * ```ts import.meta.vitest
5037
5141
  * import { Channel, Data, Effect } from "effect"
5038
5142
  *
5039
5143
  * class ScanError extends Data.TaggedError("ScanError")<{
@@ -5049,12 +5153,10 @@ export const scanEffect: {
5049
5153
  * "",
5050
5154
  * (acc, value) =>
5051
5155
  * Effect.gen(function*() {
5052
- * // Simulate async work
5053
- * yield* Effect.sleep("10 millis")
5054
5156
  * return acc + value.toString()
5055
5157
  * })
5056
5158
  * )
5057
- * // Outputs: "", "1", "12", "123", "1234"
5159
+ * await Effect.runPromise(Channel.runCollect(asyncScanChannel)) // => ["", "1", "12", "123", "1234"]
5058
5160
  *
5059
5161
  * // Scan with error handling
5060
5162
  * const errorHandlingScan = Channel.scanEffect(
@@ -5067,6 +5169,7 @@ export const scanEffect: {
5067
5169
  * return Effect.succeed(sum + n)
5068
5170
  * }
5069
5171
  * )
5172
+ * await Effect.runPromise(Channel.runCollect(errorHandlingScan)) // => [0, 1, 3, 6, 10]
5070
5173
  * ```
5071
5174
  *
5072
5175
  * @category sequencing
@@ -5099,7 +5202,7 @@ export const scanEffect: {
5099
5202
  *
5100
5203
  * **Example** (Scanning channel output with effects)
5101
5204
  *
5102
- * ```ts
5205
+ * ```ts import.meta.vitest
5103
5206
  * import { Channel, Data, Effect } from "effect"
5104
5207
  *
5105
5208
  * class ScanError extends Data.TaggedError("ScanError")<{
@@ -5115,12 +5218,10 @@ export const scanEffect: {
5115
5218
  * "",
5116
5219
  * (acc, value) =>
5117
5220
  * Effect.gen(function*() {
5118
- * // Simulate async work
5119
- * yield* Effect.sleep("10 millis")
5120
5221
  * return acc + value.toString()
5121
5222
  * })
5122
5223
  * )
5123
- * // Outputs: "", "1", "12", "123", "1234"
5224
+ * await Effect.runPromise(Channel.runCollect(asyncScanChannel)) // => ["", "1", "12", "123", "1234"]
5124
5225
  *
5125
5226
  * // Scan with error handling
5126
5227
  * const errorHandlingScan = Channel.scanEffect(
@@ -5133,6 +5234,7 @@ export const scanEffect: {
5133
5234
  * return Effect.succeed(sum + n)
5134
5235
  * }
5135
5236
  * )
5237
+ * await Effect.runPromise(Channel.runCollect(errorHandlingScan)) // => [0, 1, 3, 6, 10]
5136
5238
  * ```
5137
5239
  *
5138
5240
  * @category sequencing
@@ -5174,8 +5276,8 @@ export const scanEffect: {
5174
5276
  *
5175
5277
  * **Example** (Recovering from failure causes)
5176
5278
  *
5177
- * ```ts
5178
- * import { Cause, Channel, Data } from "effect"
5279
+ * ```ts import.meta.vitest
5280
+ * import { Cause, Channel, Data, Effect } from "effect"
5179
5281
  *
5180
5282
  * class ProcessError extends Data.TaggedError("ProcessError")<{
5181
5283
  * readonly reason: string
@@ -5198,7 +5300,7 @@ export const scanEffect: {
5198
5300
  * return Channel.succeed("Recovered from interruption")
5199
5301
  * })
5200
5302
  *
5201
- * // The channel recovers gracefully from errors
5303
+ * Effect.runSync(Channel.runCollect(recoveredChannel)) // => ["Recovered from failure"]
5202
5304
  * ```
5203
5305
  *
5204
5306
  * @category error handling
@@ -5211,8 +5313,8 @@ export const catchCause: {
5211
5313
  *
5212
5314
  * **Example** (Recovering from failure causes)
5213
5315
  *
5214
- * ```ts
5215
- * import { Cause, Channel, Data } from "effect"
5316
+ * ```ts import.meta.vitest
5317
+ * import { Cause, Channel, Data, Effect } from "effect"
5216
5318
  *
5217
5319
  * class ProcessError extends Data.TaggedError("ProcessError")<{
5218
5320
  * readonly reason: string
@@ -5235,7 +5337,7 @@ export const catchCause: {
5235
5337
  * return Channel.succeed("Recovered from interruption")
5236
5338
  * })
5237
5339
  *
5238
- * // The channel recovers gracefully from errors
5340
+ * Effect.runSync(Channel.runCollect(recoveredChannel)) // => ["Recovered from failure"]
5239
5341
  * ```
5240
5342
  *
5241
5343
  * @category error handling
@@ -5265,8 +5367,8 @@ export const catchCause: {
5265
5367
  *
5266
5368
  * **Example** (Recovering from failure causes)
5267
5369
  *
5268
- * ```ts
5269
- * import { Cause, Channel, Data } from "effect"
5370
+ * ```ts import.meta.vitest
5371
+ * import { Cause, Channel, Data, Effect } from "effect"
5270
5372
  *
5271
5373
  * class ProcessError extends Data.TaggedError("ProcessError")<{
5272
5374
  * readonly reason: string
@@ -5289,7 +5391,7 @@ export const catchCause: {
5289
5391
  * return Channel.succeed("Recovered from interruption")
5290
5392
  * })
5291
5393
  *
5292
- * // The channel recovers gracefully from errors
5394
+ * Effect.runSync(Channel.runCollect(recoveredChannel)) // => ["Recovered from failure"]
5293
5395
  * ```
5294
5396
  *
5295
5397
  * @category error handling
@@ -6762,8 +6864,8 @@ export const catchTag: {
6762
6864
  *
6763
6865
  * **Example** (Recovering from nested reasons)
6764
6866
  *
6765
- * ```ts
6766
- * import { Channel, Data } from "effect"
6867
+ * ```ts import.meta.vitest
6868
+ * import { Channel, Data, Effect } from "effect"
6767
6869
  *
6768
6870
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
6769
6871
  * retryAfter: number
@@ -6777,15 +6879,15 @@ export const catchTag: {
6777
6879
  * reason: RateLimitError | QuotaExceededError
6778
6880
  * }> {}
6779
6881
  *
6780
- * const channel = Channel.fail(
6781
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
6782
- * )
6882
+ * const reason = new RateLimitError({ retryAfter: 60 })
6883
+ * const channel = Channel.fail(new AiError({ reason }))
6783
6884
  *
6784
6885
  * const recovered = channel.pipe(
6785
6886
  * Channel.catchReason("AiError", "RateLimitError", (reason) =>
6786
6887
  * Channel.succeed(`retry: ${reason.retryAfter}`)
6787
6888
  * )
6788
6889
  * )
6890
+ * Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
6789
6891
  * ```
6790
6892
  *
6791
6893
  * @category error handling
@@ -6797,8 +6899,8 @@ export const catchReason: {
6797
6899
  *
6798
6900
  * **Example** (Recovering from nested reasons)
6799
6901
  *
6800
- * ```ts
6801
- * import { Channel, Data } from "effect"
6902
+ * ```ts import.meta.vitest
6903
+ * import { Channel, Data, Effect } from "effect"
6802
6904
  *
6803
6905
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
6804
6906
  * retryAfter: number
@@ -6812,15 +6914,15 @@ export const catchReason: {
6812
6914
  * reason: RateLimitError | QuotaExceededError
6813
6915
  * }> {}
6814
6916
  *
6815
- * const channel = Channel.fail(
6816
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
6817
- * )
6917
+ * const reason = new RateLimitError({ retryAfter: 60 })
6918
+ * const channel = Channel.fail(new AiError({ reason }))
6818
6919
  *
6819
6920
  * const recovered = channel.pipe(
6820
6921
  * Channel.catchReason("AiError", "RateLimitError", (reason) =>
6821
6922
  * Channel.succeed(`retry: ${reason.retryAfter}`)
6822
6923
  * )
6823
6924
  * )
6925
+ * Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
6824
6926
  * ```
6825
6927
  *
6826
6928
  * @category error handling
@@ -6883,8 +6985,8 @@ export const catchReason: {
6883
6985
  *
6884
6986
  * **Example** (Recovering from nested reasons)
6885
6987
  *
6886
- * ```ts
6887
- * import { Channel, Data } from "effect"
6988
+ * ```ts import.meta.vitest
6989
+ * import { Channel, Data, Effect } from "effect"
6888
6990
  *
6889
6991
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
6890
6992
  * retryAfter: number
@@ -6898,15 +7000,15 @@ export const catchReason: {
6898
7000
  * reason: RateLimitError | QuotaExceededError
6899
7001
  * }> {}
6900
7002
  *
6901
- * const channel = Channel.fail(
6902
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
6903
- * )
7003
+ * const reason = new RateLimitError({ retryAfter: 60 })
7004
+ * const channel = Channel.fail(new AiError({ reason }))
6904
7005
  *
6905
7006
  * const recovered = channel.pipe(
6906
7007
  * Channel.catchReason("AiError", "RateLimitError", (reason) =>
6907
7008
  * Channel.succeed(`retry: ${reason.retryAfter}`)
6908
7009
  * )
6909
7010
  * )
7011
+ * Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
6910
7012
  * ```
6911
7013
  *
6912
7014
  * @category error handling
@@ -7227,8 +7329,8 @@ export const catchReasons: {
7227
7329
  *
7228
7330
  * **Example** (Promoting nested reasons)
7229
7331
  *
7230
- * ```ts
7231
- * import { Channel, Data } from "effect"
7332
+ * ```ts import.meta.vitest
7333
+ * import { Channel, Data, Effect, Exit } from "effect"
7232
7334
  *
7233
7335
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
7234
7336
  * retryAfter: number
@@ -7242,11 +7344,11 @@ export const catchReasons: {
7242
7344
  * reason: RateLimitError | QuotaExceededError
7243
7345
  * }> {}
7244
7346
  *
7245
- * const channel = Channel.fail(
7246
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
7247
- * )
7347
+ * const reason = new RateLimitError({ retryAfter: 60 })
7348
+ * const channel = Channel.fail(new AiError({ reason }))
7248
7349
  *
7249
7350
  * const unwrapped = channel.pipe(Channel.unwrapReason("AiError"))
7351
+ * Effect.runSync(Effect.exit(Channel.runCollect(unwrapped))) // => Exit.fail(reason)
7250
7352
  * ```
7251
7353
  *
7252
7354
  * @category error handling
@@ -7258,8 +7360,8 @@ export const unwrapReason: {
7258
7360
  *
7259
7361
  * **Example** (Promoting nested reasons)
7260
7362
  *
7261
- * ```ts
7262
- * import { Channel, Data } from "effect"
7363
+ * ```ts import.meta.vitest
7364
+ * import { Channel, Data, Effect, Exit } from "effect"
7263
7365
  *
7264
7366
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
7265
7367
  * retryAfter: number
@@ -7273,11 +7375,11 @@ export const unwrapReason: {
7273
7375
  * reason: RateLimitError | QuotaExceededError
7274
7376
  * }> {}
7275
7377
  *
7276
- * const channel = Channel.fail(
7277
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
7278
- * )
7378
+ * const reason = new RateLimitError({ retryAfter: 60 })
7379
+ * const channel = Channel.fail(new AiError({ reason }))
7279
7380
  *
7280
7381
  * const unwrapped = channel.pipe(Channel.unwrapReason("AiError"))
7382
+ * Effect.runSync(Effect.exit(Channel.runCollect(unwrapped))) // => Exit.fail(reason)
7281
7383
  * ```
7282
7384
  *
7283
7385
  * @category error handling
@@ -7302,8 +7404,8 @@ export const unwrapReason: {
7302
7404
  *
7303
7405
  * **Example** (Promoting nested reasons)
7304
7406
  *
7305
- * ```ts
7306
- * import { Channel, Data } from "effect"
7407
+ * ```ts import.meta.vitest
7408
+ * import { Channel, Data, Effect, Exit } from "effect"
7307
7409
  *
7308
7410
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
7309
7411
  * retryAfter: number
@@ -7317,11 +7419,11 @@ export const unwrapReason: {
7317
7419
  * reason: RateLimitError | QuotaExceededError
7318
7420
  * }> {}
7319
7421
  *
7320
- * const channel = Channel.fail(
7321
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
7322
- * )
7422
+ * const reason = new RateLimitError({ retryAfter: 60 })
7423
+ * const channel = Channel.fail(new AiError({ reason }))
7323
7424
  *
7324
7425
  * const unwrapped = channel.pipe(Channel.unwrapReason("AiError"))
7426
+ * Effect.runSync(Effect.exit(Channel.runCollect(unwrapped))) // => Exit.fail(reason)
7325
7427
  * ```
7326
7428
  *
7327
7429
  * @category error handling
@@ -7419,20 +7521,21 @@ export const mapError: {
7419
7521
  *
7420
7522
  * **Example** (Converting failures to defects)
7421
7523
  *
7422
- * ```ts
7423
- * import { Channel, Data } from "effect"
7524
+ * ```ts import.meta.vitest
7525
+ * import { Cause, Channel, Data, Effect, Exit } from "effect"
7424
7526
  *
7425
7527
  * class ValidationError extends Data.TaggedError("ValidationError")<{
7426
7528
  * readonly field: string
7427
7529
  * }> {}
7428
7530
  *
7429
7531
  * // Create a channel that might fail
7430
- * const failingChannel = Channel.fail(new ValidationError({ field: "email" }))
7532
+ * const error = new ValidationError({ field: "email" })
7533
+ * const failingChannel = Channel.fail(error)
7431
7534
  *
7432
7535
  * // Convert failures to defects
7433
7536
  * const fatalChannel = Channel.orDie(failingChannel)
7434
7537
  *
7435
- * // Any failure will now become a defect (uncaught exception)
7538
+ * Effect.runSync(Effect.exit(Channel.runCollect(fatalChannel))) // => Exit.failCause(Cause.die(error))
7436
7539
  * ```
7437
7540
  *
7438
7541
  * @category error handling
@@ -7647,8 +7750,8 @@ export const retry: {
7647
7750
  *
7648
7751
  * **Example** (Switching mapped channels)
7649
7752
  *
7650
- * ```ts
7651
- * import { Channel, Data } from "effect"
7753
+ * ```ts import.meta.vitest
7754
+ * import { Channel, Data, Effect } from "effect"
7652
7755
  *
7653
7756
  * class SwitchError extends Data.TaggedError("SwitchError")<{
7654
7757
  * readonly reason: string
@@ -7663,7 +7766,7 @@ export const retry: {
7663
7766
  * (n) => Channel.fromIterable([`value-${n}`])
7664
7767
  * )
7665
7768
  *
7666
- * // Outputs: "value-1", "value-2", "value-3"
7769
+ * await Effect.runPromise(Channel.runCollect(switchedChannel)) // => ["value-3"]
7667
7770
  * ```
7668
7771
  *
7669
7772
  * @category sequencing
@@ -7682,8 +7785,8 @@ export const switchMap: {
7682
7785
  *
7683
7786
  * **Example** (Switching mapped channels)
7684
7787
  *
7685
- * ```ts
7686
- * import { Channel, Data } from "effect"
7788
+ * ```ts import.meta.vitest
7789
+ * import { Channel, Data, Effect } from "effect"
7687
7790
  *
7688
7791
  * class SwitchError extends Data.TaggedError("SwitchError")<{
7689
7792
  * readonly reason: string
@@ -7698,7 +7801,7 @@ export const switchMap: {
7698
7801
  * (n) => Channel.fromIterable([`value-${n}`])
7699
7802
  * )
7700
7803
  *
7701
- * // Outputs: "value-1", "value-2", "value-3"
7804
+ * await Effect.runPromise(Channel.runCollect(switchedChannel)) // => ["value-3"]
7702
7805
  * ```
7703
7806
  *
7704
7807
  * @category sequencing
@@ -7733,8 +7836,8 @@ export const switchMap: {
7733
7836
  *
7734
7837
  * **Example** (Switching mapped channels)
7735
7838
  *
7736
- * ```ts
7737
- * import { Channel, Data } from "effect"
7839
+ * ```ts import.meta.vitest
7840
+ * import { Channel, Data, Effect } from "effect"
7738
7841
  *
7739
7842
  * class SwitchError extends Data.TaggedError("SwitchError")<{
7740
7843
  * readonly reason: string
@@ -7749,7 +7852,7 @@ export const switchMap: {
7749
7852
  * (n) => Channel.fromIterable([`value-${n}`])
7750
7853
  * )
7751
7854
  *
7752
- * // Outputs: "value-1", "value-2", "value-3"
7855
+ * await Effect.runPromise(Channel.runCollect(switchedChannel)) // => ["value-3"]
7753
7856
  * ```
7754
7857
  *
7755
7858
  * @category sequencing
@@ -7839,8 +7942,8 @@ export const switchMap: {
7839
7942
  *
7840
7943
  * **Example** (Merging nested channels)
7841
7944
  *
7842
- * ```ts
7843
- * import { Channel, Data } from "effect"
7945
+ * ```ts import.meta.vitest
7946
+ * import { Channel, Data, Effect } from "effect"
7844
7947
  *
7845
7948
  * class MergeAllError extends Data.TaggedError("MergeAllError")<{
7846
7949
  * readonly reason: string
@@ -7855,11 +7958,11 @@ export const switchMap: {
7855
7958
  *
7856
7959
  * // Merge all channels with bounded concurrency
7857
7960
  * const mergedChannel = Channel.mergeAll({
7858
- * concurrency: 2,
7961
+ * concurrency: 1,
7859
7962
  * bufferSize: 16
7860
7963
  * })(nestedChannels)
7861
7964
  *
7862
- * // Outputs: 1, 2, 3, 4, 5, 6 (order may vary due to concurrency)
7965
+ * await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
7863
7966
  * ```
7864
7967
  *
7865
7968
  * @category combining
@@ -7876,8 +7979,8 @@ export const mergeAll: {
7876
7979
  *
7877
7980
  * **Example** (Merging nested channels)
7878
7981
  *
7879
- * ```ts
7880
- * import { Channel, Data } from "effect"
7982
+ * ```ts import.meta.vitest
7983
+ * import { Channel, Data, Effect } from "effect"
7881
7984
  *
7882
7985
  * class MergeAllError extends Data.TaggedError("MergeAllError")<{
7883
7986
  * readonly reason: string
@@ -7892,11 +7995,11 @@ export const mergeAll: {
7892
7995
  *
7893
7996
  * // Merge all channels with bounded concurrency
7894
7997
  * const mergedChannel = Channel.mergeAll({
7895
- * concurrency: 2,
7998
+ * concurrency: 1,
7896
7999
  * bufferSize: 16
7897
8000
  * })(nestedChannels)
7898
8001
  *
7899
- * // Outputs: 1, 2, 3, 4, 5, 6 (order may vary due to concurrency)
8002
+ * await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
7900
8003
  * ```
7901
8004
  *
7902
8005
  * @category combining
@@ -7937,8 +8040,8 @@ export const mergeAll: {
7937
8040
  *
7938
8041
  * **Example** (Merging nested channels)
7939
8042
  *
7940
- * ```ts
7941
- * import { Channel, Data } from "effect"
8043
+ * ```ts import.meta.vitest
8044
+ * import { Channel, Data, Effect } from "effect"
7942
8045
  *
7943
8046
  * class MergeAllError extends Data.TaggedError("MergeAllError")<{
7944
8047
  * readonly reason: string
@@ -7953,11 +8056,11 @@ export const mergeAll: {
7953
8056
  *
7954
8057
  * // Merge all channels with bounded concurrency
7955
8058
  * const mergedChannel = Channel.mergeAll({
7956
- * concurrency: 2,
8059
+ * concurrency: 1,
7957
8060
  * bufferSize: 16
7958
8061
  * })(nestedChannels)
7959
8062
  *
7960
- * // Outputs: 1, 2, 3, 4, 5, 6 (order may vary due to concurrency)
8063
+ * await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
7961
8064
  * ```
7962
8065
  *
7963
8066
  * @category combining
@@ -8032,8 +8135,8 @@ export const mergeAll: {
8032
8135
  *
8033
8136
  * **Example** (Merging nested channels)
8034
8137
  *
8035
- * ```ts
8036
- * import { Channel, Data } from "effect"
8138
+ * ```ts import.meta.vitest
8139
+ * import { Channel, Data, Effect } from "effect"
8037
8140
  *
8038
8141
  * class MergeAllError extends Data.TaggedError("MergeAllError")<{
8039
8142
  * readonly reason: string
@@ -8048,11 +8151,11 @@ export const mergeAll: {
8048
8151
  *
8049
8152
  * // Merge all channels with bounded concurrency
8050
8153
  * const mergedChannel = Channel.mergeAll({
8051
- * concurrency: 2,
8154
+ * concurrency: 1,
8052
8155
  * bufferSize: 16
8053
8156
  * })(nestedChannels)
8054
8157
  *
8055
- * // Outputs: 1, 2, 3, 4, 5, 6 (order may vary due to concurrency)
8158
+ * await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
8056
8159
  * ```
8057
8160
  *
8058
8161
  * @category combining
@@ -8068,8 +8171,8 @@ export const mergeAll: {
8068
8171
  *
8069
8172
  * **Example** (Merging nested channels)
8070
8173
  *
8071
- * ```ts
8072
- * import { Channel, Data } from "effect"
8174
+ * ```ts import.meta.vitest
8175
+ * import { Channel, Data, Effect } from "effect"
8073
8176
  *
8074
8177
  * class MergeAllError extends Data.TaggedError("MergeAllError")<{
8075
8178
  * readonly reason: string
@@ -8084,11 +8187,11 @@ export const mergeAll: {
8084
8187
  *
8085
8188
  * // Merge all channels with bounded concurrency
8086
8189
  * const mergedChannel = Channel.mergeAll({
8087
- * concurrency: 2,
8190
+ * concurrency: 1,
8088
8191
  * bufferSize: 16
8089
8192
  * })(nestedChannels)
8090
8193
  *
8091
- * // Outputs: 1, 2, 3, 4, 5, 6 (order may vary due to concurrency)
8194
+ * await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
8092
8195
  * ```
8093
8196
  *
8094
8197
  * @category combining
@@ -8172,14 +8275,11 @@ export const mergeAll: {
8172
8275
  *
8173
8276
  * **Example** (Choosing merge halt strategies)
8174
8277
  *
8175
- * ```ts
8176
- * import type { Channel } from "effect"
8278
+ * ```ts import.meta.vitest
8279
+ * import { Channel } from "effect"
8177
8280
  *
8178
8281
  * // Different halt strategies for channel merging
8179
- * const leftFirst: Channel.HaltStrategy = "left" // Stop when left channel halts
8180
- * const rightFirst: Channel.HaltStrategy = "right" // Stop when right channel halts
8181
- * const both: Channel.HaltStrategy = "both" // Stop when both channels halt
8182
- * const either: Channel.HaltStrategy = "either" // Stop when either channel halts
8282
+ * const strategies: Array<Channel.HaltStrategy> = ["left", "right", "both", "either"] // => ["left", "right", "both", "either"]
8183
8283
  * ```
8184
8284
  *
8185
8285
  * @category models
@@ -8193,24 +8293,18 @@ export type HaltStrategy = "left" | "right" | "both" | "either"
8193
8293
  *
8194
8294
  * **Example** (Merging channels)
8195
8295
  *
8196
- * ```ts
8197
- * import { Channel, Data } from "effect"
8198
- *
8199
- * class MergeError extends Data.TaggedError("MergeError")<{
8200
- * readonly source: string
8201
- * }> {}
8296
+ * ```ts import.meta.vitest
8297
+ * import { Channel, Effect } from "effect"
8202
8298
  *
8203
8299
  * // Create two channels
8204
8300
  * const leftChannel = Channel.fromIterable([1, 2, 3])
8205
8301
  * const rightChannel = Channel.fromIterable(["a", "b", "c"])
8206
8302
  *
8207
- * // Merge them with "either" halt strategy
8208
- * const mergedChannel = Channel.merge(leftChannel, rightChannel, {
8209
- * haltStrategy: "either"
8210
- * })
8303
+ * // The default "both" strategy waits for both channels to complete
8304
+ * const mergedChannel = Channel.merge(leftChannel, rightChannel)
8211
8305
  *
8212
- * // Outputs elements from both channels concurrently
8213
- * // Order may vary: 1, "a", 2, "b", 3, "c"
8306
+ * const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
8307
+ * values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
8214
8308
  * ```
8215
8309
  *
8216
8310
  * @category combining
@@ -8223,24 +8317,18 @@ export const merge: {
8223
8317
  *
8224
8318
  * **Example** (Merging channels)
8225
8319
  *
8226
- * ```ts
8227
- * import { Channel, Data } from "effect"
8228
- *
8229
- * class MergeError extends Data.TaggedError("MergeError")<{
8230
- * readonly source: string
8231
- * }> {}
8320
+ * ```ts import.meta.vitest
8321
+ * import { Channel, Effect } from "effect"
8232
8322
  *
8233
8323
  * // Create two channels
8234
8324
  * const leftChannel = Channel.fromIterable([1, 2, 3])
8235
8325
  * const rightChannel = Channel.fromIterable(["a", "b", "c"])
8236
8326
  *
8237
- * // Merge them with "either" halt strategy
8238
- * const mergedChannel = Channel.merge(leftChannel, rightChannel, {
8239
- * haltStrategy: "either"
8240
- * })
8327
+ * // The default "both" strategy waits for both channels to complete
8328
+ * const mergedChannel = Channel.merge(leftChannel, rightChannel)
8241
8329
  *
8242
- * // Outputs elements from both channels concurrently
8243
- * // Order may vary: 1, "a", 2, "b", 3, "c"
8330
+ * const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
8331
+ * values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
8244
8332
  * ```
8245
8333
  *
8246
8334
  * @category combining
@@ -8268,24 +8356,18 @@ export const merge: {
8268
8356
  *
8269
8357
  * **Example** (Merging channels)
8270
8358
  *
8271
- * ```ts
8272
- * import { Channel, Data } from "effect"
8273
- *
8274
- * class MergeError extends Data.TaggedError("MergeError")<{
8275
- * readonly source: string
8276
- * }> {}
8359
+ * ```ts import.meta.vitest
8360
+ * import { Channel, Effect } from "effect"
8277
8361
  *
8278
8362
  * // Create two channels
8279
8363
  * const leftChannel = Channel.fromIterable([1, 2, 3])
8280
8364
  * const rightChannel = Channel.fromIterable(["a", "b", "c"])
8281
8365
  *
8282
- * // Merge them with "either" halt strategy
8283
- * const mergedChannel = Channel.merge(leftChannel, rightChannel, {
8284
- * haltStrategy: "either"
8285
- * })
8366
+ * // The default "both" strategy waits for both channels to complete
8367
+ * const mergedChannel = Channel.merge(leftChannel, rightChannel)
8286
8368
  *
8287
- * // Outputs elements from both channels concurrently
8288
- * // Order may vary: 1, "a", 2, "b", 3, "c"
8369
+ * const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
8370
+ * values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
8289
8371
  * ```
8290
8372
  *
8291
8373
  * @category combining
@@ -8359,24 +8441,18 @@ export const merge: {
8359
8441
  *
8360
8442
  * **Example** (Merging channels)
8361
8443
  *
8362
- * ```ts
8363
- * import { Channel, Data } from "effect"
8364
- *
8365
- * class MergeError extends Data.TaggedError("MergeError")<{
8366
- * readonly source: string
8367
- * }> {}
8444
+ * ```ts import.meta.vitest
8445
+ * import { Channel, Effect } from "effect"
8368
8446
  *
8369
8447
  * // Create two channels
8370
8448
  * const leftChannel = Channel.fromIterable([1, 2, 3])
8371
8449
  * const rightChannel = Channel.fromIterable(["a", "b", "c"])
8372
8450
  *
8373
- * // Merge them with "either" halt strategy
8374
- * const mergedChannel = Channel.merge(leftChannel, rightChannel, {
8375
- * haltStrategy: "either"
8376
- * })
8451
+ * // The default "both" strategy waits for both channels to complete
8452
+ * const mergedChannel = Channel.merge(leftChannel, rightChannel)
8377
8453
  *
8378
- * // Outputs elements from both channels concurrently
8379
- * // Order may vary: 1, "a", 2, "b", 3, "c"
8454
+ * const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
8455
+ * values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
8380
8456
  * ```
8381
8457
  *
8382
8458
  * @category combining
@@ -8388,24 +8464,18 @@ export const merge: {
8388
8464
  *
8389
8465
  * **Example** (Merging channels)
8390
8466
  *
8391
- * ```ts
8392
- * import { Channel, Data } from "effect"
8393
- *
8394
- * class MergeError extends Data.TaggedError("MergeError")<{
8395
- * readonly source: string
8396
- * }> {}
8467
+ * ```ts import.meta.vitest
8468
+ * import { Channel, Effect } from "effect"
8397
8469
  *
8398
8470
  * // Create two channels
8399
8471
  * const leftChannel = Channel.fromIterable([1, 2, 3])
8400
8472
  * const rightChannel = Channel.fromIterable(["a", "b", "c"])
8401
8473
  *
8402
- * // Merge them with "either" halt strategy
8403
- * const mergedChannel = Channel.merge(leftChannel, rightChannel, {
8404
- * haltStrategy: "either"
8405
- * })
8474
+ * // The default "both" strategy waits for both channels to complete
8475
+ * const mergedChannel = Channel.merge(leftChannel, rightChannel)
8406
8476
  *
8407
- * // Outputs elements from both channels concurrently
8408
- * // Order may vary: 1, "a", 2, "b", 3, "c"
8477
+ * const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
8478
+ * values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
8409
8479
  * ```
8410
8480
  *
8411
8481
  * @category combining
@@ -8551,19 +8621,16 @@ export const mergeEffect: {
8551
8621
  *
8552
8622
  * **Example** (Splitting string chunks into lines)
8553
8623
  *
8554
- * ```ts
8624
+ * ```ts import.meta.vitest
8555
8625
  * import { Effect, Stream } from "effect"
8556
8626
  *
8557
- * Effect.runPromise(Effect.gen(function*() {
8558
- * const result = yield* Stream.runCollect(
8559
- * Stream.splitLines(Stream.make("hel", "lo\r\nwor", "ld\n"))
8560
- * )
8561
- * console.log(result)
8562
- * // [ 'hello', 'world' ]
8563
- * }))
8627
+ * const result = await Effect.runPromise(Stream.runCollect(
8628
+ * Stream.splitLines(Stream.make("hel", "lo\r\nwor", "ld\n"))
8629
+ * ))
8630
+ * result // => ["hello", "world"]
8564
8631
  * ```
8565
8632
  *
8566
- * @category String manipulation
8633
+ * @category splitting
8567
8634
  * @since 2.0.0
8568
8635
  */
8569
8636
  export const splitLines = <Err, Done>(): Channel<
@@ -8677,7 +8744,7 @@ export const splitLines = <Err, Done>(): Channel<
8677
8744
  * span `Uint8Array` boundaries. The optional `encoding` and `options` are
8678
8745
  * passed to `TextDecoder`.
8679
8746
  *
8680
- * @category String manipulation
8747
+ * @category decoding
8681
8748
  * @since 4.0.0
8682
8749
  */
8683
8750
  export const decodeText = <Err, Done>(encoding?: string, options?: TextDecoderOptions): Channel<
@@ -8703,7 +8770,7 @@ export const decodeText = <Err, Done>(encoding?: string, options?: TextDecoderOp
8703
8770
  *
8704
8771
  * Each string inside an emitted array is encoded independently.
8705
8772
  *
8706
- * @category String manipulation
8773
+ * @category encoding
8707
8774
  * @since 4.0.0
8708
8775
  */
8709
8776
  export const encodeText = <Err, Done>(): Channel<
@@ -8729,8 +8796,8 @@ export const encodeText = <Err, Done>(): Channel<
8729
8796
  *
8730
8797
  * **Example** (Piping one channel into another)
8731
8798
  *
8732
- * ```ts
8733
- * import { Channel, Data } from "effect"
8799
+ * ```ts import.meta.vitest
8800
+ * import { Channel, Data, Effect } from "effect"
8734
8801
  *
8735
8802
  * class PipeError extends Data.TaggedError("PipeError")<{
8736
8803
  * readonly stage: string
@@ -8743,7 +8810,7 @@ export const encodeText = <Err, Done>(): Channel<
8743
8810
  * // Pipe the source into the transform
8744
8811
  * const pipedChannel = Channel.pipeTo(sourceChannel, transformChannel)
8745
8812
  *
8746
- * // Outputs: 2, 4, 6
8813
+ * Effect.runSync(Channel.runCollect(pipedChannel)) // => [2, 4, 6]
8747
8814
  * ```
8748
8815
  *
8749
8816
  * @category sequencing
@@ -8758,8 +8825,8 @@ export const pipeTo: {
8758
8825
  *
8759
8826
  * **Example** (Piping one channel into another)
8760
8827
  *
8761
- * ```ts
8762
- * import { Channel, Data } from "effect"
8828
+ * ```ts import.meta.vitest
8829
+ * import { Channel, Data, Effect } from "effect"
8763
8830
  *
8764
8831
  * class PipeError extends Data.TaggedError("PipeError")<{
8765
8832
  * readonly stage: string
@@ -8772,7 +8839,7 @@ export const pipeTo: {
8772
8839
  * // Pipe the source into the transform
8773
8840
  * const pipedChannel = Channel.pipeTo(sourceChannel, transformChannel)
8774
8841
  *
8775
- * // Outputs: 2, 4, 6
8842
+ * Effect.runSync(Channel.runCollect(pipedChannel)) // => [2, 4, 6]
8776
8843
  * ```
8777
8844
  *
8778
8845
  * @category sequencing
@@ -8789,8 +8856,8 @@ export const pipeTo: {
8789
8856
  *
8790
8857
  * **Example** (Piping one channel into another)
8791
8858
  *
8792
- * ```ts
8793
- * import { Channel, Data } from "effect"
8859
+ * ```ts import.meta.vitest
8860
+ * import { Channel, Data, Effect } from "effect"
8794
8861
  *
8795
8862
  * class PipeError extends Data.TaggedError("PipeError")<{
8796
8863
  * readonly stage: string
@@ -8803,7 +8870,7 @@ export const pipeTo: {
8803
8870
  * // Pipe the source into the transform
8804
8871
  * const pipedChannel = Channel.pipeTo(sourceChannel, transformChannel)
8805
8872
  *
8806
- * // Outputs: 2, 4, 6
8873
+ * Effect.runSync(Channel.runCollect(pipedChannel)) // => [2, 4, 6]
8807
8874
  * ```
8808
8875
  *
8809
8876
  * @category sequencing
@@ -8831,21 +8898,22 @@ export const pipeTo: {
8831
8898
  *
8832
8899
  * **Example** (Piping while preserving failures)
8833
8900
  *
8834
- * ```ts
8835
- * import { Channel, Data } from "effect"
8901
+ * ```ts import.meta.vitest
8902
+ * import { Channel, Data, Effect, Exit } from "effect"
8836
8903
  *
8837
8904
  * class SourceError extends Data.TaggedError("SourceError")<{
8838
8905
  * readonly code: number
8839
8906
  * }> {}
8840
8907
  *
8841
8908
  * // Create a failing source channel
8842
- * const failingSource = Channel.fail(new SourceError({ code: 404 }))
8843
- * const safeTransform = Channel.succeed("transformed")
8909
+ * const error = new SourceError({ code: 404 })
8910
+ * const failingSource = Channel.fail(error)
8911
+ * const safeTransform = Channel.identity<never, never, never>()
8844
8912
  *
8845
8913
  * // Pipe while preserving source failures
8846
8914
  * const safePipedChannel = Channel.pipeToOrFail(failingSource, safeTransform)
8847
8915
  *
8848
- * // Source errors are preserved and not sent to transform channel
8916
+ * Effect.runSync(Effect.exit(Channel.runCollect(safePipedChannel))) // => Exit.fail(error)
8849
8917
  * ```
8850
8918
  *
8851
8919
  * @category sequencing
@@ -8859,21 +8927,22 @@ export const pipeToOrFail: {
8859
8927
  *
8860
8928
  * **Example** (Piping while preserving failures)
8861
8929
  *
8862
- * ```ts
8863
- * import { Channel, Data } from "effect"
8930
+ * ```ts import.meta.vitest
8931
+ * import { Channel, Data, Effect, Exit } from "effect"
8864
8932
  *
8865
8933
  * class SourceError extends Data.TaggedError("SourceError")<{
8866
8934
  * readonly code: number
8867
8935
  * }> {}
8868
8936
  *
8869
8937
  * // Create a failing source channel
8870
- * const failingSource = Channel.fail(new SourceError({ code: 404 }))
8871
- * const safeTransform = Channel.succeed("transformed")
8938
+ * const error = new SourceError({ code: 404 })
8939
+ * const failingSource = Channel.fail(error)
8940
+ * const safeTransform = Channel.identity<never, never, never>()
8872
8941
  *
8873
8942
  * // Pipe while preserving source failures
8874
8943
  * const safePipedChannel = Channel.pipeToOrFail(failingSource, safeTransform)
8875
8944
  *
8876
- * // Source errors are preserved and not sent to transform channel
8945
+ * Effect.runSync(Effect.exit(Channel.runCollect(safePipedChannel))) // => Exit.fail(error)
8877
8946
  * ```
8878
8947
  *
8879
8948
  * @category sequencing
@@ -8889,21 +8958,22 @@ export const pipeToOrFail: {
8889
8958
  *
8890
8959
  * **Example** (Piping while preserving failures)
8891
8960
  *
8892
- * ```ts
8893
- * import { Channel, Data } from "effect"
8961
+ * ```ts import.meta.vitest
8962
+ * import { Channel, Data, Effect, Exit } from "effect"
8894
8963
  *
8895
8964
  * class SourceError extends Data.TaggedError("SourceError")<{
8896
8965
  * readonly code: number
8897
8966
  * }> {}
8898
8967
  *
8899
8968
  * // Create a failing source channel
8900
- * const failingSource = Channel.fail(new SourceError({ code: 404 }))
8901
- * const safeTransform = Channel.succeed("transformed")
8969
+ * const error = new SourceError({ code: 404 })
8970
+ * const failingSource = Channel.fail(error)
8971
+ * const safeTransform = Channel.identity<never, never, never>()
8902
8972
  *
8903
8973
  * // Pipe while preserving source failures
8904
8974
  * const safePipedChannel = Channel.pipeToOrFail(failingSource, safeTransform)
8905
8975
  *
8906
- * // Source errors are preserved and not sent to transform channel
8976
+ * Effect.runSync(Effect.exit(Channel.runCollect(safePipedChannel))) // => Exit.fail(error)
8907
8977
  * ```
8908
8978
  *
8909
8979
  * @category sequencing
@@ -8945,7 +9015,7 @@ export const pipeToOrFail: {
8945
9015
  *
8946
9016
  * **Example** (Unwrapping channel effects)
8947
9017
  *
8948
- * ```ts
9018
+ * ```ts import.meta.vitest
8949
9019
  * import { Channel, Data, Effect } from "effect"
8950
9020
  *
8951
9021
  * class UnwrapError extends Data.TaggedError("UnwrapError")<{
@@ -8960,7 +9030,7 @@ export const pipeToOrFail: {
8960
9030
  * // Unwrap the effect to get the channel
8961
9031
  * const unwrappedChannel = Channel.unwrap(channelEffect)
8962
9032
  *
8963
- * // The resulting channel outputs: 1, 2, 3
9033
+ * Effect.runSync(Channel.runCollect(unwrappedChannel)) // => [1, 2, 3]
8964
9034
  * ```
8965
9035
  *
8966
9036
  * @category constructors
@@ -9009,7 +9079,7 @@ export const scoped = <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
9009
9079
  *
9010
9080
  * **Example** (Embedding custom input handling)
9011
9081
  *
9012
- * ```ts
9082
+ * ```ts import.meta.vitest
9013
9083
  * import { Channel, Effect } from "effect"
9014
9084
  *
9015
9085
  * // Create a base channel
@@ -9020,13 +9090,11 @@ export const scoped = <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
9020
9090
  * baseChannel,
9021
9091
  * (upstream) =>
9022
9092
  * upstream.pipe(
9023
- * Effect.tap((message) =>
9024
- * Effect.sync(() => console.log(message))
9025
- * ),
9026
9093
  * Effect.forever,
9027
9094
  * Effect.ignore
9028
9095
  * )
9029
9096
  * )
9097
+ * await Effect.runPromise(Channel.runCollect(embeddedChannel)) // => [1, 2, 3]
9030
9098
  * ```
9031
9099
  *
9032
9100
  * @category sequencing
@@ -9044,7 +9112,7 @@ export const embedInput: {
9044
9112
  *
9045
9113
  * **Example** (Embedding custom input handling)
9046
9114
  *
9047
- * ```ts
9115
+ * ```ts import.meta.vitest
9048
9116
  * import { Channel, Effect } from "effect"
9049
9117
  *
9050
9118
  * // Create a base channel
@@ -9055,13 +9123,11 @@ export const embedInput: {
9055
9123
  * baseChannel,
9056
9124
  * (upstream) =>
9057
9125
  * upstream.pipe(
9058
- * Effect.tap((message) =>
9059
- * Effect.sync(() => console.log(message))
9060
- * ),
9061
9126
  * Effect.forever,
9062
9127
  * Effect.ignore
9063
9128
  * )
9064
9129
  * )
9130
+ * await Effect.runPromise(Channel.runCollect(embeddedChannel)) // => [1, 2, 3]
9065
9131
  * ```
9066
9132
  *
9067
9133
  * @category sequencing
@@ -9085,7 +9151,7 @@ export const embedInput: {
9085
9151
  *
9086
9152
  * **Example** (Embedding custom input handling)
9087
9153
  *
9088
- * ```ts
9154
+ * ```ts import.meta.vitest
9089
9155
  * import { Channel, Effect } from "effect"
9090
9156
  *
9091
9157
  * // Create a base channel
@@ -9096,13 +9162,11 @@ export const embedInput: {
9096
9162
  * baseChannel,
9097
9163
  * (upstream) =>
9098
9164
  * upstream.pipe(
9099
- * Effect.tap((message) =>
9100
- * Effect.sync(() => console.log(message))
9101
- * ),
9102
9165
  * Effect.forever,
9103
9166
  * Effect.ignore
9104
9167
  * )
9105
9168
  * )
9169
+ * await Effect.runPromise(Channel.runCollect(embeddedChannel)) // => [1, 2, 3]
9106
9170
  * ```
9107
9171
  *
9108
9172
  * @category sequencing
@@ -9152,7 +9216,7 @@ export const embedInput: {
9152
9216
  *
9153
9217
  * @see {@link bufferArray} for buffering elements from array outputs
9154
9218
  *
9155
- * @category Buffering
9219
+ * @category buffering
9156
9220
  * @since 2.0.0
9157
9221
  */
9158
9222
  export const buffer: {
@@ -9178,7 +9242,7 @@ export const buffer: {
9178
9242
  *
9179
9243
  * @see {@link bufferArray} for buffering elements from array outputs
9180
9244
  *
9181
- * @category Buffering
9245
+ * @category buffering
9182
9246
  * @since 2.0.0
9183
9247
  */
9184
9248
  (
@@ -9211,7 +9275,7 @@ export const buffer: {
9211
9275
  *
9212
9276
  * @see {@link bufferArray} for buffering elements from array outputs
9213
9277
  *
9214
- * @category Buffering
9278
+ * @category buffering
9215
9279
  * @since 2.0.0
9216
9280
  */
9217
9281
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
@@ -9252,7 +9316,7 @@ export const buffer: {
9252
9316
  *
9253
9317
  * @see {@link bufferArray} for buffering elements from array outputs
9254
9318
  *
9255
- * @category Buffering
9319
+ * @category buffering
9256
9320
  * @since 2.0.0
9257
9321
  */
9258
9322
  OutElem, /**
@@ -9277,7 +9341,7 @@ export const buffer: {
9277
9341
  *
9278
9342
  * @see {@link bufferArray} for buffering elements from array outputs
9279
9343
  *
9280
- * @category Buffering
9344
+ * @category buffering
9281
9345
  * @since 2.0.0
9282
9346
  */
9283
9347
  OutErr | Cause.Done<OutDone>>({
@@ -9318,7 +9382,7 @@ export const buffer: {
9318
9382
  *
9319
9383
  * @see {@link buffer} for buffering output elements without flattening arrays
9320
9384
  *
9321
- * @category Buffering
9385
+ * @category buffering
9322
9386
  * @since 4.0.0
9323
9387
  */
9324
9388
  export const bufferArray: {
@@ -9346,7 +9410,7 @@ export const bufferArray: {
9346
9410
  *
9347
9411
  * @see {@link buffer} for buffering output elements without flattening arrays
9348
9412
  *
9349
- * @category Buffering
9413
+ * @category buffering
9350
9414
  * @since 4.0.0
9351
9415
  */
9352
9416
  (
@@ -9381,7 +9445,7 @@ export const bufferArray: {
9381
9445
  *
9382
9446
  * @see {@link buffer} for buffering output elements without flattening arrays
9383
9447
  *
9384
- * @category Buffering
9448
+ * @category buffering
9385
9449
  * @since 4.0.0
9386
9450
  */
9387
9451
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
@@ -9424,7 +9488,7 @@ export const bufferArray: {
9424
9488
  *
9425
9489
  * @see {@link buffer} for buffering output elements without flattening arrays
9426
9490
  *
9427
- * @category Buffering
9491
+ * @category buffering
9428
9492
  * @since 4.0.0
9429
9493
  */
9430
9494
  OutElem, /**
@@ -9451,7 +9515,7 @@ export const bufferArray: {
9451
9515
  *
9452
9516
  * @see {@link buffer} for buffering output elements without flattening arrays
9453
9517
  *
9454
- * @category Buffering
9518
+ * @category buffering
9455
9519
  * @since 4.0.0
9456
9520
  */
9457
9521
  OutErr | Cause.Done<OutDone>>({
@@ -9657,8 +9721,8 @@ export const onError: {
9657
9721
  *
9658
9722
  * **Example** (Running exit finalizers)
9659
9723
  *
9660
- * ```ts
9661
- * import { Channel, Console, Data, Exit } from "effect"
9724
+ * ```ts import.meta.vitest
9725
+ * import { Channel, Data, Effect, Exit } from "effect"
9662
9726
  *
9663
9727
  * class ExitError extends Data.TaggedError("ExitError")<{
9664
9728
  * readonly stage: string
@@ -9668,13 +9732,12 @@ export const onError: {
9668
9732
  * const dataChannel = Channel.fromIterable([1, 2, 3])
9669
9733
  *
9670
9734
  * // Attach exit handler
9735
+ * const exits: Array<Exit.Exit<void, ExitError>> = []
9671
9736
  * const channelWithExit = Channel.onExit(dataChannel, (exit) => {
9672
- * if (Exit.isSuccess(exit)) {
9673
- * return Console.log(`Channel completed successfully with: ${exit.value}`)
9674
- * } else {
9675
- * return Console.log(`Channel failed with: ${exit.cause}`)
9676
- * }
9737
+ * exits.push(exit)
9738
+ * return Effect.void
9677
9739
  * })
9740
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithExit)), exits] // => [[1, 2, 3], [Exit.void]]
9678
9741
  * ```
9679
9742
  *
9680
9743
  * @category resource management
@@ -9687,8 +9750,8 @@ export const onExit: {
9687
9750
  *
9688
9751
  * **Example** (Running exit finalizers)
9689
9752
  *
9690
- * ```ts
9691
- * import { Channel, Console, Data, Exit } from "effect"
9753
+ * ```ts import.meta.vitest
9754
+ * import { Channel, Data, Effect, Exit } from "effect"
9692
9755
  *
9693
9756
  * class ExitError extends Data.TaggedError("ExitError")<{
9694
9757
  * readonly stage: string
@@ -9698,13 +9761,12 @@ export const onExit: {
9698
9761
  * const dataChannel = Channel.fromIterable([1, 2, 3])
9699
9762
  *
9700
9763
  * // Attach exit handler
9764
+ * const exits: Array<Exit.Exit<void, ExitError>> = []
9701
9765
  * const channelWithExit = Channel.onExit(dataChannel, (exit) => {
9702
- * if (Exit.isSuccess(exit)) {
9703
- * return Console.log(`Channel completed successfully with: ${exit.value}`)
9704
- * } else {
9705
- * return Console.log(`Channel failed with: ${exit.cause}`)
9706
- * }
9766
+ * exits.push(exit)
9767
+ * return Effect.void
9707
9768
  * })
9769
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithExit)), exits] // => [[1, 2, 3], [Exit.void]]
9708
9770
  * ```
9709
9771
  *
9710
9772
  * @category resource management
@@ -9721,8 +9783,8 @@ export const onExit: {
9721
9783
  *
9722
9784
  * **Example** (Running exit finalizers)
9723
9785
  *
9724
- * ```ts
9725
- * import { Channel, Console, Data, Exit } from "effect"
9786
+ * ```ts import.meta.vitest
9787
+ * import { Channel, Data, Effect, Exit } from "effect"
9726
9788
  *
9727
9789
  * class ExitError extends Data.TaggedError("ExitError")<{
9728
9790
  * readonly stage: string
@@ -9732,13 +9794,12 @@ export const onExit: {
9732
9794
  * const dataChannel = Channel.fromIterable([1, 2, 3])
9733
9795
  *
9734
9796
  * // Attach exit handler
9797
+ * const exits: Array<Exit.Exit<void, ExitError>> = []
9735
9798
  * const channelWithExit = Channel.onExit(dataChannel, (exit) => {
9736
- * if (Exit.isSuccess(exit)) {
9737
- * return Console.log(`Channel completed successfully with: ${exit.value}`)
9738
- * } else {
9739
- * return Console.log(`Channel failed with: ${exit.cause}`)
9740
- * }
9799
+ * exits.push(exit)
9800
+ * return Effect.void
9741
9801
  * })
9802
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithExit)), exits] // => [[1, 2, 3], [Exit.void]]
9742
9803
  * ```
9743
9804
  *
9744
9805
  * @category resource management
@@ -9937,8 +9998,8 @@ export const onEnd: {
9937
9998
  *
9938
9999
  * **Example** (Ensuring cleanup runs)
9939
10000
  *
9940
- * ```ts
9941
- * import { Channel, Console, Data } from "effect"
10001
+ * ```ts import.meta.vitest
10002
+ * import { Channel, Data, Effect } from "effect"
9942
10003
  *
9943
10004
  * class EnsureError extends Data.TaggedError("EnsureError")<{
9944
10005
  * readonly operation: string
@@ -9948,10 +10009,12 @@ export const onEnd: {
9948
10009
  * const dataChannel = Channel.fromIterable([1, 2, 3])
9949
10010
  *
9950
10011
  * // Ensure cleanup always runs
10012
+ * const events: Array<string> = []
9951
10013
  * const channelWithCleanup = Channel.ensuring(
9952
10014
  * dataChannel,
9953
- * Console.log("Cleanup executed regardless of success or failure")
10015
+ * Effect.sync(() => events.push("cleanup"))
9954
10016
  * )
10017
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithCleanup)), events] // => [[1, 2, 3], ["cleanup"]]
9955
10018
  * ```
9956
10019
  *
9957
10020
  * @category resource management
@@ -9964,8 +10027,8 @@ export const ensuring: {
9964
10027
  *
9965
10028
  * **Example** (Ensuring cleanup runs)
9966
10029
  *
9967
- * ```ts
9968
- * import { Channel, Console, Data } from "effect"
10030
+ * ```ts import.meta.vitest
10031
+ * import { Channel, Data, Effect } from "effect"
9969
10032
  *
9970
10033
  * class EnsureError extends Data.TaggedError("EnsureError")<{
9971
10034
  * readonly operation: string
@@ -9975,10 +10038,12 @@ export const ensuring: {
9975
10038
  * const dataChannel = Channel.fromIterable([1, 2, 3])
9976
10039
  *
9977
10040
  * // Ensure cleanup always runs
10041
+ * const events: Array<string> = []
9978
10042
  * const channelWithCleanup = Channel.ensuring(
9979
10043
  * dataChannel,
9980
- * Console.log("Cleanup executed regardless of success or failure")
10044
+ * Effect.sync(() => events.push("cleanup"))
9981
10045
  * )
10046
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithCleanup)), events] // => [[1, 2, 3], ["cleanup"]]
9982
10047
  * ```
9983
10048
  *
9984
10049
  * @category resource management
@@ -9993,8 +10058,8 @@ export const ensuring: {
9993
10058
  *
9994
10059
  * **Example** (Ensuring cleanup runs)
9995
10060
  *
9996
- * ```ts
9997
- * import { Channel, Console, Data } from "effect"
10061
+ * ```ts import.meta.vitest
10062
+ * import { Channel, Data, Effect } from "effect"
9998
10063
  *
9999
10064
  * class EnsureError extends Data.TaggedError("EnsureError")<{
10000
10065
  * readonly operation: string
@@ -10004,10 +10069,12 @@ export const ensuring: {
10004
10069
  * const dataChannel = Channel.fromIterable([1, 2, 3])
10005
10070
  *
10006
10071
  * // Ensure cleanup always runs
10072
+ * const events: Array<string> = []
10007
10073
  * const channelWithCleanup = Channel.ensuring(
10008
10074
  * dataChannel,
10009
- * Console.log("Cleanup executed regardless of success or failure")
10075
+ * Effect.sync(() => events.push("cleanup"))
10010
10076
  * )
10077
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithCleanup)), events] // => [[1, 2, 3], ["cleanup"]]
10011
10078
  * ```
10012
10079
  *
10013
10080
  * @category resource management
@@ -10048,7 +10115,7 @@ const runWith = <
10048
10115
  /**
10049
10116
  * Creates a channel from the specified services.
10050
10117
  *
10051
- * @category services
10118
+ * @category accessors
10052
10119
  * @since 2.0.0
10053
10120
  */
10054
10121
  export const contextWith = <Env, OutElem, OutErr, OutDone, InElem, InErr, InDone, Env2>(
@@ -10062,7 +10129,7 @@ export const contextWith = <Env, OutElem, OutErr, OutDone, InElem, InErr, InDone
10062
10129
  * Provides a `Context` to the channel, removing the corresponding service
10063
10130
  * requirements from the returned channel.
10064
10131
  *
10065
- * @category services
10132
+ * @category providing services
10066
10133
  * @since 2.0.0
10067
10134
  */
10068
10135
  export const provideContext: {
@@ -10070,7 +10137,7 @@ export const provideContext: {
10070
10137
  * Provides a `Context` to the channel, removing the corresponding service
10071
10138
  * requirements from the returned channel.
10072
10139
  *
10073
- * @category services
10140
+ * @category providing services
10074
10141
  * @since 2.0.0
10075
10142
  */
10076
10143
  <R2>(context: Context.Context<R2>): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
@@ -10080,7 +10147,7 @@ export const provideContext: {
10080
10147
  * Provides a `Context` to the channel, removing the corresponding service
10081
10148
  * requirements from the returned channel.
10082
10149
  *
10083
- * @category services
10150
+ * @category providing services
10084
10151
  * @since 2.0.0
10085
10152
  */
10086
10153
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, R2>(
@@ -10102,7 +10169,7 @@ export const provideContext: {
10102
10169
  * Provides a concrete service for a context key, removing that service
10103
10170
  * requirement from the returned channel.
10104
10171
  *
10105
- * @category services
10172
+ * @category providing services
10106
10173
  * @since 2.0.0
10107
10174
  */
10108
10175
  export const provideService: {
@@ -10110,7 +10177,7 @@ export const provideService: {
10110
10177
  * Provides a concrete service for a context key, removing that service
10111
10178
  * requirement from the returned channel.
10112
10179
  *
10113
- * @category services
10180
+ * @category providing services
10114
10181
  * @since 2.0.0
10115
10182
  */
10116
10183
  <I, S>(key: Context.Key<I, S>, service: NoInfer<S>): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
@@ -10120,7 +10187,7 @@ export const provideService: {
10120
10187
  * Provides a concrete service for a context key, removing that service
10121
10188
  * requirement from the returned channel.
10122
10189
  *
10123
- * @category services
10190
+ * @category providing services
10124
10191
  * @since 2.0.0
10125
10192
  */
10126
10193
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S>(
@@ -10153,7 +10220,7 @@ export const provideService: {
10153
10220
  * If the service effect fails, the returned channel fails. The provided service
10154
10221
  * removes the corresponding service requirement from the returned channel.
10155
10222
  *
10156
- * @category services
10223
+ * @category providing services
10157
10224
  * @since 4.0.0
10158
10225
  */
10159
10226
  export const provideServiceEffect: {
@@ -10170,7 +10237,7 @@ export const provideServiceEffect: {
10170
10237
  * If the service effect fails, the returned channel fails. The provided service
10171
10238
  * removes the corresponding service requirement from the returned channel.
10172
10239
  *
10173
- * @category services
10240
+ * @category providing services
10174
10241
  * @since 4.0.0
10175
10242
  */
10176
10243
  <I, S, ES, RS>(key: Context.Key<I, S>, service: Effect.Effect<NoInfer<S>, ES, RS>): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
@@ -10189,7 +10256,7 @@ export const provideServiceEffect: {
10189
10256
  * If the service effect fails, the returned channel fails. The provided service
10190
10257
  * removes the corresponding service requirement from the returned channel.
10191
10258
  *
10192
- * @category services
10259
+ * @category providing services
10193
10260
  * @since 4.0.0
10194
10261
  */
10195
10262
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S, ES, RS>(
@@ -10219,7 +10286,7 @@ export const provideServiceEffect: {
10219
10286
  * builds the layer in the channel scope. Use `options.local` to build a fresh
10220
10287
  * layer instance for this provision.
10221
10288
  *
10222
- * @category services
10289
+ * @category providing services
10223
10290
  * @since 4.0.0
10224
10291
  */
10225
10292
  export const provide: {
@@ -10233,7 +10300,7 @@ export const provide: {
10233
10300
  * builds the layer in the channel scope. Use `options.local` to build a fresh
10234
10301
  * layer instance for this provision.
10235
10302
  *
10236
- * @category services
10303
+ * @category providing services
10237
10304
  * @since 4.0.0
10238
10305
  */
10239
10306
  <A, E = never, R = never>(
@@ -10254,7 +10321,7 @@ export const provide: {
10254
10321
  * builds the layer in the channel scope. Use `options.local` to build a fresh
10255
10322
  * layer instance for this provision.
10256
10323
  *
10257
- * @category services
10324
+ * @category providing services
10258
10325
  * @since 4.0.0
10259
10326
  */
10260
10327
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, A, E = never, R = never>(
@@ -10293,7 +10360,7 @@ export const provide: {
10293
10360
  * provide to the channel. The returned channel requires the services needed to
10294
10361
  * build that context.
10295
10362
  *
10296
- * @category services
10363
+ * @category providing services
10297
10364
  * @since 4.0.0
10298
10365
  */
10299
10366
  export const updateContext: {
@@ -10306,7 +10373,7 @@ export const updateContext: {
10306
10373
  * provide to the channel. The returned channel requires the services needed to
10307
10374
  * build that context.
10308
10375
  *
10309
- * @category services
10376
+ * @category providing services
10310
10377
  * @since 4.0.0
10311
10378
  */
10312
10379
  <Env, R2>(f: (context: Context.Context<R2>) => Context.Context<Env>): <OutElem, OutErr, OutDone, InElem, InErr, InDone>(
@@ -10321,7 +10388,7 @@ export const updateContext: {
10321
10388
  * provide to the channel. The returned channel requires the services needed to
10322
10389
  * build that context.
10323
10390
  *
10324
- * @category services
10391
+ * @category providing services
10325
10392
  * @since 4.0.0
10326
10393
  */
10327
10394
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, R2>(
@@ -10347,7 +10414,7 @@ export const updateContext: {
10347
10414
  * The existing service is read from the context. The updated service is
10348
10415
  * provided to the channel under the same key.
10349
10416
  *
10350
- * @category services
10417
+ * @category providing services
10351
10418
  * @since 2.0.0
10352
10419
  */
10353
10420
  export const updateService: {
@@ -10359,7 +10426,7 @@ export const updateService: {
10359
10426
  * The existing service is read from the context. The updated service is
10360
10427
  * provided to the channel under the same key.
10361
10428
  *
10362
- * @category services
10429
+ * @category providing services
10363
10430
  * @since 2.0.0
10364
10431
  */
10365
10432
  <I, S>(key: Context.Key<I, S>, f: (service: NoInfer<S>) => S): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
@@ -10373,7 +10440,7 @@ export const updateService: {
10373
10440
  * The existing service is read from the context. The updated service is
10374
10441
  * provided to the channel under the same key.
10375
10442
  *
10376
- * @category services
10443
+ * @category providing services
10377
10444
  * @since 2.0.0
10378
10445
  */
10379
10446
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, I, S>(
@@ -10465,7 +10532,7 @@ const withSpanImpl = <OutElem, OutErr, OutDone, InElem, InErr, InDone, R>(
10465
10532
  /**
10466
10533
  * The starting channel for Do notation, emitting an empty object.
10467
10534
  *
10468
- * @category do notation
10535
+ * @category constructors
10469
10536
  * @since 4.0.0
10470
10537
  */
10471
10538
  export const Do: Channel<{}> = succeed({})
@@ -10519,7 +10586,7 @@ export {
10519
10586
  /**
10520
10587
  * Adds a computed field to each object emitted by a channel.
10521
10588
  *
10522
- * @category do notation
10589
+ * @category mapping
10523
10590
  * @since 4.0.0
10524
10591
  */
10525
10592
  let_ as let
@@ -10535,7 +10602,7 @@ export {
10535
10602
  * channel's output becomes the value of the new field. `options.concurrency`
10536
10603
  * and `options.bufferSize` control how derived channels are flattened.
10537
10604
  *
10538
- * @category do notation
10605
+ * @category sequencing
10539
10606
  * @since 4.0.0
10540
10607
  */
10541
10608
  export const bind: {
@@ -10549,7 +10616,7 @@ export const bind: {
10549
10616
  * channel's output becomes the value of the new field. `options.concurrency`
10550
10617
  * and `options.bufferSize` control how derived channels are flattened.
10551
10618
  *
10552
- * @category do notation
10619
+ * @category sequencing
10553
10620
  * @since 4.0.0
10554
10621
  */
10555
10622
  <N extends string, OutElem extends object, B, OutErr2, OutDone2, InElem2, InErr2, InDone2, Env2>(
@@ -10580,7 +10647,7 @@ export const bind: {
10580
10647
  * channel's output becomes the value of the new field. `options.concurrency`
10581
10648
  * and `options.bufferSize` control how derived channels are flattened.
10582
10649
  *
10583
- * @category do notation
10650
+ * @category sequencing
10584
10651
  * @since 4.0.0
10585
10652
  */
10586
10653
  <
@@ -10667,7 +10734,7 @@ export const bind: {
10667
10734
  * @see {@link bind} for adding a field produced by another channel
10668
10735
  * @see {@link let_ let} for adding a computed field
10669
10736
  *
10670
- * @category do notation
10737
+ * @category mapping
10671
10738
  * @since 4.0.0
10672
10739
  */
10673
10740
  export const bindTo: {
@@ -10683,7 +10750,7 @@ export const bindTo: {
10683
10750
  * @see {@link bind} for adding a field produced by another channel
10684
10751
  * @see {@link let_ let} for adding a computed field
10685
10752
  *
10686
- * @category do notation
10753
+ * @category mapping
10687
10754
  * @since 4.0.0
10688
10755
  */
10689
10756
  <N extends string>(name: N): <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>(
@@ -10709,7 +10776,7 @@ export const bindTo: {
10709
10776
  * @see {@link bind} for adding a field produced by another channel
10710
10777
  * @see {@link let_ let} for adding a computed field
10711
10778
  *
10712
- * @category do notation
10779
+ * @category mapping
10713
10780
  * @since 4.0.0
10714
10781
  */
10715
10782
  <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, N extends string>(
@@ -10742,8 +10809,8 @@ export const bindTo: {
10742
10809
  *
10743
10810
  * **Example** (Counting channel output)
10744
10811
  *
10745
- * ```ts
10746
- * import { Channel, Data } from "effect"
10812
+ * ```ts import.meta.vitest
10813
+ * import { Channel, Data, Effect } from "effect"
10747
10814
  *
10748
10815
  * class CountError extends Data.TaggedError("CountError")<{
10749
10816
  * readonly reason: string
@@ -10755,10 +10822,10 @@ export const bindTo: {
10755
10822
  * // Count the elements
10756
10823
  * const countEffect = Channel.runCount(numbersChannel)
10757
10824
  *
10758
- * // Effect.runSync(countEffect) // Returns: 5
10825
+ * Effect.runSync(countEffect) // => 5
10759
10826
  * ```
10760
10827
  *
10761
- * @category execution
10828
+ * @category running
10762
10829
  * @since 4.0.0
10763
10830
  */
10764
10831
  export const runCount = <OutElem, OutErr, OutDone, Env>(
@@ -10770,8 +10837,8 @@ export const runCount = <OutElem, OutErr, OutDone, Env>(
10770
10837
  *
10771
10838
  * **Example** (Draining channel output at runtime)
10772
10839
  *
10773
- * ```ts
10774
- * import { Channel, Data } from "effect"
10840
+ * ```ts import.meta.vitest
10841
+ * import { Channel, Data, Effect } from "effect"
10775
10842
  *
10776
10843
  * class DrainError extends Data.TaggedError("DrainError")<{
10777
10844
  * readonly stage: string
@@ -10779,18 +10846,15 @@ export const runCount = <OutElem, OutErr, OutDone, Env>(
10779
10846
  *
10780
10847
  * // Create a channel that outputs elements and completes with a result
10781
10848
  * const resultChannel = Channel.fromIterable([1, 2, 3])
10782
- * const completedChannel = Channel.concatWith(
10783
- * resultChannel,
10784
- * () => Channel.succeed("completed")
10785
- * )
10849
+ * const completedChannel = Channel.concat(resultChannel, Channel.end("completed"))
10786
10850
  *
10787
10851
  * // Drain all elements and get only the final result
10788
10852
  * const drainEffect = Channel.runDrain(completedChannel)
10789
10853
  *
10790
- * // Effect.runSync(drainEffect) // Returns: "completed"
10854
+ * Effect.runSync(drainEffect) // => "completed"
10791
10855
  * ```
10792
10856
  *
10793
- * @category execution
10857
+ * @category running
10794
10858
  * @since 2.0.0
10795
10859
  */
10796
10860
  export const runDrain = <OutElem, OutErr, OutDone, Env>(
@@ -10802,8 +10866,8 @@ export const runDrain = <OutElem, OutErr, OutDone, Env>(
10802
10866
  *
10803
10867
  * **Example** (Running effects for each output)
10804
10868
  *
10805
- * ```ts
10806
- * import { Channel, Console, Data } from "effect"
10869
+ * ```ts import.meta.vitest
10870
+ * import { Channel, Data, Effect } from "effect"
10807
10871
  *
10808
10872
  * class ForEachError extends Data.TaggedError("ForEachError")<{
10809
10873
  * readonly element: unknown
@@ -10812,16 +10876,18 @@ export const runDrain = <OutElem, OutErr, OutDone, Env>(
10812
10876
  * // Create a channel with numbers
10813
10877
  * const numbersChannel = Channel.fromIterable([1, 2, 3])
10814
10878
  *
10815
- * // Run forEach to log each element
10879
+ * // Run forEach to process each element
10880
+ * const processed: Array<number> = []
10816
10881
  * const forEachEffect = Channel.runForEach(
10817
10882
  * numbersChannel,
10818
- * (n) => Console.log(`Processing: ${n}`)
10883
+ * (n) => Effect.sync(() => processed.push(n))
10819
10884
  * )
10820
10885
  *
10821
- * // Logs: "Processing: 1", "Processing: 2", "Processing: 3"
10886
+ * await Effect.runPromise(forEachEffect)
10887
+ * processed // => [1, 2, 3]
10822
10888
  * ```
10823
10889
  *
10824
- * @category execution
10890
+ * @category running
10825
10891
  * @since 4.0.0
10826
10892
  */
10827
10893
  export const runForEach: {
@@ -10830,8 +10896,8 @@ export const runForEach: {
10830
10896
  *
10831
10897
  * **Example** (Running effects for each output)
10832
10898
  *
10833
- * ```ts
10834
- * import { Channel, Console, Data } from "effect"
10899
+ * ```ts import.meta.vitest
10900
+ * import { Channel, Data, Effect } from "effect"
10835
10901
  *
10836
10902
  * class ForEachError extends Data.TaggedError("ForEachError")<{
10837
10903
  * readonly element: unknown
@@ -10840,16 +10906,18 @@ export const runForEach: {
10840
10906
  * // Create a channel with numbers
10841
10907
  * const numbersChannel = Channel.fromIterable([1, 2, 3])
10842
10908
  *
10843
- * // Run forEach to log each element
10909
+ * // Run forEach to process each element
10910
+ * const processed: Array<number> = []
10844
10911
  * const forEachEffect = Channel.runForEach(
10845
10912
  * numbersChannel,
10846
- * (n) => Console.log(`Processing: ${n}`)
10913
+ * (n) => Effect.sync(() => processed.push(n))
10847
10914
  * )
10848
10915
  *
10849
- * // Logs: "Processing: 1", "Processing: 2", "Processing: 3"
10916
+ * await Effect.runPromise(forEachEffect)
10917
+ * processed // => [1, 2, 3]
10850
10918
  * ```
10851
10919
  *
10852
- * @category execution
10920
+ * @category running
10853
10921
  * @since 4.0.0
10854
10922
  */
10855
10923
  <OutElem, EX, RX>(f: (o: OutElem) => Effect.Effect<void, EX, RX>): <OutErr, OutDone, Env>(
@@ -10860,8 +10928,8 @@ export const runForEach: {
10860
10928
  *
10861
10929
  * **Example** (Running effects for each output)
10862
10930
  *
10863
- * ```ts
10864
- * import { Channel, Console, Data } from "effect"
10931
+ * ```ts import.meta.vitest
10932
+ * import { Channel, Data, Effect } from "effect"
10865
10933
  *
10866
10934
  * class ForEachError extends Data.TaggedError("ForEachError")<{
10867
10935
  * readonly element: unknown
@@ -10870,16 +10938,18 @@ export const runForEach: {
10870
10938
  * // Create a channel with numbers
10871
10939
  * const numbersChannel = Channel.fromIterable([1, 2, 3])
10872
10940
  *
10873
- * // Run forEach to log each element
10941
+ * // Run forEach to process each element
10942
+ * const processed: Array<number> = []
10874
10943
  * const forEachEffect = Channel.runForEach(
10875
10944
  * numbersChannel,
10876
- * (n) => Console.log(`Processing: ${n}`)
10945
+ * (n) => Effect.sync(() => processed.push(n))
10877
10946
  * )
10878
10947
  *
10879
- * // Logs: "Processing: 1", "Processing: 2", "Processing: 3"
10948
+ * await Effect.runPromise(forEachEffect)
10949
+ * processed // => [1, 2, 3]
10880
10950
  * ```
10881
10951
  *
10882
- * @category execution
10952
+ * @category running
10883
10953
  * @since 4.0.0
10884
10954
  */
10885
10955
  <OutElem, OutErr, OutDone, Env, EX, RX>(
@@ -10904,7 +10974,7 @@ export const runForEach: {
10904
10974
  * Returning `true` continues consuming the channel. Returning `false` stops
10905
10975
  * consumption early. The returned effect completes with `void`.
10906
10976
  *
10907
- * @category execution
10977
+ * @category running
10908
10978
  * @since 4.0.0
10909
10979
  */
10910
10980
  export const runForEachWhile: {
@@ -10917,7 +10987,7 @@ export const runForEachWhile: {
10917
10987
  * Returning `true` continues consuming the channel. Returning `false` stops
10918
10988
  * consumption early. The returned effect completes with `void`.
10919
10989
  *
10920
- * @category execution
10990
+ * @category running
10921
10991
  * @since 4.0.0
10922
10992
  */
10923
10993
  <OutElem, EX, RX>(f: (o: OutElem) => Effect.Effect<boolean, EX, RX>): <OutErr, OutDone, Env>(
@@ -10932,7 +11002,7 @@ export const runForEachWhile: {
10932
11002
  * Returning `true` continues consuming the channel. Returning `false` stops
10933
11003
  * consumption early. The returned effect completes with `void`.
10934
11004
  *
10935
- * @category execution
11005
+ * @category running
10936
11006
  * @since 4.0.0
10937
11007
  */
10938
11008
  <OutElem, OutErr, OutDone, Env, EX, RX>(
@@ -10958,8 +11028,8 @@ export const runForEachWhile: {
10958
11028
  *
10959
11029
  * **Example** (Collecting channel output)
10960
11030
  *
10961
- * ```ts
10962
- * import { Channel, Data } from "effect"
11031
+ * ```ts import.meta.vitest
11032
+ * import { Channel, Data, Effect } from "effect"
10963
11033
  *
10964
11034
  * class CollectError extends Data.TaggedError("CollectError")<{
10965
11035
  * readonly reason: string
@@ -10971,10 +11041,10 @@ export const runForEachWhile: {
10971
11041
  * // Collect all elements into an array
10972
11042
  * const collectEffect = Channel.runCollect(numbersChannel)
10973
11043
  *
10974
- * // Effect.runSync(collectEffect) // Returns: [1, 2, 3, 4, 5]
11044
+ * Effect.runSync(collectEffect) // => [1, 2, 3, 4, 5]
10975
11045
  * ```
10976
11046
  *
10977
- * @category execution
11047
+ * @category running
10978
11048
  * @since 2.0.0
10979
11049
  */
10980
11050
  export const runCollect = <OutElem, OutErr, OutDone, Env>(
@@ -10988,7 +11058,7 @@ export const runCollect = <OutElem, OutErr, OutDone, Env>(
10988
11058
  /**
10989
11059
  * Runs a channel and outputs the done value.
10990
11060
  *
10991
- * @category execution
11061
+ * @category running
10992
11062
  * @since 4.0.0
10993
11063
  */
10994
11064
  export const runDone = <OutElem, OutErr, OutDone, Env>(
@@ -11004,7 +11074,7 @@ export const runDone = <OutElem, OutErr, OutDone, Env>(
11004
11074
  * Returns `Option.some` with the first output element, or `Option.none` if the
11005
11075
  * channel completes without emitting output.
11006
11076
  *
11007
- * @category execution
11077
+ * @category running
11008
11078
  * @since 4.0.0
11009
11079
  */
11010
11080
  export const runHead = <OutElem, OutErr, OutDone, Env>(
@@ -11031,7 +11101,7 @@ export const runHead = <OutElem, OutErr, OutDone, Env>(
11031
11101
  * Returns `Option.some` with the last emitted element, or `Option.none` if the
11032
11102
  * channel completes without emitting output.
11033
11103
  *
11034
- * @category execution
11104
+ * @category running
11035
11105
  * @since 4.0.0
11036
11106
  */
11037
11107
  export const runLast = <OutElem, OutErr, OutDone, Env>(
@@ -11059,8 +11129,8 @@ export const runLast = <OutElem, OutErr, OutDone, Env>(
11059
11129
  *
11060
11130
  * **Example** (Folding channel output)
11061
11131
  *
11062
- * ```ts
11063
- * import { Channel, Data } from "effect"
11132
+ * ```ts import.meta.vitest
11133
+ * import { Channel, Data, Effect } from "effect"
11064
11134
  *
11065
11135
  * class FoldError extends Data.TaggedError("FoldError")<{
11066
11136
  * readonly operation: string
@@ -11072,10 +11142,10 @@ export const runLast = <OutElem, OutErr, OutDone, Env>(
11072
11142
  * // Fold to calculate sum
11073
11143
  * const sumEffect = Channel.runFold(numbersChannel, () => 0, (acc, n) => acc + n)
11074
11144
  *
11075
- * // Effect.runSync(sumEffect) // Returns: 15
11145
+ * Effect.runSync(sumEffect) // => 15
11076
11146
  * ```
11077
11147
  *
11078
- * @category execution
11148
+ * @category running
11079
11149
  * @since 4.0.0
11080
11150
  */
11081
11151
  export const runFold: {
@@ -11084,8 +11154,8 @@ export const runFold: {
11084
11154
  *
11085
11155
  * **Example** (Folding channel output)
11086
11156
  *
11087
- * ```ts
11088
- * import { Channel, Data } from "effect"
11157
+ * ```ts import.meta.vitest
11158
+ * import { Channel, Data, Effect } from "effect"
11089
11159
  *
11090
11160
  * class FoldError extends Data.TaggedError("FoldError")<{
11091
11161
  * readonly operation: string
@@ -11097,10 +11167,10 @@ export const runFold: {
11097
11167
  * // Fold to calculate sum
11098
11168
  * const sumEffect = Channel.runFold(numbersChannel, () => 0, (acc, n) => acc + n)
11099
11169
  *
11100
- * // Effect.runSync(sumEffect) // Returns: 15
11170
+ * Effect.runSync(sumEffect) // => 15
11101
11171
  * ```
11102
11172
  *
11103
- * @category execution
11173
+ * @category running
11104
11174
  * @since 4.0.0
11105
11175
  */
11106
11176
  <Z, OutElem>(initial: LazyArg<Z>, f: (acc: Z, o: OutElem) => Z): <OutErr, OutDone, Env>(
@@ -11111,8 +11181,8 @@ export const runFold: {
11111
11181
  *
11112
11182
  * **Example** (Folding channel output)
11113
11183
  *
11114
- * ```ts
11115
- * import { Channel, Data } from "effect"
11184
+ * ```ts import.meta.vitest
11185
+ * import { Channel, Data, Effect } from "effect"
11116
11186
  *
11117
11187
  * class FoldError extends Data.TaggedError("FoldError")<{
11118
11188
  * readonly operation: string
@@ -11124,10 +11194,10 @@ export const runFold: {
11124
11194
  * // Fold to calculate sum
11125
11195
  * const sumEffect = Channel.runFold(numbersChannel, () => 0, (acc, n) => acc + n)
11126
11196
  *
11127
- * // Effect.runSync(sumEffect) // Returns: 15
11197
+ * Effect.runSync(sumEffect) // => 15
11128
11198
  * ```
11129
11199
  *
11130
- * @category execution
11200
+ * @category running
11131
11201
  * @since 4.0.0
11132
11202
  */
11133
11203
  <OutElem, OutErr, OutDone, Env, Z>(
@@ -11170,7 +11240,7 @@ export const runFold: {
11170
11240
  * the effectful accumulator function. The returned effect succeeds with the
11171
11241
  * final accumulator value.
11172
11242
  *
11173
- * @category execution
11243
+ * @category running
11174
11244
  * @since 4.0.0
11175
11245
  */
11176
11246
  export const runFoldEffect: {
@@ -11188,7 +11258,7 @@ export const runFoldEffect: {
11188
11258
  * the effectful accumulator function. The returned effect succeeds with the
11189
11259
  * final accumulator value.
11190
11260
  *
11191
- * @category execution
11261
+ * @category running
11192
11262
  * @since 4.0.0
11193
11263
  */
11194
11264
  <OutElem, Z, E, R>(initial: LazyArg<Z>, f: (acc: Z, o: OutElem) => Effect.Effect<Z, E, R>): <OutErr, OutDone, Env>(
@@ -11208,7 +11278,7 @@ export const runFoldEffect: {
11208
11278
  * the effectful accumulator function. The returned effect succeeds with the
11209
11279
  * final accumulator value.
11210
11280
  *
11211
- * @category execution
11281
+ * @category running
11212
11282
  * @since 4.0.0
11213
11283
  */
11214
11284
  <OutElem, OutErr, OutDone, Env, Z, E, R>(
@@ -11251,7 +11321,7 @@ export const runFoldEffect: {
11251
11321
  *
11252
11322
  * **Example** (Converting channels to pulls)
11253
11323
  *
11254
- * ```ts
11324
+ * ```ts import.meta.vitest
11255
11325
  * import { Channel, Data, Effect } from "effect"
11256
11326
  *
11257
11327
  * class PullError extends Data.TaggedError("PullError")<{
@@ -11261,12 +11331,11 @@ export const runFoldEffect: {
11261
11331
  * // Create a channel
11262
11332
  * const numbersChannel = Channel.fromIterable([1, 2, 3])
11263
11333
  *
11264
- * // Convert to Pull within a scope
11265
- * const pullEffect = Effect.scoped(
11266
- * Channel.toPull(numbersChannel)
11267
- * )
11268
- *
11269
- * // Use the Pull to manually consume elements
11334
+ * const program = Effect.scoped(Effect.gen(function*() {
11335
+ * const pull = yield* Channel.toPull(numbersChannel)
11336
+ * return [yield* pull, yield* pull, yield* pull]
11337
+ * }))
11338
+ * await Effect.runPromise(program) // => [1, 2, 3]
11270
11339
  * ```
11271
11340
  *
11272
11341
  * @category destructors
@@ -11300,7 +11369,7 @@ export const toPull: <OutElem, OutErr, OutDone, Env>(
11300
11369
  *
11301
11370
  * **Example** (Converting channels to scoped pulls)
11302
11371
  *
11303
- * ```ts
11372
+ * ```ts import.meta.vitest
11304
11373
  * import { Channel, Data, Effect, Scope } from "effect"
11305
11374
  *
11306
11375
  * class ScopedPullError extends Data.TaggedError("ScopedPullError")<{
@@ -11312,10 +11381,11 @@ export const toPull: <OutElem, OutErr, OutDone, Env>(
11312
11381
  *
11313
11382
  * // Convert to Pull with explicit scope
11314
11383
  * const scopedPullEffect = Effect.gen(function*() {
11315
- * const scope = yield* Scope.make()
11384
+ * const scope = yield* Effect.scope
11316
11385
  * const pull = yield* Channel.toPullScoped(numbersChannel, scope)
11317
- * return pull
11386
+ * return [yield* pull, yield* pull, yield* pull]
11318
11387
  * })
11388
+ * await Effect.runPromise(Effect.scoped(scopedPullEffect)) // => [1, 2, 3]
11319
11389
  * ```
11320
11390
  *
11321
11391
  * @category destructors
@@ -11473,8 +11543,8 @@ export const runIntoQueueArray: {
11473
11543
  *
11474
11544
  * **Example** (Converting channels to queues)
11475
11545
  *
11476
- * ```ts
11477
- * import { Channel, Data } from "effect"
11546
+ * ```ts import.meta.vitest
11547
+ * import { Channel, Data, Effect, Queue } from "effect"
11478
11548
  *
11479
11549
  * class QueueError extends Data.TaggedError("QueueError")<{
11480
11550
  * readonly operation: string
@@ -11484,10 +11554,11 @@ export const runIntoQueueArray: {
11484
11554
  * const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
11485
11555
  *
11486
11556
  * // Convert to queue for concurrent processing
11487
- * const queueEffect = Channel.toQueue(dataChannel, { capacity: 32 })
11488
- *
11489
- * // The queue can be used for concurrent consumption
11490
- * // Multiple consumers can read from the queue
11557
+ * const program = Effect.scoped(Effect.gen(function*() {
11558
+ * const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
11559
+ * return yield* Queue.takeBetween(queue, 5, 5)
11560
+ * }))
11561
+ * await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
11491
11562
  * ```
11492
11563
  *
11493
11564
  * @category destructors
@@ -11506,8 +11577,8 @@ export const toQueue: {
11506
11577
  *
11507
11578
  * **Example** (Converting channels to queues)
11508
11579
  *
11509
- * ```ts
11510
- * import { Channel, Data } from "effect"
11580
+ * ```ts import.meta.vitest
11581
+ * import { Channel, Data, Effect, Queue } from "effect"
11511
11582
  *
11512
11583
  * class QueueError extends Data.TaggedError("QueueError")<{
11513
11584
  * readonly operation: string
@@ -11517,10 +11588,11 @@ export const toQueue: {
11517
11588
  * const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
11518
11589
  *
11519
11590
  * // Convert to queue for concurrent processing
11520
- * const queueEffect = Channel.toQueue(dataChannel, { capacity: 32 })
11521
- *
11522
- * // The queue can be used for concurrent consumption
11523
- * // Multiple consumers can read from the queue
11591
+ * const program = Effect.scoped(Effect.gen(function*() {
11592
+ * const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
11593
+ * return yield* Queue.takeBetween(queue, 5, 5)
11594
+ * }))
11595
+ * await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
11524
11596
  * ```
11525
11597
  *
11526
11598
  * @category destructors
@@ -11548,8 +11620,8 @@ export const toQueue: {
11548
11620
  *
11549
11621
  * **Example** (Converting channels to queues)
11550
11622
  *
11551
- * ```ts
11552
- * import { Channel, Data } from "effect"
11623
+ * ```ts import.meta.vitest
11624
+ * import { Channel, Data, Effect, Queue } from "effect"
11553
11625
  *
11554
11626
  * class QueueError extends Data.TaggedError("QueueError")<{
11555
11627
  * readonly operation: string
@@ -11559,10 +11631,11 @@ export const toQueue: {
11559
11631
  * const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
11560
11632
  *
11561
11633
  * // Convert to queue for concurrent processing
11562
- * const queueEffect = Channel.toQueue(dataChannel, { capacity: 32 })
11563
- *
11564
- * // The queue can be used for concurrent consumption
11565
- * // Multiple consumers can read from the queue
11634
+ * const program = Effect.scoped(Effect.gen(function*() {
11635
+ * const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
11636
+ * return yield* Queue.takeBetween(queue, 5, 5)
11637
+ * }))
11638
+ * await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
11566
11639
  * ```
11567
11640
  *
11568
11641
  * @category destructors
@@ -11601,8 +11674,8 @@ export const toQueue: {
11601
11674
  *
11602
11675
  * **Example** (Converting channels to queues)
11603
11676
  *
11604
- * ```ts
11605
- * import { Channel, Data } from "effect"
11677
+ * ```ts import.meta.vitest
11678
+ * import { Channel, Data, Effect, Queue } from "effect"
11606
11679
  *
11607
11680
  * class QueueError extends Data.TaggedError("QueueError")<{
11608
11681
  * readonly operation: string
@@ -11612,10 +11685,11 @@ export const toQueue: {
11612
11685
  * const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
11613
11686
  *
11614
11687
  * // Convert to queue for concurrent processing
11615
- * const queueEffect = Channel.toQueue(dataChannel, { capacity: 32 })
11616
- *
11617
- * // The queue can be used for concurrent consumption
11618
- * // Multiple consumers can read from the queue
11688
+ * const program = Effect.scoped(Effect.gen(function*() {
11689
+ * const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
11690
+ * return yield* Queue.takeBetween(queue, 5, 5)
11691
+ * }))
11692
+ * await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
11619
11693
  * ```
11620
11694
  *
11621
11695
  * @category destructors
@@ -11633,8 +11707,8 @@ export const toQueue: {
11633
11707
  *
11634
11708
  * **Example** (Converting channels to queues)
11635
11709
  *
11636
- * ```ts
11637
- * import { Channel, Data } from "effect"
11710
+ * ```ts import.meta.vitest
11711
+ * import { Channel, Data, Effect, Queue } from "effect"
11638
11712
  *
11639
11713
  * class QueueError extends Data.TaggedError("QueueError")<{
11640
11714
  * readonly operation: string
@@ -11644,10 +11718,11 @@ export const toQueue: {
11644
11718
  * const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
11645
11719
  *
11646
11720
  * // Convert to queue for concurrent processing
11647
- * const queueEffect = Channel.toQueue(dataChannel, { capacity: 32 })
11648
- *
11649
- * // The queue can be used for concurrent consumption
11650
- * // Multiple consumers can read from the queue
11721
+ * const program = Effect.scoped(Effect.gen(function*() {
11722
+ * const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
11723
+ * return yield* Queue.takeBetween(queue, 5, 5)
11724
+ * }))
11725
+ * await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
11651
11726
  * ```
11652
11727
  *
11653
11728
  * @category destructors