effect 2.0.0-next.44 → 2.0.0-next.46

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 (779) hide show
  1. package/Bigint/dist/effect-Bigint.cjs.dev.js +125 -1
  2. package/Bigint/dist/effect-Bigint.cjs.mjs +6 -1
  3. package/Bigint/dist/effect-Bigint.cjs.prod.js +125 -1
  4. package/Bigint/dist/effect-Bigint.esm.js +111 -2
  5. package/Boolean/dist/effect-Boolean.cjs.dev.js +1 -1
  6. package/Boolean/dist/effect-Boolean.cjs.prod.js +1 -1
  7. package/Boolean/dist/effect-Boolean.esm.js +1 -1
  8. package/Brand/dist/effect-Brand.cjs.dev.js +3 -3
  9. package/Brand/dist/effect-Brand.cjs.prod.js +3 -3
  10. package/Cache/dist/effect-Cache.cjs.dev.js +32 -32
  11. package/Cache/dist/effect-Cache.cjs.prod.js +32 -32
  12. package/Cause/dist/effect-Cause.cjs.dev.js +17 -17
  13. package/Cause/dist/effect-Cause.cjs.mjs +1 -1
  14. package/Cause/dist/effect-Cause.cjs.prod.js +17 -17
  15. package/Cause/dist/effect-Cause.esm.js +4 -4
  16. package/Channel/dist/effect-Channel.cjs.dev.js +50 -50
  17. package/Channel/dist/effect-Channel.cjs.mjs +3 -3
  18. package/Channel/dist/effect-Channel.cjs.prod.js +50 -50
  19. package/Channel/dist/effect-Channel.esm.js +8 -8
  20. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.dev.js +36 -36
  21. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.prod.js +36 -36
  22. package/Chunk/dist/effect-Chunk.cjs.dev.js +3 -3
  23. package/Chunk/dist/effect-Chunk.cjs.prod.js +3 -3
  24. package/Clock/dist/effect-Clock.cjs.dev.js +16 -16
  25. package/Clock/dist/effect-Clock.cjs.prod.js +16 -16
  26. package/Config/dist/effect-Config.cjs.dev.js +11 -11
  27. package/Config/dist/effect-Config.cjs.prod.js +11 -11
  28. package/ConfigError/dist/effect-ConfigError.cjs.dev.js +4 -4
  29. package/ConfigError/dist/effect-ConfigError.cjs.prod.js +4 -4
  30. package/ConfigProvider/dist/effect-ConfigProvider.cjs.dev.js +17 -17
  31. package/ConfigProvider/dist/effect-ConfigProvider.cjs.prod.js +17 -17
  32. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.dev.js +5 -5
  33. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.prod.js +5 -5
  34. package/ConfigSecret/dist/effect-ConfigSecret.cjs.dev.js +4 -4
  35. package/ConfigSecret/dist/effect-ConfigSecret.cjs.prod.js +4 -4
  36. package/Console/dist/effect-Console.cjs.dev.js +35 -35
  37. package/Console/dist/effect-Console.cjs.prod.js +35 -35
  38. package/Context/dist/effect-Context.cjs.dev.js +3 -8
  39. package/Context/dist/effect-Context.cjs.prod.js +3 -8
  40. package/Data/dist/effect-Data.cjs.dev.js +141 -54
  41. package/Data/dist/effect-Data.cjs.mjs +2 -0
  42. package/Data/dist/effect-Data.cjs.prod.js +141 -54
  43. package/Data/dist/effect-Data.esm.js +51 -3
  44. package/DefaultServices/dist/effect-DefaultServices.cjs.dev.js +16 -16
  45. package/DefaultServices/dist/effect-DefaultServices.cjs.prod.js +16 -16
  46. package/Deferred/dist/effect-Deferred.cjs.dev.js +8 -8
  47. package/Deferred/dist/effect-Deferred.cjs.prod.js +8 -8
  48. package/Differ/dist/effect-Differ.cjs.dev.js +11 -11
  49. package/Differ/dist/effect-Differ.cjs.prod.js +11 -11
  50. package/Duration/dist/effect-Duration.cjs.dev.js +3 -3
  51. package/Duration/dist/effect-Duration.cjs.prod.js +3 -3
  52. package/Effect/dist/effect-Effect.cjs.dev.js +44 -44
  53. package/Effect/dist/effect-Effect.cjs.prod.js +44 -44
  54. package/Effectable/dist/effect-Effectable.cjs.dev.js +24 -14
  55. package/Effectable/dist/effect-Effectable.cjs.mjs +5 -4
  56. package/Effectable/dist/effect-Effectable.cjs.prod.js +24 -14
  57. package/Effectable/dist/effect-Effectable.esm.js +15 -5
  58. package/Either/dist/effect-Either.cjs.dev.js +3 -3
  59. package/Either/dist/effect-Either.cjs.prod.js +3 -3
  60. package/Encoding/dist/effect-Encoding.cjs.dev.js +3 -3
  61. package/Encoding/dist/effect-Encoding.cjs.prod.js +3 -3
  62. package/ExecutionStrategy/dist/effect-ExecutionStrategy.cjs.dev.js +2 -2
  63. package/ExecutionStrategy/dist/effect-ExecutionStrategy.cjs.prod.js +2 -2
  64. package/Exit/dist/effect-Exit.cjs.dev.js +8 -8
  65. package/Exit/dist/effect-Exit.cjs.prod.js +8 -8
  66. package/Fiber/dist/effect-Fiber.cjs.dev.js +29 -29
  67. package/Fiber/dist/effect-Fiber.cjs.prod.js +29 -29
  68. package/FiberId/dist/effect-FiberId.cjs.dev.js +5 -5
  69. package/FiberId/dist/effect-FiberId.cjs.prod.js +5 -5
  70. package/FiberRef/dist/effect-FiberRef.cjs.dev.js +29 -29
  71. package/FiberRef/dist/effect-FiberRef.cjs.prod.js +29 -29
  72. package/FiberRefs/dist/effect-FiberRefs.cjs.dev.js +9 -9
  73. package/FiberRefs/dist/effect-FiberRefs.cjs.prod.js +9 -9
  74. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.dev.js +10 -10
  75. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.prod.js +10 -10
  76. package/GroupBy/dist/effect-GroupBy.cjs.dev.js +42 -42
  77. package/GroupBy/dist/effect-GroupBy.cjs.prod.js +42 -42
  78. package/HashMap/dist/effect-HashMap.cjs.dev.js +20 -20
  79. package/HashMap/dist/effect-HashMap.cjs.prod.js +20 -20
  80. package/HashSet/dist/effect-HashSet.cjs.dev.js +20 -20
  81. package/HashSet/dist/effect-HashSet.cjs.prod.js +20 -20
  82. package/KeyedPool/dist/effect-KeyedPool.cjs.dev.js +33 -33
  83. package/KeyedPool/dist/effect-KeyedPool.cjs.prod.js +33 -33
  84. package/Layer/dist/effect-Layer.cjs.dev.js +32 -32
  85. package/Layer/dist/effect-Layer.cjs.prod.js +32 -32
  86. package/List/dist/effect-List.cjs.dev.js +3 -3
  87. package/List/dist/effect-List.cjs.prod.js +3 -3
  88. package/LogLevel/dist/effect-LogLevel.cjs.dev.js +8 -8
  89. package/LogLevel/dist/effect-LogLevel.cjs.prod.js +8 -8
  90. package/Logger/dist/effect-Logger.cjs.dev.js +33 -33
  91. package/Logger/dist/effect-Logger.cjs.prod.js +33 -33
  92. package/Metric/dist/effect-Metric.cjs.dev.js +27 -27
  93. package/Metric/dist/effect-Metric.cjs.prod.js +27 -27
  94. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.dev.js +4 -4
  95. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.prod.js +4 -4
  96. package/MetricHook/dist/effect-MetricHook.cjs.dev.js +6 -6
  97. package/MetricHook/dist/effect-MetricHook.cjs.prod.js +6 -6
  98. package/MetricKey/dist/effect-MetricKey.cjs.dev.js +6 -6
  99. package/MetricKey/dist/effect-MetricKey.cjs.prod.js +6 -6
  100. package/MetricKeyType/dist/effect-MetricKeyType.cjs.dev.js +4 -4
  101. package/MetricKeyType/dist/effect-MetricKeyType.cjs.prod.js +4 -4
  102. package/MetricPolling/dist/effect-MetricPolling.cjs.dev.js +30 -30
  103. package/MetricPolling/dist/effect-MetricPolling.cjs.prod.js +30 -30
  104. package/MetricRegistry/dist/effect-MetricRegistry.cjs.dev.js +8 -8
  105. package/MetricRegistry/dist/effect-MetricRegistry.cjs.prod.js +8 -8
  106. package/MetricState/dist/effect-MetricState.cjs.dev.js +1 -1
  107. package/MetricState/dist/effect-MetricState.cjs.prod.js +1 -1
  108. package/MutableHashMap/dist/effect-MutableHashMap.cjs.dev.js +4 -4
  109. package/MutableHashMap/dist/effect-MutableHashMap.cjs.prod.js +4 -4
  110. package/MutableHashSet/dist/effect-MutableHashSet.cjs.dev.js +4 -4
  111. package/MutableHashSet/dist/effect-MutableHashSet.cjs.prod.js +4 -4
  112. package/MutableQueue/dist/effect-MutableQueue.cjs.dev.js +3 -3
  113. package/MutableQueue/dist/effect-MutableQueue.cjs.prod.js +3 -3
  114. package/Number/dist/effect-Number.cjs.dev.js +1 -1
  115. package/Number/dist/effect-Number.cjs.prod.js +1 -1
  116. package/Number/dist/effect-Number.esm.js +1 -1
  117. package/Option/dist/effect-Option.cjs.dev.js +9 -9
  118. package/Option/dist/effect-Option.cjs.prod.js +9 -9
  119. package/Pool/dist/effect-Pool.cjs.dev.js +31 -31
  120. package/Pool/dist/effect-Pool.cjs.prod.js +31 -31
  121. package/PubSub/dist/effect-PubSub.cjs.d.mts +2 -0
  122. package/PubSub/dist/effect-PubSub.cjs.d.mts.map +1 -0
  123. package/PubSub/dist/effect-PubSub.cjs.d.ts +2 -0
  124. package/PubSub/dist/effect-PubSub.cjs.d.ts.map +1 -0
  125. package/{Hub/dist/effect-Hub.cjs.dev.js → PubSub/dist/effect-PubSub.cjs.dev.js} +163 -163
  126. package/PubSub/dist/effect-PubSub.cjs.js +7 -0
  127. package/{Hub/dist/effect-Hub.cjs.mjs → PubSub/dist/effect-PubSub.cjs.mjs} +1 -1
  128. package/{Hub/dist/effect-Hub.cjs.prod.js → PubSub/dist/effect-PubSub.cjs.prod.js} +163 -163
  129. package/{Hub/dist/effect-Hub.esm.js → PubSub/dist/effect-PubSub.esm.js} +15 -15
  130. package/PubSub/package.json +4 -0
  131. package/Queue/dist/effect-Queue.cjs.dev.js +28 -28
  132. package/Queue/dist/effect-Queue.cjs.prod.js +28 -28
  133. package/README.md +5 -5
  134. package/Random/dist/effect-Random.cjs.dev.js +16 -16
  135. package/Random/dist/effect-Random.cjs.prod.js +16 -16
  136. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.dev.js +3 -3
  137. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.prod.js +3 -3
  138. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.dev.js +3 -3
  139. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.prod.js +3 -3
  140. package/RedBlackTree/dist/effect-RedBlackTree.cjs.dev.js +4 -4
  141. package/RedBlackTree/dist/effect-RedBlackTree.cjs.prod.js +4 -4
  142. package/Ref/dist/effect-Ref.cjs.dev.js +9 -9
  143. package/Ref/dist/effect-Ref.cjs.prod.js +9 -9
  144. package/Reloadable/dist/effect-Reloadable.cjs.dev.js +44 -44
  145. package/Reloadable/dist/effect-Reloadable.cjs.prod.js +44 -44
  146. package/Request/dist/effect-Request.cjs.dev.js +29 -29
  147. package/Request/dist/effect-Request.cjs.prod.js +29 -29
  148. package/RequestBlock/dist/effect-RequestBlock.cjs.dev.js +36 -36
  149. package/RequestBlock/dist/effect-RequestBlock.cjs.prod.js +36 -36
  150. package/RequestResolver/dist/effect-RequestResolver.cjs.dev.js +38 -38
  151. package/RequestResolver/dist/effect-RequestResolver.cjs.prod.js +38 -38
  152. package/Resource/dist/effect-Resource.cjs.dev.js +34 -34
  153. package/Resource/dist/effect-Resource.cjs.prod.js +34 -34
  154. package/Runtime/dist/effect-Runtime.cjs.dev.js +34 -34
  155. package/Runtime/dist/effect-Runtime.cjs.prod.js +34 -34
  156. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.dev.js +33 -33
  157. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.prod.js +33 -33
  158. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.dev.js +6 -6
  159. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.prod.js +6 -6
  160. package/STM/dist/effect-STM.cjs.dev.js +48 -48
  161. package/STM/dist/effect-STM.cjs.prod.js +48 -48
  162. package/Schedule/dist/effect-Schedule.cjs.dev.js +19 -19
  163. package/Schedule/dist/effect-Schedule.cjs.prod.js +19 -19
  164. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.dev.js +3 -3
  165. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.prod.js +3 -3
  166. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.dev.js +3 -3
  167. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.prod.js +3 -3
  168. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.dev.js +3 -3
  169. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.prod.js +3 -3
  170. package/Scheduler/dist/effect-Scheduler.cjs.dev.js +8 -8
  171. package/Scheduler/dist/effect-Scheduler.cjs.prod.js +8 -8
  172. package/Scope/dist/effect-Scope.cjs.dev.js +27 -27
  173. package/Scope/dist/effect-Scope.cjs.prod.js +27 -27
  174. package/ScopedCache/dist/effect-ScopedCache.cjs.dev.js +78 -61
  175. package/ScopedCache/dist/effect-ScopedCache.cjs.prod.js +78 -61
  176. package/ScopedRef/dist/effect-ScopedRef.cjs.dev.js +34 -34
  177. package/ScopedRef/dist/effect-ScopedRef.cjs.prod.js +34 -34
  178. package/Sink/dist/effect-Sink.cjs.dev.js +43 -43
  179. package/Sink/dist/effect-Sink.cjs.mjs +1 -1
  180. package/Sink/dist/effect-Sink.cjs.prod.js +43 -43
  181. package/Sink/dist/effect-Sink.esm.js +5 -5
  182. package/SortedMap/dist/effect-SortedMap.cjs.dev.js +3 -3
  183. package/SortedMap/dist/effect-SortedMap.cjs.prod.js +3 -3
  184. package/SortedSet/dist/effect-SortedSet.cjs.dev.js +3 -3
  185. package/SortedSet/dist/effect-SortedSet.cjs.prod.js +3 -3
  186. package/Stream/dist/effect-Stream.cjs.dev.js +60 -60
  187. package/Stream/dist/effect-Stream.cjs.mjs +5 -5
  188. package/Stream/dist/effect-Stream.cjs.prod.js +60 -60
  189. package/Stream/dist/effect-Stream.esm.js +15 -15
  190. package/Streamable/dist/effect-Streamable.cjs.d.mts +2 -0
  191. package/Streamable/dist/effect-Streamable.cjs.d.mts.map +1 -0
  192. package/Streamable/dist/effect-Streamable.cjs.d.ts +2 -0
  193. package/Streamable/dist/effect-Streamable.cjs.d.ts.map +1 -0
  194. package/Streamable/dist/effect-Streamable.cjs.dev.js +152 -0
  195. package/Streamable/dist/effect-Streamable.cjs.js +7 -0
  196. package/Streamable/dist/effect-Streamable.cjs.mjs +3 -0
  197. package/Streamable/dist/effect-Streamable.cjs.prod.js +152 -0
  198. package/Streamable/dist/effect-Streamable.esm.js +42 -0
  199. package/Streamable/package.json +4 -0
  200. package/String/dist/effect-String.cjs.dev.js +4 -4
  201. package/String/dist/effect-String.cjs.prod.js +4 -4
  202. package/String/dist/effect-String.esm.js +1 -1
  203. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.dev.js +48 -48
  204. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.prod.js +48 -48
  205. package/Supervisor/dist/effect-Supervisor.cjs.dev.js +34 -34
  206. package/Supervisor/dist/effect-Supervisor.cjs.prod.js +34 -34
  207. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.dev.js +30 -30
  208. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.prod.js +30 -30
  209. package/TArray/dist/effect-TArray.cjs.dev.js +46 -46
  210. package/TArray/dist/effect-TArray.cjs.prod.js +46 -46
  211. package/TDeferred/dist/effect-TDeferred.cjs.dev.js +45 -45
  212. package/TDeferred/dist/effect-TDeferred.cjs.prod.js +45 -45
  213. package/TMap/dist/effect-TMap.cjs.dev.js +47 -47
  214. package/TMap/dist/effect-TMap.cjs.prod.js +47 -47
  215. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.dev.js +44 -44
  216. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.prod.js +44 -44
  217. package/TPubSub/dist/effect-TPubSub.cjs.d.mts +2 -0
  218. package/TPubSub/dist/effect-TPubSub.cjs.d.mts.map +1 -0
  219. package/TPubSub/dist/effect-TPubSub.cjs.d.ts +2 -0
  220. package/TPubSub/dist/effect-TPubSub.cjs.d.ts.map +1 -0
  221. package/{THub/dist/effect-THub.cjs.dev.js → TPubSub/dist/effect-TPubSub.cjs.dev.js} +101 -101
  222. package/TPubSub/dist/effect-TPubSub.cjs.js +7 -0
  223. package/{THub/dist/effect-THub.cjs.mjs → TPubSub/dist/effect-TPubSub.cjs.mjs} +2 -2
  224. package/{THub/dist/effect-THub.cjs.prod.js → TPubSub/dist/effect-TPubSub.cjs.prod.js} +101 -101
  225. package/TPubSub/dist/effect-TPubSub.esm.js +157 -0
  226. package/TPubSub/package.json +4 -0
  227. package/TQueue/dist/effect-TQueue.cjs.dev.js +46 -46
  228. package/TQueue/dist/effect-TQueue.cjs.prod.js +46 -46
  229. package/TRandom/dist/effect-TRandom.cjs.dev.js +50 -50
  230. package/TRandom/dist/effect-TRandom.cjs.prod.js +50 -50
  231. package/TReentrantLock/dist/effect-TReentrantLock.cjs.dev.js +46 -46
  232. package/TReentrantLock/dist/effect-TReentrantLock.cjs.prod.js +46 -46
  233. package/TRef/dist/effect-TRef.cjs.dev.js +44 -44
  234. package/TRef/dist/effect-TRef.cjs.prod.js +44 -44
  235. package/TSemaphore/dist/effect-TSemaphore.cjs.dev.js +45 -45
  236. package/TSemaphore/dist/effect-TSemaphore.cjs.prod.js +45 -45
  237. package/TSet/dist/effect-TSet.cjs.dev.js +47 -47
  238. package/TSet/dist/effect-TSet.cjs.prod.js +47 -47
  239. package/Take/dist/effect-Take.cjs.dev.js +36 -36
  240. package/Take/dist/effect-Take.cjs.prod.js +36 -36
  241. package/TestAnnotation/dist/effect-TestAnnotation.cjs.dev.js +8 -8
  242. package/TestAnnotation/dist/effect-TestAnnotation.cjs.prod.js +8 -8
  243. package/TestAnnotations/dist/effect-TestAnnotations.cjs.dev.js +25 -25
  244. package/TestAnnotations/dist/effect-TestAnnotations.cjs.prod.js +25 -25
  245. package/TestClock/dist/effect-TestClock.cjs.dev.js +46 -46
  246. package/TestClock/dist/effect-TestClock.cjs.prod.js +46 -46
  247. package/TestConfig/dist/effect-TestConfig.cjs.dev.js +3 -8
  248. package/TestConfig/dist/effect-TestConfig.cjs.prod.js +3 -8
  249. package/TestContext/dist/effect-TestContext.cjs.dev.js +37 -37
  250. package/TestContext/dist/effect-TestContext.cjs.prod.js +37 -37
  251. package/TestLive/dist/effect-TestLive.cjs.dev.js +17 -17
  252. package/TestLive/dist/effect-TestLive.cjs.prod.js +17 -17
  253. package/TestServices/dist/effect-TestServices.cjs.dev.js +42 -42
  254. package/TestServices/dist/effect-TestServices.cjs.prod.js +42 -42
  255. package/TestSized/dist/effect-TestSized.cjs.dev.js +11 -11
  256. package/TestSized/dist/effect-TestSized.cjs.prod.js +11 -11
  257. package/Tracer/dist/effect-Tracer.cjs.dev.js +16 -16
  258. package/Tracer/dist/effect-Tracer.cjs.prod.js +16 -16
  259. package/dist/{Context-01a123ac.cjs.prod.js → Context-9fe5eb16.cjs.prod.js} +5 -5
  260. package/dist/{Context-593661f6.cjs.dev.js → Context-da73ddfa.cjs.dev.js} +5 -5
  261. package/dist/{Effectable-2f022879.cjs.dev.js → Effectable-7314aed8.cjs.dev.js} +63 -10
  262. package/dist/{Effectable-cd8f3a96.cjs.prod.js → Effectable-c4c14a2b.cjs.prod.js} +63 -10
  263. package/dist/{Either-7a881c7a.cjs.prod.js → Either-d43f082c.cjs.prod.js} +6 -79
  264. package/dist/{Either-12bbe00c.cjs.dev.js → Either-fa0ef1d9.cjs.dev.js} +6 -79
  265. package/dist/{ExecutionStrategy-14d3053a.cjs.prod.js → ExecutionStrategy-4808fe5d.cjs.prod.js} +2 -2
  266. package/dist/{ExecutionStrategy-70f1a920.cjs.dev.js → ExecutionStrategy-7d9d457b.cjs.dev.js} +2 -2
  267. package/dist/{HashSet-0b4ff1e4.cjs.dev.js → HashSet-5963ad6b.cjs.dev.js} +32 -32
  268. package/dist/{HashSet-6257b66d.cjs.prod.js → HashSet-ac02a3e1.cjs.prod.js} +32 -32
  269. package/dist/Option-463b42e6.cjs.dev.js +81 -0
  270. package/dist/Option-935e5d7c.cjs.prod.js +81 -0
  271. package/dist/{Ref-a3a4e50d.cjs.prod.js → Ref-4014b526.cjs.prod.js} +1 -1
  272. package/dist/{Ref-74b592a4.cjs.dev.js → Ref-acdee7ef.cjs.dev.js} +1 -1
  273. package/dist/{cache-75fbef45.cjs.prod.js → cache-5c7d77e4.cjs.prod.js} +17 -17
  274. package/dist/{cache-e1ea3923.cjs.dev.js → cache-7eed9d33.cjs.dev.js} +17 -17
  275. package/dist/{circular-6f16b226.cjs.prod.js → circular-1f481ffb.cjs.prod.js} +33 -33
  276. package/dist/{circular-f406f9a4.cjs.prod.js → circular-9e10a5a7.cjs.prod.js} +6 -6
  277. package/dist/{circular-58ff5e9c.cjs.dev.js → circular-c2dbce1a.cjs.dev.js} +33 -33
  278. package/dist/{circular-30564534.cjs.dev.js → circular-c8b65bdb.cjs.dev.js} +6 -6
  279. package/dist/{config-80900693.cjs.dev.js → config-3b7935a3.cjs.dev.js} +3 -3
  280. package/dist/{config-d0ddc159.cjs.prod.js → config-5ba54da1.cjs.prod.js} +3 -3
  281. package/dist/{configProvider-93617d6d.cjs.prod.js → configProvider-b6b20998.cjs.prod.js} +29 -29
  282. package/dist/{configProvider-ce43fdbf.cjs.dev.js → configProvider-f34a82f1.cjs.dev.js} +29 -29
  283. package/dist/{core-0b0539de.cjs.prod.js → core-07202cc0.cjs.prod.js} +711 -726
  284. package/dist/{core-60ca562a.cjs.prod.js → core-7411d1e1.cjs.prod.js} +3 -3
  285. package/dist/{core-b4d7b4f5.cjs.dev.js → core-b7401357.cjs.dev.js} +711 -726
  286. package/dist/{core-13f8a866.cjs.dev.js → core-c5747f88.cjs.dev.js} +3 -3
  287. package/dist/{core-effect-892f3686.cjs.dev.js → core-effect-1c564d42.cjs.dev.js} +77 -75
  288. package/dist/{core-effect-c65770cd.cjs.prod.js → core-effect-9201ea63.cjs.prod.js} +77 -75
  289. package/dist/{dataSource-3ba9e4d3.cjs.dev.js → dataSource-b5eda714.cjs.dev.js} +2 -2
  290. package/dist/{dataSource-7df3a5f6.cjs.prod.js → dataSource-b83bc277.cjs.prod.js} +2 -2
  291. package/dist/declarations/src/Bigint.d.ts +92 -1
  292. package/dist/declarations/src/Bigint.d.ts.map +1 -1
  293. package/dist/declarations/src/Boolean.d.ts +1 -1
  294. package/dist/declarations/src/Cause.d.ts +6 -6
  295. package/dist/declarations/src/Cause.d.ts.map +1 -1
  296. package/dist/declarations/src/Channel.d.ts +7 -7
  297. package/dist/declarations/src/Channel.d.ts.map +1 -1
  298. package/dist/declarations/src/Data.d.ts +30 -0
  299. package/dist/declarations/src/Data.d.ts.map +1 -1
  300. package/dist/declarations/src/Effect.d.ts +4 -2
  301. package/dist/declarations/src/Effect.d.ts.map +1 -1
  302. package/dist/declarations/src/Effectable.d.ts +14 -4
  303. package/dist/declarations/src/Effectable.d.ts.map +1 -1
  304. package/dist/declarations/src/Metric.d.ts +31 -7
  305. package/dist/declarations/src/Metric.d.ts.map +1 -1
  306. package/dist/declarations/src/MetricHook.d.ts +7 -4
  307. package/dist/declarations/src/MetricHook.d.ts.map +1 -1
  308. package/dist/declarations/src/MetricKey.d.ts +24 -4
  309. package/dist/declarations/src/MetricKey.d.ts.map +1 -1
  310. package/dist/declarations/src/MetricKeyType.d.ts +9 -6
  311. package/dist/declarations/src/MetricKeyType.d.ts.map +1 -1
  312. package/dist/declarations/src/MetricRegistry.d.ts +2 -2
  313. package/dist/declarations/src/MetricRegistry.d.ts.map +1 -1
  314. package/dist/declarations/src/MetricState.d.ts +15 -9
  315. package/dist/declarations/src/MetricState.d.ts.map +1 -1
  316. package/dist/declarations/src/Number.d.ts +1 -1
  317. package/dist/declarations/src/{Hub.d.ts → PubSub.d.ts} +38 -38
  318. package/dist/declarations/src/PubSub.d.ts.map +1 -0
  319. package/dist/declarations/src/Sink.d.ts +4 -4
  320. package/dist/declarations/src/Sink.d.ts.map +1 -1
  321. package/dist/declarations/src/Stream.d.ts +24 -24
  322. package/dist/declarations/src/Stream.d.ts.map +1 -1
  323. package/dist/declarations/src/Streamable.d.ts +27 -0
  324. package/dist/declarations/src/Streamable.d.ts.map +1 -0
  325. package/dist/declarations/src/String.d.ts +1 -1
  326. package/dist/declarations/src/SubscriptionRef.d.ts.map +1 -1
  327. package/dist/declarations/src/TPubSub.d.ts +146 -0
  328. package/dist/declarations/src/TPubSub.d.ts.map +1 -0
  329. package/dist/declarations/src/index.d.ts +15 -15
  330. package/dist/declarations/src/index.d.ts.map +1 -1
  331. package/dist/{defaultServices-5530ff0e.cjs.dev.js → defaultServices-755d5b46.cjs.dev.js} +6 -6
  332. package/dist/{defaultServices-086b8ac9.cjs.prod.js → defaultServices-9d7ce86f.cjs.prod.js} +6 -6
  333. package/dist/effect.cjs.dev.js +9 -9
  334. package/dist/effect.cjs.mjs +3 -3
  335. package/dist/effect.cjs.prod.js +9 -9
  336. package/dist/effect.esm.js +6 -6
  337. package/dist/{fiber-1bfb4c1d.cjs.dev.js → fiber-5156eff2.cjs.dev.js} +12 -12
  338. package/dist/{fiber-2eb0a4c1.cjs.prod.js → fiber-9519d109.cjs.prod.js} +12 -12
  339. package/dist/{fiberRefs-be6b6a70.cjs.prod.js → fiberRefs-558c17e6.cjs.prod.js} +1 -1
  340. package/dist/{fiberRefs-be4fae6a.cjs.dev.js → fiberRefs-98b71233.cjs.dev.js} +1 -1
  341. package/dist/{fiberRuntime-2d31e120.cjs.prod.js → fiberRuntime-31ae011f.cjs.prod.js} +99 -100
  342. package/dist/{fiberRuntime-c7280769.cjs.dev.js → fiberRuntime-d3872282.cjs.dev.js} +99 -100
  343. package/dist/{groupBy-0702739b.cjs.prod.js → groupBy-724f64ef.cjs.prod.js} +4 -4
  344. package/dist/{groupBy-7f852bf3.cjs.dev.js → groupBy-862cc2da.cjs.dev.js} +4 -4
  345. package/dist/{hook-e72b20fd.cjs.dev.js → hook-8cefc909.cjs.dev.js} +8 -4
  346. package/dist/{hook-470b717e.cjs.prod.js → hook-98ce30e4.cjs.prod.js} +8 -4
  347. package/dist/{key-f0a1408a.cjs.dev.js → key-198b6670.cjs.dev.js} +3 -3
  348. package/dist/{key-378a6a2c.cjs.prod.js → key-eb8a12b2.cjs.prod.js} +3 -3
  349. package/dist/{keyType-cf67c69c.cjs.prod.js → keyType-0c5e6178.cjs.prod.js} +9 -2
  350. package/dist/{keyType-55f27f07.cjs.dev.js → keyType-7c164b82.cjs.dev.js} +9 -2
  351. package/dist/{layer-b42e8022.cjs.dev.js → layer-29574350.cjs.dev.js} +33 -33
  352. package/dist/{layer-d103b49b.cjs.prod.js → layer-51ff4846.cjs.prod.js} +33 -33
  353. package/dist/{patch-a1b2802f.cjs.dev.js → patch-0220a642.cjs.dev.js} +1 -1
  354. package/dist/{patch-c4d6c61e.cjs.prod.js → patch-7c559bb2.cjs.prod.js} +1 -1
  355. package/dist/{pathPatch-15c8d723.cjs.prod.js → pathPatch-b56a4da2.cjs.prod.js} +1 -1
  356. package/dist/{pathPatch-d9d41297.cjs.dev.js → pathPatch-fab016f1.cjs.dev.js} +1 -1
  357. package/dist/{pool-ef44ba82.cjs.dev.js → pool-3211287f.cjs.dev.js} +31 -31
  358. package/dist/{pool-e414eb88.cjs.prod.js → pool-f77d7705.cjs.prod.js} +31 -31
  359. package/dist/{query-1d0157db.cjs.prod.js → query-a52b25f0.cjs.prod.js} +11 -11
  360. package/dist/{query-54337864.cjs.dev.js → query-c36decd5.cjs.dev.js} +11 -11
  361. package/dist/{queue-27ac9d98.cjs.prod.js → queue-315ea45d.cjs.prod.js} +22 -22
  362. package/dist/{queue-533d70d4.cjs.dev.js → queue-7a223c44.cjs.dev.js} +22 -22
  363. package/dist/{registry-1099de3f.cjs.dev.js → registry-62ff192e.cjs.dev.js} +4 -4
  364. package/dist/{registry-013ecdde.cjs.prod.js → registry-d5258dff.cjs.prod.js} +4 -4
  365. package/dist/{runtime-ea174155.cjs.prod.js → runtime-005f8a9b.cjs.prod.js} +7 -7
  366. package/dist/{runtime-afad6a9b.cjs.dev.js → runtime-57c8ddf8.cjs.dev.js} +7 -7
  367. package/dist/{schedule-1d92198c.cjs.prod.js → schedule-8cdf6bf1.cjs.prod.js} +40 -40
  368. package/dist/{schedule-e0f55cab.cjs.dev.js → schedule-e7a9f93f.cjs.dev.js} +40 -40
  369. package/dist/scopedRef-789d7fef.cjs.prod.js +55 -0
  370. package/dist/scopedRef-eb19c7a6.cjs.dev.js +55 -0
  371. package/dist/{singleProducerAsyncInput-4105a342.cjs.dev.js → singleProducerAsyncInput-9ff8389b.cjs.dev.js} +1 -1
  372. package/dist/{singleProducerAsyncInput-21463e16.cjs.prod.js → singleProducerAsyncInput-f9b258b1.cjs.prod.js} +1 -1
  373. package/dist/{sink-9129504b.cjs.prod.js → sink-572d8981.cjs.prod.js} +17 -17
  374. package/dist/{sink-ee393b63.cjs.dev.js → sink-8d3427e7.cjs.dev.js} +17 -17
  375. package/dist/{state-dd1bd066.cjs.prod.js → state-0bdf02b7.cjs.prod.js} +2 -6
  376. package/dist/{state-8fbec044.cjs.dev.js → state-931050c4.cjs.dev.js} +2 -6
  377. package/dist/{stm-537da66b.cjs.dev.js → stm-8aca0022.cjs.dev.js} +3 -3
  378. package/dist/{stm-5043c3cb.cjs.prod.js → stm-f250b596.cjs.prod.js} +3 -3
  379. package/dist/{stream-c7eda5bc.cjs.dev.js → stream-34d80d2c.cjs.dev.js} +31 -28
  380. package/dist/{stream-13637643.cjs.prod.js → stream-ea4f4d44.cjs.prod.js} +31 -28
  381. package/dist/{synchronizedRef-37e32854.cjs.dev.js → synchronizedRef-a12fd967.cjs.dev.js} +6 -6
  382. package/dist/{synchronizedRef-b4cde4de.cjs.prod.js → synchronizedRef-ed8aa6ac.cjs.prod.js} +6 -6
  383. package/dist/{tArray-df1bae1c.cjs.dev.js → tArray-17f078f2.cjs.dev.js} +3 -3
  384. package/dist/{tArray-d5476a2d.cjs.prod.js → tArray-d184e22f.cjs.prod.js} +3 -3
  385. package/dist/{tMap-a3e14c05.cjs.dev.js → tMap-1a5aa78b.cjs.dev.js} +4 -4
  386. package/dist/{tMap-20ef43ea.cjs.prod.js → tMap-e219f30e.cjs.prod.js} +4 -4
  387. package/dist/{tQueue-bd3cf539.cjs.dev.js → tQueue-0a4fc773.cjs.dev.js} +3 -3
  388. package/dist/{tQueue-c02c22bd.cjs.prod.js → tQueue-47129ad0.cjs.prod.js} +3 -3
  389. package/dist/{tRef-49e44dde.cjs.prod.js → tRef-ab4c5713.cjs.prod.js} +1 -1
  390. package/dist/{tRef-75dd04b3.cjs.dev.js → tRef-b860ef05.cjs.dev.js} +1 -1
  391. package/internal/Context.esm.js +4 -4
  392. package/internal/Data.esm.js +4 -1
  393. package/internal/Differ/ChunkPatch.esm.js +1 -1
  394. package/internal/Differ/ContextPatch.esm.js +1 -1
  395. package/internal/Differ/HashMapPatch.esm.js +1 -1
  396. package/internal/Differ/HashSetPatch.esm.js +1 -1
  397. package/internal/Differ/OrPatch.esm.js +1 -1
  398. package/internal/Effectable.esm.js +9 -9
  399. package/internal/Either.esm.js +3 -3
  400. package/internal/Option.esm.js +3 -3
  401. package/internal/cache.esm.js +1 -1
  402. package/internal/cause.esm.js +6 -21
  403. package/internal/channel.esm.js +5 -5
  404. package/internal/core-effect.esm.js +6 -4
  405. package/internal/fiberRuntime.esm.js +3 -3
  406. package/internal/layer.esm.js +1 -1
  407. package/internal/metric/hook.esm.js +7 -3
  408. package/internal/metric/key.esm.js +2 -2
  409. package/internal/metric/keyType.esm.js +9 -2
  410. package/internal/metric/registry.esm.js +2 -2
  411. package/internal/metric/state.esm.js +2 -6
  412. package/internal/metric.esm.js +3 -3
  413. package/internal/{hub.esm.js → pubsub.esm.js} +108 -108
  414. package/internal/request.esm.js +1 -1
  415. package/internal/sink.esm.js +8 -8
  416. package/internal/stm/{tHub.esm.js → tPubSub.esm.js} +30 -30
  417. package/internal/stream.esm.js +23 -20
  418. package/internal/subscriptionRef.esm.js +8 -8
  419. package/package.json +66 -211
  420. package/src/.index.ts +30 -0
  421. package/src/Bigint.ts +497 -0
  422. package/src/Boolean.ts +261 -0
  423. package/src/Brand.ts +336 -0
  424. package/src/Cache.ts +250 -0
  425. package/src/Cause.ts +813 -0
  426. package/src/Channel.ts +2244 -0
  427. package/src/ChannelChildExecutorDecision.ts +138 -0
  428. package/src/ChannelMergeDecision.ts +94 -0
  429. package/src/ChannelMergeState.ts +166 -0
  430. package/src/ChannelMergeStrategy.ts +107 -0
  431. package/src/ChannelSingleProducerAsyncInput.ts +68 -0
  432. package/src/ChannelUpstreamPullRequest.ts +110 -0
  433. package/src/ChannelUpstreamPullStrategy.ts +120 -0
  434. package/src/Chunk.ts +1314 -0
  435. package/src/Clock.ts +111 -0
  436. package/src/Config.ts +447 -0
  437. package/src/ConfigError.ts +267 -0
  438. package/src/ConfigProvider.ts +296 -0
  439. package/src/ConfigProviderPathPatch.ts +100 -0
  440. package/src/ConfigSecret.ts +76 -0
  441. package/src/Console.ts +222 -0
  442. package/src/Context.ts +365 -0
  443. package/src/Data.ts +367 -0
  444. package/src/DefaultServices.ts +34 -0
  445. package/src/Deferred.ts +283 -0
  446. package/src/Differ.ts +406 -0
  447. package/src/Duration.ts +558 -0
  448. package/src/Effect.ts +5177 -0
  449. package/src/Effectable.ts +107 -0
  450. package/src/Either.ts +593 -0
  451. package/src/Encoding.ts +130 -0
  452. package/src/Equal.ts +64 -0
  453. package/src/Equivalence.ts +235 -0
  454. package/src/ExecutionStrategy.ts +111 -0
  455. package/src/Exit.ts +464 -0
  456. package/src/Fiber.ts +650 -0
  457. package/src/FiberId.ts +187 -0
  458. package/src/FiberRef.ts +399 -0
  459. package/src/FiberRefs.ts +160 -0
  460. package/src/FiberRefsPatch.ts +105 -0
  461. package/src/FiberStatus.ts +108 -0
  462. package/src/Function.ts +834 -0
  463. package/src/GlobalValue.ts +20 -0
  464. package/src/GroupBy.ts +102 -0
  465. package/src/HKT.ts +44 -0
  466. package/src/Hash.ts +162 -0
  467. package/src/HashMap.ts +373 -0
  468. package/src/HashSet.ts +300 -0
  469. package/src/Inspectable.ts +45 -0
  470. package/src/KeyedPool.ts +160 -0
  471. package/src/Layer.ts +866 -0
  472. package/src/List.ts +942 -0
  473. package/src/LogLevel.ts +266 -0
  474. package/src/LogSpan.ts +25 -0
  475. package/src/Logger.ts +321 -0
  476. package/src/Metric.ts +657 -0
  477. package/src/MetricBoundaries.ts +70 -0
  478. package/src/MetricHook.ts +139 -0
  479. package/src/MetricKey.ts +227 -0
  480. package/src/MetricKeyType.ts +257 -0
  481. package/src/MetricLabel.ts +47 -0
  482. package/src/MetricPair.ts +70 -0
  483. package/src/MetricPolling.ts +136 -0
  484. package/src/MetricRegistry.ts +47 -0
  485. package/src/MetricState.ts +256 -0
  486. package/src/MutableHashMap.ts +187 -0
  487. package/src/MutableHashSet.ts +118 -0
  488. package/src/MutableList.ts +289 -0
  489. package/src/MutableQueue.ts +227 -0
  490. package/src/MutableRef.ts +204 -0
  491. package/src/NonEmptyIterable.ts +30 -0
  492. package/src/Number.ts +406 -0
  493. package/src/Option.ts +1307 -0
  494. package/src/Order.ts +328 -0
  495. package/src/Ordering.ts +112 -0
  496. package/src/Pipeable.ts +318 -0
  497. package/src/Pool.ts +148 -0
  498. package/src/Predicate.ts +704 -0
  499. package/src/PubSub.ts +175 -0
  500. package/src/Queue.ts +575 -0
  501. package/src/Random.ts +115 -0
  502. package/src/ReadonlyArray.ts +2017 -0
  503. package/src/ReadonlyRecord.ts +641 -0
  504. package/src/RedBlackTree.ts +415 -0
  505. package/src/Ref.ts +159 -0
  506. package/src/Reloadable.ts +136 -0
  507. package/src/Request.ts +285 -0
  508. package/src/RequestBlock.ts +157 -0
  509. package/src/RequestResolver.ts +305 -0
  510. package/src/Resource.ts +97 -0
  511. package/src/Runtime.ts +216 -0
  512. package/src/RuntimeFlags.ts +336 -0
  513. package/src/RuntimeFlagsPatch.ts +183 -0
  514. package/src/STM.ts +2076 -0
  515. package/src/Schedule.ts +1396 -0
  516. package/src/ScheduleDecision.ts +62 -0
  517. package/src/ScheduleInterval.ts +151 -0
  518. package/src/ScheduleIntervals.ts +122 -0
  519. package/src/Scheduler.ts +359 -0
  520. package/src/Scope.ts +171 -0
  521. package/src/ScopedCache.ts +148 -0
  522. package/src/ScopedRef.ts +95 -0
  523. package/src/Sink.ts +1431 -0
  524. package/src/SortedMap.ts +229 -0
  525. package/src/SortedSet.ts +385 -0
  526. package/src/Stream.ts +4540 -0
  527. package/src/StreamEmit.ts +83 -0
  528. package/src/StreamHaltStrategy.ts +111 -0
  529. package/src/Streamable.ts +42 -0
  530. package/src/String.ts +682 -0
  531. package/src/Struct.ts +151 -0
  532. package/src/SubscriptionRef.ts +273 -0
  533. package/src/Supervisor.ts +239 -0
  534. package/src/Symbol.ts +28 -0
  535. package/src/SynchronizedRef.ts +249 -0
  536. package/src/TArray.ts +494 -0
  537. package/src/TDeferred.ts +99 -0
  538. package/src/TMap.ts +510 -0
  539. package/src/TPriorityQueue.ts +223 -0
  540. package/src/TPubSub.ts +187 -0
  541. package/src/TQueue.ts +431 -0
  542. package/src/TRandom.ts +129 -0
  543. package/src/TReentrantLock.ts +224 -0
  544. package/src/TRef.ts +176 -0
  545. package/src/TSemaphore.ts +129 -0
  546. package/src/TSet.ts +349 -0
  547. package/src/Take.ts +257 -0
  548. package/src/TestAnnotation.ts +166 -0
  549. package/src/TestAnnotationMap.ts +124 -0
  550. package/src/TestAnnotations.ts +113 -0
  551. package/src/TestClock.ts +552 -0
  552. package/src/TestConfig.ts +49 -0
  553. package/src/TestContext.ts +35 -0
  554. package/src/TestLive.ts +55 -0
  555. package/src/TestServices.ts +392 -0
  556. package/src/TestSized.ts +55 -0
  557. package/src/Tracer.ts +119 -0
  558. package/src/Tuple.ts +204 -0
  559. package/src/Types.ts +123 -0
  560. package/src/Unify.ts +118 -0
  561. package/src/Utils.ts +699 -0
  562. package/src/index.ts +840 -0
  563. package/src/internal/Common.ts +56 -0
  564. package/src/internal/Context.ts +252 -0
  565. package/src/internal/Data.ts +55 -0
  566. package/src/internal/Differ/ChunkPatch.ts +209 -0
  567. package/src/internal/Differ/ContextPatch.ts +229 -0
  568. package/src/internal/Differ/HashMapPatch.ts +217 -0
  569. package/src/internal/Differ/HashSetPatch.ts +174 -0
  570. package/src/internal/Differ/OrPatch.ts +296 -0
  571. package/src/internal/Differ.ts +184 -0
  572. package/src/internal/Effectable.ts +92 -0
  573. package/src/internal/Either.ts +107 -0
  574. package/src/internal/Encoding/Base64.ts +282 -0
  575. package/src/internal/Encoding/Base64Url.ts +28 -0
  576. package/src/internal/Encoding/Common.ts +24 -0
  577. package/src/internal/Encoding/Hex.ts +315 -0
  578. package/src/internal/HashMap/array.ts +49 -0
  579. package/src/internal/HashMap/bitwise.ts +32 -0
  580. package/src/internal/HashMap/config.ts +14 -0
  581. package/src/internal/HashMap/keySet.ts +8 -0
  582. package/src/internal/HashMap/node.ts +390 -0
  583. package/src/internal/HashMap.ts +533 -0
  584. package/src/internal/HashSet.ts +319 -0
  585. package/src/internal/Iterable.ts +54 -0
  586. package/src/internal/Option.ts +79 -0
  587. package/src/internal/ReadonlyArray.ts +8 -0
  588. package/src/internal/RedBlackTree/iterator.ts +207 -0
  589. package/src/internal/RedBlackTree/node.ts +48 -0
  590. package/src/internal/RedBlackTree.ts +1195 -0
  591. package/src/internal/Stack.ts +4 -0
  592. package/src/internal/blockedRequests.ts +512 -0
  593. package/src/internal/cache.ts +714 -0
  594. package/src/internal/cause.ts +1205 -0
  595. package/src/internal/channel/channelExecutor.ts +1193 -0
  596. package/src/internal/channel/channelState.ts +132 -0
  597. package/src/internal/channel/childExecutorDecision.ts +95 -0
  598. package/src/internal/channel/continuation.ts +171 -0
  599. package/src/internal/channel/mergeDecision.ts +115 -0
  600. package/src/internal/channel/mergeState.ts +120 -0
  601. package/src/internal/channel/mergeStrategy.ts +72 -0
  602. package/src/internal/channel/singleProducerAsyncInput.ts +261 -0
  603. package/src/internal/channel/subexecutor.ts +229 -0
  604. package/src/internal/channel/upstreamPullRequest.ts +83 -0
  605. package/src/internal/channel/upstreamPullStrategy.ts +86 -0
  606. package/src/internal/channel.ts +2516 -0
  607. package/src/internal/clock.ts +97 -0
  608. package/src/internal/completedRequestMap.ts +9 -0
  609. package/src/internal/concurrency.ts +83 -0
  610. package/src/internal/config.ts +598 -0
  611. package/src/internal/configError.ts +291 -0
  612. package/src/internal/configProvider/pathPatch.ts +97 -0
  613. package/src/internal/configProvider.ts +692 -0
  614. package/src/internal/configSecret.ts +71 -0
  615. package/src/internal/console.ts +136 -0
  616. package/src/internal/core-effect.ts +2146 -0
  617. package/src/internal/core-stream.ts +999 -0
  618. package/src/internal/core.ts +2765 -0
  619. package/src/internal/dataSource.ts +258 -0
  620. package/src/internal/defaultServices/console.ts +97 -0
  621. package/src/internal/defaultServices.ts +140 -0
  622. package/src/internal/deferred.ts +44 -0
  623. package/src/internal/effect/circular.ts +664 -0
  624. package/src/internal/executionStrategy.ts +72 -0
  625. package/src/internal/fiber.ts +350 -0
  626. package/src/internal/fiberId.ts +270 -0
  627. package/src/internal/fiberMessage.ts +85 -0
  628. package/src/internal/fiberRefs/patch.ts +144 -0
  629. package/src/internal/fiberRefs.ts +239 -0
  630. package/src/internal/fiberRuntime.ts +3477 -0
  631. package/src/internal/fiberScope.ts +72 -0
  632. package/src/internal/fiberStatus.ts +118 -0
  633. package/src/internal/groupBy.ts +516 -0
  634. package/src/internal/keyedPool.ts +240 -0
  635. package/src/internal/layer/circular.ts +203 -0
  636. package/src/internal/layer.ts +1230 -0
  637. package/src/internal/logSpan.ts +15 -0
  638. package/src/internal/logger-circular.ts +24 -0
  639. package/src/internal/logger.ts +307 -0
  640. package/src/internal/metric/boundaries.ts +72 -0
  641. package/src/internal/metric/hook.ts +459 -0
  642. package/src/internal/metric/key.ts +173 -0
  643. package/src/internal/metric/keyType.ts +263 -0
  644. package/src/internal/metric/label.ts +44 -0
  645. package/src/internal/metric/pair.ts +48 -0
  646. package/src/internal/metric/polling.ts +143 -0
  647. package/src/internal/metric/registry.ts +188 -0
  648. package/src/internal/metric/state.ts +286 -0
  649. package/src/internal/metric.ts +522 -0
  650. package/src/internal/opCodes/cause.ts +35 -0
  651. package/src/internal/opCodes/channel.ts +83 -0
  652. package/src/internal/opCodes/channelChildExecutorDecision.ts +17 -0
  653. package/src/internal/opCodes/channelMergeDecision.ts +11 -0
  654. package/src/internal/opCodes/channelMergeState.ts +17 -0
  655. package/src/internal/opCodes/channelMergeStrategy.ts +11 -0
  656. package/src/internal/opCodes/channelState.ts +23 -0
  657. package/src/internal/opCodes/channelUpstreamPullRequest.ts +11 -0
  658. package/src/internal/opCodes/channelUpstreamPullStrategy.ts +11 -0
  659. package/src/internal/opCodes/config.ts +65 -0
  660. package/src/internal/opCodes/configError.ts +35 -0
  661. package/src/internal/opCodes/continuation.ts +11 -0
  662. package/src/internal/opCodes/deferred.ts +11 -0
  663. package/src/internal/opCodes/effect.ts +83 -0
  664. package/src/internal/opCodes/layer.ts +53 -0
  665. package/src/internal/opCodes/streamHaltStrategy.ts +23 -0
  666. package/src/internal/pool.ts +499 -0
  667. package/src/internal/pubsub.ts +1557 -0
  668. package/src/internal/query.ts +199 -0
  669. package/src/internal/queue.ts +729 -0
  670. package/src/internal/random.ts +88 -0
  671. package/src/internal/ref.ts +164 -0
  672. package/src/internal/reloadable.ts +164 -0
  673. package/src/internal/request.ts +137 -0
  674. package/src/internal/resource.ts +64 -0
  675. package/src/internal/ringBuffer.ts +68 -0
  676. package/src/internal/runtime.ts +348 -0
  677. package/src/internal/runtimeFlags.ts +176 -0
  678. package/src/internal/runtimeFlagsPatch.ts +103 -0
  679. package/src/internal/schedule/decision.ts +47 -0
  680. package/src/internal/schedule/interval.ts +101 -0
  681. package/src/internal/schedule/intervals.ts +179 -0
  682. package/src/internal/schedule.ts +2096 -0
  683. package/src/internal/scopedCache.ts +634 -0
  684. package/src/internal/scopedRef.ts +133 -0
  685. package/src/internal/singleShotGen.ts +35 -0
  686. package/src/internal/sink.ts +2118 -0
  687. package/src/internal/stm/core.ts +804 -0
  688. package/src/internal/stm/opCodes/stm.ts +71 -0
  689. package/src/internal/stm/opCodes/stmState.ts +17 -0
  690. package/src/internal/stm/opCodes/strategy.ts +17 -0
  691. package/src/internal/stm/opCodes/tExit.ts +29 -0
  692. package/src/internal/stm/opCodes/tryCommit.ts +11 -0
  693. package/src/internal/stm/stm/entry.ts +59 -0
  694. package/src/internal/stm/stm/journal.ts +123 -0
  695. package/src/internal/stm/stm/opCodes/stm.ts +71 -0
  696. package/src/internal/stm/stm/opCodes/stmState.ts +17 -0
  697. package/src/internal/stm/stm/opCodes/strategy.ts +17 -0
  698. package/src/internal/stm/stm/opCodes/tExit.ts +29 -0
  699. package/src/internal/stm/stm/opCodes/tryCommit.ts +11 -0
  700. package/src/internal/stm/stm/stmState.ts +130 -0
  701. package/src/internal/stm/stm/tExit.ts +180 -0
  702. package/src/internal/stm/stm/tryCommit.ts +34 -0
  703. package/src/internal/stm/stm/txnId.ts +14 -0
  704. package/src/internal/stm/stm/versioned.ts +4 -0
  705. package/src/internal/stm/stm.ts +1491 -0
  706. package/src/internal/stm/tArray.ts +550 -0
  707. package/src/internal/stm/tDeferred.ts +79 -0
  708. package/src/internal/stm/tMap.ts +824 -0
  709. package/src/internal/stm/tPriorityQueue.ts +259 -0
  710. package/src/internal/stm/tPubSub.ts +542 -0
  711. package/src/internal/stm/tQueue.ts +400 -0
  712. package/src/internal/stm/tRandom.ts +140 -0
  713. package/src/internal/stm/tReentrantLock.ts +352 -0
  714. package/src/internal/stm/tRef.ts +190 -0
  715. package/src/internal/stm/tSemaphore.ts +113 -0
  716. package/src/internal/stm/tSet.ts +237 -0
  717. package/src/internal/stream/debounceState.ts +57 -0
  718. package/src/internal/stream/emit.ts +46 -0
  719. package/src/internal/stream/haltStrategy.ts +85 -0
  720. package/src/internal/stream/handoff.ts +185 -0
  721. package/src/internal/stream/handoffSignal.ts +59 -0
  722. package/src/internal/stream/pull.ts +35 -0
  723. package/src/internal/stream/sinkEndReason.ts +30 -0
  724. package/src/internal/stream/zipAllState.ts +88 -0
  725. package/src/internal/stream/zipChunksState.ts +56 -0
  726. package/src/internal/stream.ts +8089 -0
  727. package/src/internal/string-utils.ts +107 -0
  728. package/src/internal/subscriptionRef.ts +133 -0
  729. package/src/internal/supervisor/patch.ts +190 -0
  730. package/src/internal/supervisor.ts +301 -0
  731. package/src/internal/synchronizedRef.ts +115 -0
  732. package/src/internal/take.ts +198 -0
  733. package/src/internal/testing/sleep.ts +27 -0
  734. package/src/internal/testing/suspendedWarningData.ts +85 -0
  735. package/src/internal/testing/warningData.ts +94 -0
  736. package/src/internal/timeout.ts +23 -0
  737. package/src/internal/tracer.ts +74 -0
  738. package/Error/dist/effect-Error.cjs.d.mts +0 -2
  739. package/Error/dist/effect-Error.cjs.d.mts.map +0 -1
  740. package/Error/dist/effect-Error.cjs.d.ts +0 -2
  741. package/Error/dist/effect-Error.cjs.d.ts.map +0 -1
  742. package/Error/dist/effect-Error.cjs.dev.js +0 -140
  743. package/Error/dist/effect-Error.cjs.js +0 -7
  744. package/Error/dist/effect-Error.cjs.mjs +0 -4
  745. package/Error/dist/effect-Error.cjs.prod.js +0 -140
  746. package/Error/dist/effect-Error.esm.js +0 -47
  747. package/Error/package.json +0 -4
  748. package/Hub/dist/effect-Hub.cjs.d.mts +0 -2
  749. package/Hub/dist/effect-Hub.cjs.d.mts.map +0 -1
  750. package/Hub/dist/effect-Hub.cjs.d.ts +0 -2
  751. package/Hub/dist/effect-Hub.cjs.d.ts.map +0 -1
  752. package/Hub/dist/effect-Hub.cjs.js +0 -7
  753. package/Hub/package.json +0 -4
  754. package/THub/dist/effect-THub.cjs.d.mts +0 -2
  755. package/THub/dist/effect-THub.cjs.d.mts.map +0 -1
  756. package/THub/dist/effect-THub.cjs.d.ts +0 -2
  757. package/THub/dist/effect-THub.cjs.d.ts.map +0 -1
  758. package/THub/dist/effect-THub.cjs.js +0 -7
  759. package/THub/dist/effect-THub.esm.js +0 -157
  760. package/THub/package.json +0 -4
  761. package/dist/declarations/src/Error.d.ts +0 -37
  762. package/dist/declarations/src/Error.d.ts.map +0 -1
  763. package/dist/declarations/src/Hub.d.ts.map +0 -1
  764. package/dist/declarations/src/THub.d.ts +0 -146
  765. package/dist/declarations/src/THub.d.ts.map +0 -1
  766. package/dist/scopedRef-1c2c9acf.cjs.prod.js +0 -55
  767. package/dist/scopedRef-ab4c58b0.cjs.dev.js +0 -55
  768. /package/dist/{FiberId-e594f6e8.cjs.prod.js → FiberId-1d7ac632.cjs.prod.js} +0 -0
  769. /package/dist/{FiberId-557db880.cjs.dev.js → FiberId-d88ddce6.cjs.dev.js} +0 -0
  770. /package/dist/{RuntimeFlagsPatch-ea268c50.cjs.dev.js → RuntimeFlagsPatch-69102b03.cjs.dev.js} +0 -0
  771. /package/dist/{RuntimeFlagsPatch-e2769b87.cjs.prod.js → RuntimeFlagsPatch-866fa259.cjs.prod.js} +0 -0
  772. /package/dist/{boundaries-20cfad9d.cjs.prod.js → boundaries-9af538e3.cjs.prod.js} +0 -0
  773. /package/dist/{boundaries-3810d885.cjs.dev.js → boundaries-f212e414.cjs.dev.js} +0 -0
  774. /package/dist/{configError-33e55472.cjs.prod.js → configError-b43723af.cjs.prod.js} +0 -0
  775. /package/dist/{configError-240e9b61.cjs.dev.js → configError-d5efe9c0.cjs.dev.js} +0 -0
  776. /package/dist/{configSecret-e34c1b14.cjs.dev.js → configSecret-3e8ae336.cjs.dev.js} +0 -0
  777. /package/dist/{configSecret-d1caca55.cjs.prod.js → configSecret-e2faa181.cjs.prod.js} +0 -0
  778. /package/dist/{take-2af6e92a.cjs.prod.js → take-85daaf79.cjs.prod.js} +0 -0
  779. /package/dist/{take-df9480a8.cjs.dev.js → take-f9ef9e2e.cjs.dev.js} +0 -0
