effect 4.0.0-beta.66 → 4.0.0-beta.68

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 (1767) hide show
  1. package/dist/Array.d.ts +151 -106
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +50 -40
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +620 -553
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +298 -254
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +342 -274
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +168 -126
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +189 -156
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +85 -68
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.d.ts +30 -5
  18. package/dist/Brand.d.ts.map +1 -1
  19. package/dist/Brand.js +19 -2
  20. package/dist/Brand.js.map +1 -1
  21. package/dist/Cache.d.ts +239 -135
  22. package/dist/Cache.d.ts.map +1 -1
  23. package/dist/Cache.js +135 -59
  24. package/dist/Cache.js.map +1 -1
  25. package/dist/Cause.d.ts +84 -73
  26. package/dist/Cause.d.ts.map +1 -1
  27. package/dist/Cause.js +51 -44
  28. package/dist/Cause.js.map +1 -1
  29. package/dist/Channel.d.ts +1568 -632
  30. package/dist/Channel.d.ts.map +1 -1
  31. package/dist/Channel.js +685 -315
  32. package/dist/Channel.js.map +1 -1
  33. package/dist/ChannelSchema.d.ts +119 -10
  34. package/dist/ChannelSchema.d.ts.map +1 -1
  35. package/dist/ChannelSchema.js +45 -6
  36. package/dist/ChannelSchema.js.map +1 -1
  37. package/dist/Chunk.d.ts +574 -428
  38. package/dist/Chunk.d.ts.map +1 -1
  39. package/dist/Chunk.js +250 -191
  40. package/dist/Chunk.js.map +1 -1
  41. package/dist/Clock.d.ts +16 -9
  42. package/dist/Clock.d.ts.map +1 -1
  43. package/dist/Clock.js +9 -5
  44. package/dist/Clock.js.map +1 -1
  45. package/dist/Combiner.d.ts +11 -5
  46. package/dist/Combiner.d.ts.map +1 -1
  47. package/dist/Combiner.js +10 -4
  48. package/dist/Combiner.js.map +1 -1
  49. package/dist/Config.d.ts +80 -68
  50. package/dist/Config.d.ts.map +1 -1
  51. package/dist/Config.js +53 -49
  52. package/dist/Config.js.map +1 -1
  53. package/dist/ConfigProvider.d.ts +33 -32
  54. package/dist/ConfigProvider.d.ts.map +1 -1
  55. package/dist/ConfigProvider.js +19 -18
  56. package/dist/ConfigProvider.js.map +1 -1
  57. package/dist/Console.d.ts +76 -50
  58. package/dist/Console.d.ts.map +1 -1
  59. package/dist/Console.js +69 -46
  60. package/dist/Console.js.map +1 -1
  61. package/dist/Context.d.ts +400 -189
  62. package/dist/Context.d.ts.map +1 -1
  63. package/dist/Context.js +143 -77
  64. package/dist/Context.js.map +1 -1
  65. package/dist/Cron.d.ts +67 -48
  66. package/dist/Cron.d.ts.map +1 -1
  67. package/dist/Cron.js +94 -36
  68. package/dist/Cron.js.map +1 -1
  69. package/dist/Crypto.d.ts +208 -0
  70. package/dist/Crypto.d.ts.map +1 -0
  71. package/dist/Crypto.js +157 -0
  72. package/dist/Crypto.js.map +1 -0
  73. package/dist/Data.d.ts +9 -3
  74. package/dist/Data.d.ts.map +1 -1
  75. package/dist/Data.js.map +1 -1
  76. package/dist/DateTime.d.ts +893 -464
  77. package/dist/DateTime.d.ts.map +1 -1
  78. package/dist/DateTime.js +387 -228
  79. package/dist/DateTime.js.map +1 -1
  80. package/dist/Deferred.d.ts +367 -175
  81. package/dist/Deferred.d.ts.map +1 -1
  82. package/dist/Deferred.js +146 -72
  83. package/dist/Deferred.js.map +1 -1
  84. package/dist/Differ.d.ts +44 -2
  85. package/dist/Differ.d.ts.map +1 -1
  86. package/dist/Differ.js +36 -0
  87. package/dist/Duration.d.ts +333 -186
  88. package/dist/Duration.d.ts.map +1 -1
  89. package/dist/Duration.js +178 -107
  90. package/dist/Duration.js.map +1 -1
  91. package/dist/Effect.d.ts +2181 -2275
  92. package/dist/Effect.d.ts.map +1 -1
  93. package/dist/Effect.js +935 -850
  94. package/dist/Effect.js.map +1 -1
  95. package/dist/Effectable.d.ts +38 -3
  96. package/dist/Effectable.d.ts.map +1 -1
  97. package/dist/Effectable.js +3 -3
  98. package/dist/Effectable.js.map +1 -1
  99. package/dist/Encoding.d.ts +78 -28
  100. package/dist/Encoding.d.ts.map +1 -1
  101. package/dist/Encoding.js +75 -27
  102. package/dist/Encoding.js.map +1 -1
  103. package/dist/Equal.d.ts +4 -3
  104. package/dist/Equal.d.ts.map +1 -1
  105. package/dist/Equal.js +4 -3
  106. package/dist/Equal.js.map +1 -1
  107. package/dist/Equivalence.d.ts +18 -24
  108. package/dist/Equivalence.d.ts.map +1 -1
  109. package/dist/Equivalence.js +16 -21
  110. package/dist/Equivalence.js.map +1 -1
  111. package/dist/ErrorReporter.d.ts +66 -82
  112. package/dist/ErrorReporter.d.ts.map +1 -1
  113. package/dist/ErrorReporter.js +38 -29
  114. package/dist/ErrorReporter.js.map +1 -1
  115. package/dist/ExecutionPlan.d.ts +106 -12
  116. package/dist/ExecutionPlan.d.ts.map +1 -1
  117. package/dist/ExecutionPlan.js +23 -6
  118. package/dist/ExecutionPlan.js.map +1 -1
  119. package/dist/Exit.d.ts +6 -5
  120. package/dist/Exit.d.ts.map +1 -1
  121. package/dist/Exit.js.map +1 -1
  122. package/dist/Fiber.d.ts +71 -40
  123. package/dist/Fiber.d.ts.map +1 -1
  124. package/dist/Fiber.js +39 -21
  125. package/dist/Fiber.js.map +1 -1
  126. package/dist/FiberHandle.d.ts +118 -57
  127. package/dist/FiberHandle.d.ts.map +1 -1
  128. package/dist/FiberHandle.js +121 -39
  129. package/dist/FiberHandle.js.map +1 -1
  130. package/dist/FiberMap.d.ts +287 -159
  131. package/dist/FiberMap.d.ts.map +1 -1
  132. package/dist/FiberMap.js +175 -73
  133. package/dist/FiberMap.js.map +1 -1
  134. package/dist/FiberSet.d.ts +93 -52
  135. package/dist/FiberSet.d.ts.map +1 -1
  136. package/dist/FiberSet.js +97 -34
  137. package/dist/FiberSet.js.map +1 -1
  138. package/dist/FileSystem.d.ts +102 -73
  139. package/dist/FileSystem.d.ts.map +1 -1
  140. package/dist/FileSystem.js +53 -39
  141. package/dist/FileSystem.js.map +1 -1
  142. package/dist/Filter.d.ts +166 -88
  143. package/dist/Filter.d.ts.map +1 -1
  144. package/dist/Filter.js +68 -42
  145. package/dist/Filter.js.map +1 -1
  146. package/dist/Formatter.d.ts +4 -2
  147. package/dist/Formatter.d.ts.map +1 -1
  148. package/dist/Formatter.js +3 -69
  149. package/dist/Formatter.js.map +1 -1
  150. package/dist/Function.d.ts +218 -151
  151. package/dist/Function.d.ts.map +1 -1
  152. package/dist/Function.js +94 -78
  153. package/dist/Function.js.map +1 -1
  154. package/dist/Graph.d.ts +714 -415
  155. package/dist/Graph.d.ts.map +1 -1
  156. package/dist/Graph.js +325 -182
  157. package/dist/Graph.js.map +1 -1
  158. package/dist/HKT.d.ts +29 -13
  159. package/dist/HKT.d.ts.map +1 -1
  160. package/dist/Hash.d.ts +35 -24
  161. package/dist/Hash.d.ts.map +1 -1
  162. package/dist/Hash.js +27 -17
  163. package/dist/Hash.js.map +1 -1
  164. package/dist/HashMap.d.ts +540 -388
  165. package/dist/HashMap.d.ts.map +1 -1
  166. package/dist/HashMap.js +262 -156
  167. package/dist/HashMap.js.map +1 -1
  168. package/dist/HashRing.d.ts +53 -34
  169. package/dist/HashRing.d.ts.map +1 -1
  170. package/dist/HashRing.js +83 -16
  171. package/dist/HashRing.js.map +1 -1
  172. package/dist/HashSet.d.ts +239 -153
  173. package/dist/HashSet.d.ts.map +1 -1
  174. package/dist/HashSet.js +110 -56
  175. package/dist/HashSet.js.map +1 -1
  176. package/dist/Inspectable.d.ts +26 -13
  177. package/dist/Inspectable.d.ts.map +1 -1
  178. package/dist/Inspectable.js +22 -10
  179. package/dist/Inspectable.js.map +1 -1
  180. package/dist/Iterable.d.ts +336 -222
  181. package/dist/Iterable.d.ts.map +1 -1
  182. package/dist/Iterable.js +146 -100
  183. package/dist/Iterable.js.map +1 -1
  184. package/dist/JsonPatch.d.ts +12 -9
  185. package/dist/JsonPatch.d.ts.map +1 -1
  186. package/dist/JsonPatch.js +9 -6
  187. package/dist/JsonPatch.js.map +1 -1
  188. package/dist/JsonPointer.d.ts +13 -11
  189. package/dist/JsonPointer.d.ts.map +1 -1
  190. package/dist/JsonPointer.js +13 -11
  191. package/dist/JsonPointer.js.map +1 -1
  192. package/dist/JsonSchema.d.ts +16 -0
  193. package/dist/JsonSchema.d.ts.map +1 -1
  194. package/dist/JsonSchema.js +10 -0
  195. package/dist/JsonSchema.js.map +1 -1
  196. package/dist/Latch.d.ts +97 -26
  197. package/dist/Latch.d.ts.map +1 -1
  198. package/dist/Latch.js +39 -20
  199. package/dist/Latch.js.map +1 -1
  200. package/dist/Layer.d.ts +472 -410
  201. package/dist/Layer.d.ts.map +1 -1
  202. package/dist/Layer.js +290 -226
  203. package/dist/Layer.js.map +1 -1
  204. package/dist/LayerMap.d.ts +99 -26
  205. package/dist/LayerMap.d.ts.map +1 -1
  206. package/dist/LayerMap.js +58 -14
  207. package/dist/LayerMap.js.map +1 -1
  208. package/dist/LogLevel.d.ts +92 -131
  209. package/dist/LogLevel.d.ts.map +1 -1
  210. package/dist/LogLevel.js +25 -15
  211. package/dist/LogLevel.js.map +1 -1
  212. package/dist/Logger.d.ts +159 -104
  213. package/dist/Logger.d.ts.map +1 -1
  214. package/dist/Logger.js +215 -189
  215. package/dist/Logger.js.map +1 -1
  216. package/dist/ManagedRuntime.d.ts +78 -19
  217. package/dist/ManagedRuntime.d.ts.map +1 -1
  218. package/dist/ManagedRuntime.js +24 -17
  219. package/dist/ManagedRuntime.js.map +1 -1
  220. package/dist/Match.d.ts +135 -161
  221. package/dist/Match.d.ts.map +1 -1
  222. package/dist/Match.js +86 -78
  223. package/dist/Match.js.map +1 -1
  224. package/dist/Metric.d.ts +330 -291
  225. package/dist/Metric.d.ts.map +1 -1
  226. package/dist/Metric.js +219 -214
  227. package/dist/Metric.js.map +1 -1
  228. package/dist/MutableHashMap.d.ts +146 -87
  229. package/dist/MutableHashMap.d.ts.map +1 -1
  230. package/dist/MutableHashMap.js +67 -43
  231. package/dist/MutableHashMap.js.map +1 -1
  232. package/dist/MutableHashSet.d.ts +52 -30
  233. package/dist/MutableHashSet.d.ts.map +1 -1
  234. package/dist/MutableHashSet.js +92 -38
  235. package/dist/MutableHashSet.js.map +1 -1
  236. package/dist/MutableList.d.ts +110 -68
  237. package/dist/MutableList.d.ts.map +1 -1
  238. package/dist/MutableList.js +135 -85
  239. package/dist/MutableList.js.map +1 -1
  240. package/dist/MutableRef.d.ts +99 -62
  241. package/dist/MutableRef.d.ts.map +1 -1
  242. package/dist/MutableRef.js +78 -60
  243. package/dist/MutableRef.js.map +1 -1
  244. package/dist/Newtype.d.ts +15 -2
  245. package/dist/Newtype.d.ts.map +1 -1
  246. package/dist/Newtype.js +8 -2
  247. package/dist/Newtype.js.map +1 -1
  248. package/dist/NonEmptyIterable.d.ts +38 -48
  249. package/dist/NonEmptyIterable.d.ts.map +1 -1
  250. package/dist/NonEmptyIterable.js +34 -25
  251. package/dist/NonEmptyIterable.js.map +1 -1
  252. package/dist/Number.d.ts +261 -205
  253. package/dist/Number.d.ts.map +1 -1
  254. package/dist/Number.js +119 -91
  255. package/dist/Number.js.map +1 -1
  256. package/dist/Optic.d.ts +6 -7
  257. package/dist/Optic.d.ts.map +1 -1
  258. package/dist/Optic.js +5 -6
  259. package/dist/Optic.js.map +1 -1
  260. package/dist/Option.d.ts +133 -156
  261. package/dist/Option.d.ts.map +1 -1
  262. package/dist/Option.js +64 -64
  263. package/dist/Option.js.map +1 -1
  264. package/dist/Order.d.ts +6 -6
  265. package/dist/Order.js +6 -6
  266. package/dist/Ordering.d.ts +56 -45
  267. package/dist/Ordering.d.ts.map +1 -1
  268. package/dist/Ordering.js +10 -8
  269. package/dist/Ordering.js.map +1 -1
  270. package/dist/PartitionedSemaphore.d.ts +225 -40
  271. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  272. package/dist/PartitionedSemaphore.js +113 -17
  273. package/dist/PartitionedSemaphore.js.map +1 -1
  274. package/dist/Path.d.ts +77 -13
  275. package/dist/Path.d.ts.map +1 -1
  276. package/dist/Path.js +49 -4
  277. package/dist/Path.js.map +1 -1
  278. package/dist/Pipeable.d.ts +77 -18
  279. package/dist/Pipeable.d.ts.map +1 -1
  280. package/dist/Pipeable.js +63 -14
  281. package/dist/Pipeable.js.map +1 -1
  282. package/dist/PlatformError.d.ts +74 -6
  283. package/dist/PlatformError.d.ts.map +1 -1
  284. package/dist/PlatformError.js +68 -5
  285. package/dist/PlatformError.js.map +1 -1
  286. package/dist/Pool.d.ts +66 -31
  287. package/dist/Pool.d.ts.map +1 -1
  288. package/dist/Pool.js +26 -24
  289. package/dist/Pool.js.map +1 -1
  290. package/dist/Predicate.d.ts +16 -23
  291. package/dist/Predicate.d.ts.map +1 -1
  292. package/dist/Predicate.js +12 -17
  293. package/dist/Predicate.js.map +1 -1
  294. package/dist/PrimaryKey.d.ts +11 -3
  295. package/dist/PrimaryKey.d.ts.map +1 -1
  296. package/dist/PrimaryKey.js +9 -2
  297. package/dist/PrimaryKey.js.map +1 -1
  298. package/dist/PubSub.d.ts +385 -309
  299. package/dist/PubSub.d.ts.map +1 -1
  300. package/dist/PubSub.js +260 -207
  301. package/dist/PubSub.js.map +1 -1
  302. package/dist/Pull.d.ts +94 -25
  303. package/dist/Pull.d.ts.map +1 -1
  304. package/dist/Pull.js +61 -13
  305. package/dist/Pull.js.map +1 -1
  306. package/dist/Queue.d.ts +303 -184
  307. package/dist/Queue.d.ts.map +1 -1
  308. package/dist/Queue.js +231 -134
  309. package/dist/Queue.js.map +1 -1
  310. package/dist/Random.d.ts +65 -57
  311. package/dist/Random.d.ts.map +1 -1
  312. package/dist/Random.js +41 -66
  313. package/dist/Random.js.map +1 -1
  314. package/dist/RcMap.d.ts +151 -141
  315. package/dist/RcMap.d.ts.map +1 -1
  316. package/dist/RcMap.js +66 -20
  317. package/dist/RcMap.js.map +1 -1
  318. package/dist/RcRef.d.ts +68 -32
  319. package/dist/RcRef.d.ts.map +1 -1
  320. package/dist/RcRef.js +33 -16
  321. package/dist/RcRef.js.map +1 -1
  322. package/dist/Record.d.ts +282 -137
  323. package/dist/Record.d.ts.map +1 -1
  324. package/dist/Record.js +124 -62
  325. package/dist/Record.js.map +1 -1
  326. package/dist/Redactable.d.ts +7 -5
  327. package/dist/Redactable.d.ts.map +1 -1
  328. package/dist/Redactable.js +5 -3
  329. package/dist/Redactable.js.map +1 -1
  330. package/dist/Redacted.d.ts +63 -34
  331. package/dist/Redacted.d.ts.map +1 -1
  332. package/dist/Redacted.js +31 -15
  333. package/dist/Redacted.js.map +1 -1
  334. package/dist/Reducer.d.ts +3 -1
  335. package/dist/Reducer.d.ts.map +1 -1
  336. package/dist/Reducer.js +2 -0
  337. package/dist/Reducer.js.map +1 -1
  338. package/dist/Ref.d.ts +85 -66
  339. package/dist/Ref.d.ts.map +1 -1
  340. package/dist/Ref.js +57 -45
  341. package/dist/Ref.js.map +1 -1
  342. package/dist/References.d.ts +73 -31
  343. package/dist/References.d.ts.map +1 -1
  344. package/dist/References.js +66 -30
  345. package/dist/References.js.map +1 -1
  346. package/dist/RegExp.d.ts +12 -6
  347. package/dist/RegExp.d.ts.map +1 -1
  348. package/dist/RegExp.js +12 -6
  349. package/dist/RegExp.js.map +1 -1
  350. package/dist/Request.d.ts +159 -34
  351. package/dist/Request.d.ts.map +1 -1
  352. package/dist/Request.js +68 -12
  353. package/dist/Request.js.map +1 -1
  354. package/dist/RequestResolver.d.ts +262 -118
  355. package/dist/RequestResolver.d.ts.map +1 -1
  356. package/dist/RequestResolver.js +78 -42
  357. package/dist/RequestResolver.js.map +1 -1
  358. package/dist/Resource.d.ts +13 -7
  359. package/dist/Resource.d.ts.map +1 -1
  360. package/dist/Resource.js +44 -6
  361. package/dist/Resource.js.map +1 -1
  362. package/dist/Result.d.ts +135 -151
  363. package/dist/Result.d.ts.map +1 -1
  364. package/dist/Result.js +56 -68
  365. package/dist/Result.js.map +1 -1
  366. package/dist/Runtime.d.ts +40 -20
  367. package/dist/Runtime.d.ts.map +1 -1
  368. package/dist/Runtime.js +34 -17
  369. package/dist/Runtime.js.map +1 -1
  370. package/dist/Schedule.d.ts +556 -590
  371. package/dist/Schedule.d.ts.map +1 -1
  372. package/dist/Schedule.js +265 -253
  373. package/dist/Schedule.js.map +1 -1
  374. package/dist/Scheduler.d.ts +44 -7
  375. package/dist/Scheduler.d.ts.map +1 -1
  376. package/dist/Scheduler.js +34 -5
  377. package/dist/Scheduler.js.map +1 -1
  378. package/dist/Schema.d.ts +1293 -602
  379. package/dist/Schema.d.ts.map +1 -1
  380. package/dist/Schema.js +501 -361
  381. package/dist/Schema.js.map +1 -1
  382. package/dist/SchemaAST.d.ts +122 -92
  383. package/dist/SchemaAST.d.ts.map +1 -1
  384. package/dist/SchemaAST.js +102 -77
  385. package/dist/SchemaAST.js.map +1 -1
  386. package/dist/SchemaGetter.d.ts +49 -36
  387. package/dist/SchemaGetter.d.ts.map +1 -1
  388. package/dist/SchemaGetter.js +42 -29
  389. package/dist/SchemaGetter.js.map +1 -1
  390. package/dist/SchemaIssue.d.ts +19 -24
  391. package/dist/SchemaIssue.d.ts.map +1 -1
  392. package/dist/SchemaIssue.js +16 -14
  393. package/dist/SchemaIssue.js.map +1 -1
  394. package/dist/SchemaParser.d.ts +231 -63
  395. package/dist/SchemaParser.d.ts.map +1 -1
  396. package/dist/SchemaParser.js +266 -75
  397. package/dist/SchemaParser.js.map +1 -1
  398. package/dist/SchemaRepresentation.d.ts +89 -77
  399. package/dist/SchemaRepresentation.d.ts.map +1 -1
  400. package/dist/SchemaRepresentation.js +47 -37
  401. package/dist/SchemaRepresentation.js.map +1 -1
  402. package/dist/SchemaTransformation.d.ts +97 -46
  403. package/dist/SchemaTransformation.d.ts.map +1 -1
  404. package/dist/SchemaTransformation.js +89 -38
  405. package/dist/SchemaTransformation.js.map +1 -1
  406. package/dist/SchemaUtils.d.ts +8 -1
  407. package/dist/SchemaUtils.d.ts.map +1 -1
  408. package/dist/SchemaUtils.js +24 -1
  409. package/dist/SchemaUtils.js.map +1 -1
  410. package/dist/Scope.d.ts +107 -65
  411. package/dist/Scope.d.ts.map +1 -1
  412. package/dist/Scope.js +61 -32
  413. package/dist/Scope.js.map +1 -1
  414. package/dist/ScopedCache.d.ts +141 -49
  415. package/dist/ScopedCache.d.ts.map +1 -1
  416. package/dist/ScopedCache.js +82 -21
  417. package/dist/ScopedCache.js.map +1 -1
  418. package/dist/ScopedRef.d.ts +28 -8
  419. package/dist/ScopedRef.d.ts.map +1 -1
  420. package/dist/ScopedRef.js +25 -5
  421. package/dist/ScopedRef.js.map +1 -1
  422. package/dist/Semaphore.d.ts +61 -37
  423. package/dist/Semaphore.d.ts.map +1 -1
  424. package/dist/Semaphore.js +18 -21
  425. package/dist/Semaphore.js.map +1 -1
  426. package/dist/Sink.d.ts +461 -206
  427. package/dist/Sink.d.ts.map +1 -1
  428. package/dist/Sink.js +241 -90
  429. package/dist/Sink.js.map +1 -1
  430. package/dist/Stdio.d.ts +43 -6
  431. package/dist/Stdio.d.ts.map +1 -1
  432. package/dist/Stdio.js +33 -4
  433. package/dist/Stdio.js.map +1 -1
  434. package/dist/Stream.d.ts +2117 -1541
  435. package/dist/Stream.d.ts.map +1 -1
  436. package/dist/Stream.js +951 -682
  437. package/dist/Stream.js.map +1 -1
  438. package/dist/String.d.ts +174 -97
  439. package/dist/String.d.ts.map +1 -1
  440. package/dist/String.js +128 -69
  441. package/dist/String.js.map +1 -1
  442. package/dist/Struct.d.ts +20 -18
  443. package/dist/Struct.d.ts.map +1 -1
  444. package/dist/Struct.js +10 -8
  445. package/dist/Struct.js.map +1 -1
  446. package/dist/SubscriptionRef.d.ts +309 -204
  447. package/dist/SubscriptionRef.d.ts.map +1 -1
  448. package/dist/SubscriptionRef.js +126 -77
  449. package/dist/SubscriptionRef.js.map +1 -1
  450. package/dist/Symbol.d.ts +13 -5
  451. package/dist/Symbol.d.ts.map +1 -1
  452. package/dist/Symbol.js +13 -5
  453. package/dist/Symbol.js.map +1 -1
  454. package/dist/SynchronizedRef.d.ts +278 -62
  455. package/dist/SynchronizedRef.d.ts.map +1 -1
  456. package/dist/SynchronizedRef.js +116 -23
  457. package/dist/SynchronizedRef.js.map +1 -1
  458. package/dist/Take.d.ts +26 -2
  459. package/dist/Take.d.ts.map +1 -1
  460. package/dist/Take.js +4 -1
  461. package/dist/Take.js.map +1 -1
  462. package/dist/Terminal.d.ts +39 -7
  463. package/dist/Terminal.d.ts.map +1 -1
  464. package/dist/Terminal.js +10 -4
  465. package/dist/Terminal.js.map +1 -1
  466. package/dist/Tracer.d.ts +233 -59
  467. package/dist/Tracer.d.ts.map +1 -1
  468. package/dist/Tracer.js +94 -18
  469. package/dist/Tracer.js.map +1 -1
  470. package/dist/Trie.d.ts +280 -245
  471. package/dist/Trie.d.ts.map +1 -1
  472. package/dist/Trie.js +116 -102
  473. package/dist/Trie.js.map +1 -1
  474. package/dist/Tuple.d.ts +34 -32
  475. package/dist/Tuple.d.ts.map +1 -1
  476. package/dist/Tuple.js +16 -14
  477. package/dist/Tuple.js.map +1 -1
  478. package/dist/TxChunk.d.ts +200 -155
  479. package/dist/TxChunk.d.ts.map +1 -1
  480. package/dist/TxChunk.js +83 -61
  481. package/dist/TxChunk.js.map +1 -1
  482. package/dist/TxDeferred.d.ts +43 -29
  483. package/dist/TxDeferred.d.ts.map +1 -1
  484. package/dist/TxDeferred.js +22 -15
  485. package/dist/TxDeferred.js.map +1 -1
  486. package/dist/TxHashMap.d.ts +362 -223
  487. package/dist/TxHashMap.d.ts.map +1 -1
  488. package/dist/TxHashMap.js +171 -98
  489. package/dist/TxHashMap.js.map +1 -1
  490. package/dist/TxHashSet.d.ts +181 -111
  491. package/dist/TxHashSet.d.ts.map +1 -1
  492. package/dist/TxHashSet.js +87 -49
  493. package/dist/TxHashSet.js.map +1 -1
  494. package/dist/TxPriorityQueue.d.ts +94 -63
  495. package/dist/TxPriorityQueue.d.ts.map +1 -1
  496. package/dist/TxPriorityQueue.js +55 -37
  497. package/dist/TxPriorityQueue.js.map +1 -1
  498. package/dist/TxPubSub.d.ts +77 -49
  499. package/dist/TxPubSub.d.ts.map +1 -1
  500. package/dist/TxPubSub.js +60 -37
  501. package/dist/TxPubSub.js.map +1 -1
  502. package/dist/TxQueue.d.ts +277 -242
  503. package/dist/TxQueue.d.ts.map +1 -1
  504. package/dist/TxQueue.js +147 -101
  505. package/dist/TxQueue.js.map +1 -1
  506. package/dist/TxReentrantLock.d.ts +69 -46
  507. package/dist/TxReentrantLock.d.ts.map +1 -1
  508. package/dist/TxReentrantLock.js +48 -32
  509. package/dist/TxReentrantLock.js.map +1 -1
  510. package/dist/TxRef.d.ts +69 -40
  511. package/dist/TxRef.d.ts.map +1 -1
  512. package/dist/TxRef.js +34 -19
  513. package/dist/TxRef.js.map +1 -1
  514. package/dist/TxSemaphore.d.ts +101 -115
  515. package/dist/TxSemaphore.d.ts.map +1 -1
  516. package/dist/TxSemaphore.js +76 -77
  517. package/dist/TxSemaphore.js.map +1 -1
  518. package/dist/TxSubscriptionRef.d.ts +74 -50
  519. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  520. package/dist/TxSubscriptionRef.js +34 -23
  521. package/dist/TxSubscriptionRef.js.map +1 -1
  522. package/dist/Types.d.ts +31 -34
  523. package/dist/Types.d.ts.map +1 -1
  524. package/dist/UndefinedOr.d.ts +62 -25
  525. package/dist/UndefinedOr.d.ts.map +1 -1
  526. package/dist/UndefinedOr.js +36 -25
  527. package/dist/UndefinedOr.js.map +1 -1
  528. package/dist/Unify.d.ts +72 -117
  529. package/dist/Unify.d.ts.map +1 -1
  530. package/dist/Unify.js +20 -6
  531. package/dist/Unify.js.map +1 -1
  532. package/dist/Utils.d.ts +5 -2
  533. package/dist/Utils.d.ts.map +1 -1
  534. package/dist/Utils.js +4 -0
  535. package/dist/Utils.js.map +1 -1
  536. package/dist/index.d.ts +1973 -418
  537. package/dist/index.d.ts.map +1 -1
  538. package/dist/index.js +1973 -418
  539. package/dist/index.js.map +1 -1
  540. package/dist/internal/schema/schema.js +1 -1
  541. package/dist/internal/schema/schema.js.map +1 -1
  542. package/dist/testing/FastCheck.d.ts +9 -6
  543. package/dist/testing/FastCheck.d.ts.map +1 -1
  544. package/dist/testing/FastCheck.js +9 -6
  545. package/dist/testing/FastCheck.js.map +1 -1
  546. package/dist/testing/TestClock.d.ts +39 -35
  547. package/dist/testing/TestClock.d.ts.map +1 -1
  548. package/dist/testing/TestClock.js +42 -12
  549. package/dist/testing/TestClock.js.map +1 -1
  550. package/dist/testing/TestConsole.d.ts +44 -36
  551. package/dist/testing/TestConsole.d.ts.map +1 -1
  552. package/dist/testing/TestConsole.js +30 -15
  553. package/dist/testing/TestConsole.js.map +1 -1
  554. package/dist/testing/TestSchema.d.ts +2 -0
  555. package/dist/testing/TestSchema.d.ts.map +1 -1
  556. package/dist/testing/TestSchema.js +9 -7
  557. package/dist/testing/TestSchema.js.map +1 -1
  558. package/dist/testing/index.d.ts +34 -0
  559. package/dist/testing/index.d.ts.map +1 -1
  560. package/dist/testing/index.js +34 -0
  561. package/dist/testing/index.js.map +1 -1
  562. package/dist/unstable/ai/AiError.d.ts +205 -147
  563. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  564. package/dist/unstable/ai/AiError.js +164 -109
  565. package/dist/unstable/ai/AiError.js.map +1 -1
  566. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  567. package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
  568. package/dist/unstable/ai/Chat.d.ts +64 -41
  569. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  570. package/dist/unstable/ai/Chat.js +51 -33
  571. package/dist/unstable/ai/Chat.js.map +1 -1
  572. package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
  573. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  574. package/dist/unstable/ai/EmbeddingModel.js +9 -8
  575. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  576. package/dist/unstable/ai/IdGenerator.d.ts +28 -18
  577. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  578. package/dist/unstable/ai/IdGenerator.js +18 -11
  579. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  580. package/dist/unstable/ai/LanguageModel.d.ts +31 -25
  581. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  582. package/dist/unstable/ai/LanguageModel.js +20 -14
  583. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  584. package/dist/unstable/ai/McpSchema.d.ts +342 -119
  585. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  586. package/dist/unstable/ai/McpSchema.js +266 -98
  587. package/dist/unstable/ai/McpSchema.js.map +1 -1
  588. package/dist/unstable/ai/McpServer.d.ts +56 -20
  589. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  590. package/dist/unstable/ai/McpServer.js +64 -16
  591. package/dist/unstable/ai/McpServer.js.map +1 -1
  592. package/dist/unstable/ai/Model.d.ts +10 -12
  593. package/dist/unstable/ai/Model.d.ts.map +1 -1
  594. package/dist/unstable/ai/Model.js +9 -7
  595. package/dist/unstable/ai/Model.js.map +1 -1
  596. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  597. package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
  598. package/dist/unstable/ai/Prompt.d.ts +200 -176
  599. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  600. package/dist/unstable/ai/Prompt.js +77 -68
  601. package/dist/unstable/ai/Prompt.js.map +1 -1
  602. package/dist/unstable/ai/Response.d.ts +173 -160
  603. package/dist/unstable/ai/Response.d.ts.map +1 -1
  604. package/dist/unstable/ai/Response.js +43 -48
  605. package/dist/unstable/ai/Response.js.map +1 -1
  606. package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
  607. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
  608. package/dist/unstable/ai/ResponseIdTracker.js +27 -2
  609. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  610. package/dist/unstable/ai/Telemetry.d.ts +43 -33
  611. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  612. package/dist/unstable/ai/Telemetry.js +15 -11
  613. package/dist/unstable/ai/Telemetry.js.map +1 -1
  614. package/dist/unstable/ai/Tokenizer.d.ts +14 -9
  615. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  616. package/dist/unstable/ai/Tokenizer.js +10 -6
  617. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  618. package/dist/unstable/ai/Tool.d.ts +167 -96
  619. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  620. package/dist/unstable/ai/Tool.js +107 -53
  621. package/dist/unstable/ai/Tool.js.map +1 -1
  622. package/dist/unstable/ai/Toolkit.d.ts +32 -39
  623. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  624. package/dist/unstable/ai/Toolkit.js +7 -5
  625. package/dist/unstable/ai/Toolkit.js.map +1 -1
  626. package/dist/unstable/ai/index.d.ts +121 -29
  627. package/dist/unstable/ai/index.d.ts.map +1 -1
  628. package/dist/unstable/ai/index.js +121 -29
  629. package/dist/unstable/ai/index.js.map +1 -1
  630. package/dist/unstable/cli/Argument.d.ts +226 -134
  631. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  632. package/dist/unstable/cli/Argument.js +101 -65
  633. package/dist/unstable/cli/Argument.js.map +1 -1
  634. package/dist/unstable/cli/CliError.d.ts +72 -26
  635. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  636. package/dist/unstable/cli/CliError.js +86 -23
  637. package/dist/unstable/cli/CliError.js.map +1 -1
  638. package/dist/unstable/cli/CliOutput.d.ts +48 -19
  639. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  640. package/dist/unstable/cli/CliOutput.js +32 -9
  641. package/dist/unstable/cli/CliOutput.js.map +1 -1
  642. package/dist/unstable/cli/Command.d.ts +196 -115
  643. package/dist/unstable/cli/Command.d.ts.map +1 -1
  644. package/dist/unstable/cli/Command.js +45 -31
  645. package/dist/unstable/cli/Command.js.map +1 -1
  646. package/dist/unstable/cli/Completions.d.ts +7 -7
  647. package/dist/unstable/cli/Completions.js +1 -1
  648. package/dist/unstable/cli/Flag.d.ts +235 -142
  649. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  650. package/dist/unstable/cli/Flag.js +111 -71
  651. package/dist/unstable/cli/Flag.js.map +1 -1
  652. package/dist/unstable/cli/GlobalFlag.d.ts +41 -13
  653. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  654. package/dist/unstable/cli/GlobalFlag.js +30 -7
  655. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  656. package/dist/unstable/cli/HelpDoc.d.ts +39 -14
  657. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  658. package/dist/unstable/cli/HelpDoc.js +21 -0
  659. package/dist/unstable/cli/Param.d.ts +110 -32
  660. package/dist/unstable/cli/Param.d.ts.map +1 -1
  661. package/dist/unstable/cli/Param.js +196 -135
  662. package/dist/unstable/cli/Param.js.map +1 -1
  663. package/dist/unstable/cli/Primitive.d.ts +79 -42
  664. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  665. package/dist/unstable/cli/Primitive.js +66 -35
  666. package/dist/unstable/cli/Primitive.js.map +1 -1
  667. package/dist/unstable/cli/Prompt.d.ts +183 -59
  668. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  669. package/dist/unstable/cli/Prompt.js +105 -23
  670. package/dist/unstable/cli/Prompt.js.map +1 -1
  671. package/dist/unstable/cli/index.d.ts +182 -0
  672. package/dist/unstable/cli/index.d.ts.map +1 -1
  673. package/dist/unstable/cli/index.js +205 -6
  674. package/dist/unstable/cli/index.js.map +1 -1
  675. package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
  676. package/dist/unstable/cli/internal/ansi.js +13 -0
  677. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  678. package/dist/unstable/cli/internal/command.d.ts +5 -1
  679. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  680. package/dist/unstable/cli/internal/command.js +5 -1
  681. package/dist/unstable/cli/internal/command.js.map +1 -1
  682. package/dist/unstable/cli/internal/config.d.ts +3 -0
  683. package/dist/unstable/cli/internal/config.d.ts.map +1 -1
  684. package/dist/unstable/cli/internal/config.js.map +1 -1
  685. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  686. package/dist/unstable/cli/internal/parser.js +0 -1
  687. package/dist/unstable/cli/internal/parser.js.map +1 -1
  688. package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
  689. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  690. package/dist/unstable/cluster/ClusterCron.js +35 -1
  691. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  692. package/dist/unstable/cluster/ClusterError.d.ts +56 -7
  693. package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
  694. package/dist/unstable/cluster/ClusterError.js +56 -7
  695. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  696. package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
  697. package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
  698. package/dist/unstable/cluster/ClusterMetrics.js +39 -5
  699. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  700. package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
  701. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  702. package/dist/unstable/cluster/ClusterSchema.js +61 -8
  703. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  704. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
  705. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  706. package/dist/unstable/cluster/ClusterWorkflowEngine.js +35 -2
  707. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  708. package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
  709. package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
  710. package/dist/unstable/cluster/DeliverAt.js +11 -3
  711. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  712. package/dist/unstable/cluster/Entity.d.ts +74 -16
  713. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  714. package/dist/unstable/cluster/Entity.js +75 -10
  715. package/dist/unstable/cluster/Entity.js.map +1 -1
  716. package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
  717. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  718. package/dist/unstable/cluster/EntityAddress.js +30 -2
  719. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  720. package/dist/unstable/cluster/EntityId.d.ts +18 -3
  721. package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
  722. package/dist/unstable/cluster/EntityId.js +15 -2
  723. package/dist/unstable/cluster/EntityId.js.map +1 -1
  724. package/dist/unstable/cluster/EntityProxy.d.ts +42 -14
  725. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  726. package/dist/unstable/cluster/EntityProxy.js +30 -14
  727. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  728. package/dist/unstable/cluster/EntityProxyServer.d.ts +18 -2
  729. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  730. package/dist/unstable/cluster/EntityProxyServer.js +40 -8
  731. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  732. package/dist/unstable/cluster/EntityResource.d.ts +43 -6
  733. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  734. package/dist/unstable/cluster/EntityResource.js +11 -4
  735. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  736. package/dist/unstable/cluster/EntityType.d.ts +27 -3
  737. package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
  738. package/dist/unstable/cluster/EntityType.js +24 -2
  739. package/dist/unstable/cluster/EntityType.js.map +1 -1
  740. package/dist/unstable/cluster/Envelope.d.ts +105 -23
  741. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  742. package/dist/unstable/cluster/Envelope.js +88 -14
  743. package/dist/unstable/cluster/Envelope.js.map +1 -1
  744. package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
  745. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  746. package/dist/unstable/cluster/HttpRunner.js +88 -13
  747. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  748. package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
  749. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  750. package/dist/unstable/cluster/K8sHttpClient.js +31 -6
  751. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  752. package/dist/unstable/cluster/MachineId.d.ts +24 -3
  753. package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
  754. package/dist/unstable/cluster/MachineId.js +21 -2
  755. package/dist/unstable/cluster/MachineId.js.map +1 -1
  756. package/dist/unstable/cluster/Message.d.ts +102 -13
  757. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  758. package/dist/unstable/cluster/Message.js +86 -10
  759. package/dist/unstable/cluster/Message.js.map +1 -1
  760. package/dist/unstable/cluster/MessageStorage.d.ts +126 -21
  761. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  762. package/dist/unstable/cluster/MessageStorage.js +70 -10
  763. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  764. package/dist/unstable/cluster/Reply.d.ts +101 -12
  765. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  766. package/dist/unstable/cluster/Reply.js +64 -8
  767. package/dist/unstable/cluster/Reply.js.map +1 -1
  768. package/dist/unstable/cluster/Runner.d.ts +47 -17
  769. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  770. package/dist/unstable/cluster/Runner.js +47 -17
  771. package/dist/unstable/cluster/Runner.js.map +1 -1
  772. package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
  773. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  774. package/dist/unstable/cluster/RunnerAddress.js +34 -2
  775. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  776. package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
  777. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  778. package/dist/unstable/cluster/RunnerHealth.js +40 -12
  779. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  780. package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
  781. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  782. package/dist/unstable/cluster/RunnerServer.js +31 -4
  783. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  784. package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
  785. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  786. package/dist/unstable/cluster/RunnerStorage.js +38 -4
  787. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  788. package/dist/unstable/cluster/Runners.d.ts +76 -13
  789. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  790. package/dist/unstable/cluster/Runners.js +73 -12
  791. package/dist/unstable/cluster/Runners.js.map +1 -1
  792. package/dist/unstable/cluster/ShardId.d.ts +53 -5
  793. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  794. package/dist/unstable/cluster/ShardId.js +49 -4
  795. package/dist/unstable/cluster/ShardId.js.map +1 -1
  796. package/dist/unstable/cluster/Sharding.d.ts +10 -2
  797. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  798. package/dist/unstable/cluster/Sharding.js +35 -4
  799. package/dist/unstable/cluster/Sharding.js.map +1 -1
  800. package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
  801. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  802. package/dist/unstable/cluster/ShardingConfig.js +66 -9
  803. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  804. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
  805. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
  806. package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
  807. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  808. package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
  809. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  810. package/dist/unstable/cluster/SingleRunner.js +23 -1
  811. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  812. package/dist/unstable/cluster/Singleton.d.ts +15 -1
  813. package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
  814. package/dist/unstable/cluster/Singleton.js +15 -1
  815. package/dist/unstable/cluster/Singleton.js.map +1 -1
  816. package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
  817. package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
  818. package/dist/unstable/cluster/SingletonAddress.js +21 -1
  819. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  820. package/dist/unstable/cluster/Snowflake.d.ts +90 -19
  821. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  822. package/dist/unstable/cluster/Snowflake.js +49 -13
  823. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  824. package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
  825. package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
  826. package/dist/unstable/cluster/SocketRunner.js +29 -2
  827. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  828. package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
  829. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  830. package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
  831. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  832. package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
  833. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  834. package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
  835. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  836. package/dist/unstable/cluster/TestRunner.d.ts +18 -1
  837. package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
  838. package/dist/unstable/cluster/TestRunner.js +18 -1
  839. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  840. package/dist/unstable/cluster/index.d.ts +790 -0
  841. package/dist/unstable/cluster/index.d.ts.map +1 -1
  842. package/dist/unstable/cluster/index.js +790 -0
  843. package/dist/unstable/cluster/index.js.map +1 -1
  844. package/dist/unstable/cluster/internal/hash.js +12 -0
  845. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  846. package/dist/unstable/devtools/DevTools.d.ts +26 -3
  847. package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
  848. package/dist/unstable/devtools/DevTools.js +26 -3
  849. package/dist/unstable/devtools/DevTools.js.map +1 -1
  850. package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
  851. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  852. package/dist/unstable/devtools/DevToolsClient.js +32 -5
  853. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  854. package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
  855. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  856. package/dist/unstable/devtools/DevToolsSchema.js +102 -20
  857. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  858. package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
  859. package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
  860. package/dist/unstable/devtools/DevToolsServer.js +21 -1
  861. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  862. package/dist/unstable/devtools/index.d.ts +58 -0
  863. package/dist/unstable/devtools/index.d.ts.map +1 -1
  864. package/dist/unstable/devtools/index.js +58 -0
  865. package/dist/unstable/devtools/index.js.map +1 -1
  866. package/dist/unstable/encoding/Msgpack.d.ts +81 -12
  867. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  868. package/dist/unstable/encoding/Msgpack.js +75 -9
  869. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  870. package/dist/unstable/encoding/Ndjson.d.ts +149 -21
  871. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  872. package/dist/unstable/encoding/Ndjson.js +97 -13
  873. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  874. package/dist/unstable/encoding/Sse.d.ts +109 -18
  875. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  876. package/dist/unstable/encoding/Sse.js +69 -13
  877. package/dist/unstable/encoding/Sse.js.map +1 -1
  878. package/dist/unstable/encoding/index.d.ts +49 -0
  879. package/dist/unstable/encoding/index.d.ts.map +1 -1
  880. package/dist/unstable/encoding/index.js +49 -0
  881. package/dist/unstable/encoding/index.js.map +1 -1
  882. package/dist/unstable/eventlog/Event.d.ts +115 -30
  883. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  884. package/dist/unstable/eventlog/Event.js +22 -2
  885. package/dist/unstable/eventlog/Event.js.map +1 -1
  886. package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
  887. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  888. package/dist/unstable/eventlog/EventGroup.js +24 -6
  889. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  890. package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
  891. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  892. package/dist/unstable/eventlog/EventJournal.js +108 -16
  893. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  894. package/dist/unstable/eventlog/EventLog.d.ts +150 -31
  895. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  896. package/dist/unstable/eventlog/EventLog.js +111 -20
  897. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  898. package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
  899. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  900. package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
  901. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  902. package/dist/unstable/eventlog/EventLogMessage.d.ts +92 -18
  903. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  904. package/dist/unstable/eventlog/EventLogMessage.js +72 -16
  905. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  906. package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
  907. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  908. package/dist/unstable/eventlog/EventLogRemote.js +54 -8
  909. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  910. package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
  911. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  912. package/dist/unstable/eventlog/EventLogServer.js +17 -3
  913. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  914. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
  915. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  916. package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
  917. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  918. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
  919. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  920. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
  921. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  922. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
  923. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
  924. package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
  925. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  926. package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
  927. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  928. package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
  929. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  930. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
  931. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  932. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
  933. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  934. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
  935. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  936. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
  937. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  938. package/dist/unstable/eventlog/index.d.ts +240 -0
  939. package/dist/unstable/eventlog/index.d.ts.map +1 -1
  940. package/dist/unstable/eventlog/index.js +240 -0
  941. package/dist/unstable/eventlog/index.js.map +1 -1
  942. package/dist/unstable/http/Cookies.d.ts +156 -77
  943. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  944. package/dist/unstable/http/Cookies.js +93 -39
  945. package/dist/unstable/http/Cookies.js.map +1 -1
  946. package/dist/unstable/http/Etag.d.ts +40 -7
  947. package/dist/unstable/http/Etag.d.ts.map +1 -1
  948. package/dist/unstable/http/Etag.js +27 -4
  949. package/dist/unstable/http/Etag.js.map +1 -1
  950. package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
  951. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  952. package/dist/unstable/http/FetchHttpClient.js +33 -4
  953. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  954. package/dist/unstable/http/FindMyWay.d.ts +1 -1
  955. package/dist/unstable/http/FindMyWay.js +1 -1
  956. package/dist/unstable/http/Headers.d.ts +182 -36
  957. package/dist/unstable/http/Headers.d.ts.map +1 -1
  958. package/dist/unstable/http/Headers.js +86 -16
  959. package/dist/unstable/http/Headers.js.map +1 -1
  960. package/dist/unstable/http/HttpBody.d.ts +114 -26
  961. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  962. package/dist/unstable/http/HttpBody.js +98 -20
  963. package/dist/unstable/http/HttpBody.js.map +1 -1
  964. package/dist/unstable/http/HttpClient.d.ts +204 -96
  965. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  966. package/dist/unstable/http/HttpClient.js +85 -38
  967. package/dist/unstable/http/HttpClient.js.map +1 -1
  968. package/dist/unstable/http/HttpClientError.d.ts +68 -12
  969. package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
  970. package/dist/unstable/http/HttpClientError.js +71 -9
  971. package/dist/unstable/http/HttpClientError.js.map +1 -1
  972. package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
  973. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  974. package/dist/unstable/http/HttpClientRequest.js +151 -45
  975. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  976. package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
  977. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  978. package/dist/unstable/http/HttpClientResponse.js +44 -11
  979. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  980. package/dist/unstable/http/HttpEffect.d.ts +42 -16
  981. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  982. package/dist/unstable/http/HttpEffect.js +33 -13
  983. package/dist/unstable/http/HttpEffect.js.map +1 -1
  984. package/dist/unstable/http/HttpIncomingMessage.d.ts +48 -7
  985. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  986. package/dist/unstable/http/HttpIncomingMessage.js +45 -6
  987. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  988. package/dist/unstable/http/HttpMethod.d.ts +38 -6
  989. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  990. package/dist/unstable/http/HttpMethod.js +27 -2
  991. package/dist/unstable/http/HttpMethod.js.map +1 -1
  992. package/dist/unstable/http/HttpMiddleware.d.ts +38 -11
  993. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  994. package/dist/unstable/http/HttpMiddleware.js +52 -10
  995. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  996. package/dist/unstable/http/HttpPlatform.d.ts +34 -3
  997. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  998. package/dist/unstable/http/HttpPlatform.js +34 -3
  999. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  1000. package/dist/unstable/http/HttpRouter.d.ts +209 -62
  1001. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  1002. package/dist/unstable/http/HttpRouter.js +136 -41
  1003. package/dist/unstable/http/HttpRouter.js.map +1 -1
  1004. package/dist/unstable/http/HttpServer.d.ts +151 -22
  1005. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  1006. package/dist/unstable/http/HttpServer.js +76 -11
  1007. package/dist/unstable/http/HttpServer.js.map +1 -1
  1008. package/dist/unstable/http/HttpServerError.d.ts +93 -10
  1009. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  1010. package/dist/unstable/http/HttpServerError.js +85 -8
  1011. package/dist/unstable/http/HttpServerError.js.map +1 -1
  1012. package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
  1013. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  1014. package/dist/unstable/http/HttpServerRequest.js +101 -20
  1015. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  1016. package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
  1017. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  1018. package/dist/unstable/http/HttpServerRespondable.js +43 -5
  1019. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  1020. package/dist/unstable/http/HttpServerResponse.d.ts +391 -67
  1021. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  1022. package/dist/unstable/http/HttpServerResponse.js +205 -33
  1023. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  1024. package/dist/unstable/http/HttpStaticServer.d.ts +24 -8
  1025. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  1026. package/dist/unstable/http/HttpStaticServer.js +24 -8
  1027. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  1028. package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
  1029. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  1030. package/dist/unstable/http/HttpTraceContext.js +47 -5
  1031. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  1032. package/dist/unstable/http/Multipart.d.ts +179 -28
  1033. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  1034. package/dist/unstable/http/Multipart.js +131 -19
  1035. package/dist/unstable/http/Multipart.js.map +1 -1
  1036. package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
  1037. package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
  1038. package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
  1039. package/dist/unstable/http/Multipasta/Node.js +1 -1
  1040. package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
  1041. package/dist/unstable/http/Multipasta/Search.js +1 -1
  1042. package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
  1043. package/dist/unstable/http/Multipasta/Web.js +1 -1
  1044. package/dist/unstable/http/Multipasta.d.ts +1 -1
  1045. package/dist/unstable/http/Multipasta.js +1 -1
  1046. package/dist/unstable/http/Template.d.ts +53 -1
  1047. package/dist/unstable/http/Template.d.ts.map +1 -1
  1048. package/dist/unstable/http/Template.js +26 -0
  1049. package/dist/unstable/http/Template.js.map +1 -1
  1050. package/dist/unstable/http/Url.d.ts +70 -56
  1051. package/dist/unstable/http/Url.d.ts.map +1 -1
  1052. package/dist/unstable/http/Url.js +35 -21
  1053. package/dist/unstable/http/Url.js.map +1 -1
  1054. package/dist/unstable/http/UrlParams.d.ts +237 -51
  1055. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  1056. package/dist/unstable/http/UrlParams.js +120 -25
  1057. package/dist/unstable/http/UrlParams.js.map +1 -1
  1058. package/dist/unstable/http/index.d.ts +452 -0
  1059. package/dist/unstable/http/index.d.ts.map +1 -1
  1060. package/dist/unstable/http/index.js +452 -0
  1061. package/dist/unstable/http/index.js.map +1 -1
  1062. package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
  1063. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  1064. package/dist/unstable/httpapi/HttpApi.js +14 -8
  1065. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  1066. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +54 -16
  1067. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  1068. package/dist/unstable/httpapi/HttpApiBuilder.js +44 -6
  1069. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  1070. package/dist/unstable/httpapi/HttpApiClient.d.ts +57 -15
  1071. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  1072. package/dist/unstable/httpapi/HttpApiClient.js +42 -6
  1073. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  1074. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
  1075. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  1076. package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
  1077. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  1078. package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
  1079. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  1080. package/dist/unstable/httpapi/HttpApiError.js +98 -1
  1081. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  1082. package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
  1083. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  1084. package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
  1085. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  1086. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
  1087. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  1088. package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -5
  1089. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  1090. package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
  1091. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  1092. package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
  1093. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  1094. package/dist/unstable/httpapi/HttpApiSchema.d.ts +86 -38
  1095. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  1096. package/dist/unstable/httpapi/HttpApiSchema.js +59 -35
  1097. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  1098. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +73 -17
  1099. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  1100. package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
  1101. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  1102. package/dist/unstable/httpapi/HttpApiSwagger.d.ts +4 -3
  1103. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  1104. package/dist/unstable/httpapi/HttpApiSwagger.js +23 -3
  1105. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  1106. package/dist/unstable/httpapi/HttpApiTest.d.ts +6 -1
  1107. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  1108. package/dist/unstable/httpapi/HttpApiTest.js +26 -1
  1109. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  1110. package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
  1111. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  1112. package/dist/unstable/httpapi/OpenApi.js +73 -15
  1113. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  1114. package/dist/unstable/httpapi/index.d.ts +310 -25
  1115. package/dist/unstable/httpapi/index.d.ts.map +1 -1
  1116. package/dist/unstable/httpapi/index.js +310 -25
  1117. package/dist/unstable/httpapi/index.js.map +1 -1
  1118. package/dist/unstable/observability/Otlp.d.ts +33 -3
  1119. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  1120. package/dist/unstable/observability/Otlp.js +14 -3
  1121. package/dist/unstable/observability/Otlp.js.map +1 -1
  1122. package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
  1123. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  1124. package/dist/unstable/observability/OtlpExporter.js +32 -1
  1125. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  1126. package/dist/unstable/observability/OtlpLogger.d.ts +15 -2
  1127. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  1128. package/dist/unstable/observability/OtlpLogger.js +29 -2
  1129. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  1130. package/dist/unstable/observability/OtlpMetrics.d.ts +17 -5
  1131. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  1132. package/dist/unstable/observability/OtlpMetrics.js +32 -2
  1133. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  1134. package/dist/unstable/observability/OtlpResource.d.ts +49 -12
  1135. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  1136. package/dist/unstable/observability/OtlpResource.js +47 -5
  1137. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  1138. package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
  1139. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  1140. package/dist/unstable/observability/OtlpSerialization.js +28 -3
  1141. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  1142. package/dist/unstable/observability/OtlpTracer.d.ts +19 -2
  1143. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  1144. package/dist/unstable/observability/OtlpTracer.js +32 -2
  1145. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  1146. package/dist/unstable/observability/PrometheusMetrics.d.ts +36 -16
  1147. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  1148. package/dist/unstable/observability/PrometheusMetrics.js +9 -7
  1149. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  1150. package/dist/unstable/observability/index.d.ts +160 -3
  1151. package/dist/unstable/observability/index.d.ts.map +1 -1
  1152. package/dist/unstable/observability/index.js +160 -3
  1153. package/dist/unstable/observability/index.js.map +1 -1
  1154. package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
  1155. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  1156. package/dist/unstable/persistence/KeyValueStore.js +81 -21
  1157. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1158. package/dist/unstable/persistence/Persistable.d.ts +76 -15
  1159. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  1160. package/dist/unstable/persistence/Persistable.js +22 -5
  1161. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1162. package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
  1163. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  1164. package/dist/unstable/persistence/PersistedCache.js +24 -1
  1165. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1166. package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
  1167. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  1168. package/dist/unstable/persistence/PersistedQueue.js +60 -13
  1169. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1170. package/dist/unstable/persistence/Persistence.d.ts +98 -16
  1171. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1172. package/dist/unstable/persistence/Persistence.js +91 -14
  1173. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1174. package/dist/unstable/persistence/RateLimiter.d.ts +101 -21
  1175. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1176. package/dist/unstable/persistence/RateLimiter.js +85 -16
  1177. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1178. package/dist/unstable/persistence/Redis.d.ts +26 -5
  1179. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  1180. package/dist/unstable/persistence/Redis.js +36 -4
  1181. package/dist/unstable/persistence/Redis.js.map +1 -1
  1182. package/dist/unstable/persistence/index.d.ts +147 -0
  1183. package/dist/unstable/persistence/index.d.ts.map +1 -1
  1184. package/dist/unstable/persistence/index.js +147 -0
  1185. package/dist/unstable/persistence/index.js.map +1 -1
  1186. package/dist/unstable/process/ChildProcess.d.ts +87 -64
  1187. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1188. package/dist/unstable/process/ChildProcess.js +25 -18
  1189. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1190. package/dist/unstable/process/ChildProcessSpawner.d.ts +23 -12
  1191. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1192. package/dist/unstable/process/ChildProcessSpawner.js +11 -6
  1193. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1194. package/dist/unstable/process/index.d.ts +2 -1
  1195. package/dist/unstable/process/index.d.ts.map +1 -1
  1196. package/dist/unstable/process/index.js +2 -1
  1197. package/dist/unstable/process/index.js.map +1 -1
  1198. package/dist/unstable/reactivity/AsyncResult.d.ts +198 -59
  1199. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1200. package/dist/unstable/reactivity/AsyncResult.js +121 -36
  1201. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1202. package/dist/unstable/reactivity/Atom.d.ts +544 -130
  1203. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1204. package/dist/unstable/reactivity/Atom.js +252 -58
  1205. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1206. package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
  1207. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1208. package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
  1209. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1210. package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
  1211. package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
  1212. package/dist/unstable/reactivity/AtomRef.js +29 -3
  1213. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1214. package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
  1215. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  1216. package/dist/unstable/reactivity/AtomRegistry.js +69 -10
  1217. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1218. package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
  1219. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1220. package/dist/unstable/reactivity/AtomRpc.js +29 -1
  1221. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1222. package/dist/unstable/reactivity/Hydration.d.ts +28 -5
  1223. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  1224. package/dist/unstable/reactivity/Hydration.js +35 -3
  1225. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1226. package/dist/unstable/reactivity/Reactivity.d.ts +94 -13
  1227. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  1228. package/dist/unstable/reactivity/Reactivity.js +60 -7
  1229. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1230. package/dist/unstable/reactivity/index.d.ts +167 -0
  1231. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  1232. package/dist/unstable/reactivity/index.js +167 -0
  1233. package/dist/unstable/reactivity/index.js.map +1 -1
  1234. package/dist/unstable/rpc/Rpc.d.ts +254 -56
  1235. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1236. package/dist/unstable/rpc/Rpc.js +44 -11
  1237. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1238. package/dist/unstable/rpc/RpcClient.d.ts +80 -19
  1239. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1240. package/dist/unstable/rpc/RpcClient.js +52 -12
  1241. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1242. package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
  1243. package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
  1244. package/dist/unstable/rpc/RpcClientError.js +26 -2
  1245. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1246. package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
  1247. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  1248. package/dist/unstable/rpc/RpcGroup.js +3 -1
  1249. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1250. package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
  1251. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1252. package/dist/unstable/rpc/RpcMessage.js +23 -7
  1253. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1254. package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
  1255. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  1256. package/dist/unstable/rpc/RpcMiddleware.js +39 -3
  1257. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1258. package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
  1259. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  1260. package/dist/unstable/rpc/RpcSchema.js +34 -3
  1261. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1262. package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
  1263. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1264. package/dist/unstable/rpc/RpcSerialization.js +56 -12
  1265. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1266. package/dist/unstable/rpc/RpcServer.d.ts +73 -23
  1267. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  1268. package/dist/unstable/rpc/RpcServer.js +69 -22
  1269. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1270. package/dist/unstable/rpc/RpcTest.d.ts +20 -1
  1271. package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
  1272. package/dist/unstable/rpc/RpcTest.js +20 -1
  1273. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1274. package/dist/unstable/rpc/RpcWorker.d.ts +39 -6
  1275. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  1276. package/dist/unstable/rpc/RpcWorker.js +16 -4
  1277. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1278. package/dist/unstable/rpc/Utils.d.ts +10 -0
  1279. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  1280. package/dist/unstable/rpc/Utils.js +10 -0
  1281. package/dist/unstable/rpc/Utils.js.map +1 -1
  1282. package/dist/unstable/rpc/index.d.ts +272 -0
  1283. package/dist/unstable/rpc/index.d.ts.map +1 -1
  1284. package/dist/unstable/rpc/index.js +272 -0
  1285. package/dist/unstable/rpc/index.js.map +1 -1
  1286. package/dist/unstable/schema/Model.d.ts +192 -59
  1287. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1288. package/dist/unstable/schema/Model.js +122 -38
  1289. package/dist/unstable/schema/Model.js.map +1 -1
  1290. package/dist/unstable/schema/VariantSchema.d.ts +101 -24
  1291. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1292. package/dist/unstable/schema/VariantSchema.js +22 -6
  1293. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1294. package/dist/unstable/schema/index.d.ts +37 -0
  1295. package/dist/unstable/schema/index.d.ts.map +1 -1
  1296. package/dist/unstable/schema/index.js +37 -0
  1297. package/dist/unstable/schema/index.js.map +1 -1
  1298. package/dist/unstable/socket/Socket.d.ts +168 -34
  1299. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1300. package/dist/unstable/socket/Socket.js +124 -28
  1301. package/dist/unstable/socket/Socket.js.map +1 -1
  1302. package/dist/unstable/socket/SocketServer.d.ts +58 -10
  1303. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  1304. package/dist/unstable/socket/SocketServer.js +43 -5
  1305. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1306. package/dist/unstable/socket/index.d.ts +44 -0
  1307. package/dist/unstable/socket/index.d.ts.map +1 -1
  1308. package/dist/unstable/socket/index.js +44 -0
  1309. package/dist/unstable/socket/index.js.map +1 -1
  1310. package/dist/unstable/sql/Migrator.d.ts +40 -9
  1311. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  1312. package/dist/unstable/sql/Migrator.js +45 -5
  1313. package/dist/unstable/sql/Migrator.js.map +1 -1
  1314. package/dist/unstable/sql/SqlClient.d.ts +38 -2
  1315. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1316. package/dist/unstable/sql/SqlClient.js +40 -1
  1317. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1318. package/dist/unstable/sql/SqlConnection.d.ts +34 -3
  1319. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  1320. package/dist/unstable/sql/SqlConnection.js +22 -0
  1321. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1322. package/dist/unstable/sql/SqlError.d.ts +117 -0
  1323. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  1324. package/dist/unstable/sql/SqlError.js +131 -0
  1325. package/dist/unstable/sql/SqlError.js.map +1 -1
  1326. package/dist/unstable/sql/SqlModel.d.ts +25 -5
  1327. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  1328. package/dist/unstable/sql/SqlModel.js +8 -4
  1329. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1330. package/dist/unstable/sql/SqlResolver.d.ts +56 -13
  1331. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  1332. package/dist/unstable/sql/SqlResolver.js +44 -10
  1333. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1334. package/dist/unstable/sql/SqlSchema.d.ts +29 -8
  1335. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  1336. package/dist/unstable/sql/SqlSchema.js +29 -8
  1337. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1338. package/dist/unstable/sql/SqlStream.d.ts +4 -0
  1339. package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
  1340. package/dist/unstable/sql/SqlStream.js +24 -0
  1341. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1342. package/dist/unstable/sql/Statement.d.ts +151 -24
  1343. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1344. package/dist/unstable/sql/Statement.js +91 -6
  1345. package/dist/unstable/sql/Statement.js.map +1 -1
  1346. package/dist/unstable/sql/index.d.ts +179 -1
  1347. package/dist/unstable/sql/index.d.ts.map +1 -1
  1348. package/dist/unstable/sql/index.js +179 -1
  1349. package/dist/unstable/sql/index.js.map +1 -1
  1350. package/dist/unstable/workers/Transferable.d.ts +72 -20
  1351. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  1352. package/dist/unstable/workers/Transferable.js +57 -14
  1353. package/dist/unstable/workers/Transferable.js.map +1 -1
  1354. package/dist/unstable/workers/Worker.d.ts +61 -8
  1355. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  1356. package/dist/unstable/workers/Worker.js +44 -4
  1357. package/dist/unstable/workers/Worker.js.map +1 -1
  1358. package/dist/unstable/workers/WorkerError.d.ts +31 -9
  1359. package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
  1360. package/dist/unstable/workers/WorkerError.js +44 -7
  1361. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1362. package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
  1363. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  1364. package/dist/unstable/workers/WorkerRunner.js +24 -1
  1365. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1366. package/dist/unstable/workers/index.d.ts +81 -1
  1367. package/dist/unstable/workers/index.d.ts.map +1 -1
  1368. package/dist/unstable/workers/index.js +81 -1
  1369. package/dist/unstable/workers/index.js.map +1 -1
  1370. package/dist/unstable/workflow/Activity.d.ts +61 -10
  1371. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  1372. package/dist/unstable/workflow/Activity.js +20 -5
  1373. package/dist/unstable/workflow/Activity.js.map +1 -1
  1374. package/dist/unstable/workflow/DurableClock.d.ts +12 -3
  1375. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  1376. package/dist/unstable/workflow/DurableClock.js +22 -2
  1377. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1378. package/dist/unstable/workflow/DurableDeferred.d.ts +128 -31
  1379. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1380. package/dist/unstable/workflow/DurableDeferred.js +77 -13
  1381. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1382. package/dist/unstable/workflow/DurableQueue.d.ts +33 -8
  1383. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  1384. package/dist/unstable/workflow/DurableQueue.js +26 -6
  1385. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  1386. package/dist/unstable/workflow/Workflow.d.ts +102 -31
  1387. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1388. package/dist/unstable/workflow/Workflow.js +75 -19
  1389. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1390. package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
  1391. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  1392. package/dist/unstable/workflow/WorkflowEngine.js +16 -4
  1393. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1394. package/dist/unstable/workflow/WorkflowProxy.d.ts +40 -12
  1395. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1396. package/dist/unstable/workflow/WorkflowProxy.js +8 -12
  1397. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1398. package/dist/unstable/workflow/WorkflowProxyServer.d.ts +37 -2
  1399. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  1400. package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
  1401. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1402. package/dist/unstable/workflow/index.d.ts +160 -0
  1403. package/dist/unstable/workflow/index.d.ts.map +1 -1
  1404. package/dist/unstable/workflow/index.js +160 -0
  1405. package/dist/unstable/workflow/index.js.map +1 -1
  1406. package/package.json +11 -11
  1407. package/src/Array.ts +151 -106
  1408. package/src/BigDecimal.ts +620 -553
  1409. package/src/BigInt.ts +342 -274
  1410. package/src/Boolean.ts +189 -156
  1411. package/src/Brand.ts +30 -5
  1412. package/src/Cache.ts +334 -167
  1413. package/src/Cause.ts +84 -73
  1414. package/src/Channel.ts +1639 -667
  1415. package/src/ChannelSchema.ts +137 -12
  1416. package/src/Chunk.ts +575 -429
  1417. package/src/Clock.ts +16 -9
  1418. package/src/Combiner.ts +11 -5
  1419. package/src/Config.ts +80 -68
  1420. package/src/ConfigProvider.ts +33 -32
  1421. package/src/Console.ts +88 -58
  1422. package/src/Context.ts +401 -190
  1423. package/src/Cron.ts +109 -48
  1424. package/src/Crypto.ts +327 -0
  1425. package/src/Data.ts +9 -3
  1426. package/src/DateTime.ts +893 -464
  1427. package/src/Deferred.ts +367 -175
  1428. package/src/Differ.ts +44 -2
  1429. package/src/Duration.ts +333 -186
  1430. package/src/Effect.ts +2201 -2289
  1431. package/src/Effectable.ts +38 -3
  1432. package/src/Encoding.ts +78 -28
  1433. package/src/Equal.ts +4 -3
  1434. package/src/Equivalence.ts +18 -24
  1435. package/src/ErrorReporter.ts +66 -82
  1436. package/src/ExecutionPlan.ts +106 -12
  1437. package/src/Exit.ts +6 -5
  1438. package/src/Fiber.ts +71 -40
  1439. package/src/FiberHandle.ts +157 -57
  1440. package/src/FiberMap.ts +328 -163
  1441. package/src/FiberSet.ts +130 -52
  1442. package/src/FileSystem.ts +104 -74
  1443. package/src/Filter.ts +166 -88
  1444. package/src/Formatter.ts +4 -70
  1445. package/src/Function.ts +218 -151
  1446. package/src/Graph.ts +714 -415
  1447. package/src/HKT.ts +29 -13
  1448. package/src/Hash.ts +35 -24
  1449. package/src/HashMap.ts +540 -388
  1450. package/src/HashRing.ts +111 -34
  1451. package/src/HashSet.ts +239 -153
  1452. package/src/Inspectable.ts +30 -17
  1453. package/src/Iterable.ts +336 -222
  1454. package/src/JsonPatch.ts +13 -10
  1455. package/src/JsonPointer.ts +13 -11
  1456. package/src/JsonSchema.ts +16 -0
  1457. package/src/Latch.ts +97 -26
  1458. package/src/Layer.ts +547 -445
  1459. package/src/LayerMap.ts +99 -26
  1460. package/src/LogLevel.ts +92 -131
  1461. package/src/Logger.ts +365 -297
  1462. package/src/ManagedRuntime.ts +78 -19
  1463. package/src/Match.ts +135 -161
  1464. package/src/Metric.ts +362 -313
  1465. package/src/MutableHashMap.ts +202 -127
  1466. package/src/MutableHashSet.ts +120 -52
  1467. package/src/MutableList.ts +157 -100
  1468. package/src/MutableRef.ts +129 -90
  1469. package/src/Newtype.ts +15 -2
  1470. package/src/NonEmptyIterable.ts +38 -48
  1471. package/src/Number.ts +261 -205
  1472. package/src/Optic.ts +6 -7
  1473. package/src/Option.ts +133 -156
  1474. package/src/Order.ts +6 -6
  1475. package/src/Ordering.ts +56 -45
  1476. package/src/PartitionedSemaphore.ts +225 -40
  1477. package/src/Path.ts +77 -13
  1478. package/src/Pipeable.ts +82 -24
  1479. package/src/PlatformError.ts +74 -6
  1480. package/src/Pool.ts +94 -31
  1481. package/src/Predicate.ts +17 -24
  1482. package/src/PrimaryKey.ts +11 -3
  1483. package/src/PubSub.ts +385 -309
  1484. package/src/Pull.ts +94 -25
  1485. package/src/Queue.ts +303 -184
  1486. package/src/Random.ts +69 -93
  1487. package/src/RcMap.ts +151 -141
  1488. package/src/RcRef.ts +68 -32
  1489. package/src/Record.ts +282 -137
  1490. package/src/Redactable.ts +7 -5
  1491. package/src/Redacted.ts +63 -34
  1492. package/src/Reducer.ts +3 -1
  1493. package/src/Ref.ts +173 -134
  1494. package/src/References.ts +73 -31
  1495. package/src/RegExp.ts +12 -6
  1496. package/src/Request.ts +159 -34
  1497. package/src/RequestResolver.ts +278 -121
  1498. package/src/Resource.ts +45 -7
  1499. package/src/Result.ts +137 -153
  1500. package/src/Runtime.ts +42 -21
  1501. package/src/Schedule.ts +585 -613
  1502. package/src/Scheduler.ts +44 -7
  1503. package/src/Schema.ts +1309 -615
  1504. package/src/SchemaAST.ts +123 -93
  1505. package/src/SchemaGetter.ts +52 -37
  1506. package/src/SchemaIssue.ts +19 -24
  1507. package/src/SchemaParser.ts +306 -85
  1508. package/src/SchemaRepresentation.ts +89 -77
  1509. package/src/SchemaTransformation.ts +97 -46
  1510. package/src/SchemaUtils.ts +24 -1
  1511. package/src/Scope.ts +107 -65
  1512. package/src/ScopedCache.ts +195 -59
  1513. package/src/ScopedRef.ts +28 -8
  1514. package/src/Semaphore.ts +61 -37
  1515. package/src/Sink.ts +461 -206
  1516. package/src/Stdio.ts +43 -6
  1517. package/src/Stream.ts +2361 -1613
  1518. package/src/String.ts +174 -97
  1519. package/src/Struct.ts +20 -18
  1520. package/src/SubscriptionRef.ts +309 -204
  1521. package/src/Symbol.ts +13 -5
  1522. package/src/SynchronizedRef.ts +278 -62
  1523. package/src/Take.ts +26 -2
  1524. package/src/Terminal.ts +40 -7
  1525. package/src/Tracer.ts +233 -59
  1526. package/src/Trie.ts +280 -245
  1527. package/src/Tuple.ts +34 -32
  1528. package/src/TxChunk.ts +200 -155
  1529. package/src/TxDeferred.ts +43 -29
  1530. package/src/TxHashMap.ts +370 -231
  1531. package/src/TxHashSet.ts +253 -159
  1532. package/src/TxPriorityQueue.ts +97 -65
  1533. package/src/TxPubSub.ts +77 -49
  1534. package/src/TxQueue.ts +277 -242
  1535. package/src/TxReentrantLock.ts +70 -47
  1536. package/src/TxRef.ts +69 -40
  1537. package/src/TxSemaphore.ts +101 -115
  1538. package/src/TxSubscriptionRef.ts +74 -50
  1539. package/src/Types.ts +31 -34
  1540. package/src/UndefinedOr.ts +62 -25
  1541. package/src/Unify.ts +72 -117
  1542. package/src/Utils.ts +5 -2
  1543. package/src/index.ts +1976 -420
  1544. package/src/internal/schema/schema.ts +1 -1
  1545. package/src/testing/FastCheck.ts +9 -6
  1546. package/src/testing/TestClock.ts +63 -35
  1547. package/src/testing/TestConsole.ts +54 -36
  1548. package/src/testing/TestSchema.ts +10 -8
  1549. package/src/testing/index.ts +34 -0
  1550. package/src/unstable/ai/AiError.ts +195 -137
  1551. package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
  1552. package/src/unstable/ai/Chat.ts +68 -43
  1553. package/src/unstable/ai/EmbeddingModel.ts +12 -11
  1554. package/src/unstable/ai/IdGenerator.ts +28 -18
  1555. package/src/unstable/ai/LanguageModel.ts +35 -27
  1556. package/src/unstable/ai/McpSchema.ts +342 -119
  1557. package/src/unstable/ai/McpServer.ts +79 -20
  1558. package/src/unstable/ai/Model.ts +10 -12
  1559. package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
  1560. package/src/unstable/ai/Prompt.ts +216 -192
  1561. package/src/unstable/ai/Response.ts +179 -167
  1562. package/src/unstable/ai/ResponseIdTracker.ts +43 -4
  1563. package/src/unstable/ai/Telemetry.ts +43 -33
  1564. package/src/unstable/ai/Tokenizer.ts +14 -9
  1565. package/src/unstable/ai/Tool.ts +168 -97
  1566. package/src/unstable/ai/Toolkit.ts +51 -46
  1567. package/src/unstable/ai/index.ts +121 -29
  1568. package/src/unstable/cli/Argument.ts +226 -134
  1569. package/src/unstable/cli/CliError.ts +96 -26
  1570. package/src/unstable/cli/CliOutput.ts +48 -19
  1571. package/src/unstable/cli/Command.ts +196 -115
  1572. package/src/unstable/cli/Completions.ts +7 -7
  1573. package/src/unstable/cli/Flag.ts +235 -142
  1574. package/src/unstable/cli/GlobalFlag.ts +41 -13
  1575. package/src/unstable/cli/HelpDoc.ts +39 -14
  1576. package/src/unstable/cli/Param.ts +395 -260
  1577. package/src/unstable/cli/Primitive.ts +79 -42
  1578. package/src/unstable/cli/Prompt.ts +207 -59
  1579. package/src/unstable/cli/index.ts +205 -6
  1580. package/src/unstable/cli/internal/ansi.ts +13 -0
  1581. package/src/unstable/cli/internal/command.ts +5 -1
  1582. package/src/unstable/cli/internal/config.ts +3 -0
  1583. package/src/unstable/cli/internal/lexer.ts +11 -0
  1584. package/src/unstable/cli/internal/parser.ts +0 -1
  1585. package/src/unstable/cluster/ClusterCron.ts +35 -1
  1586. package/src/unstable/cluster/ClusterError.ts +56 -7
  1587. package/src/unstable/cluster/ClusterMetrics.ts +39 -5
  1588. package/src/unstable/cluster/ClusterSchema.ts +61 -8
  1589. package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -2
  1590. package/src/unstable/cluster/DeliverAt.ts +39 -4
  1591. package/src/unstable/cluster/Entity.ts +106 -16
  1592. package/src/unstable/cluster/EntityAddress.ts +30 -2
  1593. package/src/unstable/cluster/EntityId.ts +18 -3
  1594. package/src/unstable/cluster/EntityProxy.ts +42 -14
  1595. package/src/unstable/cluster/EntityProxyServer.ts +45 -8
  1596. package/src/unstable/cluster/EntityResource.ts +43 -6
  1597. package/src/unstable/cluster/EntityType.ts +27 -3
  1598. package/src/unstable/cluster/Envelope.ts +128 -23
  1599. package/src/unstable/cluster/HttpRunner.ts +88 -13
  1600. package/src/unstable/cluster/K8sHttpClient.ts +49 -6
  1601. package/src/unstable/cluster/MachineId.ts +24 -3
  1602. package/src/unstable/cluster/Message.ts +102 -13
  1603. package/src/unstable/cluster/MessageStorage.ts +126 -21
  1604. package/src/unstable/cluster/Reply.ts +101 -12
  1605. package/src/unstable/cluster/Runner.ts +47 -17
  1606. package/src/unstable/cluster/RunnerAddress.ts +34 -2
  1607. package/src/unstable/cluster/RunnerHealth.ts +40 -12
  1608. package/src/unstable/cluster/RunnerServer.ts +31 -4
  1609. package/src/unstable/cluster/RunnerStorage.ts +42 -5
  1610. package/src/unstable/cluster/Runners.ts +76 -13
  1611. package/src/unstable/cluster/ShardId.ts +53 -5
  1612. package/src/unstable/cluster/Sharding.ts +35 -4
  1613. package/src/unstable/cluster/ShardingConfig.ts +75 -10
  1614. package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
  1615. package/src/unstable/cluster/SingleRunner.ts +23 -1
  1616. package/src/unstable/cluster/Singleton.ts +15 -1
  1617. package/src/unstable/cluster/SingletonAddress.ts +21 -1
  1618. package/src/unstable/cluster/Snowflake.ts +90 -19
  1619. package/src/unstable/cluster/SocketRunner.ts +29 -2
  1620. package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
  1621. package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
  1622. package/src/unstable/cluster/TestRunner.ts +18 -1
  1623. package/src/unstable/cluster/index.ts +790 -0
  1624. package/src/unstable/cluster/internal/hash.ts +12 -0
  1625. package/src/unstable/devtools/DevTools.ts +26 -3
  1626. package/src/unstable/devtools/DevToolsClient.ts +32 -5
  1627. package/src/unstable/devtools/DevToolsSchema.ts +201 -44
  1628. package/src/unstable/devtools/DevToolsServer.ts +27 -2
  1629. package/src/unstable/devtools/index.ts +58 -0
  1630. package/src/unstable/encoding/Msgpack.ts +97 -12
  1631. package/src/unstable/encoding/Ndjson.ts +149 -21
  1632. package/src/unstable/encoding/Sse.ts +109 -18
  1633. package/src/unstable/encoding/index.ts +49 -0
  1634. package/src/unstable/eventlog/Event.ts +131 -30
  1635. package/src/unstable/eventlog/EventGroup.ts +50 -17
  1636. package/src/unstable/eventlog/EventJournal.ts +120 -20
  1637. package/src/unstable/eventlog/EventLog.ts +150 -31
  1638. package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
  1639. package/src/unstable/eventlog/EventLogMessage.ts +92 -18
  1640. package/src/unstable/eventlog/EventLogRemote.ts +54 -8
  1641. package/src/unstable/eventlog/EventLogServer.ts +33 -3
  1642. package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
  1643. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
  1644. package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
  1645. package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
  1646. package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
  1647. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
  1648. package/src/unstable/eventlog/index.ts +240 -0
  1649. package/src/unstable/http/Cookies.ts +156 -77
  1650. package/src/unstable/http/Etag.ts +40 -7
  1651. package/src/unstable/http/FetchHttpClient.ts +33 -4
  1652. package/src/unstable/http/FindMyWay.ts +1 -1
  1653. package/src/unstable/http/Headers.ts +252 -50
  1654. package/src/unstable/http/HttpBody.ts +128 -26
  1655. package/src/unstable/http/HttpClient.ts +204 -96
  1656. package/src/unstable/http/HttpClientError.ts +80 -12
  1657. package/src/unstable/http/HttpClientRequest.ts +318 -100
  1658. package/src/unstable/http/HttpClientResponse.ts +59 -16
  1659. package/src/unstable/http/HttpEffect.ts +66 -18
  1660. package/src/unstable/http/HttpIncomingMessage.ts +48 -7
  1661. package/src/unstable/http/HttpMethod.ts +38 -6
  1662. package/src/unstable/http/HttpMiddleware.ts +60 -11
  1663. package/src/unstable/http/HttpPlatform.ts +34 -3
  1664. package/src/unstable/http/HttpRouter.ts +232 -69
  1665. package/src/unstable/http/HttpServer.ts +151 -22
  1666. package/src/unstable/http/HttpServerError.ts +93 -10
  1667. package/src/unstable/http/HttpServerRequest.ts +125 -21
  1668. package/src/unstable/http/HttpServerRespondable.ts +49 -6
  1669. package/src/unstable/http/HttpServerResponse.ts +391 -67
  1670. package/src/unstable/http/HttpStaticServer.ts +24 -8
  1671. package/src/unstable/http/HttpTraceContext.ts +53 -6
  1672. package/src/unstable/http/Multipart.ts +179 -28
  1673. package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
  1674. package/src/unstable/http/Multipasta/Node.ts +1 -1
  1675. package/src/unstable/http/Multipasta/Search.ts +1 -1
  1676. package/src/unstable/http/Multipasta/Web.ts +1 -1
  1677. package/src/unstable/http/Multipasta.ts +1 -1
  1678. package/src/unstable/http/Template.ts +53 -1
  1679. package/src/unstable/http/Url.ts +70 -56
  1680. package/src/unstable/http/UrlParams.ts +237 -51
  1681. package/src/unstable/http/index.ts +452 -0
  1682. package/src/unstable/httpapi/HttpApi.ts +49 -14
  1683. package/src/unstable/httpapi/HttpApiBuilder.ts +81 -16
  1684. package/src/unstable/httpapi/HttpApiClient.ts +78 -15
  1685. package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
  1686. package/src/unstable/httpapi/HttpApiError.ts +100 -1
  1687. package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
  1688. package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -22
  1689. package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
  1690. package/src/unstable/httpapi/HttpApiSchema.ts +86 -38
  1691. package/src/unstable/httpapi/HttpApiSecurity.ts +73 -17
  1692. package/src/unstable/httpapi/HttpApiSwagger.ts +23 -3
  1693. package/src/unstable/httpapi/HttpApiTest.ts +26 -1
  1694. package/src/unstable/httpapi/OpenApi.ts +115 -15
  1695. package/src/unstable/httpapi/index.ts +310 -25
  1696. package/src/unstable/observability/Otlp.ts +33 -3
  1697. package/src/unstable/observability/OtlpExporter.ts +32 -1
  1698. package/src/unstable/observability/OtlpLogger.ts +32 -2
  1699. package/src/unstable/observability/OtlpMetrics.ts +39 -5
  1700. package/src/unstable/observability/OtlpResource.ts +68 -12
  1701. package/src/unstable/observability/OtlpSerialization.ts +28 -3
  1702. package/src/unstable/observability/OtlpTracer.ts +41 -2
  1703. package/src/unstable/observability/PrometheusMetrics.ts +36 -16
  1704. package/src/unstable/observability/index.ts +160 -3
  1705. package/src/unstable/persistence/KeyValueStore.ts +108 -28
  1706. package/src/unstable/persistence/Persistable.ts +76 -15
  1707. package/src/unstable/persistence/PersistedCache.ts +27 -2
  1708. package/src/unstable/persistence/PersistedQueue.ts +98 -16
  1709. package/src/unstable/persistence/Persistence.ts +98 -16
  1710. package/src/unstable/persistence/RateLimiter.ts +101 -21
  1711. package/src/unstable/persistence/Redis.ts +42 -5
  1712. package/src/unstable/persistence/index.ts +147 -0
  1713. package/src/unstable/process/ChildProcess.ts +90 -66
  1714. package/src/unstable/process/ChildProcessSpawner.ts +23 -12
  1715. package/src/unstable/process/index.ts +2 -1
  1716. package/src/unstable/reactivity/AsyncResult.ts +204 -61
  1717. package/src/unstable/reactivity/Atom.ts +598 -139
  1718. package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
  1719. package/src/unstable/reactivity/AtomRef.ts +51 -7
  1720. package/src/unstable/reactivity/AtomRegistry.ts +141 -22
  1721. package/src/unstable/reactivity/AtomRpc.ts +36 -2
  1722. package/src/unstable/reactivity/Hydration.ts +45 -5
  1723. package/src/unstable/reactivity/Reactivity.ts +94 -13
  1724. package/src/unstable/reactivity/index.ts +167 -0
  1725. package/src/unstable/rpc/Rpc.ts +254 -56
  1726. package/src/unstable/rpc/RpcClient.ts +106 -19
  1727. package/src/unstable/rpc/RpcClientError.ts +26 -2
  1728. package/src/unstable/rpc/RpcGroup.ts +51 -8
  1729. package/src/unstable/rpc/RpcMessage.ts +128 -32
  1730. package/src/unstable/rpc/RpcMiddleware.ts +100 -20
  1731. package/src/unstable/rpc/RpcSchema.ts +38 -4
  1732. package/src/unstable/rpc/RpcSerialization.ts +60 -13
  1733. package/src/unstable/rpc/RpcServer.ts +107 -23
  1734. package/src/unstable/rpc/RpcTest.ts +20 -1
  1735. package/src/unstable/rpc/RpcWorker.ts +39 -6
  1736. package/src/unstable/rpc/Utils.ts +33 -0
  1737. package/src/unstable/rpc/index.ts +272 -0
  1738. package/src/unstable/schema/Model.ts +245 -61
  1739. package/src/unstable/schema/VariantSchema.ts +101 -24
  1740. package/src/unstable/schema/index.ts +37 -0
  1741. package/src/unstable/socket/Socket.ts +168 -34
  1742. package/src/unstable/socket/SocketServer.ts +58 -10
  1743. package/src/unstable/socket/index.ts +44 -0
  1744. package/src/unstable/sql/Migrator.ts +61 -9
  1745. package/src/unstable/sql/SqlClient.ts +59 -2
  1746. package/src/unstable/sql/SqlConnection.ts +34 -3
  1747. package/src/unstable/sql/SqlError.ts +135 -0
  1748. package/src/unstable/sql/SqlModel.ts +25 -5
  1749. package/src/unstable/sql/SqlResolver.ts +56 -13
  1750. package/src/unstable/sql/SqlSchema.ts +29 -8
  1751. package/src/unstable/sql/SqlStream.ts +24 -0
  1752. package/src/unstable/sql/Statement.ts +168 -24
  1753. package/src/unstable/sql/index.ts +179 -1
  1754. package/src/unstable/workers/Transferable.ts +72 -20
  1755. package/src/unstable/workers/Worker.ts +61 -8
  1756. package/src/unstable/workers/WorkerError.ts +50 -9
  1757. package/src/unstable/workers/WorkerRunner.ts +32 -3
  1758. package/src/unstable/workers/index.ts +81 -1
  1759. package/src/unstable/workflow/Activity.ts +61 -10
  1760. package/src/unstable/workflow/DurableClock.ts +26 -3
  1761. package/src/unstable/workflow/DurableDeferred.ts +148 -31
  1762. package/src/unstable/workflow/DurableQueue.ts +33 -8
  1763. package/src/unstable/workflow/Workflow.ts +123 -31
  1764. package/src/unstable/workflow/WorkflowEngine.ts +40 -5
  1765. package/src/unstable/workflow/WorkflowProxy.ts +40 -12
  1766. package/src/unstable/workflow/WorkflowProxyServer.ts +41 -6
  1767. package/src/unstable/workflow/index.ts +160 -0
