@typed/fx 2.0.0-beta.1 → 2.0.0-beta.11
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/LICENSE +21 -0
- package/README.md +35 -21
- package/dist/Fx/Fx.d.ts +371 -19
- package/dist/Fx/Fx.d.ts.map +1 -1
- package/dist/Fx/Fx.js +37 -6
- package/dist/Fx/TypeId.d.ts +52 -6
- package/dist/Fx/TypeId.d.ts.map +1 -1
- package/dist/Fx/TypeId.js +41 -4
- package/dist/Fx/combinators/additive.d.ts +162 -11
- package/dist/Fx/combinators/additive.d.ts.map +1 -1
- package/dist/Fx/combinators/additive.js +162 -11
- package/dist/Fx/combinators/catch.d.ts +202 -29
- package/dist/Fx/combinators/catch.d.ts.map +1 -1
- package/dist/Fx/combinators/catch.js +193 -23
- package/dist/Fx/combinators/causes.d.ts +25 -2
- package/dist/Fx/combinators/causes.d.ts.map +1 -1
- package/dist/Fx/combinators/causes.js +25 -2
- package/dist/Fx/combinators/changesWithEffect.d.ts +21 -1
- package/dist/Fx/combinators/changesWithEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/changesWithEffect.js +21 -1
- package/dist/Fx/combinators/compact.d.ts +18 -1
- package/dist/Fx/combinators/compact.d.ts.map +1 -1
- package/dist/Fx/combinators/compact.js +18 -1
- 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 +113 -5
- package/dist/Fx/combinators/continueWith.d.ts.map +1 -1
- package/dist/Fx/combinators/continueWith.js +113 -5
- 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 +36 -0
- package/dist/Fx/combinators/delay.d.ts.map +1 -0
- package/dist/Fx/combinators/delay.js +33 -0
- package/dist/Fx/combinators/dropUntil.d.ts +44 -2
- package/dist/Fx/combinators/dropUntil.d.ts.map +1 -1
- package/dist/Fx/combinators/dropUntil.js +44 -2
- 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 +34 -4
- package/dist/Fx/combinators/ensuring.d.ts.map +1 -1
- package/dist/Fx/combinators/ensuring.js +34 -4
- package/dist/Fx/combinators/exhaustLatestMap.d.ts +41 -5
- package/dist/Fx/combinators/exhaustLatestMap.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustLatestMap.js +41 -5
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts +40 -4
- package/dist/Fx/combinators/exhaustLatestMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustLatestMapEffect.js +40 -4
- package/dist/Fx/combinators/exhaustMap.d.ts +38 -1
- package/dist/Fx/combinators/exhaustMap.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustMap.js +38 -1
- package/dist/Fx/combinators/exhaustMapEffect.d.ts +33 -1
- package/dist/Fx/combinators/exhaustMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/exhaustMapEffect.js +33 -1
- package/dist/Fx/combinators/exit.d.ts +23 -2
- package/dist/Fx/combinators/exit.d.ts.map +1 -1
- package/dist/Fx/combinators/exit.js +23 -2
- package/dist/Fx/combinators/filter.d.ts +17 -1
- package/dist/Fx/combinators/filter.d.ts.map +1 -1
- package/dist/Fx/combinators/filter.js +17 -1
- package/dist/Fx/combinators/filterEffect.d.ts +22 -1
- package/dist/Fx/combinators/filterEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterEffect.js +22 -1
- package/dist/Fx/combinators/filterMap.d.ts +20 -1
- package/dist/Fx/combinators/filterMap.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMap.js +20 -1
- package/dist/Fx/combinators/filterMapEffect.d.ts +21 -1
- package/dist/Fx/combinators/filterMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapEffect.js +21 -1
- package/dist/Fx/combinators/filterMapLoop.d.ts +20 -1
- package/dist/Fx/combinators/filterMapLoop.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoop.js +20 -1
- package/dist/Fx/combinators/filterMapLoopCause.d.ts +21 -1
- package/dist/Fx/combinators/filterMapLoopCause.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopCause.js +21 -1
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts +21 -1
- package/dist/Fx/combinators/filterMapLoopCauseEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopCauseEffect.js +21 -1
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts +21 -1
- package/dist/Fx/combinators/filterMapLoopEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/filterMapLoopEffect.js +21 -1
- package/dist/Fx/combinators/flatMap.d.ts +50 -5
- package/dist/Fx/combinators/flatMap.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMap.js +36 -3
- package/dist/Fx/combinators/flatMapConcurrently.d.ts +51 -4
- package/dist/Fx/combinators/flatMapConcurrently.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapConcurrently.js +48 -2
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts +48 -4
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapConcurrentlyEffect.js +40 -2
- package/dist/Fx/combinators/flatMapEffect.d.ts +46 -4
- package/dist/Fx/combinators/flatMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/flatMapEffect.js +32 -2
- package/dist/Fx/combinators/flip.d.ts +34 -2
- package/dist/Fx/combinators/flip.d.ts.map +1 -1
- package/dist/Fx/combinators/flip.js +34 -2
- package/dist/Fx/combinators/gen.d.ts +29 -10
- package/dist/Fx/combinators/gen.d.ts.map +1 -1
- package/dist/Fx/combinators/gen.js +28 -4
- package/dist/Fx/combinators/genScoped.d.ts +33 -10
- package/dist/Fx/combinators/genScoped.d.ts.map +1 -1
- package/dist/Fx/combinators/genScoped.js +31 -3
- 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 +123 -9
- package/dist/Fx/combinators/keyed.d.ts.map +1 -1
- package/dist/Fx/combinators/keyed.js +69 -11
- package/dist/Fx/combinators/loop.d.ts +17 -1
- package/dist/Fx/combinators/loop.d.ts.map +1 -1
- package/dist/Fx/combinators/loop.js +17 -1
- package/dist/Fx/combinators/loopCause.d.ts +18 -1
- package/dist/Fx/combinators/loopCause.d.ts.map +1 -1
- package/dist/Fx/combinators/loopCause.js +18 -1
- package/dist/Fx/combinators/loopCauseEffect.d.ts +19 -1
- package/dist/Fx/combinators/loopCauseEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/loopCauseEffect.js +19 -1
- package/dist/Fx/combinators/loopEffect.d.ts +24 -1
- package/dist/Fx/combinators/loopEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/loopEffect.js +24 -1
- package/dist/Fx/combinators/map.d.ts +46 -1
- package/dist/Fx/combinators/map.d.ts.map +1 -1
- package/dist/Fx/combinators/map.js +43 -1
- package/dist/Fx/combinators/mapBoth.d.ts +20 -1
- package/dist/Fx/combinators/mapBoth.d.ts.map +1 -1
- package/dist/Fx/combinators/mapBoth.js +20 -1
- package/dist/Fx/combinators/mapEffect.d.ts +25 -1
- package/dist/Fx/combinators/mapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/mapEffect.js +25 -1
- package/dist/Fx/combinators/mapError.d.ts +21 -5
- package/dist/Fx/combinators/mapError.d.ts.map +1 -1
- package/dist/Fx/combinators/mapError.js +21 -5
- package/dist/Fx/combinators/mergeAll.d.ts +35 -1
- package/dist/Fx/combinators/mergeAll.d.ts.map +1 -1
- package/dist/Fx/combinators/mergeAll.js +35 -1
- package/dist/Fx/combinators/mergeOrdered.d.ts +36 -4
- package/dist/Fx/combinators/mergeOrdered.d.ts.map +1 -1
- package/dist/Fx/combinators/mergeOrdered.js +68 -14
- package/dist/Fx/combinators/onError.d.ts +34 -4
- package/dist/Fx/combinators/onError.d.ts.map +1 -1
- package/dist/Fx/combinators/onError.js +34 -4
- package/dist/Fx/combinators/onExit.d.ts +29 -3
- package/dist/Fx/combinators/onExit.d.ts.map +1 -1
- package/dist/Fx/combinators/onExit.js +29 -3
- package/dist/Fx/combinators/onInterrupt.d.ts +49 -4
- package/dist/Fx/combinators/onInterrupt.d.ts.map +1 -1
- package/dist/Fx/combinators/onInterrupt.js +49 -4
- 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 +141 -20
- package/dist/Fx/combinators/provide.d.ts.map +1 -1
- package/dist/Fx/combinators/provide.js +137 -16
- 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 +23 -1
- package/dist/Fx/combinators/result.d.ts.map +1 -1
- package/dist/Fx/combinators/result.js +27 -13
- 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 +41 -2
- package/dist/Fx/combinators/scan.d.ts.map +1 -1
- package/dist/Fx/combinators/scan.js +43 -4
- 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 +33 -2
- package/dist/Fx/combinators/skip.d.ts.map +1 -1
- package/dist/Fx/combinators/skip.js +33 -2
- package/dist/Fx/combinators/skipRepeats.d.ts +17 -1
- package/dist/Fx/combinators/skipRepeats.d.ts.map +1 -1
- package/dist/Fx/combinators/skipRepeats.js +17 -1
- package/dist/Fx/combinators/skipRepeatsWith.d.ts +18 -1
- package/dist/Fx/combinators/skipRepeatsWith.d.ts.map +1 -1
- package/dist/Fx/combinators/skipRepeatsWith.js +18 -1
- package/dist/Fx/combinators/skipWhile.d.ts +72 -4
- package/dist/Fx/combinators/skipWhile.d.ts.map +1 -1
- package/dist/Fx/combinators/skipWhile.js +72 -4
- package/dist/Fx/combinators/slice.d.ts +85 -3
- package/dist/Fx/combinators/slice.d.ts.map +1 -1
- package/dist/Fx/combinators/slice.js +35 -2
- package/dist/Fx/combinators/switchMap.d.ts +39 -1
- package/dist/Fx/combinators/switchMap.d.ts.map +1 -1
- package/dist/Fx/combinators/switchMap.js +43 -5
- package/dist/Fx/combinators/switchMapEffect.d.ts +38 -1
- package/dist/Fx/combinators/switchMapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/switchMapEffect.js +38 -1
- package/dist/Fx/combinators/take.d.ts +34 -2
- package/dist/Fx/combinators/take.d.ts.map +1 -1
- package/dist/Fx/combinators/take.js +34 -2
- package/dist/Fx/combinators/takeUntil.d.ts +49 -3
- package/dist/Fx/combinators/takeUntil.d.ts.map +1 -1
- package/dist/Fx/combinators/takeUntil.js +49 -3
- package/dist/Fx/combinators/takeWhile.d.ts +33 -2
- package/dist/Fx/combinators/takeWhile.d.ts.map +1 -1
- package/dist/Fx/combinators/takeWhile.js +33 -2
- package/dist/Fx/combinators/tapEffect.d.ts +17 -1
- package/dist/Fx/combinators/tapEffect.d.ts.map +1 -1
- package/dist/Fx/combinators/tapEffect.js +17 -1
- 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 +32 -2
- package/dist/Fx/combinators/tuple.d.ts.map +1 -1
- package/dist/Fx/combinators/tuple.js +36 -5
- 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 +31 -2
- package/dist/Fx/combinators/unwrap.d.ts.map +1 -1
- package/dist/Fx/combinators/unwrap.js +30 -1
- package/dist/Fx/combinators/unwrapScoped.d.ts +34 -1
- package/dist/Fx/combinators/unwrapScoped.d.ts.map +1 -1
- package/dist/Fx/combinators/unwrapScoped.js +34 -1
- package/dist/Fx/combinators/when.d.ts +37 -2
- package/dist/Fx/combinators/when.d.ts.map +1 -1
- package/dist/Fx/combinators/when.js +38 -3
- 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 +64 -4
- package/dist/Fx/combinators/zip.d.ts.map +1 -1
- package/dist/Fx/combinators/zip.js +64 -4
- package/dist/Fx/constructors/at.d.ts +21 -1
- package/dist/Fx/constructors/at.d.ts.map +1 -1
- package/dist/Fx/constructors/at.js +21 -1
- package/dist/Fx/constructors/die.d.ts +22 -1
- package/dist/Fx/constructors/die.d.ts.map +1 -1
- package/dist/Fx/constructors/die.js +22 -1
- package/dist/Fx/constructors/empty.d.ts +19 -1
- package/dist/Fx/constructors/empty.d.ts.map +1 -1
- package/dist/Fx/constructors/empty.js +19 -1
- package/dist/Fx/constructors/fail.d.ts +22 -1
- package/dist/Fx/constructors/fail.d.ts.map +1 -1
- package/dist/Fx/constructors/fail.js +22 -1
- package/dist/Fx/constructors/failCause.d.ts +23 -1
- package/dist/Fx/constructors/failCause.d.ts.map +1 -1
- package/dist/Fx/constructors/failCause.js +23 -1
- package/dist/Fx/constructors/fn.d.ts +116 -16
- 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 +45 -3
- package/dist/Fx/constructors/fromEffect.d.ts.map +1 -1
- package/dist/Fx/constructors/fromEffect.js +45 -3
- package/dist/Fx/constructors/fromFailures.d.ts +25 -1
- package/dist/Fx/constructors/fromFailures.d.ts.map +1 -1
- package/dist/Fx/constructors/fromFailures.js +25 -1
- package/dist/Fx/constructors/fromIterable.d.ts +23 -1
- package/dist/Fx/constructors/fromIterable.d.ts.map +1 -1
- package/dist/Fx/constructors/fromIterable.js +23 -1
- package/dist/Fx/constructors/fromSchedule.d.ts +26 -1
- package/dist/Fx/constructors/fromSchedule.d.ts.map +1 -1
- package/dist/Fx/constructors/fromSchedule.js +28 -3
- 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 +22 -2
- package/dist/Fx/constructors/interrupt.d.ts.map +1 -1
- package/dist/Fx/constructors/interrupt.js +22 -2
- package/dist/Fx/constructors/make.d.ts +151 -4
- package/dist/Fx/constructors/make.d.ts.map +1 -1
- package/dist/Fx/constructors/make.js +60 -7
- package/dist/Fx/constructors/periodic.d.ts +30 -1
- package/dist/Fx/constructors/periodic.d.ts.map +1 -1
- package/dist/Fx/constructors/periodic.js +30 -1
- package/dist/Fx/constructors/succeed.d.ts +79 -7
- package/dist/Fx/constructors/succeed.d.ts.map +1 -1
- package/dist/Fx/constructors/succeed.js +79 -7
- 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 +70 -0
- package/dist/Fx/internal/effectableWithOverride.d.ts.map +1 -0
- package/dist/Fx/internal/effectableWithOverride.js +54 -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 +93 -4
- package/dist/Fx/run/collect.d.ts.map +1 -1
- package/dist/Fx/run/collect.js +94 -5
- package/dist/Fx/run/first.d.ts +23 -1
- package/dist/Fx/run/first.d.ts.map +1 -1
- package/dist/Fx/run/first.js +23 -1
- package/dist/Fx/run/fork.d.ts +52 -2
- package/dist/Fx/run/fork.d.ts.map +1 -1
- package/dist/Fx/run/fork.js +52 -2
- package/dist/Fx/run/observe.d.ts +112 -4
- package/dist/Fx/run/observe.d.ts.map +1 -1
- package/dist/Fx/run/observe.js +137 -16
- package/dist/Fx/run/runPromise.d.ts +45 -2
- package/dist/Fx/run/runPromise.d.ts.map +1 -1
- package/dist/Fx/run/runPromise.js +45 -2
- 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 +1229 -104
- package/dist/Push/Push.d.ts.map +1 -1
- package/dist/Push/Push.js +1024 -95
- 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 +382 -35
- package/dist/RefSubject/RefArray.d.ts.map +1 -1
- package/dist/RefSubject/RefArray.js +374 -40
- package/dist/RefSubject/RefBigDecimal.d.ts +241 -21
- package/dist/RefSubject/RefBigDecimal.d.ts.map +1 -1
- package/dist/RefSubject/RefBigDecimal.js +229 -20
- package/dist/RefSubject/RefBigInt.d.ts +181 -16
- package/dist/RefSubject/RefBigInt.d.ts.map +1 -1
- package/dist/RefSubject/RefBigInt.js +169 -15
- package/dist/RefSubject/RefBoolean.d.ts +181 -16
- package/dist/RefSubject/RefBoolean.d.ts.map +1 -1
- package/dist/RefSubject/RefBoolean.js +169 -15
- package/dist/RefSubject/RefCause.d.ts +133 -12
- package/dist/RefSubject/RefCause.d.ts.map +1 -1
- package/dist/RefSubject/RefCause.js +121 -11
- package/dist/RefSubject/RefChunk.d.ts +481 -76
- package/dist/RefSubject/RefChunk.d.ts.map +1 -1
- package/dist/RefSubject/RefChunk.js +471 -75
- package/dist/RefSubject/RefDateTime.d.ts +133 -12
- package/dist/RefSubject/RefDateTime.d.ts.map +1 -1
- package/dist/RefSubject/RefDateTime.js +122 -12
- package/dist/RefSubject/RefDuration.d.ts +169 -15
- package/dist/RefSubject/RefDuration.d.ts.map +1 -1
- package/dist/RefSubject/RefDuration.js +157 -14
- package/dist/RefSubject/RefGraph.d.ts +349 -35
- package/dist/RefSubject/RefGraph.d.ts.map +1 -1
- package/dist/RefSubject/RefGraph.js +334 -32
- package/dist/RefSubject/RefHashMap.d.ts +323 -28
- package/dist/RefSubject/RefHashMap.d.ts.map +1 -1
- package/dist/RefSubject/RefHashMap.js +317 -29
- package/dist/RefSubject/RefHashRing.d.ts +159 -15
- package/dist/RefSubject/RefHashRing.d.ts.map +1 -1
- package/dist/RefSubject/RefHashRing.js +145 -12
- package/dist/RefSubject/RefHashSet.d.ts +251 -22
- package/dist/RefSubject/RefHashSet.d.ts.map +1 -1
- package/dist/RefSubject/RefHashSet.js +238 -20
- package/dist/RefSubject/RefIterable.d.ts +358 -32
- package/dist/RefSubject/RefIterable.d.ts.map +1 -1
- package/dist/RefSubject/RefIterable.js +350 -30
- package/dist/RefSubject/RefOption.d.ts +157 -14
- package/dist/RefSubject/RefOption.d.ts.map +1 -1
- package/dist/RefSubject/RefOption.js +145 -13
- package/dist/RefSubject/RefRecord.d.ts +402 -64
- package/dist/RefSubject/RefRecord.d.ts.map +1 -1
- package/dist/RefSubject/RefRecord.js +364 -39
- package/dist/RefSubject/RefResult.d.ts +167 -35
- package/dist/RefSubject/RefResult.d.ts.map +1 -1
- package/dist/RefSubject/RefResult.js +133 -12
- package/dist/RefSubject/RefString.d.ts +205 -18
- package/dist/RefSubject/RefString.d.ts.map +1 -1
- package/dist/RefSubject/RefString.js +193 -17
- package/dist/RefSubject/RefStruct.d.ts +169 -14
- package/dist/RefSubject/RefStruct.d.ts.map +1 -1
- package/dist/RefSubject/RefStruct.js +157 -13
- package/dist/RefSubject/RefSubject.d.ts +1197 -45
- package/dist/RefSubject/RefSubject.d.ts.map +1 -1
- package/dist/RefSubject/RefSubject.js +935 -88
- package/dist/RefSubject/RefTrie.d.ts +323 -37
- package/dist/RefSubject/RefTrie.d.ts.map +1 -1
- package/dist/RefSubject/RefTrie.js +311 -31
- package/dist/RefSubject/RefTuple.d.ts +127 -11
- package/dist/RefSubject/RefTuple.d.ts.map +1 -1
- package/dist/RefSubject/RefTuple.js +114 -9
- 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 +396 -23
- package/dist/Sink/Sink.d.ts.map +1 -1
- package/dist/Sink/Sink.js +55 -7
- package/dist/Sink/combinators.d.ts +740 -11
- package/dist/Sink/combinators.d.ts.map +1 -1
- package/dist/Sink/combinators.js +716 -14
- package/dist/Subject/Subject.d.ts +1022 -27
- package/dist/Subject/Subject.d.ts.map +1 -1
- package/dist/Subject/Subject.js +909 -43
- package/dist/Versioned/Versioned.d.ts +447 -27
- package/dist/Versioned/Versioned.d.ts.map +1 -1
- package/dist/Versioned/Versioned.js +282 -48
- package/dist/index.d.ts +22 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -3
- package/package.json +126 -16
- 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 -421
- 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 -512
- 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 -510
- package/src/RefSubject/RefDateTime.test.ts +0 -43
- package/src/RefSubject/RefDateTime.ts +0 -264
- package/src/RefSubject/RefDuration.test.ts +0 -49
- package/src/RefSubject/RefDuration.ts +0 -188
- package/src/RefSubject/RefGraph.ts +0 -650
- package/src/RefSubject/RefHashMap.ts +0 -465
- package/src/RefSubject/RefHashRing.ts +0 -262
- package/src/RefSubject/RefHashSet.ts +0 -308
- package/src/RefSubject/RefIterable.ts +0 -445
- package/src/RefSubject/RefOption.test.ts +0 -67
- package/src/RefSubject/RefOption.ts +0 -193
- package/src/RefSubject/RefRecord.ts +0 -612
- 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 -2646
- package/src/RefSubject/RefTrie.ts +0 -356
- 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 Type identity
|
|
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 utilities
|
|
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 Type identity
|
|
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 utilities
|
|
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 Type identity
|
|
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 utilities
|
|
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
|
|
@@ -50,22 +157,83 @@ export type FilteredTypeId = typeof FilteredTypeId;
|
|
|
50
157
|
* ```
|
|
51
158
|
*
|
|
52
159
|
* @since 1.0.0
|
|
53
|
-
* @category
|
|
160
|
+
* @category Read-only state
|
|
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 State protocol
|
|
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 Read-only state
|
|
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 utilities
|
|
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* () {
|
|
@@ -89,9 +257,26 @@ export declare namespace Computed {
|
|
|
89
257
|
* ```
|
|
90
258
|
*
|
|
91
259
|
* @since 1.0.0
|
|
92
|
-
* @category
|
|
260
|
+
* @category Read-only state
|
|
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 State protocol
|
|
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 Optional queries
|
|
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 Read-only state
|
|
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 utilities
|
|
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
|
-
* @category
|
|
367
|
+
* @category Transactions
|
|
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 Current reads
|
|
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 State updates
|
|
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 State updates
|
|
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
|
-
* @category
|
|
470
|
+
* @category Writable state
|
|
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 State protocol
|
|
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 Transactions
|
|
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,371 @@ export interface RefSubject<A, E = never, R = never> extends Computed<A, E, R>,
|
|
|
211
544
|
* yield* ref.interrupt
|
|
212
545
|
* })
|
|
213
546
|
* ```
|
|
547
|
+
* @category Lifetime
|
|
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 Writable state
|
|
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 utilities
|
|
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 Services
|
|
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 Services
|
|
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 Services
|
|
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 Service layers
|
|
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 Services
|
|
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 utilities
|
|
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 Observation policy
|
|
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 cache the transformed input by source version within each Effect Context. The
|
|
763
|
+
* pushed channel uses `Subject.hold`: observers with the same Context object share one upstream
|
|
764
|
+
* session and its retained projection; distinct Context objects have separate sessions. The last
|
|
765
|
+
* observer ends its session and clears its held value. The observing Scope owns cleanup.
|
|
766
|
+
*
|
|
767
|
+
* @since 1.18.0
|
|
768
|
+
* @category Derived queries
|
|
769
|
+
*/
|
|
233
770
|
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>>;
|
|
771
|
+
/**
|
|
772
|
+
* Stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the accumulated state.
|
|
773
|
+
*
|
|
774
|
+
* Fx subscriptions follow `Fx.scan` semantics (emit `initial`, then fold each source value).
|
|
775
|
+
* Effect sampling accumulates across source versions via a private state ref (do not mix heavy
|
|
776
|
+
* subscribe + sample on the same scan if you need a single shared accumulator).
|
|
777
|
+
*
|
|
778
|
+
* @remarks
|
|
779
|
+
* ## Why
|
|
780
|
+
*
|
|
781
|
+
* Stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the accumulated state.
|
|
782
|
+
* Fx subscriptions follow `Fx.scan` semantics (emit `initial`, then fold each source value).
|
|
783
|
+
* Effect sampling accumulates across source versions via a private state ref (do not mix heavy
|
|
784
|
+
* subscribe + sample on the same scan if you need a single shared accumulator). The result remains
|
|
785
|
+
* a lazy view rather than a duplicated mutable value.
|
|
786
|
+
*
|
|
787
|
+
* ## Ownership and lifetime
|
|
788
|
+
*
|
|
789
|
+
* Each Effect Context object gets a private current-read accumulator, advanced after a successful
|
|
790
|
+
* fold for a new source version. The pushed channel runs `Fx.scanEffect` from `initial` inside
|
|
791
|
+
* `Subject.hold`: observers using the same Context share that active scan and retained result.
|
|
792
|
+
* The last observer ends its session and clears its held value. The observing Scope owns
|
|
793
|
+
* subscription cleanup. Read accumulators are weakly held by Context and need no finalizer.
|
|
794
|
+
*
|
|
795
|
+
* @since 1.0.0
|
|
796
|
+
* @category Accumulation
|
|
797
|
+
*/
|
|
798
|
+
export declare const scan: {
|
|
799
|
+
<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>;
|
|
800
|
+
<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>;
|
|
801
|
+
<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>>;
|
|
802
|
+
};
|
|
803
|
+
/**
|
|
804
|
+
* Effectful stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the accumulated state.
|
|
805
|
+
*
|
|
806
|
+
* @remarks
|
|
807
|
+
* ## Why
|
|
808
|
+
*
|
|
809
|
+
* Effectful stateful scan over a `RefSubject` / `Computed`, producing a `Computed` of the
|
|
810
|
+
* accumulated state. The result remains a lazy view rather than a duplicated mutable value.
|
|
811
|
+
*
|
|
812
|
+
* ## Ownership and lifetime
|
|
813
|
+
*
|
|
814
|
+
* Each Effect Context object gets a private current-read accumulator. It advances only after `f`
|
|
815
|
+
* succeeds, so a typed failure leaves the previous state intact. The pushed channel runs
|
|
816
|
+
* `Fx.scanEffect` from `initial` inside `Subject.hold`: observers using the same Context share
|
|
817
|
+
* that active scan and retained result; each fold requires `R3`. The last observer ends its
|
|
818
|
+
* session and clears its held value. The observing Scope owns cleanup. Read accumulators are
|
|
819
|
+
* weakly held by Context and need no finalizer.
|
|
820
|
+
*
|
|
821
|
+
* @since 1.0.0
|
|
822
|
+
* @category Accumulation
|
|
823
|
+
*/
|
|
824
|
+
export declare const scanEffect: {
|
|
825
|
+
<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>;
|
|
826
|
+
<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>;
|
|
827
|
+
<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>>;
|
|
828
|
+
};
|
|
829
|
+
/**
|
|
830
|
+
* Builds a Filtered view from the three channels of a Versioned source.
|
|
831
|
+
*
|
|
832
|
+
* @remarks
|
|
833
|
+
* ## Why
|
|
834
|
+
*
|
|
835
|
+
* Applies `f` to current reads and later pushes while preserving absence as Filtered semantics:
|
|
836
|
+
* Effect reads fail with `NoSuchElementError`, whereas the Fx channel simply omits absent values.
|
|
837
|
+
*
|
|
838
|
+
* ## Ownership and lifetime
|
|
839
|
+
*
|
|
840
|
+
* Sampled results and pushed sessions are isolated by Effect Context identity. Within one Context,
|
|
841
|
+
* current reads cache by source version and observers share the active held projection. Its
|
|
842
|
+
* Effect read fails with NoSuchElement while absent; the observing Scope owns its subscription.
|
|
843
|
+
*
|
|
844
|
+
* @since 1.18.0
|
|
845
|
+
* @category Optional queries
|
|
846
|
+
*/
|
|
234
847
|
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>;
|
|
848
|
+
/**
|
|
849
|
+
* Defines the ref subject options state contract.
|
|
850
|
+
*
|
|
851
|
+
* @remarks
|
|
852
|
+
* ## Why
|
|
853
|
+
*
|
|
854
|
+
* Configures equality for committed RefSubject values.
|
|
855
|
+
*
|
|
856
|
+
* ## Ownership and lifetime
|
|
857
|
+
*
|
|
858
|
+
* RefSubjectOptions is a contract and performs no acquisition. Implementations retain the errors,
|
|
859
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
860
|
+
*
|
|
861
|
+
* @since 1.18.0
|
|
862
|
+
* @category Construction options
|
|
863
|
+
*/
|
|
235
864
|
export interface RefSubjectOptions<A> {
|
|
865
|
+
/**
|
|
866
|
+
* Optional equivalence used to suppress unchanged commits.
|
|
867
|
+
*
|
|
868
|
+
* @remarks
|
|
869
|
+
* ## Why
|
|
870
|
+
*
|
|
871
|
+
* Suppresses publication and version changes when a candidate value is equivalent to the
|
|
872
|
+
* currently committed value.
|
|
873
|
+
*
|
|
874
|
+
* ## Ownership and lifetime
|
|
875
|
+
*
|
|
876
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
877
|
+
* source errors, services, and lifetime.
|
|
878
|
+
*
|
|
879
|
+
* @since 1.18.0
|
|
880
|
+
* @category Equality
|
|
881
|
+
*/
|
|
236
882
|
readonly eq?: Equivalence<A>;
|
|
237
883
|
}
|
|
238
884
|
/**
|
|
239
885
|
* Creates a new `RefSubject` from a value, `Effect`, or `Fx`.
|
|
240
886
|
*
|
|
887
|
+
* @remarks
|
|
888
|
+
* ## Why
|
|
889
|
+
*
|
|
890
|
+
* `RefSubject` keeps current state and pushed changes independent of any UI
|
|
891
|
+
* renderer. Domain transitions can therefore be constructed, composed, and
|
|
892
|
+
* tested with Effect alone; rendering is one optional consumer of the state.
|
|
893
|
+
* Plain values, Effect programs, pull-based Effect `Stream`s, and push-based
|
|
894
|
+
* `Fx` sources all enter through the same state boundary.
|
|
895
|
+
*
|
|
896
|
+
* ## Ownership and lifetime
|
|
897
|
+
*
|
|
898
|
+
* Creation requires an Effect `Scope`. That scope owns source acquisition,
|
|
899
|
+
* subscriptions, and finalization. The returned `RefSubject` exposes the
|
|
900
|
+
* source error type when read or observed, while construction itself cannot
|
|
901
|
+
* fail. Closing the scope interrupts a live source and releases its resources.
|
|
902
|
+
*
|
|
903
|
+
* ## Initialization
|
|
904
|
+
*
|
|
905
|
+
* Calling `make` is lazy because it returns an Effect: nothing is allocated and no source runs
|
|
906
|
+
* until that creation Effect is executed. After creation, a plain value is immediately available.
|
|
907
|
+
* An Effect input runs once on the first current read or observation. Fx and Stream inputs instead
|
|
908
|
+
* start one shared source run when the creation Effect executes; reads wait for their first value
|
|
909
|
+
* or failure and later emissions replace the retained current state. Equality and buffering
|
|
910
|
+
* behavior can be customized with `RefSubjectOptions`.
|
|
911
|
+
*
|
|
241
912
|
* @example
|
|
242
913
|
* ```ts
|
|
243
914
|
* import { Effect } from "effect"
|
|
@@ -271,12 +942,25 @@ export interface RefSubjectOptions<A> {
|
|
|
271
942
|
* ```
|
|
272
943
|
*
|
|
273
944
|
* @since 1.0.0
|
|
274
|
-
* @category
|
|
945
|
+
* @category Constructors
|
|
275
946
|
*/
|
|
276
947
|
export declare function make<A, E = never, R = never>(effect: A | Effect.Effect<A, E, R> | Stream.Stream<A, E, R> | Fx<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
277
948
|
/**
|
|
278
949
|
* Creates a `RefSubject` from an `Effect`.
|
|
279
950
|
*
|
|
951
|
+
* @remarks
|
|
952
|
+
* ## Why
|
|
953
|
+
*
|
|
954
|
+
* Makes effect acquisition explicit while normalizing it into current RefSubject state and
|
|
955
|
+
* subsequent pushed versions.
|
|
956
|
+
*
|
|
957
|
+
* ## Ownership and lifetime
|
|
958
|
+
*
|
|
959
|
+
* The creation Effect requires Scope and the source's services, which it captures for the private
|
|
960
|
+
* initializer Scope. The source Effect itself stays deferred until the first current read or
|
|
961
|
+
* observation and runs at most once. Source failures remain visible on reads and observations;
|
|
962
|
+
* closing the creation Scope interrupts an initializer that is still running.
|
|
963
|
+
*
|
|
280
964
|
* @example
|
|
281
965
|
* ```ts
|
|
282
966
|
* import { Effect } from "effect"
|
|
@@ -293,12 +977,23 @@ export declare function make<A, E = never, R = never>(effect: A | Effect.Effect<
|
|
|
293
977
|
* ```
|
|
294
978
|
*
|
|
295
979
|
* @since 1.0.0
|
|
296
|
-
* @category
|
|
980
|
+
* @category Source adapters
|
|
297
981
|
*/
|
|
298
982
|
export declare function fromEffect<A, E, R>(effect: Effect.Effect<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
299
983
|
/**
|
|
300
984
|
* Creates a `RefSubject` from an `Fx`, tracking the latest emitted value.
|
|
301
985
|
*
|
|
986
|
+
* @remarks
|
|
987
|
+
* ## Why
|
|
988
|
+
*
|
|
989
|
+
* Makes fx acquisition explicit while normalizing it into current RefSubject state and subsequent
|
|
990
|
+
* pushed versions.
|
|
991
|
+
*
|
|
992
|
+
* ## Ownership and lifetime
|
|
993
|
+
*
|
|
994
|
+
* The creation Effect requires Scope. It owns initializer acquisition, live source subscriptions,
|
|
995
|
+
* and cleanup; source failures and services stay on reads and pushes.
|
|
996
|
+
*
|
|
302
997
|
* @example
|
|
303
998
|
* ```ts
|
|
304
999
|
* import { Effect } from "effect"
|
|
@@ -319,13 +1014,45 @@ export declare function fromEffect<A, E, R>(effect: Effect.Effect<A, E, R>, opti
|
|
|
319
1014
|
* ```
|
|
320
1015
|
*
|
|
321
1016
|
* @since 1.0.0
|
|
322
|
-
* @category
|
|
1017
|
+
* @category Source adapters
|
|
323
1018
|
*/
|
|
324
1019
|
export declare function fromFx<A, E, R>(fx: Fx<A, E, R>, options?: RefSubjectOptions<A>): Effect.Effect<RefSubject<A, E>, never, R | Scope.Scope>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Creates a RefSubject that tracks the latest value emitted by an Effect Stream.
|
|
1022
|
+
*
|
|
1023
|
+
* @remarks
|
|
1024
|
+
* ## Why
|
|
1025
|
+
*
|
|
1026
|
+
* Bridges a pull-based Stream into renderer-independent state: each emitted value enters the
|
|
1027
|
+
* RefSubject's serialized commit path, while a stream failure becomes the ref's current and pushed
|
|
1028
|
+
* failure.
|
|
1029
|
+
*
|
|
1030
|
+
* ## Ownership and lifetime
|
|
1031
|
+
*
|
|
1032
|
+
* Construction forks stream consumption immediately into the RefSubject's private Scope and cannot
|
|
1033
|
+
* fail. `R` is required while constructing that fiber; closing the outer Scope interrupts it.
|
|
1034
|
+
* Before the first value or failure, a current read waits for initialization. Later reads and pushes
|
|
1035
|
+
* expose `E`.
|
|
1036
|
+
*
|
|
1037
|
+
* @since 1.18.0
|
|
1038
|
+
* @category Source adapters
|
|
1039
|
+
*/
|
|
325
1040
|
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
1041
|
/**
|
|
327
1042
|
* Creates a `RefSubject` from an `Option` value.
|
|
328
1043
|
*
|
|
1044
|
+
* @remarks
|
|
1045
|
+
* ## Why
|
|
1046
|
+
*
|
|
1047
|
+
* Stores the Option itself in writable state. `None` is an ordinary current value and does not add
|
|
1048
|
+
* `NoSuchElementError`; callers opt into absence semantics with `compact`, or a fallback with
|
|
1049
|
+
* `getOrElse`.
|
|
1050
|
+
*
|
|
1051
|
+
* ## Ownership and lifetime
|
|
1052
|
+
*
|
|
1053
|
+
* Construction requires Scope because it delegates to `make`, but the supplied Option needs no
|
|
1054
|
+
* services and cannot fail. The returned RefSubject owns and publishes subsequent Option writes.
|
|
1055
|
+
*
|
|
329
1056
|
* @example
|
|
330
1057
|
* ```ts
|
|
331
1058
|
* import { Effect, Option } from "effect"
|
|
@@ -339,13 +1066,42 @@ export declare function fromStream<A, E, R>(stream: Stream.Stream<A, E, R>, opti
|
|
|
339
1066
|
* ```
|
|
340
1067
|
*
|
|
341
1068
|
* @since 1.0.0
|
|
342
|
-
* @category
|
|
1069
|
+
* @category Source adapters
|
|
343
1070
|
*/
|
|
344
1071
|
export declare function fromOption<A>(option: Option.Option<A>, options?: RefSubjectOptions<Option.Option<A>>): Effect.Effect<RefSubject<Option.Option<A>>, never, Scope.Scope>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Creates Option-valued RefSubject state from a nullable input.
|
|
1074
|
+
*
|
|
1075
|
+
* @remarks
|
|
1076
|
+
* ## Why
|
|
1077
|
+
*
|
|
1078
|
+
* Converts `null` and `undefined` to `Option.none` and every other value to `Option.some`, then
|
|
1079
|
+
* stores that Option in a writable RefSubject. It does not create Filtered state or add
|
|
1080
|
+
* `NoSuchElementError`.
|
|
1081
|
+
*
|
|
1082
|
+
* ## Ownership and lifetime
|
|
1083
|
+
*
|
|
1084
|
+
* Construction requires Scope because it delegates to `make`; it needs no services and cannot
|
|
1085
|
+
* fail. The returned RefSubject owns and publishes subsequent Option writes.
|
|
1086
|
+
*
|
|
1087
|
+
* @since 1.18.0
|
|
1088
|
+
* @category Source adapters
|
|
1089
|
+
*/
|
|
345
1090
|
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
1091
|
/**
|
|
347
1092
|
* Sets the value of a `RefSubject`.
|
|
348
1093
|
*
|
|
1094
|
+
* @remarks
|
|
1095
|
+
* ## Why
|
|
1096
|
+
*
|
|
1097
|
+
* Sets the value of a `RefSubject`. The transition is serialized at the RefSubject rather than
|
|
1098
|
+
* coordinated by callers or UI components.
|
|
1099
|
+
*
|
|
1100
|
+
* ## Ownership and lifetime
|
|
1101
|
+
*
|
|
1102
|
+
* Running set performs one serialized subject transition and resolves with its committed value. It
|
|
1103
|
+
* acquires no resource; failures and services remain those of the source ref.
|
|
1104
|
+
*
|
|
349
1105
|
* @example
|
|
350
1106
|
* ```ts
|
|
351
1107
|
* import { Effect } from "effect"
|
|
@@ -367,7 +1123,7 @@ export declare function fromNullable<A>(value: A | null | undefined, options?: R
|
|
|
367
1123
|
* ```
|
|
368
1124
|
*
|
|
369
1125
|
* @since 1.0.0
|
|
370
|
-
* @category
|
|
1126
|
+
* @category State updates
|
|
371
1127
|
*/
|
|
372
1128
|
export declare const set: {
|
|
373
1129
|
<A>(value: A): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E, R>;
|
|
@@ -376,6 +1132,17 @@ export declare const set: {
|
|
|
376
1132
|
/**
|
|
377
1133
|
* Resets a `RefSubject` to its initial value, returning the previous value if it existed.
|
|
378
1134
|
*
|
|
1135
|
+
* @remarks
|
|
1136
|
+
* ## Why
|
|
1137
|
+
*
|
|
1138
|
+
* Resets a `RefSubject` to its initial value, returning the previous value if it existed. The
|
|
1139
|
+
* transition is serialized at the RefSubject rather than coordinated by callers or UI components.
|
|
1140
|
+
*
|
|
1141
|
+
* ## Ownership and lifetime
|
|
1142
|
+
*
|
|
1143
|
+
* Running reset performs one serialized subject transition and resolves with its committed value.
|
|
1144
|
+
* It acquires no resource; failures and services remain those of the source ref.
|
|
1145
|
+
*
|
|
379
1146
|
* @example
|
|
380
1147
|
* ```ts
|
|
381
1148
|
* import { Effect, Option } from "effect"
|
|
@@ -399,7 +1166,7 @@ export declare const set: {
|
|
|
399
1166
|
* ```
|
|
400
1167
|
*
|
|
401
1168
|
* @since 1.0.0
|
|
402
|
-
* @category
|
|
1169
|
+
* @category State updates
|
|
403
1170
|
*/
|
|
404
1171
|
export declare function reset<A, E, R>(ref: RefSubject<A, E, R>): Effect.Effect<Option.Option<A>, E, R>;
|
|
405
1172
|
export {
|
|
@@ -427,12 +1194,23 @@ export {
|
|
|
427
1194
|
* ```
|
|
428
1195
|
*
|
|
429
1196
|
* @since 1.20.0
|
|
430
|
-
* @category
|
|
1197
|
+
* @category State updates
|
|
431
1198
|
*/
|
|
432
1199
|
reset as delete, };
|
|
433
1200
|
/**
|
|
434
1201
|
* Updates a `RefSubject` using an `Effect`ful function.
|
|
435
1202
|
*
|
|
1203
|
+
* @remarks
|
|
1204
|
+
* ## Why
|
|
1205
|
+
*
|
|
1206
|
+
* Updates a `RefSubject` using an `Effect`ful function. The transition is serialized at the
|
|
1207
|
+
* RefSubject rather than coordinated by callers or UI components.
|
|
1208
|
+
*
|
|
1209
|
+
* ## Ownership and lifetime
|
|
1210
|
+
*
|
|
1211
|
+
* Running update effect performs one serialized subject transition and resolves with its committed
|
|
1212
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1213
|
+
*
|
|
436
1214
|
* @example
|
|
437
1215
|
* ```ts
|
|
438
1216
|
* import { Effect } from "effect"
|
|
@@ -452,7 +1230,7 @@ reset as delete, };
|
|
|
452
1230
|
* ```
|
|
453
1231
|
*
|
|
454
1232
|
* @since 1.0.0
|
|
455
|
-
* @category
|
|
1233
|
+
* @category State updates
|
|
456
1234
|
*/
|
|
457
1235
|
export declare const updateEffect: {
|
|
458
1236
|
<A, E2, R2>(f: (value: A) => Effect.Effect<A, E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E | E2, R | R2>;
|
|
@@ -461,6 +1239,26 @@ export declare const updateEffect: {
|
|
|
461
1239
|
/**
|
|
462
1240
|
* Updates a `RefSubject` using a pure function.
|
|
463
1241
|
*
|
|
1242
|
+
* @remarks
|
|
1243
|
+
* ## Why
|
|
1244
|
+
*
|
|
1245
|
+
* `update` expresses a state transition where the state lives, without moving
|
|
1246
|
+
* transition logic into a component or renderer. The same function can run in
|
|
1247
|
+
* application code, tests, workers, event handlers, or a Typed template.
|
|
1248
|
+
*
|
|
1249
|
+
* ## Ownership and lifetime
|
|
1250
|
+
*
|
|
1251
|
+
* The update runs inside the RefSubject's existing synchronized update
|
|
1252
|
+
* boundary: it reads the committed value, derives the next value, commits it,
|
|
1253
|
+
* and publishes that change. It acquires no independent resource and retains
|
|
1254
|
+
* the subject's existing error and service channels.
|
|
1255
|
+
*
|
|
1256
|
+
* ## Concurrency and failure
|
|
1257
|
+
*
|
|
1258
|
+
* Concurrent updates are serialized by the subject core so each function sees
|
|
1259
|
+
* a committed value. A pure updater adds no error channel; failures already
|
|
1260
|
+
* associated with reading or writing the RefSubject remain explicit in `E`.
|
|
1261
|
+
*
|
|
464
1262
|
* @example
|
|
465
1263
|
* ```ts
|
|
466
1264
|
* import { Effect } from "effect"
|
|
@@ -482,7 +1280,7 @@ export declare const updateEffect: {
|
|
|
482
1280
|
* ```
|
|
483
1281
|
*
|
|
484
1282
|
* @since 1.0.0
|
|
485
|
-
* @category
|
|
1283
|
+
* @category State updates
|
|
486
1284
|
*/
|
|
487
1285
|
export declare const update: {
|
|
488
1286
|
<A>(f: (value: A) => A): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<A, E, R>;
|
|
@@ -491,6 +1289,18 @@ export declare const update: {
|
|
|
491
1289
|
/**
|
|
492
1290
|
* Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new value.
|
|
493
1291
|
*
|
|
1292
|
+
* @remarks
|
|
1293
|
+
* ## Why
|
|
1294
|
+
*
|
|
1295
|
+
* Modifies a `RefSubject` using an `Effect`ful function that returns both a result and a new
|
|
1296
|
+
* value. The transition is serialized at the RefSubject rather than coordinated by callers or UI
|
|
1297
|
+
* components.
|
|
1298
|
+
*
|
|
1299
|
+
* ## Ownership and lifetime
|
|
1300
|
+
*
|
|
1301
|
+
* Running modify effect performs one serialized subject transition and resolves with its committed
|
|
1302
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1303
|
+
*
|
|
494
1304
|
* @example
|
|
495
1305
|
* ```ts
|
|
496
1306
|
* import { Effect } from "effect"
|
|
@@ -511,7 +1321,7 @@ export declare const update: {
|
|
|
511
1321
|
* ```
|
|
512
1322
|
*
|
|
513
1323
|
* @since 1.0.0
|
|
514
|
-
* @category
|
|
1324
|
+
* @category Transactions
|
|
515
1325
|
*/
|
|
516
1326
|
export declare const modifyEffect: {
|
|
517
1327
|
<A, B, E2, R2>(f: (value: A) => Effect.Effect<readonly [B, A], E2, R2>): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2, R | R2>;
|
|
@@ -520,6 +1330,17 @@ export declare const modifyEffect: {
|
|
|
520
1330
|
/**
|
|
521
1331
|
* Modifies a `RefSubject` using a pure function that returns both a result and a new value.
|
|
522
1332
|
*
|
|
1333
|
+
* @remarks
|
|
1334
|
+
* ## Why
|
|
1335
|
+
*
|
|
1336
|
+
* Modifies a `RefSubject` using a pure function that returns both a result and a new value. The
|
|
1337
|
+
* transition is serialized at the RefSubject rather than coordinated by callers or UI components.
|
|
1338
|
+
*
|
|
1339
|
+
* ## Ownership and lifetime
|
|
1340
|
+
*
|
|
1341
|
+
* Running modify performs one serialized subject transition and resolves with its committed value.
|
|
1342
|
+
* It acquires no resource; failures and services remain those of the source ref.
|
|
1343
|
+
*
|
|
523
1344
|
* @example
|
|
524
1345
|
* ```ts
|
|
525
1346
|
* import { Effect } from "effect"
|
|
@@ -538,7 +1359,7 @@ export declare const modifyEffect: {
|
|
|
538
1359
|
* ```
|
|
539
1360
|
*
|
|
540
1361
|
* @since 1.0.0
|
|
541
|
-
* @category
|
|
1362
|
+
* @category Transactions
|
|
542
1363
|
*/
|
|
543
1364
|
export declare const modify: {
|
|
544
1365
|
<A, B>(f: (value: A) => readonly [B, A]): <E, R>(ref: RefSubject<A, E, R>) => Effect.Effect<B, E, R>;
|
|
@@ -547,6 +1368,16 @@ export declare const modify: {
|
|
|
547
1368
|
/**
|
|
548
1369
|
* Checks if a value is a `RefSubject`.
|
|
549
1370
|
*
|
|
1371
|
+
* @remarks
|
|
1372
|
+
* ## Why
|
|
1373
|
+
*
|
|
1374
|
+
* Checks if a value is a `RefSubject`.
|
|
1375
|
+
*
|
|
1376
|
+
* ## Ownership and lifetime
|
|
1377
|
+
*
|
|
1378
|
+
* The derived ref owns no independent state or subscription. It follows the source lifetime and
|
|
1379
|
+
* routes writes through the source's synchronized update boundary.
|
|
1380
|
+
*
|
|
550
1381
|
* @example
|
|
551
1382
|
* ```ts
|
|
552
1383
|
* import { Effect } from "effect"
|
|
@@ -564,11 +1395,40 @@ export declare const modify: {
|
|
|
564
1395
|
* ```
|
|
565
1396
|
*
|
|
566
1397
|
* @since 1.0.0
|
|
567
|
-
* @category guards
|
|
1398
|
+
* @category Type guards
|
|
568
1399
|
*/
|
|
569
1400
|
export declare function isRefSubject(value: any): value is RefSubject<any, any, any>;
|
|
570
1401
|
/**
|
|
1402
|
+
* Tests whether a value carries the public Computed TypeId.
|
|
1403
|
+
*
|
|
1404
|
+
* @remarks
|
|
1405
|
+
* ## Why
|
|
1406
|
+
*
|
|
1407
|
+
* Uses the TypeId contract rather than a concrete implementation class, so custom Computed values
|
|
1408
|
+
* and service facades participate in the same runtime guard.
|
|
1409
|
+
*
|
|
1410
|
+
* ## Ownership and lifetime
|
|
1411
|
+
*
|
|
1412
|
+
* This synchronous predicate performs no Effect, subscription, or acquisition.
|
|
1413
|
+
*
|
|
1414
|
+
* @since 1.18.0
|
|
1415
|
+
* @category Type guards
|
|
1416
|
+
*/
|
|
1417
|
+
export declare function isComputed(value: any): value is Computed<any, any, any>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.
|
|
1420
|
+
*
|
|
1421
|
+
* @remarks
|
|
1422
|
+
* ## Why
|
|
1423
|
+
*
|
|
571
1424
|
* Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.
|
|
1425
|
+
* The transition is serialized at the RefSubject rather than coordinated by callers or UI
|
|
1426
|
+
* components.
|
|
1427
|
+
*
|
|
1428
|
+
* ## Ownership and lifetime
|
|
1429
|
+
*
|
|
1430
|
+
* Running run updates performs one serialized subject transition and resolves with its committed
|
|
1431
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
572
1432
|
*
|
|
573
1433
|
* @example
|
|
574
1434
|
* ```ts
|
|
@@ -599,7 +1459,7 @@ export declare function isRefSubject(value: any): value is RefSubject<any, any,
|
|
|
599
1459
|
* ```
|
|
600
1460
|
*
|
|
601
1461
|
* @since 1.0.0
|
|
602
|
-
* @category
|
|
1462
|
+
* @category Transactions
|
|
603
1463
|
*/
|
|
604
1464
|
export declare const runUpdates: {
|
|
605
1465
|
<A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {
|
|
@@ -609,11 +1469,22 @@ export declare const runUpdates: {
|
|
|
609
1469
|
<A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(ref: RefSubject<A, E, R>, f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {
|
|
610
1470
|
readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;
|
|
611
1471
|
readonly value?: "initial" | "current";
|
|
612
|
-
}
|
|
1472
|
+
}): Effect.Effect<B, E | E2 | E3, R | R2 | R3>;
|
|
613
1473
|
};
|
|
614
1474
|
/**
|
|
615
1475
|
* Increments a numeric `RefSubject` by 1.
|
|
616
1476
|
*
|
|
1477
|
+
* @remarks
|
|
1478
|
+
* ## Why
|
|
1479
|
+
*
|
|
1480
|
+
* Increments a numeric `RefSubject` by 1. The transition is serialized at the RefSubject rather
|
|
1481
|
+
* than coordinated by callers or UI components.
|
|
1482
|
+
*
|
|
1483
|
+
* ## Ownership and lifetime
|
|
1484
|
+
*
|
|
1485
|
+
* Running increment performs one serialized subject transition and resolves with its committed
|
|
1486
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1487
|
+
*
|
|
617
1488
|
* @example
|
|
618
1489
|
* ```ts
|
|
619
1490
|
* import { Effect } from "effect"
|
|
@@ -633,12 +1504,23 @@ export declare const runUpdates: {
|
|
|
633
1504
|
* ```
|
|
634
1505
|
*
|
|
635
1506
|
* @since 1.0.0
|
|
636
|
-
* @category
|
|
1507
|
+
* @category State updates
|
|
637
1508
|
*/
|
|
638
1509
|
export declare function increment<E, R>(ref: RefSubject<number, E, R>): Effect.Effect<number, E, R>;
|
|
639
1510
|
/**
|
|
640
1511
|
* Decrements a numeric `RefSubject` by 1.
|
|
641
1512
|
*
|
|
1513
|
+
* @remarks
|
|
1514
|
+
* ## Why
|
|
1515
|
+
*
|
|
1516
|
+
* Decrements a numeric `RefSubject` by 1. The transition is serialized at the RefSubject rather
|
|
1517
|
+
* than coordinated by callers or UI components.
|
|
1518
|
+
*
|
|
1519
|
+
* ## Ownership and lifetime
|
|
1520
|
+
*
|
|
1521
|
+
* Running decrement performs one serialized subject transition and resolves with its committed
|
|
1522
|
+
* value. It acquires no resource; failures and services remain those of the source ref.
|
|
1523
|
+
*
|
|
642
1524
|
* @example
|
|
643
1525
|
* ```ts
|
|
644
1526
|
* import { Effect } from "effect"
|
|
@@ -658,14 +1540,47 @@ export declare function increment<E, R>(ref: RefSubject<number, E, R>): Effect.E
|
|
|
658
1540
|
* ```
|
|
659
1541
|
*
|
|
660
1542
|
* @since 1.0.0
|
|
661
|
-
* @category
|
|
1543
|
+
* @category State updates
|
|
662
1544
|
*/
|
|
663
1545
|
export declare function decrement<E, R>(ref: RefSubject<number, E, R>): Effect.Effect<number, E, R>;
|
|
1546
|
+
/**
|
|
1547
|
+
* Creates a Context-backed RefSubject service facade and Layer constructors.
|
|
1548
|
+
*
|
|
1549
|
+
* @remarks
|
|
1550
|
+
* ## Why
|
|
1551
|
+
*
|
|
1552
|
+
* The returned class is simultaneously a service tag, a current-value Effect, an Fx source, and a
|
|
1553
|
+
* writable RefSubject facade. This lets consumers read, observe, and update renderer-independent
|
|
1554
|
+
* state without manually retrieving the underlying service from Context.
|
|
1555
|
+
*
|
|
1556
|
+
* ## Ownership and lifetime
|
|
1557
|
+
*
|
|
1558
|
+
* Calling `Service` is pure. `layer` installs an existing scoped RefSubject; `make` constructs one
|
|
1559
|
+
* and installs it in a Layer. The Layer Scope owns the subject and its initializer subscription.
|
|
1560
|
+
* Reads and pushes expose the declared `E` channel; construction requirements remain on the Layer,
|
|
1561
|
+
* while consumers require only the generated `Self` service.
|
|
1562
|
+
*
|
|
1563
|
+
* @since 1.18.0
|
|
1564
|
+
* @category Services
|
|
1565
|
+
*/
|
|
664
1566
|
export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => RefSubject.Class<Self, Id, A, E>;
|
|
665
1567
|
/**
|
|
666
1568
|
* Extract all values from an object using a Proxy.
|
|
667
1569
|
* Allows accessing nested properties of a `Computed` or `Filtered` object/array as individual computed values.
|
|
668
1570
|
*
|
|
1571
|
+
* @remarks
|
|
1572
|
+
* ## Why
|
|
1573
|
+
*
|
|
1574
|
+
* Lazily creates one property projection per accessed key and memoizes that projection on the
|
|
1575
|
+
* JavaScript Proxy. A Computed or RefSubject source produces Computed properties; only a Filtered
|
|
1576
|
+
* source produces Filtered properties and preserves conditional absence.
|
|
1577
|
+
*
|
|
1578
|
+
* ## Ownership and lifetime
|
|
1579
|
+
*
|
|
1580
|
+
* The Proxy caches derived view objects, not property values. Computed property reads expose only
|
|
1581
|
+
* the source's `E`; Filtered property reads can additionally fail with `NoSuchElementError` while
|
|
1582
|
+
* their source is absent. Each observed property follows the source and uses the observing Scope.
|
|
1583
|
+
*
|
|
669
1584
|
* @example
|
|
670
1585
|
* ```ts
|
|
671
1586
|
* import { Effect } from "effect"
|
|
@@ -694,7 +1609,7 @@ export declare function Service<Self, A, E = never>(): <const Id extends string>
|
|
|
694
1609
|
* ```
|
|
695
1610
|
*
|
|
696
1611
|
* @since 2.0.0
|
|
697
|
-
* @category
|
|
1612
|
+
* @category Derived queries
|
|
698
1613
|
*/
|
|
699
1614
|
export declare const proxy: {
|
|
700
1615
|
<A extends ReadonlyArray<any> | Readonly<Record<PropertyKey, any>>, E, R>(source: Computed<A, E, R>): {
|
|
@@ -704,13 +1619,91 @@ export declare const proxy: {
|
|
|
704
1619
|
readonly [K in keyof A]: Filtered<A[K], E, R>;
|
|
705
1620
|
};
|
|
706
1621
|
};
|
|
1622
|
+
/**
|
|
1623
|
+
* Describes the services type.
|
|
1624
|
+
*
|
|
1625
|
+
* @remarks
|
|
1626
|
+
* ## Why
|
|
1627
|
+
*
|
|
1628
|
+
* Extracts the service requirement channel from a RefSubject, Computed, or Filtered value.
|
|
1629
|
+
*
|
|
1630
|
+
* ## Ownership and lifetime
|
|
1631
|
+
*
|
|
1632
|
+
* Services is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
1633
|
+
* interruption, and Scope requirements expressed by its members.
|
|
1634
|
+
*
|
|
1635
|
+
* @since 1.18.0
|
|
1636
|
+
* @category Type utilities
|
|
1637
|
+
*/
|
|
707
1638
|
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;
|
|
1639
|
+
/**
|
|
1640
|
+
* Describes the error type.
|
|
1641
|
+
*
|
|
1642
|
+
* @remarks
|
|
1643
|
+
* ## Why
|
|
1644
|
+
*
|
|
1645
|
+
* Extracts the declared state error channel from a RefSubject, Computed, or Filtered value.
|
|
1646
|
+
*
|
|
1647
|
+
* ## Ownership and lifetime
|
|
1648
|
+
*
|
|
1649
|
+
* Error is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
1650
|
+
* interruption, and Scope requirements expressed by its members.
|
|
1651
|
+
*
|
|
1652
|
+
* @since 1.18.0
|
|
1653
|
+
* @category Type utilities
|
|
1654
|
+
*/
|
|
708
1655
|
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;
|
|
1656
|
+
/**
|
|
1657
|
+
* Describes the success type.
|
|
1658
|
+
*
|
|
1659
|
+
* @remarks
|
|
1660
|
+
* ## Why
|
|
1661
|
+
*
|
|
1662
|
+
* Extracts the current/read value type from a RefSubject, Computed, or Filtered value.
|
|
1663
|
+
*
|
|
1664
|
+
* ## Ownership and lifetime
|
|
1665
|
+
*
|
|
1666
|
+
* Success is a contract and performs no acquisition. Implementations retain the errors, services,
|
|
1667
|
+
* interruption, and Scope requirements expressed by its members.
|
|
1668
|
+
*
|
|
1669
|
+
* @since 1.18.0
|
|
1670
|
+
* @category Type utilities
|
|
1671
|
+
*/
|
|
709
1672
|
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;
|
|
1673
|
+
/**
|
|
1674
|
+
* Describes the identifier type.
|
|
1675
|
+
*
|
|
1676
|
+
* @remarks
|
|
1677
|
+
* ## Why
|
|
1678
|
+
*
|
|
1679
|
+
* Extracts the Context service identifier type represented by a RefSubject service facade.
|
|
1680
|
+
*
|
|
1681
|
+
* ## Ownership and lifetime
|
|
1682
|
+
*
|
|
1683
|
+
* Identifier is a contract and performs no acquisition. Implementations retain the errors,
|
|
1684
|
+
* services, interruption, and Scope requirements expressed by its members.
|
|
1685
|
+
*
|
|
1686
|
+
* @since 1.18.0
|
|
1687
|
+
* @category Type utilities
|
|
1688
|
+
*/
|
|
710
1689
|
export type Identifier<T> = T extends RefSubject.Service<infer R, infer _Id, infer _A, infer _E> ? R : never;
|
|
711
1690
|
/**
|
|
712
1691
|
* Transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function.
|
|
713
1692
|
*
|
|
1693
|
+
* @remarks
|
|
1694
|
+
* ## Why
|
|
1695
|
+
*
|
|
1696
|
+
* Applies one Effectful derivation to current reads and pushed versions. RefSubject and Computed
|
|
1697
|
+
* inputs return Computed and add only `E2`; a Filtered input returns Filtered and preserves its
|
|
1698
|
+
* conditional absence in addition to `E2`.
|
|
1699
|
+
*
|
|
1700
|
+
* ## Ownership and lifetime
|
|
1701
|
+
*
|
|
1702
|
+
* No callback runs until the result is read or observed. Computed results cannot become absent and
|
|
1703
|
+
* do not add `NoSuchElementError`; only the Filtered overload can fail a current read for absence.
|
|
1704
|
+
* Callback services and failures remain `R2` and `E2`, and the observing Scope owns subscription
|
|
1705
|
+
* cleanup.
|
|
1706
|
+
*
|
|
714
1707
|
* @example
|
|
715
1708
|
* ```ts
|
|
716
1709
|
* import { Effect } from "effect"
|
|
@@ -737,7 +1730,7 @@ export type Identifier<T> = T extends RefSubject.Service<infer R, infer _Id, inf
|
|
|
737
1730
|
* ```
|
|
738
1731
|
*
|
|
739
1732
|
* @since 1.0.0
|
|
740
|
-
* @category
|
|
1733
|
+
* @category Derived queries
|
|
741
1734
|
*/
|
|
742
1735
|
export declare const mapEffect: {
|
|
743
1736
|
<T extends RefSubject.Any | Computed.Any | Filtered.Any, B, E2, R2>(f: (a: Success<T>) => Effect.Effect<B, E2, R2>): (ref: T) => T extends Filtered.Any ? Filtered<B, Error<T> | E2, Services<T> | R2> : Computed<B, Error<T> | E2, Services<T> | R2>;
|
|
@@ -748,6 +1741,25 @@ export declare const mapEffect: {
|
|
|
748
1741
|
/**
|
|
749
1742
|
* Transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function.
|
|
750
1743
|
*
|
|
1744
|
+
* @remarks
|
|
1745
|
+
* ## Why
|
|
1746
|
+
*
|
|
1747
|
+
* `map` creates derived state instead of copying source state into a component.
|
|
1748
|
+
* Reads and pushed updates remain connected to the original `Versioned` value,
|
|
1749
|
+
* so a projection can be tested without rendering and consumed by any renderer.
|
|
1750
|
+
*
|
|
1751
|
+
* ## Ownership and lifetime
|
|
1752
|
+
*
|
|
1753
|
+
* The returned `Computed` or `Filtered` view does not take ownership of the
|
|
1754
|
+
* source. It follows the source lifetime and preserves its error and service
|
|
1755
|
+
* channels. The pure mapping function adds neither resources nor failures.
|
|
1756
|
+
*
|
|
1757
|
+
* ## Re-computation
|
|
1758
|
+
*
|
|
1759
|
+
* The mapping function runs for the current value and subsequent committed
|
|
1760
|
+
* source versions. Updates still occur on the writable source; the derived view
|
|
1761
|
+
* is read-only unless a more specific bidirectional combinator is used.
|
|
1762
|
+
*
|
|
751
1763
|
* @example
|
|
752
1764
|
* ```ts
|
|
753
1765
|
* import { Effect } from "effect"
|
|
@@ -772,7 +1784,7 @@ export declare const mapEffect: {
|
|
|
772
1784
|
* ```
|
|
773
1785
|
*
|
|
774
1786
|
* @since 1.0.0
|
|
775
|
-
* @category
|
|
1787
|
+
* @category Derived queries
|
|
776
1788
|
*/
|
|
777
1789
|
export declare const map: {
|
|
778
1790
|
<T extends RefSubject.Any | Computed.Any | Filtered.Any, B>(f: (a: Success<T>) => B): (ref: T) => T extends Filtered.Any ? Filtered<B, Error<T>, Services<T>> : Computed<B, Error<T>, Services<T>>;
|
|
@@ -783,6 +1795,18 @@ export declare const map: {
|
|
|
783
1795
|
/**
|
|
784
1796
|
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function that returns an `Option`.
|
|
785
1797
|
*
|
|
1798
|
+
* @remarks
|
|
1799
|
+
* ## Why
|
|
1800
|
+
*
|
|
1801
|
+
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using an `Effect`ful function
|
|
1802
|
+
* that returns an `Option`. Current reads and pushed versions use the same derivation, preventing
|
|
1803
|
+
* snapshot and subscription behavior from diverging.
|
|
1804
|
+
*
|
|
1805
|
+
* ## Ownership and lifetime
|
|
1806
|
+
*
|
|
1807
|
+
* The filter map effect view retains no independent value. Its Effect read fails with NoSuchElement
|
|
1808
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
1809
|
+
*
|
|
786
1810
|
* @example
|
|
787
1811
|
* ```ts
|
|
788
1812
|
* import { Effect, Option } from "effect"
|
|
@@ -802,7 +1826,7 @@ export declare const map: {
|
|
|
802
1826
|
* ```
|
|
803
1827
|
*
|
|
804
1828
|
* @since 1.0.0
|
|
805
|
-
* @category
|
|
1829
|
+
* @category Optional queries
|
|
806
1830
|
*/
|
|
807
1831
|
export declare const filterMapEffect: {
|
|
808
1832
|
<A, B, E2, R2>(f: (a: A) => Effect.Effect<Option.Option<B>, E2, R2>): {
|
|
@@ -816,6 +1840,18 @@ export declare const filterMapEffect: {
|
|
|
816
1840
|
/**
|
|
817
1841
|
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function that returns an `Option`.
|
|
818
1842
|
*
|
|
1843
|
+
* @remarks
|
|
1844
|
+
* ## Why
|
|
1845
|
+
*
|
|
1846
|
+
* Filters and transforms a `RefSubject`, `Computed`, or `Filtered` using a pure function that
|
|
1847
|
+
* returns an `Option`. Current reads and pushed versions use the same derivation, preventing
|
|
1848
|
+
* snapshot and subscription behavior from diverging.
|
|
1849
|
+
*
|
|
1850
|
+
* ## Ownership and lifetime
|
|
1851
|
+
*
|
|
1852
|
+
* The filter map view retains no independent value. Its Effect read fails with NoSuchElement
|
|
1853
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
1854
|
+
*
|
|
819
1855
|
* @example
|
|
820
1856
|
* ```ts
|
|
821
1857
|
* import { Effect, Option } from "effect"
|
|
@@ -835,7 +1871,7 @@ export declare const filterMapEffect: {
|
|
|
835
1871
|
* ```
|
|
836
1872
|
*
|
|
837
1873
|
* @since 1.0.0
|
|
838
|
-
* @category
|
|
1874
|
+
* @category Optional queries
|
|
839
1875
|
*/
|
|
840
1876
|
export declare const filterMap: {
|
|
841
1877
|
<A, B>(f: (a: A) => Option.Option<B>): {
|
|
@@ -848,6 +1884,18 @@ export declare const filterMap: {
|
|
|
848
1884
|
/**
|
|
849
1885
|
* Converts a `Computed` or `Filtered` of `Option<A>` into a `Filtered<A>`, filtering out `None` values.
|
|
850
1886
|
*
|
|
1887
|
+
* @remarks
|
|
1888
|
+
* ## Why
|
|
1889
|
+
*
|
|
1890
|
+
* Converts a `Computed` or `Filtered` of `Option<A>` into a `Filtered<A>`, filtering out `None`
|
|
1891
|
+
* values. Current reads and pushed versions use the same derivation, preventing snapshot and
|
|
1892
|
+
* subscription behavior from diverging.
|
|
1893
|
+
*
|
|
1894
|
+
* ## Ownership and lifetime
|
|
1895
|
+
*
|
|
1896
|
+
* The compact view retains no independent value. Its Effect read fails with NoSuchElement
|
|
1897
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
1898
|
+
*
|
|
851
1899
|
* @example
|
|
852
1900
|
* ```ts
|
|
853
1901
|
* import { Effect, Option } from "effect"
|
|
@@ -869,17 +1917,31 @@ export declare const filterMap: {
|
|
|
869
1917
|
* ```
|
|
870
1918
|
*
|
|
871
1919
|
* @since 1.0.0
|
|
872
|
-
* @category
|
|
1920
|
+
* @category Optional queries
|
|
873
1921
|
*/
|
|
874
1922
|
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>;
|
|
1923
|
+
<A, E, R>(ref: Computed<Option.Option<A>, E, R>): Filtered<A, E, R>;
|
|
1924
|
+
<A, E, R>(ref: Filtered<Option.Option<A>, E, R>): Filtered<A, E, R>;
|
|
877
1925
|
<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
1926
|
};
|
|
879
1927
|
/**
|
|
880
1928
|
* Returns a `Computed` that yields the value inside the `Option`, or the fallback when `None`.
|
|
881
1929
|
* Works with `Computed<Option<A>>` (e.g. from `fromOption` / `fromNullable`) and with `Filtered<A>`.
|
|
882
1930
|
*
|
|
1931
|
+
* @remarks
|
|
1932
|
+
* ## Why
|
|
1933
|
+
*
|
|
1934
|
+
* Returns a `Computed` that yields the value inside the `Option`, or the fallback when `None`.
|
|
1935
|
+
* Works with `Computed<Option<A>>` (e.g. from `fromOption` / `fromNullable`) and with
|
|
1936
|
+
* `Filtered<A>`. Current reads and pushed versions use the same derivation, preventing snapshot
|
|
1937
|
+
* and subscription behavior from diverging.
|
|
1938
|
+
*
|
|
1939
|
+
* ## Ownership and lifetime
|
|
1940
|
+
*
|
|
1941
|
+
* The returned Computed never fails for absence: `None` or an absent Filtered value invokes
|
|
1942
|
+
* `fallback`. It preserves only the input's declared `E` and `R`; the pure fallback adds no failure,
|
|
1943
|
+
* service, subscription, or retained value.
|
|
1944
|
+
*
|
|
883
1945
|
* @example
|
|
884
1946
|
* ```ts
|
|
885
1947
|
* import { Effect, Option } from "effect"
|
|
@@ -897,12 +1959,31 @@ export declare const compact: {
|
|
|
897
1959
|
* ```
|
|
898
1960
|
*
|
|
899
1961
|
* @since 1.0.0
|
|
900
|
-
* @category
|
|
1962
|
+
* @category Optional queries
|
|
901
1963
|
*/
|
|
902
1964
|
export declare const getOrElse: {
|
|
903
1965
|
<A>(fallback: () => A): <E, R>(ref: Computed<Option.Option<A>, E, R> | Filtered<A, E, R>) => Computed<A, E, R>;
|
|
904
1966
|
<A, E, R>(ref: Computed<Option.Option<A>, E, R> | Filtered<A, E, R>, fallback: () => A): Computed<A, E, R>;
|
|
905
1967
|
};
|
|
1968
|
+
/**
|
|
1969
|
+
* Limits which pushed versions a RefSubject view observes without changing its state.
|
|
1970
|
+
*
|
|
1971
|
+
* @remarks
|
|
1972
|
+
* ## Why
|
|
1973
|
+
*
|
|
1974
|
+
* Applies `skip` and `take` only to the Fx observation channel. Current reads still sample the
|
|
1975
|
+
* underlying RefSubject directly, and writes still use its original serialized update boundary.
|
|
1976
|
+
*
|
|
1977
|
+
* ## Ownership and lifetime
|
|
1978
|
+
*
|
|
1979
|
+
* Creating the view starts nothing and retains no value. Each observation uses its Scope and ends
|
|
1980
|
+
* after `take` selected pushes; ending that observation does not interrupt or delete the source.
|
|
1981
|
+
* Version, interruption, subscriber count, reads, failures, services, and writes delegate to the
|
|
1982
|
+
* source RefSubject.
|
|
1983
|
+
*
|
|
1984
|
+
* @since 1.18.0
|
|
1985
|
+
* @category Observation policy
|
|
1986
|
+
*/
|
|
906
1987
|
export declare const slice: {
|
|
907
1988
|
(skip: number, take: number): <A, E, R>(ref: RefSubject<A, E, R>) => RefSubject<A, E, R>;
|
|
908
1989
|
<A, E, R>(ref: RefSubject<A, E, R>, skip: number, take: number): RefSubject<A, E, R>;
|
|
@@ -910,6 +1991,17 @@ export declare const slice: {
|
|
|
910
1991
|
/**
|
|
911
1992
|
* Transforms a `RefSubject` invariantly using bidirectional mapping functions.
|
|
912
1993
|
*
|
|
1994
|
+
* @remarks
|
|
1995
|
+
* ## Why
|
|
1996
|
+
*
|
|
1997
|
+
* Creates a bidirectional lens over state: reads map outward and writes map back to the original
|
|
1998
|
+
* RefSubject without allocating a second store.
|
|
1999
|
+
*
|
|
2000
|
+
* ## Ownership and lifetime
|
|
2001
|
+
*
|
|
2002
|
+
* The derived ref owns no independent state or subscription. It follows the source lifetime and
|
|
2003
|
+
* routes writes through the source's synchronized update boundary.
|
|
2004
|
+
*
|
|
913
2005
|
* @example
|
|
914
2006
|
* ```ts
|
|
915
2007
|
* import { Effect } from "effect"
|
|
@@ -938,14 +2030,16 @@ export declare const slice: {
|
|
|
938
2030
|
* ```
|
|
939
2031
|
*
|
|
940
2032
|
* @since 1.0.0
|
|
941
|
-
* @category
|
|
2033
|
+
* @category Writable views
|
|
942
2034
|
*/
|
|
943
2035
|
export declare const transform: {
|
|
944
2036
|
<A, B>(toB: (a: A) => B, toA: (b: B) => A): <E, R>(ref: RefSubject<A, E, R>) => RefSubject<B, E, R>;
|
|
945
2037
|
<A, E, R, B>(ref: RefSubject<A, E, R>, toB: (a: A) => B, toA: (b: B) => A): RefSubject<B, E, R>;
|
|
946
2038
|
};
|
|
947
2039
|
type RefKind = "r" | "c" | "f";
|
|
948
|
-
type StructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = {
|
|
2040
|
+
type StructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = [keyof Refs] extends [never] ? RefSubject<{
|
|
2041
|
+
readonly [K in keyof Refs]: never;
|
|
2042
|
+
}, never, never> : {
|
|
949
2043
|
c: [ComputedStructFrom<Refs>] extends [Computed<infer A, infer E, infer R>] ? Computed<A, E, R> : never;
|
|
950
2044
|
f: [FilteredStructFrom<Refs>] extends [Filtered<infer A, infer E, infer R>] ? Filtered<A, E, R> : never;
|
|
951
2045
|
r: [RefSubjectStructFrom<Refs>] extends [RefSubject<infer A, infer E, infer R>] ? RefSubject<A, E, R> : never;
|
|
@@ -969,7 +2063,7 @@ type ComputedStructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Co
|
|
|
969
2063
|
type RefSubjectStructFrom<Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>> = RefSubject<{
|
|
970
2064
|
readonly [K in keyof Refs]: Effect.Success<Refs[K]>;
|
|
971
2065
|
}, 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>>> = {
|
|
2066
|
+
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
2067
|
c: [ComputedTupleFrom<Refs>] extends [Computed<infer A, infer E, infer R>] ? Computed<A, E, R> : never;
|
|
974
2068
|
f: [FilteredTupleFrom<Refs>] extends [Filtered<infer A, infer E, infer R>] ? Filtered<A, E, R> : never;
|
|
975
2069
|
r: [RefSubjectTupleFrom<Refs>] extends [RefSubject<infer A, infer E, infer R>] ? RefSubject<A, E, R> : never;
|
|
@@ -987,6 +2081,17 @@ type RefSubjectTupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> |
|
|
|
987
2081
|
/**
|
|
988
2082
|
* Combines multiple `RefSubject`, `Computed`, or `Filtered` instances into a single struct.
|
|
989
2083
|
*
|
|
2084
|
+
* @remarks
|
|
2085
|
+
* ## Why
|
|
2086
|
+
*
|
|
2087
|
+
* Combines several refs into one state value while preserving whether the result is writable,
|
|
2088
|
+
* computed, or filtered from its inputs.
|
|
2089
|
+
*
|
|
2090
|
+
* ## Ownership and lifetime
|
|
2091
|
+
*
|
|
2092
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
2093
|
+
* source errors, services, and lifetime.
|
|
2094
|
+
*
|
|
990
2095
|
* @example
|
|
991
2096
|
* ```ts
|
|
992
2097
|
* import { Effect } from "effect"
|
|
@@ -1017,12 +2122,23 @@ type RefSubjectTupleFrom<Refs extends ReadonlyArray<RefSubject<any, any, any> |
|
|
|
1017
2122
|
* ```
|
|
1018
2123
|
*
|
|
1019
2124
|
* @since 1.0.0
|
|
1020
|
-
* @category
|
|
2125
|
+
* @category State composition
|
|
1021
2126
|
*/
|
|
1022
2127
|
export declare function struct<const Refs extends Readonly<Record<string, RefSubject.Any | Computed.Any | Filtered.Any>>>(refs: Refs): StructFrom<Refs>;
|
|
1023
2128
|
/**
|
|
1024
2129
|
* Combines multiple `RefSubject`, `Computed`, or `Filtered` instances into a single tuple.
|
|
1025
2130
|
*
|
|
2131
|
+
* @remarks
|
|
2132
|
+
* ## Why
|
|
2133
|
+
*
|
|
2134
|
+
* Combines several refs into one state value while preserving whether the result is writable,
|
|
2135
|
+
* computed, or filtered from its inputs.
|
|
2136
|
+
*
|
|
2137
|
+
* ## Ownership and lifetime
|
|
2138
|
+
*
|
|
2139
|
+
* This declaration performs no acquisition and retains no resources. Implementations preserve
|
|
2140
|
+
* source errors, services, and lifetime.
|
|
2141
|
+
*
|
|
1026
2142
|
* @example
|
|
1027
2143
|
* ```ts
|
|
1028
2144
|
* import { Effect } from "effect"
|
|
@@ -1049,9 +2165,45 @@ export declare function struct<const Refs extends Readonly<Record<string, RefSub
|
|
|
1049
2165
|
* ```
|
|
1050
2166
|
*
|
|
1051
2167
|
* @since 1.0.0
|
|
1052
|
-
* @category
|
|
2168
|
+
* @category State composition
|
|
1053
2169
|
*/
|
|
1054
2170
|
export declare function tuple<const Refs extends ReadonlyArray<Ref>>(refs: Refs): TupleFrom<Refs>;
|
|
2171
|
+
/**
|
|
2172
|
+
* Lifts an Effect-provided Computed into a Computed facade.
|
|
2173
|
+
*
|
|
2174
|
+
* @remarks
|
|
2175
|
+
* ## Why
|
|
2176
|
+
*
|
|
2177
|
+
* Defers service lookup until each version read, current read, interruption, or Fx observation, so
|
|
2178
|
+
* callers can compose a Context-provided Computed without manually flat-mapping the service Effect.
|
|
2179
|
+
*
|
|
2180
|
+
* ## Ownership and lifetime
|
|
2181
|
+
*
|
|
2182
|
+
* The facade caches neither the resolved Computed nor its value. Each operation runs the supplied
|
|
2183
|
+
* Effect, then delegates to the resolved Computed. Service requirements combine as `R | R2`, source
|
|
2184
|
+
* failures remain `E`, and the observing Scope owns the delegated subscription.
|
|
2185
|
+
*
|
|
2186
|
+
* @since 1.18.0
|
|
2187
|
+
* @category Services
|
|
2188
|
+
*/
|
|
1055
2189
|
export declare function computedFromService<R, A, E, R2>(effect: Effect.Effect<Computed<A, E, R2>, never, R>): Computed<A, E, R | R2>;
|
|
2190
|
+
/**
|
|
2191
|
+
* Defers retrieval of a Filtered value from Effect Context while preserving Filtered behavior.
|
|
2192
|
+
*
|
|
2193
|
+
* @remarks
|
|
2194
|
+
* ## Why
|
|
2195
|
+
*
|
|
2196
|
+
* Lets a service-provided Filtered participate directly in Effect reads and Fx observation without
|
|
2197
|
+
* manually flat-mapping the service tag at every use.
|
|
2198
|
+
*
|
|
2199
|
+
* ## Ownership and lifetime
|
|
2200
|
+
*
|
|
2201
|
+
* The filtered from service view retains no independent value. Its Effect read fails with NoSuchElement
|
|
2202
|
+
* while absent; the observing Scope owns and finalizes its Fx subscription.
|
|
2203
|
+
*
|
|
2204
|
+
* @since 1.18.0
|
|
2205
|
+
* @category Services
|
|
2206
|
+
*/
|
|
1056
2207
|
export declare function filteredFromService<R, A, E, R2>(effect: Effect.Effect<Filtered<A, E, R2>, never, R>): Filtered<A, E, R | R2>;
|
|
2208
|
+
export * from "./Hydration.js";
|
|
1057
2209
|
//# sourceMappingURL=RefSubject.d.ts.map
|