@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/dist/esm/RefSubject.js
DELETED
|
@@ -1,1076 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A RefSubject is a Subject that can be used to read and write a value.
|
|
3
|
-
* @since 1.20.0
|
|
4
|
-
*/
|
|
5
|
-
import * as C from "@typed/context";
|
|
6
|
-
import * as Array from "effect/Array";
|
|
7
|
-
import * as Boolean from "effect/Boolean";
|
|
8
|
-
import * as Cause from "effect/Cause";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
|
-
import * as ExecutionStrategy from "effect/ExecutionStrategy";
|
|
11
|
-
import * as Exit from "effect/Exit";
|
|
12
|
-
import * as Fiber from "effect/Fiber";
|
|
13
|
-
import { dual, identity } from "effect/Function";
|
|
14
|
-
import * as Layer from "effect/Layer";
|
|
15
|
-
import * as MutableRef from "effect/MutableRef";
|
|
16
|
-
import { sum } from "effect/Number";
|
|
17
|
-
import * as Option from "effect/Option";
|
|
18
|
-
import * as Scope from "effect/Scope";
|
|
19
|
-
import * as Unify from "effect/Unify";
|
|
20
|
-
import * as internal from "./internal/core.js";
|
|
21
|
-
import * as DeferredRef from "./internal/DeferredRef.js";
|
|
22
|
-
import { getExitEquivalence, matchEffectPrimitive, withScope } from "./internal/helpers.js";
|
|
23
|
-
import { FxEffectBase } from "./internal/protos.js";
|
|
24
|
-
import { runtimeToLayer } from "./internal/provide.js";
|
|
25
|
-
import { hold } from "./internal/share.js";
|
|
26
|
-
import * as Sink from "./Sink.js";
|
|
27
|
-
import * as Subject from "./Subject.js";
|
|
28
|
-
import { ComputedTypeId, FilteredTypeId, FxTypeId, RefSubjectTypeId } from "./TypeId.js";
|
|
29
|
-
import * as Versioned from "./Versioned.js";
|
|
30
|
-
const UNBOUNDED = { concurrency: "unbounded" };
|
|
31
|
-
// TODO: Kind of a Hack, but I don't really want to pollute the public API with this. What should we do with this?
|
|
32
|
-
const CURRENT_ENVIRONMENT_TAG = C.Tagged("@typed/environment/CurrentEnvironment");
|
|
33
|
-
const checkIsDOM = (ctx) => C.getOption(ctx, CURRENT_ENVIRONMENT_TAG).pipe(Option.map((s) => s === "dom" || s === "test:dom"),
|
|
34
|
-
// Default behavior should allow multiple updates via Fx interface
|
|
35
|
-
Option.getOrElse(() => true));
|
|
36
|
-
/**
|
|
37
|
-
* @since 1.20.0
|
|
38
|
-
*/
|
|
39
|
-
export function fromEffect(effect, options) {
|
|
40
|
-
return Effect.map(makeCore(effect, options), (core) => new RefSubjectImpl(core));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* @since 1.20.0
|
|
44
|
-
*/
|
|
45
|
-
export function fromFx(fx, options) {
|
|
46
|
-
return DeferredRef.make(getExitEquivalence(options?.eq ?? internal.deepEquals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({ deferredRef }) => makeCore(deferredRef, options)), Effect.tap(({ core, deferredRef }) => Effect.forkIn(fx.run(Sink.make((cause) => Effect.flatMap(Effect.sync(() => deferredRef.done(Exit.failCause(cause))), () => core.subject.onFailure(cause)), (value) => Effect.flatMap(Effect.sync(() => deferredRef.done(Exit.succeed(value))), () => setCore(core, value)))), core.scope)), Effect.map(({ core }) => new RefSubjectImpl(core)));
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @since 1.20.0
|
|
50
|
-
*/
|
|
51
|
-
export function fromRefSubject(ref, options) {
|
|
52
|
-
return DeferredRef.make(getExitEquivalence(options?.eq ?? internal.deepEquals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({ deferredRef }) => makeCore(deferredRef, options)), Effect.tap(({ core, deferredRef }) => Effect.forkIn(ref.run(Sink.make((cause) => Effect.sync(() => deferredRef.done(Exit.failCause(cause))), (value) => Effect.sync(() => deferredRef.done(Exit.succeed(value))))), core.scope)), Effect.map(({ core }) => new DerivedImpl(core, persistCore(ref, core))));
|
|
53
|
-
}
|
|
54
|
-
function persistCore(ref, core) {
|
|
55
|
-
// Log any errors that fail to persist, but don't fail the consumer
|
|
56
|
-
return Effect.ignoreLogged(Effect.provide(Effect.flatMap(core.deferredRef, (value) => set(ref, value)), core.runtime.context));
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* @since 1.20.0
|
|
60
|
-
*/
|
|
61
|
-
export const make = function make(fxOrEffect, options) {
|
|
62
|
-
if (RefSubjectTypeId in fxOrEffect)
|
|
63
|
-
return fromRefSubject(fxOrEffect, options);
|
|
64
|
-
else if (FxTypeId in fxOrEffect)
|
|
65
|
-
return fromFx(fxOrEffect, options);
|
|
66
|
-
else
|
|
67
|
-
return fromEffect(fxOrEffect, options);
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* @since 1.20.0
|
|
71
|
-
*/
|
|
72
|
-
export function of(a, options) {
|
|
73
|
-
return Effect.acquireRelease(withScopeAndFiberId((scope, id) => unsafeMake({
|
|
74
|
-
id,
|
|
75
|
-
initial: Effect.succeed(a),
|
|
76
|
-
initialValue: a,
|
|
77
|
-
options,
|
|
78
|
-
scope
|
|
79
|
-
}), options?.executionStrategy ?? ExecutionStrategy.sequential), (ref) => ref.interrupt);
|
|
80
|
-
}
|
|
81
|
-
const withScopeAndFiberId = (f, strategy) => Effect.fiberIdWith((id) => withScope((scope) => f(scope, id), strategy));
|
|
82
|
-
/**
|
|
83
|
-
* @since 1.20.0
|
|
84
|
-
*/
|
|
85
|
-
export function unsafeMake(params) {
|
|
86
|
-
const { id, initial, options, scope } = params;
|
|
87
|
-
return Effect.flatMap(Effect.runtime(), (runtime) => {
|
|
88
|
-
const core = unsafeMakeCore(initial, id, runtime, scope, options);
|
|
89
|
-
const current = MutableRef.get(core.deferredRef.current);
|
|
90
|
-
// Sometimes we might be instantiating directly from a known value
|
|
91
|
-
// Here we seed the value and ensure the subject has it as well for re-broadcasting
|
|
92
|
-
if ("initialValue" in params && Option.isNone(current)) {
|
|
93
|
-
core.deferredRef.done(Exit.succeed(params.initialValue));
|
|
94
|
-
return Effect.map(core.subject.onSuccess(params.initialValue), () => new RefSubjectImpl(core));
|
|
95
|
-
}
|
|
96
|
-
else if (Option.isSome(current)) {
|
|
97
|
-
return Effect.map(Effect.matchCauseEffect(current.value, core.subject), () => new RefSubjectImpl(core));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return Effect.succeed(new RefSubjectImpl(core));
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
class RefSubjectImpl extends FxEffectBase {
|
|
105
|
-
core;
|
|
106
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
107
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
108
|
-
version;
|
|
109
|
-
interrupt;
|
|
110
|
-
subscriberCount;
|
|
111
|
-
getSetDelete;
|
|
112
|
-
constructor(core) {
|
|
113
|
-
super();
|
|
114
|
-
this.core = core;
|
|
115
|
-
this.version = Effect.sync(() => core.deferredRef.version);
|
|
116
|
-
this.interrupt = Effect.provide(interruptCore(core), core.runtime.context);
|
|
117
|
-
this.subscriberCount = Effect.provide(core.subject.subscriberCount, core.runtime.context);
|
|
118
|
-
this.getSetDelete = getSetDelete(core);
|
|
119
|
-
this.runUpdates = this.runUpdates.bind(this);
|
|
120
|
-
this.onSuccess = this.onSuccess.bind(this);
|
|
121
|
-
this.onFailure = this.onFailure.bind(this);
|
|
122
|
-
}
|
|
123
|
-
run(sink) {
|
|
124
|
-
return Effect.matchCauseEffect(getOrInitializeCore(this.core, true), {
|
|
125
|
-
onFailure: (cause) => sink.onFailure(cause),
|
|
126
|
-
onSuccess: () => Effect.provide(this.core.subject.run(sink), this.core.runtime.context)
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
runUpdates(run) {
|
|
130
|
-
return this.core.semaphore.withPermits(1)(run(this.getSetDelete));
|
|
131
|
-
}
|
|
132
|
-
unsafeGet = () => Option.getOrThrowWith(MutableRef.get(this.core.deferredRef.current), () => new Cause.NoSuchElementException());
|
|
133
|
-
onSuccess(value) {
|
|
134
|
-
return setCore(this.core, value);
|
|
135
|
-
}
|
|
136
|
-
onFailure(cause) {
|
|
137
|
-
return onFailureCore(this.core, cause);
|
|
138
|
-
}
|
|
139
|
-
toEffect() {
|
|
140
|
-
return getOrInitializeCore(this.core, true);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
class DerivedImpl extends RefSubjectImpl {
|
|
144
|
-
persist;
|
|
145
|
-
constructor(core, persist) {
|
|
146
|
-
super(core);
|
|
147
|
-
this.persist = persist;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* @since 1.20.0
|
|
152
|
-
*/
|
|
153
|
-
export const set = dual(2, function set(ref, a) {
|
|
154
|
-
return ref.runUpdates((ref) => ref.set(a));
|
|
155
|
-
});
|
|
156
|
-
/**
|
|
157
|
-
* @since 1.20.0
|
|
158
|
-
*/
|
|
159
|
-
export function reset(ref) {
|
|
160
|
-
return ref.runUpdates((ref) => ref.delete);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* @since 1.20.0
|
|
164
|
-
*/
|
|
165
|
-
export {
|
|
166
|
-
/**
|
|
167
|
-
* @since 1.20.0
|
|
168
|
-
*/
|
|
169
|
-
reset as delete };
|
|
170
|
-
function getSetDelete(ref) {
|
|
171
|
-
return {
|
|
172
|
-
get: getOrInitializeCore(ref, false),
|
|
173
|
-
set: (a) => setCore(ref, a),
|
|
174
|
-
delete: deleteCore(ref)
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* @since 1.20.0
|
|
179
|
-
*/
|
|
180
|
-
export const updateEffect = dual(2, function updateEffect(ref, f) {
|
|
181
|
-
return ref.runUpdates((ref) => Effect.flatMap(Effect.flatMap(ref.get, f), ref.set));
|
|
182
|
-
});
|
|
183
|
-
/**
|
|
184
|
-
* @since 1.20.0
|
|
185
|
-
*/
|
|
186
|
-
export const update = dual(2, function update(ref, f) {
|
|
187
|
-
return updateEffect(ref, (value) => Effect.succeed(f(value)));
|
|
188
|
-
});
|
|
189
|
-
/**
|
|
190
|
-
* @since 1.20.0
|
|
191
|
-
*/
|
|
192
|
-
export const modifyEffect = dual(2, function modifyEffect(ref, f) {
|
|
193
|
-
return ref.runUpdates((ref) => Effect.flatMap(ref.get, (value) => Effect.flatMap(f(value), ([b, a]) => Effect.flatMap(ref.set(a), () => Effect.succeed(b)))));
|
|
194
|
-
});
|
|
195
|
-
/**
|
|
196
|
-
* @since 1.20.0
|
|
197
|
-
*/
|
|
198
|
-
export const modify = dual(2, function modify(ref, f) {
|
|
199
|
-
return modifyEffect(ref, (value) => Effect.succeed(f(value)));
|
|
200
|
-
});
|
|
201
|
-
const isRefSubjectDataFirst = (args) => isRefSubject(args[0]);
|
|
202
|
-
/**
|
|
203
|
-
* @since 1.20.0
|
|
204
|
-
*/
|
|
205
|
-
export const runUpdates = dual(isRefSubjectDataFirst, function runUpdates(ref, f, options) {
|
|
206
|
-
if (!options) {
|
|
207
|
-
return ref.runUpdates(f);
|
|
208
|
-
}
|
|
209
|
-
else if (options.value === "initial") {
|
|
210
|
-
return ref.runUpdates((ref) => Effect.uninterruptibleMask((restore) => Effect.flatMap(ref.get, (initial) => f(ref).pipe(restore, Effect.tapErrorCause(Unify.unify((cause) => Cause.isInterruptedOnly(cause)
|
|
211
|
-
? options.onInterrupt(initial)
|
|
212
|
-
: Effect.void))))));
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
return ref.runUpdates((ref) => Effect.uninterruptibleMask((restore) => f(ref).pipe(restore, Effect.tapErrorCause(Unify.unify((cause) => Cause.isInterruptedOnly(cause)
|
|
216
|
-
? Effect.flatMap(ref.get, options.onInterrupt)
|
|
217
|
-
: Effect.void)))));
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
class RefSubjectCore {
|
|
221
|
-
initial;
|
|
222
|
-
subject;
|
|
223
|
-
runtime;
|
|
224
|
-
scope;
|
|
225
|
-
deferredRef;
|
|
226
|
-
semaphore;
|
|
227
|
-
constructor(initial, subject, runtime, scope, deferredRef, semaphore) {
|
|
228
|
-
this.initial = initial;
|
|
229
|
-
this.subject = subject;
|
|
230
|
-
this.runtime = runtime;
|
|
231
|
-
this.scope = scope;
|
|
232
|
-
this.deferredRef = deferredRef;
|
|
233
|
-
this.semaphore = semaphore;
|
|
234
|
-
}
|
|
235
|
-
_fiber = undefined;
|
|
236
|
-
}
|
|
237
|
-
function makeCore(initial, options) {
|
|
238
|
-
return Effect.runtime().pipe(Effect.bindTo("runtime"), Effect.let("executionStrategy", () => options?.executionStrategy ?? ExecutionStrategy.parallel), Effect.bind("scope", ({ executionStrategy, runtime }) => Scope.fork(C.get(runtime.context, Scope.Scope), executionStrategy)), Effect.bind("id", () => Effect.fiberId), Effect.map(({ id, runtime, scope }) => unsafeMakeCore(initial, id, runtime, scope, options)), Effect.tap((core) => Scope.addFinalizer(core.scope, Effect.provide(core.subject.interrupt, core.runtime.context))));
|
|
239
|
-
}
|
|
240
|
-
function unsafeMakeCore(initial, id, runtime, scope, options) {
|
|
241
|
-
const subject = new Subject.HoldSubjectImpl();
|
|
242
|
-
const core = new RefSubjectCore(initial, subject, runtime, scope, DeferredRef.unsafeMake(id, getExitEquivalence(options?.eq ?? internal.deepEquals), subject.lastValue), Effect.unsafeMakeSemaphore(1));
|
|
243
|
-
const onSuccess = (a) => core.deferredRef.done(Exit.succeed(a));
|
|
244
|
-
const onCause = (cause) => core.deferredRef.done(Exit.failCause(cause));
|
|
245
|
-
const onError = (e) => onCause(Cause.fail(e));
|
|
246
|
-
// Initialize the core with the initial value if it is synchronous
|
|
247
|
-
matchEffectPrimitive(initial, {
|
|
248
|
-
Success: onSuccess,
|
|
249
|
-
Failure: onCause,
|
|
250
|
-
Some: onSuccess,
|
|
251
|
-
None: onError,
|
|
252
|
-
Left: onError,
|
|
253
|
-
Right: onSuccess,
|
|
254
|
-
Sync: (f) => onSuccess(f()),
|
|
255
|
-
Otherwise: () => false
|
|
256
|
-
});
|
|
257
|
-
return core;
|
|
258
|
-
}
|
|
259
|
-
function getOrInitializeCore(core, lockInitialize) {
|
|
260
|
-
return Effect.suspend(() => {
|
|
261
|
-
if (core._fiber === undefined && Option.isNone(MutableRef.get(core.deferredRef.current))) {
|
|
262
|
-
return initializeCoreAndTap(core, lockInitialize);
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
return core.deferredRef;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
function initializeCoreEffect(core, lock) {
|
|
270
|
-
const initialize = Effect.onExit(Effect.provide(core.initial, core.runtime.context), (exit) => Effect.sync(() => {
|
|
271
|
-
core._fiber = undefined;
|
|
272
|
-
core.deferredRef.done(exit);
|
|
273
|
-
}));
|
|
274
|
-
return Effect.flatMap(Effect.forkIn(lock ? core.semaphore.withPermits(1)(initialize) : initialize, core.scope), (fiber) => Effect.sync(() => core._fiber = fiber));
|
|
275
|
-
}
|
|
276
|
-
function initializeCore(core, lock) {
|
|
277
|
-
const onSuccess = (a) => {
|
|
278
|
-
core.deferredRef.done(Exit.succeed(a));
|
|
279
|
-
return Effect.succeed(Fiber.succeed(a));
|
|
280
|
-
};
|
|
281
|
-
const onCause = (cause) => {
|
|
282
|
-
core.deferredRef.done(Exit.failCause(cause));
|
|
283
|
-
return Effect.succeed(Fiber.failCause(cause));
|
|
284
|
-
};
|
|
285
|
-
const onError = (e) => onCause(Cause.fail(e));
|
|
286
|
-
return matchEffectPrimitive(core.initial, {
|
|
287
|
-
Success: onSuccess,
|
|
288
|
-
Failure: onCause,
|
|
289
|
-
Some: onSuccess,
|
|
290
|
-
None: onError,
|
|
291
|
-
Left: onError,
|
|
292
|
-
Right: onSuccess,
|
|
293
|
-
Sync: (f) => Effect.suspend(() => onSuccess(f())),
|
|
294
|
-
Otherwise: () => initializeCoreEffect(core, lock)
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
function initializeCoreAndTap(core, lock) {
|
|
298
|
-
return Effect.zipRight(initializeCore(core, lock), tapEventCore(core, core.deferredRef));
|
|
299
|
-
}
|
|
300
|
-
function setCore(core, a) {
|
|
301
|
-
const exit = Exit.succeed(a);
|
|
302
|
-
return Effect.suspend(() => {
|
|
303
|
-
if (core.deferredRef.done(exit)) {
|
|
304
|
-
// If the value changed, send an event
|
|
305
|
-
return Effect.as(sendEvent(core, exit), a);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
// Otherwise, just return the current value
|
|
309
|
-
return Effect.succeed(a);
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
function onFailureCore(core, cause) {
|
|
314
|
-
const exit = Exit.failCause(cause);
|
|
315
|
-
return Effect.suspend(() => {
|
|
316
|
-
if (core.deferredRef.done(exit)) {
|
|
317
|
-
return sendEvent(core, exit);
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
return Effect.void;
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
function interruptCore(core) {
|
|
325
|
-
return Effect.fiberIdWith((id) => {
|
|
326
|
-
core.deferredRef.reset();
|
|
327
|
-
const closeScope = Scope.close(core.scope, Exit.interrupt(id));
|
|
328
|
-
const interruptFiber = core._fiber ? Fiber.interrupt(core._fiber) : Effect.void;
|
|
329
|
-
const interruptSubject = core.subject.interrupt;
|
|
330
|
-
return Effect.all([closeScope, interruptFiber, interruptSubject], { discard: true });
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
function deleteCore(core) {
|
|
334
|
-
return Effect.suspend(() => {
|
|
335
|
-
const current = MutableRef.get(core.deferredRef.current);
|
|
336
|
-
core.deferredRef.reset();
|
|
337
|
-
if (Option.isNone(current)) {
|
|
338
|
-
return Effect.succeed(Option.none());
|
|
339
|
-
}
|
|
340
|
-
return core.subject.subscriberCount.pipe(Effect.provide(core.runtime.context), Effect.flatMap((count) => count > 0 && !core._fiber ? initializeCore(core, false) : Effect.void), Effect.zipRight(Effect.asSome(current.value)));
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
function tapEventCore(core, effect) {
|
|
344
|
-
return effect.pipe(Effect.exit, Effect.tap((exit) => sendEvent(core, exit)), Effect.flatten);
|
|
345
|
-
}
|
|
346
|
-
function sendEvent(core, exit) {
|
|
347
|
-
if (Exit.isSuccess(exit)) {
|
|
348
|
-
return Effect.provide(core.subject.onSuccess(exit.value), core.runtime.context);
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
return Effect.provide(core.subject.onFailure(exit.cause), core.runtime.context);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* @since 1.20.0
|
|
356
|
-
*/
|
|
357
|
-
export const mapEffect = dual(2, function mapEffect(versioned, f) {
|
|
358
|
-
return FilteredTypeId in versioned
|
|
359
|
-
? FilteredImpl.make(versioned, (a) => Effect.asSome(f(a)))
|
|
360
|
-
: ComputedImpl.make(versioned, f);
|
|
361
|
-
});
|
|
362
|
-
/**
|
|
363
|
-
* @since 1.20.0
|
|
364
|
-
*/
|
|
365
|
-
export const map = dual(2, function map(versioned, f) {
|
|
366
|
-
return mapEffect(versioned, (a) => Effect.succeed(f(a)));
|
|
367
|
-
});
|
|
368
|
-
/**
|
|
369
|
-
* @since 1.20.0
|
|
370
|
-
*/
|
|
371
|
-
export const filterMapEffect = dual(2, function filterMapEffect(versioned, f) {
|
|
372
|
-
return FilteredImpl.make(versioned, f);
|
|
373
|
-
});
|
|
374
|
-
/**
|
|
375
|
-
* @since 1.20.0
|
|
376
|
-
*/
|
|
377
|
-
export const filterMap = dual(2, function filterMap(versioned, f) {
|
|
378
|
-
return FilteredImpl.make(versioned, (a) => Effect.succeed(f(a)));
|
|
379
|
-
});
|
|
380
|
-
/**
|
|
381
|
-
* @since 1.20.0
|
|
382
|
-
*/
|
|
383
|
-
export const compact = function compact(versioned) {
|
|
384
|
-
return FilteredImpl.make(versioned, Effect.succeed);
|
|
385
|
-
};
|
|
386
|
-
/**
|
|
387
|
-
* @since 1.20.0
|
|
388
|
-
*/
|
|
389
|
-
export const filterEffect = dual(2, function filterEffect(versioned, f) {
|
|
390
|
-
return FilteredImpl.make(versioned, (a) => Effect.map(f(a), (b) => b ? Option.some(a) : Option.none()));
|
|
391
|
-
});
|
|
392
|
-
/**
|
|
393
|
-
* @since 1.20.0
|
|
394
|
-
*/
|
|
395
|
-
export const filter = dual(2, function filter(versioned, f) {
|
|
396
|
-
return FilteredImpl.make(versioned, (a) => Effect.succeed(f(a) ? Option.some(a) : Option.none()));
|
|
397
|
-
});
|
|
398
|
-
class ComputedImpl extends Versioned.VersionedTransform {
|
|
399
|
-
input;
|
|
400
|
-
f;
|
|
401
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
402
|
-
_computed;
|
|
403
|
-
constructor(input, f) {
|
|
404
|
-
super(input, (fx) => internal.mapEffect(fx, f), Effect.flatMap(f));
|
|
405
|
-
this.input = input;
|
|
406
|
-
this.f = f;
|
|
407
|
-
this._computed = hold(internal.fromFxEffect(Effect.contextWith((ctx) => {
|
|
408
|
-
if (checkIsDOM(ctx)) {
|
|
409
|
-
return internal.fromEffect(input).pipe((_) => internal.continueWith(_, () => input), internal.skipRepeats, (_) => internal.mapEffect(_, f), internal.skipRepeats);
|
|
410
|
-
}
|
|
411
|
-
return internal.fromEffect(Effect.flatMap(input, f));
|
|
412
|
-
})));
|
|
413
|
-
}
|
|
414
|
-
run(sink) {
|
|
415
|
-
return this._computed.run(sink);
|
|
416
|
-
}
|
|
417
|
-
unsafeGet = () => Option.getOrThrowWith(this._currentValue, () => new Cause.NoSuchElementException());
|
|
418
|
-
static make(input, f) {
|
|
419
|
-
return new ComputedImpl(input, f);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
class FilteredImpl extends Versioned.VersionedTransform {
|
|
423
|
-
input;
|
|
424
|
-
f;
|
|
425
|
-
[FilteredTypeId] = FilteredTypeId;
|
|
426
|
-
_filtered;
|
|
427
|
-
constructor(input, f) {
|
|
428
|
-
super(input, (fx) => internal.filterMapEffect(fx, f), (effect) => Effect.flatten(Effect.flatMap(effect, f)));
|
|
429
|
-
this.input = input;
|
|
430
|
-
this.f = f;
|
|
431
|
-
this._filtered = hold(internal.fromFxEffect(Effect.contextWith((ctx) => {
|
|
432
|
-
if (checkIsDOM(ctx)) {
|
|
433
|
-
return internal.fromEffect(input).pipe((_) => internal.continueWith(_, () => input), internal.skipRepeats, (_) => internal.filterMapEffect(_, f), internal.skipRepeats);
|
|
434
|
-
}
|
|
435
|
-
return Effect.flatMap(input, f).pipe(internal.fromEffect, (_) => internal.filterMap(_, identity));
|
|
436
|
-
})));
|
|
437
|
-
}
|
|
438
|
-
static make(input, f) {
|
|
439
|
-
return new FilteredImpl(input, f);
|
|
440
|
-
}
|
|
441
|
-
asComputed() {
|
|
442
|
-
return ComputedImpl.make(this.input, this.f);
|
|
443
|
-
}
|
|
444
|
-
run(sink) {
|
|
445
|
-
return this._filtered.run(sink);
|
|
446
|
-
}
|
|
447
|
-
unsafeGet = () => Option.getOrThrowWith(this._currentValue, () => new Cause.NoSuchElementException());
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* @since 1.20.0
|
|
451
|
-
*/
|
|
452
|
-
export const skipRepeatsWith = dual(2, function skipRepeatsWith(ref, eq) {
|
|
453
|
-
const versioned = Versioned.transform(ref, (fx) => internal.skipRepeatsWith(fx, eq), identity);
|
|
454
|
-
if (FilteredTypeId in ref) {
|
|
455
|
-
return FilteredImpl.make(versioned, Effect.succeedSome);
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
return ComputedImpl.make(versioned, Effect.succeed);
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
export function skipRepeats(ref) {
|
|
462
|
-
return skipRepeatsWith(ref, internal.deepEquals);
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* @since 1.20.0
|
|
466
|
-
*/
|
|
467
|
-
export function transform(ref, from, to) {
|
|
468
|
-
return new RefSubjectTransform(ref, from, to);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* @since 1.20.0
|
|
472
|
-
*/
|
|
473
|
-
export function transformOrFail(ref, from, to) {
|
|
474
|
-
return new RefSubjectTransformEffect(ref, from, to);
|
|
475
|
-
}
|
|
476
|
-
class RefSubjectTransform extends FxEffectBase {
|
|
477
|
-
ref;
|
|
478
|
-
from;
|
|
479
|
-
to;
|
|
480
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
481
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
482
|
-
version;
|
|
483
|
-
interrupt;
|
|
484
|
-
subscriberCount;
|
|
485
|
-
constructor(ref, from, to) {
|
|
486
|
-
super();
|
|
487
|
-
this.ref = ref;
|
|
488
|
-
this.from = from;
|
|
489
|
-
this.to = to;
|
|
490
|
-
this.version = ref.version;
|
|
491
|
-
this.interrupt = ref.interrupt;
|
|
492
|
-
this.subscriberCount = ref.subscriberCount;
|
|
493
|
-
}
|
|
494
|
-
run(sink) {
|
|
495
|
-
return this.ref.run(Sink.map(sink, this.from));
|
|
496
|
-
}
|
|
497
|
-
runUpdates(run) {
|
|
498
|
-
return this.ref.runUpdates((ref) => run({
|
|
499
|
-
get: Effect.map(ref.get, this.from),
|
|
500
|
-
set: (b) => Effect.map(ref.set(this.to(b)), this.from),
|
|
501
|
-
delete: Effect.map(ref.delete, Option.map(this.from))
|
|
502
|
-
}));
|
|
503
|
-
}
|
|
504
|
-
unsafeGet = () => {
|
|
505
|
-
const exit = this.ref.unsafeGet();
|
|
506
|
-
return Exit.map(exit, this.from);
|
|
507
|
-
};
|
|
508
|
-
onFailure(cause) {
|
|
509
|
-
return this.ref.onFailure(cause);
|
|
510
|
-
}
|
|
511
|
-
onSuccess(value) {
|
|
512
|
-
return this.ref.onSuccess(this.to(value));
|
|
513
|
-
}
|
|
514
|
-
toEffect() {
|
|
515
|
-
return Effect.map(this.ref, this.from);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
class RefSubjectTransformEffect extends FxEffectBase {
|
|
519
|
-
ref;
|
|
520
|
-
from;
|
|
521
|
-
to;
|
|
522
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
523
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
524
|
-
version;
|
|
525
|
-
interrupt;
|
|
526
|
-
subscriberCount;
|
|
527
|
-
subject;
|
|
528
|
-
constructor(ref, from, to) {
|
|
529
|
-
super();
|
|
530
|
-
this.ref = ref;
|
|
531
|
-
this.from = from;
|
|
532
|
-
this.to = to;
|
|
533
|
-
this.version = ref.version;
|
|
534
|
-
this.interrupt = ref.interrupt;
|
|
535
|
-
this.subscriberCount = ref.subscriberCount;
|
|
536
|
-
this.subject = new Subject.HoldSubjectImpl();
|
|
537
|
-
}
|
|
538
|
-
run(sink) {
|
|
539
|
-
return internal.skipRepeats(internal.merge(internal.tapEffect(internal.mapEffect(this.ref, this.from), this.subject.onSuccess), this.subject)).run(sink);
|
|
540
|
-
}
|
|
541
|
-
runUpdates(run) {
|
|
542
|
-
return this.ref.runUpdates((ref) => run({
|
|
543
|
-
get: Effect.flatMap(ref.get, this.from),
|
|
544
|
-
set: (b) => Effect.matchCauseEffect(Effect.flatMap(this.to(b), ref.set), {
|
|
545
|
-
onFailure: (cause) => Effect.as(this.subject.onFailure(cause), b),
|
|
546
|
-
onSuccess: () => Effect.as(this.subject.onSuccess(b), b)
|
|
547
|
-
}),
|
|
548
|
-
delete: Effect.flatMap(ref.delete, Option.match({
|
|
549
|
-
onNone: () => Effect.succeedNone,
|
|
550
|
-
onSome: (b) => Effect.asSome(this.from(b))
|
|
551
|
-
}))
|
|
552
|
-
}));
|
|
553
|
-
}
|
|
554
|
-
unsafeGet = () => {
|
|
555
|
-
return Option.getOrThrowWith(MutableRef.get(this.subject.lastValue), () => new Cause.NoSuchElementException());
|
|
556
|
-
};
|
|
557
|
-
onFailure(cause) {
|
|
558
|
-
return this.subject.onFailure(cause);
|
|
559
|
-
}
|
|
560
|
-
onSuccess(value) {
|
|
561
|
-
return Effect.matchCauseEffect(this.to(value), {
|
|
562
|
-
onFailure: (cause) => this.subject.onFailure(cause),
|
|
563
|
-
onSuccess: (a) => this.ref.onSuccess(a)
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
toEffect() {
|
|
567
|
-
return Effect.flatMap(this.ref, this.from);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* @since 1.20.0
|
|
572
|
-
*/
|
|
573
|
-
export function tuple(refs) {
|
|
574
|
-
const kind = getRefKind(refs);
|
|
575
|
-
switch (kind) {
|
|
576
|
-
case "r":
|
|
577
|
-
return makeTupleRef(refs);
|
|
578
|
-
case "c":
|
|
579
|
-
return makeTupleComputed(refs);
|
|
580
|
-
case "f":
|
|
581
|
-
return makeTupleFiltered(refs);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
const join = (a, b) => {
|
|
585
|
-
if (a === "r")
|
|
586
|
-
return b;
|
|
587
|
-
if (b === "r")
|
|
588
|
-
return a;
|
|
589
|
-
if (a === "f")
|
|
590
|
-
return a;
|
|
591
|
-
if (b === "f")
|
|
592
|
-
return b;
|
|
593
|
-
return "c";
|
|
594
|
-
};
|
|
595
|
-
function getRefKind(refs) {
|
|
596
|
-
let kind = "r";
|
|
597
|
-
for (const ref of refs) {
|
|
598
|
-
if (FilteredTypeId in ref) {
|
|
599
|
-
kind = "f";
|
|
600
|
-
break;
|
|
601
|
-
}
|
|
602
|
-
else if (!(RefSubjectTypeId in ref)) {
|
|
603
|
-
kind = join(kind, "c");
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
return kind;
|
|
607
|
-
}
|
|
608
|
-
function makeTupleRef(refs) {
|
|
609
|
-
return new RefSubjectTuple(refs);
|
|
610
|
-
}
|
|
611
|
-
class RefSubjectTuple extends FxEffectBase {
|
|
612
|
-
refs;
|
|
613
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
614
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
615
|
-
version;
|
|
616
|
-
interrupt;
|
|
617
|
-
subscriberCount;
|
|
618
|
-
versioned;
|
|
619
|
-
getSetDelete;
|
|
620
|
-
constructor(refs) {
|
|
621
|
-
super();
|
|
622
|
-
this.refs = refs;
|
|
623
|
-
this.versioned = Versioned.hold(Versioned.tuple(refs));
|
|
624
|
-
this.version = this.versioned.version;
|
|
625
|
-
this.interrupt = Effect.all(refs.map((r) => r.interrupt), UNBOUNDED);
|
|
626
|
-
this.subscriberCount = Effect.map(Effect.all(refs.map((r) => r.subscriberCount), UNBOUNDED), Array.reduce(0, sum));
|
|
627
|
-
this.getSetDelete = {
|
|
628
|
-
get: this.versioned,
|
|
629
|
-
set: (a) => Effect.all(refs.map((r, i) => set(r, a[i])), UNBOUNDED),
|
|
630
|
-
delete: Effect.map(Effect.all(refs.map((r) => reset(r)), UNBOUNDED), Option.all)
|
|
631
|
-
};
|
|
632
|
-
this.runUpdates = this.runUpdates.bind(this);
|
|
633
|
-
this.onFailure = this.onFailure.bind(this);
|
|
634
|
-
this.onSuccess = this.onSuccess.bind(this);
|
|
635
|
-
}
|
|
636
|
-
run(sink) {
|
|
637
|
-
return this.versioned.run(sink);
|
|
638
|
-
}
|
|
639
|
-
toEffect() {
|
|
640
|
-
return this.versioned;
|
|
641
|
-
}
|
|
642
|
-
runUpdates(run) {
|
|
643
|
-
return run(this.getSetDelete);
|
|
644
|
-
}
|
|
645
|
-
unsafeGet = () => {
|
|
646
|
-
return Option.getOrThrowWith(Exit.all(this.refs.map((r) => r.unsafeGet())), () => new Cause.NoSuchElementException());
|
|
647
|
-
};
|
|
648
|
-
onFailure(cause) {
|
|
649
|
-
return Effect.all(this.refs.map((ref) => ref.onFailure(cause)));
|
|
650
|
-
}
|
|
651
|
-
onSuccess(value) {
|
|
652
|
-
return Effect.catchAllCause(this.getSetDelete.set(value), (c) => this.onFailure(c));
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
function makeTupleComputed(refs) {
|
|
656
|
-
return new ComputedImpl(Versioned.tuple(refs), Effect.succeed);
|
|
657
|
-
}
|
|
658
|
-
function makeTupleFiltered(refs) {
|
|
659
|
-
return new FilteredImpl(Versioned.tuple(refs), Effect.succeedSome);
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* @since 1.20.0
|
|
663
|
-
*/
|
|
664
|
-
export function struct(refs) {
|
|
665
|
-
const kind = getRefKind(Object.values(refs));
|
|
666
|
-
switch (kind) {
|
|
667
|
-
case "r":
|
|
668
|
-
return makeStructRef(refs);
|
|
669
|
-
case "c":
|
|
670
|
-
return makeStructComputed(refs);
|
|
671
|
-
case "f":
|
|
672
|
-
return makeStructFiltered(refs);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
function makeStructRef(refs) {
|
|
676
|
-
return new RefSubjectStruct(refs);
|
|
677
|
-
}
|
|
678
|
-
class RefSubjectStruct extends FxEffectBase {
|
|
679
|
-
refs;
|
|
680
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
681
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
682
|
-
version;
|
|
683
|
-
interrupt;
|
|
684
|
-
subscriberCount;
|
|
685
|
-
versioned;
|
|
686
|
-
getSetDelete;
|
|
687
|
-
constructor(refs) {
|
|
688
|
-
super();
|
|
689
|
-
this.refs = refs;
|
|
690
|
-
this.versioned = Versioned.hold(Versioned.struct(refs));
|
|
691
|
-
this.version = this.versioned.version;
|
|
692
|
-
this.interrupt = Effect.all(Object.values(refs).map((r) => r.interrupt), UNBOUNDED);
|
|
693
|
-
this.subscriberCount = Effect.map(Effect.all(Object.values(refs).map((r) => r.subscriberCount), UNBOUNDED), Array.reduce(0, sum));
|
|
694
|
-
this.getSetDelete = {
|
|
695
|
-
get: this.versioned,
|
|
696
|
-
set: (a) => Effect.all(Object.keys(refs).map((k) => set(refs[k], a[k])), UNBOUNDED),
|
|
697
|
-
delete: Effect.map(Effect.all(Object.values(refs).map((r) => reset(r)), UNBOUNDED), Option.all)
|
|
698
|
-
};
|
|
699
|
-
this.runUpdates = this.runUpdates.bind(this);
|
|
700
|
-
this.onFailure = this.onFailure.bind(this);
|
|
701
|
-
this.onSuccess = this.onSuccess.bind(this);
|
|
702
|
-
}
|
|
703
|
-
run(sink) {
|
|
704
|
-
return this.versioned.run(sink);
|
|
705
|
-
}
|
|
706
|
-
toEffect() {
|
|
707
|
-
return this.versioned;
|
|
708
|
-
}
|
|
709
|
-
runUpdates(run) {
|
|
710
|
-
return run(this.getSetDelete);
|
|
711
|
-
}
|
|
712
|
-
unsafeGet = () => {
|
|
713
|
-
const entries = Object.entries(this.refs).map(([k, r]) => Exit.map(r.unsafeGet(), (a) => [k, a]));
|
|
714
|
-
const exit = Option.getOrThrowWith(Exit.all(entries), () => new Cause.NoSuchElementException());
|
|
715
|
-
return Exit.map(exit, (entries) => Object.fromEntries(entries));
|
|
716
|
-
};
|
|
717
|
-
onFailure(cause) {
|
|
718
|
-
return Effect.all(Object.values(this.refs).map((ref) => ref.onFailure(cause)));
|
|
719
|
-
}
|
|
720
|
-
onSuccess(value) {
|
|
721
|
-
return Effect.catchAllCause(this.getSetDelete.set(value), (c) => this.onFailure(c));
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
function makeStructComputed(refs) {
|
|
725
|
-
return new ComputedImpl(Versioned.struct(refs), Effect.succeed);
|
|
726
|
-
}
|
|
727
|
-
function makeStructFiltered(refs) {
|
|
728
|
-
return new FilteredImpl(Versioned.struct(refs), Effect.succeedSome);
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* @since 1.20.0
|
|
732
|
-
*/
|
|
733
|
-
export function tagged(replay) {
|
|
734
|
-
return (identifier) => new RefSubjectTagged(C.Tagged(identifier), replay);
|
|
735
|
-
}
|
|
736
|
-
class RefSubjectTagged extends FxEffectBase {
|
|
737
|
-
tag;
|
|
738
|
-
replay;
|
|
739
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
740
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
741
|
-
version;
|
|
742
|
-
interrupt;
|
|
743
|
-
subscriberCount;
|
|
744
|
-
constructor(tag, replay = 0) {
|
|
745
|
-
super();
|
|
746
|
-
this.tag = tag;
|
|
747
|
-
this.replay = replay;
|
|
748
|
-
this.version = tag.withEffect((ref) => ref.version);
|
|
749
|
-
this.interrupt = tag.withEffect((ref) => ref.interrupt);
|
|
750
|
-
this.subscriberCount = tag.withEffect((ref) => ref.subscriberCount);
|
|
751
|
-
this.runUpdates = this.runUpdates.bind(this);
|
|
752
|
-
this.onFailure = this.onFailure.bind(this);
|
|
753
|
-
this.onSuccess = this.onSuccess.bind(this);
|
|
754
|
-
}
|
|
755
|
-
run(sink) {
|
|
756
|
-
return this.tag.withEffect((ref) => ref.run(sink));
|
|
757
|
-
}
|
|
758
|
-
toEffect() {
|
|
759
|
-
return this.tag.withEffect((ref) => ref);
|
|
760
|
-
}
|
|
761
|
-
runUpdates(run) {
|
|
762
|
-
return this.tag.withEffect((ref) => ref.runUpdates(run));
|
|
763
|
-
}
|
|
764
|
-
unsafeGet = () => {
|
|
765
|
-
throw new Error(`Unable to unsafely get a tagged RefSubject because it requires the Effect context by defnition.`);
|
|
766
|
-
};
|
|
767
|
-
onFailure(cause) {
|
|
768
|
-
return this.tag.withEffect((ref) => ref.onFailure(cause));
|
|
769
|
-
}
|
|
770
|
-
onSuccess(value) {
|
|
771
|
-
return this.tag.withEffect((ref) => ref.onSuccess(value));
|
|
772
|
-
}
|
|
773
|
-
layer = (make) => this.tag.scoped(make);
|
|
774
|
-
make = (fxOrEffect, options) => {
|
|
775
|
-
return this.tag.scoped(Effect.gen(function* (_) {
|
|
776
|
-
let ref = yield* make(fxOrEffect, options);
|
|
777
|
-
if (options?.drop || options?.take) {
|
|
778
|
-
ref = slice(ref, options.drop ?? 0, options.take ?? Infinity);
|
|
779
|
-
}
|
|
780
|
-
return ref;
|
|
781
|
-
}));
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* @since 1.20.0
|
|
786
|
-
*/
|
|
787
|
-
export function fromTag(tag, f) {
|
|
788
|
-
return new RefSubjectFromTag(tag, f);
|
|
789
|
-
}
|
|
790
|
-
class RefSubjectFromTag extends FxEffectBase {
|
|
791
|
-
tag;
|
|
792
|
-
f;
|
|
793
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
794
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
795
|
-
version;
|
|
796
|
-
interrupt;
|
|
797
|
-
subscriberCount;
|
|
798
|
-
_get;
|
|
799
|
-
_fx;
|
|
800
|
-
constructor(tag, f) {
|
|
801
|
-
super();
|
|
802
|
-
this.tag = tag;
|
|
803
|
-
this.f = f;
|
|
804
|
-
this._get = Effect.map(tag, f);
|
|
805
|
-
this._fx = internal.fromFxEffect(this._get);
|
|
806
|
-
this.version = Effect.flatMap(this._get, (ref) => ref.version);
|
|
807
|
-
this.interrupt = Effect.flatMap(this._get, (ref) => ref.interrupt);
|
|
808
|
-
this.subscriberCount = Effect.flatMap(this._get, (ref) => ref.subscriberCount);
|
|
809
|
-
}
|
|
810
|
-
run(sink) {
|
|
811
|
-
return this._fx.run(sink);
|
|
812
|
-
}
|
|
813
|
-
toEffect() {
|
|
814
|
-
return Effect.flatten(this._get);
|
|
815
|
-
}
|
|
816
|
-
runUpdates(run) {
|
|
817
|
-
return Effect.flatMap(this._get, (ref) => ref.runUpdates(run));
|
|
818
|
-
}
|
|
819
|
-
unsafeGet = () => {
|
|
820
|
-
throw new Error(`Unable to unsafely get a tagged RefSubject because it requires the Effect context by defnition.`);
|
|
821
|
-
};
|
|
822
|
-
onFailure(cause) {
|
|
823
|
-
return Effect.flatMap(this._get, (ref) => ref.onFailure(cause));
|
|
824
|
-
}
|
|
825
|
-
onSuccess(value) {
|
|
826
|
-
return Effect.flatMap(this._get, (ref) => ref.onSuccess(value));
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
export function isRefSubject(u) {
|
|
830
|
-
return isObjectLike(u) && RefSubjectTypeId in u;
|
|
831
|
-
}
|
|
832
|
-
export function isComputed(u) {
|
|
833
|
-
return isObjectLike(u) && ComputedTypeId in u;
|
|
834
|
-
}
|
|
835
|
-
export function isFiltered(u) {
|
|
836
|
-
return isObjectLike(u) && FilteredTypeId in u;
|
|
837
|
-
}
|
|
838
|
-
export function isDerived(u) {
|
|
839
|
-
return isRefSubject(u) && "persist" in u;
|
|
840
|
-
}
|
|
841
|
-
function isObjectLike(u) {
|
|
842
|
-
if (u == null)
|
|
843
|
-
return false;
|
|
844
|
-
const type = typeof u;
|
|
845
|
-
return (type === "object" && !Array.isArray(u)) || type === "function";
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* @since 1.20.0
|
|
849
|
-
*/
|
|
850
|
-
export function computedFromTag(tag, f) {
|
|
851
|
-
return new ComputedFromTag(tag, f);
|
|
852
|
-
}
|
|
853
|
-
class ComputedFromTag extends FxEffectBase {
|
|
854
|
-
tag;
|
|
855
|
-
f;
|
|
856
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
857
|
-
version;
|
|
858
|
-
_get;
|
|
859
|
-
constructor(tag, f) {
|
|
860
|
-
super();
|
|
861
|
-
this.tag = tag;
|
|
862
|
-
this.f = f;
|
|
863
|
-
this._get = Effect.map(tag, f);
|
|
864
|
-
this.version = Effect.flatMap(this._get, (ref) => ref.version);
|
|
865
|
-
}
|
|
866
|
-
run(sink) {
|
|
867
|
-
return Effect.flatMap(this._get, (ref) => ref.run(sink));
|
|
868
|
-
}
|
|
869
|
-
toEffect() {
|
|
870
|
-
return Effect.flatten(this._get);
|
|
871
|
-
}
|
|
872
|
-
unsafeGet = () => {
|
|
873
|
-
throw new Error(`Unable to unsafely get a tagged Computed because it requires the Effect context by defnition.`);
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* @since 1.20.0
|
|
878
|
-
*/
|
|
879
|
-
export function filteredFromTag(tag, f) {
|
|
880
|
-
return new FilteredFromTag(tag, f);
|
|
881
|
-
}
|
|
882
|
-
class FilteredFromTag extends FxEffectBase {
|
|
883
|
-
tag;
|
|
884
|
-
f;
|
|
885
|
-
[FilteredTypeId] = FilteredTypeId;
|
|
886
|
-
version;
|
|
887
|
-
_get;
|
|
888
|
-
constructor(tag, f) {
|
|
889
|
-
super();
|
|
890
|
-
this.tag = tag;
|
|
891
|
-
this.f = f;
|
|
892
|
-
this._get = Effect.map(tag, f);
|
|
893
|
-
this.version = Effect.flatMap(this._get, (ref) => ref.version);
|
|
894
|
-
}
|
|
895
|
-
run(sink) {
|
|
896
|
-
return Effect.flatMap(this._get, (ref) => ref.run(sink));
|
|
897
|
-
}
|
|
898
|
-
toEffect() {
|
|
899
|
-
return Effect.flatten(this._get);
|
|
900
|
-
}
|
|
901
|
-
asComputed() {
|
|
902
|
-
return new ComputedFromTag(this.tag, (s) => this.f(s).asComputed());
|
|
903
|
-
}
|
|
904
|
-
unsafeGet = () => {
|
|
905
|
-
throw new Error(`Unable to unsafely get a tagged Filtered because it requires the Effect context by defnition.`);
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
/**
|
|
909
|
-
* @since 1.20.0
|
|
910
|
-
*/
|
|
911
|
-
export const provide = dual(2, function provide(ref, providing) {
|
|
912
|
-
const layer = Layer.isLayer(providing)
|
|
913
|
-
? providing
|
|
914
|
-
: C.isContext(providing)
|
|
915
|
-
? Layer.succeedContext(providing)
|
|
916
|
-
: runtimeToLayer(providing);
|
|
917
|
-
if (isComputed(ref)) {
|
|
918
|
-
return ComputedImpl.make(Versioned.provide(ref, layer), Effect.succeed);
|
|
919
|
-
}
|
|
920
|
-
else if (isFiltered(ref)) {
|
|
921
|
-
return FilteredImpl.make(Versioned.provide(ref, layer), Effect.succeedSome);
|
|
922
|
-
}
|
|
923
|
-
else {
|
|
924
|
-
return new RefSubjectProvide(ref, layer);
|
|
925
|
-
}
|
|
926
|
-
});
|
|
927
|
-
class RefSubjectProvide extends FxEffectBase {
|
|
928
|
-
ref;
|
|
929
|
-
layer;
|
|
930
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
931
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
932
|
-
interrupt;
|
|
933
|
-
subscriberCount;
|
|
934
|
-
constructor(ref, layer) {
|
|
935
|
-
super();
|
|
936
|
-
this.ref = ref;
|
|
937
|
-
this.layer = layer;
|
|
938
|
-
this.interrupt = Effect.provide(ref.interrupt, layer);
|
|
939
|
-
this.subscriberCount = Effect.provide(ref.subscriberCount, layer);
|
|
940
|
-
}
|
|
941
|
-
run(sink) {
|
|
942
|
-
return Effect.provide(this.ref.run(sink), this.layer);
|
|
943
|
-
}
|
|
944
|
-
toEffect() {
|
|
945
|
-
return Effect.provide(this.ref, this.layer);
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Set the value to true
|
|
950
|
-
* @since 1.18.0
|
|
951
|
-
*/
|
|
952
|
-
export const asTrue = (ref) => set(ref, true);
|
|
953
|
-
/**
|
|
954
|
-
* Set the value to false
|
|
955
|
-
* @since 1.18.0
|
|
956
|
-
*/
|
|
957
|
-
export const asFalse = (ref) => set(ref, false);
|
|
958
|
-
/**
|
|
959
|
-
* Toggle the boolean value between true and false
|
|
960
|
-
* @since 1.18.0
|
|
961
|
-
*/
|
|
962
|
-
export const toggle = (ref) => update(ref, Boolean.not);
|
|
963
|
-
const add = (x) => x + 1;
|
|
964
|
-
/**
|
|
965
|
-
* Set the value to true
|
|
966
|
-
* @since 1.18.0
|
|
967
|
-
*/
|
|
968
|
-
export const increment = (ref) => update(ref, add);
|
|
969
|
-
const sub = (x) => x - 1;
|
|
970
|
-
/**
|
|
971
|
-
* Set the value to false
|
|
972
|
-
* @since 1.18.0
|
|
973
|
-
*/
|
|
974
|
-
export const decrement = (ref) => update(ref, sub);
|
|
975
|
-
/**
|
|
976
|
-
* @since 1.20.0
|
|
977
|
-
*/
|
|
978
|
-
export const slice = dual(3, function slice(ref, drop, take) {
|
|
979
|
-
return new RefSubjectSimpleTransform(ref, (_) => internal.slice(_, drop, take), identity);
|
|
980
|
-
});
|
|
981
|
-
/**
|
|
982
|
-
* @since 1.20.0
|
|
983
|
-
*/
|
|
984
|
-
export const drop = dual(2, function drop(ref, drop) {
|
|
985
|
-
return slice(ref, drop, Infinity);
|
|
986
|
-
});
|
|
987
|
-
/**
|
|
988
|
-
* @since 1.20.0
|
|
989
|
-
*/
|
|
990
|
-
export const take = dual(2, function take(ref, take) {
|
|
991
|
-
return slice(ref, 0, take);
|
|
992
|
-
});
|
|
993
|
-
/**
|
|
994
|
-
* Get the current value of the RefSubject. If it has not been set yet, a Fiber will be used to wait for the value to be set.
|
|
995
|
-
*
|
|
996
|
-
* @since 1.25.0
|
|
997
|
-
*/
|
|
998
|
-
export const get = (ref) => ref;
|
|
999
|
-
/**
|
|
1000
|
-
* Synchronously get the current Exit value of the RefSubject. If it has not been set yet, a Cause.NoSuchElementException will be thrown.
|
|
1001
|
-
*
|
|
1002
|
-
* Note: This is unimplemented for RefSubject.tagged and RefSubject.fromTag because they require the Effect context by definition.
|
|
1003
|
-
* It will throw immediately.
|
|
1004
|
-
*
|
|
1005
|
-
* @since 1.25.0
|
|
1006
|
-
*/
|
|
1007
|
-
export const unsafeGetExit = (ref) => ref.unsafeGet();
|
|
1008
|
-
/**
|
|
1009
|
-
* Synchronously get the current value of the RefSubject.
|
|
1010
|
-
*
|
|
1011
|
-
* @since 1.25.0
|
|
1012
|
-
*/
|
|
1013
|
-
export const unsafeGet = (ref) => Effect.runSync(unsafeGetExit(ref));
|
|
1014
|
-
/**
|
|
1015
|
-
* Extract all values from an object using a Proxy
|
|
1016
|
-
*
|
|
1017
|
-
* @since 2.0.0
|
|
1018
|
-
*/
|
|
1019
|
-
export const proxy = (source) => {
|
|
1020
|
-
const target = {};
|
|
1021
|
-
return new Proxy(target, {
|
|
1022
|
-
get(self, prop) {
|
|
1023
|
-
if (prop in self)
|
|
1024
|
-
return self[prop];
|
|
1025
|
-
return self[prop] = map(source, (a) => a[prop]);
|
|
1026
|
-
}
|
|
1027
|
-
});
|
|
1028
|
-
};
|
|
1029
|
-
/**
|
|
1030
|
-
* @since 2.0.0
|
|
1031
|
-
*/
|
|
1032
|
-
export const withSpan = dual(isRefSubjectDataFirst, (ref, name, options) => new RefSubjectSimpleTransform(ref, (fx) => internal.withSpan(fx, name, options), Effect.withSpan(name, options)));
|
|
1033
|
-
class RefSubjectSimpleTransform extends FxEffectBase {
|
|
1034
|
-
ref;
|
|
1035
|
-
transformFx;
|
|
1036
|
-
transformEffect;
|
|
1037
|
-
[ComputedTypeId] = ComputedTypeId;
|
|
1038
|
-
[RefSubjectTypeId] = RefSubjectTypeId;
|
|
1039
|
-
version;
|
|
1040
|
-
interrupt;
|
|
1041
|
-
subscriberCount;
|
|
1042
|
-
_fx;
|
|
1043
|
-
constructor(ref, transformFx, transformEffect) {
|
|
1044
|
-
super();
|
|
1045
|
-
this.ref = ref;
|
|
1046
|
-
this.transformFx = transformFx;
|
|
1047
|
-
this.transformEffect = transformEffect;
|
|
1048
|
-
this.version = ref.version;
|
|
1049
|
-
this.interrupt = ref.interrupt;
|
|
1050
|
-
this.subscriberCount = ref.subscriberCount;
|
|
1051
|
-
this._fx = transformFx(ref);
|
|
1052
|
-
}
|
|
1053
|
-
run(sink) {
|
|
1054
|
-
return this._fx.run(sink);
|
|
1055
|
-
}
|
|
1056
|
-
toEffect() {
|
|
1057
|
-
return this.transformEffect(this.ref);
|
|
1058
|
-
}
|
|
1059
|
-
runUpdates(run) {
|
|
1060
|
-
return this.ref.runUpdates(run);
|
|
1061
|
-
}
|
|
1062
|
-
unsafeGet = () => this.ref.unsafeGet();
|
|
1063
|
-
onFailure(cause) {
|
|
1064
|
-
return this.ref.onFailure(cause);
|
|
1065
|
-
}
|
|
1066
|
-
onSuccess(value) {
|
|
1067
|
-
return this.ref.onSuccess(value);
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* @since 2.0.0
|
|
1072
|
-
*/
|
|
1073
|
-
export const when = dual(2, function when(ref, options) {
|
|
1074
|
-
return map(ref, (a) => a ? options.onTrue : options.onFalse);
|
|
1075
|
-
});
|
|
1076
|
-
//# sourceMappingURL=RefSubject.js.map
|