@typed/fx 1.31.0 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +344 -2
- package/dist/Fx/Fx.d.ts +96 -0
- package/dist/Fx/Fx.d.ts.map +1 -0
- package/dist/Fx/Fx.js +35 -0
- package/dist/Fx/TypeId.d.ts +20 -0
- package/dist/Fx/TypeId.d.ts.map +1 -0
- package/dist/Fx/TypeId.js +15 -0
- package/dist/Fx/combinators/catch.d.ts +53 -0
- package/dist/Fx/combinators/catch.d.ts.map +1 -0
- package/dist/Fx/combinators/catch.js +69 -0
- package/dist/Fx/combinators/causes.d.ts +12 -0
- package/dist/Fx/combinators/causes.d.ts.map +1 -0
- package/dist/Fx/combinators/causes.js +16 -0
- package/dist/Fx/combinators/compact.d.ts +12 -0
- package/dist/Fx/combinators/compact.d.ts.map +1 -0
- package/dist/Fx/combinators/compact.js +11 -0
- package/dist/Fx/combinators/continueWith.d.ts +51 -0
- package/dist/Fx/combinators/continueWith.d.ts.map +1 -0
- package/dist/Fx/combinators/continueWith.js +41 -0
- package/dist/Fx/combinators/ensuring.d.ts +16 -0
- package/dist/Fx/combinators/ensuring.d.ts.map +1 -0
- package/dist/Fx/combinators/ensuring.js +13 -0
- package/dist/Fx/combinators/exhaustLatestMap.d.ts +15 -0
- package/dist/Fx/combinators/exhaustLatestMap.d.ts.map +1 -0
- package/dist/Fx/combinators/exhaustLatestMap.js +48 -0
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts +13 -0
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/exhaustLatestMapEffect.js +14 -0
- package/dist/Fx/combinators/exhaustMap.d.ts +11 -0
- package/dist/Fx/combinators/exhaustMap.d.ts.map +1 -0
- package/dist/Fx/combinators/exhaustMap.js +19 -0
- package/dist/Fx/combinators/exhaustMapEffect.d.ts +11 -0
- package/dist/Fx/combinators/exhaustMapEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/exhaustMapEffect.js +12 -0
- package/dist/Fx/combinators/exit.d.ts +12 -0
- package/dist/Fx/combinators/exit.d.ts.map +1 -0
- package/dist/Fx/combinators/exit.js +11 -0
- package/dist/Fx/combinators/filter.d.ts +14 -0
- package/dist/Fx/combinators/filter.d.ts.map +1 -0
- package/dist/Fx/combinators/filter.js +12 -0
- package/dist/Fx/combinators/filterEffect.d.ts +15 -0
- package/dist/Fx/combinators/filterEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/filterEffect.js +12 -0
- package/dist/Fx/combinators/filterMap.d.ts +15 -0
- package/dist/Fx/combinators/filterMap.d.ts.map +1 -0
- package/dist/Fx/combinators/filterMap.js +12 -0
- package/dist/Fx/combinators/filterMapEffect.d.ts +16 -0
- package/dist/Fx/combinators/filterMapEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/filterMapEffect.js +12 -0
- package/dist/Fx/combinators/filterMapLoop.d.ts +17 -0
- package/dist/Fx/combinators/filterMapLoop.d.ts.map +1 -0
- package/dist/Fx/combinators/filterMapLoop.js +14 -0
- package/dist/Fx/combinators/filterMapLoopCause.d.ts +18 -0
- package/dist/Fx/combinators/filterMapLoopCause.d.ts.map +1 -0
- package/dist/Fx/combinators/filterMapLoopCause.js +14 -0
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts +18 -0
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/filterMapLoopCauseEffect.js +13 -0
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts +17 -0
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/filterMapLoopEffect.js +13 -0
- package/dist/Fx/combinators/flatMap.d.ts +23 -0
- package/dist/Fx/combinators/flatMap.d.ts.map +1 -0
- package/dist/Fx/combinators/flatMap.js +21 -0
- package/dist/Fx/combinators/flatMapConcurrently.d.ts +12 -0
- package/dist/Fx/combinators/flatMapConcurrently.d.ts.map +1 -0
- package/dist/Fx/combinators/flatMapConcurrently.js +22 -0
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts +12 -0
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.js +13 -0
- package/dist/Fx/combinators/flatMapEffect.d.ts +24 -0
- package/dist/Fx/combinators/flatMapEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/flatMapEffect.js +14 -0
- package/dist/Fx/combinators/flip.d.ts +11 -0
- package/dist/Fx/combinators/flip.d.ts.map +1 -0
- package/dist/Fx/combinators/flip.js +11 -0
- package/dist/Fx/combinators/gen.d.ts +20 -0
- package/dist/Fx/combinators/gen.d.ts.map +1 -0
- package/dist/Fx/combinators/gen.js +14 -0
- package/dist/Fx/combinators/genScoped.d.ts +20 -0
- package/dist/Fx/combinators/genScoped.d.ts.map +1 -0
- package/dist/Fx/combinators/genScoped.js +13 -0
- package/dist/Fx/combinators/index.d.ts +52 -0
- package/dist/Fx/combinators/index.d.ts.map +1 -0
- package/dist/Fx/combinators/index.js +51 -0
- package/dist/Fx/combinators/keyed.d.ts +44 -0
- package/dist/Fx/combinators/keyed.d.ts.map +1 -0
- package/dist/Fx/combinators/keyed.js +199 -0
- package/dist/Fx/combinators/loop.d.ts +16 -0
- package/dist/Fx/combinators/loop.d.ts.map +1 -0
- package/dist/Fx/combinators/loop.js +14 -0
- package/dist/Fx/combinators/loopCause.d.ts +16 -0
- package/dist/Fx/combinators/loopCause.d.ts.map +1 -0
- package/dist/Fx/combinators/loopCause.js +13 -0
- package/dist/Fx/combinators/loopCauseEffect.d.ts +17 -0
- package/dist/Fx/combinators/loopCauseEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/loopCauseEffect.js +13 -0
- package/dist/Fx/combinators/loopEffect.d.ts +16 -0
- package/dist/Fx/combinators/loopEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/loopEffect.js +13 -0
- package/dist/Fx/combinators/map.d.ts +14 -0
- package/dist/Fx/combinators/map.d.ts.map +1 -0
- package/dist/Fx/combinators/map.js +12 -0
- package/dist/Fx/combinators/mapEffect.d.ts +15 -0
- package/dist/Fx/combinators/mapEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/mapEffect.js +12 -0
- package/dist/Fx/combinators/mergeAll.d.ts +11 -0
- package/dist/Fx/combinators/mergeAll.d.ts.map +1 -0
- package/dist/Fx/combinators/mergeAll.js +15 -0
- package/dist/Fx/combinators/mergeOrdered.d.ts +14 -0
- package/dist/Fx/combinators/mergeOrdered.d.ts.map +1 -0
- package/dist/Fx/combinators/mergeOrdered.js +89 -0
- package/dist/Fx/combinators/onError.d.ts +17 -0
- package/dist/Fx/combinators/onError.d.ts.map +1 -0
- package/dist/Fx/combinators/onError.js +14 -0
- package/dist/Fx/combinators/onExit.d.ts +16 -0
- package/dist/Fx/combinators/onExit.d.ts.map +1 -0
- package/dist/Fx/combinators/onExit.js +39 -0
- package/dist/Fx/combinators/onInterrupt.d.ts +16 -0
- package/dist/Fx/combinators/onInterrupt.d.ts.map +1 -0
- package/dist/Fx/combinators/onInterrupt.js +38 -0
- package/dist/Fx/combinators/provide.d.ts +23 -0
- package/dist/Fx/combinators/provide.d.ts.map +1 -0
- package/dist/Fx/combinators/provide.js +27 -0
- package/dist/Fx/combinators/skip.d.ts +14 -0
- package/dist/Fx/combinators/skip.d.ts.map +1 -0
- package/dist/Fx/combinators/skip.js +11 -0
- package/dist/Fx/combinators/skipRepeats.d.ts +11 -0
- package/dist/Fx/combinators/skipRepeats.d.ts.map +1 -0
- package/dist/Fx/combinators/skipRepeats.js +12 -0
- package/dist/Fx/combinators/skipRepeatsWith.d.ts +12 -0
- package/dist/Fx/combinators/skipRepeatsWith.d.ts.map +1 -0
- package/dist/Fx/combinators/skipRepeatsWith.js +20 -0
- package/dist/Fx/combinators/slice.d.ts +23 -0
- package/dist/Fx/combinators/slice.d.ts.map +1 -0
- package/dist/Fx/combinators/slice.js +12 -0
- package/dist/Fx/combinators/switchMap.d.ts +13 -0
- package/dist/Fx/combinators/switchMap.d.ts.map +1 -0
- package/dist/Fx/combinators/switchMap.js +33 -0
- package/dist/Fx/combinators/switchMapEffect.d.ts +13 -0
- package/dist/Fx/combinators/switchMapEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/switchMapEffect.js +14 -0
- package/dist/Fx/combinators/take.d.ts +14 -0
- package/dist/Fx/combinators/take.d.ts.map +1 -0
- package/dist/Fx/combinators/take.js +11 -0
- package/dist/Fx/combinators/takeUntil.d.ts +28 -0
- package/dist/Fx/combinators/takeUntil.d.ts.map +1 -0
- package/dist/Fx/combinators/takeUntil.js +31 -0
- package/dist/Fx/combinators/tapEffect.d.ts +15 -0
- package/dist/Fx/combinators/tapEffect.d.ts.map +1 -0
- package/dist/Fx/combinators/tapEffect.js +18 -0
- package/dist/Fx/combinators/tuple.d.ts +27 -0
- package/dist/Fx/combinators/tuple.d.ts.map +1 -0
- package/dist/Fx/combinators/tuple.js +46 -0
- package/dist/Fx/combinators/unwrap.d.ts +12 -0
- package/dist/Fx/combinators/unwrap.d.ts.map +1 -0
- package/dist/Fx/combinators/unwrap.js +14 -0
- package/dist/Fx/combinators/unwrapScoped.d.ts +15 -0
- package/dist/Fx/combinators/unwrapScoped.d.ts.map +1 -0
- package/dist/Fx/combinators/unwrapScoped.js +16 -0
- package/dist/Fx/combinators/when.d.ts +36 -0
- package/dist/Fx/combinators/when.d.ts.map +1 -0
- package/dist/Fx/combinators/when.js +28 -0
- package/dist/Fx/combinators/withSpan.d.ts +4 -0
- package/dist/Fx/combinators/withSpan.d.ts.map +1 -0
- package/dist/Fx/combinators/withSpan.js +6 -0
- package/dist/Fx/constructors/at.d.ts +16 -0
- package/dist/Fx/constructors/at.d.ts.map +1 -0
- package/dist/Fx/constructors/at.js +13 -0
- package/dist/Fx/constructors/die.d.ts +11 -0
- package/dist/Fx/constructors/die.d.ts.map +1 -0
- package/dist/Fx/constructors/die.js +12 -0
- package/dist/Fx/constructors/empty.d.ts +8 -0
- package/dist/Fx/constructors/empty.d.ts.map +1 -0
- package/dist/Fx/constructors/empty.js +8 -0
- package/dist/Fx/constructors/fail.d.ts +11 -0
- package/dist/Fx/constructors/fail.d.ts.map +1 -0
- package/dist/Fx/constructors/fail.js +12 -0
- package/dist/Fx/constructors/failCause.d.ts +12 -0
- package/dist/Fx/constructors/failCause.d.ts.map +1 -0
- package/dist/Fx/constructors/failCause.js +11 -0
- package/dist/Fx/constructors/fn.d.ts +47 -0
- package/dist/Fx/constructors/fn.d.ts.map +1 -0
- package/dist/Fx/constructors/fn.js +23 -0
- package/dist/Fx/constructors/fromEffect.d.ts +21 -0
- package/dist/Fx/constructors/fromEffect.d.ts.map +1 -0
- package/dist/Fx/constructors/fromEffect.js +21 -0
- package/dist/Fx/constructors/fromFailures.d.ts +10 -0
- package/dist/Fx/constructors/fromFailures.d.ts.map +1 -0
- package/dist/Fx/constructors/fromFailures.js +13 -0
- package/dist/Fx/constructors/fromIterable.d.ts +12 -0
- package/dist/Fx/constructors/fromIterable.d.ts.map +1 -0
- package/dist/Fx/constructors/fromIterable.js +12 -0
- package/dist/Fx/constructors/fromSchedule.d.ts +13 -0
- package/dist/Fx/constructors/fromSchedule.d.ts.map +1 -0
- package/dist/Fx/constructors/fromSchedule.js +13 -0
- package/dist/Fx/constructors/fromYieldable.d.ts +12 -0
- package/dist/Fx/constructors/fromYieldable.d.ts.map +1 -0
- package/dist/Fx/constructors/fromYieldable.js +12 -0
- package/dist/Fx/constructors/index.d.ts +16 -0
- package/dist/Fx/constructors/index.d.ts.map +1 -0
- package/dist/Fx/constructors/index.js +15 -0
- package/dist/Fx/constructors/interrupt.d.ts +10 -0
- package/dist/Fx/constructors/interrupt.d.ts.map +1 -0
- package/dist/Fx/constructors/interrupt.js +12 -0
- package/dist/Fx/constructors/make.d.ts +40 -0
- package/dist/Fx/constructors/make.d.ts.map +1 -0
- package/dist/Fx/constructors/make.js +61 -0
- package/dist/Fx/constructors/periodic.d.ts +12 -0
- package/dist/Fx/constructors/periodic.d.ts.map +1 -0
- package/dist/Fx/constructors/periodic.js +12 -0
- package/dist/Fx/constructors/succeed.d.ts +32 -0
- package/dist/Fx/constructors/succeed.d.ts.map +1 -0
- package/dist/Fx/constructors/succeed.js +32 -0
- package/dist/Fx/constructors/suspend.d.ts +3 -0
- package/dist/Fx/constructors/suspend.d.ts.map +1 -0
- package/dist/Fx/constructors/suspend.js +3 -0
- package/dist/Fx/index.d.ts +7 -0
- package/dist/Fx/index.d.ts.map +1 -0
- package/dist/Fx/index.js +6 -0
- package/dist/Fx/internal/DeferredRef.d.ts +29 -0
- package/dist/Fx/internal/DeferredRef.d.ts.map +1 -0
- package/dist/{esm → Fx}/internal/DeferredRef.js +21 -15
- package/dist/Fx/internal/UnionToTuple.d.ts.map +1 -0
- package/dist/Fx/internal/UnionToTuple.js +1 -0
- package/dist/{dts → Fx}/internal/diff.d.ts +3 -1
- package/dist/Fx/internal/diff.d.ts.map +1 -0
- package/dist/{esm → Fx}/internal/diff.js +37 -23
- package/dist/Fx/internal/equivalence.d.ts +4 -0
- package/dist/Fx/internal/equivalence.d.ts.map +1 -0
- package/dist/Fx/internal/equivalence.js +10 -0
- package/dist/Fx/internal/multicast.d.ts +10 -0
- package/dist/Fx/internal/multicast.d.ts.map +1 -0
- package/dist/Fx/internal/multicast.js +32 -0
- package/dist/Fx/internal/ring-buffer.d.ts +14 -0
- package/dist/Fx/internal/ring-buffer.d.ts.map +1 -0
- package/dist/Fx/internal/ring-buffer.js +52 -0
- package/dist/Fx/internal/scope.d.ts +11 -0
- package/dist/Fx/internal/scope.d.ts.map +1 -0
- package/dist/Fx/internal/scope.js +12 -0
- package/dist/Fx/internal/yieldable.d.ts +17 -0
- package/dist/Fx/internal/yieldable.d.ts.map +1 -0
- package/dist/Fx/internal/yieldable.js +20 -0
- package/dist/Fx/run/collect.d.ts +45 -0
- package/dist/Fx/run/collect.d.ts.map +1 -0
- package/dist/Fx/run/collect.js +51 -0
- package/dist/Fx/run/first.d.ts +14 -0
- package/dist/Fx/run/first.d.ts.map +1 -0
- package/dist/Fx/run/first.js +16 -0
- package/dist/Fx/run/fork.d.ts +29 -0
- package/dist/Fx/run/fork.d.ts.map +1 -0
- package/dist/Fx/run/fork.js +27 -0
- package/dist/Fx/run/index.d.ts +6 -0
- package/dist/Fx/run/index.d.ts.map +1 -0
- package/dist/Fx/run/index.js +5 -0
- package/dist/Fx/run/observe.d.ts +53 -0
- package/dist/Fx/run/observe.d.ts.map +1 -0
- package/dist/Fx/run/observe.js +55 -0
- package/dist/Fx/run/runPromise.d.ts +25 -0
- package/dist/Fx/run/runPromise.d.ts.map +1 -0
- package/dist/Fx/run/runPromise.js +23 -0
- package/dist/Fx/stream.d.ts +7 -0
- package/dist/Fx/stream.d.ts.map +1 -0
- package/dist/Fx/stream.js +7 -0
- package/dist/Fx.d.ts +2 -0
- package/dist/Fx.d.ts.map +1 -0
- package/dist/Fx.js +1 -0
- package/dist/Push/Push.d.ts +312 -0
- package/dist/Push/Push.d.ts.map +1 -0
- package/dist/Push/Push.js +289 -0
- package/dist/Push/index.d.ts +2 -0
- package/dist/Push/index.d.ts.map +1 -0
- package/dist/Push/index.js +1 -0
- package/dist/Push.d.ts +2 -0
- package/dist/Push.d.ts.map +1 -0
- package/dist/Push.js +1 -0
- package/dist/{dts → RefSubject}/RefArray.d.ts +68 -18
- package/dist/RefSubject/RefArray.d.ts.map +1 -0
- package/dist/{esm → RefSubject}/RefArray.js +80 -12
- package/dist/RefSubject/RefBigDecimal.d.ts +183 -0
- package/dist/RefSubject/RefBigDecimal.d.ts.map +1 -0
- package/dist/RefSubject/RefBigDecimal.js +161 -0
- package/dist/RefSubject/RefBigInt.d.ts +138 -0
- package/dist/RefSubject/RefBigInt.d.ts.map +1 -0
- package/dist/RefSubject/RefBigInt.js +126 -0
- package/dist/RefSubject/RefBoolean.d.ts +135 -0
- package/dist/RefSubject/RefBoolean.d.ts.map +1 -0
- package/dist/RefSubject/RefBoolean.js +124 -0
- package/dist/RefSubject/RefCause.d.ts +100 -0
- package/dist/RefSubject/RefCause.d.ts.map +1 -0
- package/dist/RefSubject/RefCause.js +93 -0
- package/dist/{dts → RefSubject}/RefChunk.d.ts +157 -71
- package/dist/RefSubject/RefChunk.d.ts.map +1 -0
- package/dist/{esm → RefSubject}/RefChunk.js +142 -52
- package/dist/RefSubject/RefDateTime.d.ts +155 -0
- package/dist/RefSubject/RefDateTime.d.ts.map +1 -0
- package/dist/RefSubject/RefDateTime.js +101 -0
- package/dist/RefSubject/RefDuration.d.ts +126 -0
- package/dist/RefSubject/RefDuration.d.ts.map +1 -0
- package/dist/RefSubject/RefDuration.js +115 -0
- package/dist/RefSubject/RefGraph.d.ts +239 -0
- package/dist/RefSubject/RefGraph.d.ts.map +1 -0
- package/dist/RefSubject/RefGraph.js +272 -0
- package/dist/RefSubject/RefHashMap.d.ts +228 -0
- package/dist/RefSubject/RefHashMap.d.ts.map +1 -0
- package/dist/RefSubject/RefHashMap.js +212 -0
- package/dist/RefSubject/RefHashRing.d.ts +123 -0
- package/dist/RefSubject/RefHashRing.d.ts.map +1 -0
- package/dist/RefSubject/RefHashRing.js +115 -0
- package/dist/RefSubject/RefHashSet.d.ts +179 -0
- package/dist/RefSubject/RefHashSet.d.ts.map +1 -0
- package/dist/RefSubject/RefHashSet.js +164 -0
- package/dist/RefSubject/RefIterable.d.ts +257 -0
- package/dist/RefSubject/RefIterable.d.ts.map +1 -0
- package/dist/RefSubject/RefIterable.js +237 -0
- package/dist/RefSubject/RefOption.d.ts +124 -0
- package/dist/RefSubject/RefOption.d.ts.map +1 -0
- package/dist/RefSubject/RefOption.js +115 -0
- package/dist/RefSubject/RefRecord.d.ts +264 -0
- package/dist/RefSubject/RefRecord.d.ts.map +1 -0
- package/dist/RefSubject/RefRecord.js +249 -0
- package/dist/RefSubject/RefResult.d.ts +121 -0
- package/dist/RefSubject/RefResult.d.ts.map +1 -0
- package/dist/RefSubject/RefResult.js +107 -0
- package/dist/RefSubject/RefString.d.ts +147 -0
- package/dist/RefSubject/RefString.d.ts.map +1 -0
- package/dist/RefSubject/RefString.js +137 -0
- package/dist/RefSubject/RefStruct.d.ts +123 -0
- package/dist/RefSubject/RefStruct.d.ts.map +1 -0
- package/dist/RefSubject/RefStruct.js +113 -0
- package/dist/RefSubject/RefSubject.d.ts +1010 -0
- package/dist/RefSubject/RefSubject.d.ts.map +1 -0
- package/dist/RefSubject/RefSubject.js +1310 -0
- package/dist/RefSubject/RefTrie.d.ts +216 -0
- package/dist/RefSubject/RefTrie.d.ts.map +1 -0
- package/dist/RefSubject/RefTrie.js +201 -0
- package/dist/RefSubject/RefTuple.d.ts +107 -0
- package/dist/RefSubject/RefTuple.d.ts.map +1 -0
- package/dist/RefSubject/RefTuple.js +94 -0
- package/dist/RefSubject/index.d.ts +22 -0
- package/dist/RefSubject/index.d.ts.map +1 -0
- package/dist/RefSubject/index.js +21 -0
- package/dist/RefSubject.d.ts +2 -0
- package/dist/RefSubject.d.ts.map +1 -0
- package/dist/RefSubject.js +1 -0
- package/dist/Sink/Sink.d.ts +94 -0
- package/dist/Sink/Sink.d.ts.map +1 -0
- package/dist/Sink/Sink.js +34 -0
- package/dist/Sink/combinators.d.ts +171 -0
- package/dist/Sink/combinators.d.ts.map +1 -0
- package/dist/{esm/Sink.js → Sink/combinators.js} +265 -352
- package/dist/Sink/index.d.ts +3 -0
- package/dist/Sink/index.d.ts.map +1 -0
- package/dist/Sink/index.js +2 -0
- package/dist/Sink.d.ts +2 -0
- package/dist/Sink.d.ts.map +1 -0
- package/dist/Sink.js +1 -0
- package/dist/Subject/Subject.d.ts +152 -0
- package/dist/Subject/Subject.d.ts.map +1 -0
- package/dist/Subject/Subject.js +272 -0
- package/dist/Subject/index.d.ts +2 -0
- package/dist/Subject/index.d.ts.map +1 -0
- package/dist/Subject/index.js +1 -0
- package/dist/Subject.d.ts +2 -0
- package/dist/Subject.d.ts.map +1 -0
- package/dist/Subject.js +1 -0
- package/dist/Versioned/Versioned.d.ts +176 -0
- package/dist/Versioned/Versioned.d.ts.map +1 -0
- package/dist/Versioned/Versioned.js +228 -0
- package/dist/Versioned/index.d.ts +2 -0
- package/dist/Versioned/index.d.ts.map +1 -0
- package/dist/Versioned/index.js +1 -0
- package/dist/Versioned.d.ts +2 -0
- package/dist/Versioned.d.ts.map +1 -0
- package/dist/Versioned.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/package.json +19 -191
- package/src/Fx/Fx.ts +164 -0
- package/src/Fx/TypeId.ts +25 -0
- package/src/Fx/combinators/catch.ts +165 -0
- package/src/Fx/combinators/causes.ts +23 -0
- package/src/Fx/combinators/compact.ts +15 -0
- package/src/Fx/combinators/continueWith.ts +78 -0
- package/src/Fx/combinators/ensuring.ts +23 -0
- package/src/Fx/combinators/exhaustLatestMap.ts +74 -0
- package/src/Fx/combinators/exhaustLatestMapEffect.ts +25 -0
- package/src/Fx/combinators/exhaustMap.ts +36 -0
- package/src/Fx/combinators/exhaustMapEffect.ts +23 -0
- package/src/Fx/combinators/exit.ts +15 -0
- package/src/Fx/combinators/filter.ts +22 -0
- package/src/Fx/combinators/filterEffect.ts +31 -0
- package/src/Fx/combinators/filterMap.ts +23 -0
- package/src/Fx/combinators/filterMapEffect.ts +32 -0
- package/src/Fx/combinators/filterMapLoop.ts +35 -0
- package/src/Fx/combinators/filterMapLoopCause.ts +36 -0
- package/src/Fx/combinators/filterMapLoopCauseEffect.ts +46 -0
- package/src/Fx/combinators/filterMapLoopEffect.ts +36 -0
- package/src/Fx/combinators/flatMap.ts +51 -0
- package/src/Fx/combinators/flatMapConcurrently.ts +36 -0
- package/src/Fx/combinators/flatMapConcurrentlyEffect.ts +26 -0
- package/src/Fx/combinators/flatMapEffect.ts +42 -0
- package/src/Fx/combinators/flip.ts +14 -0
- package/src/Fx/combinators/gen.ts +24 -0
- package/src/Fx/combinators/genScoped.ts +24 -0
- package/src/Fx/combinators/index.ts +51 -0
- package/src/Fx/combinators/keyed.ts +369 -0
- package/src/Fx/combinators/loop.ts +27 -0
- package/src/Fx/combinators/loopCause.ts +34 -0
- package/src/Fx/combinators/loopCauseEffect.ts +36 -0
- package/src/Fx/combinators/loopEffect.ts +34 -0
- package/src/Fx/combinators/map.ts +22 -0
- package/src/Fx/combinators/mapEffect.ts +32 -0
- package/src/Fx/combinators/mergeAll.ts +22 -0
- package/src/Fx/combinators/mergeOrdered.ts +123 -0
- package/src/Fx/combinators/onError.ts +40 -0
- package/src/Fx/combinators/onExit.ts +82 -0
- package/src/Fx/combinators/onInterrupt.ts +87 -0
- package/src/Fx/combinators/provide.ts +62 -0
- package/src/Fx/combinators/skip.ts +20 -0
- package/src/Fx/combinators/skipRepeats.ts +15 -0
- package/src/Fx/combinators/skipRepeatsWith.ts +40 -0
- package/src/Fx/combinators/slice.ts +32 -0
- package/src/Fx/combinators/switchMap.ts +55 -0
- package/src/Fx/combinators/switchMapEffect.ts +25 -0
- package/src/Fx/combinators/take.ts +17 -0
- package/src/Fx/combinators/takeUntil.ts +50 -0
- package/src/Fx/combinators/tapEffect.ts +39 -0
- package/src/Fx/combinators/tuple.ts +79 -0
- package/src/Fx/combinators/unwrap.ts +21 -0
- package/src/Fx/combinators/unwrapScoped.ts +26 -0
- package/src/Fx/combinators/when.ts +64 -0
- package/src/Fx/combinators/withSpan.ts +24 -0
- package/src/Fx/constructors/at.ts +23 -0
- package/src/Fx/constructors/die.ts +17 -0
- package/src/Fx/constructors/empty.ts +10 -0
- package/src/Fx/constructors/fail.ts +14 -0
- package/src/Fx/constructors/failCause.ts +14 -0
- package/src/Fx/constructors/fn.ts +245 -0
- package/src/Fx/constructors/fromEffect.ts +24 -0
- package/src/Fx/constructors/fromFailures.ts +19 -0
- package/src/Fx/constructors/fromIterable.ts +15 -0
- package/src/Fx/constructors/fromSchedule.ts +18 -0
- package/src/Fx/constructors/fromYieldable.ts +17 -0
- package/src/Fx/constructors/index.ts +15 -0
- package/src/Fx/constructors/interrupt.ts +13 -0
- package/src/Fx/constructors/make.ts +103 -0
- package/src/Fx/constructors/periodic.ts +15 -0
- package/src/Fx/constructors/succeed.ts +37 -0
- package/src/Fx/constructors/suspend.ts +6 -0
- package/src/Fx/index.ts +6 -0
- package/src/Fx/internal/DeferredRef.ts +87 -0
- package/src/Fx/internal/UnionToTuple.ts +12 -0
- package/src/Fx/internal/diff.ts +191 -0
- package/src/Fx/internal/equivalence.ts +12 -0
- package/src/Fx/internal/multicast.ts +51 -0
- package/src/Fx/internal/ring-buffer.ts +60 -0
- package/src/Fx/internal/scope.ts +58 -0
- package/src/Fx/internal/yieldable.ts +31 -0
- package/src/Fx/run/collect.ts +79 -0
- package/src/Fx/run/first.ts +20 -0
- package/src/Fx/run/fork.ts +40 -0
- package/src/Fx/run/index.ts +5 -0
- package/src/Fx/run/observe.ts +114 -0
- package/src/Fx/run/runPromise.ts +32 -0
- package/src/Fx/stream.ts +42 -0
- package/src/Fx.catch.test.ts +61 -0
- package/src/Fx.fn.test.ts +51 -0
- package/src/Fx.lifecycle.test.ts +80 -0
- package/src/Fx.test.ts +71 -0
- package/src/Fx.ts +1 -2591
- package/src/Push/Push.ts +903 -0
- package/src/Push/index.ts +1 -0
- package/src/Push.test.ts +26 -0
- package/src/Push.ts +1 -480
- package/src/{RefArray.ts → RefSubject/RefArray.ts} +246 -248
- package/src/RefSubject/RefBigDecimal.test.ts +56 -0
- package/src/RefSubject/RefBigDecimal.ts +295 -0
- package/src/RefSubject/RefBigInt.test.ts +56 -0
- package/src/RefSubject/RefBigInt.ts +189 -0
- package/src/RefSubject/RefBoolean.test.ts +57 -0
- package/src/RefSubject/RefBoolean.ts +185 -0
- package/src/RefSubject/RefCause.test.ts +53 -0
- package/src/RefSubject/RefCause.ts +146 -0
- package/src/RefSubject/RefChunk.ts +510 -0
- package/src/RefSubject/RefDateTime.test.ts +43 -0
- package/src/RefSubject/RefDateTime.ts +264 -0
- package/src/RefSubject/RefDuration.test.ts +49 -0
- package/src/RefSubject/RefDuration.ts +188 -0
- package/src/RefSubject/RefGraph.ts +650 -0
- package/src/RefSubject/RefHashMap.ts +465 -0
- package/src/RefSubject/RefHashRing.ts +262 -0
- package/src/RefSubject/RefHashSet.ts +308 -0
- package/src/RefSubject/RefIterable.ts +445 -0
- package/src/RefSubject/RefOption.test.ts +67 -0
- package/src/RefSubject/RefOption.ts +193 -0
- package/src/RefSubject/RefRecord.ts +612 -0
- package/src/RefSubject/RefResult.test.ts +63 -0
- package/src/RefSubject/RefResult.ts +209 -0
- package/src/RefSubject/RefString.test.ts +61 -0
- package/src/RefSubject/RefString.ts +256 -0
- package/src/RefSubject/RefStruct.test.ts +60 -0
- package/src/RefSubject/RefStruct.ts +253 -0
- package/src/RefSubject/RefSubject.ts +2545 -0
- package/src/RefSubject/RefTrie.ts +356 -0
- package/src/RefSubject/RefTuple.test.ts +60 -0
- package/src/RefSubject/RefTuple.ts +231 -0
- package/src/RefSubject/index.ts +21 -0
- package/src/RefSubject.test.ts +65 -0
- package/src/RefSubject.ts +1 -2488
- package/src/Sink/Sink.ts +159 -0
- package/src/Sink/combinators.ts +993 -0
- package/src/Sink/index.ts +2 -0
- package/src/Sink.ts +1 -1044
- package/src/Subject/Subject.ts +441 -0
- package/src/Subject/index.ts +1 -0
- package/src/Subject.test.ts +47 -0
- package/src/Subject.ts +1 -330
- package/src/Versioned/Versioned.ts +521 -0
- package/src/Versioned/index.ts +1 -0
- package/src/Versioned.test.ts +23 -0
- package/src/Versioned.ts +1 -357
- package/src/index.ts +7 -130
- package/tsconfig.json +6 -0
- package/AsyncData/package.json +0 -6
- package/Emitter/package.json +0 -6
- package/Form/package.json +0 -6
- package/FormEntry/package.json +0 -6
- package/Fx/package.json +0 -6
- package/Idle/package.json +0 -6
- package/LICENSE +0 -21
- package/Match/package.json +0 -6
- package/Pull/package.json +0 -6
- package/Push/package.json +0 -6
- package/RefArray/package.json +0 -6
- package/RefChunk/package.json +0 -6
- package/RefHashMap/package.json +0 -6
- package/RefHashSet/package.json +0 -6
- package/RefSubject/package.json +0 -6
- package/Sink/package.json +0 -6
- package/Stream/package.json +0 -6
- package/Subject/package.json +0 -6
- package/TypeId/package.json +0 -6
- package/Typeclass/package.json +0 -6
- package/Versioned/package.json +0 -6
- package/dist/cjs/AsyncData.js +0 -188
- package/dist/cjs/AsyncData.js.map +0 -1
- package/dist/cjs/Emitter.js +0 -44
- package/dist/cjs/Emitter.js.map +0 -1
- package/dist/cjs/Form.js +0 -178
- package/dist/cjs/Form.js.map +0 -1
- package/dist/cjs/FormEntry.js +0 -110
- package/dist/cjs/FormEntry.js.map +0 -1
- package/dist/cjs/Fx.js +0 -998
- package/dist/cjs/Fx.js.map +0 -1
- package/dist/cjs/Idle.js +0 -190
- package/dist/cjs/Idle.js.map +0 -1
- package/dist/cjs/Match.js +0 -191
- package/dist/cjs/Match.js.map +0 -1
- package/dist/cjs/Pull.js +0 -52
- package/dist/cjs/Pull.js.map +0 -1
- package/dist/cjs/Push.js +0 -168
- package/dist/cjs/Push.js.map +0 -1
- package/dist/cjs/RefArray.js +0 -253
- package/dist/cjs/RefArray.js.map +0 -1
- package/dist/cjs/RefChunk.js +0 -212
- package/dist/cjs/RefChunk.js.map +0 -1
- package/dist/cjs/RefHashMap.js +0 -198
- package/dist/cjs/RefHashMap.js.map +0 -1
- package/dist/cjs/RefHashSet.js +0 -99
- package/dist/cjs/RefHashSet.js.map +0 -1
- package/dist/cjs/RefSubject.js +0 -1115
- package/dist/cjs/RefSubject.js.map +0 -1
- package/dist/cjs/Sink.js +0 -662
- package/dist/cjs/Sink.js.map +0 -1
- package/dist/cjs/Stream.js +0 -87
- package/dist/cjs/Stream.js.map +0 -1
- package/dist/cjs/Subject.js +0 -205
- package/dist/cjs/Subject.js.map +0 -1
- package/dist/cjs/TypeId.js +0 -32
- package/dist/cjs/TypeId.js.map +0 -1
- package/dist/cjs/Typeclass.js +0 -380
- package/dist/cjs/Typeclass.js.map +0 -1
- package/dist/cjs/Versioned.js +0 -172
- package/dist/cjs/Versioned.js.map +0 -1
- package/dist/cjs/index.js +0 -89
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/internal/DeferredRef.js +0 -67
- package/dist/cjs/internal/DeferredRef.js.map +0 -1
- package/dist/cjs/internal/UnionToTuple.js +0 -6
- package/dist/cjs/internal/UnionToTuple.js.map +0 -1
- package/dist/cjs/internal/bounds.js +0 -26
- package/dist/cjs/internal/bounds.js.map +0 -1
- package/dist/cjs/internal/core.js +0 -1774
- package/dist/cjs/internal/core.js.map +0 -1
- package/dist/cjs/internal/diff.js +0 -122
- package/dist/cjs/internal/diff.js.map +0 -1
- package/dist/cjs/internal/effect-loop-operator.js +0 -288
- package/dist/cjs/internal/effect-loop-operator.js.map +0 -1
- package/dist/cjs/internal/effect-operator.js +0 -156
- package/dist/cjs/internal/effect-operator.js.map +0 -1
- package/dist/cjs/internal/effect-producer.js +0 -74
- package/dist/cjs/internal/effect-producer.js.map +0 -1
- package/dist/cjs/internal/helpers.js +0 -317
- package/dist/cjs/internal/helpers.js.map +0 -1
- package/dist/cjs/internal/keyed.js +0 -168
- package/dist/cjs/internal/keyed.js.map +0 -1
- package/dist/cjs/internal/loop-operator.js +0 -213
- package/dist/cjs/internal/loop-operator.js.map +0 -1
- package/dist/cjs/internal/operator.js +0 -79
- package/dist/cjs/internal/operator.js.map +0 -1
- package/dist/cjs/internal/protos.js +0 -48
- package/dist/cjs/internal/protos.js.map +0 -1
- package/dist/cjs/internal/provide.js +0 -100
- package/dist/cjs/internal/provide.js.map +0 -1
- package/dist/cjs/internal/requestIdleCallback.js +0 -22
- package/dist/cjs/internal/requestIdleCallback.js.map +0 -1
- package/dist/cjs/internal/share.js +0 -74
- package/dist/cjs/internal/share.js.map +0 -1
- package/dist/cjs/internal/strategies.js +0 -34
- package/dist/cjs/internal/strategies.js.map +0 -1
- package/dist/cjs/internal/sync-operator.js +0 -120
- package/dist/cjs/internal/sync-operator.js.map +0 -1
- package/dist/cjs/internal/sync-producer.js +0 -118
- package/dist/cjs/internal/sync-producer.js.map +0 -1
- package/dist/cjs/internal/withKey.js +0 -63
- package/dist/cjs/internal/withKey.js.map +0 -1
- package/dist/dts/AsyncData.d.ts +0 -179
- package/dist/dts/AsyncData.d.ts.map +0 -1
- package/dist/dts/Emitter.d.ts +0 -24
- package/dist/dts/Emitter.d.ts.map +0 -1
- package/dist/dts/Form.d.ts +0 -145
- package/dist/dts/Form.d.ts.map +0 -1
- package/dist/dts/FormEntry.d.ts +0 -65
- package/dist/dts/FormEntry.d.ts.map +0 -1
- package/dist/dts/Fx.d.ts +0 -1678
- package/dist/dts/Fx.d.ts.map +0 -1
- package/dist/dts/Idle.d.ts +0 -84
- package/dist/dts/Idle.d.ts.map +0 -1
- package/dist/dts/Match.d.ts +0 -60
- package/dist/dts/Match.d.ts.map +0 -1
- package/dist/dts/Pull.d.ts +0 -37
- package/dist/dts/Pull.d.ts.map +0 -1
- package/dist/dts/Push.d.ts +0 -176
- package/dist/dts/Push.d.ts.map +0 -1
- package/dist/dts/RefArray.d.ts.map +0 -1
- package/dist/dts/RefChunk.d.ts.map +0 -1
- package/dist/dts/RefHashMap.d.ts +0 -189
- package/dist/dts/RefHashMap.d.ts.map +0 -1
- package/dist/dts/RefHashSet.d.ts +0 -100
- package/dist/dts/RefHashSet.d.ts.map +0 -1
- package/dist/dts/RefSubject.d.ts +0 -601
- package/dist/dts/RefSubject.d.ts.map +0 -1
- package/dist/dts/Sink.d.ts +0 -252
- package/dist/dts/Sink.d.ts.map +0 -1
- package/dist/dts/Stream.d.ts +0 -66
- package/dist/dts/Stream.d.ts.map +0 -1
- package/dist/dts/Subject.d.ts +0 -61
- package/dist/dts/Subject.d.ts.map +0 -1
- package/dist/dts/TypeId.d.ts +0 -51
- package/dist/dts/TypeId.d.ts.map +0 -1
- package/dist/dts/Typeclass.d.ts +0 -284
- package/dist/dts/Typeclass.d.ts.map +0 -1
- package/dist/dts/Versioned.d.ts +0 -117
- package/dist/dts/Versioned.d.ts.map +0 -1
- package/dist/dts/index.d.ts +0 -111
- package/dist/dts/index.d.ts.map +0 -1
- package/dist/dts/internal/DeferredRef.d.ts +0 -22
- package/dist/dts/internal/DeferredRef.d.ts.map +0 -1
- package/dist/dts/internal/UnionToTuple.d.ts.map +0 -1
- package/dist/dts/internal/bounds.d.ts +0 -9
- package/dist/dts/internal/bounds.d.ts.map +0 -1
- package/dist/dts/internal/core.d.ts +0 -237
- package/dist/dts/internal/core.d.ts.map +0 -1
- package/dist/dts/internal/diff.d.ts.map +0 -1
- package/dist/dts/internal/effect-loop-operator.d.ts +0 -34
- package/dist/dts/internal/effect-loop-operator.d.ts.map +0 -1
- package/dist/dts/internal/effect-operator.d.ts +0 -40
- package/dist/dts/internal/effect-operator.d.ts.map +0 -1
- package/dist/dts/internal/effect-producer.d.ts +0 -25
- package/dist/dts/internal/effect-producer.d.ts.map +0 -1
- package/dist/dts/internal/helpers.d.ts +0 -60
- package/dist/dts/internal/helpers.d.ts.map +0 -1
- package/dist/dts/internal/keyed.d.ts +0 -4
- package/dist/dts/internal/keyed.d.ts.map +0 -1
- package/dist/dts/internal/loop-operator.d.ts +0 -40
- package/dist/dts/internal/loop-operator.d.ts.map +0 -1
- package/dist/dts/internal/operator.d.ts +0 -16
- package/dist/dts/internal/operator.d.ts.map +0 -1
- package/dist/dts/internal/protos.d.ts +0 -23
- package/dist/dts/internal/protos.d.ts.map +0 -1
- package/dist/dts/internal/provide.d.ts +0 -46
- package/dist/dts/internal/provide.d.ts.map +0 -1
- package/dist/dts/internal/requestIdleCallback.d.ts +0 -3
- package/dist/dts/internal/requestIdleCallback.d.ts.map +0 -1
- package/dist/dts/internal/share.d.ts +0 -33
- package/dist/dts/internal/share.d.ts.map +0 -1
- package/dist/dts/internal/strategies.d.ts +0 -9
- package/dist/dts/internal/strategies.d.ts.map +0 -1
- package/dist/dts/internal/sync-operator.d.ts +0 -32
- package/dist/dts/internal/sync-operator.d.ts.map +0 -1
- package/dist/dts/internal/sync-producer.d.ts +0 -36
- package/dist/dts/internal/sync-producer.d.ts.map +0 -1
- package/dist/dts/internal/withKey.d.ts +0 -4
- package/dist/dts/internal/withKey.d.ts.map +0 -1
- package/dist/esm/AsyncData.js +0 -156
- package/dist/esm/AsyncData.js.map +0 -1
- package/dist/esm/Emitter.js +0 -33
- package/dist/esm/Emitter.js.map +0 -1
- package/dist/esm/Form.js +0 -163
- package/dist/esm/Form.js.map +0 -1
- package/dist/esm/FormEntry.js +0 -100
- package/dist/esm/FormEntry.js.map +0 -1
- package/dist/esm/Fx.js +0 -984
- package/dist/esm/Fx.js.map +0 -1
- package/dist/esm/Idle.js +0 -178
- package/dist/esm/Idle.js.map +0 -1
- package/dist/esm/Match.js +0 -185
- package/dist/esm/Match.js.map +0 -1
- package/dist/esm/Pull.js +0 -41
- package/dist/esm/Pull.js.map +0 -1
- package/dist/esm/Push.js +0 -159
- package/dist/esm/Push.js.map +0 -1
- package/dist/esm/RefArray.js.map +0 -1
- package/dist/esm/RefChunk.js.map +0 -1
- package/dist/esm/RefHashMap.js +0 -176
- package/dist/esm/RefHashMap.js.map +0 -1
- package/dist/esm/RefHashSet.js +0 -86
- package/dist/esm/RefHashSet.js.map +0 -1
- package/dist/esm/RefSubject.js +0 -1076
- package/dist/esm/RefSubject.js.map +0 -1
- package/dist/esm/Sink.js.map +0 -1
- package/dist/esm/Stream.js +0 -76
- package/dist/esm/Stream.js.map +0 -1
- package/dist/esm/Subject.js +0 -198
- package/dist/esm/Subject.js.map +0 -1
- package/dist/esm/TypeId.js +0 -26
- package/dist/esm/TypeId.js.map +0 -1
- package/dist/esm/Typeclass.js +0 -375
- package/dist/esm/Typeclass.js.map +0 -1
- package/dist/esm/Versioned.js +0 -149
- package/dist/esm/Versioned.js.map +0 -1
- package/dist/esm/index.js +0 -111
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/internal/DeferredRef.js.map +0 -1
- package/dist/esm/internal/UnionToTuple.js +0 -2
- package/dist/esm/internal/UnionToTuple.js.map +0 -1
- package/dist/esm/internal/bounds.js +0 -13
- package/dist/esm/internal/bounds.js.map +0 -1
- package/dist/esm/internal/core.js +0 -1606
- package/dist/esm/internal/core.js.map +0 -1
- package/dist/esm/internal/diff.js.map +0 -1
- package/dist/esm/internal/effect-loop-operator.js +0 -269
- package/dist/esm/internal/effect-loop-operator.js.map +0 -1
- package/dist/esm/internal/effect-operator.js +0 -134
- package/dist/esm/internal/effect-operator.js.map +0 -1
- package/dist/esm/internal/effect-producer.js +0 -47
- package/dist/esm/internal/effect-producer.js.map +0 -1
- package/dist/esm/internal/helpers.js +0 -299
- package/dist/esm/internal/helpers.js.map +0 -1
- package/dist/esm/internal/keyed.js +0 -153
- package/dist/esm/internal/keyed.js.map +0 -1
- package/dist/esm/internal/loop-operator.js +0 -186
- package/dist/esm/internal/loop-operator.js.map +0 -1
- package/dist/esm/internal/operator.js +0 -68
- package/dist/esm/internal/operator.js.map +0 -1
- package/dist/esm/internal/protos.js +0 -39
- package/dist/esm/internal/protos.js.map +0 -1
- package/dist/esm/internal/provide.js +0 -72
- package/dist/esm/internal/provide.js.map +0 -1
- package/dist/esm/internal/requestIdleCallback.js +0 -16
- package/dist/esm/internal/requestIdleCallback.js.map +0 -1
- package/dist/esm/internal/share.js +0 -62
- package/dist/esm/internal/share.js.map +0 -1
- package/dist/esm/internal/strategies.js +0 -8
- package/dist/esm/internal/strategies.js.map +0 -1
- package/dist/esm/internal/sync-operator.js +0 -95
- package/dist/esm/internal/sync-operator.js.map +0 -1
- package/dist/esm/internal/sync-producer.js +0 -90
- package/dist/esm/internal/sync-producer.js.map +0 -1
- package/dist/esm/internal/withKey.js +0 -56
- package/dist/esm/internal/withKey.js.map +0 -1
- package/dist/esm/package.json +0 -4
- package/src/AsyncData.ts +0 -453
- package/src/Emitter.ts +0 -59
- package/src/Form.ts +0 -489
- package/src/FormEntry.ts +0 -214
- package/src/Idle.ts +0 -294
- package/src/Match.ts +0 -314
- package/src/Pull.ts +0 -95
- package/src/RefChunk.ts +0 -407
- package/src/RefHashMap.ts +0 -335
- package/src/RefHashSet.ts +0 -179
- package/src/Stream.ts +0 -140
- package/src/TypeId.ts +0 -59
- package/src/Typeclass.ts +0 -459
- package/src/internal/DeferredRef.ts +0 -72
- package/src/internal/UnionToTuple.ts +0 -11
- package/src/internal/bounds.ts +0 -21
- package/src/internal/core.ts +0 -2771
- package/src/internal/diff.ts +0 -171
- package/src/internal/effect-loop-operator.ts +0 -466
- package/src/internal/effect-operator.ts +0 -317
- package/src/internal/effect-producer.ts +0 -125
- package/src/internal/helpers.ts +0 -538
- package/src/internal/keyed.ts +0 -235
- package/src/internal/loop-operator.ts +0 -266
- package/src/internal/operator.ts +0 -87
- package/src/internal/protos.ts +0 -57
- package/src/internal/provide.ts +0 -151
- package/src/internal/requestIdleCallback.ts +0 -19
- package/src/internal/share.ts +0 -97
- package/src/internal/strategies.ts +0 -15
- package/src/internal/sync-operator.ts +0 -166
- package/src/internal/sync-producer.ts +0 -148
- package/src/internal/withKey.ts +0 -82
- /package/dist/{dts → Fx}/internal/UnionToTuple.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,347 @@
|
|
|
1
1
|
# @typed/fx
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **Beta:** This package is in beta; APIs may change.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@typed/fx` provides reactive streams and state for Effect: **Fx** (streams with rich combinators and run functions), **Push**, **RefSubject** (and typed refs like RefArray, RefBoolean), **Subject**, **Sink**, and **Versioned**. Use it for event streams, reactive UI state, and composing effects as streams.
|
|
6
|
+
|
|
7
|
+
## Dependencies
|
|
8
|
+
|
|
9
|
+
- `effect`
|
|
10
|
+
|
|
11
|
+
## API overview
|
|
12
|
+
|
|
13
|
+
- **Fx** — Stream type `Fx.Fx<A, E, R>` with constructors (`succeed`, `fail`, `fromEffect`, `fromIterable`, `make`, `periodic`, etc.), combinators (`map`, `flatMap`, `filter`, `take`, `switchMap`, etc.), and run (`runPromise`, `collect`, `fork`, `observe`).
|
|
14
|
+
- **Push** — Push-based stream abstraction.
|
|
15
|
+
- **RefSubject** — Mutable reactive refs; `RefSubject.make(initial)`; typed helpers like `RefSubject.increment` / `RefSubject.decrement` for numbers; `RefArray`, `RefBoolean`, `RefOption`, etc.
|
|
16
|
+
- **Subject** — Multicast subject for Fx streams.
|
|
17
|
+
- **Sink** — Consumer abstraction with combinators.
|
|
18
|
+
- **Versioned** — Versioned values.
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { Fx } from "@typed/fx";
|
|
24
|
+
|
|
25
|
+
Fx.fromIterable([1, 2, 3]).pipe(
|
|
26
|
+
Fx.filter((n) => n % 2 === 0),
|
|
27
|
+
Fx.map((n) => n * 2),
|
|
28
|
+
Fx.observe((n) => Effect.log(`emitted: ${n}`)),
|
|
29
|
+
Effect.runPromise
|
|
30
|
+
);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See the [counter example](https://github.com/typed-smol/typed-smol/tree/main/examples/counter) for a full runnable app.
|
|
34
|
+
|
|
35
|
+
## API reference
|
|
36
|
+
|
|
37
|
+
- [Fx](#fx)
|
|
38
|
+
- [Push](#push)
|
|
39
|
+
- [RefSubject](#refsubject)
|
|
40
|
+
- [Subject](#subject)
|
|
41
|
+
- [Sink](#sink)
|
|
42
|
+
- [Versioned](#versioned)
|
|
43
|
+
|
|
44
|
+
### Fx
|
|
45
|
+
|
|
46
|
+
Reactive stream type with concurrency, error handling, and context, integrated with Effect.
|
|
47
|
+
|
|
48
|
+
**Type**
|
|
49
|
+
|
|
50
|
+
- `Fx<A, E, R>` — Stream that emits `A`, can fail with `E`, requires context `R`; has `.run(sink)`.
|
|
51
|
+
|
|
52
|
+
**Type-level**
|
|
53
|
+
|
|
54
|
+
- `Fx.Success<T>`, `Fx.Error<T>`, `Fx.Services<T>` — Extract success, error, and context from an Fx type.
|
|
55
|
+
- `Fx.Any`, `Fx.Variance` — Wildcard and variance markers.
|
|
56
|
+
- `Fx.Service`, `Fx.Class` — Dependency-injection service/class for Fx.
|
|
57
|
+
|
|
58
|
+
**Constructors**
|
|
59
|
+
|
|
60
|
+
- `succeed(value)` — Emit a single value and complete.
|
|
61
|
+
- `succeedNull` / `null` — Emit `null` and complete.
|
|
62
|
+
- `succeedUndefined` / `undefined` — Emit `undefined` and complete.
|
|
63
|
+
- `succeedVoid` / `void` — Emit void and complete.
|
|
64
|
+
- `fail(error)` — Fail immediately with an error.
|
|
65
|
+
- `failCause(cause)` — Fail immediately with a Cause.
|
|
66
|
+
- `die(defect)` — Terminate with a defect.
|
|
67
|
+
- `interrupt(id?)` — Create an Fx that interrupts.
|
|
68
|
+
- `empty` — Emit nothing and complete immediately.
|
|
69
|
+
- `never` — Run forever without emitting.
|
|
70
|
+
- `fromEffect(effect)` — One-value Fx from an Effect (emit on success, fail on failure).
|
|
71
|
+
- `fromIterable(iterable)` — Emit each element of the iterable then complete.
|
|
72
|
+
- `fromYieldable(yieldable)` — Fx from any Yieldable (Effect, Promise, etc.).
|
|
73
|
+
- `fromSchedule(schedule)` — Emit `void` each time the schedule fires.
|
|
74
|
+
- `fromFailures(failures)` — Fx that fails with combined failures from an iterable.
|
|
75
|
+
- `make(run)` — Low-level: build Fx from a function that runs a Sink.
|
|
76
|
+
- `callback(run)` — Build Fx from a callback; receives `Emit` (succeed, failCause, fail, die, done).
|
|
77
|
+
- `at(value, delay)` — Emit one value after a delay.
|
|
78
|
+
- `periodic(period)` — Emit `void` on a fixed interval.
|
|
79
|
+
- `fn(body, ...pipeables)` — Effect.fn-style for Fx (body can return Fx); optional name/span.
|
|
80
|
+
|
|
81
|
+
**Combinators**
|
|
82
|
+
|
|
83
|
+
- `map(f)` — Transform emitted values.
|
|
84
|
+
- `mapEffect(f)` — Transform with an Effect.
|
|
85
|
+
- `flatMap(f)` — Map to inner Fx and merge (concurrent; like mergeMap).
|
|
86
|
+
- `flatMapEffect(f)` — FlatMap with an Effect returning Fx.
|
|
87
|
+
- `flatMapConcurrently(f, concurrency?)` — FlatMap with a concurrency limit.
|
|
88
|
+
- `flatMapConcurrentlyEffect(f, concurrency?)` — Same with Effect-based inner Fx.
|
|
89
|
+
- `switchMap(f)` — Map to inner Fx and switch to latest (cancels previous).
|
|
90
|
+
- `switchMapEffect(f)` — SwitchMap with Effect returning Fx.
|
|
91
|
+
- `exhaustMap(f)` — Map to inner Fx, ignore new outer values while inner runs.
|
|
92
|
+
- `exhaustMapEffect(f)` — ExhaustMap with Effect returning Fx.
|
|
93
|
+
- `exhaustLatestMap(f)` — Like exhaustMap but cancel previous inner when new outer arrives.
|
|
94
|
+
- `exhaustLatestMapEffect(f)` — ExhaustLatestMap with Effect returning Fx.
|
|
95
|
+
- `filter(f)` — Keep only values satisfying the predicate.
|
|
96
|
+
- `filterEffect(f)` — Filter with an Effect predicate.
|
|
97
|
+
- `filterMap(f)` — Filter and map to Option; compact.
|
|
98
|
+
- `filterMapEffect(f)` — FilterMap with Effect.
|
|
99
|
+
- `compact` — Filter out `None`, unwrap `Some`.
|
|
100
|
+
- `take(n)` — Take first n elements.
|
|
101
|
+
- `takeUntil(fx)` — Take until another Fx emits.
|
|
102
|
+
- `skip(n)` — Skip first n elements.
|
|
103
|
+
- `slice(options)` — Skip/take by bounds.
|
|
104
|
+
- `skipRepeats` — Drop consecutive duplicates (Equal).
|
|
105
|
+
- `skipRepeatsWith(equiv)` — Drop consecutive duplicates with custom equivalence.
|
|
106
|
+
- `mergeAll(fxs)` — Merge multiple Fx streams.
|
|
107
|
+
- `mergeOrdered(fxs)` — Merge with ordering guarantees.
|
|
108
|
+
- `catch(f)` — Recover from errors.
|
|
109
|
+
- `onError(f)` — Run an effect on failure.
|
|
110
|
+
- `onExit(f)` — Run an effect on exit (success/failure/interrupt).
|
|
111
|
+
- `onInterrupt(f)` — Run an effect on interrupt.
|
|
112
|
+
- `ensuring(effect)` — Run effect when Fx ends (success, failure, or interrupt).
|
|
113
|
+
- `provide(services)` — Provide context to the Fx.
|
|
114
|
+
- `when(condition, fx)` — Run Fx only when condition holds.
|
|
115
|
+
- `unwrap` — Unwrap Fx of Fx (flatten one level).
|
|
116
|
+
- `unwrapScoped` — Unwrap with Scope for inner Fx.
|
|
117
|
+
- `gen(f)` — Build Fx from a generator (yield Effects, return Fx).
|
|
118
|
+
- `genScoped(f)` — gen with Scope.
|
|
119
|
+
- `loop(initial, f)` — Loop with state and Option for continue/exit.
|
|
120
|
+
- `loopEffect(initial, f)` — Loop with Effect.
|
|
121
|
+
- `loopCause(initial, f)` — Loop with Cause handling.
|
|
122
|
+
- `loopCauseEffect(initial, f)` — Loop with Cause and Effect.
|
|
123
|
+
- `filterMapLoop(initial, f)` — Loop yielding Option.
|
|
124
|
+
- `filterMapLoopEffect(initial, f)` — filterMapLoop with Effect.
|
|
125
|
+
- `filterMapLoopCause(initial, f)` — filterMapLoop with Cause.
|
|
126
|
+
- `filterMapLoopCauseEffect(initial, f)` — filterMapLoop with Cause and Effect.
|
|
127
|
+
- `keyed(keyFn, f)` — Keyed stream (e.g. by id) with inner Fx per key.
|
|
128
|
+
- `tapEffect(f)` — Run effect for each value, pass value through.
|
|
129
|
+
- `exit` — Turn Fx of Exit into Fx that fails/succeeds accordingly.
|
|
130
|
+
- `causes` — Expose failures as Cause emissions.
|
|
131
|
+
- `continueWith(f)` — When Fx ends, continue with another Fx.
|
|
132
|
+
- `flip` — Swap success and error types.
|
|
133
|
+
- `tuple(...fxs)` — Combine Fx streams into tuple Fx.
|
|
134
|
+
- `withSpan(name?, options?)` — Add tracing span around the Fx.
|
|
135
|
+
|
|
136
|
+
**Run**
|
|
137
|
+
|
|
138
|
+
- `runPromise(fx, options?)` — Run to completion; Promise rejects on failure.
|
|
139
|
+
- `runPromiseExit(fx, options?)` — Run to completion; Promise resolves to Exit.
|
|
140
|
+
- `collectAll(fx)` — Collect all emitted values into an array (Effect).
|
|
141
|
+
- `collectAllFork(fx)` — Fork collection of all values (returns Fiber of array).
|
|
142
|
+
- `collectUpTo(fx, n)` — Collect at most n values.
|
|
143
|
+
- `collectUpToFork(fx, n)` — Fork collectUpTo.
|
|
144
|
+
- `first(fx)` — Effect that yields first value as Option (None if empty).
|
|
145
|
+
- `fork(fx, options?)` — Run Fx in a background fiber; returns Effect of Fiber.
|
|
146
|
+
- `runFork(fx, options?)` — Run Fx in a new fiber via Effect.runFork.
|
|
147
|
+
- `observe(fx, f)` — Run callback for each value; returns Effect that completes when stream ends.
|
|
148
|
+
- `drain(fx)` — Run Fx, discard values (Effect completes when stream ends).
|
|
149
|
+
- `drainLayer(fx)` — Layer that forks and drains the Fx.
|
|
150
|
+
- `observeLayer(fx, f)` — Layer that observes the Fx with the given callback.
|
|
151
|
+
|
|
152
|
+
**Stream interop**
|
|
153
|
+
|
|
154
|
+
- `toStream(fx, options?)` — Convert Fx to Effect Stream.
|
|
155
|
+
- `fromStream(stream, options?)` — Convert Effect Stream to Fx.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Push
|
|
160
|
+
|
|
161
|
+
Push-based abstraction that is both a Sink (input) and an Fx (output).
|
|
162
|
+
|
|
163
|
+
**Type**
|
|
164
|
+
|
|
165
|
+
- `Push<A, E, R, B, E2, R2>` — Consumes `A` (Sink) and produces `B` (Fx); input and output types are independent.
|
|
166
|
+
|
|
167
|
+
**Constructor**
|
|
168
|
+
|
|
169
|
+
- `Push.make(sink, fx)` — Create a Push from a Sink and an Fx (dual: can be called as `make(fx)(sink)`).
|
|
170
|
+
|
|
171
|
+
**Service**
|
|
172
|
+
|
|
173
|
+
- `Push.Service`, `Push.Class` — Dependency-injection for Push.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### RefSubject
|
|
178
|
+
|
|
179
|
+
Mutable reactive reference: observable state that can be read (as Effect), updated, and subscribed to (as Fx).
|
|
180
|
+
|
|
181
|
+
**Types**
|
|
182
|
+
|
|
183
|
+
- `RefSubject<A, E, R>` — Mutable ref; extends `Computed` and `Subject`; has `updates(transaction)` and `interrupt`.
|
|
184
|
+
- `Computed<A, E, R>` — Read-only derived value (Fx + Effect); emits and samples transformed value.
|
|
185
|
+
- `Filtered<A, E, R>` — Computed over Option; may not always have a value.
|
|
186
|
+
- `GetSetDelete<A, E, R>` — Interface with get/set/delete for use inside `updates`.
|
|
187
|
+
|
|
188
|
+
**Constructors**
|
|
189
|
+
|
|
190
|
+
- `make(initial, options?)` — Create RefSubject from value, Effect, or Fx; options include `eq` (equivalence).
|
|
191
|
+
- `fromEffect(effect)` — RefSubject driven by an Effect (e.g. initial value from async source).
|
|
192
|
+
- `fromFx(fx)` — RefSubject that follows an Fx stream.
|
|
193
|
+
- `fromStream(stream)` — RefSubject from an Effect Stream.
|
|
194
|
+
|
|
195
|
+
**Core operations**
|
|
196
|
+
|
|
197
|
+
- `set(ref, value)` — Set current value.
|
|
198
|
+
- `reset(ref)` — Reset to initial (if any); returns previous value as Option.
|
|
199
|
+
- `update(ref, f)` — Update with a pure function.
|
|
200
|
+
- `updateEffect(ref, f)` — Update with an Effect.
|
|
201
|
+
- `modify(ref, f)` — Modify and return a result (pure).
|
|
202
|
+
- `modifyEffect(ref, f)` — Modify with an Effect.
|
|
203
|
+
- `runUpdates(ref, f)` — Run an effect that can read/update the ref (transactional).
|
|
204
|
+
- `increment(ref)` — Add 1 to a number RefSubject; returns new value.
|
|
205
|
+
- `decrement(ref)` — Subtract 1 from a number RefSubject; returns new value.
|
|
206
|
+
- `proxy(ref)` — Create a proxy RefSubject that forwards to the given ref.
|
|
207
|
+
- `isRefSubject(value)` — Type guard for RefSubject.
|
|
208
|
+
|
|
209
|
+
**Derived**
|
|
210
|
+
|
|
211
|
+
- `map(ref, f)` — Computed that applies f to the value.
|
|
212
|
+
- `mapEffect(ref, f)` — Computed with Effect transformation.
|
|
213
|
+
- `filterMap(ref, f)` — Filtered computed (Option).
|
|
214
|
+
- `filterMapEffect(ref, f)` — FilterMap with Effect.
|
|
215
|
+
- `compact(ref)` — Filtered that strips Option.
|
|
216
|
+
- `slice(ref, options)` — Slice over iterable-like ref.
|
|
217
|
+
- `transform(ref, transformFx, transformGet)` — General transform of a RefSubject/Versioned.
|
|
218
|
+
- `makeComputed(input, f)` — Build a Computed from a Versioned and an Effect function.
|
|
219
|
+
- `makeFiltered(input, f)` — Build a Filtered from a Versioned and an Effect returning Option.
|
|
220
|
+
- `struct(refs)` — Combine refs into a struct RefSubject.
|
|
221
|
+
- `tuple(refs)` — Combine refs into a tuple RefSubject.
|
|
222
|
+
- `computedFromService(service)`, `filteredFromService(service)` — Computed/Filtered from a service.
|
|
223
|
+
|
|
224
|
+
**Typed refs** (each has `make` and domain-specific helpers)
|
|
225
|
+
|
|
226
|
+
- `RefArray` — Array ref; e.g. prepend, append, remove.
|
|
227
|
+
- `RefBoolean` — Boolean ref; e.g. toggle, setTrue, setFalse.
|
|
228
|
+
- `RefOption` — Option ref.
|
|
229
|
+
- `RefResult` — Result ref.
|
|
230
|
+
- `RefString` — String ref.
|
|
231
|
+
- `RefBigInt` — BigInt ref.
|
|
232
|
+
- `RefBigDecimal` — BigDecimal ref.
|
|
233
|
+
- `RefDuration` — Duration ref.
|
|
234
|
+
- `RefDateTime` — DateTime ref.
|
|
235
|
+
- `RefCause` — Cause ref.
|
|
236
|
+
- `RefChunk` — Chunk ref.
|
|
237
|
+
- `RefHashMap` — HashMap ref.
|
|
238
|
+
- `RefHashSet` — HashSet ref.
|
|
239
|
+
- `RefRecord` — Record ref.
|
|
240
|
+
- `RefStruct` — Struct ref.
|
|
241
|
+
- `RefTuple` — Tuple ref.
|
|
242
|
+
- `RefGraph` — Graph ref.
|
|
243
|
+
- `RefHashRing` — HashRing ref.
|
|
244
|
+
- `RefTrie` — Trie ref.
|
|
245
|
+
- `RefIterable` — Iterable ref.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### Subject
|
|
250
|
+
|
|
251
|
+
Multicast point: both an Fx and a Sink; multiple subscribers share one run of the source.
|
|
252
|
+
|
|
253
|
+
**Type**
|
|
254
|
+
|
|
255
|
+
- `Subject<A, E, R>` — Implements `Fx<A, E, R>` and `Sink<A, E, R>`; has `subscriberCount` (Effect) and `interrupt`.
|
|
256
|
+
|
|
257
|
+
**Constructors**
|
|
258
|
+
|
|
259
|
+
- `Subject.make(replay?)` — Create a subject; optional replay buffer size.
|
|
260
|
+
- `Subject.unsafeMake(replay?)` — Create without Scope (unsafe for cleanup).
|
|
261
|
+
|
|
262
|
+
**Combinators**
|
|
263
|
+
|
|
264
|
+
- `Subject.share(fx, subject)` — Multicast Fx through a subject (one run, many subscribers).
|
|
265
|
+
- `Subject.multicast(fx)` — Share Fx with a fresh subject.
|
|
266
|
+
- `Subject.hold(fx)` — Fx that holds last value for late subscribers.
|
|
267
|
+
- `Subject.replay(fx, n)` — Replay last n values to new subscribers.
|
|
268
|
+
|
|
269
|
+
**Service**
|
|
270
|
+
|
|
271
|
+
- `Subject.Service`, `Subject.Class` — Dependency-injection for Subject.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
### Sink
|
|
276
|
+
|
|
277
|
+
Consumer of values: two callbacks, one for success and one for failure.
|
|
278
|
+
|
|
279
|
+
**Type**
|
|
280
|
+
|
|
281
|
+
- `Sink<A, E, R>` — `{ onSuccess: (value: A) => Effect, onFailure: (cause: Cause<E>) => Effect }`.
|
|
282
|
+
- `Sink.WithEarlyExit<A, E, R>` — Adds `earlyExit` for early termination.
|
|
283
|
+
- `Sink.WithState<A, E, R, B>` — Sink with state Ref.
|
|
284
|
+
- `Sink.WithStateSemaphore<A, E, R, B>` — Sink with state and transactional updates.
|
|
285
|
+
|
|
286
|
+
**Constructor**
|
|
287
|
+
|
|
288
|
+
- `Sink.make(onFailure, onSuccess)` — Build a Sink from the two callbacks.
|
|
289
|
+
|
|
290
|
+
**Combinators**
|
|
291
|
+
|
|
292
|
+
- `map(sink, f)` — Transform values before they reach the sink.
|
|
293
|
+
- `filterMap(sink, f)` — Filter and map (Option).
|
|
294
|
+
- `compact(sink)` — Sink for Option, forward only Some.
|
|
295
|
+
- `filter(sink, f)` — Filter values.
|
|
296
|
+
- `withEarlyExit(sink, earlyExit)` — Add early-exit capability.
|
|
297
|
+
- `withState(sink, initial, f)` — Stateful sink.
|
|
298
|
+
- `withStateSemaphore(sink, initial, f)` — Stateful sink with semaphore for transactional updates.
|
|
299
|
+
- `loop(sink, initial, f)` — Loop over sink with state.
|
|
300
|
+
- `loopCause(sink, initial, f)` — Loop with Cause handling.
|
|
301
|
+
- `filterMapLoop(sink, initial, f)` — Loop with filterMap.
|
|
302
|
+
- `filterMapLoopCause(sink, initial, f)` — filterMapLoop with Cause.
|
|
303
|
+
- `loopEffect(sink, initial, f)` — Loop with Effect.
|
|
304
|
+
- `filterMapLoopEffect(sink, initial, f)` — filterMapLoop with Effect.
|
|
305
|
+
- `loopCauseEffect(sink, initial, f)` — loopCause with Effect.
|
|
306
|
+
- `filterMapLoopCauseEffect(sink, initial, f)` — Full variant with Cause and Effect.
|
|
307
|
+
- `slice(sink, options)` — Skip/take at the Sink level.
|
|
308
|
+
- `mapEffect(sink, f)` — Effectful map.
|
|
309
|
+
- `filterMapEffect(sink, f)` — Effectful filterMap.
|
|
310
|
+
- `filterEffect(sink, f)` — Effectful filter.
|
|
311
|
+
- `tapEffect(sink, f)` — Tap with Effect, pass value through.
|
|
312
|
+
- `flip(sink)` — Swap success and error types.
|
|
313
|
+
- `exit(sink)` — Sink for Exit (success/failure).
|
|
314
|
+
- `dropAfter(sink, n)` — Drop values after the nth.
|
|
315
|
+
- `skipInterrupt(sink)` — Ignore interrupt at the Sink.
|
|
316
|
+
|
|
317
|
+
**Service**
|
|
318
|
+
|
|
319
|
+
- `Sink.Service`, `Sink.Class` — Dependency-injection for Sink.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
### Versioned
|
|
324
|
+
|
|
325
|
+
Value that changes over time with a version number; both an Fx (subscribe to changes) and an Effect (sample current value).
|
|
326
|
+
|
|
327
|
+
**Type**
|
|
328
|
+
|
|
329
|
+
- `Versioned<R1, E1, A2, E2, R2, A3, E3, R3>` — Fx emits `A2`; sampling yields `A3`; has `version` (Effect of number) and `interrupt`.
|
|
330
|
+
|
|
331
|
+
**Type-level**
|
|
332
|
+
|
|
333
|
+
- `Versioned.Unify<T>` — Unify a Versioned type.
|
|
334
|
+
- `Versioned.VersionContext<T>` — Context required to get version.
|
|
335
|
+
- `Versioned.VersionError<T>` — Error type of the version effect.
|
|
336
|
+
|
|
337
|
+
**Constructor**
|
|
338
|
+
|
|
339
|
+
- `Versioned.make(version, fx, effect)` — Build Versioned from version effect, update stream (Fx), and current-value effect.
|
|
340
|
+
|
|
341
|
+
**Combinators**
|
|
342
|
+
|
|
343
|
+
- `Versioned.transform(input, transformFx, transformGet)` — Transform the Fx and the sampling effect into a new Versioned.
|
|
344
|
+
|
|
345
|
+
**Service**
|
|
346
|
+
|
|
347
|
+
- `Versioned.Service`, `Versioned.Class` — Dependency-injection for Versioned.
|
package/dist/Fx/Fx.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type { Layer } from "effect/Layer";
|
|
3
|
+
import { type Pipeable } from "effect/Pipeable";
|
|
4
|
+
import type * as Scope from "effect/Scope";
|
|
5
|
+
import * as ServiceMap from "effect/ServiceMap";
|
|
6
|
+
import type * as Types from "effect/Types";
|
|
7
|
+
import type * as Sink from "../Sink/Sink.js";
|
|
8
|
+
import { FxTypeId } from "./TypeId.js";
|
|
9
|
+
/**
|
|
10
|
+
* `Fx` is a reactive stream of values that supports concurrency, error handling,
|
|
11
|
+
* and context management, fully integrated with the Effect ecosystem.
|
|
12
|
+
*
|
|
13
|
+
* Conceptually, an `Fx<A, E, R>` is a push-based stream that:
|
|
14
|
+
* - Emits values of type `A`
|
|
15
|
+
* - Can fail with an error of type `E`
|
|
16
|
+
* - Requires a context/environment of type `R`
|
|
17
|
+
*
|
|
18
|
+
* Unlike a standard `Effect` which produces a single value, `Fx` can produce
|
|
19
|
+
* 0, 1, or many values over time. It is similar to RxJS Observables or
|
|
20
|
+
* AsyncIterables, but built on top of Effect's fiber-based concurrency model.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
* @category models
|
|
24
|
+
*/
|
|
25
|
+
export interface Fx<A, E = never, R = never> extends Pipeable {
|
|
26
|
+
readonly [FxTypeId]: Fx.Variance<A, E, R>;
|
|
27
|
+
/**
|
|
28
|
+
* Runs the Fx stream by providing a Sink to consume the values.
|
|
29
|
+
* The result is an Effect that runs the stream process.
|
|
30
|
+
*/
|
|
31
|
+
readonly run: <RSink>(sink: Sink.Sink<A, E, RSink>) => Effect.Effect<unknown, never, R | RSink>;
|
|
32
|
+
}
|
|
33
|
+
export declare namespace Fx {
|
|
34
|
+
/**
|
|
35
|
+
* Any Fx type with wildcards.
|
|
36
|
+
* @since 1.0.0
|
|
37
|
+
* @category models
|
|
38
|
+
*/
|
|
39
|
+
type Any = Fx<any, any, any>;
|
|
40
|
+
/**
|
|
41
|
+
* Variance markers for Fx types.
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
* @category models
|
|
44
|
+
*/
|
|
45
|
+
interface Variance<A, E, R> {
|
|
46
|
+
readonly _A: Types.Covariant<A>;
|
|
47
|
+
readonly _E: Types.Covariant<E>;
|
|
48
|
+
readonly _R: Types.Covariant<R>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Extract the success type from an Fx.
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
* @category type-level
|
|
54
|
+
*/
|
|
55
|
+
type Success<T> = [T] extends [never] ? never : T extends Fx<infer _A, infer _E, infer _R> ? _A : never;
|
|
56
|
+
/**
|
|
57
|
+
* Extract the error type from an Fx.
|
|
58
|
+
* @since 1.0.0
|
|
59
|
+
* @category type-level
|
|
60
|
+
*/
|
|
61
|
+
type Error<T> = [T] extends [never] ? never : T extends Fx<infer _A, infer _E, infer _R> ? _E : never;
|
|
62
|
+
/**
|
|
63
|
+
* Extract the required services from an Fx.
|
|
64
|
+
* @since 1.0.0
|
|
65
|
+
* @category type-level
|
|
66
|
+
*/
|
|
67
|
+
type Services<T> = [T] extends [never] ? never : [T] extends [Fx<infer _A, infer _E, infer _R>] ? _R : never;
|
|
68
|
+
interface Service<Self, Id extends string, A, E> extends Fx<A, E, Self> {
|
|
69
|
+
readonly id: Id;
|
|
70
|
+
readonly service: ServiceMap.Service<Self, Fx<A, E>>;
|
|
71
|
+
readonly make: <R = never>(fx: Fx<A, E, R> | Effect.Effect<Fx<A, E, R>, E, R>) => Layer<Self, E, Exclude<R, Scope.Scope>>;
|
|
72
|
+
}
|
|
73
|
+
interface Class<Self, Id extends string, A, E> extends Service<Self, Id, A, E> {
|
|
74
|
+
new (): Service<Self, Id, A, E>;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Extract the success type from an Fx.
|
|
79
|
+
* @since 1.0.0
|
|
80
|
+
* @category type-level
|
|
81
|
+
*/
|
|
82
|
+
export type Success<T> = Fx.Success<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Extract the error type from an Fx.
|
|
85
|
+
* @since 1.0.0
|
|
86
|
+
* @category type-level
|
|
87
|
+
*/
|
|
88
|
+
export type Error<T> = Fx.Error<T>;
|
|
89
|
+
/**
|
|
90
|
+
* Extract the required services from an Fx.
|
|
91
|
+
* @since 1.0.0
|
|
92
|
+
* @category type-level
|
|
93
|
+
*/
|
|
94
|
+
export type Services<T> = Fx.Services<T>;
|
|
95
|
+
export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => Fx.Class<Self, Id, A, E>;
|
|
96
|
+
//# sourceMappingURL=Fx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fx.d.ts","sourceRoot":"","sources":["../../src/Fx/Fx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAQ,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,CAAE,SAAQ,QAAQ;IAC3D,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;CACjG;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,CAAC;IAC1B;;;;OAIG;IACH,KAAY,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAEpC;;;;OAIG;IACH,UAAiB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC/B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KACjC;IAED;;;;OAIG;IACH,KAAY,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACxC,KAAK,GACL,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GACxC,EAAE,GACF,KAAK,CAAC;IAEZ;;;;OAIG;IACH,KAAY,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACtC,KAAK,GACL,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GACxC,EAAE,GACF,KAAK,CAAC;IAEZ;;;;OAIG;IACH,KAAY,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACzC,KAAK,GACL,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,GAC5C,EAAE,GACF,KAAK,CAAC;IAEZ,UAAiB,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,CAAE,SAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC;QAC5E,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;QAChB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACrD,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,KAAK,EACvB,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC/C,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;KAC9C;IAED,UAAiB,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,CAAE,SAAQ,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;QACnF,QAAQ,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACjC;CACF;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAQzC,wBAAgB,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,MAChC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,IAAI,EAAE,KAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAiCnE"}
|
package/dist/Fx/Fx.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { identity } from "effect/Function";
|
|
3
|
+
import { effect } from "effect/Layer";
|
|
4
|
+
import { pipeArguments } from "effect/Pipeable";
|
|
5
|
+
import * as ServiceMap from "effect/ServiceMap";
|
|
6
|
+
import { provideServices } from "./combinators/provide.js";
|
|
7
|
+
import { FxTypeId, isFx } from "./TypeId.js";
|
|
8
|
+
const VARIANCE = {
|
|
9
|
+
_A: identity,
|
|
10
|
+
_E: identity,
|
|
11
|
+
_R: identity,
|
|
12
|
+
};
|
|
13
|
+
export function Service() {
|
|
14
|
+
return (id) => {
|
|
15
|
+
const service = ServiceMap.Service(id);
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
17
|
+
return class FxService {
|
|
18
|
+
static id = id;
|
|
19
|
+
static service = service;
|
|
20
|
+
static make = (fx) => effect(service, Effect.gen(function* () {
|
|
21
|
+
const services = yield* Effect.services();
|
|
22
|
+
const result = isFx(fx) ? fx : yield* fx;
|
|
23
|
+
return provideServices(result, services);
|
|
24
|
+
}));
|
|
25
|
+
static [FxTypeId] = VARIANCE;
|
|
26
|
+
static pipe = function () {
|
|
27
|
+
return pipeArguments(this, arguments);
|
|
28
|
+
};
|
|
29
|
+
static run = (sink) => Effect.flatMap(service.asEffect(), (fx) => fx.run(sink));
|
|
30
|
+
constructor() {
|
|
31
|
+
return FxService;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Fx } from "./Fx.js";
|
|
2
|
+
/**
|
|
3
|
+
* The unique type identifier for Fx.
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
* @category symbol
|
|
6
|
+
*/
|
|
7
|
+
export declare const FxTypeId: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* The unique type identifier type for Fx.
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category symbol
|
|
12
|
+
*/
|
|
13
|
+
export type FxTypeId = typeof FxTypeId;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a value is an Fx.
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category guards
|
|
18
|
+
*/
|
|
19
|
+
export declare function isFx(u: unknown): u is Fx<any, any, any>;
|
|
20
|
+
//# sourceMappingURL=TypeId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeId.d.ts","sourceRoot":"","sources":["../../src/Fx/TypeId.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,eAA6B,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAEvD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { hasProperty } from "effect/Predicate";
|
|
2
|
+
/**
|
|
3
|
+
* The unique type identifier for Fx.
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
* @category symbol
|
|
6
|
+
*/
|
|
7
|
+
export const FxTypeId = Symbol.for("@typed/fx/Fx");
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a value is an Fx.
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category guards
|
|
12
|
+
*/
|
|
13
|
+
export function isFx(u) {
|
|
14
|
+
return hasProperty(u, FxTypeId);
|
|
15
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type * as Arr from "effect/Array";
|
|
2
|
+
import * as Cause from "effect/Cause";
|
|
3
|
+
import type { ExcludeTag, ExtractTag, NoInfer, Tags } from "effect/Types";
|
|
4
|
+
import type { Fx } from "../Fx.js";
|
|
5
|
+
/**
|
|
6
|
+
* Recovers from a typed failure of an Fx by switching to a fallback Fx.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors `Effect.catch` / `Effect.catchAll` (catches `Cause.Fail` only).
|
|
9
|
+
*
|
|
10
|
+
* @since 1.0.0
|
|
11
|
+
* @category combinators
|
|
12
|
+
*/
|
|
13
|
+
export declare const catch_: {
|
|
14
|
+
<E, A2, E2, R2>(f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;
|
|
15
|
+
<A, E, R, A2, E2, R2>(self: Fx<A, E, R>, f: (e: E) => Fx<A2, E2, R2>): Fx<A | A2, E2, R | R2>;
|
|
16
|
+
};
|
|
17
|
+
export { catch_ as catch };
|
|
18
|
+
/**
|
|
19
|
+
* An alias for {@link catch}.
|
|
20
|
+
*
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
* @category combinators
|
|
23
|
+
*/
|
|
24
|
+
export declare const catchAll: {
|
|
25
|
+
<E, A2, E2, R2>(f: (e: E) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;
|
|
26
|
+
<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
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Recovers from *any* failure cause of an Fx (including defects and interrupts)
|
|
30
|
+
* by switching to a fallback Fx.
|
|
31
|
+
*
|
|
32
|
+
* Mirrors `Effect.catchCause`.
|
|
33
|
+
*
|
|
34
|
+
* @since 1.0.0
|
|
35
|
+
* @category combinators
|
|
36
|
+
*/
|
|
37
|
+
export declare const catchCause: {
|
|
38
|
+
<E, A2, E2, R2>(f: (cause: Cause.Cause<E>) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2, R | R2>;
|
|
39
|
+
<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
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Recovers from a typed failure by matching on the `_tag` field of the error.
|
|
43
|
+
*
|
|
44
|
+
* Mirrors `Effect.catchTag`.
|
|
45
|
+
*
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
* @category combinators
|
|
48
|
+
*/
|
|
49
|
+
export declare const catchTag: {
|
|
50
|
+
<const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>, E, A2, E2, R2>(k: K, f: (e: ExtractTag<NoInfer<E>, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Fx<A2, E2, R2>): <A, R>(self: Fx<A, E, R>) => Fx<A | A2, E2 | ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>, R | R2>;
|
|
51
|
+
<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
|
+
};
|
|
53
|
+
//# sourceMappingURL=catch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../src/Fx/combinators/catch.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import { dual } from "effect/Function";
|
|
3
|
+
import * as Result from "effect/Result";
|
|
4
|
+
import { make as makeSink } from "../../Sink/Sink.js";
|
|
5
|
+
import { make } from "../constructors/make.js";
|
|
6
|
+
const hasTag = (u) => typeof u === "object" &&
|
|
7
|
+
u !== null &&
|
|
8
|
+
"_tag" in u &&
|
|
9
|
+
typeof u["_tag"] === "string";
|
|
10
|
+
const matchesTag = (tag, error) => {
|
|
11
|
+
if (!hasTag(error))
|
|
12
|
+
return false;
|
|
13
|
+
if (typeof tag === "string")
|
|
14
|
+
return error._tag === tag;
|
|
15
|
+
return tag.some((t) => t === error._tag);
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Recovers from a typed failure of an Fx by switching to a fallback Fx.
|
|
19
|
+
*
|
|
20
|
+
* Mirrors `Effect.catch` / `Effect.catchAll` (catches `Cause.Fail` only).
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
* @category combinators
|
|
24
|
+
*/
|
|
25
|
+
export const catch_ = dual(2, (self, f) => make((sink) => self.run(makeSink((cause) => {
|
|
26
|
+
const result = Cause.findFail(cause);
|
|
27
|
+
if (Result.isFailure(result)) {
|
|
28
|
+
return sink.onFailure(result.failure);
|
|
29
|
+
}
|
|
30
|
+
return f(result.success.error).run(sink);
|
|
31
|
+
}, sink.onSuccess))));
|
|
32
|
+
export { catch_ as catch };
|
|
33
|
+
/**
|
|
34
|
+
* An alias for {@link catch}.
|
|
35
|
+
*
|
|
36
|
+
* @since 1.0.0
|
|
37
|
+
* @category combinators
|
|
38
|
+
*/
|
|
39
|
+
export const catchAll = catch_;
|
|
40
|
+
/**
|
|
41
|
+
* Recovers from *any* failure cause of an Fx (including defects and interrupts)
|
|
42
|
+
* by switching to a fallback Fx.
|
|
43
|
+
*
|
|
44
|
+
* Mirrors `Effect.catchCause`.
|
|
45
|
+
*
|
|
46
|
+
* @since 1.0.0
|
|
47
|
+
* @category combinators
|
|
48
|
+
*/
|
|
49
|
+
export const catchCause = dual(2, (self, f) => make((sink) => self.run(makeSink((cause) => f(cause).run(sink), sink.onSuccess))));
|
|
50
|
+
/**
|
|
51
|
+
* Recovers from a typed failure by matching on the `_tag` field of the error.
|
|
52
|
+
*
|
|
53
|
+
* Mirrors `Effect.catchTag`.
|
|
54
|
+
*
|
|
55
|
+
* @since 1.0.0
|
|
56
|
+
* @category combinators
|
|
57
|
+
*/
|
|
58
|
+
export const catchTag = dual(3, (self, k, f) => make((sink) => self.run(makeSink((cause) => {
|
|
59
|
+
const result = Cause.findFail(cause);
|
|
60
|
+
if (Result.isFailure(result)) {
|
|
61
|
+
return sink.onFailure(result.failure);
|
|
62
|
+
}
|
|
63
|
+
else if (matchesTag(k, result.success.error)) {
|
|
64
|
+
return f(result.success.error).run(sink);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return sink.onFailure(cause);
|
|
68
|
+
}
|
|
69
|
+
}, sink.onSuccess))));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as Cause from "effect/Cause";
|
|
2
|
+
import type { Fx } from "../Fx.js";
|
|
3
|
+
/**
|
|
4
|
+
* Emits only the failure causes from an Fx, discarding successful values.
|
|
5
|
+
*
|
|
6
|
+
* @param fx - The `Fx` stream.
|
|
7
|
+
* @returns An `Fx` emitting `Cause<E>`.
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
* @category combinators
|
|
10
|
+
*/
|
|
11
|
+
export declare const causes: <A, E, R>(fx: Fx<A, E, R>) => Fx<Cause.Cause<E>, never, R>;
|
|
12
|
+
//# sourceMappingURL=causes.d.ts.map
|