package/dist/Stream.js CHANGED
@@ -1,4 +1,41 @@
1
1
  /**
2
+ * The `Stream` module provides a typed, composable way to describe effectful
3
+ * sequences of values. A `Stream<A, E, R>` can emit zero or more `A` values,
4
+ * fail with an `E`, and require services from `R` while preserving
5
+ * backpressure and resource safety.
6
+ *
7
+ * **Mental model**
8
+ *
9
+ * - A stream is a lazy description; it runs only when consumed with a `run*` function
10
+ * - Streams are pull-based and emit chunks internally for efficient throughput
11
+ * - `A` is the element type, `E` is the failure type, and `R` is the required context
12
+ * - Stream composition mirrors `Effect`: use `map`, `flatMap`, error handling, and `pipe`
13
+ * - Resource scopes, interruption, and finalizers are tracked by the Effect runtime
14
+ * - Interop functions connect streams to queues, pub/subs, web streams, async iterables, and channels
15
+ *
16
+ * **Common tasks**
17
+ *
18
+ * - Create streams: {@link make}, {@link fromIterable}, {@link fromEffect}, {@link fromQueue}
19
+ * - Transform values: {@link map}, {@link mapEffect}, {@link flatMap}, {@link filter}
20
+ * - Combine streams: {@link concat}, {@link merge}, {@link zip}, {@link race}
21
+ * - Control demand and timing: {@link take}, {@link drop}, {@link debounce}, {@link throttle}
22
+ * - Manage errors: {@link catchCause}, {@link catchIf}, {@link mapError}, {@link retry}
23
+ * - Manage resources and services: {@link scoped}, {@link ensuring}, {@link provide}
24
+ * - Consume streams: {@link runCollect}, {@link runForEach}, {@link runFold}, {@link runDrain}
25
+ *
26
+ * **Gotchas**
27
+ *
28
+ * - A stream is not a collection; constructors and operators build a description until it is run
29
+ * - Re-running a stream re-executes its effects unless it is explicitly shared or backed by external state
30
+ * - Operators such as {@link merge}, {@link race}, and {@link broadcast} introduce concurrency and interruption semantics
31
+ * - Prefer bounded constructors and sinks for large or infinite streams instead of collecting everything into memory
32
+ *
33
+ * **See also**
34
+ *
35
+ * - {@link Effect.Effect} for single-result effectful programs
36
+ * - {@link Sink.Sink} for consuming and folding streams
37
+ * - {@link Channel.Channel} for the lower-level primitive underlying streams
38
+ *
2
39
  * @since 2.0.0
3
40
  */
