@typed/fx 1.18.4 → 1.20.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 (423) hide show
  1. package/AsyncData/package.json +6 -0
  2. package/Emitter/package.json +6 -0
  3. package/Form/package.json +6 -0
  4. package/FormEntry/package.json +6 -0
  5. package/Fx/package.json +6 -0
  6. package/Guard/package.json +6 -0
  7. package/Idle/package.json +6 -0
  8. package/Match/package.json +6 -0
  9. package/Pull/package.json +6 -0
  10. package/Push/package.json +6 -0
  11. package/RefArray/package.json +6 -0
  12. package/RefChunk/package.json +6 -0
  13. package/RefHashMap/package.json +6 -0
  14. package/RefHashSet/package.json +6 -0
  15. package/RefSubject/package.json +6 -0
  16. package/Sink/package.json +6 -0
  17. package/Stream/package.json +6 -0
  18. package/Subject/package.json +6 -0
  19. package/TypeId/package.json +6 -0
  20. package/Typeclass/package.json +6 -0
  21. package/Versioned/package.json +6 -0
  22. package/dist/cjs/AsyncData.js +177 -0
  23. package/dist/cjs/AsyncData.js.map +1 -0
  24. package/dist/cjs/Emitter.js +24 -21
  25. package/dist/cjs/Emitter.js.map +1 -1
  26. package/dist/cjs/Form.js +78 -21
  27. package/dist/cjs/Form.js.map +1 -1
  28. package/dist/cjs/FormEntry.js +75 -48
  29. package/dist/cjs/FormEntry.js.map +1 -1
  30. package/dist/cjs/Fx.js +517 -872
  31. package/dist/cjs/Fx.js.map +1 -1
  32. package/dist/cjs/Guard.js +21 -13
  33. package/dist/cjs/Guard.js.map +1 -1
  34. package/dist/cjs/Idle.js +49 -37
  35. package/dist/cjs/Idle.js.map +1 -1
  36. package/dist/cjs/Match.js +99 -61
  37. package/dist/cjs/Match.js.map +1 -1
  38. package/dist/cjs/Pull.js.map +1 -1
  39. package/dist/cjs/Push.js +168 -0
  40. package/dist/cjs/Push.js.map +1 -0
  41. package/dist/cjs/RefArray.js +32 -30
  42. package/dist/cjs/RefArray.js.map +1 -1
  43. package/dist/cjs/RefChunk.js +26 -24
  44. package/dist/cjs/RefChunk.js.map +1 -1
  45. package/dist/cjs/RefHashMap.js +20 -20
  46. package/dist/cjs/RefHashMap.js.map +1 -1
  47. package/dist/cjs/RefHashSet.js +11 -8
  48. package/dist/cjs/RefHashSet.js.map +1 -1
  49. package/dist/cjs/RefSubject.js +899 -158
  50. package/dist/cjs/RefSubject.js.map +1 -1
  51. package/dist/cjs/Sink.js +588 -62
  52. package/dist/cjs/Sink.js.map +1 -1
  53. package/dist/cjs/Stream.js +15 -10
  54. package/dist/cjs/Stream.js.map +1 -1
  55. package/dist/cjs/Subject.js +153 -55
  56. package/dist/cjs/Subject.js.map +1 -1
  57. package/dist/cjs/TypeId.js +10 -5
  58. package/dist/cjs/TypeId.js.map +1 -1
  59. package/dist/cjs/Typeclass.js +28 -31
  60. package/dist/cjs/Typeclass.js.map +1 -1
  61. package/dist/cjs/Versioned.js +118 -57
  62. package/dist/cjs/Versioned.js.map +1 -1
  63. package/dist/cjs/index.js +44 -8
  64. package/dist/cjs/index.js.map +1 -1
  65. package/dist/cjs/internal/{deferred-ref.js → DeferredRef.js} +45 -13
  66. package/dist/cjs/internal/DeferredRef.js.map +1 -0
  67. package/dist/cjs/internal/UnionToTuple.js +6 -0
  68. package/dist/cjs/internal/UnionToTuple.js.map +1 -0
  69. package/dist/cjs/internal/core.js +1590 -779
  70. package/dist/cjs/internal/core.js.map +1 -1
  71. package/dist/cjs/internal/diff.js +114 -0
  72. package/dist/cjs/internal/diff.js.map +1 -0
  73. package/dist/cjs/internal/effect-loop-operator.js +288 -0
  74. package/dist/cjs/internal/effect-loop-operator.js.map +1 -0
  75. package/dist/cjs/internal/effect-operator.js +46 -37
  76. package/dist/cjs/internal/effect-operator.js.map +1 -1
  77. package/dist/cjs/internal/effect-producer.js +74 -0
  78. package/dist/cjs/internal/effect-producer.js.map +1 -0
  79. package/dist/cjs/internal/helpers.js +158 -128
  80. package/dist/cjs/internal/helpers.js.map +1 -1
  81. package/dist/cjs/internal/keyed.js +136 -173
  82. package/dist/cjs/internal/keyed.js.map +1 -1
  83. package/dist/cjs/internal/loop-operator.js +213 -0
  84. package/dist/cjs/internal/loop-operator.js.map +1 -0
  85. package/dist/cjs/internal/operator.js +79 -0
  86. package/dist/cjs/internal/operator.js.map +1 -0
  87. package/dist/cjs/internal/protos.js +19 -81
  88. package/dist/cjs/internal/protos.js.map +1 -1
  89. package/dist/cjs/internal/provide.js +47 -25
  90. package/dist/cjs/internal/provide.js.map +1 -1
  91. package/dist/cjs/internal/requestIdleCallback.js +5 -5
  92. package/dist/cjs/internal/requestIdleCallback.js.map +1 -1
  93. package/dist/cjs/internal/share.js +12 -15
  94. package/dist/cjs/internal/share.js.map +1 -1
  95. package/dist/cjs/internal/sync-operator.js +50 -22
  96. package/dist/cjs/internal/sync-operator.js.map +1 -1
  97. package/dist/cjs/internal/sync-producer.js +114 -0
  98. package/dist/cjs/internal/sync-producer.js.map +1 -0
  99. package/dist/cjs/internal/withKey.js +45 -51
  100. package/dist/cjs/internal/withKey.js.map +1 -1
  101. package/dist/dts/AsyncData.d.ts +185 -0
  102. package/dist/dts/AsyncData.d.ts.map +1 -0
  103. package/dist/dts/Emitter.d.ts +13 -20
  104. package/dist/dts/Emitter.d.ts.map +1 -1
  105. package/dist/dts/Form.d.ts +45 -28
  106. package/dist/dts/Form.d.ts.map +1 -1
  107. package/dist/dts/FormEntry.d.ts +25 -13
  108. package/dist/dts/FormEntry.d.ts.map +1 -1
  109. package/dist/dts/Fx.d.ts +983 -1387
  110. package/dist/dts/Fx.d.ts.map +1 -1
  111. package/dist/dts/Guard.d.ts +8 -1
  112. package/dist/dts/Guard.d.ts.map +1 -1
  113. package/dist/dts/Idle.d.ts +3 -3
  114. package/dist/dts/Idle.d.ts.map +1 -1
  115. package/dist/dts/Match.d.ts +8 -8
  116. package/dist/dts/Match.d.ts.map +1 -1
  117. package/dist/dts/Pull.d.ts +5 -5
  118. package/dist/dts/Pull.d.ts.map +1 -1
  119. package/dist/dts/Push.d.ts +170 -0
  120. package/dist/dts/Push.d.ts.map +1 -0
  121. package/dist/dts/RefArray.d.ts +21 -23
  122. package/dist/dts/RefArray.d.ts.map +1 -1
  123. package/dist/dts/RefChunk.d.ts +17 -19
  124. package/dist/dts/RefChunk.d.ts.map +1 -1
  125. package/dist/dts/RefHashMap.d.ts +19 -20
  126. package/dist/dts/RefHashMap.d.ts.map +1 -1
  127. package/dist/dts/RefHashSet.d.ts +12 -16
  128. package/dist/dts/RefHashSet.d.ts.map +1 -1
  129. package/dist/dts/RefSubject.d.ts +396 -187
  130. package/dist/dts/RefSubject.d.ts.map +1 -1
  131. package/dist/dts/Sink.d.ts +193 -93
  132. package/dist/dts/Sink.d.ts.map +1 -1
  133. package/dist/dts/Stream.d.ts +7 -1
  134. package/dist/dts/Stream.d.ts.map +1 -1
  135. package/dist/dts/Subject.d.ts +27 -36
  136. package/dist/dts/Subject.d.ts.map +1 -1
  137. package/dist/dts/TypeId.d.ts +10 -0
  138. package/dist/dts/TypeId.d.ts.map +1 -1
  139. package/dist/dts/Typeclass.d.ts +2 -2
  140. package/dist/dts/Typeclass.d.ts.map +1 -1
  141. package/dist/dts/Versioned.d.ts +50 -78
  142. package/dist/dts/Versioned.d.ts.map +1 -1
  143. package/dist/dts/index.d.ts +66 -6
  144. package/dist/dts/index.d.ts.map +1 -1
  145. package/dist/dts/internal/DeferredRef.d.ts +20 -0
  146. package/dist/dts/internal/DeferredRef.d.ts.map +1 -0
  147. package/dist/dts/internal/UnionToTuple.d.ts +6 -0
  148. package/dist/dts/internal/UnionToTuple.d.ts.map +1 -0
  149. package/dist/dts/internal/core.d.ts +218 -450
  150. package/dist/dts/internal/core.d.ts.map +1 -1
  151. package/dist/dts/internal/diff.d.ts +38 -0
  152. package/dist/dts/internal/diff.d.ts.map +1 -0
  153. package/dist/dts/internal/effect-loop-operator.d.ts +34 -0
  154. package/dist/dts/internal/effect-loop-operator.d.ts.map +1 -0
  155. package/dist/dts/internal/effect-operator.d.ts +8 -5
  156. package/dist/dts/internal/effect-operator.d.ts.map +1 -1
  157. package/dist/dts/internal/effect-producer.d.ts +25 -0
  158. package/dist/dts/internal/effect-producer.d.ts.map +1 -0
  159. package/dist/dts/internal/helpers.d.ts +33 -24
  160. package/dist/dts/internal/helpers.d.ts.map +1 -1
  161. package/dist/dts/internal/keyed.d.ts +3 -3
  162. package/dist/dts/internal/keyed.d.ts.map +1 -1
  163. package/dist/dts/internal/loop-operator.d.ts +40 -0
  164. package/dist/dts/internal/loop-operator.d.ts.map +1 -0
  165. package/dist/dts/internal/operator.d.ts +16 -0
  166. package/dist/dts/internal/operator.d.ts.map +1 -0
  167. package/dist/dts/internal/protos.d.ts +16 -43
  168. package/dist/dts/internal/protos.d.ts.map +1 -1
  169. package/dist/dts/internal/provide.d.ts +7 -1
  170. package/dist/dts/internal/provide.d.ts.map +1 -1
  171. package/dist/dts/internal/share.d.ts +12 -9
  172. package/dist/dts/internal/share.d.ts.map +1 -1
  173. package/dist/dts/internal/sync-operator.d.ts +7 -3
  174. package/dist/dts/internal/sync-operator.d.ts.map +1 -1
  175. package/dist/dts/internal/sync-producer.d.ts +36 -0
  176. package/dist/dts/internal/sync-producer.d.ts.map +1 -0
  177. package/dist/dts/internal/withKey.d.ts +3 -3
  178. package/dist/dts/internal/withKey.d.ts.map +1 -1
  179. package/dist/esm/AsyncData.js +151 -0
  180. package/dist/esm/AsyncData.js.map +1 -0
  181. package/dist/esm/Emitter.js +24 -21
  182. package/dist/esm/Emitter.js.map +1 -1
  183. package/dist/esm/Form.js +69 -14
  184. package/dist/esm/Form.js.map +1 -1
  185. package/dist/esm/FormEntry.js +77 -52
  186. package/dist/esm/FormEntry.js.map +1 -1
  187. package/dist/esm/Fx.js +509 -874
  188. package/dist/esm/Fx.js.map +1 -1
  189. package/dist/esm/Guard.js +5 -1
  190. package/dist/esm/Guard.js.map +1 -1
  191. package/dist/esm/Idle.js +49 -39
  192. package/dist/esm/Idle.js.map +1 -1
  193. package/dist/esm/Match.js +103 -63
  194. package/dist/esm/Match.js.map +1 -1
  195. package/dist/esm/Pull.js.map +1 -1
  196. package/dist/esm/Push.js +159 -0
  197. package/dist/esm/Push.js.map +1 -0
  198. package/dist/esm/RefArray.js +32 -30
  199. package/dist/esm/RefArray.js.map +1 -1
  200. package/dist/esm/RefChunk.js +26 -24
  201. package/dist/esm/RefChunk.js.map +1 -1
  202. package/dist/esm/RefHashMap.js +20 -20
  203. package/dist/esm/RefHashMap.js.map +1 -1
  204. package/dist/esm/RefHashSet.js +11 -8
  205. package/dist/esm/RefHashSet.js.map +1 -1
  206. package/dist/esm/RefSubject.js +873 -150
  207. package/dist/esm/RefSubject.js.map +1 -1
  208. package/dist/esm/Sink.js +608 -57
  209. package/dist/esm/Sink.js.map +1 -1
  210. package/dist/esm/Stream.js +13 -9
  211. package/dist/esm/Stream.js.map +1 -1
  212. package/dist/esm/Subject.js +151 -56
  213. package/dist/esm/Subject.js.map +1 -1
  214. package/dist/esm/TypeId.js +9 -4
  215. package/dist/esm/TypeId.js.map +1 -1
  216. package/dist/esm/Typeclass.js +29 -29
  217. package/dist/esm/Typeclass.js.map +1 -1
  218. package/dist/esm/Versioned.js +110 -53
  219. package/dist/esm/Versioned.js.map +1 -1
  220. package/dist/esm/index.js +66 -6
  221. package/dist/esm/index.js.map +1 -1
  222. package/dist/esm/internal/DeferredRef.js +54 -0
  223. package/dist/esm/internal/DeferredRef.js.map +1 -0
  224. package/dist/esm/internal/UnionToTuple.js +2 -0
  225. package/dist/esm/internal/UnionToTuple.js.map +1 -0
  226. package/dist/esm/internal/core.js +1439 -719
  227. package/dist/esm/internal/core.js.map +1 -1
  228. package/dist/esm/internal/diff.js +82 -0
  229. package/dist/esm/internal/diff.js.map +1 -0
  230. package/dist/esm/internal/effect-loop-operator.js +269 -0
  231. package/dist/esm/internal/effect-loop-operator.js.map +1 -0
  232. package/dist/esm/internal/effect-operator.js +44 -37
  233. package/dist/esm/internal/effect-operator.js.map +1 -1
  234. package/dist/esm/internal/effect-producer.js +47 -0
  235. package/dist/esm/internal/effect-producer.js.map +1 -0
  236. package/dist/esm/internal/helpers.js +157 -129
  237. package/dist/esm/internal/helpers.js.map +1 -1
  238. package/dist/esm/internal/keyed.js +128 -139
  239. package/dist/esm/internal/keyed.js.map +1 -1
  240. package/dist/esm/internal/loop-operator.js +186 -0
  241. package/dist/esm/internal/loop-operator.js.map +1 -0
  242. package/dist/esm/internal/operator.js +68 -0
  243. package/dist/esm/internal/operator.js.map +1 -0
  244. package/dist/esm/internal/protos.js +16 -75
  245. package/dist/esm/internal/protos.js.map +1 -1
  246. package/dist/esm/internal/provide.js +33 -25
  247. package/dist/esm/internal/provide.js.map +1 -1
  248. package/dist/esm/internal/requestIdleCallback.js +5 -5
  249. package/dist/esm/internal/requestIdleCallback.js.map +1 -1
  250. package/dist/esm/internal/share.js +12 -12
  251. package/dist/esm/internal/share.js.map +1 -1
  252. package/dist/esm/internal/sync-operator.js +49 -21
  253. package/dist/esm/internal/sync-operator.js.map +1 -1
  254. package/dist/esm/internal/sync-producer.js +88 -0
  255. package/dist/esm/internal/sync-producer.js.map +1 -0
  256. package/dist/esm/internal/withKey.js +46 -47
  257. package/dist/esm/internal/withKey.js.map +1 -1
  258. package/package.json +22 -62
  259. package/src/AsyncData.ts +447 -0
  260. package/src/Emitter.ts +47 -38
  261. package/src/Form.ts +185 -65
  262. package/src/FormEntry.ts +142 -109
  263. package/src/Fx.ts +1685 -1851
  264. package/src/Guard.ts +12 -1
  265. package/src/Idle.ts +76 -62
  266. package/src/Match.ts +149 -93
  267. package/src/Pull.ts +8 -8
  268. package/src/Push.ts +472 -0
  269. package/src/RefArray.ts +53 -51
  270. package/src/RefChunk.ts +44 -41
  271. package/src/RefHashMap.ts +57 -43
  272. package/src/RefHashSet.ts +21 -31
  273. package/src/RefSubject.ts +1984 -457
  274. package/src/Sink.ts +922 -171
  275. package/src/Stream.ts +32 -20
  276. package/src/Subject.ts +230 -87
  277. package/src/TypeId.ts +16 -4
  278. package/src/Typeclass.ts +31 -32
  279. package/src/Versioned.ts +220 -168
  280. package/src/index.ts +78 -6
  281. package/src/internal/DeferredRef.ts +62 -0
  282. package/src/internal/UnionToTuple.ts +11 -0
  283. package/src/internal/core.ts +2491 -1950
  284. package/src/internal/diff.ts +157 -0
  285. package/src/internal/effect-loop-operator.ts +466 -0
  286. package/src/internal/effect-operator.ts +89 -54
  287. package/src/internal/effect-producer.ts +125 -0
  288. package/src/internal/helpers.ts +275 -205
  289. package/src/internal/keyed.ts +192 -241
  290. package/src/internal/loop-operator.ts +266 -0
  291. package/src/internal/operator.ts +87 -0
  292. package/src/internal/protos.ts +29 -104
  293. package/src/internal/provide.ts +48 -40
  294. package/src/internal/requestIdleCallback.ts +5 -6
  295. package/src/internal/share.ts +26 -24
  296. package/src/internal/sync-operator.ts +68 -27
  297. package/src/internal/sync-producer.ts +146 -0
  298. package/src/internal/withKey.ts +64 -74
  299. package/dist/cjs/Computed.js +0 -115
  300. package/dist/cjs/Computed.js.map +0 -1
  301. package/dist/cjs/Filtered.js +0 -95
  302. package/dist/cjs/Filtered.js.map +0 -1
  303. package/dist/cjs/Model.js +0 -119
  304. package/dist/cjs/Model.js.map +0 -1
  305. package/dist/cjs/RefAsyncData.js +0 -187
  306. package/dist/cjs/RefAsyncData.js.map +0 -1
  307. package/dist/cjs/RefAsyncDataArray.js +0 -38
  308. package/dist/cjs/RefAsyncDataArray.js.map +0 -1
  309. package/dist/cjs/RefBoolean.js +0 -45
  310. package/dist/cjs/RefBoolean.js.map +0 -1
  311. package/dist/cjs/RefNumber.js +0 -49
  312. package/dist/cjs/RefNumber.js.map +0 -1
  313. package/dist/cjs/internal/core-ref-subject.js +0 -254
  314. package/dist/cjs/internal/core-ref-subject.js.map +0 -1
  315. package/dist/cjs/internal/core-subject.js +0 -108
  316. package/dist/cjs/internal/core-subject.js.map +0 -1
  317. package/dist/cjs/internal/deferred-ref.js.map +0 -1
  318. package/dist/cjs/internal/effect-primitive.js +0 -47
  319. package/dist/cjs/internal/effect-primitive.js.map +0 -1
  320. package/dist/cjs/internal/fx-effect-proto.js +0 -58
  321. package/dist/cjs/internal/fx-effect-proto.js.map +0 -1
  322. package/dist/cjs/internal/fx-primitive.js +0 -193
  323. package/dist/cjs/internal/fx-primitive.js.map +0 -1
  324. package/dist/cjs/internal/fx.js +0 -240
  325. package/dist/cjs/internal/fx.js.map +0 -1
  326. package/dist/cjs/internal/matchers.js +0 -34
  327. package/dist/cjs/internal/matchers.js.map +0 -1
  328. package/dist/cjs/internal/run.js +0 -54
  329. package/dist/cjs/internal/run.js.map +0 -1
  330. package/dist/cjs/internal/schema-ref-subject.js +0 -132
  331. package/dist/cjs/internal/schema-ref-subject.js.map +0 -1
  332. package/dist/cjs/internal/versioned-transform.js +0 -46
  333. package/dist/cjs/internal/versioned-transform.js.map +0 -1
  334. package/dist/dts/Computed.d.ts +0 -106
  335. package/dist/dts/Computed.d.ts.map +0 -1
  336. package/dist/dts/Filtered.d.ts +0 -97
  337. package/dist/dts/Filtered.d.ts.map +0 -1
  338. package/dist/dts/Model.d.ts +0 -200
  339. package/dist/dts/Model.d.ts.map +0 -1
  340. package/dist/dts/RefAsyncData.d.ts +0 -236
  341. package/dist/dts/RefAsyncData.d.ts.map +0 -1
  342. package/dist/dts/RefAsyncDataArray.d.ts +0 -56
  343. package/dist/dts/RefAsyncDataArray.d.ts.map +0 -1
  344. package/dist/dts/RefBoolean.d.ts +0 -47
  345. package/dist/dts/RefBoolean.d.ts.map +0 -1
  346. package/dist/dts/RefNumber.d.ts +0 -48
  347. package/dist/dts/RefNumber.d.ts.map +0 -1
  348. package/dist/dts/internal/core-ref-subject.d.ts +0 -100
  349. package/dist/dts/internal/core-ref-subject.d.ts.map +0 -1
  350. package/dist/dts/internal/core-subject.d.ts +0 -5
  351. package/dist/dts/internal/core-subject.d.ts.map +0 -1
  352. package/dist/dts/internal/deferred-ref.d.ts +0 -12
  353. package/dist/dts/internal/deferred-ref.d.ts.map +0 -1
  354. package/dist/dts/internal/effect-primitive.d.ts +0 -6
  355. package/dist/dts/internal/effect-primitive.d.ts.map +0 -1
  356. package/dist/dts/internal/fx-effect-proto.d.ts +0 -30
  357. package/dist/dts/internal/fx-effect-proto.d.ts.map +0 -1
  358. package/dist/dts/internal/fx-primitive.d.ts +0 -109
  359. package/dist/dts/internal/fx-primitive.d.ts.map +0 -1
  360. package/dist/dts/internal/fx.d.ts +0 -245
  361. package/dist/dts/internal/fx.d.ts.map +0 -1
  362. package/dist/dts/internal/matchers.d.ts +0 -33
  363. package/dist/dts/internal/matchers.d.ts.map +0 -1
  364. package/dist/dts/internal/run.d.ts +0 -8
  365. package/dist/dts/internal/run.d.ts.map +0 -1
  366. package/dist/dts/internal/schema-ref-subject.d.ts +0 -5
  367. package/dist/dts/internal/schema-ref-subject.d.ts.map +0 -1
  368. package/dist/dts/internal/versioned-transform.d.ts +0 -17
  369. package/dist/dts/internal/versioned-transform.d.ts.map +0 -1
  370. package/dist/esm/Computed.js +0 -103
  371. package/dist/esm/Computed.js.map +0 -1
  372. package/dist/esm/Filtered.js +0 -83
  373. package/dist/esm/Filtered.js.map +0 -1
  374. package/dist/esm/Model.js +0 -100
  375. package/dist/esm/Model.js.map +0 -1
  376. package/dist/esm/RefAsyncData.js +0 -163
  377. package/dist/esm/RefAsyncData.js.map +0 -1
  378. package/dist/esm/RefAsyncDataArray.js +0 -27
  379. package/dist/esm/RefAsyncDataArray.js.map +0 -1
  380. package/dist/esm/RefBoolean.js +0 -31
  381. package/dist/esm/RefBoolean.js.map +0 -1
  382. package/dist/esm/RefNumber.js +0 -35
  383. package/dist/esm/RefNumber.js.map +0 -1
  384. package/dist/esm/internal/core-ref-subject.js +0 -242
  385. package/dist/esm/internal/core-ref-subject.js.map +0 -1
  386. package/dist/esm/internal/core-subject.js +0 -90
  387. package/dist/esm/internal/core-subject.js.map +0 -1
  388. package/dist/esm/internal/deferred-ref.js +0 -23
  389. package/dist/esm/internal/deferred-ref.js.map +0 -1
  390. package/dist/esm/internal/effect-primitive.js +0 -41
  391. package/dist/esm/internal/effect-primitive.js.map +0 -1
  392. package/dist/esm/internal/fx-effect-proto.js +0 -43
  393. package/dist/esm/internal/fx-effect-proto.js.map +0 -1
  394. package/dist/esm/internal/fx-primitive.js +0 -175
  395. package/dist/esm/internal/fx-primitive.js.map +0 -1
  396. package/dist/esm/internal/fx.js +0 -216
  397. package/dist/esm/internal/fx.js.map +0 -1
  398. package/dist/esm/internal/matchers.js +0 -38
  399. package/dist/esm/internal/matchers.js.map +0 -1
  400. package/dist/esm/internal/run.js +0 -32
  401. package/dist/esm/internal/run.js.map +0 -1
  402. package/dist/esm/internal/schema-ref-subject.js +0 -121
  403. package/dist/esm/internal/schema-ref-subject.js.map +0 -1
  404. package/dist/esm/internal/versioned-transform.js +0 -37
  405. package/dist/esm/internal/versioned-transform.js.map +0 -1
  406. package/src/Computed.ts +0 -289
  407. package/src/Filtered.ts +0 -274
  408. package/src/Model.ts +0 -483
  409. package/src/RefAsyncData.ts +0 -547
  410. package/src/RefAsyncDataArray.ts +0 -135
  411. package/src/RefBoolean.ts +0 -71
  412. package/src/RefNumber.ts +0 -77
  413. package/src/internal/core-ref-subject.ts +0 -528
  414. package/src/internal/core-subject.ts +0 -143
  415. package/src/internal/deferred-ref.ts +0 -26
  416. package/src/internal/effect-primitive.ts +0 -230
  417. package/src/internal/fx-effect-proto.ts +0 -56
  418. package/src/internal/fx-primitive.ts +0 -223
  419. package/src/internal/fx.ts +0 -619
  420. package/src/internal/matchers.ts +0 -83
  421. package/src/internal/run.ts +0 -51
  422. package/src/internal/schema-ref-subject.ts +0 -163
  423. package/src/internal/versioned-transform.ts +0 -48
