@typed/fx 1.12.5 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RefSubject.d.ts +2 -1
- package/dist/RefSubject.d.ts.map +1 -1
- package/dist/RefSubject.js +4 -1
- package/dist/RefSubject.js.map +1 -1
- package/dist/Subject.d.ts +1 -1
- package/dist/Subject.d.ts.map +1 -1
- package/dist/Subject.js +2 -1
- package/dist/Subject.js.map +1 -1
- package/dist/at.d.ts +1 -1
- package/dist/at.d.ts.map +1 -1
- package/dist/at.js +1 -1
- package/dist/at.js.map +1 -1
- package/dist/catchAllCause.d.ts +2 -1
- package/dist/catchAllCause.d.ts.map +1 -1
- package/dist/catchAllCause.js +2 -1
- package/dist/catchAllCause.js.map +1 -1
- package/dist/cjs/RefSubject.d.ts +2 -1
- package/dist/cjs/RefSubject.d.ts.map +1 -1
- package/dist/cjs/RefSubject.js +72 -69
- package/dist/cjs/RefSubject.js.map +1 -1
- package/dist/cjs/Subject.d.ts +1 -1
- package/dist/cjs/Subject.d.ts.map +1 -1
- package/dist/cjs/Subject.js +27 -3
- package/dist/cjs/Subject.js.map +1 -1
- package/dist/cjs/at.d.ts +1 -1
- package/dist/cjs/at.d.ts.map +1 -1
- package/dist/cjs/at.js +25 -2
- package/dist/cjs/at.js.map +1 -1
- package/dist/cjs/catchAllCause.d.ts +2 -1
- package/dist/cjs/catchAllCause.d.ts.map +1 -1
- package/dist/cjs/catchAllCause.js +26 -2
- package/dist/cjs/catchAllCause.js.map +1 -1
- package/dist/cjs/combineAll.d.ts.map +1 -1
- package/dist/cjs/combineAll.js +28 -5
- package/dist/cjs/combineAll.js.map +1 -1
- package/dist/cjs/combineAllDiscard.d.ts.map +1 -1
- package/dist/cjs/combineAllDiscard.js +27 -4
- package/dist/cjs/combineAllDiscard.js.map +1 -1
- package/dist/cjs/continueWith.d.ts +1 -1
- package/dist/cjs/continueWith.d.ts.map +1 -1
- package/dist/cjs/continueWith.js +25 -2
- package/dist/cjs/continueWith.js.map +1 -1
- package/dist/cjs/debounce.d.ts +1 -1
- package/dist/cjs/debounce.d.ts.map +1 -1
- package/dist/cjs/debounce.js +25 -2
- package/dist/cjs/debounce.js.map +1 -1
- package/dist/cjs/delay.d.ts.map +1 -1
- package/dist/cjs/delay.js +25 -2
- package/dist/cjs/delay.js.map +1 -1
- package/dist/cjs/exhaustMap.d.ts +1 -1
- package/dist/cjs/exhaustMap.d.ts.map +1 -1
- package/dist/cjs/exhaustMap.js.map +1 -1
- package/dist/cjs/exhaustMapCause.d.ts +2 -1
- package/dist/cjs/exhaustMapCause.d.ts.map +1 -1
- package/dist/cjs/exhaustMapCause.js +26 -2
- package/dist/cjs/exhaustMapCause.js.map +1 -1
- package/dist/cjs/exhaustMapLatest.d.ts +1 -1
- package/dist/cjs/exhaustMapLatest.d.ts.map +1 -1
- package/dist/cjs/exhaustMapLatest.js.map +1 -1
- package/dist/cjs/exhaustMapLatestCause.d.ts +2 -1
- package/dist/cjs/exhaustMapLatestCause.d.ts.map +1 -1
- package/dist/cjs/exhaustMapLatestCause.js +26 -2
- package/dist/cjs/exhaustMapLatestCause.js.map +1 -1
- package/dist/cjs/filter.d.ts.map +1 -1
- package/dist/cjs/filter.js +25 -2
- package/dist/cjs/filter.js.map +1 -1
- package/dist/cjs/filterMap.d.ts +1 -1
- package/dist/cjs/filterMap.d.ts.map +1 -1
- package/dist/cjs/filterMap.js +26 -2
- package/dist/cjs/filterMap.js.map +1 -1
- package/dist/cjs/flatMap.d.ts +1 -1
- package/dist/cjs/flatMap.d.ts.map +1 -1
- package/dist/cjs/flatMap.js.map +1 -1
- package/dist/cjs/fromArray.d.ts.map +1 -1
- package/dist/cjs/fromArray.js +27 -4
- package/dist/cjs/fromArray.js.map +1 -1
- package/dist/cjs/fromEffect.d.ts +1 -1
- package/dist/cjs/fromEffect.d.ts.map +1 -1
- package/dist/cjs/fromEffect.js +25 -2
- package/dist/cjs/fromEffect.js.map +1 -1
- package/dist/cjs/fromEmitter.d.ts +2 -2
- package/dist/cjs/fromEmitter.d.ts.map +1 -1
- package/dist/cjs/fromEmitter.js +34 -9
- package/dist/cjs/fromEmitter.js.map +1 -1
- package/dist/cjs/fromFxEffect.d.ts +1 -1
- package/dist/cjs/fromFxEffect.d.ts.map +1 -1
- package/dist/cjs/fromFxEffect.js +25 -2
- package/dist/cjs/fromFxEffect.js.map +1 -1
- package/dist/cjs/fromIterable.d.ts.map +1 -1
- package/dist/cjs/fromIterable.js +27 -4
- package/dist/cjs/fromIterable.js.map +1 -1
- package/dist/cjs/gen.d.ts +1 -1
- package/dist/cjs/gen.d.ts.map +1 -1
- package/dist/cjs/gen.js +25 -2
- package/dist/cjs/gen.js.map +1 -1
- package/dist/cjs/helpers.d.ts +2 -1
- package/dist/cjs/helpers.d.ts.map +1 -1
- package/dist/cjs/helpers.js +64 -36
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/hold.d.ts +3 -1
- package/dist/cjs/hold.d.ts.map +1 -1
- package/dist/cjs/hold.js +32 -7
- package/dist/cjs/hold.js.map +1 -1
- package/dist/cjs/index.d.ts +7 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/keyed.d.ts.map +1 -1
- package/dist/cjs/keyed.js +43 -28
- package/dist/cjs/keyed.js.map +1 -1
- package/dist/cjs/map.d.ts.map +1 -1
- package/dist/cjs/map.js +25 -2
- package/dist/cjs/map.js.map +1 -1
- package/dist/cjs/mergeAll.d.ts.map +1 -1
- package/dist/cjs/mergeAll.js +28 -3
- package/dist/cjs/mergeAll.js.map +1 -1
- package/dist/cjs/multicast.d.ts +5 -3
- package/dist/cjs/multicast.d.ts.map +1 -1
- package/dist/cjs/multicast.js +39 -15
- package/dist/cjs/multicast.js.map +1 -1
- package/dist/cjs/never.d.ts.map +1 -1
- package/dist/cjs/never.js +25 -2
- package/dist/cjs/never.js.map +1 -1
- package/dist/cjs/observe.d.ts +1 -1
- package/dist/cjs/observe.d.ts.map +1 -1
- package/dist/cjs/observe.js +34 -9
- package/dist/cjs/observe.js.map +1 -1
- package/dist/cjs/onInterrupt.d.ts +1 -1
- package/dist/cjs/onInterrupt.d.ts.map +1 -1
- package/dist/cjs/onInterrupt.js +25 -2
- package/dist/cjs/onInterrupt.js.map +1 -1
- package/dist/cjs/promise.d.ts.map +1 -1
- package/dist/cjs/promise.js +36 -13
- package/dist/cjs/promise.js.map +1 -1
- package/dist/cjs/provide.d.ts +3 -2
- package/dist/cjs/provide.d.ts.map +1 -1
- package/dist/cjs/provide.js +31 -7
- package/dist/cjs/provide.js.map +1 -1
- package/dist/cjs/reduce.d.ts +2 -1
- package/dist/cjs/reduce.d.ts.map +1 -1
- package/dist/cjs/reduce.js +26 -3
- package/dist/cjs/reduce.js.map +1 -1
- package/dist/cjs/scan.d.ts.map +1 -1
- package/dist/cjs/scan.js +26 -3
- package/dist/cjs/scan.js.map +1 -1
- package/dist/cjs/scoped.d.ts +1 -1
- package/dist/cjs/scoped.d.ts.map +1 -1
- package/dist/cjs/scoped.js +25 -2
- package/dist/cjs/scoped.js.map +1 -1
- package/dist/cjs/skipRepeats.d.ts.map +1 -1
- package/dist/cjs/skipRepeats.js +31 -7
- package/dist/cjs/skipRepeats.js.map +1 -1
- package/dist/cjs/skipWhile.d.ts.map +1 -1
- package/dist/cjs/skipWhile.js +27 -4
- package/dist/cjs/skipWhile.js.map +1 -1
- package/dist/cjs/slice.d.ts.map +1 -1
- package/dist/cjs/slice.js +29 -6
- package/dist/cjs/slice.js.map +1 -1
- package/dist/cjs/snapshotEffect.d.ts +1 -1
- package/dist/cjs/snapshotEffect.d.ts.map +1 -1
- package/dist/cjs/snapshotEffect.js +36 -10
- package/dist/cjs/snapshotEffect.js.map +1 -1
- package/dist/cjs/switchMap.d.ts +1 -1
- package/dist/cjs/switchMap.d.ts.map +1 -1
- package/dist/cjs/switchMap.js.map +1 -1
- package/dist/cjs/switchMapCause.d.ts +2 -1
- package/dist/cjs/switchMapCause.d.ts.map +1 -1
- package/dist/cjs/switchMapCause.js +26 -2
- package/dist/cjs/switchMapCause.js.map +1 -1
- package/dist/cjs/switchMatch.d.ts +2 -1
- package/dist/cjs/switchMatch.d.ts.map +1 -1
- package/dist/cjs/switchMatch.js +26 -2
- package/dist/cjs/switchMatch.js.map +1 -1
- package/dist/cjs/takeWhile.d.ts.map +1 -1
- package/dist/cjs/takeWhile.js +27 -4
- package/dist/cjs/takeWhile.js.map +1 -1
- package/dist/cjs/tap.d.ts +1 -1
- package/dist/cjs/tap.d.ts.map +1 -1
- package/dist/cjs/tap.js +26 -3
- package/dist/cjs/tap.js.map +1 -1
- package/dist/cjs/tapCause.d.ts +2 -1
- package/dist/cjs/tapCause.d.ts.map +1 -1
- package/dist/cjs/tapCause.js +29 -5
- package/dist/cjs/tapCause.js.map +1 -1
- package/dist/cjs/test-utils.d.ts +1 -1
- package/dist/cjs/test-utils.d.ts.map +1 -1
- package/dist/cjs/test-utils.js +32 -7
- package/dist/cjs/test-utils.js.map +1 -1
- package/dist/cjs/throttle.d.ts +1 -1
- package/dist/cjs/throttle.d.ts.map +1 -1
- package/dist/cjs/throttle.js +25 -2
- package/dist/cjs/throttle.js.map +1 -1
- package/dist/cjs/toArray.d.ts +1 -1
- package/dist/cjs/toArray.d.ts.map +1 -1
- package/dist/cjs/toArray.js +26 -3
- package/dist/cjs/toArray.js.map +1 -1
- package/dist/cjs/toChunk.d.ts +2 -1
- package/dist/cjs/toChunk.d.ts.map +1 -1
- package/dist/cjs/toChunk.js +28 -4
- package/dist/cjs/toChunk.js.map +1 -1
- package/dist/cjs/toReadonlyArray.d.ts +1 -1
- package/dist/cjs/toReadonlyArray.d.ts.map +1 -1
- package/dist/combineAll.d.ts.map +1 -1
- package/dist/combineAll.js +1 -1
- package/dist/combineAll.js.map +1 -1
- package/dist/combineAllDiscard.d.ts.map +1 -1
- package/dist/combineAllDiscard.js +1 -1
- package/dist/combineAllDiscard.js.map +1 -1
- package/dist/continueWith.d.ts +1 -1
- package/dist/continueWith.d.ts.map +1 -1
- package/dist/continueWith.js +1 -1
- package/dist/continueWith.js.map +1 -1
- package/dist/debounce.d.ts +1 -1
- package/dist/debounce.d.ts.map +1 -1
- package/dist/debounce.js +1 -1
- package/dist/debounce.js.map +1 -1
- package/dist/delay.d.ts.map +1 -1
- package/dist/delay.js +1 -1
- package/dist/delay.js.map +1 -1
- package/dist/exhaustMap.d.ts +1 -1
- package/dist/exhaustMap.d.ts.map +1 -1
- package/dist/exhaustMap.js.map +1 -1
- package/dist/exhaustMapCause.d.ts +2 -1
- package/dist/exhaustMapCause.d.ts.map +1 -1
- package/dist/exhaustMapCause.js +2 -1
- package/dist/exhaustMapCause.js.map +1 -1
- package/dist/exhaustMapLatest.d.ts +1 -1
- package/dist/exhaustMapLatest.d.ts.map +1 -1
- package/dist/exhaustMapLatest.js.map +1 -1
- package/dist/exhaustMapLatestCause.d.ts +2 -1
- package/dist/exhaustMapLatestCause.d.ts.map +1 -1
- package/dist/exhaustMapLatestCause.js +2 -1
- package/dist/exhaustMapLatestCause.js.map +1 -1
- package/dist/filter.d.ts.map +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/filterMap.d.ts +1 -1
- package/dist/filterMap.d.ts.map +1 -1
- package/dist/filterMap.js +2 -1
- package/dist/filterMap.js.map +1 -1
- package/dist/flatMap.d.ts +1 -1
- package/dist/flatMap.d.ts.map +1 -1
- package/dist/flatMap.js.map +1 -1
- package/dist/fromArray.d.ts.map +1 -1
- package/dist/fromArray.js +1 -1
- package/dist/fromArray.js.map +1 -1
- package/dist/fromEffect.d.ts +1 -1
- package/dist/fromEffect.d.ts.map +1 -1
- package/dist/fromEffect.js +1 -1
- package/dist/fromEffect.js.map +1 -1
- package/dist/fromEmitter.d.ts +2 -2
- package/dist/fromEmitter.d.ts.map +1 -1
- package/dist/fromEmitter.js +3 -1
- package/dist/fromEmitter.js.map +1 -1
- package/dist/fromFxEffect.d.ts +1 -1
- package/dist/fromFxEffect.d.ts.map +1 -1
- package/dist/fromFxEffect.js +1 -1
- package/dist/fromFxEffect.js.map +1 -1
- package/dist/fromIterable.d.ts.map +1 -1
- package/dist/fromIterable.js +1 -1
- package/dist/fromIterable.js.map +1 -1
- package/dist/gen.d.ts +1 -1
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.js +1 -1
- package/dist/gen.js.map +1 -1
- package/dist/helpers.d.ts +2 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +6 -1
- package/dist/helpers.js.map +1 -1
- package/dist/hold.d.ts +3 -1
- package/dist/hold.d.ts.map +1 -1
- package/dist/hold.js +3 -1
- package/dist/hold.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/keyed.d.ts.map +1 -1
- package/dist/keyed.js +43 -25
- package/dist/keyed.js.map +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +1 -1
- package/dist/map.js.map +1 -1
- package/dist/mergeAll.d.ts.map +1 -1
- package/dist/mergeAll.js +3 -1
- package/dist/mergeAll.js.map +1 -1
- package/dist/multicast.d.ts +5 -3
- package/dist/multicast.d.ts.map +1 -1
- package/dist/multicast.js +2 -1
- package/dist/multicast.js.map +1 -1
- package/dist/never.d.ts.map +1 -1
- package/dist/never.js +1 -1
- package/dist/never.js.map +1 -1
- package/dist/observe.d.ts +1 -1
- package/dist/observe.d.ts.map +1 -1
- package/dist/observe.js +3 -1
- package/dist/observe.js.map +1 -1
- package/dist/onInterrupt.d.ts +1 -1
- package/dist/onInterrupt.d.ts.map +1 -1
- package/dist/onInterrupt.js +1 -1
- package/dist/onInterrupt.js.map +1 -1
- package/dist/promise.d.ts.map +1 -1
- package/dist/promise.js +1 -1
- package/dist/promise.js.map +1 -1
- package/dist/provide.d.ts +3 -2
- package/dist/provide.d.ts.map +1 -1
- package/dist/provide.js +2 -1
- package/dist/provide.js.map +1 -1
- package/dist/reduce.d.ts +2 -1
- package/dist/reduce.d.ts.map +1 -1
- package/dist/reduce.js +1 -1
- package/dist/reduce.js.map +1 -1
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +1 -1
- package/dist/scan.js.map +1 -1
- package/dist/scoped.d.ts +1 -1
- package/dist/scoped.d.ts.map +1 -1
- package/dist/scoped.js +1 -1
- package/dist/scoped.js.map +1 -1
- package/dist/skipRepeats.d.ts.map +1 -1
- package/dist/skipRepeats.js +2 -1
- package/dist/skipRepeats.js.map +1 -1
- package/dist/skipWhile.d.ts.map +1 -1
- package/dist/skipWhile.js +1 -1
- package/dist/skipWhile.js.map +1 -1
- package/dist/slice.d.ts.map +1 -1
- package/dist/slice.js +1 -1
- package/dist/slice.js.map +1 -1
- package/dist/snapshotEffect.d.ts +1 -1
- package/dist/snapshotEffect.d.ts.map +1 -1
- package/dist/snapshotEffect.js +4 -1
- package/dist/snapshotEffect.js.map +1 -1
- package/dist/switchMap.d.ts +1 -1
- package/dist/switchMap.d.ts.map +1 -1
- package/dist/switchMap.js.map +1 -1
- package/dist/switchMapCause.d.ts +2 -1
- package/dist/switchMapCause.d.ts.map +1 -1
- package/dist/switchMapCause.js +2 -1
- package/dist/switchMapCause.js.map +1 -1
- package/dist/switchMatch.d.ts +2 -1
- package/dist/switchMatch.d.ts.map +1 -1
- package/dist/switchMatch.js +2 -1
- package/dist/switchMatch.js.map +1 -1
- package/dist/takeWhile.d.ts.map +1 -1
- package/dist/takeWhile.js +1 -1
- package/dist/takeWhile.js.map +1 -1
- package/dist/tap.d.ts +1 -1
- package/dist/tap.d.ts.map +1 -1
- package/dist/tap.js +1 -1
- package/dist/tap.js.map +1 -1
- package/dist/tapCause.d.ts +2 -1
- package/dist/tapCause.d.ts.map +1 -1
- package/dist/tapCause.js +2 -1
- package/dist/tapCause.js.map +1 -1
- package/dist/test-utils.d.ts +1 -1
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/test-utils.js +3 -1
- package/dist/test-utils.js.map +1 -1
- package/dist/throttle.d.ts +1 -1
- package/dist/throttle.d.ts.map +1 -1
- package/dist/throttle.js +1 -1
- package/dist/throttle.js.map +1 -1
- package/dist/toArray.d.ts +1 -1
- package/dist/toArray.d.ts.map +1 -1
- package/dist/toArray.js +1 -1
- package/dist/toArray.js.map +1 -1
- package/dist/toChunk.d.ts +2 -1
- package/dist/toChunk.d.ts.map +1 -1
- package/dist/toChunk.js +2 -1
- package/dist/toChunk.js.map +1 -1
- package/dist/toReadonlyArray.d.ts +1 -1
- package/dist/toReadonlyArray.d.ts.map +1 -1
- package/dist/tsconfig.cjs.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/RefSubject.test.ts +5 -1
- package/src/RefSubject.ts +5 -2
- package/src/Subject.ts +2 -1
- package/src/at.ts +3 -2
- package/src/catchAllCause.test.ts +1 -1
- package/src/catchAllCause.ts +3 -1
- package/src/combineAll.ts +2 -1
- package/src/combineAllDiscard.ts +2 -1
- package/src/continueWith.ts +2 -1
- package/src/debounce.test.ts +1 -1
- package/src/debounce.ts +3 -2
- package/src/delay.test.ts +1 -1
- package/src/delay.ts +1 -1
- package/src/exhaustMap.test.ts +1 -1
- package/src/exhaustMap.ts +2 -1
- package/src/exhaustMapCause.test.ts +1 -1
- package/src/exhaustMapCause.ts +3 -1
- package/src/exhaustMapLatest.test.ts +1 -1
- package/src/exhaustMapLatest.ts +2 -1
- package/src/exhaustMapLatestCause.test.ts +1 -1
- package/src/exhaustMapLatestCause.ts +3 -1
- package/src/failCause.test.ts +2 -1
- package/src/filter.ts +1 -1
- package/src/filterMap.ts +3 -1
- package/src/flatMap.test.ts +1 -1
- package/src/flatMap.ts +2 -1
- package/src/fromArray.ts +2 -1
- package/src/fromEffect.test.ts +2 -1
- package/src/fromEffect.ts +2 -1
- package/src/fromEmitter.test.ts +2 -1
- package/src/fromEmitter.ts +4 -2
- package/src/fromFxEffect.test.ts +2 -1
- package/src/fromFxEffect.ts +2 -1
- package/src/fromIterable.ts +2 -1
- package/src/gen.test.ts +2 -1
- package/src/gen.ts +2 -1
- package/src/helpers.ts +6 -2
- package/src/hold.test.ts +1 -1
- package/src/hold.ts +3 -1
- package/src/index.ts +7 -2
- package/src/keyed.ts +55 -33
- package/src/map.ts +2 -1
- package/src/mergeAll.ts +4 -1
- package/src/multicast.test.ts +2 -1
- package/src/multicast.ts +5 -3
- package/src/never.ts +2 -1
- package/src/observe.ts +4 -2
- package/src/onInterrupt.ts +1 -1
- package/src/promise.ts +2 -1
- package/src/provide.ts +5 -3
- package/src/reduce.ts +3 -1
- package/src/scan.ts +2 -1
- package/src/scoped.ts +3 -1
- package/src/skipRepeats.ts +2 -1
- package/src/skipWhile.ts +1 -1
- package/src/slice.ts +2 -1
- package/src/snapshotEffect.ts +5 -1
- package/src/switchMap.test.ts +1 -1
- package/src/switchMap.ts +2 -1
- package/src/switchMapCause.test.ts +1 -1
- package/src/switchMapCause.ts +3 -1
- package/src/switchMatch.test.ts +1 -1
- package/src/switchMatch.ts +3 -1
- package/src/takeWhile.ts +2 -2
- package/src/tap.ts +2 -1
- package/src/tapCause.ts +2 -1
- package/src/test-utils.ts +3 -1
- package/src/throttle.test.ts +1 -1
- package/src/throttle.ts +3 -1
- package/src/toArray.ts +1 -1
- package/src/toChunk.ts +2 -1
- package/src/toReadonlyArray.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/src/externals.ts +0 -18
package/src/debounce.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
2
|
import { describe } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { debounce } from './debounce.js'
|
|
4
|
-
import { Duration } from './externals.js'
|
|
5
5
|
import { fromArray } from './fromArray.js'
|
|
6
6
|
import { testCollectAll } from './test-utils.js'
|
|
7
7
|
|
package/src/debounce.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
3
|
+
|
|
1
4
|
import type { Fx } from './Fx.js'
|
|
2
|
-
import type { Duration } from './externals.js'
|
|
3
|
-
import { Effect } from './externals.js'
|
|
4
5
|
import { switchMapEffect } from './switchMap.js'
|
|
5
6
|
|
|
6
7
|
export function debounce<R, E, A>(fx: Fx<R, E, A>, duration: Duration.Duration): Fx<R, E, A> {
|
package/src/delay.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
2
|
import { describe } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { delay } from './delay.js'
|
|
4
|
-
import { Duration } from './externals.js'
|
|
5
5
|
import { fromArray } from './fromArray.js'
|
|
6
6
|
import { testCollectAll } from './test-utils.js'
|
|
7
7
|
|
package/src/delay.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Duration } from '@effect/data/Duration'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
2
3
|
|
|
3
4
|
import { Fx, Sink } from './Fx.js'
|
|
4
|
-
import { Effect } from './externals.js'
|
|
5
5
|
|
|
6
6
|
export function delay<R, E, A>(fx: Fx<R, E, A>, delay: Duration): Fx<R, E, A> {
|
|
7
7
|
return Fx((sink) => fx.run(Sink((a) => Effect.delay(sink.event(a), delay), sink.error)))
|
package/src/exhaustMap.test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
2
|
import { describe } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { delay } from './delay.js'
|
|
4
5
|
import { exhaustMap } from './exhaustMap.js'
|
|
5
|
-
import { Duration } from './externals.js'
|
|
6
6
|
import { fromArray } from './fromArray.js'
|
|
7
7
|
import { testCollectAll } from './test-utils.js'
|
|
8
8
|
|
package/src/exhaustMap.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
2
|
import { describe } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { delay } from './delay.js'
|
|
4
5
|
import { exhaustMapCause, exhaustMapError } from './exhaustMapCause.js'
|
|
5
|
-
import { Duration } from './externals.js'
|
|
6
6
|
import { fail } from './failCause.js'
|
|
7
7
|
import { fromArray } from './fromArray.js'
|
|
8
8
|
import { mergeAll } from './mergeAll.js'
|
package/src/exhaustMapCause.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import * as Either from '@effect/data/Either'
|
|
1
2
|
import { pipe } from '@effect/data/Function'
|
|
3
|
+
import * as Cause from '@effect/io/Cause'
|
|
4
|
+
import * as Effect from '@effect/io/Effect'
|
|
2
5
|
|
|
3
6
|
import { Fx, Sink } from './Fx.js'
|
|
4
|
-
import { Cause, Effect, Either } from './externals.js'
|
|
5
7
|
import { failCause } from './failCause.js'
|
|
6
8
|
import { fromEffect } from './fromEffect.js'
|
|
7
9
|
import { withExhaust } from './helpers.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
2
|
import { describe } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { delay } from './delay.js'
|
|
4
5
|
import { exhaustMapLatest } from './exhaustMapLatest.js'
|
|
5
|
-
import { Duration } from './externals.js'
|
|
6
6
|
import { fromArray } from './fromArray.js'
|
|
7
7
|
import { testCollectAll } from './test-utils.js'
|
|
8
8
|
|
package/src/exhaustMapLatest.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
2
|
import { describe } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { delay } from './delay.js'
|
|
4
5
|
import { exhaustMapLatestCause, exhaustMapLatestError } from './exhaustMapLatestCause.js'
|
|
5
|
-
import { Duration } from './externals.js'
|
|
6
6
|
import { fail } from './failCause.js'
|
|
7
7
|
import { fromArray } from './fromArray.js'
|
|
8
8
|
import { mergeAll } from './mergeAll.js'
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import * as Either from '@effect/data/Either'
|
|
1
2
|
import { pipe } from '@effect/data/Function'
|
|
3
|
+
import * as Cause from '@effect/io/Cause'
|
|
4
|
+
import * as Effect from '@effect/io/Effect'
|
|
2
5
|
|
|
3
6
|
import { Fx, Sink } from './Fx.js'
|
|
4
|
-
import { Cause, Effect, Either } from './externals.js'
|
|
5
7
|
import { failCause } from './failCause.js'
|
|
6
8
|
import { fromEffect } from './fromEffect.js'
|
|
7
9
|
import { withExhaustLatest } from './helpers.js'
|
package/src/failCause.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as Cause from '@effect/io/Cause'
|
|
2
|
+
import * as FiberId from '@effect/io/Fiber/Id'
|
|
1
3
|
import { describe } from 'vitest'
|
|
2
4
|
|
|
3
|
-
import { Cause, FiberId } from './externals.js'
|
|
4
5
|
import { failCause } from './failCause.js'
|
|
5
6
|
import { testCause } from './test-utils.js'
|
|
6
7
|
|
package/src/filter.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Predicate, Refinement } from '@effect/data/Predicate'
|
|
2
2
|
import { not } from '@effect/data/Predicate'
|
|
3
|
+
import * as Effect from '@effect/io/Effect'
|
|
3
4
|
|
|
4
5
|
import { Fx, Sink } from './Fx.js'
|
|
5
|
-
import { Effect } from './externals.js'
|
|
6
6
|
|
|
7
7
|
export function filter<R, E, A, B extends A>(
|
|
8
8
|
fx: Fx<R, E, A>,
|
package/src/filterMap.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import * as Option from '@effect/data/Option'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
3
|
+
|
|
1
4
|
import { Fx, Sink } from './Fx.js'
|
|
2
|
-
import { Effect, Option } from './externals.js'
|
|
3
5
|
|
|
4
6
|
export function filterMap<R, E, A, B>(fx: Fx<R, E, A>, f: (a: A) => Option.Option<B>): Fx<R, E, B> {
|
|
5
7
|
return Fx((sink) => fx.run(Sink((a) => Option.match(f(a), Effect.unit, sink.event), sink.error)))
|
package/src/flatMap.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
2
|
import { describe } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { delay } from './delay.js'
|
|
4
|
-
import { Duration } from './externals.js'
|
|
5
5
|
import { flatMap } from './flatMap.js'
|
|
6
6
|
import { fromArray } from './fromArray.js'
|
|
7
7
|
import { testCollectAll } from './test-utils.js'
|
package/src/flatMap.ts
CHANGED
package/src/fromArray.ts
CHANGED
package/src/fromEffect.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as Cause from '@effect/io/Cause'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
1
3
|
import { describe } from 'vitest'
|
|
2
4
|
|
|
3
|
-
import { Cause, Effect } from './externals.js'
|
|
4
5
|
import { fromEffect } from './fromEffect.js'
|
|
5
6
|
import { testCause, testCollectAll } from './test-utils.js'
|
|
6
7
|
|
package/src/fromEffect.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as Effect from '@effect/io/Effect'
|
|
2
|
+
|
|
1
3
|
import { Fx } from './Fx.js'
|
|
2
|
-
import { Effect } from './externals.js'
|
|
3
4
|
|
|
4
5
|
export function fromEffect<R, E, A>(effect: Effect.Effect<R, E, A>): Fx<R, E, A> {
|
|
5
6
|
return Fx((sink) => Effect.matchCauseEffect(effect, sink.error, sink.event))
|
package/src/fromEmitter.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as Cause from '@effect/io/Cause'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
1
3
|
import { describe } from 'vitest'
|
|
2
4
|
|
|
3
|
-
import { Cause, Effect } from './externals.js'
|
|
4
5
|
import { fromEmitter } from './fromEmitter.js'
|
|
5
6
|
import { testCause, testCollectAll } from './test-utils.js'
|
|
6
7
|
|
package/src/fromEmitter.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { methodWithTrace } from '@effect/data/Debug'
|
|
2
|
+
import * as Cause from '@effect/io/Cause'
|
|
3
|
+
import * as Deferred from '@effect/io/Deferred'
|
|
4
|
+
import * as Effect from '@effect/io/Effect'
|
|
5
|
+
import * as Runtime from '@effect/io/Runtime'
|
|
2
6
|
import type { Scope } from '@effect/io/Scope'
|
|
3
7
|
|
|
4
8
|
import type { Sink } from './Fx.js'
|
|
5
9
|
import { Fx } from './Fx.js'
|
|
6
|
-
import type { Cause } from './externals.js'
|
|
7
|
-
import { Deferred, Effect, Runtime } from './externals.js'
|
|
8
10
|
|
|
9
11
|
export function fromEmitter<E, A, R, E2>(
|
|
10
12
|
f: (emitter: Emitter<E, A>) => Effect.Effect<R | Scope, E2, void>,
|
package/src/fromFxEffect.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as Cause from '@effect/io/Cause'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
1
3
|
import { describe } from 'vitest'
|
|
2
4
|
|
|
3
|
-
import { Cause, Effect } from './externals.js'
|
|
4
5
|
import { fromFxEffect } from './fromFxEffect.js'
|
|
5
6
|
import { succeed } from './succeed.js'
|
|
6
7
|
import { testCause, testCollectAll } from './test-utils.js'
|
package/src/fromFxEffect.ts
CHANGED
package/src/fromIterable.ts
CHANGED
package/src/gen.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as Cause from '@effect/io/Cause'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
1
3
|
import { describe } from 'vitest'
|
|
2
4
|
|
|
3
|
-
import { Cause, Effect } from './externals.js'
|
|
4
5
|
import { gen } from './gen.js'
|
|
5
6
|
import { succeed } from './succeed.js'
|
|
6
7
|
import { testCause, testCollectAll } from './test-utils.js'
|
package/src/gen.ts
CHANGED
package/src/helpers.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { pipe } from '@effect/data/Function'
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
import * as Option from '@effect/data/Option'
|
|
3
|
+
import * as Effect from '@effect/io/Effect'
|
|
4
|
+
import * as Fiber from '@effect/io/Fiber'
|
|
5
|
+
import * as Ref from '@effect/io/Ref'
|
|
6
|
+
import * as RefS from '@effect/io/Ref/Synchronized'
|
|
7
|
+
import * as Scope from '@effect/io/Scope'
|
|
4
8
|
|
|
5
9
|
export type ScopedFork = <R2, E2, B>(
|
|
6
10
|
effect: Effect.Effect<R2, E2, B>,
|
package/src/hold.test.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Chunk from '@effect/data/Chunk'
|
|
1
2
|
import { millis } from '@effect/data/Duration'
|
|
2
3
|
import { range } from '@effect/data/ReadonlyArray'
|
|
3
4
|
import * as Effect from '@effect/io/Effect'
|
|
@@ -5,7 +6,6 @@ import * as Fiber from '@effect/io/Fiber'
|
|
|
5
6
|
import { describe, it, expect } from 'vitest'
|
|
6
7
|
|
|
7
8
|
import { at } from './at.js'
|
|
8
|
-
import { Chunk } from './externals.js'
|
|
9
9
|
import { hold } from './hold.js'
|
|
10
10
|
import { mergeAll } from './mergeAll.js'
|
|
11
11
|
import { toChunk } from './toChunk.js'
|
package/src/hold.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Trace } from '@effect/data/Debug'
|
|
2
|
+
import * as MutableRef from '@effect/data/MutableRef'
|
|
3
|
+
import * as Option from '@effect/data/Option'
|
|
4
|
+
import * as Effect from '@effect/io/Effect'
|
|
2
5
|
|
|
3
6
|
import type { Fx, Sink } from './Fx.js'
|
|
4
7
|
import { Traced } from './Fx.js'
|
|
5
|
-
import { Effect, MutableRef, Option } from './externals.js'
|
|
6
8
|
import { MulticastFx } from './multicast.js'
|
|
7
9
|
|
|
8
10
|
export function hold<R, E, A>(fx: Fx<R, E, A>): Fx<R, E, A> {
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import * as Chunk from '@effect/data/Chunk'
|
|
2
|
+
import * as Context from '@effect/data/Context'
|
|
1
3
|
import { dualWithTrace, methodWithTrace } from '@effect/data/Debug'
|
|
2
4
|
import type { Duration } from '@effect/data/Duration'
|
|
3
5
|
import type { HashSet } from '@effect/data/HashSet'
|
|
6
|
+
import * as Option from '@effect/data/Option'
|
|
4
7
|
import type { Predicate, Refinement } from '@effect/data/Predicate'
|
|
5
8
|
import type { Equivalence } from '@effect/data/typeclass/Equivalence'
|
|
9
|
+
import * as Cause from '@effect/io/Cause'
|
|
10
|
+
import * as Effect from '@effect/io/Effect'
|
|
6
11
|
import type { FiberId } from '@effect/io/Fiber/Id'
|
|
12
|
+
import * as Layer from '@effect/io/Layer'
|
|
13
|
+
import * as Scope from '@effect/io/Scope'
|
|
7
14
|
|
|
8
15
|
import type { Fx } from './Fx.js'
|
|
9
16
|
import * as internal from './data-first.js'
|
|
10
|
-
import type { Cause, Chunk, Context, Effect, Layer, Option, Scope } from './externals.js'
|
|
11
|
-
|
|
12
17
|
export * from './Fx.js'
|
|
13
18
|
|
|
14
19
|
export const at: {
|
package/src/keyed.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import * as MutableHashMap from '@effect/data/MutableHashMap'
|
|
2
2
|
import * as Option from '@effect/data/Option'
|
|
3
3
|
import * as ReadonlyArray from '@effect/data/ReadonlyArray'
|
|
4
|
-
import * as
|
|
4
|
+
import * as Cause from '@effect/io/Cause'
|
|
5
5
|
import * as Effect from '@effect/io/Effect'
|
|
6
6
|
import * as Fiber from '@effect/io/Fiber'
|
|
7
|
-
import fastDeepEqual from 'fast-deep-equal'
|
|
8
7
|
|
|
9
8
|
import { Fx, Sink } from './Fx.js'
|
|
10
9
|
import { RefSubject } from './RefSubject.js'
|
|
11
10
|
import { Subject, makeHoldSubject } from './Subject.js'
|
|
12
|
-
import { Cause } from './externals.js'
|
|
13
11
|
import { ScopedFork, withScopedFork } from './helpers.js'
|
|
14
12
|
|
|
15
13
|
export function keyed<R, E, A, R2, E2, B, C>(
|
|
@@ -21,13 +19,10 @@ export function keyed<R, E, A, R2, E2, B, C>(
|
|
|
21
19
|
withScopedFork((fork) =>
|
|
22
20
|
Effect.gen(function* ($) {
|
|
23
21
|
const state = createKeyedState<A, B, C>()
|
|
24
|
-
const eq = Equivalence.make((x: A, y: A) => fastDeepEqual(getKey(x), getKey(y)))
|
|
25
|
-
const difference = ReadonlyArray.difference(eq)
|
|
26
|
-
const intersection = ReadonlyArray.intersection(eq)
|
|
27
22
|
const emit = emitWhenReady(state, getKey)
|
|
28
23
|
|
|
29
|
-
// Let output emit to the sink
|
|
30
|
-
|
|
24
|
+
// Let output emit to the sink, it is closes by the surrounding scope
|
|
25
|
+
yield* $(fork(state.output.run(sink)))
|
|
31
26
|
|
|
32
27
|
// Listen to the input and update the state
|
|
33
28
|
yield* $(
|
|
@@ -40,8 +35,6 @@ export function keyed<R, E, A, R2, E2, B, C>(
|
|
|
40
35
|
getKey,
|
|
41
36
|
f,
|
|
42
37
|
fork,
|
|
43
|
-
difference,
|
|
44
|
-
intersection,
|
|
45
38
|
emit,
|
|
46
39
|
error: sink.error,
|
|
47
40
|
}),
|
|
@@ -54,9 +47,6 @@ export function keyed<R, E, A, R2, E2, B, C>(
|
|
|
54
47
|
|
|
55
48
|
// When the source stream ends we wait for the remaining fibers to end
|
|
56
49
|
yield* $(Fiber.joinAll(Array.from(state.fibers).map((x) => x[1])))
|
|
57
|
-
|
|
58
|
-
// Terminate the output fiber
|
|
59
|
-
yield* $(Fiber.interrupt(fiber))
|
|
60
50
|
}),
|
|
61
51
|
),
|
|
62
52
|
)
|
|
@@ -64,7 +54,7 @@ export function keyed<R, E, A, R2, E2, B, C>(
|
|
|
64
54
|
|
|
65
55
|
type KeyedState<A, B, C> = {
|
|
66
56
|
previous: readonly A[]
|
|
67
|
-
|
|
57
|
+
previousKeys: ReadonlySet<C>
|
|
68
58
|
|
|
69
59
|
readonly subjects: MutableHashMap.MutableHashMap<C, RefSubject<never, A>>
|
|
70
60
|
readonly fibers: MutableHashMap.MutableHashMap<C, Fiber.RuntimeFiber<never, void>>
|
|
@@ -75,7 +65,7 @@ type KeyedState<A, B, C> = {
|
|
|
75
65
|
function createKeyedState<A, B, C>(): KeyedState<A, B, C> {
|
|
76
66
|
return {
|
|
77
67
|
previous: [],
|
|
78
|
-
|
|
68
|
+
previousKeys: new Set(),
|
|
79
69
|
subjects: MutableHashMap.empty(),
|
|
80
70
|
fibers: MutableHashMap.empty(),
|
|
81
71
|
values: MutableHashMap.empty(),
|
|
@@ -88,8 +78,6 @@ function updateState<A, B, C, R2, E2, R3>({
|
|
|
88
78
|
updated,
|
|
89
79
|
f,
|
|
90
80
|
fork,
|
|
91
|
-
difference,
|
|
92
|
-
intersection,
|
|
93
81
|
emit,
|
|
94
82
|
error,
|
|
95
83
|
getKey,
|
|
@@ -98,21 +86,18 @@ function updateState<A, B, C, R2, E2, R3>({
|
|
|
98
86
|
updated: readonly A[]
|
|
99
87
|
f: (fx: RefSubject<never, A>) => Fx<R2, E2, B>
|
|
100
88
|
fork: ScopedFork
|
|
101
|
-
difference: (self: Iterable<A>, that: Iterable<A>) => A[]
|
|
102
|
-
intersection: (self: Iterable<A>, that: Iterable<A>) => A[]
|
|
103
89
|
emit: Effect.Effect<never, never, void>
|
|
104
90
|
error: (e: Cause.Cause<E2>) => Effect.Effect<R3, never, void>
|
|
105
91
|
getKey: (a: A) => C
|
|
106
92
|
}) {
|
|
107
93
|
return Effect.gen(function* ($) {
|
|
108
|
-
const added =
|
|
109
|
-
const removed = difference(state.previous, updated)
|
|
110
|
-
const unchanged = intersection(updated, state.previous)
|
|
111
|
-
|
|
112
|
-
state.previous = updated
|
|
94
|
+
const { added, removed, unchanged } = diffValues(state, updated, getKey)
|
|
113
95
|
|
|
114
96
|
// Remove values that are no longer in the stream
|
|
115
|
-
yield* $(Effect.
|
|
97
|
+
yield* $(Effect.forEachDiscard(removed, (key) => removeValue(state, key)))
|
|
98
|
+
|
|
99
|
+
// Update values that are still in the stream
|
|
100
|
+
yield* $(Effect.forEachParDiscard(unchanged, (value) => updateValue(state, value, getKey)))
|
|
116
101
|
|
|
117
102
|
// Add values that are new to the stream
|
|
118
103
|
yield* $(
|
|
@@ -121,9 +106,6 @@ function updateState<A, B, C, R2, E2, R3>({
|
|
|
121
106
|
),
|
|
122
107
|
)
|
|
123
108
|
|
|
124
|
-
// Update values that are still in the stream
|
|
125
|
-
yield* $(Effect.forEachParDiscard(unchanged, (value) => updateValue(state, value, getKey)))
|
|
126
|
-
|
|
127
109
|
// If nothing was added, emit the current values
|
|
128
110
|
if (added.length === 0) {
|
|
129
111
|
yield* $(emit)
|
|
@@ -131,9 +113,46 @@ function updateState<A, B, C, R2, E2, R3>({
|
|
|
131
113
|
})
|
|
132
114
|
}
|
|
133
115
|
|
|
134
|
-
function
|
|
135
|
-
|
|
116
|
+
function diffValues<A, B, C>(
|
|
117
|
+
state: KeyedState<A, B, C>,
|
|
118
|
+
updated: ReadonlyArray<A>,
|
|
119
|
+
getKey: (a: A) => C,
|
|
120
|
+
) {
|
|
121
|
+
const added: A[] = []
|
|
122
|
+
const unchanged: A[] = []
|
|
123
|
+
const removed: C[] = []
|
|
124
|
+
const previousKeys = state.previousKeys
|
|
125
|
+
const keys = new Set<C>(updated.map(getKey))
|
|
126
|
+
|
|
127
|
+
for (let i = 0; i < updated.length; ++i) {
|
|
128
|
+
const value = updated[i]
|
|
136
129
|
const key = getKey(value)
|
|
130
|
+
|
|
131
|
+
if (previousKeys.has(key)) {
|
|
132
|
+
unchanged.push(value)
|
|
133
|
+
} else {
|
|
134
|
+
added.push(value)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
previousKeys.forEach((k) => {
|
|
139
|
+
if (!keys.has(k)) {
|
|
140
|
+
removed.push(k)
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
state.previous = updated
|
|
145
|
+
state.previousKeys = keys
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
added,
|
|
149
|
+
unchanged,
|
|
150
|
+
removed,
|
|
151
|
+
} as const
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function removeValue<A, B, C>(state: KeyedState<A, B, C>, key: C) {
|
|
155
|
+
return Effect.gen(function* ($) {
|
|
137
156
|
const subject = MutableHashMap.get(state.subjects, key)
|
|
138
157
|
|
|
139
158
|
if (Option.isSome(subject)) yield* $(Effect.fork(subject.value.end()))
|
|
@@ -202,6 +221,11 @@ function updateValue<A, B, C>(state: KeyedState<A, B, C>, value: A, getKey: (a:
|
|
|
202
221
|
|
|
203
222
|
function emitWhenReady<A, B, C>(state: KeyedState<A, B, C>, getKey: (a: A) => C) {
|
|
204
223
|
return Effect.suspend(() => {
|
|
224
|
+
// Fast path: if we don't have enough values, don't emit
|
|
225
|
+
if (MutableHashMap.size(state.values) !== state.previous.length) {
|
|
226
|
+
return Effect.unit()
|
|
227
|
+
}
|
|
228
|
+
|
|
205
229
|
const values = ReadonlyArray.filterMap(state.previous, (value) =>
|
|
206
230
|
MutableHashMap.get(state.values, getKey(value)),
|
|
207
231
|
)
|
|
@@ -216,7 +240,5 @@ function emitWhenReady<A, B, C>(state: KeyedState<A, B, C>, getKey: (a: A) => C)
|
|
|
216
240
|
}
|
|
217
241
|
|
|
218
242
|
function endAll<A, B, C>(state: KeyedState<A, B, C>) {
|
|
219
|
-
return Effect.
|
|
220
|
-
yield* $(Effect.forEachParDiscard(state.subjects, ([, subject]) => subject.end()))
|
|
221
|
-
})
|
|
243
|
+
return Effect.forEachParDiscard(state.subjects, ([, subject]) => subject.end())
|
|
222
244
|
}
|
package/src/map.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as Effect from '@effect/io/Effect'
|
|
2
|
+
|
|
1
3
|
import { Fx, Sink } from './Fx.js'
|
|
2
|
-
import { Effect } from './externals.js'
|
|
3
4
|
|
|
4
5
|
export function map<R, E, A, B>(fx: Fx<R, E, A>, f: (a: A) => B): Fx<R, E, B> {
|
|
5
6
|
return Fx((sink) => fx.run(Sink((a) => Effect.suspend(() => sink.event(f(a))), sink.error)))
|
package/src/mergeAll.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import * as Option from '@effect/data/Option'
|
|
2
|
+
import * as Cause from '@effect/io/Cause'
|
|
3
|
+
import * as Effect from '@effect/io/Effect'
|
|
4
|
+
|
|
1
5
|
import { Fx, Sink } from './Fx.js'
|
|
2
|
-
import { Cause, Effect, Option } from './externals.js'
|
|
3
6
|
import { compact } from './filterMap.js'
|
|
4
7
|
import { map } from './map.js'
|
|
5
8
|
|
package/src/multicast.test.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import * as Chunk from '@effect/data/Chunk'
|
|
2
|
+
import * as Duration from '@effect/data/Duration'
|
|
1
3
|
import { pipe } from '@effect/data/Function'
|
|
2
4
|
import * as Effect from '@effect/io/Effect'
|
|
3
5
|
import * as Fiber from '@effect/io/Fiber'
|
|
4
6
|
import { describe, it, expect } from 'vitest'
|
|
5
7
|
|
|
6
8
|
import { delay } from './delay.js'
|
|
7
|
-
import { Chunk, Duration } from './externals.js'
|
|
8
9
|
import { flatMap } from './flatMap.js'
|
|
9
10
|
import { fromArray } from './fromArray.js'
|
|
10
11
|
import { merge } from './mergeAll.js'
|
package/src/multicast.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type * as Context from '@effect/data/Context'
|
|
1
2
|
import type { Trace } from '@effect/data/Debug'
|
|
2
3
|
import { identity } from '@effect/data/Function'
|
|
4
|
+
import type * as Cause from '@effect/io/Cause'
|
|
5
|
+
import * as Effect from '@effect/io/Effect'
|
|
6
|
+
import * as Fiber from '@effect/io/Fiber'
|
|
3
7
|
|
|
4
|
-
import type { Fx, Sink } from './Fx.js'
|
|
5
8
|
import { FxTypeId, Traced } from './Fx.js'
|
|
6
|
-
import type {
|
|
7
|
-
import { Effect, Fiber } from './externals.js'
|
|
9
|
+
import type { Fx, Sink } from './Fx.js'
|
|
8
10
|
|
|
9
11
|
export function multicast<R, E, A>(fx: Fx<R, E, A>): Fx<R, E, A> {
|
|
10
12
|
return new MulticastFx(fx)
|
package/src/never.ts
CHANGED
package/src/observe.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import * as Cause from '@effect/io/Cause'
|
|
2
|
+
import * as Deferred from '@effect/io/Deferred'
|
|
3
|
+
import * as Effect from '@effect/io/Effect'
|
|
4
|
+
import * as Fiber from '@effect/io/Fiber'
|
|
1
5
|
import type { Scope } from '@effect/io/Scope'
|
|
2
6
|
|
|
3
7
|
import type { Fx } from './Fx.js'
|
|
4
8
|
import { Sink } from './Fx.js'
|
|
5
|
-
import type { Cause } from './externals.js'
|
|
6
|
-
import { Deferred, Effect, Fiber } from './externals.js'
|
|
7
9
|
|
|
8
10
|
export function observe<R, E, A, R2, E2>(
|
|
9
11
|
fx: Fx<R, E, A>,
|
package/src/onInterrupt.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HashSet } from '@effect/data/HashSet'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
2
3
|
import type { FiberId } from '@effect/io/Fiber/Id'
|
|
3
4
|
|
|
4
5
|
import { Fx } from './Fx.js'
|
|
5
|
-
import { Effect } from './externals.js'
|
|
6
6
|
|
|
7
7
|
export function onInterrupt<R, E, A, R2, E2, B>(
|
|
8
8
|
fx: Fx<R, E, A>,
|
package/src/promise.ts
CHANGED
package/src/provide.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from '@effect/data/Context'
|
|
2
|
+
import * as Effect from '@effect/io/Effect'
|
|
3
|
+
import * as Layer from '@effect/io/Layer'
|
|
4
|
+
|
|
2
5
|
import { Fx } from './Fx.js'
|
|
3
|
-
import type {
|
|
4
|
-
import { Context, Effect } from './externals.js'
|
|
6
|
+
import type { Sink } from './Fx.js'
|
|
5
7
|
import { switchMap } from './switchMap.js'
|
|
6
8
|
|
|
7
9
|
export function provideContext<R, E, A>(
|
package/src/reduce.ts
CHANGED