@fncts/io 0.0.31 → 0.0.33
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/Channel/api/runScoped.d.ts +1 -0
- package/Channel/api.d.ts +1 -0
- package/Channel/internal/ChannelExecutor.d.ts +2 -2
- package/Fiber/FiberMessage.d.ts +5 -5
- package/Fiber/FiberRuntime.d.ts +3 -3
- package/IO/api/provideSomeLayer.d.ts +1 -2
- package/IO/api/zipConcurrent.d.ts +2 -1
- package/IO/api.d.ts +2 -1
- package/IO/definition.d.ts +34 -24
- package/IO/runtime.d.ts +10 -18
- package/STM/definition.d.ts +1 -1
- package/Stream/api.d.ts +113 -5
- package/_cjs/Channel/api/mapOutConcurrentIO.cjs +1 -1
- package/_cjs/Channel/api/mapOutConcurrentIO.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +3 -3
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/Channel/api/mergeWith.cjs +4 -4
- package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
- package/_cjs/Channel/api/runScoped.cjs +19 -3
- package/_cjs/Channel/api/runScoped.cjs.map +1 -1
- package/_cjs/Channel/api/toPull.cjs +3 -3
- package/_cjs/Channel/api/toPull.cjs.map +1 -1
- package/_cjs/Channel/api.cjs +8 -7
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Channel/internal/ChannelExecutor.cjs +71 -62
- package/_cjs/Channel/internal/ChannelExecutor.cjs.map +1 -1
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs +3 -3
- package/_cjs/Channel/internal/SingleProducerAsyncInput.cjs.map +1 -1
- package/_cjs/Clock/live.cjs +1 -1
- package/_cjs/Clock/live.cjs.map +1 -1
- package/_cjs/Fiber/FiberMessage.cjs +12 -11
- package/_cjs/Fiber/FiberMessage.cjs.map +1 -1
- package/_cjs/Fiber/FiberRuntime.cjs +102 -70
- package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
- package/_cjs/Fiber/api/collectAll.cjs +1 -1
- package/_cjs/Fiber/api/collectAll.cjs.map +1 -1
- package/_cjs/Fiber/api/mapIO.cjs +1 -1
- package/_cjs/Fiber/api/mapIO.cjs.map +1 -1
- package/_cjs/Fiber/api/zipWith.cjs +1 -1
- package/_cjs/Fiber/api/zipWith.cjs.map +1 -1
- package/_cjs/Fiber/constructors.cjs +5 -5
- package/_cjs/Fiber/constructors.cjs.map +1 -1
- package/_cjs/FiberRef/unsafe.cjs +3 -2
- package/_cjs/FiberRef/unsafe.cjs.map +1 -1
- package/_cjs/FiberScope/definition.cjs +2 -2
- package/_cjs/FiberScope/definition.cjs.map +1 -1
- package/_cjs/Future/api.cjs +4 -4
- package/_cjs/Future/api.cjs.map +1 -1
- package/_cjs/Hub/api.cjs.map +1 -1
- package/_cjs/Hub/internal.cjs +1 -1
- package/_cjs/Hub/internal.cjs.map +1 -1
- package/_cjs/IO/api/asyncIO.cjs +1 -1
- package/_cjs/IO/api/asyncIO.cjs.map +1 -1
- package/_cjs/IO/api/asyncInterrupt.cjs +2 -2
- package/_cjs/IO/api/asyncInterrupt.cjs.map +1 -1
- package/_cjs/IO/api/concurrency.cjs +3 -3
- package/_cjs/IO/api/concurrency.cjs.map +1 -1
- package/_cjs/IO/api/daemonChildren.cjs +1 -1
- package/_cjs/IO/api/daemonChildren.cjs.map +1 -1
- package/_cjs/IO/api/fork.cjs +2 -1
- package/_cjs/IO/api/fork.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +2 -2
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/provideSomeLayer.cjs.map +1 -1
- package/_cjs/IO/api/raceWith.cjs +9 -12
- package/_cjs/IO/api/raceWith.cjs.map +1 -1
- package/_cjs/IO/api/repeat.cjs +2 -2
- package/_cjs/IO/api/repeat.cjs.map +1 -1
- package/_cjs/IO/api/stateful.cjs +3 -3
- package/_cjs/IO/api/stateful.cjs.map +1 -1
- package/_cjs/IO/api/timeout.cjs +1 -1
- package/_cjs/IO/api/timeout.cjs.map +1 -1
- package/_cjs/IO/api/transplant.cjs +1 -1
- package/_cjs/IO/api/transplant.cjs.map +1 -1
- package/_cjs/IO/api/withChildren.cjs +5 -4
- package/_cjs/IO/api/withChildren.cjs.map +1 -1
- package/_cjs/IO/api/withEarlyRelease.cjs +1 -1
- package/_cjs/IO/api/withEarlyRelease.cjs.map +1 -1
- package/_cjs/IO/api/zipConcurrent.cjs +23 -23
- package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
- package/_cjs/IO/api.cjs +33 -32
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO/definition.cjs +17 -31
- package/_cjs/IO/definition.cjs.map +1 -1
- package/_cjs/IO/runtime.cjs +47 -40
- package/_cjs/IO/runtime.cjs.map +1 -1
- package/_cjs/Logger/api.cjs +3 -2
- package/_cjs/Logger/api.cjs.map +1 -1
- package/_cjs/MVar/api.cjs +11 -11
- package/_cjs/MVar/api.cjs.map +1 -1
- package/_cjs/Push/api.cjs +3 -3
- package/_cjs/Push/api.cjs.map +1 -1
- package/_cjs/Push/internal.cjs +1 -1
- package/_cjs/Push/internal.cjs.map +1 -1
- package/_cjs/Queue/api/filterInputIO.cjs +2 -2
- package/_cjs/Queue/api/filterInputIO.cjs.map +1 -1
- package/_cjs/Queue/api/filterOutputIO.cjs.map +1 -1
- package/_cjs/Ref/Derived.cjs +4 -4
- package/_cjs/Ref/Derived.cjs.map +1 -1
- package/_cjs/Ref/DerivedAll.cjs +5 -5
- package/_cjs/Ref/DerivedAll.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/api.cjs +3 -3
- package/_cjs/Ref/Synchronized/api.cjs.map +1 -1
- package/_cjs/Ref/api/collect.cjs +1 -1
- package/_cjs/Ref/api/collect.cjs.map +1 -1
- package/_cjs/Ref/api/dimap.cjs +3 -3
- package/_cjs/Ref/api/dimap.cjs.map +1 -1
- package/_cjs/Ref/api/filter.cjs +2 -2
- package/_cjs/Ref/api/filter.cjs.map +1 -1
- package/_cjs/Ref/api.cjs +2 -3
- package/_cjs/Ref/api.cjs.map +1 -1
- package/_cjs/RefSubject/Atomic.cjs +6 -6
- package/_cjs/RefSubject/Atomic.cjs.map +1 -1
- package/_cjs/STM/api.cjs +5 -5
- package/_cjs/STM/api.cjs.map +1 -1
- package/_cjs/STM/definition.cjs +1 -1
- package/_cjs/STM/definition.cjs.map +1 -1
- package/_cjs/STM/internal/CommitState.cjs +5 -4
- package/_cjs/STM/internal/CommitState.cjs.map +1 -1
- package/_cjs/STM/internal/Journal.cjs +8 -8
- package/_cjs/STM/internal/Journal.cjs.map +1 -1
- package/_cjs/Schedule/api/driver.cjs +3 -3
- package/_cjs/Schedule/api/driver.cjs.map +1 -1
- package/_cjs/Schedule/api.cjs +8 -8
- package/_cjs/Schedule/api.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs +1 -1
- package/_cjs/Scope/ReleaseMap/api/releaseAll.cjs.map +1 -1
- package/_cjs/Scope/ReleaseMap/api.cjs +3 -3
- package/_cjs/Scope/ReleaseMap/api.cjs.map +1 -1
- package/_cjs/ScopedRef/api.cjs +1 -1
- package/_cjs/ScopedRef/api.cjs.map +1 -1
- package/_cjs/Semaphore.cjs +2 -2
- package/_cjs/Semaphore.cjs.map +1 -1
- package/_cjs/Sink/api.cjs +6 -6
- package/_cjs/Sink/api.cjs.map +1 -1
- package/_cjs/Stream/api/zipAllWith.cjs +8 -8
- package/_cjs/Stream/api/zipAllWith.cjs.map +1 -1
- package/_cjs/Stream/api/zipWithChunks.cjs +6 -6
- package/_cjs/Stream/api/zipWithChunks.cjs.map +1 -1
- package/_cjs/Stream/api.cjs +415 -133
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/Stream/internal/Handoff.cjs +2 -2
- package/_cjs/Stream/internal/Handoff.cjs.map +1 -1
- package/_cjs/Stream/internal/Pull.cjs +2 -2
- package/_cjs/Stream/internal/Pull.cjs.map +1 -1
- package/_cjs/Stream/internal/Take.cjs +6 -6
- package/_cjs/Stream/internal/Take.cjs.map +1 -1
- package/_cjs/Stream/internal/util.cjs +3 -2
- package/_cjs/Stream/internal/util.cjs.map +1 -1
- package/_cjs/TFuture/api.cjs +3 -3
- package/_cjs/TFuture/api.cjs.map +1 -1
- package/_cjs/TFuture/constructors.cjs +1 -1
- package/_cjs/TFuture/constructors.cjs.map +1 -1
- package/_cjs/TRef/definition.cjs +9 -9
- package/_cjs/TRef/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/findIO.cjs +3 -3
- package/_cjs/collection/immutable/Conc/findIO.cjs.map +1 -1
- package/_cjs/data/Exit/foreachIO.cjs +1 -1
- package/_cjs/data/Exit/foreachIO.cjs.map +1 -1
- package/_mjs/Cached/definition.mjs.map +1 -1
- package/_mjs/Channel/api/mapOutConcurrentIO.mjs +1 -1
- package/_mjs/Channel/api/mapOutConcurrentIO.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +3 -3
- package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
- package/_mjs/Channel/api/mergeWith.mjs +4 -4
- package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
- package/_mjs/Channel/api/runScoped.mjs +19 -3
- package/_mjs/Channel/api/runScoped.mjs.map +1 -1
- package/_mjs/Channel/api/toPull.mjs +3 -3
- package/_mjs/Channel/api/toPull.mjs.map +1 -1
- package/_mjs/Channel/api.mjs +8 -7
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Channel/internal/ChannelExecutor.mjs +71 -62
- package/_mjs/Channel/internal/ChannelExecutor.mjs.map +1 -1
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs +3 -3
- package/_mjs/Channel/internal/SingleProducerAsyncInput.mjs.map +1 -1
- package/_mjs/Clock/live.mjs +1 -1
- package/_mjs/Clock/live.mjs.map +1 -1
- package/_mjs/Fiber/FiberMessage.mjs +5 -5
- package/_mjs/Fiber/FiberMessage.mjs.map +1 -1
- package/_mjs/Fiber/FiberRuntime.mjs +102 -70
- package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
- package/_mjs/Fiber/api/collectAll.mjs +1 -1
- package/_mjs/Fiber/api/collectAll.mjs.map +1 -1
- package/_mjs/Fiber/api/mapIO.mjs +1 -1
- package/_mjs/Fiber/api/mapIO.mjs.map +1 -1
- package/_mjs/Fiber/api/zipWith.mjs +1 -1
- package/_mjs/Fiber/api/zipWith.mjs.map +1 -1
- package/_mjs/Fiber/constructors.mjs +5 -5
- package/_mjs/Fiber/constructors.mjs.map +1 -1
- package/_mjs/FiberRef/unsafe.mjs +3 -2
- package/_mjs/FiberRef/unsafe.mjs.map +1 -1
- package/_mjs/FiberScope/definition.mjs +2 -2
- package/_mjs/FiberScope/definition.mjs.map +1 -1
- package/_mjs/Future/api.mjs +4 -4
- package/_mjs/Future/api.mjs.map +1 -1
- package/_mjs/Hub/api.mjs.map +1 -1
- package/_mjs/Hub/internal.mjs +1 -1
- package/_mjs/Hub/internal.mjs.map +1 -1
- package/_mjs/IO/api/asyncIO.mjs +1 -1
- package/_mjs/IO/api/asyncIO.mjs.map +1 -1
- package/_mjs/IO/api/asyncInterrupt.mjs +2 -2
- package/_mjs/IO/api/asyncInterrupt.mjs.map +1 -1
- package/_mjs/IO/api/concurrency.mjs +3 -3
- package/_mjs/IO/api/concurrency.mjs.map +1 -1
- package/_mjs/IO/api/daemonChildren.mjs +1 -1
- package/_mjs/IO/api/daemonChildren.mjs.map +1 -1
- package/_mjs/IO/api/fork.mjs +2 -1
- package/_mjs/IO/api/fork.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +2 -2
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/provideSomeLayer.mjs.map +1 -1
- package/_mjs/IO/api/raceWith.mjs +9 -12
- package/_mjs/IO/api/raceWith.mjs.map +1 -1
- package/_mjs/IO/api/repeat.mjs +2 -2
- package/_mjs/IO/api/repeat.mjs.map +1 -1
- package/_mjs/IO/api/stateful.mjs +3 -3
- package/_mjs/IO/api/stateful.mjs.map +1 -1
- package/_mjs/IO/api/timeout.mjs +1 -1
- package/_mjs/IO/api/timeout.mjs.map +1 -1
- package/_mjs/IO/api/transplant.mjs +1 -1
- package/_mjs/IO/api/transplant.mjs.map +1 -1
- package/_mjs/IO/api/withChildren.mjs +5 -4
- package/_mjs/IO/api/withChildren.mjs.map +1 -1
- package/_mjs/IO/api/withEarlyRelease.mjs +1 -1
- package/_mjs/IO/api/withEarlyRelease.mjs.map +1 -1
- package/_mjs/IO/api/zipConcurrent.mjs +23 -23
- package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
- package/_mjs/IO/api.mjs +32 -30
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO/definition.mjs +16 -27
- package/_mjs/IO/definition.mjs.map +1 -1
- package/_mjs/IO/runtime.mjs +43 -34
- package/_mjs/IO/runtime.mjs.map +1 -1
- package/_mjs/Logger/api.mjs +3 -2
- package/_mjs/Logger/api.mjs.map +1 -1
- package/_mjs/MVar/api.mjs +11 -11
- package/_mjs/MVar/api.mjs.map +1 -1
- package/_mjs/Push/api.mjs +3 -3
- package/_mjs/Push/api.mjs.map +1 -1
- package/_mjs/Push/internal.mjs +1 -1
- package/_mjs/Push/internal.mjs.map +1 -1
- package/_mjs/Queue/api/filterInputIO.mjs +2 -2
- package/_mjs/Queue/api/filterInputIO.mjs.map +1 -1
- package/_mjs/Queue/api/filterOutputIO.mjs.map +1 -1
- package/_mjs/Ref/Derived.mjs +4 -4
- package/_mjs/Ref/Derived.mjs.map +1 -1
- package/_mjs/Ref/DerivedAll.mjs +5 -5
- package/_mjs/Ref/DerivedAll.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/api.mjs +3 -3
- package/_mjs/Ref/Synchronized/api.mjs.map +1 -1
- package/_mjs/Ref/api/collect.mjs +1 -1
- package/_mjs/Ref/api/collect.mjs.map +1 -1
- package/_mjs/Ref/api/dimap.mjs +3 -3
- package/_mjs/Ref/api/dimap.mjs.map +1 -1
- package/_mjs/Ref/api/filter.mjs +2 -2
- package/_mjs/Ref/api/filter.mjs.map +1 -1
- package/_mjs/Ref/api.mjs +2 -1
- package/_mjs/Ref/api.mjs.map +1 -1
- package/_mjs/RefSubject/Atomic.mjs +6 -6
- package/_mjs/RefSubject/Atomic.mjs.map +1 -1
- package/_mjs/STM/api.mjs +5 -5
- package/_mjs/STM/api.mjs.map +1 -1
- package/_mjs/STM/definition.mjs +1 -1
- package/_mjs/STM/definition.mjs.map +1 -1
- package/_mjs/STM/internal/CommitState.mjs +5 -4
- package/_mjs/STM/internal/CommitState.mjs.map +1 -1
- package/_mjs/STM/internal/Journal.mjs +8 -8
- package/_mjs/STM/internal/Journal.mjs.map +1 -1
- package/_mjs/Schedule/api/driver.mjs +3 -3
- package/_mjs/Schedule/api/driver.mjs.map +1 -1
- package/_mjs/Schedule/api.mjs +8 -8
- package/_mjs/Schedule/api.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/api/releaseAll.mjs +1 -1
- package/_mjs/Scope/ReleaseMap/api/releaseAll.mjs.map +1 -1
- package/_mjs/Scope/ReleaseMap/api.mjs +3 -3
- package/_mjs/Scope/ReleaseMap/api.mjs.map +1 -1
- package/_mjs/ScopedRef/api.mjs +1 -1
- package/_mjs/ScopedRef/api.mjs.map +1 -1
- package/_mjs/Semaphore.mjs +2 -2
- package/_mjs/Semaphore.mjs.map +1 -1
- package/_mjs/Sink/api.mjs +6 -6
- package/_mjs/Sink/api.mjs.map +1 -1
- package/_mjs/Stream/api/zipAllWith.mjs +8 -8
- package/_mjs/Stream/api/zipAllWith.mjs.map +1 -1
- package/_mjs/Stream/api/zipWithChunks.mjs +6 -6
- package/_mjs/Stream/api/zipWithChunks.mjs.map +1 -1
- package/_mjs/Stream/api.mjs +321 -60
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/Stream/internal/Handoff.mjs +2 -2
- package/_mjs/Stream/internal/Handoff.mjs.map +1 -1
- package/_mjs/Stream/internal/Pull.mjs +2 -2
- package/_mjs/Stream/internal/Pull.mjs.map +1 -1
- package/_mjs/Stream/internal/Take.mjs +6 -6
- package/_mjs/Stream/internal/Take.mjs.map +1 -1
- package/_mjs/Stream/internal/util.mjs +3 -2
- package/_mjs/Stream/internal/util.mjs.map +1 -1
- package/_mjs/TFuture/api.mjs +3 -3
- package/_mjs/TFuture/api.mjs.map +1 -1
- package/_mjs/TFuture/constructors.mjs +1 -1
- package/_mjs/TFuture/constructors.mjs.map +1 -1
- package/_mjs/TRef/definition.mjs +9 -9
- package/_mjs/TRef/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/findIO.mjs +3 -3
- package/_mjs/collection/immutable/Conc/findIO.mjs.map +1 -1
- package/_mjs/data/Exit/foreachIO.mjs +1 -1
- package/_mjs/data/Exit/foreachIO.mjs.map +1 -1
- package/_src/Cached/definition.ts +1 -1
- package/_src/Channel/api/runScoped.ts +30 -5
- package/_src/Channel/api/toPull.ts +1 -1
- package/_src/Channel/api.ts +1 -0
- package/_src/Channel/internal/ChannelExecutor.ts +24 -20
- package/_src/Fiber/FiberMessage.ts +5 -5
- package/_src/Fiber/FiberRuntime.ts +40 -17
- package/_src/FiberRefs/api.ts +1 -1
- package/_src/Hub/api.ts +1 -1
- package/_src/IO/api/asyncIO.ts +1 -1
- package/_src/IO/api/provideSomeLayer.ts +1 -3
- package/_src/IO/api/raceWith.ts +1 -3
- package/_src/IO/api/stateful.ts +1 -1
- package/_src/IO/api/zipConcurrent.ts +26 -30
- package/_src/IO/api.ts +4 -3
- package/_src/IO/definition.ts +35 -28
- package/_src/IO/runtime.ts +39 -38
- package/_src/Queue/api/filterInputIO.ts +1 -1
- package/_src/Queue/api/filterOutputIO.ts +1 -1
- package/_src/RefSubject/Atomic.ts +4 -4
- package/_src/STM/definition.ts +1 -1
- package/_src/State/definition.ts +1 -1
- package/_src/Stream/api.ts +315 -14
- package/_src/Subject/Atomic.ts +1 -1
- package/_src/global.ts +0 -4
- package/_src/index.ts +2 -2
- package/global.d.ts +0 -4
- package/index.d.ts +2 -2
- package/package.json +3 -3
- package/RuntimeConfig.d.ts +0 -11
- package/_cjs/RuntimeConfig.cjs +0 -12
- package/_cjs/RuntimeConfig.cjs.map +0 -1
- package/_mjs/RuntimeConfig.mjs +0 -3
- package/_mjs/RuntimeConfig.mjs.map +0 -1
- package/_src/RuntimeConfig.ts +0 -6
package/_src/Stream/api.ts
CHANGED
|
@@ -247,7 +247,11 @@ export function asyncInterrupt<R, E, A>(
|
|
|
247
247
|
IO.succeed(() =>
|
|
248
248
|
register((k, cb) => {
|
|
249
249
|
const effect = Take.fromPull(k).flatMap((a) => output.offer(a));
|
|
250
|
-
|
|
250
|
+
const fiber = runtime.makeFiber(effect);
|
|
251
|
+
if (cb) {
|
|
252
|
+
fiber.addObserver(cb);
|
|
253
|
+
}
|
|
254
|
+
fiber.start(effect);
|
|
251
255
|
}),
|
|
252
256
|
),
|
|
253
257
|
);
|
|
@@ -317,12 +321,14 @@ export function asyncIO<R, E, A, R1 = R, E1 = E>(
|
|
|
317
321
|
const output = Δ(IO.acquireRelease(Queue.makeBounded<Take<E, A>>(outputBuffer), (_) => _.shutdown));
|
|
318
322
|
const runtime = Δ(IO.runtime<R>());
|
|
319
323
|
Δ(
|
|
320
|
-
register((k, cb) =>
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
register((k, cb) => {
|
|
325
|
+
const io = Take.fromPull(k).flatMap((a) => output.offer(a));
|
|
326
|
+
const fiber = runtime.makeFiber(io);
|
|
327
|
+
if (cb) {
|
|
328
|
+
fiber.addObserver(cb);
|
|
329
|
+
}
|
|
330
|
+
fiber.start(io);
|
|
331
|
+
}),
|
|
326
332
|
);
|
|
327
333
|
const loop: Channel<never, unknown, unknown, unknown, E, Conc<A>, void> = Channel.unwrap(
|
|
328
334
|
output.take
|
|
@@ -812,9 +818,10 @@ function combineChunksProducer<Err, Elem>(
|
|
|
812
818
|
): Channel<never, Err, Conc<Elem>, unknown, never, never, any> {
|
|
813
819
|
return Channel.fromIO(latch.take).zipRight(
|
|
814
820
|
Channel.readWithCause(
|
|
815
|
-
(chunk) =>
|
|
821
|
+
(chunk: Conc<Elem>) =>
|
|
822
|
+
Channel.fromIO(handoff.offer(Take.chunk(chunk))).zipRight(combineChunksProducer(handoff, latch)),
|
|
816
823
|
(cause) => Channel.fromIO(handoff.offer(Take.failCause(cause))),
|
|
817
|
-
() => Channel.fromIO(handoff.offer(Take.end))
|
|
824
|
+
() => Channel.fromIO(handoff.offer(Take.end)),
|
|
818
825
|
),
|
|
819
826
|
);
|
|
820
827
|
}
|
|
@@ -991,6 +998,13 @@ export function debounce(duration: Lazy<Duration>, __tsplusTrace?: string) {
|
|
|
991
998
|
};
|
|
992
999
|
}
|
|
993
1000
|
|
|
1001
|
+
/**
|
|
1002
|
+
* @tsplus static fncts.io.StreamOps defer
|
|
1003
|
+
*/
|
|
1004
|
+
export function defer<R, E, A>(self: Lazy<Stream<R, E, A>>): Stream<R, E, A> {
|
|
1005
|
+
return new Stream(Channel.defer(self().channel));
|
|
1006
|
+
}
|
|
1007
|
+
|
|
994
1008
|
function defaultIfEmptyWriter<R, E, A, R1, E1, B>(
|
|
995
1009
|
fb: Stream<R1, E1, B>,
|
|
996
1010
|
__tsplusTrace?: string,
|
|
@@ -1149,7 +1163,7 @@ export function distributedWithDynamic<E, A>(
|
|
|
1149
1163
|
*
|
|
1150
1164
|
* @tsplus getter fncts.io.Stream drain
|
|
1151
1165
|
*/
|
|
1152
|
-
export function drain<R, E, A>(fa: Stream<R, E, A>, __tsplusTrace?: string): Stream<R, E,
|
|
1166
|
+
export function drain<R, E, A>(fa: Stream<R, E, A>, __tsplusTrace?: string): Stream<R, E, never> {
|
|
1153
1167
|
return new Stream(fa.channel.drain);
|
|
1154
1168
|
}
|
|
1155
1169
|
|
|
@@ -1304,6 +1318,15 @@ export function environmentWithStream<R0, R, E, A>(
|
|
|
1304
1318
|
return Stream.environment<R0>().flatMap(f);
|
|
1305
1319
|
}
|
|
1306
1320
|
|
|
1321
|
+
/**
|
|
1322
|
+
* Creates a stream that executes the specified effect but emits no elements.
|
|
1323
|
+
*
|
|
1324
|
+
* @tsplus static fncts.io.StreamOps execute
|
|
1325
|
+
*/
|
|
1326
|
+
export function execute<R, E>(io: IO<R, E, any>, __tsplusTrace?: string): Stream<R, E, never> {
|
|
1327
|
+
return Stream.fromIO(io).drain;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1307
1330
|
/**
|
|
1308
1331
|
* Halt a stream with the specified error
|
|
1309
1332
|
*
|
|
@@ -1576,6 +1599,65 @@ export function scoped<R, E, A>(stream: Lazy<IO<R, E, A>>, __tsplusTrace?: strin
|
|
|
1576
1599
|
return new Stream(Channel.scoped(stream().map(Conc.single)));
|
|
1577
1600
|
}
|
|
1578
1601
|
|
|
1602
|
+
/**
|
|
1603
|
+
* Emits a sliding window of n elements.
|
|
1604
|
+
*
|
|
1605
|
+
* @tsplus pipeable fncts.io.Stream sliding
|
|
1606
|
+
*/
|
|
1607
|
+
export function sliding(chunkSize: number, stepSize: number, __tsplusTrace?: string) {
|
|
1608
|
+
return <R, E, A>(self: Stream<R, E, A>): Stream<R, E, Conc<A>> => {
|
|
1609
|
+
return Stream.defer(() => {
|
|
1610
|
+
function slidingChunk(chunk: Conc<A>, input: Conc<A>): [Conc<A>, Conc<Conc<A>>] {
|
|
1611
|
+
const updatedChunk = chunk.concat(input);
|
|
1612
|
+
const length = updatedChunk.length;
|
|
1613
|
+
if (length >= chunkSize) {
|
|
1614
|
+
const array = new Array<Conc<A>>((length - chunkSize) / stepSize + 1);
|
|
1615
|
+
let arrayIndex = 0;
|
|
1616
|
+
let chunkIndex = 0;
|
|
1617
|
+
while (chunkIndex + chunkSize <= length) {
|
|
1618
|
+
array[arrayIndex] = updatedChunk.slice(chunkIndex, chunkIndex + chunkSize);
|
|
1619
|
+
arrayIndex += 1;
|
|
1620
|
+
chunkIndex += stepSize;
|
|
1621
|
+
}
|
|
1622
|
+
return [updatedChunk.drop(chunkIndex), Conc.fromArray(array)];
|
|
1623
|
+
} else {
|
|
1624
|
+
return [updatedChunk, Conc.empty()];
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
function sliding(chunk: Conc<A>, written: boolean): Channel<never, E, Conc<A>, any, E, Conc<Conc<A>>, any> {
|
|
1628
|
+
return Channel.readWithCause(
|
|
1629
|
+
(input) => {
|
|
1630
|
+
const [updatedChunk, out] = slidingChunk(chunk, input);
|
|
1631
|
+
if (out.isEmpty) {
|
|
1632
|
+
return sliding(updatedChunk, written);
|
|
1633
|
+
} else {
|
|
1634
|
+
return Channel.writeNow(out) > sliding(updatedChunk, true);
|
|
1635
|
+
}
|
|
1636
|
+
},
|
|
1637
|
+
(err) => {
|
|
1638
|
+
const index = written && chunkSize > stepSize ? chunkSize - stepSize : 0;
|
|
1639
|
+
if (index >= chunk.length) {
|
|
1640
|
+
return Channel.failCauseNow(err);
|
|
1641
|
+
} else {
|
|
1642
|
+
return Channel.writeNow(Conc.single(chunk)) > Channel.failCauseNow(err);
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
(done) => {
|
|
1646
|
+
const index = written && chunkSize > stepSize ? chunkSize - stepSize : 0;
|
|
1647
|
+
if (index >= chunk.length) {
|
|
1648
|
+
return Channel.succeedNow(done);
|
|
1649
|
+
} else {
|
|
1650
|
+
return Channel.writeNow(Conc.single(chunk)) > Channel.succeedNow(done);
|
|
1651
|
+
}
|
|
1652
|
+
},
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
return new Stream(self.channel >>> sliding(Conc.empty(), false));
|
|
1657
|
+
});
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1579
1661
|
/**
|
|
1580
1662
|
* Creates a stream from an effect producing a value of type `A`
|
|
1581
1663
|
*
|
|
@@ -2189,14 +2271,105 @@ function mapIOLoop<R, E, A, R1, E1, B>(
|
|
|
2189
2271
|
*
|
|
2190
2272
|
* @note This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
|
|
2191
2273
|
*
|
|
2192
|
-
* @tsplus pipeable fncts.io.Stream
|
|
2274
|
+
* @tsplus pipeable fncts.io.Stream mapIOConcurrently
|
|
2193
2275
|
*/
|
|
2194
|
-
export function
|
|
2276
|
+
export function mapIOConcurrently<A, R1, E1, B>(n: number, f: (a: A) => IO<R1, E1, B>, __tsplusTrace?: string) {
|
|
2195
2277
|
return <R, E>(stream: Stream<R, E, A>): Stream<R | R1, E | E1, B> => {
|
|
2196
2278
|
return new Stream(stream.channel.concatMap(Channel.writeChunk).mapOutConcurrentIO(n, f).mapOut(Conc.single));
|
|
2197
2279
|
};
|
|
2198
2280
|
}
|
|
2199
2281
|
|
|
2282
|
+
/**
|
|
2283
|
+
* @tsplus pipeable fncts.io.Stream mapIOConcurrentlyUnordered
|
|
2284
|
+
*/
|
|
2285
|
+
export function mapIOConcurrentlyUnordered<A, R1, E1, B>(n: number, f: (a: A) => IO<R1, E1, B>) {
|
|
2286
|
+
return <R, E>(self: Stream<R, E, A>): Stream<R | R1, E | E1, B> => {
|
|
2287
|
+
return self.pipeThroughChannelOrFail(
|
|
2288
|
+
Channel.id<never, Conc<A>, any>()
|
|
2289
|
+
.concatMap((chunk) => Channel.writeChunk(chunk))
|
|
2290
|
+
.mergeMap((inp) => Stream.fromIO(f(inp)).channel, n, 16),
|
|
2291
|
+
);
|
|
2292
|
+
};
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
/**
|
|
2296
|
+
* Merges this stream and the specified stream together.
|
|
2297
|
+
*
|
|
2298
|
+
* New produced stream will terminate when both specified stream terminate if
|
|
2299
|
+
* no termination strategy is specified.
|
|
2300
|
+
*
|
|
2301
|
+
* @tsplus pipeable fncts.io.Stream merge
|
|
2302
|
+
*/
|
|
2303
|
+
export function merge<R1, E1, B>(
|
|
2304
|
+
that: Stream<R1, E1, B>,
|
|
2305
|
+
strategy: TerminationStrategy = "Both",
|
|
2306
|
+
__tsplusTrace?: string,
|
|
2307
|
+
) {
|
|
2308
|
+
return <R, E, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A | B> => {
|
|
2309
|
+
return self.mergeWith(that, identity, identity, strategy);
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
/**
|
|
2314
|
+
* Merges this stream and the specified stream together. New produced stream
|
|
2315
|
+
* will terminate when either stream terminates.
|
|
2316
|
+
*
|
|
2317
|
+
* @tsplus pipeable fncts.io.Stream mergeHaltEither
|
|
2318
|
+
*/
|
|
2319
|
+
export function mergeHaltEither<R1, E1, B>(that: Stream<R1, E1, B>, __tsplusTrace?: string) {
|
|
2320
|
+
return <R, E, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A | B> => {
|
|
2321
|
+
return self.merge(that, "Either");
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* Merges this stream and the specified stream together. New produced stream
|
|
2327
|
+
* will terminate when this stream terminates.
|
|
2328
|
+
*
|
|
2329
|
+
* @tsplus pipeable fncts.io.Stream mergeHaltLeft
|
|
2330
|
+
*/
|
|
2331
|
+
export function mergeHaltLeft<R1, E1, B>(that: Stream<R1, E1, B>, __tsplusTrace?: string) {
|
|
2332
|
+
return <R, E, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A | B> => {
|
|
2333
|
+
return self.merge(that, "Left");
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
/**
|
|
2338
|
+
* Merges this stream and the specified stream together. New produced stream
|
|
2339
|
+
* will terminate when the specified stream terminates.
|
|
2340
|
+
*
|
|
2341
|
+
* @tsplus pipeable fncts.io.Stream mergeHaltRight
|
|
2342
|
+
*/
|
|
2343
|
+
export function mergeHaltRight<R1, E1, B>(that: Stream<R1, E1, B>, __tsplusTrace?: string) {
|
|
2344
|
+
return <R, E, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A | B> => {
|
|
2345
|
+
return self.merge(that, "Right");
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
/**
|
|
2350
|
+
* Merges this stream and the specified stream together, discarding the values
|
|
2351
|
+
* from the right stream.
|
|
2352
|
+
*
|
|
2353
|
+
* @tsplus pipeable fncts.io.Stream mergeLeft
|
|
2354
|
+
*/
|
|
2355
|
+
export function mergeLeft<R1, E1, B>(that: Stream<R1, E1, B>, __tsplusTrace?: string) {
|
|
2356
|
+
return <R, E, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A> => {
|
|
2357
|
+
return self.merge(that.drain);
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Merges this stream and the specified stream together, discarding the values
|
|
2363
|
+
* from the left stream.
|
|
2364
|
+
*
|
|
2365
|
+
* @tsplus pipeable fncts.io.Stream mergeRight
|
|
2366
|
+
*/
|
|
2367
|
+
export function mergeRight<R1, E1, B>(that: Stream<R1, E1, B>, __tsplusTrace?: string) {
|
|
2368
|
+
return <R, E, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, B> => {
|
|
2369
|
+
return self.drain.merge(that);
|
|
2370
|
+
};
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2200
2373
|
/**
|
|
2201
2374
|
* Maps each element of this stream to another stream and returns the
|
|
2202
2375
|
* non-deterministic merge of those streams, executing up to `n` inner streams
|
|
@@ -2243,7 +2416,7 @@ export function mergeEither<R1, E1, B>(fb: Stream<R1, E1, B>, __tsplusTrace?: st
|
|
|
2243
2416
|
};
|
|
2244
2417
|
}
|
|
2245
2418
|
|
|
2246
|
-
|
|
2419
|
+
function mergeWithHandler<R, E>(
|
|
2247
2420
|
terminate: boolean,
|
|
2248
2421
|
__tsplusTrace?: string,
|
|
2249
2422
|
): (exit: Exit<E, unknown>) => MergeDecision<R, E, unknown, E, unknown> {
|
|
@@ -2366,6 +2539,15 @@ export function pipeThrough<A, R1, E1, L, Z>(sa: Sink<R1, E1, A, L, Z>, __tsplus
|
|
|
2366
2539
|
};
|
|
2367
2540
|
}
|
|
2368
2541
|
|
|
2542
|
+
/**
|
|
2543
|
+
* @tsplus pipeable fncts.io.Stream pipeThroughChannelOrFail
|
|
2544
|
+
*/
|
|
2545
|
+
export function pipeThroughChannelOrFail<A, R1, E1, B>(channel: Channel<R1, never, Conc<A>, any, E1, Conc<B>, any>) {
|
|
2546
|
+
return <R, E>(self: Stream<R, E, A>): Stream<R | R1, E | E1, B> => {
|
|
2547
|
+
return new Stream(self.channel >>> channel);
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2369
2551
|
/**
|
|
2370
2552
|
* Provides the stream with its required environment, which eliminates
|
|
2371
2553
|
* its dependency on `R`.
|
|
@@ -2603,6 +2785,27 @@ export function runIntoQueueScoped<RA, RB, EA, EB, E1, A, B>(
|
|
|
2603
2785
|
};
|
|
2604
2786
|
}
|
|
2605
2787
|
|
|
2788
|
+
/**
|
|
2789
|
+
* Like runIntoQueue, but provides the result as a scoped IO
|
|
2790
|
+
* to allow for scope composition.
|
|
2791
|
+
*
|
|
2792
|
+
* @tsplus pipeable fncts.io.Stream runIntoQueueElementsScoped
|
|
2793
|
+
*/
|
|
2794
|
+
export function runIntoQueueElementsScoped<E, A>(queue: Lazy<Queue.Enqueue<Exit<Maybe<E>, A>>>) {
|
|
2795
|
+
return <R>(self: Stream<R, E, A>): IO<R | Scope, never, void> => {
|
|
2796
|
+
return IO.defer(() => {
|
|
2797
|
+
const queue0 = queue();
|
|
2798
|
+
const writer: Channel<R, E, Conc<A>, any, never, Exit<Maybe<E>, A>, any> = Channel.readWithCause(
|
|
2799
|
+
(inp: Conc<A>) => Channel.fromIO(queue0.offerAll(inp.map((a) => Exit.succeed(a)))) > writer,
|
|
2800
|
+
(cause) => Channel.fromIO(queue0.offer(Exit.failCause(cause.map((e) => Just(e))))),
|
|
2801
|
+
() => Channel.fromIO(queue0.offer(Exit.fail(Nothing()))),
|
|
2802
|
+
);
|
|
2803
|
+
|
|
2804
|
+
return (self.channel >>> writer).drain.runScoped.asUnit;
|
|
2805
|
+
});
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2606
2809
|
/**
|
|
2607
2810
|
* Like `Stream#runIntoHub`, but provides the result as a `Managed` to allow for scope
|
|
2608
2811
|
* composition.
|
|
@@ -2682,6 +2885,40 @@ export function scanReduceIO<A extends B, R1, E1, B>(f: (b: B, a: A) => IO<R1, E
|
|
|
2682
2885
|
};
|
|
2683
2886
|
}
|
|
2684
2887
|
|
|
2888
|
+
/**
|
|
2889
|
+
* @tsplus pipeable fncts.io.Stream split
|
|
2890
|
+
*/
|
|
2891
|
+
export function split<A>(predicate: Predicate<A>, __tsplusTrace?: string) {
|
|
2892
|
+
return <R, E>(self: Stream<R, E, A>): Stream<R, E, Conc<A>> => {
|
|
2893
|
+
function split(leftovers: Conc<A>, input: Conc<A>): Channel<R, E, Conc<A>, any, E, Conc<Conc<A>>, any> {
|
|
2894
|
+
const [chunk, remaining] = leftovers.concat(input).splitWhere(predicate);
|
|
2895
|
+
if (chunk.isEmpty || remaining.isEmpty) {
|
|
2896
|
+
return loop(chunk.concat(remaining.drop(1)));
|
|
2897
|
+
} else {
|
|
2898
|
+
return Channel.writeNow(Conc.single(chunk)) > split(Conc.empty(), remaining.drop(1));
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
function loop(leftovers: Conc<A>): Channel<R, E, Conc<A>, any, E, Conc<Conc<A>>, any> {
|
|
2903
|
+
return Channel.readWith(
|
|
2904
|
+
(input) => split(leftovers, input),
|
|
2905
|
+
Channel.failNow,
|
|
2906
|
+
(_) => {
|
|
2907
|
+
if (leftovers.isEmpty) {
|
|
2908
|
+
return Channel.unit;
|
|
2909
|
+
} else if (leftovers.find(predicate).isNothing()) {
|
|
2910
|
+
return Channel.writeNow(Conc.single(leftovers)) > Channel.unit;
|
|
2911
|
+
} else {
|
|
2912
|
+
return split(Conc.empty(), leftovers) > Channel.unit;
|
|
2913
|
+
}
|
|
2914
|
+
},
|
|
2915
|
+
);
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
return new Stream(self.channel >>> loop(Conc.empty()));
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2685
2922
|
/**
|
|
2686
2923
|
* Creates a single-valued pure stream
|
|
2687
2924
|
*
|
|
@@ -2805,6 +3042,70 @@ export function tap<A, R1, E1>(f: (a: A) => IO<R1, E1, any>, __tsplusTrace?: str
|
|
|
2805
3042
|
};
|
|
2806
3043
|
}
|
|
2807
3044
|
|
|
3045
|
+
/**
|
|
3046
|
+
* Returns a stream that effectfully "peeks" at the failure and adds an effect
|
|
3047
|
+
* to consumption of every element of the stream
|
|
3048
|
+
*
|
|
3049
|
+
* @tsplus pipeable fncts.io.Stream tapBoth
|
|
3050
|
+
*/
|
|
3051
|
+
export function tapBoth<E, A, R1, E1, R2, E2>(
|
|
3052
|
+
f: (e: E) => IO<R1, E1, any>,
|
|
3053
|
+
g: (a: A) => IO<R2, E2, any>,
|
|
3054
|
+
__tsplusTrace?: string,
|
|
3055
|
+
) {
|
|
3056
|
+
return <R>(self: Stream<R, E, A>): Stream<R | R1 | R2, E | E1 | E2, A> => {
|
|
3057
|
+
return self.tapError(f).tap(g);
|
|
3058
|
+
};
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
/**
|
|
3062
|
+
* Returns a stream that effectfully "peeks" at the failure of the stream.
|
|
3063
|
+
*
|
|
3064
|
+
* @tsplus pipeable fncts.io.Stream tapError
|
|
3065
|
+
*/
|
|
3066
|
+
export function tapError<E, R1, E1>(f: (e: E) => IO<R1, E1, any>, __tsplusTrace?: string) {
|
|
3067
|
+
return <R, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A> => {
|
|
3068
|
+
return self.catchAll((e) => Stream.fromIO(f(e)));
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
/**
|
|
3073
|
+
* Returns a stream that effectfully "peeks" at the cause of failure of the
|
|
3074
|
+
* stream.
|
|
3075
|
+
*
|
|
3076
|
+
* @tsplus pipeable fncts.io.Stream tapErrorCause
|
|
3077
|
+
*/
|
|
3078
|
+
export function tapErrorCause<E, R1, E1>(f: (cause: Cause<E>) => IO<R1, E1, any>, __tsplusTrace?: string) {
|
|
3079
|
+
return <R, A>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A> => {
|
|
3080
|
+
return self.catchAllCause((e) => Stream.fromIO(f(e) > IO.refailCause(e)));
|
|
3081
|
+
};
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
/**
|
|
3085
|
+
* Sends all elements emitted by this stream to the specified sink in addition
|
|
3086
|
+
* to emitting them.
|
|
3087
|
+
*
|
|
3088
|
+
* @tsplus pipeable fncts.io.Stream tapSink
|
|
3089
|
+
*/
|
|
3090
|
+
export function tapSink<A, R1, E1>(sink: Sink<R1, E1, A, any, any>, __tsplusTrace?: string) {
|
|
3091
|
+
return <R, E>(self: Stream<R, E, A>): Stream<R | R1, E | E1, A> => {
|
|
3092
|
+
return Stream.fromIO(Queue.makeBounded<Take<E | E1, A>>(1).zip(Future.make<never, void>())).flatMap(
|
|
3093
|
+
([queue, future]) => {
|
|
3094
|
+
const right = Stream.fromQueue(queue, 1).flattenTake;
|
|
3095
|
+
const loop: Channel<R | R1, E, Conc<A>, any, E1, Conc<A>, any> = Channel.readWithCause(
|
|
3096
|
+
(chunk: Conc<A>) => Channel.fromIO(queue.offer(Take.chunk(chunk))) > Channel.writeNow(chunk) > loop,
|
|
3097
|
+
(cause: Cause<E>) => Channel.fromIO(queue.offer(Take.failCause(cause))),
|
|
3098
|
+
() => Channel.fromIO(queue.offer(Take.end)),
|
|
3099
|
+
);
|
|
3100
|
+
return new Stream((self.channel >>> loop).ensuring(queue.offer(Take.end).forkDaemon > future.await)).merge(
|
|
3101
|
+
Stream.execute(right.run(sink).ensuring(future.succeed(undefined))),
|
|
3102
|
+
"Both",
|
|
3103
|
+
);
|
|
3104
|
+
},
|
|
3105
|
+
);
|
|
3106
|
+
};
|
|
3107
|
+
}
|
|
3108
|
+
|
|
2808
3109
|
/**
|
|
2809
3110
|
* Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket
|
|
2810
3111
|
* algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate
|
|
@@ -2947,7 +3248,7 @@ export function toQueueOfElements(capacity = 2, __tsplusTrace?: string) {
|
|
|
2947
3248
|
return <R, E, A>(stream: Stream<R, E, A>): IO<R | Scope, never, Queue.Dequeue<Exit<Maybe<E>, A>>> => {
|
|
2948
3249
|
return Do((Δ) => {
|
|
2949
3250
|
const queue = Δ(IO.acquireRelease(Queue.makeBounded<Exit<Maybe<E>, A>>(capacity), (_) => _.shutdown));
|
|
2950
|
-
Δ(stream.
|
|
3251
|
+
Δ(stream.runIntoQueueElementsScoped(queue).forkScoped);
|
|
2951
3252
|
return queue;
|
|
2952
3253
|
});
|
|
2953
3254
|
};
|
package/_src/Subject/Atomic.ts
CHANGED
package/_src/global.ts
CHANGED
|
@@ -99,10 +99,6 @@ import { Random } from "@fncts/io/Random/definition";
|
|
|
99
99
|
* @tsplus global
|
|
100
100
|
*/
|
|
101
101
|
import { PRef, Ref } from "@fncts/io/Ref/definition";
|
|
102
|
-
/**
|
|
103
|
-
* @tsplus global
|
|
104
|
-
*/
|
|
105
|
-
import { RuntimeConfig } from "@fncts/io/RuntimeConfig";
|
|
106
102
|
/**
|
|
107
103
|
* @tsplus global
|
|
108
104
|
*/
|
package/_src/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ export type {} from "./Channel.js";
|
|
|
5
5
|
export type {} from "./Clock.js";
|
|
6
6
|
export type {} from "./Console.js";
|
|
7
7
|
export type {} from "./CountdownLatch.js";
|
|
8
|
-
export type {} from "./demo.js";
|
|
9
8
|
export type {} from "./Fiber.js";
|
|
10
9
|
export type {} from "./FiberDescriptor.js";
|
|
11
10
|
export type {} from "./FiberRef.js";
|
|
@@ -22,18 +21,19 @@ export type {} from "./Layer.js";
|
|
|
22
21
|
export type {} from "./Logger.js";
|
|
23
22
|
export type {} from "./LogLevel.js";
|
|
24
23
|
export type {} from "./LogSpan.js";
|
|
24
|
+
export type {} from "./MVar.js";
|
|
25
25
|
export type {} from "./Push.js";
|
|
26
26
|
export type {} from "./Queue.js";
|
|
27
27
|
export type {} from "./Random.js";
|
|
28
28
|
export type {} from "./Ref.js";
|
|
29
29
|
export type {} from "./RefSubject.js";
|
|
30
30
|
export type {} from "./Reloadable.js";
|
|
31
|
-
export type {} from "./RuntimeConfig.js";
|
|
32
31
|
export type {} from "./RuntimeFlag.js";
|
|
33
32
|
export type {} from "./RuntimeFlags.js";
|
|
34
33
|
export type {} from "./Schedule.js";
|
|
35
34
|
export type {} from "./Scope.js";
|
|
36
35
|
export type {} from "./ScopedRef.js";
|
|
36
|
+
export type {} from "./Semaphore.js";
|
|
37
37
|
export type {} from "./Sink.js";
|
|
38
38
|
export type {} from "./State.js";
|
|
39
39
|
export type {} from "./STM.js";
|
package/global.d.ts
CHANGED
|
@@ -98,10 +98,6 @@ import { Random } from "@fncts/io/Random/definition";
|
|
|
98
98
|
* @tsplus global
|
|
99
99
|
*/
|
|
100
100
|
import { PRef, Ref } from "@fncts/io/Ref/definition";
|
|
101
|
-
/**
|
|
102
|
-
* @tsplus global
|
|
103
|
-
*/
|
|
104
|
-
import { RuntimeConfig } from "@fncts/io/RuntimeConfig";
|
|
105
101
|
/**
|
|
106
102
|
* @tsplus global
|
|
107
103
|
*/
|
package/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export type {} from "./Channel.js";
|
|
|
4
4
|
export type {} from "./Clock.js";
|
|
5
5
|
export type {} from "./Console.js";
|
|
6
6
|
export type {} from "./CountdownLatch.js";
|
|
7
|
-
export type {} from "./demo.js";
|
|
8
7
|
export type {} from "./Fiber.js";
|
|
9
8
|
export type {} from "./FiberDescriptor.js";
|
|
10
9
|
export type {} from "./FiberRef.js";
|
|
@@ -21,18 +20,19 @@ export type {} from "./Layer.js";
|
|
|
21
20
|
export type {} from "./Logger.js";
|
|
22
21
|
export type {} from "./LogLevel.js";
|
|
23
22
|
export type {} from "./LogSpan.js";
|
|
23
|
+
export type {} from "./MVar.js";
|
|
24
24
|
export type {} from "./Push.js";
|
|
25
25
|
export type {} from "./Queue.js";
|
|
26
26
|
export type {} from "./Random.js";
|
|
27
27
|
export type {} from "./Ref.js";
|
|
28
28
|
export type {} from "./RefSubject.js";
|
|
29
29
|
export type {} from "./Reloadable.js";
|
|
30
|
-
export type {} from "./RuntimeConfig.js";
|
|
31
30
|
export type {} from "./RuntimeFlag.js";
|
|
32
31
|
export type {} from "./RuntimeFlags.js";
|
|
33
32
|
export type {} from "./Schedule.js";
|
|
34
33
|
export type {} from "./Scope.js";
|
|
35
34
|
export type {} from "./ScopedRef.js";
|
|
35
|
+
export type {} from "./Semaphore.js";
|
|
36
36
|
export type {} from "./Sink.js";
|
|
37
37
|
export type {} from "./State.js";
|
|
38
38
|
export type {} from "./STM.js";
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fncts/io",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@fncts/base": "0.0.
|
|
6
|
-
"@fncts/transformers": "0.0.
|
|
5
|
+
"@fncts/base": "0.0.28",
|
|
6
|
+
"@fncts/transformers": "0.0.5",
|
|
7
7
|
"@fncts/typelevel": "0.0.15"
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
package/RuntimeConfig.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CaseClass } from "@fncts/base/data/CaseClass";
|
|
2
|
-
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
3
|
-
import { Supervisor } from "@fncts/io/Supervisor/definition";
|
|
4
|
-
import { Logger } from "@fncts/io/Logger/definition";
|
|
5
|
-
export declare class RuntimeConfig extends CaseClass<{
|
|
6
|
-
readonly reportFailure: (e: Cause<unknown>) => void;
|
|
7
|
-
readonly supervisor: Supervisor<any>;
|
|
8
|
-
readonly yieldOpCount: number;
|
|
9
|
-
readonly logger: Logger<string, any>;
|
|
10
|
-
}> {
|
|
11
|
-
}
|
package/_cjs/RuntimeConfig.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.RuntimeConfig = void 0;
|
|
7
|
-
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/CaseClass"));
|
|
8
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
-
class RuntimeConfig extends tsplus_module_1.CaseClass {}
|
|
11
|
-
exports.RuntimeConfig = RuntimeConfig;
|
|
12
|
-
//# sourceMappingURL=RuntimeConfig.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeConfig.cjs","mappings":";;;;;;;;;AAAM,MAAOA,aAAc,SAAQC,yBAKjC;AAAG","names":["RuntimeConfig","tsplus_module_1"],"sourceRoot":"","sources":["../_src/RuntimeConfig.ts"],"sourcesContent":[null]}
|
package/_mjs/RuntimeConfig.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeConfig.mjs","mappings":";AAAA,OAAM,MAAOA,aAAc,SAAQC,yBAKjC","names":["RuntimeConfig","tsplus_module_1"],"sourceRoot":"","sources":["../_src/RuntimeConfig.ts"],"sourcesContent":[null]}
|