@typed/fx 2.0.0-beta.3 → 2.0.0-beta.5

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 (663) hide show
  1. package/README.md +34 -20
  2. package/dist/Fx/Fx.d.ts +364 -12
  3. package/dist/Fx/Fx.d.ts.map +1 -1
  4. package/dist/Fx/Fx.js +37 -6
  5. package/dist/Fx/TypeId.d.ts +49 -3
  6. package/dist/Fx/TypeId.d.ts.map +1 -1
  7. package/dist/Fx/TypeId.js +39 -2
  8. package/dist/Fx/combinators/additive.d.ts +156 -5
  9. package/dist/Fx/combinators/additive.d.ts.map +1 -1
  10. package/dist/Fx/combinators/additive.js +156 -5
  11. package/dist/Fx/combinators/catch.d.ts +195 -22
  12. package/dist/Fx/combinators/catch.d.ts.map +1 -1
  13. package/dist/Fx/combinators/catch.js +186 -16
  14. package/dist/Fx/combinators/causes.d.ts +24 -1
  15. package/dist/Fx/combinators/causes.d.ts.map +1 -1
  16. package/dist/Fx/combinators/causes.js +24 -1
  17. package/dist/Fx/combinators/changesWithEffect.d.ts +20 -0
  18. package/dist/Fx/combinators/changesWithEffect.d.ts.map +1 -1
  19. package/dist/Fx/combinators/changesWithEffect.js +20 -0
  20. package/dist/Fx/combinators/compact.d.ts +17 -0
  21. package/dist/Fx/combinators/compact.d.ts.map +1 -1
  22. package/dist/Fx/combinators/compact.js +17 -0
  23. package/dist/Fx/combinators/concatMap.d.ts +86 -0
  24. package/dist/Fx/combinators/concatMap.d.ts.map +1 -0
  25. package/dist/Fx/combinators/concatMap.js +86 -0
  26. package/dist/Fx/combinators/continueWith.d.ts +109 -1
  27. package/dist/Fx/combinators/continueWith.d.ts.map +1 -1
  28. package/dist/Fx/combinators/continueWith.js +109 -1
  29. package/dist/Fx/combinators/debounce.d.ts +34 -0
  30. package/dist/Fx/combinators/debounce.d.ts.map +1 -0
  31. package/dist/Fx/combinators/debounce.js +35 -0
  32. package/dist/Fx/combinators/delay.d.ts +34 -0
  33. package/dist/Fx/combinators/delay.d.ts.map +1 -0
  34. package/dist/Fx/combinators/delay.js +31 -0
  35. package/dist/Fx/combinators/dropUntil.d.ts +42 -0
  36. package/dist/Fx/combinators/dropUntil.d.ts.map +1 -1
  37. package/dist/Fx/combinators/dropUntil.js +42 -0
  38. package/dist/Fx/combinators/during.d.ts +38 -0
  39. package/dist/Fx/combinators/during.d.ts.map +1 -0
  40. package/dist/Fx/combinators/during.js +85 -0
  41. package/dist/Fx/combinators/ensuring.d.ts +33 -3
  42. package/dist/Fx/combinators/ensuring.d.ts.map +1 -1
  43. package/dist/Fx/combinators/ensuring.js +33 -3
  44. package/dist/Fx/combinators/exhaustLatestMap.d.ts +40 -4
  45. package/dist/Fx/combinators/exhaustLatestMap.d.ts.map +1 -1
  46. package/dist/Fx/combinators/exhaustLatestMap.js +40 -4
  47. package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts +39 -3
  48. package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts.map +1 -1
  49. package/dist/Fx/combinators/exhaustLatestMapEffect.js +39 -3
  50. package/dist/Fx/combinators/exhaustMap.d.ts +37 -0
  51. package/dist/Fx/combinators/exhaustMap.d.ts.map +1 -1
  52. package/dist/Fx/combinators/exhaustMap.js +37 -0
  53. package/dist/Fx/combinators/exhaustMapEffect.d.ts +32 -0
  54. package/dist/Fx/combinators/exhaustMapEffect.d.ts.map +1 -1
  55. package/dist/Fx/combinators/exhaustMapEffect.js +32 -0
  56. package/dist/Fx/combinators/exit.d.ts +22 -1
  57. package/dist/Fx/combinators/exit.d.ts.map +1 -1
  58. package/dist/Fx/combinators/exit.js +22 -1
  59. package/dist/Fx/combinators/filter.d.ts +16 -0
  60. package/dist/Fx/combinators/filter.d.ts.map +1 -1
  61. package/dist/Fx/combinators/filter.js +16 -0
  62. package/dist/Fx/combinators/filterEffect.d.ts +21 -0
  63. package/dist/Fx/combinators/filterEffect.d.ts.map +1 -1
  64. package/dist/Fx/combinators/filterEffect.js +21 -0
  65. package/dist/Fx/combinators/filterMap.d.ts +19 -0
  66. package/dist/Fx/combinators/filterMap.d.ts.map +1 -1
  67. package/dist/Fx/combinators/filterMap.js +19 -0
  68. package/dist/Fx/combinators/filterMapEffect.d.ts +20 -0
  69. package/dist/Fx/combinators/filterMapEffect.d.ts.map +1 -1
  70. package/dist/Fx/combinators/filterMapEffect.js +20 -0
  71. package/dist/Fx/combinators/filterMapLoop.d.ts +19 -0
  72. package/dist/Fx/combinators/filterMapLoop.d.ts.map +1 -1
  73. package/dist/Fx/combinators/filterMapLoop.js +19 -0
  74. package/dist/Fx/combinators/filterMapLoopCause.d.ts +20 -0
  75. package/dist/Fx/combinators/filterMapLoopCause.d.ts.map +1 -1
  76. package/dist/Fx/combinators/filterMapLoopCause.js +20 -0
  77. package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts +20 -0
  78. package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts.map +1 -1
  79. package/dist/Fx/combinators/filterMapLoopCauseEffect.js +20 -0
  80. package/dist/Fx/combinators/filterMapLoopEffect.d.ts +20 -0
  81. package/dist/Fx/combinators/filterMapLoopEffect.d.ts.map +1 -1
  82. package/dist/Fx/combinators/filterMapLoopEffect.js +20 -0
  83. package/dist/Fx/combinators/flatMap.d.ts +48 -3
  84. package/dist/Fx/combinators/flatMap.d.ts.map +1 -1
  85. package/dist/Fx/combinators/flatMap.js +35 -2
  86. package/dist/Fx/combinators/flatMapConcurrently.d.ts +50 -3
  87. package/dist/Fx/combinators/flatMapConcurrently.d.ts.map +1 -1
  88. package/dist/Fx/combinators/flatMapConcurrently.js +47 -1
  89. package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts +47 -3
  90. package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts.map +1 -1
  91. package/dist/Fx/combinators/flatMapConcurrentlyEffect.js +39 -1
  92. package/dist/Fx/combinators/flatMapEffect.d.ts +44 -2
  93. package/dist/Fx/combinators/flatMapEffect.d.ts.map +1 -1
  94. package/dist/Fx/combinators/flatMapEffect.js +31 -1
  95. package/dist/Fx/combinators/flip.d.ts +33 -1
  96. package/dist/Fx/combinators/flip.d.ts.map +1 -1
  97. package/dist/Fx/combinators/flip.js +33 -1
  98. package/dist/Fx/combinators/gen.d.ts +28 -9
  99. package/dist/Fx/combinators/gen.d.ts.map +1 -1
  100. package/dist/Fx/combinators/gen.js +27 -3
  101. package/dist/Fx/combinators/genScoped.d.ts +32 -9
  102. package/dist/Fx/combinators/genScoped.d.ts.map +1 -1
  103. package/dist/Fx/combinators/genScoped.js +30 -2
  104. package/dist/Fx/combinators/grouped.d.ts +89 -0
  105. package/dist/Fx/combinators/grouped.d.ts.map +1 -0
  106. package/dist/Fx/combinators/grouped.js +146 -0
  107. package/dist/Fx/combinators/index.d.ts +35 -0
  108. package/dist/Fx/combinators/index.d.ts.map +1 -1
  109. package/dist/Fx/combinators/index.js +35 -0
  110. package/dist/Fx/combinators/keyed.d.ts +121 -7
  111. package/dist/Fx/combinators/keyed.d.ts.map +1 -1
  112. package/dist/Fx/combinators/keyed.js +68 -10
  113. package/dist/Fx/combinators/loop.d.ts +16 -0
  114. package/dist/Fx/combinators/loop.d.ts.map +1 -1
  115. package/dist/Fx/combinators/loop.js +16 -0
  116. package/dist/Fx/combinators/loopCause.d.ts +17 -0
  117. package/dist/Fx/combinators/loopCause.d.ts.map +1 -1
  118. package/dist/Fx/combinators/loopCause.js +17 -0
  119. package/dist/Fx/combinators/loopCauseEffect.d.ts +18 -0
  120. package/dist/Fx/combinators/loopCauseEffect.d.ts.map +1 -1
  121. package/dist/Fx/combinators/loopCauseEffect.js +18 -0
  122. package/dist/Fx/combinators/loopEffect.d.ts +23 -0
  123. package/dist/Fx/combinators/loopEffect.d.ts.map +1 -1
  124. package/dist/Fx/combinators/loopEffect.js +23 -0
  125. package/dist/Fx/combinators/map.d.ts +45 -0
  126. package/dist/Fx/combinators/map.d.ts.map +1 -1
  127. package/dist/Fx/combinators/map.js +42 -0
  128. package/dist/Fx/combinators/mapBoth.d.ts +19 -0
  129. package/dist/Fx/combinators/mapBoth.d.ts.map +1 -1
  130. package/dist/Fx/combinators/mapBoth.js +19 -0
  131. package/dist/Fx/combinators/mapEffect.d.ts +24 -0
  132. package/dist/Fx/combinators/mapEffect.d.ts.map +1 -1
  133. package/dist/Fx/combinators/mapEffect.js +24 -0
  134. package/dist/Fx/combinators/mapError.d.ts +20 -4
  135. package/dist/Fx/combinators/mapError.d.ts.map +1 -1
  136. package/dist/Fx/combinators/mapError.js +20 -4
  137. package/dist/Fx/combinators/mergeAll.d.ts +34 -0
  138. package/dist/Fx/combinators/mergeAll.d.ts.map +1 -1
  139. package/dist/Fx/combinators/mergeAll.js +34 -0
  140. package/dist/Fx/combinators/mergeOrdered.d.ts +35 -3
  141. package/dist/Fx/combinators/mergeOrdered.d.ts.map +1 -1
  142. package/dist/Fx/combinators/mergeOrdered.js +35 -3
  143. package/dist/Fx/combinators/onError.d.ts +33 -3
  144. package/dist/Fx/combinators/onError.d.ts.map +1 -1
  145. package/dist/Fx/combinators/onError.js +33 -3
  146. package/dist/Fx/combinators/onExit.d.ts +28 -2
  147. package/dist/Fx/combinators/onExit.d.ts.map +1 -1
  148. package/dist/Fx/combinators/onExit.js +28 -2
  149. package/dist/Fx/combinators/onInterrupt.d.ts +48 -3
  150. package/dist/Fx/combinators/onInterrupt.d.ts.map +1 -1
  151. package/dist/Fx/combinators/onInterrupt.js +48 -3
  152. package/dist/Fx/combinators/pairwise.d.ts +28 -0
  153. package/dist/Fx/combinators/pairwise.d.ts.map +1 -0
  154. package/dist/Fx/combinators/pairwise.js +31 -0
  155. package/dist/Fx/combinators/provide.d.ts +138 -17
  156. package/dist/Fx/combinators/provide.d.ts.map +1 -1
  157. package/dist/Fx/combinators/provide.js +134 -13
  158. package/dist/Fx/combinators/race.d.ts +92 -0
  159. package/dist/Fx/combinators/race.d.ts.map +1 -0
  160. package/dist/Fx/combinators/race.js +149 -0
  161. package/dist/Fx/combinators/repeat.d.ts +41 -0
  162. package/dist/Fx/combinators/repeat.d.ts.map +1 -0
  163. package/dist/Fx/combinators/repeat.js +57 -0
  164. package/dist/Fx/combinators/result.d.ts +22 -0
  165. package/dist/Fx/combinators/result.d.ts.map +1 -1
  166. package/dist/Fx/combinators/result.js +26 -12
  167. package/dist/Fx/combinators/retry.d.ts +53 -0
  168. package/dist/Fx/combinators/retry.d.ts.map +1 -0
  169. package/dist/Fx/combinators/retry.js +71 -0
  170. package/dist/Fx/combinators/sample.d.ts +31 -0
  171. package/dist/Fx/combinators/sample.d.ts.map +1 -0
  172. package/dist/Fx/combinators/sample.js +42 -0
  173. package/dist/Fx/combinators/scan.d.ts +39 -0
  174. package/dist/Fx/combinators/scan.d.ts.map +1 -1
  175. package/dist/Fx/combinators/scan.js +41 -2
  176. package/dist/Fx/combinators/since.d.ts +30 -0
  177. package/dist/Fx/combinators/since.d.ts.map +1 -0
  178. package/dist/Fx/combinators/since.js +39 -0
  179. package/dist/Fx/combinators/skip.d.ts +31 -0
  180. package/dist/Fx/combinators/skip.d.ts.map +1 -1
  181. package/dist/Fx/combinators/skip.js +31 -0
  182. package/dist/Fx/combinators/skipRepeats.d.ts +16 -0
  183. package/dist/Fx/combinators/skipRepeats.d.ts.map +1 -1
  184. package/dist/Fx/combinators/skipRepeats.js +16 -0
  185. package/dist/Fx/combinators/skipRepeatsWith.d.ts +17 -0
  186. package/dist/Fx/combinators/skipRepeatsWith.d.ts.map +1 -1
  187. package/dist/Fx/combinators/skipRepeatsWith.js +17 -0
  188. package/dist/Fx/combinators/skipWhile.d.ts +68 -0
  189. package/dist/Fx/combinators/skipWhile.d.ts.map +1 -1
  190. package/dist/Fx/combinators/skipWhile.js +68 -0
  191. package/dist/Fx/combinators/slice.d.ts +82 -0
  192. package/dist/Fx/combinators/slice.d.ts.map +1 -1
  193. package/dist/Fx/combinators/slice.js +33 -0
  194. package/dist/Fx/combinators/switchMap.d.ts +38 -0
  195. package/dist/Fx/combinators/switchMap.d.ts.map +1 -1
  196. package/dist/Fx/combinators/switchMap.js +42 -4
  197. package/dist/Fx/combinators/switchMapEffect.d.ts +37 -0
  198. package/dist/Fx/combinators/switchMapEffect.d.ts.map +1 -1
  199. package/dist/Fx/combinators/switchMapEffect.js +37 -0
  200. package/dist/Fx/combinators/take.d.ts +32 -0
  201. package/dist/Fx/combinators/take.d.ts.map +1 -1
  202. package/dist/Fx/combinators/take.js +32 -0
  203. package/dist/Fx/combinators/takeUntil.d.ts +46 -0
  204. package/dist/Fx/combinators/takeUntil.d.ts.map +1 -1
  205. package/dist/Fx/combinators/takeUntil.js +46 -0
  206. package/dist/Fx/combinators/takeWhile.d.ts +31 -0
  207. package/dist/Fx/combinators/takeWhile.d.ts.map +1 -1
  208. package/dist/Fx/combinators/takeWhile.js +31 -0
  209. package/dist/Fx/combinators/tapEffect.d.ts +16 -0
  210. package/dist/Fx/combinators/tapEffect.d.ts.map +1 -1
  211. package/dist/Fx/combinators/tapEffect.js +16 -0
  212. package/dist/Fx/combinators/throttle.d.ts +79 -0
  213. package/dist/Fx/combinators/throttle.d.ts.map +1 -0
  214. package/dist/Fx/combinators/throttle.js +99 -0
  215. package/dist/Fx/combinators/timeout.d.ts +76 -0
  216. package/dist/Fx/combinators/timeout.d.ts.map +1 -0
  217. package/dist/Fx/combinators/timeout.js +110 -0
  218. package/dist/Fx/combinators/tuple.d.ts +30 -0
  219. package/dist/Fx/combinators/tuple.d.ts.map +1 -1
  220. package/dist/Fx/combinators/tuple.js +34 -3
  221. package/dist/Fx/combinators/until.d.ts +27 -0
  222. package/dist/Fx/combinators/until.d.ts.map +1 -0
  223. package/dist/Fx/combinators/until.js +56 -0
  224. package/dist/Fx/combinators/unwrap.d.ts +29 -0
  225. package/dist/Fx/combinators/unwrap.d.ts.map +1 -1
  226. package/dist/Fx/combinators/unwrap.js +29 -0
  227. package/dist/Fx/combinators/unwrapScoped.d.ts +33 -0
  228. package/dist/Fx/combinators/unwrapScoped.d.ts.map +1 -1
  229. package/dist/Fx/combinators/unwrapScoped.js +33 -0
  230. package/dist/Fx/combinators/when.d.ts +35 -0
  231. package/dist/Fx/combinators/when.d.ts.map +1 -1
  232. package/dist/Fx/combinators/when.js +36 -1
  233. package/dist/Fx/combinators/withLatestFrom.d.ts +58 -0
  234. package/dist/Fx/combinators/withLatestFrom.d.ts.map +1 -0
  235. package/dist/Fx/combinators/withLatestFrom.js +68 -0
  236. package/dist/Fx/combinators/withSpan.d.ts +35 -1
  237. package/dist/Fx/combinators/withSpan.d.ts.map +1 -1
  238. package/dist/Fx/combinators/withSpan.js +34 -3
  239. package/dist/Fx/combinators/zip.d.ts +60 -0
  240. package/dist/Fx/combinators/zip.d.ts.map +1 -1
  241. package/dist/Fx/combinators/zip.js +60 -0
  242. package/dist/Fx/constructors/at.d.ts +20 -0
  243. package/dist/Fx/constructors/at.d.ts.map +1 -1
  244. package/dist/Fx/constructors/at.js +20 -0
  245. package/dist/Fx/constructors/die.d.ts +21 -0
  246. package/dist/Fx/constructors/die.d.ts.map +1 -1
  247. package/dist/Fx/constructors/die.js +21 -0
  248. package/dist/Fx/constructors/empty.d.ts +18 -0
  249. package/dist/Fx/constructors/empty.d.ts.map +1 -1
  250. package/dist/Fx/constructors/empty.js +18 -0
  251. package/dist/Fx/constructors/fail.d.ts +21 -0
  252. package/dist/Fx/constructors/fail.d.ts.map +1 -1
  253. package/dist/Fx/constructors/fail.js +21 -0
  254. package/dist/Fx/constructors/failCause.d.ts +22 -0
  255. package/dist/Fx/constructors/failCause.d.ts.map +1 -1
  256. package/dist/Fx/constructors/failCause.js +22 -0
  257. package/dist/Fx/constructors/fn.d.ts +113 -13
  258. package/dist/Fx/constructors/fn.d.ts.map +1 -1
  259. package/dist/Fx/constructors/fn.js +36 -0
  260. package/dist/Fx/constructors/fromEffect.d.ts +43 -1
  261. package/dist/Fx/constructors/fromEffect.d.ts.map +1 -1
  262. package/dist/Fx/constructors/fromEffect.js +43 -1
  263. package/dist/Fx/constructors/fromFailures.d.ts +24 -0
  264. package/dist/Fx/constructors/fromFailures.d.ts.map +1 -1
  265. package/dist/Fx/constructors/fromFailures.js +24 -0
  266. package/dist/Fx/constructors/fromIterable.d.ts +22 -0
  267. package/dist/Fx/constructors/fromIterable.d.ts.map +1 -1
  268. package/dist/Fx/constructors/fromIterable.js +22 -0
  269. package/dist/Fx/constructors/fromSchedule.d.ts +23 -0
  270. package/dist/Fx/constructors/fromSchedule.d.ts.map +1 -1
  271. package/dist/Fx/constructors/fromSchedule.js +25 -2
  272. package/dist/Fx/constructors/index.d.ts +2 -1
  273. package/dist/Fx/constructors/index.d.ts.map +1 -1
  274. package/dist/Fx/constructors/index.js +2 -1
  275. package/dist/Fx/constructors/interrupt.d.ts +21 -1
  276. package/dist/Fx/constructors/interrupt.d.ts.map +1 -1
  277. package/dist/Fx/constructors/interrupt.js +21 -1
  278. package/dist/Fx/constructors/make.d.ts +146 -1
  279. package/dist/Fx/constructors/make.d.ts.map +1 -1
  280. package/dist/Fx/constructors/make.js +56 -5
  281. package/dist/Fx/constructors/periodic.d.ts +29 -0
  282. package/dist/Fx/constructors/periodic.d.ts.map +1 -1
  283. package/dist/Fx/constructors/periodic.js +29 -0
  284. package/dist/Fx/constructors/succeed.d.ts +75 -3
  285. package/dist/Fx/constructors/succeed.d.ts.map +1 -1
  286. package/dist/Fx/constructors/succeed.js +75 -3
  287. package/dist/Fx/constructors/suspend.d.ts +28 -0
  288. package/dist/Fx/constructors/suspend.d.ts.map +1 -1
  289. package/dist/Fx/constructors/suspend.js +28 -0
  290. package/dist/Fx/constructors/sync.d.ts +32 -0
  291. package/dist/Fx/constructors/sync.d.ts.map +1 -0
  292. package/dist/Fx/constructors/sync.js +32 -0
  293. package/dist/Fx/internal/DeferredRef.d.ts +259 -7
  294. package/dist/Fx/internal/DeferredRef.d.ts.map +1 -1
  295. package/dist/Fx/internal/DeferredRef.js +260 -9
  296. package/dist/Fx/internal/UnionToTuple.d.ts +22 -0
  297. package/dist/Fx/internal/UnionToTuple.d.ts.map +1 -1
  298. package/dist/Fx/internal/diff.d.ts +586 -0
  299. package/dist/Fx/internal/diff.d.ts.map +1 -1
  300. package/dist/Fx/internal/diff.js +120 -9
  301. package/dist/Fx/internal/effectableEvaluateKey.d.ts +30 -0
  302. package/dist/Fx/internal/effectableEvaluateKey.d.ts.map +1 -0
  303. package/dist/Fx/internal/effectableEvaluateKey.js +29 -0
  304. package/dist/Fx/internal/effectableWithOverride.d.ts +55 -0
  305. package/dist/Fx/internal/effectableWithOverride.d.ts.map +1 -0
  306. package/dist/Fx/internal/effectableWithOverride.js +46 -0
  307. package/dist/Fx/internal/equivalence.d.ts +29 -0
  308. package/dist/Fx/internal/equivalence.d.ts.map +1 -1
  309. package/dist/Fx/internal/equivalence.js +29 -0
  310. package/dist/Fx/internal/multicast.d.ts +145 -2
  311. package/dist/Fx/internal/multicast.d.ts.map +1 -1
  312. package/dist/Fx/internal/multicast.js +146 -4
  313. package/dist/Fx/internal/ring-buffer.d.ts +149 -0
  314. package/dist/Fx/internal/ring-buffer.d.ts.map +1 -1
  315. package/dist/Fx/internal/ring-buffer.js +155 -0
  316. package/dist/Fx/internal/scope.d.ts +184 -0
  317. package/dist/Fx/internal/scope.d.ts.map +1 -1
  318. package/dist/Fx/internal/scope.js +150 -0
  319. package/dist/Fx/internal/yieldable.d.ts +117 -2
  320. package/dist/Fx/internal/yieldable.d.ts.map +1 -1
  321. package/dist/Fx/internal/yieldable.js +86 -3
  322. package/dist/Fx/run/collect.d.ts +89 -0
  323. package/dist/Fx/run/collect.d.ts.map +1 -1
  324. package/dist/Fx/run/collect.js +90 -1
  325. package/dist/Fx/run/first.d.ts +22 -0
  326. package/dist/Fx/run/first.d.ts.map +1 -1
  327. package/dist/Fx/run/first.js +22 -0
  328. package/dist/Fx/run/fork.d.ts +50 -0
  329. package/dist/Fx/run/fork.d.ts.map +1 -1
  330. package/dist/Fx/run/fork.js +50 -0
  331. package/dist/Fx/run/observe.d.ts +106 -0
  332. package/dist/Fx/run/observe.d.ts.map +1 -1
  333. package/dist/Fx/run/observe.js +108 -2
  334. package/dist/Fx/run/runPromise.d.ts +43 -0
  335. package/dist/Fx/run/runPromise.d.ts.map +1 -1
  336. package/dist/Fx/run/runPromise.js +43 -0
  337. package/dist/Fx/stream.d.ts +92 -0
  338. package/dist/Fx/stream.d.ts.map +1 -1
  339. package/dist/Fx/stream.js +60 -1
  340. package/dist/Push/Push.d.ts +1219 -94
  341. package/dist/Push/Push.d.ts.map +1 -1
  342. package/dist/Push/Push.js +1015 -86
  343. package/dist/RefArray.d.ts +2 -0
  344. package/dist/RefArray.d.ts.map +1 -0
  345. package/dist/RefArray.js +1 -0
  346. package/dist/RefBigDecimal.d.ts +2 -0
  347. package/dist/RefBigDecimal.d.ts.map +1 -0
  348. package/dist/RefBigDecimal.js +1 -0
  349. package/dist/RefBigInt.d.ts +2 -0
  350. package/dist/RefBigInt.d.ts.map +1 -0
  351. package/dist/RefBigInt.js +1 -0
  352. package/dist/RefBoolean.d.ts +2 -0
  353. package/dist/RefBoolean.d.ts.map +1 -0
  354. package/dist/RefBoolean.js +1 -0
  355. package/dist/RefCause.d.ts +2 -0
  356. package/dist/RefCause.d.ts.map +1 -0
  357. package/dist/RefCause.js +1 -0
  358. package/dist/RefChunk.d.ts +2 -0
  359. package/dist/RefChunk.d.ts.map +1 -0
  360. package/dist/RefChunk.js +1 -0
  361. package/dist/RefDateTime.d.ts +2 -0
  362. package/dist/RefDateTime.d.ts.map +1 -0
  363. package/dist/RefDateTime.js +1 -0
  364. package/dist/RefDuration.d.ts +2 -0
  365. package/dist/RefDuration.d.ts.map +1 -0
  366. package/dist/RefDuration.js +1 -0
  367. package/dist/RefGraph.d.ts +2 -0
  368. package/dist/RefGraph.d.ts.map +1 -0
  369. package/dist/RefGraph.js +1 -0
  370. package/dist/RefHashMap.d.ts +2 -0
  371. package/dist/RefHashMap.d.ts.map +1 -0
  372. package/dist/RefHashMap.js +1 -0
  373. package/dist/RefHashRing.d.ts +2 -0
  374. package/dist/RefHashRing.d.ts.map +1 -0
  375. package/dist/RefHashRing.js +1 -0
  376. package/dist/RefHashSet.d.ts +2 -0
  377. package/dist/RefHashSet.d.ts.map +1 -0
  378. package/dist/RefHashSet.js +1 -0
  379. package/dist/RefIterable.d.ts +2 -0
  380. package/dist/RefIterable.d.ts.map +1 -0
  381. package/dist/RefIterable.js +1 -0
  382. package/dist/RefOption.d.ts +2 -0
  383. package/dist/RefOption.d.ts.map +1 -0
  384. package/dist/RefOption.js +1 -0
  385. package/dist/RefRecord.d.ts +2 -0
  386. package/dist/RefRecord.d.ts.map +1 -0
  387. package/dist/RefRecord.js +1 -0
  388. package/dist/RefResult.d.ts +2 -0
  389. package/dist/RefResult.d.ts.map +1 -0
  390. package/dist/RefResult.js +1 -0
  391. package/dist/RefString.d.ts +2 -0
  392. package/dist/RefString.d.ts.map +1 -0
  393. package/dist/RefString.js +1 -0
  394. package/dist/RefStruct.d.ts +2 -0
  395. package/dist/RefStruct.d.ts.map +1 -0
  396. package/dist/RefStruct.js +1 -0
  397. package/dist/RefSubject/Hydration.d.ts +504 -0
  398. package/dist/RefSubject/Hydration.d.ts.map +1 -0
  399. package/dist/RefSubject/Hydration.js +300 -0
  400. package/dist/RefSubject/RefArray.d.ts +351 -4
  401. package/dist/RefSubject/RefArray.d.ts.map +1 -1
  402. package/dist/RefSubject/RefArray.js +339 -3
  403. package/dist/RefSubject/RefBigDecimal.d.ts +221 -1
  404. package/dist/RefSubject/RefBigDecimal.d.ts.map +1 -1
  405. package/dist/RefSubject/RefBigDecimal.js +210 -1
  406. package/dist/RefSubject/RefBigInt.d.ts +166 -1
  407. package/dist/RefSubject/RefBigInt.d.ts.map +1 -1
  408. package/dist/RefSubject/RefBigInt.js +155 -1
  409. package/dist/RefSubject/RefBoolean.d.ts +166 -1
  410. package/dist/RefSubject/RefBoolean.d.ts.map +1 -1
  411. package/dist/RefSubject/RefBoolean.js +155 -1
  412. package/dist/RefSubject/RefCause.d.ts +122 -1
  413. package/dist/RefSubject/RefCause.d.ts.map +1 -1
  414. package/dist/RefSubject/RefCause.js +111 -1
  415. package/dist/RefSubject/RefChunk.d.ts +406 -1
  416. package/dist/RefSubject/RefChunk.d.ts.map +1 -1
  417. package/dist/RefSubject/RefChunk.js +394 -0
  418. package/dist/RefSubject/RefDateTime.d.ts +122 -1
  419. package/dist/RefSubject/RefDateTime.d.ts.map +1 -1
  420. package/dist/RefSubject/RefDateTime.js +111 -1
  421. package/dist/RefSubject/RefDuration.d.ts +155 -1
  422. package/dist/RefSubject/RefDuration.d.ts.map +1 -1
  423. package/dist/RefSubject/RefDuration.js +144 -1
  424. package/dist/RefSubject/RefGraph.d.ts +320 -6
  425. package/dist/RefSubject/RefGraph.d.ts.map +1 -1
  426. package/dist/RefSubject/RefGraph.js +303 -0
  427. package/dist/RefSubject/RefHashMap.d.ts +296 -1
  428. package/dist/RefSubject/RefHashMap.d.ts.map +1 -1
  429. package/dist/RefSubject/RefHashMap.js +284 -0
  430. package/dist/RefSubject/RefHashRing.d.ts +146 -2
  431. package/dist/RefSubject/RefHashRing.d.ts.map +1 -1
  432. package/dist/RefSubject/RefHashRing.js +133 -0
  433. package/dist/RefSubject/RefHashSet.d.ts +230 -1
  434. package/dist/RefSubject/RefHashSet.d.ts.map +1 -1
  435. package/dist/RefSubject/RefHashSet.js +218 -0
  436. package/dist/RefSubject/RefIterable.d.ts +327 -1
  437. package/dist/RefSubject/RefIterable.d.ts.map +1 -1
  438. package/dist/RefSubject/RefIterable.js +315 -0
  439. package/dist/RefSubject/RefOption.d.ts +144 -1
  440. package/dist/RefSubject/RefOption.d.ts.map +1 -1
  441. package/dist/RefSubject/RefOption.js +133 -1
  442. package/dist/RefSubject/RefRecord.d.ts +339 -1
  443. package/dist/RefSubject/RefRecord.d.ts.map +1 -1
  444. package/dist/RefSubject/RefRecord.js +327 -0
  445. package/dist/RefSubject/RefResult.d.ts +155 -23
  446. package/dist/RefSubject/RefResult.d.ts.map +1 -1
  447. package/dist/RefSubject/RefResult.js +122 -1
  448. package/dist/RefSubject/RefString.d.ts +188 -1
  449. package/dist/RefSubject/RefString.d.ts.map +1 -1
  450. package/dist/RefSubject/RefString.js +177 -1
  451. package/dist/RefSubject/RefStruct.d.ts +156 -1
  452. package/dist/RefSubject/RefStruct.d.ts.map +1 -1
  453. package/dist/RefSubject/RefStruct.js +145 -1
  454. package/dist/RefSubject/RefSubject.d.ts +1168 -15
  455. package/dist/RefSubject/RefSubject.d.ts.map +1 -1
  456. package/dist/RefSubject/RefSubject.js +850 -58
  457. package/dist/RefSubject/RefTrie.d.ts +290 -4
  458. package/dist/RefSubject/RefTrie.d.ts.map +1 -1
  459. package/dist/RefSubject/RefTrie.js +278 -3
  460. package/dist/RefSubject/RefTuple.d.ts +117 -1
  461. package/dist/RefSubject/RefTuple.d.ts.map +1 -1
  462. package/dist/RefSubject/RefTuple.js +106 -1
  463. package/dist/RefSubject/index.d.ts +1 -0
  464. package/dist/RefSubject/index.d.ts.map +1 -1
  465. package/dist/RefSubject/index.js +1 -0
  466. package/dist/RefSubject.d.ts +2 -1
  467. package/dist/RefSubject.d.ts.map +1 -1
  468. package/dist/RefSubject.js +2 -1
  469. package/dist/RefTrie.d.ts +2 -0
  470. package/dist/RefTrie.d.ts.map +1 -0
  471. package/dist/RefTrie.js +1 -0
  472. package/dist/RefTuple.d.ts +2 -0
  473. package/dist/RefTuple.d.ts.map +1 -0
  474. package/dist/RefTuple.js +1 -0
  475. package/dist/Sink/Sink.d.ts +385 -14
  476. package/dist/Sink/Sink.d.ts.map +1 -1
  477. package/dist/Sink/Sink.js +53 -6
  478. package/dist/Sink/combinators.d.ts +731 -2
  479. package/dist/Sink/combinators.d.ts.map +1 -1
  480. package/dist/Sink/combinators.js +707 -5
  481. package/dist/Subject/Subject.d.ts +1016 -22
  482. package/dist/Subject/Subject.d.ts.map +1 -1
  483. package/dist/Subject/Subject.js +904 -39
  484. package/dist/Versioned/Versioned.d.ts +426 -9
  485. package/dist/Versioned/Versioned.d.ts.map +1 -1
  486. package/dist/Versioned/Versioned.js +241 -15
  487. package/dist/index.d.ts +22 -3
  488. package/dist/index.d.ts.map +1 -1
  489. package/dist/index.js +22 -3
  490. package/package.json +120 -11
  491. package/dist/Fx/constructors/fromYieldable.d.ts +0 -12
  492. package/dist/Fx/constructors/fromYieldable.d.ts.map +0 -1
  493. package/dist/Fx/constructors/fromYieldable.js +0 -12
  494. package/src/Fx/Fx.ts +0 -164
  495. package/src/Fx/TypeId.ts +0 -25
  496. package/src/Fx/combinators/additive.ts +0 -142
  497. package/src/Fx/combinators/catch.ts +0 -416
  498. package/src/Fx/combinators/causes.ts +0 -23
  499. package/src/Fx/combinators/changesWithEffect.ts +0 -66
  500. package/src/Fx/combinators/compact.ts +0 -15
  501. package/src/Fx/combinators/continueWith.ts +0 -78
  502. package/src/Fx/combinators/dropUntil.ts +0 -47
  503. package/src/Fx/combinators/ensuring.ts +0 -23
  504. package/src/Fx/combinators/exhaustLatestMap.ts +0 -74
  505. package/src/Fx/combinators/exhaustLatestMapEffect.ts +0 -25
  506. package/src/Fx/combinators/exhaustMap.ts +0 -36
  507. package/src/Fx/combinators/exhaustMapEffect.ts +0 -23
  508. package/src/Fx/combinators/exit.ts +0 -15
  509. package/src/Fx/combinators/filter.ts +0 -22
  510. package/src/Fx/combinators/filterEffect.ts +0 -31
  511. package/src/Fx/combinators/filterMap.ts +0 -23
  512. package/src/Fx/combinators/filterMapEffect.ts +0 -32
  513. package/src/Fx/combinators/filterMapLoop.ts +0 -35
  514. package/src/Fx/combinators/filterMapLoopCause.ts +0 -36
  515. package/src/Fx/combinators/filterMapLoopCauseEffect.ts +0 -46
  516. package/src/Fx/combinators/filterMapLoopEffect.ts +0 -36
  517. package/src/Fx/combinators/flatMap.ts +0 -51
  518. package/src/Fx/combinators/flatMapConcurrently.ts +0 -39
  519. package/src/Fx/combinators/flatMapConcurrentlyEffect.ts +0 -26
  520. package/src/Fx/combinators/flatMapEffect.ts +0 -42
  521. package/src/Fx/combinators/flip.ts +0 -14
  522. package/src/Fx/combinators/gen.ts +0 -24
  523. package/src/Fx/combinators/genScoped.ts +0 -24
  524. package/src/Fx/combinators/index.ts +0 -61
  525. package/src/Fx/combinators/keyed.ts +0 -369
  526. package/src/Fx/combinators/loop.ts +0 -27
  527. package/src/Fx/combinators/loopCause.ts +0 -34
  528. package/src/Fx/combinators/loopCauseEffect.ts +0 -36
  529. package/src/Fx/combinators/loopEffect.ts +0 -34
  530. package/src/Fx/combinators/map.ts +0 -22
  531. package/src/Fx/combinators/mapBoth.ts +0 -40
  532. package/src/Fx/combinators/mapEffect.ts +0 -32
  533. package/src/Fx/combinators/mapError.ts +0 -28
  534. package/src/Fx/combinators/mergeAll.ts +0 -22
  535. package/src/Fx/combinators/mergeOrdered.ts +0 -123
  536. package/src/Fx/combinators/onError.ts +0 -40
  537. package/src/Fx/combinators/onExit.ts +0 -82
  538. package/src/Fx/combinators/onInterrupt.ts +0 -87
  539. package/src/Fx/combinators/provide.ts +0 -124
  540. package/src/Fx/combinators/result.ts +0 -39
  541. package/src/Fx/combinators/scan.ts +0 -82
  542. package/src/Fx/combinators/skip.ts +0 -41
  543. package/src/Fx/combinators/skipRepeats.ts +0 -15
  544. package/src/Fx/combinators/skipRepeatsWith.ts +0 -40
  545. package/src/Fx/combinators/skipWhile.ts +0 -100
  546. package/src/Fx/combinators/slice.ts +0 -55
  547. package/src/Fx/combinators/switchMap.ts +0 -55
  548. package/src/Fx/combinators/switchMapEffect.ts +0 -25
  549. package/src/Fx/combinators/take.ts +0 -38
  550. package/src/Fx/combinators/takeUntil.ts +0 -88
  551. package/src/Fx/combinators/takeWhile.ts +0 -47
  552. package/src/Fx/combinators/tapEffect.ts +0 -39
  553. package/src/Fx/combinators/tuple.ts +0 -79
  554. package/src/Fx/combinators/unwrap.ts +0 -21
  555. package/src/Fx/combinators/unwrapScoped.ts +0 -26
  556. package/src/Fx/combinators/when.ts +0 -64
  557. package/src/Fx/combinators/withSpan.ts +0 -24
  558. package/src/Fx/combinators/zip.ts +0 -175
  559. package/src/Fx/constructors/at.ts +0 -23
  560. package/src/Fx/constructors/die.ts +0 -17
  561. package/src/Fx/constructors/empty.ts +0 -10
  562. package/src/Fx/constructors/fail.ts +0 -14
  563. package/src/Fx/constructors/failCause.ts +0 -14
  564. package/src/Fx/constructors/fn.ts +0 -245
  565. package/src/Fx/constructors/fromEffect.ts +0 -24
  566. package/src/Fx/constructors/fromFailures.ts +0 -19
  567. package/src/Fx/constructors/fromIterable.ts +0 -15
  568. package/src/Fx/constructors/fromSchedule.ts +0 -18
  569. package/src/Fx/constructors/fromYieldable.ts +0 -17
  570. package/src/Fx/constructors/index.ts +0 -15
  571. package/src/Fx/constructors/interrupt.ts +0 -13
  572. package/src/Fx/constructors/make.ts +0 -103
  573. package/src/Fx/constructors/periodic.ts +0 -15
  574. package/src/Fx/constructors/succeed.ts +0 -37
  575. package/src/Fx/constructors/suspend.ts +0 -6
  576. package/src/Fx/index.ts +0 -6
  577. package/src/Fx/internal/DeferredRef.ts +0 -87
  578. package/src/Fx/internal/UnionToTuple.ts +0 -12
  579. package/src/Fx/internal/diff.ts +0 -191
  580. package/src/Fx/internal/equivalence.ts +0 -12
  581. package/src/Fx/internal/multicast.ts +0 -51
  582. package/src/Fx/internal/ring-buffer.ts +0 -60
  583. package/src/Fx/internal/scope.ts +0 -58
  584. package/src/Fx/internal/yieldable.ts +0 -31
  585. package/src/Fx/run/collect.ts +0 -79
  586. package/src/Fx/run/first.ts +0 -20
  587. package/src/Fx/run/fork.ts +0 -40
  588. package/src/Fx/run/index.ts +0 -5
  589. package/src/Fx/run/observe.ts +0 -114
  590. package/src/Fx/run/runPromise.ts +0 -32
  591. package/src/Fx/stream.ts +0 -42
  592. package/src/Fx.additive-combinators.test.ts +0 -126
  593. package/src/Fx.catch-additive.test.ts +0 -206
  594. package/src/Fx.catch.test.ts +0 -60
  595. package/src/Fx.dropUntil.test.ts +0 -61
  596. package/src/Fx.fn.test.ts +0 -51
  597. package/src/Fx.lifecycle.test.ts +0 -79
  598. package/src/Fx.mapError-mapBoth.test.ts +0 -101
  599. package/src/Fx.provide-combinators.test.ts +0 -94
  600. package/src/Fx.result-changesWithEffect.test.ts +0 -112
  601. package/src/Fx.scan.test.ts +0 -73
  602. package/src/Fx.takeWhile-skipWhile.test.ts +0 -84
  603. package/src/Fx.test.ts +0 -71
  604. package/src/Fx.ts +0 -1
  605. package/src/Fx.zip-merge-additive.test.ts +0 -171
  606. package/src/Fx.zip.test.ts +0 -133
  607. package/src/Push/Push.ts +0 -1072
  608. package/src/Push/index.ts +0 -1
  609. package/src/Push.additive.test.ts +0 -256
  610. package/src/Push.test.ts +0 -26
  611. package/src/Push.ts +0 -1
  612. package/src/RefSubject/RefArray.ts +0 -516
  613. package/src/RefSubject/RefBigDecimal.test.ts +0 -56
  614. package/src/RefSubject/RefBigDecimal.ts +0 -295
  615. package/src/RefSubject/RefBigInt.test.ts +0 -56
  616. package/src/RefSubject/RefBigInt.ts +0 -189
  617. package/src/RefSubject/RefBoolean.test.ts +0 -57
  618. package/src/RefSubject/RefBoolean.ts +0 -185
  619. package/src/RefSubject/RefCause.test.ts +0 -53
  620. package/src/RefSubject/RefCause.ts +0 -146
  621. package/src/RefSubject/RefChunk.ts +0 -516
  622. package/src/RefSubject/RefDateTime.test.ts +0 -43
  623. package/src/RefSubject/RefDateTime.ts +0 -261
  624. package/src/RefSubject/RefDuration.test.ts +0 -49
  625. package/src/RefSubject/RefDuration.ts +0 -188
  626. package/src/RefSubject/RefGraph.ts +0 -649
  627. package/src/RefSubject/RefHashMap.ts +0 -474
  628. package/src/RefSubject/RefHashRing.ts +0 -262
  629. package/src/RefSubject/RefHashSet.ts +0 -308
  630. package/src/RefSubject/RefIterable.ts +0 -454
  631. package/src/RefSubject/RefOption.test.ts +0 -67
  632. package/src/RefSubject/RefOption.ts +0 -193
  633. package/src/RefSubject/RefRecord.ts +0 -621
  634. package/src/RefSubject/RefResult.test.ts +0 -63
  635. package/src/RefSubject/RefResult.ts +0 -209
  636. package/src/RefSubject/RefString.test.ts +0 -61
  637. package/src/RefSubject/RefString.ts +0 -256
  638. package/src/RefSubject/RefStruct.test.ts +0 -60
  639. package/src/RefSubject/RefStruct.ts +0 -253
  640. package/src/RefSubject/RefSubject.ts +0 -2644
  641. package/src/RefSubject/RefTrie.ts +0 -365
  642. package/src/RefSubject/RefTuple.test.ts +0 -60
  643. package/src/RefSubject/RefTuple.ts +0 -231
  644. package/src/RefSubject/index.ts +0 -21
  645. package/src/RefSubject.additive-parity.test.ts +0 -101
  646. package/src/RefSubject.test.ts +0 -65
  647. package/src/RefSubject.ts +0 -1
  648. package/src/Sink/Sink.ts +0 -159
  649. package/src/Sink/combinators.ts +0 -1115
  650. package/src/Sink/index.ts +0 -2
  651. package/src/Sink.combinators.test.ts +0 -88
  652. package/src/Sink.reduce-collect-head-last.test.ts +0 -107
  653. package/src/Sink.ts +0 -1
  654. package/src/Subject/Subject.ts +0 -441
  655. package/src/Subject/index.ts +0 -1
  656. package/src/Subject.test.ts +0 -47
  657. package/src/Subject.ts +0 -1
  658. package/src/Versioned/Versioned.ts +0 -597
  659. package/src/Versioned/index.ts +0 -1
  660. package/src/Versioned.filterMap.test.ts +0 -91
  661. package/src/Versioned.test.ts +0 -23
  662. package/src/Versioned.ts +0 -1
  663. package/src/index.ts +0 -7
