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