package/dist/esm/Fx.js CHANGED
@@ -1,1259 +1,760 @@
1
1
  /**
2
- * Fx<R, E, A> is a representation of an `Effect`-ful workflow that exists over
3
- * the time dimension. It operates within a context `R`, can fail with an `E`,
4
- * and succeed with an `A`.
5
- *
6
- * Any `Fx`, shorthand for "Effects", can emit 0 or more errors or events over an
7
- * indefinite period of time. This is in contrast to `Effect` which can only
8
- * produce exactly 1 error or event.
9
- *
10
- * It is defined as a super-type of `Effect`, `Stream`, and `Cause`. This
11
- * allows for all operators that accept an `Fx` to also capable of
12
- * accepting an `Effect`, `Stream`, or `Cause`. An Effect or Cause represents a single
13
- * event or error, while a Stream represents a series of events or errors that will
14
- * be pulled from the producer as soon as possible.
15
- *
16
- * @since 1.18.0
2
+ * Fx is a push-based reactive primitive built atop of Effect.
3
+ * @since 1.20.0
17
4
  */
18
5
  import * as Cause from "effect/Cause";
19
6
  import * as Effect from "effect/Effect";
20
7
  import * as Either from "effect/Either";
21
- import { constant, dual, identity } from "effect/Function";
8
+ import { dual, identity } from "effect/Function";
9
+ import * as Layer from "effect/Layer";
22
10
  import * as Option from "effect/Option";