@@ -4,13 +4,35 @@ import * as Effect from "effect/Effect";
4
4
  import * as Layer from "effect/Layer";
5
5
  import * as Option from "effect/Option";
6
6
  import type * as Scope from "effect/Scope";
7
- import * as ServiceMap from "effect/ServiceMap";
7
+ import * as Context from "effect/Context";
8
8
  import * as Fx from "../Fx/index.js";
9
9
  import * as Sink from "../Sink.js";
10
10
  /**
11
- * Push is an abstract type which represents a Type which is both an Fx and a Sink. The type parameters
12
- * are decoupled from one another and allow mapping over the input and output of the Push separately for
13
- * more complex use cases.
11
+ * A bidirectional value that is both a `Sink<A, E, R>` and an `Fx<B, E2, R2>`.
12
+ *
13
+ * Calling `onSuccess` or `onFailure` sends exactly one input notification to the
14
+ * wrapped Sink. The returned `Effect` is the acknowledgment: a producer that runs
15
+ * and awaits it waits for the consumer callback to finish. `Push` adds no queue,
16
+ * buffering, replay, or demand protocol of its own.
17
+ *
18
+ * Running the Fx side preserves that Fx's cardinality and ordering. Input values
19
+ * are not automatically forwarded to the output; any relationship between the
20
+ * two sides belongs to the supplied Sink and Fx (for example, a shared `Subject`).
21
+ *
22
+ * @remarks
23
+ * ## Why
24
+ *
25
+ * Interactive systems often need one value for sending work and another for
26
+ * observing results. Keeping both directions in one Effect-native value makes the
27
+ * boundary composable without pretending that commands and events are the same
28
+ * stream.
29
+ *
30
+ * ## Ownership and lifetime
31
+ *
32
+ * Constructing a `Push` starts no work and allocates no fiber or Scope. Each input
33
+ * callback runs in the caller's fiber with the Sink's `R` requirements. Running
34
+ * the output side follows the wrapped Fx's Scope, interruption, finalizers, `E2`
35
+ * failures, and `R2` services; `Push` does not change them.
14
36
  *
15
37
  * @example
16
38
  * ```ts
@@ -47,18 +69,208 @@ import * as Sink from "../Sink.js";
47
69
  export interface Push<in A, in E, out R, out B, out E2, out R2> extends Sink.Sink<A, E, R>, Fx.Fx<B, E2, R2> {
48
70
  }
49
71
  export declare namespace Push {
72
+ /**
73
+ * Matches any `Push` when its six channel types are intentionally unknown.
74
+ *
75
+ * @remarks
76
+ * ## Why
77
+ *
78
+ * Generic utilities sometimes need to inspect a Push before recovering its
79
+ * input, output, error, and service channels with conditional types.
80
+ *
81
+ * ## Ownership and lifetime
82
+ *
83
+ * This type alias creates no value or resource and changes no runtime lifetime.
84
+ *
85
+ * @since 1.0.0
86
+ * @category type-level
87
+ */
50
88
  type Any = Push<any, any, any, any, any, any>;
