@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,22 +0,0 @@
|
|
|
1
|
-
import type { Trace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
4
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
5
|
-
import type { Context } from '@typed/fx/internal/externals'
|
|
6
|
-
import { Debug, Effect } from '@typed/fx/internal/externals'
|
|
7
|
-
|
|
8
|
-
export const serviceWithEffect: {
|
|
9
|
-
<I, A, R2, E2, B>(tag: Context.Tag<I, A>, f: (a: A) => Effect.Effect<R2, E2, B>): Fx<
|
|
10
|
-
R2 | I,
|
|
11
|
-
E2,
|
|
12
|
-
B
|
|
13
|
-
>
|
|
14
|
-
<A, R2, E2, B>(f: (a: A) => Effect.Effect<R2, E2, B>): <I>(
|
|
15
|
-
tag: Context.Tag<I, A>,
|
|
16
|
-
) => Fx<R2 | I, E2, B>
|
|
17
|
-
} = Debug.dualWithTrace(
|
|
18
|
-
2,
|
|
19
|
-
(trace: Trace) =>
|
|
20
|
-
<I, A, R2, E2, B>(tag: Context.Tag<I, A>, f: (a: A) => Effect.Effect<R2, E2, B>) =>
|
|
21
|
-
fromEffect(Effect.flatMap(tag, f)).traced(trace),
|
|
22
|
-
)
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
2
|
-
import type { Fx, Sink } from '@typed/fx/internal/Fx'
|
|
3
|
-
import type { Context, Scope } from '@typed/fx/internal/externals'
|
|
4
|
-
import { Debug, Effect } from '@typed/fx/internal/externals'
|
|
5
|
-
|
|
6
|
-
export const serviceWithFx: {
|
|
7
|
-
<I, A, R2, E2, B>(tag: Context.Tag<I, A>, f: (a: A) => Fx<R2, E2, B>): Fx<R2 | I, E2, B>
|
|
8
|
-
<I, A, R2, E2, B>(f: (a: A) => Fx<R2, E2, B>): (tag: Context.Tag<I, A>) => Fx<R2 | I, E2, B>
|
|
9
|
-
} = Debug.dualWithTrace(
|
|
10
|
-
2,
|
|
11
|
-
(trace) =>
|
|
12
|
-
<I, A, R2, E2, B>(tag: Context.Tag<I, A>, f: (a: A) => Fx<R2, E2, B>) =>
|
|
13
|
-
new ServiceWithFx(tag, f).traced(trace),
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
export class ServiceWithFx<I, A, R, E, B> extends BaseFx<R | I, E, B> {
|
|
17
|
-
readonly name = 'ServiceWithFx' as const
|
|
18
|
-
|
|
19
|
-
constructor(readonly tag: Context.Tag<I, A>, readonly f: (a: A) => Fx<R, E, B>) {
|
|
20
|
-
super()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
run(sink: Sink<E, B>): Effect.Effect<R | I | Scope.Scope, never, unknown> {
|
|
24
|
-
return Effect.flatMap(this.tag, (a) => this.f(a).run(sink))
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Tag } from '@effect/data/Context'
|
|
2
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
3
|
-
|
|
4
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
5
|
-
import { Effect } from '@typed/fx/internal/externals'
|
|
6
|
-
|
|
7
|
-
export const updateService: {
|
|
8
|
-
<R, I, E, A, S>(fx: Fx<R | I, E, A>, service: Tag<I, S>, f: (service: S) => S): Fx<R | I, E, A>
|
|
9
|
-
<I, S>(service: Tag<I, S>, f: (service: S) => S): <R, E, A>(
|
|
10
|
-
fx: Fx<R | I, E, A>,
|
|
11
|
-
) => Fx<R | I, E, A>
|
|
12
|
-
} = dualWithTrace(
|
|
13
|
-
3,
|
|
14
|
-
(trace) =>
|
|
15
|
-
<R, I, E, A, S>(
|
|
16
|
-
fx: Fx<R | I, E, A>,
|
|
17
|
-
service: Tag<I, S>,
|
|
18
|
-
f: (service: S) => S,
|
|
19
|
-
): Fx<R | I, E, A> =>
|
|
20
|
-
fx.transform(Effect.updateService(service, f)).traced(trace),
|
|
21
|
-
)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import * as Either from '@effect/data/Either'
|
|
3
|
-
import { pipe } from '@effect/data/Function'
|
|
4
|
-
|
|
5
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
6
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
7
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
8
|
-
import { Cause, Effect, Scope } from '@typed/fx/internal/externals'
|
|
9
|
-
|
|
10
|
-
export const either: <R, E, A>(fx: Fx<R, E, A>) => Fx<R, never, Either.Either<E, A>> =
|
|
11
|
-
methodWithTrace((trace) => (fx) => new EitherFx(fx).traced(trace))
|
|
12
|
-
|
|
13
|
-
export class EitherFx<R, E, A> extends BaseFx<R, never, Either.Either<E, A>> {
|
|
14
|
-
readonly name = 'Either'
|
|
15
|
-
|
|
16
|
-
constructor(readonly fx: Fx<R, E, A>) {
|
|
17
|
-
super()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
run(sink: Sink<never, Either.Either<E, A>>): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
21
|
-
return this.fx.run(
|
|
22
|
-
Sink(
|
|
23
|
-
(a) => pipe(a, Either.right, sink.event),
|
|
24
|
-
(e) =>
|
|
25
|
-
Either.match(
|
|
26
|
-
Cause.failureOrCause(e),
|
|
27
|
-
(e) => pipe(e, Either.left, sink.event),
|
|
28
|
-
sink.error,
|
|
29
|
-
),
|
|
30
|
-
sink.end,
|
|
31
|
-
),
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import * as Effect from '@effect/io/Effect'
|
|
3
|
-
|
|
4
|
-
import { Scope } from '../externals.js'
|
|
5
|
-
|
|
6
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
7
|
-
import type { Fx, Sink } from '@typed/fx/internal/Fx'
|
|
8
|
-
|
|
9
|
-
export const fromArray: <const T extends ReadonlyArray<any>>(
|
|
10
|
-
array: T,
|
|
11
|
-
) => Fx<never, never, T[number]> = methodWithTrace(
|
|
12
|
-
(trace) =>
|
|
13
|
-
<const T extends ReadonlyArray<any>>(array: T): Fx<never, never, T[number]> =>
|
|
14
|
-
new FromArrayFx(array).traced(trace),
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
export class FromArrayFx<T extends ReadonlyArray<any>> extends BaseFx<never, never, T[number]> {
|
|
18
|
-
readonly name = 'FromArray' as const
|
|
19
|
-
|
|
20
|
-
constructor(readonly array: T) {
|
|
21
|
-
super()
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
run(sink: Sink<never, T[number]>): Effect.Effect<Scope.Scope, never, unknown> {
|
|
25
|
-
return Effect.matchCauseEffect(
|
|
26
|
-
Effect.forEachDiscard(this.array, sink.event),
|
|
27
|
-
sink.error,
|
|
28
|
-
sink.end,
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import { pipe } from '@effect/data/Function'
|
|
3
|
-
import * as Effect from '@effect/io/Effect'
|
|
4
|
-
import type { Scope } from '@effect/io/Scope'
|
|
5
|
-
|
|
6
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
7
|
-
import type { Fx, Sink } from '@typed/fx/internal/Fx'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Construct a Fx from an Effect.
|
|
11
|
-
* @since 1.0.0
|
|
12
|
-
* @category Constructor
|
|
13
|
-
*/
|
|
14
|
-
export const fromEffect: <Services = never, Errors = never, Output = unknown>(
|
|
15
|
-
effect: Effect.Effect<Services, Errors, Output>,
|
|
16
|
-
) => Fx<Exclude<Services, Scope>, Errors, Output> = methodWithTrace(
|
|
17
|
-
(trace) =>
|
|
18
|
-
<Services, Errors, Output>(
|
|
19
|
-
effect: Effect.Effect<Services, Errors, Output>,
|
|
20
|
-
): Fx<Exclude<Services, Scope>, Errors, Output> =>
|
|
21
|
-
new FromEffect(effect).traced(trace),
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
export class FromEffect<Services, Errors, Output> extends BaseFx<
|
|
25
|
-
Exclude<Services, Scope>,
|
|
26
|
-
Errors,
|
|
27
|
-
Output
|
|
28
|
-
> {
|
|
29
|
-
readonly name = 'FromEffect' as const
|
|
30
|
-
|
|
31
|
-
constructor(readonly effect: Effect.Effect<Services, Errors, Output>) {
|
|
32
|
-
super()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
run(sink: Sink<Errors, Output>): Effect.Effect<Exclude<Services, Scope> | Scope, never, unknown> {
|
|
36
|
-
return Effect.matchCauseEffect(this.effect, sink.error, (a) =>
|
|
37
|
-
pipe(sink.event(a), Effect.flatMap(sink.end)),
|
|
38
|
-
) as any
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Type guard for FromEffect.
|
|
44
|
-
* @since 1.0.0
|
|
45
|
-
* @category Type Guard
|
|
46
|
-
*/
|
|
47
|
-
export function isFromEffect<Services, Errors, Output>(
|
|
48
|
-
fx: Fx<Services, Errors, Output>,
|
|
49
|
-
): fx is FromEffect<Services, Errors, Output> {
|
|
50
|
-
return fx instanceof FromEffect
|
|
51
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import type { Either } from '@effect/data/Either'
|
|
3
|
-
import * as Effect from '@effect/io/Effect'
|
|
4
|
-
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
7
|
-
|
|
8
|
-
export const fromEither: <E, A>(either: Either<E, A>) => Fx<never, E, A> = methodWithTrace(
|
|
9
|
-
(trace) => (either) => fromEffect(Effect.fromEither(either)).traced(trace),
|
|
10
|
-
)
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import type { Either } from '@effect/data/Either'
|
|
3
|
-
import type { Cause } from '@effect/io/Cause'
|
|
4
|
-
import * as Effect from '@effect/io/Effect'
|
|
5
|
-
|
|
6
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
7
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
8
|
-
|
|
9
|
-
export const fromEitherCause: <E, A>(either: Either<Cause<E>, A>) => Fx<never, E, A> =
|
|
10
|
-
methodWithTrace((trace) => (either) => fromEffect(Effect.fromEitherCause(either)).traced(trace))
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as Runtime from '@effect/io/Runtime'
|
|
2
|
-
|
|
3
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
4
|
-
import type { Fx, Sink } from '@typed/fx/internal/Fx'
|
|
5
|
-
import { withRefCounter } from '@typed/fx/internal/RefCounter'
|
|
6
|
-
import type { Cause, Scope } from '@typed/fx/internal/externals'
|
|
7
|
-
import { Effect } from '@typed/fx/internal/externals'
|
|
8
|
-
|
|
9
|
-
export interface Emitter<E, A> {
|
|
10
|
-
readonly event: (a: A) => void
|
|
11
|
-
readonly error: (e: Cause.Cause<E>) => void
|
|
12
|
-
readonly end: () => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function fromEmitter<E, A, R = never, E2 = never>(
|
|
16
|
-
emitter: (sink: Emitter<E, A>) => Effect.Effect<R | Scope.Scope, E2, unknown>,
|
|
17
|
-
): Fx<Exclude<R, Scope.Scope>, E | E2, A> {
|
|
18
|
-
return new FromEmitterFx(emitter)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class FromEmitterFx<E, A, R, E2> extends BaseFx<Exclude<R, Scope.Scope>, E | E2, A> {
|
|
22
|
-
readonly name = 'FromEmitter' as const
|
|
23
|
-
|
|
24
|
-
constructor(readonly f: (sink: Emitter<E, A>) => Effect.Effect<R | Scope.Scope, E2, unknown>) {
|
|
25
|
-
super()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
run(sink: Sink<E | E2, A>) {
|
|
29
|
-
const { f } = this
|
|
30
|
-
|
|
31
|
-
return withRefCounter(
|
|
32
|
-
1,
|
|
33
|
-
(counter) =>
|
|
34
|
-
Effect.gen(function* ($) {
|
|
35
|
-
const runtime = yield* $(Effect.runtime<R | Scope.Scope>())
|
|
36
|
-
const fork = Runtime.runFork(runtime)
|
|
37
|
-
const error = (e: Cause.Cause<E | E2>) => Effect.zipLeft(sink.error(e), counter.decrement)
|
|
38
|
-
const emitter: Emitter<E, A> = {
|
|
39
|
-
event: (a) => fork(sink.event(a)),
|
|
40
|
-
error: (e) => fork(error(e)),
|
|
41
|
-
end: () => fork(counter.decrement),
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
yield* $(Effect.catchAllCause(f(emitter), error))
|
|
45
|
-
}),
|
|
46
|
-
sink.end,
|
|
47
|
-
) as Effect.Effect<Exclude<R, Scope.Scope> | Scope.Scope, never, unknown>
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import * as Effect from '@effect/io/Effect'
|
|
3
|
-
import type { Fiber } from '@effect/io/Fiber'
|
|
4
|
-
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
7
|
-
|
|
8
|
-
export const fromFiber: <Errors, Output>(
|
|
9
|
-
fiber: Fiber<Errors, Output>,
|
|
10
|
-
) => Fx<never, Errors, Output> = methodWithTrace(
|
|
11
|
-
(trace) => (fiber) => fromEffect(Effect.fromFiber(fiber)).traced(trace),
|
|
12
|
-
)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import * as Effect from '@effect/io/Effect'
|
|
3
|
-
import type { Fiber } from '@effect/io/Fiber'
|
|
4
|
-
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
7
|
-
|
|
8
|
-
export const fromFiberEffect: <Services, Errors, Output>(
|
|
9
|
-
fiber: Effect.Effect<Services, Errors, Fiber<Errors, Output>>,
|
|
10
|
-
) => Fx<Services, Errors, Output> = methodWithTrace(
|
|
11
|
-
(trace) => (fiber) => fromEffect(Effect.fromFiberEffect(fiber)).traced(trace),
|
|
12
|
-
)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import { type Effect, matchCauseEffect, uninterruptible } from '@effect/io/Effect'
|
|
3
|
-
|
|
4
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
5
|
-
import type { Fx, Sink } from '@typed/fx/internal/Fx'
|
|
6
|
-
import type { Scope } from '@typed/fx/internal/externals'
|
|
7
|
-
|
|
8
|
-
export const fromFxEffect: <R, E, R2 = never, E2 = never, A = unknown>(
|
|
9
|
-
effect: Effect<R, E, Fx<R2, E2, A>>,
|
|
10
|
-
) => Fx<Exclude<R, Scope.Scope> | R2, E | E2, A> = methodWithTrace(
|
|
11
|
-
(trace) =>
|
|
12
|
-
<R, E, R2 = never, E2 = never, A = unknown>(effect: Effect<R, E, Fx<R2, E2, A>>) =>
|
|
13
|
-
new FromFxEffect(effect).traced(trace),
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
export class FromFxEffect<R, E, R2, E2, A> extends BaseFx<Exclude<R, Scope.Scope> | R2, E | E2, A> {
|
|
17
|
-
readonly name = 'FromFxEffect' as const
|
|
18
|
-
|
|
19
|
-
constructor(readonly effect: Effect<R, E, Fx<R2, E2, A>>) {
|
|
20
|
-
super()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @macro traced
|
|
25
|
-
*/
|
|
26
|
-
run(sink: Sink<E | E2, A>): Effect<Exclude<R, Scope.Scope> | Scope.Scope, never, unknown> {
|
|
27
|
-
// Ensure this.effect is uninterruptible, to ensure it can add any necessary resources to the Scope
|
|
28
|
-
return matchCauseEffect(uninterruptible(this.effect), sink.error, (fx) => fx.run(sink)) as any
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import type { Option } from '@effect/data/Option'
|
|
3
|
-
import * as Effect from '@effect/io/Effect'
|
|
4
|
-
|
|
5
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
6
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
7
|
-
|
|
8
|
-
export const fromOption: <A>(option: Option<A>) => Fx<never, Option<never>, A> = methodWithTrace(
|
|
9
|
-
(trace) => (option) => fromEffect(Effect.fromOption(option)).traced(trace),
|
|
10
|
-
)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import type { NoSuchElementException } from '@effect/io/Cause'
|
|
3
|
-
|
|
4
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
5
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
6
|
-
import type { Option } from '@typed/fx/internal/externals'
|
|
7
|
-
import { Effect } from '@typed/fx/internal/externals'
|
|
8
|
-
|
|
9
|
-
export const getOrFail: <A>(option: Option.Option<A>) => Fx<never, NoSuchElementException, A> =
|
|
10
|
-
methodWithTrace(
|
|
11
|
-
(trace) =>
|
|
12
|
-
<A>(option: Option.Option<A>): Fx<never, NoSuchElementException, A> =>
|
|
13
|
-
fromEffect(Effect.getOrFail(option).traced(trace)),
|
|
14
|
-
)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
4
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
5
|
-
import type { Option } from '@typed/fx/internal/externals'
|
|
6
|
-
import { Effect } from '@typed/fx/internal/externals'
|
|
7
|
-
|
|
8
|
-
export const getOrFailDiscard: <A>(option: Option.Option<A>) => Fx<never, void, A> =
|
|
9
|
-
methodWithTrace(
|
|
10
|
-
(trace) =>
|
|
11
|
-
<A>(option: Option.Option<A>): Fx<never, void, A> =>
|
|
12
|
-
fromEffect(Effect.getOrFailDiscard(option).traced(trace)),
|
|
13
|
-
)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
4
|
-
import { fromEffect } from '@typed/fx/internal/conversion/fromEffect'
|
|
5
|
-
import type { Option } from '@typed/fx/internal/externals'
|
|
6
|
-
import { Effect } from '@typed/fx/internal/externals'
|
|
7
|
-
|
|
8
|
-
export const getOrFailWith: {
|
|
9
|
-
<A, E>(option: Option.Option<A>, f: () => E): Fx<never, E, A>
|
|
10
|
-
<E>(f: () => E): <A>(option: Option.Option<A>) => Fx<never, E, A>
|
|
11
|
-
} = dualWithTrace(
|
|
12
|
-
2,
|
|
13
|
-
(trace) =>
|
|
14
|
-
<A, E>(option: Option.Option<A>, f: () => E): Fx<never, E, A> =>
|
|
15
|
-
fromEffect(Effect.getOrFailWith(option, f).traced(trace)),
|
|
16
|
-
)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './either.js'
|
|
2
|
-
export * from './fromArray.js'
|
|
3
|
-
export * from './fromEffect.js'
|
|
4
|
-
export * from './fromEither.js'
|
|
5
|
-
export * from './fromEitherCause.js'
|
|
6
|
-
export * from './fromEmitter.js'
|
|
7
|
-
export * from './fromFiber.js'
|
|
8
|
-
export * from './fromFiberEffect.js'
|
|
9
|
-
export * from './fromFxEffect.js'
|
|
10
|
-
export * from './fromOption.js'
|
|
11
|
-
export * from './getOrFail.js'
|
|
12
|
-
export * from './getOrFailDiscard.js'
|
|
13
|
-
export * from './getOrFailWith.js'
|
package/src/internal/do/Do.ts
DELETED
package/src/internal/do/bind.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import { Effect, Scope } from '../externals.js'
|
|
4
|
-
|
|
5
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
6
|
-
import type { Fx, Sink } from '@typed/fx/internal/Fx'
|
|
7
|
-
import { flatMap } from '@typed/fx/internal/operator/flatMap'
|
|
8
|
-
import { map } from '@typed/fx/internal/operator/map'
|
|
9
|
-
|
|
10
|
-
export const bind: {
|
|
11
|
-
<R, E, N extends string, K, R2, E2, A>(
|
|
12
|
-
self: Fx<R, E, K>,
|
|
13
|
-
tag: Exclude<N, keyof K>,
|
|
14
|
-
f: (_: K) => Fx<R2, E2, A>,
|
|
15
|
-
): Fx<R | R2, E | E2, MergeObjects<K, { readonly [_ in N]: A }>>
|
|
16
|
-
|
|
17
|
-
<N extends string, K, R2, E2, A>(tag: Exclude<N, keyof K>, f: (_: K) => Fx<R2, E2, A>): <R, E>(
|
|
18
|
-
self: Fx<R, E, K>,
|
|
19
|
-
) => Fx<R | R2, E | E2, MergeObjects<K, { readonly [_ in N]: A }>>
|
|
20
|
-
} = dualWithTrace(
|
|
21
|
-
3,
|
|
22
|
-
(trace) =>
|
|
23
|
-
<R, E, N extends string, K, R2, E2, A>(
|
|
24
|
-
self: Fx<R, E, K>,
|
|
25
|
-
tag: Exclude<N, keyof K>,
|
|
26
|
-
f: (_: K) => Fx<R2, E2, A>,
|
|
27
|
-
) =>
|
|
28
|
-
new BindFx(self, tag, f).traced(trace),
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
type MergeObjects<T, U> = {
|
|
32
|
-
readonly [K in keyof T | keyof U]: K extends keyof T ? T[K] : K extends keyof U ? U[K] : never
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class BindFx<R, E, N extends string, K, R2, E2, A> extends BaseFx<
|
|
36
|
-
R | R2,
|
|
37
|
-
E | E2,
|
|
38
|
-
MergeObjects<K, { readonly [_ in N]: A }>
|
|
39
|
-
> {
|
|
40
|
-
readonly name = 'Bind'
|
|
41
|
-
|
|
42
|
-
constructor(
|
|
43
|
-
readonly self: Fx<R, E, K>,
|
|
44
|
-
readonly tag: Exclude<N, keyof K>,
|
|
45
|
-
readonly f: (_: K) => Fx<R2, E2, A>,
|
|
46
|
-
) {
|
|
47
|
-
super()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
run(
|
|
51
|
-
sink: Sink<E | E2, MergeObjects<K, { readonly [_ in N]: A }>>,
|
|
52
|
-
): Effect.Effect<R | R2 | Scope.Scope, never, unknown> {
|
|
53
|
-
return flatMap(this.self, (k) => map(this.f(k), (a) => ({ ...k, [this.tag]: a } as any))).run(
|
|
54
|
-
sink,
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
|
|
3
|
-
import { Effect, Scope } from '../externals.js'
|
|
4
|
-
|
|
5
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
6
|
-
import type { Fx, Sink } from '@typed/fx/internal/Fx'
|
|
7
|
-
import { map } from '@typed/fx/internal/operator/map'
|
|
8
|
-
|
|
9
|
-
export const bindValue: {
|
|
10
|
-
<R, E, N extends string, K, A>(self: Fx<R, E, K>, tag: Exclude<N, keyof K>, f: (_: K) => A): Fx<
|
|
11
|
-
R,
|
|
12
|
-
E,
|
|
13
|
-
MergeObjects<K, { readonly [_ in N]: A }>
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
<N extends string, K, A>(tag: Exclude<N, keyof K>, f: (_: K) => A): <R, E>(
|
|
17
|
-
self: Fx<R, E, K>,
|
|
18
|
-
) => Fx<R, E, MergeObjects<K, { readonly [_ in N]: A }>>
|
|
19
|
-
} = dualWithTrace(
|
|
20
|
-
3,
|
|
21
|
-
(trace) =>
|
|
22
|
-
<R, E, N extends string, K, A>(self: Fx<R, E, K>, tag: Exclude<N, keyof K>, f: (_: K) => A) =>
|
|
23
|
-
new BindValueFx(self, tag, f).traced(trace),
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
type MergeObjects<T, U> = {
|
|
27
|
-
readonly [K in keyof T | keyof U]: K extends keyof T ? T[K] : K extends keyof U ? U[K] : never
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class BindValueFx<R, E, N extends string, K, A> extends BaseFx<
|
|
31
|
-
R,
|
|
32
|
-
E,
|
|
33
|
-
MergeObjects<K, { readonly [_ in N]: A }>
|
|
34
|
-
> {
|
|
35
|
-
readonly name = 'Bind'
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
readonly self: Fx<R, E, K>,
|
|
39
|
-
readonly tag: Exclude<N, keyof K>,
|
|
40
|
-
readonly f: (_: K) => A,
|
|
41
|
-
) {
|
|
42
|
-
super()
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
run(
|
|
46
|
-
sink: Sink<E, MergeObjects<K, { readonly [_ in N]: A }>>,
|
|
47
|
-
): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
48
|
-
return map(this.self, (k) => ({ ...k, [this.tag]: this.f(k) } as any)).run(sink)
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/internal/do/index.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import * as Either from '@effect/data/Either'
|
|
3
|
-
import * as Cause from '@effect/io/Cause'
|
|
4
|
-
|
|
5
|
-
import { Effect, Scope } from '../externals.js'
|
|
6
|
-
|
|
7
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
8
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
9
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
10
|
-
|
|
11
|
-
export const absolve = methodWithTrace(
|
|
12
|
-
(trace) =>
|
|
13
|
-
<R, E, E2, A>(fx: Fx<R, E, Either.Either<E2, A>>) =>
|
|
14
|
-
new AbsolveFx(fx).traced(trace),
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
export class AbsolveFx<R, E, E2, A> extends BaseFx<R, E | E2, A> {
|
|
18
|
-
readonly name = 'Absolve'
|
|
19
|
-
|
|
20
|
-
constructor(readonly fx: Fx<R, E, Either.Either<E2, A>>) {
|
|
21
|
-
super()
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
run(sink: Sink<E | E2, A>): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
25
|
-
return this.fx.run(
|
|
26
|
-
Sink(
|
|
27
|
-
Either.match((e2) => sink.error(Cause.fail(e2)), sink.event),
|
|
28
|
-
sink.error,
|
|
29
|
-
sink.end,
|
|
30
|
-
),
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,34 +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 { Cause, Effect, Either, Scope, flow } from '@typed/fx/internal/externals'
|
|
7
|
-
|
|
8
|
-
export const absolveWith: {
|
|
9
|
-
<R, E, A, E2, B>(fx: Fx<R, E, A>, f: (e: A) => Either.Either<E2, B>): Fx<R, E | E2, B>
|
|
10
|
-
<A, E2, B>(f: (e: A) => Either.Either<E2, B>): <R, E>(fx: Fx<R, E, A>) => Fx<R, E | E2, B>
|
|
11
|
-
} = dualWithTrace(
|
|
12
|
-
2,
|
|
13
|
-
(trace) =>
|
|
14
|
-
<R, E, A, E2, B>(fx: Fx<R, E, A>, f: (e: A) => Either.Either<E2, B>) =>
|
|
15
|
-
new AbsolveWithFx(fx, f).traced(trace),
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
export class AbsolveWithFx<R, E, A, E2, B> extends BaseFx<R, E | E2, B> {
|
|
19
|
-
readonly name = 'AbsolveWith' as const
|
|
20
|
-
|
|
21
|
-
constructor(readonly fx: Fx<R, E, A>, readonly f: (e: A) => Either.Either<E2, B>) {
|
|
22
|
-
super()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
run(sink: Sink<E | E2, B>): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
26
|
-
return this.fx.run(
|
|
27
|
-
Sink(
|
|
28
|
-
(a) => Either.match(this.f(a), flow(Cause.fail, sink.error), sink.event),
|
|
29
|
-
sink.error,
|
|
30
|
-
sink.end,
|
|
31
|
-
),
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { dualWithTrace } from '@effect/data/Debug'
|
|
2
|
-
import * as Cause from '@effect/io/Cause'
|
|
3
|
-
|
|
4
|
-
import { Effect, Scope } from '../externals.js'
|
|
5
|
-
|
|
6
|
-
import { BaseFx } from '@typed/fx/internal/BaseFx'
|
|
7
|
-
import { Sink } from '@typed/fx/internal/Fx'
|
|
8
|
-
import type { Fx } from '@typed/fx/internal/Fx'
|
|
9
|
-
|
|
10
|
-
export const absorbWith: {
|
|
11
|
-
<R, E, A>(fx: Fx<R, E, A>, f: (e: E) => unknown): Fx<R, unknown, A>
|
|
12
|
-
<E>(f: (e: E) => unknown): <R, A>(fx: Fx<R, E, A>) => Fx<R, unknown, A>
|
|
13
|
-
} = dualWithTrace(
|
|
14
|
-
2,
|
|
15
|
-
(trace) =>
|
|
16
|
-
<R, E, A>(fx: Fx<R, E, A>, f: (e: E) => unknown): Fx<R, unknown, A> =>
|
|
17
|
-
new AbsorbWithFx(fx, f).traced(trace),
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
export class AbsorbWithFx<R, E, A> extends BaseFx<R, unknown, A> {
|
|
21
|
-
readonly name = 'AbsorbWith'
|
|
22
|
-
|
|
23
|
-
constructor(readonly fx: Fx<R, E, A>, readonly f: (e: E) => unknown) {
|
|
24
|
-
super()
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
run(sink: Sink<unknown, A>): Effect.Effect<R | Scope.Scope, never, unknown> {
|
|
28
|
-
return this.fx.run(
|
|
29
|
-
Sink(
|
|
30
|
-
sink.event,
|
|
31
|
-
(cause) => sink.error(Cause.fail(Cause.squashWith(cause, this.f))),
|
|
32
|
-
sink.end,
|
|
33
|
-
),
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
}
|