11
+ import { hasProperty } from "effect/Predicate";
12
+ import * as Queue from "effect/Queue";
13
+ import * as Schedule from "effect/Schedule";
14
+ import * as Emitter from "./Emitter.js";
23
15
  import * as core from "./internal/core.js";
24
- import * as primitive from "./internal/fx-primitive.js";
25
- import * as internal from "./internal/fx.js";
26
- import * as internalKeyed from "./internal/keyed.js";
27
- import * as internalProtos from "./internal/protos.js";
28
- import * as internalRun from "./internal/run.js";
29
- import * as Share from "./internal/share.js";
16
+ import * as coreKeyed from "./internal/keyed.js";
17
+ import * as protos from "./internal/protos.js";
18
+ import * as coreShare from "./internal/share.js";
30
19
  import * as strategies from "./internal/strategies.js";
31
- import * as internalWithKey from "./internal/withKey.js";
20
+ import * as coreWithKey from "./internal/withKey.js";
32
21
  import { transform } from "./RefSubject.js";
22
+ import * as Sink from "./Sink.js";
33
23
  import { TypeId } from "./TypeId.js";
24
+ /**
25
+ * @since 1.20.0
26
+ */
27
+ export function isFx(u) {
28
+ return u === null ? false : hasProperty(u, TypeId);
29
+ }
34
30
  /**
35
31
  * Singleton instance of Unbounded
36
- * @since 1.18.0
32
+ * @since 1.20.0
37
33
  * @category FlattenStrategy
38
34
  */
39
35
  export const Unbounded = strategies.Unbounded;
40
36
  /**
41
37
  * Construct a Bounded strategy
42
- * @since 1.18.0
38
+ * @since 1.20.0
43
39
  * @category FlattenStrategy
44
40
  */
45
41
  export const Bounded = strategies.Bounded;
46
42
  /**
47
43
  * Singleton instance of Switch
48
- * @since 1.18.0
44
+ * @since 1.20.0
49
45
  * @category FlattenStrategy
50
46
  */
51
47
  export const Switch = strategies.Switch;
52
48
  /**
53
49
  * Singleton instance of Exhaust
54
- * @since 1.18.0
50
+ * @since 1.20.0
55
51
  * @category FlattenStrategy
56
52
  */
57
53
  export const Exhaust = strategies.Exhaust;
58
54
  /**
59
55
  * Singleton instance of ExhaustLatest
60
- * @since 1.18.0
56
+ * @since 1.20.0
61
57
  * @category FlattenStrategy
62
58
  */
63
59
  export const ExhaustLatest = strategies.ExhaustLatest;
64
60
  /**
65
61
  * Construct an Unordered strategy
66
- * @since 1.18.0
62
+ * @since 1.20.0
67
63
  * @category MergeStrategy
68
64
  */
69
65
  export const Unordered = strategies.Unordered;
70
66
  /**
71
67
  * Construct an Ordered strategy
72
- * @since 1.18.0
68
+ * @since 1.20.0
73
69
  * @category MergeStrategy
74
70
  */
75
71
  export const Ordered = strategies.Ordered;
76
- /* #endregion */
77
- /* #region Constructor */
78
- /* #region Core */
79
72
  /**
80
- * An Fx which will immediately end producing 0 events and 0 errors.
81
- * @since 1.18.0
82
- * @category constructors
73
+ * @since 1.20.0
83
74
  */
84
- export const empty = core.empty;
75
+ export const make = core.make;
85
76
  /**
86
- * Construct an Fx<never, E, A> from a Cause<E>
87
- * @since 1.18.0
88
- * @category constructors
77
+ * @since 1.20.0
89
78
  */
90
- export const failCause = core.failCause;
79
+ export const succeed = core.succeed;
91
80
  /**
92
- * Construct an Fx<never, never, never> from a defect
93
- * @since 1.18.0
94
- * @category constructors
81
+ * @since 1.20.0
95
82
  */
96
- export const die = (defect) => failCause(Cause.die(defect));
83
+ export const sync = core.fromSync;
97
84
  /**
98
- * Interrupt the current Fx with the specified FiberId
99
- * @since 1.18.0
100
- * @category constructors
85
+ * @since 1.20.0
101
86
  */
102
- export const interrupt = (id) => failCause(Cause.interrupt(id));
87
+ export const fromArray = core.fromArray;
103
88
  /**
104
- * Construct an Fx which will fail with the specified error.
105
- * @since 1.18.0
106
- * @category constructors
89
+ * @since 1.20.0
107
90
  */
108
- export const fail = core.fail;
91
+ export const fromIterable = core.fromIterable;
109
92
  /**
110
- * Construct an Fx<R, E, A> from an Effect<R, E, A>
111
- * @since 1.18.0
112
- * @category constructors
93
+ * @since 1.20.0
113
94
  */
114
95
  export const fromEffect = core.fromEffect;
115
96
  /**
116
- * Construct an Fx from an Iterable
117
- * @since 1.18.0
118
- * @category constructors
97
+ * @since 1.20.0
119
98
  */
120
- export const fromIterable = core.fromIterable;
99
+ export const fromScheduled = dual(2, core.fromScheduled);
121
100
  /**
122
- * Construct an Fx<R, E, A> from an Effect<R, E, A>
123
- * @since 1.18.0
124
- * @category constructors
101
+ * @since 1.20.0
125
102
  */
126
- export const fromStream = core.fromStream;
103
+ export const schedule = dual(2, core.schedule);
127
104
  /**
128
- * Construct an Fx<R, E, A> from an Effect<R, E, A>
129
- * @since 1.18.0
130
- * @category constructors
105
+ * @since 1.20.0
131
106
  */
132
- export const from = core.from;
107
+ export const periodic = dual(2, (iterator, period) => continueWith(fromEffect(iterator), () => schedule(iterator, Schedule.spaced(period))));
133
108
  /**
134
- * Construct an Fx by describing an Effectful workflow that has access to a Sink
135
- * to emit events and errors.
136
- * @since 1.18.0
137
- * @category constructors
109
+ * @since 1.20.0
138
110
  */
139
- export const fromSink = core.fromSink;
111
+ export const failCause = core.failCause;
140
112
  /**
141
- * Construct an Fx by describing an Scoped Effect that has access to an Emitter
142
- * to emit events and errors.
143
- * @since 1.18.0
144
- * @category constructors
113
+ * @since 1.20.0
145
114
  */
146
- export const fromEmitter = core.fromEmitter;
115
+ export const fail = core.fail;
147
116
  /**
148
- * An Fx which will never emit any errors or events, and will never end
149
- * @since 1.18.0
150
- * @category constructors
117
+ * @since 1.20.0
151
118
  */
152
- export const never = core.never;
119
+ export const die = core.die;
153
120
  /**
154
- * Construct an Fx which will emit the specified value and then end.
155
- * @since 1.18.0
156
- * @category constructors
121
+ * @since 1.20.0
157
122
  */
158
- export const succeed = core.succeed;
123
+ export const map = dual(2, core.map);
159
124
  /**
160
- * Construct an Fx which will emit the return of a synchronous function and then end.
161
- * @since 1.18.0
162
- * @category constructors
125
+ * @since 1.20.0
163
126
  */
164
- export const sync = core.sync;
127
+ export const filter = dual(2, core.filter);
165
128
  /**
166
- * Lazily construct an Fx.
167
- * @since 1.18.0
168
- * @category constructors
129
+ * @since 1.20.0
169
130
  */
170
- export const suspend = core.suspend;
131
+ export const filterMap = dual(2, core.filterMap);
171
132
  /**
172
- * Helper for constructing your own custom subtypes of an Fx
173
- * @since 1.18.0
174
- * @category Subtyping
133
+ * @since 1.20.0
175
134
  */