89
+ /**
90
+ * The static and Effect service surface returned by `Push.Service`.
91
+ *
92
+ * Service lookup supplies the same bidirectional value to `run`, `onSuccess`,
93
+ * and `onFailure`. The `Self` service appears in both required-service channels;
94
+ * the installed Push itself has those requirements captured by its Layer.
95
+ *
96
+ * @remarks
97
+ * ## Why
98
+ *
99
+ * A named service lets application code send inputs and observe outputs without
100
+ * threading a concrete Push through every function.
101
+ *
102
+ * ## Ownership and lifetime
103
+ *
104
+ * The Layer built by `make` owns service installation. It captures the Sink and
105
+ * Fx construction contexts, excluding `Scope.Scope`; Scope-dependent resources
106
+ * must therefore be acquired by the surrounding scoped program.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * import * as Push from "@typed/fx/Push"
111
+ *
112
+ * class Events extends Push.Service<Events, string, never, string>()("Events") {}
113
+ * const id: "Events" = Events.id
114
+ * ```
115
+ *
116
+ * @since 1.0.0
117
+ * @category models
118
+ */
51
119
  interface Service<Self, Id extends string, A, E, B, E2> extends Push<A, E, Self, B, E2, Self> {
120
+ /**
121
+ * The literal Context service identifier supplied to `Push.Service`.
122
+ *
123
+ * @remarks
124
+ * ## Why
125
+ *
126
+ * A stable literal id makes the capability identifiable in Effect Context and
127
+ * diagnostics without inspecting its implementation.
128
+ *
129
+ * ## Ownership and lifetime
130
+ *
131
+ * The id is immutable metadata and owns no resource.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * import * as Push from "@typed/fx/Push"
136
+ * class Events extends Push.Service<Events, string, never, string>()("Events") {}
137
+ * const id: "Events" = Events.id
138
+ * ```
139
+ *
140
+ * @since 1.0.0
141
+ * @category services
142
+ */
52
143
  readonly id: Id;
53
- readonly service: ServiceMap.Service<Self, Push<A, E, never, B, E2, never>>;
144
+ /**
145
+ * The Effect Context service used by the static Push operations.
146
+ *
147
+ * @remarks
148
+ * ## Why
149
+ *
150
+ * Exposing the Context service permits ordinary Effect service composition in
151
+ * addition to the convenience statics.
152
+ *
153
+ * ## Ownership and lifetime
154
+ *
155
+ * This is an immutable service reference. The Layer providing `Self`, not the
156
+ * reference, owns installation and release.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * import * as Push from "@typed/fx/Push"
161
+ * class Events extends Push.Service<Events, string, never, string>()("Events") {}
162
+ * const service = Events.service
163
+ * ```
164
+ *
165
+ * @since 1.0.0
166
+ * @category services
167
+ */
168
+ readonly service: Context.Service<Self, Push<A, E, never, B, E2, never>>;
169
+ /**
170
+ * Builds a Layer that installs a concrete Sink/Fx pair as this service.
171
+ *
172
+ * Building the Layer starts neither side. The Sink context is captured at
173
+ * Layer construction; each output run additionally receives its subscriber's
174
+ * context.
175
+ *
176
+ * @remarks
177
+ * ## Why
178
+ *
179
+ * The Layer is the explicit composition boundary between implementation
180
+ * requirements and consumers that depend only on `Self`.
181
+ *
182
+ * ## Ownership and lifetime
183
+ *
184
+ * Layer lifetime owns service installation. `Scope.Scope` is excluded from
185
+ * captured requirements so scoped resources remain owned by the surrounding
186
+ * scoped Effect.
187
+ *
188
+ * @example
189
+ * ```ts
190
+ * import { Effect } from "effect"
191
+ * import * as Fx from "@typed/fx/Fx"
192
+ * import * as Push from "@typed/fx/Push"
193
+ * import * as Sink from "@typed/fx/Sink"
194
+ * class Events extends Push.Service<Events, string, never, string>()("Events") {}
195
+ * const Live = Events.make(Sink.make(() => Effect.void, () => Effect.void), Fx.succeed("ready"))
196
+ * ```
197
+ *
198
+ * @since 1.0.0
199
+ * @category layers
200
+ */
54
201
  readonly make: <R = never, R2 = never>(sink: Sink.Sink<A, E, R>, fx: Fx.Fx<B, E2, R2>) => Layer.Layer<Self, never, Exclude<R | R2, Scope.Scope>>;
55
202
  }
