@typed/fx 1.32.0 → 2.0.0-beta.0

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 (818) hide show
  1. package/README.md +344 -2
  2. package/dist/Fx/Fx.d.ts +96 -0
  3. package/dist/Fx/Fx.d.ts.map +1 -0
  4. package/dist/Fx/Fx.js +35 -0
  5. package/dist/Fx/TypeId.d.ts +20 -0
  6. package/dist/Fx/TypeId.d.ts.map +1 -0
  7. package/dist/Fx/TypeId.js +15 -0
  8. package/dist/Fx/combinators/catch.d.ts +53 -0
  9. package/dist/Fx/combinators/catch.d.ts.map +1 -0
  10. package/dist/Fx/combinators/catch.js +69 -0
  11. package/dist/Fx/combinators/causes.d.ts +12 -0
  12. package/dist/Fx/combinators/causes.d.ts.map +1 -0
  13. package/dist/Fx/combinators/causes.js +16 -0
  14. package/dist/Fx/combinators/compact.d.ts +12 -0
  15. package/dist/Fx/combinators/compact.d.ts.map +1 -0
  16. package/dist/Fx/combinators/compact.js +11 -0
  17. package/dist/Fx/combinators/continueWith.d.ts +51 -0
  18. package/dist/Fx/combinators/continueWith.d.ts.map +1 -0
  19. package/dist/Fx/combinators/continueWith.js +41 -0
  20. package/dist/Fx/combinators/ensuring.d.ts +16 -0
  21. package/dist/Fx/combinators/ensuring.d.ts.map +1 -0
  22. package/dist/Fx/combinators/ensuring.js +13 -0
  23. package/dist/Fx/combinators/exhaustLatestMap.d.ts +15 -0
  24. package/dist/Fx/combinators/exhaustLatestMap.d.ts.map +1 -0
  25. package/dist/Fx/combinators/exhaustLatestMap.js +48 -0
  26. package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts +13 -0
  27. package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts.map +1 -0
  28. package/dist/Fx/combinators/exhaustLatestMapEffect.js +14 -0
  29. package/dist/Fx/combinators/exhaustMap.d.ts +11 -0
  30. package/dist/Fx/combinators/exhaustMap.d.ts.map +1 -0
  31. package/dist/Fx/combinators/exhaustMap.js +19 -0
  32. package/dist/Fx/combinators/exhaustMapEffect.d.ts +11 -0
  33. package/dist/Fx/combinators/exhaustMapEffect.d.ts.map +1 -0
  34. package/dist/Fx/combinators/exhaustMapEffect.js +12 -0
  35. package/dist/Fx/combinators/exit.d.ts +12 -0
  36. package/dist/Fx/combinators/exit.d.ts.map +1 -0
  37. package/dist/Fx/combinators/exit.js +11 -0
  38. package/dist/Fx/combinators/filter.d.ts +14 -0
  39. package/dist/Fx/combinators/filter.d.ts.map +1 -0
  40. package/dist/Fx/combinators/filter.js +12 -0
  41. package/dist/Fx/combinators/filterEffect.d.ts +15 -0
  42. package/dist/Fx/combinators/filterEffect.d.ts.map +1 -0
  43. package/dist/Fx/combinators/filterEffect.js +12 -0
  44. package/dist/Fx/combinators/filterMap.d.ts +15 -0
  45. package/dist/Fx/combinators/filterMap.d.ts.map +1 -0
  46. package/dist/Fx/combinators/filterMap.js +12 -0
  47. package/dist/Fx/combinators/filterMapEffect.d.ts +16 -0
  48. package/dist/Fx/combinators/filterMapEffect.d.ts.map +1 -0
  49. package/dist/Fx/combinators/filterMapEffect.js +12 -0
  50. package/dist/Fx/combinators/filterMapLoop.d.ts +17 -0
  51. package/dist/Fx/combinators/filterMapLoop.d.ts.map +1 -0
  52. package/dist/Fx/combinators/filterMapLoop.js +14 -0
  53. package/dist/Fx/combinators/filterMapLoopCause.d.ts +18 -0
  54. package/dist/Fx/combinators/filterMapLoopCause.d.ts.map +1 -0
  55. package/dist/Fx/combinators/filterMapLoopCause.js +14 -0
  56. package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts +18 -0
  57. package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts.map +1 -0
  58. package/dist/Fx/combinators/filterMapLoopCauseEffect.js +13 -0
  59. package/dist/Fx/combinators/filterMapLoopEffect.d.ts +17 -0
  60. package/dist/Fx/combinators/filterMapLoopEffect.d.ts.map +1 -0
  61. package/dist/Fx/combinators/filterMapLoopEffect.js +13 -0
  62. package/dist/Fx/combinators/flatMap.d.ts +23 -0
  63. package/dist/Fx/combinators/flatMap.d.ts.map +1 -0
  64. package/dist/Fx/combinators/flatMap.js +21 -0
  65. package/dist/Fx/combinators/flatMapConcurrently.d.ts +12 -0
  66. package/dist/Fx/combinators/flatMapConcurrently.d.ts.map +1 -0
  67. package/dist/Fx/combinators/flatMapConcurrently.js +22 -0
  68. package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts +12 -0
  69. package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts.map +1 -0
  70. package/dist/Fx/combinators/flatMapConcurrentlyEffect.js +13 -0
  71. package/dist/Fx/combinators/flatMapEffect.d.ts +24 -0
  72. package/dist/Fx/combinators/flatMapEffect.d.ts.map +1 -0
  73. package/dist/Fx/combinators/flatMapEffect.js +14 -0
  74. package/dist/Fx/combinators/flip.d.ts +11 -0
  75. package/dist/Fx/combinators/flip.d.ts.map +1 -0
  76. package/dist/Fx/combinators/flip.js +11 -0
  77. package/dist/Fx/combinators/gen.d.ts +20 -0
  78. package/dist/Fx/combinators/gen.d.ts.map +1 -0
  79. package/dist/Fx/combinators/gen.js +14 -0
  80. package/dist/Fx/combinators/genScoped.d.ts +20 -0
  81. package/dist/Fx/combinators/genScoped.d.ts.map +1 -0
  82. package/dist/Fx/combinators/genScoped.js +13 -0
  83. package/dist/Fx/combinators/index.d.ts +52 -0
  84. package/dist/Fx/combinators/index.d.ts.map +1 -0
  85. package/dist/Fx/combinators/index.js +51 -0
  86. package/dist/Fx/combinators/keyed.d.ts +44 -0
  87. package/dist/Fx/combinators/keyed.d.ts.map +1 -0
  88. package/dist/Fx/combinators/keyed.js +199 -0
  89. package/dist/Fx/combinators/loop.d.ts +16 -0
  90. package/dist/Fx/combinators/loop.d.ts.map +1 -0
  91. package/dist/Fx/combinators/loop.js +14 -0
  92. package/dist/Fx/combinators/loopCause.d.ts +16 -0
  93. package/dist/Fx/combinators/loopCause.d.ts.map +1 -0
  94. package/dist/Fx/combinators/loopCause.js +13 -0
  95. package/dist/Fx/combinators/loopCauseEffect.d.ts +17 -0
  96. package/dist/Fx/combinators/loopCauseEffect.d.ts.map +1 -0
  97. package/dist/Fx/combinators/loopCauseEffect.js +13 -0
  98. package/dist/Fx/combinators/loopEffect.d.ts +16 -0
  99. package/dist/Fx/combinators/loopEffect.d.ts.map +1 -0
  100. package/dist/Fx/combinators/loopEffect.js +13 -0
  101. package/dist/Fx/combinators/map.d.ts +14 -0
  102. package/dist/Fx/combinators/map.d.ts.map +1 -0
  103. package/dist/Fx/combinators/map.js +12 -0
  104. package/dist/Fx/combinators/mapEffect.d.ts +15 -0
  105. package/dist/Fx/combinators/mapEffect.d.ts.map +1 -0
  106. package/dist/Fx/combinators/mapEffect.js +12 -0
  107. package/dist/Fx/combinators/mergeAll.d.ts +11 -0
  108. package/dist/Fx/combinators/mergeAll.d.ts.map +1 -0
  109. package/dist/Fx/combinators/mergeAll.js +15 -0
  110. package/dist/Fx/combinators/mergeOrdered.d.ts +14 -0
  111. package/dist/Fx/combinators/mergeOrdered.d.ts.map +1 -0
  112. package/dist/Fx/combinators/mergeOrdered.js +89 -0
  113. package/dist/Fx/combinators/onError.d.ts +17 -0
  114. package/dist/Fx/combinators/onError.d.ts.map +1 -0
  115. package/dist/Fx/combinators/onError.js +14 -0
  116. package/dist/Fx/combinators/onExit.d.ts +16 -0
  117. package/dist/Fx/combinators/onExit.d.ts.map +1 -0
  118. package/dist/Fx/combinators/onExit.js +39 -0
  119. package/dist/Fx/combinators/onInterrupt.d.ts +16 -0
  120. package/dist/Fx/combinators/onInterrupt.d.ts.map +1 -0
  121. package/dist/Fx/combinators/onInterrupt.js +38 -0
  122. package/dist/Fx/combinators/provide.d.ts +23 -0
  123. package/dist/Fx/combinators/provide.d.ts.map +1 -0
  124. package/dist/Fx/combinators/provide.js +27 -0
  125. package/dist/Fx/combinators/skip.d.ts +14 -0
  126. package/dist/Fx/combinators/skip.d.ts.map +1 -0
  127. package/dist/Fx/combinators/skip.js +11 -0
  128. package/dist/Fx/combinators/skipRepeats.d.ts +11 -0
  129. package/dist/Fx/combinators/skipRepeats.d.ts.map +1 -0
  130. package/dist/Fx/combinators/skipRepeats.js +12 -0
  131. package/dist/Fx/combinators/skipRepeatsWith.d.ts +12 -0
  132. package/dist/Fx/combinators/skipRepeatsWith.d.ts.map +1 -0
  133. package/dist/Fx/combinators/skipRepeatsWith.js +20 -0
  134. package/dist/Fx/combinators/slice.d.ts +23 -0
  135. package/dist/Fx/combinators/slice.d.ts.map +1 -0
  136. package/dist/Fx/combinators/slice.js +12 -0
  137. package/dist/Fx/combinators/switchMap.d.ts +13 -0
  138. package/dist/Fx/combinators/switchMap.d.ts.map +1 -0
  139. package/dist/Fx/combinators/switchMap.js +33 -0
  140. package/dist/Fx/combinators/switchMapEffect.d.ts +13 -0
  141. package/dist/Fx/combinators/switchMapEffect.d.ts.map +1 -0
  142. package/dist/Fx/combinators/switchMapEffect.js +14 -0
  143. package/dist/Fx/combinators/take.d.ts +14 -0
  144. package/dist/Fx/combinators/take.d.ts.map +1 -0
  145. package/dist/Fx/combinators/take.js +11 -0
  146. package/dist/Fx/combinators/takeUntil.d.ts +28 -0
  147. package/dist/Fx/combinators/takeUntil.d.ts.map +1 -0
  148. package/dist/Fx/combinators/takeUntil.js +31 -0
  149. package/dist/Fx/combinators/tapEffect.d.ts +15 -0
  150. package/dist/Fx/combinators/tapEffect.d.ts.map +1 -0
  151. package/dist/Fx/combinators/tapEffect.js +18 -0
  152. package/dist/Fx/combinators/tuple.d.ts +27 -0
  153. package/dist/Fx/combinators/tuple.d.ts.map +1 -0
  154. package/dist/Fx/combinators/tuple.js +46 -0
  155. package/dist/Fx/combinators/unwrap.d.ts +12 -0
  156. package/dist/Fx/combinators/unwrap.d.ts.map +1 -0
  157. package/dist/Fx/combinators/unwrap.js +14 -0
  158. package/dist/Fx/combinators/unwrapScoped.d.ts +15 -0
  159. package/dist/Fx/combinators/unwrapScoped.d.ts.map +1 -0
  160. package/dist/Fx/combinators/unwrapScoped.js +16 -0
  161. package/dist/Fx/combinators/when.d.ts +36 -0
  162. package/dist/Fx/combinators/when.d.ts.map +1 -0
  163. package/dist/Fx/combinators/when.js +28 -0
  164. package/dist/Fx/combinators/withSpan.d.ts +4 -0
  165. package/dist/Fx/combinators/withSpan.d.ts.map +1 -0
  166. package/dist/Fx/combinators/withSpan.js +6 -0
  167. package/dist/Fx/constructors/at.d.ts +16 -0
  168. package/dist/Fx/constructors/at.d.ts.map +1 -0
  169. package/dist/Fx/constructors/at.js +13 -0
  170. package/dist/Fx/constructors/die.d.ts +11 -0
  171. package/dist/Fx/constructors/die.d.ts.map +1 -0
  172. package/dist/Fx/constructors/die.js +12 -0
  173. package/dist/Fx/constructors/empty.d.ts +8 -0
  174. package/dist/Fx/constructors/empty.d.ts.map +1 -0
  175. package/dist/Fx/constructors/empty.js +8 -0
  176. package/dist/Fx/constructors/fail.d.ts +11 -0
  177. package/dist/Fx/constructors/fail.d.ts.map +1 -0
  178. package/dist/Fx/constructors/fail.js +12 -0
  179. package/dist/Fx/constructors/failCause.d.ts +12 -0
  180. package/dist/Fx/constructors/failCause.d.ts.map +1 -0
  181. package/dist/Fx/constructors/failCause.js +11 -0
  182. package/dist/Fx/constructors/fn.d.ts +47 -0
  183. package/dist/Fx/constructors/fn.d.ts.map +1 -0
  184. package/dist/Fx/constructors/fn.js +23 -0
  185. package/dist/Fx/constructors/fromEffect.d.ts +21 -0
  186. package/dist/Fx/constructors/fromEffect.d.ts.map +1 -0
  187. package/dist/Fx/constructors/fromEffect.js +21 -0
  188. package/dist/Fx/constructors/fromFailures.d.ts +10 -0
  189. package/dist/Fx/constructors/fromFailures.d.ts.map +1 -0
  190. package/dist/Fx/constructors/fromFailures.js +13 -0
  191. package/dist/Fx/constructors/fromIterable.d.ts +12 -0
  192. package/dist/Fx/constructors/fromIterable.d.ts.map +1 -0
  193. package/dist/Fx/constructors/fromIterable.js +12 -0
  194. package/dist/Fx/constructors/fromSchedule.d.ts +13 -0
  195. package/dist/Fx/constructors/fromSchedule.d.ts.map +1 -0
  196. package/dist/Fx/constructors/fromSchedule.js +13 -0
  197. package/dist/Fx/constructors/fromYieldable.d.ts +12 -0
  198. package/dist/Fx/constructors/fromYieldable.d.ts.map +1 -0
  199. package/dist/Fx/constructors/fromYieldable.js +12 -0
  200. package/dist/Fx/constructors/index.d.ts +16 -0
  201. package/dist/Fx/constructors/index.d.ts.map +1 -0
  202. package/dist/Fx/constructors/index.js +15 -0
  203. package/dist/Fx/constructors/interrupt.d.ts +10 -0
  204. package/dist/Fx/constructors/interrupt.d.ts.map +1 -0
  205. package/dist/Fx/constructors/interrupt.js +12 -0
  206. package/dist/Fx/constructors/make.d.ts +40 -0
  207. package/dist/Fx/constructors/make.d.ts.map +1 -0
  208. package/dist/Fx/constructors/make.js +61 -0
  209. package/dist/Fx/constructors/periodic.d.ts +12 -0
  210. package/dist/Fx/constructors/periodic.d.ts.map +1 -0
  211. package/dist/Fx/constructors/periodic.js +12 -0
  212. package/dist/Fx/constructors/succeed.d.ts +32 -0
  213. package/dist/Fx/constructors/succeed.d.ts.map +1 -0
  214. package/dist/Fx/constructors/succeed.js +32 -0
  215. package/dist/Fx/constructors/suspend.d.ts +3 -0
  216. package/dist/Fx/constructors/suspend.d.ts.map +1 -0
  217. package/dist/Fx/constructors/suspend.js +3 -0
  218. package/dist/Fx/index.d.ts +7 -0
  219. package/dist/Fx/index.d.ts.map +1 -0
  220. package/dist/Fx/index.js +6 -0
  221. package/dist/Fx/internal/DeferredRef.d.ts +29 -0
  222. package/dist/Fx/internal/DeferredRef.d.ts.map +1 -0
  223. package/dist/{esm → Fx}/internal/DeferredRef.js +21 -15
  224. package/dist/Fx/internal/UnionToTuple.d.ts.map +1 -0
  225. package/dist/Fx/internal/UnionToTuple.js +1 -0
  226. package/dist/{dts → Fx}/internal/diff.d.ts +3 -1
  227. package/dist/Fx/internal/diff.d.ts.map +1 -0
  228. package/dist/{esm → Fx}/internal/diff.js +37 -23
  229. package/dist/Fx/internal/equivalence.d.ts +4 -0
  230. package/dist/Fx/internal/equivalence.d.ts.map +1 -0
  231. package/dist/Fx/internal/equivalence.js +10 -0
  232. package/dist/Fx/internal/multicast.d.ts +10 -0
  233. package/dist/Fx/internal/multicast.d.ts.map +1 -0
  234. package/dist/Fx/internal/multicast.js +32 -0
  235. package/dist/Fx/internal/ring-buffer.d.ts +14 -0
  236. package/dist/Fx/internal/ring-buffer.d.ts.map +1 -0
  237. package/dist/Fx/internal/ring-buffer.js +52 -0
  238. package/dist/Fx/internal/scope.d.ts +11 -0
  239. package/dist/Fx/internal/scope.d.ts.map +1 -0
  240. package/dist/Fx/internal/scope.js +12 -0
  241. package/dist/Fx/internal/yieldable.d.ts +17 -0
  242. package/dist/Fx/internal/yieldable.d.ts.map +1 -0
  243. package/dist/Fx/internal/yieldable.js +20 -0
  244. package/dist/Fx/run/collect.d.ts +45 -0
  245. package/dist/Fx/run/collect.d.ts.map +1 -0
  246. package/dist/Fx/run/collect.js +51 -0
  247. package/dist/Fx/run/first.d.ts +14 -0
  248. package/dist/Fx/run/first.d.ts.map +1 -0
  249. package/dist/Fx/run/first.js +16 -0
  250. package/dist/Fx/run/fork.d.ts +29 -0
  251. package/dist/Fx/run/fork.d.ts.map +1 -0
  252. package/dist/Fx/run/fork.js +27 -0
  253. package/dist/Fx/run/index.d.ts +6 -0
  254. package/dist/Fx/run/index.d.ts.map +1 -0
  255. package/dist/Fx/run/index.js +5 -0
  256. package/dist/Fx/run/observe.d.ts +53 -0
  257. package/dist/Fx/run/observe.d.ts.map +1 -0
  258. package/dist/Fx/run/observe.js +55 -0
  259. package/dist/Fx/run/runPromise.d.ts +25 -0
  260. package/dist/Fx/run/runPromise.d.ts.map +1 -0
  261. package/dist/Fx/run/runPromise.js +23 -0
  262. package/dist/Fx/stream.d.ts +7 -0
  263. package/dist/Fx/stream.d.ts.map +1 -0
  264. package/dist/Fx/stream.js +7 -0
  265. package/dist/Fx.d.ts +2 -0
  266. package/dist/Fx.d.ts.map +1 -0
  267. package/dist/Fx.js +1 -0
  268. package/dist/Push/Push.d.ts +312 -0
  269. package/dist/Push/Push.d.ts.map +1 -0
  270. package/dist/Push/Push.js +289 -0
  271. package/dist/Push/index.d.ts +2 -0
  272. package/dist/Push/index.d.ts.map +1 -0
  273. package/dist/Push/index.js +1 -0
  274. package/dist/Push.d.ts +2 -0
  275. package/dist/Push.d.ts.map +1 -0
  276. package/dist/Push.js +1 -0
  277. package/dist/{dts → RefSubject}/RefArray.d.ts +68 -18
  278. package/dist/RefSubject/RefArray.d.ts.map +1 -0
  279. package/dist/{esm → RefSubject}/RefArray.js +80 -12
  280. package/dist/RefSubject/RefBigDecimal.d.ts +183 -0
  281. package/dist/RefSubject/RefBigDecimal.d.ts.map +1 -0
  282. package/dist/RefSubject/RefBigDecimal.js +161 -0
  283. package/dist/RefSubject/RefBigInt.d.ts +138 -0
  284. package/dist/RefSubject/RefBigInt.d.ts.map +1 -0
  285. package/dist/RefSubject/RefBigInt.js +126 -0
  286. package/dist/RefSubject/RefBoolean.d.ts +135 -0
  287. package/dist/RefSubject/RefBoolean.d.ts.map +1 -0
  288. package/dist/RefSubject/RefBoolean.js +124 -0
  289. package/dist/RefSubject/RefCause.d.ts +100 -0
  290. package/dist/RefSubject/RefCause.d.ts.map +1 -0
  291. package/dist/RefSubject/RefCause.js +93 -0
  292. package/dist/{dts → RefSubject}/RefChunk.d.ts +157 -71
  293. package/dist/RefSubject/RefChunk.d.ts.map +1 -0
  294. package/dist/{esm → RefSubject}/RefChunk.js +142 -52
  295. package/dist/RefSubject/RefDateTime.d.ts +155 -0
  296. package/dist/RefSubject/RefDateTime.d.ts.map +1 -0
  297. package/dist/RefSubject/RefDateTime.js +101 -0
  298. package/dist/RefSubject/RefDuration.d.ts +126 -0
  299. package/dist/RefSubject/RefDuration.d.ts.map +1 -0
  300. package/dist/RefSubject/RefDuration.js +115 -0
  301. package/dist/RefSubject/RefGraph.d.ts +239 -0
  302. package/dist/RefSubject/RefGraph.d.ts.map +1 -0
  303. package/dist/RefSubject/RefGraph.js +272 -0
  304. package/dist/RefSubject/RefHashMap.d.ts +228 -0
  305. package/dist/RefSubject/RefHashMap.d.ts.map +1 -0
  306. package/dist/RefSubject/RefHashMap.js +212 -0
  307. package/dist/RefSubject/RefHashRing.d.ts +123 -0
  308. package/dist/RefSubject/RefHashRing.d.ts.map +1 -0
  309. package/dist/RefSubject/RefHashRing.js +115 -0
  310. package/dist/RefSubject/RefHashSet.d.ts +179 -0
  311. package/dist/RefSubject/RefHashSet.d.ts.map +1 -0
  312. package/dist/RefSubject/RefHashSet.js +164 -0
  313. package/dist/RefSubject/RefIterable.d.ts +257 -0
  314. package/dist/RefSubject/RefIterable.d.ts.map +1 -0
  315. package/dist/RefSubject/RefIterable.js +237 -0
  316. package/dist/RefSubject/RefOption.d.ts +124 -0
  317. package/dist/RefSubject/RefOption.d.ts.map +1 -0
  318. package/dist/RefSubject/RefOption.js +115 -0
  319. package/dist/RefSubject/RefRecord.d.ts +264 -0
  320. package/dist/RefSubject/RefRecord.d.ts.map +1 -0
  321. package/dist/RefSubject/RefRecord.js +249 -0
  322. package/dist/RefSubject/RefResult.d.ts +121 -0
  323. package/dist/RefSubject/RefResult.d.ts.map +1 -0
  324. package/dist/RefSubject/RefResult.js +107 -0
  325. package/dist/RefSubject/RefString.d.ts +147 -0
  326. package/dist/RefSubject/RefString.d.ts.map +1 -0
  327. package/dist/RefSubject/RefString.js +137 -0
  328. package/dist/RefSubject/RefStruct.d.ts +123 -0
  329. package/dist/RefSubject/RefStruct.d.ts.map +1 -0
  330. package/dist/RefSubject/RefStruct.js +113 -0
  331. package/dist/RefSubject/RefSubject.d.ts +1010 -0
  332. package/dist/RefSubject/RefSubject.d.ts.map +1 -0
  333. package/dist/RefSubject/RefSubject.js +1310 -0
  334. package/dist/RefSubject/RefTrie.d.ts +216 -0
  335. package/dist/RefSubject/RefTrie.d.ts.map +1 -0
  336. package/dist/RefSubject/RefTrie.js +201 -0
  337. package/dist/RefSubject/RefTuple.d.ts +107 -0
  338. package/dist/RefSubject/RefTuple.d.ts.map +1 -0
  339. package/dist/RefSubject/RefTuple.js +94 -0
  340. package/dist/RefSubject/index.d.ts +22 -0
  341. package/dist/RefSubject/index.d.ts.map +1 -0
  342. package/dist/RefSubject/index.js +21 -0
  343. package/dist/RefSubject.d.ts +2 -0
  344. package/dist/RefSubject.d.ts.map +1 -0
  345. package/dist/RefSubject.js +1 -0
  346. package/dist/Sink/Sink.d.ts +94 -0
  347. package/dist/Sink/Sink.d.ts.map +1 -0
  348. package/dist/Sink/Sink.js +34 -0
  349. package/dist/Sink/combinators.d.ts +171 -0
  350. package/dist/Sink/combinators.d.ts.map +1 -0
  351. package/dist/{esm/Sink.js → Sink/combinators.js} +265 -352
  352. package/dist/Sink/index.d.ts +3 -0
  353. package/dist/Sink/index.d.ts.map +1 -0
  354. package/dist/Sink/index.js +2 -0
  355. package/dist/Sink.d.ts +2 -0
  356. package/dist/Sink.d.ts.map +1 -0
  357. package/dist/Sink.js +1 -0
  358. package/dist/Subject/Subject.d.ts +152 -0
  359. package/dist/Subject/Subject.d.ts.map +1 -0
  360. package/dist/Subject/Subject.js +272 -0
  361. package/dist/Subject/index.d.ts +2 -0
  362. package/dist/Subject/index.d.ts.map +1 -0
  363. package/dist/Subject/index.js +1 -0
  364. package/dist/Subject.d.ts +2 -0
  365. package/dist/Subject.d.ts.map +1 -0
  366. package/dist/Subject.js +1 -0
  367. package/dist/Versioned/Versioned.d.ts +176 -0
  368. package/dist/Versioned/Versioned.d.ts.map +1 -0
  369. package/dist/Versioned/Versioned.js +228 -0
  370. package/dist/Versioned/index.d.ts +2 -0
  371. package/dist/Versioned/index.d.ts.map +1 -0
  372. package/dist/Versioned/index.js +1 -0
  373. package/dist/Versioned.d.ts +2 -0
  374. package/dist/Versioned.d.ts.map +1 -0
  375. package/dist/Versioned.js +1 -0
  376. package/dist/index.d.ts +8 -0
  377. package/dist/index.d.ts.map +1 -0
  378. package/dist/index.js +7 -0
  379. package/package.json +19 -192
  380. package/src/Fx/Fx.ts +164 -0
  381. package/src/Fx/TypeId.ts +25 -0
  382. package/src/Fx/combinators/catch.ts +165 -0
  383. package/src/Fx/combinators/causes.ts +23 -0
  384. package/src/Fx/combinators/compact.ts +15 -0
  385. package/src/Fx/combinators/continueWith.ts +78 -0
  386. package/src/Fx/combinators/ensuring.ts +23 -0
  387. package/src/Fx/combinators/exhaustLatestMap.ts +74 -0
  388. package/src/Fx/combinators/exhaustLatestMapEffect.ts +25 -0
  389. package/src/Fx/combinators/exhaustMap.ts +36 -0
  390. package/src/Fx/combinators/exhaustMapEffect.ts +23 -0
  391. package/src/Fx/combinators/exit.ts +15 -0
  392. package/src/Fx/combinators/filter.ts +22 -0
  393. package/src/Fx/combinators/filterEffect.ts +31 -0
  394. package/src/Fx/combinators/filterMap.ts +23 -0
  395. package/src/Fx/combinators/filterMapEffect.ts +32 -0
  396. package/src/Fx/combinators/filterMapLoop.ts +35 -0
  397. package/src/Fx/combinators/filterMapLoopCause.ts +36 -0
  398. package/src/Fx/combinators/filterMapLoopCauseEffect.ts +46 -0
  399. package/src/Fx/combinators/filterMapLoopEffect.ts +36 -0
  400. package/src/Fx/combinators/flatMap.ts +51 -0
  401. package/src/Fx/combinators/flatMapConcurrently.ts +36 -0
  402. package/src/Fx/combinators/flatMapConcurrentlyEffect.ts +26 -0
  403. package/src/Fx/combinators/flatMapEffect.ts +42 -0
  404. package/src/Fx/combinators/flip.ts +14 -0
  405. package/src/Fx/combinators/gen.ts +24 -0
  406. package/src/Fx/combinators/genScoped.ts +24 -0
  407. package/src/Fx/combinators/index.ts +51 -0
  408. package/src/Fx/combinators/keyed.ts +369 -0
  409. package/src/Fx/combinators/loop.ts +27 -0
  410. package/src/Fx/combinators/loopCause.ts +34 -0
  411. package/src/Fx/combinators/loopCauseEffect.ts +36 -0
  412. package/src/Fx/combinators/loopEffect.ts +34 -0
  413. package/src/Fx/combinators/map.ts +22 -0
  414. package/src/Fx/combinators/mapEffect.ts +32 -0
  415. package/src/Fx/combinators/mergeAll.ts +22 -0
  416. package/src/Fx/combinators/mergeOrdered.ts +123 -0
  417. package/src/Fx/combinators/onError.ts +40 -0
  418. package/src/Fx/combinators/onExit.ts +82 -0
  419. package/src/Fx/combinators/onInterrupt.ts +87 -0
  420. package/src/Fx/combinators/provide.ts +62 -0
  421. package/src/Fx/combinators/skip.ts +20 -0
  422. package/src/Fx/combinators/skipRepeats.ts +15 -0
  423. package/src/Fx/combinators/skipRepeatsWith.ts +40 -0
  424. package/src/Fx/combinators/slice.ts +32 -0
  425. package/src/Fx/combinators/switchMap.ts +55 -0
  426. package/src/Fx/combinators/switchMapEffect.ts +25 -0
  427. package/src/Fx/combinators/take.ts +17 -0
  428. package/src/Fx/combinators/takeUntil.ts +50 -0
  429. package/src/Fx/combinators/tapEffect.ts +39 -0
  430. package/src/Fx/combinators/tuple.ts +79 -0
  431. package/src/Fx/combinators/unwrap.ts +21 -0
  432. package/src/Fx/combinators/unwrapScoped.ts +26 -0
  433. package/src/Fx/combinators/when.ts +64 -0
  434. package/src/Fx/combinators/withSpan.ts +24 -0
  435. package/src/Fx/constructors/at.ts +23 -0
  436. package/src/Fx/constructors/die.ts +17 -0
  437. package/src/Fx/constructors/empty.ts +10 -0
  438. package/src/Fx/constructors/fail.ts +14 -0
  439. package/src/Fx/constructors/failCause.ts +14 -0
  440. package/src/Fx/constructors/fn.ts +245 -0
  441. package/src/Fx/constructors/fromEffect.ts +24 -0
  442. package/src/Fx/constructors/fromFailures.ts +19 -0
  443. package/src/Fx/constructors/fromIterable.ts +15 -0
  444. package/src/Fx/constructors/fromSchedule.ts +18 -0
  445. package/src/Fx/constructors/fromYieldable.ts +17 -0
  446. package/src/Fx/constructors/index.ts +15 -0
  447. package/src/Fx/constructors/interrupt.ts +13 -0
  448. package/src/Fx/constructors/make.ts +103 -0
  449. package/src/Fx/constructors/periodic.ts +15 -0
  450. package/src/Fx/constructors/succeed.ts +37 -0
  451. package/src/Fx/constructors/suspend.ts +6 -0
  452. package/src/Fx/index.ts +6 -0
  453. package/src/Fx/internal/DeferredRef.ts +87 -0
  454. package/src/Fx/internal/UnionToTuple.ts +12 -0
  455. package/src/Fx/internal/diff.ts +191 -0
  456. package/src/Fx/internal/equivalence.ts +12 -0
  457. package/src/Fx/internal/multicast.ts +51 -0
  458. package/src/Fx/internal/ring-buffer.ts +60 -0
  459. package/src/Fx/internal/scope.ts +58 -0
  460. package/src/Fx/internal/yieldable.ts +31 -0
  461. package/src/Fx/run/collect.ts +79 -0
  462. package/src/Fx/run/first.ts +20 -0
  463. package/src/Fx/run/fork.ts +40 -0
  464. package/src/Fx/run/index.ts +5 -0
  465. package/src/Fx/run/observe.ts +114 -0
  466. package/src/Fx/run/runPromise.ts +32 -0
  467. package/src/Fx/stream.ts +42 -0
  468. package/src/Fx.catch.test.ts +61 -0
  469. package/src/Fx.fn.test.ts +51 -0
  470. package/src/Fx.lifecycle.test.ts +80 -0
  471. package/src/Fx.test.ts +71 -0
  472. package/src/Fx.ts +1 -2591
  473. package/src/Push/Push.ts +903 -0
  474. package/src/Push/index.ts +1 -0
  475. package/src/Push.test.ts +26 -0
  476. package/src/Push.ts +1 -480
  477. package/src/{RefArray.ts → RefSubject/RefArray.ts} +246 -248
  478. package/src/RefSubject/RefBigDecimal.test.ts +56 -0
  479. package/src/RefSubject/RefBigDecimal.ts +295 -0
  480. package/src/RefSubject/RefBigInt.test.ts +56 -0
  481. package/src/RefSubject/RefBigInt.ts +189 -0
  482. package/src/RefSubject/RefBoolean.test.ts +57 -0
  483. package/src/RefSubject/RefBoolean.ts +185 -0
  484. package/src/RefSubject/RefCause.test.ts +53 -0
  485. package/src/RefSubject/RefCause.ts +146 -0
  486. package/src/RefSubject/RefChunk.ts +510 -0
  487. package/src/RefSubject/RefDateTime.test.ts +43 -0
  488. package/src/RefSubject/RefDateTime.ts +264 -0
  489. package/src/RefSubject/RefDuration.test.ts +49 -0
  490. package/src/RefSubject/RefDuration.ts +188 -0
  491. package/src/RefSubject/RefGraph.ts +650 -0
  492. package/src/RefSubject/RefHashMap.ts +465 -0
  493. package/src/RefSubject/RefHashRing.ts +262 -0
  494. package/src/RefSubject/RefHashSet.ts +308 -0
  495. package/src/RefSubject/RefIterable.ts +445 -0
  496. package/src/RefSubject/RefOption.test.ts +67 -0
  497. package/src/RefSubject/RefOption.ts +193 -0
  498. package/src/RefSubject/RefRecord.ts +612 -0
  499. package/src/RefSubject/RefResult.test.ts +63 -0
  500. package/src/RefSubject/RefResult.ts +209 -0
  501. package/src/RefSubject/RefString.test.ts +61 -0
  502. package/src/RefSubject/RefString.ts +256 -0
  503. package/src/RefSubject/RefStruct.test.ts +60 -0
  504. package/src/RefSubject/RefStruct.ts +253 -0
  505. package/src/RefSubject/RefSubject.ts +2545 -0
  506. package/src/RefSubject/RefTrie.ts +356 -0
  507. package/src/RefSubject/RefTuple.test.ts +60 -0
  508. package/src/RefSubject/RefTuple.ts +231 -0
  509. package/src/RefSubject/index.ts +21 -0
  510. package/src/RefSubject.test.ts +65 -0
  511. package/src/RefSubject.ts +1 -2488
  512. package/src/Sink/Sink.ts +159 -0
  513. package/src/Sink/combinators.ts +993 -0
  514. package/src/Sink/index.ts +2 -0
  515. package/src/Sink.ts +1 -1044
  516. package/src/Subject/Subject.ts +441 -0
  517. package/src/Subject/index.ts +1 -0
  518. package/src/Subject.test.ts +47 -0
  519. package/src/Subject.ts +1 -330
  520. package/src/Versioned/Versioned.ts +521 -0
  521. package/src/Versioned/index.ts +1 -0
  522. package/src/Versioned.test.ts +23 -0
  523. package/src/Versioned.ts +1 -357
  524. package/src/index.ts +7 -130
  525. package/tsconfig.json +6 -0
  526. package/AsyncData/package.json +0 -6
  527. package/Emitter/package.json +0 -6
  528. package/Form/package.json +0 -6
  529. package/FormEntry/package.json +0 -6
  530. package/Fx/package.json +0 -6
  531. package/Idle/package.json +0 -6
  532. package/LICENSE +0 -21
  533. package/Match/package.json +0 -6
  534. package/Pull/package.json +0 -6
  535. package/Push/package.json +0 -6
  536. package/RefArray/package.json +0 -6
  537. package/RefChunk/package.json +0 -6
  538. package/RefHashMap/package.json +0 -6
  539. package/RefHashSet/package.json +0 -6
  540. package/RefSubject/package.json +0 -6
  541. package/Sink/package.json +0 -6
  542. package/Stream/package.json +0 -6
  543. package/Subject/package.json +0 -6
  544. package/TypeId/package.json +0 -6
  545. package/Typeclass/package.json +0 -6
  546. package/Versioned/package.json +0 -6
  547. package/dist/cjs/AsyncData.js +0 -188
  548. package/dist/cjs/AsyncData.js.map +0 -1
  549. package/dist/cjs/Emitter.js +0 -44
  550. package/dist/cjs/Emitter.js.map +0 -1
  551. package/dist/cjs/Form.js +0 -178
  552. package/dist/cjs/Form.js.map +0 -1
  553. package/dist/cjs/FormEntry.js +0 -110
  554. package/dist/cjs/FormEntry.js.map +0 -1
  555. package/dist/cjs/Fx.js +0 -998
  556. package/dist/cjs/Fx.js.map +0 -1
  557. package/dist/cjs/Idle.js +0 -190
  558. package/dist/cjs/Idle.js.map +0 -1
  559. package/dist/cjs/Match.js +0 -191
  560. package/dist/cjs/Match.js.map +0 -1
  561. package/dist/cjs/Pull.js +0 -52
  562. package/dist/cjs/Pull.js.map +0 -1
  563. package/dist/cjs/Push.js +0 -168
  564. package/dist/cjs/Push.js.map +0 -1
  565. package/dist/cjs/RefArray.js +0 -253
  566. package/dist/cjs/RefArray.js.map +0 -1
  567. package/dist/cjs/RefChunk.js +0 -212
  568. package/dist/cjs/RefChunk.js.map +0 -1
  569. package/dist/cjs/RefHashMap.js +0 -198
  570. package/dist/cjs/RefHashMap.js.map +0 -1
  571. package/dist/cjs/RefHashSet.js +0 -99
  572. package/dist/cjs/RefHashSet.js.map +0 -1
  573. package/dist/cjs/RefSubject.js +0 -1115
  574. package/dist/cjs/RefSubject.js.map +0 -1
  575. package/dist/cjs/Sink.js +0 -662
  576. package/dist/cjs/Sink.js.map +0 -1
  577. package/dist/cjs/Stream.js +0 -87
  578. package/dist/cjs/Stream.js.map +0 -1
  579. package/dist/cjs/Subject.js +0 -205
  580. package/dist/cjs/Subject.js.map +0 -1
  581. package/dist/cjs/TypeId.js +0 -32
  582. package/dist/cjs/TypeId.js.map +0 -1
  583. package/dist/cjs/Typeclass.js +0 -380
  584. package/dist/cjs/Typeclass.js.map +0 -1
  585. package/dist/cjs/Versioned.js +0 -172
  586. package/dist/cjs/Versioned.js.map +0 -1
  587. package/dist/cjs/index.js +0 -89
  588. package/dist/cjs/index.js.map +0 -1
  589. package/dist/cjs/internal/DeferredRef.js +0 -67
  590. package/dist/cjs/internal/DeferredRef.js.map +0 -1
  591. package/dist/cjs/internal/UnionToTuple.js +0 -6
  592. package/dist/cjs/internal/UnionToTuple.js.map +0 -1
  593. package/dist/cjs/internal/bounds.js +0 -26
  594. package/dist/cjs/internal/bounds.js.map +0 -1
  595. package/dist/cjs/internal/core.js +0 -1783
  596. package/dist/cjs/internal/core.js.map +0 -1
  597. package/dist/cjs/internal/diff.js +0 -122
  598. package/dist/cjs/internal/diff.js.map +0 -1
  599. package/dist/cjs/internal/effect-loop-operator.js +0 -288
  600. package/dist/cjs/internal/effect-loop-operator.js.map +0 -1
  601. package/dist/cjs/internal/effect-operator.js +0 -156
  602. package/dist/cjs/internal/effect-operator.js.map +0 -1
  603. package/dist/cjs/internal/effect-producer.js +0 -74
  604. package/dist/cjs/internal/effect-producer.js.map +0 -1
  605. package/dist/cjs/internal/helpers.js +0 -317
  606. package/dist/cjs/internal/helpers.js.map +0 -1
  607. package/dist/cjs/internal/keyed.js +0 -168
  608. package/dist/cjs/internal/keyed.js.map +0 -1
  609. package/dist/cjs/internal/loop-operator.js +0 -213
  610. package/dist/cjs/internal/loop-operator.js.map +0 -1
  611. package/dist/cjs/internal/operator.js +0 -79
  612. package/dist/cjs/internal/operator.js.map +0 -1
  613. package/dist/cjs/internal/protos.js +0 -48
  614. package/dist/cjs/internal/protos.js.map +0 -1
  615. package/dist/cjs/internal/provide.js +0 -100
  616. package/dist/cjs/internal/provide.js.map +0 -1
  617. package/dist/cjs/internal/requestIdleCallback.js +0 -22
  618. package/dist/cjs/internal/requestIdleCallback.js.map +0 -1
  619. package/dist/cjs/internal/share.js +0 -74
  620. package/dist/cjs/internal/share.js.map +0 -1
  621. package/dist/cjs/internal/strategies.js +0 -34
  622. package/dist/cjs/internal/strategies.js.map +0 -1
  623. package/dist/cjs/internal/sync-operator.js +0 -120
  624. package/dist/cjs/internal/sync-operator.js.map +0 -1
  625. package/dist/cjs/internal/sync-producer.js +0 -118
  626. package/dist/cjs/internal/sync-producer.js.map +0 -1
  627. package/dist/cjs/internal/withKey.js +0 -63
  628. package/dist/cjs/internal/withKey.js.map +0 -1
  629. package/dist/dts/AsyncData.d.ts +0 -179
  630. package/dist/dts/AsyncData.d.ts.map +0 -1
  631. package/dist/dts/Emitter.d.ts +0 -24
  632. package/dist/dts/Emitter.d.ts.map +0 -1
  633. package/dist/dts/Form.d.ts +0 -145
  634. package/dist/dts/Form.d.ts.map +0 -1
  635. package/dist/dts/FormEntry.d.ts +0 -65
  636. package/dist/dts/FormEntry.d.ts.map +0 -1
  637. package/dist/dts/Fx.d.ts +0 -1678
  638. package/dist/dts/Fx.d.ts.map +0 -1
  639. package/dist/dts/Idle.d.ts +0 -84
  640. package/dist/dts/Idle.d.ts.map +0 -1
  641. package/dist/dts/Match.d.ts +0 -60
  642. package/dist/dts/Match.d.ts.map +0 -1
  643. package/dist/dts/Pull.d.ts +0 -37
  644. package/dist/dts/Pull.d.ts.map +0 -1
  645. package/dist/dts/Push.d.ts +0 -176
  646. package/dist/dts/Push.d.ts.map +0 -1
  647. package/dist/dts/RefArray.d.ts.map +0 -1
  648. package/dist/dts/RefChunk.d.ts.map +0 -1
  649. package/dist/dts/RefHashMap.d.ts +0 -189
  650. package/dist/dts/RefHashMap.d.ts.map +0 -1
  651. package/dist/dts/RefHashSet.d.ts +0 -100
  652. package/dist/dts/RefHashSet.d.ts.map +0 -1
  653. package/dist/dts/RefSubject.d.ts +0 -601
  654. package/dist/dts/RefSubject.d.ts.map +0 -1
  655. package/dist/dts/Sink.d.ts +0 -252
  656. package/dist/dts/Sink.d.ts.map +0 -1
  657. package/dist/dts/Stream.d.ts +0 -66
  658. package/dist/dts/Stream.d.ts.map +0 -1
  659. package/dist/dts/Subject.d.ts +0 -61
  660. package/dist/dts/Subject.d.ts.map +0 -1
  661. package/dist/dts/TypeId.d.ts +0 -51
  662. package/dist/dts/TypeId.d.ts.map +0 -1
  663. package/dist/dts/Typeclass.d.ts +0 -284
  664. package/dist/dts/Typeclass.d.ts.map +0 -1
  665. package/dist/dts/Versioned.d.ts +0 -117
  666. package/dist/dts/Versioned.d.ts.map +0 -1
  667. package/dist/dts/index.d.ts +0 -111
  668. package/dist/dts/index.d.ts.map +0 -1
  669. package/dist/dts/internal/DeferredRef.d.ts +0 -22
  670. package/dist/dts/internal/DeferredRef.d.ts.map +0 -1
  671. package/dist/dts/internal/UnionToTuple.d.ts.map +0 -1
  672. package/dist/dts/internal/bounds.d.ts +0 -9
  673. package/dist/dts/internal/bounds.d.ts.map +0 -1
  674. package/dist/dts/internal/core.d.ts +0 -237
  675. package/dist/dts/internal/core.d.ts.map +0 -1
  676. package/dist/dts/internal/diff.d.ts.map +0 -1
  677. package/dist/dts/internal/effect-loop-operator.d.ts +0 -34
  678. package/dist/dts/internal/effect-loop-operator.d.ts.map +0 -1
  679. package/dist/dts/internal/effect-operator.d.ts +0 -40
  680. package/dist/dts/internal/effect-operator.d.ts.map +0 -1
  681. package/dist/dts/internal/effect-producer.d.ts +0 -25
  682. package/dist/dts/internal/effect-producer.d.ts.map +0 -1
  683. package/dist/dts/internal/helpers.d.ts +0 -60
  684. package/dist/dts/internal/helpers.d.ts.map +0 -1
  685. package/dist/dts/internal/keyed.d.ts +0 -4
  686. package/dist/dts/internal/keyed.d.ts.map +0 -1
  687. package/dist/dts/internal/loop-operator.d.ts +0 -40
  688. package/dist/dts/internal/loop-operator.d.ts.map +0 -1
  689. package/dist/dts/internal/operator.d.ts +0 -16
  690. package/dist/dts/internal/operator.d.ts.map +0 -1
  691. package/dist/dts/internal/protos.d.ts +0 -23
  692. package/dist/dts/internal/protos.d.ts.map +0 -1
  693. package/dist/dts/internal/provide.d.ts +0 -46
  694. package/dist/dts/internal/provide.d.ts.map +0 -1
  695. package/dist/dts/internal/requestIdleCallback.d.ts +0 -3
  696. package/dist/dts/internal/requestIdleCallback.d.ts.map +0 -1
  697. package/dist/dts/internal/share.d.ts +0 -33
  698. package/dist/dts/internal/share.d.ts.map +0 -1
  699. package/dist/dts/internal/strategies.d.ts +0 -9
  700. package/dist/dts/internal/strategies.d.ts.map +0 -1
  701. package/dist/dts/internal/sync-operator.d.ts +0 -32
  702. package/dist/dts/internal/sync-operator.d.ts.map +0 -1
  703. package/dist/dts/internal/sync-producer.d.ts +0 -36
  704. package/dist/dts/internal/sync-producer.d.ts.map +0 -1
  705. package/dist/dts/internal/withKey.d.ts +0 -4
  706. package/dist/dts/internal/withKey.d.ts.map +0 -1
  707. package/dist/esm/AsyncData.js +0 -156
  708. package/dist/esm/AsyncData.js.map +0 -1
  709. package/dist/esm/Emitter.js +0 -33
  710. package/dist/esm/Emitter.js.map +0 -1
  711. package/dist/esm/Form.js +0 -163
  712. package/dist/esm/Form.js.map +0 -1
  713. package/dist/esm/FormEntry.js +0 -100
  714. package/dist/esm/FormEntry.js.map +0 -1
  715. package/dist/esm/Fx.js +0 -984
  716. package/dist/esm/Fx.js.map +0 -1
  717. package/dist/esm/Idle.js +0 -178
  718. package/dist/esm/Idle.js.map +0 -1
  719. package/dist/esm/Match.js +0 -185
  720. package/dist/esm/Match.js.map +0 -1
  721. package/dist/esm/Pull.js +0 -41
  722. package/dist/esm/Pull.js.map +0 -1
  723. package/dist/esm/Push.js +0 -159
  724. package/dist/esm/Push.js.map +0 -1
  725. package/dist/esm/RefArray.js.map +0 -1
  726. package/dist/esm/RefChunk.js.map +0 -1
  727. package/dist/esm/RefHashMap.js +0 -176
  728. package/dist/esm/RefHashMap.js.map +0 -1
  729. package/dist/esm/RefHashSet.js +0 -86
  730. package/dist/esm/RefHashSet.js.map +0 -1
  731. package/dist/esm/RefSubject.js +0 -1076
  732. package/dist/esm/RefSubject.js.map +0 -1
  733. package/dist/esm/Sink.js.map +0 -1
  734. package/dist/esm/Stream.js +0 -76
  735. package/dist/esm/Stream.js.map +0 -1
  736. package/dist/esm/Subject.js +0 -198
  737. package/dist/esm/Subject.js.map +0 -1
  738. package/dist/esm/TypeId.js +0 -26
  739. package/dist/esm/TypeId.js.map +0 -1
  740. package/dist/esm/Typeclass.js +0 -375
  741. package/dist/esm/Typeclass.js.map +0 -1
  742. package/dist/esm/Versioned.js +0 -149
  743. package/dist/esm/Versioned.js.map +0 -1
  744. package/dist/esm/index.js +0 -111
  745. package/dist/esm/index.js.map +0 -1
  746. package/dist/esm/internal/DeferredRef.js.map +0 -1
  747. package/dist/esm/internal/UnionToTuple.js +0 -2
  748. package/dist/esm/internal/UnionToTuple.js.map +0 -1
  749. package/dist/esm/internal/bounds.js +0 -13
  750. package/dist/esm/internal/bounds.js.map +0 -1
  751. package/dist/esm/internal/core.js +0 -1647
  752. package/dist/esm/internal/core.js.map +0 -1
  753. package/dist/esm/internal/diff.js.map +0 -1
  754. package/dist/esm/internal/effect-loop-operator.js +0 -269
  755. package/dist/esm/internal/effect-loop-operator.js.map +0 -1
  756. package/dist/esm/internal/effect-operator.js +0 -134
  757. package/dist/esm/internal/effect-operator.js.map +0 -1
  758. package/dist/esm/internal/effect-producer.js +0 -47
  759. package/dist/esm/internal/effect-producer.js.map +0 -1
  760. package/dist/esm/internal/helpers.js +0 -299
  761. package/dist/esm/internal/helpers.js.map +0 -1
  762. package/dist/esm/internal/keyed.js +0 -153
  763. package/dist/esm/internal/keyed.js.map +0 -1
  764. package/dist/esm/internal/loop-operator.js +0 -186
  765. package/dist/esm/internal/loop-operator.js.map +0 -1
  766. package/dist/esm/internal/operator.js +0 -68
  767. package/dist/esm/internal/operator.js.map +0 -1
  768. package/dist/esm/internal/protos.js +0 -39
  769. package/dist/esm/internal/protos.js.map +0 -1
  770. package/dist/esm/internal/provide.js +0 -72
  771. package/dist/esm/internal/provide.js.map +0 -1
  772. package/dist/esm/internal/requestIdleCallback.js +0 -16
  773. package/dist/esm/internal/requestIdleCallback.js.map +0 -1
  774. package/dist/esm/internal/share.js +0 -62
  775. package/dist/esm/internal/share.js.map +0 -1
  776. package/dist/esm/internal/strategies.js +0 -8
  777. package/dist/esm/internal/strategies.js.map +0 -1
  778. package/dist/esm/internal/sync-operator.js +0 -95
  779. package/dist/esm/internal/sync-operator.js.map +0 -1
  780. package/dist/esm/internal/sync-producer.js +0 -90
  781. package/dist/esm/internal/sync-producer.js.map +0 -1
  782. package/dist/esm/internal/withKey.js +0 -56
  783. package/dist/esm/internal/withKey.js.map +0 -1
  784. package/dist/esm/package.json +0 -4
  785. package/src/AsyncData.ts +0 -453
  786. package/src/Emitter.ts +0 -59
  787. package/src/Form.ts +0 -489
  788. package/src/FormEntry.ts +0 -214
  789. package/src/Idle.ts +0 -294
  790. package/src/Match.ts +0 -314
  791. package/src/Pull.ts +0 -95
  792. package/src/RefChunk.ts +0 -407
  793. package/src/RefHashMap.ts +0 -335
  794. package/src/RefHashSet.ts +0 -179
  795. package/src/Stream.ts +0 -140
  796. package/src/TypeId.ts +0 -59
  797. package/src/Typeclass.ts +0 -459
  798. package/src/internal/DeferredRef.ts +0 -72
  799. package/src/internal/UnionToTuple.ts +0 -11
  800. package/src/internal/bounds.ts +0 -21
  801. package/src/internal/core.ts +0 -3091
  802. package/src/internal/diff.ts +0 -171
  803. package/src/internal/effect-loop-operator.ts +0 -466
  804. package/src/internal/effect-operator.ts +0 -317
  805. package/src/internal/effect-producer.ts +0 -125
  806. package/src/internal/helpers.ts +0 -538
  807. package/src/internal/keyed.ts +0 -235
  808. package/src/internal/loop-operator.ts +0 -266
  809. package/src/internal/operator.ts +0 -87
  810. package/src/internal/protos.ts +0 -57
  811. package/src/internal/provide.ts +0 -151
  812. package/src/internal/requestIdleCallback.ts +0 -19
  813. package/src/internal/share.ts +0 -97
  814. package/src/internal/strategies.ts +0 -15
  815. package/src/internal/sync-operator.ts +0 -166
  816. package/src/internal/sync-producer.ts +0 -148
  817. package/src/internal/withKey.ts +0 -82
  818. /package/dist/{dts → Fx}/internal/UnionToTuple.d.ts +0 -0