176
- export class ToFx extends primitive.ToFx {
177
- }
135
+ export const compact = (fx) => filterMap(fx, identity);
178
136
  /**
179
- * Create an Fx which will emit a value after waiting for a specified duration.
180
- * @since 1.18.0
181
- * @category constructors
137
+ * @since 1.20.0
182
138
  */
183
- export const at = internal.at;
139
+ export const mapEffect = dual(2, core.mapEffect);
184
140
  /**
185
- * Construct an Fx which can fork effects into a Scope.
186
- * @since 1.18.0
187
- * @category constructors
141
+ * @since 1.20.0
188
142
  */
189
- export const withScopedFork = core.withScopedFork;
143
+ export const filterMapEffect = dual(2, core.filterMapEffect);
190
144
  /**
191
- * Construct an Fx which can exit early from a Scope.
192
- * @since 1.18.0
193
- * @category constructors
145
+ * @since 1.20.0
194
146
  */
195
- export const withEarlyExit = core.withEarlyExit;
147
+ export const filterEffect = dual(2, core.filterEffect);
196
148
  /**
197
- * Construct an Fx which can flatten nested Fx.
198
- * @since 1.18.0
199
- * @category constructors
149
+ * @since 1.20.0
200
150
  */
201
- export const withFlattenStrategy = core.withFlattenStrategy;
202
- /* #endregion */
203
- /* #region Additions */
151
+ export const tapEffect = dual(2, core.tapEffect);
204
152
  /**
205
- * Acquire a resource, use it to construct an Fx, and then release the resource
206
- * after the Fx has exited.
207
- *
208
- * @since 1.18.0
209
- * @category constructors
153
+ * @since 1.20.0
210
154
  */
211
- export const acquireUseRelease = core.acquireUseRelease;
155
+ export const tap = dual(2, (fx, f) => tapEffect(fx, (a) => Effect.sync(() => f(a))));
212
156
  /**
213
- * Combine multiple Fx into a single Fx that will emit the results of all Fx
214
- * as a tuple of values.
215
- *
216
- * @since 1.18.0
217
- * @category constructors
157
+ * @since 1.20.0
218
158
  */
219
- export const combine = core.combine;
159
+ export const loop = dual(3, core.loop);
220
160
  /**
221
- * Combine a record of Fx into a single Fx that will emit the results of all Fx
222
- * as a record of values.
223
- *
224
- * @since 1.18.0
225
- * @category constructors
161
+ * @since 1.20.0
226
162
  */
227
- export const struct = (fx) => map(combine(Object.entries(fx).map(([k, fx]) => map(fx, (v) => [k, v]))), Object.fromEntries);
163
+ export const filterMapLoop = dual(3, core.filterMapLoop);
228
164
  /**
229
- * Combine multiple Fx into a single Fx that will emit the results of all Fx
230
- * as they occur.
231
- * @since 1.18.0
232
- * @category constructors
165
+ * @since 1.20.0
233
166
  */
234
- export const merge = core.merge;
167
+ export const loopEffect = dual(3, core.loopEffect);
235
168
  /**
236
- * Combine multiple Fx into a single Fx that will emit the results of all Fx
237
- * as they occur, but only allowing `n` concurrent Fx to run at a time.
238
- *
239
- * @since 1.18.0
240
- * @category constructors
169
+ * @since 1.20.0
241
170
  */
242
- export const mergeConcurrently = core.mergeConcurrently;
171
+ export const filterMapLoopEffect = dual(3, core.filterMapLoopEffect);
243
172
  /**
244
- * Combine multiple Fx into a single Fx that will emit the results of all Fx
245
- * in the order the Fx were provided. All Fx will be executed concurrently,
246
- * and the results will be buffered if necessary to preserve ordering.
247
- *
248
- * @since 1.18.0
249
- * @category constructors
173
+ * @since 1.20.0
250
174
  */
251
- export const mergeBuffer = core.mergeBuffer;
175
+ export const observe = dual(2, core.observe);
252
176
  /**
253
- * Combine multiple Fx into a single Fx that will emit the results of all Fx
254
- * in the order the Fx were provided. All Fx will be executed concurrently, limited
255
- * by the provided concurrency, and the results will be buffered if necessary to preserve ordering.
256
- *
257
- * @since 1.18.0
258
- * @category constructors
177
+ * @since 1.20.0
259
178
  */
260
- export const mergeBufferConcurrently = core.mergeBufferConcurrently;
179
+ export const drain = core.drain;
261
180
  /**
262
- * Merge together multiple Fx into a single Fx that will emit the results of all Fx
263
- * allowing only 1 Fx to run at a time.
264
- *
265
- * @since 1.18.0
266
- * @category constructors
181
+ * @since 1.20.0
267
182
  */
268
- export const mergeSwitch = (fxs) => core.mergeSwitch(fxs);
183
+ export const reduce = dual(3, core.reduce);
269
184
  /**
270
- * Merge together multiple Fx into a single Fx that will emit the results of the
271
- * first Fx to emit a value.
272
- *
273
- * @since 1.18.0
274
- * @category constructors
185
+ * @since 1.20.0
275
186
  */
276
- export const race = core.race;
187
+ export const toReadonlyArray = core.toReadonlyArray;
277
188
  /**
278
- * Schedule an Effect to run using the provided Schedule, emitting its success of failure
279
- * at the intervals specified by the Schedule.
280
- *
281
- * @since 1.18.0
282
- * @category constructors
189
+ * @since 1.20.0
283
190
  */
284
- export const fromScheduled = core.fromScheduled;
191
+ export const slice = dual(3, core.slice);
285
192
  /**
286
- * Schedule an Effect to run at the specified duration.
287
- *
288
- * @since 1.18.0
289
- * @category constructors
193
+ * @since 1.20.0
290
194
  */
291
- export const periodic = core.periodic;
195
+ export const take = dual(2, core.take);
292
196
  /**
293
- * Consume a Dequeue as soon as values become available and emit them as a Fx.
294
- * @since 1.18.0
295
- * @category constructors
197
+ * @since 1.20.0
296
198
  */
297
- export const fromDequeue = internal.fromDequeue;
199
+ export const drop = dual(2, core.drop);
298
200
  /**
299
- * Consume a PubSub as soon as values become available and emit them as a Fx.
300
- * @since 1.18.0
301
- * @category constructors
201
+ * @since 1.20.0
302
202
  */
303
- export const fromPubSub = internal.fromPubSub;
304
- /* #endregion */
305
- /* #region Running */
203
+ export const skipRepeats = core.skipRepeats;
306
204
  /**
307
- * Run an Fx to completion with the provided Sink. The
308
- * Effect will resolve with the first Error of the Fx.
309
- * @since 1.18.0
310
- * @category running
205
+ * @since 1.20.0
311
206
  */
312
- export const run = dual(2, internalRun.run);
207
+ export const skipRepeatsWith = dual(2, core.skipRepeatsWith);
313
208
  /**
314
- * Observe an Fx with the provided success value handler. The
315
- * Effect will resolve with the first Error of the Fx.
316
- *
317
- * @since 1.18.0
318
- * @category running
209
+ * @since 1.20.0
319
210
  */
320
- export const observe = dual(2, core.observe);
211
+ export const empty = core.empty;
321
212
  /**
322
- * Run an Fx to completion. The Effect will resolve with the first Error of the Fx.
323
- *
324
- * @since 1.18.0
325
- * @category running
213
+ * @since 1.20.0
326
214
  */
327
- export const drain = core.drain;
215
+ export const never = core.never;
328
216
  /**
329
- * Reduce an Fx to a single value.
330
- * @since 1.18.0
331
- * @category running
217
+ * @since 1.20.0
332
218
  */
333
- export const reduce = core.reduce;
219
+ export const padWith = dual(3, core.padWith);
334
220
  /**
335
- * Run an Fx to completion, collecting all emitted values into an Array.
336
- * @since 1.18.0
337
- * @category running
221
+ * @since 1.20.0
338
222
  */
339
- export const toArray = core.toArray;
223
+ export const prependAll = dual(2, core.prependAll);
340
224
  /**
341
- * Run an Fx to completion, collecting all emitted values into a ReadonlyArray.
342
- * @since 1.18.0
343
- * @category running
225
+ * @since 1.20.0
344
226
  */
345
- export const toReadonlyArray = core.toReadonlyArray;
227
+ export const appendAll = dual(2, core.appendAll);
346
228
  /**
347
- * Run an Fx to completion, collecting all emitted values into a Chunk.
348
- * @since 1.18.0
349
- * @category running
229
+ * @since 1.20.0
350
230
  */
351
- export const toChunk = core.toChunk;
231
+ export const prepend = dual(2, core.prepend);
352
232
  /**
353
- * Consume an Fx and place its values into an Enqueue.
354
- * @since 1.18.0
355
- * @category running
233
+ * @since 1.20.0
356
234
  */
357
- export const toEnqueue = internal.toEnqueue;
358
- /* #endregion */
359
- /* #region Combinators */
235
+ export const append = dual(2, core.append);
360
236
  /**
361
- * Map over the success value of an Fx.
362
- * @since 1.18.0
363
- * @category combinators
237
+ * @since 1.20.0
364
238
  */
365
- export const map = core.map;
239
+ export const scan = dual(3, core.scan);
366
240
  /**
367
- * Map over both failure and success values of an Fx.
368
- * @since 1.18.0
369
- * @category combinators
241
+ * @since 1.20.0
370
242
  */
371
- export const mapBoth = core.mapBoth;
243
+ export const flatMapWithStrategy = dual(4, core.flatMapWithStrategy);
244
+ const isDataFirstFx = (args) => isFx(args[0]);
372
245
  /**
373
- * Filter the success value of an Fx.
374
- * @since 1.18.0
375
- * @category combinators
246
+ * @since 1.20.0
376
247
  */
377
- export const filter = core.filter;
248
+ export const flatMap = dual(isDataFirstFx, core.flatMap);
378
249
  /**
379
- * Filter and map the success value of an Fx.
380
- * @since 1.18.0
381
- * @category combinators
250
+ * @since 1.20.0
382
251
  */
383
- export const filterMap = core.filterMap;
252
+ export const flatMapEffect = dual(isDataFirstFx, core.flatMapEffect);
384
253
  /**
385
- * Unwrap Options by filtering any None values.
386
- * @since 1.18.0
387
- * @category combinators
254
+ * @since 1.20.0
388
255
  */
389
- export const compact = core.compact;
256
+ export const switchMap = dual(isDataFirstFx, core.switchMap);
390
257
  /**
391
- * Map over the Cause of an Fx.
392
- * @since 1.18.0
393
- * @category errors
258
+ * @since 1.20.0
394
259
  */
395
- export const mapErrorCause = core.mapErrorCause;
260
+ export const switchMapEffect = dual(isDataFirstFx, core.switchMapEffect);
396
261
  /**
397
- * Map over the Error of an Fx.
398
- * @since 1.18.0
399
- * @category errors
262
+ * @since 1.20.0
400
263
  */
401
- export const mapError = core.mapError;
264
+ export const exhaustMap = dual(isDataFirstFx, core.exhaustMap);
402
265
  /**
403
- * Filter the Cause of an Fx.
404
- * @since 1.18.0
405
- * @category errors
266
+ * @since 1.20.0
406
267
  */
407
- export const filterErrorCause = core.filterCause;
268
+ export const exhaustMapEffect = dual(isDataFirstFx, core.exhaustMapEffect);
408
269
  /**
409
- * Filter and map the Cause of an Fx.
410
- * @since 1.18.0
411
- * @category errors
270
+ * @since 1.20.0
412
271
  */
413
- export const filterMapCause = core.filterMapCause;
272
+ export const exhaustMapLatest = dual(isDataFirstFx, core.exhaustMapLatest);
414
273
  /**
415
- * Filter the Error of an Fx.
416
- * @since 1.18.0
417
- * @category errors
274
+ * @since 1.20.0
418
275
  */
