@fncts/io 0.0.24 → 0.0.26
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/FiberRef/api.d.ts +0 -63
- package/FiberRef/operations.d.ts +64 -0
- package/FiberRef.d.ts +1 -0
- package/FiberRefs/api.d.ts +6 -1
- package/FiberRefs.d.ts +0 -1
- package/IO/api/daemonChildren.d.ts +6 -0
- package/IO/api/disconnect.d.ts +17 -0
- package/IO/api/fork.d.ts +4 -0
- package/IO/api/forkDaemon.d.ts +10 -0
- package/IO/api/interrupt.d.ts +1 -20
- package/IO/api/race.d.ts +7 -1
- package/IO/api/raceWith.d.ts +17 -0
- package/IO/api/transplant.d.ts +13 -0
- package/IO/api/whenFiberRef.d.ts +10 -0
- package/IO/api/whenRef.d.ts +10 -0
- package/IO/api/zipConcurrent.d.ts +5 -4
- package/IO/api.d.ts +12 -1
- package/IO.d.ts +7 -1
- package/RefSubject/Atomic.d.ts +1 -1
- package/_cjs/Cached/api.cjs +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +1 -1
- package/_cjs/Channel/api/mergeWith.cjs +17 -16
- package/_cjs/Channel/api/mergeWith.cjs.map +1 -1
- package/_cjs/Channel/api.cjs +1 -3
- package/_cjs/Channel/api.cjs.map +1 -1
- package/_cjs/Fiber/FiberRuntime.cjs +16 -17
- package/_cjs/Fiber/FiberRuntime.cjs.map +1 -1
- package/_cjs/FiberRef/api/locallyScoped.cjs +1 -1
- package/_cjs/FiberRef/api/locallyScopedWith.cjs +1 -1
- package/_cjs/FiberRef/api.cjs +0 -124
- package/_cjs/FiberRef/api.cjs.map +1 -1
- package/_cjs/FiberRef/constructors.cjs +1 -1
- package/_cjs/FiberRef/operations.cjs +130 -0
- package/_cjs/FiberRef/operations.cjs.map +1 -0
- package/_cjs/FiberRef.cjs +11 -0
- package/_cjs/FiberRef.cjs.map +1 -1
- package/_cjs/FiberRefs/api.cjs +90 -0
- package/_cjs/FiberRefs/api.cjs.map +1 -1
- package/_cjs/FiberRefs.cjs +0 -11
- package/_cjs/FiberRefs.cjs.map +1 -1
- package/_cjs/Future/api.cjs +1 -3
- package/_cjs/Future/api.cjs.map +1 -1
- package/_cjs/IO/api/asyncIO.cjs +1 -3
- package/_cjs/IO/api/asyncIO.cjs.map +1 -1
- package/_cjs/IO/api/bracketExit.cjs +1 -3
- package/_cjs/IO/api/bracketExit.cjs.map +1 -1
- package/_cjs/IO/api/clockWith.cjs +1 -1
- package/_cjs/IO/api/concurrency.cjs +1 -1
- package/_cjs/IO/api/consoleWith.cjs +1 -1
- package/_cjs/IO/api/daemonChildren.cjs +19 -0
- package/_cjs/IO/api/daemonChildren.cjs.map +1 -0
- package/_cjs/IO/api/disconnect.cjs +31 -0
- package/_cjs/IO/api/disconnect.cjs.map +1 -0
- package/_cjs/IO/api/environment.cjs +1 -1
- package/_cjs/IO/api/foreachConcurrent.cjs +19 -20
- package/_cjs/IO/api/foreachConcurrent.cjs.map +1 -1
- package/_cjs/IO/api/fork.cjs +8 -3
- package/_cjs/IO/api/fork.cjs.map +1 -1
- package/_cjs/IO/api/forkDaemon.cjs +21 -0
- package/_cjs/IO/api/forkDaemon.cjs.map +1 -0
- package/_cjs/IO/api/forkIn.cjs +2 -4
- package/_cjs/IO/api/forkIn.cjs.map +1 -1
- package/_cjs/IO/api/forkScoped.cjs +2 -4
- package/_cjs/IO/api/forkScoped.cjs.map +1 -1
- package/_cjs/IO/api/fulfill.cjs +1 -3
- package/_cjs/IO/api/fulfill.cjs.map +1 -1
- package/_cjs/IO/api/interrupt.cjs +8 -59
- package/_cjs/IO/api/interrupt.cjs.map +1 -1
- package/_cjs/IO/api/race.cjs +24 -12
- package/_cjs/IO/api/race.cjs.map +1 -1
- package/_cjs/IO/api/{core-scope.cjs → raceWith.cjs} +15 -56
- package/_cjs/IO/api/raceWith.cjs.map +1 -0
- package/_cjs/IO/api/randomWith.cjs +1 -1
- package/_cjs/IO/api/supervised.cjs +1 -1
- package/_cjs/IO/api/transplant.cjs +31 -0
- package/_cjs/IO/api/transplant.cjs.map +1 -0
- package/_cjs/IO/api/whenFiberRef.cjs +20 -0
- package/_cjs/IO/api/whenFiberRef.cjs.map +1 -0
- package/_cjs/IO/api/whenRef.cjs +21 -0
- package/_cjs/IO/api/whenRef.cjs.map +1 -0
- package/_cjs/IO/api/zipConcurrent.cjs +25 -19
- package/_cjs/IO/api/zipConcurrent.cjs.map +1 -1
- package/_cjs/IO/api.cjs +21 -5
- package/_cjs/IO/api.cjs.map +1 -1
- package/_cjs/IO.cjs +70 -4
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/Layer/MemoMap.cjs +1 -3
- package/_cjs/Layer/MemoMap.cjs.map +1 -1
- package/_cjs/RefSubject/Atomic.cjs +2 -2
- package/_cjs/RefSubject/Atomic.cjs.map +1 -1
- package/_cjs/Reloadable/constructors.cjs +1 -1
- package/_cjs/Reloadable/definition.cjs +1 -1
- package/_cjs/STM/api/atomically.cjs +2 -4
- package/_cjs/STM/api/atomically.cjs.map +1 -1
- package/_cjs/ScopedRef/api.cjs +2 -6
- package/_cjs/ScopedRef/api.cjs.map +1 -1
- package/_cjs/State/api.cjs +1 -1
- package/_cjs/Stream/api.cjs +137 -135
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/TReentrantLock/api.cjs +2 -6
- package/_cjs/TReentrantLock/api.cjs.map +1 -1
- package/_cjs/TSemaphore/api.cjs +1 -3
- package/_cjs/TSemaphore/api.cjs.map +1 -1
- package/_mjs/Cached/api.mjs +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +1 -1
- package/_mjs/Channel/api/mergeWith.mjs +17 -16
- package/_mjs/Channel/api/mergeWith.mjs.map +1 -1
- package/_mjs/Channel/api.mjs +1 -3
- package/_mjs/Channel/api.mjs.map +1 -1
- package/_mjs/Fiber/FiberRuntime.mjs +16 -17
- package/_mjs/Fiber/FiberRuntime.mjs.map +1 -1
- package/_mjs/FiberRef/api/locallyScoped.mjs +1 -1
- package/_mjs/FiberRef/api/locallyScopedWith.mjs +1 -1
- package/_mjs/FiberRef/api.mjs +0 -107
- package/_mjs/FiberRef/api.mjs.map +1 -1
- package/_mjs/FiberRef/constructors.mjs +1 -1
- package/_mjs/FiberRef/operations.mjs +109 -0
- package/_mjs/FiberRef/operations.mjs.map +1 -0
- package/_mjs/FiberRef.mjs +1 -0
- package/_mjs/FiberRef.mjs.map +1 -1
- package/_mjs/FiberRefs/api.mjs +89 -0
- package/_mjs/FiberRefs/api.mjs.map +1 -1
- package/_mjs/FiberRefs.mjs +0 -1
- package/_mjs/FiberRefs.mjs.map +1 -1
- package/_mjs/Future/api.mjs +1 -3
- package/_mjs/Future/api.mjs.map +1 -1
- package/_mjs/IO/api/asyncIO.mjs +1 -3
- package/_mjs/IO/api/asyncIO.mjs.map +1 -1
- package/_mjs/IO/api/bracketExit.mjs +1 -3
- package/_mjs/IO/api/bracketExit.mjs.map +1 -1
- package/_mjs/IO/api/clockWith.mjs +1 -1
- package/_mjs/IO/api/concurrency.mjs +1 -1
- package/_mjs/IO/api/consoleWith.mjs +1 -1
- package/_mjs/IO/api/daemonChildren.mjs +11 -0
- package/_mjs/IO/api/daemonChildren.mjs.map +1 -0
- package/_mjs/IO/api/disconnect.mjs +23 -0
- package/_mjs/IO/api/disconnect.mjs.map +1 -0
- package/_mjs/IO/api/environment.mjs +1 -1
- package/_mjs/IO/api/foreachConcurrent.mjs +19 -20
- package/_mjs/IO/api/foreachConcurrent.mjs.map +1 -1
- package/_mjs/IO/api/fork.mjs +6 -2
- package/_mjs/IO/api/fork.mjs.map +1 -1
- package/_mjs/IO/api/forkDaemon.mjs +13 -0
- package/_mjs/IO/api/forkDaemon.mjs.map +1 -0
- package/_mjs/IO/api/forkIn.mjs +2 -4
- package/_mjs/IO/api/forkIn.mjs.map +1 -1
- package/_mjs/IO/api/forkScoped.mjs +2 -4
- package/_mjs/IO/api/forkScoped.mjs.map +1 -1
- package/_mjs/IO/api/fulfill.mjs +1 -3
- package/_mjs/IO/api/fulfill.mjs.map +1 -1
- package/_mjs/IO/api/interrupt.mjs +6 -55
- package/_mjs/IO/api/interrupt.mjs.map +1 -1
- package/_mjs/IO/api/race.mjs +22 -12
- package/_mjs/IO/api/race.mjs.map +1 -1
- package/_mjs/IO/api/raceWith.mjs +59 -0
- package/_mjs/IO/api/raceWith.mjs.map +1 -0
- package/_mjs/IO/api/randomWith.mjs +1 -1
- package/_mjs/IO/api/supervised.mjs +1 -1
- package/_mjs/IO/api/transplant.mjs +23 -0
- package/_mjs/IO/api/transplant.mjs.map +1 -0
- package/_mjs/IO/api/whenFiberRef.mjs +12 -0
- package/_mjs/IO/api/whenFiberRef.mjs.map +1 -0
- package/_mjs/IO/api/whenRef.mjs +13 -0
- package/_mjs/IO/api/whenRef.mjs.map +1 -0
- package/_mjs/IO/api/zipConcurrent.mjs +23 -17
- package/_mjs/IO/api/zipConcurrent.mjs.map +1 -1
- package/_mjs/IO/api.mjs +16 -3
- package/_mjs/IO/api.mjs.map +1 -1
- package/_mjs/IO.mjs +7 -1
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/Layer/MemoMap.mjs +1 -3
- package/_mjs/Layer/MemoMap.mjs.map +1 -1
- package/_mjs/RefSubject/Atomic.mjs +1 -1
- package/_mjs/RefSubject/Atomic.mjs.map +1 -1
- package/_mjs/Reloadable/constructors.mjs +1 -1
- package/_mjs/Reloadable/definition.mjs +1 -1
- package/_mjs/STM/api/atomically.mjs +2 -4
- package/_mjs/STM/api/atomically.mjs.map +1 -1
- package/_mjs/ScopedRef/api.mjs +2 -6
- package/_mjs/ScopedRef/api.mjs.map +1 -1
- package/_mjs/State/api.mjs +1 -1
- package/_mjs/Stream/api.mjs +137 -135
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/TReentrantLock/api.mjs +2 -6
- package/_mjs/TReentrantLock/api.mjs.map +1 -1
- package/_mjs/TSemaphore/api.mjs +1 -3
- package/_mjs/TSemaphore/api.mjs.map +1 -1
- package/_src/Channel/api.ts +1 -1
- package/_src/FiberRef/api.ts +0 -114
- package/_src/FiberRef/operations.ts +115 -0
- package/_src/FiberRef.ts +1 -0
- package/_src/FiberRefs/api.ts +72 -0
- package/_src/FiberRefs.ts +0 -1
- package/_src/Future/api.ts +1 -1
- package/_src/IO/api/asyncIO.ts +1 -1
- package/_src/IO/api/bracketExit.ts +1 -1
- package/_src/IO/api/daemonChildren.ts +6 -0
- package/_src/IO/api/disconnect.ts +25 -0
- package/_src/IO/api/foreachConcurrent.ts +1 -1
- package/_src/IO/api/fork.ts +3 -0
- package/_src/IO/api/forkDaemon.ts +12 -0
- package/_src/IO/api/forkIn.ts +1 -1
- package/_src/IO/api/forkScoped.ts +1 -3
- package/_src/IO/api/fulfill.ts +1 -1
- package/_src/IO/api/interrupt.ts +5 -56
- package/_src/IO/api/race.ts +18 -8
- package/_src/IO/api/{core-scope.ts → raceWith.ts} +2 -44
- package/_src/IO/api/transplant.ts +19 -0
- package/_src/IO/api/whenFiberRef.ts +9 -0
- package/_src/IO/api/whenRef.ts +9 -0
- package/_src/IO/api/zipConcurrent.ts +41 -43
- package/_src/IO/api.ts +18 -2
- package/_src/IO.ts +7 -1
- package/_src/Layer/MemoMap.ts +1 -1
- package/_src/RefSubject/Atomic.ts +1 -1
- package/_src/STM/api/atomically.ts +1 -1
- package/_src/ScopedRef/api.ts +2 -2
- package/_src/TReentrantLock/api.ts +2 -2
- package/_src/TSemaphore/api.ts +1 -1
- package/package.json +2 -2
- package/FiberRefs/join.d.ts +0 -9
- package/IO/api/core-scope.d.ts +0 -43
- package/_cjs/FiberRefs/join.cjs +0 -104
- package/_cjs/FiberRefs/join.cjs.map +0 -1
- package/_cjs/IO/api/core-scope.cjs.map +0 -1
- package/_mjs/FiberRefs/join.mjs +0 -96
- package/_mjs/FiberRefs/join.mjs.map +0 -1
- package/_mjs/IO/api/core-scope.mjs +0 -97
- package/_mjs/IO/api/core-scope.mjs.map +0 -1
- package/_src/FiberRefs/join.ts +0 -71
package/_mjs/Stream/api.mjs
CHANGED
|
@@ -22,47 +22,49 @@ import * as tsplus_module_20 from "@fncts/base/data/Maybe/destructors";
|
|
|
22
22
|
import * as tsplus_module_21 from "@fncts/io/Stream/internal/SinkEndReason";
|
|
23
23
|
import * as tsplus_module_22 from "@fncts/io/Fiber/api/join";
|
|
24
24
|
import * as tsplus_module_23 from "@fncts/io/Fiber/api/interrupt";
|
|
25
|
-
import * as tsplus_module_24 from "@fncts/io/IO/api/
|
|
25
|
+
import * as tsplus_module_24 from "@fncts/io/IO/api/forkDaemon";
|
|
26
26
|
import * as tsplus_module_25 from "@fncts/base/data/Cause/api";
|
|
27
|
-
import * as tsplus_module_26 from "@fncts/io/
|
|
28
|
-
import * as tsplus_module_27 from "@fncts/io/
|
|
29
|
-
import * as tsplus_module_28 from "@fncts/io/
|
|
30
|
-
import * as tsplus_module_29 from "@fncts/io/
|
|
31
|
-
import * as tsplus_module_30 from "@fncts/io/
|
|
32
|
-
import * as tsplus_module_31 from "@fncts/io/IO/api/
|
|
33
|
-
import * as tsplus_module_32 from "@fncts/io/IO/api/
|
|
34
|
-
import * as tsplus_module_33 from "@fncts/io/
|
|
35
|
-
import * as tsplus_module_34 from "@fncts/
|
|
36
|
-
import * as tsplus_module_35 from "@fncts/base/
|
|
37
|
-
import * as tsplus_module_36 from "@fncts/
|
|
38
|
-
import * as tsplus_module_37 from "@fncts/io/Future/
|
|
39
|
-
import * as tsplus_module_38 from "@fncts/
|
|
40
|
-
import * as tsplus_module_39 from "@fncts/base/
|
|
41
|
-
import * as tsplus_module_40 from "@fncts/base/
|
|
42
|
-
import * as tsplus_module_41 from "@fncts/
|
|
43
|
-
import * as tsplus_module_42 from "@fncts/io/
|
|
44
|
-
import * as tsplus_module_43 from "@fncts/
|
|
45
|
-
import * as tsplus_module_44 from "@fncts/io/
|
|
46
|
-
import * as tsplus_module_45 from "@fncts/
|
|
47
|
-
import * as tsplus_module_46 from "@fncts/io/
|
|
48
|
-
import * as tsplus_module_47 from "@fncts/io/
|
|
49
|
-
import * as tsplus_module_48 from "@fncts/
|
|
50
|
-
import * as tsplus_module_49 from "@fncts/io/
|
|
51
|
-
import * as tsplus_module_50 from "@fncts/
|
|
52
|
-
import * as tsplus_module_51 from "@fncts/io/
|
|
53
|
-
import * as tsplus_module_52 from "@fncts/
|
|
54
|
-
import * as tsplus_module_53 from "@fncts/io/
|
|
55
|
-
import * as tsplus_module_54 from "@fncts/
|
|
56
|
-
import * as tsplus_module_55 from "@fncts/io/
|
|
57
|
-
import * as tsplus_module_56 from "@fncts/io/
|
|
58
|
-
import * as tsplus_module_57 from "@fncts/io/Channel/api/
|
|
59
|
-
import * as tsplus_module_58 from "@fncts/io/Channel/
|
|
60
|
-
import * as tsplus_module_59 from "@fncts/io/Channel/api/
|
|
61
|
-
import * as tsplus_module_60 from "@fncts/io/
|
|
62
|
-
import * as tsplus_module_61 from "@fncts/io/
|
|
63
|
-
import * as tsplus_module_62 from "@fncts/io/
|
|
64
|
-
import * as tsplus_module_63 from "@fncts/
|
|
65
|
-
import * as tsplus_module_64 from "@fncts/io/Channel/api/
|
|
27
|
+
import * as tsplus_module_26 from "@fncts/io/IO/api/raceWith";
|
|
28
|
+
import * as tsplus_module_27 from "@fncts/io/Stream/internal/Take";
|
|
29
|
+
import * as tsplus_module_28 from "@fncts/io/Queue/api/operations";
|
|
30
|
+
import * as tsplus_module_29 from "@fncts/io/IO/runtime";
|
|
31
|
+
import * as tsplus_module_30 from "@fncts/io/Queue/constructors";
|
|
32
|
+
import * as tsplus_module_31 from "@fncts/io/IO/api/acquireRelease";
|
|
33
|
+
import * as tsplus_module_32 from "@fncts/io/IO/api/acquireReleaseExit";
|
|
34
|
+
import * as tsplus_module_33 from "@fncts/io/IO/api/fork";
|
|
35
|
+
import * as tsplus_module_34 from "@fncts/io/Hub/api";
|
|
36
|
+
import * as tsplus_module_35 from "@fncts/base/collection/immutable/Conc/api/replicate";
|
|
37
|
+
import * as tsplus_module_36 from "@fncts/base/data/Exit/api";
|
|
38
|
+
import * as tsplus_module_37 from "@fncts/io/Future/api";
|
|
39
|
+
import * as tsplus_module_38 from "@fncts/io/Future/constructors";
|
|
40
|
+
import * as tsplus_module_39 from "@fncts/base/data/Maybe/api";
|
|
41
|
+
import * as tsplus_module_40 from "@fncts/base/collection/Iterable/constructors";
|
|
42
|
+
import * as tsplus_module_41 from "@fncts/base/data/Exit/constructors";
|
|
43
|
+
import * as tsplus_module_42 from "@fncts/io/Stream/internal/DebounceState";
|
|
44
|
+
import * as tsplus_module_43 from "@fncts/io/Clock/api";
|
|
45
|
+
import * as tsplus_module_44 from "@fncts/io/IO/api/transplant";
|
|
46
|
+
import * as tsplus_module_45 from "@fncts/base/collection/immutable/HashMap/api";
|
|
47
|
+
import * as tsplus_module_46 from "@fncts/io/TSemaphore/api";
|
|
48
|
+
import * as tsplus_module_47 from "@fncts/io/TSemaphore/constructors";
|
|
49
|
+
import * as tsplus_module_48 from "@fncts/io/STM/api/atomically";
|
|
50
|
+
import * as tsplus_module_49 from "@fncts/io/Sink/api";
|
|
51
|
+
import * as tsplus_module_50 from "@fncts/base/data/Predicate/api";
|
|
52
|
+
import * as tsplus_module_51 from "@fncts/io/Fiber/api/poll";
|
|
53
|
+
import * as tsplus_module_52 from "@fncts/io/IO/api/environment";
|
|
54
|
+
import * as tsplus_module_53 from "@fncts/io/collection/immutable/Conc/findIO";
|
|
55
|
+
import * as tsplus_module_54 from "@fncts/base/data/Exit/definition";
|
|
56
|
+
import * as tsplus_module_55 from "@fncts/io/Stream/internal/Pull";
|
|
57
|
+
import * as tsplus_module_56 from "@fncts/io/Queue/api/takeBetween";
|
|
58
|
+
import * as tsplus_module_57 from "@fncts/io/Channel/api/interruptWhen";
|
|
59
|
+
import * as tsplus_module_58 from "@fncts/io/Channel/api/mapOutConcurrentIO";
|
|
60
|
+
import * as tsplus_module_59 from "@fncts/io/Channel/api/mergeMap";
|
|
61
|
+
import * as tsplus_module_60 from "@fncts/io/Channel/internal/MergeDecision";
|
|
62
|
+
import * as tsplus_module_61 from "@fncts/io/Channel/api/mergeWith";
|
|
63
|
+
import * as tsplus_module_62 from "@fncts/io/Layer/MemoMap";
|
|
64
|
+
import * as tsplus_module_63 from "@fncts/io/Layer/api";
|
|
65
|
+
import * as tsplus_module_64 from "@fncts/io/Channel/api/runDrain";
|
|
66
|
+
import * as tsplus_module_65 from "@fncts/base/data/exceptions";
|
|
67
|
+
import * as tsplus_module_66 from "@fncts/io/Channel/api/toPull";
|
|
66
68
|
export const aggregateAsyncWithin = aggregateAsyncWithin_1;
|
|
67
69
|
export const aggregateAsyncWithinEither = aggregateAsyncWithinEither_1;
|
|
68
70
|
export const zipRight = zipRight_1;
|
|
@@ -232,7 +234,7 @@ function aggregateAsyncWithinEither_1(sink, schedule, __tsplusTrace) {
|
|
|
232
234
|
UpstreamEnd: () => tsplus_module_10.unwrap(() => tsplus_module_1.map(p => p ? tsplus_module_10.write(() => tsplus_module_19.make(tsplus_module_18.right(b))) : tsplus_module_10.unit, __tsplusTrace)(tsplus_module_14.get(consumed, __tsplusTrace)))
|
|
233
235
|
})(reason), __tsplusTrace)(tsplus_module_14.get(sinkEndReason, __tsplusTrace)), __tsplusTrace)(tsplus_module_13.set(tsplus_module_12.flatten(leftovers), __tsplusTrace)(sinkLeftovers)));
|
|
234
236
|
}
|
|
235
|
-
return tsplus_module_10.unwrap(() =>
|
|
237
|
+
return tsplus_module_10.unwrap(() => tsplus_module_26.raceWith(() => tsplus_module_22.join(scheduleFiber, __tsplusTrace), (sinkExit, scheduleFiber) => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)(tsplus_module_1.fromExit(() => sinkExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_23.interrupt(scheduleFiber)), (scheduleExit, sinkFiber) => tsplus_module_1.matchCauseIO(cause => tsplus_module_4.match(() => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_24.forkDaemon(tsplus_module_5.offer(tsplus_module_5.end(new ScheduleEnd()))(handoff), __tsplusTrace)), cause => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_24.forkDaemon(tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff), __tsplusTrace)))(tsplus_module_25.failureOrCause(cause)), c => tsplus_module_1.zipRight(tsplus_module_1.map(([leftovers, b]) => handleSide(leftovers, b, tsplus_module_3.just(c), __tsplusTrace), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)), __tsplusTrace)(tsplus_module_24.forkDaemon(tsplus_module_5.offer(tsplus_module_5.end(new ScheduleEnd()))(handoff), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.fromExit(() => scheduleExit, __tsplusTrace)), __tsplusTrace)(tsplus_module_22.join(sinkFiber, __tsplusTrace)));
|
|
236
238
|
};
|
|
237
239
|
return unwrapScoped_1(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(sinkFiber => tsplus_module_1.map(scheduleFiber => new Stream(scheduledAggregator(sinkFiber, scheduleFiber)), __tsplusTrace)(tsplus_module_17.forkScoped(timeout(tsplus_module_3.nothing(), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(tsplus_module_17.forkScoped(tsplus_module_16.runScoped(tsplus_module_10.doneCollect(tsplus_module_10.pipeToOrFail(sink.channel)(handoffConsumer))), __tsplusTrace)), __tsplusTrace)(tsplus_module_17.forkScoped(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(handoffProducer)(stream.channel)), __tsplusTrace)), __tsplusTrace);
|
|
238
240
|
}, __tsplusTrace)(fromIO_1(deps, __tsplusTrace));
|
|
@@ -277,12 +279,12 @@ export function as(b, __tsplusTrace) {
|
|
|
277
279
|
*/
|
|
278
280
|
function asyncInterrupt_1(register, outputBuffer = 16, __tsplusTrace) {
|
|
279
281
|
return unwrapScoped_1(tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(eitherStream => tsplus_module_4.match(canceler => {
|
|
280
|
-
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), as => tsplus_module_11.zipRight(loop)(tsplus_module_10.writeNow(as)), __tsplusTrace)(tsplus_module_1.flatMap(take =>
|
|
282
|
+
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.match(maybeError => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), as => tsplus_module_11.zipRight(loop)(tsplus_module_10.writeNow(as)), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_28.take(output, __tsplusTrace))));
|
|
281
283
|
return ensuring_1(canceler, __tsplusTrace)(new Stream(loop));
|
|
282
|
-
}, stream => unwrap_1(tsplus_module_1.as(() => stream, __tsplusTrace)(
|
|
283
|
-
const effect = tsplus_module_1.flatMap(a =>
|
|
284
|
+
}, stream => unwrap_1(tsplus_module_1.as(() => stream, __tsplusTrace)(tsplus_module_28.shutdown(output, __tsplusTrace)), __tsplusTrace))(eitherStream), __tsplusTrace)(tsplus_module_1.succeed(() => register((k, cb) => {
|
|
285
|
+
const effect = tsplus_module_1.flatMap(a => tsplus_module_28.offer(a, __tsplusTrace)(output), __tsplusTrace)(tsplus_module_27.fromPull(k));
|
|
284
286
|
return runtime.unsafeRunAsyncWith(effect, cb || constVoid, __tsplusTrace);
|
|
285
|
-
}), __tsplusTrace)), __tsplusTrace)(
|
|
287
|
+
}), __tsplusTrace)), __tsplusTrace)(tsplus_module_29.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(outputBuffer, __tsplusTrace), queue => tsplus_module_28.shutdown(queue, __tsplusTrace), __tsplusTrace)), __tsplusTrace);
|
|
286
288
|
}
|
|
287
289
|
/**
|
|
288
290
|
* Creates a stream from an asynchronous callback that can be called multiple times.
|
|
@@ -309,9 +311,9 @@ export function async(register, outputBuffer = 16, __tsplusTrace) {
|
|
|
309
311
|
*/
|
|
310
312
|
export function asyncIO(register, outputBuffer = 16, __tsplusTrace) {
|
|
311
313
|
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.flatMap(output => tsplus_module_1.flatMap(runtime => tsplus_module_1.map(() => {
|
|
312
|
-
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.matchCauseIO(cause => tsplus_module_1.as(() => tsplus_module_4.match(maybeError => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), tsplus_module_11.failCauseNow)(tsplus_module_25.failureOrCause(cause)), __tsplusTrace)(
|
|
314
|
+
const loop = tsplus_module_10.unwrap(() => tsplus_module_1.matchCauseIO(cause => tsplus_module_1.as(() => tsplus_module_4.match(maybeError => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_10.failNow)(maybeError), tsplus_module_11.failCauseNow)(tsplus_module_25.failureOrCause(cause)), __tsplusTrace)(tsplus_module_28.shutdown(output, __tsplusTrace)), as => tsplus_module_1.succeed(() => tsplus_module_11.zipRight(loop)(tsplus_module_10.writeNow(as)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_28.take(output, __tsplusTrace))));
|
|
313
315
|
return loop;
|
|
314
|
-
}, __tsplusTrace)(register((k, cb) => runtime.unsafeRunAsyncWith(tsplus_module_1.flatMap(a =>
|
|
316
|
+
}, __tsplusTrace)(register((k, cb) => runtime.unsafeRunAsyncWith(tsplus_module_1.flatMap(a => tsplus_module_28.offer(a, __tsplusTrace)(output), __tsplusTrace)(tsplus_module_27.fromPull(k)), cb || constVoid, __tsplusTrace))), __tsplusTrace)(tsplus_module_29.runtime(__tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(outputBuffer, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace))));
|
|
315
317
|
}
|
|
316
318
|
/**
|
|
317
319
|
* Returns a stream whose failure and success channels have been mapped by
|
|
@@ -329,7 +331,7 @@ export function bimap(f, g, __tsplusTrace) {
|
|
|
329
331
|
* @tsplus static fncts.io.StreamOps acquireRelease
|
|
330
332
|
*/
|
|
331
333
|
export function acquireRelease(acquire, release, __tsplusTrace) {
|
|
332
|
-
return scoped_1(() =>
|
|
334
|
+
return scoped_1(() => tsplus_module_31.acquireRelease(() => acquire, release, __tsplusTrace), __tsplusTrace);
|
|
333
335
|
}
|
|
334
336
|
/**
|
|
335
337
|
* Creates a stream from a single value that will get cleaned up after the
|
|
@@ -338,7 +340,7 @@ export function acquireRelease(acquire, release, __tsplusTrace) {
|
|
|
338
340
|
* @tsplus static fncts.io.StreamOps acquireReleaseExit
|
|
339
341
|
*/
|
|
340
342
|
export function acquireReleaseExit(acquire, release, __tsplusTrace) {
|
|
341
|
-
return scoped_1(() =>
|
|
343
|
+
return scoped_1(() => tsplus_module_32.acquireReleaseExit(() => acquire, release, __tsplusTrace), __tsplusTrace);
|
|
342
344
|
}
|
|
343
345
|
/**
|
|
344
346
|
* Fan out the stream, producing a list of streams that have the same elements as this stream.
|
|
@@ -374,7 +376,7 @@ export function broadcastDynamic(maximumLag, __tsplusTrace) {
|
|
|
374
376
|
*/
|
|
375
377
|
function broadcastedQueues_1(n, maximumLag, __tsplusTrace) {
|
|
376
378
|
return self => {
|
|
377
|
-
return tsplus_module_1.flatMap(hub => tsplus_module_1.flatMap(queues => tsplus_module_1.map(() => queues, __tsplusTrace)(
|
|
379
|
+
return tsplus_module_1.flatMap(hub => tsplus_module_1.flatMap(queues => tsplus_module_1.map(() => queues, __tsplusTrace)(tsplus_module_33.fork(runIntoHubScoped_1(hub, __tsplusTrace)(self), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.sequenceIterable(tsplus_module_35.replicate(n, tsplus_module_34.subscribe(hub, __tsplusTrace)), __tsplusTrace)), __tsplusTrace)(tsplus_module_34.makeBounded(maximumLag, __tsplusTrace));
|
|
378
380
|
};
|
|
379
381
|
}
|
|
380
382
|
/**
|
|
@@ -387,7 +389,7 @@ function broadcastedQueues_1(n, maximumLag, __tsplusTrace) {
|
|
|
387
389
|
*/
|
|
388
390
|
function broadcastedQueuesDynamic_1(maximumLag, __tsplusTrace) {
|
|
389
391
|
return stream => {
|
|
390
|
-
return tsplus_module_1.map(hub =>
|
|
392
|
+
return tsplus_module_1.map(hub => tsplus_module_34.subscribe(hub, __tsplusTrace), __tsplusTrace)(toHub_1(maximumLag, __tsplusTrace)(stream));
|
|
391
393
|
};
|
|
392
394
|
}
|
|
393
395
|
/**
|
|
@@ -400,7 +402,7 @@ export function buffer(capacity, __tsplusTrace) {
|
|
|
400
402
|
return stream => {
|
|
401
403
|
const queue = toQueueOfElements_1(capacity, __tsplusTrace)(stream);
|
|
402
404
|
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
|
|
403
|
-
const process = tsplus_module_11.flatMap(exit =>
|
|
405
|
+
const process = tsplus_module_11.flatMap(exit => tsplus_module_36.match(cause => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow)(tsplus_module_25.flipCauseOption(cause)), value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(tsplus_module_19.single(value))))(exit))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
|
|
404
406
|
return process;
|
|
405
407
|
}, __tsplusTrace)(queue)));
|
|
406
408
|
};
|
|
@@ -412,7 +414,7 @@ export function bufferChunks(capacity, __tsplusTrace) {
|
|
|
412
414
|
return stream => {
|
|
413
415
|
const queue = toQueue_1(capacity, __tsplusTrace)(stream);
|
|
414
416
|
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
|
|
415
|
-
const process = tsplus_module_11.flatMap(take =>
|
|
417
|
+
const process = tsplus_module_11.flatMap(take => tsplus_module_27.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
|
|
416
418
|
return process;
|
|
417
419
|
}, __tsplusTrace)(queue)));
|
|
418
420
|
};
|
|
@@ -426,16 +428,16 @@ export function bufferChunks(capacity, __tsplusTrace) {
|
|
|
426
428
|
export function bufferUnbounded(stream, __tsplusTrace) {
|
|
427
429
|
const queue = toQueueUnbounded_1(stream, __tsplusTrace);
|
|
428
430
|
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(queue => {
|
|
429
|
-
const process = tsplus_module_11.flatMap(take =>
|
|
431
|
+
const process = tsplus_module_11.flatMap(take => tsplus_module_27.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
|
|
430
432
|
return process;
|
|
431
433
|
}, __tsplusTrace)(queue)));
|
|
432
434
|
}
|
|
433
435
|
function bufferSignalProducer(queue, ref, __tsplusTrace) {
|
|
434
|
-
const terminate = take => tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(latch => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(
|
|
435
|
-
return tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(bufferSignalProducer(queue, ref, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(added => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_1.when(() => added, __tsplusTrace)(tsplus_module_13.set(p, __tsplusTrace)(ref))), __tsplusTrace)(
|
|
436
|
+
const terminate = take => tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(latch => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_37.wait(p, __tsplusTrace)), __tsplusTrace)(tsplus_module_13.set(p, __tsplusTrace)(ref)), __tsplusTrace)(tsplus_module_28.offer(tuple(take, p), __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace)), __tsplusTrace)(tsplus_module_37.wait(latch, __tsplusTrace)), __tsplusTrace)(tsplus_module_14.get(ref, __tsplusTrace)));
|
|
437
|
+
return tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(bufferSignalProducer(queue, ref, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(added => tsplus_module_1.map(() => void 0, __tsplusTrace)(tsplus_module_1.when(() => added, __tsplusTrace)(tsplus_module_13.set(p, __tsplusTrace)(ref))), __tsplusTrace)(tsplus_module_28.offer(tuple(tsplus_module_27.chunk(inp), p), __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace)))), e => terminate(tsplus_module_27.fail(e)), () => terminate(tsplus_module_27.end));
|
|
436
438
|
}
|
|
437
439
|
function bufferSignalConsumer(queue, __tsplusTrace) {
|
|
438
|
-
const process = tsplus_module_11.flatMap(([take, promise]) => tsplus_module_11.zipRight(
|
|
440
|
+
const process = tsplus_module_11.flatMap(([take, promise]) => tsplus_module_11.zipRight(tsplus_module_27.match(tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow, value => tsplus_module_11.zipRight(process)(tsplus_module_10.writeNow(value)))(take))(tsplus_module_10.fromIO(() => tsplus_module_37.succeed_(undefined, __tsplusTrace)(promise))))(tsplus_module_10.fromIO(() => tsplus_module_28.take(queue, __tsplusTrace)));
|
|
439
441
|
return process;
|
|
440
442
|
}
|
|
441
443
|
/**
|
|
@@ -470,7 +472,7 @@ function catchAllCause_1(f, __tsplusTrace) {
|
|
|
470
472
|
*/
|
|
471
473
|
export function catchJust(pf, __tsplusTrace) {
|
|
472
474
|
return stream => {
|
|
473
|
-
return catchAll_1(e =>
|
|
475
|
+
return catchAll_1(e => tsplus_module_39.getOrElse(() => failNow_1(e, __tsplusTrace))(pf(e)), __tsplusTrace)(stream);
|
|
474
476
|
};
|
|
475
477
|
}
|
|
476
478
|
/**
|
|
@@ -482,7 +484,7 @@ export function catchJust(pf, __tsplusTrace) {
|
|
|
482
484
|
*/
|
|
483
485
|
export function catchJustCause(pf, __tsplusTrace) {
|
|
484
486
|
return stream => {
|
|
485
|
-
return catchAllCause_1(cause =>
|
|
487
|
+
return catchAllCause_1(cause => tsplus_module_39.getOrElse(() => failCauseNow_1(cause, __tsplusTrace))(pf(cause)), __tsplusTrace)(stream);
|
|
486
488
|
};
|
|
487
489
|
}
|
|
488
490
|
/**
|
|
@@ -555,7 +557,7 @@ export function collectWhile(pf, __tsplusTrace) {
|
|
|
555
557
|
* Effectfully transforms all elements of the stream for as long as the specified partial function is defined.
|
|
556
558
|
*/
|
|
557
559
|
export function collectWhileIO(stream, pf, __tsplusTrace) {
|
|
558
|
-
return new Stream(tsplus_module_10.pipeTo(collectWhileIOLoop(
|
|
560
|
+
return new Stream(tsplus_module_10.pipeTo(collectWhileIOLoop(tsplus_module_40.empty()[Symbol.iterator](), pf, __tsplusTrace))(stream.channel));
|
|
559
561
|
}
|
|
560
562
|
function collectWhileIOLoop(iterator, pf, __tsplusTrace) {
|
|
561
563
|
const next = iterator.next();
|
|
@@ -566,7 +568,7 @@ function collectWhileIOLoop(iterator, pf, __tsplusTrace) {
|
|
|
566
568
|
}
|
|
567
569
|
}
|
|
568
570
|
function combineProducer(handoff, latch, __tsplusTrace) {
|
|
569
|
-
return tsplus_module_11.zipRight(tsplus_module_10.readWithCause(value => tsplus_module_11.zipRight(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(
|
|
571
|
+
return tsplus_module_11.zipRight(tsplus_module_10.readWithCause(value => tsplus_module_11.zipRight(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_41.succeed(value))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_41.failCause(tsplus_module_25.map(tsplus_module_3.just)(cause)))(handoff)), () => tsplus_module_11.zipRight(combineProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_41.fail(tsplus_module_3.nothing()))(handoff)))))(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)));
|
|
570
572
|
}
|
|
571
573
|
/**
|
|
572
574
|
* Combines the elements from this stream and the specified stream by repeatedly applying the
|
|
@@ -584,11 +586,11 @@ export function combine(that, s, f, __tsplusTrace) {
|
|
|
584
586
|
const pullLeft = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(left), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchL)));
|
|
585
587
|
const pullRight = tsplus_module_1.flatMap(tsplus_module_1.fromExitNow, __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(right), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchR)));
|
|
586
588
|
return unfoldIO_1(s, s => tsplus_module_1.flatMap(exit => tsplus_module_1.optional(tsplus_module_1.fromExitNow(exit, __tsplusTrace), __tsplusTrace), __tsplusTrace)(f(s, pullLeft, pullRight)), __tsplusTrace).channel;
|
|
587
|
-
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right, latchL, latchR), __tsplusTrace)(
|
|
589
|
+
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineProducer(right, latchR, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(that.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineProducer(left, latchL, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(stream.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
|
|
588
590
|
};
|
|
589
591
|
}
|
|
590
592
|
function combineChunksProducer(handoff, latch, __tsplusTrace) {
|
|
591
|
-
return tsplus_module_11.zipRight(tsplus_module_10.readWithCause(chunk => tsplus_module_11.zipRight(combineChunksProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(
|
|
593
|
+
return tsplus_module_11.zipRight(tsplus_module_10.readWithCause(chunk => tsplus_module_11.zipRight(combineChunksProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.chunk(chunk))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.failCause(cause))(handoff)), () => tsplus_module_11.zipRight(combineChunksProducer(handoff, latch, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.end)(handoff)))))(tsplus_module_10.fromIO(() => tsplus_module_5.take(latch)));
|
|
592
594
|
}
|
|
593
595
|
/**
|
|
594
596
|
* Combines the chunks from this stream and the specified stream by repeatedly applying the
|
|
@@ -601,10 +603,10 @@ function combineChunksProducer(handoff, latch, __tsplusTrace) {
|
|
|
601
603
|
export function combineChunks(that, s, f, __tsplusTrace) {
|
|
602
604
|
return stream => {
|
|
603
605
|
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right, latchL, latchR]) => {
|
|
604
|
-
const pullLeft = tsplus_module_1.flatMap(take =>
|
|
605
|
-
const pullRight = tsplus_module_1.flatMap(take =>
|
|
606
|
+
const pullLeft = tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(left), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchL)));
|
|
607
|
+
const pullRight = tsplus_module_1.flatMap(take => tsplus_module_27.done(take), __tsplusTrace)(tsplus_module_1.zipRight(tsplus_module_5.take(right), __tsplusTrace)(tsplus_module_5.offer(undefined)(latchR)));
|
|
606
608
|
return unfoldChunkIO_1(s, s => tsplus_module_1.flatMap(exit => tsplus_module_1.optional(tsplus_module_1.fromExit(() => exit, __tsplusTrace), __tsplusTrace), __tsplusTrace)(f(s, pullLeft, pullRight)), __tsplusTrace).channel;
|
|
607
|
-
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right, latchL, latchR), __tsplusTrace)(
|
|
609
|
+
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(latchL => tsplus_module_1.flatMap(latchR => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right, latchL, latchR), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineChunksProducer(right, latchR, __tsplusTrace))(that.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(combineChunksProducer(left, latchL, __tsplusTrace))(stream.channel)), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
|
|
608
610
|
};
|
|
609
611
|
}
|
|
610
612
|
/**
|
|
@@ -657,13 +659,13 @@ export function contramapEnvironment(f, __tsplusTrace) {
|
|
|
657
659
|
*/
|
|
658
660
|
export function debounce(duration, __tsplusTrace) {
|
|
659
661
|
return stream => {
|
|
660
|
-
return unwrap_1(
|
|
662
|
+
return unwrap_1(tsplus_module_44.transplant(grafter => tsplus_module_1.map(handoff => {
|
|
661
663
|
function enqueue(last, __tsplusTrace) {
|
|
662
|
-
return tsplus_module_1.map(f => consumer(
|
|
664
|
+
return tsplus_module_1.map(f => consumer(tsplus_module_42.previous(f), __tsplusTrace), __tsplusTrace)(grafter(tsplus_module_33.fork(tsplus_module_1.as(() => last, __tsplusTrace)(tsplus_module_43.sleep(duration, __tsplusTrace)), __tsplusTrace)));
|
|
663
665
|
}
|
|
664
666
|
const producer = tsplus_module_10.readWithCause(inp => tsplus_module_20.match(() => producer, last => tsplus_module_11.zipRight(producer)(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.emit(tsplus_module_19.single(last)))(handoff))))(tsplus_module_12.last(inp)), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.halt(cause))(handoff)), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_5.end(new UpstreamEnd()))(handoff)));
|
|
665
667
|
function consumer(state, __tsplusTrace) {
|
|
666
|
-
return tsplus_module_10.unwrap(() =>
|
|
668
|
+
return tsplus_module_10.unwrap(() => tsplus_module_42.match({
|
|
667
669
|
NotStarted: () => tsplus_module_1.map(signal => tsplus_module_5.matchSignal({
|
|
668
670
|
Emit: ({
|
|
669
671
|
els
|
|
@@ -686,7 +688,7 @@ export function debounce(duration, __tsplusTrace) {
|
|
|
686
688
|
})(signal), __tsplusTrace)(tsplus_module_22.join(fiber, __tsplusTrace)),
|
|
687
689
|
Previous: ({
|
|
688
690
|
fiber
|
|
689
|
-
}) =>
|
|
691
|
+
}) => tsplus_module_26.raceWith(() => tsplus_module_5.take(handoff), (ex, current) => tsplus_module_36.match(cause => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(cause), __tsplusTrace)(tsplus_module_23.interrupt(current)), chunk => tsplus_module_1.succeedNow(tsplus_module_11.zipRight(consumer(tsplus_module_42.current(current), __tsplusTrace))(tsplus_module_10.writeNow(chunk)), __tsplusTrace))(ex), (ex, previous) => tsplus_module_36.match(cause => tsplus_module_1.as(() => tsplus_module_11.failCauseNow(cause), __tsplusTrace)(tsplus_module_23.interrupt(previous)), signal => tsplus_module_5.matchSignal({
|
|
690
692
|
Emit: ({
|
|
691
693
|
els
|
|
692
694
|
}) => tsplus_module_1.zipRight(enqueue(els, __tsplusTrace), __tsplusTrace)(tsplus_module_23.interrupt(previous)),
|
|
@@ -697,7 +699,7 @@ export function debounce(duration, __tsplusTrace) {
|
|
|
697
699
|
})(signal))(ex), __tsplusTrace)(tsplus_module_22.join(fiber, __tsplusTrace))
|
|
698
700
|
})(state));
|
|
699
701
|
}
|
|
700
|
-
return zipRight_1(new Stream(consumer(
|
|
702
|
+
return zipRight_1(new Stream(consumer(tsplus_module_42.notStarted, __tsplusTrace)), __tsplusTrace)(scoped_1(() => tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(producer)(stream.channel)), __tsplusTrace), __tsplusTrace));
|
|
701
703
|
}, __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace), __tsplusTrace);
|
|
702
704
|
};
|
|
703
705
|
}
|
|
@@ -724,9 +726,9 @@ export function defaultIfEmpty(fb, __tsplusTrace) {
|
|
|
724
726
|
export function distributedWith(n, maximumLag, decide, __tsplusTrace) {
|
|
725
727
|
return self => {
|
|
726
728
|
return tsplus_module_1.flatMap(p => tsplus_module_1.flatMap(next => tsplus_module_1.flatMap(entries => {
|
|
727
|
-
const [mappings, queues] = tsplus_module_12.foldRight([
|
|
728
|
-
return tsplus_module_1.as(() => queues, __tsplusTrace)(
|
|
729
|
-
}, __tsplusTrace)(tsplus_module_1.sequenceIterable(tsplus_module_12.map(id => tsplus_module_1.map(([key, queue]) => [[key, id], queue], __tsplusTrace)(next))(tsplus_module_19.range(0, n)), __tsplusTrace)), __tsplusTrace)(distributedWithDynamic_1(maximumLag, a => tsplus_module_1.flatMap(f => f(a), __tsplusTrace)(
|
|
729
|
+
const [mappings, queues] = tsplus_module_12.foldRight([tsplus_module_45.empty(), tsplus_module_7.empty()], ([mapping, queue], [mappings, queues]) => [tsplus_module_45.set(mapping[0], mapping[1])(mappings), tsplus_module_12.append(queue)(queues)])(entries);
|
|
730
|
+
return tsplus_module_1.as(() => queues, __tsplusTrace)(tsplus_module_37.succeed_(a => tsplus_module_1.map(f => key => f(tsplus_module_39.toUndefined(tsplus_module_45.get(key)(mappings))), __tsplusTrace)(decide(a)), __tsplusTrace)(p));
|
|
731
|
+
}, __tsplusTrace)(tsplus_module_1.sequenceIterable(tsplus_module_12.map(id => tsplus_module_1.map(([key, queue]) => [[key, id], queue], __tsplusTrace)(next))(tsplus_module_19.range(0, n)), __tsplusTrace)), __tsplusTrace)(distributedWithDynamic_1(maximumLag, a => tsplus_module_1.flatMap(f => f(a), __tsplusTrace)(tsplus_module_37.wait(p, __tsplusTrace)), () => tsplus_module_1.unit, __tsplusTrace)(self)), __tsplusTrace)(tsplus_module_38.make(__tsplusTrace));
|
|
730
732
|
};
|
|
731
733
|
}
|
|
732
734
|
/**
|
|
@@ -741,20 +743,20 @@ export function distributedWith(n, maximumLag, decide, __tsplusTrace) {
|
|
|
741
743
|
*/
|
|
742
744
|
function distributedWithDynamic_1(maximumLag, decide, done = () => tsplus_module_1.unit, __tsplusTrace) {
|
|
743
745
|
return self => {
|
|
744
|
-
const offer = queuesRef => a => tsplus_module_1.flatMap(shouldProcess => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(ids => tsplus_module_12.isNonEmpty(ids) ? tsplus_module_15.update(map =>
|
|
746
|
+
const offer = queuesRef => a => tsplus_module_1.flatMap(shouldProcess => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(ids => tsplus_module_12.isNonEmpty(ids) ? tsplus_module_15.update(map => tsplus_module_45.removeMany(ids)(map), __tsplusTrace)(queuesRef) : tsplus_module_1.unit, __tsplusTrace)(tsplus_module_1.foldLeft(queues, tsplus_module_7.empty(), (b, [id, queue]) => {
|
|
745
747
|
if (shouldProcess(id)) {
|
|
746
|
-
return tsplus_module_1.matchCauseIO(c => tsplus_module_25.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_12.append(id)(b), __tsplusTrace) : tsplus_module_1.failCauseNow(c, __tsplusTrace), () => tsplus_module_1.succeedNow(b, __tsplusTrace), __tsplusTrace)(
|
|
748
|
+
return tsplus_module_1.matchCauseIO(c => tsplus_module_25.interrupted(c) ? tsplus_module_1.succeedNow(tsplus_module_12.append(id)(b), __tsplusTrace) : tsplus_module_1.failCauseNow(c, __tsplusTrace), () => tsplus_module_1.succeedNow(b, __tsplusTrace), __tsplusTrace)(tsplus_module_28.offer(tsplus_module_41.succeed(a), __tsplusTrace)(queue));
|
|
747
749
|
} else {
|
|
748
750
|
return tsplus_module_1.succeedNow(b, __tsplusTrace);
|
|
749
751
|
}
|
|
750
752
|
}, __tsplusTrace)), __tsplusTrace)(tsplus_module_14.get(queuesRef, __tsplusTrace)), __tsplusTrace)(decide(a));
|
|
751
753
|
return tsplus_module_1.flatMap(queuesRef => tsplus_module_1.map(add => add, __tsplusTrace)(tsplus_module_1.flatMap(queuesLock => tsplus_module_1.flatMap(newQueue => {
|
|
752
|
-
const finalize = endTake =>
|
|
754
|
+
const finalize = endTake => tsplus_module_46.withPermit(queuesLock, __tsplusTrace)(tsplus_module_1.asUnit(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(queues => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, __tsplusTrace)(done(endTake)), __tsplusTrace)(tsplus_module_1.foreach(queues, queue => tsplus_module_1.catchJustCause(c => tsplus_module_25.interrupted(c) ? tsplus_module_3.just(tsplus_module_1.unit) : tsplus_module_3.nothing(), __tsplusTrace)(tsplus_module_28.offer(endTake, __tsplusTrace)(queue)), __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(map => tsplus_module_45.values(map), __tsplusTrace)(tsplus_module_14.get(queuesRef, __tsplusTrace))), __tsplusTrace)(tsplus_module_13.set(tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(() => {
|
|
753
755
|
const id = Symbol();
|
|
754
|
-
return tsplus_module_1.map(() => tuple(id, queue), __tsplusTrace)(tsplus_module_15.update(map =>
|
|
755
|
-
}, __tsplusTrace)(
|
|
756
|
-
return tsplus_module_1.map(() =>
|
|
757
|
-
}, __tsplusTrace)(tsplus_module_6.make(() => tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(id => tsplus_module_1.map(() => tuple(id, queue), __tsplusTrace)(tsplus_module_15.update(map =>
|
|
756
|
+
return tsplus_module_1.map(() => tuple(id, queue), __tsplusTrace)(tsplus_module_15.update(map => tsplus_module_45.set(id, queue)(map), __tsplusTrace)(queuesRef));
|
|
757
|
+
}, __tsplusTrace)(tsplus_module_28.offer(endTake, __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_30.makeBounded(1, __tsplusTrace)), __tsplusTrace)(newQueue)), __tsplusTrace));
|
|
758
|
+
return tsplus_module_1.map(() => tsplus_module_46.withPermit(queuesLock, __tsplusTrace)(tsplus_module_1.flatten(tsplus_module_14.get(newQueue, __tsplusTrace), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_1.matchCauseIO(cause => finalize(tsplus_module_41.failCause(tsplus_module_25.map(tsplus_module_3.just)(cause))), () => finalize(tsplus_module_41.fail(tsplus_module_3.nothing())), __tsplusTrace)(runForeachScoped_1(offer(queuesRef), __tsplusTrace)(self)), __tsplusTrace));
|
|
759
|
+
}, __tsplusTrace)(tsplus_module_6.make(() => tsplus_module_1.flatMap(queue => tsplus_module_1.flatMap(id => tsplus_module_1.map(() => tuple(id, queue), __tsplusTrace)(tsplus_module_15.update(map => tsplus_module_45.set(id, queue)(map), __tsplusTrace)(queuesRef)), __tsplusTrace)(tsplus_module_1.succeed(() => Symbol(), __tsplusTrace)), __tsplusTrace)(tsplus_module_30.makeBounded(maximumLag, __tsplusTrace)), __tsplusTrace)), __tsplusTrace)(tsplus_module_48.atomically(tsplus_module_47.make(1, __tsplusTrace), __tsplusTrace))), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_6.make(() => tsplus_module_45.empty(), __tsplusTrace), ref => tsplus_module_1.flatMap(qs => tsplus_module_1.foreach(tsplus_module_45.values(qs), q => tsplus_module_28.shutdown(q, __tsplusTrace), __tsplusTrace), __tsplusTrace)(tsplus_module_14.get(ref, __tsplusTrace)), __tsplusTrace));
|
|
758
760
|
};
|
|
759
761
|
}
|
|
760
762
|
/**
|
|
@@ -792,7 +794,7 @@ function drop_1(n, __tsplusTrace) {
|
|
|
792
794
|
*/
|
|
793
795
|
function dropWhile_1(p, __tsplusTrace) {
|
|
794
796
|
return stream => {
|
|
795
|
-
return pipeThrough_1(
|
|
797
|
+
return pipeThrough_1(tsplus_module_49.makeDropWhile(p, __tsplusTrace), __tsplusTrace)(stream);
|
|
796
798
|
};
|
|
797
799
|
}
|
|
798
800
|
/**
|
|
@@ -803,7 +805,7 @@ function dropWhile_1(p, __tsplusTrace) {
|
|
|
803
805
|
*/
|
|
804
806
|
export function dropUntil(p, __tsplusTrace) {
|
|
805
807
|
return stream => {
|
|
806
|
-
return drop_1(1, __tsplusTrace)(dropWhile_1(
|
|
808
|
+
return drop_1(1, __tsplusTrace)(dropWhile_1(tsplus_module_50.invert(p), __tsplusTrace)(stream));
|
|
807
809
|
};
|
|
808
810
|
}
|
|
809
811
|
/**
|
|
@@ -824,7 +826,7 @@ export function either(stream, __tsplusTrace) {
|
|
|
824
826
|
const empty_1 = /*#__PURE__*/fromChunkNow_1( /*#__PURE__*/tsplus_module_7.empty(), fileName_1 + ":1220:70");
|
|
825
827
|
export const empty = empty_1;
|
|
826
828
|
function endWhenWriter(fiber, __tsplusTrace) {
|
|
827
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_20.match(() => tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(endWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(inp)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit =>
|
|
829
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_20.match(() => tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(endWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(inp)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_36.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_51.poll(fiber, __tsplusTrace)));
|
|
828
830
|
}
|
|
829
831
|
/**
|
|
830
832
|
* Halts the evaluation of this stream when the provided IO completes. The given IO
|
|
@@ -854,7 +856,7 @@ function ensuring_1(finalizer, __tsplusTrace) {
|
|
|
854
856
|
* @tsplus static fncts.io.StreamOps environment
|
|
855
857
|
*/
|
|
856
858
|
function environment_1(__tsplusTrace) {
|
|
857
|
-
return fromIO_1(
|
|
859
|
+
return fromIO_1(tsplus_module_52.environment(__tsplusTrace), __tsplusTrace);
|
|
858
860
|
}
|
|
859
861
|
/**
|
|
860
862
|
* Accesses the environment of the stream.
|
|
@@ -922,7 +924,7 @@ export function filter(predicate, __tsplusTrace) {
|
|
|
922
924
|
*/
|
|
923
925
|
export function filterIO(f, __tsplusTrace) {
|
|
924
926
|
return fa => {
|
|
925
|
-
return new Stream(tsplus_module_10.pipeTo(filterIOLoop(
|
|
927
|
+
return new Stream(tsplus_module_10.pipeTo(filterIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
|
|
926
928
|
};
|
|
927
929
|
}
|
|
928
930
|
function filterIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -946,7 +948,7 @@ function filterMap_1(f, __tsplusTrace) {
|
|
|
946
948
|
*/
|
|
947
949
|
export function filterMapIO(f, __tsplusTrace) {
|
|
948
950
|
return fa => {
|
|
949
|
-
return new Stream(tsplus_module_10.pipeTo(filterMapIOLoop(
|
|
951
|
+
return new Stream(tsplus_module_10.pipeTo(filterMapIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(fa.channel));
|
|
950
952
|
};
|
|
951
953
|
}
|
|
952
954
|
function filterMapIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -975,7 +977,7 @@ export function find(p, __tsplusTrace) {
|
|
|
975
977
|
*/
|
|
976
978
|
export function findIO(f, __tsplusTrace) {
|
|
977
979
|
return stream => {
|
|
978
|
-
const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeA => tsplus_module_20.match(() => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a)))(maybeA), __tsplusTrace)(
|
|
980
|
+
const loop = tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeA => tsplus_module_20.match(() => loop, a => tsplus_module_10.writeNow(tsplus_module_19.single(a)))(maybeA), __tsplusTrace)(tsplus_module_53.findIO(f, __tsplusTrace)(inp))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
|
979
981
|
return new Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
|
|
980
982
|
};
|
|
981
983
|
}
|
|
@@ -997,9 +999,9 @@ function flatten_1(self, __tsplusTrace) {
|
|
|
997
999
|
*/
|
|
998
1000
|
function flattenExitOption_1(stream, __tsplusTrace) {
|
|
999
1001
|
const processChunk = (chunk, cont) => {
|
|
1000
|
-
const [toEmit, rest] = tsplus_module_12.splitWhere(_ => !
|
|
1001
|
-
const next = tsplus_module_20.match(() => cont, exit =>
|
|
1002
|
-
return tsplus_module_11.zipRight(next)(tsplus_module_10.writeNow(tsplus_module_12.filterMap(exit =>
|
|
1002
|
+
const [toEmit, rest] = tsplus_module_12.splitWhere(_ => !tsplus_module_54.isSuccess(_))(chunk);
|
|
1003
|
+
const next = tsplus_module_20.match(() => cont, exit => tsplus_module_36.match(cause => tsplus_module_20.match(() => tsplus_module_11.endNow(undefined), tsplus_module_11.failCauseNow)(tsplus_module_25.flipCauseOption(cause)), () => tsplus_module_11.endNow(undefined))(exit))(tsplus_module_12.head(rest));
|
|
1004
|
+
return tsplus_module_11.zipRight(next)(tsplus_module_10.writeNow(tsplus_module_12.filterMap(exit => tsplus_module_36.match(() => tsplus_module_3.nothing(), tsplus_module_3.just)(exit))(toEmit)));
|
|
1003
1005
|
};
|
|
1004
1006
|
const process = tsplus_module_10.readWithCause(chunk => processChunk(chunk, process), tsplus_module_11.failCauseNow, _ => tsplus_module_11.endNow(undefined));
|
|
1005
1007
|
return new Stream(tsplus_module_10.pipeTo(process)(stream.channel));
|
|
@@ -1133,29 +1135,29 @@ function fromPull_1(scopedPull, __tsplusTrace) {
|
|
|
1133
1135
|
function fromQueue_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1134
1136
|
return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause(c => tsplus_module_1.flatMap(down => {
|
|
1135
1137
|
if (down && tsplus_module_25.interrupted(c)) {
|
|
1136
|
-
return
|
|
1138
|
+
return tsplus_module_55.end;
|
|
1137
1139
|
} else {
|
|
1138
|
-
return
|
|
1140
|
+
return tsplus_module_55.failCause(c);
|
|
1139
1141
|
}
|
|
1140
|
-
}, __tsplusTrace)(
|
|
1142
|
+
}, __tsplusTrace)(tsplus_module_28.isShutdown(queue, __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(tsplus_module_19.from, __tsplusTrace)(tsplus_module_56.takeBetween(1, maxChunkSize, __tsplusTrace)(queue))), __tsplusTrace);
|
|
1141
1143
|
}
|
|
1142
1144
|
/**
|
|
1143
1145
|
* @tsplus static fncts.io.StreamOps fromQueueWithShutdown
|
|
1144
1146
|
*/
|
|
1145
1147
|
function fromQueueWithShutdown_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1146
|
-
return ensuring_1(
|
|
1148
|
+
return ensuring_1(tsplus_module_28.shutdown(queue, __tsplusTrace), __tsplusTrace)(fromQueue_1(queue, maxChunkSize, __tsplusTrace));
|
|
1147
1149
|
}
|
|
1148
1150
|
/**
|
|
1149
1151
|
* @tsplus static fncts.io.StreamOps fromHub
|
|
1150
1152
|
*/
|
|
1151
1153
|
export function fromHub(hub, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1152
|
-
return flatMap_1(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(scoped_1(() =>
|
|
1154
|
+
return flatMap_1(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(scoped_1(() => tsplus_module_34.subscribe(hub(), __tsplusTrace), __tsplusTrace));
|
|
1153
1155
|
}
|
|
1154
1156
|
/**
|
|
1155
1157
|
* @tsplus static fncts.io.StreamOps fromHubScoped
|
|
1156
1158
|
*/
|
|
1157
1159
|
export function fromHubScoped(hub, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
|
1158
|
-
return tsplus_module_1.defer(() => tsplus_module_1.map(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(
|
|
1160
|
+
return tsplus_module_1.defer(() => tsplus_module_1.map(queue => fromQueueWithShutdown_1(queue, maxChunkSize, __tsplusTrace), __tsplusTrace)(tsplus_module_34.subscribe(hub(), __tsplusTrace)), __tsplusTrace);
|
|
1159
1161
|
}
|
|
1160
1162
|
/**
|
|
1161
1163
|
* Halt a stream with the specified exception
|
|
@@ -1174,7 +1176,7 @@ function halt_1(u, __tsplusTrace) {
|
|
|
1174
1176
|
return new Stream(tsplus_module_10.halt(u));
|
|
1175
1177
|
}
|
|
1176
1178
|
function haltWhenWriter(fiber, __tsplusTrace) {
|
|
1177
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_20.match(() => tsplus_module_10.readWith(i => tsplus_module_11.zipRight(haltWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit =>
|
|
1179
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeExit => tsplus_module_20.match(() => tsplus_module_10.readWith(i => tsplus_module_11.zipRight(haltWhenWriter(fiber, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), exit => tsplus_module_36.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_51.poll(fiber, __tsplusTrace)));
|
|
1178
1180
|
}
|
|
1179
1181
|
/**
|
|
1180
1182
|
* Halts the evaluation of this stream when the provided IO completes. The
|
|
@@ -1194,7 +1196,7 @@ export function haltWhen(io, __tsplusTrace) {
|
|
|
1194
1196
|
};
|
|
1195
1197
|
}
|
|
1196
1198
|
function haltWhenFutureWriter(future, __tsplusTrace) {
|
|
1197
|
-
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeIO => tsplus_module_20.match(() => tsplus_module_10.readWith(i => tsplus_module_11.zipRight(haltWhenFutureWriter(future, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), io => tsplus_module_10.unwrap(() => tsplus_module_1.match(tsplus_module_10.failNow, () => tsplus_module_10.unit, __tsplusTrace)(io)))(maybeIO), __tsplusTrace)(
|
|
1199
|
+
return tsplus_module_10.unwrap(() => tsplus_module_1.map(maybeIO => tsplus_module_20.match(() => tsplus_module_10.readWith(i => tsplus_module_11.zipRight(haltWhenFutureWriter(future, __tsplusTrace))(tsplus_module_10.writeNow(i)), tsplus_module_10.failNow, () => tsplus_module_10.unit), io => tsplus_module_10.unwrap(() => tsplus_module_1.match(tsplus_module_10.failNow, () => tsplus_module_10.unit, __tsplusTrace)(io)))(maybeIO), __tsplusTrace)(tsplus_module_37.poll(future, __tsplusTrace)));
|
|
1198
1200
|
}
|
|
1199
1201
|
/**
|
|
1200
1202
|
* Halts the evaluation of this stream when the provided promise resolves.
|
|
@@ -1217,7 +1219,7 @@ export function interleave(sb, __tsplusTrace) {
|
|
|
1217
1219
|
};
|
|
1218
1220
|
}
|
|
1219
1221
|
function interleaveWithProducer(handoff, __tsplusTrace) {
|
|
1220
|
-
return tsplus_module_10.readWithCause(value => tsplus_module_11.zipRight(interleaveWithProducer(handoff, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(
|
|
1222
|
+
return tsplus_module_10.readWithCause(value => tsplus_module_11.zipRight(interleaveWithProducer(handoff, __tsplusTrace))(tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.single(value))(handoff))), cause => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.failCause(cause))(handoff)), () => tsplus_module_10.fromIO(() => tsplus_module_5.offer(tsplus_module_27.end)(handoff)));
|
|
1221
1223
|
}
|
|
1222
1224
|
/**
|
|
1223
1225
|
* Combines this stream and the specified stream deterministically using the
|
|
@@ -1234,15 +1236,15 @@ function interleaveWith_1(sb, b, __tsplusTrace) {
|
|
|
1234
1236
|
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(([left, right]) => {
|
|
1235
1237
|
const process = (leftDone, rightDone) => tsplus_module_10.readWithCause(b => {
|
|
1236
1238
|
if (b && !leftDone) {
|
|
1237
|
-
return tsplus_module_11.flatMap(take =>
|
|
1239
|
+
return tsplus_module_11.flatMap(take => tsplus_module_27.match(rightDone ? tsplus_module_10.unit : process(true, rightDone), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.zipRight(process(leftDone, rightDone))(tsplus_module_10.writeNow(chunk)))(take))(tsplus_module_10.fromIO(() => tsplus_module_5.take(left)));
|
|
1238
1240
|
}
|
|
1239
1241
|
if (!b && !rightDone) {
|
|
1240
|
-
return tsplus_module_11.flatMap(take =>
|
|
1242
|
+
return tsplus_module_11.flatMap(take => tsplus_module_27.match(leftDone ? tsplus_module_10.unit : process(leftDone, true), tsplus_module_11.failCauseNow, chunk => tsplus_module_11.zipRight(process(leftDone, rightDone))(tsplus_module_10.writeNow(chunk)))(take))(tsplus_module_10.fromIO(() => tsplus_module_5.take(right)));
|
|
1241
1243
|
}
|
|
1242
1244
|
return process(leftDone, rightDone);
|
|
1243
1245
|
}, tsplus_module_11.failCauseNow, () => tsplus_module_10.unit);
|
|
1244
1246
|
return tsplus_module_10.pipeTo(process(false, false))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(b.channel));
|
|
1245
|
-
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right), __tsplusTrace)(
|
|
1247
|
+
}, __tsplusTrace)(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => tuple(left, right), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(interleaveWithProducer(right, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(sb.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_33.fork(tsplus_module_16.runScoped(tsplus_module_10.pipeTo(interleaveWithProducer(left, __tsplusTrace))(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(sa.channel))), __tsplusTrace)), __tsplusTrace)(tsplus_module_5.make()), __tsplusTrace)(tsplus_module_5.make()))));
|
|
1246
1248
|
};
|
|
1247
1249
|
}
|
|
1248
1250
|
function intersperseWriter(middle, isFirst, __tsplusTrace) {
|
|
@@ -1279,7 +1281,7 @@ export function intersperse(stream, middle, __tsplusTrace) {
|
|
|
1279
1281
|
*/
|
|
1280
1282
|
export function interruptWhen(io, __tsplusTrace) {
|
|
1281
1283
|
return stream => {
|
|
1282
|
-
return new Stream(
|
|
1284
|
+
return new Stream(tsplus_module_57.interruptWhen(io)(stream.channel));
|
|
1283
1285
|
};
|
|
1284
1286
|
}
|
|
1285
1287
|
/**
|
|
@@ -1287,7 +1289,7 @@ export function interruptWhen(io, __tsplusTrace) {
|
|
|
1287
1289
|
*/
|
|
1288
1290
|
export function interruptWhenFuture(future, __tsplusTrace) {
|
|
1289
1291
|
return fa => {
|
|
1290
|
-
return new Stream(
|
|
1292
|
+
return new Stream(tsplus_module_57.interruptWhenFuture(future)(fa.channel));
|
|
1291
1293
|
};
|
|
1292
1294
|
}
|
|
1293
1295
|
/**
|
|
@@ -1430,7 +1432,7 @@ export function mapErrorCause(f, __tsplusTrace) {
|
|
|
1430
1432
|
*/
|
|
1431
1433
|
function mapIO_1(f, __tsplusTrace) {
|
|
1432
1434
|
return stream => {
|
|
1433
|
-
return new Stream(tsplus_module_10.pipeTo(mapIOLoop(
|
|
1435
|
+
return new Stream(tsplus_module_10.pipeTo(mapIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(stream.channel));
|
|
1434
1436
|
};
|
|
1435
1437
|
}
|
|
1436
1438
|
function mapIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -1452,7 +1454,7 @@ function mapIOLoop(iterator, f, __tsplusTrace) {
|
|
|
1452
1454
|
*/
|
|
1453
1455
|
export function mapIOC(n, f, __tsplusTrace) {
|
|
1454
1456
|
return stream => {
|
|
1455
|
-
return new Stream(tsplus_module_10.mapOut(tsplus_module_19.single)(
|
|
1457
|
+
return new Stream(tsplus_module_10.mapOut(tsplus_module_19.single)(tsplus_module_58.mapOutConcurrentIO(n, f)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(stream.channel))));
|
|
1456
1458
|
};
|
|
1457
1459
|
}
|
|
1458
1460
|
/**
|
|
@@ -1465,7 +1467,7 @@ export function mapIOC(n, f, __tsplusTrace) {
|
|
|
1465
1467
|
*/
|
|
1466
1468
|
function mergeMap_1(f, n, bufferSize = 16, __tsplusTrace) {
|
|
1467
1469
|
return ma => {
|
|
1468
|
-
return new Stream(
|
|
1470
|
+
return new Stream(tsplus_module_59.mergeMap(a => f(a).channel, n, bufferSize)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(ma.channel)));
|
|
1469
1471
|
};
|
|
1470
1472
|
}
|
|
1471
1473
|
/**
|
|
@@ -1489,14 +1491,14 @@ function mergeEither_1(fb, __tsplusTrace) {
|
|
|
1489
1491
|
};
|
|
1490
1492
|
}
|
|
1491
1493
|
export function mergeWithHandler(terminate, __tsplusTrace) {
|
|
1492
|
-
return exit => terminate || !
|
|
1494
|
+
return exit => terminate || !tsplus_module_54.isSuccess(exit) ? tsplus_module_60.done(tsplus_module_1.fromExitNow(exit, __tsplusTrace)) : tsplus_module_60.wait(tsplus_module_1.fromExitNow);
|
|
1493
1495
|
}
|
|
1494
1496
|
/**
|
|
1495
1497
|
* @tsplus pipeable fncts.io.Stream mergeWith
|
|
1496
1498
|
*/
|
|
1497
1499
|
function mergeWith_1(sb, l, r, strategy = "Both", __tsplusTrace) {
|
|
1498
1500
|
return sa => {
|
|
1499
|
-
return new Stream(
|
|
1501
|
+
return new Stream(tsplus_module_61.mergeWith(map_1(r, __tsplusTrace)(sb).channel, mergeWithHandler(strategy === "Either" || strategy === "Left", __tsplusTrace), mergeWithHandler(strategy === "Either" || strategy === "Right", __tsplusTrace))(map_1(l, __tsplusTrace)(sa).channel));
|
|
1500
1502
|
};
|
|
1501
1503
|
}
|
|
1502
1504
|
/**
|
|
@@ -1589,7 +1591,7 @@ function provideEnvironment_1(r, __tsplusTrace) {
|
|
|
1589
1591
|
*/
|
|
1590
1592
|
function provideLayer_1(layer, __tsplusTrace) {
|
|
1591
1593
|
return self => {
|
|
1592
|
-
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(r => tsplus_module_10.provideEnvironment(() => r)(self.channel), __tsplusTrace)(
|
|
1594
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(r => tsplus_module_10.provideEnvironment(() => r)(self.channel), __tsplusTrace)(tsplus_module_62.build(layer, __tsplusTrace))));
|
|
1593
1595
|
};
|
|
1594
1596
|
}
|
|
1595
1597
|
/**
|
|
@@ -1598,7 +1600,7 @@ function provideLayer_1(layer, __tsplusTrace) {
|
|
|
1598
1600
|
export function provideSomeLayer(layer, __tsplusTrace) {
|
|
1599
1601
|
return self => {
|
|
1600
1602
|
// @ts-expect-error
|
|
1601
|
-
return provideLayer_1(
|
|
1603
|
+
return provideLayer_1(tsplus_module_63.and(layer, __tsplusTrace)(tsplus_module_63.environment(__tsplusTrace)), __tsplusTrace)(self);
|
|
1602
1604
|
};
|
|
1603
1605
|
}
|
|
1604
1606
|
class Rechunker {
|
|
@@ -1712,7 +1714,7 @@ function repeatIOChunkMaybe_1(fa, __tsplusTrace) {
|
|
|
1712
1714
|
*/
|
|
1713
1715
|
function run_1(sink, __tsplusTrace) {
|
|
1714
1716
|
return stream => {
|
|
1715
|
-
return
|
|
1717
|
+
return tsplus_module_64.runDrain(tsplus_module_10.pipeToOrFail(sink.channel)(stream.channel));
|
|
1716
1718
|
};
|
|
1717
1719
|
}
|
|
1718
1720
|
/**
|
|
@@ -1721,7 +1723,7 @@ function run_1(sink, __tsplusTrace) {
|
|
|
1721
1723
|
* @tsplus getter fncts.io.Stream runCollect
|
|
1722
1724
|
*/
|
|
1723
1725
|
export function runCollect(stream, __tsplusTrace) {
|
|
1724
|
-
return run_1(
|
|
1726
|
+
return run_1(tsplus_module_49.makeCollectAll(__tsplusTrace), __tsplusTrace)(stream);
|
|
1725
1727
|
}
|
|
1726
1728
|
/**
|
|
1727
1729
|
* Runs the stream and collects ignore its elements.
|
|
@@ -1729,14 +1731,14 @@ export function runCollect(stream, __tsplusTrace) {
|
|
|
1729
1731
|
* @tsplus getter fncts.io.Stream runDrain
|
|
1730
1732
|
*/
|
|
1731
1733
|
export function runDrain(stream, __tsplusTrace) {
|
|
1732
|
-
return run_1(
|
|
1734
|
+
return run_1(tsplus_module_49.drain, __tsplusTrace)(stream);
|
|
1733
1735
|
}
|
|
1734
1736
|
/**
|
|
1735
1737
|
* @tsplus pipeable fncts.io.Stream runForeachScoped
|
|
1736
1738
|
*/
|
|
1737
1739
|
function runForeachScoped_1(f, __tsplusTrace) {
|
|
1738
1740
|
return self => {
|
|
1739
|
-
return runScoped_1(
|
|
1741
|
+
return runScoped_1(tsplus_module_49.makeForeach(f, __tsplusTrace), __tsplusTrace)(self);
|
|
1740
1742
|
};
|
|
1741
1743
|
}
|
|
1742
1744
|
/**
|
|
@@ -1747,8 +1749,8 @@ function runForeachScoped_1(f, __tsplusTrace) {
|
|
|
1747
1749
|
*/
|
|
1748
1750
|
function runIntoElementsScoped_1(queue, __tsplusTrace) {
|
|
1749
1751
|
return stream => {
|
|
1750
|
-
const writer = tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(writer)(tsplus_module_12.foldLeft(tsplus_module_10.unit, (channel, a) => tsplus_module_11.zipRight(tsplus_module_10.writeNow(
|
|
1751
|
-
return tsplus_module_1.asUnit(tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO(exit =>
|
|
1752
|
+
const writer = tsplus_module_10.readWith(inp => tsplus_module_11.zipRight(writer)(tsplus_module_12.foldLeft(tsplus_module_10.unit, (channel, a) => tsplus_module_11.zipRight(tsplus_module_10.writeNow(tsplus_module_41.succeed(a)))(channel))(inp)), err => tsplus_module_10.writeNow(tsplus_module_41.fail(tsplus_module_3.just(err))), () => tsplus_module_10.writeNow(tsplus_module_41.fail(tsplus_module_3.nothing())));
|
|
1753
|
+
return tsplus_module_1.asUnit(tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO(exit => tsplus_module_28.offer(exit, __tsplusTrace)(queue))(tsplus_module_10.pipeTo(writer)(stream.channel)))), __tsplusTrace);
|
|
1752
1754
|
};
|
|
1753
1755
|
}
|
|
1754
1756
|
/**
|
|
@@ -1759,8 +1761,8 @@ function runIntoElementsScoped_1(queue, __tsplusTrace) {
|
|
|
1759
1761
|
*/
|
|
1760
1762
|
function runIntoQueueScoped_1(queue, __tsplusTrace) {
|
|
1761
1763
|
return stream => {
|
|
1762
|
-
const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.zipRight(writer)(tsplus_module_10.writeNow(
|
|
1763
|
-
return tsplus_module_1.asUnit(tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO(take =>
|
|
1764
|
+
const writer = tsplus_module_10.readWithCause(inp => tsplus_module_11.zipRight(writer)(tsplus_module_10.writeNow(tsplus_module_27.chunk(inp))), cause => tsplus_module_10.writeNow(tsplus_module_27.failCause(cause)), _ => tsplus_module_10.writeNow(tsplus_module_27.end));
|
|
1765
|
+
return tsplus_module_1.asUnit(tsplus_module_16.runScoped(tsplus_module_10.drain(tsplus_module_10.mapOutIO(take => tsplus_module_28.offer(take, __tsplusTrace)(queue))(tsplus_module_10.pipeTo(writer)(stream.channel)))), __tsplusTrace);
|
|
1764
1766
|
};
|
|
1765
1767
|
}
|
|
1766
1768
|
/**
|
|
@@ -1866,7 +1868,7 @@ export function take(n, __tsplusTrace) {
|
|
|
1866
1868
|
return empty_1;
|
|
1867
1869
|
}
|
|
1868
1870
|
if (!Number.isInteger(n)) {
|
|
1869
|
-
return halt_1(() => new
|
|
1871
|
+
return halt_1(() => new tsplus_module_65.IllegalArgumentError(`${n} should be an integer`, "Stream.take"), __tsplusTrace);
|
|
1870
1872
|
}
|
|
1871
1873
|
return new Stream(tsplus_module_10.pipeTo(takeLoop(n, __tsplusTrace))(stream.channel));
|
|
1872
1874
|
};
|
|
@@ -1876,7 +1878,7 @@ export function take(n, __tsplusTrace) {
|
|
|
1876
1878
|
*/
|
|
1877
1879
|
export function takeUntilIO(f, __tsplusTrace) {
|
|
1878
1880
|
return ma => {
|
|
1879
|
-
return new Stream(tsplus_module_10.pipeTo(takeUntilIOLoop(
|
|
1881
|
+
return new Stream(tsplus_module_10.pipeTo(takeUntilIOLoop(tsplus_module_40.empty()[Symbol.iterator](), f, __tsplusTrace))(ma.channel));
|
|
1880
1882
|
};
|
|
1881
1883
|
}
|
|
1882
1884
|
function takeUntilIOLoop(iterator, f, __tsplusTrace) {
|
|
@@ -1889,7 +1891,7 @@ function takeUntilIOLoop(iterator, f, __tsplusTrace) {
|
|
|
1889
1891
|
}
|
|
1890
1892
|
function takeUntilLoop(p, __tsplusTrace) {
|
|
1891
1893
|
return tsplus_module_10.readWith(chunk => {
|
|
1892
|
-
const taken = tsplus_module_12.takeWhile(
|
|
1894
|
+
const taken = tsplus_module_12.takeWhile(tsplus_module_50.invert(p))(chunk);
|
|
1893
1895
|
const last = tsplus_module_12.take(1)(tsplus_module_12.drop(taken.length)(chunk));
|
|
1894
1896
|
if (tsplus_module_12.isEmpty(last)) {
|
|
1895
1897
|
return tsplus_module_11.zipRight(takeUntilLoop(p, __tsplusTrace))(tsplus_module_10.writeNow(taken));
|
|
@@ -1931,7 +1933,7 @@ export function throttleEnforce(costFn, units, duration, burst = 0, __tsplusTrac
|
|
|
1931
1933
|
};
|
|
1932
1934
|
}
|
|
1933
1935
|
function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp, __tsplusTrace) {
|
|
1934
|
-
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.zipWith(
|
|
1936
|
+
return tsplus_module_10.readWith(inp => tsplus_module_10.unwrap(() => tsplus_module_1.zipWith(tsplus_module_43.currentTime, (weight, current) => {
|
|
1935
1937
|
const elapsed = current - timestamp;
|
|
1936
1938
|
const cycles = elapsed / duration;
|
|
1937
1939
|
const available = (() => {
|
|
@@ -1952,7 +1954,7 @@ function throttleEnforceIOLoop(costFn, units, duration, burst, tokens, timestamp
|
|
|
1952
1954
|
*/
|
|
1953
1955
|
function throttleEnforceIO_1(costFn, units, duration, burst = 0, __tsplusTrace) {
|
|
1954
1956
|
return sa => {
|
|
1955
|
-
return new Stream(tsplus_module_11.flatMap(current => tsplus_module_10.pipeTo(throttleEnforceIOLoop(costFn, units, duration, burst, units, current, __tsplusTrace))(sa.channel))(tsplus_module_10.fromIO(() =>
|
|
1957
|
+
return new Stream(tsplus_module_11.flatMap(current => tsplus_module_10.pipeTo(throttleEnforceIOLoop(costFn, units, duration, burst, units, current, __tsplusTrace))(sa.channel))(tsplus_module_10.fromIO(() => tsplus_module_43.currentTime)));
|
|
1956
1958
|
};
|
|
1957
1959
|
}
|
|
1958
1960
|
/**
|
|
@@ -1963,7 +1965,7 @@ function throttleEnforceIO_1(costFn, units, duration, burst = 0, __tsplusTrace)
|
|
|
1963
1965
|
*/
|
|
1964
1966
|
function toHub_1(capacity, __tsplusTrace) {
|
|
1965
1967
|
return stream => {
|
|
1966
|
-
return tsplus_module_1.flatMap(hub => tsplus_module_1.map(() => hub, __tsplusTrace)(
|
|
1968
|
+
return tsplus_module_1.flatMap(hub => tsplus_module_1.map(() => hub, __tsplusTrace)(tsplus_module_33.fork(runIntoHubScoped_1(hub, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_34.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_34.shutdown(_, __tsplusTrace), __tsplusTrace));
|
|
1967
1969
|
};
|
|
1968
1970
|
}
|
|
1969
1971
|
/**
|
|
@@ -1972,7 +1974,7 @@ function toHub_1(capacity, __tsplusTrace) {
|
|
|
1972
1974
|
* @tsplus getter fncts.io.Stream toPull
|
|
1973
1975
|
*/
|
|
1974
1976
|
function toPull_1(stream, __tsplusTrace) {
|
|
1975
|
-
return tsplus_module_1.map(io => tsplus_module_1.flatMap(r => tsplus_module_4.match(() => tsplus_module_1.failNow(tsplus_module_3.nothing(), __tsplusTrace), tsplus_module_1.succeedNow)(r), __tsplusTrace)(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(io)), __tsplusTrace)(
|
|
1977
|
+
return tsplus_module_1.map(io => tsplus_module_1.flatMap(r => tsplus_module_4.match(() => tsplus_module_1.failNow(tsplus_module_3.nothing(), __tsplusTrace), tsplus_module_1.succeedNow)(r), __tsplusTrace)(tsplus_module_1.mapError(tsplus_module_3.just, __tsplusTrace)(io)), __tsplusTrace)(tsplus_module_66.toPull(stream.channel));
|
|
1976
1978
|
}
|
|
1977
1979
|
/**
|
|
1978
1980
|
* Converts the stream to a managed queue of chunks. After the managed queue is used,
|
|
@@ -1982,7 +1984,7 @@ function toPull_1(stream, __tsplusTrace) {
|
|
|
1982
1984
|
*/
|
|
1983
1985
|
function toQueue_1(capacity = 2, __tsplusTrace) {
|
|
1984
1986
|
return stream => {
|
|
1985
|
-
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(
|
|
1987
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
|
|
1986
1988
|
};
|
|
1987
1989
|
}
|
|
1988
1990
|
/**
|
|
@@ -1990,7 +1992,7 @@ function toQueue_1(capacity = 2, __tsplusTrace) {
|
|
|
1990
1992
|
*/
|
|
1991
1993
|
export function toQueueDropping(capacity = 2, __tsplusTrace) {
|
|
1992
1994
|
return stream => {
|
|
1993
|
-
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(
|
|
1995
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeDropping(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
|
|
1994
1996
|
};
|
|
1995
1997
|
}
|
|
1996
1998
|
/**
|
|
@@ -1998,7 +2000,7 @@ export function toQueueDropping(capacity = 2, __tsplusTrace) {
|
|
|
1998
2000
|
*/
|
|
1999
2001
|
function toQueueOfElements_1(capacity = 2, __tsplusTrace) {
|
|
2000
2002
|
return stream => {
|
|
2001
|
-
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(
|
|
2003
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoElementsScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeBounded(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
|
|
2002
2004
|
};
|
|
2003
2005
|
}
|
|
2004
2006
|
/**
|
|
@@ -2006,7 +2008,7 @@ function toQueueOfElements_1(capacity = 2, __tsplusTrace) {
|
|
|
2006
2008
|
*/
|
|
2007
2009
|
export function toQueueSliding(capacity = 2, __tsplusTrace) {
|
|
2008
2010
|
return stream => {
|
|
2009
|
-
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(
|
|
2011
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeSliding(capacity, __tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
|
|
2010
2012
|
};
|
|
2011
2013
|
}
|
|
2012
2014
|
/**
|
|
@@ -2016,7 +2018,7 @@ export function toQueueSliding(capacity = 2, __tsplusTrace) {
|
|
|
2016
2018
|
* @tsplus getter fncts.io.Stream toQueueUnbounded
|
|
2017
2019
|
*/
|
|
2018
2020
|
function toQueueUnbounded_1(stream, __tsplusTrace) {
|
|
2019
|
-
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(
|
|
2021
|
+
return tsplus_module_1.flatMap(queue => tsplus_module_1.map(() => queue, __tsplusTrace)(tsplus_module_33.fork(runIntoQueueScoped_1(queue, __tsplusTrace)(stream), __tsplusTrace)), __tsplusTrace)(tsplus_module_31.acquireRelease(() => tsplus_module_30.makeUnbounded(__tsplusTrace), _ => tsplus_module_28.shutdown(_, __tsplusTrace), __tsplusTrace));
|
|
2020
2022
|
}
|
|
2021
2023
|
function unfoldChunkIOLoop(s, f, __tsplusTrace) {
|
|
2022
2024
|
return tsplus_module_10.unwrap(() => tsplus_module_1.map(m => tsplus_module_20.match(() => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap(() => unfoldChunkIOLoop(s, f, __tsplusTrace))(tsplus_module_10.writeNow(as)))(m), __tsplusTrace)(f(s)));
|
|
@@ -2035,7 +2037,7 @@ function unfoldChunkIO_1(s, f, __tsplusTrace) {
|
|
|
2035
2037
|
* @tsplus static fncts.io.StreamOps unfoldIO
|
|
2036
2038
|
*/
|
|
2037
2039
|
function unfoldIO_1(s, f, __tsplusTrace) {
|
|
2038
|
-
return unfoldChunkIO_1(s, _ => tsplus_module_1.map(m =>
|
|
2040
|
+
return unfoldChunkIO_1(s, _ => tsplus_module_1.map(m => tsplus_module_39.map(([a, s]) => tuple(tsplus_module_19.single(a), s))(m), __tsplusTrace)(f(_)), __tsplusTrace);
|
|
2039
2041
|
}
|
|
2040
2042
|
function unfoldChunkLoop(s, f, __tsplusTrace) {
|
|
2041
2043
|
return tsplus_module_20.match(() => tsplus_module_10.unit, ([as, s]) => tsplus_module_11.flatMap(() => unfoldChunkLoop(s, f, __tsplusTrace))(tsplus_module_10.writeNow(as)))(f(s));
|
|
@@ -2050,7 +2052,7 @@ function unfoldChunk_1(s, f, __tsplusTrace) {
|
|
|
2050
2052
|
* @tsplus static fncts.io.StreamOps unfold
|
|
2051
2053
|
*/
|
|
2052
2054
|
export function unfold(s, f, __tsplusTrace) {
|
|
2053
|
-
return unfoldChunk_1(s, s =>
|
|
2055
|
+
return unfoldChunk_1(s, s => tsplus_module_39.map(([a, s]) => tuple(tsplus_module_19.single(a), s))(f(s)), __tsplusTrace);
|
|
2054
2056
|
}
|
|
2055
2057
|
/**
|
|
2056
2058
|
* Creates a stream produced from an IO
|
|
@@ -2090,7 +2092,7 @@ export function zipWithLatest(fb, f, __tsplusTrace) {
|
|
|
2090
2092
|
function pullNonEmpty(pull, __tsplusTrace) {
|
|
2091
2093
|
return tsplus_module_1.flatMap(chunk => tsplus_module_12.isNonEmpty(chunk) ? pullNonEmpty(pull, __tsplusTrace) : tsplus_module_1.succeedNow(chunk, __tsplusTrace), __tsplusTrace)(pull);
|
|
2092
2094
|
}
|
|
2093
|
-
return fromPull_1(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => toPull_1(flatMap_1(([l, r, leftFirst]) => flatMap_1(latest => concat_1(flatMap_1(fromChunkNow_1, __tsplusTrace)(mapIO_1(ab => tsplus_module_4.match(leftChunk => tsplus_module_15.modify(([_, rightLatest]) => tuple(tsplus_module_12.map(a => f(a, rightLatest))(leftChunk), tuple(tsplus_module_12.unsafeGet(leftChunk.length - 1)(leftChunk), rightLatest)), __tsplusTrace)(latest), rightChunk => tsplus_module_15.modify(([leftLatest, _]) => tuple(tsplus_module_12.map(b => f(leftLatest, b))(rightChunk), tuple(leftLatest, tsplus_module_12.unsafeGet(rightChunk.length - 1)(rightChunk))), __tsplusTrace)(latest))(ab), __tsplusTrace)(mergeEither_1(repeatIOMaybe_1(right, __tsplusTrace), __tsplusTrace)(repeatIOMaybe_1(left, __tsplusTrace)))), __tsplusTrace)(fromChunk_1(() => leftFirst ? tsplus_module_12.map(b => f(tsplus_module_12.unsafeGet(l.length - 1)(l), b))(r) : tsplus_module_12.map(a => f(a, tsplus_module_12.unsafeGet(r.length - 1)(r)))(l), __tsplusTrace)), __tsplusTrace)(fromIO_1(tsplus_module_6.make(() => tuple(tsplus_module_12.unsafeGet(l.length - 1)(l), tsplus_module_12.unsafeGet(r.length - 1)(r)), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(fromIOMaybe_1(
|
|
2095
|
+
return fromPull_1(tsplus_module_1.flatMap(left => tsplus_module_1.flatMap(right => toPull_1(flatMap_1(([l, r, leftFirst]) => flatMap_1(latest => concat_1(flatMap_1(fromChunkNow_1, __tsplusTrace)(mapIO_1(ab => tsplus_module_4.match(leftChunk => tsplus_module_15.modify(([_, rightLatest]) => tuple(tsplus_module_12.map(a => f(a, rightLatest))(leftChunk), tuple(tsplus_module_12.unsafeGet(leftChunk.length - 1)(leftChunk), rightLatest)), __tsplusTrace)(latest), rightChunk => tsplus_module_15.modify(([leftLatest, _]) => tuple(tsplus_module_12.map(b => f(leftLatest, b))(rightChunk), tuple(leftLatest, tsplus_module_12.unsafeGet(rightChunk.length - 1)(rightChunk))), __tsplusTrace)(latest))(ab), __tsplusTrace)(mergeEither_1(repeatIOMaybe_1(right, __tsplusTrace), __tsplusTrace)(repeatIOMaybe_1(left, __tsplusTrace)))), __tsplusTrace)(fromChunk_1(() => leftFirst ? tsplus_module_12.map(b => f(tsplus_module_12.unsafeGet(l.length - 1)(l), b))(r) : tsplus_module_12.map(a => f(a, tsplus_module_12.unsafeGet(r.length - 1)(r)))(l), __tsplusTrace)), __tsplusTrace)(fromIO_1(tsplus_module_6.make(() => tuple(tsplus_module_12.unsafeGet(l.length - 1)(l), tsplus_module_12.unsafeGet(r.length - 1)(r)), __tsplusTrace), __tsplusTrace)), __tsplusTrace)(fromIOMaybe_1(tsplus_module_26.raceWith(() => right, (leftDone, rightFiber) => tsplus_module_1.zipWith(tsplus_module_22.join(rightFiber, __tsplusTrace), (l, r) => tuple(l, r, true), __tsplusTrace)(tsplus_module_1.fromExitNow(leftDone, __tsplusTrace)), (rightDone, leftFiber) => tsplus_module_1.zipWith(tsplus_module_22.join(leftFiber, __tsplusTrace), (r, l) => tuple(l, r, false), __tsplusTrace)(tsplus_module_1.fromExitNow(rightDone, __tsplusTrace)), __tsplusTrace)(left), __tsplusTrace)), __tsplusTrace), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fb, __tsplusTrace))), __tsplusTrace)(tsplus_module_1.map(pullNonEmpty, __tsplusTrace)(toPull_1(fa, __tsplusTrace))), __tsplusTrace);
|
|
2094
2096
|
};
|
|
2095
2097
|
}
|
|
2096
2098
|
//# sourceMappingURL=api.mjs.map
|