@typed/fx 2.0.0-beta.4 → 2.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -20
- package/dist/Fx/Fx.d.ts +362 -10
- package/dist/Fx/Fx.d.ts.map +1 -1
- package/dist/Fx/Fx.js +32 -1
- package/dist/Fx/TypeId.d.ts +49 -3
- package/dist/Fx/TypeId.d.ts.map +1 -1
- package/dist/Fx/TypeId.js +39 -2
- package/dist/Fx/combinators/additive.d.ts +156 -5
- package/dist/Fx/combinators/additive.d.ts.map +1 -1
- package/dist/Fx/combinators/additive.js +156 -5
- package/dist/Fx/combinators/catch.d.ts +195 -22
- package/dist/Fx/combinators/catch.d.ts.map +1 -1
- package/dist/Fx/combinators/catch.js +186 -16
- package/dist/Fx/combinators/causes.d.ts +24 -1
- package/dist/Fx/combinators/causes.d.ts.map +1 -1
- package/dist/Fx/combinators/causes.js +24 -1
- package/dist/Fx/combinators/changesWithEffect.d.ts +20 -0
- package/dist/Fx/combinators/changesWithEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/changesWithEffect.js +20 -0
- package/dist/Fx/combinators/compact.d.ts +17 -0
- package/dist/Fx/combinators/compact.d.ts.map +1 -1
- package/dist/Fx/combinators/compact.js +17 -0
- package/dist/Fx/combinators/concatMap.d.ts +86 -0
- package/dist/Fx/combinators/concatMap.d.ts.map +1 -0
- package/dist/Fx/combinators/concatMap.js +86 -0
- package/dist/Fx/combinators/continueWith.d.ts +109 -1
- package/dist/Fx/combinators/continueWith.d.ts.map +1 -1
- package/dist/Fx/combinators/continueWith.js +109 -1
- package/dist/Fx/combinators/debounce.d.ts +34 -0
- package/dist/Fx/combinators/debounce.d.ts.map +1 -0
- package/dist/Fx/combinators/debounce.js +35 -0
- package/dist/Fx/combinators/delay.d.ts +34 -0
- package/dist/Fx/combinators/delay.d.ts.map +1 -0
- package/dist/Fx/combinators/delay.js +31 -0
- package/dist/Fx/combinators/dropUntil.d.ts +42 -0
- package/dist/Fx/combinators/dropUntil.d.ts.map +1 -1
- package/dist/Fx/combinators/dropUntil.js +42 -0
- package/dist/Fx/combinators/during.d.ts +38 -0
- package/dist/Fx/combinators/during.d.ts.map +1 -0
- package/dist/Fx/combinators/during.js +85 -0
- package/dist/Fx/combinators/ensuring.d.ts +33 -3
- package/dist/Fx/combinators/ensuring.d.ts.map +1 -1
- package/dist/Fx/combinators/ensuring.js +33 -3
- package/dist/Fx/combinators/exhaustLatestMap.d.ts +40 -4
- package/dist/Fx/combinators/exhaustLatestMap.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustLatestMap.js +40 -4
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts +39 -3
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustLatestMapEffect.js +39 -3
- package/dist/Fx/combinators/exhaustMap.d.ts +37 -0
- package/dist/Fx/combinators/exhaustMap.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustMap.js +37 -0
- package/dist/Fx/combinators/exhaustMapEffect.d.ts +32 -0
- package/dist/Fx/combinators/exhaustMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustMapEffect.js +32 -0
- package/dist/Fx/combinators/exit.d.ts +22 -1
- package/dist/Fx/combinators/exit.d.ts.map +1 -1
- package/dist/Fx/combinators/exit.js +22 -1
- package/dist/Fx/combinators/filter.d.ts +16 -0
- package/dist/Fx/combinators/filter.d.ts.map +1 -1
- package/dist/Fx/combinators/filter.js +16 -0
- package/dist/Fx/combinators/filterEffect.d.ts +21 -0
- package/dist/Fx/combinators/filterEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterEffect.js +21 -0
- package/dist/Fx/combinators/filterMap.d.ts +19 -0
- package/dist/Fx/combinators/filterMap.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMap.js +19 -0
- package/dist/Fx/combinators/filterMapEffect.d.ts +20 -0
- package/dist/Fx/combinators/filterMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapEffect.js +20 -0
- package/dist/Fx/combinators/filterMapLoop.d.ts +19 -0
- package/dist/Fx/combinators/filterMapLoop.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoop.js +19 -0
- package/dist/Fx/combinators/filterMapLoopCause.d.ts +20 -0
- package/dist/Fx/combinators/filterMapLoopCause.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopCause.js +20 -0
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts +20 -0
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopCauseEffect.js +20 -0
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts +20 -0
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopEffect.js +20 -0
- package/dist/Fx/combinators/flatMap.d.ts +48 -3
- package/dist/Fx/combinators/flatMap.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMap.js +35 -2
- package/dist/Fx/combinators/flatMapConcurrently.d.ts +50 -3
- package/dist/Fx/combinators/flatMapConcurrently.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapConcurrently.js +47 -1
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts +47 -3
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.js +39 -1
- package/dist/Fx/combinators/flatMapEffect.d.ts +44 -2
- package/dist/Fx/combinators/flatMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapEffect.js +31 -1
- package/dist/Fx/combinators/flip.d.ts +33 -1
- package/dist/Fx/combinators/flip.d.ts.map +1 -1
- package/dist/Fx/combinators/flip.js +33 -1
- package/dist/Fx/combinators/gen.d.ts +28 -9
- package/dist/Fx/combinators/gen.d.ts.map +1 -1
- package/dist/Fx/combinators/gen.js +27 -3
- package/dist/Fx/combinators/genScoped.d.ts +32 -9
- package/dist/Fx/combinators/genScoped.d.ts.map +1 -1
- package/dist/Fx/combinators/genScoped.js +30 -2
- package/dist/Fx/combinators/grouped.d.ts +89 -0
- package/dist/Fx/combinators/grouped.d.ts.map +1 -0
- package/dist/Fx/combinators/grouped.js +146 -0
- package/dist/Fx/combinators/index.d.ts +35 -0
- package/dist/Fx/combinators/index.d.ts.map +1 -1
- package/dist/Fx/combinators/index.js +35 -0
- package/dist/Fx/combinators/keyed.d.ts +121 -7
- package/dist/Fx/combinators/keyed.d.ts.map +1 -1
- package/dist/Fx/combinators/keyed.js +64 -6
- package/dist/Fx/combinators/loop.d.ts +16 -0
- package/dist/Fx/combinators/loop.d.ts.map +1 -1
- package/dist/Fx/combinators/loop.js +16 -0
- package/dist/Fx/combinators/loopCause.d.ts +17 -0
- package/dist/Fx/combinators/loopCause.d.ts.map +1 -1
- package/dist/Fx/combinators/loopCause.js +17 -0
- package/dist/Fx/combinators/loopCauseEffect.d.ts +18 -0
- package/dist/Fx/combinators/loopCauseEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/loopCauseEffect.js +18 -0
- package/dist/Fx/combinators/loopEffect.d.ts +23 -0
- package/dist/Fx/combinators/loopEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/loopEffect.js +23 -0
- package/dist/Fx/combinators/map.d.ts +45 -0
- package/dist/Fx/combinators/map.d.ts.map +1 -1
- package/dist/Fx/combinators/map.js +42 -0
- package/dist/Fx/combinators/mapBoth.d.ts +19 -0
- package/dist/Fx/combinators/mapBoth.d.ts.map +1 -1
- package/dist/Fx/combinators/mapBoth.js +19 -0
- package/dist/Fx/combinators/mapEffect.d.ts +24 -0
- package/dist/Fx/combinators/mapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/mapEffect.js +24 -0
- package/dist/Fx/combinators/mapError.d.ts +20 -4
- package/dist/Fx/combinators/mapError.d.ts.map +1 -1
- package/dist/Fx/combinators/mapError.js +20 -4
- package/dist/Fx/combinators/mergeAll.d.ts +34 -0
- package/dist/Fx/combinators/mergeAll.d.ts.map +1 -1
- package/dist/Fx/combinators/mergeAll.js +34 -0
- package/dist/Fx/combinators/mergeOrdered.d.ts +35 -3
- package/dist/Fx/combinators/mergeOrdered.d.ts.map +1 -1
- package/dist/Fx/combinators/mergeOrdered.js +35 -3
- package/dist/Fx/combinators/onError.d.ts +33 -3
- package/dist/Fx/combinators/onError.d.ts.map +1 -1
- package/dist/Fx/combinators/onError.js +33 -3
- package/dist/Fx/combinators/onExit.d.ts +28 -2
- package/dist/Fx/combinators/onExit.d.ts.map +1 -1
- package/dist/Fx/combinators/onExit.js +28 -2
- package/dist/Fx/combinators/onInterrupt.d.ts +48 -3
- package/dist/Fx/combinators/onInterrupt.d.ts.map +1 -1
- package/dist/Fx/combinators/onInterrupt.js +48 -3
- package/dist/Fx/combinators/pairwise.d.ts +28 -0
- package/dist/Fx/combinators/pairwise.d.ts.map +1 -0
- package/dist/Fx/combinators/pairwise.js +31 -0
- package/dist/Fx/combinators/provide.d.ts +130 -9
- package/dist/Fx/combinators/provide.d.ts.map +1 -1
- package/dist/Fx/combinators/provide.js +130 -9
- package/dist/Fx/combinators/race.d.ts +92 -0
- package/dist/Fx/combinators/race.d.ts.map +1 -0
- package/dist/Fx/combinators/race.js +149 -0
- package/dist/Fx/combinators/repeat.d.ts +41 -0
- package/dist/Fx/combinators/repeat.d.ts.map +1 -0
- package/dist/Fx/combinators/repeat.js +57 -0
- package/dist/Fx/combinators/result.d.ts +22 -0
- package/dist/Fx/combinators/result.d.ts.map +1 -1
- package/dist/Fx/combinators/result.js +26 -12
- package/dist/Fx/combinators/retry.d.ts +53 -0
- package/dist/Fx/combinators/retry.d.ts.map +1 -0
- package/dist/Fx/combinators/retry.js +71 -0
- package/dist/Fx/combinators/sample.d.ts +31 -0
- package/dist/Fx/combinators/sample.d.ts.map +1 -0
- package/dist/Fx/combinators/sample.js +42 -0
- package/dist/Fx/combinators/scan.d.ts +39 -0
- package/dist/Fx/combinators/scan.d.ts.map +1 -1
- package/dist/Fx/combinators/scan.js +39 -0
- package/dist/Fx/combinators/since.d.ts +30 -0
- package/dist/Fx/combinators/since.d.ts.map +1 -0
- package/dist/Fx/combinators/since.js +39 -0
- package/dist/Fx/combinators/skip.d.ts +31 -0
- package/dist/Fx/combinators/skip.d.ts.map +1 -1
- package/dist/Fx/combinators/skip.js +31 -0
- package/dist/Fx/combinators/skipRepeats.d.ts +16 -0
- package/dist/Fx/combinators/skipRepeats.d.ts.map +1 -1
- package/dist/Fx/combinators/skipRepeats.js +16 -0
- package/dist/Fx/combinators/skipRepeatsWith.d.ts +17 -0
- package/dist/Fx/combinators/skipRepeatsWith.d.ts.map +1 -1
- package/dist/Fx/combinators/skipRepeatsWith.js +17 -0
- package/dist/Fx/combinators/skipWhile.d.ts +68 -0
- package/dist/Fx/combinators/skipWhile.d.ts.map +1 -1
- package/dist/Fx/combinators/skipWhile.js +68 -0
- package/dist/Fx/combinators/slice.d.ts +82 -0
- package/dist/Fx/combinators/slice.d.ts.map +1 -1
- package/dist/Fx/combinators/slice.js +33 -0
- package/dist/Fx/combinators/switchMap.d.ts +38 -0
- package/dist/Fx/combinators/switchMap.d.ts.map +1 -1
- package/dist/Fx/combinators/switchMap.js +38 -0
- package/dist/Fx/combinators/switchMapEffect.d.ts +37 -0
- package/dist/Fx/combinators/switchMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/switchMapEffect.js +37 -0
- package/dist/Fx/combinators/take.d.ts +32 -0
- package/dist/Fx/combinators/take.d.ts.map +1 -1
- package/dist/Fx/combinators/take.js +32 -0
- package/dist/Fx/combinators/takeUntil.d.ts +46 -0
- package/dist/Fx/combinators/takeUntil.d.ts.map +1 -1
- package/dist/Fx/combinators/takeUntil.js +46 -0
- package/dist/Fx/combinators/takeWhile.d.ts +31 -0
- package/dist/Fx/combinators/takeWhile.d.ts.map +1 -1
- package/dist/Fx/combinators/takeWhile.js +31 -0
- package/dist/Fx/combinators/tapEffect.d.ts +16 -0
- package/dist/Fx/combinators/tapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/tapEffect.js +16 -0
- package/dist/Fx/combinators/throttle.d.ts +79 -0
- package/dist/Fx/combinators/throttle.d.ts.map +1 -0
- package/dist/Fx/combinators/throttle.js +99 -0
- package/dist/Fx/combinators/timeout.d.ts +76 -0
- package/dist/Fx/combinators/timeout.d.ts.map +1 -0
- package/dist/Fx/combinators/timeout.js +110 -0
- package/dist/Fx/combinators/tuple.d.ts +30 -0
- package/dist/Fx/combinators/tuple.d.ts.map +1 -1
- package/dist/Fx/combinators/tuple.js +34 -3
- package/dist/Fx/combinators/until.d.ts +27 -0
- package/dist/Fx/combinators/until.d.ts.map +1 -0
- package/dist/Fx/combinators/until.js +56 -0
- package/dist/Fx/combinators/unwrap.d.ts +29 -0
- package/dist/Fx/combinators/unwrap.d.ts.map +1 -1
- package/dist/Fx/combinators/unwrap.js +29 -0
- package/dist/Fx/combinators/unwrapScoped.d.ts +33 -0
- package/dist/Fx/combinators/unwrapScoped.d.ts.map +1 -1
- package/dist/Fx/combinators/unwrapScoped.js +33 -0
- package/dist/Fx/combinators/when.d.ts +35 -0
- package/dist/Fx/combinators/when.d.ts.map +1 -1
- package/dist/Fx/combinators/when.js +36 -1
- package/dist/Fx/combinators/withLatestFrom.d.ts +58 -0
- package/dist/Fx/combinators/withLatestFrom.d.ts.map +1 -0
- package/dist/Fx/combinators/withLatestFrom.js +68 -0
- package/dist/Fx/combinators/withSpan.d.ts +35 -1
- package/dist/Fx/combinators/withSpan.d.ts.map +1 -1
- package/dist/Fx/combinators/withSpan.js +34 -3
- package/dist/Fx/combinators/zip.d.ts +60 -0
- package/dist/Fx/combinators/zip.d.ts.map +1 -1
- package/dist/Fx/combinators/zip.js +60 -0
- package/dist/Fx/constructors/at.d.ts +20 -0
- package/dist/Fx/constructors/at.d.ts.map +1 -1
- package/dist/Fx/constructors/at.js +20 -0
- package/dist/Fx/constructors/die.d.ts +21 -0
- package/dist/Fx/constructors/die.d.ts.map +1 -1
- package/dist/Fx/constructors/die.js +21 -0
- package/dist/Fx/constructors/empty.d.ts +18 -0
- package/dist/Fx/constructors/empty.d.ts.map +1 -1
- package/dist/Fx/constructors/empty.js +18 -0
- package/dist/Fx/constructors/fail.d.ts +21 -0
- package/dist/Fx/constructors/fail.d.ts.map +1 -1
- package/dist/Fx/constructors/fail.js +21 -0
- package/dist/Fx/constructors/failCause.d.ts +22 -0
- package/dist/Fx/constructors/failCause.d.ts.map +1 -1
- package/dist/Fx/constructors/failCause.js +22 -0
- package/dist/Fx/constructors/fn.d.ts +113 -13
- package/dist/Fx/constructors/fn.d.ts.map +1 -1
- package/dist/Fx/constructors/fn.js +36 -0
- package/dist/Fx/constructors/fromEffect.d.ts +43 -1
- package/dist/Fx/constructors/fromEffect.d.ts.map +1 -1
- package/dist/Fx/constructors/fromEffect.js +43 -1
- package/dist/Fx/constructors/fromFailures.d.ts +24 -0
- package/dist/Fx/constructors/fromFailures.d.ts.map +1 -1
- package/dist/Fx/constructors/fromFailures.js +24 -0
- package/dist/Fx/constructors/fromIterable.d.ts +22 -0
- package/dist/Fx/constructors/fromIterable.d.ts.map +1 -1
- package/dist/Fx/constructors/fromIterable.js +22 -0
- package/dist/Fx/constructors/fromSchedule.d.ts +23 -0
- package/dist/Fx/constructors/fromSchedule.d.ts.map +1 -1
- package/dist/Fx/constructors/fromSchedule.js +25 -2
- package/dist/Fx/constructors/index.d.ts +2 -1
- package/dist/Fx/constructors/index.d.ts.map +1 -1
- package/dist/Fx/constructors/index.js +2 -1
- package/dist/Fx/constructors/interrupt.d.ts +21 -1
- package/dist/Fx/constructors/interrupt.d.ts.map +1 -1
- package/dist/Fx/constructors/interrupt.js +21 -1
- package/dist/Fx/constructors/make.d.ts +146 -1
- package/dist/Fx/constructors/make.d.ts.map +1 -1
- package/dist/Fx/constructors/make.js +54 -3
- package/dist/Fx/constructors/periodic.d.ts +29 -0
- package/dist/Fx/constructors/periodic.d.ts.map +1 -1
- package/dist/Fx/constructors/periodic.js +29 -0
- package/dist/Fx/constructors/succeed.d.ts +75 -3
- package/dist/Fx/constructors/succeed.d.ts.map +1 -1
- package/dist/Fx/constructors/succeed.js +75 -3
- package/dist/Fx/constructors/suspend.d.ts +28 -0
- package/dist/Fx/constructors/suspend.d.ts.map +1 -1
- package/dist/Fx/constructors/suspend.js +28 -0
- package/dist/Fx/constructors/sync.d.ts +32 -0
- package/dist/Fx/constructors/sync.d.ts.map +1 -0
- package/dist/Fx/constructors/sync.js +32 -0
- package/dist/Fx/internal/DeferredRef.d.ts +259 -7
- package/dist/Fx/internal/DeferredRef.d.ts.map +1 -1
- package/dist/Fx/internal/DeferredRef.js +260 -9
- package/dist/Fx/internal/UnionToTuple.d.ts +22 -0
- package/dist/Fx/internal/UnionToTuple.d.ts.map +1 -1
- package/dist/Fx/internal/diff.d.ts +586 -0
- package/dist/Fx/internal/diff.d.ts.map +1 -1
- package/dist/Fx/internal/diff.js +120 -9
- package/dist/Fx/internal/effectableEvaluateKey.d.ts +30 -0
- package/dist/Fx/internal/effectableEvaluateKey.d.ts.map +1 -0
- package/dist/Fx/internal/effectableEvaluateKey.js +29 -0
- package/dist/Fx/internal/effectableWithOverride.d.ts +55 -0
- package/dist/Fx/internal/effectableWithOverride.d.ts.map +1 -0
- package/dist/Fx/internal/effectableWithOverride.js +46 -0
- package/dist/Fx/internal/equivalence.d.ts +29 -0
- package/dist/Fx/internal/equivalence.d.ts.map +1 -1
- package/dist/Fx/internal/equivalence.js +29 -0
- package/dist/Fx/internal/multicast.d.ts +145 -2
- package/dist/Fx/internal/multicast.d.ts.map +1 -1
- package/dist/Fx/internal/multicast.js +146 -4
- package/dist/Fx/internal/ring-buffer.d.ts +149 -0
- package/dist/Fx/internal/ring-buffer.d.ts.map +1 -1
- package/dist/Fx/internal/ring-buffer.js +155 -0
- package/dist/Fx/internal/scope.d.ts +184 -0
- package/dist/Fx/internal/scope.d.ts.map +1 -1
- package/dist/Fx/internal/scope.js +150 -0
- package/dist/Fx/internal/yieldable.d.ts +117 -2
- package/dist/Fx/internal/yieldable.d.ts.map +1 -1
- package/dist/Fx/internal/yieldable.js +86 -3
- package/dist/Fx/run/collect.d.ts +89 -0
- package/dist/Fx/run/collect.d.ts.map +1 -1
- package/dist/Fx/run/collect.js +90 -1
- package/dist/Fx/run/first.d.ts +22 -0
- package/dist/Fx/run/first.d.ts.map +1 -1
- package/dist/Fx/run/first.js +22 -0
- package/dist/Fx/run/fork.d.ts +50 -0
- package/dist/Fx/run/fork.d.ts.map +1 -1
- package/dist/Fx/run/fork.js +50 -0
- package/dist/Fx/run/observe.d.ts +106 -0
- package/dist/Fx/run/observe.d.ts.map +1 -1
- package/dist/Fx/run/observe.js +106 -0
- package/dist/Fx/run/runPromise.d.ts +43 -0
- package/dist/Fx/run/runPromise.d.ts.map +1 -1
- package/dist/Fx/run/runPromise.js +43 -0
- package/dist/Fx/stream.d.ts +92 -0
- package/dist/Fx/stream.d.ts.map +1 -1
- package/dist/Fx/stream.js +60 -1
- package/dist/Push/Push.d.ts +1216 -91
- package/dist/Push/Push.d.ts.map +1 -1
- package/dist/Push/Push.js +1012 -83
- package/dist/RefArray.d.ts +2 -0
- package/dist/RefArray.d.ts.map +1 -0
- package/dist/RefArray.js +1 -0
- package/dist/RefBigDecimal.d.ts +2 -0
- package/dist/RefBigDecimal.d.ts.map +1 -0
- package/dist/RefBigDecimal.js +1 -0
- package/dist/RefBigInt.d.ts +2 -0
- package/dist/RefBigInt.d.ts.map +1 -0
- package/dist/RefBigInt.js +1 -0
- package/dist/RefBoolean.d.ts +2 -0
- package/dist/RefBoolean.d.ts.map +1 -0
- package/dist/RefBoolean.js +1 -0
- package/dist/RefCause.d.ts +2 -0
- package/dist/RefCause.d.ts.map +1 -0
- package/dist/RefCause.js +1 -0
- package/dist/RefChunk.d.ts +2 -0
- package/dist/RefChunk.d.ts.map +1 -0
- package/dist/RefChunk.js +1 -0
- package/dist/RefDateTime.d.ts +2 -0
- package/dist/RefDateTime.d.ts.map +1 -0
- package/dist/RefDateTime.js +1 -0
- package/dist/RefDuration.d.ts +2 -0
- package/dist/RefDuration.d.ts.map +1 -0
- package/dist/RefDuration.js +1 -0
- package/dist/RefGraph.d.ts +2 -0
- package/dist/RefGraph.d.ts.map +1 -0
- package/dist/RefGraph.js +1 -0
- package/dist/RefHashMap.d.ts +2 -0
- package/dist/RefHashMap.d.ts.map +1 -0
- package/dist/RefHashMap.js +1 -0
- package/dist/RefHashRing.d.ts +2 -0
- package/dist/RefHashRing.d.ts.map +1 -0
- package/dist/RefHashRing.js +1 -0
- package/dist/RefHashSet.d.ts +2 -0
- package/dist/RefHashSet.d.ts.map +1 -0
- package/dist/RefHashSet.js +1 -0
- package/dist/RefIterable.d.ts +2 -0
- package/dist/RefIterable.d.ts.map +1 -0
- package/dist/RefIterable.js +1 -0
- package/dist/RefOption.d.ts +2 -0
- package/dist/RefOption.d.ts.map +1 -0
- package/dist/RefOption.js +1 -0
- package/dist/RefRecord.d.ts +2 -0
- package/dist/RefRecord.d.ts.map +1 -0
- package/dist/RefRecord.js +1 -0
- package/dist/RefResult.d.ts +2 -0
- package/dist/RefResult.d.ts.map +1 -0
- package/dist/RefResult.js +1 -0
- package/dist/RefString.d.ts +2 -0
- package/dist/RefString.d.ts.map +1 -0
- package/dist/RefString.js +1 -0
- package/dist/RefStruct.d.ts +2 -0
- package/dist/RefStruct.d.ts.map +1 -0
- package/dist/RefStruct.js +1 -0
- package/dist/RefSubject/Hydration.d.ts +504 -0
- package/dist/RefSubject/Hydration.d.ts.map +1 -0
- package/dist/RefSubject/Hydration.js +300 -0
- package/dist/RefSubject/RefArray.d.ts +351 -4
- package/dist/RefSubject/RefArray.d.ts.map +1 -1
- package/dist/RefSubject/RefArray.js +339 -3
- package/dist/RefSubject/RefBigDecimal.d.ts +221 -1
- package/dist/RefSubject/RefBigDecimal.d.ts.map +1 -1
- package/dist/RefSubject/RefBigDecimal.js +210 -1
- package/dist/RefSubject/RefBigInt.d.ts +166 -1
- package/dist/RefSubject/RefBigInt.d.ts.map +1 -1
- package/dist/RefSubject/RefBigInt.js +155 -1
- package/dist/RefSubject/RefBoolean.d.ts +166 -1
- package/dist/RefSubject/RefBoolean.d.ts.map +1 -1
- package/dist/RefSubject/RefBoolean.js +155 -1
- package/dist/RefSubject/RefCause.d.ts +122 -1
- package/dist/RefSubject/RefCause.d.ts.map +1 -1
- package/dist/RefSubject/RefCause.js +111 -1
- package/dist/RefSubject/RefChunk.d.ts +406 -1
- package/dist/RefSubject/RefChunk.d.ts.map +1 -1
- package/dist/RefSubject/RefChunk.js +394 -0
- package/dist/RefSubject/RefDateTime.d.ts +122 -1
- package/dist/RefSubject/RefDateTime.d.ts.map +1 -1
- package/dist/RefSubject/RefDateTime.js +111 -1
- package/dist/RefSubject/RefDuration.d.ts +155 -1
- package/dist/RefSubject/RefDuration.d.ts.map +1 -1
- package/dist/RefSubject/RefDuration.js +144 -1
- package/dist/RefSubject/RefGraph.d.ts +320 -6
- package/dist/RefSubject/RefGraph.d.ts.map +1 -1
- package/dist/RefSubject/RefGraph.js +303 -0
- package/dist/RefSubject/RefHashMap.d.ts +296 -1
- package/dist/RefSubject/RefHashMap.d.ts.map +1 -1
- package/dist/RefSubject/RefHashMap.js +284 -0
- package/dist/RefSubject/RefHashRing.d.ts +146 -2
- package/dist/RefSubject/RefHashRing.d.ts.map +1 -1
- package/dist/RefSubject/RefHashRing.js +133 -0
- package/dist/RefSubject/RefHashSet.d.ts +230 -1
- package/dist/RefSubject/RefHashSet.d.ts.map +1 -1
- package/dist/RefSubject/RefHashSet.js +218 -0
- package/dist/RefSubject/RefIterable.d.ts +327 -1
- package/dist/RefSubject/RefIterable.d.ts.map +1 -1
- package/dist/RefSubject/RefIterable.js +315 -0
- package/dist/RefSubject/RefOption.d.ts +144 -1
- package/dist/RefSubject/RefOption.d.ts.map +1 -1
- package/dist/RefSubject/RefOption.js +133 -1
- package/dist/RefSubject/RefRecord.d.ts +339 -1
- package/dist/RefSubject/RefRecord.d.ts.map +1 -1
- package/dist/RefSubject/RefRecord.js +327 -0
- package/dist/RefSubject/RefResult.d.ts +155 -23
- package/dist/RefSubject/RefResult.d.ts.map +1 -1
- package/dist/RefSubject/RefResult.js +122 -1
- package/dist/RefSubject/RefString.d.ts +188 -1
- package/dist/RefSubject/RefString.d.ts.map +1 -1
- package/dist/RefSubject/RefString.js +177 -1
- package/dist/RefSubject/RefStruct.d.ts +156 -1
- package/dist/RefSubject/RefStruct.d.ts.map +1 -1
- package/dist/RefSubject/RefStruct.js +145 -1
- package/dist/RefSubject/RefSubject.d.ts +1166 -13
- package/dist/RefSubject/RefSubject.d.ts.map +1 -1
- package/dist/RefSubject/RefSubject.js +843 -51
- package/dist/RefSubject/RefTrie.d.ts +290 -4
- package/dist/RefSubject/RefTrie.d.ts.map +1 -1
- package/dist/RefSubject/RefTrie.js +278 -3
- package/dist/RefSubject/RefTuple.d.ts +117 -1
- package/dist/RefSubject/RefTuple.d.ts.map +1 -1
- package/dist/RefSubject/RefTuple.js +106 -1
- package/dist/RefSubject/index.d.ts +1 -0
- package/dist/RefSubject/index.d.ts.map +1 -1
- package/dist/RefSubject/index.js +1 -0
- package/dist/RefSubject.d.ts +2 -1
- package/dist/RefSubject.d.ts.map +1 -1
- package/dist/RefSubject.js +2 -1
- package/dist/RefTrie.d.ts +2 -0
- package/dist/RefTrie.d.ts.map +1 -0
- package/dist/RefTrie.js +1 -0
- package/dist/RefTuple.d.ts +2 -0
- package/dist/RefTuple.d.ts.map +1 -0
- package/dist/RefTuple.js +1 -0
- package/dist/Sink/Sink.d.ts +381 -10
- package/dist/Sink/Sink.d.ts.map +1 -1
- package/dist/Sink/Sink.js +49 -2
- package/dist/Sink/combinators.d.ts +731 -2
- package/dist/Sink/combinators.d.ts.map +1 -1
- package/dist/Sink/combinators.js +706 -4
- package/dist/Subject/Subject.d.ts +1013 -19
- package/dist/Subject/Subject.d.ts.map +1 -1
- package/dist/Subject/Subject.js +901 -36
- package/dist/Versioned/Versioned.d.ts +424 -7
- package/dist/Versioned/Versioned.d.ts.map +1 -1
- package/dist/Versioned/Versioned.js +238 -12
- package/dist/index.d.ts +22 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -3
- package/package.json +123 -14
- package/dist/Fx/constructors/fromYieldable.d.ts +0 -12
- package/dist/Fx/constructors/fromYieldable.d.ts.map +0 -1
- package/dist/Fx/constructors/fromYieldable.js +0 -12
- package/src/Fx/Fx.ts +0 -164
- package/src/Fx/TypeId.ts +0 -25
- package/src/Fx/combinators/additive.ts +0 -142
- package/src/Fx/combinators/catch.ts +0 -416
- package/src/Fx/combinators/causes.ts +0 -23
- package/src/Fx/combinators/changesWithEffect.ts +0 -66
- package/src/Fx/combinators/compact.ts +0 -15
- package/src/Fx/combinators/continueWith.ts +0 -78
- package/src/Fx/combinators/dropUntil.ts +0 -47
- package/src/Fx/combinators/ensuring.ts +0 -23
- package/src/Fx/combinators/exhaustLatestMap.ts +0 -74
- package/src/Fx/combinators/exhaustLatestMapEffect.ts +0 -25
- package/src/Fx/combinators/exhaustMap.ts +0 -36
- package/src/Fx/combinators/exhaustMapEffect.ts +0 -23
- package/src/Fx/combinators/exit.ts +0 -15
- package/src/Fx/combinators/filter.ts +0 -22
- package/src/Fx/combinators/filterEffect.ts +0 -31
- package/src/Fx/combinators/filterMap.ts +0 -23
- package/src/Fx/combinators/filterMapEffect.ts +0 -32
- package/src/Fx/combinators/filterMapLoop.ts +0 -35
- package/src/Fx/combinators/filterMapLoopCause.ts +0 -36
- package/src/Fx/combinators/filterMapLoopCauseEffect.ts +0 -46
- package/src/Fx/combinators/filterMapLoopEffect.ts +0 -36
- package/src/Fx/combinators/flatMap.ts +0 -51
- package/src/Fx/combinators/flatMapConcurrently.ts +0 -39
- package/src/Fx/combinators/flatMapConcurrentlyEffect.ts +0 -26
- package/src/Fx/combinators/flatMapEffect.ts +0 -42
- package/src/Fx/combinators/flip.ts +0 -14
- package/src/Fx/combinators/gen.ts +0 -24
- package/src/Fx/combinators/genScoped.ts +0 -24
- package/src/Fx/combinators/index.ts +0 -61
- package/src/Fx/combinators/keyed.ts +0 -369
- package/src/Fx/combinators/loop.ts +0 -27
- package/src/Fx/combinators/loopCause.ts +0 -34
- package/src/Fx/combinators/loopCauseEffect.ts +0 -36
- package/src/Fx/combinators/loopEffect.ts +0 -34
- package/src/Fx/combinators/map.ts +0 -22
- package/src/Fx/combinators/mapBoth.ts +0 -40
- package/src/Fx/combinators/mapEffect.ts +0 -32
- package/src/Fx/combinators/mapError.ts +0 -28
- package/src/Fx/combinators/mergeAll.ts +0 -22
- package/src/Fx/combinators/mergeOrdered.ts +0 -123
- package/src/Fx/combinators/onError.ts +0 -40
- package/src/Fx/combinators/onExit.ts +0 -82
- package/src/Fx/combinators/onInterrupt.ts +0 -87
- package/src/Fx/combinators/provide.ts +0 -124
- package/src/Fx/combinators/result.ts +0 -39
- package/src/Fx/combinators/scan.ts +0 -82
- package/src/Fx/combinators/skip.ts +0 -41
- package/src/Fx/combinators/skipRepeats.ts +0 -15
- package/src/Fx/combinators/skipRepeatsWith.ts +0 -40
- package/src/Fx/combinators/skipWhile.ts +0 -100
- package/src/Fx/combinators/slice.ts +0 -55
- package/src/Fx/combinators/switchMap.ts +0 -55
- package/src/Fx/combinators/switchMapEffect.ts +0 -25
- package/src/Fx/combinators/take.ts +0 -38
- package/src/Fx/combinators/takeUntil.ts +0 -88
- package/src/Fx/combinators/takeWhile.ts +0 -47
- package/src/Fx/combinators/tapEffect.ts +0 -39
- package/src/Fx/combinators/tuple.ts +0 -79
- package/src/Fx/combinators/unwrap.ts +0 -21
- package/src/Fx/combinators/unwrapScoped.ts +0 -26
- package/src/Fx/combinators/when.ts +0 -64
- package/src/Fx/combinators/withSpan.ts +0 -24
- package/src/Fx/combinators/zip.ts +0 -175
- package/src/Fx/constructors/at.ts +0 -23
- package/src/Fx/constructors/die.ts +0 -17
- package/src/Fx/constructors/empty.ts +0 -10
- package/src/Fx/constructors/fail.ts +0 -14
- package/src/Fx/constructors/failCause.ts +0 -14
- package/src/Fx/constructors/fn.ts +0 -245
- package/src/Fx/constructors/fromEffect.ts +0 -24
- package/src/Fx/constructors/fromFailures.ts +0 -19
- package/src/Fx/constructors/fromIterable.ts +0 -15
- package/src/Fx/constructors/fromSchedule.ts +0 -18
- package/src/Fx/constructors/fromYieldable.ts +0 -17
- package/src/Fx/constructors/index.ts +0 -15
- package/src/Fx/constructors/interrupt.ts +0 -13
- package/src/Fx/constructors/make.ts +0 -103
- package/src/Fx/constructors/periodic.ts +0 -15
- package/src/Fx/constructors/succeed.ts +0 -37
- package/src/Fx/constructors/suspend.ts +0 -6
- package/src/Fx/index.ts +0 -6
- package/src/Fx/internal/DeferredRef.ts +0 -87
- package/src/Fx/internal/UnionToTuple.ts +0 -12
- package/src/Fx/internal/diff.ts +0 -191
- package/src/Fx/internal/equivalence.ts +0 -12
- package/src/Fx/internal/multicast.ts +0 -51
- package/src/Fx/internal/ring-buffer.ts +0 -60
- package/src/Fx/internal/scope.ts +0 -58
- package/src/Fx/internal/yieldable.ts +0 -31
- package/src/Fx/run/collect.ts +0 -79
- package/src/Fx/run/first.ts +0 -20
- package/src/Fx/run/fork.ts +0 -40
- package/src/Fx/run/index.ts +0 -5
- package/src/Fx/run/observe.ts +0 -114
- package/src/Fx/run/runPromise.ts +0 -32
- package/src/Fx/stream.ts +0 -42
- package/src/Fx.additive-combinators.test.ts +0 -126
- package/src/Fx.catch-additive.test.ts +0 -206
- package/src/Fx.catch.test.ts +0 -60
- package/src/Fx.dropUntil.test.ts +0 -61
- package/src/Fx.fn.test.ts +0 -51
- package/src/Fx.lifecycle.test.ts +0 -79
- package/src/Fx.mapError-mapBoth.test.ts +0 -101
- package/src/Fx.provide-combinators.test.ts +0 -94
- package/src/Fx.result-changesWithEffect.test.ts +0 -112
- package/src/Fx.scan.test.ts +0 -73
- package/src/Fx.takeWhile-skipWhile.test.ts +0 -84
- package/src/Fx.test.ts +0 -71
- package/src/Fx.ts +0 -1
- package/src/Fx.zip-merge-additive.test.ts +0 -171
- package/src/Fx.zip.test.ts +0 -133
- package/src/Push/Push.ts +0 -1093
- package/src/Push/index.ts +0 -1
- package/src/Push.additive.test.ts +0 -256
- package/src/Push.test.ts +0 -26
- package/src/Push.ts +0 -1
- package/src/RefSubject/RefArray.ts +0 -516
- package/src/RefSubject/RefBigDecimal.test.ts +0 -56
- package/src/RefSubject/RefBigDecimal.ts +0 -295
- package/src/RefSubject/RefBigInt.test.ts +0 -56
- package/src/RefSubject/RefBigInt.ts +0 -189
- package/src/RefSubject/RefBoolean.test.ts +0 -57
- package/src/RefSubject/RefBoolean.ts +0 -185
- package/src/RefSubject/RefCause.test.ts +0 -53
- package/src/RefSubject/RefCause.ts +0 -146
- package/src/RefSubject/RefChunk.ts +0 -516
- package/src/RefSubject/RefDateTime.test.ts +0 -43
- package/src/RefSubject/RefDateTime.ts +0 -261
- package/src/RefSubject/RefDuration.test.ts +0 -49
- package/src/RefSubject/RefDuration.ts +0 -188
- package/src/RefSubject/RefGraph.ts +0 -649
- package/src/RefSubject/RefHashMap.ts +0 -474
- package/src/RefSubject/RefHashRing.ts +0 -262
- package/src/RefSubject/RefHashSet.ts +0 -308
- package/src/RefSubject/RefIterable.ts +0 -454
- package/src/RefSubject/RefOption.test.ts +0 -67
- package/src/RefSubject/RefOption.ts +0 -193
- package/src/RefSubject/RefRecord.ts +0 -621
- package/src/RefSubject/RefResult.test.ts +0 -63
- package/src/RefSubject/RefResult.ts +0 -209
- package/src/RefSubject/RefString.test.ts +0 -61
- package/src/RefSubject/RefString.ts +0 -256
- package/src/RefSubject/RefStruct.test.ts +0 -60
- package/src/RefSubject/RefStruct.ts +0 -253
- package/src/RefSubject/RefSubject.ts +0 -2642
- package/src/RefSubject/RefTrie.ts +0 -365
- package/src/RefSubject/RefTuple.test.ts +0 -60
- package/src/RefSubject/RefTuple.ts +0 -231
- package/src/RefSubject/index.ts +0 -21
- package/src/RefSubject.additive-parity.test.ts +0 -101
- package/src/RefSubject.test.ts +0 -65
- package/src/RefSubject.ts +0 -1
- package/src/Sink/Sink.ts +0 -159
- package/src/Sink/combinators.ts +0 -1115
- package/src/Sink/index.ts +0 -2
- package/src/Sink.combinators.test.ts +0 -88
- package/src/Sink.reduce-collect-head-last.test.ts +0 -107
- package/src/Sink.ts +0 -1
- package/src/Subject/Subject.ts +0 -440
- package/src/Subject/index.ts +0 -1
- package/src/Subject.test.ts +0 -47
- package/src/Subject.ts +0 -1
- package/src/Versioned/Versioned.ts +0 -595
- package/src/Versioned/index.ts +0 -1
- package/src/Versioned.filterMap.test.ts +0 -91
- package/src/Versioned.test.ts +0 -23
- package/src/Versioned.ts +0 -1
- package/src/index.ts +0 -7
|
@@ -3,9 +3,41 @@ import * as Cause from "effect/Cause";
|
|
|
3
3
|
import type { ExcludeTag, ExtractTag, NoInfer, Tags } from "effect/Types";
|
|
4
4
|
import type { Fx } from "../Fx.js";
|
|
5
5
|
/**
|
|
6
|
-
* Recovers from
|
|
6
|
+
* Recovers from the first typed failure of an Fx by running a fallback Fx.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* ## Why
|
|
10
|
+
*
|
|
11
|
+
* Typed failures are part of an Fx's public error channel, so callers often
|
|
12
|
+
* need to replace a failed producer based on its first typed failure. This is
|
|
13
|
+
* the push-stream counterpart of Effect's typed recovery.
|
|
14
|
+
*
|
|
15
|
+
* ## Ownership and lifetime
|
|
16
|
+
*
|
|
17
|
+
* The source runs until it reports a Cause containing a `Fail`. The first typed
|
|
18
|
+
* failure starts exactly one fallback and the entire original Cause is replaced,
|
|
19
|
+
* including any defects or interrupts composed beside that Fail. A Cause with
|
|
20
|
+
* no Fail passes through unchanged. Source values already delivered remain
|
|
21
|
+
* delivered. The fallback's services become requirements of the returned Fx,
|
|
22
|
+
* and external interruption stops whichever run is active.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { catch as recover } from "@typed/fx/Fx"
|
|
27
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
28
|
+
*
|
|
29
|
+
* const resilient = recover(fail("offline"), (error) => succeed(error.length))
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example Recovering a Fail discards its complete composite Cause
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { Cause } from "effect"
|
|
35
|
+
* import { catch as recover } from "@typed/fx/Fx"
|
|
36
|
+
* import { failCause, succeed } from "@typed/fx/Fx"
|
|
37
|
+
*
|
|
38
|
+
* const composite = Cause.combine(Cause.fail("offline"), Cause.die("socket defect"))
|
|
39
|
+
* const recovered = recover(failCause(composite), () => succeed("cached"))
|
|
40
|
+
* ```
|
|
9
41
|
*
|
|
10
42
|
* @since 1.0.0
|
|
11
43
|
* @category combinators
|
|
@@ -16,7 +48,27 @@ export declare const catch_: {
|
|
|
16
48
|
};
|
|
17
49
|
export { catch_ as catch };
|
|
18
50
|
/**
|
|
19
|
-
*
|
|
51
|
+
* Uses the Effect-style `catchAll` name for {@link catch}.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* ## Why
|
|
55
|
+
*
|
|
56
|
+
* The alias lets Effect users apply the same typed-failure recovery vocabulary
|
|
57
|
+
* to Fx without introducing different runtime behavior.
|
|
58
|
+
*
|
|
59
|
+
* ## Ownership and lifetime
|
|
60
|
+
*
|
|
61
|
+
* It has exactly the source/fallback switching, failure, service, and
|
|
62
|
+
* interruption semantics of {@link catch}; it allocates no wrapper resource
|
|
63
|
+
* beyond that combinator.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { catchAll } from "@typed/fx/Fx"
|
|
68
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
69
|
+
*
|
|
70
|
+
* const recovered = catchAll(fail("missing"), () => succeed("default"))
|
|
71
|
+
* ```
|
|
20
72
|
*
|
|
21
73
|
* @since 1.0.0
|
|
22
74
|
* @category combinators
|
|
@@ -26,10 +78,34 @@ export declare const catchAll: {
|
|
|
26
78
|
<A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;
|
|
27
79
|
};
|
|
28
80
|
/**
|
|
29
|
-
* Recovers from
|
|
30
|
-
*
|
|
81
|
+
* Recovers from any failure cause by running a fallback Fx.
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* ## Why
|
|
85
|
+
*
|
|
86
|
+
* A full `Cause` retains typed failures, defects, interruption, and composed
|
|
87
|
+
* causes. Handling that structure explicitly is necessary at boundaries that
|
|
88
|
+
* must translate every termination mode rather than only expected errors.
|
|
31
89
|
*
|
|
32
|
-
*
|
|
90
|
+
* ## Ownership and lifetime
|
|
91
|
+
*
|
|
92
|
+
* The handler runs once after the source reports a cause and its returned Fx
|
|
93
|
+
* continues in the same subscription. It receives the cause unchanged. Values
|
|
94
|
+
* emitted before failure are not replayed, and the fallback's errors and
|
|
95
|
+
* services replace the recovered source error and join its requirements.
|
|
96
|
+
* Because interruption is catchable here, use this only when intentionally
|
|
97
|
+
* translating interruption rather than for ordinary typed recovery.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { Cause } from "effect"
|
|
102
|
+
* import { catchCause } from "@typed/fx/Fx"
|
|
103
|
+
* import { failCause, succeed } from "@typed/fx/Fx"
|
|
104
|
+
*
|
|
105
|
+
* const reported = catchCause(failCause(Cause.die("boom")), (cause) =>
|
|
106
|
+
* succeed(Cause.pretty(cause))
|
|
107
|
+
* )
|
|
108
|
+
* ```
|
|
33
109
|
*
|
|
34
110
|
* @since 1.0.0
|
|
35
111
|
* @category combinators
|
|
@@ -39,9 +115,32 @@ export declare const catchCause: {
|
|
|
39
115
|
<A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (cause: Cause.Cause<E>) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;
|
|
40
116
|
};
|
|
41
117
|
/**
|
|
42
|
-
* Recovers
|
|
118
|
+
* Recovers selected tagged typed failures by running a fallback Fx.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* ## Why
|
|
43
122
|
*
|
|
44
|
-
*
|
|
123
|
+
* Tagged error unions are idiomatic Effect APIs. Selecting one or more tags
|
|
124
|
+
* narrows the handler input and removes only those variants from the returned
|
|
125
|
+
* error channel, preserving the rest for later composition.
|
|
126
|
+
*
|
|
127
|
+
* ## Ownership and lifetime
|
|
128
|
+
*
|
|
129
|
+
* The source owns the subscription until its Cause contains a Fail whose tag
|
|
130
|
+
* matches. That first matching Fail starts one handler Fx and replaces the
|
|
131
|
+
* entire original Cause, including any defects or interrupts composed with it.
|
|
132
|
+
* A Cause with no Fail, or a first Fail with another tag, passes through intact.
|
|
133
|
+
* The fallback is lazy and contributes its errors and services to the result.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* import { catchTag } from "@typed/fx/Fx"
|
|
138
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
139
|
+
*
|
|
140
|
+
* type Missing = { readonly _tag: "Missing"; readonly id: string }
|
|
141
|
+
* const source = fail<Missing>({ _tag: "Missing", id: "42" })
|
|
142
|
+
* const recovered = catchTag(source, "Missing", ({ id }) => succeed(`missing:${id}`))
|
|
143
|
+
* ```
|
|
45
144
|
*
|
|
46
145
|
* @since 1.0.0
|
|
47
146
|
* @category combinators
|
|
@@ -51,10 +150,30 @@ export declare const catchTag: {
|
|
|
51
150
|
<A, E, R, const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>, A2, E2, R2>(self: Fx<A, E, R>, k: K, f: (e: ExtractTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Fx<A2, E2, R2>): Fx<A | A2, E2 | ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>, R | R2>;
|
|
52
151
|
};
|
|
53
152
|
/**
|
|
54
|
-
* Recovers
|
|
55
|
-
*
|
|
153
|
+
* Recovers a typed failure only when a predicate accepts it.
|
|
154
|
+
*
|
|
155
|
+
* @remarks
|
|
156
|
+
* ## Why
|
|
56
157
|
*
|
|
57
|
-
*
|
|
158
|
+
* Some typed errors are distinguished by values rather than tags. Predicate
|
|
159
|
+
* recovery handles that subset while retaining `E` in the result because a
|
|
160
|
+
* rejected error can still escape.
|
|
161
|
+
*
|
|
162
|
+
* ## Ownership and lifetime
|
|
163
|
+
*
|
|
164
|
+
* The predicate is evaluated on the first Fail found anywhere in the source
|
|
165
|
+
* Cause. A match starts one lazy fallback and replaces that entire Cause,
|
|
166
|
+
* including any defects or interrupts composed with the Fail. A rejection, or
|
|
167
|
+
* a Cause containing no Fail, forwards the original Cause unchanged. The
|
|
168
|
+
* fallback contributes its errors and services and shares the subscription.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* import { catchIf } from "@typed/fx/Fx"
|
|
173
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
174
|
+
*
|
|
175
|
+
* const recovered = catchIf(fail(404), (status) => status === 404, () => succeed("missing"))
|
|
176
|
+
* ```
|
|
58
177
|
*
|
|
59
178
|
* @since 1.0.0
|
|
60
179
|
* @category combinators
|
|
@@ -64,10 +183,33 @@ export declare const catchIf: {
|
|
|
64
183
|
<A, E, R, A2, E2, R2>(self: Fx<A, E, R>, predicate: (e: E) => boolean, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E | E2, R | R2>;
|
|
65
184
|
};
|
|
66
185
|
/**
|
|
67
|
-
* Recovers
|
|
68
|
-
*
|
|
186
|
+
* Recovers a failure cause only when a predicate accepts the complete cause.
|
|
187
|
+
*
|
|
188
|
+
* @remarks
|
|
189
|
+
* ## Why
|
|
69
190
|
*
|
|
70
|
-
*
|
|
191
|
+
* Cause-level predicates can distinguish defects, interruption, sequential or
|
|
192
|
+
* parallel cause structure that a typed-error predicate cannot observe.
|
|
193
|
+
*
|
|
194
|
+
* ## Ownership and lifetime
|
|
195
|
+
*
|
|
196
|
+
* The predicate receives the source cause unchanged. A match starts one lazy
|
|
197
|
+
* fallback in the same subscription; otherwise the original cause propagates.
|
|
198
|
+
* The fallback's requirements and errors are added, prior source values stay
|
|
199
|
+
* delivered, and interrupting the returned Fx interrupts its active run.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* import { Cause } from "effect"
|
|
204
|
+
* import { catchCauseIf } from "@typed/fx/Fx"
|
|
205
|
+
* import { failCause, succeed } from "@typed/fx/Fx"
|
|
206
|
+
*
|
|
207
|
+
* const recovered = catchCauseIf(
|
|
208
|
+
* failCause(Cause.die("bad decoder")),
|
|
209
|
+
* Cause.hasDies,
|
|
210
|
+
* () => succeed("reported")
|
|
211
|
+
* )
|
|
212
|
+
* ```
|
|
71
213
|
*
|
|
72
214
|
* @since 1.0.0
|
|
73
215
|
* @category combinators
|
|
@@ -83,32 +225,63 @@ type TaggedCase<E> = {
|
|
|
83
225
|
_tag: K;
|
|
84
226
|
}>) => Fx<unknown, unknown, unknown>;
|
|
85
227
|
};
|
|
228
|
+
type CaseSuccess<T> = T extends (error: never) => Fx<infer A, infer _E, infer _R> ? A : never;
|
|
229
|
+
type CaseError<T> = T extends (error: never) => Fx<infer _A, infer E, infer _R> ? E : never;
|
|
230
|
+
type CaseServices<T> = T extends (error: never) => Fx<infer _A, infer _E, infer R> ? R : never;
|
|
86
231
|
/**
|
|
87
|
-
* Recovers
|
|
232
|
+
* Recovers several tagged typed-error variants with one handler table.
|
|
233
|
+
*
|
|
234
|
+
* @remarks
|
|
235
|
+
* ## Why
|
|
236
|
+
*
|
|
237
|
+
* A handler table keeps multi-variant recovery exhaustive and preserves the
|
|
238
|
+
* precise success, error, and service unions produced by each selected case.
|
|
239
|
+
* Unlisted variants remain visible in the returned error channel.
|
|
240
|
+
*
|
|
241
|
+
* ## Ownership and lifetime
|
|
242
|
+
*
|
|
243
|
+
* The first Fail found anywhere in the source Cause is inspected. A listed tag
|
|
244
|
+
* starts exactly one handler Fx and replaces the entire original Cause,
|
|
245
|
+
* including any defects or interrupts composed with that Fail. An untagged or
|
|
246
|
+
* unlisted first Fail, or a Cause with no Fail, propagates intact. Handlers are
|
|
247
|
+
* lazy and contribute their individual errors and service requirements.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* import { catchTags } from "@typed/fx/Fx"
|
|
252
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
88
253
|
*
|
|
89
|
-
*
|
|
254
|
+
* type Failure =
|
|
255
|
+
* | { readonly _tag: "Missing"; readonly id: string }
|
|
256
|
+
* | { readonly _tag: "Forbidden" }
|
|
257
|
+
* const source = fail<Failure>({ _tag: "Missing", id: "42" })
|
|
258
|
+
* const recovered = catchTags(source, {
|
|
259
|
+
* Missing: ({ id }) => succeed(`missing:${id}`),
|
|
260
|
+
* Forbidden: () => succeed("forbidden")
|
|
261
|
+
* })
|
|
262
|
+
* ```
|
|
90
263
|
*
|
|
91
264
|
* @since 1.0.0
|
|
92
265
|
* @category combinators
|
|
93
266
|
*/
|
|
94
267
|
export declare const catchTags: {
|
|
95
268
|
<E, Cases extends TaggedCase<E>>(cases: Cases): <A, R>(self: Fx<A, E, R>) => Fx<A | {
|
|
96
|
-
[K in keyof Cases]: Cases[K]
|
|
269
|
+
[K in keyof Cases]: CaseSuccess<Cases[K]>;
|
|
97
270
|
}[keyof Cases], Exclude<E, {
|
|
98
271
|
_tag: keyof Cases;
|
|
99
272
|
}> | {
|
|
100
|
-
[K in keyof Cases]: Cases[K]
|
|
273
|
+
[K in keyof Cases]: CaseError<Cases[K]>;
|
|
101
274
|
}[keyof Cases], R | {
|
|
102
|
-
[K in keyof Cases]: Cases[K]
|
|
275
|
+
[K in keyof Cases]: CaseServices<Cases[K]>;
|
|
103
276
|
}[keyof Cases]>;
|
|
104
277
|
<A, E, R, Cases extends TaggedCase<E>>(self: Fx<A, E, R>, cases: Cases): Fx<A | {
|
|
105
|
-
[K in keyof Cases]: Cases[K]
|
|
278
|
+
[K in keyof Cases]: CaseSuccess<Cases[K]>;
|
|
106
279
|
}[keyof Cases], Exclude<E, {
|
|
107
280
|
_tag: keyof Cases;
|
|
108
281
|
}> | {
|
|
109
|
-
[K in keyof Cases]: Cases[K]
|
|
282
|
+
[K in keyof Cases]: CaseError<Cases[K]>;
|
|
110
283
|
}[keyof Cases], R | {
|
|
111
|
-
[K in keyof Cases]: Cases[K]
|
|
284
|
+
[K in keyof Cases]: CaseServices<Cases[K]>;
|
|
112
285
|
}[keyof Cases]>;
|
|
113
286
|
};
|
|
114
287
|
//# sourceMappingURL=catch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/catch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAiBnC
|
|
1
|
+
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/catch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAiBnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,MAAM,EAAE;IACnB,CA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G;SAAG,CAAC,IAAI,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC,MAAM,KAAK,CAAC,EAC9D,OAAO,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC,GAAG;SAAG,CAAC,IAAI,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC,MAAM,KAAK,CAAC,EAC5F,CAAC,GAAG;SAAG,CAAC,IAAI,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC,MAAM,KAAK,CAAC,CAChE,CAAC;CA4DH,CAAC"}
|
|
@@ -15,9 +15,41 @@ const matchesTag = (tag, error) => {
|
|
|
15
15
|
return tag.some((t) => t === error._tag);
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* Recovers from
|
|
18
|
+
* Recovers from the first typed failure of an Fx by running a fallback Fx.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* ## Why
|
|
22
|
+
*
|
|
23
|
+
* Typed failures are part of an Fx's public error channel, so callers often
|
|
24
|
+
* need to replace a failed producer based on its first typed failure. This is
|
|
25
|
+
* the push-stream counterpart of Effect's typed recovery.
|
|
26
|
+
*
|
|
27
|
+
* ## Ownership and lifetime
|
|
28
|
+
*
|
|
29
|
+
* The source runs until it reports a Cause containing a `Fail`. The first typed
|
|
30
|
+
* failure starts exactly one fallback and the entire original Cause is replaced,
|
|
31
|
+
* including any defects or interrupts composed beside that Fail. A Cause with
|
|
32
|
+
* no Fail passes through unchanged. Source values already delivered remain
|
|
33
|
+
* delivered. The fallback's services become requirements of the returned Fx,
|
|
34
|
+
* and external interruption stops whichever run is active.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { catch as recover } from "@typed/fx/Fx"
|
|
39
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
40
|
+
*
|
|
41
|
+
* const resilient = recover(fail("offline"), (error) => succeed(error.length))
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Recovering a Fail discards its complete composite Cause
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { Cause } from "effect"
|
|
47
|
+
* import { catch as recover } from "@typed/fx/Fx"
|
|
48
|
+
* import { failCause, succeed } from "@typed/fx/Fx"
|
|
49
|
+
*
|
|
50
|
+
* const composite = Cause.combine(Cause.fail("offline"), Cause.die("socket defect"))
|
|
51
|
+
* const recovered = recover(failCause(composite), () => succeed("cached"))
|
|
52
|
+
* ```
|
|
21
53
|
*
|
|
22
54
|
* @since 1.0.0
|
|
23
55
|
* @category combinators
|
|
@@ -31,26 +63,93 @@ export const catch_ = dual(2, (self, f) => make((sink) => self.run(makeSink((cau
|
|
|
31
63
|
}, sink.onSuccess))));
|
|
32
64
|
export { catch_ as catch };
|
|
33
65
|
/**
|
|
34
|
-
*
|
|
66
|
+
* Uses the Effect-style `catchAll` name for {@link catch}.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* ## Why
|
|
70
|
+
*
|
|
71
|
+
* The alias lets Effect users apply the same typed-failure recovery vocabulary
|
|
72
|
+
* to Fx without introducing different runtime behavior.
|
|
73
|
+
*
|
|
74
|
+
* ## Ownership and lifetime
|
|
75
|
+
*
|
|
76
|
+
* It has exactly the source/fallback switching, failure, service, and
|
|
77
|
+
* interruption semantics of {@link catch}; it allocates no wrapper resource
|
|
78
|
+
* beyond that combinator.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { catchAll } from "@typed/fx/Fx"
|
|
83
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
84
|
+
*
|
|
85
|
+
* const recovered = catchAll(fail("missing"), () => succeed("default"))
|
|
86
|
+
* ```
|
|
35
87
|
*
|
|
36
88
|
* @since 1.0.0
|
|
37
89
|
* @category combinators
|
|
38
90
|
*/
|
|
39
91
|
export const catchAll = catch_;
|
|
40
92
|
/**
|
|
41
|
-
* Recovers from
|
|
42
|
-
*
|
|
93
|
+
* Recovers from any failure cause by running a fallback Fx.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* ## Why
|
|
97
|
+
*
|
|
98
|
+
* A full `Cause` retains typed failures, defects, interruption, and composed
|
|
99
|
+
* causes. Handling that structure explicitly is necessary at boundaries that
|
|
100
|
+
* must translate every termination mode rather than only expected errors.
|
|
43
101
|
*
|
|
44
|
-
*
|
|
102
|
+
* ## Ownership and lifetime
|
|
103
|
+
*
|
|
104
|
+
* The handler runs once after the source reports a cause and its returned Fx
|
|
105
|
+
* continues in the same subscription. It receives the cause unchanged. Values
|
|
106
|
+
* emitted before failure are not replayed, and the fallback's errors and
|
|
107
|
+
* services replace the recovered source error and join its requirements.
|
|
108
|
+
* Because interruption is catchable here, use this only when intentionally
|
|
109
|
+
* translating interruption rather than for ordinary typed recovery.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* import { Cause } from "effect"
|
|
114
|
+
* import { catchCause } from "@typed/fx/Fx"
|
|
115
|
+
* import { failCause, succeed } from "@typed/fx/Fx"
|
|
116
|
+
*
|
|
117
|
+
* const reported = catchCause(failCause(Cause.die("boom")), (cause) =>
|
|
118
|
+
* succeed(Cause.pretty(cause))
|
|
119
|
+
* )
|
|
120
|
+
* ```
|
|
45
121
|
*
|
|
46
122
|
* @since 1.0.0
|
|
47
123
|
* @category combinators
|
|
48
124
|
*/
|
|
49
125
|
export const catchCause = dual(2, (self, f) => make((sink) => self.run(makeSink((cause) => f(cause).run(sink), sink.onSuccess))));
|
|
50
126
|
/**
|
|
51
|
-
* Recovers
|
|
127
|
+
* Recovers selected tagged typed failures by running a fallback Fx.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* ## Why
|
|
52
131
|
*
|
|
53
|
-
*
|
|
132
|
+
* Tagged error unions are idiomatic Effect APIs. Selecting one or more tags
|
|
133
|
+
* narrows the handler input and removes only those variants from the returned
|
|
134
|
+
* error channel, preserving the rest for later composition.
|
|
135
|
+
*
|
|
136
|
+
* ## Ownership and lifetime
|
|
137
|
+
*
|
|
138
|
+
* The source owns the subscription until its Cause contains a Fail whose tag
|
|
139
|
+
* matches. That first matching Fail starts one handler Fx and replaces the
|
|
140
|
+
* entire original Cause, including any defects or interrupts composed with it.
|
|
141
|
+
* A Cause with no Fail, or a first Fail with another tag, passes through intact.
|
|
142
|
+
* The fallback is lazy and contributes its errors and services to the result.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* import { catchTag } from "@typed/fx/Fx"
|
|
147
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
148
|
+
*
|
|
149
|
+
* type Missing = { readonly _tag: "Missing"; readonly id: string }
|
|
150
|
+
* const source = fail<Missing>({ _tag: "Missing", id: "42" })
|
|
151
|
+
* const recovered = catchTag(source, "Missing", ({ id }) => succeed(`missing:${id}`))
|
|
152
|
+
* ```
|
|
54
153
|
*
|
|
55
154
|
* @since 1.0.0
|
|
56
155
|
* @category combinators
|
|
@@ -68,10 +167,30 @@ export const catchTag = dual(3, (self, k, f) => make((sink) => self.run(makeSink
|
|
|
68
167
|
}
|
|
69
168
|
}, sink.onSuccess))));
|
|
70
169
|
/**
|
|
71
|
-
* Recovers
|
|
72
|
-
*
|
|
170
|
+
* Recovers a typed failure only when a predicate accepts it.
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* ## Why
|
|
73
174
|
*
|
|
74
|
-
*
|
|
175
|
+
* Some typed errors are distinguished by values rather than tags. Predicate
|
|
176
|
+
* recovery handles that subset while retaining `E` in the result because a
|
|
177
|
+
* rejected error can still escape.
|
|
178
|
+
*
|
|
179
|
+
* ## Ownership and lifetime
|
|
180
|
+
*
|
|
181
|
+
* The predicate is evaluated on the first Fail found anywhere in the source
|
|
182
|
+
* Cause. A match starts one lazy fallback and replaces that entire Cause,
|
|
183
|
+
* including any defects or interrupts composed with the Fail. A rejection, or
|
|
184
|
+
* a Cause containing no Fail, forwards the original Cause unchanged. The
|
|
185
|
+
* fallback contributes its errors and services and shares the subscription.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* import { catchIf } from "@typed/fx/Fx"
|
|
190
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
191
|
+
*
|
|
192
|
+
* const recovered = catchIf(fail(404), (status) => status === 404, () => succeed("missing"))
|
|
193
|
+
* ```
|
|
75
194
|
*
|
|
76
195
|
* @since 1.0.0
|
|
77
196
|
* @category combinators
|
|
@@ -88,19 +207,70 @@ export const catchIf = dual(3, (self, predicate, f) => make((sink) => self.run(m
|
|
|
88
207
|
return sink.onFailure(cause);
|
|
89
208
|
}, sink.onSuccess))));
|
|
90
209
|
/**
|
|
91
|
-
* Recovers
|
|
92
|
-
*
|
|
210
|
+
* Recovers a failure cause only when a predicate accepts the complete cause.
|
|
211
|
+
*
|
|
212
|
+
* @remarks
|
|
213
|
+
* ## Why
|
|
93
214
|
*
|
|
94
|
-
*
|
|
215
|
+
* Cause-level predicates can distinguish defects, interruption, sequential or
|
|
216
|
+
* parallel cause structure that a typed-error predicate cannot observe.
|
|
217
|
+
*
|
|
218
|
+
* ## Ownership and lifetime
|
|
219
|
+
*
|
|
220
|
+
* The predicate receives the source cause unchanged. A match starts one lazy
|
|
221
|
+
* fallback in the same subscription; otherwise the original cause propagates.
|
|
222
|
+
* The fallback's requirements and errors are added, prior source values stay
|
|
223
|
+
* delivered, and interrupting the returned Fx interrupts its active run.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```ts
|
|
227
|
+
* import { Cause } from "effect"
|
|
228
|
+
* import { catchCauseIf } from "@typed/fx/Fx"
|
|
229
|
+
* import { failCause, succeed } from "@typed/fx/Fx"
|
|
230
|
+
*
|
|
231
|
+
* const recovered = catchCauseIf(
|
|
232
|
+
* failCause(Cause.die("bad decoder")),
|
|
233
|
+
* Cause.hasDies,
|
|
234
|
+
* () => succeed("reported")
|
|
235
|
+
* )
|
|
236
|
+
* ```
|
|
95
237
|
*
|
|
96
238
|
* @since 1.0.0
|
|
97
239
|
* @category combinators
|
|
98
240
|
*/
|
|
99
241
|
export const catchCauseIf = dual(3, (self, predicate, f) => make((sink) => self.run(makeSink((cause) => (predicate(cause) ? f(cause).run(sink) : sink.onFailure(cause)), sink.onSuccess))));
|
|
100
242
|
/**
|
|
101
|
-
* Recovers
|
|
243
|
+
* Recovers several tagged typed-error variants with one handler table.
|
|
244
|
+
*
|
|
245
|
+
* @remarks
|
|
246
|
+
* ## Why
|
|
247
|
+
*
|
|
248
|
+
* A handler table keeps multi-variant recovery exhaustive and preserves the
|
|
249
|
+
* precise success, error, and service unions produced by each selected case.
|
|
250
|
+
* Unlisted variants remain visible in the returned error channel.
|
|
251
|
+
*
|
|
252
|
+
* ## Ownership and lifetime
|
|
253
|
+
*
|
|
254
|
+
* The first Fail found anywhere in the source Cause is inspected. A listed tag
|
|
255
|
+
* starts exactly one handler Fx and replaces the entire original Cause,
|
|
256
|
+
* including any defects or interrupts composed with that Fail. An untagged or
|
|
257
|
+
* unlisted first Fail, or a Cause with no Fail, propagates intact. Handlers are
|
|
258
|
+
* lazy and contribute their individual errors and service requirements.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* import { catchTags } from "@typed/fx/Fx"
|
|
263
|
+
* import { fail, succeed } from "@typed/fx/Fx"
|
|
102
264
|
*
|
|
103
|
-
*
|
|
265
|
+
* type Failure =
|
|
266
|
+
* | { readonly _tag: "Missing"; readonly id: string }
|
|
267
|
+
* | { readonly _tag: "Forbidden" }
|
|
268
|
+
* const source = fail<Failure>({ _tag: "Missing", id: "42" })
|
|
269
|
+
* const recovered = catchTags(source, {
|
|
270
|
+
* Missing: ({ id }) => succeed(`missing:${id}`),
|
|
271
|
+
* Forbidden: () => succeed("forbidden")
|
|
272
|
+
* })
|
|
273
|
+
* ```
|
|
104
274
|
*
|
|
105
275
|
* @since 1.0.0
|
|
106
276
|
* @category combinators
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import type * as Cause from "effect/Cause";
|
|
2
2
|
import type { Fx } from "../Fx.js";
|
|
3
3
|
/**
|
|
4
|
-
* Emits
|
|
4
|
+
* Emits the source's terminal failure cause and discards every successful value.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* ## Why
|
|
8
|
+
*
|
|
9
|
+
* Failure telemetry and supervision often need the complete Effect `Cause`
|
|
10
|
+
* without treating that cause as another failure. Materializing only the
|
|
11
|
+
* failure side makes those pipelines ordinary, infallible Fx values.
|
|
12
|
+
*
|
|
13
|
+
* ## Ownership and lifetime
|
|
14
|
+
*
|
|
15
|
+
* The source is subscribed once. Success values are dropped in arrival order;
|
|
16
|
+
* a terminal cause is emitted once and the returned Fx completes without a
|
|
17
|
+
* typed error. Defects and interruption are retained inside the emitted cause.
|
|
18
|
+
* No resource is acquired beyond the source subscription.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { Cause } from "effect"
|
|
23
|
+
* import { causes } from "@typed/fx/Fx"
|
|
24
|
+
* import { failCause } from "@typed/fx/Fx"
|
|
25
|
+
*
|
|
26
|
+
* const failures = causes(failCause(Cause.fail("offline")))
|
|
27
|
+
* ```
|
|
5
28
|
*
|
|
6
29
|
* @param fx - The `Fx` stream.
|
|
7
30
|
* @returns An `Fx` emitting `Cause<E>`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"causes.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/causes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAInC
|
|
1
|
+
{"version":3,"file":"causes.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/causes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAInC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAO1E,CAAC"}
|
|
@@ -3,7 +3,30 @@ import * as Option from "effect/Option";
|
|
|
3
3
|
import { exit } from "./exit.js";
|
|
4
4
|
import { filterMap } from "./filterMap.js";
|
|
5
5
|
/**
|
|
6
|
-
* Emits
|
|
6
|
+
* Emits the source's terminal failure cause and discards every successful value.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* ## Why
|
|
10
|
+
*
|
|
11
|
+
* Failure telemetry and supervision often need the complete Effect `Cause`
|
|
12
|
+
* without treating that cause as another failure. Materializing only the
|
|
13
|
+
* failure side makes those pipelines ordinary, infallible Fx values.
|
|
14
|
+
*
|
|
15
|
+
* ## Ownership and lifetime
|
|
16
|
+
*
|
|
17
|
+
* The source is subscribed once. Success values are dropped in arrival order;
|
|
18
|
+
* a terminal cause is emitted once and the returned Fx completes without a
|
|
19
|
+
* typed error. Defects and interruption are retained inside the emitted cause.
|
|
20
|
+
* No resource is acquired beyond the source subscription.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { Cause } from "effect"
|
|
25
|
+
* import { causes } from "@typed/fx/Fx"
|
|
26
|
+
* import { failCause } from "@typed/fx/Fx"
|
|
27
|
+
*
|
|
28
|
+
* const failures = causes(failCause(Cause.fail("offline")))
|
|
29
|
+
* ```
|
|
7
30
|
*
|
|
8
31
|
* @param fx - The `Fx` stream.
|
|
9
32
|
* @returns An `Fx` emitting `Cause<E>`.
|