Erster Docker-Stand
This commit is contained in:
688
_node_modules/effect/dist/esm/internal/channel/channelExecutor.js
generated
vendored
Normal file
688
_node_modules/effect/dist/esm/internal/channel/channelExecutor.js
generated
vendored
Normal file
@@ -0,0 +1,688 @@
|
||||
import * as Cause from "../../Cause.js";
|
||||
import * as Deferred from "../../Deferred.js";
|
||||
import * as Effect from "../../Effect.js";
|
||||
import * as ExecutionStrategy from "../../ExecutionStrategy.js";
|
||||
import * as Exit from "../../Exit.js";
|
||||
import * as Fiber from "../../Fiber.js";
|
||||
import * as FiberId from "../../FiberId.js";
|
||||
import { dual, identity, pipe } from "../../Function.js";
|
||||
import * as HashSet from "../../HashSet.js";
|
||||
import * as Option from "../../Option.js";
|
||||
import * as Scope from "../../Scope.js";
|
||||
import * as core from "../core-stream.js";
|
||||
import * as ChannelOpCodes from "../opCodes/channel.js";
|
||||
import * as ChildExecutorDecisionOpCodes from "../opCodes/channelChildExecutorDecision.js";
|
||||
import * as ChannelStateOpCodes from "../opCodes/channelState.js";
|
||||
import * as UpstreamPullStrategyOpCodes from "../opCodes/channelUpstreamPullStrategy.js";
|
||||
import * as ContinuationOpCodes from "../opCodes/continuation.js";
|
||||
import * as ChannelState from "./channelState.js";
|
||||
import * as Continuation from "./continuation.js";
|
||||
import * as Subexecutor from "./subexecutor.js";
|
||||
import * as upstreamPullRequest from "./upstreamPullRequest.js";
|
||||
/** @internal */
|
||||
export class ChannelExecutor {
|
||||
_activeSubexecutor = undefined;
|
||||
_cancelled = undefined;
|
||||
_closeLastSubstream = undefined;
|
||||
_currentChannel;
|
||||
_done = undefined;
|
||||
_doneStack = [];
|
||||
_emitted = undefined;
|
||||
_executeCloseLastSubstream;
|
||||
_input = undefined;
|
||||
_inProgressFinalizer = undefined;
|
||||
_providedEnv;
|
||||
constructor(initialChannel, providedEnv, executeCloseLastSubstream) {
|
||||
this._currentChannel = initialChannel;
|
||||
this._executeCloseLastSubstream = executeCloseLastSubstream;
|
||||
this._providedEnv = providedEnv;
|
||||
}
|
||||
run() {
|
||||
let result = undefined;
|
||||
while (result === undefined) {
|
||||
if (this._cancelled !== undefined) {
|
||||
result = this.processCancellation();
|
||||
} else if (this._activeSubexecutor !== undefined) {
|
||||
result = this.runSubexecutor();
|
||||
} else {
|
||||
try {
|
||||
if (this._currentChannel === undefined) {
|
||||
result = ChannelState.Done();
|
||||
} else {
|
||||
if (Effect.isEffect(this._currentChannel)) {
|
||||
this._currentChannel = core.fromEffect(this._currentChannel);
|
||||
}
|
||||
switch (this._currentChannel._tag) {
|
||||
case ChannelOpCodes.OP_BRACKET_OUT:
|
||||
{
|
||||
result = this.runBracketOut(this._currentChannel);
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_BRIDGE:
|
||||
{
|
||||
const bridgeInput = this._currentChannel.input;
|
||||
// PipeTo(left, Bridge(queue, channel))
|
||||
// In a fiber: repeatedly run left and push its outputs to the queue
|
||||
// Add a finalizer to interrupt the fiber and close the executor
|
||||
this._currentChannel = this._currentChannel.channel;
|
||||
if (this._input !== undefined) {
|
||||
const inputExecutor = this._input;
|
||||
this._input = undefined;
|
||||
const drainer = () => Effect.flatMap(bridgeInput.awaitRead(), () => Effect.suspend(() => {
|
||||
const state = inputExecutor.run();
|
||||
switch (state._tag) {
|
||||
case ChannelStateOpCodes.OP_DONE:
|
||||
{
|
||||
return Exit.match(inputExecutor.getDone(), {
|
||||
onFailure: cause => bridgeInput.error(cause),
|
||||
onSuccess: value => bridgeInput.done(value)
|
||||
});
|
||||
}
|
||||
case ChannelStateOpCodes.OP_EMIT:
|
||||
{
|
||||
return Effect.flatMap(bridgeInput.emit(inputExecutor.getEmit()), () => drainer());
|
||||
}
|
||||
case ChannelStateOpCodes.OP_FROM_EFFECT:
|
||||
{
|
||||
return Effect.matchCauseEffect(state.effect, {
|
||||
onFailure: cause => bridgeInput.error(cause),
|
||||
onSuccess: () => drainer()
|
||||
});
|
||||
}
|
||||
case ChannelStateOpCodes.OP_READ:
|
||||
{
|
||||
return readUpstream(state, () => drainer(), cause => bridgeInput.error(cause));
|
||||
}
|
||||
}
|
||||
}));
|
||||
result = ChannelState.fromEffect(Effect.flatMap(Effect.forkDaemon(Effect.interruptible(drainer())), fiber => Effect.sync(() => this.addFinalizer(exit => Effect.flatMap(Fiber.interrupt(fiber), () => Effect.suspend(() => {
|
||||
const effect = this.restorePipe(exit, inputExecutor);
|
||||
return effect !== undefined ? effect : Effect.void;
|
||||
}))))));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_CONCAT_ALL:
|
||||
{
|
||||
const executor = new ChannelExecutor(this._currentChannel.value(), this._providedEnv, effect => Effect.sync(() => {
|
||||
const prevLastClose = this._closeLastSubstream === undefined ? Effect.void : this._closeLastSubstream;
|
||||
this._closeLastSubstream = pipe(prevLastClose, Effect.zipRight(effect));
|
||||
}));
|
||||
executor._input = this._input;
|
||||
const channel = this._currentChannel;
|
||||
this._activeSubexecutor = new Subexecutor.PullFromUpstream(executor, value => channel.k(value), undefined, [], (x, y) => channel.combineInners(x, y), (x, y) => channel.combineAll(x, y), request => channel.onPull(request), value => channel.onEmit(value));
|
||||
this._closeLastSubstream = undefined;
|
||||
this._currentChannel = undefined;
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_EMIT:
|
||||
{
|
||||
this._emitted = this._currentChannel.out;
|
||||
this._currentChannel = this._activeSubexecutor !== undefined ? undefined : core.void;
|
||||
result = ChannelState.Emit();
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_ENSURING:
|
||||
{
|
||||
this.runEnsuring(this._currentChannel);
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_FAIL:
|
||||
{
|
||||
result = this.doneHalt(this._currentChannel.error());
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_FOLD:
|
||||
{
|
||||
this._doneStack.push(this._currentChannel.k);
|
||||
this._currentChannel = this._currentChannel.channel;
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_FROM_EFFECT:
|
||||
{
|
||||
const effect = this._providedEnv === undefined ? this._currentChannel.effect() : pipe(this._currentChannel.effect(), Effect.provide(this._providedEnv));
|
||||
result = ChannelState.fromEffect(Effect.matchCauseEffect(effect, {
|
||||
onFailure: cause => {
|
||||
const state = this.doneHalt(cause);
|
||||
return state !== undefined && ChannelState.isFromEffect(state) ? state.effect : Effect.void;
|
||||
},
|
||||
onSuccess: value => {
|
||||
const state = this.doneSucceed(value);
|
||||
return state !== undefined && ChannelState.isFromEffect(state) ? state.effect : Effect.void;
|
||||
}
|
||||
}));
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_PIPE_TO:
|
||||
{
|
||||
const previousInput = this._input;
|
||||
const leftExec = new ChannelExecutor(this._currentChannel.left(), this._providedEnv, effect => this._executeCloseLastSubstream(effect));
|
||||
leftExec._input = previousInput;
|
||||
this._input = leftExec;
|
||||
this.addFinalizer(exit => {
|
||||
const effect = this.restorePipe(exit, previousInput);
|
||||
return effect !== undefined ? effect : Effect.void;
|
||||
});
|
||||
this._currentChannel = this._currentChannel.right();
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_PROVIDE:
|
||||
{
|
||||
const previousEnv = this._providedEnv;
|
||||
this._providedEnv = this._currentChannel.context();
|
||||
this._currentChannel = this._currentChannel.inner;
|
||||
this.addFinalizer(() => Effect.sync(() => {
|
||||
this._providedEnv = previousEnv;
|
||||
}));
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_READ:
|
||||
{
|
||||
const read = this._currentChannel;
|
||||
result = ChannelState.Read(this._input, identity, emitted => {
|
||||
try {
|
||||
this._currentChannel = read.more(emitted);
|
||||
} catch (error) {
|
||||
this._currentChannel = read.done.onExit(Exit.die(error));
|
||||
}
|
||||
return undefined;
|
||||
}, exit => {
|
||||
const onExit = exit => {
|
||||
return read.done.onExit(exit);
|
||||
};
|
||||
this._currentChannel = onExit(exit);
|
||||
return undefined;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_SUCCEED:
|
||||
{
|
||||
result = this.doneSucceed(this._currentChannel.evaluate());
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_SUCCEED_NOW:
|
||||
{
|
||||
result = this.doneSucceed(this._currentChannel.terminal);
|
||||
break;
|
||||
}
|
||||
case ChannelOpCodes.OP_SUSPEND:
|
||||
{
|
||||
this._currentChannel = this._currentChannel.channel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this._currentChannel = core.failCause(Cause.die(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getDone() {
|
||||
return this._done;
|
||||
}
|
||||
getEmit() {
|
||||
return this._emitted;
|
||||
}
|
||||
cancelWith(exit) {
|
||||
this._cancelled = exit;
|
||||
}
|
||||
clearInProgressFinalizer() {
|
||||
this._inProgressFinalizer = undefined;
|
||||
}
|
||||
storeInProgressFinalizer(finalizer) {
|
||||
this._inProgressFinalizer = finalizer;
|
||||
}
|
||||
popAllFinalizers(exit) {
|
||||
const finalizers = [];
|
||||
let next = this._doneStack.pop();
|
||||
while (next) {
|
||||
if (next._tag === "ContinuationFinalizer") {
|
||||
finalizers.push(next.finalizer);
|
||||
}
|
||||
next = this._doneStack.pop();
|
||||
}
|
||||
const effect = finalizers.length === 0 ? Effect.void : runFinalizers(finalizers, exit);
|
||||
this.storeInProgressFinalizer(effect);
|
||||
return effect;
|
||||
}
|
||||
popNextFinalizers() {
|
||||
const builder = [];
|
||||
while (this._doneStack.length !== 0) {
|
||||
const cont = this._doneStack[this._doneStack.length - 1];
|
||||
if (cont._tag === ContinuationOpCodes.OP_CONTINUATION_K) {
|
||||
return builder;
|
||||
}
|
||||
builder.push(cont);
|
||||
this._doneStack.pop();
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
restorePipe(exit, prev) {
|
||||
const currInput = this._input;
|
||||
this._input = prev;
|
||||
if (currInput !== undefined) {
|
||||
const effect = currInput.close(exit);
|
||||
return effect;
|
||||
}
|
||||
return Effect.void;
|
||||
}
|
||||
close(exit) {
|
||||
let runInProgressFinalizers = undefined;
|
||||
const finalizer = this._inProgressFinalizer;
|
||||
if (finalizer !== undefined) {
|
||||
runInProgressFinalizers = pipe(finalizer, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())));
|
||||
}
|
||||
let closeSelf = undefined;
|
||||
const selfFinalizers = this.popAllFinalizers(exit);
|
||||
if (selfFinalizers !== undefined) {
|
||||
closeSelf = pipe(selfFinalizers, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())));
|
||||
}
|
||||
const closeSubexecutors = this._activeSubexecutor === undefined ? undefined : this._activeSubexecutor.close(exit);
|
||||
if (closeSubexecutors === undefined && runInProgressFinalizers === undefined && closeSelf === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return pipe(Effect.exit(ifNotNull(closeSubexecutors)), Effect.zip(Effect.exit(ifNotNull(runInProgressFinalizers))), Effect.zip(Effect.exit(ifNotNull(closeSelf))), Effect.map(([[exit1, exit2], exit3]) => pipe(exit1, Exit.zipRight(exit2), Exit.zipRight(exit3))), Effect.uninterruptible,
|
||||
// TODO: remove
|
||||
Effect.flatMap(exit => Effect.suspend(() => exit)));
|
||||
}
|
||||
doneSucceed(value) {
|
||||
if (this._doneStack.length === 0) {
|
||||
this._done = Exit.succeed(value);
|
||||
this._currentChannel = undefined;
|
||||
return ChannelState.Done();
|
||||
}
|
||||
const head = this._doneStack[this._doneStack.length - 1];
|
||||
if (head._tag === ContinuationOpCodes.OP_CONTINUATION_K) {
|
||||
this._doneStack.pop();
|
||||
this._currentChannel = head.onSuccess(value);
|
||||
return undefined;
|
||||
}
|
||||
const finalizers = this.popNextFinalizers();
|
||||
if (this._doneStack.length === 0) {
|
||||
this._doneStack = finalizers.reverse();
|
||||
this._done = Exit.succeed(value);
|
||||
this._currentChannel = undefined;
|
||||
return ChannelState.Done();
|
||||
}
|
||||
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), Exit.succeed(value));
|
||||
this.storeInProgressFinalizer(finalizerEffect);
|
||||
const effect = pipe(finalizerEffect, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())), Effect.uninterruptible, Effect.flatMap(() => Effect.sync(() => this.doneSucceed(value))));
|
||||
return ChannelState.fromEffect(effect);
|
||||
}
|
||||
doneHalt(cause) {
|
||||
if (this._doneStack.length === 0) {
|
||||
this._done = Exit.failCause(cause);
|
||||
this._currentChannel = undefined;
|
||||
return ChannelState.Done();
|
||||
}
|
||||
const head = this._doneStack[this._doneStack.length - 1];
|
||||
if (head._tag === ContinuationOpCodes.OP_CONTINUATION_K) {
|
||||
this._doneStack.pop();
|
||||
try {
|
||||
this._currentChannel = head.onHalt(cause);
|
||||
} catch (error) {
|
||||
this._currentChannel = core.failCause(Cause.die(error));
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
const finalizers = this.popNextFinalizers();
|
||||
if (this._doneStack.length === 0) {
|
||||
this._doneStack = finalizers.reverse();
|
||||
this._done = Exit.failCause(cause);
|
||||
this._currentChannel = undefined;
|
||||
return ChannelState.Done();
|
||||
}
|
||||
const finalizerEffect = runFinalizers(finalizers.map(f => f.finalizer), Exit.failCause(cause));
|
||||
this.storeInProgressFinalizer(finalizerEffect);
|
||||
const effect = pipe(finalizerEffect, Effect.ensuring(Effect.sync(() => this.clearInProgressFinalizer())), Effect.uninterruptible, Effect.flatMap(() => Effect.sync(() => this.doneHalt(cause))));
|
||||
return ChannelState.fromEffect(effect);
|
||||
}
|
||||
processCancellation() {
|
||||
this._currentChannel = undefined;
|
||||
this._done = this._cancelled;
|
||||
this._cancelled = undefined;
|
||||
return ChannelState.Done();
|
||||
}
|
||||
runBracketOut(bracketOut) {
|
||||
const effect = Effect.uninterruptible(Effect.matchCauseEffect(this.provide(bracketOut.acquire()), {
|
||||
onFailure: cause => Effect.sync(() => {
|
||||
this._currentChannel = core.failCause(cause);
|
||||
}),
|
||||
onSuccess: out => Effect.sync(() => {
|
||||
this.addFinalizer(exit => this.provide(bracketOut.finalizer(out, exit)));
|
||||
this._currentChannel = core.write(out);
|
||||
})
|
||||
}));
|
||||
return ChannelState.fromEffect(effect);
|
||||
}
|
||||
provide(effect) {
|
||||
if (this._providedEnv === undefined) {
|
||||
return effect;
|
||||
}
|
||||
return pipe(effect, Effect.provide(this._providedEnv));
|
||||
}
|
||||
runEnsuring(ensuring) {
|
||||
this.addFinalizer(ensuring.finalizer);
|
||||
this._currentChannel = ensuring.channel;
|
||||
}
|
||||
addFinalizer(f) {
|
||||
this._doneStack.push(new Continuation.ContinuationFinalizerImpl(f));
|
||||
}
|
||||
runSubexecutor() {
|
||||
const subexecutor = this._activeSubexecutor;
|
||||
switch (subexecutor._tag) {
|
||||
case Subexecutor.OP_PULL_FROM_CHILD:
|
||||
{
|
||||
return this.pullFromChild(subexecutor.childExecutor, subexecutor.parentSubexecutor, subexecutor.onEmit, subexecutor);
|
||||
}
|
||||
case Subexecutor.OP_PULL_FROM_UPSTREAM:
|
||||
{
|
||||
return this.pullFromUpstream(subexecutor);
|
||||
}
|
||||
case Subexecutor.OP_DRAIN_CHILD_EXECUTORS:
|
||||
{
|
||||
return this.drainChildExecutors(subexecutor);
|
||||
}
|
||||
case Subexecutor.OP_EMIT:
|
||||
{
|
||||
this._emitted = subexecutor.value;
|
||||
this._activeSubexecutor = subexecutor.next;
|
||||
return ChannelState.Emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
replaceSubexecutor(nextSubExec) {
|
||||
this._currentChannel = undefined;
|
||||
this._activeSubexecutor = nextSubExec;
|
||||
}
|
||||
finishWithExit(exit) {
|
||||
const state = Exit.match(exit, {
|
||||
onFailure: cause => this.doneHalt(cause),
|
||||
onSuccess: value => this.doneSucceed(value)
|
||||
});
|
||||
this._activeSubexecutor = undefined;
|
||||
return state === undefined ? Effect.void : ChannelState.effect(state);
|
||||
}
|
||||
finishSubexecutorWithCloseEffect(subexecutorDone, ...closeFuncs) {
|
||||
this.addFinalizer(() => pipe(closeFuncs, Effect.forEach(closeFunc => pipe(Effect.sync(() => closeFunc(subexecutorDone)), Effect.flatMap(closeEffect => closeEffect !== undefined ? closeEffect : Effect.void)), {
|
||||
discard: true
|
||||
})));
|
||||
const state = pipe(subexecutorDone, Exit.match({
|
||||
onFailure: cause => this.doneHalt(cause),
|
||||
onSuccess: value => this.doneSucceed(value)
|
||||
}));
|
||||
this._activeSubexecutor = undefined;
|
||||
return state;
|
||||
}
|
||||
applyUpstreamPullStrategy(upstreamFinished, queue, strategy) {
|
||||
switch (strategy._tag) {
|
||||
case UpstreamPullStrategyOpCodes.OP_PULL_AFTER_NEXT:
|
||||
{
|
||||
const shouldPrepend = !upstreamFinished || queue.some(subexecutor => subexecutor !== undefined);
|
||||
return [strategy.emitSeparator, shouldPrepend ? [undefined, ...queue] : queue];
|
||||
}
|
||||
case UpstreamPullStrategyOpCodes.OP_PULL_AFTER_ALL_ENQUEUED:
|
||||
{
|
||||
const shouldEnqueue = !upstreamFinished || queue.some(subexecutor => subexecutor !== undefined);
|
||||
return [strategy.emitSeparator, shouldEnqueue ? [...queue, undefined] : queue];
|
||||
}
|
||||
}
|
||||
}
|
||||
pullFromChild(childExecutor, parentSubexecutor, onEmitted, subexecutor) {
|
||||
return ChannelState.Read(childExecutor, identity, emitted => {
|
||||
const childExecutorDecision = onEmitted(emitted);
|
||||
switch (childExecutorDecision._tag) {
|
||||
case ChildExecutorDecisionOpCodes.OP_CONTINUE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ChildExecutorDecisionOpCodes.OP_CLOSE:
|
||||
{
|
||||
this.finishWithDoneValue(childExecutor, parentSubexecutor, childExecutorDecision.value);
|
||||
break;
|
||||
}
|
||||
case ChildExecutorDecisionOpCodes.OP_YIELD:
|
||||
{
|
||||
const modifiedParent = parentSubexecutor.enqueuePullFromChild(subexecutor);
|
||||
this.replaceSubexecutor(modifiedParent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this._activeSubexecutor = new Subexecutor.Emit(emitted, this._activeSubexecutor);
|
||||
return undefined;
|
||||
}, Exit.match({
|
||||
onFailure: cause => {
|
||||
const state = this.handleSubexecutorFailure(childExecutor, parentSubexecutor, cause);
|
||||
return state === undefined ? undefined : ChannelState.effectOrUndefinedIgnored(state);
|
||||
},
|
||||
onSuccess: doneValue => {
|
||||
this.finishWithDoneValue(childExecutor, parentSubexecutor, doneValue);
|
||||
return undefined;
|
||||
}
|
||||
}));
|
||||
}
|
||||
finishWithDoneValue(childExecutor, parentSubexecutor, doneValue) {
|
||||
const subexecutor = parentSubexecutor;
|
||||
switch (subexecutor._tag) {
|
||||
case Subexecutor.OP_PULL_FROM_UPSTREAM:
|
||||
{
|
||||
const modifiedParent = new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit);
|
||||
this._closeLastSubstream = childExecutor.close(Exit.succeed(doneValue));
|
||||
this.replaceSubexecutor(modifiedParent);
|
||||
break;
|
||||
}
|
||||
case Subexecutor.OP_DRAIN_CHILD_EXECUTORS:
|
||||
{
|
||||
const modifiedParent = new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone !== undefined ? subexecutor.combineChildResults(subexecutor.lastDone, doneValue) : doneValue, subexecutor.activeChildExecutors, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);
|
||||
this._closeLastSubstream = childExecutor.close(Exit.succeed(doneValue));
|
||||
this.replaceSubexecutor(modifiedParent);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
handleSubexecutorFailure(childExecutor, parentSubexecutor, cause) {
|
||||
return this.finishSubexecutorWithCloseEffect(Exit.failCause(cause), exit => parentSubexecutor.close(exit), exit => childExecutor.close(exit));
|
||||
}
|
||||
pullFromUpstream(subexecutor) {
|
||||
if (subexecutor.activeChildExecutors.length === 0) {
|
||||
return this.performPullFromUpstream(subexecutor);
|
||||
}
|
||||
const activeChild = subexecutor.activeChildExecutors[0];
|
||||
const parentSubexecutor = new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, subexecutor.activeChildExecutors.slice(1), subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit);
|
||||
if (activeChild === undefined) {
|
||||
return this.performPullFromUpstream(parentSubexecutor);
|
||||
}
|
||||
this.replaceSubexecutor(new Subexecutor.PullFromChild(activeChild.childExecutor, parentSubexecutor, activeChild.onEmit));
|
||||
return undefined;
|
||||
}
|
||||
performPullFromUpstream(subexecutor) {
|
||||
return ChannelState.Read(subexecutor.upstreamExecutor, effect => {
|
||||
const closeLastSubstream = this._closeLastSubstream === undefined ? Effect.void : this._closeLastSubstream;
|
||||
this._closeLastSubstream = undefined;
|
||||
return pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.zipRight(effect));
|
||||
}, emitted => {
|
||||
if (this._closeLastSubstream !== undefined) {
|
||||
const closeLastSubstream = this._closeLastSubstream;
|
||||
this._closeLastSubstream = undefined;
|
||||
return pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.map(() => {
|
||||
const childExecutor = new ChannelExecutor(subexecutor.createChild(emitted), this._providedEnv, this._executeCloseLastSubstream);
|
||||
childExecutor._input = this._input;
|
||||
const [emitSeparator, updatedChildExecutors] = this.applyUpstreamPullStrategy(false, subexecutor.activeChildExecutors, subexecutor.onPull(upstreamPullRequest.Pulled(emitted)));
|
||||
this._activeSubexecutor = new Subexecutor.PullFromChild(childExecutor, new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, updatedChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit), subexecutor.onEmit);
|
||||
if (Option.isSome(emitSeparator)) {
|
||||
this._activeSubexecutor = new Subexecutor.Emit(emitSeparator.value, this._activeSubexecutor);
|
||||
}
|
||||
return undefined;
|
||||
}));
|
||||
}
|
||||
const childExecutor = new ChannelExecutor(subexecutor.createChild(emitted), this._providedEnv, this._executeCloseLastSubstream);
|
||||
childExecutor._input = this._input;
|
||||
const [emitSeparator, updatedChildExecutors] = this.applyUpstreamPullStrategy(false, subexecutor.activeChildExecutors, subexecutor.onPull(upstreamPullRequest.Pulled(emitted)));
|
||||
this._activeSubexecutor = new Subexecutor.PullFromChild(childExecutor, new Subexecutor.PullFromUpstream(subexecutor.upstreamExecutor, subexecutor.createChild, subexecutor.lastDone, updatedChildExecutors, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull, subexecutor.onEmit), subexecutor.onEmit);
|
||||
if (Option.isSome(emitSeparator)) {
|
||||
this._activeSubexecutor = new Subexecutor.Emit(emitSeparator.value, this._activeSubexecutor);
|
||||
}
|
||||
return undefined;
|
||||
}, exit => {
|
||||
if (subexecutor.activeChildExecutors.some(subexecutor => subexecutor !== undefined)) {
|
||||
const drain = new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone, [undefined, ...subexecutor.activeChildExecutors], subexecutor.upstreamExecutor.getDone(), subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);
|
||||
if (this._closeLastSubstream !== undefined) {
|
||||
const closeLastSubstream = this._closeLastSubstream;
|
||||
this._closeLastSubstream = undefined;
|
||||
return pipe(this._executeCloseLastSubstream(closeLastSubstream), Effect.map(() => this.replaceSubexecutor(drain)));
|
||||
}
|
||||
this.replaceSubexecutor(drain);
|
||||
return undefined;
|
||||
}
|
||||
const closeLastSubstream = this._closeLastSubstream;
|
||||
const state = this.finishSubexecutorWithCloseEffect(pipe(exit, Exit.map(a => subexecutor.combineWithChildResult(subexecutor.lastDone, a))), () => closeLastSubstream, exit => subexecutor.upstreamExecutor.close(exit));
|
||||
return state === undefined ? undefined :
|
||||
// NOTE: assuming finalizers cannot fail
|
||||
ChannelState.effectOrUndefinedIgnored(state);
|
||||
});
|
||||
}
|
||||
drainChildExecutors(subexecutor) {
|
||||
if (subexecutor.activeChildExecutors.length === 0) {
|
||||
const lastClose = this._closeLastSubstream;
|
||||
if (lastClose !== undefined) {
|
||||
this.addFinalizer(() => Effect.succeed(lastClose));
|
||||
}
|
||||
return this.finishSubexecutorWithCloseEffect(subexecutor.upstreamDone, () => lastClose, exit => subexecutor.upstreamExecutor.close(exit));
|
||||
}
|
||||
const activeChild = subexecutor.activeChildExecutors[0];
|
||||
const rest = subexecutor.activeChildExecutors.slice(1);
|
||||
if (activeChild === undefined) {
|
||||
const [emitSeparator, remainingExecutors] = this.applyUpstreamPullStrategy(true, rest, subexecutor.onPull(upstreamPullRequest.NoUpstream(rest.reduce((n, curr) => curr !== undefined ? n + 1 : n, 0))));
|
||||
this.replaceSubexecutor(new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone, remainingExecutors, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull));
|
||||
if (Option.isSome(emitSeparator)) {
|
||||
this._emitted = emitSeparator.value;
|
||||
return ChannelState.Emit();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
const parentSubexecutor = new Subexecutor.DrainChildExecutors(subexecutor.upstreamExecutor, subexecutor.lastDone, rest, subexecutor.upstreamDone, subexecutor.combineChildResults, subexecutor.combineWithChildResult, subexecutor.onPull);
|
||||
this.replaceSubexecutor(new Subexecutor.PullFromChild(activeChild.childExecutor, parentSubexecutor, activeChild.onEmit));
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
const ifNotNull = effect => effect !== undefined ? effect : Effect.void;
|
||||
const runFinalizers = (finalizers, exit) => {
|
||||
return pipe(Effect.forEach(finalizers, fin => Effect.exit(fin(exit))), Effect.map(exits => pipe(Exit.all(exits), Option.getOrElse(() => Exit.void))), Effect.flatMap(exit => Effect.suspend(() => exit)));
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const readUpstream = (r, onSuccess, onFailure) => {
|
||||
const readStack = [r];
|
||||
const read = () => {
|
||||
const current = readStack.pop();
|
||||
if (current === undefined || current.upstream === undefined) {
|
||||
return Effect.dieMessage("Unexpected end of input for channel execution");
|
||||
}
|
||||
const state = current.upstream.run();
|
||||
switch (state._tag) {
|
||||
case ChannelStateOpCodes.OP_EMIT:
|
||||
{
|
||||
const emitEffect = current.onEmit(current.upstream.getEmit());
|
||||
if (readStack.length === 0) {
|
||||
if (emitEffect === undefined) {
|
||||
return Effect.suspend(onSuccess);
|
||||
}
|
||||
return pipe(emitEffect, Effect.matchCauseEffect({
|
||||
onFailure,
|
||||
onSuccess
|
||||
}));
|
||||
}
|
||||
if (emitEffect === undefined) {
|
||||
return Effect.suspend(() => read());
|
||||
}
|
||||
return pipe(emitEffect, Effect.matchCauseEffect({
|
||||
onFailure,
|
||||
onSuccess: () => read()
|
||||
}));
|
||||
}
|
||||
case ChannelStateOpCodes.OP_DONE:
|
||||
{
|
||||
const doneEffect = current.onDone(current.upstream.getDone());
|
||||
if (readStack.length === 0) {
|
||||
if (doneEffect === undefined) {
|
||||
return Effect.suspend(onSuccess);
|
||||
}
|
||||
return pipe(doneEffect, Effect.matchCauseEffect({
|
||||
onFailure,
|
||||
onSuccess
|
||||
}));
|
||||
}
|
||||
if (doneEffect === undefined) {
|
||||
return Effect.suspend(() => read());
|
||||
}
|
||||
return pipe(doneEffect, Effect.matchCauseEffect({
|
||||
onFailure,
|
||||
onSuccess: () => read()
|
||||
}));
|
||||
}
|
||||
case ChannelStateOpCodes.OP_FROM_EFFECT:
|
||||
{
|
||||
readStack.push(current);
|
||||
return pipe(current.onEffect(state.effect), Effect.catchAllCause(cause => Effect.suspend(() => {
|
||||
const doneEffect = current.onDone(Exit.failCause(cause));
|
||||
return doneEffect === undefined ? Effect.void : doneEffect;
|
||||
})), Effect.matchCauseEffect({
|
||||
onFailure,
|
||||
onSuccess: () => read()
|
||||
}));
|
||||
}
|
||||
case ChannelStateOpCodes.OP_READ:
|
||||
{
|
||||
readStack.push(current);
|
||||
readStack.push(state);
|
||||
return Effect.suspend(() => read());
|
||||
}
|
||||
}
|
||||
};
|
||||
return read();
|
||||
};
|
||||
/** @internal */
|
||||
export const runIn = /*#__PURE__*/dual(2, (self, scope) => {
|
||||
const run = (channelDeferred, scopeDeferred, scope) => Effect.acquireUseRelease(Effect.sync(() => new ChannelExecutor(self, void 0, identity)), exec => Effect.suspend(() => runScopedInterpret(exec.run(), exec).pipe(Effect.intoDeferred(channelDeferred), Effect.zipRight(Deferred.await(channelDeferred)), Effect.zipLeft(Deferred.await(scopeDeferred)))), (exec, exit) => {
|
||||
const finalize = exec.close(exit);
|
||||
if (finalize === undefined) {
|
||||
return Effect.void;
|
||||
}
|
||||
return Effect.tapErrorCause(finalize, cause => Scope.addFinalizer(scope, Effect.failCause(cause)));
|
||||
});
|
||||
return Effect.uninterruptibleMask(restore => Effect.all([Scope.fork(scope, ExecutionStrategy.sequential), Deferred.make(), Deferred.make()]).pipe(Effect.flatMap(([child, channelDeferred, scopeDeferred]) => restore(run(channelDeferred, scopeDeferred, child)).pipe(Effect.forkIn(scope), Effect.flatMap(fiber => scope.addFinalizer(exit => {
|
||||
const interruptors = Exit.isFailure(exit) ? Cause.interruptors(exit.cause) : undefined;
|
||||
return Deferred.isDone(channelDeferred).pipe(Effect.flatMap(isDone => isDone ? Deferred.succeed(scopeDeferred, void 0).pipe(Effect.zipRight(Fiber.await(fiber)), Effect.zipRight(Fiber.inheritAll(fiber))) : Deferred.succeed(scopeDeferred, void 0).pipe(Effect.zipRight(interruptors && HashSet.size(interruptors) > 0 ? Fiber.interruptAs(fiber, FiberId.combineAll(interruptors)) : Fiber.interrupt(fiber)), Effect.zipRight(Fiber.inheritAll(fiber)))));
|
||||
}).pipe(Effect.zipRight(restore(Deferred.await(channelDeferred)))))))));
|
||||
});
|
||||
/** @internal */
|
||||
const runScopedInterpret = (channelState, exec) => {
|
||||
const op = channelState;
|
||||
switch (op._tag) {
|
||||
case ChannelStateOpCodes.OP_FROM_EFFECT:
|
||||
{
|
||||
return pipe(op.effect, Effect.flatMap(() => runScopedInterpret(exec.run(), exec)));
|
||||
}
|
||||
case ChannelStateOpCodes.OP_EMIT:
|
||||
{
|
||||
// Can't really happen because Out <:< Nothing. So just skip ahead.
|
||||
return runScopedInterpret(exec.run(), exec);
|
||||
}
|
||||
case ChannelStateOpCodes.OP_DONE:
|
||||
{
|
||||
return Effect.suspend(() => exec.getDone());
|
||||
}
|
||||
case ChannelStateOpCodes.OP_READ:
|
||||
{
|
||||
return readUpstream(op, () => runScopedInterpret(exec.run(), exec), Effect.failCause);
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=channelExecutor.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/channelExecutor.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/channelExecutor.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
59
_node_modules/effect/dist/esm/internal/channel/channelState.js
generated
vendored
Normal file
59
_node_modules/effect/dist/esm/internal/channel/channelState.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import * as Effect from "../../Effect.js";
|
||||
import { hasProperty } from "../../Predicate.js";
|
||||
import * as OpCodes from "../opCodes/channelState.js";
|
||||
/** @internal */
|
||||
export const ChannelStateTypeId = /*#__PURE__*/Symbol.for("effect/ChannelState");
|
||||
const channelStateVariance = {
|
||||
/* c8 ignore next */
|
||||
_E: _ => _,
|
||||
/* c8 ignore next */
|
||||
_R: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
const proto = {
|
||||
[ChannelStateTypeId]: channelStateVariance
|
||||
};
|
||||
/** @internal */
|
||||
export const Done = () => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_DONE;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const Emit = () => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_EMIT;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const fromEffect = effect => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_FROM_EFFECT;
|
||||
op.effect = effect;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const Read = (upstream, onEffect, onEmit, onDone) => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_READ;
|
||||
op.upstream = upstream;
|
||||
op.onEffect = onEffect;
|
||||
op.onEmit = onEmit;
|
||||
op.onDone = onDone;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const isChannelState = u => hasProperty(u, ChannelStateTypeId);
|
||||
/** @internal */
|
||||
export const isDone = self => self._tag === OpCodes.OP_DONE;
|
||||
/** @internal */
|
||||
export const isEmit = self => self._tag === OpCodes.OP_EMIT;
|
||||
/** @internal */
|
||||
export const isFromEffect = self => self._tag === OpCodes.OP_FROM_EFFECT;
|
||||
/** @internal */
|
||||
export const isRead = self => self._tag === OpCodes.OP_READ;
|
||||
/** @internal */
|
||||
export const effect = self => isFromEffect(self) ? self.effect : Effect.void;
|
||||
/** @internal */
|
||||
export const effectOrUndefinedIgnored = self => isFromEffect(self) ? Effect.ignore(self.effect) : undefined;
|
||||
//# sourceMappingURL=channelState.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/channelState.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/channelState.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"channelState.js","names":["Effect","hasProperty","OpCodes","ChannelStateTypeId","Symbol","for","channelStateVariance","_E","_","_R","proto","Done","op","Object","create","_tag","OP_DONE","Emit","OP_EMIT","fromEffect","effect","OP_FROM_EFFECT","Read","upstream","onEffect","onEmit","onDone","OP_READ","isChannelState","u","isDone","self","isEmit","isFromEffect","isRead","void","effectOrUndefinedIgnored","ignore","undefined"],"sources":["../../../../src/internal/channel/channelState.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,iBAAiB;AAEzC,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,OAAO,KAAKC,OAAO,MAAM,4BAA4B;AAGrD;AACA,OAAO,MAAMC,kBAAkB,gBAAGC,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAkBnE,MAAMC,oBAAoB,GAAG;EAC3B;EACAC,EAAE,EAAGC,CAAQ,IAAKA,CAAC;EACnB;EACAC,EAAE,EAAGD,CAAQ,IAAKA;CACnB;AAED;AACA,MAAME,KAAK,GAAG;EACZ,CAACP,kBAAkB,GAAGG;CACvB;AAqCD;AACA,OAAO,MAAMK,IAAI,GAAGA,CAAA,KAAiC;EACnD,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACJ,KAAK,CAAC;EAC/BE,EAAE,CAACG,IAAI,GAAGb,OAAO,CAACc,OAAO;EACzB,OAAOJ,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMK,IAAI,GAAGA,CAAA,KAAiC;EACnD,MAAML,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACJ,KAAK,CAAC;EAC/BE,EAAE,CAACG,IAAI,GAAGb,OAAO,CAACgB,OAAO;EACzB,OAAON,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMO,UAAU,GAAaC,MAA8B,IAAwB;EACxF,MAAMR,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACJ,KAAK,CAAC;EAC/BE,EAAE,CAACG,IAAI,GAAGb,OAAO,CAACmB,cAAc;EAChCT,EAAE,CAACQ,MAAM,GAAGA,MAAM;EAClB,OAAOR,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMU,IAAI,GAAGA,CAClBC,QAA2B,EAC3BC,QAAkF,EAClFC,MAAqE,EACrEC,MAAwF,KAC9D;EAC1B,MAAMd,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACJ,KAAK,CAAC;EAC/BE,EAAE,CAACG,IAAI,GAAGb,OAAO,CAACyB,OAAO;EACzBf,EAAE,CAACW,QAAQ,GAAGA,QAAQ;EACtBX,EAAE,CAACY,QAAQ,GAAGA,QAAQ;EACtBZ,EAAE,CAACa,MAAM,GAAGA,MAAM;EAClBb,EAAE,CAACc,MAAM,GAAGA,MAAM;EAClB,OAAOd,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMgB,cAAc,GAAIC,CAAU,IAA0C5B,WAAW,CAAC4B,CAAC,EAAE1B,kBAAkB,CAAC;AAErH;AACA,OAAO,MAAM2B,MAAM,GAAUC,IAAwB,IAAoBA,IAAkB,CAAChB,IAAI,KAAKb,OAAO,CAACc,OAAO;AAEpH;AACA,OAAO,MAAMgB,MAAM,GAAUD,IAAwB,IAAoBA,IAAkB,CAAChB,IAAI,KAAKb,OAAO,CAACgB,OAAO;AAEpH;AACA,OAAO,MAAMe,YAAY,GAAUF,IAAwB,IACxDA,IAAkB,CAAChB,IAAI,KAAKb,OAAO,CAACmB,cAAc;AAErD;AACA,OAAO,MAAMa,MAAM,GAAUH,IAAwB,IAAoBA,IAAkB,CAAChB,IAAI,KAAKb,OAAO,CAACyB,OAAO;AAEpH;AACA,OAAO,MAAMP,MAAM,GAAUW,IAAwB,IACnDE,YAAY,CAACF,IAAI,CAAC,GAAGA,IAAI,CAACX,MAAmC,GAAGpB,MAAM,CAACmC,IAAI;AAE7E;AACA,OAAO,MAAMC,wBAAwB,GAAUL,IAAwB,IACrEE,YAAY,CAACF,IAAI,CAAC,GAAG/B,MAAM,CAACqC,MAAM,CAACN,IAAI,CAACX,MAAmC,CAAC,GAAGkB,SAAS","ignoreList":[]}
|
||||
60
_node_modules/effect/dist/esm/internal/channel/childExecutorDecision.js
generated
vendored
Normal file
60
_node_modules/effect/dist/esm/internal/channel/childExecutorDecision.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { dual } from "../../Function.js";
|
||||
import { hasProperty } from "../../Predicate.js";
|
||||
import * as OpCodes from "../opCodes/channelChildExecutorDecision.js";
|
||||
/** @internal */
|
||||
const ChildExecutorDecisionSymbolKey = "effect/ChannelChildExecutorDecision";
|
||||
/** @internal */
|
||||
export const ChildExecutorDecisionTypeId = /*#__PURE__*/Symbol.for(ChildExecutorDecisionSymbolKey);
|
||||
/** @internal */
|
||||
const proto = {
|
||||
[ChildExecutorDecisionTypeId]: ChildExecutorDecisionTypeId
|
||||
};
|
||||
/** @internal */
|
||||
export const Continue = _ => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_CONTINUE;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const Close = value => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_CLOSE;
|
||||
op.value = value;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const Yield = _ => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_YIELD;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const isChildExecutorDecision = u => hasProperty(u, ChildExecutorDecisionTypeId);
|
||||
/** @internal */
|
||||
export const isContinue = self => self._tag === OpCodes.OP_CONTINUE;
|
||||
/** @internal */
|
||||
export const isClose = self => self._tag === OpCodes.OP_CLOSE;
|
||||
/** @internal */
|
||||
export const isYield = self => self._tag === OpCodes.OP_YIELD;
|
||||
/** @internal */
|
||||
export const match = /*#__PURE__*/dual(2, (self, {
|
||||
onClose,
|
||||
onContinue,
|
||||
onYield
|
||||
}) => {
|
||||
switch (self._tag) {
|
||||
case OpCodes.OP_CONTINUE:
|
||||
{
|
||||
return onContinue();
|
||||
}
|
||||
case OpCodes.OP_CLOSE:
|
||||
{
|
||||
return onClose(self.value);
|
||||
}
|
||||
case OpCodes.OP_YIELD:
|
||||
{
|
||||
return onYield();
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=childExecutorDecision.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/childExecutorDecision.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/childExecutorDecision.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"childExecutorDecision.js","names":["dual","hasProperty","OpCodes","ChildExecutorDecisionSymbolKey","ChildExecutorDecisionTypeId","Symbol","for","proto","Continue","_","op","Object","create","_tag","OP_CONTINUE","Close","value","OP_CLOSE","Yield","OP_YIELD","isChildExecutorDecision","u","isContinue","self","isClose","isYield","match","onClose","onContinue","onYield"],"sources":["../../../../src/internal/channel/childExecutorDecision.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,IAAI,QAAQ,mBAAmB;AACxC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,OAAO,KAAKC,OAAO,MAAM,4CAA4C;AAErE;AACA,MAAMC,8BAA8B,GAAG,qCAAqC;AAE5E;AACA,OAAO,MAAMC,2BAA2B,gBAAsDC,MAAM,CAACC,GAAG,CACtGH,8BAA8B,CACsB;AAEtD;AACA,MAAMI,KAAK,GAAG;EACZ,CAACH,2BAA2B,GAAGA;CAChC;AAED;AACA,OAAO,MAAMI,QAAQ,GAAIC,CAAO,IAAiD;EAC/E,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGX,OAAO,CAACY,WAAW;EAC7B,OAAOJ,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMK,KAAK,GAAIC,KAAc,IAAiD;EACnF,MAAMN,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGX,OAAO,CAACe,QAAQ;EAC1BP,EAAE,CAACM,KAAK,GAAGA,KAAK;EAChB,OAAON,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMQ,KAAK,GAAIT,CAAO,IAAiD;EAC5E,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGX,OAAO,CAACiB,QAAQ;EAC1B,OAAOT,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMU,uBAAuB,GAAIC,CAAU,IAChDpB,WAAW,CAACoB,CAAC,EAAEjB,2BAA2B,CAAC;AAE7C;AACA,OAAO,MAAMkB,UAAU,GACrBC,IAAiD,IACNA,IAAI,CAACV,IAAI,KAAKX,OAAO,CAACY,WAAW;AAE9E;AACA,OAAO,MAAMU,OAAO,GAClBD,IAAiD,IACTA,IAAI,CAACV,IAAI,KAAKX,OAAO,CAACe,QAAQ;AAExE;AACA,OAAO,MAAMQ,OAAO,GAClBF,IAAiD,IACTA,IAAI,CAACV,IAAI,KAAKX,OAAO,CAACiB,QAAQ;AAExE;AACA,OAAO,MAAMO,KAAK,gBAAG1B,IAAI,CAgBvB,CAAC,EAAE,CACHuB,IAAiD,EACjD;EAAEI,OAAO;EAAEC,UAAU;EAAEC;AAAO,CAI7B,KACI;EACL,QAAQN,IAAI,CAACV,IAAI;IACf,KAAKX,OAAO,CAACY,WAAW;MAAE;QACxB,OAAOc,UAAU,EAAE;MACrB;IACA,KAAK1B,OAAO,CAACe,QAAQ;MAAE;QACrB,OAAOU,OAAO,CAACJ,IAAI,CAACP,KAAK,CAAC;MAC5B;IACA,KAAKd,OAAO,CAACiB,QAAQ;MAAE;QACrB,OAAOU,OAAO,EAAE;MAClB;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
||||
48
_node_modules/effect/dist/esm/internal/channel/continuation.js
generated
vendored
Normal file
48
_node_modules/effect/dist/esm/internal/channel/continuation.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import * as Exit from "../../Exit.js";
|
||||
import * as OpCodes from "../opCodes/continuation.js";
|
||||
/** @internal */
|
||||
export const ContinuationTypeId = /*#__PURE__*/Symbol.for("effect/ChannelContinuation");
|
||||
const continuationVariance = {
|
||||
/* c8 ignore next */
|
||||
_Env: _ => _,
|
||||
/* c8 ignore next */
|
||||
_InErr: _ => _,
|
||||
/* c8 ignore next */
|
||||
_InElem: _ => _,
|
||||
/* c8 ignore next */
|
||||
_InDone: _ => _,
|
||||
/* c8 ignore next */
|
||||
_OutErr: _ => _,
|
||||
/* c8 ignore next */
|
||||
_OutDone: _ => _,
|
||||
/* c8 ignore next */
|
||||
_OutErr2: _ => _,
|
||||
/* c8 ignore next */
|
||||
_OutElem: _ => _,
|
||||
/* c8 ignore next */
|
||||
_OutDone2: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
export class ContinuationKImpl {
|
||||
onSuccess;
|
||||
onHalt;
|
||||
_tag = OpCodes.OP_CONTINUATION_K;
|
||||
[ContinuationTypeId] = continuationVariance;
|
||||
constructor(onSuccess, onHalt) {
|
||||
this.onSuccess = onSuccess;
|
||||
this.onHalt = onHalt;
|
||||
}
|
||||
onExit(exit) {
|
||||
return Exit.isFailure(exit) ? this.onHalt(exit.cause) : this.onSuccess(exit.value);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
export class ContinuationFinalizerImpl {
|
||||
finalizer;
|
||||
_tag = OpCodes.OP_CONTINUATION_FINALIZER;
|
||||
[ContinuationTypeId] = continuationVariance;
|
||||
constructor(finalizer) {
|
||||
this.finalizer = finalizer;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=continuation.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/continuation.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/continuation.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"continuation.js","names":["Exit","OpCodes","ContinuationTypeId","Symbol","for","continuationVariance","_Env","_","_InErr","_InElem","_InDone","_OutErr","_OutDone","_OutErr2","_OutElem","_OutDone2","ContinuationKImpl","onSuccess","onHalt","_tag","OP_CONTINUATION_K","constructor","onExit","exit","isFailure","cause","value","ContinuationFinalizerImpl","finalizer","OP_CONTINUATION_FINALIZER"],"sources":["../../../../src/internal/channel/continuation.ts"],"sourcesContent":[null],"mappings":"AAGA,OAAO,KAAKA,IAAI,MAAM,eAAe;AAErC,OAAO,KAAKC,OAAO,MAAM,4BAA4B;AAErD;AACA,OAAO,MAAMC,kBAAkB,gBAAGC,MAAM,CAACC,GAAG,CAAC,4BAA4B,CAAC;AAuH1E,MAAMC,oBAAoB,GAAG;EAC3B;EACAC,IAAI,EAAGC,CAAQ,IAAKA,CAAC;EACrB;EACAC,MAAM,EAAGD,CAAU,IAAKA,CAAC;EACzB;EACAE,OAAO,EAAGF,CAAU,IAAKA,CAAC;EAC1B;EACAG,OAAO,EAAGH,CAAU,IAAKA,CAAC;EAC1B;EACAI,OAAO,EAAGJ,CAAQ,IAAKA,CAAC;EACxB;EACAK,QAAQ,EAAGL,CAAQ,IAAKA,CAAC;EACzB;EACAM,QAAQ,EAAGN,CAAQ,IAAKA,CAAC;EACzB;EACAO,QAAQ,EAAGP,CAAQ,IAAKA,CAAC;EACzB;EACAQ,SAAS,EAAGR,CAAQ,IAAKA;CAC1B;AAED;AACA,OAAM,MAAOS,iBAAiB;EA2BjBC,SAAA;EAGAC,MAAA;EANFC,IAAI,GAAGlB,OAAO,CAACmB,iBAAiB;EAChC,CAAClB,kBAAkB,IAAIG,oBAAoB;EACpDgB,YACWJ,SAEmE,EACnEC,MAEoE;IALpE,KAAAD,SAAS,GAATA,SAAS;IAGT,KAAAC,MAAM,GAANA,MAAM;EAIjB;EACAI,MAAMA,CACJC,IAAgC;IAEhC,OAAOvB,IAAI,CAACwB,SAAS,CAACD,IAAI,CAAC,GAAG,IAAI,CAACL,MAAM,CAACK,IAAI,CAACE,KAAK,CAAC,GAAG,IAAI,CAACR,SAAS,CAACM,IAAI,CAACG,KAAK,CAAC;EACpF;;AAGF;AACA,OAAM,MAAOC,yBAAyB;EAKfC,SAAA;EAFZT,IAAI,GAAGlB,OAAO,CAAC4B,yBAAyB;EACxC,CAAC3B,kBAAkB,IAAIG,oBAAoB;EACpDgB,YAAqBO,SAAmF;IAAnF,KAAAA,SAAS,GAATA,SAAS;EAC9B","ignoreList":[]}
|
||||
49
_node_modules/effect/dist/esm/internal/channel/mergeDecision.js
generated
vendored
Normal file
49
_node_modules/effect/dist/esm/internal/channel/mergeDecision.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { dual } from "../../Function.js";
|
||||
import { hasProperty } from "../../Predicate.js";
|
||||
import * as OpCodes from "../opCodes/channelMergeDecision.js";
|
||||
/** @internal */
|
||||
const MergeDecisionSymbolKey = "effect/ChannelMergeDecision";
|
||||
/** @internal */
|
||||
export const MergeDecisionTypeId = /*#__PURE__*/Symbol.for(MergeDecisionSymbolKey);
|
||||
/** @internal */
|
||||
const proto = {
|
||||
[MergeDecisionTypeId]: {
|
||||
_R: _ => _,
|
||||
_E0: _ => _,
|
||||
_Z0: _ => _,
|
||||
_E: _ => _,
|
||||
_Z: _ => _
|
||||
}
|
||||
};
|
||||
/** @internal */
|
||||
export const Done = effect => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_DONE;
|
||||
op.effect = effect;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const Await = f => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_AWAIT;
|
||||
op.f = f;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const AwaitConst = effect => Await(() => effect);
|
||||
/** @internal */
|
||||
export const isMergeDecision = u => hasProperty(u, MergeDecisionTypeId);
|
||||
/** @internal */
|
||||
export const match = /*#__PURE__*/dual(2, (self, {
|
||||
onAwait,
|
||||
onDone
|
||||
}) => {
|
||||
const op = self;
|
||||
switch (op._tag) {
|
||||
case OpCodes.OP_DONE:
|
||||
return onDone(op.effect);
|
||||
case OpCodes.OP_AWAIT:
|
||||
return onAwait(op.f);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=mergeDecision.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/mergeDecision.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/mergeDecision.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mergeDecision.js","names":["dual","hasProperty","OpCodes","MergeDecisionSymbolKey","MergeDecisionTypeId","Symbol","for","proto","_R","_","_E0","_Z0","_E","_Z","Done","effect","op","Object","create","_tag","OP_DONE","Await","f","OP_AWAIT","AwaitConst","isMergeDecision","u","match","self","onAwait","onDone"],"sources":["../../../../src/internal/channel/mergeDecision.ts"],"sourcesContent":[null],"mappings":"AAEA,SAASA,IAAI,QAAQ,mBAAmB;AAExC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,OAAO,KAAKC,OAAO,MAAM,oCAAoC;AAE7D;AACA,MAAMC,sBAAsB,GAAG,6BAA6B;AAE5D;AACA,OAAO,MAAMC,mBAAmB,gBAAsCC,MAAM,CAACC,GAAG,CAC9EH,sBAAsB,CACc;AAEtC;AACA,MAAMI,KAAK,GAAG;EACZ,CAACH,mBAAmB,GAAG;IACrBI,EAAE,EAAGC,CAAQ,IAAKA,CAAC;IACnBC,GAAG,EAAGD,CAAU,IAAKA,CAAC;IACtBE,GAAG,EAAGF,CAAU,IAAKA,CAAC;IACtBG,EAAE,EAAGH,CAAQ,IAAKA,CAAC;IACnBI,EAAE,EAAGJ,CAAQ,IAAKA;;CAErB;AA6BD;AACA,OAAO,MAAMK,IAAI,GACfC,MAA8B,IAC4B;EAC1D,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACX,KAAK,CAAC;EAC/BS,EAAE,CAACG,IAAI,GAAGjB,OAAO,CAACkB,OAAO;EACzBJ,EAAE,CAACD,MAAM,GAAGA,MAAM;EAClB,OAAOC,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMK,KAAK,GAChBC,CAAsD,IACN;EAChD,MAAMN,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACX,KAAK,CAAC;EAC/BS,EAAE,CAACG,IAAI,GAAGjB,OAAO,CAACqB,QAAQ;EAC1BP,EAAE,CAACM,CAAC,GAAGA,CAAC;EACR,OAAON,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMQ,UAAU,GACrBT,MAA8B,IAC6BM,KAAK,CAAC,MAAMN,MAAM,CAAC;AAEhF;AACA,OAAO,MAAMU,eAAe,GAC1BC,CAAU,IACwEzB,WAAW,CAACyB,CAAC,EAAEtB,mBAAmB,CAAC;AAEvH;AACA,OAAO,MAAMuB,KAAK,gBAAG3B,IAAI,CAcvB,CAAC,EAAE,CACH4B,IAAkD,EAClD;EAAEC,OAAO;EAAEC;AAAM,CAGhB,KACK;EACN,MAAMd,EAAE,GAAGY,IAAiB;EAC5B,QAAQZ,EAAE,CAACG,IAAI;IACb,KAAKjB,OAAO,CAACkB,OAAO;MAClB,OAAOU,MAAM,CAACd,EAAE,CAACD,MAAM,CAAC;IAC1B,KAAKb,OAAO,CAACqB,QAAQ;MACnB,OAAOM,OAAO,CAACb,EAAE,CAACM,CAAC,CAAC;EACxB;AACF,CAAC,CAAC","ignoreList":[]}
|
||||
69
_node_modules/effect/dist/esm/internal/channel/mergeState.js
generated
vendored
Normal file
69
_node_modules/effect/dist/esm/internal/channel/mergeState.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import { dual } from "../../Function.js";
|
||||
import { hasProperty } from "../../Predicate.js";
|
||||
import * as OpCodes from "../opCodes/channelMergeState.js";
|
||||
/** @internal */
|
||||
const MergeStateSymbolKey = "effect/ChannelMergeState";
|
||||
/** @internal */
|
||||
export const MergeStateTypeId = /*#__PURE__*/Symbol.for(MergeStateSymbolKey);
|
||||
/** @internal */
|
||||
const proto = {
|
||||
[MergeStateTypeId]: MergeStateTypeId
|
||||
};
|
||||
/** @internal */
|
||||
export const BothRunning = (left, right) => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_BOTH_RUNNING;
|
||||
op.left = left;
|
||||
op.right = right;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const LeftDone = f => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_LEFT_DONE;
|
||||
op.f = f;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const RightDone = f => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_RIGHT_DONE;
|
||||
op.f = f;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const isMergeState = u => hasProperty(u, MergeStateTypeId);
|
||||
/** @internal */
|
||||
export const isBothRunning = self => {
|
||||
return self._tag === OpCodes.OP_BOTH_RUNNING;
|
||||
};
|
||||
/** @internal */
|
||||
export const isLeftDone = self => {
|
||||
return self._tag === OpCodes.OP_LEFT_DONE;
|
||||
};
|
||||
/** @internal */
|
||||
export const isRightDone = self => {
|
||||
return self._tag === OpCodes.OP_RIGHT_DONE;
|
||||
};
|
||||
/** @internal */
|
||||
export const match = /*#__PURE__*/dual(2, (self, {
|
||||
onBothRunning,
|
||||
onLeftDone,
|
||||
onRightDone
|
||||
}) => {
|
||||
switch (self._tag) {
|
||||
case OpCodes.OP_BOTH_RUNNING:
|
||||
{
|
||||
return onBothRunning(self.left, self.right);
|
||||
}
|
||||
case OpCodes.OP_LEFT_DONE:
|
||||
{
|
||||
return onLeftDone(self.f);
|
||||
}
|
||||
case OpCodes.OP_RIGHT_DONE:
|
||||
{
|
||||
return onRightDone(self.f);
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=mergeState.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/mergeState.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/mergeState.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mergeState.js","names":["dual","hasProperty","OpCodes","MergeStateSymbolKey","MergeStateTypeId","Symbol","for","proto","BothRunning","left","right","op","Object","create","_tag","OP_BOTH_RUNNING","LeftDone","f","OP_LEFT_DONE","RightDone","OP_RIGHT_DONE","isMergeState","u","isBothRunning","self","isLeftDone","isRightDone","match","onBothRunning","onLeftDone","onRightDone"],"sources":["../../../../src/internal/channel/mergeState.ts"],"sourcesContent":[null],"mappings":"AAIA,SAASA,IAAI,QAAQ,mBAAmB;AAExC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,OAAO,KAAKC,OAAO,MAAM,iCAAiC;AAE1D;AACA,MAAMC,mBAAmB,GAAG,0BAA0B;AAEtD;AACA,OAAO,MAAMC,gBAAgB,gBAAgCC,MAAM,CAACC,GAAG,CACrEH,mBAAmB,CACW;AAEhC;AACA,MAAMI,KAAK,GAAG;EACZ,CAACH,gBAAgB,GAAGA;CACrB;AAED;AACA,OAAO,MAAMI,WAAW,GAAGA,CACzBC,IAAiD,EACjDC,KAAoD,KACqB;EACzE,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACN,KAAK,CAAC;EAC/BI,EAAE,CAACG,IAAI,GAAGZ,OAAO,CAACa,eAAe;EACjCJ,EAAE,CAACF,IAAI,GAAGA,IAAI;EACdE,EAAE,CAACD,KAAK,GAAGA,KAAK;EAChB,OAAOC,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMK,QAAQ,GACnBC,CAAoE,IACK;EACzE,MAAMN,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACN,KAAK,CAAC;EAC/BI,EAAE,CAACG,IAAI,GAAGZ,OAAO,CAACgB,YAAY;EAC9BP,EAAE,CAACM,CAAC,GAAGA,CAAC;EACR,OAAON,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMQ,SAAS,GACpBF,CAAkE,IACO;EACzE,MAAMN,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACN,KAAK,CAAC;EAC/BI,EAAE,CAACG,IAAI,GAAGZ,OAAO,CAACkB,aAAa;EAC/BT,EAAE,CAACM,CAAC,GAAGA,CAAC;EACR,OAAON,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMU,YAAY,GACvBC,CAAU,IAEVrB,WAAW,CAACqB,CAAC,EAAElB,gBAAgB,CAAC;AAElC;AACA,OAAO,MAAMmB,aAAa,GACxBC,IAA2E,IACO;EAClF,OAAOA,IAAI,CAACV,IAAI,KAAKZ,OAAO,CAACa,eAAe;AAC9C,CAAC;AAED;AACA,OAAO,MAAMU,UAAU,GACrBD,IAA2E,IACI;EAC/E,OAAOA,IAAI,CAACV,IAAI,KAAKZ,OAAO,CAACgB,YAAY;AAC3C,CAAC;AAED;AACA,OAAO,MAAMQ,WAAW,GACtBF,IAA2E,IACK;EAChF,OAAOA,IAAI,CAACV,IAAI,KAAKZ,OAAO,CAACkB,aAAa;AAC5C,CAAC;AAED;AACA,OAAO,MAAMO,KAAK,gBAAG3B,IAAI,CAsBvB,CAAC,EAAE,CACHwB,IAAI,EACJ;EAAEI,aAAa;EAAEC,UAAU;EAAEC;AAAW,CAAE,KACxC;EACF,QAAQN,IAAI,CAACV,IAAI;IACf,KAAKZ,OAAO,CAACa,eAAe;MAAE;QAC5B,OAAOa,aAAa,CAACJ,IAAI,CAACf,IAAI,EAAEe,IAAI,CAACd,KAAK,CAAC;MAC7C;IACA,KAAKR,OAAO,CAACgB,YAAY;MAAE;QACzB,OAAOW,UAAU,CAACL,IAAI,CAACP,CAAC,CAAC;MAC3B;IACA,KAAKf,OAAO,CAACkB,aAAa;MAAE;QAC1B,OAAOU,WAAW,CAACN,IAAI,CAACP,CAAC,CAAC;MAC5B;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
||||
46
_node_modules/effect/dist/esm/internal/channel/mergeStrategy.js
generated
vendored
Normal file
46
_node_modules/effect/dist/esm/internal/channel/mergeStrategy.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import { dual } from "../../Function.js";
|
||||
import { hasProperty } from "../../Predicate.js";
|
||||
import * as OpCodes from "../opCodes/channelMergeStrategy.js";
|
||||
/** @internal */
|
||||
const MergeStrategySymbolKey = "effect/ChannelMergeStrategy";
|
||||
/** @internal */
|
||||
export const MergeStrategyTypeId = /*#__PURE__*/Symbol.for(MergeStrategySymbolKey);
|
||||
/** @internal */
|
||||
const proto = {
|
||||
[MergeStrategyTypeId]: MergeStrategyTypeId
|
||||
};
|
||||
/** @internal */
|
||||
export const BackPressure = _ => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_BACK_PRESSURE;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const BufferSliding = _ => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_BUFFER_SLIDING;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const isMergeStrategy = u => hasProperty(u, MergeStrategyTypeId);
|
||||
/** @internal */
|
||||
export const isBackPressure = self => self._tag === OpCodes.OP_BACK_PRESSURE;
|
||||
/** @internal */
|
||||
export const isBufferSliding = self => self._tag === OpCodes.OP_BUFFER_SLIDING;
|
||||
/** @internal */
|
||||
export const match = /*#__PURE__*/dual(2, (self, {
|
||||
onBackPressure,
|
||||
onBufferSliding
|
||||
}) => {
|
||||
switch (self._tag) {
|
||||
case OpCodes.OP_BACK_PRESSURE:
|
||||
{
|
||||
return onBackPressure();
|
||||
}
|
||||
case OpCodes.OP_BUFFER_SLIDING:
|
||||
{
|
||||
return onBufferSliding();
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=mergeStrategy.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/mergeStrategy.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/mergeStrategy.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mergeStrategy.js","names":["dual","hasProperty","OpCodes","MergeStrategySymbolKey","MergeStrategyTypeId","Symbol","for","proto","BackPressure","_","op","Object","create","_tag","OP_BACK_PRESSURE","BufferSliding","OP_BUFFER_SLIDING","isMergeStrategy","u","isBackPressure","self","isBufferSliding","match","onBackPressure","onBufferSliding"],"sources":["../../../../src/internal/channel/mergeStrategy.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAI,QAAQ,mBAAmB;AAExC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,OAAO,KAAKC,OAAO,MAAM,oCAAoC;AAE7D;AACA,MAAMC,sBAAsB,GAAG,6BAA6B;AAE5D;AACA,OAAO,MAAMC,mBAAmB,gBAAsCC,MAAM,CAACC,GAAG,CAC9EH,sBAAsB,CACc;AAEtC;AACA,MAAMI,KAAK,GAAG;EACZ,CAACH,mBAAmB,GAAGA;CACxB;AAED;AACA,OAAO,MAAMI,YAAY,GAAIC,CAAO,IAAiC;EACnE,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGX,OAAO,CAACY,gBAAgB;EAClC,OAAOJ,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMK,aAAa,GAAIN,CAAO,IAAiC;EACpE,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGX,OAAO,CAACc,iBAAiB;EACnC,OAAON,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMO,eAAe,GAAIC,CAAU,IAAuCjB,WAAW,CAACiB,CAAC,EAAEd,mBAAmB,CAAC;AAEpH;AACA,OAAO,MAAMe,cAAc,GAAIC,IAAiC,IAC9DA,IAAI,CAACP,IAAI,KAAKX,OAAO,CAACY,gBAAgB;AAExC;AACA,OAAO,MAAMO,eAAe,GAAID,IAAiC,IAC/DA,IAAI,CAACP,IAAI,KAAKX,OAAO,CAACc,iBAAiB;AAEzC;AACA,OAAO,MAAMM,KAAK,gBAAGtB,IAAI,CAYvB,CAAC,EAAE,CACHoB,IAAiC,EACjC;EAAEG,cAAc;EAAEC;AAAe,CAGhC,KACI;EACL,QAAQJ,IAAI,CAACP,IAAI;IACf,KAAKX,OAAO,CAACY,gBAAgB;MAAE;QAC7B,OAAOS,cAAc,EAAE;MACzB;IACA,KAAKrB,OAAO,CAACc,iBAAiB;MAAE;QAC9B,OAAOQ,eAAe,EAAE;MAC1B;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
||||
163
_node_modules/effect/dist/esm/internal/channel/singleProducerAsyncInput.js
generated
vendored
Normal file
163
_node_modules/effect/dist/esm/internal/channel/singleProducerAsyncInput.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
import * as Cause from "../../Cause.js";
|
||||
import * as Deferred from "../../Deferred.js";
|
||||
import * as Effect from "../../Effect.js";
|
||||
import * as Either from "../../Either.js";
|
||||
import * as Exit from "../../Exit.js";
|
||||
import { pipe } from "../../Function.js";
|
||||
import * as Ref from "../../Ref.js";
|
||||
/** @internal */
|
||||
const OP_STATE_EMPTY = "Empty";
|
||||
/** @internal */
|
||||
const OP_STATE_EMIT = "Emit";
|
||||
/** @internal */
|
||||
const OP_STATE_ERROR = "Error";
|
||||
/** @internal */
|
||||
const OP_STATE_DONE = "Done";
|
||||
/** @internal */
|
||||
const stateEmpty = notifyProducer => ({
|
||||
_tag: OP_STATE_EMPTY,
|
||||
notifyProducer
|
||||
});
|
||||
/** @internal */
|
||||
const stateEmit = notifyConsumers => ({
|
||||
_tag: OP_STATE_EMIT,
|
||||
notifyConsumers
|
||||
});
|
||||
/** @internal */
|
||||
const stateError = cause => ({
|
||||
_tag: OP_STATE_ERROR,
|
||||
cause
|
||||
});
|
||||
/** @internal */
|
||||
const stateDone = done => ({
|
||||
_tag: OP_STATE_DONE,
|
||||
done
|
||||
});
|
||||
/** @internal */
|
||||
class SingleProducerAsyncInputImpl {
|
||||
ref;
|
||||
constructor(ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
awaitRead() {
|
||||
return Effect.flatten(Ref.modify(this.ref, state => state._tag === OP_STATE_EMPTY ? [Deferred.await(state.notifyProducer), state] : [Effect.void, state]));
|
||||
}
|
||||
get close() {
|
||||
return Effect.fiberIdWith(fiberId => this.error(Cause.interrupt(fiberId)));
|
||||
}
|
||||
done(value) {
|
||||
return Effect.flatten(Ref.modify(this.ref, state => {
|
||||
switch (state._tag) {
|
||||
case OP_STATE_EMPTY:
|
||||
{
|
||||
return [Deferred.await(state.notifyProducer), state];
|
||||
}
|
||||
case OP_STATE_EMIT:
|
||||
{
|
||||
return [Effect.forEach(state.notifyConsumers, deferred => Deferred.succeed(deferred, Either.left(value)), {
|
||||
discard: true
|
||||
}), stateDone(value)];
|
||||
}
|
||||
case OP_STATE_ERROR:
|
||||
{
|
||||
return [Effect.interrupt, state];
|
||||
}
|
||||
case OP_STATE_DONE:
|
||||
{
|
||||
return [Effect.interrupt, state];
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
emit(element) {
|
||||
return Effect.flatMap(Deferred.make(), deferred => Effect.flatten(Ref.modify(this.ref, state => {
|
||||
switch (state._tag) {
|
||||
case OP_STATE_EMPTY:
|
||||
{
|
||||
return [Deferred.await(state.notifyProducer), state];
|
||||
}
|
||||
case OP_STATE_EMIT:
|
||||
{
|
||||
const notifyConsumer = state.notifyConsumers[0];
|
||||
const notifyConsumers = state.notifyConsumers.slice(1);
|
||||
if (notifyConsumer !== undefined) {
|
||||
return [Deferred.succeed(notifyConsumer, Either.right(element)), notifyConsumers.length === 0 ? stateEmpty(deferred) : stateEmit(notifyConsumers)];
|
||||
}
|
||||
throw new Error("Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues");
|
||||
}
|
||||
case OP_STATE_ERROR:
|
||||
{
|
||||
return [Effect.interrupt, state];
|
||||
}
|
||||
case OP_STATE_DONE:
|
||||
{
|
||||
return [Effect.interrupt, state];
|
||||
}
|
||||
}
|
||||
})));
|
||||
}
|
||||
error(cause) {
|
||||
return Effect.flatten(Ref.modify(this.ref, state => {
|
||||
switch (state._tag) {
|
||||
case OP_STATE_EMPTY:
|
||||
{
|
||||
return [Deferred.await(state.notifyProducer), state];
|
||||
}
|
||||
case OP_STATE_EMIT:
|
||||
{
|
||||
return [Effect.forEach(state.notifyConsumers, deferred => Deferred.failCause(deferred, cause), {
|
||||
discard: true
|
||||
}), stateError(cause)];
|
||||
}
|
||||
case OP_STATE_ERROR:
|
||||
{
|
||||
return [Effect.interrupt, state];
|
||||
}
|
||||
case OP_STATE_DONE:
|
||||
{
|
||||
return [Effect.interrupt, state];
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
get take() {
|
||||
return this.takeWith(cause => Exit.failCause(Cause.map(cause, Either.left)), elem => Exit.succeed(elem), done => Exit.fail(Either.right(done)));
|
||||
}
|
||||
takeWith(onError, onElement, onDone) {
|
||||
return Effect.flatMap(Deferred.make(), deferred => Effect.flatten(Ref.modify(this.ref, state => {
|
||||
switch (state._tag) {
|
||||
case OP_STATE_EMPTY:
|
||||
{
|
||||
return [Effect.zipRight(Deferred.succeed(state.notifyProducer, void 0), Effect.matchCause(Deferred.await(deferred), {
|
||||
onFailure: onError,
|
||||
onSuccess: Either.match({
|
||||
onLeft: onDone,
|
||||
onRight: onElement
|
||||
})
|
||||
})), stateEmit([deferred])];
|
||||
}
|
||||
case OP_STATE_EMIT:
|
||||
{
|
||||
return [Effect.matchCause(Deferred.await(deferred), {
|
||||
onFailure: onError,
|
||||
onSuccess: Either.match({
|
||||
onLeft: onDone,
|
||||
onRight: onElement
|
||||
})
|
||||
}), stateEmit([...state.notifyConsumers, deferred])];
|
||||
}
|
||||
case OP_STATE_ERROR:
|
||||
{
|
||||
return [Effect.succeed(onError(state.cause)), state];
|
||||
}
|
||||
case OP_STATE_DONE:
|
||||
{
|
||||
return [Effect.succeed(onDone(state.done)), state];
|
||||
}
|
||||
}
|
||||
})));
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
export const make = () => pipe(Deferred.make(), Effect.flatMap(deferred => Ref.make(stateEmpty(deferred))), Effect.map(ref => new SingleProducerAsyncInputImpl(ref)));
|
||||
//# sourceMappingURL=singleProducerAsyncInput.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/singleProducerAsyncInput.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/singleProducerAsyncInput.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
152
_node_modules/effect/dist/esm/internal/channel/subexecutor.js
generated
vendored
Normal file
152
_node_modules/effect/dist/esm/internal/channel/subexecutor.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
import * as Effect from "../../Effect.js";
|
||||
import * as Exit from "../../Exit.js";
|
||||
import { pipe } from "../../Function.js";
|
||||
/** @internal */
|
||||
export const OP_PULL_FROM_CHILD = "PullFromChild";
|
||||
/** @internal */
|
||||
export const OP_PULL_FROM_UPSTREAM = "PullFromUpstream";
|
||||
/** @internal */
|
||||
export const OP_DRAIN_CHILD_EXECUTORS = "DrainChildExecutors";
|
||||
/** @internal */
|
||||
export const OP_EMIT = "Emit";
|
||||
/**
|
||||
* Execute the `childExecutor` and on each emitted value, decide what to do by
|
||||
* `onEmit`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class PullFromChild {
|
||||
childExecutor;
|
||||
parentSubexecutor;
|
||||
onEmit;
|
||||
_tag = OP_PULL_FROM_CHILD;
|
||||
constructor(childExecutor, parentSubexecutor, onEmit) {
|
||||
this.childExecutor = childExecutor;
|
||||
this.parentSubexecutor = parentSubexecutor;
|
||||
this.onEmit = onEmit;
|
||||
}
|
||||
close(exit) {
|
||||
const fin1 = this.childExecutor.close(exit);
|
||||
const fin2 = this.parentSubexecutor.close(exit);
|
||||
if (fin1 !== undefined && fin2 !== undefined) {
|
||||
return Effect.zipWith(Effect.exit(fin1), Effect.exit(fin2), (exit1, exit2) => pipe(exit1, Exit.zipRight(exit2)));
|
||||
} else if (fin1 !== undefined) {
|
||||
return fin1;
|
||||
} else if (fin2 !== undefined) {
|
||||
return fin2;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
enqueuePullFromChild(_child) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute `upstreamExecutor` and for each emitted element, spawn a child
|
||||
* channel and continue with processing it by `PullFromChild`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class PullFromUpstream {
|
||||
upstreamExecutor;
|
||||
createChild;
|
||||
lastDone;
|
||||
activeChildExecutors;
|
||||
combineChildResults;
|
||||
combineWithChildResult;
|
||||
onPull;
|
||||
onEmit;
|
||||
_tag = OP_PULL_FROM_UPSTREAM;
|
||||
constructor(upstreamExecutor, createChild, lastDone, activeChildExecutors, combineChildResults, combineWithChildResult, onPull, onEmit) {
|
||||
this.upstreamExecutor = upstreamExecutor;
|
||||
this.createChild = createChild;
|
||||
this.lastDone = lastDone;
|
||||
this.activeChildExecutors = activeChildExecutors;
|
||||
this.combineChildResults = combineChildResults;
|
||||
this.combineWithChildResult = combineWithChildResult;
|
||||
this.onPull = onPull;
|
||||
this.onEmit = onEmit;
|
||||
}
|
||||
close(exit) {
|
||||
const fin1 = this.upstreamExecutor.close(exit);
|
||||
const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];
|
||||
const result = fins.reduce((acc, next) => {
|
||||
if (acc !== undefined && next !== undefined) {
|
||||
return Effect.zipWith(acc, Effect.exit(next), (exit1, exit2) => Exit.zipRight(exit1, exit2));
|
||||
} else if (acc !== undefined) {
|
||||
return acc;
|
||||
} else if (next !== undefined) {
|
||||
return Effect.exit(next);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}, undefined);
|
||||
return result === undefined ? result : result;
|
||||
}
|
||||
enqueuePullFromChild(child) {
|
||||
return new PullFromUpstream(this.upstreamExecutor, this.createChild, this.lastDone, [...this.activeChildExecutors, child], this.combineChildResults, this.combineWithChildResult, this.onPull, this.onEmit);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Transformed from `PullFromUpstream` when upstream has finished but there
|
||||
* are still active child executors.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class DrainChildExecutors {
|
||||
upstreamExecutor;
|
||||
lastDone;
|
||||
activeChildExecutors;
|
||||
upstreamDone;
|
||||
combineChildResults;
|
||||
combineWithChildResult;
|
||||
onPull;
|
||||
_tag = OP_DRAIN_CHILD_EXECUTORS;
|
||||
constructor(upstreamExecutor, lastDone, activeChildExecutors, upstreamDone, combineChildResults, combineWithChildResult, onPull) {
|
||||
this.upstreamExecutor = upstreamExecutor;
|
||||
this.lastDone = lastDone;
|
||||
this.activeChildExecutors = activeChildExecutors;
|
||||
this.upstreamDone = upstreamDone;
|
||||
this.combineChildResults = combineChildResults;
|
||||
this.combineWithChildResult = combineWithChildResult;
|
||||
this.onPull = onPull;
|
||||
}
|
||||
close(exit) {
|
||||
const fin1 = this.upstreamExecutor.close(exit);
|
||||
const fins = [...this.activeChildExecutors.map(child => child !== undefined ? child.childExecutor.close(exit) : undefined), fin1];
|
||||
const result = fins.reduce((acc, next) => {
|
||||
if (acc !== undefined && next !== undefined) {
|
||||
return Effect.zipWith(acc, Effect.exit(next), (exit1, exit2) => Exit.zipRight(exit1, exit2));
|
||||
} else if (acc !== undefined) {
|
||||
return acc;
|
||||
} else if (next !== undefined) {
|
||||
return Effect.exit(next);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}, undefined);
|
||||
return result === undefined ? result : result;
|
||||
}
|
||||
enqueuePullFromChild(child) {
|
||||
return new DrainChildExecutors(this.upstreamExecutor, this.lastDone, [...this.activeChildExecutors, child], this.upstreamDone, this.combineChildResults, this.combineWithChildResult, this.onPull);
|
||||
}
|
||||
}
|
||||
/** @internal */
|
||||
export class Emit {
|
||||
value;
|
||||
next;
|
||||
_tag = OP_EMIT;
|
||||
constructor(value, next) {
|
||||
this.value = value;
|
||||
this.next = next;
|
||||
}
|
||||
close(exit) {
|
||||
const result = this.next.close(exit);
|
||||
return result === undefined ? result : result;
|
||||
}
|
||||
enqueuePullFromChild(_child) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=subexecutor.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/subexecutor.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/subexecutor.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
52
_node_modules/effect/dist/esm/internal/channel/upstreamPullRequest.js
generated
vendored
Normal file
52
_node_modules/effect/dist/esm/internal/channel/upstreamPullRequest.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import { dual } from "../../Function.js";
|
||||
import { hasProperty } from "../../Predicate.js";
|
||||
import * as OpCodes from "../opCodes/channelUpstreamPullRequest.js";
|
||||
/** @internal */
|
||||
const UpstreamPullRequestSymbolKey = "effect/ChannelUpstreamPullRequest";
|
||||
/** @internal */
|
||||
export const UpstreamPullRequestTypeId = /*#__PURE__*/Symbol.for(UpstreamPullRequestSymbolKey);
|
||||
const upstreamPullRequestVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
const proto = {
|
||||
[UpstreamPullRequestTypeId]: upstreamPullRequestVariance
|
||||
};
|
||||
/** @internal */
|
||||
export const Pulled = value => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_PULLED;
|
||||
op.value = value;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const NoUpstream = activeDownstreamCount => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_NO_UPSTREAM;
|
||||
op.activeDownstreamCount = activeDownstreamCount;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const isUpstreamPullRequest = u => hasProperty(u, UpstreamPullRequestTypeId);
|
||||
/** @internal */
|
||||
export const isPulled = self => self._tag === OpCodes.OP_PULLED;
|
||||
/** @internal */
|
||||
export const isNoUpstream = self => self._tag === OpCodes.OP_NO_UPSTREAM;
|
||||
/** @internal */
|
||||
export const match = /*#__PURE__*/dual(2, (self, {
|
||||
onNoUpstream,
|
||||
onPulled
|
||||
}) => {
|
||||
switch (self._tag) {
|
||||
case OpCodes.OP_PULLED:
|
||||
{
|
||||
return onPulled(self.value);
|
||||
}
|
||||
case OpCodes.OP_NO_UPSTREAM:
|
||||
{
|
||||
return onNoUpstream(self.activeDownstreamCount);
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=upstreamPullRequest.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/upstreamPullRequest.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/upstreamPullRequest.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"upstreamPullRequest.js","names":["dual","hasProperty","OpCodes","UpstreamPullRequestSymbolKey","UpstreamPullRequestTypeId","Symbol","for","upstreamPullRequestVariance","_A","_","proto","Pulled","value","op","Object","create","_tag","OP_PULLED","NoUpstream","activeDownstreamCount","OP_NO_UPSTREAM","isUpstreamPullRequest","u","isPulled","self","isNoUpstream","match","onNoUpstream","onPulled"],"sources":["../../../../src/internal/channel/upstreamPullRequest.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAI,QAAQ,mBAAmB;AACxC,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,OAAO,KAAKC,OAAO,MAAM,0CAA0C;AAEnE;AACA,MAAMC,4BAA4B,GAAG,mCAAmC;AAExE;AACA,OAAO,MAAMC,yBAAyB,gBAAkDC,MAAM,CAACC,GAAG,CAChGH,4BAA4B,CACoB;AAElD,MAAMI,2BAA2B,GAAG;EAClC;EACAC,EAAE,EAAGC,CAAQ,IAAKA;CACnB;AAED;AACA,MAAMC,KAAK,GAAG;EACZ,CAACN,yBAAyB,GAAGG;CAC9B;AAED;AACA,OAAO,MAAMI,MAAM,GAAOC,KAAQ,IAAgD;EAChF,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGd,OAAO,CAACe,SAAS;EAC3BJ,EAAE,CAACD,KAAK,GAAGA,KAAK;EAChB,OAAOC,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMK,UAAU,GAAIC,qBAA6B,IAAoD;EAC1G,MAAMN,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGd,OAAO,CAACkB,cAAc;EAChCP,EAAE,CAACM,qBAAqB,GAAGA,qBAAqB;EAChD,OAAON,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMQ,qBAAqB,GAAIC,CAAU,IAC9CrB,WAAW,CAACqB,CAAC,EAAElB,yBAAyB,CAAC;AAE3C;AACA,OAAO,MAAMmB,QAAQ,GACnBC,IAAgD,IACNA,IAAI,CAACR,IAAI,KAAKd,OAAO,CAACe,SAAS;AAE3E;AACA,OAAO,MAAMQ,YAAY,GACvBD,IAAgD,IACLA,IAAI,CAACR,IAAI,KAAKd,OAAO,CAACkB,cAAc;AAEjF;AACA,OAAO,MAAMM,KAAK,gBAAG1B,IAAI,CAcvB,CAAC,EAAE,CACHwB,IAAgD,EAChD;EAAEG,YAAY;EAAEC;AAAQ,CAGvB,KACI;EACL,QAAQJ,IAAI,CAACR,IAAI;IACf,KAAKd,OAAO,CAACe,SAAS;MAAE;QACtB,OAAOW,QAAQ,CAACJ,IAAI,CAACZ,KAAK,CAAC;MAC7B;IACA,KAAKV,OAAO,CAACkB,cAAc;MAAE;QAC3B,OAAOO,YAAY,CAACH,IAAI,CAACL,qBAAqB,CAAC;MACjD;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
||||
52
_node_modules/effect/dist/esm/internal/channel/upstreamPullStrategy.js
generated
vendored
Normal file
52
_node_modules/effect/dist/esm/internal/channel/upstreamPullStrategy.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import { dual } from "../../Function.js";
|
||||
import { hasProperty } from "../../Predicate.js";
|
||||
import * as OpCodes from "../opCodes/channelUpstreamPullStrategy.js";
|
||||
/** @internal */
|
||||
const UpstreamPullStrategySymbolKey = "effect/ChannelUpstreamPullStrategy";
|
||||
/** @internal */
|
||||
export const UpstreamPullStrategyTypeId = /*#__PURE__*/Symbol.for(UpstreamPullStrategySymbolKey);
|
||||
const upstreamPullStrategyVariance = {
|
||||
/* c8 ignore next */
|
||||
_A: _ => _
|
||||
};
|
||||
/** @internal */
|
||||
const proto = {
|
||||
[UpstreamPullStrategyTypeId]: upstreamPullStrategyVariance
|
||||
};
|
||||
/** @internal */
|
||||
export const PullAfterNext = emitSeparator => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_PULL_AFTER_NEXT;
|
||||
op.emitSeparator = emitSeparator;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const PullAfterAllEnqueued = emitSeparator => {
|
||||
const op = Object.create(proto);
|
||||
op._tag = OpCodes.OP_PULL_AFTER_ALL_ENQUEUED;
|
||||
op.emitSeparator = emitSeparator;
|
||||
return op;
|
||||
};
|
||||
/** @internal */
|
||||
export const isUpstreamPullStrategy = u => hasProperty(u, UpstreamPullStrategyTypeId);
|
||||
/** @internal */
|
||||
export const isPullAfterNext = self => self._tag === OpCodes.OP_PULL_AFTER_NEXT;
|
||||
/** @internal */
|
||||
export const isPullAfterAllEnqueued = self => self._tag === OpCodes.OP_PULL_AFTER_ALL_ENQUEUED;
|
||||
/** @internal */
|
||||
export const match = /*#__PURE__*/dual(2, (self, {
|
||||
onAllEnqueued,
|
||||
onNext
|
||||
}) => {
|
||||
switch (self._tag) {
|
||||
case OpCodes.OP_PULL_AFTER_NEXT:
|
||||
{
|
||||
return onNext(self.emitSeparator);
|
||||
}
|
||||
case OpCodes.OP_PULL_AFTER_ALL_ENQUEUED:
|
||||
{
|
||||
return onAllEnqueued(self.emitSeparator);
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=upstreamPullStrategy.js.map
|
||||
1
_node_modules/effect/dist/esm/internal/channel/upstreamPullStrategy.js.map
generated
vendored
Normal file
1
_node_modules/effect/dist/esm/internal/channel/upstreamPullStrategy.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"upstreamPullStrategy.js","names":["dual","hasProperty","OpCodes","UpstreamPullStrategySymbolKey","UpstreamPullStrategyTypeId","Symbol","for","upstreamPullStrategyVariance","_A","_","proto","PullAfterNext","emitSeparator","op","Object","create","_tag","OP_PULL_AFTER_NEXT","PullAfterAllEnqueued","OP_PULL_AFTER_ALL_ENQUEUED","isUpstreamPullStrategy","u","isPullAfterNext","self","isPullAfterAllEnqueued","match","onAllEnqueued","onNext"],"sources":["../../../../src/internal/channel/upstreamPullStrategy.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAI,QAAQ,mBAAmB;AAExC,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,OAAO,KAAKC,OAAO,MAAM,2CAA2C;AAEpE;AACA,MAAMC,6BAA6B,GAAG,oCAAoC;AAE1E;AACA,OAAO,MAAMC,0BAA0B,gBAAoDC,MAAM,CAACC,GAAG,CACnGH,6BAA6B,CACqB;AAEpD,MAAMI,4BAA4B,GAAG;EACnC;EACAC,EAAE,EAAGC,CAAQ,IAAKA;CACnB;AAED;AACA,MAAMC,KAAK,GAAG;EACZ,CAACN,0BAA0B,GAAGG;CAC/B;AAED;AACA,OAAO,MAAMI,aAAa,GAAOC,aAA+B,IAAkD;EAChH,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGd,OAAO,CAACe,kBAAkB;EACpCJ,EAAE,CAACD,aAAa,GAAGA,aAAa;EAChC,OAAOC,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMK,oBAAoB,GAC/BN,aAA+B,IACiB;EAChD,MAAMC,EAAE,GAAGC,MAAM,CAACC,MAAM,CAACL,KAAK,CAAC;EAC/BG,EAAE,CAACG,IAAI,GAAGd,OAAO,CAACiB,0BAA0B;EAC5CN,EAAE,CAACD,aAAa,GAAGA,aAAa;EAChC,OAAOC,EAAE;AACX,CAAC;AAED;AACA,OAAO,MAAMO,sBAAsB,GAAIC,CAAU,IAC/CpB,WAAW,CAACoB,CAAC,EAAEjB,0BAA0B,CAAC;AAE5C;AACA,OAAO,MAAMkB,eAAe,GAC1BC,IAAkD,IACAA,IAAI,CAACP,IAAI,KAAKd,OAAO,CAACe,kBAAkB;AAE5F;AACA,OAAO,MAAMO,sBAAsB,GACjCD,IAAkD,IACOA,IAAI,CAACP,IAAI,KAAKd,OAAO,CAACiB,0BAA0B;AAE3G;AACA,OAAO,MAAMM,KAAK,gBAAGzB,IAAI,CAcvB,CAAC,EAAE,CACHuB,IAAkD,EAClD;EAAEG,aAAa;EAAEC;AAAM,CAGtB,KACI;EACL,QAAQJ,IAAI,CAACP,IAAI;IACf,KAAKd,OAAO,CAACe,kBAAkB;MAAE;QAC/B,OAAOU,MAAM,CAACJ,IAAI,CAACX,aAAa,CAAC;MACnC;IACA,KAAKV,OAAO,CAACiB,0BAA0B;MAAE;QACvC,OAAOO,aAAa,CAACH,IAAI,CAACX,aAAa,CAAC;MAC1C;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
||||
Reference in New Issue
Block a user