203
+ /**
204
+ * Constructable static type produced by `Push.Service`.
205
+ *
206
+ * @remarks
207
+ * ## Why
208
+ *
209
+ * The construct signature supports the class-extension pattern used by Effect
210
+ * services while retaining the complete static Push API.
211
+ *
212
+ * ## Ownership and lifetime
213
+ *
214
+ * Constructing the class returns its static service value; it does not acquire,
215
+ * subscribe to, or dispose the installed Push.
216
+ *
217
+ * @example
218
+ * ```ts
219
+ * import * as Push from "@typed/fx/Push"
220
+ *
221
+ * class Events extends Push.Service<Events, string, never, string>()("Events") {}
222
+ * const ServiceClass: Push.Push.Class<Events, "Events", string, never, string, never> = Events
223
+ * ```
224
+ *
225
+ * @since 1.0.0
226
+ * @category models
227
+ */
56
228
  interface Class<Self, Id extends string, A, E, B, E2> extends Service<Self, Id, A, E, B, E2> {
229
+ /**
230
+ * Returns the static service value when used through the class pattern.
231
+ *
232
+ * @remarks
233
+ * ## Why
234
+ *
235
+ * The construct signature allows `class X extends Push.Service(...)` while
236
+ * preserving the service's precise static type.
237
+ *
238
+ * ## Ownership and lifetime
239
+ *
240
+ * Construction acquires nothing; the resulting value still resolves its
241
+ * concrete Push from the current Effect Context.
242
+ *
243
+ * @example
244
+ * ```ts
245
+ * import * as Push from "@typed/fx/Push"
246
+ * class Events extends Push.Service<Events, string, never, string>()("Events") {}
247
+ * const events = new Events()
248
+ * ```
249
+ *
250
+ * @since 1.0.0
251
+ * @category services
252
+ */
57
253
  new (): Service<Self, Id, A, E, B, E2>;
58
254
  }
59
255
  }