4
41
  // @effect-diagnostics returnEffectInGen:off
@@ -23,6 +60,7 @@ import * as MutableHashMap from "./MutableHashMap.js";
23
60
  import * as MutableList from "./MutableList.js";
24
61
  import * as Option from "./Option.js";
25
62
  import { hasProperty, isNotUndefined, isTagged } from "./Predicate.js";
63
+ import * as PubSub from "./PubSub.js";
26
64
  import * as Pull from "./Pull.js";
27
65
  import * as Queue from "./Queue.js";
28
66
  import * as RcMap from "./RcMap.js";
@@ -33,14 +71,18 @@ import * as Scope from "./Scope.js";
33
71
  import * as Sink from "./Sink.js";
34
72
  import { isString } from "./String.js";
35
73
  /**
36
- * @since 4.0.0
74
+ * Runtime identifier stored on `Stream` values and used by `isStream` to
75
+ * recognize them.
76
+ *
37
77
  * @category Type Identifiers
78
+ * @since 4.0.0
38
79
  */
39
80
  export const TypeId = "~effect/Stream";
40
81
  /**
41
82
  * Checks whether a value is a Stream.
42
83
  *
43
- * @example
84
+ * **Example** (Checking whether a value is a Stream)
85
+ *
44
86
  * ```ts
45
87
  * import { Console, Effect, Stream } from "effect"
46
88
  *
@@ -57,14 +99,15 @@ export const TypeId = "~effect/Stream";
57
99
  * Effect.runPromise(program)
58
100
  * ```
59
101
  *
60
- * @since 2.0.0
61
- * @category Guards
102
+ * @category guards
103
+ * @since 4.0.0
62
104
  */
63
105
  export const isStream = u => hasProperty(u, TypeId);
64
106
  /**
65
107
  * The default chunk size used by Stream constructors and combinators.
66
108
  *
67
- * @example
109
+ * **Example** (Reading the default chunk size)
110
+ *
68
111
  * ```ts
69
112
  * import { Console, Effect, Stream } from "effect"
70
113
  *
@@ -83,7 +126,8 @@ export const DefaultChunkSize = Channel.DefaultChunkSize;
83
126
  /**
84
127
  * Creates a stream from a array-emitting `Channel`.
85
128
  *
86
- * @example
129
+ * **Example** (Creating a stream from an array-emitting channel)
130
+ *
87
131
  * ```ts
88
132
  * import { Channel, Console, Effect, Stream } from "effect"
89
133
  *
@@ -97,15 +141,16 @@ export const DefaultChunkSize = Channel.DefaultChunkSize;
97
141
  * // Output: [ 1, 2, 3 ]
98
142
  * ```
99
143
  *
144
+ * @category constructors
100
145
  * @since 2.0.0
101
- * @category Constructors
102
146
  */
103
147
  export const fromChannel = internal.fromChannel;
104
148
  /**
105
149
  * Either emits the success value of this effect or terminates the stream
106
150
  * with the failure value of this effect.
107
151
  *
108
- * @example
152
+ * **Example** (Creating a stream from an effect)
153
+ *
109
154
  * ```ts
110
155
  * import { Console, Effect, Stream } from "effect"
111
156
  *
@@ -119,16 +164,17 @@ export const fromChannel = internal.fromChannel;
119
164
  * // Output: [ 42 ]
120
165
  * ```
121
166
  *
167
+ * @category constructors
122
168
  * @since 2.0.0
123
- * @category Constructors
124
169
  */
125
170
  export const fromEffect = effect => fromChannel(Channel.fromEffect(Effect.map(effect, Arr.of)));
126
171
  /**
127
172
  * Accesses a service from the context and emits it as a single element.
128
173
  *
129
- * @example
174
+ * **Example** (Accessing a service as a stream)
175
+ *
130
176
  * ```ts
131
- * import { Effect, Context, Stream } from "effect"
177
+ * import { Context, Effect, Stream } from "effect"
132
178
  *
133
179
  * class Greeter extends Context.Service<Greeter, {
134
180
  * readonly greet: (name: string) => string
@@ -151,17 +197,18 @@ export const fromEffect = effect => fromChannel(Channel.fromEffect(Effect.map(ef
151
197
  * // Output: [ "Hello, World!" ]
152
198
  * ```
153
199
  *
154
- * @since 4.0.0
155
200
  * @category Context
201
+ * @since 4.0.0
156
202
  */
157
203
  export const service = service => fromEffect(Effect.service(service));
158
204
  /**
159
205
  * Optionally accesses a service from the context and emits the result as a
160
206
  * single element.
161
207
  *
162
- * @example
208
+ * **Example** (Accessing an optional service as a stream)
209
+ *
163
210
  * ```ts
164
- * import { Effect, Option, Context, Stream } from "effect"
211
+ * import { Context, Effect, Option, Stream } from "effect"
165
212
  *
166
213
  * class Greeter extends Context.Service<Greeter, {
167
214
  * readonly greet: (name: string) => string
@@ -189,14 +236,15 @@ export const service = service => fromEffect(Effect.service(service));
189
236
  * // Output: [ "Hello, World!" ]
190
237
  * ```
191
238
  *
192
- * @since 4.0.0
193
239
  * @category Context
240
+ * @since 4.0.0
194
241
  */
195
242
  export const serviceOption = service => fromEffect(Effect.serviceOption(service));
196
243
  /**
197
244
  * Creates a stream that runs the effect and emits no elements.
198
245
  *
199
- * @example
246
+ * **Example** (Draining an effect into a stream)
247
+ *
200
248
  * ```ts
201
249
  * import { Console, Effect, Stream } from "effect"
202
250
  *
@@ -210,20 +258,15 @@ export const serviceOption = service => fromEffect(Effect.serviceOption(service)
210
258
  * // Output: Draining side effect
211
259
  * ```
212
260
  *
261
+ * @category constructors
213
262
  * @since 4.0.0
214
- * @category Constructors
215
263
  */
216
264
  export const fromEffectDrain = effect => fromPull(Effect.succeed(Effect.flatMap(effect, () => Cause.done())));
217
265
  /**
218
266
  * Creates a stream from an effect producing a value of type `A` which repeats forever.
219
267
  *
220
- * **Previously Known As**
221
- *
222
- * This API replaces the following from Effect 3.x:
268
+ * **Example** (Repeating an effect forever)
223
269
  *
224
- * - `Stream.repeatEffect`
225
- *
226
- * @example
227
270
  * ```ts
228
271
  * import { Console, Effect, Random, Stream } from "effect"
229
272
  *
@@ -239,21 +282,16 @@ export const fromEffectDrain = effect => fromPull(Effect.succeed(Effect.flatMap(
239
282
  * // Output: [ 3891571149, 4239494205, 2352981603, 2339111046, 1488052210 ]
240
283
  * ```
241
284
  *
285
+ * @category constructors
242
286
  * @since 4.0.0
243
- * @category Constructors
244
287
  */
245
288
  export const fromEffectRepeat = effect => fromPull(Effect.succeed(Effect.map(effect, Arr.of)));
246
289
  /**
247
290
  * Creates a stream from an effect producing a value of type `A`, which is
248
291
  * repeated using the specified schedule.
249
292
  *
250
- * **Previously Known As**
251
- *
252
- * This API replaces the following from Effect 3.x:
293
+ * **Example** (Repeating an effect with a schedule)
253
294
  *
254
- * - `Stream.repeatEffectWithSchedule`
255
- *
256
- * @example
257
295
  * ```ts
258
296
  * import { Console, Effect, Schedule, Stream } from "effect"
259
297
  *
@@ -270,8 +308,8 @@ export const fromEffectRepeat = effect => fromPull(Effect.succeed(Effect.map(eff
270
308
  * // Output: [ "ping", "ping", "ping" ]
271
309
  * ```
272
310
  *
273
- * @since 2.0.0
274
- * @category Constructors
311
+ * @category constructors
312
+ * @since 4.0.0
275
313
  */
276
314
  export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(function* () {
277
315
  const step = yield* Schedule.toStepWithMetadata(schedule);
@@ -290,9 +328,11 @@ export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(func
290
328
  });
291
329
  }));
292
330
  /**
293
- * Creates a stream that emits void values spaced by the specified duration.
331
+ * Creates a stream that emits `void` immediately once, then emits another
332
+ * `void` after each specified interval.
333
+ *
334
+ * **Example** (Emitting ticks on an interval)
294
335
  *
295
- * @example
296
336
  * ```ts
297
337
  * import { Console, Effect, Stream } from "effect"
298
338
  *
@@ -308,8 +348,8 @@ export const fromEffectSchedule = (effect, schedule) => fromPull(Effect.gen(func
308
348
  * // Output: [ undefined, undefined, undefined ]
309
349
  * ```
310
350
  *
351
+ * @category constructors
311
352
  * @since 2.0.0
312
- * @category Constructors
313
353
  */