@@ -1,1783 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.acquireUseRelease = acquireUseRelease;
7
- exports.all = all;
8
- exports.annotateLogs = annotateLogs;
9
- exports.annotateSpans = annotateSpans;
10
- exports.append = append;
11
- exports.appendAll = appendAll;
12
- exports.concatMap = concatMap;
13
- exports.continueWith = continueWith;
14
- exports.debounce = debounce;
15
- exports.drop = exports.drain = exports.die = exports.deepEquals = void 0;
16
- exports.dropAfter = dropAfter;
17
- exports.dropAfterEffect = dropAfterEffect;
18
- exports.dropUntil = dropUntil;
19
- exports.dropUntilEffect = dropUntilEffect;
20
- exports.dropWhile = dropWhile;
21
- exports.dropWhileEffect = dropWhileEffect;
22
- exports.during = during;
23
- exports.either = either;
24
- exports.empty = void 0;
25
- exports.exhaustFilterMapLatestEffect = exhaustFilterMapLatestEffect;
26
- exports.exhaustMap = exhaustMap;
27
- exports.exhaustMapCause = exhaustMapCause;
28
- exports.exhaustMapEffect = exhaustMapEffect;
29
- exports.exhaustMapError = exhaustMapError;
30
- exports.exhaustMapLatest = exhaustMapLatest;
31
- exports.exhaustMapLatestCause = exhaustMapLatestCause;
32
- exports.exhaustMapLatestEffect = exhaustMapLatestEffect;
33
- exports.exhaustMapLatestError = exhaustMapLatestError;
34
- exports.exhaustMatchCause = exhaustMatchCause;
35
- exports.exhaustMatchError = exhaustMatchError;
36
- exports.exhaustMatchLatestCause = exhaustMatchLatestCause;
37
- exports.exhaustMatchLatestError = exhaustMatchLatestError;
38
- exports.exit = exit;
39
- exports.filter = exports.failCause = exports.fail = void 0;
40
- exports.filterCause = filterCause;
41
- exports.filterCauseEffect = filterCauseEffect;
42
- exports.filterEffect = void 0;
43
- exports.filterError = filterError;
44
- exports.filterErrorEffect = filterErrorEffect;
45
- exports.filterMap = void 0;
46
- exports.filterMapCause = filterMapCause;
47
- exports.filterMapCauseEffect = filterMapCauseEffect;
48
- exports.filterMapEffect = void 0;
49
- exports.filterMapError = filterMapError;
50
- exports.filterMapErrorEffect = filterMapErrorEffect;
51
- exports.filterMapLoop = void 0;
52
- exports.filterMapLoopCause = filterMapLoopCause;
53
- exports.filterMapLoopCauseEffect = filterMapLoopCauseEffect;
54
- exports.filterMapLoopEffect = void 0;
55
- exports.filterMapLoopError = filterMapLoopError;
56
- exports.filterMapLoopErrorEffect = filterMapLoopErrorEffect;
57
- exports.findFirst = findFirst;
58
- exports.first = first;
59
- exports.flatMap = flatMap;
60
- exports.flatMapCause = flatMapCause;
61
- exports.flatMapCauseConcurrently = flatMapCauseConcurrently;
62
- exports.flatMapCauseWithStrategy = flatMapCauseWithStrategy;
63
- exports.flatMapConcurrently = flatMapConcurrently;
64
- exports.flatMapConcurrentlyEffect = flatMapConcurrentlyEffect;
65
- exports.flatMapEffect = flatMapEffect;
66
- exports.flatMapError = flatMapError;
67
- exports.flatMapErrorConcurrently = flatMapErrorConcurrently;
68
- exports.flatMapErrorWithStrategy = flatMapErrorWithStrategy;
69
- exports.flatMapWithStrategy = flatMapWithStrategy;
70
- exports.fromArray = void 0;
71
- exports.fromAsyncIterable = fromAsyncIterable;
72
- exports.fromEffect = void 0;
73
- exports.fromFxEffect = fromFxEffect;
74
- exports.fromSync = exports.fromScheduled = exports.fromIterable = void 0;
75
- exports.gen = gen;
76
- exports.genScoped = genScoped;
77
- exports.if = if_;
78
- exports.interruptible = void 0;
79
- exports.isEmpty = isEmpty;
80
- exports.isFailCause = isFailCause;
81
- exports.isNever = isNever;
82
- exports.isPadWith = isPadWith;
83
- exports.isProducer = isProducer;
84
- exports.isProducerEffect = isProducerEffect;
85
- exports.isProducerEffectTransformer = isProducerEffectTransformer;
86
- exports.isProducerSyncTransformer = isProducerSyncTransformer;
87
- exports.isSlice = isSlice;
88
- exports.isTransformer = isTransformer;
89
- exports.locally = locally;
90
- exports.locallyWith = locallyWith;
91
- exports.loop = void 0;
92
- exports.loopCause = loopCause;
93
- exports.loopCauseEffect = loopCauseEffect;
94
- exports.loopEffect = void 0;
95
- exports.loopError = loopError;
96
- exports.loopErrorEffect = loopErrorEffect;
97
- exports.make = make;
98
- exports.map = void 0;
99
- exports.mapBoth = mapBoth;
100
- exports.mapCause = mapCause;
101
- exports.mapCauseEffect = mapCauseEffect;
102
- exports.mapEffect = void 0;
103
- exports.mapError = mapError;
104
- exports.mapErrorEffect = mapErrorEffect;
105
- exports.matchCause = matchCause;
106
- exports.matchCauseConcurrently = matchCauseConcurrently;
107
- exports.matchCauseWithStrategy = matchCauseWithStrategy;
108
- exports.matchError = matchError;
109
- exports.matchErrorConcurrently = matchErrorConcurrently;
110
- exports.matchErrorWithStrategy = matchErrorWithStrategy;
111
- exports.merge = merge;
112
- exports.mergeAll = mergeAll;
113
- exports.mergeFirst = mergeFirst;
114
- exports.mergeOrdered = mergeOrdered;
115
- exports.mergeOrderedConcurrently = mergeOrderedConcurrently;
116
- exports.mergeRace = mergeRace;
117
- exports.mergeSwitch = mergeSwitch;
118
- exports.mergeWithStrategy = mergeWithStrategy;
119
- exports.middleware = middleware;
120
- exports.observe = exports.never = void 0;
121
- exports.onError = onError;
122
- exports.onExit = onExit;
123
- exports.onInterrupt = onInterrupt;
124
- exports.orElse = orElse;
125
- exports.orElseCause = orElseCause;
126
- exports.padWith = padWith;
127
- exports.prepend = prepend;
128
- exports.prependAll = prependAll;
129
- exports.provide = provide;
130
- exports.provideContext = provideContext;
131
- exports.provideLayer = provideLayer;
132
- exports.provideRuntime = provideRuntime;
133
- exports.provideService = provideService;
134
- exports.provideServiceEffect = provideServiceEffect;
135
- exports.race = race;
136
- exports.raceAll = raceAll;
137
- exports.reduce = void 0;
138
- exports.sample = sample;
139
- exports.scan = scan;
140
- exports.scoped = exports.schedule = void 0;
141
- exports.since = since;
142
- exports.skipRepeats = skipRepeats;
143
- exports.skipRepeatsWith = skipRepeatsWith;
144
- exports.slice = void 0;
145
- exports.snapshot = snapshot;
146
- exports.snapshotEffect = snapshotEffect;
147
- exports.struct = struct;
148
- exports.succeed = void 0;
149
- exports.suspend = suspend;
150
- exports.switchMap = switchMap;
151
- exports.switchMapCause = switchMapCause;
152
- exports.switchMapEffect = switchMapEffect;
153
- exports.switchMapError = switchMapError;
154
- exports.switchMatchCause = switchMatchCause;
155
- exports.switchMatchError = switchMatchError;
156
- exports.take = void 0;
157
- exports.takeUntil = takeUntil;
158
- exports.takeUntilEffect = takeUntilEffect;
159
- exports.takeWhile = takeWhile;
160
- exports.takeWhileEffect = takeWhileEffect;
161
- exports.tapEffect = void 0;
162
- exports.throttle = throttle;
163
- exports.throttleLatest = throttleLatest;
164
- exports.toEnqueue = toEnqueue;
165
- exports.toReadonlyArray = void 0;
166
- exports.tuple = tuple;
167
- exports.uninterruptible = void 0;
168
- exports.until = until;
169
- exports.when = when;
170
- exports.withConcurrency = withConcurrency;
171
- exports.withConfigProvider = withConfigProvider;
172
- exports.withLogSpan = withLogSpan;
173
- exports.withMaxOpsBeforeYield = withMaxOpsBeforeYield;
174
- exports.withParentSpan = withParentSpan;
175
- exports.withPrevious = void 0;
176
- exports.withRequestBatching = withRequestBatching;
177
- exports.withRequestCache = withRequestCache;
178
- exports.withRequestCaching = withRequestCaching;
179
- exports.withScheduler = withScheduler;
180
- exports.withSpan = withSpan;
181
- exports.withTracer = withTracer;
182
- exports.withTracerTiming = withTracerTiming;
183
- var Context = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@typed/context"));
184
- var _effect = /*#__PURE__*/require("effect");
185
- var Boolean = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Boolean"));
186
- var Cause = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Cause"));
187
- var Clock = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Clock"));
188
- var Deferred = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Deferred"));
189
- var Effect = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Effect"));
190
- var Either = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Either"));
191
- var Equal = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Equal"));
192
- var _Equivalence = /*#__PURE__*/require("effect/Equivalence");
193
- var ExecutionStrategy = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/ExecutionStrategy"));
194
- var Exit = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Exit"));
195
- var Fiber = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Fiber"));
196
- var _Function = /*#__PURE__*/require("effect/Function");
197
- var Layer = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Layer"));
198
- var Option = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Option"));
199
- var Predicate = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Predicate"));
200
- var Ref = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Ref"));
201
- var Scope = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Scope"));
202
- var Tracer = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Tracer"));
203
- var Unify = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("effect/Unify"));
204
- var Sink = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("../Sink.js"));
205
- var _bounds = /*#__PURE__*/require("./bounds.js");
206
- var EffectLoopOp = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./effect-loop-operator.js"));
207
- var EffectOp = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./effect-operator.js"));
208
- var EffectProducer = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./effect-producer.js"));
209
- var _helpers = /*#__PURE__*/require("./helpers.js");
210
- var SyncLoopOp = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./loop-operator.js"));
211
- var Op = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./operator.js"));
212
- var _protos = /*#__PURE__*/require("./protos.js");
213
- var Provide = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./provide.js"));
214
- var _strategies = /*#__PURE__*/require("./strategies.js");
215
- var SyncOp = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./sync-operator.js"));
216
- var SyncProducer = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./sync-producer.js"));
217
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
218
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
219
- const DISCARD = {
220
- discard: true
221
- };
222
- const UNBOUNDED = {
223
- concurrency: "unbounded"
224
- };
225
- function make(run) {
226
- return new Make(run);
227
- }
228
- class Make extends _protos.FxBase {
229
- _run;
230
- constructor(_run) {
231
- super();
232
- this._run = _run;
233
- }
234
- run(sink) {
235
- return Effect.contextWithEffect(ctx => this._run(Sink.provide(sink, ctx)));
236
- }
237
- }
238
- /**
239
- * @internal
240
- */
241
- class Producer extends _protos.FxBase {
242
- i0;
243
- constructor(i0) {
244
- super();
245
- this.i0 = i0;
246
- }
247
- run(sink) {
248
- return SyncProducer.runSink(this.i0, sink);
249
- }
250
- }
251
- /**
252
- * @internal
253
- */
254
- function isProducer(fx) {
255
- return fx.constructor === Producer;
256
- }
257
- const succeed = value => new Producer(SyncProducer.Success(value));
258
- exports.succeed = succeed;
259
- const fromSync = f => new Producer(SyncProducer.FromSync(f));
260
- exports.fromSync = fromSync;
261
- const fromArray = array => new Producer(SyncProducer.FromArray(array));
262
- exports.fromArray = fromArray;
263
- const fromIterable = iterable => new Producer(SyncProducer.FromIterable(iterable));
264
- exports.fromIterable = fromIterable;
265
- class ProducerEffect extends _protos.FxBase {
266
- i0;
267
- constructor(i0) {
268
- super();
269
- this.i0 = i0;
270
- }
271
- run(sink) {
272
- return EffectProducer.runSink(this.i0, sink);
273
- }
274
- }
275
- /**
276
- * @internal
277
- */
278
- function isProducerEffect(fx) {
279
- return fx.constructor === ProducerEffect;
280
- }
281
- const fromEffect = effect => (0, _helpers.matchEffectPrimitive)(effect, {
282
- // Match over Effect primitives and return Fx primitives to allow fusion to take place
283
- Success: succeed,
284
- Failure: failCause,
285
- Sync: fromSync,
286
- Left: fail,
287
- Right: succeed,
288
- Some: succeed,
289
- None: fail,
290
- Otherwise: effect => new ProducerEffect(EffectProducer.FromEffect(effect))
291
- });
292
- exports.fromEffect = fromEffect;
293
- const fromScheduled = (input, schedule) => new ProducerEffect(EffectProducer.FromScheduled(input, schedule));
294
- exports.fromScheduled = fromScheduled;
295
- const schedule = (input, schedule) => new ProducerEffect(EffectProducer.Scheduled(input, schedule));
296
- exports.schedule = schedule;
297
- class FailCause extends _protos.FxBase {
298
- i0;
299
- constructor(i0) {
300
- super();
301
- this.i0 = i0;
302
- }
303
- run(sink) {
304
- return sink.onFailure(this.i0);
305
- }
306
- }
307
- /**
308
- * @internal
309
- */
310
- function isFailCause(fx) {
311
- return fx.constructor === FailCause;
312
- }
313
- const failCause = cause => new FailCause(cause);
314
- exports.failCause = failCause;
315
- const fail = error => failCause(Cause.fail(error));
316
- exports.fail = fail;
317
- const die = error => failCause(Cause.die(error));
318
- exports.die = die;
319
- class Transformer extends _protos.FxBase {
320
- i0;
321
- i1;
322
- constructor(i0, i1) {
323
- super();
324
- this.i0 = i0;
325
- this.i1 = i1;
326
- }
327
- run(sink) {
328
- return this.i0.run(Op.compileOperatorSink(this.i1, sink));
329
- }
330
- static make(fx, operator) {
331
- if (isEmpty(fx) || isNever(fx)) return fx;else if (isProducer(fx)) {
332
- return new ProducerSyncTransformer(fx.i0, operator);
333
- } else if (isTransformer(fx)) {
334
- return new Transformer(fx.i0, Op.fuseOperators(fx.i1, operator));
335
- } else if (isProducerSyncTransformer(fx)) {
336
- return new ProducerSyncTransformer(fx.i0, Op.fuseOperators(fx.i1, operator));
337
- } else if (isProducerEffect(fx)) {
338
- return new ProducerEffectTransformer(fx.i0, operator);
339
- } else if (isProducerEffectTransformer(fx)) {
340
- return new ProducerEffectTransformer(fx.i0, Op.fuseOperators(fx.i1, operator));
341
- } else if (isSuspend(fx)) {
342
- return new SuspendedTransformer(fx.i0, operator);
343
- } else if (isSuspendedTransformer(fx)) {
344
- return new SuspendedTransformer(fx.i0, Op.fuseOperators(fx.i1, operator));
345
- } else if (isFailCause(fx)) {
346
- return fx;
347
- } else {
348
- return new Transformer(fx, operator);
349
- }
350
- }
351
- }
352
- /**
353
- * @internal
354
- */
355
- function isTransformer(fx) {
356
- return fx.constructor === Transformer;
357
- }
358
- class ProducerSyncTransformer extends _protos.FxBase {
359
- i0;
360
- i1;
361
- constructor(i0, i1) {
362
- super();
363
- this.i0 = i0;
364
- this.i1 = i1;
365
- }
366
- run(sink) {
367
- return SyncProducer.runSink(this.i0, Op.compileOperatorSink(this.i1, sink));
368
- }
369
- }
370
- /**
371
- * @internal
372
- */
373
- function isProducerSyncTransformer(fx) {
374
- return fx.constructor === ProducerSyncTransformer;
375
- }
376
- const map = (fx, f) => Transformer.make(fx, SyncOp.Map(f));
377
- exports.map = map;
378
- const filter = (fx, f) => Transformer.make(fx, SyncOp.Filter(f));
379
- exports.filter = filter;
380
- const filterMap = (fx, f) => Transformer.make(fx, SyncOp.FilterMap(f));
381
- exports.filterMap = filterMap;
382
- const mapEffect = (fx, f) => Transformer.make(fx, EffectOp.MapEffect(f));
383
- exports.mapEffect = mapEffect;
384
- const filterMapEffect = (fx, f) => Transformer.make(fx, EffectOp.FilterMapEffect(f));
385
- exports.filterMapEffect = filterMapEffect;
386
- const filterEffect = (fx, f) => Transformer.make(fx, EffectOp.FilterEffect(f));
387
- exports.filterEffect = filterEffect;
388
- const tapEffect = (fx, f) => Transformer.make(fx, EffectOp.TapEffect(f));
389
- exports.tapEffect = tapEffect;
390
- const loop = (fx, seed, f) => Transformer.make(fx, SyncLoopOp.LoopOperator(seed, f));
391
- exports.loop = loop;
392
- const withPrevious = fx => loop(fx, Option.none(), (acc, a) => [[acc, a], Option.some(a)]);
393
- exports.withPrevious = withPrevious;
394
- const filterMapLoop = (fx, seed, f) => Transformer.make(fx, SyncLoopOp.FilterMapLoopOperator(seed, f));
395
- exports.filterMapLoop = filterMapLoop;
396
- const loopEffect = (fx, seed, f) => Transformer.make(fx, EffectLoopOp.LoopEffectOperator(seed, f));
397
- exports.loopEffect = loopEffect;
398
- const filterMapLoopEffect = (fx, seed, f) => Transformer.make(fx, EffectLoopOp.FilterMapLoopEffectOperator(seed, f));
399
- exports.filterMapLoopEffect = filterMapLoopEffect;
400
- const observe = (fx, f) => Observe.make(fx, f);
401
- exports.observe = observe;
402
- const constUnit = () => Effect.void;
403
- const drain = fx => Observe.make(fx, constUnit);
404
- exports.drain = drain;
405
- class Observe extends _protos.EffectBase {
406
- i0;
407
- i1;
408
- constructor(i0, i1) {
409
- super();
410
- this.i0 = i0;
411
- this.i1 = i1;
412
- }
413
- toEffect() {
414
- return Effect.asyncEffect(resume => {
415
- const {
416
- i0: fx,
417
- i1: f
418
- } = this;
419
- const onFailure = cause => Effect.sync(() => resume(Effect.failCause(cause)));
420
- return Effect.zipRight(fx.run(Sink.make(onFailure, a => Effect.catchAllCause(f(a), onFailure))), Effect.sync(() => resume(Effect.void)));
421
- });
422
- }
423
- static make(fx, f) {
424
- if (isEmpty(fx)) {
425
- return Effect.void;
426
- } else if (isNever(fx)) {
427
- return Effect.never;
428
- } else if (isProducer(fx)) {
429
- return SyncProducer.runEffect(fx.i0, f);
430
- } else if (isProducerSyncTransformer(fx)) {
431
- return Op.matchOperator(fx.i1, {
432
- SyncOperator: op => SyncOp.matchSyncOperator(op, {
433
- Map: op => SyncProducer.effectOnce(() => SyncProducer.runEffect(fx.i0, a => f(op.f(a)))),
434
- Filter: op => SyncProducer.effectOnce(() => SyncProducer.runEffect(fx.i0, Unify.unify(a => op.f(a) ? f(a) : Effect.void))),
435
- FilterMap: op => SyncProducer.effectOnce(() => SyncProducer.runEffect(fx.i0, Unify.unify(a => Option.match(op.f(a), {
436
- onNone: () => Effect.void,
437
- onSome: f
438
- }))))
439
- }),
440
- EffectOperator: op => EffectOp.matchEffectOperator(op, {
441
- MapEffect: op => SyncProducer.runEffect(fx.i0, a => Effect.flatMap(op.f(a), f)),
442
- FilterMapEffect: op => SyncProducer.runEffect(fx.i0, a => Effect.flatMap(op.f(a), Unify.unify(Option.match({
443
- onNone: () => Effect.void,
444
- onSome: f
445
- })))),
446
- FilterEffect: op => SyncProducer.runEffect(fx.i0, Unify.unify(a => Effect.flatMap(op.f(a), Unify.unify(b => b ? f(a) : Effect.void)))),
447
- TapEffect: op => SyncProducer.runEffect(fx.i0, a => Effect.flatMap(op.f(a), () => f(a)))
448
- }),
449
- SyncLoopOperator: op => SyncLoopOp.matchSyncLoopOperator(op, {
450
- Loop: op => SyncProducer.effectOnce(() => SyncProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => {
451
- const [c, b] = op.f(acc, a);
452
- return Effect.as(f(c), b);
453
- })),
454
- FilterMapLoop: op => SyncProducer.effectOnce(() => SyncProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => {
455
- const [c, b] = op.f(acc, a);
456
- return Option.match(c, {
457
- onNone: () => Effect.succeed(acc),
458
- onSome: c => Effect.as(f(c), b)
459
- });
460
- }))
461
- }),
462
- EffectLoopOperator: op => EffectLoopOp.matchEffectLoopOperator(op, {
463
- LoopEffect: op => SyncProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => Effect.flatMap(op.f(acc, a), ([c, b]) => Effect.as(f(c), b))),
464
- FilterMapLoopEffect: op => SyncProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => Effect.flatMap(op.f(acc, a), ([c, b]) => Option.match(c, {
465
- onNone: () => Effect.succeed(b),
466
- onSome: c => Effect.as(f(c), b)
467
- })))
468
- })
469
- });
470
- } else if (isProducerEffect(fx)) {
471
- return EffectProducer.runEffect(fx.i0, f);
472
- } else if (isProducerEffectTransformer(fx)) {
473
- return Op.matchOperator(fx.i1, {
474
- SyncOperator: op => SyncOp.matchSyncOperator(op, {
475
- Map: op => SyncProducer.effectOnce(() => EffectProducer.runEffect(fx.i0, a => f(op.f(a)))),
476
- Filter: op => SyncProducer.effectOnce(() => EffectProducer.runEffect(fx.i0, Unify.unify(a => op.f(a) ? f(a) : Effect.void))),
477
- FilterMap: op => SyncProducer.effectOnce(() => EffectProducer.runEffect(fx.i0, Unify.unify(a => Option.match(op.f(a), {
478
- onNone: () => Effect.void,
479
- onSome: f
480
- }))))
481
- }),
482
- EffectOperator: op => EffectOp.matchEffectOperator(op, {
483
- MapEffect: op => EffectProducer.runEffect(fx.i0, a => Effect.flatMap(op.f(a), f)),
484
- FilterMapEffect: op => EffectProducer.runEffect(fx.i0, a => Effect.flatMap(op.f(a), Unify.unify(Option.match({
485
- onNone: () => Effect.void,
486
- onSome: f
487
- })))),
488
- FilterEffect: op => EffectProducer.runEffect(fx.i0, Unify.unify(a => Effect.flatMap(op.f(a), Unify.unify(b => b ? f(a) : Effect.void)))),
489
- TapEffect: op => EffectProducer.runEffect(fx.i0, a => Effect.flatMap(op.f(a), () => f(a)))
490
- }),
491
- SyncLoopOperator: op => SyncLoopOp.matchSyncLoopOperator(op, {
492
- Loop: op => SyncProducer.effectOnce(() => EffectProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => {
493
- const [c, b] = op.f(acc, a);
494
- return Effect.as(f(c), b);
495
- })),
496
- FilterMapLoop: op => SyncProducer.effectOnce(() => EffectProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => {
497
- const [c, b] = op.f(acc, a);
498
- return Option.match(c, {
499
- onNone: () => Effect.succeed(acc),
500
- onSome: c => Effect.as(f(c), b)
501
- });
502
- }))
503
- }),
504
- EffectLoopOperator: op => EffectLoopOp.matchEffectLoopOperator(op, {
505
- LoopEffect: op => EffectProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => Effect.flatMap(op.f(acc, a), ([c, b]) => Effect.as(f(c), b))),
506
- FilterMapLoopEffect: op => EffectProducer.runReduceEffect(fx.i0, op.seed, (acc, a) => Effect.flatMap(op.f(acc, a), ([c, b]) => Option.match(c, {
507
- onNone: () => Effect.succeed(b),
508
- onSome: c => Effect.as(f(c), b)
509
- })))
510
- })
511
- });
512
- } else if (isFailCause(fx)) {
513
- return Effect.failCause(fx.i0);
514
- } else {
515
- return new Observe(fx, f);
516
- }
517
- }
518
- }
519
- const reduce = (fx, seed, f) => Reduce.make(fx, seed, f);
520
- exports.reduce = reduce;
521
- class Reduce extends _protos.EffectBase {
522
- i0;
523
- i1;
524
- i2;
525
- constructor(i0, i1, i2) {
526
- super();
527
- this.i0 = i0;
528
- this.i1 = i1;
529
- this.i2 = i2;
530
- }
531
- toEffect() {
532
- return Effect.suspend(() => {
533
- let acc = this.i1;
534
- return Effect.map(observe(this.i0, a => Effect.sync(() => acc = this.i2(acc, a))), () => acc);
535
- });
536
- }
537
- static make(fx, seed, f) {
538
- // TODO: optimize Effect trasformers
539
- if (isEmpty(fx)) return Effect.succeed(seed);else if (isProducer(fx)) {
540
- return SyncProducer.runReduce(fx.i0, seed, f);
541
- } else if (isProducerSyncTransformer(fx)) {
542
- return Op.matchOperator(fx.i1, {
543
- SyncOperator: op => SyncProducer.syncOnce(() => SyncOp.runSyncReduce(fx.i0, op, seed, f)),
544
- EffectOperator: op => EffectOp.runSyncReduce(fx.i0, op, seed, f),
545
- SyncLoopOperator: op => SyncLoopOp.matchSyncLoopOperator(op, {
546
- Loop: op => Effect.map(SyncProducer.runReduce(fx.i0, [op.seed, seed], ([opAcc, acc], a) => {
547
- const [c, b] = op.f(opAcc, a);
548
- const newAcc = f(acc, c);
549
- return [b, newAcc];
550
- }), x => x[1]),
551
- FilterMapLoop: op => Effect.map(SyncProducer.runReduce(fx.i0, [op.seed, seed], ([opAcc, acc], a) => {
552
- const [c, b] = op.f(opAcc, a);
553
- const newAcc = Option.match(c, {
554
- onNone: () => acc,
555
- onSome: c => f(acc, c)
556
- });
557
- return [b, newAcc];
558
- }), x => x[1])
559
- }),
560
- EffectLoopOperator: op => EffectLoopOp.matchEffectLoopOperator(op, {
561
- LoopEffect: op => Effect.map(SyncProducer.runReduceEffect(fx.i0, [op.seed, seed], ([opAcc, acc], a) => {
562
- return Effect.flatMap(op.f(opAcc, a), ([c, b]) => {
563
- const newAcc = f(acc, c);
564
- return Effect.succeed([b, newAcc]);
565
- });
566
- }), x => x[1]),
567
- FilterMapLoopEffect: op => Effect.map(SyncProducer.runReduceEffect(fx.i0, [op.seed, seed], ([opAcc, acc], a) => {
568
- return Effect.map(op.f(opAcc, a), ([c, b]) => {
569
- const newAcc = Option.match(c, {
570
- onNone: () => acc,
571
- onSome: () => f(acc, b)
572
- });
573
- return [b, newAcc];
574
- });
575
- }), x => x[1])
576
- })
577
- });
578
- } else if (isProducerEffect(fx)) {
579
- return EffectProducer.runReduceEffect(fx.i0, seed, (b, a) => Effect.succeed(f(b, a)));
580
- } else if (isFailCause(fx)) {
581
- return Effect.failCause(fx.i0);
582
- } else {
583
- return new Reduce(fx, seed, f);
584
- }
585
- }
586
- }
587
- const toReadonlyArray = fx => Effect.suspend(() => {
588
- const init = [];
589
- return Reduce.make(fx, init, (acc, a) => {
590
- acc.push(a);
591
- return acc;
592
- });
593
- });
594
- exports.toReadonlyArray = toReadonlyArray;
595
- const slice = (fx, drop, take) => Slice.make(fx, (0, _bounds.boundsFrom)(drop, take));
596
- exports.slice = slice;
597
- const take = (fx, n) => slice(fx, 0, n);
598
- exports.take = take;
599
- const drop = (fx, n) => slice(fx, n, Infinity);
600
- exports.drop = drop;
601
- class Slice extends _protos.FxBase {
602
- i0;
603
- i1;
604
- constructor(i0, i1) {
605
- super();
606
- this.i0 = i0;
607
- this.i1 = i1;
608
- }
609
- run(sink) {
610
- return Sink.slice(sink, this.i1, s => this.i0.run(s));
611
- }
612
- static make(fx, bounds) {
613
- if ((0, _bounds.isNilBounds)(bounds)) return empty;
614
- if ((0, _bounds.isInfiniteBounds)(bounds)) return fx;
615
- if (isSlice(fx)) {
616
- return Slice.make(fx.i0, (0, _bounds.mergeBounds)(fx.i1, bounds));
617
- } else if (isTransformer(fx) && fx.i1._tag === "Map") {
618
- // Commute map and slice
619
- return map(Slice.make(fx.i0, bounds), fx.i1.f);
620
- } else {
621
- return new Slice(fx, bounds);
622
- }
623
- }
624
- }
625
- /**
626
- * @internal
627
- */
628
- function isSlice(fx) {
629
- return fx.constructor === Slice;
630
- }
631
- function skipRepeatsWith(fx, eq) {
632
- return filterMapLoop(fx, Option.none(), (previous, a) => {
633
- if (Option.isSome(previous) && eq(a, previous.value)) {
634
- return [Option.none(), Option.some(a)];
635
- } else {
636
- return [Option.some(a), Option.some(a)];
637
- }
638
- });
639
- }
640
- const toDeepEquals = u => {
641
- switch (typeof u) {
642
- case "object":
643
- {
644
- if (Predicate.isNullable(u)) {
645
- return u;
646
- } else if (Equal.symbol in u) {
647
- return u;
648
- } else if (Array.isArray(u)) {
649
- return _effect.Data.tuple(u.map(toDeepEquals));
650
- } else if (u instanceof Set) {
651
- return _effect.Data.tuple(Array.from(u, toDeepEquals));
652
- } else if (u instanceof Map) {
653
- return _effect.Data.tuple(Array.from(u, ([k, v]) => _effect.Data.tuple([toDeepEquals(k), toDeepEquals(v)])));
654
- } else if (u instanceof URLSearchParams) {
655
- return _effect.Data.tuple(Array.from(u.keys()).map(key => _effect.Data.tuple([key, toDeepEquals(u.getAll(key))])));
656
- } else if (Symbol.iterator in u) {
657
- return _effect.Data.tuple(Array.from(u, toDeepEquals));
658
- } else {
659
- return _effect.Data.struct(_effect.Record.map(u, toDeepEquals));
660
- }
661
- }
662
- default:
663
- return u;
664
- }
665
- };
666
- /**
667
- * @internal
668
- */
669
- const deepEquals = (a, b) => {
670
- // Attempt reference equality first for performance
671
- if (Object.is(a, b)) return true;
672
- return Equal.equals(toDeepEquals(a), toDeepEquals(b));
673
- };
674
- exports.deepEquals = deepEquals;
675
- function skipRepeats(fx) {
676
- return skipRepeatsWith(fx, deepEquals);
677
- }
678
- class ProducerEffectTransformer extends _protos.FxBase {
679
- i0;
680
- i1;
681
- constructor(i0, i1) {
682
- super();
683
- this.i0 = i0;
684
- this.i1 = i1;
685
- }
686
- run(sink) {
687
- return EffectProducer.runSink(this.i0, Op.compileOperatorSink(this.i1, sink));
688
- }
689
- }
690
- /**
691
- * @internal
692
- */
693
- function isProducerEffectTransformer(fx) {
694
- return fx.constructor === ProducerEffectTransformer;
695
- }
696
- class Empty extends _protos.FxBase {
697
- run() {
698
- return Effect.void;
699
- }
700
- }
701
- /**
702
- * @internal
703
- */
704
- function isEmpty(fx) {
705
- return fx.constructor === Empty;
706
- }
707
- const empty = exports.empty = /*#__PURE__*/new Empty();
708
- class Never extends _protos.FxBase {
709
- run() {
710
- return Effect.never;
711
- }
712
- }
713
- /**
714
- * @internal
715
- */
716
- function isNever(fx) {
717
- return fx.constructor === Never;
718
- }
719
- const never = exports.never = /*#__PURE__*/new Never();
720
- function padWith(fx, start, end) {
721
- return new PadWith(fx, start, end);
722
- }
723
- function prependAll(fx, start) {
724
- return new PadWith(fx, start, []);
725
- }
726
- function appendAll(fx, end) {
727
- return new PadWith(fx, [], end);
728
- }
729
- function prepend(fx, start) {
730
- return new PadWith(fx, [start], []);
731
- }
732
- function append(fx, end) {
733
- return new PadWith(fx, [], [end]);
734
- }
735
- function scan(fx, seed, f) {
736
- return prepend(loop(fx, seed, (b, a) => {
737
- const b2 = f(b, a);
738
- return [b2, b2];
739
- }), seed);
740
- }
741
- class PadWith extends _protos.FxBase {
742
- i0;
743
- i1;
744
- i2;
745
- constructor(i0, i1, i2) {
746
- super();
747
- this.i0 = i0;
748
- this.i1 = i1;
749
- this.i2 = i2;
750
- }
751
- run(sink) {
752
- const onSuccess = a => sink.onSuccess(a);
753
- return Effect.forEach(this.i1, onSuccess, DISCARD).pipe(Effect.zipRight(this.i0.run(sink)), Effect.zipRight(Effect.forEach(this.i2, onSuccess, DISCARD)));
754
- }
755
- static make(fx, start, end) {
756
- if (isEmpty(fx) || isNever(fx)) return fx;else if (isPadWith(fx)) {
757
- return new PadWith(fx.i0, concat(start, fx.i1), concat(fx.i2, end));
758
- } else {
759
- return new PadWith(fx, start, end);
760
- }
761
- }
762
- }
763
- function concat(a, b) {
764
- return {
765
- *[Symbol.iterator]() {
766
- yield* a;
767
- yield* b;
768
- }
769
- };
770
- }
771
- /**
772
- * @internal
773
- */
774
- function isPadWith(fx) {
775
- return fx.constructor === PadWith;
776
- }
777
- function flatMapWithStrategy(fx, f, strategy, executionStrategy = ExecutionStrategy.sequential) {
778
- return FlatMapWithStrategy.make(fx, f, strategy, executionStrategy);
779
- }
780
- function switchMap(fx, f, executionStrategy) {
781
- return flatMapWithStrategy(fx, f, _strategies.Switch, executionStrategy);
782
- }
783
- function switchMapEffect(fx, f, executionStrategy) {
784
- return switchMap(fx, a => fromEffect(f(a)), executionStrategy);
785
- }
786
- function exhaustMap(fx, f, executionStrategy) {
787
- return flatMapWithStrategy(fx, f, _strategies.Exhaust, executionStrategy);
788
- }
789
- function exhaustMapEffect(fx, f, executionStrategy) {
790
- return exhaustMap(fx, a => fromEffect(f(a)), executionStrategy);
791
- }
792
- function exhaustMapLatest(fx, f, executionStrategy) {
793
- return flatMapWithStrategy(fx, f, _strategies.ExhaustLatest, executionStrategy);
794
- }
795
- function exhaustMapLatestEffect(fx, f, executionStrategy) {
796
- return exhaustMapLatest(fx, a => fromEffect(f(a)), executionStrategy);
797
- }
798
- function exhaustFilterMapLatestEffect(fx, f, executionStrategy) {
799
- return exhaustMapLatest(fx, a => fromFxEffect(Effect.map(f(a), Option.match({
800
- onNone: () => empty,
801
- onSome: succeed
802
- }))), executionStrategy);
803
- }
804
- function flatMapConcurrently(fx, f, capacity, executionStrategy) {
805
- return flatMapWithStrategy(fx, f, (0, _strategies.Bounded)(capacity), executionStrategy);
806
- }
807
- function concatMap(fx, f, executionStrategy) {
808
- return flatMapConcurrently(fx, f, 1, executionStrategy);
809
- }
810
- function flatMapConcurrentlyEffect(fx, f, capacity, executionStrategy) {
811
- return flatMapConcurrently(fx, a => fromEffect(f(a)), capacity, executionStrategy);
812
- }
813
- function flatMap(fx, f, executionStrategy) {
814
- return flatMapWithStrategy(fx, f, _strategies.Unbounded, executionStrategy);
815
- }
816
- function flatMapEffect(fx, f, executionStrategy) {
817
- return flatMap(fx, a => fromEffect(f(a)), executionStrategy);
818
- }
819
- class FlatMapWithStrategy extends _protos.FxBase {
820
- i0;
821
- i1;
822
- i2;
823
- i3;
824
- withFork;
825
- constructor(i0, i1, i2, i3) {
826
- super();
827
- this.i0 = i0;
828
- this.i1 = i1;
829
- this.i2 = i2;
830
- this.i3 = i3;
831
- this.withFork = (0, _helpers.withFlattenStrategy)(i2);
832
- }
833
- run(sink) {
834
- return this.withFork(fork => Sink.withEarlyExit(sink, sink => this.i0.run(Sink.make(cause => Cause.isInterruptedOnly(cause) ? sink.earlyExit : sink.onFailure(cause), a => fork(this.i1(a).run(sink))))), this.i3);
835
- }
836
- static make(fx, f, strategy, executionStrategy) {
837
- if (isEmpty(fx) || isNever(fx)) return fx;else if (isProducer(fx)) {
838
- if (fx.i0._tag === "Success") return f(fx.i0.source);
839
- if (fx.i0._tag === "FromSync") {
840
- const producer = fx.i0;
841
- return suspend(() => f(producer.source()));
842
- }
843
- const arr = Array.isArray(fx.i0.source) ? fx.i0.source : Array.from(fx.i0.source);
844
- if (arr.length === 0) return empty;
845
- if (arr.length === 1) return f(arr[0]);
846
- switch (strategy._tag) {
847
- case "Switch":
848
- return f(arr[arr.length - 1]);
849
- case "Exhaust":
850
- return f(arr[0]);
851
- case "ExhaustLatest":
852
- return arr.length > 1 ? continueWith(f(arr[0]), () => f(arr[arr.length - 1])) : f(arr[0]);
853
- default:
854
- return new FlatMapWithStrategy(fx, f, strategy, executionStrategy);
855
- }
856
- } else if (isProducerEffect(fx) && fx.i0._tag === "FromEffect") {
857
- return fromFxEffect(Effect.map(fx.i0.source, f));
858
- } else if (isTransformer(fx) && fx.i1._tag === "Map") {
859
- const {
860
- f: op
861
- } = fx.i1;
862
- return new FlatMapWithStrategy(fx.i0, a => f(op(a)), strategy, executionStrategy);
863
- } else {
864
- return new FlatMapWithStrategy(fx, f, strategy, executionStrategy);
865
- }
866
- }
867
- }
868
- function fromFxEffect(effect) {
869
- return new FromFxEffect(effect);
870
- }
871
- class FromFxEffect extends _protos.FxBase {
872
- i0;
873
- constructor(i0) {
874
- super();
875
- this.i0 = i0;
876
- }
877
- run(sink) {
878
- return Effect.matchCauseEffect(this.i0, {
879
- onFailure: cause => sink.onFailure(cause),
880
- onSuccess: fx => fx.run(sink)
881
- });
882
- }
883
- }
884
- function gen(f) {
885
- return fromFxEffect(Effect.gen(f));
886
- }
887
- function genScoped(f) {
888
- return scoped(fromFxEffect(Effect.gen(f)));
889
- }
890
- function continueWith(fx, f) {
891
- return ContinueWith.make(fx, f);
892
- }
893
- class ContinueWith extends _protos.FxBase {
894
- i0;
895
- i1;
896
- constructor(i0, i1) {
897
- super();
898
- this.i0 = i0;
899
- this.i1 = i1;
900
- }
901
- run(sink) {
902
- return Effect.flatMap(this.i0.run(sink), () => this.i1().run(sink));
903
- }
904
- static make(fx, f) {
905
- if (isEmpty(fx)) return f();else if (isNever(fx)) return fx;else if (isProducer(fx)) {
906
- return SyncProducer.matchSyncProducer(fx.i0, {
907
- Success: source => prependAll(f(), [source]),
908
- FromSync: source => suspend(() => prependAll(f(), [source()])),
909
- FromArray: source => prependAll(f(), source),
910
- FromIterable: source => prependAll(f(), source)
911
- });
912
- } else {
913
- return new ContinueWith(fx, f);
914
- }
915
- }
916
- }
917
- function orElseCause(fx, f) {
918
- return OrElseCause.make(fx, f);
919
- }
920
- class OrElseCause extends _protos.FxBase {
921
- i0;
922
- i1;
923
- constructor(i0, i1) {
924
- super();
925
- this.i0 = i0;
926
- this.i1 = i1;
927
- }
928
- run(sink) {
929
- return Effect.catchAllCause(observe(this.i0, sink.onSuccess), cause => this.i1(cause).run(sink));
930
- }
931
- static make(fx, f) {
932
- if (isEmpty(fx)) return fx;else if (isNever(fx)) return fx;else {
933
- return new OrElseCause(fx, f);
934
- }
935
- }
936
- }
937
- function orElse(fx, f) {
938
- return OrElse.make(fx, f);
939
- }
940
- class OrElse extends _protos.FxBase {
941
- i0;
942
- i1;
943
- constructor(i0, i1) {
944
- super();
945
- this.i0 = i0;
946
- this.i1 = i1;
947
- }
948
- run(sink) {
949
- return Effect.catchAll(Effect.asyncEffect(resume => Effect.asVoid(Effect.zipRight(this.i0.run(Sink.make(cause => Either.match(Cause.failureOrCause(cause), {
950
- onLeft: e => Effect.succeed(resume(Effect.fail(e))),
951
- onRight: cause => sink.onFailure(cause)
952
- }), sink.onSuccess)), Effect.sync(() => resume(Effect.void))))), error => this.i1(error).run(sink));
953
- }
954
- static make(fx, f) {
955
- if (isEmpty(fx)) return fx;else if (isNever(fx)) return fx;else {
956
- return new OrElse(fx, f);
957
- }
958
- }
959
- }
960
- function suspend(f) {
961
- return new Suspend(f);
962
- }
963
- class Suspend extends _protos.FxBase {
964
- i0;
965
- constructor(i0) {
966
- super();
967
- this.i0 = i0;
968
- }
969
- run(sink) {
970
- return this.i0().run(sink);
971
- }
972
- }
973
- function isSuspend(fx) {
974
- return fx.constructor === Suspend;
975
- }
976
- class SuspendedTransformer extends _protos.FxBase {
977
- i0;
978
- i1;
979
- constructor(i0, i1) {
980
- super();
981
- this.i0 = i0;
982
- this.i1 = i1;
983
- }
984
- run(sink) {
985
- return this.i0().run(Op.compileOperatorSink(this.i1, sink));
986
- }
987
- }
988
- function isSuspendedTransformer(fx) {
989
- return fx.constructor === SuspendedTransformer;
990
- }
991
- function mergeWithStrategy(fx, stategy) {
992
- return MergeWithStrategy.make(fx, stategy);
993
- }
994
- function merge(fx, other) {
995
- return mergeWithStrategy([fx, other], (0, _strategies.Unordered)(2));
996
- }
997
- function mergeAll(fx) {
998
- return mergeWithStrategy(fx, (0, _strategies.Unordered)(Infinity));
999
- }
1000
- function mergeOrdered(fx) {
1001
- return mergeOrderedConcurrently(fx, Infinity);
1002
- }
1003
- function mergeOrderedConcurrently(fx, concurrency) {
1004
- return mergeWithStrategy(fx, (0, _strategies.Ordered)(concurrency));
1005
- }
1006
- function mergeSwitch(fx) {
1007
- return mergeWithStrategy(fx, _strategies.Switch);
1008
- }
1009
- class MergeWithStrategy extends _protos.FxBase {
1010
- i0;
1011
- i1;
1012
- constructor(i0, i1) {
1013
- super();
1014
- this.i0 = i0;
1015
- this.i1 = i1;
1016
- }
1017
- run(sink) {
1018
- switch (this.i1._tag) {
1019
- case "Unordered":
1020
- return runUnordered(this.i0, sink, this.i1.concurrency === Infinity ? "unbounded" : this.i1.concurrency);
1021
- case "Ordered":
1022
- return runOrdered(this.i0, sink, this.i1.concurrency === Infinity ? "unbounded" : this.i1.concurrency);
1023
- case "Switch":
1024
- return runSwitch(this.i0, sink);
1025
- }
1026
- }
1027
- static make(fx, strategy) {
1028
- if (fx.length === 0) return empty;else if (fx.length === 1) return fx[0];else {
1029
- return new MergeWithStrategy(fx.filter(Predicate.not(isEmpty)), strategy);
1030
- }
1031
- }
1032
- }
1033
- function runUnordered(fx, sink, concurrency) {
1034
- return Effect.forEach(fx, fx => fx.run(sink), {
1035
- concurrency,
1036
- discard: true
1037
- });
1038
- }
1039
- function runOrdered(fx, sink, concurrency) {
1040
- return Effect.fiberIdWith(id => {
1041
- const buffers = (0, _helpers.withBuffers)(fx.length, sink, id);
1042
- return Effect.forEach(fx, (fx, i) => Effect.flatMap(fx.run(Sink.make(cause => Cause.isInterruptedOnly(cause) ? buffers.onEnd(i) : sink.onFailure(cause), a => buffers.onSuccess(i, a))), () => buffers.onEnd(i)), {
1043
- concurrency,
1044
- discard: true
1045
- });
1046
- });
1047
- }
1048
- function runSwitch(fx, sink) {
1049
- return Effect.forEach(fx, fx => fx.run(sink), {
1050
- concurrency: 1,
1051
- discard: true
1052
- });
1053
- }
1054
- function takeWhile(fx, f) {
1055
- return TakeWhile.make(fx, f);
1056
- }
1057
- function takeUntil(fx, f) {
1058
- return TakeWhile.make(fx, Predicate.not(f));
1059
- }
1060
- class TakeWhile extends _protos.FxBase {
1061
- i0;
1062
- i1;
1063
- constructor(i0, i1) {
1064
- super();
1065
- this.i0 = i0;
1066
- this.i1 = i1;
1067
- }
1068
- run(sink) {
1069
- return Sink.takeWhile(sink, this.i1, s => this.i0.run(s));
1070
- }
1071
- static make(fx, predicate) {
1072
- if (isEmpty(fx) || isNever(fx)) return fx;else {
1073
- return new TakeWhile(fx, predicate);
1074
- }
1075
- }
1076
- }
1077
- function dropWhile(fx, f) {
1078
- return DropUntil.make(fx, f);
1079
- }
1080
- function dropUntil(fx, f) {
1081
- return DropUntil.make(fx, Predicate.not(f));
1082
- }
1083
- class DropUntil extends _protos.FxBase {
1084
- i0;
1085
- i1;
1086
- constructor(i0, i1) {
1087
- super();
1088
- this.i0 = i0;
1089
- this.i1 = i1;
1090
- }
1091
- run(sink) {
1092
- return this.i0.run(Sink.dropWhile(sink, this.i1));
1093
- }
1094
- static make(fx, predicate) {
1095
- if (isEmpty(fx) || isNever(fx)) return fx;else {
1096
- return new DropUntil(fx, predicate);
1097
- }
1098
- }
1099
- }
1100
- function dropAfter(fx, f) {
1101
- return DropAfter.make(fx, f);
1102
- }
1103
- class DropAfter extends _protos.FxBase {
1104
- i0;
1105
- i1;
1106
- constructor(i0, i1) {
1107
- super();
1108
- this.i0 = i0;
1109
- this.i1 = i1;
1110
- }
1111
- run(sink) {
1112
- return Sink.dropAfter(sink, this.i1, s => this.i0.run(s));
1113
- }
1114
- static make(fx, predicate) {
1115
- if (isEmpty(fx) || isNever(fx)) return fx;else {
1116
- return new DropAfter(fx, predicate);
1117
- }
1118
- }
1119
- }
1120
- function takeWhileEffect(fx, f) {
1121
- return TakeWhileEffect.make(fx, f);
1122
- }
1123
- function takeUntilEffect(fx, f) {
1124
- return TakeWhileEffect.make(fx, a => Effect.map(f(a), Boolean.not));
1125
- }
1126
- class TakeWhileEffect extends _protos.FxBase {
1127
- i0;
1128
- i1;
1129
- constructor(i0, i1) {
1130
- super();
1131
- this.i0 = i0;
1132
- this.i1 = i1;
1133
- }
1134
- run(sink) {
1135
- return Sink.takeWhileEffect(sink, this.i1, s => this.i0.run(s));
1136
- }
1137
- static make(fx, f) {
1138
- if (isEmpty(fx) || isNever(fx)) return fx;else {
1139
- return new TakeWhileEffect(fx, f);
1140
- }
1141
- }
1142
- }
1143
- function dropWhileEffect(fx, f) {
1144
- return DropWhileEffect.make(fx, f);
1145
- }
1146
- function dropUntilEffect(fx, f) {
1147
- return DropWhileEffect.make(fx, a => Effect.map(f(a), Boolean.not));
1148
- }
1149
- class DropWhileEffect extends _protos.FxBase {
1150
- i0;
1151
- i1;
1152
- constructor(i0, i1) {
1153
- super();
1154
- this.i0 = i0;
1155
- this.i1 = i1;
1156
- }
1157
- run(sink) {
1158
- return this.i0.run(Sink.dropWhileEffect(sink, this.i1));
1159
- }
1160
- static make(fx, f) {
1161
- if (isEmpty(fx) || isNever(fx)) return fx;else {
1162
- return new DropWhileEffect(fx, f);
1163
- }
1164
- }
1165
- }
1166
- function dropAfterEffect(fx, f) {
1167
- return DropAfterEffect.make(fx, f);
1168
- }
1169
- class DropAfterEffect extends _protos.FxBase {
1170
- i0;
1171
- i1;
1172
- constructor(i0, i1) {
1173
- super();
1174
- this.i0 = i0;
1175
- this.i1 = i1;
1176
- }
1177
- run(sink) {
1178
- return this.i0.run(Sink.dropAfterEffect(sink, this.i1));
1179
- }
1180
- static make(fx, f) {
1181
- if (isEmpty(fx) || isNever(fx)) return fx;else {
1182
- return new DropAfterEffect(fx, f);
1183
- }
1184
- }
1185
- }
1186
- function during(fx, window) {
1187
- return During.make(fx, window);
1188
- }
1189
- function since(fx, window) {
1190
- return During.make(fx, map(window, () => never));
1191
- }
1192
- function until(fx, window) {
1193
- return During.make(fx, succeed(window));
1194
- }
1195
- class During extends _protos.FxBase {
1196
- i0;
1197
- i1;
1198
- constructor(i0, i1) {
1199
- super();
1200
- this.i0 = i0;
1201
- this.i1 = i1;
1202
- }
1203
- run(sink) {
1204
- return (0, _helpers.withScopedFork)(fork => Sink.withEarlyExit(sink, s => {
1205
- let taking = false;
1206
- const onFailure = cause => s.onFailure(cause);
1207
- return Effect.flatMap(fork(take(this.i1, 1).run(Sink.make(onFailure, nested => {
1208
- taking = true;
1209
- return take(nested, 1).run(Sink.make(onFailure, () => s.earlyExit));
1210
- }))), () => Effect.zipRight(
1211
- // Allow fibers to start
1212
- (0, _helpers.adjustTime)(1), this.i0.run(Sink.make(onFailure, a => taking ? s.onSuccess(a) : Effect.void))));
1213
- }), ExecutionStrategy.sequential);
1214
- }
1215
- static make(fx, window) {
1216
- if (isEmpty(fx) || isNever(fx)) return fx;else {
1217
- return new During(fx, window);
1218
- }
1219
- }
1220
- }
1221
- function middleware(fx, effect, sink) {
1222
- return new Middleware(fx, effect, sink);
1223
- }
1224
- function onExit(fx, f) {
1225
- return middleware(fx, Effect.onExit(f));
1226
- }
1227
- function onInterrupt(fx, f) {
1228
- return middleware(fx, Effect.onInterrupt(f));
1229
- }
1230
- function onError(fx, f) {
1231
- return middleware(fx, Effect.onError(f));
1232
- }
1233
- const scoped = fx => middleware(fx, Effect.scoped);
1234
- exports.scoped = scoped;
1235
- function annotateLogs(fx, key, value) {
1236
- return middleware(fx, effect => Effect.annotateLogs(effect, key, value));
1237
- }
1238
- function annotateSpans(fx, key, value) {
1239
- return middleware(fx, effect => Effect.annotateSpans(effect, key, value));
1240
- }
1241
- const interruptible = fx => middleware(fx, Effect.interruptible);
1242
- exports.interruptible = interruptible;
1243
- const uninterruptible = fx => middleware(fx, Effect.uninterruptible);
1244
- exports.uninterruptible = uninterruptible;
1245
- function locally(use, self, value) {
1246
- return middleware(use, effect => Effect.locally(effect, self, value));
1247
- }
1248
- function locallyWith(use, self, f) {
1249
- return middleware(use, effect => Effect.locallyWith(effect, self, f));
1250
- }
1251
- function withTracerTiming(fx, enabled) {
1252
- return middleware(fx, effect => Effect.withTracerTiming(effect, enabled));
1253
- }
1254
- function withConcurrency(fx, concurrency) {
1255
- return middleware(fx, effect => Effect.withConcurrency(effect, concurrency));
1256
- }
1257
- function withConfigProvider(fx, configProvider) {
1258
- return middleware(fx, effect => Effect.withConfigProvider(effect, configProvider));
1259
- }
1260
- function withLogSpan(fx, span) {
1261
- return middleware(fx, effect => Effect.withLogSpan(effect, span));
1262
- }
1263
- function withMaxOpsBeforeYield(fx, maxOps) {
1264
- return middleware(fx, effect => Effect.withMaxOpsBeforeYield(effect, maxOps));
1265
- }
1266
- function withParentSpan(fx, parentSpan) {
1267
- return middleware(fx, effect => Effect.withParentSpan(effect, parentSpan));
1268
- }
1269
- function withRequestBatching(fx, requestBatching) {
1270
- return middleware(fx, effect => Effect.withRequestBatching(effect, requestBatching));
1271
- }
1272
- function withRequestCache(fx, cache) {
1273
- return middleware(fx, effect => Effect.withRequestCache(effect, cache));
1274
- }
1275
- function withRequestCaching(fx, requestCaching) {
1276
- return middleware(fx, effect => Effect.withRequestCaching(effect, requestCaching));
1277
- }
1278
- function withScheduler(fx, scheduler) {
1279
- return middleware(fx, effect => Effect.withScheduler(effect, scheduler));
1280
- }
1281
- function withTracer(fx, tracer) {
1282
- return middleware(fx, effect => Effect.withTracer(effect, tracer));
1283
- }
1284
- class Middleware extends _protos.FxBase {
1285
- i0;
1286
- i1;
1287
- i2;
1288
- constructor(i0, i1, i2) {
1289
- super();
1290
- this.i0 = i0;
1291
- this.i1 = i1;
1292
- this.i2 = i2;
1293
- }
1294
- run(sink) {
1295
- return Effect.contextWithEffect(ctx => {
1296
- const s = Sink.provide(sink, ctx);
1297
- return this.i1(this.i0.run(this.i2 ? this.i2(s) : s));
1298
- });
1299
- }
1300
- }
1301
- function acquireUseRelease(acquire, use, release) {
1302
- return new AcquireUseRelease(acquire, use, release);
1303
- }
1304
- class AcquireUseRelease extends _protos.FxBase {
1305
- acquire;
1306
- use;
1307
- release;
1308
- constructor(acquire, use, release) {
1309
- super();
1310
- this.acquire = acquire;
1311
- this.use = use;
1312
- this.release = release;
1313
- }
1314
- run(sink) {
1315
- return Effect.catchAllCause(Effect.acquireUseRelease(this.acquire, a => this.use(a).run(sink), (a, exit) => Effect.catchAllCause(this.release(a, exit), cause => sink.onFailure(cause))), cause => sink.onFailure(cause));
1316
- }
1317
- }
1318
- function withSpan(self, name, options = {}) {
1319
- return acquireUseRelease(Effect.flatMap(Effect.optionFromOptional(Effect.currentSpan), parent => Effect.makeSpan(name, {
1320
- ...options,
1321
- parent: options?.parent || Option.getOrUndefined(parent)
1322
- })), span => middleware(self, effect => Effect.provideService(effect, Tracer.ParentSpan, span), s => Sink.setSpan(s, span)), (span, exit) => Effect.flatMap(Clock.currentTimeNanos, time => Effect.sync(() => span.end(time, exit))));
1323
- }
1324
- function provideContext(fx, context) {
1325
- return ProvideFx.make(fx, Provide.ProvideContext(context));
1326
- }
1327
- function provideLayer(fx, layer) {
1328
- return ProvideFx.make(fx, Provide.ProvideLayer(layer));
1329
- }
1330
- function provideRuntime(fx, runtime) {
1331
- return ProvideFx.make(fx, Provide.ProvideRuntime(runtime));
1332
- }
1333
- function provideService(fx, service, instance) {
1334
- return ProvideFx.make(fx, Provide.ProvideService(service, instance));
1335
- }
1336
- function provideServiceEffect(fx, service, instance) {
1337
- return ProvideFx.make(fx, Provide.ProvideServiceEffect(service, instance));
1338
- }
1339
- function provide(fx, provide) {
1340
- if (Layer.isLayer(provide)) {
1341
- return provideLayer(fx, provide);
1342
- } else if (Context.isContext(provide)) {
1343
- return provideContext(fx, provide);
1344
- } else return provideRuntime(fx, provide);
1345
- }
1346
- class ProvideFx extends _protos.FxBase {
1347
- i0;
1348
- i1;
1349
- constructor(i0, i1) {
1350
- super();
1351
- this.i0 = i0;
1352
- this.i1 = i1;
1353
- }
1354
- run(sink) {
1355
- return Effect.acquireUseRelease(Scope.make(), scope => Effect.matchEffect(Provide.buildWithScope(this.i1, scope), {
1356
- onFailure: error => sink.onFailure(Cause.fail(error)),
1357
- onSuccess: ctx => Effect.provide(this.i0.run(sink), ctx)
1358
- }), (scope, exit) => Scope.close(scope, exit));
1359
- }
1360
- static make(fx, provide) {
1361
- if (isEmpty(fx) || isNever(fx)) return fx;else if (isProvideFx(fx)) {
1362
- return new ProvideFx(fx.i0, Provide.merge(fx.i1, provide));
1363
- } else {
1364
- return new ProvideFx(fx, provide);
1365
- }
1366
- }
1367
- }
1368
- function isProvideFx(u) {
1369
- return u.constructor === ProvideFx;
1370
- }
1371
- function mapCause(fx, f) {
1372
- return new TransformerCause(fx, SyncOp.Map(f));
1373
- }
1374
- function mapError(fx, f) {
1375
- return mapCause(fx, Cause.map(f));
1376
- }
1377
- function filterCause(fx, f) {
1378
- return new TransformerCause(fx, SyncOp.Filter(f));
1379
- }
1380
- function filterError(fx, f) {
1381
- return filterCause(fx, cause => Option.match(Cause.failureOption(cause), {
1382
- onNone: _Function.constTrue,
1383
- onSome: f
1384
- }));
1385
- }
1386
- function filterMapCause(fx, f) {
1387
- return new TransformerCause(fx, SyncOp.FilterMap(f));
1388
- }
1389
- function filterMapError(fx, f) {
1390
- return filterMapCause(fx, cause => Either.match(Cause.failureOrCause(cause), {
1391
- onLeft: e => Option.map(f(e), Cause.fail),
1392
- onRight: Option.some
1393
- }));
1394
- }
1395
- function mapCauseEffect(fx, f) {
1396
- return new TransformerCause(fx, EffectOp.MapEffect(f));
1397
- }
1398
- function mapErrorEffect(fx, f) {
1399
- return mapCauseEffect(fx, cause => Either.match(Cause.failureOrCause(cause), {
1400
- onLeft: e => Effect.map(f(e), Cause.fail),
1401
- onRight: cause => Effect.succeed(cause)
1402
- }));
1403
- }
1404
- function filterCauseEffect(fx, f) {
1405
- return new TransformerCause(fx, EffectOp.FilterEffect(f));
1406
- }
1407
- function filterErrorEffect(fx, f) {
1408
- return filterCauseEffect(fx, cause => Either.match(Cause.failureOrCause(cause), {
1409
- onLeft: f,
1410
- onRight: () => Effect.succeed(true)
1411
- }));
1412
- }
1413
- function filterMapCauseEffect(fx, f) {
1414
- return new TransformerCause(fx, EffectOp.FilterMapEffect(f));
1415
- }
1416
- function filterMapErrorEffect(fx, f) {
1417
- return filterMapCauseEffect(fx, cause => Either.match(Cause.failureOrCause(cause), {
1418
- onLeft: e => Effect.map(f(e), Option.map(Cause.fail)),
1419
- onRight: cause => Effect.succeed(Option.some(cause))
1420
- }));
1421
- }
1422
- function loopCause(fx, seed, f) {
1423
- return new TransformerCause(fx, SyncLoopOp.LoopOperator(seed, f));
1424
- }
1425
- function loopError(fx, seed, f) {
1426
- return loopCause(fx, seed, (b, cause) => Either.match(Cause.failureOrCause(cause), {
1427
- onLeft: e => {
1428
- const [c, b2] = f(b, e);
1429
- return [Cause.fail(c), b2];
1430
- },
1431
- onRight: cause => [cause, b]
1432
- }));
1433
- }
1434
- function loopCauseEffect(fx, seed, f) {
1435
- return new TransformerCause(fx, EffectLoopOp.LoopEffectOperator(seed, f));
1436
- }
1437
- function loopErrorEffect(fx, seed, f) {
1438
- return loopCauseEffect(fx, seed, (b, cause) => Either.match(Cause.failureOrCause(cause), {
1439
- onLeft: e => Effect.map(f(b, e), ([c, b2]) => [Cause.fail(c), b2]),
1440
- onRight: cause => Effect.succeed([cause, b])
1441
- }));
1442
- }
1443
- function filterMapLoopCause(fx, seed, f) {
1444
- return new TransformerCause(fx, SyncLoopOp.FilterMapLoopOperator(seed, f));
1445
- }
1446
- function filterMapLoopError(fx, seed, f) {
1447
- return filterMapLoopCause(fx, seed, (b, cause) => Either.match(Cause.failureOrCause(cause), {
1448
- onLeft: e => {
1449
- const [c, b2] = f(b, e);
1450
- return [Option.map(Cause.fail)(c), b2];
1451
- },
1452
- onRight: cause => [Option.some(cause), b]
1453
- }));
1454
- }
1455
- function filterMapLoopCauseEffect(fx, seed, f) {
1456
- return new TransformerCause(fx, EffectLoopOp.FilterMapLoopEffectOperator(seed, f));
1457
- }
1458
- function filterMapLoopErrorEffect(fx, seed, f) {
1459
- return filterMapLoopCauseEffect(fx, seed, (b, cause) => Either.match(Cause.failureOrCause(cause), {
1460
- onLeft: e => Effect.map(f(b, e), ([c, b2]) => [Option.map(c, Cause.fail), b2]),
1461
- onRight: cause => Effect.succeed([Option.some(cause), b])
1462
- }));
1463
- }
1464
- class TransformerCause extends _protos.FxBase {
1465
- i0;
1466
- i1;
1467
- constructor(i0, i1) {
1468
- super();
1469
- this.i0 = i0;
1470
- this.i1 = i1;
1471
- }
1472
- run(sink) {
1473
- return this.i0.run(Op.compileOperatorSinkCause(this.i1, sink));
1474
- }
1475
- }
1476
- function flatMapCauseWithStrategy(fx, f, flattenStrategy, executionStrategy = ExecutionStrategy.sequential) {
1477
- return new FlatMapCauseWithStrategy(fx, f, flattenStrategy, executionStrategy);
1478
- }
1479
- function flatMapErrorWithStrategy(fx, f, flattenStrategy, executionStrategy = ExecutionStrategy.sequential) {
1480
- return flatMapCauseWithStrategy(fx, cause => Either.match(Cause.failureOrCause(cause), {
1481
- onLeft: f,
1482
- onRight: cause => failCause(cause)
1483
- }), flattenStrategy, executionStrategy);
1484
- }
1485
- function switchMapCause(fx, f, executionStrategy) {
1486
- return flatMapCauseWithStrategy(fx, f, _strategies.Switch, executionStrategy);
1487
- }
1488
- function switchMapError(fx, f, executionStrategy) {
1489
- return flatMapErrorWithStrategy(fx, f, _strategies.Switch, executionStrategy);
1490
- }
1491
- function flatMapCause(fx, f, executionStrategy) {
1492
- return flatMapCauseWithStrategy(fx, f, _strategies.Unbounded, executionStrategy);
1493
- }
1494
- function flatMapError(fx, f, executionStrategy) {
1495
- return flatMapErrorWithStrategy(fx, f, _strategies.Unbounded, executionStrategy);
1496
- }
1497
- function flatMapCauseConcurrently(fx, f, concurrency, executionStrategy) {
1498
- return flatMapCauseWithStrategy(fx, f, (0, _strategies.Bounded)(concurrency), executionStrategy);
1499
- }
1500
- function flatMapErrorConcurrently(fx, f, concurrency, executionStrategy) {
1501
- return flatMapErrorWithStrategy(fx, f, (0, _strategies.Bounded)(concurrency), executionStrategy);
1502
- }
1503
- function exhaustMapCause(fx, f, executionStrategy) {
1504
- return flatMapCauseWithStrategy(fx, f, _strategies.Exhaust, executionStrategy);
1505
- }
1506
- function exhaustMapError(fx, f, executionStrategy) {
1507
- return flatMapErrorWithStrategy(fx, f, _strategies.Exhaust, executionStrategy);
1508
- }
1509
- function exhaustMapLatestCause(fx, f, executionStrategy) {
1510
- return flatMapCauseWithStrategy(fx, f, _strategies.ExhaustLatest, executionStrategy);
1511
- }
1512
- function exhaustMapLatestError(fx, f, executionStrategy) {
1513
- return flatMapErrorWithStrategy(fx, f, _strategies.ExhaustLatest, executionStrategy);
1514
- }
1515
- class FlatMapCauseWithStrategy extends _protos.FxBase {
1516
- i0;
1517
- i1;
1518
- i2;
1519
- i3;
1520
- withFork;
1521
- constructor(i0, i1, i2, i3) {
1522
- super();
1523
- this.i0 = i0;
1524
- this.i1 = i1;
1525
- this.i2 = i2;
1526
- this.i3 = i3;
1527
- this.withFork = (0, _helpers.withFlattenStrategy)(this.i2);
1528
- }
1529
- run(sink) {
1530
- return this.withFork(fork => this.i0.run(Sink.make(cause => fork(this.i1(cause).run(sink)), a => sink.onSuccess(a))), this.i3);
1531
- }
1532
- }
1533
- class MatchWithStrategy extends _protos.FxBase {
1534
- i0;
1535
- i1;
1536
- i2;
1537
- i3;
1538
- i4;
1539
- withFork;
1540
- constructor(i0, i1, i2, i3, i4) {
1541
- super();
1542
- this.i0 = i0;
1543
- this.i1 = i1;
1544
- this.i2 = i2;
1545
- this.i3 = i3;
1546
- this.i4 = i4;
1547
- this.withFork = (0, _helpers.withFlattenStrategy)(this.i3);
1548
- }
1549
- run(sink) {
1550
- return this.withFork(fork => this.i0.run(Sink.make(cause => fork(this.i1(cause).run(sink)), a => fork(this.i2(a).run(sink)))), this.i4);
1551
- }
1552
- }
1553
- function matchCauseWithStrategy(fx, flattenStrategy, opts) {
1554
- return new MatchWithStrategy(fx, opts.onFailure, opts.onSuccess, flattenStrategy, opts.executionStrategy || ExecutionStrategy.sequential);
1555
- }
1556
- function matchErrorWithStrategy(fx, flattenStrategy, {
1557
- executionStrategy,
1558
- onFailure,
1559
- onSuccess
1560
- }) {
1561
- return new MatchWithStrategy(fx, cause => Either.match(Cause.failureOrCause(cause), {
1562
- onLeft: onFailure,
1563
- onRight: cause => failCause(cause)
1564
- }), onSuccess, flattenStrategy, executionStrategy || ExecutionStrategy.sequential);
1565
- }
1566
- function matchCause(fx, opts) {
1567
- return matchCauseWithStrategy(fx, _strategies.Unbounded, opts);
1568
- }
1569
- function matchError(fx, opts) {
1570
- return matchErrorWithStrategy(fx, _strategies.Unbounded, opts);
1571
- }
1572
- function matchCauseConcurrently(fx, concurrency, opts) {
1573
- return matchCauseWithStrategy(fx, (0, _strategies.Bounded)(concurrency), opts);
1574
- }
1575
- function matchErrorConcurrently(fx, concurrency, opts) {
1576
- return matchErrorWithStrategy(fx, (0, _strategies.Bounded)(concurrency), opts);
1577
- }
1578
- function switchMatchCause(fx, opts) {
1579
- return matchCauseWithStrategy(fx, _strategies.Switch, opts);
1580
- }
1581
- function switchMatchError(fx, opts) {
1582
- return matchErrorWithStrategy(fx, _strategies.Switch, opts);
1583
- }
1584
- function exhaustMatchCause(fx, opts) {
1585
- return matchCauseWithStrategy(fx, _strategies.Exhaust, opts);
1586
- }
1587
- function exhaustMatchError(fx, opts) {
1588
- return matchErrorWithStrategy(fx, _strategies.Exhaust, opts);
1589
- }
1590
- function exhaustMatchLatestCause(fx, opts) {
1591
- return matchCauseWithStrategy(fx, _strategies.ExhaustLatest, opts);
1592
- }
1593
- function exhaustMatchLatestError(fx, opts) {
1594
- return matchErrorWithStrategy(fx, _strategies.ExhaustLatest, opts);
1595
- }
1596
- function tuple(fx) {
1597
- return new Tuple(fx);
1598
- }
1599
- class Tuple extends _protos.FxBase {
1600
- i0;
1601
- constructor(i0) {
1602
- super();
1603
- this.i0 = i0;
1604
- }
1605
- run(sink) {
1606
- return (0, _helpers.tupleSink)(sink, onSuccess => Effect.forEach(this.i0, (fx, i) => fx.run(Sink.make(sink.onFailure, a => onSuccess(i, a))), UNBOUNDED), this.i0.length);
1607
- }
1608
- }
1609
- function struct(fx) {
1610
- const entries = Object.entries(fx);
1611
- return map(tuple(entries.map(([key, fx]) => map(fx, a => [key, a]))), Object.fromEntries);
1612
- }
1613
- function all(fx) {
1614
- if (Array.isArray(fx)) return tuple(fx);else return struct(fx);
1615
- }
1616
- function exit(fx) {
1617
- return new ExitFx(fx);
1618
- }
1619
- class ExitFx extends _protos.FxBase {
1620
- i0;
1621
- constructor(i0) {
1622
- super();
1623
- this.i0 = i0;
1624
- }
1625
- run(sink) {
1626
- return this.i0.run(Sink.make(cause => sink.onSuccess(Exit.failCause(cause)), a => sink.onSuccess(Exit.succeed(a))));
1627
- }
1628
- }
1629
- function toEnqueue(fx, queue) {
1630
- return observe(fx, a => queue.offer(a));
1631
- }
1632
- function debounce(fx, delay) {
1633
- return switchMapEffect(fx, a => Effect.as(Effect.sleep(delay), a));
1634
- }
1635
- function emitAndSleep(value, delay) {
1636
- return make(sink => Effect.zipRight(sink.onSuccess(value), Effect.sleep(delay)));
1637
- }
1638
- function throttle(fx, delay) {
1639
- return exhaustMap(fx, a => emitAndSleep(a, delay));
1640
- }
1641
- function throttleLatest(fx, delay) {
1642
- return exhaustMapLatest(fx, a => emitAndSleep(a, delay));
1643
- }
1644
- function fromAsyncIterable(iterable) {
1645
- return new FromAsyncIterable(iterable);
1646
- }
1647
- class FromAsyncIterable extends _protos.FxBase {
1648
- i0;
1649
- constructor(i0) {
1650
- super();
1651
- this.i0 = i0;
1652
- }
1653
- run(sink) {
1654
- return Effect.asyncEffect(cb => {
1655
- const iterator = this.i0[Symbol.asyncIterator]();
1656
- const loop = result => result.done ? Effect.sync(() => cb(Effect.void)) : Effect.zipRight(sink.onSuccess(result.value), Effect.flatMap(Effect.promise(() => iterator.next()), loop));
1657
- return Effect.asVoid(Effect.flatMap(Effect.promise(() => iterator.next()), loop));
1658
- });
1659
- }
1660
- }
1661
- function findFirst(fx, predicate) {
1662
- return Effect.asyncEffect(cb => observe(fx, a => predicate(a) ? Effect.sync(() => cb(Effect.succeed(a))) : Effect.void));
1663
- }
1664
- function first(fx) {
1665
- return findFirst(fx, _Function.constTrue);
1666
- }
1667
- function either(fx) {
1668
- return new EitherFx(fx);
1669
- }
1670
- class EitherFx extends _protos.FxBase {
1671
- i0;
1672
- constructor(i0) {
1673
- super();
1674
- this.i0 = i0;
1675
- }
1676
- run(sink) {
1677
- return this.i0.run(Sink.make(cause => Either.match(Cause.failureOrCause(cause), {
1678
- onLeft: e => sink.onSuccess(Either.left(e)),
1679
- onRight: cause => sink.onFailure(cause)
1680
- }), a => sink.onSuccess(Either.right(a))));
1681
- }
1682
- }
1683
- function mergeFirst(fx, that) {
1684
- return merge(fx, filter(that, _Function.constFalse));
1685
- }
1686
- function mergeRace(fx, that) {
1687
- return new MergeRace(fx, that);
1688
- }
1689
- class MergeRace extends _protos.FxBase {
1690
- i0;
1691
- i1;
1692
- constructor(i0, i1) {
1693
- super();
1694
- this.i0 = i0;
1695
- this.i1 = i1;
1696
- }
1697
- run(sink) {
1698
- return Effect.gen(this, function* (_) {
1699
- const fiber1 = yield* Effect.fork(this.i0.run(Sink.make(sink.onFailure, a => Effect.flatMap(sink.onSuccess(a), () => Fiber.interrupt(fiber2)))));
1700
- const fiber2 = yield* Effect.fork(this.i1.run(sink));
1701
- return yield* Fiber.joinAll([fiber1, fiber2]);
1702
- });
1703
- }
1704
- }
1705
- function raceAll(fx) {
1706
- return new RaceAll(fx);
1707
- }
1708
- function race(fx, that) {
1709
- return raceAll([fx, that]);
1710
- }
1711
- class RaceAll extends _protos.FxBase {
1712
- i0;
1713
- constructor(i0) {
1714
- super();
1715
- this.i0 = i0;
1716
- }
1717
- run(sink) {
1718
- return Effect.gen(this, function* (_) {
1719
- const winner = yield* Deferred.make();
1720
- const fibers = [];
1721
- for (const fx of this.i0) {
1722
- const fiber = yield* Effect.fork(fx.run(Sink.make(sink.onFailure, a => Effect.flatMap(Deferred.succeed(winner, fiber), () => sink.onSuccess(a)))));
1723
- fibers.push(fiber);
1724
- }
1725
- const winningFiber = yield* Deferred.await(winner);
1726
- yield* Fiber.interruptAll(fibers.filter(x => x !== winningFiber));
1727
- return yield* Fiber.join(winningFiber);
1728
- });
1729
- }
1730
- }
1731
- function snapshot(fx, sampled, f) {
1732
- return new Snapshot(fx, sampled, f);
1733
- }
1734
- function sample(fx, sampled) {
1735
- return snapshot(fx, sampled, (_, b) => b);
1736
- }
1737
- class Snapshot extends _protos.FxBase {
1738
- i0;
1739
- i1;
1740
- i2;
1741
- constructor(i0, i1, i2) {
1742
- super();
1743
- this.i0 = i0;
1744
- this.i1 = i1;
1745
- this.i2 = i2;
1746
- }
1747
- run(sink) {
1748
- return Effect.flatMap(Ref.make(Option.none()), ref => Effect.all([this.i1.run(Sink.make(sink.onFailure, b => Ref.set(ref, Option.some(b)))), this.i0.run(Sink.make(sink.onFailure, a => Effect.flatMap(Ref.get(ref), Option.match({
1749
- onNone: () => Effect.void,
1750
- onSome: b => sink.onSuccess(this.i2(a, b))
1751
- }))))], UNBOUNDED));
1752
- }
1753
- }
1754
- function snapshotEffect(fx, sampled, f) {
1755
- return new SnapshotEffect(fx, sampled, f);
1756
- }
1757
- class SnapshotEffect extends _protos.FxBase {
1758
- i0;
1759
- i1;
1760
- i2;
1761
- constructor(i0, i1, i2) {
1762
- super();
1763
- this.i0 = i0;
1764
- this.i1 = i1;
1765
- this.i2 = i2;
1766
- }
1767
- run(sink) {
1768
- return Effect.flatMap(Ref.make(Option.none()), ref => Effect.flatMap(Effect.tap(Effect.fork(this.i1.run(Sink.make(sink.onFailure, b => Ref.set(ref, Option.some(b))))), () => this.i0.run(Sink.make(sink.onFailure, a => Effect.flatMap(Ref.get(ref), Option.match({
1769
- onNone: () => Effect.void,
1770
- onSome: b => Effect.matchCauseEffect(this.i2(a, b), sink)
1771
- }))))), Fiber.interrupt));
1772
- }
1773
- }
1774
- function if_(bool, options) {
1775
- return switchMap(skipRepeatsWith(bool, _Equivalence.boolean), b => b ? options.onTrue : options.onFalse);
1776
- }
1777
- function when(bool, options) {
1778
- return map(skipRepeatsWith(bool, _Equivalence.boolean), b => b ? options.onTrue : options.onFalse);
1779
- }
1780
- function mapBoth(fx, f, g) {
1781
- return map(mapError(fx, f), g);
1782
- }
1783
- //# sourceMappingURL=core.js.map