60
256
  /**
61
- * Creates a `Push` from a `Sink` and an `Fx`.
257
+ * Couples a `Sink` input with an independent `Fx` output.
258
+ *
259
+ * The result forwards each input callback directly to `sink` and delegates every
260
+ * output subscription to `fx`. It does not connect the two values, change output
261
+ * cardinality or ordering, buffer inputs, or start either side eagerly.
262
+ *
263
+ * @remarks
264
+ * ## Why
265
+ *
266
+ * `make` is the explicit boundary where a command consumer and event producer
267
+ * become one bidirectional capability without hiding either contract.
268
+ *
269
+ * ## Ownership and lifetime
270
+ *
271
+ * Construction is allocation-free apart from the wrapper. Each input callback is
272
+ * owned by its caller; each output run is owned by the wrapped Fx run and inherits
273
+ * its interruption, Scope, cleanup, failures, and services.
62
274
  *
63
275
  * @example
64
276
  * ```ts
@@ -67,26 +279,17 @@ export declare namespace Push {
67
279
  * import { Fx } from "@typed/fx"
68
280
  * import * as Sink from "@typed/fx/Sink"
69
281
  *
70
- * const program = Effect.gen(function* () {
71
- * const sink = Sink.make(
72
- * (cause) => Effect.sync(() => console.log("Failed:", cause)),
73
- * (value) => Effect.sync(() => console.log("Success:", value))
74
- * )
75
- *
76
- * const fx = Fx.succeed("Output")
282
+ * const received: Array<number> = []
283
+ * const sink = Sink.make(() => Effect.void, (value: number) =>
284
+ * Effect.sync(() => received.push(value))
285
+ * )
286
+ * const push = Push.make(sink, Fx.fromIterable(["ready", "done"]))
77
287
  *
78
- * const push = Push.make(sink, fx)
79
- *
80
- * // Push a value
81
- * yield* push.onSuccess(42)
82
- * // Output: "Success: 42"
83
- *
84
- * // Observe the Fx
85
- * yield* Fx.observe(push, (value) =>
86
- * Effect.sync(() => console.log("Emitted:", value))
87
- * )
88
- * // Output: "Emitted: Output"
89
- * })
288
+ * const program = Effect.gen(function* () {
289
+ * yield* push.onSuccess(42) // acknowledges the Sink callback
290
+ * const output = yield* Fx.collectAll(push)
291
+ * return { received, output }
292
+ * }).pipe(Effect.scoped)
90
293
  * ```
91
294
  *
92
295
  * @since 1.0.0
@@ -97,62 +300,295 @@ export declare const make: {
97
300
  <A, E, R, B, E2, R2>(sink: Sink.Sink<A, E, R>, fx: Fx.Fx<B, E2, R2>): Push<A, E, R, B, E2, R2>;
98
301
  };
99
302
  /**
100
- * Maps over the input (Sink) side of a `Push`.
303
+ * Synchronously transforms each successful input before sending it to the Sink.
304
+ *
305
+ * One input maps to exactly one downstream input. Calling `onSuccess` evaluates
306
+ * `f` immediately, before the returned downstream Effect is run; allocation and
307
+ * thrown exceptions therefore occur at callback invocation (and become defects
308
+ * only when that invocation itself occurs inside Effect evaluation). The Sink
309
+ * callback Effect remains the acknowledgment. Calls are not serialized; execution
310
+ * order and concurrency follow the producer. The Fx output is unchanged.
311
+ *
312
+ * @remarks
313
+ * ## Why
314
+ *
315
+ * Adapt an external command shape to an existing consumer without rebuilding or
316
+ * changing the independent output stream.
317
+ *
318
+ * ## Ownership and lifetime
319
+ *
320
+ * `f` runs synchronously when `onSuccess` is called, before its returned Effect
321
+ * exists, and acquires no resource. Downstream handling retains the original
322
+ * Sink's `E`, `R`, caller fiber, interruption, and cleanup behavior.
101
323
  *
102
324
  * @example
103
325
  * ```ts
104
326
  * import { Effect } from "effect"
327
+ * import * as Fx from "@typed/fx/Fx"
105
328
  * import * as Push from "@typed/fx/Push"
106
- * import { Fx } from "@typed/fx"
107
329
  * import * as Sink from "@typed/fx/Sink"
108
330
  *
109
- * const program = Effect.gen(function* () {
110
- * const push = Push.make(
111
- * Sink.make(
112
- * (cause) => Effect.void,
113
- * (value) => Effect.sync(() => console.log("Number:", value))
114
- * ),
115
- * Fx.succeed("Output")
116
- * )
117
- *
118
- * // Map input from string to number
119
- * const mapped = Push.mapInput(push, (str: string) => parseInt(str))
120
- *
121
- * // Push a string, which gets converted to a number
122
- * yield* mapped.onSuccess("42")
123
- * // Output: "Number: 42"
331
+ * const events: Array<string> = []
332
+ * const base = Push.make(
333
+ * Sink.make(() => Effect.void, (n: number) => Effect.sync(() => events.push(`sink:${n}`))),
334
+ * Fx.empty
335
+ * )
336
+ * const mapped = Push.mapInput(base, (text: string) => {
337
+ * events.push(`map:${text}`)
338
+ * return Number(text)
124
339
  * })
340
+ * const acknowledgement = mapped.onSuccess("42")
341
+ * // events is already ["map:42"]; the Sink Effect has not run yet.
342
+ * const program = Effect.as(acknowledgement, events)
125
343
  * ```
126
344
  *
127
345
  * @since 1.0.0
128
346
  * @category combinators
129
347
  */
130
348
  export declare const mapInput: {
131
- <P extends Push.Any, C>(f: (c: C) => Sink.Success<P>): (push: P) => Push<Sink.Context<P>, Sink.Error<P>, C, Fx.Fx.Services<P>, Fx.Fx.Error<P>, Fx.Fx.Success<P>>;
132
- <P extends Push.Any, C>(push: P, f: (c: C) => Sink.Sink.Success<P>): Push<Sink.Sink.Context<P>, Sink.Sink.Error<P>, C, Fx.Fx.Services<P>, Fx.Fx.Error<P>, Fx.Fx.Success<P>>;
349
+ <C, A>(f: (c: C) => A): <E, R, B, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<C, E, R, B, E2, R2>;
350
+ <A, E, R, B, E2, R2, C>(push: Push<A, E, R, B, E2, R2>, f: (c: C) => A): Push<C, E, R, B, E2, R2>;
133
351
  };
352
+ /**
353
+ * Effectfully transforms each successful input before sending it to the Sink.
354
+ *
355
+ * Calling `onSuccess(value)` invokes `f(value)` immediately to construct an
356
+ * Effect. Allocation and thrown exceptions therefore occur before an
357
+ * acknowledgment Effect is returned. Running that returned Effect later executes
358
+ * the constructed Effect in the caller's fiber. On success its single `A` reaches
359
+ * the Sink; typed failure, defect, or interruption sends its full Cause to the
360
+ * Sink failure callback. Calls are not serialized, so the producer controls order
361
+ * and concurrency. Output values and order are unchanged.
362
+ *
363
+ * @remarks
364
+ * ## Why
365
+ *
366
+ * Use this at an input boundary that must decode, validate, or load Effect
367
+ * services before the existing consumer can accept a value.
368
+ *
369
+ * ## Ownership and lifetime
370
+ *
371
+ * Effect construction happens eagerly at `onSuccess`; only execution is deferred.
372
+ * The fiber running the returned acknowledgment owns execution and interruption
373
+ * of the constructed Effect and downstream callback. `E` is handled by the Sink
374
+ * failure channel, while `R3` joins the input service requirements.
375
+ *
376
+ * @example
377
+ * ```ts
378
+ * import { Effect } from "effect"
379
+ * import * as Fx from "@typed/fx/Fx"
380
+ * import * as Push from "@typed/fx/Push"
381
+ * import * as Sink from "@typed/fx/Sink"
382
+ *
383
+ * const numbers: Array<number> = []
384
+ * const base = Push.make(
385
+ * Sink.make(() => Effect.void, (n: number) => Effect.sync(() => numbers.push(n))),
386
+ * Fx.empty
387
+ * )
388
+ * const parsed = Push.mapInputEffect(base, (text: string) =>
389
+ * text === "" ? Effect.fail("empty" as const) : Effect.succeed(Number(text))
390
+ * )
391
+ * ```
392
+ *
393
+ * @since 1.0.0
394
+ * @category combinators
395
+ */
134
396
  export declare const mapInputEffect: {
135
397
  <C, R3, E, A>(f: (c: C) => Effect.Effect<A, E, R3>): <R, B, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<C, E, R | R3, B, E2, R2>;
136
398
  <A, E, R, B, E2, R2, R3, C>(push: Push<A, E, R, B, E2, R2>, f: (c: C) => Effect.Effect<A, E, R3>): Push<C, E, R | R3, B, E2, R2>;
137
399
  };
400
+ /**
401
+ * Keeps successful inputs that satisfy `f` and discards the rest.
402
+ *
403
+ * Calling `onSuccess` runs the predicate immediately. A match constructs one Sink
404
+ * callback Effect; a non-match immediately returns an empty acknowledgment.
405
+ * Predicate allocation and throws therefore occur before the returned Effect is
406
+ * run. The producer controls call order and concurrency; output is preserved.
407
+ *
408
+ * @remarks
409
+ * ## Why
410
+ *
411
+ * Filtering before the consumer avoids teaching the underlying Sink about input
412
+ * values that are irrelevant to it.
413
+ *
414
+ * ## Ownership and lifetime
415
+ *
416
+ * The predicate is synchronous at `onSuccess` invocation and acquires no
417
+ * resources. Accepted callback Effects retain the original Sink's errors,
418
+ * services, interruption, and cleanup.
419
+ *
420
+ * @example
421
+ * ```ts
422
+ * import { Effect } from "effect"
423
+ * import * as Fx from "@typed/fx/Fx"
424
+ * import * as Push from "@typed/fx/Push"
425
+ * import * as Sink from "@typed/fx/Sink"
426
+ *
427
+ * const checks: Array<number> = []
428
+ * const positives = Push.filterInput(
429
+ * Push.make(Sink.make(() => Effect.void, (n: number) => Effect.log(n)), Fx.empty),
430
+ * (n) => (checks.push(n), n > 0)
431
+ * )
432
+ * const acknowledgement = positives.onSuccess(-1)
433
+ * // checks is already [-1]; acknowledgement performs no Sink callback.
434
+ * ```
435
+ *
436
+ * @since 1.0.0
437
+ * @category combinators
438
+ */
138
439
  export declare const filterInput: {
139
- <A>(f: (a: A) => boolean): <P extends Push.Any>(push: P) => Push<Sink.Context<P>, Sink.Error<P>, A, Fx.Fx.Services<P>, Fx.Fx.Error<P>, Fx.Fx.Success<P>>;
440
+ <A>(f: (a: A) => boolean): <E, R, B, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, B, E2, R2>;
140
441
  <A, E, R, B, E2, R2>(push: Push<A, E, R, B, E2, R2>, f: (a: A) => boolean): Push<A, E, R, B, E2, R2>;
141
442
  };
443
+ /**
444
+ * Effectfully decides whether each successful input reaches the Sink.
445
+ *
446
+ * Calling `onSuccess(value)` invokes `f(value)` immediately to construct the
447
+ * predicate Effect; allocation and throws happen before an acknowledgment is
448
+ * returned. Running the acknowledgment later executes that Effect in the caller's
449
+ * fiber. `true` forwards one value, `false` none, and failure sends its Cause to
450
+ * the Sink failure callback. Calls are not serialized; the producer controls
451
+ * order and concurrency. Output behavior is unchanged.
452
+ *
453
+ * @remarks
454
+ * ## Why
455
+ *
456
+ * This supports authorization and service-backed eligibility checks directly at
457
+ * the consumer boundary.
458
+ *
459
+ * ## Ownership and lifetime
460
+ *
461
+ * Predicate Effect construction is eager; its execution and downstream callback
462
+ * belong to the fiber that runs the returned acknowledgment, whose interruption
463
+ * stops them. Predicate services join input `R`; typed `E` is consumed through
464
+ * the Sink failure channel.
465
+ *
466
+ * @example
467
+ * ```ts
468
+ * import { Effect } from "effect"
469
+ * import * as Fx from "@typed/fx/Fx"
470
+ * import * as Push from "@typed/fx/Push"
471
+ * import * as Sink from "@typed/fx/Sink"
472
+ *
473
+ * const even = Push.filterInputEffect(
474
+ * Push.make(Sink.make(() => Effect.void, (_n: number) => Effect.void), Fx.empty),
475
+ * (n) => Effect.succeed(n % 2 === 0)
476
+ * )
477
+ * ```
478
+ *
479
+ * @since 1.0.0
480
+ * @category combinators
481
+ */
142
482
  export declare const filterInputEffect: {
143
483
  <A, R3, E>(f: (a: A) => Effect.Effect<boolean, E, R3>): <R, B, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R | R3, B, E2, R2>;
144
484
  <A, E, R, B, E2, R2, R3>(push: Push<A, E, R, B, E2, R2>, f: (a: A) => Effect.Effect<boolean, E, R3>): Push<A, E, R | R3, B, E2, R2>;
145
485
  };
486
+ /**
487
+ * Transforms an input and forwards it only when `f` returns `Some`.
488
+ *
489
+ * Calling `onSuccess` evaluates `f` immediately. `Some(a)` constructs one Sink
490
+ * callback Effect; `None` immediately returns an empty acknowledgment. Mapping
491
+ * allocation and throws therefore happen before the returned Effect runs. Calls
492
+ * are not serialized, so ordering follows the producer. Output is unchanged.
493
+ *
494
+ * @remarks
495
+ * ## Why
496
+ *
497
+ * `Option` combines parsing and filtering without a sentinel value or a separate
498
+ * predicate pass.
499
+ *
500
+ * ## Ownership and lifetime
501
+ *
502
+ * The mapping is synchronous at `onSuccess` invocation and resource-free. A
503
+ * forwarded callback Effect retains the original Sink's lifetime, error channel,
504
+ * and service requirements.
505
+ *
506
+ * @example
507
+ * ```ts
508
+ * import { Effect, Option } from "effect"
509
+ * import * as Fx from "@typed/fx/Fx"
510
+ * import * as Push from "@typed/fx/Push"
511
+ * import * as Sink from "@typed/fx/Sink"
512
+ *
513
+ * const parsed: Array<string> = []
514
+ * const integers = Push.filterMapInput(
515
+ * Push.make(Sink.make(() => Effect.void, (n: number) => Effect.log(n)), Fx.empty),
516
+ * (text: string) => {
517
+ * parsed.push(text)
518
+ * return /^\d+$/.test(text) ? Option.some(Number(text)) : Option.none()
519
+ * }
520
+ * )
521
+ * const acknowledgement = integers.onSuccess("nope")
522
+ * // parsed is already ["nope"]; acknowledgement performs no Sink callback.
523
+ * ```
524
+ *
525
+ * @since 1.0.0
526
+ * @category combinators
527
+ */
146
528
  export declare const filterMapInput: {
147
- <C, A>(f: (c: C) => Option.Option<A>): <P extends Push.Any>(push: P) => Push<C, Sink.Error<P>, Sink.Context<P>, Fx.Fx.Success<P>, Fx.Fx.Error<P>, Fx.Fx.Services<P>>;
529
+ <C, A>(f: (c: C) => Option.Option<A>): <P extends Push.Any>(push: P) => Push<C, Sink.Error<P>, Sink.Services<P>, Fx.Fx.Success<P>, Fx.Fx.Error<P>, Fx.Fx.Services<P>>;
148
530
  <A, E, R, B, E2, R2, C>(push: Push<A, E, R, B, E2, R2>, f: (c: C) => Option.Option<A>): Push<C, E, R, B, E2, R2>;
149
531
  };
