@typed/fx 1.6.2 → 1.8.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.
- package/dist/Fx.d.ts +24 -38
- package/dist/Fx.d.ts.map +1 -1
- package/dist/Fx.js +35 -32
- package/dist/Fx.js.map +1 -1
- package/dist/RefSubject.d.ts +44 -0
- package/dist/RefSubject.d.ts.map +1 -0
- package/dist/RefSubject.js +191 -0
- package/dist/RefSubject.js.map +1 -0
- package/dist/Subject.d.ts +18 -0
- package/dist/Subject.d.ts.map +1 -0
- package/dist/Subject.js +24 -0
- package/dist/Subject.js.map +1 -0
- package/dist/at.d.ts +4 -0
- package/dist/at.d.ts.map +1 -0
- package/dist/at.js +6 -0
- package/dist/at.js.map +1 -0
- package/dist/catchAllCause.d.ts +7 -0
- package/dist/catchAllCause.d.ts.map +1 -0
- package/dist/catchAllCause.js +37 -0
- package/dist/catchAllCause.js.map +1 -0
- package/dist/cjs/Fx.d.ts +24 -38
- package/dist/cjs/Fx.d.ts.map +1 -1
- package/dist/cjs/Fx.js +38 -33
- package/dist/cjs/Fx.js.map +1 -1
- package/dist/cjs/RefSubject.d.ts +44 -0
- package/dist/cjs/RefSubject.d.ts.map +1 -0
- package/dist/cjs/RefSubject.js +219 -0
- package/dist/cjs/RefSubject.js.map +1 -0
- package/dist/cjs/Subject.d.ts +18 -0
- package/dist/cjs/Subject.d.ts.map +1 -0
- package/dist/cjs/Subject.js +31 -0
- package/dist/cjs/Subject.js.map +1 -0
- package/dist/cjs/at.d.ts +4 -0
- package/dist/cjs/at.d.ts.map +1 -0
- package/dist/cjs/at.js +10 -0
- package/dist/cjs/at.js.map +1 -0
- package/dist/cjs/catchAllCause.d.ts +7 -0
- package/dist/cjs/catchAllCause.d.ts.map +1 -0
- package/dist/cjs/catchAllCause.js +44 -0
- package/dist/cjs/catchAllCause.js.map +1 -0
- package/dist/cjs/combineAll.d.ts +6 -0
- package/dist/cjs/combineAll.d.ts.map +1 -0
- package/dist/cjs/combineAll.js +34 -0
- package/dist/cjs/combineAll.js.map +1 -0
- package/dist/cjs/continueWith.d.ts +7 -0
- package/dist/cjs/continueWith.d.ts.map +1 -0
- package/dist/cjs/continueWith.js +24 -0
- package/dist/cjs/continueWith.js.map +1 -0
- package/dist/cjs/data-first.d.ts +51 -0
- package/dist/cjs/data-first.d.ts.map +1 -0
- package/dist/cjs/data-first.js +67 -0
- package/dist/cjs/data-first.js.map +1 -0
- package/dist/cjs/debounce.d.ts +4 -0
- package/dist/cjs/debounce.d.ts.map +1 -0
- package/dist/cjs/debounce.js +10 -0
- package/dist/cjs/debounce.js.map +1 -0
- package/dist/cjs/delay.d.ts +4 -0
- package/dist/cjs/delay.d.ts.map +1 -0
- package/dist/cjs/delay.js +10 -0
- package/dist/cjs/delay.js.map +1 -0
- package/dist/cjs/empty.d.ts +3 -0
- package/dist/cjs/empty.d.ts.map +1 -0
- package/dist/cjs/empty.js +33 -0
- package/dist/cjs/empty.js.map +1 -0
- package/dist/cjs/exhaustMap.d.ts +7 -0
- package/dist/cjs/exhaustMap.d.ts.map +1 -0
- package/dist/cjs/exhaustMap.js +41 -0
- package/dist/cjs/exhaustMap.js.map +1 -0
- package/dist/cjs/exhaustMapCause.d.ts +7 -0
- package/dist/cjs/exhaustMapCause.d.ts.map +1 -0
- package/dist/cjs/exhaustMapCause.js +42 -0
- package/dist/cjs/exhaustMapCause.js.map +1 -0
- package/dist/cjs/exhaustMapLatest.d.ts +7 -0
- package/dist/cjs/exhaustMapLatest.d.ts.map +1 -0
- package/dist/cjs/exhaustMapLatest.js +91 -0
- package/dist/cjs/exhaustMapLatest.js.map +1 -0
- package/dist/cjs/exhaustMapLatestCause.d.ts +7 -0
- package/dist/cjs/exhaustMapLatestCause.d.ts.map +1 -0
- package/dist/cjs/exhaustMapLatestCause.js +92 -0
- package/dist/cjs/exhaustMapLatestCause.js.map +1 -0
- package/dist/cjs/externals.d.ts +19 -0
- package/dist/cjs/externals.d.ts.map +1 -0
- package/dist/cjs/externals.js +45 -0
- package/dist/cjs/externals.js.map +1 -0
- package/dist/cjs/failCause.d.ts +7 -0
- package/dist/cjs/failCause.d.ts.map +1 -0
- package/dist/cjs/failCause.js +41 -0
- package/dist/cjs/failCause.js.map +1 -0
- package/dist/cjs/filter.d.ts +7 -0
- package/dist/cjs/filter.d.ts.map +1 -0
- package/dist/cjs/filter.js +15 -0
- package/dist/cjs/filter.js.map +1 -0
- package/dist/cjs/filterMap.d.ts +5 -0
- package/dist/cjs/filterMap.d.ts.map +1 -0
- package/dist/cjs/filterMap.js +14 -0
- package/dist/cjs/filterMap.js.map +1 -0
- package/dist/cjs/flatMap.d.ts +7 -0
- package/dist/cjs/flatMap.d.ts.map +1 -0
- package/dist/cjs/flatMap.js +40 -0
- package/dist/cjs/flatMap.js.map +1 -0
- package/dist/cjs/fromArray.d.ts +3 -0
- package/dist/cjs/fromArray.d.ts.map +1 -0
- package/dist/cjs/fromArray.js +19 -0
- package/dist/cjs/fromArray.js.map +1 -0
- package/dist/cjs/fromEffect.d.ts +4 -0
- package/dist/cjs/fromEffect.d.ts.map +1 -0
- package/dist/cjs/fromEffect.js +10 -0
- package/dist/cjs/fromEffect.js.map +1 -0
- package/dist/cjs/fromEmitter.d.ts +11 -0
- package/dist/cjs/fromEmitter.d.ts.map +1 -0
- package/dist/cjs/fromEmitter.js +29 -0
- package/dist/cjs/fromEmitter.js.map +1 -0
- package/dist/cjs/fromFxEffect.d.ts +4 -0
- package/dist/cjs/fromFxEffect.d.ts.map +1 -0
- package/dist/cjs/fromFxEffect.js +10 -0
- package/dist/cjs/fromFxEffect.js.map +1 -0
- package/dist/cjs/fromIterable.d.ts +3 -0
- package/dist/cjs/fromIterable.d.ts.map +1 -0
- package/dist/cjs/fromIterable.js +24 -0
- package/dist/cjs/fromIterable.js.map +1 -0
- package/dist/cjs/gen.d.ts +7 -0
- package/dist/cjs/gen.d.ts.map +1 -0
- package/dist/cjs/gen.js +10 -0
- package/dist/cjs/gen.js.map +1 -0
- package/dist/cjs/hold.d.ts +14 -0
- package/dist/cjs/hold.d.ts.map +1 -0
- package/dist/cjs/hold.js +35 -0
- package/dist/cjs/hold.js.map +1 -0
- package/dist/cjs/index.d.ts +319 -18
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +127 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/slicing/skipAfter.d.ts +1 -1
- package/dist/cjs/internal/slicing/skipAfter.d.ts.map +1 -1
- package/dist/cjs/internal/slicing/skipWhile.d.ts +1 -1
- package/dist/cjs/map.d.ts +4 -0
- package/dist/cjs/map.d.ts.map +1 -0
- package/dist/cjs/map.js +14 -0
- package/dist/cjs/map.js.map +1 -0
- package/dist/cjs/mergeAll.d.ts +4 -0
- package/dist/cjs/mergeAll.d.ts.map +1 -0
- package/dist/cjs/mergeAll.js +14 -0
- package/dist/cjs/mergeAll.js.map +1 -0
- package/dist/cjs/multicast.d.ts +29 -0
- package/dist/cjs/multicast.d.ts.map +1 -0
- package/dist/cjs/multicast.js +70 -0
- package/dist/cjs/multicast.js.map +1 -0
- package/dist/cjs/never.d.ts +3 -0
- package/dist/cjs/never.d.ts.map +1 -0
- package/dist/cjs/never.js +10 -0
- package/dist/cjs/never.js.map +1 -0
- package/dist/cjs/observe.d.ts +6 -0
- package/dist/cjs/observe.d.ts.map +1 -0
- package/dist/cjs/observe.js +22 -0
- package/dist/cjs/observe.js.map +1 -0
- package/dist/cjs/onInterrupt.d.ts +6 -0
- package/dist/cjs/onInterrupt.d.ts.map +1 -0
- package/dist/cjs/onInterrupt.js +10 -0
- package/dist/cjs/onInterrupt.js.map +1 -0
- package/dist/cjs/promise.d.ts +14 -0
- package/dist/cjs/promise.d.ts.map +1 -0
- package/dist/cjs/promise.js +55 -0
- package/dist/cjs/promise.js.map +1 -0
- package/dist/cjs/provide.d.ts +11 -0
- package/dist/cjs/provide.d.ts.map +1 -0
- package/dist/cjs/provide.js +35 -0
- package/dist/cjs/provide.js.map +1 -0
- package/dist/cjs/reduce.d.ts +3 -0
- package/dist/cjs/reduce.d.ts.map +1 -0
- package/dist/cjs/reduce.js +13 -0
- package/dist/cjs/reduce.js.map +1 -0
- package/dist/cjs/scan.d.ts +3 -0
- package/dist/cjs/scan.d.ts.map +1 -0
- package/dist/cjs/scan.js +13 -0
- package/dist/cjs/scan.js.map +1 -0
- package/dist/cjs/skipRepeats.d.ts +5 -0
- package/dist/cjs/skipRepeats.d.ts.map +1 -0
- package/dist/cjs/skipRepeats.js +21 -0
- package/dist/cjs/skipRepeats.js.map +1 -0
- package/dist/cjs/skipWhile.d.ts +5 -0
- package/dist/cjs/skipWhile.d.ts.map +1 -0
- package/dist/cjs/skipWhile.js +23 -0
- package/dist/cjs/skipWhile.js.map +1 -0
- package/dist/cjs/slice.d.ts +5 -0
- package/dist/cjs/slice.d.ts.map +1 -0
- package/dist/cjs/slice.js +32 -0
- package/dist/cjs/slice.js.map +1 -0
- package/dist/cjs/succeed.d.ts +4 -0
- package/dist/cjs/succeed.d.ts.map +1 -0
- package/dist/cjs/succeed.js +10 -0
- package/dist/cjs/succeed.js.map +1 -0
- package/dist/cjs/suspend.d.ts +3 -0
- package/dist/cjs/suspend.d.ts.map +1 -0
- package/dist/cjs/suspend.js +9 -0
- package/dist/cjs/suspend.js.map +1 -0
- package/dist/cjs/switchMap.d.ts +7 -0
- package/dist/cjs/switchMap.d.ts.map +1 -0
- package/dist/cjs/switchMap.js +34 -0
- package/dist/cjs/switchMap.js.map +1 -0
- package/dist/cjs/switchMapCause.d.ts +7 -0
- package/dist/cjs/switchMapCause.d.ts.map +1 -0
- package/dist/cjs/switchMapCause.js +35 -0
- package/dist/cjs/switchMapCause.js.map +1 -0
- package/dist/cjs/switchMatch.d.ts +7 -0
- package/dist/cjs/switchMatch.d.ts.map +1 -0
- package/dist/cjs/switchMatch.js +35 -0
- package/dist/cjs/switchMatch.js.map +1 -0
- package/dist/cjs/takeWhile.d.ts +5 -0
- package/dist/cjs/takeWhile.d.ts.map +1 -0
- package/dist/cjs/takeWhile.js +23 -0
- package/dist/cjs/takeWhile.js.map +1 -0
- package/dist/cjs/tap.d.ts +5 -0
- package/dist/cjs/tap.d.ts.map +1 -0
- package/dist/cjs/tap.js +14 -0
- package/dist/cjs/tap.js.map +1 -0
- package/dist/cjs/tapCause.d.ts +7 -0
- package/dist/cjs/tapCause.d.ts.map +1 -0
- package/dist/cjs/tapCause.js +23 -0
- package/dist/cjs/tapCause.js.map +1 -0
- package/dist/cjs/test-utils.d.ts +5 -0
- package/dist/cjs/test-utils.d.ts.map +1 -0
- package/dist/cjs/test-utils.js +27 -0
- package/dist/cjs/test-utils.js.map +1 -0
- package/dist/cjs/throttle.d.ts +4 -0
- package/dist/cjs/throttle.d.ts.map +1 -0
- package/dist/cjs/throttle.js +28 -0
- package/dist/cjs/throttle.js.map +1 -0
- package/dist/cjs/toArray.d.ts +5 -0
- package/dist/cjs/toArray.d.ts.map +1 -0
- package/dist/cjs/toArray.js +14 -0
- package/dist/cjs/toArray.js.map +1 -0
- package/dist/cjs/toChunk.d.ts +5 -0
- package/dist/cjs/toChunk.d.ts.map +1 -0
- package/dist/cjs/toChunk.js +14 -0
- package/dist/cjs/toChunk.js.map +1 -0
- package/dist/cjs/toReadonlyArray.d.ts +5 -0
- package/dist/cjs/toReadonlyArray.d.ts.map +1 -0
- package/dist/cjs/toReadonlyArray.js +14 -0
- package/dist/cjs/toReadonlyArray.js.map +1 -0
- package/dist/combineAll.d.ts +6 -0
- package/dist/combineAll.d.ts.map +1 -0
- package/dist/combineAll.js +29 -0
- package/dist/combineAll.js.map +1 -0
- package/dist/continueWith.d.ts +7 -0
- package/dist/continueWith.d.ts.map +1 -0
- package/dist/continueWith.js +17 -0
- package/dist/continueWith.js.map +1 -0
- package/dist/data-first.d.ts +51 -0
- package/dist/data-first.d.ts.map +1 -0
- package/dist/data-first.js +51 -0
- package/dist/data-first.js.map +1 -0
- package/dist/debounce.d.ts +4 -0
- package/dist/debounce.d.ts.map +1 -0
- package/dist/debounce.js +6 -0
- package/dist/debounce.js.map +1 -0
- package/dist/delay.d.ts +4 -0
- package/dist/delay.d.ts.map +1 -0
- package/dist/delay.js +6 -0
- package/dist/delay.js.map +1 -0
- package/dist/empty.d.ts +3 -0
- package/dist/empty.d.ts.map +1 -0
- package/dist/empty.js +6 -0
- package/dist/empty.js.map +1 -0
- package/dist/exhaustMap.d.ts +7 -0
- package/dist/exhaustMap.d.ts.map +1 -0
- package/dist/exhaustMap.js +34 -0
- package/dist/exhaustMap.js.map +1 -0
- package/dist/exhaustMapCause.d.ts +7 -0
- package/dist/exhaustMapCause.d.ts.map +1 -0
- package/dist/exhaustMapCause.js +35 -0
- package/dist/exhaustMapCause.js.map +1 -0
- package/dist/exhaustMapLatest.d.ts +7 -0
- package/dist/exhaustMapLatest.d.ts.map +1 -0
- package/dist/exhaustMapLatest.js +61 -0
- package/dist/exhaustMapLatest.js.map +1 -0
- package/dist/exhaustMapLatestCause.d.ts +7 -0
- package/dist/exhaustMapLatestCause.d.ts.map +1 -0
- package/dist/exhaustMapLatestCause.js +62 -0
- package/dist/exhaustMapLatestCause.js.map +1 -0
- package/dist/externals.d.ts +19 -0
- package/dist/externals.d.ts.map +1 -0
- package/dist/externals.js +19 -0
- package/dist/externals.js.map +1 -0
- package/dist/failCause.d.ts +7 -0
- package/dist/failCause.d.ts.map +1 -0
- package/dist/failCause.js +12 -0
- package/dist/failCause.js.map +1 -0
- package/dist/filter.d.ts +7 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.js +10 -0
- package/dist/filter.js.map +1 -0
- package/dist/filterMap.d.ts +5 -0
- package/dist/filterMap.d.ts.map +1 -0
- package/dist/filterMap.js +9 -0
- package/dist/filterMap.js.map +1 -0
- package/dist/flatMap.d.ts +7 -0
- package/dist/flatMap.d.ts.map +1 -0
- package/dist/flatMap.js +33 -0
- package/dist/flatMap.js.map +1 -0
- package/dist/fromArray.d.ts +3 -0
- package/dist/fromArray.d.ts.map +1 -0
- package/dist/fromArray.js +15 -0
- package/dist/fromArray.js.map +1 -0
- package/dist/fromEffect.d.ts +4 -0
- package/dist/fromEffect.d.ts.map +1 -0
- package/dist/fromEffect.js +6 -0
- package/dist/fromEffect.js.map +1 -0
- package/dist/fromEmitter.d.ts +11 -0
- package/dist/fromEmitter.d.ts.map +1 -0
- package/dist/fromEmitter.js +25 -0
- package/dist/fromEmitter.js.map +1 -0
- package/dist/fromFxEffect.d.ts +4 -0
- package/dist/fromFxEffect.d.ts.map +1 -0
- package/dist/fromFxEffect.js +6 -0
- package/dist/fromFxEffect.js.map +1 -0
- package/dist/fromIterable.d.ts +3 -0
- package/dist/fromIterable.d.ts.map +1 -0
- package/dist/fromIterable.js +20 -0
- package/dist/fromIterable.js.map +1 -0
- package/dist/gen.d.ts +7 -0
- package/dist/gen.d.ts.map +1 -0
- package/dist/gen.js +6 -0
- package/dist/gen.js.map +1 -0
- package/dist/hold.d.ts +14 -0
- package/dist/hold.d.ts.map +1 -0
- package/dist/hold.js +30 -0
- package/dist/hold.js.map +1 -0
- package/dist/index.d.ts +319 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +112 -18
- package/dist/index.js.map +1 -1
- package/dist/internal/constructor/collectAll.d.ts +1 -1
- package/dist/map.d.ts +4 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/map.js +9 -0
- package/dist/map.js.map +1 -0
- package/dist/mergeAll.d.ts +4 -0
- package/dist/mergeAll.d.ts.map +1 -0
- package/dist/mergeAll.js +9 -0
- package/dist/mergeAll.js.map +1 -0
- package/dist/multicast.d.ts +29 -0
- package/dist/multicast.d.ts.map +1 -0
- package/dist/multicast.js +65 -0
- package/dist/multicast.js.map +1 -0
- package/dist/never.d.ts +3 -0
- package/dist/never.d.ts.map +1 -0
- package/dist/never.js +6 -0
- package/dist/never.js.map +1 -0
- package/dist/observe.d.ts +6 -0
- package/dist/observe.d.ts.map +1 -0
- package/dist/observe.js +17 -0
- package/dist/observe.js.map +1 -0
- package/dist/onInterrupt.d.ts +6 -0
- package/dist/onInterrupt.d.ts.map +1 -0
- package/dist/onInterrupt.js +6 -0
- package/dist/onInterrupt.js.map +1 -0
- package/dist/promise.d.ts +14 -0
- package/dist/promise.d.ts.map +1 -0
- package/dist/promise.js +40 -0
- package/dist/promise.js.map +1 -0
- package/dist/provide.d.ts +11 -0
- package/dist/provide.d.ts.map +1 -0
- package/dist/provide.js +25 -0
- package/dist/provide.js.map +1 -0
- package/dist/reduce.d.ts +3 -0
- package/dist/reduce.d.ts.map +1 -0
- package/dist/reduce.js +9 -0
- package/dist/reduce.js.map +1 -0
- package/dist/scan.d.ts +3 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +9 -0
- package/dist/scan.js.map +1 -0
- package/dist/skipRepeats.d.ts +5 -0
- package/dist/skipRepeats.d.ts.map +1 -0
- package/dist/skipRepeats.js +16 -0
- package/dist/skipRepeats.js.map +1 -0
- package/dist/skipWhile.d.ts +5 -0
- package/dist/skipWhile.d.ts.map +1 -0
- package/dist/skipWhile.js +18 -0
- package/dist/skipWhile.js.map +1 -0
- package/dist/slice.d.ts +5 -0
- package/dist/slice.d.ts.map +1 -0
- package/dist/slice.js +26 -0
- package/dist/slice.js.map +1 -0
- package/dist/succeed.d.ts +4 -0
- package/dist/succeed.d.ts.map +1 -0
- package/dist/succeed.js +6 -0
- package/dist/succeed.js.map +1 -0
- package/dist/suspend.d.ts +3 -0
- package/dist/suspend.d.ts.map +1 -0
- package/dist/suspend.js +5 -0
- package/dist/suspend.js.map +1 -0
- package/dist/switchMap.d.ts +7 -0
- package/dist/switchMap.d.ts.map +1 -0
- package/dist/switchMap.js +27 -0
- package/dist/switchMap.js.map +1 -0
- package/dist/switchMapCause.d.ts +7 -0
- package/dist/switchMapCause.d.ts.map +1 -0
- package/dist/switchMapCause.js +28 -0
- package/dist/switchMapCause.js.map +1 -0
- package/dist/switchMatch.d.ts +7 -0
- package/dist/switchMatch.d.ts.map +1 -0
- package/dist/switchMatch.js +28 -0
- package/dist/switchMatch.js.map +1 -0
- package/dist/takeWhile.d.ts +5 -0
- package/dist/takeWhile.d.ts.map +1 -0
- package/dist/takeWhile.js +18 -0
- package/dist/takeWhile.js.map +1 -0
- package/dist/tap.d.ts +5 -0
- package/dist/tap.d.ts.map +1 -0
- package/dist/tap.js +9 -0
- package/dist/tap.js.map +1 -0
- package/dist/tapCause.d.ts +7 -0
- package/dist/tapCause.d.ts.map +1 -0
- package/dist/tapCause.js +16 -0
- package/dist/tapCause.js.map +1 -0
- package/dist/test-utils.d.ts +5 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +22 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/throttle.d.ts +4 -0
- package/dist/throttle.d.ts.map +1 -0
- package/dist/throttle.js +24 -0
- package/dist/throttle.js.map +1 -0
- package/dist/toArray.d.ts +5 -0
- package/dist/toArray.d.ts.map +1 -0
- package/dist/toArray.js +10 -0
- package/dist/toArray.js.map +1 -0
- package/dist/toChunk.d.ts +5 -0
- package/dist/toChunk.d.ts.map +1 -0
- package/dist/toChunk.js +10 -0
- package/dist/toChunk.js.map +1 -0
- package/dist/toReadonlyArray.d.ts +5 -0
- package/dist/toReadonlyArray.d.ts.map +1 -0
- package/dist/toReadonlyArray.js +10 -0
- package/dist/toReadonlyArray.js.map +1 -0
- package/dist/tsconfig.cjs.build.tsbuildinfo +1 -1
- package/package.json +8 -5
- package/src/Fx.ts +109 -0
- package/src/RefSubject.test.ts +352 -0
- package/src/RefSubject.ts +599 -0
- package/src/Subject.ts +45 -0
- package/src/at.ts +7 -0
- package/src/catchAllCause.test.ts +23 -0
- package/src/catchAllCause.ts +84 -0
- package/src/combineAll.ts +63 -0
- package/src/continueWith.test.ts +17 -0
- package/src/continueWith.ts +29 -0
- package/src/data-first.ts +50 -0
- package/src/debounce.test.ts +18 -0
- package/src/debounce.ts +8 -0
- package/src/delay.test.ts +13 -0
- package/src/delay.ts +8 -0
- package/src/empty.test.ts +10 -0
- package/src/empty.ts +7 -0
- package/src/exhaustMap.test.ts +19 -0
- package/src/exhaustMap.ts +72 -0
- package/src/exhaustMapCause.test.ts +23 -0
- package/src/exhaustMapCause.ts +79 -0
- package/src/exhaustMapLatest.test.ts +19 -0
- package/src/exhaustMapLatest.ts +104 -0
- package/src/exhaustMapLatestCause.test.ts +23 -0
- package/src/exhaustMapLatestCause.ts +111 -0
- package/src/{internal/externals.ts → externals.ts} +5 -4
- package/src/failCause.test.ts +20 -0
- package/src/failCause.ts +16 -0
- package/src/filter.ts +25 -0
- package/src/filterMap.ts +10 -0
- package/src/flatMap.test.ts +19 -0
- package/src/flatMap.ts +79 -0
- package/src/fromArray.test.ts +11 -0
- package/src/fromArray.ts +20 -0
- package/src/fromEffect.test.ts +15 -0
- package/src/fromEffect.ts +7 -0
- package/src/fromEmitter.test.ts +32 -0
- package/src/fromEmitter.ts +50 -0
- package/src/fromFxEffect.ts +8 -0
- package/src/fromIterable.test.ts +11 -0
- package/src/fromIterable.ts +26 -0
- package/src/gen.ts +27 -0
- package/src/hold.test.ts +37 -0
- package/src/hold.ts +40 -0
- package/src/index.ts +1009 -18
- package/src/map.test.ts +17 -0
- package/src/map.ts +10 -0
- package/src/mergeAll.test.ts +17 -0
- package/src/mergeAll.ts +23 -0
- package/src/multicast.test.ts +62 -0
- package/src/multicast.ts +104 -0
- package/src/never.ts +6 -0
- package/src/observe.ts +33 -0
- package/src/onInterrupt.ts +16 -0
- package/src/promise.ts +70 -0
- package/src/provide.ts +72 -0
- package/src/reduce.ts +12 -0
- package/src/scan.ts +14 -0
- package/src/skipRepeats.ts +30 -0
- package/src/skipWhile.test.ts +27 -0
- package/src/skipWhile.ts +31 -0
- package/src/slice.test.ts +26 -0
- package/src/slice.ts +42 -0
- package/src/succeed.ts +7 -0
- package/src/suspend.ts +5 -0
- package/src/switchMap.test.ts +19 -0
- package/src/switchMap.ts +67 -0
- package/src/switchMapCause.test.ts +23 -0
- package/src/switchMapCause.ts +74 -0
- package/src/switchMatch.test.ts +26 -0
- package/src/switchMatch.ts +95 -0
- package/src/takeWhile.test.ts +27 -0
- package/src/takeWhile.ts +34 -0
- package/src/tap.ts +17 -0
- package/src/tapCause.ts +41 -0
- package/src/test-utils.ts +36 -0
- package/src/throttle.test.ts +18 -0
- package/src/throttle.ts +40 -0
- package/src/toArray.ts +15 -0
- package/src/toChunk.ts +15 -0
- package/src/toReadonlyArray.ts +17 -0
- package/tsconfig.build.json +5 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.cjs.build.json +3 -2
- package/src/internal/BaseFx.ts +0 -90
- package/src/internal/Fx.ts +0 -163
- package/src/internal/Mutable.ts +0 -11
- package/src/internal/RefCounter.ts +0 -95
- package/src/internal/concurrency/index.ts +0 -2
- package/src/internal/concurrency/withParallelism.ts +0 -14
- package/src/internal/concurrency/withParallelismUnbounded.ts +0 -6
- package/src/internal/config/config.ts +0 -13
- package/src/internal/config/configProviderWith.ts +0 -25
- package/src/internal/config/index.ts +0 -3
- package/src/internal/config/withConfigProvider.ts +0 -15
- package/src/internal/constructor/acquireUseRelease.ts +0 -48
- package/src/internal/constructor/async.ts +0 -13
- package/src/internal/constructor/asyncEffect.ts +0 -11
- package/src/internal/constructor/asyncInterrupt.ts +0 -18
- package/src/internal/constructor/asyncInterruptEither.ts +0 -23
- package/src/internal/constructor/asyncOption.ts +0 -23
- package/src/internal/constructor/at.ts +0 -13
- package/src/internal/constructor/collect.ts +0 -26
- package/src/internal/constructor/collectAll.ts +0 -66
- package/src/internal/constructor/collectAllDiscard.ts +0 -65
- package/src/internal/constructor/combineAll.ts +0 -95
- package/src/internal/constructor/die.ts +0 -9
- package/src/internal/constructor/dieMessage.ts +0 -9
- package/src/internal/constructor/dieSync.ts +0 -10
- package/src/internal/constructor/done.ts +0 -10
- package/src/internal/constructor/empty.ts +0 -20
- package/src/internal/constructor/fail.ts +0 -9
- package/src/internal/constructor/failCause.ts +0 -10
- package/src/internal/constructor/failCauseSync.ts +0 -11
- package/src/internal/constructor/failSync.ts +0 -10
- package/src/internal/constructor/gen.ts +0 -51
- package/src/internal/constructor/ifFx.ts +0 -14
- package/src/internal/constructor/index.ts +0 -49
- package/src/internal/constructor/interrupt.ts +0 -9
- package/src/internal/constructor/interruptWith.ts +0 -10
- package/src/internal/constructor/interruptible.ts +0 -10
- package/src/internal/constructor/never.ts +0 -16
- package/src/internal/constructor/none.ts +0 -17
- package/src/internal/constructor/noneOrFail.ts +0 -7
- package/src/internal/constructor/noneOrFailWith.ts +0 -21
- package/src/internal/constructor/periodic.ts +0 -11
- package/src/internal/constructor/promise.ts +0 -9
- package/src/internal/constructor/promiseFx.ts +0 -9
- package/src/internal/constructor/promiseInterrupt.ts +0 -11
- package/src/internal/constructor/schedule.ts +0 -61
- package/src/internal/constructor/succeed.ts +0 -9
- package/src/internal/constructor/succeedLeft.ts +0 -12
- package/src/internal/constructor/succeedNone.ts +0 -10
- package/src/internal/constructor/succeedRight.ts +0 -12
- package/src/internal/constructor/succeedSome.ts +0 -12
- package/src/internal/constructor/suspend.ts +0 -26
- package/src/internal/constructor/sync.ts +0 -11
- package/src/internal/constructor/try.ts +0 -14
- package/src/internal/constructor/tryCatch.ts +0 -12
- package/src/internal/constructor/tryCatchPromise.ts +0 -14
- package/src/internal/constructor/tryCatchPromiseInterrupt.ts +0 -14
- package/src/internal/constructor/tryPromise.ts +0 -11
- package/src/internal/constructor/tryPromiseInterrupt.ts +0 -13
- package/src/internal/constructor/trySucceed.ts +0 -29
- package/src/internal/constructor/uninterruptible.ts +0 -10
- package/src/internal/context/clock.ts +0 -10
- package/src/internal/context/clockWith.ts +0 -15
- package/src/internal/context/context.ts +0 -12
- package/src/internal/context/contextWith.ts +0 -13
- package/src/internal/context/contextWithEffect.ts +0 -12
- package/src/internal/context/contextWithFx.ts +0 -22
- package/src/internal/context/contramapContext.ts +0 -48
- package/src/internal/context/index.ts +0 -19
- package/src/internal/context/provideContext.ts +0 -14
- package/src/internal/context/provideLayer.ts +0 -15
- package/src/internal/context/provideService.ts +0 -25
- package/src/internal/context/provideServiceEffect.ts +0 -25
- package/src/internal/context/provideServiceFx.ts +0 -29
- package/src/internal/context/provideSomeLayer.ts +0 -24
- package/src/internal/context/random.ts +0 -10
- package/src/internal/context/randomWith.ts +0 -13
- package/src/internal/context/serviceWith.ts +0 -17
- package/src/internal/context/serviceWithEffect.ts +0 -22
- package/src/internal/context/serviceWithFx.ts +0 -26
- package/src/internal/context/updateService.ts +0 -21
- package/src/internal/conversion/either.ts +0 -34
- package/src/internal/conversion/fromArray.ts +0 -31
- package/src/internal/conversion/fromEffect.ts +0 -51
- package/src/internal/conversion/fromEither.ts +0 -10
- package/src/internal/conversion/fromEitherCause.ts +0 -10
- package/src/internal/conversion/fromEmitter.ts +0 -49
- package/src/internal/conversion/fromFiber.ts +0 -12
- package/src/internal/conversion/fromFiberEffect.ts +0 -12
- package/src/internal/conversion/fromFxEffect.ts +0 -30
- package/src/internal/conversion/fromOption.ts +0 -10
- package/src/internal/conversion/getOrFail.ts +0 -14
- package/src/internal/conversion/getOrFailDiscard.ts +0 -13
- package/src/internal/conversion/getOrFailWith.ts +0 -16
- package/src/internal/conversion/index.ts +0 -13
- package/src/internal/do/Do.ts +0 -4
- package/src/internal/do/bind.ts +0 -57
- package/src/internal/do/bindValue.ts +0 -50
- package/src/internal/do/index.ts +0 -3
- package/src/internal/error/absolve.ts +0 -33
- package/src/internal/error/absolveWith.ts +0 -34
- package/src/internal/error/absorb.ts +0 -6
- package/src/internal/error/absorbWith.ts +0 -36
- package/src/internal/error/catch.ts +0 -74
- package/src/internal/error/catchAll.ts +0 -40
- package/src/internal/error/catchAllCause.ts +0 -77
- package/src/internal/error/catchAllDefect.ts +0 -33
- package/src/internal/error/catchSome.ts +0 -25
- package/src/internal/error/catchSomeCause.ts +0 -31
- package/src/internal/error/catchTag.ts +0 -17
- package/src/internal/error/catchTags.ts +0 -60
- package/src/internal/error/cause.ts +0 -30
- package/src/internal/error/exit.ts +0 -31
- package/src/internal/error/index.ts +0 -22
- package/src/internal/error/orDie.ts +0 -7
- package/src/internal/error/orDieWith.ts +0 -34
- package/src/internal/error/orElse.ts +0 -35
- package/src/internal/error/orElseEither.ts +0 -45
- package/src/internal/error/orElseFail.ts +0 -28
- package/src/internal/error/orElseOptional.ts +0 -46
- package/src/internal/error/orElseSucceed.ts +0 -29
- package/src/internal/error/tryOrElse.ts +0 -59
- package/src/internal/getters/index.ts +0 -6
- package/src/internal/getters/left.ts +0 -35
- package/src/internal/getters/right.ts +0 -35
- package/src/internal/getters/some.ts +0 -33
- package/src/internal/getters/unleft.ts +0 -38
- package/src/internal/getters/unright.ts +0 -38
- package/src/internal/getters/unsome.ts +0 -37
- package/src/internal/locking/index.ts +0 -2
- package/src/internal/locking/withPermit.ts +0 -15
- package/src/internal/locking/withPermits.ts +0 -43
- package/src/internal/logging/index.ts +0 -22
- package/src/internal/logging/log.ts +0 -9
- package/src/internal/logging/logAnnotate.ts +0 -14
- package/src/internal/logging/logAnnotations.ts +0 -9
- package/src/internal/logging/logDebug.ts +0 -9
- package/src/internal/logging/logDebugCause.ts +0 -12
- package/src/internal/logging/logDebugCauseMessage.ts +0 -16
- package/src/internal/logging/logError.ts +0 -9
- package/src/internal/logging/logErrorCause.ts +0 -12
- package/src/internal/logging/logErrorCauseMessage.ts +0 -16
- package/src/internal/logging/logFatal.ts +0 -9
- package/src/internal/logging/logFatalCause.ts +0 -12
- package/src/internal/logging/logFatalCauseMessage.ts +0 -16
- package/src/internal/logging/logInfo.ts +0 -9
- package/src/internal/logging/logInfoCause.ts +0 -12
- package/src/internal/logging/logInfoCauseMessage.ts +0 -16
- package/src/internal/logging/logSpan.ts +0 -14
- package/src/internal/logging/logTrace.ts +0 -9
- package/src/internal/logging/logTraceCause.ts +0 -12
- package/src/internal/logging/logTraceCauseMessage.ts +0 -16
- package/src/internal/logging/logWarning.ts +0 -9
- package/src/internal/logging/logWarningCause.ts +0 -13
- package/src/internal/logging/logWarningCauseMessage.ts +0 -16
- package/src/internal/metric/index.ts +0 -4
- package/src/internal/metric/tagged.ts +0 -14
- package/src/internal/metric/taggedWithLabelSet.ts +0 -16
- package/src/internal/metric/taggedWithLabels.ts +0 -15
- package/src/internal/metric/withMetric.ts +0 -37
- package/src/internal/operator/continueWith.ts +0 -36
- package/src/internal/operator/debounce.ts +0 -69
- package/src/internal/operator/delay.ts +0 -33
- package/src/internal/operator/ensuring.ts +0 -36
- package/src/internal/operator/exhaustMap.ts +0 -94
- package/src/internal/operator/exhaustMapLatest.ts +0 -117
- package/src/internal/operator/filterMap.ts +0 -66
- package/src/internal/operator/filterMapEffect.ts +0 -106
- package/src/internal/operator/flatMap.ts +0 -71
- package/src/internal/operator/flatMapCause.ts +0 -56
- package/src/internal/operator/flatMapConcurrently.ts +0 -44
- package/src/internal/operator/flip.ts +0 -38
- package/src/internal/operator/hold.ts +0 -158
- package/src/internal/operator/index.ts +0 -53
- package/src/internal/operator/map.ts +0 -42
- package/src/internal/operator/mapAccum.ts +0 -54
- package/src/internal/operator/mapBoth.ts +0 -57
- package/src/internal/operator/mapCause.ts +0 -32
- package/src/internal/operator/mapEither.ts +0 -21
- package/src/internal/operator/mapError.ts +0 -15
- package/src/internal/operator/mapSome.ts +0 -15
- package/src/internal/operator/merge.ts +0 -68
- package/src/internal/operator/mergeRace.ts +0 -52
- package/src/internal/operator/multicast.ts +0 -133
- package/src/internal/operator/onDone.ts +0 -32
- package/src/internal/operator/onDoneCause.ts +0 -53
- package/src/internal/operator/onError.ts +0 -25
- package/src/internal/operator/onErrorCause.ts +0 -25
- package/src/internal/operator/onExit.ts +0 -56
- package/src/internal/operator/onInterrupt.ts +0 -63
- package/src/internal/operator/onNonInterruptCause.ts +0 -53
- package/src/internal/operator/option.ts +0 -11
- package/src/internal/operator/race.ts +0 -115
- package/src/internal/operator/sandbox.ts +0 -26
- package/src/internal/operator/scan.ts +0 -41
- package/src/internal/operator/scanEffect.ts +0 -73
- package/src/internal/operator/separate.ts +0 -42
- package/src/internal/operator/skipRepeats.ts +0 -49
- package/src/internal/operator/snapshot.ts +0 -80
- package/src/internal/operator/startWith.ts +0 -15
- package/src/internal/operator/summarized.ts +0 -66
- package/src/internal/operator/supervised.ts +0 -15
- package/src/internal/operator/switchMap.ts +0 -85
- package/src/internal/operator/tap.ts +0 -63
- package/src/internal/operator/tapCause.ts +0 -50
- package/src/internal/operator/tapDefect.ts +0 -19
- package/src/internal/operator/tapEither.ts +0 -74
- package/src/internal/operator/tapError.ts +0 -31
- package/src/internal/operator/tapSome.ts +0 -76
- package/src/internal/operator/throttle.ts +0 -37
- package/src/internal/operator/traced.ts +0 -9
- package/src/internal/operator/unrefineWith.ts +0 -66
- package/src/internal/operator/unsandbox.ts +0 -30
- package/src/internal/operator/zipItems.ts +0 -70
- package/src/internal/run/drain.ts +0 -8
- package/src/internal/run/effect.ts +0 -27
- package/src/internal/run/index.ts +0 -7
- package/src/internal/run/observe.ts +0 -55
- package/src/internal/run/reduce.ts +0 -20
- package/src/internal/run/reduceEffect.ts +0 -29
- package/src/internal/run/toChunk.ts +0 -13
- package/src/internal/run/toReadonlyArray.ts +0 -19
- package/src/internal/slicing/index.ts +0 -10
- package/src/internal/slicing/since.ts +0 -47
- package/src/internal/slicing/skip.ts +0 -14
- package/src/internal/slicing/skipAfter.ts +0 -51
- package/src/internal/slicing/skipUntil.ts +0 -15
- package/src/internal/slicing/skipWhile.ts +0 -44
- package/src/internal/slicing/slice.ts +0 -66
- package/src/internal/slicing/take.ts +0 -14
- package/src/internal/slicing/takeUntil.ts +0 -15
- package/src/internal/slicing/takeWhile.ts +0 -42
- package/src/internal/slicing/until.ts +0 -40
- package/src/internal/subject/HoldSubject.ts +0 -45
- package/src/internal/subject/RefSubject.ts +0 -448
- package/src/internal/subject/Subject.ts +0 -31
- package/src/internal/subject/index.ts +0 -3
- package/src/internal/typeclass/Alternative.ts +0 -0
- package/src/internal/typeclass/Applicative.ts +0 -13
- package/src/internal/typeclass/Bicovariant.ts +0 -8
- package/src/internal/typeclass/Chainable.ts +0 -16
- package/src/internal/typeclass/Coproduct.ts +0 -0
- package/src/internal/typeclass/Covariant.ts +0 -28
- package/src/internal/typeclass/Filterable.ts +0 -0
- package/src/internal/typeclass/FlatMap.ts +0 -23
- package/src/internal/typeclass/Monad.ts +0 -10
- package/src/internal/typeclass/Of.ts +0 -10
- package/src/internal/typeclass/Pointed.ts +0 -10
- package/src/internal/typeclass/Product.ts +0 -45
- package/src/internal/typeclass/SemiAlternative.ts +0 -0
- package/src/internal/typeclass/SemiApplicative.ts +0 -43
- package/src/internal/typeclass/SemiCoproduct.ts +0 -0
- package/src/internal/typeclass/SemiProduct.ts +0 -51
- package/src/internal/typeclass/index.ts +0 -16
- package/src/internal/withEarlyExit.ts +0 -17
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import type { Scope } from '@effect/io/Scope'
|
|
3
|
-
|
|
4
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
7
|
-
import type { Context } from '@typed/fx/internal/externals'
|
|
8
|
-
import { Cause, Effect, pipe } from '@typed/fx/internal/externals'
|
|
9
|
-
|
|
10
|
-
export const tapCause: {
|
|
11
|
-
<R, E, A, R2, E2, B>(
|
|
12
|
-
self: Fx<R, E, A>,
|
|
13
|
-
f: (cause: Cause.Cause<E>) => Effect.Effect<R2, E2, B>,
|
|
14
|
-
): Fx<R | R2, E | E2, A>
|
|
15
|
-
|
|
16
|
-
<E, R2, E2, B>(f: (cause: Cause.Cause<E>) => Effect.Effect<R2, E2, B>): <R, A>(
|
|
17
|
-
self: Fx<R, E, A>,
|
|
18
|
-
) => Fx<R | R2, E | E2, A>
|
|
19
|
-
} = dualWithTrace(2, (trace) => (self, f) => new TapCauseFx(self, f).traced(trace))
|
|
20
|
-
|
|
21
|
-
export class TapCauseFx<R, E, A, R2, E2, B> extends BaseFx<R | R2, E | E2, A> {
|
|
22
|
-
readonly name = 'TapCause' as const
|
|
23
|
-
|
|
24
|
-
constructor(
|
|
25
|
-
readonly self: Fx<R, E, A>,
|
|
26
|
-
readonly f: (cause: Cause.Cause<E>) => Effect.Effect<R2, E2, B>,
|
|
27
|
-
) {
|
|
28
|
-
super()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
run(sink: Sink<E | E2, A>): Effect.Effect<R | R2 | Scope, never, unknown> {
|
|
32
|
-
return Effect.contextWithEffect((ctx: Context.Context<R | R2 | Scope>) =>
|
|
33
|
-
this.self.run(
|
|
34
|
-
Sink(
|
|
35
|
-
sink.event,
|
|
36
|
-
(cause) =>
|
|
37
|
-
pipe(
|
|
38
|
-
this.f(cause),
|
|
39
|
-
Effect.matchCauseEffect(
|
|
40
|
-
(cause2) => sink.error(Cause.sequential(cause, cause2)),
|
|
41
|
-
() => sink.error(cause),
|
|
42
|
-
),
|
|
43
|
-
Effect.provideContext(ctx),
|
|
44
|
-
),
|
|
45
|
-
sink.end,
|
|
46
|
-
),
|
|
47
|
-
),
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { pipe } from '@effect/data/Function'
|
|
2
|
-
|
|
3
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
4
|
-
import { Cause, Chunk, Effect, Option } from '@typed/fx/internal/externals'
|
|
5
|
-
import { tapCause } from '@typed/fx/internal/operator/tapCause'
|
|
6
|
-
|
|
7
|
-
export function tapDefect<R2, E2, B>(f: (defect: unknown) => Effect.Effect<R2, E2, B>) {
|
|
8
|
-
return <R, E, A>(fx: Fx<R, E, A>): Fx<R | R2, E | E2, A | B> =>
|
|
9
|
-
pipe(
|
|
10
|
-
fx,
|
|
11
|
-
tapCause(
|
|
12
|
-
(cause): Effect.Effect<R2, E | E2, B> =>
|
|
13
|
-
pipe(
|
|
14
|
-
Chunk.get(Cause.defects(cause), 0),
|
|
15
|
-
Option.match(() => Effect.failCause(cause), f),
|
|
16
|
-
),
|
|
17
|
-
),
|
|
18
|
-
)
|
|
19
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
4
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import type { Context } from '@typed/fx/internal/externals'
|
|
7
|
-
import { Effect, Either } from '@typed/fx/internal/externals'
|
|
8
|
-
|
|
9
|
-
export const tapEither: {
|
|
10
|
-
<A, R2, E2, B>(f: (a: A) => Effect.Effect<R2, E2, B>): <R, E, E3>(
|
|
11
|
-
self: Fx<R, E, Either.Either<E3, A>>,
|
|
12
|
-
) => Fx<R | R2, E | E3, Either.Either<E3, A>>
|
|
13
|
-
|
|
14
|
-
<R, E, E2, A, R2, E3, B>(
|
|
15
|
-
self: Fx<R, E, Either.Either<E2, A>>,
|
|
16
|
-
f: (a: A) => Effect.Effect<R2, E3, B>,
|
|
17
|
-
): Fx<R | R2, E | E3, Either.Either<E2, A>>
|
|
18
|
-
} = dualWithTrace(
|
|
19
|
-
2,
|
|
20
|
-
(trace) =>
|
|
21
|
-
<R, E, E2, A, R2, E3, B>(
|
|
22
|
-
self: Fx<R, E, Either.Either<E2, A>>,
|
|
23
|
-
f: (a: A) => Effect.Effect<R2, E3, B>,
|
|
24
|
-
) =>
|
|
25
|
-
new TapEitherFx(self, f).traced(trace),
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export const tapEitherSync: {
|
|
29
|
-
<A, B>(f: (a: A) => B): <R, E, E2>(
|
|
30
|
-
self: Fx<R, E, Either.Either<E2, A>>,
|
|
31
|
-
) => Fx<R, E, Either.Either<E2, A>>
|
|
32
|
-
<R, E, E2, A, B>(self: Fx<R, E, Either.Either<E2, A>>, f: (a: A) => B): Fx<
|
|
33
|
-
R,
|
|
34
|
-
E,
|
|
35
|
-
Either.Either<E2, A>
|
|
36
|
-
>
|
|
37
|
-
} = dualWithTrace(
|
|
38
|
-
2,
|
|
39
|
-
(trace) =>
|
|
40
|
-
<R, E, E2, A, B>(self: Fx<R, E, Either.Either<E2, A>>, f: (a: A) => B) =>
|
|
41
|
-
new TapEitherFx(self, (a) => Effect.sync(() => f(a))).traced(trace),
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
class TapEitherFx<R, E, E2, A, R2, E3, B> extends BaseFx<R | R2, E | E3, Either.Either<E2, A>> {
|
|
45
|
-
readonly name = 'TapEither' as const
|
|
46
|
-
|
|
47
|
-
constructor(
|
|
48
|
-
readonly self: Fx<R, E, Either.Either<E2, A>>,
|
|
49
|
-
readonly f: (a: A) => Effect.Effect<R2, E3, B>,
|
|
50
|
-
) {
|
|
51
|
-
super()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
run(sink: Sink<E | E3, Either.Either<E2, A>>) {
|
|
55
|
-
return Effect.contextWithEffect((ctx: Context.Context<R | R2>) =>
|
|
56
|
-
this.self.run(
|
|
57
|
-
Sink(
|
|
58
|
-
(either) => {
|
|
59
|
-
if (Either.isRight(either)) {
|
|
60
|
-
return Effect.provideContext(
|
|
61
|
-
Effect.matchCauseEffect(this.f(either.right), sink.error, () => sink.event(either)),
|
|
62
|
-
ctx,
|
|
63
|
-
)
|
|
64
|
-
} else {
|
|
65
|
-
return sink.event(either)
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
sink.error,
|
|
69
|
-
sink.end,
|
|
70
|
-
),
|
|
71
|
-
),
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import { pipe } from '@effect/data/Function'
|
|
3
|
-
|
|
4
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
5
|
-
import { Cause, Effect, Either } from '@typed/fx/internal/externals'
|
|
6
|
-
import { tapCause } from '@typed/fx/internal/operator/tapCause'
|
|
7
|
-
|
|
8
|
-
export const tapError: {
|
|
9
|
-
<E, R2, E2, B>(f: (error: E) => Effect.Effect<R2, E2, B>): <R, A>(
|
|
10
|
-
self: Fx<R, E, A>,
|
|
11
|
-
) => Fx<R | R2, E | E2, A>
|
|
12
|
-
|
|
13
|
-
<R, E, A, R2, E2, B>(self: Fx<R, E, A>, f: (error: E) => Effect.Effect<R2, E2, B>): Fx<
|
|
14
|
-
R | R2,
|
|
15
|
-
E | E2,
|
|
16
|
-
A
|
|
17
|
-
>
|
|
18
|
-
} = dualWithTrace(
|
|
19
|
-
2,
|
|
20
|
-
(trace) =>
|
|
21
|
-
<R, E, A, R2, E2, B>(self: Fx<R, E, A>, f: (error: E) => Effect.Effect<R2, E2, B>) =>
|
|
22
|
-
tapCause(
|
|
23
|
-
self,
|
|
24
|
-
(cause): Effect.Effect<R2, E | E2, B> =>
|
|
25
|
-
pipe(
|
|
26
|
-
cause,
|
|
27
|
-
Cause.failureOrCause,
|
|
28
|
-
Either.match(f, () => Effect.failCause(cause)),
|
|
29
|
-
),
|
|
30
|
-
).traced(trace),
|
|
31
|
-
)
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@effect/data/Context'
|
|
2
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
3
|
-
import { pipe } from '@effect/data/Function'
|
|
4
|
-
import * as Effect from '@effect/io/Effect'
|
|
5
|
-
import type { Scope } from '@effect/io/Scope'
|
|
6
|
-
|
|
7
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
8
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
9
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
10
|
-
import { Option } from '@typed/fx/internal/externals'
|
|
11
|
-
|
|
12
|
-
export const tapSome: {
|
|
13
|
-
<A, R2, E2, B>(f: (a: A) => Effect.Effect<R2, E2, B>): <R, E>(
|
|
14
|
-
fx: Fx<R, E, Option.Option<A>>,
|
|
15
|
-
) => Fx<R | R2, E | E2, A>
|
|
16
|
-
<R, E, A, R2, E2, B>(fx: Fx<R, E, Option.Option<A>>, f: (a: A) => Effect.Effect<R2, E2, B>): Fx<
|
|
17
|
-
R | R2,
|
|
18
|
-
E | E2,
|
|
19
|
-
A
|
|
20
|
-
>
|
|
21
|
-
} = dualWithTrace(
|
|
22
|
-
2,
|
|
23
|
-
(trace) =>
|
|
24
|
-
<R, E, A, R2, E2, B>(fx: Fx<R, E, Option.Option<A>>, f: (a: A) => Effect.Effect<R2, E2, B>) =>
|
|
25
|
-
TapSomeFx.make(fx, f).traced(trace),
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export const tapSomeSync: {
|
|
29
|
-
<R, E, A, B>(fx: Fx<R, E, Option.Option<A>>, f: (a: A) => B): Fx<R, E, Option.Option<A>>
|
|
30
|
-
<A, B>(f: (a: A) => B): <R, E>(fx: Fx<R, E, Option.Option<A>>) => Fx<R, E, Option.Option<A>>
|
|
31
|
-
} = dualWithTrace(
|
|
32
|
-
2,
|
|
33
|
-
(trace) =>
|
|
34
|
-
<R, E, A, B>(fx: Fx<R, E, Option.Option<A>>, f: (a: A) => B) =>
|
|
35
|
-
TapSomeFx.make(fx, (a) => Effect.sync(() => f(a))).traced(trace),
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
class TapSomeFx<R, E, A, R2, E2, B> extends BaseFx<R | R2, E | E2, Option.Option<A>> {
|
|
39
|
-
readonly name = 'TapSome' as const
|
|
40
|
-
|
|
41
|
-
constructor(
|
|
42
|
-
readonly fx: Fx<R, E, Option.Option<A>>,
|
|
43
|
-
readonly f: (a: A) => Effect.Effect<R2, E2, B>,
|
|
44
|
-
) {
|
|
45
|
-
super()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
run(sink: Sink<E | E2, Option.Option<A>>): Effect.Effect<R | R2 | Scope, never, unknown> {
|
|
49
|
-
return Effect.contextWithEffect((context: Context<R | R2 | Scope>) =>
|
|
50
|
-
this.fx.run(
|
|
51
|
-
Sink(
|
|
52
|
-
(a) =>
|
|
53
|
-
pipe(
|
|
54
|
-
a,
|
|
55
|
-
Option.match(
|
|
56
|
-
() => sink.event(a),
|
|
57
|
-
(a) =>
|
|
58
|
-
pipe(
|
|
59
|
-
Effect.as(this.f(a), Option.some(a)),
|
|
60
|
-
Effect.matchCauseEffect(sink.error, sink.event),
|
|
61
|
-
Effect.provideContext(context),
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
),
|
|
65
|
-
sink.error,
|
|
66
|
-
sink.end,
|
|
67
|
-
),
|
|
68
|
-
),
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
static make = <R, E, A, R2, E2, B>(
|
|
73
|
-
fx: Fx<R, E, Option.Option<A>>,
|
|
74
|
-
f: (a: A) => Effect.Effect<R2, E2, B>,
|
|
75
|
-
) => new TapSomeFx(fx, f)
|
|
76
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
2
|
-
import { suspend } from '@typed/fx/internal/constructor/suspend'
|
|
3
|
-
import { Effect, pipe } from '@typed/fx/internal/externals'
|
|
4
|
-
import type { Duration, Fiber } from '@typed/fx/internal/externals'
|
|
5
|
-
import { filterEffect } from '@typed/fx/internal/operator/filterMapEffect'
|
|
6
|
-
|
|
7
|
-
export function throttle<R, E, A>(self: Fx<R, E, A>, duration: Duration.Duration): Fx<R, E, A> {
|
|
8
|
-
return suspend(() => {
|
|
9
|
-
let scheduledFiber: Fiber.RuntimeFiber<never, unknown> | undefined
|
|
10
|
-
|
|
11
|
-
const shouldThrottle = Effect.gen(function* ($) {
|
|
12
|
-
if (scheduledFiber) {
|
|
13
|
-
return false
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
scheduledFiber = yield* $(
|
|
17
|
-
pipe(
|
|
18
|
-
Effect.unit(),
|
|
19
|
-
Effect.delay(duration),
|
|
20
|
-
Effect.tap(() =>
|
|
21
|
-
Effect.sync(() => {
|
|
22
|
-
scheduledFiber = undefined
|
|
23
|
-
}),
|
|
24
|
-
),
|
|
25
|
-
Effect.forkScoped,
|
|
26
|
-
),
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
return true
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
return pipe(
|
|
33
|
-
self,
|
|
34
|
-
filterEffect(() => shouldThrottle),
|
|
35
|
-
)
|
|
36
|
-
})
|
|
37
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Trace } from '@effect/data/Debug'
|
|
2
|
-
import { dual } from '@effect/data/Function'
|
|
3
|
-
|
|
4
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
5
|
-
|
|
6
|
-
export const traced: {
|
|
7
|
-
<R, E, A>(fx: Fx<R, E, A>, trace: Trace): Fx<R, E, A>
|
|
8
|
-
(trace: Trace): <R, E, A>(fx: Fx<R, E, A>) => Fx<R, E, A>
|
|
9
|
-
} = dual(2, <R, E, A>(fx: Fx<R, E, A>, trace: Trace): Fx<R, E, A> => fx.traced(trace))
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
4
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import type { Option, Scope } from '@typed/fx/internal/externals'
|
|
7
|
-
import { Effect, identity, pipe } from '@typed/fx/internal/externals'
|
|
8
|
-
|
|
9
|
-
export const unrefineWith: {
|
|
10
|
-
<E2, E, E3>(f: (defect: unknown) => Option.Option<E2>, g: (e: E) => E3): <R, A>(
|
|
11
|
-
self: Fx<R, E, A>,
|
|
12
|
-
) => Fx<R, E2 | E3, A>
|
|
13
|
-
<R, E, A, E2, E3>(
|
|
14
|
-
self: Fx<R, E, A>,
|
|
15
|
-
f: (defect: unknown) => Option.Option<E2>,
|
|
16
|
-
g: (e: E) => E3,
|
|
17
|
-
): Fx<R, E2 | E3, A>
|
|
18
|
-
} = dualWithTrace(
|
|
19
|
-
3,
|
|
20
|
-
(trace) =>
|
|
21
|
-
function unrefineWith<R, E, A, E2, E3>(
|
|
22
|
-
self: Fx<R, E, A>,
|
|
23
|
-
f: (defect: unknown) => Option.Option<E2>,
|
|
24
|
-
g: (e: E) => E3,
|
|
25
|
-
): Fx<R, E2 | E3, A> {
|
|
26
|
-
return new UnrefineWithFx(self, f, g).traced(trace)
|
|
27
|
-
},
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
export const unrefine: {
|
|
31
|
-
<E2, E>(f: (defect: unknown) => Option.Option<E2>): <R, A>(self: Fx<R, E, A>) => Fx<R, E | E2, A>
|
|
32
|
-
|
|
33
|
-
<R, E, A, E2>(self: Fx<R, E, A>, f: (defect: unknown) => Option.Option<E2>): Fx<R, E | E2, A>
|
|
34
|
-
} = dualWithTrace(
|
|
35
|
-
2,
|
|
36
|
-
(trace) =>
|
|
37
|
-
<R, E, A, E2>(self: Fx<R, E, A>, f: (defect: unknown) => Option.Option<E2>) =>
|
|
38
|
-
unrefineWith(self, f, identity).traced(trace),
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
class UnrefineWithFx<R, E, A, E2, E3> extends BaseFx<R, E2 | E3, A> {
|
|
42
|
-
readonly name = 'UnrefineWith'
|
|
43
|
-
|
|
44
|
-
constructor(
|
|
45
|
-
readonly self: Fx<R, E, A>,
|
|
46
|
-
readonly f: (defect: unknown) => Option.Option<E2>,
|
|
47
|
-
readonly g: (e: E) => E3,
|
|
48
|
-
) {
|
|
49
|
-
super()
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
run(sink: Sink<E2 | E3, A>): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
53
|
-
return this.self.run(
|
|
54
|
-
Sink(
|
|
55
|
-
sink.event,
|
|
56
|
-
(cause) =>
|
|
57
|
-
pipe(
|
|
58
|
-
Effect.failCause(cause),
|
|
59
|
-
Effect.unrefineWith(this.f, this.g),
|
|
60
|
-
Effect.catchAllCause(sink.error),
|
|
61
|
-
),
|
|
62
|
-
sink.end,
|
|
63
|
-
),
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
4
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
5
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
6
|
-
import { Cause, Effect, Either, pipe, Scope } from '@typed/fx/internal/externals'
|
|
7
|
-
|
|
8
|
-
export const unsandbox: <R, E, A>(fx: Fx<R, Cause.Cause<E>, A>) => Fx<R, E, A> = methodWithTrace(
|
|
9
|
-
(trace) =>
|
|
10
|
-
<R, E, A>(fx: Fx<R, Cause.Cause<E>, A>) =>
|
|
11
|
-
new UnsandboxFx(fx).traced(trace),
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
export class UnsandboxFx<R, E, A> extends BaseFx<R, E, A> {
|
|
15
|
-
readonly name = 'Unsandbox'
|
|
16
|
-
|
|
17
|
-
constructor(readonly fx: Fx<R, Cause.Cause<E>, A>) {
|
|
18
|
-
super()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
run(sink: Sink<E, A>): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
22
|
-
return this.fx.run(
|
|
23
|
-
Sink(
|
|
24
|
-
sink.event,
|
|
25
|
-
(cause) => pipe(cause, Cause.failureOrCause, Either.match(sink.error, sink.error)),
|
|
26
|
-
sink.end,
|
|
27
|
-
),
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
4
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import { Effect, Scope } from '@typed/fx/internal/externals'
|
|
7
|
-
|
|
8
|
-
export const zipItemsWith: {
|
|
9
|
-
<R, E, A, B, C>(self: Fx<R, E, A>, items: Iterable<B>, f: (a: A, b: B) => C): Fx<R, E, C>
|
|
10
|
-
<A, B, C>(items: Iterable<B>, f: (a: A, b: B) => C): <R, E>(self: Fx<R, E, A>) => Fx<R, E, C>
|
|
11
|
-
} = dualWithTrace(
|
|
12
|
-
3,
|
|
13
|
-
(trace) =>
|
|
14
|
-
<R, E, A, B, C>(self: Fx<R, E, A>, items: Iterable<B>, f: (a: A, b: B) => C) =>
|
|
15
|
-
new ZipItemsWithFx(self, items, f).traced(trace),
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
export const zipItems: {
|
|
19
|
-
<R, E, A, B>(self: Fx<R, E, A>, items: Iterable<B>): Fx<R, E, readonly [A, B]>
|
|
20
|
-
<B>(items: Iterable<B>): <R, E, A>(self: Fx<R, E, A>) => Fx<R, E, readonly [A, B]>
|
|
21
|
-
} = dualWithTrace(
|
|
22
|
-
2,
|
|
23
|
-
(trace) =>
|
|
24
|
-
<R, E, A, B>(self: Fx<R, E, A>, items: Iterable<B>) =>
|
|
25
|
-
zipItemsWith(self, items, (a, b) => [a, b] as const).traced(trace),
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export const withItems: {
|
|
29
|
-
<R, E, A, B>(self: Fx<R, E, A>, items: Iterable<B>): Fx<R, E, B>
|
|
30
|
-
<B>(items: Iterable<B>): <R, E, A>(self: Fx<R, E, A>) => Fx<R, E, B>
|
|
31
|
-
} = dualWithTrace(
|
|
32
|
-
2,
|
|
33
|
-
(trace) =>
|
|
34
|
-
<R, E, A, B>(self: Fx<R, E, A>, items: Iterable<B>) =>
|
|
35
|
-
zipItemsWith(self, items, (_, b) => b).traced(trace),
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
export class ZipItemsWithFx<R, E, A, B, C> extends BaseFx<R, E, C> {
|
|
39
|
-
readonly name = 'ZipItemsWith' as const
|
|
40
|
-
|
|
41
|
-
constructor(
|
|
42
|
-
readonly self: Fx<R, E, A>,
|
|
43
|
-
readonly items: Iterable<B>,
|
|
44
|
-
readonly f: (a: A, b: B) => C,
|
|
45
|
-
) {
|
|
46
|
-
super()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
run(sink: Sink<E, C>): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
50
|
-
return Effect.suspend(() => {
|
|
51
|
-
const iterator = this.items[Symbol.iterator]()
|
|
52
|
-
|
|
53
|
-
return this.self.run(
|
|
54
|
-
Sink(
|
|
55
|
-
(a) => {
|
|
56
|
-
const next = iterator.next()
|
|
57
|
-
|
|
58
|
-
if (next.done) {
|
|
59
|
-
return sink.end()
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return sink.event(this.f(a, next.value))
|
|
63
|
-
},
|
|
64
|
-
sink.error,
|
|
65
|
-
sink.end,
|
|
66
|
-
),
|
|
67
|
-
)
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as Effect from '@effect/io/Effect'
|
|
2
|
-
|
|
3
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
4
|
-
import { observe } from '@typed/fx/internal/run/observe'
|
|
5
|
-
|
|
6
|
-
export const drain: <R, E, A>(fx: Fx<R, E, A>) => Effect.Effect<R, E, void> = observe(
|
|
7
|
-
Effect.unit,
|
|
8
|
-
) as <R, E, A>(fx: Fx<R, E, A>) => Effect.Effect<R, E, void>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import * as Effect from '@effect/io/Effect'
|
|
3
|
-
|
|
4
|
-
import { drain } from './drain.js'
|
|
5
|
-
|
|
6
|
-
import { Fx } from '@typed/fx/internal/Fx'
|
|
7
|
-
import { Scope } from '@typed/fx/internal/externals'
|
|
8
|
-
|
|
9
|
-
export const forkDaemon: <R, E, A>(fx: Fx<R, E, A>) => Effect.Effect<R, E, unknown> =
|
|
10
|
-
methodWithTrace(
|
|
11
|
-
(trace) =>
|
|
12
|
-
<R, E, A>(fx: Fx<R, E, A>): Effect.Effect<R, E, unknown> =>
|
|
13
|
-
Effect.forkDaemon(drain(fx)).traced(trace),
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
export const forkScoped: <R, E, A>(fx: Fx<R, E, A>) => Effect.Effect<R | Scope.Scope, E, unknown> =
|
|
17
|
-
methodWithTrace(
|
|
18
|
-
(trace) =>
|
|
19
|
-
<R, E, A>(fx: Fx<R, E, A>): Effect.Effect<R | Scope.Scope, E, unknown> =>
|
|
20
|
-
Effect.forkScoped(drain(fx)).traced(trace),
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
export const fork: <R, E, A>(fx: Fx<R, E, A>) => Effect.Effect<R, E, unknown> = methodWithTrace(
|
|
24
|
-
(trace) =>
|
|
25
|
-
<R, E, A>(fx: Fx<R, E, A>): Effect.Effect<R, E, unknown> =>
|
|
26
|
-
Effect.fork(drain(fx)).traced(trace),
|
|
27
|
-
)
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import { pipe } from '@effect/data/Function'
|
|
3
|
-
import type { Cause } from '@effect/io/Cause'
|
|
4
|
-
import { isInterruptedOnly } from '@effect/io/Cause'
|
|
5
|
-
import * as Deferred from '@effect/io/Deferred'
|
|
6
|
-
import * as Effect from '@effect/io/Effect'
|
|
7
|
-
import type { Scope } from '@effect/io/Scope'
|
|
8
|
-
|
|
9
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
10
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
11
|
-
|
|
12
|
-
export const observe: {
|
|
13
|
-
<R, E, A, R2, E2>(fx: Fx<R, E, A>, f: (a: A) => Effect.Effect<R2, E2, unknown>): Effect.Effect<
|
|
14
|
-
R | R2,
|
|
15
|
-
E | E2,
|
|
16
|
-
void
|
|
17
|
-
>
|
|
18
|
-
<A, R2, E2>(f: (a: A) => Effect.Effect<R2, E2, unknown>): <R, E>(
|
|
19
|
-
fx: Fx<R, E, A>,
|
|
20
|
-
) => Effect.Effect<R | R2, E | E2, void>
|
|
21
|
-
} = dualWithTrace(
|
|
22
|
-
2,
|
|
23
|
-
(trace) =>
|
|
24
|
-
<R, E, A, R2, E2>(
|
|
25
|
-
fx: Fx<R, E, A>,
|
|
26
|
-
f: (a: A) => Effect.Effect<R2, E2, unknown>,
|
|
27
|
-
): Effect.Effect<R | R2, E | E2, void> =>
|
|
28
|
-
Effect.scoped(observe_(fx, f)).traced(trace),
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
const observe_ = <R, E, A, R2, E2>(
|
|
32
|
-
fx: Fx<R, E, A>,
|
|
33
|
-
f: (a: A) => Effect.Effect<R2, E2, unknown>,
|
|
34
|
-
): Effect.Effect<R | R2 | Scope, E | E2, void> =>
|
|
35
|
-
Effect.gen(function* ($) {
|
|
36
|
-
const context = yield* $(Effect.context<R | R2 | Scope>())
|
|
37
|
-
const deferred = yield* $(Deferred.make<E | E2, void>())
|
|
38
|
-
const end = Deferred.succeed(deferred, undefined)
|
|
39
|
-
const error = (cause: Cause<E | E2>) =>
|
|
40
|
-
isInterruptedOnly(cause) ? end : Deferred.failCause(deferred, cause)
|
|
41
|
-
|
|
42
|
-
yield* $(
|
|
43
|
-
Effect.forkScoped(
|
|
44
|
-
fx.run(
|
|
45
|
-
Sink(
|
|
46
|
-
(a) => pipe(a, f, Effect.catchAllCause(error), Effect.provideContext(context)),
|
|
47
|
-
error,
|
|
48
|
-
() => end,
|
|
49
|
-
),
|
|
50
|
-
),
|
|
51
|
-
),
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
return yield* $(Deferred.await(deferred))
|
|
55
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
4
|
-
import { Effect } from '@typed/fx/internal/externals'
|
|
5
|
-
|
|
6
|
-
export const reduce: {
|
|
7
|
-
<R, E, A, B>(fx: Fx<R, E, A>, seed: B, f: (acc: B, a: A) => B): Effect.Effect<R, E, B>
|
|
8
|
-
<B, A>(seed: B, f: (acc: B, a: A) => B): <R, E>(fx: Fx<R, E, A>) => Effect.Effect<R, E, B>
|
|
9
|
-
} = dualWithTrace(
|
|
10
|
-
3,
|
|
11
|
-
(trace) =>
|
|
12
|
-
<R, E, A, B>(fx: Fx<R, E, A>, seed: B, f: (acc: B, a: A) => B) =>
|
|
13
|
-
Effect.gen(function* ($) {
|
|
14
|
-
let acc = seed
|
|
15
|
-
|
|
16
|
-
yield* $(fx.observe((a) => Effect.sync(() => (acc = f(acc, a)))))
|
|
17
|
-
|
|
18
|
-
return acc
|
|
19
|
-
}).traced(trace),
|
|
20
|
-
)
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
4
|
-
import { Effect } from '@typed/fx/internal/externals'
|
|
5
|
-
|
|
6
|
-
export const reduceEffect: {
|
|
7
|
-
<R, E, A, B, R2, E2>(
|
|
8
|
-
fx: Fx<R, E, A>,
|
|
9
|
-
seed: B,
|
|
10
|
-
f: (acc: B, a: A) => Effect.Effect<R2, E2, B>,
|
|
11
|
-
): Effect.Effect<R | R2, E | E2, B>
|
|
12
|
-
<B, A, R2, E2>(seed: B, f: (acc: B, a: A) => Effect.Effect<R2, E2, B>): <R, E>(
|
|
13
|
-
fx: Fx<R, E, A>,
|
|
14
|
-
) => Effect.Effect<R | R2, E | E2, B>
|
|
15
|
-
} = dualWithTrace(
|
|
16
|
-
3,
|
|
17
|
-
(trace) =>
|
|
18
|
-
<R, E, A, B, R2, E2>(fx: Fx<R, E, A>, seed: B, f: (acc: B, a: A) => Effect.Effect<R2, E2, B>) =>
|
|
19
|
-
Effect.gen(function* ($) {
|
|
20
|
-
const lock = Effect.unsafeMakeSemaphore(1).withPermits(1)
|
|
21
|
-
let acc = seed
|
|
22
|
-
|
|
23
|
-
yield* $(
|
|
24
|
-
fx.observe((a) => lock(Effect.tap(f(acc, a), (b) => Effect.sync(() => (acc = b))))),
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
return acc
|
|
28
|
-
}).traced(trace),
|
|
29
|
-
)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import type * as Effect from '@effect/io/Effect'
|
|
3
|
-
|
|
4
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
5
|
-
import { Chunk } from '@typed/fx/internal/externals'
|
|
6
|
-
import { reduce } from '@typed/fx/internal/run/reduce'
|
|
7
|
-
|
|
8
|
-
export const toChunk: <R, E, A>(fx: Fx<R, E, A>) => Effect.Effect<R, E, Chunk.Chunk<A>> =
|
|
9
|
-
methodWithTrace(
|
|
10
|
-
(trace) =>
|
|
11
|
-
<R, E, A>(fx: Fx<R, E, A>): Effect.Effect<R, E, Chunk.Chunk<A>> =>
|
|
12
|
-
reduce(fx, Chunk.empty<A>(), Chunk.append<A, A>).traced(trace),
|
|
13
|
-
)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import type * as Effect from '@effect/io/Effect'
|
|
3
|
-
|
|
4
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
5
|
-
import { reduce } from '@typed/fx/internal/run/reduce'
|
|
6
|
-
|
|
7
|
-
export const toReadonlyArray: <R, E, A>(fx: Fx<R, E, A>) => Effect.Effect<R, E, ReadonlyArray<A>> =
|
|
8
|
-
methodWithTrace(
|
|
9
|
-
(trace) =>
|
|
10
|
-
<R, E, A>(fx: Fx<R, E, A>): Effect.Effect<R, E, ReadonlyArray<A>> =>
|
|
11
|
-
reduce(fx, [] as Array<A>, (xs, x) => {
|
|
12
|
-
xs.push(x)
|
|
13
|
-
return xs
|
|
14
|
-
}).traced(trace),
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
export const toArray = toReadonlyArray as <R, E, A>(
|
|
18
|
-
fx: Fx<R, E, A>,
|
|
19
|
-
) => Effect.Effect<R, E, Array<A>>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './since.js'
|
|
2
|
-
export * from './skip.js'
|
|
3
|
-
export * from './skipAfter.js'
|
|
4
|
-
export * from './skipUntil.js'
|
|
5
|
-
export * from './skipWhile.js'
|
|
6
|
-
export * from './slice.js'
|
|
7
|
-
export * from './take.js'
|
|
8
|
-
export * from './takeUntil.js'
|
|
9
|
-
export * from './takeWhile.js'
|
|
10
|
-
export * from './until.js'
|