@typed/fx 2.0.0-beta.3 → 2.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -20
- package/dist/Fx/Fx.d.ts +364 -12
- package/dist/Fx/Fx.d.ts.map +1 -1
- package/dist/Fx/Fx.js +37 -6
- package/dist/Fx/TypeId.d.ts +49 -3
- package/dist/Fx/TypeId.d.ts.map +1 -1
- package/dist/Fx/TypeId.js +39 -2
- package/dist/Fx/combinators/additive.d.ts +156 -5
- package/dist/Fx/combinators/additive.d.ts.map +1 -1
- package/dist/Fx/combinators/additive.js +156 -5
- package/dist/Fx/combinators/catch.d.ts +195 -22
- package/dist/Fx/combinators/catch.d.ts.map +1 -1
- package/dist/Fx/combinators/catch.js +186 -16
- package/dist/Fx/combinators/causes.d.ts +24 -1
- package/dist/Fx/combinators/causes.d.ts.map +1 -1
- package/dist/Fx/combinators/causes.js +24 -1
- package/dist/Fx/combinators/changesWithEffect.d.ts +20 -0
- package/dist/Fx/combinators/changesWithEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/changesWithEffect.js +20 -0
- package/dist/Fx/combinators/compact.d.ts +17 -0
- package/dist/Fx/combinators/compact.d.ts.map +1 -1
- package/dist/Fx/combinators/compact.js +17 -0
- package/dist/Fx/combinators/concatMap.d.ts +86 -0
- package/dist/Fx/combinators/concatMap.d.ts.map +1 -0
- package/dist/Fx/combinators/concatMap.js +86 -0
- package/dist/Fx/combinators/continueWith.d.ts +109 -1
- package/dist/Fx/combinators/continueWith.d.ts.map +1 -1
- package/dist/Fx/combinators/continueWith.js +109 -1
- package/dist/Fx/combinators/debounce.d.ts +34 -0
- package/dist/Fx/combinators/debounce.d.ts.map +1 -0
- package/dist/Fx/combinators/debounce.js +35 -0
- package/dist/Fx/combinators/delay.d.ts +34 -0
- package/dist/Fx/combinators/delay.d.ts.map +1 -0
- package/dist/Fx/combinators/delay.js +31 -0
- package/dist/Fx/combinators/dropUntil.d.ts +42 -0
- package/dist/Fx/combinators/dropUntil.d.ts.map +1 -1
- package/dist/Fx/combinators/dropUntil.js +42 -0
- package/dist/Fx/combinators/during.d.ts +38 -0
- package/dist/Fx/combinators/during.d.ts.map +1 -0
- package/dist/Fx/combinators/during.js +85 -0
- package/dist/Fx/combinators/ensuring.d.ts +33 -3
- package/dist/Fx/combinators/ensuring.d.ts.map +1 -1
- package/dist/Fx/combinators/ensuring.js +33 -3
- package/dist/Fx/combinators/exhaustLatestMap.d.ts +40 -4
- package/dist/Fx/combinators/exhaustLatestMap.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustLatestMap.js +40 -4
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts +39 -3
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustLatestMapEffect.js +39 -3
- package/dist/Fx/combinators/exhaustMap.d.ts +37 -0
- package/dist/Fx/combinators/exhaustMap.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustMap.js +37 -0
- package/dist/Fx/combinators/exhaustMapEffect.d.ts +32 -0
- package/dist/Fx/combinators/exhaustMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustMapEffect.js +32 -0
- package/dist/Fx/combinators/exit.d.ts +22 -1
- package/dist/Fx/combinators/exit.d.ts.map +1 -1
- package/dist/Fx/combinators/exit.js +22 -1
- package/dist/Fx/combinators/filter.d.ts +16 -0
- package/dist/Fx/combinators/filter.d.ts.map +1 -1
- package/dist/Fx/combinators/filter.js +16 -0
- package/dist/Fx/combinators/filterEffect.d.ts +21 -0
- package/dist/Fx/combinators/filterEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterEffect.js +21 -0
- package/dist/Fx/combinators/filterMap.d.ts +19 -0
- package/dist/Fx/combinators/filterMap.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMap.js +19 -0
- package/dist/Fx/combinators/filterMapEffect.d.ts +20 -0
- package/dist/Fx/combinators/filterMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapEffect.js +20 -0
- package/dist/Fx/combinators/filterMapLoop.d.ts +19 -0
- package/dist/Fx/combinators/filterMapLoop.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoop.js +19 -0
- package/dist/Fx/combinators/filterMapLoopCause.d.ts +20 -0
- package/dist/Fx/combinators/filterMapLoopCause.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopCause.js +20 -0
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts +20 -0
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopCauseEffect.js +20 -0
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts +20 -0
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopEffect.js +20 -0
- package/dist/Fx/combinators/flatMap.d.ts +48 -3
- package/dist/Fx/combinators/flatMap.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMap.js +35 -2
- package/dist/Fx/combinators/flatMapConcurrently.d.ts +50 -3
- package/dist/Fx/combinators/flatMapConcurrently.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapConcurrently.js +47 -1
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts +47 -3
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.js +39 -1
- package/dist/Fx/combinators/flatMapEffect.d.ts +44 -2
- package/dist/Fx/combinators/flatMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapEffect.js +31 -1
- package/dist/Fx/combinators/flip.d.ts +33 -1
- package/dist/Fx/combinators/flip.d.ts.map +1 -1
- package/dist/Fx/combinators/flip.js +33 -1
- package/dist/Fx/combinators/gen.d.ts +28 -9
- package/dist/Fx/combinators/gen.d.ts.map +1 -1
- package/dist/Fx/combinators/gen.js +27 -3
- package/dist/Fx/combinators/genScoped.d.ts +32 -9
- package/dist/Fx/combinators/genScoped.d.ts.map +1 -1
- package/dist/Fx/combinators/genScoped.js +30 -2
- package/dist/Fx/combinators/grouped.d.ts +89 -0
- package/dist/Fx/combinators/grouped.d.ts.map +1 -0
- package/dist/Fx/combinators/grouped.js +146 -0
- package/dist/Fx/combinators/index.d.ts +35 -0
- package/dist/Fx/combinators/index.d.ts.map +1 -1
- package/dist/Fx/combinators/index.js +35 -0
- package/dist/Fx/combinators/keyed.d.ts +121 -7
- package/dist/Fx/combinators/keyed.d.ts.map +1 -1
- package/dist/Fx/combinators/keyed.js +68 -10
- package/dist/Fx/combinators/loop.d.ts +16 -0
- package/dist/Fx/combinators/loop.d.ts.map +1 -1
- package/dist/Fx/combinators/loop.js +16 -0
- package/dist/Fx/combinators/loopCause.d.ts +17 -0
- package/dist/Fx/combinators/loopCause.d.ts.map +1 -1
- package/dist/Fx/combinators/loopCause.js +17 -0
- package/dist/Fx/combinators/loopCauseEffect.d.ts +18 -0
- package/dist/Fx/combinators/loopCauseEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/loopCauseEffect.js +18 -0
- package/dist/Fx/combinators/loopEffect.d.ts +23 -0
- package/dist/Fx/combinators/loopEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/loopEffect.js +23 -0
- package/dist/Fx/combinators/map.d.ts +45 -0
- package/dist/Fx/combinators/map.d.ts.map +1 -1
- package/dist/Fx/combinators/map.js +42 -0
- package/dist/Fx/combinators/mapBoth.d.ts +19 -0
- package/dist/Fx/combinators/mapBoth.d.ts.map +1 -1
- package/dist/Fx/combinators/mapBoth.js +19 -0
- package/dist/Fx/combinators/mapEffect.d.ts +24 -0
- package/dist/Fx/combinators/mapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/mapEffect.js +24 -0
- package/dist/Fx/combinators/mapError.d.ts +20 -4
- package/dist/Fx/combinators/mapError.d.ts.map +1 -1
- package/dist/Fx/combinators/mapError.js +20 -4
- package/dist/Fx/combinators/mergeAll.d.ts +34 -0
- package/dist/Fx/combinators/mergeAll.d.ts.map +1 -1
- package/dist/Fx/combinators/mergeAll.js +34 -0
- package/dist/Fx/combinators/mergeOrdered.d.ts +35 -3
- package/dist/Fx/combinators/mergeOrdered.d.ts.map +1 -1
- package/dist/Fx/combinators/mergeOrdered.js +35 -3
- package/dist/Fx/combinators/onError.d.ts +33 -3
- package/dist/Fx/combinators/onError.d.ts.map +1 -1
- package/dist/Fx/combinators/onError.js +33 -3
- package/dist/Fx/combinators/onExit.d.ts +28 -2
- package/dist/Fx/combinators/onExit.d.ts.map +1 -1
- package/dist/Fx/combinators/onExit.js +28 -2
- package/dist/Fx/combinators/onInterrupt.d.ts +48 -3
- package/dist/Fx/combinators/onInterrupt.d.ts.map +1 -1
- package/dist/Fx/combinators/onInterrupt.js +48 -3
- package/dist/Fx/combinators/pairwise.d.ts +28 -0
- package/dist/Fx/combinators/pairwise.d.ts.map +1 -0
- package/dist/Fx/combinators/pairwise.js +31 -0
- package/dist/Fx/combinators/provide.d.ts +138 -17
- package/dist/Fx/combinators/provide.d.ts.map +1 -1
- package/dist/Fx/combinators/provide.js +134 -13
- package/dist/Fx/combinators/race.d.ts +92 -0
- package/dist/Fx/combinators/race.d.ts.map +1 -0
- package/dist/Fx/combinators/race.js +149 -0
- package/dist/Fx/combinators/repeat.d.ts +41 -0
- package/dist/Fx/combinators/repeat.d.ts.map +1 -0
- package/dist/Fx/combinators/repeat.js +57 -0
- package/dist/Fx/combinators/result.d.ts +22 -0
- package/dist/Fx/combinators/result.d.ts.map +1 -1
- package/dist/Fx/combinators/result.js +26 -12
- package/dist/Fx/combinators/retry.d.ts +53 -0
- package/dist/Fx/combinators/retry.d.ts.map +1 -0
- package/dist/Fx/combinators/retry.js +71 -0
- package/dist/Fx/combinators/sample.d.ts +31 -0
- package/dist/Fx/combinators/sample.d.ts.map +1 -0
- package/dist/Fx/combinators/sample.js +42 -0
- package/dist/Fx/combinators/scan.d.ts +39 -0
- package/dist/Fx/combinators/scan.d.ts.map +1 -1
- package/dist/Fx/combinators/scan.js +41 -2
- package/dist/Fx/combinators/since.d.ts +30 -0
- package/dist/Fx/combinators/since.d.ts.map +1 -0
- package/dist/Fx/combinators/since.js +39 -0
- package/dist/Fx/combinators/skip.d.ts +31 -0
- package/dist/Fx/combinators/skip.d.ts.map +1 -1
- package/dist/Fx/combinators/skip.js +31 -0
- package/dist/Fx/combinators/skipRepeats.d.ts +16 -0
- package/dist/Fx/combinators/skipRepeats.d.ts.map +1 -1
- package/dist/Fx/combinators/skipRepeats.js +16 -0
- package/dist/Fx/combinators/skipRepeatsWith.d.ts +17 -0
- package/dist/Fx/combinators/skipRepeatsWith.d.ts.map +1 -1
- package/dist/Fx/combinators/skipRepeatsWith.js +17 -0
- package/dist/Fx/combinators/skipWhile.d.ts +68 -0
- package/dist/Fx/combinators/skipWhile.d.ts.map +1 -1
- package/dist/Fx/combinators/skipWhile.js +68 -0
- package/dist/Fx/combinators/slice.d.ts +82 -0
- package/dist/Fx/combinators/slice.d.ts.map +1 -1
- package/dist/Fx/combinators/slice.js +33 -0
- package/dist/Fx/combinators/switchMap.d.ts +38 -0
- package/dist/Fx/combinators/switchMap.d.ts.map +1 -1
- package/dist/Fx/combinators/switchMap.js +42 -4
- package/dist/Fx/combinators/switchMapEffect.d.ts +37 -0
- package/dist/Fx/combinators/switchMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/switchMapEffect.js +37 -0
- package/dist/Fx/combinators/take.d.ts +32 -0
- package/dist/Fx/combinators/take.d.ts.map +1 -1
- package/dist/Fx/combinators/take.js +32 -0
- package/dist/Fx/combinators/takeUntil.d.ts +46 -0
- package/dist/Fx/combinators/takeUntil.d.ts.map +1 -1
- package/dist/Fx/combinators/takeUntil.js +46 -0
- package/dist/Fx/combinators/takeWhile.d.ts +31 -0
- package/dist/Fx/combinators/takeWhile.d.ts.map +1 -1
- package/dist/Fx/combinators/takeWhile.js +31 -0
- package/dist/Fx/combinators/tapEffect.d.ts +16 -0
- package/dist/Fx/combinators/tapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/tapEffect.js +16 -0
- package/dist/Fx/combinators/throttle.d.ts +79 -0
- package/dist/Fx/combinators/throttle.d.ts.map +1 -0
- package/dist/Fx/combinators/throttle.js +99 -0
- package/dist/Fx/combinators/timeout.d.ts +76 -0
- package/dist/Fx/combinators/timeout.d.ts.map +1 -0
- package/dist/Fx/combinators/timeout.js +110 -0
- package/dist/Fx/combinators/tuple.d.ts +30 -0
- package/dist/Fx/combinators/tuple.d.ts.map +1 -1
- package/dist/Fx/combinators/tuple.js +34 -3
- package/dist/Fx/combinators/until.d.ts +27 -0
- package/dist/Fx/combinators/until.d.ts.map +1 -0
- package/dist/Fx/combinators/until.js +56 -0
- package/dist/Fx/combinators/unwrap.d.ts +29 -0
- package/dist/Fx/combinators/unwrap.d.ts.map +1 -1
- package/dist/Fx/combinators/unwrap.js +29 -0
- package/dist/Fx/combinators/unwrapScoped.d.ts +33 -0
- package/dist/Fx/combinators/unwrapScoped.d.ts.map +1 -1
- package/dist/Fx/combinators/unwrapScoped.js +33 -0
- package/dist/Fx/combinators/when.d.ts +35 -0
- package/dist/Fx/combinators/when.d.ts.map +1 -1
- package/dist/Fx/combinators/when.js +36 -1
- package/dist/Fx/combinators/withLatestFrom.d.ts +58 -0
- package/dist/Fx/combinators/withLatestFrom.d.ts.map +1 -0
- package/dist/Fx/combinators/withLatestFrom.js +68 -0
- package/dist/Fx/combinators/withSpan.d.ts +35 -1
- package/dist/Fx/combinators/withSpan.d.ts.map +1 -1
- package/dist/Fx/combinators/withSpan.js +34 -3
- package/dist/Fx/combinators/zip.d.ts +60 -0
- package/dist/Fx/combinators/zip.d.ts.map +1 -1
- package/dist/Fx/combinators/zip.js +60 -0
- package/dist/Fx/constructors/at.d.ts +20 -0
- package/dist/Fx/constructors/at.d.ts.map +1 -1
- package/dist/Fx/constructors/at.js +20 -0
- package/dist/Fx/constructors/die.d.ts +21 -0
- package/dist/Fx/constructors/die.d.ts.map +1 -1
- package/dist/Fx/constructors/die.js +21 -0
- package/dist/Fx/constructors/empty.d.ts +18 -0
- package/dist/Fx/constructors/empty.d.ts.map +1 -1
- package/dist/Fx/constructors/empty.js +18 -0
- package/dist/Fx/constructors/fail.d.ts +21 -0
- package/dist/Fx/constructors/fail.d.ts.map +1 -1
- package/dist/Fx/constructors/fail.js +21 -0
- package/dist/Fx/constructors/failCause.d.ts +22 -0
- package/dist/Fx/constructors/failCause.d.ts.map +1 -1
- package/dist/Fx/constructors/failCause.js +22 -0
- package/dist/Fx/constructors/fn.d.ts +113 -13
- package/dist/Fx/constructors/fn.d.ts.map +1 -1
- package/dist/Fx/constructors/fn.js +36 -0
- package/dist/Fx/constructors/fromEffect.d.ts +43 -1
- package/dist/Fx/constructors/fromEffect.d.ts.map +1 -1
- package/dist/Fx/constructors/fromEffect.js +43 -1
- package/dist/Fx/constructors/fromFailures.d.ts +24 -0
- package/dist/Fx/constructors/fromFailures.d.ts.map +1 -1
- package/dist/Fx/constructors/fromFailures.js +24 -0
- package/dist/Fx/constructors/fromIterable.d.ts +22 -0
- package/dist/Fx/constructors/fromIterable.d.ts.map +1 -1
- package/dist/Fx/constructors/fromIterable.js +22 -0
- package/dist/Fx/constructors/fromSchedule.d.ts +23 -0
- package/dist/Fx/constructors/fromSchedule.d.ts.map +1 -1
- package/dist/Fx/constructors/fromSchedule.js +25 -2
- package/dist/Fx/constructors/index.d.ts +2 -1
- package/dist/Fx/constructors/index.d.ts.map +1 -1
- package/dist/Fx/constructors/index.js +2 -1
- package/dist/Fx/constructors/interrupt.d.ts +21 -1
- package/dist/Fx/constructors/interrupt.d.ts.map +1 -1
- package/dist/Fx/constructors/interrupt.js +21 -1
- package/dist/Fx/constructors/make.d.ts +146 -1
- package/dist/Fx/constructors/make.d.ts.map +1 -1
- package/dist/Fx/constructors/make.js +56 -5
- package/dist/Fx/constructors/periodic.d.ts +29 -0
- package/dist/Fx/constructors/periodic.d.ts.map +1 -1
- package/dist/Fx/constructors/periodic.js +29 -0
- package/dist/Fx/constructors/succeed.d.ts +75 -3
- package/dist/Fx/constructors/succeed.d.ts.map +1 -1
- package/dist/Fx/constructors/succeed.js +75 -3
- package/dist/Fx/constructors/suspend.d.ts +28 -0
- package/dist/Fx/constructors/suspend.d.ts.map +1 -1
- package/dist/Fx/constructors/suspend.js +28 -0
- package/dist/Fx/constructors/sync.d.ts +32 -0
- package/dist/Fx/constructors/sync.d.ts.map +1 -0
- package/dist/Fx/constructors/sync.js +32 -0
- package/dist/Fx/internal/DeferredRef.d.ts +259 -7
- package/dist/Fx/internal/DeferredRef.d.ts.map +1 -1
- package/dist/Fx/internal/DeferredRef.js +260 -9
- package/dist/Fx/internal/UnionToTuple.d.ts +22 -0
- package/dist/Fx/internal/UnionToTuple.d.ts.map +1 -1
- package/dist/Fx/internal/diff.d.ts +586 -0
- package/dist/Fx/internal/diff.d.ts.map +1 -1
- package/dist/Fx/internal/diff.js +120 -9
- package/dist/Fx/internal/effectableEvaluateKey.d.ts +30 -0
- package/dist/Fx/internal/effectableEvaluateKey.d.ts.map +1 -0
- package/dist/Fx/internal/effectableEvaluateKey.js +29 -0
- package/dist/Fx/internal/effectableWithOverride.d.ts +55 -0
- package/dist/Fx/internal/effectableWithOverride.d.ts.map +1 -0
- package/dist/Fx/internal/effectableWithOverride.js +46 -0
- package/dist/Fx/internal/equivalence.d.ts +29 -0
- package/dist/Fx/internal/equivalence.d.ts.map +1 -1
- package/dist/Fx/internal/equivalence.js +29 -0
- package/dist/Fx/internal/multicast.d.ts +145 -2
- package/dist/Fx/internal/multicast.d.ts.map +1 -1
- package/dist/Fx/internal/multicast.js +146 -4
- package/dist/Fx/internal/ring-buffer.d.ts +149 -0
- package/dist/Fx/internal/ring-buffer.d.ts.map +1 -1
- package/dist/Fx/internal/ring-buffer.js +155 -0
- package/dist/Fx/internal/scope.d.ts +184 -0
- package/dist/Fx/internal/scope.d.ts.map +1 -1
- package/dist/Fx/internal/scope.js +150 -0
- package/dist/Fx/internal/yieldable.d.ts +117 -2
- package/dist/Fx/internal/yieldable.d.ts.map +1 -1
- package/dist/Fx/internal/yieldable.js +86 -3
- package/dist/Fx/run/collect.d.ts +89 -0
- package/dist/Fx/run/collect.d.ts.map +1 -1
- package/dist/Fx/run/collect.js +90 -1
- package/dist/Fx/run/first.d.ts +22 -0
- package/dist/Fx/run/first.d.ts.map +1 -1
- package/dist/Fx/run/first.js +22 -0
- package/dist/Fx/run/fork.d.ts +50 -0
- package/dist/Fx/run/fork.d.ts.map +1 -1
- package/dist/Fx/run/fork.js +50 -0
- package/dist/Fx/run/observe.d.ts +106 -0
- package/dist/Fx/run/observe.d.ts.map +1 -1
- package/dist/Fx/run/observe.js +108 -2
- package/dist/Fx/run/runPromise.d.ts +43 -0
- package/dist/Fx/run/runPromise.d.ts.map +1 -1
- package/dist/Fx/run/runPromise.js +43 -0
- package/dist/Fx/stream.d.ts +92 -0
- package/dist/Fx/stream.d.ts.map +1 -1
- package/dist/Fx/stream.js +60 -1
- package/dist/Push/Push.d.ts +1219 -94
- package/dist/Push/Push.d.ts.map +1 -1
- package/dist/Push/Push.js +1015 -86
- package/dist/RefArray.d.ts +2 -0
- package/dist/RefArray.d.ts.map +1 -0
- package/dist/RefArray.js +1 -0
- package/dist/RefBigDecimal.d.ts +2 -0
- package/dist/RefBigDecimal.d.ts.map +1 -0
- package/dist/RefBigDecimal.js +1 -0
- package/dist/RefBigInt.d.ts +2 -0
- package/dist/RefBigInt.d.ts.map +1 -0
- package/dist/RefBigInt.js +1 -0
- package/dist/RefBoolean.d.ts +2 -0
- package/dist/RefBoolean.d.ts.map +1 -0
- package/dist/RefBoolean.js +1 -0
- package/dist/RefCause.d.ts +2 -0
- package/dist/RefCause.d.ts.map +1 -0
- package/dist/RefCause.js +1 -0
- package/dist/RefChunk.d.ts +2 -0
- package/dist/RefChunk.d.ts.map +1 -0
- package/dist/RefChunk.js +1 -0
- package/dist/RefDateTime.d.ts +2 -0
- package/dist/RefDateTime.d.ts.map +1 -0
- package/dist/RefDateTime.js +1 -0
- package/dist/RefDuration.d.ts +2 -0
- package/dist/RefDuration.d.ts.map +1 -0
- package/dist/RefDuration.js +1 -0
- package/dist/RefGraph.d.ts +2 -0
- package/dist/RefGraph.d.ts.map +1 -0
- package/dist/RefGraph.js +1 -0
- package/dist/RefHashMap.d.ts +2 -0
- package/dist/RefHashMap.d.ts.map +1 -0
- package/dist/RefHashMap.js +1 -0
- package/dist/RefHashRing.d.ts +2 -0
- package/dist/RefHashRing.d.ts.map +1 -0
- package/dist/RefHashRing.js +1 -0
- package/dist/RefHashSet.d.ts +2 -0
- package/dist/RefHashSet.d.ts.map +1 -0
- package/dist/RefHashSet.js +1 -0
- package/dist/RefIterable.d.ts +2 -0
- package/dist/RefIterable.d.ts.map +1 -0
- package/dist/RefIterable.js +1 -0
- package/dist/RefOption.d.ts +2 -0
- package/dist/RefOption.d.ts.map +1 -0
- package/dist/RefOption.js +1 -0
- package/dist/RefRecord.d.ts +2 -0
- package/dist/RefRecord.d.ts.map +1 -0
- package/dist/RefRecord.js +1 -0
- package/dist/RefResult.d.ts +2 -0
- package/dist/RefResult.d.ts.map +1 -0
- package/dist/RefResult.js +1 -0
- package/dist/RefString.d.ts +2 -0
- package/dist/RefString.d.ts.map +1 -0
- package/dist/RefString.js +1 -0
- package/dist/RefStruct.d.ts +2 -0
- package/dist/RefStruct.d.ts.map +1 -0
- package/dist/RefStruct.js +1 -0
- package/dist/RefSubject/Hydration.d.ts +504 -0
- package/dist/RefSubject/Hydration.d.ts.map +1 -0
- package/dist/RefSubject/Hydration.js +300 -0
- package/dist/RefSubject/RefArray.d.ts +351 -4
- package/dist/RefSubject/RefArray.d.ts.map +1 -1
- package/dist/RefSubject/RefArray.js +339 -3
- package/dist/RefSubject/RefBigDecimal.d.ts +221 -1
- package/dist/RefSubject/RefBigDecimal.d.ts.map +1 -1
- package/dist/RefSubject/RefBigDecimal.js +210 -1
- package/dist/RefSubject/RefBigInt.d.ts +166 -1
- package/dist/RefSubject/RefBigInt.d.ts.map +1 -1
- package/dist/RefSubject/RefBigInt.js +155 -1
- package/dist/RefSubject/RefBoolean.d.ts +166 -1
- package/dist/RefSubject/RefBoolean.d.ts.map +1 -1
- package/dist/RefSubject/RefBoolean.js +155 -1
- package/dist/RefSubject/RefCause.d.ts +122 -1
- package/dist/RefSubject/RefCause.d.ts.map +1 -1
- package/dist/RefSubject/RefCause.js +111 -1
- package/dist/RefSubject/RefChunk.d.ts +406 -1
- package/dist/RefSubject/RefChunk.d.ts.map +1 -1
- package/dist/RefSubject/RefChunk.js +394 -0
- package/dist/RefSubject/RefDateTime.d.ts +122 -1
- package/dist/RefSubject/RefDateTime.d.ts.map +1 -1
- package/dist/RefSubject/RefDateTime.js +111 -1
- package/dist/RefSubject/RefDuration.d.ts +155 -1
- package/dist/RefSubject/RefDuration.d.ts.map +1 -1
- package/dist/RefSubject/RefDuration.js +144 -1
- package/dist/RefSubject/RefGraph.d.ts +320 -6
- package/dist/RefSubject/RefGraph.d.ts.map +1 -1
- package/dist/RefSubject/RefGraph.js +303 -0
- package/dist/RefSubject/RefHashMap.d.ts +296 -1
- package/dist/RefSubject/RefHashMap.d.ts.map +1 -1
- package/dist/RefSubject/RefHashMap.js +284 -0
- package/dist/RefSubject/RefHashRing.d.ts +146 -2
- package/dist/RefSubject/RefHashRing.d.ts.map +1 -1
- package/dist/RefSubject/RefHashRing.js +133 -0
- package/dist/RefSubject/RefHashSet.d.ts +230 -1
- package/dist/RefSubject/RefHashSet.d.ts.map +1 -1
- package/dist/RefSubject/RefHashSet.js +218 -0
- package/dist/RefSubject/RefIterable.d.ts +327 -1
- package/dist/RefSubject/RefIterable.d.ts.map +1 -1
- package/dist/RefSubject/RefIterable.js +315 -0
- package/dist/RefSubject/RefOption.d.ts +144 -1
- package/dist/RefSubject/RefOption.d.ts.map +1 -1
- package/dist/RefSubject/RefOption.js +133 -1
- package/dist/RefSubject/RefRecord.d.ts +339 -1
- package/dist/RefSubject/RefRecord.d.ts.map +1 -1
- package/dist/RefSubject/RefRecord.js +327 -0
- package/dist/RefSubject/RefResult.d.ts +155 -23
- package/dist/RefSubject/RefResult.d.ts.map +1 -1
- package/dist/RefSubject/RefResult.js +122 -1
- package/dist/RefSubject/RefString.d.ts +188 -1
- package/dist/RefSubject/RefString.d.ts.map +1 -1
- package/dist/RefSubject/RefString.js +177 -1
- package/dist/RefSubject/RefStruct.d.ts +156 -1
- package/dist/RefSubject/RefStruct.d.ts.map +1 -1
- package/dist/RefSubject/RefStruct.js +145 -1
- package/dist/RefSubject/RefSubject.d.ts +1168 -15
- package/dist/RefSubject/RefSubject.d.ts.map +1 -1
- package/dist/RefSubject/RefSubject.js +850 -58
- package/dist/RefSubject/RefTrie.d.ts +290 -4
- package/dist/RefSubject/RefTrie.d.ts.map +1 -1
- package/dist/RefSubject/RefTrie.js +278 -3
- package/dist/RefSubject/RefTuple.d.ts +117 -1
- package/dist/RefSubject/RefTuple.d.ts.map +1 -1
- package/dist/RefSubject/RefTuple.js +106 -1
- package/dist/RefSubject/index.d.ts +1 -0
- package/dist/RefSubject/index.d.ts.map +1 -1
- package/dist/RefSubject/index.js +1 -0
- package/dist/RefSubject.d.ts +2 -1
- package/dist/RefSubject.d.ts.map +1 -1
- package/dist/RefSubject.js +2 -1
- package/dist/RefTrie.d.ts +2 -0
- package/dist/RefTrie.d.ts.map +1 -0
- package/dist/RefTrie.js +1 -0
- package/dist/RefTuple.d.ts +2 -0
- package/dist/RefTuple.d.ts.map +1 -0
- package/dist/RefTuple.js +1 -0
- package/dist/Sink/Sink.d.ts +385 -14
- package/dist/Sink/Sink.d.ts.map +1 -1
- package/dist/Sink/Sink.js +53 -6
- package/dist/Sink/combinators.d.ts +731 -2
- package/dist/Sink/combinators.d.ts.map +1 -1
- package/dist/Sink/combinators.js +707 -5
- package/dist/Subject/Subject.d.ts +1016 -22
- package/dist/Subject/Subject.d.ts.map +1 -1
- package/dist/Subject/Subject.js +904 -39
- package/dist/Versioned/Versioned.d.ts +426 -9
- package/dist/Versioned/Versioned.d.ts.map +1 -1
- package/dist/Versioned/Versioned.js +241 -15
- package/dist/index.d.ts +22 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -3
- package/package.json +120 -11
- package/dist/Fx/constructors/fromYieldable.d.ts +0 -12
- package/dist/Fx/constructors/fromYieldable.d.ts.map +0 -1
- package/dist/Fx/constructors/fromYieldable.js +0 -12
- package/src/Fx/Fx.ts +0 -164
- package/src/Fx/TypeId.ts +0 -25
- package/src/Fx/combinators/additive.ts +0 -142
- package/src/Fx/combinators/catch.ts +0 -416
- package/src/Fx/combinators/causes.ts +0 -23
- package/src/Fx/combinators/changesWithEffect.ts +0 -66
- package/src/Fx/combinators/compact.ts +0 -15
- package/src/Fx/combinators/continueWith.ts +0 -78
- package/src/Fx/combinators/dropUntil.ts +0 -47
- package/src/Fx/combinators/ensuring.ts +0 -23
- package/src/Fx/combinators/exhaustLatestMap.ts +0 -74
- package/src/Fx/combinators/exhaustLatestMapEffect.ts +0 -25
- package/src/Fx/combinators/exhaustMap.ts +0 -36
- package/src/Fx/combinators/exhaustMapEffect.ts +0 -23
- package/src/Fx/combinators/exit.ts +0 -15
- package/src/Fx/combinators/filter.ts +0 -22
- package/src/Fx/combinators/filterEffect.ts +0 -31
- package/src/Fx/combinators/filterMap.ts +0 -23
- package/src/Fx/combinators/filterMapEffect.ts +0 -32
- package/src/Fx/combinators/filterMapLoop.ts +0 -35
- package/src/Fx/combinators/filterMapLoopCause.ts +0 -36
- package/src/Fx/combinators/filterMapLoopCauseEffect.ts +0 -46
- package/src/Fx/combinators/filterMapLoopEffect.ts +0 -36
- package/src/Fx/combinators/flatMap.ts +0 -51
- package/src/Fx/combinators/flatMapConcurrently.ts +0 -39
- package/src/Fx/combinators/flatMapConcurrentlyEffect.ts +0 -26
- package/src/Fx/combinators/flatMapEffect.ts +0 -42
- package/src/Fx/combinators/flip.ts +0 -14
- package/src/Fx/combinators/gen.ts +0 -24
- package/src/Fx/combinators/genScoped.ts +0 -24
- package/src/Fx/combinators/index.ts +0 -61
- package/src/Fx/combinators/keyed.ts +0 -369
- package/src/Fx/combinators/loop.ts +0 -27
- package/src/Fx/combinators/loopCause.ts +0 -34
- package/src/Fx/combinators/loopCauseEffect.ts +0 -36
- package/src/Fx/combinators/loopEffect.ts +0 -34
- package/src/Fx/combinators/map.ts +0 -22
- package/src/Fx/combinators/mapBoth.ts +0 -40
- package/src/Fx/combinators/mapEffect.ts +0 -32
- package/src/Fx/combinators/mapError.ts +0 -28
- package/src/Fx/combinators/mergeAll.ts +0 -22
- package/src/Fx/combinators/mergeOrdered.ts +0 -123
- package/src/Fx/combinators/onError.ts +0 -40
- package/src/Fx/combinators/onExit.ts +0 -82
- package/src/Fx/combinators/onInterrupt.ts +0 -87
- package/src/Fx/combinators/provide.ts +0 -124
- package/src/Fx/combinators/result.ts +0 -39
- package/src/Fx/combinators/scan.ts +0 -82
- package/src/Fx/combinators/skip.ts +0 -41
- package/src/Fx/combinators/skipRepeats.ts +0 -15
- package/src/Fx/combinators/skipRepeatsWith.ts +0 -40
- package/src/Fx/combinators/skipWhile.ts +0 -100
- package/src/Fx/combinators/slice.ts +0 -55
- package/src/Fx/combinators/switchMap.ts +0 -55
- package/src/Fx/combinators/switchMapEffect.ts +0 -25
- package/src/Fx/combinators/take.ts +0 -38
- package/src/Fx/combinators/takeUntil.ts +0 -88
- package/src/Fx/combinators/takeWhile.ts +0 -47
- package/src/Fx/combinators/tapEffect.ts +0 -39
- package/src/Fx/combinators/tuple.ts +0 -79
- package/src/Fx/combinators/unwrap.ts +0 -21
- package/src/Fx/combinators/unwrapScoped.ts +0 -26
- package/src/Fx/combinators/when.ts +0 -64
- package/src/Fx/combinators/withSpan.ts +0 -24
- package/src/Fx/combinators/zip.ts +0 -175
- package/src/Fx/constructors/at.ts +0 -23
- package/src/Fx/constructors/die.ts +0 -17
- package/src/Fx/constructors/empty.ts +0 -10
- package/src/Fx/constructors/fail.ts +0 -14
- package/src/Fx/constructors/failCause.ts +0 -14
- package/src/Fx/constructors/fn.ts +0 -245
- package/src/Fx/constructors/fromEffect.ts +0 -24
- package/src/Fx/constructors/fromFailures.ts +0 -19
- package/src/Fx/constructors/fromIterable.ts +0 -15
- package/src/Fx/constructors/fromSchedule.ts +0 -18
- package/src/Fx/constructors/fromYieldable.ts +0 -17
- package/src/Fx/constructors/index.ts +0 -15
- package/src/Fx/constructors/interrupt.ts +0 -13
- package/src/Fx/constructors/make.ts +0 -103
- package/src/Fx/constructors/periodic.ts +0 -15
- package/src/Fx/constructors/succeed.ts +0 -37
- package/src/Fx/constructors/suspend.ts +0 -6
- package/src/Fx/index.ts +0 -6
- package/src/Fx/internal/DeferredRef.ts +0 -87
- package/src/Fx/internal/UnionToTuple.ts +0 -12
- package/src/Fx/internal/diff.ts +0 -191
- package/src/Fx/internal/equivalence.ts +0 -12
- package/src/Fx/internal/multicast.ts +0 -51
- package/src/Fx/internal/ring-buffer.ts +0 -60
- package/src/Fx/internal/scope.ts +0 -58
- package/src/Fx/internal/yieldable.ts +0 -31
- package/src/Fx/run/collect.ts +0 -79
- package/src/Fx/run/first.ts +0 -20
- package/src/Fx/run/fork.ts +0 -40
- package/src/Fx/run/index.ts +0 -5
- package/src/Fx/run/observe.ts +0 -114
- package/src/Fx/run/runPromise.ts +0 -32
- package/src/Fx/stream.ts +0 -42
- package/src/Fx.additive-combinators.test.ts +0 -126
- package/src/Fx.catch-additive.test.ts +0 -206
- package/src/Fx.catch.test.ts +0 -60
- package/src/Fx.dropUntil.test.ts +0 -61
- package/src/Fx.fn.test.ts +0 -51
- package/src/Fx.lifecycle.test.ts +0 -79
- package/src/Fx.mapError-mapBoth.test.ts +0 -101
- package/src/Fx.provide-combinators.test.ts +0 -94
- package/src/Fx.result-changesWithEffect.test.ts +0 -112
- package/src/Fx.scan.test.ts +0 -73
- package/src/Fx.takeWhile-skipWhile.test.ts +0 -84
- package/src/Fx.test.ts +0 -71
- package/src/Fx.ts +0 -1
- package/src/Fx.zip-merge-additive.test.ts +0 -171
- package/src/Fx.zip.test.ts +0 -133
- package/src/Push/Push.ts +0 -1072
- package/src/Push/index.ts +0 -1
- package/src/Push.additive.test.ts +0 -256
- package/src/Push.test.ts +0 -26
- package/src/Push.ts +0 -1
- package/src/RefSubject/RefArray.ts +0 -516
- package/src/RefSubject/RefBigDecimal.test.ts +0 -56
- package/src/RefSubject/RefBigDecimal.ts +0 -295
- package/src/RefSubject/RefBigInt.test.ts +0 -56
- package/src/RefSubject/RefBigInt.ts +0 -189
- package/src/RefSubject/RefBoolean.test.ts +0 -57
- package/src/RefSubject/RefBoolean.ts +0 -185
- package/src/RefSubject/RefCause.test.ts +0 -53
- package/src/RefSubject/RefCause.ts +0 -146
- package/src/RefSubject/RefChunk.ts +0 -516
- package/src/RefSubject/RefDateTime.test.ts +0 -43
- package/src/RefSubject/RefDateTime.ts +0 -261
- package/src/RefSubject/RefDuration.test.ts +0 -49
- package/src/RefSubject/RefDuration.ts +0 -188
- package/src/RefSubject/RefGraph.ts +0 -649
- package/src/RefSubject/RefHashMap.ts +0 -474
- package/src/RefSubject/RefHashRing.ts +0 -262
- package/src/RefSubject/RefHashSet.ts +0 -308
- package/src/RefSubject/RefIterable.ts +0 -454
- package/src/RefSubject/RefOption.test.ts +0 -67
- package/src/RefSubject/RefOption.ts +0 -193
- package/src/RefSubject/RefRecord.ts +0 -621
- package/src/RefSubject/RefResult.test.ts +0 -63
- package/src/RefSubject/RefResult.ts +0 -209
- package/src/RefSubject/RefString.test.ts +0 -61
- package/src/RefSubject/RefString.ts +0 -256
- package/src/RefSubject/RefStruct.test.ts +0 -60
- package/src/RefSubject/RefStruct.ts +0 -253
- package/src/RefSubject/RefSubject.ts +0 -2644
- package/src/RefSubject/RefTrie.ts +0 -365
- package/src/RefSubject/RefTuple.test.ts +0 -60
- package/src/RefSubject/RefTuple.ts +0 -231
- package/src/RefSubject/index.ts +0 -21
- package/src/RefSubject.additive-parity.test.ts +0 -101
- package/src/RefSubject.test.ts +0 -65
- package/src/RefSubject.ts +0 -1
- package/src/Sink/Sink.ts +0 -159
- package/src/Sink/combinators.ts +0 -1115
- package/src/Sink/index.ts +0 -2
- package/src/Sink.combinators.test.ts +0 -88
- package/src/Sink.reduce-collect-head-last.test.ts +0 -107
- package/src/Sink.ts +0 -1
- package/src/Subject/Subject.ts +0 -441
- package/src/Subject/index.ts +0 -1
- package/src/Subject.test.ts +0 -47
- package/src/Subject.ts +0 -1
- package/src/Versioned/Versioned.ts +0 -597
- package/src/Versioned/index.ts +0 -1
- package/src/Versioned.filterMap.test.ts +0 -91
- package/src/Versioned.test.ts +0 -23
- package/src/Versioned.ts +0 -1
- package/src/index.ts +0 -7
|
@@ -6,27 +6,134 @@ import type { Equivalence } from "effect/Equivalence";
|
|
|
6
6
|
import * as Layer from "effect/Layer";
|
|
7
7
|
import * as Option from "effect/Option";
|
|
8
8
|
import * as Scope from "effect/Scope";
|
|
9
|
-
import * as
|
|
9
|
+
import * as Context from "effect/Context";
|
|
10
10
|
import * as Stream from "effect/Stream";
|
|
11
11
|
import type { Error as FxError, Fx } from "../Fx/index.js";
|
|
12
12
|
import type { UnionToTuple } from "../Fx/internal/UnionToTuple.js";
|
|
13
13
|
import * as Subject from "../Subject/Subject.js";
|
|
14
14
|
import * as Versioned from "../Versioned/Versioned.js";
|
|
15
|
+
/**
|
|
16
|
+
* Runtime symbol identifying writable RefSubject values.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* ## Why
|
|
20
|
+
*
|
|
21
|
+
* Provides stable runtime identity for RefSubject values without relying on classes or a renderer.
|
|
22
|
+
*
|
|
23
|
+
* ## Ownership and lifetime
|
|
24
|
+
*
|
|
25
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
26
|
+
* source errors, services, and lifetime.
|
|
27
|
+
*
|
|
28
|
+
* @since 1.18.0
|
|
29
|
+
* @category combinators
|
|
30
|
+
*/
|
|
15
31
|
export declare const RefSubjectTypeId: unique symbol;
|
|
32
|
+
/**
|
|
33
|
+
* Describes the ref subject type id type.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* ## Why
|
|
37
|
+
*
|
|
38
|
+
* Provides stable runtime identity for RefSubject values without relying on classes or a renderer.
|
|
39
|
+
*
|
|
40
|
+
* ## Ownership and lifetime
|
|
41
|
+
*
|
|
42
|
+
* RefSubjectTypeId is a contract and performs no acquisition. Implementations retain the errors,
|
|
43
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
44
|
+
*
|
|
45
|
+
* @since 1.18.0
|
|
46
|
+
* @category type-level
|
|
47
|
+
*/
|
|
16
48
|
export type RefSubjectTypeId = typeof RefSubjectTypeId;
|
|
49
|
+
/**
|
|
50
|
+
* Runtime symbol identifying read-only Computed values.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* ## Why
|
|
54
|
+
*
|
|
55
|
+
* Provides stable runtime identity for Computed values without relying on classes or a renderer.
|
|
56
|
+
*
|
|
57
|
+
* ## Ownership and lifetime
|
|
58
|
+
*
|
|
59
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
60
|
+
* source errors, services, and lifetime.
|
|
61
|
+
*
|
|
62
|
+
* @since 1.18.0
|
|
63
|
+
* @category combinators
|
|
64
|
+
*/
|
|
17
65
|
export declare const ComputedTypeId: unique symbol;
|
|
66
|
+
/**
|
|
67
|
+
* Describes the computed type id type.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* ## Why
|
|
71
|
+
*
|
|
72
|
+
* Provides stable runtime identity for Computed values without relying on classes or a renderer.
|
|
73
|
+
*
|
|
74
|
+
* ## Ownership and lifetime
|
|
75
|
+
*
|
|
76
|
+
* ComputedTypeId is a contract and performs no acquisition. Implementations retain the errors,
|
|
77
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
78
|
+
*
|
|
79
|
+
* @since 1.18.0
|
|
80
|
+
* @category type-level
|
|
81
|
+
*/
|
|
18
82
|
export type ComputedTypeId = typeof ComputedTypeId;
|
|
83
|
+
/**
|
|
84
|
+
* Runtime symbol identifying conditionally available Filtered values.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* ## Why
|
|
88
|
+
*
|
|
89
|
+
* Provides stable runtime identity for Filtered values without relying on classes or a renderer.
|
|
90
|
+
*
|
|
91
|
+
* ## Ownership and lifetime
|
|
92
|
+
*
|
|
93
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
94
|
+
* source errors, services, and lifetime.
|
|
95
|
+
*
|
|
96
|
+
* @since 1.18.0
|
|
97
|
+
* @category combinators
|
|
98
|
+
*/
|
|
19
99
|
export declare const FilteredTypeId: unique symbol;
|
|
100
|
+
/**
|
|
101
|
+
* Describes the filtered type id type.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* ## Why
|
|
105
|
+
*
|
|
106
|
+
* Provides stable runtime identity for Filtered values without relying on classes or a renderer.
|
|
107
|
+
*
|
|
108
|
+
* ## Ownership and lifetime
|
|
109
|
+
*
|
|
110
|
+
* FilteredTypeId is a contract and performs no acquisition. Implementations retain the errors,
|
|
111
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
112
|
+
*
|
|
113
|
+
* @since 1.18.0
|
|
114
|
+
* @category type-level
|
|
115
|
+
*/
|
|
20
116
|
export type FilteredTypeId = typeof FilteredTypeId;
|
|
21
117
|
/**
|
|
22
118
|
* A `Computed` is a read-only view of a value that can change over time.
|
|
23
119
|
* It is an `Fx` that emits the current value and subsequent updates.
|
|
24
120
|
* It is also an `Effect` that samples the current value.
|
|
25
121
|
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* ## Why
|
|
124
|
+
*
|
|
125
|
+
* Represents derived state as both an Effectful current read and an Fx of subsequent versions,
|
|
126
|
+
* without granting write access.
|
|
127
|
+
*
|
|
128
|
+
* ## Ownership and lifetime
|
|
129
|
+
*
|
|
130
|
+
* Computed is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
131
|
+
* interruption, and Scope requirements expressed by its members.
|
|
132
|
+
*
|
|
26
133
|
* @example
|
|
27
134
|
* ```ts
|
|
28
135
|
* import { Effect } from "effect"
|
|
29
|
-
* import
|
|
136
|
+
* import { RefSubject } from "@typed/fx"
|
|
30
137
|
* import { Fx } from "@typed/fx"
|
|
31
138
|
*
|
|
32
139
|
* // Create a RefSubject and derive a Computed from it
|
|
@@ -53,19 +160,80 @@ export type FilteredTypeId = typeof FilteredTypeId;
|
|
|
53
160
|
* @category models
|
|
54
161
|
*/
|
|
55
162
|
export interface Computed<out A, out E = never, out R = never> extends Versioned.Versioned<R, E, A, E, R | Scope.Scope, A, E, R> {
|
|
163
|
+
/**
|
|
164
|
+
* Carries the runtime marker recognized by `isComputed`.
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* ## Why
|
|
168
|
+
*
|
|
169
|
+
* Marks the value as Computed for runtime guards and composition without granting writable
|
|
170
|
+
* RefSubject operations.
|
|
171
|
+
*
|
|
172
|
+
* ## Ownership and lifetime
|
|
173
|
+
*
|
|
174
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
175
|
+
* source errors, services, and lifetime.
|
|
176
|
+
*
|
|
177
|
+
* @since 1.18.0
|
|
178
|
+
* @category combinators
|
|
179
|
+
*/
|
|
56
180
|
readonly [ComputedTypeId]: ComputedTypeId;
|
|
57
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Type utilities for read-only Computed state.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* ## Why
|
|
187
|
+
*
|
|
188
|
+
* Represents derived state as both an Effectful current read and an Fx of subsequent versions,
|
|
189
|
+
* without granting write access.
|
|
190
|
+
*
|
|
191
|
+
* ## Ownership and lifetime
|
|
192
|
+
*
|
|
193
|
+
* A namespace declaration performs no read or acquisition. The Computed values described by its
|
|
194
|
+
* members retain their own errors, services, and Scope-owned observation lifetimes.
|
|
195
|
+
*
|
|
196
|
+
* @since 1.18.0
|
|
197
|
+
* @category combinators
|
|
198
|
+
*/
|
|
58
199
|
export declare namespace Computed {
|
|
200
|
+
/**
|
|
201
|
+
* Describes the any type.
|
|
202
|
+
*
|
|
203
|
+
* @remarks
|
|
204
|
+
* ## Why
|
|
205
|
+
*
|
|
206
|
+
* The result remains a lazy view rather than a duplicated mutable value.
|
|
207
|
+
*
|
|
208
|
+
* ## Ownership and lifetime
|
|
209
|
+
*
|
|
210
|
+
* Any is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
211
|
+
* interruption, and Scope requirements expressed by its members.
|
|
212
|
+
*
|
|
213
|
+
* @since 1.18.0
|
|
214
|
+
* @category type-level
|
|
215
|
+
*/
|
|
59
216
|
type Any = Computed<any, any, any> | Computed<never, any, any> | Computed<any, never, any> | Computed<never, never, any>;
|
|
60
217
|
}
|
|
61
218
|
/**
|
|
62
219
|
* A `Filtered` is a `Computed` that may not always have a value.
|
|
63
220
|
* It is essentially a `Computed<Option<A>>` with helper methods.
|
|
64
221
|
*
|
|
222
|
+
* @remarks
|
|
223
|
+
* ## Why
|
|
224
|
+
*
|
|
225
|
+
* Represents a derived value that may be absent now and become available on a later push,
|
|
226
|
+
* preserving absence in the state contract.
|
|
227
|
+
*
|
|
228
|
+
* ## Ownership and lifetime
|
|
229
|
+
*
|
|
230
|
+
* Filtered is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
231
|
+
* interruption, and Scope requirements expressed by its members.
|
|
232
|
+
*
|
|
65
233
|
* @example
|
|
66
234
|
* ```ts
|
|
67
235
|
* import { Effect, Option } from "effect"
|
|
68
|
-
* import
|
|
236
|
+
* import { RefSubject } from "@typed/fx"
|
|
69
237
|
*
|
|
70
238
|
* // Create a RefSubject and filter it
|
|
71
239
|
* const program = Effect.gen(function* () {
|
|
@@ -92,6 +260,23 @@ export declare namespace Computed {
|
|
|
92
260
|
* @category models
|
|
93
261
|
*/
|
|
94
262
|
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> {
|
|
263
|
+
/**
|
|
264
|
+
* Carries the runtime marker distinguishing conditional Filtered state from Computed state.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* ## Why
|
|
268
|
+
*
|
|
269
|
+
* Marks the value as Filtered for runtime guards and composition without changing its data or
|
|
270
|
+
* error channels.
|
|
271
|
+
*
|
|
272
|
+
* ## Ownership and lifetime
|
|
273
|
+
*
|
|
274
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
275
|
+
* source errors, services, and lifetime.
|
|
276
|
+
*
|
|
277
|
+
* @since 1.18.0
|
|
278
|
+
* @category combinators
|
|
279
|
+
*/
|
|
95
280
|
readonly [FilteredTypeId]: FilteredTypeId;
|
|
96
281
|
/**
|
|
97
282
|
* Converts the Filtered back to a Computed of Option.
|
|
@@ -113,34 +298,151 @@ export interface Filtered<out A, out E = never, out R = never> extends Versioned
|
|
|
113
298
|
* console.log(Option.isNone(option)) // true (no number > 5)
|
|
114
299
|
* })
|
|
115
300
|
* ```
|
|
301
|
+
* @category combinators
|
|
302
|
+
* @since 1.18.0
|
|
303
|
+
* @remarks
|
|
304
|
+
* ## Why
|
|
305
|
+
*
|
|
306
|
+
* Converts the Filtered back to a Computed of Option. The result remains a lazy view rather than a
|
|
307
|
+
* duplicated mutable value.
|
|
308
|
+
*
|
|
309
|
+
* ## Ownership and lifetime
|
|
310
|
+
*
|
|
311
|
+
* The as computed view retains no independent state. Effectful reads sample the source once;
|
|
312
|
+
* Fx observation follows later pushes and the observing Scope finalizes it.
|
|
313
|
+
*
|
|
116
314
|
*/
|
|
117
315
|
asComputed(): Computed<Option.Option<A>, E, R>;
|
|
118
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Type utilities for conditionally available Filtered state.
|
|
319
|
+
*
|
|
320
|
+
* @remarks
|
|
321
|
+
* ## Why
|
|
322
|
+
*
|
|
323
|
+
* Represents a derived value that may be absent now and become available on a later push,
|
|
324
|
+
* preserving absence in the state contract.
|
|
325
|
+
*
|
|
326
|
+
* ## Ownership and lifetime
|
|
327
|
+
*
|
|
328
|
+
* A namespace declaration performs no read or acquisition. Individual Filtered values fail
|
|
329
|
+
* current reads with `NoSuchElementError` while absent; their observing Scope owns Fx cleanup.
|
|
330
|
+
*
|
|
331
|
+
* @since 1.18.0
|
|
332
|
+
* @category combinators
|
|
333
|
+
*/
|
|
119
334
|
export declare namespace Filtered {
|
|
335
|
+
/**
|
|
336
|
+
* Describes the any type.
|
|
337
|
+
*
|
|
338
|
+
* @remarks
|
|
339
|
+
* ## Why
|
|
340
|
+
*
|
|
341
|
+
* Gives generic utilities one structural supertype for Filtered values without erasing the
|
|
342
|
+
* concrete channels of values passed through those utilities.
|
|
343
|
+
*
|
|
344
|
+
* ## Ownership and lifetime
|
|
345
|
+
*
|
|
346
|
+
* Any is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
347
|
+
* interruption, and Scope requirements expressed by its members.
|
|
348
|
+
*
|
|
349
|
+
* @since 1.18.0
|
|
350
|
+
* @category type-level
|
|
351
|
+
*/
|
|
120
352
|
type Any = Filtered<any, any, any> | Filtered<never, any, any> | Filtered<any, never, any> | Filtered<never, never, any>;
|
|
121
353
|
}
|
|
122
354
|
/**
|
|
123
355
|
* Interface for basic RefSubject operations: get, set, delete.
|
|
356
|
+
* @remarks
|
|
357
|
+
* ## Why
|
|
358
|
+
*
|
|
359
|
+
* Interface for basic RefSubject operations: get, set, delete.
|
|
360
|
+
*
|
|
361
|
+
* ## Ownership and lifetime
|
|
362
|
+
*
|
|
363
|
+
* GetSetDelete is a contract and performs no acquisition. Implementations retain the errors,
|
|
364
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
365
|
+
*
|
|
124
366
|
* @since 1.0.0
|
|
125
367
|
* @category models
|
|
126
368
|
*/
|
|
127
369
|
export interface GetSetDelete<A, E = never, R = never> {
|
|
370
|
+
/**
|
|
371
|
+
* Reads the value visible to the current transaction.
|
|
372
|
+
*
|
|
373
|
+
* @remarks
|
|
374
|
+
* ## Why
|
|
375
|
+
*
|
|
376
|
+
* Reads the value visible inside the current transaction without publishing a change.
|
|
377
|
+
*
|
|
378
|
+
* ## Ownership and lifetime
|
|
379
|
+
*
|
|
380
|
+
* Running `get` performs no mutation or acquisition. It can fail with `E` and requires `R`; when
|
|
381
|
+
* used by `updates`, it observes that transaction's buffered value.
|
|
382
|
+
*
|
|
383
|
+
* @since 1.18.0
|
|
384
|
+
* @category combinators
|
|
385
|
+
*/
|
|
128
386
|
readonly get: Effect.Effect<A, E, R>;
|
|
387
|
+
/**
|
|
388
|
+
* Replaces the value inside the current transaction.
|
|
389
|
+
*
|
|
390
|
+
* @remarks
|
|
391
|
+
* ## Why
|
|
392
|
+
*
|
|
393
|
+
* The transition is serialized at the RefSubject rather than coordinated by callers or UI
|
|
394
|
+
* components.
|
|
395
|
+
*
|
|
396
|
+
* ## Ownership and lifetime
|
|
397
|
+
*
|
|
398
|
+
* Running set performs one serialized subject transition and returns the committed value. It
|
|
399
|
+
* acquires no resource and preserves source failures and services.
|
|
400
|
+
*
|
|
401
|
+
* @since 1.18.0
|
|
402
|
+
* @category combinators
|
|
403
|
+
*/
|
|
129
404
|
readonly set: (a: A) => Effect.Effect<A, E, R>;
|
|
405
|
+
/**
|
|
406
|
+
* Removes and returns the value visible to the current transaction.
|
|
407
|
+
*
|
|
408
|
+
* @remarks
|
|
409
|
+
* ## Why
|
|
410
|
+
*
|
|
411
|
+
* Removes the value from the current transaction and returns the previous value as `Some`, or
|
|
412
|
+
* `None` when no value was present.
|
|
413
|
+
*
|
|
414
|
+
* ## Ownership and lifetime
|
|
415
|
+
*
|
|
416
|
+
* Running delete performs one serialized subject transition and returns the committed value.
|
|
417
|
+
* It acquires no resource and preserves source failures and services.
|
|
418
|
+
*
|
|
419
|
+
* @since 1.18.0
|
|
420
|
+
* @category combinators
|
|
421
|
+
*/
|
|
130
422
|
readonly delete: Effect.Effect<Option.Option<A>, E, R>;
|
|
131
423
|
}
|
|
132
424
|
/**
|
|
133
425
|
* A `RefSubject` is a mutable reference that can be observed as an Fx.
|
|
134
426
|
* It combines the capabilities of a `Ref` (get/set/update) with a `Subject` (subscribe).
|
|
135
427
|
*
|
|
428
|
+
* @remarks
|
|
429
|
+
* ## Why
|
|
430
|
+
*
|
|
431
|
+
* Unifies synchronized mutable state, Effectful current reads, and Fx pushes so the same state can
|
|
432
|
+
* be tested and consumed without a renderer.
|
|
433
|
+
*
|
|
434
|
+
* ## Ownership and lifetime
|
|
435
|
+
*
|
|
436
|
+
* RefSubject is a contract and performs no acquisition. Implementations retain the errors,
|
|
437
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
438
|
+
*
|
|
136
439
|
* @example
|
|
137
440
|
* ```ts
|
|
138
441
|
* import { Effect } from "effect"
|
|
139
|
-
* import
|
|
140
|
-
* import { Fx } from "@typed/fx"
|
|
442
|
+
* import { Fx, RefSubject } from "@typed/fx"
|
|
141
443
|
*
|
|
142
444
|
* // Create a RefSubject with an initial value
|
|
143
|
-
* const program = Effect.gen(function* () {
|
|
445
|
+
* const program = Effect.scoped(Effect.gen(function* () {
|
|
144
446
|
* const count = yield* RefSubject.make(0)
|
|
145
447
|
*
|
|
146
448
|
* // Get the current value
|
|
@@ -153,21 +455,38 @@ export interface GetSetDelete<A, E = never, R = never> {
|
|
|
153
455
|
* console.log(updated) // 5
|
|
154
456
|
*
|
|
155
457
|
* // Use as an Fx to observe changes
|
|
156
|
-
* yield* Fx.observe(
|
|
458
|
+
* yield* Effect.forkScoped(Fx.observe(
|
|
157
459
|
* count,
|
|
158
460
|
* (value) => Effect.sync(() => console.log("Count changed:", value))
|
|
159
|
-
* )
|
|
461
|
+
* ))
|
|
160
462
|
*
|
|
161
463
|
* // Increment
|
|
162
464
|
* yield* RefSubject.increment(count)
|
|
163
465
|
* // Output: "Count changed: 6"
|
|
164
|
-
* })
|
|
466
|
+
* }))
|
|
165
467
|
* ```
|
|
166
468
|
*
|
|
167
469
|
* @since 1.0.0
|
|
168
470
|
* @category models
|
|
169
471
|
*/
|
|
170
472
|
export interface RefSubject<A, E = never, R = never> extends Computed<A, E, R>, Subject.Subject<A, E, R> {
|
|
473
|
+
/**
|
|
474
|
+
* Carries the runtime marker recognized by `isRefSubject`.
|
|
475
|
+
*
|
|
476
|
+
* @remarks
|
|
477
|
+
* ## Why
|
|
478
|
+
*
|
|
479
|
+
* Marks the value as a writable RefSubject for runtime guards while retaining its Computed and
|
|
480
|
+
* Subject capabilities.
|
|
481
|
+
*
|
|
482
|
+
* ## Ownership and lifetime
|
|
483
|
+
*
|
|
484
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
485
|
+
* source errors, services, and lifetime.
|
|
486
|
+
*
|
|
487
|
+
* @since 1.18.0
|
|
488
|
+
* @category combinators
|
|
489
|
+
*/
|
|
171
490
|
readonly [RefSubjectTypeId]: RefSubjectTypeId;
|
|
172
491
|
/**
|
|
173
492
|
* Runs an effect that can modify the RefSubject transactionally.
|
|
@@ -194,6 +513,20 @@ export interface RefSubject<A, E = never, R = never> extends Computed<A, E, R>,
|
|
|
194
513
|
* )
|
|
195
514
|
* })
|
|
196
515
|
* ```
|
|
516
|
+
* @category combinators
|
|
517
|
+
* @since 1.18.0
|
|
518
|
+
* @remarks
|
|
519
|
+
* ## Why
|
|
520
|
+
*
|
|
521
|
+
* Runs an effect that can modify the RefSubject transactionally. All operations within the
|
|
522
|
+
* transaction are atomic and serialized. The transition is serialized at the RefSubject rather
|
|
523
|
+
* than coordinated by callers or UI components.
|
|
524
|
+
*
|
|
525
|
+
* ## Ownership and lifetime
|
|
526
|
+
*
|
|
527
|
+
* Running updates performs one serialized subject transition and returns the committed value.
|
|
528
|
+
* It acquires no resource and preserves source failures and services.
|
|
529
|
+
*
|
|
197
530
|
*/
|
|
198
531
|
readonly updates: <B, E2, R2>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>) => Effect.Effect<B, E | E2, R | R2>;
|
|
199
532
|
/**
|
|
@@ -211,33 +544,372 @@ export interface RefSubject<A, E = never, R = never> extends Computed<A, E, R>,
|
|
|
211
544
|
* yield* ref.interrupt
|
|
212
545
|
* })
|
|
213
546
|
* ```
|
|
547
|
+
* @category combinators
|
|
548
|
+
* @since 1.18.0
|
|
549
|
+
* @remarks
|
|
550
|
+
* ## Why
|
|
551
|
+
*
|
|
552
|
+
* Interrupts the RefSubject, stopping all subscriptions and cleaning up resources.
|
|
553
|
+
*
|
|
554
|
+
* ## Ownership and lifetime
|
|
555
|
+
*
|
|
556
|
+
* Running this Effect returns `void`: it resets pending initialization, closes the RefSubject's
|
|
557
|
+
* private Scope, interrupts its initializer fiber, and interrupts its Subject. It cannot fail;
|
|
558
|
+
* `R` supplies services captured by the RefSubject's internal lifetime.
|
|
559
|
+
*
|
|
214
560
|
*/
|
|
215
561
|
readonly interrupt: Effect.Effect<void, never, R>;
|
|
216
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* Type utilities and service contracts for RefSubject values.
|
|
565
|
+
*
|
|
566
|
+
* @remarks
|
|
567
|
+
* ## Why
|
|
568
|
+
*
|
|
569
|
+
* Unifies synchronized mutable state, Effectful current reads, and Fx pushes so the same state can
|
|
570
|
+
* be tested and consumed without a renderer.
|
|
571
|
+
*
|
|
572
|
+
* ## Ownership and lifetime
|
|
573
|
+
*
|
|
574
|
+
* The namespace itself cannot run, read, or commit state. It groups structural helper types and
|
|
575
|
+
* the Context-backed service facade; concrete RefSubject values own their own Scope and serialized
|
|
576
|
+
* update boundary.
|
|
577
|
+
*
|
|
578
|
+
* @since 1.18.0
|
|
579
|
+
* @category combinators
|
|
580
|
+
*/
|
|
217
581
|
export declare namespace RefSubject {
|
|
582
|
+
/**
|
|
583
|
+
* Describes the any type.
|
|
584
|
+
*
|
|
585
|
+
* @remarks
|
|
586
|
+
* ## Why
|
|
587
|
+
*
|
|
588
|
+
* Gives generic utilities one structural supertype for writable RefSubject values while leaving
|
|
589
|
+
* concrete value, error, and service channels available to conditional types.
|
|
590
|
+
*
|
|
591
|
+
* ## Ownership and lifetime
|
|
592
|
+
*
|
|
593
|
+
* Any is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
594
|
+
* interruption, and Scope requirements expressed by its members.
|
|
595
|
+
*
|
|
596
|
+
* @since 1.18.0
|
|
597
|
+
* @category type-level
|
|
598
|
+
*/
|
|
218
599
|
type Any = RefSubject<any, any, any> | RefSubject<any, any> | RefSubject<any, never, any> | RefSubject<any>;
|
|
600
|
+
/**
|
|
601
|
+
* Defines the service state contract.
|
|
602
|
+
*
|
|
603
|
+
* @remarks
|
|
604
|
+
* ## Why
|
|
605
|
+
*
|
|
606
|
+
* Describes the class-like facade returned by `RefSubject.Service`: it is a Context tag whose
|
|
607
|
+
* static members also implement current reads, Fx observation, and serialized writes.
|
|
608
|
+
*
|
|
609
|
+
* ## Ownership and lifetime
|
|
610
|
+
*
|
|
611
|
+
* The contract itself acquires nothing. A matching Layer owns the underlying RefSubject; using
|
|
612
|
+
* the facade requires `Self`, exposes the underlying `E` on reads and pushes, and forwards Scope
|
|
613
|
+
* ownership to that installed subject.
|
|
614
|
+
*
|
|
615
|
+
* @since 1.18.0
|
|
616
|
+
* @category models
|
|
617
|
+
*/
|
|
219
618
|
interface Service<Self, Id extends string, A, E> extends RefSubject<A, E, Self> {
|
|
619
|
+
/**
|
|
620
|
+
* Exposes id on the ref subject contract.
|
|
621
|
+
*
|
|
622
|
+
* @remarks
|
|
623
|
+
* ## Why
|
|
624
|
+
*
|
|
625
|
+
* Preserves the literal Context identifier used to construct and diagnose the service tag.
|
|
626
|
+
*
|
|
627
|
+
* ## Ownership and lifetime
|
|
628
|
+
*
|
|
629
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
630
|
+
* source errors, services, and lifetime.
|
|
631
|
+
*
|
|
632
|
+
* @since 1.18.0
|
|
633
|
+
* @category combinators
|
|
634
|
+
*/
|
|
220
635
|
readonly id: Id;
|
|
221
|
-
|
|
636
|
+
/**
|
|
637
|
+
* Exposes service on the ref subject contract.
|
|
638
|
+
*
|
|
639
|
+
* @remarks
|
|
640
|
+
* ## Why
|
|
641
|
+
*
|
|
642
|
+
* Exposes the exact Effect Context tag used by `layer`, `make`, and every static operation on
|
|
643
|
+
* the facade, so custom Layers can install an existing RefSubject without another wrapper.
|
|
644
|
+
*
|
|
645
|
+
* ## Ownership and lifetime
|
|
646
|
+
*
|
|
647
|
+
* The tag is pure metadata and owns no state. The Layer that provides it owns the installed
|
|
648
|
+
* RefSubject and its scoped initializer; operations retrieving it require `Self`.
|
|
649
|
+
*
|
|
650
|
+
* @since 1.18.0
|
|
651
|
+
* @category combinators
|
|
652
|
+
*/
|
|
653
|
+
readonly service: Context.Service<Self, RefSubject<A, E>>;
|
|
654
|
+
/**
|
|
655
|
+
* Exposes make on the ref subject contract.
|
|
656
|
+
*
|
|
657
|
+
* @remarks
|
|
658
|
+
* ## Why
|
|
659
|
+
*
|
|
660
|
+
* Accepts values, Effects, Streams, and Fx through one renderer-independent state constructor
|
|
661
|
+
* while retaining their typed failures and services.
|
|
662
|
+
*
|
|
663
|
+
* ## Ownership and lifetime
|
|
664
|
+
*
|
|
665
|
+
* The creation Effect requires Scope. It owns initializer acquisition, live source subscriptions,
|
|
666
|
+
* and cleanup; source failures and services stay on reads and pushes.
|
|
667
|
+
*
|
|
668
|
+
* @since 1.18.0
|
|
669
|
+
* @category constructors
|
|
670
|
+
*/
|
|
222
671
|
readonly make: <R = never>(value: A | Effect.Effect<A, E, R> | Fx<A, E, R>, options?: RefSubjectOptions<A> & {
|
|
223
672
|
readonly skip?: number;
|
|
224
673
|
readonly take?: number;
|
|
225
674
|
}) => Layer.Layer<Self, never, Exclude<R, Scope.Scope>>;
|
|
675
|
+
/**
|
|
676
|
+
* Exposes layer on the ref subject contract.
|
|
677
|
+
*
|
|
678
|
+
* @remarks
|
|
679
|
+
* ## Why
|
|
680
|
+
*
|
|
681
|
+
* Converts a scoped Effect that produces a RefSubject into the exact Layer required by the
|
|
682
|
+
* facade, preserving construction failures and non-Scope requirements.
|
|
683
|
+
*
|
|
684
|
+
* ## Ownership and lifetime
|
|
685
|
+
*
|
|
686
|
+
* Layer acquisition runs `make` once per Layer instance. Its Scope owns the installed subject;
|
|
687
|
+
* `E2` is a Layer-construction failure, while the subject's `E` remains on later state access.
|
|
688
|
+
*
|
|
689
|
+
* @since 1.18.0
|
|
690
|
+
* @category combinators
|
|
691
|
+
*/
|
|
226
692
|
readonly layer: <E2, R2>(make: Effect.Effect<RefSubject<A, E>, E2, R2 | Scope.Scope>) => Layer.Layer<Self, E2, Exclude<R2, Scope.Scope>>;
|
|
227
693
|
}
|
|
694
|
+
/**
|
|
695
|
+
* Defines the class state contract.
|
|
696
|
+
*
|
|
697
|
+
* @remarks
|
|
698
|
+
* ## Why
|
|
699
|
+
*
|
|
700
|
+
* Adds the construct signature used by class-extension syntax to the RefSubject service facade.
|
|
701
|
+
*
|
|
702
|
+
* ## Ownership and lifetime
|
|
703
|
+
*
|
|
704
|
+
* Class is a contract and performs no acquisition. Implementations retain the errors,
|
|
705
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
706
|
+
*
|
|
707
|
+
* @since 1.18.0
|
|
708
|
+
* @category models
|
|
709
|
+
*/
|
|
228
710
|
interface Class<Self, Id extends string, A, E> extends RefSubject.Service<Self, Id, A, E> {
|
|
711
|
+
/**
|
|
712
|
+
* Construct signature used by the generated RefSubject service class.
|
|
713
|
+
*
|
|
714
|
+
* @remarks
|
|
715
|
+
* ## Why
|
|
716
|
+
*
|
|
717
|
+
* Makes `class State extends RefSubject.Service(...)(id) {}` type-check while returning the
|
|
718
|
+
* static facade rather than allocating a second state object.
|
|
719
|
+
*
|
|
720
|
+
* ## Ownership and lifetime
|
|
721
|
+
*
|
|
722
|
+
* Constructing the generated class returns its static service facade; it does not allocate or
|
|
723
|
+
* acquire a RefSubject. The matching Layer owns the installed state and its Scope.
|
|
724
|
+
*
|
|
725
|
+
* @since 1.18.0
|
|
726
|
+
* @category type-level
|
|
727
|
+
*/
|
|
229
728
|
new (): RefSubject.Service<Self, Id, A, E>;
|
|
230
729
|
}
|
|
231
730
|
}
|
|
232
|
-
|
|
731
|
+
/**
|
|
732
|
+
* Selects whether a computed Fx observes only its current value or also follows later pushes.
|
|
733
|
+
*
|
|
734
|
+
* @remarks
|
|
735
|
+
* ## Why
|
|
736
|
+
*
|
|
737
|
+
* `"multiple"` (the default) emits the current value and then follows distinct source pushes.
|
|
738
|
+
* `"one"` emits only the current value. Hydration temporarily uses `"one"` when it must resolve a
|
|
739
|
+
* single server value without leaving a live observation running.
|
|
740
|
+
*
|
|
741
|
+
* ## Ownership and lifetime
|
|
742
|
+
*
|
|
743
|
+
* This is an Effect Context reference with a default value, not mutable global state. Supplying a
|
|
744
|
+
* value changes computed observation only in the provided Effect context; the observing Scope
|
|
745
|
+
* still owns any subscription created by `"multiple"`.
|
|
746
|
+
*
|
|
747
|
+
* @since 1.18.0
|
|
748
|
+
* @category combinators
|
|
749
|
+
*/
|
|
750
|
+
export declare const CurrentComputedBehavior: Context.Reference<"multiple" | "one">;
|
|
751
|
+
/**
|
|
752
|
+
* Builds a read-only Computed projection from a Versioned source.
|
|
753
|
+
*
|
|
754
|
+
* @remarks
|
|
755
|
+
* ## Why
|
|
756
|
+
*
|
|
757
|
+
* Applies the same Effectful projection to current reads and pushed versions, preserving all three
|
|
758
|
+
* Versioned channels without granting writes to the source.
|
|
759
|
+
*
|
|
760
|
+
* ## Ownership and lifetime
|
|
761
|
+
*
|
|
762
|
+
* Current reads directly sample and transform the input. The pushed channel uses `Subject.hold`:
|
|
763
|
+
* concurrent observers share one active upstream session and its latest retained projection; the
|
|
764
|
+
* last observer ends the session and clears that held value. The observing Scope owns cleanup.
|
|
765
|
+
*
|
|
766
|
+
* @since 1.18.0
|
|
767
|
+
* @category combinators
|
|
768
|
+
*/
|
|
233
769
|
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>>;
|
|
770
|
+
/**
|
|
771
|
+
* Stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the accumulated state.
|
|
772
|
+
*
|
|
773
|
+
* Fx subscriptions follow `Fx.scan` semantics (emit `initial`, then fold each source value).
|
|
774
|
+
* Effect sampling accumulates across source versions via a private state ref (do not mix heavy
|
|
775
|
+
* subscribe + sample on the same scan if you need a single shared accumulator).
|
|
776
|
+
*
|
|
777
|
+
* @remarks
|
|
778
|
+
* ## Why
|
|
779
|
+
*
|
|
780
|
+
* Stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the accumulated state.
|
|
781
|
+
* Fx subscriptions follow `Fx.scan` semantics (emit `initial`, then fold each source value).
|
|
782
|
+
* Effect sampling accumulates across source versions via a private state ref (do not mix heavy
|
|
783
|
+
* subscribe + sample on the same scan if you need a single shared accumulator). The result remains
|
|
784
|
+
* a lazy view rather than a duplicated mutable value.
|
|
785
|
+
*
|
|
786
|
+
* ## Ownership and lifetime
|
|
787
|
+
*
|
|
788
|
+
* Calling `scan` allocates one private `MutableRef` for the returned Computed's Effect-read
|
|
789
|
+
* accumulator. Every Effect read of that same Computed shares it and advances it after a
|
|
790
|
+
* successful fold; separate `scan` calls do not share state. The pushed channel runs
|
|
791
|
+
* `Fx.scanEffect` from `initial` inside `Subject.hold`: concurrent observers share the active scan
|
|
792
|
+
* and its latest retained result, while the last observer ends that session and clears the held
|
|
793
|
+
* value. The observing Scope owns subscription cleanup. The private read accumulator has no
|
|
794
|
+
* finalizer and is collected with the returned Computed.
|
|
795
|
+
*
|
|
796
|
+
* @since 1.0.0
|
|
797
|
+
* @category combinators
|
|
798
|
+
*/
|
|
799
|
+
export declare const scan: {
|
|
800
|
+
<S, A>(initial: S, f: (s: S, a: A) => S): <E, R>(ref: RefSubject<A, E, R> | Computed<A, E, R>) => Computed<S, E, R>;
|
|
801
|
+
<A, E, R, S>(ref: RefSubject<A, E, R> | Computed<A, E, R>, initial: S, f: (s: S, a: A) => S): Computed<S, E, R>;
|
|
802
|
+
<R0, E0, A, E, R, E2, R2, S>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, initial: S, f: (s: S, a: A) => S): Computed<S, E0 | E | E2, R0 | R2 | Exclude<R, Scope.Scope>>;
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* Effectful stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the accumulated state.
|
|
806
|
+
*
|
|
807
|
+
* @remarks
|
|
808
|
+
* ## Why
|
|
809
|
+
*
|
|
810
|
+
* Effectful stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the
|
|
811
|
+
* accumulated state. The result remains a lazy view rather than a duplicated mutable value.
|
|
812
|
+
*
|
|
813
|
+
* ## Ownership and lifetime
|
|
814
|
+
*
|
|
815
|
+
* Calling `scanEffect` allocates one private `MutableRef` for the returned Computed's Effect-read
|
|
816
|
+
* accumulator. Every Effect read of that same Computed shares it; the accumulator advances only
|
|
817
|
+
* after `f` succeeds, so a typed failure leaves the previous state intact. The pushed channel runs
|
|
818
|
+
* `Fx.scanEffect` from `initial` inside `Subject.hold`: concurrent observers share the active scan
|
|
819
|
+
* and latest retained result, and each fold requires `R3`. The last observer ends that session and
|
|
820
|
+
* clears the held value. The observing Scope owns cleanup; the private read accumulator has no
|
|
821
|
+
* finalizer and is collected with the returned Computed.
|
|
822
|
+
*
|
|
823
|
+
* @since 1.0.0
|
|
824
|
+
* @category combinators
|
|
825
|
+
*/
|
|
826
|
+
export declare const scanEffect: {
|
|
827
|
+
<S, A, E3, R3>(initial: S, f: (s: S, a: A) => Effect.Effect<S, E3, R3>): <E, R>(ref: RefSubject<A, E, R> | Computed<A, E, R>) => Computed<S, E | E3, R | R3>;
|
|
828
|
+
<A, E, R, S, E3, R3>(ref: RefSubject<A, E, R> | Computed<A, E, R>, initial: S, f: (s: S, a: A) => Effect.Effect<S, E3, R3>): Computed<S, E | E3, R | R3>;
|
|
829
|
+
<R0, E0, A, E, R, E2, R2, S, E3, R3>(versioned: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, initial: S, f: (s: S, a: A) => Effect.Effect<S, E3, R3>): Computed<S, E0 | E | E2 | E3, R0 | R2 | R3 | Exclude<R, Scope.Scope>>;
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* Builds a Filtered view from the three channels of a Versioned source.
|
|
833
|
+
*
|
|
834
|
+
* @remarks
|
|
835
|
+
* ## Why
|
|
836
|
+
*
|
|
837
|
+
* Applies `f` to current reads and later pushes while preserving absence as Filtered semantics:
|
|
838
|
+
* Effect reads fail with `NoSuchElementError`, whereas the Fx channel simply omits absent values.
|
|
839
|
+
*
|
|
840
|
+
* ## Ownership and lifetime
|
|
841
|
+
*
|
|
842
|
+
* The make filtered view retains no independent value. Its Effect read fails with NoSuchElement
|
|
843
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
844
|
+
*
|
|
845
|
+
* @since 1.18.0
|
|
846
|
+
* @category combinators
|
|
847
|
+
*/
|
|
234
848
|
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>;
|
|
849
|
+
/**
|
|
850
|
+
* Defines the ref subject options state contract.
|
|
851
|
+
*
|
|
852
|
+
* @remarks
|
|
853
|
+
* ## Why
|
|
854
|
+
*
|
|
855
|
+
* Configures equality for committed RefSubject values.
|
|
856
|
+
*
|
|
857
|
+
* ## Ownership and lifetime
|
|
858
|
+
*
|
|
859
|
+
* RefSubjectOptions is a contract and performs no acquisition. Implementations retain the errors,
|
|
860
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
861
|
+
*
|
|
862
|
+
* @since 1.18.0
|
|
863
|
+
* @category models
|
|
864
|
+
*/
|
|
235
865
|
export interface RefSubjectOptions<A> {
|
|
866
|
+
/**
|
|
867
|
+
* Optional equivalence used to suppress unchanged commits.
|
|
868
|
+
*
|
|
869
|
+
* @remarks
|
|
870
|
+
* ## Why
|
|
871
|
+
*
|
|
872
|
+
* Suppresses publication and version changes when a candidate value is equivalent to the
|
|
873
|
+
* currently committed value.
|
|
874
|
+
*
|
|
875
|
+
* ## Ownership and lifetime
|
|
876
|
+
*
|
|
877
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
878
|
+
* source errors, services, and lifetime.
|
|
879
|
+
*
|
|
880
|
+
* @since 1.18.0
|
|
881
|
+
* @category combinators
|
|
882
|
+
*/
|
|
236
883
|
readonly eq?: Equivalence<A>;
|
|
237
884
|
}
|
|
238
885
|
/**
|
|
239
886
|
* Creates a new `RefSubject` from a value, `Effect`, or `Fx`.
|
|
240
887
|
*
|
|
888
|
+
* @remarks
|
|
889
|
+
* ## Why
|
|
890
|
+
*
|
|
891
|
+
* `RefSubject` keeps current state and pushed changes independent of any UI
|
|
892
|
+
* renderer. Domain transitions can therefore be constructed, composed, and
|
|
893
|
+
* tested with Effect alone; rendering is one optional consumer of the state.
|
|
894
|
+
* Plain values, Effect programs, pull-based Effect `Stream`s, and push-based
|
|
895
|
+
* `Fx` sources all enter through the same state boundary.
|
|
896
|
+
*
|
|
897
|
+
* ## Ownership and lifetime
|
|
898
|
+
*
|
|
899
|
+
* Creation requires an Effect `Scope`. That scope owns source acquisition,
|
|
900
|
+
* subscriptions, and finalization. The returned `RefSubject` exposes the
|
|
901
|
+
* source error type when read or observed, while construction itself cannot
|
|
902
|
+
* fail. Closing the scope interrupts a live source and releases its resources.
|
|
903
|
+
*
|
|
904
|
+
* ## Initialization
|
|
905
|
+
*
|
|
906
|
+
* Calling `make` is lazy because it returns an Effect: nothing is allocated and no source runs
|
|
907
|
+
* until that creation Effect is executed. After creation, a plain value is immediately available.
|
|
908
|
+
* An Effect input runs once on the first current read or observation. Fx and Stream inputs instead
|
|
909
|
+
* start one shared source run when the creation Effect executes; reads wait for their first value
|
|
910
|
+
* or failure and later emissions replace the retained current state. Equality and buffering
|
|
911
|
+
* behavior can be customized with `RefSubjectOptions`.
|
|
912
|
+
*
|
|
241
913
|
* @example
|
|
242
914
|
* ```ts
|
|
243
915
|
* import { Effect } from "effect"
|
|
@@ -277,6 +949,19 @@ export declare function make<A, E = never, R = never>(effect: A | Effect.Effect<
|
|
|
277
949
|
/**
|
|
278
950
|
* Creates a `RefSubject` from an `Effect`.
|
|
279
951
|
*
|
|
952
|
+
* @remarks
|
|
953
|
+
* ## Why
|
|
954
|
+
*
|
|
955
|
+
* Makes effect acquisition explicit while normalizing it into current RefSubject state and
|
|
956
|
+
* subsequent pushed versions.
|
|
957
|
+
*
|
|
958
|
+
* ## Ownership and lifetime
|
|
959
|
+
*
|
|
960
|
+
* The creation Effect requires Scope and the source's services, which it captures for the private
|
|
961
|
+
* initializer Scope. The source Effect itself stays deferred until the first current read or
|
|
962
|
+
* observation and runs at most once. Source failures remain visible on reads and observations;
|
|
963
|
+
* closing the creation Scope interrupts an initializer that is still running.
|
|
964
|
+
*
|
|
280
965
|
* @example
|
|
281
966
|
* ```ts
|
|
282
967
|
* import { Effect } from "effect"
|
|
@@ -299,6 +984,17 @@ export declare function fromEffect<A, E, R>(effect: Effect.Effect<A, E, R>, opti
|
|
|
299
984
|
/**
|
|
300
985
|
* Creates a `RefSubject` from an `Fx`, tracking the latest emitted value.
|
|
301
986
|
*
|
|
987
|
+
* @remarks
|
|
988
|
+
* ## Why
|
|
989
|
+
*
|
|
990
|
+
* Makes fx acquisition explicit while normalizing it into current RefSubject state and subsequent
|
|
991
|
+
* pushed versions.
|
|
992
|
+
*
|
|
993
|
+
* ## Ownership and lifetime
|
|
994
|
+
*
|
|
995
|
+
* The creation Effect requires Scope. It owns initializer acquisition, live source subscriptions,
|
|
996
|
+
* and cleanup; source failures and services stay on reads and pushes.
|
|
997
|
+
*
|
|
302
998
|
* @example
|
|
303
999
|
* ```ts
|
|
304
1000
|
* import { Effect } from "effect"
|
|
@@ -322,10 +1018,42 @@ export declare function fromEffect<A, E, R>(effect: Effect.Effect<A, E, R>, opti
|
|
|
322
1018
|
* @category constructors
|
|
323
1019
|
*/
|
|
324
1020
|
export declare function fromFx<A, E, R>(fx: Fx<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Creates a RefSubject that tracks the latest value emitted by an Effect Stream.
|
|
1023
|
+
*
|
|
1024
|
+
* @remarks
|
|
1025
|
+
* ## Why
|
|
1026
|
+
*
|
|
1027
|
+
* Bridges a pull-based Stream into renderer-independent state: each emitted value enters the
|
|
1028
|
+
* RefSubject's serialized commit path, while a stream failure becomes the ref's current and pushed
|
|
1029
|
+
* failure.
|
|
1030
|
+
*
|
|
1031
|
+
* ## Ownership and lifetime
|
|
1032
|
+
*
|
|
1033
|
+
* Construction forks stream consumption immediately into the RefSubject's private Scope and cannot
|
|
1034
|
+
* fail. `R` is required while constructing that fiber; closing the outer Scope interrupts it.
|
|
1035
|
+
* Before the first value or failure, a current read waits for initialization. Later reads and pushes
|
|
1036
|
+
* expose `E`.
|
|
1037
|
+
*
|
|
1038
|
+
* @since 1.18.0
|
|
1039
|
+
* @category combinators
|
|
1040
|
+
*/
|
|
325
1041
|
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
1042
|
/**
|
|
327
1043
|
* Creates a `RefSubject` from an `Option` value.
|
|
328
1044
|
*
|
|
1045
|
+
* @remarks
|
|
1046
|
+
* ## Why
|
|
1047
|
+
*
|
|
1048
|
+
* Stores the Option itself in writable state. `None` is an ordinary current value and does not add
|
|
1049
|
+
* `NoSuchElementError`; callers opt into absence semantics with `compact`, or a fallback with
|
|
1050
|
+
* `getOrElse`.
|
|
1051
|
+
*
|
|
1052
|
+
* ## Ownership and lifetime
|
|
1053
|
+
*
|
|
1054
|
+
* Construction requires Scope because it delegates to `make`, but the supplied Option needs no
|
|
1055
|
+
* services and cannot fail. The returned RefSubject owns and publishes subsequent Option writes.
|
|
1056
|
+
*
|
|
329
1057
|
* @example
|
|
330
1058
|
* ```ts
|
|
331
1059
|
* import { Effect, Option } from "effect"
|
|
@@ -342,10 +1070,39 @@ export declare function fromStream<A, E, R>(stream: Stream.Stream<A, E, R>, opti
|
|
|
342
1070
|
* @category constructors
|
|
343
1071
|
*/
|
|
344
1072
|
export declare function fromOption<A>(option: Option.Option<A>, options?: RefSubjectOptions<Option.Option<A>>): Effect.Effect<RefSubject<Option.Option<A>>, never, Scope.Scope>;
|
|
1073
|
+
/**
|
|
1074
|
+
* Creates Option-valued RefSubject state from a nullable input.
|
|
1075
|
+
*
|
|
1076
|
+
* @remarks
|
|
1077
|
+
* ## Why
|
|
1078
|
+
*
|
|
1079
|
+
* Converts `null` and `undefined` to `Option.none` and every other value to `Option.some`, then
|
|
1080
|
+
* stores that Option in a writable RefSubject. It does not create Filtered state or add
|
|
1081
|
+
* `NoSuchElementError`.
|
|
1082
|
+
*
|
|
1083
|
+
* ## Ownership and lifetime
|
|
1084
|
+
*
|
|
1085
|
+
* Construction requires Scope because it delegates to `make`; it needs no services and cannot
|
|
1086
|
+
* fail. The returned RefSubject owns and publishes subsequent Option writes.
|
|
1087
|
+
*
|
|
1088
|
+
* @since 1.18.0
|
|
1089
|
+
* @category combinators
|
|
1090
|
+
*/
|
|
345
1091
|
export declare function fromNullable<A>(value: A | null | undefined, options?: RefSubjectOptions<Option.Option<NonNullable<A>>>): Effect.Effect<RefSubject<Option.Option<NonNullable<A>>>, never, Scope.Scope>;
|
|
346
1092
|
/**
|
|
347
1093
|
* Sets the value of a `RefSubject`.
|
|
348
1094
|
*
|
|
1095
|
+
* @remarks
|
|
1096
|
+
* ## Why
|
|
1097
|
+
*
|
|
1098
|
+
* Sets the value of a `RefSubject`. The transition is serialized at the RefSubject rather than
|
|
1099
|
+
* coordinated by callers or UI components.
|
|
1100
|
+
*
|
|
1101
|
+
* ## Ownership and lifetime
|
|
1102
|
+
*
|
|
1103
|
+
* Running set performs one serialized subject transition and resolves with its committed value. It
|
|
1104
|
+
* acquires no resource; failures and services remain those of the source ref.
|
|
1105
|
+
*
|
|
349
1106
|
* @example
|
|
350
1107
|
* ```ts
|
|
351
1108
|
* import { Effect } from "effect"
|
|
@@ -376,6 +1133,17 @@ export declare const set: {
|
|
|
376
1133
|
/**
|
|
377
1134
|
* Resets a `RefSubject` to its initial value, returning the previous value if it existed.
|
|
378
1135
|
*
|
|
1136
|
+
* @remarks
|
|
1137
|
+
* ## Why
|
|
1138
|
+
*
|
|
1139
|
+
* Resets a `RefSubject` to its initial value, returning the previous value if it existed. The
|
|
1140
|
+
* transition is serialized at the RefSubject rather than coordinated by callers or UI components.
|
|
1141
|
+
*
|
|
1142
|
+
* ## Ownership and lifetime
|
|
1143
|
+
*
|
|
1144
|
+
* Running reset performs one serialized subject transition and resolves with its committed value.
|
|
1145
|
+
* It acquires no resource; failures and services remain those of the source ref.
|
|
1146
|
+
*
|
|
379
1147
|
* @example
|
|
380
1148
|
* ```ts
|
|
381
1149
|
* import { Effect, Option } from "effect"
|
|
@@ -433,6 +1201,17 @@ reset as delete, };
|
|
|
433
1201
|
/**
|
|
434
1202
|
* Updates a `RefSubject` using an `Effect`ful function.
|
|
435
1203
|
*
|
|
1204
|
+
* @remarks
|
|
1205
|
+
* ## Why
|
|
1206
|
+
*
|
|
1207
|
+
* Updates a `RefSubject` using an `Effect`ful function. The transition is serialized at the
|
|
1208
|
+
* RefSubject rather than coordinated by callers or UI components.
|
|
1209
|
+
*
|
|
1210
|
+
* ## Ownership and lifetime
|
|
1211
|
+
*
|
|
1212
|
+
* Running update effect performs one serialized subject transition and resolves with its committed
|
|
1213
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1214
|
+
*
|
|
436
1215
|
* @example
|
|
437
1216
|
* ```ts
|
|
438
1217
|
* import { Effect } from "effect"
|
|
@@ -461,6 +1240,26 @@ export declare const updateEffect: {
|
|
|
461
1240
|
/**
|
|
462
1241
|
* Updates a `RefSubject` using a pure function.
|
|
463
1242
|
*
|
|
1243
|
+
* @remarks
|
|
1244
|
+
* ## Why
|
|
1245
|
+
*
|
|
1246
|
+
* `update` expresses a state transition where the state lives, without moving
|
|
1247
|
+
* transition logic into a component or renderer. The same function can run in
|
|
1248
|
+
* application code, tests, workers, event handlers, or a Typed template.
|
|
1249
|
+
*
|
|
1250
|
+
* ## Ownership and lifetime
|
|
1251
|
+
*
|
|
1252
|
+
* The update runs inside the RefSubject's existing synchronized update
|
|
1253
|
+
* boundary: it reads the committed value, derives the next value, commits it,
|
|
1254
|
+
* and publishes that change. It acquires no independent resource and retains
|
|
1255
|
+
* the subject's existing error and service channels.
|
|
1256
|
+
*
|
|
1257
|
+
* ## Concurrency and failure
|
|
1258
|
+
*
|
|
1259
|
+
* Concurrent updates are serialized by the subject core so each function sees
|
|
1260
|
+
* a committed value. A pure updater adds no error channel; failures already
|
|
1261
|
+
* associated with reading or writing the RefSubject remain explicit in `E`.
|
|
1262
|
+
*
|
|
464
1263
|
* @example
|
|
465
1264
|
* ```ts
|
|
466
1265
|
* import { Effect } from "effect"
|
|
@@ -491,6 +1290,18 @@ export declare const update: {
|
|
|
491
1290
|
/**
|
|
492
1291
|
* Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new value.
|
|
493
1292
|
*
|
|
1293
|
+
* @remarks
|
|
1294
|
+
* ## Why
|
|
1295
|
+
*
|
|
1296
|
+
* Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new
|
|
1297
|
+
* value. The transition is serialized at the RefSubject rather than coordinated by callers or UI
|
|
1298
|
+
* components.
|
|
1299
|
+
*
|
|
1300
|
+
* ## Ownership and lifetime
|
|
1301
|
+
*
|
|
1302
|
+
* Running modify effect performs one serialized subject transition and resolves with its committed
|
|
1303
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1304
|
+
*
|
|
494
1305
|
* @example
|
|
495
1306
|
* ```ts
|
|
496
1307
|
* import { Effect } from "effect"
|
|
@@ -520,6 +1331,17 @@ export declare const modifyEffect: {
|
|
|
520
1331
|
/**
|
|
521
1332
|
* Modifies a `RefSubject` using a pure function that returns both a result and a new value.
|
|
522
1333
|
*
|
|
1334
|
+
* @remarks
|
|
1335
|
+
* ## Why
|
|
1336
|
+
*
|
|
1337
|
+
* Modifies a `RefSubject` using a pure function that returns both a result and a new value. The
|
|
1338
|
+
* transition is serialized at the RefSubject rather than coordinated by callers or UI components.
|
|
1339
|
+
*
|
|
1340
|
+
* ## Ownership and lifetime
|
|
1341
|
+
*
|
|
1342
|
+
* Running modify performs one serialized subject transition and resolves with its committed value.
|
|
1343
|
+
* It acquires no resource; failures and services remain those of the source ref.
|
|
1344
|
+
*
|
|
523
1345
|
* @example
|
|
524
1346
|
* ```ts
|
|
525
1347
|
* import { Effect } from "effect"
|
|
@@ -547,6 +1369,16 @@ export declare const modify: {
|
|
|
547
1369
|
/**
|
|
548
1370
|
* Checks if a value is a `RefSubject`.
|
|
549
1371
|
*
|
|
1372
|
+
* @remarks
|
|
1373
|
+
* ## Why
|
|
1374
|
+
*
|
|
1375
|
+
* Checks if a value is a `RefSubject`.
|
|
1376
|
+
*
|
|
1377
|
+
* ## Ownership and lifetime
|
|
1378
|
+
*
|
|
1379
|
+
* The derived ref owns no independent state or subscription. It follows the source lifetime and
|
|
1380
|
+
* routes writes through the source's synchronized update boundary.
|
|
1381
|
+
*
|
|
550
1382
|
* @example
|
|
551
1383
|
* ```ts
|
|
552
1384
|
* import { Effect } from "effect"
|
|
@@ -567,9 +1399,38 @@ export declare const modify: {
|
|
|
567
1399
|
* @category guards
|
|
568
1400
|
*/
|
|
569
1401
|
export declare function isRefSubject(value: any): value is RefSubject<any, any, any>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Tests whether a value carries the public Computed TypeId.
|
|
1404
|
+
*
|
|
1405
|
+
* @remarks
|
|
1406
|
+
* ## Why
|
|
1407
|
+
*
|
|
1408
|
+
* Uses the TypeId contract rather than a concrete implementation class, so custom Computed values
|
|
1409
|
+
* and service facades participate in the same runtime guard.
|
|
1410
|
+
*
|
|
1411
|
+
* ## Ownership and lifetime
|
|
1412
|
+
*
|
|
1413
|
+
* This synchronous predicate performs no Effect, subscription, or acquisition.
|
|
1414
|
+
*
|
|
1415
|
+
* @since 1.18.0
|
|
1416
|
+
* @category guards
|
|
1417
|
+
*/
|
|
1418
|
+
export declare function isComputed(value: any): value is Computed<any, any, any>;
|
|
570
1419
|
/**
|
|
571
1420
|
* Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.
|
|
572
1421
|
*
|
|
1422
|
+
* @remarks
|
|
1423
|
+
* ## Why
|
|
1424
|
+
*
|
|
1425
|
+
* Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.
|
|
1426
|
+
* The transition is serialized at the RefSubject rather than coordinated by callers or UI
|
|
1427
|
+
* components.
|
|
1428
|
+
*
|
|
1429
|
+
* ## Ownership and lifetime
|
|
1430
|
+
*
|
|
1431
|
+
* Running run updates performs one serialized subject transition and resolves with its committed
|
|
1432
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1433
|
+
*
|
|
573
1434
|
* @example
|
|
574
1435
|
* ```ts
|
|
575
1436
|
* import { Effect } from "effect"
|
|
@@ -614,6 +1475,17 @@ export declare const runUpdates: {
|
|
|
614
1475
|
/**
|
|
615
1476
|
* Increments a numeric `RefSubject` by 1.
|
|
616
1477
|
*
|
|
1478
|
+
* @remarks
|
|
1479
|
+
* ## Why
|
|
1480
|
+
*
|
|
1481
|
+
* Increments a numeric `RefSubject` by 1. The transition is serialized at the RefSubject rather
|
|
1482
|
+
* than coordinated by callers or UI components.
|
|
1483
|
+
*
|
|
1484
|
+
* ## Ownership and lifetime
|
|
1485
|
+
*
|
|
1486
|
+
* Running increment performs one serialized subject transition and resolves with its committed
|
|
1487
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1488
|
+
*
|
|
617
1489
|
* @example
|
|
618
1490
|
* ```ts
|
|
619
1491
|
* import { Effect } from "effect"
|
|
@@ -639,6 +1511,17 @@ export declare function increment<E, R>(ref: RefSubject<number, E, R>): Effect.E
|
|
|
639
1511
|
/**
|
|
640
1512
|
* Decrements a numeric `RefSubject` by 1.
|
|
641
1513
|
*
|
|
1514
|
+
* @remarks
|
|
1515
|
+
* ## Why
|
|
1516
|
+
*
|
|
1517
|
+
* Decrements a numeric `RefSubject` by 1. The transition is serialized at the RefSubject rather
|
|
1518
|
+
* than coordinated by callers or UI components.
|
|
1519
|
+
*
|
|
1520
|
+
* ## Ownership and lifetime
|
|
1521
|
+
*
|
|
1522
|
+
* Running decrement performs one serialized subject transition and resolves with its committed
|
|
1523
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1524
|
+
*
|
|
642
1525
|
* @example
|
|
643
1526
|
* ```ts
|
|
644
1527
|
* import { Effect } from "effect"
|
|
@@ -661,11 +1544,44 @@ export declare function increment<E, R>(ref: RefSubject<number, E, R>): Effect.E
|
|
|
661
1544
|
* @category combinators
|
|
662
1545
|
*/
|
|
663
1546
|
export declare function decrement<E, R>(ref: RefSubject<number, E, R>): Effect.Effect<number, E, R>;
|
|
1547
|
+
/**
|
|
1548
|
+
* Creates a Context-backed RefSubject service facade and Layer constructors.
|
|
1549
|
+
*
|
|
1550
|
+
* @remarks
|
|
1551
|
+
* ## Why
|
|
1552
|
+
*
|
|
1553
|
+
* The returned class is simultaneously a service tag, a current-value Effect, an Fx source, and a
|
|
1554
|
+
* writable RefSubject facade. This lets consumers read, observe, and update renderer-independent
|
|
1555
|
+
* state without manually retrieving the underlying service from Context.
|
|
1556
|
+
*
|
|
1557
|
+
* ## Ownership and lifetime
|
|
1558
|
+
*
|
|
1559
|
+
* Calling `Service` is pure. `layer` installs an existing scoped RefSubject; `make` constructs one
|
|
1560
|
+
* and installs it in a Layer. The Layer Scope owns the subject and its initializer subscription.
|
|
1561
|
+
* Reads and pushes expose the declared `E` channel; construction requirements remain on the Layer,
|
|
1562
|
+
* while consumers require only the generated `Self` service.
|
|
1563
|
+
*
|
|
1564
|
+
* @since 1.18.0
|
|
1565
|
+
* @category combinators
|
|
1566
|
+
*/
|
|
664
1567
|
export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => RefSubject.Class<Self, Id, A, E>;
|
|
665
1568
|
/**
|
|
666
1569
|
* Extract all values from an object using a Proxy.
|
|
667
1570
|
* Allows accessing nested properties of a `Computed` or `Filtered` object/array as individual computed values.
|
|
668
1571
|
*
|
|
1572
|
+
* @remarks
|
|
1573
|
+
* ## Why
|
|
1574
|
+
*
|
|
1575
|
+
* Lazily creates one property projection per accessed key and memoizes that projection on the
|
|
1576
|
+
* JavaScript Proxy. A Computed or RefSubject source produces Computed properties; only a Filtered
|
|
1577
|
+
* source produces Filtered properties and preserves conditional absence.
|
|
1578
|
+
*
|
|
1579
|
+
* ## Ownership and lifetime
|
|
1580
|
+
*
|
|
1581
|
+
* The Proxy caches derived view objects, not property values. Computed property reads expose only
|
|
1582
|
+
* the source's `E`; Filtered property reads can additionally fail with `NoSuchElementError` while
|
|
1583
|
+
* their source is absent. Each observed property follows the source and uses the observing Scope.
|
|
1584
|
+
*
|
|
669
1585
|
* @example
|
|
670
1586
|
* ```ts
|
|
671
1587
|
* import { Effect } from "effect"
|
|
@@ -704,13 +1620,91 @@ export declare const proxy: {
|
|
|
704
1620
|
readonly [K in keyof A]: Filtered<A[K], E, R>;
|
|
705
1621
|
};
|
|
706
1622
|
};
|
|
1623
|
+
/**
|
|
1624
|
+
* Describes the services type.
|
|
1625
|
+
*
|
|
1626
|
+
* @remarks
|
|
1627
|
+
* ## Why
|
|
1628
|
+
*
|
|
1629
|
+
* Extracts the service requirement channel from a RefSubject, Computed, or Filtered value.
|
|
1630
|
+
*
|
|
1631
|
+
* ## Ownership and lifetime
|
|
1632
|
+
*
|
|
1633
|
+
* Services is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
1634
|
+
* interruption, and Scope requirements expressed by its members.
|
|
1635
|
+
*
|
|
1636
|
+
* @since 1.18.0
|
|
1637
|
+
* @category type-level
|
|
1638
|
+
*/
|
|
707
1639
|
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;
|
|
1640
|
+
/**
|
|
1641
|
+
* Describes the error type.
|
|
1642
|
+
*
|
|
1643
|
+
* @remarks
|
|
1644
|
+
* ## Why
|
|
1645
|
+
*
|
|
1646
|
+
* Extracts the declared state error channel from a RefSubject, Computed, or Filtered value.
|
|
1647
|
+
*
|
|
1648
|
+
* ## Ownership and lifetime
|
|
1649
|
+
*
|
|
1650
|
+
* Error is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
1651
|
+
* interruption, and Scope requirements expressed by its members.
|
|
1652
|
+
*
|
|
1653
|
+
* @since 1.18.0
|
|
1654
|
+
* @category type-level
|
|
1655
|
+
*/
|
|
708
1656
|
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;
|
|
1657
|
+
/**
|
|
1658
|
+
* Describes the success type.
|
|
1659
|
+
*
|
|
1660
|
+
* @remarks
|
|
1661
|
+
* ## Why
|
|
1662
|
+
*
|
|
1663
|
+
* Extracts the current/read value type from a RefSubject, Computed, or Filtered value.
|
|
1664
|
+
*
|
|
1665
|
+
* ## Ownership and lifetime
|
|
1666
|
+
*
|
|
1667
|
+
* Success is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
1668
|
+
* interruption, and Scope requirements expressed by its members.
|
|
1669
|
+
*
|
|
1670
|
+
* @since 1.18.0
|
|
1671
|
+
* @category type-level
|
|
1672
|
+
*/
|
|
709
1673
|
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;
|
|
1674
|
+
/**
|
|
1675
|
+
* Describes the identifier type.
|
|
1676
|
+
*
|
|
1677
|
+
* @remarks
|
|
1678
|
+
* ## Why
|
|
1679
|
+
*
|
|
1680
|
+
* Extracts the Context service identifier type represented by a RefSubject service facade.
|
|
1681
|
+
*
|
|
1682
|
+
* ## Ownership and lifetime
|
|
1683
|
+
*
|
|
1684
|
+
* Identifier is a contract and performs no acquisition. Implementations retain the errors,
|
|
1685
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
1686
|
+
*
|
|
1687
|
+
* @since 1.18.0
|
|
1688
|
+
* @category type-level
|
|
1689
|
+
*/
|
|
710
1690
|
export type Identifier<T> = T extends RefSubject.Service<infer R, infer _Id, infer _A, infer _E> ? R : never;
|
|
711
1691
|
/**
|
|
712
1692
|
* Transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function.
|
|
713
1693
|
*
|
|
1694
|
+
* @remarks
|
|
1695
|
+
* ## Why
|
|
1696
|
+
*
|
|
1697
|
+
* Applies one Effectful derivation to current reads and pushed versions. RefSubject and Computed
|
|
1698
|
+
* inputs return Computed and add only `E2`; a Filtered input returns Filtered and preserves its
|
|
1699
|
+
* conditional absence in addition to `E2`.
|
|
1700
|
+
*
|
|
1701
|
+
* ## Ownership and lifetime
|
|
1702
|
+
*
|
|
1703
|
+
* No callback runs until the result is read or observed. Computed results cannot become absent and
|
|
1704
|
+
* do not add `NoSuchElementError`; only the Filtered overload can fail a current read for absence.
|
|
1705
|
+
* Callback services and failures remain `R2` and `E2`, and the observing Scope owns subscription
|
|
1706
|
+
* cleanup.
|
|
1707
|
+
*
|
|
714
1708
|
* @example
|
|
715
1709
|
* ```ts
|
|
716
1710
|
* import { Effect } from "effect"
|
|
@@ -748,6 +1742,25 @@ export declare const mapEffect: {
|
|
|
748
1742
|
/**
|
|
749
1743
|
* Transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function.
|
|
750
1744
|
*
|
|
1745
|
+
* @remarks
|
|
1746
|
+
* ## Why
|
|
1747
|
+
*
|
|
1748
|
+
* `map` creates derived state instead of copying source state into a component.
|
|
1749
|
+
* Reads and pushed updates remain connected to the original `Versioned` value,
|
|
1750
|
+
* so a projection can be tested without rendering and consumed by any renderer.
|
|
1751
|
+
*
|
|
1752
|
+
* ## Ownership and lifetime
|
|
1753
|
+
*
|
|
1754
|
+
* The returned `Computed` or `Filtered` view does not take ownership of the
|
|
1755
|
+
* source. It follows the source lifetime and preserves its error and service
|
|
1756
|
+
* channels. The pure mapping function adds neither resources nor failures.
|
|
1757
|
+
*
|
|
1758
|
+
* ## Re-computation
|
|
1759
|
+
*
|
|
1760
|
+
* The mapping function runs for the current value and subsequent committed
|
|
1761
|
+
* source versions. Updates still occur on the writable source; the derived view
|
|
1762
|
+
* is read-only unless a more specific bidirectional combinator is used.
|
|
1763
|
+
*
|
|
751
1764
|
* @example
|
|
752
1765
|
* ```ts
|
|
753
1766
|
* import { Effect } from "effect"
|
|
@@ -783,6 +1796,18 @@ export declare const map: {
|
|
|
783
1796
|
/**
|
|
784
1797
|
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function that returns an `Option`.
|
|
785
1798
|
*
|
|
1799
|
+
* @remarks
|
|
1800
|
+
* ## Why
|
|
1801
|
+
*
|
|
1802
|
+
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function
|
|
1803
|
+
* that returns an `Option`. Current reads and pushed versions use the same derivation, preventing
|
|
1804
|
+
* snapshot and subscription behavior from diverging.
|
|
1805
|
+
*
|
|
1806
|
+
* ## Ownership and lifetime
|
|
1807
|
+
*
|
|
1808
|
+
* The filter map effect view retains no independent value. Its Effect read fails with NoSuchElement
|
|
1809
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
1810
|
+
*
|
|
786
1811
|
* @example
|
|
787
1812
|
* ```ts
|
|
788
1813
|
* import { Effect, Option } from "effect"
|
|
@@ -816,6 +1841,18 @@ export declare const filterMapEffect: {
|
|
|
816
1841
|
/**
|
|
817
1842
|
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function that returns an `Option`.
|
|
818
1843
|
*
|
|
1844
|
+
* @remarks
|
|
1845
|
+
* ## Why
|
|
1846
|
+
*
|
|
1847
|
+
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function that
|
|
1848
|
+
* returns an `Option`. Current reads and pushed versions use the same derivation, preventing
|
|
1849
|
+
* snapshot and subscription behavior from diverging.
|
|
1850
|
+
*
|
|
1851
|
+
* ## Ownership and lifetime
|
|
1852
|
+
*
|
|
1853
|
+
* The filter map view retains no independent value. Its Effect read fails with NoSuchElement
|
|
1854
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
1855
|
+
*
|
|
819
1856
|
* @example
|
|
820
1857
|
* ```ts
|
|
821
1858
|
* import { Effect, Option } from "effect"
|
|
@@ -848,6 +1885,18 @@ export declare const filterMap: {
|
|
|
848
1885
|
/**
|
|
849
1886
|
* Converts a `Computed` or `Filtered` of `Option<A>` into a `Filtered<A>`, filtering out `None` values.
|
|
850
1887
|
*
|
|
1888
|
+
* @remarks
|
|
1889
|
+
* ## Why
|
|
1890
|
+
*
|
|
1891
|
+
* Converts a `Computed` or `Filtered` of `Option<A>` into a `Filtered<A>`, filtering out `None`
|
|
1892
|
+
* values. Current reads and pushed versions use the same derivation, preventing snapshot and
|
|
1893
|
+
* subscription behavior from diverging.
|
|
1894
|
+
*
|
|
1895
|
+
* ## Ownership and lifetime
|
|
1896
|
+
*
|
|
1897
|
+
* The compact view retains no independent value. Its Effect read fails with NoSuchElement
|
|
1898
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
1899
|
+
*
|
|
851
1900
|
* @example
|
|
852
1901
|
* ```ts
|
|
853
1902
|
* import { Effect, Option } from "effect"
|
|
@@ -872,14 +1921,28 @@ export declare const filterMap: {
|
|
|
872
1921
|
* @category combinators
|
|
873
1922
|
*/
|
|
874
1923
|
export declare const compact: {
|
|
875
|
-
<A, E, R>(ref: Computed<Option.Option<A>, E, R>): Filtered<A>;
|
|
876
|
-
<A, E, R>(ref: Filtered<Option.Option<A>, E, R>): Filtered<A>;
|
|
1924
|
+
<A, E, R>(ref: Computed<Option.Option<A>, E, R>): Filtered<A, E, R>;
|
|
1925
|
+
<A, E, R>(ref: Filtered<Option.Option<A>, E, R>): Filtered<A, E, R>;
|
|
877
1926
|
<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>>;
|
|
878
1927
|
};
|
|
879
1928
|
/**
|
|
880
1929
|
* Returns a `Computed` that yields the value inside the `Option`, or the fallback when `None`.
|
|
881
1930
|
* Works with `Computed<Option<A>>` (e.g. from `fromOption` / `fromNullable`) and with `Filtered<A>`.
|
|
882
1931
|
*
|
|
1932
|
+
* @remarks
|
|
1933
|
+
* ## Why
|
|
1934
|
+
*
|
|
1935
|
+
* Returns a `Computed` that yields the value inside the `Option`, or the fallback when `None`.
|
|
1936
|
+
* Works with `Computed<Option<A>>` (e.g. from `fromOption` / `fromNullable`) and with
|
|
1937
|
+
* `Filtered<A>`. Current reads and pushed versions use the same derivation, preventing snapshot
|
|
1938
|
+
* and subscription behavior from diverging.
|
|
1939
|
+
*
|
|
1940
|
+
* ## Ownership and lifetime
|
|
1941
|
+
*
|
|
1942
|
+
* The returned Computed never fails for absence: `None` or an absent Filtered value invokes
|
|
1943
|
+
* `fallback`. It preserves only the input's declared `E` and `R`; the pure fallback adds no failure,
|
|
1944
|
+
* service, subscription, or retained value.
|
|
1945
|
+
*
|
|
883
1946
|
* @example
|
|
884
1947
|
* ```ts
|
|
885
1948
|
* import { Effect, Option } from "effect"
|
|
@@ -903,6 +1966,25 @@ export declare const getOrElse: {
|
|
|
903
1966
|
<A>(fallback: () => A): <E, R>(ref: Computed<Option.Option<A>, E, R> | Filtered<A, E, R>) => Computed<A, E, R>;
|
|
904
1967
|
<A, E, R>(ref: Computed<Option.Option<A>, E, R> | Filtered<A, E, R>, fallback: () => A): Computed<A, E, R>;
|
|
905
1968
|
};
|
|
1969
|
+
/**
|
|
1970
|
+
* Limits which pushed versions a RefSubject view observes without changing its state.
|
|
1971
|
+
*
|
|
1972
|
+
* @remarks
|
|
1973
|
+
* ## Why
|
|
1974
|
+
*
|
|
1975
|
+
* Applies `skip` and `take` only to the Fx observation channel. Current reads still sample the
|
|
1976
|
+
* underlying RefSubject directly, and writes still use its original serialized update boundary.
|
|
1977
|
+
*
|
|
1978
|
+
* ## Ownership and lifetime
|
|
1979
|
+
*
|
|
1980
|
+
* Creating the view starts nothing and retains no value. Each observation uses its Scope and ends
|
|
1981
|
+
* after `take` selected pushes; ending that observation does not interrupt or delete the source.
|
|
1982
|
+
* Version, interruption, subscriber count, reads, failures, services, and writes delegate to the
|
|
1983
|
+
* source RefSubject.
|
|
1984
|
+
*
|
|
1985
|
+
* @since 1.18.0
|
|
1986
|
+
* @category combinators
|
|
1987
|
+
*/
|
|
906
1988
|
export declare const slice: {
|
|
907
1989
|
(skip: number, take: number): <A, E, R>(ref: RefSubject<A, E, R>) => RefSubject<A, E, R>;
|
|
908
1990
|
<A, E, R>(ref: RefSubject<A, E, R>, skip: number, take: number): RefSubject<A, E, R>;
|
|
@@ -910,6 +1992,17 @@ export declare const slice: {
|
|
|
910
1992
|
/**
|
|
911
1993
|
* Transforms a `RefSubject` invariantly using bidirectional mapping functions.
|
|
912
1994
|
*
|
|
1995
|
+
* @remarks
|
|
1996
|
+
* ## Why
|
|
1997
|
+
*
|
|
1998
|
+
* Creates a bidirectional lens over state: reads map outward and writes map back to the original
|
|
1999
|
+
* RefSubject without allocating a second store.
|
|
2000
|
+
*
|
|
2001
|
+
* ## Ownership and lifetime
|
|
2002
|
+
*
|
|
2003
|
+
* The derived ref owns no independent state or subscription. It follows the source lifetime and
|
|
2004
|
+
* routes writes through the source's synchronized update boundary.
|
|
2005
|
+
*
|
|
913
2006
|
* @example
|
|
914
2007
|
* ```ts
|
|
915
2008
|
* import { Effect } from "effect"
|
|
@@ -945,7 +2038,9 @@ export declare const transform: {
|
|
|
945
2038
|
<A, E, R, B>(ref: RefSubject<A, E, R>, toB: (a: A) => B, toA: (b: B) => A): RefSubject<B, E, R>;
|
|
946
2039
|
};
|
|
947
2040
|
type RefKind = "r" | "c" | "f";
|
|
948
|
-
type StructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = {
|
|
2041
|
+
type StructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = [keyof Refs] extends [never] ? RefSubject<{
|
|
2042
|
+
readonly [K in keyof Refs]: never;
|
|
2043
|
+
}, never, never> : {
|
|
949
2044
|
c: [ComputedStructFrom<Refs>] extends [Computed<infer A, infer E, infer R>] ? Computed<A, E, R> : never;
|
|
950
2045
|
f: [FilteredStructFrom<Refs>] extends [Filtered<infer A, infer E, infer R>] ? Filtered<A, E, R> : never;
|
|
951
2046
|
r: [RefSubjectStructFrom<Refs>] extends [RefSubject<infer A, infer E, infer R>] ? RefSubject<A, E, R> : never;
|
|
@@ -969,7 +2064,7 @@ type ComputedStructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Co
|
|
|
969
2064
|
type RefSubjectStructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = RefSubject<{
|
|
970
2065
|
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
971
2066
|
}, Effect.Error<Refs[keyof Refs]>, Effect.Services<Refs[keyof Refs]>>;
|
|
972
|
-
type TupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> | Computed<any, any, any> | Filtered<any, any, any>>> = {
|
|
2067
|
+
type TupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> | Computed<any, any, any> | Filtered<any, any, any>>> = Refs extends readonly [] ? RefSubject<readonly [], never, never> : {
|
|
973
2068
|
c: [ComputedTupleFrom<Refs>] extends [Computed<infer A, infer E, infer R>] ? Computed<A, E, R> : never;
|
|
974
2069
|
f: [FilteredTupleFrom<Refs>] extends [Filtered<infer A, infer E, infer R>] ? Filtered<A, E, R> : never;
|
|
975
2070
|
r: [RefSubjectTupleFrom<Refs>] extends [RefSubject<infer A, infer E, infer R>] ? RefSubject<A, E, R> : never;
|
|
@@ -987,6 +2082,17 @@ type RefSubjectTupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> |
|
|
|
987
2082
|
/**
|
|
988
2083
|
* Combines multiple `RefSubject`, `Computed`, or `Filtered` instances into a single struct.
|
|
989
2084
|
*
|
|
2085
|
+
* @remarks
|
|
2086
|
+
* ## Why
|
|
2087
|
+
*
|
|
2088
|
+
* Combines several refs into one state value while preserving whether the result is writable,
|
|
2089
|
+
* computed, or filtered from its inputs.
|
|
2090
|
+
*
|
|
2091
|
+
* ## Ownership and lifetime
|
|
2092
|
+
*
|
|
2093
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
2094
|
+
* source errors, services, and lifetime.
|
|
2095
|
+
*
|
|
990
2096
|
* @example
|
|
991
2097
|
* ```ts
|
|
992
2098
|
* import { Effect } from "effect"
|
|
@@ -1023,6 +2129,17 @@ export declare function struct<const Refs extends Readonly<Record<string, RefSub
|
|
|
1023
2129
|
/**
|
|
1024
2130
|
* Combines multiple `RefSubject`, `Computed`, or `Filtered` instances into a single tuple.
|
|
1025
2131
|
*
|
|
2132
|
+
* @remarks
|
|
2133
|
+
* ## Why
|
|
2134
|
+
*
|
|
2135
|
+
* Combines several refs into one state value while preserving whether the result is writable,
|
|
2136
|
+
* computed, or filtered from its inputs.
|
|
2137
|
+
*
|
|
2138
|
+
* ## Ownership and lifetime
|
|
2139
|
+
*
|
|
2140
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
2141
|
+
* source errors, services, and lifetime.
|
|
2142
|
+
*
|
|
1026
2143
|
* @example
|
|
1027
2144
|
* ```ts
|
|
1028
2145
|
* import { Effect } from "effect"
|
|
@@ -1052,6 +2169,42 @@ export declare function struct<const Refs extends Readonly<Record<string, RefSub
|
|
|
1052
2169
|
* @category combinators
|
|
1053
2170
|
*/
|
|
1054
2171
|
export declare function tuple<const Refs extends ReadonlyArray<Ref>>(refs: Refs): TupleFrom<Refs>;
|
|
2172
|
+
/**
|
|
2173
|
+
* Lifts an Effect-provided Computed into a Computed facade.
|
|
2174
|
+
*
|
|
2175
|
+
* @remarks
|
|
2176
|
+
* ## Why
|
|
2177
|
+
*
|
|
2178
|
+
* Defers service lookup until each version read, current read, interruption, or Fx observation, so
|
|
2179
|
+
* callers can compose a Context-provided Computed without manually flat-mapping the service Effect.
|
|
2180
|
+
*
|
|
2181
|
+
* ## Ownership and lifetime
|
|
2182
|
+
*
|
|
2183
|
+
* The facade caches neither the resolved Computed nor its value. Each operation runs the supplied
|
|
2184
|
+
* Effect, then delegates to the resolved Computed. Service requirements combine as `R | R2`, source
|
|
2185
|
+
* failures remain `E`, and the observing Scope owns the delegated subscription.
|
|
2186
|
+
*
|
|
2187
|
+
* @since 1.18.0
|
|
2188
|
+
* @category combinators
|
|
2189
|
+
*/
|
|
1055
2190
|
export declare function computedFromService<R, A, E, R2>(effect: Effect.Effect<Computed<A, E, R2>, never, R>): Computed<A, E, R | R2>;
|
|
2191
|
+
/**
|
|
2192
|
+
* Defers retrieval of a Filtered value from Effect Context while preserving Filtered behavior.
|
|
2193
|
+
*
|
|
2194
|
+
* @remarks
|
|
2195
|
+
* ## Why
|
|
2196
|
+
*
|
|
2197
|
+
* Lets a service-provided Filtered participate directly in Effect reads and Fx observation without
|
|
2198
|
+
* manually flat-mapping the service tag at every use.
|
|
2199
|
+
*
|
|
2200
|
+
* ## Ownership and lifetime
|
|
2201
|
+
*
|
|
2202
|
+
* The filtered from service view retains no independent value. Its Effect read fails with NoSuchElement
|
|
2203
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
2204
|
+
*
|
|
2205
|
+
* @since 1.18.0
|
|
2206
|
+
* @category combinators
|
|
2207
|
+
*/
|
|
1056
2208
|
export declare function filteredFromService<R, A, E, R2>(effect: Effect.Effect<Filtered<A, E, R2>, never, R>): Filtered<A, E, R | R2>;
|
|
2209
|
+
export * from "./Hydration.js";
|
|
1057
2210
|
//# sourceMappingURL=RefSubject.d.ts.map
|