532
+ /**
533
+ * Effectfully transforms an input and forwards only a resulting `Some` value.
534
+ *
535
+ * Calling `onSuccess(value)` invokes `f(value)` immediately to construct an
536
+ * Effect; allocation and throws happen before an acknowledgment is returned.
537
+ * Running that acknowledgment later executes the constructed Effect in the
538
+ * caller's fiber. `Some(a)` produces one Sink callback, `None` none, and failure
539
+ * sends its full Cause to the Sink failure callback. Concurrent calls are not
540
+ * serialized.
541
+ *
542
+ * @remarks
543
+ * ## Why
544
+ *
545
+ * This is the input-boundary form for service-backed lookup or validation where
546
+ * absence is expected but failure remains meaningful.
547
+ *
548
+ * ## Ownership and lifetime
549
+ *
550
+ * Mapper Effect construction is eager; execution belongs to the fiber that runs
551
+ * the returned acknowledgment and can be interrupted there. Mapper requirements
552
+ * join the Sink input requirements; its `E` is handled through the same failure
553
+ * callback. The output Fx is untouched.
554
+ *
555
+ * @example
556
+ * ```ts
557
+ * import { Effect, Option } from "effect"
558
+ * import * as Fx from "@typed/fx/Fx"
559
+ * import * as Push from "@typed/fx/Push"
560
+ * import * as Sink from "@typed/fx/Sink"
561
+ *
562
+ * const known = Push.filterMapInputEffect(
563
+ * Push.make(Sink.make(() => Effect.void, (_n: number) => Effect.void), Fx.empty),
564
+ * (text: string) => Effect.succeed(text === "one" ? Option.some(1) : Option.none())
565
+ * )
566
+ * ```
567
+ *
568
+ * @since 1.0.0
569
+ * @category combinators
570
+ */
150
571
  export declare const filterMapInputEffect: {
151
572
  <C, R3, E, A>(f: (c: C) => Effect.Effect<Option.Option<A>, E, R3>): <R, B, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<C, E, R | R3, B, E2, R2>;
152
573
  <A, E, R, B, E2, R2, R3, C>(push: Push<A, E, R, B, E2, R2>, f: (c: C) => Effect.Effect<Option.Option<A>, E, R3>): Push<C, E, R | R3, B, E2, R2>;
153
574
  };
