effect 3.10.19 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BigDecimal.js +125 -24
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/Channel.js +44 -4
- package/dist/cjs/Channel.js.map +1 -1
- package/dist/cjs/Config.js +8 -1
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/Context.js +26 -1
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Cron.js +75 -67
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/DateTime.js +114 -664
- package/dist/cjs/DateTime.js.map +1 -1
- package/dist/cjs/Effect.js +82 -4
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Inspectable.js +8 -4
- package/dist/cjs/Inspectable.js.map +1 -1
- package/dist/cjs/JSONSchema.js.map +1 -1
- package/dist/cjs/Micro.js +1099 -1072
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schema.js +57 -8
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/Sink.js +9 -1
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +25 -7
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/Utils.js +7 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/channel/channelExecutor.js +5 -9
- package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
- package/dist/cjs/internal/channel.js +156 -130
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/config.js +13 -4
- package/dist/cjs/internal/config.js.map +1 -1
- package/dist/cjs/internal/context.js +46 -3
- package/dist/cjs/internal/context.js.map +1 -1
- package/dist/cjs/internal/dateTime.js +747 -0
- package/dist/cjs/internal/dateTime.js.map +1 -0
- package/dist/cjs/internal/fiberRuntime.js +34 -11
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/groupBy.js +9 -3
- package/dist/cjs/internal/groupBy.js.map +1 -1
- package/dist/cjs/internal/layer.js +1 -1
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/mailbox.js +1 -1
- package/dist/cjs/internal/mailbox.js.map +1 -1
- package/dist/cjs/internal/sink.js +25 -21
- package/dist/cjs/internal/sink.js.map +1 -1
- package/dist/cjs/internal/stream.js +70 -71
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/cjs/internal/version.js.map +1 -1
- package/dist/dts/BigDecimal.d.ts +56 -1
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +66 -5
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +23 -1
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +111 -0
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +15 -6
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/DateTime.d.ts +40 -49
- package/dist/dts/DateTime.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +88 -1
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Inspectable.d.ts.map +1 -1
- package/dist/dts/JSONSchema.d.ts +1 -0
- package/dist/dts/JSONSchema.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +875 -872
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +2 -0
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +32 -0
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +8 -0
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +50 -32
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts +4 -0
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/context.d.ts +1 -1
- package/dist/dts/internal/context.d.ts.map +1 -1
- package/dist/dts/internal/dateTime.d.ts +2 -0
- package/dist/dts/internal/dateTime.d.ts.map +1 -0
- package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/BigDecimal.js +119 -20
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/Channel.js +42 -2
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/Config.js +7 -0
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/Context.js +25 -0
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Cron.js +75 -67
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/DateTime.js +112 -627
- package/dist/esm/DateTime.js.map +1 -1
- package/dist/esm/Effect.js +77 -0
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Inspectable.js +8 -4
- package/dist/esm/Inspectable.js.map +1 -1
- package/dist/esm/JSONSchema.js.map +1 -1
- package/dist/esm/Micro.js +1077 -1047
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schema.js +54 -0
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/Sink.js +8 -0
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Stream.js +23 -5
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/Utils.js +5 -0
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/channel/channelExecutor.js +5 -7
- package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
- package/dist/esm/internal/channel.js +152 -129
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/config.js +11 -3
- package/dist/esm/internal/config.js.map +1 -1
- package/dist/esm/internal/context.js +42 -2
- package/dist/esm/internal/context.js.map +1 -1
- package/dist/esm/internal/dateTime.js +704 -0
- package/dist/esm/internal/dateTime.js.map +1 -0
- package/dist/esm/internal/fiberRuntime.js +31 -9
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/groupBy.js +9 -3
- package/dist/esm/internal/groupBy.js.map +1 -1
- package/dist/esm/internal/layer.js +1 -1
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/mailbox.js +1 -1
- package/dist/esm/internal/mailbox.js.map +1 -1
- package/dist/esm/internal/sink.js +23 -20
- package/dist/esm/internal/sink.js.map +1 -1
- package/dist/esm/internal/stream.js +66 -69
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/dist/esm/internal/version.js.map +1 -1
- package/package.json +1 -1
- package/src/BigDecimal.ts +131 -21
- package/src/Channel.ts +81 -5
- package/src/Config.ts +24 -1
- package/src/Context.ts +119 -0
- package/src/Cron.ts +85 -68
- package/src/DateTime.ts +155 -757
- package/src/Effect.ts +340 -1
- package/src/Inspectable.ts +11 -7
- package/src/JSONSchema.ts +1 -0
- package/src/Micro.ts +2005 -1757
- package/src/STM.ts +2 -0
- package/src/Schema.ts +60 -0
- package/src/Sink.ts +11 -0
- package/src/Stream.ts +55 -44
- package/src/Utils.ts +8 -0
- package/src/internal/channel/channelExecutor.ts +37 -33
- package/src/internal/channel.ts +504 -467
- package/src/internal/config.ts +18 -6
- package/src/internal/context.ts +56 -4
- package/src/internal/dateTime.ts +1126 -0
- package/src/internal/fiberRuntime.ts +35 -16
- package/src/internal/groupBy.ts +13 -22
- package/src/internal/layer.ts +5 -8
- package/src/internal/mailbox.ts +6 -4
- package/src/internal/sink.ts +55 -35
- package/src/internal/stream.ts +299 -299
- package/src/internal/version.ts +1 -1
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.fromEventListener = exports.fromEffectOption = exports.fromEffect = exports.fromChunks = exports.fromChunkQueue = exports.fromChunkPubSub = exports.fromChunk = exports.fromChannel = exports.fromAsyncIterable = exports.forever = exports.flattenTake = exports.flattenIterables = exports.flattenExitOption = exports.flattenEffect = exports.flattenChunks = exports.flatten = exports.flatMap = exports.findEffect = exports.find = exports.finalizer = exports.filterMapWhileEffect = exports.filterMapWhile = exports.filterMapEffect = exports.filterMap = exports.filterEffect = exports.filter = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.execute = exports.ensuringWith = exports.ensuring = exports.encodeText = exports.empty = exports.either = exports.dropWhileEffect = exports.dropWhile = exports.dropUntilEffect = exports.dropUntil = exports.dropRight = exports.drop = exports.drainFork = exports.drain = exports.distributedWithDynamicCallback = exports.distributedWithDynamic = exports.distributedWith = exports.dieSync = exports.dieMessage = exports.die = exports.decodeText = exports.debounce = exports.crossWith = exports.crossRight = exports.crossLeft = exports.cross = exports.contextWithStream = exports.contextWithEffect = exports.contextWith = exports.context = exports.concatAll = exports.concat = exports.combineChunks = exports.combine = exports.chunksWith = exports.chunks = exports.channelToStream = exports.changesWithEffect = exports.changesWith = exports.changes = exports.catchTags = exports.catchTag = exports.catchSomeCause = exports.catchSome = exports.catchAllCause = exports.catchAll = exports.bufferChunks = exports.buffer = exports.broadcastedQueuesDynamic = exports.broadcastedQueues = exports.broadcastDynamic = exports.broadcast = exports.branchAfter = exports.bindTo = exports.bind = exports.asyncScoped = exports.asyncPush = exports.asyncEffect = exports.as = exports.aggregateWithinEither = exports.aggregateWithin = exports.aggregate = exports.acquireRelease = exports.accumulateChunks = exports.accumulate = exports._async = exports.StreamTypeId = exports.StreamImpl = exports.Do = exports.DefaultChunkSize = void 0;
|
|
7
7
|
exports.repeatValue = exports.repeatElementsWith = exports.repeatElements = exports.repeatEither = exports.repeatEffectWithSchedule = exports.repeatEffectOption = exports.repeatEffectChunkOption = exports.repeatEffectChunk = exports.repeatEffect = exports.repeat = exports.refineOrDieWith = exports.refineOrDie = exports.rechunk = exports.range = exports.raceAll = exports.race = exports.provideSomeLayer = exports.provideServiceStream = exports.provideServiceEffect = exports.provideService = exports.provideLayer = exports.provideContext = exports.prepend = exports.pipeThroughChannelOrFail = exports.pipeThroughChannel = exports.pipeThrough = exports.peel = exports.partitionEither = exports.partition = exports.paginateEffect = exports.paginateChunkEffect = exports.paginateChunk = exports.paginate = exports.orElseSucceed = exports.orElseIfEmptyStream = exports.orElseIfEmptyChunk = exports.orElseIfEmpty = exports.orElseFail = exports.orElseEither = exports.orElse = exports.orDieWith = exports.orDie = exports.onStart = exports.onError = exports.onEnd = exports.onDone = exports.never = exports.mkString = exports.mergeWithTag = exports.mergeWith = exports.mergeRight = exports.mergeLeft = exports.mergeEither = exports.mergeAll = exports.merge = exports.matchConcurrency = exports.mapInputContext = exports.mapErrorCause = exports.mapError = exports.mapEffectSequential = exports.mapEffectPar = exports.mapConcatEffect = exports.mapConcatChunkEffect = exports.mapConcatChunk = exports.mapConcat = exports.mapChunksEffect = exports.mapChunks = exports.mapBoth = exports.mapAccumEffect = exports.mapAccum = exports.map = exports.make = exports.let_ = exports.iterate = exports.isStream = exports.intersperseAffixes = exports.intersperse = exports.interruptWhenDeferred = exports.interruptWhen = exports.interruptAfter = exports.interleaveWith = exports.interleave = exports.identityStream = exports.haltWhenDeferred = exports.haltWhen = exports.haltAfter = exports.groupedWithin = exports.grouped = exports.groupAdjacentBy = exports.fromTQueue = exports.fromTPubSub = exports.fromSchedule = exports.fromReadableStreamByob = exports.fromReadableStream = exports.fromQueue = exports.fromPull = exports.fromPubSub = exports.fromIteratorSucceed = exports.fromIterableEffect = exports.fromIterable = void 0;
|
|
8
|
-
exports.
|
|
9
|
-
exports.zipWithPreviousAndNext = exports.zipWithPrevious = exports.zipWithNext = exports.zipWithIndex = exports.zipWithChunks = exports.zipWith = exports.zipRight = exports.zipLeft = void 0;
|
|
8
|
+
exports.zipLatest = exports.zipFlatten = exports.zipAllWith = exports.zipAllSortedByKeyWith = exports.zipAllSortedByKeyRight = exports.zipAllSortedByKeyLeft = exports.zipAllSortedByKey = exports.zipAllRight = exports.zipAllLeft = exports.zipAll = exports.zip = exports.withSpan = exports.whenEffect = exports.whenCaseEffect = exports.whenCase = exports.when = exports.void = exports.updateService = exports.unwrapScopedWith = exports.unwrapScoped = exports.unwrap = exports.unfoldEffect = exports.unfoldChunkEffect = exports.unfoldChunk = exports.unfold = exports.transduce = exports.toReadableStreamRuntime = exports.toReadableStreamEffect = exports.toReadableStream = exports.toQueueOfElements = exports.toQueue = exports.toPull = exports.toPubSub = exports.toChannel = exports.timeoutTo = exports.timeoutFailCause = exports.timeoutFail = exports.timeout = exports.tick = exports.throttleEffect = exports.throttle = exports.tapSink = exports.tapErrorCause = exports.tapError = exports.tapBoth = exports.tap = exports.takeWhile = exports.takeUntilEffect = exports.takeUntil = exports.takeRight = exports.take = exports.sync = exports.suspend = exports.succeed = exports.splitOnChunk = exports.splitLines = exports.split = exports.someOrFail = exports.someOrElse = exports.some = exports.slidingSize = exports.sliding = exports.share = exports.scopedWith = exports.scoped = exports.scheduleWith = exports.schedule = exports.scanReduceEffect = exports.scanReduce = exports.scanEffect = exports.scan = exports.runSum = exports.runScoped = exports.runLast = exports.runIntoQueueScoped = exports.runIntoQueueElementsScoped = exports.runIntoQueue = exports.runIntoPubSubScoped = exports.runIntoPubSub = exports.runHead = exports.runForEachWhileScoped = exports.runForEachWhile = exports.runForEachScoped = exports.runForEachChunkScoped = exports.runForEachChunk = exports.runForEach = exports.runFoldWhileScopedEffect = exports.runFoldWhileScoped = exports.runFoldWhileEffect = exports.runFoldWhile = exports.runFoldScopedEffect = exports.runFoldScoped = exports.runFoldEffect = exports.runFold = exports.runDrain = exports.runCount = exports.runCollect = exports.run = exports.retry = exports.repeatWith = void 0;
|
|
9
|
+
exports.zipWithPreviousAndNext = exports.zipWithPrevious = exports.zipWithNext = exports.zipWithIndex = exports.zipWithChunks = exports.zipWith = exports.zipRight = exports.zipLeft = exports.zipLatestWith = exports.zipLatestAll = void 0;
|
|
10
10
|
var Cause = _interopRequireWildcard(require("../Cause.js"));
|
|
11
11
|
var Chunk = _interopRequireWildcard(require("../Chunk.js"));
|
|
12
12
|
var Clock = _interopRequireWildcard(require("../Clock.js"));
|
|
@@ -39,7 +39,6 @@ var Tuple = _interopRequireWildcard(require("../Tuple.js"));
|
|
|
39
39
|
var channel = _interopRequireWildcard(require("./channel.js"));
|
|
40
40
|
var channelExecutor = _interopRequireWildcard(require("./channel/channelExecutor.js"));
|
|
41
41
|
var MergeStrategy = _interopRequireWildcard(require("./channel/mergeStrategy.js"));
|
|
42
|
-
var singleProducerAsyncInput = _interopRequireWildcard(require("./channel/singleProducerAsyncInput.js"));
|
|
43
42
|
var core = _interopRequireWildcard(require("./core-stream.js"));
|
|
44
43
|
var doNotation = _interopRequireWildcard(require("./doNotation.js"));
|
|
45
44
|
var _ringBuffer = require("./ringBuffer.js");
|
|
@@ -113,7 +112,7 @@ const aggregateWithin = exports.aggregateWithin = /*#__PURE__*/(0, _Function.dua
|
|
|
113
112
|
/** @internal */
|
|
114
113
|
const aggregateWithinEither = exports.aggregateWithinEither = /*#__PURE__*/(0, _Function.dual)(3, (self, sink, schedule) => {
|
|
115
114
|
const layer = Effect.all([Handoff.make(), Ref.make(SinkEndReason.ScheduleEnd), Ref.make(Chunk.empty()), Schedule.driver(schedule), Ref.make(false), Ref.make(false)]);
|
|
116
|
-
return (
|
|
115
|
+
return fromEffect(layer).pipe(flatMap(([handoff, sinkEndReason, sinkLeftovers, scheduleDriver, consumed, endAfterEmit]) => {
|
|
117
116
|
const handoffProducer = core.readWithCause({
|
|
118
117
|
onInput: input => core.flatMap(core.fromEffect((0, _Function.pipe)(handoff, Handoff.offer(HandoffSignal.emit(input)), Effect.when(() => Chunk.isNonEmpty(input)))), () => handoffProducer),
|
|
119
118
|
onFailure: cause => core.fromEffect(Handoff.offer(handoff, HandoffSignal.halt(cause))),
|
|
@@ -145,7 +144,7 @@ const aggregateWithinEither = exports.aggregateWithinEither = /*#__PURE__*/(0, _
|
|
|
145
144
|
}), channel.unwrap);
|
|
146
145
|
const timeout = lastB => scheduleDriver.next(lastB);
|
|
147
146
|
const scheduledAggregator = (sinkFiber, scheduleFiber, scope) => {
|
|
148
|
-
const forkSink = (0, _Function.pipe)(Ref.set(consumed, false), Effect.zipRight(Ref.set(endAfterEmit, false)), Effect.zipRight((0, _Function.pipe)(handoffConsumer, channel.pipeToOrFail(_sink.toChannel(sink)), core.collectElements,
|
|
147
|
+
const forkSink = (0, _Function.pipe)(Ref.set(consumed, false), Effect.zipRight(Ref.set(endAfterEmit, false)), Effect.zipRight((0, _Function.pipe)(handoffConsumer, channel.pipeToOrFail(_sink.toChannel(sink)), core.collectElements, channel.run, Effect.forkIn(scope))));
|
|
149
148
|
const handleSide = (leftovers, b, c) => (0, _Function.pipe)(Ref.set(sinkLeftovers, Chunk.flatten(leftovers)), Effect.zipRight(Effect.map(Ref.get(sinkEndReason), reason => {
|
|
150
149
|
switch (reason._tag) {
|
|
151
150
|
case SinkEndReason.OP_SCHEDULE_END:
|
|
@@ -178,7 +177,7 @@ const aggregateWithinEither = exports.aggregateWithinEither = /*#__PURE__*/(0, _
|
|
|
178
177
|
})
|
|
179
178
|
}));
|
|
180
179
|
};
|
|
181
|
-
return
|
|
180
|
+
return unwrapScopedWith(scope => core.pipeTo(toChannel(self), handoffProducer).pipe(channel.run, Effect.forkIn(scope), Effect.zipRight(channel.pipeToOrFail(handoffConsumer, _sink.toChannel(sink)).pipe(core.collectElements, channel.run, Effect.forkIn(scope), Effect.flatMap(sinkFiber => timeout(Option.none()).pipe(Effect.forkIn(scope), Effect.map(scheduleFiber => new StreamImpl(scheduledAggregator(sinkFiber, scheduleFiber, scope)))))))));
|
|
182
181
|
}));
|
|
183
182
|
});
|
|
184
183
|
/** @internal */
|
|
@@ -381,7 +380,7 @@ const bufferSignal = (scoped, bufferChannel) => {
|
|
|
381
380
|
}))));
|
|
382
381
|
return process;
|
|
383
382
|
};
|
|
384
|
-
return channel.unwrapScoped((0, _Function.pipe)(scoped, Effect.flatMap(queue => (0, _Function.pipe)(Deferred.make(), Effect.tap(start => Deferred.succeed(start, void 0)), Effect.flatMap(start => (0, _Function.pipe)(Ref.make(start), Effect.flatMap(ref => (0, _Function.pipe)(bufferChannel, core.pipeTo(producer(queue, ref)),
|
|
383
|
+
return channel.unwrapScoped((0, _Function.pipe)(scoped, Effect.flatMap(queue => (0, _Function.pipe)(Deferred.make(), Effect.tap(start => Deferred.succeed(start, void 0)), Effect.flatMap(start => (0, _Function.pipe)(Ref.make(start), Effect.flatMap(ref => (0, _Function.pipe)(bufferChannel, core.pipeTo(producer(queue, ref)), channel.runScoped, Effect.forkScoped)), Effect.as(consumer(queue))))))));
|
|
385
384
|
};
|
|
386
385
|
/** @internal */
|
|
387
386
|
const catchAll = exports.catchAll = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => catchAllCause(self, cause => Either.match(Cause.failureOrCause(cause), {
|
|
@@ -451,26 +450,18 @@ const chunksWith = exports.chunksWith = /*#__PURE__*/(0, _Function.dual)(2, (sel
|
|
|
451
450
|
const unsome = effect => Effect.catchAll(Effect.asSome(effect), o => o._tag === "None" ? Effect.succeedNone : Effect.fail(o.value));
|
|
452
451
|
/** @internal */
|
|
453
452
|
const combine = exports.combine = /*#__PURE__*/(0, _Function.dual)(4, (self, that, s, f) => {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
const
|
|
464
|
-
yield* $(toChannel(self), channel.concatMap(channel.writeChunk), core.pipeTo(producer(left, latchL)), channelExecutor.runScoped, Effect.forkScoped);
|
|
465
|
-
yield* $(toChannel(that), channel.concatMap(channel.writeChunk), core.pipeTo(producer(right, latchR)), channelExecutor.runScoped, Effect.forkScoped);
|
|
466
|
-
const pullLeft = (0, _Function.pipe)(latchL, Handoff.offer(void 0),
|
|
467
|
-
// TODO: remove
|
|
468
|
-
Effect.zipRight((0, _Function.pipe)(Handoff.take(left), Effect.flatMap(exit => Effect.suspend(() => exit)))));
|
|
469
|
-
const pullRight = (0, _Function.pipe)(latchR, Handoff.offer(void 0),
|
|
470
|
-
// TODO: remove
|
|
471
|
-
Effect.zipRight((0, _Function.pipe)(Handoff.take(right), Effect.flatMap(exit => Effect.suspend(() => exit)))));
|
|
453
|
+
function producer(handoff, latch) {
|
|
454
|
+
return core.fromEffect(Handoff.take(latch)).pipe(channel.zipRight(core.readWithCause({
|
|
455
|
+
onInput: input => core.flatMap(core.fromEffect(Handoff.offer(handoff, Exit.succeed(input))), () => producer(handoff, latch)),
|
|
456
|
+
onFailure: cause => core.fromEffect(Handoff.offer(handoff, Exit.failCause((0, _Function.pipe)(cause, Cause.map(Option.some))))),
|
|
457
|
+
onDone: () => core.flatMap(core.fromEffect(Handoff.offer(handoff, Exit.fail(Option.none()))), () => producer(handoff, latch))
|
|
458
|
+
})));
|
|
459
|
+
}
|
|
460
|
+
return new StreamImpl(channel.unwrapScopedWith(scope => Effect.all([Handoff.make(), Handoff.make(), Handoff.make(), Handoff.make()]).pipe(Effect.tap(([left, _, latchL]) => toChannel(self).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(left, latchL)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.tap(([, right, _, rightL]) => toChannel(that).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(right, rightL)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.map(([left, right, latchL, latchR]) => {
|
|
461
|
+
const pullLeft = Handoff.offer(latchL, void 0).pipe(Effect.zipRight(Handoff.take(left).pipe(Effect.flatMap(_Function.identity))));
|
|
462
|
+
const pullRight = Handoff.offer(latchR, void 0).pipe(Effect.zipRight(Handoff.take(right).pipe(Effect.flatMap(_Function.identity))));
|
|
472
463
|
return toChannel(unfoldEffect(s, s => Effect.flatMap(f(s, pullLeft, pullRight), unsome)));
|
|
473
|
-
})));
|
|
464
|
+
}))));
|
|
474
465
|
});
|
|
475
466
|
/** @internal */
|
|
476
467
|
const combineChunks = exports.combineChunks = /*#__PURE__*/(0, _Function.dual)(4, (self, that, s, f) => {
|
|
@@ -479,11 +470,11 @@ const combineChunks = exports.combineChunks = /*#__PURE__*/(0, _Function.dual)(4
|
|
|
479
470
|
onFailure: cause => core.fromEffect(Handoff.offer(handoff, InternalTake.failCause(cause))),
|
|
480
471
|
onDone: () => core.fromEffect(Handoff.offer(handoff, InternalTake.end))
|
|
481
472
|
}));
|
|
482
|
-
return new StreamImpl((
|
|
483
|
-
const pullLeft =
|
|
484
|
-
const pullRight =
|
|
473
|
+
return new StreamImpl(channel.unwrapScopedWith(scope => Effect.all([Handoff.make(), Handoff.make(), Handoff.make(), Handoff.make()]).pipe(Effect.tap(([left, _, latchL]) => core.pipeTo(toChannel(self), producer(left, latchL)).pipe(channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.tap(([_, right, __, latchR]) => core.pipeTo(toChannel(that), producer(right, latchR)).pipe(channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.map(([left, right, latchL, latchR]) => {
|
|
474
|
+
const pullLeft = Handoff.offer(latchL, void 0).pipe(Effect.zipRight(Handoff.take(left).pipe(Effect.flatMap(InternalTake.done))));
|
|
475
|
+
const pullRight = Handoff.offer(latchR, void 0).pipe(Effect.zipRight(Handoff.take(right).pipe(Effect.flatMap(InternalTake.done))));
|
|
485
476
|
return toChannel(unfoldChunkEffect(s, s => Effect.flatMap(f(s, pullLeft, pullRight), unsome)));
|
|
486
|
-
})
|
|
477
|
+
}))));
|
|
487
478
|
});
|
|
488
479
|
/** @internal */
|
|
489
480
|
const concat = exports.concat = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => new StreamImpl((0, _Function.pipe)(toChannel(self), channel.zipRight(toChannel(that)))));
|
|
@@ -499,21 +490,24 @@ const crossRight = exports.crossRight = /*#__PURE__*/(0, _Function.dual)(2, (lef
|
|
|
499
490
|
/** @internal */
|
|
500
491
|
const crossWith = exports.crossWith = /*#__PURE__*/(0, _Function.dual)(3, (left, right, f) => (0, _Function.pipe)(left, flatMap(a => (0, _Function.pipe)(right, map(b => f(a, b))))));
|
|
501
492
|
/** @internal */
|
|
502
|
-
const debounce = exports.debounce = /*#__PURE__*/(0, _Function.dual)(2, (self, duration) => (
|
|
503
|
-
const
|
|
493
|
+
const debounce = exports.debounce = /*#__PURE__*/(0, _Function.dual)(2, (self, duration) => unwrapScopedWith(scope => Effect.gen(function* () {
|
|
494
|
+
const handoff = yield* Handoff.make();
|
|
495
|
+
function enqueue(last) {
|
|
496
|
+
return Clock.sleep(duration).pipe(Effect.as(last), Effect.forkIn(scope), Effect.map(fiber => consumer(DebounceState.previous(fiber))));
|
|
497
|
+
}
|
|
504
498
|
const producer = core.readWithCause({
|
|
505
499
|
onInput: input => Option.match(Chunk.last(input), {
|
|
506
500
|
onNone: () => producer,
|
|
507
|
-
onSome:
|
|
501
|
+
onSome: elem => core.fromEffect(Handoff.offer(handoff, HandoffSignal.emit(Chunk.of(elem)))).pipe(core.flatMap(() => producer))
|
|
508
502
|
}),
|
|
509
503
|
onFailure: cause => core.fromEffect(Handoff.offer(handoff, HandoffSignal.halt(cause))),
|
|
510
504
|
onDone: () => core.fromEffect(Handoff.offer(handoff, HandoffSignal.end(SinkEndReason.UpstreamEnd)))
|
|
511
505
|
});
|
|
512
|
-
|
|
506
|
+
function consumer(state) {
|
|
513
507
|
switch (state._tag) {
|
|
514
508
|
case DebounceState.OP_NOT_STARTED:
|
|
515
509
|
{
|
|
516
|
-
return
|
|
510
|
+
return channel.unwrap(Handoff.take(handoff).pipe(Effect.map(signal => {
|
|
517
511
|
switch (signal._tag) {
|
|
518
512
|
case HandoffSignal.OP_EMIT:
|
|
519
513
|
{
|
|
@@ -528,39 +522,39 @@ const debounce = exports.debounce = /*#__PURE__*/(0, _Function.dual)(2, (self, d
|
|
|
528
522
|
return core.void;
|
|
529
523
|
}
|
|
530
524
|
}
|
|
531
|
-
})
|
|
525
|
+
})));
|
|
532
526
|
}
|
|
533
527
|
case DebounceState.OP_PREVIOUS:
|
|
534
528
|
{
|
|
535
|
-
return channel.unwrap(Effect.raceWith(Fiber.join(state.fiber),
|
|
529
|
+
return channel.unwrap(Handoff.take(handoff).pipe(Effect.forkIn(scope), Effect.flatMap(handoffFiber => Effect.raceWith(Fiber.join(state.fiber), Fiber.join(handoffFiber), {
|
|
536
530
|
onSelfDone: (leftExit, current) => Exit.match(leftExit, {
|
|
537
|
-
onFailure: cause =>
|
|
538
|
-
onSuccess: chunk =>
|
|
531
|
+
onFailure: cause => Fiber.interrupt(current).pipe(Effect.as(core.failCause(cause))),
|
|
532
|
+
onSuccess: chunk => Fiber.interrupt(current).pipe(Effect.zipRight(Effect.succeed(core.write(chunk).pipe(core.flatMap(() => consumer(DebounceState.current(handoffFiber)))))))
|
|
539
533
|
}),
|
|
540
534
|
onOtherDone: (rightExit, previous) => Exit.match(rightExit, {
|
|
541
|
-
onFailure: cause =>
|
|
535
|
+
onFailure: cause => Fiber.interrupt(previous).pipe(Effect.as(core.failCause(cause))),
|
|
542
536
|
onSuccess: signal => {
|
|
543
537
|
switch (signal._tag) {
|
|
544
538
|
case HandoffSignal.OP_EMIT:
|
|
545
539
|
{
|
|
546
|
-
return
|
|
540
|
+
return Fiber.interrupt(previous).pipe(Effect.zipRight(enqueue(signal.elements)));
|
|
547
541
|
}
|
|
548
542
|
case HandoffSignal.OP_HALT:
|
|
549
543
|
{
|
|
550
|
-
return
|
|
544
|
+
return Fiber.interrupt(previous).pipe(Effect.as(core.failCause(signal.cause)));
|
|
551
545
|
}
|
|
552
546
|
case HandoffSignal.OP_END:
|
|
553
547
|
{
|
|
554
|
-
return
|
|
548
|
+
return Fiber.join(previous).pipe(Effect.map(chunk => core.write(chunk).pipe(channel.zipRight(core.void))));
|
|
555
549
|
}
|
|
556
550
|
}
|
|
557
551
|
}
|
|
558
552
|
})
|
|
559
|
-
}));
|
|
553
|
+
}))));
|
|
560
554
|
}
|
|
561
555
|
case DebounceState.OP_CURRENT:
|
|
562
556
|
{
|
|
563
|
-
return
|
|
557
|
+
return channel.unwrap(Fiber.join(state.fiber).pipe(Effect.map(signal => {
|
|
564
558
|
switch (signal._tag) {
|
|
565
559
|
case HandoffSignal.OP_EMIT:
|
|
566
560
|
{
|
|
@@ -575,13 +569,12 @@ const debounce = exports.debounce = /*#__PURE__*/(0, _Function.dual)(2, (self, d
|
|
|
575
569
|
return core.void;
|
|
576
570
|
}
|
|
577
571
|
}
|
|
578
|
-
})
|
|
572
|
+
})));
|
|
579
573
|
}
|
|
580
574
|
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
})))), unwrap));
|
|
575
|
+
}
|
|
576
|
+
return scopedWith(scope => core.pipeTo(toChannel(self), producer).pipe(channelExecutor.runIn(scope), Effect.forkIn(scope))).pipe(crossRight(new StreamImpl(consumer(DebounceState.notStarted))));
|
|
577
|
+
})));
|
|
585
578
|
/** @internal */
|
|
586
579
|
const die = defect => fromEffect(Effect.die(defect));
|
|
587
580
|
/** @internal */
|
|
@@ -657,7 +650,7 @@ const distributedWithDynamicCallback = exports.distributedWithDynamicCallback =
|
|
|
657
650
|
const drain = self => new StreamImpl(channel.drain(toChannel(self)));
|
|
658
651
|
/** @internal */
|
|
659
652
|
exports.drain = drain;
|
|
660
|
-
const drainFork = exports.drainFork = /*#__PURE__*/(0, _Function.dual)(2, (self, that) =>
|
|
653
|
+
const drainFork = exports.drainFork = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => fromEffect(Deferred.make()).pipe(flatMap(backgroundDied => scopedWith(scope => toChannel(that).pipe(channel.drain, channelExecutor.runIn(scope), Effect.catchAllCause(cause => Deferred.failCause(backgroundDied, cause)), Effect.forkIn(scope))).pipe(crossRight(interruptWhenDeferred(self, backgroundDied))))));
|
|
661
654
|
/** @internal */
|
|
662
655
|
const drop = exports.drop = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => {
|
|
663
656
|
const loop = r => core.readWith({
|
|
@@ -1207,7 +1200,7 @@ const haltWhen = exports.haltWhen = /*#__PURE__*/(0, _Function.dual)(2, (self, e
|
|
|
1207
1200
|
onSuccess: () => core.void
|
|
1208
1201
|
})
|
|
1209
1202
|
})), channel.unwrap);
|
|
1210
|
-
return new StreamImpl((
|
|
1203
|
+
return new StreamImpl(channel.unwrapScopedWith(scope => effect.pipe(Effect.forkIn(scope), Effect.map(fiber => toChannel(self).pipe(core.pipeTo(writer(fiber)))))));
|
|
1211
1204
|
});
|
|
1212
1205
|
/** @internal */
|
|
1213
1206
|
const haltAfter = exports.haltAfter = /*#__PURE__*/(0, _Function.dual)(2, (self, duration) => (0, _Function.pipe)(self, haltWhen(Clock.sleep(duration))));
|
|
@@ -1238,7 +1231,7 @@ const interleaveWith = exports.interleaveWith = /*#__PURE__*/(0, _Function.dual)
|
|
|
1238
1231
|
onFailure: cause => core.fromEffect(Handoff.offer(handoff, InternalTake.failCause(cause))),
|
|
1239
1232
|
onDone: () => core.fromEffect(Handoff.offer(handoff, InternalTake.end))
|
|
1240
1233
|
});
|
|
1241
|
-
return new StreamImpl(channel.
|
|
1234
|
+
return new StreamImpl(channel.unwrapScopedWith(scope => (0, _Function.pipe)(Handoff.make(), Effect.zip(Handoff.make()), Effect.tap(([left]) => toChannel(self).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(left)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.tap(([_, right]) => toChannel(that).pipe(channel.concatMap(channel.writeChunk), core.pipeTo(producer(right)), channelExecutor.runIn(scope), Effect.forkIn(scope))), Effect.map(([left, right]) => {
|
|
1242
1235
|
const process = (leftDone, rightDone) => core.readWithCause({
|
|
1243
1236
|
onInput: bool => {
|
|
1244
1237
|
if (bool && !leftDone) {
|
|
@@ -1568,7 +1561,7 @@ const prepend = exports.prepend = /*#__PURE__*/(0, _Function.dual)(2, (self, val
|
|
|
1568
1561
|
/** @internal */
|
|
1569
1562
|
const provideContext = exports.provideContext = /*#__PURE__*/(0, _Function.dual)(2, (self, context) => new StreamImpl((0, _Function.pipe)(toChannel(self), core.provideContext(context))));
|
|
1570
1563
|
/** @internal */
|
|
1571
|
-
const provideLayer = exports.provideLayer = /*#__PURE__*/(0, _Function.dual)(2, (self, layer) => new StreamImpl(channel.
|
|
1564
|
+
const provideLayer = exports.provideLayer = /*#__PURE__*/(0, _Function.dual)(2, (self, layer) => new StreamImpl(channel.unwrapScopedWith(scope => Layer.buildWithScope(layer, scope).pipe(Effect.map(env => (0, _Function.pipe)(toChannel(self), core.provideContext(env)))))));
|
|
1572
1565
|
/** @internal */
|
|
1573
1566
|
const provideService = exports.provideService = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, resource) => provideServiceEffect(self, tag, Effect.succeed(resource)));
|
|
1574
1567
|
/** @internal */
|
|
@@ -1763,46 +1756,46 @@ const retry = exports.retry = /*#__PURE__*/(0, _Function.dual)(2, (self, schedul
|
|
|
1763
1756
|
return loop;
|
|
1764
1757
|
}), channel.unwrap, fromChannel));
|
|
1765
1758
|
/** @internal */
|
|
1766
|
-
const run = exports.run = /*#__PURE__*/(0, _Function.dual)(2, (self, sink) => (
|
|
1759
|
+
const run = exports.run = /*#__PURE__*/(0, _Function.dual)(2, (self, sink) => toChannel(self).pipe(channel.pipeToOrFail(_sink.toChannel(sink)), channel.runDrain));
|
|
1767
1760
|
/** @internal */
|
|
1768
|
-
const runCollect = self => (
|
|
1761
|
+
const runCollect = self => run(self, _sink.collectAll());
|
|
1769
1762
|
/** @internal */
|
|
1770
1763
|
exports.runCollect = runCollect;
|
|
1771
|
-
const runCount = self => (
|
|
1764
|
+
const runCount = self => run(self, _sink.count);
|
|
1772
1765
|
/** @internal */
|
|
1773
1766
|
exports.runCount = runCount;
|
|
1774
|
-
const runDrain = self => (
|
|
1767
|
+
const runDrain = self => run(self, _sink.drain);
|
|
1775
1768
|
/** @internal */
|
|
1776
1769
|
exports.runDrain = runDrain;
|
|
1777
|
-
const runFold = exports.runFold = /*#__PURE__*/(0, _Function.dual)(3, (self, s, f) => (
|
|
1770
|
+
const runFold = exports.runFold = /*#__PURE__*/(0, _Function.dual)(3, (self, s, f) => runFoldWhile(self, s, _Function.constTrue, f));
|
|
1778
1771
|
/** @internal */
|
|
1779
|
-
const runFoldEffect = exports.runFoldEffect = /*#__PURE__*/(0, _Function.dual)(3, (self, s, f) => (
|
|
1772
|
+
const runFoldEffect = exports.runFoldEffect = /*#__PURE__*/(0, _Function.dual)(3, (self, s, f) => runFoldWhileEffect(self, s, _Function.constTrue, f));
|
|
1780
1773
|
/** @internal */
|
|
1781
1774
|
const runFoldScoped = exports.runFoldScoped = /*#__PURE__*/(0, _Function.dual)(3, (self, s, f) => (0, _Function.pipe)(self, runFoldWhileScoped(s, _Function.constTrue, f)));
|
|
1782
1775
|
/** @internal */
|
|
1783
1776
|
const runFoldScopedEffect = exports.runFoldScopedEffect = /*#__PURE__*/(0, _Function.dual)(3, (self, s, f) => (0, _Function.pipe)(self, runFoldWhileScopedEffect(s, _Function.constTrue, f)));
|
|
1784
1777
|
/** @internal */
|
|
1785
|
-
const runFoldWhile = exports.runFoldWhile = /*#__PURE__*/(0, _Function.dual)(4, (self, s, cont, f) => (
|
|
1778
|
+
const runFoldWhile = exports.runFoldWhile = /*#__PURE__*/(0, _Function.dual)(4, (self, s, cont, f) => run(self, _sink.fold(s, cont, f)));
|
|
1786
1779
|
/** @internal */
|
|
1787
|
-
const runFoldWhileEffect = exports.runFoldWhileEffect = /*#__PURE__*/(0, _Function.dual)(4, (self, s, cont, f) => (
|
|
1780
|
+
const runFoldWhileEffect = exports.runFoldWhileEffect = /*#__PURE__*/(0, _Function.dual)(4, (self, s, cont, f) => run(self, _sink.foldEffect(s, cont, f)));
|
|
1788
1781
|
/** @internal */
|
|
1789
1782
|
const runFoldWhileScoped = exports.runFoldWhileScoped = /*#__PURE__*/(0, _Function.dual)(4, (self, s, cont, f) => (0, _Function.pipe)(self, runScoped(_sink.fold(s, cont, f))));
|
|
1790
1783
|
/** @internal */
|
|
1791
1784
|
const runFoldWhileScopedEffect = exports.runFoldWhileScopedEffect = /*#__PURE__*/(0, _Function.dual)(4, (self, s, cont, f) => (0, _Function.pipe)(self, runScoped(_sink.foldEffect(s, cont, f))));
|
|
1792
1785
|
/** @internal */
|
|
1793
|
-
const runForEach = exports.runForEach = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (
|
|
1786
|
+
const runForEach = exports.runForEach = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => run(self, _sink.forEach(f)));
|
|
1794
1787
|
/** @internal */
|
|
1795
|
-
const runForEachChunk = exports.runForEachChunk = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (
|
|
1788
|
+
const runForEachChunk = exports.runForEachChunk = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => run(self, _sink.forEachChunk(f)));
|
|
1796
1789
|
/** @internal */
|
|
1797
1790
|
const runForEachChunkScoped = exports.runForEachChunkScoped = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (0, _Function.pipe)(self, runScoped(_sink.forEachChunk(f))));
|
|
1798
1791
|
/** @internal */
|
|
1799
1792
|
const runForEachScoped = exports.runForEachScoped = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (0, _Function.pipe)(self, runScoped(_sink.forEach(f))));
|
|
1800
1793
|
/** @internal */
|
|
1801
|
-
const runForEachWhile = exports.runForEachWhile = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (
|
|
1794
|
+
const runForEachWhile = exports.runForEachWhile = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => run(self, _sink.forEachWhile(f)));
|
|
1802
1795
|
/** @internal */
|
|
1803
1796
|
const runForEachWhileScoped = exports.runForEachWhileScoped = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => (0, _Function.pipe)(self, runScoped(_sink.forEachWhile(f))));
|
|
1804
1797
|
/** @internal */
|
|
1805
|
-
const runHead = self => (
|
|
1798
|
+
const runHead = self => run(self, _sink.head());
|
|
1806
1799
|
/** @internal */
|
|
1807
1800
|
exports.runHead = runHead;
|
|
1808
1801
|
const runIntoPubSub = exports.runIntoPubSub = /*#__PURE__*/(0, _Function.dual)(2, (self, pubsub) => (0, _Function.pipe)(self, runIntoQueue(pubsub)));
|
|
@@ -1817,7 +1810,7 @@ const runIntoQueueElementsScoped = exports.runIntoQueueElementsScoped = /*#__PUR
|
|
|
1817
1810
|
onFailure: cause => core.fromEffect(Queue.offer(queue, Exit.failCause(Cause.map(cause, Option.some)))),
|
|
1818
1811
|
onDone: () => core.fromEffect(Queue.offer(queue, Exit.fail(Option.none())))
|
|
1819
1812
|
});
|
|
1820
|
-
return (0, _Function.pipe)(core.pipeTo(toChannel(self), writer), channel.drain,
|
|
1813
|
+
return (0, _Function.pipe)(core.pipeTo(toChannel(self), writer), channel.drain, channel.runScoped, Effect.asVoid);
|
|
1821
1814
|
});
|
|
1822
1815
|
/** @internal */
|
|
1823
1816
|
const runIntoQueueScoped = exports.runIntoQueueScoped = /*#__PURE__*/(0, _Function.dual)(2, (self, queue) => {
|
|
@@ -1826,15 +1819,15 @@ const runIntoQueueScoped = exports.runIntoQueueScoped = /*#__PURE__*/(0, _Functi
|
|
|
1826
1819
|
onFailure: cause => core.write(InternalTake.failCause(cause)),
|
|
1827
1820
|
onDone: () => core.write(InternalTake.end)
|
|
1828
1821
|
});
|
|
1829
|
-
return (0, _Function.pipe)(core.pipeTo(toChannel(self), writer), channel.mapOutEffect(take => Queue.offer(queue, take)), channel.drain,
|
|
1822
|
+
return (0, _Function.pipe)(core.pipeTo(toChannel(self), writer), channel.mapOutEffect(take => Queue.offer(queue, take)), channel.drain, channel.runScoped, Effect.asVoid);
|
|
1830
1823
|
});
|
|
1831
1824
|
/** @internal */
|
|
1832
|
-
const runLast = self => (
|
|
1825
|
+
const runLast = self => run(self, _sink.last());
|
|
1833
1826
|
/** @internal */
|
|
1834
1827
|
exports.runLast = runLast;
|
|
1835
|
-
const runScoped = exports.runScoped = /*#__PURE__*/(0, _Function.dual)(2, (self, sink) => (0, _Function.pipe)(toChannel(self), channel.pipeToOrFail(_sink.toChannel(sink)), channel.drain,
|
|
1828
|
+
const runScoped = exports.runScoped = /*#__PURE__*/(0, _Function.dual)(2, (self, sink) => (0, _Function.pipe)(toChannel(self), channel.pipeToOrFail(_sink.toChannel(sink)), channel.drain, channel.runScoped));
|
|
1836
1829
|
/** @internal */
|
|
1837
|
-
const runSum = self => (
|
|
1830
|
+
const runSum = self => run(self, _sink.sum);
|
|
1838
1831
|
/** @internal */
|
|
1839
1832
|
exports.runSum = runSum;
|
|
1840
1833
|
const scan = exports.scan = /*#__PURE__*/(0, _Function.dual)(3, (self, s, f) => (0, _Function.pipe)(self, scanEffect(s, (s, a) => Effect.succeed(f(s, a)))));
|
|
@@ -1882,6 +1875,9 @@ const scanEffect = exports.scanEffect = /*#__PURE__*/(0, _Function.dual)(3, (sel
|
|
|
1882
1875
|
const scoped = effect => new StreamImpl(channel.ensuring(channel.scoped((0, _Function.pipe)(effect, Effect.map(Chunk.of))), Effect.void));
|
|
1883
1876
|
/** @internal */
|
|
1884
1877
|
exports.scoped = scoped;
|
|
1878
|
+
const scopedWith = f => new StreamImpl(channel.scopedWith(scope => f(scope).pipe(Effect.map(Chunk.of))));
|
|
1879
|
+
/** @internal */
|
|
1880
|
+
exports.scopedWith = scopedWith;
|
|
1885
1881
|
const some = self => (0, _Function.pipe)(self, mapError(Option.some), someOrFail(() => Option.none()));
|
|
1886
1882
|
/** @internal */
|
|
1887
1883
|
exports.some = some;
|
|
@@ -2338,6 +2334,9 @@ exports.unwrap = unwrap;
|
|
|
2338
2334
|
const unwrapScoped = effect => flatten(scoped(effect));
|
|
2339
2335
|
/** @internal */
|
|
2340
2336
|
exports.unwrapScoped = unwrapScoped;
|
|
2337
|
+
const unwrapScopedWith = f => flatten(scopedWith(scope => f(scope)));
|
|
2338
|
+
/** @internal */
|
|
2339
|
+
exports.unwrapScopedWith = unwrapScopedWith;
|
|
2341
2340
|
const updateService = exports.updateService = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, f) => (0, _Function.pipe)(self, mapInputContext(context => (0, _Function.pipe)(context, Context.add(tag, f((0, _Function.pipe)(context, Context.unsafeGet(tag))))))));
|
|
2342
2341
|
/** @internal */
|
|
2343
2342
|
const when = exports.when = /*#__PURE__*/(0, _Function.dual)(2, (self, test) => (0, _Function.pipe)(self, whenEffect(Effect.sync(test))));
|