package/src/Stream.ts ADDED
@@ -0,0 +1,4540 @@
1
+ /**
2
+ * @since 2.0.0
3
+ */
4
+ import type * as Cause from "./Cause"
5
+ import type * as Channel from "./Channel"
6
+ import type * as Chunk from "./Chunk"
7
+ import type * as Context from "./Context"
8
+ import type * as Deferred from "./Deferred"
9
+ import type * as Duration from "./Duration"
10
+ import type * as Effect from "./Effect"
11
+ import type * as Either from "./Either"
12
+ import type * as Exit from "./Exit"
13
+ import type { LazyArg } from "./Function"
14
+ import type * as GroupBy from "./GroupBy"
15
+ import type { TypeLambda } from "./HKT"
16
+ import * as _groupBy from "./internal/groupBy"
17
+ import * as internal from "./internal/stream"
18
+ import type * as Layer from "./Layer"
19
+ import type * as Option from "./Option"
20
+ import type * as Order from "./Order"
21
+ import type { Pipeable } from "./Pipeable"
22
+ import type { Predicate, Refinement } from "./Predicate"
23
+ import type * as PubSub from "./PubSub"
24
+ import type * as Queue from "./Queue"
25
+ import type * as Schedule from "./Schedule"
26
+ import type * as Scope from "./Scope"
27
+ import type * as Sink from "./Sink"
28
+ import type * as Emit from "./StreamEmit"
29
+ import type * as HaltStrategy from "./StreamHaltStrategy"
30
+ import type * as Take from "./Take"
31
+ import type * as Tracer from "./Tracer"
32
+ import type * as Unify from "./Unify"
33
+
34
+ /**
35
+ * @since 2.0.0
36
+ * @category symbols
37
+ */
38
+ export const StreamTypeId: unique symbol = internal.StreamTypeId
39
+
40
+ /**
41
+ * @since 2.0.0
42
+ * @category symbols
43
+ */
44
+ export type StreamTypeId = typeof StreamTypeId
45
+
46
+ /**
47
+ * A `Stream<R, E, A>` is a description of a program that, when evaluated, may
48
+ * emit zero or more values of type `A`, may fail with errors of type `E`, and
49
+ * uses an context of type `R`. One way to think of `Stream` is as a
50
+ * `Effect` program that could emit multiple values.
51
+ *
52
+ * `Stream` is a purely functional *pull* based stream. Pull based streams offer
53
+ * inherent laziness and backpressure, relieving users of the need to manage
54
+ * buffers between operators. As an optimization, `Stream` does not emit
55
+ * single values, but rather an array of values. This allows the cost of effect
56
+ * evaluation to be amortized.
57
+ *
58
+ * `Stream` forms a monad on its `A` type parameter, and has error management
59
+ * facilities for its `E` type parameter, modeled similarly to `Effect` (with
60
+ * some adjustments for the multiple-valued nature of `Stream`). These aspects
61
+ * allow for rich and expressive composition of streams.
62
+ *
63
+ * @since 2.0.0
64
+ * @category models
65
+ */
66
+ export interface Stream<R, E, A> extends Stream.Variance<R, E, A>, Pipeable {
67
+ [Unify.typeSymbol]?: unknown
68
+ [Unify.unifySymbol]?: StreamUnify<this>
69
+ [Unify.blacklistSymbol]?: StreamUnifyBlacklist
70
+ }
71
+
72
+ /**
73
+ * @since 2.0.0
74
+ * @category models
75
+ */
76
+ export interface StreamUnify<A extends { [Unify.typeSymbol]?: any }> extends Effect.EffectUnify<A> {
77
+ Stream?: () => A[Unify.typeSymbol] extends Stream<infer R0, infer E0, infer A0> | infer _ ? Stream<R0, E0, A0> : never
78
+ }
79
+
80
+ /**
81
+ * @category models
82
+ * @since 2.0.0
83
+ */
84
+ export interface StreamUnifyBlacklist extends Effect.EffectUnifyBlacklist {
85
+ Effect?: true
86
+ }
87
+
88
+ /**
89
+ * @since 2.0.0
90
+ * @category models
91
+ */
92
+ declare module "./Effect" {
93
+ interface Effect<R, E, A> extends Stream<R, E, A> {}
94
+ interface EffectUnifyBlacklist {
95
+ Stream?: true
96
+ }
97
+ }
98
+
99
+ /**
100
+ * @category type lambdas
101
+ * @since 2.0.0
102
+ */
103
+ export interface StreamTypeLambda extends TypeLambda {
104
+ readonly type: Stream<this["Out2"], this["Out1"], this["Target"]>
105
+ }
106
+
107
+ /**
108
+ * @since 2.0.0
109
+ */
110
+ export declare namespace Stream {
111
+ /**
112
+ * @since 2.0.0
113
+ * @category models
114
+ */
115
+ export interface Variance<R, E, A> {
116
+ readonly [StreamTypeId]: {
117
+ _R: (_: never) => R
118
+ _E: (_: never) => E
119
+ _A: (_: never) => A
120
+ }
121
+ }
122
+
123
+ /**
124
+ * @since 2.0.0
125
+ * @category models
126
+ */
127
+ export type DynamicTuple<T, N extends number> = N extends N ? number extends N ? Array<T> : DynamicTupleOf<T, N, []>
128
+ : never
129
+
130
+ /**
131
+ * @since 2.0.0
132
+ * @category models
133
+ */
134
+ export type DynamicTupleOf<T, N extends number, R extends Array<unknown>> = R["length"] extends N ? R
135
+ : DynamicTupleOf<T, N, [T, ...R]>
136
+ }
137
+
138
+ /**
139
+ * The default chunk size used by the various combinators and constructors of
140
+ * `Stream`.
141
+ *
142
+ * @since 2.0.0
143
+ * @category constants
144
+ */
145
+ export const DefaultChunkSize: number = internal.DefaultChunkSize
146
+
147
+ /**
148
+ * Creates a stream from a single value that will get cleaned up after the
149
+ * stream is consumed.
150
+ *
151
+ * @since 2.0.0
152
+ * @category constructors
153
+ */
154
+ export const acquireRelease: <R, E, A, R2, _>(
155
+ acquire: Effect.Effect<R, E, A>,
156
+ release: (resource: A, exit: Exit.Exit<unknown, unknown>) => Effect.Effect<R2, never, _>
157
+ ) => Stream<R | R2, E, A> = internal.acquireRelease
158
+
159
+ /**
160
+ * Aggregates elements of this stream using the provided sink for as long as
161
+ * the downstream operators on the stream are busy.
162
+ *
163
+ * This operator divides the stream into two asynchronous "islands". Operators
164
+ * upstream of this operator run on one fiber, while downstream operators run
165
+ * on another. Whenever the downstream fiber is busy processing elements, the
166
+ * upstream fiber will feed elements into the sink until it signals
167
+ * completion.
168
+ *
169
+ * Any sink can be used here, but see `Sink.foldWeightedEffect` and
170
+ * `Sink.foldUntilEffect` for sinks that cover the common usecases.
171
+ *
172
+ * @since 2.0.0
173
+ * @category utils
174
+ */
175
+ export const aggregate: {
176
+ <R2, E2, A, A2, B>(sink: Sink.Sink<R2, E2, A | A2, A2, B>): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, B>
177
+ <R, E, R2, E2, A, A2, B>(self: Stream<R, E, A>, sink: Sink.Sink<R2, E2, A | A2, A2, B>): Stream<R | R2, E | E2, B>
178
+ } = internal.aggregate
179
+
180
+ /**
181
+ * Like `aggregateWithinEither`, but only returns the `Right` results.
182
+ *
183
+ * @param sink A `Sink` used to perform the aggregation.
184
+ * @param schedule A `Schedule` used to signal when to stop the aggregation.
185
+ * @since 2.0.0
186
+ * @category utils
187
+ */
188
+ export const aggregateWithin: {
189
+ <R2, E2, A, A2, B, R3, C>(
190
+ sink: Sink.Sink<R2, E2, A | A2, A2, B>,
191
+ schedule: Schedule.Schedule<R3, Option.Option<B>, C>
192
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R3 | R, E2 | E, B>
193
+ <R, E, R2, E2, A, A2, B, R3, C>(
194
+ self: Stream<R, E, A>,
195
+ sink: Sink.Sink<R2, E2, A | A2, A2, B>,
196
+ schedule: Schedule.Schedule<R3, Option.Option<B>, C>
197
+ ): Stream<R | R2 | R3, E | E2, B>
198
+ } = internal.aggregateWithin
199
+
200
+ /**
201
+ * Aggregates elements using the provided sink until it completes, or until
202
+ * the delay signalled by the schedule has passed.
203
+ *
204
+ * This operator divides the stream into two asynchronous islands. Operators
205
+ * upstream of this operator run on one fiber, while downstream operators run
206
+ * on another. Elements will be aggregated by the sink until the downstream
207
+ * fiber pulls the aggregated value, or until the schedule's delay has passed.
208
+ *
209
+ * Aggregated elements will be fed into the schedule to determine the delays
210
+ * between pulls.
211
+ *
212
+ * @param sink A `Sink` used to perform the aggregation.
213
+ * @param schedule A `Schedule` used to signal when to stop the aggregation.
214
+ * @since 2.0.0
215
+ * @category utils
216
+ */
217
+ export const aggregateWithinEither: {
218
+ <R2, E2, A, A2, B, R3, C>(
219
+ sink: Sink.Sink<R2, E2, A | A2, A2, B>,
220
+ schedule: Schedule.Schedule<R3, Option.Option<B>, C>
221
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R3 | R, E2 | E, Either.Either<C, B>>
222
+ <R, E, R2, E2, A, A2, B, R3, C>(
223
+ self: Stream<R, E, A>,
224
+ sink: Sink.Sink<R2, E2, A | A2, A2, B>,
225
+ schedule: Schedule.Schedule<R3, Option.Option<B>, C>
226
+ ): Stream<R | R2 | R3, E | E2, Either.Either<C, B>>
227
+ } = internal.aggregateWithinEither
228
+
229
+ /**
230
+ * Maps the success values of this stream to the specified constant value.
231
+ *
232
+ * @since 2.0.0
233
+ * @category mapping
234
+ */
235
+ export const as: {
236
+ <B>(value: B): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, B>
237
+ <R, E, A, B>(self: Stream<R, E, A>, value: B): Stream<R, E, B>
238
+ } = internal.as
239
+
240
+ const _async: <R, E, A>(register: (emit: Emit.Emit<R, E, A, void>) => void, outputBuffer?: number) => Stream<R, E, A> =
241
+ internal._async
242
+ export {
243
+ /**
244
+ * Creates a stream from an asynchronous callback that can be called multiple
245
+ * times. The optionality of the error type `E` can be used to signal the end
246
+ * of the stream, by setting it to `None`.
247
+ *
248
+ * @since 2.0.0
249
+ * @category constructors
250
+ */
251
+ _async as async
252
+ }
253
+
254
+ /**
255
+ * Creates a stream from an asynchronous callback that can be called multiple
256
+ * times The registration of the callback itself returns an effect. The
257
+ * optionality of the error type `E` can be used to signal the end of the
258
+ * stream, by setting it to `None`.
259
+ *
260
+ * @since 2.0.0
261
+ * @category constructors
262
+ */
263
+ export const asyncEffect: <R, E, A>(
264
+ register: (emit: Emit.Emit<R, E, A, void>) => Effect.Effect<R, E, unknown>,
265
+ outputBuffer?: number
266
+ ) => Stream<R, E, A> = internal.asyncEffect
267
+
268
+ /**
269
+ * Creates a stream from an asynchronous callback that can be called multiple
270
+ * times. The registration of the callback returns either a canceler or
271
+ * synchronously returns a stream. The optionality of the error type `E` can
272
+ * be used to signal the end of the stream, by setting it to `None`.
273
+ *
274
+ * @since 2.0.0
275
+ * @category constructors
276
+ */
277
+ export const asyncInterrupt: <R, E, A>(
278
+ register: (emit: Emit.Emit<R, E, A, void>) => Either.Either<Effect.Effect<R, never, unknown>, Stream<R, E, A>>,
279
+ outputBuffer?: number
280
+ ) => Stream<R, E, A> = internal.asyncInterrupt
281
+
282
+ /**
283
+ * Creates a stream from an asynchronous callback that can be called multiple
284
+ * times. The registration of the callback can possibly return the stream
285
+ * synchronously. The optionality of the error type `E` can be used to signal
286
+ * the end of the stream, by setting it to `None`.
287
+ *
288
+ * @since 2.0.0
289
+ * @category constructors
290
+ */
291
+ export const asyncOption: <R, E, A>(
292
+ register: (emit: Emit.Emit<R, E, A, void>) => Option.Option<Stream<R, E, A>>,
293
+ outputBuffer?: number
294
+ ) => Stream<R, E, A> = internal.asyncOption
295
+
296
+ /**
297
+ * Creates a stream from an asynchronous callback that can be called multiple
298
+ * times. The registration of the callback itself returns an a scoped
299
+ * resource. The optionality of the error type `E` can be used to signal the
300
+ * end of the stream, by setting it to `None`.
301
+ *
302
+ * @since 2.0.0
303
+ * @category constructors
304
+ */
305
+ export const asyncScoped: <R, E, A>(
306
+ register: (emit: Emit.Emit<R, E, A, void>) => Effect.Effect<R, E, unknown>,
307
+ outputBuffer?: number
308
+ ) => Stream<Exclude<R, Scope.Scope>, E, A> = internal.asyncScoped
309
+
310
+ /**
311
+ * Returns a `Stream` that first collects `n` elements from the input `Stream`,
312
+ * and then creates a new `Stream` using the specified function, and sends all
313
+ * the following elements through that.
314
+ *
315
+ * @since 2.0.0
316
+ * @category sequencing
317
+ */
318
+ export const branchAfter: {
319
+ <A, R2, E2, A2>(
320
+ n: number,
321
+ f: (input: Chunk.Chunk<A>) => Stream<R2, E2, A2>
322
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
323
+ <R, E, A, R2, E2, A2>(
324
+ self: Stream<R, E, A>,
325
+ n: number,
326
+ f: (input: Chunk.Chunk<A>) => Stream<R2, E2, A2>
327
+ ): Stream<R | R2, E | E2, A2>
328
+ } = internal.branchAfter
329
+
330
+ /**
331
+ * Fan out the stream, producing a list of streams that have the same elements
332
+ * as this stream. The driver stream will only ever advance the `maximumLag`
333
+ * chunks before the slowest downstream stream.
334
+ *
335
+ * @since 2.0.0
336
+ * @category utils
337
+ */
338
+ export const broadcast: {
339
+ <N extends number>(
340
+ n: N,
341
+ maximumLag: number
342
+ ): <R, E, A>(
343
+ self: Stream<R, E, A>
344
+ ) => Effect.Effect<Scope.Scope | R, never, Stream.DynamicTuple<Stream<never, E, A>, N>>
345
+ <R, E, A, N extends number>(
346
+ self: Stream<R, E, A>,
347
+ n: N,
348
+ maximumLag: number
349
+ ): Effect.Effect<Scope.Scope | R, never, Stream.DynamicTuple<Stream<never, E, A>, N>>
350
+ } = internal.broadcast
351
+
352
+ /**
353
+ * Fan out the stream, producing a dynamic number of streams that have the
354
+ * same elements as this stream. The driver stream will only ever advance the
355
+ * `maximumLag` chunks before the slowest downstream stream.
356
+ *
357
+ * @since 2.0.0
358
+ * @category utils
359
+ */
360
+ export const broadcastDynamic: {
361
+ (maximumLag: number): <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R, never, Stream<never, E, A>>
362
+ <R, E, A>(self: Stream<R, E, A>, maximumLag: number): Effect.Effect<Scope.Scope | R, never, Stream<never, E, A>>
363
+ } = internal.broadcastDynamic
364
+
365
+ /**
366
+ * Converts the stream to a scoped list of queues. Every value will be
367
+ * replicated to every queue with the slowest queue being allowed to buffer
368
+ * `maximumLag` chunks before the driver is back pressured.
369
+ *
370
+ * Queues can unsubscribe from upstream by shutting down.
371
+ *
372
+ * @since 2.0.0
373
+ * @category utils
374
+ */
375
+ export const broadcastedQueues: {
376
+ <N extends number>(
377
+ n: N,
378
+ maximumLag: number
379
+ ): <R, E, A>(
380
+ self: Stream<R, E, A>
381
+ ) => Effect.Effect<Scope.Scope | R, never, Stream.DynamicTuple<Queue.Dequeue<Take.Take<E, A>>, N>>
382
+ <R, E, A, N extends number>(
383
+ self: Stream<R, E, A>,
384
+ n: N,
385
+ maximumLag: number
386
+ ): Effect.Effect<Scope.Scope | R, never, Stream.DynamicTuple<Queue.Dequeue<Take.Take<E, A>>, N>>
387
+ } = internal.broadcastedQueues
388
+
389
+ /**
390
+ * Converts the stream to a scoped dynamic amount of queues. Every chunk will
391
+ * be replicated to every queue with the slowest queue being allowed to buffer
392
+ * `maximumLag` chunks before the driver is back pressured.
393
+ *
394
+ * Queues can unsubscribe from upstream by shutting down.
395
+ *
396
+ * @since 2.0.0
397
+ * @category utils
398
+ */
399
+ export const broadcastedQueuesDynamic: {
400
+ (
401
+ maximumLag: number
402
+ ): <R, E, A>(
403
+ self: Stream<R, E, A>
404
+ ) => Effect.Effect<Scope.Scope | R, never, Effect.Effect<Scope.Scope, never, Queue.Dequeue<Take.Take<E, A>>>>
405
+ <R, E, A>(
406
+ self: Stream<R, E, A>,
407
+ maximumLag: number
408
+ ): Effect.Effect<Scope.Scope | R, never, Effect.Effect<Scope.Scope, never, Queue.Dequeue<Take.Take<E, A>>>>
409
+ } = internal.broadcastedQueuesDynamic
410
+
411
+ /**
412
+ * Allows a faster producer to progress independently of a slower consumer by
413
+ * buffering up to `capacity` elements in a queue.
414
+ *
415
+ * @note This combinator destroys the chunking structure. It's recommended to
416
+ * use rechunk afterwards. Additionally, prefer capacities that are powers
417
+ * of 2 for better performance.
418
+ * @since 2.0.0
419
+ * @category utils
420
+ */
421
+ export const buffer: {
422
+ (
423
+ options: { readonly capacity: "unbounded" } | {
424
+ readonly capacity: number
425
+ readonly strategy?: "dropping" | "sliding" | "suspend"
426
+ }
427
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
428
+ <R, E, A>(
429
+ self: Stream<R, E, A>,
430
+ options: { readonly capacity: "unbounded" } | {
431
+ readonly capacity: number
432
+ readonly strategy?: "dropping" | "sliding" | "suspend"
433
+ }
434
+ ): Stream<R, E, A>
435
+ } = internal.buffer
436
+
437
+ /**
438
+ * Allows a faster producer to progress independently of a slower consumer by
439
+ * buffering up to `capacity` chunks in a queue.
440
+ *
441
+ * @note Prefer capacities that are powers of 2 for better performance.
442
+ * @since 2.0.0
443
+ * @category utils
444
+ */
445
+ export const bufferChunks: {
446
+ (
447
+ options: {
448
+ readonly capacity: number
449
+ readonly strategy?: "dropping" | "sliding" | "suspend"
450
+ }
451
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
452
+ <R, E, A>(
453
+ self: Stream<R, E, A>,
454
+ options: {
455
+ readonly capacity: number
456
+ readonly strategy?: "dropping" | "sliding" | "suspend"
457
+ }
458
+ ): Stream<R, E, A>
459
+ } = internal.bufferChunks
460
+
461
+ /**
462
+ * Switches over to the stream produced by the provided function in case this
463
+ * one fails with a typed error.
464
+ *
465
+ * @since 2.0.0
466
+ * @category error handling
467
+ */
468
+ export const catchAll: {
469
+ <E, R2, E2, A2>(f: (error: E) => Stream<R2, E2, A2>): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2, A2 | A>
470
+ <R, A, E, R2, E2, A2>(self: Stream<R, E, A>, f: (error: E) => Stream<R2, E2, A2>): Stream<R | R2, E2, A | A2>
471
+ } = internal.catchAll
472
+
473
+ /**
474
+ * Switches over to the stream produced by the provided function in case this
475
+ * one fails. Allows recovery from all causes of failure, including
476
+ * interruption if the stream is uninterruptible.
477
+ *
478
+ * @since 2.0.0
479
+ * @category error handling
480
+ */
481
+ export const catchAllCause: {
482
+ <E, R2, E2, A2>(
483
+ f: (cause: Cause.Cause<E>) => Stream<R2, E2, A2>
484
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2, A2 | A>
485
+ <R, A, E, R2, E2, A2>(
486
+ self: Stream<R, E, A>,
487
+ f: (cause: Cause.Cause<E>) => Stream<R2, E2, A2>
488
+ ): Stream<R | R2, E2, A | A2>
489
+ } = internal.catchAllCause
490
+
491
+ /**
492
+ * Switches over to the stream produced by the provided function in case this
493
+ * one fails with some typed error.
494
+ *
495
+ * @since 2.0.0
496
+ * @category error handling
497
+ */
498
+ export const catchSome: {
499
+ <E, R2, E2, A2>(
500
+ pf: (error: E) => Option.Option<Stream<R2, E2, A2>>
501
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E | E2, A2 | A>
502
+ <R, A, E, R2, E2, A2>(
503
+ self: Stream<R, E, A>,
504
+ pf: (error: E) => Option.Option<Stream<R2, E2, A2>>
505
+ ): Stream<R | R2, E | E2, A | A2>
506
+ } = internal.catchSome
507
+
508
+ /**
509
+ * Switches over to the stream produced by the provided function in case this
510
+ * one fails with an error matching the given `_tag`.
511
+ *
512
+ * @since 2.0.0
513
+ * @category error handling
514
+ */
515
+ export const catchTag: {
516
+ <K extends E["_tag"] & string, E extends { _tag: string }, R1, E1, A1>(
517
+ k: K,
518
+ f: (e: Extract<E, { _tag: K }>) => Stream<R1, E1, A1>
519
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R1 | R, E1 | Exclude<E, { _tag: K }>, A1 | A>
520
+ <R, E extends { _tag: string }, A, K extends E["_tag"] & string, R1, E1, A1>(
521
+ self: Stream<R, E, A>,
522
+ k: K,
523
+ f: (e: Extract<E, { _tag: K }>) => Stream<R1, E1, A1>
524
+ ): Stream<R | R1, E1 | Exclude<E, { _tag: K }>, A | A1>
525
+ } = internal.catchTag
526
+
527
+ /**
528
+ * Switches over to the stream produced by one of the provided functions, in
529
+ * case this one fails with an error matching one of the given `_tag`'s.
530
+ *
531
+ * @since 2.0.0
532
+ * @category error handling
533
+ */
534
+ export const catchTags: {
535
+ <
536
+ E extends { _tag: string },
537
+ Cases extends { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Stream<any, any, any>) | undefined }
538
+ >(
539
+ cases: Cases
540
+ ): <R, A>(
541
+ self: Stream<R, E, A>
542
+ ) => Stream<
543
+ | R
544
+ | {
545
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Stream.Variance<infer R, infer _E, infer _A> ? R
546
+ : never
547
+ }[keyof Cases],
548
+ | Exclude<E, { _tag: keyof Cases }>
549
+ | {
550
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Stream.Variance<infer _R, infer E, infer _A> ? E
551
+ : never
552
+ }[keyof Cases],
553
+ | A
554
+ | {
555
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Stream.Variance<infer _R, infer _E, infer A> ? A
556
+ : never
557
+ }[keyof Cases]
558
+ >
559
+ <
560
+ R,
561
+ E extends { _tag: string },
562
+ A,
563
+ Cases extends { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Stream<any, any, any>) | undefined }
564
+ >(
565
+ self: Stream<R, E, A>,
566
+ cases: Cases
567
+ ): Stream<
568
+ | R
569
+ | {
570
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Stream.Variance<infer R, infer _E, infer _A> ? R
571
+ : never
572
+ }[keyof Cases],
573
+ | Exclude<E, { _tag: keyof Cases }>
574
+ | {
575
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Stream.Variance<infer _R, infer E, infer _A> ? E
576
+ : never
577
+ }[keyof Cases],
578
+ | A
579
+ | {
580
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Stream.Variance<infer _R, infer _E, infer A> ? A
581
+ : never
582
+ }[keyof Cases]
583
+ >
584
+ } = internal.catchTags
585
+
586
+ /**
587
+ * Switches over to the stream produced by the provided function in case this
588
+ * one fails with some errors. Allows recovery from all causes of failure,
589
+ * including interruption if the stream is uninterruptible.
590
+ *
591
+ * @since 2.0.0
592
+ * @category error handling
593
+ */
594
+ export const catchSomeCause: {
595
+ <E, R2, E2, A2>(
596
+ pf: (cause: Cause.Cause<E>) => Option.Option<Stream<R2, E2, A2>>
597
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E | E2, A2 | A>
598
+ <R, A, E, R2, E2, A2>(
599
+ self: Stream<R, E, A>,
600
+ pf: (cause: Cause.Cause<E>) => Option.Option<Stream<R2, E2, A2>>
601
+ ): Stream<R | R2, E | E2, A | A2>
602
+ } = internal.catchSomeCause
603
+
604
+ /**
605
+ * Returns a new stream that only emits elements that are not equal to the
606
+ * previous element emitted, using natural equality to determine whether two
607
+ * elements are equal.
608
+ *
609
+ * @since 2.0.0
610
+ * @category utils
611
+ */
612
+ export const changes: <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A> = internal.changes
613
+
614
+ /**
615
+ * Returns a new stream that only emits elements that are not equal to the
616
+ * previous element emitted, using the specified function to determine whether
617
+ * two elements are equal.
618
+ *
619
+ * @since 2.0.0
620
+ * @category utils
621
+ */
622
+ export const changesWith: {
623
+ <A>(f: (x: A, y: A) => boolean): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
624
+ <R, E, A>(self: Stream<R, E, A>, f: (x: A, y: A) => boolean): Stream<R, E, A>
625
+ } = internal.changesWith
626
+
627
+ /**
628
+ * Returns a new stream that only emits elements that are not equal to the
629
+ * previous element emitted, using the specified effectual function to
630
+ * determine whether two elements are equal.
631
+ *
632
+ * @since 2.0.0
633
+ * @category utils
634
+ */
635
+ export const changesWithEffect: {
636
+ <A, R2, E2>(
637
+ f: (x: A, y: A) => Effect.Effect<R2, E2, boolean>
638
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
639
+ <R, E, A, R2, E2>(self: Stream<R, E, A>, f: (x: A, y: A) => Effect.Effect<R2, E2, boolean>): Stream<R | R2, E | E2, A>
640
+ } = internal.changesWithEffect
641
+
642
+ /**
643
+ * Exposes the underlying chunks of the stream as a stream of chunks of
644
+ * elements.
645
+ *
646
+ * @since 2.0.0
647
+ * @category utils
648
+ */
649
+ export const chunks: <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>> = internal.chunks
650
+
651
+ /**
652
+ * Performs the specified stream transformation with the chunk structure of
653
+ * the stream exposed.
654
+ *
655
+ * @since 2.0.0
656
+ * @category utils
657
+ */
658
+ export const chunksWith: <R, E, A, R2, E2, A2>(
659
+ f: (stream: Stream<R, E, Chunk.Chunk<A>>) => Stream<R2, E2, Chunk.Chunk<A2>>
660
+ ) => (self: Stream<R, E, A>) => Stream<R | R2, E | E2, A2> = internal.chunksWith
661
+
662
+ /**
663
+ * Combines the elements from this stream and the specified stream by
664
+ * repeatedly applying the function `f` to extract an element using both sides
665
+ * and conceptually "offer" it to the destination stream. `f` can maintain
666
+ * some internal state to control the combining process, with the initial
667
+ * state being specified by `s`.
668
+ *
669
+ * Where possible, prefer `Stream.combineChunks` for a more efficient
670
+ * implementation.
671
+ *
672
+ * @since 2.0.0
673
+ * @category utils
674
+ */
675
+ export const combine: {
676
+ <R2, E2, A2, S, R3, E, A, R4, R5, A3>(
677
+ that: Stream<R2, E2, A2>,
678
+ s: S,
679
+ f: (
680
+ s: S,
681
+ pullLeft: Effect.Effect<R3, Option.Option<E>, A>,
682
+ pullRight: Effect.Effect<R4, Option.Option<E2>, A2>
683
+ ) => Effect.Effect<R5, never, Exit.Exit<Option.Option<E2 | E>, readonly [A3, S]>>
684
+ ): <R>(self: Stream<R, E, A>) => Stream<R2 | R3 | R4 | R5 | R, E2 | E, A3>
685
+ <R, R2, E2, A2, S, R3, E, A, R4, R5, A3>(
686
+ self: Stream<R, E, A>,
687
+ that: Stream<R2, E2, A2>,
688
+ s: S,
689
+ f: (
690
+ s: S,
691
+ pullLeft: Effect.Effect<R3, Option.Option<E>, A>,
692
+ pullRight: Effect.Effect<R4, Option.Option<E2>, A2>
693
+ ) => Effect.Effect<R5, never, Exit.Exit<Option.Option<E2 | E>, readonly [A3, S]>>
694
+ ): Stream<R | R2 | R3 | R4 | R5, E2 | E, A3>
695
+ } = internal.combine
696
+
697
+ /**
698
+ * Combines the chunks from this stream and the specified stream by repeatedly
699
+ * applying the function `f` to extract a chunk using both sides and
700
+ * conceptually "offer" it to the destination stream. `f` can maintain some
701
+ * internal state to control the combining process, with the initial state
702
+ * being specified by `s`.
703
+ *
704
+ * @since 2.0.0
705
+ * @category utils
706
+ */
707
+ export const combineChunks: {
708
+ <R2, E2, A2, S, R3, E, A, R4, R5, A3>(
709
+ that: Stream<R2, E2, A2>,
710
+ s: S,
711
+ f: (
712
+ s: S,
713
+ pullLeft: Effect.Effect<R3, Option.Option<E>, Chunk.Chunk<A>>,
714
+ pullRight: Effect.Effect<R4, Option.Option<E2>, Chunk.Chunk<A2>>
715
+ ) => Effect.Effect<R5, never, Exit.Exit<Option.Option<E2 | E>, readonly [Chunk.Chunk<A3>, S]>>
716
+ ): <R>(self: Stream<R, E, A>) => Stream<R2 | R3 | R4 | R5 | R, E2 | E, A3>
717
+ <R, R2, E2, A2, S, R3, E, A, R4, R5, A3>(
718
+ self: Stream<R, E, A>,
719
+ that: Stream<R2, E2, A2>,
720
+ s: S,
721
+ f: (
722
+ s: S,
723
+ pullLeft: Effect.Effect<R3, Option.Option<E>, Chunk.Chunk<A>>,
724
+ pullRight: Effect.Effect<R4, Option.Option<E2>, Chunk.Chunk<A2>>
725
+ ) => Effect.Effect<R5, never, Exit.Exit<Option.Option<E2 | E>, readonly [Chunk.Chunk<A3>, S]>>
726
+ ): Stream<R | R2 | R3 | R4 | R5, E2 | E, A3>
727
+ } = internal.combineChunks
728
+
729
+ /**
730
+ * Concatenates the specified stream with this stream, resulting in a stream
731
+ * that emits the elements from this stream and then the elements from the
732
+ * specified stream.
733
+ *
734
+ * @since 2.0.0
735
+ * @category utils
736
+ */
737
+ export const concat: {
738
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2 | A>
739
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A | A2>
740
+ } = internal.concat
741
+
742
+ /**
743
+ * Concatenates all of the streams in the chunk to one stream.
744
+ *
745
+ * @since 2.0.0
746
+ * @category constructors
747
+ */
748
+ export const concatAll: <R, E, A>(streams: Chunk.Chunk<Stream<R, E, A>>) => Stream<R, E, A> = internal.concatAll
749
+
750
+ /**
751
+ * Composes this stream with the specified stream to create a cartesian
752
+ * product of elements. The `that` stream would be run multiple times, for
753
+ * every element in the `this` stream.
754
+ *
755
+ * See also `Stream.zip` for the more common point-wise variant.
756
+ *
757
+ * @since 2.0.0
758
+ * @category utils
759
+ */
760
+ export const cross: {
761
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, readonly [A, A2]>
762
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, readonly [A, A2]>
763
+ } = internal.cross
764
+
765
+ /**
766
+ * Composes this stream with the specified stream to create a cartesian
767
+ * product of elements, but keeps only elements from this stream. The `that`
768
+ * stream would be run multiple times, for every element in the `this` stream.
769
+ *
770
+ * See also `Stream.zipLeft` for the more common point-wise variant.
771
+ *
772
+ * @since 2.0.0
773
+ * @category utils
774
+ */
775
+ export const crossLeft: {
776
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
777
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A>
778
+ } = internal.crossLeft
779
+
780
+ /**
781
+ * Composes this stream with the specified stream to create a cartesian
782
+ * product of elements, but keeps only elements from the other stream. The
783
+ * `that` stream would be run multiple times, for every element in the `this`
784
+ * stream.
785
+ *
786
+ * See also `Stream.zipRight` for the more common point-wise variant.
787
+ *
788
+ * @since 2.0.0
789
+ * @category utils
790
+ */
791
+ export const crossRight: {
792
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
793
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A2>
794
+ } = internal.crossRight
795
+
796
+ /**
797
+ * Composes this stream with the specified stream to create a cartesian
798
+ * product of elements with a specified function. The `that` stream would be
799
+ * run multiple times, for every element in the `this` stream.
800
+ *
801
+ * See also `Stream.zipWith` for the more common point-wise variant.
802
+ *
803
+ * @since 2.0.0
804
+ * @category utils
805
+ */
806
+ export const crossWith: {
807
+ <R2, E2, B, A, C>(
808
+ that: Stream<R2, E2, B>,
809
+ f: (a: A, b: B) => C
810
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, C>
811
+ <R, E, R2, E2, B, A, C>(
812
+ self: Stream<R, E, A>,
813
+ that: Stream<R2, E2, B>,
814
+ f: (a: A, b: B) => C
815
+ ): Stream<R | R2, E | E2, C>
816
+ } = internal.crossWith
817
+
818
+ /**
819
+ * Delays the emission of values by holding new values for a set duration. If
820
+ * no new values arrive during that time the value is emitted, however if a
821
+ * new value is received during the holding period the previous value is
822
+ * discarded and the process is repeated with the new value.
823
+ *
824
+ * This operator is useful if you have a stream of "bursty" events which
825
+ * eventually settle down and you only need the final event of the burst. For
826
+ * example, a search engine may only want to initiate a search after a user
827
+ * has paused typing so as to not prematurely recommend results.
828
+ *
829
+ * @since 2.0.0
830
+ * @category utils
831
+ */
832
+ export const debounce: {
833
+ (duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
834
+ <R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
835
+ } = internal.debounce
836
+
837
+ /**
838
+ * The stream that dies with the specified defect.
839
+ *
840
+ * @since 2.0.0
841
+ * @category constructors
842
+ */
843
+ export const die: (defect: unknown) => Stream<never, never, never> = internal.die
844
+
845
+ /**
846
+ * The stream that dies with the specified lazily evaluated defect.
847
+ *
848
+ * @since 2.0.0
849
+ * @category constructors
850
+ */
851
+ export const dieSync: (evaluate: LazyArg<unknown>) => Stream<never, never, never> = internal.dieSync
852
+
853
+ /**
854
+ * The stream that dies with an exception described by `message`.
855
+ *
856
+ * @since 2.0.0
857
+ * @category constructors
858
+ */
859
+ export const dieMessage: (message: string) => Stream<never, never, never> = internal.dieMessage
860
+
861
+ /**
862
+ * More powerful version of `Stream.broadcast`. Allows to provide a function
863
+ * that determines what queues should receive which elements. The decide
864
+ * function will receive the indices of the queues in the resulting list.
865
+ *
866
+ * @since 2.0.0
867
+ * @category utils
868
+ */
869
+ export const distributedWith: {
870
+ <N extends number, A>(
871
+ options: {
872
+ readonly size: N
873
+ readonly maximumLag: number
874
+ readonly decide: (a: A) => Effect.Effect<never, never, Predicate<number>>
875
+ }
876
+ ): <R, E>(
877
+ self: Stream<R, E, A>
878
+ ) => Effect.Effect<Scope.Scope | R, never, Stream.DynamicTuple<Queue.Dequeue<Exit.Exit<Option.Option<E>, A>>, N>>
879
+ <R, E, N extends number, A>(
880
+ self: Stream<R, E, A>,
881
+ options: {
882
+ readonly size: N
883
+ readonly maximumLag: number
884
+ readonly decide: (a: A) => Effect.Effect<never, never, Predicate<number>>
885
+ }
886
+ ): Effect.Effect<Scope.Scope | R, never, Stream.DynamicTuple<Queue.Dequeue<Exit.Exit<Option.Option<E>, A>>, N>>
887
+ } = internal.distributedWith
888
+
889
+ /**
890
+ * More powerful version of `Stream.distributedWith`. This returns a function
891
+ * that will produce new queues and corresponding indices. You can also
892
+ * provide a function that will be executed after the final events are
893
+ * enqueued in all queues. Shutdown of the queues is handled by the driver.
894
+ * Downstream users can also shutdown queues manually. In this case the driver
895
+ * will continue but no longer backpressure on them.
896
+ *
897
+ * @since 2.0.0
898
+ * @category utils
899
+ */
900
+ export const distributedWithDynamic: {
901
+ <E, A, _>(
902
+ options: {
903
+ readonly maximumLag: number
904
+ readonly decide: (a: A) => Effect.Effect<never, never, Predicate<number>>
905
+ }
906
+ ): <R>(
907
+ self: Stream<R, E, A>
908
+ ) => Effect.Effect<
909
+ Scope.Scope | R,
910
+ never,
911
+ Effect.Effect<never, never, readonly [number, Queue.Dequeue<Exit.Exit<Option.Option<E>, A>>]>
912
+ >
913
+ <R, E, A, _>(
914
+ self: Stream<R, E, A>,
915
+ options: {
916
+ readonly maximumLag: number
917
+ readonly decide: (a: A) => Effect.Effect<never, never, Predicate<number>>
918
+ }
919
+ ): Effect.Effect<
920
+ Scope.Scope | R,
921
+ never,
922
+ Effect.Effect<never, never, readonly [number, Queue.Dequeue<Exit.Exit<Option.Option<E>, A>>]>
923
+ >
924
+ } = internal.distributedWithDynamic
925
+
926
+ /**
927
+ * Converts this stream to a stream that executes its effects but emits no
928
+ * elements. Useful for sequencing effects using streams:
929
+ *
930
+ * @since 2.0.0
931
+ * @category utils
932
+ */
933
+ export const drain: <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, never> = internal.drain
934
+
935
+ /**
936
+ * Drains the provided stream in the background for as long as this stream is
937
+ * running. If this stream ends before `other`, `other` will be interrupted.
938
+ * If `other` fails, this stream will fail with that error.
939
+ *
940
+ * @since 2.0.0
941
+ * @category utils
942
+ */
943
+ export const drainFork: {
944
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
945
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A>
946
+ } = internal.drainFork
947
+
948
+ /**
949
+ * Drops the specified number of elements from this stream.
950
+ *
951
+ * @since 2.0.0
952
+ * @category utils
953
+ */
954
+ export const drop: {
955
+ (n: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
956
+ <R, E, A>(self: Stream<R, E, A>, n: number): Stream<R, E, A>
957
+ } = internal.drop
958
+
959
+ /**
960
+ * Drops the last specified number of elements from this stream.
961
+ *
962
+ * @note This combinator keeps `n` elements in memory. Be careful with big
963
+ * numbers.
964
+ * @since 2.0.0
965
+ * @category utils
966
+ */
967
+ export const dropRight: {
968
+ (n: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
969
+ <R, E, A>(self: Stream<R, E, A>, n: number): Stream<R, E, A>
970
+ } = internal.dropRight
971
+
972
+ /**
973
+ * Drops all elements of the stream until the specified predicate evaluates to
974
+ * `true`.
975
+ *
976
+ * @since 2.0.0
977
+ * @category utils
978
+ */
979
+ export const dropUntil: {
980
+ <A, X extends A>(predicate: Predicate<X>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
981
+ <R, E, A, X extends A>(self: Stream<R, E, A>, predicate: Predicate<X>): Stream<R, E, A>
982
+ } = internal.dropUntil
983
+
984
+ /**
985
+ * Drops all elements of the stream until the specified effectful predicate
986
+ * evaluates to `true`.
987
+ *
988
+ * @since 2.0.0
989
+ * @category utils
990
+ */
991
+ export const dropUntilEffect: {
992
+ <A, X extends A, R2, E2>(
993
+ predicate: (a: X) => Effect.Effect<R2, E2, boolean>
994
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
995
+ <R, E, A, X extends A, R2, E2>(
996
+ self: Stream<R, E, A>,
997
+ predicate: (a: X) => Effect.Effect<R2, E2, boolean>
998
+ ): Stream<R | R2, E | E2, A>
999
+ } = internal.dropUntilEffect
1000
+
1001
+ /**
1002
+ * Drops all elements of the stream for as long as the specified predicate
1003
+ * evaluates to `true`.
1004
+ *
1005
+ * @since 2.0.0
1006
+ * @category utils
1007
+ */
1008
+ export const dropWhile: {
1009
+ <A, X extends A>(predicate: Predicate<X>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
1010
+ <R, E, A, X extends A>(self: Stream<R, E, A>, predicate: Predicate<X>): Stream<R, E, A>
1011
+ } = internal.dropWhile
1012
+
1013
+ /**
1014
+ * Drops all elements of the stream for as long as the specified predicate
1015
+ * produces an effect that evalutates to `true`
1016
+ *
1017
+ * @since 2.0.0
1018
+ * @category utils
1019
+ */
1020
+ export const dropWhileEffect: {
1021
+ <A, X extends A, R2, E2>(
1022
+ predicate: (a: X) => Effect.Effect<R2, E2, boolean>
1023
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
1024
+ <R, E, A, X extends A, R2, E2>(
1025
+ self: Stream<R, E, A>,
1026
+ predicate: (a: X) => Effect.Effect<R2, E2, boolean>
1027
+ ): Stream<R | R2, E | E2, A>
1028
+ } = internal.dropWhileEffect
1029
+
1030
+ /**
1031
+ * Returns a stream whose failures and successes have been lifted into an
1032
+ * `Either`. The resulting stream cannot fail, because the failures have been
1033
+ * exposed as part of the `Either` success case.
1034
+ *
1035
+ * @note The stream will end as soon as the first error occurs.
1036
+ *
1037
+ * @since 2.0.0
1038
+ * @category utils
1039
+ */
1040
+ export const either: <R, E, A>(self: Stream<R, E, A>) => Stream<R, never, Either.Either<E, A>> = internal.either
1041
+
1042
+ /**
1043
+ * The empty stream.
1044
+ *
1045
+ * @since 2.0.0
1046
+ * @category constructors
1047
+ */
1048
+ export const empty: Stream<never, never, never> = internal.empty
1049
+
1050
+ /**
1051
+ * Executes the provided finalizer after this stream's finalizers run.
1052
+ *
1053
+ * @since 2.0.0
1054
+ * @category utils
1055
+ */
1056
+ export const ensuring: {
1057
+ <R2, _>(finalizer: Effect.Effect<R2, never, _>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
1058
+ <R, E, A, R2, _>(self: Stream<R, E, A>, finalizer: Effect.Effect<R2, never, _>): Stream<R | R2, E, A>
1059
+ } = internal.ensuring
1060
+
1061
+ /**
1062
+ * Executes the provided finalizer after this stream's finalizers run.
1063
+ *
1064
+ * @since 2.0.0
1065
+ * @category utils
1066
+ */
1067
+ export const ensuringWith: {
1068
+ <E, R2>(
1069
+ finalizer: (exit: Exit.Exit<E, unknown>) => Effect.Effect<R2, never, unknown>
1070
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
1071
+ <R, E, A, R2>(
1072
+ self: Stream<R, E, A>,
1073
+ finalizer: (exit: Exit.Exit<E, unknown>) => Effect.Effect<R2, never, unknown>
1074
+ ): Stream<R | R2, E, A>
1075
+ } = internal.ensuringWith
1076
+
1077
+ /**
1078
+ * Accesses the whole context of the stream.
1079
+ *
1080
+ * @since 2.0.0
1081
+ * @category context
1082
+ */
1083
+ export const context: <R>() => Stream<R, never, Context.Context<R>> = internal.context
1084
+
1085
+ /**
1086
+ * Accesses the context of the stream.
1087
+ *
1088
+ * @since 2.0.0
1089
+ * @category context
1090
+ */
1091
+ export const contextWith: <R, A>(f: (env: Context.Context<R>) => A) => Stream<R, never, A> = internal.contextWith
1092
+
1093
+ /**
1094
+ * Accesses the context of the stream in the context of an effect.
1095
+ *
1096
+ * @since 2.0.0
1097
+ * @category context
1098
+ */
1099
+ export const contextWithEffect: <R0, R, E, A>(
1100
+ f: (env: Context.Context<R0>) => Effect.Effect<R, E, A>
1101
+ ) => Stream<R0 | R, E, A> = internal.contextWithEffect
1102
+
1103
+ /**
1104
+ * Accesses the context of the stream in the context of a stream.
1105
+ *
1106
+ * @since 2.0.0
1107
+ * @category context
1108
+ */
1109
+ export const contextWithStream: <R0, R, E, A>(
1110
+ f: (env: Context.Context<R0>) => Stream<R, E, A>
1111
+ ) => Stream<R0 | R, E, A> = internal.contextWithStream
1112
+
1113
+ /**
1114
+ * Creates a stream that executes the specified effect but emits no elements.
1115
+ *
1116
+ * @since 2.0.0
1117
+ * @category constructors
1118
+ */
1119
+ export const execute: <R, E, _>(effect: Effect.Effect<R, E, _>) => Stream<R, E, never> = internal.execute
1120
+
1121
+ /**
1122
+ * Terminates with the specified error.
1123
+ *
1124
+ * @since 2.0.0
1125
+ * @category constructors
1126
+ */
1127
+ export const fail: <E>(error: E) => Stream<never, E, never> = internal.fail
1128
+
1129
+ /**
1130
+ * Terminates with the specified lazily evaluated error.
1131
+ *
1132
+ * @since 2.0.0
1133
+ * @category constructors
1134
+ */
1135
+ export const failSync: <E>(evaluate: LazyArg<E>) => Stream<never, E, never> = internal.failSync
1136
+
1137
+ /**
1138
+ * The stream that always fails with the specified `Cause`.
1139
+ *
1140
+ * @since 2.0.0
1141
+ * @category constructors
1142
+ */
1143
+ export const failCause: <E>(cause: Cause.Cause<E>) => Stream<never, E, never> = internal.failCause
1144
+
1145
+ /**
1146
+ * The stream that always fails with the specified lazily evaluated `Cause`.
1147
+ *
1148
+ * @since 2.0.0
1149
+ * @category constructors
1150
+ */
1151
+ export const failCauseSync: <E>(evaluate: LazyArg<Cause.Cause<E>>) => Stream<never, E, never> = internal.failCauseSync
1152
+
1153
+ /**
1154
+ * Filters the elements emitted by this stream using the provided function.
1155
+ *
1156
+ * @since 2.0.0
1157
+ * @category filtering
1158
+ */
1159
+ export const filter: {
1160
+ <A, B extends A>(refinement: Refinement<A, B>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, B>
1161
+ <A, X extends A>(predicate: Predicate<X>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
1162
+ <R, E, A, B extends A>(self: Stream<R, E, A>, refinement: Refinement<A, B>): Stream<R, E, B>
1163
+ <R, E, A, X extends A>(self: Stream<R, E, A>, predicate: Predicate<X>): Stream<R, E, A>
1164
+ } = internal.filter
1165
+
1166
+ /**
1167
+ * Effectfully filters the elements emitted by this stream.
1168
+ *
1169
+ * @since 2.0.0
1170
+ * @category filtering
1171
+ */
1172
+ export const filterEffect: {
1173
+ <A, X extends A, R2, E2>(
1174
+ f: (a: X) => Effect.Effect<R2, E2, boolean>
1175
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
1176
+ <R, E, A, X extends A, R2, E2>(
1177
+ self: Stream<R, E, A>,
1178
+ f: (a: X) => Effect.Effect<R2, E2, boolean>
1179
+ ): Stream<R | R2, E | E2, A>
1180
+ } = internal.filterEffect
1181
+
1182
+ /**
1183
+ * Performs a filter and map in a single step.
1184
+ *
1185
+ * @since 2.0.0
1186
+ * @category utils
1187
+ */
1188
+ export const filterMap: {
1189
+ <A, B>(pf: (a: A) => Option.Option<B>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, B>
1190
+ <R, E, A, B>(self: Stream<R, E, A>, pf: (a: A) => Option.Option<B>): Stream<R, E, B>
1191
+ } = internal.filterMap
1192
+
1193
+ /**
1194
+ * Performs an effectful filter and map in a single step.
1195
+ *
1196
+ * @since 2.0.0
1197
+ * @category utils
1198
+ */
1199
+ export const filterMapEffect: {
1200
+ <A, R2, E2, A2>(
1201
+ pf: (a: A) => Option.Option<Effect.Effect<R2, E2, A2>>
1202
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
1203
+ <R, E, A, R2, E2, A2>(
1204
+ self: Stream<R, E, A>,
1205
+ pf: (a: A) => Option.Option<Effect.Effect<R2, E2, A2>>
1206
+ ): Stream<R | R2, E | E2, A2>
1207
+ } = internal.filterMapEffect
1208
+
1209
+ /**
1210
+ * Transforms all elements of the stream for as long as the specified partial
1211
+ * function is defined.
1212
+ *
1213
+ * @since 2.0.0
1214
+ * @category utils
1215
+ */
1216
+ export const filterMapWhile: {
1217
+ <A, A2>(pf: (a: A) => Option.Option<A2>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A2>
1218
+ <R, E, A, A2>(self: Stream<R, E, A>, pf: (a: A) => Option.Option<A2>): Stream<R, E, A2>
1219
+ } = internal.filterMapWhile
1220
+
1221
+ /**
1222
+ * Effectfully transforms all elements of the stream for as long as the
1223
+ * specified partial function is defined.
1224
+ *
1225
+ * @since 2.0.0
1226
+ * @category utils
1227
+ */
1228
+ export const filterMapWhileEffect: {
1229
+ <A, R2, E2, A2>(
1230
+ pf: (a: A) => Option.Option<Effect.Effect<R2, E2, A2>>
1231
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
1232
+ <R, E, A, R2, E2, A2>(
1233
+ self: Stream<R, E, A>,
1234
+ pf: (a: A) => Option.Option<Effect.Effect<R2, E2, A2>>
1235
+ ): Stream<R | R2, E | E2, A2>
1236
+ } = internal.filterMapWhileEffect
1237
+
1238
+ /**
1239
+ * Creates a one-element stream that never fails and executes the finalizer
1240
+ * when it ends.
1241
+ *
1242
+ * @since 2.0.0
1243
+ * @category constructors
1244
+ */
1245
+ export const finalizer: <R, _>(finalizer: Effect.Effect<R, never, _>) => Stream<R, never, void> = internal.finalizer
1246
+
1247
+ /**
1248
+ * Finds the first element emitted by this stream that satisfies the provided
1249
+ * predicate.
1250
+ *
1251
+ * @since 2.0.0
1252
+ * @category elements
1253
+ */
1254
+ export const find: {
1255
+ <A, B extends A>(refinement: Refinement<A, B>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, B>
1256
+ <A, X extends A>(predicate: Predicate<X>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
1257
+ <R, E, A, B extends A>(self: Stream<R, E, A>, refinement: Refinement<A, B>): Stream<R, E, B>
1258
+ <R, E, A, X extends A>(self: Stream<R, E, A>, predicate: Predicate<X>): Stream<R, E, A>
1259
+ } = internal.find
1260
+
1261
+ /**
1262
+ * Finds the first element emitted by this stream that satisfies the provided
1263
+ * effectful predicate.
1264
+ *
1265
+ * @since 2.0.0
1266
+ * @category elements
1267
+ */
1268
+ export const findEffect: {
1269
+ <A, X extends A, R2, E2>(
1270
+ predicate: (a: X) => Effect.Effect<R2, E2, boolean>
1271
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
1272
+ <R, E, A, X extends A, R2, E2>(
1273
+ self: Stream<R, E, A>,
1274
+ predicate: (a: X) => Effect.Effect<R2, E2, boolean>
1275
+ ): Stream<R | R2, E | E2, A>
1276
+ } = internal.findEffect
1277
+
1278
+ /**
1279
+ * Returns a stream made of the concatenation in strict order of all the
1280
+ * streams produced by passing each element of this stream to `f0`
1281
+ *
1282
+ * @since 2.0.0
1283
+ * @category sequencing
1284
+ */
1285
+ export const flatMap: {
1286
+ <A, R2, E2, A2>(
1287
+ f: (a: A) => Stream<R2, E2, A2>,
1288
+ options?: { readonly concurrency?: number | "unbounded"; readonly bufferSize?: number; readonly switch?: boolean }
1289
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
1290
+ <R, E, A, R2, E2, A2>(
1291
+ self: Stream<R, E, A>,
1292
+ f: (a: A) => Stream<R2, E2, A2>,
1293
+ options?: { readonly concurrency?: number | "unbounded"; readonly bufferSize?: number; readonly switch?: boolean }
1294
+ ): Stream<R | R2, E | E2, A2>
1295
+ } = internal.flatMap
1296
+
1297
+ /**
1298
+ * Flattens this stream-of-streams into a stream made of the concatenation in
1299
+ * strict order of all the streams.
1300
+ *
1301
+ * @since 2.0.0
1302
+ * @category sequencing
1303
+ */
1304
+ export const flatten: {
1305
+ (
1306
+ options?: {
1307
+ readonly concurrency?: number | "unbounded"
1308
+ readonly bufferSize?: number
1309
+ }
1310
+ ): <R, E, R2, E2, A>(self: Stream<R, E, Stream<R2, E2, A>>) => Stream<R | R2, E | E2, A>
1311
+ <R, E, R2, E2, A>(
1312
+ self: Stream<R, E, Stream<R2, E2, A>>,
1313
+ options?: {
1314
+ readonly concurrency?: number | "unbounded"
1315
+ readonly bufferSize?: number
1316
+ }
1317
+ ): Stream<R | R2, E | E2, A>
1318
+ } = internal.flatten
1319
+
1320
+ /**
1321
+ * Submerges the chunks carried by this stream into the stream's structure,
1322
+ * while still preserving them.
1323
+ *
1324
+ * @since 2.0.0
1325
+ * @category sequencing
1326
+ */
1327
+ export const flattenChunks: <R, E, A>(self: Stream<R, E, Chunk.Chunk<A>>) => Stream<R, E, A> = internal.flattenChunks
1328
+
1329
+ /**
1330
+ * Flattens `Effect` values into the stream's structure, preserving all
1331
+ * information about the effect.
1332
+ *
1333
+ * @since 2.0.0
1334
+ * @category sequencing
1335
+ */
1336
+ export const flattenEffect: {
1337
+ (
1338
+ options?: {
1339
+ readonly concurrency?: number | "unbounded"
1340
+ readonly unordered?: boolean
1341
+ }
1342
+ ): <R, E, R2, E2, A>(self: Stream<R, E, Effect.Effect<R2, E2, A>>) => Stream<R | R2, E | E2, A>
1343
+ <R, E, R2, E2, A>(
1344
+ self: Stream<R, E, Effect.Effect<R2, E2, A>>,
1345
+ options?: {
1346
+ readonly concurrency?: number | "unbounded"
1347
+ readonly unordered?: boolean
1348
+ }
1349
+ ): Stream<R | R2, E | E2, A>
1350
+ } = internal.flattenEffect
1351
+
1352
+ /**
1353
+ * Unwraps `Exit` values that also signify end-of-stream by failing with `None`.
1354
+ *
1355
+ * For `Exit` values that do not signal end-of-stream, prefer:
1356
+ *
1357
+ * ```ts
1358
+ * stream.mapZIO(ZIO.done(_))
1359
+ * ```
1360
+ *
1361
+ * @since 2.0.0
1362
+ * @category sequencing
1363
+ */
1364
+ export const flattenExitOption: <R, E, E2, A>(
1365
+ self: Stream<R, E, Exit.Exit<Option.Option<E2>, A>>
1366
+ ) => Stream<R, E | E2, A> = internal.flattenExitOption
1367
+
1368
+ /**
1369
+ * Submerges the iterables carried by this stream into the stream's structure,
1370
+ * while still preserving them.
1371
+ *
1372
+ * @since 2.0.0
1373
+ * @category sequencing
1374
+ */
1375
+ export const flattenIterables: <R, E, A>(self: Stream<R, E, Iterable<A>>) => Stream<R, E, A> = internal.flattenIterables
1376
+
1377
+ /**
1378
+ * Unwraps `Exit` values and flatten chunks that also signify end-of-stream
1379
+ * by failing with `None`.
1380
+ *
1381
+ * @since 2.0.0
1382
+ * @category sequencing
1383
+ */
1384
+ export const flattenTake: <R, E, E2, A>(
1385
+ self: Stream<R, E, Take.Take<E2, A>>
1386
+ ) => Stream<R, E | E2, A> = internal.flattenTake
1387
+
1388
+ /**
1389
+ * Repeats this stream forever.
1390
+ *
1391
+ * @since 2.0.0
1392
+ * @category utils
1393
+ */
1394
+ export const forever: <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A> = internal.forever
1395
+
1396
+ /**
1397
+ * Creates a stream from an `AsyncIterable`.
1398
+ *
1399
+ * @since 2.0.0
1400
+ * @category constructors
1401
+ */
1402
+ export const fromAsyncIterable: <E, A>(
1403
+ iterable: AsyncIterable<A>,
1404
+ onError: (e: unknown) => E
1405
+ ) => Stream<never, E, A> = internal.fromAsyncIterable
1406
+
1407
+ /**
1408
+ * Creates a stream from a `Channel`.
1409
+ *
1410
+ * @since 2.0.0
1411
+ * @category constructors
1412
+ */
1413
+ export const fromChannel: <R, E, A>(
1414
+ channel: Channel.Channel<R, unknown, unknown, unknown, E, Chunk.Chunk<A>, unknown>
1415
+ ) => Stream<R, E, A> = internal.fromChannel
1416
+
1417
+ /**
1418
+ * Creates a channel from a `Stream`.
1419
+ *
1420
+ * @since 2.0.0
1421
+ * @category constructors
1422
+ */
1423
+ export const toChannel: <R, E, A>(
1424
+ stream: Stream<R, E, A>
1425
+ ) => Channel.Channel<R, unknown, unknown, unknown, E, Chunk.Chunk<A>, unknown> = internal.toChannel
1426
+
1427
+ /**
1428
+ * Creates a stream from a `Chunk` of values.
1429
+ *
1430
+ * @since 2.0.0
1431
+ * @category constructors
1432
+ */
1433
+ export const fromChunk: <A>(chunk: Chunk.Chunk<A>) => Stream<never, never, A> = internal.fromChunk
1434
+
1435
+ /**
1436
+ * Creates a stream from a subscription to a `PubSub`.
1437
+ *
1438
+ * @param shutdown If `true`, the `PubSub` will be shutdown after the stream is evaluated (defaults to `false`)
1439
+ * @since 2.0.0
1440
+ * @category constructors
1441
+ */
1442
+ export const fromChunkPubSub: {
1443
+ <A>(
1444
+ pubsub: PubSub.PubSub<Chunk.Chunk<A>>,
1445
+ options: { readonly scoped: true; readonly shutdown?: boolean }
1446
+ ): Effect.Effect<Scope.Scope, never, Stream<never, never, A>>
1447
+ <A>(
1448
+ pubsub: PubSub.PubSub<Chunk.Chunk<A>>,
1449
+ options?: { readonly scoped?: false; readonly shutdown?: boolean }
1450
+ ): Stream<never, never, A>
1451
+ } = internal.fromChunkPubSub
1452
+
1453
+ /**
1454
+ * Creates a stream from a `Queue` of values.
1455
+ *
1456
+ * @param shutdown If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`)
1457
+ * @since 2.0.0
1458
+ * @category constructors
1459
+ */
1460
+ export const fromChunkQueue: <A>(
1461
+ queue: Queue.Dequeue<Chunk.Chunk<A>>,
1462
+ options?: { readonly shutdown?: boolean }
1463
+ ) => Stream<never, never, A> = internal.fromChunkQueue
1464
+
1465
+ /**
1466
+ * Creates a stream from an arbitrary number of chunks.
1467
+ *
1468
+ * @since 2.0.0
1469
+ * @category constructors
1470
+ */
1471
+ export const fromChunks: <A>(...chunks: Array<Chunk.Chunk<A>>) => Stream<never, never, A> = internal.fromChunks
1472
+
1473
+ /**
1474
+ * Either emits the success value of this effect or terminates the stream
1475
+ * with the failure value of this effect.
1476
+ *
1477
+ * @since 2.0.0
1478
+ * @category constructors
1479
+ */
1480
+ export const fromEffect: <R, E, A>(effect: Effect.Effect<R, E, A>) => Stream<R, E, A> = internal.fromEffect
1481
+
1482
+ /**
1483
+ * Creates a stream from an effect producing a value of type `A` or an empty
1484
+ * `Stream`.
1485
+ *
1486
+ * @since 2.0.0
1487
+ * @category constructors
1488
+ */
1489
+ export const fromEffectOption: <R, E, A>(effect: Effect.Effect<R, Option.Option<E>, A>) => Stream<R, E, A> =
1490
+ internal.fromEffectOption
1491
+
1492
+ /**
1493
+ * Creates a stream from a subscription to a `PubSub`.
1494
+ *
1495
+ * @param shutdown If `true`, the `PubSub` will be shutdown after the stream is evaluated (defaults to `false`)
1496
+ * @since 2.0.0
1497
+ * @category constructors
1498
+ */
1499
+ export const fromPubSub: {
1500
+ <A>(
1501
+ pubsub: PubSub.PubSub<A>,
1502
+ options: { readonly scoped: true; readonly maxChunkSize?: number; readonly shutdown?: boolean }
1503
+ ): Effect.Effect<Scope.Scope, never, Stream<never, never, A>>
1504
+ <A>(
1505
+ pubsub: PubSub.PubSub<A>,
1506
+ options?: { readonly scoped?: false; readonly maxChunkSize?: number; readonly shutdown?: boolean }
1507
+ ): Stream<never, never, A>
1508
+ } = internal.fromPubSub
1509
+
1510
+ /**
1511
+ * Creates a stream from an `Iterable` collection of values.
1512
+ *
1513
+ * @since 2.0.0
1514
+ * @category constructors
1515
+ */
1516
+ export const fromIterable: <A>(iterable: Iterable<A>) => Stream<never, never, A> = internal.fromIterable
1517
+
1518
+ /**
1519
+ * Creates a stream from an effect producing a value of type `Iterable<A>`.
1520
+ *
1521
+ * @since 2.0.0
1522
+ * @category constructors
1523
+ */
1524
+ export const fromIterableEffect: <R, E, A>(effect: Effect.Effect<R, E, Iterable<A>>) => Stream<R, E, A> =
1525
+ internal.fromIterableEffect
1526
+
1527
+ /**
1528
+ * Creates a stream from an iterator
1529
+ *
1530
+ * @since 2.0.0
1531
+ * @category constructors
1532
+ */
1533
+ export const fromIteratorSucceed: <A>(iterator: IterableIterator<A>, maxChunkSize?: number) => Stream<never, never, A> =
1534
+ internal.fromIteratorSucceed
1535
+
1536
+ /**
1537
+ * Creates a stream from an effect that pulls elements from another stream.
1538
+ *
1539
+ * See `Stream.toPull` for reference.
1540
+ *
1541
+ * @since 2.0.0
1542
+ * @category constructors
1543
+ */
1544
+ export const fromPull: <R, R2, E, A>(
1545
+ effect: Effect.Effect<Scope.Scope | R, never, Effect.Effect<R2, Option.Option<E>, Chunk.Chunk<A>>>
1546
+ ) => Stream<Exclude<R, Scope.Scope> | R2, E, A> = internal.fromPull
1547
+
1548
+ /**
1549
+ * Creates a stream from a queue of values
1550
+ *
1551
+ * @param maxChunkSize The maximum number of queued elements to put in one chunk in the stream
1552
+ * @param shutdown If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`)
1553
+ * @since 2.0.0
1554
+ * @category constructors
1555
+ */
1556
+ export const fromQueue: <A>(
1557
+ queue: Queue.Dequeue<A>,
1558
+ options?: { readonly maxChunkSize?: number; readonly shutdown?: boolean }
1559
+ ) => Stream<never, never, A> = internal.fromQueue
1560
+
1561
+ /**
1562
+ * Creates a stream from a `ReadableStream`.
1563
+ *
1564
+ * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
1565
+ *
1566
+ * @since 2.0.0
1567
+ * @category constructors
1568
+ */
1569
+ export const fromReadableStream: <A, E>(
1570
+ evaluate: LazyArg<ReadableStream<A>>,
1571
+ onError: (error: unknown) => E
1572
+ ) => Stream<never, E, A> = internal.fromReadableStream
1573
+
1574
+ /**
1575
+ * Creates a stream from a `ReadableStreamBYOBReader`.
1576
+ *
1577
+ * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader.
1578
+ *
1579
+ * @param allocSize Controls the size of the underlying `ArrayBuffer` (defaults to `4096`).
1580
+ * @since 2.0.0
1581
+ * @category constructors
1582
+ */
1583
+ export const fromReadableStreamByob: <E>(
1584
+ evaluate: LazyArg<ReadableStream<Uint8Array>>,
1585
+ onError: (error: unknown) => E,
1586
+ allocSize?: number
1587
+ ) => Stream<never, E, Uint8Array> = internal.fromReadableStreamByob
1588
+
1589
+ /**
1590
+ * Creates a stream from a `Schedule` that does not require any further
1591
+ * input. The stream will emit an element for each value output from the
1592
+ * schedule, continuing for as long as the schedule continues.
1593
+ *
1594
+ * @since 2.0.0
1595
+ * @category constructors
1596
+ */
1597
+ export const fromSchedule: <R, A>(schedule: Schedule.Schedule<R, unknown, A>) => Stream<R, never, A> =
1598
+ internal.fromSchedule
1599
+
1600
+ /**
1601
+ * Creates a pipeline that groups on adjacent keys, calculated by the
1602
+ * specified function.
1603
+ *
1604
+ * @since 2.0.0
1605
+ * @category grouping
1606
+ */
1607
+ export const groupAdjacentBy: {
1608
+ <A, K>(f: (a: A) => K): <R, E>(self: Stream<R, E, A>) => Stream<R, E, readonly [K, Chunk.NonEmptyChunk<A>]>
1609
+ <R, E, A, K>(self: Stream<R, E, A>, f: (a: A) => K): Stream<R, E, readonly [K, Chunk.NonEmptyChunk<A>]>
1610
+ } = internal.groupAdjacentBy
1611
+
1612
+ /**
1613
+ * More powerful version of `Stream.groupByKey`.
1614
+ *
1615
+ * @since 2.0.0
1616
+ * @category grouping
1617
+ */
1618
+ export const groupBy: {
1619
+ <A, R2, E2, K, V>(
1620
+ f: (a: A) => Effect.Effect<R2, E2, readonly [K, V]>,
1621
+ options?: { readonly bufferSize?: number }
1622
+ ): <R, E>(self: Stream<R, E, A>) => GroupBy.GroupBy<R2 | R, E2 | E, K, V>
1623
+ <R, E, A, R2, E2, K, V>(
1624
+ self: Stream<R, E, A>,
1625
+ f: (a: A) => Effect.Effect<R2, E2, readonly [K, V]>,
1626
+ options?: { readonly bufferSize?: number }
1627
+ ): GroupBy.GroupBy<R | R2, E | E2, K, V>
1628
+ } = _groupBy.groupBy
1629
+
1630
+ /**
1631
+ * Partition a stream using a function and process each stream individually.
1632
+ * This returns a data structure that can be used to further filter down which
1633
+ * groups shall be processed.
1634
+ *
1635
+ * After calling apply on the GroupBy object, the remaining groups will be
1636
+ * processed in parallel and the resulting streams merged in a
1637
+ * nondeterministic fashion.
1638
+ *
1639
+ * Up to `buffer` elements may be buffered in any group stream before the
1640
+ * producer is backpressured. Take care to consume from all streams in order
1641
+ * to prevent deadlocks.
1642
+ *
1643
+ * For example, to collect the first 2 words for every starting letter from a
1644
+ * stream of words:
1645
+ *
1646
+ * ```ts
1647
+ * import * as GroupBy from "./GroupBy"
1648
+ * import * as Stream from "./Stream"
1649
+ * import { pipe } from "./Function"
1650
+ *
1651
+ * pipe(
1652
+ * Stream.fromIterable(["hello", "world", "hi", "holla"]),
1653
+ * Stream.groupByKey((word) => word[0]),
1654
+ * GroupBy.evaluate((key, stream) =>
1655
+ * pipe(
1656
+ * stream,
1657
+ * Stream.take(2),
1658
+ * Stream.map((words) => [key, words] as const)
1659
+ * )
1660
+ * )
1661
+ * )
1662
+ * ```
1663
+ *
1664
+ * @since 2.0.0
1665
+ * @category utils
1666
+ */
1667
+ export const groupByKey: {
1668
+ <A, K>(
1669
+ f: (a: A) => K,
1670
+ options?: { readonly bufferSize?: number }
1671
+ ): <R, E>(self: Stream<R, E, A>) => GroupBy.GroupBy<R, E, K, A>
1672
+ <R, E, A, K>(
1673
+ self: Stream<R, E, A>,
1674
+ f: (a: A) => K,
1675
+ options?: { readonly bufferSize?: number }
1676
+ ): GroupBy.GroupBy<R, E, K, A>
1677
+ } = _groupBy.groupByKey
1678
+
1679
+ /**
1680
+ * Partitions the stream with specified `chunkSize`.
1681
+ *
1682
+ * @since 2.0.0
1683
+ * @category utils
1684
+ */
1685
+ export const grouped: {
1686
+ (chunkSize: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
1687
+ <R, E, A>(self: Stream<R, E, A>, chunkSize: number): Stream<R, E, Chunk.Chunk<A>>
1688
+ } = internal.grouped
1689
+
1690
+ /**
1691
+ * Partitions the stream with the specified `chunkSize` or until the specified
1692
+ * `duration` has passed, whichever is satisfied first.
1693
+ *
1694
+ * @since 2.0.0
1695
+ * @category utils
1696
+ */
1697
+ export const groupedWithin: {
1698
+ (
1699
+ chunkSize: number,
1700
+ duration: Duration.DurationInput
1701
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
1702
+ <R, E, A>(self: Stream<R, E, A>, chunkSize: number, duration: Duration.DurationInput): Stream<R, E, Chunk.Chunk<A>>
1703
+ } = internal.groupedWithin
1704
+
1705
+ /**
1706
+ * Specialized version of haltWhen which halts the evaluation of this stream
1707
+ * after the given duration.
1708
+ *
1709
+ * An element in the process of being pulled will not be interrupted when the
1710
+ * given duration completes. See `interruptAfter` for this behavior.
1711
+ *
1712
+ * @since 2.0.0
1713
+ * @category utils
1714
+ */
1715
+ export const haltAfter: {
1716
+ (duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
1717
+ <R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
1718
+ } = internal.haltAfter
1719
+
1720
+ /**
1721
+ * Halts the evaluation of this stream when the provided effect completes. The
1722
+ * given effect will be forked as part of the returned stream, and its success
1723
+ * will be discarded.
1724
+ *
1725
+ * An element in the process of being pulled will not be interrupted when the
1726
+ * effect completes. See `interruptWhen` for this behavior.
1727
+ *
1728
+ * If the effect completes with a failure, the stream will emit that failure.
1729
+ *
1730
+ * @since 2.0.0
1731
+ * @category utils
1732
+ */
1733
+ export const haltWhen: {
1734
+ <R2, E2, _>(effect: Effect.Effect<R2, E2, _>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
1735
+ <R, E, A, R2, E2, _>(self: Stream<R, E, A>, effect: Effect.Effect<R2, E2, _>): Stream<R | R2, E | E2, A>
1736
+ } = internal.haltWhen
1737
+
1738
+ /**
1739
+ * Halts the evaluation of this stream when the provided promise resolves.
1740
+ *
1741
+ * If the promise completes with a failure, the stream will emit that failure.
1742
+ *
1743
+ * @since 2.0.0
1744
+ * @category utils
1745
+ */
1746
+ export const haltWhenDeferred: {
1747
+ <E2, _>(deferred: Deferred.Deferred<E2, _>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
1748
+ <R, E, A, E2, _>(self: Stream<R, E, A>, deferred: Deferred.Deferred<E2, _>): Stream<R, E | E2, A>
1749
+ } = internal.haltWhenDeferred
1750
+
1751
+ /**
1752
+ * The identity pipeline, which does not modify streams in any way.
1753
+ *
1754
+ * @since 2.0.0
1755
+ * @category utils
1756
+ */
1757
+ export const identity: <R, E, A>() => Stream<R, E, A> = internal.identityStream
1758
+
1759
+ /**
1760
+ * Interleaves this stream and the specified stream deterministically by
1761
+ * alternating pulling values from this stream and the specified stream. When
1762
+ * one stream is exhausted all remaining values in the other stream will be
1763
+ * pulled.
1764
+ *
1765
+ * @since 2.0.0
1766
+ * @category utils
1767
+ */
1768
+ export const interleave: {
1769
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2 | A>
1770
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A | A2>
1771
+ } = internal.interleave
1772
+
1773
+ /**
1774
+ * Combines this stream and the specified stream deterministically using the
1775
+ * stream of boolean values `pull` to control which stream to pull from next.
1776
+ * A value of `true` indicates to pull from this stream and a value of `false`
1777
+ * indicates to pull from the specified stream. Only consumes as many elements
1778
+ * as requested by the `pull` stream. If either this stream or the specified
1779
+ * stream are exhausted further requests for values from that stream will be
1780
+ * ignored.
1781
+ *
1782
+ * @since 2.0.0
1783
+ * @category utils
1784
+ */
1785
+ export const interleaveWith: {
1786
+ <R2, E2, A2, R3, E3>(
1787
+ that: Stream<R2, E2, A2>,
1788
+ decider: Stream<R3, E3, boolean>
1789
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R3 | R, E2 | E3 | E, A2 | A>
1790
+ <R, E, A, R2, E2, A2, R3, E3>(
1791
+ self: Stream<R, E, A>,
1792
+ that: Stream<R2, E2, A2>,
1793
+ decider: Stream<R3, E3, boolean>
1794
+ ): Stream<R | R2 | R3, E | E2 | E3, A | A2>
1795
+ } = internal.interleaveWith
1796
+
1797
+ /**
1798
+ * Intersperse stream with provided `element`.
1799
+ *
1800
+ * @since 2.0.0
1801
+ * @category utils
1802
+ */
1803
+ export const intersperse: {
1804
+ <A2>(element: A2): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A2 | A>
1805
+ <R, E, A, A2>(self: Stream<R, E, A>, element: A2): Stream<R, E, A | A2>
1806
+ } = internal.intersperse
1807
+
1808
+ /**
1809
+ * Intersperse the specified element, also adding a prefix and a suffix.
1810
+ *
1811
+ * @since 2.0.0
1812
+ * @category utils
1813
+ */
1814
+ export const intersperseAffixes: {
1815
+ <A2, A3, A4>(
1816
+ options: { readonly start: A2; readonly middle: A3; readonly end: A4 }
1817
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A2 | A3 | A4 | A>
1818
+ <R, E, A, A2, A3, A4>(
1819
+ self: Stream<R, E, A>,
1820
+ options: { readonly start: A2; readonly middle: A3; readonly end: A4 }
1821
+ ): Stream<R, E, A | A2 | A3 | A4>
1822
+ } = internal.intersperseAffixes
1823
+
1824
+ /**
1825
+ * Specialized version of `Stream.interruptWhen` which interrupts the
1826
+ * evaluation of this stream after the given `Duration`.
1827
+ *
1828
+ * @since 2.0.0
1829
+ * @category utils
1830
+ */
1831
+ export const interruptAfter: {
1832
+ (duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
1833
+ <R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
1834
+ } = internal.interruptAfter
1835
+
1836
+ /**
1837
+ * Interrupts the evaluation of this stream when the provided effect
1838
+ * completes. The given effect will be forked as part of this stream, and its
1839
+ * success will be discarded. This combinator will also interrupt any
1840
+ * in-progress element being pulled from upstream.
1841
+ *
1842
+ * If the effect completes with a failure before the stream completes, the
1843
+ * returned stream will emit that failure.
1844
+ *
1845
+ * @since 2.0.0
1846
+ * @category utils
1847
+ */
1848
+ export const interruptWhen: {
1849
+ <R2, E2, _>(effect: Effect.Effect<R2, E2, _>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
1850
+ <R, E, A, R2, E2, _>(self: Stream<R, E, A>, effect: Effect.Effect<R2, E2, _>): Stream<R | R2, E | E2, A>
1851
+ } = internal.interruptWhen
1852
+
1853
+ /**
1854
+ * Interrupts the evaluation of this stream when the provided promise
1855
+ * resolves. This combinator will also interrupt any in-progress element being
1856
+ * pulled from upstream.
1857
+ *
1858
+ * If the promise completes with a failure, the stream will emit that failure.
1859
+ *
1860
+ * @since 2.0.0
1861
+ * @category utils
1862
+ */
1863
+ export const interruptWhenDeferred: {
1864
+ <E2, _>(deferred: Deferred.Deferred<E2, _>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
1865
+ <R, E, A, E2, _>(self: Stream<R, E, A>, deferred: Deferred.Deferred<E2, _>): Stream<R, E | E2, A>
1866
+ } = internal.interruptWhenDeferred
1867
+
1868
+ /**
1869
+ * The infinite stream of iterative function application: a, f(a), f(f(a)),
1870
+ * f(f(f(a))), ...
1871
+ *
1872
+ * @since 2.0.0
1873
+ * @category constructors
1874
+ */
1875
+ export const iterate: <A>(value: A, next: (value: A) => A) => Stream<never, never, A> = internal.iterate
1876
+
1877
+ /**
1878
+ * Creates a stream from an sequence of values.
1879
+ *
1880
+ * @since 2.0.0
1881
+ * @category constructors
1882
+ */
1883
+ export const make: <As extends Array<any>>(...as: As) => Stream<never, never, As[number]> = internal.make
1884
+
1885
+ /**
1886
+ * Transforms the elements of this stream using the supplied function.
1887
+ *
1888
+ * @since 2.0.0
1889
+ * @category mapping
1890
+ */
1891
+ export const map: {
1892
+ <A, B>(f: (a: A) => B): <R, E>(self: Stream<R, E, A>) => Stream<R, E, B>
1893
+ <R, E, A, B>(self: Stream<R, E, A>, f: (a: A) => B): Stream<R, E, B>
1894
+ } = internal.map
1895
+
1896
+ /**
1897
+ * Statefully maps over the elements of this stream to produce new elements.
1898
+ *
1899
+ * @since 2.0.0
1900
+ * @category mapping
1901
+ */
1902
+ export const mapAccum: {
1903
+ <S, A, A2>(s: S, f: (s: S, a: A) => readonly [S, A2]): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A2>
1904
+ <R, E, S, A, A2>(self: Stream<R, E, A>, s: S, f: (s: S, a: A) => readonly [S, A2]): Stream<R, E, A2>
1905
+ } = internal.mapAccum
1906
+
1907
+ /**
1908
+ * Statefully and effectfully maps over the elements of this stream to produce
1909
+ * new elements.
1910
+ *
1911
+ * @since 2.0.0
1912
+ * @category mapping
1913
+ */
1914
+ export const mapAccumEffect: {
1915
+ <S, A, R2, E2, A2>(
1916
+ s: S,
1917
+ f: (s: S, a: A) => Effect.Effect<R2, E2, readonly [S, A2]>
1918
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
1919
+ <R, E, S, A, R2, E2, A2>(
1920
+ self: Stream<R, E, A>,
1921
+ s: S,
1922
+ f: (s: S, a: A) => Effect.Effect<R2, E2, readonly [S, A2]>
1923
+ ): Stream<R | R2, E | E2, A2>
1924
+ } = internal.mapAccumEffect
1925
+
1926
+ /**
1927
+ * Returns a stream whose failure and success channels have been mapped by the
1928
+ * specified `onFailure` and `onSuccess` functions.
1929
+ *
1930
+ * @since 2.0.0
1931
+ * @category utils
1932
+ */
1933
+ export const mapBoth: {
1934
+ <E, E2, A, A2>(
1935
+ options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2 }
1936
+ ): <R>(self: Stream<R, E, A>) => Stream<R, E2, A2>
1937
+ <R, E, E2, A, A2>(
1938
+ self: Stream<R, E, A>,
1939
+ options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2 }
1940
+ ): Stream<R, E2, A2>
1941
+ } = internal.mapBoth
1942
+
1943
+ /**
1944
+ * Transforms the chunks emitted by this stream.
1945
+ *
1946
+ * @since 2.0.0
1947
+ * @category mapping
1948
+ */
1949
+ export const mapChunks: {
1950
+ <A, B>(f: (chunk: Chunk.Chunk<A>) => Chunk.Chunk<B>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, B>
1951
+ <R, E, A, B>(self: Stream<R, E, A>, f: (chunk: Chunk.Chunk<A>) => Chunk.Chunk<B>): Stream<R, E, B>
1952
+ } = internal.mapChunks
1953
+
1954
+ /**
1955
+ * Effectfully transforms the chunks emitted by this stream.
1956
+ *
1957
+ * @since 2.0.0
1958
+ * @category mapping
1959
+ */
1960
+ export const mapChunksEffect: {
1961
+ <A, R2, E2, B>(
1962
+ f: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, Chunk.Chunk<B>>
1963
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, B>
1964
+ <R, E, A, R2, E2, B>(
1965
+ self: Stream<R, E, A>,
1966
+ f: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, Chunk.Chunk<B>>
1967
+ ): Stream<R | R2, E | E2, B>
1968
+ } = internal.mapChunksEffect
1969
+
1970
+ /**
1971
+ * Maps each element to an iterable, and flattens the iterables into the
1972
+ * output of this stream.
1973
+ *
1974
+ * @since 2.0.0
1975
+ * @category mapping
1976
+ */
1977
+ export const mapConcat: {
1978
+ <A, A2>(f: (a: A) => Iterable<A2>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A2>
1979
+ <R, E, A, A2>(self: Stream<R, E, A>, f: (a: A) => Iterable<A2>): Stream<R, E, A2>
1980
+ } = internal.mapConcat
1981
+
1982
+ /**
1983
+ * Maps each element to a chunk, and flattens the chunks into the output of
1984
+ * this stream.
1985
+ *
1986
+ * @since 2.0.0
1987
+ * @category mapping
1988
+ */
1989
+ export const mapConcatChunk: {
1990
+ <A, A2>(f: (a: A) => Chunk.Chunk<A2>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A2>
1991
+ <R, E, A, A2>(self: Stream<R, E, A>, f: (a: A) => Chunk.Chunk<A2>): Stream<R, E, A2>
1992
+ } = internal.mapConcatChunk
1993
+
1994
+ /**
1995
+ * Effectfully maps each element to a chunk, and flattens the chunks into the
1996
+ * output of this stream.
1997
+ *
1998
+ * @since 2.0.0
1999
+ * @category mapping
2000
+ */
2001
+ export const mapConcatChunkEffect: {
2002
+ <A, R2, E2, A2>(
2003
+ f: (a: A) => Effect.Effect<R2, E2, Chunk.Chunk<A2>>
2004
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
2005
+ <R, E, A, R2, E2, A2>(
2006
+ self: Stream<R, E, A>,
2007
+ f: (a: A) => Effect.Effect<R2, E2, Chunk.Chunk<A2>>
2008
+ ): Stream<R | R2, E | E2, A2>
2009
+ } = internal.mapConcatChunkEffect
2010
+
2011
+ /**
2012
+ * Effectfully maps each element to an iterable, and flattens the iterables
2013
+ * into the output of this stream.
2014
+ *
2015
+ * @since 2.0.0
2016
+ * @category mapping
2017
+ */
2018
+ export const mapConcatEffect: {
2019
+ <A, R2, E2, A2>(
2020
+ f: (a: A) => Effect.Effect<R2, E2, Iterable<A2>>
2021
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
2022
+ <R, E, A, R2, E2, A2>(
2023
+ self: Stream<R, E, A>,
2024
+ f: (a: A) => Effect.Effect<R2, E2, Iterable<A2>>
2025
+ ): Stream<R | R2, E | E2, A2>
2026
+ } = internal.mapConcatEffect
2027
+
2028
+ /**
2029
+ * Maps over elements of the stream with the specified effectful function.
2030
+ *
2031
+ * @since 2.0.0
2032
+ * @category mapping
2033
+ */
2034
+ export const mapEffect: {
2035
+ <A, R2, E2, A2>(
2036
+ f: (a: A) => Effect.Effect<R2, E2, A2>,
2037
+ options?: {
2038
+ readonly concurrency?: number | "unbounded"
2039
+ readonly unordered?: boolean
2040
+ }
2041
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
2042
+ <A, R2, E2, A2, K>(
2043
+ f: (a: A) => Effect.Effect<R2, E2, A2>,
2044
+ options: {
2045
+ readonly key: (a: A) => K
2046
+ readonly bufferSize?: number
2047
+ }
2048
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
2049
+ <R, E, A, R2, E2, A2>(
2050
+ self: Stream<R, E, A>,
2051
+ f: (a: A) => Effect.Effect<R2, E2, A2>,
2052
+ options?: {
2053
+ readonly concurrency?: number | "unbounded"
2054
+ readonly unordered?: boolean
2055
+ }
2056
+ ): Stream<R | R2, E | E2, A2>
2057
+ <R, E, A, R2, E2, A2, K>(
2058
+ self: Stream<R, E, A>,
2059
+ f: (a: A) => Effect.Effect<R2, E2, A2>,
2060
+ options: {
2061
+ readonly key: (a: A) => K
2062
+ readonly bufferSize?: number
2063
+ }
2064
+ ): Stream<R | R2, E | E2, A2>
2065
+ } = _groupBy.mapEffectOptions
2066
+
2067
+ /**
2068
+ * Transforms the errors emitted by this stream using `f`.
2069
+ *
2070
+ * @since 2.0.0
2071
+ * @category mapping
2072
+ */
2073
+ export const mapError: {
2074
+ <E, E2>(f: (error: E) => E2): <R, A>(self: Stream<R, E, A>) => Stream<R, E2, A>
2075
+ <R, A, E, E2>(self: Stream<R, E, A>, f: (error: E) => E2): Stream<R, E2, A>
2076
+ } = internal.mapError
2077
+
2078
+ /**
2079
+ * Transforms the full causes of failures emitted by this stream.
2080
+ *
2081
+ * @since 2.0.0
2082
+ * @category mapping
2083
+ */
2084
+ export const mapErrorCause: {
2085
+ <E, E2>(f: (cause: Cause.Cause<E>) => Cause.Cause<E2>): <R, A>(self: Stream<R, E, A>) => Stream<R, E2, A>
2086
+ <R, A, E, E2>(self: Stream<R, E, A>, f: (cause: Cause.Cause<E>) => Cause.Cause<E2>): Stream<R, E2, A>
2087
+ } = internal.mapErrorCause
2088
+
2089
+ /**
2090
+ * Merges this stream and the specified stream together.
2091
+ *
2092
+ * New produced stream will terminate when both specified stream terminate if
2093
+ * no termination strategy is specified.
2094
+ *
2095
+ * @since 2.0.0
2096
+ * @category utils
2097
+ */
2098
+ export const merge: {
2099
+ <R2, E2, A2>(
2100
+ that: Stream<R2, E2, A2>,
2101
+ options?: { readonly haltStrategy?: HaltStrategy.HaltStrategyInput }
2102
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2 | A>
2103
+ <R, E, A, R2, E2, A2>(
2104
+ self: Stream<R, E, A>,
2105
+ that: Stream<R2, E2, A2>,
2106
+ options?: { readonly haltStrategy?: HaltStrategy.HaltStrategyInput }
2107
+ ): Stream<R | R2, E | E2, A | A2>
2108
+ } = internal.merge
2109
+
2110
+ /**
2111
+ * Merges a variable list of streams in a non-deterministic fashion. Up to `n`
2112
+ * streams may be consumed in parallel and up to `outputBuffer` chunks may be
2113
+ * buffered by this operator.
2114
+ *
2115
+ * @since 2.0.0
2116
+ * @category utils
2117
+ */
2118
+ export const mergeAll: {
2119
+ (
2120
+ options: {
2121
+ readonly concurrency: number | "unbounded"
2122
+ readonly bufferSize?: number
2123
+ }
2124
+ ): <R, E, A>(streams: Iterable<Stream<R, E, A>>) => Stream<R, E, A>
2125
+ <R, E, A>(
2126
+ streams: Iterable<Stream<R, E, A>>,
2127
+ options: {
2128
+ readonly concurrency: number | "unbounded"
2129
+ readonly bufferSize?: number
2130
+ }
2131
+ ): Stream<R, E, A>
2132
+ } = internal.mergeAll
2133
+
2134
+ /**
2135
+ * Merges this stream and the specified stream together to a common element
2136
+ * type with the specified mapping functions.
2137
+ *
2138
+ * New produced stream will terminate when both specified stream terminate if
2139
+ * no termination strategy is specified.
2140
+ *
2141
+ * @since 2.0.0
2142
+ * @category utils
2143
+ */
2144
+ export const mergeWith: {
2145
+ <R2, E2, A2, A, A3, A4>(
2146
+ other: Stream<R2, E2, A2>,
2147
+ options: {
2148
+ readonly onSelf: (a: A) => A3
2149
+ readonly onOther: (a2: A2) => A4
2150
+ readonly haltStrategy?: HaltStrategy.HaltStrategyInput
2151
+ }
2152
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A3 | A4>
2153
+ <R, E, R2, E2, A2, A, A3, A4>(
2154
+ self: Stream<R, E, A>,
2155
+ other: Stream<R2, E2, A2>,
2156
+ options: {
2157
+ readonly onSelf: (a: A) => A3
2158
+ readonly onOther: (a2: A2) => A4
2159
+ readonly haltStrategy?: HaltStrategy.HaltStrategyInput
2160
+ }
2161
+ ): Stream<R | R2, E | E2, A3 | A4>
2162
+ } = internal.mergeWith
2163
+
2164
+ /**
2165
+ * Merges this stream and the specified stream together to produce a stream of
2166
+ * eithers.
2167
+ *
2168
+ * @since 2.0.0
2169
+ * @category utils
2170
+ */
2171
+ export const mergeEither: {
2172
+ <R2, E2, A2>(
2173
+ that: Stream<R2, E2, A2>
2174
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, Either.Either<A, A2>>
2175
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, Either.Either<A, A2>>
2176
+ } = internal.mergeEither
2177
+
2178
+ /**
2179
+ * Merges this stream and the specified stream together, discarding the values
2180
+ * from the right stream.
2181
+ *
2182
+ * @since 2.0.0
2183
+ * @category utils
2184
+ */
2185
+ export const mergeLeft: {
2186
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
2187
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A>
2188
+ } = internal.mergeLeft
2189
+
2190
+ /**
2191
+ * Merges this stream and the specified stream together, discarding the values
2192
+ * from the left stream.
2193
+ *
2194
+ * @since 2.0.0
2195
+ * @category utils
2196
+ */
2197
+ export const mergeRight: {
2198
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
2199
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A2>
2200
+ } = internal.mergeRight
2201
+
2202
+ /**
2203
+ * Returns a combined string resulting from concatenating each of the values
2204
+ * from the stream.
2205
+ *
2206
+ * @since 2.0.0
2207
+ * @category utils
2208
+ */
2209
+ export const mkString: <R, E>(self: Stream<R, E, string>) => Effect.Effect<R, E, string> = internal.mkString
2210
+
2211
+ /**
2212
+ * The stream that never produces any value or fails with any error.
2213
+ *
2214
+ * @since 2.0.0
2215
+ * @category constructors
2216
+ */
2217
+ export const never: Stream<never, never, never> = internal.never
2218
+
2219
+ /**
2220
+ * Runs the specified effect if this stream fails, providing the error to the
2221
+ * effect if it exists.
2222
+ *
2223
+ * Note: Unlike `Effect.onError` there is no guarantee that the provided
2224
+ * effect will not be interrupted.
2225
+ *
2226
+ * @since 2.0.0
2227
+ * @category utils
2228
+ */
2229
+ export const onError: {
2230
+ <E, R2, _>(
2231
+ cleanup: (cause: Cause.Cause<E>) => Effect.Effect<R2, never, _>
2232
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
2233
+ <R, A, E, R2, _>(
2234
+ self: Stream<R, E, A>,
2235
+ cleanup: (cause: Cause.Cause<E>) => Effect.Effect<R2, never, _>
2236
+ ): Stream<R | R2, E, A>
2237
+ } = internal.onError
2238
+
2239
+ /**
2240
+ * Runs the specified effect if this stream ends.
2241
+ *
2242
+ * @since 2.0.0
2243
+ * @category utils
2244
+ */
2245
+ export const onDone: {
2246
+ <R2, _>(cleanup: () => Effect.Effect<R2, never, _>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
2247
+ <R, E, A, R2, _>(self: Stream<R, E, A>, cleanup: () => Effect.Effect<R2, never, _>): Stream<R | R2, E, A>
2248
+ } = internal.onDone
2249
+
2250
+ /**
2251
+ * Translates any failure into a stream termination, making the stream
2252
+ * infallible and all failures unchecked.
2253
+ *
2254
+ * @since 2.0.0
2255
+ * @category error handling
2256
+ */
2257
+ export const orDie: <R, E, A>(self: Stream<R, E, A>) => Stream<R, never, A> = internal.orDie
2258
+
2259
+ /**
2260
+ * Keeps none of the errors, and terminates the stream with them, using the
2261
+ * specified function to convert the `E` into a defect.
2262
+ *
2263
+ * @since 2.0.0
2264
+ * @category error handling
2265
+ */
2266
+ export const orDieWith: {
2267
+ <E>(f: (e: E) => unknown): <R, A>(self: Stream<R, E, A>) => Stream<R, never, A>
2268
+ <R, A, E>(self: Stream<R, E, A>, f: (e: E) => unknown): Stream<R, never, A>
2269
+ } = internal.orDieWith
2270
+
2271
+ /**
2272
+ * Switches to the provided stream in case this one fails with a typed error.
2273
+ *
2274
+ * See also `Stream.catchAll`.
2275
+ *
2276
+ * @since 2.0.0
2277
+ * @category error handling
2278
+ */
2279
+ export const orElse: {
2280
+ <R2, E2, A2>(that: LazyArg<Stream<R2, E2, A2>>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2, A2 | A>
2281
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: LazyArg<Stream<R2, E2, A2>>): Stream<R | R2, E2, A | A2>
2282
+ } = internal.orElse
2283
+
2284
+ /**
2285
+ * Switches to the provided stream in case this one fails with a typed error.
2286
+ *
2287
+ * See also `Stream.catchAll`.
2288
+ *
2289
+ * @since 2.0.0
2290
+ * @category error handling
2291
+ */
2292
+ export const orElseEither: {
2293
+ <R2, E2, A2>(
2294
+ that: LazyArg<Stream<R2, E2, A2>>
2295
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2, Either.Either<A, A2>>
2296
+ <R, E, A, R2, E2, A2>(
2297
+ self: Stream<R, E, A>,
2298
+ that: LazyArg<Stream<R2, E2, A2>>
2299
+ ): Stream<R | R2, E2, Either.Either<A, A2>>
2300
+ } = internal.orElseEither
2301
+
2302
+ /**
2303
+ * Fails with given error in case this one fails with a typed error.
2304
+ *
2305
+ * See also `Stream.catchAll`.
2306
+ *
2307
+ * @since 2.0.0
2308
+ * @category error handling
2309
+ */
2310
+ export const orElseFail: {
2311
+ <E2>(error: LazyArg<E2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2, A>
2312
+ <R, E, A, E2>(self: Stream<R, E, A>, error: LazyArg<E2>): Stream<R, E2, A>
2313
+ } = internal.orElseFail
2314
+
2315
+ /**
2316
+ * Produces the specified element if this stream is empty.
2317
+ *
2318
+ * @since 2.0.0
2319
+ * @category error handling
2320
+ */
2321
+ export const orElseIfEmpty: {
2322
+ <A2>(element: LazyArg<A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A2 | A>
2323
+ <R, E, A, A2>(self: Stream<R, E, A>, element: LazyArg<A2>): Stream<R, E, A | A2>
2324
+ } = internal.orElseIfEmpty
2325
+
2326
+ /**
2327
+ * Produces the specified chunk if this stream is empty.
2328
+ *
2329
+ * @since 2.0.0
2330
+ * @category error handling
2331
+ */
2332
+ export const orElseIfEmptyChunk: {
2333
+ <A2>(chunk: LazyArg<Chunk.Chunk<A2>>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A2 | A>
2334
+ <R, E, A, A2>(self: Stream<R, E, A>, chunk: LazyArg<Chunk.Chunk<A2>>): Stream<R, E, A | A2>
2335
+ } = internal.orElseIfEmptyChunk
2336
+
2337
+ /**
2338
+ * Switches to the provided stream in case this one is empty.
2339
+ *
2340
+ * @since 2.0.0
2341
+ * @category error handling
2342
+ */
2343
+ export const orElseIfEmptyStream: {
2344
+ <R2, E2, A2>(stream: LazyArg<Stream<R2, E2, A2>>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2 | A>
2345
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, stream: LazyArg<Stream<R2, E2, A2>>): Stream<R | R2, E | E2, A | A2>
2346
+ } = internal.orElseIfEmptyStream
2347
+
2348
+ /**
2349
+ * Succeeds with the specified value if this one fails with a typed error.
2350
+ *
2351
+ * @since 2.0.0
2352
+ * @category error handling
2353
+ */
2354
+ export const orElseSucceed: {
2355
+ <A2>(value: LazyArg<A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, never, A2 | A>
2356
+ <R, E, A, A2>(self: Stream<R, E, A>, value: LazyArg<A2>): Stream<R, never, A | A2>
2357
+ } = internal.orElseSucceed
2358
+
2359
+ /**
2360
+ * Like `Stream.unfold`, but allows the emission of values to end one step further
2361
+ * than the unfolding of the state. This is useful for embedding paginated
2362
+ * APIs, hence the name.
2363
+ *
2364
+ * @since 2.0.0
2365
+ * @category constructors
2366
+ */
2367
+ export const paginate: <S, A>(s: S, f: (s: S) => readonly [A, Option.Option<S>]) => Stream<never, never, A> =
2368
+ internal.paginate
2369
+
2370
+ /**
2371
+ * Like `Stream.unfoldChunk`, but allows the emission of values to end one step
2372
+ * further than the unfolding of the state. This is useful for embedding
2373
+ * paginated APIs, hence the name.
2374
+ *
2375
+ * @since 2.0.0
2376
+ * @category constructors
2377
+ */
2378
+ export const paginateChunk: <S, A>(
2379
+ s: S,
2380
+ f: (s: S) => readonly [Chunk.Chunk<A>, Option.Option<S>]
2381
+ ) => Stream<never, never, A> = internal.paginateChunk
2382
+
2383
+ /**
2384
+ * Like `Stream.unfoldChunkEffect`, but allows the emission of values to end one step
2385
+ * further than the unfolding of the state. This is useful for embedding
2386
+ * paginated APIs, hence the name.
2387
+ *
2388
+ * @since 2.0.0
2389
+ * @category constructors
2390
+ */
2391
+ export const paginateChunkEffect: <S, R, E, A>(
2392
+ s: S,
2393
+ f: (s: S) => Effect.Effect<R, E, readonly [Chunk.Chunk<A>, Option.Option<S>]>
2394
+ ) => Stream<R, E, A> = internal.paginateChunkEffect
2395
+
2396
+ /**
2397
+ * Like `Stream.unfoldEffect` but allows the emission of values to end one step
2398
+ * further than the unfolding of the state. This is useful for embedding
2399
+ * paginated APIs, hence the name.
2400
+ *
2401
+ * @since 2.0.0
2402
+ * @category constructors
2403
+ */
2404
+ export const paginateEffect: <S, R, E, A>(
2405
+ s: S,
2406
+ f: (s: S) => Effect.Effect<R, E, readonly [A, Option.Option<S>]>
2407
+ ) => Stream<R, E, A> = internal.paginateEffect
2408
+
2409
+ /**
2410
+ * Partition a stream using a predicate. The first stream will contain all
2411
+ * element evaluated to true and the second one will contain all element
2412
+ * evaluated to false. The faster stream may advance by up to buffer elements
2413
+ * further than the slower one.
2414
+ *
2415
+ * @since 2.0.0
2416
+ * @category utils
2417
+ */
2418
+ export const partition: {
2419
+ <A>(
2420
+ predicate: Predicate<A>,
2421
+ options?: { bufferSize?: number }
2422
+ ): <R, E>(
2423
+ self: Stream<R, E, A>
2424
+ ) => Effect.Effect<Scope.Scope | R, E, readonly [Stream<never, E, A>, Stream<never, E, A>]>
2425
+ <R, E, A>(
2426
+ self: Stream<R, E, A>,
2427
+ predicate: Predicate<A>,
2428
+ options?: { bufferSize?: number }
2429
+ ): Effect.Effect<Scope.Scope | R, E, readonly [Stream<never, E, A>, Stream<never, E, A>]>
2430
+ } = internal.partition
2431
+
2432
+ /**
2433
+ * Split a stream by an effectful predicate. The faster stream may advance by
2434
+ * up to buffer elements further than the slower one.
2435
+ *
2436
+ * @since 2.0.0
2437
+ * @category utils
2438
+ */
2439
+ export const partitionEither: {
2440
+ <A, R2, E2, A2, A3>(
2441
+ predicate: (a: A) => Effect.Effect<R2, E2, Either.Either<A2, A3>>,
2442
+ options?: { readonly bufferSize?: number }
2443
+ ): <R, E>(
2444
+ self: Stream<R, E, A>
2445
+ ) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, readonly [Stream<never, E2 | E, A2>, Stream<never, E2 | E, A3>]>
2446
+ <R, E, A, R2, E2, A2, A3>(
2447
+ self: Stream<R, E, A>,
2448
+ predicate: (a: A) => Effect.Effect<R2, E2, Either.Either<A2, A3>>,
2449
+ options?: { readonly bufferSize?: number }
2450
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, readonly [Stream<never, E | E2, A2>, Stream<never, E | E2, A3>]>
2451
+ } = internal.partitionEither
2452
+
2453
+ /**
2454
+ * Peels off enough material from the stream to construct a `Z` using the
2455
+ * provided `Sink` and then returns both the `Z` and the rest of the
2456
+ * `Stream` in a scope. Like all scoped values, the provided stream is
2457
+ * valid only within the scope.
2458
+ *
2459
+ * @since 2.0.0
2460
+ * @category utils
2461
+ */
2462
+ export const peel: {
2463
+ <R2, E2, A, Z>(
2464
+ sink: Sink.Sink<R2, E2, A, A, Z>
2465
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, readonly [Z, Stream<never, E, A>]>
2466
+ <R, E, R2, E2, A, Z>(
2467
+ self: Stream<R, E, A>,
2468
+ sink: Sink.Sink<R2, E2, A, A, Z>
2469
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, readonly [Z, Stream<never, E, A>]>
2470
+ } = internal.peel
2471
+
2472
+ /**
2473
+ * Pipes all of the values from this stream through the provided sink.
2474
+ *
2475
+ * See also `Stream.transduce`.
2476
+ *
2477
+ * @since 2.0.0
2478
+ * @category utils
2479
+ */
2480
+ export const pipeThrough: {
2481
+ <R2, E2, A, L, Z>(sink: Sink.Sink<R2, E2, A, L, Z>): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, L>
2482
+ <R, E, R2, E2, A, L, Z>(self: Stream<R, E, A>, sink: Sink.Sink<R2, E2, A, L, Z>): Stream<R | R2, E | E2, L>
2483
+ } = internal.pipeThrough
2484
+
2485
+ /**
2486
+ * Pipes all the values from this stream through the provided channel.
2487
+ *
2488
+ * @since 2.0.0
2489
+ * @category utils
2490
+ */
2491
+ export const pipeThroughChannel: {
2492
+ <R2, E, E2, A, A2>(
2493
+ channel: Channel.Channel<R2, E, Chunk.Chunk<A>, unknown, E2, Chunk.Chunk<A2>, unknown>
2494
+ ): <R>(self: Stream<R, E, A>) => Stream<R2 | R, E2, A2>
2495
+ <R, R2, E, E2, A, A2>(
2496
+ self: Stream<R, E, A>,
2497
+ channel: Channel.Channel<R2, E, Chunk.Chunk<A>, unknown, E2, Chunk.Chunk<A2>, unknown>
2498
+ ): Stream<R | R2, E2, A2>
2499
+ } = internal.pipeThroughChannel
2500
+
2501
+ /**
2502
+ * Pipes all values from this stream through the provided channel, passing
2503
+ * through any error emitted by this stream unchanged.
2504
+ *
2505
+ * @since 2.0.0
2506
+ * @category utils
2507
+ */
2508
+ export const pipeThroughChannelOrFail: {
2509
+ <R2, E, E2, A, A2>(
2510
+ chan: Channel.Channel<R2, E, Chunk.Chunk<A>, unknown, E2, Chunk.Chunk<A2>, unknown>
2511
+ ): <R>(self: Stream<R, E, A>) => Stream<R2 | R, E | E2, A2>
2512
+ <R, R2, E, E2, A, A2>(
2513
+ self: Stream<R, E, A>,
2514
+ chan: Channel.Channel<R2, E, Chunk.Chunk<A>, unknown, E2, Chunk.Chunk<A2>, unknown>
2515
+ ): Stream<R | R2, E | E2, A2>
2516
+ } = internal.pipeThroughChannelOrFail
2517
+
2518
+ /**
2519
+ * Emits the provided chunk before emitting any other value.
2520
+ *
2521
+ * @since 2.0.0
2522
+ * @category utils
2523
+ */
2524
+ export const prepend: {
2525
+ <B>(values: Chunk.Chunk<B>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, B | A>
2526
+ <R, E, A, B>(self: Stream<R, E, A>, values: Chunk.Chunk<B>): Stream<R, E, A | B>
2527
+ } = internal.prepend
2528
+
2529
+ /**
2530
+ * Provides the stream with its required context, which eliminates its
2531
+ * dependency on `R`.
2532
+ *
2533
+ * @since 2.0.0
2534
+ * @category context
2535
+ */
2536
+ export const provideContext: {
2537
+ <R>(context: Context.Context<R>): <E, A>(self: Stream<R, E, A>) => Stream<never, E, A>
2538
+ <E, A, R>(self: Stream<R, E, A>, context: Context.Context<R>): Stream<never, E, A>
2539
+ } = internal.provideContext
2540
+
2541
+ /**
2542
+ * Provides a `Layer` to the stream, which translates it to another level.
2543
+ *
2544
+ * @since 2.0.0
2545
+ * @category context
2546
+ */
2547
+ export const provideLayer: {
2548
+ <RIn, E2, ROut>(layer: Layer.Layer<RIn, E2, ROut>): <E, A>(self: Stream<ROut, E, A>) => Stream<RIn, E2 | E, A>
2549
+ <E, A, RIn, E2, ROut>(self: Stream<ROut, E, A>, layer: Layer.Layer<RIn, E2, ROut>): Stream<RIn, E | E2, A>
2550
+ } = internal.provideLayer
2551
+
2552
+ /**
2553
+ * Provides the stream with the single service it requires. If the stream
2554
+ * requires more than one service use `Stream.provideContext` instead.
2555
+ *
2556
+ * @since 2.0.0
2557
+ * @category context
2558
+ */
2559
+ export const provideService: {
2560
+ <T extends Context.Tag<any, any>>(
2561
+ tag: T,
2562
+ resource: Context.Tag.Service<T>
2563
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<Exclude<R, Context.Tag.Identifier<T>>, E, A>
2564
+ <R, E, A, T extends Context.Tag<any, any>>(
2565
+ self: Stream<R, E, A>,
2566
+ tag: T,
2567
+ resource: Context.Tag.Service<T>
2568
+ ): Stream<Exclude<R, Context.Tag.Identifier<T>>, E, A>
2569
+ } = internal.provideService
2570
+
2571
+ /**
2572
+ * Provides the stream with the single service it requires. If the stream
2573
+ * requires more than one service use `Stream.provideContext` instead.
2574
+ *
2575
+ * @since 2.0.0
2576
+ * @category context
2577
+ */
2578
+ export const provideServiceEffect: {
2579
+ <T extends Context.Tag<any, any>, R2, E2>(
2580
+ tag: T,
2581
+ effect: Effect.Effect<R2, E2, Context.Tag.Service<T>>
2582
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | Exclude<R, Context.Tag.Identifier<T>>, E2 | E, A>
2583
+ <R, E, A, T extends Context.Tag<any, any>, R2, E2>(
2584
+ self: Stream<R, E, A>,
2585
+ tag: T,
2586
+ effect: Effect.Effect<R2, E2, Context.Tag.Service<T>>
2587
+ ): Stream<R2 | Exclude<R, Context.Tag.Identifier<T>>, E | E2, A>
2588
+ } = internal.provideServiceEffect
2589
+
2590
+ /**
2591
+ * Provides the stream with the single service it requires. If the stream
2592
+ * requires more than one service use `Stream.provideContext` instead.
2593
+ *
2594
+ * @since 2.0.0
2595
+ * @category context
2596
+ */
2597
+ export const provideServiceStream: {
2598
+ <T extends Context.Tag<any, any>, R2, E2>(
2599
+ tag: T,
2600
+ stream: Stream<R2, E2, Context.Tag.Service<T>>
2601
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | Exclude<R, Context.Tag.Identifier<T>>, E2 | E, A>
2602
+ <R, E, A, T extends Context.Tag<any, any>, R2, E2>(
2603
+ self: Stream<R, E, A>,
2604
+ tag: T,
2605
+ stream: Stream<R2, E2, Context.Tag.Service<T>>
2606
+ ): Stream<R2 | Exclude<R, Context.Tag.Identifier<T>>, E | E2, A>
2607
+ } = internal.provideServiceStream
2608
+
2609
+ /**
2610
+ * Transforms the context being provided to the stream with the specified
2611
+ * function.
2612
+ *
2613
+ * @since 2.0.0
2614
+ * @category context
2615
+ */
2616
+ export const mapInputContext: {
2617
+ <R0, R>(f: (env: Context.Context<R0>) => Context.Context<R>): <E, A>(self: Stream<R, E, A>) => Stream<R0, E, A>
2618
+ <E, A, R0, R>(self: Stream<R, E, A>, f: (env: Context.Context<R0>) => Context.Context<R>): Stream<R0, E, A>
2619
+ } = internal.mapInputContext
2620
+
2621
+ /**
2622
+ * Splits the context into two parts, providing one part using the
2623
+ * specified layer and leaving the remainder `R0`.
2624
+ *
2625
+ * @since 2.0.0
2626
+ * @category context
2627
+ */
2628
+ export const provideSomeLayer: {
2629
+ <RIn, E2, ROut>(
2630
+ layer: Layer.Layer<RIn, E2, ROut>
2631
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<RIn | Exclude<R, ROut>, E2 | E, A>
2632
+ <R, E, A, RIn, E2, ROut>(
2633
+ self: Stream<R, E, A>,
2634
+ layer: Layer.Layer<RIn, E2, ROut>
2635
+ ): Stream<RIn | Exclude<R, ROut>, E | E2, A>
2636
+ } = internal.provideSomeLayer
2637
+
2638
+ /**
2639
+ * Constructs a stream from a range of integers, including both endpoints.
2640
+ *
2641
+ * @since 2.0.0
2642
+ * @category constructors
2643
+ */
2644
+ export const range: (min: number, max: number, chunkSize?: number) => Stream<never, never, number> = internal.range
2645
+
2646
+ /**
2647
+ * Re-chunks the elements of the stream into chunks of `n` elements each. The
2648
+ * last chunk might contain less than `n` elements.
2649
+ *
2650
+ * @since 2.0.0
2651
+ * @category utils
2652
+ */
2653
+ export const rechunk: {
2654
+ (n: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
2655
+ <R, E, A>(self: Stream<R, E, A>, n: number): Stream<R, E, A>
2656
+ } = internal.rechunk
2657
+
2658
+ /**
2659
+ * Keeps some of the errors, and terminates the fiber with the rest
2660
+ *
2661
+ * @since 2.0.0
2662
+ * @category error handling
2663
+ */
2664
+ export const refineOrDie: {
2665
+ <E, E2>(pf: (error: E) => Option.Option<E2>): <R, A>(self: Stream<R, E, A>) => Stream<R, E2, A>
2666
+ <R, A, E, E2>(self: Stream<R, E, A>, pf: (error: E) => Option.Option<E2>): Stream<R, E2, A>
2667
+ } = internal.refineOrDie
2668
+
2669
+ /**
2670
+ * Keeps some of the errors, and terminates the fiber with the rest, using the
2671
+ * specified function to convert the `E` into a defect.
2672
+ *
2673
+ * @since 2.0.0
2674
+ * @category error handling
2675
+ */
2676
+ export const refineOrDieWith: {
2677
+ <E, E2>(
2678
+ pf: (error: E) => Option.Option<E2>,
2679
+ f: (error: E) => unknown
2680
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R, E2, A>
2681
+ <R, A, E, E2>(self: Stream<R, E, A>, pf: (error: E) => Option.Option<E2>, f: (error: E) => unknown): Stream<R, E2, A>
2682
+ } = internal.refineOrDieWith
2683
+
2684
+ /**
2685
+ * Repeats the entire stream using the specified schedule. The stream will
2686
+ * execute normally, and then repeat again according to the provided schedule.
2687
+ *
2688
+ * @since 2.0.0
2689
+ * @category utils
2690
+ */
2691
+ export const repeat: {
2692
+ <R2, B>(schedule: Schedule.Schedule<R2, unknown, B>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
2693
+ <R, E, A, R2, B>(self: Stream<R, E, A>, schedule: Schedule.Schedule<R2, unknown, B>): Stream<R | R2, E, A>
2694
+ } = internal.repeat
2695
+
2696
+ /**
2697
+ * Creates a stream from an effect producing a value of type `A` which repeats
2698
+ * forever.
2699
+ *
2700
+ * @since 2.0.0
2701
+ * @category constructors
2702
+ */
2703
+ export const repeatEffect: <R, E, A>(effect: Effect.Effect<R, E, A>) => Stream<R, E, A> = internal.repeatEffect
2704
+
2705
+ /**
2706
+ * Creates a stream from an effect producing chunks of `A` values which
2707
+ * repeats forever.
2708
+ *
2709
+ * @since 2.0.0
2710
+ * @category constructors
2711
+ */
2712
+ export const repeatEffectChunk: <R, E, A>(effect: Effect.Effect<R, E, Chunk.Chunk<A>>) => Stream<R, E, A> =
2713
+ internal.repeatEffectChunk
2714
+
2715
+ /**
2716
+ * Creates a stream from an effect producing chunks of `A` values until it
2717
+ * fails with `None`.
2718
+ *
2719
+ * @since 2.0.0
2720
+ * @category constructors
2721
+ */
2722
+ export const repeatEffectChunkOption: <R, E, A>(
2723
+ effect: Effect.Effect<R, Option.Option<E>, Chunk.Chunk<A>>
2724
+ ) => Stream<R, E, A> = internal.repeatEffectChunkOption
2725
+
2726
+ /**
2727
+ * Creates a stream from an effect producing values of type `A` until it fails
2728
+ * with `None`.
2729
+ *
2730
+ * @since 2.0.0
2731
+ * @category constructors
2732
+ */
2733
+ export const repeatEffectOption: <R, E, A>(effect: Effect.Effect<R, Option.Option<E>, A>) => Stream<R, E, A> =
2734
+ internal.repeatEffectOption
2735
+
2736
+ /**
2737
+ * Creates a stream from an effect producing a value of type `A`, which is
2738
+ * repeated using the specified schedule.
2739
+ *
2740
+ * @since 2.0.0
2741
+ * @category constructors
2742
+ */
2743
+ export const repeatEffectWithSchedule: <R, E, A, A0 extends A, R2, _>(
2744
+ effect: Effect.Effect<R, E, A>,
2745
+ schedule: Schedule.Schedule<R2, A0, _>
2746
+ ) => Stream<R | R2, E, A> = internal.repeatEffectWithSchedule
2747
+
2748
+ /**
2749
+ * Repeats the entire stream using the specified schedule. The stream will
2750
+ * execute normally, and then repeat again according to the provided schedule.
2751
+ * The schedule output will be emitted at the end of each repetition.
2752
+ *
2753
+ * @since 2.0.0
2754
+ * @category utils
2755
+ */
2756
+ export const repeatEither: {
2757
+ <R2, B>(
2758
+ schedule: Schedule.Schedule<R2, unknown, B>
2759
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, Either.Either<B, A>>
2760
+ <R, E, A, R2, B>(
2761
+ self: Stream<R, E, A>,
2762
+ schedule: Schedule.Schedule<R2, unknown, B>
2763
+ ): Stream<R | R2, E, Either.Either<B, A>>
2764
+ } = internal.repeatEither
2765
+
2766
+ /**
2767
+ * Repeats each element of the stream using the provided schedule. Repetitions
2768
+ * are done in addition to the first execution, which means using
2769
+ * `Schedule.recurs(1)` actually results in the original effect, plus an
2770
+ * additional recurrence, for a total of two repetitions of each value in the
2771
+ * stream.
2772
+ *
2773
+ * @since 2.0.0
2774
+ * @category utils
2775
+ */
2776
+ export const repeatElements: {
2777
+ <R2, B>(schedule: Schedule.Schedule<R2, unknown, B>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
2778
+ <R, E, A, R2, B>(self: Stream<R, E, A>, schedule: Schedule.Schedule<R2, unknown, B>): Stream<R | R2, E, A>
2779
+ } = internal.repeatElements
2780
+
2781
+ /**
2782
+ * Repeats each element of the stream using the provided schedule. When the
2783
+ * schedule is finished, then the output of the schedule will be emitted into
2784
+ * the stream. Repetitions are done in addition to the first execution, which
2785
+ * means using `Schedule.recurs(1)` actually results in the original effect,
2786
+ * plus an additional recurrence, for a total of two repetitions of each value
2787
+ * in the stream.
2788
+ *
2789
+ * This function accepts two conversion functions, which allow the output of
2790
+ * this stream and the output of the provided schedule to be unified into a
2791
+ * single type. For example, `Either` or similar data type.
2792
+ *
2793
+ * @since 2.0.0
2794
+ * @category utils
2795
+ */
2796
+ export const repeatElementsWith: {
2797
+ <R2, B, A, C>(
2798
+ schedule: Schedule.Schedule<R2, unknown, B>,
2799
+ options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C }
2800
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E, C>
2801
+ <R, E, R2, B, A, C>(
2802
+ self: Stream<R, E, A>,
2803
+ schedule: Schedule.Schedule<R2, unknown, B>,
2804
+ options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C }
2805
+ ): Stream<R | R2, E, C>
2806
+ } = internal.repeatElementsWith
2807
+
2808
+ /**
2809
+ * Repeats the provided value infinitely.
2810
+ *
2811
+ * @since 2.0.0
2812
+ * @category constructors
2813
+ */
2814
+ export const repeatValue: <A>(value: A) => Stream<never, never, A> = internal.repeatValue
2815
+
2816
+ /**
2817
+ * Repeats the entire stream using the specified schedule. The stream will
2818
+ * execute normally, and then repeat again according to the provided schedule.
2819
+ * The schedule output will be emitted at the end of each repetition and can
2820
+ * be unified with the stream elements using the provided functions.
2821
+ *
2822
+ * @since 2.0.0
2823
+ * @category utils
2824
+ */
2825
+ export const repeatWith: {
2826
+ <R2, B, A, C>(
2827
+ schedule: Schedule.Schedule<R2, unknown, B>,
2828
+ options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C }
2829
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E, C>
2830
+ <R, E, R2, B, A, C>(
2831
+ self: Stream<R, E, A>,
2832
+ schedule: Schedule.Schedule<R2, unknown, B>,
2833
+ options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C }
2834
+ ): Stream<R | R2, E, C>
2835
+ } = internal.repeatWith
2836
+
2837
+ /**
2838
+ * When the stream fails, retry it according to the given schedule
2839
+ *
2840
+ * This retries the entire stream, so will re-execute all of the stream's
2841
+ * acquire operations.
2842
+ *
2843
+ * The schedule is reset as soon as the first element passes through the
2844
+ * stream again.
2845
+ *
2846
+ * @param schedule A `Schedule` receiving as input the errors of the stream.
2847
+ * @since 2.0.0
2848
+ * @category utils
2849
+ */
2850
+ export const retry: {
2851
+ <R2, E, E0 extends E, _>(
2852
+ schedule: Schedule.Schedule<R2, E0, _>
2853
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
2854
+ <R, A, R2, E, E0 extends E, _>(self: Stream<R, E, A>, schedule: Schedule.Schedule<R2, E0, _>): Stream<R | R2, E, A>
2855
+ } = internal.retry
2856
+
2857
+ /**
2858
+ * Runs the sink on the stream to produce either the sink's result or an error.
2859
+ *
2860
+ * @since 2.0.0
2861
+ * @category destructors
2862
+ */
2863
+ export const run: {
2864
+ <R2, E2, A, Z>(
2865
+ sink: Sink.Sink<R2, E2, A, unknown, Z>
2866
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R2 | R, E2 | E, Z>
2867
+ <R, E, R2, E2, A, Z>(self: Stream<R, E, A>, sink: Sink.Sink<R2, E2, A, unknown, Z>): Effect.Effect<R | R2, E | E2, Z>
2868
+ } = internal.run
2869
+
2870
+ /**
2871
+ * Runs the stream and collects all of its elements to a chunk.
2872
+ *
2873
+ * @since 2.0.0
2874
+ * @category destructors
2875
+ */
2876
+ export const runCollect: <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<R, E, Chunk.Chunk<A>> = internal.runCollect
2877
+
2878
+ /**
2879
+ * Runs the stream and emits the number of elements processed
2880
+ *
2881
+ * @since 2.0.0
2882
+ * @category destructors
2883
+ */
2884
+ export const runCount: <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<R, E, number> = internal.runCount
2885
+
2886
+ /**
2887
+ * Runs the stream only for its effects. The emitted elements are discarded.
2888
+ *
2889
+ * @since 2.0.0
2890
+ * @category destructors
2891
+ */
2892
+ export const runDrain: <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<R, E, void> = internal.runDrain
2893
+
2894
+ /**
2895
+ * Executes a pure fold over the stream of values - reduces all elements in
2896
+ * the stream to a value of type `S`.
2897
+ *
2898
+ * @since 2.0.0
2899
+ * @category destructors
2900
+ */
2901
+ export const runFold: {
2902
+ <S, A>(s: S, f: (s: S, a: A) => S): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R, E, S>
2903
+ <R, E, S, A>(self: Stream<R, E, A>, s: S, f: (s: S, a: A) => S): Effect.Effect<R, E, S>
2904
+ } = internal.runFold
2905
+
2906
+ /**
2907
+ * Executes an effectful fold over the stream of values.
2908
+ *
2909
+ * @since 2.0.0
2910
+ * @category destructors
2911
+ */
2912
+ export const runFoldEffect: {
2913
+ <S, A, R2, E2>(
2914
+ s: S,
2915
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
2916
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R2 | R, E2 | E, S>
2917
+ <R, E, S, A, R2, E2>(
2918
+ self: Stream<R, E, A>,
2919
+ s: S,
2920
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
2921
+ ): Effect.Effect<R | R2, E | E2, S>
2922
+ } = internal.runFoldEffect
2923
+
2924
+ /**
2925
+ * Executes a pure fold over the stream of values. Returns a scoped value that
2926
+ * represents the scope of the stream.
2927
+ *
2928
+ * @since 2.0.0
2929
+ * @category destructors
2930
+ */
2931
+ export const runFoldScoped: {
2932
+ <S, A>(s: S, f: (s: S, a: A) => S): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R, E, S>
2933
+ <R, E, S, A>(self: Stream<R, E, A>, s: S, f: (s: S, a: A) => S): Effect.Effect<Scope.Scope | R, E, S>
2934
+ } = internal.runFoldScoped
2935
+
2936
+ /**
2937
+ * Executes an effectful fold over the stream of values. Returns a scoped
2938
+ * value that represents the scope of the stream.
2939
+ *
2940
+ * @since 2.0.0
2941
+ * @category destructors
2942
+ */
2943
+ export const runFoldScopedEffect: {
2944
+ <S, A, R2, E2>(
2945
+ s: S,
2946
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
2947
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, S>
2948
+ <R, E, S, A, R2, E2>(
2949
+ self: Stream<R, E, A>,
2950
+ s: S,
2951
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
2952
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, S>
2953
+ } = internal.runFoldScopedEffect
2954
+
2955
+ /**
2956
+ * Reduces the elements in the stream to a value of type `S`. Stops the fold
2957
+ * early when the condition is not fulfilled. Example:
2958
+ *
2959
+ * @since 2.0.0
2960
+ * @category destructors
2961
+ */
2962
+ export const runFoldWhile: {
2963
+ <S, A>(s: S, cont: Predicate<S>, f: (s: S, a: A) => S): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R, E, S>
2964
+ <R, E, S, A>(self: Stream<R, E, A>, s: S, cont: Predicate<S>, f: (s: S, a: A) => S): Effect.Effect<R, E, S>
2965
+ } = internal.runFoldWhile
2966
+
2967
+ /**
2968
+ * Executes an effectful fold over the stream of values. Stops the fold early
2969
+ * when the condition is not fulfilled.
2970
+ *
2971
+ * @since 2.0.0
2972
+ * @category destructors
2973
+ */
2974
+ export const runFoldWhileEffect: {
2975
+ <S, A, R2, E2>(
2976
+ s: S,
2977
+ cont: Predicate<S>,
2978
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
2979
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R2 | R, E2 | E, S>
2980
+ <R, E, S, A, R2, E2>(
2981
+ self: Stream<R, E, A>,
2982
+ s: S,
2983
+ cont: Predicate<S>,
2984
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
2985
+ ): Effect.Effect<R | R2, E | E2, S>
2986
+ } = internal.runFoldWhileEffect
2987
+
2988
+ /**
2989
+ * Executes a pure fold over the stream of values. Returns a scoped value that
2990
+ * represents the scope of the stream. Stops the fold early when the condition
2991
+ * is not fulfilled.
2992
+ *
2993
+ * @since 2.0.0
2994
+ * @category destructors
2995
+ */
2996
+ export const runFoldWhileScoped: {
2997
+ <S, A>(
2998
+ s: S,
2999
+ cont: Predicate<S>,
3000
+ f: (s: S, a: A) => S
3001
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R | Scope.Scope, E, S>
3002
+ <R, E, S, A>(
3003
+ self: Stream<R, E, A>,
3004
+ s: S,
3005
+ cont: Predicate<S>,
3006
+ f: (s: S, a: A) => S
3007
+ ): Effect.Effect<Scope.Scope | R, E, S>
3008
+ } = internal.runFoldWhileScoped
3009
+
3010
+ /**
3011
+ * Executes an effectful fold over the stream of values. Returns a scoped
3012
+ * value that represents the scope of the stream. Stops the fold early when
3013
+ * the condition is not fulfilled.
3014
+ *
3015
+ * @since 2.0.0
3016
+ * @category destructors
3017
+ */
3018
+ export const runFoldWhileScopedEffect: {
3019
+ <S, A, R2, E2>(
3020
+ s: S,
3021
+ cont: Predicate<S>,
3022
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
3023
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, S>
3024
+ <R, E, S, A, R2, E2>(
3025
+ self: Stream<R, E, A>,
3026
+ s: S,
3027
+ cont: Predicate<S>,
3028
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
3029
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, S>
3030
+ } = internal.runFoldWhileScopedEffect
3031
+
3032
+ /**
3033
+ * Consumes all elements of the stream, passing them to the specified
3034
+ * callback.
3035
+ *
3036
+ * @since 2.0.0
3037
+ * @category destructors
3038
+ */
3039
+ export const runForEach: {
3040
+ <A, R2, E2, _>(
3041
+ f: (a: A) => Effect.Effect<R2, E2, _>
3042
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R2 | R, E2 | E, void>
3043
+ <R, E, A, R2, E2, _>(
3044
+ self: Stream<R, E, A>,
3045
+ f: (a: A) => Effect.Effect<R2, E2, _>
3046
+ ): Effect.Effect<R | R2, E | E2, void>
3047
+ } = internal.runForEach
3048
+
3049
+ /**
3050
+ * Consumes all elements of the stream, passing them to the specified
3051
+ * callback.
3052
+ *
3053
+ * @since 2.0.0
3054
+ * @category destructors
3055
+ */
3056
+ export const runForEachChunk: {
3057
+ <A, R2, E2, _>(
3058
+ f: (a: Chunk.Chunk<A>) => Effect.Effect<R2, E2, _>
3059
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R2 | R, E2 | E, void>
3060
+ <R, E, A, R2, E2, _>(
3061
+ self: Stream<R, E, A>,
3062
+ f: (a: Chunk.Chunk<A>) => Effect.Effect<R2, E2, _>
3063
+ ): Effect.Effect<R | R2, E | E2, void>
3064
+ } = internal.runForEachChunk
3065
+
3066
+ /**
3067
+ * Like `Stream.runForEachChunk`, but returns a scoped effect so the
3068
+ * finalization order can be controlled.
3069
+ *
3070
+ * @since 2.0.0
3071
+ * @category destructors
3072
+ */
3073
+ export const runForEachChunkScoped: {
3074
+ <A, R2, E2, _>(
3075
+ f: (a: Chunk.Chunk<A>) => Effect.Effect<R2, E2, _>
3076
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, void>
3077
+ <R, E, A, R2, E2, _>(
3078
+ self: Stream<R, E, A>,
3079
+ f: (a: Chunk.Chunk<A>) => Effect.Effect<R2, E2, _>
3080
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, void>
3081
+ } = internal.runForEachChunkScoped
3082
+
3083
+ /**
3084
+ * Like `Stream.forEach`, but returns a scoped effect so the finalization
3085
+ * order can be controlled.
3086
+ *
3087
+ * @since 2.0.0
3088
+ * @category destructors
3089
+ */
3090
+ export const runForEachScoped: {
3091
+ <A, R2, E2, _>(
3092
+ f: (a: A) => Effect.Effect<R2, E2, _>
3093
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, void>
3094
+ <R, E, A, R2, E2, _>(
3095
+ self: Stream<R, E, A>,
3096
+ f: (a: A) => Effect.Effect<R2, E2, _>
3097
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, void>
3098
+ } = internal.runForEachScoped
3099
+
3100
+ /**
3101
+ * Consumes elements of the stream, passing them to the specified callback,
3102
+ * and terminating consumption when the callback returns `false`.
3103
+ *
3104
+ * @since 2.0.0
3105
+ * @category destructors
3106
+ */
3107
+ export const runForEachWhile: {
3108
+ <A, R2, E2>(
3109
+ f: (a: A) => Effect.Effect<R2, E2, boolean>
3110
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<R2 | R, E2 | E, void>
3111
+ <R, E, A, R2, E2>(
3112
+ self: Stream<R, E, A>,
3113
+ f: (a: A) => Effect.Effect<R2, E2, boolean>
3114
+ ): Effect.Effect<R | R2, E | E2, void>
3115
+ } = internal.runForEachWhile
3116
+
3117
+ /**
3118
+ * Like `Stream.runForEachWhile`, but returns a scoped effect so the
3119
+ * finalization order can be controlled.
3120
+ *
3121
+ * @since 2.0.0
3122
+ * @category destructors
3123
+ */
3124
+ export const runForEachWhileScoped: {
3125
+ <A, R2, E2>(
3126
+ f: (a: A) => Effect.Effect<R2, E2, boolean>
3127
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, void>
3128
+ <R, E, A, R2, E2>(
3129
+ self: Stream<R, E, A>,
3130
+ f: (a: A) => Effect.Effect<R2, E2, boolean>
3131
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, void>
3132
+ } = internal.runForEachWhileScoped
3133
+
3134
+ /**
3135
+ * Runs the stream to completion and yields the first value emitted by it,
3136
+ * discarding the rest of the elements.
3137
+ *
3138
+ * @since 2.0.0
3139
+ * @category destructors
3140
+ */
3141
+ export const runHead: <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<R, E, Option.Option<A>> = internal.runHead
3142
+
3143
+ /**
3144
+ * Publishes elements of this stream to a `PubSub`. Stream failure and ending will
3145
+ * also be signalled.
3146
+ *
3147
+ * @since 2.0.0
3148
+ * @category destructors
3149
+ */
3150
+ export const runIntoPubSub: {
3151
+ <E, A>(pubsub: PubSub.PubSub<Take.Take<E, A>>): <R>(self: Stream<R, E, A>) => Effect.Effect<R, never, void>
3152
+ <R, E, A>(self: Stream<R, E, A>, pubsub: PubSub.PubSub<Take.Take<E, A>>): Effect.Effect<R, never, void>
3153
+ } = internal.runIntoPubSub
3154
+
3155
+ /**
3156
+ * Like `Stream.runIntoPubSub`, but provides the result as a scoped effect to
3157
+ * allow for scope composition.
3158
+ *
3159
+ * @since 2.0.0
3160
+ * @category destructors
3161
+ */
3162
+ export const runIntoPubSubScoped: {
3163
+ <E, A>(
3164
+ pubsub: PubSub.PubSub<Take.Take<E, A>>
3165
+ ): <R>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R, never, void>
3166
+ <R, E, A>(self: Stream<R, E, A>, pubsub: PubSub.PubSub<Take.Take<E, A>>): Effect.Effect<Scope.Scope | R, never, void>
3167
+ } = internal.runIntoPubSubScoped
3168
+
3169
+ /**
3170
+ * Enqueues elements of this stream into a queue. Stream failure and ending
3171
+ * will also be signalled.
3172
+ *
3173
+ * @since 2.0.0
3174
+ * @category destructors
3175
+ */
3176
+ export const runIntoQueue: {
3177
+ <E, A>(queue: Queue.Enqueue<Take.Take<E, A>>): <R>(self: Stream<R, E, A>) => Effect.Effect<R, never, void>
3178
+ <R, E, A>(self: Stream<R, E, A>, queue: Queue.Enqueue<Take.Take<E, A>>): Effect.Effect<R, never, void>
3179
+ } = internal.runIntoQueue
3180
+
3181
+ /**
3182
+ * Like `Stream.runIntoQueue`, but provides the result as a scoped [[ZIO]]
3183
+ * to allow for scope composition.
3184
+ *
3185
+ * @since 2.0.0
3186
+ * @category destructors
3187
+ */
3188
+ export const runIntoQueueElementsScoped: {
3189
+ <E, A>(
3190
+ queue: Queue.Enqueue<Exit.Exit<Option.Option<E>, A>>
3191
+ ): <R>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R, never, void>
3192
+ <R, E, A>(
3193
+ self: Stream<R, E, A>,
3194
+ queue: Queue.Enqueue<Exit.Exit<Option.Option<E>, A>>
3195
+ ): Effect.Effect<Scope.Scope | R, never, void>
3196
+ } = internal.runIntoQueueElementsScoped
3197
+
3198
+ /**
3199
+ * Like `Stream.runIntoQueue`, but provides the result as a scoped effect
3200
+ * to allow for scope composition.
3201
+ *
3202
+ * @since 2.0.0
3203
+ * @category destructors
3204
+ */
3205
+ export const runIntoQueueScoped: {
3206
+ <E, A>(
3207
+ queue: Queue.Enqueue<Take.Take<E, A>>
3208
+ ): <R>(self: Stream<R, E, A>) => Effect.Effect<R | Scope.Scope, never, void>
3209
+ <R, E, A>(self: Stream<R, E, A>, queue: Queue.Enqueue<Take.Take<E, A>>): Effect.Effect<Scope.Scope | R, never, void>
3210
+ } = internal.runIntoQueueScoped
3211
+
3212
+ /**
3213
+ * Runs the stream to completion and yields the last value emitted by it,
3214
+ * discarding the rest of the elements.
3215
+ *
3216
+ * @since 2.0.0
3217
+ * @category destructors
3218
+ */
3219
+ export const runLast: <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<R, E, Option.Option<A>> = internal.runLast
3220
+
3221
+ /**
3222
+ * @since 2.0.0
3223
+ * @category destructors
3224
+ */
3225
+ export const runScoped: {
3226
+ <R2, E2, A, A2>(
3227
+ sink: Sink.Sink<R2, E2, A, unknown, A2>
3228
+ ): <R, E>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R2 | R, E2 | E, A2>
3229
+ <R, E, R2, E2, A, A2>(
3230
+ self: Stream<R, E, A>,
3231
+ sink: Sink.Sink<R2, E2, A, unknown, A2>
3232
+ ): Effect.Effect<Scope.Scope | R | R2, E | E2, A2>
3233
+ } = internal.runScoped
3234
+
3235
+ /**
3236
+ * Runs the stream to a sink which sums elements, provided they are Numeric.
3237
+ *
3238
+ * @since 2.0.0
3239
+ * @category destructors
3240
+ */
3241
+ export const runSum: <R, E>(self: Stream<R, E, number>) => Effect.Effect<R, E, number> = internal.runSum
3242
+
3243
+ /**
3244
+ * Statefully maps over the elements of this stream to produce all
3245
+ * intermediate results of type `S` given an initial S.
3246
+ *
3247
+ * @since 2.0.0
3248
+ * @category utils
3249
+ */
3250
+ export const scan: {
3251
+ <S, A>(s: S, f: (s: S, a: A) => S): <R, E>(self: Stream<R, E, A>) => Stream<R, E, S>
3252
+ <R, E, S, A>(self: Stream<R, E, A>, s: S, f: (s: S, a: A) => S): Stream<R, E, S>
3253
+ } = internal.scan
3254
+
3255
+ /**
3256
+ * Statefully and effectfully maps over the elements of this stream to produce
3257
+ * all intermediate results of type `S` given an initial S.
3258
+ *
3259
+ * @since 2.0.0
3260
+ * @category utils
3261
+ */
3262
+ export const scanEffect: {
3263
+ <S, A, R2, E2>(
3264
+ s: S,
3265
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
3266
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, S>
3267
+ <R, E, S, A, R2, E2>(
3268
+ self: Stream<R, E, A>,
3269
+ s: S,
3270
+ f: (s: S, a: A) => Effect.Effect<R2, E2, S>
3271
+ ): Stream<R | R2, E | E2, S>
3272
+ } = internal.scanEffect
3273
+
3274
+ /**
3275
+ * Statefully maps over the elements of this stream to produce all
3276
+ * intermediate results.
3277
+ *
3278
+ * See also `Stream.scan`.
3279
+ *
3280
+ * @since 2.0.0
3281
+ * @category utils
3282
+ */
3283
+ export const scanReduce: {
3284
+ <A2, A>(f: (a2: A2 | A, a: A) => A2): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A2 | A>
3285
+ <R, E, A2, A>(self: Stream<R, E, A>, f: (a2: A2 | A, a: A) => A2): Stream<R, E, A2 | A>
3286
+ } = internal.scanReduce
3287
+
3288
+ /**
3289
+ * Statefully and effectfully maps over the elements of this stream to produce
3290
+ * all intermediate results.
3291
+ *
3292
+ * See also `Stream.scanEffect`.
3293
+ *
3294
+ * @since 2.0.0
3295
+ * @category utils
3296
+ */
3297
+ export const scanReduceEffect: <A2, A, R2, E2>(
3298
+ f: (a2: A2 | A, a: A) => Effect.Effect<R2, E2, A2 | A>
3299
+ ) => <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2 | A> = internal.scanReduceEffect
3300
+
3301
+ /**
3302
+ * Schedules the output of the stream using the provided `schedule`.
3303
+ *
3304
+ * @since 2.0.0
3305
+ * @category utils
3306
+ */
3307
+ export const schedule: {
3308
+ <R2, A, A0 extends A, _>(
3309
+ schedule: Schedule.Schedule<R2, A0, _>
3310
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E, A>
3311
+ <R, E, R2, A, A0 extends A, _>(self: Stream<R, E, A>, schedule: Schedule.Schedule<R2, A0, _>): Stream<R | R2, E, A>
3312
+ } = internal.schedule
3313
+
3314
+ /**
3315
+ * Schedules the output of the stream using the provided `schedule` and emits
3316
+ * its output at the end (if `schedule` is finite). Uses the provided function
3317
+ * to align the stream and schedule outputs on the same type.
3318
+ *
3319
+ * @since 2.0.0
3320
+ * @category utils
3321
+ */
3322
+ export const scheduleWith: {
3323
+ <R2, A, A0 extends A, B, C>(
3324
+ schedule: Schedule.Schedule<R2, A0, B>,
3325
+ options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C }
3326
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E, C>
3327
+ <R, E, R2, A, A0 extends A, B, C>(
3328
+ self: Stream<R, E, A>,
3329
+ schedule: Schedule.Schedule<R2, A0, B>,
3330
+ options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C }
3331
+ ): Stream<R | R2, E, C>
3332
+ } = internal.scheduleWith
3333
+
3334
+ /**
3335
+ * Creates a single-valued stream from a scoped resource.
3336
+ *
3337
+ * @since 2.0.0
3338
+ * @category constructors
3339
+ */
3340
+ export const scoped: <R, E, A>(effect: Effect.Effect<R, E, A>) => Stream<Exclude<R, Scope.Scope>, E, A> =
3341
+ internal.scoped
3342
+
3343
+ /**
3344
+ * Emits a sliding window of `n` elements.
3345
+ *
3346
+ * ```ts
3347
+ * import * as Stream from "./Stream"
3348
+ * import { pipe } from "./Function"
3349
+ *
3350
+ * pipe(
3351
+ * Stream.make(1, 2, 3, 4),
3352
+ * Stream.sliding(2),
3353
+ * Stream.runCollect
3354
+ * )
3355
+ * // => Chunk(Chunk(1, 2), Chunk(2, 3), Chunk(3, 4))
3356
+ * ```
3357
+ *
3358
+ * @since 2.0.0
3359
+ * @category utils
3360
+ */
3361
+ export const sliding: {
3362
+ (chunkSize: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
3363
+ <R, E, A>(self: Stream<R, E, A>, chunkSize: number): Stream<R, E, Chunk.Chunk<A>>
3364
+ } = internal.sliding
3365
+
3366
+ /**
3367
+ * Like `sliding`, but with a configurable `stepSize` parameter.
3368
+ *
3369
+ * @since 2.0.0
3370
+ * @category utils
3371
+ */
3372
+ export const slidingSize: {
3373
+ (chunkSize: number, stepSize: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
3374
+ <R, E, A>(self: Stream<R, E, A>, chunkSize: number, stepSize: number): Stream<R, E, Chunk.Chunk<A>>
3375
+ } = internal.slidingSize
3376
+
3377
+ /**
3378
+ * Converts an option on values into an option on errors.
3379
+ *
3380
+ * @since 2.0.0
3381
+ * @category utils
3382
+ */
3383
+ export const some: <R, E, A>(self: Stream<R, E, Option.Option<A>>) => Stream<R, Option.Option<E>, A> = internal.some
3384
+
3385
+ /**
3386
+ * Extracts the optional value, or returns the given 'default'.
3387
+ *
3388
+ * @since 2.0.0
3389
+ * @category utils
3390
+ */
3391
+ export const someOrElse: {
3392
+ <A2>(fallback: LazyArg<A2>): <R, E, A>(self: Stream<R, E, Option.Option<A>>) => Stream<R, E, A2 | A>
3393
+ <R, E, A, A2>(self: Stream<R, E, Option.Option<A>>, fallback: LazyArg<A2>): Stream<R, E, A | A2>
3394
+ } = internal.someOrElse
3395
+
3396
+ /**
3397
+ * Extracts the optional value, or fails with the given error 'e'.
3398
+ *
3399
+ * @since 2.0.0
3400
+ * @category utils
3401
+ */
3402
+ export const someOrFail: {
3403
+ <E2>(error: LazyArg<E2>): <R, E, A>(self: Stream<R, E, Option.Option<A>>) => Stream<R, E2 | E, A>
3404
+ <R, E, A, E2>(self: Stream<R, E, Option.Option<A>>, error: LazyArg<E2>): Stream<R, E | E2, A>
3405
+ } = internal.someOrFail
3406
+
3407
+ /**
3408
+ * Splits elements based on a predicate.
3409
+ *
3410
+ * ```ts
3411
+ * import * as Stream from "./Stream"
3412
+ * import { pipe } from "./Function"
3413
+ *
3414
+ * pipe(
3415
+ * Stream.range(1, 10),
3416
+ * Stream.split((n) => n % 4 === 0),
3417
+ * Stream.runCollect
3418
+ * )
3419
+ * // => Chunk(Chunk(1, 2, 3), Chunk(5, 6, 7), Chunk(9))
3420
+ * ```
3421
+ *
3422
+ * @since 2.0.0
3423
+ * @category utils
3424
+ */
3425
+ export const split: {
3426
+ <A>(predicate: Predicate<A>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
3427
+ <R, E, A>(self: Stream<R, E, A>, predicate: Predicate<A>): Stream<R, E, Chunk.Chunk<A>>
3428
+ } = internal.split
3429
+
3430
+ /**
3431
+ * Splits elements on a delimiter and transforms the splits into desired output.
3432
+ *
3433
+ * @since 2.0.0
3434
+ * @category utils
3435
+ */
3436
+ export const splitOnChunk: {
3437
+ <A>(delimiter: Chunk.Chunk<A>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, Chunk.Chunk<A>>
3438
+ <R, E, A>(self: Stream<R, E, A>, delimiter: Chunk.Chunk<A>): Stream<R, E, Chunk.Chunk<A>>
3439
+ } = internal.splitOnChunk
3440
+
3441
+ /**
3442
+ * Splits strings on newlines. Handles both Windows newlines (`\r\n`) and UNIX
3443
+ * newlines (`\n`).
3444
+ *
3445
+ * @since 2.0.0
3446
+ * @category combinators
3447
+ */
3448
+ export const splitLines: <R, E>(self: Stream<R, E, string>) => Stream<R, E, string> = internal.splitLines
3449
+
3450
+ /**
3451
+ * Creates a single-valued pure stream.
3452
+ *
3453
+ * @since 2.0.0
3454
+ * @category constructors
3455
+ */
3456
+ export const succeed: <A>(value: A) => Stream<never, never, A> = internal.succeed
3457
+
3458
+ /**
3459
+ * Creates a single-valued pure stream.
3460
+ *
3461
+ * @since 2.0.0
3462
+ * @category constructors
3463
+ */
3464
+ export const sync: <A>(evaluate: LazyArg<A>) => Stream<never, never, A> = internal.sync
3465
+
3466
+ /**
3467
+ * Returns a lazily constructed stream.
3468
+ *
3469
+ * @since 2.0.0
3470
+ * @category constructors
3471
+ */
3472
+ export const suspend: <R, E, A>(stream: LazyArg<Stream<R, E, A>>) => Stream<R, E, A> = internal.suspend
3473
+
3474
+ /**
3475
+ * Takes the specified number of elements from this stream.
3476
+ *
3477
+ * @since 2.0.0
3478
+ * @category utils
3479
+ */
3480
+ export const take: {
3481
+ (n: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
3482
+ <R, E, A>(self: Stream<R, E, A>, n: number): Stream<R, E, A>
3483
+ } = internal.take
3484
+
3485
+ /**
3486
+ * Takes the last specified number of elements from this stream.
3487
+ *
3488
+ * @since 2.0.0
3489
+ * @category utils
3490
+ */
3491
+ export const takeRight: {
3492
+ (n: number): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
3493
+ <R, E, A>(self: Stream<R, E, A>, n: number): Stream<R, E, A>
3494
+ } = internal.takeRight
3495
+
3496
+ /**
3497
+ * Takes all elements of the stream until the specified predicate evaluates to
3498
+ * `true`.
3499
+ *
3500
+ * @since 2.0.0
3501
+ * @category utils
3502
+ */
3503
+ export const takeUntil: {
3504
+ <A>(predicate: Predicate<A>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
3505
+ <R, E, A>(self: Stream<R, E, A>, predicate: Predicate<A>): Stream<R, E, A>
3506
+ } = internal.takeUntil
3507
+
3508
+ /**
3509
+ * Takes all elements of the stream until the specified effectual predicate
3510
+ * evaluates to `true`.
3511
+ *
3512
+ * @since 2.0.0
3513
+ * @category utils
3514
+ */
3515
+ export const takeUntilEffect: {
3516
+ <A, R2, E2>(
3517
+ predicate: (a: A) => Effect.Effect<R2, E2, boolean>
3518
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
3519
+ <R, E, A, R2, E2>(
3520
+ self: Stream<R, E, A>,
3521
+ predicate: (a: A) => Effect.Effect<R2, E2, boolean>
3522
+ ): Stream<R | R2, E | E2, A>
3523
+ } = internal.takeUntilEffect
3524
+
3525
+ /**
3526
+ * Takes all elements of the stream for as long as the specified predicate
3527
+ * evaluates to `true`.
3528
+ *
3529
+ * @since 2.0.0
3530
+ * @category utils
3531
+ */
3532
+ export const takeWhile: {
3533
+ <A>(predicate: Predicate<A>): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
3534
+ <R, E, A>(self: Stream<R, E, A>, predicate: Predicate<A>): Stream<R, E, A>
3535
+ } = internal.takeWhile
3536
+
3537
+ /**
3538
+ * Adds an effect to consumption of every element of the stream.
3539
+ *
3540
+ * @since 2.0.0
3541
+ * @category sequencing
3542
+ */
3543
+ export const tap: {
3544
+ <A, X extends A, R2, E2, _>(
3545
+ f: (a: X) => Effect.Effect<R2, E2, _>
3546
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
3547
+ <R, E, A, X extends A, R2, E2, _>(
3548
+ self: Stream<R, E, A>,
3549
+ f: (a: X) => Effect.Effect<R2, E2, _>
3550
+ ): Stream<R | R2, E | E2, A>
3551
+ } = internal.tap
3552
+
3553
+ /**
3554
+ * Returns a stream that effectfully "peeks" at the failure or success of
3555
+ * the stream.
3556
+ *
3557
+ * @since 2.0.0
3558
+ * @category sequencing
3559
+ */
3560
+ export const tapBoth: {
3561
+ <E, XE extends E, A, XA extends A, R2, E2, X, R3, E3, X1>(
3562
+ options: {
3563
+ readonly onFailure: (e: XE) => Effect.Effect<R2, E2, X>
3564
+ readonly onSuccess: (a: XA) => Effect.Effect<R3, E3, X1>
3565
+ }
3566
+ ): <R>(self: Stream<R, E, A>) => Stream<R | R2 | R3, E | E2 | E3, A>
3567
+ <R, E, A, XE extends E, XA extends A, R2, E2, X, R3, E3, X1>(
3568
+ self: Stream<R, E, A>,
3569
+ options: {
3570
+ readonly onFailure: (e: XE) => Effect.Effect<R2, E2, X>
3571
+ readonly onSuccess: (a: XA) => Effect.Effect<R3, E3, X1>
3572
+ }
3573
+ ): Stream<R | R2 | R3, E | E2 | E3, A>
3574
+ } = internal.tapBoth
3575
+
3576
+ /**
3577
+ * Returns a stream that effectfully "peeks" at the failure of the stream.
3578
+ *
3579
+ * @since 2.0.0
3580
+ * @category sequencing
3581
+ */
3582
+ export const tapError: {
3583
+ <E, X extends E, R2, E2, _>(
3584
+ f: (error: X) => Effect.Effect<R2, E2, _>
3585
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E | E2, A>
3586
+ <R, A, E, X extends E, R2, E2, _>(
3587
+ self: Stream<R, E, A>,
3588
+ f: (error: X) => Effect.Effect<R2, E2, _>
3589
+ ): Stream<R | R2, E | E2, A>
3590
+ } = internal.tapError
3591
+
3592
+ /**
3593
+ * Returns a stream that effectfully "peeks" at the cause of failure of the
3594
+ * stream.
3595
+ *
3596
+ * @since 2.0.0
3597
+ * @category utils
3598
+ */
3599
+ export const tapErrorCause: {
3600
+ <E, X extends E, R2, E2, _>(
3601
+ f: (cause: Cause.Cause<X>) => Effect.Effect<R2, E2, _>
3602
+ ): <R, A>(self: Stream<R, E, A>) => Stream<R2 | R, E | E2, A>
3603
+ <R, A, E, X extends E, R2, E2, _>(
3604
+ self: Stream<R, E, A>,
3605
+ f: (cause: Cause.Cause<X>) => Effect.Effect<R2, E2, _>
3606
+ ): Stream<R | R2, E | E2, A>
3607
+ } = internal.tapErrorCause
3608
+
3609
+ /**
3610
+ * Sends all elements emitted by this stream to the specified sink in addition
3611
+ * to emitting them.
3612
+ *
3613
+ * @since 2.0.0
3614
+ * @category sequencing
3615
+ */
3616
+ export const tapSink: {
3617
+ <R2, E2, A>(sink: Sink.Sink<R2, E2, A, unknown, unknown>): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
3618
+ <R, E, R2, E2, A>(self: Stream<R, E, A>, sink: Sink.Sink<R2, E2, A, unknown, unknown>): Stream<R | R2, E | E2, A>
3619
+ } = internal.tapSink
3620
+
3621
+ /**
3622
+ * Delays the chunks of this stream according to the given bandwidth
3623
+ * parameters using the token bucket algorithm. Allows for burst in the
3624
+ * processing of elements by allowing the token bucket to accumulate tokens up
3625
+ * to a `units + burst` threshold. The weight of each chunk is determined by
3626
+ * the `costFn` function.
3627
+ *
3628
+ * If using the "enforce" strategy, chunks that do not meet the bandwidth
3629
+ * constraints are dropped. If using the "shape" strategy, chunks are delayed
3630
+ * until they can be emitted without exceeding the bandwidth constraints.
3631
+ *
3632
+ * Defaults to the "shape" strategy.
3633
+ *
3634
+ * @since 2.0.0
3635
+ * @category utils
3636
+ */
3637
+ export const throttle: {
3638
+ <A>(
3639
+ options: {
3640
+ readonly cost: (chunk: Chunk.Chunk<A>) => number
3641
+ readonly units: number
3642
+ readonly duration: Duration.DurationInput
3643
+ readonly burst?: number
3644
+ readonly strategy?: "enforce" | "shape"
3645
+ }
3646
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R, E, A>
3647
+ <R, E, A>(
3648
+ self: Stream<R, E, A>,
3649
+ options: {
3650
+ readonly cost: (chunk: Chunk.Chunk<A>) => number
3651
+ readonly units: number
3652
+ readonly duration: Duration.DurationInput
3653
+ readonly burst?: number
3654
+ readonly strategy?: "enforce" | "shape"
3655
+ }
3656
+ ): Stream<R, E, A>
3657
+ } = internal.throttle
3658
+
3659
+ /**
3660
+ * Delays the chunks of this stream according to the given bandwidth
3661
+ * parameters using the token bucket algorithm. Allows for burst in the
3662
+ * processing of elements by allowing the token bucket to accumulate tokens up
3663
+ * to a `units + burst` threshold. The weight of each chunk is determined by
3664
+ * the effectful `costFn` function.
3665
+ *
3666
+ * If using the "enforce" strategy, chunks that do not meet the bandwidth
3667
+ * constraints are dropped. If using the "shape" strategy, chunks are delayed
3668
+ * until they can be emitted without exceeding the bandwidth constraints.
3669
+ *
3670
+ * Defaults to the "shape" strategy.
3671
+ *
3672
+ * @since 2.0.0
3673
+ * @category utils
3674
+ */
3675
+ export const throttleEffect: {
3676
+ <A, R2, E2>(
3677
+ options: {
3678
+ readonly cost: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, number>
3679
+ readonly units: number
3680
+ readonly duration: Duration.DurationInput
3681
+ readonly burst?: number
3682
+ readonly strategy?: "enforce" | "shape"
3683
+ }
3684
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
3685
+ <R, E, A, R2, E2>(
3686
+ self: Stream<R, E, A>,
3687
+ options: {
3688
+ readonly cost: (chunk: Chunk.Chunk<A>) => Effect.Effect<R2, E2, number>
3689
+ readonly units: number
3690
+ readonly duration: Duration.DurationInput
3691
+ readonly burst?: number
3692
+ readonly strategy?: "enforce" | "shape"
3693
+ }
3694
+ ): Stream<R | R2, E | E2, A>
3695
+ } = internal.throttleEffect
3696
+
3697
+ /**
3698
+ * A stream that emits Unit values spaced by the specified duration.
3699
+ *
3700
+ * @since 2.0.0
3701
+ * @category constructors
3702
+ */
3703
+ export const tick: (interval: Duration.DurationInput) => Stream<never, never, void> = internal.tick
3704
+
3705
+ /**
3706
+ * Ends the stream if it does not produce a value after the specified duration.
3707
+ *
3708
+ * @since 2.0.0
3709
+ * @category utils
3710
+ */
3711
+ export const timeout: {
3712
+ (duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
3713
+ <R, E, A>(self: Stream<R, E, A>, duration: Duration.DurationInput): Stream<R, E, A>
3714
+ } = internal.timeout
3715
+
3716
+ /**
3717
+ * Fails the stream with given error if it does not produce a value after d
3718
+ * duration.
3719
+ *
3720
+ * @since 2.0.0
3721
+ * @category utils
3722
+ */
3723
+ export const timeoutFail: {
3724
+ <E2>(error: LazyArg<E2>, duration: Duration.DurationInput): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
3725
+ <R, E, A, E2>(self: Stream<R, E, A>, error: LazyArg<E2>, duration: Duration.DurationInput): Stream<R, E | E2, A>
3726
+ } = internal.timeoutFail
3727
+
3728
+ /**
3729
+ * Fails the stream with given cause if it does not produce a value after d
3730
+ * duration.
3731
+ *
3732
+ * @since 2.0.0
3733
+ * @category utils
3734
+ */
3735
+ export const timeoutFailCause: {
3736
+ <E2>(
3737
+ cause: LazyArg<Cause.Cause<E2>>,
3738
+ duration: Duration.DurationInput
3739
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E2 | E, A>
3740
+ <R, E, A, E2>(
3741
+ self: Stream<R, E, A>,
3742
+ cause: LazyArg<Cause.Cause<E2>>,
3743
+ duration: Duration.DurationInput
3744
+ ): Stream<R, E | E2, A>
3745
+ } = internal.timeoutFailCause
3746
+
3747
+ /**
3748
+ * Switches the stream if it does not produce a value after the specified
3749
+ * duration.
3750
+ *
3751
+ * @since 2.0.0
3752
+ * @category utils
3753
+ */
3754
+ export const timeoutTo: {
3755
+ <R2, E2, A2>(
3756
+ duration: Duration.DurationInput,
3757
+ that: Stream<R2, E2, A2>
3758
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2 | A>
3759
+ <R, E, A, R2, E2, A2>(
3760
+ self: Stream<R, E, A>,
3761
+ duration: Duration.DurationInput,
3762
+ that: Stream<R2, E2, A2>
3763
+ ): Stream<R | R2, E | E2, A | A2>
3764
+ } = internal.timeoutTo
3765
+
3766
+ /**
3767
+ * Converts the stream to a scoped `PubSub` of chunks. After the scope is closed,
3768
+ * the `PubSub` will never again produce values and should be discarded.
3769
+ *
3770
+ * @since 2.0.0
3771
+ * @category destructors
3772
+ */
3773
+ export const toPubSub: {
3774
+ (
3775
+ capacity: number
3776
+ ): <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R, never, PubSub.PubSub<Take.Take<E, A>>>
3777
+ <R, E, A>(
3778
+ self: Stream<R, E, A>,
3779
+ capacity: number
3780
+ ): Effect.Effect<Scope.Scope | R, never, PubSub.PubSub<Take.Take<E, A>>>
3781
+ } = internal.toPubSub
3782
+
3783
+ /**
3784
+ * Returns in a scope a ZIO effect that can be used to repeatedly pull chunks
3785
+ * from the stream. The pull effect fails with None when the stream is
3786
+ * finished, or with Some error if it fails, otherwise it returns a chunk of
3787
+ * the stream's output.
3788
+ *
3789
+ * @since 2.0.0
3790
+ * @category destructors
3791
+ */
3792
+ export const toPull: <R, E, A>(
3793
+ self: Stream<R, E, A>
3794
+ ) => Effect.Effect<Scope.Scope | R, never, Effect.Effect<R, Option.Option<E>, Chunk.Chunk<A>>> = internal.toPull
3795
+
3796
+ /**
3797
+ * Converts the stream to a scoped queue of chunks. After the scope is closed,
3798
+ * the queue will never again produce values and should be discarded.
3799
+ *
3800
+ * Defaults to the "suspend" back pressure strategy with a capacity of 2.
3801
+ *
3802
+ * @since 2.0.0
3803
+ * @category destructors
3804
+ */
3805
+ export const toQueue: {
3806
+ (
3807
+ options?: { readonly strategy?: "dropping" | "sliding" | "suspend"; readonly capacity?: number } | {
3808
+ readonly strategy: "unbounded"
3809
+ }
3810
+ ): <R, E, A>(self: Stream<R, E, A>) => Effect.Effect<Scope.Scope | R, never, Queue.Dequeue<Take.Take<E, A>>>
3811
+ <R, E, A>(
3812
+ self: Stream<R, E, A>,
3813
+ options?: { readonly strategy?: "dropping" | "sliding" | "suspend"; readonly capacity?: number } | {
3814
+ readonly strategy: "unbounded"
3815
+ }
3816
+ ): Effect.Effect<Scope.Scope | R, never, Queue.Dequeue<Take.Take<E, A>>>
3817
+ } = internal.toQueue
3818
+
3819
+ /**
3820
+ * Converts the stream to a scoped queue of elements. After the scope is
3821
+ * closed, the queue will never again produce values and should be discarded.
3822
+ *
3823
+ * Defaults to a capacity of 2.
3824
+ *
3825
+ * @since 2.0.0
3826
+ * @category destructors
3827
+ */
3828
+ export const toQueueOfElements: {
3829
+ (
3830
+ options?: { readonly capacity?: number }
3831
+ ): <R, E, A>(
3832
+ self: Stream<R, E, A>
3833
+ ) => Effect.Effect<Scope.Scope | R, never, Queue.Dequeue<Exit.Exit<Option.Option<E>, A>>>
3834
+ <R, E, A>(
3835
+ self: Stream<R, E, A>,
3836
+ options?: { readonly capacity?: number }
3837
+ ): Effect.Effect<Scope.Scope | R, never, Queue.Dequeue<Exit.Exit<Option.Option<E>, A>>>
3838
+ } = internal.toQueueOfElements
3839
+
3840
+ /**
3841
+ * Converts the stream to a `ReadableStream`.
3842
+ *
3843
+ * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
3844
+ *
3845
+ * @since 2.0.0
3846
+ * @category destructors
3847
+ */
3848
+ export const toReadableStream: <E, A>(source: Stream<never, E, A>) => ReadableStream<A> = internal.toReadableStream
3849
+
3850
+ /**
3851
+ * Applies the transducer to the stream and emits its outputs.
3852
+ *
3853
+ * @since 2.0.0
3854
+ * @category utils
3855
+ */
3856
+ export const transduce: {
3857
+ <R2, E2, A, Z>(sink: Sink.Sink<R2, E2, A, A, Z>): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, Z>
3858
+ <R, E, R2, E2, A, Z>(self: Stream<R, E, A>, sink: Sink.Sink<R2, E2, A, A, Z>): Stream<R | R2, E | E2, Z>
3859
+ } = internal.transduce
3860
+
3861
+ /**
3862
+ * Creates a stream by peeling off the "layers" of a value of type `S`.
3863
+ *
3864
+ * @since 2.0.0
3865
+ * @category constructors
3866
+ */
3867
+ export const unfold: <S, A>(s: S, f: (s: S) => Option.Option<readonly [A, S]>) => Stream<never, never, A> =
3868
+ internal.unfold
3869
+
3870
+ /**
3871
+ * Creates a stream by peeling off the "layers" of a value of type `S`.
3872
+ *
3873
+ * @since 2.0.0
3874
+ * @category constructors
3875
+ */
3876
+ export const unfoldChunk: <S, A>(
3877
+ s: S,
3878
+ f: (s: S) => Option.Option<readonly [Chunk.Chunk<A>, S]>
3879
+ ) => Stream<never, never, A> = internal.unfoldChunk
3880
+
3881
+ /**
3882
+ * Creates a stream by effectfully peeling off the "layers" of a value of type
3883
+ * `S`.
3884
+ *
3885
+ * @since 2.0.0
3886
+ * @category constructors
3887
+ */
3888
+ export const unfoldChunkEffect: <R, E, A, S>(
3889
+ s: S,
3890
+ f: (s: S) => Effect.Effect<R, E, Option.Option<readonly [Chunk.Chunk<A>, S]>>
3891
+ ) => Stream<R, E, A> = internal.unfoldChunkEffect
3892
+
3893
+ /**
3894
+ * Creates a stream by effectfully peeling off the "layers" of a value of type
3895
+ * `S`.
3896
+ *
3897
+ * @since 2.0.0
3898
+ * @category constructors
3899
+ */
3900
+ export const unfoldEffect: <S, R, E, A>(
3901
+ s: S,
3902
+ f: (s: S) => Effect.Effect<R, E, Option.Option<readonly [A, S]>>
3903
+ ) => Stream<R, E, A> = internal.unfoldEffect
3904
+
3905
+ /**
3906
+ * A stream that contains a single `Unit` value.
3907
+ *
3908
+ * @since 2.0.0
3909
+ * @category constructors
3910
+ */
3911
+ export const unit: Stream<never, never, void> = internal.unit
3912
+
3913
+ /**
3914
+ * Creates a stream produced from an `Effect`.
3915
+ *
3916
+ * @since 2.0.0
3917
+ * @category constructors
3918
+ */
3919
+ export const unwrap: <R, E, R2, E2, A>(effect: Effect.Effect<R, E, Stream<R2, E2, A>>) => Stream<R | R2, E | E2, A> =
3920
+ internal.unwrap
3921
+
3922
+ /**
3923
+ * Creates a stream produced from a scoped `Effect`.
3924
+ *
3925
+ * @since 2.0.0
3926
+ * @category constructors
3927
+ */
3928
+ export const unwrapScoped: <R, E, R2, E2, A>(
3929
+ effect: Effect.Effect<R, E, Stream<R2, E2, A>>
3930
+ ) => Stream<R2 | Exclude<R, Scope.Scope>, E | E2, A> = internal.unwrapScoped
3931
+
3932
+ /**
3933
+ * Updates the specified service within the context of the `Stream`.
3934
+ *
3935
+ * @since 2.0.0
3936
+ * @category context
3937
+ */
3938
+ export const updateService = internal.updateService
3939
+
3940
+ /**
3941
+ * Returns the specified stream if the given condition is satisfied, otherwise
3942
+ * returns an empty stream.
3943
+ *
3944
+ * @since 2.0.0
3945
+ * @category utils
3946
+ */
3947
+ export const when: {
3948
+ (predicate: LazyArg<boolean>): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
3949
+ <R, E, A>(self: Stream<R, E, A>, predicate: LazyArg<boolean>): Stream<R, E, A>
3950
+ } = internal.when
3951
+
3952
+ /**
3953
+ * Returns the resulting stream when the given `PartialFunction` is defined
3954
+ * for the given value, otherwise returns an empty stream.
3955
+ *
3956
+ * @since 2.0.0
3957
+ * @category constructors
3958
+ */
3959
+ export const whenCase: <A, R, E, A2>(
3960
+ evaluate: LazyArg<A>,
3961
+ pf: (a: A) => Option.Option<Stream<R, E, A2>>
3962
+ ) => Stream<R, E, A2> = internal.whenCase
3963
+
3964
+ /**
3965
+ * Returns the stream when the given partial function is defined for the given
3966
+ * effectful value, otherwise returns an empty stream.
3967
+ *
3968
+ * @since 2.0.0
3969
+ * @category utils
3970
+ */
3971
+ export const whenCaseEffect: {
3972
+ <A, R2, E2, A2>(
3973
+ pf: (a: A) => Option.Option<Stream<R2, E2, A2>>
3974
+ ): <R, E>(self: Effect.Effect<R, E, A>) => Stream<R2 | R, E2 | E, A2>
3975
+ <R, E, A, R2, E2, A2>(
3976
+ self: Effect.Effect<R, E, A>,
3977
+ pf: (a: A) => Option.Option<Stream<R2, E2, A2>>
3978
+ ): Stream<R | R2, E | E2, A2>
3979
+ } = internal.whenCaseEffect
3980
+
3981
+ /**
3982
+ * Returns the stream if the given effectful condition is satisfied, otherwise
3983
+ * returns an empty stream.
3984
+ *
3985
+ * @since 2.0.0
3986
+ * @category utils
3987
+ */
3988
+ export const whenEffect: {
3989
+ <R2, E2>(effect: Effect.Effect<R2, E2, boolean>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
3990
+ <R, E, A, R2, E2>(self: Stream<R, E, A>, effect: Effect.Effect<R2, E2, boolean>): Stream<R | R2, E | E2, A>
3991
+ } = internal.whenEffect
3992
+
3993
+ /**
3994
+ * Wraps the stream with a new span for tracing.
3995
+ *
3996
+ * @since 2.0.0
3997
+ * @category tracing
3998
+ */
3999
+ export const withSpan: {
4000
+ (
4001
+ name: string,
4002
+ options?: {
4003
+ readonly attributes?: Record<string, Tracer.AttributeValue>
4004
+ readonly links?: ReadonlyArray<Tracer.SpanLink>
4005
+ readonly parent?: Tracer.ParentSpan
4006
+ readonly root?: boolean
4007
+ readonly context?: Context.Context<never>
4008
+ }
4009
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
4010
+ <R, E, A>(
4011
+ self: Stream<R, E, A>,
4012
+ name: string,
4013
+ options?: {
4014
+ readonly attributes?: Record<string, Tracer.AttributeValue>
4015
+ readonly links?: ReadonlyArray<Tracer.SpanLink>
4016
+ readonly parent?: Tracer.ParentSpan
4017
+ readonly root?: boolean
4018
+ readonly context?: Context.Context<never>
4019
+ }
4020
+ ): Stream<R, E, A>
4021
+ } = internal.withSpan
4022
+
4023
+ /**
4024
+ * Zips this stream with another point-wise and emits tuples of elements from
4025
+ * both streams.
4026
+ *
4027
+ * The new stream will end when one of the sides ends.
4028
+ *
4029
+ * @since 2.0.0
4030
+ * @category zipping
4031
+ */
4032
+ export const zip: {
4033
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, readonly [A, A2]>
4034
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, readonly [A, A2]>
4035
+ } = internal.zip
4036
+
4037
+ /**
4038
+ * Zips this stream with another point-wise and emits tuples of elements from
4039
+ * both streams.
4040
+ *
4041
+ * The new stream will end when one of the sides ends.
4042
+ *
4043
+ * @since 2.0.0
4044
+ * @category zipping
4045
+ */
4046
+ export const zipFlatten: {
4047
+ <R2, E2, A2>(
4048
+ that: Stream<R2, E2, A2>
4049
+ ): <R, E, A extends ReadonlyArray<any>>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, readonly [...A, A2]>
4050
+ <R, E, A extends ReadonlyArray<any>, R2, E2, A2>(
4051
+ self: Stream<R, E, A>,
4052
+ that: Stream<R2, E2, A2>
4053
+ ): Stream<R | R2, E | E2, readonly [...A, A2]>
4054
+ } = internal.zipFlatten
4055
+
4056
+ /**
4057
+ * Zips this stream with another point-wise, creating a new stream of pairs of
4058
+ * elements from both sides.
4059
+ *
4060
+ * The defaults `defaultLeft` and `defaultRight` will be used if the streams
4061
+ * have different lengths and one of the streams has ended before the other.
4062
+ *
4063
+ * @since 2.0.0
4064
+ * @category zipping
4065
+ */
4066
+ export const zipAll: {
4067
+ <R2, E2, A2, A>(
4068
+ options: { readonly other: Stream<R2, E2, A2>; readonly defaultSelf: A; readonly defaultOther: A2 }
4069
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, readonly [A, A2]>
4070
+ <R, E, R2, E2, A2, A>(
4071
+ self: Stream<R, E, A>,
4072
+ options: { readonly other: Stream<R2, E2, A2>; readonly defaultSelf: A; readonly defaultOther: A2 }
4073
+ ): Stream<R | R2, E | E2, readonly [A, A2]>
4074
+ } = internal.zipAll
4075
+
4076
+ /**
4077
+ * Zips this stream with another point-wise, and keeps only elements from this
4078
+ * stream.
4079
+ *
4080
+ * The provided default value will be used if the other stream ends before
4081
+ * this one.
4082
+ *
4083
+ * @since 2.0.0
4084
+ * @category zipping
4085
+ */
4086
+ export const zipAllLeft: {
4087
+ <R2, E2, A2, A>(that: Stream<R2, E2, A2>, defaultLeft: A): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
4088
+ <R, E, R2, E2, A2, A>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>, defaultLeft: A): Stream<R | R2, E | E2, A>
4089
+ } = internal.zipAllLeft
4090
+
4091
+ /**
4092
+ * Zips this stream with another point-wise, and keeps only elements from the
4093
+ * other stream.
4094
+ *
4095
+ * The provided default value will be used if this stream ends before the
4096
+ * other one.
4097
+ *
4098
+ * @since 2.0.0
4099
+ * @category zipping
4100
+ */
4101
+ export const zipAllRight: {
4102
+ <R2, E2, A2>(
4103
+ that: Stream<R2, E2, A2>,
4104
+ defaultRight: A2
4105
+ ): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
4106
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>, defaultRight: A2): Stream<R | R2, E | E2, A2>
4107
+ } = internal.zipAllRight
4108
+
4109
+ /**
4110
+ * Zips this stream that is sorted by distinct keys and the specified stream
4111
+ * that is sorted by distinct keys to produce a new stream that is sorted by
4112
+ * distinct keys. Combines values associated with each key into a tuple,
4113
+ * using the specified values `defaultLeft` and `defaultRight` to fill in
4114
+ * missing values.
4115
+ *
4116
+ * This allows zipping potentially unbounded streams of data by key in
4117
+ * constant space but the caller is responsible for ensuring that the
4118
+ * streams are sorted by distinct keys.
4119
+ *
4120
+ * @since 2.0.0
4121
+ * @category zipping
4122
+ */
4123
+ export const zipAllSortedByKey: {
4124
+ <R2, E2, A2, A, K>(
4125
+ options: {
4126
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4127
+ readonly defaultSelf: A
4128
+ readonly defaultOther: A2
4129
+ readonly order: Order.Order<K>
4130
+ }
4131
+ ): <R, E>(self: Stream<R, E, readonly [K, A]>) => Stream<R2 | R, E2 | E, readonly [K, readonly [A, A2]]>
4132
+ <R, E, R2, E2, A2, A, K>(
4133
+ self: Stream<R, E, readonly [K, A]>,
4134
+ options: {
4135
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4136
+ readonly defaultSelf: A
4137
+ readonly defaultOther: A2
4138
+ readonly order: Order.Order<K>
4139
+ }
4140
+ ): Stream<R | R2, E | E2, readonly [K, readonly [A, A2]]>
4141
+ } = internal.zipAllSortedByKey
4142
+
4143
+ /**
4144
+ * Zips this stream that is sorted by distinct keys and the specified stream
4145
+ * that is sorted by distinct keys to produce a new stream that is sorted by
4146
+ * distinct keys. Keeps only values from this stream, using the specified
4147
+ * value `default` to fill in missing values.
4148
+ *
4149
+ * This allows zipping potentially unbounded streams of data by key in
4150
+ * constant space but the caller is responsible for ensuring that the
4151
+ * streams are sorted by distinct keys.
4152
+ *
4153
+ * @since 2.0.0
4154
+ * @category zipping
4155
+ */
4156
+ export const zipAllSortedByKeyLeft: {
4157
+ <R2, E2, A2, A, K>(
4158
+ options: {
4159
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4160
+ readonly defaultSelf: A
4161
+ readonly order: Order.Order<K>
4162
+ }
4163
+ ): <R, E>(self: Stream<R, E, readonly [K, A]>) => Stream<R2 | R, E2 | E, readonly [K, A]>
4164
+ <R, E, R2, E2, A2, A, K>(
4165
+ self: Stream<R, E, readonly [K, A]>,
4166
+ options: {
4167
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4168
+ readonly defaultSelf: A
4169
+ readonly order: Order.Order<K>
4170
+ }
4171
+ ): Stream<R | R2, E | E2, readonly [K, A]>
4172
+ } = internal.zipAllSortedByKeyLeft
4173
+
4174
+ /**
4175
+ * Zips this stream that is sorted by distinct keys and the specified stream
4176
+ * that is sorted by distinct keys to produce a new stream that is sorted by
4177
+ * distinct keys. Keeps only values from that stream, using the specified
4178
+ * value `default` to fill in missing values.
4179
+ *
4180
+ * This allows zipping potentially unbounded streams of data by key in
4181
+ * constant space but the caller is responsible for ensuring that the
4182
+ * streams are sorted by distinct keys.
4183
+ *
4184
+ * @since 2.0.0
4185
+ * @category zipping
4186
+ */
4187
+ export const zipAllSortedByKeyRight: {
4188
+ <R2, E2, A2, K>(
4189
+ options: {
4190
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4191
+ readonly defaultOther: A2
4192
+ readonly order: Order.Order<K>
4193
+ }
4194
+ ): <R, E, A>(self: Stream<R, E, readonly [K, A]>) => Stream<R2 | R, E2 | E, readonly [K, A2]>
4195
+ <R, E, A, R2, E2, A2, K>(
4196
+ self: Stream<R, E, readonly [K, A]>,
4197
+ options: {
4198
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4199
+ readonly defaultOther: A2
4200
+ readonly order: Order.Order<K>
4201
+ }
4202
+ ): Stream<R | R2, E | E2, readonly [K, A2]>
4203
+ } = internal.zipAllSortedByKeyRight
4204
+
4205
+ /**
4206
+ * Zips this stream that is sorted by distinct keys and the specified stream
4207
+ * that is sorted by distinct keys to produce a new stream that is sorted by
4208
+ * distinct keys. Uses the functions `left`, `right`, and `both` to handle
4209
+ * the cases where a key and value exist in this stream, that stream, or
4210
+ * both streams.
4211
+ *
4212
+ * This allows zipping potentially unbounded streams of data by key in
4213
+ * constant space but the caller is responsible for ensuring that the
4214
+ * streams are sorted by distinct keys.
4215
+ *
4216
+ * @since 2.0.0
4217
+ * @category zipping
4218
+ */
4219
+ export const zipAllSortedByKeyWith: {
4220
+ <R2, E2, A, A3, A2, K>(
4221
+ options: {
4222
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4223
+ readonly onSelf: (a: A) => A3
4224
+ readonly onOther: (a2: A2) => A3
4225
+ readonly onBoth: (a: A, a2: A2) => A3
4226
+ readonly order: Order.Order<K>
4227
+ }
4228
+ ): <R, E>(self: Stream<R, E, readonly [K, A]>) => Stream<R2 | R, E2 | E, readonly [K, A3]>
4229
+ <R, E, R2, E2, A, A3, A2, K>(
4230
+ self: Stream<R, E, readonly [K, A]>,
4231
+ options: {
4232
+ readonly other: Stream<R2, E2, readonly [K, A2]>
4233
+ readonly onSelf: (a: A) => A3
4234
+ readonly onOther: (a2: A2) => A3
4235
+ readonly onBoth: (a: A, a2: A2) => A3
4236
+ readonly order: Order.Order<K>
4237
+ }
4238
+ ): Stream<R | R2, E | E2, readonly [K, A3]>
4239
+ } = internal.zipAllSortedByKeyWith
4240
+
4241
+ /**
4242
+ * Zips this stream with another point-wise. The provided functions will be
4243
+ * used to create elements for the composed stream.
4244
+ *
4245
+ * The functions `left` and `right` will be used if the streams have different
4246
+ * lengths and one of the streams has ended before the other.
4247
+ *
4248
+ * @since 2.0.0
4249
+ * @category zipping
4250
+ */
4251
+ export const zipAllWith: {
4252
+ <R2, E2, A2, A, A3>(
4253
+ options: {
4254
+ readonly other: Stream<R2, E2, A2>
4255
+ readonly onSelf: (a: A) => A3
4256
+ readonly onOther: (a2: A2) => A3
4257
+ readonly onBoth: (a: A, a2: A2) => A3
4258
+ }
4259
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A3>
4260
+ <R, E, R2, E2, A2, A, A3>(
4261
+ self: Stream<R, E, A>,
4262
+ options: {
4263
+ readonly other: Stream<R2, E2, A2>
4264
+ readonly onSelf: (a: A) => A3
4265
+ readonly onOther: (a2: A2) => A3
4266
+ readonly onBoth: (a: A, a2: A2) => A3
4267
+ }
4268
+ ): Stream<R | R2, E | E2, A3>
4269
+ } = internal.zipAllWith
4270
+
4271
+ /**
4272
+ * Zips the two streams so that when a value is emitted by either of the two
4273
+ * streams, it is combined with the latest value from the other stream to
4274
+ * produce a result.
4275
+ *
4276
+ * Note: tracking the latest value is done on a per-chunk basis. That means
4277
+ * that emitted elements that are not the last value in chunks will never be
4278
+ * used for zipping.
4279
+ *
4280
+ * @since 2.0.0
4281
+ * @category zipping
4282
+ */
4283
+ export const zipLatest: {
4284
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, readonly [A, A2]>
4285
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, readonly [A, A2]>
4286
+ } = internal.zipLatest
4287
+
4288
+ /**
4289
+ * Zips the two streams so that when a value is emitted by either of the two
4290
+ * streams, it is combined with the latest value from the other stream to
4291
+ * produce a result.
4292
+ *
4293
+ * Note: tracking the latest value is done on a per-chunk basis. That means
4294
+ * that emitted elements that are not the last value in chunks will never be
4295
+ * used for zipping.
4296
+ *
4297
+ * @since 2.0.0
4298
+ * @category zipping
4299
+ */
4300
+ export const zipLatestWith: {
4301
+ <R2, E2, A2, A, A3>(
4302
+ that: Stream<R2, E2, A2>,
4303
+ f: (a: A, a2: A2) => A3
4304
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A3>
4305
+ <R, E, R2, E2, A2, A, A3>(
4306
+ self: Stream<R, E, A>,
4307
+ that: Stream<R2, E2, A2>,
4308
+ f: (a: A, a2: A2) => A3
4309
+ ): Stream<R | R2, E | E2, A3>
4310
+ } = internal.zipLatestWith
4311
+
4312
+ /**
4313
+ * Zips this stream with another point-wise, but keeps only the outputs of
4314
+ * this stream.
4315
+ *
4316
+ * The new stream will end when one of the sides ends.
4317
+ *
4318
+ * @since 2.0.0
4319
+ * @category zipping
4320
+ */
4321
+ export const zipLeft: {
4322
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A>
4323
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A>
4324
+ } = internal.zipLeft
4325
+
4326
+ /**
4327
+ * Zips this stream with another point-wise, but keeps only the outputs of the
4328
+ * other stream.
4329
+ *
4330
+ * The new stream will end when one of the sides ends.
4331
+ *
4332
+ * @since 2.0.0
4333
+ * @category zipping
4334
+ */
4335
+ export const zipRight: {
4336
+ <R2, E2, A2>(that: Stream<R2, E2, A2>): <R, E, A>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A2>
4337
+ <R, E, A, R2, E2, A2>(self: Stream<R, E, A>, that: Stream<R2, E2, A2>): Stream<R | R2, E | E2, A2>
4338
+ } = internal.zipRight
4339
+
4340
+ /**
4341
+ * Zips this stream with another point-wise and applies the function to the
4342
+ * paired elements.
4343
+ *
4344
+ * The new stream will end when one of the sides ends.
4345
+ *
4346
+ * @since 2.0.0
4347
+ * @category zipping
4348
+ */
4349
+ export const zipWith: {
4350
+ <R2, E2, A2, A, A3>(
4351
+ that: Stream<R2, E2, A2>,
4352
+ f: (a: A, a2: A2) => A3
4353
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A3>
4354
+ <R, E, R2, E2, A2, A, A3>(
4355
+ self: Stream<R, E, A>,
4356
+ that: Stream<R2, E2, A2>,
4357
+ f: (a: A, a2: A2) => A3
4358
+ ): Stream<R | R2, E | E2, A3>
4359
+ } = internal.zipWith
4360
+
4361
+ /**
4362
+ * Zips this stream with another point-wise and applies the function to the
4363
+ * paired elements.
4364
+ *
4365
+ * The new stream will end when one of the sides ends.
4366
+ *
4367
+ * @since 2.0.0
4368
+ * @category zipping
4369
+ */
4370
+ export const zipWithChunks: {
4371
+ <R2, E2, A2, A, A3>(
4372
+ that: Stream<R2, E2, A2>,
4373
+ f: (
4374
+ left: Chunk.Chunk<A>,
4375
+ right: Chunk.Chunk<A2>
4376
+ ) => readonly [Chunk.Chunk<A3>, Either.Either<Chunk.Chunk<A>, Chunk.Chunk<A2>>]
4377
+ ): <R, E>(self: Stream<R, E, A>) => Stream<R2 | R, E2 | E, A3>
4378
+ <R, E, R2, E2, A2, A, A3>(
4379
+ self: Stream<R, E, A>,
4380
+ that: Stream<R2, E2, A2>,
4381
+ f: (
4382
+ left: Chunk.Chunk<A>,
4383
+ right: Chunk.Chunk<A2>
4384
+ ) => readonly [Chunk.Chunk<A3>, Either.Either<Chunk.Chunk<A>, Chunk.Chunk<A2>>]
4385
+ ): Stream<R | R2, E | E2, A3>
4386
+ } = internal.zipWithChunks
4387
+
4388
+ /**
4389
+ * Zips each element with the next element if present.
4390
+ *
4391
+ * @since 2.0.0
4392
+ * @category zipping
4393
+ */
4394
+ export const zipWithNext: <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, readonly [A, Option.Option<A>]> =
4395
+ internal.zipWithNext
4396
+
4397
+ /**
4398
+ * Zips each element with the previous element. Initially accompanied by
4399
+ * `None`.
4400
+ *
4401
+ * @since 2.0.0
4402
+ * @category zipping
4403
+ */
4404
+ export const zipWithPrevious: <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, readonly [Option.Option<A>, A]> =
4405
+ internal.zipWithPrevious
4406
+
4407
+ /**
4408
+ * Zips each element with both the previous and next element.
4409
+ *
4410
+ * @since 2.0.0
4411
+ * @category zipping
4412
+ */
4413
+ export const zipWithPreviousAndNext: <R, E, A>(
4414
+ self: Stream<R, E, A>
4415
+ ) => Stream<R, E, readonly [Option.Option<A>, A, Option.Option<A>]> = internal.zipWithPreviousAndNext
4416
+
4417
+ /**
4418
+ * Zips this stream together with the index of elements.
4419
+ *
4420
+ * @since 2.0.0
4421
+ * @category zipping
4422
+ */
4423
+ export const zipWithIndex: <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, readonly [A, number]> =
4424
+ internal.zipWithIndex
4425
+
4426
+ // -------------------------------------------------------------------------------------
4427
+ // Do notation
4428
+ // -------------------------------------------------------------------------------------
4429
+
4430
+ /**
4431
+ * @since 2.0.0
4432
+ * @category do notation
4433
+ */
4434
+ export const Do: Stream<never, never, {}> = internal.Do
4435
+
4436
+ /**
4437
+ * Binds a value from a stream in a `do` scope
4438
+ *
4439
+ * @since 2.0.0
4440
+ * @category do notation
4441
+ */
4442
+ export const bind: {
4443
+ <N extends string, K, R2, E2, A>(
4444
+ tag: Exclude<N, keyof K>,
4445
+ f: (_: K) => Stream<R2, E2, A>,
4446
+ options?: {
4447
+ readonly concurrency?: number | "unbounded"
4448
+ readonly bufferSize?: number
4449
+ }
4450
+ ): <R, E>(self: Stream<R, E, K>) => Stream<R2 | R, E2 | E, Effect.MergeRecord<K, { [k in N]: A }>>
4451
+ <R, E, N extends string, K, R2, E2, A>(
4452
+ self: Stream<R, E, K>,
4453
+ tag: Exclude<N, keyof K>,
4454
+ f: (_: K) => Stream<R2, E2, A>,
4455
+ options?: {
4456
+ readonly concurrency?: number | "unbounded"
4457
+ readonly bufferSize?: number
4458
+ }
4459
+ ): Stream<R | R2, E | E2, Effect.MergeRecord<K, { [k in N]: A }>>
4460
+ } = internal.bind
4461
+
4462
+ /**
4463
+ * Binds an effectful value in a `do` scope
4464
+ *
4465
+ * @since 2.0.0
4466
+ * @category do notation
4467
+ */
4468
+ export const bindEffect: {
4469
+ <N extends string, K, R2, E2, A>(
4470
+ tag: Exclude<N, keyof K>,
4471
+ f: (_: K) => Effect.Effect<R2, E2, A>,
4472
+ options?: {
4473
+ readonly concurrency?: number | "unbounded"
4474
+ readonly bufferSize?: number
4475
+ }
4476
+ ): <R, E>(self: Stream<R, E, K>) => Stream<R2 | R, E2 | E, Effect.MergeRecord<K, { [k in N]: A }>>
4477
+ <R, E, N extends string, K, R2, E2, A>(
4478
+ self: Stream<R, E, K>,
4479
+ tag: Exclude<N, keyof K>,
4480
+ f: (_: K) => Effect.Effect<R2, E2, A>,
4481
+ options?: {
4482
+ readonly concurrency?: number | "unbounded"
4483
+ readonly bufferSize?: number
4484
+ }
4485
+ ): Stream<R | R2, E | E2, Effect.MergeRecord<K, { [k in N]: A }>>
4486
+ } = _groupBy.bindEffect
4487
+
4488
+ /**
4489
+ * @since 2.0.0
4490
+ * @category do notation
4491
+ */
4492
+ export const bindTo: {
4493
+ <N extends string>(tag: N): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, Record<N, A>>
4494
+ <R, E, A, N extends string>(self: Stream<R, E, A>, tag: N): Stream<R, E, Record<N, A>>
4495
+ } = internal.bindTo
4496
+
4497
+ const let_: {
4498
+ <N extends string, K, A>(
4499
+ tag: Exclude<N, keyof K>,
4500
+ f: (_: K) => A
4501
+ ): <R, E>(self: Stream<R, E, K>) => Stream<R, E, Effect.MergeRecord<K, { [k in N]: A }>>
4502
+ <R, E, K, N extends string, A>(
4503
+ self: Stream<R, E, K>,
4504
+ tag: Exclude<N, keyof K>,
4505
+ f: (_: K) => A
4506
+ ): Stream<R, E, Effect.MergeRecord<K, { [k in N]: A }>>
4507
+ } = internal.let_
4508
+
4509
+ export {
4510
+ /**
4511
+ * Bind a value in a `do` scope
4512
+ *
4513
+ * @since 2.0.0
4514
+ * @category do notation
4515
+ */
4516
+ let_ as let
4517
+ }
4518
+
4519
+ // -------------------------------------------------------------------------------------
4520
+ // encoding
4521
+ // -------------------------------------------------------------------------------------
4522
+
4523
+ /**
4524
+ * Decode Uint8Array chunks into a stream of strings using the specified encoding.
4525
+ *
4526
+ * @since 2.0.0
4527
+ * @category encoding
4528
+ */
4529
+ export const decodeText: {
4530
+ (encoding?: string): <R, E>(self: Stream<R, E, Uint8Array>) => Stream<R, E, string>
4531
+ <R, E>(self: Stream<R, E, Uint8Array>, encoding?: string): Stream<R, E, string>
4532
+ } = internal.decodeText
4533
+
4534
+ /**
4535
+ * Encode a stream of strings into a stream of Uint8Array chunks using the specified encoding.
4536
+ *
4537
+ * @since 2.0.0
4538
+ * @category encoding
4539
+ */
4540
+ export const encodeText: <R, E>(self: Stream<R, E, string>) => Stream<R, E, Uint8Array> = internal.encodeText