154
575
  /**
155
- * Maps over the output (Fx) side of a `Push`.
576
+ * Synchronously transforms every value emitted by the Fx output side.
577
+ *
578
+ * It emits exactly one `C` for every upstream `B`, preserving order and the
579
+ * complete input Sink. The mapping does not buffer or introduce concurrency.
580
+ *
581
+ * @remarks
582
+ * ## Why
583
+ *
584
+ * Adapt observed events without changing the commands the bidirectional boundary
585
+ * accepts.
586
+ *
587
+ * ## Ownership and lifetime
588
+ *
589
+ * `f` runs in the upstream Fx delivery path and owns no resource. Output
590
+ * subscription, interruption, failures, services, and cleanup remain those of the
591
+ * wrapped Fx and downstream Sink.
156
592
  *
157
593
  * @example
158
594
  * ```ts
@@ -188,6 +624,39 @@ export declare const map: {
188
624
  <B, C>(f: (b: B) => C): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2, R2>;
189
625
  <A, E, R, B, E2, R2, C>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => C): Push<A, E, R, C, E2, R2>;
190
626
  };
627
+ /**
628
+ * Effectfully transforms each Fx output value.
629
+ *
630
+ * The mapper runs once per upstream value and emits one result on success, in
631
+ * upstream order for a sequential source. Its typed failures join `E2`; its
632
+ * required services join `R2`. The input side is unchanged.
633
+ *
634
+ * @remarks
635
+ * ## Why
636
+ *
637
+ * Use this for output enrichment that needs Effect services or can fail while
638
+ * keeping input handling independent.
639
+ *
640
+ * ## Ownership and lifetime
641
+ *
642
+ * Each mapper Effect runs inside the output subscription and is interrupted with
643
+ * it. No work starts before `run`; cleanup belongs to the upstream Fx and mapper
644
+ * effects. `mapEffect` itself introduces no separate buffer or long-lived fiber.
645
+ *
646
+ * @example
647
+ * ```ts
648
+ * import { Effect } from "effect"
649
+ * import * as Fx from "@typed/fx/Fx"
650
+ * import * as Push from "@typed/fx/Push"
651
+ * import * as Sink from "@typed/fx/Sink"
652
+ *
653
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.succeed(2))
654
+ * const doubled = Push.mapEffect(push, (n) => Effect.succeed(n * 2))
655
+ * ```
656
+ *
657
+ * @since 1.0.0
658
+ * @category combinators
659
+ */
191
660
  export declare const mapEffect: {
192
661
  <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3>;
193
662
  <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3>;
@@ -198,7 +667,31 @@ export declare const mapEffect: {
198
667
  * Failures (Cause) are mapped via `Cause.map`, so only the typed failure (`Fail`)
199
668
  * is transformed; defects and interrupts are preserved unchanged.
200
669
  *
201
- * Mirrors `Effect.mapError` on the Fx side.
670
+ * Mirrors `Effect.mapError` on the Fx side. Cardinality, value order, input
671
+ * callbacks, and output service requirements are unchanged.
672
+ *
673
+ * @remarks
674
+ * ## Why
675
+ *
676
+ * Normalize an output failure type at the observation boundary without touching
677
+ * input errors or collapsing defects and interruption into typed failures.
678
+ *
679
+ * ## Ownership and lifetime
680
+ *
681
+ * The mapping is synchronous and resource-free. It runs when the output Cause is
682
+ * delivered and preserves the upstream subscription, Scope, interruption, and
683
+ * cleanup behavior.
684
+ *
685
+ * @example
686
+ * ```ts
687
+ * import { Effect } from "effect"
688
+ * import * as Fx from "@typed/fx/Fx"
689
+ * import * as Push from "@typed/fx/Push"
690
+ * import * as Sink from "@typed/fx/Sink"
691
+ *
692
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.fail("offline"))
693
+ * const normalized = Push.mapError(push, (message) => ({ message }))
694
+ * ```
202
695
  *
203
696
  * @since 1.0.0
204
697
  * @category combinators
@@ -210,8 +703,34 @@ export declare const mapError: {
210
703
  /**
211
704
  * Transforms both the output (Fx) success and error channels of a `Push` using the provided options.
212
705
  *
213
- * Mirrors `Effect.mapBoth` on the Fx side: `onSuccess` maps emitted values,
214
- * `onFailure` maps the typed failure (via `Cause.map`); defects and interrupts are preserved.
706
+ * Mirrors `Effect.mapBoth` on the Fx side: `onSuccess` maps every emitted value
707
+ * one-to-one and `onFailure` maps typed failures via `Cause.map`; defects and
708
+ * interrupts are preserved. Ordering, services, and the input side are unchanged.
709
+ *
710
+ * @remarks
711
+ * ## Why
712
+ *
713
+ * Adapt both observable result channels at once while leaving command handling
714
+ * and non-typed Cause information intact.
715
+ *
716
+ * ## Ownership and lifetime
717
+ *
718
+ * Both functions run synchronously in the output delivery path and acquire no
719
+ * resources. The wrapped Fx retains ownership of its subscription and finalizers.
720
+ *
721
+ * @example
722
+ * ```ts
723
+ * import { Effect } from "effect"
724
+ * import * as Fx from "@typed/fx/Fx"
725
+ * import * as Push from "@typed/fx/Push"
726
+ * import * as Sink from "@typed/fx/Sink"
727
+ *
728
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.succeed(2))
729
+ * const labeled = Push.mapBoth(push, {
730
+ * onFailure: (error: never) => error,
731
+ * onSuccess: (value) => `value:${value}`
732
+ * })
733
+ * ```
215
734
  *
216
735
  * @since 1.0.0
217
736
  * @category combinators
@@ -226,93 +745,316 @@ export declare const mapBoth: {
226
745
  readonly onSuccess: (b: B) => C;
227
746
  }): Push<A, E, R, C, E3, R2>;
228
747
  };
748
+ /**
749
+ * Keeps Fx output values that satisfy `f`.
750
+ *
751
+ * The upstream Sink invokes the predicate synchronously for each output value,
752
+ * before the returned downstream callback Effect runs. Predicate allocation and
753
+ * throws therefore occur at upstream callback invocation. Matches preserve their
754
+ * relative order; non-matches produce no output. No buffer is added and every
755
+ * input callback is unchanged.
756
+ *
757
+ * @remarks
758
+ * ## Why
759
+ *
760
+ * Restrict observed events without restricting which commands the Push accepts.
761
+ *
762
+ * ## Ownership and lifetime
763
+ *
764
+ * The predicate is synchronous at upstream `onSuccess` invocation and
765
+ * resource-free. Subscription, interruption, failures, services, and cleanup
766
+ * remain those of the wrapped Fx.
767
+ *
768
+ * @example
769
+ * ```ts
770
+ * import { Effect } from "effect"
771
+ * import * as Fx from "@typed/fx/Fx"
772
+ * import * as Push from "@typed/fx/Push"
773
+ * import * as Sink from "@typed/fx/Sink"
774
+ *
775
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.fromIterable([1, 2, 3]))
776
+ * const even = Push.filter(push, (n) => n % 2 === 0)
777
+ * ```
778
+ *
779
+ * @since 1.0.0
780
+ * @category combinators
781
+ */
229
782
  export declare const filter: {
230
783
  <B>(f: (b: B) => boolean): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, B, E2, R2>;
231
784
  <A, E, R, B, E2, R2>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => boolean): Push<A, E, R, B, E2, R2>;
232
785
  };
786
+ /**
787
+ * Effectfully decides which Fx output values are emitted.
788
+ *
789
+ * Each upstream value runs one predicate. `true` emits that value, `false` emits
790
+ * none, and predicate failures join the output error channel. For a sequential
791
+ * source the predicate is acknowledged before the next delivery, preserving
792
+ * order; the input side is unchanged.
793
+ *
794
+ * @remarks
795
+ * ## Why
796
+ *
797
+ * Use this when an observed event needs an Effect service or fallible check before
798
+ * it is visible downstream.
799
+ *
800
+ * ## Ownership and lifetime
801
+ *
802
+ * Predicate effects run inside and are interrupted with the output subscription.
803
+ * Their `E3` failures and `R3` services join the Fx channels. No separate queue or
804
+ * persistent fiber is introduced.
805
+ *
806
+ * @example
807
+ * ```ts
808
+ * import { Effect } from "effect"
809
+ * import * as Fx from "@typed/fx/Fx"
810
+ * import * as Push from "@typed/fx/Push"
811
+ * import * as Sink from "@typed/fx/Sink"
812
+ *
813
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.fromIterable([1, 2]))
814
+ * const positive = Push.filterEffect(push, (n) => Effect.succeed(n > 0))
815
+ * ```
816
+ *
817
+ * @since 1.0.0
818
+ * @category combinators
819
+ */
233
820
  export declare const filterEffect: {
234
821
  <B, R3, E3>(f: (b: B) => Effect.Effect<boolean, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, B, E2 | E3, R2 | R3>;
235
822
  <A, E, R, B, E2, R2, R3, E3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<boolean, E3, R3>): Push<A, E, R, B, E2 | E3, R2 | R3>;
236
823
  };
824
+ /**
825
+ * Maps each Fx output and emits only resulting `Some` values.
826
+ *
827
+ * The upstream Sink evaluates `f` synchronously for each value, before its
828
+ * returned downstream callback Effect runs. Mapping allocation and throws occur
829
+ * at that callback invocation. `Some(c)` emits exactly one `c`; `None` emits
830
+ * nothing. Relative order, errors, services, and input behavior are preserved.
831
+ *
832
+ * @remarks
833
+ * ## Why
834
+ *
835
+ * Combine output parsing and filtering without a sentinel value or a second pass.
836
+ *
837
+ * ## Ownership and lifetime
838
+ *
839
+ * The mapper is synchronous at upstream `onSuccess` invocation and resource-free.
840
+ * The wrapped Fx retains ownership of subscription, Scope, interruption, and
841
+ * finalizers.
842
+ *
843
+ * @example
844
+ * ```ts
845
+ * import { Effect, Option } from "effect"
846
+ * import * as Fx from "@typed/fx/Fx"
847
+ * import * as Push from "@typed/fx/Push"
848
+ * import * as Sink from "@typed/fx/Sink"
849
+ *
850
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.fromIterable(["1", "x"]))
851
+ * const numbers = Push.filterMap(push, (text) => /^\d+$/.test(text) ? Option.some(Number(text)) : Option.none())
852
+ * ```
853
+ *
854
+ * @since 1.0.0
855
+ * @category combinators
856
+ */
237
857
  export declare const filterMap: {
238
858
  <B, C>(f: (b: B) => Option.Option<C>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2, R2>;
239
859
  <A, E, R, B, E2, R2, C>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Option.Option<C>): Push<A, E, R, C, E2, R2>;
240
860
  };
861
+ /**
862
+ * Effectfully maps each Fx output and emits only resulting `Some` values.
863
+ *
864
+ * One mapper Effect runs per upstream value. `Some(c)` emits once, `None` emits
865
+ * nothing, and failures join the output error channel. Sequential sources retain
866
+ * order; the input Sink remains unchanged.
867
+ *
868
+ * @remarks
869
+ * ## Why
870
+ *
871
+ * This models service-backed lookup where absence is an ordinary filtered result
872
+ * but operational failure must remain observable.
873
+ *
874
+ * ## Ownership and lifetime
875
+ *
876
+ * Mapper effects are owned and interrupted by the output subscription. Their
877
+ * services join `R2` and failures join `E2`; the combinator adds no independent
878
+ * buffer or resource.
879
+ *
880
+ * @example
881
+ * ```ts
882
+ * import { Effect, Option } from "effect"
883
+ * import * as Fx from "@typed/fx/Fx"
884
+ * import * as Push from "@typed/fx/Push"
885
+ * import * as Sink from "@typed/fx/Sink"
886
+ *
887
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.succeed("one"))
888
+ * const ids = Push.filterMapEffect(push, (name) => Effect.succeed(name === "one" ? Option.some(1) : Option.none()))
889
+ * ```
890
+ *
891
+ * @since 1.0.0
892
+ * @category combinators
893
+ */
241
894
  export declare const filterMapEffect: {
242
895
  <B, C, E3, R3>(f: (b: B) => Effect.Effect<Option.Option<C>, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3>;
243
896
  <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<Option.Option<C>, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3>;
244
897
  };
245
898
  /**
246
- * Transforms each output value into a new `Fx`, switching to the latest inner `Fx` when a new value arrives.
899
+ * Transforms each output value into an inner `Fx`, observing only the latest one.
900
+ *
901
+ * A new outer value interrupts the previous inner fiber before starting the next.
902
+ * Output cardinality is the cardinality of the successive active inners; values
903
+ * from an interrupted inner stop. Outer order determines replacement order, while
904
+ * each active inner preserves its own order. The input Sink is unchanged.
905
+ *
906
+ * @remarks
907
+ * ## Why
908
+ *
909
+ * Latest-wins composition models search, navigation, and other work where a newer
910
+ * request makes the previous result irrelevant.
911
+ *
912
+ * ## Ownership and lifetime
913
+ *
914
+ * Running the result requires `Scope.Scope`. Each inner runs in that Scope and is
915
+ * interrupted on replacement or outer interruption; the last inner is joined
916
+ * before normal completion. Outer and inner errors/services are combined.
247
917
  *
248
918
  * @example
249
919
  * ```ts
250
920
  * import { Effect } from "effect"
921
+ * import * as Fx from "@typed/fx/Fx"
251
922
  * import * as Push from "@typed/fx/Push"
252
- * import { Fx } from "@typed/fx"
253
923
  * import * as Sink from "@typed/fx/Sink"
254
924
  *
255
- * const program = Effect.gen(function* () {
256
- * const push = Push.make(
257
- * Sink.make(
258
- * (cause) => Effect.void,
259
- * (value) => Effect.void
260
- * ),
261
- * Fx.succeed(1)
262
- * )
263
- *
264
- * // Switch to a new Fx for each value
265
- * const switched = Push.switchMap(push, (n) =>
266
- * Fx.fromIterable([n, n * 2, n * 3])
925
+ * const finalized: Array<number> = []
926
+ * const outer = Fx.make<number>((sink) =>
927
+ * sink.onSuccess(1).pipe(
928
+ * Effect.andThen(Effect.sleep("5 millis")),
929
+ * Effect.andThen(sink.onSuccess(2))
267
930
  * )
268
- *
269
- * // Only the latest Fx's values are emitted
270
- * yield* Fx.observe(switched, (value) =>
271
- * Effect.sync(() => console.log(value))
931
+ * )
932
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), outer)
933
+ * const switched = Push.switchMap(push, (id) =>
934
+ * Fx.make<number>((sink) =>
935
+ * Effect.gen(function* () {
936
+ * yield* Effect.sleep("2 millis")
937
+ * yield* sink.onSuccess(id * 10 + 1)
938
+ * yield* Effect.sleep(id === 1 ? "20 millis" : "2 millis")
939
+ * yield* sink.onSuccess(id * 10 + 2)
940
+ * }).pipe(Effect.ensuring(Effect.sync(() => finalized.push(id))))
272
941
  * )
273
- * })
942
+ * )
943
+ * const program = Fx.collectAll(switched).pipe(
944
+ * Effect.map((values) => ({ values, finalized })),
945
+ * Effect.scoped
946
+ * )
947
+ * // Effect.runPromise(program) => { values: [11, 21, 22], finalized: [1, 2] }
274
948
  * ```
275
949
  *
276
950
  * @since 1.0.0
277
951
  * @category combinators
278
952
  */
279
953
  export declare const switchMap: {
280
- <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, Scope.Scope | C, E2 | E3, R2 | R3>;
954
+ <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
281
955
  <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
282
956
  };
283
- export declare const switchMapEffect: {
284
- <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, Scope.Scope | C, E2 | E3, R2 | R3>;
285
- <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, Scope.Scope | C, E2 | E3, R2 | R3>;
286
- };
287
957
  /**
288
- * Transforms each output value into a new `Fx` and merges all inner `Fx` values concurrently.
958
+ * Transforms each output value into an Effect, keeping only the latest Effect.
959
+ *
960
+ * Each new outer value interrupts the previous Effect before starting its own.
961
+ * Every Effect can emit at most one value; interrupted Effects emit none. The
962
+ * input side is unchanged.
963
+ *
964
+ * @remarks
965
+ * ## Why
966
+ *
967
+ * This is latest-wins Effect composition without manually wrapping each Effect as
968
+ * an Fx.
969
+ *
970
+ * ## Ownership and lifetime
971
+ *
972
+ * The output subscription's Scope owns the active Effect fiber. Replacement and
973
+ * subscription interruption run its interruption/finalizers. `E3` joins output
974
+ * errors and `R3` joins required services.
289
975
  *
290
976
  * @example
291
977
  * ```ts
292
978
  * import { Effect } from "effect"
979
+ * import * as Fx from "@typed/fx/Fx"
293
980
  * import * as Push from "@typed/fx/Push"
294
- * import { Fx } from "@typed/fx"
295
981
  * import * as Sink from "@typed/fx/Sink"
296
982
  *
297
- * const program = Effect.gen(function* () {
298
- * const push = Push.make(
299
- * Sink.make(
300
- * (cause) => Effect.void,
301
- * (value) => Effect.void
302
- * ),
303
- * Fx.succeed(1)
983
+ * const finalized: Array<number> = []
984
+ * const source = Fx.make<number>((sink) =>
985
+ * sink.onSuccess(1).pipe(
986
+ * Effect.andThen(Effect.sleep("2 millis")),
987
+ * Effect.andThen(sink.onSuccess(2))
304
988
  * )
305
- *
306
- * // FlatMap merges all inner Fx values
307
- * const flattened = Push.flatMap(push, (n) =>
308
- * Fx.fromIterable([n, n * 2, n * 3])
989
+ * )
990
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), source)
991
+ * const latest = Push.switchMapEffect(push, (id) =>
992
+ * Effect.sleep(id === 1 ? "20 millis" : "1 millis").pipe(
993
+ * Effect.as(id),
994
+ * Effect.ensuring(Effect.sync(() => finalized.push(id)))
309
995
  * )
996
+ * )
997
+ * const program = Fx.collectAll(latest).pipe(
998
+ * Effect.map((values) => ({ values, finalized })),
999
+ * Effect.scoped
1000
+ * )
1001
+ * // Effect.runPromise(program) => { values: [2], finalized: [1, 2] }
1002
+ * ```
310
1003
  *
311
- * // All values from all inner Fx are emitted
312
- * yield* Fx.observe(flattened, (value) =>
313
- * Effect.sync(() => console.log(value))
1004
+ * @since 1.0.0
1005
+ * @category combinators
1006
+ */
1007
+ export declare const switchMapEffect: {
1008
+ <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
1009
+ <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
1010
+ };
1011
+ /**
1012
+ * Transforms each output value into an inner `Fx` and merges all inners concurrently.
1013
+ *
1014
+ * Every outer value starts one inner. All inner values are emitted; order within
1015
+ * each inner is preserved, but values from different inners may interleave. The
1016
+ * outer stream waits for all inners before normal completion. The input Sink is
1017
+ * unchanged.
1018
+ *
1019
+ * @remarks
1020
+ * ## Why
1021
+ *
1022
+ * Use concurrent flattening when every produced task matters and independent work
1023
+ * should overlap.
1024
+ *
1025
+ * ## Ownership and lifetime
1026
+ *
1027
+ * The output Scope owns a fiber set containing all active inners. Outer
1028
+ * interruption interrupts that set and runs inner cleanup. Inner failures and
1029
+ * services join the outer Fx channels; no ordering buffer is added.
1030
+ *
1031
+ * @example
1032
+ * ```ts
1033
+ * import { Effect } from "effect"
1034
+ * import * as Fx from "@typed/fx/Fx"
1035
+ * import * as Push from "@typed/fx/Push"
1036
+ * import * as Sink from "@typed/fx/Sink"
1037
+ *
1038
+ * const finalized: Array<number> = []
1039
+ * const push = Push.make(
1040
+ * Sink.make(() => Effect.void, (_: string) => Effect.void),
1041
+ * Fx.fromIterable([1, 2])
1042
+ * )
1043
+ * const merged = Push.flatMap(push, (id) =>
1044
+ * Fx.make<number>((sink) =>
1045
+ * Effect.gen(function* () {
1046
+ * yield* Effect.sleep(id === 1 ? "5 millis" : "10 millis")
1047
+ * yield* sink.onSuccess(id * 10 + 1)
1048
+ * yield* Effect.sleep("20 millis")
1049
+ * yield* sink.onSuccess(id * 10 + 2)
1050
+ * }).pipe(Effect.ensuring(Effect.sync(() => finalized.push(id))))
314
1051
  * )
315
- * })
1052
+ * )
1053
+ * const program = Fx.collectAll(merged).pipe(
1054
+ * Effect.map((values) => ({ values, finalized })),
1055
+ * Effect.scoped
1056
+ * )
1057
+ * // Effect.runPromise(program) => { values: [11, 21, 12, 22], finalized: [1, 2] }
316
1058
  * ```
317
1059
  *
318
1060
  * @since 1.0.0
@@ -322,30 +1064,313 @@ export declare const flatMap: {
322
1064
  <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
323
1065
  <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
324
1066
  };
1067
+ /**
1068
+ * Transforms every output value into an Effect and merges their results concurrently.
1069
+ *
1070
+ * One Effect starts per outer value and can emit one result. All successful
1071
+ * results are emitted, but concurrent completion order may differ from input
1072
+ * order. The input side is unchanged.
1073
+ *
1074
+ * @remarks
1075
+ * ## Why
1076
+ *
1077
+ * This runs independent Effect work concurrently without manually lifting each
1078
+ * Effect into Fx.
1079
+ *
1080
+ * ## Ownership and lifetime
1081
+ *
1082
+ * Active Effects are fibers owned by the output Scope. Completion waits for all
1083
+ * of them; interruption stops them and runs their finalizers. `E3` and `R3` join
1084
+ * the output failure and service channels.
1085
+ *
1086
+ * @example
1087
+ * ```ts
1088
+ * import { Effect } from "effect"
1089
+ * import * as Fx from "@typed/fx/Fx"
1090
+ * import * as Push from "@typed/fx/Push"
1091
+ * import * as Sink from "@typed/fx/Sink"
1092
+ *
1093
+ * const finalized: Array<number> = []
1094
+ * const push = Push.make(
1095
+ * Sink.make(() => Effect.void, (_: string) => Effect.void),
1096
+ * Fx.fromIterable([1, 2])
1097
+ * )
1098
+ * const loaded = Push.flatMapEffect(push, (id) =>
1099
+ * Effect.sleep(id === 1 ? "20 millis" : "1 millis").pipe(
1100
+ * Effect.as(id),
1101
+ * Effect.ensuring(Effect.sync(() => finalized.push(id)))
1102
+ * )
1103
+ * )
1104
+ * const program = Fx.collectAll(loaded).pipe(
1105
+ * Effect.map((values) => ({ values, finalized })),
1106
+ * Effect.scoped
1107
+ * )
1108
+ * // Effect.runPromise(program) => { values: [2, 1], finalized: [2, 1] }
1109
+ * ```
1110
+ *
1111
+ * @since 1.0.0
1112
+ * @category combinators
1113
+ */
325
1114
  export declare const flatMapEffect: {
326
1115
  <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
327
- <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, Scope.Scope | C, E2 | E3, R2 | R3>;
1116
+ <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
328
1117
  };
1118
+ /**
1119
+ * Runs at most one inner Fx and ignores outer values while it is active.
1120
+ *
1121
+ * The first value seen while idle starts an inner; every value arriving before
1122
+ * that inner completes is dropped. `f(value)` is still evaluated and its inner Fx
1123
+ * is constructed before the busy check; dropping means the returned Fx is not
1124
+ * run. Accepted inners preserve their own order and all values. Input is unchanged.
1125
+ *
1126
+ * @remarks
1127
+ * ## Why
1128
+ *
1129
+ * Exhaust semantics prevent duplicate work, such as repeated submit clicks, while
1130
+ * allowing another request after the active one completes.
1131
+ *
1132
+ * ## Ownership and lifetime
1133
+ *
1134
+ * The output Scope owns the active inner fiber, joins it before completion, and
1135
+ * interrupts it with the subscription. Inner failures and services join the
1136
+ * outer channels; there is no pending-value buffer.
1137
+ *
1138
+ * @example
1139
+ * ```ts
1140
+ * import { Effect } from "effect"
1141
+ * import * as Fx from "@typed/fx/Fx"
1142
+ * import * as Push from "@typed/fx/Push"
1143
+ * import * as Sink from "@typed/fx/Sink"
1144
+ *
1145
+ * const constructed: Array<number> = []
1146
+ * const started: Array<number> = []
1147
+ * const finalized: Array<number> = []
1148
+ * const push = Push.make(
1149
+ * Sink.make(() => Effect.void, (_: string) => Effect.void),
1150
+ * Fx.fromIterable([1, 2])
1151
+ * )
1152
+ * const exhausted = Push.exhaustMap(push, (id) => {
1153
+ * constructed.push(id)
1154
+ * return Fx.make<number>((sink) =>
1155
+ * Effect.gen(function* () {
1156
+ * yield* Effect.sync(() => started.push(id))
1157
+ * yield* Effect.sleep("5 millis")
1158
+ * yield* sink.onSuccess(id * 10 + 1)
1159
+ * yield* Effect.sleep("5 millis")
1160
+ * yield* sink.onSuccess(id * 10 + 2)
1161
+ * }).pipe(Effect.ensuring(Effect.sync(() => finalized.push(id))))
1162
+ * )
1163
+ * })
1164
+ * const program = Fx.collectAll(exhausted).pipe(
1165
+ * Effect.map((values) => ({ values, constructed, started, finalized })),
1166
+ * Effect.scoped
1167
+ * )
1168
+ * // => { values: [11, 12], constructed: [1, 2], started: [1], finalized: [1] }
1169
+ * ```
1170
+ *
1171
+ * @since 1.0.0
1172
+ * @category combinators
1173
+ */
329
1174
  export declare const exhaustMap: {
330
1175
  <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
331
1176
  <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
332
1177
  };
1178
+ /**
1179
+ * Runs at most one mapped Effect and ignores values while it is active.
1180
+ *
1181
+ * The first value while idle starts one Effect and can emit one result; all values
1182
+ * received before it completes are dropped. The mapping callback is still invoked
1183
+ * and constructs an Effect for every value before the busy check; dropped Effects
1184
+ * are not run. The input side is unchanged.
1185
+ *
1186
+ * @remarks
1187
+ * ## Why
1188
+ *
1189
+ * This guards non-overlapping Effect work without manual busy state.
1190
+ *
1191
+ * ## Ownership and lifetime
1192
+ *
1193
+ * The output Scope owns and joins the active Effect fiber. Subscription
1194
+ * interruption stops it and runs finalizers. Its errors and services join the
1195
+ * output channels; no value is buffered for later.
1196
+ *
1197
+ * @example
1198
+ * ```ts
1199
+ * import { Effect } from "effect"
1200
+ * import * as Fx from "@typed/fx/Fx"
1201
+ * import * as Push from "@typed/fx/Push"
1202
+ * import * as Sink from "@typed/fx/Sink"
1203
+ *
1204
+ * const constructed: Array<number> = []
1205
+ * const finalized: Array<number> = []
1206
+ * const push = Push.make(
1207
+ * Sink.make(() => Effect.void, (_: string) => Effect.void),
1208
+ * Fx.fromIterable([1, 2])
1209
+ * )
1210
+ * const saving = Push.exhaustMapEffect(push, (id) => {
1211
+ * constructed.push(id)
1212
+ * return Effect.sleep("10 millis").pipe(
1213
+ * Effect.as(id),
1214
+ * Effect.ensuring(Effect.sync(() => finalized.push(id)))
1215
+ * )
1216
+ * })
1217
+ * const program = Fx.collectAll(saving).pipe(
1218
+ * Effect.map((values) => ({ values, constructed, finalized })),
1219
+ * Effect.scoped
1220
+ * )
1221
+ * // Effect.runPromise(program) => { values: [1], constructed: [1, 2], finalized: [1] }
1222
+ * ```
1223
+ *
1224
+ * @since 1.0.0
1225
+ * @category combinators
1226
+ */
333
1227
  export declare const exhaustMapEffect: {
334
1228
  <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
335
- <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, Scope.Scope | C, E2 | E3, R2 | R3>;
1229
+ <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
336
1230
  };
1231
+ /**
1232
+ * Runs one inner Fx at a time and retains only the latest value received while busy.
1233
+ *
1234
+ * A value while idle starts immediately. While its inner runs, newer outer values
1235
+ * replace a single pending slot. `f(value)` is evaluated and an inner Fx is
1236
+ * constructed before every replacement; a superseded pending Fx is never run.
1237
+ * After completion, only the latest pending Fx starts. Accepted inners preserve
1238
+ * their own order and all values. The input Sink is unchanged.
1239
+ *
1240
+ * @remarks
1241
+ * ## Why
1242
+ *
1243
+ * This is useful when work must not overlap but the newest requested state must
1244
+ * eventually be processed.
1245
+ *
1246
+ * ## Ownership and lifetime
1247
+ *
1248
+ * The output Scope owns one active inner fiber and an in-memory latest slot. It
1249
+ * joins the final inner before completion and interrupts it with the subscription.
1250
+ * Inner failures and services join the output channels.
1251
+ *
1252
+ * @example
1253
+ * ```ts
1254
+ * import { Effect } from "effect"
1255
+ * import * as Fx from "@typed/fx/Fx"
1256
+ * import * as Push from "@typed/fx/Push"
1257
+ * import * as Sink from "@typed/fx/Sink"
1258
+ *
1259
+ * const constructed: Array<number> = []
1260
+ * const started: Array<number> = []
1261
+ * const finalized: Array<number> = []
1262
+ * const push = Push.make(
1263
+ * Sink.make(() => Effect.void, (_: string) => Effect.void),
1264
+ * Fx.fromIterable([1, 2, 3])
1265
+ * )
1266
+ * const latest = Push.exhaustLatestMap(push, (id) => {
1267
+ * constructed.push(id)
1268
+ * return Fx.make<number>((sink) =>
1269
+ * Effect.gen(function* () {
1270
+ * yield* Effect.sync(() => started.push(id))
1271
+ * yield* Effect.sleep("5 millis")
1272
+ * yield* sink.onSuccess(id * 10 + 1)
1273
+ * yield* Effect.sleep("5 millis")
1274
+ * yield* sink.onSuccess(id * 10 + 2)
1275
+ * }).pipe(Effect.ensuring(Effect.sync(() => finalized.push(id))))
1276
+ * )
1277
+ * })
1278
+ * const program = Fx.collectAll(latest).pipe(
1279
+ * Effect.map((values) => ({ values, constructed, started, finalized })),
1280
+ * Effect.scoped
1281
+ * )
1282
+ * // => values [11, 12, 31, 32]; constructed [1, 2, 3]; started/finalized [1, 3].
1283
+ * ```
1284
+ *
1285
+ * @since 1.0.0
1286
+ * @category combinators
1287
+ */
337
1288
  export declare const exhaustLatestMap: {
338
1289
  <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
339
1290
  <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
340
1291
  };
1292
+ /**
1293
+ * Runs one mapped Effect at a time and retains only the latest value received while busy.
1294
+ *
1295
+ * Each accepted Effect can emit one result. While it runs, one pending Effect is
1296
+ * repeatedly overwritten; after completion only the latest pending Effect starts.
1297
+ * The mapping callback still runs and constructs an Effect for every value before
1298
+ * replacement; superseded Effects are not run. The input side is unchanged.
1299
+ *
1300
+ * @remarks
1301
+ * ## Why
1302
+ *
1303
+ * This provides non-overlapping Effect work with eventual latest-state handling,
1304
+ * avoiding an unbounded queue of obsolete requests.
1305
+ *
1306
+ * ## Ownership and lifetime
1307
+ *
1308
+ * The output Scope owns the active Effect fiber and pending slot. It waits for the
1309
+ * final Effect, interrupts it with the subscription, and runs its finalizers.
1310
+ * Effect failures and services join the output channels.
1311
+ *
1312
+ * @example
1313
+ * ```ts
1314
+ * import { Effect } from "effect"
1315
+ * import * as Fx from "@typed/fx/Fx"
1316
+ * import * as Push from "@typed/fx/Push"
1317
+ * import * as Sink from "@typed/fx/Sink"
1318
+ *
1319
+ * const constructed: Array<number> = []
1320
+ * const finalized: Array<number> = []
1321
+ * const push = Push.make(
1322
+ * Sink.make(() => Effect.void, (_: string) => Effect.void),
1323
+ * Fx.fromIterable([1, 2, 3])
1324
+ * )
1325
+ * const latestSaved = Push.exhaustLatestMapEffect(push, (id) => {
1326
+ * constructed.push(id)
1327
+ * return Effect.sleep("10 millis").pipe(
1328
+ * Effect.as(id),
1329
+ * Effect.ensuring(Effect.sync(() => finalized.push(id)))
1330
+ * )
1331
+ * })
1332
+ * const program = Fx.collectAll(latestSaved).pipe(
1333
+ * Effect.map((values) => ({ values, constructed, finalized })),
1334
+ * Effect.scoped
1335
+ * )
1336
+ * // Effect.runPromise(program) => { values: [1, 3], constructed: [1, 2, 3], finalized: [1, 3] }
1337
+ * ```
1338
+ *
1339
+ * @since 1.0.0
1340
+ * @category combinators
1341
+ */
341
1342
  export declare const exhaustLatestMapEffect: {
342
1343
  <B, C, E3, R3>(f: (b: B) => Effect.Effect<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
343
- <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, Scope.Scope | C, E2 | E3, R2 | R3>;
1344
+ <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;
344
1345
  };
345
1346
  /**
346
1347
  * Maps over the output (Fx) side of a `Push` with an accumulator: for each emitted value `b`,
347
1348
  * applies `f(state, b)` to get `[nextState, emitted]` and emits the second element.
348
1349
  * The first element is the initial state; subsequent states are updated by each step.
1350
+ * It emits exactly one `C` per upstream value, in order. Accumulator state is
1351
+ * private to each output subscription; the input Sink is unchanged.
1352
+ *
1353
+ * @remarks
1354
+ * ## Why
1355
+ *
1356
+ * Stateful output projection can derive running totals or protocol state without
1357
+ * moving that state into the bidirectional input boundary.
1358
+ *
1359
+ * ## Ownership and lifetime
1360
+ *
1361
+ * Each run owns its own synchronous accumulator. It is discarded when that run
1362
+ * completes or is interrupted and acquires no Scope or external resource.
1363
+ *
1364
+ * @example
1365
+ * ```ts
1366
+ * import { Effect } from "effect"
1367
+ * import * as Fx from "@typed/fx/Fx"
1368
+ * import * as Push from "@typed/fx/Push"
1369
+ * import * as Sink from "@typed/fx/Sink"
1370
+ *
1371
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), Fx.fromIterable([1, 2, 3]))
1372
+ * const totals = Push.mapAccum(push, 0, (total, value) => [total + value, total + value] as const)
1373
+ * ```
349
1374
  *
350
1375
  * @param initial - Initial accumulator state.
351
1376
  * @param f - Reducer `(state, value) => [nextState, emitted]`.
@@ -360,6 +1385,67 @@ export declare const mapAccum: {
360
1385
  /**
361
1386
  * Maps over the output (Fx) side of a `Push` with an effectful accumulator: for each emitted value `b`,
362
1387
  * runs `f(state, b)` to get `[nextState, emitted]` and emits the second element.
1388
+ * The adapter does not serialize callbacks. Calling `onSuccess` invokes `f`
1389
+ * immediately with the current seed and constructs its Effect; overlapping calls
1390
+ * can therefore observe the same seed. Successful completion commits the returned
1391
+ * seed and emits in completion order, so later completion may overwrite newer
1392
+ * state. Reducer failure is sent to the output Sink, emits nothing, restores that
1393
+ * call's previous seed, and completes normally so a continuing producer can send
1394
+ * later values. The input Sink is unchanged.
1395
+ *
1396
+ * @remarks
1397
+ * ## Why
1398
+ *
1399
+ * Use an effectful accumulator when each transition needs services or can fail,
1400
+ * while keeping state local to observation rather than global application state.
1401
+ *
1402
+ * ## Ownership and lifetime
1403
+ *
1404
+ * Each output run owns one mutable seed, but concurrent producer callbacks may
1405
+ * race over it; callers needing serialized state transitions must serialize the
1406
+ * upstream deliveries. Each callback fiber runs and interrupts its own reducer
1407
+ * Effect. `E3` and `R3` join the output channels. State is discarded when the
1408
+ * subscription ends.
1409
+ *
1410
+ * @example
1411
+ * ```ts
1412
+ * import { Effect } from "effect"
1413
+ * import * as Fx from "@typed/fx/Fx"
1414
+ * import * as Push from "@typed/fx/Push"
1415
+ * import * as Sink from "@typed/fx/Sink"
1416
+ *
1417
+ * const concurrent = Fx.make<number>((sink) =>
1418
+ * Effect.all([sink.onSuccess(1), sink.onSuccess(2)], {
1419
+ * concurrency: "unbounded",
1420
+ * discard: true
1421
+ * })
1422
+ * )
1423
+ * const push = Push.make(Sink.make(() => Effect.void, (_: string) => Effect.void), concurrent)
1424
+ * const totals = Push.mapAccumEffect(push, 0, (seed, value) =>
1425
+ * Effect.sleep(value === 1 ? "20 millis" : "1 millis").pipe(
1426
+ * Effect.as([seed + value, seed + value] as const)
1427
+ * )
1428
+ * )
1429
+ * const program = Fx.collectAll(totals).pipe(Effect.scoped)
1430
+ * // Both reducers see seed 0; Effect.runPromise(program) resolves to [2, 1].
1431
+ *
1432
+ * const values: Array<number> = []
1433
+ * let failures = 0
1434
+ * const sequential = Push.make(
1435
+ * Sink.make(() => Effect.void, (_: string) => Effect.void),
1436
+ * Fx.fromIterable([1, 2, 3])
1437
+ * )
1438
+ * const continued = Push.mapAccumEffect(sequential, 0, (seed, value) =>
1439
+ * value === 2
1440
+ * ? Effect.fail("rejected" as const)
1441
+ * : Effect.succeed([seed + value, seed + value] as const)
1442
+ * )
1443
+ * const recovery = continued.run(Sink.make(
1444
+ * () => Effect.sync(() => { failures += 1 }),
1445
+ * (value) => Effect.sync(() => values.push(value))
1446
+ * ))
1447
+ * // Effect.runPromise(recovery) leaves values [1, 4] and failures 1.
1448
+ * ```
363
1449
  *
364
1450
  * @param initial - Initial accumulator state.
365
1451
  * @param f - Effectful reducer `(state, value) => Effect<[nextState, emitted]>`.
@@ -371,5 +1457,44 @@ export declare const mapAccumEffect: {
371
1457
  <S, B, C, E3, R3>(initial: S, f: (s: S, b: B) => Effect.Effect<readonly [S, C], E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3>;
372
1458
  <A, E, R, B, E2, R2, S, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, initial: S, f: (s: S, b: B) => Effect.Effect<readonly [S, C], E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3>;
373
1459
  };
1460
+ /**
1461
+ * Defines a named Effect service whose value is a `Push`.
1462
+ *
1463
+ * The returned class exposes `onSuccess`, `onFailure`, and `run` as Effects that
1464
+ * first resolve the service from Context. `make` captures the Sink construction
1465
+ * context and combines it with each output subscriber's context; it does not start
1466
+ * the Fx or send an input while building the Layer.
1467
+ *
1468
+ * @remarks
1469
+ * ## Why
1470
+ *
1471
+ * A service gives a bidirectional application capability one stable identity, so
1472
+ * producers and observers can depend on it through ordinary Effect requirements.
1473
+ *
1474
+ * ## Ownership and lifetime
1475
+ *
1476
+ * The returned Layer owns service installation and captures non-Scope services
1477
+ * needed by both sides. Output runs retain the caller's Scope and interruption;
1478
+ * input acknowledgment Effects run in their caller. Layer release drops the
1479
+ * service but does not invent cleanup beyond the supplied Sink and Fx.
1480
+ *
1481
+ * @example
1482
+ * ```ts
1483
+ * import { Effect, Layer } from "effect"
1484
+ * import * as Fx from "@typed/fx/Fx"
1485
+ * import * as Push from "@typed/fx/Push"
1486
+ * import * as Sink from "@typed/fx/Sink"
1487
+ *
1488
+ * class Messages extends Push.Service<Messages, string, never, string>()("Messages") {}
1489
+ * const MessagesLive = Messages.make(
1490
+ * Sink.make(() => Effect.void, (message) => Effect.log(message)),
1491
+ * Fx.succeed("ready")
1492
+ * )
1493
+ * const send = Messages.onSuccess("hello").pipe(Effect.provide(MessagesLive))
1494
+ * ```
1495
+ *
1496
+ * @since 1.0.0
1497
+ * @category services
1498
+ */
374
1499
  export declare function Service<Self, A, E = never, B = never, E2 = never>(): <const Id extends string>(id: Id) => Push.Class<Self, Id, A, E, B, E2>;
375
1500
  //# sourceMappingURL=Push.d.ts.map