419
- export const filterError = core.filterError;
276
+ export const exhaustMapLatestEffect = dual(isDataFirstFx, core.exhaustMapLatestEffect);
420
277
  /**
421
- * Filter and map the error of an Fx.
422
- * @since 1.18.0
423
- * @category errors
278
+ * @since 1.20.0
424
279
  */
425
- export const filterMapError = core.filterMapError;
280
+ export const flatMapConcurrently = dual(isDataFirstFx, core.flatMapConcurrently);
426
281
  /**
427
- * Filter and map the error of an Fx using an Effect.
428
- * @since 1.18.0
429
- * @category errors
282
+ * @since 1.20.0
430
283
  */
431
- export const filterMapErrorEffect = core.filterMapErrorEffect;
284
+ export const flatMapConcurrentlyEffect = dual(isDataFirstFx, core.flatMapConcurrentlyEffect);
432
285
  /**
433
- * Map the success value of an Fx to another Fx, flattening the result
434
- * with the provided FlattenStrategy.
435
- * @since 1.18.0
436
- * @category flattening
286
+ * @since 1.20.0
437
287
  */
438
- export const flatMapWithStrategy = dual(3, core.flatMapWithStrategy);
288
+ export const concatMap = dual(isDataFirstFx, core.concatMap);
439
289
  /**
440
- * Map the success value of an Fx to another Fx, switching to the latest
441
- * Fx emitted and interrupting the previous.
442
- * @since 1.18.0
443
- * @category flattening
290
+ * @since 1.20.0
444
291
  */
445
- export const switchMap = core.switchMap;
292
+ export const fromFxEffect = core.fromFxEffect;
446
293
  /**
447
- * Map the success value of an Fx to another Fx, switching to the latest
448
- * Fx emitted and interrupting the previous.
449
- * @since 1.18.0
450
- * @category flattening
294
+ * @since 1.20.0
451
295
  */
452
- export const switchLatest = core.switchMap((x) => x);
296
+ export const continueWith = dual(2, core.continueWith);
453
297
  /**
454
- * Map the success value of an Fx to another Fx, prefering the first
455
- * Fx emitted and dropping any subsequent Fx until it has completed.
456
- * @since 1.18.0
457
- * @category flattening
298
+ * @since 1.20.0
458
299
  */
459
- export const exhaustMap = core.exhaustMap;
300
+ export const orElseCause = dual(2, core.orElseCause);
460
301
  /**
461
- * Flatten a nested Fx, prefering the first
462
- * Fx emitted and dropping any subsequent Fx until it has completed.
463
- * @since 1.18.0
464
- * @category flattening
302
+ * @since 1.20.0
465
303
  */
466
- export const exhaust = core.exhaust;
304
+ export const orElse = dual(2, core.orElse);
467
305
  /**
468
- * Map the success value of an Fx to another Fx, prefering the first
469
- * until completion, and then running the last emitted Fx if they are not
470
- * the same Fx.
471
- *
472
- * @since 1.18.0
473
- * @category flattening
306
+ * @since 1.20.0
474
307
  */
475
- export const exhaustMapLatest = core.exhaustMapLatest;
308
+ export const suspend = core.suspend;
476
309
  /**
477
- * Flatten a nested Fx, prefering the first until completion, and then running the last emitted Fx if they are not
478
- * the same Fx.
479
- *
480
- * @since 1.18.0
481
- * @category flattening
310
+ * @since 1.20.0
482
311
  */
483
- export const exhaustLatest = core.exhaustLatest;
312
+ export const mergeWithStrategy = dual(2, core.mergeWithStrategy);
484
313
  /**
485
- * Map the success value of an Fx to another Fx with unbounded concurrency.
486
- *
487
- * @since 1.18.0
488
- * @category flattening
314
+ * @since 1.20.0
489
315
  */
490
- export const flatMap = core.flatMap;
316
+ export const merge = dual(2, core.merge);
491
317
  /**
492
- * Map the success value of an Fx to another Fx with unbounded concurrency.
493
- *
494
- * @since 1.18.0
495
- * @category flattening
318
+ * @since 1.20.0
496
319
  */
497
- export const flatten = core.flatten;
320
+ export const mergeAll = core.mergeAll;
498
321
  /**
499
- * Map the success value of an Fx to another Fx with the specified concurrency.
500
- *
501
- * @since 1.18.0
502
- * @category flattening
322
+ * @since 1.20.0
503
323
  */
504
- export const flatMapConcurrently = core.flatMapConcurrently;
324
+ export const mergeOrdered = core.mergeOrdered;
505
325
  /**
506
- * Map the success value of an Fx to another Fx one at a time.
507
- *
508
- * @since 1.18.0
509
- * @category flattening
326
+ * @since 1.20.0
510
327
  */
511
- export const concatMap = core.concatMap;
328
+ export const mergeOrderedConcurrently = core.mergeOrderedConcurrently;
512
329
  /**
513
- * Skip and take a number of values from an Fx.
514
- *
515
- * @since 1.18.0
516
- * @category slicing
330
+ * @since 1.20.0
517
331
  */
518
- export const slice = core.slice;
332
+ export const mergeSwitch = core.mergeSwitch;
519
333
  /**
520
- * Take a number of values from an Fx.
521
- *
522
- * @since 1.18.0
523
- * @category slicing
334
+ * @since 1.20.0
524
335
  */
525
- export const take = core.take;
336
+ export const takeWhile = dual(2, core.takeWhile);
526
337
  /**
527
- * Drop a number of values from an Fx.
528
- *
529
- * @since 1.18.0
530
- * @category slicing
338
+ * @since 1.20.0
531
339
  */
532
- export const drop = core.drop;
340
+ export const takeUntil = dual(2, core.takeUntil);
533
341
  /**
534
- * Take values from an Fx while the predicate returns true.
535
- *
536
- * @since 1.18.0
537
- * @category slicing
342
+ * @since 1.20.0
538
343
  */
539
- export const takeWhile = core.takeWhile;
344
+ export const dropWhile = dual(2, core.dropWhile);
540
345
  /**
541
- * Take values from an Fx until the predicate returns true.
542
- *
543
- * @since 1.18.0
544
- * @category slicing
346
+ * @since 1.20.0
545
347
  */
546
- export const takeUntil = core.takeUntil;
348
+ export const dropUntil = dual(2, core.dropUntil);
547
349
  /**
548
- * Drop values from an Fx while the predicate returns true.
549
- *
550
- * @since 1.18.0
551
- * @category slicing
350
+ * @since 1.20.0
552
351
  */
553
- export const dropWhile = core.dropWhile;
352
+ export const dropAfter = dual(2, core.dropAfter);
554
353
  /**
555
- * Drop values from an Fx until the predicate returns true.
556
- *
557
- * @since 1.18.0
558
- * @category slicing
354
+ * @since 1.20.0
559
355
  */
560
- export const dropUntil = core.dropUntil;
356
+ export const takeWhileEffect = dual(2, core.takeWhileEffect);
561
357
  /**
562
- * Drop values from an Fx after the predicate returns true.
563
- *
564
- * @since 1.18.0
565
- * @category slicing
358
+ * @since 1.20.0
566
359
  */
567
- export const dropAfter = core.dropAfter;
360
+ export const takeUntiEffect = dual(2, core.takeUntilEffect);
568
361
  /**
569
- * Concatenate an Fx after the successful completion of another Fx
570
- *
571
- * @since 1.18.0
572
- * @category combinators
362
+ * @since 1.20.0
573
363
  */
574
- export const continueWith = core.continueWith;
364
+ export const dropWhileEffect = dual(2, core.dropWhileEffect);
575
365
  /**
576
- * Concatenate an Fx after the failure of another Fx
577
- *
578
- * @since 1.18.0
579
- * @category combinators
366
+ * @since 1.20.0
580
367
  */
581
- export const orElse = core.recoverWith;
368
+ export const dropUntilEffect = dual(2, core.dropUntilEffect);
582
369
  /**
583
- * Map the success value of an Fx to an Effect, doesn't fork any fibers like flatMap* etc.
584
- *
585
- * @since 1.18.0
586
- * @category combinators
370
+ * @since 1.20.0
587
371
  */
588
- export const mapEffect = core.mapEffect;
372
+ export const dropAfterEffect = dual(2, core.dropAfterEffect);
589
373
  /**
590
- * Perform an Effect for each value emitted by an Fx, not affecting the output of the Fx.
591
- *
592
- * @since 1.18.0
593
- * @category combinators
374
+ * @since 1.20.0
594
375
  */
595
- export const tap = core.tap;
376
+ export const during = dual(2, core.during);
596
377
  /**
597
- * Filter the success value of an Fx with an Effect.
598
- *
599
- * @since 1.18.0
600
- * @category combinators
378
+ * @since 1.20.0
601
379
  */
602
- export const filterEffect = core.filterEffect;
380
+ export const since = dual(2, core.since);
603
381
  /**
604
- * Filter and map the success value of an Fx with an Effect.
605
- *
606
- * @since 1.18.0
607
- * @category combinators
382
+ * @since 1.20.0
608
383
  */
609
- export const filterMapEffect = core.filterMapEffect;
384
+ export const until = dual(2, core.until);
610
385
  /**
611
- * Apply a function to the constructed Effect that represents the running Fx.
612
- *
613
- * @since 1.18.0
614
- * @category combinators
386
+ * @since 1.20.0
615
387
  */
616
- export const middleware = core.middleware;
388
+ export const middleware = dual(isDataFirstFx, core.middleware);
617
389
  /**
618
- * Accumulate a value over the success values of an Fx and atomically produce derived value.
619
- *
620
- * @since 1.18.0
621
- * @category combinators
390
+ * @since 1.20.0
622
391
  */
623
- export const loop = core.loop;
392
+ export const onExit = dual(2, core.onExit);
624
393
  /**
625
- * Emit values with their previously emitted values when possible.
626
- *
627
- * @since 1.18.0
628
- * @category combinators
394
+ * @since 1.20.0
629
395
  */
630
- export const withPrevious = (fx) => loop(fx, Option.none(), (previous, current) => [[previous, current], Option.some(current)]);
396
+ export const onInterrupt = dual(2, core.onInterrupt);
631
397
  /**
632
- * Accumulate a value over the success values of an Fx and atomically produce derived value
633
- * useing an Effect. A SynchronizedRef is utilized to ensure ordering of events.
634
- *
635
- * @since 1.18.0
636
- * @category combinators
398
+ * @since 1.20.0
637
399
  */
638
- export const loopEffect = core.loopEffect;
400
+ export const onError = dual(2, core.onError);
639
401
  /**
640
- * Prepends a value to the beginning of an Fx.
641
- *
642
- * @since 1.18.0
643
- * @category combinators
402
+ * @since 1.20.0
644
403
  */
645
- export const startWith = core.startWith;
404
+ export const scoped = core.scoped;
646
405
  /**
647
- * Appends a value to the end of an Fx.
648
- *
649
- * @since 1.18.0
650
- * @category combinators
406
+ * @since 1.20.0
651
407
  */
652
- export const endWith = core.endWith;
408
+ export const annotateLogs = dual(isDataFirstFx, core.annotateLogs);
653
409
  /**
654
- * Run a reducer over the success values of an Fx.
655
- *
656
- * @since 1.18.0
657
- * @category combinators
410
+ * @since 1.20.0
658
411
  */
659
- export const scan = core.scan;
412
+ export const annotateSpans = dual(isDataFirstFx, core.annotateSpans);
660
413
  /**
661
- * Run an Effect-ful reducer over the success values of an Fx.
662
- *
663
- * @since 1.18.0
664
- * @category combinators
414
+ * @since 1.20.0
665
415
  */
666
- export const scanEffect = core.scanEffect;
416
+ export const interruptible = core.interruptible;
667
417
  /**
668
- * Map the failures of an Fx to another Fx, flattening the result
669
- * with the provided FlattenStrategy.
670
- * @since 1.18.0
671
- * @category flattening
418
+ * @since 1.20.0
672
419
  */
