@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
|
@@ -0,0 +1,1010 @@
|
|
|
1
|
+
/** @effect-diagnostics missingEffectError:skip-file */
|
|
2
|
+
/** @effect-diagnostics missingEffectContext:skip-file */
|
|
3
|
+
import type * as Cause from "effect/Cause";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import type { Equivalence } from "effect/Equivalence";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as Scope from "effect/Scope";
|
|
9
|
+
import * as ServiceMap from "effect/ServiceMap";
|
|
10
|
+
import * as Stream from "effect/Stream";
|
|
11
|
+
import type { Error as FxError, Fx } from "../Fx/index.js";
|
|
12
|
+
import type { UnionToTuple } from "../Fx/internal/UnionToTuple.js";
|
|
13
|
+
import * as Subject from "../Subject/Subject.js";
|
|
14
|
+
import * as Versioned from "../Versioned/Versioned.js";
|
|
15
|
+
export declare const RefSubjectTypeId: unique symbol;
|
|
16
|
+
export type RefSubjectTypeId = typeof RefSubjectTypeId;
|
|
17
|
+
export declare const ComputedTypeId: unique symbol;
|
|
18
|
+
export type ComputedTypeId = typeof ComputedTypeId;
|
|
19
|
+
export declare const FilteredTypeId: unique symbol;
|
|
20
|
+
export type FilteredTypeId = typeof FilteredTypeId;
|
|
21
|
+
/**
|
|
22
|
+
* A `Computed` is a read-only view of a value that can change over time.
|
|
23
|
+
* It is an `Fx` that emits the current value and subsequent updates.
|
|
24
|
+
* It is also an `Effect` that samples the current value.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { Effect } from "effect"
|
|
29
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
30
|
+
* import { Fx } from "@typed/fx"
|
|
31
|
+
*
|
|
32
|
+
* // Create a RefSubject and derive a Computed from it
|
|
33
|
+
* const program = Effect.gen(function* () {
|
|
34
|
+
* const count = yield* RefSubject.make(0)
|
|
35
|
+
*
|
|
36
|
+
* // Create a computed that doubles the count
|
|
37
|
+
* const doubled = RefSubject.map(count, (n) => n * 2)
|
|
38
|
+
*
|
|
39
|
+
* // Sample the computed value
|
|
40
|
+
* const value = yield* doubled
|
|
41
|
+
* console.log(value) // 0
|
|
42
|
+
*
|
|
43
|
+
* // Update the source
|
|
44
|
+
* yield* RefSubject.set(count, 5)
|
|
45
|
+
*
|
|
46
|
+
* // The computed automatically reflects the change
|
|
47
|
+
* const newValue = yield* doubled
|
|
48
|
+
* console.log(newValue) // 10
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
* @category models
|
|
54
|
+
*/
|
|
55
|
+
export interface Computed<out A, out E = never, out R = never> extends Versioned.Versioned<R, E, A, E, R | Scope.Scope, A, E, R> {
|
|
56
|
+
readonly [ComputedTypeId]: ComputedTypeId;
|
|
57
|
+
}
|
|
58
|
+
export declare namespace Computed {
|
|
59
|
+
type Any = Computed<any, any, any> | Computed<never, any, any> | Computed<any, never, any> | Computed<never, never, any>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A `Filtered` is a `Computed` that may not always have a value.
|
|
63
|
+
* It is essentially a `Computed<Option<A>>` with helper methods.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { Effect, Option } from "effect"
|
|
68
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
69
|
+
*
|
|
70
|
+
* // Create a RefSubject and filter it
|
|
71
|
+
* const program = Effect.gen(function* () {
|
|
72
|
+
* const numbers = yield* RefSubject.make([1, 2, 3, 4, 5])
|
|
73
|
+
*
|
|
74
|
+
* // Get the first even number (filtered)
|
|
75
|
+
* const firstEven = RefSubject.filterMap(
|
|
76
|
+
* numbers,
|
|
77
|
+
* (arr) => Option.fromNullable(arr.find((n) => n % 2 === 0))
|
|
78
|
+
* )
|
|
79
|
+
*
|
|
80
|
+
* // Try to get the value (may fail with NoSuchElementError)
|
|
81
|
+
* const value = yield* firstEven
|
|
82
|
+
* console.log(value) // 2
|
|
83
|
+
*
|
|
84
|
+
* // Or convert back to Option
|
|
85
|
+
* const option = firstEven.asComputed()
|
|
86
|
+
* const maybeValue = yield* option
|
|
87
|
+
* console.log(Option.isSome(maybeValue)) // true
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @since 1.0.0
|
|
92
|
+
* @category models
|
|
93
|
+
*/
|
|
94
|
+
export interface Filtered<out A, out E = never, out R = never> extends Versioned.Versioned<R, E, A, E, R | Scope.Scope, A, E | Cause.NoSuchElementError, R> {
|
|
95
|
+
readonly [FilteredTypeId]: FilteredTypeId;
|
|
96
|
+
/**
|
|
97
|
+
* Converts the Filtered back to a Computed of Option.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { Effect, Option } from "effect"
|
|
102
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
103
|
+
*
|
|
104
|
+
* const program = Effect.gen(function* () {
|
|
105
|
+
* const filtered = RefSubject.filterMap(
|
|
106
|
+
* yield* RefSubject.make([1, 2, 3]),
|
|
107
|
+
* (arr) => Option.fromNullable(arr.find((n) => n > 5))
|
|
108
|
+
* )
|
|
109
|
+
*
|
|
110
|
+
* // Convert to Computed<Option<number>>
|
|
111
|
+
* const computed = filtered.asComputed()
|
|
112
|
+
* const option = yield* computed
|
|
113
|
+
* console.log(Option.isNone(option)) // true (no number > 5)
|
|
114
|
+
* })
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
asComputed(): Computed<Option.Option<A>, E, R>;
|
|
118
|
+
}
|
|
119
|
+
export declare namespace Filtered {
|
|
120
|
+
type Any = Filtered<any, any, any> | Filtered<never, any, any> | Filtered<any, never, any> | Filtered<never, never, any>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Interface for basic RefSubject operations: get, set, delete.
|
|
124
|
+
* @since 1.0.0
|
|
125
|
+
* @category models
|
|
126
|
+
*/
|
|
127
|
+
export interface GetSetDelete<A, E = never, R = never> {
|
|
128
|
+
readonly get: Effect.Effect<A, E, R>;
|
|
129
|
+
readonly set: (a: A) => Effect.Effect<A, E, R>;
|
|
130
|
+
readonly delete: Effect.Effect<Option.Option<A>, E, R>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A `RefSubject` is a mutable reference that can be observed as an Fx.
|
|
134
|
+
* It combines the capabilities of a `Ref` (get/set/update) with a `Subject` (subscribe).
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* import { Effect } from "effect"
|
|
139
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
140
|
+
* import { Fx } from "@typed/fx"
|
|
141
|
+
*
|
|
142
|
+
* // Create a RefSubject with an initial value
|
|
143
|
+
* const program = Effect.gen(function* () {
|
|
144
|
+
* const count = yield* RefSubject.make(0)
|
|
145
|
+
*
|
|
146
|
+
* // Get the current value
|
|
147
|
+
* const current = yield* count
|
|
148
|
+
* console.log(current) // 0
|
|
149
|
+
*
|
|
150
|
+
* // Update the value
|
|
151
|
+
* yield* RefSubject.set(count, 5)
|
|
152
|
+
* const updated = yield* count
|
|
153
|
+
* console.log(updated) // 5
|
|
154
|
+
*
|
|
155
|
+
* // Use as an Fx to observe changes
|
|
156
|
+
* yield* Fx.observe(
|
|
157
|
+
* count,
|
|
158
|
+
* (value) => Effect.sync(() => console.log("Count changed:", value))
|
|
159
|
+
* )
|
|
160
|
+
*
|
|
161
|
+
* // Increment
|
|
162
|
+
* yield* RefSubject.increment(count)
|
|
163
|
+
* // Output: "Count changed: 6"
|
|
164
|
+
* })
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* @since 1.0.0
|
|
168
|
+
* @category models
|
|
169
|
+
*/
|
|
170
|
+
export interface RefSubject<A, E = never, R = never> extends Computed<A, E, R>, Subject.Subject<A, E, R> {
|
|
171
|
+
readonly [RefSubjectTypeId]: RefSubjectTypeId;
|
|
172
|
+
/**
|
|
173
|
+
* Runs an effect that can modify the RefSubject transactionally.
|
|
174
|
+
* All operations within the transaction are atomic and serialized.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* import { Effect } from "effect"
|
|
179
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
180
|
+
*
|
|
181
|
+
* const program = Effect.gen(function* () {
|
|
182
|
+
* const balance = yield* RefSubject.make(100)
|
|
183
|
+
*
|
|
184
|
+
* // Transfer money atomically
|
|
185
|
+
* yield* balance.updates((ref) =>
|
|
186
|
+
* Effect.gen(function* () {
|
|
187
|
+
* const current = yield* ref.get
|
|
188
|
+
* if (current >= 50) {
|
|
189
|
+
* yield* ref.set(current - 50)
|
|
190
|
+
* return "Transfer successful"
|
|
191
|
+
* }
|
|
192
|
+
* return "Insufficient funds"
|
|
193
|
+
* })
|
|
194
|
+
* )
|
|
195
|
+
* })
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
readonly updates: <B, E2, R2>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>) => Effect.Effect<B, E | E2, R | R2>;
|
|
199
|
+
/**
|
|
200
|
+
* Interrupts the RefSubject, stopping all subscriptions and cleaning up resources.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* import { Effect } from "effect"
|
|
205
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
206
|
+
*
|
|
207
|
+
* const program = Effect.gen(function* () {
|
|
208
|
+
* const ref = yield* RefSubject.make(0)
|
|
209
|
+
*
|
|
210
|
+
* // Later, clean up
|
|
211
|
+
* yield* ref.interrupt
|
|
212
|
+
* })
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
readonly interrupt: Effect.Effect<void, never, R>;
|
|
216
|
+
}
|
|
217
|
+
export declare namespace RefSubject {
|
|
218
|
+
type Any = RefSubject<any, any, any> | RefSubject<any, any> | RefSubject<any, never, any> | RefSubject<any>;
|
|
219
|
+
interface Service<Self, Id extends string, A, E> extends RefSubject<A, E, Self> {
|
|
220
|
+
readonly id: Id;
|
|
221
|
+
readonly service: ServiceMap.Service<Self, RefSubject<A, E>>;
|
|
222
|
+
readonly make: <R = never>(value: A | Effect.Effect<A, E, R> | Fx<A, E, R>, options?: RefSubjectOptions<A> & {
|
|
223
|
+
readonly skip?: number;
|
|
224
|
+
readonly take?: number;
|
|
225
|
+
}) => Layer.Layer<Self, never, Exclude<R, Scope.Scope>>;
|
|
226
|
+
readonly layer: <E2, R2>(make: Effect.Effect<RefSubject<A, E>, E2, R2 | Scope.Scope>) => Layer.Layer<Self, E2, Exclude<R2, Scope.Scope>>;
|
|
227
|
+
}
|
|
228
|
+
interface Class<Self, Id extends string, A, E> extends RefSubject.Service<Self, Id, A, E> {
|
|
229
|
+
new (): RefSubject.Service<Self, Id, A, E>;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export declare const CurrentComputedBehavior: ServiceMap.Reference<"one" | "multiple">;
|
|
233
|
+
export declare function makeComputed<R0, E0, A, E, R, E2, R2, C, E3, R3>(input: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Effect.Effect<C, E3, R3>): Computed<C, E0 | E | E2 | E3, R0 | R2 | R3 | Exclude<R, Scope.Scope>>;
|
|
234
|
+
export declare function makeFiltered<R0, E0, A, E, R, E2, R2, C, E3, R3>(input: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Effect.Effect<Option.Option<C>, E3, R3>): Filtered<C, E0 | E | E2 | E3, R0 | Exclude<R, Scope.Scope> | R2 | R3>;
|
|
235
|
+
export interface RefSubjectOptions<A> {
|
|
236
|
+
readonly eq?: Equivalence<A>;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Creates a new `RefSubject` from a value, `Effect`, or `Fx`.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* import { Effect } from "effect"
|
|
244
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
245
|
+
* import { Fx } from "@typed/fx"
|
|
246
|
+
*
|
|
247
|
+
* // From a plain value
|
|
248
|
+
* const program1 = Effect.gen(function* () {
|
|
249
|
+
* const ref = yield* RefSubject.make(42)
|
|
250
|
+
* const value = yield* ref
|
|
251
|
+
* console.log(value) // 42
|
|
252
|
+
* })
|
|
253
|
+
*
|
|
254
|
+
* // From an Effect
|
|
255
|
+
* const program2 = Effect.gen(function* () {
|
|
256
|
+
* const ref = yield* RefSubject.make(
|
|
257
|
+
* Effect.succeed("Hello")
|
|
258
|
+
* )
|
|
259
|
+
* const value = yield* ref
|
|
260
|
+
* console.log(value) // "Hello"
|
|
261
|
+
* })
|
|
262
|
+
*
|
|
263
|
+
* // From an Fx (tracks the latest value)
|
|
264
|
+
* const program3 = Effect.gen(function* () {
|
|
265
|
+
* const ref = yield* RefSubject.make(
|
|
266
|
+
* Fx.fromIterable([1, 2, 3])
|
|
267
|
+
* )
|
|
268
|
+
* const value = yield* ref
|
|
269
|
+
* console.log(value) // 3 (latest value)
|
|
270
|
+
* })
|
|
271
|
+
* ```
|
|
272
|
+
*
|
|
273
|
+
* @since 1.0.0
|
|
274
|
+
* @category constructors
|
|
275
|
+
*/
|
|
276
|
+
export declare function make<A, E = never, R = never>(effect: A | Effect.Effect<A, E, R> | Stream.Stream<A, E, R> | Fx<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
277
|
+
/**
|
|
278
|
+
* Creates a `RefSubject` from an `Effect`.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```ts
|
|
282
|
+
* import { Effect } from "effect"
|
|
283
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
284
|
+
*
|
|
285
|
+
* const program = Effect.gen(function* () {
|
|
286
|
+
* const ref = yield* RefSubject.fromEffect(
|
|
287
|
+
* Effect.succeed("Initial value")
|
|
288
|
+
* )
|
|
289
|
+
*
|
|
290
|
+
* const value = yield* ref
|
|
291
|
+
* console.log(value) // "Initial value"
|
|
292
|
+
* })
|
|
293
|
+
* ```
|
|
294
|
+
*
|
|
295
|
+
* @since 1.0.0
|
|
296
|
+
* @category constructors
|
|
297
|
+
*/
|
|
298
|
+
export declare function fromEffect<A, E, R>(effect: Effect.Effect<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
299
|
+
/**
|
|
300
|
+
* Creates a `RefSubject` from an `Fx`, tracking the latest emitted value.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```ts
|
|
304
|
+
* import { Effect } from "effect"
|
|
305
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
306
|
+
* import { Fx } from "@typed/fx"
|
|
307
|
+
*
|
|
308
|
+
* const program = Effect.gen(function* () {
|
|
309
|
+
* // Create an Fx that emits multiple values
|
|
310
|
+
* const numbers = Fx.fromIterable([1, 2, 3, 4, 5])
|
|
311
|
+
*
|
|
312
|
+
* // Create a RefSubject that tracks the latest value
|
|
313
|
+
* const ref = yield* RefSubject.fromFx(numbers)
|
|
314
|
+
*
|
|
315
|
+
* // Get the latest value
|
|
316
|
+
* const latest = yield* ref
|
|
317
|
+
* console.log(latest) // 5
|
|
318
|
+
* })
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* @since 1.0.0
|
|
322
|
+
* @category constructors
|
|
323
|
+
*/
|
|
324
|
+
export declare function fromFx<A, E, R>(fx: Fx<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
325
|
+
export declare function fromStream<A, E, R>(stream: Stream.Stream<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
326
|
+
/**
|
|
327
|
+
* Sets the value of a `RefSubject`.
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```ts
|
|
331
|
+
* import { Effect } from "effect"
|
|
332
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
333
|
+
*
|
|
334
|
+
* const program = Effect.gen(function* () {
|
|
335
|
+
* const count = yield* RefSubject.make(0)
|
|
336
|
+
*
|
|
337
|
+
* // Set the value
|
|
338
|
+
* yield* RefSubject.set(count, 10)
|
|
339
|
+
* const value = yield* count
|
|
340
|
+
* console.log(value) // 10
|
|
341
|
+
*
|
|
342
|
+
* // Can also use pipe syntax
|
|
343
|
+
* yield* count.pipe(RefSubject.set(20))
|
|
344
|
+
* const newValue = yield* count
|
|
345
|
+
* console.log(newValue) // 20
|
|
346
|
+
* })
|
|
347
|
+
* ```
|
|
348
|
+
*
|
|
349
|
+
* @since 1.0.0
|
|
350
|
+
* @category combinators
|
|
351
|
+
*/
|
|
352
|
+
export declare const set: {
|
|
353
|
+
<A>(value: A): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E, R>;
|
|
354
|
+
<A, E, R>(ref: RefSubject<A, E, R>, a: A): Effect.Effect<A, E, R>;
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* Resets a `RefSubject` to its initial value, returning the previous value if it existed.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```ts
|
|
361
|
+
* import { Effect, Option } from "effect"
|
|
362
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
363
|
+
*
|
|
364
|
+
* const program = Effect.gen(function* () {
|
|
365
|
+
* const count = yield* RefSubject.make(0)
|
|
366
|
+
*
|
|
367
|
+
* yield* RefSubject.set(count, 5)
|
|
368
|
+
* const before = yield* count
|
|
369
|
+
* console.log(before) // 5
|
|
370
|
+
*
|
|
371
|
+
* // Reset to initial value
|
|
372
|
+
* const previous = yield* RefSubject.reset(count)
|
|
373
|
+
* console.log(Option.isSome(previous)) // true
|
|
374
|
+
* console.log(previous.value) // 5
|
|
375
|
+
*
|
|
376
|
+
* const after = yield* count
|
|
377
|
+
* console.log(after) // 0
|
|
378
|
+
* })
|
|
379
|
+
* ```
|
|
380
|
+
*
|
|
381
|
+
* @since 1.0.0
|
|
382
|
+
* @category combinators
|
|
383
|
+
*/
|
|
384
|
+
export declare function reset<A, E, R>(ref: RefSubject<A, E, R>): Effect.Effect<Option.Option<A>, E, R>;
|
|
385
|
+
export {
|
|
386
|
+
/**
|
|
387
|
+
* Deletes the current value of a `RefSubject`, resetting it to its initial state.
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```ts
|
|
391
|
+
* import { Effect, Option } from "effect"
|
|
392
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
393
|
+
*
|
|
394
|
+
* const program = Effect.gen(function* () {
|
|
395
|
+
* const ref = yield* RefSubject.make(10)
|
|
396
|
+
* yield* RefSubject.set(ref, 20)
|
|
397
|
+
*
|
|
398
|
+
* // Delete the current value
|
|
399
|
+
* const deleted = yield* RefSubject.delete(ref)
|
|
400
|
+
* console.log(Option.isSome(deleted)) // true
|
|
401
|
+
* console.log(deleted.value) // 20
|
|
402
|
+
*
|
|
403
|
+
* // Value is reset to initial
|
|
404
|
+
* const current = yield* ref
|
|
405
|
+
* console.log(current) // 10
|
|
406
|
+
* })
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* @since 1.20.0
|
|
410
|
+
* @category combinators
|
|
411
|
+
*/
|
|
412
|
+
reset as delete, };
|
|
413
|
+
/**
|
|
414
|
+
* Updates a `RefSubject` using an `Effect`ful function.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```ts
|
|
418
|
+
* import { Effect } from "effect"
|
|
419
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
420
|
+
*
|
|
421
|
+
* const program = Effect.gen(function* () {
|
|
422
|
+
* const count = yield* RefSubject.make(5)
|
|
423
|
+
*
|
|
424
|
+
* // Update with an async operation
|
|
425
|
+
* yield* RefSubject.updateEffect(count, (value) =>
|
|
426
|
+
* Effect.succeed(value * 2)
|
|
427
|
+
* )
|
|
428
|
+
*
|
|
429
|
+
* const result = yield* count
|
|
430
|
+
* console.log(result) // 10
|
|
431
|
+
* })
|
|
432
|
+
* ```
|
|
433
|
+
*
|
|
434
|
+
* @since 1.0.0
|
|
435
|
+
* @category combinators
|
|
436
|
+
*/
|
|
437
|
+
export declare const updateEffect: {
|
|
438
|
+
<A, E2, R2>(f: (value: A) => Effect.Effect<A, E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E | E2, R | R2>;
|
|
439
|
+
<A, E, R, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<A, E2, R2>): Effect.Effect<A, E | E2, R | R2>;
|
|
440
|
+
};
|
|
441
|
+
/**
|
|
442
|
+
* Updates a `RefSubject` using a pure function.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* import { Effect } from "effect"
|
|
447
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
448
|
+
*
|
|
449
|
+
* const program = Effect.gen(function* () {
|
|
450
|
+
* const count = yield* RefSubject.make(5)
|
|
451
|
+
*
|
|
452
|
+
* // Increment by 1
|
|
453
|
+
* yield* RefSubject.update(count, (n) => n + 1)
|
|
454
|
+
* const value = yield* count
|
|
455
|
+
* console.log(value) // 6
|
|
456
|
+
*
|
|
457
|
+
* // Can also use pipe syntax
|
|
458
|
+
* yield* count.pipe(RefSubject.update((n) => n * 2))
|
|
459
|
+
* const doubled = yield* count
|
|
460
|
+
* console.log(doubled) // 12
|
|
461
|
+
* })
|
|
462
|
+
* ```
|
|
463
|
+
*
|
|
464
|
+
* @since 1.0.0
|
|
465
|
+
* @category combinators
|
|
466
|
+
*/
|
|
467
|
+
export declare const update: {
|
|
468
|
+
<A>(f: (value: A) => A): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E, R>;
|
|
469
|
+
<A, E, R>(ref: RefSubject<A, E, R>, f: (value: A) => A): Effect.Effect<A, E, R>;
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new value.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```ts
|
|
476
|
+
* import { Effect } from "effect"
|
|
477
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
478
|
+
*
|
|
479
|
+
* const program = Effect.gen(function* () {
|
|
480
|
+
* const count = yield* RefSubject.make(5)
|
|
481
|
+
*
|
|
482
|
+
* // Get the old value and set a new one, returning the old value
|
|
483
|
+
* const oldValue = yield* RefSubject.modifyEffect(count, (value) =>
|
|
484
|
+
* Effect.succeed([value, value + 10] as const)
|
|
485
|
+
* )
|
|
486
|
+
*
|
|
487
|
+
* console.log(oldValue) // 5
|
|
488
|
+
* const newValue = yield* count
|
|
489
|
+
* console.log(newValue) // 15
|
|
490
|
+
* })
|
|
491
|
+
* ```
|
|
492
|
+
*
|
|
493
|
+
* @since 1.0.0
|
|
494
|
+
* @category combinators
|
|
495
|
+
*/
|
|
496
|
+
export declare const modifyEffect: {
|
|
497
|
+
<A, B, E2, R2>(f: (value: A) => Effect.Effect<readonly [B, A], E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2, R | R2>;
|
|
498
|
+
<A, E, R, B, E2, R2>(ref: RefSubject<A, E, R>, f: (value: A) => Effect.Effect<readonly [B, A], E2, R2>): Effect.Effect<B, E | E2, R | R2>;
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Modifies a `RefSubject` using a pure function that returns both a result and a new value.
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```ts
|
|
505
|
+
* import { Effect } from "effect"
|
|
506
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
507
|
+
*
|
|
508
|
+
* const program = Effect.gen(function* () {
|
|
509
|
+
* const count = yield* RefSubject.make(5)
|
|
510
|
+
*
|
|
511
|
+
* // Get the old value and increment, returning the old value
|
|
512
|
+
* const oldValue = yield* RefSubject.modify(count, (value) => [value, value + 1] as const)
|
|
513
|
+
*
|
|
514
|
+
* console.log(oldValue) // 5
|
|
515
|
+
* const newValue = yield* count
|
|
516
|
+
* console.log(newValue) // 6
|
|
517
|
+
* })
|
|
518
|
+
* ```
|
|
519
|
+
*
|
|
520
|
+
* @since 1.0.0
|
|
521
|
+
* @category combinators
|
|
522
|
+
*/
|
|
523
|
+
export declare const modify: {
|
|
524
|
+
<A, B>(f: (value: A) => readonly [B, A]): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E, R>;
|
|
525
|
+
<A, E, R, B>(ref: RefSubject<A, E, R>, f: (value: A) => readonly [B, A]): Effect.Effect<B, E, R>;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Checks if a value is a `RefSubject`.
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```ts
|
|
532
|
+
* import { Effect } from "effect"
|
|
533
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
534
|
+
*
|
|
535
|
+
* const program = Effect.gen(function* () {
|
|
536
|
+
* const ref = yield* RefSubject.make(42)
|
|
537
|
+
* const isRef = RefSubject.isRefSubject(ref)
|
|
538
|
+
* console.log(isRef) // true
|
|
539
|
+
*
|
|
540
|
+
* const notRef = { value: 42 }
|
|
541
|
+
* const isNotRef = RefSubject.isRefSubject(notRef)
|
|
542
|
+
* console.log(isNotRef) // false
|
|
543
|
+
* })
|
|
544
|
+
* ```
|
|
545
|
+
*
|
|
546
|
+
* @since 1.0.0
|
|
547
|
+
* @category guards
|
|
548
|
+
*/
|
|
549
|
+
export declare function isRefSubject(value: any): value is RefSubject<any, any, any>;
|
|
550
|
+
/**
|
|
551
|
+
* Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```ts
|
|
555
|
+
* import { Effect } from "effect"
|
|
556
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
557
|
+
*
|
|
558
|
+
* const program = Effect.gen(function* () {
|
|
559
|
+
* const balance = yield* RefSubject.make(100)
|
|
560
|
+
*
|
|
561
|
+
* // Transfer money atomically with interrupt handling
|
|
562
|
+
* yield* RefSubject.runUpdates(
|
|
563
|
+
* balance,
|
|
564
|
+
* (ref) =>
|
|
565
|
+
* Effect.gen(function* () {
|
|
566
|
+
* const current = yield* ref.get
|
|
567
|
+
* if (current >= 50) {
|
|
568
|
+
* yield* ref.set(current - 50)
|
|
569
|
+
* return "Transfer successful"
|
|
570
|
+
* }
|
|
571
|
+
* return "Insufficient funds"
|
|
572
|
+
* }),
|
|
573
|
+
* {
|
|
574
|
+
* onInterrupt: (value) => Effect.sync(() => console.log(`Interrupted at balance: ${value}`)),
|
|
575
|
+
* value: "initial"
|
|
576
|
+
* }
|
|
577
|
+
* )
|
|
578
|
+
* })
|
|
579
|
+
* ```
|
|
580
|
+
*
|
|
581
|
+
* @since 1.0.0
|
|
582
|
+
* @category combinators
|
|
583
|
+
*/
|
|
584
|
+
export declare const runUpdates: {
|
|
585
|
+
<A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {
|
|
586
|
+
readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;
|
|
587
|
+
readonly value?: "initial" | "current";
|
|
588
|
+
}): (ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2 | E3, R | R2 | R3>;
|
|
589
|
+
<A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(ref: RefSubject<A, E, R>, f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {
|
|
590
|
+
readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;
|
|
591
|
+
readonly value?: "initial" | "current";
|
|
592
|
+
} | undefined): Effect.Effect<B, E | E2 | E3, R | R2 | R3>;
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* Increments a numeric `RefSubject` by 1.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```ts
|
|
599
|
+
* import { Effect } from "effect"
|
|
600
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
601
|
+
*
|
|
602
|
+
* const program = Effect.gen(function* () {
|
|
603
|
+
* const count = yield* RefSubject.make(0)
|
|
604
|
+
*
|
|
605
|
+
* yield* RefSubject.increment(count)
|
|
606
|
+
* const value = yield* count
|
|
607
|
+
* console.log(value) // 1
|
|
608
|
+
*
|
|
609
|
+
* yield* RefSubject.increment(count)
|
|
610
|
+
* const newValue = yield* count
|
|
611
|
+
* console.log(newValue) // 2
|
|
612
|
+
* })
|
|
613
|
+
* ```
|
|
614
|
+
*
|
|
615
|
+
* @since 1.0.0
|
|
616
|
+
* @category combinators
|
|
617
|
+
*/
|
|
618
|
+
export declare function increment<E, R>(ref: RefSubject<number, E, R>): Effect.Effect<number, E, R>;
|
|
619
|
+
/**
|
|
620
|
+
* Decrements a numeric `RefSubject` by 1.
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* ```ts
|
|
624
|
+
* import { Effect } from "effect"
|
|
625
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
626
|
+
*
|
|
627
|
+
* const program = Effect.gen(function* () {
|
|
628
|
+
* const count = yield* RefSubject.make(10)
|
|
629
|
+
*
|
|
630
|
+
* yield* RefSubject.decrement(count)
|
|
631
|
+
* const value = yield* count
|
|
632
|
+
* console.log(value) // 9
|
|
633
|
+
*
|
|
634
|
+
* yield* RefSubject.decrement(count)
|
|
635
|
+
* const newValue = yield* count
|
|
636
|
+
* console.log(newValue) // 8
|
|
637
|
+
* })
|
|
638
|
+
* ```
|
|
639
|
+
*
|
|
640
|
+
* @since 1.0.0
|
|
641
|
+
* @category combinators
|
|
642
|
+
*/
|
|
643
|
+
export declare function decrement<E, R>(ref: RefSubject<number, E, R>): Effect.Effect<number, E, R>;
|
|
644
|
+
export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => RefSubject.Class<Self, Id, A, E>;
|
|
645
|
+
/**
|
|
646
|
+
* Extract all values from an object using a Proxy.
|
|
647
|
+
* Allows accessing nested properties of a `Computed` or `Filtered` object/array as individual computed values.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```ts
|
|
651
|
+
* import { Effect } from "effect"
|
|
652
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
653
|
+
*
|
|
654
|
+
* const program = Effect.gen(function* () {
|
|
655
|
+
* const user = yield* RefSubject.make({ name: "Alice", age: 30 })
|
|
656
|
+
*
|
|
657
|
+
* // Create a proxy to access nested properties
|
|
658
|
+
* const proxied = RefSubject.proxy(user)
|
|
659
|
+
*
|
|
660
|
+
* // Access individual properties as Computed values
|
|
661
|
+
* const name = yield* proxied.name
|
|
662
|
+
* console.log(name) // "Alice"
|
|
663
|
+
*
|
|
664
|
+
* const age = yield* proxied.age
|
|
665
|
+
* console.log(age) // 30
|
|
666
|
+
*
|
|
667
|
+
* // Update the source
|
|
668
|
+
* yield* RefSubject.set(user, { name: "Bob", age: 25 })
|
|
669
|
+
*
|
|
670
|
+
* // Proxied values automatically update
|
|
671
|
+
* const newName = yield* proxied.name
|
|
672
|
+
* console.log(newName) // "Bob"
|
|
673
|
+
* })
|
|
674
|
+
* ```
|
|
675
|
+
*
|
|
676
|
+
* @since 2.0.0
|
|
677
|
+
* @category combinators
|
|
678
|
+
*/
|
|
679
|
+
export declare const proxy: {
|
|
680
|
+
<A extends ReadonlyArray<any> | Readonly<Record<PropertyKey, any>>, E, R>(source: Computed<A, E, R>): {
|
|
681
|
+
readonly [K in keyof A]: Computed<A[K], E, R>;
|
|
682
|
+
};
|
|
683
|
+
<A extends ReadonlyArray<any> | Readonly<Record<PropertyKey, any>>, E, R>(source: Filtered<A, E, R>): {
|
|
684
|
+
readonly [K in keyof A]: Filtered<A[K], E, R>;
|
|
685
|
+
};
|
|
686
|
+
};
|
|
687
|
+
export type Services<T> = T extends RefSubject<infer _A, infer _E, infer R> ? R : T extends Computed<infer _A, infer _E, infer R> ? R : T extends Filtered<infer _A, infer _E, infer R> ? R : never;
|
|
688
|
+
export type Error<T> = T extends RefSubject<infer _A, infer E, infer _R> ? E : T extends Computed<infer _A, infer E, infer _R> ? E : T extends Filtered<infer _A, infer E, infer _R> ? E : never;
|
|
689
|
+
export type Success<T> = T extends RefSubject<infer A, infer _E, infer _R> ? A : T extends Computed<infer A, infer _E, infer _R> ? A : T extends Filtered<infer A, infer _E, infer _R> ? A : never;
|
|
690
|
+
export type Identifier<T> = T extends RefSubject.Service<infer R, infer _Id, infer _A, infer _E> ? R : never;
|
|
691
|
+
/**
|
|
692
|
+
* Transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function.
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* ```ts
|
|
696
|
+
* import { Effect } from "effect"
|
|
697
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
698
|
+
*
|
|
699
|
+
* const program = Effect.gen(function* () {
|
|
700
|
+
* const count = yield* RefSubject.make(5)
|
|
701
|
+
*
|
|
702
|
+
* // Transform with an async operation
|
|
703
|
+
* const doubled = RefSubject.mapEffect(count, (n) =>
|
|
704
|
+
* Effect.succeed(n * 2)
|
|
705
|
+
* )
|
|
706
|
+
*
|
|
707
|
+
* const value = yield* doubled
|
|
708
|
+
* console.log(value) // 10
|
|
709
|
+
*
|
|
710
|
+
* // Update source
|
|
711
|
+
* yield* RefSubject.set(count, 7)
|
|
712
|
+
*
|
|
713
|
+
* // Computed automatically updates
|
|
714
|
+
* const newValue = yield* doubled
|
|
715
|
+
* console.log(newValue) // 14
|
|
716
|
+
* })
|
|
717
|
+
* ```
|
|
718
|
+
*
|
|
719
|
+
* @since 1.0.0
|
|
720
|
+
* @category combinators
|
|
721
|
+
*/
|
|
722
|
+
export declare const mapEffect: {
|
|
723
|
+
<T extends RefSubject.Any | Computed.Any | Filtered.Any, B, E2, R2>(f: (a: Success<T>) => Effect.Effect<B, E2, R2>): (ref: T) => T extends Filtered.Any ? Filtered<B, Error<T> | E2, Services<T> | R2> : Computed<B, Error<T> | E2, Services<T> | R2>;
|
|
724
|
+
<A, E, R, B, E2, R2>(ref: RefSubject<A, E, R> | Computed<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>): Computed<B, E | E2, R | R2>;
|
|
725
|
+
<A, E, R, B, E2, R2>(ref: Filtered<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>): Filtered<B, E | E2, R | R2>;
|
|
726
|
+
<R0, E0, A, E, R, E2, R2, C, E3, R3>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Effect.Effect<C, E3, R3>): Computed<C, E0 | E | E2 | E3, R0 | R2 | R3 | Exclude<R, Scope.Scope>>;
|
|
727
|
+
};
|
|
728
|
+
/**
|
|
729
|
+
* Transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function.
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* ```ts
|
|
733
|
+
* import { Effect } from "effect"
|
|
734
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
735
|
+
*
|
|
736
|
+
* const program = Effect.gen(function* () {
|
|
737
|
+
* const count = yield* RefSubject.make(5)
|
|
738
|
+
*
|
|
739
|
+
* // Create a computed that doubles the count
|
|
740
|
+
* const doubled = RefSubject.map(count, (n) => n * 2)
|
|
741
|
+
*
|
|
742
|
+
* const value = yield* doubled
|
|
743
|
+
* console.log(value) // 10
|
|
744
|
+
*
|
|
745
|
+
* // Update source
|
|
746
|
+
* yield* RefSubject.set(count, 7)
|
|
747
|
+
*
|
|
748
|
+
* // Computed automatically updates
|
|
749
|
+
* const newValue = yield* doubled
|
|
750
|
+
* console.log(newValue) // 14
|
|
751
|
+
* })
|
|
752
|
+
* ```
|
|
753
|
+
*
|
|
754
|
+
* @since 1.0.0
|
|
755
|
+
* @category combinators
|
|
756
|
+
*/
|
|
757
|
+
export declare const map: {
|
|
758
|
+
<T extends RefSubject.Any | Computed.Any | Filtered.Any, B>(f: (a: Success<T>) => B): (ref: T) => T extends Filtered.Any ? Filtered<B, Error<T>, Services<T>> : Computed<B, Error<T>, Services<T>>;
|
|
759
|
+
<A, E, R, B>(ref: RefSubject<A, E, R> | Computed<A, E, R>, f: (a: A) => B): Computed<B, E, R>;
|
|
760
|
+
<A, E, R, B>(filtered: Filtered<A, E, R>, f: (a: A) => B): Filtered<B, E, R>;
|
|
761
|
+
<R0, E0, A, E, R, B, E2, R2>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => B): Computed<B, E0 | E | E2, R0 | R2 | Exclude<R, Scope.Scope>> | Filtered<B, E0 | E | E2, R0 | R2 | Exclude<R, Scope.Scope>>;
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function that returns an `Option`.
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* ```ts
|
|
768
|
+
* import { Effect, Option } from "effect"
|
|
769
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
770
|
+
*
|
|
771
|
+
* const program = Effect.gen(function* () {
|
|
772
|
+
* const numbers = yield* RefSubject.make([1, 2, 3, 4, 5])
|
|
773
|
+
*
|
|
774
|
+
* // Find the first even number
|
|
775
|
+
* const firstEven = RefSubject.filterMapEffect(numbers, (arr) =>
|
|
776
|
+
* Effect.succeed(Option.fromNullable(arr.find((n) => n % 2 === 0)))
|
|
777
|
+
* )
|
|
778
|
+
*
|
|
779
|
+
* const value = yield* firstEven
|
|
780
|
+
* console.log(value) // 2
|
|
781
|
+
* })
|
|
782
|
+
* ```
|
|
783
|
+
*
|
|
784
|
+
* @since 1.0.0
|
|
785
|
+
* @category combinators
|
|
786
|
+
*/
|
|
787
|
+
export declare const filterMapEffect: {
|
|
788
|
+
<A, B, E2, R2>(f: (a: A) => Effect.Effect<Option.Option<B>, E2, R2>): {
|
|
789
|
+
<E, R>(ref: RefSubject<A, E, R> | Computed<A, E, R>): Filtered<B, E | E2, R | R2>;
|
|
790
|
+
<E, R>(ref: Filtered<A, E, R>): Filtered<B, E | E2, R | R2>;
|
|
791
|
+
<R0, E0, B, E, R, E2, R2>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Effect.Effect<Option.Option<B>, E2, R2>): Filtered<B, E0 | E | E2, R0 | R2>;
|
|
792
|
+
};
|
|
793
|
+
<A, E, R, B, E2, R2>(ref: RefSubject<A, E, R> | Computed<A, E, R> | Filtered<A, E, R>, f: (a: A) => Effect.Effect<Option.Option<B>, E2, R2>): Filtered<B, E | E2, R | R2>;
|
|
794
|
+
<R0, E0, A, E, R, B, E2, R2, R3, E3>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Effect.Effect<Option.Option<B>, E3, R3>): Filtered<B, E0 | E | E2 | E3, R0 | R2 | R3 | Exclude<R, Scope.Scope>>;
|
|
795
|
+
};
|
|
796
|
+
/**
|
|
797
|
+
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function that returns an `Option`.
|
|
798
|
+
*
|
|
799
|
+
* @example
|
|
800
|
+
* ```ts
|
|
801
|
+
* import { Effect, Option } from "effect"
|
|
802
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
803
|
+
*
|
|
804
|
+
* const program = Effect.gen(function* () {
|
|
805
|
+
* const numbers = yield* RefSubject.make([1, 2, 3, 4, 5])
|
|
806
|
+
*
|
|
807
|
+
* // Get the first even number
|
|
808
|
+
* const firstEven = RefSubject.filterMap(numbers, (arr) =>
|
|
809
|
+
* Option.fromNullable(arr.find((n) => n % 2 === 0))
|
|
810
|
+
* )
|
|
811
|
+
*
|
|
812
|
+
* const value = yield* firstEven
|
|
813
|
+
* console.log(value) // 2
|
|
814
|
+
* })
|
|
815
|
+
* ```
|
|
816
|
+
*
|
|
817
|
+
* @since 1.0.0
|
|
818
|
+
* @category combinators
|
|
819
|
+
*/
|
|
820
|
+
export declare const filterMap: {
|
|
821
|
+
<A, B>(f: (a: A) => Option.Option<B>): {
|
|
822
|
+
<E, R>(ref: RefSubject<A, E, R> | Computed<A, E, R> | Filtered<A, E, R>): Filtered<B, E, R>;
|
|
823
|
+
<R0, E0, B, E, R, E2, R2>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Option.Option<B>): Filtered<B, E0 | E | E2, R0 | R2>;
|
|
824
|
+
};
|
|
825
|
+
<R0, E0, A, E, R, B, E2, R2>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Option.Option<B>): Filtered<B, E0 | E | E2, R0 | R2 | Exclude<R, Scope.Scope>>;
|
|
826
|
+
<A, E, R, B>(ref: RefSubject<A, E, R> | Computed<A, E, R> | Filtered<A, E, R>, f: (a: A) => Option.Option<B>): Filtered<B, E, R>;
|
|
827
|
+
};
|
|
828
|
+
/**
|
|
829
|
+
* Converts a `Computed` or `Filtered` of `Option<A>` into a `Filtered<A>`, filtering out `None` values.
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* ```ts
|
|
833
|
+
* import { Effect, Option } from "effect"
|
|
834
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
835
|
+
*
|
|
836
|
+
* const program = Effect.gen(function* () {
|
|
837
|
+
* const maybeValue = yield* RefSubject.make(Option.some(42))
|
|
838
|
+
*
|
|
839
|
+
* // Compact the Option
|
|
840
|
+
* const filtered = RefSubject.compact(maybeValue)
|
|
841
|
+
*
|
|
842
|
+
* const value = yield* filtered
|
|
843
|
+
* console.log(value) // 42
|
|
844
|
+
*
|
|
845
|
+
* // If the Option becomes None, the Filtered will fail
|
|
846
|
+
* yield* RefSubject.set(maybeValue, Option.none())
|
|
847
|
+
* // yield* filtered would fail with NoSuchElementError
|
|
848
|
+
* })
|
|
849
|
+
* ```
|
|
850
|
+
*
|
|
851
|
+
* @since 1.0.0
|
|
852
|
+
* @category combinators
|
|
853
|
+
*/
|
|
854
|
+
export declare const compact: {
|
|
855
|
+
<A, E, R>(ref: Computed<Option.Option<A>, E, R>): Filtered<A>;
|
|
856
|
+
<A, E, R>(ref: Filtered<Option.Option<A>, E, R>): Filtered<A>;
|
|
857
|
+
<R0, E0, A, E, R, E2, R2>(versioned: Versioned.Versioned<R0, E0, Option.Option<A>, E, R, Option.Option<A>, E2, R2>): Filtered<A, E0 | E | Exclude<E, Cause.NoSuchElementError> | Exclude<E2, Cause.NoSuchElementError>, R0 | R2 | Exclude<R, Scope.Scope>>;
|
|
858
|
+
};
|
|
859
|
+
export declare const slice: {
|
|
860
|
+
(skip: number, take: number): <A, E, R>(ref: RefSubject<A, E, R>) => RefSubject<A, E, R>;
|
|
861
|
+
<A, E, R>(ref: RefSubject<A, E, R>, skip: number, take: number): RefSubject<A, E, R>;
|
|
862
|
+
};
|
|
863
|
+
/**
|
|
864
|
+
* Transforms a `RefSubject` invariantly using bidirectional mapping functions.
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* ```ts
|
|
868
|
+
* import { Effect } from "effect"
|
|
869
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
870
|
+
*
|
|
871
|
+
* const program = Effect.gen(function* () {
|
|
872
|
+
* const count = yield* RefSubject.make(5)
|
|
873
|
+
*
|
|
874
|
+
* // Transform to string and back
|
|
875
|
+
* const countStr = RefSubject.transform(
|
|
876
|
+
* count,
|
|
877
|
+
* (n) => n.toString(),
|
|
878
|
+
* (s) => parseInt(s, 10)
|
|
879
|
+
* )
|
|
880
|
+
*
|
|
881
|
+
* const value = yield* countStr
|
|
882
|
+
* console.log(value) // "5"
|
|
883
|
+
*
|
|
884
|
+
* // Set using the transformed type
|
|
885
|
+
* yield* RefSubject.set(countStr, "10")
|
|
886
|
+
*
|
|
887
|
+
* // Original reflects the change
|
|
888
|
+
* const original = yield* count
|
|
889
|
+
* console.log(original) // 10
|
|
890
|
+
* })
|
|
891
|
+
* ```
|
|
892
|
+
*
|
|
893
|
+
* @since 1.0.0
|
|
894
|
+
* @category combinators
|
|
895
|
+
*/
|
|
896
|
+
export declare const transform: {
|
|
897
|
+
<A, B>(toB: (a: A) => B, toA: (b: B) => A): <E, R>(ref: RefSubject<A, E, R>) => RefSubject<B, E, R>;
|
|
898
|
+
<A, E, R, B>(ref: RefSubject<A, E, R>, toB: (a: A) => B, toA: (b: B) => A): RefSubject<B, E, R>;
|
|
899
|
+
};
|
|
900
|
+
type RefKind = "r" | "c" | "f";
|
|
901
|
+
type StructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = {
|
|
902
|
+
c: [ComputedStructFrom<Refs>] extends [Computed<infer A, infer E, infer R>] ? Computed<A, E, R> : never;
|
|
903
|
+
f: [FilteredStructFrom<Refs>] extends [Filtered<infer A, infer E, infer R>] ? Filtered<A, E, R> : never;
|
|
904
|
+
r: [RefSubjectStructFrom<Refs>] extends [RefSubject<infer A, infer E, infer R>] ? RefSubject<A, E, R> : never;
|
|
905
|
+
}[GetStructKind<Refs>];
|
|
906
|
+
type GetStructKind<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = MergeKinds<UnionToTuple<{
|
|
907
|
+
[K in keyof Refs]: MatchKind<Refs[K]>;
|
|
908
|
+
}[keyof Refs]>>;
|
|
909
|
+
type Ref = RefSubject.Any | Computed.Any | Filtered.Any;
|
|
910
|
+
type MatchKind<T extends Ref> = [T] extends [Filtered.Any] ? "f" : [T] extends [RefSubject.Any] ? "r" : "c";
|
|
911
|
+
type MergeKind<A extends RefKind, B extends RefKind> = A extends "f" ? A : B extends "f" ? B : A extends "r" ? B : B extends "r" ? A : "c";
|
|
912
|
+
type MergeKinds<Kinds extends ReadonlyArray<any>> = Kinds extends readonly [
|
|
913
|
+
infer Head extends RefKind,
|
|
914
|
+
...infer Tail extends ReadonlyArray<RefKind>
|
|
915
|
+
] ? MergeKind<Head, MergeKinds<Tail>> : "r";
|
|
916
|
+
type FilteredStructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = Filtered<{
|
|
917
|
+
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
918
|
+
}, FxError<Refs[keyof Refs]>, Effect.Services<Refs[keyof Refs]>>;
|
|
919
|
+
type ComputedStructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = Computed<{
|
|
920
|
+
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
921
|
+
}, Effect.Error<Refs[keyof Refs]>, Effect.Services<Refs[keyof Refs]>>;
|
|
922
|
+
type RefSubjectStructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = RefSubject<{
|
|
923
|
+
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
924
|
+
}, Effect.Error<Refs[keyof Refs]>, Effect.Services<Refs[keyof Refs]>>;
|
|
925
|
+
type TupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> | Computed<any, any, any> | Filtered<any, any, any>>> = {
|
|
926
|
+
c: [ComputedTupleFrom<Refs>] extends [Computed<infer A, infer E, infer R>] ? Computed<A, E, R> : never;
|
|
927
|
+
f: [FilteredTupleFrom<Refs>] extends [Filtered<infer A, infer E, infer R>] ? Filtered<A, E, R> : never;
|
|
928
|
+
r: [RefSubjectTupleFrom<Refs>] extends [RefSubject<infer A, infer E, infer R>] ? RefSubject<A, E, R> : never;
|
|
929
|
+
}[GetTupleKind<Refs>];
|
|
930
|
+
type GetTupleKind<Refs extends ReadonlyArray<Ref>, Kind extends RefKind = "r"> = Refs extends readonly [infer Head extends Ref, ...infer Tail extends ReadonlyArray<Ref>] ? GetTupleKind<Tail, MergeKind<Kind, MatchKind<Head>>> : Kind;
|
|
931
|
+
type FilteredTupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> | Computed<any, any, any> | Filtered<any, any, any>>> = Filtered<{
|
|
932
|
+
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
933
|
+
}, FxError<Refs[number]>, Effect.Services<Refs[number]>>;
|
|
934
|
+
type ComputedTupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> | Computed<any, any, any> | Filtered<any, any, any>>> = Computed<{
|
|
935
|
+
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
936
|
+
}, Effect.Error<Refs[number]>, Effect.Services<Refs[number]>>;
|
|
937
|
+
type RefSubjectTupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> | Computed<any, any, any> | Filtered<any, any, any>>> = RefSubject<{
|
|
938
|
+
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
939
|
+
}, Effect.Error<Refs[number]>, Effect.Services<Refs[number]>>;
|
|
940
|
+
/**
|
|
941
|
+
* Combines multiple `RefSubject`, `Computed`, or `Filtered` instances into a single struct.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```ts
|
|
945
|
+
* import { Effect } from "effect"
|
|
946
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
947
|
+
*
|
|
948
|
+
* const program = Effect.gen(function* () {
|
|
949
|
+
* const firstName = yield* RefSubject.make("Alice")
|
|
950
|
+
* const lastName = yield* RefSubject.make("Smith")
|
|
951
|
+
* const age = yield* RefSubject.make(30)
|
|
952
|
+
*
|
|
953
|
+
* // Combine into a struct
|
|
954
|
+
* const person = RefSubject.struct({
|
|
955
|
+
* firstName,
|
|
956
|
+
* lastName,
|
|
957
|
+
* age
|
|
958
|
+
* })
|
|
959
|
+
*
|
|
960
|
+
* const fullPerson = yield* person
|
|
961
|
+
* console.log(fullPerson) // { firstName: "Alice", lastName: "Smith", age: 30 }
|
|
962
|
+
*
|
|
963
|
+
* // Update one field
|
|
964
|
+
* yield* RefSubject.set(firstName, "Bob")
|
|
965
|
+
*
|
|
966
|
+
* // Struct automatically updates
|
|
967
|
+
* const updated = yield* person
|
|
968
|
+
* console.log(updated.firstName) // "Bob"
|
|
969
|
+
* })
|
|
970
|
+
* ```
|
|
971
|
+
*
|
|
972
|
+
* @since 1.0.0
|
|
973
|
+
* @category combinators
|
|
974
|
+
*/
|
|
975
|
+
export declare function struct<const Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>>(refs: Refs): StructFrom<Refs>;
|
|
976
|
+
/**
|
|
977
|
+
* Combines multiple `RefSubject`, `Computed`, or `Filtered` instances into a single tuple.
|
|
978
|
+
*
|
|
979
|
+
* @example
|
|
980
|
+
* ```ts
|
|
981
|
+
* import { Effect } from "effect"
|
|
982
|
+
* import * as RefSubject from "@typed/fx/RefSubject"
|
|
983
|
+
*
|
|
984
|
+
* const program = Effect.gen(function* () {
|
|
985
|
+
* const x = yield* RefSubject.make(10)
|
|
986
|
+
* const y = yield* RefSubject.make(20)
|
|
987
|
+
* const z = yield* RefSubject.make(30)
|
|
988
|
+
*
|
|
989
|
+
* // Combine into a tuple
|
|
990
|
+
* const point = RefSubject.tuple([x, y, z])
|
|
991
|
+
*
|
|
992
|
+
* const coords = yield* point
|
|
993
|
+
* console.log(coords) // [10, 20, 30]
|
|
994
|
+
*
|
|
995
|
+
* // Update one value
|
|
996
|
+
* yield* RefSubject.set(x, 15)
|
|
997
|
+
*
|
|
998
|
+
* // Tuple automatically updates
|
|
999
|
+
* const updated = yield* point
|
|
1000
|
+
* console.log(updated) // [15, 20, 30]
|
|
1001
|
+
* })
|
|
1002
|
+
* ```
|
|
1003
|
+
*
|
|
1004
|
+
* @since 1.0.0
|
|
1005
|
+
* @category combinators
|
|
1006
|
+
*/
|
|
1007
|
+
export declare function tuple<const Refs extends ReadonlyArray<Ref>>(refs: Refs): TupleFrom<Refs>;
|
|
1008
|
+
export declare function computedFromService<R, A, E, R2>(effect: Effect.Effect<Computed<A, E, R2>, never, R>): Computed<A, E, R | R2>;
|
|
1009
|
+
export declare function filteredFromService<R, A, E, R2>(effect: Effect.Effect<Filtered<A, E, R2>, never, R>): Filtered<A, E, R | R2>;
|
|
1010
|
+
//# sourceMappingURL=RefSubject.d.ts.map
|