314
354
  export const tick = interval => fromPull(Effect.sync(() => {
315
355
  let first = true;
@@ -329,7 +369,8 @@ export const tick = interval => fromPull(Effect.sync(() => {
329
369
  * A pull effect yields chunks on demand and completes when the upstream stream ends.
330
370
  * See `Stream.toPull` for a matching producer.
331
371
  *
332
- * @example
372
+ * **Example** (Creating a stream from a pull effect)
373
+ *
333
374
  * ```ts
334
375
  * import { Console, Effect, Stream } from "effect"
335
376
  *
@@ -347,14 +388,15 @@ export const tick = interval => fromPull(Effect.sync(() => {
347
388
  * // Output: [1, 2, 3]
348
389
  * ```
349
390
  *
391
+ * @category constructors
350
392
  * @since 2.0.0
351
- * @category Constructors
352
393
  */
353
394
  export const fromPull = pull => fromChannel(Channel.fromPull(pull));
354
395
  /**
355
396
  * Derive a stream by transforming its pull effect.
356
397
  *
357
- * @example
398
+ * **Example** (Transforming a pull effect)
399
+ *
358
400
  * ```ts
359
401
  * import { Console, Effect, Stream } from "effect"
360
402
  *
@@ -371,8 +413,8 @@ export const fromPull = pull => fromChannel(Channel.fromPull(pull));
371
413
  * // Output: [ 1, 2, 3 ]
372
414
  * ```
373
415
  *
416
+ * @category constructors
374
417
  * @since 4.0.0
375
- * @category Constructors
376
418
  */
377
419
  export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_, scope) => Effect.flatMap(Channel.toPullScoped(self.channel, scope), pull => f(pull, scope))));
378
420
  /**
@@ -381,7 +423,8 @@ export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_,
381
423
  * A forked scope is also provided to the transformation function, which is
382
424
  * closed once the resulting stream has finished processing.
383
425
  *
384
- * @example
426
+ * **Example** (Transforming a stream by effectfully transforming its pull effect)
427
+ *
385
428
  * ```ts
386
429
  * import { Console, Effect, Scope, Stream } from "effect"
387
430
  *
@@ -406,14 +449,15 @@ export const transformPull = (self, f) => fromChannel(Channel.fromTransform((_,
406
449
  * // Releasing scope
407
450
  * ```
408
451
  *
452
+ * @category constructors
409
453
  * @since 4.0.0
410
- * @category Constructors
411
454
  */
412
455
  export const transformPullBracket = (self, f) => fromChannel(Channel.fromTransformBracket((_, scope, forkedScope) => Effect.flatMap(Channel.toPullScoped(self.channel, scope), pull => f(pull, scope, forkedScope))));
413
456
  /**
414
457
  * Creates a channel from a stream.
415
458
  *
416
- * @example
459
+ * **Example** (Converting a stream to a channel)
460
+ *
417
461
  * ```ts
418
462
  * import { Channel, Console, Effect, Stream } from "effect"
419
463
  *
@@ -428,8 +472,8 @@ export const transformPullBracket = (self, f) => fromChannel(Channel.fromTransfo
428
472
  * // Output: [ 1, 2, 3 ]
429
473
  * ```
430
474
  *
475
+ * @category constructors
431
476
  * @since 2.0.0
432
- * @category Constructors
433
477
  */
434
478
  export const toChannel = stream => stream.channel;
435
479
  /**
@@ -442,16 +486,8 @@ export const toChannel = stream => stream.channel;
442
486
  * You can customize the buffer size and strategy by passing an object as the
443
487
  * second argument with the `bufferSize` and `strategy` fields.
444
488
  *
445
- * **Previously Known As**
489
+ * **Example** (Creating a stream from a callback that can emit values into a queue)
446
490
  *
447
- * This API replaces the following from Effect 3.x:
448
- *
449
- * - `Stream.async`
450
- * - `Stream.asyncEffect`
451
- * - `Stream.asyncPush`
452
- * - `Stream.asyncScoped`
453
- *
454
- * @example
455
491
  * ```ts
456
492
  * import { Console, Effect, Queue, Stream } from "effect"
457
493
  *
@@ -475,14 +511,15 @@ export const toChannel = stream => stream.channel;
475
511
  * Effect.runPromise(program)
476
512
  * ```
477
513
  *
478
- * @since 2.0.0
479
- * @category Constructors
514
+ * @category constructors
515
+ * @since 4.0.0
480
516
  */
481
517
  export const callback = (f, options) => fromChannel(Channel.callbackArray(f, options));
482
518
  /**
483
519
  * Creates an empty stream.
484
520
  *
485
- * @example
521
+ * **Example** (Creating an empty stream)
522
+ *
486
523
  * ```ts
487
524
  * import { Console, Effect, Stream } from "effect"
488
525
  *
@@ -495,14 +532,15 @@ export const callback = (f, options) => fromChannel(Channel.callbackArray(f, opt
495
532
  * // []
496
533
  * ```
497
534
  *
498
- * @since 4.0.0
499
- * @category Constructors
535
+ * @category constructors
536
+ * @since 2.0.0
500
537
  */
501
538
  export const empty = /*#__PURE__*/fromChannel(Channel.empty);
502
539
  /**
503
540
  * Creates a single-valued pure stream.
504
541
  *
505
- * @example
542
+ * **Example** (Creating a single-valued pure stream)
543
+ *
506
544
  * ```ts
507
545
  * import { Console, Effect, Stream } from "effect"
508
546
  *
@@ -515,14 +553,15 @@ export const empty = /*#__PURE__*/fromChannel(Channel.empty);
515
553
  * // [ 3 ]
516
554
  * ```
517
555
  *
556
+ * @category constructors
518
557
  * @since 2.0.0
519
- * @category Constructors
520
558
  */
521
559
  export const succeed = value => fromChannel(Channel.succeed(Arr.of(value)));
522
560
  /**
523
561
  * Creates a stream from a sequence of values.
524
562
  *
525
- * @example
563
+ * **Example** (Creating a stream from a sequence of values)
564
+ *
526
565
  * ```ts
527
566
  * import { Console, Effect, Stream } from "effect"
528
567
  *
@@ -536,8 +575,8 @@ export const succeed = value => fromChannel(Channel.succeed(Arr.of(value)));
536
575
  * Effect.runPromise(program)
537
576
  * ```
538
577
  *
578
+ * @category constructors
539
579
  * @since 2.0.0
540
- * @category Constructors
541
580
  */
542
581
  export const make = (...values) => fromArray(values);
543
582
  /**
@@ -545,7 +584,8 @@ export const make = (...values) => fromArray(values);
545
584
  *
546
585
  * The function is evaluated each time the stream is run.
547
586
  *
548
- * @example
587
+ * **Example** (Evaluating a value synchronously)
588
+ *
549
589
  * ```ts
550
590
  * import { Console, Effect, Stream } from "effect"
551
591
  *
@@ -558,8 +598,8 @@ export const make = (...values) => fromArray(values);
558
598
  * // Output: [ 3 ]
559
599
  * ```
560
600
  *
601
+ * @category constructors
561
602
  * @since 2.0.0
562
- * @category Constructors
563
603
  */
564
604
  export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate())));
565
605
  /**
@@ -567,7 +607,8 @@ export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate()
567
607
  *
568
608
  * The stream factory is evaluated each time the stream is run.
569
609
  *
570
- * @example
610
+ * **Example** (Creating a lazily constructed stream)
611
+ *
571
612
  * ```ts
572
613
  * import { Console, Effect, Stream } from "effect"
573
614
  *
@@ -580,14 +621,15 @@ export const sync = evaluate => fromChannel(Channel.sync(() => Arr.of(evaluate()
580
621
  * // Output: [ 1, 2, 3 ]
581
622
  * ```
582
623
  *
624
+ * @category constructors
583
625
  * @since 2.0.0
584
- * @category Constructors
585
626
  */
586
627
  export const suspend = stream => fromChannel(Channel.suspend(() => stream().channel));
587
628
  /**
588
629
  * Terminates with the specified error.
589
630
  *
590
- * @example
631
+ * **Example** (Failing a stream)
632
+ *
591
633
  * ```ts
592
634
  * import { Console, Effect, Stream } from "effect"
593
635
  *
@@ -601,14 +643,15 @@ export const suspend = stream => fromChannel(Channel.suspend(() => stream().chan
601
643
  * Effect.runPromise(program)
602
644
  * ```
603
645
  *
646
+ * @category constructors
604
647
  * @since 2.0.0
605
- * @category Constructors
606
648
  */
607
649
  export const fail = error => fromChannel(Channel.fail(error));
608
650
  /**
609
651
  * Terminates with the specified lazily evaluated error.
610
652
  *
611
- * @example
653
+ * **Example** (Failing a stream lazily)
654
+ *
612
655
  * ```ts
613
656
  * import { Console, Effect, Stream } from "effect"
614
657
  *
@@ -624,14 +667,15 @@ export const fail = error => fromChannel(Channel.fail(error));
624
667
  * // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Uh oh!' } }
625
668
  * ```
626
669
  *
670
+ * @category constructors
627
671
  * @since 2.0.0
628
- * @category Constructors
629
672
  */
630
673
  export const failSync = evaluate => fromChannel(Channel.failSync(evaluate));
631
674
  /**
632
675
  * Creates a stream that fails with the specified `Cause`.
633
676
  *
634
- * @example
677
+ * **Example** (Failing with a cause)
678
+ *
635
679
  * ```ts
636
680
  * import { Cause, Console, Effect, Stream } from "effect"
637
681
  *
@@ -648,14 +692,15 @@ export const failSync = evaluate => fromChannel(Channel.failSync(evaluate));
648
692
  * Effect.runPromise(program)
649
693
  * ```
650
694
  *
695
+ * @category constructors
651
696
  * @since 2.0.0
652
- * @category Constructors
653
697
  */
654
698
  export const failCause = cause => fromChannel(Channel.failCause(cause));
655
699
  /**
656
700
  * The stream that dies with the specified defect.
657
701
  *
658
- * @example
702
+ * **Example** (Dying with a defect)
703
+ *
659
704
  * ```ts
660
705
  * import { Cause, Console, Effect, Exit, Stream } from "effect"
661
706
  *
@@ -679,14 +724,15 @@ export const failCause = cause => fromChannel(Channel.failCause(cause));
679
724
  * // Output: Exit.Failure(Error: Boom)
680
725
  * ```
681
726
  *
727
+ * @category constructors
682
728
  * @since 2.0.0
683
- * @category Constructors
684
729
  */
685
730
  export const die = defect => fromChannel(Channel.die(defect));
686
731
  /**
687
732
  * The stream that always fails with the specified lazily evaluated `Cause`.
688
733
  *
689
- * @example
734
+ * **Example** (Failing with a lazy cause)
735
+ *
690
736
  * ```ts
691
737
  * import { Cause, Console, Effect, Stream } from "effect"
692
738
  *
@@ -704,8 +750,8 @@ export const die = defect => fromChannel(Channel.die(defect));
704
750
  * // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Connection timeout after retries' } }
705
751
  * ```
706
752
  *
753
+ * @category constructors
707
754
  * @since 2.0.0
708
- * @category Constructors
709
755
  */
710
756
  export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evaluate));
711
757
  /**
@@ -713,7 +759,8 @@ export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evalu
713
759
  *
714
760
  * The `maxChunkSize` parameter controls how many values are pulled per chunk.
715
761
  *
716
- * @example
762
+ * **Example** (Consuming values from an iterator)
763
+ *
717
764
  * ```ts
718
765
  * import { Console, Effect, Stream } from "effect"
719
766
  *
@@ -734,8 +781,8 @@ export const failCauseSync = evaluate => fromChannel(Channel.failCauseSync(evalu
734
781
  * // Output: [ 1, 2, 3 ]
735
782
  * ```
736
783
  *
784
+ * @category constructors
737
785
  * @since 2.0.0
738
- * @category Constructors
739
786
  */
740
787
  export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Channel.fromIteratorArray(() => iterator, maxChunkSize));
741
788
  /**
@@ -745,7 +792,8 @@ export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Chann
745
792
  *
746
793
  * - `chunkSize`: Maximum number of values emitted per chunk.
747
794
  *
748
- * @example
795
+ * **Example** (Creating a stream from an iterable)
796
+ *
749
797
  * ```ts
750
798
  * import { Console, Effect, Stream } from "effect"
751
799
  *
@@ -761,16 +809,17 @@ export const fromIteratorSucceed = (iterator, maxChunkSize) => fromChannel(Chann
761
809
  * // Output: [ 1, 2, 3 ]
762
810
  * ```
763
811
  *
812
+ * @category constructors
764
813
  * @since 2.0.0
765
- * @category Constructors
766
814
  */
767
815
  export const fromIterable = (iterable, options) => Array.isArray(iterable) && options?.chunkSize === undefined ? fromArray(iterable) : fromChannel(Channel.fromIterableArray(iterable, options?.chunkSize));
768
816
  /**
769
817
  * Creates a stream from an effect producing an iterable of values.
770
818
  *
771
- * @example
819
+ * **Example** (Creating a stream from an iterable effect)
820
+ *
772
821
  * ```ts
773
- * import { Console, Effect, Context, Stream } from "effect"
822
+ * import { Console, Context, Effect, Stream } from "effect"
774
823
  *
775
824
  * class UserRepo extends Context.Service<UserRepo, {
776
825
  * readonly list: Effect.Effect<ReadonlyArray<string>>
@@ -796,20 +845,15 @@ export const fromIterable = (iterable, options) => Array.isArray(iterable) && op
796
845
  * // Output: [ "user1", "user2" ]
797
846
  * ```
798
847
  *
848
+ * @category constructors
799
849
  * @since 2.0.0
800
- * @category Constructors
801
850
  */
802
851
  export const fromIterableEffect = iterable => unwrap(Effect.map(iterable, fromIterable));
803
852
  /**
804
853
  * Creates a stream by repeatedly running an effect that yields an iterable of values.
805
854
  *
806
- * **Previously Known As**
807
- *
808
- * This API replaces the following from Effect 3.x:
855
+ * **Example** (Repeating an iterable effect)
809
856
  *
810
- * - `Stream.repeatEffectChunk`
811
- *
812
- * @example
813
857
  * ```ts
814
858
  * import { Console, Effect, Stream } from "effect"
815
859
  *
@@ -825,20 +869,15 @@ export const fromIterableEffect = iterable => unwrap(Effect.map(iterable, fromIt
825
869
  * // Output: [ 1, 2, 1, 2, 1 ]
826
870
  * ```
827
871
  *
872
+ * @category constructors
828
873
  * @since 4.0.0
829
- * @category Constructors
830
874
  */
831
875
  export const fromIterableEffectRepeat = iterable => flatMap(fromEffectRepeat(iterable), fromIterable);
832
876
  /**
833
877
  * Creates a stream from an array of values.
834
878
  *
835
- * **Previously Known As**
836
- *
837
- * This API replaces the following from Effect 3.x:
879
+ * **Example** (Creating a stream from an array of values)
838
880
  *
839
- * - `Stream.fromChunk`
840
- *
841
- * @example
842
881
  * ```ts
843
882
  * import { Console, Effect, Stream } from "effect"
844
883
  *
@@ -852,14 +891,15 @@ export const fromIterableEffectRepeat = iterable => flatMap(fromEffectRepeat(ite
852
891
  * // Output: [ 1, 2, 3 ]
853
892
  * ```
854
893
  *
894
+ * @category constructors
855
895
  * @since 4.0.0
856
- * @category Constructors
857
896
  */
858
897
  export const fromArray = array => Arr.isReadonlyArrayNonEmpty(array) ? fromChannel(Channel.succeed(array)) : empty;
859
898
  /**
860
899
  * Creates a stream from an effect that produces an array of values.
861
900
  *
862
- * @example
901
+ * **Example** (Creating a stream from an effect that produces an array of values)
902
+ *
863
903
  * ```ts
864
904
  * import { Console, Effect, Stream } from "effect"
865
905
  *
@@ -873,20 +913,15 @@ export const fromArray = array => Arr.isReadonlyArrayNonEmpty(array) ? fromChann
873
913
  * // Output: [ "Ada", "Grace" ]
874
914
  * ```
875
915
  *
916
+ * @category constructors
876
917
  * @since 4.0.0
877
- * @category Constructors
878
918
  */
879
919
  export const fromArrayEffect = effect => unwrap(Effect.map(effect, fromArray));
880
920
  /**
881
921
  * Creates a stream from an arbitrary number of arrays.
882
922
  *
883
- * **Previously Known As**
923
+ * **Example** (Creating a stream from an arbitrary number of arrays)
884
924
  *
885
- * This API replaces the following from Effect 3.x:
886
- *
887
- * - `Stream.fromChunks`
888
- *
889
- * @example
890
925
  * ```ts
891
926
  * import { Console, Effect, Stream } from "effect"
892
927
  *
@@ -900,19 +935,18 @@ export const fromArrayEffect = effect => unwrap(Effect.map(effect, fromArray));
900
935
  * // Output: [ 1, 2, 3, 4 ]
901
936
  * ```
902
937
  *
938
+ * @category constructors
903
939
  * @since 4.0.0
904
- * @category Constructors
905
940
  */
906
941
  export const fromArrays = (...arrays) => fromChannel(Channel.fromArray(Arr.filter(arrays, Arr.isReadonlyArrayNonEmpty)));
907
942
  /**
908
- * Creates a stream from a queue of values.
943
+ * Creates a stream that pulls values from a `Queue.Dequeue`.
909
944
  *
910
- * **Options**
945
+ * The stream emits non-empty batches of queued values and ends when the queue
946
+ * fails with `Cause.Done`; other queue failures are propagated.
911
947
  *
912
- * - `maxChunkSize`: The maximum number of queued elements to put in one chunk in the stream
913
- * - `shutdown`: If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`)
948
+ * **Example** (Creating a stream from a queue of values)
914
949
  *
915
- * @example
916
950
  * ```ts
917
951
  * import { Console, Effect, Queue, Stream } from "effect"
918
952
  *
@@ -932,14 +966,15 @@ export const fromArrays = (...arrays) => fromChannel(Channel.fromArray(Arr.filte
932
966
  * // Output: [ 1, 2, 3 ]
933
967
  * ```
934
968
  *
935
- * @since 4.0.0
936
- * @category Constructors
969
+ * @category constructors
970
+ * @since 2.0.0
937
971
  */
938
972
  export const fromQueue = queue => fromChannel(Channel.fromQueueArray(queue));
939
973
  /**
940
974
  * Creates a stream from a subscription to a `PubSub`.
941
975
  *
942
- * @example
976
+ * **Example** (Creating a stream from a subscription to a PubSub)
977
+ *
943
978
  * ```ts
944
979
  * import { Console, Effect, Fiber, PubSub, Stream } from "effect"
945
980
  *
@@ -964,8 +999,8 @@ export const fromQueue = queue => fromChannel(Channel.fromQueueArray(queue));
964
999
  * // Output: [ 1, 2, 3 ]
965
1000
  * ```
966
1001
  *
967
- * @since 4.0.0
968
- * @category Constructors
1002
+ * @category constructors
1003
+ * @since 2.0.0
969
1004
  */
970
1005
  export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub));
971
1006
  /**
@@ -973,7 +1008,8 @@ export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub))
973
1008
  *
974
1009
  * `Take` values include end and failure signals.
975
1010
  *
976
- * @example
1011
+ * **Example** (Creating a stream from PubSub takes)
1012
+ *
977
1013
  * ```ts
978
1014
  * import { Console, Effect, Exit, PubSub, Stream, Take } from "effect"
979
1015
  *
@@ -994,16 +1030,19 @@ export const fromPubSub = pubsub => fromChannel(Channel.fromPubSubArray(pubsub))
994
1030
  * // Output: [ 1, 2 ]
995
1031
  * ```
996
1032
  *
1033
+ * @category constructors
997
1034
  * @since 4.0.0
998
- * @category Constructors
999
1035
  */
1000
1036
  export const fromPubSubTake = pubsub => fromChannel(Channel.fromPubSubTake(pubsub));
1001
1037
  /**
1002
- * Creates a stream from a `ReadableStream`.
1038
+ * Creates a stream from a lazily supplied Web `ReadableStream`.
1003
1039
  *
1004
- * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
1040
+ * The stream reads from a `ReadableStreamDefaultReader`, maps read failures
1041
+ * with `onError`, and closes the reader when the stream finalizes. By default
1042
+ * the reader is canceled; set `releaseLockOnEnd` to release the lock instead.
1043
+ *
1044
+ * **Example** (Creating a stream from a ReadableStream)
1005
1045
  *
1006
- * @example
1007
1046
  * ```ts
1008
1047
  * import { Console, Data, Effect, Stream } from "effect"
1009
1048
  *
@@ -1031,8 +1070,8 @@ export const fromPubSubTake = pubsub => fromChannel(Channel.fromPubSubTake(pubsu
1031
1070
  * // Output: [ 1, 2, 3 ]
1032
1071
  * ```
1033
1072
  *
1073
+ * @category constructors
1034
1074
  * @since 2.0.0
1035
- * @category Constructors
1036
1075
  */
1037
1076
  export const fromReadableStream = options => fromChannel(Channel.fromTransform(Effect.fnUntraced(function* (_, scope) {
1038
1077
  const reader = options.evaluate().getReader();
@@ -1048,9 +1087,10 @@ export const fromReadableStream = options => fromChannel(Channel.fromTransform(E
1048
1087
  /**
1049
1088
  * Creates a stream from an AsyncIterable.
1050
1089
  *
1051
- * @example
1090
+ * **Example** (Creating a stream from an AsyncIterable)
1091
+ *
1052
1092
  * ```ts
1053
- * import { Console, Data, Effect, Stream } from "effect"
1093
+ * import { Data, Effect, Stream } from "effect"
1054
1094
  *
1055
1095
  * class StreamError extends Data.TaggedError("StreamError")<{ readonly cause: unknown }> {}
1056
1096
  *
@@ -1060,25 +1100,25 @@ export const fromReadableStream = options => fromChannel(Channel.fromTransform(E
1060
1100
  * yield 3
1061
1101
  * })()
1062
1102
  *
1063
- * const program = Effect.gen(function*() {
1103
+ * Effect.runPromise(Effect.gen(function*() {
1064
1104
  * const stream = Stream.fromAsyncIterable(iterable, (cause) => new StreamError({ cause }))
1065
1105
  * const values = yield* Stream.runCollect(stream)
1066
- * yield* Console.log(values)
1067
- * })
1106
+ * yield* Effect.sync(() => console.log(values))
1107
+ * }))
1068
1108
  *
1069
- * Effect.runPromise(program)
1070
- * // Output: [ 1, 2, 3 ]
1109
+ * // [ 1, 2, 3 ]
1071
1110
  * ```
1072
1111
  *
1112
+ * @category constructors
1073
1113
  * @since 2.0.0
1074
- * @category Constructors
1075
1114
  */
1076
1115
  export const fromAsyncIterable = (iterable, onError) => fromChannel(Channel.fromAsyncIterableArray(iterable, onError));
1077
1116
  /**
1078
1117
  * Creates a stream that emits each output of a schedule that does not require input,
1079
1118
  * for as long as the schedule continues.
1080
1119
  *
1081
- * @example
1120
+ * **Example** (Creating a stream from a schedule)
1121
+ *
1082
1122
  * ```ts
1083
1123
  * import { Console, Effect, Schedule, Stream } from "effect"
1084
1124
  *
@@ -1095,8 +1135,8 @@ export const fromAsyncIterable = (iterable, onError) => fromChannel(Channel.from
1095
1135
  * // Output: [ 0, 1, 2 ]
1096
1136
  * ```
1097
1137
  *
1138
+ * @category constructors
1098
1139
  * @since 2.0.0
1099
- * @category Constructors
1100
1140
  */
1101
1141
  export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithSleep(schedule), step => Pull.catchDone(Effect.map(step(void 0), Arr.of), () => Cause.done())));
1102
1142
  /**
@@ -1105,7 +1145,8 @@ export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithS
1105
1145
  * Use `PubSub.subscribe` to create the subscription and `Stream.take` or
1106
1146
  * cancellation to control how many values are consumed.
1107
1147
  *
1108
- * @example
1148
+ * **Example** (Creating a stream from a PubSub subscription)
1149
+ *
1109
1150
  * ```ts
1110
1151
  * import { Console, Effect, PubSub, Stream } from "effect"
1111
1152
  *
@@ -1125,33 +1166,42 @@ export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithS
1125
1166
  * // Output: [ 1, 2 ]
1126
1167
  * ```
1127
1168
  *
1169
+ * @category constructors
1128
1170
  * @since 4.0.0
1129
- * @category Constructors
1130
1171
  */
1131
1172
  export const fromSubscription = pubsub => fromChannel(Channel.fromSubscriptionArray(pubsub));
1132
1173
  /**
1133
1174
  * Creates a stream from an event listener.
1134
1175
  *
1135
- * @example
1176
+ * **Example** (Creating a stream from an event listener)
1177
+ *
1136
1178
  * ```ts
1137
- * import { Console, Effect, Stream } from "effect"
1179
+ * import { Effect, Stream } from "effect"
1138
1180
  *
1139
- * declare const target: Stream.EventListener<number>
1181
+ * class NumberTarget implements Stream.EventListener<number> {
1182
+ * addEventListener(event: string, f: (event: number) => void) {
1183
+ * if (event === "data") {
1184
+ * f(1)
1185
+ * f(2)
1186
+ * f(3)
1187
+ * }
1188
+ * }
1189
+ * removeEventListener(_event: string, _f: (event: number) => void) {}
1190
+ * }
1140
1191
  *
1141
- * const program = Effect.gen(function*() {
1142
- * const stream = Stream.fromEventListener(target, "data").pipe(
1192
+ * Effect.runPromise(Effect.gen(function*() {
1193
+ * const stream = Stream.fromEventListener(new NumberTarget(), "data").pipe(
1143
1194
  * Stream.take(3)
1144
1195
  * )
1145
1196
  * const values = yield* Stream.runCollect(stream)
1146
- * yield* Console.log(values)
1147
- * })
1197
+ * yield* Effect.sync(() => console.log(values))
1198
+ * }))
1148
1199
  *
1149
- * Effect.runPromise(program)
1150
- * // Output: [ 1, 2, 3 ]
1200
+ * // [ 1, 2, 3 ]
1151
1201
  * ```
1152
1202
  *
1203
+ * @category constructors
1153
1204
  * @since 3.1.0
1154
- * @category Constructors
1155
1205
  */
1156
1206
  export const fromEventListener = (target, type, options) => callback(queue => {
1157
1207
  function emit(event) {
@@ -1162,9 +1212,14 @@ export const fromEventListener = (target, type, options) => callback(queue => {
1162
1212
  bufferSize: typeof options === "object" ? options.bufferSize : undefined
1163
1213
  });
1164
1214
  /**
1165
- * Creates a stream by peeling off successive layers of a state value.
1215
+ * Creates a stream by repeatedly applying an effectful step function to a
1216
+ * state.
1217
+ *
1218
+ * Each `readonly [value, nextState]` result emits `value` and continues with
1219
+ * `nextState`; returning `undefined` ends the stream.
1220
+ *
1221
+ * **Example** (Unfolding stream state)
1166
1222
  *
1167
- * @example
1168
1223
  * ```ts
1169
1224
  * import { Console, Effect, Stream } from "effect"
1170
1225
  *
@@ -1178,8 +1233,8 @@ export const fromEventListener = (target, type, options) => callback(queue => {
1178
1233
  * // Output: [ 1, 2, 3, 4, 5 ]
1179
1234
  * ```
1180
1235
  *
1236
+ * @category constructors
1181
1237
  * @since 2.0.0
1182
- * @category Constructors
1183
1238
  */
1184
1239
  export const unfold = (s, f) => fromPull(Effect.sync(() => {
1185
1240
  let state = s;
@@ -1194,10 +1249,10 @@ export const unfold = (s, f) => fromPull(Effect.sync(() => {
1194
1249
  * than the unfolding of the state. This is useful for embedding paginated APIs,
1195
1250
  * hence the name.
1196
1251
  *
1197
- * @example
1252
+ * **Example** (Paginating stream state)
1253
+ *
1198
1254
  * ```ts
1199
- * import { Console, Effect, Stream } from "effect"
1200
- * import * as Option from "effect/Option"
1255
+ * import { Console, Effect, Option, Stream } from "effect"
1201
1256
  *
1202
1257
  * const stream = Stream.paginate(0, (n: number) =>
1203
1258
  * Effect.succeed(
@@ -1211,8 +1266,8 @@ export const unfold = (s, f) => fromPull(Effect.sync(() => {
1211
1266
  * // Output: [ 0, 1, 2, 3 ]
1212
1267
  * ```
1213
1268
  *
1269
+ * @category constructors
1214
1270
  * @since 2.0.0
1215
- * @category Constructors
1216
1271
  */
1217
1272
  export const paginate = (s, f) => fromPull(Effect.sync(() => {
1218
1273
  let state = s;
@@ -1233,7 +1288,8 @@ export const paginate = (s, f) => fromPull(Effect.sync(() => {
1233
1288
  /**
1234
1289
  * Creates an infinite stream by repeatedly applying a function to a seed value.
1235
1290
  *
1236
- * @example
1291
+ * **Example** (Iterating from a seed value)
1292
+ *
1237
1293
  * ```ts
1238
1294
  * import { Console, Effect, Stream } from "effect"
1239
1295
  *
@@ -1248,8 +1304,8 @@ export const paginate = (s, f) => fromPull(Effect.sync(() => {
1248
1304
  * // Output: [ 1, 2, 3 ]
1249
1305
  * ```
1250
1306
  *
1307
+ * @category constructors
1251
1308
  * @since 2.0.0
1252
- * @category Constructors
1253
1309
  */
1254
1310
  export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, next(a)]));
1255
1311
  /**
@@ -1258,7 +1314,8 @@ export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, ne
1258
1314
  * If the provided `min` is greater than `max`, the stream will not emit any
1259
1315
  * values.
1260
1316
  *
1261
- * @example
1317
+ * **Example** (Creating a numeric range)
1318
+ *
1262
1319
  * ```ts
1263
1320
  * import { Console, Effect, Stream } from "effect"
1264
1321
  *
@@ -1270,8 +1327,8 @@ export const iterate = (value, next) => unfold(value, a => Effect.succeed([a, ne
1270
1327
  * Effect.runPromise(program)
1271
1328
  * // Output: [ 1, 2, 3, 4, 5 ]
1272
1329
  * ```
1273
- * @since 4.0.0
1274
- * @category Constructors
1330
+ * @category constructors
1331
+ * @since 2.0.0
1275
1332
  */
1276
1333
  export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > max ? empty : fromPull(Effect.sync(() => {
1277
1334
  let start = min;
@@ -1292,7 +1349,8 @@ export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > m
1292
1349
  /**
1293
1350
  * The stream that never produces any value or fails with any error.
1294
1351
  *
1295
- * @example
1352
+ * **Example** (Creating a never-ending stream)
1353
+ *
1296
1354
  * ```ts
1297
1355
  * import { Effect, Stream } from "effect"
1298
1356
  *
@@ -1305,14 +1363,15 @@ export const range = (min, max, chunkSize = Channel.DefaultChunkSize) => min > m
1305
1363
  * // []
1306
1364
  * ```
1307
1365
  *
1308
- * @since 4.0.0
1309
- * @category Constructors
1366
+ * @category constructors
1367
+ * @since 2.0.0
1310
1368
  */
1311
1369
  export const never = /*#__PURE__*/fromChannel(Channel.never);
1312
1370
  /**
1313
1371
  * Creates a stream produced from an `Effect`.
1314
1372
  *
1315
- * @example
1373
+ * **Example** (Unwrapping a stream effect)
1374
+ *
1316
1375
  * ```ts
1317
1376
  * import { Console, Effect, Stream } from "effect"
1318
1377
  *
@@ -1327,15 +1386,16 @@ export const never = /*#__PURE__*/fromChannel(Channel.never);
1327
1386
  * // [1, 2, 3]
1328
1387
  * ```
1329
1388
  *
1389
+ * @category constructors
1330
1390
  * @since 2.0.0
1331
- * @category Constructors
1332
1391
  */
1333
1392
  export const unwrap = effect => fromChannel(Channel.unwrap(Effect.map(effect, toChannel)));
1334
1393
  /**
1335
1394
  * Runs a stream that requires `Scope` in a managed scope, ensuring its
1336
1395
  * finalizers are run when the stream completes.
1337
1396
  *
1338
- * @example
1397
+ * **Example** (Scoping a stream)
1398
+ *
1339
1399
  * ```ts
1340
1400
  * import { Console, Effect, Stream } from "effect"
1341
1401
  *
@@ -1354,14 +1414,15 @@ export const unwrap = effect => fromChannel(Channel.unwrap(Effect.map(effect, to
1354
1414
  * // [ "resource" ]
1355
1415
  * ```
1356
1416
  *
1417
+ * @category constructors
1357
1418
  * @since 2.0.0
1358
- * @category Constructors
1359
1419
  */
1360
1420
  export const scoped = self => fromChannel(Channel.scoped(self.channel));
1361
1421
  /**
1362
1422
  * Transforms the elements of this stream using the supplied function.
1363
1423
  *
1364
- * @example
1424
+ * **Example** (Mapping stream values)
1425
+ *
1365
1426
  * ```ts
1366
1427
  * import { Console, Effect, Stream } from "effect"
1367
1428
  *
@@ -1374,8 +1435,8 @@ export const scoped = self => fromChannel(Channel.scoped(self.channel));
1374
1435
  * // [ 1, 3, 5 ]
1375
1436
  * ```
1376
1437
  *
1438
+ * @category mapping
1377
1439
  * @since 2.0.0
1378
- * @category Mapping
1379
1440
  */
1380
1441
  export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
1381
1442
  let i = 0;
@@ -1384,7 +1445,8 @@ export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
1384
1445
  /**
1385
1446
  * Maps both the failure and success channels of a stream.
1386
1447
  *
1387
- * @example
1448
+ * **Example** (Mapping both the failure and success channels of a stream)
1449
+ *
1388
1450
  * ```ts
1389
1451
  * import { Console, Effect, Stream } from "effect"
1390
1452
  *
@@ -1413,20 +1475,15 @@ export const map = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
1413
1475
  * // Output: [ "error: boom" ]
1414
1476
  * ```
1415
1477
  *
1478
+ * @category mapping
1416
1479
  * @since 2.0.0
1417
- * @category Mapping
1418
1480
  */
1419
1481
  export const mapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(map(options.onSuccess), mapError(options.onFailure)));
1420
1482
  /**
1421
1483
  * Transforms each emitted chunk using the provided function, which receives the chunk and its index.
1422
1484
  *
1423
- * **Previously Known As**
1424
- *
1425
- * This API replaces the following from Effect 3.x:
1485
+ * **Example** (Mapping stream chunks)
1426
1486
  *
1427
- * - `Stream.mapChunks`
1428
- *
1429
- * @example
1430
1487
  * ```ts
1431
1488
  * import { Array, Console, Effect, Stream } from "effect"
1432
1489
  *
@@ -1443,14 +1500,15 @@ export const mapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(map(opt
1443
1500
  * // Output: [ 1, 2, 4, 5 ]
1444
1501
  * ```
1445
1502
  *
1446
- * @since 2.0.0
1447
- * @category Mapping
1503
+ * @category mapping
1504
+ * @since 4.0.0
1448
1505
  */
1449
1506
  export const mapArray = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.map(self.channel, f)));
1450
1507
  /**
1451
1508
  * Maps over elements of the stream with the specified effectful function.
1452
1509
  *
1453
- * @example
1510
+ * **Example** (Effectfully mapping stream values)
1511
+ *
1454
1512
  * ```ts
1455
1513
  * import { Console, Effect, Stream } from "effect"
1456
1514
  *
@@ -1478,14 +1536,15 @@ export const mapArray = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.ma
1478
1536
  * // [2, 4, 6]
1479
1537
  * ```
1480
1538
  *
1539
+ * @category mapping
1481
1540
  * @since 2.0.0
1482
- * @category Mapping
1483
1541
  */
1484
1542
  export const mapEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.mapEffect(f, options), Channel.map(Arr.of), fromChannel));
1485
1543
  /**
1486
1544
  * Flattens a stream of `Effect` values into a stream of their results.
1487
1545
  *
1488
- * @example
1546
+ * **Example** (Flattening a stream of Effect values into a stream of their results)
1547
+ *
1489
1548
  * ```ts
1490
1549
  * import { Console, Effect, Stream } from "effect"
1491
1550
  *
@@ -1500,20 +1559,15 @@ export const mapEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, f,
1500
1559
  * // Output: [1, 2, 3]
1501
1560
  * ```
1502
1561
  *
1562
+ * @category mapping
1503
1563
  * @since 2.0.0
1504
- * @category Mapping
1505
1564
  */
1506
1565
  export const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => mapEffect(self, identity, options));
1507
1566
  /**
1508
1567
  * Effectfully maps over non-empty array chunks emitted by the stream.
1509
1568
  *
1510
- * **Previously Known As**
1511
- *
1512
- * This API replaces the following from Effect 3.x:
1569
+ * **Example** (Effectfully mapping stream chunks)
1513
1570
  *
1514
- * - `Stream.mapChunksEffect`
1515
- *
1516
- * @example
1517
1571
  * ```ts
1518
1572
  * import { Array, Console, Effect, Stream } from "effect"
1519
1573
  *
@@ -1532,8 +1586,8 @@ export const flattenEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self,
1532
1586
  * // Output: [1, 2, 13, 14]
1533
1587
  * ```
1534
1588
  *
1589
+ * @category mapping
1535
1590
  * @since 4.0.0
1536
- * @category Mapping
1537
1591
  */
1538
1592
  export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.mapEffect(self.channel, f)));
1539
1593
  /**
@@ -1541,13 +1595,8 @@ export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chan
1541
1595
  *
1542
1596
  * The stream ends after the first failure, emitting a `Result.fail` value.
1543
1597
  *
1544
- * **Previously Known As:**
1545
- *
1546
- * This API replaces the following from Effect 3.x:
1598
+ * **Example** (Converting failures to results)
1547
1599
  *
1548
- * - `Stream.either`
1549
- *
1550
- * @example
1551
1600
  * ```ts
1552
1601
  * import { Console, Effect, Result, Stream } from "effect"
1553
1602
  *
@@ -1568,14 +1617,15 @@ export const mapArrayEffect = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chan
1568
1617
  * // Output: [ "success: 1", "success: 2", "failure: boom" ]
1569
1618
  * ```
1570
1619
  *
1620
+ * @category error handling
1571
1621
  * @since 4.0.0
1572
- * @category Error Handling
1573
1622
  */
1574
1623
  export const result = self => self.pipe(map(Result.succeed), catch_(e => succeed(Result.fail(e))));
1575
1624
  /**
1576
1625
  * Runs the provided effect for each element while preserving the elements.
1577
1626
  *
1578
- * @example
1627
+ * **Example** (Tapping stream values)
1628
+ *
1579
1629
  * ```ts
1580
1630
  * import { Console, Effect, Stream } from "effect"
1581
1631
  *
@@ -1601,14 +1651,15 @@ export const result = self => self.pipe(map(Result.succeed), catch_(e => succeed
1601
1651
  * // [ 2, 4, 6 ]
1602
1652
  * ```
1603
1653
  *
1654
+ * @category sequencing
1604
1655
  * @since 2.0.0
1605
- * @category Sequencing
1606
1656
  */
1607
1657
  export const tap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => mapEffect(self, a => Effect.as(f(a), a), options));
1608
1658
  /**
1609
1659
  * Returns a stream that effectfully "peeks" at elements and failures.
1610
1660
  *
1611
- * @example
1661
+ * **Example** (Tapping values and errors)
1662
+ *
1612
1663
  * ```ts
1613
1664
  * import { Console, Effect, Stream } from "effect"
1614
1665
  *
@@ -1633,8 +1684,8 @@ export const tap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, option
1633
1684
  * // [ 1, 2, 3 ]
1634
1685
  * ```
1635
1686
  *
1687
+ * @category sequencing
1636
1688
  * @since 2.0.0
1637
- * @category Sequencing
1638
1689
  */
1639
1690
  export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapError(options.onError), tap(options.onElement, {
1640
1691
  concurrency: options.concurrency
@@ -1643,7 +1694,8 @@ export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapErro
1643
1694
  * Sends all elements emitted by this stream to the specified sink in addition
1644
1695
  * to emitting them.
1645
1696
  *
1646
- * @example
1697
+ * **Example** (Tapping values with a sink)
1698
+ *
1647
1699
  * ```ts
1648
1700
  * import { Console, Effect, Ref, Sink, Stream } from "effect"
1649
1701
  *
@@ -1666,8 +1718,8 @@ export const tapBoth = /*#__PURE__*/dual(2, (self, options) => self.pipe(tapErro
1666
1718
  * // Output: [1, 2, 3]
1667
1719
  * ```
1668
1720
  *
1721
+ * @category sequencing
1669
1722
  * @since 2.0.0
1670
- * @category Sequencing
1671
1723
  */
1672
1724
  export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket(self, Effect.fnUntraced(function* (pull, _, scope) {
1673
1725
  const upstreamLatch = Latch.makeUnsafe();
@@ -1713,9 +1765,15 @@ export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket
1713
1765
  });
1714
1766
  })));
1715
1767
  /**
1716
- * Maps each element to a stream and concatenates the results in order.
1768
+ * Maps each element to a stream and flattens the resulting streams.
1769
+ *
1770
+ * With the default sequential concurrency, inner streams are concatenated in
1771
+ * input order. When `concurrency` is greater than `1` or `"unbounded"`,
1772
+ * multiple inner streams may run at the same time and their outputs are merged
1773
+ * as they arrive.
1774
+ *
1775
+ * **Example** (FlatMapping stream values)
1717
1776
  *
1718
- * @example
1719
1777
  * ```ts
1720
1778
  * import { Console, Effect, Stream } from "effect"
1721
1779
  *
@@ -1731,15 +1789,16 @@ export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket
1731
1789
  * // Output: [ 1, 2, 2, 4, 3, 6 ]
1732
1790
  * ```
1733
1791
  *
1792
+ * @category mapping
1734
1793
  * @since 2.0.0
1735
- * @category Mapping
1736
1794
  */
1737
1795
  export const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.flatMap(a => f(a).channel, options), fromChannel));
1738
1796
  /**
1739
1797
  * Switches to the latest stream produced by the mapping function, interrupting
1740
1798
  * the previous stream when a new element arrives.
1741
1799
  *
1742
- * @example
1800
+ * **Example** (Switching to the latest stream)
1801
+ *
1743
1802
  * ```ts
1744
1803
  * import { Console, Effect, Stream } from "effect"
1745
1804
  *
@@ -1755,15 +1814,20 @@ export const flatMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
1755
1814
  * })
1756
1815
  * ```
1757
1816
  *
1817
+ * @category sequencing
1758
1818
  * @since 4.0.0
1759
- * @category Sequencing
1760
1819
  */
1761
1820
  export const switchMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => self.channel.pipe(Channel.flattenArray, Channel.switchMap(a => f(a).channel, options), fromChannel));
1762
1821
  /**
1763
- * Flattens a stream of streams into a single stream by concatenating the
1764
- * inner streams in strict order.
1822
+ * Flattens a stream of streams into a single stream.
1823
+ *
1824
+ * With the default sequential concurrency, inner streams are concatenated in
1825
+ * strict order. When `concurrency` is greater than `1` or `"unbounded"`,
1826
+ * multiple inner streams may run at the same time and their outputs are merged
1827
+ * as they arrive.
1828
+ *
1829
+ * **Example** (Flattening nested streams)
1765
1830
  *
1766
- * @example
1767
1831
  * ```ts
1768
1832
  * import { Console, Effect, Stream } from "effect"
1769
1833
  *
@@ -1782,20 +1846,15 @@ export const switchMap = /*#__PURE__*/dual(args => isStream(args[0]), (self, f,
1782
1846
  * // Output: [ 1, 2, 3, 4, 5, 6 ]
1783
1847
  * ```
1784
1848
  *
1849
+ * @category mapping
1785
1850
  * @since 2.0.0
1786
- * @category Mapping
1787
1851
  */
1788
1852
  export const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => flatMap(self, identity, options));
1789
1853
  /**
1790
1854
  * Flattens a stream of non-empty arrays into a stream of elements.
1791
1855
  *
1792
- * **Previously Known As**
1793
- *
1794
- * This API replaces the following from Effect 3.x:
1856
+ * **Example** (Flattening a stream of non-empty arrays into a stream of elements)
1795
1857
  *
1796
- * - `Stream.flattenChunks`
1797
- *
1798
- * @example
1799
1858
  * ```ts
1800
1859
  * import { Array, Console, Effect, Stream } from "effect"
1801
1860
  *
@@ -1810,14 +1869,15 @@ export const flatten = /*#__PURE__*/dual(args => isStream(args[0]), (self, optio
1810
1869
  * // Output: [ 1, 2, 3 ]
1811
1870
  * ```
1812
1871
  *
1872
+ * @category sequencing
1813
1873
  * @since 4.0.0
1814
- * @category Sequencing
1815
1874
  */
1816
1875
  export const flattenArray = self => fromChannel(Channel.flattenArray(self.channel));
1817
1876
  /**
1818
1877
  * Converts this stream to one that runs its effects but emits no elements.
1819
1878
  *
1820
- * @example
1879
+ * **Example** (Draining stream values)
1880
+ *
1821
1881
  * ```ts
1822
1882
  * import { Console, Effect, Stream } from "effect"
1823
1883
  *
@@ -1830,15 +1890,16 @@ export const flattenArray = self => fromChannel(Channel.flattenArray(self.channe
1830
1890
  * // Output: []
1831
1891
  * ```
1832
1892
  *
1893
+ * @category sequencing
1833
1894
  * @since 2.0.0
1834
- * @category Sequencing
1835
1895
  */
1836
1896
  export const drain = self => fromChannel(Channel.drain(self.channel));
1837
1897
  /**
1838
1898
  * Runs the provided stream in the background while this stream runs, interrupting it
1839
1899
  * when this stream completes and failing if the background stream fails or defects.
1840
1900
  *
1841
- * @example
1901
+ * **Example** (Draining a stream in the background)
1902
+ *
1842
1903
  * ```ts
1843
1904
  * import { Console, Effect, Stream } from "effect"
1844
1905
  *
@@ -1858,14 +1919,15 @@ export const drain = self => fromChannel(Channel.drain(self.channel));
1858
1919
  * // Output: [ 1, 2 ]
1859
1920
  * ```
1860
1921
  *
1922
+ * @category sequencing
1861
1923
  * @since 2.0.0
1862
- * @category Sequencing
1863
1924
  */
1864
1925
  export const drainFork = /*#__PURE__*/dual(2, (self, that) => mergeEffect(self, runDrain(that)));
1865
1926
  /**
1866
1927
  * Repeats the entire stream according to the provided schedule.
1867
1928
  *
1868
- * @example
1929
+ * **Example** (Repeating a stream on a schedule)
1930
+ *
1869
1931
  * ```ts
1870
1932
  * import { Console, Effect, Schedule, Stream } from "effect"
1871
1933
  *
@@ -1882,14 +1944,15 @@ export const drainFork = /*#__PURE__*/dual(2, (self, that) => mergeEffect(self,
1882
1944
  * // Output: [ 1, 1, 1, 1, 1 ]
1883
1945
  * ```
1884
1946
  *
1947
+ * @category sequencing
1885
1948
  * @since 2.0.0
1886
- * @category Sequencing
1887
1949
  */
1888
1950
  export const repeat = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Channel.repeat(self.channel, schedule)));
1889
1951
  /**
1890
1952
  * Spaces the stream's elements according to the provided `schedule`.
1891
1953
  *
1892
- * @example
1954
+ * **Example** (Scheduling stream elements)
1955
+ *
1893
1956
  * ```ts
1894
1957
  * import { Console, Effect, Schedule, Stream } from "effect"
1895
1958
  *
@@ -1906,14 +1969,15 @@ export const repeat = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Chann
1906
1969
  * // Output: [ 1, 2, 3 ]
1907
1970
  * ```
1908
1971
  *
1909
- * @since 2.0.0
1910
1972
  * @category Rate Limiting
1973
+ * @since 2.0.0
1911
1974
  */
1912
1975
  export const schedule = /*#__PURE__*/dual(2, (self, schedule) => self.channel.pipe(Channel.flattenArray, Channel.schedule(schedule), Channel.map(Arr.of), fromChannel));
1913
1976
  /**
1914
1977
  * Ends the stream if it does not produce a value within the specified duration.
1915
1978
  *
1916
- * @example
1979
+ * **Example** (Timing out a stream)
1980
+ *
1917
1981
  * ```ts
1918
1982
  * import { Console, Effect, Stream } from "effect"
1919
1983
  *
@@ -1930,16 +1994,23 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => self.channel.pi
1930
1994
  * // Output: [ 1 ]
1931
1995
  * ```
1932
1996
  *
1933
- * @since 2.0.0
1934
1997
  * @category Rate Limiting
1998
+ * @since 2.0.0
1935
1999
  */
1936
2000
  export const timeout = /*#__PURE__*/dual(2, (self, duration) => timeoutOrElse(self, {
1937
2001
  duration,
1938
2002
  orElse: () => empty
1939
2003
  }));
1940
2004
  /**
1941
- * @since 2.0.0
2005
+ * Switches to a fallback stream if this stream does not emit a value within
2006
+ * the specified duration.
2007
+ *
2008
+ * The timeout is checked for each pull. A zero duration uses `orElse`
2009
+ * immediately, while an infinite duration leaves the original stream
2010
+ * unchanged.
2011
+ *
1942
2012
  * @category Rate Limiting
2013
+ * @since 4.0.0
1943
2014
  */
1944
2015
  export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
1945
2016
  const duration = Duration.fromInputUnsafe(options.duration);
@@ -1983,9 +2054,8 @@ export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
1983
2054
  * Repeats each element of the stream according to the provided schedule,
1984
2055
  * including the original emission.
1985
2056
  *
1986
- * @since 2.0.0
1987
- * @category Sequencing
1988
- * @example
2057
+ * **Example** (Repeating stream elements)
2058
+ *
1989
2059
  * ```ts
1990
2060
  * import { Console, Effect, Schedule, Stream } from "effect"
1991
2061
  *
@@ -2000,6 +2070,9 @@ export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => {
2000
2070
  * Effect.runPromise(program)
2001
2071
  * // Output: [ "A", "A", "B", "B", "C", "C" ]
2002
2072
  * ```
2073
+ *
2074
+ * @category sequencing
2075
+ * @since 2.0.0
2003
2076
  */
2004
2077
  export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChannel(Channel.fromTransform((upstream, scope) => Effect.map(Channel.toTransform(Channel.flattenArray(self.channel))(upstream, scope), pullElement => {
2005
2078
  let pullRepeat = undefined;
@@ -2018,7 +2091,8 @@ export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChann
2018
2091
  /**
2019
2092
  * Repeats this stream forever.
2020
2093
  *
2021
- * @example
2094
+ * **Example** (Repeating a stream forever)
2095
+ *
2022
2096
  * ```ts
2023
2097
  * import { Console, Effect, Stream } from "effect"
2024
2098
  *
@@ -2036,20 +2110,15 @@ export const repeatElements = /*#__PURE__*/dual(2, (self, schedule) => fromChann
2036
2110
  * // Output: [ "A", "B", "A", "B", "A" ]
2037
2111
  * ```
2038
2112
  *
2113
+ * @category sequencing
2039
2114
  * @since 2.0.0
2040
- * @category Sequencing
2041
2115
  */
2042
2116
  export const forever = self => fromChannel(Channel.forever(self.channel));
2043
2117
  /**
2044
2118
  * Submerges the iterables emitted by this stream into the stream's structure.
2045
2119
  *
2046
- * **Previously Known As**
2047
- *
2048
- * This API replaces the following from Effect 3.x:
2120
+ * **Example** (Flattening iterable values)
2049
2121
  *
2050
- * - `Stream.flattenIterables`
2051
- *
2052
- * @example
2053
2122
  * ```ts
2054
2123
  * import { Console, Effect, Stream } from "effect"
2055
2124
  *
@@ -2063,15 +2132,16 @@ export const forever = self => fromChannel(Channel.forever(self.channel));
2063
2132
  * // Output: [ 1, 2, 3, 4 ]
2064
2133
  * ```
2065
2134
  *
2135
+ * @category mapping
2066
2136
  * @since 4.0.0
2067
- * @category Mapping
2068
2137
  */
2069
2138
  export const flattenIterable = self => flatMap(self, fromIterable);
2070
2139
  /**
2071
2140
  * Unwraps `Take` values, emitting elements from non-empty arrays and ending or
2072
2141
  * failing when the `Exit` signals completion.
2073
2142
  *
2074
- * @example
2143
+ * **Example** (Flattening Take values)
2144
+ *
2075
2145
  * ```ts
2076
2146
  * import { Array, Console, Effect, Exit, Stream } from "effect"
2077
2147
  *
@@ -2090,15 +2160,16 @@ export const flattenIterable = self => flatMap(self, fromIterable);
2090
2160
  * // Output: [ 1, 2, 3 ]
2091
2161
  * ```
2092
2162
  *
2093
- * @since 4.0.0
2094
- * @category Sequencing
2163
+ * @category sequencing
2164
+ * @since 2.0.0
2095
2165
  */
2096
2166
  export const flattenTake = self => self.channel.pipe(Channel.flattenArray, Channel.flattenTake, fromChannel);
2097
2167
  /**
2098
2168
  * Concatenates two streams, emitting all elements from the first stream
2099
2169
  * followed by all elements from the second stream.
2100
2170
  *
2101
- * @example
2171
+ * **Example** (Concatenating streams)
2172
+ *
2102
2173
  * ```ts
2103
2174
  * import { Console, Effect, Stream } from "effect"
2104
2175
  *
@@ -2111,14 +2182,15 @@ export const flattenTake = self => self.channel.pipe(Channel.flattenArray, Chann
2111
2182
  * // Output: [ 1, 2, 3, 4, 5, 6 ]
2112
2183
  * ```
2113
2184
  *
2185
+ * @category sequencing
2114
2186
  * @since 2.0.0
2115
- * @category Sequencing
2116
2187
  */
2117
2188
  export const concat = /*#__PURE__*/dual(2, (self, that) => flatten(fromArray([self, that])));
2118
2189
  /**
2119
2190
  * Prepends the values from the provided iterable before the stream's elements.
2120
2191
  *
2121
- * @example
2192
+ * **Example** (Prepending values)
2193
+ *
2122
2194
  * ```ts
2123
2195
  * import { Console, Effect, Stream } from "effect"
2124
2196
  *
@@ -2135,8 +2207,8 @@ export const concat = /*#__PURE__*/dual(2, (self, that) => flatten(fromArray([se
2135
2207
  * Effect.runPromise(program)
2136
2208
  * ```
2137
2209
  *
2210
+ * @category sequencing
2138
2211
  * @since 2.0.0
2139
- * @category Sequencing
2140
2212
  */
2141
2213
  export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterable(values), self));
2142
2214
  /**
@@ -2145,7 +2217,8 @@ export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterabl
2145
2217
  * By default, the merged stream ends when both streams end. Use
2146
2218
  * `haltStrategy` to change the termination behavior.
2147
2219
  *
2148
- * @example
2220
+ * **Example** (Merging stream values)
2221
+ *
2149
2222
  * ```ts
2150
2223
  * import { Console, Effect, Stream } from "effect"
2151
2224
  *
@@ -2161,8 +2234,8 @@ export const prepend = /*#__PURE__*/dual(2, (self, values) => concat(fromIterabl
2161
2234
  * // Output: [ 1, 2, 3, 4 ]
2162
2235
  * ```
2163
2236
  *
2164
- * @since 2.0.0
2165
2237
  * @category Merging
2238
+ * @since 2.0.0
2166
2239
  */
2167
2240
  export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(Channel.merge(toChannel(self), toChannel(that), options)));
2168
2241
  /**
@@ -2171,9 +2244,8 @@ export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(arg
2171
2244
  * The effect runs concurrently, fails the stream if it fails, and is interrupted
2172
2245
  * when the stream completes.
2173
2246
  *
2174
- * @since 4.0.0
2175
- * @category Merging
2176
- * @example
2247
+ * **Example** (Merging with a background effect)
2248
+ *
2177
2249
  * ```ts
2178
2250
  * import { Console, Effect, Stream } from "effect"
2179
2251
  *
@@ -2190,19 +2262,17 @@ export const merge = /*#__PURE__*/dual(args => isStream(args[0]) && isStream(arg
2190
2262
  * // Output: side task
2191
2263
  * // Output: [ 1, 2, 3 ]
2192
2264
  * ```
2265
+ *
2266
+ * @category Merging
2267
+ * @since 4.0.0
2193
2268
  */
2194
2269
  export const mergeEffect = /*#__PURE__*/dual(2, (self, effect) => self.channel.pipe(Channel.mergeEffect(effect), fromChannel));
2195
2270
  /**
2196
2271
  * Merges this stream and the specified stream together, tagging values from the
2197
2272
  * left stream as `Result.succeed` and values from the right stream as `Result.fail`.
2198
2273
  *
2199
- * **Previously Known As**
2200
- *
2201
- * This API replaces the following from Effect 3.x:
2274
+ * **Example** (Merging streams into results)
2202
2275
  *
2203
- * - `Stream.mergeEither`
2204
- *
2205
- * @example
2206
2276
  * ```ts
2207
2277
  * import { Console, Effect, Result, Stream } from "effect"
2208
2278
  *
@@ -2228,8 +2298,8 @@ export const mergeEffect = /*#__PURE__*/dual(2, (self, effect) => self.channel.p
2228
2298
  * // Output: [ "left:left", "right:right" ]
2229
2299
  * ```
2230
2300
  *
2231
- * @since 2.0.0
2232
2301
  * @category Merging
2302
+ * @since 4.0.0
2233
2303
  */
2234
2304
  export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self, Result.succeed), map(that, Result.fail)));
2235
2305
  /**
@@ -2239,7 +2309,8 @@ export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self,
2239
2309
  * stream are propagated. The merged stream completes when the left stream
2240
2310
  * completes, interrupting the right stream.
2241
2311
  *
2242
- * @example
2312
+ * **Example** (Merging streams while keeping left values)
2313
+ *
2243
2314
  * ```ts
2244
2315
  * import { Console, Effect, Stream } from "effect"
2245
2316
  *
@@ -2254,8 +2325,8 @@ export const mergeResult = /*#__PURE__*/dual(2, (self, that) => merge(map(self,
2254
2325
  * // Output: [ 1, 2 ]
2255
2326
  * ```
2256
2327
  *
2257
- * @since 2.0.0
2258
2328
  * @category Merging
2329
+ * @since 2.0.0
2259
2330
  */
2260
2331
  export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left, runDrain(right)));
2261
2332
  /**
@@ -2265,7 +2336,8 @@ export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left,
2265
2336
  * The merged stream ends when the right stream completes, interrupting the
2266
2337
  * left stream. Failures from the left stream still fail the merged stream.
2267
2338
  *
2268
- * @example
2339
+ * **Example** (Merging streams while keeping right values)
2340
+ *
2269
2341
  * ```ts
2270
2342
  * import { Console, Effect, Stream } from "effect"
2271
2343
  *
@@ -2285,17 +2357,18 @@ export const mergeLeft = /*#__PURE__*/dual(2, (left, right) => mergeEffect(left,
2285
2357
  * // Output: [ 1, 2 ]
2286
2358
  * ```
2287
2359
  *
2288
- * @since 2.0.0
2289
2360
  * @category Merging
2361
+ * @since 2.0.0
2290
2362
  */
2291
2363
  export const mergeRight = /*#__PURE__*/dual(2, (left, right) => mergeEffect(right, runDrain(left)));
2292
2364
  /**
2293
2365
  * Merges a collection of streams, running up to the specified number concurrently.
2294
2366
  *
2295
- * @since 2.0.0
2296
2367
  * @category Merging
2368
+ * @since 2.0.0
2369
+ *
2370
+ * **Example** (Merging streams with bounded concurrency)
2297
2371
  *
2298
- * @example
2299
2372
  * ```ts
2300
2373
  * import { Console, Effect, Stream } from "effect"
2301
2374
  *
@@ -2322,7 +2395,8 @@ export const mergeAll = /*#__PURE__*/dual(2, (streams, options) => flatten(fromI
2322
2395
  *
2323
2396
  * See also `Stream.zip` for the more common point-wise variant.
2324
2397
  *
2325
- * @example
2398
+ * **Example** (Computing cartesian products)
2399
+ *
2326
2400
  * ```ts
2327
2401
  * import { Console, Effect, Stream } from "effect"
2328
2402
  *
@@ -2337,8 +2411,8 @@ export const mergeAll = /*#__PURE__*/dual(2, (streams, options) => flatten(fromI
2337
2411
  * // Output: [ [ 1, "a" ], [ 1, "b" ], [ 2, "a" ], [ 2, "b" ] ]
2338
2412
  * ```
2339
2413
  *
2414
+ * @category zipping
2340
2415
  * @since 2.0.0
2341
- * @category Zipping
2342
2416
  */
2343
2417
  export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right, (l, r) => [l, r]));
2344
2418
  /**
@@ -2348,7 +2422,8 @@ export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right
2348
2422
  *
2349
2423
  * See also `Stream.zipWith` for the more common point-wise variant.
2350
2424
  *
2351
- * @example
2425
+ * **Example** (Combining cartesian products)
2426
+ *
2352
2427
  * ```ts
2353
2428
  * import { Console, Effect, Stream } from "effect"
2354
2429
  *
@@ -2364,14 +2439,15 @@ export const cross = /*#__PURE__*/dual(2, (left, right) => crossWith(left, right
2364
2439
  * // Output: [ "1-a", "1-b", "2-a", "2-b" ]
2365
2440
  * ```
2366
2441
  *
2442
+ * @category zipping
2367
2443
  * @since 2.0.0
2368
- * @category Zipping
2369
2444
  */
2370
2445
  export const crossWith = /*#__PURE__*/dual(3, (left, right, f) => flatMap(left, l => map(right, r => f(l, r))));
2371
2446
  /**
2372
2447
  * Zips two streams point-wise with a combining function, ending when either stream ends.
2373
2448
  *
2374
- * @example
2449
+ * **Example** (Zipping streams with a function)
2450
+ *
2375
2451
  * ```ts
2376
2452
  * import { Console, Effect, Stream } from "effect"
2377
2453
  *
@@ -2389,8 +2465,8 @@ export const crossWith = /*#__PURE__*/dual(3, (left, right, f) => flatMap(left,
2389
2465
  * // Output: [ "1-a", "2-b", "3-c" ]
2390
2466
  * ```
2391
2467
  *
2468
+ * @category zipping
2392
2469
  * @since 2.0.0
2393
- * @category Zipping
2394
2470
  */
2395
2471
  export const zipWith = /*#__PURE__*/dual(3, (left, right, f) => zipWithArray(left, right, zipArrays(f)));
2396
2472
  const zipArrays = f => (leftArr, rightArr) => {
@@ -2406,13 +2482,8 @@ const zipArrays = f => (leftArr, rightArr) => {
2406
2482
  *
2407
2483
  * The function returns output plus leftover arrays that carry into the next pull.
2408
2484
  *
2409
- * **Previously Known As**
2410
- *
2411
- * This API replaces the following from Effect 3.x:
2485
+ * **Example** (Zipping stream chunks)
2412
2486
  *
2413
- * - `Stream.zipWithChunks`
2414
- *
2415
- * @example
2416
2487
  * ```ts
2417
2488
  * import { Array, Console, Effect, Stream } from "effect"
2418
2489
  *
@@ -2435,8 +2506,8 @@ const zipArrays = f => (leftArr, rightArr) => {
2435
2506
  * // Output: [[1, "a"], [2, "b"], [3, "c"], [4, "d"], [5, "e"]]
2436
2507
  * ```
2437
2508
  *
2438
- * @since 2.0.0
2439
- * @category Zipping
2509
+ * @category zipping
2510
+ * @since 4.0.0
2440
2511
  */
2441
2512
  export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function* (_, scope) {
2442
2513
  const pullLeft = yield* Channel.toPullScoped(left.channel, scope);
@@ -2475,7 +2546,8 @@ export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel
2475
2546
  * Zips this stream with another point-wise and emits tuples of elements from
2476
2547
  * both streams. The new stream ends when either stream ends.
2477
2548
  *
2478
- * @example
2549
+ * **Example** (Zipping streams)
2550
+ *
2479
2551
  * ```ts
2480
2552
  * import { Console, Effect, Stream } from "effect"
2481
2553
  *
@@ -2493,8 +2565,8 @@ export const zipWithArray = /*#__PURE__*/dual(3, (left, right, f) => fromChannel
2493
2565
  * // Output: [[1, "a"], [2, "b"], [3, "c"]]
2494
2566
  * ```
2495
2567
  *
2568
+ * @category zipping
2496
2569
  * @since 2.0.0
2497
- * @category Zipping
2498
2570
  */
2499
2571
  export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a, a2) => [a, a2]));
2500
2572
  /**
@@ -2503,7 +2575,8 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a,
2503
2575
  *
2504
2576
  * The resulting stream ends when either side ends.
2505
2577
  *
2506
- * @example
2578
+ * **Example** (Zipping streams while keeping left values)
2579
+ *
2507
2580
  * ```ts
2508
2581
  * import { Console, Effect, Stream } from "effect"
2509
2582
  *
@@ -2519,8 +2592,8 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a,
2519
2592
  * // Output: [1, 2]
2520
2593
  * ```
2521
2594
  *
2595
+ * @category zipping
2522
2596
  * @since 2.0.0
2523
- * @category Zipping
2524
2597
  */
2525
2598
  export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left, right, (leftArr, rightArr) => {
2526
2599
  const minLength = Math.min(leftArr.length, rightArr.length);
@@ -2532,7 +2605,8 @@ export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
2532
2605
  /**
2533
2606
  * Zips this stream with another point-wise, keeping only right values and ending when either stream ends.
2534
2607
  *
2535
- * @example
2608
+ * **Example** (Zipping streams while keeping right values)
2609
+ *
2536
2610
  * ```ts
2537
2611
  * import { Console, Effect, Stream } from "effect"
2538
2612
  *
@@ -2548,8 +2622,8 @@ export const zipLeft = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
2548
2622
  * // Output: ["a", "b"]
2549
2623
  * ```
2550
2624
  *
2625
+ * @category zipping
2551
2626
  * @since 2.0.0
2552
- * @category Zipping
2553
2627
  */
2554
2628
  export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left, right, (leftArr, rightArr) => {
2555
2629
  const minLength = Math.min(leftArr.length, rightArr.length);
@@ -2564,7 +2638,8 @@ export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
2564
2638
  *
2565
2639
  * The new stream will end when one of the sides ends.
2566
2640
  *
2567
- * @example
2641
+ * **Example** (Zipping and flattening tuples)
2642
+ *
2568
2643
  * ```ts
2569
2644
  * import { Console, Effect, Stream } from "effect"
2570
2645
  *
@@ -2584,14 +2659,15 @@ export const zipRight = /*#__PURE__*/dual(2, (left, right) => zipWithArray(left,
2584
2659
  * // Output: [[1, "a", "x"], [2, "b", "y"], [3, "c", "z"]]
2585
2660
  * ```
2586
2661
  *
2662
+ * @category zipping
2587
2663
  * @since 2.0.0
2588
- * @category Zipping
2589
2664
  */
2590
2665
  export const zipFlatten = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, (a, a2) => [...a, a2]));
2591
2666
  /**
2592
2667
  * Zips this stream together with the index of elements.
2593
2668
  *
2594
- * @example
2669
+ * **Example** (Zipping elements with indices)
2670
+ *
2595
2671
  * ```ts
2596
2672
  * import { Console, Effect, Stream } from "effect"
2597
2673
  *
@@ -2607,15 +2683,16 @@ export const zipFlatten = /*#__PURE__*/dual(2, (self, that) => zipWith(self, tha
2607
2683
  * // Output: [["a", 0], ["b", 1], ["c", 2], ["d", 3]]
2608
2684
  * ```
2609
2685
  *
2686
+ * @category zipping
2610
2687
  * @since 2.0.0
2611
- * @category Zipping
2612
2688
  */
2613
2689
  export const zipWithIndex = self => map(self, (a, i) => [a, i]);
2614
2690
  /**
2615
2691
  * Zips each element with the next element, pairing the final element with
2616
2692
  * `Option.none()`.
2617
2693
  *
2618
- * @example
2694
+ * **Example** (Zipping elements with next values)
2695
+ *
2619
2696
  * ```ts
2620
2697
  * import { Console, Effect, Stream } from "effect"
2621
2698
  *
@@ -2633,8 +2710,8 @@ export const zipWithIndex = self => map(self, (a, i) => [a, i]);
2633
2710
  * // ]
2634
2711
  * ```
2635
2712
  *
2713
+ * @category zipping
2636
2714
  * @since 2.0.0
2637
- * @category Zipping
2638
2715
  */
2639
2716
  export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) => {
2640
2717
  let i = 0;
@@ -2657,7 +2734,8 @@ export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) =
2657
2734
  /**
2658
2735
  * Zips each element with its previous element, starting with `None`.
2659
2736
  *
2660
- * @example
2737
+ * **Example** (Zipping elements with previous values)
2738
+ *
2661
2739
  * ```ts
2662
2740
  * import { Console, Effect, Stream } from "effect"
2663
2741
  *
@@ -2677,8 +2755,8 @@ export const zipWithNext = self => mapAccumArray(self, Option.none, (acc, arr) =
2677
2755
  * // ]
2678
2756
  * ```
2679
2757
  *
2758
+ * @category zipping
2680
2759
  * @since 2.0.0
2681
- * @category Zipping
2682
2760
  */
2683
2761
  export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, arr) => {
2684
2762
  const pairs = Arr.empty();
@@ -2692,7 +2770,8 @@ export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, ar
2692
2770
  /**
2693
2771
  * Zips each element with its previous and next values.
2694
2772
  *
2695
- * @example
2773
+ * **Example** (Zipping elements with neighbors)
2774
+ *
2696
2775
  * ```ts
2697
2776
  * import { Console, Effect, Option, Stream } from "effect"
2698
2777
  *
@@ -2708,8 +2787,8 @@ export const zipWithPrevious = self => mapAccumArray(self, Option.none, (acc, ar
2708
2787
  * // Output: [ [Option.none(), 1, Option.some(2)], [Option.some(1), 2, Option.some(3)], [Option.some(2), 3, Option.none()] ]
2709
2788
  * ```
2710
2789
  *
2790
+ * @category zipping
2711
2791
  * @since 2.0.0
2712
- * @category Zipping
2713
2792
  */
2714
2793
  export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
2715
2794
  prev: Option.none(),
@@ -2746,7 +2825,8 @@ export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
2746
2825
  * that emitted elements that are not the last value in arrays will never be
2747
2826
  * used for zipping.
2748
2827
  *
2749
- * @example
2828
+ * **Example** (Zipping latest values from many streams)
2829
+ *
2750
2830
  * ```ts
2751
2831
  * import { Console, Effect, Stream } from "effect"
2752
2832
  *
@@ -2765,8 +2845,8 @@ export const zipWithPreviousAndNext = self => mapAccumArray(self, () => ({
2765
2845
  * // Output: [ [ 1, "a", true ], [ 2, "a", true ], [ 3, "a", true ], [ 3, "b", true ], [ 3, "c", true ], [ 3, "c", false ], [ 3, "c", true ] ]
2766
2846
  * ```
2767
2847
  *
2768
- * @since 2.0.0
2769
- * @category Zipping
2848
+ * @category zipping
2849
+ * @since 3.3.0
2770
2850
  */
2771
2851
  export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
2772
2852
  const latest = [];
@@ -2794,7 +2874,8 @@ export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
2794
2874
  * that emitted elements that are not the last value in arrays will never be
2795
2875
  * used for zipping.
2796
2876
  *
2797
- * @example
2877
+ * **Example** (Zipping latest values)
2878
+ *
2798
2879
  * ```ts
2799
2880
  * import { Console, Effect, Stream } from "effect"
2800
2881
  *
@@ -2809,8 +2890,8 @@ export const zipLatestAll = (...streams) => fromChannel(Channel.suspend(() => {
2809
2890
  * // Output: [ [1, "a"] ]
2810
2891
  * ```
2811
2892
  *
2893
+ * @category zipping
2812
2894
  * @since 2.0.0
2813
- * @category Zipping
2814
2895
  */
2815
2896
  export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left, right));
2816
2897
  /**
@@ -2821,7 +2902,8 @@ export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left
2821
2902
  * that emitted elements that are not the last value in arrays will never be
2822
2903
  * used for zipping.
2823
2904
  *
2824
- * @example
2905
+ * **Example** (Zipping latest values with a function)
2906
+ *
2825
2907
  * ```ts
2826
2908
  * import { Console, Effect, Stream } from "effect"
2827
2909
  *
@@ -2840,17 +2922,23 @@ export const zipLatest = /*#__PURE__*/dual(2, (left, right) => zipLatestAll(left
2840
2922
  * })
2841
2923
  * ```
2842
2924
  *
2925
+ * @category zipping
2843
2926
  * @since 2.0.0
2844
- * @category Zipping
2845
2927
  */
2846
2928
  export const zipLatestWith = /*#__PURE__*/dual(3, (left, right, f) => map(zipLatestAll(left, right), ([a, a2]) => f(a, a2)));
2847
2929
  /**
2848
- * Races multiple streams and emits values from the first stream to produce a value, interrupting the rest.
2930
+ * Runs all streams concurrently until one stream emits its first value, then
2931
+ * mirrors that winning stream and interrupts the rest.
2932
+ *
2933
+ * Failures or completion from losing streams before a winner is chosen are
2934
+ * ignored unless every stream fails or completes before emitting. After a
2935
+ * winner is chosen, that stream's later failures are propagated.
2849
2936
  *
2850
- * @since 3.7.0
2851
2937
  * @category Racing
2938
+ * @since 3.5.0
2939
+ *
2940
+ * **Example** (Racing multiple streams)
2852
2941
  *
2853
- * @example
2854
2942
  * ```ts
2855
2943
  * import { Console, Effect, Schedule, Stream } from "effect"
2856
2944
  *
@@ -2884,10 +2972,15 @@ export const raceAll = (...streams) => fromChannel(Channel.fromTransform((_, sco
2884
2972
  return Effect.suspend(() => winner ?? race);
2885
2973
  })));
2886
2974
  /**
2887
- * Returns a stream that mirrors the first upstream to emit an item.
2888
- * As soon as one stream emits, the other is interrupted and failures propagate.
2975
+ * Runs both streams concurrently until one stream emits its first value, then
2976
+ * mirrors that winning stream and interrupts the other.
2977
+ *
2978
+ * A failure or completion from one side before the other side emits does not
2979
+ * win the race unless both sides fail or complete before emitting. After a
2980
+ * winner is chosen, that stream's later failures are propagated.
2981
+ *
2982
+ * **Example** (Racing two streams)
2889
2983
  *
2890
- * @example
2891
2984
  * ```ts
2892
2985
  * import { Console, Effect, Schedule, Stream } from "effect"
2893
2986
  *
@@ -2905,14 +2998,15 @@ export const raceAll = (...streams) => fromChannel(Channel.fromTransform((_, sco
2905
2998
  * // Output: [ 0, 1, 2 ]
2906
2999
  * ```
2907
3000
  *
2908
- * @since 3.7.0
2909
3001
  * @category Racing
3002
+ * @since 3.7.0
2910
3003
  */
2911
3004
  export const race = /*#__PURE__*/dual(2, (left, right) => raceAll(left, right));
2912
3005
  /**
2913
3006
  * Filters a stream to the elements that satisfy a predicate.
2914
3007
  *
2915
- * @example
3008
+ * **Example** (Filtering stream values)
3009
+ *
2916
3010
  * ```ts
2917
3011
  * import { Console, Effect, Stream } from "effect"
2918
3012
  *
@@ -2928,21 +3022,22 @@ export const race = /*#__PURE__*/dual(2, (left, right) => raceAll(left, right));
2928
3022
  * // Output: [ 2, 4 ]
2929
3023
  * ```
2930
3024
  *
3025
+ * @category filtering
2931
3026
  * @since 2.0.0
2932
- * @category Filtering
2933
3027
  */
2934
3028
  export const filter = /*#__PURE__*/dual(2, (self, predicate) => fromChannel(Channel.filterArray(toChannel(self), predicate)));
2935
3029
  /**
2936
3030
  * Filters and maps stream elements in one pass using a `Filter`.
2937
3031
  *
2938
- * @since 4.0.0
2939
- * @category Filtering
3032
+ * @category filtering
3033
+ * @since 2.0.0
2940
3034
  */
2941
3035
  export const filterMap = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Channel.filterMapArray(toChannel(self), filter)));
2942
3036
  /**
2943
3037
  * Effectfully filters elements in a single pass.
2944
3038
  *
2945
- * @example
3039
+ * **Example** (Effectfully filtering stream values)
3040
+ *
2946
3041
  * ```ts
2947
3042
  * import { Console, Effect, Stream } from "effect"
2948
3043
  *
@@ -2957,23 +3052,27 @@ export const filterMap = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Chan
2957
3052
  * // Output: [ 3, 4 ]
2958
3053
  * ```
2959
3054
  *
3055
+ * @category filtering
2960
3056
  * @since 2.0.0
2961
- * @category Filtering
2962
3057
  */
2963
3058
  export const filterEffect = /*#__PURE__*/dual(2, (self, predicate) => fromChannel(Channel.filterArrayEffect(toChannel(self), predicate)));
2964
3059
  /**
2965
3060
  * Effectfully filters and maps elements in a single pass.
2966
3061
  *
2967
- * @since 4.0.0
2968
- * @category Filtering
3062
+ * @category filtering
3063
+ * @since 2.0.0
2969
3064
  */
2970
3065
  export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromChannel(Channel.filterMapArrayEffect(toChannel(self), filter)));
2971
3066
  /**
2972
- * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
3067
+ * Partitions a stream using a `Filter` and exposes passing and failing values
3068
+ * as scoped queues.
2973
3069
  *
2974
- * Each queue fails with the stream error or `Cause.Done` when the source ends.
3070
+ * The queues are backed by a fiber in the current scope and should be consumed
3071
+ * while that scope remains open. Each queue fails with the stream error or
3072
+ * `Cause.Done` when the source ends.
3073
+ *
3074
+ * **Example** (Partitioning a stream into queues)
2975
3075
  *
2976
- * @example
2977
3076
  * ```ts
2978
3077
  * import { Console, Effect, Result, Stream } from "effect"
2979
3078
  *
@@ -2994,8 +3093,8 @@ export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromChanne
2994
3093
  * Effect.runPromise(Effect.scoped(program))
2995
3094
  * ```
2996
3095
  *
3096
+ * @category filtering
2997
3097
  * @since 4.0.0
2998
- * @category Filtering
2999
3098
  */
3000
3099
  export const partitionQueue = /*#__PURE__*/dual(args => isStream(args[0]), /*#__PURE__*/Effect.fnUntraced(function* (self, filter, options) {
3001
3100
  const scope = yield* Effect.scope;
@@ -3043,22 +3142,30 @@ export const partitionQueue = /*#__PURE__*/dual(args => isStream(args[0]), /*#__
3043
3142
  return [passes, fails];
3044
3143
  }));
3045
3144
  /**
3046
- * Splits a stream using an effectful `Filter`, producing pass and fail streams.
3145
+ * Splits a stream with an effectful `Filter`, returning scoped streams for
3146
+ * filter successes and failures.
3147
+ *
3148
+ * The returned streams are backed by queues in the current scope and should be
3149
+ * consumed while that scope remains open. The first stream emits success values
3150
+ * from the filter, and the second emits failure values.
3047
3151
  *
3152
+ * @category filtering
3048
3153
  * @since 4.0.0
3049
- * @category Filtering
3050
3154
  */
3051
3155
  export const partitionEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, filter, options) => Effect.map(partitionQueue(mapEffect(self, a => filter(a), options), result => result, options), ([passes, fails]) => [fromQueue(passes), fromQueue(fails)]));
3052
3156
  /**
3053
- * Splits a stream into excluded and satisfying substreams using a `Filter`.
3157
+ * Splits a stream into scoped excluded and satisfying substreams using a
3158
+ * `Filter`.
3054
3159
  *
3055
- * The faster stream may advance up to `bufferSize` elements ahead of the slower
3056
- * one.
3160
+ * The returned streams are backed by queues in the current scope and should be
3161
+ * consumed while that scope remains open. The faster stream may advance up to
3162
+ * `bufferSize` elements ahead of the slower one.
3057
3163
  *
3058
- * @since 4.0.0
3059
- * @category Filtering
3164
+ * @category filtering
3165
+ * @since 2.0.0
3166
+ *
3167
+ * **Example** (Partitioning a stream)
3060
3168
  *
3061
- * @example
3062
3169
  * ```ts
3063
3170
  * import { Console, Effect, Result, Stream } from "effect"
3064
3171
  *
@@ -3083,7 +3190,8 @@ export const partition = /*#__PURE__*/dual(args => isStream(args[0]), (self, fil
3083
3190
  * Returns the specified stream if the given condition is satisfied, otherwise
3084
3191
  * returns an empty stream.
3085
3192
  *
3086
- * @example
3193
+ * **Example** (Conditionally keeping a stream)
3194
+ *
3087
3195
  * ```ts
3088
3196
  * import { Console, Effect, Stream } from "effect"
3089
3197
  *
@@ -3098,8 +3206,8 @@ export const partition = /*#__PURE__*/dual(args => isStream(args[0]), (self, fil
3098
3206
  * // Output: []
3099
3207
  * ```
3100
3208
  *
3209
+ * @category filtering
3101
3210
  * @since 2.0.0
3102
- * @category Filtering
3103
3211
  */
3104
3212
  export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pass => pass ? self : empty), unwrap));
3105
3213
  /**
@@ -3108,7 +3216,8 @@ export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pa
3108
3216
  *
3109
3217
  * The returned stream is only valid within the scope.
3110
3218
  *
3111
- * @example
3219
+ * **Example** (Peeling a stream with a sink)
3220
+ *
3112
3221
  * ```ts
3113
3222
  * import { Console, Effect, Sink, Stream } from "effect"
3114
3223
  *
@@ -3127,8 +3236,8 @@ export const when = /*#__PURE__*/dual(2, (self, test) => test.pipe(Effect.map(pa
3127
3236
  * // Output: [ [1, 2, 3], [4, 5, 6] ]
3128
3237
  * ```
3129
3238
  *
3239
+ * @category destructors
3130
3240
  * @since 2.0.0
3131
- * @category Destructors
3132
3241
  */
3133
3242
  export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function* (self, sink) {
3134
3243
  let cause = undefined;
@@ -3147,10 +3256,13 @@ export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function
3147
3256
  * Buffers up to `capacity` elements so a faster producer can progress
3148
3257
  * independently of a slower consumer.
3149
3258
  *
3150
- * Note: This combinator destroys chunking. Use `Stream.rechunk` afterwards if
3151
- * you need fixed chunk sizes.
3259
+ * Finite buffers use the configured queue strategy: `"suspend"` applies
3260
+ * backpressure, while `"dropping"` and `"sliding"` may discard elements when
3261
+ * the buffer is full. This combinator destroys chunking; use `Stream.rechunk`
3262
+ * afterward if you need fixed chunk sizes.
3263
+ *
3264
+ * **Example** (Buffering stream elements)
3152
3265
  *
3153
- * @example
3154
3266
  * ```ts
3155
3267
  * import { Console, Effect, Stream } from "effect"
3156
3268
  *
@@ -3166,23 +3278,21 @@ export const peel = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function
3166
3278
  * // Output: [ 1, 2, 3 ]
3167
3279
  * ```
3168
3280
  *
3169
- * @since 2.0.0
3170
3281
  * @category Rate Limiting
3282
+ * @since 2.0.0
3171
3283
  */
3172
3284
  export const buffer = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channel.bufferArray(self.channel, options)));
3173
3285
  /**
3174
3286
  * Allows a faster producer to progress independently of a slower consumer by
3175
3287
  * buffering up to `capacity` chunks in a queue.
3176
3288
  *
3177
- * This combinator preserves chunking and is best with power-of-2 capacities.
3178
- *
3179
- * **Previously Known As**
3180
- *
3181
- * This API replaces the following from Effect 3.x:
3289
+ * Finite buffers use the configured queue strategy: `"suspend"` applies
3290
+ * backpressure, while `"dropping"` and `"sliding"` may discard chunks when the
3291
+ * buffer is full. This combinator preserves chunking and is best with
3292
+ * power-of-2 capacities.
3182
3293
  *
3183
- * - `Stream.bufferChunks`
3294
+ * **Example** (Buffering stream chunks)
3184
3295
  *
3185
- * @example
3186
3296
  * ```ts
3187
3297
  * import { Console, Effect, Stream } from "effect"
3188
3298
  *
@@ -3197,8 +3307,8 @@ export const buffer = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channe
3197
3307
  * // Output: [ 1, 2, 3, 4 ]
3198
3308
  * ```
3199
3309
  *
3200
- * @since 2.0.0
3201
3310
  * @category Rate Limiting
3311
+ * @since 4.0.0
3202
3312
  */
3203
3313
  export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(Channel.buffer(self.channel, options)));
3204
3314
  /**
@@ -3206,13 +3316,8 @@ export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(C
3206
3316
  * one fails. Allows recovery from all causes of failure, including
3207
3317
  * interruption if the stream is uninterruptible.
3208
3318
  *
3209
- * **Previously Known As**
3210
- *
3211
- * This API replaces the following from Effect 3.x:
3212
- *
3213
- * - `Stream.catchAllCause`
3319
+ * **Example** (Catching stream causes)
3214
3320
  *
3215
- * @example
3216
3321
  * ```ts
3217
3322
  * import { Console, Effect, Stream } from "effect"
3218
3323
  *
@@ -3234,21 +3339,16 @@ export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromChannel(C
3234
3339
  * // Output: [ 1, 2, 999 ]
3235
3340
  * ```
3236
3341
  *
3237
- * @since 4.0.0
3238
- * @category Error Handling
3342
+ * @category error handling
3343
+ * @since 2.0.0
3239
3344
  */
3240
3345
  export const catchCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.catchCause(cause => f(cause).channel), fromChannel));
3241
3346
  /**
3242
3347
  * Runs an effect when the stream fails without changing its values or error,
3243
3348
  * unless the tap effect itself fails.
3244
3349
  *
3245
- * **Previously Known As**
3246
- *
3247
- * This API replaces the following from Effect 3.x:
3248
- *
3249
- * - `Stream.tapErrorCause`
3350
+ * **Example** (Tapping stream causes)
3250
3351
  *
3251
- * @example
3252
3352
  * ```ts
3253
3353
  * import { Cause, Console, Effect, Stream } from "effect"
3254
3354
  *
@@ -3268,8 +3368,8 @@ export const catchCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Ch
3268
3368
  * // Output: [ 1, 2, 0 ]
3269
3369
  * ```
3270
3370
  *
3271
- * @since 4.0.0
3272
- * @category Error Handling
3371
+ * @category error handling
3372
+ * @since 2.0.0
3273
3373
  */
3274
3374
  export const tapCause = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.tapCause(f), fromChannel));
3275
3375
  const catch_ = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.catch(self.channel, error => f(error).channel)));
@@ -3277,13 +3377,8 @@ export {
3277
3377
  /**
3278
3378
  * Switches over to the stream produced by the provided function if this one fails.
3279
3379
  *
3280
- * **Previously Known As**
3281
- *
3282
- * This API replaces the following from Effect 3.x:
3283
- *
3284
- * - `Stream.catchAll`
3380
+ * **Example** (Catching stream failures)
3285
3381
  *
3286
- * @example
3287
3382
  * ```ts
3288
3383
  * import { Console, Effect, Stream } from "effect"
3289
3384
  *
@@ -3301,14 +3396,15 @@ export {
3301
3396
  * // Output: [ 1, 2, 999 ]
3302
3397
  * ```
3303
3398
  *
3399
+ * @category error handling
3304
3400
  * @since 4.0.0
3305
- * @category Error Handling
3306
3401
  */
3307
3402
  catch_ as catch };
3308
3403
  /**
3309
3404
  * Effectfully peeks at errors without changing the stream unless the tap fails.
3310
3405
  *
3311
- * @example
3406
+ * **Example** (Effectfully peeking at errors)
3407
+ *
3312
3408
  * ```ts
3313
3409
  * import { Console, Effect, Stream } from "effect"
3314
3410
  *
@@ -3329,8 +3425,8 @@ catch_ as catch };
3329
3425
  * // [ 1, 2, 999 ]
3330
3426
  * ```
3331
3427
  *
3332
- * @since 4.0.0
3333
- * @category Error Handling
3428
+ * @category error handling
3429
+ * @since 2.0.0
3334
3430
  */
3335
3431
  export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Channel.tapError(f), fromChannel));
3336
3432
  /**
@@ -3340,13 +3436,8 @@ export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Chan
3340
3436
  * stream. Non-matching failures propagate downstream, so the error type is
3341
3437
  * preserved unless the filter narrows it.
3342
3438
  *
3343
- * **Previously Known As**
3344
- *
3345
- * This API replaces the following from Effect 3.x:
3439
+ * **Example** (Catching matching failures)
3346
3440
  *
3347
- * - `Stream.catchSome`
3348
- *
3349
- * @example
3350
3441
  * ```ts
3351
3442
  * import { Console, Effect, Stream } from "effect"
3352
3443
  *
@@ -3367,16 +3458,16 @@ export const tapError = /*#__PURE__*/dual(2, (self, f) => self.channel.pipe(Chan
3367
3458
  * Effect.runPromise(program)
3368
3459
  * ```
3369
3460
  *
3461
+ * @category error handling
3370
3462
  * @since 4.0.0
3371
- * @category Error Handling
3372
3463
  */
3373
3464
  export const catchIf = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, f, orElse) => fromChannel(Channel.catchIf(toChannel(self), predicate, e => f(e).channel, orElse && (e => orElse(e).channel))));
3374
3465
  /**
3375
3466
  * Recovers from errors that match a `Filter` by switching to a recovery
3376
3467
  * stream.
3377
3468
  *
3469
+ * @category error handling
3378
3470
  * @since 4.0.0
3379
- * @category Error Handling
3380
3471
  */
3381
3472
  export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, filter, f, orElse) => fromChannel(Channel.catchFilter(toChannel(self), filter, e => f(e).channel, orElse && (e => orElse(e).channel))));
3382
3473
  /**
@@ -3388,7 +3479,8 @@ export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, f
3388
3479
  * Use `catchTag` when your error type is a tagged union with a readonly `_tag`
3389
3480
  * field and you want to handle a specific error case.
3390
3481
  *
3391
- * @example
3482
+ * **Example** (Catching tagged failures)
3483
+ *
3392
3484
  * ```ts
3393
3485
  * import { Console, Data, Effect, Stream } from "effect"
3394
3486
  *
@@ -3409,8 +3501,8 @@ export const catchFilter = /*#__PURE__*/dual(args => isStream(args[0]), (self, f
3409
3501
  * Effect.runPromise(program)
3410
3502
  * ```
3411
3503
  *
3412
- * @since 4.0.0
3413
- * @category Error Handling
3504
+ * @category error handling
3505
+ * @since 2.0.0
3414
3506
  */
3415
3507
  export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f, orElse) => {
3416
3508
  const pred = Array.isArray(k) ? e => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k);
@@ -3419,7 +3511,8 @@ export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f
3419
3511
  /**
3420
3512
  * Switches to a recovery stream based on matching `_tag` handlers.
3421
3513
  *
3422
- * @example
3514
+ * **Example** (Catching tagged failures with handlers)
3515
+ *
3423
3516
  * ```ts
3424
3517
  * import { Console, Effect, Stream } from "effect"
3425
3518
  *
@@ -3449,8 +3542,8 @@ export const catchTag = /*#__PURE__*/dual(args => isStream(args[0]), (self, k, f
3449
3542
  * // Output: [ "fallback" ]
3450
3543
  * ```
3451
3544
  *
3452
- * @since 4.0.0
3453
- * @category Error Handling
3545
+ * @category error handling
3546
+ * @since 2.0.0
3454
3547
  */
3455
3548
  export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cases, orElse) => {
3456
3549
  let keys;
@@ -3465,7 +3558,8 @@ export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cas
3465
3558
  * Use this to handle nested error causes without removing the parent error
3466
3559
  * from the error channel. The handler receives the unwrapped reason.
3467
3560
  *
3468
- * @example
3561
+ * **Example** (Catching a tagged error reason)
3562
+ *
3469
3563
  * ```ts
3470
3564
  * import { Console, Data, Effect, Stream } from "effect"
3471
3565
  *
@@ -3499,14 +3593,15 @@ export const catchTags = /*#__PURE__*/dual(args => isStream(args[0]), (self, cas
3499
3593
  * // Output: [ "retry: 60" ]
3500
3594
  * ```
3501
3595
  *
3596
+ * @category error handling
3502
3597
  * @since 4.0.0
3503
- * @category Error Handling
3504
3598
  */
3505
3599
  export const catchReason = /*#__PURE__*/dual(args => isStream(args[0]), (self, errorTag, reasonTag, f, orElse) => fromChannel(Channel.catchReason(toChannel(self), errorTag, reasonTag, (reason, error) => f(reason, error).channel, orElse && ((reason, error) => orElse(reason, error).channel))));
3506
3600
  /**
3507
3601
  * Catches multiple reasons within a tagged error using an object of handlers.
3508
3602
  *
3509
- * @example
3603
+ * **Example** (Catching tagged error reasons)
3604
+ *
3510
3605
  * ```ts
3511
3606
  * import { Console, Data, Effect, Stream } from "effect"
3512
3607
  *
@@ -3541,8 +3636,8 @@ export const catchReason = /*#__PURE__*/dual(args => isStream(args[0]), (self, e
3541
3636
  * // Output: [ "retry: 60" ]
3542
3637
  * ```
3543
3638
  *
3639
+ * @category error handling
3544
3640
  * @since 4.0.0
3545
- * @category Error Handling
3546
3641
  */
3547
3642
  export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self, errorTag, cases, orElse) => {
3548
3643
  const handlers = {};
@@ -3556,7 +3651,8 @@ export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self,
3556
3651
  /**
3557
3652
  * Transforms the errors emitted by this stream using `f`.
3558
3653
  *
3559
- * @example
3654
+ * **Example** (Mapping stream errors)
3655
+ *
3560
3656
  * ```ts
3561
3657
  * import { Console, Effect, Stream } from "effect"
3562
3658
  *
@@ -3573,21 +3669,16 @@ export const catchReasons = /*#__PURE__*/dual(args => isStream(args[0]), (self,
3573
3669
  * // Output: [ "recovered from mapped: bad" ]
3574
3670
  * ```
3575
3671
  *
3672
+ * @category error handling
3576
3673
  * @since 2.0.0
3577
- * @category Error Handling
3578
3674
  */
3579
3675
  export const mapError = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.mapError(self.channel, f)));
3580
3676
  /**
3581
3677
  * Recovers from stream failures by filtering the `Cause` and switching to a recovery stream.
3582
3678
  * Non-matching causes are re-emitted as failures.
3583
3679
  *
3584
- * **Previously Known As**
3585
- *
3586
- * This API replaces the following from Effect 3.x:
3587
- *
3588
- * - `Stream.catchSomeCause`
3680
+ * **Example** (Catching matching causes)
3589
3681
  *
3590
- * @example
3591
3682
  * ```ts
3592
3683
  * import { Cause, Console, Effect, Stream } from "effect"
3593
3684
  *
@@ -3607,22 +3698,23 @@ export const mapError = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.ma
3607
3698
  * // Output: [ "Recovered: NetworkError" ]
3608
3699
  * ```
3609
3700
  *
3701
+ * @category error handling
3610
3702
  * @since 4.0.0
3611
- * @category Error Handling
3612
3703
  */
3613
3704
  export const catchCauseIf = /*#__PURE__*/dual(3, (self, predicate, f) => fromChannel(Channel.catchCauseIf(self.channel, predicate, cause => f(cause).channel)));
3614
3705
  /**
3615
3706
  * Recovers from stream failures by filtering the `Cause` and switching to a
3616
3707
  * recovery stream.
3617
3708
  *
3709
+ * @category error handling
3618
3710
  * @since 4.0.0
3619
- * @category Error Handling
3620
3711
  */
3621
3712
  export const catchCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => fromChannel(Channel.catchCauseFilter(self.channel, filter, (failure, cause) => f(failure, cause).channel)));
3622
3713
  /**
3623
3714
  * Switches to a fallback stream if this stream is empty.
3624
3715
  *
3625
- * @example
3716
+ * **Example** (Switching on empty streams)
3717
+ *
3626
3718
  * ```ts
3627
3719
  * import { Console, Effect, Stream } from "effect"
3628
3720
  *
@@ -3638,14 +3730,15 @@ export const catchCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => fromCh
3638
3730
  * // Output: [ 1, 2 ]
3639
3731
  * ```
3640
3732
  *
3733
+ * @category error handling
3641
3734
  * @since 2.0.0
3642
- * @category Error Handling
3643
3735
  */
3644
3736
  export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, orElse) => fromChannel(Channel.orElseIfEmpty(self.channel, _ => toChannel(orElse()))));
3645
3737
  /**
3646
3738
  * Returns a stream that emits a fallback value when this stream fails.
3647
3739
  *
3648
- * @example
3740
+ * **Example** (Recovering with a fallback value)
3741
+ *
3649
3742
  * ```ts
3650
3743
  * import { Console, Effect, Stream } from "effect"
3651
3744
  *
@@ -3662,14 +3755,15 @@ export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, orElse) => fromChannel(
3662
3755
  * // Output: [ "Recovered: NetworkError" ]
3663
3756
  * ```
3664
3757
  *
3758
+ * @category error handling
3665
3759
  * @since 2.0.0
3666
- * @category Error Handling
3667
3760
  */
3668
3761
  export const orElseSucceed = /*#__PURE__*/dual(2, (self, f) => catch_(self, e => succeed(f(e))));
3669
3762
  /**
3670
3763
  * Turns typed failures into defects, making the stream infallible.
3671
3764
  *
3672
- * @example
3765
+ * **Example** (Turning failures into defects)
3766
+ *
3673
3767
  * ```ts
3674
3768
  * import { Console, Effect, Stream } from "effect"
3675
3769
  *
@@ -3686,8 +3780,8 @@ export const orElseSucceed = /*#__PURE__*/dual(2, (self, f) => catch_(self, e =>
3686
3780
  * // Output: [ 1, 2, 3 ]
3687
3781
  * ```
3688
3782
  *
3783
+ * @category error handling
3689
3784
  * @since 2.0.0
3690
- * @category Error Handling
3691
3785
  */
3692
3786
  export const orDie = self => fromChannel(Channel.orDie(self.channel));
3693
3787
  /**
@@ -3695,7 +3789,8 @@ export const orDie = self => fromChannel(Channel.orDie(self.channel));
3695
3789
  *
3696
3790
  * Use the `log` option to emit the full {@link Cause} when the stream fails.
3697
3791
  *
3698
- * @example
3792
+ * **Example** (Ignoring stream failures)
3793
+ *
3699
3794
  * ```ts
3700
3795
  * import { Console, Effect, Stream } from "effect"
3701
3796
  *
@@ -3712,17 +3807,24 @@ export const orDie = self => fromChannel(Channel.orDie(self.channel));
3712
3807
  * // Output: [ 1, 2, 3 ]
3713
3808
  * ```
3714
3809
  *
3715
- * @example
3810
+ * **Example** (Configuring ignore logging)
3811
+ *
3716
3812
  * ```ts
3717
- * import { Stream } from "effect"
3813
+ * import { Effect, Stream } from "effect"
3718
3814
  *
3719
- * const stream = Stream.fail("boom")
3815
+ * Effect.runPromise(Effect.gen(function*() {
3816
+ * const values = yield* Stream.fail("boom").pipe(
3817
+ * Stream.ignore({ log: false }),
3818
+ * Stream.runCollect
3819
+ * )
3820
+ * yield* Effect.sync(() => console.log(values))
3821
+ * }))
3720
3822
  *
3721
- * const program = stream.pipe(Stream.ignore({ log: "Error" }))
3823
+ * // []
3722
3824
  * ```
3723
3825
  *
3826
+ * @category error handling
3724
3827
  * @since 4.0.0
3725
- * @category Error Handling
3726
3828
  */
3727
3829
  export const ignore = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => fromChannel(Channel.ignore(self.channel, options)));
3728
3830
  /**
@@ -3730,20 +3832,25 @@ export const ignore = /*#__PURE__*/dual(args => isStream(args[0]), (self, option
3730
3832
  *
3731
3833
  * Use the `log` option to emit the full {@link Cause} when the stream fails.
3732
3834
  *
3733
- * @example
3835
+ * **Example** (Ignoring stream failure causes)
3836
+ *
3734
3837
  * ```ts
3735
3838
  * import { Effect, Stream } from "effect"
3736
3839
  *
3737
- * const stream = Stream.make(1, 2).pipe(
3738
- * Stream.concat(Stream.fail("boom")),
3739
- * Stream.ignoreCause({ log: "Error" })
3740
- * )
3840
+ * Effect.runPromise(Effect.gen(function*() {
3841
+ * const values = yield* Stream.make(1, 2).pipe(
3842
+ * Stream.concat(Stream.die("boom")),
3843
+ * Stream.ignoreCause({ log: false }),
3844
+ * Stream.runCollect
3845
+ * )
3846
+ * yield* Effect.sync(() => console.log(values))
3847
+ * }))
3741
3848
  *
3742
- * const program = Stream.runCollect(stream)
3849
+ * // [ 1, 2 ]
3743
3850
  * ```
3744
3851
  *
3852
+ * @category error handling
3745
3853
  * @since 4.0.0
3746
- * @category Error Handling
3747
3854
  */
3748
3855
  export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => fromChannel(Channel.ignoreCause(self.channel, options)));
3749
3856
  /**
@@ -3755,7 +3862,8 @@ export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, o
3755
3862
  * The schedule is reset as soon as the first element passes through the
3756
3863
  * stream again.
3757
3864
  *
3758
- * @example
3865
+ * **Example** (Retrying stream failures)
3866
+ *
3759
3867
  * ```ts
3760
3868
  * import { Console, Effect, Schedule, Stream } from "effect"
3761
3869
  *
@@ -3774,8 +3882,8 @@ export const ignoreCause = /*#__PURE__*/dual(args => isStream(args[0]), (self, o
3774
3882
  * // Output: [ 1, 1 ]
3775
3883
  * ```
3776
3884
  *
3885
+ * @category error handling
3777
3886
  * @since 2.0.0
3778
- * @category Error Handling
3779
3887
  */
3780
3888
  export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.retry(self.channel, policy)));
3781
3889
  /**
@@ -3786,9 +3894,10 @@ export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.
3786
3894
  * `preventFallbackOnPartialStream` to fail instead of mixing partial output with
3787
3895
  * a later fallback.
3788
3896
  *
3789
- * @example
3897
+ * **Example** (Applying an execution plan)
3898
+ *
3790
3899
  * ```ts
3791
- * import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
3900
+ * import { Console, Context, Effect, ExecutionPlan, Layer, Stream } from "effect"
3792
3901
  *
3793
3902
  * class Service extends Context.Service<Service>()("Service", {
3794
3903
  * make: Effect.succeed({
@@ -3815,9 +3924,8 @@ export const retry = /*#__PURE__*/dual(2, (self, policy) => fromChannel(Channel.
3815
3924
  * // Output: [ 1, 2, 3 ]
3816
3925
  * ```
3817
3926
  *
3927
+ * @category error handling
3818
3928
  * @since 3.16.0
3819
- * @category Error Handling
3820
- * @experimental
3821
3929
  */
3822
3930
  export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (self, policy, options) => suspend(() => {
3823
3931
  const preventFallbackOnPartialStream = options?.preventFallbackOnPartialStream ?? false;
@@ -3873,7 +3981,8 @@ export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (s
3873
3981
  /**
3874
3982
  * Takes the first `n` elements from this stream, returning `Stream.empty` when `n < 1`.
3875
3983
  *
3876
- * @example
3984
+ * **Example** (Taking values from the left)
3985
+ *
3877
3986
  * ```ts
3878
3987
  * import { Console, Effect, Stream } from "effect"
3879
3988
  *
@@ -3889,14 +3998,15 @@ export const withExecutionPlan = /*#__PURE__*/dual(args => isStream(args[0]), (s
3889
3998
  * // Output: [ 1, 2, 3 ]
3890
3999
  * ```
3891
4000
  *
4001
+ * @category filtering
3892
4002
  * @since 2.0.0
3893
- * @category Filtering
3894
4003
  */
3895
4004
  export const take = /*#__PURE__*/dual(2, (self, n) => n < 1 ? empty : takeUntil(self, (_, i) => i === n - 1));
3896
4005
  /**
3897
4006
  * Keeps the last `n` elements from this stream.
3898
4007
  *
3899
- * @example
4008
+ * **Example** (Taking elements from the right)
4009
+ *
3900
4010
  * ```ts
3901
4011
  * import { Console, Effect, Stream } from "effect"
3902
4012
  *
@@ -3912,8 +4022,8 @@ export const take = /*#__PURE__*/dual(2, (self, n) => n < 1 ? empty : takeUntil(
3912
4022
  * // Output: [ 4, 5, 6 ]
3913
4023
  * ```
3914
4024
  *
4025
+ * @category filtering
3915
4026
  * @since 2.0.0
3916
- * @category Filtering
3917
4027
  */
3918
4028
  export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, MutableList.make, (list, arr) => {
3919
4029
  MutableList.appendAll(list, arr);
@@ -3931,7 +4041,8 @@ export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, M
3931
4041
  *
3932
4042
  * When `excludeLast` is `true`, the matching element is dropped.
3933
4043
  *
3934
- * @example
4044
+ * **Example** (Taking until a predicate matches)
4045
+ *
3935
4046
  * ```ts
3936
4047
  * import { Console, Effect, Stream } from "effect"
3937
4048
  *
@@ -3954,8 +4065,8 @@ export const takeRight = /*#__PURE__*/dual(2, (self, n) => mapAccumArray(self, M
3954
4065
  * })
3955
4066
  * ```
3956
4067
  *
4068
+ * @category filtering
3957
4069
  * @since 2.0.0
3958
- * @category Filtering
3959
4070
  */
3960
4071
  export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => Effect.sync(() => {
3961
4072
  let i = 0;
@@ -3974,7 +4085,8 @@ export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, pre
3974
4085
  /**
3975
4086
  * Effectful predicate version of `takeUntil`.
3976
4087
  *
3977
- * @example
4088
+ * **Example** (Taking until an effectful predicate matches)
4089
+ *
3978
4090
  * ```ts
3979
4091
  * import { Console, Effect, Stream } from "effect"
3980
4092
  *
@@ -3990,8 +4102,8 @@ export const takeUntil = /*#__PURE__*/dual(args => isStream(args[0]), (self, pre
3990
4102
  * // Output: [ 1, 2, 3 ]
3991
4103
  * ```
3992
4104
  *
4105
+ * @category filtering
3993
4106
  * @since 2.0.0
3994
- * @category Filtering
3995
4107
  */
3996
4108
  export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, predicate, options) => transformPull(self, (pull, _scope) => Effect.sync(() => {
3997
4109
  let i = 0;
@@ -4012,7 +4124,8 @@ export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (sel
4012
4124
  /**
4013
4125
  * Takes the longest initial prefix of elements that satisfy the predicate.
4014
4126
  *
4015
- * @example
4127
+ * **Example** (Taking while a predicate holds)
4128
+ *
4016
4129
  * ```ts
4017
4130
  * import { Console, Effect, Stream } from "effect"
4018
4131
  *
@@ -4029,8 +4142,8 @@ export const takeUntilEffect = /*#__PURE__*/dual(args => isStream(args[0]), (sel
4029
4142
  * // Output: [ 1, 2 ]
4030
4143
  * ```
4031
4144
  *
4145
+ * @category filtering
4032
4146
  * @since 2.0.0
4033
- * @category Filtering
4034
4147
  */
4035
4148
  export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
4036
4149
  let i = 0;
@@ -4049,10 +4162,13 @@ export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull
4049
4162
  return pump;
4050
4163
  })));
4051
4164
  /**
4052
- * Takes the longest initial prefix of elements that satisfy the filter.
4165
+ * Takes the longest initial prefix accepted by a `Filter` and emits the
4166
+ * filter's success values.
4053
4167
  *
4168
+ * The stream stops at the first `Result.fail` returned by the filter.
4169
+ *
4170
+ * @category filtering
4054
4171
  * @since 4.0.0
4055
- * @category Filtering
4056
4172
  */
4057
4173
  export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformPull(self, (pull, _scope) => Effect.sync(() => {
4058
4174
  let done = false;
@@ -4073,7 +4189,8 @@ export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
4073
4189
  /**
4074
4190
  * Takes elements from the stream while the effectful predicate is `true`.
4075
4191
  *
4076
- * @example
4192
+ * **Example** (Effectfully taking while a predicate holds)
4193
+ *
4077
4194
  * ```ts
4078
4195
  * import { Console, Effect, Stream } from "effect"
4079
4196
  *
@@ -4089,8 +4206,8 @@ export const takeWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
4089
4206
  * // Output: [ 1, 2 ]
4090
4207
  * ```
4091
4208
  *
4092
- * @since 2.0.0
4093
- * @category Filtering
4209
+ * @category filtering
4210
+ * @since 4.0.0
4094
4211
  */
4095
4212
  export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUntilEffect(self, (a, n) => Effect.map(predicate(a, n), b => !b), {
4096
4213
  excludeLast: true
@@ -4098,7 +4215,8 @@ export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUnt
4098
4215
  /**
4099
4216
  * Drops the first `n` elements from this stream.
4100
4217
  *
4101
- * @example
4218
+ * **Example** (Dropping values from the left)
4219
+ *
4102
4220
  * ```ts
4103
4221
  * import { Console, Effect, Stream } from "effect"
4104
4222
  *
@@ -4114,8 +4232,8 @@ export const takeWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => takeUnt
4114
4232
  * // Output: [ 3, 4, 5 ]
4115
4233
  * ```
4116
4234
  *
4235
+ * @category filtering
4117
4236
  * @since 2.0.0
4118
- * @category Filtering
4119
4237
  */
4120
4238
  export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull, _scope) => Effect.sync(() => {
4121
4239
  let dropped = 0;
@@ -4131,7 +4249,8 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull,
4131
4249
  * Drops elements until the specified predicate evaluates to `true`, then drops
4132
4250
  * that matching element.
4133
4251
  *
4134
- * @example
4252
+ * **Example** (Dropping until a predicate matches)
4253
+ *
4135
4254
  * ```ts
4136
4255
  * import { Console, Effect, Stream } from "effect"
4137
4256
  *
@@ -4144,8 +4263,8 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => transformPull(self, (pull,
4144
4263
  * })
4145
4264
  * ```
4146
4265
  *
4266
+ * @category filtering
4147
4267
  * @since 2.0.0
4148
- * @category Filtering
4149
4268
  */
4150
4269
  export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhile(self, (a, i) => !predicate(a, i)), 1));
4151
4270
  /**
@@ -4154,7 +4273,8 @@ export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhil
4154
4273
  *
4155
4274
  * The first element that satisfies the predicate is also dropped.
4156
4275
  *
4157
- * @example
4276
+ * **Example** (Dropping until an effectful predicate matches)
4277
+ *
4158
4278
  * ```ts
4159
4279
  * import { Console, Effect, Stream } from "effect"
4160
4280
  *
@@ -4170,14 +4290,15 @@ export const dropUntil = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhil
4170
4290
  * // Output: [ 4, 5 ]
4171
4291
  * ```
4172
4292
  *
4293
+ * @category filtering
4173
4294
  * @since 2.0.0
4174
- * @category Filtering
4175
4295
  */
4176
4296
  export const dropUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => drop(dropWhileEffect(self, (a, i) => Effect.map(predicate(a, i), b => !b)), 1));
4177
4297
  /**
4178
4298
  * Drops elements from the stream while the specified predicate evaluates to `true`.
4179
4299
  *
4180
- * @example
4300
+ * **Example** (Dropping while a predicate holds)
4301
+ *
4181
4302
  * ```ts
4182
4303
  * import { Console, Effect, Stream } from "effect"
4183
4304
  *
@@ -4193,8 +4314,8 @@ export const dropUntilEffect = /*#__PURE__*/dual(2, (self, predicate) => drop(dr
4193
4314
  * // Output: [ 3, 4, 5 ]
4194
4315
  * ```
4195
4316
  *
4317
+ * @category filtering
4196
4318
  * @since 2.0.0
4197
- * @category Filtering
4198
4319
  */
4199
4320
  export const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
4200
4321
  let dropping = true;
@@ -4210,8 +4331,8 @@ export const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => transformPull
4210
4331
  /**
4211
4332
  * Drops elements while the filter succeeds.
4212
4333
  *
4334
+ * @category filtering
4213
4335
  * @since 4.0.0
4214
- * @category Filtering
4215
4336
  */
4216
4337
  export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformPull(self, (pull, _scope) => Effect.sync(() => {
4217
4338
  let dropping = true;
@@ -4226,7 +4347,8 @@ export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
4226
4347
  /**
4227
4348
  * Drops elements while the specified effectful predicate evaluates to `true`.
4228
4349
  *
4229
- * @example
4350
+ * **Example** (Effectfully dropping while a predicate holds)
4351
+ *
4230
4352
  * ```ts
4231
4353
  * import { Console, Effect, Stream } from "effect"
4232
4354
  *
@@ -4242,8 +4364,8 @@ export const dropWhileFilter = /*#__PURE__*/dual(2, (self, filter) => transformP
4242
4364
  * // Output: [ 3, 4, 5 ]
4243
4365
  * ```
4244
4366
  *
4367
+ * @category filtering
4245
4368
  * @since 2.0.0
4246
- * @category Filtering
4247
4369
  */
4248
4370
  export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transformPull(self, (pull, _scope) => Effect.sync(() => {
4249
4371
  let dropping = true;
@@ -4266,7 +4388,8 @@ export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transfo
4266
4388
  *
4267
4389
  * Keeps the last `n` elements in memory to drop them on completion.
4268
4390
  *
4269
- * @example
4391
+ * **Example** (Dropping values from the right)
4392
+ *
4270
4393
  * ```ts
4271
4394
  * import { Console, Effect, Stream } from "effect"
4272
4395
  *
@@ -4282,8 +4405,8 @@ export const dropWhileEffect = /*#__PURE__*/dual(2, (self, predicate) => transfo
4282
4405
  * // Output: [ 1, 2, 3 ]
4283
4406
  * ```
4284
4407
  *
4408
+ * @category filtering
4285
4409
  * @since 2.0.0
4286
- * @category Filtering
4287
4410
  */
4288
4411
  export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
4289
4412
  if (n <= 0) return self;
@@ -4301,7 +4424,8 @@ export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
4301
4424
  /**
4302
4425
  * Exposes the underlying chunks as a stream of non-empty arrays.
4303
4426
  *
4304
- * @example
4427
+ * **Example** (Exposing stream chunks)
4428
+ *
4305
4429
  * ```ts
4306
4430
  * import { Console, Effect, Stream } from "effect"
4307
4431
  *
@@ -4318,8 +4442,8 @@ export const dropRight = /*#__PURE__*/dual(2, (self, n) => {
4318
4442
  * // Output: [ [ 1, 2 ], [ 3, 4 ] ]
4319
4443
  * ```
4320
4444
  *
4321
- * @since 2.0.0
4322
4445
  * @category Grouping
4446
+ * @since 2.0.0
4323
4447
  */
4324
4448
  export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel);
4325
4449
  /**
@@ -4327,7 +4451,8 @@ export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel
4327
4451
  *
4328
4452
  * The size is clamped to at least 1.
4329
4453
  *
4330
- * @example
4454
+ * **Example** (Rechunking stream elements)
4455
+ *
4331
4456
  * ```ts
4332
4457
  * import { Console, Effect, Stream } from "effect"
4333
4458
  *
@@ -4344,8 +4469,8 @@ export const chunks = self => self.channel.pipe(Channel.map(Arr.of), fromChannel
4344
4469
  * // Output: [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ]
4345
4470
  * ```
4346
4471
  *
4347
- * @since 2.0.0
4348
4472
  * @category Grouping
4473
+ * @since 2.0.0
4349
4474
  */
4350
4475
  export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
4351
4476
  target = Math.max(1, target);
@@ -4390,9 +4515,10 @@ export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
4390
4515
  /**
4391
4516
  * Emits a sliding window of `n` elements.
4392
4517
  *
4393
- * @example
4518
+ * **Example** (Emitting sliding windows)
4519
+ *
4394
4520
  * ```ts
4395
- * import { Console, Effect, Stream, pipe } from "effect"
4521
+ * import { Console, Effect, pipe, Stream } from "effect"
4396
4522
  *
4397
4523
  * Effect.gen(function*() {
4398
4524
  * const result = yield* pipe(
@@ -4405,13 +4531,15 @@ export const rechunk = /*#__PURE__*/dual(2, (self, target) => {
4405
4531
  * // Output: [ [1, 2], [2, 3], [3, 4], [4, 5] ]
4406
4532
  * ```
4407
4533
  *
4408
- * @since 2.0.0
4409
4534
  * @category Grouping
4535
+ * @since 2.0.0
4410
4536
  */
4411
4537
  export const sliding = /*#__PURE__*/dual(2, (self, chunkSize) => slidingSize(self, chunkSize, 1));
4412
4538
  /**
4413
4539
  * Emits sliding windows of `chunkSize` elements, advancing by `stepSize`.
4414
4540
  *
4541
+ * **Example** (Emitting sliding windows with a step size)
4542
+ *
4415
4543
  * ```ts
4416
4544
  * import { Console, Effect, Stream } from "effect"
4417
4545
  *
@@ -4427,8 +4555,8 @@ export const sliding = /*#__PURE__*/dual(2, (self, chunkSize) => slidingSize(sel
4427
4555
  * // Output: [ [ 1, 2, 3 ], [ 3, 4, 5 ] ]
4428
4556
  * ```
4429
4557
  *
4430
- * @since 2.0.0
4431
4558
  * @category Grouping
4559
+ * @since 2.0.0
4432
4560
  */
4433
4561
  export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => transformPull(self, (upstream, _scope) => Effect.sync(() => {
4434
4562
  let cause = null;
@@ -4468,7 +4596,8 @@ export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => t
4468
4596
  *
4469
4597
  * Matching elements act as delimiters and are not included in the output.
4470
4598
  *
4471
- * @example
4599
+ * **Example** (Splitting on matching values)
4600
+ *
4472
4601
  * ```ts
4473
4602
  * import { Console, Effect, Stream } from "effect"
4474
4603
  *
@@ -4484,8 +4613,8 @@ export const slidingSize = /*#__PURE__*/dual(3, (self, chunkSize, stepSize) => t
4484
4613
  * // Output: [ [1, 2, 3], [5, 6, 7], [9] ]
4485
4614
  * ```
4486
4615
  *
4487
- * @since 2.0.0
4488
4616
  * @category Grouping
4617
+ * @since 2.0.0
4489
4618
  */
4490
4619
  export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(self, Arr.empty, (acc, arr) => {
4491
4620
  const out = Arr.empty();
@@ -4512,7 +4641,8 @@ export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(sel
4512
4641
  * Where possible, prefer `Stream.combineArray` for a more efficient
4513
4642
  * implementation.
4514
4643
  *
4515
- * @example
4644
+ * **Example** (Combining streams with state)
4645
+ *
4516
4646
  * ```ts
4517
4647
  * import { Console, Effect, Stream } from "effect"
4518
4648
  *
@@ -4535,8 +4665,8 @@ export const split = /*#__PURE__*/dual(2, (self, predicate) => mapAccumArray(sel
4535
4665
  * // Output: [ "L:A", "R:1", "L:B", "R:2", "L:C", "R:3" ]
4536
4666
  * ```
4537
4667
  *
4538
- * @since 2.0.0
4539
4668
  * @category Merging
4669
+ * @since 2.0.0
4540
4670
  */
4541
4671
  export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combine(Channel.flattenArray(self.channel), Channel.flattenArray(that.channel), s, f).pipe(Channel.map(Arr.of), fromChannel));
4542
4672
  /**
@@ -4546,13 +4676,8 @@ export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combin
4546
4676
  * internal state to control the combining process, with the initial state
4547
4677
  * being specified by `s`.
4548
4678
  *
4549
- * **Previously Known As**
4550
- *
4551
- * This API replaces the following from Effect 3.x:
4679
+ * **Example** (Combining stream chunks with state)
4552
4680
  *
4553
- * - `Stream.combineChunks`
4554
- *
4555
- * @example
4556
4681
  * ```ts
4557
4682
  * import { Console, Effect, Stream } from "effect"
4558
4683
  *
@@ -4577,14 +4702,15 @@ export const combine = /*#__PURE__*/dual(4, (self, that, s, f) => Channel.combin
4577
4702
  * // Output: [ 1, 2, 10, 20 ]
4578
4703
  * ```
4579
4704
  *
4580
- * @since 2.0.0
4581
- * @category Sequencing
4705
+ * @category sequencing
4706
+ * @since 4.0.0
4582
4707
  */
4583
4708
  export const combineArray = /*#__PURE__*/dual(4, (self, that, s, f) => fromChannel(Channel.combine(self.channel, that.channel, s, f)));
4584
4709
  /**
4585
4710
  * Statefully maps elements, emitting zero or more outputs per input.
4586
4711
  *
4587
- * @example
4712
+ * **Example** (Statefully mapping stream values)
4713
+ *
4588
4714
  * ```ts
4589
4715
  * import { Console, Effect, Stream } from "effect"
4590
4716
  *
@@ -4604,8 +4730,8 @@ export const combineArray = /*#__PURE__*/dual(4, (self, that, s, f) => fromChann
4604
4730
  * // Output: [ 0, 1, 3, 6, 10, 15, 21 ]
4605
4731
  * ```
4606
4732
  *
4733
+ * @category mapping
4607
4734
  * @since 2.0.0
4608
- * @category Mapping
4609
4735
  */
4610
4736
  export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => {
4611
4737
  const acc = Arr.empty();
@@ -4626,7 +4752,8 @@ export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, init
4626
4752
  *
4627
4753
  * The mapping function runs once per chunk and the state is threaded across chunks.
4628
4754
  *
4629
- * @example
4755
+ * **Example** (Statefully mapping stream chunks)
4756
+ *
4630
4757
  * ```ts
4631
4758
  * import { Console, Effect, Stream } from "effect"
4632
4759
  *
@@ -4646,8 +4773,8 @@ export const mapAccum = /*#__PURE__*/dual(args => isStream(args[0]), (self, init
4646
4773
  * // Output: [ 3, 10, 21 ]
4647
4774
  * ```
4648
4775
  *
4649
- * @since 2.0.0
4650
- * @category Mapping
4776
+ * @category mapping
4777
+ * @since 4.0.0
4651
4778
  */
4652
4779
  export const mapAccumArray = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => fromChannel(Channel.mapAccum(self.channel, initial, (state, arr) => {
4653
4780
  const [newState, values] = f(state, arr);
@@ -4661,9 +4788,15 @@ export const mapAccumArray = /*#__PURE__*/dual(args => isStream(args[0]), (self,
4661
4788
  } : undefined)));
4662
4789
  const emptyArr = /*#__PURE__*/Arr.empty();
4663
4790
  /**
4664
- * Statefully and effectfully maps over the elements of this stream to produce new elements.
4791
+ * Statefully and effectfully maps each element, emitting zero or more output
4792
+ * values per input.
4793
+ *
4794
+ * The mapping effect receives the current state and element, then returns the
4795
+ * next state plus the values to emit. The state is threaded through the
4796
+ * stream.
4797
+ *
4798
+ * **Example** (Effectfully mapping stream values with state)
4665
4799
  *
4666
- * @example
4667
4800
  * ```ts
4668
4801
  * import { Console, Effect, Stream } from "effect"
4669
4802
  *
@@ -4682,8 +4815,8 @@ const emptyArr = /*#__PURE__*/Arr.empty();
4682
4815
  * // Output: [ 1, 2, 3 ]
4683
4816
  * ```
4684
4817
  *
4818
+ * @category mapping
4685
4819
  * @since 2.0.0
4686
- * @category Mapping
4687
4820
  */
4688
4821
  export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, initial, f, options) => self.channel.pipe(Channel.flattenArray, Channel.mapAccum(initial, (state, a) => Effect.map(f(state, a), ([state, values]) => [state, Arr.isReadonlyArrayNonEmpty(values) ? Arr.of(values) : Arr.empty()]), options?.onHalt ? {
4689
4822
  onHalt(state) {
@@ -4692,9 +4825,14 @@ export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self
4692
4825
  }
4693
4826
  } : undefined), fromChannel));
4694
4827
  /**
4695
- * Statefully and effectfully maps over chunks of this stream to emit new values.
4828
+ * Statefully and effectfully maps each non-empty input chunk, emitting zero or
4829
+ * more output values per chunk.
4830
+ *
4831
+ * The mapping effect receives the current state and chunk, then returns the
4832
+ * next state plus the values to emit. The state is threaded across chunks.
4833
+ *
4834
+ * **Example** (Effectfully mapping stream chunks with state)
4696
4835
  *
4697
- * @example
4698
4836
  * ```ts
4699
4837
  * import { Console, Effect, Stream } from "effect"
4700
4838
  *
@@ -4716,8 +4854,8 @@ export const mapAccumEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self
4716
4854
  * // Output: [ 3, 10 ]
4717
4855
  * ```
4718
4856
  *
4719
- * @since 2.0.0
4720
- * @category Mapping
4857
+ * @category mapping
4858
+ * @since 4.0.0
4721
4859
  */
4722
4860
  export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (self, initial, f, options) => self.channel.pipe(Channel.mapAccum(initial, (state, a) => Effect.map(f(state, a), ([state, values]) => [state, Arr.isReadonlyArrayNonEmpty(values) ? Arr.of(values) : emptyArr]), options?.onHalt ? {
4723
4861
  onHalt(state) {
@@ -4728,7 +4866,8 @@ export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (se
4728
4866
  /**
4729
4867
  * Accumulates state across the stream, emitting the initial state and each updated state.
4730
4868
  *
4731
- * @example
4869
+ * **Example** (Scanning stream state)
4870
+ *
4732
4871
  * ```ts
4733
4872
  * import { Console, Effect, Stream } from "effect"
4734
4873
  *
@@ -4744,8 +4883,8 @@ export const mapAccumArrayEffect = /*#__PURE__*/dual(args => isStream(args), (se
4744
4883
  * // Output: [ 0, 1, 3, 6 ]
4745
4884
  * ```
4746
4885
  *
4747
- * @since 2.0.0
4748
4886
  * @category Accumulation
4887
+ * @since 2.0.0
4749
4888
  */
4750
4889
  export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
4751
4890
  let isFirst = true;
@@ -4765,7 +4904,8 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
4765
4904
  /**
4766
4905
  * Effectfully accumulates state and emits the initial state plus each accumulated state.
4767
4906
  *
4768
- * @example
4907
+ * **Example** (Effectfully scanning stream state)
4908
+ *
4769
4909
  * ```ts
4770
4910
  * import { Console, Effect, Stream } from "effect"
4771
4911
  *
@@ -4779,14 +4919,15 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => suspend(() => {
4779
4919
  * })
4780
4920
  * ```
4781
4921
  *
4782
- * @since 2.0.0
4783
4922
  * @category Accumulation
4923
+ * @since 2.0.0
4784
4924
  */
4785
4925
  export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => self.channel.pipe(Channel.flattenArray, Channel.scanEffect(initial, f), Channel.map(Arr.of), fromChannel));
4786
4926
  /**
4787
4927
  * Drops earlier elements within the debounce window and emits only the latest element after the pause.
4788
4928
  *
4789
- * @example
4929
+ * **Example** (Debouncing stream elements)
4930
+ *
4790
4931
  * ```ts
4791
4932
  * import { Console, Duration, Effect, Stream } from "effect"
4792
4933
  *
@@ -4803,8 +4944,8 @@ export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => self.channe
4803
4944
  * })
4804
4945
  * ```
4805
4946
  *
4806
- * @since 2.0.0
4807
4947
  * @category Rate Limiting
4948
+ * @since 2.0.0
4808
4949
  */
4809
4950
  export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(self, Effect.fnUntraced(function* (pull, scope) {
4810
4951
  const clock = yield* Clock;
@@ -4873,7 +5014,8 @@ export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(s
4873
5014
  *
4874
5015
  * Defaults to the "shape" strategy.
4875
5016
  *
4876
- * @example
5017
+ * **Example** (Throttling stream chunks effectfully)
5018
+ *
4877
5019
  * ```ts
4878
5020
  * import { Console, Effect, Schedule, Stream } from "effect"
4879
5021
  *
@@ -4894,8 +5036,8 @@ export const debounce = /*#__PURE__*/dual(2, (self, duration) => transformPull(s
4894
5036
  * // Output: [0, 1, 2, 3, 4, 5]
4895
5037
  * ```
4896
5038
  *
4897
- * @since 2.0.0
4898
5039
  * @category Rate Limiting
5040
+ * @since 2.0.0
4899
5041
  */
4900
5042
  export const throttleEffect = /*#__PURE__*/dual(2, (self, options) => {
4901
5043
  const burst = options.burst ?? 0;
@@ -4969,7 +5111,8 @@ const throttleShapeEffect = (self, cost, units, duration, burst) => transformPul
4969
5111
  *
4970
5112
  * Defaults to the "shape" strategy.
4971
5113
  *
4972
- * @example
5114
+ * **Example** (Throttling stream chunks)
5115
+ *
4973
5116
  * ```ts
4974
5117
  * import { Console, Effect, Schedule, Stream } from "effect"
4975
5118
  *
@@ -4990,8 +5133,8 @@ const throttleShapeEffect = (self, cost, units, duration, burst) => transformPul
4990
5133
  * })
4991
5134
  * ```
4992
5135
  *
4993
- * @since 2.0.0
4994
5136
  * @category Rate Limiting
5137
+ * @since 2.0.0
4995
5138
  */
4996
5139
  export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(self, {
4997
5140
  ...options,
@@ -5002,7 +5145,8 @@ export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(s
5002
5145
  *
5003
5146
  * The final array may be smaller if there are not enough elements to fill it.
5004
5147
  *
5005
- * @example
5148
+ * **Example** (Grouping elements by size)
5149
+ *
5006
5150
  * ```ts
5007
5151
  * import { Console, Effect, Stream } from "effect"
5008
5152
  *
@@ -5018,15 +5162,16 @@ export const throttle = /*#__PURE__*/dual(2, (self, options) => throttleEffect(s
5018
5162
  * // Output: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ]
5019
5163
  * ```
5020
5164
  *
5021
- * @since 2.0.0
5022
5165
  * @category Grouping
5166
+ * @since 2.0.0
5023
5167
  */
5024
5168
  export const grouped = /*#__PURE__*/dual(2, (self, n) => chunks(rechunk(self, n)));
5025
5169
  /**
5026
5170
  * Partitions the stream into arrays, emitting when the chunk size is reached
5027
5171
  * or the duration passes.
5028
5172
  *
5029
- * @example
5173
+ * **Example** (Grouping elements by size or time)
5174
+ *
5030
5175
  * ```ts
5031
5176
  * import { Console, Effect, Stream } from "effect"
5032
5177
  *
@@ -5042,14 +5187,15 @@ export const grouped = /*#__PURE__*/dual(2, (self, n) => chunks(rechunk(self, n)
5042
5187
  * // Output: [ [ 1, 2 ], [ 3 ] ]
5043
5188
  * ```
5044
5189
  *
5045
- * @since 2.0.0
5046
5190
  * @category Grouping
5191
+ * @since 2.0.0
5047
5192
  */
5048
5193
  export const groupedWithin = /*#__PURE__*/dual(3, (self, chunkSize, duration) => aggregateWithin(self, Sink.take(chunkSize), Schedule.spaced(duration)));
5049
5194
  /**
5050
5195
  * Groups elements into keyed substreams using an effectful classifier.
5051
5196
  *
5052
- * @example
5197
+ * **Example** (Grouping elements into keyed substreams using an effectful classifier)
5198
+ *
5053
5199
  * ```ts
5054
5200
  * import { Console, Effect, Stream } from "effect"
5055
5201
  *
@@ -5074,8 +5220,8 @@ export const groupedWithin = /*#__PURE__*/dual(3, (self, chunkSize, duration) =>
5074
5220
  * // Output: [ [ "odd", [ 1, 3, 5 ] ], [ "even", [ 2, 4 ] ] ]
5075
5221
  * ```
5076
5222
  *
5077
- * @since 2.0.0
5078
5223
  * @category Grouping
5224
+ * @since 2.0.0
5079
5225
  */
5080
5226
  export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => groupByImpl(self, Effect.fnUntraced(function* (arr, queues, queueMap) {
5081
5227
  for (let i = 0; i < arr.length; i++) {
@@ -5089,7 +5235,8 @@ export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
5089
5235
  /**
5090
5236
  * Groups elements by a key and emits a stream per key.
5091
5237
  *
5092
- * @example
5238
+ * **Example** (Grouping elements by key)
5239
+ *
5093
5240
  * ```ts
5094
5241
  * import { Console, Effect, Stream } from "effect"
5095
5242
  *
@@ -5112,8 +5259,8 @@ export const groupBy = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, op
5112
5259
  * // Output: [ [ "odd", [ 1, 3, 5 ] ], [ "even", [ 2, 4 ] ] ]
5113
5260
  * ```
5114
5261
  *
5115
- * @since 2.0.0
5116
5262
  * @category Grouping
5263
+ * @since 2.0.0
5117
5264
  */
5118
5265
  export const groupByKey = /*#__PURE__*/dual(args => isStream(args[0]), (self, f, options) => suspend(() => {
5119
5266
  const batch = MutableHashMap.empty();
@@ -5160,8 +5307,14 @@ const groupByImpl = (self, f, options) => transformPullBracket(self, Effect.fnUn
5160
5307
  return Queue.takeAll(out);
5161
5308
  }));
5162
5309
  /**
5163
- * @since 2.0.0
5310
+ * Groups consecutive elements that have equal keys into non-empty arrays.
5311
+ *
5312
+ * The key is computed with `f`; adjacent elements whose keys are equal by
5313
+ * `Equal.equals` are emitted as one `[key, group]`. Later non-adjacent runs
5314
+ * with the same key are emitted separately.
5315
+ *
5164
5316
  * @category Grouping
5317
+ * @since 2.0.0
5165
5318
  */
5166
5319
  export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
5167
5320
  let currentKey = undefined;
@@ -5201,7 +5354,8 @@ export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(s
5201
5354
  /**
5202
5355
  * Applies a sink transducer to the stream and emits each sink result.
5203
5356
  *
5204
- * @example
5357
+ * **Example** (Transducing with a sink)
5358
+ *
5205
5359
  * ```ts
5206
5360
  * import { Console, Effect, Sink, Stream } from "effect"
5207
5361
  *
@@ -5216,8 +5370,8 @@ export const groupAdjacentBy = /*#__PURE__*/dual(2, (self, f) => transformPull(s
5216
5370
  * })
5217
5371
  * ```
5218
5372
  *
5219
- * @since 2.0.0
5220
5373
  * @category Aggregation
5374
+ * @since 2.0.0
5221
5375
  */
5222
5376
  export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self, (upstream, scope) => Effect.sync(() => {
5223
5377
  let done;
@@ -5245,7 +5399,8 @@ export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self
5245
5399
  * The stream runs the upstream and downstream in separate fibers, so the sink can keep
5246
5400
  * consuming input while downstream is busy processing the previous output.
5247
5401
  *
5248
- * @example
5402
+ * **Example** (Aggregating with a sink)
5403
+ *
5249
5404
  * ```ts
5250
5405
  * import { Console, Effect, Sink, Stream } from "effect"
5251
5406
  *
@@ -5262,8 +5417,8 @@ export const transduce = /*#__PURE__*/dual(2, (self, sink) => transformPull(self
5262
5417
  * // [ 6, 15 ]
5263
5418
  * ```
5264
5419
  *
5265
- * @since 2.0.0
5266
5420
  * @category Aggregation
5421
+ * @since 2.0.0
5267
5422
  */
5268
5423
  export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(self, sink, Schedule.forever));
5269
5424
  /**
@@ -5271,7 +5426,8 @@ export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(se
5271
5426
  *
5272
5427
  * The schedule can flush the current aggregation even if the sink has not finished.
5273
5428
  *
5274
- * @example
5429
+ * **Example** (Aggregating with a sink and schedule)
5430
+ *
5275
5431
  * ```ts
5276
5432
  * import { Console, Effect, Schedule, Sink, Stream } from "effect"
5277
5433
  *
@@ -5289,8 +5445,8 @@ export const aggregate = /*#__PURE__*/dual(2, (self, sink) => aggregateWithin(se
5289
5445
  * // Output: [ 6, 15 ]
5290
5446
  * ```
5291
5447
  *
5292
- * @since 2.0.0
5293
5448
  * @category Aggregation
5449
+ * @since 2.0.0
5294
5450
  */
5295
5451
  export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function* (_upstream, _, scope) {
5296
5452
  const pull = yield* Channel.toPullScoped(self.channel, _);
@@ -5348,12 +5504,63 @@ export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fr
5348
5504
  return Effect.succeed(Effect.suspend(() => sink.transform(sinkUpstream, scope)));
5349
5505
  }).pipe(Effect.flatMap(pull => Effect.raceFirst(catchSinkHalt(pull), stepToBuffer)));
5350
5506
  }))));
5507
+ /**
5508
+ * Fan out the stream, producing a fixed-size tuple of streams that each emit
5509
+ * the same elements as the source stream.
5510
+ *
5511
+ * The source stream starts after all downstream streams have been subscribed.
5512
+ * With the default suspend strategy, the source can only advance `capacity`
5513
+ * chunks ahead of the slowest downstream stream. If a downstream stream is
5514
+ * interrupted, it unsubscribes from the broadcast so it no longer contributes
5515
+ * backpressure.
5516
+ *
5517
+ * **Example** (Broadcasting to two consumers)
5518
+ *
5519
+ * ```ts
5520
+ * import { Console, Effect, Stream } from "effect"
5521
+ *
5522
+ * const program = Effect.scoped(
5523
+ * Effect.gen(function*() {
5524
+ * const [left, right] = yield* Stream.make(1, 2, 3).pipe(
5525
+ * Stream.broadcastN({ n: 2, capacity: 8 })
5526
+ * )
5527
+ *
5528
+ * const values = yield* Effect.all([
5529
+ * Stream.runCollect(left),
5530
+ * Stream.runCollect(right)
5531
+ * ], { concurrency: "unbounded" })
5532
+ *
5533
+ * yield* Console.log(values)
5534
+ * })
5535
+ * )
5536
+ *
5537
+ * Effect.runPromise(program)
5538
+ * // Output: [[1, 2, 3], [1, 2, 3]]
5539
+ * ```
5540
+ *
5541
+ * @category Broadcast
5542
+ * @since 4.0.0
5543
+ */
5544
+ export const broadcastN = /*#__PURE__*/dual(2, /*#__PURE__*/Effect.fnUntraced(function* (self, options) {
5545
+ const pubsub = yield* makePubSub(options);
5546
+ const streams = new Array(options.n);
5547
+ const parentScope = yield* Scope.Scope;
5548
+ for (let i = 0; i < options.n; i++) {
5549
+ const scope = Scope.forkUnsafe(parentScope);
5550
+ const subscription = yield* PubSub.subscribe(pubsub).pipe(Effect.provideService(Scope.Scope, scope));
5551
+ streams[i] = Channel.fromEffectTake(PubSub.take(subscription)).pipe(Channel.onExit(exit => Scope.close(scope, exit)), fromChannel);
5552
+ }
5553
+ yield* Channel.runForEach(self.channel, value => PubSub.publish(pubsub, value)).pipe(Effect.onExit(exit => PubSub.publish(pubsub, exit)), Effect.forkScoped);
5554
+ return streams;
5555
+ }));
5556
+ const makePubSub = options => Effect.acquireRelease(options.capacity === "unbounded" ? PubSub.unbounded(options) : options.strategy === "dropping" ? PubSub.dropping(options) : options.strategy === "sliding" ? PubSub.sliding(options) : PubSub.bounded(options), PubSub.shutdown);
5351
5557
  /**
5352
5558
  * Creates a PubSub-backed stream that multicasts the source to all subscribers.
5353
5559
  *
5354
5560
  * The returned stream is scoped and uses the provided PubSub capacity and replay settings.
5355
5561
  *
5356
- * @example
5562
+ * **Example** (Broadcasting a stream)
5563
+ *
5357
5564
  * ```ts
5358
5565
  * import { Console, Effect, Stream } from "effect"
5359
5566
  *
@@ -5377,8 +5584,8 @@ export const aggregateWithin = /*#__PURE__*/dual(3, (self, sink, schedule) => fr
5377
5584
  * // Output: [[1, 2, 3], [1, 2, 3]]
5378
5585
  * ```
5379
5586
  *
5380
- * @since 2.0.0
5381
5587
  * @category Broadcast
5588
+ * @since 2.0.0
5382
5589
  */
5383
5590
  export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPubSubTake(self, options), fromPubSubTake));
5384
5591
  /**
@@ -5388,7 +5595,8 @@ export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPu
5388
5595
  * If `idleTimeToLive` is set, the upstream is kept alive for that duration so a later subscriber can continue from
5389
5596
  * the next element instead of restarting.
5390
5597
  *
5391
- * @example
5598
+ * **Example** (Sharing a stream)
5599
+ *
5392
5600
  * ```ts
5393
5601
  * import { Console, Effect, Stream } from "effect"
5394
5602
  *
@@ -5409,8 +5617,8 @@ export const broadcast = /*#__PURE__*/dual(2, (self, options) => Effect.map(toPu
5409
5617
  * // output: [[1], [1]]
5410
5618
  * ```
5411
5619
  *
5412
- * @since 2.0.0
5413
5620
  * @category Broadcast
5621
+ * @since 3.8.0
5414
5622
  */
5415
5623
  export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.make({
5416
5624
  acquire: broadcast(self, options),
@@ -5422,7 +5630,8 @@ export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.ma
5422
5630
  * The channel receives `NonEmptyReadonlyArray` chunks and can transform both the
5423
5631
  * output elements and error type.
5424
5632
  *
5425
- * @example
5633
+ * **Example** (Piping through a channel)
5634
+ *
5426
5635
  * ```ts
5427
5636
  * import { Array, Channel, Console, Effect, Stream } from "effect"
5428
5637
  *
@@ -5445,8 +5654,8 @@ export const share = /*#__PURE__*/dual(2, (self, options) => Effect.map(RcRef.ma
5445
5654
  * // => [2, 4, 6]
5446
5655
  * ```
5447
5656
  *
5448
- * @since 2.0.0
5449
5657
  * @category Pipe
5658
+ * @since 2.0.0
5450
5659
  */
5451
5660
  export const pipeThroughChannel = /*#__PURE__*/dual(2, (self, channel) => fromChannel(Channel.pipeTo(self.channel, channel)));
5452
5661
  /**
@@ -5456,35 +5665,31 @@ export const pipeThroughChannel = /*#__PURE__*/dual(2, (self, channel) => fromCh
5456
5665
  * Upstream failures are not passed to the channel, so the resulting stream can
5457
5666
  * fail with either the original stream error or the channel error.
5458
5667
  *
5459
- * @example
5668
+ * **Example** (Piping through a channel with failures)
5669
+ *
5460
5670
  * ```ts
5461
- * import type { Channel } from "effect"
5462
- * import { Console, Effect, Stream } from "effect"
5671
+ * import { Array, Channel, Effect, Stream } from "effect"
5463
5672
  *
5464
- * declare const transformChannel: Channel.Channel<
5465
- * readonly [string, ...Array<string>],
5466
- * "ChannelError",
5467
- * unknown,
5468
- * readonly [number, ...Array<number>],
5469
- * "StreamError",
5470
- * unknown,
5471
- * never
5472
- * >
5673
+ * type NumberChunk = readonly [number, ...Array<number>]
5674
+ *
5675
+ * const stringifyChunks = Channel.identity<NumberChunk, "StreamError", unknown>().pipe(
5676
+ * Channel.map((chunk) => Array.map(chunk, String))
5677
+ * )
5473
5678
  *
5474
5679
  * Effect.runPromise(Effect.gen(function*() {
5475
5680
  * const result = yield* Stream.make(1, 2, 3).pipe(
5476
- * Stream.pipeThroughChannelOrFail(transformChannel),
5681
+ * Stream.rechunk(2),
5682
+ * Stream.pipeThroughChannelOrFail(stringifyChunks),
5477
5683
  * Stream.runCollect
5478
5684
  * )
5479
5685
  *
5480
- * yield* Console.log(result)
5686
+ * yield* Effect.sync(() => console.log(result))
5481
5687
  * }))
5482
- * // Output:
5483
- * // ["1", "2", "3"]
5688
+ * // [ "1", "2", "3" ]
5484
5689
  * ```
5485
5690
  *
5486
- * @since 2.0.0
5487
5691
  * @category Pipe
5692
+ * @since 2.0.0
5488
5693
  */
5489
5694
  export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) => fromChannel(Channel.pipeToOrFail(self.channel, channel)));
5490
5695
  /**
@@ -5492,7 +5697,8 @@ export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) =>
5492
5697
  *
5493
5698
  * If the sink completes mid-chunk, the remaining elements become the output stream.
5494
5699
  *
5495
- * @example
5700
+ * **Example** (Piping through a sink)
5701
+ *
5496
5702
  * ```ts
5497
5703
  * import { Console, Effect, Sink, Stream } from "effect"
5498
5704
  *
@@ -5509,14 +5715,15 @@ export const pipeThroughChannelOrFail = /*#__PURE__*/dual(2, (self, channel) =>
5509
5715
  * //=> [ 3, 4 ]
5510
5716
  * ```
5511
5717
  *
5512
- * @since 2.0.0
5513
5718
  * @category Pipe
5719
+ * @since 2.0.0
5514
5720
  */
5515
5721
  export const pipeThrough = /*#__PURE__*/dual(2, (self, sink) => self.channel.pipe(Channel.pipeToOrFail(Sink.toChannel(sink)), Channel.concatWith(([_, leftover]) => leftover ? Channel.succeed(leftover) : Channel.empty), fromChannel));
5516
5722
  /**
5517
5723
  * Collects all elements into an array and emits it as a single element.
5518
5724
  *
5519
- * @example
5725
+ * **Example** (Collecting values into a stream element)
5726
+ *
5520
5727
  * ```ts
5521
5728
  * import { Console, Effect, Stream } from "effect"
5522
5729
  *
@@ -5531,14 +5738,15 @@ export const pipeThrough = /*#__PURE__*/dual(2, (self, sink) => self.channel.pip
5531
5738
  * // [1, 2, 3]
5532
5739
  * ```
5533
5740
  *
5534
- * @since 2.0.0
5535
5741
  * @category Accumulation
5742
+ * @since 4.0.0
5536
5743
  */
5537
5744
  export const collect = self => fromEffect(runCollect(self));
5538
5745
  /**
5539
5746
  * Accumulates elements into a growing array, emitting the cumulative array for each input chunk.
5540
5747
  *
5541
- * @example
5748
+ * **Example** (Accumulating stream elements)
5749
+ *
5542
5750
  * ```ts
5543
5751
  * import { Console, Effect, Stream } from "effect"
5544
5752
  *
@@ -5556,8 +5764,8 @@ export const collect = self => fromEffect(runCollect(self));
5556
5764
  * //=> { _id: 'Chunk', values: [ [ 1 ], [ 1, 2 ], [ 1, 2, 3 ] ] }
5557
5765
  * ```
5558
5766
  *
5559
- * @since 2.0.0
5560
5767
  * @category Accumulation
5768
+ * @since 2.0.0
5561
5769
  */
5562
5770
  export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
5563
5771
  const combined = Arr.appendAll(acc, as);
@@ -5566,7 +5774,8 @@ export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
5566
5774
  /**
5567
5775
  * Emits only elements that differ from the previous one.
5568
5776
  *
5569
- * @example
5777
+ * **Example** (Emitting changed values)
5778
+ *
5570
5779
  * ```ts
5571
5780
  * import { Console, Effect, Stream } from "effect"
5572
5781
  *
@@ -5583,14 +5792,15 @@ export const accumulate = self => mapAccumArray(self, Arr.empty, (acc, as) => {
5583
5792
  * // [1, 2, 3]
5584
5793
  * ```
5585
5794
  *
5586
- * @since 2.0.0
5587
5795
  * @category Deduplication
5796
+ * @since 2.0.0
5588
5797
  */
5589
5798
  export const changes = self => changesWith(self, Equal.equals);
5590
5799
  /**
5591
5800
  * Returns a stream that only emits elements that are not equal to the previously emitted element, as determined by the specified predicate.
5592
5801
  *
5593
- * @example
5802
+ * **Example** (Emitting values that changed by equivalence)
5803
+ *
5594
5804
  * ```ts
5595
5805
  * import { Console, Effect, Stream } from "effect"
5596
5806
  *
@@ -5607,8 +5817,8 @@ export const changes = self => changesWith(self, Equal.equals);
5607
5817
  * // ["A", "B"]
5608
5818
  * ```
5609
5819
  *
5610
- * @since 2.0.0
5611
5820
  * @category Deduplication
5821
+ * @since 2.0.0
5612
5822
  */
5613
5823
  export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
5614
5824
  let first = true;
@@ -5636,7 +5846,8 @@ export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self,
5636
5846
  *
5637
5847
  * The predicate runs for each element after the first; returning `true` treats it as equal and skips it.
5638
5848
  *
5639
- * @example
5849
+ * **Example** (Effectfully emitting changed values)
5850
+ *
5640
5851
  * ```ts
5641
5852
  * import { Console, Effect, Stream } from "effect"
5642
5853
  *
@@ -5652,8 +5863,8 @@ export const changesWith = /*#__PURE__*/dual(2, (self, f) => transformPull(self,
5652
5863
  * // { _id: "Chunk", values: [ 1, 2, 3 ] }
5653
5864
  * ```
5654
5865
  *
5655
- * @since 2.0.0
5656
5866
  * @category Deduplication
5867
+ * @since 2.0.0
5657
5868
  */
5658
5869
  export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull(self, (pull, _scope) => Effect.sync(() => {
5659
5870
  let first = true;
@@ -5679,7 +5890,8 @@ export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull
5679
5890
  /**
5680
5891
  * Decodes Uint8Array chunks into strings using TextDecoder with an optional encoding.
5681
5892
  *
5682
- * @example
5893
+ * **Example** (Decoding Uint8Array chunks into strings using TextDecoder with an optional encoding)
5894
+ *
5683
5895
  * ```ts
5684
5896
  * import { Console, Effect, Stream } from "effect"
5685
5897
  *
@@ -5701,8 +5913,8 @@ export const changesWithEffect = /*#__PURE__*/dual(2, (self, f) => transformPull
5701
5913
  * // ["Hello", " World"]
5702
5914
  * ```
5703
5915
  *
5916
+ * @category encoding
5704
5917
  * @since 2.0.0
5705
- * @category Encoding
5706
5918
  */
5707
5919
  export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => suspend(() => {
5708
5920
  const decoder = new TextDecoder(options?.encoding);
@@ -5713,7 +5925,8 @@ export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, op
5713
5925
  /**
5714
5926
  * Encodes a stream of strings into UTF-8 `Uint8Array` chunks.
5715
5927
  *
5716
- * @example
5928
+ * **Example** (Encoding a stream of strings into UTF-8 Uint8Array chunks)
5929
+ *
5717
5930
  * ```ts
5718
5931
  * import { Console, Effect, Stream } from "effect"
5719
5932
  *
@@ -5729,8 +5942,8 @@ export const decodeText = /*#__PURE__*/dual(args => isStream(args[0]), (self, op
5729
5942
  * // [[72, 101, 108, 108, 111], [32], [87, 111, 114, 108, 100]]
5730
5943
  * ```
5731
5944
  *
5945
+ * @category encoding
5732
5946
  * @since 2.0.0
5733
- * @category Encoding
5734
5947
  */
5735
5948
  export const encodeText = self => suspend(() => {
5736
5949
  const encoder = new TextEncoder();
@@ -5739,7 +5952,8 @@ export const encodeText = self => suspend(() => {
5739
5952
  /**
5740
5953
  * Splits a stream of strings into lines, handling `\n`, `\r`, and `\r\n` delimiters across chunks.
5741
5954
  *
5742
- * @example
5955
+ * **Example** (Splitting streamed text into lines)
5956
+ *
5743
5957
  * ```ts
5744
5958
  * import { Console, Effect, Stream } from "effect"
5745
5959
  *
@@ -5752,14 +5966,15 @@ export const encodeText = self => suspend(() => {
5752
5966
  * // ["a", "b", "c"]
5753
5967
  * ```
5754
5968
  *
5969
+ * @category encoding
5755
5970
  * @since 2.0.0
5756
- * @category Encoding
5757
5971
  */
5758
5972
  export const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.splitLines()), fromChannel);
5759
5973
  /**
5760
5974
  * Inserts the provided element between emitted elements.
5761
5975
  *
5762
- * @example
5976
+ * **Example** (Interspersing stream elements)
5977
+ *
5763
5978
  * ```ts
5764
5979
  * import { Console, Effect, Stream } from "effect"
5765
5980
  *
@@ -5773,8 +5988,8 @@ export const splitLines = self => self.channel.pipe(Channel.pipeTo(Channel.split
5773
5988
  * // [1, 0, 2, 0, 3, 0, 4]
5774
5989
  * ```
5775
5990
  *
5991
+ * @category sequencing
5776
5992
  * @since 2.0.0
5777
- * @category Sequencing
5778
5993
  */
5779
5994
  export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self, (arr, i) => {
5780
5995
  const out = i === 0 ? [] : [element];
@@ -5793,7 +6008,8 @@ export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self
5793
6008
  *
5794
6009
  * The start and end values are always emitted, even when the stream is empty.
5795
6010
  *
5796
- * @example
6011
+ * **Example** (Interspersing stream affixes)
6012
+ *
5797
6013
  * ```ts
5798
6014
  * import { Console, Effect, Stream } from "effect"
5799
6015
  *
@@ -5810,8 +6026,8 @@ export const intersperse = /*#__PURE__*/dual(2, (self, element) => mapArray(self
5810
6026
  * // [ "[", "a", ",", "b", ",", "c", "]" ]
5811
6027
  * ```
5812
6028
  *
6029
+ * @category sequencing
5813
6030
  * @since 2.0.0
5814
- * @category Sequencing
5815
6031
  */
5816
6032
  export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succeed(options.start).pipe(concat(intersperse(self, options.middle)), concat(succeed(options.end))));
5817
6033
  /**
@@ -5819,7 +6035,8 @@ export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succee
5819
6035
  * each stream; when one ends, the remaining values from the other stream are
5820
6036
  * emitted.
5821
6037
  *
5822
- * @example
6038
+ * **Example** (Interleaving streams)
6039
+ *
5823
6040
  * ```ts
5824
6041
  * import { Console, Effect, Stream } from "effect"
5825
6042
  *
@@ -5836,8 +6053,8 @@ export const intersperseAffixes = /*#__PURE__*/dual(2, (self, options) => succee
5836
6053
  * Effect.runPromise(program)
5837
6054
  * // [2, 5, 3, 6, 7]
5838
6055
  * ```
5839
- * @since 2.0.0
5840
6056
  * @category Merging
6057
+ * @since 2.0.0
5841
6058
  */
5842
6059
  export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(self, that, fromIterable(Iterable.forever([true, false]))));
5843
6060
  /**
@@ -5846,7 +6063,8 @@ export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(se
5846
6063
  * The decider controls how many elements are pulled; if one side ends, pulls for
5847
6064
  * that side are ignored.
5848
6065
  *
5849
- * @example
6066
+ * **Example** (Interleaving two streams deterministically by following a boolean decider stream)
6067
+ *
5850
6068
  * ```ts
5851
6069
  * import { Console, Effect, Stream } from "effect"
5852
6070
  *
@@ -5866,8 +6084,8 @@ export const interleave = /*#__PURE__*/dual(2, (self, that) => interleaveWith(se
5866
6084
  * // [ 1, 2, 4, 3, 5 ]
5867
6085
  * ```
5868
6086
  *
5869
- * @since 2.0.0
5870
6087
  * @category Merging
6088
+ * @since 2.0.0
5871
6089
  */
5872
6090
  export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => fromChannel(Channel.fromTransform(Effect.fnUntraced(function* (upstream, scope) {
5873
6091
  const pullDecider = yield* Channel.toTransform(Channel.flattenArray(decider.channel))(upstream, scope);
@@ -5905,7 +6123,8 @@ export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => from
5905
6123
  * If the effect completes with a failure before the stream completes, the
5906
6124
  * returned stream will emit that failure.
5907
6125
  *
5908
- * @example
6126
+ * **Example** (Interrupting when an effect completes)
6127
+ *
5909
6128
  * ```ts
5910
6129
  * import { Console, Deferred, Effect, Stream } from "effect"
5911
6130
  *
@@ -5928,14 +6147,15 @@ export const interleaveWith = /*#__PURE__*/dual(3, (self, that, decider) => from
5928
6147
  * // => [1, 2]
5929
6148
  * ```
5930
6149
  *
5931
- * @since 2.0.0
5932
6150
  * @category Interruption
6151
+ * @since 2.0.0
5933
6152
  */
5934
6153
  export const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Channel.interruptWhen(self.channel, effect)));
5935
6154
  /**
5936
6155
  * Halts evaluation after the current element once the provided effect completes; the effect is forked, its success is discarded, failures fail the stream, and it does not interrupt an in-progress pull (use `interruptWhen` for that).
5937
6156
  *
5938
- * @example
6157
+ * **Example** (Halting a stream after an effect completes)
6158
+ *
5939
6159
  * ```ts
5940
6160
  * import { Console, Deferred, Effect, Stream } from "effect"
5941
6161
  *
@@ -5954,14 +6174,15 @@ export const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(
5954
6174
  * // [1, 2]
5955
6175
  * ```
5956
6176
  *
5957
- * @since 2.0.0
5958
6177
  * @category Interruption
6178
+ * @since 2.0.0
5959
6179
  */
5960
6180
  export const haltWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Channel.haltWhen(self.channel, effect)));
5961
6181
  /**
5962
6182
  * Runs the provided finalizer when the stream exits, passing the exit value.
5963
6183
  *
5964
- * @example
6184
+ * **Example** (Running a finalizer on exit)
6185
+ *
5965
6186
  * ```ts
5966
6187
  * import { Console, Effect, Exit, Stream } from "effect"
5967
6188
  *
@@ -5980,8 +6201,8 @@ export const haltWhen = /*#__PURE__*/dual(2, (self, effect) => fromChannel(Chann
5980
6201
  * // Stream completed successfully
5981
6202
  * ```
5982
6203
  *
5983
- * @since 4.0.0
5984
6204
  * @category Finalization
6205
+ * @since 4.0.0
5985
6206
  */
5986
6207
  export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Channel.onExit(self.channel, finalizer)));
5987
6208
  /**
@@ -5990,7 +6211,8 @@ export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Chan
5990
6211
  * Note: Unlike `Effect.onError` there is no guarantee that the provided
5991
6212
  * effect will not be interrupted.
5992
6213
  *
5993
- * @example
6214
+ * **Example** (Running an effect on errors)
6215
+ *
5994
6216
  * ```ts
5995
6217
  * import { Cause, Console, Effect, Stream } from "effect"
5996
6218
  *
@@ -6008,14 +6230,15 @@ export const onExit = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Chan
6008
6230
  * // Stream failed: boom
6009
6231
  * ```
6010
6232
  *
6233
+ * @category error handling
6011
6234
  * @since 2.0.0
6012
- * @category Error Handling
6013
6235
  */
6014
6236
  export const onError = /*#__PURE__*/dual(2, (self, cleanup) => fromChannel(Channel.onError(self.channel, cleanup)));
6015
6237
  /**
6016
6238
  * Runs the provided effect before this stream starts.
6017
6239
  *
6018
- * @example
6240
+ * **Example** (Running an effect on start)
6241
+ *
6019
6242
  * ```ts
6020
6243
  * import { Console, Effect, Stream } from "effect"
6021
6244
  *
@@ -6034,14 +6257,15 @@ export const onError = /*#__PURE__*/dual(2, (self, cleanup) => fromChannel(Chann
6034
6257
  * // [1, 2, 3]
6035
6258
  * ```
6036
6259
  *
6037
- * @since 4.0.0
6038
- * @category Sequencing
6260
+ * @category sequencing
6261
+ * @since 3.6.0
6039
6262
  */
6040
6263
  export const onStart = /*#__PURE__*/dual(2, (self, onStart) => fromChannel(Channel.onStart(self.channel, onStart)));
6041
6264
  /**
6042
6265
  * Runs the provided effect with the first element emitted by the stream.
6043
6266
  *
6044
- * @example
6267
+ * **Example** (Running an effect on the first value)
6268
+ *
6045
6269
  * ```ts
6046
6270
  * import { Console, Effect, Stream } from "effect"
6047
6271
  *
@@ -6054,14 +6278,15 @@ export const onStart = /*#__PURE__*/dual(2, (self, onStart) => fromChannel(Chann
6054
6278
  * // Output: first=1
6055
6279
  * ```
6056
6280
  *
6281
+ * @category sequencing
6057
6282
  * @since 4.0.0
6058
- * @category Sequencing
6059
6283
  */
6060
6284
  export const onFirst = /*#__PURE__*/dual(2, (self, onFirst) => fromChannel(Channel.onFirst(self.channel, arr => onFirst(arr[0]))));
6061
6285
  /**
6062
6286
  * Runs the provided effect when the stream ends successfully.
6063
6287
  *
6064
- * @example
6288
+ * **Example** (Running an effect on end)
6289
+ *
6065
6290
  * ```ts
6066
6291
  * import { Console, Effect, Stream } from "effect"
6067
6292
  *
@@ -6078,14 +6303,15 @@ export const onFirst = /*#__PURE__*/dual(2, (self, onFirst) => fromChannel(Chann
6078
6303
  * // [1, 2, 3]
6079
6304
  * ```
6080
6305
  *
6081
- * @since 4.0.0
6082
- * @category Sequencing
6306
+ * @category sequencing
6307
+ * @since 3.6.0
6083
6308
  */
6084
6309
  export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => fromChannel(Channel.onEnd(self.channel, onEnd)));
6085
6310
  /**
6086
6311
  * Executes the provided finalizer after this stream's finalizers run.
6087
6312
  *
6088
- * @example
6313
+ * **Example** (Ensuring finalization)
6314
+ *
6089
6315
  * ```ts
6090
6316
  * import { Console, Effect, Stream } from "effect"
6091
6317
  *
@@ -6103,8 +6329,8 @@ export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => fromChannel(Channel.o
6103
6329
  * //=> [1, 2]
6104
6330
  * ```
6105
6331
  *
6106
- * @since 4.0.0
6107
6332
  * @category Finalization
6333
+ * @since 2.0.0
6108
6334
  */
6109
6335
  export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Channel.ensuring(self.channel, finalizer)));
6110
6336
  /**
@@ -6112,11 +6338,10 @@ export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Ch
6112
6338
  * service requirements. Use `options.local` to build the layer every time; by
6113
6339
  * default, layers are shared between provide calls.
6114
6340
  *
6115
- * **Previously Known As:** `provideSomeLayer`, `provideSomeContext`.
6341
+ * **Example** (Providing stream requirements)
6116
6342
  *
6117
- * @example
6118
6343
  * ```ts
6119
- * import { Console, Effect, Layer, Context, Stream } from "effect"
6344
+ * import { Console, Context, Effect, Layer, Stream } from "effect"
6120
6345
  *
6121
6346
  * class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
6122
6347
  *
@@ -6140,16 +6365,17 @@ export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => fromChannel(Ch
6140
6365
  * // ["Hello, Ada"]
6141
6366
  * ```
6142
6367
  *
6368
+ * @category services
6143
6369
  * @since 4.0.0
6144
- * @category Services
6145
6370
  */
6146
6371
  export const provide = /*#__PURE__*/dual(args => isStream(args[0]), (self, layer, options) => fromChannel(Channel.provide(self.channel, layer, options)));
6147
6372
  /**
6148
6373
  * Provides multiple services to the stream using a context.
6149
6374
  *
6150
- * @example
6375
+ * **Example** (Providing multiple services to the stream using a context)
6376
+ *
6151
6377
  * ```ts
6152
- * import { Console, Effect, Context, Stream } from "effect"
6378
+ * import { Console, Context, Effect, Stream } from "effect"
6153
6379
  *
6154
6380
  * class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
6155
6381
  * class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
@@ -6175,17 +6401,18 @@ export const provide = /*#__PURE__*/dual(args => isStream(args[0]), (self, layer
6175
6401
  * // ["Hello!"]
6176
6402
  * ```
6177
6403
  *
6178
- * @since 4.0.0
6179
- * @category Services
6404
+ * @category services
6405
+ * @since 2.0.0
6180
6406
  */
6181
6407
  export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromChannel(Channel.provideContext(self.channel, context)));
6182
6408
  /**
6183
6409
  * Provides the stream with a single required service, eliminating that
6184
6410
  * requirement from its environment.
6185
6411
  *
6186
- * @example
6412
+ * **Example** (Providing a stream service)
6413
+ *
6187
6414
  * ```ts
6188
- * import { Console, Effect, Context, Stream } from "effect"
6415
+ * import { Console, Context, Effect, Stream } from "effect"
6189
6416
  *
6190
6417
  * class Greeter extends Context.Service<Greeter, {
6191
6418
  * greet: (name: string) => string
@@ -6212,16 +6439,17 @@ export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromChanne
6212
6439
  * //=> ["Hello, Ada"]
6213
6440
  * ```
6214
6441
  *
6215
- * @since 4.0.0
6216
- * @category Services
6442
+ * @category services
6443
+ * @since 2.0.0
6217
6444
  */
6218
6445
  export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromChannel(Channel.provideService(self.channel, key, service)));
6219
6446
  /**
6220
6447
  * Provides a service to the stream using an effect, removing the requirement and adding the effect's error and environment.
6221
6448
  *
6222
- * @example
6449
+ * **Example** (Providing a stream service effectfully)
6450
+ *
6223
6451
  * ```ts
6224
- * import { Console, Effect, Context, Stream } from "effect"
6452
+ * import { Console, Context, Effect, Stream } from "effect"
6225
6453
  *
6226
6454
  * class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
6227
6455
  *
@@ -6251,17 +6479,18 @@ export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromC
6251
6479
  * // ["https://example.com"]
6252
6480
  * ```
6253
6481
  *
6254
- * @since 4.0.0
6255
- * @category Services
6482
+ * @category services
6483
+ * @since 2.0.0
6256
6484
  */
6257
6485
  export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) => fromChannel(Channel.provideServiceEffect(self.channel, key, service)));
6258
6486
  /**
6259
6487
  * Transforms the stream's required services by mapping the current context
6260
6488
  * to a new one.
6261
6489
  *
6262
- * @example
6490
+ * **Example** (Updating the stream context)
6491
+ *
6263
6492
  * ```ts
6264
- * import { Console, Effect, Context, Stream } from "effect"
6493
+ * import { Console, Context, Effect, Stream } from "effect"
6265
6494
  *
6266
6495
  * class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
6267
6496
  * class Config extends Context.Service<Config, { name: string }>()("Config") {}
@@ -6291,16 +6520,17 @@ export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) =>
6291
6520
  * //=> [ "Hello World" ]
6292
6521
  * ```
6293
6522
  *
6294
- * @since 2.0.0
6295
- * @category Services
6523
+ * @category services
6524
+ * @since 4.0.0
6296
6525
  */
6297
6526
  export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromChannel(Channel.updateContext(self.channel, f)));
6298
6527
  /**
6299
6528
  * Updates a single service in the stream environment by applying a function.
6300
6529
  *
6301
- * @example
6530
+ * **Example** (Updating a stream service)
6531
+ *
6302
6532
  * ```ts
6303
- * import { Console, Effect, Context, Stream } from "effect"
6533
+ * import { Console, Context, Effect, Stream } from "effect"
6304
6534
  *
6305
6535
  * class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
6306
6536
  *
@@ -6317,14 +6547,15 @@ export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromChannel(Chann
6317
6547
  * // Output: Updated count: 1
6318
6548
  * ```
6319
6549
  *
6550
+ * @category services
6320
6551
  * @since 2.0.0
6321
- * @category Services
6322
6552
  */
6323
6553
  export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateContext(self, context => Context.add(context, service, f(Context.get(context, service)))));
6324
6554
  /**
6325
6555
  * Wraps the stream with a new span for tracing.
6326
6556
  *
6327
- * @example
6557
+ * **Example** (Wrapping a stream in a span)
6558
+ *
6328
6559
  * ```ts
6329
6560
  * import { Console, Effect, Stream } from "effect"
6330
6561
  *
@@ -6339,8 +6570,8 @@ export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateCo
6339
6570
  * // [1, 2, 3]
6340
6571
  * ```
6341
6572
  *
6342
- * @since 4.0.0
6343
- * @category Tracing
6573
+ * @category tracing
6574
+ * @since 2.0.0
6344
6575
  */
6345
6576
  export const withSpan = function () {
6346
6577
  const dataFirst = isStream(arguments[0]);
@@ -6355,9 +6586,10 @@ export const withSpan = function () {
6355
6586
  /**
6356
6587
  * Provides the entry point for do-notation style stream composition.
6357
6588
  *
6358
- * @example
6589
+ * **Example** (Starting stream do notation)
6590
+ *
6359
6591
  * ```ts
6360
- * import { Console, Effect, Stream, pipe } from "effect"
6592
+ * import { Console, Effect, pipe, Stream } from "effect"
6361
6593
  *
6362
6594
  * const program = pipe(
6363
6595
  * Stream.Do,
@@ -6374,8 +6606,8 @@ export const withSpan = function () {
6374
6606
  * //=> [{ value: 1, next: 2 }, { value: 2, next: 3 }]
6375
6607
  * ```
6376
6608
  *
6377
- * @since 4.0.0
6378
6609
  * @category Do Notation
6610
+ * @since 2.0.0
6379
6611
  */
6380
6612
  export const Do = /*#__PURE__*/succeed({});
6381
6613
  const let_ = /*#__PURE__*/dual(3, (self, name, f) => map(self, a => ({
@@ -6386,7 +6618,8 @@ export {
6386
6618
  /**
6387
6619
  * Adds a computed field to the current Do-notation record.
6388
6620
  *
6389
- * @example
6621
+ * **Example** (Adding a computed field)
6622
+ *
6390
6623
  * ```ts
6391
6624
  * import { Console, Effect, Stream } from "effect"
6392
6625
  *
@@ -6404,14 +6637,15 @@ export {
6404
6637
  * // [{ x: 2, y: 6 }]
6405
6638
  * ```
6406
6639
  *
6407
- * @since 4.0.0
6408
6640
  * @category Do Notation
6641
+ * @since 2.0.0
6409
6642
  */
6410
6643
  let_ as let };
6411
6644
  /**
6412
6645
  * Binds the result of a stream to a field in the do-notation record.
6413
6646
  *
6414
- * @example
6647
+ * **Example** (Binding a stream value)
6648
+ *
6415
6649
  * ```ts
6416
6650
  * import { Console, Effect, Stream } from "effect"
6417
6651
  *
@@ -6426,8 +6660,8 @@ let_ as let };
6426
6660
  * // [{ a: 1, b: 2 }, { a: 2, b: 3 }]
6427
6661
  * ```
6428
6662
  *
6429
- * @since 4.0.0
6430
6663
  * @category Do Notation
6664
+ * @since 2.0.0
6431
6665
  */
6432
6666
  export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f, options) => flatMap(self, a => map(f(a), b => ({
6433
6667
  ...a,
@@ -6436,7 +6670,8 @@ export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f,
6436
6670
  /**
6437
6671
  * Binds an Effect-produced value into the do-notation record for each stream element.
6438
6672
  *
6439
- * @example
6673
+ * **Example** (Binding an effect value)
6674
+ *
6440
6675
  * ```ts
6441
6676
  * import { Console, Effect, Stream } from "effect"
6442
6677
  *
@@ -6454,8 +6689,8 @@ export const bind = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f,
6454
6689
  * // [{ value: 1, double: 2 }, { value: 2, double: 4 }]
6455
6690
  * ```
6456
6691
  *
6457
- * @since 4.0.0
6458
6692
  * @category Do Notation
6693
+ * @since 2.0.0
6459
6694
  */
6460
6695
  export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, tag, f, options) => mapEffect(self, a => Effect.map(f(a), b => ({
6461
6696
  ...a,
@@ -6464,7 +6699,8 @@ export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, ta
6464
6699
  /**
6465
6700
  * Maps each element into a record keyed by the provided name.
6466
6701
  *
6467
- * @example
6702
+ * **Example** (Binding values to a record key)
6703
+ *
6468
6704
  * ```ts
6469
6705
  * import { Console, Effect, Stream } from "effect"
6470
6706
  *
@@ -6477,7 +6713,7 @@ export const bindEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, ta
6477
6713
  * ```
6478
6714
  *
6479
6715
  * @category Do Notation
6480
- * @since 4.0.0
6716
+ * @since 2.0.0
6481
6717
  */
6482
6718
  export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
6483
6719
  [name]: a
@@ -6485,7 +6721,8 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
6485
6721
  /**
6486
6722
  * Runs a stream with a sink and returns the sink result.
6487
6723
  *
6488
- * @example
6724
+ * **Example** (Running a stream with a sink)
6725
+ *
6489
6726
  * ```ts
6490
6727
  * import { Console, Effect, Sink, Stream } from "effect"
6491
6728
  *
@@ -6495,14 +6732,15 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, a => ({
6495
6732
  * // 6
6496
6733
  * ```
6497
6734
  *
6735
+ * @category destructors
6498
6736
  * @since 2.0.0
6499
- * @category Destructors
6500
6737
  */
6501
6738
  export const run = /*#__PURE__*/dual(2, (self, sink) => Effect.scopedWith(scope => Channel.toPullScoped(self.channel, scope).pipe(Effect.flatMap(upstream => sink.transform(upstream, scope)), Effect.map(([a]) => a))));
6502
6739
  /**
6503
6740
  * Runs the stream and collects all elements into an array.
6504
6741
  *
6505
- * @example
6742
+ * **Example** (Collecting stream values)
6743
+ *
6506
6744
  * ```ts
6507
6745
  * import { Console, Effect, Stream } from "effect"
6508
6746
  *
@@ -6517,8 +6755,8 @@ export const run = /*#__PURE__*/dual(2, (self, sink) => Effect.scopedWith(scope
6517
6755
  * // [1, 2, 3, 4, 5]
6518
6756
  * ```
6519
6757
  *
6758
+ * @category destructors
6520
6759
  * @since 2.0.0
6521
- * @category Destructors
6522
6760
  */
6523
6761
  export const runCollect = self => Channel.runFold(self.channel, () => [], (acc, chunk) => {
6524
6762
  for (let i = 0; i < chunk.length; i++) {
@@ -6529,7 +6767,8 @@ export const runCollect = self => Channel.runFold(self.channel, () => [], (acc,
6529
6767
  /**
6530
6768
  * Runs the stream and returns the number of elements emitted.
6531
6769
  *
6532
- * @example
6770
+ * **Example** (Counting stream values)
6771
+ *
6533
6772
  * ```ts
6534
6773
  * import { Console, Effect, Stream } from "effect"
6535
6774
  *
@@ -6544,14 +6783,15 @@ export const runCollect = self => Channel.runFold(self.channel, () => [], (acc,
6544
6783
  * // 5
6545
6784
  * ```
6546
6785
  *
6786
+ * @category destructors
6547
6787
  * @since 2.0.0
6548
- * @category Destructors
6549
6788
  */
6550
6789
  export const runCount = self => Channel.runFold(self.channel, () => 0, (acc, chunk) => acc + chunk.length);
6551
6790
  /**
6552
6791
  * Runs the stream and returns the numeric sum of its elements.
6553
6792
  *
6554
- * @example
6793
+ * **Example** (Summing stream values)
6794
+ *
6555
6795
  * ```ts
6556
6796
  * import { Console, Effect, Stream } from "effect"
6557
6797
  *
@@ -6564,8 +6804,8 @@ export const runCount = self => Channel.runFold(self.channel, () => 0, (acc, chu
6564
6804
  * // 6
6565
6805
  * ```
6566
6806
  *
6807
+ * @category destructors
6567
6808
  * @since 2.0.0
6568
- * @category Destructors
6569
6809
  */
6570
6810
  export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk) => {
6571
6811
  for (let i = 0; i < chunk.length; i++) {
@@ -6576,7 +6816,8 @@ export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk
6576
6816
  /**
6577
6817
  * Runs the stream and folds elements using a pure reducer.
6578
6818
  *
6579
- * @example
6819
+ * **Example** (Folding stream values)
6820
+ *
6580
6821
  * ```ts
6581
6822
  * import { Console, Effect, Stream } from "effect"
6582
6823
  *
@@ -6593,8 +6834,8 @@ export const runSum = self => Channel.runFold(self.channel, () => 0, (acc, chunk
6593
6834
  * // 6
6594
6835
  * ```
6595
6836
  *
6837
+ * @category destructors
6596
6838
  * @since 2.0.0
6597
- * @category Destructors
6598
6839
  */
6599
6840
  export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFold(self.channel, initial, (acc, arr) => {
6600
6841
  for (let i = 0; i < arr.length; i++) {
@@ -6605,7 +6846,8 @@ export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFol
6605
6846
  /**
6606
6847
  * Runs the stream and folds elements using an effectful reducer.
6607
6848
  *
6608
- * @example
6849
+ * **Example** (Effectfully folding stream values)
6850
+ *
6609
6851
  * ```ts
6610
6852
  * import { Console, Effect, Stream } from "effect"
6611
6853
  *
@@ -6622,8 +6864,8 @@ export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFol
6622
6864
  * // 6
6623
6865
  * ```
6624
6866
  *
6867
+ * @category destructors
6625
6868
  * @since 2.0.0
6626
- * @category Destructors
6627
6869
  */
6628
6870
  export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.runFoldEffect(self.channel, initial, (acc, arr) => {
6629
6871
  let i = 0;
@@ -6640,7 +6882,8 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.
6640
6882
  /**
6641
6883
  * Runs the stream and returns the first element as an `Option`.
6642
6884
  *
6643
- * @example
6885
+ * **Example** (Getting the first stream value)
6886
+ *
6644
6887
  * ```ts
6645
6888
  * import { Console, Effect, Option, Stream } from "effect"
6646
6889
  *
@@ -6653,21 +6896,22 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Channel.
6653
6896
  * // 1
6654
6897
  * ```
6655
6898
  *
6899
+ * @category destructors
6656
6900
  * @since 2.0.0
6657
- * @category Destructors
6658
6901
  */
6659
6902
  export const runHead = self => Effect.map(Channel.runHead(self.channel), Option.map(Arr.getUnsafe(0)));
6660
6903
  /**
6661
6904
  * Runs the stream and returns the last element as an `Option`.
6662
6905
  *
6906
+ * @category destructors
6663
6907
  * @since 2.0.0
6664
- * @category Destructors
6665
6908
  */
6666
6909
  export const runLast = self => Effect.map(Channel.runLast(self.channel), Option.map(Arr.lastNonEmpty));
6667
6910
  /**
6668
6911
  * Runs the provided effectful callback for each element of the stream.
6669
6912
  *
6670
- * @example
6913
+ * **Example** (Running an effect for each value)
6914
+ *
6671
6915
  * ```ts
6672
6916
  * import { Console, Effect, Stream } from "effect"
6673
6917
  *
@@ -6683,8 +6927,8 @@ export const runLast = self => Effect.map(Channel.runLast(self.channel), Option.
6683
6927
  * // Processing: 3
6684
6928
  * ```
6685
6929
  *
6930
+ * @category destructors
6686
6931
  * @since 2.0.0
6687
- * @category Destructors
6688
6932
  */
6689
6933
  export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(self.channel, arr => {
6690
6934
  let i = 0;
@@ -6698,7 +6942,8 @@ export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(s
6698
6942
  * Runs the stream, applying the effectful predicate to each element and
6699
6943
  * stopping when it returns `false`.
6700
6944
  *
6701
- * @example
6945
+ * **Example** (Running effects while a predicate holds)
6946
+ *
6702
6947
  * ```ts
6703
6948
  * import { Console, Effect, Stream } from "effect"
6704
6949
  *
@@ -6719,8 +6964,8 @@ export const runForEach = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(s
6719
6964
  * // Processing: 3
6720
6965
  * ```
6721
6966
  *
6967
+ * @category destructors
6722
6968
  * @since 2.0.0
6723
- * @category Destructors
6724
6969
  */
6725
6970
  export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForEachWhile(self.channel, arr => {
6726
6971
  let done = false;
@@ -6737,7 +6982,8 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
6737
6982
  /**
6738
6983
  * Consumes the stream in chunks, passing each non-empty array to the callback.
6739
6984
  *
6740
- * @example
6985
+ * **Example** (Consuming stream chunks)
6986
+ *
6741
6987
  * ```ts
6742
6988
  * import { Console, Effect, Stream } from "effect"
6743
6989
  *
@@ -6753,14 +6999,15 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
6753
6999
  * // Processing chunk: 1, 2, 3, 4, 5
6754
7000
  * ```
6755
7001
  *
6756
- * @since 2.0.0
6757
- * @category Destructors
7002
+ * @category destructors
7003
+ * @since 4.0.0
6758
7004
  */
6759
7005
  export const runForEachArray = /*#__PURE__*/dual(2, (self, f) => Channel.runForEach(self.channel, f));
6760
7006
  /**
6761
7007
  * Runs the stream for its effects, discarding emitted elements.
6762
7008
  *
6763
- * @example
7009
+ * **Example** (Draining a stream run)
7010
+ *
6764
7011
  * ```ts
6765
7012
  * import { Console, Effect, Stream } from "effect"
6766
7013
  *
@@ -6778,8 +7025,8 @@ export const runForEachArray = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
6778
7025
  * // Processing: 3
6779
7026
  * ```
6780
7027
  *
7028
+ * @category destructors
6781
7029
  * @since 2.0.0
6782
- * @category Destructors
6783
7030
  */
6784
7031
  export const runDrain = self => Channel.runDrain(self.channel);
6785
7032
  /**
@@ -6788,7 +7035,8 @@ export const runDrain = self => Channel.runDrain(self.channel);
6788
7035
  * The pull fails with `Cause.Done` when the stream ends and with the stream
6789
7036
  * error on failure.
6790
7037
  *
6791
- * @example
7038
+ * **Example** (Creating a scoped pull)
7039
+ *
6792
7040
  * ```ts
6793
7041
  * import { Console, Effect, Stream } from "effect"
6794
7042
  *
@@ -6806,14 +7054,15 @@ export const runDrain = self => Channel.runDrain(self.channel);
6806
7054
  * // [1, 2, 3]
6807
7055
  * ```
6808
7056
  *
7057
+ * @category destructors
6809
7058
  * @since 2.0.0
6810
- * @category Destructors
6811
7059
  */
6812
7060
  export const toPull = self => Channel.toPull(self.channel);
6813
7061
  /**
6814
7062
  * Concatenates all emitted strings into a single string.
6815
7063
  *
6816
- * @example
7064
+ * **Example** (Joining strings from a stream)
7065
+ *
6817
7066
  * ```ts
6818
7067
  * import { Console, Effect, Stream } from "effect"
6819
7068
  *
@@ -6827,14 +7076,15 @@ export const toPull = self => Channel.toPull(self.channel);
6827
7076
  * // Hello World!
6828
7077
  * ```
6829
7078
  *
7079
+ * @category destructors
6830
7080
  * @since 2.0.0
6831
- * @category Destructors
6832
7081
  */
6833
7082
  export const mkString = self => Channel.runFold(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
6834
7083
  /**
6835
7084
  * Concatenates the stream's `Uint8Array` chunks into a single `Uint8Array`.
6836
7085
  *
6837
- * @example
7086
+ * **Example** (Joining Uint8Array chunks)
7087
+ *
6838
7088
  * ```ts
6839
7089
  * import { Console, Effect, Stream } from "effect"
6840
7090
  *
@@ -6848,8 +7098,8 @@ export const mkString = self => Channel.runFold(self.channel, () => "", (acc, ch
6848
7098
  * // [1, 2, 3, 4]
6849
7099
  * ```
6850
7100
  *
7101
+ * @category destructors
6851
7102
  * @since 4.0.0
6852
- * @category Destructors
6853
7103
  */
6854
7104
  export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, () => ({
6855
7105
  bytes: 0,
@@ -6878,7 +7128,8 @@ export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, ()
6878
7128
  *
6879
7129
  * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
6880
7130
  *
6881
- * @example
7131
+ * **Example** (Converting to a ReadableStream with services)
7132
+ *
6882
7133
  * ```ts
6883
7134
  * import { Context, Stream } from "effect"
6884
7135
  *
@@ -6886,8 +7137,8 @@ export const mkUint8Array = self => Effect.map(Channel.runFold(self.channel, ()
6886
7137
  * const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
6887
7138
  * ```
6888
7139
  *
6889
- * @since 2.0.0
6890
- * @category Destructors
7140
+ * @category destructors
7141
+ * @since 4.0.0
6891
7142
  */
6892
7143
  export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]), (self, context, options) => {
6893
7144
  let currentResolve = undefined;
@@ -6928,7 +7179,8 @@ export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]),
6928
7179
  *
6929
7180
  * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
6930
7181
  *
6931
- * @example
7182
+ * **Example** (Converting a stream to a ReadableStream)
7183
+ *
6932
7184
  * ```ts
6933
7185
  * import { Stream } from "effect"
6934
7186
  *
@@ -6936,8 +7188,8 @@ export const toReadableStreamWith = /*#__PURE__*/dual(args => isStream(args[0]),
6936
7188
  * const reader = readableStream.getReader()
6937
7189
  * ```
6938
7190
  *
7191
+ * @category destructors
6939
7192
  * @since 2.0.0
6940
- * @category Destructors
6941
7193
  */
6942
7194
  export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => toReadableStreamWith(self, Context.empty(), options));
6943
7195
  /**
@@ -6945,7 +7197,8 @@ export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (se
6945
7197
  *
6946
7198
  * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
6947
7199
  *
6948
- * @example
7200
+ * **Example** (Creating a ReadableStream effect)
7201
+ *
6949
7202
  * ```ts
6950
7203
  * import { Console, Effect, Stream } from "effect"
6951
7204
  *
@@ -6959,14 +7212,15 @@ export const toReadableStream = /*#__PURE__*/dual(args => isStream(args[0]), (se
6959
7212
  * Effect.runPromise(effect)
6960
7213
  * ```
6961
7214
  *
7215
+ * @category destructors
6962
7216
  * @since 2.0.0
6963
- * @category Destructors
6964
7217
  */
6965
7218
  export const toReadableStreamEffect = /*#__PURE__*/dual(args => isStream(args[0]), (self, options) => Effect.map(Effect.context(), context => toReadableStreamWith(self, context, options)));
6966
7219
  /**
6967
7220
  * Converts the stream to an `AsyncIterable` using the provided services.
6968
7221
  *
6969
- * @example
7222
+ * **Example** (Converting to an AsyncIterable with services)
7223
+ *
6970
7224
  * ```ts
6971
7225
  * import { Context, Stream } from "effect"
6972
7226
  *
@@ -6978,12 +7232,15 @@ export const toReadableStreamEffect = /*#__PURE__*/dual(args => isStream(args[0]
6978
7232
  * for await (const value of iterable) {
6979
7233
  * results.push(value)
6980
7234
  * }
6981
- * return results
7235
+ * console.log(results)
6982
7236
  * }
7237
+ *
7238
+ * collect()
7239
+ * // [ 1, 2, 3 ]
6983
7240
  * ```
6984
7241
  *
6985
- * @since 2.0.0
6986
- * @category Destructors
7242
+ * @category destructors
7243
+ * @since 4.0.0
6987
7244
  */
6988
7245
  export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
6989
7246
  [Symbol.asyncIterator]() {
@@ -7024,9 +7281,10 @@ export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
7024
7281
  /**
7025
7282
  * Creates an effect that yields an `AsyncIterable` using the current services.
7026
7283
  *
7027
- * @example
7284
+ * **Example** (Creating an AsyncIterable effect)
7285
+ *
7028
7286
  * ```ts
7029
- * import { Console, Effect, Stream } from "effect"
7287
+ * import { Effect, Stream } from "effect"
7030
7288
  *
7031
7289
  * const stream = Stream.make(1, 2, 3)
7032
7290
  *
@@ -7039,41 +7297,42 @@ export const toAsyncIterableWith = /*#__PURE__*/dual(2, (self, context) => ({
7039
7297
  * }
7040
7298
  * return collected
7041
7299
  * })
7042
- * yield* Console.log(values)
7300
+ * yield* Effect.sync(() => console.log(values))
7043
7301
  * })
7044
7302
  *
7045
7303
  * Effect.runPromise(program)
7046
- * //=> [ 1, 2, 3 ]
7304
+ * // [ 1, 2, 3 ]
7047
7305
  * ```
7048
7306
  *
7049
- * @since 2.0.0
7050
- * @category Destructors
7307
+ * @category destructors
7308
+ * @since 3.15.0
7051
7309
  */
7052
7310
  export const toAsyncIterableEffect = self => Effect.map(Effect.context(), context => toAsyncIterableWith(self, context));
7053
7311
  /**
7054
7312
  * Converts a stream to an `AsyncIterable` for `for await...of` consumption.
7055
7313
  *
7056
- * @example
7314
+ * **Example** (Converting to an async iterable)
7315
+ *
7057
7316
  * ```ts
7058
- * import { Effect, Stream } from "effect"
7317
+ * import { Stream } from "effect"
7059
7318
  *
7060
7319
  * const stream = Stream.make(1, 2, 3)
7061
7320
  *
7062
- * const program = Effect.gen(function* () {
7321
+ * const collect = async () => {
7063
7322
  * const iterable = Stream.toAsyncIterable(stream)
7064
- * const results = yield* Effect.promise(async () => {
7065
- * const values: Array<number> = []
7066
- * for await (const value of iterable) {
7067
- * values.push(value)
7068
- * }
7069
- * return values
7070
- * })
7071
- * return results
7072
- * })
7323
+ * const values: Array<number> = []
7324
+ * for await (const value of iterable) {
7325
+ * values.push(value)
7326
+ * }
7327
+ * console.log(values)
7328
+ * }
7329
+ *
7330
+ * collect()
7331
+ * // [ 1, 2, 3 ]
7073
7332
  * ```
7074
7333
  *
7075
- * @since 2.0.0
7076
- * @category Destructors
7334
+ * @category destructors
7335
+ * @since 3.15.0
7077
7336
  */
7078
7337
  export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty());
7079
7338
  /**
@@ -7082,7 +7341,8 @@ export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty()
7082
7341
  * `shutdownOnEnd` controls whether the PubSub is shut down when the stream ends.
7083
7342
  * It only shuts down when set to `true`.
7084
7343
  *
7085
- * @example
7344
+ * **Example** (Running a stream into a PubSub)
7345
+ *
7086
7346
  * ```ts
7087
7347
  * import { Console, Effect, PubSub, Stream } from "effect"
7088
7348
  *
@@ -7104,8 +7364,8 @@ export const toAsyncIterable = self => toAsyncIterableWith(self, Context.empty()
7104
7364
  * //=> 2
7105
7365
  * ```
7106
7366
  *
7367
+ * @category destructors
7107
7368
  * @since 2.0.0
7108
- * @category Destructors
7109
7369
  */
7110
7370
  export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self, pubsub, options) => Channel.runIntoPubSubArray(self.channel, pubsub, options));
7111
7371
  /**
@@ -7114,7 +7374,8 @@ export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self,
7114
7374
  * `shutdownOnEnd` indicates whether the PubSub should be shut down when the
7115
7375
  * stream ends. By default this is `true`.
7116
7376
  *
7117
- * @example
7377
+ * **Example** (Converting a stream to a PubSub for concurrent consumption)
7378
+ *
7118
7379
  * ```ts
7119
7380
  * import { Console, Effect, PubSub, Stream } from "effect"
7120
7381
  *
@@ -7129,8 +7390,8 @@ export const runIntoPubSub = /*#__PURE__*/dual(args => isStream(args[0]), (self,
7129
7390
  * }))
7130
7391
  * ```
7131
7392
  *
7393
+ * @category destructors
7132
7394
  * @since 2.0.0
7133
- * @category Destructors
7134
7395
  */
7135
7396
  export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSubArray(self.channel, options));
7136
7397
  /**
@@ -7138,7 +7399,8 @@ export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSub
7138
7399
  *
7139
7400
  * `Take` values include the stream's end and failure signals.
7140
7401
  *
7141
- * @example
7402
+ * **Example** (Converting to a PubSub of takes)
7403
+ *
7142
7404
  * ```ts
7143
7405
  * import { Console, Effect, PubSub, Stream } from "effect"
7144
7406
  *
@@ -7155,14 +7417,20 @@ export const toPubSub = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSub
7155
7417
  * })
7156
7418
  * ```
7157
7419
  *
7420
+ * @category destructors
7158
7421
  * @since 4.0.0
7159
- * @category Destructors
7160
7422
  */
7161
7423
  export const toPubSubTake = /*#__PURE__*/dual(2, (self, options) => Channel.toPubSubTake(self.channel, options));
7162
7424
  /**
7163
- * Converts a stream to a Queue for concurrent consumption.
7425
+ * Creates a scoped dequeue that is fed by the stream for concurrent
7426
+ * consumption.
7427
+ *
7428
+ * Elements are offered to the queue as the stream runs. Stream completion is
7429
+ * signaled with `Cause.Done`, stream failures fail the queue, and the queue is
7430
+ * shut down when the surrounding scope closes.
7431
+ *
7432
+ * **Example** (Converting a stream to a Queue for concurrent consumption)
7164
7433
  *
7165
- * @example
7166
7434
  * ```ts
7167
7435
  * import { Effect, Queue, Stream } from "effect"
7168
7436
  *
@@ -7173,15 +7441,16 @@ export const toPubSubTake = /*#__PURE__*/dual(2, (self, options) => Channel.toPu
7173
7441
  * })
7174
7442
  * ```
7175
7443
  *
7444
+ * @category destructors
7176
7445
  * @since 2.0.0
7177
- * @category Destructors
7178
7446
  */
7179
7447
  export const toQueue = /*#__PURE__*/dual(2, (self, options) => Channel.toQueueArray(self.channel, options));
7180
7448
  /**
7181
7449
  * Runs the stream, offering each element to the provided queue and ending it
7182
7450
  * with `Cause.Done` when the stream completes.
7183
7451
  *
7184
- * @example
7452
+ * **Example** (Running a stream into a queue)
7453
+ *
7185
7454
  * ```ts
7186
7455
  * import { Cause, Effect, Queue, Stream } from "effect"
7187
7456
  *
@@ -7203,8 +7472,8 @@ export const toQueue = /*#__PURE__*/dual(2, (self, options) => Channel.toQueueAr
7203
7472
  * })
7204
7473
  * ```
7205
7474
  *
7475
+ * @category destructors
7206
7476
  * @since 2.0.0
7207
- * @category Destructors
7208
7477
  */
7209
7478
  export const runIntoQueue = /*#__PURE__*/dual(2, (self, queue) => Channel.runIntoQueueArray(self.channel, queue));
7210
7479
  //# sourceMappingURL=Stream.js.map