673
- export const flatMapCauseWithStrategy = core.flatMapCauseWithStrategy;
420
+ export const uninterruptible = core.uninterruptible;
674
421
  /**
675
- * Map the failures of an Fx to another Fx, flattening the result
676
- * with the provided FlattenStrategy.
677
- * @since 1.18.0
678
- * @category flattening
422
+ * @since 1.20.0
679
423
  */
680
- export const flatMapErrorWithStrategy = core.flatMapErrorWithStrategy;
424
+ export const locally = dual(3, core.locally);
681
425
  /**
682
- * Map the failures of an Fx to another Fx, flattening the result with unbounded concurrency.
683
- *
684
- * @since 1.18.0
685
- * @category flattening
426
+ * @since 1.20.0
686
427
  */
687
- export const flatMapCause = core.flatMapCause;
428
+ export const locallyWith = dual(3, core.locallyWith);
688
429
  /**
689
- * Map the failures of an Fx to another Fx, flattening the result with unbounded concurrency.
690
- *
691
- * @since 1.18.0
692
- * @category flattening
430
+ * @since 1.20.0
693
431
  */
694
- export const flatMapError = core.flatMapError;
432
+ export const withTracerTiming = dual(2, core.withTracerTiming);
695
433
  /**
696
- * Map the failures of an Fx to another Fx with the specified concurrency.
697
- *
698
- * @since 1.18.0
699
- * @category flattening
434
+ * @since 1.20.0
700
435
  */
701
- export const flatMapCauseConcurrently = core.flatMapCauseConcurrently;
436
+ export const withConcurrency = dual(2, core.withConcurrency);
702
437
  /**
703
- * Map the failures of an Fx to another Fx with the specified concurrency.
704
- *
705
- * @since 1.18.0
706
- * @category flattening
438
+ * @since 1.20.0
707
439
  */
708
- export const flatMapErrorConcurrently = core.flatMapErrorConcurrently;
440
+ export const withConfigProvider = dual(2, core.withConfigProvider);
709
441
  /**
710
- * Map the failures of an Fx to another Fx, switching to the latest
711
- * Fx emitted and interrupting the previous.
712
- *
713
- * @since 1.18.0
714
- * @category flattening
442
+ * @since 1.20.0
715
443
  */
716
- export const switchMapCause = core.switchMapCause;
444
+ export const withLogSpan = dual(2, core.withLogSpan);
717
445
  /**
718
- * Map the failures of an Fx to another Fx, switching to the latest
719
- * Fx emitted and interrupting the previous.
720
- *
721
- * @since 1.18.0
722
- * @category flattening
446
+ * @since 1.20.0
723
447
  */
724
- export const switchMapError = core.switchMapError;
448
+ export const withMaxOpsBeforeYield = dual(2, core.withMaxOpsBeforeYield);
725
449
  /**
726
- * Map the failures of an Fx to another Fx, prefering the first
727
- * Fx emitted and dropping any subsequent Fx until it has completed.
728
- *
729
- * @since 1.18.0
730
- * @category flattening
450
+ * @since 1.20.0
731
451
  */
732
- export const exhaustMapCause = core.exhaustMapCause;
452
+ export const withParentSpan = dual(2, core.withParentSpan);
733
453
  /**
734
- * Map the failures of an Fx to another Fx, prefering the first
735
- * Fx emitted and dropping any subsequent Fx until it has completed.
736
- *
737
- * @since 1.18.0
738
- * @category flattening
454
+ * @since 1.20.0
739
455
  */
740
- export const exhaustMapError = core.exhaustMapError;
456
+ export const withRequestBatching = dual(2, core.withRequestBatching);
741
457
  /**
742
- * Map the failures of an Fx to another Fx, prefering the first
743
- * until completion, and then running the last emitted Fx if they are not
744
- * the same Fx.
745
- *
746
- * @since 1.18.0
747
- * @category flattening
458
+ * @since 1.20.0
748
459
  */
749
- export const exhaustMapLatestCause = core.exhaustMapLatestCause;
460
+ export const withRequestCache = dual(2, core.withRequestCache);
750
461
  /**
751
- * Map the failures of an Fx to another Fx, prefering the first
752
- * until completion, and then running the last emitted Fx if they are not
753
- * the same Fx.
754
- *
755
- * @since 1.18.0
756
- * @category flattening
462
+ * @since 1.20.0
757
463
  */
758
- export const exhaustMapLatestError = core.exhaustMapLatestError;
464
+ export const withRequestCaching = dual(2, core.withRequestCaching);
759
465
  /**
760
- * Map over the failures and successes of an Fx, flattening both using the same strategy.
761
- *
762
- * @since 1.18.0
763
- * @category flattening
466
+ * @since 1.20.0
764
467
  */
765
- export const matchCauseWithStrategy = core.matchCauseWithStrategy;
468
+ export const withTracer = dual(2, core.withTracer);
766
469
  /**
767
- * Map over the failures and successes of an Fx, flattening both using the same strategy.
768
- *
769
- * @since 1.18.0
770
- * @category flattening
470
+ * @since 1.20.0
771
471
  */
772
- export const matchErrorWithStrategy = core.matchErrorWithStrategy;
472
+ export const acquireUseRelease = dual(3, core.acquireUseRelease);
773
473
  /**
774
- * Map over the failures and successes of an Fx, flattening both with unbounded concurrency.
775
- *
776
- * @since 1.18.0
777
- * @category flattening
474
+ * @since 1.20.0
778
475
  */
779
- export const matchCause = core.matchCause;
476
+ export const withSpan = dual(3, core.withSpan);
780
477
  /**
781
- * Map over the failures and successes of an Fx, flattening both with unbounded concurrency.
782
- *
783
- * @since 1.18.0
784
- * @category flattening
478
+ * @since 1.20.0
785
479
  */
786
- export const match = core.match;
480
+ export const provideContext = dual(2, core.provideContext);
787
481
  /**
788
- * Map over the failures and successes of an Fx, flattening both with the specified concurrency.
789
- *
790
- * @since 1.18.0
791
- * @category flattening
482
+ * @since 1.20.0
792
483
  */
793
- export const matchCauseConcurrently = core.matchCauseConcurrently;
484
+ export const provideLayer = dual(2, core.provideLayer);
794
485
  /**
795
- * Map over the failures and successes of an Fx, flattening both with the specified concurrency.
796
- *
797
- * @since 1.18.0
798
- * @category flattening
486
+ * @since 1.20.0
799
487
  */
800
- export const matchErrorConcurrently = core.matchErrorConcurrently;
488
+ export const provideRuntime = dual(2, core.provideRuntime);
801
489
  /**
802
- * Map over the failures and successes of an Fx, switching to the latest
803
- * Fx emitted and interrupting the previous.
804
- *
805
- * @since 1.18.0
806
- * @category flattening
490
+ * @since 1.20.0
807
491
  */
808
- export const switchMatchCause = core.switchMatchCause;
492
+ export const provideService = dual(3, core.provideService);
809
493
  /**
810
- * Map over the failures and successes of an Fx, switching to the latest
811
- * Fx emitted and interrupting the previous.
812
- *
813
- * @since 1.18.0
814
- * @category flattening
494
+ * @since 1.20.0
815
495
  */
816
- export const switchMatch = core.switchMatch;
496
+ export const provideServiceEffect = dual(3, core.provideServiceEffect);
817
497
  /**
818
- * Map over the failures and successes of an Fx, prefering the first
819
- * Fx emitted and dropping any subsequent Fx until it has completed.
820
- *
821
- * @since 1.18.0
822
- * @category flattening
498
+ * @since 1.20.0
823
499
  */
824
- export const exhaustMatchCause = core.exhaustMatchCause;
500
+ export const provide = dual(2, core.provide);
825
501
  /**
826
- * Map over the failures and successes of an Fx, prefering the first
827
- * Fx emitted and dropping any subsequent Fx until it has completed.
828
- *
829
- * @since 1.18.0
830
- * @category flattening
502
+ * @since 1.20.0
831
503
  */
832
- export const exhaustMatch = core.exhaustMatch;
504
+ export const share = dual(2, coreShare.share);
833
505
  /**
834
- * Map over the failures and successes of an Fx, prefering the first
835
- * Fx emitted and starting the latest Fx when the first completes
836
- * if they are not the same Fx.
837
- *
838
- * @since 1.18.0
839
- * @category flattening
506
+ * @since 1.20.0
840
507
  */
841
- export const exhaustLatestMatchCause = core.exhaustLatestMatchCause;
508
+ export const multicast = coreShare.multicast;
842
509
  /**
843
- * Map over the failures and successes of an Fx, prefering the first
844
- * Fx emitted and starting the latest Fx when the first completes
845
- * if they are not the same Fx.
846
- *
847
- * @since 1.18.0
848
- * @category flattening
510
+ * @since 1.20.0
849
511
  */
850
- export const exhaustLatestMatch = core.exhaustLatestMatch;
512
+ export const hold = coreShare.hold;
851
513
  /**
852
- * Listen to the events of an Fx within the provided window. When the window Fx
853
- * emits the inner stream, the fx will begin allowing events to pass through,
854
- * and when the inner stream emits, the fx will be interrupted.
855
- *
856
- * @since 1.18.0
857
- * @category time slicing
514
+ * @since 1.20.0
858
515
  */
859
- export const during = core.during;
516
+ export const replay = dual(2, coreShare.replay);
860
517
  /**
861
- * Listen to the events of an Fx after the provided window emits.
862
- *
863
- * @since 1.18.0
864
- * @category time slicing
518
+ * @since 1.20.0
865
519
  */
866
- export const since = core.since;
520
+ export const mapCause = dual(2, core.mapCause);
867
521
  /**
868
- * Listen to the events of an Fx until the provided window emits.
869
- *
870
- * @since 1.18.0
871
- * @category time slicing
522
+ * @since 1.20.0
872
523
  */
873
- export const until = core.until;
524
+ export const mapError = dual(2, core.mapError);
874
525
  /**
875
- * Provide the environment to an Fx.
876
- *
877
- * @since 1.18.0
878
- * @category context
526
+ * @since 1.20.0
879
527
  */
880
- export const provide = core.provide;
528
+ export const mapBoth = dual(3, core.mapBoth);
881
529
  /**
882
- * Provide a service to an Fx using a Tag.
883
- * @since 1.18.0
884
- * @category context
530
+ * @since 1.20.0
885
531
  */
886
- export const provideService = core.provideService;
532
+ export const filterCause = dual(2, core.filterCause);
887
533
  /**
888
- * Provide a service using an Effect to an Fx using a Tag.
889
- *
890
- * @since 1.18.0
891
- * @category context
534
+ * @since 1.20.0
892
535
  */
893
- export const provideServiceEffect = core.provideServiceEffect;
536
+ export const filterError = dual(2, core.filterError);
894
537
  /**
895
- * Skip repeated values, using the provided Equivalence to compare values.
896
- *
897
- * @since 1.18.0
898
- * @category slicing
538
+ * @since 1.20.0
899
539
  */
900
- export const skipRepeatsWith = core.skipRepeatsWith;
540
+ export const filterMapCause = dual(2, core.filterMapCause);
901
541
  /**
902
- * Skip repeated values, using @effect/data/Equal for value comparison.
903
- *
904
- * @since 1.18.0
905
- * @category slicing
542
+ * @since 1.20.0
906
543
  */
907
- export const skipRepeats = core.skipRepeats;
544
+ export const filterMapError = dual(2, core.filterMapError);
908
545
  /**
909
- * Sample the values of an Fx, or Effect, during the events of another Fx.
910
- *
911
- * @since 1.18.0
912
- * @category combinators
546
+ * @since 1.20.0
913
547
  */
914
- export const snapshot = core.snapshot;
548
+ export const mapCauseEffect = dual(2, core.mapCauseEffect);
915
549
  /**
916
- * Share the output of an Fx, or Effect, with other Fx's using the behavior of the
917
- * provided Subject.
918
- *
919
- * @since 1.18.0
920
- * @category sharing
550
+ * @since 1.20.0
921
551
  */
