@fncts/io 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- package/IO/api/blocking.d.ts +7 -0
- package/IO.d.ts +1 -0
- package/Ref/Synchronized/definition.d.ts +3 -3
- package/Semaphore.d.ts +30 -0
- package/SubscriptionRef.d.ts +3 -3
- package/_cjs/Channel/api/mapOutConcurrentIO.cjs +14 -16
- package/_cjs/Channel/api/mapOutConcurrentIO.cjs.map +1 -1
- package/_cjs/Channel/api/mergeAllWith.cjs +30 -32
- package/_cjs/Channel/api/mergeAllWith.cjs.map +1 -1
- package/_cjs/IO/api/blocking.cjs +20 -0
- package/_cjs/IO/api/blocking.cjs.map +1 -0
- package/_cjs/IO.cjs +11 -0
- package/_cjs/IO.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/constructors.cjs +4 -5
- package/_cjs/Ref/Synchronized/constructors.cjs.map +1 -1
- package/_cjs/Ref/Synchronized/definition.cjs +1 -2
- package/_cjs/Ref/Synchronized/definition.cjs.map +1 -1
- package/_cjs/Semaphore.cjs +90 -0
- package/_cjs/Semaphore.cjs.map +1 -0
- package/_cjs/Stream/api.cjs +47 -49
- package/_cjs/Stream/api.cjs.map +1 -1
- package/_cjs/SubscriptionRef.cjs +2 -3
- package/_cjs/SubscriptionRef.cjs.map +1 -1
- package/_cjs/internal/BackgroundScheduler.cjs +199 -0
- package/_cjs/internal/BackgroundScheduler.cjs.map +1 -0
- package/_mjs/Channel/api/mapOutConcurrentIO.mjs +14 -16
- package/_mjs/Channel/api/mapOutConcurrentIO.mjs.map +1 -1
- package/_mjs/Channel/api/mergeAllWith.mjs +30 -32
- package/_mjs/Channel/api/mergeAllWith.mjs.map +1 -1
- package/_mjs/IO/api/blocking.mjs +12 -0
- package/_mjs/IO/api/blocking.mjs.map +1 -0
- package/_mjs/IO.mjs +1 -0
- package/_mjs/IO.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/constructors.mjs +4 -5
- package/_mjs/Ref/Synchronized/constructors.mjs.map +1 -1
- package/_mjs/Ref/Synchronized/definition.mjs +1 -2
- package/_mjs/Ref/Synchronized/definition.mjs.map +1 -1
- package/_mjs/Semaphore.mjs +78 -0
- package/_mjs/Semaphore.mjs.map +1 -0
- package/_mjs/Stream/api.mjs +47 -49
- package/_mjs/Stream/api.mjs.map +1 -1
- package/_mjs/SubscriptionRef.mjs +2 -3
- package/_mjs/SubscriptionRef.mjs.map +1 -1
- package/_mjs/internal/BackgroundScheduler.mjs +191 -0
- package/_mjs/internal/BackgroundScheduler.mjs.map +1 -0
- package/_src/Channel/api/mapOutConcurrentIO.ts +1 -1
- package/_src/Channel/api/mergeAllWith.ts +1 -1
- package/_src/IO/api/blocking.ts +9 -0
- package/_src/IO.ts +1 -0
- package/_src/Ref/Synchronized/constructors.ts +2 -2
- package/_src/Ref/Synchronized/definition.ts +1 -1
- package/_src/Semaphore.ts +81 -0
- package/_src/Stream/api.ts +1 -1
- package/_src/SubscriptionRef.ts +2 -2
- package/_src/global.ts +4 -0
- package/_src/internal/BackgroundScheduler.ts +276 -0
- package/global.d.ts +4 -0
- package/internal/BackgroundScheduler.d.ts +47 -0
- package/package.json +2 -2
package/_mjs/Stream/api.mjs
CHANGED
@@ -44,27 +44,25 @@ import * as tsplus_module_42 from "@fncts/io/Stream/internal/DebounceState";
|
|
44
44
|
import * as tsplus_module_43 from "@fncts/io/Clock/api";
|
45
45
|
import * as tsplus_module_44 from "@fncts/io/IO/api/transplant";
|
46
46
|
import * as tsplus_module_45 from "@fncts/base/collection/immutable/HashMap/api";
|
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/
|
66
|
-
import * as tsplus_module_65 from "@fncts/base/data/exceptions";
|
67
|
-
import * as tsplus_module_66 from "@fncts/io/Channel/api/toPull";
|
47
|
+
import * as tsplus_module_46 from "@fncts/io/Semaphore";
|
48
|
+
import * as tsplus_module_47 from "@fncts/io/Sink/api";
|
49
|
+
import * as tsplus_module_48 from "@fncts/base/data/Predicate/api";
|
50
|
+
import * as tsplus_module_49 from "@fncts/io/Fiber/api/poll";
|
51
|
+
import * as tsplus_module_50 from "@fncts/io/IO/api/environment";
|
52
|
+
import * as tsplus_module_51 from "@fncts/io/collection/immutable/Conc/findIO";
|
53
|
+
import * as tsplus_module_52 from "@fncts/base/data/Exit/definition";
|
54
|
+
import * as tsplus_module_53 from "@fncts/io/Stream/internal/Pull";
|
55
|
+
import * as tsplus_module_54 from "@fncts/io/Queue/api/takeBetween";
|
56
|
+
import * as tsplus_module_55 from "@fncts/io/Channel/api/interruptWhen";
|
57
|
+
import * as tsplus_module_56 from "@fncts/io/Channel/api/mapOutConcurrentIO";
|
58
|
+
import * as tsplus_module_57 from "@fncts/io/Channel/api/mergeMap";
|
59
|
+
import * as tsplus_module_58 from "@fncts/io/Channel/internal/MergeDecision";
|
60
|
+
import * as tsplus_module_59 from "@fncts/io/Channel/api/mergeWith";
|
61
|
+
import * as tsplus_module_60 from "@fncts/io/Layer/MemoMap";
|
62
|
+
import * as tsplus_module_61 from "@fncts/io/Layer/api";
|
63
|
+
import * as tsplus_module_62 from "@fncts/io/Channel/api/runDrain";
|
64
|
+
import * as tsplus_module_63 from "@fncts/base/data/exceptions";
|
65
|
+
import * as tsplus_module_64 from "@fncts/io/Channel/api/toPull";
|
68
66
|
export const aggregateAsyncWithin = aggregateAsyncWithin_1;
|
69
67
|
export const aggregateAsyncWithinEither = aggregateAsyncWithinEither_1;
|
70
68
|
export const zipRight = zipRight_1;
|
@@ -751,12 +749,12 @@ function distributedWithDynamic_1(maximumLag, decide, done = () => tsplus_module
|
|
751
749
|
}
|
752
750
|
}, __tsplusTrace)), __tsplusTrace)(tsplus_module_14.get(queuesRef, __tsplusTrace)), __tsplusTrace)(decide(a));
|
753
751
|
return tsplus_module_1.flatMap(queuesRef => tsplus_module_1.map(add => add, __tsplusTrace)(tsplus_module_1.flatMap(queuesLock => tsplus_module_1.flatMap(newQueue => {
|
754
|
-
const finalize = endTake =>
|
752
|
+
const finalize = endTake => queuesLock.withPermit(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(() => {
|
755
753
|
const id = Symbol();
|
756
754
|
return tsplus_module_1.map(() => tuple(id, queue), __tsplusTrace)(tsplus_module_15.update(map => tsplus_module_45.set(id, queue)(map), __tsplusTrace)(queuesRef));
|
757
755
|
}, __tsplusTrace)(tsplus_module_28.offer(endTake, __tsplusTrace)(queue)), __tsplusTrace)(tsplus_module_30.makeBounded(1, __tsplusTrace)), __tsplusTrace)(newQueue)), __tsplusTrace));
|
758
|
-
return tsplus_module_1.map(() =>
|
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)(
|
756
|
+
return tsplus_module_1.map(() => queuesLock.withPermit(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));
|
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 => 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_46.makeSemaphore(1, __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));
|
760
758
|
};
|
761
759
|
}
|
762
760
|
/**
|
@@ -794,7 +792,7 @@ function drop_1(n, __tsplusTrace) {
|
|
794
792
|
*/
|
795
793
|
function dropWhile_1(p, __tsplusTrace) {
|
796
794
|
return stream => {
|
797
|
-
return pipeThrough_1(
|
795
|
+
return pipeThrough_1(tsplus_module_47.makeDropWhile(p, __tsplusTrace), __tsplusTrace)(stream);
|
798
796
|
};
|
799
797
|
}
|
800
798
|
/**
|
@@ -805,7 +803,7 @@ function dropWhile_1(p, __tsplusTrace) {
|
|
805
803
|
*/
|
806
804
|
export function dropUntil(p, __tsplusTrace) {
|
807
805
|
return stream => {
|
808
|
-
return drop_1(1, __tsplusTrace)(dropWhile_1(
|
806
|
+
return drop_1(1, __tsplusTrace)(dropWhile_1(tsplus_module_48.invert(p), __tsplusTrace)(stream));
|
809
807
|
};
|
810
808
|
}
|
811
809
|
/**
|
@@ -826,7 +824,7 @@ export function either(stream, __tsplusTrace) {
|
|
826
824
|
const empty_1 = /*#__PURE__*/fromChunkNow_1( /*#__PURE__*/tsplus_module_7.empty(), fileName_1 + ":1220:70");
|
827
825
|
export const empty = empty_1;
|
828
826
|
function endWhenWriter(fiber, __tsplusTrace) {
|
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)(
|
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 => tsplus_module_36.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_49.poll(fiber, __tsplusTrace)));
|
830
828
|
}
|
831
829
|
/**
|
832
830
|
* Halts the evaluation of this stream when the provided IO completes. The given IO
|
@@ -856,7 +854,7 @@ function ensuring_1(finalizer, __tsplusTrace) {
|
|
856
854
|
* @tsplus static fncts.io.StreamOps environment
|
857
855
|
*/
|
858
856
|
function environment_1(__tsplusTrace) {
|
859
|
-
return fromIO_1(
|
857
|
+
return fromIO_1(tsplus_module_50.environment(__tsplusTrace), __tsplusTrace);
|
860
858
|
}
|
861
859
|
/**
|
862
860
|
* Accesses the environment of the stream.
|
@@ -977,7 +975,7 @@ export function find(p, __tsplusTrace) {
|
|
977
975
|
*/
|
978
976
|
export function findIO(f, __tsplusTrace) {
|
979
977
|
return stream => {
|
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)(
|
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)(tsplus_module_51.findIO(f, __tsplusTrace)(inp))), tsplus_module_10.failNow, () => tsplus_module_10.unit);
|
981
979
|
return new Stream(tsplus_module_10.pipeTo(loop)(stream.channel));
|
982
980
|
};
|
983
981
|
}
|
@@ -999,7 +997,7 @@ function flatten_1(self, __tsplusTrace) {
|
|
999
997
|
*/
|
1000
998
|
function flattenExitOption_1(stream, __tsplusTrace) {
|
1001
999
|
const processChunk = (chunk, cont) => {
|
1002
|
-
const [toEmit, rest] = tsplus_module_12.splitWhere(_ => !
|
1000
|
+
const [toEmit, rest] = tsplus_module_12.splitWhere(_ => !tsplus_module_52.isSuccess(_))(chunk);
|
1003
1001
|
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
1002
|
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)));
|
1005
1003
|
};
|
@@ -1135,11 +1133,11 @@ function fromPull_1(scopedPull, __tsplusTrace) {
|
|
1135
1133
|
function fromQueue_1(queue, maxChunkSize = DEFAULT_CHUNK_SIZE, __tsplusTrace) {
|
1136
1134
|
return repeatIOChunkMaybe_1(tsplus_module_1.catchAllCause(c => tsplus_module_1.flatMap(down => {
|
1137
1135
|
if (down && tsplus_module_25.interrupted(c)) {
|
1138
|
-
return
|
1136
|
+
return tsplus_module_53.end;
|
1139
1137
|
} else {
|
1140
|
-
return
|
1138
|
+
return tsplus_module_53.failCause(c);
|
1141
1139
|
}
|
1142
|
-
}, __tsplusTrace)(tsplus_module_28.isShutdown(queue, __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(tsplus_module_19.from, __tsplusTrace)(
|
1140
|
+
}, __tsplusTrace)(tsplus_module_28.isShutdown(queue, __tsplusTrace)), __tsplusTrace)(tsplus_module_1.map(tsplus_module_19.from, __tsplusTrace)(tsplus_module_54.takeBetween(1, maxChunkSize, __tsplusTrace)(queue))), __tsplusTrace);
|
1143
1141
|
}
|
1144
1142
|
/**
|
1145
1143
|
* @tsplus static fncts.io.StreamOps fromQueueWithShutdown
|
@@ -1176,7 +1174,7 @@ function halt_1(u, __tsplusTrace) {
|
|
1176
1174
|
return new Stream(tsplus_module_10.halt(u));
|
1177
1175
|
}
|
1178
1176
|
function haltWhenWriter(fiber, __tsplusTrace) {
|
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)(
|
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 => tsplus_module_36.match(tsplus_module_11.failCauseNow, () => tsplus_module_10.unit)(exit))(maybeExit), __tsplusTrace)(tsplus_module_49.poll(fiber, __tsplusTrace)));
|
1180
1178
|
}
|
1181
1179
|
/**
|
1182
1180
|
* Halts the evaluation of this stream when the provided IO completes. The
|
@@ -1281,7 +1279,7 @@ export function intersperse(stream, middle, __tsplusTrace) {
|
|
1281
1279
|
*/
|
1282
1280
|
export function interruptWhen(io, __tsplusTrace) {
|
1283
1281
|
return stream => {
|
1284
|
-
return new Stream(
|
1282
|
+
return new Stream(tsplus_module_55.interruptWhen(io)(stream.channel));
|
1285
1283
|
};
|
1286
1284
|
}
|
1287
1285
|
/**
|
@@ -1289,7 +1287,7 @@ export function interruptWhen(io, __tsplusTrace) {
|
|
1289
1287
|
*/
|
1290
1288
|
export function interruptWhenFuture(future, __tsplusTrace) {
|
1291
1289
|
return fa => {
|
1292
|
-
return new Stream(
|
1290
|
+
return new Stream(tsplus_module_55.interruptWhenFuture(future)(fa.channel));
|
1293
1291
|
};
|
1294
1292
|
}
|
1295
1293
|
/**
|
@@ -1454,7 +1452,7 @@ function mapIOLoop(iterator, f, __tsplusTrace) {
|
|
1454
1452
|
*/
|
1455
1453
|
export function mapIOC(n, f, __tsplusTrace) {
|
1456
1454
|
return stream => {
|
1457
|
-
return new Stream(tsplus_module_10.mapOut(tsplus_module_19.single)(
|
1455
|
+
return new Stream(tsplus_module_10.mapOut(tsplus_module_19.single)(tsplus_module_56.mapOutConcurrentIO(n, f)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(stream.channel))));
|
1458
1456
|
};
|
1459
1457
|
}
|
1460
1458
|
/**
|
@@ -1467,7 +1465,7 @@ export function mapIOC(n, f, __tsplusTrace) {
|
|
1467
1465
|
*/
|
1468
1466
|
function mergeMap_1(f, n, bufferSize = 16, __tsplusTrace) {
|
1469
1467
|
return ma => {
|
1470
|
-
return new Stream(
|
1468
|
+
return new Stream(tsplus_module_57.mergeMap(a => f(a).channel, n, bufferSize)(tsplus_module_10.concatMap(tsplus_module_10.writeChunk)(ma.channel)));
|
1471
1469
|
};
|
1472
1470
|
}
|
1473
1471
|
/**
|
@@ -1491,14 +1489,14 @@ function mergeEither_1(fb, __tsplusTrace) {
|
|
1491
1489
|
};
|
1492
1490
|
}
|
1493
1491
|
export function mergeWithHandler(terminate, __tsplusTrace) {
|
1494
|
-
return exit => terminate || !
|
1492
|
+
return exit => terminate || !tsplus_module_52.isSuccess(exit) ? tsplus_module_58.done(tsplus_module_1.fromExitNow(exit, __tsplusTrace)) : tsplus_module_58.wait(tsplus_module_1.fromExitNow);
|
1495
1493
|
}
|
1496
1494
|
/**
|
1497
1495
|
* @tsplus pipeable fncts.io.Stream mergeWith
|
1498
1496
|
*/
|
1499
1497
|
function mergeWith_1(sb, l, r, strategy = "Both", __tsplusTrace) {
|
1500
1498
|
return sa => {
|
1501
|
-
return new Stream(
|
1499
|
+
return new Stream(tsplus_module_59.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));
|
1502
1500
|
};
|
1503
1501
|
}
|
1504
1502
|
/**
|
@@ -1591,7 +1589,7 @@ function provideEnvironment_1(r, __tsplusTrace) {
|
|
1591
1589
|
*/
|
1592
1590
|
function provideLayer_1(layer, __tsplusTrace) {
|
1593
1591
|
return self => {
|
1594
|
-
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(r => tsplus_module_10.provideEnvironment(() => r)(self.channel), __tsplusTrace)(
|
1592
|
+
return new Stream(tsplus_module_10.unwrapScoped(() => tsplus_module_1.map(r => tsplus_module_10.provideEnvironment(() => r)(self.channel), __tsplusTrace)(tsplus_module_60.build(layer, __tsplusTrace))));
|
1595
1593
|
};
|
1596
1594
|
}
|
1597
1595
|
/**
|
@@ -1600,7 +1598,7 @@ function provideLayer_1(layer, __tsplusTrace) {
|
|
1600
1598
|
export function provideSomeLayer(layer, __tsplusTrace) {
|
1601
1599
|
return self => {
|
1602
1600
|
// @ts-expect-error
|
1603
|
-
return provideLayer_1(
|
1601
|
+
return provideLayer_1(tsplus_module_61.and(layer, __tsplusTrace)(tsplus_module_61.environment(__tsplusTrace)), __tsplusTrace)(self);
|
1604
1602
|
};
|
1605
1603
|
}
|
1606
1604
|
class Rechunker {
|
@@ -1714,7 +1712,7 @@ function repeatIOChunkMaybe_1(fa, __tsplusTrace) {
|
|
1714
1712
|
*/
|
1715
1713
|
function run_1(sink, __tsplusTrace) {
|
1716
1714
|
return stream => {
|
1717
|
-
return
|
1715
|
+
return tsplus_module_62.runDrain(tsplus_module_10.pipeToOrFail(sink.channel)(stream.channel));
|
1718
1716
|
};
|
1719
1717
|
}
|
1720
1718
|
/**
|
@@ -1723,7 +1721,7 @@ function run_1(sink, __tsplusTrace) {
|
|
1723
1721
|
* @tsplus getter fncts.io.Stream runCollect
|
1724
1722
|
*/
|
1725
1723
|
export function runCollect(stream, __tsplusTrace) {
|
1726
|
-
return run_1(
|
1724
|
+
return run_1(tsplus_module_47.makeCollectAll(__tsplusTrace), __tsplusTrace)(stream);
|
1727
1725
|
}
|
1728
1726
|
/**
|
1729
1727
|
* Runs the stream and collects ignore its elements.
|
@@ -1731,14 +1729,14 @@ export function runCollect(stream, __tsplusTrace) {
|
|
1731
1729
|
* @tsplus getter fncts.io.Stream runDrain
|
1732
1730
|
*/
|
1733
1731
|
export function runDrain(stream, __tsplusTrace) {
|
1734
|
-
return run_1(
|
1732
|
+
return run_1(tsplus_module_47.drain, __tsplusTrace)(stream);
|
1735
1733
|
}
|
1736
1734
|
/**
|
1737
1735
|
* @tsplus pipeable fncts.io.Stream runForeachScoped
|
1738
1736
|
*/
|
1739
1737
|
function runForeachScoped_1(f, __tsplusTrace) {
|
1740
1738
|
return self => {
|
1741
|
-
return runScoped_1(
|
1739
|
+
return runScoped_1(tsplus_module_47.makeForeach(f, __tsplusTrace), __tsplusTrace)(self);
|
1742
1740
|
};
|
1743
1741
|
}
|
1744
1742
|
/**
|
@@ -1868,7 +1866,7 @@ export function take(n, __tsplusTrace) {
|
|
1868
1866
|
return empty_1;
|
1869
1867
|
}
|
1870
1868
|
if (!Number.isInteger(n)) {
|
1871
|
-
return halt_1(() => new
|
1869
|
+
return halt_1(() => new tsplus_module_63.IllegalArgumentError(`${n} should be an integer`, "Stream.take"), __tsplusTrace);
|
1872
1870
|
}
|
1873
1871
|
return new Stream(tsplus_module_10.pipeTo(takeLoop(n, __tsplusTrace))(stream.channel));
|
1874
1872
|
};
|
@@ -1891,7 +1889,7 @@ function takeUntilIOLoop(iterator, f, __tsplusTrace) {
|
|
1891
1889
|
}
|
1892
1890
|
function takeUntilLoop(p, __tsplusTrace) {
|
1893
1891
|
return tsplus_module_10.readWith(chunk => {
|
1894
|
-
const taken = tsplus_module_12.takeWhile(
|
1892
|
+
const taken = tsplus_module_12.takeWhile(tsplus_module_48.invert(p))(chunk);
|
1895
1893
|
const last = tsplus_module_12.take(1)(tsplus_module_12.drop(taken.length)(chunk));
|
1896
1894
|
if (tsplus_module_12.isEmpty(last)) {
|
1897
1895
|
return tsplus_module_11.zipRight(takeUntilLoop(p, __tsplusTrace))(tsplus_module_10.writeNow(taken));
|
@@ -1974,7 +1972,7 @@ function toHub_1(capacity, __tsplusTrace) {
|
|
1974
1972
|
* @tsplus getter fncts.io.Stream toPull
|
1975
1973
|
*/
|
1976
1974
|
function toPull_1(stream, __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)(
|
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)(tsplus_module_64.toPull(stream.channel));
|
1978
1976
|
}
|
1979
1977
|
/**
|
1980
1978
|
* Converts the stream to a managed queue of chunks. After the managed queue is used,
|