922
- export const share = Share.share;
552
+ export const mapErrorEffect = dual(2, core.mapErrorEffect);
923
553
  /**
924
- * Effeciently share an underlying stream with multiple subscribers.
925
- *
926
- * @since 1.18.0
927
- * @category sharing
554
+ * @since 1.20.0
928
555
  */
929
- export const multicast = Share.multicast;
556
+ export const filterCauseEffect = dual(2, core.filterCauseEffect);
930
557
  /**
931
- * Effeciently share an underlying stream with multiple subscribers, saving the most
932
- * recent event and emitting it to new subscribers.
933
- *
934
- * @since 1.18.0
935
- * @category sharing
558
+ * @since 1.20.0
936
559
  */
937
- export const hold = Share.hold;
560
+ export const filterErrorEffect = dual(2, core.filterErrorEffect);
938
561
  /**
939
- * Effeciently share an underlying stream with multiple subscribers,
940
- * saving up to the most recent `n` events and emitting them to new subscribers.
941
- *
942
- * @since 1.18.0
943
- * @category sharing
562
+ * @since 1.20.0
944
563
  */
945
- export const replay = Share.replay;
564
+ export const filterMapCauseEffect = dual(2, core.filterMapCauseEffect);
946
565
  /**
947
- * Create an Fx which will wait a specified duration of time where no
948
- * events have occurred before emitting a value.
949
- * @since 1.18.0
950
- * @category time slicing
566
+ * @since 1.20.0
951
567
  */
952
- export const debounce = internal.debounce;
568
+ export const filterMapErrorEffect = dual(2, core.filterMapErrorEffect);
953
569
  /**
954
- * Create an Fx which will wait a specified duration of time before emitting
955
- * an event after the last event.
956
- * @since 1.18.0
957
- * @category time slicing
570
+ * @since 1.20.0
958
571
  */
959
- export const throttle = internal.throttle;
572
+ export const loopCause = dual(3, core.loopCause);
960
573
  /**
961
- * Create an Fx which will wait a specified duration of time where no
962
- * events have occurred before emitting a value.
963
- * @since 1.18.0
964
- * @category combinators
574
+ * @since 1.20.0
965
575
  */
966
- export const delay = internal.delay;
576
+ export const loopError = dual(3, core.loopError);
967
577
  /**
968
- * Run an Effect to produce an Fx to run.
969
- * @since 1.18.0
970
- * @category constructors
578
+ * @since 1.20.0
971
579
  */
972
- export const fromFxEffect = internal.fromFxEffect;
580
+ export const loopCauseEffect = dual(3, core.loopCauseEffect);
973
581
  /**
974
- * Utilize Effect.gen to construct an Fx
975
- * @since 1.18.0
976
- * @category constructors
582
+ * @since 1.20.0
977
583
  */
978
- export function gen(f) {
979
- return fromFxEffect(Effect.gen(f));
980
- }
584
+ export const loopErrorEffect = dual(3, core.loopErrorEffect);
981
585
  /**
982
- * Utilize Effect.gen to construct an Fx
983
- * @since 1.18.0
984
- * @category constructors
586
+ * @since 1.20.0
985
587
  */
986
- export function genScoped(f) {
987
- return scoped(fromFxEffect(Effect.gen(f)));
988
- }
588
+ export const filterMapLoopCause = dual(3, core.filterMapLoopCause);
989
589
  /**
990
- * Run an Effect when an Fx exits
991
- * @since 1.18.0
992
- * @category lifecycles
590
+ * @since 1.20.0
993
591
  */
994
- export const onExit = internal.onExit;
592
+ export const filterMapLoopError = dual(3, core.filterMapLoopError);
995
593
  /**
996
- * Run an Effect when an Fx is interrupted
997
- * @since 1.18.0
998
- * @category lifecycles
594
+ * @since 1.20.0
999
595
  */
1000
- export const onInterrupt = internal.onInterrupt;
596
+ export const filterMapLoopCauseEffect = dual(3, core.filterMapLoopCauseEffect);
1001
597
  /**
1002
- * Run an Effect when an Fx ends with an error
1003
- * @since 1.18.0
1004
- * @category lifecycles
598
+ * @since 1.20.0
1005
599
  */
1006
- export const onError = internal.onError;
600
+ export const filterMapLoopErrorEffect = dual(3, core.filterMapLoopErrorEffect);
1007
601
  /**
1008
- * Provide a Scope to an Fx
1009
- * @since 1.18.0
1010
- * @category context
602
+ * @since 1.20.0
1011
603
  */
1012
- export const scoped = internal.scoped;
604
+ export const flatMapCauseWithStrategy = dual(isDataFirstFx, core.flatMapCauseWithStrategy);
1013
605
  /**
1014
- * Annotate the logs of an Fx
1015
- * @since 1.18.0
1016
- * @category combinators
606
+ * @since 1.20.0
1017
607
  */
1018
- export const annotateLogs = internal.annotateLogs;
608
+ export const flatMapErrorWithStrategy = dual(isDataFirstFx, core.flatMapErrorWithStrategy);
1019
609
  /**
1020
- * Annotate the spans of an Fx
1021
- * @since 1.18.0
1022
- * @category combinators
1023
- */
1024
- export const annotateSpans = internal.annotateSpans;
1025
- /**
1026
- * Create an Fx which will succeed with Option.None
1027
- * @since 1.18.0
1028
- * @category constructors
610
+ * @since 1.20.0
1029
611
  */
1030
- export const succeedNone = internal.succeedNone;
612
+ export const switchMapCause = dual(isDataFirstFx, core.switchMapCause);
1031
613
  /**
1032
- * Create an Fx which will succeed with Option.Some
1033
- * @since 1.18.0
1034
- * @category constructors
614
+ * @since 1.20.0
1035
615
  */
1036
- export const succeedSome = internal.succeedSome;
616
+ export const switchMapError = dual(isDataFirstFx, core.switchMapError);
1037
617
  /**
1038
- * Do simulation
1039
- * @since 1.18.0
1040
- * @category Do
618
+ * @since 1.20.0
1041
619
  */
1042
- export const Do = internal.Do;
620
+ export const flatMapCause = dual(isDataFirstFx, core.flatMapCause);
1043
621
  /**
1044
- * Do simulation
1045
- * @since 1.18.0
1046
- * @category Do
622
+ * @since 1.20.0
1047
623
  */
1048
- export const bind = internal.bind;
624
+ export const flatMapError = dual(isDataFirstFx, core.flatMapError);
1049
625
  /**
1050
- * Do simulation
1051
- * @since 1.18.0
1052
- * @category Do
626
+ * @since 1.20.0
1053
627
  */
1054
- export const bindTo = internal.bindTo;
1055
- const let_ = internal.let;
1056
- export {
628
+ export const flatMapCauseConcurrently = dual(isDataFirstFx, core.flatMapCauseConcurrently);
1057
629
  /**
1058
- * Do simulation
1059
- * @since 1.18.0
1060
- * @category Do
630
+ * @since 1.20.0
1061
631
  */
1062
- let_ as let };
632
+ export const flatMapErrorConcurrently = dual(isDataFirstFx, core.flatMapErrorConcurrently);
1063
633
  /**
1064
- * Ensure a finalizer runs on Fx ext.
1065
- * @since 1.18.0
1066
- * @category combinators
634
+ * @since 1.20.0
1067
635
  */
1068
- export const ensuring = internal.ensuring;
636
+ export const exhaustMapCause = dual(isDataFirstFx, core.exhaustMapCause);
1069
637
  /**
1070
- * Capture the errors and success values as Exit
1071
- * @since 1.18.0
1072
- * @category combinators
638
+ * @since 1.20.0
1073
639
  */
1074
- export const exit = internal.exit;
640
+ export const exhaustMapError = dual(isDataFirstFx, core.exhaustMapError);
1075
641
  /**
1076
- * Capture the errors and success values as Either
1077
- * @since 1.18.0
1078
- * @category combinators
642
+ * @since 1.20.0
1079
643
  */
1080
- export const either = internal.either;
644
+ export const exhaustMapLatestCause = dual(isDataFirstFx, core.exhaustMapLatestCause);
1081
645
  /**
1082
- * Run an Fx until finding a value which satisfies the predicate.
1083
- * @since 1.18.0
1084
- * @category running
646
+ * @since 1.20.0
1085
647
  */
1086
- export const findFirst = internal.findFirst;
648
+ export const exhaustMapLatestError = dual(isDataFirstFx, core.exhaustMapLatestError);
1087
649
  /**
1088
- * Grab the first value emitted by an Fx
1089
- * @since 1.18.0
1090
- * @category running
650
+ * @since 1.20.0
1091
651
  */
1092
- export const first = findFirst(constant(Effect.succeed(true)));
652
+ export const matchCauseWithStrategy = dual(3, core.matchCauseWithStrategy);
1093
653
  /**
1094
- * Transform success values into failures and failures into successes.
1095
- * @since 1.18.0
1096
- * @category combinators
654
+ * @since 1.20.0
1097
655
  */
1098
- export const flip = internal.flip;
656
+ export const matchErrorWithStrategy = dual(3, core.matchErrorWithStrategy);
1099
657
  /**
1100
- * Lift a nullable value into an Fx
1101
- * @since 1.18.0
1102
- * @category constructors
658
+ * @since 1.20.0
1103
659
  */
1104
- export const fromNullable = internal.fromNullable;
1105
- const if_ = internal.if;
1106
- export {
660
+ export const matchCause = dual(2, core.matchCause);
1107
661
  /**
1108
- * Logical if/else using Fx.
1109
- * @since 1.18.0
1110
- * @category combinators
662
+ * @since 1.20.0
1111
663
  */
1112
- if_ as if };
664
+ export const matchError = dual(2, core.matchError);
1113
665
  /**
1114
- * Logical if/else using static values.
1115
- * @since 1.18.0
1116
- * @category combinators
666
+ * @since 1.20.0
1117
667
  */
1118
- export const when = internal.when;
668
+ export const matchCauseConcurrently = dual(3, core.matchCauseConcurrently);
1119
669
  /**
1120
- * Mark an Fx as interruptible
1121
- * @since 1.18.0
1122
- * @category combinators
670
+ * @since 1.20.0
1123
671
  */
1124
- export const interruptible = internal.interruptible;
672
+ export const matchErrorConcurrently = dual(3, core.matchErrorConcurrently);
1125
673
  /**
1126
- * Mark an Fx as uninterruptible
1127
- * @since 1.18.0
1128
- * @category combinators
674
+ * @since 1.20.0
1129
675
  */
1130
- export const uninterruptible = internal.uninterruptible;
676
+ export const switchMatchCause = dual(2, core.switchMatchCause);
1131
677
  /**
1132
- * Locally set the value of a FiberRef
1133
- * @since 1.18.0
1134
- * @category FiberRef
678
+ * @since 1.20.0
1135
679
  */
1136
- export const locally = internal.locally;
680
+ export const switchMatchError = dual(2, core.switchMatchError);
1137
681
  /**
1138
- * Locally set the value of a FiberRef by updating the current value
1139
- * @since 1.18.0
1140
- * @category FiberRef
682
+ * @since 1.20.0
1141
683
  */
1142
- export const locallyWith = internal.locallyWith;
684
+ export const exhaustMatchCause = dual(2, core.exhaustMatchCause);
1143
685
  /**
1144
- * Enable/disable tracer timing for an Fx
1145
- * @since 1.18.0
1146
- * @category tracing
686
+ * @since 1.20.0
1147
687
  */
1148
- export const withTracerTiming = internal.withTracerTiming;
688
+ export const exhaustMatchError = dual(2, core.exhaustMatchError);
1149
689
  /**
1150
- * Configure the concurreny limit of Fibers running within an Fx
1151
- * @since 1.18.0
1152
- * @category concurrency
690
+ * @since 1.20.0
1153
691
  */
1154
- export const withConcurrency = internal.withConcurrency;
692
+ export const exhaustMatchLatestCause = dual(2, core.exhaustMatchLatestCause);
1155
693
  /**
1156
- * Add a span to your log messages
1157
- * @since 1.18.0
1158
- * @category logging
694
+ * @since 1.20.0
1159
695
  */
1160
- export const withLogSpan = internal.withLogSpan;
696
+ export const exhaustMatchLatestError = dual(2, core.exhaustMatchLatestError);
1161
697
  /**
1162
- * Configure the maximum number of operations to run before yielding to the runtime
1163
- * @since 1.18.0
1164
- * @category concurrency
698
+ * @since 1.20.0
1165
699
  */
1166
- export const withMaxOpsBeforeYield = internal.withMaxOpsBeforeYield;
700
+ export const exit = core.exit;
1167
701
  /**
1168
- * Set the parent Span of an Fx
1169
- * @since 1.18.0
1170
- * @category tracing
702
+ * @since 1.20.0
1171
703
  */
1172
- export const withParentSpan = internal.withParentSpan;
704
+ export const either = core.either;
1173
705
  /**
1174
- * Enable/disable request batching within an Fx
1175
- * @since 1.18.0
1176
- * @category batching
706
+ * @since 1.20.0
1177
707
  */
1178
- export const withRequestBatching = internal.withRequestBatching;
708
+ export const tuple = core.tuple;
1179
709
  /**
1180
- * Set the request cache Effects running within an Fx
1181
- * @since 1.18.0
1182
- * @category batching
710
+ * @since 1.20.0
1183
711
  */
1184
- export const withRequestCache = internal.withRequestCache;
712
+ export const struct = core.struct;
1185
713
  /**
1186
- * Enable/disable request caching within an Fx
1187
- * @since 1.18.0
1188
- * @category batching
714
+ * @since 1.20.0
1189
715
  */
1190
- export const withRequestCaching = internal.withRequestCaching;
716
+ export const all = core.all;
1191
717
  /**
1192
- * Configure the scheduler to use within an Fx
1193
- * @since 1.18.0
1194
- * @category concurrency
718
+ * @since 1.20.0
1195
719
  */
1196
- export const withScheduler = internal.withScheduler;
720
+ export const toEnqueue = dual(2, core.toEnqueue);
1197
721
  /**
1198
- * Set the span of an Fx
1199
- * @since 1.18.0
1200
- * @category tracing
722
+ * @since 1.20.0
1201
723
  */
1202
- export const withSpan = internal.withSpan;
724
+ export const debounce = dual(2, core.debounce);
1203
725
  /**
1204
- * Set the tracer used within an Fx
1205
- * @since 1.18.0
1206
- * @category tracing
726
+ * @since 1.20.0
1207
727
  */
1208
- export const withTracer = internal.withTracer;
728
+ export const throttle = dual(2, core.throttle);
1209
729
  /**
1210
- * Partition an Fx into two Fx's based on a either-returning function.
1211
- * @since 1.18.0
1212
- * @category combinators
730
+ * @since 1.20.0
1213
731
  */
1214
- export const partitionMap = internal.partitionMap;
732
+ export const throttleLatest = dual(2, core.throttleLatest);
1215
733
  /**
1216
- * Convert a list of keyed values into persistent workflows for given each key of the list
1217
- * even when the list has been re-ordered.
1218
- *
1219
- * @since 1.18.0
1220
- * @category combinators
734
+ * @since 1.20.0
1221
735
  */
1222
- export const keyed = dual(3, internalKeyed.keyed);
736
+ export const keyed = dual(2, coreKeyed.keyed);
1223
737
  /**
1224
- * Map an Fx of values into workflows similar to Fx.switchMap, but
1225
- * instead of providing the value directly, it is exposed as a RefSubject to
1226
- * allow creating a persistent workflows similar to Fx.keyed but for a single value.
1227
- *
1228
- * @since 1.18.0
1229
- * @category combinators
738
+ * @since 1.20.0
1230
739
  */
1231
- export const withKey = dual(3, internalWithKey.withKey);
740
+ export const withKey = dual(2, coreWithKey.withKey);
1232
741
  const getTag = (a) => a._tag;
1233
742
  /**
1234
743
  * Match over a tagged union of values into a set of persistent workflows
1235
744
  * that allow listening to changes of values with the same tag using the same
1236
745
  * Fx.
1237
746
  *
1238
- * @since 1.18.0
747
+ * @since 1.20.0
1239
748
  * @category combinators
1240
749
  */
1241
750
  export const matchTags = dual(2, function matchTags(fx, matchers) {
1242
- return withKey(fx, getTag, (ref, tag) => matchers[tag](ref));
751
+ return withKey(fx, {
752
+ getKey: getTag,
753
+ onValue: (ref, tag) => matchers[tag](ref)
754
+ });
1243
755
  });
1244
756
  /**
1245
- * @since 1.18.0
1246
- */
1247
- export const drainLayer = internal.drainLayer;
1248
- /* #endregion */
1249
- /**
1250
- * @since 1.18.0
1251
- */
1252
- export function isFx(u) {
1253
- return typeof u === "object" && u !== null && TypeId in u;
1254
- }
1255
- /**
1256
- * @since 1.18.0
757
+ * @since 1.20.0
1257
758
  */
1258
759
  export const matchOption = dual(3, function matchOption(fx, onNone, onSome) {
1259
760
  return matchTags(fx, {
@@ -1262,13 +763,13 @@ export const matchOption = dual(3, function matchOption(fx, onNone, onSome) {
1262
763
  });
1263
764
  });
1264
765
  /**
1265
- * @since 1.18.0
766
+ * @since 1.20.0
1266
767
  */
1267
768
  export const getOrElse = dual(2, function getOrElse(fx, orElse) {
1268
769
  return matchOption(fx, orElse, identity);
1269
770
  });
1270
771
  /**
1271
- * @since 1.18.0
772
+ * @since 1.20.0
1272
773
  */
1273
774
  export const matchEither = dual(3, function matchEither(fx, onLeft, onRight) {
1274
775
  return matchTags(fx, {
@@ -1277,28 +778,162 @@ export const matchEither = dual(3, function matchEither(fx, onLeft, onRight) {
1277
778
  });
1278
779
  });
1279
780
  /**
1280
- * @since 1.18.0
781
+ * @since 1.20.0
782
+ */
783
+ export const at = dual(2, (value, duration) => fromEffect(Effect.delay(Effect.succeed(value), duration)));
784
+ /**
785
+ * @since 1.20.0
786
+ */
787
+ export function drainLayer(...fxs) {
788
+ return Layer.scopedDiscard(Effect.forkWithErrorHandler(core.drain(core.mergeAll(fxs)), Effect.logError));
789
+ }
790
+ /**
791
+ * @since 1.20.0
1281
792
  */
1282
793
  export const fork = (fx) => Effect.fork(drain(fx));
1283
794
  /**
1284
- * @since 1.18.0
795
+ * @since 1.20.0
1285
796
  */
1286
797
  export const forkScoped = (fx) => Effect.forkScoped(drain(fx));
1287
798
  /**
1288
- * @since 1.18.0
799
+ * @since 1.20.0
1289
800
  */
1290
801
  export const forkDaemon = (fx) => Effect.forkDaemon(drain(fx));
1291
802
  /**
1292
- * @since 1.18.0
803
+ * @since 1.20.0
1293
804
  */
1294
805
  export const forkIn = dual(2, (fx, scope) => Effect.forkIn(drain(fx), scope));
1295
806
  /**
1296
- * @since 1.18.0
807
+ * @since 1.20.0
808
+ */
809
+ export const fromAsyncIterable = core.fromAsyncIterable;
810
+ /**
811
+ * @since 1.20.0
812
+ */
813
+ export const partitionMap = dual(2, function partitionMap(fx, f) {
814
+ const source = coreShare.multicast(core.map(fx, f));
815
+ return [
816
+ core.filterMap(source, Either.getLeft),
817
+ core.filterMap(source, Either.getRight)
818
+ ];
819
+ });
820
+ /**
821
+ * @since 1.20.0
822
+ */
823
+ export const gen = core.gen;
824
+ /**
825
+ * @since 1.20.0
826
+ */
827
+ export const genScoped = core.genScoped;
828
+ /**
829
+ * @since 1.20.0
830
+ */
831
+ export const findFirst = dual(2, core.findFirst);
832
+ /**
833
+ * @since 1.20.0
834
+ */
835
+ export const first = core.first;
836
+ /**
837
+ * @since 1.20.0
838
+ */
839
+ export const mergeFirst = dual(2, core.mergeFirst);
840
+ /**
841
+ * @since 1.20.0
842
+ */
843
+ export const mergeRace = dual(2, core.mergeRace);
844
+ /**
845
+ * @since 1.20.0
846
+ */
847
+ export const raceAll = core.raceAll;
848
+ /**
849
+ * @since 1.20.0
850
+ */
851
+ export const race = dual(2, core.race);
852
+ /**
853
+ * @since 1.20.0
854
+ */
855
+ export const snapshot = dual(3, core.snapshot);
856
+ /**
857
+ * @since 1.20.0
1297
858
  */
1298
- export const mergeRace = internal.mergeRace;
859
+ export const sample = dual(2, core.sample);
1299
860
  /**
861
+ * @since 1.20.0
862
+ */
863
+ export const snapshotEffect = dual(3, core.snapshotEffect);
864
+ const if_ = dual(2, core.if);
865
+ export {
866
+ /**
867
+ * @since 1.20.0
868
+ */
869
+ if_ as if };
870
+ /**
871
+ * @since 1.20.0
872
+ */
873
+ export const when = dual(2, core.when);
874
+ /**
875
+ * @since 1.20.0
876
+ */
877
+ export const withEmitter = (f) => core.make((sink) => Emitter.withEmitter(sink, f));
878
+ /**
879
+ * Create an Fx which will wait a specified duration of time where no
880
+ * events have occurred before emitting a value.
1300
881
  * @since 1.18.0
1301
882
  */
1302
- export class FxEffectBase extends internalProtos.FxEffectBase {
883
+ export const delay = dual(2, function (fx, delay) {
884
+ return core.flatMap(fx, (a) => core.fromEffect(Effect.delay(Effect.succeed(a), delay)));
885
+ });
886
+ /**
887
+ * @since 1.20.0
888
+ */
889
+ export const ensuring = dual(2, function (self, finalizer) {
890
+ return core.middleware(self, (effect) => Effect.ensuring(effect, finalizer));
891
+ });
892
+ /**
893
+ * @since 1.20.0
894
+ */
895
+ export const flip = (fx) => core.make((sink) => fx.run(Sink.make((cause) => Either.match(Cause.failureOrCause(cause), {
896
+ onLeft: (e) => sink.onSuccess(e),
897
+ onRight: (c) => sink.onFailure(c)
898
+ }), (a) => sink.onFailure(Cause.fail(a)))));
899
+ /**
900
+ * @since 1.20.0
901
+ */
902
+ export const fromNullable = (value) => {
903
+ if (value === null || value === undefined) {
904
+ return core.empty;
905
+ }
906
+ else {
907
+ return core.succeed(value);
908
+ }
909
+ };
910
+ export function fromDequeue(dequeue) {
911
+ return core.make((sink) => Effect.repeatWhileEffect(Effect.matchCauseEffect(dequeue.take, sink), () => dequeueIsActive(dequeue)));
912
+ }
913
+ /**
914
+ * @internal
915
+ */
916
+ export function dequeueIsActive(dequeue) {
917
+ if (Queue.DequeueTypeId in dequeue) {
918
+ return Effect.sync(() => dequeue.isActive());
919
+ }
920
+ else {
921
+ return dequeue.isActive;
922
+ }
923
+ }
924
+ export function fromPubSub(pubSub) {
925
+ return core.acquireUseRelease(pubSub.subscribe, (q) => fromDequeue(q), (d) => d.shutdown);
926
+ }
927
+ /**
928
+ * @since 1.20.0
929
+ */
930
+ export class FxEffectBase extends protos.FxEffectBase {
931
+ _fx;
932
+ /**
933
+ * @since 1.20.0
934
+ */
935
+ run(sink) {
936
+ return (this._fx ||= this.toFx()).run(sink);
937
+ }
1303
938
  }
1304
939
  //# sourceMappingURL=Fx.js.map